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.
- package/dist/_build/common.mjs +24931 -0
- package/dist/_build/rolldown.mjs +6 -11
- package/dist/_build/rollup.mjs +201 -0
- package/dist/_build/vite.build.mjs +1 -1
- package/dist/_chunks/dev.mjs +4 -6
- package/dist/_chunks/nitro.mjs +1183 -24
- package/dist/_chunks/nitro2.mjs +91 -248
- package/dist/_chunks/utils.mjs +254 -0
- package/dist/_common.mjs +45 -0
- package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +652 -0
- package/dist/_libs/@jridgewell/gen-mapping.mjs +448 -0
- package/dist/_libs/@jridgewell/remapping.mjs +117 -0
- package/dist/_libs/@rollup/plugin-alias.mjs +64 -0
- package/dist/_libs/@rollup/plugin-commonjs.d.mts +241 -0
- package/dist/_libs/@rollup/plugin-commonjs.mjs +1300 -0
- package/dist/_libs/{plugin-alias+plugin-inject.mjs → @rollup/plugin-inject.mjs} +2 -65
- package/dist/_libs/@rollup/plugin-json.mjs +36 -0
- package/dist/_libs/@rollup/plugin-node-resolve.mjs +1972 -0
- package/dist/_libs/c12.d.mts +214 -0
- package/dist/_libs/{c12+dotenv+rc9.mjs → c12.mjs} +105 -12
- package/dist/_libs/{chokidar+readdirp.mjs → chokidar.mjs} +8 -1
- package/dist/_libs/compatx.d.mts +47 -0
- package/dist/_libs/confbox.mjs +2488 -70
- package/dist/_libs/esbuild.d.mts +20 -0
- package/dist/_libs/escape-string-regexp.mjs +8 -0
- package/dist/_libs/estree-walker.mjs +187 -0
- package/dist/_libs/giget.mjs +3550 -0
- package/dist/_libs/httpxy.d.mts +79 -0
- package/dist/_libs/httpxy.mjs +6 -1
- package/dist/_libs/klona.mjs +38 -0
- package/dist/_libs/magic-string.d.mts +220 -0
- package/dist/_libs/mlly.d.mts +57 -0
- package/dist/_libs/pkg-types.d.mts +23 -0
- package/dist/_libs/rou3.d.mts +43 -0
- package/dist/_libs/rou3.mjs +322 -0
- package/dist/_libs/std-env.d.mts +4 -0
- package/dist/_libs/tsconfck.mjs +832 -0
- package/dist/_libs/ultrahtml.mjs +138 -0
- package/dist/_libs/unimport.d.mts +426 -0
- package/dist/_libs/unimport.mjs +1781 -5
- package/dist/_libs/unwasm.d.mts +29 -0
- package/dist/_presets.mjs +3 -8
- package/dist/builder.mjs +6 -8
- package/dist/cli/_chunks/build.mjs +1 -1
- package/dist/cli/_chunks/dev.mjs +2 -3
- package/dist/cli/_chunks/list.mjs +1 -1
- package/dist/cli/_chunks/prepare.mjs +1 -1
- package/dist/cli/_chunks/run.mjs +1 -1
- package/dist/cli/_chunks/task.mjs +16 -0
- package/dist/cli/index.mjs +1 -1
- package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -5
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +0 -1
- package/dist/presets/winterjs/runtime/winterjs.d.mts +0 -1
- package/dist/runtime/internal/error/dev.d.mts +0 -1
- package/dist/runtime/internal/route-rules.d.mts +0 -4
- package/dist/runtime/internal/routes/openapi.d.mts +0 -1
- package/dist/runtime/internal/routes/scalar.d.mts +0 -1
- package/dist/runtime/internal/routes/swagger.d.mts +0 -1
- package/dist/runtime/internal/runtime-config.d.mts +0 -1
- package/dist/runtime/nitro.d.mts +0 -3
- package/dist/runtime/virtual/renderer-template.d.mts +0 -1
- package/dist/types/index.d.mts +36 -1405
- package/dist/vite.mjs +18 -641
- package/package.json +2 -2
- package/dist/_chunks/nitro3.mjs +0 -2696
- package/dist/_chunks/nitro4.mjs +0 -176
- package/dist/_chunks/nitro5.mjs +0 -733
- package/dist/_chunks/nitro6.mjs +0 -1458
- package/dist/_chunks/nitro7.mjs +0 -7561
- package/dist/_chunks/nitro8.mjs +0 -3524
- package/dist/_chunks/nitro9.mjs +0 -1729
- package/dist/_libs/_.mjs +0 -3
- package/dist/_libs/_2.mjs +0 -3
- package/dist/_libs/_3.mjs +0 -4
- package/dist/_libs/_4.mjs +0 -6
- package/dist/_libs/_5.mjs +0 -3
- package/dist/_libs/_6.mjs +0 -3
- package/dist/_libs/acorn+confbox+js-tokens+magic-string+mlly+pkg-types+sourcemap-codec+strip-literal+unimport.mjs +0 -8900
- package/dist/_libs/confbox+exsolve+pkg-types.mjs +0 -1249
- package/dist/_libs/confbox2.mjs +0 -786
- package/dist/_libs/confbox3.mjs +0 -404
- package/dist/_libs/confbox4.mjs +0 -3
- package/dist/_libs/estree-walker+unimport.mjs +0 -378
- package/dist/_libs/fdir+picomatch+tinyglobby.mjs +0 -2471
- package/dist/_libs/gen-mapping+remapping+resolve-uri+trace-mapping+unimport+unplugin+unplugin-utils+webpack-virtual-modules.mjs +0 -2150
- package/dist/_libs/giget+node-fetch-native.mjs +0 -2692
- package/dist/_libs/local-pkg+quansync+unimport.mjs +0 -1526
- package/dist/_libs/nypm+tinyexec.mjs +0 -858
- package/dist/_libs/pathe.mjs +0 -164
- package/dist/_libs/perfect-debounce.mjs +0 -89
- package/dist/_libs/std-env.mjs +0 -158
- package/dist/_libs/vite-plugin-fullstack.mjs +0 -26
package/dist/_build/rolldown.mjs
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import { a as join,
|
|
3
|
-
import {
|
|
4
|
-
import { t as debounce } from "../_libs/perfect-debounce.mjs";
|
|
1
|
+
import "../_common.mjs";
|
|
2
|
+
import { _ as writeTypes, a as libChunkName, at as join, h as writeBuildInfo, i as getChunkName, n as baseBuildPlugins, o as baseBuildConfig, r as NODE_MODULES_RE, st as relative } from "./common.mjs";
|
|
3
|
+
import { i as debounce } from "../_libs/c12.mjs";
|
|
5
4
|
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
6
|
-
import "../_chunks/
|
|
7
|
-
import "../_libs/
|
|
8
|
-
import {
|
|
9
|
-
import { n as writeBuildInfo } from "../_chunks/nitro6.mjs";
|
|
10
|
-
import "../_libs/acorn+confbox+js-tokens+magic-string+mlly+pkg-types+sourcemap-codec+strip-literal+unimport.mjs";
|
|
11
|
-
import { i as watch$1 } from "../_libs/chokidar+readdirp.mjs";
|
|
12
|
-
import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "../_chunks/nitro7.mjs";
|
|
5
|
+
import { n as scanHandlers } from "../_chunks/nitro2.mjs";
|
|
6
|
+
import { n as watch$1 } from "../_libs/chokidar.mjs";
|
|
7
|
+
import { t as generateFSTree } from "../_chunks/utils.mjs";
|
|
13
8
|
import { builtinModules } from "node:module";
|
|
14
9
|
import { watch } from "node:fs";
|
|
15
10
|
import { defu } from "defu";
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import "../_common.mjs";
|
|
2
|
+
import { _ as writeTypes, a as libChunkName, at as join, h as writeBuildInfo, i as getChunkName, it as isAbsolute, n as baseBuildPlugins, o as baseBuildConfig, r as NODE_MODULES_RE, st as relative, t as oxc } from "./common.mjs";
|
|
3
|
+
import { i as debounce } from "../_libs/c12.mjs";
|
|
4
|
+
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
5
|
+
import { n as scanHandlers } from "../_chunks/nitro2.mjs";
|
|
6
|
+
import { n as watch$1 } from "../_libs/chokidar.mjs";
|
|
7
|
+
import { t as alias } from "../_libs/@rollup/plugin-alias.mjs";
|
|
8
|
+
import { t as inject } from "../_libs/@rollup/plugin-inject.mjs";
|
|
9
|
+
import { t as generateFSTree } from "../_chunks/utils.mjs";
|
|
10
|
+
import { t as commonjs } from "../_libs/@rollup/plugin-commonjs.mjs";
|
|
11
|
+
import { t as json } from "../_libs/@rollup/plugin-json.mjs";
|
|
12
|
+
import { t as nodeResolve } from "../_libs/@rollup/plugin-node-resolve.mjs";
|
|
13
|
+
import { watch } from "node:fs";
|
|
14
|
+
import { defu } from "defu";
|
|
15
|
+
|
|
16
|
+
//#region src/build/rollup/config.ts
|
|
17
|
+
const getRollupConfig = async (nitro) => {
|
|
18
|
+
const base = baseBuildConfig(nitro);
|
|
19
|
+
const tsc = nitro.options.typescript.tsConfig?.compilerOptions;
|
|
20
|
+
let config = {
|
|
21
|
+
input: nitro.options.entry,
|
|
22
|
+
external: [...base.env.external],
|
|
23
|
+
plugins: [
|
|
24
|
+
...await baseBuildPlugins(nitro, base),
|
|
25
|
+
oxc({
|
|
26
|
+
sourcemap: !!nitro.options.sourcemap,
|
|
27
|
+
minify: nitro.options.minify ? { ...nitro.options.oxc?.minify } : false,
|
|
28
|
+
transform: {
|
|
29
|
+
target: "esnext",
|
|
30
|
+
cwd: nitro.options.rootDir,
|
|
31
|
+
...nitro.options.oxc?.transform,
|
|
32
|
+
jsx: {
|
|
33
|
+
runtime: tsc?.jsx === "react" ? "classic" : "automatic",
|
|
34
|
+
pragma: tsc?.jsxFactory,
|
|
35
|
+
pragmaFrag: tsc?.jsxFragmentFactory,
|
|
36
|
+
importSource: tsc?.jsxImportSource,
|
|
37
|
+
development: nitro.options.dev,
|
|
38
|
+
...nitro.options.oxc?.transform?.jsx
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
alias({ entries: base.aliases }),
|
|
43
|
+
nodeResolve({
|
|
44
|
+
extensions: base.extensions,
|
|
45
|
+
preferBuiltins: !!nitro.options.node,
|
|
46
|
+
rootDir: nitro.options.rootDir,
|
|
47
|
+
exportConditions: nitro.options.exportConditions
|
|
48
|
+
}),
|
|
49
|
+
commonjs({ ...nitro.options.commonJS }),
|
|
50
|
+
json(),
|
|
51
|
+
inject(base.env.inject)
|
|
52
|
+
],
|
|
53
|
+
onwarn(warning, rollupWarn) {
|
|
54
|
+
if (!base.ignoreWarningCodes.has(warning.code || "")) rollupWarn(warning);
|
|
55
|
+
},
|
|
56
|
+
treeshake: { moduleSideEffects(id) {
|
|
57
|
+
return nitro.options.moduleSideEffects.some((p) => id.startsWith(p));
|
|
58
|
+
} },
|
|
59
|
+
output: {
|
|
60
|
+
format: "esm",
|
|
61
|
+
entryFileNames: "index.mjs",
|
|
62
|
+
chunkFileNames: (chunk) => getChunkName(chunk, nitro),
|
|
63
|
+
dir: nitro.options.output.serverDir,
|
|
64
|
+
inlineDynamicImports: nitro.options.inlineDynamicImports,
|
|
65
|
+
generatedCode: { constBindings: true },
|
|
66
|
+
sourcemap: nitro.options.sourcemap,
|
|
67
|
+
sourcemapExcludeSources: true,
|
|
68
|
+
sourcemapIgnoreList: (id) => id.includes("node_modules"),
|
|
69
|
+
manualChunks(id) {
|
|
70
|
+
if (NODE_MODULES_RE.test(id)) return libChunkName(id);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
config = defu(nitro.options.rollupConfig, config);
|
|
75
|
+
const outputConfig = config.output;
|
|
76
|
+
if (outputConfig.inlineDynamicImports || outputConfig.format === "iife") delete outputConfig.manualChunks;
|
|
77
|
+
return config;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/build/rollup/error.ts
|
|
82
|
+
function formatRollupError(_error) {
|
|
83
|
+
try {
|
|
84
|
+
const logs = [_error.toString()];
|
|
85
|
+
const errors = _error?.errors || [_error];
|
|
86
|
+
for (const error of errors) {
|
|
87
|
+
const id = error.path || error.id || _error.id;
|
|
88
|
+
let path = isAbsolute(id) ? relative(process.cwd(), id) : id;
|
|
89
|
+
const location = error.loc;
|
|
90
|
+
if (location) path += `:${location.line}:${location.column}`;
|
|
91
|
+
const text = error.frame;
|
|
92
|
+
logs.push(`Rollup error while processing \`${path}\`` + text ? "\n\n" + text : "");
|
|
93
|
+
}
|
|
94
|
+
return logs.join("\n");
|
|
95
|
+
} catch {
|
|
96
|
+
return _error?.toString();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/build/rollup/dev.ts
|
|
102
|
+
async function watchDev(nitro, rollupConfig) {
|
|
103
|
+
const rollup = await import("rollup");
|
|
104
|
+
let rollupWatcher;
|
|
105
|
+
async function load() {
|
|
106
|
+
if (rollupWatcher) await rollupWatcher.close();
|
|
107
|
+
await scanHandlers(nitro);
|
|
108
|
+
nitro.routing.sync();
|
|
109
|
+
rollupWatcher = startRollupWatcher(nitro, rollupConfig);
|
|
110
|
+
await writeTypes(nitro);
|
|
111
|
+
}
|
|
112
|
+
const reload = debounce(load);
|
|
113
|
+
const scanDirs = nitro.options.scanDirs.flatMap((dir) => [
|
|
114
|
+
join(dir, nitro.options.apiDir || "api"),
|
|
115
|
+
join(dir, nitro.options.routesDir || "routes"),
|
|
116
|
+
join(dir, "middleware"),
|
|
117
|
+
join(dir, "plugins"),
|
|
118
|
+
join(dir, "modules")
|
|
119
|
+
]);
|
|
120
|
+
const watchReloadEvents = new Set([
|
|
121
|
+
"add",
|
|
122
|
+
"addDir",
|
|
123
|
+
"unlink",
|
|
124
|
+
"unlinkDir"
|
|
125
|
+
]);
|
|
126
|
+
const scanDirsWatcher = watch$1(scanDirs, { ignoreInitial: true }).on("all", (event, path, stat$1) => {
|
|
127
|
+
if (watchReloadEvents.has(event)) reload();
|
|
128
|
+
});
|
|
129
|
+
const rootDirWatcher = watch(nitro.options.rootDir, { persistent: false }, (_event, filename) => {
|
|
130
|
+
if (filename && /^server\.[mc]?[jt]sx?$/.test(filename)) reload();
|
|
131
|
+
});
|
|
132
|
+
nitro.hooks.hook("close", () => {
|
|
133
|
+
rollupWatcher.close();
|
|
134
|
+
scanDirsWatcher.close();
|
|
135
|
+
rootDirWatcher.close();
|
|
136
|
+
});
|
|
137
|
+
nitro.hooks.hook("rollup:reload", () => reload());
|
|
138
|
+
await load();
|
|
139
|
+
function startRollupWatcher(nitro$1, rollupConfig$1) {
|
|
140
|
+
const watcher = rollup.watch(defu(rollupConfig$1, { watch: { chokidar: nitro$1.options.watchOptions } }));
|
|
141
|
+
let start;
|
|
142
|
+
watcher.on("event", (event) => {
|
|
143
|
+
switch (event.code) {
|
|
144
|
+
case "START":
|
|
145
|
+
start = Date.now();
|
|
146
|
+
nitro$1.logger.info(`Starting dev watcher (builder: \`rollup\`, preset: \`${nitro$1.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro$1.options.compatibilityDate)}\`)`);
|
|
147
|
+
nitro$1.hooks.callHook("dev:start");
|
|
148
|
+
break;
|
|
149
|
+
case "BUNDLE_END":
|
|
150
|
+
nitro$1.hooks.callHook("compiled", nitro$1);
|
|
151
|
+
if (nitro$1.options.logging.buildSuccess) nitro$1.logger.success(`Server built`, start ? `in ${Date.now() - start}ms` : "");
|
|
152
|
+
nitro$1.hooks.callHook("dev:reload");
|
|
153
|
+
break;
|
|
154
|
+
case "ERROR":
|
|
155
|
+
nitro$1.logger.error(formatRollupError(event.error));
|
|
156
|
+
nitro$1.hooks.callHook("dev:error", event.error);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
return watcher;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/build/rollup/prod.ts
|
|
165
|
+
async function buildProduction(nitro, rollupConfig) {
|
|
166
|
+
const rollup = await import("rollup");
|
|
167
|
+
const buildStartTime = Date.now();
|
|
168
|
+
await scanHandlers(nitro);
|
|
169
|
+
await writeTypes(nitro);
|
|
170
|
+
if (!nitro.options.static) {
|
|
171
|
+
nitro.logger.info(`Building server (builder: \`rollup\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
172
|
+
await (await rollup.rollup(rollupConfig).catch((error) => {
|
|
173
|
+
nitro.logger.error(formatRollupError(error));
|
|
174
|
+
throw error;
|
|
175
|
+
})).write(rollupConfig.output);
|
|
176
|
+
}
|
|
177
|
+
const buildInfo = await writeBuildInfo(nitro);
|
|
178
|
+
if (!nitro.options.static) {
|
|
179
|
+
if (nitro.options.logging.buildSuccess) nitro.logger.success(`Server built in ${Date.now() - buildStartTime}ms`);
|
|
180
|
+
if (nitro.options.logLevel > 1) process.stdout.write(await generateFSTree(nitro.options.output.serverDir, { compressedSizes: nitro.options.logging.compressedSizes }) || "");
|
|
181
|
+
}
|
|
182
|
+
await nitro.hooks.callHook("compiled", nitro);
|
|
183
|
+
const rOutput = relative(process.cwd(), nitro.options.output.dir);
|
|
184
|
+
const rewriteRelativePaths = (input) => {
|
|
185
|
+
return input.replace(/([\s:])\.\/(\S*)/g, `$1${rOutput}/$2`);
|
|
186
|
+
};
|
|
187
|
+
if (buildInfo.commands.preview) nitro.logger.success(`You can preview this build using \`${rewriteRelativePaths(buildInfo.commands.preview)}\``);
|
|
188
|
+
if (buildInfo.commands.deploy) nitro.logger.success(`You can deploy this build using \`${rewriteRelativePaths(buildInfo.commands.deploy)}\``);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/build/rollup/build.ts
|
|
193
|
+
async function rollupBuild(nitro) {
|
|
194
|
+
await nitro.hooks.callHook("build:before", nitro);
|
|
195
|
+
const config = await getRollupConfig(nitro);
|
|
196
|
+
await nitro.hooks.callHook("rollup:before", nitro, config);
|
|
197
|
+
return nitro.options.dev ? watchDev(nitro, config) : buildProduction(nitro, config);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
//#endregion
|
|
201
|
+
export { rollupBuild };
|
package/dist/_chunks/dev.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { a as join$1,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as createProxyServer } from "../_libs/httpxy.mjs";
|
|
6
|
-
import { i as watch$1 } from "../_libs/chokidar+readdirp.mjs";
|
|
1
|
+
import { B as T, V as a, at as join$1, ct as resolve$1, g as writeDevBuildInfo, j as src_default, rt as extname$1 } from "../_build/common.mjs";
|
|
2
|
+
import { i as debounce } from "../_libs/c12.mjs";
|
|
3
|
+
import { t as createProxyServer } from "../_libs/httpxy.mjs";
|
|
4
|
+
import { n as watch$1 } from "../_libs/chokidar.mjs";
|
|
7
5
|
import consola$1 from "consola";
|
|
8
6
|
import { createReadStream, existsSync } from "node:fs";
|
|
9
7
|
import { readFile, rm, stat as stat$1 } from "node:fs/promises";
|