nitro-nightly 3.1.0-20251028-144954-cdeb667d → 3.1.0-20251028-160624-0b002649
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/info.mjs
CHANGED
|
@@ -123,6 +123,9 @@ function baseBuildConfig(nitro) {
|
|
|
123
123
|
"nitro/runtime": runtimeDir,
|
|
124
124
|
"nitropack/runtime": runtimeDir,
|
|
125
125
|
// Backwards compatibility
|
|
126
|
+
"nitro/deps/h3": "h3",
|
|
127
|
+
"nitro/deps/ofetch": "ofetch",
|
|
128
|
+
"nitro/h3": "h3",
|
|
126
129
|
...env.alias
|
|
127
130
|
});
|
|
128
131
|
return {
|
package/dist/_build/prepare.mjs
CHANGED
|
@@ -214,6 +214,11 @@ function _resolveExportConditions(conditions, opts) {
|
|
|
214
214
|
resolvedConditions.push("wasm", "unwasm");
|
|
215
215
|
}
|
|
216
216
|
resolvedConditions.push("import", "default");
|
|
217
|
+
if ("Bun" in globalThis) {
|
|
218
|
+
resolvedConditions.push("bun");
|
|
219
|
+
} else if ("Deno" in globalThis) {
|
|
220
|
+
resolvedConditions.push("deno");
|
|
221
|
+
}
|
|
217
222
|
return resolvedConditions.filter(
|
|
218
223
|
(c, i) => resolvedConditions.indexOf(c) === i
|
|
219
224
|
);
|
|
@@ -20,30 +20,16 @@ async function generateFunctionFiles(nitro) {
|
|
|
20
20
|
const buildConfigPath = resolve(nitro.options.output.dir, "config.json");
|
|
21
21
|
const buildConfig = generateBuildConfig(nitro, o11Routes);
|
|
22
22
|
await writeFile(buildConfigPath, JSON.stringify(buildConfig, null, 2));
|
|
23
|
-
let runtime = nitro.options.vercel?.functions?.runtime;
|
|
24
|
-
if (!runtime) {
|
|
25
|
-
const vercelConfig = await readVercelConfig(nitro.options.rootDir);
|
|
26
|
-
if (vercelConfig.bunVersion || "Bun" in globalThis) {
|
|
27
|
-
runtime = `bun${vercelConfig.bunVersion || "1.x"}`;
|
|
28
|
-
} else {
|
|
29
|
-
const systemNodeVersion = getSystemNodeVersion();
|
|
30
|
-
const usedNodeVersion = SUPPORTED_NODE_VERSIONS.find(
|
|
31
|
-
(version) => version >= systemNodeVersion
|
|
32
|
-
) ?? SUPPORTED_NODE_VERSIONS.at(-1);
|
|
33
|
-
runtime = `nodejs${usedNodeVersion}.x`;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
23
|
const functionConfigPath = resolve(
|
|
37
24
|
nitro.options.output.serverDir,
|
|
38
25
|
".vc-config.json"
|
|
39
26
|
);
|
|
40
27
|
const functionConfig = {
|
|
41
|
-
runtime,
|
|
42
|
-
...nitro.options.vercel?.functions,
|
|
43
28
|
handler: "index.mjs",
|
|
44
29
|
launcherType: "Nodejs",
|
|
45
30
|
shouldAddHelpers: false,
|
|
46
|
-
supportsResponseStreaming: true
|
|
31
|
+
supportsResponseStreaming: true,
|
|
32
|
+
...nitro.options.vercel?.functions
|
|
47
33
|
};
|
|
48
34
|
await writeFile(functionConfigPath, JSON.stringify(functionConfig, null, 2));
|
|
49
35
|
for (const [key, value] of Object.entries(nitro.options.routeRules)) {
|
|
@@ -207,6 +193,24 @@ function deprecateSWR(nitro) {
|
|
|
207
193
|
);
|
|
208
194
|
}
|
|
209
195
|
}
|
|
196
|
+
async function resolveVercelRuntime(nitro) {
|
|
197
|
+
let runtime = nitro.options.vercel?.functions?.runtime;
|
|
198
|
+
if (runtime) {
|
|
199
|
+
return runtime;
|
|
200
|
+
}
|
|
201
|
+
const vercelConfig = await readVercelConfig(nitro.options.rootDir);
|
|
202
|
+
if (vercelConfig.bunVersion || "Bun" in globalThis) {
|
|
203
|
+
runtime = "bun1.x";
|
|
204
|
+
} else {
|
|
205
|
+
const systemNodeVersion = getSystemNodeVersion();
|
|
206
|
+
const usedNodeVersion = SUPPORTED_NODE_VERSIONS.find((version) => version >= systemNodeVersion) ?? SUPPORTED_NODE_VERSIONS.at(-1);
|
|
207
|
+
runtime = `nodejs${usedNodeVersion}.x`;
|
|
208
|
+
}
|
|
209
|
+
nitro.options.vercel ??= {};
|
|
210
|
+
nitro.options.vercel.functions ??= {};
|
|
211
|
+
nitro.options.vercel.functions.runtime = runtime;
|
|
212
|
+
return runtime;
|
|
213
|
+
}
|
|
210
214
|
async function readVercelConfig(rootDir) {
|
|
211
215
|
const vercelConfigPath = resolve(rootDir, "vercel.json");
|
|
212
216
|
const vercelConfig = await fsp.readFile(vercelConfigPath).then((config) => JSON.parse(config.toString())).catch(() => ({}));
|
|
@@ -322,7 +326,11 @@ const vercel = defineNitroPreset(
|
|
|
322
326
|
preview: ""
|
|
323
327
|
},
|
|
324
328
|
hooks: {
|
|
325
|
-
"rollup:before": (nitro) => {
|
|
329
|
+
"rollup:before": async (nitro) => {
|
|
330
|
+
const runtime = await resolveVercelRuntime(nitro);
|
|
331
|
+
if (runtime.startsWith("bun") && !nitro.options.exportConditions.includes("bun")) {
|
|
332
|
+
nitro.options.exportConditions.push("bun");
|
|
333
|
+
}
|
|
326
334
|
deprecateSWR(nitro);
|
|
327
335
|
},
|
|
328
336
|
async compiled(nitro) {
|
package/package.json
CHANGED