@unocss/vite 0.31.5 → 0.31.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 +22 -2
- package/dist/index.mjs +22 -2
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -258,6 +258,7 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
|
|
|
258
258
|
let base = "";
|
|
259
259
|
const tasks = [];
|
|
260
260
|
const entries = /* @__PURE__ */ new Map();
|
|
261
|
+
const cssModules = /* @__PURE__ */ new Set();
|
|
261
262
|
let invalidateTimer;
|
|
262
263
|
let lastUpdate = Date.now();
|
|
263
264
|
let lastServed = 0;
|
|
@@ -271,8 +272,12 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
|
|
|
271
272
|
base = base.slice(0, base.length - 1);
|
|
272
273
|
}
|
|
273
274
|
function invalidate(timer = 10) {
|
|
275
|
+
const ids = [
|
|
276
|
+
...entries.keys(),
|
|
277
|
+
...cssModules.keys()
|
|
278
|
+
];
|
|
274
279
|
for (const server of servers) {
|
|
275
|
-
for (const id of
|
|
280
|
+
for (const id of ids) {
|
|
276
281
|
const mod = server.moduleGraph.getModuleById(id);
|
|
277
282
|
if (!mod)
|
|
278
283
|
continue;
|
|
@@ -284,10 +289,14 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
|
|
|
284
289
|
}
|
|
285
290
|
function sendUpdate() {
|
|
286
291
|
lastUpdate = Date.now();
|
|
292
|
+
const ids = [
|
|
293
|
+
...entries.keys(),
|
|
294
|
+
...cssModules.keys()
|
|
295
|
+
];
|
|
287
296
|
for (const server of servers) {
|
|
288
297
|
server.ws.send({
|
|
289
298
|
type: "update",
|
|
290
|
-
updates: Array.from(
|
|
299
|
+
updates: Array.from(ids).map((i) => ({
|
|
291
300
|
acceptedPath: i,
|
|
292
301
|
path: i,
|
|
293
302
|
timestamp: lastUpdate,
|
|
@@ -348,6 +357,8 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
|
|
|
348
357
|
entries.set(entry.id, entry.layer);
|
|
349
358
|
return entry.id;
|
|
350
359
|
}
|
|
360
|
+
if (id.match(regexCssId))
|
|
361
|
+
cssModules.add(id);
|
|
351
362
|
},
|
|
352
363
|
async load(id) {
|
|
353
364
|
const layer = entries.get(getPath(id));
|
|
@@ -659,6 +670,9 @@ function initTransformerPlugins(ctx) {
|
|
|
659
670
|
name: "unocss:transformers:default",
|
|
660
671
|
transform(code, id) {
|
|
661
672
|
return applyTransformers(code, id);
|
|
673
|
+
},
|
|
674
|
+
transformIndexHtml(code) {
|
|
675
|
+
return applyTransformers(code, "index.html").then((t) => t?.code);
|
|
662
676
|
}
|
|
663
677
|
},
|
|
664
678
|
{
|
|
@@ -666,6 +680,9 @@ function initTransformerPlugins(ctx) {
|
|
|
666
680
|
enforce: "pre",
|
|
667
681
|
transform(code, id) {
|
|
668
682
|
return applyTransformers(code, id, "pre");
|
|
683
|
+
},
|
|
684
|
+
transformIndexHtml(code) {
|
|
685
|
+
return applyTransformers(code, "index.html", "pre").then((t) => t?.code);
|
|
669
686
|
}
|
|
670
687
|
},
|
|
671
688
|
{
|
|
@@ -673,6 +690,9 @@ function initTransformerPlugins(ctx) {
|
|
|
673
690
|
enforce: "post",
|
|
674
691
|
transform(code, id) {
|
|
675
692
|
return applyTransformers(code, id, "post");
|
|
693
|
+
},
|
|
694
|
+
transformIndexHtml(code) {
|
|
695
|
+
applyTransformers(code, "index.html", "post").then((t) => t?.code);
|
|
676
696
|
}
|
|
677
697
|
}
|
|
678
698
|
];
|
package/dist/index.mjs
CHANGED
|
@@ -248,6 +248,7 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
|
|
|
248
248
|
let base = "";
|
|
249
249
|
const tasks = [];
|
|
250
250
|
const entries = /* @__PURE__ */ new Map();
|
|
251
|
+
const cssModules = /* @__PURE__ */ new Set();
|
|
251
252
|
let invalidateTimer;
|
|
252
253
|
let lastUpdate = Date.now();
|
|
253
254
|
let lastServed = 0;
|
|
@@ -261,8 +262,12 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
|
|
|
261
262
|
base = base.slice(0, base.length - 1);
|
|
262
263
|
}
|
|
263
264
|
function invalidate(timer = 10) {
|
|
265
|
+
const ids = [
|
|
266
|
+
...entries.keys(),
|
|
267
|
+
...cssModules.keys()
|
|
268
|
+
];
|
|
264
269
|
for (const server of servers) {
|
|
265
|
-
for (const id of
|
|
270
|
+
for (const id of ids) {
|
|
266
271
|
const mod = server.moduleGraph.getModuleById(id);
|
|
267
272
|
if (!mod)
|
|
268
273
|
continue;
|
|
@@ -274,10 +279,14 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
|
|
|
274
279
|
}
|
|
275
280
|
function sendUpdate() {
|
|
276
281
|
lastUpdate = Date.now();
|
|
282
|
+
const ids = [
|
|
283
|
+
...entries.keys(),
|
|
284
|
+
...cssModules.keys()
|
|
285
|
+
];
|
|
277
286
|
for (const server of servers) {
|
|
278
287
|
server.ws.send({
|
|
279
288
|
type: "update",
|
|
280
|
-
updates: Array.from(
|
|
289
|
+
updates: Array.from(ids).map((i) => ({
|
|
281
290
|
acceptedPath: i,
|
|
282
291
|
path: i,
|
|
283
292
|
timestamp: lastUpdate,
|
|
@@ -338,6 +347,8 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
|
|
|
338
347
|
entries.set(entry.id, entry.layer);
|
|
339
348
|
return entry.id;
|
|
340
349
|
}
|
|
350
|
+
if (id.match(regexCssId))
|
|
351
|
+
cssModules.add(id);
|
|
341
352
|
},
|
|
342
353
|
async load(id) {
|
|
343
354
|
const layer = entries.get(getPath(id));
|
|
@@ -649,6 +660,9 @@ function initTransformerPlugins(ctx) {
|
|
|
649
660
|
name: "unocss:transformers:default",
|
|
650
661
|
transform(code, id) {
|
|
651
662
|
return applyTransformers(code, id);
|
|
663
|
+
},
|
|
664
|
+
transformIndexHtml(code) {
|
|
665
|
+
return applyTransformers(code, "index.html").then((t) => t?.code);
|
|
652
666
|
}
|
|
653
667
|
},
|
|
654
668
|
{
|
|
@@ -656,6 +670,9 @@ function initTransformerPlugins(ctx) {
|
|
|
656
670
|
enforce: "pre",
|
|
657
671
|
transform(code, id) {
|
|
658
672
|
return applyTransformers(code, id, "pre");
|
|
673
|
+
},
|
|
674
|
+
transformIndexHtml(code) {
|
|
675
|
+
return applyTransformers(code, "index.html", "pre").then((t) => t?.code);
|
|
659
676
|
}
|
|
660
677
|
},
|
|
661
678
|
{
|
|
@@ -663,6 +680,9 @@ function initTransformerPlugins(ctx) {
|
|
|
663
680
|
enforce: "post",
|
|
664
681
|
transform(code, id) {
|
|
665
682
|
return applyTransformers(code, id, "post");
|
|
683
|
+
},
|
|
684
|
+
transformIndexHtml(code) {
|
|
685
|
+
applyTransformers(code, "index.html", "post").then((t) => t?.code);
|
|
666
686
|
}
|
|
667
687
|
}
|
|
668
688
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.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.31.
|
|
47
|
-
"@unocss/core": "0.31.
|
|
48
|
-
"@unocss/inspector": "0.31.
|
|
49
|
-
"@unocss/scope": "0.31.
|
|
50
|
-
"@unocss/transformer-directives": "0.31.
|
|
46
|
+
"@unocss/config": "0.31.9",
|
|
47
|
+
"@unocss/core": "0.31.9",
|
|
48
|
+
"@unocss/inspector": "0.31.9",
|
|
49
|
+
"@unocss/scope": "0.31.9",
|
|
50
|
+
"@unocss/transformer-directives": "0.31.9",
|
|
51
51
|
"magic-string": "^0.26.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|