@unocss/vite 0.45.15 → 0.45.20

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) {
@@ -58,6 +61,7 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
58
61
  }) {
59
62
  let root = process.cwd();
60
63
  let rawConfig = {};
64
+ let configFileList = [];
61
65
  const uno = core.createGenerator(rawConfig, defaults);
62
66
  let rollupFilter = pluginutils.createFilter(defaultInclude, defaultExclude);
63
67
  const invalidations = [];
@@ -70,6 +74,7 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
70
74
  const result = await config.loadConfig(root, configOrPath, extraConfigSources);
71
75
  resolveConfigResult(result);
72
76
  rawConfig = result.config;
77
+ configFileList = result.sources;
73
78
  uno.setConfig(rawConfig);
74
79
  uno.config.envMode = "dev";
75
80
  rollupFilter = pluginutils.createFilter(
@@ -141,7 +146,8 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
141
146
  extract,
142
147
  getConfig,
143
148
  root,
144
- updateRoot
149
+ updateRoot,
150
+ getConfigFileList: () => configFileList
145
151
  };
146
152
  }
147
153
 
@@ -366,7 +372,7 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, filter, getConfig
366
372
  if (!replaced) {
367
373
  let msg = "[unocss] does not found CSS placeholder in the generated chunks";
368
374
  if (viteConfig.build.lib && checkJs)
369
- 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";
370
376
  else
371
377
  msg += "\nThis is likely an internal bug of unocss vite plugin";
372
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) {
@@ -47,6 +50,7 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
47
50
  }) {
48
51
  let root = process.cwd();
49
52
  let rawConfig = {};
53
+ let configFileList = [];
50
54
  const uno = createGenerator(rawConfig, defaults);
51
55
  let rollupFilter = createFilter(defaultInclude, defaultExclude);
52
56
  const invalidations = [];
@@ -59,6 +63,7 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
59
63
  const result = await loadConfig(root, configOrPath, extraConfigSources);
60
64
  resolveConfigResult(result);
61
65
  rawConfig = result.config;
66
+ configFileList = result.sources;
62
67
  uno.setConfig(rawConfig);
63
68
  uno.config.envMode = "dev";
64
69
  rollupFilter = createFilter(
@@ -130,7 +135,8 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
130
135
  extract,
131
136
  getConfig,
132
137
  root,
133
- updateRoot
138
+ updateRoot,
139
+ getConfigFileList: () => configFileList
134
140
  };
135
141
  }
136
142
 
@@ -355,7 +361,7 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, filter, getConfig
355
361
  if (!replaced) {
356
362
  let msg = "[unocss] does not found CSS placeholder in the generated chunks";
357
363
  if (viteConfig.build.lib && checkJs)
358
- 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";
359
365
  else
360
366
  msg += "\nThis is likely an internal bug of unocss vite plugin";
361
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.15",
3
+ "version": "0.45.20",
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.15",
48
- "@unocss/core": "0.45.15",
49
- "@unocss/inspector": "0.45.15",
50
- "@unocss/scope": "0.45.15",
51
- "@unocss/transformer-directives": "0.45.15",
52
- "magic-string": "^0.26.2"
47
+ "@unocss/config": "0.45.20",
48
+ "@unocss/core": "0.45.20",
49
+ "@unocss/inspector": "0.45.20",
50
+ "@unocss/scope": "0.45.20",
51
+ "@unocss/transformer-directives": "0.45.20",
52
+ "magic-string": "^0.26.3"
53
53
  },
54
54
  "devDependencies": {
55
- "@unocss/shared-integration": "0.45.15",
56
- "vite": "^3.0.8"
55
+ "@unocss/shared-integration": "0.45.20",
56
+ "vite": "^3.1.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "unbuild",