@unocss/vite 0.50.4 → 0.50.5

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
@@ -31,15 +31,15 @@ const VIRTUAL_ENTRY_ALIAS = [
31
31
  /^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
32
32
  ];
33
33
  const LAYER_MARK_ALL = "__ALL__";
34
- const RESOLVED_ID_WITH_QUERY_RE = /[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
35
- const RESOLVED_ID_RE = /[\/\\]__uno(?:(_.*?))?\.css$/;
34
+ const RESOLVED_ID_WITH_QUERY_RE = /\0?[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
35
+ const RESOLVED_ID_RE = /\0?[\/\\]__uno(?:(_.*?))?\.css$/;
36
36
  function resolveId(id) {
37
37
  if (id.match(RESOLVED_ID_WITH_QUERY_RE))
38
38
  return id;
39
39
  for (const alias of VIRTUAL_ENTRY_ALIAS) {
40
40
  const match = id.match(alias);
41
41
  if (match) {
42
- return match[1] ? `/__uno_${match[1]}.css` : "/__uno.css";
42
+ return match[1] ? `\0/__uno_${match[1]}.css` : "\0/__uno.css";
43
43
  }
44
44
  }
45
45
  }
@@ -659,7 +659,10 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
659
659
  if (!layer)
660
660
  return null;
661
661
  const { hash, css } = await generateCSS(layer);
662
- return `__uno_hash_${hash}{--:'';}${css}`;
662
+ return {
663
+ code: `__uno_hash_${hash}{--:'';}${css}`,
664
+ map: { mappings: "" }
665
+ };
663
666
  }
664
667
  },
665
668
  {
@@ -691,7 +694,12 @@ if (!import.meta.url.includes('?'))
691
694
  })()`;
692
695
  hmr = `
693
696
  if (import.meta.hot) {${hmr}}`;
694
- return code + hmr;
697
+ const s = new MagicString__default(code);
698
+ s.append(hmr);
699
+ return {
700
+ code: s.toString(),
701
+ map: s.generateMap()
702
+ };
695
703
  }
696
704
  }
697
705
  }
package/dist/index.mjs CHANGED
@@ -18,15 +18,15 @@ const VIRTUAL_ENTRY_ALIAS = [
18
18
  /^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
19
19
  ];
20
20
  const LAYER_MARK_ALL = "__ALL__";
21
- const RESOLVED_ID_WITH_QUERY_RE = /[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
22
- const RESOLVED_ID_RE = /[\/\\]__uno(?:(_.*?))?\.css$/;
21
+ const RESOLVED_ID_WITH_QUERY_RE = /\0?[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
22
+ const RESOLVED_ID_RE = /\0?[\/\\]__uno(?:(_.*?))?\.css$/;
23
23
  function resolveId(id) {
24
24
  if (id.match(RESOLVED_ID_WITH_QUERY_RE))
25
25
  return id;
26
26
  for (const alias of VIRTUAL_ENTRY_ALIAS) {
27
27
  const match = id.match(alias);
28
28
  if (match) {
29
- return match[1] ? `/__uno_${match[1]}.css` : "/__uno.css";
29
+ return match[1] ? `\0/__uno_${match[1]}.css` : "\0/__uno.css";
30
30
  }
31
31
  }
32
32
  }
@@ -646,7 +646,10 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
646
646
  if (!layer)
647
647
  return null;
648
648
  const { hash, css } = await generateCSS(layer);
649
- return `__uno_hash_${hash}{--:'';}${css}`;
649
+ return {
650
+ code: `__uno_hash_${hash}{--:'';}${css}`,
651
+ map: { mappings: "" }
652
+ };
650
653
  }
651
654
  },
652
655
  {
@@ -678,7 +681,12 @@ if (!import.meta.url.includes('?'))
678
681
  })()`;
679
682
  hmr = `
680
683
  if (import.meta.hot) {${hmr}}`;
681
- return code + hmr;
684
+ const s = new MagicString(code);
685
+ s.append(hmr);
686
+ return {
687
+ code: s.toString(),
688
+ map: s.generateMap()
689
+ };
682
690
  }
683
691
  }
684
692
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.50.4",
3
+ "version": "0.50.5",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -47,15 +47,15 @@
47
47
  "chokidar": "^3.5.3",
48
48
  "fast-glob": "^3.2.12",
49
49
  "magic-string": "^0.30.0",
50
- "@unocss/config": "0.50.4",
51
- "@unocss/core": "0.50.4",
52
- "@unocss/inspector": "0.50.4",
53
- "@unocss/scope": "0.50.4",
54
- "@unocss/transformer-directives": "0.50.4"
50
+ "@unocss/config": "0.50.5",
51
+ "@unocss/core": "0.50.5",
52
+ "@unocss/inspector": "0.50.5",
53
+ "@unocss/scope": "0.50.5",
54
+ "@unocss/transformer-directives": "0.50.5"
55
55
  },
56
56
  "devDependencies": {
57
- "vite": "^4.1.4",
58
- "@unocss/shared-integration": "0.50.4"
57
+ "vite": "^4.2.0",
58
+ "@unocss/shared-integration": "0.50.5"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "unbuild",