{"bugs":{"url":"https://github.com/ampproject/amp-toolbox/issues"},"dist":{"shasum":"5775c06d95d7a292a379cf5bcf8736b9fb5cc5c3","tarball":"https://registry.npmjs.org/@ampproject/toolbox-validator-rules/-/toolbox-validator-rules-2.8.0-canary.9.tgz","fileCount":6,"integrity":"sha512-hZI5Vox24ZkhyVEh4ZCkblFeC0WMh6g9VJqcE4dFLYIaH0QkBhaE6pPqkmy4lkzXBsz3e0LFEKXSCkO84tT0nw==","signatures":[{"sig":"MEYCIQCj/JwLfd10JJSedHM6GBCY7/O4sJTxwTtsKX3ZN7pHAwIhAPLzBe+A6zWcv8Z8Ps/9gKeV+/jOQ0vtGVzlg9PTYxNh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23674,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgWLFUCRA9TVsSAnZWagAAwfEP/1xKnQwWsyj2AT036UrX\ncCrsfkN7fPbI8cDE/1Sm7EQgjq5Ks0eHg0f44VpV9MNWMnaPCZNP4qDxSojW\n2YJQqnh+bP6j+OeNzCN7qN0almyiP71DbwoREFvrG0PoL9KEKnL1t3bjVrsx\nHN45C4BGV0TQUas3GLju3/S/TRV+mDoQCJTs19Du5HbE75C2Z7ZVH8EN1jE0\nFX6isCJTnS3P1WYskB8k/MPSvZSnrtIG+7QBUWQRKUVwclWl17GHwAYwDm6B\nSZ1tWOJP0VLqR8bRkzb+CLAWkgsWNIgJrRZn8LjvvQoSWkDX8mS/wDTsk/R1\na6eztENRh9M70s63H+Q6CBU6TzHJiX38WcxTrII1Z79xua6cRgYkz6UsPBEI\nA58aq3RbO4a61+gveo/sw5cHxC21377MrhH1uEuhBjvQyokwAClDhxDKxCth\nQSXmU+H2SlfqQKNuIQDkV+l4GN24zBl2NOLLveDF4KCtyfqZMic86K+DB0y3\nV70Qic5FJRijBwH5SevApSR5SpdqRhcV9PROOfPCdtxmZi5F7FxCsSKjlrns\nJJoW6uaMd/aIqeJ49bbkWiRm9MPddp4lHYbEjKE5MCp3ZolM6ylohe3gOxL0\nj8Q2Pu67uyw1c9A/juoG4A834Jqdx7lk8WPY1svFXpIhS9r46iKu/spfEL61\nMayr\r\n=h4ry\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","name":"@ampproject/toolbox-validator-rules","author":{"name":"AMPHTML Team"},"readme":"# AMP-Toolbox Validator Rules\n\n[![npm version](https://badge.fury.io/js/%40ampproject%2Ftoolbox-validator-rules.svg)](https://badge.fury.io/js/%40ampproject%2Ftoolbox-validator-rules)\n\nQueries published AMP Validator rules and extracts information about required\nmarkup and attributes for all AMP formats.\n\n## Usage\n\nInstall via:\n\n```\n$ npm install @ampproject/toolbox-validator-rules\n```\n\n### Including the Module\n\n#### ES Module (Browser)\n\n```javascript\nimport validatorRules from '@ampproject/toolbox-validator-rules';\n```\n\n#### CommonJs (Node)\n\n```javascript\nconst validatorRules = require('@ampproject/toolbox-validator-rules');\n```\n\n### Using the module\n\n```javascript\n  // Loads the validator rules remotely with default options\n  const rules = await validatorRules.fetch();\n\n\n  // The raw unprocessed rules\n  console.log(rules.raw);\n\n  // All tags, combined with their respective attribute lists\n  console.log(rules.tags);\n\n  // All extensions\n  console.log(rules.extensions);\n\n  // Get all tag names used in AMP for Email\n  // The supported formats are AMP, AMP4EMAIL, AMP4ADS and ACTIONS\n  const tags = rules.getTagsForFormat('AMP4EMAIL');\n\n  // Display their names\n  console.log(tags.map(tag => tag.tagName));\n\n  // Get information about an extension\n  const ext = rules.getExtension('AMP4EMAIL', 'amp-carousel');\n\n  // Display supported versions\n  console.log(ext.versions);\n```\n\n### Format of rules\n\nThe rules used closely follow the proto definitions from [validator.proto](https://github.com/ampproject/amphtml/blob/master/validator/validator.proto).\n\nSpecifically:\n\n-   The `raw` property is unprocessed [ValidatorRules](https://github.com/ampproject/amphtml/blob/master/validator/validator.proto#L643), the same format used by `https://cdn.ampproject.org/v0/validator.json`\n-   The result of `getTagsForFormat` and the `tags` property is a list of [TagSpec](https://github.com/ampproject/amphtml/blob/b892d81467594cab5473c803e071af5108f834a6/validator/validator.proto#L463)\n-   The result of `getExtension` is [ExtensionSpec](https://github.com/ampproject/amphtml/blob/b892d81467594cab5473c803e071af5108f834a6/validator/validator.proto#L388) with the `htmlFormat` field from `TagSpec`\n-   The `extensions` property a list of [ExtensionSpec](https://github.com/ampproject/amphtml/blob/b892d81467594cab5473c803e071af5108f834a6/validator/validator.proto#L388) with the `htmlFormat` field from `TagSpec`\n-   The `errors` property combines [ErrorFormat](https://github.com/ampproject/amphtml/blob/b892d81467594cab5473c803e071af5108f834a6/validator/validator.proto#L874) and [ErrorSpecificity](https://github.com/ampproject/amphtml/blob/b892d81467594cab5473c803e071af5108f834a6/validator/validator.proto#L869)\n\n### Options\n\n`fetch` optionally accepts an options object allowing you to customize its\nbehaviour.\n\nThe following options are supported:\n\n   * `noCache`: true to always fetch latest rules (by default, subsequent calls to `fetch` reuse the same result).\n   * `rules`: object to use locally specified rules instead of fetching them from the AMP CDN.\n   * `url`: override the URL where validator rules are fetched from.\n   * `source`: one of `'local'` (load rules from local file named \"validator.json\"), `'remote'` (fetch rules from CDN) or `'auto'` which is the default (tries looking for the local file first, then tries to fetch from CDN).\n\nExample:\n\n```\nvalidatorRules.fetch({\n  noCache: true,\n  source: 'remote'\n});\n```\n","gitHead":"0974deb66a4bf37062208de3f6dbeea1ba08fa36","license":"Apache-2.0","scripts":{"fetchRules":"curl https://cdn.ampproject.org/v0/validator.json --output validator.json"},"_npmUser":{"name":"amp-toolbox","email":"amp-toolbox-eng@google.com"},"homepage":"https://github.com/ampproject/amp-toolbox/tree/main/packages/validator-rules","keywords":["amp"],"repository":{"url":"git+https://github.com/ampproject/amp-toolbox.git","type":"git","directory":"packages/validator-rules"},"_npmVersion":"lerna/4.0.0/node@v14.15.4+x64 (darwin)","description":"A library that helps query AMP Validator rules","directories":{"lib":"lib"},"maintainers":[{"name":"ampproject-admin","email":"admin@ampproject.org"},{"name":"kristoferbaxter","email":"kbax@me.com"},{"name":"jridgewell","email":"justin+npm@ridgewell.name"},{"name":"choumx","email":"willchou@google.com"},{"name":"amp-toolbox","email":"amp-toolbox-eng@google.com"},{"name":"fstanis","email":"filip@stanis.me"},{"name":"erwinmombay","email":"erwin.mombay@gmail.com"},{"name":"samouri","email":"jzfisgreat@gmail.com"},{"name":"caroqliu","email":"carolineliu@google.com"},{"name":"rsimha","email":"rsimha@amp.dev"},{"name":"dvoytenko","email":"dvoytenko@gmail.com"},{"name":"patrickkettner","email":"patrickkettner@gmail.com"},{"name":"alanorozco","email":"orozcoalan@gmail.com"}],"_nodeVersion":"14.15.4","dependencies":{"cross-fetch":"3.1.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/toolbox-validator-rules_2.8.0-canary.9_1616425300065_0.18376790757481287","host":"s3://npm-registry-packages"},"_id":"@ampproject/toolbox-validator-rules@2.8.0-canary.9","version":"2.8.0-canary.9"}