{"_id":"@apehead/babel-plugin-css-modules-transform","_rev":"2-5d0e1f5d41f15003a0aa74d8725c207f","name":"@apehead/babel-plugin-css-modules-transform","dist-tags":{"latest":"1.7.0","beta":"2.0.0-beta.0"},"versions":{"1.7.0":{"name":"@apehead/babel-plugin-css-modules-transform","version":"1.7.0","description":"Transform required css modules so one can use generated class names.","main":"build/index.js","scripts":{"build":"babel src --ignore **/*.spec.js -d build","lint":"eslint src","pretest":"npm run lint","test":"cross-env NODE_ENV=test nyc mocha","prepublishOnly":"npm run test && npm run build"},"repository":{"type":"git","url":"git+https://github.com/apehead/babel-plugin-css-modules-transform.git"},"keywords":["babel","css-modules","babel-plugin","plugin"],"author":{"name":"Alexander Curiel","email":"alexander.curiel@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/apehead/babel-plugin-css-modules-transform/issues"},"homepage":"https://github.com/apehead/babel-plugin-css-modules-transform#readme","dependencies":{"css-modules-require-hook":"^4.0.6","mkdirp":"^0.5.1"},"devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-eslint":"^7.1.1","babel-plugin-istanbul":"^4.1.3","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-env":"^1.6.1","babel-register":"^6.26.0","chai":"^3.4.1","cross-env":"^5.0.0","eslint":"^1.9.0","eslint-config-airbnb-lite":"^1.0.0","gulp-babel":"7.0.0","gulp-util":"^3.0.7","mocha":"^3.4.2","nyc":"^10.3.2","postcss":"^5.x","postcss-modules-extract-imports":"^1.x","postcss-modules-local-by-default":"^1.x","postcss-modules-scope":"^1.x","postcss-modules-values":"^1.x","rimraf":"^2.5.4"},"engines":{"node":">=4.0.0"},"directories":{"test":"test"},"gitHead":"2138f0342192d04e836b826221d4d84d76f4f532","_id":"@apehead/babel-plugin-css-modules-transform@1.7.0","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"integrity":"sha512-OxeCA37Ld9Kq6wzRitwRCrNOfGsM/V7QPI4kl+/i4fa+kNtn6yxANl1bON873EHH9rxAXscSG91LupTy4g4kig==","shasum":"dbb6eb09957a5555ac5d04ffb59a3a13d4fb4c9b","tarball":"https://registry.npmjs.org/@apehead/babel-plugin-css-modules-transform/-/babel-plugin-css-modules-transform-1.7.0.tgz","fileCount":39,"unpackedSize":112659,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJec5FnCRA9TVsSAnZWagAAaTwQAIyKi/2ZhTdDS7lzlZV6\nxcDwnj5uQ56IbgPLtGmbL5TggWwKSRWd7EG/RREe4wHFlt52w+frDfbISR6i\nOHj92ZHxTe4M6YjFnziddctXaH/rLZcBpMmQlxd2Npn7toX3JJEpehSZOABD\n++vB6BF+S9HwpKe18hliLmd/7C3Nj4IZvPXjA7eg6E5Gc0dH1FYLcr+Nk7tf\nkc7Uy17JlwGBFLUxJLeo1h/l9VTCCK+ktMDVM61dT9md81yJKicF0lMmZau9\nQe58j+udUwyHUQqUm/l4p8cfQDo4ZQ+5OpFlQzrxPwCplLlF+z3nuEWF4zrc\n+8EvbKr0P1dXh1D2Rtpdk1RL9KQrBWOK4bYOXTjFNek9y8i3SJq9GRG/JVPI\nOPrnNIxc9exU0JkmEdKXr8WEOQulfDhuuCW/M8lmY5WLnUTPU5WCwXu33y89\n0hlejUAtTQhELPyj9cet/DmWdjqlW7x403Xg0F0+2hNKxgc7Q3fGoFci3jsP\nuB+caR/+wOM/mgt8mZ6HFakiRHpLmLY6dNXFFd6roe8sK1y7aqR9woSe1UCJ\nqG9KmwviZBTsYyGy6A0JH847PHirhGbrkGW0eZPvdzNcAM/rUIYQOEo68yfX\ngXALUSHC62LJD6h9PJQ64ZlbRSYcFYi+yJ9nk4iioUfIw5l1FG7VXP5R1XA2\n3ajL\r\n=uutD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF7nlwA/GhXiVB6lCdQ9gNqlkejJTldPXz1axU0mrFKyAiEAhcthpZeln44NwgtOwiT/hDeNNQZkHdfK39oj+Flrm9s="}]},"maintainers":[{"name":"apehead","email":"alexander.curiel@gmail.com"}],"_npmUser":{"name":"apehead","email":"alexander.curiel@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-css-modules-transform_1.7.0_1584632167482_0.4538555471885146"},"_hasShrinkwrap":false},"2.0.0-beta.0":{"name":"@apehead/babel-plugin-css-modules-transform","version":"2.0.0-beta.0","description":"Transform required css modules so one can use generated class names.","main":"build/index.js","scripts":{"build":"babel src --ignore **/*.spec.js -d build","lint":"eslint src","pretest":"npm run lint","test":"cross-env NODE_ENV=test nyc mocha","prepublishOnly":"npm run test && npm run build"},"repository":{"type":"git","url":"git+https://github.com/apehead/babel-plugin-css-modules-transform.git"},"keywords":["babel","css-modules","babel-plugin","plugin"],"author":{"name":"Alexander Curiel","email":"alexander.curiel@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/apehead/babel-plugin-css-modules-transform/issues"},"homepage":"https://github.com/apehead/babel-plugin-css-modules-transform#readme","dependencies":{"css-modules-require-hook":"^4.0.6","mkdirp":"^0.5.1"},"devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-eslint":"^7.1.1","babel-plugin-istanbul":"^4.1.3","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-env":"^1.6.1","babel-register":"^6.26.0","chai":"^3.4.1","cross-env":"^5.0.0","eslint":"^1.9.0","eslint-config-airbnb-lite":"^1.0.0","gulp-babel":"7.0.0","gulp-util":"^3.0.7","mocha":"^3.4.2","nyc":"^10.3.2","postcss":"^5.x","postcss-modules-extract-imports":"^1.x","postcss-modules-local-by-default":"^1.x","postcss-modules-scope":"^1.x","postcss-modules-values":"^1.x","rimraf":"^2.5.4"},"engines":{"node":">=8.0.0"},"directories":{"test":"test"},"readme":"# babel-plugin-css-modules-transform [![Circle CI](https://circleci.com/gh/michalkvasnicak/babel-plugin-css-modules-transform.svg?style=svg)](https://circleci.com/gh/michalkvasnicak/babel-plugin-css-modules-transform)\n\n**🎉 Babel 6 and Babel 7 compatible**\n\n**⚠️ Babel 7 compatibility added in 1.4.0**\n\nThis Babel plugin finds all `require`s for css module files and replace them with a hash where keys are class names and values are generated css class names.\n\nThis plugin is based on the fantastic [css-modules-require-hook](https://github.com/css-modules/css-modules-require-hook).\n\n## Warning\n\nThis plugin is experimental, pull requests are welcome.\n\n**Do not run this plugin as part of webpack frontend configuration. This plugin is intended only for backend compilation.**\n\n## Example\n\n```css\n/* test.css */\n\n.someClass {\n    color: red;\n}\n```\n\n```js\n// component.js\nconst styles = require('./test.css');\n\nconsole.log(styles.someClass);\n\n// transformed file\nconst styles = {\n    'someClass': 'Test__someClass___2Frqu'\n}\n\nconsole.log(styles.someClass); // prints Test__someClass___2Frqu\n```\n\n## Installation\n\n```console\nnpm install --save-dev babel-plugin-css-modules-transform\n```\n\n**Include plugin in `.babelrc`**\n\n```json\n{\n    \"plugins\": [\"css-modules-transform\"]\n}\n```\n\n**With custom options [css-modules-require-hook options](https://github.com/css-modules/css-modules-require-hook#tuning-options)**\n\n\n```js\n{\n    \"plugins\": [\n        [\n            \"css-modules-transform\", {\n                \"append\": [\n                    \"npm-module-name\",\n                    \"./path/to/module-exporting-a-function.js\"\n                ],\n                \"camelCase\": false,\n                \"createImportedName\": \"npm-module-name\",\n                \"createImportedName\": \"./path/to/module-exporting-a-function.js\",\n                \"devMode\": false,\n                \"extensions\": [\".css\", \".scss\", \".less\"], // list extensions to process; defaults to .css\n                \"generateScopedName\": \"[name]__[local]___[hash:base64:5]\", // in case you don't want to use a function\n                \"generateScopedName\": \"./path/to/module-exporting-a-function.js\", // in case you want to use a function\n                \"generateScopedName\": \"npm-module-name\",\n                \"hashPrefix\": \"string\",\n                \"ignore\": \"*css\",\n                \"ignore\": \"./path/to/module-exporting-a-function-or-regexp.js\",\n                \"preprocessCss\": \"./path/to/module-exporting-a-function.js\",\n                \"preprocessCss\": \"npm-module-name\",\n                \"processCss\": \"./path/to/module-exporting-a-function.js\",\n                \"processCss\": \"npm-module-name\",\n                \"processorOpts\": \"npm-module-name\",\n                \"processorOpts\": \"./path/to/module/exporting-a-plain-object.js\",\n                \"mode\": \"string\",\n                \"prepend\": [\n                    \"npm-module-name\",\n                    \"./path/to/module-exporting-a-function.js\"\n                ],\n                \"extractCss\": \"./dist/stylesheets/combined.css\"\n            }\n        ]\n    ]\n}\n```\n\n## Using a preprocessor\n\nWhen using this plugin with a preprocessor, you'll need to configure it as such:\n\n\n```js\n// ./path/to/module-exporting-a-function.js\nvar sass = require('node-sass');\nvar path = require('path');\n\nmodule.exports = function processSass(data, filename) {\n    var result;\n    result = sass.renderSync({\n        data: data,\n        file: filename\n    }).css;\n    return result.toString('utf8');\n};\n```\n\nand then add any relevant extensions to your plugin config:\n\n```js\n{\n    \"plugins\": [\n        [\n            \"css-modules-transform\", {\n                \"preprocessCss\": \"./path/to/module-exporting-a-function.js\",\n                \"extensions\": [\".css\", \".scss\"]\n            }\n        ]\n    ]\n}\n\n```\n\n## Extract CSS Files\n\nWhen you publish a library, you might want to ship compiled css files as well to\nhelp integration in other projects.\n\nAn more complete alternative is to use\n[babel-plugin-webpack-loaders](https://github.com/istarkov/babel-plugin-webpack-loaders)\nbut be aware that a new webpack instance is run for each css file, this has a\nhuge overhead. If you do not use fancy stuff, you might consider using\n[babel-plugin-css-modules-transform](https://github.com/michalkvasnicak/babel-plugin-css-modules-transform)\ninstead.\n\n\nTo combine all css files in a single file, give its name:\n\n```js\n{\n    \"plugins\": [\n        [\n            \"css-modules-transform\", {\n                \"extractCss\": \"./dist/stylesheets/combined.css\"\n            }\n        ]\n    ]\n}\n```\n\nTo extract all files in a single directory, give an object:\n\n```js\n{\n    \"plugins\": [\n        [\n            \"css-modules-transform\", {\n                \"extractCss\": {\n                    \"dir\": \"./dist/stylesheets/\",\n                    \"relativeRoot\": \"./src/\",\n                    \"filename\": \"[path]/[name].css\"\n                }\n            }\n        ]\n    ]\n}\n```\n\nNote that `relativeRoot` is used to resolve relative directory names, available\nas `[path]` in `filename` pattern.\n\n## Keeping import\n\nTo keep import statements you should set option `keepImport` to *true*. In this way, simultaneously with the converted values, the import will be described as unassigned call expression.\n\n```js\n// before\nconst styles = require('./test.css');\n```\n\n```js\n// after\nrequire('./test.css');\n\nconst styles = {\n    'someClass': 'Test__someClass___2Frqu'\n}\n```\n\n## Alternatives\n\n- [babel-plugin-transform-postcss](https://github.com/wbyoung/babel-plugin-transform-postcss) - which supports async plugins and does not depend on `css-modules-require-hook`.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"9772fb080689247ea58badde72dfb49d63d78db7","_id":"@apehead/babel-plugin-css-modules-transform@2.0.0-beta.0","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"integrity":"sha512-ZciCTmq9ylqBGENVuu+Ibm4cWs6LnAffVkTYUIJ4UNCGReEZ3iUsdlcM9V7jl4FGegxLsenAF8qPfYJuSCsNyw==","shasum":"2c6dfe59b6fb367d35481a7768c909b17b97d8be","tarball":"https://registry.npmjs.org/@apehead/babel-plugin-css-modules-transform/-/babel-plugin-css-modules-transform-2.0.0-beta.0.tgz","fileCount":39,"unpackedSize":115138,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJec5KKCRA9TVsSAnZWagAAQm8P/0+HWNpeFJaUvSUVmUX8\nTJ7zaskd3JpgyDk/qLJPkFmWptNilwGXlQvBh0grYjM9qrrHB+xZI/qotiLA\no7XRod6lcPHEYncx9QTBcuKZYsMJYEqD0UT4gCXcHlVhBSngFRTGyIhKf0bl\nv/0W/+4sVLrnafzpVQdbb54R2dSCOaM5qA9ocdmt8huTqT4eNfrcBASERjdZ\nlvbuQVSMpvR36c4TrzqA3rH6rdme8ex/Xy/to1XY1on3aplW5jVl0J5bAXvJ\nRi7ulKFNhgoTlahyAHa+CVy+da8SxHCO3j030VmLmHJdwBSNpE0gP39T37JR\nkluS/H1yfPzt4Yx8eEiySs11zcCTdSGCeYJ9JXslKQYwblsOe6jhasKsiy8V\n54VBlVV6LqrYsp5Q0AaVsAZAyG58lcgNcJpzrG0lg09g0bjHhplR+AeXS5Sb\nv+719YCHzCfyRDg65mrlfc9B76OiOd+AJasYuhizP0rF3cpzW4EpbvPsa4FW\nvjWMJRaYZCjgpXY//sA2fg1BGYn03avO/ZGFWIGuJGKjmBDUB7ma9LzcStys\nDLk72ORpNDROHP7JAmmxE+YahJh9OAG7F0QeQhwtjgF8nsbEIMRdkMkQWORd\nFeZ+ri+bvWGmSujRNVT5nVSFvJ/3uh3uZDSI7iFt0zuSr4uar9dfC0FlD4ob\nHvMj\r\n=Ttqa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCvn0AwrkTCoTdJI3/1puwRJZtnLyXT0e07OacBURJWiAIgXyczJsj3KvzjxJ0jf682Heq7Cyl1RW/0CvrG5fCT+6k="}]},"maintainers":[{"name":"apehead","email":"alexander.curiel@gmail.com"}],"_npmUser":{"name":"apehead","email":"alexander.curiel@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-css-modules-transform_2.0.0-beta.0_1584632458025_0.9081818910057589"},"_hasShrinkwrap":false}},"time":{"created":"2020-03-19T15:36:07.221Z","1.7.0":"2020-03-19T15:36:07.620Z","modified":"2022-04-04T14:32:42.814Z","2.0.0-beta.0":"2020-03-19T15:40:58.176Z"},"maintainers":[{"name":"apehead","email":"alexander.curiel@gmail.com"}],"description":"Transform required css modules so one can use generated class names.","homepage":"https://github.com/apehead/babel-plugin-css-modules-transform#readme","keywords":["babel","css-modules","babel-plugin","plugin"],"repository":{"type":"git","url":"git+https://github.com/apehead/babel-plugin-css-modules-transform.git"},"author":{"name":"Alexander Curiel","email":"alexander.curiel@gmail.com"},"bugs":{"url":"https://github.com/apehead/babel-plugin-css-modules-transform/issues"},"license":"MIT","readme":"","readmeFilename":""}