esbuild-css-modules-plugin
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20243
462
0