nitro-nightly 4.0.0-20251030-144744-c8bf5222 → 4.0.0-20251030-211409-b9690b9a
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/_presets.mjs +2 -1
- package/dist/presets/vercel/runtime/vercel.node.d.mts +3 -0
- package/dist/presets/vercel/runtime/vercel.node.mjs +15 -0
- package/dist/types/index.d.mts +8 -0
- package/package.json +1 -1
- /package/dist/presets/vercel/runtime/{vercel.d.mts → vercel.web.d.mts} +0 -0
- /package/dist/presets/vercel/runtime/{vercel.mjs → vercel.web.mjs} +0 -0
package/dist/_presets.mjs
CHANGED
|
@@ -1531,7 +1531,7 @@ async function writePrerenderConfig(filename, isrConfig, bypassToken) {
|
|
|
1531
1531
|
//#endregion
|
|
1532
1532
|
//#region src/presets/vercel/preset.ts
|
|
1533
1533
|
const vercel = defineNitroPreset({
|
|
1534
|
-
entry: "./vercel/runtime/vercel",
|
|
1534
|
+
entry: "./vercel/runtime/vercel.{format}",
|
|
1535
1535
|
output: {
|
|
1536
1536
|
dir: "{{ rootDir }}/.vercel/output",
|
|
1537
1537
|
serverDir: "{{ output.dir }}/functions/__server.func",
|
|
@@ -1544,6 +1544,7 @@ const vercel = defineNitroPreset({
|
|
|
1544
1544
|
hooks: {
|
|
1545
1545
|
"build:before": async (nitro) => {
|
|
1546
1546
|
if ((await resolveVercelRuntime(nitro)).startsWith("bun") && !nitro.options.exportConditions.includes("bun")) nitro.options.exportConditions.push("bun");
|
|
1547
|
+
nitro.options.entry = nitro.options.entry.replace("{format}", nitro.options.vercel?.entryFormat === "node" ? "node" : "web");
|
|
1547
1548
|
},
|
|
1548
1549
|
"rollup:before": (nitro) => {
|
|
1549
1550
|
deprecateSWR(nitro);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "#nitro-internal-pollyfills";
|
|
2
|
+
import { toNodeHandler } from "srvx/node";
|
|
3
|
+
import { useNitroApp } from "nitro/runtime";
|
|
4
|
+
const nitroApp = useNitroApp();
|
|
5
|
+
const handler = toNodeHandler(nitroApp.fetch);
|
|
6
|
+
export default function nodeHandler(req, res) {
|
|
7
|
+
const query = req.headers["x-now-route-matches"];
|
|
8
|
+
if (query) {
|
|
9
|
+
const url = new URLSearchParams(query).get("url");
|
|
10
|
+
if (url) {
|
|
11
|
+
req.url = decodeURIComponent(url);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return handler(req, res);
|
|
15
|
+
}
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1785,6 +1785,14 @@ interface VercelOptions {
|
|
|
1785
1785
|
*/
|
|
1786
1786
|
regions?: string[];
|
|
1787
1787
|
functions?: VercelServerlessFunctionConfig;
|
|
1788
|
+
/**
|
|
1789
|
+
* Handler format to use for Vercel Serverless Functions.
|
|
1790
|
+
*
|
|
1791
|
+
* Using `node` format enables compatibility with Node.js specific APIs in your Nitro application (e.g., `req.runtime.node`).
|
|
1792
|
+
*
|
|
1793
|
+
* Possible values are: `web` (default) and `node`.
|
|
1794
|
+
*/
|
|
1795
|
+
entryFormat?: "web" | "node";
|
|
1788
1796
|
}
|
|
1789
1797
|
//#endregion
|
|
1790
1798
|
//#region src/presets/_types.gen.d.ts
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|