@unocss/vite 0.45.24 → 0.45.26
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 +14 -13
- package/dist/index.mjs +11 -10
- package/package.json +8 -9
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ const pluginutils = require('@rollup/pluginutils');
|
|
|
8
8
|
const config = require('@unocss/config');
|
|
9
9
|
const crypto = require('crypto');
|
|
10
10
|
const MagicString = require('magic-string');
|
|
11
|
-
const
|
|
11
|
+
const path = require('path');
|
|
12
12
|
const remapping = require('@ampproject/remapping');
|
|
13
13
|
const fs = require('fs');
|
|
14
14
|
const url = require('url');
|
|
@@ -305,7 +305,7 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, filter, getConfig
|
|
|
305
305
|
}
|
|
306
306
|
},
|
|
307
307
|
async configResolved(config) {
|
|
308
|
-
const distDir =
|
|
308
|
+
const distDir = path.resolve(config.root, config.build.outDir);
|
|
309
309
|
cssPostPlugins.set(distDir, config.plugins.find((i) => i.name === "vite:css-post"));
|
|
310
310
|
cssPlugins.set(distDir, config.plugins.find((i) => i.name === "vite:css"));
|
|
311
311
|
await ready;
|
|
@@ -412,9 +412,9 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
|
|
|
412
412
|
server.moduleGraph.invalidateModule(mod);
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
lastServedHash.clear();
|
|
416
415
|
clearTimeout(invalidateTimer);
|
|
417
416
|
invalidateTimer = setTimeout(() => {
|
|
417
|
+
lastServedHash.clear();
|
|
418
418
|
sendUpdate(ids);
|
|
419
419
|
}, timer);
|
|
420
420
|
}
|
|
@@ -464,14 +464,8 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
|
|
|
464
464
|
async configureServer(_server) {
|
|
465
465
|
servers.push(_server);
|
|
466
466
|
_server.ws.on(WS_EVENT_PREFIX, ([layer, hash]) => {
|
|
467
|
-
if (lastServedHash.get(layer) !== hash)
|
|
467
|
+
if (lastServedHash.get(layer) !== hash)
|
|
468
468
|
sendUpdate(entries);
|
|
469
|
-
} else {
|
|
470
|
-
setTimeout(() => {
|
|
471
|
-
if (lastServedHash.get(layer) !== hash)
|
|
472
|
-
sendUpdate(entries);
|
|
473
|
-
}, 50);
|
|
474
|
-
}
|
|
475
469
|
});
|
|
476
470
|
},
|
|
477
471
|
buildStart() {
|
|
@@ -502,7 +496,14 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
|
|
|
502
496
|
if (!layer)
|
|
503
497
|
return null;
|
|
504
498
|
await Promise.all(tasks);
|
|
505
|
-
|
|
499
|
+
let result;
|
|
500
|
+
let tokensSize = tokens.size;
|
|
501
|
+
do {
|
|
502
|
+
result = await uno.generate(tokens);
|
|
503
|
+
if (tokensSize === tokens.size)
|
|
504
|
+
break;
|
|
505
|
+
tokensSize = tokens.size;
|
|
506
|
+
} while (true);
|
|
506
507
|
const css = layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(entries).map((i) => resolveLayer(i)).filter((i) => !!i)) : result.getLayer(layer);
|
|
507
508
|
const hash = getHash(css || "", HASH_LENGTH);
|
|
508
509
|
lastServedHash.set(layer, hash);
|
|
@@ -873,7 +874,7 @@ function createTransformerPlugins(ctx) {
|
|
|
873
874
|
}));
|
|
874
875
|
}
|
|
875
876
|
|
|
876
|
-
const _dirname = typeof __dirname !== "undefined" ? __dirname :
|
|
877
|
+
const _dirname = typeof __dirname !== "undefined" ? __dirname : path.dirname(url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
877
878
|
const DEVTOOLS_MODULE_ID = "virtual:unocss-devtools";
|
|
878
879
|
const MOCK_CLASSES_MODULE_ID = "virtual:unocss-mock-classes";
|
|
879
880
|
const MOCK_CLASSES_PATH = "/@unocss/mock-classes";
|
|
@@ -983,7 +984,7 @@ function createDevtoolsPlugin(ctx) {
|
|
|
983
984
|
if (id === DEVTOOLS_PATH) {
|
|
984
985
|
if (!clientCode) {
|
|
985
986
|
clientCode = [
|
|
986
|
-
await fs__default.promises.readFile(
|
|
987
|
+
await fs__default.promises.readFile(path.resolve(_dirname, "client.mjs"), "utf-8"),
|
|
987
988
|
`import('${MOCK_CLASSES_MODULE_ID}')`,
|
|
988
989
|
`import('${DEVTOOLS_CSS_PATH}')`
|
|
989
990
|
].join("\n").replace("__POST_PATH__", (config.server?.origin ?? "") + POST_PATH);
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createFilter } from '@rollup/pluginutils';
|
|
|
4
4
|
import { loadConfig } from '@unocss/config';
|
|
5
5
|
import { createHash } from 'crypto';
|
|
6
6
|
import MagicString from 'magic-string';
|
|
7
|
-
import { resolve, dirname } from '
|
|
7
|
+
import { resolve, dirname } from 'path';
|
|
8
8
|
import remapping from '@ampproject/remapping';
|
|
9
9
|
import fs from 'fs';
|
|
10
10
|
import { fileURLToPath } from 'url';
|
|
@@ -401,9 +401,9 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
|
|
|
401
401
|
server.moduleGraph.invalidateModule(mod);
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
lastServedHash.clear();
|
|
405
404
|
clearTimeout(invalidateTimer);
|
|
406
405
|
invalidateTimer = setTimeout(() => {
|
|
406
|
+
lastServedHash.clear();
|
|
407
407
|
sendUpdate(ids);
|
|
408
408
|
}, timer);
|
|
409
409
|
}
|
|
@@ -453,14 +453,8 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
|
|
|
453
453
|
async configureServer(_server) {
|
|
454
454
|
servers.push(_server);
|
|
455
455
|
_server.ws.on(WS_EVENT_PREFIX, ([layer, hash]) => {
|
|
456
|
-
if (lastServedHash.get(layer) !== hash)
|
|
456
|
+
if (lastServedHash.get(layer) !== hash)
|
|
457
457
|
sendUpdate(entries);
|
|
458
|
-
} else {
|
|
459
|
-
setTimeout(() => {
|
|
460
|
-
if (lastServedHash.get(layer) !== hash)
|
|
461
|
-
sendUpdate(entries);
|
|
462
|
-
}, 50);
|
|
463
|
-
}
|
|
464
458
|
});
|
|
465
459
|
},
|
|
466
460
|
buildStart() {
|
|
@@ -491,7 +485,14 @@ function GlobalModeDevPlugin({ uno, tokens, affectedModules, onInvalidate, extra
|
|
|
491
485
|
if (!layer)
|
|
492
486
|
return null;
|
|
493
487
|
await Promise.all(tasks);
|
|
494
|
-
|
|
488
|
+
let result;
|
|
489
|
+
let tokensSize = tokens.size;
|
|
490
|
+
do {
|
|
491
|
+
result = await uno.generate(tokens);
|
|
492
|
+
if (tokensSize === tokens.size)
|
|
493
|
+
break;
|
|
494
|
+
tokensSize = tokens.size;
|
|
495
|
+
} while (true);
|
|
495
496
|
const css = layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(entries).map((i) => resolveLayer(i)).filter((i) => !!i)) : result.getLayer(layer);
|
|
496
497
|
const hash = getHash(css || "", HASH_LENGTH);
|
|
497
498
|
lastServedHash.set(layer, hash);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.26",
|
|
4
4
|
"description": "The Vite plugin for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,16 +44,15 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ampproject/remapping": "^2.2.0",
|
|
46
46
|
"@rollup/pluginutils": "^4.2.1",
|
|
47
|
-
"@unocss/config": "0.45.
|
|
48
|
-
"@unocss/core": "0.45.
|
|
49
|
-
"@unocss/inspector": "0.45.
|
|
50
|
-
"@unocss/scope": "0.45.
|
|
51
|
-
"@unocss/transformer-directives": "0.45.
|
|
52
|
-
"magic-string": "^0.26.3"
|
|
53
|
-
"pathe": "^0.3.7"
|
|
47
|
+
"@unocss/config": "0.45.26",
|
|
48
|
+
"@unocss/core": "0.45.26",
|
|
49
|
+
"@unocss/inspector": "0.45.26",
|
|
50
|
+
"@unocss/scope": "0.45.26",
|
|
51
|
+
"@unocss/transformer-directives": "0.45.26",
|
|
52
|
+
"magic-string": "^0.26.3"
|
|
54
53
|
},
|
|
55
54
|
"devDependencies": {
|
|
56
|
-
"@unocss/shared-integration": "0.45.
|
|
55
|
+
"@unocss/shared-integration": "0.45.26",
|
|
57
56
|
"vite": "^3.1.2"
|
|
58
57
|
},
|
|
59
58
|
"scripts": {
|