{"name":"hast-util-parse-selector","version":"3.1.0","description":"hast utility to create an element from a simple CSS selector","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","css","selector","parse"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-parse-selector.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-parse-selector/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","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","typesVersions":{"<=4.1":{"extract.d.ts":["extract-legacy.d.ts"]}},"dependencies":{"@types/hast":"^2.0.0"},"devDependencies":{"@types/tape":"^4.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^9.0.0","remark-preset-wooorm":"^8.0.0","rimraf":"^3.0.0","tape":"^5.0.0","tsd":"^0.14.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.40.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && tsd && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"no-var":"off","prefer-arrow-callback":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"e56273ab0770348b70f7e5de4c628c5e5905544e","homepage":"https://github.com/syntax-tree/hast-util-parse-selector#readme","_id":"hast-util-parse-selector@3.1.0","_nodeVersion":"15.11.0","_npmVersion":"7.11.1","dist":{"integrity":"sha512-AyjlI2pTAZEOeu7GeBPZhROx0RHBnydkQIXlhnFzDi0qfXTmGUWoCYZtomHbrdrheV4VFUlPcfJ6LMF5T6sQzg==","shasum":"a519e27e8b61bd5a98fad494ed06131ce68d9c3f","tarball":"http://registry-npm.ywwl.com/hast-util-parse-selector/download/hast-util-parse-selector-3.1.0.tgz","fileCount":7,"unpackedSize":10451,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmC+7CRA9TVsSAnZWagAA9fAP/iuq5mngcXmIj3uYf74k\nSlzJzVZwlmQCwu5r6/h9sojCZ+Q1xnblF/VYQogbnUhn0bD2WzPfw+vGy35D\nZcoOphQXfaK8kj12rnmwRQ3nejwmKfSKB6X3AUBqwalEb5gDGf43eHOnAinj\nPnNQWlVZJXjPrO6SMa733siUce8MYwtbpTOF3THKKvIbUoh9DCd6TxsRZ86A\nChstUsoMIh2GOEDIlkX+t+eJV5Nnbxa6n8XSK6bS7w0TFCDz5p7ZZjsJ94On\nRDXbeu6phDh54tNs54TxFBDm+6FteMQdqBRIPGdIykg2n0KAUweh/hqnHTpK\nZd5Q91bn3Ix0jj0PaY+HA6qqScsRC2+bcNB4bQBH+fWG0cMOagU7u+LUtkmY\n1GTsU2nEyNM6qiyGGAvDRZ+mMu6WeEUO/GeIwajVKuDhoD3e5W7OmDjDLkQU\nf+SRaiMzn5B+zCYw/Kr5Lm+5q45azokwikCB8gGTKAKfOa8iGViJi2RkdvbR\n1IXJsGdO69PgiKgVKf4kagOveQr4q5j4RkmjBtezgOVvAOQp5jWeNL3X0V+s\nmBjhLxNIcy4uto+tLOaFuU+T88wB29vI7LvzB2hvB9qEMI7Iy447yzxV08FW\nY8bIHSOxNkyHh3j3s4iNVhGDgKQDCIyqu4ZVE2wecOsb9HPicwCdErDEIzxL\ngxr3\r\n=zRce\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgtZNgRVPWFPWKbOXQDvsPqNVfujOJToMzQbQ6M2kOiAIhAMRKVjd6N/ULROFIO6efDTyiyBMiDiQ7AlllwaWkWEGE"}],"size":3937,"noattachment":false,"key":"/hast-util-parse-selector/-/hast-util-parse-selector-3.1.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/hast-util-parse-selector_3.1.0_1620586426552_0.6212382828158132"},"_hasShrinkwrap":false,"readme":"# hast-util-parse-selector\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[hast][] utility to create an element from a simple CSS selector.\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    *   [`parseSelector(selector?[, defaultTagName])`](#parseselectorselector-defaulttagname)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a tiny utility that helps create elements.\n\n## When should I use this?\n\nThis utility is super niche.\nYou probably want the more powerful [`hastscript`][hastscript] or\n[`hast-util-from-selector`][hast-util-from-selector]\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install hast-util-parse-selector\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {parseSelector} from 'https://esm.sh/hast-util-parse-selector@4'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {parseSelector} from 'https://esm.sh/hast-util-parse-selector@4?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {parseSelector} from 'hast-util-parse-selector'\n\nconsole.log(parseSelector('.quux#bar.baz.qux'))\n```\n\nYields:\n\n```js\n{ type: 'element',\n  tagName: 'div',\n  properties: { id: 'bar', className: [ 'quux', 'baz', 'qux' ] },\n  children: [] }\n```\n\n## API\n\nThis package exports the identifier [`parseSelector`][api-parse-selector].\nThere is no default export.\n\n### `parseSelector(selector?[, defaultTagName])`\n\nCreate a hast element from a simple CSS selector.\n\n###### Parameters\n\n*   `selector` (`string`, optional)\n    —  simple CSS selector, can contain a tag name (`foo`), classes (`.bar`),\n    and an ID (`#baz`), multiple classes are allowed, uses the last ID if\n    multiple IDs are found\n*   `defaultTagName` (`string`, default: `'div'`)\n    — tag name to use if `selector` does not specify one\n\n###### Returns\n\nBuilt element ([`Element`][element]).\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\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`hast-util-parse-selector@^4`, compatible with Node.js 16.\n\n## Security\n\nImproper use of the `selector` or `defaultTagName` can open you up to a\n[cross-site scripting (XSS)][xss] attack as the value of `tagName`, when\nresolving to `script`, injects a `script` element into the syntax tree.\n\nDo not use user input in `selector` or use\n[`hast-util-santize`][hast-util-sanitize].\n\n## Related\n\n*   [`hast-util-from-selector`](https://github.com/syntax-tree/hast-util-from-selector)\n    — parse complex CSS selectors to nodes\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to 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<!-- Definitions -->\n\n[build-badge]: https://github.com/syntax-tree/hast-util-parse-selector/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/hast-util-parse-selector/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-parse-selector.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/hast-util-parse-selector\n\n[downloads-badge]: https://img.shields.io/npm/dm/hast-util-parse-selector.svg\n\n[downloads]: https://www.npmjs.com/package/hast-util-parse-selector\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-parse-selector\n\n[size]: https://bundlejs.com/?q=hast-util-parse-selector\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[hast]: https://github.com/syntax-tree/hast\n\n[hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize\n\n[hastscript]: https://github.com/syntax-tree/hastscript\n\n[hast-util-from-selector]: https://github.com/syntax-tree/hast-util-from-selector\n\n[element]: https://github.com/syntax-tree/hast#element\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[api-parse-selector]: #parseselectorselector-defaulttagname\n","publish_time":1620586426711,"_cnpm_publish_time":1620586426711,"dist-tags":{"latest":"4.0.0"}}