nitro 3.0.260429-beta → 3.0.260603-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 +142 -35
- package/dist/_build/rolldown.mjs +12 -8
- package/dist/_build/rollup.mjs +11 -11
- package/dist/_build/vite.build.mjs +3 -3
- package/dist/_build/vite.dev.mjs +149 -0
- package/dist/_build/vite.env.mjs +177 -0
- package/dist/_chunks/nitro.mjs +252 -17
- package/dist/_chunks/nitro2.mjs +117 -90
- package/dist/_chunks/utils.mjs +4 -4
- package/dist/_common.mjs +1 -1
- package/dist/_dev.d.mts +1 -1
- package/dist/_dev.mjs +5 -5
- package/dist/_libs/c12+rc9.mjs +11 -10
- package/dist/_libs/c12+readdirp+chokidar.d.mts +7 -8
- package/dist/_libs/citty.mjs +1 -1
- package/dist/_libs/common.d.mts +37 -0
- package/dist/_libs/commondir+is-reference.mjs +5 -5
- package/dist/_libs/compatx.d.mts +1 -1
- package/dist/_libs/compatx.mjs +1 -1
- package/dist/_libs/estree+pluginutils.d.mts +1 -1
- package/dist/_libs/estree-walker.mjs +1 -1
- package/dist/_libs/hasown+resolve+deepmerge.mjs +15 -15
- package/dist/_libs/httpxy.d.mts +2 -1
- package/dist/_libs/httpxy.mjs +8 -4
- package/dist/_libs/klona.mjs +1 -1
- package/dist/_libs/magic-string.d.mts +1 -1
- package/dist/_libs/mlly.d.mts +1 -1
- package/dist/_libs/nypm+tinyexec.mjs +150 -434
- package/dist/_libs/openapi-types.d.mts +730 -0
- package/dist/_libs/perfect-debounce.mjs +1 -1
- package/dist/_libs/pkg-types.d.mts +1 -1
- package/dist/_libs/plugin-alias.mjs +2 -2
- package/dist/_libs/plugin-inject.mjs +3 -3
- package/dist/_libs/plugin-json.mjs +2 -2
- package/dist/_libs/pluginutils.mjs +16 -5
- package/dist/_libs/readdirp+chokidar.mjs +2 -2
- package/dist/_libs/remapping.mjs +2 -2
- package/dist/_libs/resolve-uri+gen-mapping.mjs +2 -5
- package/dist/_libs/rou3.d.mts +1 -1
- package/dist/_libs/rou3.mjs +1 -1
- package/dist/_libs/std-env.d.mts +1 -1
- package/dist/_libs/tsconfck.mjs +1 -1
- package/dist/_libs/ultrahtml.mjs +1 -1
- package/dist/_libs/undici+jsonc-parser.d.mts +2418 -0
- package/dist/_libs/{unimport+unplugin+oxc-parser.mjs → unimport+unplugin.mjs} +18 -8
- package/dist/_libs/unplugin+unimport.d.mts +3 -3
- package/dist/_libs/unwasm.d.mts +1 -1
- package/dist/_presets.mjs +131 -91
- package/dist/builder.d.mts +1 -1
- package/dist/builder.mjs +3 -3
- package/dist/cli/_chunks/build.mjs +3 -3
- package/dist/cli/_chunks/common.mjs +1 -1
- package/dist/cli/_chunks/deploy.mjs +2 -2
- package/dist/cli/_chunks/dev.mjs +4 -4
- package/dist/cli/_chunks/docs.mjs +1 -1
- package/dist/cli/_chunks/list.mjs +2 -2
- package/dist/cli/_chunks/prepare.mjs +3 -3
- package/dist/cli/_chunks/preview.mjs +4 -4
- package/dist/cli/_chunks/run.mjs +2 -2
- package/dist/cli/_chunks/task.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +3 -3
- package/dist/docs/1.deploy/2.providers/21.vercel.md +6 -0
- package/dist/docs/2.config/0.index/index.md +14 -0
- package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +1 -1
- package/dist/presets/vercel/runtime/queue.dev.mjs +41 -0
- package/dist/runtime/internal/app.mjs +4 -111
- package/dist/runtime/virtual/app.d.mts +4 -0
- package/dist/runtime/virtual/app.mjs +32 -0
- package/dist/types/index.d.mts +51 -1756
- package/dist/vite.mjs +29 -339
- package/package.json +39 -41
- package/dist/THIRD-PARTY-LICENSES.md +0 -1676
- package/dist/_chunks/nitro3.mjs +0 -136
- package/dist/_chunks/nitro4.mjs +0 -127
|
@@ -1,60 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_common.mjs";
|
|
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, normalize, 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
11
|
import u from "node:readline";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const p = /^path$/i;
|
|
15
|
-
const m = {
|
|
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
|
-
const
|
|
34
|
-
let
|
|
31
|
+
const r = [];
|
|
32
|
+
let o = e;
|
|
35
33
|
let c;
|
|
36
34
|
do {
|
|
37
|
-
|
|
38
|
-
c =
|
|
39
|
-
|
|
40
|
-
} while (
|
|
41
|
-
|
|
42
|
-
const l =
|
|
35
|
+
r.push(resolve(o, "node_modules", ".bin"));
|
|
36
|
+
c = o;
|
|
37
|
+
o = dirname(o);
|
|
38
|
+
} while (o !== c);
|
|
39
|
+
r.push(dirname(process.execPath));
|
|
40
|
+
const l = r.concat(n).join(delimiter);
|
|
43
41
|
return {
|
|
44
42
|
key: t.key,
|
|
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 v = (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 b = /* @__PURE__ */ d(((e, t) => {
|
|
95
|
-
t.exports = r;
|
|
96
|
-
r.sync = i;
|
|
97
|
-
var n = f("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 x = /* @__PURE__ */ d(((e, t) => {
|
|
123
|
-
f("fs");
|
|
124
|
-
var n;
|
|
125
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) n = y();
|
|
126
|
-
else n = b();
|
|
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 S = /* @__PURE__ */ d(((e, t) => {
|
|
163
|
-
const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
164
|
-
const r = f("path");
|
|
165
|
-
const i = n ? ";" : ":";
|
|
166
|
-
const a = x();
|
|
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 C = /* @__PURE__ */ d(((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 w = /* @__PURE__ */ d(((e, t) => {
|
|
242
|
-
const n = f("path");
|
|
243
|
-
const r = S();
|
|
244
|
-
const i = C();
|
|
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 T = /* @__PURE__ */ d(((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 E = /* @__PURE__ */ d(((e, t) => {
|
|
289
|
-
t.exports = /^#!(.*)/;
|
|
290
|
-
}));
|
|
291
|
-
var D = /* @__PURE__ */ d(((e, t) => {
|
|
292
|
-
const n = E();
|
|
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 k = /* @__PURE__ */ d(((e, t) => {
|
|
319
|
-
const n = f("path");
|
|
320
|
-
const r = w();
|
|
321
|
-
const i = T();
|
|
322
|
-
const a = O();
|
|
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 N = 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,18 +166,12 @@ var N = 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
|
|
452
|
-
return {
|
|
453
|
-
command: normalize(e),
|
|
454
|
-
args: t ?? []
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
function z(e) {
|
|
173
|
+
const N = { windowsHide: true };
|
|
174
|
+
function P(e) {
|
|
458
175
|
const t = new AbortController();
|
|
459
176
|
for (const n of e) {
|
|
460
177
|
if (n.aborted) {
|
|
@@ -468,14 +185,14 @@ function z(e) {
|
|
|
468
185
|
}
|
|
469
186
|
return t.signal;
|
|
470
187
|
}
|
|
471
|
-
async function
|
|
188
|
+
async function F(e) {
|
|
472
189
|
let t = "";
|
|
473
190
|
try {
|
|
474
191
|
for await (const n of e) t += n.toString();
|
|
475
192
|
} catch {}
|
|
476
193
|
return t;
|
|
477
194
|
}
|
|
478
|
-
var
|
|
195
|
+
var I = class {
|
|
479
196
|
_process;
|
|
480
197
|
_aborted = false;
|
|
481
198
|
_options;
|
|
@@ -495,7 +212,7 @@ var V = class {
|
|
|
495
212
|
}
|
|
496
213
|
constructor(e, t, n) {
|
|
497
214
|
this._options = {
|
|
498
|
-
...
|
|
215
|
+
...j,
|
|
499
216
|
...n
|
|
500
217
|
};
|
|
501
218
|
this._command = e;
|
|
@@ -514,7 +231,7 @@ var V = class {
|
|
|
514
231
|
return this._process?.killed === true;
|
|
515
232
|
}
|
|
516
233
|
pipe(e, t, n) {
|
|
517
|
-
return
|
|
234
|
+
return z(e, t, {
|
|
518
235
|
...n,
|
|
519
236
|
stdin: this
|
|
520
237
|
});
|
|
@@ -525,18 +242,18 @@ var V = class {
|
|
|
525
242
|
const t = [];
|
|
526
243
|
if (this._streamErr) t.push(this._streamErr);
|
|
527
244
|
if (this._streamOut) t.push(this._streamOut);
|
|
528
|
-
const n =
|
|
245
|
+
const n = b(t);
|
|
529
246
|
const r = u.createInterface({ input: n });
|
|
530
247
|
for await (const e of r) yield e.toString();
|
|
531
248
|
await this._processClosed;
|
|
532
249
|
e.removeAllListeners();
|
|
533
250
|
if (this._thrownError) throw this._thrownError;
|
|
534
|
-
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);
|
|
535
252
|
}
|
|
536
253
|
async _waitForOutput() {
|
|
537
254
|
const e = this._process;
|
|
538
255
|
if (!e) throw new Error("No process was started");
|
|
539
|
-
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) : ""]);
|
|
540
257
|
await this._processClosed;
|
|
541
258
|
const { stdin: r } = this._options;
|
|
542
259
|
if (r && typeof r !== "string") await r;
|
|
@@ -547,7 +264,7 @@ var V = class {
|
|
|
547
264
|
stdout: t,
|
|
548
265
|
exitCode: this.exitCode
|
|
549
266
|
};
|
|
550
|
-
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);
|
|
551
268
|
return i;
|
|
552
269
|
}
|
|
553
270
|
then(e, t) {
|
|
@@ -556,31 +273,30 @@ var V = class {
|
|
|
556
273
|
_streamOut;
|
|
557
274
|
_streamErr;
|
|
558
275
|
spawn() {
|
|
559
|
-
const
|
|
560
|
-
const
|
|
561
|
-
const
|
|
562
|
-
...
|
|
563
|
-
...
|
|
276
|
+
const t = cwd();
|
|
277
|
+
const r = this._options;
|
|
278
|
+
const i = {
|
|
279
|
+
...N,
|
|
280
|
+
...r.nodeOptions
|
|
564
281
|
};
|
|
565
|
-
const
|
|
282
|
+
const a = [];
|
|
566
283
|
this._resetState();
|
|
567
|
-
if (
|
|
568
|
-
if (
|
|
569
|
-
if (
|
|
570
|
-
if (
|
|
571
|
-
|
|
572
|
-
const
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
if (
|
|
576
|
-
|
|
577
|
-
this.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
else e?.process?.stdout?.pipe(l.stdin);
|
|
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);
|
|
290
|
+
const s = spawn(o.command, o.args, o.options);
|
|
291
|
+
if (s.stderr) this._streamErr = s.stderr;
|
|
292
|
+
if (s.stdout) this._streamOut = s.stdout;
|
|
293
|
+
this._process = s;
|
|
294
|
+
s.once("error", this._onError);
|
|
295
|
+
s.once("close", this._onClose);
|
|
296
|
+
if (s.stdin) {
|
|
297
|
+
const { stdin: e } = r;
|
|
298
|
+
if (typeof e === "string") s.stdin.end(e);
|
|
299
|
+
else e?.process?.stdout?.pipe(s.stdin);
|
|
584
300
|
}
|
|
585
301
|
}
|
|
586
302
|
_resetState() {
|
|
@@ -601,12 +317,12 @@ var V = class {
|
|
|
601
317
|
if (this._resolveClose) this._resolveClose();
|
|
602
318
|
};
|
|
603
319
|
};
|
|
604
|
-
const
|
|
605
|
-
const r = new
|
|
320
|
+
const R = (e, t, n) => {
|
|
321
|
+
const r = new I(e, t, n);
|
|
606
322
|
r.spawn();
|
|
607
323
|
return r;
|
|
608
324
|
};
|
|
609
|
-
const
|
|
325
|
+
const z = R;
|
|
610
326
|
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
611
327
|
addDependency: () => addDependency,
|
|
612
328
|
addDevDependency: () => addDevDependency,
|
|
@@ -661,7 +377,7 @@ function cached(fn) {
|
|
|
661
377
|
const hasCorepack = cached(async () => {
|
|
662
378
|
if (globalThis.process?.versions?.webcontainer) return false;
|
|
663
379
|
try {
|
|
664
|
-
const { exitCode } = await
|
|
380
|
+
const { exitCode } = await R("corepack", ["--version"]);
|
|
665
381
|
return exitCode === 0;
|
|
666
382
|
} catch {
|
|
667
383
|
return false;
|
|
@@ -669,7 +385,7 @@ const hasCorepack = cached(async () => {
|
|
|
669
385
|
});
|
|
670
386
|
async function executeCommand(command, args, options = {}) {
|
|
671
387
|
const xArgs = command !== "npm" && command !== "bun" && command !== "deno" && options.corepack !== false && await hasCorepack() ? ["corepack", [command, ...args]] : [command, args];
|
|
672
|
-
const { exitCode, stdout, stderr } = await
|
|
388
|
+
const { exitCode, stdout, stderr } = await R(xArgs[0], xArgs[1], { nodeOptions: {
|
|
673
389
|
cwd: resolve$1(options.cwd || process.cwd()),
|
|
674
390
|
env: options.env,
|
|
675
391
|
stdio: options.silent ? "pipe" : "inherit"
|
|
@@ -850,4 +566,4 @@ async function addDevDependency(name, options = {}) {
|
|
|
850
566
|
dev: true
|
|
851
567
|
});
|
|
852
568
|
}
|
|
853
|
-
export { dist_exports
|
|
569
|
+
export { dist_exports };
|