{"name":"detective-postcss","version":"8.0.3","keywords":[],"author":{"name":"Joscha Feth","email":"joscha@feth.com"},"license":"MIT","_id":"detective-postcss@8.0.3","maintainers":[{"name":"joscha","email":"joscha@feth.com"},{"name":"xhmikosr","email":"xhmikosr@gmail.com"}],"homepage":"https://github.com/dependents/node-detective-postcss#readme","bugs":{"url":"https://github.com/dependents/node-detective-postcss/issues"},"dist":{"shasum":"a947494e55a68d0a271d4593714b51be7efe3014","tarball":"http://registry-npm.ywwl.com/detective-postcss/download/detective-postcss-8.0.3.tgz","fileCount":5,"integrity":"sha512-0AQjxn13b14tLmeXQq0QAFXSP6vBZhWFfmEazyFQ+JVlVwfrYlKF6dGy4R06hqAiSZ9cRvFx0FW4uvVnx0WXiw==","signatures":[{"sig":"MEYCIQCgUrtLrxsyPaJEJRxY9fh+UaisRTERzT6/MeJGLMxWSgIhAIK/lbk7UYTT4bFj+LDyzM7P7SlAwb94K6ynJBuVK2bF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/detective-postcss@8.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":10676,"size":4058,"noattachment":false,"key":"/detective-postcss/-/detective-postcss-8.0.3.tgz"},"main":"dist/index.js","engines":{"node":">=18"},"gitHead":"457986faa04de50a5fdaaf6155e3bed1377d84a3","scripts":{"test":"jest --ci","build":"rimraf ./dist && npm run compile","compile":"tsc","prepack":"npm run build","pretest":"prettier --check .","prettier":"prettier --write .","precommit":"lint-staged","test:watch":"jest --watch --notify"},"typings":"dist/index.d.ts","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:783ced02-e9a7-48b4-ab9e-b31a4e9f9370"}},"repository":{"url":"git+https://github.com/dependents/node-detective-postcss.git","type":"git"},"_npmVersion":"11.11.0","description":"Detective to find dependents of CSS (PostCSS dialect)","directories":{},"_nodeVersion":"24.14.1","dependencies":{"is-url-superb":"^4.0.0","postcss-values-parser":"^6.0.2"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.3.0","rimraf":"^6.1.3","postcss":"^8.5.10","ts-jest":"^29.4.9","prettier":"^3.8.3","typescript":"^6.0.3","@types/jest":"^30.0.0","@types/node":"^18.19.130","lint-staged":"^16.4.0"},"peerDependencies":{"postcss":"^8.4.47"},"_npmOperationalInternal":{"tmp":"tmp/detective-postcss_8.0.3_1776961064204_0.018400846447802044","host":"s3://npm-registry-packages-npm-production"},"readme":"# node-detective-postcss\n\n[![build](https://img.shields.io/github/actions/workflow/status/dependents/node-detective-postcss/node.js.yml?branch=main&label=CI&logo=github)](https://github.com/dependents/node-detective-postcss/actions/workflows/node.js.yml?query=branch%3Amain)\n[![npm version](https://img.shields.io/npm/v/detective-postcss?logo=npm&logoColor=fff)](https://www.npmjs.com/package/detective-postcss)\n[![npm downloads](https://img.shields.io/npm/dm/detective-postcss)](https://www.npmjs.com/package/detective-postcss)\n\n> Find the dependencies of a CSS file (PostCSS dialect)\n\nSupports `@import` and [`@value ... from`](https://github.com/css-modules/postcss-icss-values). Absolute and protocol-relative URLs are automatically filtered out.\n\nThe AST is generated using [postcss](https://github.com/postcss/postcss) and [postcss-values-parser](https://github.com/shellscape/postcss-values-parser).\n\n## Installation\n\n```sh\nnpm install detective-postcss\n```\n\n`postcss` must be installed separately as a peer dependency:\n\n```sh\nnpm install postcss\n```\n\n## Usage\n\n```js\n// ESM\nimport { readFileSync } from 'node:fs';\nimport detective from 'detective-postcss';\n// CommonJS\nconst { readFileSync } = require('node:fs');\nconst detective = require('detective-postcss');\n\nconst content = readFileSync('styles.css', 'utf8');\n\n// Returns an array of imported file paths (e.g. ['foo.css', 'bar.css'])\nconst dependencies = detective(content);\n\n// Also include url() references (images, fonts, etc.) found in declarations\nconst allDependencies = detective(content, { url: true });\n```\n\n## API\n\n### `detective(src, options?)`\n\n| Parameter     | Type      | Required | Description                                                                                                                |\n| ------------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |\n| `src`         | `string`  | Yes      | CSS source code to analyse                                                                                                 |\n| `options.url` | `boolean` | No       | When `true`, also extracts `url()` references from declarations (e.g. `background`, `src`, `cursor`). Defaults to `false`. |\n\nReturns `string[]` - the list of local dependency paths found in the source.\n\nThrows `detective.MalformedCssError` if `src` cannot be parsed.\n\n#### What is detected\n\n| Syntax                     | Example                            | Detected by default       |\n| -------------------------- | ---------------------------------- | ------------------------- |\n| `@import \"file.css\"`       | `@import \"theme.css\"`              | yes                       |\n| `@import url(file.css)`    | `@import url(print.css)`           | yes                       |\n| `@value x from \"file.css\"` | `@value primary from 'colors.css'` | yes                       |\n| `url()` in declarations    | `background: url(bg.png)`          | only with `{ url: true }` |\n\nAbsolute URLs (`https://...`) and protocol-relative URLs (`//...`) are always ignored.\n\n## Related\n\nThis is the CSS (PostCSS dialect) counterpart to:\n\n- [detective-cjs](https://github.com/dependents/node-detective-cjs) - CommonJS\n- [detective-amd](https://github.com/dependents/node-detective-amd) - AMD\n- [detective-es6](https://github.com/dependents/node-detective-es6) - ES modules\n- [detective-sass](https://github.com/dependents/node-detective-sass) - Sass\n- [detective-scss](https://github.com/dependents/node-detective-scss) - SCSS\n\n## Releasing\n\n1. Ensure CI is green on `main`.\n2. Preview what would be included in the package without publishing: `npm pack --dry-run`.\n3. Bump the version following [semver](https://semver.org/) (this also creates the `vX.Y.Z` tag): `npm version <patch|minor|major>`.\n4. Push the commit and tag: `git push --follow-tags`.\n5. Create (or draft) a GitHub release from that `vX.Y.Z` tag, then **Publish** it.\n6. Publishing the release triggers [npm-publish](https://github.com/dependents/node-detective-postcss/actions/workflows/npm-publish.yml) (`release.published`), which runs `npm ci` and `npm publish --provenance`.\n\n## License\n\n[MIT](LICENSE)\n","publish_time":1776961064426,"_cnpm_publish_time":1776961064426,"dist-tags":{"latest":"9.0.1"}}