@unocss/vite 66.4.0 → 66.4.2
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.mjs +11 -4
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { glob } from 'tinyglobby';
|
|
|
11
11
|
import remapping from '@ampproject/remapping';
|
|
12
12
|
import MagicString from 'magic-string';
|
|
13
13
|
import { resolve as resolve$1 } from 'pathe';
|
|
14
|
-
import
|
|
14
|
+
import crypto from 'node:crypto';
|
|
15
15
|
import { Buffer } from 'node:buffer';
|
|
16
16
|
|
|
17
17
|
const INCLUDE_COMMENT = "@unocss-include";
|
|
@@ -354,7 +354,7 @@ function ChunkModeBuildPlugin(ctx) {
|
|
|
354
354
|
function getPath(id) {
|
|
355
355
|
return id.replace(/\?.*$/, "");
|
|
356
356
|
}
|
|
357
|
-
function hash(str) {
|
|
357
|
+
function hash$1(str) {
|
|
358
358
|
let i;
|
|
359
359
|
let l;
|
|
360
360
|
let hval = 2166136261;
|
|
@@ -368,7 +368,7 @@ function transformSkipCode(code, map, SKIP_RULES_RE, keyFlag) {
|
|
|
368
368
|
for (const item of Array.from(code.matchAll(SKIP_RULES_RE))) {
|
|
369
369
|
if (item != null) {
|
|
370
370
|
const matched = item[0];
|
|
371
|
-
const withHashKey = `${keyFlag}${hash(matched)}`;
|
|
371
|
+
const withHashKey = `${keyFlag}${hash$1(matched)}`;
|
|
372
372
|
map.set(withHashKey, matched);
|
|
373
373
|
code = code.replace(matched, withHashKey);
|
|
374
374
|
}
|
|
@@ -493,6 +493,7 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
493
493
|
const { ready, extract, tokens, filter, getConfig, tasks, flushTasks } = ctx;
|
|
494
494
|
const vfsLayers = /* @__PURE__ */ new Map();
|
|
495
495
|
const resolveContexts = /* @__PURE__ */ new Map();
|
|
496
|
+
const unocssImporters = /* @__PURE__ */ new Set();
|
|
496
497
|
let viteConfig;
|
|
497
498
|
const cssPostPlugins = /* @__PURE__ */ new Map();
|
|
498
499
|
const cssPlugins = /* @__PURE__ */ new Map();
|
|
@@ -561,6 +562,8 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
561
562
|
if (entry) {
|
|
562
563
|
const layer = resolveLayer(entry);
|
|
563
564
|
if (layer) {
|
|
565
|
+
if (importer)
|
|
566
|
+
unocssImporters.add(importer);
|
|
564
567
|
if (vfsLayers.has(layer)) {
|
|
565
568
|
this.warn(`[unocss] ${JSON.stringify(id)} is being imported multiple times in different files, using the first occurrence: ${JSON.stringify(vfsLayers.get(layer))}`);
|
|
566
569
|
return vfsLayers.get(layer);
|
|
@@ -584,6 +587,9 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
584
587
|
};
|
|
585
588
|
}
|
|
586
589
|
},
|
|
590
|
+
shouldTransformCachedModule({ id }) {
|
|
591
|
+
return unocssImporters.delete(id);
|
|
592
|
+
},
|
|
587
593
|
async configResolved(config) {
|
|
588
594
|
const distDirs = [
|
|
589
595
|
resolve(config.root, config.build.outDir)
|
|
@@ -663,8 +669,9 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
663
669
|
];
|
|
664
670
|
}
|
|
665
671
|
|
|
672
|
+
const hash = crypto.hash ?? ((algorithm, data, outputEncoding) => crypto.createHash(algorithm).update(data).digest(outputEncoding));
|
|
666
673
|
function getHash(input, length = 8) {
|
|
667
|
-
return
|
|
674
|
+
return hash("sha256", input, "hex").substring(0, length);
|
|
668
675
|
}
|
|
669
676
|
|
|
670
677
|
const WARN_TIMEOUT = 2e4;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.4.
|
|
4
|
+
"version": "66.4.2",
|
|
5
5
|
"description": "The Vite plugin for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"pathe": "^2.0.3",
|
|
56
56
|
"tinyglobby": "^0.2.14",
|
|
57
57
|
"unplugin-utils": "^0.2.4",
|
|
58
|
-
"@unocss/config": "66.4.
|
|
59
|
-
"@unocss/
|
|
60
|
-
"@unocss/
|
|
58
|
+
"@unocss/config": "66.4.2",
|
|
59
|
+
"@unocss/inspector": "66.4.2",
|
|
60
|
+
"@unocss/core": "66.4.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"vite": "^7.0.6"
|