@unocss/vite 0.32.8 → 0.32.9

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
@@ -40,6 +40,7 @@ function resolveId(id) {
40
40
  }
41
41
  }
42
42
  }
43
+ const RESOLVED_ID_RE = /\/__uno(_.*?)?\.css$/;
43
44
  const LAYER_PLACEHOLDER_RE = /(\\?")?#--unocss--\s*{\s*layer\s*:\s*(.+?);?\s*}/g;
44
45
  function getLayerPlaceholder(layer) {
45
46
  return `#--unocss--{layer:${layer}}`;
@@ -253,12 +254,14 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, modules, filter, g
253
254
  const chunks = Object.keys(chunk.modules).filter((i) => modules.has(i));
254
255
  if (!chunks.length)
255
256
  return null;
257
+ const fakeCssId = `${chunk.fileName}-unocss-hash.css`;
256
258
  const tokens2 = /* @__PURE__ */ new Set();
257
259
  await Promise.all(chunks.map((c) => uno.applyExtractors(modules.get(c) || "", c, tokens2)));
258
260
  let { css } = await uno.generate(tokens2, { minify: true });
259
261
  if (!css)
260
262
  return null;
261
- const fakeCssId = `${chunk.fileName}-unocss-hash.css`;
263
+ if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
264
+ return null;
262
265
  css = await transformCSS(css, fakeCssId);
263
266
  const hash = getHash(css);
264
267
  await cssPostPlugin.transform(getHashPlaceholder(hash), fakeCssId);
package/dist/index.mjs CHANGED
@@ -30,6 +30,7 @@ function resolveId(id) {
30
30
  }
31
31
  }
32
32
  }
33
+ const RESOLVED_ID_RE = /\/__uno(_.*?)?\.css$/;
33
34
  const LAYER_PLACEHOLDER_RE = /(\\?")?#--unocss--\s*{\s*layer\s*:\s*(.+?);?\s*}/g;
34
35
  function getLayerPlaceholder(layer) {
35
36
  return `#--unocss--{layer:${layer}}`;
@@ -243,12 +244,14 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, modules, filter, g
243
244
  const chunks = Object.keys(chunk.modules).filter((i) => modules.has(i));
244
245
  if (!chunks.length)
245
246
  return null;
247
+ const fakeCssId = `${chunk.fileName}-unocss-hash.css`;
246
248
  const tokens2 = /* @__PURE__ */ new Set();
247
249
  await Promise.all(chunks.map((c) => uno.applyExtractors(modules.get(c) || "", c, tokens2)));
248
250
  let { css } = await uno.generate(tokens2, { minify: true });
249
251
  if (!css)
250
252
  return null;
251
- const fakeCssId = `${chunk.fileName}-unocss-hash.css`;
253
+ if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
254
+ return null;
252
255
  css = await transformCSS(css, fakeCssId);
253
256
  const hash = getHash(css);
254
257
  await cssPostPlugin.transform(getHashPlaceholder(hash), fakeCssId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.32.8",
3
+ "version": "0.32.9",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -43,11 +43,11 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@rollup/pluginutils": "^4.2.1",
46
- "@unocss/config": "0.32.8",
47
- "@unocss/core": "0.32.8",
48
- "@unocss/inspector": "0.32.8",
49
- "@unocss/scope": "0.32.8",
50
- "@unocss/transformer-directives": "0.32.8",
46
+ "@unocss/config": "0.32.9",
47
+ "@unocss/core": "0.32.9",
48
+ "@unocss/inspector": "0.32.9",
49
+ "@unocss/scope": "0.32.9",
50
+ "@unocss/transformer-directives": "0.32.9",
51
51
  "magic-string": "^0.26.1"
52
52
  },
53
53
  "devDependencies": {