nitro 3.0.260522-beta → 3.0.260610-beta
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/THIRD-PARTY-LICENSES.md.gz +0 -0
- package/dist/_build/common.mjs +38 -21
- package/dist/_build/rolldown.mjs +6 -2
- package/dist/_build/vite.env.mjs +5 -37
- package/dist/_chunks/nitro.mjs +23 -8
- package/dist/_libs/commondir+is-reference.mjs +2 -2
- package/dist/_libs/httpxy.d.mts +1 -0
- package/dist/_libs/nypm+tinyexec.mjs +135 -412
- package/dist/_libs/{jsonc-parser+workers-utils.d.mts → undici+jsonc-parser.d.mts} +867 -6
- package/dist/_presets.mjs +14 -0
- package/dist/docs/0.docs/4.server-entry.md +1 -1
- package/dist/docs/2.config/0.index/index.md +14 -0
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +1 -1
- package/dist/presets/vercel/runtime/vercel.node.mjs +9 -1
- package/dist/presets/vercel/runtime/vercel.web.mjs +12 -1
- package/dist/runtime/internal/vite/dev-worker.mjs +14 -14
- package/dist/runtime/virtual/_runtime_warn.mjs +2 -1
- package/dist/runtime/virtual/vite-services.d.mts +5 -0
- package/dist/runtime/virtual/vite-services.mjs +1 -0
- package/dist/runtime/vite.d.mts +0 -7
- package/dist/runtime/vite.mjs +2 -2
- package/dist/types/index.d.mts +31 -1
- package/dist/vite.mjs +76 -58
- package/package.json +39 -39
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
import { __exportAll } from "../_common.mjs";
|
|
2
2
|
import { join as join$1, normalize as normalize$1, resolve as resolve$1 } from "../_build/common.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
-
import { existsSync } from "node:fs";
|
|
4
|
+
import { closeSync, existsSync, openSync, readSync, statSync } from "node:fs";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
6
|
-
import { delimiter, dirname, join, resolve } from "node:path";
|
|
6
|
+
import { basename, delimiter, dirname, join, normalize, resolve } from "node:path";
|
|
7
7
|
import { cwd } from "node:process";
|
|
8
8
|
import { PassThrough } from "node:stream";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
10
10
|
import { pipeline } from "node:stream/promises";
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const f = /^path$/i;
|
|
15
|
-
const p = {
|
|
11
|
+
import u from "node:readline";
|
|
12
|
+
const h = /^path$/i;
|
|
13
|
+
const g = {
|
|
16
14
|
key: "PATH",
|
|
17
15
|
value: ""
|
|
18
16
|
};
|
|
19
|
-
function
|
|
17
|
+
function _(e) {
|
|
20
18
|
for (const t in e) {
|
|
21
|
-
if (!Object.prototype.hasOwnProperty.call(e, t) || !
|
|
19
|
+
if (!Object.prototype.hasOwnProperty.call(e, t) || !h.test(t)) continue;
|
|
22
20
|
const n = e[t];
|
|
23
|
-
if (!n) return
|
|
21
|
+
if (!n) return g;
|
|
24
22
|
return {
|
|
25
23
|
key: t,
|
|
26
24
|
value: n
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
|
-
return
|
|
27
|
+
return g;
|
|
30
28
|
}
|
|
31
|
-
function
|
|
29
|
+
function v(e, t) {
|
|
32
30
|
const n = t.value.split(delimiter);
|
|
33
31
|
const r = [];
|
|
34
|
-
let
|
|
32
|
+
let o = e;
|
|
35
33
|
let c;
|
|
36
34
|
do {
|
|
37
|
-
r.push(resolve(
|
|
38
|
-
c =
|
|
39
|
-
|
|
40
|
-
} while (
|
|
35
|
+
r.push(resolve(o, "node_modules", ".bin"));
|
|
36
|
+
c = o;
|
|
37
|
+
o = dirname(o);
|
|
38
|
+
} while (o !== c);
|
|
41
39
|
r.push(dirname(process.execPath));
|
|
42
40
|
const l = r.concat(n).join(delimiter);
|
|
43
41
|
return {
|
|
@@ -45,16 +43,17 @@ function h(e, t) {
|
|
|
45
43
|
value: l
|
|
46
44
|
};
|
|
47
45
|
}
|
|
48
|
-
function
|
|
49
|
-
const
|
|
46
|
+
function y(e, t, n = true) {
|
|
47
|
+
const r = {
|
|
50
48
|
...process.env,
|
|
51
49
|
...t
|
|
52
50
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
if (!n) return r;
|
|
52
|
+
const i = v(e, _(r));
|
|
53
|
+
r[i.key] = i.value;
|
|
54
|
+
return r;
|
|
56
55
|
}
|
|
57
|
-
const
|
|
56
|
+
const b = (e) => {
|
|
58
57
|
let t = e.length;
|
|
59
58
|
const n = new PassThrough();
|
|
60
59
|
const r = () => {
|
|
@@ -63,377 +62,101 @@ const _ = (e) => {
|
|
|
63
62
|
for (const t of e) pipeline(t, n, { end: false }).then(r).catch(r);
|
|
64
63
|
return n;
|
|
65
64
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (!e.isSymbolicLink() && !e.isFile()) return false;
|
|
83
|
-
return r(t, n);
|
|
84
|
-
}
|
|
85
|
-
function a(e, t, r) {
|
|
86
|
-
n.stat(e, function(n, a) {
|
|
87
|
-
r(n, n ? false : i(a, e, t));
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function o(e, t) {
|
|
91
|
-
return i(n.statSync(e), e, t);
|
|
92
|
-
}
|
|
93
|
-
}));
|
|
94
|
-
var y = /* @__PURE__ */ u(((e, t) => {
|
|
95
|
-
t.exports = r;
|
|
96
|
-
r.sync = i;
|
|
97
|
-
var n = d("fs");
|
|
98
|
-
function r(e, t, r) {
|
|
99
|
-
n.stat(e, function(e, n) {
|
|
100
|
-
r(e, e ? false : a(n, t));
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function i(e, t) {
|
|
104
|
-
return a(n.statSync(e), t);
|
|
105
|
-
}
|
|
106
|
-
function a(e, t) {
|
|
107
|
-
return e.isFile() && o(e, t);
|
|
108
|
-
}
|
|
109
|
-
function o(e, t) {
|
|
110
|
-
var n = e.mode;
|
|
111
|
-
var r = e.uid;
|
|
112
|
-
var i = e.gid;
|
|
113
|
-
var a = t.uid !== void 0 ? t.uid : process.getuid && process.getuid();
|
|
114
|
-
var o = t.gid !== void 0 ? t.gid : process.getgid && process.getgid();
|
|
115
|
-
var s = parseInt("100", 8);
|
|
116
|
-
var c = parseInt("010", 8);
|
|
117
|
-
var l = parseInt("001", 8);
|
|
118
|
-
var u = s | c;
|
|
119
|
-
return n & l || n & c && i === o || n & s && r === a || n & u && a === 0;
|
|
120
|
-
}
|
|
121
|
-
}));
|
|
122
|
-
var b = /* @__PURE__ */ u(((e, t) => {
|
|
123
|
-
d("fs");
|
|
124
|
-
var n;
|
|
125
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) n = v();
|
|
126
|
-
else n = y();
|
|
127
|
-
t.exports = r;
|
|
128
|
-
r.sync = i;
|
|
129
|
-
function r(e, t, i) {
|
|
130
|
-
if (typeof t === "function") {
|
|
131
|
-
i = t;
|
|
132
|
-
t = {};
|
|
133
|
-
}
|
|
134
|
-
if (!i) {
|
|
135
|
-
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
136
|
-
return new Promise(function(n, i) {
|
|
137
|
-
r(e, t || {}, function(e, t) {
|
|
138
|
-
if (e) i(e);
|
|
139
|
-
else n(t);
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
n(e, t || {}, function(e, n) {
|
|
144
|
-
if (e) {
|
|
145
|
-
if (e.code === "EACCES" || t && t.ignoreErrors) {
|
|
146
|
-
e = null;
|
|
147
|
-
n = false;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
i(e, n);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function i(e, t) {
|
|
154
|
-
try {
|
|
155
|
-
return n.sync(e, t || {});
|
|
156
|
-
} catch (e) {
|
|
157
|
-
if (t && t.ignoreErrors || e.code === "EACCES") return false;
|
|
158
|
-
else throw e;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}));
|
|
162
|
-
var x = /* @__PURE__ */ u(((e, t) => {
|
|
163
|
-
const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
164
|
-
const r = d("path");
|
|
165
|
-
const i = n ? ";" : ":";
|
|
166
|
-
const a = b();
|
|
167
|
-
const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
|
|
168
|
-
const s = (e, t) => {
|
|
169
|
-
const r = t.colon || i;
|
|
170
|
-
const a = e.match(/\//) || n && e.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t.path || process.env.PATH || "").split(r)];
|
|
171
|
-
const o = n ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
172
|
-
const s = n ? o.split(r) : [""];
|
|
173
|
-
if (n) {
|
|
174
|
-
if (e.indexOf(".") !== -1 && s[0] !== "") s.unshift("");
|
|
175
|
-
}
|
|
176
|
-
return {
|
|
177
|
-
pathEnv: a,
|
|
178
|
-
pathExt: s,
|
|
179
|
-
pathExtExe: o
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
const c = (e, t, n) => {
|
|
183
|
-
if (typeof t === "function") {
|
|
184
|
-
n = t;
|
|
185
|
-
t = {};
|
|
186
|
-
}
|
|
187
|
-
if (!t) t = {};
|
|
188
|
-
const { pathEnv: i, pathExt: c, pathExtExe: l } = s(e, t);
|
|
189
|
-
const u = [];
|
|
190
|
-
const d = (n) => new Promise((a, s) => {
|
|
191
|
-
if (n === i.length) return t.all && u.length ? a(u) : s(o(e));
|
|
192
|
-
const c = i[n];
|
|
193
|
-
const l = /^".*"$/.test(c) ? c.slice(1, -1) : c;
|
|
194
|
-
const d = r.join(l, e);
|
|
195
|
-
a(f(!l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d, n, 0));
|
|
196
|
-
});
|
|
197
|
-
const f = (e, n, r) => new Promise((i, o) => {
|
|
198
|
-
if (r === c.length) return i(d(n + 1));
|
|
199
|
-
const s = c[r];
|
|
200
|
-
a(e + s, { pathExt: l }, (a, o) => {
|
|
201
|
-
if (!a && o) if (t.all) u.push(e + s);
|
|
202
|
-
else return i(e + s);
|
|
203
|
-
return i(f(e, n, r + 1));
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
return n ? d(0).then((e) => n(null, e), n) : d(0);
|
|
207
|
-
};
|
|
208
|
-
const l = (e, t) => {
|
|
209
|
-
t = t || {};
|
|
210
|
-
const { pathEnv: n, pathExt: i, pathExtExe: c } = s(e, t);
|
|
211
|
-
const l = [];
|
|
212
|
-
for (let o = 0; o < n.length; o++) {
|
|
213
|
-
const s = n[o];
|
|
214
|
-
const u = /^".*"$/.test(s) ? s.slice(1, -1) : s;
|
|
215
|
-
const d = r.join(u, e);
|
|
216
|
-
const f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
|
|
217
|
-
for (let e = 0; e < i.length; e++) {
|
|
218
|
-
const n = f + i[e];
|
|
219
|
-
try {
|
|
220
|
-
if (a.sync(n, { pathExt: c })) if (t.all) l.push(n);
|
|
221
|
-
else return n;
|
|
222
|
-
} catch (e) {}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (t.all && l.length) return l;
|
|
226
|
-
if (t.nothrow) return null;
|
|
227
|
-
throw o(e);
|
|
228
|
-
};
|
|
229
|
-
t.exports = c;
|
|
230
|
-
c.sync = l;
|
|
231
|
-
}));
|
|
232
|
-
var S = /* @__PURE__ */ u(((e, t) => {
|
|
233
|
-
const n = (e = {}) => {
|
|
234
|
-
const t = e.env || process.env;
|
|
235
|
-
if ((e.platform || process.platform) !== "win32") return "PATH";
|
|
236
|
-
return Object.keys(t).reverse().find((e) => e.toUpperCase() === "PATH") || "Path";
|
|
237
|
-
};
|
|
238
|
-
t.exports = n;
|
|
239
|
-
t.exports.default = n;
|
|
240
|
-
}));
|
|
241
|
-
var C = /* @__PURE__ */ u(((e, t) => {
|
|
242
|
-
const n = d("path");
|
|
243
|
-
const r = x();
|
|
244
|
-
const i = S();
|
|
245
|
-
function a(e, t) {
|
|
246
|
-
const a = e.options.env || process.env;
|
|
247
|
-
const o = process.cwd();
|
|
248
|
-
const s = e.options.cwd != null;
|
|
249
|
-
const c = s && process.chdir !== void 0 && !process.chdir.disabled;
|
|
250
|
-
if (c) try {
|
|
251
|
-
process.chdir(e.options.cwd);
|
|
252
|
-
} catch (e) {}
|
|
253
|
-
let l;
|
|
254
|
-
try {
|
|
255
|
-
l = r.sync(e.command, {
|
|
256
|
-
path: a[i({ env: a })],
|
|
257
|
-
pathExt: t ? n.delimiter : void 0
|
|
258
|
-
});
|
|
259
|
-
} catch (e) {} finally {
|
|
260
|
-
if (c) process.chdir(o);
|
|
261
|
-
}
|
|
262
|
-
if (l) l = n.resolve(s ? e.options.cwd : "", l);
|
|
263
|
-
return l;
|
|
264
|
-
}
|
|
265
|
-
function o(e) {
|
|
266
|
-
return a(e) || a(e, true);
|
|
267
|
-
}
|
|
268
|
-
t.exports = o;
|
|
269
|
-
}));
|
|
270
|
-
var w = /* @__PURE__ */ u(((e, t) => {
|
|
271
|
-
const n = /([()\][%!^"`<>&|;, *?])/g;
|
|
272
|
-
function r(e) {
|
|
273
|
-
e = e.replace(n, "^$1");
|
|
274
|
-
return e;
|
|
275
|
-
}
|
|
276
|
-
function i(e, t) {
|
|
277
|
-
e = `${e}`;
|
|
278
|
-
e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
279
|
-
e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
280
|
-
e = `"${e}"`;
|
|
281
|
-
e = e.replace(n, "^$1");
|
|
282
|
-
if (t) e = e.replace(n, "^$1");
|
|
283
|
-
return e;
|
|
284
|
-
}
|
|
285
|
-
t.exports.command = r;
|
|
286
|
-
t.exports.argument = i;
|
|
287
|
-
}));
|
|
288
|
-
var T = /* @__PURE__ */ u(((e, t) => {
|
|
289
|
-
t.exports = /^#!(.*)/;
|
|
290
|
-
}));
|
|
291
|
-
var E = /* @__PURE__ */ u(((e, t) => {
|
|
292
|
-
const n = T();
|
|
293
|
-
t.exports = (e = "") => {
|
|
294
|
-
const t = e.match(n);
|
|
295
|
-
if (!t) return null;
|
|
296
|
-
const [r, i] = t[0].replace(/#! ?/, "").split(" ");
|
|
297
|
-
const a = r.split("/").pop();
|
|
298
|
-
if (a === "env") return i;
|
|
299
|
-
return i ? `${a} ${i}` : a;
|
|
65
|
+
const x = /([()\][%!^"`<>&|;, *?])/g;
|
|
66
|
+
const S = /^#!\s*(.+)/;
|
|
67
|
+
const C = /\.(?:com|exe)$/i;
|
|
68
|
+
const w = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
|
|
69
|
+
const T = process.platform === "win32";
|
|
70
|
+
const E = [
|
|
71
|
+
".EXE",
|
|
72
|
+
".CMD",
|
|
73
|
+
".BAT",
|
|
74
|
+
".COM"
|
|
75
|
+
];
|
|
76
|
+
function D(e, t = [], n = {}) {
|
|
77
|
+
if (n.shell === true || !T) return {
|
|
78
|
+
command: e,
|
|
79
|
+
args: t,
|
|
80
|
+
options: n
|
|
300
81
|
};
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const i = Buffer.alloc(t);
|
|
308
|
-
let a;
|
|
82
|
+
let i = O(e, n);
|
|
83
|
+
let a = null;
|
|
84
|
+
if (i !== null) {
|
|
85
|
+
const e = 150;
|
|
86
|
+
const t = Buffer.alloc(e);
|
|
87
|
+
let n = null;
|
|
309
88
|
try {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
return r(i.toString());
|
|
315
|
-
}
|
|
316
|
-
t.exports = i;
|
|
317
|
-
}));
|
|
318
|
-
var O = /* @__PURE__ */ u(((e, t) => {
|
|
319
|
-
const n = d("path");
|
|
320
|
-
const r = C();
|
|
321
|
-
const i = w();
|
|
322
|
-
const a = D();
|
|
323
|
-
const o = process.platform === "win32";
|
|
324
|
-
const s = /\.(?:com|exe)$/i;
|
|
325
|
-
const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
326
|
-
function l(e) {
|
|
327
|
-
e.file = r(e);
|
|
328
|
-
const t = e.file && a(e.file);
|
|
329
|
-
if (t) {
|
|
330
|
-
e.args.unshift(e.file);
|
|
331
|
-
e.command = t;
|
|
332
|
-
return r(e);
|
|
333
|
-
}
|
|
334
|
-
return e.file;
|
|
335
|
-
}
|
|
336
|
-
function u(e) {
|
|
337
|
-
if (!o) return e;
|
|
338
|
-
const t = l(e);
|
|
339
|
-
const r = !s.test(t);
|
|
340
|
-
if (e.options.forceShell || r) {
|
|
341
|
-
const r = c.test(t);
|
|
342
|
-
e.command = n.normalize(e.command);
|
|
343
|
-
e.command = i.command(e.command);
|
|
344
|
-
e.args = e.args.map((e) => i.argument(e, r));
|
|
345
|
-
e.args = [
|
|
346
|
-
"/d",
|
|
347
|
-
"/s",
|
|
348
|
-
"/c",
|
|
349
|
-
`"${[e.command].concat(e.args).join(" ")}"`
|
|
350
|
-
];
|
|
351
|
-
e.command = process.env.comspec || "cmd.exe";
|
|
352
|
-
e.options.windowsVerbatimArguments = true;
|
|
89
|
+
n = openSync(i, "r");
|
|
90
|
+
readSync(n, t, 0, e, 0);
|
|
91
|
+
} catch {} finally {
|
|
92
|
+
if (n !== null) closeSync(n);
|
|
353
93
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
n = t;
|
|
359
|
-
|
|
94
|
+
const o = t.toString().match(S);
|
|
95
|
+
if (o !== null) {
|
|
96
|
+
const e = o[1].trim();
|
|
97
|
+
const t = e.indexOf(" ");
|
|
98
|
+
const n = t !== -1 ? e.slice(0, t) : e;
|
|
99
|
+
const i = t !== -1 ? e.slice(t + 1) : "";
|
|
100
|
+
const s = basename(n);
|
|
101
|
+
a = s === "env" ? i || null : s;
|
|
360
102
|
}
|
|
361
|
-
t = t ? t.slice(0) : [];
|
|
362
|
-
n = Object.assign({}, n);
|
|
363
|
-
const r = {
|
|
364
|
-
command: e,
|
|
365
|
-
args: t,
|
|
366
|
-
options: n,
|
|
367
|
-
file: void 0,
|
|
368
|
-
original: {
|
|
369
|
-
command: e,
|
|
370
|
-
args: t
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
return n.shell ? r : u(r);
|
|
374
103
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
104
|
+
if (a !== null && i !== null) {
|
|
105
|
+
t = [i, ...t];
|
|
106
|
+
e = a;
|
|
107
|
+
i = O(e, n);
|
|
108
|
+
}
|
|
109
|
+
if (i === null || !C.test(i)) {
|
|
110
|
+
const r = i !== null && w.test(i);
|
|
111
|
+
e = normalize(e);
|
|
112
|
+
e = e.replace(x, "^$1");
|
|
113
|
+
t = t.map((e) => {
|
|
114
|
+
e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
115
|
+
e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
116
|
+
e = `"${e}"`;
|
|
117
|
+
e = e.replace(x, "^$1");
|
|
118
|
+
if (r) e = e.replace(x, "^$1");
|
|
119
|
+
return e;
|
|
386
120
|
});
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
121
|
+
t = [
|
|
122
|
+
"/d",
|
|
123
|
+
"/s",
|
|
124
|
+
"/c",
|
|
125
|
+
`"${[e, ...t].join(" ")}"`
|
|
126
|
+
];
|
|
127
|
+
e = n.env?.comspec ?? "cmd.exe";
|
|
128
|
+
n = {
|
|
129
|
+
...n,
|
|
130
|
+
windowsVerbatimArguments: true
|
|
397
131
|
};
|
|
398
132
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
function o(e, t) {
|
|
404
|
-
if (n && e === 1 && !t.file) return r(t.original, "spawnSync");
|
|
405
|
-
return null;
|
|
406
|
-
}
|
|
407
|
-
t.exports = {
|
|
408
|
-
hookChildProcess: i,
|
|
409
|
-
verifyENOENT: a,
|
|
410
|
-
verifyENOENTSync: o,
|
|
411
|
-
notFoundError: r
|
|
133
|
+
return {
|
|
134
|
+
command: e,
|
|
135
|
+
args: t,
|
|
136
|
+
options: n
|
|
412
137
|
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
const
|
|
416
|
-
const
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
138
|
+
}
|
|
139
|
+
function O(e, t) {
|
|
140
|
+
const r = (t.cwd ?? cwd()).toString();
|
|
141
|
+
const a = t.env ?? process.env;
|
|
142
|
+
const o = _(a).value;
|
|
143
|
+
const c = e.includes("/") || e.includes("\\") ? [""] : [r, ...o.split(delimiter)];
|
|
144
|
+
const l = a.PATHEXT ? a.PATHEXT.split(delimiter) : E;
|
|
145
|
+
if (e.includes(".") && l[0] !== "") l.unshift("");
|
|
146
|
+
for (const t of c) {
|
|
147
|
+
const n = resolve(r, t.startsWith("\"") && t.endsWith("\"") && t.length > 1 ? t.slice(1, -1) : t, e);
|
|
148
|
+
for (const e of l) {
|
|
149
|
+
const t = n + e;
|
|
150
|
+
try {
|
|
151
|
+
if (statSync(t).isFile()) return t;
|
|
152
|
+
} catch {}
|
|
153
|
+
}
|
|
429
154
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
})))();
|
|
436
|
-
var M = class extends Error {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
var k = class extends Error {
|
|
158
|
+
result;
|
|
159
|
+
output;
|
|
437
160
|
get exitCode() {
|
|
438
161
|
if (this.result.exitCode !== null) return this.result.exitCode;
|
|
439
162
|
}
|
|
@@ -443,12 +166,12 @@ var M = class extends Error {
|
|
|
443
166
|
this.output = t;
|
|
444
167
|
}
|
|
445
168
|
};
|
|
446
|
-
const
|
|
169
|
+
const j = {
|
|
447
170
|
timeout: void 0,
|
|
448
171
|
persist: false
|
|
449
172
|
};
|
|
450
|
-
const
|
|
451
|
-
function
|
|
173
|
+
const N = { windowsHide: true };
|
|
174
|
+
function P(e) {
|
|
452
175
|
const t = new AbortController();
|
|
453
176
|
for (const n of e) {
|
|
454
177
|
if (n.aborted) {
|
|
@@ -462,14 +185,14 @@ function L(e) {
|
|
|
462
185
|
}
|
|
463
186
|
return t.signal;
|
|
464
187
|
}
|
|
465
|
-
async function
|
|
188
|
+
async function F(e) {
|
|
466
189
|
let t = "";
|
|
467
190
|
try {
|
|
468
191
|
for await (const n of e) t += n.toString();
|
|
469
192
|
} catch {}
|
|
470
193
|
return t;
|
|
471
194
|
}
|
|
472
|
-
var
|
|
195
|
+
var I = class {
|
|
473
196
|
_process;
|
|
474
197
|
_aborted = false;
|
|
475
198
|
_options;
|
|
@@ -489,7 +212,7 @@ var z = class {
|
|
|
489
212
|
}
|
|
490
213
|
constructor(e, t, n) {
|
|
491
214
|
this._options = {
|
|
492
|
-
...
|
|
215
|
+
...j,
|
|
493
216
|
...n
|
|
494
217
|
};
|
|
495
218
|
this._command = e;
|
|
@@ -508,7 +231,7 @@ var z = class {
|
|
|
508
231
|
return this._process?.killed === true;
|
|
509
232
|
}
|
|
510
233
|
pipe(e, t, n) {
|
|
511
|
-
return
|
|
234
|
+
return z(e, t, {
|
|
512
235
|
...n,
|
|
513
236
|
stdin: this
|
|
514
237
|
});
|
|
@@ -519,18 +242,18 @@ var z = class {
|
|
|
519
242
|
const t = [];
|
|
520
243
|
if (this._streamErr) t.push(this._streamErr);
|
|
521
244
|
if (this._streamOut) t.push(this._streamOut);
|
|
522
|
-
const n =
|
|
523
|
-
const r =
|
|
245
|
+
const n = b(t);
|
|
246
|
+
const r = u.createInterface({ input: n });
|
|
524
247
|
for await (const e of r) yield e.toString();
|
|
525
248
|
await this._processClosed;
|
|
526
249
|
e.removeAllListeners();
|
|
527
250
|
if (this._thrownError) throw this._thrownError;
|
|
528
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
251
|
+
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new k(this);
|
|
529
252
|
}
|
|
530
253
|
async _waitForOutput() {
|
|
531
254
|
const e = this._process;
|
|
532
255
|
if (!e) throw new Error("No process was started");
|
|
533
|
-
const [t, n] = await Promise.all([this._streamOut ?
|
|
256
|
+
const [t, n] = await Promise.all([this._streamOut ? F(this._streamOut) : "", this._streamErr ? F(this._streamErr) : ""]);
|
|
534
257
|
await this._processClosed;
|
|
535
258
|
const { stdin: r } = this._options;
|
|
536
259
|
if (r && typeof r !== "string") await r;
|
|
@@ -541,7 +264,7 @@ var z = class {
|
|
|
541
264
|
stdout: t,
|
|
542
265
|
exitCode: this.exitCode
|
|
543
266
|
};
|
|
544
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
267
|
+
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new k(this, i);
|
|
545
268
|
return i;
|
|
546
269
|
}
|
|
547
270
|
then(e, t) {
|
|
@@ -550,20 +273,20 @@ var z = class {
|
|
|
550
273
|
_streamOut;
|
|
551
274
|
_streamErr;
|
|
552
275
|
spawn() {
|
|
553
|
-
const
|
|
554
|
-
const
|
|
276
|
+
const t = cwd();
|
|
277
|
+
const r = this._options;
|
|
555
278
|
const i = {
|
|
556
|
-
...
|
|
557
|
-
...
|
|
279
|
+
...N,
|
|
280
|
+
...r.nodeOptions
|
|
558
281
|
};
|
|
559
282
|
const a = [];
|
|
560
283
|
this._resetState();
|
|
561
|
-
if (
|
|
562
|
-
if (
|
|
563
|
-
if (
|
|
564
|
-
if (a.length > 0) i.signal =
|
|
565
|
-
i.env =
|
|
566
|
-
const o = (
|
|
284
|
+
if (r.timeout !== void 0) a.push(AbortSignal.timeout(r.timeout));
|
|
285
|
+
if (r.signal !== void 0) a.push(r.signal);
|
|
286
|
+
if (r.persist === true) i.detached = true;
|
|
287
|
+
if (a.length > 0) i.signal = P(a);
|
|
288
|
+
i.env = y(t, i.env, r.nodePath);
|
|
289
|
+
const o = D(this._command, this._args, i);
|
|
567
290
|
const s = spawn(o.command, o.args, o.options);
|
|
568
291
|
if (s.stderr) this._streamErr = s.stderr;
|
|
569
292
|
if (s.stdout) this._streamOut = s.stdout;
|
|
@@ -571,7 +294,7 @@ var z = class {
|
|
|
571
294
|
s.once("error", this._onError);
|
|
572
295
|
s.once("close", this._onClose);
|
|
573
296
|
if (s.stdin) {
|
|
574
|
-
const { stdin: e } =
|
|
297
|
+
const { stdin: e } = r;
|
|
575
298
|
if (typeof e === "string") s.stdin.end(e);
|
|
576
299
|
else e?.process?.stdout?.pipe(s.stdin);
|
|
577
300
|
}
|
|
@@ -594,12 +317,12 @@ var z = class {
|
|
|
594
317
|
if (this._resolveClose) this._resolveClose();
|
|
595
318
|
};
|
|
596
319
|
};
|
|
597
|
-
const
|
|
598
|
-
const r = new
|
|
320
|
+
const R = (e, t, n) => {
|
|
321
|
+
const r = new I(e, t, n);
|
|
599
322
|
r.spawn();
|
|
600
323
|
return r;
|
|
601
324
|
};
|
|
602
|
-
const
|
|
325
|
+
const z = R;
|
|
603
326
|
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
604
327
|
addDependency: () => addDependency,
|
|
605
328
|
addDevDependency: () => addDevDependency,
|
|
@@ -654,7 +377,7 @@ function cached(fn) {
|
|
|
654
377
|
const hasCorepack = cached(async () => {
|
|
655
378
|
if (globalThis.process?.versions?.webcontainer) return false;
|
|
656
379
|
try {
|
|
657
|
-
const { exitCode } = await
|
|
380
|
+
const { exitCode } = await R("corepack", ["--version"]);
|
|
658
381
|
return exitCode === 0;
|
|
659
382
|
} catch {
|
|
660
383
|
return false;
|
|
@@ -662,7 +385,7 @@ const hasCorepack = cached(async () => {
|
|
|
662
385
|
});
|
|
663
386
|
async function executeCommand(command, args, options = {}) {
|
|
664
387
|
const xArgs = command !== "npm" && command !== "bun" && command !== "deno" && options.corepack !== false && await hasCorepack() ? ["corepack", [command, ...args]] : [command, args];
|
|
665
|
-
const { exitCode, stdout, stderr } = await
|
|
388
|
+
const { exitCode, stdout, stderr } = await R(xArgs[0], xArgs[1], { nodeOptions: {
|
|
666
389
|
cwd: resolve$1(options.cwd || process.cwd()),
|
|
667
390
|
env: options.env,
|
|
668
391
|
stdio: options.silent ? "pipe" : "inherit"
|