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 3.0.0-dev.4 to 3.0.0-dev.5

16

lib/plugin.js

@@ -9,3 +9,2 @@ import {

} from 'node:path';
import { createHash } from 'node:crypto';
import { readFile, writeFile, mkdir } from 'node:fs/promises';

@@ -26,3 +25,4 @@ import {

pluginCssNamespace,
relativeToCwd
relativeToCwd,
genDigest
} from './utils.js';

@@ -141,6 +141,8 @@ import { transform, bundle } from 'lightningcss';

const { log, relative, buildRoot, packageVersion } = patchedBuild.context;
const { log, relative, buildRoot, packageVersion, buildId } = patchedBuild.context;
const supportNamedExports = options.namedExports ?? false;
const isEsbuildBundleMode = build.initialOptions.bundle ?? false;
const genTheDigest = (/** @type {string} */ str) => genDigest(str, buildId);
patchedBuild.onLoad(

@@ -354,5 +356,3 @@ { filter: /.*/, namespace: pluginCssNamespace },

define: {
[digestPlaceholder]: JSON.stringify(
createHash('md5').update(relativeFilePath).digest('hex')
),
[digestPlaceholder]: JSON.stringify(genTheDigest(relativeFilePath)),
[contentsPlaceholder]: JSON.stringify(result.code.toString('utf8').replaceAll('\n', ''))

@@ -438,5 +438,3 @@ }

const digest = createHash('md5')
.update(baseNames.join('') + pluginJsNamespace)
.digest('hex');
const digest = genTheDigest(baseNames.join(''));

@@ -443,0 +441,0 @@ const cssContents = cssOutputs.map((opt) => opt.text.trim()).join('');

@@ -37,3 +37,2 @@ import { isAbsolute, resolve, sep, relative } from 'node:path';

/**

@@ -203,3 +202,3 @@ * getRootDir

/**
* @param {string} to
* @param {string} to
* @returns string

@@ -209,2 +208,5 @@ */

const genDigest = (/** @type {string} */ str, /** @type {string} */ buildId) =>
createHash('md5').update(`${pluginName}:${buildId}:${str}`).digest('hex');
export {

@@ -227,3 +229,4 @@ pluginName,

digestPlaceholder,
relativeToCwd
relativeToCwd,
genDigest
};
{
"name": "esbuild-css-modules-plugin",
"version": "3.0.0-dev.4",
"version": "3.0.0-dev.5",
"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