Objects
- hydrolysis :
object
Static analysis for Polymer.
Functions
- isSiblingOrAunt() ⇒
boolean
Returns true if
patha
is a sibling or aunt ofpathb
.- redirectSibling() ⇒
string
Change
localPath
from a sibling ofbasePath
to be a child ofbasePath
joined withredirect
.- ProtocolRedirect(config)
A single redirect configuration
hydrolysis : object
Static analysis for Polymer.
Kind: global namespace
- hydrolysis :
object
- .Analyzer
- new Analyzer(attachAST, [loader])
- instance
- .elements :
Array.<ElementDescriptor>
- .elementsByTagName :
Object.<string, ElementDescriptor>
- .features :
Array.<FeatureDescriptor>
- .behaviors :
Array.<BehaviorDescriptor>
- .behaviorsByName :
Object.<string, BehaviorDescriptor>
- .html :
Object.<string, AnalyzedDocument>
- .parsedDocuments :
Object
- .parsedScripts :
Object.<string, Array.<ParsedJS>>
- ._content :
Object
- ._getDependencies(href, [found], [transitive]) ⇒
Array.<string>
- .elementsForFolder(href) ⇒
Array.<ElementDescriptor>
- .behaviorsForFolder(href) ⇒
Array.<BehaviorDescriptor>
- .metadataTree(href) ⇒
Promise
- .getLoadedAst(href, [loaded]) ⇒
Promise.<DocumentAST>
- .nodeWalkDocuments(predicate) ⇒
Object
- .nodeWalkAllDocuments(predicate) ⇒
Object
- .annotate()
- .clean()
- .elements :
- static
- .analyze(href, [options]) ⇒
Promise.<Analyzer>
- .analyze(href, [options]) ⇒
- .FileLoader
- new FileLoader()
- .addResolver(resolver)
- .request(url) ⇒
Promise.<string>
- .FSResolver
- new FSResolver(config)
- .NoopResolver
- new NoopResolver(config)
- .accept(uri, deferred) ⇒
boolean
- .RedirectResolver
- new RedirectResolver(config, redirects)
- .XHRResolver
- new XHRResolver(config)
- .DocumentAST :
Object
- .JSAST :
Object
- .ParsedJS :
Object
- .ElementDescriptor :
Object
- .FeatureDescriptor :
Object
- .BehaviorDescriptor :
Object
- .DocumentDescriptor :
Object
- .AnalyzedDocument :
Object
- .LoadOptions :
Object
- .Resolver :
Object
hydrolysis.Analyzer
Kind: static class of hydrolysis
- .Analyzer
- new Analyzer(attachAST, [loader])
- instance
- .elements :
Array.<ElementDescriptor>
- .elementsByTagName :
Object.<string, ElementDescriptor>
- .features :
Array.<FeatureDescriptor>
- .behaviors :
Array.<BehaviorDescriptor>
- .behaviorsByName :
Object.<string, BehaviorDescriptor>
- .html :
Object.<string, AnalyzedDocument>
- .parsedDocuments :
Object
- .parsedScripts :
Object.<string, Array.<ParsedJS>>
- ._content :
Object
- ._getDependencies(href, [found], [transitive]) ⇒
Array.<string>
- .elementsForFolder(href) ⇒
Array.<ElementDescriptor>
- .behaviorsForFolder(href) ⇒
Array.<BehaviorDescriptor>
- .metadataTree(href) ⇒
Promise
- .getLoadedAst(href, [loaded]) ⇒
Promise.<DocumentAST>
- .nodeWalkDocuments(predicate) ⇒
Object
- .nodeWalkAllDocuments(predicate) ⇒
Object
- .annotate()
- .clean()
- static
- .analyze(href, [options]) ⇒
Promise.<Analyzer>
new Analyzer(attachAST, [loader])
A database of Polymer metadata defined in HTML
Param | Type | Description |
---|---|---|
attachAST | boolean |
If true, attach a parse5 compliant AST |
[loader] | FileLoader |
An optional FileLoader used to load external resources |
analyzer.elements : Array.<ElementDescriptor>
A list of all elements the Analyzer
has metadata for.
Kind: instance property of Analyzer
analyzer.elementsByTagName : Object.<string, ElementDescriptor>
A view into elements
, keyed by tag name.
Kind: instance property of Analyzer
analyzer.features : Array.<FeatureDescriptor>
A list of API features added to Polymer.Base
encountered by the
analyzer.
Kind: instance property of Analyzer
analyzer.behaviors : Array.<BehaviorDescriptor>
The behaviors collected by the analysis pass.
Kind: instance property of Analyzer
analyzer.behaviorsByName : Object.<string, BehaviorDescriptor>
The behaviors collected by the analysis pass by name.
Kind: instance property of Analyzer
analyzer.html : Object.<string, AnalyzedDocument>
A map, keyed by absolute path, of Document metadata.
Kind: instance property of Analyzer
analyzer.parsedDocuments : Object
A map, keyed by path, of HTML document ASTs.
Kind: instance property of Analyzer
analyzer.parsedScripts : Object.<string, Array.<ParsedJS>>
A map, keyed by path, of JS script ASTs.
If the path is an HTML file with multiple scripts, the entry will be an array of scripts.
Kind: instance property of Analyzer
analyzer._content : Object
A map, keyed by path, of document content.
Kind: instance property of Analyzer
analyzer._getDependencies(href, [found], [transitive]) ⇒ Array.<string>
List all the html dependencies for the document at href
.
Kind: instance method of Analyzer
Returns: Array.<string>
- A list of all the html dependencies.
Param | Type | Description |
---|---|---|
href | string |
The href to get dependencies for. |
[found] | Object.<string, boolean> |
An object keyed by URL of the already resolved dependencies. |
[transitive] | boolean |
Whether to load transitive dependencies. Defaults to true. |
analyzer.elementsForFolder(href) ⇒ Array.<ElementDescriptor>
Returns the elements defined in the folder containing href
.
Kind: instance method of Analyzer
Param | Type | Description |
---|---|---|
href | string |
path to search. |
analyzer.behaviorsForFolder(href) ⇒ Array.<BehaviorDescriptor>
Returns the behaviors defined in the folder containing href
.
Kind: instance method of Analyzer
Param | Type | Description |
---|---|---|
href | string |
path to search. |
analyzer.metadataTree(href) ⇒ Promise
Returns a promise that resolves to a POJO representation of the import tree, in a format that maintains the ordering of the HTML imports spec.
Kind: instance method of Analyzer
Param | Type | Description |
---|---|---|
href | string |
the import to get metadata for. |
analyzer.getLoadedAst(href, [loaded]) ⇒ Promise.<DocumentAST>
Returns a promise resolving to a form of the AST with all links replaced with the document they link to. .css and .script files become <style> and <script>, respectively.
The elements in the loaded document are unmodified from their original documents.
Kind: instance method of Analyzer
Param | Type | Description |
---|---|---|
href | string |
The document to load. |
[loaded] | Object.<string, boolean> |
An object keyed by already loaded documents. |
analyzer.nodeWalkDocuments(predicate) ⇒ Object
Calls dom5.nodeWalkAll
on each document that Anayzler
has laoded.
Kind: instance method of Analyzer
Param | Type | Description |
---|---|---|
predicate | Object |
A dom5 predicate. |
analyzer.nodeWalkAllDocuments(predicate) ⇒ Object
Calls dom5.nodeWalkAll
on each document that Anayzler
has laoded.
Kind: instance method of Analyzer
Param | Type | Description |
---|---|---|
predicate | Object |
A dom5 predicate. |
analyzer.annotate()
Annotates all loaded metadata with its documentation.
Kind: instance method of Analyzer
analyzer.clean()
Removes redundant properties from the collected descriptors.
Kind: instance method of Analyzer
Analyzer.analyze(href, [options]) ⇒ Promise.<Analyzer>
Shorthand for transitively loading and processing all imports beginning at
href
.
In order to properly filter paths, href
must be an absolute URI.
Kind: static method of Analyzer
Returns: Promise.<Analyzer>
- A promise that will resolve once href
and its
dependencies have been loaded and analyzed.
Param | Type | Description |
---|---|---|
href | string |
The root import to begin loading from. |
[options] | LoadOptions |
Any additional options for the load. |
hydrolysis.FileLoader
Kind: static class of hydrolysis
- .FileLoader
- new FileLoader()
- .addResolver(resolver)
- .request(url) ⇒
Promise.<string>
new FileLoader()
A FileLoader lets you resolve URLs with a set of potential resolvers.
fileLoader.addResolver(resolver)
Add an instance of a Resolver class to the list of url resolvers
Ordering of resolvers is most to least recently added The first resolver to "accept" the url wins.
Kind: instance method of FileLoader
Param | Type | Description |
---|---|---|
resolver | Resolver |
The resolver to add. |
fileLoader.request(url) ⇒ Promise.<string>
Return a promise for an absolute url
Url requests are deduplicated by the loader, returning the same Promise for identical urls
Kind: instance method of FileLoader
Returns: Promise.<string>
- A promise that resolves to the contents of the URL.
Param | Type | Description |
---|---|---|
url | string |
The absolute url to request. |
hydrolysis.FSResolver
Kind: static class of hydrolysis
new FSResolver(config)
Resolves requests via the file system.
Param | Type | Description |
---|---|---|
config | Object |
configuration options. |
config.host | string |
Hostname to match for absolute urls. Matches "/" by default |
config.basePath | string |
Prefix directory for components in url. Defaults to "/". |
config.root | string |
Filesystem root to search. Defaults to the current working directory. |
config.redirect | string |
Where to redirect lookups to siblings. |
hydrolysis.NoopResolver
Kind: static class of hydrolysis
new NoopResolver(config)
A resolver that resolves to null any uri matching config.
Param | Type | Description |
---|---|---|
config | string |
The url to accept . |
noopResolver.accept(uri, deferred) ⇒ boolean
Kind: instance method of NoopResolver
Returns: boolean
- Whether the URI is handled by this resolver.
Param | Type | Description |
---|---|---|
uri | string |
The absolute URI being requested. |
deferred | Deferred |
The deferred promise that should be resolved if this resolver handles the URI. |
hydrolysis.RedirectResolver
Kind: static class of hydrolysis
new RedirectResolver(config, redirects)
Resolves protocol://hostname/path to the local filesystem.
Param | Type | Description |
---|---|---|
config | Object |
configuration options. |
config.root | string |
Filesystem root to search. Defaults to the current working directory. |
redirects | Array.<ProtocolRedirect> |
A list of protocol redirects for the resolver. They are checked for matching first-to-last. |
hydrolysis.XHRResolver
Kind: static class of hydrolysis
new XHRResolver(config)
Construct a resolver that requests resources over XHR.
Param | Type | Description |
---|---|---|
config | Object |
configuration arguments. |
config.responseType | string |
Type of object to be returned by the XHR. Defaults to 'text', accepts 'document', 'arraybuffer', and 'json'. |
hydrolysis.DocumentAST : Object
Parse5's representation of a parsed html document
Kind: static typedef of hydrolysis
hydrolysis.JSAST : Object
espree's representation of a parsed html document
Kind: static typedef of hydrolysis
hydrolysis.ParsedJS : Object
Package of a parsed JS script
Kind: static typedef of hydrolysis
Properties
Name | Type | Description |
---|---|---|
ast | JSAST |
The script's AST |
scriptElement | DocumentAST |
If inline, the script's containing tag. |
hydrolysis.ElementDescriptor : Object
The metadata for a single polymer element
Kind: static typedef of hydrolysis
hydrolysis.FeatureDescriptor : Object
The metadata for a Polymer feature.
Kind: static typedef of hydrolysis
hydrolysis.BehaviorDescriptor : Object
The metadata for a Polymer behavior mixin.
Kind: static typedef of hydrolysis
hydrolysis.DocumentDescriptor : Object
The metadata for all features and elements defined in one document
Kind: static typedef of hydrolysis
Properties
Name | Type | Description |
---|---|---|
elements | Array.<ElementDescriptor> |
The elements from the document |
features | Array.<FeatureDescriptor> |
The features from the document |
behaviors | Array.<FeatureDescriptor> |
The behaviors from the document |
hydrolysis.AnalyzedDocument : Object
The metadata of an entire HTML document, in promises.
Kind: static typedef of hydrolysis
Properties
Name | Type | Description |
---|---|---|
href | string |
The url of the document. |
htmlLoaded | Promise.<ParsedImport> |
The parsed representation of the doc. Use the ast property to get the full parse5 ast |
depsLoaded | Promise.<Array.<string>> |
Resolves to the list of this Document's transitive import dependencies |
depHrefs | Array.<string> |
The direct dependencies of the document. |
metadataLoaded | Promise.<DocumentDescriptor> |
Resolves to the list of this Document's import dependencies |
hydrolysis.LoadOptions : Object
Options for Analyzer.analzye
Kind: static typedef of hydrolysis
Properties
Name | Type | Description |
---|---|---|
noAnnotations | boolean |
Whether annotate() should be skipped. |
clean | boolean |
Whether the generated descriptors should be cleaned of redundant data. |
filter | function |
A predicate function that indicates which files should be ignored by the loader. By default all files not located under the dirname of href will be ignored. |
hydrolysis.Resolver : Object
An object that knows how to resolve resources.
Kind: static typedef of hydrolysis
Properties
Name | Type | Description |
---|---|---|
accept | function |
Attempt to resolve deferred with the contents the specified URL. Returns false if the Resolver is unable to resolve the URL. |
isSiblingOrAunt() ⇒ boolean
Returns true if patha
is a sibling or aunt of pathb
.
redirectSibling() ⇒ string
Change localPath
from a sibling of basePath
to be a child of
basePath
joined with redirect
.
ProtocolRedirect(config)
A single redirect configuration
Kind: global function
Param | Type | Description |
---|---|---|
config | Object |
The configuration object |
config.protocol | string |
The protocol this redirect matches. |
config.hostname | string |
The host name this redirect matches. |
config.path | string |
The part of the path to match and replace with 'redirectPath' |
config.redirectPath | string |
The local filesystem path that should replace "protocol://hosname/path/" |
- ProtocolRedirect(config)
- .protocol :
string
- .hostname :
string
- .path :
string
- .redirectPath :
string
- .protocol :
protocolRedirect.protocol : string
The protocol this redirect matches.
Kind: instance property of ProtocolRedirect
protocolRedirect.hostname : string
The host name this redirect matches.
Kind: instance property of ProtocolRedirect
protocolRedirect.path : string
The part of the path to match and replace with 'redirectPath'
Kind: instance property of ProtocolRedirect
protocolRedirect.redirectPath : string
The local filesystem path that should replace "protocol://hosname/path/"
Kind: instance property of ProtocolRedirect