# polymer-analyzer

> Static analysis for Web Components

Latest version **3.2.4** (published 2019-07-09) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install polymer-analyzer
pnpm add polymer-analyzer
yarn add polymer-analyzer
bun add polymer-analyzer
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.2.4 |
| Published | 2019-07-09 |
| First published | 2016-08-01 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 37 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 437 |
| Author | The Polymer Project Authors |
| Maintainers | aomarks, azakus, bicknellr, emarquez, justinfagnani, keanulee, notwaldorf, polymer-devs, samli, sorvell, tvanderlippe, usergenic |

## Links

- npm: https://www.npmjs.com/package/polymer-analyzer
- Repository: https://github.com/Polymer/tools
- Homepage: https://github.com/Polymer/tools/tree/master/packages/analyzer
- Issues: https://github.com/Polymer/tools/issues
- npm.io page: https://npm.io/package/polymer-analyzer

## Dependencies (37)

- [dom5](https://npm.io/package/dom5.md) ^3.0.0
- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [clone](https://npm.io/package/clone.md) ^2.0.0
- [indent](https://npm.io/package/indent.md) 0.0.2
- [parse5](https://npm.io/package/parse5.md) ^4.0.0
- [stable](https://npm.io/package/stable.md) ^0.1.6
- [babylon](https://npm.io/package/babylon.md) ^7.0.0-beta.42
- [resolve](https://npm.io/package/resolve.md) ^1.5.0
- [doctrine](https://npm.io/package/doctrine.md) ^2.0.2
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.4
- [is-windows](https://npm.io/package/is-windows.md) ^1.0.2
- [jsonschema](https://npm.io/package/jsonschema.md) ^1.1.0
- [vscode-uri](https://npm.io/package/vscode-uri.md) =1.0.6
- [whatwg-url](https://npm.io/package/whatwg-url.md) ^6.4.0
- [cssbeautify](https://npm.io/package/cssbeautify.md) ^0.3.1
- [@babel/types](https://npm.io/package/@babel/types.md) ^7.0.0-beta.42
- [@types/chalk](https://npm.io/package/@types/chalk.md) ^0.4.30
- [@types/clone](https://npm.io/package/@types/clone.md) ^0.1.30
- [cancel-token](https://npm.io/package/cancel-token.md) ^0.1.1
- [strip-indent](https://npm.io/package/strip-indent.md) ^2.0.0
- [@types/parse5](https://npm.io/package/@types/parse5.md) ^2.2.34
- [@types/babylon](https://npm.io/package/@types/babylon.md) ^6.16.2
- [@types/resolve](https://npm.io/package/@types/resolve.md) 0.0.6
- [path-is-inside](https://npm.io/package/path-is-inside.md) ^1.0.2
- [@babel/traverse](https://npm.io/package/@babel/traverse.md) ^7.0.0-beta.42
- [@types/doctrine](https://npm.io/package/@types/doctrine.md) ^0.0.1
- [@babel/generator](https://npm.io/package/@babel/generator.md) ^7.0.0-beta.42
- [@types/minimatch](https://npm.io/package/@types/minimatch.md) ^3.0.1
- [shady-css-parser](https://npm.io/package/shady-css-parser.md) ^0.1.0
- [@types/is-windows](https://npm.io/package/@types/is-windows.md) ^0.2.0
- [@types/whatwg-url](https://npm.io/package/@types/whatwg-url.md) ^6.4.0
- [@types/babel-types](https://npm.io/package/@types/babel-types.md) ^6.25.1
- [@types/chai-subset](https://npm.io/package/@types/chai-subset.md) ^1.3.0
- [@types/cssbeautify](https://npm.io/package/@types/cssbeautify.md) ^0.3.1
- [@types/babel-traverse](https://npm.io/package/@types/babel-traverse.md) ^6.25.2
- [@types/path-is-inside](https://npm.io/package/@types/path-is-inside.md) ^1.0.0
- [@types/babel-generator](https://npm.io/package/@types/babel-generator.md) ^6.25.1

## Recent versions

- 3.2.4 (latest) — 2019-07-09
- 3.0.0-pre.25 (next) — 2018-05-04
- 3.2.3 — 2019-06-04
- 3.2.2 — 2019-01-10
- 3.2.1 — 2018-12-19
- 3.2.0 — 2018-12-05
- 3.1.3 — 2018-10-16
- 3.1.2 — 2018-08-24
- 3.1.1 — 2018-08-16
- 3.1.0 — 2018-07-26
- 3.0.2 — 2018-06-28
- 3.0.1 — 2018-05-14
- 3.0.0 — 2018-05-08
- 3.0.0-pre.24 — 2018-04-19
- 3.0.0-pre.23 — 2018-04-17
- … 76 more at https://npm.io/package/polymer-analyzer/versions

## README

[![Build Status](https://travis-ci.org/Polymer/polymer-analyzer.svg?branch=master)](https://travis-ci.org/Polymer/polymer-analyzer)
[![NPM version](http://img.shields.io/npm/v/polymer-analyzer.svg)](https://www.npmjs.com/package/polymer-analyzer)

# Polymer Analyzer

A static analysis framework for Web Components.

## Install

```
npm install polymer-analyzer
```

## Usage
```js
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?

* [webcomponents.org](https://webcomponents.org) - discovery, demos, and docs for web components
* [polymer-linter](https://github.com/Polymer/polymer-linter) - lints the web
* [polymer-build](https://github.com/Polymer/polymer-build) - performs HTML-aware buildtime optimization
* [polymer-editor-service](https://github.com/Polymer/polymer-editor-service) - IDE plugin, provides live as-you-type help

## Developing

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

```sh
npm install
npm test
```

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

```sh
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`](https://github.com/Polymer/polymer-analyzer/tree/hydrolysis-1.x)
branch.

---
_Source: https://npm.io/package/polymer-analyzer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
