@unocss/vite 0.51.8 → 0.51.12
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 +9 -2
- package/dist/index.mjs +9 -2
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -310,6 +310,9 @@ async function setupExtraContent(ctx, shouldWatch = false) {
|
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
function isLegacyChunk(chunk, options) {
|
|
314
|
+
return options.format === "system" && chunk.fileName.includes("-legacy");
|
|
315
|
+
}
|
|
313
316
|
function GlobalModeBuildPlugin(ctx) {
|
|
314
317
|
const { uno, ready, extract, tokens, filter, getConfig, tasks, flushTasks } = ctx;
|
|
315
318
|
const vfsLayers = /* @__PURE__ */ new Set();
|
|
@@ -416,6 +419,8 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
416
419
|
await ready;
|
|
417
420
|
},
|
|
418
421
|
async renderChunk(_, chunk, options) {
|
|
422
|
+
if (isLegacyChunk(chunk, options))
|
|
423
|
+
return null;
|
|
419
424
|
if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
|
|
420
425
|
return null;
|
|
421
426
|
const cssPost = cssPostPlugins.get(options.dir);
|
|
@@ -424,7 +429,7 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
424
429
|
return null;
|
|
425
430
|
}
|
|
426
431
|
let { css } = await generateAll();
|
|
427
|
-
const fakeCssId = `${chunk.fileName}-unocss-hash.css`;
|
|
432
|
+
const fakeCssId = `${viteConfig.root}/${chunk.fileName}-unocss-hash.css`;
|
|
428
433
|
css = await applyCssTransform(css, fakeCssId, options.dir, this);
|
|
429
434
|
const hash = getHash(css);
|
|
430
435
|
const transformHandler = "handler" in cssPost.transform ? cssPost.transform.handler : cssPost.transform;
|
|
@@ -453,6 +458,8 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
453
458
|
name: "unocss:global:build:generate",
|
|
454
459
|
apply: "build",
|
|
455
460
|
async renderChunk(code, chunk, options) {
|
|
461
|
+
if (isLegacyChunk(chunk, options))
|
|
462
|
+
return null;
|
|
456
463
|
if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
|
|
457
464
|
return null;
|
|
458
465
|
const cssPost = cssPostPlugins.get(options.dir);
|
|
@@ -464,7 +471,7 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
464
471
|
const cssWithLayers = Array.from(vfsLayers).map(
|
|
465
472
|
(layer) => `#--unocss-layer-start--${layer}--{start:${layer}} ${layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(vfsLayers)) : result.getLayer(layer) || ""} #--unocss-layer-end--${layer}--{end:${layer}}`
|
|
466
473
|
).join("");
|
|
467
|
-
const fakeCssId = `${chunk.fileName}-unocss-hash.css`;
|
|
474
|
+
const fakeCssId = `${viteConfig.root}/${chunk.fileName}-unocss-hash.css`;
|
|
468
475
|
const css = await applyCssTransform(cssWithLayers, fakeCssId, options.dir, this);
|
|
469
476
|
const transformHandler = "handler" in cssPost.transform ? cssPost.transform.handler : cssPost.transform;
|
|
470
477
|
await transformHandler.call({}, css, fakeCssId);
|
package/dist/index.mjs
CHANGED
|
@@ -297,6 +297,9 @@ async function setupExtraContent(ctx, shouldWatch = false) {
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
function isLegacyChunk(chunk, options) {
|
|
301
|
+
return options.format === "system" && chunk.fileName.includes("-legacy");
|
|
302
|
+
}
|
|
300
303
|
function GlobalModeBuildPlugin(ctx) {
|
|
301
304
|
const { uno, ready, extract, tokens, filter, getConfig, tasks, flushTasks } = ctx;
|
|
302
305
|
const vfsLayers = /* @__PURE__ */ new Set();
|
|
@@ -403,6 +406,8 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
403
406
|
await ready;
|
|
404
407
|
},
|
|
405
408
|
async renderChunk(_, chunk, options) {
|
|
409
|
+
if (isLegacyChunk(chunk, options))
|
|
410
|
+
return null;
|
|
406
411
|
if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
|
|
407
412
|
return null;
|
|
408
413
|
const cssPost = cssPostPlugins.get(options.dir);
|
|
@@ -411,7 +416,7 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
411
416
|
return null;
|
|
412
417
|
}
|
|
413
418
|
let { css } = await generateAll();
|
|
414
|
-
const fakeCssId = `${chunk.fileName}-unocss-hash.css`;
|
|
419
|
+
const fakeCssId = `${viteConfig.root}/${chunk.fileName}-unocss-hash.css`;
|
|
415
420
|
css = await applyCssTransform(css, fakeCssId, options.dir, this);
|
|
416
421
|
const hash = getHash(css);
|
|
417
422
|
const transformHandler = "handler" in cssPost.transform ? cssPost.transform.handler : cssPost.transform;
|
|
@@ -440,6 +445,8 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
440
445
|
name: "unocss:global:build:generate",
|
|
441
446
|
apply: "build",
|
|
442
447
|
async renderChunk(code, chunk, options) {
|
|
448
|
+
if (isLegacyChunk(chunk, options))
|
|
449
|
+
return null;
|
|
443
450
|
if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
|
|
444
451
|
return null;
|
|
445
452
|
const cssPost = cssPostPlugins.get(options.dir);
|
|
@@ -451,7 +458,7 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
451
458
|
const cssWithLayers = Array.from(vfsLayers).map(
|
|
452
459
|
(layer) => `#--unocss-layer-start--${layer}--{start:${layer}} ${layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(vfsLayers)) : result.getLayer(layer) || ""} #--unocss-layer-end--${layer}--{end:${layer}}`
|
|
453
460
|
).join("");
|
|
454
|
-
const fakeCssId = `${chunk.fileName}-unocss-hash.css`;
|
|
461
|
+
const fakeCssId = `${viteConfig.root}/${chunk.fileName}-unocss-hash.css`;
|
|
455
462
|
const css = await applyCssTransform(cssWithLayers, fakeCssId, options.dir, this);
|
|
456
463
|
const transformHandler = "handler" in cssPost.transform ? cssPost.transform.handler : cssPost.transform;
|
|
457
464
|
await transformHandler.call({}, css, fakeCssId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.12",
|
|
4
4
|
"description": "The Vite plugin for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"homepage": "https://github.com/unocss/unocss/tree/main/packages/vite#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "
|
|
11
|
+
"url": "https://github.com/unocss/unocss",
|
|
12
12
|
"directory": "packages/vite"
|
|
13
13
|
},
|
|
14
14
|
"bugs": {
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"chokidar": "^3.5.3",
|
|
48
48
|
"fast-glob": "^3.2.12",
|
|
49
49
|
"magic-string": "^0.30.0",
|
|
50
|
-
"@unocss/config": "0.51.
|
|
51
|
-
"@unocss/core": "0.51.
|
|
52
|
-
"@unocss/inspector": "0.51.
|
|
53
|
-
"@unocss/scope": "0.51.
|
|
54
|
-
"@unocss/transformer-directives": "0.51.
|
|
50
|
+
"@unocss/config": "0.51.12",
|
|
51
|
+
"@unocss/core": "0.51.12",
|
|
52
|
+
"@unocss/inspector": "0.51.12",
|
|
53
|
+
"@unocss/scope": "0.51.12",
|
|
54
|
+
"@unocss/transformer-directives": "0.51.12"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"vite": "^4.
|
|
58
|
-
"@unocss/shared-integration": "0.51.
|
|
57
|
+
"vite": "^4.3.5",
|
|
58
|
+
"@unocss/shared-integration": "0.51.12"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "unbuild",
|