@unocss/cli 66.7.2 → 66.7.3
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 +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-C2QZQu0w.mjs → src-BiyH6pNk.mjs} +35 -14
- package/package.json +7 -7
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-BiyH6pNk.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { green } from "colorette";
|
|
4
4
|
import { resolve } from "pathe";
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as build } from "./src-
|
|
1
|
+
import { t as build } from "./src-BiyH6pNk.mjs";
|
|
2
2
|
export { build };
|
|
@@ -2,7 +2,7 @@ import { existsSync, promises } from "node:fs";
|
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { BetterMap, createGenerator, cssIdRE, toArray } from "@unocss/core";
|
|
4
4
|
import { cyan, dim, green, yellow } from "colorette";
|
|
5
|
-
import consola, { consola
|
|
5
|
+
import consola$1, { consola } from "consola";
|
|
6
6
|
import { basename, dirname, normalize, relative, resolve } from "pathe";
|
|
7
7
|
import { debounce } from "perfect-debounce";
|
|
8
8
|
import { glob } from "tinyglobby";
|
|
@@ -160,18 +160,39 @@ function restoreSkipCode(code, map) {
|
|
|
160
160
|
}
|
|
161
161
|
//#endregion
|
|
162
162
|
//#region ../../virtual-shared/integration/src/transformers.ts
|
|
163
|
+
const transformerCache = /* @__PURE__ */ new WeakMap();
|
|
164
|
+
function getTransformers(ctx, enforce) {
|
|
165
|
+
const configured = ctx.uno.config.transformers;
|
|
166
|
+
if (!configured?.length) return;
|
|
167
|
+
let grouped = transformerCache.get(configured);
|
|
168
|
+
if (!grouped) {
|
|
169
|
+
grouped = {
|
|
170
|
+
pre: [],
|
|
171
|
+
default: [],
|
|
172
|
+
post: []
|
|
173
|
+
};
|
|
174
|
+
for (const transformer of configured) grouped[transformer.enforce || "default"].push(transformer);
|
|
175
|
+
transformerCache.set(configured, grouped);
|
|
176
|
+
}
|
|
177
|
+
return grouped[enforce];
|
|
178
|
+
}
|
|
163
179
|
async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
164
180
|
if (original.includes("@unocss-ignore")) return;
|
|
165
|
-
const transformers = (ctx
|
|
166
|
-
if (!transformers
|
|
167
|
-
const skipMap = /* @__PURE__ */ new Map();
|
|
181
|
+
const transformers = getTransformers(ctx, enforce);
|
|
182
|
+
if (!transformers?.length) return;
|
|
168
183
|
let code = original;
|
|
169
|
-
let
|
|
184
|
+
let skipMap;
|
|
185
|
+
let s;
|
|
170
186
|
const maps = [];
|
|
171
187
|
for (const t of transformers) {
|
|
172
188
|
if (t.idFilter) {
|
|
173
189
|
if (!t.idFilter(id)) continue;
|
|
174
190
|
} else if (!ctx.filter(code, id)) continue;
|
|
191
|
+
if (t.codeFilter && !t.codeFilter(code, id)) continue;
|
|
192
|
+
if (!s) {
|
|
193
|
+
skipMap = /* @__PURE__ */ new Map();
|
|
194
|
+
s = new MagicString(transformSkipCode(code, skipMap, SKIP_COMMENT_RE, "@unocss-skip-placeholder-"));
|
|
195
|
+
}
|
|
175
196
|
await t.transform(s, id, ctx);
|
|
176
197
|
if (s.hasChanged()) {
|
|
177
198
|
code = restoreSkipCode(s.toString(), skipMap);
|
|
@@ -192,7 +213,7 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
|
192
213
|
}
|
|
193
214
|
//#endregion
|
|
194
215
|
//#region package.json
|
|
195
|
-
var version = "66.7.
|
|
216
|
+
var version = "66.7.3";
|
|
196
217
|
//#endregion
|
|
197
218
|
//#region src/debug.ts
|
|
198
219
|
/**
|
|
@@ -214,12 +235,12 @@ function debugDetailsTable(options, outFile, files) {
|
|
|
214
235
|
});
|
|
215
236
|
const colWidths = table[0].map((_, colIndex) => Math.max(...table.map((row) => row[colIndex].length)));
|
|
216
237
|
const separator = colWidths.map((width) => "-".repeat(width + 3)).join("+");
|
|
217
|
-
consola.log(yellow("File Generation Details:"));
|
|
218
|
-
consola.log(separator);
|
|
238
|
+
consola$1.log(yellow("File Generation Details:"));
|
|
239
|
+
consola$1.log(separator);
|
|
219
240
|
for (const row of table) {
|
|
220
241
|
const rowStr = row.map((cell, index) => ` ${cell.padEnd(colWidths[index])} `).join("|");
|
|
221
|
-
consola.log(`|${rowStr}|`);
|
|
222
|
-
consola.log(separator);
|
|
242
|
+
consola$1.log(`|${rowStr}|`);
|
|
243
|
+
consola$1.log(separator);
|
|
223
244
|
}
|
|
224
245
|
}
|
|
225
246
|
//#endregion
|
|
@@ -233,7 +254,7 @@ var PrettyError = class extends Error {
|
|
|
233
254
|
}
|
|
234
255
|
};
|
|
235
256
|
function handleError(error) {
|
|
236
|
-
if (error instanceof PrettyError) consola
|
|
257
|
+
if (error instanceof PrettyError) consola.error(error.message);
|
|
237
258
|
process.exitCode = 1;
|
|
238
259
|
}
|
|
239
260
|
//#endregion
|
|
@@ -262,7 +283,7 @@ async function getWatcher(options) {
|
|
|
262
283
|
//#endregion
|
|
263
284
|
//#region src/index.ts
|
|
264
285
|
function createCliLogger(options) {
|
|
265
|
-
return options.stdout ? consola
|
|
286
|
+
return options.stdout ? consola.create({ stdout: process.stderr }) : consola;
|
|
266
287
|
}
|
|
267
288
|
async function resolveOptions(options, userConfig) {
|
|
268
289
|
const resolvedOptions = {
|
|
@@ -465,8 +486,8 @@ async function generateSingle(options, outFile, files) {
|
|
|
465
486
|
await promises.writeFile(outFileResolved, finalCss, "utf-8");
|
|
466
487
|
if (!options.watch) {
|
|
467
488
|
const duration = (performance.now() - start).toFixed(2);
|
|
468
|
-
if (rewriter.length > 0) consola
|
|
469
|
-
if (matchedLen > 0) consola
|
|
489
|
+
if (rewriter.length > 0) consola.success(`${rewriter.length} file${rewriter.length > 1 ? "s" : ""} rewritten in ${green(duration)}ms`);
|
|
490
|
+
if (matchedLen > 0) consola.success(`${matchedLen} utilities generated to ${cyan(relative(process.cwd(), outFileResolved))} in ${green(duration)}ms\n`);
|
|
470
491
|
}
|
|
471
492
|
}
|
|
472
493
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.7.
|
|
4
|
+
"version": "66.7.3",
|
|
5
5
|
"description": "CLI for UnoCSS",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Johann Schopplich",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"magic-string": "^0.30.21",
|
|
42
42
|
"pathe": "^2.0.3",
|
|
43
43
|
"perfect-debounce": "^2.1.0",
|
|
44
|
-
"tinyglobby": "^0.2.
|
|
44
|
+
"tinyglobby": "^0.2.17",
|
|
45
45
|
"unplugin-utils": "^0.3.1",
|
|
46
|
-
"@unocss/
|
|
47
|
-
"@unocss/
|
|
48
|
-
"@unocss/preset-wind3": "66.7.
|
|
49
|
-
"@unocss/transformer-directives": "66.7.
|
|
50
|
-
"@unocss/preset-wind4": "66.7.
|
|
46
|
+
"@unocss/core": "66.7.3",
|
|
47
|
+
"@unocss/config": "66.7.3",
|
|
48
|
+
"@unocss/preset-wind3": "66.7.3",
|
|
49
|
+
"@unocss/transformer-directives": "66.7.3",
|
|
50
|
+
"@unocss/preset-wind4": "66.7.3"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsdown --config-loader unrun",
|