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
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 2.6.0 to 2.6.1-beta.1

1

index.d.ts

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

v2?: boolean;
generateTsFile?: boolean;
v2CssModulesOption?: {

@@ -53,0 +54,0 @@ /**

19

lib/plugin.js

@@ -31,3 +31,3 @@ const path = require('path');

const cssFileName = path.basename(fullPath); // e.g. xxx.module.css?esbuild-css-modules-plugin-building
const { buildId, relative, packageVersion } = build.context;
const { buildId, relative, packageVersion, log } = build.context;
const resolveDir = path.dirname(fullPath);

@@ -39,2 +39,3 @@ const classPrefix =

const cssModulesOption = options.v2CssModulesOption || {};
const genTs = !!options.generateTsFile;

@@ -67,3 +68,3 @@ /**

if (options.usePascalCase) {
name = upperFirst(name)
name = upperFirst(name);
}

@@ -103,2 +104,3 @@

const namedExportsTs = [];
const namedExportStatements = Object.entries(cssModulesJSON)

@@ -111,3 +113,5 @@ .map(([camelCaseClassName, className]) => {

}
return `export const ${camelCaseClassName} = "${className}";`;
const line = `export const ${camelCaseClassName} = "${className}"`;
genTs && namedExportsTs.push(`${line} as const;`);
return `${line};`;
})

@@ -118,2 +122,9 @@ .join('\n');

if (genTs) {
const ts = `export default ${classNamesMapString} as const;\n${namedExportsTs.join('\n')}\n`;
const tsPath = `${fullPath.replace(/\?.+$/, '')}.ts`;
log(tsPath, ts);
await writeFile(tsPath, ts, { encoding: 'utf-8' });
}
return {

@@ -224,3 +235,3 @@ js,

const { js, resolveDir, css, exports, originCss } = await buildCssModulesJs({
const { js, ts, resolveDir, css, exports, originCss } = await buildCssModulesJs({
fullPath: absPath,

@@ -227,0 +238,0 @@ options,

{
"name": "esbuild-css-modules-plugin",
"version": "2.6.0",
"version": "2.6.1-beta.1",
"description": "A esbuild plugin to bundle css modules into js(x)/ts(x).",

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

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