{"name":"rehype-sort-attributes","version":"4.0.0","description":"rehype plugin to reorder attributes based on how often they occur","license":"MIT","keywords":["unified","rehype","rehype-plugin","plugin","html","minify","mangle","attribute","sort"],"repository":{"type":"git","url":"git+https://github.com/rehypejs/rehype-minify.git#main"},"bugs":{"url":"https://github.com/rehypejs/rehype-minify/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/hast":"^2.0.0","unified":"^10.0.0","unist-util-visit":"^4.0.0"},"scripts":{"build":"rimraf \"*.d.ts\" && tsc && type-coverage","test":"node --conditions development test.js"},"xo":false,"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"homepage":"https://github.com/rehypejs/rehype-minify/tree/main#readme","_id":"rehype-sort-attributes@4.0.0","_nodeVersion":"16.2.0","_npmVersion":"7.18.1","dist":{"integrity":"sha512-sCT58e12F+fJL8ZmvpEP2vAK7cpYffUAf0cMQjNfLIewWjMHMGo0Io+H8eztJoI1S9dvEm2XZT5zzchqe8gYJw==","shasum":"b7766c864a370a07dd8ffa93b02c98322c20fe67","tarball":"http://registry-npm.ywwl.com/rehype-sort-attributes/download/rehype-sort-attributes-4.0.0.tgz","fileCount":4,"unpackedSize":7695,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhBvDxCRA9TVsSAnZWagAAFuYP/0YvQ/Opu7iTMFxPaksc\nW0d1XY8kG7D4b97trJYmC1CoBoTZX96S1Y05LyVIYjO2ceSK71AKuHZM0bIn\nStq+EB1TQ5gB06YMe+hLeSZpWChZiTGOoPzYMa7qdIpCsc+j04gLxpT8TeVS\n+cvfzySU7W6Kyr/1w1sQy60uTC1mfnvzcIZDP7jdWODOSuKzti2U0LsT5iTW\nDEbbbZMoI/AkWitQAaS/kseeggin9uy9i7zrJs3R4awoBS8ibi2nV3+MkEbC\nKBzhL/xLKbyhPc7eL4vjsC0eNXhQ1mv8Z3TnzQ3p7Xm59kb/2WNjLOf8c2dJ\nOyrRGyqAgqLspqKk/xJ40KHP1VLoXimaNXYFF6bVsuBvU4hFgjS0rViJb309\nwVgKybcP/wLhEdFwsV3au0MxF75AZLNp+Nhfmk2WxNnYAkBZXXeSgB9G7aRg\nv1B5xAyGsOB+/64eIFbL+sns/OdbdsJyMbIOAVSsbXIxGzaXE04EQVnF11MQ\n1jHqbAFnz+MzSw8hsHZkasQumrCoKs6sNp6YZYGl+M781aRaHNO3Ly9KNZyD\nWntetKqEow9P9fG5gCKAEtMKnbxXsu6iqUP1qftTmlaeP/OEbduqhkdlGocM\n5/P1LmLYVacHfXbFF6wAW2AgS4hD0IDF71a8rS3YzxI7dlYvaY9MhLlxfYPy\n4b/6\r\n=dxMi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBhldjNKeUXzIY71XpO49RlJh6BlsZAP+uNNbvKdbRXbAiEAz9unsqbj+SqO8vpTKFhqIiTjlmEW4r3YJNDE1t3sCDM="}],"size":2728,"noattachment":false,"key":"/rehype-sort-attributes/-/rehype-sort-attributes-4.0.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-sort-attributes_4.0.0_1627844848996_0.4040014519899422"},"_hasShrinkwrap":false,"readme":"<!--This file is generated-->\n\n# rehype-sort-attributes\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][funding-sponsors-badge]][funding]\n[![Backers][funding-backers-badge]][funding]\n[![Chat][chat-badge]][chat]\n\n**[rehype][]** plugin to sort attributes.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`unified().use(rehypeSortAttributeValues)`](#unifieduserehypesortattributevalues)\n*   [Example](#example)\n*   [Syntax](#syntax)\n*   [Syntax tree](#syntax-tree)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a plugin that sorts attributes based on how frequent they\noccur, which optimizes for repetition-based compression (such as GZip).\n\n## When should I use this?\n\nYou can use this plugin when you want to improve the transfer size of HTML\ndocuments.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install rehype-sort-attributes\n```\n\nIn Deno with [`esm.sh`][esm-sh]:\n\n```js\nimport rehypeSortAttributes from 'https://esm.sh/rehype-sort-attributes@5'\n```\n\nIn browsers with [`esm.sh`][esm-sh]:\n\n```html\n<script type=\"module\">\n  import rehypeSortAttributes from 'https://esm.sh/rehype-sort-attributes@5?bundle'\n</script>\n```\n\n## Use\n\nOn the API:\n\n```js\nimport rehypeParse from 'rehype-parse'\nimport rehypeSortAttributes from 'rehype-sort-attributes'\nimport rehypeStringify from 'rehype-stringify'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(rehypeParse)\n  .use(rehypeSortAttributes)\n  .use(rehypeStringify)\n  .process(await read('index.html'))\n\nconsole.log(String(file))\n```\n\nOn the CLI:\n\n```sh\nrehype input.html --use rehype-sort-attributes --output output.html\n```\n\nOn the CLI in a config file (here a `package.json`):\n\n```diff\n …\n \"rehype\": {\n   \"plugins\": [\n     …\n+    \"rehype-sort-attributes\",\n     …\n   ]\n }\n …\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is `rehypeSortAttributes`.\n\n### `unified().use(rehypeSortAttributeValues)`\n\nSort attributes.\n\n###### Returns\n\nTransform ([`Transformer`](https://github.com/unifiedjs/unified#transformer)).\n\n## Example\n\n###### In\n\n```html\n<div id=\"foo\">bar</div>\n<div class=\"baz\" id=\"qux\">quux</div>\n```\n\n###### Out\n\n```html\n<div id=\"foo\">bar</div>\n<div id=\"qux\" class=\"baz\">quux</div>\n```\n\n## Syntax\n\nHTML is parsed according to WHATWG HTML (the living standard), which is also\nfollowed by all browsers.\n\n## Syntax tree\n\nThe syntax tree used is [hast][].\n\n## Types\n\nThis package is fully typed with [TypeScript][].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`rehype-sort-attributes@^5`,\ncompatible with Node.js 16.\n\n## Security\n\nAs **rehype** works on HTML and improper use of HTML can open you up to a\n[cross-site scripting (XSS)][xss] attack, use of rehype can also be unsafe.\nUse [`rehype-sanitize`][rehype-sanitize] to make the tree safe.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`rehypejs/.github`][health] for ways\nto get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n[author]: https://wooorm.com\n\n[build]: https://github.com/rehypejs/rehype-minify/actions\n\n[build-badge]: https://github.com/rehypejs/rehype-minify/workflows/main/badge.svg\n\n[chat]: https://github.com/rehypejs/rehype/discussions\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[coc]: https://github.com/rehypejs/.github/blob/main/code-of-conduct.md\n\n[contributing]: https://github.com/rehypejs/.github/blob/main/contributing.md\n\n[coverage]: https://codecov.io/github/rehypejs/rehype-minify\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-minify.svg\n\n[downloads]: https://www.npmjs.com/package/rehype-sort-attributes\n\n[downloads-badge]: https://img.shields.io/npm/dm/rehype-sort-attributes.svg\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esm-sh]: https://esm.sh\n\n[funding]: https://opencollective.com/unified\n\n[funding-backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[funding-sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[hast]: https://github.com/syntax-tree/hast\n\n[health]: https://github.com/rehypejs/.github\n\n[license]: https://github.com/rehypejs/rehype-minify/blob/main/license\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize\n\n[size]: https://bundlejs.com/?q=rehype-sort-attributes\n\n[size-badge]: https://img.shields.io/bundlejs/size/rehype-sort-attributes\n\n[support]: https://github.com/rehypejs/.github/blob/main/support.md\n\n[typescript]: https://www.typescriptlang.org\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n","publish_time":1627844849156,"_cnpm_publish_time":1627844849156,"dist-tags":{"latest":"5.0.1"}}