@batijs/cli 0.0.564 → 0.0.568
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/boilerplates/@batijs/auth0/files/$.env.js +5 -5
- package/dist/boilerplates/@batijs/auth0/files/$TODO.md.js +3 -3
- package/dist/boilerplates/@batijs/auth0/files/$wrangler.jsonc.js +3 -3
- package/dist/boilerplates/@batijs/authjs/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/aws/files/$README.md.js +5 -5
- package/dist/boilerplates/@batijs/aws/files/$TODO.md.js +5 -5
- package/dist/boilerplates/@batijs/aws/files/$package.json.js +9 -9
- package/dist/boilerplates/@batijs/aws/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/biome/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/cloudflare/files/$TODO.md.js +5 -5
- package/dist/boilerplates/@batijs/cloudflare/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/cloudflare/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/compiled/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/d1/files/$TODO.md.js +5 -5
- package/dist/boilerplates/@batijs/d1/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/d1/files/$wrangler.jsonc.js +3 -3
- package/dist/boilerplates/@batijs/d1-kysely/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/d1-sqlite/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/drizzle/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/drizzle/files/$TODO.md.js +5 -5
- package/dist/boilerplates/@batijs/drizzle/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/eslint/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/express/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/fastify/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/google-analytics/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/h3/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/hono/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/kysely/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/kysely/files/$TODO.md.js +5 -5
- package/dist/boilerplates/@batijs/kysely/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/mantine/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/mantine/files/$package.json.js +8 -8
- package/dist/boilerplates/@batijs/oxlint/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/photon/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/photon/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/plausible.io/files/$TODO.md.js +3 -3
- package/dist/boilerplates/@batijs/pnpm/files/$pnpm-workspace.yaml.js +3 -3
- package/dist/boilerplates/@batijs/prettier/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/prisma/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/prisma/files/$TODO.md.js +5 -5
- package/dist/boilerplates/@batijs/prisma/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/react/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/react/files/$package.json.js +11 -11
- package/dist/boilerplates/@batijs/react/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/react-sentry/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/sentry/files/$.env.js +4 -4
- package/dist/boilerplates/@batijs/sentry/files/$README.md.js +5 -5
- package/dist/boilerplates/@batijs/sentry/files/$TODO.md.js +3 -3
- package/dist/boilerplates/@batijs/sentry/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/sentry/files/$vite.config.ts.js +7 -7
- package/dist/boilerplates/@batijs/sentry/files/pages/$+client.ts.js +9 -9
- package/dist/boilerplates/@batijs/shadcn-ui/files/$README.md.js +5 -5
- package/dist/boilerplates/@batijs/shadcn-ui/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/shadcn-ui/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/shadcn-ui/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/shared/files/$README.md.js +7 -7
- package/dist/boilerplates/@batijs/shared/files/$TODO.md.js +3 -3
- package/dist/boilerplates/@batijs/shared/files/package.json +1 -1
- package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/shared-todo/types/pages/todo/+data.d.ts +1 -3
- package/dist/boilerplates/@batijs/solid/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/solid/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/solid/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/solid/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/solid-sentry/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/sqlite/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/sqlite/files/$TODO.md.js +5 -5
- package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/tailwindcss/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/telefunc/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/trpc/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/trpc/types/trpc/client.d.ts +2 -2
- package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/vercel/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/vercel/files/pages/$+config.ts.js +3 -3
- package/dist/boilerplates/@batijs/vue/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/vue/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/vue/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/vue/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/vue-sentry/files/$package.json.js +7 -7
- package/dist/{chunk-JMBFOJWR.js → chunk-2ZRZBBQF.js} +61167 -60843
- package/dist/index.js +457 -1599
- package/package.json +8 -7
- package/dist/boilerplates/@batijs/prettier/files/.prettierrc +0 -3
- package/dist/prompt-424IOCOV.js +0 -758
package/dist/index.js
CHANGED
|
@@ -3,14 +3,14 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
|
|
|
3
3
|
const require = createRequire_BATI_CLI(import.meta.url);
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Wps,
|
|
9
|
-
_Rs,
|
|
6
|
+
BRs,
|
|
7
|
+
dfs,
|
|
10
8
|
export_which,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
hfs,
|
|
10
|
+
hir,
|
|
11
|
+
ohe,
|
|
12
|
+
vst
|
|
13
|
+
} from "./chunk-2ZRZBBQF.js";
|
|
14
14
|
import "./chunk-IAWYWZSL.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
@@ -134,40 +134,40 @@ var require_lib = __commonJS({
|
|
|
134
134
|
return this._src.resume();
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
write(
|
|
137
|
+
write(c) {
|
|
138
138
|
if (this.muted) {
|
|
139
139
|
if (!this.replace) {
|
|
140
140
|
return true;
|
|
141
141
|
}
|
|
142
|
-
if (
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
if (c.match(/^\u001b/)) {
|
|
143
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
144
|
+
c = c.slice(this._prompt.length);
|
|
145
|
+
c = c.replace(/./g, this.replace);
|
|
146
|
+
c = this._prompt + c;
|
|
147
147
|
}
|
|
148
148
|
this._hadControl = true;
|
|
149
|
-
return this.emit("data",
|
|
149
|
+
return this.emit("data", c);
|
|
150
150
|
} else {
|
|
151
|
-
if (this._prompt && this._hadControl &&
|
|
151
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
152
152
|
this._hadControl = false;
|
|
153
153
|
this.emit("data", this._prompt);
|
|
154
|
-
|
|
154
|
+
c = c.slice(this._prompt.length);
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
c = c.toString().replace(/./g, this.replace);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
this.emit("data",
|
|
159
|
+
this.emit("data", c);
|
|
160
160
|
}
|
|
161
|
-
end(
|
|
161
|
+
end(c) {
|
|
162
162
|
if (this.muted) {
|
|
163
|
-
if (
|
|
164
|
-
|
|
163
|
+
if (c && this.replace) {
|
|
164
|
+
c = c.toString().replace(/./g, this.replace);
|
|
165
165
|
} else {
|
|
166
|
-
|
|
166
|
+
c = null;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
if (
|
|
170
|
-
this.emit("data",
|
|
169
|
+
if (c) {
|
|
170
|
+
this.emit("data", c);
|
|
171
171
|
}
|
|
172
172
|
this.emit("end");
|
|
173
173
|
}
|
|
@@ -206,8 +206,8 @@ async function mergeDts({
|
|
|
206
206
|
filepath,
|
|
207
207
|
meta
|
|
208
208
|
}) {
|
|
209
|
-
const previousAst =
|
|
210
|
-
const currentAst =
|
|
209
|
+
const previousAst = ohe(previousContent);
|
|
210
|
+
const currentAst = ohe(fileContent);
|
|
211
211
|
for (const imp of previousAst.imports.$items) {
|
|
212
212
|
currentAst.imports[imp.local] = imp;
|
|
213
213
|
}
|
|
@@ -224,7 +224,7 @@ async function mergeDts({
|
|
|
224
224
|
currentAst.$ast.body.splice(index, 0, node);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
const res = await
|
|
227
|
+
const res = await dfs(currentAst.generate().code, meta, {
|
|
228
228
|
filepath
|
|
229
229
|
});
|
|
230
230
|
return clearExports(res.code, meta);
|
|
@@ -248,7 +248,7 @@ async function executeOperationFile(op, {
|
|
|
248
248
|
}) {
|
|
249
249
|
const code = await readFile(op.sourceAbsolute, { encoding: "utf-8" });
|
|
250
250
|
const filepath = relative(op.source, op.sourceAbsolute);
|
|
251
|
-
const result = await
|
|
251
|
+
const result = await dfs(code, meta, {
|
|
252
252
|
filepath
|
|
253
253
|
});
|
|
254
254
|
let fileContent = result.code;
|
|
@@ -270,9 +270,9 @@ async function executeOperationFile(op, {
|
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
function orderBy(array, getter) {
|
|
273
|
-
return array.slice().sort((
|
|
274
|
-
const valueA = getter(
|
|
275
|
-
const valueB = getter(
|
|
273
|
+
return array.slice().sort((a, b) => {
|
|
274
|
+
const valueA = getter(a);
|
|
275
|
+
const valueB = getter(b);
|
|
276
276
|
if (valueA < valueB) return -1;
|
|
277
277
|
if (valueA > valueB) return 1;
|
|
278
278
|
return 0;
|
|
@@ -332,7 +332,7 @@ async function transformFileAfterExec(filepath, fileContent) {
|
|
|
332
332
|
case ".js":
|
|
333
333
|
case ".tsx":
|
|
334
334
|
case ".jsx":
|
|
335
|
-
return
|
|
335
|
+
return vst(fileContent, {
|
|
336
336
|
filepath
|
|
337
337
|
});
|
|
338
338
|
case ".env":
|
|
@@ -361,8 +361,8 @@ async function transformFileAfterExec(filepath, fileContent) {
|
|
|
361
361
|
}
|
|
362
362
|
async function importTransformer(p) {
|
|
363
363
|
const importFile = isWin ? `file://${p}` : p;
|
|
364
|
-
const
|
|
365
|
-
return
|
|
364
|
+
const f = await import(importFile);
|
|
365
|
+
return f.default;
|
|
366
366
|
}
|
|
367
367
|
async function executeOperationTransform(op, {
|
|
368
368
|
meta,
|
|
@@ -435,7 +435,7 @@ function computeDeepUnimportedFiles(importedByVolatileFile, unimportedFiles) {
|
|
|
435
435
|
if (found) {
|
|
436
436
|
redo = true;
|
|
437
437
|
unimportedFiles.push(relationImport.importTargetRelationFile);
|
|
438
|
-
importedByVolatileFile = importedByVolatileFile.filter((
|
|
438
|
+
importedByVolatileFile = importedByVolatileFile.filter((i) => i !== relationImport);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
if (redo) {
|
|
@@ -1145,8 +1145,8 @@ var features = [
|
|
|
1145
1145
|
disabled: true
|
|
1146
1146
|
}
|
|
1147
1147
|
];
|
|
1148
|
-
var flags = features.map((
|
|
1149
|
-
var cliFlags = features.filter((
|
|
1148
|
+
var flags = features.map((f) => f.flag);
|
|
1149
|
+
var cliFlags = features.filter((f) => !f.invisibleCli).map((f) => f.flag);
|
|
1150
1150
|
|
|
1151
1151
|
// ../features/dist/index.js
|
|
1152
1152
|
var BatiSet = class extends Set {
|
|
@@ -1155,11 +1155,11 @@ var BatiSet = class extends Set {
|
|
|
1155
1155
|
#databases;
|
|
1156
1156
|
constructor(flags2, allFeatures) {
|
|
1157
1157
|
super(flags2);
|
|
1158
|
-
this.#servers = new Set(allFeatures.filter((
|
|
1159
|
-
this.#databases = new Set(allFeatures.filter((
|
|
1158
|
+
this.#servers = new Set(allFeatures.filter((f) => f.category === "Server").map((f) => f.flag));
|
|
1159
|
+
this.#databases = new Set(allFeatures.filter((f) => f.category === "Database").map((f) => f.flag));
|
|
1160
1160
|
}
|
|
1161
|
-
hasOneOf(
|
|
1162
|
-
for (const x of this) if (
|
|
1161
|
+
hasOneOf(a) {
|
|
1162
|
+
for (const x of this) if (a.has(x)) return true;
|
|
1163
1163
|
return false;
|
|
1164
1164
|
}
|
|
1165
1165
|
get hasServer() {
|
|
@@ -1193,20 +1193,20 @@ var RulesMessage = /* @__PURE__ */ ((RulesMessage2) => {
|
|
|
1193
1193
|
})(RulesMessage || {});
|
|
1194
1194
|
function requires(message, ifPresent, mustAlsoInclude) {
|
|
1195
1195
|
const m = Array.from(prepare(mustAlsoInclude));
|
|
1196
|
-
return (fts) => fts.has(ifPresent) && !m.every((
|
|
1196
|
+
return (fts) => fts.has(ifPresent) && !m.every((r) => fts.has(r)) && message;
|
|
1197
1197
|
}
|
|
1198
1198
|
function filter(message, callback) {
|
|
1199
1199
|
return (fts) => callback(fts) && message;
|
|
1200
1200
|
}
|
|
1201
1201
|
function prepare(fts) {
|
|
1202
|
-
const
|
|
1203
|
-
for (const
|
|
1204
|
-
if (flags.includes(
|
|
1205
|
-
|
|
1202
|
+
const s = /* @__PURE__ */ new Set();
|
|
1203
|
+
for (const f of fts) {
|
|
1204
|
+
if (flags.includes(f)) {
|
|
1205
|
+
s.add(features.find((feat) => feat.flag === f).category);
|
|
1206
1206
|
}
|
|
1207
|
-
|
|
1207
|
+
s.add(f);
|
|
1208
1208
|
}
|
|
1209
|
-
return
|
|
1209
|
+
return s;
|
|
1210
1210
|
}
|
|
1211
1211
|
var rules_default = [
|
|
1212
1212
|
requires(0, "Auth", ["Server"]),
|
|
@@ -1270,7 +1270,7 @@ function execRules(fts, rulesMessages2) {
|
|
|
1270
1270
|
return messages;
|
|
1271
1271
|
}
|
|
1272
1272
|
|
|
1273
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1273
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/key.js
|
|
1274
1274
|
var isUpKey = (key, keybindings = []) => (
|
|
1275
1275
|
// The up key
|
|
1276
1276
|
key.name === "up" || // Vim keybinding: hjkl keys map to left/down/up/right
|
|
@@ -1287,7 +1287,7 @@ var isBackspaceKey = (key) => key.name === "backspace";
|
|
|
1287
1287
|
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
1288
1288
|
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
1289
1289
|
|
|
1290
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1290
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/errors.js
|
|
1291
1291
|
var AbortPromptError = class extends Error {
|
|
1292
1292
|
name = "AbortPromptError";
|
|
1293
1293
|
message = "Prompt was aborted";
|
|
@@ -1310,10 +1310,10 @@ var ValidationError = class extends Error {
|
|
|
1310
1310
|
name = "ValidationError";
|
|
1311
1311
|
};
|
|
1312
1312
|
|
|
1313
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1313
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
1314
1314
|
import { AsyncResource as AsyncResource2 } from "async_hooks";
|
|
1315
1315
|
|
|
1316
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1316
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
1317
1317
|
import { AsyncLocalStorage, AsyncResource } from "async_hooks";
|
|
1318
1318
|
var hookStorage = new AsyncLocalStorage();
|
|
1319
1319
|
function createStore(rl) {
|
|
@@ -1419,7 +1419,7 @@ var effectScheduler = {
|
|
|
1419
1419
|
}
|
|
1420
1420
|
};
|
|
1421
1421
|
|
|
1422
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1422
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
1423
1423
|
function useState(defaultValue) {
|
|
1424
1424
|
return withPointer((pointer) => {
|
|
1425
1425
|
const setState = AsyncResource2.bind(function setState2(newValue) {
|
|
@@ -1437,11 +1437,11 @@ function useState(defaultValue) {
|
|
|
1437
1437
|
});
|
|
1438
1438
|
}
|
|
1439
1439
|
|
|
1440
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1440
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
1441
1441
|
function useEffect(cb, depArray) {
|
|
1442
1442
|
withPointer((pointer) => {
|
|
1443
1443
|
const oldDeps = pointer.get();
|
|
1444
|
-
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep,
|
|
1444
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
1445
1445
|
if (hasChanged) {
|
|
1446
1446
|
effectScheduler.queue(cb);
|
|
1447
1447
|
}
|
|
@@ -1449,7 +1449,7 @@ function useEffect(cb, depArray) {
|
|
|
1449
1449
|
});
|
|
1450
1450
|
}
|
|
1451
1451
|
|
|
1452
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1452
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/theme.js
|
|
1453
1453
|
import { styleText } from "util";
|
|
1454
1454
|
|
|
1455
1455
|
// ../../node_modules/.pnpm/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
|
|
@@ -1744,7 +1744,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
|
1744
1744
|
var dist_default = figures;
|
|
1745
1745
|
var replacements = Object.entries(specialMainSymbols);
|
|
1746
1746
|
|
|
1747
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1747
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/theme.js
|
|
1748
1748
|
var defaultTheme = {
|
|
1749
1749
|
prefix: {
|
|
1750
1750
|
idle: styleText("blue", "?"),
|
|
@@ -1765,7 +1765,7 @@ var defaultTheme = {
|
|
|
1765
1765
|
}
|
|
1766
1766
|
};
|
|
1767
1767
|
|
|
1768
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1768
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
1769
1769
|
function isPlainObject(value) {
|
|
1770
1770
|
if (typeof value !== "object" || value === null)
|
|
1771
1771
|
return false;
|
|
@@ -1793,7 +1793,7 @@ function makeTheme(...themes) {
|
|
|
1793
1793
|
return deepMerge(...themesToMerge);
|
|
1794
1794
|
}
|
|
1795
1795
|
|
|
1796
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1796
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
1797
1797
|
function usePrefix({ status = "idle", theme }) {
|
|
1798
1798
|
const [showLoader, setShowLoader] = useState(false);
|
|
1799
1799
|
const [tick, setTick] = useState(0);
|
|
@@ -1824,11 +1824,11 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
1824
1824
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
1825
1825
|
}
|
|
1826
1826
|
|
|
1827
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1827
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
1828
1828
|
function useMemo(fn, dependencies) {
|
|
1829
1829
|
return withPointer((pointer) => {
|
|
1830
1830
|
const prev = pointer.get();
|
|
1831
|
-
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep,
|
|
1831
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
1832
1832
|
const value = fn();
|
|
1833
1833
|
pointer.set({ value, dependencies });
|
|
1834
1834
|
return value;
|
|
@@ -1837,12 +1837,12 @@ function useMemo(fn, dependencies) {
|
|
|
1837
1837
|
});
|
|
1838
1838
|
}
|
|
1839
1839
|
|
|
1840
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1840
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
1841
1841
|
function useRef(val) {
|
|
1842
1842
|
return useState({ current: val })[0];
|
|
1843
1843
|
}
|
|
1844
1844
|
|
|
1845
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1845
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
1846
1846
|
function useKeypress(userHandler) {
|
|
1847
1847
|
const signal = useRef(userHandler);
|
|
1848
1848
|
signal.current = userHandler;
|
|
@@ -1861,7 +1861,7 @@ function useKeypress(userHandler) {
|
|
|
1861
1861
|
}, []);
|
|
1862
1862
|
}
|
|
1863
1863
|
|
|
1864
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
1864
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/utils.js
|
|
1865
1865
|
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
1866
1866
|
|
|
1867
1867
|
// ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
@@ -2301,7 +2301,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
2301
2301
|
return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
|
|
2302
2302
|
}
|
|
2303
2303
|
|
|
2304
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
2304
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/utils.js
|
|
2305
2305
|
function breakLines(content, width) {
|
|
2306
2306
|
return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split("\n").map((str) => str.trimEnd())).join("\n");
|
|
2307
2307
|
}
|
|
@@ -2309,7 +2309,7 @@ function readlineWidth() {
|
|
|
2309
2309
|
return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
|
|
2310
2310
|
}
|
|
2311
2311
|
|
|
2312
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
2312
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
2313
2313
|
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
2314
2314
|
const state = useRef({
|
|
2315
2315
|
lastPointer: active,
|
|
@@ -2398,7 +2398,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
|
2398
2398
|
return pageBuffer.filter((line) => typeof line === "string").join("\n");
|
|
2399
2399
|
}
|
|
2400
2400
|
|
|
2401
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
2401
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
2402
2402
|
var import_mute_stream = __toESM(require_lib(), 1);
|
|
2403
2403
|
import * as readline2 from "readline";
|
|
2404
2404
|
import { AsyncResource as AsyncResource3 } from "async_hooks";
|
|
@@ -2459,14 +2459,14 @@ var Emitter = class {
|
|
|
2459
2459
|
}
|
|
2460
2460
|
removeListener(ev, fn) {
|
|
2461
2461
|
const list = this.listeners[ev];
|
|
2462
|
-
const
|
|
2463
|
-
if (
|
|
2462
|
+
const i = list.indexOf(fn);
|
|
2463
|
+
if (i === -1) {
|
|
2464
2464
|
return;
|
|
2465
2465
|
}
|
|
2466
|
-
if (
|
|
2466
|
+
if (i === 0 && list.length === 1) {
|
|
2467
2467
|
list.length = 0;
|
|
2468
2468
|
} else {
|
|
2469
|
-
list.splice(
|
|
2469
|
+
list.splice(i, 1);
|
|
2470
2470
|
}
|
|
2471
2471
|
}
|
|
2472
2472
|
emit(ev, code, signal) {
|
|
@@ -2536,9 +2536,9 @@ var SignalExit = class extends SignalExitBase {
|
|
|
2536
2536
|
if (listeners.length === count) {
|
|
2537
2537
|
this.unload();
|
|
2538
2538
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
2539
|
-
const
|
|
2539
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
2540
2540
|
if (!ret)
|
|
2541
|
-
process4.kill(process4.pid,
|
|
2541
|
+
process4.kill(process4.pid, s);
|
|
2542
2542
|
}
|
|
2543
2543
|
};
|
|
2544
2544
|
}
|
|
@@ -2573,11 +2573,11 @@ var SignalExit = class extends SignalExitBase {
|
|
|
2573
2573
|
const fn = this.#sigListeners[sig];
|
|
2574
2574
|
if (fn)
|
|
2575
2575
|
this.#process.on(sig, fn);
|
|
2576
|
-
} catch (
|
|
2576
|
+
} catch (_) {
|
|
2577
2577
|
}
|
|
2578
2578
|
}
|
|
2579
|
-
this.#process.emit = (ev, ...
|
|
2580
|
-
return this.#processEmit(ev, ...
|
|
2579
|
+
this.#process.emit = (ev, ...a) => {
|
|
2580
|
+
return this.#processEmit(ev, ...a);
|
|
2581
2581
|
};
|
|
2582
2582
|
this.#process.reallyExit = (code) => {
|
|
2583
2583
|
return this.#processReallyExit(code);
|
|
@@ -2595,7 +2595,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
2595
2595
|
}
|
|
2596
2596
|
try {
|
|
2597
2597
|
this.#process.removeListener(sig, listener);
|
|
2598
|
-
} catch (
|
|
2598
|
+
} catch (_) {
|
|
2599
2599
|
}
|
|
2600
2600
|
});
|
|
2601
2601
|
this.#process.emit = this.#originalProcessEmit;
|
|
@@ -2654,7 +2654,7 @@ var {
|
|
|
2654
2654
|
unload
|
|
2655
2655
|
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback());
|
|
2656
2656
|
|
|
2657
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
2657
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
2658
2658
|
import { stripVTControlCharacters } from "util";
|
|
2659
2659
|
|
|
2660
2660
|
// ../../node_modules/.pnpm/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
|
|
@@ -2664,16 +2664,16 @@ var cursorHide = ESC + "?25l";
|
|
|
2664
2664
|
var cursorShow = ESC + "?25h";
|
|
2665
2665
|
var cursorUp = (rows = 1) => rows > 0 ? `${ESC}${rows}A` : "";
|
|
2666
2666
|
var cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : "";
|
|
2667
|
-
var cursorTo = (x,
|
|
2668
|
-
if (typeof
|
|
2669
|
-
return `${ESC}${
|
|
2667
|
+
var cursorTo = (x, y) => {
|
|
2668
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
2669
|
+
return `${ESC}${y + 1};${x + 1}H`;
|
|
2670
2670
|
}
|
|
2671
2671
|
return `${ESC}${x + 1}G`;
|
|
2672
2672
|
};
|
|
2673
2673
|
var eraseLine = ESC + "2K";
|
|
2674
2674
|
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
2675
2675
|
|
|
2676
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
2676
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
2677
2677
|
var height = (content) => content.split("\n").length;
|
|
2678
2678
|
var lastLine = (content) => content.split("\n").pop() ?? "";
|
|
2679
2679
|
var ScreenManager = class {
|
|
@@ -2733,7 +2733,7 @@ var ScreenManager = class {
|
|
|
2733
2733
|
}
|
|
2734
2734
|
};
|
|
2735
2735
|
|
|
2736
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
2736
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
2737
2737
|
var PromisePolyfill = class extends Promise {
|
|
2738
2738
|
// Available starting from Node 22
|
|
2739
2739
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
@@ -2748,12 +2748,12 @@ var PromisePolyfill = class extends Promise {
|
|
|
2748
2748
|
}
|
|
2749
2749
|
};
|
|
2750
2750
|
|
|
2751
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
2751
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
2752
2752
|
function getCallSites() {
|
|
2753
2753
|
const _prepareStackTrace = Error.prepareStackTrace;
|
|
2754
2754
|
let result = [];
|
|
2755
2755
|
try {
|
|
2756
|
-
Error.prepareStackTrace = (
|
|
2756
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
2757
2757
|
const callSitesWithoutCurrent = callSites.slice(1);
|
|
2758
2758
|
result = callSitesWithoutCurrent;
|
|
2759
2759
|
return callSitesWithoutCurrent;
|
|
@@ -2835,7 +2835,7 @@ function createPrompt(view) {
|
|
|
2835
2835
|
return prompt;
|
|
2836
2836
|
}
|
|
2837
2837
|
|
|
2838
|
-
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.
|
|
2838
|
+
// ../../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@20.19.30/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
2839
2839
|
import { styleText as styleText2 } from "util";
|
|
2840
2840
|
var Separator = class {
|
|
2841
2841
|
separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
@@ -2850,7 +2850,7 @@ var Separator = class {
|
|
|
2850
2850
|
}
|
|
2851
2851
|
};
|
|
2852
2852
|
|
|
2853
|
-
// ../../node_modules/.pnpm/@inquirer+select@5.0.4_@types+node@20.19.
|
|
2853
|
+
// ../../node_modules/.pnpm/@inquirer+select@5.0.4_@types+node@20.19.30/node_modules/@inquirer/select/dist/index.js
|
|
2854
2854
|
import { styleText as styleText3 } from "util";
|
|
2855
2855
|
var selectTheme = {
|
|
2856
2856
|
icon: { cursor: dist_default.pointer },
|
|
@@ -3006,1154 +3006,22 @@ var dist_default2 = createPrompt((config, done) => {
|
|
|
3006
3006
|
return `${lines}${cursorHide}`;
|
|
3007
3007
|
});
|
|
3008
3008
|
|
|
3009
|
-
// ../../node_modules/.pnpm/
|
|
3010
|
-
var LogLevels = {
|
|
3011
|
-
silent: Number.NEGATIVE_INFINITY,
|
|
3012
|
-
fatal: 0,
|
|
3013
|
-
error: 0,
|
|
3014
|
-
warn: 1,
|
|
3015
|
-
log: 2,
|
|
3016
|
-
info: 3,
|
|
3017
|
-
success: 3,
|
|
3018
|
-
fail: 3,
|
|
3019
|
-
ready: 3,
|
|
3020
|
-
start: 3,
|
|
3021
|
-
box: 3,
|
|
3022
|
-
debug: 4,
|
|
3023
|
-
trace: 5,
|
|
3024
|
-
verbose: Number.POSITIVE_INFINITY
|
|
3025
|
-
};
|
|
3026
|
-
var LogTypes = {
|
|
3027
|
-
// Silent
|
|
3028
|
-
silent: {
|
|
3029
|
-
level: -1
|
|
3030
|
-
},
|
|
3031
|
-
// Level 0
|
|
3032
|
-
fatal: {
|
|
3033
|
-
level: LogLevels.fatal
|
|
3034
|
-
},
|
|
3035
|
-
error: {
|
|
3036
|
-
level: LogLevels.error
|
|
3037
|
-
},
|
|
3038
|
-
// Level 1
|
|
3039
|
-
warn: {
|
|
3040
|
-
level: LogLevels.warn
|
|
3041
|
-
},
|
|
3042
|
-
// Level 2
|
|
3043
|
-
log: {
|
|
3044
|
-
level: LogLevels.log
|
|
3045
|
-
},
|
|
3046
|
-
// Level 3
|
|
3047
|
-
info: {
|
|
3048
|
-
level: LogLevels.info
|
|
3049
|
-
},
|
|
3050
|
-
success: {
|
|
3051
|
-
level: LogLevels.success
|
|
3052
|
-
},
|
|
3053
|
-
fail: {
|
|
3054
|
-
level: LogLevels.fail
|
|
3055
|
-
},
|
|
3056
|
-
ready: {
|
|
3057
|
-
level: LogLevels.info
|
|
3058
|
-
},
|
|
3059
|
-
start: {
|
|
3060
|
-
level: LogLevels.info
|
|
3061
|
-
},
|
|
3062
|
-
box: {
|
|
3063
|
-
level: LogLevels.info
|
|
3064
|
-
},
|
|
3065
|
-
// Level 4
|
|
3066
|
-
debug: {
|
|
3067
|
-
level: LogLevels.debug
|
|
3068
|
-
},
|
|
3069
|
-
// Level 5
|
|
3070
|
-
trace: {
|
|
3071
|
-
level: LogLevels.trace
|
|
3072
|
-
},
|
|
3073
|
-
// Verbose
|
|
3074
|
-
verbose: {
|
|
3075
|
-
level: LogLevels.verbose
|
|
3076
|
-
}
|
|
3077
|
-
};
|
|
3078
|
-
function isPlainObject$1(value) {
|
|
3079
|
-
if (value === null || typeof value !== "object") {
|
|
3080
|
-
return false;
|
|
3081
|
-
}
|
|
3082
|
-
const prototype = Object.getPrototypeOf(value);
|
|
3083
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
3084
|
-
return false;
|
|
3085
|
-
}
|
|
3086
|
-
if (Symbol.iterator in value) {
|
|
3087
|
-
return false;
|
|
3088
|
-
}
|
|
3089
|
-
if (Symbol.toStringTag in value) {
|
|
3090
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
3091
|
-
}
|
|
3092
|
-
return true;
|
|
3093
|
-
}
|
|
3094
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
3095
|
-
if (!isPlainObject$1(defaults)) {
|
|
3096
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
3097
|
-
}
|
|
3098
|
-
const object = Object.assign({}, defaults);
|
|
3099
|
-
for (const key in baseObject) {
|
|
3100
|
-
if (key === "__proto__" || key === "constructor") {
|
|
3101
|
-
continue;
|
|
3102
|
-
}
|
|
3103
|
-
const value = baseObject[key];
|
|
3104
|
-
if (value === null || value === void 0) {
|
|
3105
|
-
continue;
|
|
3106
|
-
}
|
|
3107
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
3108
|
-
continue;
|
|
3109
|
-
}
|
|
3110
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
3111
|
-
object[key] = [...value, ...object[key]];
|
|
3112
|
-
} else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
|
|
3113
|
-
object[key] = _defu(
|
|
3114
|
-
value,
|
|
3115
|
-
object[key],
|
|
3116
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
3117
|
-
merger
|
|
3118
|
-
);
|
|
3119
|
-
} else {
|
|
3120
|
-
object[key] = value;
|
|
3121
|
-
}
|
|
3122
|
-
}
|
|
3123
|
-
return object;
|
|
3124
|
-
}
|
|
3125
|
-
function createDefu(merger) {
|
|
3126
|
-
return (...arguments_) => (
|
|
3127
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
3128
|
-
arguments_.reduce((p, c2) => _defu(p, c2, "", merger), {})
|
|
3129
|
-
);
|
|
3130
|
-
}
|
|
3131
|
-
var defu = createDefu();
|
|
3132
|
-
function isPlainObject2(obj) {
|
|
3133
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
3134
|
-
}
|
|
3135
|
-
function isLogObj(arg) {
|
|
3136
|
-
if (!isPlainObject2(arg)) {
|
|
3137
|
-
return false;
|
|
3138
|
-
}
|
|
3139
|
-
if (!arg.message && !arg.args) {
|
|
3140
|
-
return false;
|
|
3141
|
-
}
|
|
3142
|
-
if (arg.stack) {
|
|
3143
|
-
return false;
|
|
3144
|
-
}
|
|
3145
|
-
return true;
|
|
3146
|
-
}
|
|
3147
|
-
var paused = false;
|
|
3148
|
-
var queue = [];
|
|
3149
|
-
var Consola = class _Consola {
|
|
3150
|
-
options;
|
|
3151
|
-
_lastLog;
|
|
3152
|
-
_mockFn;
|
|
3153
|
-
/**
|
|
3154
|
-
* Creates an instance of Consola with specified options or defaults.
|
|
3155
|
-
*
|
|
3156
|
-
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
3157
|
-
*/
|
|
3158
|
-
constructor(options = {}) {
|
|
3159
|
-
const types = options.types || LogTypes;
|
|
3160
|
-
this.options = defu(
|
|
3161
|
-
{
|
|
3162
|
-
...options,
|
|
3163
|
-
defaults: { ...options.defaults },
|
|
3164
|
-
level: _normalizeLogLevel(options.level, types),
|
|
3165
|
-
reporters: [...options.reporters || []]
|
|
3166
|
-
},
|
|
3167
|
-
{
|
|
3168
|
-
types: LogTypes,
|
|
3169
|
-
throttle: 1e3,
|
|
3170
|
-
throttleMin: 5,
|
|
3171
|
-
formatOptions: {
|
|
3172
|
-
date: true,
|
|
3173
|
-
colors: false,
|
|
3174
|
-
compact: true
|
|
3175
|
-
}
|
|
3176
|
-
}
|
|
3177
|
-
);
|
|
3178
|
-
for (const type in types) {
|
|
3179
|
-
const defaults = {
|
|
3180
|
-
type,
|
|
3181
|
-
...this.options.defaults,
|
|
3182
|
-
...types[type]
|
|
3183
|
-
};
|
|
3184
|
-
this[type] = this._wrapLogFn(defaults);
|
|
3185
|
-
this[type].raw = this._wrapLogFn(
|
|
3186
|
-
defaults,
|
|
3187
|
-
true
|
|
3188
|
-
);
|
|
3189
|
-
}
|
|
3190
|
-
if (this.options.mockFn) {
|
|
3191
|
-
this.mockTypes();
|
|
3192
|
-
}
|
|
3193
|
-
this._lastLog = {};
|
|
3194
|
-
}
|
|
3195
|
-
/**
|
|
3196
|
-
* Gets the current log level of the Consola instance.
|
|
3197
|
-
*
|
|
3198
|
-
* @returns {number} The current log level.
|
|
3199
|
-
*/
|
|
3200
|
-
get level() {
|
|
3201
|
-
return this.options.level;
|
|
3202
|
-
}
|
|
3203
|
-
/**
|
|
3204
|
-
* Sets the minimum log level that will be output by the instance.
|
|
3205
|
-
*
|
|
3206
|
-
* @param {number} level - The new log level to set.
|
|
3207
|
-
*/
|
|
3208
|
-
set level(level) {
|
|
3209
|
-
this.options.level = _normalizeLogLevel(
|
|
3210
|
-
level,
|
|
3211
|
-
this.options.types,
|
|
3212
|
-
this.options.level
|
|
3213
|
-
);
|
|
3214
|
-
}
|
|
3215
|
-
/**
|
|
3216
|
-
* Displays a prompt to the user and returns the response.
|
|
3217
|
-
* Throw an error if `prompt` is not supported by the current configuration.
|
|
3218
|
-
*
|
|
3219
|
-
* @template T
|
|
3220
|
-
* @param {string} message - The message to display in the prompt.
|
|
3221
|
-
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
3222
|
-
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
3223
|
-
*/
|
|
3224
|
-
prompt(message, opts) {
|
|
3225
|
-
if (!this.options.prompt) {
|
|
3226
|
-
throw new Error("prompt is not supported!");
|
|
3227
|
-
}
|
|
3228
|
-
return this.options.prompt(message, opts);
|
|
3229
|
-
}
|
|
3230
|
-
/**
|
|
3231
|
-
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
3232
|
-
*
|
|
3233
|
-
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
3234
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
3235
|
-
*/
|
|
3236
|
-
create(options) {
|
|
3237
|
-
const instance = new _Consola({
|
|
3238
|
-
...this.options,
|
|
3239
|
-
...options
|
|
3240
|
-
});
|
|
3241
|
-
if (this._mockFn) {
|
|
3242
|
-
instance.mockTypes(this._mockFn);
|
|
3243
|
-
}
|
|
3244
|
-
return instance;
|
|
3245
|
-
}
|
|
3246
|
-
/**
|
|
3247
|
-
* Creates a new Consola instance with the specified default log object properties.
|
|
3248
|
-
*
|
|
3249
|
-
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
3250
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
3251
|
-
*/
|
|
3252
|
-
withDefaults(defaults) {
|
|
3253
|
-
return this.create({
|
|
3254
|
-
...this.options,
|
|
3255
|
-
defaults: {
|
|
3256
|
-
...this.options.defaults,
|
|
3257
|
-
...defaults
|
|
3258
|
-
}
|
|
3259
|
-
});
|
|
3260
|
-
}
|
|
3261
|
-
/**
|
|
3262
|
-
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
3263
|
-
*
|
|
3264
|
-
* @param {string} tag - The tag to include in each log of the new instance.
|
|
3265
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
3266
|
-
*/
|
|
3267
|
-
withTag(tag) {
|
|
3268
|
-
return this.withDefaults({
|
|
3269
|
-
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
|
|
3270
|
-
});
|
|
3271
|
-
}
|
|
3272
|
-
/**
|
|
3273
|
-
* Adds a custom reporter to the Consola instance.
|
|
3274
|
-
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
3275
|
-
*
|
|
3276
|
-
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
3277
|
-
* @returns {Consola} The current Consola instance.
|
|
3278
|
-
*/
|
|
3279
|
-
addReporter(reporter) {
|
|
3280
|
-
this.options.reporters.push(reporter);
|
|
3281
|
-
return this;
|
|
3282
|
-
}
|
|
3283
|
-
/**
|
|
3284
|
-
* Removes a custom reporter from the Consola instance.
|
|
3285
|
-
* If no reporter is specified, all reporters will be removed.
|
|
3286
|
-
*
|
|
3287
|
-
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
3288
|
-
* @returns {Consola} The current Consola instance.
|
|
3289
|
-
*/
|
|
3290
|
-
removeReporter(reporter) {
|
|
3291
|
-
if (reporter) {
|
|
3292
|
-
const i2 = this.options.reporters.indexOf(reporter);
|
|
3293
|
-
if (i2 !== -1) {
|
|
3294
|
-
return this.options.reporters.splice(i2, 1);
|
|
3295
|
-
}
|
|
3296
|
-
} else {
|
|
3297
|
-
this.options.reporters.splice(0);
|
|
3298
|
-
}
|
|
3299
|
-
return this;
|
|
3300
|
-
}
|
|
3301
|
-
/**
|
|
3302
|
-
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
3303
|
-
*
|
|
3304
|
-
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
3305
|
-
* @returns {Consola} The current Consola instance.
|
|
3306
|
-
*/
|
|
3307
|
-
setReporters(reporters) {
|
|
3308
|
-
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
3309
|
-
return this;
|
|
3310
|
-
}
|
|
3311
|
-
wrapAll() {
|
|
3312
|
-
this.wrapConsole();
|
|
3313
|
-
this.wrapStd();
|
|
3314
|
-
}
|
|
3315
|
-
restoreAll() {
|
|
3316
|
-
this.restoreConsole();
|
|
3317
|
-
this.restoreStd();
|
|
3318
|
-
}
|
|
3319
|
-
/**
|
|
3320
|
-
* Overrides console methods with Consola logging methods for consistent logging.
|
|
3321
|
-
*/
|
|
3322
|
-
wrapConsole() {
|
|
3323
|
-
for (const type in this.options.types) {
|
|
3324
|
-
if (!console["__" + type]) {
|
|
3325
|
-
console["__" + type] = console[type];
|
|
3326
|
-
}
|
|
3327
|
-
console[type] = this[type].raw;
|
|
3328
|
-
}
|
|
3329
|
-
}
|
|
3330
|
-
/**
|
|
3331
|
-
* Restores the original console methods, removing Consola overrides.
|
|
3332
|
-
*/
|
|
3333
|
-
restoreConsole() {
|
|
3334
|
-
for (const type in this.options.types) {
|
|
3335
|
-
if (console["__" + type]) {
|
|
3336
|
-
console[type] = console["__" + type];
|
|
3337
|
-
delete console["__" + type];
|
|
3338
|
-
}
|
|
3339
|
-
}
|
|
3340
|
-
}
|
|
3341
|
-
/**
|
|
3342
|
-
* Overrides standard output and error streams to redirect them through Consola.
|
|
3343
|
-
*/
|
|
3344
|
-
wrapStd() {
|
|
3345
|
-
this._wrapStream(this.options.stdout, "log");
|
|
3346
|
-
this._wrapStream(this.options.stderr, "log");
|
|
3347
|
-
}
|
|
3348
|
-
_wrapStream(stream, type) {
|
|
3349
|
-
if (!stream) {
|
|
3350
|
-
return;
|
|
3351
|
-
}
|
|
3352
|
-
if (!stream.__write) {
|
|
3353
|
-
stream.__write = stream.write;
|
|
3354
|
-
}
|
|
3355
|
-
stream.write = (data) => {
|
|
3356
|
-
this[type].raw(String(data).trim());
|
|
3357
|
-
};
|
|
3358
|
-
}
|
|
3359
|
-
/**
|
|
3360
|
-
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
3361
|
-
*/
|
|
3362
|
-
restoreStd() {
|
|
3363
|
-
this._restoreStream(this.options.stdout);
|
|
3364
|
-
this._restoreStream(this.options.stderr);
|
|
3365
|
-
}
|
|
3366
|
-
_restoreStream(stream) {
|
|
3367
|
-
if (!stream) {
|
|
3368
|
-
return;
|
|
3369
|
-
}
|
|
3370
|
-
if (stream.__write) {
|
|
3371
|
-
stream.write = stream.__write;
|
|
3372
|
-
delete stream.__write;
|
|
3373
|
-
}
|
|
3374
|
-
}
|
|
3375
|
-
/**
|
|
3376
|
-
* Pauses logging, queues incoming logs until resumed.
|
|
3377
|
-
*/
|
|
3378
|
-
pauseLogs() {
|
|
3379
|
-
paused = true;
|
|
3380
|
-
}
|
|
3381
|
-
/**
|
|
3382
|
-
* Resumes logging, processing any queued logs.
|
|
3383
|
-
*/
|
|
3384
|
-
resumeLogs() {
|
|
3385
|
-
paused = false;
|
|
3386
|
-
const _queue = queue.splice(0);
|
|
3387
|
-
for (const item of _queue) {
|
|
3388
|
-
item[0]._logFn(item[1], item[2]);
|
|
3389
|
-
}
|
|
3390
|
-
}
|
|
3391
|
-
/**
|
|
3392
|
-
* Replaces logging methods with mocks if a mock function is provided.
|
|
3393
|
-
*
|
|
3394
|
-
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
3395
|
-
*/
|
|
3396
|
-
mockTypes(mockFn) {
|
|
3397
|
-
const _mockFn = mockFn || this.options.mockFn;
|
|
3398
|
-
this._mockFn = _mockFn;
|
|
3399
|
-
if (typeof _mockFn !== "function") {
|
|
3400
|
-
return;
|
|
3401
|
-
}
|
|
3402
|
-
for (const type in this.options.types) {
|
|
3403
|
-
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
3404
|
-
this[type].raw = this[type];
|
|
3405
|
-
}
|
|
3406
|
-
}
|
|
3407
|
-
_wrapLogFn(defaults, isRaw) {
|
|
3408
|
-
return (...args) => {
|
|
3409
|
-
if (paused) {
|
|
3410
|
-
queue.push([this, defaults, args, isRaw]);
|
|
3411
|
-
return;
|
|
3412
|
-
}
|
|
3413
|
-
return this._logFn(defaults, args, isRaw);
|
|
3414
|
-
};
|
|
3415
|
-
}
|
|
3416
|
-
_logFn(defaults, args, isRaw) {
|
|
3417
|
-
if ((defaults.level || 0) > this.level) {
|
|
3418
|
-
return false;
|
|
3419
|
-
}
|
|
3420
|
-
const logObj = {
|
|
3421
|
-
date: /* @__PURE__ */ new Date(),
|
|
3422
|
-
args: [],
|
|
3423
|
-
...defaults,
|
|
3424
|
-
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
3425
|
-
};
|
|
3426
|
-
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
3427
|
-
Object.assign(logObj, args[0]);
|
|
3428
|
-
} else {
|
|
3429
|
-
logObj.args = [...args];
|
|
3430
|
-
}
|
|
3431
|
-
if (logObj.message) {
|
|
3432
|
-
logObj.args.unshift(logObj.message);
|
|
3433
|
-
delete logObj.message;
|
|
3434
|
-
}
|
|
3435
|
-
if (logObj.additional) {
|
|
3436
|
-
if (!Array.isArray(logObj.additional)) {
|
|
3437
|
-
logObj.additional = logObj.additional.split("\n");
|
|
3438
|
-
}
|
|
3439
|
-
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
3440
|
-
delete logObj.additional;
|
|
3441
|
-
}
|
|
3442
|
-
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
3443
|
-
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
3444
|
-
const resolveLog = (newLog = false) => {
|
|
3445
|
-
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
3446
|
-
if (this._lastLog.object && repeated > 0) {
|
|
3447
|
-
const args2 = [...this._lastLog.object.args];
|
|
3448
|
-
if (repeated > 1) {
|
|
3449
|
-
args2.push(`(repeated ${repeated} times)`);
|
|
3450
|
-
}
|
|
3451
|
-
this._log({ ...this._lastLog.object, args: args2 });
|
|
3452
|
-
this._lastLog.count = 1;
|
|
3453
|
-
}
|
|
3454
|
-
if (newLog) {
|
|
3455
|
-
this._lastLog.object = logObj;
|
|
3456
|
-
this._log(logObj);
|
|
3457
|
-
}
|
|
3458
|
-
};
|
|
3459
|
-
clearTimeout(this._lastLog.timeout);
|
|
3460
|
-
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
3461
|
-
this._lastLog.time = logObj.date;
|
|
3462
|
-
if (diffTime < this.options.throttle) {
|
|
3463
|
-
try {
|
|
3464
|
-
const serializedLog = JSON.stringify([
|
|
3465
|
-
logObj.type,
|
|
3466
|
-
logObj.tag,
|
|
3467
|
-
logObj.args
|
|
3468
|
-
]);
|
|
3469
|
-
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
3470
|
-
this._lastLog.serialized = serializedLog;
|
|
3471
|
-
if (isSameLog) {
|
|
3472
|
-
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
3473
|
-
if (this._lastLog.count > this.options.throttleMin) {
|
|
3474
|
-
this._lastLog.timeout = setTimeout(
|
|
3475
|
-
resolveLog,
|
|
3476
|
-
this.options.throttle
|
|
3477
|
-
);
|
|
3478
|
-
return;
|
|
3479
|
-
}
|
|
3480
|
-
}
|
|
3481
|
-
} catch {
|
|
3482
|
-
}
|
|
3483
|
-
}
|
|
3484
|
-
resolveLog(true);
|
|
3485
|
-
}
|
|
3486
|
-
_log(logObj) {
|
|
3487
|
-
for (const reporter of this.options.reporters) {
|
|
3488
|
-
reporter.log(logObj, {
|
|
3489
|
-
options: this.options
|
|
3490
|
-
});
|
|
3491
|
-
}
|
|
3492
|
-
}
|
|
3493
|
-
};
|
|
3494
|
-
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
3495
|
-
if (input === void 0) {
|
|
3496
|
-
return defaultLevel;
|
|
3497
|
-
}
|
|
3498
|
-
if (typeof input === "number") {
|
|
3499
|
-
return input;
|
|
3500
|
-
}
|
|
3501
|
-
if (types[input] && types[input].level !== void 0) {
|
|
3502
|
-
return types[input].level;
|
|
3503
|
-
}
|
|
3504
|
-
return defaultLevel;
|
|
3505
|
-
}
|
|
3506
|
-
Consola.prototype.add = Consola.prototype.addReporter;
|
|
3507
|
-
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
3508
|
-
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
3509
|
-
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
3510
|
-
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
3511
|
-
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
3512
|
-
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
3513
|
-
function createConsola(options = {}) {
|
|
3514
|
-
return new Consola(options);
|
|
3515
|
-
}
|
|
3516
|
-
|
|
3517
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
|
|
3518
|
-
import { formatWithOptions } from "util";
|
|
3519
|
-
import { sep } from "path";
|
|
3520
|
-
function parseStack(stack, message) {
|
|
3521
|
-
const cwd = process.cwd() + sep;
|
|
3522
|
-
const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
3523
|
-
return lines;
|
|
3524
|
-
}
|
|
3525
|
-
function writeStream(data, stream) {
|
|
3526
|
-
const write = stream.__write || stream.write;
|
|
3527
|
-
return write.call(stream, data);
|
|
3528
|
-
}
|
|
3529
|
-
var bracket = (x) => x ? `[${x}]` : "";
|
|
3530
|
-
var BasicReporter = class {
|
|
3531
|
-
formatStack(stack, message, opts) {
|
|
3532
|
-
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
3533
|
-
return indent + parseStack(stack, message).join(`
|
|
3534
|
-
${indent}`);
|
|
3535
|
-
}
|
|
3536
|
-
formatError(err, opts) {
|
|
3537
|
-
const message = err.message ?? formatWithOptions(opts, err);
|
|
3538
|
-
const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
|
|
3539
|
-
const level = opts?.errorLevel || 0;
|
|
3540
|
-
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
|
|
3541
|
-
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
|
|
3542
|
-
return causedPrefix + message + "\n" + stack + causedError;
|
|
3543
|
-
}
|
|
3544
|
-
formatArgs(args, opts) {
|
|
3545
|
-
const _args = args.map((arg) => {
|
|
3546
|
-
if (arg && typeof arg.stack === "string") {
|
|
3547
|
-
return this.formatError(arg, opts);
|
|
3548
|
-
}
|
|
3549
|
-
return arg;
|
|
3550
|
-
});
|
|
3551
|
-
return formatWithOptions(opts, ..._args);
|
|
3552
|
-
}
|
|
3553
|
-
formatDate(date, opts) {
|
|
3554
|
-
return opts.date ? date.toLocaleTimeString() : "";
|
|
3555
|
-
}
|
|
3556
|
-
filterAndJoin(arr) {
|
|
3557
|
-
return arr.filter(Boolean).join(" ");
|
|
3558
|
-
}
|
|
3559
|
-
formatLogObj(logObj, opts) {
|
|
3560
|
-
const message = this.formatArgs(logObj.args, opts);
|
|
3561
|
-
if (logObj.type === "box") {
|
|
3562
|
-
return "\n" + [
|
|
3563
|
-
bracket(logObj.tag),
|
|
3564
|
-
logObj.title && logObj.title,
|
|
3565
|
-
...message.split("\n")
|
|
3566
|
-
].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
|
|
3567
|
-
}
|
|
3568
|
-
return this.filterAndJoin([
|
|
3569
|
-
bracket(logObj.type),
|
|
3570
|
-
bracket(logObj.tag),
|
|
3571
|
-
message
|
|
3572
|
-
]);
|
|
3573
|
-
}
|
|
3574
|
-
log(logObj, ctx) {
|
|
3575
|
-
const line = this.formatLogObj(logObj, {
|
|
3576
|
-
columns: ctx.options.stdout.columns || 0,
|
|
3577
|
-
...ctx.options.formatOptions
|
|
3578
|
-
});
|
|
3579
|
-
return writeStream(
|
|
3580
|
-
line + "\n",
|
|
3581
|
-
logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
|
|
3582
|
-
);
|
|
3583
|
-
}
|
|
3584
|
-
};
|
|
3585
|
-
|
|
3586
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
|
|
3587
|
-
import g$1 from "process";
|
|
3588
|
-
|
|
3589
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
|
|
3590
|
-
import * as tty from "tty";
|
|
3591
|
-
var {
|
|
3592
|
-
env = {},
|
|
3593
|
-
argv = [],
|
|
3594
|
-
platform = ""
|
|
3595
|
-
} = typeof process === "undefined" ? {} : process;
|
|
3596
|
-
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
3597
|
-
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
3598
|
-
var isWindows = platform === "win32";
|
|
3599
|
-
var isDumbTerminal = env.TERM === "dumb";
|
|
3600
|
-
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
3601
|
-
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
3602
|
-
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
3603
|
-
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
3604
|
-
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
3605
|
-
}
|
|
3606
|
-
function clearBleed(index, string, open, close, replace) {
|
|
3607
|
-
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
3608
|
-
}
|
|
3609
|
-
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
3610
|
-
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
3611
|
-
("" + string).indexOf(close, at),
|
|
3612
|
-
string,
|
|
3613
|
-
open,
|
|
3614
|
-
close,
|
|
3615
|
-
replace
|
|
3616
|
-
) : "";
|
|
3617
|
-
}
|
|
3618
|
-
function init(open, close, replace) {
|
|
3619
|
-
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
3620
|
-
}
|
|
3621
|
-
var colorDefs = {
|
|
3622
|
-
reset: init(0, 0),
|
|
3623
|
-
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
3624
|
-
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
3625
|
-
italic: init(3, 23),
|
|
3626
|
-
underline: init(4, 24),
|
|
3627
|
-
inverse: init(7, 27),
|
|
3628
|
-
hidden: init(8, 28),
|
|
3629
|
-
strikethrough: init(9, 29),
|
|
3630
|
-
black: init(30, 39),
|
|
3631
|
-
red: init(31, 39),
|
|
3632
|
-
green: init(32, 39),
|
|
3633
|
-
yellow: init(33, 39),
|
|
3634
|
-
blue: init(34, 39),
|
|
3635
|
-
magenta: init(35, 39),
|
|
3636
|
-
cyan: init(36, 39),
|
|
3637
|
-
white: init(37, 39),
|
|
3638
|
-
gray: init(90, 39),
|
|
3639
|
-
bgBlack: init(40, 49),
|
|
3640
|
-
bgRed: init(41, 49),
|
|
3641
|
-
bgGreen: init(42, 49),
|
|
3642
|
-
bgYellow: init(43, 49),
|
|
3643
|
-
bgBlue: init(44, 49),
|
|
3644
|
-
bgMagenta: init(45, 49),
|
|
3645
|
-
bgCyan: init(46, 49),
|
|
3646
|
-
bgWhite: init(47, 49),
|
|
3647
|
-
blackBright: init(90, 39),
|
|
3648
|
-
redBright: init(91, 39),
|
|
3649
|
-
greenBright: init(92, 39),
|
|
3650
|
-
yellowBright: init(93, 39),
|
|
3651
|
-
blueBright: init(94, 39),
|
|
3652
|
-
magentaBright: init(95, 39),
|
|
3653
|
-
cyanBright: init(96, 39),
|
|
3654
|
-
whiteBright: init(97, 39),
|
|
3655
|
-
bgBlackBright: init(100, 49),
|
|
3656
|
-
bgRedBright: init(101, 49),
|
|
3657
|
-
bgGreenBright: init(102, 49),
|
|
3658
|
-
bgYellowBright: init(103, 49),
|
|
3659
|
-
bgBlueBright: init(104, 49),
|
|
3660
|
-
bgMagentaBright: init(105, 49),
|
|
3661
|
-
bgCyanBright: init(106, 49),
|
|
3662
|
-
bgWhiteBright: init(107, 49)
|
|
3663
|
-
};
|
|
3664
|
-
function createColors(useColor = isColorSupported) {
|
|
3665
|
-
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
3666
|
-
}
|
|
3667
|
-
var colors = createColors();
|
|
3668
|
-
function getColor(color, fallback = "reset") {
|
|
3669
|
-
return colors[color] || colors[fallback];
|
|
3670
|
-
}
|
|
3671
|
-
var ansiRegex2 = [
|
|
3672
|
-
String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
|
|
3673
|
-
String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
|
|
3674
|
-
].join("|");
|
|
3675
|
-
function stripAnsi2(text) {
|
|
3676
|
-
return text.replace(new RegExp(ansiRegex2, "g"), "");
|
|
3677
|
-
}
|
|
3678
|
-
var boxStylePresets = {
|
|
3679
|
-
solid: {
|
|
3680
|
-
tl: "\u250C",
|
|
3681
|
-
tr: "\u2510",
|
|
3682
|
-
bl: "\u2514",
|
|
3683
|
-
br: "\u2518",
|
|
3684
|
-
h: "\u2500",
|
|
3685
|
-
v: "\u2502"
|
|
3686
|
-
},
|
|
3687
|
-
double: {
|
|
3688
|
-
tl: "\u2554",
|
|
3689
|
-
tr: "\u2557",
|
|
3690
|
-
bl: "\u255A",
|
|
3691
|
-
br: "\u255D",
|
|
3692
|
-
h: "\u2550",
|
|
3693
|
-
v: "\u2551"
|
|
3694
|
-
},
|
|
3695
|
-
doubleSingle: {
|
|
3696
|
-
tl: "\u2553",
|
|
3697
|
-
tr: "\u2556",
|
|
3698
|
-
bl: "\u2559",
|
|
3699
|
-
br: "\u255C",
|
|
3700
|
-
h: "\u2500",
|
|
3701
|
-
v: "\u2551"
|
|
3702
|
-
},
|
|
3703
|
-
doubleSingleRounded: {
|
|
3704
|
-
tl: "\u256D",
|
|
3705
|
-
tr: "\u256E",
|
|
3706
|
-
bl: "\u2570",
|
|
3707
|
-
br: "\u256F",
|
|
3708
|
-
h: "\u2500",
|
|
3709
|
-
v: "\u2551"
|
|
3710
|
-
},
|
|
3711
|
-
singleThick: {
|
|
3712
|
-
tl: "\u250F",
|
|
3713
|
-
tr: "\u2513",
|
|
3714
|
-
bl: "\u2517",
|
|
3715
|
-
br: "\u251B",
|
|
3716
|
-
h: "\u2501",
|
|
3717
|
-
v: "\u2503"
|
|
3718
|
-
},
|
|
3719
|
-
singleDouble: {
|
|
3720
|
-
tl: "\u2552",
|
|
3721
|
-
tr: "\u2555",
|
|
3722
|
-
bl: "\u2558",
|
|
3723
|
-
br: "\u255B",
|
|
3724
|
-
h: "\u2550",
|
|
3725
|
-
v: "\u2502"
|
|
3726
|
-
},
|
|
3727
|
-
singleDoubleRounded: {
|
|
3728
|
-
tl: "\u256D",
|
|
3729
|
-
tr: "\u256E",
|
|
3730
|
-
bl: "\u2570",
|
|
3731
|
-
br: "\u256F",
|
|
3732
|
-
h: "\u2550",
|
|
3733
|
-
v: "\u2502"
|
|
3734
|
-
},
|
|
3735
|
-
rounded: {
|
|
3736
|
-
tl: "\u256D",
|
|
3737
|
-
tr: "\u256E",
|
|
3738
|
-
bl: "\u2570",
|
|
3739
|
-
br: "\u256F",
|
|
3740
|
-
h: "\u2500",
|
|
3741
|
-
v: "\u2502"
|
|
3742
|
-
}
|
|
3743
|
-
};
|
|
3744
|
-
var defaultStyle = {
|
|
3745
|
-
borderColor: "white",
|
|
3746
|
-
borderStyle: "rounded",
|
|
3747
|
-
valign: "center",
|
|
3748
|
-
padding: 2,
|
|
3749
|
-
marginLeft: 1,
|
|
3750
|
-
marginTop: 1,
|
|
3751
|
-
marginBottom: 1
|
|
3752
|
-
};
|
|
3753
|
-
function box(text, _opts = {}) {
|
|
3754
|
-
const opts = {
|
|
3755
|
-
..._opts,
|
|
3756
|
-
style: {
|
|
3757
|
-
...defaultStyle,
|
|
3758
|
-
..._opts.style
|
|
3759
|
-
}
|
|
3760
|
-
};
|
|
3761
|
-
const textLines = text.split("\n");
|
|
3762
|
-
const boxLines = [];
|
|
3763
|
-
const _color = getColor(opts.style.borderColor);
|
|
3764
|
-
const borderStyle = {
|
|
3765
|
-
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
3766
|
-
};
|
|
3767
|
-
if (_color) {
|
|
3768
|
-
for (const key in borderStyle) {
|
|
3769
|
-
borderStyle[key] = _color(
|
|
3770
|
-
borderStyle[key]
|
|
3771
|
-
);
|
|
3772
|
-
}
|
|
3773
|
-
}
|
|
3774
|
-
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
3775
|
-
const height2 = textLines.length + paddingOffset;
|
|
3776
|
-
const width = Math.max(
|
|
3777
|
-
...textLines.map((line) => stripAnsi2(line).length),
|
|
3778
|
-
opts.title ? stripAnsi2(opts.title).length : 0
|
|
3779
|
-
) + paddingOffset;
|
|
3780
|
-
const widthOffset = width + paddingOffset;
|
|
3781
|
-
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
3782
|
-
if (opts.style.marginTop > 0) {
|
|
3783
|
-
boxLines.push("".repeat(opts.style.marginTop));
|
|
3784
|
-
}
|
|
3785
|
-
if (opts.title) {
|
|
3786
|
-
const title = _color ? _color(opts.title) : opts.title;
|
|
3787
|
-
const left = borderStyle.h.repeat(
|
|
3788
|
-
Math.floor((width - stripAnsi2(opts.title).length) / 2)
|
|
3789
|
-
);
|
|
3790
|
-
const right = borderStyle.h.repeat(
|
|
3791
|
-
width - stripAnsi2(opts.title).length - stripAnsi2(left).length + paddingOffset
|
|
3792
|
-
);
|
|
3793
|
-
boxLines.push(
|
|
3794
|
-
`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
|
|
3795
|
-
);
|
|
3796
|
-
} else {
|
|
3797
|
-
boxLines.push(
|
|
3798
|
-
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
|
|
3799
|
-
);
|
|
3800
|
-
}
|
|
3801
|
-
const valignOffset = opts.style.valign === "center" ? Math.floor((height2 - textLines.length) / 2) : opts.style.valign === "top" ? height2 - textLines.length - paddingOffset : height2 - textLines.length;
|
|
3802
|
-
for (let i2 = 0; i2 < height2; i2++) {
|
|
3803
|
-
if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
|
|
3804
|
-
boxLines.push(
|
|
3805
|
-
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
|
|
3806
|
-
);
|
|
3807
|
-
} else {
|
|
3808
|
-
const line = textLines[i2 - valignOffset];
|
|
3809
|
-
const left = " ".repeat(paddingOffset);
|
|
3810
|
-
const right = " ".repeat(width - stripAnsi2(line).length);
|
|
3811
|
-
boxLines.push(
|
|
3812
|
-
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
|
|
3813
|
-
);
|
|
3814
|
-
}
|
|
3815
|
-
}
|
|
3816
|
-
boxLines.push(
|
|
3817
|
-
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
|
|
3818
|
-
);
|
|
3819
|
-
if (opts.style.marginBottom > 0) {
|
|
3820
|
-
boxLines.push("".repeat(opts.style.marginBottom));
|
|
3821
|
-
}
|
|
3822
|
-
return boxLines.join("\n");
|
|
3823
|
-
}
|
|
3824
|
-
|
|
3825
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
|
|
3826
|
-
import "util";
|
|
3827
|
-
import "path";
|
|
3828
|
-
import "tty";
|
|
3829
|
-
var r = /* @__PURE__ */ Object.create(null);
|
|
3830
|
-
var i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
|
|
3831
|
-
var o = new Proxy(r, { get(e, s2) {
|
|
3832
|
-
return i()[s2] ?? r[s2];
|
|
3833
|
-
}, has(e, s2) {
|
|
3834
|
-
const E = i();
|
|
3835
|
-
return s2 in E || s2 in r;
|
|
3836
|
-
}, set(e, s2, E) {
|
|
3837
|
-
const B = i(true);
|
|
3838
|
-
return B[s2] = E, true;
|
|
3839
|
-
}, deleteProperty(e, s2) {
|
|
3840
|
-
if (!s2) return false;
|
|
3841
|
-
const E = i(true);
|
|
3842
|
-
return delete E[s2], true;
|
|
3843
|
-
}, ownKeys() {
|
|
3844
|
-
const e = i(true);
|
|
3845
|
-
return Object.keys(e);
|
|
3846
|
-
} });
|
|
3847
|
-
var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
|
|
3848
|
-
var f = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["CODESANDBOX", "CODESANDBOX_HOST", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
|
|
3849
|
-
function b() {
|
|
3850
|
-
if (globalThis.process?.env) for (const e of f) {
|
|
3851
|
-
const s2 = e[1] || e[0];
|
|
3852
|
-
if (globalThis.process?.env[s2]) return { name: e[0].toLowerCase(), ...e[2] };
|
|
3853
|
-
}
|
|
3854
|
-
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
|
|
3855
|
-
}
|
|
3856
|
-
var l = b();
|
|
3857
|
-
l.name;
|
|
3858
|
-
function n(e) {
|
|
3859
|
-
return e ? e !== "false" : false;
|
|
3860
|
-
}
|
|
3861
|
-
var I = globalThis.process?.platform || "";
|
|
3862
|
-
var T = n(o.CI) || l.ci !== false;
|
|
3863
|
-
var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
|
|
3864
|
-
var g = n(o.DEBUG);
|
|
3865
|
-
var R = t === "test" || n(o.TEST);
|
|
3866
|
-
n(o.MINIMAL) || T || R || !a;
|
|
3867
|
-
var A = /^win/i.test(I);
|
|
3868
|
-
!n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM !== "dumb" || T);
|
|
3869
|
-
var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
3870
|
-
Number(C?.split(".")[0]) || null;
|
|
3871
|
-
var y = globalThis.process || /* @__PURE__ */ Object.create(null);
|
|
3872
|
-
var _ = { versions: {} };
|
|
3873
|
-
new Proxy(y, { get(e, s2) {
|
|
3874
|
-
if (s2 === "env") return o;
|
|
3875
|
-
if (s2 in e) return e[s2];
|
|
3876
|
-
if (s2 in _) return _[s2];
|
|
3877
|
-
} });
|
|
3878
|
-
var c = globalThis.process?.release?.name === "node";
|
|
3879
|
-
var O = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
|
|
3880
|
-
var D = !!globalThis.Deno;
|
|
3881
|
-
var L = !!globalThis.fastly;
|
|
3882
|
-
var S = !!globalThis.Netlify;
|
|
3883
|
-
var u = !!globalThis.EdgeRuntime;
|
|
3884
|
-
var N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
|
|
3885
|
-
var F = [[S, "netlify"], [u, "edge-light"], [N, "workerd"], [L, "fastly"], [D, "deno"], [O, "bun"], [c, "node"]];
|
|
3886
|
-
function G() {
|
|
3887
|
-
const e = F.find((s2) => s2[0]);
|
|
3888
|
-
if (e) return { name: e[1] };
|
|
3889
|
-
}
|
|
3890
|
-
var P = G();
|
|
3891
|
-
P?.name || "";
|
|
3892
|
-
function ansiRegex3({ onlyFirst = false } = {}) {
|
|
3893
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
3894
|
-
const pattern = [
|
|
3895
|
-
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
3896
|
-
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
3897
|
-
].join("|");
|
|
3898
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
3899
|
-
}
|
|
3900
|
-
var regex2 = ansiRegex3();
|
|
3901
|
-
function stripAnsi3(string) {
|
|
3902
|
-
if (typeof string !== "string") {
|
|
3903
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
3904
|
-
}
|
|
3905
|
-
return string.replace(regex2, "");
|
|
3906
|
-
}
|
|
3907
|
-
function isAmbiguous2(x) {
|
|
3908
|
-
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
3909
|
-
}
|
|
3910
|
-
function isFullWidth2(x) {
|
|
3911
|
-
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
3912
|
-
}
|
|
3913
|
-
function isWide2(x) {
|
|
3914
|
-
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
3915
|
-
}
|
|
3916
|
-
function validate2(codePoint) {
|
|
3917
|
-
if (!Number.isSafeInteger(codePoint)) {
|
|
3918
|
-
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
3919
|
-
}
|
|
3920
|
-
}
|
|
3921
|
-
function eastAsianWidth2(codePoint, { ambiguousAsWide = false } = {}) {
|
|
3922
|
-
validate2(codePoint);
|
|
3923
|
-
if (isFullWidth2(codePoint) || isWide2(codePoint) || ambiguousAsWide && isAmbiguous2(codePoint)) {
|
|
3924
|
-
return 2;
|
|
3925
|
-
}
|
|
3926
|
-
return 1;
|
|
3927
|
-
}
|
|
3928
|
-
var emojiRegex = () => {
|
|
3929
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
3930
|
-
};
|
|
3931
|
-
var segmenter2 = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
|
|
3932
|
-
var defaultIgnorableCodePointRegex2 = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
3933
|
-
function stringWidth$1(string, options = {}) {
|
|
3934
|
-
if (typeof string !== "string" || string.length === 0) {
|
|
3935
|
-
return 0;
|
|
3936
|
-
}
|
|
3937
|
-
const {
|
|
3938
|
-
ambiguousIsNarrow = true,
|
|
3939
|
-
countAnsiEscapeCodes = false
|
|
3940
|
-
} = options;
|
|
3941
|
-
if (!countAnsiEscapeCodes) {
|
|
3942
|
-
string = stripAnsi3(string);
|
|
3943
|
-
}
|
|
3944
|
-
if (string.length === 0) {
|
|
3945
|
-
return 0;
|
|
3946
|
-
}
|
|
3947
|
-
let width = 0;
|
|
3948
|
-
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
3949
|
-
for (const { segment: character } of segmenter2.segment(string)) {
|
|
3950
|
-
const codePoint = character.codePointAt(0);
|
|
3951
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
3952
|
-
continue;
|
|
3953
|
-
}
|
|
3954
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
3955
|
-
continue;
|
|
3956
|
-
}
|
|
3957
|
-
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
3958
|
-
continue;
|
|
3959
|
-
}
|
|
3960
|
-
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
3961
|
-
continue;
|
|
3962
|
-
}
|
|
3963
|
-
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
3964
|
-
continue;
|
|
3965
|
-
}
|
|
3966
|
-
if (defaultIgnorableCodePointRegex2.test(character)) {
|
|
3967
|
-
continue;
|
|
3968
|
-
}
|
|
3969
|
-
if (emojiRegex().test(character)) {
|
|
3970
|
-
width += 2;
|
|
3971
|
-
continue;
|
|
3972
|
-
}
|
|
3973
|
-
width += eastAsianWidth2(codePoint, eastAsianWidthOptions);
|
|
3974
|
-
}
|
|
3975
|
-
return width;
|
|
3976
|
-
}
|
|
3977
|
-
function isUnicodeSupported2() {
|
|
3978
|
-
const { env: env3 } = g$1;
|
|
3979
|
-
const { TERM, TERM_PROGRAM } = env3;
|
|
3980
|
-
if (g$1.platform !== "win32") {
|
|
3981
|
-
return TERM !== "linux";
|
|
3982
|
-
}
|
|
3983
|
-
return Boolean(env3.WT_SESSION) || Boolean(env3.TERMINUS_SUBLIME) || env3.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env3.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
3984
|
-
}
|
|
3985
|
-
var TYPE_COLOR_MAP = {
|
|
3986
|
-
info: "cyan",
|
|
3987
|
-
fail: "red",
|
|
3988
|
-
success: "green",
|
|
3989
|
-
ready: "green",
|
|
3990
|
-
start: "magenta"
|
|
3991
|
-
};
|
|
3992
|
-
var LEVEL_COLOR_MAP = {
|
|
3993
|
-
0: "red",
|
|
3994
|
-
1: "yellow"
|
|
3995
|
-
};
|
|
3996
|
-
var unicode = isUnicodeSupported2();
|
|
3997
|
-
var s = (c2, fallback) => unicode ? c2 : fallback;
|
|
3998
|
-
var TYPE_ICONS = {
|
|
3999
|
-
error: s("\u2716", "\xD7"),
|
|
4000
|
-
fatal: s("\u2716", "\xD7"),
|
|
4001
|
-
ready: s("\u2714", "\u221A"),
|
|
4002
|
-
warn: s("\u26A0", "\u203C"),
|
|
4003
|
-
info: s("\u2139", "i"),
|
|
4004
|
-
success: s("\u2714", "\u221A"),
|
|
4005
|
-
debug: s("\u2699", "D"),
|
|
4006
|
-
trace: s("\u2192", "\u2192"),
|
|
4007
|
-
fail: s("\u2716", "\xD7"),
|
|
4008
|
-
start: s("\u25D0", "o"),
|
|
4009
|
-
log: ""
|
|
4010
|
-
};
|
|
4011
|
-
function stringWidth2(str) {
|
|
4012
|
-
const hasICU = typeof Intl === "object";
|
|
4013
|
-
if (!hasICU || !Intl.Segmenter) {
|
|
4014
|
-
return stripAnsi2(str).length;
|
|
4015
|
-
}
|
|
4016
|
-
return stringWidth$1(str);
|
|
4017
|
-
}
|
|
4018
|
-
var FancyReporter = class extends BasicReporter {
|
|
4019
|
-
formatStack(stack, message, opts) {
|
|
4020
|
-
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
4021
|
-
return `
|
|
4022
|
-
${indent}` + parseStack(stack, message).map(
|
|
4023
|
-
(line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)
|
|
4024
|
-
).join(`
|
|
4025
|
-
${indent}`);
|
|
4026
|
-
}
|
|
4027
|
-
formatType(logObj, isBadge, opts) {
|
|
4028
|
-
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
4029
|
-
if (isBadge) {
|
|
4030
|
-
return getBgColor(typeColor)(
|
|
4031
|
-
colors.black(` ${logObj.type.toUpperCase()} `)
|
|
4032
|
-
);
|
|
4033
|
-
}
|
|
4034
|
-
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
4035
|
-
return _type ? getColor2(typeColor)(_type) : "";
|
|
4036
|
-
}
|
|
4037
|
-
formatLogObj(logObj, opts) {
|
|
4038
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
4039
|
-
"\n"
|
|
4040
|
-
);
|
|
4041
|
-
if (logObj.type === "box") {
|
|
4042
|
-
return box(
|
|
4043
|
-
characterFormat(
|
|
4044
|
-
message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
|
|
4045
|
-
),
|
|
4046
|
-
{
|
|
4047
|
-
title: logObj.title ? characterFormat(logObj.title) : void 0,
|
|
4048
|
-
style: logObj.style
|
|
4049
|
-
}
|
|
4050
|
-
);
|
|
4051
|
-
}
|
|
4052
|
-
const date = this.formatDate(logObj.date, opts);
|
|
4053
|
-
const coloredDate = date && colors.gray(date);
|
|
4054
|
-
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
4055
|
-
const type = this.formatType(logObj, isBadge, opts);
|
|
4056
|
-
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
4057
|
-
let line;
|
|
4058
|
-
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
4059
|
-
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
4060
|
-
const space = (opts.columns || 0) - stringWidth2(left) - stringWidth2(right) - 2;
|
|
4061
|
-
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
4062
|
-
line += characterFormat(
|
|
4063
|
-
additional.length > 0 ? "\n" + additional.join("\n") : ""
|
|
4064
|
-
);
|
|
4065
|
-
if (logObj.type === "trace") {
|
|
4066
|
-
const _err = new Error("Trace: " + logObj.message);
|
|
4067
|
-
line += this.formatStack(_err.stack || "", _err.message);
|
|
4068
|
-
}
|
|
4069
|
-
return isBadge ? "\n" + line + "\n" : line;
|
|
4070
|
-
}
|
|
4071
|
-
};
|
|
4072
|
-
function characterFormat(str) {
|
|
4073
|
-
return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
|
|
4074
|
-
}
|
|
4075
|
-
function getColor2(color = "white") {
|
|
4076
|
-
return colors[color] || colors.white;
|
|
4077
|
-
}
|
|
4078
|
-
function getBgColor(color = "bgWhite") {
|
|
4079
|
-
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
4080
|
-
}
|
|
4081
|
-
function createConsola2(options = {}) {
|
|
4082
|
-
let level = _getDefaultLogLevel();
|
|
4083
|
-
if (process.env.CONSOLA_LEVEL) {
|
|
4084
|
-
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
4085
|
-
}
|
|
4086
|
-
const consola2 = createConsola({
|
|
4087
|
-
level,
|
|
4088
|
-
defaults: { level },
|
|
4089
|
-
stdout: process.stdout,
|
|
4090
|
-
stderr: process.stderr,
|
|
4091
|
-
prompt: (...args) => import("./prompt-424IOCOV.js").then((m) => m.prompt(...args)),
|
|
4092
|
-
reporters: options.reporters || [
|
|
4093
|
-
options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
|
|
4094
|
-
],
|
|
4095
|
-
...options
|
|
4096
|
-
});
|
|
4097
|
-
return consola2;
|
|
4098
|
-
}
|
|
4099
|
-
function _getDefaultLogLevel() {
|
|
4100
|
-
if (g) {
|
|
4101
|
-
return LogLevels.debug;
|
|
4102
|
-
}
|
|
4103
|
-
if (R) {
|
|
4104
|
-
return LogLevels.warn;
|
|
4105
|
-
}
|
|
4106
|
-
return LogLevels.info;
|
|
4107
|
-
}
|
|
4108
|
-
var consola = createConsola2();
|
|
4109
|
-
|
|
4110
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/utils.mjs
|
|
4111
|
-
import "tty";
|
|
4112
|
-
|
|
4113
|
-
// ../../node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs
|
|
4114
|
-
function toArray(val) {
|
|
4115
|
-
if (Array.isArray(val)) {
|
|
4116
|
-
return val;
|
|
4117
|
-
}
|
|
4118
|
-
return val === void 0 ? [] : [val];
|
|
4119
|
-
}
|
|
4120
|
-
function formatLineColumns(lines, linePrefix = "") {
|
|
4121
|
-
const maxLengh = [];
|
|
4122
|
-
for (const line of lines) {
|
|
4123
|
-
for (const [i2, element] of line.entries()) {
|
|
4124
|
-
maxLengh[i2] = Math.max(maxLengh[i2] || 0, element.length);
|
|
4125
|
-
}
|
|
4126
|
-
}
|
|
4127
|
-
return lines.map(
|
|
4128
|
-
(l2) => l2.map(
|
|
4129
|
-
(c2, i2) => linePrefix + c2[i2 === 0 ? "padStart" : "padEnd"](maxLengh[i2])
|
|
4130
|
-
).join(" ")
|
|
4131
|
-
).join("\n");
|
|
4132
|
-
}
|
|
4133
|
-
function resolveValue(input) {
|
|
4134
|
-
return typeof input === "function" ? input() : input;
|
|
4135
|
-
}
|
|
4136
|
-
var CLIError = class extends Error {
|
|
4137
|
-
constructor(message, code) {
|
|
4138
|
-
super(message);
|
|
4139
|
-
this.code = code;
|
|
4140
|
-
this.name = "CLIError";
|
|
4141
|
-
}
|
|
4142
|
-
};
|
|
3009
|
+
// ../../node_modules/.pnpm/citty@0.2.0/node_modules/citty/dist/_chunks/libs/scule.mjs
|
|
4143
3010
|
var NUMBER_CHAR_RE = /\d/;
|
|
4144
|
-
var STR_SPLITTERS = [
|
|
3011
|
+
var STR_SPLITTERS = [
|
|
3012
|
+
"-",
|
|
3013
|
+
"_",
|
|
3014
|
+
"/",
|
|
3015
|
+
"."
|
|
3016
|
+
];
|
|
4145
3017
|
function isUppercase(char = "") {
|
|
4146
|
-
if (NUMBER_CHAR_RE.test(char))
|
|
4147
|
-
return void 0;
|
|
4148
|
-
}
|
|
3018
|
+
if (NUMBER_CHAR_RE.test(char)) return;
|
|
4149
3019
|
return char !== char.toLowerCase();
|
|
4150
3020
|
}
|
|
4151
3021
|
function splitByCase(str, separators) {
|
|
4152
3022
|
const splitters = separators ?? STR_SPLITTERS;
|
|
4153
3023
|
const parts = [];
|
|
4154
|
-
if (!str || typeof str !== "string")
|
|
4155
|
-
return parts;
|
|
4156
|
-
}
|
|
3024
|
+
if (!str || typeof str !== "string") return parts;
|
|
4157
3025
|
let buff = "";
|
|
4158
3026
|
let previousUpper;
|
|
4159
3027
|
let previousSplitter;
|
|
@@ -4203,179 +3071,161 @@ function camelCase(str, opts) {
|
|
|
4203
3071
|
function kebabCase(str, joiner) {
|
|
4204
3072
|
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
|
|
4205
3073
|
}
|
|
4206
|
-
|
|
4207
|
-
|
|
3074
|
+
|
|
3075
|
+
// ../../node_modules/.pnpm/citty@0.2.0/node_modules/citty/dist/index.mjs
|
|
3076
|
+
import { parseArgs as parseArgs$1 } from "util";
|
|
3077
|
+
function toArray(val) {
|
|
3078
|
+
if (Array.isArray(val)) return val;
|
|
3079
|
+
return val === void 0 ? [] : [val];
|
|
4208
3080
|
}
|
|
4209
|
-
function
|
|
4210
|
-
|
|
4211
|
-
const
|
|
4212
|
-
|
|
4213
|
-
out[key] = old == void 0 ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
3081
|
+
function formatLineColumns(lines, linePrefix = "") {
|
|
3082
|
+
const maxLength = [];
|
|
3083
|
+
for (const line of lines) for (const [i, element] of line.entries()) maxLength[i] = Math.max(maxLength[i] || 0, element.length);
|
|
3084
|
+
return lines.map((l) => l.map((c, i) => linePrefix + c[i === 0 ? "padStart" : "padEnd"](maxLength[i])).join(" ")).join("\n");
|
|
4214
3085
|
}
|
|
4215
|
-
function
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
let idx = 0;
|
|
4225
|
-
const len = args.length;
|
|
4226
|
-
const alibi = opts.alias !== void 0;
|
|
4227
|
-
const strict = opts.unknown !== void 0;
|
|
4228
|
-
const defaults = opts.default !== void 0;
|
|
4229
|
-
opts.alias = opts.alias || {};
|
|
4230
|
-
opts.string = toArr(opts.string);
|
|
4231
|
-
opts.boolean = toArr(opts.boolean);
|
|
4232
|
-
if (alibi) {
|
|
4233
|
-
for (k in opts.alias) {
|
|
4234
|
-
arr = opts.alias[k] = toArr(opts.alias[k]);
|
|
4235
|
-
for (i2 = 0; i2 < arr.length; i2++) {
|
|
4236
|
-
(opts.alias[arr[i2]] = arr.concat(k)).splice(i2, 1);
|
|
4237
|
-
}
|
|
4238
|
-
}
|
|
4239
|
-
}
|
|
4240
|
-
for (i2 = opts.boolean.length; i2-- > 0; ) {
|
|
4241
|
-
arr = opts.alias[opts.boolean[i2]] || [];
|
|
4242
|
-
for (j = arr.length; j-- > 0; ) {
|
|
4243
|
-
opts.boolean.push(arr[j]);
|
|
4244
|
-
}
|
|
4245
|
-
}
|
|
4246
|
-
for (i2 = opts.string.length; i2-- > 0; ) {
|
|
4247
|
-
arr = opts.alias[opts.string[i2]] || [];
|
|
4248
|
-
for (j = arr.length; j-- > 0; ) {
|
|
4249
|
-
opts.string.push(arr[j]);
|
|
4250
|
-
}
|
|
4251
|
-
}
|
|
4252
|
-
if (defaults) {
|
|
4253
|
-
for (k in opts.default) {
|
|
4254
|
-
name = typeof opts.default[k];
|
|
4255
|
-
arr = opts.alias[k] = opts.alias[k] || [];
|
|
4256
|
-
if (opts[name] !== void 0) {
|
|
4257
|
-
opts[name].push(k);
|
|
4258
|
-
for (i2 = 0; i2 < arr.length; i2++) {
|
|
4259
|
-
opts[name].push(arr[i2]);
|
|
4260
|
-
}
|
|
4261
|
-
}
|
|
4262
|
-
}
|
|
3086
|
+
function resolveValue(input) {
|
|
3087
|
+
return typeof input === "function" ? input() : input;
|
|
3088
|
+
}
|
|
3089
|
+
var CLIError = class extends Error {
|
|
3090
|
+
code;
|
|
3091
|
+
constructor(message, code) {
|
|
3092
|
+
super(message);
|
|
3093
|
+
this.name = "CLIError";
|
|
3094
|
+
this.code = code;
|
|
4263
3095
|
}
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
3096
|
+
};
|
|
3097
|
+
function parseRawArgs(args = [], opts = {}) {
|
|
3098
|
+
const booleans = new Set(opts.boolean || []);
|
|
3099
|
+
const strings = new Set(opts.string || []);
|
|
3100
|
+
const aliasMap = opts.alias || {};
|
|
3101
|
+
const defaults = opts.default || {};
|
|
3102
|
+
const aliasToMain = /* @__PURE__ */ new Map();
|
|
3103
|
+
const mainToAliases = /* @__PURE__ */ new Map();
|
|
3104
|
+
for (const [key, value] of Object.entries(aliasMap)) {
|
|
3105
|
+
const targets = value;
|
|
3106
|
+
for (const target of targets) {
|
|
3107
|
+
aliasToMain.set(key, target);
|
|
3108
|
+
if (!mainToAliases.has(target)) mainToAliases.set(target, []);
|
|
3109
|
+
mainToAliases.get(target).push(key);
|
|
3110
|
+
aliasToMain.set(target, key);
|
|
3111
|
+
if (!mainToAliases.has(key)) mainToAliases.set(key, []);
|
|
3112
|
+
mainToAliases.get(key).push(target);
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
const options = {};
|
|
3116
|
+
function getType(name) {
|
|
3117
|
+
if (booleans.has(name)) return "boolean";
|
|
3118
|
+
const aliases = mainToAliases.get(name) || [];
|
|
3119
|
+
for (const alias of aliases) if (booleans.has(alias)) return "boolean";
|
|
3120
|
+
return "string";
|
|
3121
|
+
}
|
|
3122
|
+
const allOptions = /* @__PURE__ */ new Set([
|
|
3123
|
+
...booleans,
|
|
3124
|
+
...strings,
|
|
3125
|
+
...Object.keys(aliasMap),
|
|
3126
|
+
...Object.values(aliasMap).flat(),
|
|
3127
|
+
...Object.keys(defaults)
|
|
3128
|
+
]);
|
|
3129
|
+
for (const name of allOptions) if (!options[name]) options[name] = {
|
|
3130
|
+
type: getType(name),
|
|
3131
|
+
default: defaults[name]
|
|
3132
|
+
};
|
|
3133
|
+
for (const [alias, main2] of aliasToMain.entries()) if (alias.length === 1 && options[main2] && !options[main2].short) options[main2].short = alias;
|
|
3134
|
+
const processedArgs = [];
|
|
3135
|
+
const negatedFlags = {};
|
|
3136
|
+
for (let i = 0; i < args.length; i++) {
|
|
3137
|
+
const arg = args[i];
|
|
4267
3138
|
if (arg === "--") {
|
|
4268
|
-
|
|
3139
|
+
processedArgs.push(...args.slice(i));
|
|
4269
3140
|
break;
|
|
4270
3141
|
}
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
}
|
|
4276
|
-
if (j === 0) {
|
|
4277
|
-
out._.push(arg);
|
|
4278
|
-
} else if (arg.substring(j, j + 3) === "no-") {
|
|
4279
|
-
name = arg.slice(Math.max(0, j + 3));
|
|
4280
|
-
if (strict && !~keys.indexOf(name)) {
|
|
4281
|
-
return opts.unknown(arg);
|
|
4282
|
-
}
|
|
4283
|
-
out[name] = false;
|
|
4284
|
-
} else {
|
|
4285
|
-
for (idx = j + 1; idx < arg.length; idx++) {
|
|
4286
|
-
if (arg.charCodeAt(idx) === 61) {
|
|
4287
|
-
break;
|
|
4288
|
-
}
|
|
4289
|
-
}
|
|
4290
|
-
name = arg.substring(j, idx);
|
|
4291
|
-
val = arg.slice(Math.max(0, ++idx)) || i2 + 1 === len || ("" + args[i2 + 1]).charCodeAt(0) === 45 || args[++i2];
|
|
4292
|
-
arr = j === 2 ? [name] : name;
|
|
4293
|
-
for (idx = 0; idx < arr.length; idx++) {
|
|
4294
|
-
name = arr[idx];
|
|
4295
|
-
if (strict && !~keys.indexOf(name)) {
|
|
4296
|
-
return opts.unknown("-".repeat(j) + name);
|
|
4297
|
-
}
|
|
4298
|
-
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
4299
|
-
}
|
|
3142
|
+
if (arg.startsWith("--no-")) {
|
|
3143
|
+
const flagName = arg.slice(5);
|
|
3144
|
+
negatedFlags[flagName] = true;
|
|
3145
|
+
continue;
|
|
4300
3146
|
}
|
|
3147
|
+
processedArgs.push(arg);
|
|
4301
3148
|
}
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
3149
|
+
let parsed;
|
|
3150
|
+
try {
|
|
3151
|
+
parsed = parseArgs$1({
|
|
3152
|
+
args: processedArgs,
|
|
3153
|
+
options: Object.keys(options).length > 0 ? options : void 0,
|
|
3154
|
+
allowPositionals: true,
|
|
3155
|
+
strict: false
|
|
3156
|
+
});
|
|
3157
|
+
} catch {
|
|
3158
|
+
parsed = {
|
|
3159
|
+
values: {},
|
|
3160
|
+
positionals: processedArgs
|
|
3161
|
+
};
|
|
4308
3162
|
}
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
3163
|
+
const out = { _: [] };
|
|
3164
|
+
out._ = parsed.positionals;
|
|
3165
|
+
for (const [key, value] of Object.entries(parsed.values)) out[key] = value;
|
|
3166
|
+
for (const [name] of Object.entries(negatedFlags)) out[name] = false;
|
|
3167
|
+
for (const [alias, main2] of aliasToMain.entries()) {
|
|
3168
|
+
if (out[alias] !== void 0 && out[main2] === void 0) out[main2] = out[alias];
|
|
3169
|
+
if (out[main2] !== void 0 && out[alias] === void 0) out[alias] = out[main2];
|
|
4316
3170
|
}
|
|
4317
3171
|
return out;
|
|
4318
3172
|
}
|
|
3173
|
+
var noColor = /* @__PURE__ */ (() => {
|
|
3174
|
+
const env2 = globalThis.process?.env ?? {};
|
|
3175
|
+
return env2.NO_COLOR === "1" || env2.TERM === "dumb" || env2.TEST || env2.CI;
|
|
3176
|
+
})();
|
|
3177
|
+
var _c = (c, r = 39) => (t) => noColor ? t : `\x1B[${c}m${t}\x1B[${r}m`;
|
|
3178
|
+
var bold = /* @__PURE__ */ _c(1, 22);
|
|
3179
|
+
var cyan = /* @__PURE__ */ _c(36);
|
|
3180
|
+
var gray = /* @__PURE__ */ _c(90);
|
|
3181
|
+
var underline = /* @__PURE__ */ _c(4, 24);
|
|
4319
3182
|
function parseArgs(rawArgs, argsDef) {
|
|
4320
3183
|
const parseOptions = {
|
|
4321
3184
|
boolean: [],
|
|
4322
3185
|
string: [],
|
|
4323
|
-
mixed: [],
|
|
4324
3186
|
alias: {},
|
|
4325
3187
|
default: {}
|
|
4326
3188
|
};
|
|
4327
3189
|
const args = resolveArgs(argsDef);
|
|
4328
3190
|
for (const arg of args) {
|
|
4329
|
-
if (arg.type === "positional")
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
if (arg.
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
parseOptions.alias[arg.name] = arg.alias;
|
|
3191
|
+
if (arg.type === "positional") continue;
|
|
3192
|
+
if (arg.type === "string" || arg.type === "enum") parseOptions.string.push(arg.name);
|
|
3193
|
+
else if (arg.type === "boolean") parseOptions.boolean.push(arg.name);
|
|
3194
|
+
if (arg.default !== void 0) parseOptions.default[arg.name] = arg.default;
|
|
3195
|
+
if (arg.alias) parseOptions.alias[arg.name] = arg.alias;
|
|
3196
|
+
const camelName = camelCase(arg.name);
|
|
3197
|
+
const kebabName = kebabCase(arg.name);
|
|
3198
|
+
if (camelName !== arg.name || kebabName !== arg.name) {
|
|
3199
|
+
const existingAliases = toArray(parseOptions.alias[arg.name] || []);
|
|
3200
|
+
if (camelName !== arg.name && !existingAliases.includes(camelName)) existingAliases.push(camelName);
|
|
3201
|
+
if (kebabName !== arg.name && !existingAliases.includes(kebabName)) existingAliases.push(kebabName);
|
|
3202
|
+
if (existingAliases.length > 0) parseOptions.alias[arg.name] = existingAliases;
|
|
4342
3203
|
}
|
|
4343
3204
|
}
|
|
4344
3205
|
const parsed = parseRawArgs(rawArgs, parseOptions);
|
|
4345
3206
|
const [...positionalArguments] = parsed._;
|
|
4346
|
-
const parsedArgsProxy = new Proxy(parsed, {
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
if (arg.
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
"EARG"
|
|
4360
|
-
);
|
|
4361
|
-
} else {
|
|
4362
|
-
parsedArgsProxy[arg.name] = arg.default;
|
|
4363
|
-
}
|
|
4364
|
-
} else if (arg.required && parsedArgsProxy[arg.name] === void 0) {
|
|
4365
|
-
throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
|
|
4366
|
-
}
|
|
4367
|
-
}
|
|
3207
|
+
const parsedArgsProxy = new Proxy(parsed, { get(target, prop) {
|
|
3208
|
+
return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
|
|
3209
|
+
} });
|
|
3210
|
+
for (const [, arg] of args.entries()) if (arg.type === "positional") {
|
|
3211
|
+
const nextPositionalArgument = positionalArguments.shift();
|
|
3212
|
+
if (nextPositionalArgument !== void 0) parsedArgsProxy[arg.name] = nextPositionalArgument;
|
|
3213
|
+
else if (arg.default === void 0 && arg.required !== false) throw new CLIError(`Missing required positional argument: ${arg.name.toUpperCase()}`, "EARG");
|
|
3214
|
+
else parsedArgsProxy[arg.name] = arg.default;
|
|
3215
|
+
} else if (arg.type === "enum") {
|
|
3216
|
+
const argument = parsedArgsProxy[arg.name];
|
|
3217
|
+
const options = arg.options || [];
|
|
3218
|
+
if (argument !== void 0 && options.length > 0 && !options.includes(argument)) throw new CLIError(`Invalid value for argument: ${cyan(`--${arg.name}`)} (${cyan(argument)}). Expected one of: ${options.map((o) => cyan(o)).join(", ")}.`, "EARG");
|
|
3219
|
+
} else if (arg.required && parsedArgsProxy[arg.name] === void 0) throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
|
|
4368
3220
|
return parsedArgsProxy;
|
|
4369
3221
|
}
|
|
4370
3222
|
function resolveArgs(argsDef) {
|
|
4371
3223
|
const args = [];
|
|
4372
|
-
for (const [name, argDef] of Object.entries(argsDef || {})) {
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
});
|
|
4378
|
-
}
|
|
3224
|
+
for (const [name, argDef] of Object.entries(argsDef || {})) args.push({
|
|
3225
|
+
...argDef,
|
|
3226
|
+
name,
|
|
3227
|
+
alias: toArray(argDef.alias)
|
|
3228
|
+
});
|
|
4379
3229
|
return args;
|
|
4380
3230
|
}
|
|
4381
3231
|
function defineCommand(def) {
|
|
@@ -4390,41 +3240,22 @@ async function runCommand(cmd, opts) {
|
|
|
4390
3240
|
data: opts.data,
|
|
4391
3241
|
cmd
|
|
4392
3242
|
};
|
|
4393
|
-
if (typeof cmd.setup === "function")
|
|
4394
|
-
await cmd.setup(context);
|
|
4395
|
-
}
|
|
3243
|
+
if (typeof cmd.setup === "function") await cmd.setup(context);
|
|
4396
3244
|
let result;
|
|
4397
3245
|
try {
|
|
4398
3246
|
const subCommands = await resolveValue(cmd.subCommands);
|
|
4399
3247
|
if (subCommands && Object.keys(subCommands).length > 0) {
|
|
4400
|
-
const subCommandArgIndex = opts.rawArgs.findIndex(
|
|
4401
|
-
(arg) => !arg.startsWith("-")
|
|
4402
|
-
);
|
|
3248
|
+
const subCommandArgIndex = opts.rawArgs.findIndex((arg) => !arg.startsWith("-"));
|
|
4403
3249
|
const subCommandName = opts.rawArgs[subCommandArgIndex];
|
|
4404
3250
|
if (subCommandName) {
|
|
4405
|
-
if (!subCommands[subCommandName]) {
|
|
4406
|
-
throw new CLIError(
|
|
4407
|
-
`Unknown command \`${subCommandName}\``,
|
|
4408
|
-
"E_UNKNOWN_COMMAND"
|
|
4409
|
-
);
|
|
4410
|
-
}
|
|
3251
|
+
if (!subCommands[subCommandName]) throw new CLIError(`Unknown command ${cyan(subCommandName)}`, "E_UNKNOWN_COMMAND");
|
|
4411
3252
|
const subCommand = await resolveValue(subCommands[subCommandName]);
|
|
4412
|
-
if (subCommand) {
|
|
4413
|
-
|
|
4414
|
-
rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
|
|
4415
|
-
});
|
|
4416
|
-
}
|
|
4417
|
-
} else if (!cmd.run) {
|
|
4418
|
-
throw new CLIError(`No command specified.`, "E_NO_COMMAND");
|
|
4419
|
-
}
|
|
4420
|
-
}
|
|
4421
|
-
if (typeof cmd.run === "function") {
|
|
4422
|
-
result = await cmd.run(context);
|
|
3253
|
+
if (subCommand) await runCommand(subCommand, { rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1) });
|
|
3254
|
+
} else if (!cmd.run) throw new CLIError(`No command specified.`, "E_NO_COMMAND");
|
|
4423
3255
|
}
|
|
3256
|
+
if (typeof cmd.run === "function") result = await cmd.run(context);
|
|
4424
3257
|
} finally {
|
|
4425
|
-
if (typeof cmd.cleanup === "function")
|
|
4426
|
-
await cmd.cleanup(context);
|
|
4427
|
-
}
|
|
3258
|
+
if (typeof cmd.cleanup === "function") await cmd.cleanup(context);
|
|
4428
3259
|
}
|
|
4429
3260
|
return { result };
|
|
4430
3261
|
}
|
|
@@ -4434,23 +3265,18 @@ async function resolveSubCommand(cmd, rawArgs, parent) {
|
|
|
4434
3265
|
const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
|
|
4435
3266
|
const subCommandName = rawArgs[subCommandArgIndex];
|
|
4436
3267
|
const subCommand = await resolveValue(subCommands[subCommandName]);
|
|
4437
|
-
if (subCommand)
|
|
4438
|
-
return resolveSubCommand(
|
|
4439
|
-
subCommand,
|
|
4440
|
-
rawArgs.slice(subCommandArgIndex + 1),
|
|
4441
|
-
cmd
|
|
4442
|
-
);
|
|
4443
|
-
}
|
|
3268
|
+
if (subCommand) return resolveSubCommand(subCommand, rawArgs.slice(subCommandArgIndex + 1), cmd);
|
|
4444
3269
|
}
|
|
4445
3270
|
return [cmd, parent];
|
|
4446
3271
|
}
|
|
4447
3272
|
async function showUsage(cmd, parent) {
|
|
4448
3273
|
try {
|
|
4449
|
-
|
|
3274
|
+
console.log(await renderUsage(cmd, parent) + "\n");
|
|
4450
3275
|
} catch (error2) {
|
|
4451
|
-
|
|
3276
|
+
console.error(error2);
|
|
4452
3277
|
}
|
|
4453
3278
|
}
|
|
3279
|
+
var negativePrefixRe = /^no[-A-Z]/;
|
|
4454
3280
|
async function renderUsage(cmd, parent) {
|
|
4455
3281
|
const cmdMeta = await resolveValue(cmd.meta || {});
|
|
4456
3282
|
const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
|
|
@@ -4460,77 +3286,58 @@ async function renderUsage(cmd, parent) {
|
|
|
4460
3286
|
const posLines = [];
|
|
4461
3287
|
const commandsLines = [];
|
|
4462
3288
|
const usageLine = [];
|
|
4463
|
-
for (const arg of cmdArgs) {
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
", "
|
|
4481
|
-
)) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
|
|
4482
|
-
argLines.push([
|
|
4483
|
-
"`" + argStr + (isRequired ? " (required)" : "") + "`",
|
|
4484
|
-
arg.description || ""
|
|
4485
|
-
]);
|
|
4486
|
-
if (isRequired) {
|
|
4487
|
-
usageLine.push(argStr);
|
|
4488
|
-
}
|
|
3289
|
+
for (const arg of cmdArgs) if (arg.type === "positional") {
|
|
3290
|
+
const name = arg.name.toUpperCase();
|
|
3291
|
+
const isRequired = arg.required !== false && arg.default === void 0;
|
|
3292
|
+
const defaultHint = arg.default ? `="${arg.default}"` : "";
|
|
3293
|
+
posLines.push([
|
|
3294
|
+
cyan(name + defaultHint),
|
|
3295
|
+
arg.description || "",
|
|
3296
|
+
arg.valueHint ? `<${arg.valueHint}>` : ""
|
|
3297
|
+
]);
|
|
3298
|
+
usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
|
|
3299
|
+
} else {
|
|
3300
|
+
const isRequired = arg.required === true && arg.default === void 0;
|
|
3301
|
+
const argStr = [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(", ") + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "") + (arg.type === "enum" && arg.options ? `=<${arg.options.join("|")}>` : "");
|
|
3302
|
+
argLines.push([cyan(argStr + (isRequired ? " (required)" : "")), arg.description || ""]);
|
|
3303
|
+
if (arg.type === "boolean" && (arg.default === true || arg.negativeDescription) && !negativePrefixRe.test(arg.name)) {
|
|
3304
|
+
const negativeArgStr = [...(arg.alias || []).map((a) => `--no-${a}`), `--no-${arg.name}`].join(", ");
|
|
3305
|
+
argLines.push([cyan(negativeArgStr + (isRequired ? " (required)" : "")), arg.negativeDescription || ""]);
|
|
4489
3306
|
}
|
|
3307
|
+
if (isRequired) usageLine.push(argStr);
|
|
4490
3308
|
}
|
|
4491
3309
|
if (cmd.subCommands) {
|
|
4492
3310
|
const commandNames = [];
|
|
4493
3311
|
const subCommands = await resolveValue(cmd.subCommands);
|
|
4494
3312
|
for (const [name, sub] of Object.entries(subCommands)) {
|
|
4495
|
-
const
|
|
4496
|
-
|
|
4497
|
-
commandsLines.push([
|
|
3313
|
+
const meta = await resolveValue((await resolveValue(sub))?.meta);
|
|
3314
|
+
if (meta?.hidden) continue;
|
|
3315
|
+
commandsLines.push([cyan(name), meta?.description || ""]);
|
|
4498
3316
|
commandNames.push(name);
|
|
4499
3317
|
}
|
|
4500
3318
|
usageLine.push(commandNames.join("|"));
|
|
4501
3319
|
}
|
|
4502
3320
|
const usageLines = [];
|
|
4503
3321
|
const version = cmdMeta.version || parentMeta.version;
|
|
4504
|
-
usageLines.push(
|
|
4505
|
-
colors.gray(
|
|
4506
|
-
`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`
|
|
4507
|
-
),
|
|
4508
|
-
""
|
|
4509
|
-
);
|
|
3322
|
+
usageLines.push(gray(`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`), "");
|
|
4510
3323
|
const hasOptions = argLines.length > 0 || posLines.length > 0;
|
|
4511
|
-
usageLines.push(
|
|
4512
|
-
`${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``,
|
|
4513
|
-
""
|
|
4514
|
-
);
|
|
3324
|
+
usageLines.push(`${underline(bold("USAGE"))} ${cyan(`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}`)}`, "");
|
|
4515
3325
|
if (posLines.length > 0) {
|
|
4516
|
-
usageLines.push(
|
|
3326
|
+
usageLines.push(underline(bold("ARGUMENTS")), "");
|
|
4517
3327
|
usageLines.push(formatLineColumns(posLines, " "));
|
|
4518
3328
|
usageLines.push("");
|
|
4519
3329
|
}
|
|
4520
3330
|
if (argLines.length > 0) {
|
|
4521
|
-
usageLines.push(
|
|
3331
|
+
usageLines.push(underline(bold("OPTIONS")), "");
|
|
4522
3332
|
usageLines.push(formatLineColumns(argLines, " "));
|
|
4523
3333
|
usageLines.push("");
|
|
4524
3334
|
}
|
|
4525
3335
|
if (commandsLines.length > 0) {
|
|
4526
|
-
usageLines.push(
|
|
3336
|
+
usageLines.push(underline(bold("COMMANDS")), "");
|
|
4527
3337
|
usageLines.push(formatLineColumns(commandsLines, " "));
|
|
4528
|
-
usageLines.push(
|
|
4529
|
-
"",
|
|
4530
|
-
`Use \`${commandName} <command> --help\` for more information about a command.`
|
|
4531
|
-
);
|
|
3338
|
+
usageLines.push("", `Use ${cyan(`${commandName} <command> --help`)} for more information about a command.`);
|
|
4532
3339
|
}
|
|
4533
|
-
return usageLines.filter((
|
|
3340
|
+
return usageLines.filter((l) => typeof l === "string").join("\n");
|
|
4534
3341
|
}
|
|
4535
3342
|
async function runMain(cmd, opts = {}) {
|
|
4536
3343
|
const rawArgs = opts.rawArgs || process.argv.slice(2);
|
|
@@ -4541,22 +3348,14 @@ async function runMain(cmd, opts = {}) {
|
|
|
4541
3348
|
process.exit(0);
|
|
4542
3349
|
} else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
|
|
4543
3350
|
const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
|
|
4544
|
-
if (!meta?.version)
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
consola.log(meta.version);
|
|
4548
|
-
} else {
|
|
4549
|
-
await runCommand(cmd, { rawArgs });
|
|
4550
|
-
}
|
|
3351
|
+
if (!meta?.version) throw new CLIError("No version specified", "E_NO_VERSION");
|
|
3352
|
+
console.log(meta.version);
|
|
3353
|
+
} else await runCommand(cmd, { rawArgs });
|
|
4551
3354
|
} catch (error2) {
|
|
4552
|
-
|
|
4553
|
-
if (!isCLIError) {
|
|
4554
|
-
consola.error(error2, "\n");
|
|
4555
|
-
}
|
|
4556
|
-
if (isCLIError) {
|
|
3355
|
+
if (error2 instanceof CLIError) {
|
|
4557
3356
|
await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
|
|
4558
|
-
|
|
4559
|
-
|
|
3357
|
+
console.error(error2.message);
|
|
3358
|
+
} else console.error(error2, "\n");
|
|
4560
3359
|
process.exit(1);
|
|
4561
3360
|
}
|
|
4562
3361
|
}
|
|
@@ -4584,17 +3383,17 @@ __export(colorette_exports, {
|
|
|
4584
3383
|
blackBright: () => blackBright,
|
|
4585
3384
|
blue: () => blue,
|
|
4586
3385
|
blueBright: () => blueBright,
|
|
4587
|
-
bold: () =>
|
|
4588
|
-
createColors: () =>
|
|
4589
|
-
cyan: () =>
|
|
3386
|
+
bold: () => bold2,
|
|
3387
|
+
createColors: () => createColors,
|
|
3388
|
+
cyan: () => cyan2,
|
|
4590
3389
|
cyanBright: () => cyanBright,
|
|
4591
3390
|
dim: () => dim,
|
|
4592
|
-
gray: () =>
|
|
3391
|
+
gray: () => gray2,
|
|
4593
3392
|
green: () => green,
|
|
4594
3393
|
greenBright: () => greenBright,
|
|
4595
3394
|
hidden: () => hidden,
|
|
4596
3395
|
inverse: () => inverse,
|
|
4597
|
-
isColorSupported: () =>
|
|
3396
|
+
isColorSupported: () => isColorSupported,
|
|
4598
3397
|
italic: () => italic,
|
|
4599
3398
|
magenta: () => magenta,
|
|
4600
3399
|
magentaBright: () => magentaBright,
|
|
@@ -4602,88 +3401,88 @@ __export(colorette_exports, {
|
|
|
4602
3401
|
redBright: () => redBright,
|
|
4603
3402
|
reset: () => reset,
|
|
4604
3403
|
strikethrough: () => strikethrough,
|
|
4605
|
-
underline: () =>
|
|
3404
|
+
underline: () => underline2,
|
|
4606
3405
|
white: () => white,
|
|
4607
3406
|
whiteBright: () => whiteBright,
|
|
4608
3407
|
yellow: () => yellow,
|
|
4609
3408
|
yellowBright: () => yellowBright
|
|
4610
3409
|
});
|
|
4611
|
-
import * as
|
|
3410
|
+
import * as tty from "tty";
|
|
4612
3411
|
var {
|
|
4613
|
-
env
|
|
4614
|
-
argv
|
|
4615
|
-
platform
|
|
3412
|
+
env = {},
|
|
3413
|
+
argv = [],
|
|
3414
|
+
platform = ""
|
|
4616
3415
|
} = typeof process === "undefined" ? {} : process;
|
|
4617
|
-
var
|
|
4618
|
-
var
|
|
4619
|
-
var
|
|
4620
|
-
var
|
|
4621
|
-
var
|
|
4622
|
-
var
|
|
4623
|
-
var
|
|
4624
|
-
var
|
|
4625
|
-
var
|
|
4626
|
-
var
|
|
3416
|
+
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
3417
|
+
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
3418
|
+
var isWindows = platform === "win32";
|
|
3419
|
+
var isDumbTerminal = env.TERM === "dumb";
|
|
3420
|
+
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
3421
|
+
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
3422
|
+
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
3423
|
+
var replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
3424
|
+
var clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
3425
|
+
var filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
4627
3426
|
("" + string).indexOf(close, at),
|
|
4628
3427
|
string,
|
|
4629
3428
|
open,
|
|
4630
3429
|
close,
|
|
4631
3430
|
replace
|
|
4632
3431
|
) : "";
|
|
4633
|
-
var
|
|
4634
|
-
var
|
|
4635
|
-
reset:
|
|
4636
|
-
bold:
|
|
4637
|
-
dim:
|
|
4638
|
-
italic:
|
|
4639
|
-
underline:
|
|
4640
|
-
inverse:
|
|
4641
|
-
hidden:
|
|
4642
|
-
strikethrough:
|
|
4643
|
-
black:
|
|
4644
|
-
red:
|
|
4645
|
-
green:
|
|
4646
|
-
yellow:
|
|
4647
|
-
blue:
|
|
4648
|
-
magenta:
|
|
4649
|
-
cyan:
|
|
4650
|
-
white:
|
|
4651
|
-
gray:
|
|
4652
|
-
bgBlack:
|
|
4653
|
-
bgRed:
|
|
4654
|
-
bgGreen:
|
|
4655
|
-
bgYellow:
|
|
4656
|
-
bgBlue:
|
|
4657
|
-
bgMagenta:
|
|
4658
|
-
bgCyan:
|
|
4659
|
-
bgWhite:
|
|
4660
|
-
blackBright:
|
|
4661
|
-
redBright:
|
|
4662
|
-
greenBright:
|
|
4663
|
-
yellowBright:
|
|
4664
|
-
blueBright:
|
|
4665
|
-
magentaBright:
|
|
4666
|
-
cyanBright:
|
|
4667
|
-
whiteBright:
|
|
4668
|
-
bgBlackBright:
|
|
4669
|
-
bgRedBright:
|
|
4670
|
-
bgGreenBright:
|
|
4671
|
-
bgYellowBright:
|
|
4672
|
-
bgBlueBright:
|
|
4673
|
-
bgMagentaBright:
|
|
4674
|
-
bgCyanBright:
|
|
4675
|
-
bgWhiteBright:
|
|
3432
|
+
var init = (open, close, replace) => filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
3433
|
+
var colors = {
|
|
3434
|
+
reset: init(0, 0),
|
|
3435
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
3436
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
3437
|
+
italic: init(3, 23),
|
|
3438
|
+
underline: init(4, 24),
|
|
3439
|
+
inverse: init(7, 27),
|
|
3440
|
+
hidden: init(8, 28),
|
|
3441
|
+
strikethrough: init(9, 29),
|
|
3442
|
+
black: init(30, 39),
|
|
3443
|
+
red: init(31, 39),
|
|
3444
|
+
green: init(32, 39),
|
|
3445
|
+
yellow: init(33, 39),
|
|
3446
|
+
blue: init(34, 39),
|
|
3447
|
+
magenta: init(35, 39),
|
|
3448
|
+
cyan: init(36, 39),
|
|
3449
|
+
white: init(37, 39),
|
|
3450
|
+
gray: init(90, 39),
|
|
3451
|
+
bgBlack: init(40, 49),
|
|
3452
|
+
bgRed: init(41, 49),
|
|
3453
|
+
bgGreen: init(42, 49),
|
|
3454
|
+
bgYellow: init(43, 49),
|
|
3455
|
+
bgBlue: init(44, 49),
|
|
3456
|
+
bgMagenta: init(45, 49),
|
|
3457
|
+
bgCyan: init(46, 49),
|
|
3458
|
+
bgWhite: init(47, 49),
|
|
3459
|
+
blackBright: init(90, 39),
|
|
3460
|
+
redBright: init(91, 39),
|
|
3461
|
+
greenBright: init(92, 39),
|
|
3462
|
+
yellowBright: init(93, 39),
|
|
3463
|
+
blueBright: init(94, 39),
|
|
3464
|
+
magentaBright: init(95, 39),
|
|
3465
|
+
cyanBright: init(96, 39),
|
|
3466
|
+
whiteBright: init(97, 39),
|
|
3467
|
+
bgBlackBright: init(100, 49),
|
|
3468
|
+
bgRedBright: init(101, 49),
|
|
3469
|
+
bgGreenBright: init(102, 49),
|
|
3470
|
+
bgYellowBright: init(103, 49),
|
|
3471
|
+
bgBlueBright: init(104, 49),
|
|
3472
|
+
bgMagentaBright: init(105, 49),
|
|
3473
|
+
bgCyanBright: init(106, 49),
|
|
3474
|
+
bgWhiteBright: init(107, 49)
|
|
4676
3475
|
};
|
|
4677
|
-
var
|
|
4678
|
-
(
|
|
3476
|
+
var createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors : Object.keys(colors).reduce(
|
|
3477
|
+
(colors2, key) => ({ ...colors2, [key]: String }),
|
|
4679
3478
|
{}
|
|
4680
3479
|
);
|
|
4681
3480
|
var {
|
|
4682
3481
|
reset,
|
|
4683
|
-
bold,
|
|
3482
|
+
bold: bold2,
|
|
4684
3483
|
dim,
|
|
4685
3484
|
italic,
|
|
4686
|
-
underline,
|
|
3485
|
+
underline: underline2,
|
|
4687
3486
|
inverse,
|
|
4688
3487
|
hidden,
|
|
4689
3488
|
strikethrough,
|
|
@@ -4693,9 +3492,9 @@ var {
|
|
|
4693
3492
|
yellow,
|
|
4694
3493
|
blue,
|
|
4695
3494
|
magenta,
|
|
4696
|
-
cyan,
|
|
3495
|
+
cyan: cyan2,
|
|
4697
3496
|
white,
|
|
4698
|
-
gray,
|
|
3497
|
+
gray: gray2,
|
|
4699
3498
|
bgBlack,
|
|
4700
3499
|
bgRed,
|
|
4701
3500
|
bgGreen,
|
|
@@ -4720,12 +3519,65 @@ var {
|
|
|
4720
3519
|
bgMagentaBright,
|
|
4721
3520
|
bgCyanBright,
|
|
4722
3521
|
bgWhiteBright
|
|
4723
|
-
} =
|
|
3522
|
+
} = createColors();
|
|
3523
|
+
|
|
3524
|
+
// ../../node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
|
|
3525
|
+
var NUMBER_CHAR_RE2 = /\d/;
|
|
3526
|
+
var STR_SPLITTERS2 = ["-", "_", "/", "."];
|
|
3527
|
+
function isUppercase2(char = "") {
|
|
3528
|
+
if (NUMBER_CHAR_RE2.test(char)) {
|
|
3529
|
+
return void 0;
|
|
3530
|
+
}
|
|
3531
|
+
return char !== char.toLowerCase();
|
|
3532
|
+
}
|
|
3533
|
+
function splitByCase2(str, separators) {
|
|
3534
|
+
const splitters = separators ?? STR_SPLITTERS2;
|
|
3535
|
+
const parts = [];
|
|
3536
|
+
if (!str || typeof str !== "string") {
|
|
3537
|
+
return parts;
|
|
3538
|
+
}
|
|
3539
|
+
let buff = "";
|
|
3540
|
+
let previousUpper;
|
|
3541
|
+
let previousSplitter;
|
|
3542
|
+
for (const char of str) {
|
|
3543
|
+
const isSplitter = splitters.includes(char);
|
|
3544
|
+
if (isSplitter === true) {
|
|
3545
|
+
parts.push(buff);
|
|
3546
|
+
buff = "";
|
|
3547
|
+
previousUpper = void 0;
|
|
3548
|
+
continue;
|
|
3549
|
+
}
|
|
3550
|
+
const isUpper = isUppercase2(char);
|
|
3551
|
+
if (previousSplitter === false) {
|
|
3552
|
+
if (previousUpper === false && isUpper === true) {
|
|
3553
|
+
parts.push(buff);
|
|
3554
|
+
buff = char;
|
|
3555
|
+
previousUpper = isUpper;
|
|
3556
|
+
continue;
|
|
3557
|
+
}
|
|
3558
|
+
if (previousUpper === true && isUpper === false && buff.length > 1) {
|
|
3559
|
+
const lastChar = buff.at(-1);
|
|
3560
|
+
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
|
|
3561
|
+
buff = lastChar + char;
|
|
3562
|
+
previousUpper = isUpper;
|
|
3563
|
+
continue;
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
buff += char;
|
|
3567
|
+
previousUpper = isUpper;
|
|
3568
|
+
previousSplitter = isSplitter;
|
|
3569
|
+
}
|
|
3570
|
+
parts.push(buff);
|
|
3571
|
+
return parts;
|
|
3572
|
+
}
|
|
3573
|
+
function kebabCase2(str, joiner) {
|
|
3574
|
+
return str ? (Array.isArray(str) ? str : splitByCase2(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
|
|
3575
|
+
}
|
|
4724
3576
|
|
|
4725
3577
|
// package.json
|
|
4726
3578
|
var package_default = {
|
|
4727
3579
|
name: "@batijs/cli",
|
|
4728
|
-
version: "0.0.
|
|
3580
|
+
version: "0.0.568",
|
|
4729
3581
|
type: "module",
|
|
4730
3582
|
scripts: {
|
|
4731
3583
|
"check-types": "tsc --noEmit",
|
|
@@ -4741,12 +3593,13 @@ var package_default = {
|
|
|
4741
3593
|
"@batijs/build": "workspace:*",
|
|
4742
3594
|
"@batijs/compile": "workspace:*",
|
|
4743
3595
|
"@inquirer/prompts": "^8.2.0",
|
|
4744
|
-
"@types/node": "^20.19.
|
|
3596
|
+
"@types/node": "^20.19.30",
|
|
4745
3597
|
"@types/which": "^3.0.4",
|
|
4746
|
-
citty: "^0.
|
|
3598
|
+
citty: "^0.2.0",
|
|
4747
3599
|
colorette: "^2.0.20",
|
|
4748
3600
|
esbuild: "^0.27.2",
|
|
4749
3601
|
execa: "^9.6.1",
|
|
3602
|
+
scule: "^1.3.0",
|
|
4750
3603
|
tsup: "^8.5.1",
|
|
4751
3604
|
typescript: "^5.9.3",
|
|
4752
3605
|
"unplugin-purge-polyfills": "^0.1.0",
|
|
@@ -4782,37 +3635,37 @@ function warning(value) {
|
|
|
4782
3635
|
}
|
|
4783
3636
|
var rulesMessages = {
|
|
4784
3637
|
[RulesMessage.ERROR_AUTH_R_SERVER]: error(
|
|
4785
|
-
`A ${inverse(
|
|
4786
|
-
|
|
3638
|
+
`A ${inverse(bold2("Server"))} is required when using ${inverse(
|
|
3639
|
+
bold2("Auth")
|
|
4787
3640
|
)}. Check https://vike.dev/integration#server-side-tools for details and https://batijs.dev for available servers`
|
|
4788
3641
|
),
|
|
4789
3642
|
[RulesMessage.ERROR_COMPILED_R_REACT]: error(
|
|
4790
|
-
`${inverse(
|
|
3643
|
+
`${inverse(bold2("React"))} is required when using ${inverse(bold2("Compiled"))}`
|
|
4791
3644
|
),
|
|
4792
3645
|
[RulesMessage.ERROR_MANTINE_R_REACT]: error(
|
|
4793
|
-
`${inverse(
|
|
3646
|
+
`${inverse(bold2("React"))} is required when using ${inverse(bold2("Mantine"))}`
|
|
4794
3647
|
),
|
|
4795
3648
|
[RulesMessage.ERROR_DRIZZLE_R_SERVER]: error(
|
|
4796
|
-
`A ${inverse(
|
|
3649
|
+
`A ${inverse(bold2("Server"))} is required when using ${inverse(bold2("Drizzle"))}`
|
|
4797
3650
|
),
|
|
4798
3651
|
[RulesMessage.ERROR_KYSELY_R_SERVER]: error(
|
|
4799
|
-
`A ${inverse(
|
|
3652
|
+
`A ${inverse(bold2("Server"))} is required when using ${inverse(bold2("Kysely"))}`
|
|
4800
3653
|
),
|
|
4801
3654
|
[RulesMessage.ERROR_DATA_R_SERVER]: error(
|
|
4802
|
-
`A ${inverse(
|
|
3655
|
+
`A ${inverse(bold2("Server"))} is required when using ${inverse(bold2("Data fetching"))}`
|
|
4803
3656
|
),
|
|
4804
3657
|
[RulesMessage.ERROR_CLOUDFLARE_R_COMPAT_SERVER]: error(
|
|
4805
|
-
`${inverse(
|
|
3658
|
+
`${inverse(bold2("Cloudflare"))} is only compatible with ${inverse(bold2("Hono"))} or ${inverse(bold2("H3"))}.
|
|
4806
3659
|
Choose one of them or remove selected Server`
|
|
4807
3660
|
),
|
|
4808
3661
|
[RulesMessage.ERROR_AWS_R_COMPAT_SERVER]: error(
|
|
4809
|
-
`${inverse(
|
|
3662
|
+
`${inverse(bold2("AWS"))} deployment is only compatible with ${inverse(bold2("Hono"))}`
|
|
4810
3663
|
),
|
|
4811
3664
|
[RulesMessage.ERROR_SHADCN_R_REACT]: error(
|
|
4812
|
-
`${inverse(
|
|
3665
|
+
`${inverse(bold2("shadcn/ui"))} is only compatible with ${inverse(bold2("React"))}`
|
|
4813
3666
|
),
|
|
4814
3667
|
[RulesMessage.WARN_SHADCN_R_TAILWINDCSS]: warning(
|
|
4815
|
-
`${inverse(
|
|
3668
|
+
`${inverse(bold2("shadcn/ui"))} integration is tied to ${inverse(bold2("TailwindCSS"))}. Using another CSS library with it may have unpredictable behaviour.`
|
|
4816
3669
|
),
|
|
4817
3670
|
[RulesMessage.INFO_STACKBLITZ_COMPAT]: null
|
|
4818
3671
|
};
|
|
@@ -4822,7 +3675,7 @@ printInit();
|
|
|
4822
3675
|
var __filename = fileURLToPath(import.meta.url);
|
|
4823
3676
|
var __dirname = dirname(__filename);
|
|
4824
3677
|
var isWin2 = process.platform === "win32";
|
|
4825
|
-
var pm =
|
|
3678
|
+
var pm = hfs();
|
|
4826
3679
|
function boilerplatesDir() {
|
|
4827
3680
|
if (existsSync2(join(__dirname, "boilerplates", "boilerplates.json"))) {
|
|
4828
3681
|
return join(__dirname, "boilerplates");
|
|
@@ -4883,10 +3736,10 @@ async function generateKnipConfig(dist, boilerplates) {
|
|
|
4883
3736
|
const pkgJsonPath = join(dist, "package.json");
|
|
4884
3737
|
const pkgJson = JSON.parse(await readFile2(pkgJsonPath, "utf-8"));
|
|
4885
3738
|
const scriptsValues = Object.values(pkgJson.scripts ?? {});
|
|
4886
|
-
if (scriptsValues.some((
|
|
3739
|
+
if (scriptsValues.some((s) => s.includes("tsx "))) {
|
|
4887
3740
|
aggregated.ignoreDependencies.push("tsx");
|
|
4888
3741
|
}
|
|
4889
|
-
if (scriptsValues.some((
|
|
3742
|
+
if (scriptsValues.some((s) => s.includes("cross-env "))) {
|
|
4890
3743
|
aggregated.ignoreDependencies.push("cross-env");
|
|
4891
3744
|
}
|
|
4892
3745
|
} catch {
|
|
@@ -4913,7 +3766,7 @@ async function generateKnipConfig(dist, boilerplates) {
|
|
|
4913
3766
|
);
|
|
4914
3767
|
}
|
|
4915
3768
|
function findFeature(key) {
|
|
4916
|
-
const feat = features.find((
|
|
3769
|
+
const feat = features.find((f) => f.flag === key);
|
|
4917
3770
|
if (!feat) return;
|
|
4918
3771
|
if (feat.description) {
|
|
4919
3772
|
return feat;
|
|
@@ -4933,27 +3786,27 @@ async function hasRemainingSteps(dist) {
|
|
|
4933
3786
|
}
|
|
4934
3787
|
}
|
|
4935
3788
|
function printInit() {
|
|
4936
|
-
const v =
|
|
3789
|
+
const v = BRs();
|
|
4937
3790
|
const version = v.semver.at(-1);
|
|
4938
3791
|
assert(version);
|
|
4939
3792
|
console.log(`
|
|
4940
|
-
\u{1F528} ${
|
|
3793
|
+
\u{1F528} ${cyan2("Vike Scaffolder")} \u{1F528} ${gray2(`v${version}`)}
|
|
4941
3794
|
`);
|
|
4942
3795
|
}
|
|
4943
3796
|
async function printOK(dist, flags2, nextSteps) {
|
|
4944
3797
|
const indent = 1;
|
|
4945
|
-
const list =
|
|
4946
|
-
const cmd =
|
|
3798
|
+
const list = hir("-", gray2, indent);
|
|
3799
|
+
const cmd = hir("$", gray2, indent);
|
|
4947
3800
|
const distPretty = prettifyDist(dist);
|
|
4948
|
-
console.log(`${green(`${
|
|
3801
|
+
console.log(`${green(`${bold2("\u2713")} Project created: ${bold2(distPretty)}`)}`);
|
|
4949
3802
|
console.log(list("Vike"));
|
|
4950
3803
|
for (const key of flags2) {
|
|
4951
|
-
const feature = features.find((
|
|
3804
|
+
const feature = features.find((f) => f.flag === key);
|
|
4952
3805
|
if (!feature || !feature.label) continue;
|
|
4953
3806
|
console.log(list(feature.label));
|
|
4954
3807
|
}
|
|
4955
3808
|
console.log(`
|
|
4956
|
-
${
|
|
3809
|
+
${bold2("Next steps:")}`);
|
|
4957
3810
|
console.log(cmd(`cd ${distPretty}`));
|
|
4958
3811
|
console.log(cmd(`${pm.name} install`));
|
|
4959
3812
|
if (nextSteps.length > 0) {
|
|
@@ -4961,11 +3814,11 @@ ${bold("Next steps:")}`);
|
|
|
4961
3814
|
if (step.type === "command") {
|
|
4962
3815
|
console.log(cmd(step.step));
|
|
4963
3816
|
} else {
|
|
4964
|
-
console.log(
|
|
3817
|
+
console.log(hir("\u2022\uFE0F", gray2, indent)(step.step));
|
|
4965
3818
|
}
|
|
4966
3819
|
}
|
|
4967
3820
|
} else if (await hasRemainingSteps(dist)) {
|
|
4968
|
-
console.log(
|
|
3821
|
+
console.log(hir("\u2022\uFE0F", gray2, indent)(`Check ${bold2("TODO.md")} for remaining steps`));
|
|
4969
3822
|
}
|
|
4970
3823
|
console.log(cmd(`${pm.run} dev`));
|
|
4971
3824
|
console.log("\nHappy coding! \u{1F680}\n");
|
|
@@ -5009,7 +3862,7 @@ function yn(value, default_) {
|
|
|
5009
3862
|
function generateRandomFilename(size) {
|
|
5010
3863
|
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
5011
3864
|
let result = "";
|
|
5012
|
-
for (let
|
|
3865
|
+
for (let i = 0; i < size; i++) {
|
|
5013
3866
|
const randomIndex = Math.floor(Math.random() * chars.length);
|
|
5014
3867
|
result += chars[randomIndex];
|
|
5015
3868
|
}
|
|
@@ -5017,38 +3870,41 @@ function generateRandomFilename(size) {
|
|
|
5017
3870
|
}
|
|
5018
3871
|
async function checkArguments(args) {
|
|
5019
3872
|
const projectChosenByUser = Boolean(args.project);
|
|
5020
|
-
|
|
5021
|
-
args
|
|
3873
|
+
const newArgs = {
|
|
3874
|
+
...args
|
|
3875
|
+
};
|
|
3876
|
+
if (!newArgs.project) {
|
|
3877
|
+
newArgs.project = "my-app";
|
|
5022
3878
|
}
|
|
5023
|
-
if (existsSync2(
|
|
5024
|
-
const stat = await lstat(
|
|
3879
|
+
if (existsSync2(newArgs.project)) {
|
|
3880
|
+
const stat = await lstat(newArgs.project);
|
|
5025
3881
|
if (!projectChosenByUser) {
|
|
5026
|
-
|
|
5027
|
-
return;
|
|
3882
|
+
newArgs.project = `my-app-${generateRandomFilename(5)}`;
|
|
3883
|
+
return newArgs;
|
|
5028
3884
|
} else if (!stat.isDirectory()) {
|
|
5029
3885
|
console.error(
|
|
5030
|
-
`${yellow("\u26A0")} Target ${
|
|
3886
|
+
`${yellow("\u26A0")} Target ${cyan2(newArgs.project)} already exists but is not a directory. ${yellow("Aborting")}.`
|
|
5031
3887
|
);
|
|
5032
3888
|
process.exit(2);
|
|
5033
3889
|
}
|
|
5034
3890
|
try {
|
|
5035
|
-
await access(
|
|
3891
|
+
await access(newArgs.project, constants.W_OK);
|
|
5036
3892
|
} catch {
|
|
5037
3893
|
console.error(
|
|
5038
|
-
`${yellow("\u26A0")} Target folder ${
|
|
3894
|
+
`${yellow("\u26A0")} Target folder ${cyan2(newArgs.project)} already exists but is not writable. ${yellow("Aborting")}.`
|
|
5039
3895
|
);
|
|
5040
3896
|
process.exit(3);
|
|
5041
3897
|
}
|
|
5042
|
-
if (!
|
|
5043
|
-
const isFolderEmpty = (await readdir(
|
|
3898
|
+
if (!newArgs.force) {
|
|
3899
|
+
const isFolderEmpty = (await readdir(newArgs.project)).length === 0;
|
|
5044
3900
|
if (!isFolderEmpty) {
|
|
5045
3901
|
if (!projectChosenByUser) {
|
|
5046
|
-
|
|
5047
|
-
return;
|
|
3902
|
+
newArgs.project = `my-app-${generateRandomFilename(5)}`;
|
|
3903
|
+
return newArgs;
|
|
5048
3904
|
} else {
|
|
5049
3905
|
console.error(
|
|
5050
|
-
`${yellow("\u26A0")} Target folder ${
|
|
5051
|
-
|
|
3906
|
+
`${yellow("\u26A0")} Target folder ${cyan2(
|
|
3907
|
+
newArgs.project
|
|
5052
3908
|
)} already exists and is not empty.
|
|
5053
3909
|
Continuing might erase existing files. ${yellow("Aborting")}.`
|
|
5054
3910
|
);
|
|
@@ -5057,12 +3913,13 @@ async function checkArguments(args) {
|
|
|
5057
3913
|
}
|
|
5058
3914
|
}
|
|
5059
3915
|
}
|
|
3916
|
+
return newArgs;
|
|
5060
3917
|
}
|
|
5061
3918
|
var choices = [
|
|
5062
3919
|
{
|
|
5063
3920
|
label: "React",
|
|
5064
3921
|
value: "react",
|
|
5065
|
-
labelColor:
|
|
3922
|
+
labelColor: cyan2
|
|
5066
3923
|
},
|
|
5067
3924
|
{
|
|
5068
3925
|
label: "Vue",
|
|
@@ -5078,11 +3935,11 @@ var choices = [
|
|
|
5078
3935
|
async function checkFlagsIncludesUiFramework(flags2) {
|
|
5079
3936
|
const flagsUi = features.filter((fs) => fs.category === "UI Framework").map((fs) => fs.flag);
|
|
5080
3937
|
const flagsHosting = features.filter((fs) => fs.category === "Hosting").map((fs) => fs.flag);
|
|
5081
|
-
const flagsUiFound = flags2.some((
|
|
5082
|
-
const isBarebones = flags2.filter((
|
|
3938
|
+
const flagsUiFound = flags2.some((f) => flagsUi.includes(f));
|
|
3939
|
+
const isBarebones = flags2.filter((f) => !flagsUi.includes(f) && !flagsHosting.includes(f)).length === 0;
|
|
5083
3940
|
if (isBarebones) {
|
|
5084
3941
|
console.warn(
|
|
5085
|
-
`${yellow("\u{1F6C8} Scaffolding a bare-bones app")} \u27A1\uFE0F Go to ${
|
|
3942
|
+
`${yellow("\u{1F6C8} Scaffolding a bare-bones app")} \u27A1\uFE0F Go to ${underline2("https://vike.dev/new")} to scaffold full-fledged apps with Tailwind, authentication, database, deployment, and more.
|
|
5086
3943
|
`
|
|
5087
3944
|
);
|
|
5088
3945
|
}
|
|
@@ -5090,16 +3947,16 @@ async function checkFlagsIncludesUiFramework(flags2) {
|
|
|
5090
3947
|
const ui = await dist_default2({
|
|
5091
3948
|
theme: {
|
|
5092
3949
|
style: {
|
|
5093
|
-
highlight(
|
|
5094
|
-
const found = choices.find((
|
|
5095
|
-
return (found?.labelColor ??
|
|
3950
|
+
highlight(t) {
|
|
3951
|
+
const found = choices.find((c) => t.includes(c.label));
|
|
3952
|
+
return (found?.labelColor ?? cyan2)(t);
|
|
5096
3953
|
}
|
|
5097
3954
|
}
|
|
5098
3955
|
},
|
|
5099
3956
|
message: "Select a UI framework:",
|
|
5100
|
-
choices: choices.map((
|
|
5101
|
-
name:
|
|
5102
|
-
value:
|
|
3957
|
+
choices: choices.map((c) => ({
|
|
3958
|
+
name: c.label,
|
|
3959
|
+
value: c.value
|
|
5103
3960
|
}))
|
|
5104
3961
|
});
|
|
5105
3962
|
flags2.unshift(ui);
|
|
@@ -5107,7 +3964,7 @@ async function checkFlagsIncludesUiFramework(flags2) {
|
|
|
5107
3964
|
}
|
|
5108
3965
|
function checkFlagsExist(flags2) {
|
|
5109
3966
|
const inValidOptions = flags2.reduce((acc, flag) => {
|
|
5110
|
-
if (!Object.hasOwn(defaultDef, flag) && !features.some((
|
|
3967
|
+
if (!Object.hasOwn(defaultDef, flag) && !features.some((f) => f.flag === flag || kebabCase2(f.flag) === kebabCase2(flag))) {
|
|
5111
3968
|
acc.push(flag);
|
|
5112
3969
|
}
|
|
5113
3970
|
return acc;
|
|
@@ -5115,7 +3972,7 @@ function checkFlagsExist(flags2) {
|
|
|
5115
3972
|
const count = inValidOptions.length;
|
|
5116
3973
|
if (count) {
|
|
5117
3974
|
console.error(
|
|
5118
|
-
`${red("\u26A0")} Unknown option${count > 1 ? "s" : ""} ${
|
|
3975
|
+
`${red("\u26A0")} Unknown option${count > 1 ? "s" : ""} ${bold2(inValidOptions.join(", "))}. Use \`--help\` to list all available options.`
|
|
5119
3976
|
);
|
|
5120
3977
|
process.exit(5);
|
|
5121
3978
|
}
|
|
@@ -5202,22 +4059,23 @@ function gitInit(cwd) {
|
|
|
5202
4059
|
async function run() {
|
|
5203
4060
|
const dir = boilerplatesDir();
|
|
5204
4061
|
const boilerplates = await loadBoilerplates(dir);
|
|
4062
|
+
const optsArgs = Object.assign({}, defaultDef, ...cliFlags.map((k) => toArg(k, findFeature(k))));
|
|
5205
4063
|
const main2 = defineCommand({
|
|
5206
4064
|
meta: {
|
|
5207
4065
|
name: package_default.name,
|
|
5208
4066
|
version: package_default.version,
|
|
5209
4067
|
description: package_default.description
|
|
5210
4068
|
},
|
|
5211
|
-
args:
|
|
5212
|
-
async run(
|
|
5213
|
-
await checkArguments(args);
|
|
4069
|
+
args: optsArgs,
|
|
4070
|
+
async run(commandContext) {
|
|
4071
|
+
const args = await checkArguments(commandContext.args);
|
|
5214
4072
|
const sources = [];
|
|
5215
4073
|
const hooks = [];
|
|
5216
4074
|
const flags2 = [
|
|
5217
4075
|
...new Set(
|
|
5218
4076
|
Object.entries(args).filter(([, val]) => val === true).flatMap(([key]) => {
|
|
5219
4077
|
const flag = [key];
|
|
5220
|
-
const dependsOn = features.find((
|
|
4078
|
+
const dependsOn = features.find((f) => f.flag === key)?.dependsOn;
|
|
5221
4079
|
if (dependsOn) {
|
|
5222
4080
|
flag.push(...dependsOn);
|
|
5223
4081
|
}
|
|
@@ -5267,8 +4125,8 @@ async function run() {
|
|
|
5267
4125
|
if (!args["skip-git"]) {
|
|
5268
4126
|
gitInit(args.project);
|
|
5269
4127
|
}
|
|
5270
|
-
const nextSteps = filteredBoilerplates.flatMap((
|
|
5271
|
-
nextSteps.sort((
|
|
4128
|
+
const nextSteps = filteredBoilerplates.flatMap((b) => b.config.nextSteps?.(meta, pm.run, colorette_exports)).filter(Boolean);
|
|
4129
|
+
nextSteps.sort((s) => s.order ?? 0);
|
|
5272
4130
|
await printOK(args.project, flags2, nextSteps);
|
|
5273
4131
|
}
|
|
5274
4132
|
});
|