nitro-nightly 3.0.1-20260120-020848-6786d069 → 3.0.1-20260120-133205-cbfce96c

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 (92) hide show
  1. package/dist/_build/common.mjs +24931 -0
  2. package/dist/_build/rolldown.mjs +6 -11
  3. package/dist/_build/rollup.mjs +201 -0
  4. package/dist/_build/vite.build.mjs +1 -1
  5. package/dist/_chunks/dev.mjs +4 -6
  6. package/dist/_chunks/nitro.mjs +1183 -24
  7. package/dist/_chunks/nitro2.mjs +91 -248
  8. package/dist/_chunks/utils.mjs +254 -0
  9. package/dist/_common.mjs +45 -0
  10. package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +652 -0
  11. package/dist/_libs/@jridgewell/gen-mapping.mjs +448 -0
  12. package/dist/_libs/@jridgewell/remapping.mjs +117 -0
  13. package/dist/_libs/@rollup/plugin-alias.mjs +64 -0
  14. package/dist/_libs/@rollup/plugin-commonjs.d.mts +241 -0
  15. package/dist/_libs/@rollup/plugin-commonjs.mjs +1300 -0
  16. package/dist/_libs/{plugin-alias+plugin-inject.mjs → @rollup/plugin-inject.mjs} +2 -65
  17. package/dist/_libs/@rollup/plugin-json.mjs +36 -0
  18. package/dist/_libs/@rollup/plugin-node-resolve.mjs +1972 -0
  19. package/dist/_libs/c12.d.mts +214 -0
  20. package/dist/_libs/{c12+dotenv+rc9.mjs → c12.mjs} +105 -12
  21. package/dist/_libs/{chokidar+readdirp.mjs → chokidar.mjs} +8 -1
  22. package/dist/_libs/compatx.d.mts +47 -0
  23. package/dist/_libs/confbox.mjs +2488 -70
  24. package/dist/_libs/esbuild.d.mts +20 -0
  25. package/dist/_libs/escape-string-regexp.mjs +8 -0
  26. package/dist/_libs/estree-walker.mjs +187 -0
  27. package/dist/_libs/giget.mjs +3550 -0
  28. package/dist/_libs/httpxy.d.mts +79 -0
  29. package/dist/_libs/httpxy.mjs +6 -1
  30. package/dist/_libs/klona.mjs +38 -0
  31. package/dist/_libs/magic-string.d.mts +220 -0
  32. package/dist/_libs/mlly.d.mts +57 -0
  33. package/dist/_libs/pkg-types.d.mts +23 -0
  34. package/dist/_libs/rou3.d.mts +43 -0
  35. package/dist/_libs/rou3.mjs +322 -0
  36. package/dist/_libs/std-env.d.mts +4 -0
  37. package/dist/_libs/tsconfck.mjs +832 -0
  38. package/dist/_libs/ultrahtml.mjs +138 -0
  39. package/dist/_libs/unimport.d.mts +426 -0
  40. package/dist/_libs/unimport.mjs +1781 -5
  41. package/dist/_libs/unwasm.d.mts +29 -0
  42. package/dist/_presets.mjs +3 -8
  43. package/dist/builder.mjs +6 -8
  44. package/dist/cli/_chunks/build.mjs +1 -1
  45. package/dist/cli/_chunks/dev.mjs +2 -3
  46. package/dist/cli/_chunks/list.mjs +1 -1
  47. package/dist/cli/_chunks/prepare.mjs +1 -1
  48. package/dist/cli/_chunks/run.mjs +1 -1
  49. package/dist/cli/_chunks/task.mjs +16 -0
  50. package/dist/cli/index.mjs +1 -1
  51. package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -5
  52. package/dist/presets/netlify/runtime/netlify-edge.d.mts +0 -1
  53. package/dist/presets/winterjs/runtime/winterjs.d.mts +0 -1
  54. package/dist/runtime/internal/error/dev.d.mts +0 -1
  55. package/dist/runtime/internal/route-rules.d.mts +0 -4
  56. package/dist/runtime/internal/routes/openapi.d.mts +0 -1
  57. package/dist/runtime/internal/routes/scalar.d.mts +0 -1
  58. package/dist/runtime/internal/routes/swagger.d.mts +0 -1
  59. package/dist/runtime/internal/runtime-config.d.mts +0 -1
  60. package/dist/runtime/nitro.d.mts +0 -3
  61. package/dist/runtime/virtual/renderer-template.d.mts +0 -1
  62. package/dist/types/index.d.mts +36 -1405
  63. package/dist/vite.mjs +18 -641
  64. package/package.json +2 -2
  65. package/dist/_chunks/nitro3.mjs +0 -2696
  66. package/dist/_chunks/nitro4.mjs +0 -176
  67. package/dist/_chunks/nitro5.mjs +0 -733
  68. package/dist/_chunks/nitro6.mjs +0 -1458
  69. package/dist/_chunks/nitro7.mjs +0 -7561
  70. package/dist/_chunks/nitro8.mjs +0 -3524
  71. package/dist/_chunks/nitro9.mjs +0 -1729
  72. package/dist/_libs/_.mjs +0 -3
  73. package/dist/_libs/_2.mjs +0 -3
  74. package/dist/_libs/_3.mjs +0 -4
  75. package/dist/_libs/_4.mjs +0 -6
  76. package/dist/_libs/_5.mjs +0 -3
  77. package/dist/_libs/_6.mjs +0 -3
  78. package/dist/_libs/acorn+confbox+js-tokens+magic-string+mlly+pkg-types+sourcemap-codec+strip-literal+unimport.mjs +0 -8900
  79. package/dist/_libs/confbox+exsolve+pkg-types.mjs +0 -1249
  80. package/dist/_libs/confbox2.mjs +0 -786
  81. package/dist/_libs/confbox3.mjs +0 -404
  82. package/dist/_libs/confbox4.mjs +0 -3
  83. package/dist/_libs/estree-walker+unimport.mjs +0 -378
  84. package/dist/_libs/fdir+picomatch+tinyglobby.mjs +0 -2471
  85. package/dist/_libs/gen-mapping+remapping+resolve-uri+trace-mapping+unimport+unplugin+unplugin-utils+webpack-virtual-modules.mjs +0 -2150
  86. package/dist/_libs/giget+node-fetch-native.mjs +0 -2692
  87. package/dist/_libs/local-pkg+quansync+unimport.mjs +0 -1526
  88. package/dist/_libs/nypm+tinyexec.mjs +0 -858
  89. package/dist/_libs/pathe.mjs +0 -164
  90. package/dist/_libs/perfect-debounce.mjs +0 -89
  91. package/dist/_libs/std-env.mjs +0 -158
  92. package/dist/_libs/vite-plugin-fullstack.mjs +0 -26
