@unocss/vite 0.27.3 → 0.27.6

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
@@ -245,7 +245,7 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, modules, filter })
245
245
  ];
246
246
  }
247
247
 
248
- const WARN_TIMEOUT = 3e3;
248
+ const WARN_TIMEOUT = 1e4;
249
249
  const WS_EVENT_PREFIX = "custom:unocss:";
250
250
  function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
251
251
  const servers = [];
@@ -317,6 +317,9 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
317
317
  servers.push(_server);
318
318
  setWarnTimer();
319
319
  _server.ws.on("connection", (ws) => {
320
+ ws.on("open", () => {
321
+ invalidate();
322
+ });
320
323
  ws.on("message", (msg) => {
321
324
  const message = String(msg);
322
325
  if (!message.startsWith(WS_EVENT_PREFIX))
@@ -327,6 +330,9 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
327
330
  });
328
331
  });
329
332
  },
333
+ async buildStart() {
334
+ await uno.generate("", { preflights: true });
335
+ },
330
336
  transform(code, id) {
331
337
  if (filter(code, id))
332
338
  extract(code, id);
package/dist/index.mjs CHANGED
@@ -236,7 +236,7 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, modules, filter })
236
236
  ];
237
237
  }
238
238
 
239
- const WARN_TIMEOUT = 3e3;
239
+ const WARN_TIMEOUT = 1e4;
240
240
  const WS_EVENT_PREFIX = "custom:unocss:";
241
241
  function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
242
242
  const servers = [];
@@ -308,6 +308,9 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
308
308
  servers.push(_server);
309
309
  setWarnTimer();
310
310
  _server.ws.on("connection", (ws) => {
311
+ ws.on("open", () => {
312
+ invalidate();
313
+ });
311
314
  ws.on("message", (msg) => {
312
315
  const message = String(msg);
313
316
  if (!message.startsWith(WS_EVENT_PREFIX))
@@ -318,6 +321,9 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
318
321
  });
319
322
  });
320
323
  },
324
+ async buildStart() {
325
+ await uno.generate("", { preflights: true });
326
+ },
321
327
  transform(code, id) {
322
328
  if (filter(code, id))
323
329
  extract(code, id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.27.3",
3
+ "version": "0.27.6",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -35,11 +35,11 @@
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
37
  "@rollup/pluginutils": "^4.1.2",
38
- "@unocss/config": "0.27.3",
39
- "@unocss/core": "0.27.3",
40
- "@unocss/inspector": "0.27.3",
41
- "@unocss/scope": "0.27.3",
42
- "@unocss/transformer-directives": "0.27.3",
38
+ "@unocss/config": "0.27.6",
39
+ "@unocss/core": "0.27.6",
40
+ "@unocss/inspector": "0.27.6",
41
+ "@unocss/scope": "0.27.6",
42
+ "@unocss/transformer-directives": "0.27.6",
43
43
  "magic-string": "^0.26.1"
44
44
  },
45
45
  "devDependencies": {