@unocss/vite 0.30.5 → 0.30.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
@@ -373,15 +373,15 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
373
373
  if (id.includes("@vite/client") || id.includes("vite/dist/client/client.mjs")) {
374
374
  return code.replace("return hot", [
375
375
  "let __buffer = []",
376
- "function sendBuffer() { if(socket.readyState !== 1) return; __buffer.forEach(msg => socket.send(msg)); __buffer = [] }",
377
- 'socket.addEventListener("open", () => sendBuffer())',
378
- "hot.send = (data) => {__buffer.push(data);sendBuffer()}",
376
+ "function unoSendBuffer() { if(socket.readyState !== 1) return; __buffer.forEach(msg => socket.send(msg)); __buffer = [] }",
377
+ 'socket.addEventListener("open", () => unoSendBuffer())',
378
+ "hot.unoSend = (data) => {__buffer.push(data);unoSendBuffer()}",
379
379
  "return hot"
380
380
  ].join(";"));
381
381
  }
382
382
  if (entries.has(getPath(id)) && code.includes("import.meta.hot")) {
383
383
  const snippet = `
384
- if (import.meta.hot) { try { import.meta.hot.send('${WS_EVENT_PREFIX}${lastServed}') } catch (e) { console.warn('[unocss-hmr]', e) } }`;
384
+ if (import.meta.hot) { try { import.meta.hot.unoSend('${WS_EVENT_PREFIX}${lastServed}') } catch (e) { console.warn('[unocss-hmr]', e) } }`;
385
385
  return code + snippet;
386
386
  }
387
387
  }
package/dist/index.mjs CHANGED
@@ -364,15 +364,15 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
364
364
  if (id.includes("@vite/client") || id.includes("vite/dist/client/client.mjs")) {
365
365
  return code.replace("return hot", [
366
366
  "let __buffer = []",
367
- "function sendBuffer() { if(socket.readyState !== 1) return; __buffer.forEach(msg => socket.send(msg)); __buffer = [] }",
368
- 'socket.addEventListener("open", () => sendBuffer())',
369
- "hot.send = (data) => {__buffer.push(data);sendBuffer()}",
367
+ "function unoSendBuffer() { if(socket.readyState !== 1) return; __buffer.forEach(msg => socket.send(msg)); __buffer = [] }",
368
+ 'socket.addEventListener("open", () => unoSendBuffer())',
369
+ "hot.unoSend = (data) => {__buffer.push(data);unoSendBuffer()}",
370
370
  "return hot"
371
371
  ].join(";"));
372
372
  }
373
373
  if (entries.has(getPath(id)) && code.includes("import.meta.hot")) {
374
374
  const snippet = `
375
- if (import.meta.hot) { try { import.meta.hot.send('${WS_EVENT_PREFIX}${lastServed}') } catch (e) { console.warn('[unocss-hmr]', e) } }`;
375
+ if (import.meta.hot) { try { import.meta.hot.unoSend('${WS_EVENT_PREFIX}${lastServed}') } catch (e) { console.warn('[unocss-hmr]', e) } }`;
376
376
  return code + snippet;
377
377
  }
378
378
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.30.5",
3
+ "version": "0.30.6",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -35,11 +35,11 @@
35
35
  "sideEffects": false,
36
36
  "dependencies": {
37
37
  "@rollup/pluginutils": "^4.2.0",
38
- "@unocss/config": "0.30.5",
39
- "@unocss/core": "0.30.5",
40
- "@unocss/inspector": "0.30.5",
41
- "@unocss/scope": "0.30.5",
42
- "@unocss/transformer-directives": "0.30.5",
38
+ "@unocss/config": "0.30.6",
39
+ "@unocss/core": "0.30.6",
40
+ "@unocss/inspector": "0.30.6",
41
+ "@unocss/scope": "0.30.6",
42
+ "@unocss/transformer-directives": "0.30.6",
43
43
  "magic-string": "^0.26.1"
44
44
  },
45
45
  "devDependencies": {