{ "manifest": { "name": "icss-utils", "version": "5.1.0", "description": "ICSS utils for postcss ast", "main": "src/index.js", "engines": { "node": "^10 || ^12 || >= 14" }, "files": [ "src" ], "scripts": { "prettier": "prettier -l --ignore-path .gitignore . \"!test/test-cases\"", "eslint": "eslint --ignore-path .gitignore .", "lint": "yarn eslint && yarn prettier", "test:only": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage --collectCoverageFrom=\"src/**/*\"", "pretest": "yarn lint", "test": "yarn test:coverage", "prepublishOnly": "yarn test" }, "repository": { "type": "git", "url": "git+https://github.com/css-modules/icss-utils.git" }, "keywords": [ "css", "modules", "icss", "postcss" ], "author": { "name": "Glen Maddern" }, "license": "ISC", "bugs": { "url": "https://github.com/css-modules/icss-utils/issues" }, "homepage": "https://github.com/css-modules/icss-utils#readme", "devDependencies": { "coveralls": "^3.1.0", "eslint": "^7.9.0", "eslint-config-prettier": "^6.12.0", "husky": "^4.3.0", "jest": "^26.4.2", "lint-staged": "^10.4.0", "postcss": "^8.1.0", "prettier": "^2.1.2" }, "peerDependencies": { "postcss": "^8.1.0" }, "_registry": "npm", "_loc": "/home/josie/.cache/yarn/v6/npm-icss-utils-5.1.0-c6be6858abd013d768e98366ae47e25d5887b1ae-integrity/node_modules/icss-utils/package.json", "readmeFilename": "README.md", "readme": "[![Build Status](https://travis-ci.org/css-modules/icss-utils.svg)](https://travis-ci.org/css-modules/icss-utils)\n\n# ICSS Utils\n\n## replaceSymbols\n\nGoverns the way tokens are searched & replaced during the linking stage of ICSS loading.\n\nThis is broken into its own module in case the behaviour needs to be replicated in other PostCSS plugins\n(i.e. [CSS Modules Values](https://github.com/css-modules/postcss-modules-values))\n\n```js\nimport { replaceSymbols, replaceValueSymbols } from \"icss-utils\";\n\nreplaceSymbols(css, replacements);\nreplaceValueSymbols(string, replacements);\n```\n\nWhere:\n\n- `css` is the PostCSS tree you're working with\n- `replacements` is an JS object of `symbol: \"replacement\"` pairs, where all occurrences of `symbol` are replaced with `replacement`.\n\nA symbol is a string of alphanumeric, `-` or `_` characters. A replacement can be any string. They are replaced in the following places:\n\n- In the value of a declaration, i.e. `color: my_symbol;` or `box-shadow: 0 0 blur spread shadow-color`\n- In a media expression i.e. `@media small {}` or `@media screen and not-large {}`\n\n## extractICSS(css, removeRules = true, mode = 'auto')\n\nExtracts and remove (if removeRules is equal true) from PostCSS tree `:import`, `@icss-import`, `:export` and `@icss-export` statements.\n\n```js\nimport postcss from \"postcss\";\nimport { extractICSS } from \"icss-utils\";\n\nconst css = postcss.parse(`\n :import(colors) {\n a: b;\n }\n :export {\n c: d;\n }\n`);\n\nextractICSS(css);\n/*\n {\n icssImports: {\n colors: {\n a: 'b'\n }\n },\n icssExports: {\n c: 'd'\n }\n }\n*/\n```\n\nBy default both the pseudo and at-rule form of the import and export statements\nwill be removed. Pass the `mode` option to limit to only one type.\n\n## createICSSRules(icssImports, icssExports, mode = 'rule')\n\nConverts icss imports and exports definitions to postcss ast\n\n```js\ncreateICSSRules(\n {\n colors: {\n a: \"b\",\n },\n },\n {\n c: \"d\",\n },\n // Need pass `rule` and `decl` from postcss\n // Please look at `Step 4` https://evilmartians.com/chronicles/postcss-8-plugin-migration\n postcss\n);\n```\n\nBy default it will create pseudo selector rules (`:import` and `:export`). Pass\n`at-rule` for `mode` to instead generate `@icss-import` and `@icss-export`, which\nmay be more resilient to post processing by other tools.\n\n## License\n\nISC\n\n---\n\nGlen Maddern, Bogdan Chadkin and Evilebottnawi 2015-present.\n", "licenseText": "ISC License (ISC)\nCopyright 2018 Glen Maddern\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n" }, "artifacts": [], "remote": { "resolved": "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae", "type": "tarball", "reference": "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz", "hash": "c6be6858abd013d768e98366ae47e25d5887b1ae", "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", "registry": "npm", "packageName": "icss-utils", "cacheIntegrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA== sha1-xr5oWKvQE9do6YNmrkfiXViHsa4=" }, "registry": "npm", "hash": "c6be6858abd013d768e98366ae47e25d5887b1ae" }