@unocss/webpack 0.60.2 → 0.60.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -8
- package/dist/index.mjs +7 -8
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -201,7 +201,6 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
if (code !== original) {
|
|
204
|
-
ctx.affectedModules.add(id);
|
|
205
204
|
return {
|
|
206
205
|
code,
|
|
207
206
|
map: remapping__default(maps, (_, ctx2) => {
|
|
@@ -278,8 +277,8 @@ const VIRTUAL_ENTRY_ALIAS = [
|
|
|
278
277
|
/^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
|
|
279
278
|
];
|
|
280
279
|
const LAYER_MARK_ALL = "__ALL__";
|
|
281
|
-
const RESOLVED_ID_WITH_QUERY_RE = /[
|
|
282
|
-
const RESOLVED_ID_RE = /[
|
|
280
|
+
const RESOLVED_ID_WITH_QUERY_RE = /[/\\]__uno(_.*?)?\.css(\?.*)?$/;
|
|
281
|
+
const RESOLVED_ID_RE = /[/\\]__uno(?:_(.*?))?\.css$/;
|
|
283
282
|
function resolveId(id) {
|
|
284
283
|
if (id.match(RESOLVED_ID_WITH_QUERY_RE))
|
|
285
284
|
return id;
|
|
@@ -295,7 +294,7 @@ function resolveLayer(id) {
|
|
|
295
294
|
if (match)
|
|
296
295
|
return match[1] || LAYER_MARK_ALL;
|
|
297
296
|
}
|
|
298
|
-
const LAYER_PLACEHOLDER_RE = /#--unocss--\s
|
|
297
|
+
const LAYER_PLACEHOLDER_RE = /#--unocss--\s*\{\s*layer\s*:\s*(.+?)\s*(?:;\s*escape-view\s*:\s*(.+?)\s*)?;?\s*\}/g;
|
|
299
298
|
function getLayerPlaceholder(layer) {
|
|
300
299
|
return `#--unocss--{layer:${layer};escape-view:\\"\\'\\\`\\\\}`;
|
|
301
300
|
}
|
|
@@ -305,14 +304,14 @@ function getCssEscaperForJsContent(view) {
|
|
|
305
304
|
const prefix = {};
|
|
306
305
|
const escapeViewRe = /(\\*)\\(["'`\\])/g;
|
|
307
306
|
view.trim().replace(escapeViewRe, (_, bs, char) => {
|
|
308
|
-
prefix[char] = bs;
|
|
307
|
+
prefix[char] = bs.replace(/\\\\/g, "\\");
|
|
309
308
|
return "";
|
|
310
309
|
});
|
|
311
310
|
return (css) => css.replace(/["'`\\]/g, (v) => {
|
|
312
311
|
return (prefix[v] || "") + v;
|
|
313
312
|
});
|
|
314
313
|
}
|
|
315
|
-
const HASH_PLACEHOLDER_RE = /#--unocss-hash--\s
|
|
314
|
+
const HASH_PLACEHOLDER_RE = /#--unocss-hash--\s*\{\s*content\s*:\s*\\*"([^\\"]+)\\*";?\s*\}/g;
|
|
316
315
|
function getHashPlaceholder(hash) {
|
|
317
316
|
return `#--unocss-hash--{content:"${hash}"}`;
|
|
318
317
|
}
|
|
@@ -411,8 +410,8 @@ function WebpackPlugin(configOrPath, defaults) {
|
|
|
411
410
|
code = code.replace(HASH_PLACEHOLDER_RE, "");
|
|
412
411
|
code = code.replace(LAYER_PLACEHOLDER_RE, (_, layer, escapeView) => {
|
|
413
412
|
replaced = true;
|
|
414
|
-
const css = layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(entries).map((i) => resolveLayer(i)).filter((i) => !!i)) : result.getLayer(layer) || "";
|
|
415
|
-
escapeCss = escapeCss ?? getCssEscaperForJsContent(escapeView);
|
|
413
|
+
const css = layer.trim() === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(entries).map((i) => resolveLayer(i)).filter((i) => !!i)) : result.getLayer(layer) || "";
|
|
414
|
+
escapeCss = escapeCss ?? getCssEscaperForJsContent(escapeView.trim());
|
|
416
415
|
return escapeCss(css);
|
|
417
416
|
});
|
|
418
417
|
if (replaced)
|
package/dist/index.mjs
CHANGED
|
@@ -188,7 +188,6 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
if (code !== original) {
|
|
191
|
-
ctx.affectedModules.add(id);
|
|
192
191
|
return {
|
|
193
192
|
code,
|
|
194
193
|
map: remapping(maps, (_, ctx2) => {
|
|
@@ -265,8 +264,8 @@ const VIRTUAL_ENTRY_ALIAS = [
|
|
|
265
264
|
/^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
|
|
266
265
|
];
|
|
267
266
|
const LAYER_MARK_ALL = "__ALL__";
|
|
268
|
-
const RESOLVED_ID_WITH_QUERY_RE = /[
|
|
269
|
-
const RESOLVED_ID_RE = /[
|
|
267
|
+
const RESOLVED_ID_WITH_QUERY_RE = /[/\\]__uno(_.*?)?\.css(\?.*)?$/;
|
|
268
|
+
const RESOLVED_ID_RE = /[/\\]__uno(?:_(.*?))?\.css$/;
|
|
270
269
|
function resolveId(id) {
|
|
271
270
|
if (id.match(RESOLVED_ID_WITH_QUERY_RE))
|
|
272
271
|
return id;
|
|
@@ -282,7 +281,7 @@ function resolveLayer(id) {
|
|
|
282
281
|
if (match)
|
|
283
282
|
return match[1] || LAYER_MARK_ALL;
|
|
284
283
|
}
|
|
285
|
-
const LAYER_PLACEHOLDER_RE = /#--unocss--\s
|
|
284
|
+
const LAYER_PLACEHOLDER_RE = /#--unocss--\s*\{\s*layer\s*:\s*(.+?)\s*(?:;\s*escape-view\s*:\s*(.+?)\s*)?;?\s*\}/g;
|
|
286
285
|
function getLayerPlaceholder(layer) {
|
|
287
286
|
return `#--unocss--{layer:${layer};escape-view:\\"\\'\\\`\\\\}`;
|
|
288
287
|
}
|
|
@@ -292,14 +291,14 @@ function getCssEscaperForJsContent(view) {
|
|
|
292
291
|
const prefix = {};
|
|
293
292
|
const escapeViewRe = /(\\*)\\(["'`\\])/g;
|
|
294
293
|
view.trim().replace(escapeViewRe, (_, bs, char) => {
|
|
295
|
-
prefix[char] = bs;
|
|
294
|
+
prefix[char] = bs.replace(/\\\\/g, "\\");
|
|
296
295
|
return "";
|
|
297
296
|
});
|
|
298
297
|
return (css) => css.replace(/["'`\\]/g, (v) => {
|
|
299
298
|
return (prefix[v] || "") + v;
|
|
300
299
|
});
|
|
301
300
|
}
|
|
302
|
-
const HASH_PLACEHOLDER_RE = /#--unocss-hash--\s
|
|
301
|
+
const HASH_PLACEHOLDER_RE = /#--unocss-hash--\s*\{\s*content\s*:\s*\\*"([^\\"]+)\\*";?\s*\}/g;
|
|
303
302
|
function getHashPlaceholder(hash) {
|
|
304
303
|
return `#--unocss-hash--{content:"${hash}"}`;
|
|
305
304
|
}
|
|
@@ -398,8 +397,8 @@ function WebpackPlugin(configOrPath, defaults) {
|
|
|
398
397
|
code = code.replace(HASH_PLACEHOLDER_RE, "");
|
|
399
398
|
code = code.replace(LAYER_PLACEHOLDER_RE, (_, layer, escapeView) => {
|
|
400
399
|
replaced = true;
|
|
401
|
-
const css = layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(entries).map((i) => resolveLayer(i)).filter((i) => !!i)) : result.getLayer(layer) || "";
|
|
402
|
-
escapeCss = escapeCss ?? getCssEscaperForJsContent(escapeView);
|
|
400
|
+
const css = layer.trim() === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(entries).map((i) => resolveLayer(i)).filter((i) => !!i)) : result.getLayer(layer) || "";
|
|
401
|
+
escapeCss = escapeCss ?? getCssEscaperForJsContent(escapeView.trim());
|
|
403
402
|
return escapeCss(css);
|
|
404
403
|
});
|
|
405
404
|
if (replaced)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/webpack",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.60.
|
|
4
|
+
"version": "0.60.3",
|
|
5
5
|
"description": "The Webpack plugin for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"magic-string": "^0.30.10",
|
|
50
50
|
"unplugin": "^1.10.1",
|
|
51
51
|
"webpack-sources": "^3.2.3",
|
|
52
|
-
"@unocss/config": "0.60.
|
|
53
|
-
"@unocss/core": "0.60.
|
|
52
|
+
"@unocss/config": "0.60.3",
|
|
53
|
+
"@unocss/core": "0.60.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/webpack": "^5.28.5",
|