@unocss/vite 0.31.8 → 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 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 entries.keys()) {
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(entries.keys()).map((i) => ({
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));
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 entries.keys()) {
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(entries.keys()).map((i) => ({
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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.31.8",
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.8",
47
- "@unocss/core": "0.31.8",
48
- "@unocss/inspector": "0.31.8",
49
- "@unocss/scope": "0.31.8",
50
- "@unocss/transformer-directives": "0.31.8",
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": {