Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-css-modules-plugin

Package Overview
Dependencies
Maintainers
1
Versions
82
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 2.3.2 to 2.4.0

1

index.d.ts

@@ -49,2 +49,3 @@ import type { OnLoadResult, Plugin, PluginBuild } from 'esbuild';

cssModulesOption?: CssModulesOptions;
filter?: RegExp;
v2?: boolean;

@@ -51,0 +52,0 @@ v2CssModulesOption?: {

6

lib/plugin.js

@@ -12,4 +12,4 @@ const path = require('path');

builtCssSuffix,
modulesCssRegExp,
builtModulesCssRegExp,
getModulesCssRegExp,
getBuiltModulesCssRegExp,
getRelativePath,

@@ -425,2 +425,4 @@ getBuildId

await prepareBuild(build, options);
const modulesCssRegExp = getModulesCssRegExp(options);
const builtModulesCssRegExp = getBuiltModulesCssRegExp(options);

@@ -427,0 +429,0 @@ // resolve xxx.module.css to xxx.module.css?esbuild-css-modules-plugin-building

@@ -9,6 +9,24 @@ const path = require('path');

const builtCssSuffixRegExp = builtCssSuffix.replace('?', '\\?').replace(/\-/g, '\\-');
const modulesCssRegExp = /\.modules?\.css$/i;
const builtModulesCssRegExp = new RegExp(`\\.modules?\\.css${builtCssSuffixRegExp}$`, 'i');
/**
* getModulesCssRegExp
* @param {import('..').Options} options
* @returns {RegExp}
*/
const getModulesCssRegExp = (options) => {
return options.filter ?? /\.modules?\.css$/i
}
/**
* getBuiltModulesCssRegExp
* @param {import('..').Options} options
* @returns {RegExp}
*/
const getBuiltModulesCssRegExp = (options) => {
const baseRegExp = getModulesCssRegExp(options);
const baseRegExpSource = baseRegExp.source.endsWith('$') ? baseRegExp.source.slice(0, -1) : baseRegExp.source;
return new RegExp(`${baseRegExpSource}${builtCssSuffixRegExp}$`, 'i');
}
/**
* getLogger

@@ -45,3 +63,3 @@ * @param {import('..').Build} build

window.__inject_${digest}__ = doInject;
})();
})();
`;

@@ -74,3 +92,3 @@ }

window.__inject_${digest}__ = doInject;
})();
})();
`;

@@ -143,4 +161,4 @@ };

builtCssSuffix,
modulesCssRegExp,
builtModulesCssRegExp,
getModulesCssRegExp,
getBuiltModulesCssRegExp,
buildingCssSuffix,

@@ -147,0 +165,0 @@ getRelativePath,

@@ -161,4 +161,8 @@ const path = require('path');

const setup = async (build, options) => {
const filter = options.filter ?? /\.modules?\.css$/;
const filterBaseSource = filter.source.endsWith('$') ? filter.source.slice(0, -1) : filter.source;
const filterCssJS = new RegExp(`${filterBaseSource}\\.js$`);
build.onResolve(
{ filter: /\.modules?\.css$/, namespace: 'file' },
{ filter, namespace: 'file' },
onResolveFactory(build, options)

@@ -168,3 +172,3 @@ );

build.onLoad(
{ filter: /\.modules?\.css\.js$/, namespace: pluginNamespace },
{ filter: filterCssJS, namespace: pluginNamespace },
onLoadFactory(build, options)

@@ -171,0 +175,0 @@ );

{
"name": "esbuild-css-modules-plugin",
"version": "2.3.2",
"version": "2.4.0",
"description": "A esbuild plugin to bundle css modules into js(x)/ts(x).",

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

@@ -54,2 +54,4 @@ # esbuild-css-modules-plugin

filter: /\.modules?\.css$/i // Optional. Regex to filter certain CSS files.
cssModulesOption: {

@@ -56,0 +58,0 @@ // optional, refer to: https://github.com/madyankin/postcss-modules/blob/d7cefc427c43bf35f7ebc55e7bda33b4689baf5a/index.d.ts#L27

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