wxt 0.17.4 → 0.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-E5MGUY6P.js → chunk-4K4AQ5GV.js} +238 -25
- package/dist/chunk-VBXJIVYU.js +38 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +374 -85
- package/dist/execa-4F7CCWCA.js +2191 -0
- package/dist/{index-vpYNIeCJ.d.cts → index-5w9cnXgy.d.cts} +80 -3
- package/dist/{index-vpYNIeCJ.d.ts → index-5w9cnXgy.d.ts} +80 -3
- package/dist/index.cjs +2848 -181
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +105 -27
- package/dist/storage.js +1 -1
- package/dist/testing.cjs +54 -44
- package/dist/testing.d.cts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +2 -2
- package/package.json +5 -3
- package/dist/chunk-P57PW2II.js +0 -11
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,12 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
8
14
|
var __export = (target, all) => {
|
|
9
15
|
for (var name in all)
|
|
10
16
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,17 +21,2396 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
21
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
22
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
23
|
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
|
|
36
|
+
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
37
|
+
var require_windows = __commonJS({
|
|
38
|
+
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
|
|
39
|
+
"use strict";
|
|
40
|
+
module2.exports = isexe;
|
|
41
|
+
isexe.sync = sync;
|
|
42
|
+
var fs16 = require("fs");
|
|
43
|
+
function checkPathExt(path13, options) {
|
|
44
|
+
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
45
|
+
if (!pathext) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
pathext = pathext.split(";");
|
|
49
|
+
if (pathext.indexOf("") !== -1) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
53
|
+
var p = pathext[i].toLowerCase();
|
|
54
|
+
if (p && path13.substr(-p.length).toLowerCase() === p) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
function checkStat(stat, path13, options) {
|
|
61
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return checkPathExt(path13, options);
|
|
65
|
+
}
|
|
66
|
+
function isexe(path13, options, cb) {
|
|
67
|
+
fs16.stat(path13, function(er, stat) {
|
|
68
|
+
cb(er, er ? false : checkStat(stat, path13, options));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function sync(path13, options) {
|
|
72
|
+
return checkStat(fs16.statSync(path13), path13, options);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
78
|
+
var require_mode = __commonJS({
|
|
79
|
+
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
|
|
80
|
+
"use strict";
|
|
81
|
+
module2.exports = isexe;
|
|
82
|
+
isexe.sync = sync;
|
|
83
|
+
var fs16 = require("fs");
|
|
84
|
+
function isexe(path13, options, cb) {
|
|
85
|
+
fs16.stat(path13, function(er, stat) {
|
|
86
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function sync(path13, options) {
|
|
90
|
+
return checkStat(fs16.statSync(path13), options);
|
|
91
|
+
}
|
|
92
|
+
function checkStat(stat, options) {
|
|
93
|
+
return stat.isFile() && checkMode(stat, options);
|
|
94
|
+
}
|
|
95
|
+
function checkMode(stat, options) {
|
|
96
|
+
var mod = stat.mode;
|
|
97
|
+
var uid = stat.uid;
|
|
98
|
+
var gid = stat.gid;
|
|
99
|
+
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
100
|
+
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
101
|
+
var u = parseInt("100", 8);
|
|
102
|
+
var g = parseInt("010", 8);
|
|
103
|
+
var o = parseInt("001", 8);
|
|
104
|
+
var ug = u | g;
|
|
105
|
+
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
106
|
+
return ret;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
112
|
+
var require_isexe = __commonJS({
|
|
113
|
+
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
|
|
114
|
+
"use strict";
|
|
115
|
+
var fs16 = require("fs");
|
|
116
|
+
var core;
|
|
117
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
118
|
+
core = require_windows();
|
|
119
|
+
} else {
|
|
120
|
+
core = require_mode();
|
|
121
|
+
}
|
|
122
|
+
module2.exports = isexe;
|
|
123
|
+
isexe.sync = sync;
|
|
124
|
+
function isexe(path13, options, cb) {
|
|
125
|
+
if (typeof options === "function") {
|
|
126
|
+
cb = options;
|
|
127
|
+
options = {};
|
|
128
|
+
}
|
|
129
|
+
if (!cb) {
|
|
130
|
+
if (typeof Promise !== "function") {
|
|
131
|
+
throw new TypeError("callback not provided");
|
|
132
|
+
}
|
|
133
|
+
return new Promise(function(resolve13, reject) {
|
|
134
|
+
isexe(path13, options || {}, function(er, is) {
|
|
135
|
+
if (er) {
|
|
136
|
+
reject(er);
|
|
137
|
+
} else {
|
|
138
|
+
resolve13(is);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
core(path13, options || {}, function(er, is) {
|
|
144
|
+
if (er) {
|
|
145
|
+
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
146
|
+
er = null;
|
|
147
|
+
is = false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
cb(er, is);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function sync(path13, options) {
|
|
154
|
+
try {
|
|
155
|
+
return core.sync(path13, options || {});
|
|
156
|
+
} catch (er) {
|
|
157
|
+
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
158
|
+
return false;
|
|
159
|
+
} else {
|
|
160
|
+
throw er;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
168
|
+
var require_which = __commonJS({
|
|
169
|
+
"node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
|
|
170
|
+
"use strict";
|
|
171
|
+
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
172
|
+
var path13 = require("path");
|
|
173
|
+
var COLON = isWindows ? ";" : ":";
|
|
174
|
+
var isexe = require_isexe();
|
|
175
|
+
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
176
|
+
var getPathInfo = (cmd, opt) => {
|
|
177
|
+
const colon = opt.colon || COLON;
|
|
178
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
179
|
+
// windows always checks the cwd first
|
|
180
|
+
...isWindows ? [process.cwd()] : [],
|
|
181
|
+
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
182
|
+
"").split(colon)
|
|
183
|
+
];
|
|
184
|
+
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
185
|
+
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
186
|
+
if (isWindows) {
|
|
187
|
+
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
188
|
+
pathExt.unshift("");
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
pathEnv,
|
|
192
|
+
pathExt,
|
|
193
|
+
pathExtExe
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
var which = (cmd, opt, cb) => {
|
|
197
|
+
if (typeof opt === "function") {
|
|
198
|
+
cb = opt;
|
|
199
|
+
opt = {};
|
|
200
|
+
}
|
|
201
|
+
if (!opt)
|
|
202
|
+
opt = {};
|
|
203
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
204
|
+
const found = [];
|
|
205
|
+
const step = (i) => new Promise((resolve13, reject) => {
|
|
206
|
+
if (i === pathEnv.length)
|
|
207
|
+
return opt.all && found.length ? resolve13(found) : reject(getNotFoundError(cmd));
|
|
208
|
+
const ppRaw = pathEnv[i];
|
|
209
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
210
|
+
const pCmd = path13.join(pathPart, cmd);
|
|
211
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
212
|
+
resolve13(subStep(p, i, 0));
|
|
213
|
+
});
|
|
214
|
+
const subStep = (p, i, ii) => new Promise((resolve13, reject) => {
|
|
215
|
+
if (ii === pathExt.length)
|
|
216
|
+
return resolve13(step(i + 1));
|
|
217
|
+
const ext = pathExt[ii];
|
|
218
|
+
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
219
|
+
if (!er && is) {
|
|
220
|
+
if (opt.all)
|
|
221
|
+
found.push(p + ext);
|
|
222
|
+
else
|
|
223
|
+
return resolve13(p + ext);
|
|
224
|
+
}
|
|
225
|
+
return resolve13(subStep(p, i, ii + 1));
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
229
|
+
};
|
|
230
|
+
var whichSync = (cmd, opt) => {
|
|
231
|
+
opt = opt || {};
|
|
232
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
233
|
+
const found = [];
|
|
234
|
+
for (let i = 0; i < pathEnv.length; i++) {
|
|
235
|
+
const ppRaw = pathEnv[i];
|
|
236
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
237
|
+
const pCmd = path13.join(pathPart, cmd);
|
|
238
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
239
|
+
for (let j = 0; j < pathExt.length; j++) {
|
|
240
|
+
const cur = p + pathExt[j];
|
|
241
|
+
try {
|
|
242
|
+
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
243
|
+
if (is) {
|
|
244
|
+
if (opt.all)
|
|
245
|
+
found.push(cur);
|
|
246
|
+
else
|
|
247
|
+
return cur;
|
|
248
|
+
}
|
|
249
|
+
} catch (ex) {
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (opt.all && found.length)
|
|
254
|
+
return found;
|
|
255
|
+
if (opt.nothrow)
|
|
256
|
+
return null;
|
|
257
|
+
throw getNotFoundError(cmd);
|
|
258
|
+
};
|
|
259
|
+
module2.exports = which;
|
|
260
|
+
which.sync = whichSync;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
265
|
+
var require_path_key = __commonJS({
|
|
266
|
+
"node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module2) {
|
|
267
|
+
"use strict";
|
|
268
|
+
var pathKey2 = (options = {}) => {
|
|
269
|
+
const environment = options.env || process.env;
|
|
270
|
+
const platform = options.platform || process.platform;
|
|
271
|
+
if (platform !== "win32") {
|
|
272
|
+
return "PATH";
|
|
273
|
+
}
|
|
274
|
+
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
275
|
+
};
|
|
276
|
+
module2.exports = pathKey2;
|
|
277
|
+
module2.exports.default = pathKey2;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
282
|
+
var require_resolveCommand = __commonJS({
|
|
283
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
|
|
284
|
+
"use strict";
|
|
285
|
+
var path13 = require("path");
|
|
286
|
+
var which = require_which();
|
|
287
|
+
var getPathKey = require_path_key();
|
|
288
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
289
|
+
const env = parsed.options.env || process.env;
|
|
290
|
+
const cwd = process.cwd();
|
|
291
|
+
const hasCustomCwd = parsed.options.cwd != null;
|
|
292
|
+
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
293
|
+
if (shouldSwitchCwd) {
|
|
294
|
+
try {
|
|
295
|
+
process.chdir(parsed.options.cwd);
|
|
296
|
+
} catch (err) {
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
let resolved;
|
|
300
|
+
try {
|
|
301
|
+
resolved = which.sync(parsed.command, {
|
|
302
|
+
path: env[getPathKey({ env })],
|
|
303
|
+
pathExt: withoutPathExt ? path13.delimiter : void 0
|
|
304
|
+
});
|
|
305
|
+
} catch (e) {
|
|
306
|
+
} finally {
|
|
307
|
+
if (shouldSwitchCwd) {
|
|
308
|
+
process.chdir(cwd);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (resolved) {
|
|
312
|
+
resolved = path13.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
313
|
+
}
|
|
314
|
+
return resolved;
|
|
315
|
+
}
|
|
316
|
+
function resolveCommand(parsed) {
|
|
317
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
318
|
+
}
|
|
319
|
+
module2.exports = resolveCommand;
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js
|
|
324
|
+
var require_escape = __commonJS({
|
|
325
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
|
|
326
|
+
"use strict";
|
|
327
|
+
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
328
|
+
function escapeCommand(arg) {
|
|
329
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
330
|
+
return arg;
|
|
331
|
+
}
|
|
332
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
333
|
+
arg = `${arg}`;
|
|
334
|
+
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
|
|
335
|
+
arg = arg.replace(/(\\*)$/, "$1$1");
|
|
336
|
+
arg = `"${arg}"`;
|
|
337
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
338
|
+
if (doubleEscapeMetaChars) {
|
|
339
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
340
|
+
}
|
|
341
|
+
return arg;
|
|
342
|
+
}
|
|
343
|
+
module2.exports.command = escapeCommand;
|
|
344
|
+
module2.exports.argument = escapeArgument;
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
349
|
+
var require_shebang_regex = __commonJS({
|
|
350
|
+
"node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module2) {
|
|
351
|
+
"use strict";
|
|
352
|
+
module2.exports = /^#!(.*)/;
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
// node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
357
|
+
var require_shebang_command = __commonJS({
|
|
358
|
+
"node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module2) {
|
|
359
|
+
"use strict";
|
|
360
|
+
var shebangRegex = require_shebang_regex();
|
|
361
|
+
module2.exports = (string = "") => {
|
|
362
|
+
const match = string.match(shebangRegex);
|
|
363
|
+
if (!match) {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
const [path13, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
367
|
+
const binary = path13.split("/").pop();
|
|
368
|
+
if (binary === "env") {
|
|
369
|
+
return argument;
|
|
370
|
+
}
|
|
371
|
+
return argument ? `${binary} ${argument}` : binary;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js
|
|
377
|
+
var require_readShebang = __commonJS({
|
|
378
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
|
|
379
|
+
"use strict";
|
|
380
|
+
var fs16 = require("fs");
|
|
381
|
+
var shebangCommand = require_shebang_command();
|
|
382
|
+
function readShebang(command) {
|
|
383
|
+
const size = 150;
|
|
384
|
+
const buffer = Buffer.alloc(size);
|
|
385
|
+
let fd;
|
|
386
|
+
try {
|
|
387
|
+
fd = fs16.openSync(command, "r");
|
|
388
|
+
fs16.readSync(fd, buffer, 0, size, 0);
|
|
389
|
+
fs16.closeSync(fd);
|
|
390
|
+
} catch (e) {
|
|
391
|
+
}
|
|
392
|
+
return shebangCommand(buffer.toString());
|
|
393
|
+
}
|
|
394
|
+
module2.exports = readShebang;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js
|
|
399
|
+
var require_parse = __commonJS({
|
|
400
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
|
|
401
|
+
"use strict";
|
|
402
|
+
var path13 = require("path");
|
|
403
|
+
var resolveCommand = require_resolveCommand();
|
|
404
|
+
var escape = require_escape();
|
|
405
|
+
var readShebang = require_readShebang();
|
|
406
|
+
var isWin = process.platform === "win32";
|
|
407
|
+
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
408
|
+
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
409
|
+
function detectShebang(parsed) {
|
|
410
|
+
parsed.file = resolveCommand(parsed);
|
|
411
|
+
const shebang = parsed.file && readShebang(parsed.file);
|
|
412
|
+
if (shebang) {
|
|
413
|
+
parsed.args.unshift(parsed.file);
|
|
414
|
+
parsed.command = shebang;
|
|
415
|
+
return resolveCommand(parsed);
|
|
416
|
+
}
|
|
417
|
+
return parsed.file;
|
|
418
|
+
}
|
|
419
|
+
function parseNonShell(parsed) {
|
|
420
|
+
if (!isWin) {
|
|
421
|
+
return parsed;
|
|
422
|
+
}
|
|
423
|
+
const commandFile = detectShebang(parsed);
|
|
424
|
+
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
425
|
+
if (parsed.options.forceShell || needsShell) {
|
|
426
|
+
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
427
|
+
parsed.command = path13.normalize(parsed.command);
|
|
428
|
+
parsed.command = escape.command(parsed.command);
|
|
429
|
+
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
430
|
+
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
431
|
+
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
432
|
+
parsed.command = process.env.comspec || "cmd.exe";
|
|
433
|
+
parsed.options.windowsVerbatimArguments = true;
|
|
434
|
+
}
|
|
435
|
+
return parsed;
|
|
436
|
+
}
|
|
437
|
+
function parse(command, args, options) {
|
|
438
|
+
if (args && !Array.isArray(args)) {
|
|
439
|
+
options = args;
|
|
440
|
+
args = null;
|
|
441
|
+
}
|
|
442
|
+
args = args ? args.slice(0) : [];
|
|
443
|
+
options = Object.assign({}, options);
|
|
444
|
+
const parsed = {
|
|
445
|
+
command,
|
|
446
|
+
args,
|
|
447
|
+
options,
|
|
448
|
+
file: void 0,
|
|
449
|
+
original: {
|
|
450
|
+
command,
|
|
451
|
+
args
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
return options.shell ? parsed : parseNonShell(parsed);
|
|
455
|
+
}
|
|
456
|
+
module2.exports = parse;
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js
|
|
461
|
+
var require_enoent = __commonJS({
|
|
462
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
|
|
463
|
+
"use strict";
|
|
464
|
+
var isWin = process.platform === "win32";
|
|
465
|
+
function notFoundError(original, syscall) {
|
|
466
|
+
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
467
|
+
code: "ENOENT",
|
|
468
|
+
errno: "ENOENT",
|
|
469
|
+
syscall: `${syscall} ${original.command}`,
|
|
470
|
+
path: original.command,
|
|
471
|
+
spawnargs: original.args
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
function hookChildProcess(cp, parsed) {
|
|
475
|
+
if (!isWin) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
const originalEmit = cp.emit;
|
|
479
|
+
cp.emit = function(name, arg1) {
|
|
480
|
+
if (name === "exit") {
|
|
481
|
+
const err = verifyENOENT(arg1, parsed, "spawn");
|
|
482
|
+
if (err) {
|
|
483
|
+
return originalEmit.call(cp, "error", err);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return originalEmit.apply(cp, arguments);
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function verifyENOENT(status, parsed) {
|
|
490
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
491
|
+
return notFoundError(parsed.original, "spawn");
|
|
492
|
+
}
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
function verifyENOENTSync(status, parsed) {
|
|
496
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
497
|
+
return notFoundError(parsed.original, "spawnSync");
|
|
498
|
+
}
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
module2.exports = {
|
|
502
|
+
hookChildProcess,
|
|
503
|
+
verifyENOENT,
|
|
504
|
+
verifyENOENTSync,
|
|
505
|
+
notFoundError
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js
|
|
511
|
+
var require_cross_spawn = __commonJS({
|
|
512
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js"(exports, module2) {
|
|
513
|
+
"use strict";
|
|
514
|
+
var cp = require("child_process");
|
|
515
|
+
var parse = require_parse();
|
|
516
|
+
var enoent = require_enoent();
|
|
517
|
+
function spawn(command, args, options) {
|
|
518
|
+
const parsed = parse(command, args, options);
|
|
519
|
+
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
520
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
521
|
+
return spawned;
|
|
522
|
+
}
|
|
523
|
+
function spawnSync(command, args, options) {
|
|
524
|
+
const parsed = parse(command, args, options);
|
|
525
|
+
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
526
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
527
|
+
return result;
|
|
528
|
+
}
|
|
529
|
+
module2.exports = spawn;
|
|
530
|
+
module2.exports.spawn = spawn;
|
|
531
|
+
module2.exports.sync = spawnSync;
|
|
532
|
+
module2.exports._parse = parse;
|
|
533
|
+
module2.exports._enoent = enoent;
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
// node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js
|
|
538
|
+
function stripFinalNewline(input) {
|
|
539
|
+
const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
|
|
540
|
+
const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
|
|
541
|
+
if (input[input.length - 1] === LF) {
|
|
542
|
+
input = input.slice(0, -1);
|
|
543
|
+
}
|
|
544
|
+
if (input[input.length - 1] === CR) {
|
|
545
|
+
input = input.slice(0, -1);
|
|
546
|
+
}
|
|
547
|
+
return input;
|
|
548
|
+
}
|
|
549
|
+
var init_strip_final_newline = __esm({
|
|
550
|
+
"node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js"() {
|
|
551
|
+
"use strict";
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
// node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
|
556
|
+
function pathKey(options = {}) {
|
|
557
|
+
const {
|
|
558
|
+
env = process.env,
|
|
559
|
+
platform = process.platform
|
|
560
|
+
} = options;
|
|
561
|
+
if (platform !== "win32") {
|
|
562
|
+
return "PATH";
|
|
563
|
+
}
|
|
564
|
+
return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
565
|
+
}
|
|
566
|
+
var init_path_key = __esm({
|
|
567
|
+
"node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js"() {
|
|
568
|
+
"use strict";
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
// node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js
|
|
573
|
+
function npmRunPath(options = {}) {
|
|
574
|
+
const {
|
|
575
|
+
cwd = import_node_process.default.cwd(),
|
|
576
|
+
path: path_ = import_node_process.default.env[pathKey()],
|
|
577
|
+
execPath = import_node_process.default.execPath
|
|
578
|
+
} = options;
|
|
579
|
+
let previous;
|
|
580
|
+
const cwdString = cwd instanceof URL ? import_node_url.default.fileURLToPath(cwd) : cwd;
|
|
581
|
+
let cwdPath = import_node_path2.default.resolve(cwdString);
|
|
582
|
+
const result = [];
|
|
583
|
+
while (previous !== cwdPath) {
|
|
584
|
+
result.push(import_node_path2.default.join(cwdPath, "node_modules/.bin"));
|
|
585
|
+
previous = cwdPath;
|
|
586
|
+
cwdPath = import_node_path2.default.resolve(cwdPath, "..");
|
|
587
|
+
}
|
|
588
|
+
result.push(import_node_path2.default.resolve(cwdString, execPath, ".."));
|
|
589
|
+
return [...result, path_].join(import_node_path2.default.delimiter);
|
|
590
|
+
}
|
|
591
|
+
function npmRunPathEnv({ env = import_node_process.default.env, ...options } = {}) {
|
|
592
|
+
env = { ...env };
|
|
593
|
+
const path13 = pathKey({ env });
|
|
594
|
+
options.path = env[path13];
|
|
595
|
+
env[path13] = npmRunPath(options);
|
|
596
|
+
return env;
|
|
597
|
+
}
|
|
598
|
+
var import_node_process, import_node_path2, import_node_url;
|
|
599
|
+
var init_npm_run_path = __esm({
|
|
600
|
+
"node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js"() {
|
|
601
|
+
"use strict";
|
|
602
|
+
import_node_process = __toESM(require("process"), 1);
|
|
603
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
604
|
+
import_node_url = __toESM(require("url"), 1);
|
|
605
|
+
init_path_key();
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
// node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js
|
|
610
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
611
|
+
const { name } = to;
|
|
612
|
+
for (const property of Reflect.ownKeys(from)) {
|
|
613
|
+
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
614
|
+
}
|
|
615
|
+
changePrototype(to, from);
|
|
616
|
+
changeToString(to, from, name);
|
|
617
|
+
return to;
|
|
618
|
+
}
|
|
619
|
+
var copyProperty, canCopyProperty, changePrototype, wrappedToString, toStringDescriptor, toStringName, changeToString;
|
|
620
|
+
var init_mimic_fn = __esm({
|
|
621
|
+
"node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js"() {
|
|
622
|
+
"use strict";
|
|
623
|
+
copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
624
|
+
if (property === "length" || property === "prototype") {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
if (property === "arguments" || property === "caller") {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
631
|
+
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
632
|
+
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
Object.defineProperty(to, property, fromDescriptor);
|
|
636
|
+
};
|
|
637
|
+
canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
638
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
639
|
+
};
|
|
640
|
+
changePrototype = (to, from) => {
|
|
641
|
+
const fromPrototype = Object.getPrototypeOf(from);
|
|
642
|
+
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
Object.setPrototypeOf(to, fromPrototype);
|
|
646
|
+
};
|
|
647
|
+
wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
648
|
+
${fromBody}`;
|
|
649
|
+
toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
650
|
+
toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
651
|
+
changeToString = (to, from, name) => {
|
|
652
|
+
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
653
|
+
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
654
|
+
Object.defineProperty(newToString, "name", toStringName);
|
|
655
|
+
Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
// node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js
|
|
661
|
+
var calledFunctions, onetime, onetime_default;
|
|
662
|
+
var init_onetime = __esm({
|
|
663
|
+
"node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js"() {
|
|
664
|
+
"use strict";
|
|
665
|
+
init_mimic_fn();
|
|
666
|
+
calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
667
|
+
onetime = (function_, options = {}) => {
|
|
668
|
+
if (typeof function_ !== "function") {
|
|
669
|
+
throw new TypeError("Expected a function");
|
|
670
|
+
}
|
|
671
|
+
let returnValue;
|
|
672
|
+
let callCount = 0;
|
|
673
|
+
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
674
|
+
const onetime2 = function(...arguments_) {
|
|
675
|
+
calledFunctions.set(onetime2, ++callCount);
|
|
676
|
+
if (callCount === 1) {
|
|
677
|
+
returnValue = function_.apply(this, arguments_);
|
|
678
|
+
function_ = null;
|
|
679
|
+
} else if (options.throw === true) {
|
|
680
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
681
|
+
}
|
|
682
|
+
return returnValue;
|
|
683
|
+
};
|
|
684
|
+
mimicFunction(onetime2, function_);
|
|
685
|
+
calledFunctions.set(onetime2, callCount);
|
|
686
|
+
return onetime2;
|
|
687
|
+
};
|
|
688
|
+
onetime.callCount = (function_) => {
|
|
689
|
+
if (!calledFunctions.has(function_)) {
|
|
690
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
691
|
+
}
|
|
692
|
+
return calledFunctions.get(function_);
|
|
693
|
+
};
|
|
694
|
+
onetime_default = onetime;
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/realtime.js
|
|
699
|
+
var getRealtimeSignals, getRealtimeSignal, SIGRTMIN, SIGRTMAX;
|
|
700
|
+
var init_realtime = __esm({
|
|
701
|
+
"node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/realtime.js"() {
|
|
702
|
+
"use strict";
|
|
703
|
+
getRealtimeSignals = () => {
|
|
704
|
+
const length = SIGRTMAX - SIGRTMIN + 1;
|
|
705
|
+
return Array.from({ length }, getRealtimeSignal);
|
|
706
|
+
};
|
|
707
|
+
getRealtimeSignal = (value, index) => ({
|
|
708
|
+
name: `SIGRT${index + 1}`,
|
|
709
|
+
number: SIGRTMIN + index,
|
|
710
|
+
action: "terminate",
|
|
711
|
+
description: "Application-specific signal (realtime)",
|
|
712
|
+
standard: "posix"
|
|
713
|
+
});
|
|
714
|
+
SIGRTMIN = 34;
|
|
715
|
+
SIGRTMAX = 64;
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
|
|
719
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/core.js
|
|
720
|
+
var SIGNALS;
|
|
721
|
+
var init_core = __esm({
|
|
722
|
+
"node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/core.js"() {
|
|
723
|
+
"use strict";
|
|
724
|
+
SIGNALS = [
|
|
725
|
+
{
|
|
726
|
+
name: "SIGHUP",
|
|
727
|
+
number: 1,
|
|
728
|
+
action: "terminate",
|
|
729
|
+
description: "Terminal closed",
|
|
730
|
+
standard: "posix"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
name: "SIGINT",
|
|
734
|
+
number: 2,
|
|
735
|
+
action: "terminate",
|
|
736
|
+
description: "User interruption with CTRL-C",
|
|
737
|
+
standard: "ansi"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
name: "SIGQUIT",
|
|
741
|
+
number: 3,
|
|
742
|
+
action: "core",
|
|
743
|
+
description: "User interruption with CTRL-\\",
|
|
744
|
+
standard: "posix"
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
name: "SIGILL",
|
|
748
|
+
number: 4,
|
|
749
|
+
action: "core",
|
|
750
|
+
description: "Invalid machine instruction",
|
|
751
|
+
standard: "ansi"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
name: "SIGTRAP",
|
|
755
|
+
number: 5,
|
|
756
|
+
action: "core",
|
|
757
|
+
description: "Debugger breakpoint",
|
|
758
|
+
standard: "posix"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
name: "SIGABRT",
|
|
762
|
+
number: 6,
|
|
763
|
+
action: "core",
|
|
764
|
+
description: "Aborted",
|
|
765
|
+
standard: "ansi"
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
name: "SIGIOT",
|
|
769
|
+
number: 6,
|
|
770
|
+
action: "core",
|
|
771
|
+
description: "Aborted",
|
|
772
|
+
standard: "bsd"
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
name: "SIGBUS",
|
|
776
|
+
number: 7,
|
|
777
|
+
action: "core",
|
|
778
|
+
description: "Bus error due to misaligned, non-existing address or paging error",
|
|
779
|
+
standard: "bsd"
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
name: "SIGEMT",
|
|
783
|
+
number: 7,
|
|
784
|
+
action: "terminate",
|
|
785
|
+
description: "Command should be emulated but is not implemented",
|
|
786
|
+
standard: "other"
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
name: "SIGFPE",
|
|
790
|
+
number: 8,
|
|
791
|
+
action: "core",
|
|
792
|
+
description: "Floating point arithmetic error",
|
|
793
|
+
standard: "ansi"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
name: "SIGKILL",
|
|
797
|
+
number: 9,
|
|
798
|
+
action: "terminate",
|
|
799
|
+
description: "Forced termination",
|
|
800
|
+
standard: "posix",
|
|
801
|
+
forced: true
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: "SIGUSR1",
|
|
805
|
+
number: 10,
|
|
806
|
+
action: "terminate",
|
|
807
|
+
description: "Application-specific signal",
|
|
808
|
+
standard: "posix"
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
name: "SIGSEGV",
|
|
812
|
+
number: 11,
|
|
813
|
+
action: "core",
|
|
814
|
+
description: "Segmentation fault",
|
|
815
|
+
standard: "ansi"
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
name: "SIGUSR2",
|
|
819
|
+
number: 12,
|
|
820
|
+
action: "terminate",
|
|
821
|
+
description: "Application-specific signal",
|
|
822
|
+
standard: "posix"
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
name: "SIGPIPE",
|
|
826
|
+
number: 13,
|
|
827
|
+
action: "terminate",
|
|
828
|
+
description: "Broken pipe or socket",
|
|
829
|
+
standard: "posix"
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
name: "SIGALRM",
|
|
833
|
+
number: 14,
|
|
834
|
+
action: "terminate",
|
|
835
|
+
description: "Timeout or timer",
|
|
836
|
+
standard: "posix"
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
name: "SIGTERM",
|
|
840
|
+
number: 15,
|
|
841
|
+
action: "terminate",
|
|
842
|
+
description: "Termination",
|
|
843
|
+
standard: "ansi"
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
name: "SIGSTKFLT",
|
|
847
|
+
number: 16,
|
|
848
|
+
action: "terminate",
|
|
849
|
+
description: "Stack is empty or overflowed",
|
|
850
|
+
standard: "other"
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
name: "SIGCHLD",
|
|
854
|
+
number: 17,
|
|
855
|
+
action: "ignore",
|
|
856
|
+
description: "Child process terminated, paused or unpaused",
|
|
857
|
+
standard: "posix"
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
name: "SIGCLD",
|
|
861
|
+
number: 17,
|
|
862
|
+
action: "ignore",
|
|
863
|
+
description: "Child process terminated, paused or unpaused",
|
|
864
|
+
standard: "other"
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
name: "SIGCONT",
|
|
868
|
+
number: 18,
|
|
869
|
+
action: "unpause",
|
|
870
|
+
description: "Unpaused",
|
|
871
|
+
standard: "posix",
|
|
872
|
+
forced: true
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
name: "SIGSTOP",
|
|
876
|
+
number: 19,
|
|
877
|
+
action: "pause",
|
|
878
|
+
description: "Paused",
|
|
879
|
+
standard: "posix",
|
|
880
|
+
forced: true
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
name: "SIGTSTP",
|
|
884
|
+
number: 20,
|
|
885
|
+
action: "pause",
|
|
886
|
+
description: 'Paused using CTRL-Z or "suspend"',
|
|
887
|
+
standard: "posix"
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
name: "SIGTTIN",
|
|
891
|
+
number: 21,
|
|
892
|
+
action: "pause",
|
|
893
|
+
description: "Background process cannot read terminal input",
|
|
894
|
+
standard: "posix"
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
name: "SIGBREAK",
|
|
898
|
+
number: 21,
|
|
899
|
+
action: "terminate",
|
|
900
|
+
description: "User interruption with CTRL-BREAK",
|
|
901
|
+
standard: "other"
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
name: "SIGTTOU",
|
|
905
|
+
number: 22,
|
|
906
|
+
action: "pause",
|
|
907
|
+
description: "Background process cannot write to terminal output",
|
|
908
|
+
standard: "posix"
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
name: "SIGURG",
|
|
912
|
+
number: 23,
|
|
913
|
+
action: "ignore",
|
|
914
|
+
description: "Socket received out-of-band data",
|
|
915
|
+
standard: "bsd"
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
name: "SIGXCPU",
|
|
919
|
+
number: 24,
|
|
920
|
+
action: "core",
|
|
921
|
+
description: "Process timed out",
|
|
922
|
+
standard: "bsd"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
name: "SIGXFSZ",
|
|
926
|
+
number: 25,
|
|
927
|
+
action: "core",
|
|
928
|
+
description: "File too big",
|
|
929
|
+
standard: "bsd"
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
name: "SIGVTALRM",
|
|
933
|
+
number: 26,
|
|
934
|
+
action: "terminate",
|
|
935
|
+
description: "Timeout or timer",
|
|
936
|
+
standard: "bsd"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
name: "SIGPROF",
|
|
940
|
+
number: 27,
|
|
941
|
+
action: "terminate",
|
|
942
|
+
description: "Timeout or timer",
|
|
943
|
+
standard: "bsd"
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
name: "SIGWINCH",
|
|
947
|
+
number: 28,
|
|
948
|
+
action: "ignore",
|
|
949
|
+
description: "Terminal window size changed",
|
|
950
|
+
standard: "bsd"
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
name: "SIGIO",
|
|
954
|
+
number: 29,
|
|
955
|
+
action: "terminate",
|
|
956
|
+
description: "I/O is available",
|
|
957
|
+
standard: "other"
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
name: "SIGPOLL",
|
|
961
|
+
number: 29,
|
|
962
|
+
action: "terminate",
|
|
963
|
+
description: "Watched event",
|
|
964
|
+
standard: "other"
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
name: "SIGINFO",
|
|
968
|
+
number: 29,
|
|
969
|
+
action: "ignore",
|
|
970
|
+
description: "Request for process information",
|
|
971
|
+
standard: "other"
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
name: "SIGPWR",
|
|
975
|
+
number: 30,
|
|
976
|
+
action: "terminate",
|
|
977
|
+
description: "Device running out of power",
|
|
978
|
+
standard: "systemv"
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
name: "SIGSYS",
|
|
982
|
+
number: 31,
|
|
983
|
+
action: "core",
|
|
984
|
+
description: "Invalid system call",
|
|
985
|
+
standard: "other"
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
name: "SIGUNUSED",
|
|
989
|
+
number: 31,
|
|
990
|
+
action: "terminate",
|
|
991
|
+
description: "Invalid system call",
|
|
992
|
+
standard: "other"
|
|
993
|
+
}
|
|
994
|
+
];
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
|
|
998
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
|
|
999
|
+
var import_node_os, getSignals, normalizeSignal;
|
|
1000
|
+
var init_signals = __esm({
|
|
1001
|
+
"node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js"() {
|
|
1002
|
+
"use strict";
|
|
1003
|
+
import_node_os = require("os");
|
|
1004
|
+
init_core();
|
|
1005
|
+
init_realtime();
|
|
1006
|
+
getSignals = () => {
|
|
1007
|
+
const realtimeSignals = getRealtimeSignals();
|
|
1008
|
+
const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
|
|
1009
|
+
return signals2;
|
|
1010
|
+
};
|
|
1011
|
+
normalizeSignal = ({
|
|
1012
|
+
name,
|
|
1013
|
+
number: defaultNumber,
|
|
1014
|
+
description,
|
|
1015
|
+
action,
|
|
1016
|
+
forced = false,
|
|
1017
|
+
standard
|
|
1018
|
+
}) => {
|
|
1019
|
+
const {
|
|
1020
|
+
signals: { [name]: constantSignal }
|
|
1021
|
+
} = import_node_os.constants;
|
|
1022
|
+
const supported = constantSignal !== void 0;
|
|
1023
|
+
const number = supported ? constantSignal : defaultNumber;
|
|
1024
|
+
return { name, number, description, supported, action, forced, standard };
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
// node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
|
|
1030
|
+
var import_node_os2, getSignalsByName, getSignalByName, signalsByName, getSignalsByNumber, getSignalByNumber, findSignalByNumber, signalsByNumber;
|
|
1031
|
+
var init_main = __esm({
|
|
1032
|
+
"node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js"() {
|
|
1033
|
+
"use strict";
|
|
1034
|
+
import_node_os2 = require("os");
|
|
1035
|
+
init_realtime();
|
|
1036
|
+
init_signals();
|
|
1037
|
+
getSignalsByName = () => {
|
|
1038
|
+
const signals2 = getSignals();
|
|
1039
|
+
return Object.fromEntries(signals2.map(getSignalByName));
|
|
1040
|
+
};
|
|
1041
|
+
getSignalByName = ({
|
|
1042
|
+
name,
|
|
1043
|
+
number,
|
|
1044
|
+
description,
|
|
1045
|
+
supported,
|
|
1046
|
+
action,
|
|
1047
|
+
forced,
|
|
1048
|
+
standard
|
|
1049
|
+
}) => [name, { name, number, description, supported, action, forced, standard }];
|
|
1050
|
+
signalsByName = getSignalsByName();
|
|
1051
|
+
getSignalsByNumber = () => {
|
|
1052
|
+
const signals2 = getSignals();
|
|
1053
|
+
const length = SIGRTMAX + 1;
|
|
1054
|
+
const signalsA = Array.from(
|
|
1055
|
+
{ length },
|
|
1056
|
+
(value, number) => getSignalByNumber(number, signals2)
|
|
1057
|
+
);
|
|
1058
|
+
return Object.assign({}, ...signalsA);
|
|
1059
|
+
};
|
|
1060
|
+
getSignalByNumber = (number, signals2) => {
|
|
1061
|
+
const signal = findSignalByNumber(number, signals2);
|
|
1062
|
+
if (signal === void 0) {
|
|
1063
|
+
return {};
|
|
1064
|
+
}
|
|
1065
|
+
const { name, description, supported, action, forced, standard } = signal;
|
|
1066
|
+
return {
|
|
1067
|
+
[number]: {
|
|
1068
|
+
name,
|
|
1069
|
+
number,
|
|
1070
|
+
description,
|
|
1071
|
+
supported,
|
|
1072
|
+
action,
|
|
1073
|
+
forced,
|
|
1074
|
+
standard
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
};
|
|
1078
|
+
findSignalByNumber = (number, signals2) => {
|
|
1079
|
+
const signal = signals2.find(({ name }) => import_node_os2.constants.signals[name] === number);
|
|
1080
|
+
if (signal !== void 0) {
|
|
1081
|
+
return signal;
|
|
1082
|
+
}
|
|
1083
|
+
return signals2.find((signalA) => signalA.number === number);
|
|
1084
|
+
};
|
|
1085
|
+
signalsByNumber = getSignalsByNumber();
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
|
|
1090
|
+
var import_node_process2, getErrorPrefix, makeError;
|
|
1091
|
+
var init_error = __esm({
|
|
1092
|
+
"node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js"() {
|
|
1093
|
+
"use strict";
|
|
1094
|
+
import_node_process2 = __toESM(require("process"), 1);
|
|
1095
|
+
init_main();
|
|
1096
|
+
getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
|
|
1097
|
+
if (timedOut) {
|
|
1098
|
+
return `timed out after ${timeout} milliseconds`;
|
|
1099
|
+
}
|
|
1100
|
+
if (isCanceled) {
|
|
1101
|
+
return "was canceled";
|
|
1102
|
+
}
|
|
1103
|
+
if (errorCode !== void 0) {
|
|
1104
|
+
return `failed with ${errorCode}`;
|
|
1105
|
+
}
|
|
1106
|
+
if (signal !== void 0) {
|
|
1107
|
+
return `was killed with ${signal} (${signalDescription})`;
|
|
1108
|
+
}
|
|
1109
|
+
if (exitCode !== void 0) {
|
|
1110
|
+
return `failed with exit code ${exitCode}`;
|
|
1111
|
+
}
|
|
1112
|
+
return "failed";
|
|
1113
|
+
};
|
|
1114
|
+
makeError = ({
|
|
1115
|
+
stdout,
|
|
1116
|
+
stderr,
|
|
1117
|
+
all,
|
|
1118
|
+
error,
|
|
1119
|
+
signal,
|
|
1120
|
+
exitCode,
|
|
1121
|
+
command,
|
|
1122
|
+
escapedCommand,
|
|
1123
|
+
timedOut,
|
|
1124
|
+
isCanceled,
|
|
1125
|
+
killed,
|
|
1126
|
+
parsed: { options: { timeout, cwd = import_node_process2.default.cwd() } }
|
|
1127
|
+
}) => {
|
|
1128
|
+
exitCode = exitCode === null ? void 0 : exitCode;
|
|
1129
|
+
signal = signal === null ? void 0 : signal;
|
|
1130
|
+
const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
|
|
1131
|
+
const errorCode = error && error.code;
|
|
1132
|
+
const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
|
|
1133
|
+
const execaMessage = `Command ${prefix}: ${command}`;
|
|
1134
|
+
const isError = Object.prototype.toString.call(error) === "[object Error]";
|
|
1135
|
+
const shortMessage = isError ? `${execaMessage}
|
|
1136
|
+
${error.message}` : execaMessage;
|
|
1137
|
+
const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
|
|
1138
|
+
if (isError) {
|
|
1139
|
+
error.originalMessage = error.message;
|
|
1140
|
+
error.message = message;
|
|
1141
|
+
} else {
|
|
1142
|
+
error = new Error(message);
|
|
1143
|
+
}
|
|
1144
|
+
error.shortMessage = shortMessage;
|
|
1145
|
+
error.command = command;
|
|
1146
|
+
error.escapedCommand = escapedCommand;
|
|
1147
|
+
error.exitCode = exitCode;
|
|
1148
|
+
error.signal = signal;
|
|
1149
|
+
error.signalDescription = signalDescription;
|
|
1150
|
+
error.stdout = stdout;
|
|
1151
|
+
error.stderr = stderr;
|
|
1152
|
+
error.cwd = cwd;
|
|
1153
|
+
if (all !== void 0) {
|
|
1154
|
+
error.all = all;
|
|
1155
|
+
}
|
|
1156
|
+
if ("bufferedData" in error) {
|
|
1157
|
+
delete error.bufferedData;
|
|
1158
|
+
}
|
|
1159
|
+
error.failed = true;
|
|
1160
|
+
error.timedOut = Boolean(timedOut);
|
|
1161
|
+
error.isCanceled = isCanceled;
|
|
1162
|
+
error.killed = killed && !timedOut;
|
|
1163
|
+
return error;
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
});
|
|
1167
|
+
|
|
1168
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stdio.js
|
|
1169
|
+
var aliases, hasAlias, normalizeStdio, normalizeStdioNode;
|
|
1170
|
+
var init_stdio = __esm({
|
|
1171
|
+
"node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stdio.js"() {
|
|
1172
|
+
"use strict";
|
|
1173
|
+
aliases = ["stdin", "stdout", "stderr"];
|
|
1174
|
+
hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
|
|
1175
|
+
normalizeStdio = (options) => {
|
|
1176
|
+
if (!options) {
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
const { stdio } = options;
|
|
1180
|
+
if (stdio === void 0) {
|
|
1181
|
+
return aliases.map((alias) => options[alias]);
|
|
1182
|
+
}
|
|
1183
|
+
if (hasAlias(options)) {
|
|
1184
|
+
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
|
|
1185
|
+
}
|
|
1186
|
+
if (typeof stdio === "string") {
|
|
1187
|
+
return stdio;
|
|
1188
|
+
}
|
|
1189
|
+
if (!Array.isArray(stdio)) {
|
|
1190
|
+
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
1191
|
+
}
|
|
1192
|
+
const length = Math.max(stdio.length, aliases.length);
|
|
1193
|
+
return Array.from({ length }, (value, index) => stdio[index]);
|
|
1194
|
+
};
|
|
1195
|
+
normalizeStdioNode = (options) => {
|
|
1196
|
+
const stdio = normalizeStdio(options);
|
|
1197
|
+
if (stdio === "ipc") {
|
|
1198
|
+
return "ipc";
|
|
1199
|
+
}
|
|
1200
|
+
if (stdio === void 0 || typeof stdio === "string") {
|
|
1201
|
+
return [stdio, stdio, stdio, "ipc"];
|
|
1202
|
+
}
|
|
1203
|
+
if (stdio.includes("ipc")) {
|
|
1204
|
+
return stdio;
|
|
1205
|
+
}
|
|
1206
|
+
return [...stdio, "ipc"];
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
1212
|
+
var signals;
|
|
1213
|
+
var init_signals2 = __esm({
|
|
1214
|
+
"node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js"() {
|
|
1215
|
+
"use strict";
|
|
1216
|
+
signals = [];
|
|
1217
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
1218
|
+
if (process.platform !== "win32") {
|
|
1219
|
+
signals.push(
|
|
1220
|
+
"SIGALRM",
|
|
1221
|
+
"SIGABRT",
|
|
1222
|
+
"SIGVTALRM",
|
|
1223
|
+
"SIGXCPU",
|
|
1224
|
+
"SIGXFSZ",
|
|
1225
|
+
"SIGUSR2",
|
|
1226
|
+
"SIGTRAP",
|
|
1227
|
+
"SIGSYS",
|
|
1228
|
+
"SIGQUIT",
|
|
1229
|
+
"SIGIOT"
|
|
1230
|
+
// should detect profiler and enable/disable accordingly.
|
|
1231
|
+
// see #21
|
|
1232
|
+
// 'SIGPROF'
|
|
1233
|
+
);
|
|
1234
|
+
}
|
|
1235
|
+
if (process.platform === "linux") {
|
|
1236
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
|
|
1241
|
+
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
1242
|
+
var processOk, kExitEmitter, global2, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, SignalExit, process4, onExit, load, unload;
|
|
1243
|
+
var init_mjs = __esm({
|
|
1244
|
+
"node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js"() {
|
|
1245
|
+
"use strict";
|
|
1246
|
+
init_signals2();
|
|
1247
|
+
processOk = (process7) => !!process7 && typeof process7 === "object" && typeof process7.removeListener === "function" && typeof process7.emit === "function" && typeof process7.reallyExit === "function" && typeof process7.listeners === "function" && typeof process7.kill === "function" && typeof process7.pid === "number" && typeof process7.on === "function";
|
|
1248
|
+
kExitEmitter = Symbol.for("signal-exit emitter");
|
|
1249
|
+
global2 = globalThis;
|
|
1250
|
+
ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
1251
|
+
Emitter = class {
|
|
1252
|
+
emitted = {
|
|
1253
|
+
afterExit: false,
|
|
1254
|
+
exit: false
|
|
1255
|
+
};
|
|
1256
|
+
listeners = {
|
|
1257
|
+
afterExit: [],
|
|
1258
|
+
exit: []
|
|
1259
|
+
};
|
|
1260
|
+
count = 0;
|
|
1261
|
+
id = Math.random();
|
|
1262
|
+
constructor() {
|
|
1263
|
+
if (global2[kExitEmitter]) {
|
|
1264
|
+
return global2[kExitEmitter];
|
|
1265
|
+
}
|
|
1266
|
+
ObjectDefineProperty(global2, kExitEmitter, {
|
|
1267
|
+
value: this,
|
|
1268
|
+
writable: false,
|
|
1269
|
+
enumerable: false,
|
|
1270
|
+
configurable: false
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
on(ev, fn) {
|
|
1274
|
+
this.listeners[ev].push(fn);
|
|
1275
|
+
}
|
|
1276
|
+
removeListener(ev, fn) {
|
|
1277
|
+
const list = this.listeners[ev];
|
|
1278
|
+
const i = list.indexOf(fn);
|
|
1279
|
+
if (i === -1) {
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
if (i === 0 && list.length === 1) {
|
|
1283
|
+
list.length = 0;
|
|
1284
|
+
} else {
|
|
1285
|
+
list.splice(i, 1);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
emit(ev, code, signal) {
|
|
1289
|
+
if (this.emitted[ev]) {
|
|
1290
|
+
return false;
|
|
1291
|
+
}
|
|
1292
|
+
this.emitted[ev] = true;
|
|
1293
|
+
let ret = false;
|
|
1294
|
+
for (const fn of this.listeners[ev]) {
|
|
1295
|
+
ret = fn(code, signal) === true || ret;
|
|
1296
|
+
}
|
|
1297
|
+
if (ev === "exit") {
|
|
1298
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
1299
|
+
}
|
|
1300
|
+
return ret;
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
SignalExitBase = class {
|
|
1304
|
+
};
|
|
1305
|
+
signalExitWrap = (handler) => {
|
|
1306
|
+
return {
|
|
1307
|
+
onExit(cb, opts) {
|
|
1308
|
+
return handler.onExit(cb, opts);
|
|
1309
|
+
},
|
|
1310
|
+
load() {
|
|
1311
|
+
return handler.load();
|
|
1312
|
+
},
|
|
1313
|
+
unload() {
|
|
1314
|
+
return handler.unload();
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
};
|
|
1318
|
+
SignalExitFallback = class extends SignalExitBase {
|
|
1319
|
+
onExit() {
|
|
1320
|
+
return () => {
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
load() {
|
|
1324
|
+
}
|
|
1325
|
+
unload() {
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
SignalExit = class extends SignalExitBase {
|
|
1329
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
1330
|
+
// so use a supported signal instead
|
|
1331
|
+
/* c8 ignore start */
|
|
1332
|
+
#hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
1333
|
+
/* c8 ignore stop */
|
|
1334
|
+
#emitter = new Emitter();
|
|
1335
|
+
#process;
|
|
1336
|
+
#originalProcessEmit;
|
|
1337
|
+
#originalProcessReallyExit;
|
|
1338
|
+
#sigListeners = {};
|
|
1339
|
+
#loaded = false;
|
|
1340
|
+
constructor(process7) {
|
|
1341
|
+
super();
|
|
1342
|
+
this.#process = process7;
|
|
1343
|
+
this.#sigListeners = {};
|
|
1344
|
+
for (const sig of signals) {
|
|
1345
|
+
this.#sigListeners[sig] = () => {
|
|
1346
|
+
const listeners = this.#process.listeners(sig);
|
|
1347
|
+
let { count } = this.#emitter;
|
|
1348
|
+
const p = process7;
|
|
1349
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
1350
|
+
count += p.__signal_exit_emitter__.count;
|
|
1351
|
+
}
|
|
1352
|
+
if (listeners.length === count) {
|
|
1353
|
+
this.unload();
|
|
1354
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
1355
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
1356
|
+
if (!ret)
|
|
1357
|
+
process7.kill(process7.pid, s);
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
this.#originalProcessReallyExit = process7.reallyExit;
|
|
1362
|
+
this.#originalProcessEmit = process7.emit;
|
|
1363
|
+
}
|
|
1364
|
+
onExit(cb, opts) {
|
|
1365
|
+
if (!processOk(this.#process)) {
|
|
1366
|
+
return () => {
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
if (this.#loaded === false) {
|
|
1370
|
+
this.load();
|
|
1371
|
+
}
|
|
1372
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
1373
|
+
this.#emitter.on(ev, cb);
|
|
1374
|
+
return () => {
|
|
1375
|
+
this.#emitter.removeListener(ev, cb);
|
|
1376
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
1377
|
+
this.unload();
|
|
1378
|
+
}
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
load() {
|
|
1382
|
+
if (this.#loaded) {
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1385
|
+
this.#loaded = true;
|
|
1386
|
+
this.#emitter.count += 1;
|
|
1387
|
+
for (const sig of signals) {
|
|
1388
|
+
try {
|
|
1389
|
+
const fn = this.#sigListeners[sig];
|
|
1390
|
+
if (fn)
|
|
1391
|
+
this.#process.on(sig, fn);
|
|
1392
|
+
} catch (_) {
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
this.#process.emit = (ev, ...a) => {
|
|
1396
|
+
return this.#processEmit(ev, ...a);
|
|
1397
|
+
};
|
|
1398
|
+
this.#process.reallyExit = (code) => {
|
|
1399
|
+
return this.#processReallyExit(code);
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
unload() {
|
|
1403
|
+
if (!this.#loaded) {
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
this.#loaded = false;
|
|
1407
|
+
signals.forEach((sig) => {
|
|
1408
|
+
const listener = this.#sigListeners[sig];
|
|
1409
|
+
if (!listener) {
|
|
1410
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
1411
|
+
}
|
|
1412
|
+
try {
|
|
1413
|
+
this.#process.removeListener(sig, listener);
|
|
1414
|
+
} catch (_) {
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1417
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
1418
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
1419
|
+
this.#emitter.count -= 1;
|
|
1420
|
+
}
|
|
1421
|
+
#processReallyExit(code) {
|
|
1422
|
+
if (!processOk(this.#process)) {
|
|
1423
|
+
return 0;
|
|
1424
|
+
}
|
|
1425
|
+
this.#process.exitCode = code || 0;
|
|
1426
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1427
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
1428
|
+
}
|
|
1429
|
+
#processEmit(ev, ...args) {
|
|
1430
|
+
const og = this.#originalProcessEmit;
|
|
1431
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
1432
|
+
if (typeof args[0] === "number") {
|
|
1433
|
+
this.#process.exitCode = args[0];
|
|
1434
|
+
}
|
|
1435
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
1436
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1437
|
+
return ret;
|
|
1438
|
+
} else {
|
|
1439
|
+
return og.call(this.#process, ev, ...args);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
process4 = globalThis.process;
|
|
1444
|
+
({
|
|
1445
|
+
onExit: (
|
|
1446
|
+
/**
|
|
1447
|
+
* Called when the process is exiting, whether via signal, explicit
|
|
1448
|
+
* exit, or running out of stuff to do.
|
|
1449
|
+
*
|
|
1450
|
+
* If the global process object is not suitable for instrumentation,
|
|
1451
|
+
* then this will be a no-op.
|
|
1452
|
+
*
|
|
1453
|
+
* Returns a function that may be used to unload signal-exit.
|
|
1454
|
+
*/
|
|
1455
|
+
onExit
|
|
1456
|
+
),
|
|
1457
|
+
load: (
|
|
1458
|
+
/**
|
|
1459
|
+
* Load the listeners. Likely you never need to call this, unless
|
|
1460
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
1461
|
+
* Mostly exposed for the benefit of testing.
|
|
1462
|
+
*
|
|
1463
|
+
* @internal
|
|
1464
|
+
*/
|
|
1465
|
+
load
|
|
1466
|
+
),
|
|
1467
|
+
unload: (
|
|
1468
|
+
/**
|
|
1469
|
+
* Unload the listeners. Likely you never need to call this, unless
|
|
1470
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
1471
|
+
* Mostly exposed for the benefit of testing.
|
|
1472
|
+
*
|
|
1473
|
+
* @internal
|
|
1474
|
+
*/
|
|
1475
|
+
unload
|
|
1476
|
+
)
|
|
1477
|
+
} = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback()));
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
|
|
1481
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
|
|
1482
|
+
var import_node_os3, DEFAULT_FORCE_KILL_TIMEOUT, spawnedKill, setKillTimeout, shouldForceKill, isSigterm, getForceKillAfterTimeout, spawnedCancel, timeoutKill, setupTimeout, validateTimeout, setExitHandler;
|
|
1483
|
+
var init_kill = __esm({
|
|
1484
|
+
"node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js"() {
|
|
1485
|
+
"use strict";
|
|
1486
|
+
import_node_os3 = __toESM(require("os"), 1);
|
|
1487
|
+
init_mjs();
|
|
1488
|
+
DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
|
1489
|
+
spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
|
|
1490
|
+
const killResult = kill(signal);
|
|
1491
|
+
setKillTimeout(kill, signal, options, killResult);
|
|
1492
|
+
return killResult;
|
|
1493
|
+
};
|
|
1494
|
+
setKillTimeout = (kill, signal, options, killResult) => {
|
|
1495
|
+
if (!shouldForceKill(signal, options, killResult)) {
|
|
1496
|
+
return;
|
|
1497
|
+
}
|
|
1498
|
+
const timeout = getForceKillAfterTimeout(options);
|
|
1499
|
+
const t = setTimeout(() => {
|
|
1500
|
+
kill("SIGKILL");
|
|
1501
|
+
}, timeout);
|
|
1502
|
+
if (t.unref) {
|
|
1503
|
+
t.unref();
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
|
1507
|
+
isSigterm = (signal) => signal === import_node_os3.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
|
|
1508
|
+
getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
|
|
1509
|
+
if (forceKillAfterTimeout === true) {
|
|
1510
|
+
return DEFAULT_FORCE_KILL_TIMEOUT;
|
|
1511
|
+
}
|
|
1512
|
+
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
|
1513
|
+
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
|
1514
|
+
}
|
|
1515
|
+
return forceKillAfterTimeout;
|
|
1516
|
+
};
|
|
1517
|
+
spawnedCancel = (spawned, context) => {
|
|
1518
|
+
const killResult = spawned.kill();
|
|
1519
|
+
if (killResult) {
|
|
1520
|
+
context.isCanceled = true;
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1523
|
+
timeoutKill = (spawned, signal, reject) => {
|
|
1524
|
+
spawned.kill(signal);
|
|
1525
|
+
reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
|
|
1526
|
+
};
|
|
1527
|
+
setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
|
|
1528
|
+
if (timeout === 0 || timeout === void 0) {
|
|
1529
|
+
return spawnedPromise;
|
|
1530
|
+
}
|
|
1531
|
+
let timeoutId;
|
|
1532
|
+
const timeoutPromise = new Promise((resolve13, reject) => {
|
|
1533
|
+
timeoutId = setTimeout(() => {
|
|
1534
|
+
timeoutKill(spawned, killSignal, reject);
|
|
1535
|
+
}, timeout);
|
|
1536
|
+
});
|
|
1537
|
+
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
|
1538
|
+
clearTimeout(timeoutId);
|
|
1539
|
+
});
|
|
1540
|
+
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
|
1541
|
+
};
|
|
1542
|
+
validateTimeout = ({ timeout }) => {
|
|
1543
|
+
if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
|
|
1544
|
+
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
|
|
1548
|
+
if (!cleanup || detached) {
|
|
1549
|
+
return timedPromise;
|
|
1550
|
+
}
|
|
1551
|
+
const removeExitHandler = onExit(() => {
|
|
1552
|
+
spawned.kill();
|
|
1553
|
+
});
|
|
1554
|
+
return timedPromise.finally(() => {
|
|
1555
|
+
removeExitHandler();
|
|
1556
|
+
});
|
|
1557
|
+
};
|
|
1558
|
+
}
|
|
1559
|
+
});
|
|
1560
|
+
|
|
1561
|
+
// node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js
|
|
1562
|
+
function isStream(stream) {
|
|
1563
|
+
return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
|
|
1564
|
+
}
|
|
1565
|
+
function isWritableStream(stream) {
|
|
1566
|
+
return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
|
|
1567
|
+
}
|
|
1568
|
+
var init_is_stream = __esm({
|
|
1569
|
+
"node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js"() {
|
|
1570
|
+
"use strict";
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
|
|
1574
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/pipe.js
|
|
1575
|
+
var import_node_fs, import_node_child_process, isExecaChildProcess, pipeToTarget, addPipeMethods;
|
|
1576
|
+
var init_pipe = __esm({
|
|
1577
|
+
"node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/pipe.js"() {
|
|
1578
|
+
"use strict";
|
|
1579
|
+
import_node_fs = require("fs");
|
|
1580
|
+
import_node_child_process = require("child_process");
|
|
1581
|
+
init_is_stream();
|
|
1582
|
+
isExecaChildProcess = (target) => target instanceof import_node_child_process.ChildProcess && typeof target.then === "function";
|
|
1583
|
+
pipeToTarget = (spawned, streamName, target) => {
|
|
1584
|
+
if (typeof target === "string") {
|
|
1585
|
+
spawned[streamName].pipe((0, import_node_fs.createWriteStream)(target));
|
|
1586
|
+
return spawned;
|
|
1587
|
+
}
|
|
1588
|
+
if (isWritableStream(target)) {
|
|
1589
|
+
spawned[streamName].pipe(target);
|
|
1590
|
+
return spawned;
|
|
1591
|
+
}
|
|
1592
|
+
if (!isExecaChildProcess(target)) {
|
|
1593
|
+
throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
|
|
1594
|
+
}
|
|
1595
|
+
if (!isWritableStream(target.stdin)) {
|
|
1596
|
+
throw new TypeError("The target child process's stdin must be available.");
|
|
1597
|
+
}
|
|
1598
|
+
spawned[streamName].pipe(target.stdin);
|
|
1599
|
+
return target;
|
|
1600
|
+
};
|
|
1601
|
+
addPipeMethods = (spawned) => {
|
|
1602
|
+
if (spawned.stdout !== null) {
|
|
1603
|
+
spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
|
|
1604
|
+
}
|
|
1605
|
+
if (spawned.stderr !== null) {
|
|
1606
|
+
spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
|
|
1607
|
+
}
|
|
1608
|
+
if (spawned.all !== void 0) {
|
|
1609
|
+
spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
|
|
1610
|
+
}
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
});
|
|
1614
|
+
|
|
1615
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/contents.js
|
|
1616
|
+
var getStreamContents, appendFinalChunk, appendChunk, addNewChunk, isAsyncIterable, getChunkType, objectToString, MaxBufferError;
|
|
1617
|
+
var init_contents = __esm({
|
|
1618
|
+
"node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/contents.js"() {
|
|
1619
|
+
"use strict";
|
|
1620
|
+
getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
|
|
1621
|
+
if (!isAsyncIterable(stream)) {
|
|
1622
|
+
throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
|
|
1623
|
+
}
|
|
1624
|
+
const state = init();
|
|
1625
|
+
state.length = 0;
|
|
1626
|
+
try {
|
|
1627
|
+
for await (const chunk of stream) {
|
|
1628
|
+
const chunkType = getChunkType(chunk);
|
|
1629
|
+
const convertedChunk = convertChunk[chunkType](chunk, state);
|
|
1630
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
1631
|
+
}
|
|
1632
|
+
appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
|
|
1633
|
+
return finalize(state);
|
|
1634
|
+
} catch (error) {
|
|
1635
|
+
error.bufferedData = finalize(state);
|
|
1636
|
+
throw error;
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
|
|
1640
|
+
const convertedChunk = getFinalChunk(state);
|
|
1641
|
+
if (convertedChunk !== void 0) {
|
|
1642
|
+
appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
|
|
1643
|
+
}
|
|
1644
|
+
};
|
|
1645
|
+
appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
|
|
1646
|
+
const chunkSize = getSize(convertedChunk);
|
|
1647
|
+
const newLength = state.length + chunkSize;
|
|
1648
|
+
if (newLength <= maxBuffer) {
|
|
1649
|
+
addNewChunk(convertedChunk, state, addChunk, newLength);
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
|
|
1653
|
+
if (truncatedChunk !== void 0) {
|
|
1654
|
+
addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
|
|
1655
|
+
}
|
|
1656
|
+
throw new MaxBufferError();
|
|
1657
|
+
};
|
|
1658
|
+
addNewChunk = (convertedChunk, state, addChunk, newLength) => {
|
|
1659
|
+
state.contents = addChunk(convertedChunk, state, newLength);
|
|
1660
|
+
state.length = newLength;
|
|
1661
|
+
};
|
|
1662
|
+
isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
|
|
1663
|
+
getChunkType = (chunk) => {
|
|
1664
|
+
const typeOfChunk = typeof chunk;
|
|
1665
|
+
if (typeOfChunk === "string") {
|
|
1666
|
+
return "string";
|
|
1667
|
+
}
|
|
1668
|
+
if (typeOfChunk !== "object" || chunk === null) {
|
|
1669
|
+
return "others";
|
|
1670
|
+
}
|
|
1671
|
+
if (globalThis.Buffer?.isBuffer(chunk)) {
|
|
1672
|
+
return "buffer";
|
|
1673
|
+
}
|
|
1674
|
+
const prototypeName = objectToString.call(chunk);
|
|
1675
|
+
if (prototypeName === "[object ArrayBuffer]") {
|
|
1676
|
+
return "arrayBuffer";
|
|
1677
|
+
}
|
|
1678
|
+
if (prototypeName === "[object DataView]") {
|
|
1679
|
+
return "dataView";
|
|
1680
|
+
}
|
|
1681
|
+
if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
|
|
1682
|
+
return "typedArray";
|
|
1683
|
+
}
|
|
1684
|
+
return "others";
|
|
1685
|
+
};
|
|
1686
|
+
({ toString: objectToString } = Object.prototype);
|
|
1687
|
+
MaxBufferError = class extends Error {
|
|
1688
|
+
name = "MaxBufferError";
|
|
1689
|
+
constructor() {
|
|
1690
|
+
super("maxBuffer exceeded");
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
});
|
|
1695
|
+
|
|
1696
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/utils.js
|
|
1697
|
+
var identity, noop, getContentsProp, throwObjectStream, getLengthProp;
|
|
1698
|
+
var init_utils = __esm({
|
|
1699
|
+
"node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/utils.js"() {
|
|
1700
|
+
"use strict";
|
|
1701
|
+
identity = (value) => value;
|
|
1702
|
+
noop = () => void 0;
|
|
1703
|
+
getContentsProp = ({ contents }) => contents;
|
|
1704
|
+
throwObjectStream = (chunk) => {
|
|
1705
|
+
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
|
|
1706
|
+
};
|
|
1707
|
+
getLengthProp = (convertedChunk) => convertedChunk.length;
|
|
1708
|
+
}
|
|
1709
|
+
});
|
|
1710
|
+
|
|
1711
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array.js
|
|
1712
|
+
var init_array = __esm({
|
|
1713
|
+
"node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array.js"() {
|
|
1714
|
+
"use strict";
|
|
1715
|
+
init_contents();
|
|
1716
|
+
init_utils();
|
|
1717
|
+
}
|
|
1718
|
+
});
|
|
1719
|
+
|
|
1720
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array-buffer.js
|
|
1721
|
+
async function getStreamAsArrayBuffer(stream, options) {
|
|
1722
|
+
return getStreamContents(stream, arrayBufferMethods, options);
|
|
1723
|
+
}
|
|
1724
|
+
var initArrayBuffer, useTextEncoder, textEncoder, useUint8Array, useUint8ArrayWithOffset, truncateArrayBufferChunk, addArrayBufferChunk, resizeArrayBufferSlow, resizeArrayBuffer, getNewContentsLength, SCALE_FACTOR, finalizeArrayBuffer, hasArrayBufferResize, arrayBufferMethods;
|
|
1725
|
+
var init_array_buffer = __esm({
|
|
1726
|
+
"node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array-buffer.js"() {
|
|
1727
|
+
"use strict";
|
|
1728
|
+
init_contents();
|
|
1729
|
+
init_utils();
|
|
1730
|
+
initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
|
|
1731
|
+
useTextEncoder = (chunk) => textEncoder.encode(chunk);
|
|
1732
|
+
textEncoder = new TextEncoder();
|
|
1733
|
+
useUint8Array = (chunk) => new Uint8Array(chunk);
|
|
1734
|
+
useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
1735
|
+
truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
1736
|
+
addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
|
|
1737
|
+
const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
|
|
1738
|
+
new Uint8Array(newContents).set(convertedChunk, previousLength);
|
|
1739
|
+
return newContents;
|
|
1740
|
+
};
|
|
1741
|
+
resizeArrayBufferSlow = (contents, length) => {
|
|
1742
|
+
if (length <= contents.byteLength) {
|
|
1743
|
+
return contents;
|
|
1744
|
+
}
|
|
1745
|
+
const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
|
|
1746
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
1747
|
+
return arrayBuffer;
|
|
1748
|
+
};
|
|
1749
|
+
resizeArrayBuffer = (contents, length) => {
|
|
1750
|
+
if (length <= contents.maxByteLength) {
|
|
1751
|
+
contents.resize(length);
|
|
1752
|
+
return contents;
|
|
1753
|
+
}
|
|
1754
|
+
const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
|
|
1755
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
1756
|
+
return arrayBuffer;
|
|
1757
|
+
};
|
|
1758
|
+
getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
|
|
1759
|
+
SCALE_FACTOR = 2;
|
|
1760
|
+
finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
|
|
1761
|
+
hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
|
|
1762
|
+
arrayBufferMethods = {
|
|
1763
|
+
init: initArrayBuffer,
|
|
1764
|
+
convertChunk: {
|
|
1765
|
+
string: useTextEncoder,
|
|
1766
|
+
buffer: useUint8Array,
|
|
1767
|
+
arrayBuffer: useUint8Array,
|
|
1768
|
+
dataView: useUint8ArrayWithOffset,
|
|
1769
|
+
typedArray: useUint8ArrayWithOffset,
|
|
1770
|
+
others: throwObjectStream
|
|
1771
|
+
},
|
|
1772
|
+
getSize: getLengthProp,
|
|
1773
|
+
truncateChunk: truncateArrayBufferChunk,
|
|
1774
|
+
addChunk: addArrayBufferChunk,
|
|
1775
|
+
getFinalChunk: noop,
|
|
1776
|
+
finalize: finalizeArrayBuffer
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
});
|
|
1780
|
+
|
|
1781
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/buffer.js
|
|
1782
|
+
async function getStreamAsBuffer(stream, options) {
|
|
1783
|
+
if (!("Buffer" in globalThis)) {
|
|
1784
|
+
throw new Error("getStreamAsBuffer() is only supported in Node.js");
|
|
1785
|
+
}
|
|
1786
|
+
try {
|
|
1787
|
+
return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
|
|
1788
|
+
} catch (error) {
|
|
1789
|
+
if (error.bufferedData !== void 0) {
|
|
1790
|
+
error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
|
|
1791
|
+
}
|
|
1792
|
+
throw error;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
var arrayBufferToNodeBuffer;
|
|
1796
|
+
var init_buffer = __esm({
|
|
1797
|
+
"node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/buffer.js"() {
|
|
1798
|
+
"use strict";
|
|
1799
|
+
init_array_buffer();
|
|
1800
|
+
arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1803
|
+
|
|
1804
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/string.js
|
|
1805
|
+
async function getStreamAsString(stream, options) {
|
|
1806
|
+
return getStreamContents(stream, stringMethods, options);
|
|
1807
|
+
}
|
|
1808
|
+
var initString, useTextDecoder, addStringChunk, truncateStringChunk, getFinalStringChunk, stringMethods;
|
|
1809
|
+
var init_string = __esm({
|
|
1810
|
+
"node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/string.js"() {
|
|
1811
|
+
"use strict";
|
|
1812
|
+
init_contents();
|
|
1813
|
+
init_utils();
|
|
1814
|
+
initString = () => ({ contents: "", textDecoder: new TextDecoder() });
|
|
1815
|
+
useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
|
|
1816
|
+
addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
|
|
1817
|
+
truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
1818
|
+
getFinalStringChunk = ({ textDecoder }) => {
|
|
1819
|
+
const finalChunk = textDecoder.decode();
|
|
1820
|
+
return finalChunk === "" ? void 0 : finalChunk;
|
|
1821
|
+
};
|
|
1822
|
+
stringMethods = {
|
|
1823
|
+
init: initString,
|
|
1824
|
+
convertChunk: {
|
|
1825
|
+
string: identity,
|
|
1826
|
+
buffer: useTextDecoder,
|
|
1827
|
+
arrayBuffer: useTextDecoder,
|
|
1828
|
+
dataView: useTextDecoder,
|
|
1829
|
+
typedArray: useTextDecoder,
|
|
1830
|
+
others: throwObjectStream
|
|
1831
|
+
},
|
|
1832
|
+
getSize: getLengthProp,
|
|
1833
|
+
truncateChunk: truncateStringChunk,
|
|
1834
|
+
addChunk: addStringChunk,
|
|
1835
|
+
getFinalChunk: getFinalStringChunk,
|
|
1836
|
+
finalize: getContentsProp
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1839
|
+
});
|
|
1840
|
+
|
|
1841
|
+
// node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/index.js
|
|
1842
|
+
var init_source = __esm({
|
|
1843
|
+
"node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/index.js"() {
|
|
1844
|
+
"use strict";
|
|
1845
|
+
init_array();
|
|
1846
|
+
init_array_buffer();
|
|
1847
|
+
init_buffer();
|
|
1848
|
+
init_string();
|
|
1849
|
+
init_contents();
|
|
1850
|
+
}
|
|
1851
|
+
});
|
|
1852
|
+
|
|
1853
|
+
// node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js
|
|
1854
|
+
var require_merge_stream = __commonJS({
|
|
1855
|
+
"node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module2) {
|
|
1856
|
+
"use strict";
|
|
1857
|
+
var { PassThrough } = require("stream");
|
|
1858
|
+
module2.exports = function() {
|
|
1859
|
+
var sources = [];
|
|
1860
|
+
var output = new PassThrough({ objectMode: true });
|
|
1861
|
+
output.setMaxListeners(0);
|
|
1862
|
+
output.add = add;
|
|
1863
|
+
output.isEmpty = isEmpty;
|
|
1864
|
+
output.on("unpipe", remove);
|
|
1865
|
+
Array.prototype.slice.call(arguments).forEach(add);
|
|
1866
|
+
return output;
|
|
1867
|
+
function add(source) {
|
|
1868
|
+
if (Array.isArray(source)) {
|
|
1869
|
+
source.forEach(add);
|
|
1870
|
+
return this;
|
|
1871
|
+
}
|
|
1872
|
+
sources.push(source);
|
|
1873
|
+
source.once("end", remove.bind(null, source));
|
|
1874
|
+
source.once("error", output.emit.bind(output, "error"));
|
|
1875
|
+
source.pipe(output, { end: false });
|
|
1876
|
+
return this;
|
|
1877
|
+
}
|
|
1878
|
+
function isEmpty() {
|
|
1879
|
+
return sources.length == 0;
|
|
1880
|
+
}
|
|
1881
|
+
function remove(source) {
|
|
1882
|
+
sources = sources.filter(function(it) {
|
|
1883
|
+
return it !== source;
|
|
1884
|
+
});
|
|
1885
|
+
if (!sources.length && output.readable) {
|
|
1886
|
+
output.end();
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
};
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
|
|
1893
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
|
|
1894
|
+
var import_node_fs2, import_promises, import_merge_stream, validateInputOptions, getInputSync, handleInputSync, getInput, handleInput, makeAllStream, getBufferedData, getStreamPromise, applyEncoding, getSpawnedResult;
|
|
1895
|
+
var init_stream = __esm({
|
|
1896
|
+
"node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js"() {
|
|
1897
|
+
"use strict";
|
|
1898
|
+
import_node_fs2 = require("fs");
|
|
1899
|
+
import_promises = require("timers/promises");
|
|
1900
|
+
init_is_stream();
|
|
1901
|
+
init_source();
|
|
1902
|
+
import_merge_stream = __toESM(require_merge_stream(), 1);
|
|
1903
|
+
validateInputOptions = (input) => {
|
|
1904
|
+
if (input !== void 0) {
|
|
1905
|
+
throw new TypeError("The `input` and `inputFile` options cannot be both set.");
|
|
1906
|
+
}
|
|
1907
|
+
};
|
|
1908
|
+
getInputSync = ({ input, inputFile }) => {
|
|
1909
|
+
if (typeof inputFile !== "string") {
|
|
1910
|
+
return input;
|
|
1911
|
+
}
|
|
1912
|
+
validateInputOptions(input);
|
|
1913
|
+
return (0, import_node_fs2.readFileSync)(inputFile);
|
|
1914
|
+
};
|
|
1915
|
+
handleInputSync = (options) => {
|
|
1916
|
+
const input = getInputSync(options);
|
|
1917
|
+
if (isStream(input)) {
|
|
1918
|
+
throw new TypeError("The `input` option cannot be a stream in sync mode");
|
|
1919
|
+
}
|
|
1920
|
+
return input;
|
|
1921
|
+
};
|
|
1922
|
+
getInput = ({ input, inputFile }) => {
|
|
1923
|
+
if (typeof inputFile !== "string") {
|
|
1924
|
+
return input;
|
|
1925
|
+
}
|
|
1926
|
+
validateInputOptions(input);
|
|
1927
|
+
return (0, import_node_fs2.createReadStream)(inputFile);
|
|
1928
|
+
};
|
|
1929
|
+
handleInput = (spawned, options) => {
|
|
1930
|
+
const input = getInput(options);
|
|
1931
|
+
if (input === void 0) {
|
|
1932
|
+
return;
|
|
1933
|
+
}
|
|
1934
|
+
if (isStream(input)) {
|
|
1935
|
+
input.pipe(spawned.stdin);
|
|
1936
|
+
} else {
|
|
1937
|
+
spawned.stdin.end(input);
|
|
1938
|
+
}
|
|
1939
|
+
};
|
|
1940
|
+
makeAllStream = (spawned, { all }) => {
|
|
1941
|
+
if (!all || !spawned.stdout && !spawned.stderr) {
|
|
1942
|
+
return;
|
|
1943
|
+
}
|
|
1944
|
+
const mixed = (0, import_merge_stream.default)();
|
|
1945
|
+
if (spawned.stdout) {
|
|
1946
|
+
mixed.add(spawned.stdout);
|
|
1947
|
+
}
|
|
1948
|
+
if (spawned.stderr) {
|
|
1949
|
+
mixed.add(spawned.stderr);
|
|
1950
|
+
}
|
|
1951
|
+
return mixed;
|
|
1952
|
+
};
|
|
1953
|
+
getBufferedData = async (stream, streamPromise) => {
|
|
1954
|
+
if (!stream || streamPromise === void 0) {
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1957
|
+
await (0, import_promises.setTimeout)(0);
|
|
1958
|
+
stream.destroy();
|
|
1959
|
+
try {
|
|
1960
|
+
return await streamPromise;
|
|
1961
|
+
} catch (error) {
|
|
1962
|
+
return error.bufferedData;
|
|
1963
|
+
}
|
|
1964
|
+
};
|
|
1965
|
+
getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
|
|
1966
|
+
if (!stream || !buffer) {
|
|
1967
|
+
return;
|
|
1968
|
+
}
|
|
1969
|
+
if (encoding === "utf8" || encoding === "utf-8") {
|
|
1970
|
+
return getStreamAsString(stream, { maxBuffer });
|
|
1971
|
+
}
|
|
1972
|
+
if (encoding === null || encoding === "buffer") {
|
|
1973
|
+
return getStreamAsBuffer(stream, { maxBuffer });
|
|
1974
|
+
}
|
|
1975
|
+
return applyEncoding(stream, maxBuffer, encoding);
|
|
1976
|
+
};
|
|
1977
|
+
applyEncoding = async (stream, maxBuffer, encoding) => {
|
|
1978
|
+
const buffer = await getStreamAsBuffer(stream, { maxBuffer });
|
|
1979
|
+
return buffer.toString(encoding);
|
|
1980
|
+
};
|
|
1981
|
+
getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
|
|
1982
|
+
const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
|
|
1983
|
+
const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
|
|
1984
|
+
const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
|
|
1985
|
+
try {
|
|
1986
|
+
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
|
1987
|
+
} catch (error) {
|
|
1988
|
+
return Promise.all([
|
|
1989
|
+
{ error, signal: error.signal, timedOut: error.timedOut },
|
|
1990
|
+
getBufferedData(stdout, stdoutPromise),
|
|
1991
|
+
getBufferedData(stderr, stderrPromise),
|
|
1992
|
+
getBufferedData(all, allPromise)
|
|
1993
|
+
]);
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
|
|
1999
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/promise.js
|
|
2000
|
+
var nativePromisePrototype, descriptors, mergePromise, getSpawnedPromise;
|
|
2001
|
+
var init_promise = __esm({
|
|
2002
|
+
"node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/promise.js"() {
|
|
2003
|
+
"use strict";
|
|
2004
|
+
nativePromisePrototype = (async () => {
|
|
2005
|
+
})().constructor.prototype;
|
|
2006
|
+
descriptors = ["then", "catch", "finally"].map((property) => [
|
|
2007
|
+
property,
|
|
2008
|
+
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
|
|
2009
|
+
]);
|
|
2010
|
+
mergePromise = (spawned, promise) => {
|
|
2011
|
+
for (const [property, descriptor] of descriptors) {
|
|
2012
|
+
const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
|
|
2013
|
+
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
2014
|
+
}
|
|
2015
|
+
};
|
|
2016
|
+
getSpawnedPromise = (spawned) => new Promise((resolve13, reject) => {
|
|
2017
|
+
spawned.on("exit", (exitCode, signal) => {
|
|
2018
|
+
resolve13({ exitCode, signal });
|
|
2019
|
+
});
|
|
2020
|
+
spawned.on("error", (error) => {
|
|
2021
|
+
reject(error);
|
|
2022
|
+
});
|
|
2023
|
+
if (spawned.stdin) {
|
|
2024
|
+
spawned.stdin.on("error", (error) => {
|
|
2025
|
+
reject(error);
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
});
|
|
2031
|
+
|
|
2032
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/command.js
|
|
2033
|
+
var import_node_buffer, import_node_child_process2, normalizeArgs, NO_ESCAPE_REGEXP, escapeArg, joinCommand, getEscapedCommand, SPACES_REGEXP, parseCommand, parseExpression, concatTokens, parseTemplate, parseTemplates;
|
|
2034
|
+
var init_command = __esm({
|
|
2035
|
+
"node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/command.js"() {
|
|
2036
|
+
"use strict";
|
|
2037
|
+
import_node_buffer = require("buffer");
|
|
2038
|
+
import_node_child_process2 = require("child_process");
|
|
2039
|
+
normalizeArgs = (file, args = []) => {
|
|
2040
|
+
if (!Array.isArray(args)) {
|
|
2041
|
+
return [file];
|
|
2042
|
+
}
|
|
2043
|
+
return [file, ...args];
|
|
2044
|
+
};
|
|
2045
|
+
NO_ESCAPE_REGEXP = /^[\w.-]+$/;
|
|
2046
|
+
escapeArg = (arg) => {
|
|
2047
|
+
if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
|
|
2048
|
+
return arg;
|
|
2049
|
+
}
|
|
2050
|
+
return `"${arg.replaceAll('"', '\\"')}"`;
|
|
2051
|
+
};
|
|
2052
|
+
joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
|
|
2053
|
+
getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
|
|
2054
|
+
SPACES_REGEXP = / +/g;
|
|
2055
|
+
parseCommand = (command) => {
|
|
2056
|
+
const tokens = [];
|
|
2057
|
+
for (const token of command.trim().split(SPACES_REGEXP)) {
|
|
2058
|
+
const previousToken = tokens.at(-1);
|
|
2059
|
+
if (previousToken && previousToken.endsWith("\\")) {
|
|
2060
|
+
tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
|
|
2061
|
+
} else {
|
|
2062
|
+
tokens.push(token);
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
return tokens;
|
|
2066
|
+
};
|
|
2067
|
+
parseExpression = (expression) => {
|
|
2068
|
+
const typeOfExpression = typeof expression;
|
|
2069
|
+
if (typeOfExpression === "string") {
|
|
2070
|
+
return expression;
|
|
2071
|
+
}
|
|
2072
|
+
if (typeOfExpression === "number") {
|
|
2073
|
+
return String(expression);
|
|
2074
|
+
}
|
|
2075
|
+
if (typeOfExpression === "object" && expression !== null && !(expression instanceof import_node_child_process2.ChildProcess) && "stdout" in expression) {
|
|
2076
|
+
const typeOfStdout = typeof expression.stdout;
|
|
2077
|
+
if (typeOfStdout === "string") {
|
|
2078
|
+
return expression.stdout;
|
|
2079
|
+
}
|
|
2080
|
+
if (import_node_buffer.Buffer.isBuffer(expression.stdout)) {
|
|
2081
|
+
return expression.stdout.toString();
|
|
2082
|
+
}
|
|
2083
|
+
throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
|
|
2084
|
+
}
|
|
2085
|
+
throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
|
|
2086
|
+
};
|
|
2087
|
+
concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
|
|
2088
|
+
...tokens.slice(0, -1),
|
|
2089
|
+
`${tokens.at(-1)}${nextTokens[0]}`,
|
|
2090
|
+
...nextTokens.slice(1)
|
|
2091
|
+
];
|
|
2092
|
+
parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
2093
|
+
const templateString = template ?? templates.raw[index];
|
|
2094
|
+
const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
|
|
2095
|
+
const newTokens = concatTokens(
|
|
2096
|
+
tokens,
|
|
2097
|
+
templateTokens,
|
|
2098
|
+
templateString.startsWith(" ")
|
|
2099
|
+
);
|
|
2100
|
+
if (index === expressions.length) {
|
|
2101
|
+
return newTokens;
|
|
2102
|
+
}
|
|
2103
|
+
const expression = expressions[index];
|
|
2104
|
+
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
|
|
2105
|
+
return concatTokens(
|
|
2106
|
+
newTokens,
|
|
2107
|
+
expressionTokens,
|
|
2108
|
+
templateString.endsWith(" ")
|
|
2109
|
+
);
|
|
2110
|
+
};
|
|
2111
|
+
parseTemplates = (templates, expressions) => {
|
|
2112
|
+
let tokens = [];
|
|
2113
|
+
for (const [index, template] of templates.entries()) {
|
|
2114
|
+
tokens = parseTemplate({ templates, expressions, tokens, index, template });
|
|
2115
|
+
}
|
|
2116
|
+
return tokens;
|
|
2117
|
+
};
|
|
2118
|
+
}
|
|
2119
|
+
});
|
|
2120
|
+
|
|
2121
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/verbose.js
|
|
2122
|
+
var import_node_util, import_node_process3, verboseDefault, padField, getTimestamp, logCommand;
|
|
2123
|
+
var init_verbose = __esm({
|
|
2124
|
+
"node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/verbose.js"() {
|
|
2125
|
+
"use strict";
|
|
2126
|
+
import_node_util = require("util");
|
|
2127
|
+
import_node_process3 = __toESM(require("process"), 1);
|
|
2128
|
+
verboseDefault = (0, import_node_util.debuglog)("execa").enabled;
|
|
2129
|
+
padField = (field, padding) => String(field).padStart(padding, "0");
|
|
2130
|
+
getTimestamp = () => {
|
|
2131
|
+
const date = /* @__PURE__ */ new Date();
|
|
2132
|
+
return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
|
|
2133
|
+
};
|
|
2134
|
+
logCommand = (escapedCommand, { verbose }) => {
|
|
2135
|
+
if (!verbose) {
|
|
2136
|
+
return;
|
|
2137
|
+
}
|
|
2138
|
+
import_node_process3.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
|
|
2139
|
+
`);
|
|
2140
|
+
};
|
|
2141
|
+
}
|
|
2142
|
+
});
|
|
2143
|
+
|
|
2144
|
+
// node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
|
|
2145
|
+
var execa_exports = {};
|
|
2146
|
+
__export(execa_exports, {
|
|
2147
|
+
$: () => $,
|
|
2148
|
+
execa: () => execa,
|
|
2149
|
+
execaCommand: () => execaCommand,
|
|
2150
|
+
execaCommandSync: () => execaCommandSync,
|
|
2151
|
+
execaNode: () => execaNode,
|
|
2152
|
+
execaSync: () => execaSync
|
|
2153
|
+
});
|
|
2154
|
+
function execa(file, args, options) {
|
|
2155
|
+
const parsed = handleArguments(file, args, options);
|
|
2156
|
+
const command = joinCommand(file, args);
|
|
2157
|
+
const escapedCommand = getEscapedCommand(file, args);
|
|
2158
|
+
logCommand(escapedCommand, parsed.options);
|
|
2159
|
+
validateTimeout(parsed.options);
|
|
2160
|
+
let spawned;
|
|
2161
|
+
try {
|
|
2162
|
+
spawned = import_node_child_process3.default.spawn(parsed.file, parsed.args, parsed.options);
|
|
2163
|
+
} catch (error) {
|
|
2164
|
+
const dummySpawned = new import_node_child_process3.default.ChildProcess();
|
|
2165
|
+
const errorPromise = Promise.reject(makeError({
|
|
2166
|
+
error,
|
|
2167
|
+
stdout: "",
|
|
2168
|
+
stderr: "",
|
|
2169
|
+
all: "",
|
|
2170
|
+
command,
|
|
2171
|
+
escapedCommand,
|
|
2172
|
+
parsed,
|
|
2173
|
+
timedOut: false,
|
|
2174
|
+
isCanceled: false,
|
|
2175
|
+
killed: false
|
|
2176
|
+
}));
|
|
2177
|
+
mergePromise(dummySpawned, errorPromise);
|
|
2178
|
+
return dummySpawned;
|
|
2179
|
+
}
|
|
2180
|
+
const spawnedPromise = getSpawnedPromise(spawned);
|
|
2181
|
+
const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
|
|
2182
|
+
const processDone = setExitHandler(spawned, parsed.options, timedPromise);
|
|
2183
|
+
const context = { isCanceled: false };
|
|
2184
|
+
spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
|
|
2185
|
+
spawned.cancel = spawnedCancel.bind(null, spawned, context);
|
|
2186
|
+
const handlePromise = async () => {
|
|
2187
|
+
const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
|
|
2188
|
+
const stdout = handleOutput(parsed.options, stdoutResult);
|
|
2189
|
+
const stderr = handleOutput(parsed.options, stderrResult);
|
|
2190
|
+
const all = handleOutput(parsed.options, allResult);
|
|
2191
|
+
if (error || exitCode !== 0 || signal !== null) {
|
|
2192
|
+
const returnedError = makeError({
|
|
2193
|
+
error,
|
|
2194
|
+
exitCode,
|
|
2195
|
+
signal,
|
|
2196
|
+
stdout,
|
|
2197
|
+
stderr,
|
|
2198
|
+
all,
|
|
2199
|
+
command,
|
|
2200
|
+
escapedCommand,
|
|
2201
|
+
parsed,
|
|
2202
|
+
timedOut,
|
|
2203
|
+
isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
|
|
2204
|
+
killed: spawned.killed
|
|
2205
|
+
});
|
|
2206
|
+
if (!parsed.options.reject) {
|
|
2207
|
+
return returnedError;
|
|
2208
|
+
}
|
|
2209
|
+
throw returnedError;
|
|
2210
|
+
}
|
|
2211
|
+
return {
|
|
2212
|
+
command,
|
|
2213
|
+
escapedCommand,
|
|
2214
|
+
exitCode: 0,
|
|
2215
|
+
stdout,
|
|
2216
|
+
stderr,
|
|
2217
|
+
all,
|
|
2218
|
+
failed: false,
|
|
2219
|
+
timedOut: false,
|
|
2220
|
+
isCanceled: false,
|
|
2221
|
+
killed: false
|
|
2222
|
+
};
|
|
2223
|
+
};
|
|
2224
|
+
const handlePromiseOnce = onetime_default(handlePromise);
|
|
2225
|
+
handleInput(spawned, parsed.options);
|
|
2226
|
+
spawned.all = makeAllStream(spawned, parsed.options);
|
|
2227
|
+
addPipeMethods(spawned);
|
|
2228
|
+
mergePromise(spawned, handlePromiseOnce);
|
|
2229
|
+
return spawned;
|
|
2230
|
+
}
|
|
2231
|
+
function execaSync(file, args, options) {
|
|
2232
|
+
const parsed = handleArguments(file, args, options);
|
|
2233
|
+
const command = joinCommand(file, args);
|
|
2234
|
+
const escapedCommand = getEscapedCommand(file, args);
|
|
2235
|
+
logCommand(escapedCommand, parsed.options);
|
|
2236
|
+
const input = handleInputSync(parsed.options);
|
|
2237
|
+
let result;
|
|
2238
|
+
try {
|
|
2239
|
+
result = import_node_child_process3.default.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
|
|
2240
|
+
} catch (error) {
|
|
2241
|
+
throw makeError({
|
|
2242
|
+
error,
|
|
2243
|
+
stdout: "",
|
|
2244
|
+
stderr: "",
|
|
2245
|
+
all: "",
|
|
2246
|
+
command,
|
|
2247
|
+
escapedCommand,
|
|
2248
|
+
parsed,
|
|
2249
|
+
timedOut: false,
|
|
2250
|
+
isCanceled: false,
|
|
2251
|
+
killed: false
|
|
2252
|
+
});
|
|
2253
|
+
}
|
|
2254
|
+
const stdout = handleOutput(parsed.options, result.stdout, result.error);
|
|
2255
|
+
const stderr = handleOutput(parsed.options, result.stderr, result.error);
|
|
2256
|
+
if (result.error || result.status !== 0 || result.signal !== null) {
|
|
2257
|
+
const error = makeError({
|
|
2258
|
+
stdout,
|
|
2259
|
+
stderr,
|
|
2260
|
+
error: result.error,
|
|
2261
|
+
signal: result.signal,
|
|
2262
|
+
exitCode: result.status,
|
|
2263
|
+
command,
|
|
2264
|
+
escapedCommand,
|
|
2265
|
+
parsed,
|
|
2266
|
+
timedOut: result.error && result.error.code === "ETIMEDOUT",
|
|
2267
|
+
isCanceled: false,
|
|
2268
|
+
killed: result.signal !== null
|
|
2269
|
+
});
|
|
2270
|
+
if (!parsed.options.reject) {
|
|
2271
|
+
return error;
|
|
2272
|
+
}
|
|
2273
|
+
throw error;
|
|
2274
|
+
}
|
|
2275
|
+
return {
|
|
2276
|
+
command,
|
|
2277
|
+
escapedCommand,
|
|
2278
|
+
exitCode: 0,
|
|
2279
|
+
stdout,
|
|
2280
|
+
stderr,
|
|
2281
|
+
failed: false,
|
|
2282
|
+
timedOut: false,
|
|
2283
|
+
isCanceled: false,
|
|
2284
|
+
killed: false
|
|
2285
|
+
};
|
|
2286
|
+
}
|
|
2287
|
+
function create$(options) {
|
|
2288
|
+
function $2(templatesOrOptions, ...expressions) {
|
|
2289
|
+
if (!Array.isArray(templatesOrOptions)) {
|
|
2290
|
+
return create$({ ...options, ...templatesOrOptions });
|
|
2291
|
+
}
|
|
2292
|
+
const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
|
|
2293
|
+
return execa(file, args, normalizeScriptOptions(options));
|
|
2294
|
+
}
|
|
2295
|
+
$2.sync = (templates, ...expressions) => {
|
|
2296
|
+
if (!Array.isArray(templates)) {
|
|
2297
|
+
throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
|
|
2298
|
+
}
|
|
2299
|
+
const [file, ...args] = parseTemplates(templates, expressions);
|
|
2300
|
+
return execaSync(file, args, normalizeScriptOptions(options));
|
|
2301
|
+
};
|
|
2302
|
+
return $2;
|
|
2303
|
+
}
|
|
2304
|
+
function execaCommand(command, options) {
|
|
2305
|
+
const [file, ...args] = parseCommand(command);
|
|
2306
|
+
return execa(file, args, options);
|
|
2307
|
+
}
|
|
2308
|
+
function execaCommandSync(command, options) {
|
|
2309
|
+
const [file, ...args] = parseCommand(command);
|
|
2310
|
+
return execaSync(file, args, options);
|
|
2311
|
+
}
|
|
2312
|
+
function execaNode(scriptPath, args, options = {}) {
|
|
2313
|
+
if (args && !Array.isArray(args) && typeof args === "object") {
|
|
2314
|
+
options = args;
|
|
2315
|
+
args = [];
|
|
2316
|
+
}
|
|
2317
|
+
const stdio = normalizeStdioNode(options);
|
|
2318
|
+
const defaultExecArgv = import_node_process4.default.execArgv.filter((arg) => !arg.startsWith("--inspect"));
|
|
2319
|
+
const {
|
|
2320
|
+
nodePath = import_node_process4.default.execPath,
|
|
2321
|
+
nodeOptions = defaultExecArgv
|
|
2322
|
+
} = options;
|
|
2323
|
+
return execa(
|
|
2324
|
+
nodePath,
|
|
2325
|
+
[
|
|
2326
|
+
...nodeOptions,
|
|
2327
|
+
scriptPath,
|
|
2328
|
+
...Array.isArray(args) ? args : []
|
|
2329
|
+
],
|
|
2330
|
+
{
|
|
2331
|
+
...options,
|
|
2332
|
+
stdin: void 0,
|
|
2333
|
+
stdout: void 0,
|
|
2334
|
+
stderr: void 0,
|
|
2335
|
+
stdio,
|
|
2336
|
+
shell: false
|
|
2337
|
+
}
|
|
2338
|
+
);
|
|
2339
|
+
}
|
|
2340
|
+
var import_node_buffer2, import_node_path3, import_node_child_process3, import_node_process4, import_cross_spawn, DEFAULT_MAX_BUFFER, getEnv, handleArguments, handleOutput, normalizeScriptStdin, normalizeScriptOptions, $;
|
|
2341
|
+
var init_execa = __esm({
|
|
2342
|
+
"node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js"() {
|
|
2343
|
+
"use strict";
|
|
2344
|
+
import_node_buffer2 = require("buffer");
|
|
2345
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
2346
|
+
import_node_child_process3 = __toESM(require("child_process"), 1);
|
|
2347
|
+
import_node_process4 = __toESM(require("process"), 1);
|
|
2348
|
+
import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
2349
|
+
init_strip_final_newline();
|
|
2350
|
+
init_npm_run_path();
|
|
2351
|
+
init_onetime();
|
|
2352
|
+
init_error();
|
|
2353
|
+
init_stdio();
|
|
2354
|
+
init_kill();
|
|
2355
|
+
init_pipe();
|
|
2356
|
+
init_stream();
|
|
2357
|
+
init_promise();
|
|
2358
|
+
init_command();
|
|
2359
|
+
init_verbose();
|
|
2360
|
+
DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
|
|
2361
|
+
getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
|
2362
|
+
const env = extendEnv ? { ...import_node_process4.default.env, ...envOption } : envOption;
|
|
2363
|
+
if (preferLocal) {
|
|
2364
|
+
return npmRunPathEnv({ env, cwd: localDir, execPath });
|
|
2365
|
+
}
|
|
2366
|
+
return env;
|
|
2367
|
+
};
|
|
2368
|
+
handleArguments = (file, args, options = {}) => {
|
|
2369
|
+
const parsed = import_cross_spawn.default._parse(file, args, options);
|
|
2370
|
+
file = parsed.command;
|
|
2371
|
+
args = parsed.args;
|
|
2372
|
+
options = parsed.options;
|
|
2373
|
+
options = {
|
|
2374
|
+
maxBuffer: DEFAULT_MAX_BUFFER,
|
|
2375
|
+
buffer: true,
|
|
2376
|
+
stripFinalNewline: true,
|
|
2377
|
+
extendEnv: true,
|
|
2378
|
+
preferLocal: false,
|
|
2379
|
+
localDir: options.cwd || import_node_process4.default.cwd(),
|
|
2380
|
+
execPath: import_node_process4.default.execPath,
|
|
2381
|
+
encoding: "utf8",
|
|
2382
|
+
reject: true,
|
|
2383
|
+
cleanup: true,
|
|
2384
|
+
all: false,
|
|
2385
|
+
windowsHide: true,
|
|
2386
|
+
verbose: verboseDefault,
|
|
2387
|
+
...options
|
|
2388
|
+
};
|
|
2389
|
+
options.env = getEnv(options);
|
|
2390
|
+
options.stdio = normalizeStdio(options);
|
|
2391
|
+
if (import_node_process4.default.platform === "win32" && import_node_path3.default.basename(file, ".exe") === "cmd") {
|
|
2392
|
+
args.unshift("/q");
|
|
2393
|
+
}
|
|
2394
|
+
return { file, args, options, parsed };
|
|
2395
|
+
};
|
|
2396
|
+
handleOutput = (options, value, error) => {
|
|
2397
|
+
if (typeof value !== "string" && !import_node_buffer2.Buffer.isBuffer(value)) {
|
|
2398
|
+
return error === void 0 ? void 0 : "";
|
|
2399
|
+
}
|
|
2400
|
+
if (options.stripFinalNewline) {
|
|
2401
|
+
return stripFinalNewline(value);
|
|
2402
|
+
}
|
|
2403
|
+
return value;
|
|
2404
|
+
};
|
|
2405
|
+
normalizeScriptStdin = ({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {};
|
|
2406
|
+
normalizeScriptOptions = (options = {}) => ({
|
|
2407
|
+
preferLocal: true,
|
|
2408
|
+
...normalizeScriptStdin(options),
|
|
2409
|
+
...options
|
|
2410
|
+
});
|
|
2411
|
+
$ = create$();
|
|
2412
|
+
}
|
|
2413
|
+
});
|
|
29
2414
|
|
|
30
2415
|
// src/index.ts
|
|
31
2416
|
var src_exports = {};
|
|
@@ -43,27 +2428,228 @@ __export(src_exports, {
|
|
|
43
2428
|
module.exports = __toCommonJS(src_exports);
|
|
44
2429
|
|
|
45
2430
|
// src/core/utils/fs.ts
|
|
46
|
-
var
|
|
2431
|
+
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
47
2432
|
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
48
2433
|
|
|
49
2434
|
// src/core/utils/paths.ts
|
|
50
2435
|
var import_node_path = __toESM(require("path"), 1);
|
|
51
2436
|
var import_normalize_path = __toESM(require("normalize-path"), 1);
|
|
52
|
-
function normalizePath(
|
|
53
|
-
return (0, import_normalize_path.default)(
|
|
2437
|
+
function normalizePath(path13) {
|
|
2438
|
+
return (0, import_normalize_path.default)(path13);
|
|
54
2439
|
}
|
|
55
|
-
function unnormalizePath(
|
|
56
|
-
return import_node_path.default.normalize(
|
|
2440
|
+
function unnormalizePath(path13) {
|
|
2441
|
+
return import_node_path.default.normalize(path13);
|
|
57
2442
|
}
|
|
58
2443
|
var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
|
|
59
2444
|
var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
|
|
60
2445
|
|
|
61
2446
|
// src/core/wxt.ts
|
|
62
2447
|
var import_hookable = require("hookable");
|
|
2448
|
+
|
|
2449
|
+
// src/core/package-managers/index.ts
|
|
2450
|
+
var import_nypm = require("nypm");
|
|
2451
|
+
|
|
2452
|
+
// src/core/package-managers/npm.ts
|
|
2453
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
2454
|
+
var import_fs_extra = require("fs-extra");
|
|
2455
|
+
var npm = {
|
|
2456
|
+
overridesKey: "overrides",
|
|
2457
|
+
async downloadDependency(id, downloadDir) {
|
|
2458
|
+
await (0, import_fs_extra.ensureDir)(downloadDir);
|
|
2459
|
+
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
2460
|
+
const res = await execa2("npm", ["pack", id, "--json"], {
|
|
2461
|
+
cwd: downloadDir
|
|
2462
|
+
});
|
|
2463
|
+
const packed = JSON.parse(res.stdout);
|
|
2464
|
+
return import_node_path4.default.resolve(downloadDir, packed[0].filename);
|
|
2465
|
+
},
|
|
2466
|
+
async listDependencies(options) {
|
|
2467
|
+
const args = ["ls", "--json"];
|
|
2468
|
+
if (options?.all) {
|
|
2469
|
+
args.push("--depth", "Infinity");
|
|
2470
|
+
}
|
|
2471
|
+
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
2472
|
+
const res = await execa2("npm", args, { cwd: options?.cwd });
|
|
2473
|
+
const project = JSON.parse(res.stdout);
|
|
2474
|
+
return flattenNpmListOutput([project]);
|
|
2475
|
+
}
|
|
2476
|
+
};
|
|
2477
|
+
function flattenNpmListOutput(projects) {
|
|
2478
|
+
const queue = projects.flatMap(
|
|
2479
|
+
(project) => {
|
|
2480
|
+
const acc = [];
|
|
2481
|
+
if (project.dependencies)
|
|
2482
|
+
acc.push(project.dependencies);
|
|
2483
|
+
if (project.devDependencies)
|
|
2484
|
+
acc.push(project.devDependencies);
|
|
2485
|
+
return acc;
|
|
2486
|
+
}
|
|
2487
|
+
);
|
|
2488
|
+
const dependencies = [];
|
|
2489
|
+
while (queue.length > 0) {
|
|
2490
|
+
Object.entries(queue.pop()).forEach(([name, meta]) => {
|
|
2491
|
+
dependencies.push({
|
|
2492
|
+
name,
|
|
2493
|
+
version: meta.version
|
|
2494
|
+
});
|
|
2495
|
+
if (meta.dependencies)
|
|
2496
|
+
queue.push(meta.dependencies);
|
|
2497
|
+
if (meta.devDependencies)
|
|
2498
|
+
queue.push(meta.devDependencies);
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
return dedupeDependencies(dependencies);
|
|
2502
|
+
}
|
|
2503
|
+
function dedupeDependencies(dependencies) {
|
|
2504
|
+
const hashes = /* @__PURE__ */ new Set();
|
|
2505
|
+
return dependencies.filter((dep) => {
|
|
2506
|
+
const hash = `${dep.name}@${dep.version}`;
|
|
2507
|
+
if (hashes.has(hash)) {
|
|
2508
|
+
return false;
|
|
2509
|
+
} else {
|
|
2510
|
+
hashes.add(hash);
|
|
2511
|
+
return true;
|
|
2512
|
+
}
|
|
2513
|
+
});
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
// src/core/package-managers/bun.ts
|
|
2517
|
+
var bun = {
|
|
2518
|
+
overridesKey: "overrides",
|
|
2519
|
+
// But also supports "resolutions"
|
|
2520
|
+
downloadDependency(...args) {
|
|
2521
|
+
return npm.downloadDependency(...args);
|
|
2522
|
+
},
|
|
2523
|
+
async listDependencies(options) {
|
|
2524
|
+
const args = ["pm", "ls"];
|
|
2525
|
+
if (options?.all) {
|
|
2526
|
+
args.push("--all");
|
|
2527
|
+
}
|
|
2528
|
+
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
2529
|
+
const res = await execa2("bun", args, { cwd: options?.cwd });
|
|
2530
|
+
return dedupeDependencies(
|
|
2531
|
+
res.stdout.split("\n").slice(1).map((line) => line.trim()).map((line) => /.* (@?\S+)@(\S+)$/.exec(line)).filter((match) => !!match).map(([_, name, version2]) => ({ name, version: version2 }))
|
|
2532
|
+
);
|
|
2533
|
+
}
|
|
2534
|
+
};
|
|
2535
|
+
|
|
2536
|
+
// src/core/package-managers/yarn.ts
|
|
2537
|
+
var yarn = {
|
|
2538
|
+
overridesKey: "resolutions",
|
|
2539
|
+
downloadDependency(...args) {
|
|
2540
|
+
return npm.downloadDependency(...args);
|
|
2541
|
+
},
|
|
2542
|
+
async listDependencies(options) {
|
|
2543
|
+
const args = ["list", "--json"];
|
|
2544
|
+
if (options?.all) {
|
|
2545
|
+
args.push("--depth", "Infinity");
|
|
2546
|
+
}
|
|
2547
|
+
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
2548
|
+
const res = await execa2("yarn", args, { cwd: options?.cwd });
|
|
2549
|
+
const tree = res.stdout.split("\n").map((line) => JSON.parse(line)).find((line) => line.type === "tree")?.data;
|
|
2550
|
+
if (tree == null)
|
|
2551
|
+
throw Error("'yarn list --json' did not output a tree");
|
|
2552
|
+
const queue = [...tree.trees];
|
|
2553
|
+
const dependencies = [];
|
|
2554
|
+
while (queue.length > 0) {
|
|
2555
|
+
const { name: treeName, children } = queue.pop();
|
|
2556
|
+
const match = /(@?\S+)@(\S+)$/.exec(treeName);
|
|
2557
|
+
if (match) {
|
|
2558
|
+
const [_, name, version2] = match;
|
|
2559
|
+
dependencies.push({ name, version: version2 });
|
|
2560
|
+
}
|
|
2561
|
+
if (children != null) {
|
|
2562
|
+
queue.push(...children);
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
return dedupeDependencies(dependencies);
|
|
2566
|
+
}
|
|
2567
|
+
};
|
|
2568
|
+
|
|
2569
|
+
// src/core/package-managers/pnpm.ts
|
|
2570
|
+
var pnpm = {
|
|
2571
|
+
overridesKey: "resolutions",
|
|
2572
|
+
// "pnpm.overrides" has a higher priority, but I don't want to deal with nesting
|
|
2573
|
+
downloadDependency(...args) {
|
|
2574
|
+
return npm.downloadDependency(...args);
|
|
2575
|
+
},
|
|
2576
|
+
async listDependencies(options) {
|
|
2577
|
+
const args = ["ls", "--json"];
|
|
2578
|
+
if (options?.all) {
|
|
2579
|
+
args.push("--depth", "Infinity");
|
|
2580
|
+
}
|
|
2581
|
+
if (typeof process !== "undefined" && process.env.WXT_PNPM_IGNORE_WORKSPACE === "true") {
|
|
2582
|
+
args.push("--ignore-workspace");
|
|
2583
|
+
}
|
|
2584
|
+
const { execa: execa2 } = await Promise.resolve().then(() => (init_execa(), execa_exports));
|
|
2585
|
+
const res = await execa2("pnpm", args, { cwd: options?.cwd });
|
|
2586
|
+
const projects = JSON.parse(res.stdout);
|
|
2587
|
+
return flattenNpmListOutput(projects);
|
|
2588
|
+
}
|
|
2589
|
+
};
|
|
2590
|
+
|
|
2591
|
+
// src/core/package-managers/index.ts
|
|
2592
|
+
async function createWxtPackageManager(root) {
|
|
2593
|
+
const pm = await (0, import_nypm.detectPackageManager)(root, {
|
|
2594
|
+
includeParentDirs: true
|
|
2595
|
+
});
|
|
2596
|
+
const requirePm = (cb) => {
|
|
2597
|
+
if (pm == null)
|
|
2598
|
+
throw Error("Could not detect package manager");
|
|
2599
|
+
return cb(pm);
|
|
2600
|
+
};
|
|
2601
|
+
return {
|
|
2602
|
+
get name() {
|
|
2603
|
+
return requirePm((pm2) => pm2.name);
|
|
2604
|
+
},
|
|
2605
|
+
get command() {
|
|
2606
|
+
return requirePm((pm2) => pm2.command);
|
|
2607
|
+
},
|
|
2608
|
+
get version() {
|
|
2609
|
+
return requirePm((pm2) => pm2.version);
|
|
2610
|
+
},
|
|
2611
|
+
get majorVersion() {
|
|
2612
|
+
return requirePm((pm2) => pm2.majorVersion);
|
|
2613
|
+
},
|
|
2614
|
+
get lockFile() {
|
|
2615
|
+
return requirePm((pm2) => pm2.lockFile);
|
|
2616
|
+
},
|
|
2617
|
+
get files() {
|
|
2618
|
+
return requirePm((pm2) => pm2.files);
|
|
2619
|
+
},
|
|
2620
|
+
addDependency: import_nypm.addDependency,
|
|
2621
|
+
addDevDependency: import_nypm.addDevDependency,
|
|
2622
|
+
ensureDependencyInstalled: import_nypm.ensureDependencyInstalled,
|
|
2623
|
+
installDependencies: import_nypm.installDependencies,
|
|
2624
|
+
removeDependency: import_nypm.removeDependency,
|
|
2625
|
+
get overridesKey() {
|
|
2626
|
+
return requirePm((pm2) => packageManagers[pm2.name].overridesKey);
|
|
2627
|
+
},
|
|
2628
|
+
downloadDependency(...args) {
|
|
2629
|
+
return requirePm(
|
|
2630
|
+
(pm2) => packageManagers[pm2.name].downloadDependency(...args)
|
|
2631
|
+
);
|
|
2632
|
+
},
|
|
2633
|
+
listDependencies(...args) {
|
|
2634
|
+
return requirePm(
|
|
2635
|
+
(pm2) => packageManagers[pm2.name].listDependencies(...args)
|
|
2636
|
+
);
|
|
2637
|
+
}
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
var packageManagers = {
|
|
2641
|
+
npm,
|
|
2642
|
+
pnpm,
|
|
2643
|
+
bun,
|
|
2644
|
+
yarn
|
|
2645
|
+
};
|
|
2646
|
+
|
|
2647
|
+
// src/core/wxt.ts
|
|
63
2648
|
var wxt;
|
|
64
2649
|
async function registerWxt(command, inlineConfig = {}, server) {
|
|
65
2650
|
const config = await resolveConfig(inlineConfig, command, server);
|
|
66
2651
|
const hooks = (0, import_hookable.createHooks)();
|
|
2652
|
+
const pm = await createWxtPackageManager(config.root);
|
|
67
2653
|
wxt = {
|
|
68
2654
|
config,
|
|
69
2655
|
hooks,
|
|
@@ -72,7 +2658,8 @@ async function registerWxt(command, inlineConfig = {}, server) {
|
|
|
72
2658
|
},
|
|
73
2659
|
async reloadConfig() {
|
|
74
2660
|
wxt.config = await resolveConfig(inlineConfig, command, server);
|
|
75
|
-
}
|
|
2661
|
+
},
|
|
2662
|
+
pm
|
|
76
2663
|
};
|
|
77
2664
|
wxt.hooks.addHooks(config.hooks);
|
|
78
2665
|
await wxt.hooks.callHook("ready", wxt);
|
|
@@ -80,20 +2667,20 @@ async function registerWxt(command, inlineConfig = {}, server) {
|
|
|
80
2667
|
|
|
81
2668
|
// src/core/utils/fs.ts
|
|
82
2669
|
async function writeFileIfDifferent(file, newContents) {
|
|
83
|
-
const existingContents = await
|
|
2670
|
+
const existingContents = await import_fs_extra2.default.readFile(file, "utf-8").catch(() => void 0);
|
|
84
2671
|
if (existingContents !== newContents) {
|
|
85
|
-
await
|
|
2672
|
+
await import_fs_extra2.default.writeFile(file, newContents);
|
|
86
2673
|
}
|
|
87
2674
|
}
|
|
88
2675
|
async function getPublicFiles() {
|
|
89
|
-
if (!await
|
|
2676
|
+
if (!await import_fs_extra2.default.exists(wxt.config.publicDir))
|
|
90
2677
|
return [];
|
|
91
2678
|
const files = await (0, import_fast_glob.default)("**/*", { cwd: wxt.config.publicDir });
|
|
92
2679
|
return files.map(unnormalizePath);
|
|
93
2680
|
}
|
|
94
2681
|
|
|
95
2682
|
// src/core/utils/building/build-entrypoints.ts
|
|
96
|
-
var
|
|
2683
|
+
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
97
2684
|
var import_path = require("path");
|
|
98
2685
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
99
2686
|
async function buildEntrypoints(groups, spinner) {
|
|
@@ -121,8 +2708,8 @@ async function copyPublicDirectory() {
|
|
|
121
2708
|
for (const file of files) {
|
|
122
2709
|
const srcPath = (0, import_path.resolve)(wxt.config.publicDir, file);
|
|
123
2710
|
const outPath = (0, import_path.resolve)(wxt.config.outDir, file);
|
|
124
|
-
await
|
|
125
|
-
await
|
|
2711
|
+
await import_fs_extra3.default.ensureDir((0, import_path.dirname)(outPath));
|
|
2712
|
+
await import_fs_extra3.default.copyFile(srcPath, outPath);
|
|
126
2713
|
publicAssets.push({
|
|
127
2714
|
type: "asset",
|
|
128
2715
|
fileName: file
|
|
@@ -241,25 +2828,25 @@ function findEffectedSteps(changedFile, currentOutput) {
|
|
|
241
2828
|
|
|
242
2829
|
// src/core/utils/building/find-entrypoints.ts
|
|
243
2830
|
var import_path2 = require("path");
|
|
244
|
-
var
|
|
2831
|
+
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
245
2832
|
var import_minimatch = require("minimatch");
|
|
246
2833
|
var import_linkedom = require("linkedom");
|
|
247
2834
|
var import_json5 = __toESM(require("json5"), 1);
|
|
248
2835
|
var import_fast_glob2 = __toESM(require("fast-glob"), 1);
|
|
249
2836
|
|
|
250
2837
|
// src/core/utils/entrypoints.ts
|
|
251
|
-
var
|
|
2838
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
252
2839
|
function getEntrypointName(entrypointsDir, inputPath) {
|
|
253
|
-
const relativePath =
|
|
2840
|
+
const relativePath = import_node_path5.default.relative(entrypointsDir, inputPath);
|
|
254
2841
|
const name = relativePath.split(/[\.\/\\]/, 2)[0];
|
|
255
2842
|
return name;
|
|
256
2843
|
}
|
|
257
2844
|
function getEntrypointOutputFile(entrypoint, ext) {
|
|
258
|
-
return (0,
|
|
2845
|
+
return (0, import_node_path5.resolve)(entrypoint.outputDir, `${entrypoint.name}${ext}`);
|
|
259
2846
|
}
|
|
260
2847
|
function getEntrypointBundlePath(entrypoint, outDir, ext) {
|
|
261
2848
|
return normalizePath(
|
|
262
|
-
(0,
|
|
2849
|
+
(0, import_node_path5.relative)(outDir, getEntrypointOutputFile(entrypoint, ext))
|
|
263
2850
|
);
|
|
264
2851
|
}
|
|
265
2852
|
function resolvePerBrowserOption(option, browser) {
|
|
@@ -294,7 +2881,7 @@ async function findEntrypoints() {
|
|
|
294
2881
|
const inputPath = (0, import_path2.resolve)(wxt.config.entrypointsDir, relativePath);
|
|
295
2882
|
const name = getEntrypointName(wxt.config.entrypointsDir, inputPath);
|
|
296
2883
|
const matchingGlob = pathGlobs.find(
|
|
297
|
-
(
|
|
2884
|
+
(glob6) => (0, import_minimatch.minimatch)(relativePath, glob6)
|
|
298
2885
|
);
|
|
299
2886
|
if (matchingGlob) {
|
|
300
2887
|
const type = PATH_GLOB_TO_TYPE_MAP[matchingGlob];
|
|
@@ -587,7 +3174,7 @@ async function getSidepanelEntrypoint(info) {
|
|
|
587
3174
|
};
|
|
588
3175
|
}
|
|
589
3176
|
async function getHtmlEntrypointOptions(info, keyMap, queries, parsers) {
|
|
590
|
-
const content = await
|
|
3177
|
+
const content = await import_fs_extra4.default.readFile(info.inputPath, "utf-8");
|
|
591
3178
|
const { document } = (0, import_linkedom.parseHTML)(content);
|
|
592
3179
|
const options = {};
|
|
593
3180
|
const defaultQuery = (manifestKey) => document.querySelector(`meta[name='manifest.${manifestKey}']`)?.getAttribute("content");
|
|
@@ -650,7 +3237,7 @@ var CONTENT_SCRIPT_OUT_DIR = "content-scripts";
|
|
|
650
3237
|
|
|
651
3238
|
// src/core/utils/building/generate-wxt-dir.ts
|
|
652
3239
|
var import_unimport = require("unimport");
|
|
653
|
-
var
|
|
3240
|
+
var import_fs_extra5 = __toESM(require("fs-extra"), 1);
|
|
654
3241
|
var import_path3 = require("path");
|
|
655
3242
|
|
|
656
3243
|
// src/core/utils/globals.ts
|
|
@@ -709,7 +3296,7 @@ function getEntrypointGlobals(entrypointName) {
|
|
|
709
3296
|
}
|
|
710
3297
|
|
|
711
3298
|
// src/core/utils/building/generate-wxt-dir.ts
|
|
712
|
-
var
|
|
3299
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
713
3300
|
|
|
714
3301
|
// src/core/utils/i18n.ts
|
|
715
3302
|
var predefinedMessages = {
|
|
@@ -750,7 +3337,7 @@ function parseI18nMessages(messagesJson) {
|
|
|
750
3337
|
|
|
751
3338
|
// src/core/utils/building/generate-wxt-dir.ts
|
|
752
3339
|
async function generateTypesDir(entrypoints) {
|
|
753
|
-
await
|
|
3340
|
+
await import_fs_extra5.default.ensureDir(wxt.config.typesDir);
|
|
754
3341
|
const references = [];
|
|
755
3342
|
if (wxt.config.imports !== false) {
|
|
756
3343
|
const unimport2 = (0, import_unimport.createUnimport)(wxt.config.imports);
|
|
@@ -782,7 +3369,7 @@ async function writeImportsEslintFile(unimport2, options) {
|
|
|
782
3369
|
(await unimport2.getImports()).map((i) => i.as ?? i.name).filter(Boolean).sort().forEach((name) => {
|
|
783
3370
|
eslintrc.globals[name] = options.eslintrc.globalsPropValue;
|
|
784
3371
|
});
|
|
785
|
-
await
|
|
3372
|
+
await import_fs_extra5.default.writeJson(options.eslintrc.filePath, eslintrc, { spaces: 2 });
|
|
786
3373
|
}
|
|
787
3374
|
async function writePathsDeclarationFile(entrypoints) {
|
|
788
3375
|
const filePath = (0, import_path3.resolve)(wxt.config.typesDir, "paths.d.ts");
|
|
@@ -792,7 +3379,7 @@ async function writePathsDeclarationFile(entrypoints) {
|
|
|
792
3379
|
wxt.config.outDir,
|
|
793
3380
|
isHtmlEntrypoint(entry) ? ".html" : ".js"
|
|
794
3381
|
)
|
|
795
|
-
).concat(await getPublicFiles()).map(normalizePath).map((
|
|
3382
|
+
).concat(await getPublicFiles()).map(normalizePath).map((path13) => ` | "/${path13}"`).sort().join("\n");
|
|
796
3383
|
const template = `// Generated by wxt
|
|
797
3384
|
import "wxt/browser";
|
|
798
3385
|
|
|
@@ -836,13 +3423,13 @@ declare module "wxt/browser" {
|
|
|
836
3423
|
`;
|
|
837
3424
|
let messages;
|
|
838
3425
|
if (defaultLocale) {
|
|
839
|
-
const defaultLocalePath =
|
|
3426
|
+
const defaultLocalePath = import_node_path6.default.resolve(
|
|
840
3427
|
wxt.config.publicDir,
|
|
841
3428
|
"_locales",
|
|
842
3429
|
defaultLocale,
|
|
843
3430
|
"messages.json"
|
|
844
3431
|
);
|
|
845
|
-
const content = JSON.parse(await
|
|
3432
|
+
const content = JSON.parse(await import_fs_extra5.default.readFile(defaultLocalePath, "utf-8"));
|
|
846
3433
|
messages = parseI18nMessages(content);
|
|
847
3434
|
} else {
|
|
848
3435
|
messages = parseI18nMessages({});
|
|
@@ -874,7 +3461,7 @@ async function writeGlobalsDeclarationFile() {
|
|
|
874
3461
|
"// Generated by wxt",
|
|
875
3462
|
"export {}",
|
|
876
3463
|
"interface ImportMetaEnv {",
|
|
877
|
-
...globals2.map((
|
|
3464
|
+
...globals2.map((global3) => ` readonly ${global3.name}: ${global3.type};`),
|
|
878
3465
|
"}",
|
|
879
3466
|
"interface ImportMeta {",
|
|
880
3467
|
" readonly env: ImportMetaEnv",
|
|
@@ -900,7 +3487,7 @@ async function writeMainDeclarationFile(references) {
|
|
|
900
3487
|
}
|
|
901
3488
|
async function writeTsConfigFile(mainReference) {
|
|
902
3489
|
const dir = wxt.config.wxtDir;
|
|
903
|
-
const getTsconfigPath = (
|
|
3490
|
+
const getTsconfigPath = (path13) => normalizePath((0, import_path3.relative)(dir, path13));
|
|
904
3491
|
const paths = Object.entries(wxt.config.alias).flatMap(([alias, absolutePath]) => {
|
|
905
3492
|
const aliasPath = getTsconfigPath(absolutePath);
|
|
906
3493
|
return [
|
|
@@ -936,23 +3523,23 @@ ${paths}
|
|
|
936
3523
|
|
|
937
3524
|
// src/core/utils/building/resolve-config.ts
|
|
938
3525
|
var import_c12 = require("c12");
|
|
939
|
-
var
|
|
3526
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
940
3527
|
|
|
941
3528
|
// src/core/utils/cache.ts
|
|
942
|
-
var
|
|
3529
|
+
var import_fs_extra6 = __toESM(require("fs-extra"), 1);
|
|
943
3530
|
var import_path4 = require("path");
|
|
944
3531
|
function createFsCache(wxtDir) {
|
|
945
3532
|
const getPath = (key) => (0, import_path4.resolve)(wxtDir, "cache", encodeURIComponent(key));
|
|
946
3533
|
return {
|
|
947
3534
|
async set(key, value) {
|
|
948
|
-
const
|
|
949
|
-
await (0,
|
|
950
|
-
await writeFileIfDifferent(
|
|
3535
|
+
const path13 = getPath(key);
|
|
3536
|
+
await (0, import_fs_extra6.ensureDir)((0, import_path4.dirname)(path13));
|
|
3537
|
+
await writeFileIfDifferent(path13, value);
|
|
951
3538
|
},
|
|
952
3539
|
async get(key) {
|
|
953
|
-
const
|
|
3540
|
+
const path13 = getPath(key);
|
|
954
3541
|
try {
|
|
955
|
-
return await
|
|
3542
|
+
return await import_fs_extra6.default.readFile(path13, "utf-8");
|
|
956
3543
|
} catch {
|
|
957
3544
|
return void 0;
|
|
958
3545
|
}
|
|
@@ -965,11 +3552,11 @@ var import_consola = __toESM(require("consola"), 1);
|
|
|
965
3552
|
|
|
966
3553
|
// src/core/builders/vite/plugins/devHtmlPrerender.ts
|
|
967
3554
|
var import_linkedom2 = require("linkedom");
|
|
968
|
-
var
|
|
3555
|
+
var import_node_path7 = require("path");
|
|
969
3556
|
var reactRefreshPreamble = "";
|
|
970
3557
|
function devHtmlPrerender(config) {
|
|
971
3558
|
const htmlReloadId = "@wxt/reload-html";
|
|
972
|
-
const resolvedHtmlReloadId = (0,
|
|
3559
|
+
const resolvedHtmlReloadId = (0, import_node_path7.resolve)(
|
|
973
3560
|
config.wxtModuleDir,
|
|
974
3561
|
"dist/virtual/reload-html.js"
|
|
975
3562
|
);
|
|
@@ -1015,8 +3602,8 @@ function devHtmlPrerender(config) {
|
|
|
1015
3602
|
return;
|
|
1016
3603
|
const originalUrl = `${server.origin}${ctx.path}`;
|
|
1017
3604
|
const name = getEntrypointName(config.entrypointsDir, ctx.filename);
|
|
1018
|
-
const
|
|
1019
|
-
const serverHtml = await server.transformHtml(
|
|
3605
|
+
const url2 = `${server.origin}/${name}.html`;
|
|
3606
|
+
const serverHtml = await server.transformHtml(url2, html, originalUrl);
|
|
1020
3607
|
const { document } = (0, import_linkedom2.parseHTML)(serverHtml);
|
|
1021
3608
|
const reactRefreshScript = Array.from(
|
|
1022
3609
|
document.querySelectorAll("script[type=module]")
|
|
@@ -1074,25 +3661,25 @@ function pointToDevServer(config, server, id, document, querySelector, attr) {
|
|
|
1074
3661
|
);
|
|
1075
3662
|
if (matchingAlias) {
|
|
1076
3663
|
const [alias, replacement] = matchingAlias;
|
|
1077
|
-
resolvedAbsolutePath = (0,
|
|
3664
|
+
resolvedAbsolutePath = (0, import_node_path7.resolve)(
|
|
1078
3665
|
config.root,
|
|
1079
3666
|
src.replace(alias, replacement)
|
|
1080
3667
|
);
|
|
1081
3668
|
} else {
|
|
1082
|
-
resolvedAbsolutePath = (0,
|
|
3669
|
+
resolvedAbsolutePath = (0, import_node_path7.resolve)((0, import_node_path7.dirname)(id), src);
|
|
1083
3670
|
}
|
|
1084
3671
|
if (resolvedAbsolutePath) {
|
|
1085
3672
|
const relativePath = normalizePath(
|
|
1086
|
-
(0,
|
|
3673
|
+
(0, import_node_path7.relative)(config.root, resolvedAbsolutePath)
|
|
1087
3674
|
);
|
|
1088
3675
|
if (relativePath.startsWith(".")) {
|
|
1089
|
-
let
|
|
1090
|
-
if (!
|
|
1091
|
-
|
|
1092
|
-
element.setAttribute(attr, `${server.origin}/@fs${
|
|
3676
|
+
let path13 = normalizePath(resolvedAbsolutePath);
|
|
3677
|
+
if (!path13.startsWith("/"))
|
|
3678
|
+
path13 = "/" + path13;
|
|
3679
|
+
element.setAttribute(attr, `${server.origin}/@fs${path13}`);
|
|
1093
3680
|
} else {
|
|
1094
|
-
const
|
|
1095
|
-
element.setAttribute(attr,
|
|
3681
|
+
const url2 = new URL(relativePath, server.origin);
|
|
3682
|
+
element.setAttribute(attr, url2.href);
|
|
1096
3683
|
}
|
|
1097
3684
|
}
|
|
1098
3685
|
});
|
|
@@ -1163,24 +3750,24 @@ async function isOnline() {
|
|
|
1163
3750
|
const offline = await isOffline();
|
|
1164
3751
|
return !offline;
|
|
1165
3752
|
}
|
|
1166
|
-
async function fetchCached(
|
|
3753
|
+
async function fetchCached(url2, config) {
|
|
1167
3754
|
let content = "";
|
|
1168
3755
|
if (await isOnline()) {
|
|
1169
|
-
const res = await fetch(
|
|
3756
|
+
const res = await fetch(url2);
|
|
1170
3757
|
if (res.status < 300) {
|
|
1171
3758
|
content = await res.text();
|
|
1172
|
-
await config.fsCache.set(
|
|
3759
|
+
await config.fsCache.set(url2, content);
|
|
1173
3760
|
} else {
|
|
1174
3761
|
config.logger.debug(
|
|
1175
|
-
`Failed to download "${
|
|
3762
|
+
`Failed to download "${url2}", falling back to cache...`
|
|
1176
3763
|
);
|
|
1177
3764
|
}
|
|
1178
3765
|
}
|
|
1179
3766
|
if (!content)
|
|
1180
|
-
content = await config.fsCache.get(
|
|
3767
|
+
content = await config.fsCache.get(url2) ?? "";
|
|
1181
3768
|
if (!content)
|
|
1182
3769
|
throw Error(
|
|
1183
|
-
`Offline and "${
|
|
3770
|
+
`Offline and "${url2}" has not been cached. Try again when online.`
|
|
1184
3771
|
);
|
|
1185
3772
|
return content;
|
|
1186
3773
|
}
|
|
@@ -1196,15 +3783,15 @@ function download(config) {
|
|
|
1196
3783
|
async load(id) {
|
|
1197
3784
|
if (!id.startsWith("\0url:"))
|
|
1198
3785
|
return;
|
|
1199
|
-
const
|
|
1200
|
-
return await fetchCached(
|
|
3786
|
+
const url2 = id.replace("\0url:", "");
|
|
3787
|
+
return await fetchCached(url2, config);
|
|
1201
3788
|
}
|
|
1202
3789
|
};
|
|
1203
3790
|
}
|
|
1204
3791
|
|
|
1205
3792
|
// src/core/builders/vite/plugins/multipageMove.ts
|
|
1206
|
-
var
|
|
1207
|
-
var
|
|
3793
|
+
var import_node_path8 = require("path");
|
|
3794
|
+
var import_fs_extra7 = __toESM(require("fs-extra"), 1);
|
|
1208
3795
|
function multipageMove(entrypoints, config) {
|
|
1209
3796
|
return {
|
|
1210
3797
|
name: "wxt:multipage-move",
|
|
@@ -1222,7 +3809,7 @@ function multipageMove(entrypoints, config) {
|
|
|
1222
3809
|
const newBundlePath = getEntrypointBundlePath(
|
|
1223
3810
|
entrypoint,
|
|
1224
3811
|
config.outDir,
|
|
1225
|
-
(0,
|
|
3812
|
+
(0, import_node_path8.extname)(oldBundlePath)
|
|
1226
3813
|
);
|
|
1227
3814
|
if (newBundlePath === oldBundlePath) {
|
|
1228
3815
|
config.logger.debug(
|
|
@@ -1231,10 +3818,10 @@ function multipageMove(entrypoints, config) {
|
|
|
1231
3818
|
);
|
|
1232
3819
|
continue;
|
|
1233
3820
|
}
|
|
1234
|
-
const oldAbsPath = (0,
|
|
1235
|
-
const newAbsPath = (0,
|
|
1236
|
-
await (0,
|
|
1237
|
-
await
|
|
3821
|
+
const oldAbsPath = (0, import_node_path8.resolve)(config.outDir, oldBundlePath);
|
|
3822
|
+
const newAbsPath = (0, import_node_path8.resolve)(config.outDir, newBundlePath);
|
|
3823
|
+
await (0, import_fs_extra7.ensureDir)((0, import_node_path8.dirname)(newAbsPath));
|
|
3824
|
+
await import_fs_extra7.default.move(oldAbsPath, newAbsPath, { overwrite: true });
|
|
1238
3825
|
const renamedChunk = {
|
|
1239
3826
|
...bundle[oldBundlePath],
|
|
1240
3827
|
fileName: newBundlePath
|
|
@@ -1247,16 +3834,16 @@ function multipageMove(entrypoints, config) {
|
|
|
1247
3834
|
};
|
|
1248
3835
|
}
|
|
1249
3836
|
async function removeEmptyDirs(dir) {
|
|
1250
|
-
const files = await
|
|
3837
|
+
const files = await import_fs_extra7.default.readdir(dir);
|
|
1251
3838
|
for (const file of files) {
|
|
1252
|
-
const filePath = (0,
|
|
1253
|
-
const stats = await
|
|
3839
|
+
const filePath = (0, import_node_path8.join)(dir, file);
|
|
3840
|
+
const stats = await import_fs_extra7.default.stat(filePath);
|
|
1254
3841
|
if (stats.isDirectory()) {
|
|
1255
3842
|
await removeEmptyDirs(filePath);
|
|
1256
3843
|
}
|
|
1257
3844
|
}
|
|
1258
3845
|
try {
|
|
1259
|
-
await
|
|
3846
|
+
await import_fs_extra7.default.rmdir(dir);
|
|
1260
3847
|
} catch {
|
|
1261
3848
|
}
|
|
1262
3849
|
}
|
|
@@ -1297,7 +3884,7 @@ function unimport(config) {
|
|
|
1297
3884
|
}
|
|
1298
3885
|
|
|
1299
3886
|
// src/core/builders/vite/plugins/virtualEntrypoint.ts
|
|
1300
|
-
var
|
|
3887
|
+
var import_fs_extra8 = __toESM(require("fs-extra"), 1);
|
|
1301
3888
|
var import_path6 = require("path");
|
|
1302
3889
|
function virtualEntrypoint(type, config) {
|
|
1303
3890
|
const virtualId = `virtual:wxt-${type}?`;
|
|
@@ -1315,7 +3902,7 @@ function virtualEntrypoint(type, config) {
|
|
|
1315
3902
|
if (!id.startsWith(resolvedVirtualId))
|
|
1316
3903
|
return;
|
|
1317
3904
|
const inputPath = id.replace(resolvedVirtualId, "");
|
|
1318
|
-
const template = await
|
|
3905
|
+
const template = await import_fs_extra8.default.readFile(
|
|
1319
3906
|
(0, import_path6.resolve)(config.wxtModuleDir, `dist/virtual/${type}-entrypoint.js`),
|
|
1320
3907
|
"utf-8"
|
|
1321
3908
|
);
|
|
@@ -1383,12 +3970,12 @@ function cssEntrypoints(entrypoint, config) {
|
|
|
1383
3970
|
|
|
1384
3971
|
// src/core/builders/vite/plugins/bundleAnalysis.ts
|
|
1385
3972
|
var import_rollup_plugin_visualizer = require("@aklinker1/rollup-plugin-visualizer");
|
|
1386
|
-
var
|
|
3973
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
1387
3974
|
var increment = 0;
|
|
1388
3975
|
function bundleAnalysis(config) {
|
|
1389
3976
|
return (0, import_rollup_plugin_visualizer.visualizer)({
|
|
1390
3977
|
template: "raw-data",
|
|
1391
|
-
filename:
|
|
3978
|
+
filename: import_node_path9.default.resolve(
|
|
1392
3979
|
config.analysis.outputDir,
|
|
1393
3980
|
`${config.analysis.outputName}-${increment++}.json`
|
|
1394
3981
|
)
|
|
@@ -1401,8 +3988,8 @@ function globals(config) {
|
|
|
1401
3988
|
name: "wxt:globals",
|
|
1402
3989
|
config() {
|
|
1403
3990
|
const define = {};
|
|
1404
|
-
for (const
|
|
1405
|
-
define[`import.meta.env.${
|
|
3991
|
+
for (const global3 of getGlobals(config)) {
|
|
3992
|
+
define[`import.meta.env.${global3.name}`] = JSON.stringify(global3.value);
|
|
1406
3993
|
}
|
|
1407
3994
|
return {
|
|
1408
3995
|
define
|
|
@@ -1412,7 +3999,7 @@ function globals(config) {
|
|
|
1412
3999
|
}
|
|
1413
4000
|
|
|
1414
4001
|
// src/core/builders/vite/plugins/webextensionPolyfillMock.ts
|
|
1415
|
-
var
|
|
4002
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
1416
4003
|
|
|
1417
4004
|
// src/core/builders/vite/plugins/excludeBrowserPolyfill.ts
|
|
1418
4005
|
function excludeBrowserPolyfill(config) {
|
|
@@ -1445,8 +4032,8 @@ function entrypointGroupGlobals(entrypointGroup) {
|
|
|
1445
4032
|
config() {
|
|
1446
4033
|
const define = {};
|
|
1447
4034
|
let name = Array.isArray(entrypointGroup) ? "html" : entrypointGroup.name;
|
|
1448
|
-
for (const
|
|
1449
|
-
define[`import.meta.env.${
|
|
4035
|
+
for (const global3 of getEntrypointGlobals(name)) {
|
|
4036
|
+
define[`import.meta.env.${global3.name}`] = JSON.stringify(global3.value);
|
|
1450
4037
|
}
|
|
1451
4038
|
return {
|
|
1452
4039
|
define
|
|
@@ -1693,12 +4280,12 @@ function getRollupEntry(entrypoint) {
|
|
|
1693
4280
|
var import_defu = __toESM(require("defu"), 1);
|
|
1694
4281
|
|
|
1695
4282
|
// src/core/utils/package.ts
|
|
1696
|
-
var
|
|
1697
|
-
var
|
|
4283
|
+
var import_node_path11 = require("path");
|
|
4284
|
+
var import_fs_extra9 = __toESM(require("fs-extra"), 1);
|
|
1698
4285
|
async function getPackageJson() {
|
|
1699
|
-
const file = (0,
|
|
4286
|
+
const file = (0, import_node_path11.resolve)(wxt.config.root, "package.json");
|
|
1700
4287
|
try {
|
|
1701
|
-
return await
|
|
4288
|
+
return await import_fs_extra9.default.readJson(file);
|
|
1702
4289
|
} catch (err) {
|
|
1703
4290
|
wxt.logger.debug(
|
|
1704
4291
|
`Failed to read package.json at: ${file}. Returning undefined.`
|
|
@@ -1737,21 +4324,21 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1737
4324
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
1738
4325
|
const mode = mergedConfig.mode ?? (command === "build" ? "production" : "development");
|
|
1739
4326
|
const env = { browser, command, manifestVersion, mode };
|
|
1740
|
-
const root =
|
|
4327
|
+
const root = import_node_path12.default.resolve(
|
|
1741
4328
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
1742
4329
|
);
|
|
1743
|
-
const wxtDir =
|
|
4330
|
+
const wxtDir = import_node_path12.default.resolve(root, ".wxt");
|
|
1744
4331
|
const wxtModuleDir = await resolveWxtModuleDir();
|
|
1745
|
-
const srcDir =
|
|
1746
|
-
const entrypointsDir =
|
|
4332
|
+
const srcDir = import_node_path12.default.resolve(root, mergedConfig.srcDir ?? root);
|
|
4333
|
+
const entrypointsDir = import_node_path12.default.resolve(
|
|
1747
4334
|
srcDir,
|
|
1748
4335
|
mergedConfig.entrypointsDir ?? "entrypoints"
|
|
1749
4336
|
);
|
|
1750
4337
|
const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
|
|
1751
|
-
const publicDir =
|
|
1752
|
-
const typesDir =
|
|
1753
|
-
const outBaseDir =
|
|
1754
|
-
const outDir =
|
|
4338
|
+
const publicDir = import_node_path12.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
|
|
4339
|
+
const typesDir = import_node_path12.default.resolve(wxtDir, "types");
|
|
4340
|
+
const outBaseDir = import_node_path12.default.resolve(root, mergedConfig.outDir ?? ".output");
|
|
4341
|
+
const outDir = import_node_path12.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
|
|
1755
4342
|
const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
|
|
1756
4343
|
const runnerConfig = await (0, import_c12.loadConfig)({
|
|
1757
4344
|
name: "web-ext",
|
|
@@ -1768,14 +4355,14 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1768
4355
|
"~": srcDir,
|
|
1769
4356
|
"@@": root,
|
|
1770
4357
|
"~~": root
|
|
1771
|
-
}).map(([key, value]) => [key,
|
|
4358
|
+
}).map(([key, value]) => [key, import_node_path12.default.resolve(root, value)])
|
|
1772
4359
|
);
|
|
1773
|
-
const analysisOutputFile =
|
|
4360
|
+
const analysisOutputFile = import_node_path12.default.resolve(
|
|
1774
4361
|
root,
|
|
1775
4362
|
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
1776
4363
|
);
|
|
1777
|
-
const analysisOutputDir =
|
|
1778
|
-
const analysisOutputName =
|
|
4364
|
+
const analysisOutputDir = import_node_path12.default.dirname(analysisOutputFile);
|
|
4365
|
+
const analysisOutputName = import_node_path12.default.parse(analysisOutputFile).name;
|
|
1779
4366
|
const finalConfig = {
|
|
1780
4367
|
browser,
|
|
1781
4368
|
command,
|
|
@@ -1900,6 +4487,7 @@ function mergeInlineConfig(inlineConfig, userConfig) {
|
|
|
1900
4487
|
};
|
|
1901
4488
|
}
|
|
1902
4489
|
function resolveInternalZipConfig(root, mergedConfig) {
|
|
4490
|
+
const downloadedPackagesDir = import_node_path12.default.resolve(root, ".wxt/local_modules");
|
|
1903
4491
|
return {
|
|
1904
4492
|
name: void 0,
|
|
1905
4493
|
sourcesTemplate: "{{name}}-{{version}}-sources.zip",
|
|
@@ -1918,7 +4506,9 @@ function resolveInternalZipConfig(root, mergedConfig) {
|
|
|
1918
4506
|
"**/*.+(test|spec).?(c|m)+(j|t)s?(x)",
|
|
1919
4507
|
// From user
|
|
1920
4508
|
...mergedConfig.zip?.excludeSources ?? []
|
|
1921
|
-
]
|
|
4509
|
+
],
|
|
4510
|
+
downloadPackages: mergedConfig.zip?.downloadPackages ?? [],
|
|
4511
|
+
downloadedPackagesDir
|
|
1922
4512
|
};
|
|
1923
4513
|
}
|
|
1924
4514
|
async function getUnimportOptions(wxtDir, logger, config) {
|
|
@@ -1950,7 +4540,7 @@ async function getUnimportOptions(wxtDir, logger, config) {
|
|
|
1950
4540
|
dirs: ["components", "composables", "hooks", "utils"],
|
|
1951
4541
|
eslintrc: {
|
|
1952
4542
|
enabled,
|
|
1953
|
-
filePath:
|
|
4543
|
+
filePath: import_node_path12.default.resolve(wxtDir, "eslintrc-auto-import.json"),
|
|
1954
4544
|
globalsPropValue: true
|
|
1955
4545
|
}
|
|
1956
4546
|
};
|
|
@@ -1961,7 +4551,7 @@ async function getUnimportOptions(wxtDir, logger, config) {
|
|
|
1961
4551
|
}
|
|
1962
4552
|
async function resolveWxtModuleDir() {
|
|
1963
4553
|
const requireResolve = require?.resolve ?? (await import("module")).default.createRequire(import_meta.url).resolve;
|
|
1964
|
-
return
|
|
4554
|
+
return import_node_path12.default.resolve(requireResolve("wxt"), "../..");
|
|
1965
4555
|
}
|
|
1966
4556
|
|
|
1967
4557
|
// src/core/utils/building/group-entrypoints.ts
|
|
@@ -2006,8 +4596,8 @@ var ENTRY_TYPE_TO_GROUP_MAP = {
|
|
|
2006
4596
|
// src/core/utils/building/import-entrypoint.ts
|
|
2007
4597
|
var import_jiti = __toESM(require("jiti"), 1);
|
|
2008
4598
|
var import_unimport3 = require("unimport");
|
|
2009
|
-
var
|
|
2010
|
-
var
|
|
4599
|
+
var import_fs_extra10 = __toESM(require("fs-extra"), 1);
|
|
4600
|
+
var import_node_path13 = require("path");
|
|
2011
4601
|
|
|
2012
4602
|
// src/core/utils/strings.ts
|
|
2013
4603
|
function kebabCaseAlphanumeric(str) {
|
|
@@ -2028,31 +4618,31 @@ ${noImports}`;
|
|
|
2028
4618
|
|
|
2029
4619
|
// src/core/utils/building/import-entrypoint.ts
|
|
2030
4620
|
var import_esbuild = require("esbuild");
|
|
2031
|
-
var
|
|
4621
|
+
var import_node_url2 = require("url");
|
|
2032
4622
|
var import_meta2 = {};
|
|
2033
|
-
async function importEntrypointFile(
|
|
2034
|
-
wxt.logger.debug("Loading file metadata:",
|
|
2035
|
-
const normalPath = normalizePath(
|
|
4623
|
+
async function importEntrypointFile(path13) {
|
|
4624
|
+
wxt.logger.debug("Loading file metadata:", path13);
|
|
4625
|
+
const normalPath = normalizePath(path13);
|
|
2036
4626
|
const unimport2 = (0, import_unimport3.createUnimport)({
|
|
2037
4627
|
...wxt.config.imports,
|
|
2038
4628
|
// Only allow specific imports, not all from the project
|
|
2039
4629
|
dirs: []
|
|
2040
4630
|
});
|
|
2041
4631
|
await unimport2.init();
|
|
2042
|
-
const text = await
|
|
4632
|
+
const text = await import_fs_extra10.default.readFile(path13, "utf-8");
|
|
2043
4633
|
const textNoImports = removeProjectImportStatements(text);
|
|
2044
4634
|
const { code } = await unimport2.injectImports(textNoImports);
|
|
2045
4635
|
wxt.logger.debug(
|
|
2046
4636
|
["Text:", text, "No imports:", textNoImports, "Code:", code].join("\n")
|
|
2047
4637
|
);
|
|
2048
4638
|
const jiti = (0, import_jiti.default)(
|
|
2049
|
-
typeof __filename !== "undefined" ? __filename : (0,
|
|
4639
|
+
typeof __filename !== "undefined" ? __filename : (0, import_node_url2.fileURLToPath)(import_meta2.url),
|
|
2050
4640
|
{
|
|
2051
4641
|
cache: false,
|
|
2052
4642
|
debug: wxt.config.debug,
|
|
2053
4643
|
esmResolve: true,
|
|
2054
4644
|
alias: {
|
|
2055
|
-
"webextension-polyfill": (0,
|
|
4645
|
+
"webextension-polyfill": (0, import_node_path13.resolve)(
|
|
2056
4646
|
wxt.config.wxtModuleDir,
|
|
2057
4647
|
"dist/virtual/mock-browser.js"
|
|
2058
4648
|
)
|
|
@@ -2082,10 +4672,10 @@ async function importEntrypointFile(path9) {
|
|
|
2082
4672
|
}
|
|
2083
4673
|
);
|
|
2084
4674
|
try {
|
|
2085
|
-
const res = await jiti(
|
|
4675
|
+
const res = await jiti(path13);
|
|
2086
4676
|
return res.default;
|
|
2087
4677
|
} catch (err) {
|
|
2088
|
-
const filePath = (0,
|
|
4678
|
+
const filePath = (0, import_node_path13.relative)(wxt.config.root, path13);
|
|
2089
4679
|
if (err instanceof ReferenceError) {
|
|
2090
4680
|
const variableName = err.message.replace(" is not defined", "");
|
|
2091
4681
|
throw Error(
|
|
@@ -2114,15 +4704,15 @@ function getEsbuildOptions(opts) {
|
|
|
2114
4704
|
|
|
2115
4705
|
// src/core/utils/building/internal-build.ts
|
|
2116
4706
|
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
2117
|
-
var
|
|
4707
|
+
var import_fs_extra13 = __toESM(require("fs-extra"), 1);
|
|
2118
4708
|
|
|
2119
4709
|
// src/core/utils/log/printBuildSummary.ts
|
|
2120
4710
|
var import_path7 = require("path");
|
|
2121
4711
|
|
|
2122
4712
|
// src/core/utils/log/printFileList.ts
|
|
2123
|
-
var
|
|
4713
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
2124
4714
|
var import_picocolors3 = __toESM(require("picocolors"), 1);
|
|
2125
|
-
var
|
|
4715
|
+
var import_fs_extra11 = __toESM(require("fs-extra"), 1);
|
|
2126
4716
|
var import_filesize = require("filesize");
|
|
2127
4717
|
|
|
2128
4718
|
// src/core/utils/log/printTable.ts
|
|
@@ -2158,12 +4748,12 @@ async function printFileList(log, header, baseDir, files) {
|
|
|
2158
4748
|
const fileRows = await Promise.all(
|
|
2159
4749
|
files.map(async (file, i) => {
|
|
2160
4750
|
const parts = [
|
|
2161
|
-
|
|
2162
|
-
|
|
4751
|
+
import_node_path14.default.relative(process.cwd(), baseDir) + import_node_path14.default.sep,
|
|
4752
|
+
import_node_path14.default.relative(baseDir, file)
|
|
2163
4753
|
];
|
|
2164
4754
|
const prefix = i === files.length - 1 ? " \u2514\u2500" : " \u251C\u2500";
|
|
2165
4755
|
const color = getChunkColor(file);
|
|
2166
|
-
const stats = await
|
|
4756
|
+
const stats = await import_fs_extra11.default.lstat(file);
|
|
2167
4757
|
totalSize += stats.size;
|
|
2168
4758
|
const size = String((0, import_filesize.filesize)(stats.size));
|
|
2169
4759
|
return [
|
|
@@ -2227,7 +4817,7 @@ function getChunkSortWeight(filename) {
|
|
|
2227
4817
|
var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
2228
4818
|
|
|
2229
4819
|
// package.json
|
|
2230
|
-
var version = "0.17.
|
|
4820
|
+
var version = "0.17.5";
|
|
2231
4821
|
|
|
2232
4822
|
// src/core/utils/log/printHeader.ts
|
|
2233
4823
|
var import_consola2 = require("consola");
|
|
@@ -2236,7 +4826,7 @@ var import_consola2 = require("consola");
|
|
|
2236
4826
|
var import_fast_glob3 = __toESM(require("fast-glob"), 1);
|
|
2237
4827
|
|
|
2238
4828
|
// src/core/utils/manifest.ts
|
|
2239
|
-
var
|
|
4829
|
+
var import_fs_extra12 = __toESM(require("fs-extra"), 1);
|
|
2240
4830
|
var import_path8 = require("path");
|
|
2241
4831
|
|
|
2242
4832
|
// src/core/utils/content-security-policy.ts
|
|
@@ -2347,7 +4937,7 @@ function mapWxtOptionsToRegisteredContentScript(options, js, css) {
|
|
|
2347
4937
|
var import_defu2 = __toESM(require("defu"), 1);
|
|
2348
4938
|
async function writeManifest(manifest, output) {
|
|
2349
4939
|
const str = wxt.config.mode === "production" ? JSON.stringify(manifest) : JSON.stringify(manifest, null, 2);
|
|
2350
|
-
await
|
|
4940
|
+
await import_fs_extra12.default.ensureDir(wxt.config.outDir);
|
|
2351
4941
|
await writeFileIfDifferent((0, import_path8.resolve)(wxt.config.outDir, "manifest.json"), str);
|
|
2352
4942
|
output.publicAssets.unshift({
|
|
2353
4943
|
type: "asset",
|
|
@@ -2837,7 +5427,7 @@ async function rebuild(allEntrypoints, entrypointGroups, existingOutput = {
|
|
|
2837
5427
|
}
|
|
2838
5428
|
|
|
2839
5429
|
// src/core/utils/building/internal-build.ts
|
|
2840
|
-
var
|
|
5430
|
+
var import_node_path15 = require("path");
|
|
2841
5431
|
|
|
2842
5432
|
// src/core/utils/validation.ts
|
|
2843
5433
|
function validateEntrypoints(entrypoints) {
|
|
@@ -2911,8 +5501,8 @@ async function internalBuild() {
|
|
|
2911
5501
|
)}`
|
|
2912
5502
|
);
|
|
2913
5503
|
const startTime = Date.now();
|
|
2914
|
-
await
|
|
2915
|
-
await
|
|
5504
|
+
await import_fs_extra13.default.rm(wxt.config.outDir, { recursive: true, force: true });
|
|
5505
|
+
await import_fs_extra13.default.ensureDir(wxt.config.outDir);
|
|
2916
5506
|
const entrypoints = await findEntrypoints();
|
|
2917
5507
|
wxt.logger.debug("Detected entrypoints:", entrypoints);
|
|
2918
5508
|
const validationResults = validateEntrypoints(entrypoints);
|
|
@@ -2938,7 +5528,7 @@ async function internalBuild() {
|
|
|
2938
5528
|
}
|
|
2939
5529
|
if (wxt.config.analysis.enabled) {
|
|
2940
5530
|
await combineAnalysisStats();
|
|
2941
|
-
const statsPath = (0,
|
|
5531
|
+
const statsPath = (0, import_node_path15.relative)(wxt.config.root, wxt.config.analysis.outputFile);
|
|
2942
5532
|
wxt.logger.info(
|
|
2943
5533
|
`Analysis complete:
|
|
2944
5534
|
${import_picocolors5.default.gray("\u2514\u2500")} ${import_picocolors5.default.yellow(statsPath)}`
|
|
@@ -2958,7 +5548,7 @@ async function combineAnalysisStats() {
|
|
|
2958
5548
|
filename: wxt.config.analysis.outputFile
|
|
2959
5549
|
});
|
|
2960
5550
|
if (!wxt.config.analysis.keepArtifacts) {
|
|
2961
|
-
await Promise.all(absolutePaths.map((statsFile) =>
|
|
5551
|
+
await Promise.all(absolutePaths.map((statsFile) => import_fs_extra13.default.remove(statsFile)));
|
|
2962
5552
|
}
|
|
2963
5553
|
}
|
|
2964
5554
|
function printValidationResults({
|
|
@@ -2977,7 +5567,7 @@ function printValidationResults({
|
|
|
2977
5567
|
return map;
|
|
2978
5568
|
}, /* @__PURE__ */ new Map());
|
|
2979
5569
|
Array.from(entrypointErrors.entries()).forEach(([entrypoint, errors2]) => {
|
|
2980
|
-
import_consola3.default.log((0,
|
|
5570
|
+
import_consola3.default.log((0, import_node_path15.relative)(cwd, entrypoint.inputPath));
|
|
2981
5571
|
console.log();
|
|
2982
5572
|
errors2.forEach((err) => {
|
|
2983
5573
|
const type = err.type === "error" ? import_picocolors5.default.red("ERROR") : import_picocolors5.default.yellow("WARN");
|
|
@@ -2995,9 +5585,9 @@ async function build(config) {
|
|
|
2995
5585
|
}
|
|
2996
5586
|
|
|
2997
5587
|
// src/core/clean.ts
|
|
2998
|
-
var
|
|
5588
|
+
var import_node_path16 = __toESM(require("path"), 1);
|
|
2999
5589
|
var import_fast_glob4 = __toESM(require("fast-glob"), 1);
|
|
3000
|
-
var
|
|
5590
|
+
var import_fs_extra14 = __toESM(require("fs-extra"), 1);
|
|
3001
5591
|
var import_consola4 = require("consola");
|
|
3002
5592
|
var import_picocolors6 = __toESM(require("picocolors"), 1);
|
|
3003
5593
|
async function clean(root = process.cwd()) {
|
|
@@ -3010,7 +5600,7 @@ async function clean(root = process.cwd()) {
|
|
|
3010
5600
|
];
|
|
3011
5601
|
import_consola4.consola.debug("Looking for:", tempDirs.map(import_picocolors6.default.cyan).join(", "));
|
|
3012
5602
|
const directories = await (0, import_fast_glob4.default)(tempDirs, {
|
|
3013
|
-
cwd:
|
|
5603
|
+
cwd: import_node_path16.default.resolve(root),
|
|
3014
5604
|
absolute: true,
|
|
3015
5605
|
onlyDirectories: true,
|
|
3016
5606
|
deep: 2
|
|
@@ -3021,11 +5611,11 @@ async function clean(root = process.cwd()) {
|
|
|
3021
5611
|
}
|
|
3022
5612
|
import_consola4.consola.debug(
|
|
3023
5613
|
"Found:",
|
|
3024
|
-
directories.map((dir) => import_picocolors6.default.cyan(
|
|
5614
|
+
directories.map((dir) => import_picocolors6.default.cyan(import_node_path16.default.relative(root, dir))).join(", ")
|
|
3025
5615
|
);
|
|
3026
5616
|
for (const directory of directories) {
|
|
3027
|
-
await
|
|
3028
|
-
import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(
|
|
5617
|
+
await import_fs_extra14.default.rm(directory, { force: true, recursive: true });
|
|
5618
|
+
import_consola4.consola.debug("Deleted " + import_picocolors6.default.cyan(import_node_path16.default.relative(root, directory)));
|
|
3029
5619
|
}
|
|
3030
5620
|
}
|
|
3031
5621
|
|
|
@@ -3040,12 +5630,12 @@ function defineRunnerConfig(config) {
|
|
|
3040
5630
|
}
|
|
3041
5631
|
|
|
3042
5632
|
// src/core/runners/wsl.ts
|
|
3043
|
-
var
|
|
5633
|
+
var import_node_path17 = require("path");
|
|
3044
5634
|
function createWslRunner() {
|
|
3045
5635
|
return {
|
|
3046
5636
|
async openBrowser() {
|
|
3047
5637
|
wxt.logger.warn(
|
|
3048
|
-
`Cannot open browser when using WSL. Load "${(0,
|
|
5638
|
+
`Cannot open browser when using WSL. Load "${(0, import_node_path17.relative)(
|
|
3049
5639
|
process.cwd(),
|
|
3050
5640
|
wxt.config.outDir
|
|
3051
5641
|
)}" as an unpacked extension manually`
|
|
@@ -3133,12 +5723,12 @@ var DEFAULT_CHROMIUM_PREFS = {
|
|
|
3133
5723
|
};
|
|
3134
5724
|
|
|
3135
5725
|
// src/core/runners/safari.ts
|
|
3136
|
-
var
|
|
5726
|
+
var import_node_path18 = require("path");
|
|
3137
5727
|
function createSafariRunner() {
|
|
3138
5728
|
return {
|
|
3139
5729
|
async openBrowser() {
|
|
3140
5730
|
wxt.logger.warn(
|
|
3141
|
-
`Cannot Safari using web-ext. Load "${(0,
|
|
5731
|
+
`Cannot Safari using web-ext. Load "${(0, import_node_path18.relative)(
|
|
3142
5732
|
process.cwd(),
|
|
3143
5733
|
wxt.config.outDir
|
|
3144
5734
|
)}" as an unpacked extension manually`
|
|
@@ -3150,12 +5740,12 @@ function createSafariRunner() {
|
|
|
3150
5740
|
}
|
|
3151
5741
|
|
|
3152
5742
|
// src/core/runners/manual.ts
|
|
3153
|
-
var
|
|
5743
|
+
var import_node_path19 = require("path");
|
|
3154
5744
|
function createManualRunner() {
|
|
3155
5745
|
return {
|
|
3156
5746
|
async openBrowser() {
|
|
3157
5747
|
wxt.logger.info(
|
|
3158
|
-
`Load "${(0,
|
|
5748
|
+
`Load "${(0, import_node_path19.relative)(
|
|
3159
5749
|
process.cwd(),
|
|
3160
5750
|
wxt.config.outDir
|
|
3161
5751
|
)}" as an unpacked extension manually`
|
|
@@ -3187,7 +5777,7 @@ async function createExtensionRunner() {
|
|
|
3187
5777
|
var import_consola5 = require("consola");
|
|
3188
5778
|
var import_async_mutex = require("async-mutex");
|
|
3189
5779
|
var import_picocolors7 = __toESM(require("picocolors"), 1);
|
|
3190
|
-
var
|
|
5780
|
+
var import_node_path20 = require("path");
|
|
3191
5781
|
async function createServer(inlineConfig) {
|
|
3192
5782
|
const port = await getPort();
|
|
3193
5783
|
const hostname = "localhost";
|
|
@@ -3233,14 +5823,14 @@ async function createServer(inlineConfig) {
|
|
|
3233
5823
|
await closeAndRecreateRunner();
|
|
3234
5824
|
await buildAndOpenBrowser();
|
|
3235
5825
|
},
|
|
3236
|
-
transformHtml(
|
|
3237
|
-
return builderServer.transformHtml(
|
|
5826
|
+
transformHtml(url2, html, originalUrl) {
|
|
5827
|
+
return builderServer.transformHtml(url2, html, originalUrl);
|
|
3238
5828
|
},
|
|
3239
5829
|
reloadContentScript(payload) {
|
|
3240
5830
|
server.ws.send("wxt:reload-content-script", payload);
|
|
3241
5831
|
},
|
|
3242
|
-
reloadPage(
|
|
3243
|
-
server.ws.send("wxt:reload-page",
|
|
5832
|
+
reloadPage(path13) {
|
|
5833
|
+
server.ws.send("wxt:reload-page", path13);
|
|
3244
5834
|
},
|
|
3245
5835
|
reloadExtension() {
|
|
3246
5836
|
server.ws.send("wxt:reload-extension");
|
|
@@ -3271,11 +5861,11 @@ async function getPort() {
|
|
|
3271
5861
|
function createFileReloader(server) {
|
|
3272
5862
|
const fileChangedMutex = new import_async_mutex.Mutex();
|
|
3273
5863
|
const changeQueue = [];
|
|
3274
|
-
return async (event,
|
|
5864
|
+
return async (event, path13) => {
|
|
3275
5865
|
await wxt.reloadConfig();
|
|
3276
|
-
if (
|
|
5866
|
+
if (path13.startsWith(wxt.config.outBaseDir))
|
|
3277
5867
|
return;
|
|
3278
|
-
changeQueue.push([event,
|
|
5868
|
+
changeQueue.push([event, path13]);
|
|
3279
5869
|
await fileChangedMutex.runExclusive(async () => {
|
|
3280
5870
|
if (server.currentOutput == null)
|
|
3281
5871
|
return;
|
|
@@ -3296,7 +5886,7 @@ function createFileReloader(server) {
|
|
|
3296
5886
|
return;
|
|
3297
5887
|
}
|
|
3298
5888
|
wxt.logger.info(
|
|
3299
|
-
`Changed: ${Array.from(new Set(fileChanges)).map((file) => import_picocolors7.default.dim((0,
|
|
5889
|
+
`Changed: ${Array.from(new Set(fileChanges)).map((file) => import_picocolors7.default.dim((0, import_node_path20.relative)(wxt.config.root, file))).join(", ")}`
|
|
3300
5890
|
);
|
|
3301
5891
|
const allEntrypoints = await findEntrypoints();
|
|
3302
5892
|
const { output: newOutput } = await rebuild(
|
|
@@ -3354,8 +5944,8 @@ function reloadContentScripts(steps, server) {
|
|
|
3354
5944
|
function reloadHtmlPages(groups, server) {
|
|
3355
5945
|
const htmlEntries = groups.flat().filter(isHtmlEntrypoint);
|
|
3356
5946
|
htmlEntries.forEach((entry) => {
|
|
3357
|
-
const
|
|
3358
|
-
server.reloadPage(
|
|
5947
|
+
const path13 = getEntrypointBundlePath(entry, wxt.config.outDir, ".html");
|
|
5948
|
+
server.reloadPage(path13);
|
|
3359
5949
|
});
|
|
3360
5950
|
return {
|
|
3361
5951
|
reloadedNames: htmlEntries.map((entry) => entry.name)
|
|
@@ -3385,8 +5975,8 @@ function getExternalOutputDependencies(server) {
|
|
|
3385
5975
|
var import_prompts = __toESM(require("prompts"), 1);
|
|
3386
5976
|
var import_consola6 = require("consola");
|
|
3387
5977
|
var import_giget = require("giget");
|
|
3388
|
-
var
|
|
3389
|
-
var
|
|
5978
|
+
var import_fs_extra15 = __toESM(require("fs-extra"), 1);
|
|
5979
|
+
var import_node_path21 = __toESM(require("path"), 1);
|
|
3390
5980
|
var import_picocolors8 = __toESM(require("picocolors"), 1);
|
|
3391
5981
|
async function initialize(options) {
|
|
3392
5982
|
import_consola6.consola.info("Initalizing new project");
|
|
@@ -3434,7 +6024,7 @@ async function initialize(options) {
|
|
|
3434
6024
|
input.template ??= defaultTemplate;
|
|
3435
6025
|
input.packageManager ??= options.packageManager;
|
|
3436
6026
|
await cloneProject(input);
|
|
3437
|
-
const cdPath =
|
|
6027
|
+
const cdPath = import_node_path21.default.relative(process.cwd(), import_node_path21.default.resolve(input.directory));
|
|
3438
6028
|
console.log();
|
|
3439
6029
|
import_consola6.consola.log(
|
|
3440
6030
|
`\u2728 WXT project created with the ${TEMPLATE_COLORS[input.template.name]?.(input.template.name) ?? input.template.name} template.`
|
|
@@ -3477,9 +6067,9 @@ async function cloneProject({
|
|
|
3477
6067
|
dir: directory,
|
|
3478
6068
|
force: true
|
|
3479
6069
|
});
|
|
3480
|
-
await
|
|
3481
|
-
|
|
3482
|
-
|
|
6070
|
+
await import_fs_extra15.default.move(
|
|
6071
|
+
import_node_path21.default.join(directory, "_gitignore"),
|
|
6072
|
+
import_node_path21.default.join(directory, ".gitignore")
|
|
3483
6073
|
).catch(
|
|
3484
6074
|
(err) => import_consola6.consola.warn("Failed to move _gitignore to .gitignore:", err)
|
|
3485
6075
|
);
|
|
@@ -3511,10 +6101,11 @@ async function prepare(config) {
|
|
|
3511
6101
|
}
|
|
3512
6102
|
|
|
3513
6103
|
// src/core/zip.ts
|
|
3514
|
-
var
|
|
3515
|
-
var
|
|
3516
|
-
var import_fs_extra15 = __toESM(require("fs-extra"), 1);
|
|
6104
|
+
var import_node_path22 = __toESM(require("path"), 1);
|
|
6105
|
+
var import_fs_extra16 = __toESM(require("fs-extra"), 1);
|
|
3517
6106
|
var import_minimatch2 = require("minimatch");
|
|
6107
|
+
var import_jszip = __toESM(require("jszip"), 1);
|
|
6108
|
+
var import_fast_glob5 = __toESM(require("fast-glob"), 1);
|
|
3518
6109
|
async function zip(config) {
|
|
3519
6110
|
await registerWxt("build", config);
|
|
3520
6111
|
const output = await internalBuild();
|
|
@@ -3522,32 +6113,33 @@ async function zip(config) {
|
|
|
3522
6113
|
wxt.logger.info("Zipping extension...");
|
|
3523
6114
|
const zipFiles = [];
|
|
3524
6115
|
const projectName = wxt.config.zip.name ?? kebabCaseAlphanumeric(
|
|
3525
|
-
(await getPackageJson())?.name ||
|
|
6116
|
+
(await getPackageJson())?.name || import_node_path22.default.dirname(process.cwd())
|
|
3526
6117
|
);
|
|
3527
6118
|
const applyTemplate = (template) => template.replaceAll("{{name}}", projectName).replaceAll("{{browser}}", wxt.config.browser).replaceAll(
|
|
3528
6119
|
"{{version}}",
|
|
3529
6120
|
output.manifest.version_name ?? output.manifest.version
|
|
3530
6121
|
).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
3531
|
-
await
|
|
6122
|
+
await import_fs_extra16.default.ensureDir(wxt.config.outBaseDir);
|
|
3532
6123
|
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
|
3533
|
-
const outZipPath =
|
|
3534
|
-
await (
|
|
3535
|
-
saveTo: outZipPath
|
|
3536
|
-
});
|
|
6124
|
+
const outZipPath = import_node_path22.default.resolve(wxt.config.outBaseDir, outZipFilename);
|
|
6125
|
+
await zipDir(wxt.config.outDir, outZipPath);
|
|
3537
6126
|
zipFiles.push(outZipPath);
|
|
3538
6127
|
if (wxt.config.browser === "firefox") {
|
|
6128
|
+
const { overrides, files: downloadedPackages } = await downloadPrivatePackages();
|
|
3539
6129
|
const sourcesZipFilename = applyTemplate(wxt.config.zip.sourcesTemplate);
|
|
3540
|
-
const sourcesZipPath =
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
6130
|
+
const sourcesZipPath = import_node_path22.default.resolve(
|
|
6131
|
+
wxt.config.outBaseDir,
|
|
6132
|
+
sourcesZipFilename
|
|
6133
|
+
);
|
|
6134
|
+
await zipDir(wxt.config.zip.sourcesRoot, sourcesZipPath, {
|
|
6135
|
+
include: wxt.config.zip.includeSources,
|
|
6136
|
+
exclude: wxt.config.zip.excludeSources,
|
|
6137
|
+
transform(file, content) {
|
|
6138
|
+
if (file.endsWith("package.json")) {
|
|
6139
|
+
return addOverridesToPackageJson(content, overrides);
|
|
6140
|
+
}
|
|
6141
|
+
},
|
|
6142
|
+
additionalFiles: downloadedPackages
|
|
3551
6143
|
});
|
|
3552
6144
|
zipFiles.push(sourcesZipPath);
|
|
3553
6145
|
}
|
|
@@ -3559,6 +6151,81 @@ async function zip(config) {
|
|
|
3559
6151
|
);
|
|
3560
6152
|
return zipFiles;
|
|
3561
6153
|
}
|
|
6154
|
+
async function zipDir(directory, outputPath, options) {
|
|
6155
|
+
const archive = new import_jszip.default();
|
|
6156
|
+
const files = (await (0, import_fast_glob5.default)("**/*", {
|
|
6157
|
+
cwd: directory,
|
|
6158
|
+
// Ignore node_modules, otherwise this glob step takes forever
|
|
6159
|
+
ignore: ["**/node_modules"],
|
|
6160
|
+
onlyFiles: true
|
|
6161
|
+
})).filter((relativePath) => {
|
|
6162
|
+
return wxt.config.zip.includeSources.some(
|
|
6163
|
+
(pattern) => (0, import_minimatch2.minimatch)(relativePath, pattern)
|
|
6164
|
+
) || !wxt.config.zip.excludeSources.some(
|
|
6165
|
+
(pattern) => (0, import_minimatch2.minimatch)(relativePath, pattern)
|
|
6166
|
+
);
|
|
6167
|
+
});
|
|
6168
|
+
const filesToZip = [
|
|
6169
|
+
...files,
|
|
6170
|
+
...(options?.additionalFiles ?? []).map(
|
|
6171
|
+
(file) => import_node_path22.default.relative(directory, file)
|
|
6172
|
+
)
|
|
6173
|
+
];
|
|
6174
|
+
for (const file of filesToZip) {
|
|
6175
|
+
const absolutePath = import_node_path22.default.resolve(directory, file);
|
|
6176
|
+
if (file.endsWith(".json")) {
|
|
6177
|
+
const content = await import_fs_extra16.default.readFile(absolutePath, "utf-8");
|
|
6178
|
+
archive.file(
|
|
6179
|
+
file,
|
|
6180
|
+
await options?.transform?.(file, content) || content
|
|
6181
|
+
);
|
|
6182
|
+
} else {
|
|
6183
|
+
const content = await import_fs_extra16.default.readFile(absolutePath);
|
|
6184
|
+
archive.file(file, content);
|
|
6185
|
+
}
|
|
6186
|
+
}
|
|
6187
|
+
await options?.additionalWork?.(archive);
|
|
6188
|
+
const buffer = await archive.generateAsync({ type: "base64" });
|
|
6189
|
+
await import_fs_extra16.default.writeFile(outputPath, buffer, "base64");
|
|
6190
|
+
}
|
|
6191
|
+
async function downloadPrivatePackages() {
|
|
6192
|
+
const overrides = {};
|
|
6193
|
+
const files = [];
|
|
6194
|
+
if (wxt.config.zip.downloadPackages.length > 0) {
|
|
6195
|
+
const _downloadPackages = new Set(wxt.config.zip.downloadPackages);
|
|
6196
|
+
const allPackages = await wxt.pm.listDependencies({
|
|
6197
|
+
all: true,
|
|
6198
|
+
cwd: wxt.config.root
|
|
6199
|
+
});
|
|
6200
|
+
const downloadPackages = allPackages.filter(
|
|
6201
|
+
(pkg) => _downloadPackages.has(pkg.name)
|
|
6202
|
+
);
|
|
6203
|
+
for (const pkg of downloadPackages) {
|
|
6204
|
+
wxt.logger.info(`Downloading package: ${pkg.name}@${pkg.version}`);
|
|
6205
|
+
const id = `${pkg.name}@${pkg.version}`;
|
|
6206
|
+
const tgzPath = await wxt.pm.downloadDependency(
|
|
6207
|
+
id,
|
|
6208
|
+
wxt.config.zip.downloadedPackagesDir
|
|
6209
|
+
);
|
|
6210
|
+
files.push(tgzPath);
|
|
6211
|
+
overrides[id] = "file://./" + normalizePath(import_node_path22.default.relative(wxt.config.root, tgzPath));
|
|
6212
|
+
}
|
|
6213
|
+
}
|
|
6214
|
+
return { overrides, files };
|
|
6215
|
+
}
|
|
6216
|
+
function addOverridesToPackageJson(content, overrides) {
|
|
6217
|
+
if (Object.keys(overrides).length === 0)
|
|
6218
|
+
return content;
|
|
6219
|
+
const oldPackage = JSON.parse(content);
|
|
6220
|
+
const newPackage = {
|
|
6221
|
+
...oldPackage,
|
|
6222
|
+
[wxt.pm.overridesKey]: {
|
|
6223
|
+
...oldPackage[wxt.pm.overridesKey],
|
|
6224
|
+
...overrides
|
|
6225
|
+
}
|
|
6226
|
+
};
|
|
6227
|
+
return JSON.stringify(newPackage, null, 2);
|
|
6228
|
+
}
|
|
3562
6229
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3563
6230
|
0 && (module.exports = {
|
|
3564
6231
|
build,
|