nitro-nightly 3.1.0-20251028-090722-437659e4 → 3.1.0-20251028-131831-fe9fd554
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/_build/build.mjs +379 -14
- package/dist/_build/{rollup.mjs → build2.mjs} +218 -68
- package/dist/_build/info.mjs +963 -7
- package/dist/_build/prepare.mjs +1491 -2
- package/dist/_build/snapshot.mjs +155 -31
- package/dist/_build/vite.mjs +43 -2307
- package/dist/_build/vite2.mjs +149 -0
- package/dist/{_deps → _chunks/_deps}/c12.mjs +1 -1
- package/dist/{_deps → _chunks/_deps}/giget.mjs +1 -1
- package/dist/_chunks/_deps/klona.mjs +137 -0
- package/dist/{_deps → _chunks/_deps}/knitwork.mjs +1 -1
- package/dist/{_deps → _chunks/_deps}/local-pkg.mjs +1 -1
- package/dist/{_deps → _chunks/_deps}/mlly.mjs +1 -1
- package/dist/{_deps → _chunks/_deps}/nypm.mjs +1 -1
- package/dist/{_deps → _chunks/_deps}/pathe.mjs +1 -1
- package/dist/{_deps → _chunks/_deps}/pkg-types.mjs +2 -2
- package/dist/{_deps → _chunks/_deps}/rou3.mjs +1 -1
- package/dist/_chunks/_deps/std-env.mjs +3 -0
- package/dist/{_deps → _chunks/_deps}/unimport.mjs +2 -2
- package/dist/{_deps → _chunks/_deps}/unplugin-utils.mjs +1 -1
- package/dist/{_deps → _chunks/_deps}/untyped.mjs +1 -1
- package/dist/{_deps → _chunks/_deps}/unwasm.mjs +2 -2
- package/dist/{_presets → _chunks/_presets}/_resolve.mjs +2 -2
- package/dist/{_presets → _chunks/_presets}/_utils.mjs +1 -1
- package/dist/{_presets → _chunks/_presets}/azure.mjs +1 -1
- package/dist/{_presets → _chunks/_presets}/cloudflare.mjs +4 -4
- package/dist/{_presets → _chunks/_presets}/deno.mjs +1 -1
- package/dist/{_presets → _chunks/_presets}/firebase.mjs +1 -1
- package/dist/{_presets → _chunks/_presets}/iis.mjs +1 -1
- package/dist/{_presets → _chunks/_presets}/index.mjs +1 -1
- package/dist/{_presets → _chunks/_presets}/vercel.mjs +3 -3
- package/dist/{_presets → _chunks/_presets}/zeabur.mjs +1 -1
- package/dist/_chunks/app.mjs +600 -0
- package/dist/_chunks/index.mjs +648 -0
- package/dist/_chunks/server.mjs +256 -0
- package/dist/_cli/build.mjs +2 -2
- package/dist/_cli/dev.mjs +46 -130
- package/dist/_cli/index.mjs +1 -1
- package/dist/_cli/list.mjs +2 -2
- package/dist/_cli/prepare.mjs +2 -2
- package/dist/_cli/run.mjs +2 -2
- package/dist/cli/index.mjs +1 -1
- package/dist/index.mjs +94 -120
- package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
- package/dist/node_modules/cookie-es/package.json +37 -0
- package/dist/node_modules/rendu/dist/index.mjs +380 -0
- package/dist/node_modules/rendu/package.json +47 -0
- package/dist/runtime/internal/task.mjs +1 -2
- package/dist/types/index.d.mts +2 -1
- package/dist/vite.mjs +103 -114
- package/lib/runtime/meta.mjs +18 -25
- package/package.json +9 -10
- package/dist/_build/assets.mjs +0 -235
- package/dist/_build/config.mjs +0 -124
- package/dist/_build/plugins.mjs +0 -1041
- package/dist/_build/rolldown.mjs +0 -494
- package/dist/_build/types.mjs +0 -268
- package/dist/node_modules/klona/dist/index.mjs +0 -81
- package/dist/node_modules/klona/full/index.mjs +0 -53
- package/dist/node_modules/klona/package.json +0 -74
- package/dist/node_modules/std-env/dist/index.mjs +0 -1
- package/dist/node_modules/std-env/package.json +0 -46
- /package/dist/{_deps → _chunks/_deps}/@jridgewell/gen-mapping.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@jridgewell/remapping.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@jridgewell/resolve-uri.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@jridgewell/sourcemap-codec.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@jridgewell/trace-mapping.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@pi0/vite-plugin-fullstack.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-alias.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-commonjs.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-inject.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-json.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-node-resolve.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-replace.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/@rollup/pluginutils.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/acorn.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/chokidar.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/citty.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/commondir.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/compatx.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/confbox.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/debug.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/deepmerge.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/depd.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/dot-prop.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/dotenv.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/duplexer.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/ee-first.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/encodeurl.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/escape-html.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/escape-string-regexp.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/estree-walker.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/etag.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/exsolve.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/fdir.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/fresh.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/function-bind.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/gzip-size.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/hasown.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/http-errors.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/httpxy.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/inherits.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/is-core-module.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/is-module.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/is-reference.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/js-tokens.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/magic-string.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/mime-db.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/mime-types.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/mime.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/ms.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/node-fetch-native.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/on-finished.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/parseurl.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/path-parse.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/perfect-debounce.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/picomatch.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/pretty-bytes.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/quansync.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/range-parser.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/rc9.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/readdirp.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/resolve.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/send.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/serve-static.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/setprototypeof.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/statuses.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/strip-literal.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/supports-color.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/tinyexec.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/tinyglobby.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/toidentifier.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/ultrahtml.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/unplugin.mjs +0 -0
- /package/dist/{_deps → _chunks/_deps}/webpack-virtual-modules.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/_all.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/_nitro.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/_static.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/_types.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/alwaysdata.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/aws-amplify.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/aws-lambda.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/bun.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/cleavr.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/digitalocean.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/flightcontrol.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/genezio.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/heroku.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/koyeb.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/netlify.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/node.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/platform.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/render.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/standard.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/stormkit.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/winterjs.mjs +0 -0
- /package/dist/{_presets → _chunks/_presets}/zerops.mjs +0 -0
package/dist/_build/build.mjs
CHANGED
|
@@ -1,21 +1,386 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { s as sanitizeFilePath } from '../_chunks/_deps/mlly.mjs';
|
|
2
|
+
import { r as resolveModulePath } from '../_chunks/_deps/exsolve.mjs';
|
|
3
|
+
import { runtimeDir } from 'nitro/runtime/meta';
|
|
4
|
+
import { b as baseBuildConfig, a as baseBuildPlugins, r as replace, w as writeBuildInfo } from './info.mjs';
|
|
5
|
+
import { builtinModules } from 'node:module';
|
|
6
|
+
import { defu } from 'defu';
|
|
7
|
+
import { r as raw, n as nitroServerName, s as snapshot, g as generateFSTree } from './snapshot.mjs';
|
|
8
|
+
import { n as normalize, j as join, a as relative } from '../_chunks/_deps/pathe.mjs';
|
|
9
|
+
import { watch } from '../_chunks/_deps/chokidar.mjs';
|
|
10
|
+
import { watch as watch$1 } from 'node:fs';
|
|
11
|
+
import { d as debounce } from '../_chunks/_deps/perfect-debounce.mjs';
|
|
12
|
+
import { s as scanHandlers } from './prepare.mjs';
|
|
13
|
+
import { w as writeTypes } from '../_chunks/index.mjs';
|
|
14
|
+
import { f as formatCompatibilityDate } from '../_chunks/_deps/compatx.mjs';
|
|
15
|
+
import '../_chunks/_deps/acorn.mjs';
|
|
16
|
+
import 'ufo';
|
|
17
|
+
import '../_chunks/_deps/pkg-types.mjs';
|
|
18
|
+
import '../_chunks/_deps/confbox.mjs';
|
|
19
|
+
import 'node:url';
|
|
20
|
+
import 'node:fs/promises';
|
|
21
|
+
import 'node:assert';
|
|
22
|
+
import 'node:process';
|
|
23
|
+
import 'node:path';
|
|
24
|
+
import 'node:v8';
|
|
25
|
+
import 'node:util';
|
|
26
|
+
import '../_chunks/_deps/@rollup/plugin-replace.mjs';
|
|
27
|
+
import '../_chunks/_deps/magic-string.mjs';
|
|
28
|
+
import '../_chunks/_deps/@jridgewell/sourcemap-codec.mjs';
|
|
29
|
+
import '../_chunks/_deps/@rollup/pluginutils.mjs';
|
|
30
|
+
import 'path';
|
|
31
|
+
import '../_chunks/_deps/estree-walker.mjs';
|
|
32
|
+
import '../_chunks/_deps/picomatch.mjs';
|
|
33
|
+
import '../_chunks/_deps/commondir.mjs';
|
|
34
|
+
import 'unenv';
|
|
35
|
+
import 'ohash';
|
|
36
|
+
import '../_chunks/_deps/unimport.mjs';
|
|
37
|
+
import 'scule';
|
|
38
|
+
import 'node:os';
|
|
39
|
+
import '../_chunks/_deps/unplugin.mjs';
|
|
40
|
+
import 'node:buffer';
|
|
41
|
+
import '../_chunks/_deps/@jridgewell/remapping.mjs';
|
|
42
|
+
import '../_chunks/_deps/@jridgewell/trace-mapping.mjs';
|
|
43
|
+
import '../_chunks/_deps/@jridgewell/resolve-uri.mjs';
|
|
44
|
+
import '../_chunks/_deps/@jridgewell/gen-mapping.mjs';
|
|
45
|
+
import 'node:querystring';
|
|
46
|
+
import '../_chunks/_deps/webpack-virtual-modules.mjs';
|
|
47
|
+
import 'constants';
|
|
48
|
+
import '../_chunks/_deps/unplugin-utils.mjs';
|
|
49
|
+
import '../_chunks/_deps/tinyglobby.mjs';
|
|
50
|
+
import 'fs';
|
|
51
|
+
import 'url';
|
|
52
|
+
import '../_chunks/_deps/fdir.mjs';
|
|
53
|
+
import 'module';
|
|
54
|
+
import '../_chunks/_deps/local-pkg.mjs';
|
|
55
|
+
import '../_chunks/_deps/quansync.mjs';
|
|
56
|
+
import '../_chunks/_deps/strip-literal.mjs';
|
|
57
|
+
import '../_chunks/_deps/js-tokens.mjs';
|
|
58
|
+
import '../_chunks/_deps/unwasm.mjs';
|
|
59
|
+
import 'node:crypto';
|
|
60
|
+
import '../_chunks/_deps/knitwork.mjs';
|
|
61
|
+
import 'db0';
|
|
62
|
+
import 'esbuild';
|
|
63
|
+
import '../_chunks/_deps/etag.mjs';
|
|
64
|
+
import 'crypto';
|
|
65
|
+
import '../_chunks/_deps/mime.mjs';
|
|
66
|
+
import 'unstorage';
|
|
67
|
+
import 'nf3';
|
|
68
|
+
import 'rendu';
|
|
69
|
+
import 'nitro/meta';
|
|
70
|
+
import '../_chunks/_presets/_types.mjs';
|
|
71
|
+
import 'consola/utils';
|
|
72
|
+
import '../_chunks/_deps/gzip-size.mjs';
|
|
73
|
+
import 'node:stream';
|
|
74
|
+
import 'node:zlib';
|
|
75
|
+
import 'stream';
|
|
76
|
+
import '../_chunks/_deps/pretty-bytes.mjs';
|
|
77
|
+
import '../_chunks/_deps/std-env.mjs';
|
|
78
|
+
import 'fs/promises';
|
|
79
|
+
import 'events';
|
|
80
|
+
import '../_chunks/_deps/readdirp.mjs';
|
|
81
|
+
import 'os';
|
|
82
|
+
import 'consola';
|
|
83
|
+
import 'hookable';
|
|
84
|
+
import '../_chunks/_deps/c12.mjs';
|
|
85
|
+
import 'jiti';
|
|
86
|
+
import '../_chunks/_deps/rc9.mjs';
|
|
87
|
+
import 'destr';
|
|
88
|
+
import '../_chunks/_deps/dotenv.mjs';
|
|
89
|
+
import '../_chunks/_deps/klona.mjs';
|
|
90
|
+
import '../_chunks/_deps/escape-string-regexp.mjs';
|
|
91
|
+
import 'ofetch';
|
|
92
|
+
import '../_chunks/_deps/rou3.mjs';
|
|
93
|
+
import '../_chunks/_deps/dot-prop.mjs';
|
|
94
|
+
import '../_chunks/_deps/ultrahtml.mjs';
|
|
95
|
+
import '../_chunks/server.mjs';
|
|
96
|
+
import '../_chunks/app.mjs';
|
|
97
|
+
import 'node:worker_threads';
|
|
98
|
+
import 'h3';
|
|
99
|
+
import '../_chunks/_deps/serve-static.mjs';
|
|
100
|
+
import '../_chunks/_deps/encodeurl.mjs';
|
|
101
|
+
import '../_chunks/_deps/escape-html.mjs';
|
|
102
|
+
import '../_chunks/_deps/parseurl.mjs';
|
|
103
|
+
import '../_chunks/_deps/send.mjs';
|
|
104
|
+
import '../_chunks/_deps/http-errors.mjs';
|
|
105
|
+
import '../_chunks/_deps/depd.mjs';
|
|
106
|
+
import '../_chunks/_deps/setprototypeof.mjs';
|
|
107
|
+
import '../_chunks/_deps/statuses.mjs';
|
|
108
|
+
import '../_chunks/_deps/inherits.mjs';
|
|
109
|
+
import '../_chunks/_deps/toidentifier.mjs';
|
|
110
|
+
import '../_chunks/_deps/debug.mjs';
|
|
111
|
+
import 'tty';
|
|
112
|
+
import 'util';
|
|
113
|
+
import '../_chunks/_deps/ms.mjs';
|
|
114
|
+
import '../_chunks/_deps/supports-color.mjs';
|
|
115
|
+
import '../_chunks/_deps/fresh.mjs';
|
|
116
|
+
import '../_chunks/_deps/mime-types.mjs';
|
|
117
|
+
import '../_chunks/_deps/mime-db.mjs';
|
|
118
|
+
import '../_chunks/_deps/on-finished.mjs';
|
|
119
|
+
import '../_chunks/_deps/ee-first.mjs';
|
|
120
|
+
import '../_chunks/_deps/range-parser.mjs';
|
|
121
|
+
import '../_chunks/_deps/httpxy.mjs';
|
|
122
|
+
import 'node:http';
|
|
123
|
+
import 'node:https';
|
|
124
|
+
import 'node:events';
|
|
125
|
+
import 'undici';
|
|
126
|
+
import 'youch-core';
|
|
127
|
+
import 'youch';
|
|
128
|
+
import 'source-map';
|
|
129
|
+
import 'srvx';
|
|
130
|
+
import 'srvx/node';
|
|
131
|
+
import '../_chunks/_deps/untyped.mjs';
|
|
132
|
+
|
|
133
|
+
const getRolldownConfig = (nitro) => {
|
|
134
|
+
const base = baseBuildConfig(nitro);
|
|
135
|
+
const chunkNamePrefixes = [
|
|
136
|
+
[nitro.options.buildDir, "build"],
|
|
137
|
+
[base.buildServerDir, "app"],
|
|
138
|
+
[runtimeDir, "nitro"],
|
|
139
|
+
[base.presetsDir, "nitro"],
|
|
140
|
+
["\0raw:", "raw"],
|
|
141
|
+
["\0nitro-wasm:", "wasm"],
|
|
142
|
+
["\0", "virtual"]
|
|
143
|
+
];
|
|
144
|
+
let config = {
|
|
145
|
+
cwd: nitro.options.rootDir,
|
|
146
|
+
input: nitro.options.entry,
|
|
147
|
+
external: [
|
|
148
|
+
...base.env.external,
|
|
149
|
+
...builtinModules,
|
|
150
|
+
...builtinModules.map((m) => `node:${m}`)
|
|
151
|
+
],
|
|
152
|
+
plugins: [
|
|
153
|
+
...baseBuildPlugins(nitro, base),
|
|
154
|
+
// https://github.com/rolldown/rolldown/issues/4257
|
|
155
|
+
replace({
|
|
156
|
+
delimiters: base.replaceDelimiters,
|
|
157
|
+
preventAssignment: true,
|
|
158
|
+
values: base.replacements
|
|
159
|
+
}),
|
|
160
|
+
raw()
|
|
161
|
+
],
|
|
162
|
+
resolve: {
|
|
163
|
+
alias: base.aliases,
|
|
164
|
+
extensions: base.extensions,
|
|
165
|
+
mainFields: ["main"],
|
|
166
|
+
// "module" is intentionally not supported because of externals
|
|
167
|
+
conditionNames: nitro.options.exportConditions
|
|
168
|
+
},
|
|
169
|
+
// @ts-expect-error (readonly values)
|
|
170
|
+
inject: base.env.inject,
|
|
171
|
+
jsx: {
|
|
172
|
+
mode: "classic",
|
|
173
|
+
factory: nitro.options.esbuild?.options?.jsxFactory,
|
|
174
|
+
fragment: nitro.options.esbuild?.options?.jsxFragment
|
|
175
|
+
},
|
|
176
|
+
onwarn(warning, warn) {
|
|
177
|
+
if (!["CIRCULAR_DEPENDENCY", "EVAL"].includes(warning.code || "") && !warning.message.includes("Unsupported source map comment")) {
|
|
178
|
+
warn(warning);
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
treeshake: {
|
|
182
|
+
moduleSideEffects(id) {
|
|
183
|
+
const normalizedId = normalize(id);
|
|
184
|
+
const idWithoutNodeModules = normalizedId.split("node_modules/").pop();
|
|
185
|
+
if (!idWithoutNodeModules) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
if (normalizedId.startsWith(runtimeDir) || idWithoutNodeModules.startsWith(runtimeDir)) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
return nitro.options.moduleSideEffects.some(
|
|
192
|
+
(m) => normalizedId.startsWith(m) || idWithoutNodeModules.startsWith(m)
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
output: {
|
|
197
|
+
dir: nitro.options.output.serverDir,
|
|
198
|
+
entryFileNames: "index.mjs",
|
|
199
|
+
minify: nitro.options.minify,
|
|
200
|
+
chunkFileNames(chunk) {
|
|
201
|
+
const id = normalize(chunk.moduleIds.at(-1) || "");
|
|
202
|
+
for (const [dir, name] of chunkNamePrefixes) {
|
|
203
|
+
if (id.startsWith(dir)) {
|
|
204
|
+
return `chunks/${name}/[name].mjs`;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const routeHandler = nitro.options.handlers.find(
|
|
208
|
+
(h) => id.startsWith(h.handler)
|
|
209
|
+
) || nitro.scannedHandlers.find((h) => id.startsWith(h.handler));
|
|
210
|
+
if (routeHandler?.route) {
|
|
211
|
+
const path = routeHandler.route.replace(/:([^/]+)/g, "_$1").replace(/\/[^/]+$/g, "") || "/";
|
|
212
|
+
return `chunks/routes${path}/[name].mjs`;
|
|
213
|
+
}
|
|
214
|
+
const taskHandler = Object.entries(nitro.options.tasks).find(
|
|
215
|
+
([_, task]) => task.handler === id
|
|
216
|
+
);
|
|
217
|
+
if (taskHandler) {
|
|
218
|
+
return `chunks/tasks/[name].mjs`;
|
|
219
|
+
}
|
|
220
|
+
return `chunks/_/[name].mjs`;
|
|
221
|
+
},
|
|
222
|
+
inlineDynamicImports: nitro.options.inlineDynamicImports,
|
|
223
|
+
format: "esm",
|
|
224
|
+
exports: "auto",
|
|
225
|
+
intro: "",
|
|
226
|
+
outro: "",
|
|
227
|
+
sanitizeFileName: sanitizeFilePath,
|
|
228
|
+
sourcemap: nitro.options.sourceMap,
|
|
229
|
+
sourcemapIgnoreList(relativePath) {
|
|
230
|
+
return relativePath.includes("node_modules");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
config.plugins.push({
|
|
235
|
+
name: "nitro:rolldown-resolves",
|
|
236
|
+
async resolveId(id, parent, options) {
|
|
237
|
+
if (parent?.startsWith("\0virtual:#nitro-internal-virtual")) {
|
|
238
|
+
const internalRes = await this.resolve(id, import.meta.url, {
|
|
239
|
+
...options,
|
|
240
|
+
custom: { ...options.custom, skipNoExternals: true }
|
|
241
|
+
});
|
|
242
|
+
if (internalRes) {
|
|
243
|
+
return internalRes;
|
|
244
|
+
}
|
|
245
|
+
return resolveModulePath(id, {
|
|
246
|
+
from: [nitro.options.rootDir, import.meta.url],
|
|
247
|
+
try: true
|
|
248
|
+
}) || resolveModulePath("./" + id, {
|
|
249
|
+
from: [nitro.options.rootDir, import.meta.url],
|
|
250
|
+
try: true
|
|
251
|
+
});
|
|
252
|
+
}
|
|
6
253
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
254
|
+
});
|
|
255
|
+
config = defu(nitro.options.rollupConfig, config);
|
|
256
|
+
return config;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
async function watchDev(nitro, config) {
|
|
260
|
+
const rolldown = await import('rolldown');
|
|
261
|
+
let watcher;
|
|
262
|
+
async function load() {
|
|
263
|
+
if (watcher) {
|
|
264
|
+
await watcher.close();
|
|
10
265
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
266
|
+
await scanHandlers(nitro);
|
|
267
|
+
nitro.routing.sync();
|
|
268
|
+
watcher = startWatcher(nitro, config);
|
|
269
|
+
await writeTypes(nitro);
|
|
270
|
+
}
|
|
271
|
+
const reload = debounce(load);
|
|
272
|
+
const scanDirs = nitro.options.scanDirs.flatMap((dir) => [
|
|
273
|
+
join(dir, nitro.options.apiDir || "api"),
|
|
274
|
+
join(dir, nitro.options.routesDir || "routes"),
|
|
275
|
+
join(dir, "middleware"),
|
|
276
|
+
join(dir, "plugins"),
|
|
277
|
+
join(dir, "modules")
|
|
278
|
+
]);
|
|
279
|
+
const watchReloadEvents = /* @__PURE__ */ new Set(["add", "addDir", "unlink", "unlinkDir"]);
|
|
280
|
+
const scanDirsWatcher = watch(scanDirs, {
|
|
281
|
+
ignoreInitial: true
|
|
282
|
+
}).on("all", (event) => {
|
|
283
|
+
if (watchReloadEvents.has(event)) {
|
|
284
|
+
reload();
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
const srcDirWatcher = watch$1(
|
|
288
|
+
nitro.options.srcDir,
|
|
289
|
+
{ persistent: false },
|
|
290
|
+
(_event, filename) => {
|
|
291
|
+
if (filename && /^server\.[mc]?[jt]sx?$/.test(filename)) {
|
|
292
|
+
reload();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
nitro.hooks.hook("close", () => {
|
|
297
|
+
watcher.close();
|
|
298
|
+
scanDirsWatcher.close();
|
|
299
|
+
srcDirWatcher.close();
|
|
300
|
+
});
|
|
301
|
+
nitro.hooks.hook("rollup:reload", () => reload());
|
|
302
|
+
await load();
|
|
303
|
+
function startWatcher(nitro2, config2) {
|
|
304
|
+
const watcher2 = rolldown.watch(config2);
|
|
305
|
+
let start;
|
|
306
|
+
watcher2.on("event", (event) => {
|
|
307
|
+
switch (event.code) {
|
|
308
|
+
case "START": {
|
|
309
|
+
start = Date.now();
|
|
310
|
+
nitro2.hooks.callHook("dev:start");
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
case "BUNDLE_END": {
|
|
314
|
+
nitro2.hooks.callHook("compiled", nitro2);
|
|
315
|
+
if (nitro2.options.logging.buildSuccess) {
|
|
316
|
+
nitro2.logger.success(
|
|
317
|
+
`${nitroServerName(nitro2)} built with rolldown`,
|
|
318
|
+
start ? `in ${Date.now() - start}ms` : ""
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
nitro2.hooks.callHook("dev:reload");
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
case "ERROR": {
|
|
325
|
+
nitro2.hooks.callHook("dev:error", event.error);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
return watcher2;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
async function buildProduction(nitro, config) {
|
|
334
|
+
const rolldown = await import('rolldown');
|
|
335
|
+
await scanHandlers(nitro);
|
|
336
|
+
await writeTypes(nitro);
|
|
337
|
+
await snapshot(nitro);
|
|
338
|
+
if (!nitro.options.static) {
|
|
339
|
+
nitro.logger.info(
|
|
340
|
+
`Building ${nitroServerName(nitro)} (rolldown, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`
|
|
341
|
+
);
|
|
342
|
+
const build = await rolldown.rolldown(config);
|
|
343
|
+
await build.write(config.output);
|
|
344
|
+
}
|
|
345
|
+
const buildInfo = await writeBuildInfo(nitro);
|
|
346
|
+
if (!nitro.options.static) {
|
|
347
|
+
if (nitro.options.logging.buildSuccess) {
|
|
348
|
+
nitro.logger.success(`${nitroServerName(nitro)} built`);
|
|
14
349
|
}
|
|
15
|
-
|
|
16
|
-
|
|
350
|
+
if (nitro.options.logLevel > 1) {
|
|
351
|
+
process.stdout.write(
|
|
352
|
+
await generateFSTree(nitro.options.output.serverDir, {
|
|
353
|
+
compressedSizes: nitro.options.logging.compressedSizes
|
|
354
|
+
}) || ""
|
|
355
|
+
);
|
|
17
356
|
}
|
|
18
357
|
}
|
|
358
|
+
await nitro.hooks.callHook("compiled", nitro);
|
|
359
|
+
const rOutput = relative(process.cwd(), nitro.options.output.dir);
|
|
360
|
+
const rewriteRelativePaths = (input) => {
|
|
361
|
+
return input.replace(/([\s:])\.\/(\S*)/g, `$1${rOutput}/$2`);
|
|
362
|
+
};
|
|
363
|
+
if (buildInfo.commands.preview) {
|
|
364
|
+
nitro.logger.success(
|
|
365
|
+
`You can preview this build using \`${rewriteRelativePaths(
|
|
366
|
+
buildInfo.commands.preview
|
|
367
|
+
)}\``
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
if (buildInfo.commands.deploy) {
|
|
371
|
+
nitro.logger.success(
|
|
372
|
+
`You can deploy this build using \`${rewriteRelativePaths(
|
|
373
|
+
buildInfo.commands.deploy
|
|
374
|
+
)}\``
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
async function rolldownBuild(nitro) {
|
|
380
|
+
await nitro.hooks.callHook("build:before", nitro);
|
|
381
|
+
const config = getRolldownConfig(nitro);
|
|
382
|
+
await nitro.hooks.callHook("rollup:before", nitro, config);
|
|
383
|
+
return nitro.options.dev ? watchDev(nitro, config) : buildProduction(nitro, config);
|
|
19
384
|
}
|
|
20
385
|
|
|
21
|
-
export {
|
|
386
|
+
export { rolldownBuild };
|