@unocss/vite 0.45.22 → 0.45.23
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 +11 -5
- package/dist/index.mjs +8 -2
- package/package.json +9 -8
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 pathe = require('pathe');
|
|
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 = pathe.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;
|
|
@@ -464,8 +464,14 @@ 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
|
+
}
|
|
469
475
|
});
|
|
470
476
|
},
|
|
471
477
|
buildStart() {
|
|
@@ -867,7 +873,7 @@ function createTransformerPlugins(ctx) {
|
|
|
867
873
|
}));
|
|
868
874
|
}
|
|
869
875
|
|
|
870
|
-
const _dirname = typeof __dirname !== "undefined" ? __dirname :
|
|
876
|
+
const _dirname = typeof __dirname !== "undefined" ? __dirname : pathe.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))));
|
|
871
877
|
const DEVTOOLS_MODULE_ID = "virtual:unocss-devtools";
|
|
872
878
|
const MOCK_CLASSES_MODULE_ID = "virtual:unocss-mock-classes";
|
|
873
879
|
const MOCK_CLASSES_PATH = "/@unocss/mock-classes";
|
|
@@ -977,7 +983,7 @@ function createDevtoolsPlugin(ctx) {
|
|
|
977
983
|
if (id === DEVTOOLS_PATH) {
|
|
978
984
|
if (!clientCode) {
|
|
979
985
|
clientCode = [
|
|
980
|
-
await fs__default.promises.readFile(
|
|
986
|
+
await fs__default.promises.readFile(pathe.resolve(_dirname, "client.mjs"), "utf-8"),
|
|
981
987
|
`import('${MOCK_CLASSES_MODULE_ID}')`,
|
|
982
988
|
`import('${DEVTOOLS_CSS_PATH}')`
|
|
983
989
|
].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 'pathe';
|
|
8
8
|
import remapping from '@ampproject/remapping';
|
|
9
9
|
import fs from 'fs';
|
|
10
10
|
import { fileURLToPath } from 'url';
|
|
@@ -453,8 +453,14 @@ 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
|
+
}
|
|
458
464
|
});
|
|
459
465
|
},
|
|
460
466
|
buildStart() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.23",
|
|
4
4
|
"description": "The Vite plugin for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,15 +44,16 @@
|
|
|
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"
|
|
47
|
+
"@unocss/config": "0.45.23",
|
|
48
|
+
"@unocss/core": "0.45.23",
|
|
49
|
+
"@unocss/inspector": "0.45.23",
|
|
50
|
+
"@unocss/scope": "0.45.23",
|
|
51
|
+
"@unocss/transformer-directives": "0.45.23",
|
|
52
|
+
"magic-string": "^0.26.3",
|
|
53
|
+
"pathe": "^0.3.7"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
|
-
"@unocss/shared-integration": "0.45.
|
|
56
|
+
"@unocss/shared-integration": "0.45.23",
|
|
56
57
|
"vite": "^3.1.2"
|
|
57
58
|
},
|
|
58
59
|
"scripts": {
|