esbuild-css-modules-plugin
Advanced tools
Comparing version 2.6.3 to 2.6.4-dev.0
@@ -69,9 +69,9 @@ const path = require('path'); | ||
return ` | ||
(function(){ | ||
(function(win){ | ||
const css = \`${css}\`; | ||
const doInject = () => { | ||
if (typeof document === 'undefined') { | ||
if (typeof win.document === 'undefined') { | ||
return; | ||
} | ||
let root = document.querySelector('${injectToSelector}'); | ||
let root = win.document.querySelector('${injectToSelector}'); | ||
if (root && root.shadowRoot) { | ||
@@ -81,16 +81,15 @@ root = root.shadowRoot; | ||
if (!root) { | ||
root = document.head; | ||
root = win.document.head; | ||
} | ||
let container = root.querySelector('#_${digest}'); | ||
if (!container) { | ||
container = document.createElement('style'); | ||
container = win.document.createElement('style'); | ||
container.id = '_${digest}'; | ||
const text = win.document.createTextNode(css); | ||
container.appendChild(text); | ||
root.appendChild(container); | ||
} | ||
const text = document.createTextNode(css); | ||
container.appendChild(text); | ||
delete window.__inject_${digest}__; | ||
} | ||
window.__inject_${digest}__ = doInject; | ||
})(); | ||
win.__inject_${digest}__ = doInject; | ||
})(globalThis); | ||
`; | ||
@@ -97,0 +96,0 @@ }; |
{ | ||
"name": "esbuild-css-modules-plugin", | ||
"version": "2.6.3", | ||
"version": "2.6.4-dev.0", | ||
"description": "A esbuild plugin to bundle css modules into js(x)/ts(x).", | ||
@@ -21,3 +21,3 @@ "main": "./index.js", | ||
"test": "cd ./test && node test.js", | ||
"pub": "npm_config_registry=https://registry.npmjs.org/ npm publish --userconfig ~/.pubnpmrc --access public" | ||
"pub": "npm_config_registry=https://registry.npmjs.org/ npm publish --userconfig ~/.pubnpmrc --access public --tag latest" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
38541
1020
2