{"_id":"@aarondrabeck/web-component-analyzer","_rev":"1-54137745794f6ab89b9987a417c78d29","name":"@aarondrabeck/web-component-analyzer","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@aarondrabeck/web-component-analyzer","version":"0.0.1","description":"A fork of web-component-analyzer with experimental json output geared towards web component storybook","main":"lib/index.cjs.js","typings":"lib/index.cjs.d.ts","scripts":{"prepare":"npm run build","build":"rollup -c","watch":"rollup -c --watch","pretest":"cd dev && npm install","test":"ava","lint":"","test:update":"ava --update-snapshots","test:watch":"ava --watch","prettier:check":"prettier --list-different \"src/**/*.{ts,tsx}\"","prettier:write":"prettier --write \"src/**/*.{ts,tsx}\""},"repository":{"type":"git","url":"git+https://github.com/runem/web-component-analyzer.git"},"keywords":["web components","web","components"],"contributors":[{"name":"Rune Mehlsen","url":"https://github.com/runem"}],"author":{"name":"Rune Mehlsen"},"license":"MIT","bugs":{"url":"https://github.com/runem/web-component-analyzer/issues"},"homepage":"https://github.com/runem/web-component-analyzer#readme","dependencies":{"fast-glob":"^3.1.0","ts-simple-type":"~0.3.6","typescript":"^3.6.4"},"devDependencies":{"@types/node":"^12.11.1","@wessberg/rollup-plugin-ts":"^1.1.72","ava":"^2.4.0","husky":"^3.0.9","prettier":"^1.18.2","pretty-quick":"^2.0.0","rollup":"^1.24.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-replace":"^2.2.0","ts-node":"^8.4.1","tslib":"^1.10.0"},"ava":{"compileEnhancements":false,"extensions":["ts"],"require":["ts-node/register"],"snapshotDir":"test/snapshots/results","files":["test/**/*.ts"],"helpers":["test/helpers/**/*"],"sources":["src/**/*"]},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"bin":{"wca":"cli.js"},"gitHead":"657e2c4f479887858c80b6d3dffa43f4d06dda08","_id":"@aarondrabeck/web-component-analyzer@0.0.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-FT2+u7Lra9dxPP2eSnilzuGQVziIPY8Ldd3WiZPy6B9pj3WKlwhg99oSv23EEonWExXxZ+pD/s4YMUAVvWKxCA==","shasum":"e8958869b834671034a17053d2a8781a2bdbd942","tarball":"https://registry.npmjs.org/@aarondrabeck/web-component-analyzer/-/web-component-analyzer-0.0.1.tgz","fileCount":7,"unpackedSize":210741,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzubZCRA9TVsSAnZWagAAvygP/0QDVgGjr7EpBKAMp2Lp\nz5D4UWHgV+EAr3eYvauimbG80WLSzxyn/1cXG08bPMO61jeqnQOt7QdPO7d2\nAGrhCumPHriG9vGFgtHkF26mIWOEla7objK6B1OkFfsJx632vZkrC0fsd7qD\nIV2lLe2ENbW5JRCT+QvqpDm4v4cd/mq+s/eMFu+rz2BkwniQ6c9dIvzLpeY1\nsHpfyfYYOwHDw2iEjs/sDR0x1vy/hfpg4TDgR51c8nW0Uch0GvhiqMN3x+8b\nN22H06b123YUOzGvj3iAl/NtlbgD0CUC2OU/6XyghWUX6wlnFKuEX6XnbE7r\nqsw6bcd/L4mHDNHHNznhjwoUbKjyTUnT9jpyUYX2Eb9EYl3TGrkh8DiEyfAO\nFa64OX0s2OW2ka+pfVc4vklU3sfRk2HARI0sZFkhEF0ILlqWF+2c5WxqTL03\nAg4otgax2Ng9F0r0A1gKUDw3q/GuVAtTK7/NXx3TjpxQ1UXsitYR/zlMV6F6\nrwcu0OebHSF3+JfieUisIV2LrKPLtqkHBa41g0yT4sbKG3QKTCipdy3JiQU+\nsWU8ZKNFFQ/n57XuCaGt8xD0fqYw/DS+/5EaYynw1N5vWC4TMTLUuaAt2OLE\nNR9YZdVRjuSnSikV0UxPecjG877VnNecmRWFbXJeadnZW0ktIQx4sq+g1N3N\n/QF2\r\n=uTJX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDUBzZb1p7Yk0P2qNPZoL3Q7c68B890dWcpMKDbCf0ZMQIhAJYO2lEiti6QokzxQwtAuPMpd67T7rqHdigzormCQ+Ot"}]},"maintainers":[{"name":"aarondrabeck","email":"github@aarondrabeck.com"}],"_npmUser":{"name":"aarondrabeck","email":"github@aarondrabeck.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/web-component-analyzer_0.0.1_1573840601087_0.8183542113807702"},"_hasShrinkwrap":false}},"time":{"created":"2019-11-15T17:56:40.842Z","0.0.1":"2019-11-15T17:56:41.274Z","modified":"2022-04-04T10:55:36.471Z"},"maintainers":[{"name":"aarondrabeck","email":"github@aarondrabeck.com"}],"description":"A fork of web-component-analyzer with experimental json output geared towards web component storybook","homepage":"https://github.com/runem/web-component-analyzer#readme","keywords":["web components","web","components"],"repository":{"type":"git","url":"git+https://github.com/runem/web-component-analyzer.git"},"contributors":[{"name":"Rune Mehlsen","url":"https://github.com/runem"}],"author":{"name":"Rune Mehlsen"},"bugs":{"url":"https://github.com/runem/web-component-analyzer/issues"},"license":"MIT","readme":"<h1 align=\"center\">web-component-analyzer</h1>\r\n\r\n<p align=\"center\">\r\n\t<a href=\"https://npmcharts.com/compare/web-component-analyzer?minimal=true\"><img alt=\"Downloads per month\" src=\"https://img.shields.io/npm/dm/web-component-analyzer.svg\" height=\"20\"/></a>\r\n\t<a href=\"https://www.npmjs.com/package/web-component-analyzer\"><img alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/web-component-analyzer.svg\" height=\"20\"/></a>\r\n\t<a href=\"https://david-dm.org/runem/web-component-analyzer\"><img alt=\"Dependencies\" src=\"https://img.shields.io/david/runem/web-component-analyzer.svg\" height=\"20\"/></a>\r\n\t<a href=\"https://github.com/runem/web-component-analyzer/graphs/contributors\"><img alt=\"Contributors\" src=\"https://img.shields.io/github/contributors/runem/web-component-analyzer.svg\" height=\"20\"/></a>\r\n</p>\r\n\r\n<p align=\"center\">\r\n  <img src=\"https://user-images.githubusercontent.com/5372940/68087781-1044ce80-fe59-11e9-969c-4234f9287f1b.gif\" alt=\"Web component analyzer GIF\"/>\r\n</p>\r\n\r\n`web-component-analyzer` is a CLI that makes it possible to easily analyze web components. It analyzes your code and jsdoc in order to extract `properties`, `attributes`, `methods`, `events`, `slots`, `css shadow parts` and `css custom properties`. Works with both javascript and typescript.\r\n\r\nTry the online playground [here](https://runem.github.io/web-component-analyzer/)\r\n\r\nIn addition to [vanilla web components](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) this tool supports web components built with the following libraries:\r\n\r\n- [lit-element](https://github.com/Polymer/lit-element)\r\n- [polymer](https://github.com/Polymer/polymer)\r\n- [stencil](https://github.com/ionic-team/stencil) (partial)\r\n- [open an issue for library requests](https://github.com/runem/web-component-analyzer/issues)\r\n\r\n[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#installation)\r\n\r\n## ➤ Installation\r\n\r\n<!-- prettier-ignore -->\r\n```bash\r\n$ npm install -g web-component-analyzer\r\n```\r\n\r\n[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#usage)\r\n\r\n## Analyze\r\n\r\nThe analyze command analyses an optional `input glob` and emits the output to the console as default. When the `input glob` is omitted it will find all components excluding `node_modules`. The default format is `markdown`.\r\n\r\n<img src=\"https://user-images.githubusercontent.com/5372940/54445420-02fd9700-4745-11e9-9305-47d6ec3c6307.gif\" />\r\n\r\n<!-- prettier-ignore -->\r\n```bash\r\n$ wca analyze\r\n$ wca analyze src --format markdown\r\n$ wca analyze \"src/**/*.{js,ts}\" --outDir components\r\n$ wca analyze my-element.js --outFile custom-elements.json\r\n```\r\n\r\n### Options\r\n\r\n| Option               | Type                             | Description                                                                  |\r\n| -------------------- | -------------------------------- | ---------------------------------------------------------------------------- |\r\n| `--format FORMAT`    | `markdown` \\| `json` \\| `vscode` | Specify output format.                                                       |\r\n| `--outFile FILE`     | `file path`                      | Concatenate and emit output to a single file.                                |\r\n| `--outDir DIRECTORY` | `directory path`                 | Direct output to a directory where each file corresponds to a web component. |\r\n\r\n[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#api)\r\n\r\n## Output Formats\r\n\r\n### json\r\n\r\n```bash\r\nwca analyze src --format json --outFile custom-elements.json\r\n```\r\n\r\nTry the online playground [here](https://runem.github.io/web-component-analyzer?format=json)\r\n\r\nThis json format is for experimental and demo purposes, and is still being actively discussed. You can expect changes to this format. Please follow and contribute to the discussion at:\r\n\r\n- https://github.com/webcomponents/custom-elements-json\r\n- https://github.com/w3c/webcomponents/issues/776\r\n\r\n### markdown\r\n\r\n```bash\r\nwca analyze src --format markdown --outDir readme\r\n```\r\n\r\nTry the online playground [here](https://runem.github.io/web-component-analyzer?format=markdown)\r\n\r\nWeb Component Analyzer can output markdown documentation of your web components. This can either be output into a single file using `--outFile` or into multiple files using `--outDir`.\r\n\r\n### vscode\r\n\r\n```bash\r\nwca analyze src --format vscode --outFile vscode-html-custom-data.json\r\n```\r\n\r\nVSCode supports a JSON format called [vscode custom data](https://github.com/microsoft/vscode-custom-data) for the built in html editor which is set using `html.customData` vscode setting. Web Component Analyzer can output this format.\r\n\r\n[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#how-does-this-tool-analyze-my-components)\r\n\r\n## ➤ API\r\n\r\nYou can also use the underlying functionality of this tool if you don't want to use the CLI. Documentation will be added as soon as the API is considered stable.\r\n\r\n<!-- prettier-ignore -->\r\n```typescript\r\nimport { analyzeComponents } from \"web-component-analyzer\";\r\n\r\nanalyzeComponents(sourceFile, { checker });\r\n```\r\n\r\n[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#how-does-this-tool-analyze-my-components)\r\n\r\n## ➤ How does this tool analyze my components?\r\n\r\nThis tool extract information about your components by looking at your code directly and by looking at your JSDoc comments.\r\n\r\n**Code**: Web Component Analyzer supports multiple libraries. [Click here](https://github.com/runem/web-component-analyzer/blob/master/ANALYZE.md) for an overview of how each library is analyzed.\r\n\r\n**JSDoc**: Read next section to learn more about how JSDoc is analyzed.\r\n\r\n[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#how-to-document-your-components-using-jsdoc)\r\n\r\n## ➤ How to document your components using JSDoc\r\n\r\nIn addition to analyzing the code of your components, this library also use JSDoc to construct the documentation. It's especially a good idea to use JSDoc for documenting `slots`, `events`, `css custom properties` and `css shadow parts` as these not analyzed statically by this tool as of now (except when constructing a CustomEvent within your component).\r\n\r\nHere's an example including all supported JSDoc tags. All JSDoc tags are on the the form `@tag {type} name - comment`.\r\n\r\n<!-- prettier-ignore -->\r\n```javascript\r\n/**\r\n * Here is a description of my web component.\r\n * \r\n * @element my-element\r\n * \r\n * @fires change - This jsdoc tag makes it possible to document events.\r\n * @fires submit\r\n * \r\n * @attr {Boolean} disabled - This jsdoc tag documents an attribute.\r\n * @attr {on|off} switch - Here is an attribute with either the \"on\" or \"off\" value.\r\n * @attr my-attr\r\n * \r\n * @prop {String} myProp - You can use this jsdoc tag to document properties.\r\n * @prop value\r\n * \r\n * @slot - This is an unnamed slot (the default slot)\r\n * @slot start - This is a slot named \"start\".\r\n * @slot end\r\n * \r\n * @cssprop --main-bg-color - This jsdoc tag can be used to document css custom properties.\r\n * @cssprop --main-color\r\n\r\n * @csspart container \r\n */\r\nclass MyElement extends HTMLElement {\r\n\r\n /**\r\n  * This is a description of a property with an attribute with exactly the same name: \"color\".\r\n  * @type {\"red\"|\"green\"|\"blue\"}\r\n  * @attr\r\n  */\r\n  color = \"red\";\r\n\r\n  /**\r\n   * This is a description of a property with an attribute called \"my-prop\".\r\n   * @type {number}\r\n   * @deprecated\r\n   * @attr my-prop\r\n   */\r\n  myProp = 10\r\n\r\n}\r\n```\r\n\r\n### Overview of supported JSDoc tags\r\n\r\n| JSDoc Tag                    | Description                                                                                                                                  |\r\n| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |\r\n| `@element`                   | Gives your component a tag name. This JSDoc tag is useful if your 'customElements.define` is called dynamically eg. using a custom function. |\r\n| `@fires`                     | Documents events.                                                                                                                            |\r\n| `@slot`                      | Documents slots. Using an empty name here documents the unnamed (default) slot.                                                              |\r\n| `@attr` or `@attribute`      | Documents an attribute on your component.                                                                                                    |\r\n| `@prop` or `@property`       | Documents a property on your component.                                                                                                      |\r\n| `@cssprop` or `@cssproperty` | Documents a css custom property on your component.                                                                                           |\r\n| `@csspart`                   | Documents a css shadow part on your component.                                                                                               |\r\n\r\n[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#contributors)\r\n\r\n## ➤ Contributors\r\n\r\n| [<img alt=\"Rune Mehlsen\" src=\"https://avatars0.githubusercontent.com/u/5372940?s=400&u=43d97899257af3c47715679512919eadb07eab26&v=4\" width=\"100\">](https://github.com/runem) |\r\n| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |\r\n|                                                                   [Rune Mehlsen](https://github.com/runem)                                                                   |\r\n\r\n[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#license)\r\n\r\n## ➤ License\r\n\r\nLicensed under [MIT](https://opensource.org/licenses/MIT).\r\n","readmeFilename":"README.md"}