@@ -1,378 +0,0 @@
1
- import "../_chunks/nitro.mjs";
2
- import { I as parse, s as getMagicString } from "./acorn+confbox+js-tokens+magic-string+mlly+pkg-types+sourcemap-codec+strip-literal+unimport.mjs";
3
- import "node:path";
4
- import "node:process";
5
- import "scule";
6
-
7
- //#region node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/walker.js
8
- /**
9
- * @typedef { import('estree').Node} Node
10
- * @typedef {{
11
- * skip: () => void;
12
- * remove: () => void;
13
- * replace: (node: Node) => void;
14
- * }} WalkerContext
15
- */
16
- var WalkerBase = class {
17
- constructor() {
18
- /** @type {boolean} */
19
- this.should_skip = false;
20
- /** @type {boolean} */
21
- this.should_remove = false;
22
- /** @type {Node | null} */
23
- this.replacement = null;
24
- /** @type {WalkerContext} */
25
- this.context = {
26
- skip: () => this.should_skip = true,
27
- remove: () => this.should_remove = true,
28
- replace: (node) => this.replacement = node
29
- };
30
- }
31
- /**
32
- * @template {Node} Parent
33
- * @param {Parent | null | undefined} parent
34
- * @param {keyof Parent | null | undefined} prop
35
- * @param {number | null | undefined} index
36
- * @param {Node} node
37
- */
38
- replace(parent, prop, index, node) {
39
- if (parent && prop) if (index != null)
40
- /** @type {Array<Node>} */ parent[prop][index] = node;
41
- else
42
- /** @type {Node} */ parent[prop] = node;
43
- }
44
- /**
45
- * @template {Node} Parent
46
- * @param {Parent | null | undefined} parent
47
- * @param {keyof Parent | null | undefined} prop
48
- * @param {number | null | undefined} index
49
- */
50
- remove(parent, prop, index) {
51
- if (parent && prop) if (index !== null && index !== void 0)
52
- /** @type {Array<Node>} */ parent[prop].splice(index, 1);
53
- else delete parent[prop];
54
- }
55
- };
56
-
57
- //#endregion
58
- //#region node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/sync.js
59
- /**
60
- * @typedef { import('estree').Node} Node
61
- * @typedef { import('./walker.js').WalkerContext} WalkerContext
62
- * @typedef {(
63
- * this: WalkerContext,
64
- * node: Node,
65
- * parent: Node | null,
66
- * key: string | number | symbol | null | undefined,
67
- * index: number | null | undefined
68
- * ) => void} SyncHandler
69
- */
70
- var SyncWalker = class extends WalkerBase {
71
- /**
72
- *
73
- * @param {SyncHandler} [enter]
74
- * @param {SyncHandler} [leave]
75
- */
76
- constructor(enter, leave) {
77
- super();
78
- /** @type {boolean} */
79
- this.should_skip = false;
80
- /** @type {boolean} */
81
- this.should_remove = false;
82
- /** @type {Node | null} */
83
- this.replacement = null;
84
- /** @type {WalkerContext} */
85
- this.context = {
86
- skip: () => this.should_skip = true,
87
- remove: () => this.should_remove = true,
88
- replace: (node) => this.replacement = node
89
- };
90
- /** @type {SyncHandler | undefined} */
91
- this.enter = enter;
92
- /** @type {SyncHandler | undefined} */
93
- this.leave = leave;
94
- }
95
- /**
96
- * @template {Node} Parent
97
- * @param {Node} node
98
- * @param {Parent | null} parent
99
- * @param {keyof Parent} [prop]
100
- * @param {number | null} [index]
101
- * @returns {Node | null}
102
- */
103
- visit(node, parent, prop, index) {
104
- if (node) {
105
- if (this.enter) {
106
- const _should_skip = this.should_skip;
107
- const _should_remove = this.should_remove;
108
- const _replacement = this.replacement;
109
- this.should_skip = false;
110
- this.should_remove = false;
111
- this.replacement = null;
112
- this.enter.call(this.context, node, parent, prop, index);
113
- if (this.replacement) {
114
- node = this.replacement;
115
- this.replace(parent, prop, index, node);
116
- }
117
- if (this.should_remove) this.remove(parent, prop, index);
118
- const skipped = this.should_skip;
119
- const removed = this.should_remove;
120
- this.should_skip = _should_skip;
121
- this.should_remove = _should_remove;
122
- this.replacement = _replacement;
123
- if (skipped) return node;
124
- if (removed) return null;
125
- }
126
- /** @type {keyof Node} */
127
- let key;
128
- for (key in node) {
129
- /** @type {unknown} */
130
- const value = node[key];
131
- if (value && typeof value === "object") {
132
- if (Array.isArray(value)) {
133
- const nodes = value;
134
- for (let i = 0; i < nodes.length; i += 1) {
135
- const item = nodes[i];
136
- if (isNode(item)) {
137
- if (!this.visit(item, node, key, i)) i--;
138
- }
139
- }
140
- } else if (isNode(value)) this.visit(value, node, key, null);
141
- }
142
- }
143
- if (this.leave) {
144
- const _replacement = this.replacement;
145
- const _should_remove = this.should_remove;
146
- this.replacement = null;
147
- this.should_remove = false;
148
- this.leave.call(this.context, node, parent, prop, index);
149
- if (this.replacement) {
150
- node = this.replacement;
151
- this.replace(parent, prop, index, node);
152
- }
153
- if (this.should_remove) this.remove(parent, prop, index);
154
- const removed = this.should_remove;
155
- this.replacement = _replacement;
156
- this.should_remove = _should_remove;
157
- if (removed) return null;
158
- }
159
- }
160
- return node;
161
- }
162
- };
163
- /**
164
- * Ducktype a node.
165
- *
166
- * @param {unknown} value
167
- * @returns {value is Node}
168
- */
169
- function isNode(value) {
170
- return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
171
- }
172
-
173
- //#endregion
174
- //#region node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/index.js
175
- /**
176
- * @typedef {import('estree').Node} Node
177
- * @typedef {import('./sync.js').SyncHandler} SyncHandler
178
- * @typedef {import('./async.js').AsyncHandler} AsyncHandler
179
- */
180
- /**
181
- * @param {Node} ast
182
- * @param {{
183
- * enter?: SyncHandler
184
- * leave?: SyncHandler
185
- * }} walker
186
- * @returns {Node | null}
187
- */
188
- function walk(ast, { enter, leave }) {
189
- return new SyncWalker(enter, leave).visit(ast, null);
190
- }
191
-
192
- //#endregion
193
- //#region node_modules/.pnpm/unimport@5.6.0/node_modules/unimport/dist/chunks/detect-acorn.mjs
194
- async function detectImportsAcorn(code, ctx, options) {
195
- const s = getMagicString(code);
196
- const map = await ctx.getImportMap();
197
- let matchedImports = [];
198
- const enableAutoImport = options?.autoImport !== false;
199
- const enableTransformVirtualImports = options?.transformVirtualImports !== false && ctx.options.virtualImports?.length;
200
- if (enableAutoImport || enableTransformVirtualImports) {
201
- const ast = parse(s.original, {
202
- sourceType: "module",
203
- ecmaVersion: "latest",
204
- locations: true
205
- });
206
- const virtualImports = createVirtualImportsAcronWalker(map, ctx.options.virtualImports);
207
- const scopes = traveseScopes(ast, enableTransformVirtualImports ? virtualImports.walk : {});
208
- if (enableAutoImport) {
209
- const identifiers = scopes.unmatched;
210
- matchedImports.push(...Array.from(identifiers).map((name) => {
211
- const item = map.get(name);
212
- if (item && !item.disabled) return item;
213
- return null;
214
- }).filter(Boolean));
215
- for (const addon of ctx.addons) matchedImports = await addon.matchImports?.call(ctx, identifiers, matchedImports) || matchedImports;
216
- }
217
- virtualImports.ranges.forEach(([start, end]) => {
218
- s.remove(start, end);
219
- });
220
- matchedImports.push(...virtualImports.imports);
221
- }
222
- return {
223
- s,
224
- strippedCode: code.toString(),
225
- matchedImports,
226
- isCJSContext: false,
227
- firstOccurrence: 0
228
- };
229
- }
230
- function traveseScopes(ast, additionalWalk) {
231
- const scopes = [];
232
- let scopeCurrent = void 0;
233
- const scopesStack = [];
234
- function pushScope(node) {
235
- scopeCurrent = {
236
- node,
237
- parent: scopeCurrent,
238
- declarations: /* @__PURE__ */ new Set(),
239
- references: /* @__PURE__ */ new Set()
240
- };
241
- scopes.push(scopeCurrent);
242
- scopesStack.push(scopeCurrent);
243
- }
244
- function popScope(node) {
245
- if (scopesStack.pop()?.node !== node) throw new Error("Scope mismatch");
246
- scopeCurrent = scopesStack[scopesStack.length - 1];
247
- }
248
- pushScope(void 0);
249
- walk(ast, {
250
- enter(node, parent, prop, index) {
251
- additionalWalk?.enter?.call(this, node, parent, prop, index);
252
- switch (node.type) {
253
- case "ImportSpecifier":
254
- case "ImportDefaultSpecifier":
255
- case "ImportNamespaceSpecifier":
256
- scopeCurrent.declarations.add(node.local.name);
257
- return;
258
- case "FunctionDeclaration":
259
- case "ClassDeclaration":
260
- if (node.id) scopeCurrent.declarations.add(node.id.name);
261
- return;
262
- case "VariableDeclarator":
263
- if (node.id.type === "Identifier") scopeCurrent.declarations.add(node.id.name);
264
- else walk(node.id, { enter(node2) {
265
- if (node2.type === "ObjectPattern") node2.properties.forEach((i) => {
266
- if (i.type === "Property" && i.value.type === "Identifier") scopeCurrent.declarations.add(i.value.name);
267
- else if (i.type === "RestElement" && i.argument.type === "Identifier") scopeCurrent.declarations.add(i.argument.name);
268
- });
269
- else if (node2.type === "ArrayPattern") node2.elements.forEach((i) => {
270
- if (i?.type === "Identifier") scopeCurrent.declarations.add(i.name);
271
- if (i?.type === "RestElement" && i.argument.type === "Identifier") scopeCurrent.declarations.add(i.argument.name);
272
- });
273
- } });
274
- return;
275
- case "BlockStatement":
276
- switch (parent?.type) {
277
- case "FunctionDeclaration":
278
- case "ArrowFunctionExpression":
279
- case "FunctionExpression": {
280
- const parameterIdentifiers = parent.params.filter((p) => p.type === "Identifier");
281
- for (const id of parameterIdentifiers) scopeCurrent.declarations.add(id.name);
282
- break;
283
- }
284
- }
285
- pushScope(node);
286
- return;
287
- case "Identifier":
288
- switch (parent?.type) {
289
- case "CallExpression":
290
- if (parent.callee === node || parent.arguments.includes(node)) scopeCurrent.references.add(node.name);
291
- return;
292
- case "MemberExpression":
293
- if (parent.object === node) scopeCurrent.references.add(node.name);
294
- return;
295
- case "VariableDeclarator":
296
- if (parent.init === node) scopeCurrent.references.add(node.name);
297
- return;
298
- case "SpreadElement":
299
- if (parent.argument === node) scopeCurrent.references.add(node.name);
300
- return;
301
- case "ClassDeclaration":
302
- if (parent.superClass === node) scopeCurrent.references.add(node.name);
303
- return;
304
- case "Property":
305
- if (parent.value === node) scopeCurrent.references.add(node.name);
306
- return;
307
- case "TemplateLiteral":
308
- if (parent.expressions.includes(node)) scopeCurrent.references.add(node.name);
309
- return;
310
- case "AssignmentExpression":
311
- if (parent.right === node) scopeCurrent.references.add(node.name);
312
- return;
313
- case "IfStatement":
314
- case "WhileStatement":
315
- case "DoWhileStatement":
316
- if (parent.test === node) scopeCurrent.references.add(node.name);
317
- return;
318
- case "SwitchStatement":
319
- if (parent.discriminant === node) scopeCurrent.references.add(node.name);
320
- return;
321
- }
322
- if (parent?.type.includes("Expression")) scopeCurrent.references.add(node.name);
323
- }
324
- },
325
- leave(node, parent, prop, index) {
326
- additionalWalk?.leave?.call(this, node, parent, prop, index);
327
- switch (node.type) {
328
- case "BlockStatement": popScope(node);
329
- }
330
- }
331
- });
332
- const unmatched = /* @__PURE__ */ new Set();
333
- for (const scope of scopes) for (const name of scope.references) {
334
- let defined = false;
335
- let parent = scope;
336
- while (parent) {
337
- if (parent.declarations.has(name)) {
338
- defined = true;
339
- break;
340
- }
341
- parent = parent?.parent;
342
- }
343
- if (!defined) unmatched.add(name);
344
- }
345
- return {
346
- unmatched,
347
- scopes
348
- };
349
- }
350
- function createVirtualImportsAcronWalker(importMap, virtualImports = []) {
351
- const imports = [];
352
- const ranges = [];
353
- return {
354
- imports,
355
- ranges,
356
- walk: { enter(node) {
357
- if (node.type === "ImportDeclaration") {
358
- if (virtualImports.includes(node.source.value)) {
359
- ranges.push([node.start, node.end]);
360
- node.specifiers.forEach((i) => {
361
- if (i.type === "ImportSpecifier" && i.imported.type === "Identifier") {
362
- const original = importMap.get(i.imported.name);
363
- if (!original) throw new Error(`[unimport] failed to find "${i.imported.name}" imported from "${node.source.value}"`);
364
- imports.push({
365
- from: original.from,
366
- name: original.name,
367
- as: i.local.name
368
- });
369
- }
370
- });
371
- }
372
- }
373
- } }
374
- };
375
- }
376
-
377
- //#endregion
378
- export { detectImportsAcorn };