nitro 3.0.260429-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.
Files changed (75) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md.gz +0 -0
  2. package/dist/_build/common.mjs +119 -21
  3. package/dist/_build/rolldown.mjs +6 -6
  4. package/dist/_build/rollup.mjs +11 -11
  5. package/dist/_build/vite.build.mjs +3 -3
  6. package/dist/_build/vite.dev.mjs +149 -0
  7. package/dist/_build/vite.env.mjs +177 -0
  8. package/dist/_chunks/nitro.mjs +239 -12
  9. package/dist/_chunks/nitro2.mjs +117 -90
  10. package/dist/_chunks/utils.mjs +4 -4
  11. package/dist/_common.mjs +1 -1
  12. package/dist/_dev.d.mts +1 -1
  13. package/dist/_dev.mjs +5 -5
  14. package/dist/_libs/c12+rc9.mjs +11 -10
  15. package/dist/_libs/c12+readdirp+chokidar.d.mts +7 -8
  16. package/dist/_libs/citty.mjs +1 -1
  17. package/dist/_libs/common.d.mts +37 -0
  18. package/dist/_libs/commondir+is-reference.mjs +3 -3
  19. package/dist/_libs/compatx.d.mts +1 -1
  20. package/dist/_libs/compatx.mjs +1 -1
  21. package/dist/_libs/estree+pluginutils.d.mts +1 -1
  22. package/dist/_libs/estree-walker.mjs +1 -1
  23. package/dist/_libs/hasown+resolve+deepmerge.mjs +15 -15
  24. package/dist/_libs/httpxy.d.mts +1 -1
  25. package/dist/_libs/httpxy.mjs +8 -4
  26. package/dist/_libs/jsonc-parser+workers-utils.d.mts +1579 -0
  27. package/dist/_libs/klona.mjs +1 -1
  28. package/dist/_libs/magic-string.d.mts +1 -1
  29. package/dist/_libs/mlly.d.mts +1 -1
  30. package/dist/_libs/nypm+tinyexec.mjs +92 -99
  31. package/dist/_libs/openapi-types.d.mts +730 -0
  32. package/dist/_libs/perfect-debounce.mjs +1 -1
  33. package/dist/_libs/pkg-types.d.mts +1 -1
  34. package/dist/_libs/plugin-alias.mjs +2 -2
  35. package/dist/_libs/plugin-inject.mjs +3 -3
  36. package/dist/_libs/plugin-json.mjs +2 -2
  37. package/dist/_libs/pluginutils.mjs +16 -5
  38. package/dist/_libs/readdirp+chokidar.mjs +2 -2
  39. package/dist/_libs/remapping.mjs +2 -2
  40. package/dist/_libs/resolve-uri+gen-mapping.mjs +2 -5
  41. package/dist/_libs/rou3.d.mts +1 -1
  42. package/dist/_libs/rou3.mjs +1 -1
  43. package/dist/_libs/std-env.d.mts +1 -1
  44. package/dist/_libs/tsconfck.mjs +1 -1
  45. package/dist/_libs/ultrahtml.mjs +1 -1
  46. package/dist/_libs/{unimport+unplugin+oxc-parser.mjs → unimport+unplugin.mjs} +18 -8
  47. package/dist/_libs/unplugin+unimport.d.mts +3 -3
  48. package/dist/_libs/unwasm.d.mts +1 -1
  49. package/dist/_presets.mjs +117 -91
  50. package/dist/builder.d.mts +1 -1
  51. package/dist/builder.mjs +3 -3
  52. package/dist/cli/_chunks/build.mjs +3 -3
  53. package/dist/cli/_chunks/common.mjs +1 -1
  54. package/dist/cli/_chunks/deploy.mjs +2 -2
  55. package/dist/cli/_chunks/dev.mjs +4 -4
  56. package/dist/cli/_chunks/docs.mjs +1 -1
  57. package/dist/cli/_chunks/list.mjs +2 -2
  58. package/dist/cli/_chunks/prepare.mjs +3 -3
  59. package/dist/cli/_chunks/preview.mjs +4 -4
  60. package/dist/cli/_chunks/run.mjs +2 -2
  61. package/dist/cli/_chunks/task.mjs +1 -1
  62. package/dist/cli/index.mjs +1 -1
  63. package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +3 -3
  64. package/dist/docs/1.deploy/2.providers/21.vercel.md +6 -0
  65. package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +1 -1
  66. package/dist/presets/vercel/runtime/queue.dev.mjs +41 -0
  67. package/dist/runtime/internal/app.mjs +4 -111
  68. package/dist/runtime/virtual/app.d.mts +4 -0
  69. package/dist/runtime/virtual/app.mjs +32 -0
  70. package/dist/types/index.d.mts +21 -1756
  71. package/dist/vite.mjs +23 -337
  72. package/package.json +37 -39
  73. package/dist/THIRD-PARTY-LICENSES.md +0 -1676
  74. package/dist/_chunks/nitro3.mjs +0 -136
  75. package/dist/_chunks/nitro4.mjs +0 -127
