@unocss/webpack
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -10,4 +10,4 @@ var __create = Object.create; | ||
__markAsModule(target); | ||
for (var name2 in all) | ||
__defProp(target, name2, { get: all[name2], enumerable: true }); | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
@@ -51,4 +51,4 @@ var __reExport = (target, module2, desc) => { | ||
]; | ||
var PLACEHOLDER_RE = /(\\?")?#--unocss--\s*{\s*layer\s*:\s*(.+?);?\s*}/g; | ||
var ALL_LAYERS = "__ALL__"; | ||
var LAYER_PLACEHOLDER_RE = /(\\?")?#--unocss--\s*{\s*layer\s*:\s*(.+?);?\s*}/g; | ||
var LAYER_MARK_ALL = "__ALL__"; | ||
function resolveId(id) { | ||
@@ -63,3 +63,3 @@ for (const alias of VIRTUAL_ENTRY_ALIAS) { | ||
id: "/__uno.css", | ||
layer: ALL_LAYERS | ||
layer: LAYER_MARK_ALL | ||
}; | ||
@@ -74,3 +74,4 @@ } | ||
// src/index.ts | ||
var name = "unocss:webpack"; | ||
var PLUGIN_NAME = "unocss:webpack"; | ||
var UPDATE_DEBOUNCE = 10; | ||
function defineConfig(config) { | ||
@@ -88,3 +89,2 @@ return config; | ||
const entries = new Map(); | ||
const isDev = !!process.env.WEBPACK_DEV_SERVER || process.env.NODE_ENV === "development"; | ||
const plugin = { | ||
@@ -114,4 +114,4 @@ name: "unocss:webpack", | ||
webpack(compiler) { | ||
compiler.hooks.compilation.tap(name, (compilation) => { | ||
compilation.hooks.optimizeAssets.tapPromise(name, async () => { | ||
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => { | ||
compilation.hooks.optimizeAssets.tapPromise(PLUGIN_NAME, async () => { | ||
const files = Object.keys(compilation.assets); | ||
@@ -123,5 +123,5 @@ await Promise.all(tasks); | ||
let replaced = false; | ||
code = code.replace(PLACEHOLDER_RE, (_, quote, layer) => { | ||
code = code.replace(LAYER_PLACEHOLDER_RE, (_, quote, layer) => { | ||
replaced = true; | ||
const css = layer === ALL_LAYERS ? result.getLayers(void 0, Array.from(entries.values())) : result.getLayer(layer) || ""; | ||
const css = layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(entries.values())) : result.getLayer(layer) || ""; | ||
if (!quote) | ||
@@ -150,3 +150,3 @@ return css; | ||
clearTimeout(timer); | ||
timer = setTimeout(updateModules, 10); | ||
timer = setTimeout(updateModules, UPDATE_DEBOUNCE); | ||
} | ||
@@ -162,3 +162,3 @@ async function updateModules() { | ||
return; | ||
const code = layer === ALL_LAYERS ? result.getLayers(void 0, Array.from(entries.values())) : result.getLayer(layer) || ""; | ||
const code = layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(entries.values())) : result.getLayer(layer) || ""; | ||
plugin.__vfs.writeModule(id, code); | ||
@@ -165,0 +165,0 @@ }); |
{ | ||
"name": "@unocss/webpack", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "The Webpack plugin for UnoCSS", | ||
@@ -36,4 +36,4 @@ "keywords": [ | ||
"@rollup/pluginutils": "^4.1.1", | ||
"@unocss/config": "0.9.1", | ||
"@unocss/core": "0.9.1", | ||
"@unocss/config": "0.9.2", | ||
"@unocss/core": "0.9.2", | ||
"unplugin": "^0.2.20", | ||
@@ -40,0 +40,0 @@ "webpack-sources": "^3.2.1" |
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
0
14147
+ Added@unocss/config@0.9.2(transitive)
+ Added@unocss/core@0.9.2(transitive)
- Removed@unocss/config@0.9.1(transitive)
- Removed@unocss/core@0.9.1(transitive)
Updated@unocss/config@0.9.2
Updated@unocss/core@0.9.2