@unocss/vite 0.45.3 → 0.45.4

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
@@ -454,8 +454,8 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
454
454
  invalidate(0);
455
455
  });
456
456
  },
457
- async buildStart() {
458
- await uno.generate("", { preflights: true });
457
+ buildStart() {
458
+ uno.generate("", { preflights: true });
459
459
  },
460
460
  transform(code, id) {
461
461
  if (filter(code, id))
@@ -496,9 +496,13 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
496
496
  enforce: "post",
497
497
  transform(code, id) {
498
498
  if (entries.has(getPath(id)) && code.includes("import.meta.hot")) {
499
- const snippet = `
500
- if (import.meta.hot) { try { import.meta.hot.send('${WS_EVENT_PREFIX}', ${lastServed}) } catch (e) { console.warn('[unocss-hmr]', e) } }`;
501
- return code + snippet;
499
+ return `${code}
500
+ if (import.meta.hot) {
501
+ try { await import.meta.hot.send('${WS_EVENT_PREFIX}', ${lastServed}); }
502
+ catch (e) { console.warn('[unocss-hmr]', e) }
503
+ if (!import.meta.url.includes('?'))
504
+ await new Promise(resolve => setTimeout(resolve, 100))
505
+ }`;
502
506
  }
503
507
  }
504
508
  }
package/dist/index.mjs CHANGED
@@ -443,8 +443,8 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
443
443
  invalidate(0);
444
444
  });
445
445
  },
446
- async buildStart() {
447
- await uno.generate("", { preflights: true });
446
+ buildStart() {
447
+ uno.generate("", { preflights: true });
448
448
  },
449
449
  transform(code, id) {
450
450
  if (filter(code, id))
@@ -485,9 +485,13 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
485
485
  enforce: "post",
486
486
  transform(code, id) {
487
487
  if (entries.has(getPath(id)) && code.includes("import.meta.hot")) {
488
- const snippet = `
489
- if (import.meta.hot) { try { import.meta.hot.send('${WS_EVENT_PREFIX}', ${lastServed}) } catch (e) { console.warn('[unocss-hmr]', e) } }`;
490
- return code + snippet;
488
+ return `${code}
489
+ if (import.meta.hot) {
490
+ try { await import.meta.hot.send('${WS_EVENT_PREFIX}', ${lastServed}); }
491
+ catch (e) { console.warn('[unocss-hmr]', e) }
492
+ if (!import.meta.url.includes('?'))
493
+ await new Promise(resolve => setTimeout(resolve, 100))
494
+ }`;
491
495
  }
492
496
  }
493
497
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.45.3",
3
+ "version": "0.45.4",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -44,15 +44,15 @@
44
44
  "dependencies": {
45
45
  "@ampproject/remapping": "^2.2.0",
46
46
  "@rollup/pluginutils": "^4.2.1",
47
- "@unocss/config": "0.45.3",
48
- "@unocss/core": "0.45.3",
49
- "@unocss/inspector": "0.45.3",
50
- "@unocss/scope": "0.45.3",
51
- "@unocss/transformer-directives": "0.45.3",
47
+ "@unocss/config": "0.45.4",
48
+ "@unocss/core": "0.45.4",
49
+ "@unocss/inspector": "0.45.4",
50
+ "@unocss/scope": "0.45.4",
51
+ "@unocss/transformer-directives": "0.45.4",
52
52
  "magic-string": "^0.26.2"
53
53
  },
54
54
  "devDependencies": {
55
- "@unocss/shared-integration": "0.45.3",
55
+ "@unocss/shared-integration": "0.45.4",
56
56
  "vite": "^3.0.4"
57
57
  },
58
58
  "scripts": {