nitro-nightly 3.1.0-20251028-004953-57503e42 → 3.1.0-20251028-090722-437659e4

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 (155) hide show
  1. package/dist/_build/assets.mjs +235 -0
  2. package/dist/_build/build.mjs +21 -0
  3. package/dist/_build/config.mjs +124 -0
  4. package/dist/_build/info.mjs +39 -0
  5. package/dist/_build/plugins.mjs +1041 -0
  6. package/dist/_build/prepare.mjs +17 -0
  7. package/dist/{_chunks/build2.mjs → _build/rolldown.mjs} +238 -64
  8. package/dist/_build/rollup.mjs +404 -0
  9. package/dist/_build/snapshot.mjs +61 -0
  10. package/dist/_build/types.mjs +268 -0
  11. package/dist/_build/vite.mjs +3266 -0
  12. package/dist/{cli → _cli}/build.mjs +2 -3
  13. package/dist/_cli/dev.mjs +205 -0
  14. package/dist/{cli/index2.mjs → _cli/index.mjs} +1 -2
  15. package/dist/{cli → _cli}/list.mjs +2 -3
  16. package/dist/{cli → _cli}/prepare.mjs +2 -3
  17. package/dist/{cli → _cli}/run.mjs +2 -3
  18. package/dist/_deps/@jridgewell/gen-mapping.mjs +189 -0
  19. package/dist/_deps/@jridgewell/remapping.mjs +137 -0
  20. package/dist/_deps/@jridgewell/resolve-uri.mjs +231 -0
  21. package/dist/_deps/@jridgewell/sourcemap-codec.mjs +173 -0
  22. package/dist/_deps/@jridgewell/trace-mapping.mjs +170 -0
  23. package/dist/_deps/@pi0/vite-plugin-fullstack.mjs +575 -0
  24. package/dist/_deps/@rollup/plugin-alias.mjs +89 -0
  25. package/dist/_deps/@rollup/plugin-commonjs.mjs +2376 -0
  26. package/dist/{_chunks/index2.mjs → _deps/@rollup/plugin-inject.mjs} +5 -90
  27. package/dist/_deps/@rollup/plugin-json.mjs +37 -0
  28. package/dist/_deps/@rollup/plugin-node-resolve.mjs +1386 -0
  29. package/dist/_deps/@rollup/plugin-replace.mjs +133 -0
  30. package/dist/_deps/@rollup/pluginutils.mjs +346 -0
  31. package/dist/_deps/acorn.mjs +6225 -0
  32. package/dist/_deps/c12.mjs +510 -0
  33. package/dist/_deps/chokidar.mjs +1428 -0
  34. package/dist/_deps/citty.mjs +460 -0
  35. package/dist/_deps/commondir.mjs +77 -0
  36. package/dist/_deps/compatx.mjs +76 -0
  37. package/dist/_deps/confbox.mjs +300 -0
  38. package/dist/_deps/debug.mjs +885 -0
  39. package/dist/_deps/deepmerge.mjs +147 -0
  40. package/dist/_deps/depd.mjs +550 -0
  41. package/dist/_deps/dot-prop.mjs +282 -0
  42. package/dist/_deps/dotenv.mjs +555 -0
  43. package/dist/_deps/duplexer.mjs +1 -0
  44. package/dist/_deps/ee-first.mjs +104 -0
  45. package/dist/_deps/encodeurl.mjs +69 -0
  46. package/dist/_deps/escape-html.mjs +87 -0
  47. package/dist/_deps/escape-string-regexp.mjs +13 -0
  48. package/dist/_deps/estree-walker.mjs +433 -0
  49. package/dist/_deps/etag.mjs +147 -0
  50. package/dist/_deps/exsolve.mjs +1416 -0
  51. package/dist/_deps/fdir.mjs +569 -0
  52. package/dist/_deps/fresh.mjs +145 -0
  53. package/dist/_deps/function-bind.mjs +106 -0
  54. package/dist/{_chunks/index4.mjs → _deps/giget.mjs} +21 -776
  55. package/dist/_deps/gzip-size.mjs +19 -0
  56. package/dist/_deps/hasown.mjs +19 -0
  57. package/dist/_deps/http-errors.mjs +307 -0
  58. package/dist/_deps/httpxy.mjs +580 -0
  59. package/dist/_deps/inherits.mjs +57 -0
  60. package/dist/_deps/is-core-module.mjs +596 -0
  61. package/dist/_deps/is-module.mjs +25 -0
  62. package/dist/_deps/is-reference.mjs +31 -0
  63. package/dist/_deps/js-tokens.mjs +411 -0
  64. package/dist/_deps/knitwork.mjs +172 -0
  65. package/dist/_deps/local-pkg.mjs +163 -0
  66. package/dist/_deps/magic-string.mjs +1296 -0
  67. package/dist/_deps/mime-db.mjs +11685 -0
  68. package/dist/_deps/mime-types.mjs +287 -0
  69. package/dist/_deps/mime.mjs +1172 -0
  70. package/dist/_deps/mlly.mjs +2413 -0
  71. package/dist/_deps/ms.mjs +172 -0
  72. package/dist/_deps/node-fetch-native.mjs +3 -0
  73. package/dist/_deps/nypm.mjs +219 -0
  74. package/dist/_deps/on-finished.mjs +246 -0
  75. package/dist/_deps/parseurl.mjs +168 -0
  76. package/dist/_deps/path-parse.mjs +85 -0
  77. package/dist/{_chunks/pathe.M-eThtNZ.mjs → _deps/pathe.mjs} +48 -1
  78. package/dist/_deps/perfect-debounce.mjs +88 -0
  79. package/dist/_deps/picomatch.mjs +2144 -0
  80. package/dist/_deps/pkg-types.mjs +247 -0
  81. package/dist/_deps/pretty-bytes.mjs +180 -0
  82. package/dist/_deps/quansync.mjs +99 -0
  83. package/dist/_deps/range-parser.mjs +171 -0
  84. package/dist/_deps/rc9.mjs +219 -0
  85. package/dist/_deps/readdirp.mjs +245 -0
  86. package/dist/_deps/resolve.mjs +1260 -0
  87. package/dist/_deps/rou3.mjs +326 -0
  88. package/dist/_deps/send.mjs +1022 -0
  89. package/dist/_deps/serve-static.mjs +228 -0
  90. package/dist/_deps/setprototypeof.mjs +26 -0
  91. package/dist/_deps/statuses.mjs +457 -0
  92. package/dist/_deps/strip-literal.mjs +67 -0
  93. package/dist/_deps/supports-color.mjs +44 -0
  94. package/dist/_deps/tinyexec.mjs +552 -0
  95. package/dist/_deps/tinyglobby.mjs +293 -0
  96. package/dist/_deps/toidentifier.mjs +41 -0
  97. package/dist/_deps/ultrahtml.mjs +3 -0
  98. package/dist/_deps/unimport.mjs +2267 -0
  99. package/dist/_deps/unplugin-utils.mjs +65 -0
  100. package/dist/_deps/unplugin.mjs +1294 -0
  101. package/dist/_deps/untyped.mjs +375 -0
  102. package/dist/{_chunks/info.mjs → _deps/unwasm.mjs} +8 -4122
  103. package/dist/_deps/webpack-virtual-modules.mjs +360 -0
  104. package/dist/_presets/_all.mjs +59 -0
  105. package/dist/_presets/_nitro.mjs +74 -0
  106. package/dist/_presets/_resolve.mjs +64 -0
  107. package/dist/_presets/_static.mjs +69 -0
  108. package/dist/_presets/_types.mjs +3 -0
  109. package/dist/_presets/_utils.mjs +31 -0
  110. package/dist/_presets/alwaysdata.mjs +17 -0
  111. package/dist/_presets/aws-amplify.mjs +111 -0
  112. package/dist/_presets/aws-lambda.mjs +23 -0
  113. package/dist/_presets/azure.mjs +162 -0
  114. package/dist/_presets/bun.mjs +19 -0
  115. package/dist/_presets/cleavr.mjs +15 -0
  116. package/dist/_presets/cloudflare.mjs +608 -0
  117. package/dist/_presets/deno.mjs +196 -0
  118. package/dist/_presets/digitalocean.mjs +14 -0
  119. package/dist/_presets/firebase.mjs +47 -0
  120. package/dist/_presets/flightcontrol.mjs +14 -0
  121. package/dist/_presets/genezio.mjs +13 -0
  122. package/dist/_presets/heroku.mjs +14 -0
  123. package/dist/_presets/iis.mjs +194 -0
  124. package/dist/_presets/index.mjs +62 -0
  125. package/dist/_presets/koyeb.mjs +14 -0
  126. package/dist/_presets/netlify.mjs +241 -0
  127. package/dist/_presets/node.mjs +54 -0
  128. package/dist/_presets/platform.mjs +14 -0
  129. package/dist/_presets/render.mjs +14 -0
  130. package/dist/_presets/standard.mjs +23 -0
  131. package/dist/_presets/stormkit.mjs +18 -0
  132. package/dist/_presets/vercel.mjs +365 -0
  133. package/dist/_presets/winterjs.mjs +22 -0
  134. package/dist/_presets/zeabur.mjs +69 -0
  135. package/dist/_presets/zerops.mjs +27 -0
  136. package/dist/cli/index.mjs +7 -464
  137. package/dist/index.mjs +122 -34
  138. package/dist/vite.mjs +118 -44
  139. package/package.json +1 -1
  140. package/dist/_chunks/app.mjs +0 -19797
  141. package/dist/_chunks/build.mjs +0 -86
  142. package/dist/_chunks/build3.mjs +0 -6538
  143. package/dist/_chunks/detect-acorn.mjs +0 -503
  144. package/dist/_chunks/index.mjs +0 -22256
  145. package/dist/_chunks/index3.mjs +0 -1062
  146. package/dist/_chunks/json5.mjs +0 -68
  147. package/dist/_chunks/jsonc.mjs +0 -51
  148. package/dist/_chunks/plugin.mjs +0 -1560
  149. package/dist/_chunks/server.mjs +0 -254
  150. package/dist/_chunks/snapshot.mjs +0 -376
  151. package/dist/_chunks/toml.mjs +0 -259
  152. package/dist/_chunks/yaml.mjs +0 -86
  153. package/dist/cli/dev.mjs +0 -95
  154. package/dist/presets.mjs +0 -2494
  155. /package/dist/{cli → _cli}/common.mjs +0 -0
