@unocss/vite 0.12.11 → 0.12.15

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.js CHANGED
@@ -84,11 +84,13 @@ function createContext(configOrPath, defaults = {}) {
84
84
  function invalidate() {
85
85
  invalidations.forEach((cb) => cb());
86
86
  }
87
- async function scan(code, id) {
87
+ async function extract(code, id) {
88
88
  if (id)
89
89
  modules.set(id, code);
90
+ const len = tokens.size;
90
91
  await uno.applyExtractors(code, id, tokens);
91
- invalidate();
92
+ if (tokens.size > len)
93
+ invalidate();
92
94
  }
93
95
  async function reloadConfig() {
94
96
  if (!filepath)
@@ -113,7 +115,7 @@ function createContext(configOrPath, defaults = {}) {
113
115
  filter,
114
116
  reloadConfig,
115
117
  uno,
116
- extract: scan,
118
+ extract,
117
119
  config,
118
120
  configFilepath: filepath
119
121
  };
@@ -286,7 +288,6 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
286
288
  const mod = server.moduleGraph.getModuleById(id);
287
289
  if (!mod)
288
290
  continue;
289
- lastUpdate = Date.now();
290
291
  server.moduleGraph.invalidateModule(mod);
291
292
  }
292
293
  }
@@ -294,6 +295,7 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
294
295
  invalidateTimer = setTimeout(sendUpdate, timer);
295
296
  }
296
297
  function sendUpdate() {
298
+ lastUpdate = Date.now();
297
299
  for (const server of servers) {
298
300
  server.ws.send({
299
301
  type: "update",
package/dist/index.mjs CHANGED
@@ -50,11 +50,13 @@ function createContext(configOrPath, defaults = {}) {
50
50
  function invalidate() {
51
51
  invalidations.forEach((cb) => cb());
52
52
  }
53
- async function scan(code, id) {
53
+ async function extract(code, id) {
54
54
  if (id)
55
55
  modules.set(id, code);
56
+ const len = tokens.size;
56
57
  await uno.applyExtractors(code, id, tokens);
57
- invalidate();
58
+ if (tokens.size > len)
59
+ invalidate();
58
60
  }
59
61
  async function reloadConfig() {
60
62
  if (!filepath)
@@ -79,7 +81,7 @@ function createContext(configOrPath, defaults = {}) {
79
81
  filter,
80
82
  reloadConfig,
81
83
  uno,
82
- extract: scan,
84
+ extract,
83
85
  config,
84
86
  configFilepath: filepath
85
87
  };
@@ -252,7 +254,6 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
252
254
  const mod = server.moduleGraph.getModuleById(id);
253
255
  if (!mod)
254
256
  continue;
255
- lastUpdate = Date.now();
256
257
  server.moduleGraph.invalidateModule(mod);
257
258
  }
258
259
  }
@@ -260,6 +261,7 @@ function GlobalModeDevPlugin({ uno, tokens, onInvalidate, extract, filter }) {
260
261
  invalidateTimer = setTimeout(sendUpdate, timer);
261
262
  }
262
263
  function sendUpdate() {
264
+ lastUpdate = Date.now();
263
265
  for (const server of servers) {
264
266
  server.ws.send({
265
267
  type: "update",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.12.11",
3
+ "version": "0.12.15",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -35,10 +35,10 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@rollup/pluginutils": "^4.1.1",
38
- "@unocss/config": "0.12.11",
39
- "@unocss/core": "0.12.11",
40
- "@unocss/inspector": "0.12.11",
41
- "@unocss/scope": "0.12.11"
38
+ "@unocss/config": "0.12.15",
39
+ "@unocss/core": "0.12.15",
40
+ "@unocss/inspector": "0.12.15",
41
+ "@unocss/scope": "0.12.15"
42
42
  },
43
43
  "devDependencies": {
44
44
  "vite": "^2.6.14"