{"name":"postcss-selector-parser","version":"7.1.2","license":"MIT","_id":"postcss-selector-parser@7.1.2","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"}],"contributors":[{"url":"http://beneb.info","name":"Ben Briggs","email":"beneb.info@gmail.com"},{"url":"http://twitter.com/chriseppstein","name":"Chris Eppstein","email":"chris@eppsteins.net"}],"homepage":"https://github.com/postcss/postcss-selector-parser","bugs":{"url":"https://github.com/postcss/postcss-selector-parser/issues"},"ava":{"require":["@babel/register"],"timeout":"25s","concurrency":5,"nodeArguments":[]},"nyc":{"exclude":["node_modules","**/__tests__"]},"dist":{"shasum":"e2dc51fc26c007a29bc3195ee9e68ca6df52e32e","tarball":"http://registry-npm.ywwl.com/postcss-selector-parser/download/postcss-selector-parser-7.1.2.tgz","fileCount":37,"integrity":"sha512-Wjvt4scRFouioIInHf51IFNP4ltJ2EngJM+cZPGiqbKetBfmP3vpdPV8ID2S6JS6/jdo74N8+aEYH9lQr2C6sA==","signatures":[{"sig":"MEQCIBKdn9CQJdBZJBfio7/xtGUpbNjjjcOgWKDgOJURLjCjAiBF4qK04LMDo/8UMcy0v1OIcdiodRZWsZu8PW2Y/dw8PQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":191810,"size":45010,"noattachment":false,"key":"/postcss-selector-parser/-/postcss-selector-parser-7.1.2.tgz"},"main":"dist/index.js","types":"postcss-selector-parser.d.ts","engines":{"node":">=4"},"gitHead":"1b81a3c27a21eded8d87e08749ebbd96f2de873b","scripts":{"test":"nyc ava src/__tests__/*.mjs --node-arguments=--no-experimental-detect-module","report":"nyc report --reporter=html","lintfix":"eslint --fix src","prepare":"del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/","pretest":"eslint src && npm run typecheck","release":"npx npmpub","testone":"ava","typecheck":"tsc --noEmit --strict postcss-selector-parser.d.ts postcss-selector-parser.test.ts","test:node-lt-20":"nyc ava src/__tests__/*.mjs"},"_npmUser":{"name":"moox","email":"npm@moox.io"},"repository":{"url":"git+https://github.com/postcss/postcss-selector-parser.git","type":"git"},"_npmVersion":"11.6.1","description":"[![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) [![GitHub Workflow Status","directories":{},"_nodeVersion":"24.11.0","dependencies":{"cssesc":"^3.0.0","util-deprecate":"^1.0.2"},"_hasShrinkwrap":false,"devDependencies":{"ava":"^5.1.0","nyc":"^15.1.0","glob":"^8.0.3","eslint":"^8.28.0","semver":"^7.3.2","del-cli":"^5.0.0","postcss":"^8.4.31","minimist":"^1.2.5","@babel/cli":"^7.11.6","typescript":"^4.0.3","@babel/core":"^7.11.6","coveralls-next":"^4.2.1","@babel/register":"^7.11.5","@babel/preset-env":"^7.11.5","@babel/eslint-parser":"^7.11.5","@babel/eslint-plugin":"^7.11.5","eslint-plugin-import":"^2.26.0","babel-plugin-add-module-exports":"^1.0.4","@babel/plugin-proposal-class-properties":"^7.10.4"},"_npmOperationalInternal":{"tmp":"tmp/postcss-selector-parser_7.1.2_1780990808654_0.9870375096452568","host":"s3://npm-registry-packages-npm-production"},"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":1780990808836,"_cnpm_publish_time":1780990808836,"dist-tags":{"latest":"7.2.1","legacy-v6":"6.1.6"}}