{"_id":"postcss-selector-parser@7.1.7","bugs":{"url":"https://github.com/postcss/postcss-selector-parser/issues"},"dist":{"shasum":"70e353032ced41529d70b7662227a74eb001d31b","tarball":"http://registry-npm.ywwl.com/postcss-selector-parser/download/postcss-selector-parser-7.1.7.tgz","fileCount":37,"integrity":"sha512-wWBro/7hJ40ye6TPiXkUQoXKCw23xSsjriUvqd7Uls9Sso3oLiON1flc18cCdnjgCRXw4fBVqUJJeOdDTh3P3g==","signatures":[{"sig":"MEUCICnm+423vKNrsvkeZ2CulSCl1K9QWbtabAIGbUmc4LCwAiEAw4jHG8dDJg6kaMvC7pyMVVtgVI+p/g6QG03IkGKK1GA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDWF3wnH61nL6IHYszDn63w2PrvCVOJwLihjvSP/BATywIgXdkSDLVl035nL6PWlFdn0b9/6kAk1JaZ1cSfGyHJdrU="}],"unpackedSize":219780,"size":47677,"noattachment":false,"key":"/postcss-selector-parser/-/postcss-selector-parser-7.1.7.tgz"},"main":"dist/index.js","name":"postcss-selector-parser","types":"postcss-selector-parser.d.ts","engines":{"node":">=4"},"gitHead":"154c2b0e84c0d455d8f0b93473ef8f8fdcc7161f","license":"MIT","scripts":{"lint":"oxlint","test":"npm run lint && npm run typecheck && npm run coverage","build":"npm run clean && tsc","clean":"node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"","tests":"node --test src/__tests__/*.mjs","format":"oxfmt src","prepare":"npm run build","release":"npx npmpub","coverage":"node --enable-source-maps --test --experimental-test-coverage --test-coverage-exclude=\"**/__tests__/**\" --test-coverage-lines=94 --test-coverage-branches=94 --test-coverage-functions=96 --test-reporter=spec src/__tests__/*.mjs","lint:fix":"oxlint --fix","pretests":"npm run build","typecheck":"tsc --noEmit --strict postcss-selector-parser.d.ts postcss-selector-parser.test.ts","precoverage":"npm run build","format:check":"oxfmt --check src"},"version":"7.1.7","_npmUser":{"name":"moox","email":"npm@moox.io"},"homepage":"https://github.com/postcss/postcss-selector-parser","repository":{"url":"git+https://github.com/postcss/postcss-selector-parser.git","type":"git"},"_npmVersion":"11.16.0","description":"Selector parser with built in methods for working with selector strings.","directories":{},"maintainers":[{"name":"moox","email":"npm@moox.io"},{"name":"ai","email":"andrey@sitnik.es"},{"name":"chriseppstein","email":"chris@eppsteins.net"},{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},{"name":"evilebottnawi","email":"sheo13666q@gmail.com"}],"_nodeVersion":"26.3.1","contributors":[{"url":"https://moox.io","name":"Maxime Thirouin"},{"url":"http://beneb.info","name":"Ben Briggs","email":"beneb.info@gmail.com"},{"name":"Chris Eppstein","email":"chris@eppsteins.net"}],"dependencies":{"cssesc":"^3.0.0","util-deprecate":"^1.0.2"},"_hasShrinkwrap":false,"devDependencies":{"oxfmt":"^0.54.0","oxlint":"^1.69.0","postcss":"^8.4.31","typescript":"^5.4.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/postcss-selector-parser_7.1.7_1792487313003_0.3943865903913042"},"readme":"# postcss-selector-parser\n\n[![npm package version](https://img.shields.io/github/package-json/v/postcss/postcss-selector-parser) ![npm downloads](https://img.shields.io/npm/dm/postcss-selector-parser)](https://www.npmjs.com/package/postcss-selector-parser)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/postcss/postcss-selector-parser/test.yml)](https://github.com/postcss/postcss-selector-parser/actions)\n[![License](https://img.shields.io/github/license/postcss/postcss-selector-parser)](https://github.com/postcss/postcss-selector-parser)  \n\n> Selector parser with built in methods for working with selector strings.\n\n## Install\n\nWith [npm](https://npmjs.com/package/postcss-selector-parser) do:\n\n```\nnpm install postcss-selector-parser\n```\n\n## Quick Start\n\n```js\nconst parser = require('postcss-selector-parser');\nconst transform = selectors => {\n    selectors.walk(selector => {\n        // do something with the selector\n        console.log(String(selector))\n    });\n};\n\nconst transformed = parser(transform).processSync('h1, h2, h3');\n```\n\nTo normalize selector whitespace:\n\n```js\nconst parser = require('postcss-selector-parser');\nconst normalized = parser().processSync('h1, h2, h3', {lossless: false});\n// -> h1,h2,h3\n```\n\nAsync support is provided through `parser.process` and will resolve a Promise\nwith the resulting selector string.\n\n## API\n\nPlease see [API.md](API.md).\n\n## Security\n\n### Selector nesting depth (CVE-2026-9358)\n\nThe parser walks the selector AST recursively, both when parsing and when\nserializing it back to a string (`.toString()`). In versions up to and\nincluding `7.1.1`, a selector with extreme nesting — for example thousands of\nnested `:not(...)` — could recurse deeply enough to overflow the call stack and\nthrow `RangeError: Maximum call stack size exceeded`, a potential\ndenial-of-service when processing untrusted CSS.\n\nThis is now bounded by a maximum nesting depth (default: `256`). Beyond that\ndepth, parsing and serialization throw a regular, catchable `Error` at a\npredictable point instead of relying on the runtime hitting its stack limit.\nThe default is far above any realistic selector, so it does not affect normal\nuse.\n\n**Practical impact is low.** The only attacker-controlled input is the selector\nstring itself, which is now capped by the default limit. The limit is\nadjustable through the `maxNestingDepth` option, but that option is trusted\nconfiguration provided by the integrating code — it is never derived from the\nparsed CSS, so a malicious selector cannot change it:\n\n```js\n// Tighten the limit when parsing untrusted input:\nparser().processSync(untrustedSelector, {maxNestingDepth: 128});\n```\n\nRaising `maxNestingDepth` to a very large value is an explicit, informed choice\nand can reintroduce the stack-overflow risk in environments with a small call\nstack (e.g. browser workers). The default is recommended unless you have a\nspecific need.\n\n## Credits\n\n* Huge thanks to Andrey Sitnik (@ai) for work on PostCSS which helped\n  accelerate this module's development.\n\n## License\n\nMIT\n","publish_time":1792487313097,"_cnpm_publish_time":1792487313097,"dist-tags":{"latest":"7.2.1","legacy-v6":"6.1.6"}}