## Objects
hydrolysis : object

Static analysis for Polymer.

## Functions
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.

## hydrolysis : object Static analysis for Polymer. **Kind**: global namespace * [hydrolysis](#hydrolysis) : object * [.Analyzer](#hydrolysis.Analyzer) * [new Analyzer(attachAST, [loader])](#new_hydrolysis.Analyzer_new) * _instance_ * [.elements](#hydrolysis.Analyzer+elements) : Array.<ElementDescriptor> * [.elementsByTagName](#hydrolysis.Analyzer+elementsByTagName) : Object.<string, ElementDescriptor> * [.features](#hydrolysis.Analyzer+features) : Array.<FeatureDescriptor> * [.behaviors](#hydrolysis.Analyzer+behaviors) : Array.<BehaviorDescriptor> * [.behaviorsByName](#hydrolysis.Analyzer+behaviorsByName) : Object.<string, BehaviorDescriptor> * [.html](#hydrolysis.Analyzer+html) : Object.<string, AnalyzedDocument> * [.parsedDocuments](#hydrolysis.Analyzer+parsedDocuments) : Object * [.parsedScripts](#hydrolysis.Analyzer+parsedScripts) : Object.<string, Array.<ParsedJS>> * [._content](#hydrolysis.Analyzer+_content) : Object * [._getDependencies(href, [found], [transitive])](#hydrolysis.Analyzer+_getDependencies) ⇒ Array.<string> * [.metadataTree(href)](#hydrolysis.Analyzer+metadataTree) ⇒ Promise * [.getLoadedAst(href, [loaded])](#hydrolysis.Analyzer+getLoadedAst) ⇒ Promise.<DocumentAST> * [.nodeWalkDocuments(predicate)](#hydrolysis.Analyzer+nodeWalkDocuments) ⇒ Object * [.nodeWalkAllDocuments(predicate)](#hydrolysis.Analyzer+nodeWalkAllDocuments) ⇒ Object * [.annotate()](#hydrolysis.Analyzer+annotate) * [.clean()](#hydrolysis.Analyzer+clean) * _static_ * [.analyze(href, [options])](#hydrolysis.Analyzer.analyze) ⇒ Promise.<Analyzer> * [.FileLoader](#hydrolysis.FileLoader) * [new FileLoader()](#new_hydrolysis.FileLoader_new) * [.addResolver(resolver)](#hydrolysis.FileLoader+addResolver) * [.request(url)](#hydrolysis.FileLoader+request) ⇒ Promise.<string> * [.FSResolver](#hydrolysis.FSResolver) * [new FSResolver(config)](#new_hydrolysis.FSResolver_new) * [.NoopResolver](#hydrolysis.NoopResolver) * [new NoopResolver(config)](#new_hydrolysis.NoopResolver_new) * [.accept(uri, deferred)](#hydrolysis.NoopResolver+accept) ⇒ boolean * [.XHRResolver](#hydrolysis.XHRResolver) * [new XHRResolver(config)](#new_hydrolysis.XHRResolver_new) * [.DocumentAST](#hydrolysis.DocumentAST) : Object * [.JSAST](#hydrolysis.JSAST) : Object * [.ParsedJS](#hydrolysis.ParsedJS) : Object * [.ElementDescriptor](#hydrolysis.ElementDescriptor) : Object * [.FeatureDescriptor](#hydrolysis.FeatureDescriptor) : Object * [.BehaviorDescriptor](#hydrolysis.BehaviorDescriptor) : Object * [.DocumentDescriptor](#hydrolysis.DocumentDescriptor) : Object * [.AnalyzedDocument](#hydrolysis.AnalyzedDocument) : Object * [.LoadOptions](#hydrolysis.LoadOptions) : Object * [.Resolver](#hydrolysis.Resolver) : Object ### hydrolysis.Analyzer **Kind**: static class of [hydrolysis](#hydrolysis) * [.Analyzer](#hydrolysis.Analyzer) * [new Analyzer(attachAST, [loader])](#new_hydrolysis.Analyzer_new) * _instance_ * [.elements](#hydrolysis.Analyzer+elements) : Array.<ElementDescriptor> * [.elementsByTagName](#hydrolysis.Analyzer+elementsByTagName) : Object.<string, ElementDescriptor> * [.features](#hydrolysis.Analyzer+features) : Array.<FeatureDescriptor> * [.behaviors](#hydrolysis.Analyzer+behaviors) : Array.<BehaviorDescriptor> * [.behaviorsByName](#hydrolysis.Analyzer+behaviorsByName) : Object.<string, BehaviorDescriptor> * [.html](#hydrolysis.Analyzer+html) : Object.<string, AnalyzedDocument> * [.parsedDocuments](#hydrolysis.Analyzer+parsedDocuments) : Object * [.parsedScripts](#hydrolysis.Analyzer+parsedScripts) : Object.<string, Array.<ParsedJS>> * [._content](#hydrolysis.Analyzer+_content) : Object * [._getDependencies(href, [found], [transitive])](#hydrolysis.Analyzer+_getDependencies) ⇒ Array.<string> * [.metadataTree(href)](#hydrolysis.Analyzer+metadataTree) ⇒ Promise * [.getLoadedAst(href, [loaded])](#hydrolysis.Analyzer+getLoadedAst) ⇒ Promise.<DocumentAST> * [.nodeWalkDocuments(predicate)](#hydrolysis.Analyzer+nodeWalkDocuments) ⇒ Object * [.nodeWalkAllDocuments(predicate)](#hydrolysis.Analyzer+nodeWalkAllDocuments) ⇒ Object * [.annotate()](#hydrolysis.Analyzer+annotate) * [.clean()](#hydrolysis.Analyzer+clean) * _static_ * [.analyze(href, [options])](#hydrolysis.Analyzer.analyze) ⇒ 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](#hydrolysis.Analyzer) #### analyzer.elementsByTagName : Object.<string, ElementDescriptor> A view into `elements`, keyed by tag name. **Kind**: instance property of [Analyzer](#hydrolysis.Analyzer) #### analyzer.features : Array.<FeatureDescriptor> A list of API features added to `Polymer.Base` encountered by the analyzer. **Kind**: instance property of [Analyzer](#hydrolysis.Analyzer) #### analyzer.behaviors : Array.<BehaviorDescriptor> The behaviors collected by the analysis pass. **Kind**: instance property of [Analyzer](#hydrolysis.Analyzer) #### analyzer.behaviorsByName : Object.<string, BehaviorDescriptor> The behaviors collected by the analysis pass by name. **Kind**: instance property of [Analyzer](#hydrolysis.Analyzer) #### analyzer.html : Object.<string, AnalyzedDocument> A map, keyed by absolute path, of Document metadata. **Kind**: instance property of [Analyzer](#hydrolysis.Analyzer) #### analyzer.parsedDocuments : Object A map, keyed by path, of HTML document ASTs. **Kind**: instance property of [Analyzer](#hydrolysis.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](#hydrolysis.Analyzer) #### analyzer._content : Object A map, keyed by path, of document content. **Kind**: instance property of [Analyzer](#hydrolysis.Analyzer) #### analyzer._getDependencies(href, [found], [transitive]) ⇒ Array.<string> List all the html dependencies for the document at `href`. **Kind**: instance method of [Analyzer](#hydrolysis.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.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](#hydrolysis.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](#hydrolysis.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](#hydrolysis.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](#hydrolysis.Analyzer) | Param | Type | Description | | --- | --- | --- | | predicate | Object | A dom5 predicate. | #### analyzer.annotate() Annotates all loaded metadata with its documentation. **Kind**: instance method of [Analyzer](#hydrolysis.Analyzer) #### analyzer.clean() Removes redundant properties from the collected descriptors. **Kind**: instance method of [Analyzer](#hydrolysis.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](#hydrolysis.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](#hydrolysis) * [.FileLoader](#hydrolysis.FileLoader) * [new FileLoader()](#new_hydrolysis.FileLoader_new) * [.addResolver(resolver)](#hydrolysis.FileLoader+addResolver) * [.request(url)](#hydrolysis.FileLoader+request) ⇒ 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](#hydrolysis.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](#hydrolysis.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](#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](#hydrolysis) * [.NoopResolver](#hydrolysis.NoopResolver) * [new NoopResolver(config)](#new_hydrolysis.NoopResolver_new) * [.accept(uri, deferred)](#hydrolysis.NoopResolver+accept) ⇒ boolean #### 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](#hydrolysis.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.XHRResolver **Kind**: static class of [hydrolysis](#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) ### hydrolysis.JSAST : Object espree's representation of a parsed html document **Kind**: static typedef of [hydrolysis](#hydrolysis) ### hydrolysis.ParsedJS : Object Package of a parsed JS script **Kind**: static typedef of [hydrolysis](#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) ### hydrolysis.FeatureDescriptor : Object The metadata for a Polymer feature. **Kind**: static typedef of [hydrolysis](#hydrolysis) ### hydrolysis.BehaviorDescriptor : Object The metadata for a Polymer behavior mixin. **Kind**: static typedef of [hydrolysis](#hydrolysis) ### hydrolysis.DocumentDescriptor : Object The metadata for all features and elements defined in one document **Kind**: static typedef of [hydrolysis](#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](#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](#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](#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`. **Kind**: global function ## redirectSibling() ⇒ string Change `localPath` from a sibling of `basePath` to be a child of `basePath` joined with `redirect`. **Kind**: global function