create-edhor-stack 0.1.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 +21 -0
- package/README.md +75 -0
- package/STACK.md +1086 -0
- package/dist/index.js +3181 -0
- package/package.json +44 -0
- package/templates/apps/api-elysia/package.json +21 -0
- package/templates/apps/api-elysia/src/index.ts +59 -0
- package/templates/apps/api-elysia/src/lib/eden.ts +25 -0
- package/templates/apps/api-elysia/src/lib/env.ts +18 -0
- package/templates/apps/api-elysia/src/routes/health.ts +13 -0
- package/templates/apps/api-elysia/src/routes/users.ts +117 -0
- package/templates/apps/api-elysia/tsconfig.json +15 -0
- package/templates/apps/api-hono/package.json +20 -0
- package/templates/apps/api-hono/src/index.ts +66 -0
- package/templates/apps/api-hono/src/lib/env.ts +18 -0
- package/templates/apps/api-hono/src/routes/health.ts +20 -0
- package/templates/apps/api-hono/src/routes/users.ts +110 -0
- package/templates/apps/api-hono/tsconfig.json +15 -0
- package/templates/apps/mobile/.env.example +9 -0
- package/templates/apps/mobile/app/_layout.tsx +16 -0
- package/templates/apps/mobile/app/index.tsx +39 -0
- package/templates/apps/mobile/app.json +37 -0
- package/templates/apps/mobile/assets/adaptive-icon.png +0 -0
- package/templates/apps/mobile/assets/favicon.png +0 -0
- package/templates/apps/mobile/assets/icon.png +0 -0
- package/templates/apps/mobile/assets/splash-icon.png +0 -0
- package/templates/apps/mobile/package.json +39 -0
- package/templates/apps/mobile/src/api/client.ts +51 -0
- package/templates/apps/mobile/src/api/index.ts +3 -0
- package/templates/apps/mobile/src/api/queries.ts +24 -0
- package/templates/apps/mobile/src/api/schemas.ts +32 -0
- package/templates/apps/mobile/src/lib/env.ts +40 -0
- package/templates/apps/mobile/src/lib/query-client.ts +28 -0
- package/templates/apps/mobile/src/lib/result.ts +45 -0
- package/templates/apps/mobile/src/lib/store.ts +63 -0
- package/templates/apps/mobile/tsconfig.json +10 -0
- package/templates/apps/web/.env.example +11 -0
- package/templates/apps/web/package.json +29 -0
- package/templates/apps/web/src/lib/env.ts +52 -0
- package/templates/apps/web/src/lib/queries.ts +27 -0
- package/templates/apps/web/src/lib/query-client.ts +11 -0
- package/templates/apps/web/src/router.tsx +17 -0
- package/templates/apps/web/src/routes/__root.tsx +32 -0
- package/templates/apps/web/src/routes/index.tsx +16 -0
- package/templates/apps/web/src/styles.css +26 -0
- package/templates/apps/web/tsconfig.json +10 -0
- package/templates/apps/web/vite.config.ts +21 -0
- package/templates/base/.claude/settings.json +33 -0
- package/templates/base/.claude/skills/add-api-endpoint.md +137 -0
- package/templates/base/.claude/skills/add-component.md +79 -0
- package/templates/base/.claude/skills/add-route.md +134 -0
- package/templates/base/.claude/skills/add-store.md +158 -0
- package/templates/base/.husky/pre-commit +1 -0
- package/templates/base/.lintstagedrc +4 -0
- package/templates/base/.node-version +1 -0
- package/templates/base/AGENTS.md +135 -0
- package/templates/base/CLAUDE.md.hbs +139 -0
- package/templates/base/Dockerfile +32 -0
- package/templates/base/biome.json +52 -0
- package/templates/base/fly.toml.hbs +20 -0
- package/templates/base/gitignore +36 -0
- package/templates/base/package.json.hbs +22 -0
- package/templates/base/tsconfig.json +14 -0
- package/templates/base/turbo.json +22 -0
- package/templates/packages/shared/package.json +17 -0
- package/templates/packages/shared/src/index.ts +4 -0
- package/templates/packages/shared/src/schemas.ts +50 -0
- package/templates/packages/shared/src/types.ts +47 -0
- package/templates/packages/shared/src/utils.ts +87 -0
- package/templates/packages/shared/tsconfig.json +14 -0
- package/templates/packages/stripe/package.json +18 -0
- package/templates/packages/stripe/src/client.ts +110 -0
- package/templates/packages/stripe/src/index.ts +3 -0
- package/templates/packages/stripe/src/schemas.ts +65 -0
- package/templates/packages/stripe/src/webhooks.ts +91 -0
- package/templates/packages/stripe/tsconfig.json +14 -0
- package/templates/packages/ui/components.json +19 -0
- package/templates/packages/ui/package.json +29 -0
- package/templates/packages/ui/src/components/button.tsx +58 -0
- package/templates/packages/ui/src/index.ts +5 -0
- package/templates/packages/ui/src/lib/utils.ts +6 -0
- package/templates/packages/ui/src/styles.css +120 -0
- package/templates/packages/ui/tsconfig.json +10 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
+
for (let key of __getOwnPropNames(mod))
|
|
12
|
+
if (!__hasOwnProp.call(to, key))
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: () => mod[key],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
20
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
21
|
+
|
|
22
|
+
// node_modules/sisteransi/src/index.js
|
|
23
|
+
var require_src = __commonJS((exports, module) => {
|
|
24
|
+
var ESC = "\x1B";
|
|
25
|
+
var CSI = `${ESC}[`;
|
|
26
|
+
var beep = "\x07";
|
|
27
|
+
var cursor = {
|
|
28
|
+
to(x, y) {
|
|
29
|
+
if (!y)
|
|
30
|
+
return `${CSI}${x + 1}G`;
|
|
31
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
32
|
+
},
|
|
33
|
+
move(x, y) {
|
|
34
|
+
let ret = "";
|
|
35
|
+
if (x < 0)
|
|
36
|
+
ret += `${CSI}${-x}D`;
|
|
37
|
+
else if (x > 0)
|
|
38
|
+
ret += `${CSI}${x}C`;
|
|
39
|
+
if (y < 0)
|
|
40
|
+
ret += `${CSI}${-y}A`;
|
|
41
|
+
else if (y > 0)
|
|
42
|
+
ret += `${CSI}${y}B`;
|
|
43
|
+
return ret;
|
|
44
|
+
},
|
|
45
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
46
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
47
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
48
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
49
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
50
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
51
|
+
left: `${CSI}G`,
|
|
52
|
+
hide: `${CSI}?25l`,
|
|
53
|
+
show: `${CSI}?25h`,
|
|
54
|
+
save: `${ESC}7`,
|
|
55
|
+
restore: `${ESC}8`
|
|
56
|
+
};
|
|
57
|
+
var scroll = {
|
|
58
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
59
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
60
|
+
};
|
|
61
|
+
var erase = {
|
|
62
|
+
screen: `${CSI}2J`,
|
|
63
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
64
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
65
|
+
line: `${CSI}2K`,
|
|
66
|
+
lineEnd: `${CSI}K`,
|
|
67
|
+
lineStart: `${CSI}1K`,
|
|
68
|
+
lines(count) {
|
|
69
|
+
let clear = "";
|
|
70
|
+
for (let i = 0;i < count; i++)
|
|
71
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
72
|
+
if (count)
|
|
73
|
+
clear += cursor.left;
|
|
74
|
+
return clear;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// node_modules/picocolors/picocolors.js
|
|
81
|
+
var require_picocolors = __commonJS((exports, module) => {
|
|
82
|
+
var p = process || {};
|
|
83
|
+
var argv = p.argv || [];
|
|
84
|
+
var env = p.env || {};
|
|
85
|
+
var 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);
|
|
86
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
87
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
88
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
89
|
+
};
|
|
90
|
+
var replaceClose = (string, close, replace, index) => {
|
|
91
|
+
let result = "", cursor = 0;
|
|
92
|
+
do {
|
|
93
|
+
result += string.substring(cursor, index) + replace;
|
|
94
|
+
cursor = index + close.length;
|
|
95
|
+
index = string.indexOf(close, cursor);
|
|
96
|
+
} while (~index);
|
|
97
|
+
return result + string.substring(cursor);
|
|
98
|
+
};
|
|
99
|
+
var createColors = (enabled = isColorSupported) => {
|
|
100
|
+
let f = enabled ? formatter : () => String;
|
|
101
|
+
return {
|
|
102
|
+
isColorSupported: enabled,
|
|
103
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
104
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
105
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
106
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
107
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
108
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
109
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
110
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
111
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
112
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
113
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
114
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
115
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
116
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
117
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
118
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
119
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
120
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
121
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
122
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
123
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
124
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
125
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
126
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
127
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
128
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
129
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
130
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
131
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
132
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
133
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
134
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
135
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
136
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
137
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
138
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
139
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
140
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
141
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
142
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
143
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
module.exports = createColors();
|
|
147
|
+
module.exports.createColors = createColors;
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// node_modules/universalify/index.js
|
|
151
|
+
var require_universalify = __commonJS((exports) => {
|
|
152
|
+
exports.fromCallback = function(fn) {
|
|
153
|
+
return Object.defineProperty(function(...args) {
|
|
154
|
+
if (typeof args[args.length - 1] === "function")
|
|
155
|
+
fn.apply(this, args);
|
|
156
|
+
else {
|
|
157
|
+
return new Promise((resolve, reject) => {
|
|
158
|
+
args.push((err, res) => err != null ? reject(err) : resolve(res));
|
|
159
|
+
fn.apply(this, args);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}, "name", { value: fn.name });
|
|
163
|
+
};
|
|
164
|
+
exports.fromPromise = function(fn) {
|
|
165
|
+
return Object.defineProperty(function(...args) {
|
|
166
|
+
const cb = args[args.length - 1];
|
|
167
|
+
if (typeof cb !== "function")
|
|
168
|
+
return fn.apply(this, args);
|
|
169
|
+
else {
|
|
170
|
+
args.pop();
|
|
171
|
+
fn.apply(this, args).then((r) => cb(null, r), cb);
|
|
172
|
+
}
|
|
173
|
+
}, "name", { value: fn.name });
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// node_modules/graceful-fs/polyfills.js
|
|
178
|
+
var require_polyfills = __commonJS((exports, module) => {
|
|
179
|
+
var constants = __require("constants");
|
|
180
|
+
var origCwd = process.cwd;
|
|
181
|
+
var cwd = null;
|
|
182
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
183
|
+
process.cwd = function() {
|
|
184
|
+
if (!cwd)
|
|
185
|
+
cwd = origCwd.call(process);
|
|
186
|
+
return cwd;
|
|
187
|
+
};
|
|
188
|
+
try {
|
|
189
|
+
process.cwd();
|
|
190
|
+
} catch (er) {}
|
|
191
|
+
if (typeof process.chdir === "function") {
|
|
192
|
+
chdir = process.chdir;
|
|
193
|
+
process.chdir = function(d3) {
|
|
194
|
+
cwd = null;
|
|
195
|
+
chdir.call(process, d3);
|
|
196
|
+
};
|
|
197
|
+
if (Object.setPrototypeOf)
|
|
198
|
+
Object.setPrototypeOf(process.chdir, chdir);
|
|
199
|
+
}
|
|
200
|
+
var chdir;
|
|
201
|
+
module.exports = patch;
|
|
202
|
+
function patch(fs) {
|
|
203
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
204
|
+
patchLchmod(fs);
|
|
205
|
+
}
|
|
206
|
+
if (!fs.lutimes) {
|
|
207
|
+
patchLutimes(fs);
|
|
208
|
+
}
|
|
209
|
+
fs.chown = chownFix(fs.chown);
|
|
210
|
+
fs.fchown = chownFix(fs.fchown);
|
|
211
|
+
fs.lchown = chownFix(fs.lchown);
|
|
212
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
213
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
214
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
215
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
216
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
217
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
218
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
219
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
220
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
221
|
+
fs.stat = statFix(fs.stat);
|
|
222
|
+
fs.fstat = statFix(fs.fstat);
|
|
223
|
+
fs.lstat = statFix(fs.lstat);
|
|
224
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
225
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
226
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
227
|
+
if (fs.chmod && !fs.lchmod) {
|
|
228
|
+
fs.lchmod = function(path, mode, cb) {
|
|
229
|
+
if (cb)
|
|
230
|
+
process.nextTick(cb);
|
|
231
|
+
};
|
|
232
|
+
fs.lchmodSync = function() {};
|
|
233
|
+
}
|
|
234
|
+
if (fs.chown && !fs.lchown) {
|
|
235
|
+
fs.lchown = function(path, uid, gid, cb) {
|
|
236
|
+
if (cb)
|
|
237
|
+
process.nextTick(cb);
|
|
238
|
+
};
|
|
239
|
+
fs.lchownSync = function() {};
|
|
240
|
+
}
|
|
241
|
+
if (platform === "win32") {
|
|
242
|
+
fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
|
|
243
|
+
function rename(from, to, cb) {
|
|
244
|
+
var start = Date.now();
|
|
245
|
+
var backoff = 0;
|
|
246
|
+
fs$rename(from, to, function CB(er) {
|
|
247
|
+
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 60000) {
|
|
248
|
+
setTimeout(function() {
|
|
249
|
+
fs.stat(to, function(stater, st) {
|
|
250
|
+
if (stater && stater.code === "ENOENT")
|
|
251
|
+
fs$rename(from, to, CB);
|
|
252
|
+
else
|
|
253
|
+
cb(er);
|
|
254
|
+
});
|
|
255
|
+
}, backoff);
|
|
256
|
+
if (backoff < 100)
|
|
257
|
+
backoff += 10;
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (cb)
|
|
261
|
+
cb(er);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
if (Object.setPrototypeOf)
|
|
265
|
+
Object.setPrototypeOf(rename, fs$rename);
|
|
266
|
+
return rename;
|
|
267
|
+
}(fs.rename);
|
|
268
|
+
}
|
|
269
|
+
fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
|
|
270
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
271
|
+
var callback;
|
|
272
|
+
if (callback_ && typeof callback_ === "function") {
|
|
273
|
+
var eagCounter = 0;
|
|
274
|
+
callback = function(er, _3, __) {
|
|
275
|
+
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
276
|
+
eagCounter++;
|
|
277
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
278
|
+
}
|
|
279
|
+
callback_.apply(this, arguments);
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
283
|
+
}
|
|
284
|
+
if (Object.setPrototypeOf)
|
|
285
|
+
Object.setPrototypeOf(read, fs$read);
|
|
286
|
+
return read;
|
|
287
|
+
}(fs.read);
|
|
288
|
+
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) {
|
|
289
|
+
return function(fd, buffer, offset, length, position) {
|
|
290
|
+
var eagCounter = 0;
|
|
291
|
+
while (true) {
|
|
292
|
+
try {
|
|
293
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
294
|
+
} catch (er) {
|
|
295
|
+
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
296
|
+
eagCounter++;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
throw er;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}(fs.readSync);
|
|
304
|
+
function patchLchmod(fs2) {
|
|
305
|
+
fs2.lchmod = function(path, mode, callback) {
|
|
306
|
+
fs2.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
307
|
+
if (err) {
|
|
308
|
+
if (callback)
|
|
309
|
+
callback(err);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
fs2.fchmod(fd, mode, function(err2) {
|
|
313
|
+
fs2.close(fd, function(err22) {
|
|
314
|
+
if (callback)
|
|
315
|
+
callback(err2 || err22);
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
fs2.lchmodSync = function(path, mode) {
|
|
321
|
+
var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
322
|
+
var threw = true;
|
|
323
|
+
var ret;
|
|
324
|
+
try {
|
|
325
|
+
ret = fs2.fchmodSync(fd, mode);
|
|
326
|
+
threw = false;
|
|
327
|
+
} finally {
|
|
328
|
+
if (threw) {
|
|
329
|
+
try {
|
|
330
|
+
fs2.closeSync(fd);
|
|
331
|
+
} catch (er) {}
|
|
332
|
+
} else {
|
|
333
|
+
fs2.closeSync(fd);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return ret;
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function patchLutimes(fs2) {
|
|
340
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
|
|
341
|
+
fs2.lutimes = function(path, at, mt, cb) {
|
|
342
|
+
fs2.open(path, constants.O_SYMLINK, function(er, fd) {
|
|
343
|
+
if (er) {
|
|
344
|
+
if (cb)
|
|
345
|
+
cb(er);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
fs2.futimes(fd, at, mt, function(er2) {
|
|
349
|
+
fs2.close(fd, function(er22) {
|
|
350
|
+
if (cb)
|
|
351
|
+
cb(er2 || er22);
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
fs2.lutimesSync = function(path, at, mt) {
|
|
357
|
+
var fd = fs2.openSync(path, constants.O_SYMLINK);
|
|
358
|
+
var ret;
|
|
359
|
+
var threw = true;
|
|
360
|
+
try {
|
|
361
|
+
ret = fs2.futimesSync(fd, at, mt);
|
|
362
|
+
threw = false;
|
|
363
|
+
} finally {
|
|
364
|
+
if (threw) {
|
|
365
|
+
try {
|
|
366
|
+
fs2.closeSync(fd);
|
|
367
|
+
} catch (er) {}
|
|
368
|
+
} else {
|
|
369
|
+
fs2.closeSync(fd);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return ret;
|
|
373
|
+
};
|
|
374
|
+
} else if (fs2.futimes) {
|
|
375
|
+
fs2.lutimes = function(_a, _b, _c, cb) {
|
|
376
|
+
if (cb)
|
|
377
|
+
process.nextTick(cb);
|
|
378
|
+
};
|
|
379
|
+
fs2.lutimesSync = function() {};
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function chmodFix(orig) {
|
|
383
|
+
if (!orig)
|
|
384
|
+
return orig;
|
|
385
|
+
return function(target, mode, cb) {
|
|
386
|
+
return orig.call(fs, target, mode, function(er) {
|
|
387
|
+
if (chownErOk(er))
|
|
388
|
+
er = null;
|
|
389
|
+
if (cb)
|
|
390
|
+
cb.apply(this, arguments);
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function chmodFixSync(orig) {
|
|
395
|
+
if (!orig)
|
|
396
|
+
return orig;
|
|
397
|
+
return function(target, mode) {
|
|
398
|
+
try {
|
|
399
|
+
return orig.call(fs, target, mode);
|
|
400
|
+
} catch (er) {
|
|
401
|
+
if (!chownErOk(er))
|
|
402
|
+
throw er;
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function chownFix(orig) {
|
|
407
|
+
if (!orig)
|
|
408
|
+
return orig;
|
|
409
|
+
return function(target, uid, gid, cb) {
|
|
410
|
+
return orig.call(fs, target, uid, gid, function(er) {
|
|
411
|
+
if (chownErOk(er))
|
|
412
|
+
er = null;
|
|
413
|
+
if (cb)
|
|
414
|
+
cb.apply(this, arguments);
|
|
415
|
+
});
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function chownFixSync(orig) {
|
|
419
|
+
if (!orig)
|
|
420
|
+
return orig;
|
|
421
|
+
return function(target, uid, gid) {
|
|
422
|
+
try {
|
|
423
|
+
return orig.call(fs, target, uid, gid);
|
|
424
|
+
} catch (er) {
|
|
425
|
+
if (!chownErOk(er))
|
|
426
|
+
throw er;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function statFix(orig) {
|
|
431
|
+
if (!orig)
|
|
432
|
+
return orig;
|
|
433
|
+
return function(target, options, cb) {
|
|
434
|
+
if (typeof options === "function") {
|
|
435
|
+
cb = options;
|
|
436
|
+
options = null;
|
|
437
|
+
}
|
|
438
|
+
function callback(er, stats) {
|
|
439
|
+
if (stats) {
|
|
440
|
+
if (stats.uid < 0)
|
|
441
|
+
stats.uid += 4294967296;
|
|
442
|
+
if (stats.gid < 0)
|
|
443
|
+
stats.gid += 4294967296;
|
|
444
|
+
}
|
|
445
|
+
if (cb)
|
|
446
|
+
cb.apply(this, arguments);
|
|
447
|
+
}
|
|
448
|
+
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function statFixSync(orig) {
|
|
452
|
+
if (!orig)
|
|
453
|
+
return orig;
|
|
454
|
+
return function(target, options) {
|
|
455
|
+
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
456
|
+
if (stats) {
|
|
457
|
+
if (stats.uid < 0)
|
|
458
|
+
stats.uid += 4294967296;
|
|
459
|
+
if (stats.gid < 0)
|
|
460
|
+
stats.gid += 4294967296;
|
|
461
|
+
}
|
|
462
|
+
return stats;
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
function chownErOk(er) {
|
|
466
|
+
if (!er)
|
|
467
|
+
return true;
|
|
468
|
+
if (er.code === "ENOSYS")
|
|
469
|
+
return true;
|
|
470
|
+
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
471
|
+
if (nonroot) {
|
|
472
|
+
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
473
|
+
return true;
|
|
474
|
+
}
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
// node_modules/graceful-fs/legacy-streams.js
|
|
481
|
+
var require_legacy_streams = __commonJS((exports, module) => {
|
|
482
|
+
var Stream = __require("stream").Stream;
|
|
483
|
+
module.exports = legacy;
|
|
484
|
+
function legacy(fs) {
|
|
485
|
+
return {
|
|
486
|
+
ReadStream,
|
|
487
|
+
WriteStream
|
|
488
|
+
};
|
|
489
|
+
function ReadStream(path, options) {
|
|
490
|
+
if (!(this instanceof ReadStream))
|
|
491
|
+
return new ReadStream(path, options);
|
|
492
|
+
Stream.call(this);
|
|
493
|
+
var self = this;
|
|
494
|
+
this.path = path;
|
|
495
|
+
this.fd = null;
|
|
496
|
+
this.readable = true;
|
|
497
|
+
this.paused = false;
|
|
498
|
+
this.flags = "r";
|
|
499
|
+
this.mode = 438;
|
|
500
|
+
this.bufferSize = 64 * 1024;
|
|
501
|
+
options = options || {};
|
|
502
|
+
var keys = Object.keys(options);
|
|
503
|
+
for (var index = 0, length = keys.length;index < length; index++) {
|
|
504
|
+
var key = keys[index];
|
|
505
|
+
this[key] = options[key];
|
|
506
|
+
}
|
|
507
|
+
if (this.encoding)
|
|
508
|
+
this.setEncoding(this.encoding);
|
|
509
|
+
if (this.start !== undefined) {
|
|
510
|
+
if (typeof this.start !== "number") {
|
|
511
|
+
throw TypeError("start must be a Number");
|
|
512
|
+
}
|
|
513
|
+
if (this.end === undefined) {
|
|
514
|
+
this.end = Infinity;
|
|
515
|
+
} else if (typeof this.end !== "number") {
|
|
516
|
+
throw TypeError("end must be a Number");
|
|
517
|
+
}
|
|
518
|
+
if (this.start > this.end) {
|
|
519
|
+
throw new Error("start must be <= end");
|
|
520
|
+
}
|
|
521
|
+
this.pos = this.start;
|
|
522
|
+
}
|
|
523
|
+
if (this.fd !== null) {
|
|
524
|
+
process.nextTick(function() {
|
|
525
|
+
self._read();
|
|
526
|
+
});
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
530
|
+
if (err) {
|
|
531
|
+
self.emit("error", err);
|
|
532
|
+
self.readable = false;
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
self.fd = fd;
|
|
536
|
+
self.emit("open", fd);
|
|
537
|
+
self._read();
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
function WriteStream(path, options) {
|
|
541
|
+
if (!(this instanceof WriteStream))
|
|
542
|
+
return new WriteStream(path, options);
|
|
543
|
+
Stream.call(this);
|
|
544
|
+
this.path = path;
|
|
545
|
+
this.fd = null;
|
|
546
|
+
this.writable = true;
|
|
547
|
+
this.flags = "w";
|
|
548
|
+
this.encoding = "binary";
|
|
549
|
+
this.mode = 438;
|
|
550
|
+
this.bytesWritten = 0;
|
|
551
|
+
options = options || {};
|
|
552
|
+
var keys = Object.keys(options);
|
|
553
|
+
for (var index = 0, length = keys.length;index < length; index++) {
|
|
554
|
+
var key = keys[index];
|
|
555
|
+
this[key] = options[key];
|
|
556
|
+
}
|
|
557
|
+
if (this.start !== undefined) {
|
|
558
|
+
if (typeof this.start !== "number") {
|
|
559
|
+
throw TypeError("start must be a Number");
|
|
560
|
+
}
|
|
561
|
+
if (this.start < 0) {
|
|
562
|
+
throw new Error("start must be >= zero");
|
|
563
|
+
}
|
|
564
|
+
this.pos = this.start;
|
|
565
|
+
}
|
|
566
|
+
this.busy = false;
|
|
567
|
+
this._queue = [];
|
|
568
|
+
if (this.fd === null) {
|
|
569
|
+
this._open = fs.open;
|
|
570
|
+
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
|
|
571
|
+
this.flush();
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
// node_modules/graceful-fs/clone.js
|
|
578
|
+
var require_clone = __commonJS((exports, module) => {
|
|
579
|
+
module.exports = clone;
|
|
580
|
+
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
581
|
+
return obj.__proto__;
|
|
582
|
+
};
|
|
583
|
+
function clone(obj) {
|
|
584
|
+
if (obj === null || typeof obj !== "object")
|
|
585
|
+
return obj;
|
|
586
|
+
if (obj instanceof Object)
|
|
587
|
+
var copy = { __proto__: getPrototypeOf(obj) };
|
|
588
|
+
else
|
|
589
|
+
var copy = Object.create(null);
|
|
590
|
+
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
591
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
592
|
+
});
|
|
593
|
+
return copy;
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// node_modules/graceful-fs/graceful-fs.js
|
|
598
|
+
var require_graceful_fs = __commonJS((exports, module) => {
|
|
599
|
+
var fs = __require("fs");
|
|
600
|
+
var polyfills = require_polyfills();
|
|
601
|
+
var legacy = require_legacy_streams();
|
|
602
|
+
var clone = require_clone();
|
|
603
|
+
var util = __require("util");
|
|
604
|
+
var gracefulQueue;
|
|
605
|
+
var previousSymbol;
|
|
606
|
+
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
607
|
+
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
608
|
+
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
609
|
+
} else {
|
|
610
|
+
gracefulQueue = "___graceful-fs.queue";
|
|
611
|
+
previousSymbol = "___graceful-fs.previous";
|
|
612
|
+
}
|
|
613
|
+
function noop() {}
|
|
614
|
+
function publishQueue(context, queue2) {
|
|
615
|
+
Object.defineProperty(context, gracefulQueue, {
|
|
616
|
+
get: function() {
|
|
617
|
+
return queue2;
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
var debug = noop;
|
|
622
|
+
if (util.debuglog)
|
|
623
|
+
debug = util.debuglog("gfs4");
|
|
624
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
625
|
+
debug = function() {
|
|
626
|
+
var m2 = util.format.apply(util, arguments);
|
|
627
|
+
m2 = "GFS4: " + m2.split(/\n/).join(`
|
|
628
|
+
GFS4: `);
|
|
629
|
+
console.error(m2);
|
|
630
|
+
};
|
|
631
|
+
if (!fs[gracefulQueue]) {
|
|
632
|
+
queue = global[gracefulQueue] || [];
|
|
633
|
+
publishQueue(fs, queue);
|
|
634
|
+
fs.close = function(fs$close) {
|
|
635
|
+
function close(fd, cb) {
|
|
636
|
+
return fs$close.call(fs, fd, function(err) {
|
|
637
|
+
if (!err) {
|
|
638
|
+
resetQueue();
|
|
639
|
+
}
|
|
640
|
+
if (typeof cb === "function")
|
|
641
|
+
cb.apply(this, arguments);
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
Object.defineProperty(close, previousSymbol, {
|
|
645
|
+
value: fs$close
|
|
646
|
+
});
|
|
647
|
+
return close;
|
|
648
|
+
}(fs.close);
|
|
649
|
+
fs.closeSync = function(fs$closeSync) {
|
|
650
|
+
function closeSync(fd) {
|
|
651
|
+
fs$closeSync.apply(fs, arguments);
|
|
652
|
+
resetQueue();
|
|
653
|
+
}
|
|
654
|
+
Object.defineProperty(closeSync, previousSymbol, {
|
|
655
|
+
value: fs$closeSync
|
|
656
|
+
});
|
|
657
|
+
return closeSync;
|
|
658
|
+
}(fs.closeSync);
|
|
659
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
660
|
+
process.on("exit", function() {
|
|
661
|
+
debug(fs[gracefulQueue]);
|
|
662
|
+
__require("assert").equal(fs[gracefulQueue].length, 0);
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
var queue;
|
|
667
|
+
if (!global[gracefulQueue]) {
|
|
668
|
+
publishQueue(global, fs[gracefulQueue]);
|
|
669
|
+
}
|
|
670
|
+
module.exports = patch(clone(fs));
|
|
671
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
672
|
+
module.exports = patch(fs);
|
|
673
|
+
fs.__patched = true;
|
|
674
|
+
}
|
|
675
|
+
function patch(fs2) {
|
|
676
|
+
polyfills(fs2);
|
|
677
|
+
fs2.gracefulify = patch;
|
|
678
|
+
fs2.createReadStream = createReadStream;
|
|
679
|
+
fs2.createWriteStream = createWriteStream;
|
|
680
|
+
var fs$readFile = fs2.readFile;
|
|
681
|
+
fs2.readFile = readFile;
|
|
682
|
+
function readFile(path, options, cb) {
|
|
683
|
+
if (typeof options === "function")
|
|
684
|
+
cb = options, options = null;
|
|
685
|
+
return go$readFile(path, options, cb);
|
|
686
|
+
function go$readFile(path2, options2, cb2, startTime) {
|
|
687
|
+
return fs$readFile(path2, options2, function(err) {
|
|
688
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
689
|
+
enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
690
|
+
else {
|
|
691
|
+
if (typeof cb2 === "function")
|
|
692
|
+
cb2.apply(this, arguments);
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
var fs$writeFile = fs2.writeFile;
|
|
698
|
+
fs2.writeFile = writeFile;
|
|
699
|
+
function writeFile(path, data, options, cb) {
|
|
700
|
+
if (typeof options === "function")
|
|
701
|
+
cb = options, options = null;
|
|
702
|
+
return go$writeFile(path, data, options, cb);
|
|
703
|
+
function go$writeFile(path2, data2, options2, cb2, startTime) {
|
|
704
|
+
return fs$writeFile(path2, data2, options2, function(err) {
|
|
705
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
706
|
+
enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
707
|
+
else {
|
|
708
|
+
if (typeof cb2 === "function")
|
|
709
|
+
cb2.apply(this, arguments);
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
var fs$appendFile = fs2.appendFile;
|
|
715
|
+
if (fs$appendFile)
|
|
716
|
+
fs2.appendFile = appendFile;
|
|
717
|
+
function appendFile(path, data, options, cb) {
|
|
718
|
+
if (typeof options === "function")
|
|
719
|
+
cb = options, options = null;
|
|
720
|
+
return go$appendFile(path, data, options, cb);
|
|
721
|
+
function go$appendFile(path2, data2, options2, cb2, startTime) {
|
|
722
|
+
return fs$appendFile(path2, data2, options2, function(err) {
|
|
723
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
724
|
+
enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
725
|
+
else {
|
|
726
|
+
if (typeof cb2 === "function")
|
|
727
|
+
cb2.apply(this, arguments);
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
var fs$copyFile = fs2.copyFile;
|
|
733
|
+
if (fs$copyFile)
|
|
734
|
+
fs2.copyFile = copyFile;
|
|
735
|
+
function copyFile(src, dest, flags, cb) {
|
|
736
|
+
if (typeof flags === "function") {
|
|
737
|
+
cb = flags;
|
|
738
|
+
flags = 0;
|
|
739
|
+
}
|
|
740
|
+
return go$copyFile(src, dest, flags, cb);
|
|
741
|
+
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
|
|
742
|
+
return fs$copyFile(src2, dest2, flags2, function(err) {
|
|
743
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
744
|
+
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
745
|
+
else {
|
|
746
|
+
if (typeof cb2 === "function")
|
|
747
|
+
cb2.apply(this, arguments);
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
var fs$readdir = fs2.readdir;
|
|
753
|
+
fs2.readdir = readdir;
|
|
754
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
755
|
+
function readdir(path, options, cb) {
|
|
756
|
+
if (typeof options === "function")
|
|
757
|
+
cb = options, options = null;
|
|
758
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path2, options2, cb2, startTime) {
|
|
759
|
+
return fs$readdir(path2, fs$readdirCallback(path2, options2, cb2, startTime));
|
|
760
|
+
} : function go$readdir(path2, options2, cb2, startTime) {
|
|
761
|
+
return fs$readdir(path2, options2, fs$readdirCallback(path2, options2, cb2, startTime));
|
|
762
|
+
};
|
|
763
|
+
return go$readdir(path, options, cb);
|
|
764
|
+
function fs$readdirCallback(path2, options2, cb2, startTime) {
|
|
765
|
+
return function(err, files) {
|
|
766
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
767
|
+
enqueue([
|
|
768
|
+
go$readdir,
|
|
769
|
+
[path2, options2, cb2],
|
|
770
|
+
err,
|
|
771
|
+
startTime || Date.now(),
|
|
772
|
+
Date.now()
|
|
773
|
+
]);
|
|
774
|
+
else {
|
|
775
|
+
if (files && files.sort)
|
|
776
|
+
files.sort();
|
|
777
|
+
if (typeof cb2 === "function")
|
|
778
|
+
cb2.call(this, err, files);
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
if (process.version.substr(0, 4) === "v0.8") {
|
|
784
|
+
var legStreams = legacy(fs2);
|
|
785
|
+
ReadStream = legStreams.ReadStream;
|
|
786
|
+
WriteStream = legStreams.WriteStream;
|
|
787
|
+
}
|
|
788
|
+
var fs$ReadStream = fs2.ReadStream;
|
|
789
|
+
if (fs$ReadStream) {
|
|
790
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
791
|
+
ReadStream.prototype.open = ReadStream$open;
|
|
792
|
+
}
|
|
793
|
+
var fs$WriteStream = fs2.WriteStream;
|
|
794
|
+
if (fs$WriteStream) {
|
|
795
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
796
|
+
WriteStream.prototype.open = WriteStream$open;
|
|
797
|
+
}
|
|
798
|
+
Object.defineProperty(fs2, "ReadStream", {
|
|
799
|
+
get: function() {
|
|
800
|
+
return ReadStream;
|
|
801
|
+
},
|
|
802
|
+
set: function(val) {
|
|
803
|
+
ReadStream = val;
|
|
804
|
+
},
|
|
805
|
+
enumerable: true,
|
|
806
|
+
configurable: true
|
|
807
|
+
});
|
|
808
|
+
Object.defineProperty(fs2, "WriteStream", {
|
|
809
|
+
get: function() {
|
|
810
|
+
return WriteStream;
|
|
811
|
+
},
|
|
812
|
+
set: function(val) {
|
|
813
|
+
WriteStream = val;
|
|
814
|
+
},
|
|
815
|
+
enumerable: true,
|
|
816
|
+
configurable: true
|
|
817
|
+
});
|
|
818
|
+
var FileReadStream = ReadStream;
|
|
819
|
+
Object.defineProperty(fs2, "FileReadStream", {
|
|
820
|
+
get: function() {
|
|
821
|
+
return FileReadStream;
|
|
822
|
+
},
|
|
823
|
+
set: function(val) {
|
|
824
|
+
FileReadStream = val;
|
|
825
|
+
},
|
|
826
|
+
enumerable: true,
|
|
827
|
+
configurable: true
|
|
828
|
+
});
|
|
829
|
+
var FileWriteStream = WriteStream;
|
|
830
|
+
Object.defineProperty(fs2, "FileWriteStream", {
|
|
831
|
+
get: function() {
|
|
832
|
+
return FileWriteStream;
|
|
833
|
+
},
|
|
834
|
+
set: function(val) {
|
|
835
|
+
FileWriteStream = val;
|
|
836
|
+
},
|
|
837
|
+
enumerable: true,
|
|
838
|
+
configurable: true
|
|
839
|
+
});
|
|
840
|
+
function ReadStream(path, options) {
|
|
841
|
+
if (this instanceof ReadStream)
|
|
842
|
+
return fs$ReadStream.apply(this, arguments), this;
|
|
843
|
+
else
|
|
844
|
+
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
845
|
+
}
|
|
846
|
+
function ReadStream$open() {
|
|
847
|
+
var that = this;
|
|
848
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
849
|
+
if (err) {
|
|
850
|
+
if (that.autoClose)
|
|
851
|
+
that.destroy();
|
|
852
|
+
that.emit("error", err);
|
|
853
|
+
} else {
|
|
854
|
+
that.fd = fd;
|
|
855
|
+
that.emit("open", fd);
|
|
856
|
+
that.read();
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
function WriteStream(path, options) {
|
|
861
|
+
if (this instanceof WriteStream)
|
|
862
|
+
return fs$WriteStream.apply(this, arguments), this;
|
|
863
|
+
else
|
|
864
|
+
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
865
|
+
}
|
|
866
|
+
function WriteStream$open() {
|
|
867
|
+
var that = this;
|
|
868
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
869
|
+
if (err) {
|
|
870
|
+
that.destroy();
|
|
871
|
+
that.emit("error", err);
|
|
872
|
+
} else {
|
|
873
|
+
that.fd = fd;
|
|
874
|
+
that.emit("open", fd);
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
function createReadStream(path, options) {
|
|
879
|
+
return new fs2.ReadStream(path, options);
|
|
880
|
+
}
|
|
881
|
+
function createWriteStream(path, options) {
|
|
882
|
+
return new fs2.WriteStream(path, options);
|
|
883
|
+
}
|
|
884
|
+
var fs$open = fs2.open;
|
|
885
|
+
fs2.open = open;
|
|
886
|
+
function open(path, flags, mode, cb) {
|
|
887
|
+
if (typeof mode === "function")
|
|
888
|
+
cb = mode, mode = null;
|
|
889
|
+
return go$open(path, flags, mode, cb);
|
|
890
|
+
function go$open(path2, flags2, mode2, cb2, startTime) {
|
|
891
|
+
return fs$open(path2, flags2, mode2, function(err, fd) {
|
|
892
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
893
|
+
enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
894
|
+
else {
|
|
895
|
+
if (typeof cb2 === "function")
|
|
896
|
+
cb2.apply(this, arguments);
|
|
897
|
+
}
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
return fs2;
|
|
902
|
+
}
|
|
903
|
+
function enqueue(elem) {
|
|
904
|
+
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
905
|
+
fs[gracefulQueue].push(elem);
|
|
906
|
+
retry();
|
|
907
|
+
}
|
|
908
|
+
var retryTimer;
|
|
909
|
+
function resetQueue() {
|
|
910
|
+
var now = Date.now();
|
|
911
|
+
for (var i = 0;i < fs[gracefulQueue].length; ++i) {
|
|
912
|
+
if (fs[gracefulQueue][i].length > 2) {
|
|
913
|
+
fs[gracefulQueue][i][3] = now;
|
|
914
|
+
fs[gracefulQueue][i][4] = now;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
retry();
|
|
918
|
+
}
|
|
919
|
+
function retry() {
|
|
920
|
+
clearTimeout(retryTimer);
|
|
921
|
+
retryTimer = undefined;
|
|
922
|
+
if (fs[gracefulQueue].length === 0)
|
|
923
|
+
return;
|
|
924
|
+
var elem = fs[gracefulQueue].shift();
|
|
925
|
+
var fn = elem[0];
|
|
926
|
+
var args = elem[1];
|
|
927
|
+
var err = elem[2];
|
|
928
|
+
var startTime = elem[3];
|
|
929
|
+
var lastTime = elem[4];
|
|
930
|
+
if (startTime === undefined) {
|
|
931
|
+
debug("RETRY", fn.name, args);
|
|
932
|
+
fn.apply(null, args);
|
|
933
|
+
} else if (Date.now() - startTime >= 60000) {
|
|
934
|
+
debug("TIMEOUT", fn.name, args);
|
|
935
|
+
var cb = args.pop();
|
|
936
|
+
if (typeof cb === "function")
|
|
937
|
+
cb.call(null, err);
|
|
938
|
+
} else {
|
|
939
|
+
var sinceAttempt = Date.now() - lastTime;
|
|
940
|
+
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
941
|
+
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
942
|
+
if (sinceAttempt >= desiredDelay) {
|
|
943
|
+
debug("RETRY", fn.name, args);
|
|
944
|
+
fn.apply(null, args.concat([startTime]));
|
|
945
|
+
} else {
|
|
946
|
+
fs[gracefulQueue].push(elem);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
if (retryTimer === undefined) {
|
|
950
|
+
retryTimer = setTimeout(retry, 0);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
// node_modules/fs-extra/lib/fs/index.js
|
|
956
|
+
var require_fs = __commonJS((exports) => {
|
|
957
|
+
var u2 = require_universalify().fromCallback;
|
|
958
|
+
var fs = require_graceful_fs();
|
|
959
|
+
var api = [
|
|
960
|
+
"access",
|
|
961
|
+
"appendFile",
|
|
962
|
+
"chmod",
|
|
963
|
+
"chown",
|
|
964
|
+
"close",
|
|
965
|
+
"copyFile",
|
|
966
|
+
"cp",
|
|
967
|
+
"fchmod",
|
|
968
|
+
"fchown",
|
|
969
|
+
"fdatasync",
|
|
970
|
+
"fstat",
|
|
971
|
+
"fsync",
|
|
972
|
+
"ftruncate",
|
|
973
|
+
"futimes",
|
|
974
|
+
"glob",
|
|
975
|
+
"lchmod",
|
|
976
|
+
"lchown",
|
|
977
|
+
"lutimes",
|
|
978
|
+
"link",
|
|
979
|
+
"lstat",
|
|
980
|
+
"mkdir",
|
|
981
|
+
"mkdtemp",
|
|
982
|
+
"open",
|
|
983
|
+
"opendir",
|
|
984
|
+
"readdir",
|
|
985
|
+
"readFile",
|
|
986
|
+
"readlink",
|
|
987
|
+
"realpath",
|
|
988
|
+
"rename",
|
|
989
|
+
"rm",
|
|
990
|
+
"rmdir",
|
|
991
|
+
"stat",
|
|
992
|
+
"statfs",
|
|
993
|
+
"symlink",
|
|
994
|
+
"truncate",
|
|
995
|
+
"unlink",
|
|
996
|
+
"utimes",
|
|
997
|
+
"writeFile"
|
|
998
|
+
].filter((key) => {
|
|
999
|
+
return typeof fs[key] === "function";
|
|
1000
|
+
});
|
|
1001
|
+
Object.assign(exports, fs);
|
|
1002
|
+
api.forEach((method) => {
|
|
1003
|
+
exports[method] = u2(fs[method]);
|
|
1004
|
+
});
|
|
1005
|
+
exports.exists = function(filename, callback) {
|
|
1006
|
+
if (typeof callback === "function") {
|
|
1007
|
+
return fs.exists(filename, callback);
|
|
1008
|
+
}
|
|
1009
|
+
return new Promise((resolve) => {
|
|
1010
|
+
return fs.exists(filename, resolve);
|
|
1011
|
+
});
|
|
1012
|
+
};
|
|
1013
|
+
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
1014
|
+
if (typeof callback === "function") {
|
|
1015
|
+
return fs.read(fd, buffer, offset, length, position, callback);
|
|
1016
|
+
}
|
|
1017
|
+
return new Promise((resolve, reject) => {
|
|
1018
|
+
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
1019
|
+
if (err)
|
|
1020
|
+
return reject(err);
|
|
1021
|
+
resolve({ bytesRead, buffer: buffer2 });
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
};
|
|
1025
|
+
exports.write = function(fd, buffer, ...args) {
|
|
1026
|
+
if (typeof args[args.length - 1] === "function") {
|
|
1027
|
+
return fs.write(fd, buffer, ...args);
|
|
1028
|
+
}
|
|
1029
|
+
return new Promise((resolve, reject) => {
|
|
1030
|
+
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
1031
|
+
if (err)
|
|
1032
|
+
return reject(err);
|
|
1033
|
+
resolve({ bytesWritten, buffer: buffer2 });
|
|
1034
|
+
});
|
|
1035
|
+
});
|
|
1036
|
+
};
|
|
1037
|
+
exports.readv = function(fd, buffers, ...args) {
|
|
1038
|
+
if (typeof args[args.length - 1] === "function") {
|
|
1039
|
+
return fs.readv(fd, buffers, ...args);
|
|
1040
|
+
}
|
|
1041
|
+
return new Promise((resolve, reject) => {
|
|
1042
|
+
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
|
|
1043
|
+
if (err)
|
|
1044
|
+
return reject(err);
|
|
1045
|
+
resolve({ bytesRead, buffers: buffers2 });
|
|
1046
|
+
});
|
|
1047
|
+
});
|
|
1048
|
+
};
|
|
1049
|
+
exports.writev = function(fd, buffers, ...args) {
|
|
1050
|
+
if (typeof args[args.length - 1] === "function") {
|
|
1051
|
+
return fs.writev(fd, buffers, ...args);
|
|
1052
|
+
}
|
|
1053
|
+
return new Promise((resolve, reject) => {
|
|
1054
|
+
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
|
|
1055
|
+
if (err)
|
|
1056
|
+
return reject(err);
|
|
1057
|
+
resolve({ bytesWritten, buffers: buffers2 });
|
|
1058
|
+
});
|
|
1059
|
+
});
|
|
1060
|
+
};
|
|
1061
|
+
if (typeof fs.realpath.native === "function") {
|
|
1062
|
+
exports.realpath.native = u2(fs.realpath.native);
|
|
1063
|
+
} else {
|
|
1064
|
+
process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003");
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
// node_modules/fs-extra/lib/mkdirs/utils.js
|
|
1069
|
+
var require_utils = __commonJS((exports, module) => {
|
|
1070
|
+
var path = __require("path");
|
|
1071
|
+
exports.checkPath = function checkPath(pth) {
|
|
1072
|
+
if (process.platform === "win32") {
|
|
1073
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ""));
|
|
1074
|
+
if (pathHasInvalidWinCharacters) {
|
|
1075
|
+
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
1076
|
+
error.code = "EINVAL";
|
|
1077
|
+
throw error;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
// node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
1084
|
+
var require_make_dir = __commonJS((exports, module) => {
|
|
1085
|
+
var fs = require_fs();
|
|
1086
|
+
var { checkPath } = require_utils();
|
|
1087
|
+
var getMode = (options) => {
|
|
1088
|
+
const defaults = { mode: 511 };
|
|
1089
|
+
if (typeof options === "number")
|
|
1090
|
+
return options;
|
|
1091
|
+
return { ...defaults, ...options }.mode;
|
|
1092
|
+
};
|
|
1093
|
+
exports.makeDir = async (dir, options) => {
|
|
1094
|
+
checkPath(dir);
|
|
1095
|
+
return fs.mkdir(dir, {
|
|
1096
|
+
mode: getMode(options),
|
|
1097
|
+
recursive: true
|
|
1098
|
+
});
|
|
1099
|
+
};
|
|
1100
|
+
exports.makeDirSync = (dir, options) => {
|
|
1101
|
+
checkPath(dir);
|
|
1102
|
+
return fs.mkdirSync(dir, {
|
|
1103
|
+
mode: getMode(options),
|
|
1104
|
+
recursive: true
|
|
1105
|
+
});
|
|
1106
|
+
};
|
|
1107
|
+
});
|
|
1108
|
+
|
|
1109
|
+
// node_modules/fs-extra/lib/mkdirs/index.js
|
|
1110
|
+
var require_mkdirs = __commonJS((exports, module) => {
|
|
1111
|
+
var u2 = require_universalify().fromPromise;
|
|
1112
|
+
var { makeDir: _makeDir, makeDirSync } = require_make_dir();
|
|
1113
|
+
var makeDir = u2(_makeDir);
|
|
1114
|
+
module.exports = {
|
|
1115
|
+
mkdirs: makeDir,
|
|
1116
|
+
mkdirsSync: makeDirSync,
|
|
1117
|
+
mkdirp: makeDir,
|
|
1118
|
+
mkdirpSync: makeDirSync,
|
|
1119
|
+
ensureDir: makeDir,
|
|
1120
|
+
ensureDirSync: makeDirSync
|
|
1121
|
+
};
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
// node_modules/fs-extra/lib/path-exists/index.js
|
|
1125
|
+
var require_path_exists = __commonJS((exports, module) => {
|
|
1126
|
+
var u2 = require_universalify().fromPromise;
|
|
1127
|
+
var fs = require_fs();
|
|
1128
|
+
function pathExists(path) {
|
|
1129
|
+
return fs.access(path).then(() => true).catch(() => false);
|
|
1130
|
+
}
|
|
1131
|
+
module.exports = {
|
|
1132
|
+
pathExists: u2(pathExists),
|
|
1133
|
+
pathExistsSync: fs.existsSync
|
|
1134
|
+
};
|
|
1135
|
+
});
|
|
1136
|
+
|
|
1137
|
+
// node_modules/fs-extra/lib/util/utimes.js
|
|
1138
|
+
var require_utimes = __commonJS((exports, module) => {
|
|
1139
|
+
var fs = require_fs();
|
|
1140
|
+
var u2 = require_universalify().fromPromise;
|
|
1141
|
+
async function utimesMillis(path, atime, mtime) {
|
|
1142
|
+
const fd = await fs.open(path, "r+");
|
|
1143
|
+
let closeErr = null;
|
|
1144
|
+
try {
|
|
1145
|
+
await fs.futimes(fd, atime, mtime);
|
|
1146
|
+
} finally {
|
|
1147
|
+
try {
|
|
1148
|
+
await fs.close(fd);
|
|
1149
|
+
} catch (e2) {
|
|
1150
|
+
closeErr = e2;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
if (closeErr) {
|
|
1154
|
+
throw closeErr;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
function utimesMillisSync(path, atime, mtime) {
|
|
1158
|
+
const fd = fs.openSync(path, "r+");
|
|
1159
|
+
fs.futimesSync(fd, atime, mtime);
|
|
1160
|
+
return fs.closeSync(fd);
|
|
1161
|
+
}
|
|
1162
|
+
module.exports = {
|
|
1163
|
+
utimesMillis: u2(utimesMillis),
|
|
1164
|
+
utimesMillisSync
|
|
1165
|
+
};
|
|
1166
|
+
});
|
|
1167
|
+
|
|
1168
|
+
// node_modules/fs-extra/lib/util/stat.js
|
|
1169
|
+
var require_stat = __commonJS((exports, module) => {
|
|
1170
|
+
var fs = require_fs();
|
|
1171
|
+
var path = __require("path");
|
|
1172
|
+
var u2 = require_universalify().fromPromise;
|
|
1173
|
+
function getStats(src, dest, opts) {
|
|
1174
|
+
const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true });
|
|
1175
|
+
return Promise.all([
|
|
1176
|
+
statFunc(src),
|
|
1177
|
+
statFunc(dest).catch((err) => {
|
|
1178
|
+
if (err.code === "ENOENT")
|
|
1179
|
+
return null;
|
|
1180
|
+
throw err;
|
|
1181
|
+
})
|
|
1182
|
+
]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
|
|
1183
|
+
}
|
|
1184
|
+
function getStatsSync(src, dest, opts) {
|
|
1185
|
+
let destStat;
|
|
1186
|
+
const statFunc = opts.dereference ? (file) => fs.statSync(file, { bigint: true }) : (file) => fs.lstatSync(file, { bigint: true });
|
|
1187
|
+
const srcStat = statFunc(src);
|
|
1188
|
+
try {
|
|
1189
|
+
destStat = statFunc(dest);
|
|
1190
|
+
} catch (err) {
|
|
1191
|
+
if (err.code === "ENOENT")
|
|
1192
|
+
return { srcStat, destStat: null };
|
|
1193
|
+
throw err;
|
|
1194
|
+
}
|
|
1195
|
+
return { srcStat, destStat };
|
|
1196
|
+
}
|
|
1197
|
+
async function checkPaths(src, dest, funcName, opts) {
|
|
1198
|
+
const { srcStat, destStat } = await getStats(src, dest, opts);
|
|
1199
|
+
if (destStat) {
|
|
1200
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1201
|
+
const srcBaseName = path.basename(src);
|
|
1202
|
+
const destBaseName = path.basename(dest);
|
|
1203
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1204
|
+
return { srcStat, destStat, isChangingCase: true };
|
|
1205
|
+
}
|
|
1206
|
+
throw new Error("Source and destination must not be the same.");
|
|
1207
|
+
}
|
|
1208
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1209
|
+
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1210
|
+
}
|
|
1211
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1212
|
+
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1216
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
1217
|
+
}
|
|
1218
|
+
return { srcStat, destStat };
|
|
1219
|
+
}
|
|
1220
|
+
function checkPathsSync(src, dest, funcName, opts) {
|
|
1221
|
+
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
1222
|
+
if (destStat) {
|
|
1223
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1224
|
+
const srcBaseName = path.basename(src);
|
|
1225
|
+
const destBaseName = path.basename(dest);
|
|
1226
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1227
|
+
return { srcStat, destStat, isChangingCase: true };
|
|
1228
|
+
}
|
|
1229
|
+
throw new Error("Source and destination must not be the same.");
|
|
1230
|
+
}
|
|
1231
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1232
|
+
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1233
|
+
}
|
|
1234
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1235
|
+
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1239
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
1240
|
+
}
|
|
1241
|
+
return { srcStat, destStat };
|
|
1242
|
+
}
|
|
1243
|
+
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
1244
|
+
const srcParent = path.resolve(path.dirname(src));
|
|
1245
|
+
const destParent = path.resolve(path.dirname(dest));
|
|
1246
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root)
|
|
1247
|
+
return;
|
|
1248
|
+
let destStat;
|
|
1249
|
+
try {
|
|
1250
|
+
destStat = await fs.stat(destParent, { bigint: true });
|
|
1251
|
+
} catch (err) {
|
|
1252
|
+
if (err.code === "ENOENT")
|
|
1253
|
+
return;
|
|
1254
|
+
throw err;
|
|
1255
|
+
}
|
|
1256
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1257
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
1258
|
+
}
|
|
1259
|
+
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
1260
|
+
}
|
|
1261
|
+
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
1262
|
+
const srcParent = path.resolve(path.dirname(src));
|
|
1263
|
+
const destParent = path.resolve(path.dirname(dest));
|
|
1264
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root)
|
|
1265
|
+
return;
|
|
1266
|
+
let destStat;
|
|
1267
|
+
try {
|
|
1268
|
+
destStat = fs.statSync(destParent, { bigint: true });
|
|
1269
|
+
} catch (err) {
|
|
1270
|
+
if (err.code === "ENOENT")
|
|
1271
|
+
return;
|
|
1272
|
+
throw err;
|
|
1273
|
+
}
|
|
1274
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1275
|
+
throw new Error(errMsg(src, dest, funcName));
|
|
1276
|
+
}
|
|
1277
|
+
return checkParentPathsSync(src, srcStat, destParent, funcName);
|
|
1278
|
+
}
|
|
1279
|
+
function areIdentical(srcStat, destStat) {
|
|
1280
|
+
return destStat.ino !== undefined && destStat.dev !== undefined && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
1281
|
+
}
|
|
1282
|
+
function isSrcSubdir(src, dest) {
|
|
1283
|
+
const srcArr = path.resolve(src).split(path.sep).filter((i) => i);
|
|
1284
|
+
const destArr = path.resolve(dest).split(path.sep).filter((i) => i);
|
|
1285
|
+
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
1286
|
+
}
|
|
1287
|
+
function errMsg(src, dest, funcName) {
|
|
1288
|
+
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
1289
|
+
}
|
|
1290
|
+
module.exports = {
|
|
1291
|
+
checkPaths: u2(checkPaths),
|
|
1292
|
+
checkPathsSync,
|
|
1293
|
+
checkParentPaths: u2(checkParentPaths),
|
|
1294
|
+
checkParentPathsSync,
|
|
1295
|
+
isSrcSubdir,
|
|
1296
|
+
areIdentical
|
|
1297
|
+
};
|
|
1298
|
+
});
|
|
1299
|
+
|
|
1300
|
+
// node_modules/fs-extra/lib/util/async.js
|
|
1301
|
+
var require_async = __commonJS((exports, module) => {
|
|
1302
|
+
async function asyncIteratorConcurrentProcess(iterator, fn) {
|
|
1303
|
+
const promises = [];
|
|
1304
|
+
for await (const item of iterator) {
|
|
1305
|
+
promises.push(fn(item).then(() => null, (err) => err ?? new Error("unknown error")));
|
|
1306
|
+
}
|
|
1307
|
+
await Promise.all(promises.map((promise) => promise.then((possibleErr) => {
|
|
1308
|
+
if (possibleErr !== null)
|
|
1309
|
+
throw possibleErr;
|
|
1310
|
+
})));
|
|
1311
|
+
}
|
|
1312
|
+
module.exports = {
|
|
1313
|
+
asyncIteratorConcurrentProcess
|
|
1314
|
+
};
|
|
1315
|
+
});
|
|
1316
|
+
|
|
1317
|
+
// node_modules/fs-extra/lib/copy/copy.js
|
|
1318
|
+
var require_copy = __commonJS((exports, module) => {
|
|
1319
|
+
var fs = require_fs();
|
|
1320
|
+
var path = __require("path");
|
|
1321
|
+
var { mkdirs } = require_mkdirs();
|
|
1322
|
+
var { pathExists } = require_path_exists();
|
|
1323
|
+
var { utimesMillis } = require_utimes();
|
|
1324
|
+
var stat = require_stat();
|
|
1325
|
+
var { asyncIteratorConcurrentProcess } = require_async();
|
|
1326
|
+
async function copy(src, dest, opts = {}) {
|
|
1327
|
+
if (typeof opts === "function") {
|
|
1328
|
+
opts = { filter: opts };
|
|
1329
|
+
}
|
|
1330
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1331
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1332
|
+
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1333
|
+
process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
1334
|
+
|
|
1335
|
+
` + "\tsee https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0001");
|
|
1336
|
+
}
|
|
1337
|
+
const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
|
|
1338
|
+
await stat.checkParentPaths(src, srcStat, dest, "copy");
|
|
1339
|
+
const include = await runFilter(src, dest, opts);
|
|
1340
|
+
if (!include)
|
|
1341
|
+
return;
|
|
1342
|
+
const destParent = path.dirname(dest);
|
|
1343
|
+
const dirExists = await pathExists(destParent);
|
|
1344
|
+
if (!dirExists) {
|
|
1345
|
+
await mkdirs(destParent);
|
|
1346
|
+
}
|
|
1347
|
+
await getStatsAndPerformCopy(destStat, src, dest, opts);
|
|
1348
|
+
}
|
|
1349
|
+
async function runFilter(src, dest, opts) {
|
|
1350
|
+
if (!opts.filter)
|
|
1351
|
+
return true;
|
|
1352
|
+
return opts.filter(src, dest);
|
|
1353
|
+
}
|
|
1354
|
+
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
1355
|
+
const statFn = opts.dereference ? fs.stat : fs.lstat;
|
|
1356
|
+
const srcStat = await statFn(src);
|
|
1357
|
+
if (srcStat.isDirectory())
|
|
1358
|
+
return onDir(srcStat, destStat, src, dest, opts);
|
|
1359
|
+
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
|
|
1360
|
+
return onFile(srcStat, destStat, src, dest, opts);
|
|
1361
|
+
if (srcStat.isSymbolicLink())
|
|
1362
|
+
return onLink(destStat, src, dest, opts);
|
|
1363
|
+
if (srcStat.isSocket())
|
|
1364
|
+
throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1365
|
+
if (srcStat.isFIFO())
|
|
1366
|
+
throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1367
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1368
|
+
}
|
|
1369
|
+
async function onFile(srcStat, destStat, src, dest, opts) {
|
|
1370
|
+
if (!destStat)
|
|
1371
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1372
|
+
if (opts.overwrite) {
|
|
1373
|
+
await fs.unlink(dest);
|
|
1374
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1375
|
+
}
|
|
1376
|
+
if (opts.errorOnExist) {
|
|
1377
|
+
throw new Error(`'${dest}' already exists`);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
async function copyFile(srcStat, src, dest, opts) {
|
|
1381
|
+
await fs.copyFile(src, dest);
|
|
1382
|
+
if (opts.preserveTimestamps) {
|
|
1383
|
+
if (fileIsNotWritable(srcStat.mode)) {
|
|
1384
|
+
await makeFileWritable(dest, srcStat.mode);
|
|
1385
|
+
}
|
|
1386
|
+
const updatedSrcStat = await fs.stat(src);
|
|
1387
|
+
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1388
|
+
}
|
|
1389
|
+
return fs.chmod(dest, srcStat.mode);
|
|
1390
|
+
}
|
|
1391
|
+
function fileIsNotWritable(srcMode) {
|
|
1392
|
+
return (srcMode & 128) === 0;
|
|
1393
|
+
}
|
|
1394
|
+
function makeFileWritable(dest, srcMode) {
|
|
1395
|
+
return fs.chmod(dest, srcMode | 128);
|
|
1396
|
+
}
|
|
1397
|
+
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
1398
|
+
if (!destStat) {
|
|
1399
|
+
await fs.mkdir(dest);
|
|
1400
|
+
}
|
|
1401
|
+
await asyncIteratorConcurrentProcess(await fs.opendir(src), async (item) => {
|
|
1402
|
+
const srcItem = path.join(src, item.name);
|
|
1403
|
+
const destItem = path.join(dest, item.name);
|
|
1404
|
+
const include = await runFilter(srcItem, destItem, opts);
|
|
1405
|
+
if (include) {
|
|
1406
|
+
const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
1407
|
+
await getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
if (!destStat) {
|
|
1411
|
+
await fs.chmod(dest, srcStat.mode);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
async function onLink(destStat, src, dest, opts) {
|
|
1415
|
+
let resolvedSrc = await fs.readlink(src);
|
|
1416
|
+
if (opts.dereference) {
|
|
1417
|
+
resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
|
|
1418
|
+
}
|
|
1419
|
+
if (!destStat) {
|
|
1420
|
+
return fs.symlink(resolvedSrc, dest);
|
|
1421
|
+
}
|
|
1422
|
+
let resolvedDest = null;
|
|
1423
|
+
try {
|
|
1424
|
+
resolvedDest = await fs.readlink(dest);
|
|
1425
|
+
} catch (e2) {
|
|
1426
|
+
if (e2.code === "EINVAL" || e2.code === "UNKNOWN")
|
|
1427
|
+
return fs.symlink(resolvedSrc, dest);
|
|
1428
|
+
throw e2;
|
|
1429
|
+
}
|
|
1430
|
+
if (opts.dereference) {
|
|
1431
|
+
resolvedDest = path.resolve(process.cwd(), resolvedDest);
|
|
1432
|
+
}
|
|
1433
|
+
if (resolvedSrc !== resolvedDest) {
|
|
1434
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1435
|
+
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1436
|
+
}
|
|
1437
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1438
|
+
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
await fs.unlink(dest);
|
|
1442
|
+
return fs.symlink(resolvedSrc, dest);
|
|
1443
|
+
}
|
|
1444
|
+
module.exports = copy;
|
|
1445
|
+
});
|
|
1446
|
+
|
|
1447
|
+
// node_modules/fs-extra/lib/copy/copy-sync.js
|
|
1448
|
+
var require_copy_sync = __commonJS((exports, module) => {
|
|
1449
|
+
var fs = require_graceful_fs();
|
|
1450
|
+
var path = __require("path");
|
|
1451
|
+
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
1452
|
+
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
1453
|
+
var stat = require_stat();
|
|
1454
|
+
function copySync(src, dest, opts) {
|
|
1455
|
+
if (typeof opts === "function") {
|
|
1456
|
+
opts = { filter: opts };
|
|
1457
|
+
}
|
|
1458
|
+
opts = opts || {};
|
|
1459
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1460
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1461
|
+
if (opts.preserveTimestamps && process.arch === "ia32") {
|
|
1462
|
+
process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
1463
|
+
|
|
1464
|
+
` + "\tsee https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0002");
|
|
1465
|
+
}
|
|
1466
|
+
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
1467
|
+
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
1468
|
+
if (opts.filter && !opts.filter(src, dest))
|
|
1469
|
+
return;
|
|
1470
|
+
const destParent = path.dirname(dest);
|
|
1471
|
+
if (!fs.existsSync(destParent))
|
|
1472
|
+
mkdirsSync(destParent);
|
|
1473
|
+
return getStats(destStat, src, dest, opts);
|
|
1474
|
+
}
|
|
1475
|
+
function getStats(destStat, src, dest, opts) {
|
|
1476
|
+
const statSync = opts.dereference ? fs.statSync : fs.lstatSync;
|
|
1477
|
+
const srcStat = statSync(src);
|
|
1478
|
+
if (srcStat.isDirectory())
|
|
1479
|
+
return onDir(srcStat, destStat, src, dest, opts);
|
|
1480
|
+
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
|
|
1481
|
+
return onFile(srcStat, destStat, src, dest, opts);
|
|
1482
|
+
else if (srcStat.isSymbolicLink())
|
|
1483
|
+
return onLink(destStat, src, dest, opts);
|
|
1484
|
+
else if (srcStat.isSocket())
|
|
1485
|
+
throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1486
|
+
else if (srcStat.isFIFO())
|
|
1487
|
+
throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1488
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1489
|
+
}
|
|
1490
|
+
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1491
|
+
if (!destStat)
|
|
1492
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1493
|
+
return mayCopyFile(srcStat, src, dest, opts);
|
|
1494
|
+
}
|
|
1495
|
+
function mayCopyFile(srcStat, src, dest, opts) {
|
|
1496
|
+
if (opts.overwrite) {
|
|
1497
|
+
fs.unlinkSync(dest);
|
|
1498
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1499
|
+
} else if (opts.errorOnExist) {
|
|
1500
|
+
throw new Error(`'${dest}' already exists`);
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
function copyFile(srcStat, src, dest, opts) {
|
|
1504
|
+
fs.copyFileSync(src, dest);
|
|
1505
|
+
if (opts.preserveTimestamps)
|
|
1506
|
+
handleTimestamps(srcStat.mode, src, dest);
|
|
1507
|
+
return setDestMode(dest, srcStat.mode);
|
|
1508
|
+
}
|
|
1509
|
+
function handleTimestamps(srcMode, src, dest) {
|
|
1510
|
+
if (fileIsNotWritable(srcMode))
|
|
1511
|
+
makeFileWritable(dest, srcMode);
|
|
1512
|
+
return setDestTimestamps(src, dest);
|
|
1513
|
+
}
|
|
1514
|
+
function fileIsNotWritable(srcMode) {
|
|
1515
|
+
return (srcMode & 128) === 0;
|
|
1516
|
+
}
|
|
1517
|
+
function makeFileWritable(dest, srcMode) {
|
|
1518
|
+
return setDestMode(dest, srcMode | 128);
|
|
1519
|
+
}
|
|
1520
|
+
function setDestMode(dest, srcMode) {
|
|
1521
|
+
return fs.chmodSync(dest, srcMode);
|
|
1522
|
+
}
|
|
1523
|
+
function setDestTimestamps(src, dest) {
|
|
1524
|
+
const updatedSrcStat = fs.statSync(src);
|
|
1525
|
+
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1526
|
+
}
|
|
1527
|
+
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1528
|
+
if (!destStat)
|
|
1529
|
+
return mkDirAndCopy(srcStat.mode, src, dest, opts);
|
|
1530
|
+
return copyDir(src, dest, opts);
|
|
1531
|
+
}
|
|
1532
|
+
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
1533
|
+
fs.mkdirSync(dest);
|
|
1534
|
+
copyDir(src, dest, opts);
|
|
1535
|
+
return setDestMode(dest, srcMode);
|
|
1536
|
+
}
|
|
1537
|
+
function copyDir(src, dest, opts) {
|
|
1538
|
+
const dir = fs.opendirSync(src);
|
|
1539
|
+
try {
|
|
1540
|
+
let dirent;
|
|
1541
|
+
while ((dirent = dir.readSync()) !== null) {
|
|
1542
|
+
copyDirItem(dirent.name, src, dest, opts);
|
|
1543
|
+
}
|
|
1544
|
+
} finally {
|
|
1545
|
+
dir.closeSync();
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
function copyDirItem(item, src, dest, opts) {
|
|
1549
|
+
const srcItem = path.join(src, item);
|
|
1550
|
+
const destItem = path.join(dest, item);
|
|
1551
|
+
if (opts.filter && !opts.filter(srcItem, destItem))
|
|
1552
|
+
return;
|
|
1553
|
+
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
1554
|
+
return getStats(destStat, srcItem, destItem, opts);
|
|
1555
|
+
}
|
|
1556
|
+
function onLink(destStat, src, dest, opts) {
|
|
1557
|
+
let resolvedSrc = fs.readlinkSync(src);
|
|
1558
|
+
if (opts.dereference) {
|
|
1559
|
+
resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
|
|
1560
|
+
}
|
|
1561
|
+
if (!destStat) {
|
|
1562
|
+
return fs.symlinkSync(resolvedSrc, dest);
|
|
1563
|
+
} else {
|
|
1564
|
+
let resolvedDest;
|
|
1565
|
+
try {
|
|
1566
|
+
resolvedDest = fs.readlinkSync(dest);
|
|
1567
|
+
} catch (err) {
|
|
1568
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN")
|
|
1569
|
+
return fs.symlinkSync(resolvedSrc, dest);
|
|
1570
|
+
throw err;
|
|
1571
|
+
}
|
|
1572
|
+
if (opts.dereference) {
|
|
1573
|
+
resolvedDest = path.resolve(process.cwd(), resolvedDest);
|
|
1574
|
+
}
|
|
1575
|
+
if (resolvedSrc !== resolvedDest) {
|
|
1576
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
1577
|
+
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1578
|
+
}
|
|
1579
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
1580
|
+
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
return copyLink(resolvedSrc, dest);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
function copyLink(resolvedSrc, dest) {
|
|
1587
|
+
fs.unlinkSync(dest);
|
|
1588
|
+
return fs.symlinkSync(resolvedSrc, dest);
|
|
1589
|
+
}
|
|
1590
|
+
module.exports = copySync;
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
// node_modules/fs-extra/lib/copy/index.js
|
|
1594
|
+
var require_copy2 = __commonJS((exports, module) => {
|
|
1595
|
+
var u2 = require_universalify().fromPromise;
|
|
1596
|
+
module.exports = {
|
|
1597
|
+
copy: u2(require_copy()),
|
|
1598
|
+
copySync: require_copy_sync()
|
|
1599
|
+
};
|
|
1600
|
+
});
|
|
1601
|
+
|
|
1602
|
+
// node_modules/fs-extra/lib/remove/index.js
|
|
1603
|
+
var require_remove = __commonJS((exports, module) => {
|
|
1604
|
+
var fs = require_graceful_fs();
|
|
1605
|
+
var u2 = require_universalify().fromCallback;
|
|
1606
|
+
function remove(path, callback) {
|
|
1607
|
+
fs.rm(path, { recursive: true, force: true }, callback);
|
|
1608
|
+
}
|
|
1609
|
+
function removeSync(path) {
|
|
1610
|
+
fs.rmSync(path, { recursive: true, force: true });
|
|
1611
|
+
}
|
|
1612
|
+
module.exports = {
|
|
1613
|
+
remove: u2(remove),
|
|
1614
|
+
removeSync
|
|
1615
|
+
};
|
|
1616
|
+
});
|
|
1617
|
+
|
|
1618
|
+
// node_modules/fs-extra/lib/empty/index.js
|
|
1619
|
+
var require_empty = __commonJS((exports, module) => {
|
|
1620
|
+
var u2 = require_universalify().fromPromise;
|
|
1621
|
+
var fs = require_fs();
|
|
1622
|
+
var path = __require("path");
|
|
1623
|
+
var mkdir = require_mkdirs();
|
|
1624
|
+
var remove = require_remove();
|
|
1625
|
+
var emptyDir = u2(async function emptyDir(dir) {
|
|
1626
|
+
let items;
|
|
1627
|
+
try {
|
|
1628
|
+
items = await fs.readdir(dir);
|
|
1629
|
+
} catch {
|
|
1630
|
+
return mkdir.mkdirs(dir);
|
|
1631
|
+
}
|
|
1632
|
+
return Promise.all(items.map((item) => remove.remove(path.join(dir, item))));
|
|
1633
|
+
});
|
|
1634
|
+
function emptyDirSync(dir) {
|
|
1635
|
+
let items;
|
|
1636
|
+
try {
|
|
1637
|
+
items = fs.readdirSync(dir);
|
|
1638
|
+
} catch {
|
|
1639
|
+
return mkdir.mkdirsSync(dir);
|
|
1640
|
+
}
|
|
1641
|
+
items.forEach((item) => {
|
|
1642
|
+
item = path.join(dir, item);
|
|
1643
|
+
remove.removeSync(item);
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
module.exports = {
|
|
1647
|
+
emptyDirSync,
|
|
1648
|
+
emptydirSync: emptyDirSync,
|
|
1649
|
+
emptyDir,
|
|
1650
|
+
emptydir: emptyDir
|
|
1651
|
+
};
|
|
1652
|
+
});
|
|
1653
|
+
|
|
1654
|
+
// node_modules/fs-extra/lib/ensure/file.js
|
|
1655
|
+
var require_file = __commonJS((exports, module) => {
|
|
1656
|
+
var u2 = require_universalify().fromPromise;
|
|
1657
|
+
var path = __require("path");
|
|
1658
|
+
var fs = require_fs();
|
|
1659
|
+
var mkdir = require_mkdirs();
|
|
1660
|
+
async function createFile(file) {
|
|
1661
|
+
let stats;
|
|
1662
|
+
try {
|
|
1663
|
+
stats = await fs.stat(file);
|
|
1664
|
+
} catch {}
|
|
1665
|
+
if (stats && stats.isFile())
|
|
1666
|
+
return;
|
|
1667
|
+
const dir = path.dirname(file);
|
|
1668
|
+
let dirStats = null;
|
|
1669
|
+
try {
|
|
1670
|
+
dirStats = await fs.stat(dir);
|
|
1671
|
+
} catch (err) {
|
|
1672
|
+
if (err.code === "ENOENT") {
|
|
1673
|
+
await mkdir.mkdirs(dir);
|
|
1674
|
+
await fs.writeFile(file, "");
|
|
1675
|
+
return;
|
|
1676
|
+
} else {
|
|
1677
|
+
throw err;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
if (dirStats.isDirectory()) {
|
|
1681
|
+
await fs.writeFile(file, "");
|
|
1682
|
+
} else {
|
|
1683
|
+
await fs.readdir(dir);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
function createFileSync(file) {
|
|
1687
|
+
let stats;
|
|
1688
|
+
try {
|
|
1689
|
+
stats = fs.statSync(file);
|
|
1690
|
+
} catch {}
|
|
1691
|
+
if (stats && stats.isFile())
|
|
1692
|
+
return;
|
|
1693
|
+
const dir = path.dirname(file);
|
|
1694
|
+
try {
|
|
1695
|
+
if (!fs.statSync(dir).isDirectory()) {
|
|
1696
|
+
fs.readdirSync(dir);
|
|
1697
|
+
}
|
|
1698
|
+
} catch (err) {
|
|
1699
|
+
if (err && err.code === "ENOENT")
|
|
1700
|
+
mkdir.mkdirsSync(dir);
|
|
1701
|
+
else
|
|
1702
|
+
throw err;
|
|
1703
|
+
}
|
|
1704
|
+
fs.writeFileSync(file, "");
|
|
1705
|
+
}
|
|
1706
|
+
module.exports = {
|
|
1707
|
+
createFile: u2(createFile),
|
|
1708
|
+
createFileSync
|
|
1709
|
+
};
|
|
1710
|
+
});
|
|
1711
|
+
|
|
1712
|
+
// node_modules/fs-extra/lib/ensure/link.js
|
|
1713
|
+
var require_link = __commonJS((exports, module) => {
|
|
1714
|
+
var u2 = require_universalify().fromPromise;
|
|
1715
|
+
var path = __require("path");
|
|
1716
|
+
var fs = require_fs();
|
|
1717
|
+
var mkdir = require_mkdirs();
|
|
1718
|
+
var { pathExists } = require_path_exists();
|
|
1719
|
+
var { areIdentical } = require_stat();
|
|
1720
|
+
async function createLink(srcpath, dstpath) {
|
|
1721
|
+
let dstStat;
|
|
1722
|
+
try {
|
|
1723
|
+
dstStat = await fs.lstat(dstpath);
|
|
1724
|
+
} catch {}
|
|
1725
|
+
let srcStat;
|
|
1726
|
+
try {
|
|
1727
|
+
srcStat = await fs.lstat(srcpath);
|
|
1728
|
+
} catch (err) {
|
|
1729
|
+
err.message = err.message.replace("lstat", "ensureLink");
|
|
1730
|
+
throw err;
|
|
1731
|
+
}
|
|
1732
|
+
if (dstStat && areIdentical(srcStat, dstStat))
|
|
1733
|
+
return;
|
|
1734
|
+
const dir = path.dirname(dstpath);
|
|
1735
|
+
const dirExists = await pathExists(dir);
|
|
1736
|
+
if (!dirExists) {
|
|
1737
|
+
await mkdir.mkdirs(dir);
|
|
1738
|
+
}
|
|
1739
|
+
await fs.link(srcpath, dstpath);
|
|
1740
|
+
}
|
|
1741
|
+
function createLinkSync(srcpath, dstpath) {
|
|
1742
|
+
let dstStat;
|
|
1743
|
+
try {
|
|
1744
|
+
dstStat = fs.lstatSync(dstpath);
|
|
1745
|
+
} catch {}
|
|
1746
|
+
try {
|
|
1747
|
+
const srcStat = fs.lstatSync(srcpath);
|
|
1748
|
+
if (dstStat && areIdentical(srcStat, dstStat))
|
|
1749
|
+
return;
|
|
1750
|
+
} catch (err) {
|
|
1751
|
+
err.message = err.message.replace("lstat", "ensureLink");
|
|
1752
|
+
throw err;
|
|
1753
|
+
}
|
|
1754
|
+
const dir = path.dirname(dstpath);
|
|
1755
|
+
const dirExists = fs.existsSync(dir);
|
|
1756
|
+
if (dirExists)
|
|
1757
|
+
return fs.linkSync(srcpath, dstpath);
|
|
1758
|
+
mkdir.mkdirsSync(dir);
|
|
1759
|
+
return fs.linkSync(srcpath, dstpath);
|
|
1760
|
+
}
|
|
1761
|
+
module.exports = {
|
|
1762
|
+
createLink: u2(createLink),
|
|
1763
|
+
createLinkSync
|
|
1764
|
+
};
|
|
1765
|
+
});
|
|
1766
|
+
|
|
1767
|
+
// node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
1768
|
+
var require_symlink_paths = __commonJS((exports, module) => {
|
|
1769
|
+
var path = __require("path");
|
|
1770
|
+
var fs = require_fs();
|
|
1771
|
+
var { pathExists } = require_path_exists();
|
|
1772
|
+
var u2 = require_universalify().fromPromise;
|
|
1773
|
+
async function symlinkPaths(srcpath, dstpath) {
|
|
1774
|
+
if (path.isAbsolute(srcpath)) {
|
|
1775
|
+
try {
|
|
1776
|
+
await fs.lstat(srcpath);
|
|
1777
|
+
} catch (err) {
|
|
1778
|
+
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1779
|
+
throw err;
|
|
1780
|
+
}
|
|
1781
|
+
return {
|
|
1782
|
+
toCwd: srcpath,
|
|
1783
|
+
toDst: srcpath
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
const dstdir = path.dirname(dstpath);
|
|
1787
|
+
const relativeToDst = path.join(dstdir, srcpath);
|
|
1788
|
+
const exists = await pathExists(relativeToDst);
|
|
1789
|
+
if (exists) {
|
|
1790
|
+
return {
|
|
1791
|
+
toCwd: relativeToDst,
|
|
1792
|
+
toDst: srcpath
|
|
1793
|
+
};
|
|
1794
|
+
}
|
|
1795
|
+
try {
|
|
1796
|
+
await fs.lstat(srcpath);
|
|
1797
|
+
} catch (err) {
|
|
1798
|
+
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1799
|
+
throw err;
|
|
1800
|
+
}
|
|
1801
|
+
return {
|
|
1802
|
+
toCwd: srcpath,
|
|
1803
|
+
toDst: path.relative(dstdir, srcpath)
|
|
1804
|
+
};
|
|
1805
|
+
}
|
|
1806
|
+
function symlinkPathsSync(srcpath, dstpath) {
|
|
1807
|
+
if (path.isAbsolute(srcpath)) {
|
|
1808
|
+
const exists2 = fs.existsSync(srcpath);
|
|
1809
|
+
if (!exists2)
|
|
1810
|
+
throw new Error("absolute srcpath does not exist");
|
|
1811
|
+
return {
|
|
1812
|
+
toCwd: srcpath,
|
|
1813
|
+
toDst: srcpath
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
const dstdir = path.dirname(dstpath);
|
|
1817
|
+
const relativeToDst = path.join(dstdir, srcpath);
|
|
1818
|
+
const exists = fs.existsSync(relativeToDst);
|
|
1819
|
+
if (exists) {
|
|
1820
|
+
return {
|
|
1821
|
+
toCwd: relativeToDst,
|
|
1822
|
+
toDst: srcpath
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
const srcExists = fs.existsSync(srcpath);
|
|
1826
|
+
if (!srcExists)
|
|
1827
|
+
throw new Error("relative srcpath does not exist");
|
|
1828
|
+
return {
|
|
1829
|
+
toCwd: srcpath,
|
|
1830
|
+
toDst: path.relative(dstdir, srcpath)
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
module.exports = {
|
|
1834
|
+
symlinkPaths: u2(symlinkPaths),
|
|
1835
|
+
symlinkPathsSync
|
|
1836
|
+
};
|
|
1837
|
+
});
|
|
1838
|
+
|
|
1839
|
+
// node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
1840
|
+
var require_symlink_type = __commonJS((exports, module) => {
|
|
1841
|
+
var fs = require_fs();
|
|
1842
|
+
var u2 = require_universalify().fromPromise;
|
|
1843
|
+
async function symlinkType(srcpath, type) {
|
|
1844
|
+
if (type)
|
|
1845
|
+
return type;
|
|
1846
|
+
let stats;
|
|
1847
|
+
try {
|
|
1848
|
+
stats = await fs.lstat(srcpath);
|
|
1849
|
+
} catch {
|
|
1850
|
+
return "file";
|
|
1851
|
+
}
|
|
1852
|
+
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1853
|
+
}
|
|
1854
|
+
function symlinkTypeSync(srcpath, type) {
|
|
1855
|
+
if (type)
|
|
1856
|
+
return type;
|
|
1857
|
+
let stats;
|
|
1858
|
+
try {
|
|
1859
|
+
stats = fs.lstatSync(srcpath);
|
|
1860
|
+
} catch {
|
|
1861
|
+
return "file";
|
|
1862
|
+
}
|
|
1863
|
+
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1864
|
+
}
|
|
1865
|
+
module.exports = {
|
|
1866
|
+
symlinkType: u2(symlinkType),
|
|
1867
|
+
symlinkTypeSync
|
|
1868
|
+
};
|
|
1869
|
+
});
|
|
1870
|
+
|
|
1871
|
+
// node_modules/fs-extra/lib/ensure/symlink.js
|
|
1872
|
+
var require_symlink = __commonJS((exports, module) => {
|
|
1873
|
+
var u2 = require_universalify().fromPromise;
|
|
1874
|
+
var path = __require("path");
|
|
1875
|
+
var fs = require_fs();
|
|
1876
|
+
var { mkdirs, mkdirsSync } = require_mkdirs();
|
|
1877
|
+
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
1878
|
+
var { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
1879
|
+
var { pathExists } = require_path_exists();
|
|
1880
|
+
var { areIdentical } = require_stat();
|
|
1881
|
+
async function createSymlink(srcpath, dstpath, type) {
|
|
1882
|
+
let stats;
|
|
1883
|
+
try {
|
|
1884
|
+
stats = await fs.lstat(dstpath);
|
|
1885
|
+
} catch {}
|
|
1886
|
+
if (stats && stats.isSymbolicLink()) {
|
|
1887
|
+
const [srcStat, dstStat] = await Promise.all([
|
|
1888
|
+
fs.stat(srcpath),
|
|
1889
|
+
fs.stat(dstpath)
|
|
1890
|
+
]);
|
|
1891
|
+
if (areIdentical(srcStat, dstStat))
|
|
1892
|
+
return;
|
|
1893
|
+
}
|
|
1894
|
+
const relative = await symlinkPaths(srcpath, dstpath);
|
|
1895
|
+
srcpath = relative.toDst;
|
|
1896
|
+
const toType = await symlinkType(relative.toCwd, type);
|
|
1897
|
+
const dir = path.dirname(dstpath);
|
|
1898
|
+
if (!await pathExists(dir)) {
|
|
1899
|
+
await mkdirs(dir);
|
|
1900
|
+
}
|
|
1901
|
+
return fs.symlink(srcpath, dstpath, toType);
|
|
1902
|
+
}
|
|
1903
|
+
function createSymlinkSync(srcpath, dstpath, type) {
|
|
1904
|
+
let stats;
|
|
1905
|
+
try {
|
|
1906
|
+
stats = fs.lstatSync(dstpath);
|
|
1907
|
+
} catch {}
|
|
1908
|
+
if (stats && stats.isSymbolicLink()) {
|
|
1909
|
+
const srcStat = fs.statSync(srcpath);
|
|
1910
|
+
const dstStat = fs.statSync(dstpath);
|
|
1911
|
+
if (areIdentical(srcStat, dstStat))
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
1915
|
+
srcpath = relative.toDst;
|
|
1916
|
+
type = symlinkTypeSync(relative.toCwd, type);
|
|
1917
|
+
const dir = path.dirname(dstpath);
|
|
1918
|
+
const exists = fs.existsSync(dir);
|
|
1919
|
+
if (exists)
|
|
1920
|
+
return fs.symlinkSync(srcpath, dstpath, type);
|
|
1921
|
+
mkdirsSync(dir);
|
|
1922
|
+
return fs.symlinkSync(srcpath, dstpath, type);
|
|
1923
|
+
}
|
|
1924
|
+
module.exports = {
|
|
1925
|
+
createSymlink: u2(createSymlink),
|
|
1926
|
+
createSymlinkSync
|
|
1927
|
+
};
|
|
1928
|
+
});
|
|
1929
|
+
|
|
1930
|
+
// node_modules/fs-extra/lib/ensure/index.js
|
|
1931
|
+
var require_ensure = __commonJS((exports, module) => {
|
|
1932
|
+
var { createFile, createFileSync } = require_file();
|
|
1933
|
+
var { createLink, createLinkSync } = require_link();
|
|
1934
|
+
var { createSymlink, createSymlinkSync } = require_symlink();
|
|
1935
|
+
module.exports = {
|
|
1936
|
+
createFile,
|
|
1937
|
+
createFileSync,
|
|
1938
|
+
ensureFile: createFile,
|
|
1939
|
+
ensureFileSync: createFileSync,
|
|
1940
|
+
createLink,
|
|
1941
|
+
createLinkSync,
|
|
1942
|
+
ensureLink: createLink,
|
|
1943
|
+
ensureLinkSync: createLinkSync,
|
|
1944
|
+
createSymlink,
|
|
1945
|
+
createSymlinkSync,
|
|
1946
|
+
ensureSymlink: createSymlink,
|
|
1947
|
+
ensureSymlinkSync: createSymlinkSync
|
|
1948
|
+
};
|
|
1949
|
+
});
|
|
1950
|
+
|
|
1951
|
+
// node_modules/jsonfile/utils.js
|
|
1952
|
+
var require_utils2 = __commonJS((exports, module) => {
|
|
1953
|
+
function stringify(obj, { EOL = `
|
|
1954
|
+
`, finalEOL = true, replacer = null, spaces } = {}) {
|
|
1955
|
+
const EOF = finalEOL ? EOL : "";
|
|
1956
|
+
const str = JSON.stringify(obj, replacer, spaces);
|
|
1957
|
+
return str.replace(/\n/g, EOL) + EOF;
|
|
1958
|
+
}
|
|
1959
|
+
function stripBom(content) {
|
|
1960
|
+
if (Buffer.isBuffer(content))
|
|
1961
|
+
content = content.toString("utf8");
|
|
1962
|
+
return content.replace(/^\uFEFF/, "");
|
|
1963
|
+
}
|
|
1964
|
+
module.exports = { stringify, stripBom };
|
|
1965
|
+
});
|
|
1966
|
+
|
|
1967
|
+
// node_modules/jsonfile/index.js
|
|
1968
|
+
var require_jsonfile = __commonJS((exports, module) => {
|
|
1969
|
+
var _fs;
|
|
1970
|
+
try {
|
|
1971
|
+
_fs = require_graceful_fs();
|
|
1972
|
+
} catch (_3) {
|
|
1973
|
+
_fs = __require("fs");
|
|
1974
|
+
}
|
|
1975
|
+
var universalify = require_universalify();
|
|
1976
|
+
var { stringify, stripBom } = require_utils2();
|
|
1977
|
+
async function _readFile(file, options = {}) {
|
|
1978
|
+
if (typeof options === "string") {
|
|
1979
|
+
options = { encoding: options };
|
|
1980
|
+
}
|
|
1981
|
+
const fs = options.fs || _fs;
|
|
1982
|
+
const shouldThrow = "throws" in options ? options.throws : true;
|
|
1983
|
+
let data = await universalify.fromCallback(fs.readFile)(file, options);
|
|
1984
|
+
data = stripBom(data);
|
|
1985
|
+
let obj;
|
|
1986
|
+
try {
|
|
1987
|
+
obj = JSON.parse(data, options ? options.reviver : null);
|
|
1988
|
+
} catch (err) {
|
|
1989
|
+
if (shouldThrow) {
|
|
1990
|
+
err.message = `${file}: ${err.message}`;
|
|
1991
|
+
throw err;
|
|
1992
|
+
} else {
|
|
1993
|
+
return null;
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
return obj;
|
|
1997
|
+
}
|
|
1998
|
+
var readFile = universalify.fromPromise(_readFile);
|
|
1999
|
+
function readFileSync(file, options = {}) {
|
|
2000
|
+
if (typeof options === "string") {
|
|
2001
|
+
options = { encoding: options };
|
|
2002
|
+
}
|
|
2003
|
+
const fs = options.fs || _fs;
|
|
2004
|
+
const shouldThrow = "throws" in options ? options.throws : true;
|
|
2005
|
+
try {
|
|
2006
|
+
let content = fs.readFileSync(file, options);
|
|
2007
|
+
content = stripBom(content);
|
|
2008
|
+
return JSON.parse(content, options.reviver);
|
|
2009
|
+
} catch (err) {
|
|
2010
|
+
if (shouldThrow) {
|
|
2011
|
+
err.message = `${file}: ${err.message}`;
|
|
2012
|
+
throw err;
|
|
2013
|
+
} else {
|
|
2014
|
+
return null;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
async function _writeFile(file, obj, options = {}) {
|
|
2019
|
+
const fs = options.fs || _fs;
|
|
2020
|
+
const str = stringify(obj, options);
|
|
2021
|
+
await universalify.fromCallback(fs.writeFile)(file, str, options);
|
|
2022
|
+
}
|
|
2023
|
+
var writeFile = universalify.fromPromise(_writeFile);
|
|
2024
|
+
function writeFileSync(file, obj, options = {}) {
|
|
2025
|
+
const fs = options.fs || _fs;
|
|
2026
|
+
const str = stringify(obj, options);
|
|
2027
|
+
return fs.writeFileSync(file, str, options);
|
|
2028
|
+
}
|
|
2029
|
+
module.exports = {
|
|
2030
|
+
readFile,
|
|
2031
|
+
readFileSync,
|
|
2032
|
+
writeFile,
|
|
2033
|
+
writeFileSync
|
|
2034
|
+
};
|
|
2035
|
+
});
|
|
2036
|
+
|
|
2037
|
+
// node_modules/fs-extra/lib/json/jsonfile.js
|
|
2038
|
+
var require_jsonfile2 = __commonJS((exports, module) => {
|
|
2039
|
+
var jsonFile = require_jsonfile();
|
|
2040
|
+
module.exports = {
|
|
2041
|
+
readJson: jsonFile.readFile,
|
|
2042
|
+
readJsonSync: jsonFile.readFileSync,
|
|
2043
|
+
writeJson: jsonFile.writeFile,
|
|
2044
|
+
writeJsonSync: jsonFile.writeFileSync
|
|
2045
|
+
};
|
|
2046
|
+
});
|
|
2047
|
+
|
|
2048
|
+
// node_modules/fs-extra/lib/output-file/index.js
|
|
2049
|
+
var require_output_file = __commonJS((exports, module) => {
|
|
2050
|
+
var u2 = require_universalify().fromPromise;
|
|
2051
|
+
var fs = require_fs();
|
|
2052
|
+
var path = __require("path");
|
|
2053
|
+
var mkdir = require_mkdirs();
|
|
2054
|
+
var pathExists = require_path_exists().pathExists;
|
|
2055
|
+
async function outputFile(file, data, encoding = "utf-8") {
|
|
2056
|
+
const dir = path.dirname(file);
|
|
2057
|
+
if (!await pathExists(dir)) {
|
|
2058
|
+
await mkdir.mkdirs(dir);
|
|
2059
|
+
}
|
|
2060
|
+
return fs.writeFile(file, data, encoding);
|
|
2061
|
+
}
|
|
2062
|
+
function outputFileSync(file, ...args) {
|
|
2063
|
+
const dir = path.dirname(file);
|
|
2064
|
+
if (!fs.existsSync(dir)) {
|
|
2065
|
+
mkdir.mkdirsSync(dir);
|
|
2066
|
+
}
|
|
2067
|
+
fs.writeFileSync(file, ...args);
|
|
2068
|
+
}
|
|
2069
|
+
module.exports = {
|
|
2070
|
+
outputFile: u2(outputFile),
|
|
2071
|
+
outputFileSync
|
|
2072
|
+
};
|
|
2073
|
+
});
|
|
2074
|
+
|
|
2075
|
+
// node_modules/fs-extra/lib/json/output-json.js
|
|
2076
|
+
var require_output_json = __commonJS((exports, module) => {
|
|
2077
|
+
var { stringify } = require_utils2();
|
|
2078
|
+
var { outputFile } = require_output_file();
|
|
2079
|
+
async function outputJson(file, data, options = {}) {
|
|
2080
|
+
const str = stringify(data, options);
|
|
2081
|
+
await outputFile(file, str, options);
|
|
2082
|
+
}
|
|
2083
|
+
module.exports = outputJson;
|
|
2084
|
+
});
|
|
2085
|
+
|
|
2086
|
+
// node_modules/fs-extra/lib/json/output-json-sync.js
|
|
2087
|
+
var require_output_json_sync = __commonJS((exports, module) => {
|
|
2088
|
+
var { stringify } = require_utils2();
|
|
2089
|
+
var { outputFileSync } = require_output_file();
|
|
2090
|
+
function outputJsonSync(file, data, options) {
|
|
2091
|
+
const str = stringify(data, options);
|
|
2092
|
+
outputFileSync(file, str, options);
|
|
2093
|
+
}
|
|
2094
|
+
module.exports = outputJsonSync;
|
|
2095
|
+
});
|
|
2096
|
+
|
|
2097
|
+
// node_modules/fs-extra/lib/json/index.js
|
|
2098
|
+
var require_json = __commonJS((exports, module) => {
|
|
2099
|
+
var u2 = require_universalify().fromPromise;
|
|
2100
|
+
var jsonFile = require_jsonfile2();
|
|
2101
|
+
jsonFile.outputJson = u2(require_output_json());
|
|
2102
|
+
jsonFile.outputJsonSync = require_output_json_sync();
|
|
2103
|
+
jsonFile.outputJSON = jsonFile.outputJson;
|
|
2104
|
+
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
|
|
2105
|
+
jsonFile.writeJSON = jsonFile.writeJson;
|
|
2106
|
+
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
|
|
2107
|
+
jsonFile.readJSON = jsonFile.readJson;
|
|
2108
|
+
jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
2109
|
+
module.exports = jsonFile;
|
|
2110
|
+
});
|
|
2111
|
+
|
|
2112
|
+
// node_modules/fs-extra/lib/move/move.js
|
|
2113
|
+
var require_move = __commonJS((exports, module) => {
|
|
2114
|
+
var fs = require_fs();
|
|
2115
|
+
var path = __require("path");
|
|
2116
|
+
var { copy } = require_copy2();
|
|
2117
|
+
var { remove } = require_remove();
|
|
2118
|
+
var { mkdirp } = require_mkdirs();
|
|
2119
|
+
var { pathExists } = require_path_exists();
|
|
2120
|
+
var stat = require_stat();
|
|
2121
|
+
async function move(src, dest, opts = {}) {
|
|
2122
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2123
|
+
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
|
|
2124
|
+
await stat.checkParentPaths(src, srcStat, dest, "move");
|
|
2125
|
+
const destParent = path.dirname(dest);
|
|
2126
|
+
const parsedParentPath = path.parse(destParent);
|
|
2127
|
+
if (parsedParentPath.root !== destParent) {
|
|
2128
|
+
await mkdirp(destParent);
|
|
2129
|
+
}
|
|
2130
|
+
return doRename(src, dest, overwrite, isChangingCase);
|
|
2131
|
+
}
|
|
2132
|
+
async function doRename(src, dest, overwrite, isChangingCase) {
|
|
2133
|
+
if (!isChangingCase) {
|
|
2134
|
+
if (overwrite) {
|
|
2135
|
+
await remove(dest);
|
|
2136
|
+
} else if (await pathExists(dest)) {
|
|
2137
|
+
throw new Error("dest already exists.");
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
try {
|
|
2141
|
+
await fs.rename(src, dest);
|
|
2142
|
+
} catch (err) {
|
|
2143
|
+
if (err.code !== "EXDEV") {
|
|
2144
|
+
throw err;
|
|
2145
|
+
}
|
|
2146
|
+
await moveAcrossDevice(src, dest, overwrite);
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
async function moveAcrossDevice(src, dest, overwrite) {
|
|
2150
|
+
const opts = {
|
|
2151
|
+
overwrite,
|
|
2152
|
+
errorOnExist: true,
|
|
2153
|
+
preserveTimestamps: true
|
|
2154
|
+
};
|
|
2155
|
+
await copy(src, dest, opts);
|
|
2156
|
+
return remove(src);
|
|
2157
|
+
}
|
|
2158
|
+
module.exports = move;
|
|
2159
|
+
});
|
|
2160
|
+
|
|
2161
|
+
// node_modules/fs-extra/lib/move/move-sync.js
|
|
2162
|
+
var require_move_sync = __commonJS((exports, module) => {
|
|
2163
|
+
var fs = require_graceful_fs();
|
|
2164
|
+
var path = __require("path");
|
|
2165
|
+
var copySync = require_copy2().copySync;
|
|
2166
|
+
var removeSync = require_remove().removeSync;
|
|
2167
|
+
var mkdirpSync = require_mkdirs().mkdirpSync;
|
|
2168
|
+
var stat = require_stat();
|
|
2169
|
+
function moveSync(src, dest, opts) {
|
|
2170
|
+
opts = opts || {};
|
|
2171
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
2172
|
+
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
2173
|
+
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
2174
|
+
if (!isParentRoot(dest))
|
|
2175
|
+
mkdirpSync(path.dirname(dest));
|
|
2176
|
+
return doRename(src, dest, overwrite, isChangingCase);
|
|
2177
|
+
}
|
|
2178
|
+
function isParentRoot(dest) {
|
|
2179
|
+
const parent = path.dirname(dest);
|
|
2180
|
+
const parsedPath = path.parse(parent);
|
|
2181
|
+
return parsedPath.root === parent;
|
|
2182
|
+
}
|
|
2183
|
+
function doRename(src, dest, overwrite, isChangingCase) {
|
|
2184
|
+
if (isChangingCase)
|
|
2185
|
+
return rename(src, dest, overwrite);
|
|
2186
|
+
if (overwrite) {
|
|
2187
|
+
removeSync(dest);
|
|
2188
|
+
return rename(src, dest, overwrite);
|
|
2189
|
+
}
|
|
2190
|
+
if (fs.existsSync(dest))
|
|
2191
|
+
throw new Error("dest already exists.");
|
|
2192
|
+
return rename(src, dest, overwrite);
|
|
2193
|
+
}
|
|
2194
|
+
function rename(src, dest, overwrite) {
|
|
2195
|
+
try {
|
|
2196
|
+
fs.renameSync(src, dest);
|
|
2197
|
+
} catch (err) {
|
|
2198
|
+
if (err.code !== "EXDEV")
|
|
2199
|
+
throw err;
|
|
2200
|
+
return moveAcrossDevice(src, dest, overwrite);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
function moveAcrossDevice(src, dest, overwrite) {
|
|
2204
|
+
const opts = {
|
|
2205
|
+
overwrite,
|
|
2206
|
+
errorOnExist: true,
|
|
2207
|
+
preserveTimestamps: true
|
|
2208
|
+
};
|
|
2209
|
+
copySync(src, dest, opts);
|
|
2210
|
+
return removeSync(src);
|
|
2211
|
+
}
|
|
2212
|
+
module.exports = moveSync;
|
|
2213
|
+
});
|
|
2214
|
+
|
|
2215
|
+
// node_modules/fs-extra/lib/move/index.js
|
|
2216
|
+
var require_move2 = __commonJS((exports, module) => {
|
|
2217
|
+
var u2 = require_universalify().fromPromise;
|
|
2218
|
+
module.exports = {
|
|
2219
|
+
move: u2(require_move()),
|
|
2220
|
+
moveSync: require_move_sync()
|
|
2221
|
+
};
|
|
2222
|
+
});
|
|
2223
|
+
|
|
2224
|
+
// node_modules/fs-extra/lib/index.js
|
|
2225
|
+
var require_lib = __commonJS((exports, module) => {
|
|
2226
|
+
module.exports = {
|
|
2227
|
+
...require_fs(),
|
|
2228
|
+
...require_copy2(),
|
|
2229
|
+
...require_empty(),
|
|
2230
|
+
...require_ensure(),
|
|
2231
|
+
...require_json(),
|
|
2232
|
+
...require_mkdirs(),
|
|
2233
|
+
...require_move2(),
|
|
2234
|
+
...require_output_file(),
|
|
2235
|
+
...require_path_exists(),
|
|
2236
|
+
...require_remove()
|
|
2237
|
+
};
|
|
2238
|
+
});
|
|
2239
|
+
|
|
2240
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
2241
|
+
import { stripVTControlCharacters as S2 } from "node:util";
|
|
2242
|
+
|
|
2243
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
2244
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
2245
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
2246
|
+
import { stdin as j, stdout as M } from "node:process";
|
|
2247
|
+
import * as g from "node:readline";
|
|
2248
|
+
import O from "node:readline";
|
|
2249
|
+
import { Writable as X } from "node:stream";
|
|
2250
|
+
function DD({ onlyFirst: e = false } = {}) {
|
|
2251
|
+
const t = ["[\\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("|");
|
|
2252
|
+
return new RegExp(t, e ? undefined : "g");
|
|
2253
|
+
}
|
|
2254
|
+
var uD = DD();
|
|
2255
|
+
function P(e) {
|
|
2256
|
+
if (typeof e != "string")
|
|
2257
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
2258
|
+
return e.replace(uD, "");
|
|
2259
|
+
}
|
|
2260
|
+
function L(e) {
|
|
2261
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2262
|
+
}
|
|
2263
|
+
var W = { exports: {} };
|
|
2264
|
+
(function(e) {
|
|
2265
|
+
var u = {};
|
|
2266
|
+
e.exports = u, u.eastAsianWidth = function(F) {
|
|
2267
|
+
var s = F.charCodeAt(0), i = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
|
|
2268
|
+
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
2269
|
+
}, u.characterLength = function(F) {
|
|
2270
|
+
var s = this.eastAsianWidth(F);
|
|
2271
|
+
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
2272
|
+
};
|
|
2273
|
+
function t(F) {
|
|
2274
|
+
return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
2275
|
+
}
|
|
2276
|
+
u.length = function(F) {
|
|
2277
|
+
for (var s = t(F), i = 0, D = 0;D < s.length; D++)
|
|
2278
|
+
i = i + this.characterLength(s[D]);
|
|
2279
|
+
return i;
|
|
2280
|
+
}, u.slice = function(F, s, i) {
|
|
2281
|
+
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
2282
|
+
for (var D = "", r = 0, n = t(F), E = 0;E < n.length; E++) {
|
|
2283
|
+
var a = n[E], o = u.length(a);
|
|
2284
|
+
if (r >= s - (o == 2 ? 1 : 0))
|
|
2285
|
+
if (r + o <= i)
|
|
2286
|
+
D += a;
|
|
2287
|
+
else
|
|
2288
|
+
break;
|
|
2289
|
+
r += o;
|
|
2290
|
+
}
|
|
2291
|
+
return D;
|
|
2292
|
+
};
|
|
2293
|
+
})(W);
|
|
2294
|
+
var tD = W.exports;
|
|
2295
|
+
var eD = L(tD);
|
|
2296
|
+
var FD = function() {
|
|
2297
|
+
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;
|
|
2298
|
+
};
|
|
2299
|
+
var sD = L(FD);
|
|
2300
|
+
function p(e, u = {}) {
|
|
2301
|
+
if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
|
|
2302
|
+
return 0;
|
|
2303
|
+
e = e.replace(sD(), " ");
|
|
2304
|
+
const t = u.ambiguousIsNarrow ? 1 : 2;
|
|
2305
|
+
let F = 0;
|
|
2306
|
+
for (const s of e) {
|
|
2307
|
+
const i = s.codePointAt(0);
|
|
2308
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
|
|
2309
|
+
continue;
|
|
2310
|
+
switch (eD.eastAsianWidth(s)) {
|
|
2311
|
+
case "F":
|
|
2312
|
+
case "W":
|
|
2313
|
+
F += 2;
|
|
2314
|
+
break;
|
|
2315
|
+
case "A":
|
|
2316
|
+
F += t;
|
|
2317
|
+
break;
|
|
2318
|
+
default:
|
|
2319
|
+
F += 1;
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
return F;
|
|
2323
|
+
}
|
|
2324
|
+
var w = 10;
|
|
2325
|
+
var N = (e = 0) => (u) => `\x1B[${u + e}m`;
|
|
2326
|
+
var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
|
|
2327
|
+
var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
|
|
2328
|
+
var C = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
2329
|
+
Object.keys(C.modifier);
|
|
2330
|
+
var iD = Object.keys(C.color);
|
|
2331
|
+
var rD = Object.keys(C.bgColor);
|
|
2332
|
+
[...iD, ...rD];
|
|
2333
|
+
function CD() {
|
|
2334
|
+
const e = new Map;
|
|
2335
|
+
for (const [u, t] of Object.entries(C)) {
|
|
2336
|
+
for (const [F, s] of Object.entries(t))
|
|
2337
|
+
C[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = C[F], e.set(s[0], s[1]);
|
|
2338
|
+
Object.defineProperty(C, u, { value: t, enumerable: false });
|
|
2339
|
+
}
|
|
2340
|
+
return Object.defineProperty(C, "codes", { value: e, enumerable: false }), C.color.close = "\x1B[39m", C.bgColor.close = "\x1B[49m", C.color.ansi = N(), C.color.ansi256 = I(), C.color.ansi16m = R(), C.bgColor.ansi = N(w), C.bgColor.ansi256 = I(w), C.bgColor.ansi16m = R(w), Object.defineProperties(C, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
2341
|
+
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
2342
|
+
if (!t)
|
|
2343
|
+
return [0, 0, 0];
|
|
2344
|
+
let [F] = t;
|
|
2345
|
+
F.length === 3 && (F = [...F].map((i) => i + i).join(""));
|
|
2346
|
+
const s = Number.parseInt(F, 16);
|
|
2347
|
+
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
2348
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => C.rgbToAnsi256(...C.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
2349
|
+
if (u < 8)
|
|
2350
|
+
return 30 + u;
|
|
2351
|
+
if (u < 16)
|
|
2352
|
+
return 90 + (u - 8);
|
|
2353
|
+
let t, F, s;
|
|
2354
|
+
if (u >= 232)
|
|
2355
|
+
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
2356
|
+
else {
|
|
2357
|
+
u -= 16;
|
|
2358
|
+
const r = u % 36;
|
|
2359
|
+
t = Math.floor(u / 36) / 5, F = Math.floor(r / 6) / 5, s = r % 6 / 5;
|
|
2360
|
+
}
|
|
2361
|
+
const i = Math.max(t, F, s) * 2;
|
|
2362
|
+
if (i === 0)
|
|
2363
|
+
return 30;
|
|
2364
|
+
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
2365
|
+
return i === 2 && (D += 60), D;
|
|
2366
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => C.ansi256ToAnsi(C.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => C.ansi256ToAnsi(C.hexToAnsi256(u)), enumerable: false } }), C;
|
|
2367
|
+
}
|
|
2368
|
+
var ED = CD();
|
|
2369
|
+
var d = new Set(["\x1B", ""]);
|
|
2370
|
+
var oD = 39;
|
|
2371
|
+
var y = "\x07";
|
|
2372
|
+
var V = "[";
|
|
2373
|
+
var nD = "]";
|
|
2374
|
+
var G = "m";
|
|
2375
|
+
var _ = `${nD}8;;`;
|
|
2376
|
+
var z = (e) => `${d.values().next().value}${V}${e}${G}`;
|
|
2377
|
+
var K = (e) => `${d.values().next().value}${_}${e}${y}`;
|
|
2378
|
+
var aD = (e) => e.split(" ").map((u) => p(u));
|
|
2379
|
+
var k = (e, u, t) => {
|
|
2380
|
+
const F = [...u];
|
|
2381
|
+
let s = false, i = false, D = p(P(e[e.length - 1]));
|
|
2382
|
+
for (const [r, n] of F.entries()) {
|
|
2383
|
+
const E = p(n);
|
|
2384
|
+
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(r + 1).join("").startsWith(_)), s) {
|
|
2385
|
+
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
2386
|
+
continue;
|
|
2387
|
+
}
|
|
2388
|
+
D += E, D === t && r < F.length - 1 && (e.push(""), D = 0);
|
|
2389
|
+
}
|
|
2390
|
+
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
2391
|
+
};
|
|
2392
|
+
var hD = (e) => {
|
|
2393
|
+
const u = e.split(" ");
|
|
2394
|
+
let t = u.length;
|
|
2395
|
+
for (;t > 0 && !(p(u[t - 1]) > 0); )
|
|
2396
|
+
t--;
|
|
2397
|
+
return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
|
|
2398
|
+
};
|
|
2399
|
+
var lD = (e, u, t = {}) => {
|
|
2400
|
+
if (t.trim !== false && e.trim() === "")
|
|
2401
|
+
return "";
|
|
2402
|
+
let F = "", s, i;
|
|
2403
|
+
const D = aD(e);
|
|
2404
|
+
let r = [""];
|
|
2405
|
+
for (const [E, a] of e.split(" ").entries()) {
|
|
2406
|
+
t.trim !== false && (r[r.length - 1] = r[r.length - 1].trimStart());
|
|
2407
|
+
let o = p(r[r.length - 1]);
|
|
2408
|
+
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (r.push(""), o = 0), (o > 0 || t.trim === false) && (r[r.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
2409
|
+
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
2410
|
+
Math.floor((D[E] - 1) / u) < f && r.push(""), k(r, a, u);
|
|
2411
|
+
continue;
|
|
2412
|
+
}
|
|
2413
|
+
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
2414
|
+
if (t.wordWrap === false && o < u) {
|
|
2415
|
+
k(r, a, u);
|
|
2416
|
+
continue;
|
|
2417
|
+
}
|
|
2418
|
+
r.push("");
|
|
2419
|
+
}
|
|
2420
|
+
if (o + D[E] > u && t.wordWrap === false) {
|
|
2421
|
+
k(r, a, u);
|
|
2422
|
+
continue;
|
|
2423
|
+
}
|
|
2424
|
+
r[r.length - 1] += a;
|
|
2425
|
+
}
|
|
2426
|
+
t.trim !== false && (r = r.map((E) => hD(E)));
|
|
2427
|
+
const n = [...r.join(`
|
|
2428
|
+
`)];
|
|
2429
|
+
for (const [E, a] of n.entries()) {
|
|
2430
|
+
if (F += a, d.has(a)) {
|
|
2431
|
+
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
2432
|
+
if (c.code !== undefined) {
|
|
2433
|
+
const f = Number.parseFloat(c.code);
|
|
2434
|
+
s = f === oD ? undefined : f;
|
|
2435
|
+
} else
|
|
2436
|
+
c.uri !== undefined && (i = c.uri.length === 0 ? undefined : c.uri);
|
|
2437
|
+
}
|
|
2438
|
+
const o = ED.codes.get(Number(s));
|
|
2439
|
+
n[E + 1] === `
|
|
2440
|
+
` ? (i && (F += K("")), s && o && (F += z(o))) : a === `
|
|
2441
|
+
` && (s && o && (F += z(s)), i && (F += K(i)));
|
|
2442
|
+
}
|
|
2443
|
+
return F;
|
|
2444
|
+
};
|
|
2445
|
+
function Y(e, u, t) {
|
|
2446
|
+
return String(e).normalize().replace(/\r\n/g, `
|
|
2447
|
+
`).split(`
|
|
2448
|
+
`).map((F) => lD(F, u, t)).join(`
|
|
2449
|
+
`);
|
|
2450
|
+
}
|
|
2451
|
+
var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
2452
|
+
var B = { actions: new Set(xD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
2453
|
+
function $(e, u) {
|
|
2454
|
+
if (typeof e == "string")
|
|
2455
|
+
return B.aliases.get(e) === u;
|
|
2456
|
+
for (const t of e)
|
|
2457
|
+
if (t !== undefined && $(t, u))
|
|
2458
|
+
return true;
|
|
2459
|
+
return false;
|
|
2460
|
+
}
|
|
2461
|
+
function BD(e, u) {
|
|
2462
|
+
if (e === u)
|
|
2463
|
+
return;
|
|
2464
|
+
const t = e.split(`
|
|
2465
|
+
`), F = u.split(`
|
|
2466
|
+
`), s = [];
|
|
2467
|
+
for (let i = 0;i < Math.max(t.length, F.length); i++)
|
|
2468
|
+
t[i] !== F[i] && s.push(i);
|
|
2469
|
+
return s;
|
|
2470
|
+
}
|
|
2471
|
+
var AD = globalThis.process.platform.startsWith("win");
|
|
2472
|
+
var S = Symbol("clack:cancel");
|
|
2473
|
+
function pD(e) {
|
|
2474
|
+
return e === S;
|
|
2475
|
+
}
|
|
2476
|
+
function m(e, u) {
|
|
2477
|
+
const t = e;
|
|
2478
|
+
t.isTTY && t.setRawMode(u);
|
|
2479
|
+
}
|
|
2480
|
+
function fD({ input: e = j, output: u = M, overwrite: t = true, hideCursor: F = true } = {}) {
|
|
2481
|
+
const s = g.createInterface({ input: e, output: u, prompt: "", tabSize: 1 });
|
|
2482
|
+
g.emitKeypressEvents(e, s), e.isTTY && e.setRawMode(true);
|
|
2483
|
+
const i = (D, { name: r, sequence: n }) => {
|
|
2484
|
+
const E = String(D);
|
|
2485
|
+
if ($([E, r, n], "cancel")) {
|
|
2486
|
+
F && u.write(import_sisteransi.cursor.show), process.exit(0);
|
|
2487
|
+
return;
|
|
2488
|
+
}
|
|
2489
|
+
if (!t)
|
|
2490
|
+
return;
|
|
2491
|
+
const a = r === "return" ? 0 : -1, o = r === "return" ? -1 : 0;
|
|
2492
|
+
g.moveCursor(u, a, o, () => {
|
|
2493
|
+
g.clearLine(u, 1, () => {
|
|
2494
|
+
e.once("keypress", i);
|
|
2495
|
+
});
|
|
2496
|
+
});
|
|
2497
|
+
};
|
|
2498
|
+
return F && u.write(import_sisteransi.cursor.hide), e.once("keypress", i), () => {
|
|
2499
|
+
e.off("keypress", i), F && u.write(import_sisteransi.cursor.show), e.isTTY && !AD && e.setRawMode(false), s.terminal = false, s.close();
|
|
2500
|
+
};
|
|
2501
|
+
}
|
|
2502
|
+
var gD = Object.defineProperty;
|
|
2503
|
+
var vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
2504
|
+
var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
2505
|
+
|
|
2506
|
+
class x {
|
|
2507
|
+
constructor(u, t = true) {
|
|
2508
|
+
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
2509
|
+
const { input: F = j, output: s = M, render: i, signal: D, ...r } = u;
|
|
2510
|
+
this.opts = r, 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 = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
2511
|
+
}
|
|
2512
|
+
unsubscribe() {
|
|
2513
|
+
this._subscribers.clear();
|
|
2514
|
+
}
|
|
2515
|
+
setSubscriber(u, t) {
|
|
2516
|
+
const F = this._subscribers.get(u) ?? [];
|
|
2517
|
+
F.push(t), this._subscribers.set(u, F);
|
|
2518
|
+
}
|
|
2519
|
+
on(u, t) {
|
|
2520
|
+
this.setSubscriber(u, { cb: t });
|
|
2521
|
+
}
|
|
2522
|
+
once(u, t) {
|
|
2523
|
+
this.setSubscriber(u, { cb: t, once: true });
|
|
2524
|
+
}
|
|
2525
|
+
emit(u, ...t) {
|
|
2526
|
+
const F = this._subscribers.get(u) ?? [], s = [];
|
|
2527
|
+
for (const i of F)
|
|
2528
|
+
i.cb(...t), i.once && s.push(() => F.splice(F.indexOf(i), 1));
|
|
2529
|
+
for (const i of s)
|
|
2530
|
+
i();
|
|
2531
|
+
}
|
|
2532
|
+
prompt() {
|
|
2533
|
+
return new Promise((u, t) => {
|
|
2534
|
+
if (this._abortSignal) {
|
|
2535
|
+
if (this._abortSignal.aborted)
|
|
2536
|
+
return this.state = "cancel", this.close(), u(S);
|
|
2537
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
2538
|
+
this.state = "cancel", this.close();
|
|
2539
|
+
}, { once: true });
|
|
2540
|
+
}
|
|
2541
|
+
const F = new X;
|
|
2542
|
+
F._write = (s, i, D) => {
|
|
2543
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
2544
|
+
}, this.input.pipe(F), this.rl = O.createInterface({ input: this.input, output: F, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
2545
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(this.value);
|
|
2546
|
+
}), this.once("cancel", () => {
|
|
2547
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(S);
|
|
2548
|
+
});
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2551
|
+
onKeypress(u, t) {
|
|
2552
|
+
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
2553
|
+
if (!this.value && this.opts.placeholder && (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder)), this.opts.validate) {
|
|
2554
|
+
const F = this.opts.validate(this.value);
|
|
2555
|
+
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
2556
|
+
}
|
|
2557
|
+
this.state !== "error" && (this.state = "submit");
|
|
2558
|
+
}
|
|
2559
|
+
$([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
2560
|
+
}
|
|
2561
|
+
close() {
|
|
2562
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
2563
|
+
`), m(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
2564
|
+
}
|
|
2565
|
+
restoreCursor() {
|
|
2566
|
+
const u = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
2567
|
+
`).length - 1;
|
|
2568
|
+
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
|
|
2569
|
+
}
|
|
2570
|
+
render() {
|
|
2571
|
+
const u = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
2572
|
+
if (u !== this._prevFrame) {
|
|
2573
|
+
if (this.state === "initial")
|
|
2574
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
2575
|
+
else {
|
|
2576
|
+
const t = BD(this._prevFrame, u);
|
|
2577
|
+
if (this.restoreCursor(), t && t?.length === 1) {
|
|
2578
|
+
const F = t[0];
|
|
2579
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
|
|
2580
|
+
const s = u.split(`
|
|
2581
|
+
`);
|
|
2582
|
+
this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
|
|
2583
|
+
return;
|
|
2584
|
+
}
|
|
2585
|
+
if (t && t?.length > 1) {
|
|
2586
|
+
const F = t[0];
|
|
2587
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
|
|
2588
|
+
const s = u.split(`
|
|
2589
|
+
`).slice(F);
|
|
2590
|
+
this.output.write(s.join(`
|
|
2591
|
+
`)), this._prevFrame = u;
|
|
2592
|
+
return;
|
|
2593
|
+
}
|
|
2594
|
+
this.output.write(import_sisteransi.erase.down());
|
|
2595
|
+
}
|
|
2596
|
+
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
class dD extends x {
|
|
2602
|
+
get cursor() {
|
|
2603
|
+
return this.value ? 0 : 1;
|
|
2604
|
+
}
|
|
2605
|
+
get _value() {
|
|
2606
|
+
return this.cursor === 0;
|
|
2607
|
+
}
|
|
2608
|
+
constructor(u) {
|
|
2609
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
2610
|
+
this.value = this._value;
|
|
2611
|
+
}), this.on("confirm", (t) => {
|
|
2612
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
|
|
2613
|
+
}), this.on("cursor", () => {
|
|
2614
|
+
this.value = !this.value;
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
var A;
|
|
2619
|
+
A = new WeakMap;
|
|
2620
|
+
var kD = Object.defineProperty;
|
|
2621
|
+
var $D = (e, u, t) => (u in e) ? kD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
2622
|
+
var H = (e, u, t) => ($D(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
2623
|
+
var SD = class extends x {
|
|
2624
|
+
constructor(u) {
|
|
2625
|
+
super(u, false), H(this, "options"), H(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u.cursorAt), 0), this.on("key", (t) => {
|
|
2626
|
+
t === "a" && this.toggleAll();
|
|
2627
|
+
}), this.on("cursor", (t) => {
|
|
2628
|
+
switch (t) {
|
|
2629
|
+
case "left":
|
|
2630
|
+
case "up":
|
|
2631
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
2632
|
+
break;
|
|
2633
|
+
case "down":
|
|
2634
|
+
case "right":
|
|
2635
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
2636
|
+
break;
|
|
2637
|
+
case "space":
|
|
2638
|
+
this.toggleValue();
|
|
2639
|
+
break;
|
|
2640
|
+
}
|
|
2641
|
+
});
|
|
2642
|
+
}
|
|
2643
|
+
get _value() {
|
|
2644
|
+
return this.options[this.cursor].value;
|
|
2645
|
+
}
|
|
2646
|
+
toggleAll() {
|
|
2647
|
+
const u = this.value.length === this.options.length;
|
|
2648
|
+
this.value = u ? [] : this.options.map((t) => t.value);
|
|
2649
|
+
}
|
|
2650
|
+
toggleValue() {
|
|
2651
|
+
const u = this.value.includes(this._value);
|
|
2652
|
+
this.value = u ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
|
|
2653
|
+
}
|
|
2654
|
+
};
|
|
2655
|
+
var OD = Object.defineProperty;
|
|
2656
|
+
var PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
2657
|
+
var J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
2658
|
+
|
|
2659
|
+
class LD extends x {
|
|
2660
|
+
constructor(u) {
|
|
2661
|
+
super(u, false), J(this, "options"), J(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: t }) => t === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
2662
|
+
switch (t) {
|
|
2663
|
+
case "left":
|
|
2664
|
+
case "up":
|
|
2665
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
2666
|
+
break;
|
|
2667
|
+
case "down":
|
|
2668
|
+
case "right":
|
|
2669
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
2670
|
+
break;
|
|
2671
|
+
}
|
|
2672
|
+
this.changeValue();
|
|
2673
|
+
});
|
|
2674
|
+
}
|
|
2675
|
+
get _value() {
|
|
2676
|
+
return this.options[this.cursor];
|
|
2677
|
+
}
|
|
2678
|
+
changeValue() {
|
|
2679
|
+
this.value = this._value.value;
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
class RD extends x {
|
|
2683
|
+
get valueWithCursor() {
|
|
2684
|
+
if (this.state === "submit")
|
|
2685
|
+
return this.value;
|
|
2686
|
+
if (this.cursor >= this.value.length)
|
|
2687
|
+
return `${this.value}█`;
|
|
2688
|
+
const u = this.value.slice(0, this.cursor), [t, ...F] = this.value.slice(this.cursor);
|
|
2689
|
+
return `${u}${import_picocolors.default.inverse(t)}${F.join("")}`;
|
|
2690
|
+
}
|
|
2691
|
+
get cursor() {
|
|
2692
|
+
return this._cursor;
|
|
2693
|
+
}
|
|
2694
|
+
constructor(u) {
|
|
2695
|
+
super(u), this.on("finalize", () => {
|
|
2696
|
+
this.value || (this.value = u.defaultValue);
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
2702
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
2703
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
2704
|
+
import y2 from "node:process";
|
|
2705
|
+
function ce() {
|
|
2706
|
+
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
2707
|
+
}
|
|
2708
|
+
var V2 = ce();
|
|
2709
|
+
var u = (t, n) => V2 ? t : n;
|
|
2710
|
+
var le = u("◆", "*");
|
|
2711
|
+
var L2 = u("■", "x");
|
|
2712
|
+
var W2 = u("▲", "x");
|
|
2713
|
+
var C2 = u("◇", "o");
|
|
2714
|
+
var ue = u("┌", "T");
|
|
2715
|
+
var o = u("│", "|");
|
|
2716
|
+
var d2 = u("└", "—");
|
|
2717
|
+
var k2 = u("●", ">");
|
|
2718
|
+
var P2 = u("○", " ");
|
|
2719
|
+
var A2 = u("◻", "[•]");
|
|
2720
|
+
var T = u("◼", "[+]");
|
|
2721
|
+
var F = u("◻", "[ ]");
|
|
2722
|
+
var $e = u("▪", "•");
|
|
2723
|
+
var _2 = u("─", "-");
|
|
2724
|
+
var me = u("╮", "+");
|
|
2725
|
+
var de = u("├", "+");
|
|
2726
|
+
var pe = u("╯", "+");
|
|
2727
|
+
var q = u("●", "•");
|
|
2728
|
+
var D = u("◆", "*");
|
|
2729
|
+
var U = u("▲", "!");
|
|
2730
|
+
var K2 = u("■", "x");
|
|
2731
|
+
var b2 = (t) => {
|
|
2732
|
+
switch (t) {
|
|
2733
|
+
case "initial":
|
|
2734
|
+
case "active":
|
|
2735
|
+
return import_picocolors2.default.cyan(le);
|
|
2736
|
+
case "cancel":
|
|
2737
|
+
return import_picocolors2.default.red(L2);
|
|
2738
|
+
case "error":
|
|
2739
|
+
return import_picocolors2.default.yellow(W2);
|
|
2740
|
+
case "submit":
|
|
2741
|
+
return import_picocolors2.default.green(C2);
|
|
2742
|
+
}
|
|
2743
|
+
};
|
|
2744
|
+
var G2 = (t) => {
|
|
2745
|
+
const { cursor: n, options: r, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
2746
|
+
let l2 = 0;
|
|
2747
|
+
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
2748
|
+
const $2 = a < r.length && l2 > 0, g2 = a < r.length && l2 + a < r.length;
|
|
2749
|
+
return r.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
2750
|
+
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
2751
|
+
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
2752
|
+
});
|
|
2753
|
+
};
|
|
2754
|
+
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
2755
|
+
const n = `${import_picocolors2.default.gray(o)}
|
|
2756
|
+
${b2(this.state)} ${t.message}
|
|
2757
|
+
`, r = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r;
|
|
2758
|
+
switch (this.state) {
|
|
2759
|
+
case "error":
|
|
2760
|
+
return `${n.trim()}
|
|
2761
|
+
${import_picocolors2.default.yellow(o)} ${i}
|
|
2762
|
+
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
2763
|
+
`;
|
|
2764
|
+
case "submit":
|
|
2765
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
2766
|
+
case "cancel":
|
|
2767
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
2768
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
2769
|
+
default:
|
|
2770
|
+
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
2771
|
+
${import_picocolors2.default.cyan(d2)}
|
|
2772
|
+
`;
|
|
2773
|
+
}
|
|
2774
|
+
} }).prompt();
|
|
2775
|
+
var ye = (t) => {
|
|
2776
|
+
const n = t.active ?? "Yes", r = t.inactive ?? "No";
|
|
2777
|
+
return new dD({ active: n, inactive: r, initialValue: t.initialValue ?? true, render() {
|
|
2778
|
+
const i = `${import_picocolors2.default.gray(o)}
|
|
2779
|
+
${b2(this.state)} ${t.message}
|
|
2780
|
+
`, s = this.value ? n : r;
|
|
2781
|
+
switch (this.state) {
|
|
2782
|
+
case "submit":
|
|
2783
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
|
|
2784
|
+
case "cancel":
|
|
2785
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
|
|
2786
|
+
${import_picocolors2.default.gray(o)}`;
|
|
2787
|
+
default:
|
|
2788
|
+
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r)}` : `${import_picocolors2.default.green(k2)} ${r}`}
|
|
2789
|
+
${import_picocolors2.default.cyan(d2)}
|
|
2790
|
+
`;
|
|
2791
|
+
}
|
|
2792
|
+
} }).prompt();
|
|
2793
|
+
};
|
|
2794
|
+
var ve = (t) => {
|
|
2795
|
+
const n = (r, i) => {
|
|
2796
|
+
const s = r.label ?? String(r.value);
|
|
2797
|
+
switch (i) {
|
|
2798
|
+
case "selected":
|
|
2799
|
+
return `${import_picocolors2.default.dim(s)}`;
|
|
2800
|
+
case "active":
|
|
2801
|
+
return `${import_picocolors2.default.green(k2)} ${s} ${r.hint ? import_picocolors2.default.dim(`(${r.hint})`) : ""}`;
|
|
2802
|
+
case "cancelled":
|
|
2803
|
+
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
|
|
2804
|
+
default:
|
|
2805
|
+
return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
|
|
2806
|
+
}
|
|
2807
|
+
};
|
|
2808
|
+
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
2809
|
+
const r = `${import_picocolors2.default.gray(o)}
|
|
2810
|
+
${b2(this.state)} ${t.message}
|
|
2811
|
+
`;
|
|
2812
|
+
switch (this.state) {
|
|
2813
|
+
case "submit":
|
|
2814
|
+
return `${r}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
2815
|
+
case "cancel":
|
|
2816
|
+
return `${r}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
2817
|
+
${import_picocolors2.default.gray(o)}`;
|
|
2818
|
+
default:
|
|
2819
|
+
return `${r}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
2820
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
2821
|
+
${import_picocolors2.default.cyan(d2)}
|
|
2822
|
+
`;
|
|
2823
|
+
}
|
|
2824
|
+
} }).prompt();
|
|
2825
|
+
};
|
|
2826
|
+
var fe = (t) => {
|
|
2827
|
+
const n = (r, i) => {
|
|
2828
|
+
const s = r.label ?? String(r.value);
|
|
2829
|
+
return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r.hint ? import_picocolors2.default.dim(`(${r.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T)} ${import_picocolors2.default.dim(s)} ${r.hint ? import_picocolors2.default.dim(`(${r.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T)} ${s} ${r.hint ? import_picocolors2.default.dim(`(${r.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
|
|
2830
|
+
};
|
|
2831
|
+
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r) {
|
|
2832
|
+
if (this.required && r.length === 0)
|
|
2833
|
+
return `Please select at least one option.
|
|
2834
|
+
${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
|
|
2835
|
+
}, render() {
|
|
2836
|
+
const r = `${import_picocolors2.default.gray(o)}
|
|
2837
|
+
${b2(this.state)} ${t.message}
|
|
2838
|
+
`, i = (s, c) => {
|
|
2839
|
+
const a = this.value.includes(s.value);
|
|
2840
|
+
return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
|
|
2841
|
+
};
|
|
2842
|
+
switch (this.state) {
|
|
2843
|
+
case "submit":
|
|
2844
|
+
return `${r}${import_picocolors2.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
|
|
2845
|
+
case "cancel": {
|
|
2846
|
+
const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors2.default.dim(", "));
|
|
2847
|
+
return `${r}${import_picocolors2.default.gray(o)} ${s.trim() ? `${s}
|
|
2848
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
2849
|
+
}
|
|
2850
|
+
case "error": {
|
|
2851
|
+
const s = this.error.split(`
|
|
2852
|
+
`).map((c, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c)}` : ` ${c}`).join(`
|
|
2853
|
+
`);
|
|
2854
|
+
return `${r + import_picocolors2.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
2855
|
+
${import_picocolors2.default.yellow(o)} `)}
|
|
2856
|
+
${s}
|
|
2857
|
+
`;
|
|
2858
|
+
}
|
|
2859
|
+
default:
|
|
2860
|
+
return `${r}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
2861
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
2862
|
+
${import_picocolors2.default.cyan(d2)}
|
|
2863
|
+
`;
|
|
2864
|
+
}
|
|
2865
|
+
} }).prompt();
|
|
2866
|
+
};
|
|
2867
|
+
var Me = (t = "", n = "") => {
|
|
2868
|
+
const r = `
|
|
2869
|
+
${t}
|
|
2870
|
+
`.split(`
|
|
2871
|
+
`), i = S2(n).length, s = Math.max(r.reduce((a, l2) => {
|
|
2872
|
+
const $2 = S2(l2);
|
|
2873
|
+
return $2.length > a ? $2.length : a;
|
|
2874
|
+
}, 0), i) + 2, c = r.map((a) => `${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(a)}${" ".repeat(s - S2(a).length)}${import_picocolors2.default.gray(o)}`).join(`
|
|
2875
|
+
`);
|
|
2876
|
+
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
2877
|
+
${import_picocolors2.default.green(C2)} ${import_picocolors2.default.reset(n)} ${import_picocolors2.default.gray(_2.repeat(Math.max(s - i - 1, 1)) + me)}
|
|
2878
|
+
${c}
|
|
2879
|
+
${import_picocolors2.default.gray(de + _2.repeat(s + 2) + pe)}
|
|
2880
|
+
`);
|
|
2881
|
+
};
|
|
2882
|
+
var xe = (t = "") => {
|
|
2883
|
+
process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(t)}
|
|
2884
|
+
|
|
2885
|
+
`);
|
|
2886
|
+
};
|
|
2887
|
+
var Ie = (t = "") => {
|
|
2888
|
+
process.stdout.write(`${import_picocolors2.default.gray(ue)} ${t}
|
|
2889
|
+
`);
|
|
2890
|
+
};
|
|
2891
|
+
var Se = (t = "") => {
|
|
2892
|
+
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
2893
|
+
${import_picocolors2.default.gray(d2)} ${t}
|
|
2894
|
+
|
|
2895
|
+
`);
|
|
2896
|
+
};
|
|
2897
|
+
var M2 = { message: (t = "", { symbol: n = import_picocolors2.default.gray(o) } = {}) => {
|
|
2898
|
+
const r = [`${import_picocolors2.default.gray(o)}`];
|
|
2899
|
+
if (t) {
|
|
2900
|
+
const [i, ...s] = t.split(`
|
|
2901
|
+
`);
|
|
2902
|
+
r.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors2.default.gray(o)} ${c}`));
|
|
2903
|
+
}
|
|
2904
|
+
process.stdout.write(`${r.join(`
|
|
2905
|
+
`)}
|
|
2906
|
+
`);
|
|
2907
|
+
}, info: (t) => {
|
|
2908
|
+
M2.message(t, { symbol: import_picocolors2.default.blue(q) });
|
|
2909
|
+
}, success: (t) => {
|
|
2910
|
+
M2.message(t, { symbol: import_picocolors2.default.green(D) });
|
|
2911
|
+
}, step: (t) => {
|
|
2912
|
+
M2.message(t, { symbol: import_picocolors2.default.green(C2) });
|
|
2913
|
+
}, warn: (t) => {
|
|
2914
|
+
M2.message(t, { symbol: import_picocolors2.default.yellow(U) });
|
|
2915
|
+
}, warning: (t) => {
|
|
2916
|
+
M2.warn(t);
|
|
2917
|
+
}, error: (t) => {
|
|
2918
|
+
M2.message(t, { symbol: import_picocolors2.default.red(K2) });
|
|
2919
|
+
} };
|
|
2920
|
+
var J2 = `${import_picocolors2.default.gray(o)} `;
|
|
2921
|
+
var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
2922
|
+
const n = V2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], r = V2 ? 80 : 120, i = process.env.CI === "true";
|
|
2923
|
+
let s, c, a = false, l2 = "", $2, g2 = performance.now();
|
|
2924
|
+
const p2 = (m2) => {
|
|
2925
|
+
const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
|
|
2926
|
+
a && N2(h2, m2);
|
|
2927
|
+
}, v2 = () => p2(2), f = () => p2(1), j2 = () => {
|
|
2928
|
+
process.on("uncaughtExceptionMonitor", v2), process.on("unhandledRejection", v2), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p2);
|
|
2929
|
+
}, E = () => {
|
|
2930
|
+
process.removeListener("uncaughtExceptionMonitor", v2), process.removeListener("unhandledRejection", v2), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p2);
|
|
2931
|
+
}, B2 = () => {
|
|
2932
|
+
if ($2 === undefined)
|
|
2933
|
+
return;
|
|
2934
|
+
i && process.stdout.write(`
|
|
2935
|
+
`);
|
|
2936
|
+
const m2 = $2.split(`
|
|
2937
|
+
`);
|
|
2938
|
+
process.stdout.write(import_sisteransi2.cursor.move(-999, m2.length - 1)), process.stdout.write(import_sisteransi2.erase.down(m2.length));
|
|
2939
|
+
}, R2 = (m2) => m2.replace(/\.+$/, ""), O2 = (m2) => {
|
|
2940
|
+
const h2 = (performance.now() - m2) / 1000, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
|
|
2941
|
+
return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
|
|
2942
|
+
}, H2 = (m2 = "") => {
|
|
2943
|
+
a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
2944
|
+
`);
|
|
2945
|
+
let h2 = 0, w2 = 0;
|
|
2946
|
+
j2(), c = setInterval(() => {
|
|
2947
|
+
if (i && l2 === $2)
|
|
2948
|
+
return;
|
|
2949
|
+
B2(), $2 = l2;
|
|
2950
|
+
const I2 = import_picocolors2.default.magenta(n[h2]);
|
|
2951
|
+
if (i)
|
|
2952
|
+
process.stdout.write(`${I2} ${l2}...`);
|
|
2953
|
+
else if (t === "timer")
|
|
2954
|
+
process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
|
|
2955
|
+
else {
|
|
2956
|
+
const z2 = ".".repeat(Math.floor(w2)).slice(0, 3);
|
|
2957
|
+
process.stdout.write(`${I2} ${l2}${z2}`);
|
|
2958
|
+
}
|
|
2959
|
+
h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
|
|
2960
|
+
}, r);
|
|
2961
|
+
}, N2 = (m2 = "", h2 = 0) => {
|
|
2962
|
+
a = false, clearInterval(c), B2();
|
|
2963
|
+
const w2 = h2 === 0 ? import_picocolors2.default.green(C2) : h2 === 1 ? import_picocolors2.default.red(L2) : import_picocolors2.default.red(W2);
|
|
2964
|
+
l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
|
|
2965
|
+
`) : process.stdout.write(`${w2} ${l2}
|
|
2966
|
+
`), E(), s();
|
|
2967
|
+
};
|
|
2968
|
+
return { start: H2, stop: N2, message: (m2 = "") => {
|
|
2969
|
+
l2 = R2(m2 ?? l2);
|
|
2970
|
+
} };
|
|
2971
|
+
};
|
|
2972
|
+
var Ce = async (t, n) => {
|
|
2973
|
+
const r = {}, i = Object.keys(t);
|
|
2974
|
+
for (const s of i) {
|
|
2975
|
+
const c = t[s], a = await c({ results: r })?.catch((l2) => {
|
|
2976
|
+
throw l2;
|
|
2977
|
+
});
|
|
2978
|
+
if (typeof n?.onCancel == "function" && pD(a)) {
|
|
2979
|
+
r[s] = "canceled", n.onCancel({ results: r });
|
|
2980
|
+
continue;
|
|
2981
|
+
}
|
|
2982
|
+
r[s] = a;
|
|
2983
|
+
}
|
|
2984
|
+
return r;
|
|
2985
|
+
};
|
|
2986
|
+
|
|
2987
|
+
// src/index.ts
|
|
2988
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
2989
|
+
var import_fs_extra2 = __toESM(require_lib(), 1);
|
|
2990
|
+
import path3 from "node:path";
|
|
2991
|
+
|
|
2992
|
+
// src/prompts.ts
|
|
2993
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
2994
|
+
async function runPrompts(projectName) {
|
|
2995
|
+
Ie(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" create-edhor-stack ")));
|
|
2996
|
+
const project = await Ce({
|
|
2997
|
+
name: () => he({
|
|
2998
|
+
message: "Project name",
|
|
2999
|
+
initialValue: projectName || "my-app",
|
|
3000
|
+
validate: (value) => {
|
|
3001
|
+
if (!value)
|
|
3002
|
+
return "Project name is required";
|
|
3003
|
+
if (!/^[a-z0-9-]+$/.test(value))
|
|
3004
|
+
return "Use lowercase letters, numbers, and hyphens only";
|
|
3005
|
+
}
|
|
3006
|
+
}),
|
|
3007
|
+
apps: () => fe({
|
|
3008
|
+
message: "Which apps do you want?",
|
|
3009
|
+
options: [
|
|
3010
|
+
{ value: "web", label: "Web (TanStack Start)", hint: "recommended" },
|
|
3011
|
+
{ value: "mobile", label: "Mobile (Expo + React Native)" }
|
|
3012
|
+
],
|
|
3013
|
+
initialValues: ["web"],
|
|
3014
|
+
required: true
|
|
3015
|
+
}),
|
|
3016
|
+
database: () => ve({
|
|
3017
|
+
message: "Database?",
|
|
3018
|
+
options: [
|
|
3019
|
+
{ value: "none", label: "None", hint: "external API" },
|
|
3020
|
+
{ value: "postgres", label: "PostgreSQL", hint: "Drizzle ORM" },
|
|
3021
|
+
{ value: "convex", label: "Convex", hint: "realtime DB + serverless functions" }
|
|
3022
|
+
],
|
|
3023
|
+
initialValue: "none"
|
|
3024
|
+
}),
|
|
3025
|
+
api: ({ results }) => results.database !== "convex" ? ve({
|
|
3026
|
+
message: "API framework?",
|
|
3027
|
+
options: [
|
|
3028
|
+
{ value: "none", label: "None", hint: "TanStack Start server functions" },
|
|
3029
|
+
{ value: "hono", label: "Hono", hint: "lightweight, fast" },
|
|
3030
|
+
{ value: "elysia", label: "Elysia", hint: "Bun-native, end-to-end type safety" }
|
|
3031
|
+
],
|
|
3032
|
+
initialValue: "none"
|
|
3033
|
+
}) : Promise.resolve("none"),
|
|
3034
|
+
packages: ({ results }) => fe({
|
|
3035
|
+
message: "Additional packages?",
|
|
3036
|
+
options: [
|
|
3037
|
+
{ value: "ui", label: "UI (shadcn/ui + Tailwind)", hint: "recommended" },
|
|
3038
|
+
{ value: "shared", label: "Shared (types + schemas)", hint: "for web & mobile" },
|
|
3039
|
+
...results.database !== "none" ? [{ value: "auth", label: "Auth", hint: results.database === "convex" ? "Convex Auth" : "Better Auth" }] : [],
|
|
3040
|
+
{ value: "stripe", label: "Stripe", hint: "payments" }
|
|
3041
|
+
],
|
|
3042
|
+
required: false
|
|
3043
|
+
}),
|
|
3044
|
+
testing: () => ye({
|
|
3045
|
+
message: "Add testing setup? (Vitest + Playwright)",
|
|
3046
|
+
initialValue: true
|
|
3047
|
+
}),
|
|
3048
|
+
ci: () => ye({
|
|
3049
|
+
message: "Add GitHub Actions CI?",
|
|
3050
|
+
initialValue: true
|
|
3051
|
+
}),
|
|
3052
|
+
deployment: () => ye({
|
|
3053
|
+
message: "Add deployment config? (Dockerfile + fly.toml)",
|
|
3054
|
+
initialValue: true
|
|
3055
|
+
})
|
|
3056
|
+
}, {
|
|
3057
|
+
onCancel: () => {
|
|
3058
|
+
xe("Setup cancelled.");
|
|
3059
|
+
process.exit(0);
|
|
3060
|
+
}
|
|
3061
|
+
});
|
|
3062
|
+
return project;
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
// src/scaffold.ts
|
|
3066
|
+
var import_fs_extra = __toESM(require_lib(), 1);
|
|
3067
|
+
import path2 from "node:path";
|
|
3068
|
+
|
|
3069
|
+
// src/utils.ts
|
|
3070
|
+
import path from "node:path";
|
|
3071
|
+
import { fileURLToPath } from "node:url";
|
|
3072
|
+
var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
|
|
3073
|
+
function getTemplatesDir() {
|
|
3074
|
+
return path.resolve(__dirname2, "..", "templates");
|
|
3075
|
+
}
|
|
3076
|
+
function renderTemplate(content, vars) {
|
|
3077
|
+
return content.replace(/\{\{(\w+)\}\}/g, (_3, key) => vars[key] ?? "");
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
// src/scaffold.ts
|
|
3081
|
+
async function scaffoldProject(config, targetDir) {
|
|
3082
|
+
const templatesDir = getTemplatesDir();
|
|
3083
|
+
await import_fs_extra.default.ensureDir(targetDir);
|
|
3084
|
+
await copyTemplate(path2.join(templatesDir, "base"), targetDir, {
|
|
3085
|
+
name: config.name
|
|
3086
|
+
});
|
|
3087
|
+
await import_fs_extra.default.ensureDir(path2.join(targetDir, "apps"));
|
|
3088
|
+
await import_fs_extra.default.ensureDir(path2.join(targetDir, "packages"));
|
|
3089
|
+
for (const app of config.apps) {
|
|
3090
|
+
const appSrc = path2.join(templatesDir, "apps", app);
|
|
3091
|
+
const appDest = path2.join(targetDir, "apps", app);
|
|
3092
|
+
if (await import_fs_extra.default.pathExists(appSrc)) {
|
|
3093
|
+
await copyTemplate(appSrc, appDest, { name: config.name });
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
if (config.api && config.api !== "none") {
|
|
3097
|
+
const apiSrc = path2.join(templatesDir, "apps", `api-${config.api}`);
|
|
3098
|
+
const apiDest = path2.join(targetDir, "apps", "api");
|
|
3099
|
+
if (await import_fs_extra.default.pathExists(apiSrc)) {
|
|
3100
|
+
await copyTemplate(apiSrc, apiDest, { name: config.name });
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
for (const pkg of config.packages) {
|
|
3104
|
+
const pkgSrc = path2.join(templatesDir, "packages", pkg);
|
|
3105
|
+
const pkgDest = path2.join(targetDir, "packages", pkg);
|
|
3106
|
+
if (await import_fs_extra.default.pathExists(pkgSrc)) {
|
|
3107
|
+
await copyTemplate(pkgSrc, pkgDest, { name: config.name });
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
if (!config.deployment) {
|
|
3111
|
+
await import_fs_extra.default.remove(path2.join(targetDir, "Dockerfile"));
|
|
3112
|
+
await import_fs_extra.default.remove(path2.join(targetDir, "fly.toml"));
|
|
3113
|
+
}
|
|
3114
|
+
const preCommitPath = path2.join(targetDir, ".husky", "pre-commit");
|
|
3115
|
+
if (await import_fs_extra.default.pathExists(preCommitPath)) {
|
|
3116
|
+
await import_fs_extra.default.chmod(preCommitPath, 493);
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
async function copyTemplate(srcDir, destDir, vars) {
|
|
3120
|
+
await import_fs_extra.default.ensureDir(destDir);
|
|
3121
|
+
const entries = await import_fs_extra.default.readdir(srcDir, { withFileTypes: true });
|
|
3122
|
+
for (const entry of entries) {
|
|
3123
|
+
const srcPath = path2.join(srcDir, entry.name);
|
|
3124
|
+
let destName = entry.name.replace(/\.hbs$/, "");
|
|
3125
|
+
if (destName === "gitignore") {
|
|
3126
|
+
destName = ".gitignore";
|
|
3127
|
+
}
|
|
3128
|
+
const destPath = path2.join(destDir, destName);
|
|
3129
|
+
if (entry.isDirectory()) {
|
|
3130
|
+
await import_fs_extra.default.ensureDir(destPath);
|
|
3131
|
+
await copyTemplate(srcPath, destPath, vars);
|
|
3132
|
+
} else {
|
|
3133
|
+
let content = await import_fs_extra.default.readFile(srcPath, "utf-8");
|
|
3134
|
+
const renderExtensions = [".hbs", ".json", ".tsx", ".ts", ".md", ".toml"];
|
|
3135
|
+
if (renderExtensions.some((ext) => entry.name.endsWith(ext))) {
|
|
3136
|
+
content = renderTemplate(content, vars);
|
|
3137
|
+
}
|
|
3138
|
+
await import_fs_extra.default.writeFile(destPath, content);
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
|
|
3143
|
+
// src/index.ts
|
|
3144
|
+
async function main() {
|
|
3145
|
+
const args = process.argv.slice(2);
|
|
3146
|
+
const projectName = args[0];
|
|
3147
|
+
const config = await runPrompts(projectName);
|
|
3148
|
+
if (!config)
|
|
3149
|
+
return;
|
|
3150
|
+
const targetDir = path3.resolve(process.cwd(), config.name);
|
|
3151
|
+
if (await import_fs_extra2.default.pathExists(targetDir)) {
|
|
3152
|
+
const overwrite = await ye({
|
|
3153
|
+
message: `Directory ${import_picocolors4.default.cyan(config.name)} already exists. Overwrite?`,
|
|
3154
|
+
initialValue: false
|
|
3155
|
+
});
|
|
3156
|
+
if (!overwrite) {
|
|
3157
|
+
xe("Setup cancelled.");
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
3160
|
+
await import_fs_extra2.default.remove(targetDir);
|
|
3161
|
+
}
|
|
3162
|
+
const s = Y2();
|
|
3163
|
+
s.start("Creating project...");
|
|
3164
|
+
try {
|
|
3165
|
+
await scaffoldProject(config, targetDir);
|
|
3166
|
+
s.stop("Project created!");
|
|
3167
|
+
Me([
|
|
3168
|
+
`cd ${config.name}`,
|
|
3169
|
+
"bun install",
|
|
3170
|
+
"git init && git add -A && git commit -m 'Initial commit'",
|
|
3171
|
+
"bun dev"
|
|
3172
|
+
].join(`
|
|
3173
|
+
`), "Next steps");
|
|
3174
|
+
Se(import_picocolors4.default.green("Happy coding!"));
|
|
3175
|
+
} catch (error) {
|
|
3176
|
+
s.stop("Failed to create project");
|
|
3177
|
+
M2.error(String(error));
|
|
3178
|
+
process.exit(1);
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
main().catch(console.error);
|