@@ -32,4 +32,4 @@ function klona(x) {
32
32
  }
33
33
  return tmp || x;
34
34
  }
35
- export { klona as t };
35
+ export { klona };
@@ -215,4 +215,4 @@ declare class MagicString {
215
215
  toString(): string;
216
216
  offset: number;
217
217
  }
218
- export { MagicString as t };
218
+ export { MagicString };
@@ -52,4 +52,4 @@ interface ESMExport {
52
52
  * Represents a declaration export within an ECMAScript module.
53
53
  * Extends {@link ESMExport}.
54
54
  */
55
- export { ESMExport as t };
55
+ export type { ESMExport };
@@ -1,60 +1,60 @@
1
- import { n as __exportAll } from "../_common.mjs";
2
- import { ft as resolve$1, lt as join$1, ut as normalize$1 } from "../_build/common.mjs";
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
4
  import { existsSync } from "node:fs";
5
5
  import { readFile } from "node:fs/promises";
6
- import { delimiter, dirname, join, normalize, resolve } from "node:path";
6
+ import { delimiter, dirname, join, 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 u from "node:readline";
12
- var d = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
13
- var f = /* @__PURE__ */ createRequire(import.meta.url);
14
- const p = /^path$/i;
15
- const m = {
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 = {
16
16
  key: "PATH",
17
17
  value: ""
18
18
  };
19
- function h(e) {
19
+ function m(e) {
20
20
  for (const t in e) {
21
- if (!Object.prototype.hasOwnProperty.call(e, t) || !p.test(t)) continue;
21
+ if (!Object.prototype.hasOwnProperty.call(e, t) || !f.test(t)) continue;
22
22
  const n = e[t];
23
- if (!n) return m;
23
+ if (!n) return p;
24
24
  return {
25
25
  key: t,
26
26
  value: n
27
27
  };
28
28
  }
29
- return m;
29
+ return p;
30
30
  }
31
- function g(e, t) {
31
+ function h(e, t) {
32
32
  const n = t.value.split(delimiter);
33
- const a = [];
33
+ const r = [];
34
34
  let s = e;
35
35
  let c;
36
36
  do {
37
- a.push(resolve(s, "node_modules", ".bin"));
37
+ r.push(resolve(s, "node_modules", ".bin"));
38
38
  c = s;
39
39
  s = dirname(s);
40
40
  } while (s !== c);
41
- a.push(dirname(process.execPath));
42
- const l = a.concat(n).join(delimiter);
41
+ r.push(dirname(process.execPath));
42
+ const l = r.concat(n).join(delimiter);
43
43
  return {
44
44
  key: t.key,
45
45
  value: l
46
46
  };
47
47
  }
48
- function _(e, t) {
48
+ function g(e, t) {
49
49
  const n = {
50
50
  ...process.env,
51
51
  ...t
52
52
  };
53
- const r = g(e, h(n));
53
+ const r = h(e, m(n));
54
54
  n[r.key] = r.value;
55
55
  return n;
56
56
  }
57
- const v = (e) => {
57
+ const _ = (e) => {
58
58
  let t = e.length;
59
59
  const n = new PassThrough();
60
60
  const r = () => {
@@ -63,10 +63,10 @@ const v = (e) => {
63
63
  for (const t of e) pipeline(t, n, { end: false }).then(r).catch(r);
64
64
  return n;
65
65
  };
66
- var y = /* @__PURE__ */ d(((e, t) => {
66
+ var v = /* @__PURE__ */ u(((e, t) => {
67
67
  t.exports = a;
68
68
  a.sync = o;
69
- var n = f("fs");
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 y = /* @__PURE__ */ d(((e, t) => {
91
91
  return i(n.statSync(e), e, t);
92
92
  }
93
93
  }));
94
- var b = /* @__PURE__ */ d(((e, t) => {
94
+ var y = /* @__PURE__ */ u(((e, t) => {
95
95
  t.exports = r;
96
96
  r.sync = i;
97
- var n = f("fs");
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 b = /* @__PURE__ */ d(((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 x = /* @__PURE__ */ d(((e, t) => {
123
- f("fs");
122
+ var b = /* @__PURE__ */ u(((e, t) => {
123
+ d("fs");
124
124
  var n;
125
- if (process.platform === "win32" || global.TESTING_WINDOWS) n = y();
126
- else n = b();
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 x = /* @__PURE__ */ d(((e, t) => {
159
159
  }
160
160
  }
161
161
  }));
162
- var S = /* @__PURE__ */ d(((e, t) => {
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 = f("path");
164
+ const r = d("path");
165
165
  const i = n ? ";" : ":";
166
- const a = x();
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 S = /* @__PURE__ */ d(((e, t) => {
229
229
  t.exports = c;
230
230
  c.sync = l;
231
231
  }));
232
- var C = /* @__PURE__ */ d(((e, t) => {
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 C = /* @__PURE__ */ d(((e, t) => {
238
238
  t.exports = n;
239
239
  t.exports.default = n;
240
240
  }));
241
- var w = /* @__PURE__ */ d(((e, t) => {
242
- const n = f("path");
243
- const r = S();
244
- const i = C();
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 w = /* @__PURE__ */ d(((e, t) => {
267
267
  }
268
268
  t.exports = o;
269
269
  }));
270
- var T = /* @__PURE__ */ d(((e, t) => {
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 T = /* @__PURE__ */ d(((e, t) => {
285
285
  t.exports.command = r;
286
286
  t.exports.argument = i;
287
287
  }));
288
- var E = /* @__PURE__ */ d(((e, t) => {
288
+ var T = /* @__PURE__ */ u(((e, t) => {
289
289
  t.exports = /^#!(.*)/;
290
290
  }));
291
- var D = /* @__PURE__ */ d(((e, t) => {
292
- const n = E();
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 D = /* @__PURE__ */ d(((e, t) => {
299
299
  return i ? `${a} ${i}` : a;
300
300
  };
301
301
  }));
302
- var O = /* @__PURE__ */ d(((e, t) => {
303
- const n = f("fs");
304
- const r = D();
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 O = /* @__PURE__ */ d(((e, t) => {
315
315
  }
316
316
  t.exports = i;
317
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();
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;
@@ -353,7 +353,7 @@ var k = /* @__PURE__ */ d(((e, t) => {
353
353
  }
354
354
  return e;
355
355
  }
356
- function d(e, t, n) {
356
+ function f(e, t, n) {
357
357
  if (t && !Array.isArray(t)) {
358
358
  n = t;
359
359
  t = null;
@@ -372,9 +372,9 @@ var k = /* @__PURE__ */ d(((e, t) => {
372
372
  };
373
373
  return n.shell ? r : u(r);
374
374
  }
375
- t.exports = d;
375
+ t.exports = f;
376
376
  }));
377
- var A = /* @__PURE__ */ d(((e, t) => {
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 A = /* @__PURE__ */ d(((e, t) => {
411
411
  notFoundError: r
412
412
  };
413
413
  }));
414
- var M = (/* @__PURE__ */ d(((e, t) => {
415
- const n = f("child_process");
416
- const r = k();
417
- const i = A();
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,7 +433,7 @@ var M = (/* @__PURE__ */ d(((e, t) => {
433
433
  t.exports._parse = r;
434
434
  t.exports._enoent = i;
435
435
  })))();
436
- var N = class extends Error {
436
+ var M = class extends Error {
437
437
  get exitCode() {
438
438
  if (this.result.exitCode !== null) return this.result.exitCode;
439
439
  }
@@ -443,18 +443,12 @@ var N = class extends Error {
443
443
  this.output = t;
444
444
  }
445
445
  };
446
- const F = {
446
+ const P = {
447
447
  timeout: void 0,
448
448
  persist: false
449
449
  };
450
- const L = { windowsHide: true };
451
- function R(e, t) {
452
- return {
453
- command: normalize(e),
454
- args: t ?? []
455
- };
456
- }
457
- function z(e) {
450
+ const I = { windowsHide: true };
451
+ function L(e) {
458
452
  const t = new AbortController();
459
453
  for (const n of e) {
460
454
  if (n.aborted) {
@@ -468,14 +462,14 @@ function z(e) {
468
462
  }
469
463
  return t.signal;
470
464
  }
471
- async function B(e) {
465
+ async function R(e) {
472
466
  let t = "";
473
467
  try {
474
468
  for await (const n of e) t += n.toString();
475
469
  } catch {}
476
470
  return t;
477
471
  }
478
- var V = class {
472
+ var z = class {
479
473
  _process;
480
474
  _aborted = false;
481
475
  _options;
@@ -495,7 +489,7 @@ var V = class {
495
489
  }
496
490
  constructor(e, t, n) {
497
491
  this._options = {
498
- ...F,
492
+ ...P,
499
493
  ...n
500
494
  };
501
495
  this._command = e;
@@ -514,7 +508,7 @@ var V = class {
514
508
  return this._process?.killed === true;
515
509
  }
516
510
  pipe(e, t, n) {
517
- return W(e, t, {
511
+ return H(e, t, {
518
512
  ...n,
519
513
  stdin: this
520
514
  });
@@ -525,18 +519,18 @@ var V = 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 = v(t);
529
- const r = u.createInterface({ input: n });
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 N(this);
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 ? B(this._streamOut) : "", this._streamErr ? B(this._streamErr) : ""]);
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;
542
536
  if (r && typeof r !== "string") await r;
@@ -547,7 +541,7 @@ var V = class {
547
541
  stdout: t,
548
542
  exitCode: this.exitCode
549
543
  };
550
- if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new N(this, i);
544
+ if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new M(this, i);
551
545
  return i;
552
546
  }
553
547
  then(e, t) {
@@ -558,29 +552,28 @@ var V = class {
558
552
  spawn() {
559
553
  const e = cwd();
560
554
  const n = this._options;
561
- const r = {
562
- ...L,
555
+ const i = {
556
+ ...I,
563
557
  ...n.nodeOptions
564
558
  };
565
- const i = [];
559
+ const a = [];
566
560
  this._resetState();
567
- if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
568
- if (n.signal !== void 0) i.push(n.signal);
569
- if (n.persist === true) r.detached = true;
570
- if (i.length > 0) r.signal = z(i);
571
- r.env = _(e, r.env);
572
- const { command: a, args: o } = R(this._command, this._args);
573
- const c = (0, M._parse)(a, o, r);
574
- const l = spawn(c.command, c.args, c.options);
575
- if (l.stderr) this._streamErr = l.stderr;
576
- if (l.stdout) this._streamOut = l.stdout;
577
- this._process = l;
578
- l.once("error", this._onError);
579
- l.once("close", this._onClose);
580
- if (l.stdin) {
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) {
581
574
  const { stdin: e } = n;
582
- if (typeof e === "string") l.stdin.end(e);
583
- else e?.process?.stdout?.pipe(l.stdin);
575
+ if (typeof e === "string") s.stdin.end(e);
576
+ else e?.process?.stdout?.pipe(s.stdin);
584
577
  }
585
578
  }
586
579
  _resetState() {
@@ -601,12 +594,12 @@ var V = class {
601
594
  if (this._resolveClose) this._resolveClose();
602
595
  };
603
596
  };
604
- const U = (e, t, n) => {
605
- const r = new V(e, t, n);
597
+ const V = (e, t, n) => {
598
+ const r = new z(e, t, n);
606
599
  r.spawn();
607
600
  return r;
608
601
  };
609
- const W = U;
602
+ const H = V;
610
603
  var dist_exports = /* @__PURE__ */ __exportAll({
611
604
  addDependency: () => addDependency,
612
605
  addDevDependency: () => addDevDependency,
@@ -661,7 +654,7 @@ function cached(fn) {
661
654
  const hasCorepack = cached(async () => {
662
655
  if (globalThis.process?.versions?.webcontainer) return false;
663
656
  try {
664
- const { exitCode } = await U("corepack", ["--version"]);
657
+ const { exitCode } = await V("corepack", ["--version"]);
665
658
  return exitCode === 0;
666
659
  } catch {
667
660
  return false;
@@ -669,7 +662,7 @@ const hasCorepack = cached(async () => {
669
662
  });
670
663
  async function executeCommand(command, args, options = {}) {
671
664
  const xArgs = command !== "npm" && command !== "bun" && command !== "deno" && options.corepack !== false && await hasCorepack() ? ["corepack", [command, ...args]] : [command, args];
672
- const { exitCode, stdout, stderr } = await U(xArgs[0], xArgs[1], { nodeOptions: {
665
+ const { exitCode, stdout, stderr } = await V(xArgs[0], xArgs[1], { nodeOptions: {
673
666
  cwd: resolve$1(options.cwd || process.cwd()),
674
667
  env: options.env,
675
668
  stdio: options.silent ? "pipe" : "inherit"
@@ -850,4 +843,4 @@ async function addDevDependency(name, options = {}) {
850
843
  dev: true
851
844
  });
852
845
  }
853
- export { dist_exports as t };
846
+ export { dist_exports };