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.2.0 to 2.2.1

16

lib/utils.js

@@ -43,7 +43,8 @@ const path = require('path');

const buildInjectCode = (injectToSelector = 'head', css, digest, { urlFullPathMap }) => {
const placeholders = [];
const patchedPlaceholders = [];
const imports = Object.keys(urlFullPathMap)
.map((placeholder) => {
placeholders.push(placeholder);
return `import ${placeholder} from '${urlFullPathMap[placeholder]}';`;
// placeholder can start with number
patchedPlaceholders.push('__' + placeholder);
return `import __${placeholder} from '${urlFullPathMap[placeholder]}';`;
})

@@ -55,8 +56,9 @@ .join('\n');

${
placeholders.length
patchedPlaceholders.length
? `
const placeholders = \`${placeholders.join(',')}\`.split(',');
const urls = [${placeholders.join(',')}];
const placeholders = \`${patchedPlaceholders.join(',')}\`.split(',');
const urls = [${patchedPlaceholders.join(',')}];
placeholders.forEach(function(p, index) {
css = css.replace(new RegExp(\`"\${p}"\`, 'g'), urls[index]);
const originPlaceholder = p.replace(/^__/, '');
css = css.replace(new RegExp(\`"\${originPlaceholder}"\`, 'g'), urls[index]);
});

@@ -63,0 +65,0 @@ `

{
"name": "esbuild-css-modules-plugin",
"version": "2.2.0",
"version": "2.2.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