nitro 3.0.260415-beta → 3.0.260522-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 +157 -45
- package/dist/_build/rolldown.mjs +6 -6
- 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 +241 -14
- package/dist/_chunks/nitro2.mjs +117 -90
- package/dist/_chunks/utils.mjs +4 -4
- package/dist/_common.mjs +2 -2
- package/dist/_dev.d.mts +1 -1
- package/dist/_dev.mjs +7 -6
- package/dist/_libs/c12+rc9.mjs +24 -11
- 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 +3 -3
- 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 +62 -49
- package/dist/_libs/httpxy.d.mts +2 -4
- package/dist/_libs/httpxy.mjs +13 -9
- package/dist/_libs/jsonc-parser+workers-utils.d.mts +1579 -0
- 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 +137 -113
- package/dist/_libs/openapi-types.d.mts +730 -0
- package/dist/_libs/perfect-debounce.mjs +1 -1
- package/dist/_libs/pkg-types.d.mts +8 -5
- package/dist/_libs/plugin-alias.mjs +2 -2
- package/dist/_libs/plugin-inject.mjs +4 -2
- package/dist/_libs/plugin-json.mjs +2 -2
- package/dist/_libs/pluginutils.mjs +18 -5
- package/dist/_libs/readdirp+chokidar.mjs +4 -3
- 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/unimport+unplugin.mjs +61 -39
- package/dist/_libs/unplugin+unimport.d.mts +4 -4
- package/dist/_libs/unwasm.d.mts +1 -1
- package/dist/_presets.mjs +118 -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/0.docs/5.cache.md +53 -9
- 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/3.examples/27.vite-ssr-tsr-react.md +1 -1
- package/dist/node_modules/ufo/dist/index.mjs +2 -2
- package/dist/node_modules/ufo/package.json +9 -9
- package/dist/presets/azure/runtime/azure-swa.mjs +2 -0
- package/dist/presets/vercel/runtime/queue.dev.mjs +41 -0
- package/dist/runtime/internal/app.mjs +4 -111
- package/dist/runtime/internal/route-rules.d.mts +1 -0
- package/dist/runtime/internal/route-rules.mjs +29 -1
- package/dist/runtime/internal/routes/scalar.mjs +1 -0
- package/dist/runtime/virtual/app.d.mts +4 -0
- package/dist/runtime/virtual/app.mjs +32 -0
- package/dist/types/index.d.mts +959 -1836
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +23 -331
- package/package.json +43 -44
- package/dist/THIRD-PARTY-LICENSES.md +0 -1646
- package/dist/_chunks/nitro3.mjs +0 -136
- package/dist/_chunks/nitro4.mjs +0 -127
- package/dist/_libs/_.mjs +0 -2
- package/dist/_libs/_2.mjs +0 -2
- package/dist/_libs/_3.mjs +0 -2
- package/dist/_libs/_4.mjs +0 -2
- package/dist/_libs/_5.mjs +0 -2
- package/dist/_libs/_6.mjs +0 -2
- package/dist/_libs/_7.mjs +0 -2
- package/dist/_libs/escape-string-regexp.mjs +0 -5
package/dist/_libs/klona.mjs
CHANGED
package/dist/_libs/mlly.d.mts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
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";
|
|
2
3
|
import { createRequire } from "node:module";
|
|
3
4
|
import { existsSync } from "node:fs";
|
|
4
5
|
import { readFile } from "node:fs/promises";
|
|
5
|
-
import { delimiter, dirname, join,
|
|
6
|
+
import { delimiter, dirname, join, resolve } from "node:path";
|
|
6
7
|
import { cwd } from "node:process";
|
|
7
8
|
import { PassThrough } from "node:stream";
|
|
8
9
|
import { spawn } from "node:child_process";
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
var u =
|
|
12
|
-
|
|
13
|
-
const f =
|
|
10
|
+
import { pipeline } from "node:stream/promises";
|
|
11
|
+
import l from "node:readline";
|
|
12
|
+
var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports);
|
|
13
|
+
var d = /* @__PURE__ */ createRequire(import.meta.url);
|
|
14
|
+
const f = /^path$/i;
|
|
15
|
+
const p = {
|
|
14
16
|
key: "PATH",
|
|
15
17
|
value: ""
|
|
16
18
|
};
|
|
17
|
-
function
|
|
19
|
+
function m(e) {
|
|
18
20
|
for (const t in e) {
|
|
19
|
-
if (!Object.prototype.hasOwnProperty.call(e, t) || !
|
|
21
|
+
if (!Object.prototype.hasOwnProperty.call(e, t) || !f.test(t)) continue;
|
|
20
22
|
const n = e[t];
|
|
21
|
-
if (!n) return
|
|
23
|
+
if (!n) return p;
|
|
22
24
|
return {
|
|
23
25
|
key: t,
|
|
24
26
|
value: n
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
|
-
return
|
|
29
|
+
return p;
|
|
28
30
|
}
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
-
const
|
|
31
|
+
function h(e, t) {
|
|
32
|
+
const n = t.value.split(delimiter);
|
|
33
|
+
const r = [];
|
|
32
34
|
let s = e;
|
|
33
35
|
let c;
|
|
34
36
|
do {
|
|
35
|
-
|
|
37
|
+
r.push(resolve(s, "node_modules", ".bin"));
|
|
36
38
|
c = s;
|
|
37
39
|
s = dirname(s);
|
|
38
40
|
} while (s !== c);
|
|
39
|
-
|
|
41
|
+
r.push(dirname(process.execPath));
|
|
42
|
+
const l = r.concat(n).join(delimiter);
|
|
40
43
|
return {
|
|
41
44
|
key: t.key,
|
|
42
45
|
value: l
|
|
43
46
|
};
|
|
44
47
|
}
|
|
45
|
-
function
|
|
48
|
+
function g(e, t) {
|
|
46
49
|
const n = {
|
|
47
50
|
...process.env,
|
|
48
51
|
...t
|
|
49
52
|
};
|
|
50
|
-
const r =
|
|
53
|
+
const r = h(e, m(n));
|
|
51
54
|
n[r.key] = r.value;
|
|
52
55
|
return n;
|
|
53
56
|
}
|
|
54
|
-
const
|
|
57
|
+
const _ = (e) => {
|
|
55
58
|
let t = e.length;
|
|
56
59
|
const n = new PassThrough();
|
|
57
60
|
const r = () => {
|
|
58
|
-
if (--t === 0) n.
|
|
61
|
+
if (--t === 0) n.end();
|
|
59
62
|
};
|
|
60
|
-
for (const t of e) {
|
|
61
|
-
t.pipe(n, { end: false });
|
|
62
|
-
t.on("end", r);
|
|
63
|
-
}
|
|
63
|
+
for (const t of e) pipeline(t, n, { end: false }).then(r).catch(r);
|
|
64
64
|
return n;
|
|
65
65
|
};
|
|
66
|
-
var
|
|
66
|
+
var v = /* @__PURE__ */ u(((e, t) => {
|
|
67
67
|
t.exports = a;
|
|
68
68
|
a.sync = o;
|
|
69
|
-
var n =
|
|
69
|
+
var n = d("fs");
|
|
70
70
|
function r(e, t) {
|
|
71
71
|
var n = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT;
|
|
72
72
|
if (!n) return true;
|
|
@@ -91,10 +91,10 @@ var _ = /* @__PURE__ */ l(((e, t) => {
|
|
|
91
91
|
return i(n.statSync(e), e, t);
|
|
92
92
|
}
|
|
93
93
|
}));
|
|
94
|
-
var
|
|
94
|
+
var y = /* @__PURE__ */ u(((e, t) => {
|
|
95
95
|
t.exports = r;
|
|
96
96
|
r.sync = i;
|
|
97
|
-
var n =
|
|
97
|
+
var n = d("fs");
|
|
98
98
|
function r(e, t, r) {
|
|
99
99
|
n.stat(e, function(e, n) {
|
|
100
100
|
r(e, e ? false : a(n, t));
|
|
@@ -119,11 +119,11 @@ var v = /* @__PURE__ */ l(((e, t) => {
|
|
|
119
119
|
return n & l || n & c && i === o || n & s && r === a || n & u && a === 0;
|
|
120
120
|
}
|
|
121
121
|
}));
|
|
122
|
-
var
|
|
123
|
-
|
|
122
|
+
var b = /* @__PURE__ */ u(((e, t) => {
|
|
123
|
+
d("fs");
|
|
124
124
|
var n;
|
|
125
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) n =
|
|
126
|
-
else n =
|
|
125
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) n = v();
|
|
126
|
+
else n = y();
|
|
127
127
|
t.exports = r;
|
|
128
128
|
r.sync = i;
|
|
129
129
|
function r(e, t, i) {
|
|
@@ -159,11 +159,11 @@ var y = /* @__PURE__ */ l(((e, t) => {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}));
|
|
162
|
-
var
|
|
162
|
+
var x = /* @__PURE__ */ u(((e, t) => {
|
|
163
163
|
const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
164
|
-
const r =
|
|
164
|
+
const r = d("path");
|
|
165
165
|
const i = n ? ";" : ":";
|
|
166
|
-
const a =
|
|
166
|
+
const a = b();
|
|
167
167
|
const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
|
|
168
168
|
const s = (e, t) => {
|
|
169
169
|
const r = t.colon || i;
|
|
@@ -229,7 +229,7 @@ var b = /* @__PURE__ */ l(((e, t) => {
|
|
|
229
229
|
t.exports = c;
|
|
230
230
|
c.sync = l;
|
|
231
231
|
}));
|
|
232
|
-
var
|
|
232
|
+
var S = /* @__PURE__ */ u(((e, t) => {
|
|
233
233
|
const n = (e = {}) => {
|
|
234
234
|
const t = e.env || process.env;
|
|
235
235
|
if ((e.platform || process.platform) !== "win32") return "PATH";
|
|
@@ -238,10 +238,10 @@ var x = /* @__PURE__ */ l(((e, t) => {
|
|
|
238
238
|
t.exports = n;
|
|
239
239
|
t.exports.default = n;
|
|
240
240
|
}));
|
|
241
|
-
var
|
|
242
|
-
const n =
|
|
243
|
-
const r =
|
|
244
|
-
const i =
|
|
241
|
+
var C = /* @__PURE__ */ u(((e, t) => {
|
|
242
|
+
const n = d("path");
|
|
243
|
+
const r = x();
|
|
244
|
+
const i = S();
|
|
245
245
|
function a(e, t) {
|
|
246
246
|
const a = e.options.env || process.env;
|
|
247
247
|
const o = process.cwd();
|
|
@@ -267,7 +267,7 @@ var S = /* @__PURE__ */ l(((e, t) => {
|
|
|
267
267
|
}
|
|
268
268
|
t.exports = o;
|
|
269
269
|
}));
|
|
270
|
-
var
|
|
270
|
+
var w = /* @__PURE__ */ u(((e, t) => {
|
|
271
271
|
const n = /([()\][%!^"`<>&|;, *?])/g;
|
|
272
272
|
function r(e) {
|
|
273
273
|
e = e.replace(n, "^$1");
|
|
@@ -285,11 +285,11 @@ var C = /* @__PURE__ */ l(((e, t) => {
|
|
|
285
285
|
t.exports.command = r;
|
|
286
286
|
t.exports.argument = i;
|
|
287
287
|
}));
|
|
288
|
-
var
|
|
288
|
+
var T = /* @__PURE__ */ u(((e, t) => {
|
|
289
289
|
t.exports = /^#!(.*)/;
|
|
290
290
|
}));
|
|
291
|
-
var
|
|
292
|
-
const n =
|
|
291
|
+
var E = /* @__PURE__ */ u(((e, t) => {
|
|
292
|
+
const n = T();
|
|
293
293
|
t.exports = (e = "") => {
|
|
294
294
|
const t = e.match(n);
|
|
295
295
|
if (!t) return null;
|
|
@@ -299,9 +299,9 @@ var T = /* @__PURE__ */ l(((e, t) => {
|
|
|
299
299
|
return i ? `${a} ${i}` : a;
|
|
300
300
|
};
|
|
301
301
|
}));
|
|
302
|
-
var
|
|
303
|
-
const n =
|
|
304
|
-
const r =
|
|
302
|
+
var D = /* @__PURE__ */ u(((e, t) => {
|
|
303
|
+
const n = d("fs");
|
|
304
|
+
const r = E();
|
|
305
305
|
function i(e) {
|
|
306
306
|
const t = 150;
|
|
307
307
|
const i = Buffer.alloc(t);
|
|
@@ -315,11 +315,11 @@ var E = /* @__PURE__ */ l(((e, t) => {
|
|
|
315
315
|
}
|
|
316
316
|
t.exports = i;
|
|
317
317
|
}));
|
|
318
|
-
var
|
|
319
|
-
const n =
|
|
320
|
-
const r =
|
|
321
|
-
const i =
|
|
322
|
-
const a =
|
|
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
323
|
const o = process.platform === "win32";
|
|
324
324
|
const s = /\.(?:com|exe)$/i;
|
|
325
325
|
const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
@@ -333,7 +333,7 @@ var D = /* @__PURE__ */ l(((e, t) => {
|
|
|
333
333
|
}
|
|
334
334
|
return e.file;
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function u(e) {
|
|
337
337
|
if (!o) return e;
|
|
338
338
|
const t = l(e);
|
|
339
339
|
const r = !s.test(t);
|
|
@@ -370,11 +370,11 @@ var D = /* @__PURE__ */ l(((e, t) => {
|
|
|
370
370
|
args: t
|
|
371
371
|
}
|
|
372
372
|
};
|
|
373
|
-
return n.shell ? r :
|
|
373
|
+
return n.shell ? r : u(r);
|
|
374
374
|
}
|
|
375
375
|
t.exports = f;
|
|
376
376
|
}));
|
|
377
|
-
var
|
|
377
|
+
var k = /* @__PURE__ */ u(((e, t) => {
|
|
378
378
|
const n = process.platform === "win32";
|
|
379
379
|
function r(e, t) {
|
|
380
380
|
return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
|
|
@@ -411,10 +411,10 @@ var O = /* @__PURE__ */ l(((e, t) => {
|
|
|
411
411
|
notFoundError: r
|
|
412
412
|
};
|
|
413
413
|
}));
|
|
414
|
-
var
|
|
415
|
-
const n =
|
|
416
|
-
const r =
|
|
417
|
-
const i =
|
|
414
|
+
var j = (/* @__PURE__ */ u(((e, t) => {
|
|
415
|
+
const n = d("child_process");
|
|
416
|
+
const r = O();
|
|
417
|
+
const i = k();
|
|
418
418
|
function a(e, t, a) {
|
|
419
419
|
const o = r(e, t, a);
|
|
420
420
|
const s = n.spawn(o.command, o.args, o.options);
|
|
@@ -433,9 +433,7 @@ var A = (/* @__PURE__ */ l(((e, t) => {
|
|
|
433
433
|
t.exports._parse = r;
|
|
434
434
|
t.exports._enoent = i;
|
|
435
435
|
})))();
|
|
436
|
-
var
|
|
437
|
-
result;
|
|
438
|
-
output;
|
|
436
|
+
var M = class extends Error {
|
|
439
437
|
get exitCode() {
|
|
440
438
|
if (this.result.exitCode !== null) return this.result.exitCode;
|
|
441
439
|
}
|
|
@@ -445,18 +443,12 @@ var j = class extends Error {
|
|
|
445
443
|
this.output = t;
|
|
446
444
|
}
|
|
447
445
|
};
|
|
448
|
-
const
|
|
446
|
+
const P = {
|
|
449
447
|
timeout: void 0,
|
|
450
448
|
persist: false
|
|
451
449
|
};
|
|
452
|
-
const
|
|
453
|
-
function
|
|
454
|
-
return {
|
|
455
|
-
command: normalize(e),
|
|
456
|
-
args: t ?? []
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
function F(e) {
|
|
450
|
+
const I = { windowsHide: true };
|
|
451
|
+
function L(e) {
|
|
460
452
|
const t = new AbortController();
|
|
461
453
|
for (const n of e) {
|
|
462
454
|
if (n.aborted) {
|
|
@@ -470,12 +462,14 @@ function F(e) {
|
|
|
470
462
|
}
|
|
471
463
|
return t.signal;
|
|
472
464
|
}
|
|
473
|
-
async function
|
|
465
|
+
async function R(e) {
|
|
474
466
|
let t = "";
|
|
475
|
-
|
|
467
|
+
try {
|
|
468
|
+
for await (const n of e) t += n.toString();
|
|
469
|
+
} catch {}
|
|
476
470
|
return t;
|
|
477
471
|
}
|
|
478
|
-
var
|
|
472
|
+
var z = class {
|
|
479
473
|
_process;
|
|
480
474
|
_aborted = false;
|
|
481
475
|
_options;
|
|
@@ -495,7 +489,7 @@ var L = class {
|
|
|
495
489
|
}
|
|
496
490
|
constructor(e, t, n) {
|
|
497
491
|
this._options = {
|
|
498
|
-
...
|
|
492
|
+
...P,
|
|
499
493
|
...n
|
|
500
494
|
};
|
|
501
495
|
this._command = e;
|
|
@@ -514,7 +508,7 @@ var L = class {
|
|
|
514
508
|
return this._process?.killed === true;
|
|
515
509
|
}
|
|
516
510
|
pipe(e, t, n) {
|
|
517
|
-
return
|
|
511
|
+
return H(e, t, {
|
|
518
512
|
...n,
|
|
519
513
|
stdin: this
|
|
520
514
|
});
|
|
@@ -525,29 +519,30 @@ var L = class {
|
|
|
525
519
|
const t = [];
|
|
526
520
|
if (this._streamErr) t.push(this._streamErr);
|
|
527
521
|
if (this._streamOut) t.push(this._streamOut);
|
|
528
|
-
const n =
|
|
529
|
-
const r =
|
|
522
|
+
const n = _(t);
|
|
523
|
+
const r = l.createInterface({ input: n });
|
|
530
524
|
for await (const e of r) yield e.toString();
|
|
531
525
|
await this._processClosed;
|
|
532
526
|
e.removeAllListeners();
|
|
533
527
|
if (this._thrownError) throw this._thrownError;
|
|
534
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
528
|
+
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new M(this);
|
|
535
529
|
}
|
|
536
530
|
async _waitForOutput() {
|
|
537
531
|
const e = this._process;
|
|
538
532
|
if (!e) throw new Error("No process was started");
|
|
539
|
-
const [t, n] = await Promise.all([this._streamOut ?
|
|
533
|
+
const [t, n] = await Promise.all([this._streamOut ? R(this._streamOut) : "", this._streamErr ? R(this._streamErr) : ""]);
|
|
540
534
|
await this._processClosed;
|
|
541
|
-
|
|
535
|
+
const { stdin: r } = this._options;
|
|
536
|
+
if (r && typeof r !== "string") await r;
|
|
542
537
|
e.removeAllListeners();
|
|
543
538
|
if (this._thrownError) throw this._thrownError;
|
|
544
|
-
const
|
|
539
|
+
const i = {
|
|
545
540
|
stderr: n,
|
|
546
541
|
stdout: t,
|
|
547
542
|
exitCode: this.exitCode
|
|
548
543
|
};
|
|
549
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
550
|
-
return
|
|
544
|
+
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new M(this, i);
|
|
545
|
+
return i;
|
|
551
546
|
}
|
|
552
547
|
then(e, t) {
|
|
553
548
|
return this._waitForOutput().then(e, t);
|
|
@@ -557,28 +552,28 @@ var L = class {
|
|
|
557
552
|
spawn() {
|
|
558
553
|
const e = cwd();
|
|
559
554
|
const n = this._options;
|
|
560
|
-
const
|
|
561
|
-
...
|
|
555
|
+
const i = {
|
|
556
|
+
...I,
|
|
562
557
|
...n.nodeOptions
|
|
563
558
|
};
|
|
564
|
-
const
|
|
559
|
+
const a = [];
|
|
565
560
|
this._resetState();
|
|
566
|
-
if (n.timeout !== void 0)
|
|
567
|
-
if (n.signal !== void 0)
|
|
568
|
-
if (n.persist === true)
|
|
569
|
-
if (
|
|
570
|
-
|
|
571
|
-
const
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
if (
|
|
575
|
-
|
|
576
|
-
this.
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
561
|
+
if (n.timeout !== void 0) a.push(AbortSignal.timeout(n.timeout));
|
|
562
|
+
if (n.signal !== void 0) a.push(n.signal);
|
|
563
|
+
if (n.persist === true) i.detached = true;
|
|
564
|
+
if (a.length > 0) i.signal = L(a);
|
|
565
|
+
i.env = g(e, i.env);
|
|
566
|
+
const o = (0, j._parse)(this._command, this._args, i);
|
|
567
|
+
const s = spawn(o.command, o.args, o.options);
|
|
568
|
+
if (s.stderr) this._streamErr = s.stderr;
|
|
569
|
+
if (s.stdout) this._streamOut = s.stdout;
|
|
570
|
+
this._process = s;
|
|
571
|
+
s.once("error", this._onError);
|
|
572
|
+
s.once("close", this._onClose);
|
|
573
|
+
if (s.stdin) {
|
|
574
|
+
const { stdin: e } = n;
|
|
575
|
+
if (typeof e === "string") s.stdin.end(e);
|
|
576
|
+
else e?.process?.stdout?.pipe(s.stdin);
|
|
582
577
|
}
|
|
583
578
|
}
|
|
584
579
|
_resetState() {
|
|
@@ -599,12 +594,18 @@ var L = class {
|
|
|
599
594
|
if (this._resolveClose) this._resolveClose();
|
|
600
595
|
};
|
|
601
596
|
};
|
|
602
|
-
const
|
|
603
|
-
const r = new
|
|
597
|
+
const V = (e, t, n) => {
|
|
598
|
+
const r = new z(e, t, n);
|
|
604
599
|
r.spawn();
|
|
605
600
|
return r;
|
|
606
601
|
};
|
|
607
|
-
const
|
|
602
|
+
const H = V;
|
|
603
|
+
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
604
|
+
addDependency: () => addDependency,
|
|
605
|
+
addDevDependency: () => addDevDependency,
|
|
606
|
+
detectPackageManager: () => detectPackageManager,
|
|
607
|
+
packageManagers: () => packageManagers
|
|
608
|
+
});
|
|
608
609
|
async function findup(cwd, match, options = {}) {
|
|
609
610
|
const segments = normalize$1(cwd).split("/");
|
|
610
611
|
while (segments.length > 0) {
|
|
@@ -613,11 +614,32 @@ async function findup(cwd, match, options = {}) {
|
|
|
613
614
|
segments.pop();
|
|
614
615
|
}
|
|
615
616
|
}
|
|
616
|
-
async function readPackageJSON(cwd) {
|
|
617
|
+
async function readPackageJSON(cwd, options = {}) {
|
|
617
618
|
return findup(cwd, (p) => {
|
|
618
619
|
const pkgPath = join(p, "package.json");
|
|
619
620
|
if (existsSync(pkgPath)) return readFile(pkgPath, "utf8").then((data) => JSON.parse(data));
|
|
620
|
-
});
|
|
621
|
+
}, options);
|
|
622
|
+
}
|
|
623
|
+
async function readInstalledPackageJSON(pkgName, cwd) {
|
|
624
|
+
const pkgJSONPath = await findup(cwd, (p) => {
|
|
625
|
+
const candidate = join(p, "node_modules", pkgName, "package.json");
|
|
626
|
+
if (existsSync(candidate)) return candidate;
|
|
627
|
+
}, { includeParentDirs: true });
|
|
628
|
+
if (!pkgJSONPath) return null;
|
|
629
|
+
try {
|
|
630
|
+
return JSON.parse(await readFile(pkgJSONPath, "utf8"));
|
|
631
|
+
} catch {
|
|
632
|
+
return null;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
async function readPackageJSONFromResolver(requireFn, pkgName) {
|
|
636
|
+
let resolved;
|
|
637
|
+
try {
|
|
638
|
+
resolved = requireFn.resolve(pkgName);
|
|
639
|
+
} catch {
|
|
640
|
+
return null;
|
|
641
|
+
}
|
|
642
|
+
return readPackageJSON(resolved, { includeParentDirs: true });
|
|
621
643
|
}
|
|
622
644
|
function cached(fn) {
|
|
623
645
|
let v;
|
|
@@ -632,7 +654,7 @@ function cached(fn) {
|
|
|
632
654
|
const hasCorepack = cached(async () => {
|
|
633
655
|
if (globalThis.process?.versions?.webcontainer) return false;
|
|
634
656
|
try {
|
|
635
|
-
const { exitCode } = await
|
|
657
|
+
const { exitCode } = await V("corepack", ["--version"]);
|
|
636
658
|
return exitCode === 0;
|
|
637
659
|
} catch {
|
|
638
660
|
return false;
|
|
@@ -640,7 +662,7 @@ const hasCorepack = cached(async () => {
|
|
|
640
662
|
});
|
|
641
663
|
async function executeCommand(command, args, options = {}) {
|
|
642
664
|
const xArgs = command !== "npm" && command !== "bun" && command !== "deno" && options.corepack !== false && await hasCorepack() ? ["corepack", [command, ...args]] : [command, args];
|
|
643
|
-
const { exitCode, stdout, stderr } = await
|
|
665
|
+
const { exitCode, stdout, stderr } = await V(xArgs[0], xArgs[1], { nodeOptions: {
|
|
644
666
|
cwd: resolve$1(options.cwd || process.cwd()),
|
|
645
667
|
env: options.env,
|
|
646
668
|
stdio: options.silent ? "pipe" : "inherit"
|
|
@@ -797,8 +819,10 @@ async function addDependency(name, options = {}) {
|
|
|
797
819
|
const _require = createRequire(join(resolvedOptions.cwd, "/_.js"));
|
|
798
820
|
for (const _name of names) {
|
|
799
821
|
const pkgName = _name.match(/^(.[^@]+)/)?.[0];
|
|
800
|
-
|
|
801
|
-
|
|
822
|
+
if (!pkgName) continue;
|
|
823
|
+
let pkg = await readPackageJSONFromResolver(_require, pkgName);
|
|
824
|
+
if (pkg?.name !== pkgName) pkg = await readInstalledPackageJSON(pkgName, resolvedOptions.cwd);
|
|
825
|
+
if (!pkg?.peerDependencies) continue;
|
|
802
826
|
for (const [peerDependency, version] of Object.entries(pkg.peerDependencies)) {
|
|
803
827
|
if (pkg.peerDependenciesMeta?.[peerDependency]?.optional) continue;
|
|
804
828
|
if (existingPkg?.dependencies?.[peerDependency] || existingPkg?.devDependencies?.[peerDependency]) continue;
|
|
@@ -819,4 +843,4 @@ async function addDevDependency(name, options = {}) {
|
|
|
819
843
|
dev: true
|
|
820
844
|
});
|
|
821
845
|
}
|
|
822
|
-
export {
|
|
846
|
+
export { dist_exports };
|