@@ -0,0 +1,17 @@
1
+ import fsp from 'node:fs/promises';
2
+
3
+ async function prepare(nitro) {
4
+ await prepareDir(nitro.options.output.dir);
5
+ if (!nitro.options.noPublicDir) {
6
+ await prepareDir(nitro.options.output.publicDir);
7
+ }
8
+ if (!nitro.options.static) {
9
+ await prepareDir(nitro.options.output.serverDir);
10
+ }
11
+ }
12
+ async function prepareDir(dir) {
13
+ await fsp.rm(dir, { recursive: true, force: true });
14
+ await fsp.mkdir(dir, { recursive: true });
15
+ }
16
+
17
+ export { prepare as p };
@@ -1,69 +1,238 @@
1
- import { r as resolveModulePath, s as sanitizeFilePath, a as scanHandlers, f as formatCompatibilityDate } from './index.mjs';
1
+ import { s as sanitizeFilePath } from '../_deps/mlly.mjs';
2
+ import { r as resolveModulePath } from '../_deps/exsolve.mjs';
2
3
  import { runtimeDir } from 'nitro/runtime/meta';
3
- import { b as baseBuildConfig, d as baseBuildPlugins, r as replace, e as writeBuildInfo } from './info.mjs';
4
+ import { b as baseBuildConfig } from './config.mjs';
5
+ import { b as baseBuildPlugins, r as replace, a as raw } from './plugins.mjs';
4
6
  import { builtinModules } from 'node:module';
