@unocss/vite 0.50.3 → 0.50.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 +12 -12
- package/dist/index.mjs +5 -5
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -6,14 +6,14 @@ const UnocssInspector = require('@unocss/inspector');
|
|
|
6
6
|
const core = require('@unocss/core');
|
|
7
7
|
const pluginutils = require('@rollup/pluginutils');
|
|
8
8
|
const config = require('@unocss/config');
|
|
9
|
-
const
|
|
9
|
+
const node_crypto = require('node:crypto');
|
|
10
10
|
const MagicString = require('magic-string');
|
|
11
|
-
const
|
|
12
|
-
const fs = require('fs/promises');
|
|
11
|
+
const node_path = require('node:path');
|
|
12
|
+
const fs = require('node:fs/promises');
|
|
13
13
|
const fg = require('fast-glob');
|
|
14
14
|
const remapping = require('@ampproject/remapping');
|
|
15
|
-
const fs$1 = require('fs');
|
|
16
|
-
const
|
|
15
|
+
const fs$1 = require('node:fs');
|
|
16
|
+
const node_url = require('node:url');
|
|
17
17
|
|
|
18
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
19
19
|
|
|
@@ -168,7 +168,7 @@ function getPath(id) {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
function getHash(input, length = 8) {
|
|
171
|
-
return
|
|
171
|
+
return node_crypto.createHash("sha256").update(input).digest("hex").slice(0, length);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
function replaceAsync(string, searchValue, replacer) {
|
|
@@ -300,7 +300,7 @@ async function setupExtraContent(ctx, shouldWatch = false) {
|
|
|
300
300
|
});
|
|
301
301
|
watcher.on("all", (type, file) => {
|
|
302
302
|
if (type === "add" || type === "change") {
|
|
303
|
-
const absolutePath =
|
|
303
|
+
const absolutePath = node_path.resolve(root, file);
|
|
304
304
|
tasks.push(extractFile(absolutePath));
|
|
305
305
|
}
|
|
306
306
|
});
|
|
@@ -395,15 +395,15 @@ function GlobalModeBuildPlugin(ctx) {
|
|
|
395
395
|
},
|
|
396
396
|
async configResolved(config) {
|
|
397
397
|
const distDirs = [
|
|
398
|
-
|
|
398
|
+
node_path.resolve(config.root, config.build.outDir)
|
|
399
399
|
];
|
|
400
400
|
if (config.build.rollupOptions.output) {
|
|
401
401
|
const outputOptions = config.build.rollupOptions.output;
|
|
402
402
|
const outputDirs = Array.isArray(outputOptions) ? outputOptions.map((option) => option.dir).filter(Boolean) : outputOptions.dir ? [outputOptions.dir] : [];
|
|
403
403
|
outputDirs.forEach((dir) => {
|
|
404
404
|
distDirs.push(dir);
|
|
405
|
-
if (!
|
|
406
|
-
distDirs.push(
|
|
405
|
+
if (!node_path.isAbsolute(dir))
|
|
406
|
+
distDirs.push(node_path.resolve(config.root, dir));
|
|
407
407
|
});
|
|
408
408
|
}
|
|
409
409
|
const cssPostPlugin = config.plugins.find((i) => i.name === "vite:css-post");
|
|
@@ -1182,7 +1182,7 @@ function createTransformerPlugins(ctx) {
|
|
|
1182
1182
|
}));
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
|
-
const _dirname = typeof __dirname !== "undefined" ? __dirname :
|
|
1185
|
+
const _dirname = typeof __dirname !== "undefined" ? __dirname : node_path.dirname(node_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))));
|
|
1186
1186
|
const DEVTOOLS_MODULE_ID = "virtual:unocss-devtools";
|
|
1187
1187
|
const MOCK_CLASSES_MODULE_ID = "virtual:unocss-mock-classes";
|
|
1188
1188
|
const MOCK_CLASSES_PATH = "/@unocss/mock-classes";
|
|
@@ -1292,7 +1292,7 @@ function createDevtoolsPlugin(ctx) {
|
|
|
1292
1292
|
if (id === DEVTOOLS_PATH) {
|
|
1293
1293
|
if (!clientCode) {
|
|
1294
1294
|
clientCode = [
|
|
1295
|
-
await fs__default$1.promises.readFile(
|
|
1295
|
+
await fs__default$1.promises.readFile(node_path.resolve(_dirname, "client.mjs"), "utf-8"),
|
|
1296
1296
|
`import('${MOCK_CLASSES_MODULE_ID}')`,
|
|
1297
1297
|
`import('${DEVTOOLS_CSS_PATH}')`
|
|
1298
1298
|
].join("\n").replace("__POST_PATH__", (config.server?.origin ?? "") + POST_PATH);
|
package/dist/index.mjs
CHANGED
|
@@ -2,14 +2,14 @@ import UnocssInspector from '@unocss/inspector';
|
|
|
2
2
|
import { cssIdRE, createGenerator, BetterMap, notNull, expandVariantGroup, attributifyRE, escapeRegExp, toEscapedSelector } from '@unocss/core';
|
|
3
3
|
import { createFilter } from '@rollup/pluginutils';
|
|
4
4
|
import { loadConfig } from '@unocss/config';
|
|
5
|
-
import { createHash } from 'crypto';
|
|
5
|
+
import { createHash } from 'node:crypto';
|
|
6
6
|
import MagicString from 'magic-string';
|
|
7
|
-
import { resolve, isAbsolute, dirname } from 'path';
|
|
8
|
-
import fs from 'fs/promises';
|
|
7
|
+
import { resolve, isAbsolute, dirname } from 'node:path';
|
|
8
|
+
import fs from 'node:fs/promises';
|
|
9
9
|
import fg from 'fast-glob';
|
|
10
10
|
import remapping from '@ampproject/remapping';
|
|
11
|
-
import fs$1 from 'fs';
|
|
12
|
-
import { fileURLToPath } from 'url';
|
|
11
|
+
import fs$1 from 'node:fs';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
13
|
|
|
14
14
|
const defaultExclude = [cssIdRE];
|
|
15
15
|
const defaultInclude = [/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.4",
|
|
4
4
|
"description": "The Vite plugin for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,18 +44,18 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ampproject/remapping": "^2.2.0",
|
|
46
46
|
"@rollup/pluginutils": "^5.0.2",
|
|
47
|
-
"@unocss/config": "0.50.3",
|
|
48
|
-
"@unocss/core": "0.50.3",
|
|
49
|
-
"@unocss/inspector": "0.50.3",
|
|
50
|
-
"@unocss/scope": "0.50.3",
|
|
51
|
-
"@unocss/transformer-directives": "0.50.3",
|
|
52
47
|
"chokidar": "^3.5.3",
|
|
53
48
|
"fast-glob": "^3.2.12",
|
|
54
|
-
"magic-string": "^0.30.0"
|
|
49
|
+
"magic-string": "^0.30.0",
|
|
50
|
+
"@unocss/config": "0.50.4",
|
|
51
|
+
"@unocss/core": "0.50.4",
|
|
52
|
+
"@unocss/inspector": "0.50.4",
|
|
53
|
+
"@unocss/scope": "0.50.4",
|
|
54
|
+
"@unocss/transformer-directives": "0.50.4"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
57
|
+
"vite": "^4.1.4",
|
|
58
|
+
"@unocss/shared-integration": "0.50.4"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "unbuild",
|