nitro-nightly 3.0.1-20260119-145349-d0c4950f → 3.0.1-20260120-020848-6786d069

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 (70) hide show
  1. package/dist/_build/rolldown.mjs +13 -8
  2. package/dist/_build/vite.build.mjs +1 -1
  3. package/dist/_chunks/dev.mjs +5 -3
  4. package/dist/_chunks/nitro.mjs +24 -1183
  5. package/dist/_chunks/nitro2.mjs +248 -91
  6. package/dist/_chunks/nitro3.mjs +2696 -0
  7. package/dist/_chunks/nitro4.mjs +176 -0
  8. package/dist/_chunks/nitro5.mjs +733 -0
  9. package/dist/_chunks/nitro6.mjs +1458 -0
  10. package/dist/_chunks/nitro7.mjs +7561 -0
  11. package/dist/_chunks/nitro8.mjs +3524 -0
  12. package/dist/_chunks/nitro9.mjs +1729 -0
  13. package/dist/_libs/_.mjs +3 -0
  14. package/dist/_libs/_2.mjs +3 -0
  15. package/dist/_libs/_3.mjs +4 -0
  16. package/dist/_libs/_4.mjs +6 -0
  17. package/dist/_libs/_5.mjs +3 -0
  18. package/dist/_libs/_6.mjs +3 -0
  19. package/dist/_libs/acorn+confbox+js-tokens+magic-string+mlly+pkg-types+sourcemap-codec+strip-literal+unimport.mjs +8900 -0
  20. package/dist/_libs/{c12.mjs → c12+dotenv+rc9.mjs} +12 -105
  21. package/dist/_libs/{chokidar.mjs → chokidar+readdirp.mjs} +2 -9
  22. package/dist/_libs/confbox+exsolve+pkg-types.mjs +1249 -0
  23. package/dist/_libs/confbox.mjs +70 -2488
  24. package/dist/_libs/confbox2.mjs +786 -0
  25. package/dist/_libs/confbox3.mjs +404 -0
  26. package/dist/_libs/confbox4.mjs +3 -0
  27. package/dist/_libs/estree-walker+unimport.mjs +378 -0
  28. package/dist/_libs/fdir+picomatch+tinyglobby.mjs +2471 -0
  29. package/dist/_libs/gen-mapping+remapping+resolve-uri+trace-mapping+unimport+unplugin+unplugin-utils+webpack-virtual-modules.mjs +2150 -0
  30. package/dist/_libs/giget+node-fetch-native.mjs +2692 -0
  31. package/dist/_libs/httpxy.mjs +1 -6
  32. package/dist/_libs/local-pkg+quansync+unimport.mjs +1526 -0
  33. package/dist/_libs/nypm+tinyexec.mjs +858 -0
  34. package/dist/_libs/pathe.mjs +164 -0
  35. package/dist/_libs/perfect-debounce.mjs +89 -0
  36. package/dist/_libs/{@rollup/plugin-inject.mjs → plugin-alias+plugin-inject.mjs} +65 -2
  37. package/dist/_libs/std-env.mjs +158 -0
  38. package/dist/_libs/unimport.mjs +5 -1781
  39. package/dist/_libs/vite-plugin-fullstack.mjs +26 -0
  40. package/dist/_presets.mjs +8 -3
  41. package/dist/builder.mjs +8 -6
  42. package/dist/cli/_chunks/build.mjs +1 -1
  43. package/dist/cli/_chunks/dev.mjs +3 -2
  44. package/dist/cli/_chunks/list.mjs +1 -1
  45. package/dist/cli/_chunks/prepare.mjs +1 -1
  46. package/dist/cli/_chunks/run.mjs +1 -1
  47. package/dist/cli/index.mjs +1 -1
  48. package/dist/types/index.d.mts +2410 -1174
  49. package/dist/vite.d.mts +13 -13
  50. package/dist/vite.mjs +640 -16
  51. package/package.json +9 -9
  52. package/dist/_build/common.mjs +0 -24931
  53. package/dist/_build/rollup.mjs +0 -201
  54. package/dist/_chunks/utils.mjs +0 -254
  55. package/dist/_common.mjs +0 -45
  56. package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +0 -652
  57. package/dist/_libs/@jridgewell/gen-mapping.mjs +0 -448
  58. package/dist/_libs/@jridgewell/remapping.mjs +0 -117
  59. package/dist/_libs/@rollup/plugin-alias.mjs +0 -64
  60. package/dist/_libs/@rollup/plugin-commonjs.mjs +0 -1300
  61. package/dist/_libs/@rollup/plugin-json.mjs +0 -36
  62. package/dist/_libs/@rollup/plugin-node-resolve.mjs +0 -1972
  63. package/dist/_libs/escape-string-regexp.mjs +0 -8
  64. package/dist/_libs/estree-walker.mjs +0 -187
  65. package/dist/_libs/giget.mjs +0 -3550
  66. package/dist/_libs/klona.mjs +0 -38
  67. package/dist/_libs/rou3.mjs +0 -322
  68. package/dist/_libs/tsconfck.mjs +0 -832
  69. package/dist/_libs/ultrahtml.mjs +0 -138
  70. package/dist/cli/_chunks/task.mjs +0 -16
@@ -0,0 +1,378 @@
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 };