@unocss/vite 0.58.5 → 0.58.6

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 CHANGED
@@ -36,7 +36,7 @@ const VIRTUAL_ENTRY_ALIAS = [
36
36
  ];
37
37
  const LAYER_MARK_ALL = "__ALL__";
38
38
  const RESOLVED_ID_WITH_QUERY_RE = /[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
39
- const RESOLVED_ID_RE = /[\/\\]__uno(?:(_.*?))?\.css$/;
39
+ const RESOLVED_ID_RE = /[\/\\]__uno(?:_(.*?))?\.css$/;
40
40
  function resolveId(id) {
41
41
  if (id.match(RESOLVED_ID_WITH_QUERY_RE))
42
42
  return id;
@@ -52,9 +52,9 @@ function resolveLayer(id) {
52
52
  if (match)
53
53
  return match[1] || LAYER_MARK_ALL;
54
54
  }
55
- const LAYER_PLACEHOLDER_RE = /(\\?")?#--unocss--\s*{\s*layer\s*:\s*(.+?);?\s*}/g;
55
+ const LAYER_PLACEHOLDER_RE = /#--unocss--\s*{\s*layer\s*:\s*(.+?)\s*(?:;\s*escape-view\s*:\s*(.+?)\s*)?;?\s*}/g;
56
56
  function getLayerPlaceholder(layer) {
57
- return `#--unocss--{layer:${layer}}`;
57
+ return `#--unocss--{layer:${layer};escape-view:\\"\\'\\\`\\\\}`;
58
58
  }
59
59
  const HASH_PLACEHOLDER_RE = /#--unocss-hash--\s*{\s*content\s*:\s*\\*"(.+?)\\*";?\s*}/g;
60
60
  function getHashPlaceholder(hash) {
@@ -577,7 +577,7 @@ function GlobalModeBuildPlugin(ctx) {
577
577
  const chunk = bundle[file];
578
578
  if (chunk.type === "asset" && typeof chunk.source === "string") {
579
579
  const css = chunk.source.replace(HASH_PLACEHOLDER_RE, "");
580
- chunk.source = await replaceAsync(css, LAYER_PLACEHOLDER_RE, async (_, __, layer) => {
580
+ chunk.source = await replaceAsync(css, LAYER_PLACEHOLDER_RE, async (_, layer) => {
581
581
  replaced = true;
582
582
  return getLayer(layer, css);
583
583
  });
@@ -586,7 +586,7 @@ function GlobalModeBuildPlugin(ctx) {
586
586
  });
587
587
  } else if (chunk.type === "chunk" && typeof chunk.code === "string") {
588
588
  const js = chunk.code.replace(HASH_PLACEHOLDER_RE, "");
589
- chunk.code = await replaceAsync(js, LAYER_PLACEHOLDER_RE, async (_, __, layer) => {
589
+ chunk.code = await replaceAsync(js, LAYER_PLACEHOLDER_RE, async (_, layer) => {
590
590
  replaced = true;
591
591
  const css = getLayer(layer, js);
592
592
  return css.replace(/\n/g, "").replace(/(?<!\\)(['"])/g, "\\$1");
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ const VIRTUAL_ENTRY_ALIAS = [
21
21
  ];
22
22
  const LAYER_MARK_ALL = "__ALL__";
23
23
  const RESOLVED_ID_WITH_QUERY_RE = /[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
24
- const RESOLVED_ID_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,9 +37,9 @@ function resolveLayer(id) {
37
37
  if (match)
38
38
  return match[1] || LAYER_MARK_ALL;
39
39
  }
40
- const LAYER_PLACEHOLDER_RE = /(\\?")?#--unocss--\s*{\s*layer\s*:\s*(.+?);?\s*}/g;
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
- return `#--unocss--{layer:${layer}}`;
42
+ return `#--unocss--{layer:${layer};escape-view:\\"\\'\\\`\\\\}`;
43
43
  }
44
44
  const HASH_PLACEHOLDER_RE = /#--unocss-hash--\s*{\s*content\s*:\s*\\*"(.+?)\\*";?\s*}/g;
45
45
  function getHashPlaceholder(hash) {
@@ -562,7 +562,7 @@ function GlobalModeBuildPlugin(ctx) {
562
562
  const chunk = bundle[file];
563
563
  if (chunk.type === "asset" && typeof chunk.source === "string") {
564
564
  const css = chunk.source.replace(HASH_PLACEHOLDER_RE, "");
565
- chunk.source = await replaceAsync(css, LAYER_PLACEHOLDER_RE, async (_, __, layer) => {
565
+ chunk.source = await replaceAsync(css, LAYER_PLACEHOLDER_RE, async (_, layer) => {
566
566
  replaced = true;
567
567
  return getLayer(layer, css);
568
568
  });
@@ -571,7 +571,7 @@ function GlobalModeBuildPlugin(ctx) {
571
571
  });
572
572
  } else if (chunk.type === "chunk" && typeof chunk.code === "string") {
573
573
  const js = chunk.code.replace(HASH_PLACEHOLDER_RE, "");
574
- chunk.code = await replaceAsync(js, LAYER_PLACEHOLDER_RE, async (_, __, layer) => {
574
+ chunk.code = await replaceAsync(js, LAYER_PLACEHOLDER_RE, async (_, layer) => {
575
575
  replaced = true;
576
576
  const css = getLayer(layer, js);
577
577
  return css.replace(/\n/g, "").replace(/(?<!\\)(['"])/g, "\\$1");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.58.5",
3
+ "version": "0.58.6",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -42,20 +42,20 @@
42
42
  "vite": "^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0"
43
43
  },
44
44
  "dependencies": {
45
- "@ampproject/remapping": "^2.2.1",
45
+ "@ampproject/remapping": "^2.3.0",
46
46
  "@rollup/pluginutils": "^5.1.0",
47
- "chokidar": "^3.5.3",
47
+ "chokidar": "^3.6.0",
48
48
  "fast-glob": "^3.3.2",
49
- "magic-string": "^0.30.6",
50
- "@unocss/config": "0.58.5",
51
- "@unocss/core": "0.58.5",
52
- "@unocss/inspector": "0.58.5",
53
- "@unocss/scope": "0.58.5",
54
- "@unocss/transformer-directives": "0.58.5"
49
+ "magic-string": "^0.30.8",
50
+ "@unocss/config": "0.58.6",
51
+ "@unocss/core": "0.58.6",
52
+ "@unocss/inspector": "0.58.6",
53
+ "@unocss/scope": "0.58.6",
54
+ "@unocss/transformer-directives": "0.58.6"
55
55
  },
56
56
  "devDependencies": {
57
- "vite": "^5.0.12",
58
- "@unocss/shared-integration": "0.58.5"
57
+ "vite": "^5.1.6",
58
+ "@unocss/shared-integration": "0.58.6"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "unbuild",