@unocss/cli 66.6.6-beta.1 → 66.6.7
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/cli.mjs +2 -5
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +2 -3
- package/dist/{src--FBLDsr1.mjs → src-CwdqtLdP.mjs} +20 -39
- package/package.json +6 -6
package/dist/cli.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { n as handleError, r as version, t as build } from "./src
|
|
1
|
+
import { n as handleError, r as version, t as build } from "./src-CwdqtLdP.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { green } from "colorette";
|
|
4
4
|
import { resolve } from "pathe";
|
|
5
5
|
import { cac } from "cac";
|
|
6
|
-
|
|
7
6
|
//#region src/cli-start.ts
|
|
8
7
|
async function startCli(cwd = process.cwd(), argv = process.argv, options = {}) {
|
|
9
8
|
const cli = cac("unocss");
|
|
@@ -22,10 +21,8 @@ async function startCli(cwd = process.cwd(), argv = process.argv, options = {})
|
|
|
22
21
|
cli.parse(argv, { run: false });
|
|
23
22
|
await cli.runMatchedCommand();
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
//#endregion
|
|
27
25
|
//#region src/cli.ts
|
|
28
26
|
startCli().catch(handleError);
|
|
29
|
-
|
|
30
27
|
//#endregion
|
|
31
|
-
export {
|
|
28
|
+
export {};
|
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { t as build } from "./src
|
|
2
|
-
|
|
3
|
-
export { build };
|
|
1
|
+
import { t as build } from "./src-CwdqtLdP.mjs";
|
|
2
|
+
export { build };
|
|
@@ -10,24 +10,13 @@ import consola, { consola as consola$1 } from "consola";
|
|
|
10
10
|
import { basename, dirname, normalize, relative, resolve } from "pathe";
|
|
11
11
|
import { debounce } from "perfect-debounce";
|
|
12
12
|
import { glob } from "tinyglobby";
|
|
13
|
-
|
|
14
|
-
//#region ../../virtual-shared/integration/src/constants.ts
|
|
15
|
-
const INCLUDE_COMMENT = "@unocss-include";
|
|
16
|
-
const IGNORE_COMMENT = "@unocss-ignore";
|
|
17
|
-
const CSS_PLACEHOLDER = "@unocss-placeholder";
|
|
18
13
|
const SKIP_START_COMMENT = "@unocss-skip-start";
|
|
19
14
|
const SKIP_END_COMMENT = "@unocss-skip-end";
|
|
20
15
|
const SKIP_COMMENT_RE = new RegExp(`(\/\/\\s*?${SKIP_START_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(\/\/\\s*?${SKIP_END_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, "g");
|
|
21
|
-
|
|
22
16
|
//#endregion
|
|
23
17
|
//#region ../../virtual-shared/integration/src/defaults.ts
|
|
24
18
|
const defaultPipelineExclude = [cssIdRE];
|
|
25
19
|
const defaultPipelineInclude = [/\.(vue|svelte|[jt]sx|vine.ts|mdx?|astro|elm|php|phtml|marko|html)($|\?)/];
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region ../../virtual-shared/integration/src/deprecation.ts
|
|
29
|
-
function deprecationCheck(config) {}
|
|
30
|
-
|
|
31
20
|
//#endregion
|
|
32
21
|
//#region ../../virtual-shared/integration/src/context.ts
|
|
33
22
|
function createContext(configOrPath, defaults = {}, extraConfigSources = [], resolveConfigResult = () => {}) {
|
|
@@ -53,7 +42,7 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
53
42
|
await _uno;
|
|
54
43
|
const result = await loadConfig(root, configOrPath, extraConfigSources, defaults);
|
|
55
44
|
resolveConfigResult(result);
|
|
56
|
-
|
|
45
|
+
result.config;
|
|
57
46
|
rawConfig = result.config;
|
|
58
47
|
configFileList = result.sources;
|
|
59
48
|
await uno.setConfig(rawConfig);
|
|
@@ -79,15 +68,15 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
79
68
|
reloadListeners.forEach((cb) => cb());
|
|
80
69
|
}
|
|
81
70
|
async function extract(code, id) {
|
|
82
|
-
const uno
|
|
71
|
+
const uno = await _uno;
|
|
83
72
|
if (id) modules.set(id, code);
|
|
84
73
|
const len = tokens.size;
|
|
85
|
-
await uno
|
|
74
|
+
await uno.applyExtractors(code.replace(SKIP_COMMENT_RE, ""), id, tokens);
|
|
86
75
|
if (tokens.size > len) invalidate();
|
|
87
76
|
}
|
|
88
77
|
function filter(code, id) {
|
|
89
|
-
if (code.includes(
|
|
90
|
-
return code.includes(
|
|
78
|
+
if (code.includes("@unocss-ignore")) return false;
|
|
79
|
+
return code.includes("@unocss-include") || code.includes("@unocss-placeholder") || rollupFilter(id.replace(/\?v=\w+$/, ""));
|
|
91
80
|
}
|
|
92
81
|
async function getConfig() {
|
|
93
82
|
await ready;
|
|
@@ -107,8 +96,8 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
107
96
|
if (vmpCache.has(prefix)) return vmpCache.get(prefix);
|
|
108
97
|
const regexes = {
|
|
109
98
|
prefix,
|
|
110
|
-
RESOLVED_ID_WITH_QUERY_RE:
|
|
111
|
-
RESOLVED_ID_RE:
|
|
99
|
+
RESOLVED_ID_WITH_QUERY_RE: new RegExp(`[/\\\\]${prefix}(_.*?)?\\.css(\\?.*)?$`),
|
|
100
|
+
RESOLVED_ID_RE: new RegExp(`[/\\\\]${prefix}(?:_(.*?))?\.css$`)
|
|
112
101
|
};
|
|
113
102
|
vmpCache.set(prefix, regexes);
|
|
114
103
|
return regexes;
|
|
@@ -145,7 +134,6 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
145
134
|
getVMPRegexes
|
|
146
135
|
};
|
|
147
136
|
}
|
|
148
|
-
|
|
149
137
|
//#endregion
|
|
150
138
|
//#region ../../virtual-shared/integration/src/utils.ts
|
|
151
139
|
function hash(str) {
|
|
@@ -171,11 +159,10 @@ function restoreSkipCode(code, map) {
|
|
|
171
159
|
for (const [withHashKey, matched] of map.entries()) code = code.replaceAll(withHashKey, matched);
|
|
172
160
|
return code;
|
|
173
161
|
}
|
|
174
|
-
|
|
175
162
|
//#endregion
|
|
176
163
|
//#region ../../virtual-shared/integration/src/transformers.ts
|
|
177
164
|
async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
178
|
-
if (original.includes(
|
|
165
|
+
if (original.includes("@unocss-ignore")) return;
|
|
179
166
|
const transformers = (ctx.uno.config.transformers || []).filter((i) => (i.enforce || "default") === enforce);
|
|
180
167
|
if (!transformers.length) return;
|
|
181
168
|
const skipMap = /* @__PURE__ */ new Map();
|
|
@@ -198,17 +185,15 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
|
198
185
|
}
|
|
199
186
|
if (code !== original) return {
|
|
200
187
|
code,
|
|
201
|
-
map: remapping(maps, (_, ctx
|
|
202
|
-
ctx
|
|
188
|
+
map: remapping(maps, (_, ctx) => {
|
|
189
|
+
ctx.content = code;
|
|
203
190
|
return null;
|
|
204
191
|
})
|
|
205
192
|
};
|
|
206
193
|
}
|
|
207
|
-
|
|
208
194
|
//#endregion
|
|
209
195
|
//#region package.json
|
|
210
|
-
var version = "66.6.
|
|
211
|
-
|
|
196
|
+
var version = "66.6.7";
|
|
212
197
|
//#endregion
|
|
213
198
|
//#region src/debug.ts
|
|
214
199
|
/**
|
|
@@ -238,7 +223,6 @@ function debugDetailsTable(options, outFile, files) {
|
|
|
238
223
|
consola.log(separator);
|
|
239
224
|
}
|
|
240
225
|
}
|
|
241
|
-
|
|
242
226
|
//#endregion
|
|
243
227
|
//#region src/errors.ts
|
|
244
228
|
var PrettyError = class extends Error {
|
|
@@ -253,7 +237,6 @@ function handleError(error) {
|
|
|
253
237
|
if (error instanceof PrettyError) consola$1.error(error.message);
|
|
254
238
|
process.exitCode = 1;
|
|
255
239
|
}
|
|
256
|
-
|
|
257
240
|
//#endregion
|
|
258
241
|
//#region src/watcher.ts
|
|
259
242
|
let watcher;
|
|
@@ -277,7 +260,6 @@ async function getWatcher(options) {
|
|
|
277
260
|
watcher = newWatcher;
|
|
278
261
|
return newWatcher;
|
|
279
262
|
}
|
|
280
|
-
|
|
281
263
|
//#endregion
|
|
282
264
|
//#region src/index.ts
|
|
283
265
|
async function resolveOptions(options, userConfig) {
|
|
@@ -387,16 +369,16 @@ async function build(_options) {
|
|
|
387
369
|
generate(options).catch(handleError);
|
|
388
370
|
}, 100);
|
|
389
371
|
await startWatcher().catch(handleError);
|
|
390
|
-
async function generate(options
|
|
391
|
-
return Promise.all(Array.from(fileCache.entries()).map(([outFile, entries]) => generateSingle(options
|
|
372
|
+
async function generate(options) {
|
|
373
|
+
return Promise.all(Array.from(fileCache.entries()).map(([outFile, entries]) => generateSingle(options, outFile, entries)));
|
|
392
374
|
}
|
|
393
375
|
async function startWatcher() {
|
|
394
376
|
if (!options.watch) return;
|
|
395
377
|
const { ctx } = options;
|
|
396
|
-
const watcher
|
|
378
|
+
const watcher = await getWatcher(options);
|
|
397
379
|
const watchedFiles = [...fileCache.values().flatMap((files) => files.map((f) => f.id)), ...ctx.getConfigFileList()];
|
|
398
|
-
watcher
|
|
399
|
-
watcher
|
|
380
|
+
watcher.add(watchedFiles);
|
|
381
|
+
watcher.on("all", async (type, file) => {
|
|
400
382
|
const absolutePath = resolve(options.cwd, file);
|
|
401
383
|
if (type === "addDir" || type === "unlinkDir") return;
|
|
402
384
|
if (ctx.getConfigFileList().map(normalize).includes(absolutePath)) {
|
|
@@ -405,7 +387,7 @@ async function build(_options) {
|
|
|
405
387
|
Object.assign(options, newOtions);
|
|
406
388
|
await parseEntries(options, fileCache);
|
|
407
389
|
const configSources = ctx.getConfigFileList().map(normalize);
|
|
408
|
-
if (configSources.length) watcher
|
|
390
|
+
if (configSources.length) watcher.add(configSources);
|
|
409
391
|
if (type === "change") consola$1.info(`${cyan(basename(file))} changed, setting new config`);
|
|
410
392
|
consola$1.info(`Watching for changes in ${[...options.entries.flatMap((i) => i.patterns), ...configSources].map(cyan).join(", ")}`);
|
|
411
393
|
} else if (type === "change") {
|
|
@@ -431,9 +413,9 @@ async function build(_options) {
|
|
|
431
413
|
}
|
|
432
414
|
}
|
|
433
415
|
async function transformFiles(ctx, sources) {
|
|
434
|
-
const run = (sources
|
|
416
|
+
const run = (sources, enforce) => Promise.all(sources.map((source) => new Promise((resolve) => {
|
|
435
417
|
applyTransformers(ctx, source.transformedCode ?? source.code, source.id, enforce).then((transformsRes) => {
|
|
436
|
-
resolve
|
|
418
|
+
resolve({
|
|
437
419
|
...source,
|
|
438
420
|
transformedCode: (transformsRes === null || transformsRes === void 0 ? void 0 : transformsRes.code) ?? source.transformedCode
|
|
439
421
|
});
|
|
@@ -485,6 +467,5 @@ async function generateSingle(options, outFile, files) {
|
|
|
485
467
|
if (matchedLen > 0) consola$1.success(`${matchedLen} utilities generated to ${cyan(relative(process.cwd(), outFileResolved))} in ${green(duration)}ms\n`);
|
|
486
468
|
}
|
|
487
469
|
}
|
|
488
|
-
|
|
489
470
|
//#endregion
|
|
490
|
-
export { handleError as n, version as r, build as t };
|
|
471
|
+
export { handleError as n, version as r, build as t };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.6.
|
|
4
|
+
"version": "66.6.7",
|
|
5
5
|
"description": "CLI for UnoCSS",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Johann Schopplich",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"perfect-debounce": "^2.1.0",
|
|
47
47
|
"tinyglobby": "^0.2.15",
|
|
48
48
|
"unplugin-utils": "^0.3.1",
|
|
49
|
-
"@unocss/config": "66.6.
|
|
50
|
-
"@unocss/core": "66.6.
|
|
51
|
-
"@unocss/preset-
|
|
52
|
-
"@unocss/
|
|
53
|
-
"@unocss/
|
|
49
|
+
"@unocss/config": "66.6.7",
|
|
50
|
+
"@unocss/core": "66.6.7",
|
|
51
|
+
"@unocss/preset-wind4": "66.6.7",
|
|
52
|
+
"@unocss/transformer-directives": "66.6.7",
|
|
53
|
+
"@unocss/preset-wind3": "66.6.7"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsdown --config-loader unrun",
|