Switch branches/tags
web-component-tester@6.9.0-pre.1 web-component-tester@6.8.0 web-component-tester@6.7.1 web-component-tester@6.7.0 web-component-tester@6.6.0 wct-sauce@2.1.0 wct-sauce@2.0.3 wct-sauce@2.0.2 wct-mocha@1.0.0-pre.2 wct-local@2.1.2 wct-local@2.1.1 wct-browser-legacy@1.0.2 wct-browser-legacy@1.0.1 wct-browser-legacy@1.0.0 v0.0.20131107 v0.0.20131025 v0.0.20131010 v0.0.20131003 v0.0.20130912 v0.0.20130905 v0.0.20130829 polyserve@0.27.13 polyserve@0.27.12 polyserve@0.27.11 polyserve@0.27.10 polyserve@0.27.9 polyserve@0.27.8 polyserve@0.27.7 polyserve@0.27.6 polyserve@0.27.5 polyserve@0.27.4 polyserve@0.27.3 polyserve@0.27.2 polyserve@0.27.1 @polymer/tools-common@2.0.1 @polymer/gen-typescript-declarations@1.5.1 @polymer/gen-typescript-declarations@1.5.0 @polymer/esm-amd-loader@1.0.3 @polymer/esm-amd-loader@1.0.2 @polymer/esm-amd-loader@1.0.1 @polymer/esm-amd-loader@1.0.0 @polymer/esm-amd-loader@0.1.1 @polymer/esm-amd-loader@0.1.0 polymer-workspaces@2.2.0 polymer-project-config@4.0.2 polymer-project-config@4.0.1 polymer-project-config@4.0.0 polymer-project-config@3.14.0 polymer-modulizer@0.4.1 polymer-linter@3.0.1 polymer-linter@3.0.0 polymer-linter@3.0.0-pre.7 polymer-linter@3.0.0-pre.6 polymer-editor-service@2.2.2 polymer-editor-service@2.2.1 polymer-cli@1.9.0-pre.1 polymer-cli@1.8.0 polymer-cli@1.7.7 polymer-cli@1.7.6 polymer-cli@1.7.4 polymer-cli@1.7.3 polymer-cli@1.7.1 polymer-cli@1.7.0 polymer-cli@1.7.0-pre.17 polymer-cli@1.7.0-pre.16 polymer-cli@1.7.0-pre.15 polymer-cli@1.7.0-pre.14 polymer-cli@1.7.0-pre.13 polymer-cli@1.7.0-pre.12 polymer-cli@1.7.0-pre.11 polymer-cli@1.7.0-pre.10 polymer-cli@1.7.0-pre.9 polymer-cli@1.7.0-pre.8 polymer-cli@1.7.0-pre.7 polymer-cli@1.7.0-pre.6 polymer-cli@1.7.0-pre.5 polymer-bundler@4.0.4 polymer-bundler@4.0.3 polymer-bundler@4.0.2 polymer-bundler@4.0.0 polymer-bundler@4.0.0-pre.7 polymer-bundler@4.0.0-pre.6 polymer-bundler@4.0.0-pre.5 polymer-build@3.1.0 polymer-build@3.0.4 polymer-build@3.0.3 polymer-build@3.0.2 polymer-build@3.0.0 polymer-build@3.0.0-pre.17 polymer-build@3.0.0-pre.16 polymer-build@3.0.0-pre.15 polymer-build@3.0.0-pre.14 polymer-build@3.0.0-pre.13 polymer-build@3.0.0-pre.12 polymer-build@3.0.0-pre.11 polymer-build@3.0.0-pre.10 polymer-analyzer@3.1.3 polymer-analyzer@3.1.2 polymer-analyzer@3.1.1 polymer-analyzer@3.1.0
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
.github Add 'packages/analyzer/' from commit '42a13c053ad23bf53c60920a8678373… Apr 7, 2018
.vscode Apply the no-any lint rule to every repo except WCT (#177) Apr 20, 2018
custom_typings Remove the custom typing for stable.d.ts that was wrong. (#239) Apr 25, 2018
design
scripts Hoist and update typescript-json-schema to use common version of type… May 18, 2018
src Prepare release of packages (with WCT and CLI as minor version pre-re… Oct 16, 2018
test Standardize mocha scripts (#267) Apr 28, 2018
.editorconfig Add 'packages/analyzer/' from commit '42a13c053ad23bf53c60920a8678373… Apr 7, 2018
.gitattributes Add 'packages/analyzer/' from commit '42a13c053ad23bf53c60920a8678373… Apr 7, 2018
.gitignore
.npmignore Add 'packages/analyzer/' from commit '42a13c053ad23bf53c60920a8678373… Apr 7, 2018
CHANGELOG.md Prepare release of packages (with WCT and CLI as minor version pre-re… Oct 16, 2018
LICENSE Add 'packages/analyzer/' from commit '42a13c053ad23bf53c60920a8678373… Apr 7, 2018
README.md
appveyor.yml Add 'packages/analyzer/' from commit '42a13c053ad23bf53c60920a8678373… Apr 7, 2018
package-lock.json Prepare release of packages (with WCT and CLI as minor version pre-re… Oct 16, 2018
package.json Prepare release of packages (with WCT and CLI as minor version pre-re… Oct 16, 2018
tsconfig.json
tslint.json

README.md

Build Status NPM version

Polymer Analyzer

A static analysis framework for Web Components.

Install

npm install polymer-analyzer

Usage

const {Analyzer, FsUrlLoader, PackageUrlResolver} = require('polymer-analyzer');

const rootDir = process.cwd();
const analyzer = new Analyzer({
  urlLoader: new FsUrlLoader(rootDir),
  urlResolver: new PackageUrlResolver({ packageDir: rootDir }),
});

// This path is relative to the root dir
analyzer.analyze(['my-element.html']).then((analysis) => {
  // Print the name of every property on paper-button, and where it was
  // inherited from.
  const [paperButton] = analysis.getFeatures(
      {kind: 'element', id: 'paper-button', externalPackages: true});
  if (paperButton) {
    for (const [name, property] of paperButton.properties) {
      let message = `${name}`;
      if (property.inheritedFrom) {
        message += ` inherited from ${property.inheritedFrom}`;
      } else {
        message += ` was defined directly on paper-button`;
      }
      console.log(message);
    }
  } else {
    console.log(`my-element.html didn't define or import paper-button.`);
  }
});

What's it used for?

Developing

Polymer Analyzer is supported on Node LTS and stable. It is written in TypeScript. All development dependencies are installed via npm.

npm install
npm test

Or watch the source for changes, and run tests each time a file is modified:

npm run test:watch

Looking for Hydrolysis?

Hydrolysis has been renamed to Polymer Analyzer for version 2. You can find the hydrolysis source on the hydrolysis-1.x branch.