New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-css-modules-plugin

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-css-modules-plugin - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

3

changelog.md

@@ -0,1 +1,4 @@

## V3.0.1
- add ability to custom ts declaration file outdir
## V3.0.0

@@ -2,0 +5,0 @@ This version has some breaking changes:

import type { Plugin, PluginBuild } from 'esbuild';
declare type EmitDtsConfig = Partial<Record<'.d.css.ts' | '.css.d.ts' | '*', string>>;
declare interface BuildOptions {

@@ -19,5 +21,15 @@ /**

* - `true` : emit both `xxx.css.d.ts` and `xxx.d.css.ts`
* by default the dts files would be generated in `outdir` of esbuild config, if you want to custom outdir of these dts files:
* ```js
* {
* emitDeclarationFile: {
* '*': 'custom/path/for/all',
* '.css.d.ts': 'custom/path/for/*.css.d.ts',
* '.d.css.ts': 'custom/path/for/*.d.css.ts'
* }
* }
* ```
* @default false
*/
emitDeclarationFile?: boolean | '.d.css.ts' | '.css.d.ts';
emitDeclarationFile?: boolean | '.d.css.ts' | '.css.d.ts' | EmitDtsConfig;
/**

@@ -102,2 +114,4 @@ * set to false to not inject generated css into page;

declare namespace CssModulesPlugin {
export type EmitDts = EmitDtsConfig;
export interface Options extends BuildOptions {}

@@ -104,0 +118,0 @@

@@ -108,7 +108,18 @@ import { basename, dirname, extname, normalize, relative, resolve, sep } from 'node:path';

if (emitDts) {
/** @type {('.d.css.ts'|'.css.d.ts')[]} */
const dtsExts = [];
/** @type {import('./index.js').EmitDts} */
let outdirs = {};
if (emitDts === '.d.css.ts' || emitDts === '.css.d.ts') {
dtsExts.push(emitDts);
} else {
} else if (emitDts === true) {
dtsExts.push('.d.css.ts', '.css.d.ts');
} else if (typeof emitDts === 'object') {
outdirs = { ...emitDts };
if (emitDts['*']) {
dtsExts.push('.d.css.ts', '.css.d.ts');
} else {
emitDts['.css.d.ts'] && dtsExts.push('.css.d.ts');
emitDts['.d.css.ts'] && dtsExts.push('.d.css.ts');
}
}

@@ -119,2 +130,6 @@ const outdir = resolve(buildRoot, patchedBuild.initialOptions.outdir ?? '');

let outDtsfile = resolve(outdir, rpath).replace(/\.css$/i, dtsExt);
const dtsOutdir = outdirs[dtsExt] || outdirs['*'];
if (dtsOutdir) {
outDtsfile = resolve(buildRoot, dtsOutdir, rpath).replace(/\.css$/i, dtsExt);
}
if (outbase) {

@@ -253,3 +268,3 @@ let normalized = normalize(outbase);

await Promise.all([
...(moduleJsFiles.map(([src, dist]) => {
...moduleJsFiles.map(([src, dist]) => {
const fp = resolve(buildRoot, dist);

@@ -260,3 +275,3 @@ const filename = basename(src) + outJsExt;

return rename(fp, finalPath);
})),
}),
...jsFiles.map(([js, places]) => {

@@ -263,0 +278,0 @@ const fulljs = resolve(buildRoot, js);

2

package.json
{
"name": "esbuild-css-modules-plugin",
"version": "3.0.0",
"version": "3.0.1",
"description": "A esbuild plugin to bundle css modules into js(x)/ts(x).",

@@ -5,0 +5,0 @@ "main": "./index.cjs",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc