{"_id":"@eliyya/typed-css-modules","_rev":"3-6cf88423e293a57fe742e9148ac2a4bb","name":"@eliyya/typed-css-modules","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@eliyya/typed-css-modules","version":"1.0.0","keywords":["css-modules","css","typescript","ts","nextjs","next"],"author":{"name":"eliyya"},"license":"MIT","_id":"@eliyya/typed-css-modules@1.0.0","maintainers":[{"name":"eliyya","email":"elimacmun@gmail.com"}],"dist":{"shasum":"16d218fa7c36c4637a28046912b2ae42e488bf6b","tarball":"https://registry.npmjs.org/@eliyya/typed-css-modules/-/typed-css-modules-1.0.0.tgz","fileCount":5,"integrity":"sha512-mcZZ+VwaYW/m5bFfEMX9fXLk++TFOcVC1W7akyMBYoMkV61QG4xRzwl1n2mzb2uUBkznj0gz0yeTX35+AAYLtA==","signatures":[{"sig":"MEUCICkSjRln5oUG2sgbDaZhVXXoIh3/IgRgdHdyDRLU119bAiEA1iAHsWi4fHRFZhFIqL1W63gtTglthUB5p1bcS20RhDk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6764},"main":"./lib/lib.js","type":"module","types":"./lib/lib.d.ts","engines":{"node":">=20.11"},"exports":"./lib/lib.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc && esbuild src/lib.ts --minify --platform=node --outfile=lib/lib.js"},"_npmUser":{"name":"eliyya","email":"elimacmun@gmail.com"},"_npmVersion":"11.0.0","description":"Creates .d.ts files from CSS Modules .css files with a nextjs pluggin","directories":{},"_nodeVersion":"22.11.0","dependencies":{"typed-css-modules":"^0.9.1"},"engineStrict":true,"_hasShrinkwrap":false,"devDependencies":{"next":"^15.1.4","eslint":"^9.18.0","esbuild":"^0.24.2","globals":"^15.14.0","typescript":"^5.7.3","@types/node":"^22.10.5"},"peerDependencies":{"next":"^15"},"peerDependenciesMeta":{"next":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/typed-css-modules_1.0.0_1736662354325_0.33847298237436374","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@eliyya/typed-css-modules","version":"1.0.1","keywords":["css-modules","css","typescript","ts","nextjs","next"],"author":{"name":"eliyya"},"license":"MIT","_id":"@eliyya/typed-css-modules@1.0.1","maintainers":[{"name":"eliyya","email":"elimacmun@gmail.com"}],"homepage":"https://github.com/eliyya/typed-css-modules#readme","bugs":{"url":"https://github.com/eliyya/typed-css-modules/issues"},"dist":{"shasum":"9c850acbd317a56a39e545ddbaab9137673febe1","tarball":"https://registry.npmjs.org/@eliyya/typed-css-modules/-/typed-css-modules-1.0.1.tgz","fileCount":3,"integrity":"sha512-ZVNrigKZoBp98AnAS11B4lwp52/prwsXpgbXOQnXqBn2u//3buIBmUB9u4E2iM0/FFwwFE8O5EBbVoPhfLLC+Q==","signatures":[{"sig":"MEQCIByLUS3aWJCzHUAMNYN6NUj424+CucgVDhm8NrCAjDW8AiBKJKUP4g7G8ud32NL00YgWGrUpITuvxqVA0w+wG31oZw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5864},"main":"./lib/lib.js","type":"module","types":"./lib/lib.d.ts","engines":{"node":">=20.11"},"exports":"./lib/lib.js","gitHead":"646f9ddf254d6d43ad906ee1605d8522d71e2d54","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc && esbuild src/lib.ts --minify --platform=node --outfile=lib/lib.js"},"_npmUser":{"name":"eliyya","email":"elimacmun@gmail.com"},"repository":{"url":"git+https://github.com/eliyya/typed-css-modules.git","type":"git"},"_npmVersion":"10.9.3","description":"Creates .d.ts files from CSS Modules .css files with a nextjs pluggin","directories":{},"_nodeVersion":"22.20.0","dependencies":{"typed-css-modules":"^0.9.1"},"engineStrict":true,"_hasShrinkwrap":false,"devDependencies":{"next":"^16.0.0","eslint":"^9.38.0","esbuild":"^0.25.11","globals":"^16.4.0","typescript":"^5.7.3","@types/node":"^24.9.1"},"peerDependencies":{"next":"^15 || ^16"},"peerDependenciesMeta":{"next":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/typed-css-modules_1.0.1_1761144920408_0.8031955461622728","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@eliyya/typed-css-modules","version":"1.0.2","description":"Creates .d.ts files from CSS Modules .css files with a nextjs pluggin","main":"./lib/lib.js","type":"module","types":"./lib/lib.d.ts","exports":"./lib/lib.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc && esbuild src/lib.ts --minify --platform=node --outfile=lib/lib.js","prepublishOnly":"pnpm build"},"repository":{"type":"git","url":"git+https://github.com/eliyya/typed-css-modules.git"},"keywords":["css-modules","css","typescript","ts","nextjs","next"],"author":{"name":"eliyya"},"license":"MIT","dependencies":{"typed-css-modules":"^0.9.1"},"devDependencies":{"@types/node":"^24.9.1","esbuild":"^0.25.11","eslint":"^9.38.0","globals":"^16.4.0","next":"^16.0.0","typescript":"^5.7.3"},"peerDependencies":{"next":"^15 || ^16"},"peerDependenciesMeta":{"next":{"optional":true}},"engineStrict":true,"engines":{"node":">=20.11"},"_id":"@eliyya/typed-css-modules@1.0.2","gitHead":"0f0e7a1aa9d45b1f2b5697239328ea8cd5ace45b","bugs":{"url":"https://github.com/eliyya/typed-css-modules/issues"},"homepage":"https://github.com/eliyya/typed-css-modules#readme","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-Y1jY1mZFtBmVkzIOJFJ5sgn5+/COJKl03Rhq1LLzzgg1kCql9r/FhCbMiGqyQOWYLGbe14VwMvbkOEoviZMsGQ==","shasum":"cf06d56957ffabed1aeffddf437d89a2aa922542","tarball":"https://registry.npmjs.org/@eliyya/typed-css-modules/-/typed-css-modules-1.0.2.tgz","fileCount":5,"unpackedSize":6959,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHORol47ePZvSzpOhcMvNm33ao14KeuMFX1oQFY0yUABAiEAow7di2qgNeCl/RlClnyVNX/YJTSqaf3ch8YxrNhnfJY="}]},"_npmUser":{"name":"eliyya","email":"elimacmun@gmail.com"},"directories":{},"maintainers":[{"name":"eliyya","email":"elimacmun@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/typed-css-modules_1.0.2_1761145540585_0.7679240168550618"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-12T06:12:34.240Z","modified":"2025-10-22T15:05:41.034Z","1.0.0":"2025-01-12T06:12:34.509Z","1.0.1":"2025-10-22T14:55:20.601Z","1.0.2":"2025-10-22T15:05:40.845Z"},"bugs":{"url":"https://github.com/eliyya/typed-css-modules/issues"},"author":{"name":"eliyya"},"license":"MIT","homepage":"https://github.com/eliyya/typed-css-modules#readme","keywords":["css-modules","css","typescript","ts","nextjs","next"],"repository":{"type":"git","url":"git+https://github.com/eliyya/typed-css-modules.git"},"description":"Creates .d.ts files from CSS Modules .css files with a nextjs pluggin","maintainers":[{"name":"eliyya","email":"elimacmun@gmail.com"}],"readme":"# withTypeCSSModule\r\n\r\nA Next.js plugin that wraps the [`typed-css-modules`](https://www.npmjs.com/package/typed-css-modules) library, enabling automatic generation of `.d.ts` files for CSS Modules in TypeScript projects. This plugin integrates seamlessly with your Next.js project and simplifies the usage of `typed-css-modules` by:\r\n\r\n1. Running it automatically for all CSS Module files in your project.\r\n2. Watching for changes in your CSS Module files and regenerating the `.d.ts` files when necessary.\r\n3. Exporting all the functionalities of `typed-css-modules` so you can use it directly if the plugin is not required.\r\n\r\n## Features\r\n\r\n-   **Automatic Type Generation:** No need to run `typed-css-modules` manually.\r\n-   **File Watching:** Watches your CSS Module files and regenerates `.d.ts` files on change.\r\n-   **Customizable Extensions:** Supports `.module.css`, `.module.scss`, and other extensions.\r\n-   **Debounce Support:** Prevents excessive executions during rapid file changes.\r\n-   **Direct Access to `typed-css-modules`:** Exposes the original API for advanced use cases.\r\n\r\n---\r\n\r\n## Installation\r\n\r\nInstall the package using npm or yarn:\r\n\r\n```bash\r\nnpm install typed-css-modules\r\n```\r\n\r\nInclude the plugin in your `next.config.mjs` file:\r\n\r\n```javascript\r\nimport { withTypeCSSModule } from '@eliya/typed-css-modules'\r\n\r\nconst nextjsConfig = {\r\n    // your nextjs config\r\n}\r\n\r\nexport default withTypeCSSModule(nextjsConfig)\r\n```\r\n\r\n---\r\n\r\n## Usage\r\n\r\n### Plugin Mode\r\n\r\nBy default, the plugin automatically generates `.d.ts` files for all CSS Module files in your Next.js project.\r\n\r\nExample `next.config.mjs`:\r\n\r\n```javascript\r\nimport { withTypeCSSModule } from '@eliya/typed-css-modules'\r\n\r\nconst nextjsConfig = {\r\n    // your nextjs config\r\n}\r\n\r\nexport default withTypeCSSModule(nextjsConfig, {\r\n    extensions: ['.module.css', '.module.scss'], // optona;\r\n    debounceWait: 300, // optona;\r\n})\r\n```\r\n\r\n-   `extensions`: Specifies the file extensions to watch and process. Default: `['.module.css']`.\r\n-   `debounceWait`: Time in milliseconds to wait before regenerating types after a file change. Default: `200`.\r\n\r\n---\r\n\r\n### Direct API Usage\r\n\r\nIf you prefer to use `typed-css-modules` directly, the plugin exports all its functionalities. For example:\r\n\r\n```javascript\r\nimport { run } from '@eliya/typed-css-modules'\r\n\r\nrun('./src', {\r\n    silent: true,\r\n    pattern: '**/*.module.css',\r\n})\r\n```\r\n\r\nThis works the same way as calling `run` from the `typed-css-modules` package itself.\r\n\r\n---\r\n\r\n## Example Project Structure\r\n\r\n```\r\nproject-root/\r\n├── src/\r\n│   ├── components/\r\n│   │   ├── Button.module.css\r\n│   │   └── Button.module.css.d.ts <-- generated\r\n│   └── pages/\r\n├── next.config.mjs\r\n└── package.json\r\n```\r\n\r\n---\r\n\r\n## How It Works\r\n\r\n1. **Initial Run:** When you include the plugin, it automatically generates `.d.ts` files for all CSS Modules matching the specified extensions.\r\n2. **File Watching:** Uses `fs.watch` to monitor changes in the `src` directory and regenerates `.d.ts` files for modified CSS Module files.\r\n3. **Debounced Updates:** Uses a debounce mechanism to reduce redundant type generation during rapid file modifications.\r\n\r\n---\r\n\r\n## Notes\r\n\r\n-   Ensure your CSS Modules follow the naming convention (e.g., `*.module.css`).\r\n-   If using custom extensions like `.module.scss`, you need to configure the `extensions` option.\r\n-   The plugin does not interfere with other Next.js configurations.\r\n\r\n---\r\n\r\n## License\r\n\r\nThis plugin is licensed under the MIT License.\r\n","readmeFilename":"README.md"}