@unocss/vite 0.59.4 → 0.60.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +5 -2
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -362,6 +362,8 @@ async function setupContentExtractor(ctx, shouldWatch = false) {
362
362
  }
363
363
  }
364
364
 
365
+ const LAYER_IMPORTS = "imports";
366
+
365
367
  function isLegacyChunk(chunk, options) {
366
368
  return options.format === "system" && chunk.fileName.includes("-legacy");
367
369
  }
@@ -528,7 +530,8 @@ function GlobalModeBuildPlugin(ctx) {
528
530
  }
529
531
  const result = await generateAll();
530
532
  const mappedVfsLayer = Array.from(vfsLayers).map((layer) => layer === LAYER_MARK_ALL ? layer : layer.replace(/^_/, ""));
531
- const cssWithLayers = Array.from(vfsLayers).map((layer) => `#--unocss-layer-start--${layer}--{start:${layer}} ${layer === LAYER_MARK_ALL ? result.getLayers(void 0, mappedVfsLayer) : result.getLayer(layer.replace(/^_/, "")) || ""} #--unocss-layer-end--${layer}--{end:${layer}}`).join("");
533
+ const importStatements = result.getLayer(LAYER_IMPORTS);
534
+ const cssWithLayers = Array.from(vfsLayers).map((layer) => `${importStatements ?? ""}#--unocss-layer-start--${layer}--{start:${layer}} ${layer === LAYER_MARK_ALL ? result.getLayers(void 0, [...mappedVfsLayer, LAYER_IMPORTS]) : result.getLayer(layer.replace(/^_/, "")) || ""} #--unocss-layer-end--${layer}--{end:${layer}}`).join("");
532
535
  const fakeCssId = `${viteConfig.root}/${chunk.fileName}-unocss-hash.css`;
533
536
  const css = await applyCssTransform(cssWithLayers, fakeCssId, options.dir, this);
534
537
  const transformHandler = "handler" in cssPost.transform ? cssPost.transform.handler : cssPost.transform;
@@ -733,7 +736,7 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
733
736
  const { hash, css } = await generateCSS(layer);
734
737
  return {
735
738
  // add hash to the chunk of CSS that it will send back to client to check if there is new CSS generated
736
- code: `__uno_hash_${hash}{--:'';}${css}`,
739
+ code: `${css}__uno_hash_${hash}{--:'';}`,
737
740
  map: { mappings: "" }
738
741
  };
739
742
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
3
  "type": "module",
4
- "version": "0.59.4",
4
+ "version": "0.60.0",
5
5
  "description": "The Vite plugin for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -54,15 +54,15 @@
54
54
  "chokidar": "^3.6.0",
55
55
  "fast-glob": "^3.3.2",
56
56
  "magic-string": "^0.30.10",
57
- "@unocss/config": "0.59.4",
58
- "@unocss/core": "0.59.4",
59
- "@unocss/inspector": "0.59.4",
60
- "@unocss/scope": "0.59.4",
61
- "@unocss/transformer-directives": "0.59.4"
57
+ "@unocss/config": "0.60.0",
58
+ "@unocss/core": "0.60.0",
59
+ "@unocss/inspector": "0.60.0",
60
+ "@unocss/scope": "0.60.0",
61
+ "@unocss/transformer-directives": "0.60.0"
62
62
  },
63
63
  "devDependencies": {
64
- "vite": "^5.2.9",
65
- "@unocss/shared-integration": "0.59.4"
64
+ "vite": "^5.2.11",
65
+ "@unocss/shared-integration": "0.60.0"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "unbuild",