@unocss/vite 0.58.4 → 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) {
@@ -560,7 +560,7 @@ function GlobalModeBuildPlugin(ctx) {
560
560
  if (!vfsLayers.size) {
561
561
  if (replaced)
562
562
  return;
563
- const msg = "[unocss] entry module not found, have you add `import 'uno.css'` in your main entry?";
563
+ const msg = "[unocss] Entry module not found. Did you add `import 'uno.css'` in your main entry?";
564
564
  this.warn(msg);
565
565
  return;
566
566
  }
@@ -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");
@@ -675,7 +675,7 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
675
675
  if (process__default.env.TEST || process__default.env.NODE_ENV === "test")
676
676
  return;
677
677
  if (!resolved) {
678
- const msg = "[unocss] entry module not found, have you add `import 'uno.css'` in your main entry?";
678
+ const msg = "[unocss] Entry module not found. Did you add `import 'uno.css'` in your main entry?";
679
679
  console.warn(msg);
680
680
  servers.forEach(({ ws }) => ws.send({
681
681
  type: "error",
package/dist/index.d.cts CHANGED
@@ -70,8 +70,8 @@ declare function VueScopedPlugin({ uno, ready }: UnocssPluginContext): Plugin;
70
70
 
71
71
  declare function defineConfig<Theme extends object>(config: VitePluginConfig<Theme>): VitePluginConfig<Theme>;
72
72
  interface UnocssVitePluginAPI {
73
- getContext(): UnocssPluginContext<VitePluginConfig>;
74
- getMode(): VitePluginConfig['mode'];
73
+ getContext: () => UnocssPluginContext<VitePluginConfig>;
74
+ getMode: () => VitePluginConfig['mode'];
75
75
  }
76
76
  declare function UnocssPlugin<Theme extends object>(configOrPath?: VitePluginConfig<Theme> | string, defaults?: UserConfigDefaults): Plugin[];
77
77
 
package/dist/index.d.mts CHANGED
@@ -70,8 +70,8 @@ declare function VueScopedPlugin({ uno, ready }: UnocssPluginContext): Plugin;
70
70
 
71
71
  declare function defineConfig<Theme extends object>(config: VitePluginConfig<Theme>): VitePluginConfig<Theme>;
72
72
  interface UnocssVitePluginAPI {
73
- getContext(): UnocssPluginContext<VitePluginConfig>;
74
- getMode(): VitePluginConfig['mode'];
73
+ getContext: () => UnocssPluginContext<VitePluginConfig>;
74
+ getMode: () => VitePluginConfig['mode'];
75
75
  }
76
76
  declare function UnocssPlugin<Theme extends object>(configOrPath?: VitePluginConfig<Theme> | string, defaults?: UserConfigDefaults): Plugin[];
77
77
 
package/dist/index.d.ts CHANGED
@@ -70,8 +70,8 @@ declare function VueScopedPlugin({ uno, ready }: UnocssPluginContext): Plugin;
70
70
 
71
71
  declare function defineConfig<Theme extends object>(config: VitePluginConfig<Theme>): VitePluginConfig<Theme>;
72
72
  interface UnocssVitePluginAPI {
73
- getContext(): UnocssPluginContext<VitePluginConfig>;
74
- getMode(): VitePluginConfig['mode'];
73
+ getContext: () => UnocssPluginContext<VitePluginConfig>;
74
+ getMode: () => VitePluginConfig['mode'];
75
75
  }
76
76
  declare function UnocssPlugin<Theme extends object>(configOrPath?: VitePluginConfig<Theme> | string, defaults?: UserConfigDefaults): Plugin[];
77
77
 
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) {
@@ -545,7 +545,7 @@ function GlobalModeBuildPlugin(ctx) {
545
545
  if (!vfsLayers.size) {
546
546
  if (replaced)
547
547
  return;
548
- const msg = "[unocss] entry module not found, have you add `import 'uno.css'` in your main entry?";
548
+ const msg = "[unocss] Entry module not found. Did you add `import 'uno.css'` in your main entry?";
549
549
  this.warn(msg);
550
550
  return;
551
551
  }
@@ -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");
@@ -660,7 +660,7 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
660
660
  if (process$1.env.TEST || process$1.env.NODE_ENV === "test")
661
661
  return;
662
662
  if (!resolved) {
663
- const msg = "[unocss] entry module not found, have you add `import 'uno.css'` in your main entry?";
663
+ const msg = "[unocss] Entry module not found. Did you add `import 'uno.css'` in your main entry?";
664
664
  console.warn(msg);
665
665
  servers.forEach(({ ws }) => ws.send({
666
666
  type: "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.58.4",
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.5",
50
- "@unocss/config": "0.58.4",
51
- "@unocss/core": "0.58.4",
52
- "@unocss/inspector": "0.58.4",
53
- "@unocss/scope": "0.58.4",
54
- "@unocss/transformer-directives": "0.58.4"
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.4"
57
+ "vite": "^5.1.6",
58
+ "@unocss/shared-integration": "0.58.6"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "unbuild",