@unocss/vite 0.60.1 → 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.mjs +9 -10
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -20,8 +20,8 @@ const VIRTUAL_ENTRY_ALIAS = [
|
|
|
20
20
|
/^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
|
|
21
21
|
];
|
|
22
22
|
const LAYER_MARK_ALL = "__ALL__";
|
|
23
|
-
const RESOLVED_ID_WITH_QUERY_RE = /[
|
|
24
|
-
const RESOLVED_ID_RE = /[
|
|
23
|
+
const RESOLVED_ID_WITH_QUERY_RE = /[/\\]__uno(_.*?)?\.css(\?.*)?$/;
|
|
24
|
+
const RESOLVED_ID_RE = /[/\\]__uno(?:_(.*?))?\.css$/;
|
|
25
25
|
function resolveId(id) {
|
|
26
26
|
if (id.match(RESOLVED_ID_WITH_QUERY_RE))
|
|
27
27
|
return id;
|
|
@@ -37,11 +37,11 @@ function resolveLayer(id) {
|
|
|
37
37
|
if (match)
|
|
38
38
|
return match[1] || LAYER_MARK_ALL;
|
|
39
39
|
}
|
|
40
|
-
const LAYER_PLACEHOLDER_RE = /#--unocss--\s
|
|
40
|
+
const LAYER_PLACEHOLDER_RE = /#--unocss--\s*\{\s*layer\s*:\s*(.+?)\s*(?:;\s*escape-view\s*:\s*(.+?)\s*)?;?\s*\}/g;
|
|
41
41
|
function getLayerPlaceholder(layer) {
|
|
42
42
|
return `#--unocss--{layer:${layer};escape-view:\\"\\'\\\`\\\\}`;
|
|
43
43
|
}
|
|
44
|
-
const HASH_PLACEHOLDER_RE = /#--unocss-hash--\s
|
|
44
|
+
const HASH_PLACEHOLDER_RE = /#--unocss-hash--\s*\{\s*content\s*:\s*\\*"([^\\"]+)\\*";?\s*\}/g;
|
|
45
45
|
function getHashPlaceholder(hash) {
|
|
46
46
|
return `#--unocss-hash--{content:"${hash}"}`;
|
|
47
47
|
}
|
|
@@ -289,7 +289,6 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
if (code !== original) {
|
|
292
|
-
ctx.affectedModules.add(id);
|
|
293
292
|
return {
|
|
294
293
|
code,
|
|
295
294
|
map: remapping(maps, (_, ctx2) => {
|
|
@@ -570,7 +569,7 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
570
569
|
const css = chunk.source.replace(HASH_PLACEHOLDER_RE, "");
|
|
571
570
|
chunk.source = await replaceAsync(css, LAYER_PLACEHOLDER_RE, async (_, layer) => {
|
|
572
571
|
replaced = true;
|
|
573
|
-
return getLayer(layer, css);
|
|
572
|
+
return getLayer(layer.trim(), css);
|
|
574
573
|
});
|
|
575
574
|
Array.from(vfsLayers).forEach((layer) => {
|
|
576
575
|
chunk.source = getLayer(layer, chunk.source, true);
|
|
@@ -579,7 +578,7 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
579
578
|
const js = chunk.code.replace(HASH_PLACEHOLDER_RE, "");
|
|
580
579
|
chunk.code = await replaceAsync(js, LAYER_PLACEHOLDER_RE, async (_, layer) => {
|
|
581
580
|
replaced = true;
|
|
582
|
-
const css = getLayer(layer, js);
|
|
581
|
+
const css = getLayer(layer.trim(), js);
|
|
583
582
|
return css.replace(/\n/g, "").replace(/(?<!\\)(['"])/g, "\\$1");
|
|
584
583
|
});
|
|
585
584
|
Array.from(vfsLayers).forEach((layer) => {
|
|
@@ -593,7 +592,7 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
593
592
|
msg += "\nIt seems you are building in library mode, it's recommended to set `build.cssCodeSplit` to true.\nSee https://github.com/vitejs/vite/issues/1579";
|
|
594
593
|
else
|
|
595
594
|
msg += "\nThis is likely an internal bug of unocss vite plugin";
|
|
596
|
-
this.
|
|
595
|
+
this.warn(msg);
|
|
597
596
|
}
|
|
598
597
|
}
|
|
599
598
|
}
|
|
@@ -924,9 +923,9 @@ function VueScopedPlugin({ uno, ready }) {
|
|
|
924
923
|
}
|
|
925
924
|
|
|
926
925
|
function ShadowDomModuleModePlugin({ uno }) {
|
|
927
|
-
const partExtractorRegex = /^part-\[(.+)]:/;
|
|
926
|
+
const partExtractorRegex = /^part-\[(.+)\]:/;
|
|
928
927
|
const nameRegexp = /<([^\s^!>]+)\s*([^>]*)>/;
|
|
929
|
-
const vueSFCStyleRE =
|
|
928
|
+
const vueSFCStyleRE = /<style[^>]*>[\s\S]*@unocss-placeholder[\s\S]*<\/style>/;
|
|
930
929
|
const checkElement = (useParts, idxResolver, element) => {
|
|
931
930
|
if (!element)
|
|
932
931
|
return null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.60.
|
|
4
|
+
"version": "0.60.3",
|
|
5
5
|
"description": "The Vite plugin for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"chokidar": "^3.6.0",
|
|
55
55
|
"fast-glob": "^3.3.2",
|
|
56
56
|
"magic-string": "^0.30.10",
|
|
57
|
-
"@unocss/
|
|
58
|
-
"@unocss/
|
|
59
|
-
"@unocss/inspector": "0.60.
|
|
60
|
-
"@unocss/scope": "0.60.
|
|
61
|
-
"@unocss/transformer-directives": "0.60.
|
|
57
|
+
"@unocss/core": "0.60.3",
|
|
58
|
+
"@unocss/config": "0.60.3",
|
|
59
|
+
"@unocss/inspector": "0.60.3",
|
|
60
|
+
"@unocss/scope": "0.60.3",
|
|
61
|
+
"@unocss/transformer-directives": "0.60.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"vite": "^5.2.11",
|
|
65
|
-
"@unocss/shared-integration": "0.60.
|
|
65
|
+
"@unocss/shared-integration": "0.60.3"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "unbuild",
|