wxt 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +2083 -95
- package/dist/client.d.ts +24 -0
- package/dist/client.js +33 -1
- package/dist/index.cjs +2071 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +2094 -76
- package/dist/index.js.map +1 -1
- package/dist/virtual-modules/content-script-entrypoint.js +32 -0
- package/dist/virtual-modules/content-script-entrypoint.js.map +1 -1
- package/package.json +6 -1
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,9 @@ 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 __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -27,6 +30,845 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
30
|
));
|
|
28
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
32
|
|
|
33
|
+
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
34
|
+
var require_windows = __commonJS({
|
|
35
|
+
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
module2.exports = isexe;
|
|
38
|
+
isexe.sync = sync;
|
|
39
|
+
var fs16 = require("fs");
|
|
40
|
+
function checkPathExt(path9, options) {
|
|
41
|
+
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
42
|
+
if (!pathext) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
pathext = pathext.split(";");
|
|
46
|
+
if (pathext.indexOf("") !== -1) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
50
|
+
var p = pathext[i].toLowerCase();
|
|
51
|
+
if (p && path9.substr(-p.length).toLowerCase() === p) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
function checkStat(stat, path9, options) {
|
|
58
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return checkPathExt(path9, options);
|
|
62
|
+
}
|
|
63
|
+
function isexe(path9, options, cb) {
|
|
64
|
+
fs16.stat(path9, function(er, stat) {
|
|
65
|
+
cb(er, er ? false : checkStat(stat, path9, options));
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function sync(path9, options) {
|
|
69
|
+
return checkStat(fs16.statSync(path9), path9, options);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
75
|
+
var require_mode = __commonJS({
|
|
76
|
+
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
|
|
77
|
+
"use strict";
|
|
78
|
+
module2.exports = isexe;
|
|
79
|
+
isexe.sync = sync;
|
|
80
|
+
var fs16 = require("fs");
|
|
81
|
+
function isexe(path9, options, cb) {
|
|
82
|
+
fs16.stat(path9, function(er, stat) {
|
|
83
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function sync(path9, options) {
|
|
87
|
+
return checkStat(fs16.statSync(path9), options);
|
|
88
|
+
}
|
|
89
|
+
function checkStat(stat, options) {
|
|
90
|
+
return stat.isFile() && checkMode(stat, options);
|
|
91
|
+
}
|
|
92
|
+
function checkMode(stat, options) {
|
|
93
|
+
var mod = stat.mode;
|
|
94
|
+
var uid = stat.uid;
|
|
95
|
+
var gid = stat.gid;
|
|
96
|
+
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
97
|
+
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
98
|
+
var u = parseInt("100", 8);
|
|
99
|
+
var g = parseInt("010", 8);
|
|
100
|
+
var o = parseInt("001", 8);
|
|
101
|
+
var ug = u | g;
|
|
102
|
+
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
103
|
+
return ret;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
109
|
+
var require_isexe = __commonJS({
|
|
110
|
+
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
|
|
111
|
+
"use strict";
|
|
112
|
+
var fs16 = require("fs");
|
|
113
|
+
var core;
|
|
114
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
115
|
+
core = require_windows();
|
|
116
|
+
} else {
|
|
117
|
+
core = require_mode();
|
|
118
|
+
}
|
|
119
|
+
module2.exports = isexe;
|
|
120
|
+
isexe.sync = sync;
|
|
121
|
+
function isexe(path9, options, cb) {
|
|
122
|
+
if (typeof options === "function") {
|
|
123
|
+
cb = options;
|
|
124
|
+
options = {};
|
|
125
|
+
}
|
|
126
|
+
if (!cb) {
|
|
127
|
+
if (typeof Promise !== "function") {
|
|
128
|
+
throw new TypeError("callback not provided");
|
|
129
|
+
}
|
|
130
|
+
return new Promise(function(resolve13, reject) {
|
|
131
|
+
isexe(path9, options || {}, function(er, is) {
|
|
132
|
+
if (er) {
|
|
133
|
+
reject(er);
|
|
134
|
+
} else {
|
|
135
|
+
resolve13(is);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
core(path9, options || {}, function(er, is) {
|
|
141
|
+
if (er) {
|
|
142
|
+
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
143
|
+
er = null;
|
|
144
|
+
is = false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
cb(er, is);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function sync(path9, options) {
|
|
151
|
+
try {
|
|
152
|
+
return core.sync(path9, options || {});
|
|
153
|
+
} catch (er) {
|
|
154
|
+
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
155
|
+
return false;
|
|
156
|
+
} else {
|
|
157
|
+
throw er;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
165
|
+
var require_which = __commonJS({
|
|
166
|
+
"node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
|
|
167
|
+
"use strict";
|
|
168
|
+
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
169
|
+
var path9 = require("path");
|
|
170
|
+
var COLON = isWindows ? ";" : ":";
|
|
171
|
+
var isexe = require_isexe();
|
|
172
|
+
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
173
|
+
var getPathInfo = (cmd, opt) => {
|
|
174
|
+
const colon = opt.colon || COLON;
|
|
175
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
176
|
+
// windows always checks the cwd first
|
|
177
|
+
...isWindows ? [process.cwd()] : [],
|
|
178
|
+
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
179
|
+
"").split(colon)
|
|
180
|
+
];
|
|
181
|
+
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
182
|
+
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
183
|
+
if (isWindows) {
|
|
184
|
+
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
185
|
+
pathExt.unshift("");
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
pathEnv,
|
|
189
|
+
pathExt,
|
|
190
|
+
pathExtExe
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
var which = (cmd, opt, cb) => {
|
|
194
|
+
if (typeof opt === "function") {
|
|
195
|
+
cb = opt;
|
|
196
|
+
opt = {};
|
|
197
|
+
}
|
|
198
|
+
if (!opt)
|
|
199
|
+
opt = {};
|
|
200
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
201
|
+
const found = [];
|
|
202
|
+
const step = (i) => new Promise((resolve13, reject) => {
|
|
203
|
+
if (i === pathEnv.length)
|
|
204
|
+
return opt.all && found.length ? resolve13(found) : reject(getNotFoundError(cmd));
|
|
205
|
+
const ppRaw = pathEnv[i];
|
|
206
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
207
|
+
const pCmd = path9.join(pathPart, cmd);
|
|
208
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
209
|
+
resolve13(subStep(p, i, 0));
|
|
210
|
+
});
|
|
211
|
+
const subStep = (p, i, ii) => new Promise((resolve13, reject) => {
|
|
212
|
+
if (ii === pathExt.length)
|
|
213
|
+
return resolve13(step(i + 1));
|
|
214
|
+
const ext = pathExt[ii];
|
|
215
|
+
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
216
|
+
if (!er && is) {
|
|
217
|
+
if (opt.all)
|
|
218
|
+
found.push(p + ext);
|
|
219
|
+
else
|
|
220
|
+
return resolve13(p + ext);
|
|
221
|
+
}
|
|
222
|
+
return resolve13(subStep(p, i, ii + 1));
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
226
|
+
};
|
|
227
|
+
var whichSync = (cmd, opt) => {
|
|
228
|
+
opt = opt || {};
|
|
229
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
230
|
+
const found = [];
|
|
231
|
+
for (let i = 0; i < pathEnv.length; i++) {
|
|
232
|
+
const ppRaw = pathEnv[i];
|
|
233
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
234
|
+
const pCmd = path9.join(pathPart, cmd);
|
|
235
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
236
|
+
for (let j = 0; j < pathExt.length; j++) {
|
|
237
|
+
const cur = p + pathExt[j];
|
|
238
|
+
try {
|
|
239
|
+
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
240
|
+
if (is) {
|
|
241
|
+
if (opt.all)
|
|
242
|
+
found.push(cur);
|
|
243
|
+
else
|
|
244
|
+
return cur;
|
|
245
|
+
}
|
|
246
|
+
} catch (ex) {
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (opt.all && found.length)
|
|
251
|
+
return found;
|
|
252
|
+
if (opt.nothrow)
|
|
253
|
+
return null;
|
|
254
|
+
throw getNotFoundError(cmd);
|
|
255
|
+
};
|
|
256
|
+
module2.exports = which;
|
|
257
|
+
which.sync = whichSync;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
262
|
+
var require_path_key = __commonJS({
|
|
263
|
+
"node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module2) {
|
|
264
|
+
"use strict";
|
|
265
|
+
var pathKey2 = (options = {}) => {
|
|
266
|
+
const environment = options.env || process.env;
|
|
267
|
+
const platform = options.platform || process.platform;
|
|
268
|
+
if (platform !== "win32") {
|
|
269
|
+
return "PATH";
|
|
270
|
+
}
|
|
271
|
+
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
272
|
+
};
|
|
273
|
+
module2.exports = pathKey2;
|
|
274
|
+
module2.exports.default = pathKey2;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
279
|
+
var require_resolveCommand = __commonJS({
|
|
280
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
|
|
281
|
+
"use strict";
|
|
282
|
+
var path9 = require("path");
|
|
283
|
+
var which = require_which();
|
|
284
|
+
var getPathKey = require_path_key();
|
|
285
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
286
|
+
const env = parsed.options.env || process.env;
|
|
287
|
+
const cwd = process.cwd();
|
|
288
|
+
const hasCustomCwd = parsed.options.cwd != null;
|
|
289
|
+
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
290
|
+
if (shouldSwitchCwd) {
|
|
291
|
+
try {
|
|
292
|
+
process.chdir(parsed.options.cwd);
|
|
293
|
+
} catch (err) {
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
let resolved;
|
|
297
|
+
try {
|
|
298
|
+
resolved = which.sync(parsed.command, {
|
|
299
|
+
path: env[getPathKey({ env })],
|
|
300
|
+
pathExt: withoutPathExt ? path9.delimiter : void 0
|
|
301
|
+
});
|
|
302
|
+
} catch (e) {
|
|
303
|
+
} finally {
|
|
304
|
+
if (shouldSwitchCwd) {
|
|
305
|
+
process.chdir(cwd);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (resolved) {
|
|
309
|
+
resolved = path9.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
310
|
+
}
|
|
311
|
+
return resolved;
|
|
312
|
+
}
|
|
313
|
+
function resolveCommand(parsed) {
|
|
314
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
315
|
+
}
|
|
316
|
+
module2.exports = resolveCommand;
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js
|
|
321
|
+
var require_escape = __commonJS({
|
|
322
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
|
|
323
|
+
"use strict";
|
|
324
|
+
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
325
|
+
function escapeCommand(arg) {
|
|
326
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
327
|
+
return arg;
|
|
328
|
+
}
|
|
329
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
330
|
+
arg = `${arg}`;
|
|
331
|
+
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
|
|
332
|
+
arg = arg.replace(/(\\*)$/, "$1$1");
|
|
333
|
+
arg = `"${arg}"`;
|
|
334
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
335
|
+
if (doubleEscapeMetaChars) {
|
|
336
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
337
|
+
}
|
|
338
|
+
return arg;
|
|
339
|
+
}
|
|
340
|
+
module2.exports.command = escapeCommand;
|
|
341
|
+
module2.exports.argument = escapeArgument;
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
346
|
+
var require_shebang_regex = __commonJS({
|
|
347
|
+
"node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module2) {
|
|
348
|
+
"use strict";
|
|
349
|
+
module2.exports = /^#!(.*)/;
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
// node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
354
|
+
var require_shebang_command = __commonJS({
|
|
355
|
+
"node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module2) {
|
|
356
|
+
"use strict";
|
|
357
|
+
var shebangRegex = require_shebang_regex();
|
|
358
|
+
module2.exports = (string = "") => {
|
|
359
|
+
const match = string.match(shebangRegex);
|
|
360
|
+
if (!match) {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
const [path9, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
364
|
+
const binary = path9.split("/").pop();
|
|
365
|
+
if (binary === "env") {
|
|
366
|
+
return argument;
|
|
367
|
+
}
|
|
368
|
+
return argument ? `${binary} ${argument}` : binary;
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js
|
|
374
|
+
var require_readShebang = __commonJS({
|
|
375
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
|
|
376
|
+
"use strict";
|
|
377
|
+
var fs16 = require("fs");
|
|
378
|
+
var shebangCommand = require_shebang_command();
|
|
379
|
+
function readShebang(command) {
|
|
380
|
+
const size = 150;
|
|
381
|
+
const buffer = Buffer.alloc(size);
|
|
382
|
+
let fd;
|
|
383
|
+
try {
|
|
384
|
+
fd = fs16.openSync(command, "r");
|
|
385
|
+
fs16.readSync(fd, buffer, 0, size, 0);
|
|
386
|
+
fs16.closeSync(fd);
|
|
387
|
+
} catch (e) {
|
|
388
|
+
}
|
|
389
|
+
return shebangCommand(buffer.toString());
|
|
390
|
+
}
|
|
391
|
+
module2.exports = readShebang;
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js
|
|
396
|
+
var require_parse = __commonJS({
|
|
397
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
|
|
398
|
+
"use strict";
|
|
399
|
+
var path9 = require("path");
|
|
400
|
+
var resolveCommand = require_resolveCommand();
|
|
401
|
+
var escape = require_escape();
|
|
402
|
+
var readShebang = require_readShebang();
|
|
403
|
+
var isWin = process.platform === "win32";
|
|
404
|
+
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
405
|
+
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
406
|
+
function detectShebang(parsed) {
|
|
407
|
+
parsed.file = resolveCommand(parsed);
|
|
408
|
+
const shebang = parsed.file && readShebang(parsed.file);
|
|
409
|
+
if (shebang) {
|
|
410
|
+
parsed.args.unshift(parsed.file);
|
|
411
|
+
parsed.command = shebang;
|
|
412
|
+
return resolveCommand(parsed);
|
|
413
|
+
}
|
|
414
|
+
return parsed.file;
|
|
415
|
+
}
|
|
416
|
+
function parseNonShell(parsed) {
|
|
417
|
+
if (!isWin) {
|
|
418
|
+
return parsed;
|
|
419
|
+
}
|
|
420
|
+
const commandFile = detectShebang(parsed);
|
|
421
|
+
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
422
|
+
if (parsed.options.forceShell || needsShell) {
|
|
423
|
+
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
424
|
+
parsed.command = path9.normalize(parsed.command);
|
|
425
|
+
parsed.command = escape.command(parsed.command);
|
|
426
|
+
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
427
|
+
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
428
|
+
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
429
|
+
parsed.command = process.env.comspec || "cmd.exe";
|
|
430
|
+
parsed.options.windowsVerbatimArguments = true;
|
|
431
|
+
}
|
|
432
|
+
return parsed;
|
|
433
|
+
}
|
|
434
|
+
function parse(command, args, options) {
|
|
435
|
+
if (args && !Array.isArray(args)) {
|
|
436
|
+
options = args;
|
|
437
|
+
args = null;
|
|
438
|
+
}
|
|
439
|
+
args = args ? args.slice(0) : [];
|
|
440
|
+
options = Object.assign({}, options);
|
|
441
|
+
const parsed = {
|
|
442
|
+
command,
|
|
443
|
+
args,
|
|
444
|
+
options,
|
|
445
|
+
file: void 0,
|
|
446
|
+
original: {
|
|
447
|
+
command,
|
|
448
|
+
args
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
return options.shell ? parsed : parseNonShell(parsed);
|
|
452
|
+
}
|
|
453
|
+
module2.exports = parse;
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js
|
|
458
|
+
var require_enoent = __commonJS({
|
|
459
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
|
|
460
|
+
"use strict";
|
|
461
|
+
var isWin = process.platform === "win32";
|
|
462
|
+
function notFoundError(original, syscall) {
|
|
463
|
+
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
464
|
+
code: "ENOENT",
|
|
465
|
+
errno: "ENOENT",
|
|
466
|
+
syscall: `${syscall} ${original.command}`,
|
|
467
|
+
path: original.command,
|
|
468
|
+
spawnargs: original.args
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
function hookChildProcess(cp, parsed) {
|
|
472
|
+
if (!isWin) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
const originalEmit = cp.emit;
|
|
476
|
+
cp.emit = function(name, arg1) {
|
|
477
|
+
if (name === "exit") {
|
|
478
|
+
const err = verifyENOENT(arg1, parsed, "spawn");
|
|
479
|
+
if (err) {
|
|
480
|
+
return originalEmit.call(cp, "error", err);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return originalEmit.apply(cp, arguments);
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function verifyENOENT(status, parsed) {
|
|
487
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
488
|
+
return notFoundError(parsed.original, "spawn");
|
|
489
|
+
}
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
function verifyENOENTSync(status, parsed) {
|
|
493
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
494
|
+
return notFoundError(parsed.original, "spawnSync");
|
|
495
|
+
}
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
module2.exports = {
|
|
499
|
+
hookChildProcess,
|
|
500
|
+
verifyENOENT,
|
|
501
|
+
verifyENOENTSync,
|
|
502
|
+
notFoundError
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
// node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js
|
|
508
|
+
var require_cross_spawn = __commonJS({
|
|
509
|
+
"node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js"(exports, module2) {
|
|
510
|
+
"use strict";
|
|
511
|
+
var cp = require("child_process");
|
|
512
|
+
var parse = require_parse();
|
|
513
|
+
var enoent = require_enoent();
|
|
514
|
+
function spawn(command, args, options) {
|
|
515
|
+
const parsed = parse(command, args, options);
|
|
516
|
+
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
517
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
518
|
+
return spawned;
|
|
519
|
+
}
|
|
520
|
+
function spawnSync(command, args, options) {
|
|
521
|
+
const parsed = parse(command, args, options);
|
|
522
|
+
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
523
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
524
|
+
return result;
|
|
525
|
+
}
|
|
526
|
+
module2.exports = spawn;
|
|
527
|
+
module2.exports.spawn = spawn;
|
|
528
|
+
module2.exports.sync = spawnSync;
|
|
529
|
+
module2.exports._parse = parse;
|
|
530
|
+
module2.exports._enoent = enoent;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
// node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
|
|
535
|
+
var require_signals = __commonJS({
|
|
536
|
+
"node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports, module2) {
|
|
537
|
+
"use strict";
|
|
538
|
+
module2.exports = [
|
|
539
|
+
"SIGABRT",
|
|
540
|
+
"SIGALRM",
|
|
541
|
+
"SIGHUP",
|
|
542
|
+
"SIGINT",
|
|
543
|
+
"SIGTERM"
|
|
544
|
+
];
|
|
545
|
+
if (process.platform !== "win32") {
|
|
546
|
+
module2.exports.push(
|
|
547
|
+
"SIGVTALRM",
|
|
548
|
+
"SIGXCPU",
|
|
549
|
+
"SIGXFSZ",
|
|
550
|
+
"SIGUSR2",
|
|
551
|
+
"SIGTRAP",
|
|
552
|
+
"SIGSYS",
|
|
553
|
+
"SIGQUIT",
|
|
554
|
+
"SIGIOT"
|
|
555
|
+
// should detect profiler and enable/disable accordingly.
|
|
556
|
+
// see #21
|
|
557
|
+
// 'SIGPROF'
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
if (process.platform === "linux") {
|
|
561
|
+
module2.exports.push(
|
|
562
|
+
"SIGIO",
|
|
563
|
+
"SIGPOLL",
|
|
564
|
+
"SIGPWR",
|
|
565
|
+
"SIGSTKFLT",
|
|
566
|
+
"SIGUNUSED"
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
// node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
573
|
+
var require_signal_exit = __commonJS({
|
|
574
|
+
"node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module2) {
|
|
575
|
+
"use strict";
|
|
576
|
+
var process6 = global.process;
|
|
577
|
+
var processOk = function(process7) {
|
|
578
|
+
return 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";
|
|
579
|
+
};
|
|
580
|
+
if (!processOk(process6)) {
|
|
581
|
+
module2.exports = function() {
|
|
582
|
+
return function() {
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
} else {
|
|
586
|
+
assert = require("assert");
|
|
587
|
+
signals = require_signals();
|
|
588
|
+
isWin = /^win/i.test(process6.platform);
|
|
589
|
+
EE = require("events");
|
|
590
|
+
if (typeof EE !== "function") {
|
|
591
|
+
EE = EE.EventEmitter;
|
|
592
|
+
}
|
|
593
|
+
if (process6.__signal_exit_emitter__) {
|
|
594
|
+
emitter = process6.__signal_exit_emitter__;
|
|
595
|
+
} else {
|
|
596
|
+
emitter = process6.__signal_exit_emitter__ = new EE();
|
|
597
|
+
emitter.count = 0;
|
|
598
|
+
emitter.emitted = {};
|
|
599
|
+
}
|
|
600
|
+
if (!emitter.infinite) {
|
|
601
|
+
emitter.setMaxListeners(Infinity);
|
|
602
|
+
emitter.infinite = true;
|
|
603
|
+
}
|
|
604
|
+
module2.exports = function(cb, opts) {
|
|
605
|
+
if (!processOk(global.process)) {
|
|
606
|
+
return function() {
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
610
|
+
if (loaded === false) {
|
|
611
|
+
load();
|
|
612
|
+
}
|
|
613
|
+
var ev = "exit";
|
|
614
|
+
if (opts && opts.alwaysLast) {
|
|
615
|
+
ev = "afterexit";
|
|
616
|
+
}
|
|
617
|
+
var remove = function() {
|
|
618
|
+
emitter.removeListener(ev, cb);
|
|
619
|
+
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
|
|
620
|
+
unload();
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
emitter.on(ev, cb);
|
|
624
|
+
return remove;
|
|
625
|
+
};
|
|
626
|
+
unload = function unload2() {
|
|
627
|
+
if (!loaded || !processOk(global.process)) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
loaded = false;
|
|
631
|
+
signals.forEach(function(sig) {
|
|
632
|
+
try {
|
|
633
|
+
process6.removeListener(sig, sigListeners[sig]);
|
|
634
|
+
} catch (er) {
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
process6.emit = originalProcessEmit;
|
|
638
|
+
process6.reallyExit = originalProcessReallyExit;
|
|
639
|
+
emitter.count -= 1;
|
|
640
|
+
};
|
|
641
|
+
module2.exports.unload = unload;
|
|
642
|
+
emit = function emit2(event, code, signal) {
|
|
643
|
+
if (emitter.emitted[event]) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
emitter.emitted[event] = true;
|
|
647
|
+
emitter.emit(event, code, signal);
|
|
648
|
+
};
|
|
649
|
+
sigListeners = {};
|
|
650
|
+
signals.forEach(function(sig) {
|
|
651
|
+
sigListeners[sig] = function listener() {
|
|
652
|
+
if (!processOk(global.process)) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
var listeners = process6.listeners(sig);
|
|
656
|
+
if (listeners.length === emitter.count) {
|
|
657
|
+
unload();
|
|
658
|
+
emit("exit", null, sig);
|
|
659
|
+
emit("afterexit", null, sig);
|
|
660
|
+
if (isWin && sig === "SIGHUP") {
|
|
661
|
+
sig = "SIGINT";
|
|
662
|
+
}
|
|
663
|
+
process6.kill(process6.pid, sig);
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
});
|
|
667
|
+
module2.exports.signals = function() {
|
|
668
|
+
return signals;
|
|
669
|
+
};
|
|
670
|
+
loaded = false;
|
|
671
|
+
load = function load2() {
|
|
672
|
+
if (loaded || !processOk(global.process)) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
loaded = true;
|
|
676
|
+
emitter.count += 1;
|
|
677
|
+
signals = signals.filter(function(sig) {
|
|
678
|
+
try {
|
|
679
|
+
process6.on(sig, sigListeners[sig]);
|
|
680
|
+
return true;
|
|
681
|
+
} catch (er) {
|
|
682
|
+
return false;
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
process6.emit = processEmit;
|
|
686
|
+
process6.reallyExit = processReallyExit;
|
|
687
|
+
};
|
|
688
|
+
module2.exports.load = load;
|
|
689
|
+
originalProcessReallyExit = process6.reallyExit;
|
|
690
|
+
processReallyExit = function processReallyExit2(code) {
|
|
691
|
+
if (!processOk(global.process)) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
process6.exitCode = code || /* istanbul ignore next */
|
|
695
|
+
0;
|
|
696
|
+
emit("exit", process6.exitCode, null);
|
|
697
|
+
emit("afterexit", process6.exitCode, null);
|
|
698
|
+
originalProcessReallyExit.call(process6, process6.exitCode);
|
|
699
|
+
};
|
|
700
|
+
originalProcessEmit = process6.emit;
|
|
701
|
+
processEmit = function processEmit2(ev, arg) {
|
|
702
|
+
if (ev === "exit" && processOk(global.process)) {
|
|
703
|
+
if (arg !== void 0) {
|
|
704
|
+
process6.exitCode = arg;
|
|
705
|
+
}
|
|
706
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
707
|
+
emit("exit", process6.exitCode, null);
|
|
708
|
+
emit("afterexit", process6.exitCode, null);
|
|
709
|
+
return ret;
|
|
710
|
+
} else {
|
|
711
|
+
return originalProcessEmit.apply(this, arguments);
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
var assert;
|
|
716
|
+
var signals;
|
|
717
|
+
var isWin;
|
|
718
|
+
var EE;
|
|
719
|
+
var emitter;
|
|
720
|
+
var unload;
|
|
721
|
+
var emit;
|
|
722
|
+
var sigListeners;
|
|
723
|
+
var loaded;
|
|
724
|
+
var load;
|
|
725
|
+
var originalProcessReallyExit;
|
|
726
|
+
var processReallyExit;
|
|
727
|
+
var originalProcessEmit;
|
|
728
|
+
var processEmit;
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
// node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js
|
|
733
|
+
var require_buffer_stream = __commonJS({
|
|
734
|
+
"node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js"(exports, module2) {
|
|
735
|
+
"use strict";
|
|
736
|
+
var { PassThrough: PassThroughStream } = require("stream");
|
|
737
|
+
module2.exports = (options) => {
|
|
738
|
+
options = { ...options };
|
|
739
|
+
const { array } = options;
|
|
740
|
+
let { encoding } = options;
|
|
741
|
+
const isBuffer = encoding === "buffer";
|
|
742
|
+
let objectMode = false;
|
|
743
|
+
if (array) {
|
|
744
|
+
objectMode = !(encoding || isBuffer);
|
|
745
|
+
} else {
|
|
746
|
+
encoding = encoding || "utf8";
|
|
747
|
+
}
|
|
748
|
+
if (isBuffer) {
|
|
749
|
+
encoding = null;
|
|
750
|
+
}
|
|
751
|
+
const stream = new PassThroughStream({ objectMode });
|
|
752
|
+
if (encoding) {
|
|
753
|
+
stream.setEncoding(encoding);
|
|
754
|
+
}
|
|
755
|
+
let length = 0;
|
|
756
|
+
const chunks = [];
|
|
757
|
+
stream.on("data", (chunk) => {
|
|
758
|
+
chunks.push(chunk);
|
|
759
|
+
if (objectMode) {
|
|
760
|
+
length = chunks.length;
|
|
761
|
+
} else {
|
|
762
|
+
length += chunk.length;
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
stream.getBufferedValue = () => {
|
|
766
|
+
if (array) {
|
|
767
|
+
return chunks;
|
|
768
|
+
}
|
|
769
|
+
return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
|
|
770
|
+
};
|
|
771
|
+
stream.getBufferedLength = () => length;
|
|
772
|
+
return stream;
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
// node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js
|
|
778
|
+
var require_get_stream = __commonJS({
|
|
779
|
+
"node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js"(exports, module2) {
|
|
780
|
+
"use strict";
|
|
781
|
+
var { constants: BufferConstants } = require("buffer");
|
|
782
|
+
var stream = require("stream");
|
|
783
|
+
var { promisify } = require("util");
|
|
784
|
+
var bufferStream = require_buffer_stream();
|
|
785
|
+
var streamPipelinePromisified = promisify(stream.pipeline);
|
|
786
|
+
var MaxBufferError = class extends Error {
|
|
787
|
+
constructor() {
|
|
788
|
+
super("maxBuffer exceeded");
|
|
789
|
+
this.name = "MaxBufferError";
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
async function getStream2(inputStream, options) {
|
|
793
|
+
if (!inputStream) {
|
|
794
|
+
throw new Error("Expected a stream");
|
|
795
|
+
}
|
|
796
|
+
options = {
|
|
797
|
+
maxBuffer: Infinity,
|
|
798
|
+
...options
|
|
799
|
+
};
|
|
800
|
+
const { maxBuffer } = options;
|
|
801
|
+
const stream2 = bufferStream(options);
|
|
802
|
+
await new Promise((resolve13, reject) => {
|
|
803
|
+
const rejectPromise = (error) => {
|
|
804
|
+
if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
805
|
+
error.bufferedData = stream2.getBufferedValue();
|
|
806
|
+
}
|
|
807
|
+
reject(error);
|
|
808
|
+
};
|
|
809
|
+
(async () => {
|
|
810
|
+
try {
|
|
811
|
+
await streamPipelinePromisified(inputStream, stream2);
|
|
812
|
+
resolve13();
|
|
813
|
+
} catch (error) {
|
|
814
|
+
rejectPromise(error);
|
|
815
|
+
}
|
|
816
|
+
})();
|
|
817
|
+
stream2.on("data", () => {
|
|
818
|
+
if (stream2.getBufferedLength() > maxBuffer) {
|
|
819
|
+
rejectPromise(new MaxBufferError());
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
return stream2.getBufferedValue();
|
|
824
|
+
}
|
|
825
|
+
module2.exports = getStream2;
|
|
826
|
+
module2.exports.buffer = (stream2, options) => getStream2(stream2, { ...options, encoding: "buffer" });
|
|
827
|
+
module2.exports.array = (stream2, options) => getStream2(stream2, { ...options, array: true });
|
|
828
|
+
module2.exports.MaxBufferError = MaxBufferError;
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
// node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js
|
|
833
|
+
var require_merge_stream = __commonJS({
|
|
834
|
+
"node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module2) {
|
|
835
|
+
"use strict";
|
|
836
|
+
var { PassThrough } = require("stream");
|
|
837
|
+
module2.exports = function() {
|
|
838
|
+
var sources = [];
|
|
839
|
+
var output = new PassThrough({ objectMode: true });
|
|
840
|
+
output.setMaxListeners(0);
|
|
841
|
+
output.add = add;
|
|
842
|
+
output.isEmpty = isEmpty;
|
|
843
|
+
output.on("unpipe", remove);
|
|
844
|
+
Array.prototype.slice.call(arguments).forEach(add);
|
|
845
|
+
return output;
|
|
846
|
+
function add(source) {
|
|
847
|
+
if (Array.isArray(source)) {
|
|
848
|
+
source.forEach(add);
|
|
849
|
+
return this;
|
|
850
|
+
}
|
|
851
|
+
sources.push(source);
|
|
852
|
+
source.once("end", remove.bind(null, source));
|
|
853
|
+
source.once("error", output.emit.bind(output, "error"));
|
|
854
|
+
source.pipe(output, { end: false });
|
|
855
|
+
return this;
|
|
856
|
+
}
|
|
857
|
+
function isEmpty() {
|
|
858
|
+
return sources.length == 0;
|
|
859
|
+
}
|
|
860
|
+
function remove(source) {
|
|
861
|
+
sources = sources.filter(function(it) {
|
|
862
|
+
return it !== source;
|
|
863
|
+
});
|
|
864
|
+
if (!sources.length && output.readable) {
|
|
865
|
+
output.end();
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
|
|
30
872
|
// src/index.ts
|
|
31
873
|
var src_exports = {};
|
|
32
874
|
__export(src_exports, {
|
|
@@ -62,14 +904,14 @@ function createFsCache(wxtDir) {
|
|
|
62
904
|
const getPath = (key) => (0, import_path.resolve)(wxtDir, "cache", encodeURIComponent(key));
|
|
63
905
|
return {
|
|
64
906
|
async set(key, value) {
|
|
65
|
-
const
|
|
66
|
-
await (0, import_fs_extra2.ensureDir)((0, import_path.dirname)(
|
|
67
|
-
await writeFileIfDifferent(
|
|
907
|
+
const path9 = getPath(key);
|
|
908
|
+
await (0, import_fs_extra2.ensureDir)((0, import_path.dirname)(path9));
|
|
909
|
+
await writeFileIfDifferent(path9, value);
|
|
68
910
|
},
|
|
69
911
|
async get(key) {
|
|
70
|
-
const
|
|
912
|
+
const path9 = getPath(key);
|
|
71
913
|
try {
|
|
72
|
-
return await import_fs_extra2.default.readFile(
|
|
914
|
+
return await import_fs_extra2.default.readFile(path9, "utf-8");
|
|
73
915
|
} catch {
|
|
74
916
|
return void 0;
|
|
75
917
|
}
|
|
@@ -86,11 +928,11 @@ var import_node_path2 = __toESM(require("path"), 1);
|
|
|
86
928
|
// src/core/utils/paths.ts
|
|
87
929
|
var import_node_path = __toESM(require("path"), 1);
|
|
88
930
|
var vite = __toESM(require("vite"), 1);
|
|
89
|
-
function normalizePath2(
|
|
90
|
-
return vite.normalizePath(
|
|
931
|
+
function normalizePath2(path9) {
|
|
932
|
+
return vite.normalizePath(path9);
|
|
91
933
|
}
|
|
92
|
-
function unnormalizePath(
|
|
93
|
-
return import_node_path.default.normalize(
|
|
934
|
+
function unnormalizePath(path9) {
|
|
935
|
+
return import_node_path.default.normalize(path9);
|
|
94
936
|
}
|
|
95
937
|
var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
|
|
96
938
|
var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
|
|
@@ -135,9 +977,9 @@ function devHtmlPrerender(config) {
|
|
|
135
977
|
return;
|
|
136
978
|
const originalUrl = `${server.origin}${id}`;
|
|
137
979
|
const name = getEntrypointName(config.entrypointsDir, id);
|
|
138
|
-
const
|
|
980
|
+
const url2 = `${server.origin}/${name}.html`;
|
|
139
981
|
const serverHtml = await server.transformIndexHtml(
|
|
140
|
-
|
|
982
|
+
url2,
|
|
141
983
|
html,
|
|
142
984
|
originalUrl
|
|
143
985
|
);
|
|
@@ -221,24 +1063,24 @@ async function isOnline() {
|
|
|
221
1063
|
const offline = await isOffline();
|
|
222
1064
|
return !offline;
|
|
223
1065
|
}
|
|
224
|
-
async function fetchCached(
|
|
1066
|
+
async function fetchCached(url2, config) {
|
|
225
1067
|
let content = "";
|
|
226
1068
|
if (await isOnline()) {
|
|
227
|
-
const res = await fetch(
|
|
1069
|
+
const res = await fetch(url2);
|
|
228
1070
|
if (res.status < 300) {
|
|
229
1071
|
content = await res.text();
|
|
230
|
-
await config.fsCache.set(
|
|
1072
|
+
await config.fsCache.set(url2, content);
|
|
231
1073
|
} else {
|
|
232
1074
|
config.logger.debug(
|
|
233
|
-
`Failed to download "${
|
|
1075
|
+
`Failed to download "${url2}", falling back to cache...`
|
|
234
1076
|
);
|
|
235
1077
|
}
|
|
236
1078
|
}
|
|
237
1079
|
if (!content)
|
|
238
|
-
content = await config.fsCache.get(
|
|
1080
|
+
content = await config.fsCache.get(url2) ?? "";
|
|
239
1081
|
if (!content)
|
|
240
1082
|
throw Error(
|
|
241
|
-
`Offline and "${
|
|
1083
|
+
`Offline and "${url2}" has not been cached. Try again when online.`
|
|
242
1084
|
);
|
|
243
1085
|
return content;
|
|
244
1086
|
}
|
|
@@ -254,8 +1096,8 @@ function download(config) {
|
|
|
254
1096
|
async load(id) {
|
|
255
1097
|
if (!id.startsWith("\0url:"))
|
|
256
1098
|
return;
|
|
257
|
-
const
|
|
258
|
-
return await fetchCached(
|
|
1099
|
+
const url2 = id.replace("\0url:", "");
|
|
1100
|
+
return await fetchCached(url2, config);
|
|
259
1101
|
}
|
|
260
1102
|
};
|
|
261
1103
|
}
|
|
@@ -689,8 +1531,8 @@ async function resolveInternalViteConfig(env, mergedConfig, finalConfig) {
|
|
|
689
1531
|
internalVite.plugins.push(bundleAnalysis());
|
|
690
1532
|
}
|
|
691
1533
|
internalVite.define ??= {};
|
|
692
|
-
for (const
|
|
693
|
-
internalVite.define[
|
|
1534
|
+
for (const global2 of getGlobals(finalConfig)) {
|
|
1535
|
+
internalVite.define[global2.name] = JSON.stringify(global2.value);
|
|
694
1536
|
}
|
|
695
1537
|
return internalVite;
|
|
696
1538
|
}
|
|
@@ -793,7 +1635,7 @@ function findEffectedSteps(changedFile, currentOutput) {
|
|
|
793
1635
|
// src/index.ts
|
|
794
1636
|
var import_async_mutex = require("async-mutex");
|
|
795
1637
|
var import_consola3 = require("consola");
|
|
796
|
-
var
|
|
1638
|
+
var import_node_path13 = require("path");
|
|
797
1639
|
|
|
798
1640
|
// src/core/build/buildEntrypoints.ts
|
|
799
1641
|
var vite3 = __toESM(require("vite"), 1);
|
|
@@ -881,8 +1723,8 @@ async function buildSingleEntrypoint(entrypoint, config) {
|
|
|
881
1723
|
"process.env.NODE_ENV": JSON.stringify(config.mode)
|
|
882
1724
|
}
|
|
883
1725
|
};
|
|
884
|
-
for (const
|
|
885
|
-
libMode.define[
|
|
1726
|
+
for (const global2 of getEntrypointGlobals(config, entrypoint.name)) {
|
|
1727
|
+
libMode.define[global2.name] = JSON.stringify(global2.value);
|
|
886
1728
|
}
|
|
887
1729
|
const entryConfig = vite3.mergeConfig(
|
|
888
1730
|
libMode,
|
|
@@ -915,8 +1757,8 @@ async function buildMultipleEntrypoints(entrypoints, config) {
|
|
|
915
1757
|
},
|
|
916
1758
|
define: {}
|
|
917
1759
|
};
|
|
918
|
-
for (const
|
|
919
|
-
multiPage.define[
|
|
1760
|
+
for (const global2 of getEntrypointGlobals(config, "html")) {
|
|
1761
|
+
multiPage.define[global2.name] = JSON.stringify(global2.value);
|
|
920
1762
|
}
|
|
921
1763
|
const entryConfig = vite3.mergeConfig(
|
|
922
1764
|
multiPage,
|
|
@@ -985,16 +1827,16 @@ ${noImports}`;
|
|
|
985
1827
|
}
|
|
986
1828
|
|
|
987
1829
|
// src/core/utils/importEntrypointFile.ts
|
|
988
|
-
async function importEntrypointFile(
|
|
989
|
-
config.logger.debug("Loading file metadata:",
|
|
990
|
-
const normalPath = normalizePath2(
|
|
1830
|
+
async function importEntrypointFile(path9, config) {
|
|
1831
|
+
config.logger.debug("Loading file metadata:", path9);
|
|
1832
|
+
const normalPath = normalizePath2(path9);
|
|
991
1833
|
const unimport2 = (0, import_unimport2.createUnimport)({
|
|
992
1834
|
...getUnimportOptions(config),
|
|
993
1835
|
// Only allow specific imports, not all from the project
|
|
994
1836
|
dirs: []
|
|
995
1837
|
});
|
|
996
1838
|
await unimport2.init();
|
|
997
|
-
const text = await import_fs_extra8.default.readFile(
|
|
1839
|
+
const text = await import_fs_extra8.default.readFile(path9, "utf-8");
|
|
998
1840
|
const textNoImports = removeProjectImportStatements(text);
|
|
999
1841
|
const { code } = await unimport2.injectImports(textNoImports);
|
|
1000
1842
|
config.logger.debug(
|
|
@@ -1018,7 +1860,7 @@ async function importEntrypointFile(path7, config) {
|
|
|
1018
1860
|
}
|
|
1019
1861
|
});
|
|
1020
1862
|
try {
|
|
1021
|
-
return await jiti(
|
|
1863
|
+
return await jiti(path9);
|
|
1022
1864
|
} catch (err) {
|
|
1023
1865
|
config.logger.error(err);
|
|
1024
1866
|
throw err;
|
|
@@ -1038,7 +1880,7 @@ async function findEntrypoints(config) {
|
|
|
1038
1880
|
let hasBackground = false;
|
|
1039
1881
|
await Promise.all(
|
|
1040
1882
|
relativePaths.map(async (relativePath) => {
|
|
1041
|
-
const
|
|
1883
|
+
const path9 = (0, import_path8.resolve)(config.entrypointsDir, relativePath);
|
|
1042
1884
|
const matchingGlob = pathGlobs.find(
|
|
1043
1885
|
(glob5) => (0, import_minimatch.minimatch)(relativePath, glob5)
|
|
1044
1886
|
);
|
|
@@ -1058,30 +1900,30 @@ ${JSON.stringify(
|
|
|
1058
1900
|
let entrypoint;
|
|
1059
1901
|
switch (type) {
|
|
1060
1902
|
case "popup":
|
|
1061
|
-
entrypoint = await getPopupEntrypoint(config,
|
|
1903
|
+
entrypoint = await getPopupEntrypoint(config, path9);
|
|
1062
1904
|
break;
|
|
1063
1905
|
case "options":
|
|
1064
|
-
entrypoint = await getOptionsEntrypoint(config,
|
|
1906
|
+
entrypoint = await getOptionsEntrypoint(config, path9);
|
|
1065
1907
|
break;
|
|
1066
1908
|
case "background":
|
|
1067
|
-
entrypoint = await getBackgroundEntrypoint(config,
|
|
1909
|
+
entrypoint = await getBackgroundEntrypoint(config, path9);
|
|
1068
1910
|
hasBackground = true;
|
|
1069
1911
|
break;
|
|
1070
1912
|
case "content-script":
|
|
1071
1913
|
entrypoint = await getContentScriptEntrypoint(
|
|
1072
1914
|
config,
|
|
1073
|
-
getEntrypointName(config.entrypointsDir,
|
|
1074
|
-
|
|
1915
|
+
getEntrypointName(config.entrypointsDir, path9),
|
|
1916
|
+
path9
|
|
1075
1917
|
);
|
|
1076
1918
|
break;
|
|
1077
1919
|
case "unlisted-page":
|
|
1078
|
-
entrypoint = await getUnlistedPageEntrypoint(config,
|
|
1920
|
+
entrypoint = await getUnlistedPageEntrypoint(config, path9);
|
|
1079
1921
|
break;
|
|
1080
1922
|
case "content-script-style":
|
|
1081
1923
|
entrypoint = {
|
|
1082
1924
|
type,
|
|
1083
|
-
name: getEntrypointName(config.entrypointsDir,
|
|
1084
|
-
inputPath:
|
|
1925
|
+
name: getEntrypointName(config.entrypointsDir, path9),
|
|
1926
|
+
inputPath: path9,
|
|
1085
1927
|
outputDir: (0, import_path8.resolve)(config.outDir, CONTENT_SCRIPT_OUT_DIR),
|
|
1086
1928
|
options: {
|
|
1087
1929
|
include: void 0,
|
|
@@ -1092,8 +1934,8 @@ ${JSON.stringify(
|
|
|
1092
1934
|
default:
|
|
1093
1935
|
entrypoint = {
|
|
1094
1936
|
type,
|
|
1095
|
-
name: getEntrypointName(config.entrypointsDir,
|
|
1096
|
-
inputPath:
|
|
1937
|
+
name: getEntrypointName(config.entrypointsDir, path9),
|
|
1938
|
+
inputPath: path9,
|
|
1097
1939
|
outputDir: config.outDir,
|
|
1098
1940
|
options: {
|
|
1099
1941
|
include: void 0,
|
|
@@ -1151,8 +1993,8 @@ function getHtmlBaseOptions(document) {
|
|
|
1151
1993
|
}
|
|
1152
1994
|
return options;
|
|
1153
1995
|
}
|
|
1154
|
-
async function getPopupEntrypoint(config,
|
|
1155
|
-
const content = await import_fs_extra9.default.readFile(
|
|
1996
|
+
async function getPopupEntrypoint(config, path9) {
|
|
1997
|
+
const content = await import_fs_extra9.default.readFile(path9, "utf-8");
|
|
1156
1998
|
const { document } = (0, import_linkedom2.parseHTML)(content);
|
|
1157
1999
|
const options = getHtmlBaseOptions(document);
|
|
1158
2000
|
const title = document.querySelector("title");
|
|
@@ -1177,12 +2019,12 @@ async function getPopupEntrypoint(config, path7) {
|
|
|
1177
2019
|
type: "popup",
|
|
1178
2020
|
name: "popup",
|
|
1179
2021
|
options,
|
|
1180
|
-
inputPath:
|
|
2022
|
+
inputPath: path9,
|
|
1181
2023
|
outputDir: config.outDir
|
|
1182
2024
|
};
|
|
1183
2025
|
}
|
|
1184
|
-
async function getOptionsEntrypoint(config,
|
|
1185
|
-
const content = await import_fs_extra9.default.readFile(
|
|
2026
|
+
async function getOptionsEntrypoint(config, path9) {
|
|
2027
|
+
const content = await import_fs_extra9.default.readFile(path9, "utf-8");
|
|
1186
2028
|
const { document } = (0, import_linkedom2.parseHTML)(content);
|
|
1187
2029
|
const options = getHtmlBaseOptions(document);
|
|
1188
2030
|
const openInTabContent = document.querySelector("meta[name='manifest.open_in_tab']")?.getAttribute("content");
|
|
@@ -1201,25 +2043,25 @@ async function getOptionsEntrypoint(config, path7) {
|
|
|
1201
2043
|
type: "options",
|
|
1202
2044
|
name: "options",
|
|
1203
2045
|
options,
|
|
1204
|
-
inputPath:
|
|
2046
|
+
inputPath: path9,
|
|
1205
2047
|
outputDir: config.outDir
|
|
1206
2048
|
};
|
|
1207
2049
|
}
|
|
1208
|
-
async function getUnlistedPageEntrypoint(config,
|
|
1209
|
-
const content = await import_fs_extra9.default.readFile(
|
|
2050
|
+
async function getUnlistedPageEntrypoint(config, path9) {
|
|
2051
|
+
const content = await import_fs_extra9.default.readFile(path9, "utf-8");
|
|
1210
2052
|
const { document } = (0, import_linkedom2.parseHTML)(content);
|
|
1211
2053
|
return {
|
|
1212
2054
|
type: "unlisted-page",
|
|
1213
|
-
name: getEntrypointName(config.entrypointsDir,
|
|
1214
|
-
inputPath:
|
|
2055
|
+
name: getEntrypointName(config.entrypointsDir, path9),
|
|
2056
|
+
inputPath: path9,
|
|
1215
2057
|
outputDir: config.outDir,
|
|
1216
2058
|
options: getHtmlBaseOptions(document)
|
|
1217
2059
|
};
|
|
1218
2060
|
}
|
|
1219
|
-
async function getBackgroundEntrypoint(config,
|
|
2061
|
+
async function getBackgroundEntrypoint(config, path9) {
|
|
1220
2062
|
let options = {};
|
|
1221
|
-
if (
|
|
1222
|
-
const defaultExport = await importEntrypointFile(
|
|
2063
|
+
if (path9 !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {
|
|
2064
|
+
const defaultExport = await importEntrypointFile(path9, config);
|
|
1223
2065
|
if (defaultExport == null) {
|
|
1224
2066
|
throw Error("Background script does not have a default export");
|
|
1225
2067
|
}
|
|
@@ -1229,20 +2071,20 @@ async function getBackgroundEntrypoint(config, path7) {
|
|
|
1229
2071
|
return {
|
|
1230
2072
|
type: "background",
|
|
1231
2073
|
name: "background",
|
|
1232
|
-
inputPath:
|
|
2074
|
+
inputPath: path9,
|
|
1233
2075
|
outputDir: config.outDir,
|
|
1234
2076
|
options
|
|
1235
2077
|
};
|
|
1236
2078
|
}
|
|
1237
|
-
async function getContentScriptEntrypoint(config, name,
|
|
1238
|
-
const { main: _, ...options } = await importEntrypointFile(
|
|
2079
|
+
async function getContentScriptEntrypoint(config, name, path9) {
|
|
2080
|
+
const { main: _, ...options } = await importEntrypointFile(path9, config);
|
|
1239
2081
|
if (options == null) {
|
|
1240
2082
|
throw Error(`Content script ${name} does not have a default export`);
|
|
1241
2083
|
}
|
|
1242
2084
|
return {
|
|
1243
2085
|
type: "content-script",
|
|
1244
|
-
name: getEntrypointName(config.entrypointsDir,
|
|
1245
|
-
inputPath:
|
|
2086
|
+
name: getEntrypointName(config.entrypointsDir, path9),
|
|
2087
|
+
inputPath: path9,
|
|
1246
2088
|
outputDir: (0, import_path8.resolve)(config.outDir, CONTENT_SCRIPT_OUT_DIR),
|
|
1247
2089
|
options
|
|
1248
2090
|
};
|
|
@@ -1367,7 +2209,7 @@ async function writePathsDeclarationFile(entrypoints, config) {
|
|
|
1367
2209
|
config.outDir,
|
|
1368
2210
|
entry.inputPath.endsWith(".html") ? ".html" : ".js"
|
|
1369
2211
|
)
|
|
1370
|
-
).concat(await getPublicFiles(config)).map(normalizePath2).map((
|
|
2212
|
+
).concat(await getPublicFiles(config)).map(normalizePath2).map((path9) => ` | "/${path9}"`).sort().join("\n");
|
|
1371
2213
|
const template = `// Generated by wxt
|
|
1372
2214
|
import "wxt/browser";
|
|
1373
2215
|
|
|
@@ -1447,7 +2289,7 @@ async function writeGlobalsDeclarationFile(config) {
|
|
|
1447
2289
|
"// Generated by wxt",
|
|
1448
2290
|
"export {}",
|
|
1449
2291
|
"declare global {",
|
|
1450
|
-
...globals.map((
|
|
2292
|
+
...globals.map((global2) => ` const ${global2.name}: ${global2.type};`),
|
|
1451
2293
|
"}"
|
|
1452
2294
|
].join("\n") + "\n"
|
|
1453
2295
|
);
|
|
@@ -2081,8 +2923,1153 @@ function getChunkSortWeight(filename) {
|
|
|
2081
2923
|
)?.[1] ?? DEFAULT_SORT_WEIGHT;
|
|
2082
2924
|
}
|
|
2083
2925
|
|
|
2084
|
-
//
|
|
2926
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/index.js
|
|
2927
|
+
var import_node_buffer2 = require("buffer");
|
|
2928
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
2929
|
+
var import_node_child_process3 = __toESM(require("child_process"), 1);
|
|
2930
|
+
var import_node_process4 = __toESM(require("process"), 1);
|
|
2931
|
+
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
2932
|
+
|
|
2933
|
+
// node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js
|
|
2934
|
+
function stripFinalNewline(input) {
|
|
2935
|
+
const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
|
|
2936
|
+
const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
|
|
2937
|
+
if (input[input.length - 1] === LF) {
|
|
2938
|
+
input = input.slice(0, -1);
|
|
2939
|
+
}
|
|
2940
|
+
if (input[input.length - 1] === CR) {
|
|
2941
|
+
input = input.slice(0, -1);
|
|
2942
|
+
}
|
|
2943
|
+
return input;
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
// node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js
|
|
2947
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
2948
|
+
var import_node_path8 = __toESM(require("path"), 1);
|
|
2949
|
+
var import_node_url = __toESM(require("url"), 1);
|
|
2950
|
+
|
|
2951
|
+
// node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
|
2952
|
+
function pathKey(options = {}) {
|
|
2953
|
+
const {
|
|
2954
|
+
env = process.env,
|
|
2955
|
+
platform = process.platform
|
|
2956
|
+
} = options;
|
|
2957
|
+
if (platform !== "win32") {
|
|
2958
|
+
return "PATH";
|
|
2959
|
+
}
|
|
2960
|
+
return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
// node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js
|
|
2964
|
+
function npmRunPath(options = {}) {
|
|
2965
|
+
const {
|
|
2966
|
+
cwd = import_node_process.default.cwd(),
|
|
2967
|
+
path: path_ = import_node_process.default.env[pathKey()],
|
|
2968
|
+
execPath = import_node_process.default.execPath
|
|
2969
|
+
} = options;
|
|
2970
|
+
let previous;
|
|
2971
|
+
const cwdString = cwd instanceof URL ? import_node_url.default.fileURLToPath(cwd) : cwd;
|
|
2972
|
+
let cwdPath = import_node_path8.default.resolve(cwdString);
|
|
2973
|
+
const result = [];
|
|
2974
|
+
while (previous !== cwdPath) {
|
|
2975
|
+
result.push(import_node_path8.default.join(cwdPath, "node_modules/.bin"));
|
|
2976
|
+
previous = cwdPath;
|
|
2977
|
+
cwdPath = import_node_path8.default.resolve(cwdPath, "..");
|
|
2978
|
+
}
|
|
2979
|
+
result.push(import_node_path8.default.resolve(cwdString, execPath, ".."));
|
|
2980
|
+
return [...result, path_].join(import_node_path8.default.delimiter);
|
|
2981
|
+
}
|
|
2982
|
+
function npmRunPathEnv({ env = import_node_process.default.env, ...options } = {}) {
|
|
2983
|
+
env = { ...env };
|
|
2984
|
+
const path9 = pathKey({ env });
|
|
2985
|
+
options.path = env[path9];
|
|
2986
|
+
env[path9] = npmRunPath(options);
|
|
2987
|
+
return env;
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
// node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js
|
|
2991
|
+
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
2992
|
+
if (property === "length" || property === "prototype") {
|
|
2993
|
+
return;
|
|
2994
|
+
}
|
|
2995
|
+
if (property === "arguments" || property === "caller") {
|
|
2996
|
+
return;
|
|
2997
|
+
}
|
|
2998
|
+
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
2999
|
+
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
3000
|
+
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
|
3001
|
+
return;
|
|
3002
|
+
}
|
|
3003
|
+
Object.defineProperty(to, property, fromDescriptor);
|
|
3004
|
+
};
|
|
3005
|
+
var canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
3006
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
3007
|
+
};
|
|
3008
|
+
var changePrototype = (to, from) => {
|
|
3009
|
+
const fromPrototype = Object.getPrototypeOf(from);
|
|
3010
|
+
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
3011
|
+
return;
|
|
3012
|
+
}
|
|
3013
|
+
Object.setPrototypeOf(to, fromPrototype);
|
|
3014
|
+
};
|
|
3015
|
+
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
3016
|
+
${fromBody}`;
|
|
3017
|
+
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
3018
|
+
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
3019
|
+
var changeToString = (to, from, name) => {
|
|
3020
|
+
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
3021
|
+
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
3022
|
+
Object.defineProperty(newToString, "name", toStringName);
|
|
3023
|
+
Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
|
|
3024
|
+
};
|
|
3025
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
3026
|
+
const { name } = to;
|
|
3027
|
+
for (const property of Reflect.ownKeys(from)) {
|
|
3028
|
+
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
3029
|
+
}
|
|
3030
|
+
changePrototype(to, from);
|
|
3031
|
+
changeToString(to, from, name);
|
|
3032
|
+
return to;
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
// node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js
|
|
3036
|
+
var calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
3037
|
+
var onetime = (function_, options = {}) => {
|
|
3038
|
+
if (typeof function_ !== "function") {
|
|
3039
|
+
throw new TypeError("Expected a function");
|
|
3040
|
+
}
|
|
3041
|
+
let returnValue;
|
|
3042
|
+
let callCount = 0;
|
|
3043
|
+
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
3044
|
+
const onetime2 = function(...arguments_) {
|
|
3045
|
+
calledFunctions.set(onetime2, ++callCount);
|
|
3046
|
+
if (callCount === 1) {
|
|
3047
|
+
returnValue = function_.apply(this, arguments_);
|
|
3048
|
+
function_ = null;
|
|
3049
|
+
} else if (options.throw === true) {
|
|
3050
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
3051
|
+
}
|
|
3052
|
+
return returnValue;
|
|
3053
|
+
};
|
|
3054
|
+
mimicFunction(onetime2, function_);
|
|
3055
|
+
calledFunctions.set(onetime2, callCount);
|
|
3056
|
+
return onetime2;
|
|
3057
|
+
};
|
|
3058
|
+
onetime.callCount = (function_) => {
|
|
3059
|
+
if (!calledFunctions.has(function_)) {
|
|
3060
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
3061
|
+
}
|
|
3062
|
+
return calledFunctions.get(function_);
|
|
3063
|
+
};
|
|
3064
|
+
var onetime_default = onetime;
|
|
3065
|
+
|
|
3066
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/error.js
|
|
3067
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
3068
|
+
|
|
3069
|
+
// node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/main.js
|
|
3070
|
+
var import_node_os2 = require("os");
|
|
3071
|
+
|
|
3072
|
+
// node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/realtime.js
|
|
3073
|
+
var getRealtimeSignals = () => {
|
|
3074
|
+
const length = SIGRTMAX - SIGRTMIN + 1;
|
|
3075
|
+
return Array.from({ length }, getRealtimeSignal);
|
|
3076
|
+
};
|
|
3077
|
+
var getRealtimeSignal = (value, index) => ({
|
|
3078
|
+
name: `SIGRT${index + 1}`,
|
|
3079
|
+
number: SIGRTMIN + index,
|
|
3080
|
+
action: "terminate",
|
|
3081
|
+
description: "Application-specific signal (realtime)",
|
|
3082
|
+
standard: "posix"
|
|
3083
|
+
});
|
|
3084
|
+
var SIGRTMIN = 34;
|
|
3085
|
+
var SIGRTMAX = 64;
|
|
3086
|
+
|
|
3087
|
+
// node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/signals.js
|
|
3088
|
+
var import_node_os = require("os");
|
|
3089
|
+
|
|
3090
|
+
// node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/core.js
|
|
3091
|
+
var SIGNALS = [
|
|
3092
|
+
{
|
|
3093
|
+
name: "SIGHUP",
|
|
3094
|
+
number: 1,
|
|
3095
|
+
action: "terminate",
|
|
3096
|
+
description: "Terminal closed",
|
|
3097
|
+
standard: "posix"
|
|
3098
|
+
},
|
|
3099
|
+
{
|
|
3100
|
+
name: "SIGINT",
|
|
3101
|
+
number: 2,
|
|
3102
|
+
action: "terminate",
|
|
3103
|
+
description: "User interruption with CTRL-C",
|
|
3104
|
+
standard: "ansi"
|
|
3105
|
+
},
|
|
3106
|
+
{
|
|
3107
|
+
name: "SIGQUIT",
|
|
3108
|
+
number: 3,
|
|
3109
|
+
action: "core",
|
|
3110
|
+
description: "User interruption with CTRL-\\",
|
|
3111
|
+
standard: "posix"
|
|
3112
|
+
},
|
|
3113
|
+
{
|
|
3114
|
+
name: "SIGILL",
|
|
3115
|
+
number: 4,
|
|
3116
|
+
action: "core",
|
|
3117
|
+
description: "Invalid machine instruction",
|
|
3118
|
+
standard: "ansi"
|
|
3119
|
+
},
|
|
3120
|
+
{
|
|
3121
|
+
name: "SIGTRAP",
|
|
3122
|
+
number: 5,
|
|
3123
|
+
action: "core",
|
|
3124
|
+
description: "Debugger breakpoint",
|
|
3125
|
+
standard: "posix"
|
|
3126
|
+
},
|
|
3127
|
+
{
|
|
3128
|
+
name: "SIGABRT",
|
|
3129
|
+
number: 6,
|
|
3130
|
+
action: "core",
|
|
3131
|
+
description: "Aborted",
|
|
3132
|
+
standard: "ansi"
|
|
3133
|
+
},
|
|
3134
|
+
{
|
|
3135
|
+
name: "SIGIOT",
|
|
3136
|
+
number: 6,
|
|
3137
|
+
action: "core",
|
|
3138
|
+
description: "Aborted",
|
|
3139
|
+
standard: "bsd"
|
|
3140
|
+
},
|
|
3141
|
+
{
|
|
3142
|
+
name: "SIGBUS",
|
|
3143
|
+
number: 7,
|
|
3144
|
+
action: "core",
|
|
3145
|
+
description: "Bus error due to misaligned, non-existing address or paging error",
|
|
3146
|
+
standard: "bsd"
|
|
3147
|
+
},
|
|
3148
|
+
{
|
|
3149
|
+
name: "SIGEMT",
|
|
3150
|
+
number: 7,
|
|
3151
|
+
action: "terminate",
|
|
3152
|
+
description: "Command should be emulated but is not implemented",
|
|
3153
|
+
standard: "other"
|
|
3154
|
+
},
|
|
3155
|
+
{
|
|
3156
|
+
name: "SIGFPE",
|
|
3157
|
+
number: 8,
|
|
3158
|
+
action: "core",
|
|
3159
|
+
description: "Floating point arithmetic error",
|
|
3160
|
+
standard: "ansi"
|
|
3161
|
+
},
|
|
3162
|
+
{
|
|
3163
|
+
name: "SIGKILL",
|
|
3164
|
+
number: 9,
|
|
3165
|
+
action: "terminate",
|
|
3166
|
+
description: "Forced termination",
|
|
3167
|
+
standard: "posix",
|
|
3168
|
+
forced: true
|
|
3169
|
+
},
|
|
3170
|
+
{
|
|
3171
|
+
name: "SIGUSR1",
|
|
3172
|
+
number: 10,
|
|
3173
|
+
action: "terminate",
|
|
3174
|
+
description: "Application-specific signal",
|
|
3175
|
+
standard: "posix"
|
|
3176
|
+
},
|
|
3177
|
+
{
|
|
3178
|
+
name: "SIGSEGV",
|
|
3179
|
+
number: 11,
|
|
3180
|
+
action: "core",
|
|
3181
|
+
description: "Segmentation fault",
|
|
3182
|
+
standard: "ansi"
|
|
3183
|
+
},
|
|
3184
|
+
{
|
|
3185
|
+
name: "SIGUSR2",
|
|
3186
|
+
number: 12,
|
|
3187
|
+
action: "terminate",
|
|
3188
|
+
description: "Application-specific signal",
|
|
3189
|
+
standard: "posix"
|
|
3190
|
+
},
|
|
3191
|
+
{
|
|
3192
|
+
name: "SIGPIPE",
|
|
3193
|
+
number: 13,
|
|
3194
|
+
action: "terminate",
|
|
3195
|
+
description: "Broken pipe or socket",
|
|
3196
|
+
standard: "posix"
|
|
3197
|
+
},
|
|
3198
|
+
{
|
|
3199
|
+
name: "SIGALRM",
|
|
3200
|
+
number: 14,
|
|
3201
|
+
action: "terminate",
|
|
3202
|
+
description: "Timeout or timer",
|
|
3203
|
+
standard: "posix"
|
|
3204
|
+
},
|
|
3205
|
+
{
|
|
3206
|
+
name: "SIGTERM",
|
|
3207
|
+
number: 15,
|
|
3208
|
+
action: "terminate",
|
|
3209
|
+
description: "Termination",
|
|
3210
|
+
standard: "ansi"
|
|
3211
|
+
},
|
|
3212
|
+
{
|
|
3213
|
+
name: "SIGSTKFLT",
|
|
3214
|
+
number: 16,
|
|
3215
|
+
action: "terminate",
|
|
3216
|
+
description: "Stack is empty or overflowed",
|
|
3217
|
+
standard: "other"
|
|
3218
|
+
},
|
|
3219
|
+
{
|
|
3220
|
+
name: "SIGCHLD",
|
|
3221
|
+
number: 17,
|
|
3222
|
+
action: "ignore",
|
|
3223
|
+
description: "Child process terminated, paused or unpaused",
|
|
3224
|
+
standard: "posix"
|
|
3225
|
+
},
|
|
3226
|
+
{
|
|
3227
|
+
name: "SIGCLD",
|
|
3228
|
+
number: 17,
|
|
3229
|
+
action: "ignore",
|
|
3230
|
+
description: "Child process terminated, paused or unpaused",
|
|
3231
|
+
standard: "other"
|
|
3232
|
+
},
|
|
3233
|
+
{
|
|
3234
|
+
name: "SIGCONT",
|
|
3235
|
+
number: 18,
|
|
3236
|
+
action: "unpause",
|
|
3237
|
+
description: "Unpaused",
|
|
3238
|
+
standard: "posix",
|
|
3239
|
+
forced: true
|
|
3240
|
+
},
|
|
3241
|
+
{
|
|
3242
|
+
name: "SIGSTOP",
|
|
3243
|
+
number: 19,
|
|
3244
|
+
action: "pause",
|
|
3245
|
+
description: "Paused",
|
|
3246
|
+
standard: "posix",
|
|
3247
|
+
forced: true
|
|
3248
|
+
},
|
|
3249
|
+
{
|
|
3250
|
+
name: "SIGTSTP",
|
|
3251
|
+
number: 20,
|
|
3252
|
+
action: "pause",
|
|
3253
|
+
description: 'Paused using CTRL-Z or "suspend"',
|
|
3254
|
+
standard: "posix"
|
|
3255
|
+
},
|
|
3256
|
+
{
|
|
3257
|
+
name: "SIGTTIN",
|
|
3258
|
+
number: 21,
|
|
3259
|
+
action: "pause",
|
|
3260
|
+
description: "Background process cannot read terminal input",
|
|
3261
|
+
standard: "posix"
|
|
3262
|
+
},
|
|
3263
|
+
{
|
|
3264
|
+
name: "SIGBREAK",
|
|
3265
|
+
number: 21,
|
|
3266
|
+
action: "terminate",
|
|
3267
|
+
description: "User interruption with CTRL-BREAK",
|
|
3268
|
+
standard: "other"
|
|
3269
|
+
},
|
|
3270
|
+
{
|
|
3271
|
+
name: "SIGTTOU",
|
|
3272
|
+
number: 22,
|
|
3273
|
+
action: "pause",
|
|
3274
|
+
description: "Background process cannot write to terminal output",
|
|
3275
|
+
standard: "posix"
|
|
3276
|
+
},
|
|
3277
|
+
{
|
|
3278
|
+
name: "SIGURG",
|
|
3279
|
+
number: 23,
|
|
3280
|
+
action: "ignore",
|
|
3281
|
+
description: "Socket received out-of-band data",
|
|
3282
|
+
standard: "bsd"
|
|
3283
|
+
},
|
|
3284
|
+
{
|
|
3285
|
+
name: "SIGXCPU",
|
|
3286
|
+
number: 24,
|
|
3287
|
+
action: "core",
|
|
3288
|
+
description: "Process timed out",
|
|
3289
|
+
standard: "bsd"
|
|
3290
|
+
},
|
|
3291
|
+
{
|
|
3292
|
+
name: "SIGXFSZ",
|
|
3293
|
+
number: 25,
|
|
3294
|
+
action: "core",
|
|
3295
|
+
description: "File too big",
|
|
3296
|
+
standard: "bsd"
|
|
3297
|
+
},
|
|
3298
|
+
{
|
|
3299
|
+
name: "SIGVTALRM",
|
|
3300
|
+
number: 26,
|
|
3301
|
+
action: "terminate",
|
|
3302
|
+
description: "Timeout or timer",
|
|
3303
|
+
standard: "bsd"
|
|
3304
|
+
},
|
|
3305
|
+
{
|
|
3306
|
+
name: "SIGPROF",
|
|
3307
|
+
number: 27,
|
|
3308
|
+
action: "terminate",
|
|
3309
|
+
description: "Timeout or timer",
|
|
3310
|
+
standard: "bsd"
|
|
3311
|
+
},
|
|
3312
|
+
{
|
|
3313
|
+
name: "SIGWINCH",
|
|
3314
|
+
number: 28,
|
|
3315
|
+
action: "ignore",
|
|
3316
|
+
description: "Terminal window size changed",
|
|
3317
|
+
standard: "bsd"
|
|
3318
|
+
},
|
|
3319
|
+
{
|
|
3320
|
+
name: "SIGIO",
|
|
3321
|
+
number: 29,
|
|
3322
|
+
action: "terminate",
|
|
3323
|
+
description: "I/O is available",
|
|
3324
|
+
standard: "other"
|
|
3325
|
+
},
|
|
3326
|
+
{
|
|
3327
|
+
name: "SIGPOLL",
|
|
3328
|
+
number: 29,
|
|
3329
|
+
action: "terminate",
|
|
3330
|
+
description: "Watched event",
|
|
3331
|
+
standard: "other"
|
|
3332
|
+
},
|
|
3333
|
+
{
|
|
3334
|
+
name: "SIGINFO",
|
|
3335
|
+
number: 29,
|
|
3336
|
+
action: "ignore",
|
|
3337
|
+
description: "Request for process information",
|
|
3338
|
+
standard: "other"
|
|
3339
|
+
},
|
|
3340
|
+
{
|
|
3341
|
+
name: "SIGPWR",
|
|
3342
|
+
number: 30,
|
|
3343
|
+
action: "terminate",
|
|
3344
|
+
description: "Device running out of power",
|
|
3345
|
+
standard: "systemv"
|
|
3346
|
+
},
|
|
3347
|
+
{
|
|
3348
|
+
name: "SIGSYS",
|
|
3349
|
+
number: 31,
|
|
3350
|
+
action: "core",
|
|
3351
|
+
description: "Invalid system call",
|
|
3352
|
+
standard: "other"
|
|
3353
|
+
},
|
|
3354
|
+
{
|
|
3355
|
+
name: "SIGUNUSED",
|
|
3356
|
+
number: 31,
|
|
3357
|
+
action: "terminate",
|
|
3358
|
+
description: "Invalid system call",
|
|
3359
|
+
standard: "other"
|
|
3360
|
+
}
|
|
3361
|
+
];
|
|
3362
|
+
|
|
3363
|
+
// node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/signals.js
|
|
3364
|
+
var getSignals = () => {
|
|
3365
|
+
const realtimeSignals = getRealtimeSignals();
|
|
3366
|
+
const signals = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
|
|
3367
|
+
return signals;
|
|
3368
|
+
};
|
|
3369
|
+
var normalizeSignal = ({
|
|
3370
|
+
name,
|
|
3371
|
+
number: defaultNumber,
|
|
3372
|
+
description,
|
|
3373
|
+
action,
|
|
3374
|
+
forced = false,
|
|
3375
|
+
standard
|
|
3376
|
+
}) => {
|
|
3377
|
+
const {
|
|
3378
|
+
signals: { [name]: constantSignal }
|
|
3379
|
+
} = import_node_os.constants;
|
|
3380
|
+
const supported = constantSignal !== void 0;
|
|
3381
|
+
const number = supported ? constantSignal : defaultNumber;
|
|
3382
|
+
return { name, number, description, supported, action, forced, standard };
|
|
3383
|
+
};
|
|
3384
|
+
|
|
3385
|
+
// node_modules/.pnpm/human-signals@4.3.1/node_modules/human-signals/build/src/main.js
|
|
3386
|
+
var getSignalsByName = () => {
|
|
3387
|
+
const signals = getSignals();
|
|
3388
|
+
return Object.fromEntries(signals.map(getSignalByName));
|
|
3389
|
+
};
|
|
3390
|
+
var getSignalByName = ({
|
|
3391
|
+
name,
|
|
3392
|
+
number,
|
|
3393
|
+
description,
|
|
3394
|
+
supported,
|
|
3395
|
+
action,
|
|
3396
|
+
forced,
|
|
3397
|
+
standard
|
|
3398
|
+
}) => [name, { name, number, description, supported, action, forced, standard }];
|
|
3399
|
+
var signalsByName = getSignalsByName();
|
|
3400
|
+
var getSignalsByNumber = () => {
|
|
3401
|
+
const signals = getSignals();
|
|
3402
|
+
const length = SIGRTMAX + 1;
|
|
3403
|
+
const signalsA = Array.from({ length }, (value, number) => getSignalByNumber(number, signals));
|
|
3404
|
+
return Object.assign({}, ...signalsA);
|
|
3405
|
+
};
|
|
3406
|
+
var getSignalByNumber = (number, signals) => {
|
|
3407
|
+
const signal = findSignalByNumber(number, signals);
|
|
3408
|
+
if (signal === void 0) {
|
|
3409
|
+
return {};
|
|
3410
|
+
}
|
|
3411
|
+
const { name, description, supported, action, forced, standard } = signal;
|
|
3412
|
+
return {
|
|
3413
|
+
[number]: {
|
|
3414
|
+
name,
|
|
3415
|
+
number,
|
|
3416
|
+
description,
|
|
3417
|
+
supported,
|
|
3418
|
+
action,
|
|
3419
|
+
forced,
|
|
3420
|
+
standard
|
|
3421
|
+
}
|
|
3422
|
+
};
|
|
3423
|
+
};
|
|
3424
|
+
var findSignalByNumber = (number, signals) => {
|
|
3425
|
+
const signal = signals.find(({ name }) => import_node_os2.constants.signals[name] === number);
|
|
3426
|
+
if (signal !== void 0) {
|
|
3427
|
+
return signal;
|
|
3428
|
+
}
|
|
3429
|
+
return signals.find((signalA) => signalA.number === number);
|
|
3430
|
+
};
|
|
3431
|
+
var signalsByNumber = getSignalsByNumber();
|
|
3432
|
+
|
|
3433
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/error.js
|
|
3434
|
+
var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
|
|
3435
|
+
if (timedOut) {
|
|
3436
|
+
return `timed out after ${timeout} milliseconds`;
|
|
3437
|
+
}
|
|
3438
|
+
if (isCanceled) {
|
|
3439
|
+
return "was canceled";
|
|
3440
|
+
}
|
|
3441
|
+
if (errorCode !== void 0) {
|
|
3442
|
+
return `failed with ${errorCode}`;
|
|
3443
|
+
}
|
|
3444
|
+
if (signal !== void 0) {
|
|
3445
|
+
return `was killed with ${signal} (${signalDescription})`;
|
|
3446
|
+
}
|
|
3447
|
+
if (exitCode !== void 0) {
|
|
3448
|
+
return `failed with exit code ${exitCode}`;
|
|
3449
|
+
}
|
|
3450
|
+
return "failed";
|
|
3451
|
+
};
|
|
3452
|
+
var makeError = ({
|
|
3453
|
+
stdout,
|
|
3454
|
+
stderr,
|
|
3455
|
+
all,
|
|
3456
|
+
error,
|
|
3457
|
+
signal,
|
|
3458
|
+
exitCode,
|
|
3459
|
+
command,
|
|
3460
|
+
escapedCommand,
|
|
3461
|
+
timedOut,
|
|
3462
|
+
isCanceled,
|
|
3463
|
+
killed,
|
|
3464
|
+
parsed: { options: { timeout, cwd = import_node_process2.default.cwd() } }
|
|
3465
|
+
}) => {
|
|
3466
|
+
exitCode = exitCode === null ? void 0 : exitCode;
|
|
3467
|
+
signal = signal === null ? void 0 : signal;
|
|
3468
|
+
const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
|
|
3469
|
+
const errorCode = error && error.code;
|
|
3470
|
+
const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
|
|
3471
|
+
const execaMessage = `Command ${prefix}: ${command}`;
|
|
3472
|
+
const isError = Object.prototype.toString.call(error) === "[object Error]";
|
|
3473
|
+
const shortMessage = isError ? `${execaMessage}
|
|
3474
|
+
${error.message}` : execaMessage;
|
|
3475
|
+
const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
|
|
3476
|
+
if (isError) {
|
|
3477
|
+
error.originalMessage = error.message;
|
|
3478
|
+
error.message = message;
|
|
3479
|
+
} else {
|
|
3480
|
+
error = new Error(message);
|
|
3481
|
+
}
|
|
3482
|
+
error.shortMessage = shortMessage;
|
|
3483
|
+
error.command = command;
|
|
3484
|
+
error.escapedCommand = escapedCommand;
|
|
3485
|
+
error.exitCode = exitCode;
|
|
3486
|
+
error.signal = signal;
|
|
3487
|
+
error.signalDescription = signalDescription;
|
|
3488
|
+
error.stdout = stdout;
|
|
3489
|
+
error.stderr = stderr;
|
|
3490
|
+
error.cwd = cwd;
|
|
3491
|
+
if (all !== void 0) {
|
|
3492
|
+
error.all = all;
|
|
3493
|
+
}
|
|
3494
|
+
if ("bufferedData" in error) {
|
|
3495
|
+
delete error.bufferedData;
|
|
3496
|
+
}
|
|
3497
|
+
error.failed = true;
|
|
3498
|
+
error.timedOut = Boolean(timedOut);
|
|
3499
|
+
error.isCanceled = isCanceled;
|
|
3500
|
+
error.killed = killed && !timedOut;
|
|
3501
|
+
return error;
|
|
3502
|
+
};
|
|
3503
|
+
|
|
3504
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/stdio.js
|
|
3505
|
+
var aliases = ["stdin", "stdout", "stderr"];
|
|
3506
|
+
var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
|
|
3507
|
+
var normalizeStdio = (options) => {
|
|
3508
|
+
if (!options) {
|
|
3509
|
+
return;
|
|
3510
|
+
}
|
|
3511
|
+
const { stdio } = options;
|
|
3512
|
+
if (stdio === void 0) {
|
|
3513
|
+
return aliases.map((alias) => options[alias]);
|
|
3514
|
+
}
|
|
3515
|
+
if (hasAlias(options)) {
|
|
3516
|
+
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
|
|
3517
|
+
}
|
|
3518
|
+
if (typeof stdio === "string") {
|
|
3519
|
+
return stdio;
|
|
3520
|
+
}
|
|
3521
|
+
if (!Array.isArray(stdio)) {
|
|
3522
|
+
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
|
3523
|
+
}
|
|
3524
|
+
const length = Math.max(stdio.length, aliases.length);
|
|
3525
|
+
return Array.from({ length }, (value, index) => stdio[index]);
|
|
3526
|
+
};
|
|
3527
|
+
|
|
3528
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/kill.js
|
|
3529
|
+
var import_node_os3 = __toESM(require("os"), 1);
|
|
3530
|
+
var import_signal_exit = __toESM(require_signal_exit(), 1);
|
|
3531
|
+
var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
|
3532
|
+
var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
|
|
3533
|
+
const killResult = kill(signal);
|
|
3534
|
+
setKillTimeout(kill, signal, options, killResult);
|
|
3535
|
+
return killResult;
|
|
3536
|
+
};
|
|
3537
|
+
var setKillTimeout = (kill, signal, options, killResult) => {
|
|
3538
|
+
if (!shouldForceKill(signal, options, killResult)) {
|
|
3539
|
+
return;
|
|
3540
|
+
}
|
|
3541
|
+
const timeout = getForceKillAfterTimeout(options);
|
|
3542
|
+
const t = setTimeout(() => {
|
|
3543
|
+
kill("SIGKILL");
|
|
3544
|
+
}, timeout);
|
|
3545
|
+
if (t.unref) {
|
|
3546
|
+
t.unref();
|
|
3547
|
+
}
|
|
3548
|
+
};
|
|
3549
|
+
var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
|
3550
|
+
var isSigterm = (signal) => signal === import_node_os3.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
|
|
3551
|
+
var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
|
|
3552
|
+
if (forceKillAfterTimeout === true) {
|
|
3553
|
+
return DEFAULT_FORCE_KILL_TIMEOUT;
|
|
3554
|
+
}
|
|
3555
|
+
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
|
|
3556
|
+
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
|
|
3557
|
+
}
|
|
3558
|
+
return forceKillAfterTimeout;
|
|
3559
|
+
};
|
|
3560
|
+
var spawnedCancel = (spawned, context) => {
|
|
3561
|
+
const killResult = spawned.kill();
|
|
3562
|
+
if (killResult) {
|
|
3563
|
+
context.isCanceled = true;
|
|
3564
|
+
}
|
|
3565
|
+
};
|
|
3566
|
+
var timeoutKill = (spawned, signal, reject) => {
|
|
3567
|
+
spawned.kill(signal);
|
|
3568
|
+
reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
|
|
3569
|
+
};
|
|
3570
|
+
var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
|
|
3571
|
+
if (timeout === 0 || timeout === void 0) {
|
|
3572
|
+
return spawnedPromise;
|
|
3573
|
+
}
|
|
3574
|
+
let timeoutId;
|
|
3575
|
+
const timeoutPromise = new Promise((resolve13, reject) => {
|
|
3576
|
+
timeoutId = setTimeout(() => {
|
|
3577
|
+
timeoutKill(spawned, killSignal, reject);
|
|
3578
|
+
}, timeout);
|
|
3579
|
+
});
|
|
3580
|
+
const safeSpawnedPromise = spawnedPromise.finally(() => {
|
|
3581
|
+
clearTimeout(timeoutId);
|
|
3582
|
+
});
|
|
3583
|
+
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
|
3584
|
+
};
|
|
3585
|
+
var validateTimeout = ({ timeout }) => {
|
|
3586
|
+
if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
|
|
3587
|
+
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
|
3588
|
+
}
|
|
3589
|
+
};
|
|
3590
|
+
var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
|
|
3591
|
+
if (!cleanup || detached) {
|
|
3592
|
+
return timedPromise;
|
|
3593
|
+
}
|
|
3594
|
+
const removeExitHandler = (0, import_signal_exit.default)(() => {
|
|
3595
|
+
spawned.kill();
|
|
3596
|
+
});
|
|
3597
|
+
return timedPromise.finally(() => {
|
|
3598
|
+
removeExitHandler();
|
|
3599
|
+
});
|
|
3600
|
+
};
|
|
3601
|
+
|
|
3602
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/pipe.js
|
|
3603
|
+
var import_node_fs = require("fs");
|
|
2085
3604
|
var import_node_child_process = require("child_process");
|
|
3605
|
+
|
|
3606
|
+
// node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js
|
|
3607
|
+
function isStream(stream) {
|
|
3608
|
+
return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
|
|
3609
|
+
}
|
|
3610
|
+
function isWritableStream(stream) {
|
|
3611
|
+
return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/pipe.js
|
|
3615
|
+
var isExecaChildProcess = (target) => target instanceof import_node_child_process.ChildProcess && typeof target.then === "function";
|
|
3616
|
+
var pipeToTarget = (spawned, streamName, target) => {
|
|
3617
|
+
if (typeof target === "string") {
|
|
3618
|
+
spawned[streamName].pipe((0, import_node_fs.createWriteStream)(target));
|
|
3619
|
+
return spawned;
|
|
3620
|
+
}
|
|
3621
|
+
if (isWritableStream(target)) {
|
|
3622
|
+
spawned[streamName].pipe(target);
|
|
3623
|
+
return spawned;
|
|
3624
|
+
}
|
|
3625
|
+
if (!isExecaChildProcess(target)) {
|
|
3626
|
+
throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
|
|
3627
|
+
}
|
|
3628
|
+
if (!isWritableStream(target.stdin)) {
|
|
3629
|
+
throw new TypeError("The target child process's stdin must be available.");
|
|
3630
|
+
}
|
|
3631
|
+
spawned[streamName].pipe(target.stdin);
|
|
3632
|
+
return target;
|
|
3633
|
+
};
|
|
3634
|
+
var addPipeMethods = (spawned) => {
|
|
3635
|
+
if (spawned.stdout !== null) {
|
|
3636
|
+
spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
|
|
3637
|
+
}
|
|
3638
|
+
if (spawned.stderr !== null) {
|
|
3639
|
+
spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
|
|
3640
|
+
}
|
|
3641
|
+
if (spawned.all !== void 0) {
|
|
3642
|
+
spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
|
|
3643
|
+
}
|
|
3644
|
+
};
|
|
3645
|
+
|
|
3646
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/stream.js
|
|
3647
|
+
var import_node_fs2 = require("fs");
|
|
3648
|
+
var import_get_stream = __toESM(require_get_stream(), 1);
|
|
3649
|
+
var import_merge_stream = __toESM(require_merge_stream(), 1);
|
|
3650
|
+
var validateInputOptions = (input) => {
|
|
3651
|
+
if (input !== void 0) {
|
|
3652
|
+
throw new TypeError("The `input` and `inputFile` options cannot be both set.");
|
|
3653
|
+
}
|
|
3654
|
+
};
|
|
3655
|
+
var getInputSync = ({ input, inputFile }) => {
|
|
3656
|
+
if (typeof inputFile !== "string") {
|
|
3657
|
+
return input;
|
|
3658
|
+
}
|
|
3659
|
+
validateInputOptions(input);
|
|
3660
|
+
return (0, import_node_fs2.readFileSync)(inputFile);
|
|
3661
|
+
};
|
|
3662
|
+
var handleInputSync = (options) => {
|
|
3663
|
+
const input = getInputSync(options);
|
|
3664
|
+
if (isStream(input)) {
|
|
3665
|
+
throw new TypeError("The `input` option cannot be a stream in sync mode");
|
|
3666
|
+
}
|
|
3667
|
+
return input;
|
|
3668
|
+
};
|
|
3669
|
+
var getInput = ({ input, inputFile }) => {
|
|
3670
|
+
if (typeof inputFile !== "string") {
|
|
3671
|
+
return input;
|
|
3672
|
+
}
|
|
3673
|
+
validateInputOptions(input);
|
|
3674
|
+
return (0, import_node_fs2.createReadStream)(inputFile);
|
|
3675
|
+
};
|
|
3676
|
+
var handleInput = (spawned, options) => {
|
|
3677
|
+
const input = getInput(options);
|
|
3678
|
+
if (input === void 0) {
|
|
3679
|
+
return;
|
|
3680
|
+
}
|
|
3681
|
+
if (isStream(input)) {
|
|
3682
|
+
input.pipe(spawned.stdin);
|
|
3683
|
+
} else {
|
|
3684
|
+
spawned.stdin.end(input);
|
|
3685
|
+
}
|
|
3686
|
+
};
|
|
3687
|
+
var makeAllStream = (spawned, { all }) => {
|
|
3688
|
+
if (!all || !spawned.stdout && !spawned.stderr) {
|
|
3689
|
+
return;
|
|
3690
|
+
}
|
|
3691
|
+
const mixed = (0, import_merge_stream.default)();
|
|
3692
|
+
if (spawned.stdout) {
|
|
3693
|
+
mixed.add(spawned.stdout);
|
|
3694
|
+
}
|
|
3695
|
+
if (spawned.stderr) {
|
|
3696
|
+
mixed.add(spawned.stderr);
|
|
3697
|
+
}
|
|
3698
|
+
return mixed;
|
|
3699
|
+
};
|
|
3700
|
+
var getBufferedData = async (stream, streamPromise) => {
|
|
3701
|
+
if (!stream || streamPromise === void 0) {
|
|
3702
|
+
return;
|
|
3703
|
+
}
|
|
3704
|
+
stream.destroy();
|
|
3705
|
+
try {
|
|
3706
|
+
return await streamPromise;
|
|
3707
|
+
} catch (error) {
|
|
3708
|
+
return error.bufferedData;
|
|
3709
|
+
}
|
|
3710
|
+
};
|
|
3711
|
+
var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
|
|
3712
|
+
if (!stream || !buffer) {
|
|
3713
|
+
return;
|
|
3714
|
+
}
|
|
3715
|
+
if (encoding) {
|
|
3716
|
+
return (0, import_get_stream.default)(stream, { encoding, maxBuffer });
|
|
3717
|
+
}
|
|
3718
|
+
return import_get_stream.default.buffer(stream, { maxBuffer });
|
|
3719
|
+
};
|
|
3720
|
+
var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
|
|
3721
|
+
const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
|
|
3722
|
+
const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
|
|
3723
|
+
const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
|
|
3724
|
+
try {
|
|
3725
|
+
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
|
3726
|
+
} catch (error) {
|
|
3727
|
+
return Promise.all([
|
|
3728
|
+
{ error, signal: error.signal, timedOut: error.timedOut },
|
|
3729
|
+
getBufferedData(stdout, stdoutPromise),
|
|
3730
|
+
getBufferedData(stderr, stderrPromise),
|
|
3731
|
+
getBufferedData(all, allPromise)
|
|
3732
|
+
]);
|
|
3733
|
+
}
|
|
3734
|
+
};
|
|
3735
|
+
|
|
3736
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/promise.js
|
|
3737
|
+
var nativePromisePrototype = (/* @__PURE__ */ (async () => {
|
|
3738
|
+
})()).constructor.prototype;
|
|
3739
|
+
var descriptors = ["then", "catch", "finally"].map((property) => [
|
|
3740
|
+
property,
|
|
3741
|
+
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
|
|
3742
|
+
]);
|
|
3743
|
+
var mergePromise = (spawned, promise) => {
|
|
3744
|
+
for (const [property, descriptor] of descriptors) {
|
|
3745
|
+
const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
|
|
3746
|
+
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
3747
|
+
}
|
|
3748
|
+
};
|
|
3749
|
+
var getSpawnedPromise = (spawned) => new Promise((resolve13, reject) => {
|
|
3750
|
+
spawned.on("exit", (exitCode, signal) => {
|
|
3751
|
+
resolve13({ exitCode, signal });
|
|
3752
|
+
});
|
|
3753
|
+
spawned.on("error", (error) => {
|
|
3754
|
+
reject(error);
|
|
3755
|
+
});
|
|
3756
|
+
if (spawned.stdin) {
|
|
3757
|
+
spawned.stdin.on("error", (error) => {
|
|
3758
|
+
reject(error);
|
|
3759
|
+
});
|
|
3760
|
+
}
|
|
3761
|
+
});
|
|
3762
|
+
|
|
3763
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/command.js
|
|
3764
|
+
var import_node_buffer = require("buffer");
|
|
3765
|
+
var import_node_child_process2 = require("child_process");
|
|
3766
|
+
var normalizeArgs = (file, args = []) => {
|
|
3767
|
+
if (!Array.isArray(args)) {
|
|
3768
|
+
return [file];
|
|
3769
|
+
}
|
|
3770
|
+
return [file, ...args];
|
|
3771
|
+
};
|
|
3772
|
+
var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
|
|
3773
|
+
var DOUBLE_QUOTES_REGEXP = /"/g;
|
|
3774
|
+
var escapeArg = (arg) => {
|
|
3775
|
+
if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
|
|
3776
|
+
return arg;
|
|
3777
|
+
}
|
|
3778
|
+
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
|
|
3779
|
+
};
|
|
3780
|
+
var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
|
|
3781
|
+
var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
|
|
3782
|
+
var SPACES_REGEXP = / +/g;
|
|
3783
|
+
var parseCommand = (command) => {
|
|
3784
|
+
const tokens = [];
|
|
3785
|
+
for (const token of command.trim().split(SPACES_REGEXP)) {
|
|
3786
|
+
const previousToken = tokens[tokens.length - 1];
|
|
3787
|
+
if (previousToken && previousToken.endsWith("\\")) {
|
|
3788
|
+
tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
|
|
3789
|
+
} else {
|
|
3790
|
+
tokens.push(token);
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
return tokens;
|
|
3794
|
+
};
|
|
3795
|
+
var parseExpression = (expression) => {
|
|
3796
|
+
const typeOfExpression = typeof expression;
|
|
3797
|
+
if (typeOfExpression === "string") {
|
|
3798
|
+
return expression;
|
|
3799
|
+
}
|
|
3800
|
+
if (typeOfExpression === "number") {
|
|
3801
|
+
return String(expression);
|
|
3802
|
+
}
|
|
3803
|
+
if (typeOfExpression === "object" && expression !== null && !(expression instanceof import_node_child_process2.ChildProcess) && "stdout" in expression) {
|
|
3804
|
+
const typeOfStdout = typeof expression.stdout;
|
|
3805
|
+
if (typeOfStdout === "string") {
|
|
3806
|
+
return expression.stdout;
|
|
3807
|
+
}
|
|
3808
|
+
if (import_node_buffer.Buffer.isBuffer(expression.stdout)) {
|
|
3809
|
+
return expression.stdout.toString();
|
|
3810
|
+
}
|
|
3811
|
+
throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
|
|
3812
|
+
}
|
|
3813
|
+
throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
|
|
3814
|
+
};
|
|
3815
|
+
var concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
|
|
3816
|
+
...tokens.slice(0, -1),
|
|
3817
|
+
`${tokens[tokens.length - 1]}${nextTokens[0]}`,
|
|
3818
|
+
...nextTokens.slice(1)
|
|
3819
|
+
];
|
|
3820
|
+
var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
3821
|
+
const templateString = template ?? templates.raw[index];
|
|
3822
|
+
const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
|
|
3823
|
+
const newTokens = concatTokens(
|
|
3824
|
+
tokens,
|
|
3825
|
+
templateTokens,
|
|
3826
|
+
templateString.startsWith(" ")
|
|
3827
|
+
);
|
|
3828
|
+
if (index === expressions.length) {
|
|
3829
|
+
return newTokens;
|
|
3830
|
+
}
|
|
3831
|
+
const expression = expressions[index];
|
|
3832
|
+
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
|
|
3833
|
+
return concatTokens(
|
|
3834
|
+
newTokens,
|
|
3835
|
+
expressionTokens,
|
|
3836
|
+
templateString.endsWith(" ")
|
|
3837
|
+
);
|
|
3838
|
+
};
|
|
3839
|
+
var parseTemplates = (templates, expressions) => {
|
|
3840
|
+
let tokens = [];
|
|
3841
|
+
for (const [index, template] of templates.entries()) {
|
|
3842
|
+
tokens = parseTemplate({ templates, expressions, tokens, index, template });
|
|
3843
|
+
}
|
|
3844
|
+
return tokens;
|
|
3845
|
+
};
|
|
3846
|
+
|
|
3847
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/lib/verbose.js
|
|
3848
|
+
var import_node_util = require("util");
|
|
3849
|
+
var import_node_process3 = __toESM(require("process"), 1);
|
|
3850
|
+
var verboseDefault = (0, import_node_util.debuglog)("execa").enabled;
|
|
3851
|
+
var padField = (field, padding) => String(field).padStart(padding, "0");
|
|
3852
|
+
var getTimestamp = () => {
|
|
3853
|
+
const date = /* @__PURE__ */ new Date();
|
|
3854
|
+
return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
|
|
3855
|
+
};
|
|
3856
|
+
var logCommand = (escapedCommand, { verbose }) => {
|
|
3857
|
+
if (!verbose) {
|
|
3858
|
+
return;
|
|
3859
|
+
}
|
|
3860
|
+
import_node_process3.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
|
|
3861
|
+
`);
|
|
3862
|
+
};
|
|
3863
|
+
|
|
3864
|
+
// node_modules/.pnpm/execa@7.2.0/node_modules/execa/index.js
|
|
3865
|
+
var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
|
|
3866
|
+
var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
|
3867
|
+
const env = extendEnv ? { ...import_node_process4.default.env, ...envOption } : envOption;
|
|
3868
|
+
if (preferLocal) {
|
|
3869
|
+
return npmRunPathEnv({ env, cwd: localDir, execPath });
|
|
3870
|
+
}
|
|
3871
|
+
return env;
|
|
3872
|
+
};
|
|
3873
|
+
var handleArguments = (file, args, options = {}) => {
|
|
3874
|
+
const parsed = import_cross_spawn.default._parse(file, args, options);
|
|
3875
|
+
file = parsed.command;
|
|
3876
|
+
args = parsed.args;
|
|
3877
|
+
options = parsed.options;
|
|
3878
|
+
options = {
|
|
3879
|
+
maxBuffer: DEFAULT_MAX_BUFFER,
|
|
3880
|
+
buffer: true,
|
|
3881
|
+
stripFinalNewline: true,
|
|
3882
|
+
extendEnv: true,
|
|
3883
|
+
preferLocal: false,
|
|
3884
|
+
localDir: options.cwd || import_node_process4.default.cwd(),
|
|
3885
|
+
execPath: import_node_process4.default.execPath,
|
|
3886
|
+
encoding: "utf8",
|
|
3887
|
+
reject: true,
|
|
3888
|
+
cleanup: true,
|
|
3889
|
+
all: false,
|
|
3890
|
+
windowsHide: true,
|
|
3891
|
+
verbose: verboseDefault,
|
|
3892
|
+
...options
|
|
3893
|
+
};
|
|
3894
|
+
options.env = getEnv(options);
|
|
3895
|
+
options.stdio = normalizeStdio(options);
|
|
3896
|
+
if (import_node_process4.default.platform === "win32" && import_node_path9.default.basename(file, ".exe") === "cmd") {
|
|
3897
|
+
args.unshift("/q");
|
|
3898
|
+
}
|
|
3899
|
+
return { file, args, options, parsed };
|
|
3900
|
+
};
|
|
3901
|
+
var handleOutput = (options, value, error) => {
|
|
3902
|
+
if (typeof value !== "string" && !import_node_buffer2.Buffer.isBuffer(value)) {
|
|
3903
|
+
return error === void 0 ? void 0 : "";
|
|
3904
|
+
}
|
|
3905
|
+
if (options.stripFinalNewline) {
|
|
3906
|
+
return stripFinalNewline(value);
|
|
3907
|
+
}
|
|
3908
|
+
return value;
|
|
3909
|
+
};
|
|
3910
|
+
function execa(file, args, options) {
|
|
3911
|
+
const parsed = handleArguments(file, args, options);
|
|
3912
|
+
const command = joinCommand(file, args);
|
|
3913
|
+
const escapedCommand = getEscapedCommand(file, args);
|
|
3914
|
+
logCommand(escapedCommand, parsed.options);
|
|
3915
|
+
validateTimeout(parsed.options);
|
|
3916
|
+
let spawned;
|
|
3917
|
+
try {
|
|
3918
|
+
spawned = import_node_child_process3.default.spawn(parsed.file, parsed.args, parsed.options);
|
|
3919
|
+
} catch (error) {
|
|
3920
|
+
const dummySpawned = new import_node_child_process3.default.ChildProcess();
|
|
3921
|
+
const errorPromise = Promise.reject(makeError({
|
|
3922
|
+
error,
|
|
3923
|
+
stdout: "",
|
|
3924
|
+
stderr: "",
|
|
3925
|
+
all: "",
|
|
3926
|
+
command,
|
|
3927
|
+
escapedCommand,
|
|
3928
|
+
parsed,
|
|
3929
|
+
timedOut: false,
|
|
3930
|
+
isCanceled: false,
|
|
3931
|
+
killed: false
|
|
3932
|
+
}));
|
|
3933
|
+
mergePromise(dummySpawned, errorPromise);
|
|
3934
|
+
return dummySpawned;
|
|
3935
|
+
}
|
|
3936
|
+
const spawnedPromise = getSpawnedPromise(spawned);
|
|
3937
|
+
const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
|
|
3938
|
+
const processDone = setExitHandler(spawned, parsed.options, timedPromise);
|
|
3939
|
+
const context = { isCanceled: false };
|
|
3940
|
+
spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
|
|
3941
|
+
spawned.cancel = spawnedCancel.bind(null, spawned, context);
|
|
3942
|
+
const handlePromise = async () => {
|
|
3943
|
+
const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
|
|
3944
|
+
const stdout = handleOutput(parsed.options, stdoutResult);
|
|
3945
|
+
const stderr = handleOutput(parsed.options, stderrResult);
|
|
3946
|
+
const all = handleOutput(parsed.options, allResult);
|
|
3947
|
+
if (error || exitCode !== 0 || signal !== null) {
|
|
3948
|
+
const returnedError = makeError({
|
|
3949
|
+
error,
|
|
3950
|
+
exitCode,
|
|
3951
|
+
signal,
|
|
3952
|
+
stdout,
|
|
3953
|
+
stderr,
|
|
3954
|
+
all,
|
|
3955
|
+
command,
|
|
3956
|
+
escapedCommand,
|
|
3957
|
+
parsed,
|
|
3958
|
+
timedOut,
|
|
3959
|
+
isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
|
|
3960
|
+
killed: spawned.killed
|
|
3961
|
+
});
|
|
3962
|
+
if (!parsed.options.reject) {
|
|
3963
|
+
return returnedError;
|
|
3964
|
+
}
|
|
3965
|
+
throw returnedError;
|
|
3966
|
+
}
|
|
3967
|
+
return {
|
|
3968
|
+
command,
|
|
3969
|
+
escapedCommand,
|
|
3970
|
+
exitCode: 0,
|
|
3971
|
+
stdout,
|
|
3972
|
+
stderr,
|
|
3973
|
+
all,
|
|
3974
|
+
failed: false,
|
|
3975
|
+
timedOut: false,
|
|
3976
|
+
isCanceled: false,
|
|
3977
|
+
killed: false
|
|
3978
|
+
};
|
|
3979
|
+
};
|
|
3980
|
+
const handlePromiseOnce = onetime_default(handlePromise);
|
|
3981
|
+
handleInput(spawned, parsed.options);
|
|
3982
|
+
spawned.all = makeAllStream(spawned, parsed.options);
|
|
3983
|
+
addPipeMethods(spawned);
|
|
3984
|
+
mergePromise(spawned, handlePromiseOnce);
|
|
3985
|
+
return spawned;
|
|
3986
|
+
}
|
|
3987
|
+
function execaSync(file, args, options) {
|
|
3988
|
+
const parsed = handleArguments(file, args, options);
|
|
3989
|
+
const command = joinCommand(file, args);
|
|
3990
|
+
const escapedCommand = getEscapedCommand(file, args);
|
|
3991
|
+
logCommand(escapedCommand, parsed.options);
|
|
3992
|
+
const input = handleInputSync(parsed.options);
|
|
3993
|
+
let result;
|
|
3994
|
+
try {
|
|
3995
|
+
result = import_node_child_process3.default.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
|
|
3996
|
+
} catch (error) {
|
|
3997
|
+
throw makeError({
|
|
3998
|
+
error,
|
|
3999
|
+
stdout: "",
|
|
4000
|
+
stderr: "",
|
|
4001
|
+
all: "",
|
|
4002
|
+
command,
|
|
4003
|
+
escapedCommand,
|
|
4004
|
+
parsed,
|
|
4005
|
+
timedOut: false,
|
|
4006
|
+
isCanceled: false,
|
|
4007
|
+
killed: false
|
|
4008
|
+
});
|
|
4009
|
+
}
|
|
4010
|
+
const stdout = handleOutput(parsed.options, result.stdout, result.error);
|
|
4011
|
+
const stderr = handleOutput(parsed.options, result.stderr, result.error);
|
|
4012
|
+
if (result.error || result.status !== 0 || result.signal !== null) {
|
|
4013
|
+
const error = makeError({
|
|
4014
|
+
stdout,
|
|
4015
|
+
stderr,
|
|
4016
|
+
error: result.error,
|
|
4017
|
+
signal: result.signal,
|
|
4018
|
+
exitCode: result.status,
|
|
4019
|
+
command,
|
|
4020
|
+
escapedCommand,
|
|
4021
|
+
parsed,
|
|
4022
|
+
timedOut: result.error && result.error.code === "ETIMEDOUT",
|
|
4023
|
+
isCanceled: false,
|
|
4024
|
+
killed: result.signal !== null
|
|
4025
|
+
});
|
|
4026
|
+
if (!parsed.options.reject) {
|
|
4027
|
+
return error;
|
|
4028
|
+
}
|
|
4029
|
+
throw error;
|
|
4030
|
+
}
|
|
4031
|
+
return {
|
|
4032
|
+
command,
|
|
4033
|
+
escapedCommand,
|
|
4034
|
+
exitCode: 0,
|
|
4035
|
+
stdout,
|
|
4036
|
+
stderr,
|
|
4037
|
+
failed: false,
|
|
4038
|
+
timedOut: false,
|
|
4039
|
+
isCanceled: false,
|
|
4040
|
+
killed: false
|
|
4041
|
+
};
|
|
4042
|
+
}
|
|
4043
|
+
var normalizeScriptStdin = ({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {};
|
|
4044
|
+
var normalizeScriptOptions = (options = {}) => ({
|
|
4045
|
+
preferLocal: true,
|
|
4046
|
+
...normalizeScriptStdin(options),
|
|
4047
|
+
...options
|
|
4048
|
+
});
|
|
4049
|
+
function create$(options) {
|
|
4050
|
+
function $2(templatesOrOptions, ...expressions) {
|
|
4051
|
+
if (!Array.isArray(templatesOrOptions)) {
|
|
4052
|
+
return create$({ ...options, ...templatesOrOptions });
|
|
4053
|
+
}
|
|
4054
|
+
const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
|
|
4055
|
+
return execa(file, args, normalizeScriptOptions(options));
|
|
4056
|
+
}
|
|
4057
|
+
$2.sync = (templates, ...expressions) => {
|
|
4058
|
+
if (!Array.isArray(templates)) {
|
|
4059
|
+
throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
|
|
4060
|
+
}
|
|
4061
|
+
const [file, ...args] = parseTemplates(templates, expressions);
|
|
4062
|
+
return execaSync(file, args, normalizeScriptOptions(options));
|
|
4063
|
+
};
|
|
4064
|
+
return $2;
|
|
4065
|
+
}
|
|
4066
|
+
var $ = create$();
|
|
4067
|
+
function execaCommand(command, options) {
|
|
4068
|
+
const [file, ...args] = parseCommand(command);
|
|
4069
|
+
return execa(file, args, options);
|
|
4070
|
+
}
|
|
4071
|
+
|
|
4072
|
+
// src/core/build.ts
|
|
2086
4073
|
var import_fast_glob3 = __toESM(require("fast-glob"), 1);
|
|
2087
4074
|
async function buildInternal(config) {
|
|
2088
4075
|
const verb = config.command === "serve" ? "Pre-rendering" : "Building";
|
|
@@ -2160,7 +4147,7 @@ async function combineAnalysisStats(config) {
|
|
|
2160
4147
|
absolute: true
|
|
2161
4148
|
});
|
|
2162
4149
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
2163
|
-
|
|
4150
|
+
await execaCommand(
|
|
2164
4151
|
`rollup-plugin-visualizer ${absolutePaths.join(" ")} --template ${config.analysis.template}`,
|
|
2165
4152
|
{ cwd: config.root, stdio: "inherit" }
|
|
2166
4153
|
);
|
|
@@ -2170,12 +4157,12 @@ async function combineAnalysisStats(config) {
|
|
|
2170
4157
|
var vite5 = __toESM(require("vite"), 1);
|
|
2171
4158
|
|
|
2172
4159
|
// src/core/runners/wsl.ts
|
|
2173
|
-
var
|
|
4160
|
+
var import_node_path10 = require("path");
|
|
2174
4161
|
function createWslRunner() {
|
|
2175
4162
|
return {
|
|
2176
4163
|
async openBrowser(config) {
|
|
2177
4164
|
config.logger.warn(
|
|
2178
|
-
`Cannot open browser when using WSL. Load "${(0,
|
|
4165
|
+
`Cannot open browser when using WSL. Load "${(0, import_node_path10.relative)(
|
|
2179
4166
|
process.cwd(),
|
|
2180
4167
|
config.outDir
|
|
2181
4168
|
)}" as an unpacked extension manually`
|
|
@@ -2242,12 +4229,12 @@ var WARN_LOG_LEVEL = 40;
|
|
|
2242
4229
|
var ERROR_LOG_LEVEL = 50;
|
|
2243
4230
|
|
|
2244
4231
|
// src/core/runners/safari.ts
|
|
2245
|
-
var
|
|
4232
|
+
var import_node_path11 = require("path");
|
|
2246
4233
|
function createSafariRunner() {
|
|
2247
4234
|
return {
|
|
2248
4235
|
async openBrowser(config) {
|
|
2249
4236
|
config.logger.warn(
|
|
2250
|
-
`Cannot Safari using web-ext. Load "${(0,
|
|
4237
|
+
`Cannot Safari using web-ext. Load "${(0, import_node_path11.relative)(
|
|
2251
4238
|
process.cwd(),
|
|
2252
4239
|
config.outDir
|
|
2253
4240
|
)}" as an unpacked extension manually`
|
|
@@ -2300,8 +4287,8 @@ async function setupServer(serverInfo, config) {
|
|
|
2300
4287
|
const reloadExtension = () => {
|
|
2301
4288
|
viteServer.ws.send("wxt:reload-extension");
|
|
2302
4289
|
};
|
|
2303
|
-
const reloadPage = (
|
|
2304
|
-
viteServer.ws.send("wxt:reload-page",
|
|
4290
|
+
const reloadPage = (path9) => {
|
|
4291
|
+
viteServer.ws.send("wxt:reload-page", path9);
|
|
2305
4292
|
};
|
|
2306
4293
|
const reloadContentScript = (contentScript) => {
|
|
2307
4294
|
viteServer.ws.send("wxt:reload-content-script", contentScript);
|
|
@@ -2335,8 +4322,9 @@ function reloadContentScripts(steps, config, server) {
|
|
|
2335
4322
|
return;
|
|
2336
4323
|
const js = [getEntrypointBundlePath(entry, config.outDir, ".js")];
|
|
2337
4324
|
const css = getContentScriptCssFiles([entry], server.currentOutput);
|
|
4325
|
+
const { include: _1, exclude: _2, ...options } = entry.options;
|
|
2338
4326
|
server.reloadContentScript({
|
|
2339
|
-
...
|
|
4327
|
+
...options,
|
|
2340
4328
|
js,
|
|
2341
4329
|
css
|
|
2342
4330
|
});
|
|
@@ -2347,13 +4335,13 @@ function reloadContentScripts(steps, config, server) {
|
|
|
2347
4335
|
}
|
|
2348
4336
|
function reloadHtmlPages(groups, server, config) {
|
|
2349
4337
|
groups.flat().forEach((entry) => {
|
|
2350
|
-
const
|
|
2351
|
-
server.reloadPage(
|
|
4338
|
+
const path9 = getEntrypointBundlePath(entry, config.outDir, ".html");
|
|
4339
|
+
server.reloadPage(path9);
|
|
2352
4340
|
});
|
|
2353
4341
|
}
|
|
2354
4342
|
|
|
2355
4343
|
// src/core/clean.ts
|
|
2356
|
-
var
|
|
4344
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
2357
4345
|
var import_fast_glob4 = __toESM(require("fast-glob"), 1);
|
|
2358
4346
|
var import_fs_extra15 = __toESM(require("fs-extra"), 1);
|
|
2359
4347
|
var import_consola2 = require("consola");
|
|
@@ -2368,7 +4356,7 @@ async function clean(root = process.cwd()) {
|
|
|
2368
4356
|
];
|
|
2369
4357
|
import_consola2.consola.debug("Looking for:", tempDirs.map(import_picocolors4.default.cyan).join(", "));
|
|
2370
4358
|
const directories = await (0, import_fast_glob4.default)(tempDirs, {
|
|
2371
|
-
cwd:
|
|
4359
|
+
cwd: import_node_path12.default.resolve(root),
|
|
2372
4360
|
absolute: true,
|
|
2373
4361
|
onlyDirectories: true,
|
|
2374
4362
|
deep: 2
|
|
@@ -2379,16 +4367,16 @@ async function clean(root = process.cwd()) {
|
|
|
2379
4367
|
}
|
|
2380
4368
|
import_consola2.consola.debug(
|
|
2381
4369
|
"Found:",
|
|
2382
|
-
directories.map((dir) => import_picocolors4.default.cyan(
|
|
4370
|
+
directories.map((dir) => import_picocolors4.default.cyan(import_node_path12.default.relative(root, dir))).join(", ")
|
|
2383
4371
|
);
|
|
2384
4372
|
for (const directory of directories) {
|
|
2385
4373
|
await import_fs_extra15.default.rm(directory, { force: true, recursive: true });
|
|
2386
|
-
import_consola2.consola.debug("Deleted " + import_picocolors4.default.cyan(
|
|
4374
|
+
import_consola2.consola.debug("Deleted " + import_picocolors4.default.cyan(import_node_path12.default.relative(root, directory)));
|
|
2387
4375
|
}
|
|
2388
4376
|
}
|
|
2389
4377
|
|
|
2390
4378
|
// package.json
|
|
2391
|
-
var version2 = "0.6.
|
|
4379
|
+
var version2 = "0.6.4";
|
|
2392
4380
|
|
|
2393
4381
|
// src/core/utils/defineConfig.ts
|
|
2394
4382
|
function defineConfig(config) {
|
|
@@ -2424,10 +4412,10 @@ async function createServer2(config) {
|
|
|
2424
4412
|
server.ws.on("wxt:background-initialized", () => {
|
|
2425
4413
|
reloadContentScripts(server.currentOutput.steps, internalConfig, server);
|
|
2426
4414
|
});
|
|
2427
|
-
server.watcher.on("all", async (event,
|
|
2428
|
-
if (
|
|
4415
|
+
server.watcher.on("all", async (event, path9, _stats) => {
|
|
4416
|
+
if (path9.startsWith(internalConfig.outBaseDir))
|
|
2429
4417
|
return;
|
|
2430
|
-
changeQueue.push([event,
|
|
4418
|
+
changeQueue.push([event, path9]);
|
|
2431
4419
|
await fileChangedMutex.runExclusive(async () => {
|
|
2432
4420
|
const fileChanges = changeQueue.splice(0, changeQueue.length);
|
|
2433
4421
|
if (fileChanges.length === 0)
|
|
@@ -2436,11 +4424,11 @@ async function createServer2(config) {
|
|
|
2436
4424
|
if (changes.type === "no-change")
|
|
2437
4425
|
return;
|
|
2438
4426
|
internalConfig.logger.info(
|
|
2439
|
-
`Changed: ${Array.from(new Set(fileChanges.map((change) => change[1]))).map((file) => import_picocolors5.default.dim((0,
|
|
4427
|
+
`Changed: ${Array.from(new Set(fileChanges.map((change) => change[1]))).map((file) => import_picocolors5.default.dim((0, import_node_path13.relative)(internalConfig.root, file))).join(", ")}`
|
|
2440
4428
|
);
|
|
2441
4429
|
const rebuiltNames = changes.rebuildGroups.flat().map((entry) => {
|
|
2442
4430
|
return import_picocolors5.default.cyan(
|
|
2443
|
-
(0,
|
|
4431
|
+
(0, import_node_path13.relative)(internalConfig.outDir, getEntrypointOutputFile(entry, ""))
|
|
2444
4432
|
);
|
|
2445
4433
|
}).join(import_picocolors5.default.dim(", "));
|
|
2446
4434
|
internalConfig = await getLatestInternalConfig();
|