@unocss/vite 0.45.18 → 0.45.21

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
@@ -27,7 +27,10 @@ const VIRTUAL_ENTRY_ALIAS = [
27
27
  /^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
28
28
  ];
29
29
  const LAYER_MARK_ALL = "__ALL__";
30
+ const RESOLVED_ID_WITH_QUERY_RE = /\/__uno(?:(_.*?))?\.css(\?.*)?$/;
30
31
  function resolveId(id) {
32
+ if (id.match(RESOLVED_ID_WITH_QUERY_RE))
33
+ return id;
31
34
  for (const alias of VIRTUAL_ENTRY_ALIAS) {
32
35
  const match = id.match(alias);
33
36
  if (match) {
@@ -117,7 +120,7 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
117
120
  const filter = (code, id) => {
118
121
  if (code.includes(IGNORE_COMMENT))
119
122
  return false;
120
- return code.includes(INCLUDE_COMMENT) || code.includes(CSS_PLACEHOLDER) || rollupFilter(id);
123
+ return code.includes(INCLUDE_COMMENT) || code.includes(CSS_PLACEHOLDER) || rollupFilter(id.replace(/\?v=\w+$/, ""));
121
124
  };
122
125
  async function getConfig() {
123
126
  await ready;
@@ -369,7 +372,7 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, filter, getConfig
369
372
  if (!replaced) {
370
373
  let msg = "[unocss] does not found CSS placeholder in the generated chunks";
371
374
  if (viteConfig.build.lib && checkJs)
372
- msg += "\nIt seems you are building in library mode, it's recommanded to set `build.cssCodeSplit` to true.\nSee https://github.com/vitejs/vite/issues/1579";
375
+ 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";
373
376
  else
374
377
  msg += "\nThis is likely an internal bug of unocss vite plugin";
375
378
  this.error(new Error(msg));
package/dist/index.mjs CHANGED
@@ -16,7 +16,10 @@ const VIRTUAL_ENTRY_ALIAS = [
16
16
  /^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
17
17
  ];
18
18
  const LAYER_MARK_ALL = "__ALL__";
19
+ const RESOLVED_ID_WITH_QUERY_RE = /\/__uno(?:(_.*?))?\.css(\?.*)?$/;
19
20
  function resolveId(id) {
21
+ if (id.match(RESOLVED_ID_WITH_QUERY_RE))
22
+ return id;
20
23
  for (const alias of VIRTUAL_ENTRY_ALIAS) {
21
24
  const match = id.match(alias);
22
25
  if (match) {
@@ -106,7 +109,7 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
106
109
  const filter = (code, id) => {
107
110
  if (code.includes(IGNORE_COMMENT))
108
111
  return false;
109
- return code.includes(INCLUDE_COMMENT) || code.includes(CSS_PLACEHOLDER) || rollupFilter(id);
112
+ return code.includes(INCLUDE_COMMENT) || code.includes(CSS_PLACEHOLDER) || rollupFilter(id.replace(/\?v=\w+$/, ""));
110
113
  };
111
114
  async function getConfig() {
112
115
  await ready;
@@ -358,7 +361,7 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, filter, getConfig
358
361
  if (!replaced) {
359
362
  let msg = "[unocss] does not found CSS placeholder in the generated chunks";
360
363
  if (viteConfig.build.lib && checkJs)
361
- msg += "\nIt seems you are building in library mode, it's recommanded to set `build.cssCodeSplit` to true.\nSee https://github.com/vitejs/vite/issues/1579";
364
+ 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";
362
365
  else
363
366
  msg += "\nThis is likely an internal bug of unocss vite plugin";
364
367
  this.error(new Error(msg));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.45.18",
3
+ "version": "0.45.21",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -44,16 +44,16 @@
44
44
  "dependencies": {
45
45
  "@ampproject/remapping": "^2.2.0",
46
46
  "@rollup/pluginutils": "^4.2.1",
47
- "@unocss/config": "0.45.18",
48
- "@unocss/core": "0.45.18",
49
- "@unocss/inspector": "0.45.18",
50
- "@unocss/scope": "0.45.18",
51
- "@unocss/transformer-directives": "0.45.18",
52
- "magic-string": "^0.26.2"
47
+ "@unocss/config": "0.45.21",
48
+ "@unocss/core": "0.45.21",
49
+ "@unocss/inspector": "0.45.21",
50
+ "@unocss/scope": "0.45.21",
51
+ "@unocss/transformer-directives": "0.45.21",
52
+ "magic-string": "^0.26.3"
53
53
  },
54
54
  "devDependencies": {
55
- "@unocss/shared-integration": "0.45.18",
56
- "vite": "^3.0.8"
55
+ "@unocss/shared-integration": "0.45.21",
56
+ "vite": "^3.1.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "unbuild",