5
7
  import { defu } from 'defu';
6
- import { r as raw, n as nitroServerName, s as snapshot, g as generateFSTree } from './snapshot.mjs';
7
- import { n as normalize, j as join, a as relative } from './pathe.M-eThtNZ.mjs';
8
- import { d as debounce, w as watch } from './app.mjs';
9
- import { watch as watch$1 } from 'node:fs';
10
- import { w as writeTypes } from './index3.mjs';
11
- import 'consola';
12
- import 'hookable';
13
- import 'node:fs/promises';
14
- import 'node:url';
15
- import 'node:os';
16
- import 'node:path';
17
- import 'node:assert';
18
- import 'node:process';
19
- import 'node:v8';
20
- import 'node:util';
21
- import 'jiti';
22
- import 'destr';
23
- import 'fs';
24
- import 'path';
25
- import 'os';
26
- import 'crypto';
27
- import 'klona/full';
28
- import 'std-env';
29
- import 'ufo';
30
- import 'ofetch';
31
- import 'klona';
32
- import 'unstorage';
33
- import 'ohash';
34
- import 'scule';
35
- import 'url';
36
- import 'module';
37
- import 'consola/utils';
38
- import 'node:zlib';
39
- import 'unenv';
40
- import 'node:buffer';
41
- import 'node:querystring';
42
- import 'constants';
43
- import 'node:crypto';
44
- import 'db0';
45
- import 'esbuild';
46
- import 'nf3';
47
- import 'rendu';
48
- import 'nitro/meta';
49
- import 'node:stream';
50
- import 'stream';
51
- import 'node:worker_threads';
52
- import 'fs/promises';
53
- import 'events';
54
- import 'h3';
55
- import 'tty';
56
- import 'util';
57
- import 'node:http';
58
- import 'node:https';
59
- import 'node:events';
60
- import 'undici';
61
- import 'youch-core';
62
- import 'youch';
63
- import 'source-map';
64
- import 'srvx';
65
- import './server.mjs';
66
- import 'srvx/node';
8
+ import { j as join, r as relative, a as resolve, d as dirname, n as normalize } from '../_deps/pathe.mjs';
9
+ import { watch } from '../_deps/chokidar.mjs';
10
+ import { promises, watch as watch$1 } from 'node:fs';
11
+ import { d as debounce } from '../_deps/perfect-debounce.mjs';
12
+ import { g as glob } from '../_deps/tinyglobby.mjs';
13
+ import { withLeadingSlash, withoutTrailingSlash, withBase } from 'ufo';
14
+ import { upperFirst } from 'scule';
15
+ import { w as writeTypes } from './types.mjs';
16
+ import { f as formatCompatibilityDate } from '../_deps/compatx.mjs';
17
+ import { colors } from 'consola/utils';
18
+ import { g as gzipSize } from '../_deps/gzip-size.mjs';
19
+ import { p as prettyBytes } from '../_deps/pretty-bytes.mjs';
20
+ import { isTest } from 'std-env';
21
+ import { s as snapshot } from './snapshot.mjs';
22
+ import { w as writeBuildInfo } from './info.mjs';
23
+
24
+ const GLOB_SCAN_PATTERN = "**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}";
25
+ const suffixRegex = /(\.(?<method>connect|delete|get|head|options|patch|post|put|trace))?(\.(?<env>dev|prod|prerender))?$/;
26
+ async function scanAndSyncOptions(nitro) {
27
+ const scannedPlugins = await scanPlugins(nitro);
28
+ for (const plugin of scannedPlugins) {
29
+ if (!nitro.options.plugins.includes(plugin)) {
30
+ nitro.options.plugins.push(plugin);
31
+ }
32
+ }
33
+ if (nitro.options.experimental.tasks) {
34
+ const scannedTasks = await scanTasks(nitro);
35
+ for (const scannedTask of scannedTasks) {
36
+ if (scannedTask.name in nitro.options.tasks) {
37
+ if (!nitro.options.tasks[scannedTask.name].handler) {
38
+ nitro.options.tasks[scannedTask.name].handler = scannedTask.handler;
39
+ }
40
+ } else {
41
+ nitro.options.tasks[scannedTask.name] = {
42
+ handler: scannedTask.handler,
43
+ description: ""
44
+ };
45
+ }
46
+ }
47
+ }
48
+ const scannedModules = await scanModules(nitro);
49
+ nitro.options.modules = nitro.options.modules || [];
50
+ for (const modPath of scannedModules) {
51
+ if (!nitro.options.modules.includes(modPath)) {
52
+ nitro.options.modules.push(modPath);
53
+ }
54
+ }
55
+ }
56
+ async function scanHandlers(nitro) {
57
+ const middleware = await scanMiddleware(nitro);
58
+ const handlers = await Promise.all([
59
+ scanServerRoutes(
60
+ nitro,
61
+ nitro.options.apiDir || "api",
62
+ nitro.options.apiBaseURL || "/api"
63
+ ),
64
+ scanServerRoutes(nitro, nitro.options.routesDir || "routes")
65
+ ]).then((r) => r.flat());
66
+ nitro.scannedHandlers = [
67
+ ...middleware,
68
+ ...handlers.filter((h, index, array) => {
69
+ return array.findIndex(
70
+ (h2) => h.route === h2.route && h.method === h2.method && h.env === h2.env
71
+ ) === index;
72
+ })
73
+ ];
74
+ return handlers;
75
+ }
76
+ async function scanMiddleware(nitro) {
77
+ const files = await scanFiles(nitro, "middleware");
78
+ return files.map((file) => {
79
+ return {
80
+ route: "/**",
81
+ middleware: true,
82
+ handler: file.fullPath
83
+ };
84
+ });
85
+ }
86
+ async function scanServerRoutes(nitro, dir, prefix = "/") {
87
+ const files = await scanFiles(nitro, dir);
88
+ return files.map((file) => {
89
+ let route = file.path.replace(/\.[A-Za-z]+$/, "").replace(/\(([^(/\\]+)\)[/\\]/g, "").replace(/\[\.{3}]/g, "**").replace(/\[\.{3}(\w+)]/g, "**:$1").replace(/\[([^/\]]+)]/g, ":$1");
90
+ route = withLeadingSlash(withoutTrailingSlash(withBase(route, prefix)));
91
+ const suffixMatch = route.match(suffixRegex);
92
+ let method;
93
+ let env;
94
+ if (suffixMatch?.index && suffixMatch?.index >= 0) {
95
+ route = route.slice(0, suffixMatch.index);
96
+ method = suffixMatch.groups?.method;
97
+ env = suffixMatch.groups?.env;
98
+ }
99
+ route = route.replace(/\/index$/, "") || "/";
100
+ return {
101
+ handler: file.fullPath,
102
+ lazy: true,
103
+ middleware: false,
104
+ route,
105
+ method,
106
+ env
107
+ };
108
+ });
109
+ }
110
+ async function scanPlugins(nitro) {
111
+ const files = await scanFiles(nitro, "plugins");
112
+ return files.map((f) => f.fullPath);
113
+ }
114
+ async function scanTasks(nitro) {
115
+ const files = await scanFiles(nitro, "tasks");
116
+ return files.map((f) => {
117
+ const name = f.path.replace(/\/index$/, "").replace(/\.[A-Za-z]+$/, "").replace(/\//g, ":");
118
+ return { name, handler: f.fullPath };
119
+ });
120
+ }
121
+ async function scanModules(nitro) {
122
+ const files = await scanFiles(nitro, "modules");
123
+ return files.map((f) => f.fullPath);
124
+ }
125
+ async function scanFiles(nitro, name) {
126
+ const files = await Promise.all(
127
+ nitro.options.scanDirs.map((dir) => scanDir(nitro, dir, name))
128
+ ).then((r) => r.flat());
129
+ return files;
130
+ }
131
+ async function scanDir(nitro, dir, name) {
132
+ const fileNames = await glob(join(name, GLOB_SCAN_PATTERN), {
133
+ cwd: dir,
134
+ dot: true,
135
+ ignore: nitro.options.ignore,
136
+ absolute: true
137
+ }).catch((error) => {
138
+ if (error?.code === "ENOTDIR") {
139
+ nitro.logger.warn(
140
+ `Ignoring \`${join(dir, name)}\`. It must be a directory.`
141
+ );
142
+ return [];
143
+ }
144
+ throw error;
145
+ });
146
+ return fileNames.map((fullPath) => {
147
+ return {
148
+ fullPath,
149
+ path: relative(join(dir, name), fullPath)
150
+ };
151
+ }).sort((a, b) => a.path.localeCompare(b.path));
152
+ }
153
+
154
+ async function runParallel(inputs, cb, opts) {
155
+ const tasks = /* @__PURE__ */ new Set();
156
+ function queueNext() {
157
+ const route = inputs.values().next().value;
158
+ if (!route) {
159
+ return;
160
+ }
161
+ inputs.delete(route);
162
+ const task = (opts.interval ? new Promise((resolve) => setTimeout(resolve, opts.interval)) : Promise.resolve()).then(() => cb(route)).catch((error) => {
163
+ console.error(error);
164
+ });
165
+ tasks.add(task);
166
+ return task.then(() => {
167
+ tasks.delete(task);
168
+ if (inputs.size > 0) {
169
+ return refillQueue();
170
+ }
171
+ });
172
+ }
173
+ function refillQueue() {
174
+ const workers = Math.min(opts.concurrency - tasks.size, inputs.size);
175
+ return Promise.all(Array.from({ length: workers }, () => queueNext()));
176
+ }
177
+ await refillQueue();
178
+ }
179
+
180
+ function nitroServerName(nitro) {
181
+ return nitro.options.framework.name === "nitro" ? "Nitro Server" : `${upperFirst(nitro.options.framework.name)} Nitro server`;
182
+ }
183
+
184
+ async function generateFSTree(dir, options = {}) {
185
+ if (isTest) {
186
+ return;
187
+ }
188
+ const files = await glob("**/*.*", { cwd: dir, ignore: ["*.map"] });
189
+ const items = [];
190
+ await runParallel(
191
+ new Set(files),
192
+ async (file) => {
193
+ const path = resolve(dir, file);
194
+ const src = await promises.readFile(path);
195
+ const size = src.byteLength;
196
+ const gzip = options.compressedSizes ? await gzipSize(src) : 0;
197
+ items.push({ file, path, size, gzip });
198
+ },
199
+ { concurrency: 10 }
200
+ );
201
+ items.sort((a, b) => a.path.localeCompare(b.path));
202
+ let totalSize = 0;
203
+ let totalGzip = 0;
204
+ let totalNodeModulesSize = 0;
205
+ let totalNodeModulesGzip = 0;
206
+ let treeText = "";
207
+ for (const [index, item] of items.entries()) {
208
+ dirname(item.file);
209
+ const rpath = relative(process.cwd(), item.path);
210
+ const treeChar = index === items.length - 1 ? "\u2514\u2500" : "\u251C\u2500";
211
+ const isNodeModules = item.file.includes("node_modules");
212
+ if (isNodeModules) {
213
+ totalNodeModulesSize += item.size;
214
+ totalNodeModulesGzip += item.gzip;
215
+ continue;
216
+ }
217
+ treeText += colors.gray(
218
+ ` ${treeChar} ${rpath} (${prettyBytes(item.size)})`
219
+ );
220
+ if (options.compressedSizes) {
221
+ treeText += colors.gray(` (${prettyBytes(item.gzip)} gzip)`);
222
+ }
223
+ treeText += "\n";
224
+ totalSize += item.size;
225
+ totalGzip += item.gzip;
226
+ }
227
+ treeText += `${colors.cyan("\u03A3 Total size:")} ${prettyBytes(
228
+ totalSize + totalNodeModulesSize
229
+ )}`;
230
+ if (options.compressedSizes) {
231
+ treeText += ` (${prettyBytes(totalGzip + totalNodeModulesGzip)} gzip)`;
232
+ }
233
+ treeText += "\n";
234
+ return treeText;
235
+ }
67
236
 
68
237
  const getRolldownConfig = (nitro) => {
69
238
  const base = baseBuildConfig(nitro);
@@ -317,4 +486,9 @@ async function rolldownBuild(nitro) {
317
486
  return nitro.options.dev ? watchDev(nitro, config) : buildProduction(nitro, config);
318
487
  }
319
488
 
320
- export { rolldownBuild };
489
+ const build = {
490
+ __proto__: null,
491
+ rolldownBuild: rolldownBuild
492
+ };
493
+
494
+ export { scanAndSyncOptions as a, build as b, generateFSTree as g, nitroServerName as n, runParallel as r, scanHandlers as s };