nitro 3.0.260522-beta → 3.0.260610-beta
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/THIRD-PARTY-LICENSES.md.gz +0 -0
- package/dist/_build/common.mjs +38 -21
- package/dist/_build/rolldown.mjs +6 -2
- package/dist/_build/vite.env.mjs +5 -37
- package/dist/_chunks/nitro.mjs +23 -8
- package/dist/_libs/commondir+is-reference.mjs +2 -2
- package/dist/_libs/httpxy.d.mts +1 -0
- package/dist/_libs/nypm+tinyexec.mjs +135 -412
- package/dist/_libs/{jsonc-parser+workers-utils.d.mts → undici+jsonc-parser.d.mts} +867 -6
- package/dist/_presets.mjs +14 -0
- package/dist/docs/0.docs/4.server-entry.md +1 -1
- package/dist/docs/2.config/0.index/index.md +14 -0
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +1 -1
- package/dist/presets/vercel/runtime/vercel.node.mjs +9 -1
- package/dist/presets/vercel/runtime/vercel.web.mjs +12 -1
- package/dist/runtime/internal/vite/dev-worker.mjs +14 -14
- package/dist/runtime/virtual/_runtime_warn.mjs +2 -1
- package/dist/runtime/virtual/vite-services.d.mts +5 -0
- package/dist/runtime/virtual/vite-services.mjs +1 -0
- package/dist/runtime/vite.d.mts +0 -7
- package/dist/runtime/vite.mjs +2 -2
- package/dist/types/index.d.mts +31 -1
- package/dist/vite.mjs +76 -58
- package/package.json +39 -39
package/dist/vite.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { NODE_MODULES_RE, baseBuildConfig, baseBuildPlugins, basename, copyPubli
|
|
|
2
2
|
import { formatCompatibilityDate } from "./_libs/compatx.mjs";
|
|
3
3
|
import { createNitro, prerender } from "./_chunks/nitro.mjs";
|
|
4
4
|
import { NitroDevApp } from "./_dev.mjs";
|
|
5
|
-
import { createNitroEnvironment, createServiceEnvironment, createServiceEnvironments, getEnvRunner, initEnvRunner
|
|
5
|
+
import { createNitroEnvironment, createServiceEnvironment, createServiceEnvironments, getEnvRunner, initEnvRunner } from "./_build/vite.env.mjs";
|
|
6
6
|
import { startPreview } from "./_chunks/nitro2.mjs";
|
|
7
7
|
import { assetsPlugin } from "./_libs/pluginutils.mjs";
|
|
8
8
|
import { runtimeDir } from "nitro/meta";
|
|
@@ -93,7 +93,7 @@ async function buildEnvironments(ctx, builder) {
|
|
|
93
93
|
if (nitroOptions.renderer?.template && nitroOptions.renderer?.template === clientInput) {
|
|
94
94
|
const outputPath = resolve(nitroOptions.output.publicDir, basename(clientInput));
|
|
95
95
|
if (existsSync(outputPath)) {
|
|
96
|
-
const html = await readFile(outputPath, "utf8").then((r) => r.replace("<!--ssr-outlet-->", `{{{
|
|
96
|
+
const html = await readFile(outputPath, "utf8").then((r) => r.replace("<!--ssr-outlet-->", `{{{ fetchViteEnv("ssr", $REQUEST) || "" }}}`));
|
|
97
97
|
await rm(outputPath);
|
|
98
98
|
const tmp = resolve(nitroOptions.buildDir, "vite/index.html");
|
|
99
99
|
await mkdir(dirname(tmp), { recursive: true });
|
|
@@ -122,32 +122,12 @@ async function buildEnvironments(ctx, builder) {
|
|
|
122
122
|
await nitro.hooks.callHook("compiled", nitro);
|
|
123
123
|
await writeBuildInfo(nitro, output);
|
|
124
124
|
if (!v && !m) console.log();
|
|
125
|
-
nitro.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
let promise, mod
|
|
132
|
-
return {
|
|
133
|
-
fetch(req) {
|
|
134
|
-
if (mod) { return mod.fetch(req) }
|
|
135
|
-
if (!promise) {
|
|
136
|
-
promise = loader().then(_mod => (mod = _mod.default || _mod))
|
|
137
|
-
}
|
|
138
|
-
return promise.then(mod => mod.fetch(req))
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const services = {
|
|
144
|
-
${Object.keys(ctx.services).map((name) => {
|
|
145
|
-
return [name, resolve(ctx.nitro.options.buildDir, "vite/services", name, ctx._entryPoints[name])];
|
|
146
|
-
}).map(([name, entry]) => `[${JSON.stringify(name)}]: lazyService(() => import(${JSON.stringify(entry)}))`).join(",\n")}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
globalThis.__nitro_vite_envs__ = services;
|
|
150
|
-
`;
|
|
125
|
+
const previewCommand = nitro.options.framework.previewCommand || "npx vite preview";
|
|
126
|
+
nitro.logger.success(`You can preview this build using \`${previewCommand}\``);
|
|
127
|
+
if (nitro.options.commands.deploy) {
|
|
128
|
+
const deployCommand = nitro.options.framework.deployCommand || "npx nitro deploy --prebuilt";
|
|
129
|
+
nitro.logger.success(`You can deploy this build using \`${deployCommand}\``);
|
|
130
|
+
}
|
|
151
131
|
}
|
|
152
132
|
function nitroPreviewPlugin(ctx) {
|
|
153
133
|
return {
|
|
@@ -178,6 +158,67 @@ function nitroPreviewPlugin(ctx) {
|
|
|
178
158
|
}
|
|
179
159
|
};
|
|
180
160
|
}
|
|
161
|
+
function viteServicesTemplate(ctx) {
|
|
162
|
+
const serviceNames = Object.keys(ctx.services);
|
|
163
|
+
if (ctx.nitro.options.dev) return `
|
|
164
|
+
export const viteServices = {
|
|
165
|
+
${serviceNames.map((name) => ` get [${JSON.stringify(name)}]() { return globalThis.__nitro_vite_envs__[${JSON.stringify(name)}] }`).join(",\n")}
|
|
166
|
+
};
|
|
167
|
+
`;
|
|
168
|
+
return `
|
|
169
|
+
function lazyService(loader) {
|
|
170
|
+
let promise, mod
|
|
171
|
+
return {
|
|
172
|
+
fetch(req) {
|
|
173
|
+
if (mod) { return mod.fetch(req) }
|
|
174
|
+
if (!promise) {
|
|
175
|
+
promise = loader().then(_mod => (mod = _mod.default || _mod))
|
|
176
|
+
}
|
|
177
|
+
return promise.then(mod => mod.fetch(req))
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export const viteServices = {
|
|
183
|
+
${serviceNames.map((name) => {
|
|
184
|
+
return [name, resolve(ctx.nitro.options.buildDir, "vite/services", name, ctx._entryPoints[name])];
|
|
185
|
+
}).map(([name, entry]) => `[${JSON.stringify(name)}]: lazyService(() => import(${JSON.stringify(entry)}))`).join(",\n")}
|
|
186
|
+
};
|
|
187
|
+
`;
|
|
188
|
+
}
|
|
189
|
+
const NITRO_PROXY_PREFIX = "\0nitro-env-proxy:";
|
|
190
|
+
function nitroDevServiceProxy() {
|
|
191
|
+
return {
|
|
192
|
+
name: "nitro:dev-service-proxy",
|
|
193
|
+
enforce: "pre",
|
|
194
|
+
applyToEnvironment: (env) => env.name !== "nitro" && env.config.consumer === "server",
|
|
195
|
+
apply: (_config, configEnv) => configEnv.command === "serve",
|
|
196
|
+
resolveId: {
|
|
197
|
+
filter: { id: /^nitro(\/|$)/ },
|
|
198
|
+
handler(id) {
|
|
199
|
+
if (id === "nitro" || id.startsWith("nitro/")) return {
|
|
200
|
+
id: NITRO_PROXY_PREFIX + id,
|
|
201
|
+
moduleSideEffects: false
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
load: {
|
|
206
|
+
filter: { id: /^\0nitro-env-proxy:/ },
|
|
207
|
+
handler(id) {
|
|
208
|
+
if (!id.startsWith(NITRO_PROXY_PREFIX)) return;
|
|
209
|
+
const originalId = id.slice(17);
|
|
210
|
+
return {
|
|
211
|
+
code: [
|
|
212
|
+
`const _mod = await globalThis.__VITE_ENVIRONMENT_RUNNER_IMPORT__("nitro", ${JSON.stringify(originalId)});`,
|
|
213
|
+
`__vite_ssr_exportAll__(_mod);`,
|
|
214
|
+
`export default _mod.default;`
|
|
215
|
+
].join("\n"),
|
|
216
|
+
map: null
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
181
222
|
const DEFAULT_EXTENSIONS = [
|
|
182
223
|
".ts",
|
|
183
224
|
".js",
|
|
@@ -195,8 +236,7 @@ function nitro(pluginConfig = {}) {
|
|
|
195
236
|
nitroEnv(ctx),
|
|
196
237
|
nitroMain(ctx),
|
|
197
238
|
nitroPrepare(ctx),
|
|
198
|
-
|
|
199
|
-
nitroServiceProxy(),
|
|
239
|
+
nitroDevServiceProxy(),
|
|
200
240
|
nitroPreviewPlugin(ctx),
|
|
201
241
|
pluginConfig.experimental?.vite?.assetsImport !== false && assetsPlugin({ experimental: { clientBuildFallback: false } })
|
|
202
242
|
].filter(Boolean);
|
|
@@ -353,29 +393,6 @@ function nitroPrepare(ctx) {
|
|
|
353
393
|
}
|
|
354
394
|
};
|
|
355
395
|
}
|
|
356
|
-
function nitroService(ctx) {
|
|
357
|
-
return {
|
|
358
|
-
name: "nitro:service",
|
|
359
|
-
enforce: "pre",
|
|
360
|
-
sharedDuringBuild: true,
|
|
361
|
-
applyToEnvironment: (env) => env.name === "nitro",
|
|
362
|
-
resolveId: {
|
|
363
|
-
filter: { id: /^#nitro-vite-setup$/ },
|
|
364
|
-
async handler(id) {
|
|
365
|
-
if (id === "#nitro-vite-setup") return {
|
|
366
|
-
id,
|
|
367
|
-
moduleSideEffects: true
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
|
-
load: {
|
|
372
|
-
filter: { id: /^#nitro-vite-setup$/ },
|
|
373
|
-
async handler(id) {
|
|
374
|
-
if (id === "#nitro-vite-setup") return prodSetup(ctx);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
396
|
function createContext(pluginConfig) {
|
|
380
397
|
return {
|
|
381
398
|
pluginConfig,
|
|
@@ -388,6 +405,7 @@ function useNitro(ctx) {
|
|
|
388
405
|
return ctx.nitro;
|
|
389
406
|
}
|
|
390
407
|
async function setupNitroContext(ctx, configEnv, userConfig) {
|
|
408
|
+
const providedNitro = ctx.pluginConfig._nitro;
|
|
391
409
|
const nitroConfig = {
|
|
392
410
|
dev: configEnv.command === "serve",
|
|
393
411
|
builder: "vite",
|
|
@@ -396,9 +414,13 @@ async function setupNitroContext(ctx, configEnv, userConfig) {
|
|
|
396
414
|
};
|
|
397
415
|
nitroConfig.modules ??= [];
|
|
398
416
|
for (const plugin of flattenPlugins(userConfig.plugins || [])) if (plugin.nitro) nitroConfig.modules.push(plugin.nitro);
|
|
417
|
+
const vServicesId = "#nitro/virtual/vite-services";
|
|
418
|
+
nitroConfig.virtual ??= {};
|
|
419
|
+
nitroConfig.virtual[vServicesId] = () => viteServicesTemplate(ctx);
|
|
420
|
+
if (providedNitro) providedNitro.options.virtual[vServicesId] = nitroConfig.virtual[vServicesId];
|
|
399
421
|
const dotenvFileNames = [".env", ".env.local"];
|
|
400
422
|
if (configEnv.mode) dotenvFileNames.push(`.env.${configEnv.mode}`, `.env.${configEnv.mode}.local`);
|
|
401
|
-
ctx.nitro =
|
|
423
|
+
ctx.nitro = providedNitro || await createNitro(nitroConfig, { dotenv: { fileName: dotenvFileNames } });
|
|
402
424
|
if (!ctx.services?.ssr) if (userConfig.environments?.ssr === void 0) {
|
|
403
425
|
const ssrEntry = resolveModulePath("./entry-server", {
|
|
404
426
|
from: [
|
|
@@ -436,10 +458,6 @@ async function setupNitroContext(ctx, configEnv, userConfig) {
|
|
|
436
458
|
baseURL: "/",
|
|
437
459
|
fallthrough: true
|
|
438
460
|
});
|
|
439
|
-
if (!ctx.nitro.options.dev) ctx.nitro.options.unenv.push({
|
|
440
|
-
meta: { name: "nitro-vite" },
|
|
441
|
-
polyfill: ["#nitro-vite-setup"]
|
|
442
|
-
});
|
|
443
461
|
await ctx.nitro.hooks.callHook("build:before", ctx.nitro);
|
|
444
462
|
ctx.bundlerConfig = await getBundlerConfig(ctx);
|
|
445
463
|
await ctx.nitro.hooks.callHook("rollup:before", ctx.nitro, ctx.bundlerConfig.rollupConfig || ctx.bundlerConfig.rolldownConfig);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.260610-beta",
|
|
4
4
|
"description": "Build and Deploy Universal JavaScript Servers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-routes",
|
|
@@ -69,51 +69,51 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"consola": "^3.4.2",
|
|
72
|
-
"crossws": "^0.4.
|
|
72
|
+
"crossws": "^0.4.6",
|
|
73
73
|
"db0": "^0.3.4",
|
|
74
|
-
"env-runner": "^0.1.
|
|
75
|
-
"h3": "
|
|
74
|
+
"env-runner": "^0.1.12",
|
|
75
|
+
"h3": "2.0.1-rc.22",
|
|
76
76
|
"hookable": "^6.1.1",
|
|
77
77
|
"nf3": "^0.3.17",
|
|
78
|
-
"ocache": "^0.1.
|
|
79
|
-
"ofetch": "
|
|
78
|
+
"ocache": "^0.1.5",
|
|
79
|
+
"ofetch": "2.0.0-alpha.3",
|
|
80
80
|
"ohash": "^2.0.11",
|
|
81
|
-
"rolldown": "^1.0
|
|
82
|
-
"srvx": "^0.11.
|
|
83
|
-
"unenv": "
|
|
84
|
-
"unstorage": "
|
|
81
|
+
"rolldown": "^1.1.0",
|
|
82
|
+
"srvx": "^0.11.16",
|
|
83
|
+
"unenv": "2.0.0-rc.24",
|
|
84
|
+
"unstorage": "2.0.0-alpha.7"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@apphosting/common": "^0.0.9",
|
|
88
88
|
"@azure/functions": "^3.5.1",
|
|
89
89
|
"@azure/static-web-apps-cli": "^2.0.9",
|
|
90
|
-
"@cloudflare/workers-types": "^4.
|
|
91
|
-
"@cloudflare/workers-utils": "^0.
|
|
90
|
+
"@cloudflare/workers-types": "^4.20260609.1",
|
|
91
|
+
"@cloudflare/workers-utils": "^0.23.0",
|
|
92
92
|
"@deno/types": "^0.0.1",
|
|
93
93
|
"@hiogawa/vite-plugin-fullstack": "^0.0.11",
|
|
94
|
-
"@netlify/edge-functions": "^3.0.
|
|
95
|
-
"@netlify/functions": "^5.
|
|
94
|
+
"@netlify/edge-functions": "^3.0.8",
|
|
95
|
+
"@netlify/functions": "^5.3.0",
|
|
96
96
|
"@rollup/plugin-alias": "^6.0.0",
|
|
97
|
-
"@rollup/plugin-commonjs": "^29.0.
|
|
97
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
98
98
|
"@rollup/plugin-inject": "^5.0.5",
|
|
99
99
|
"@rollup/plugin-json": "^6.1.0",
|
|
100
100
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
101
101
|
"@rollup/plugin-replace": "^6.0.3",
|
|
102
|
-
"@scalar/api-reference": "^1.
|
|
103
|
-
"@scalar/openapi-types": "^0.
|
|
104
|
-
"@types/aws-lambda": "^8.10.
|
|
102
|
+
"@scalar/api-reference": "^1.59.2",
|
|
103
|
+
"@scalar/openapi-types": "^0.9.1",
|
|
104
|
+
"@types/aws-lambda": "^8.10.162",
|
|
105
105
|
"@types/estree": "^1.0.9",
|
|
106
106
|
"@types/etag": "^1.8.4",
|
|
107
107
|
"@types/http-proxy": "^1.17.17",
|
|
108
|
-
"@types/node": "^25.9.
|
|
108
|
+
"@types/node": "^25.9.2",
|
|
109
109
|
"@types/node-fetch": "^2.6.13",
|
|
110
110
|
"@types/semver": "^7.7.1",
|
|
111
111
|
"@types/xml2js": "^0.4.14",
|
|
112
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
113
|
-
"@vercel/queue": "^0.
|
|
114
|
-
"@vitest/coverage-v8": "^4.1.
|
|
112
|
+
"@typescript/native-preview": "7.0.0-dev.20260609.1",
|
|
113
|
+
"@vercel/queue": "^0.3.0",
|
|
114
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
115
115
|
"automd": "^0.4.3",
|
|
116
|
-
"c12": "
|
|
116
|
+
"c12": "4.0.0-beta.5",
|
|
117
117
|
"changelogen": "^0.6.2",
|
|
118
118
|
"chokidar": "^5.0.0",
|
|
119
119
|
"citty": "^0.2.2",
|
|
@@ -138,27 +138,27 @@
|
|
|
138
138
|
"magic-string": "^0.30.21",
|
|
139
139
|
"mdzilla": "^0.2.1",
|
|
140
140
|
"mime": "^4.1.0",
|
|
141
|
-
"miniflare": "^4.
|
|
141
|
+
"miniflare": "^4.20260609.0",
|
|
142
142
|
"mlly": "^1.8.2",
|
|
143
143
|
"nypm": "^0.6.6",
|
|
144
144
|
"obuild": "^0.4.36",
|
|
145
145
|
"oxc-parser": "link:shims/oxc-parser",
|
|
146
|
-
"oxfmt": "^0.
|
|
147
|
-
"oxlint": "^1.
|
|
146
|
+
"oxfmt": "^0.54.0",
|
|
147
|
+
"oxlint": "^1.69.0",
|
|
148
148
|
"pathe": "^2.0.3",
|
|
149
149
|
"perfect-debounce": "^2.1.0",
|
|
150
150
|
"pkg-types": "^2.3.1",
|
|
151
151
|
"pretty-bytes": "^7.1.0",
|
|
152
|
-
"react": "^19.2.
|
|
152
|
+
"react": "^19.2.7",
|
|
153
153
|
"rendu": "^0.1.0",
|
|
154
|
-
"rollup": "^4.
|
|
154
|
+
"rollup": "^4.61.1",
|
|
155
155
|
"rou3": "^0.8.1",
|
|
156
156
|
"scule": "^1.3.0",
|
|
157
|
-
"semver": "^7.8.
|
|
157
|
+
"semver": "^7.8.3",
|
|
158
158
|
"serve-placeholder": "^2.0.2",
|
|
159
159
|
"source-map": "^0.7.6",
|
|
160
160
|
"std-env": "^4.1.0",
|
|
161
|
-
"tinyglobby": "^0.2.
|
|
161
|
+
"tinyglobby": "^0.2.17",
|
|
162
162
|
"tsconfck": "^3.1.6",
|
|
163
163
|
"typescript": "^6.0.3",
|
|
164
164
|
"ufo": "^1.6.4",
|
|
@@ -168,21 +168,21 @@
|
|
|
168
168
|
"unimport": "^6.3.0",
|
|
169
169
|
"untyped": "^2.0.0",
|
|
170
170
|
"unwasm": "^0.5.3",
|
|
171
|
-
"vite": "^8.0.
|
|
172
|
-
"vite7": "npm:vite@^7.3.
|
|
173
|
-
"vitest": "^4.1.
|
|
174
|
-
"wrangler": "^4.
|
|
171
|
+
"vite": "^8.0.16",
|
|
172
|
+
"vite7": "npm:vite@^7.3.5",
|
|
173
|
+
"vitest": "^4.1.8",
|
|
174
|
+
"wrangler": "^4.99.0",
|
|
175
175
|
"xml2js": "^0.6.2",
|
|
176
176
|
"youch": "^4.1.1",
|
|
177
177
|
"youch-core": "^0.3.3",
|
|
178
|
-
"zephyr-agent": "^
|
|
178
|
+
"zephyr-agent": "^0.2.0"
|
|
179
179
|
},
|
|
180
180
|
"peerDependencies": {
|
|
181
|
-
"@vercel/queue": "^0.
|
|
181
|
+
"@vercel/queue": "^0.3.0",
|
|
182
182
|
"dotenv": "*",
|
|
183
183
|
"giget": "*",
|
|
184
|
-
"jiti": "^2.
|
|
185
|
-
"rollup": "^4.
|
|
184
|
+
"jiti": "^2.7.0",
|
|
185
|
+
"rollup": "^4.61.1",
|
|
186
186
|
"vite": "^7 || ^8",
|
|
187
187
|
"xml2js": "^0.6.2",
|
|
188
188
|
"zephyr-agent": "^0.2.0"
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
"engines": {
|
|
217
217
|
"node": "^20.19.0 || >=22.12.0"
|
|
218
218
|
},
|
|
219
|
-
"packageManager": "pnpm@11.
|
|
219
|
+
"packageManager": "pnpm@11.5.2",
|
|
220
220
|
"compatiblePackages": {
|
|
221
221
|
"schemaVersion": 1,
|
|
222
222
|
"vite": {
|