- hydrolysis :
object Static analysis for Polymer.
- isSiblingOrAunt() ⇒
boolean Returns true if
pathais a sibling or aunt ofpathb.- redirectSibling() ⇒
string Change
localPathfrom a sibling ofbasePathto be a child ofbasePathjoined withredirect.- ProtocolRedirect(config)
A single redirect configuration
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
- .NoopResolver
- .RedirectResolver
- .XHRResolver
- .DocumentAST :
Object - .JSAST :
Object - .ParsedJS :
Object - .ElementDescriptor :
Object - .FeatureDescriptor :
Object - .BehaviorDescriptor :
Object - .DocumentDescriptor :
Object - .AnalyzedDocument :
Object - .LoadOptions :
Object - .Resolver :
Object
- .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()
- .elements :
- static
- .analyze(href, [options]) ⇒
Promise.<Analyzer>
- .analyze(href, [options]) ⇒
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 |
A list of all elements the Analyzer has metadata for.
Kind: instance property of Analyzer
A view into elements, keyed by tag name.
Kind: instance property of Analyzer
A list of API features added to Polymer.Base encountered by the
analyzer.
Kind: instance property of Analyzer
The behaviors collected by the analysis pass.
Kind: instance property of Analyzer
The behaviors collected by the analysis pass by name.
Kind: instance property of Analyzer
A map, keyed by absolute path, of Document metadata.
Kind: instance property of Analyzer
A map, keyed by path, of HTML document ASTs.
Kind: instance property of Analyzer
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
A map, keyed by path, of document content.
Kind: instance property of Analyzer
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. |
Returns the elements defined in the folder containing href.
Kind: instance method of Analyzer
| Param | Type | Description |
|---|---|---|
| href | string |
path to search. |
Returns the behaviors defined in the folder containing href.
Kind: instance method of Analyzer
| Param | Type | Description |
|---|---|---|
| href | string |
path to search. |
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. |
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. |
Calls dom5.nodeWalkAll on each document that Anayzler has laoded.
Kind: instance method of Analyzer
| Param | Type | Description |
|---|---|---|
| predicate | Object |
A dom5 predicate. |
Calls dom5.nodeWalkAll on each document that Anayzler has laoded.
Kind: instance method of Analyzer
| Param | Type | Description |
|---|---|---|
| predicate | Object |
A dom5 predicate. |
Annotates all loaded metadata with its documentation.
Kind: instance method of Analyzer
Removes redundant properties from the collected descriptors.
Kind: instance method of 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. |
Kind: static class of hydrolysis
- .FileLoader
- new FileLoader()
- .addResolver(resolver)
- .request(url) ⇒
Promise.<string>
A FileLoader lets you resolve URLs with a set of potential resolvers.
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. |
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. |
Kind: static class of hydrolysis
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. |
Kind: static class of hydrolysis
A resolver that resolves to null any uri matching config.
| Param | Type | Description |
|---|---|---|
| config | string |
The url to accept. |
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. |
Kind: static class of hydrolysis
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. |
Kind: static class of hydrolysis
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'. |
Parse5's representation of a parsed html document
Kind: static typedef of hydrolysis
espree's representation of a parsed html document
Kind: static typedef of hydrolysis
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. |
The metadata for a single polymer element
Kind: static typedef of hydrolysis
The metadata for a Polymer feature.
Kind: static typedef of hydrolysis
The metadata for a Polymer behavior mixin.
Kind: static typedef of hydrolysis
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 |
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 |
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. |
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. |
Returns true if patha is a sibling or aunt of pathb.
Change localPath from a sibling of basePath to be a child of
basePath joined with redirect.
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 :
The protocol this redirect matches.
Kind: instance property of ProtocolRedirect
The host name this redirect matches.
Kind: instance property of ProtocolRedirect
The part of the path to match and replace with 'redirectPath'
Kind: instance property of ProtocolRedirect
The local filesystem path that should replace "protocol://hosname/path/"
Kind: instance property of ProtocolRedirect