create-vue 3.15.0 → 3.16.0
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/LICENSE +109 -88
- package/README.md +1 -1
- package/bundle.js +3164 -0
- package/package.json +12 -12
- package/template/base/.vscode/settings.json +1 -1
- package/template/base/package.json +2 -2
- package/template/code/default/src/components/TheWelcome.vue +1 -1
- package/template/code/router/src/components/TheWelcome.vue +1 -1
- package/template/code/typescript-default/src/components/TheWelcome.vue +1 -1
- package/template/code/typescript-router/src/components/TheWelcome.vue +1 -1
- package/template/config/cypress/package.json +2 -2
- package/template/config/cypress-ct/package.json +1 -1
- package/template/config/jsx/package.json +2 -2
- package/template/config/nightwatch/package.json +4 -4
- package/template/config/oxlint/.vscode/extensions.json +3 -0
- package/template/config/playwright/package.json +1 -1
- package/template/config/prettier/package.json +3 -1
- package/template/config/typescript/package.json +1 -1
- package/template/config/vitest/package.json +1 -1
- package/template/eslint/package.json +1 -1
- package/template/tsconfig/base/package.json +1 -1
- package/outfile.cjs +0 -2810
package/bundle.js
ADDED
|
@@ -0,0 +1,3164 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
import * as fs$5 from "node:fs";
|
|
4
|
+
import * as fs$4 from "node:fs";
|
|
5
|
+
import * as fs$3 from "node:fs";
|
|
6
|
+
import * as fs$2 from "node:fs";
|
|
7
|
+
import * as fs$1 from "node:fs";
|
|
8
|
+
import * as fs from "node:fs";
|
|
9
|
+
import * as path$5 from "node:path";
|
|
10
|
+
import * as path$4 from "node:path";
|
|
11
|
+
import * as path$3 from "node:path";
|
|
12
|
+
import * as path$2 from "node:path";
|
|
13
|
+
import * as path from "node:path";
|
|
14
|
+
import { parseArgs, stripVTControlCharacters } from "node:util";
|
|
15
|
+
import g, { stdin, stdout } from "node:process";
|
|
16
|
+
import * as f$1 from "node:readline";
|
|
17
|
+
import M from "node:readline";
|
|
18
|
+
import { WriteStream } from "node:tty";
|
|
19
|
+
import * as path$1 from "path";
|
|
20
|
+
import { pathToFileURL } from "node:url";
|
|
21
|
+
|
|
22
|
+
//#region rolldown:runtime
|
|
23
|
+
var __create = Object.create;
|
|
24
|
+
var __defProp = Object.defineProperty;
|
|
25
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
26
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
27
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
28
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
29
|
+
var __commonJS = (cb, mod) => function() {
|
|
30
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
31
|
+
};
|
|
32
|
+
var __copyProps = (to, from, except, desc) => {
|
|
33
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
34
|
+
key = keys[i];
|
|
35
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
36
|
+
get: ((k$2) => from[k$2]).bind(null, key),
|
|
37
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return to;
|
|
41
|
+
};
|
|
42
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
43
|
+
value: mod,
|
|
44
|
+
enumerable: true
|
|
45
|
+
}) : target, mod));
|
|
46
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
50
|
+
var require_src = __commonJS({ "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
|
|
51
|
+
const ESC = "\x1B";
|
|
52
|
+
const CSI = `${ESC}[`;
|
|
53
|
+
const beep = "\x07";
|
|
54
|
+
const cursor = {
|
|
55
|
+
to(x$1, y$1) {
|
|
56
|
+
if (!y$1) return `${CSI}${x$1 + 1}G`;
|
|
57
|
+
return `${CSI}${y$1 + 1};${x$1 + 1}H`;
|
|
58
|
+
},
|
|
59
|
+
move(x$1, y$1) {
|
|
60
|
+
let ret = "";
|
|
61
|
+
if (x$1 < 0) ret += `${CSI}${-x$1}D`;
|
|
62
|
+
else if (x$1 > 0) ret += `${CSI}${x$1}C`;
|
|
63
|
+
if (y$1 < 0) ret += `${CSI}${-y$1}A`;
|
|
64
|
+
else if (y$1 > 0) ret += `${CSI}${y$1}B`;
|
|
65
|
+
return ret;
|
|
66
|
+
},
|
|
67
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
68
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
69
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
70
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
71
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
72
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
73
|
+
left: `${CSI}G`,
|
|
74
|
+
hide: `${CSI}?25l`,
|
|
75
|
+
show: `${CSI}?25h`,
|
|
76
|
+
save: `${ESC}7`,
|
|
77
|
+
restore: `${ESC}8`
|
|
78
|
+
};
|
|
79
|
+
const scroll = {
|
|
80
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
81
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
82
|
+
};
|
|
83
|
+
const erase = {
|
|
84
|
+
screen: `${CSI}2J`,
|
|
85
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
86
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
87
|
+
line: `${CSI}2K`,
|
|
88
|
+
lineEnd: `${CSI}K`,
|
|
89
|
+
lineStart: `${CSI}1K`,
|
|
90
|
+
lines(count) {
|
|
91
|
+
let clear = "";
|
|
92
|
+
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
93
|
+
if (count) clear += cursor.left;
|
|
94
|
+
return clear;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
module.exports = {
|
|
98
|
+
cursor,
|
|
99
|
+
scroll,
|
|
100
|
+
erase,
|
|
101
|
+
beep
|
|
102
|
+
};
|
|
103
|
+
} });
|
|
104
|
+
var import_src = __toESM(require_src(), 1);
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
108
|
+
var require_picocolors = __commonJS({ "node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
109
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
110
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
111
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
112
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
113
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
114
|
+
};
|
|
115
|
+
let replaceClose = (string, close, replace, index) => {
|
|
116
|
+
let result = "", cursor$1 = 0;
|
|
117
|
+
do {
|
|
118
|
+
result += string.substring(cursor$1, index) + replace;
|
|
119
|
+
cursor$1 = index + close.length;
|
|
120
|
+
index = string.indexOf(close, cursor$1);
|
|
121
|
+
} while (~index);
|
|
122
|
+
return result + string.substring(cursor$1);
|
|
123
|
+
};
|
|
124
|
+
let createColors = (enabled = isColorSupported) => {
|
|
125
|
+
let f$2 = enabled ? formatter : () => String;
|
|
126
|
+
return {
|
|
127
|
+
isColorSupported: enabled,
|
|
128
|
+
reset: f$2("\x1B[0m", "\x1B[0m"),
|
|
129
|
+
bold: f$2("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
130
|
+
dim: f$2("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
131
|
+
italic: f$2("\x1B[3m", "\x1B[23m"),
|
|
132
|
+
underline: f$2("\x1B[4m", "\x1B[24m"),
|
|
133
|
+
inverse: f$2("\x1B[7m", "\x1B[27m"),
|
|
134
|
+
hidden: f$2("\x1B[8m", "\x1B[28m"),
|
|
135
|
+
strikethrough: f$2("\x1B[9m", "\x1B[29m"),
|
|
136
|
+
black: f$2("\x1B[30m", "\x1B[39m"),
|
|
137
|
+
red: f$2("\x1B[31m", "\x1B[39m"),
|
|
138
|
+
green: f$2("\x1B[32m", "\x1B[39m"),
|
|
139
|
+
yellow: f$2("\x1B[33m", "\x1B[39m"),
|
|
140
|
+
blue: f$2("\x1B[34m", "\x1B[39m"),
|
|
141
|
+
magenta: f$2("\x1B[35m", "\x1B[39m"),
|
|
142
|
+
cyan: f$2("\x1B[36m", "\x1B[39m"),
|
|
143
|
+
white: f$2("\x1B[37m", "\x1B[39m"),
|
|
144
|
+
gray: f$2("\x1B[90m", "\x1B[39m"),
|
|
145
|
+
bgBlack: f$2("\x1B[40m", "\x1B[49m"),
|
|
146
|
+
bgRed: f$2("\x1B[41m", "\x1B[49m"),
|
|
147
|
+
bgGreen: f$2("\x1B[42m", "\x1B[49m"),
|
|
148
|
+
bgYellow: f$2("\x1B[43m", "\x1B[49m"),
|
|
149
|
+
bgBlue: f$2("\x1B[44m", "\x1B[49m"),
|
|
150
|
+
bgMagenta: f$2("\x1B[45m", "\x1B[49m"),
|
|
151
|
+
bgCyan: f$2("\x1B[46m", "\x1B[49m"),
|
|
152
|
+
bgWhite: f$2("\x1B[47m", "\x1B[49m"),
|
|
153
|
+
blackBright: f$2("\x1B[90m", "\x1B[39m"),
|
|
154
|
+
redBright: f$2("\x1B[91m", "\x1B[39m"),
|
|
155
|
+
greenBright: f$2("\x1B[92m", "\x1B[39m"),
|
|
156
|
+
yellowBright: f$2("\x1B[93m", "\x1B[39m"),
|
|
157
|
+
blueBright: f$2("\x1B[94m", "\x1B[39m"),
|
|
158
|
+
magentaBright: f$2("\x1B[95m", "\x1B[39m"),
|
|
159
|
+
cyanBright: f$2("\x1B[96m", "\x1B[39m"),
|
|
160
|
+
whiteBright: f$2("\x1B[97m", "\x1B[39m"),
|
|
161
|
+
bgBlackBright: f$2("\x1B[100m", "\x1B[49m"),
|
|
162
|
+
bgRedBright: f$2("\x1B[101m", "\x1B[49m"),
|
|
163
|
+
bgGreenBright: f$2("\x1B[102m", "\x1B[49m"),
|
|
164
|
+
bgYellowBright: f$2("\x1B[103m", "\x1B[49m"),
|
|
165
|
+
bgBlueBright: f$2("\x1B[104m", "\x1B[49m"),
|
|
166
|
+
bgMagentaBright: f$2("\x1B[105m", "\x1B[49m"),
|
|
167
|
+
bgCyanBright: f$2("\x1B[106m", "\x1B[49m"),
|
|
168
|
+
bgWhiteBright: f$2("\x1B[107m", "\x1B[49m")
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
module.exports = createColors();
|
|
172
|
+
module.exports.createColors = createColors;
|
|
173
|
+
} });
|
|
174
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
175
|
+
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region node_modules/.pnpm/@clack+core@0.4.1/node_modules/@clack/core/dist/index.mjs
|
|
178
|
+
function J$1({ onlyFirst: t = !1 } = {}) {
|
|
179
|
+
const F$1 = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
180
|
+
return new RegExp(F$1, t ? void 0 : "g");
|
|
181
|
+
}
|
|
182
|
+
const Q = J$1();
|
|
183
|
+
function T$1(t) {
|
|
184
|
+
if (typeof t != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
|
|
185
|
+
return t.replace(Q, "");
|
|
186
|
+
}
|
|
187
|
+
function O(t) {
|
|
188
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
189
|
+
}
|
|
190
|
+
var P$1 = { exports: {} };
|
|
191
|
+
(function(t) {
|
|
192
|
+
var u$1 = {};
|
|
193
|
+
t.exports = u$1, u$1.eastAsianWidth = function(e) {
|
|
194
|
+
var s = e.charCodeAt(0), i = e.length == 2 ? e.charCodeAt(1) : 0, D$1 = s;
|
|
195
|
+
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D$1 = s << 10 | i, D$1 += 65536), D$1 == 12288 || 65281 <= D$1 && D$1 <= 65376 || 65504 <= D$1 && D$1 <= 65510 ? "F" : D$1 == 8361 || 65377 <= D$1 && D$1 <= 65470 || 65474 <= D$1 && D$1 <= 65479 || 65482 <= D$1 && D$1 <= 65487 || 65490 <= D$1 && D$1 <= 65495 || 65498 <= D$1 && D$1 <= 65500 || 65512 <= D$1 && D$1 <= 65518 ? "H" : 4352 <= D$1 && D$1 <= 4447 || 4515 <= D$1 && D$1 <= 4519 || 4602 <= D$1 && D$1 <= 4607 || 9001 <= D$1 && D$1 <= 9002 || 11904 <= D$1 && D$1 <= 11929 || 11931 <= D$1 && D$1 <= 12019 || 12032 <= D$1 && D$1 <= 12245 || 12272 <= D$1 && D$1 <= 12283 || 12289 <= D$1 && D$1 <= 12350 || 12353 <= D$1 && D$1 <= 12438 || 12441 <= D$1 && D$1 <= 12543 || 12549 <= D$1 && D$1 <= 12589 || 12593 <= D$1 && D$1 <= 12686 || 12688 <= D$1 && D$1 <= 12730 || 12736 <= D$1 && D$1 <= 12771 || 12784 <= D$1 && D$1 <= 12830 || 12832 <= D$1 && D$1 <= 12871 || 12880 <= D$1 && D$1 <= 13054 || 13056 <= D$1 && D$1 <= 19903 || 19968 <= D$1 && D$1 <= 42124 || 42128 <= D$1 && D$1 <= 42182 || 43360 <= D$1 && D$1 <= 43388 || 44032 <= D$1 && D$1 <= 55203 || 55216 <= D$1 && D$1 <= 55238 || 55243 <= D$1 && D$1 <= 55291 || 63744 <= D$1 && D$1 <= 64255 || 65040 <= D$1 && D$1 <= 65049 || 65072 <= D$1 && D$1 <= 65106 || 65108 <= D$1 && D$1 <= 65126 || 65128 <= D$1 && D$1 <= 65131 || 110592 <= D$1 && D$1 <= 110593 || 127488 <= D$1 && D$1 <= 127490 || 127504 <= D$1 && D$1 <= 127546 || 127552 <= D$1 && D$1 <= 127560 || 127568 <= D$1 && D$1 <= 127569 || 131072 <= D$1 && D$1 <= 194367 || 177984 <= D$1 && D$1 <= 196605 || 196608 <= D$1 && D$1 <= 262141 ? "W" : 32 <= D$1 && D$1 <= 126 || 162 <= D$1 && D$1 <= 163 || 165 <= D$1 && D$1 <= 166 || D$1 == 172 || D$1 == 175 || 10214 <= D$1 && D$1 <= 10221 || 10629 <= D$1 && D$1 <= 10630 ? "Na" : D$1 == 161 || D$1 == 164 || 167 <= D$1 && D$1 <= 168 || D$1 == 170 || 173 <= D$1 && D$1 <= 174 || 176 <= D$1 && D$1 <= 180 || 182 <= D$1 && D$1 <= 186 || 188 <= D$1 && D$1 <= 191 || D$1 == 198 || D$1 == 208 || 215 <= D$1 && D$1 <= 216 || 222 <= D$1 && D$1 <= 225 || D$1 == 230 || 232 <= D$1 && D$1 <= 234 || 236 <= D$1 && D$1 <= 237 || D$1 == 240 || 242 <= D$1 && D$1 <= 243 || 247 <= D$1 && D$1 <= 250 || D$1 == 252 || D$1 == 254 || D$1 == 257 || D$1 == 273 || D$1 == 275 || D$1 == 283 || 294 <= D$1 && D$1 <= 295 || D$1 == 299 || 305 <= D$1 && D$1 <= 307 || D$1 == 312 || 319 <= D$1 && D$1 <= 322 || D$1 == 324 || 328 <= D$1 && D$1 <= 331 || D$1 == 333 || 338 <= D$1 && D$1 <= 339 || 358 <= D$1 && D$1 <= 359 || D$1 == 363 || D$1 == 462 || D$1 == 464 || D$1 == 466 || D$1 == 468 || D$1 == 470 || D$1 == 472 || D$1 == 474 || D$1 == 476 || D$1 == 593 || D$1 == 609 || D$1 == 708 || D$1 == 711 || 713 <= D$1 && D$1 <= 715 || D$1 == 717 || D$1 == 720 || 728 <= D$1 && D$1 <= 731 || D$1 == 733 || D$1 == 735 || 768 <= D$1 && D$1 <= 879 || 913 <= D$1 && D$1 <= 929 || 931 <= D$1 && D$1 <= 937 || 945 <= D$1 && D$1 <= 961 || 963 <= D$1 && D$1 <= 969 || D$1 == 1025 || 1040 <= D$1 && D$1 <= 1103 || D$1 == 1105 || D$1 == 8208 || 8211 <= D$1 && D$1 <= 8214 || 8216 <= D$1 && D$1 <= 8217 || 8220 <= D$1 && D$1 <= 8221 || 8224 <= D$1 && D$1 <= 8226 || 8228 <= D$1 && D$1 <= 8231 || D$1 == 8240 || 8242 <= D$1 && D$1 <= 8243 || D$1 == 8245 || D$1 == 8251 || D$1 == 8254 || D$1 == 8308 || D$1 == 8319 || 8321 <= D$1 && D$1 <= 8324 || D$1 == 8364 || D$1 == 8451 || D$1 == 8453 || D$1 == 8457 || D$1 == 8467 || D$1 == 8470 || 8481 <= D$1 && D$1 <= 8482 || D$1 == 8486 || D$1 == 8491 || 8531 <= D$1 && D$1 <= 8532 || 8539 <= D$1 && D$1 <= 8542 || 8544 <= D$1 && D$1 <= 8555 || 8560 <= D$1 && D$1 <= 8569 || D$1 == 8585 || 8592 <= D$1 && D$1 <= 8601 || 8632 <= D$1 && D$1 <= 8633 || D$1 == 8658 || D$1 == 8660 || D$1 == 8679 || D$1 == 8704 || 8706 <= D$1 && D$1 <= 8707 || 8711 <= D$1 && D$1 <= 8712 || D$1 == 8715 || D$1 == 8719 || D$1 == 8721 || D$1 == 8725 || D$1 == 8730 || 8733 <= D$1 && D$1 <= 8736 || D$1 == 8739 || D$1 == 8741 || 8743 <= D$1 && D$1 <= 8748 || D$1 == 8750 || 8756 <= D$1 && D$1 <= 8759 || 8764 <= D$1 && D$1 <= 8765 || D$1 == 8776 || D$1 == 8780 || D$1 == 8786 || 8800 <= D$1 && D$1 <= 8801 || 8804 <= D$1 && D$1 <= 8807 || 8810 <= D$1 && D$1 <= 8811 || 8814 <= D$1 && D$1 <= 8815 || 8834 <= D$1 && D$1 <= 8835 || 8838 <= D$1 && D$1 <= 8839 || D$1 == 8853 || D$1 == 8857 || D$1 == 8869 || D$1 == 8895 || D$1 == 8978 || 9312 <= D$1 && D$1 <= 9449 || 9451 <= D$1 && D$1 <= 9547 || 9552 <= D$1 && D$1 <= 9587 || 9600 <= D$1 && D$1 <= 9615 || 9618 <= D$1 && D$1 <= 9621 || 9632 <= D$1 && D$1 <= 9633 || 9635 <= D$1 && D$1 <= 9641 || 9650 <= D$1 && D$1 <= 9651 || 9654 <= D$1 && D$1 <= 9655 || 9660 <= D$1 && D$1 <= 9661 || 9664 <= D$1 && D$1 <= 9665 || 9670 <= D$1 && D$1 <= 9672 || D$1 == 9675 || 9678 <= D$1 && D$1 <= 9681 || 9698 <= D$1 && D$1 <= 9701 || D$1 == 9711 || 9733 <= D$1 && D$1 <= 9734 || D$1 == 9737 || 9742 <= D$1 && D$1 <= 9743 || 9748 <= D$1 && D$1 <= 9749 || D$1 == 9756 || D$1 == 9758 || D$1 == 9792 || D$1 == 9794 || 9824 <= D$1 && D$1 <= 9825 || 9827 <= D$1 && D$1 <= 9829 || 9831 <= D$1 && D$1 <= 9834 || 9836 <= D$1 && D$1 <= 9837 || D$1 == 9839 || 9886 <= D$1 && D$1 <= 9887 || 9918 <= D$1 && D$1 <= 9919 || 9924 <= D$1 && D$1 <= 9933 || 9935 <= D$1 && D$1 <= 9953 || D$1 == 9955 || 9960 <= D$1 && D$1 <= 9983 || D$1 == 10045 || D$1 == 10071 || 10102 <= D$1 && D$1 <= 10111 || 11093 <= D$1 && D$1 <= 11097 || 12872 <= D$1 && D$1 <= 12879 || 57344 <= D$1 && D$1 <= 63743 || 65024 <= D$1 && D$1 <= 65039 || D$1 == 65533 || 127232 <= D$1 && D$1 <= 127242 || 127248 <= D$1 && D$1 <= 127277 || 127280 <= D$1 && D$1 <= 127337 || 127344 <= D$1 && D$1 <= 127386 || 917760 <= D$1 && D$1 <= 917999 || 983040 <= D$1 && D$1 <= 1048573 || 1048576 <= D$1 && D$1 <= 1114109 ? "A" : "N";
|
|
196
|
+
}, u$1.characterLength = function(e) {
|
|
197
|
+
var s = this.eastAsianWidth(e);
|
|
198
|
+
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
199
|
+
};
|
|
200
|
+
function F$1(e) {
|
|
201
|
+
return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
202
|
+
}
|
|
203
|
+
u$1.length = function(e) {
|
|
204
|
+
for (var s = F$1(e), i = 0, D$1 = 0; D$1 < s.length; D$1++) i = i + this.characterLength(s[D$1]);
|
|
205
|
+
return i;
|
|
206
|
+
}, u$1.slice = function(e, s, i) {
|
|
207
|
+
textLen = u$1.length(e), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
208
|
+
for (var D$1 = "", C$1 = 0, o$1 = F$1(e), E = 0; E < o$1.length; E++) {
|
|
209
|
+
var a = o$1[E], n = u$1.length(a);
|
|
210
|
+
if (C$1 >= s - (n == 2 ? 1 : 0)) if (C$1 + n <= i) D$1 += a;
|
|
211
|
+
else break;
|
|
212
|
+
C$1 += n;
|
|
213
|
+
}
|
|
214
|
+
return D$1;
|
|
215
|
+
};
|
|
216
|
+
})(P$1);
|
|
217
|
+
var X = P$1.exports;
|
|
218
|
+
const DD = O(X);
|
|
219
|
+
var uD = function() {
|
|
220
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\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|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\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]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
221
|
+
};
|
|
222
|
+
const FD = O(uD);
|
|
223
|
+
function A$1(t, u$1 = {}) {
|
|
224
|
+
if (typeof t != "string" || t.length === 0 || (u$1 = {
|
|
225
|
+
ambiguousIsNarrow: !0,
|
|
226
|
+
...u$1
|
|
227
|
+
}, t = T$1(t), t.length === 0)) return 0;
|
|
228
|
+
t = t.replace(FD(), " ");
|
|
229
|
+
const F$1 = u$1.ambiguousIsNarrow ? 1 : 2;
|
|
230
|
+
let e = 0;
|
|
231
|
+
for (const s of t) {
|
|
232
|
+
const i = s.codePointAt(0);
|
|
233
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
|
|
234
|
+
switch (DD.eastAsianWidth(s)) {
|
|
235
|
+
case "F":
|
|
236
|
+
case "W":
|
|
237
|
+
e += 2;
|
|
238
|
+
break;
|
|
239
|
+
case "A":
|
|
240
|
+
e += F$1;
|
|
241
|
+
break;
|
|
242
|
+
default: e += 1;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return e;
|
|
246
|
+
}
|
|
247
|
+
const m = 10, L$1 = (t = 0) => (u$1) => `\x1B[${u$1 + t}m`, N = (t = 0) => (u$1) => `\x1B[${38 + t};5;${u$1}m`, I = (t = 0) => (u$1, F$1, e) => `\x1B[${38 + t};2;${u$1};${F$1};${e}m`, r = {
|
|
248
|
+
modifier: {
|
|
249
|
+
reset: [0, 0],
|
|
250
|
+
bold: [1, 22],
|
|
251
|
+
dim: [2, 22],
|
|
252
|
+
italic: [3, 23],
|
|
253
|
+
underline: [4, 24],
|
|
254
|
+
overline: [53, 55],
|
|
255
|
+
inverse: [7, 27],
|
|
256
|
+
hidden: [8, 28],
|
|
257
|
+
strikethrough: [9, 29]
|
|
258
|
+
},
|
|
259
|
+
color: {
|
|
260
|
+
black: [30, 39],
|
|
261
|
+
red: [31, 39],
|
|
262
|
+
green: [32, 39],
|
|
263
|
+
yellow: [33, 39],
|
|
264
|
+
blue: [34, 39],
|
|
265
|
+
magenta: [35, 39],
|
|
266
|
+
cyan: [36, 39],
|
|
267
|
+
white: [37, 39],
|
|
268
|
+
blackBright: [90, 39],
|
|
269
|
+
gray: [90, 39],
|
|
270
|
+
grey: [90, 39],
|
|
271
|
+
redBright: [91, 39],
|
|
272
|
+
greenBright: [92, 39],
|
|
273
|
+
yellowBright: [93, 39],
|
|
274
|
+
blueBright: [94, 39],
|
|
275
|
+
magentaBright: [95, 39],
|
|
276
|
+
cyanBright: [96, 39],
|
|
277
|
+
whiteBright: [97, 39]
|
|
278
|
+
},
|
|
279
|
+
bgColor: {
|
|
280
|
+
bgBlack: [40, 49],
|
|
281
|
+
bgRed: [41, 49],
|
|
282
|
+
bgGreen: [42, 49],
|
|
283
|
+
bgYellow: [43, 49],
|
|
284
|
+
bgBlue: [44, 49],
|
|
285
|
+
bgMagenta: [45, 49],
|
|
286
|
+
bgCyan: [46, 49],
|
|
287
|
+
bgWhite: [47, 49],
|
|
288
|
+
bgBlackBright: [100, 49],
|
|
289
|
+
bgGray: [100, 49],
|
|
290
|
+
bgGrey: [100, 49],
|
|
291
|
+
bgRedBright: [101, 49],
|
|
292
|
+
bgGreenBright: [102, 49],
|
|
293
|
+
bgYellowBright: [103, 49],
|
|
294
|
+
bgBlueBright: [104, 49],
|
|
295
|
+
bgMagentaBright: [105, 49],
|
|
296
|
+
bgCyanBright: [106, 49],
|
|
297
|
+
bgWhiteBright: [107, 49]
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
Object.keys(r.modifier);
|
|
301
|
+
const tD = Object.keys(r.color), eD = Object.keys(r.bgColor);
|
|
302
|
+
[...tD, ...eD];
|
|
303
|
+
function sD() {
|
|
304
|
+
const t = new Map();
|
|
305
|
+
for (const [u$1, F$1] of Object.entries(r)) {
|
|
306
|
+
for (const [e, s] of Object.entries(F$1)) r[e] = {
|
|
307
|
+
open: `\x1B[${s[0]}m`,
|
|
308
|
+
close: `\x1B[${s[1]}m`
|
|
309
|
+
}, F$1[e] = r[e], t.set(s[0], s[1]);
|
|
310
|
+
Object.defineProperty(r, u$1, {
|
|
311
|
+
value: F$1,
|
|
312
|
+
enumerable: !1
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
return Object.defineProperty(r, "codes", {
|
|
316
|
+
value: t,
|
|
317
|
+
enumerable: !1
|
|
318
|
+
}), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L$1(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L$1(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, {
|
|
319
|
+
rgbToAnsi256: {
|
|
320
|
+
value: (u$1, F$1, e) => u$1 === F$1 && F$1 === e ? u$1 < 8 ? 16 : u$1 > 248 ? 231 : Math.round((u$1 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u$1 / 255 * 5) + 6 * Math.round(F$1 / 255 * 5) + Math.round(e / 255 * 5),
|
|
321
|
+
enumerable: !1
|
|
322
|
+
},
|
|
323
|
+
hexToRgb: {
|
|
324
|
+
value: (u$1) => {
|
|
325
|
+
const F$1 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u$1.toString(16));
|
|
326
|
+
if (!F$1) return [
|
|
327
|
+
0,
|
|
328
|
+
0,
|
|
329
|
+
0
|
|
330
|
+
];
|
|
331
|
+
let [e] = F$1;
|
|
332
|
+
e.length === 3 && (e = [...e].map((i) => i + i).join(""));
|
|
333
|
+
const s = Number.parseInt(e, 16);
|
|
334
|
+
return [
|
|
335
|
+
s >> 16 & 255,
|
|
336
|
+
s >> 8 & 255,
|
|
337
|
+
s & 255
|
|
338
|
+
];
|
|
339
|
+
},
|
|
340
|
+
enumerable: !1
|
|
341
|
+
},
|
|
342
|
+
hexToAnsi256: {
|
|
343
|
+
value: (u$1) => r.rgbToAnsi256(...r.hexToRgb(u$1)),
|
|
344
|
+
enumerable: !1
|
|
345
|
+
},
|
|
346
|
+
ansi256ToAnsi: {
|
|
347
|
+
value: (u$1) => {
|
|
348
|
+
if (u$1 < 8) return 30 + u$1;
|
|
349
|
+
if (u$1 < 16) return 90 + (u$1 - 8);
|
|
350
|
+
let F$1, e, s;
|
|
351
|
+
if (u$1 >= 232) F$1 = ((u$1 - 232) * 10 + 8) / 255, e = F$1, s = F$1;
|
|
352
|
+
else {
|
|
353
|
+
u$1 -= 16;
|
|
354
|
+
const C$1 = u$1 % 36;
|
|
355
|
+
F$1 = Math.floor(u$1 / 36) / 5, e = Math.floor(C$1 / 6) / 5, s = C$1 % 6 / 5;
|
|
356
|
+
}
|
|
357
|
+
const i = Math.max(F$1, e, s) * 2;
|
|
358
|
+
if (i === 0) return 30;
|
|
359
|
+
let D$1 = 30 + (Math.round(s) << 2 | Math.round(e) << 1 | Math.round(F$1));
|
|
360
|
+
return i === 2 && (D$1 += 60), D$1;
|
|
361
|
+
},
|
|
362
|
+
enumerable: !1
|
|
363
|
+
},
|
|
364
|
+
rgbToAnsi: {
|
|
365
|
+
value: (u$1, F$1, e) => r.ansi256ToAnsi(r.rgbToAnsi256(u$1, F$1, e)),
|
|
366
|
+
enumerable: !1
|
|
367
|
+
},
|
|
368
|
+
hexToAnsi: {
|
|
369
|
+
value: (u$1) => r.ansi256ToAnsi(r.hexToAnsi256(u$1)),
|
|
370
|
+
enumerable: !1
|
|
371
|
+
}
|
|
372
|
+
}), r;
|
|
373
|
+
}
|
|
374
|
+
const iD = sD(), v = new Set(["\x1B", ""]), CD = 39, w$1 = "\x07", W$1 = "[", rD = "]", R = "m", y = `${rD}8;;`, V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`, z = (t) => `${v.values().next().value}${y}${t}${w$1}`, ED = (t) => t.split(" ").map((u$1) => A$1(u$1)), _$1 = (t, u$1, F$1) => {
|
|
375
|
+
const e = [...u$1];
|
|
376
|
+
let s = !1, i = !1, D$1 = A$1(T$1(t[t.length - 1]));
|
|
377
|
+
for (const [C$1, o$1] of e.entries()) {
|
|
378
|
+
const E = A$1(o$1);
|
|
379
|
+
if (D$1 + E <= F$1 ? t[t.length - 1] += o$1 : (t.push(o$1), D$1 = 0), v.has(o$1) && (s = !0, i = e.slice(C$1 + 1).join("").startsWith(y)), s) {
|
|
380
|
+
i ? o$1 === w$1 && (s = !1, i = !1) : o$1 === R && (s = !1);
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
D$1 += E, D$1 === F$1 && C$1 < e.length - 1 && (t.push(""), D$1 = 0);
|
|
384
|
+
}
|
|
385
|
+
!D$1 && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
386
|
+
}, nD = (t) => {
|
|
387
|
+
const u$1 = t.split(" ");
|
|
388
|
+
let F$1 = u$1.length;
|
|
389
|
+
for (; F$1 > 0 && !(A$1(u$1[F$1 - 1]) > 0);) F$1--;
|
|
390
|
+
return F$1 === u$1.length ? t : u$1.slice(0, F$1).join(" ") + u$1.slice(F$1).join("");
|
|
391
|
+
}, oD = (t, u$1, F$1 = {}) => {
|
|
392
|
+
if (F$1.trim !== !1 && t.trim() === "") return "";
|
|
393
|
+
let e = "", s, i;
|
|
394
|
+
const D$1 = ED(t);
|
|
395
|
+
let C$1 = [""];
|
|
396
|
+
for (const [E, a] of t.split(" ").entries()) {
|
|
397
|
+
F$1.trim !== !1 && (C$1[C$1.length - 1] = C$1[C$1.length - 1].trimStart());
|
|
398
|
+
let n = A$1(C$1[C$1.length - 1]);
|
|
399
|
+
if (E !== 0 && (n >= u$1 && (F$1.wordWrap === !1 || F$1.trim === !1) && (C$1.push(""), n = 0), (n > 0 || F$1.trim === !1) && (C$1[C$1.length - 1] += " ", n++)), F$1.hard && D$1[E] > u$1) {
|
|
400
|
+
const B$1 = u$1 - n, p$1 = 1 + Math.floor((D$1[E] - B$1 - 1) / u$1);
|
|
401
|
+
Math.floor((D$1[E] - 1) / u$1) < p$1 && C$1.push(""), _$1(C$1, a, u$1);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if (n + D$1[E] > u$1 && n > 0 && D$1[E] > 0) {
|
|
405
|
+
if (F$1.wordWrap === !1 && n < u$1) {
|
|
406
|
+
_$1(C$1, a, u$1);
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
C$1.push("");
|
|
410
|
+
}
|
|
411
|
+
if (n + D$1[E] > u$1 && F$1.wordWrap === !1) {
|
|
412
|
+
_$1(C$1, a, u$1);
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
C$1[C$1.length - 1] += a;
|
|
416
|
+
}
|
|
417
|
+
F$1.trim !== !1 && (C$1 = C$1.map((E) => nD(E)));
|
|
418
|
+
const o$1 = [...C$1.join(`
|
|
419
|
+
`)];
|
|
420
|
+
for (const [E, a] of o$1.entries()) {
|
|
421
|
+
if (e += a, v.has(a)) {
|
|
422
|
+
const { groups: B$1 } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o$1.slice(E).join("")) || { groups: {} };
|
|
423
|
+
if (B$1.code !== void 0) {
|
|
424
|
+
const p$1 = Number.parseFloat(B$1.code);
|
|
425
|
+
s = p$1 === CD ? void 0 : p$1;
|
|
426
|
+
} else B$1.uri !== void 0 && (i = B$1.uri.length === 0 ? void 0 : B$1.uri);
|
|
427
|
+
}
|
|
428
|
+
const n = iD.codes.get(Number(s));
|
|
429
|
+
o$1[E + 1] === `
|
|
430
|
+
` ? (i && (e += z("")), s && n && (e += V$1(n))) : a === `
|
|
431
|
+
` && (s && n && (e += V$1(s)), i && (e += z(i)));
|
|
432
|
+
}
|
|
433
|
+
return e;
|
|
434
|
+
};
|
|
435
|
+
function G(t, u$1, F$1) {
|
|
436
|
+
return String(t).normalize().replace(/\r\n/g, `
|
|
437
|
+
`).split(`
|
|
438
|
+
`).map((e) => oD(e, u$1, F$1)).join(`
|
|
439
|
+
`);
|
|
440
|
+
}
|
|
441
|
+
const aD = [
|
|
442
|
+
"up",
|
|
443
|
+
"down",
|
|
444
|
+
"left",
|
|
445
|
+
"right",
|
|
446
|
+
"space",
|
|
447
|
+
"enter",
|
|
448
|
+
"cancel"
|
|
449
|
+
], c = {
|
|
450
|
+
actions: new Set(aD),
|
|
451
|
+
aliases: new Map([
|
|
452
|
+
["k", "up"],
|
|
453
|
+
["j", "down"],
|
|
454
|
+
["h", "left"],
|
|
455
|
+
["l", "right"],
|
|
456
|
+
["", "cancel"],
|
|
457
|
+
["escape", "cancel"]
|
|
458
|
+
])
|
|
459
|
+
};
|
|
460
|
+
function k$1(t, u$1) {
|
|
461
|
+
if (typeof t == "string") return c.aliases.get(t) === u$1;
|
|
462
|
+
for (const F$1 of t) if (F$1 !== void 0 && k$1(F$1, u$1)) return !0;
|
|
463
|
+
return !1;
|
|
464
|
+
}
|
|
465
|
+
function lD(t, u$1) {
|
|
466
|
+
if (t === u$1) return;
|
|
467
|
+
const F$1 = t.split(`
|
|
468
|
+
`), e = u$1.split(`
|
|
469
|
+
`), s = [];
|
|
470
|
+
for (let i = 0; i < Math.max(F$1.length, e.length); i++) F$1[i] !== e[i] && s.push(i);
|
|
471
|
+
return s;
|
|
472
|
+
}
|
|
473
|
+
const xD = globalThis.process.platform.startsWith("win"), S = Symbol("clack:cancel");
|
|
474
|
+
function BD(t) {
|
|
475
|
+
return t === S;
|
|
476
|
+
}
|
|
477
|
+
function d$1(t, u$1) {
|
|
478
|
+
const F$1 = t;
|
|
479
|
+
F$1.isTTY && F$1.setRawMode(u$1);
|
|
480
|
+
}
|
|
481
|
+
function cD({ input: t = stdin, output: u$1 = stdout, overwrite: F$1 = !0, hideCursor: e = !0 } = {}) {
|
|
482
|
+
const s = f$1.createInterface({
|
|
483
|
+
input: t,
|
|
484
|
+
output: u$1,
|
|
485
|
+
prompt: "",
|
|
486
|
+
tabSize: 1
|
|
487
|
+
});
|
|
488
|
+
f$1.emitKeypressEvents(t, s), t.isTTY && t.setRawMode(!0);
|
|
489
|
+
const i = (D$1, { name: C$1, sequence: o$1 }) => {
|
|
490
|
+
const E = String(D$1);
|
|
491
|
+
if (k$1([
|
|
492
|
+
E,
|
|
493
|
+
C$1,
|
|
494
|
+
o$1
|
|
495
|
+
], "cancel")) {
|
|
496
|
+
e && u$1.write(import_src.cursor.show), process.exit(0);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if (!F$1) return;
|
|
500
|
+
const a = C$1 === "return" ? 0 : -1, n = C$1 === "return" ? -1 : 0;
|
|
501
|
+
f$1.moveCursor(u$1, a, n, () => {
|
|
502
|
+
f$1.clearLine(u$1, 1, () => {
|
|
503
|
+
t.once("keypress", i);
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
};
|
|
507
|
+
return e && u$1.write(import_src.cursor.hide), t.once("keypress", i), () => {
|
|
508
|
+
t.off("keypress", i), e && u$1.write(import_src.cursor.show), t.isTTY && !xD && t.setRawMode(!1), s.terminal = !1, s.close();
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
var AD = Object.defineProperty, pD = (t, u$1, F$1) => u$1 in t ? AD(t, u$1, {
|
|
512
|
+
enumerable: !0,
|
|
513
|
+
configurable: !0,
|
|
514
|
+
writable: !0,
|
|
515
|
+
value: F$1
|
|
516
|
+
}) : t[u$1] = F$1, h = (t, u$1, F$1) => (pD(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1);
|
|
517
|
+
var x = class {
|
|
518
|
+
constructor(u$1, F$1 = !0) {
|
|
519
|
+
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", !1), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
520
|
+
const { input: e = stdin, output: s = stdout, render: i, signal: D$1,...C$1 } = u$1;
|
|
521
|
+
this.opts = C$1, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F$1, this._abortSignal = D$1, this.input = e, this.output = s;
|
|
522
|
+
}
|
|
523
|
+
unsubscribe() {
|
|
524
|
+
this._subscribers.clear();
|
|
525
|
+
}
|
|
526
|
+
setSubscriber(u$1, F$1) {
|
|
527
|
+
const e = this._subscribers.get(u$1) ?? [];
|
|
528
|
+
e.push(F$1), this._subscribers.set(u$1, e);
|
|
529
|
+
}
|
|
530
|
+
on(u$1, F$1) {
|
|
531
|
+
this.setSubscriber(u$1, { cb: F$1 });
|
|
532
|
+
}
|
|
533
|
+
once(u$1, F$1) {
|
|
534
|
+
this.setSubscriber(u$1, {
|
|
535
|
+
cb: F$1,
|
|
536
|
+
once: !0
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
emit(u$1, ...F$1) {
|
|
540
|
+
const e = this._subscribers.get(u$1) ?? [], s = [];
|
|
541
|
+
for (const i of e) i.cb(...F$1), i.once && s.push(() => e.splice(e.indexOf(i), 1));
|
|
542
|
+
for (const i of s) i();
|
|
543
|
+
}
|
|
544
|
+
prompt() {
|
|
545
|
+
return new Promise((u$1, F$1) => {
|
|
546
|
+
if (this._abortSignal) {
|
|
547
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u$1(S);
|
|
548
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
549
|
+
this.state = "cancel", this.close();
|
|
550
|
+
}, { once: !0 });
|
|
551
|
+
}
|
|
552
|
+
const e = new WriteStream(0);
|
|
553
|
+
e._write = (s, i, D$1) => {
|
|
554
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D$1();
|
|
555
|
+
}, this.input.pipe(e), this.rl = M.createInterface({
|
|
556
|
+
input: this.input,
|
|
557
|
+
output: e,
|
|
558
|
+
tabSize: 2,
|
|
559
|
+
prompt: "",
|
|
560
|
+
escapeCodeTimeout: 50
|
|
561
|
+
}), M.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
562
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), d$1(this.input, !1), u$1(this.value);
|
|
563
|
+
}), this.once("cancel", () => {
|
|
564
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), d$1(this.input, !1), u$1(S);
|
|
565
|
+
});
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
onKeypress(u$1, F$1) {
|
|
569
|
+
if (this.state === "error" && (this.state = "active"), F$1?.name && (!this._track && c.aliases.has(F$1.name) && this.emit("cursor", c.aliases.get(F$1.name)), c.actions.has(F$1.name) && this.emit("cursor", F$1.name)), u$1 && (u$1.toLowerCase() === "y" || u$1.toLowerCase() === "n") && this.emit("confirm", u$1.toLowerCase() === "y"), u$1 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u$1 && this.emit("key", u$1.toLowerCase()), F$1?.name === "return") {
|
|
570
|
+
if (this.opts.validate) {
|
|
571
|
+
const e = this.opts.validate(this.value);
|
|
572
|
+
e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.value));
|
|
573
|
+
}
|
|
574
|
+
this.state !== "error" && (this.state = "submit");
|
|
575
|
+
}
|
|
576
|
+
k$1([
|
|
577
|
+
u$1,
|
|
578
|
+
F$1?.name,
|
|
579
|
+
F$1?.sequence
|
|
580
|
+
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
581
|
+
}
|
|
582
|
+
close() {
|
|
583
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
584
|
+
`), d$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
585
|
+
}
|
|
586
|
+
restoreCursor() {
|
|
587
|
+
const u$1 = G(this._prevFrame, process.stdout.columns, { hard: !0 }).split(`
|
|
588
|
+
`).length - 1;
|
|
589
|
+
this.output.write(import_src.cursor.move(-999, u$1 * -1));
|
|
590
|
+
}
|
|
591
|
+
render() {
|
|
592
|
+
const u$1 = G(this._render(this) ?? "", process.stdout.columns, { hard: !0 });
|
|
593
|
+
if (u$1 !== this._prevFrame) {
|
|
594
|
+
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
595
|
+
else {
|
|
596
|
+
const F$1 = lD(this._prevFrame, u$1);
|
|
597
|
+
if (this.restoreCursor(), F$1 && F$1?.length === 1) {
|
|
598
|
+
const e = F$1[0];
|
|
599
|
+
this.output.write(import_src.cursor.move(0, e)), this.output.write(import_src.erase.lines(1));
|
|
600
|
+
const s = u$1.split(`
|
|
601
|
+
`);
|
|
602
|
+
this.output.write(s[e]), this._prevFrame = u$1, this.output.write(import_src.cursor.move(0, s.length - e - 1));
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
if (F$1 && F$1?.length > 1) {
|
|
606
|
+
const e = F$1[0];
|
|
607
|
+
this.output.write(import_src.cursor.move(0, e)), this.output.write(import_src.erase.down());
|
|
608
|
+
const s = u$1.split(`
|
|
609
|
+
`).slice(e);
|
|
610
|
+
this.output.write(s.join(`
|
|
611
|
+
`)), this._prevFrame = u$1;
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
this.output.write(import_src.erase.down());
|
|
615
|
+
}
|
|
616
|
+
this.output.write(u$1), this.state === "initial" && (this.state = "active"), this._prevFrame = u$1;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
var fD = class extends x {
|
|
621
|
+
get cursor() {
|
|
622
|
+
return this.value ? 0 : 1;
|
|
623
|
+
}
|
|
624
|
+
get _value() {
|
|
625
|
+
return this.cursor === 0;
|
|
626
|
+
}
|
|
627
|
+
constructor(u$1) {
|
|
628
|
+
super(u$1, !1), this.value = !!u$1.initialValue, this.on("value", () => {
|
|
629
|
+
this.value = this._value;
|
|
630
|
+
}), this.on("confirm", (F$1) => {
|
|
631
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = F$1, this.state = "submit", this.close();
|
|
632
|
+
}), this.on("cursor", () => {
|
|
633
|
+
this.value = !this.value;
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
var gD = Object.defineProperty, vD = (t, u$1, F$1) => u$1 in t ? gD(t, u$1, {
|
|
638
|
+
enumerable: !0,
|
|
639
|
+
configurable: !0,
|
|
640
|
+
writable: !0,
|
|
641
|
+
value: F$1
|
|
642
|
+
}) : t[u$1] = F$1, K$1 = (t, u$1, F$1) => (vD(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1);
|
|
643
|
+
let dD = class extends x {
|
|
644
|
+
constructor(u$1) {
|
|
645
|
+
super(u$1, !1), K$1(this, "options"), K$1(this, "cursor", 0);
|
|
646
|
+
const { options: F$1 } = u$1;
|
|
647
|
+
this.options = Object.entries(F$1).flatMap(([e, s]) => [{
|
|
648
|
+
value: e,
|
|
649
|
+
group: !0,
|
|
650
|
+
label: e
|
|
651
|
+
}, ...s.map((i) => ({
|
|
652
|
+
...i,
|
|
653
|
+
group: e
|
|
654
|
+
}))]), this.value = [...u$1.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e }) => e === u$1.cursorAt), 0), this.on("cursor", (e) => {
|
|
655
|
+
switch (e) {
|
|
656
|
+
case "left":
|
|
657
|
+
case "up":
|
|
658
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
659
|
+
break;
|
|
660
|
+
case "down":
|
|
661
|
+
case "right":
|
|
662
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
663
|
+
break;
|
|
664
|
+
case "space":
|
|
665
|
+
this.toggleValue();
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
getGroupItems(u$1) {
|
|
671
|
+
return this.options.filter((F$1) => F$1.group === u$1);
|
|
672
|
+
}
|
|
673
|
+
isGroupSelected(u$1) {
|
|
674
|
+
return this.getGroupItems(u$1).every((F$1) => this.value.includes(F$1.value));
|
|
675
|
+
}
|
|
676
|
+
toggleValue() {
|
|
677
|
+
const u$1 = this.options[this.cursor];
|
|
678
|
+
if (u$1.group === !0) {
|
|
679
|
+
const F$1 = u$1.value, e = this.getGroupItems(F$1);
|
|
680
|
+
this.isGroupSelected(F$1) ? this.value = this.value.filter((s) => e.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));
|
|
681
|
+
} else {
|
|
682
|
+
const F$1 = this.value.includes(u$1.value);
|
|
683
|
+
this.value = F$1 ? this.value.filter((e) => e !== u$1.value) : [...this.value, u$1.value];
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
var bD = Object.defineProperty, mD = (t, u$1, F$1) => u$1 in t ? bD(t, u$1, {
|
|
688
|
+
enumerable: !0,
|
|
689
|
+
configurable: !0,
|
|
690
|
+
writable: !0,
|
|
691
|
+
value: F$1
|
|
692
|
+
}) : t[u$1] = F$1, Y$1 = (t, u$1, F$1) => (mD(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1);
|
|
693
|
+
let wD = class extends x {
|
|
694
|
+
constructor(u$1) {
|
|
695
|
+
super(u$1, !1), Y$1(this, "options"), Y$1(this, "cursor", 0), this.options = u$1.options, this.value = [...u$1.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F$1 }) => F$1 === u$1.cursorAt), 0), this.on("key", (F$1) => {
|
|
696
|
+
F$1 === "a" && this.toggleAll();
|
|
697
|
+
}), this.on("cursor", (F$1) => {
|
|
698
|
+
switch (F$1) {
|
|
699
|
+
case "left":
|
|
700
|
+
case "up":
|
|
701
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
702
|
+
break;
|
|
703
|
+
case "down":
|
|
704
|
+
case "right":
|
|
705
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
706
|
+
break;
|
|
707
|
+
case "space":
|
|
708
|
+
this.toggleValue();
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
get _value() {
|
|
714
|
+
return this.options[this.cursor].value;
|
|
715
|
+
}
|
|
716
|
+
toggleAll() {
|
|
717
|
+
const u$1 = this.value.length === this.options.length;
|
|
718
|
+
this.value = u$1 ? [] : this.options.map((F$1) => F$1.value);
|
|
719
|
+
}
|
|
720
|
+
toggleValue() {
|
|
721
|
+
const u$1 = this.value.includes(this._value);
|
|
722
|
+
this.value = u$1 ? this.value.filter((F$1) => F$1 !== this._value) : [...this.value, this._value];
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
var yD = Object.defineProperty, _D = (t, u$1, F$1) => u$1 in t ? yD(t, u$1, {
|
|
726
|
+
enumerable: !0,
|
|
727
|
+
configurable: !0,
|
|
728
|
+
writable: !0,
|
|
729
|
+
value: F$1
|
|
730
|
+
}) : t[u$1] = F$1, Z = (t, u$1, F$1) => (_D(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1);
|
|
731
|
+
var kD = class extends x {
|
|
732
|
+
constructor({ mask: u$1,...F$1 }) {
|
|
733
|
+
super(F$1), Z(this, "valueWithCursor", ""), Z(this, "_mask", "•"), this._mask = u$1 ?? "•", this.on("finalize", () => {
|
|
734
|
+
this.valueWithCursor = this.masked;
|
|
735
|
+
}), this.on("value", () => {
|
|
736
|
+
if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
737
|
+
else {
|
|
738
|
+
const e = this.masked.slice(0, this.cursor), s = this.masked.slice(this.cursor);
|
|
739
|
+
this.valueWithCursor = `${e}${import_picocolors.default.inverse(s[0])}${s.slice(1)}`;
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
get cursor() {
|
|
744
|
+
return this._cursor;
|
|
745
|
+
}
|
|
746
|
+
get masked() {
|
|
747
|
+
return this.value.replaceAll(/./g, this._mask);
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
var SD = Object.defineProperty, $D = (t, u$1, F$1) => u$1 in t ? SD(t, u$1, {
|
|
751
|
+
enumerable: !0,
|
|
752
|
+
configurable: !0,
|
|
753
|
+
writable: !0,
|
|
754
|
+
value: F$1
|
|
755
|
+
}) : t[u$1] = F$1, q$1 = (t, u$1, F$1) => ($D(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1);
|
|
756
|
+
var jD = class extends x {
|
|
757
|
+
constructor(u$1) {
|
|
758
|
+
super(u$1, !1), q$1(this, "options"), q$1(this, "cursor", 0), this.options = u$1.options, this.cursor = this.options.findIndex(({ value: F$1 }) => F$1 === u$1.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F$1) => {
|
|
759
|
+
switch (F$1) {
|
|
760
|
+
case "left":
|
|
761
|
+
case "up":
|
|
762
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
763
|
+
break;
|
|
764
|
+
case "down":
|
|
765
|
+
case "right":
|
|
766
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
this.changeValue();
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
get _value() {
|
|
773
|
+
return this.options[this.cursor];
|
|
774
|
+
}
|
|
775
|
+
changeValue() {
|
|
776
|
+
this.value = this._value.value;
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
var MD = Object.defineProperty, TD = (t, u$1, F$1) => u$1 in t ? MD(t, u$1, {
|
|
780
|
+
enumerable: !0,
|
|
781
|
+
configurable: !0,
|
|
782
|
+
writable: !0,
|
|
783
|
+
value: F$1
|
|
784
|
+
}) : t[u$1] = F$1, H = (t, u$1, F$1) => (TD(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1);
|
|
785
|
+
var OD = class extends x {
|
|
786
|
+
constructor(u$1) {
|
|
787
|
+
super(u$1, !1), H(this, "options"), H(this, "cursor", 0), this.options = u$1.options;
|
|
788
|
+
const F$1 = this.options.map(({ value: [e] }) => e?.toLowerCase());
|
|
789
|
+
this.cursor = Math.max(F$1.indexOf(u$1.initialValue), 0), this.on("key", (e) => {
|
|
790
|
+
if (!F$1.includes(e)) return;
|
|
791
|
+
const s = this.options.find(({ value: [i] }) => i?.toLowerCase() === e);
|
|
792
|
+
s && (this.value = s.value, this.state = "submit", this.emit("submit"));
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
var PD = class extends x {
|
|
797
|
+
get valueWithCursor() {
|
|
798
|
+
if (this.state === "submit") return this.value;
|
|
799
|
+
if (this.cursor >= this.value.length) return `${this.value}\u2588`;
|
|
800
|
+
const u$1 = this.value.slice(0, this.cursor), [F$1, ...e] = this.value.slice(this.cursor);
|
|
801
|
+
return `${u$1}${import_picocolors.default.inverse(F$1)}${e.join("")}`;
|
|
802
|
+
}
|
|
803
|
+
get cursor() {
|
|
804
|
+
return this._cursor;
|
|
805
|
+
}
|
|
806
|
+
constructor(u$1) {
|
|
807
|
+
super(u$1), this.on("finalize", () => {
|
|
808
|
+
this.value || (this.value = u$1.defaultValue);
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region node_modules/.pnpm/@clack+prompts@0.10.0/node_modules/@clack/prompts/dist/index.mjs
|
|
815
|
+
function ce() {
|
|
816
|
+
return g.platform !== "win32" ? g.env.TERM !== "linux" : !!g.env.CI || !!g.env.WT_SESSION || !!g.env.TERMINUS_SUBLIME || g.env.ConEmuTask === "{cmd::Cmder}" || g.env.TERM_PROGRAM === "Terminus-Sublime" || g.env.TERM_PROGRAM === "vscode" || g.env.TERM === "xterm-256color" || g.env.TERM === "alacritty" || g.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
817
|
+
}
|
|
818
|
+
const V = ce(), u = (t, n) => V ? t : n, le = u("◆", "*"), L = u("■", "x"), W = u("▲", "x"), C = u("◇", "o"), ue = u("┌", "T"), o = u("│", "|"), d = u("└", "—"), k = u("●", ">"), P = u("○", " "), A = u("◻", "[•]"), T = u("◼", "[+]"), F = u("◻", "[ ]"), $e = u("▪", "•"), _ = u("─", "-"), me = u("╮", "+"), de = u("├", "+"), pe = u("╯", "+"), q = u("●", "•"), D = u("◆", "*"), U = u("▲", "!"), K = u("■", "x"), w = (t) => {
|
|
819
|
+
switch (t) {
|
|
820
|
+
case "initial":
|
|
821
|
+
case "active": return import_picocolors.default.cyan(le);
|
|
822
|
+
case "cancel": return import_picocolors.default.red(L);
|
|
823
|
+
case "error": return import_picocolors.default.yellow(W);
|
|
824
|
+
case "submit": return import_picocolors.default.green(C);
|
|
825
|
+
}
|
|
826
|
+
}, B = (t) => {
|
|
827
|
+
const { cursor: n, options: s, style: r$1 } = t, i = t.maxItems ?? Number.POSITIVE_INFINITY, a = Math.max(process.stdout.rows - 4, 0), c$1 = Math.min(a, Math.max(i, 5));
|
|
828
|
+
let l = 0;
|
|
829
|
+
n >= l + c$1 - 3 ? l = Math.max(Math.min(n - c$1 + 3, s.length - c$1), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
|
|
830
|
+
const $ = c$1 < s.length && l > 0, p$1 = c$1 < s.length && l + c$1 < s.length;
|
|
831
|
+
return s.slice(l, l + c$1).map((M$1, v$1, x$1) => {
|
|
832
|
+
const j = v$1 === 0 && $, E = v$1 === x$1.length - 1 && p$1;
|
|
833
|
+
return j || E ? import_picocolors.default.dim("...") : r$1(M$1, v$1 + l === n);
|
|
834
|
+
});
|
|
835
|
+
}, he = (t) => new PD({
|
|
836
|
+
validate: t.validate,
|
|
837
|
+
placeholder: t.placeholder,
|
|
838
|
+
defaultValue: t.defaultValue,
|
|
839
|
+
initialValue: t.initialValue,
|
|
840
|
+
render() {
|
|
841
|
+
const n = `${import_picocolors.default.gray(o)}
|
|
842
|
+
${w(this.state)} ${t.message}
|
|
843
|
+
`, s = t.placeholder ? import_picocolors.default.inverse(t.placeholder[0]) + import_picocolors.default.dim(t.placeholder.slice(1)) : import_picocolors.default.inverse(import_picocolors.default.hidden("_")), r$1 = this.value ? this.valueWithCursor : s;
|
|
844
|
+
switch (this.state) {
|
|
845
|
+
case "error": return `${n.trim()}
|
|
846
|
+
${import_picocolors.default.yellow(o)} ${r$1}
|
|
847
|
+
${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(this.error)}
|
|
848
|
+
`;
|
|
849
|
+
case "submit": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(this.value || t.placeholder)}`;
|
|
850
|
+
case "cancel": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
851
|
+
${import_picocolors.default.gray(o)}` : ""}`;
|
|
852
|
+
default: return `${n}${import_picocolors.default.cyan(o)} ${r$1}
|
|
853
|
+
${import_picocolors.default.cyan(d)}
|
|
854
|
+
`;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}).prompt(), ge = (t) => new kD({
|
|
858
|
+
validate: t.validate,
|
|
859
|
+
mask: t.mask ?? $e,
|
|
860
|
+
render() {
|
|
861
|
+
const n = `${import_picocolors.default.gray(o)}
|
|
862
|
+
${w(this.state)} ${t.message}
|
|
863
|
+
`, s = this.valueWithCursor, r$1 = this.masked;
|
|
864
|
+
switch (this.state) {
|
|
865
|
+
case "error": return `${n.trim()}
|
|
866
|
+
${import_picocolors.default.yellow(o)} ${r$1}
|
|
867
|
+
${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(this.error)}
|
|
868
|
+
`;
|
|
869
|
+
case "submit": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(r$1)}`;
|
|
870
|
+
case "cancel": return `${n}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(r$1 ?? ""))}${r$1 ? `
|
|
871
|
+
${import_picocolors.default.gray(o)}` : ""}`;
|
|
872
|
+
default: return `${n}${import_picocolors.default.cyan(o)} ${s}
|
|
873
|
+
${import_picocolors.default.cyan(d)}
|
|
874
|
+
`;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}).prompt(), ye = (t) => {
|
|
878
|
+
const n = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
879
|
+
return new fD({
|
|
880
|
+
active: n,
|
|
881
|
+
inactive: s,
|
|
882
|
+
initialValue: t.initialValue ?? !0,
|
|
883
|
+
render() {
|
|
884
|
+
const r$1 = `${import_picocolors.default.gray(o)}
|
|
885
|
+
${w(this.state)} ${t.message}
|
|
886
|
+
`, i = this.value ? n : s;
|
|
887
|
+
switch (this.state) {
|
|
888
|
+
case "submit": return `${r$1}${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(i)}`;
|
|
889
|
+
case "cancel": return `${r$1}${import_picocolors.default.gray(o)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}
|
|
890
|
+
${import_picocolors.default.gray(o)}`;
|
|
891
|
+
default: return `${r$1}${import_picocolors.default.cyan(o)} ${this.value ? `${import_picocolors.default.green(k)} ${n}` : `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(n)}`} ${import_picocolors.default.dim("/")} ${this.value ? `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(s)}` : `${import_picocolors.default.green(k)} ${s}`}
|
|
892
|
+
${import_picocolors.default.cyan(d)}
|
|
893
|
+
`;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}).prompt();
|
|
897
|
+
}, ve = (t) => {
|
|
898
|
+
const n = (s, r$1) => {
|
|
899
|
+
const i = s.label ?? String(s.value);
|
|
900
|
+
switch (r$1) {
|
|
901
|
+
case "selected": return `${import_picocolors.default.dim(i)}`;
|
|
902
|
+
case "active": return `${import_picocolors.default.green(k)} ${i} ${s.hint ? import_picocolors.default.dim(`(${s.hint})`) : ""}`;
|
|
903
|
+
case "cancelled": return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}`;
|
|
904
|
+
default: return `${import_picocolors.default.dim(P)} ${import_picocolors.default.dim(i)}`;
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
return new jD({
|
|
908
|
+
options: t.options,
|
|
909
|
+
initialValue: t.initialValue,
|
|
910
|
+
render() {
|
|
911
|
+
const s = `${import_picocolors.default.gray(o)}
|
|
912
|
+
${w(this.state)} ${t.message}
|
|
913
|
+
`;
|
|
914
|
+
switch (this.state) {
|
|
915
|
+
case "submit": return `${s}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
916
|
+
case "cancel": return `${s}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
917
|
+
${import_picocolors.default.gray(o)}`;
|
|
918
|
+
default: return `${s}${import_picocolors.default.cyan(o)} ${B({
|
|
919
|
+
cursor: this.cursor,
|
|
920
|
+
options: this.options,
|
|
921
|
+
maxItems: t.maxItems,
|
|
922
|
+
style: (r$1, i) => n(r$1, i ? "active" : "inactive")
|
|
923
|
+
}).join(`
|
|
924
|
+
${import_picocolors.default.cyan(o)} `)}
|
|
925
|
+
${import_picocolors.default.cyan(d)}
|
|
926
|
+
`;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}).prompt();
|
|
930
|
+
}, we = (t) => {
|
|
931
|
+
const n = (s, r$1 = "inactive") => {
|
|
932
|
+
const i = s.label ?? String(s.value);
|
|
933
|
+
return r$1 === "selected" ? `${import_picocolors.default.dim(i)}` : r$1 === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}` : r$1 === "active" ? `${import_picocolors.default.bgCyan(import_picocolors.default.gray(` ${s.value} `))} ${i} ${s.hint ? import_picocolors.default.dim(`(${s.hint})`) : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${s.value} `)))} ${i} ${s.hint ? import_picocolors.default.dim(`(${s.hint})`) : ""}`;
|
|
934
|
+
};
|
|
935
|
+
return new OD({
|
|
936
|
+
options: t.options,
|
|
937
|
+
initialValue: t.initialValue,
|
|
938
|
+
render() {
|
|
939
|
+
const s = `${import_picocolors.default.gray(o)}
|
|
940
|
+
${w(this.state)} ${t.message}
|
|
941
|
+
`;
|
|
942
|
+
switch (this.state) {
|
|
943
|
+
case "submit": return `${s}${import_picocolors.default.gray(o)} ${n(this.options.find((r$1) => r$1.value === this.value) ?? t.options[0], "selected")}`;
|
|
944
|
+
case "cancel": return `${s}${import_picocolors.default.gray(o)} ${n(this.options[0], "cancelled")}
|
|
945
|
+
${import_picocolors.default.gray(o)}`;
|
|
946
|
+
default: return `${s}${import_picocolors.default.cyan(o)} ${this.options.map((r$1, i) => n(r$1, i === this.cursor ? "active" : "inactive")).join(`
|
|
947
|
+
${import_picocolors.default.cyan(o)} `)}
|
|
948
|
+
${import_picocolors.default.cyan(d)}
|
|
949
|
+
`;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}).prompt();
|
|
953
|
+
}, fe = (t) => {
|
|
954
|
+
const n = (s, r$1) => {
|
|
955
|
+
const i = s.label ?? String(s.value);
|
|
956
|
+
return r$1 === "active" ? `${import_picocolors.default.cyan(A)} ${i} ${s.hint ? import_picocolors.default.dim(`(${s.hint})`) : ""}` : r$1 === "selected" ? `${import_picocolors.default.green(T)} ${import_picocolors.default.dim(i)}` : r$1 === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}` : r$1 === "active-selected" ? `${import_picocolors.default.green(T)} ${i} ${s.hint ? import_picocolors.default.dim(`(${s.hint})`) : ""}` : r$1 === "submitted" ? `${import_picocolors.default.dim(i)}` : `${import_picocolors.default.dim(F)} ${import_picocolors.default.dim(i)}`;
|
|
957
|
+
};
|
|
958
|
+
return new wD({
|
|
959
|
+
options: t.options,
|
|
960
|
+
initialValues: t.initialValues,
|
|
961
|
+
required: t.required ?? !0,
|
|
962
|
+
cursorAt: t.cursorAt,
|
|
963
|
+
validate(s) {
|
|
964
|
+
if (this.required && s.length === 0) return `Please select at least one option.
|
|
965
|
+
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
966
|
+
},
|
|
967
|
+
render() {
|
|
968
|
+
const s = `${import_picocolors.default.gray(o)}
|
|
969
|
+
${w(this.state)} ${t.message}
|
|
970
|
+
`, r$1 = (i, a) => {
|
|
971
|
+
const c$1 = this.value.includes(i.value);
|
|
972
|
+
return a && c$1 ? n(i, "active-selected") : c$1 ? n(i, "selected") : n(i, a ? "active" : "inactive");
|
|
973
|
+
};
|
|
974
|
+
switch (this.state) {
|
|
975
|
+
case "submit": return `${s}${import_picocolors.default.gray(o)} ${this.options.filter(({ value: i }) => this.value.includes(i)).map((i) => n(i, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none")}`;
|
|
976
|
+
case "cancel": {
|
|
977
|
+
const i = this.options.filter(({ value: a }) => this.value.includes(a)).map((a) => n(a, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
978
|
+
return `${s}${import_picocolors.default.gray(o)} ${i.trim() ? `${i}
|
|
979
|
+
${import_picocolors.default.gray(o)}` : ""}`;
|
|
980
|
+
}
|
|
981
|
+
case "error": {
|
|
982
|
+
const i = this.error.split(`
|
|
983
|
+
`).map((a, c$1) => c$1 === 0 ? `${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(a)}` : ` ${a}`).join(`
|
|
984
|
+
`);
|
|
985
|
+
return `${s + import_picocolors.default.yellow(o)} ${B({
|
|
986
|
+
options: this.options,
|
|
987
|
+
cursor: this.cursor,
|
|
988
|
+
maxItems: t.maxItems,
|
|
989
|
+
style: r$1
|
|
990
|
+
}).join(`
|
|
991
|
+
${import_picocolors.default.yellow(o)} `)}
|
|
992
|
+
${i}
|
|
993
|
+
`;
|
|
994
|
+
}
|
|
995
|
+
default: return `${s}${import_picocolors.default.cyan(o)} ${B({
|
|
996
|
+
options: this.options,
|
|
997
|
+
cursor: this.cursor,
|
|
998
|
+
maxItems: t.maxItems,
|
|
999
|
+
style: r$1
|
|
1000
|
+
}).join(`
|
|
1001
|
+
${import_picocolors.default.cyan(o)} `)}
|
|
1002
|
+
${import_picocolors.default.cyan(d)}
|
|
1003
|
+
`;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}).prompt();
|
|
1007
|
+
}, be = (t) => {
|
|
1008
|
+
const n = (s, r$1, i = []) => {
|
|
1009
|
+
const a = s.label ?? String(s.value), c$1 = typeof s.group == "string", l = c$1 && (i[i.indexOf(s) + 1] ?? { group: !0 }), $ = c$1 && l.group === !0, p$1 = c$1 ? `${$ ? d : o} ` : "";
|
|
1010
|
+
return r$1 === "active" ? `${import_picocolors.default.dim(p$1)}${import_picocolors.default.cyan(A)} ${a} ${s.hint ? import_picocolors.default.dim(`(${s.hint})`) : ""}` : r$1 === "group-active" ? `${p$1}${import_picocolors.default.cyan(A)} ${import_picocolors.default.dim(a)}` : r$1 === "group-active-selected" ? `${p$1}${import_picocolors.default.green(T)} ${import_picocolors.default.dim(a)}` : r$1 === "selected" ? `${import_picocolors.default.dim(p$1)}${import_picocolors.default.green(T)} ${import_picocolors.default.dim(a)}` : r$1 === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}` : r$1 === "active-selected" ? `${import_picocolors.default.dim(p$1)}${import_picocolors.default.green(T)} ${a} ${s.hint ? import_picocolors.default.dim(`(${s.hint})`) : ""}` : r$1 === "submitted" ? `${import_picocolors.default.dim(a)}` : `${import_picocolors.default.dim(p$1)}${import_picocolors.default.dim(F)} ${import_picocolors.default.dim(a)}`;
|
|
1011
|
+
};
|
|
1012
|
+
return new dD({
|
|
1013
|
+
options: t.options,
|
|
1014
|
+
initialValues: t.initialValues,
|
|
1015
|
+
required: t.required ?? !0,
|
|
1016
|
+
cursorAt: t.cursorAt,
|
|
1017
|
+
validate(s) {
|
|
1018
|
+
if (this.required && s.length === 0) return `Please select at least one option.
|
|
1019
|
+
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
1020
|
+
},
|
|
1021
|
+
render() {
|
|
1022
|
+
const s = `${import_picocolors.default.gray(o)}
|
|
1023
|
+
${w(this.state)} ${t.message}
|
|
1024
|
+
`;
|
|
1025
|
+
switch (this.state) {
|
|
1026
|
+
case "submit": return `${s}${import_picocolors.default.gray(o)} ${this.options.filter(({ value: r$1 }) => this.value.includes(r$1)).map((r$1) => n(r$1, "submitted")).join(import_picocolors.default.dim(", "))}`;
|
|
1027
|
+
case "cancel": {
|
|
1028
|
+
const r$1 = this.options.filter(({ value: i }) => this.value.includes(i)).map((i) => n(i, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
1029
|
+
return `${s}${import_picocolors.default.gray(o)} ${r$1.trim() ? `${r$1}
|
|
1030
|
+
${import_picocolors.default.gray(o)}` : ""}`;
|
|
1031
|
+
}
|
|
1032
|
+
case "error": {
|
|
1033
|
+
const r$1 = this.error.split(`
|
|
1034
|
+
`).map((i, a) => a === 0 ? `${import_picocolors.default.yellow(d)} ${import_picocolors.default.yellow(i)}` : ` ${i}`).join(`
|
|
1035
|
+
`);
|
|
1036
|
+
return `${s}${import_picocolors.default.yellow(o)} ${this.options.map((i, a, c$1) => {
|
|
1037
|
+
const l = this.value.includes(i.value) || i.group === !0 && this.isGroupSelected(`${i.value}`), $ = a === this.cursor;
|
|
1038
|
+
return !$ && typeof i.group == "string" && this.options[this.cursor].value === i.group ? n(i, l ? "group-active-selected" : "group-active", c$1) : $ && l ? n(i, "active-selected", c$1) : l ? n(i, "selected", c$1) : n(i, $ ? "active" : "inactive", c$1);
|
|
1039
|
+
}).join(`
|
|
1040
|
+
${import_picocolors.default.yellow(o)} `)}
|
|
1041
|
+
${r$1}
|
|
1042
|
+
`;
|
|
1043
|
+
}
|
|
1044
|
+
default: return `${s}${import_picocolors.default.cyan(o)} ${this.options.map((r$1, i, a) => {
|
|
1045
|
+
const c$1 = this.value.includes(r$1.value) || r$1.group === !0 && this.isGroupSelected(`${r$1.value}`), l = i === this.cursor;
|
|
1046
|
+
return !l && typeof r$1.group == "string" && this.options[this.cursor].value === r$1.group ? n(r$1, c$1 ? "group-active-selected" : "group-active", a) : l && c$1 ? n(r$1, "active-selected", a) : c$1 ? n(r$1, "selected", a) : n(r$1, l ? "active" : "inactive", a);
|
|
1047
|
+
}).join(`
|
|
1048
|
+
${import_picocolors.default.cyan(o)} `)}
|
|
1049
|
+
${import_picocolors.default.cyan(d)}
|
|
1050
|
+
`;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}).prompt();
|
|
1054
|
+
}, Me = (t = "", n = "") => {
|
|
1055
|
+
const s = `
|
|
1056
|
+
${t}
|
|
1057
|
+
`.split(`
|
|
1058
|
+
`), r$1 = stripVTControlCharacters(n).length, i = Math.max(s.reduce((c$1, l) => {
|
|
1059
|
+
const $ = stripVTControlCharacters(l);
|
|
1060
|
+
return $.length > c$1 ? $.length : c$1;
|
|
1061
|
+
}, 0), r$1) + 2, a = s.map((c$1) => `${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(c$1)}${" ".repeat(i - stripVTControlCharacters(c$1).length)}${import_picocolors.default.gray(o)}`).join(`
|
|
1062
|
+
`);
|
|
1063
|
+
process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
1064
|
+
${import_picocolors.default.green(C)} ${import_picocolors.default.reset(n)} ${import_picocolors.default.gray(_.repeat(Math.max(i - r$1 - 1, 1)) + me)}
|
|
1065
|
+
${a}
|
|
1066
|
+
${import_picocolors.default.gray(de + _.repeat(i + 2) + pe)}
|
|
1067
|
+
`);
|
|
1068
|
+
}, xe = (t = "") => {
|
|
1069
|
+
process.stdout.write(`${import_picocolors.default.gray(d)} ${import_picocolors.default.red(t)}
|
|
1070
|
+
|
|
1071
|
+
`);
|
|
1072
|
+
}, Ie = (t = "") => {
|
|
1073
|
+
process.stdout.write(`${import_picocolors.default.gray(ue)} ${t}
|
|
1074
|
+
`);
|
|
1075
|
+
}, Se = (t = "") => {
|
|
1076
|
+
process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
1077
|
+
${import_picocolors.default.gray(d)} ${t}
|
|
1078
|
+
|
|
1079
|
+
`);
|
|
1080
|
+
}, f = {
|
|
1081
|
+
message: (t = "", { symbol: n = import_picocolors.default.gray(o) } = {}) => {
|
|
1082
|
+
const s = [`${import_picocolors.default.gray(o)}`];
|
|
1083
|
+
if (t) {
|
|
1084
|
+
const [r$1, ...i] = t.split(`
|
|
1085
|
+
`);
|
|
1086
|
+
s.push(`${n} ${r$1}`, ...i.map((a) => `${import_picocolors.default.gray(o)} ${a}`));
|
|
1087
|
+
}
|
|
1088
|
+
process.stdout.write(`${s.join(`
|
|
1089
|
+
`)}
|
|
1090
|
+
`);
|
|
1091
|
+
},
|
|
1092
|
+
info: (t) => {
|
|
1093
|
+
f.message(t, { symbol: import_picocolors.default.blue(q) });
|
|
1094
|
+
},
|
|
1095
|
+
success: (t) => {
|
|
1096
|
+
f.message(t, { symbol: import_picocolors.default.green(D) });
|
|
1097
|
+
},
|
|
1098
|
+
step: (t) => {
|
|
1099
|
+
f.message(t, { symbol: import_picocolors.default.green(C) });
|
|
1100
|
+
},
|
|
1101
|
+
warn: (t) => {
|
|
1102
|
+
f.message(t, { symbol: import_picocolors.default.yellow(U) });
|
|
1103
|
+
},
|
|
1104
|
+
warning: (t) => {
|
|
1105
|
+
f.warn(t);
|
|
1106
|
+
},
|
|
1107
|
+
error: (t) => {
|
|
1108
|
+
f.message(t, { symbol: import_picocolors.default.red(K) });
|
|
1109
|
+
}
|
|
1110
|
+
}, J = `${import_picocolors.default.gray(o)} `, b = {
|
|
1111
|
+
message: async (t, { symbol: n = import_picocolors.default.gray(o) } = {}) => {
|
|
1112
|
+
process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
1113
|
+
${n} `);
|
|
1114
|
+
let s = 3;
|
|
1115
|
+
for await (let r$1 of t) {
|
|
1116
|
+
r$1 = r$1.replace(/\n/g, `
|
|
1117
|
+
${J}`), r$1.includes(`
|
|
1118
|
+
`) && (s = 3 + stripVTControlCharacters(r$1.slice(r$1.lastIndexOf(`
|
|
1119
|
+
`))).length);
|
|
1120
|
+
const i = stripVTControlCharacters(r$1).length;
|
|
1121
|
+
s + i < process.stdout.columns ? (s += i, process.stdout.write(r$1)) : (process.stdout.write(`
|
|
1122
|
+
${J}${r$1.trimStart()}`), s = 3 + stripVTControlCharacters(r$1.trimStart()).length);
|
|
1123
|
+
}
|
|
1124
|
+
process.stdout.write(`
|
|
1125
|
+
`);
|
|
1126
|
+
},
|
|
1127
|
+
info: (t) => b.message(t, { symbol: import_picocolors.default.blue(q) }),
|
|
1128
|
+
success: (t) => b.message(t, { symbol: import_picocolors.default.green(D) }),
|
|
1129
|
+
step: (t) => b.message(t, { symbol: import_picocolors.default.green(C) }),
|
|
1130
|
+
warn: (t) => b.message(t, { symbol: import_picocolors.default.yellow(U) }),
|
|
1131
|
+
warning: (t) => b.warn(t),
|
|
1132
|
+
error: (t) => b.message(t, { symbol: import_picocolors.default.red(K) })
|
|
1133
|
+
}, Y = ({ indicator: t = "dots" } = {}) => {
|
|
1134
|
+
const n = V ? [
|
|
1135
|
+
"◒",
|
|
1136
|
+
"◐",
|
|
1137
|
+
"◓",
|
|
1138
|
+
"◑"
|
|
1139
|
+
] : [
|
|
1140
|
+
"•",
|
|
1141
|
+
"o",
|
|
1142
|
+
"O",
|
|
1143
|
+
"0"
|
|
1144
|
+
], s = V ? 80 : 120, r$1 = process.env.CI === "true";
|
|
1145
|
+
let i, a, c$1 = !1, l = "", $, p$1 = performance.now();
|
|
1146
|
+
const M$1 = (m$1) => {
|
|
1147
|
+
const h$1 = m$1 > 1 ? "Something went wrong" : "Canceled";
|
|
1148
|
+
c$1 && N$1(h$1, m$1);
|
|
1149
|
+
}, v$1 = () => M$1(2), x$1 = () => M$1(1), j = () => {
|
|
1150
|
+
process.on("uncaughtExceptionMonitor", v$1), process.on("unhandledRejection", v$1), process.on("SIGINT", x$1), process.on("SIGTERM", x$1), process.on("exit", M$1);
|
|
1151
|
+
}, E = () => {
|
|
1152
|
+
process.removeListener("uncaughtExceptionMonitor", v$1), process.removeListener("unhandledRejection", v$1), process.removeListener("SIGINT", x$1), process.removeListener("SIGTERM", x$1), process.removeListener("exit", M$1);
|
|
1153
|
+
}, O$1 = () => {
|
|
1154
|
+
if ($ === void 0) return;
|
|
1155
|
+
r$1 && process.stdout.write(`
|
|
1156
|
+
`);
|
|
1157
|
+
const m$1 = $.split(`
|
|
1158
|
+
`);
|
|
1159
|
+
process.stdout.write(import_src.cursor.move(-999, m$1.length - 1)), process.stdout.write(import_src.erase.down(m$1.length));
|
|
1160
|
+
}, R$1 = (m$1) => m$1.replace(/\.+$/, ""), G$1 = (m$1) => {
|
|
1161
|
+
const h$1 = (performance.now() - m$1) / 1e3, y$1 = Math.floor(h$1 / 60), I$1 = Math.floor(h$1 % 60);
|
|
1162
|
+
return y$1 > 0 ? `[${y$1}m ${I$1}s]` : `[${I$1}s]`;
|
|
1163
|
+
}, H$1 = (m$1 = "") => {
|
|
1164
|
+
c$1 = !0, i = cD(), l = R$1(m$1), p$1 = performance.now(), process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
1165
|
+
`);
|
|
1166
|
+
let h$1 = 0, y$1 = 0;
|
|
1167
|
+
j(), a = setInterval(() => {
|
|
1168
|
+
if (r$1 && l === $) return;
|
|
1169
|
+
O$1(), $ = l;
|
|
1170
|
+
const I$1 = import_picocolors.default.magenta(n[h$1]);
|
|
1171
|
+
if (r$1) process.stdout.write(`${I$1} ${l}...`);
|
|
1172
|
+
else if (t === "timer") process.stdout.write(`${I$1} ${l} ${G$1(p$1)}`);
|
|
1173
|
+
else {
|
|
1174
|
+
const z$1 = ".".repeat(Math.floor(y$1)).slice(0, 3);
|
|
1175
|
+
process.stdout.write(`${I$1} ${l}${z$1}`);
|
|
1176
|
+
}
|
|
1177
|
+
h$1 = h$1 + 1 < n.length ? h$1 + 1 : 0, y$1 = y$1 < n.length ? y$1 + .125 : 0;
|
|
1178
|
+
}, s);
|
|
1179
|
+
}, N$1 = (m$1 = "", h$1 = 0) => {
|
|
1180
|
+
c$1 = !1, clearInterval(a), O$1();
|
|
1181
|
+
const y$1 = h$1 === 0 ? import_picocolors.default.green(C) : h$1 === 1 ? import_picocolors.default.red(L) : import_picocolors.default.red(W);
|
|
1182
|
+
l = R$1(m$1 ?? l), t === "timer" ? process.stdout.write(`${y$1} ${l} ${G$1(p$1)}
|
|
1183
|
+
`) : process.stdout.write(`${y$1} ${l}
|
|
1184
|
+
`), E(), i();
|
|
1185
|
+
};
|
|
1186
|
+
return {
|
|
1187
|
+
start: H$1,
|
|
1188
|
+
stop: N$1,
|
|
1189
|
+
message: (m$1 = "") => {
|
|
1190
|
+
l = R$1(m$1 ?? l);
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
}, Ce = async (t, n) => {
|
|
1194
|
+
const s = {}, r$1 = Object.keys(t);
|
|
1195
|
+
for (const i of r$1) {
|
|
1196
|
+
const a = t[i], c$1 = await a({ results: s })?.catch((l) => {
|
|
1197
|
+
throw l;
|
|
1198
|
+
});
|
|
1199
|
+
if (typeof n?.onCancel == "function" && BD(c$1)) {
|
|
1200
|
+
s[i] = "canceled", n.onCancel({ results: s });
|
|
1201
|
+
continue;
|
|
1202
|
+
}
|
|
1203
|
+
s[i] = c$1;
|
|
1204
|
+
}
|
|
1205
|
+
return s;
|
|
1206
|
+
}, Te = async (t) => {
|
|
1207
|
+
for (const n of t) {
|
|
1208
|
+
if (n.enabled === !1) continue;
|
|
1209
|
+
const s = Y();
|
|
1210
|
+
s.start(n.title);
|
|
1211
|
+
const r$1 = await n.task(s.message);
|
|
1212
|
+
s.stop(r$1 || n.title);
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
|
|
1216
|
+
//#endregion
|
|
1217
|
+
//#region node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/lib/utils.js
|
|
1218
|
+
var require_utils = __commonJS({ "node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/lib/utils.js"(exports) {
|
|
1219
|
+
var regExpChars = /[|\\{}()[\]^$+*?.]/g;
|
|
1220
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1221
|
+
var hasOwn = function(obj, key) {
|
|
1222
|
+
return hasOwnProperty.apply(obj, [key]);
|
|
1223
|
+
};
|
|
1224
|
+
/**
|
|
1225
|
+
* Escape characters reserved in regular expressions.
|
|
1226
|
+
*
|
|
1227
|
+
* If `string` is `undefined` or `null`, the empty string is returned.
|
|
1228
|
+
*
|
|
1229
|
+
* @param {String} string Input string
|
|
1230
|
+
* @return {String} Escaped string
|
|
1231
|
+
* @static
|
|
1232
|
+
* @private
|
|
1233
|
+
*/
|
|
1234
|
+
exports.escapeRegExpChars = function(string) {
|
|
1235
|
+
if (!string) return "";
|
|
1236
|
+
return String(string).replace(regExpChars, "\\$&");
|
|
1237
|
+
};
|
|
1238
|
+
var _ENCODE_HTML_RULES = {
|
|
1239
|
+
"&": "&",
|
|
1240
|
+
"<": "<",
|
|
1241
|
+
">": ">",
|
|
1242
|
+
"\"": """,
|
|
1243
|
+
"'": "'"
|
|
1244
|
+
};
|
|
1245
|
+
var _MATCH_HTML = /[&<>'"]/g;
|
|
1246
|
+
function encode_char(c$1) {
|
|
1247
|
+
return _ENCODE_HTML_RULES[c$1] || c$1;
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Stringified version of constants used by {@link module:utils.escapeXML}.
|
|
1251
|
+
*
|
|
1252
|
+
* It is used in the process of generating {@link ClientFunction}s.
|
|
1253
|
+
*
|
|
1254
|
+
* @readonly
|
|
1255
|
+
* @type {String}
|
|
1256
|
+
*/
|
|
1257
|
+
var escapeFuncStr = "var _ENCODE_HTML_RULES = {\n \"&\": \"&\"\n , \"<\": \"<\"\n , \">\": \">\"\n , '\"': \""\"\n , \"'\": \"'\"\n }\n , _MATCH_HTML = /[&<>'\"]/g;\nfunction encode_char(c) {\n return _ENCODE_HTML_RULES[c] || c;\n};\n";
|
|
1258
|
+
/**
|
|
1259
|
+
* Escape characters reserved in XML.
|
|
1260
|
+
*
|
|
1261
|
+
* If `markup` is `undefined` or `null`, the empty string is returned.
|
|
1262
|
+
*
|
|
1263
|
+
* @implements {EscapeCallback}
|
|
1264
|
+
* @param {String} markup Input string
|
|
1265
|
+
* @return {String} Escaped string
|
|
1266
|
+
* @static
|
|
1267
|
+
* @private
|
|
1268
|
+
*/
|
|
1269
|
+
exports.escapeXML = function(markup) {
|
|
1270
|
+
return markup == void 0 ? "" : String(markup).replace(_MATCH_HTML, encode_char);
|
|
1271
|
+
};
|
|
1272
|
+
function escapeXMLToString() {
|
|
1273
|
+
return Function.prototype.toString.call(this) + ";\n" + escapeFuncStr;
|
|
1274
|
+
}
|
|
1275
|
+
try {
|
|
1276
|
+
if (typeof Object.defineProperty === "function") Object.defineProperty(exports.escapeXML, "toString", { value: escapeXMLToString });
|
|
1277
|
+
else exports.escapeXML.toString = escapeXMLToString;
|
|
1278
|
+
} catch (err) {
|
|
1279
|
+
console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)");
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Naive copy of properties from one object to another.
|
|
1283
|
+
* Does not recurse into non-scalar properties
|
|
1284
|
+
* Does not check to see if the property has a value before copying
|
|
1285
|
+
*
|
|
1286
|
+
* @param {Object} to Destination object
|
|
1287
|
+
* @param {Object} from Source object
|
|
1288
|
+
* @return {Object} Destination object
|
|
1289
|
+
* @static
|
|
1290
|
+
* @private
|
|
1291
|
+
*/
|
|
1292
|
+
exports.shallowCopy = function(to, from) {
|
|
1293
|
+
from = from || {};
|
|
1294
|
+
if (to !== null && to !== void 0) for (var p$1 in from) {
|
|
1295
|
+
if (!hasOwn(from, p$1)) continue;
|
|
1296
|
+
if (p$1 === "__proto__" || p$1 === "constructor") continue;
|
|
1297
|
+
to[p$1] = from[p$1];
|
|
1298
|
+
}
|
|
1299
|
+
return to;
|
|
1300
|
+
};
|
|
1301
|
+
/**
|
|
1302
|
+
* Naive copy of a list of key names, from one object to another.
|
|
1303
|
+
* Only copies property if it is actually defined
|
|
1304
|
+
* Does not recurse into non-scalar properties
|
|
1305
|
+
*
|
|
1306
|
+
* @param {Object} to Destination object
|
|
1307
|
+
* @param {Object} from Source object
|
|
1308
|
+
* @param {Array} list List of properties to copy
|
|
1309
|
+
* @return {Object} Destination object
|
|
1310
|
+
* @static
|
|
1311
|
+
* @private
|
|
1312
|
+
*/
|
|
1313
|
+
exports.shallowCopyFromList = function(to, from, list) {
|
|
1314
|
+
list = list || [];
|
|
1315
|
+
from = from || {};
|
|
1316
|
+
if (to !== null && to !== void 0) for (var i = 0; i < list.length; i++) {
|
|
1317
|
+
var p$1 = list[i];
|
|
1318
|
+
if (typeof from[p$1] != "undefined") {
|
|
1319
|
+
if (!hasOwn(from, p$1)) continue;
|
|
1320
|
+
if (p$1 === "__proto__" || p$1 === "constructor") continue;
|
|
1321
|
+
to[p$1] = from[p$1];
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return to;
|
|
1325
|
+
};
|
|
1326
|
+
/**
|
|
1327
|
+
* Simple in-process cache implementation. Does not implement limits of any
|
|
1328
|
+
* sort.
|
|
1329
|
+
*
|
|
1330
|
+
* @implements {Cache}
|
|
1331
|
+
* @static
|
|
1332
|
+
* @private
|
|
1333
|
+
*/
|
|
1334
|
+
exports.cache = {
|
|
1335
|
+
_data: {},
|
|
1336
|
+
set: function(key, val) {
|
|
1337
|
+
this._data[key] = val;
|
|
1338
|
+
},
|
|
1339
|
+
get: function(key) {
|
|
1340
|
+
return this._data[key];
|
|
1341
|
+
},
|
|
1342
|
+
remove: function(key) {
|
|
1343
|
+
delete this._data[key];
|
|
1344
|
+
},
|
|
1345
|
+
reset: function() {
|
|
1346
|
+
this._data = {};
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
/**
|
|
1350
|
+
* Transforms hyphen case variable into camel case.
|
|
1351
|
+
*
|
|
1352
|
+
* @param {String} string Hyphen case string
|
|
1353
|
+
* @return {String} Camel case string
|
|
1354
|
+
* @static
|
|
1355
|
+
* @private
|
|
1356
|
+
*/
|
|
1357
|
+
exports.hyphenToCamel = function(str) {
|
|
1358
|
+
return str.replace(/-[a-z]/g, function(match) {
|
|
1359
|
+
return match[1].toUpperCase();
|
|
1360
|
+
});
|
|
1361
|
+
};
|
|
1362
|
+
/**
|
|
1363
|
+
* Returns a null-prototype object in runtimes that support it
|
|
1364
|
+
*
|
|
1365
|
+
* @return {Object} Object, prototype will be set to null where possible
|
|
1366
|
+
* @static
|
|
1367
|
+
* @private
|
|
1368
|
+
*/
|
|
1369
|
+
exports.createNullProtoObjWherePossible = function() {
|
|
1370
|
+
if (typeof Object.create == "function") return function() {
|
|
1371
|
+
return Object.create(null);
|
|
1372
|
+
};
|
|
1373
|
+
return function() {
|
|
1374
|
+
return {};
|
|
1375
|
+
};
|
|
1376
|
+
}();
|
|
1377
|
+
exports.hasOwnOnlyObject = function(obj) {
|
|
1378
|
+
var o$1 = exports.createNullProtoObjWherePossible();
|
|
1379
|
+
for (var p$1 in obj) if (hasOwn(obj, p$1)) o$1[p$1] = obj[p$1];
|
|
1380
|
+
return o$1;
|
|
1381
|
+
};
|
|
1382
|
+
} });
|
|
1383
|
+
|
|
1384
|
+
//#endregion
|
|
1385
|
+
//#region node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/package.json
|
|
1386
|
+
var require_package = __commonJS({ "node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/package.json"(exports, module) {
|
|
1387
|
+
module.exports = {
|
|
1388
|
+
"name": "ejs",
|
|
1389
|
+
"description": "Embedded JavaScript templates",
|
|
1390
|
+
"keywords": [
|
|
1391
|
+
"template",
|
|
1392
|
+
"engine",
|
|
1393
|
+
"ejs"
|
|
1394
|
+
],
|
|
1395
|
+
"version": "3.1.10",
|
|
1396
|
+
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",
|
|
1397
|
+
"license": "Apache-2.0",
|
|
1398
|
+
"bin": { "ejs": "./bin/cli.js" },
|
|
1399
|
+
"main": "./lib/ejs.js",
|
|
1400
|
+
"jsdelivr": "ejs.min.js",
|
|
1401
|
+
"unpkg": "ejs.min.js",
|
|
1402
|
+
"repository": {
|
|
1403
|
+
"type": "git",
|
|
1404
|
+
"url": "git://github.com/mde/ejs.git"
|
|
1405
|
+
},
|
|
1406
|
+
"bugs": "https://github.com/mde/ejs/issues",
|
|
1407
|
+
"homepage": "https://github.com/mde/ejs",
|
|
1408
|
+
"dependencies": { "jake": "^10.8.5" },
|
|
1409
|
+
"devDependencies": {
|
|
1410
|
+
"browserify": "^16.5.1",
|
|
1411
|
+
"eslint": "^6.8.0",
|
|
1412
|
+
"git-directory-deploy": "^1.5.1",
|
|
1413
|
+
"jsdoc": "^4.0.2",
|
|
1414
|
+
"lru-cache": "^4.0.1",
|
|
1415
|
+
"mocha": "^10.2.0",
|
|
1416
|
+
"uglify-js": "^3.3.16"
|
|
1417
|
+
},
|
|
1418
|
+
"engines": { "node": ">=0.10.0" },
|
|
1419
|
+
"scripts": { "test": "npx jake test" }
|
|
1420
|
+
};
|
|
1421
|
+
} });
|
|
1422
|
+
|
|
1423
|
+
//#endregion
|
|
1424
|
+
//#region node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/lib/ejs.js
|
|
1425
|
+
var require_ejs = __commonJS({ "node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/lib/ejs.js"(exports) {
|
|
1426
|
+
/**
|
|
1427
|
+
* @file Embedded JavaScript templating engine. {@link http://ejs.co}
|
|
1428
|
+
* @author Matthew Eernisse <mde@fleegix.org>
|
|
1429
|
+
* @author Tiancheng "Timothy" Gu <timothygu99@gmail.com>
|
|
1430
|
+
* @project EJS
|
|
1431
|
+
* @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
|
|
1432
|
+
*/
|
|
1433
|
+
/**
|
|
1434
|
+
* EJS internal functions.
|
|
1435
|
+
*
|
|
1436
|
+
* Technically this "module" lies in the same file as {@link module:ejs}, for
|
|
1437
|
+
* the sake of organization all the private functions re grouped into this
|
|
1438
|
+
* module.
|
|
1439
|
+
*
|
|
1440
|
+
* @module ejs-internal
|
|
1441
|
+
* @private
|
|
1442
|
+
*/
|
|
1443
|
+
/**
|
|
1444
|
+
* Embedded JavaScript templating engine.
|
|
1445
|
+
*
|
|
1446
|
+
* @module ejs
|
|
1447
|
+
* @public
|
|
1448
|
+
*/
|
|
1449
|
+
var fs$6 = __require("fs");
|
|
1450
|
+
var path$6 = __require("path");
|
|
1451
|
+
var utils = require_utils();
|
|
1452
|
+
var scopeOptionWarned = false;
|
|
1453
|
+
/** @type {string} */
|
|
1454
|
+
var _VERSION_STRING = require_package().version;
|
|
1455
|
+
var _DEFAULT_OPEN_DELIMITER = "<";
|
|
1456
|
+
var _DEFAULT_CLOSE_DELIMITER = ">";
|
|
1457
|
+
var _DEFAULT_DELIMITER = "%";
|
|
1458
|
+
var _DEFAULT_LOCALS_NAME = "locals";
|
|
1459
|
+
var _NAME = "ejs";
|
|
1460
|
+
var _REGEX_STRING = "(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)";
|
|
1461
|
+
var _OPTS_PASSABLE_WITH_DATA = [
|
|
1462
|
+
"delimiter",
|
|
1463
|
+
"scope",
|
|
1464
|
+
"context",
|
|
1465
|
+
"debug",
|
|
1466
|
+
"compileDebug",
|
|
1467
|
+
"client",
|
|
1468
|
+
"_with",
|
|
1469
|
+
"rmWhitespace",
|
|
1470
|
+
"strict",
|
|
1471
|
+
"filename",
|
|
1472
|
+
"async"
|
|
1473
|
+
];
|
|
1474
|
+
var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat("cache");
|
|
1475
|
+
var _BOM = /^\uFEFF/;
|
|
1476
|
+
var _JS_IDENTIFIER = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
|
|
1477
|
+
/**
|
|
1478
|
+
* EJS template function cache. This can be a LRU object from lru-cache NPM
|
|
1479
|
+
* module. By default, it is {@link module:utils.cache}, a simple in-process
|
|
1480
|
+
* cache that grows continuously.
|
|
1481
|
+
*
|
|
1482
|
+
* @type {Cache}
|
|
1483
|
+
*/
|
|
1484
|
+
exports.cache = utils.cache;
|
|
1485
|
+
/**
|
|
1486
|
+
* Custom file loader. Useful for template preprocessing or restricting access
|
|
1487
|
+
* to a certain part of the filesystem.
|
|
1488
|
+
*
|
|
1489
|
+
* @type {fileLoader}
|
|
1490
|
+
*/
|
|
1491
|
+
exports.fileLoader = fs$6.readFileSync;
|
|
1492
|
+
/**
|
|
1493
|
+
* Name of the object containing the locals.
|
|
1494
|
+
*
|
|
1495
|
+
* This variable is overridden by {@link Options}`.localsName` if it is not
|
|
1496
|
+
* `undefined`.
|
|
1497
|
+
*
|
|
1498
|
+
* @type {String}
|
|
1499
|
+
* @public
|
|
1500
|
+
*/
|
|
1501
|
+
exports.localsName = _DEFAULT_LOCALS_NAME;
|
|
1502
|
+
/**
|
|
1503
|
+
* Promise implementation -- defaults to the native implementation if available
|
|
1504
|
+
* This is mostly just for testability
|
|
1505
|
+
*
|
|
1506
|
+
* @type {PromiseConstructorLike}
|
|
1507
|
+
* @public
|
|
1508
|
+
*/
|
|
1509
|
+
exports.promiseImpl = new Function("return this;")().Promise;
|
|
1510
|
+
/**
|
|
1511
|
+
* Get the path to the included file from the parent file path and the
|
|
1512
|
+
* specified path.
|
|
1513
|
+
*
|
|
1514
|
+
* @param {String} name specified path
|
|
1515
|
+
* @param {String} filename parent file path
|
|
1516
|
+
* @param {Boolean} [isDir=false] whether the parent file path is a directory
|
|
1517
|
+
* @return {String}
|
|
1518
|
+
*/
|
|
1519
|
+
exports.resolveInclude = function(name$2, filename, isDir) {
|
|
1520
|
+
var dirname = path$6.dirname;
|
|
1521
|
+
var extname = path$6.extname;
|
|
1522
|
+
var resolve = path$6.resolve;
|
|
1523
|
+
var includePath = resolve(isDir ? filename : dirname(filename), name$2);
|
|
1524
|
+
var ext = extname(name$2);
|
|
1525
|
+
if (!ext) includePath += ".ejs";
|
|
1526
|
+
return includePath;
|
|
1527
|
+
};
|
|
1528
|
+
/**
|
|
1529
|
+
* Try to resolve file path on multiple directories
|
|
1530
|
+
*
|
|
1531
|
+
* @param {String} name specified path
|
|
1532
|
+
* @param {Array<String>} paths list of possible parent directory paths
|
|
1533
|
+
* @return {String}
|
|
1534
|
+
*/
|
|
1535
|
+
function resolvePaths(name$2, paths) {
|
|
1536
|
+
var filePath;
|
|
1537
|
+
if (paths.some(function(v$1) {
|
|
1538
|
+
filePath = exports.resolveInclude(name$2, v$1, true);
|
|
1539
|
+
return fs$6.existsSync(filePath);
|
|
1540
|
+
})) return filePath;
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Get the path to the included file by Options
|
|
1544
|
+
*
|
|
1545
|
+
* @param {String} path specified path
|
|
1546
|
+
* @param {Options} options compilation options
|
|
1547
|
+
* @return {String}
|
|
1548
|
+
*/
|
|
1549
|
+
function getIncludePath(path$7, options) {
|
|
1550
|
+
var includePath;
|
|
1551
|
+
var filePath;
|
|
1552
|
+
var views = options.views;
|
|
1553
|
+
var match = /^[A-Za-z]+:\\|^\//.exec(path$7);
|
|
1554
|
+
if (match && match.length) {
|
|
1555
|
+
path$7 = path$7.replace(/^\/*/, "");
|
|
1556
|
+
if (Array.isArray(options.root)) includePath = resolvePaths(path$7, options.root);
|
|
1557
|
+
else includePath = exports.resolveInclude(path$7, options.root || "/", true);
|
|
1558
|
+
} else {
|
|
1559
|
+
if (options.filename) {
|
|
1560
|
+
filePath = exports.resolveInclude(path$7, options.filename);
|
|
1561
|
+
if (fs$6.existsSync(filePath)) includePath = filePath;
|
|
1562
|
+
}
|
|
1563
|
+
if (!includePath && Array.isArray(views)) includePath = resolvePaths(path$7, views);
|
|
1564
|
+
if (!includePath && typeof options.includer !== "function") throw new Error("Could not find the include file \"" + options.escapeFunction(path$7) + "\"");
|
|
1565
|
+
}
|
|
1566
|
+
return includePath;
|
|
1567
|
+
}
|
|
1568
|
+
/**
|
|
1569
|
+
* Get the template from a string or a file, either compiled on-the-fly or
|
|
1570
|
+
* read from cache (if enabled), and cache the template if needed.
|
|
1571
|
+
*
|
|
1572
|
+
* If `template` is not set, the file specified in `options.filename` will be
|
|
1573
|
+
* read.
|
|
1574
|
+
*
|
|
1575
|
+
* If `options.cache` is true, this function reads the file from
|
|
1576
|
+
* `options.filename` so it must be set prior to calling this function.
|
|
1577
|
+
*
|
|
1578
|
+
* @memberof module:ejs-internal
|
|
1579
|
+
* @param {Options} options compilation options
|
|
1580
|
+
* @param {String} [template] template source
|
|
1581
|
+
* @return {(TemplateFunction|ClientFunction)}
|
|
1582
|
+
* Depending on the value of `options.client`, either type might be returned.
|
|
1583
|
+
* @static
|
|
1584
|
+
*/
|
|
1585
|
+
function handleCache(options, template) {
|
|
1586
|
+
var func;
|
|
1587
|
+
var filename = options.filename;
|
|
1588
|
+
var hasTemplate = arguments.length > 1;
|
|
1589
|
+
if (options.cache) {
|
|
1590
|
+
if (!filename) throw new Error("cache option requires a filename");
|
|
1591
|
+
func = exports.cache.get(filename);
|
|
1592
|
+
if (func) return func;
|
|
1593
|
+
if (!hasTemplate) template = fileLoader(filename).toString().replace(_BOM, "");
|
|
1594
|
+
} else if (!hasTemplate) {
|
|
1595
|
+
if (!filename) throw new Error("Internal EJS error: no file name or template provided");
|
|
1596
|
+
template = fileLoader(filename).toString().replace(_BOM, "");
|
|
1597
|
+
}
|
|
1598
|
+
func = exports.compile(template, options);
|
|
1599
|
+
if (options.cache) exports.cache.set(filename, func);
|
|
1600
|
+
return func;
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* Try calling handleCache with the given options and data and call the
|
|
1604
|
+
* callback with the result. If an error occurs, call the callback with
|
|
1605
|
+
* the error. Used by renderFile().
|
|
1606
|
+
*
|
|
1607
|
+
* @memberof module:ejs-internal
|
|
1608
|
+
* @param {Options} options compilation options
|
|
1609
|
+
* @param {Object} data template data
|
|
1610
|
+
* @param {RenderFileCallback} cb callback
|
|
1611
|
+
* @static
|
|
1612
|
+
*/
|
|
1613
|
+
function tryHandleCache(options, data, cb) {
|
|
1614
|
+
var result;
|
|
1615
|
+
if (!cb) if (typeof exports.promiseImpl == "function") return new exports.promiseImpl(function(resolve, reject) {
|
|
1616
|
+
try {
|
|
1617
|
+
result = handleCache(options)(data);
|
|
1618
|
+
resolve(result);
|
|
1619
|
+
} catch (err) {
|
|
1620
|
+
reject(err);
|
|
1621
|
+
}
|
|
1622
|
+
});
|
|
1623
|
+
else throw new Error("Please provide a callback function");
|
|
1624
|
+
else {
|
|
1625
|
+
try {
|
|
1626
|
+
result = handleCache(options)(data);
|
|
1627
|
+
} catch (err) {
|
|
1628
|
+
return cb(err);
|
|
1629
|
+
}
|
|
1630
|
+
cb(null, result);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* fileLoader is independent
|
|
1635
|
+
*
|
|
1636
|
+
* @param {String} filePath ejs file path.
|
|
1637
|
+
* @return {String} The contents of the specified file.
|
|
1638
|
+
* @static
|
|
1639
|
+
*/
|
|
1640
|
+
function fileLoader(filePath) {
|
|
1641
|
+
return exports.fileLoader(filePath);
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Get the template function.
|
|
1645
|
+
*
|
|
1646
|
+
* If `options.cache` is `true`, then the template is cached.
|
|
1647
|
+
*
|
|
1648
|
+
* @memberof module:ejs-internal
|
|
1649
|
+
* @param {String} path path for the specified file
|
|
1650
|
+
* @param {Options} options compilation options
|
|
1651
|
+
* @return {(TemplateFunction|ClientFunction)}
|
|
1652
|
+
* Depending on the value of `options.client`, either type might be returned
|
|
1653
|
+
* @static
|
|
1654
|
+
*/
|
|
1655
|
+
function includeFile(path$7, options) {
|
|
1656
|
+
var opts = utils.shallowCopy(utils.createNullProtoObjWherePossible(), options);
|
|
1657
|
+
opts.filename = getIncludePath(path$7, opts);
|
|
1658
|
+
if (typeof options.includer === "function") {
|
|
1659
|
+
var includerResult = options.includer(path$7, opts.filename);
|
|
1660
|
+
if (includerResult) {
|
|
1661
|
+
if (includerResult.filename) opts.filename = includerResult.filename;
|
|
1662
|
+
if (includerResult.template) return handleCache(opts, includerResult.template);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
return handleCache(opts);
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Re-throw the given `err` in context to the `str` of ejs, `filename`, and
|
|
1669
|
+
* `lineno`.
|
|
1670
|
+
*
|
|
1671
|
+
* @implements {RethrowCallback}
|
|
1672
|
+
* @memberof module:ejs-internal
|
|
1673
|
+
* @param {Error} err Error object
|
|
1674
|
+
* @param {String} str EJS source
|
|
1675
|
+
* @param {String} flnm file name of the EJS file
|
|
1676
|
+
* @param {Number} lineno line number of the error
|
|
1677
|
+
* @param {EscapeCallback} esc
|
|
1678
|
+
* @static
|
|
1679
|
+
*/
|
|
1680
|
+
function rethrow(err, str, flnm, lineno, esc) {
|
|
1681
|
+
var lines = str.split("\n");
|
|
1682
|
+
var start = Math.max(lineno - 3, 0);
|
|
1683
|
+
var end = Math.min(lines.length, lineno + 3);
|
|
1684
|
+
var filename = esc(flnm);
|
|
1685
|
+
var context = lines.slice(start, end).map(function(line, i) {
|
|
1686
|
+
var curr = i + start + 1;
|
|
1687
|
+
return (curr == lineno ? " >> " : " ") + curr + "| " + line;
|
|
1688
|
+
}).join("\n");
|
|
1689
|
+
err.path = filename;
|
|
1690
|
+
err.message = (filename || "ejs") + ":" + lineno + "\n" + context + "\n\n" + err.message;
|
|
1691
|
+
throw err;
|
|
1692
|
+
}
|
|
1693
|
+
function stripSemi(str) {
|
|
1694
|
+
return str.replace(/;(\s*$)/, "$1");
|
|
1695
|
+
}
|
|
1696
|
+
/**
|
|
1697
|
+
* Compile the given `str` of ejs into a template function.
|
|
1698
|
+
*
|
|
1699
|
+
* @param {String} template EJS template
|
|
1700
|
+
*
|
|
1701
|
+
* @param {Options} [opts] compilation options
|
|
1702
|
+
*
|
|
1703
|
+
* @return {(TemplateFunction|ClientFunction)}
|
|
1704
|
+
* Depending on the value of `opts.client`, either type might be returned.
|
|
1705
|
+
* Note that the return type of the function also depends on the value of `opts.async`.
|
|
1706
|
+
* @public
|
|
1707
|
+
*/
|
|
1708
|
+
exports.compile = function compile(template, opts) {
|
|
1709
|
+
var templ;
|
|
1710
|
+
if (opts && opts.scope) {
|
|
1711
|
+
if (!scopeOptionWarned) {
|
|
1712
|
+
console.warn("`scope` option is deprecated and will be removed in EJS 3");
|
|
1713
|
+
scopeOptionWarned = true;
|
|
1714
|
+
}
|
|
1715
|
+
if (!opts.context) opts.context = opts.scope;
|
|
1716
|
+
delete opts.scope;
|
|
1717
|
+
}
|
|
1718
|
+
templ = new Template(template, opts);
|
|
1719
|
+
return templ.compile();
|
|
1720
|
+
};
|
|
1721
|
+
/**
|
|
1722
|
+
* Render the given `template` of ejs.
|
|
1723
|
+
*
|
|
1724
|
+
* If you would like to include options but not data, you need to explicitly
|
|
1725
|
+
* call this function with `data` being an empty object or `null`.
|
|
1726
|
+
*
|
|
1727
|
+
* @param {String} template EJS template
|
|
1728
|
+
* @param {Object} [data={}] template data
|
|
1729
|
+
* @param {Options} [opts={}] compilation and rendering options
|
|
1730
|
+
* @return {(String|Promise<String>)}
|
|
1731
|
+
* Return value type depends on `opts.async`.
|
|
1732
|
+
* @public
|
|
1733
|
+
*/
|
|
1734
|
+
exports.render = function(template, d$2, o$1) {
|
|
1735
|
+
var data = d$2 || utils.createNullProtoObjWherePossible();
|
|
1736
|
+
var opts = o$1 || utils.createNullProtoObjWherePossible();
|
|
1737
|
+
if (arguments.length == 2) utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA);
|
|
1738
|
+
return handleCache(opts, template)(data);
|
|
1739
|
+
};
|
|
1740
|
+
/**
|
|
1741
|
+
* Render an EJS file at the given `path` and callback `cb(err, str)`.
|
|
1742
|
+
*
|
|
1743
|
+
* If you would like to include options but not data, you need to explicitly
|
|
1744
|
+
* call this function with `data` being an empty object or `null`.
|
|
1745
|
+
*
|
|
1746
|
+
* @param {String} path path to the EJS file
|
|
1747
|
+
* @param {Object} [data={}] template data
|
|
1748
|
+
* @param {Options} [opts={}] compilation and rendering options
|
|
1749
|
+
* @param {RenderFileCallback} cb callback
|
|
1750
|
+
* @public
|
|
1751
|
+
*/
|
|
1752
|
+
exports.renderFile = function() {
|
|
1753
|
+
var args = Array.prototype.slice.call(arguments);
|
|
1754
|
+
var filename = args.shift();
|
|
1755
|
+
var cb;
|
|
1756
|
+
var opts = { filename };
|
|
1757
|
+
var data;
|
|
1758
|
+
var viewOpts;
|
|
1759
|
+
if (typeof arguments[arguments.length - 1] == "function") cb = args.pop();
|
|
1760
|
+
if (args.length) {
|
|
1761
|
+
data = args.shift();
|
|
1762
|
+
if (args.length) utils.shallowCopy(opts, args.pop());
|
|
1763
|
+
else {
|
|
1764
|
+
if (data.settings) {
|
|
1765
|
+
if (data.settings.views) opts.views = data.settings.views;
|
|
1766
|
+
if (data.settings["view cache"]) opts.cache = true;
|
|
1767
|
+
viewOpts = data.settings["view options"];
|
|
1768
|
+
if (viewOpts) utils.shallowCopy(opts, viewOpts);
|
|
1769
|
+
}
|
|
1770
|
+
utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA_EXPRESS);
|
|
1771
|
+
}
|
|
1772
|
+
opts.filename = filename;
|
|
1773
|
+
} else data = utils.createNullProtoObjWherePossible();
|
|
1774
|
+
return tryHandleCache(opts, data, cb);
|
|
1775
|
+
};
|
|
1776
|
+
/**
|
|
1777
|
+
* Clear intermediate JavaScript cache. Calls {@link Cache#reset}.
|
|
1778
|
+
* @public
|
|
1779
|
+
*/
|
|
1780
|
+
/**
|
|
1781
|
+
* EJS template class
|
|
1782
|
+
* @public
|
|
1783
|
+
*/
|
|
1784
|
+
exports.Template = Template;
|
|
1785
|
+
exports.clearCache = function() {
|
|
1786
|
+
exports.cache.reset();
|
|
1787
|
+
};
|
|
1788
|
+
function Template(text, optsParam) {
|
|
1789
|
+
var opts = utils.hasOwnOnlyObject(optsParam);
|
|
1790
|
+
var options = utils.createNullProtoObjWherePossible();
|
|
1791
|
+
this.templateText = text;
|
|
1792
|
+
/** @type {string | null} */
|
|
1793
|
+
this.mode = null;
|
|
1794
|
+
this.truncate = false;
|
|
1795
|
+
this.currentLine = 1;
|
|
1796
|
+
this.source = "";
|
|
1797
|
+
options.client = opts.client || false;
|
|
1798
|
+
options.escapeFunction = opts.escape || opts.escapeFunction || utils.escapeXML;
|
|
1799
|
+
options.compileDebug = opts.compileDebug !== false;
|
|
1800
|
+
options.debug = !!opts.debug;
|
|
1801
|
+
options.filename = opts.filename;
|
|
1802
|
+
options.openDelimiter = opts.openDelimiter || exports.openDelimiter || _DEFAULT_OPEN_DELIMITER;
|
|
1803
|
+
options.closeDelimiter = opts.closeDelimiter || exports.closeDelimiter || _DEFAULT_CLOSE_DELIMITER;
|
|
1804
|
+
options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER;
|
|
1805
|
+
options.strict = opts.strict || false;
|
|
1806
|
+
options.context = opts.context;
|
|
1807
|
+
options.cache = opts.cache || false;
|
|
1808
|
+
options.rmWhitespace = opts.rmWhitespace;
|
|
1809
|
+
options.root = opts.root;
|
|
1810
|
+
options.includer = opts.includer;
|
|
1811
|
+
options.outputFunctionName = opts.outputFunctionName;
|
|
1812
|
+
options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME;
|
|
1813
|
+
options.views = opts.views;
|
|
1814
|
+
options.async = opts.async;
|
|
1815
|
+
options.destructuredLocals = opts.destructuredLocals;
|
|
1816
|
+
options.legacyInclude = typeof opts.legacyInclude != "undefined" ? !!opts.legacyInclude : true;
|
|
1817
|
+
if (options.strict) options._with = false;
|
|
1818
|
+
else options._with = typeof opts._with != "undefined" ? opts._with : true;
|
|
1819
|
+
this.opts = options;
|
|
1820
|
+
this.regex = this.createRegex();
|
|
1821
|
+
}
|
|
1822
|
+
Template.modes = {
|
|
1823
|
+
EVAL: "eval",
|
|
1824
|
+
ESCAPED: "escaped",
|
|
1825
|
+
RAW: "raw",
|
|
1826
|
+
COMMENT: "comment",
|
|
1827
|
+
LITERAL: "literal"
|
|
1828
|
+
};
|
|
1829
|
+
Template.prototype = {
|
|
1830
|
+
createRegex: function() {
|
|
1831
|
+
var str = _REGEX_STRING;
|
|
1832
|
+
var delim = utils.escapeRegExpChars(this.opts.delimiter);
|
|
1833
|
+
var open = utils.escapeRegExpChars(this.opts.openDelimiter);
|
|
1834
|
+
var close = utils.escapeRegExpChars(this.opts.closeDelimiter);
|
|
1835
|
+
str = str.replace(/%/g, delim).replace(/</g, open).replace(/>/g, close);
|
|
1836
|
+
return new RegExp(str);
|
|
1837
|
+
},
|
|
1838
|
+
compile: function() {
|
|
1839
|
+
/** @type {string} */
|
|
1840
|
+
var src;
|
|
1841
|
+
/** @type {ClientFunction} */
|
|
1842
|
+
var fn;
|
|
1843
|
+
var opts = this.opts;
|
|
1844
|
+
var prepended = "";
|
|
1845
|
+
var appended = "";
|
|
1846
|
+
/** @type {EscapeCallback} */
|
|
1847
|
+
var escapeFn = opts.escapeFunction;
|
|
1848
|
+
/** @type {FunctionConstructor} */
|
|
1849
|
+
var ctor;
|
|
1850
|
+
/** @type {string} */
|
|
1851
|
+
var sanitizedFilename = opts.filename ? JSON.stringify(opts.filename) : "undefined";
|
|
1852
|
+
if (!this.source) {
|
|
1853
|
+
this.generateSource();
|
|
1854
|
+
prepended += " var __output = \"\";\n function __append(s) { if (s !== undefined && s !== null) __output += s }\n";
|
|
1855
|
+
if (opts.outputFunctionName) {
|
|
1856
|
+
if (!_JS_IDENTIFIER.test(opts.outputFunctionName)) throw new Error("outputFunctionName is not a valid JS identifier.");
|
|
1857
|
+
prepended += " var " + opts.outputFunctionName + " = __append;\n";
|
|
1858
|
+
}
|
|
1859
|
+
if (opts.localsName && !_JS_IDENTIFIER.test(opts.localsName)) throw new Error("localsName is not a valid JS identifier.");
|
|
1860
|
+
if (opts.destructuredLocals && opts.destructuredLocals.length) {
|
|
1861
|
+
var destructuring = " var __locals = (" + opts.localsName + " || {}),\n";
|
|
1862
|
+
for (var i = 0; i < opts.destructuredLocals.length; i++) {
|
|
1863
|
+
var name$2 = opts.destructuredLocals[i];
|
|
1864
|
+
if (!_JS_IDENTIFIER.test(name$2)) throw new Error("destructuredLocals[" + i + "] is not a valid JS identifier.");
|
|
1865
|
+
if (i > 0) destructuring += ",\n ";
|
|
1866
|
+
destructuring += name$2 + " = __locals." + name$2;
|
|
1867
|
+
}
|
|
1868
|
+
prepended += destructuring + ";\n";
|
|
1869
|
+
}
|
|
1870
|
+
if (opts._with !== false) {
|
|
1871
|
+
prepended += " with (" + opts.localsName + " || {}) {\n";
|
|
1872
|
+
appended += " }\n";
|
|
1873
|
+
}
|
|
1874
|
+
appended += " return __output;\n";
|
|
1875
|
+
this.source = prepended + this.source + appended;
|
|
1876
|
+
}
|
|
1877
|
+
if (opts.compileDebug) src = "var __line = 1\n , __lines = " + JSON.stringify(this.templateText) + "\n , __filename = " + sanitizedFilename + ";\ntry {\n" + this.source + "} catch (e) {\n rethrow(e, __lines, __filename, __line, escapeFn);\n}\n";
|
|
1878
|
+
else src = this.source;
|
|
1879
|
+
if (opts.client) {
|
|
1880
|
+
src = "escapeFn = escapeFn || " + escapeFn.toString() + ";\n" + src;
|
|
1881
|
+
if (opts.compileDebug) src = "rethrow = rethrow || " + rethrow.toString() + ";\n" + src;
|
|
1882
|
+
}
|
|
1883
|
+
if (opts.strict) src = "\"use strict\";\n" + src;
|
|
1884
|
+
if (opts.debug) console.log(src);
|
|
1885
|
+
if (opts.compileDebug && opts.filename) src = src + "\n//# sourceURL=" + sanitizedFilename + "\n";
|
|
1886
|
+
try {
|
|
1887
|
+
if (opts.async) try {
|
|
1888
|
+
ctor = new Function("return (async function(){}).constructor;")();
|
|
1889
|
+
} catch (e) {
|
|
1890
|
+
if (e instanceof SyntaxError) throw new Error("This environment does not support async/await");
|
|
1891
|
+
else throw e;
|
|
1892
|
+
}
|
|
1893
|
+
else ctor = Function;
|
|
1894
|
+
fn = new ctor(opts.localsName + ", escapeFn, include, rethrow", src);
|
|
1895
|
+
} catch (e) {
|
|
1896
|
+
if (e instanceof SyntaxError) {
|
|
1897
|
+
if (opts.filename) e.message += " in " + opts.filename;
|
|
1898
|
+
e.message += " while compiling ejs\n\n";
|
|
1899
|
+
e.message += "If the above error is not helpful, you may want to try EJS-Lint:\n";
|
|
1900
|
+
e.message += "https://github.com/RyanZim/EJS-Lint";
|
|
1901
|
+
if (!opts.async) {
|
|
1902
|
+
e.message += "\n";
|
|
1903
|
+
e.message += "Or, if you meant to create an async function, pass `async: true` as an option.";
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
throw e;
|
|
1907
|
+
}
|
|
1908
|
+
var returnedFn = opts.client ? fn : function anonymous(data) {
|
|
1909
|
+
var include = function(path$7, includeData) {
|
|
1910
|
+
var d$2 = utils.shallowCopy(utils.createNullProtoObjWherePossible(), data);
|
|
1911
|
+
if (includeData) d$2 = utils.shallowCopy(d$2, includeData);
|
|
1912
|
+
return includeFile(path$7, opts)(d$2);
|
|
1913
|
+
};
|
|
1914
|
+
return fn.apply(opts.context, [
|
|
1915
|
+
data || utils.createNullProtoObjWherePossible(),
|
|
1916
|
+
escapeFn,
|
|
1917
|
+
include,
|
|
1918
|
+
rethrow
|
|
1919
|
+
]);
|
|
1920
|
+
};
|
|
1921
|
+
if (opts.filename && typeof Object.defineProperty === "function") {
|
|
1922
|
+
var filename = opts.filename;
|
|
1923
|
+
var basename = path$6.basename(filename, path$6.extname(filename));
|
|
1924
|
+
try {
|
|
1925
|
+
Object.defineProperty(returnedFn, "name", {
|
|
1926
|
+
value: basename,
|
|
1927
|
+
writable: false,
|
|
1928
|
+
enumerable: false,
|
|
1929
|
+
configurable: true
|
|
1930
|
+
});
|
|
1931
|
+
} catch (e) {}
|
|
1932
|
+
}
|
|
1933
|
+
return returnedFn;
|
|
1934
|
+
},
|
|
1935
|
+
generateSource: function() {
|
|
1936
|
+
var opts = this.opts;
|
|
1937
|
+
if (opts.rmWhitespace) this.templateText = this.templateText.replace(/[\r\n]+/g, "\n").replace(/^\s+|\s+$/gm, "");
|
|
1938
|
+
this.templateText = this.templateText.replace(/[ \t]*<%_/gm, "<%_").replace(/_%>[ \t]*/gm, "_%>");
|
|
1939
|
+
var self = this;
|
|
1940
|
+
var matches = this.parseTemplateText();
|
|
1941
|
+
var d$2 = this.opts.delimiter;
|
|
1942
|
+
var o$1 = this.opts.openDelimiter;
|
|
1943
|
+
var c$1 = this.opts.closeDelimiter;
|
|
1944
|
+
if (matches && matches.length) matches.forEach(function(line, index) {
|
|
1945
|
+
var closing;
|
|
1946
|
+
if (line.indexOf(o$1 + d$2) === 0 && line.indexOf(o$1 + d$2 + d$2) !== 0) {
|
|
1947
|
+
closing = matches[index + 2];
|
|
1948
|
+
if (!(closing == d$2 + c$1 || closing == "-" + d$2 + c$1 || closing == "_" + d$2 + c$1)) throw new Error("Could not find matching close tag for \"" + line + "\".");
|
|
1949
|
+
}
|
|
1950
|
+
self.scanLine(line);
|
|
1951
|
+
});
|
|
1952
|
+
},
|
|
1953
|
+
parseTemplateText: function() {
|
|
1954
|
+
var str = this.templateText;
|
|
1955
|
+
var pat = this.regex;
|
|
1956
|
+
var result = pat.exec(str);
|
|
1957
|
+
var arr = [];
|
|
1958
|
+
var firstPos;
|
|
1959
|
+
while (result) {
|
|
1960
|
+
firstPos = result.index;
|
|
1961
|
+
if (firstPos !== 0) {
|
|
1962
|
+
arr.push(str.substring(0, firstPos));
|
|
1963
|
+
str = str.slice(firstPos);
|
|
1964
|
+
}
|
|
1965
|
+
arr.push(result[0]);
|
|
1966
|
+
str = str.slice(result[0].length);
|
|
1967
|
+
result = pat.exec(str);
|
|
1968
|
+
}
|
|
1969
|
+
if (str) arr.push(str);
|
|
1970
|
+
return arr;
|
|
1971
|
+
},
|
|
1972
|
+
_addOutput: function(line) {
|
|
1973
|
+
if (this.truncate) {
|
|
1974
|
+
line = line.replace(/^(?:\r\n|\r|\n)/, "");
|
|
1975
|
+
this.truncate = false;
|
|
1976
|
+
}
|
|
1977
|
+
if (!line) return line;
|
|
1978
|
+
line = line.replace(/\\/g, "\\\\");
|
|
1979
|
+
line = line.replace(/\n/g, "\\n");
|
|
1980
|
+
line = line.replace(/\r/g, "\\r");
|
|
1981
|
+
line = line.replace(/"/g, "\\\"");
|
|
1982
|
+
this.source += " ; __append(\"" + line + "\")\n";
|
|
1983
|
+
},
|
|
1984
|
+
scanLine: function(line) {
|
|
1985
|
+
var self = this;
|
|
1986
|
+
var d$2 = this.opts.delimiter;
|
|
1987
|
+
var o$1 = this.opts.openDelimiter;
|
|
1988
|
+
var c$1 = this.opts.closeDelimiter;
|
|
1989
|
+
var newLineCount = 0;
|
|
1990
|
+
newLineCount = line.split("\n").length - 1;
|
|
1991
|
+
switch (line) {
|
|
1992
|
+
case o$1 + d$2:
|
|
1993
|
+
case o$1 + d$2 + "_":
|
|
1994
|
+
this.mode = Template.modes.EVAL;
|
|
1995
|
+
break;
|
|
1996
|
+
case o$1 + d$2 + "=":
|
|
1997
|
+
this.mode = Template.modes.ESCAPED;
|
|
1998
|
+
break;
|
|
1999
|
+
case o$1 + d$2 + "-":
|
|
2000
|
+
this.mode = Template.modes.RAW;
|
|
2001
|
+
break;
|
|
2002
|
+
case o$1 + d$2 + "#":
|
|
2003
|
+
this.mode = Template.modes.COMMENT;
|
|
2004
|
+
break;
|
|
2005
|
+
case o$1 + d$2 + d$2:
|
|
2006
|
+
this.mode = Template.modes.LITERAL;
|
|
2007
|
+
this.source += " ; __append(\"" + line.replace(o$1 + d$2 + d$2, o$1 + d$2) + "\")\n";
|
|
2008
|
+
break;
|
|
2009
|
+
case d$2 + d$2 + c$1:
|
|
2010
|
+
this.mode = Template.modes.LITERAL;
|
|
2011
|
+
this.source += " ; __append(\"" + line.replace(d$2 + d$2 + c$1, d$2 + c$1) + "\")\n";
|
|
2012
|
+
break;
|
|
2013
|
+
case d$2 + c$1:
|
|
2014
|
+
case "-" + d$2 + c$1:
|
|
2015
|
+
case "_" + d$2 + c$1:
|
|
2016
|
+
if (this.mode == Template.modes.LITERAL) this._addOutput(line);
|
|
2017
|
+
this.mode = null;
|
|
2018
|
+
this.truncate = line.indexOf("-") === 0 || line.indexOf("_") === 0;
|
|
2019
|
+
break;
|
|
2020
|
+
default: if (this.mode) {
|
|
2021
|
+
switch (this.mode) {
|
|
2022
|
+
case Template.modes.EVAL:
|
|
2023
|
+
case Template.modes.ESCAPED:
|
|
2024
|
+
case Template.modes.RAW: if (line.lastIndexOf("//") > line.lastIndexOf("\n")) line += "\n";
|
|
2025
|
+
}
|
|
2026
|
+
switch (this.mode) {
|
|
2027
|
+
case Template.modes.EVAL:
|
|
2028
|
+
this.source += " ; " + line + "\n";
|
|
2029
|
+
break;
|
|
2030
|
+
case Template.modes.ESCAPED:
|
|
2031
|
+
this.source += " ; __append(escapeFn(" + stripSemi(line) + "))\n";
|
|
2032
|
+
break;
|
|
2033
|
+
case Template.modes.RAW:
|
|
2034
|
+
this.source += " ; __append(" + stripSemi(line) + ")\n";
|
|
2035
|
+
break;
|
|
2036
|
+
case Template.modes.COMMENT: break;
|
|
2037
|
+
case Template.modes.LITERAL:
|
|
2038
|
+
this._addOutput(line);
|
|
2039
|
+
break;
|
|
2040
|
+
}
|
|
2041
|
+
} else this._addOutput(line);
|
|
2042
|
+
}
|
|
2043
|
+
if (self.opts.compileDebug && newLineCount) {
|
|
2044
|
+
this.currentLine += newLineCount;
|
|
2045
|
+
this.source += " ; __line = " + this.currentLine + "\n";
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
};
|
|
2049
|
+
/**
|
|
2050
|
+
* Escape characters reserved in XML.
|
|
2051
|
+
*
|
|
2052
|
+
* This is simply an export of {@link module:utils.escapeXML}.
|
|
2053
|
+
*
|
|
2054
|
+
* If `markup` is `undefined` or `null`, the empty string is returned.
|
|
2055
|
+
*
|
|
2056
|
+
* @param {String} markup Input string
|
|
2057
|
+
* @return {String} Escaped string
|
|
2058
|
+
* @public
|
|
2059
|
+
* @func
|
|
2060
|
+
* */
|
|
2061
|
+
exports.escapeXML = utils.escapeXML;
|
|
2062
|
+
/**
|
|
2063
|
+
* Express.js support.
|
|
2064
|
+
*
|
|
2065
|
+
* This is an alias for {@link module:ejs.renderFile}, in order to support
|
|
2066
|
+
* Express.js out-of-the-box.
|
|
2067
|
+
*
|
|
2068
|
+
* @func
|
|
2069
|
+
*/
|
|
2070
|
+
exports.__express = exports.renderFile;
|
|
2071
|
+
/**
|
|
2072
|
+
* Version of EJS.
|
|
2073
|
+
*
|
|
2074
|
+
* @readonly
|
|
2075
|
+
* @type {String}
|
|
2076
|
+
* @public
|
|
2077
|
+
*/
|
|
2078
|
+
exports.VERSION = _VERSION_STRING;
|
|
2079
|
+
/**
|
|
2080
|
+
* Name for detection of EJS.
|
|
2081
|
+
*
|
|
2082
|
+
* @readonly
|
|
2083
|
+
* @type {String}
|
|
2084
|
+
* @public
|
|
2085
|
+
*/
|
|
2086
|
+
exports.name = _NAME;
|
|
2087
|
+
if (typeof window != "undefined") window.ejs = exports;
|
|
2088
|
+
} });
|
|
2089
|
+
var import_ejs = __toESM(require_ejs(), 1);
|
|
2090
|
+
|
|
2091
|
+
//#endregion
|
|
2092
|
+
//#region utils/banners.ts
|
|
2093
|
+
const defaultBanner = "Vue.js - The Progressive JavaScript Framework";
|
|
2094
|
+
const gradientBanner = "\x1B[38;2;66;211;146mV\x1B[39m\x1B[38;2;66;211;146mu\x1B[39m\x1B[38;2;66;211;146me\x1B[39m\x1B[38;2;66;211;146m.\x1B[39m\x1B[38;2;66;211;146mj\x1B[39m\x1B[38;2;67;209;149ms\x1B[39m \x1B[38;2;68;206;152m-\x1B[39m \x1B[38;2;69;204;155mT\x1B[39m\x1B[38;2;70;201;158mh\x1B[39m\x1B[38;2;71;199;162me\x1B[39m \x1B[38;2;72;196;165mP\x1B[39m\x1B[38;2;73;194;168mr\x1B[39m\x1B[38;2;74;192;171mo\x1B[39m\x1B[38;2;75;189;174mg\x1B[39m\x1B[38;2;76;187;177mr\x1B[39m\x1B[38;2;77;184;180me\x1B[39m\x1B[38;2;78;182;183ms\x1B[39m\x1B[38;2;79;179;186ms\x1B[39m\x1B[38;2;80;177;190mi\x1B[39m\x1B[38;2;81;175;193mv\x1B[39m\x1B[38;2;82;172;196me\x1B[39m \x1B[38;2;83;170;199mJ\x1B[39m\x1B[38;2;83;167;202ma\x1B[39m\x1B[38;2;84;165;205mv\x1B[39m\x1B[38;2;85;162;208ma\x1B[39m\x1B[38;2;86;160;211mS\x1B[39m\x1B[38;2;87;158;215mc\x1B[39m\x1B[38;2;88;155;218mr\x1B[39m\x1B[38;2;89;153;221mi\x1B[39m\x1B[38;2;90;150;224mp\x1B[39m\x1B[38;2;91;148;227mt\x1B[39m \x1B[38;2;92;145;230mF\x1B[39m\x1B[38;2;93;143;233mr\x1B[39m\x1B[38;2;94;141;236ma\x1B[39m\x1B[38;2;95;138;239mm\x1B[39m\x1B[38;2;96;136;243me\x1B[39m\x1B[38;2;97;133;246mw\x1B[39m\x1B[38;2;98;131;249mo\x1B[39m\x1B[38;2;99;128;252mr\x1B[39m\x1B[38;2;100;126;255mk\x1B[39m";
|
|
2095
|
+
|
|
2096
|
+
//#endregion
|
|
2097
|
+
//#region utils/deepMerge.ts
|
|
2098
|
+
const isObject$1 = (val) => val && typeof val === "object";
|
|
2099
|
+
const mergeArrayWithDedupe$1 = (a, b$1) => Array.from(new Set([...a, ...b$1]));
|
|
2100
|
+
/**
|
|
2101
|
+
* Recursively merge the content of the new object to the existing one
|
|
2102
|
+
* @param {Object} target the existing object
|
|
2103
|
+
* @param {Object} obj the new object
|
|
2104
|
+
*/
|
|
2105
|
+
function deepMerge$1(target, obj) {
|
|
2106
|
+
for (const key of Object.keys(obj)) {
|
|
2107
|
+
const oldVal = target[key];
|
|
2108
|
+
const newVal = obj[key];
|
|
2109
|
+
if (Array.isArray(oldVal) && Array.isArray(newVal)) target[key] = mergeArrayWithDedupe$1(oldVal, newVal);
|
|
2110
|
+
else if (isObject$1(oldVal) && isObject$1(newVal)) target[key] = deepMerge$1(oldVal, newVal);
|
|
2111
|
+
else target[key] = newVal;
|
|
2112
|
+
}
|
|
2113
|
+
return target;
|
|
2114
|
+
}
|
|
2115
|
+
var deepMerge_default = deepMerge$1;
|
|
2116
|
+
|
|
2117
|
+
//#endregion
|
|
2118
|
+
//#region utils/sortDependencies.ts
|
|
2119
|
+
function sortDependencies(packageJson) {
|
|
2120
|
+
const sorted = {};
|
|
2121
|
+
const depTypes = [
|
|
2122
|
+
"dependencies",
|
|
2123
|
+
"devDependencies",
|
|
2124
|
+
"peerDependencies",
|
|
2125
|
+
"optionalDependencies"
|
|
2126
|
+
];
|
|
2127
|
+
for (const depType of depTypes) if (packageJson[depType]) {
|
|
2128
|
+
sorted[depType] = {};
|
|
2129
|
+
Object.keys(packageJson[depType]).sort().forEach((name$2) => {
|
|
2130
|
+
sorted[depType][name$2] = packageJson[depType][name$2];
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
return {
|
|
2134
|
+
...packageJson,
|
|
2135
|
+
...sorted
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
//#endregion
|
|
2140
|
+
//#region utils/renderTemplate.ts
|
|
2141
|
+
/**
|
|
2142
|
+
* Renders a template folder/file to the file system,
|
|
2143
|
+
* by recursively copying all files under the `src` directory,
|
|
2144
|
+
* with the following exception:
|
|
2145
|
+
* - `_filename` should be renamed to `.filename`
|
|
2146
|
+
* - Fields in `package.json` should be recursively merged
|
|
2147
|
+
* @param {string} src source filename to copy
|
|
2148
|
+
* @param {string} dest destination filename of the copy operation
|
|
2149
|
+
*/
|
|
2150
|
+
function renderTemplate(src, dest, callbacks) {
|
|
2151
|
+
const stats = fs$5.statSync(src);
|
|
2152
|
+
if (stats.isDirectory()) {
|
|
2153
|
+
if (path$5.basename(src) === "node_modules") return;
|
|
2154
|
+
fs$5.mkdirSync(dest, { recursive: true });
|
|
2155
|
+
for (const file of fs$5.readdirSync(src)) renderTemplate(path$5.resolve(src, file), path$5.resolve(dest, file), callbacks);
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
const filename = path$5.basename(src);
|
|
2159
|
+
if (filename === "package.json" && fs$5.existsSync(dest)) {
|
|
2160
|
+
const existing = JSON.parse(fs$5.readFileSync(dest, "utf8"));
|
|
2161
|
+
const newPackage = JSON.parse(fs$5.readFileSync(src, "utf8"));
|
|
2162
|
+
const pkg = sortDependencies(deepMerge_default(existing, newPackage));
|
|
2163
|
+
fs$5.writeFileSync(dest, JSON.stringify(pkg, null, 2) + "\n");
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2166
|
+
if (filename === "extensions.json" && fs$5.existsSync(dest)) {
|
|
2167
|
+
const existing = JSON.parse(fs$5.readFileSync(dest, "utf8"));
|
|
2168
|
+
const newExtensions = JSON.parse(fs$5.readFileSync(src, "utf8"));
|
|
2169
|
+
const extensions = deepMerge_default(existing, newExtensions);
|
|
2170
|
+
fs$5.writeFileSync(dest, JSON.stringify(extensions, null, 2) + "\n");
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
if (filename === "settings.json" && fs$5.existsSync(dest)) {
|
|
2174
|
+
const existing = JSON.parse(fs$5.readFileSync(dest, "utf8"));
|
|
2175
|
+
const newSettings = JSON.parse(fs$5.readFileSync(src, "utf8"));
|
|
2176
|
+
const settings = deepMerge_default(existing, newSettings);
|
|
2177
|
+
fs$5.writeFileSync(dest, JSON.stringify(settings, null, 2) + "\n");
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
if (filename.startsWith("_")) dest = path$5.resolve(path$5.dirname(dest), filename.replace(/^_/, "."));
|
|
2181
|
+
if (filename === "_gitignore" && fs$5.existsSync(dest)) {
|
|
2182
|
+
const existing = fs$5.readFileSync(dest, "utf8");
|
|
2183
|
+
const newGitignore = fs$5.readFileSync(src, "utf8");
|
|
2184
|
+
fs$5.writeFileSync(dest, existing + "\n" + newGitignore);
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2187
|
+
if (filename.endsWith(".data.mjs")) {
|
|
2188
|
+
dest = dest.replace(/\.data\.mjs$/, "");
|
|
2189
|
+
callbacks.push(async (dataStore) => {
|
|
2190
|
+
const getData = (await import(pathToFileURL(src).toString())).default;
|
|
2191
|
+
dataStore[dest] = await getData({ oldData: dataStore[dest] || {} });
|
|
2192
|
+
});
|
|
2193
|
+
return;
|
|
2194
|
+
}
|
|
2195
|
+
fs$5.copyFileSync(src, dest);
|
|
2196
|
+
}
|
|
2197
|
+
var renderTemplate_default = renderTemplate;
|
|
2198
|
+
|
|
2199
|
+
//#endregion
|
|
2200
|
+
//#region utils/directoryTraverse.ts
|
|
2201
|
+
function preOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
|
|
2202
|
+
for (const filename of fs$4.readdirSync(dir)) {
|
|
2203
|
+
if (filename === ".git") continue;
|
|
2204
|
+
const fullpath = path$4.resolve(dir, filename);
|
|
2205
|
+
if (fs$4.lstatSync(fullpath).isDirectory()) {
|
|
2206
|
+
dirCallback(fullpath);
|
|
2207
|
+
if (fs$4.existsSync(fullpath)) preOrderDirectoryTraverse(fullpath, dirCallback, fileCallback);
|
|
2208
|
+
continue;
|
|
2209
|
+
}
|
|
2210
|
+
fileCallback(fullpath);
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
function postOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
|
|
2214
|
+
for (const filename of fs$4.readdirSync(dir)) {
|
|
2215
|
+
if (filename === ".git") continue;
|
|
2216
|
+
const fullpath = path$4.resolve(dir, filename);
|
|
2217
|
+
if (fs$4.lstatSync(fullpath).isDirectory()) {
|
|
2218
|
+
postOrderDirectoryTraverse(fullpath, dirCallback, fileCallback);
|
|
2219
|
+
dirCallback(fullpath);
|
|
2220
|
+
continue;
|
|
2221
|
+
}
|
|
2222
|
+
fileCallback(fullpath);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
//#endregion
|
|
2227
|
+
//#region utils/getCommand.ts
|
|
2228
|
+
function getCommand(packageManager$1, scriptName, args) {
|
|
2229
|
+
if (scriptName === "install") return packageManager$1 === "yarn" ? "yarn" : `${packageManager$1} install`;
|
|
2230
|
+
if (scriptName === "build") return packageManager$1 === "npm" || packageManager$1 === "bun" ? `${packageManager$1} run build` : `${packageManager$1} build`;
|
|
2231
|
+
if (args) return packageManager$1 === "npm" ? `npm run ${scriptName} -- ${args}` : `${packageManager$1} ${scriptName} ${args}`;
|
|
2232
|
+
else return packageManager$1 === "npm" ? `npm run ${scriptName}` : `${packageManager$1} ${scriptName}`;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
//#endregion
|
|
2236
|
+
//#region utils/generateReadme.ts
|
|
2237
|
+
const sfcTypeSupportDoc = [
|
|
2238
|
+
"",
|
|
2239
|
+
"## Type Support for `.vue` Imports in TS",
|
|
2240
|
+
"",
|
|
2241
|
+
"TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.",
|
|
2242
|
+
""
|
|
2243
|
+
].join("\n");
|
|
2244
|
+
function generateReadme({ projectName, packageManager: packageManager$1, needsTypeScript, needsCypress, needsNightwatch, needsCypressCT, needsNightwatchCT, needsPlaywright, needsVitest, needsEslint }) {
|
|
2245
|
+
const commandFor = (scriptName, args) => getCommand(packageManager$1, scriptName, args);
|
|
2246
|
+
let readme = `# ${projectName}
|
|
2247
|
+
|
|
2248
|
+
This template should help get you started developing with Vue 3 in Vite.
|
|
2249
|
+
|
|
2250
|
+
## Recommended IDE Setup
|
|
2251
|
+
|
|
2252
|
+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
|
2253
|
+
${needsTypeScript ? sfcTypeSupportDoc : ""}
|
|
2254
|
+
## Customize configuration
|
|
2255
|
+
|
|
2256
|
+
See [Vite Configuration Reference](https://vite.dev/config/).
|
|
2257
|
+
|
|
2258
|
+
## Project Setup
|
|
2259
|
+
|
|
2260
|
+
`;
|
|
2261
|
+
let installCommand = commandFor("install");
|
|
2262
|
+
if (packageManager$1 === "pnpm" && needsNightwatch) installCommand += `\npnpm approve-builds # for pnpm 10+`;
|
|
2263
|
+
let npmScriptsDescriptions = `\`\`\`sh
|
|
2264
|
+
${installCommand}
|
|
2265
|
+
\`\`\`
|
|
2266
|
+
|
|
2267
|
+
### Compile and Hot-Reload for Development
|
|
2268
|
+
|
|
2269
|
+
\`\`\`sh
|
|
2270
|
+
${commandFor("dev")}
|
|
2271
|
+
\`\`\`
|
|
2272
|
+
|
|
2273
|
+
### ${needsTypeScript ? "Type-Check, " : ""}Compile and Minify for Production
|
|
2274
|
+
|
|
2275
|
+
\`\`\`sh
|
|
2276
|
+
${commandFor("build")}
|
|
2277
|
+
\`\`\`
|
|
2278
|
+
`;
|
|
2279
|
+
if (needsVitest) npmScriptsDescriptions += `
|
|
2280
|
+
### Run Unit Tests with [Vitest](https://vitest.dev/)
|
|
2281
|
+
|
|
2282
|
+
\`\`\`sh
|
|
2283
|
+
${commandFor("test:unit")}
|
|
2284
|
+
\`\`\`
|
|
2285
|
+
`;
|
|
2286
|
+
if (needsCypressCT) npmScriptsDescriptions += `
|
|
2287
|
+
### Run Headed Component Tests with [Cypress Component Testing](https://on.cypress.io/component)
|
|
2288
|
+
|
|
2289
|
+
\`\`\`sh
|
|
2290
|
+
${commandFor("test:unit:dev")} # or \`${commandFor("test:unit")}\` for headless testing
|
|
2291
|
+
\`\`\`
|
|
2292
|
+
`;
|
|
2293
|
+
if (needsCypress) npmScriptsDescriptions += `
|
|
2294
|
+
### Run End-to-End Tests with [Cypress](https://www.cypress.io/)
|
|
2295
|
+
|
|
2296
|
+
\`\`\`sh
|
|
2297
|
+
${commandFor("test:e2e:dev")}
|
|
2298
|
+
\`\`\`
|
|
2299
|
+
|
|
2300
|
+
This runs the end-to-end tests against the Vite development server.
|
|
2301
|
+
It is much faster than the production build.
|
|
2302
|
+
|
|
2303
|
+
But it's still recommended to test the production build with \`test:e2e\` before deploying (e.g. in CI environments):
|
|
2304
|
+
|
|
2305
|
+
\`\`\`sh
|
|
2306
|
+
${commandFor("build")}
|
|
2307
|
+
${commandFor("test:e2e")}
|
|
2308
|
+
\`\`\`
|
|
2309
|
+
`;
|
|
2310
|
+
if (needsNightwatch) npmScriptsDescriptions += `
|
|
2311
|
+
### Run End-to-End Tests with [Nightwatch](https://nightwatchjs.org/)
|
|
2312
|
+
|
|
2313
|
+
\`\`\`sh
|
|
2314
|
+
# When using CI, the project must be built first.
|
|
2315
|
+
${commandFor("build")}
|
|
2316
|
+
|
|
2317
|
+
# Runs the end-to-end tests
|
|
2318
|
+
${commandFor("test:e2e")}
|
|
2319
|
+
# Runs the tests only on Chrome
|
|
2320
|
+
${commandFor("test:e2e", "--env chrome")}
|
|
2321
|
+
# Runs the tests of a specific file
|
|
2322
|
+
${commandFor("test:e2e", `tests/e2e/example.${needsTypeScript ? "ts" : "js"}`)}
|
|
2323
|
+
# Runs the tests in debug mode
|
|
2324
|
+
${commandFor("test:e2e", "--debug")}
|
|
2325
|
+
\`\`\`
|
|
2326
|
+
`;
|
|
2327
|
+
if (needsNightwatchCT) npmScriptsDescriptions += `
|
|
2328
|
+
### Run Headed Component Tests with [Nightwatch Component Testing](https://nightwatchjs.org/guide/component-testing/introduction.html)
|
|
2329
|
+
|
|
2330
|
+
\`\`\`sh
|
|
2331
|
+
${commandFor("test:unit")}
|
|
2332
|
+
${commandFor("test:unit -- --headless # for headless testing")}
|
|
2333
|
+
\`\`\`
|
|
2334
|
+
`;
|
|
2335
|
+
if (needsPlaywright) npmScriptsDescriptions += `
|
|
2336
|
+
### Run End-to-End Tests with [Playwright](https://playwright.dev)
|
|
2337
|
+
|
|
2338
|
+
\`\`\`sh
|
|
2339
|
+
# Install browsers for the first run
|
|
2340
|
+
npx playwright install
|
|
2341
|
+
|
|
2342
|
+
# When testing on CI, must build the project first
|
|
2343
|
+
${commandFor("build")}
|
|
2344
|
+
|
|
2345
|
+
# Runs the end-to-end tests
|
|
2346
|
+
${commandFor("test:e2e")}
|
|
2347
|
+
# Runs the tests only on Chromium
|
|
2348
|
+
${commandFor("test:e2e", "--project=chromium")}
|
|
2349
|
+
# Runs the tests of a specific file
|
|
2350
|
+
${commandFor("test:e2e", "tests/example.spec.ts")}
|
|
2351
|
+
# Runs the tests in debug mode
|
|
2352
|
+
${commandFor("test:e2e", "--debug")}
|
|
2353
|
+
\`\`\`
|
|
2354
|
+
`;
|
|
2355
|
+
if (needsEslint) npmScriptsDescriptions += `
|
|
2356
|
+
### Lint with [ESLint](https://eslint.org/)
|
|
2357
|
+
|
|
2358
|
+
\`\`\`sh
|
|
2359
|
+
${commandFor("lint")}
|
|
2360
|
+
\`\`\`
|
|
2361
|
+
`;
|
|
2362
|
+
readme += npmScriptsDescriptions;
|
|
2363
|
+
return readme;
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
//#endregion
|
|
2367
|
+
//#region utils/getLanguage.ts
|
|
2368
|
+
/**
|
|
2369
|
+
*
|
|
2370
|
+
* This function is used to link obtained locale with correct locale file in order to make locales reusable
|
|
2371
|
+
*
|
|
2372
|
+
* @param locale the obtained locale
|
|
2373
|
+
* @returns locale that linked with correct name
|
|
2374
|
+
*/
|
|
2375
|
+
function linkLocale(locale) {
|
|
2376
|
+
if (locale === "C") return "en-US";
|
|
2377
|
+
let linkedLocale;
|
|
2378
|
+
try {
|
|
2379
|
+
linkedLocale = Intl.getCanonicalLocales(locale)[0];
|
|
2380
|
+
} catch (error) {
|
|
2381
|
+
console.log(`${error.toString()}, invalid language tag: "${locale}"\n`);
|
|
2382
|
+
}
|
|
2383
|
+
switch (linkedLocale) {
|
|
2384
|
+
case "zh-TW":
|
|
2385
|
+
case "zh-HK":
|
|
2386
|
+
case "zh-MO":
|
|
2387
|
+
linkedLocale = "zh-Hant";
|
|
2388
|
+
break;
|
|
2389
|
+
case "zh-CN":
|
|
2390
|
+
case "zh-SG":
|
|
2391
|
+
linkedLocale = "zh-Hans";
|
|
2392
|
+
break;
|
|
2393
|
+
default: linkedLocale = locale;
|
|
2394
|
+
}
|
|
2395
|
+
return linkedLocale;
|
|
2396
|
+
}
|
|
2397
|
+
function getLocale() {
|
|
2398
|
+
const shellLocale = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || Intl.DateTimeFormat().resolvedOptions().locale || "en-US";
|
|
2399
|
+
return linkLocale(shellLocale.split(".")[0].replace("_", "-"));
|
|
2400
|
+
}
|
|
2401
|
+
async function getLanguage(localesRoot) {
|
|
2402
|
+
const locale = getLocale();
|
|
2403
|
+
const languageFilePath = path$3.resolve(localesRoot, `${locale}.json`);
|
|
2404
|
+
const doesLanguageExist = fs$3.existsSync(languageFilePath);
|
|
2405
|
+
const lang = doesLanguageExist ? (await import(languageFilePath, { with: { type: "json" } })).default : (await import(path$3.resolve(localesRoot, "en-US.json"), { with: { type: "json" } })).default;
|
|
2406
|
+
return lang;
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
//#endregion
|
|
2410
|
+
//#region node_modules/.pnpm/@vue+create-eslint-config@0.10.1/node_modules/@vue/create-eslint-config/renderEjsFile.js
|
|
2411
|
+
const templates = {
|
|
2412
|
+
"./templates/_editorconfig.ejs": "[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]\ncharset = utf-8\nindent_size = 2\nindent_style = space\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n<%_ if (styleGuide !== 'standard' || needsPrettier) { _%>\n<%#\n// standard doesn't have an opinion on line endings\n// https://github.com/standard/standard/issues/140\n// or maximum line length\n// https://github.com/standard/standard/issues/1559\n// Prettier enforces these things, though.\n%>\nend_of_line = lf\nmax_line_length = 100\n<%_ } _%>\n",
|
|
2413
|
+
"./templates/_gitattributes": "* text=auto eol=lf\n",
|
|
2414
|
+
"./templates/_prettierrc.json.ejs": "<%_ if (styleGuide === 'airbnb') { _%>\n{\n \"$schema\": \"https://json.schemastore.org/prettierrc\",\n \"printWidth\": 100,\n \"singleQuote\": true\n}\n<%_ } else if (styleGuide === 'standard') { _%>\n{\n \"$schema\": \"https://json.schemastore.org/prettierrc\",\n \"semi\": false,\n \"singleQuote\": true,\n \"jsxSingleQuote\": true,\n \"trailingComma\": \"none\"\n}\n<%_ } else { _%>\n<%#\n The default style follows the one used in the vuejs/create-vue repository\n <https://github.com/vuejs/create-vue/blob/main/.prettierrc>\n%>\n{\n \"$schema\": \"https://json.schemastore.org/prettierrc\",\n \"semi\": false,\n \"singleQuote\": true,\n \"printWidth\": 100\n}\n<%_ } _%>\n",
|
|
2415
|
+
"./templates/eslint.config.js.ejs": "<%_ for (const { importer } of configsBeforeVuePlugin) { _%>\n<%- importer %>\n<%_ } _%>\nimport { defineConfig, globalIgnores } from 'eslint/config'\nimport globals from 'globals'\nimport js from '@eslint/js'\nimport pluginVue from 'eslint-plugin-vue'\n<%_ for (const { importer } of configsAfterVuePlugin) { _%>\n<%- importer %>\n<%_ } _%>\n\nexport default defineConfig([\n {\n name: 'app/files-to-lint',\n files: ['**/*.{<%= fileExtensions.join(',') %>}'],\n },\n\n globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),\n\n {\n languageOptions: {\n globals: {\n ...globals.browser,\n },\n },\n },\n\n<%_ for (const { content } of configsBeforeVuePlugin) { _%>\n <%- content %><%# TODO: auto-indent if content's multi-line %>\n<%_ } _%>\n js.configs.recommended,\n ...pluginVue.configs['flat/essential'],\n<%_ for (const { content } of configsAfterVuePlugin) { _%>\n <%- content %><%# TODO: auto-indent if content's multi-line %>\n<%_ } _%>\n])\n",
|
|
2416
|
+
"./templates/eslint.config.ts.ejs": "<%_ for (const { importer } of configsBeforeVuePlugin) { _%>\n<%- importer %>\n<%_ } _%>\nimport { globalIgnores } from 'eslint/config'\nimport { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'\nimport pluginVue from 'eslint-plugin-vue'\n<%_ for (const { importer } of configsAfterVuePlugin) { _%>\n<%- importer %>\n<%_ } _%>\n\n// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:\n// import { configureVueProject } from '@vue/eslint-config-typescript'\n// configureVueProject({ scriptLangs: ['ts', 'tsx'] })\n// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup\n\nexport default defineConfigWithVueTs(\n {\n name: 'app/files-to-lint',\n files: ['**/*.{<%= fileExtensions.join(',') %>}'],\n },\n\n globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),\n\n<%_ for (const { content } of configsBeforeVuePlugin) { _%>\n <%- content %><%# TODO: auto-indent if content's multi-line %>\n<%_ } _%>\n pluginVue.configs['flat/essential'],\n vueTsConfigs.recommended,\n<%_ for (const { content } of configsAfterVuePlugin) { _%>\n <%- content %><%# TODO: auto-indent if content's multi-line %>\n<%_ } _%>\n)\n"
|
|
2417
|
+
};
|
|
2418
|
+
function renderEjsFile(filePath, data) {
|
|
2419
|
+
return import_ejs.render(templates[filePath], data, {});
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
//#endregion
|
|
2423
|
+
//#region node_modules/.pnpm/@vue+create-eslint-config@0.10.1/node_modules/@vue/create-eslint-config/package.json
|
|
2424
|
+
var name$1 = "@vue/create-eslint-config";
|
|
2425
|
+
var version$1 = "0.10.1";
|
|
2426
|
+
var description$1 = "Utility to setup ESLint in Vue.js projects.";
|
|
2427
|
+
var type$1 = "module";
|
|
2428
|
+
var main = "index.js";
|
|
2429
|
+
var bin$1 = { "create-eslint-config": "bin/create-eslint-config.js" };
|
|
2430
|
+
var engines$1 = { "node": "^16.14.0 || >= 18.0.0" };
|
|
2431
|
+
var scripts$1 = {
|
|
2432
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
2433
|
+
"lint": "eslint --fix ."
|
|
2434
|
+
};
|
|
2435
|
+
var repository$1 = {
|
|
2436
|
+
"type": "git",
|
|
2437
|
+
"url": "git+https://github.com/vuejs/create-eslint-config.git"
|
|
2438
|
+
};
|
|
2439
|
+
var keywords$1 = [
|
|
2440
|
+
"vue",
|
|
2441
|
+
"eslint",
|
|
2442
|
+
"config"
|
|
2443
|
+
];
|
|
2444
|
+
var author$1 = "Haoqun Jiang <haoqunjiang+npm@gmail.com>";
|
|
2445
|
+
var license$1 = "MIT";
|
|
2446
|
+
var bugs$1 = { "url": "https://github.com/vuejs/create-eslint-config/issues" };
|
|
2447
|
+
var homepage$1 = "https://github.com/vuejs/create-eslint-config#readme";
|
|
2448
|
+
var publishConfig$1 = {
|
|
2449
|
+
"access": "public",
|
|
2450
|
+
"provenance": true
|
|
2451
|
+
};
|
|
2452
|
+
var dependencies = {
|
|
2453
|
+
"ejs": "^3.1.10",
|
|
2454
|
+
"enquirer": "^2.4.1",
|
|
2455
|
+
"kolorist": "^1.8.0"
|
|
2456
|
+
};
|
|
2457
|
+
var devDependencies$2 = {
|
|
2458
|
+
"@eslint/js": "^9.22.0",
|
|
2459
|
+
"@types/node": "^22.13.10",
|
|
2460
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
2461
|
+
"@vue/eslint-config-typescript": "^14.5.0",
|
|
2462
|
+
"eslint": "^9.22.0",
|
|
2463
|
+
"eslint-plugin-oxlint": "^0.16.0",
|
|
2464
|
+
"eslint-plugin-vue": "~10.0.0",
|
|
2465
|
+
"globals": "^16.0.0",
|
|
2466
|
+
"jiti": "^2.4.2",
|
|
2467
|
+
"npm-run-all2": "^7.0.2",
|
|
2468
|
+
"oxlint": "^0.16.0",
|
|
2469
|
+
"prettier": "3.5.3",
|
|
2470
|
+
"typescript": "~5.8.2"
|
|
2471
|
+
};
|
|
2472
|
+
var package_default$2 = {
|
|
2473
|
+
name: name$1,
|
|
2474
|
+
version: version$1,
|
|
2475
|
+
description: description$1,
|
|
2476
|
+
type: type$1,
|
|
2477
|
+
main,
|
|
2478
|
+
bin: bin$1,
|
|
2479
|
+
engines: engines$1,
|
|
2480
|
+
scripts: scripts$1,
|
|
2481
|
+
repository: repository$1,
|
|
2482
|
+
keywords: keywords$1,
|
|
2483
|
+
author: author$1,
|
|
2484
|
+
license: license$1,
|
|
2485
|
+
bugs: bugs$1,
|
|
2486
|
+
homepage: homepage$1,
|
|
2487
|
+
publishConfig: publishConfig$1,
|
|
2488
|
+
dependencies,
|
|
2489
|
+
devDependencies: devDependencies$2
|
|
2490
|
+
};
|
|
2491
|
+
|
|
2492
|
+
//#endregion
|
|
2493
|
+
//#region node_modules/.pnpm/@vue+create-eslint-config@0.10.1/node_modules/@vue/create-eslint-config/index.js
|
|
2494
|
+
const versionMap = package_default$2.devDependencies;
|
|
2495
|
+
function createConfig({ styleGuide = "default", hasTypeScript = false, needsPrettier = false, needsOxlint = false, additionalConfigs = [] }) {
|
|
2496
|
+
const pickDependencies = (keys) => pickKeysFromObject(versionMap, keys);
|
|
2497
|
+
const pkg = {
|
|
2498
|
+
devDependencies: pickDependencies(["eslint", "eslint-plugin-vue"]),
|
|
2499
|
+
scripts: {}
|
|
2500
|
+
};
|
|
2501
|
+
const fileExtensions = ["vue"];
|
|
2502
|
+
if (hasTypeScript) {
|
|
2503
|
+
fileExtensions.unshift("ts", "mts", "tsx");
|
|
2504
|
+
additionalConfigs.unshift({ devDependencies: pickDependencies(["@vue/eslint-config-typescript", "jiti"]) });
|
|
2505
|
+
} else {
|
|
2506
|
+
fileExtensions.unshift("js", "mjs", "jsx");
|
|
2507
|
+
additionalConfigs.unshift({ devDependencies: pickDependencies(["@eslint/js", "globals"]) });
|
|
2508
|
+
}
|
|
2509
|
+
if (needsOxlint) {
|
|
2510
|
+
additionalConfigs.push({
|
|
2511
|
+
devDependencies: pickDependencies([
|
|
2512
|
+
"oxlint",
|
|
2513
|
+
"eslint-plugin-oxlint",
|
|
2514
|
+
"npm-run-all2"
|
|
2515
|
+
]),
|
|
2516
|
+
afterVuePlugin: [{
|
|
2517
|
+
importer: "import pluginOxlint from 'eslint-plugin-oxlint'",
|
|
2518
|
+
content: "...pluginOxlint.configs['flat/recommended'],"
|
|
2519
|
+
}]
|
|
2520
|
+
});
|
|
2521
|
+
pkg.scripts["lint:oxlint"] = "oxlint . --fix -D correctness --ignore-path .gitignore";
|
|
2522
|
+
pkg.scripts["lint:eslint"] = "eslint . --fix";
|
|
2523
|
+
pkg.scripts.lint = "run-s lint:*";
|
|
2524
|
+
} else pkg.scripts.lint = "eslint . --fix";
|
|
2525
|
+
if (needsPrettier) {
|
|
2526
|
+
additionalConfigs.push({
|
|
2527
|
+
devDependencies: pickDependencies(["prettier", "@vue/eslint-config-prettier"]),
|
|
2528
|
+
afterVuePlugin: [{
|
|
2529
|
+
importer: "import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'",
|
|
2530
|
+
content: "skipFormatting,"
|
|
2531
|
+
}]
|
|
2532
|
+
});
|
|
2533
|
+
pkg.scripts.format = "prettier --write src/";
|
|
2534
|
+
}
|
|
2535
|
+
const configsBeforeVuePlugin = [], configsAfterVuePlugin = [];
|
|
2536
|
+
for (const config of additionalConfigs) {
|
|
2537
|
+
deepMerge(pkg.devDependencies, config.devDependencies ?? {});
|
|
2538
|
+
configsBeforeVuePlugin.push(...config.beforeVuePlugin ?? []);
|
|
2539
|
+
configsAfterVuePlugin.push(...config.afterVuePlugin ?? []);
|
|
2540
|
+
}
|
|
2541
|
+
const templateData = {
|
|
2542
|
+
styleGuide,
|
|
2543
|
+
needsPrettier,
|
|
2544
|
+
fileExtensions,
|
|
2545
|
+
configsBeforeVuePlugin,
|
|
2546
|
+
configsAfterVuePlugin
|
|
2547
|
+
};
|
|
2548
|
+
const files$1 = { ".editorconfig": renderEjsFile("./templates/_editorconfig.ejs", templateData) };
|
|
2549
|
+
if (hasTypeScript) files$1["eslint.config.ts"] = renderEjsFile("./templates/eslint.config.ts.ejs", templateData);
|
|
2550
|
+
else files$1["eslint.config.js"] = renderEjsFile("./templates/eslint.config.js.ejs", templateData);
|
|
2551
|
+
if (needsPrettier) files$1[".prettierrc.json"] = renderEjsFile("./templates/_prettierrc.json.ejs", templateData);
|
|
2552
|
+
if (styleGuide !== "standard" || needsPrettier) files$1[".gitattributes"] = renderEjsFile("./templates/_gitattributes", {});
|
|
2553
|
+
return {
|
|
2554
|
+
pkg,
|
|
2555
|
+
files: files$1
|
|
2556
|
+
};
|
|
2557
|
+
}
|
|
2558
|
+
/**
|
|
2559
|
+
* Picks specified keys from an object.
|
|
2560
|
+
*
|
|
2561
|
+
* @param {Object} obj - The source object.
|
|
2562
|
+
* @param {string[]} keys - The keys to pick from the object.
|
|
2563
|
+
* @returns {Object} - A new object with the picked keys.
|
|
2564
|
+
*/
|
|
2565
|
+
function pickKeysFromObject(obj, keys) {
|
|
2566
|
+
return keys.reduce((acc, key) => {
|
|
2567
|
+
if (key in obj) acc[key] = obj[key];
|
|
2568
|
+
return acc;
|
|
2569
|
+
}, {});
|
|
2570
|
+
}
|
|
2571
|
+
const isObject = (val) => val && typeof val === "object";
|
|
2572
|
+
const mergeArrayWithDedupe = (a, b$1) => Array.from(new Set([...a, ...b$1]));
|
|
2573
|
+
function deepMerge(target, obj) {
|
|
2574
|
+
for (const key of Object.keys(obj)) {
|
|
2575
|
+
const oldVal = target[key];
|
|
2576
|
+
const newVal = obj[key];
|
|
2577
|
+
if (Array.isArray(oldVal) && Array.isArray(newVal)) target[key] = mergeArrayWithDedupe(oldVal, newVal);
|
|
2578
|
+
else if (isObject(oldVal) && isObject(newVal)) target[key] = deepMerge(oldVal, newVal);
|
|
2579
|
+
else target[key] = newVal;
|
|
2580
|
+
}
|
|
2581
|
+
return target;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
//#endregion
|
|
2585
|
+
//#region template/eslint/package.json
|
|
2586
|
+
var devDependencies$1 = {
|
|
2587
|
+
"@vitest/eslint-plugin": "^1.1.38",
|
|
2588
|
+
"eslint-plugin-cypress": "^4.2.0",
|
|
2589
|
+
"eslint-plugin-playwright": "^2.2.0"
|
|
2590
|
+
};
|
|
2591
|
+
var package_default$1 = { devDependencies: devDependencies$1 };
|
|
2592
|
+
|
|
2593
|
+
//#endregion
|
|
2594
|
+
//#region utils/renderEslint.ts
|
|
2595
|
+
const eslintDeps = package_default$1.devDependencies;
|
|
2596
|
+
function renderEslint(rootDir, { needsTypeScript, needsVitest, needsCypress, needsCypressCT, needsOxlint, needsPrettier, needsPlaywright }) {
|
|
2597
|
+
const additionalConfigs = getAdditionalConfigs({
|
|
2598
|
+
needsTypeScript,
|
|
2599
|
+
needsVitest,
|
|
2600
|
+
needsCypress,
|
|
2601
|
+
needsCypressCT,
|
|
2602
|
+
needsPlaywright
|
|
2603
|
+
});
|
|
2604
|
+
const { pkg, files: files$1 } = createConfig({
|
|
2605
|
+
styleGuide: "default",
|
|
2606
|
+
hasTypeScript: needsTypeScript,
|
|
2607
|
+
needsOxlint,
|
|
2608
|
+
needsPrettier,
|
|
2609
|
+
additionalConfigs
|
|
2610
|
+
});
|
|
2611
|
+
const packageJsonPath = path$2.resolve(rootDir, "package.json");
|
|
2612
|
+
const existingPkg = JSON.parse(fs$2.readFileSync(packageJsonPath, "utf8"));
|
|
2613
|
+
const updatedPkg = sortDependencies(deepMerge_default(existingPkg, pkg));
|
|
2614
|
+
fs$2.writeFileSync(packageJsonPath, JSON.stringify(updatedPkg, null, 2) + "\n", "utf8");
|
|
2615
|
+
for (const [fileName, content] of Object.entries(files$1)) {
|
|
2616
|
+
const fullPath = path$2.resolve(rootDir, fileName);
|
|
2617
|
+
fs$2.writeFileSync(fullPath, content, "utf8");
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
function getAdditionalConfigs({ needsTypeScript, needsVitest, needsCypress, needsCypressCT, needsPlaywright }) {
|
|
2621
|
+
const additionalConfigs = [];
|
|
2622
|
+
if (needsVitest) additionalConfigs.push({
|
|
2623
|
+
devDependencies: { "@vitest/eslint-plugin": eslintDeps["@vitest/eslint-plugin"] },
|
|
2624
|
+
afterVuePlugin: [{
|
|
2625
|
+
importer: `import pluginVitest from '@vitest/eslint-plugin'`,
|
|
2626
|
+
content: `
|
|
2627
|
+
{
|
|
2628
|
+
...pluginVitest.configs.recommended,
|
|
2629
|
+
files: ['src/**/__tests__/*'],
|
|
2630
|
+
},`
|
|
2631
|
+
}]
|
|
2632
|
+
});
|
|
2633
|
+
if (needsCypress) additionalConfigs.push({
|
|
2634
|
+
devDependencies: { "eslint-plugin-cypress": eslintDeps["eslint-plugin-cypress"] },
|
|
2635
|
+
afterVuePlugin: [{
|
|
2636
|
+
importer: (needsTypeScript ? "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n" : "") + "import pluginCypress from 'eslint-plugin-cypress/flat'",
|
|
2637
|
+
content: `
|
|
2638
|
+
{
|
|
2639
|
+
...pluginCypress.configs.recommended,
|
|
2640
|
+
files: [
|
|
2641
|
+
${[
|
|
2642
|
+
...needsCypressCT ? ["**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}"] : [],
|
|
2643
|
+
"cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}",
|
|
2644
|
+
"cypress/support/**/*.{js,ts,jsx,tsx}"
|
|
2645
|
+
].map(JSON.stringify.bind(JSON)).join(",\n ").replace(
|
|
2646
|
+
/"/g,
|
|
2647
|
+
"'"
|
|
2648
|
+
/* use single quotes as in the other configs */
|
|
2649
|
+
)}
|
|
2650
|
+
],
|
|
2651
|
+
},`
|
|
2652
|
+
}]
|
|
2653
|
+
});
|
|
2654
|
+
if (needsPlaywright) additionalConfigs.push({
|
|
2655
|
+
devDependencies: { "eslint-plugin-playwright": eslintDeps["eslint-plugin-playwright"] },
|
|
2656
|
+
afterVuePlugin: [{
|
|
2657
|
+
importer: "import pluginPlaywright from 'eslint-plugin-playwright'",
|
|
2658
|
+
content: `
|
|
2659
|
+
{
|
|
2660
|
+
...pluginPlaywright.configs['flat/recommended'],
|
|
2661
|
+
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
|
|
2662
|
+
},`
|
|
2663
|
+
}]
|
|
2664
|
+
});
|
|
2665
|
+
return additionalConfigs;
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
//#endregion
|
|
2669
|
+
//#region utils/trimBoilerplate.ts
|
|
2670
|
+
function replaceContent(filepath, replacer) {
|
|
2671
|
+
const content = fs$1.readFileSync(filepath, "utf8");
|
|
2672
|
+
fs$1.writeFileSync(filepath, replacer(content));
|
|
2673
|
+
}
|
|
2674
|
+
function trimBoilerplate(rootDir) {
|
|
2675
|
+
const srcDir = path$1.resolve(rootDir, "src");
|
|
2676
|
+
for (const filename of fs$1.readdirSync(srcDir)) {
|
|
2677
|
+
if ([
|
|
2678
|
+
"main.js",
|
|
2679
|
+
"main.ts",
|
|
2680
|
+
"router",
|
|
2681
|
+
"stores"
|
|
2682
|
+
].includes(filename)) continue;
|
|
2683
|
+
const fullpath = path$1.resolve(srcDir, filename);
|
|
2684
|
+
fs$1.rmSync(fullpath, { recursive: true });
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
function removeCSSImport(rootDir, needsTypeScript, needsCypressCT) {
|
|
2688
|
+
const entryPath = path$1.resolve(rootDir, needsTypeScript ? "src/main.ts" : "src/main.js");
|
|
2689
|
+
replaceContent(entryPath, (content) => content.replace("import './assets/main.css'\n\n", ""));
|
|
2690
|
+
if (needsCypressCT) {
|
|
2691
|
+
const ctSetupPath = path$1.resolve(rootDir, needsTypeScript ? "cypress/support/component.ts" : "cypress/support/component.js");
|
|
2692
|
+
replaceContent(ctSetupPath, (content) => content.replace("import '@/assets/main.css'", "// import '@/assets/main.css'"));
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
function emptyRouterConfig(rootDir, needsTypeScript) {
|
|
2696
|
+
const srcDir = path$1.resolve(rootDir, "src");
|
|
2697
|
+
const routerEntry = path$1.resolve(srcDir, needsTypeScript ? "router/index.ts" : "router/index.js");
|
|
2698
|
+
replaceContent(routerEntry, (content) => content.replace(`import HomeView from '../views/HomeView.vue'\n`, "").replace(/routes:\s*\[[\s\S]*?\],/, "routes: [],"));
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
//#endregion
|
|
2702
|
+
//#region package.json
|
|
2703
|
+
var name = "create-vue";
|
|
2704
|
+
var version = "3.16.0";
|
|
2705
|
+
var description = "🛠️ The recommended way to start a Vite-powered Vue project";
|
|
2706
|
+
var type = "module";
|
|
2707
|
+
var packageManager = "pnpm@10.7.0";
|
|
2708
|
+
var bin = { "create-vue": "bundle.js" };
|
|
2709
|
+
var files = [
|
|
2710
|
+
"locales",
|
|
2711
|
+
"bundle.js",
|
|
2712
|
+
"template",
|
|
2713
|
+
"!template/**/node_modules/.bin/*"
|
|
2714
|
+
];
|
|
2715
|
+
var engines = { "node": ">=v18.3.0" };
|
|
2716
|
+
var scripts = {
|
|
2717
|
+
"prepare": "husky",
|
|
2718
|
+
"format": "prettier --write .",
|
|
2719
|
+
"build": "rolldown -c rolldown.config.ts",
|
|
2720
|
+
"snapshot": "zx ./scripts/snapshot.mjs",
|
|
2721
|
+
"pretest": "pnpm run build && pnpm run snapshot",
|
|
2722
|
+
"test": "zx ./scripts/test.mjs",
|
|
2723
|
+
"test:unit": "vitest",
|
|
2724
|
+
"postversion": "zx ./scripts/postversion.mjs",
|
|
2725
|
+
"prepublishOnly": "pnpm run build"
|
|
2726
|
+
};
|
|
2727
|
+
var repository = {
|
|
2728
|
+
"type": "git",
|
|
2729
|
+
"url": "git+https://github.com/vuejs/create-vue.git"
|
|
2730
|
+
};
|
|
2731
|
+
var keywords = [];
|
|
2732
|
+
var author = "Haoqun Jiang <npm@haoqun.me>";
|
|
2733
|
+
var license = "MIT";
|
|
2734
|
+
var bugs = { "url": "https://github.com/vuejs/create-vue/issues" };
|
|
2735
|
+
var homepage = "https://github.com/vuejs/create-vue#readme";
|
|
2736
|
+
var devDependencies = {
|
|
2737
|
+
"@clack/prompts": "^0.10.0",
|
|
2738
|
+
"@tsconfig/node22": "^22.0.1",
|
|
2739
|
+
"@types/eslint": "^9.6.1",
|
|
2740
|
+
"@types/node": "^22.13.14",
|
|
2741
|
+
"@types/prompts": "^2.4.9",
|
|
2742
|
+
"@vue/create-eslint-config": "^0.10.1",
|
|
2743
|
+
"@vue/tsconfig": "^0.7.0",
|
|
2744
|
+
"ejs": "^3.1.10",
|
|
2745
|
+
"husky": "^9.1.7",
|
|
2746
|
+
"lint-staged": "^15.5.0",
|
|
2747
|
+
"picocolors": "^1.1.1",
|
|
2748
|
+
"prettier": "3.5.3",
|
|
2749
|
+
"rolldown": "1.0.0-beta.7",
|
|
2750
|
+
"rollup-plugin-license": "^3.6.0",
|
|
2751
|
+
"vitest": "^3.1.1",
|
|
2752
|
+
"zx": "^8.4.1"
|
|
2753
|
+
};
|
|
2754
|
+
var lint_staged = { "*.{js,ts,vue,json}": ["prettier --write"] };
|
|
2755
|
+
var publishConfig = {
|
|
2756
|
+
"access": "public",
|
|
2757
|
+
"provenance": true
|
|
2758
|
+
};
|
|
2759
|
+
var package_default = {
|
|
2760
|
+
name,
|
|
2761
|
+
version,
|
|
2762
|
+
description,
|
|
2763
|
+
type,
|
|
2764
|
+
packageManager,
|
|
2765
|
+
bin,
|
|
2766
|
+
files,
|
|
2767
|
+
engines,
|
|
2768
|
+
scripts,
|
|
2769
|
+
repository,
|
|
2770
|
+
keywords,
|
|
2771
|
+
author,
|
|
2772
|
+
license,
|
|
2773
|
+
bugs,
|
|
2774
|
+
homepage,
|
|
2775
|
+
devDependencies,
|
|
2776
|
+
"lint-staged": lint_staged,
|
|
2777
|
+
publishConfig
|
|
2778
|
+
};
|
|
2779
|
+
|
|
2780
|
+
//#endregion
|
|
2781
|
+
//#region index.ts
|
|
2782
|
+
const language = await getLanguage(path.resolve(import.meta.dirname, "locales"));
|
|
2783
|
+
const FEATURE_FLAGS = [
|
|
2784
|
+
"default",
|
|
2785
|
+
"ts",
|
|
2786
|
+
"typescript",
|
|
2787
|
+
"jsx",
|
|
2788
|
+
"router",
|
|
2789
|
+
"vue-router",
|
|
2790
|
+
"pinia",
|
|
2791
|
+
"tests",
|
|
2792
|
+
"with-tests",
|
|
2793
|
+
"vitest",
|
|
2794
|
+
"cypress",
|
|
2795
|
+
"nightwatch",
|
|
2796
|
+
"playwright",
|
|
2797
|
+
"eslint",
|
|
2798
|
+
"prettier",
|
|
2799
|
+
"eslint-with-oxlint",
|
|
2800
|
+
"eslint-with-prettier"
|
|
2801
|
+
];
|
|
2802
|
+
const FEATURE_OPTIONS = [
|
|
2803
|
+
{
|
|
2804
|
+
value: "typescript",
|
|
2805
|
+
label: language.needsTypeScript.message
|
|
2806
|
+
},
|
|
2807
|
+
{
|
|
2808
|
+
value: "jsx",
|
|
2809
|
+
label: language.needsJsx.message
|
|
2810
|
+
},
|
|
2811
|
+
{
|
|
2812
|
+
value: "router",
|
|
2813
|
+
label: language.needsRouter.message
|
|
2814
|
+
},
|
|
2815
|
+
{
|
|
2816
|
+
value: "pinia",
|
|
2817
|
+
label: language.needsPinia.message
|
|
2818
|
+
},
|
|
2819
|
+
{
|
|
2820
|
+
value: "vitest",
|
|
2821
|
+
label: language.needsVitest.message
|
|
2822
|
+
},
|
|
2823
|
+
{
|
|
2824
|
+
value: "e2e",
|
|
2825
|
+
label: language.needsE2eTesting.message
|
|
2826
|
+
},
|
|
2827
|
+
{
|
|
2828
|
+
value: "eslint",
|
|
2829
|
+
label: language.needsEslint.message
|
|
2830
|
+
},
|
|
2831
|
+
{
|
|
2832
|
+
value: "prettier",
|
|
2833
|
+
label: language.needsPrettier.message
|
|
2834
|
+
}
|
|
2835
|
+
];
|
|
2836
|
+
function isValidPackageName(projectName) {
|
|
2837
|
+
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
|
|
2838
|
+
}
|
|
2839
|
+
function toValidPackageName(projectName) {
|
|
2840
|
+
return projectName.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
|
|
2841
|
+
}
|
|
2842
|
+
function canSkipEmptying(dir) {
|
|
2843
|
+
if (!fs.existsSync(dir)) return true;
|
|
2844
|
+
const files$1 = fs.readdirSync(dir);
|
|
2845
|
+
if (files$1.length === 0) return true;
|
|
2846
|
+
if (files$1.length === 1 && files$1[0] === ".git") return true;
|
|
2847
|
+
return false;
|
|
2848
|
+
}
|
|
2849
|
+
function emptyDir(dir) {
|
|
2850
|
+
if (!fs.existsSync(dir)) return;
|
|
2851
|
+
postOrderDirectoryTraverse(dir, (dir$1) => fs.rmdirSync(dir$1), (file) => fs.unlinkSync(file));
|
|
2852
|
+
}
|
|
2853
|
+
async function unwrapPrompt(maybeCancelPromise) {
|
|
2854
|
+
const result = await maybeCancelPromise;
|
|
2855
|
+
if (BD(result)) {
|
|
2856
|
+
xe((0, import_picocolors.red)("✖") + ` ${language.errors.operationCancelled}`);
|
|
2857
|
+
process.exit(0);
|
|
2858
|
+
}
|
|
2859
|
+
return result;
|
|
2860
|
+
}
|
|
2861
|
+
const helpMessage = `\
|
|
2862
|
+
Usage: create-vue [FEATURE_FLAGS...] [OPTIONS...] [DIRECTORY]
|
|
2863
|
+
|
|
2864
|
+
Create a new Vue.js project.
|
|
2865
|
+
Start the CLI in interactive mode when no FEATURE_FLAGS is provided, or if the DIRECTORY argument is not a valid package name.
|
|
2866
|
+
|
|
2867
|
+
Options:
|
|
2868
|
+
--force
|
|
2869
|
+
Create the project even if the directory is not empty.
|
|
2870
|
+
--bare
|
|
2871
|
+
Create a barebone project without example code.
|
|
2872
|
+
--help
|
|
2873
|
+
Display this help message.
|
|
2874
|
+
--version
|
|
2875
|
+
Display the version number of this CLI.
|
|
2876
|
+
|
|
2877
|
+
Available feature flags:
|
|
2878
|
+
--default
|
|
2879
|
+
Create a project with the default configuration without any additional features.
|
|
2880
|
+
--ts, --typescript
|
|
2881
|
+
Add TypeScript support.
|
|
2882
|
+
--jsx
|
|
2883
|
+
Add JSX support.
|
|
2884
|
+
--router, --vue-router
|
|
2885
|
+
Add Vue Router for SPA development.
|
|
2886
|
+
--pinia
|
|
2887
|
+
Add Pinia for state management.
|
|
2888
|
+
--vitest
|
|
2889
|
+
Add Vitest for unit testing.
|
|
2890
|
+
--cypress
|
|
2891
|
+
Add Cypress for end-to-end testing.
|
|
2892
|
+
If used without ${(0, import_picocolors.cyan)("--vitest")}, it will also add Cypress Component Testing.
|
|
2893
|
+
--playwright
|
|
2894
|
+
Add Playwright for end-to-end testing.
|
|
2895
|
+
--nightwatch
|
|
2896
|
+
Add Nightwatch for end-to-end testing.
|
|
2897
|
+
If used without ${(0, import_picocolors.cyan)("--vitest")}, it will also add Nightwatch Component Testing.
|
|
2898
|
+
--eslint
|
|
2899
|
+
Add ESLint for code quality.
|
|
2900
|
+
--eslint-with-oxlint
|
|
2901
|
+
Add ESLint for code quality, and use Oxlint to speed up the linting process.
|
|
2902
|
+
--eslint-with-prettier (Deprecated in favor of ${(0, import_picocolors.cyan)("--eslint --prettier")})
|
|
2903
|
+
Add Prettier for code formatting in addition to ESLint.
|
|
2904
|
+
--prettier
|
|
2905
|
+
Add Prettier for code formatting.
|
|
2906
|
+
|
|
2907
|
+
Unstable feature flags:
|
|
2908
|
+
--tests, --with-tests
|
|
2909
|
+
Add both unit testing and end-to-end testing support.
|
|
2910
|
+
Currently equivalent to ${(0, import_picocolors.cyan)("--vitest --cypress")}, but may change in the future.
|
|
2911
|
+
`;
|
|
2912
|
+
async function init() {
|
|
2913
|
+
const cwd = process.cwd();
|
|
2914
|
+
const args = process.argv.slice(2);
|
|
2915
|
+
const flags = [
|
|
2916
|
+
...FEATURE_FLAGS,
|
|
2917
|
+
"force",
|
|
2918
|
+
"bare",
|
|
2919
|
+
"help",
|
|
2920
|
+
"version"
|
|
2921
|
+
];
|
|
2922
|
+
const options = Object.fromEntries(flags.map((key) => [key, { type: "boolean" }]));
|
|
2923
|
+
const { values: argv$1, positionals } = parseArgs({
|
|
2924
|
+
args,
|
|
2925
|
+
options,
|
|
2926
|
+
strict: true,
|
|
2927
|
+
allowPositionals: true
|
|
2928
|
+
});
|
|
2929
|
+
if (argv$1.help) {
|
|
2930
|
+
console.log(helpMessage);
|
|
2931
|
+
process.exit(0);
|
|
2932
|
+
}
|
|
2933
|
+
if (argv$1.version) {
|
|
2934
|
+
console.log(`${package_default.name} v${package_default.version}`);
|
|
2935
|
+
process.exit(0);
|
|
2936
|
+
}
|
|
2937
|
+
const isFeatureFlagsUsed = FEATURE_FLAGS.some((flag) => typeof argv$1[flag] === "boolean");
|
|
2938
|
+
let targetDir = positionals[0];
|
|
2939
|
+
const defaultProjectName = targetDir || "vue-project";
|
|
2940
|
+
const forceOverwrite = argv$1.force;
|
|
2941
|
+
const result = {
|
|
2942
|
+
projectName: defaultProjectName,
|
|
2943
|
+
shouldOverwrite: forceOverwrite,
|
|
2944
|
+
packageName: defaultProjectName,
|
|
2945
|
+
features: [],
|
|
2946
|
+
e2eFramework: void 0,
|
|
2947
|
+
experimentOxlint: false
|
|
2948
|
+
};
|
|
2949
|
+
Ie(process.stdout.isTTY && process.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner);
|
|
2950
|
+
if (!targetDir) {
|
|
2951
|
+
const _result = await unwrapPrompt(he({
|
|
2952
|
+
message: language.projectName.message,
|
|
2953
|
+
placeholder: defaultProjectName,
|
|
2954
|
+
validate: (value) => value.trim().length > 0 ? void 0 : language.projectName.invalidMessage
|
|
2955
|
+
}));
|
|
2956
|
+
targetDir = result.projectName = result.packageName = _result.trim();
|
|
2957
|
+
}
|
|
2958
|
+
if (!canSkipEmptying(targetDir) && !forceOverwrite) {
|
|
2959
|
+
result.shouldOverwrite = await unwrapPrompt(ye({
|
|
2960
|
+
message: `${targetDir === "." ? language.shouldOverwrite.dirForPrompts.current : `${language.shouldOverwrite.dirForPrompts.target} "${targetDir}"`} ${language.shouldOverwrite.message}`,
|
|
2961
|
+
initialValue: false
|
|
2962
|
+
}));
|
|
2963
|
+
if (!result.shouldOverwrite) {
|
|
2964
|
+
xe((0, import_picocolors.red)("✖") + ` ${language.errors.operationCancelled}`);
|
|
2965
|
+
process.exit(0);
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
if (!isValidPackageName(targetDir)) result.packageName = await unwrapPrompt(he({
|
|
2969
|
+
message: language.packageName.message,
|
|
2970
|
+
initialValue: toValidPackageName(targetDir),
|
|
2971
|
+
validate: (value) => isValidPackageName(value) ? void 0 : language.packageName.invalidMessage
|
|
2972
|
+
}));
|
|
2973
|
+
if (!isFeatureFlagsUsed) {
|
|
2974
|
+
result.features = await unwrapPrompt(fe({
|
|
2975
|
+
message: `${language.featureSelection.message} ${(0, import_picocolors.dim)(language.featureSelection.hint)}`,
|
|
2976
|
+
options: FEATURE_OPTIONS,
|
|
2977
|
+
required: false
|
|
2978
|
+
}));
|
|
2979
|
+
if (result.features.includes("e2e")) {
|
|
2980
|
+
const hasVitest = result.features.includes("vitest");
|
|
2981
|
+
result.e2eFramework = await unwrapPrompt(ve({
|
|
2982
|
+
message: `${language.e2eSelection.message} ${(0, import_picocolors.dim)(language.e2eSelection.hint)}`,
|
|
2983
|
+
options: [
|
|
2984
|
+
{
|
|
2985
|
+
value: "playwright",
|
|
2986
|
+
label: language.e2eSelection.selectOptions.playwright.title,
|
|
2987
|
+
hint: language.e2eSelection.selectOptions.playwright.desc
|
|
2988
|
+
},
|
|
2989
|
+
{
|
|
2990
|
+
value: "cypress",
|
|
2991
|
+
label: language.e2eSelection.selectOptions.cypress.title,
|
|
2992
|
+
hint: hasVitest ? language.e2eSelection.selectOptions.cypress.desc : language.e2eSelection.selectOptions.cypress.hintOnComponentTesting
|
|
2993
|
+
},
|
|
2994
|
+
{
|
|
2995
|
+
value: "nightwatch",
|
|
2996
|
+
label: language.e2eSelection.selectOptions.nightwatch.title,
|
|
2997
|
+
hint: hasVitest ? language.e2eSelection.selectOptions.nightwatch.desc : language.e2eSelection.selectOptions.nightwatch.hintOnComponentTesting
|
|
2998
|
+
}
|
|
2999
|
+
]
|
|
3000
|
+
}));
|
|
3001
|
+
}
|
|
3002
|
+
if (result.features.includes("eslint")) result.experimentOxlint = await unwrapPrompt(ye({
|
|
3003
|
+
message: language.needsOxlint.message,
|
|
3004
|
+
initialValue: false
|
|
3005
|
+
}));
|
|
3006
|
+
}
|
|
3007
|
+
const { features } = result;
|
|
3008
|
+
const needsTypeScript = argv$1.ts || argv$1.typescript || features.includes("typescript");
|
|
3009
|
+
const needsJsx = argv$1.jsx || features.includes("jsx");
|
|
3010
|
+
const needsRouter = argv$1.router || argv$1["vue-router"] || features.includes("router");
|
|
3011
|
+
const needsPinia = argv$1.pinia || features.includes("pinia");
|
|
3012
|
+
const needsVitest = argv$1.vitest || argv$1.tests || features.includes("vitest");
|
|
3013
|
+
const needsEslint = argv$1.eslint || argv$1["eslint-with-oxlint"] || argv$1["eslint-with-prettier"] || features.includes("eslint");
|
|
3014
|
+
const needsPrettier = argv$1.prettier || argv$1["eslint-with-prettier"] || features.includes("prettier");
|
|
3015
|
+
const needsOxlint = argv$1["eslint-with-oxlint"] || result.experimentOxlint;
|
|
3016
|
+
const { e2eFramework } = result;
|
|
3017
|
+
const needsCypress = argv$1.cypress || argv$1.tests || e2eFramework === "cypress";
|
|
3018
|
+
const needsCypressCT = needsCypress && !needsVitest;
|
|
3019
|
+
const needsNightwatch = argv$1.nightwatch || e2eFramework === "nightwatch";
|
|
3020
|
+
const needsNightwatchCT = needsNightwatch && !needsVitest;
|
|
3021
|
+
const needsPlaywright = argv$1.playwright || e2eFramework === "playwright";
|
|
3022
|
+
const root = path.join(cwd, targetDir);
|
|
3023
|
+
if (fs.existsSync(root) && result.shouldOverwrite) emptyDir(root);
|
|
3024
|
+
else if (!fs.existsSync(root)) fs.mkdirSync(root);
|
|
3025
|
+
console.log(`\n${language.infos.scaffolding} ${root}...`);
|
|
3026
|
+
const pkg = {
|
|
3027
|
+
name: result.packageName,
|
|
3028
|
+
version: "0.0.0"
|
|
3029
|
+
};
|
|
3030
|
+
fs.writeFileSync(path.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
|
|
3031
|
+
const templateRoot = new URL("./template", import.meta.url).pathname;
|
|
3032
|
+
const callbacks = [];
|
|
3033
|
+
const render = function render$1(templateName) {
|
|
3034
|
+
const templateDir = path.resolve(templateRoot, templateName);
|
|
3035
|
+
renderTemplate_default(templateDir, root, callbacks);
|
|
3036
|
+
};
|
|
3037
|
+
render("base");
|
|
3038
|
+
if (needsJsx) render("config/jsx");
|
|
3039
|
+
if (needsRouter) render("config/router");
|
|
3040
|
+
if (needsPinia) render("config/pinia");
|
|
3041
|
+
if (needsVitest) render("config/vitest");
|
|
3042
|
+
if (needsCypress) render("config/cypress");
|
|
3043
|
+
if (needsCypressCT) render("config/cypress-ct");
|
|
3044
|
+
if (needsNightwatch) render("config/nightwatch");
|
|
3045
|
+
if (needsNightwatchCT) render("config/nightwatch-ct");
|
|
3046
|
+
if (needsPlaywright) render("config/playwright");
|
|
3047
|
+
if (needsTypeScript) {
|
|
3048
|
+
render("config/typescript");
|
|
3049
|
+
render("tsconfig/base");
|
|
3050
|
+
const rootTsConfig = {
|
|
3051
|
+
files: [],
|
|
3052
|
+
references: [{ path: "./tsconfig.node.json" }, { path: "./tsconfig.app.json" }]
|
|
3053
|
+
};
|
|
3054
|
+
if (needsCypress) {
|
|
3055
|
+
render("tsconfig/cypress");
|
|
3056
|
+
rootTsConfig.compilerOptions = { module: "NodeNext" };
|
|
3057
|
+
}
|
|
3058
|
+
if (needsCypressCT) {
|
|
3059
|
+
render("tsconfig/cypress-ct");
|
|
3060
|
+
rootTsConfig.references.push({ path: "./tsconfig.cypress-ct.json" });
|
|
3061
|
+
}
|
|
3062
|
+
if (needsPlaywright) render("tsconfig/playwright");
|
|
3063
|
+
if (needsVitest) {
|
|
3064
|
+
render("tsconfig/vitest");
|
|
3065
|
+
rootTsConfig.references.push({ path: "./tsconfig.vitest.json" });
|
|
3066
|
+
}
|
|
3067
|
+
if (needsNightwatch) {
|
|
3068
|
+
render("tsconfig/nightwatch");
|
|
3069
|
+
rootTsConfig.references.push({ path: "./nightwatch/tsconfig.json" });
|
|
3070
|
+
}
|
|
3071
|
+
if (needsNightwatchCT) render("tsconfig/nightwatch-ct");
|
|
3072
|
+
fs.writeFileSync(path.resolve(root, "tsconfig.json"), JSON.stringify(rootTsConfig, null, 2) + "\n", "utf-8");
|
|
3073
|
+
}
|
|
3074
|
+
if (needsEslint) {
|
|
3075
|
+
renderEslint(root, {
|
|
3076
|
+
needsTypeScript,
|
|
3077
|
+
needsOxlint,
|
|
3078
|
+
needsVitest,
|
|
3079
|
+
needsCypress,
|
|
3080
|
+
needsCypressCT,
|
|
3081
|
+
needsPrettier,
|
|
3082
|
+
needsPlaywright
|
|
3083
|
+
});
|
|
3084
|
+
render("config/eslint");
|
|
3085
|
+
}
|
|
3086
|
+
if (needsOxlint) render("config/oxlint");
|
|
3087
|
+
if (needsPrettier) render("config/prettier");
|
|
3088
|
+
const codeTemplate = (needsTypeScript ? "typescript-" : "") + (needsRouter ? "router" : "default");
|
|
3089
|
+
render(`code/${codeTemplate}`);
|
|
3090
|
+
if (needsPinia && needsRouter) render("entry/router-and-pinia");
|
|
3091
|
+
else if (needsPinia) render("entry/pinia");
|
|
3092
|
+
else if (needsRouter) render("entry/router");
|
|
3093
|
+
else render("entry/default");
|
|
3094
|
+
const dataStore = {};
|
|
3095
|
+
for (const cb of callbacks) await cb(dataStore);
|
|
3096
|
+
preOrderDirectoryTraverse(root, () => {}, (filepath) => {
|
|
3097
|
+
if (filepath.endsWith(".ejs")) {
|
|
3098
|
+
const template = fs.readFileSync(filepath, "utf-8");
|
|
3099
|
+
const dest = filepath.replace(/\.ejs$/, "");
|
|
3100
|
+
const content = import_ejs.render(template, dataStore[dest]);
|
|
3101
|
+
fs.writeFileSync(dest, content);
|
|
3102
|
+
fs.unlinkSync(filepath);
|
|
3103
|
+
}
|
|
3104
|
+
});
|
|
3105
|
+
if (argv$1.bare) {
|
|
3106
|
+
trimBoilerplate(root);
|
|
3107
|
+
render("bare/base");
|
|
3108
|
+
if (needsTypeScript) render("bare/typescript");
|
|
3109
|
+
if (needsVitest) render("bare/vitest");
|
|
3110
|
+
if (needsCypressCT) render("bare/cypress-ct");
|
|
3111
|
+
if (needsNightwatchCT) render("bare/nightwatch-ct");
|
|
3112
|
+
}
|
|
3113
|
+
if (needsTypeScript) {
|
|
3114
|
+
preOrderDirectoryTraverse(root, () => {}, (filepath) => {
|
|
3115
|
+
if (filepath.endsWith(".js") && !filepath.endsWith("eslint.config.js")) {
|
|
3116
|
+
const tsFilePath = filepath.replace(/\.js$/, ".ts");
|
|
3117
|
+
if (fs.existsSync(tsFilePath)) fs.unlinkSync(filepath);
|
|
3118
|
+
else fs.renameSync(filepath, tsFilePath);
|
|
3119
|
+
} else if (path.basename(filepath) === "jsconfig.json") fs.unlinkSync(filepath);
|
|
3120
|
+
});
|
|
3121
|
+
const indexHtmlPath = path.resolve(root, "index.html");
|
|
3122
|
+
const indexHtmlContent = fs.readFileSync(indexHtmlPath, "utf8");
|
|
3123
|
+
fs.writeFileSync(indexHtmlPath, indexHtmlContent.replace("src/main.js", "src/main.ts"));
|
|
3124
|
+
} else preOrderDirectoryTraverse(root, () => {}, (filepath) => {
|
|
3125
|
+
if (filepath.endsWith(".ts")) fs.unlinkSync(filepath);
|
|
3126
|
+
});
|
|
3127
|
+
if (argv$1.bare) {
|
|
3128
|
+
removeCSSImport(root, needsTypeScript, needsCypressCT);
|
|
3129
|
+
if (needsRouter) emptyRouterConfig(root, needsTypeScript);
|
|
3130
|
+
}
|
|
3131
|
+
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
3132
|
+
const packageManager$1 = /pnpm/.test(userAgent) ? "pnpm" : /yarn/.test(userAgent) ? "yarn" : /bun/.test(userAgent) ? "bun" : "npm";
|
|
3133
|
+
fs.writeFileSync(path.resolve(root, "README.md"), generateReadme({
|
|
3134
|
+
projectName: result.projectName ?? result.packageName ?? defaultProjectName,
|
|
3135
|
+
packageManager: packageManager$1,
|
|
3136
|
+
needsTypeScript,
|
|
3137
|
+
needsVitest,
|
|
3138
|
+
needsCypress,
|
|
3139
|
+
needsNightwatch,
|
|
3140
|
+
needsPlaywright,
|
|
3141
|
+
needsNightwatchCT,
|
|
3142
|
+
needsCypressCT,
|
|
3143
|
+
needsEslint
|
|
3144
|
+
}));
|
|
3145
|
+
let outroMessage = `${language.infos.done}\n\n`;
|
|
3146
|
+
if (root !== cwd) {
|
|
3147
|
+
const cdProjectName = path.relative(cwd, root);
|
|
3148
|
+
outroMessage += ` ${(0, import_picocolors.bold)((0, import_picocolors.green)(`cd ${cdProjectName.includes(" ") ? `"${cdProjectName}"` : cdProjectName}`))}\n`;
|
|
3149
|
+
}
|
|
3150
|
+
outroMessage += ` ${(0, import_picocolors.bold)((0, import_picocolors.green)(getCommand(packageManager$1, "install")))}\n`;
|
|
3151
|
+
if (needsPrettier) outroMessage += ` ${(0, import_picocolors.bold)((0, import_picocolors.green)(getCommand(packageManager$1, "format")))}\n`;
|
|
3152
|
+
outroMessage += ` ${(0, import_picocolors.bold)((0, import_picocolors.green)(getCommand(packageManager$1, "dev")))}\n`;
|
|
3153
|
+
outroMessage += `
|
|
3154
|
+
${(0, import_picocolors.dim)("|")} ${language.infos.optionalGitCommand}
|
|
3155
|
+
|
|
3156
|
+
${(0, import_picocolors.bold)((0, import_picocolors.green)("git init && git add -A && git commit -m \"initial commit\""))}`;
|
|
3157
|
+
Se(outroMessage);
|
|
3158
|
+
}
|
|
3159
|
+
init().catch((e) => {
|
|
3160
|
+
console.error(e);
|
|
3161
|
+
process.exit(1);
|
|
3162
|
+
});
|
|
3163
|
+
|
|
3164
|
+
//#endregion
|