nitro-nightly 4.0.0-20251030-135442-97badaa1 → 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/_build/vite.build.mjs +1 -1
- package/dist/_build/vite.plugin.mjs +1 -1
- package/dist/_chunks/{B-7HiF0V.mjs → DKi6z_Js.mjs} +0 -4
- package/dist/_presets.mjs +2 -1
- package/dist/builder.mjs +1 -1
- package/dist/presets/vercel/runtime/vercel.node.d.mts +3 -0
- package/dist/presets/vercel/runtime/vercel.node.mjs +15 -0
- package/dist/runtime/index.d.mts +0 -2
- package/dist/runtime/index.mjs +0 -2
- package/dist/types/index.d.mts +8 -2
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
- package/dist/runtime/internal/renderer.d.mts +0 -3
- package/dist/runtime/internal/renderer.mjs +0 -44
- /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
|
@@ -13,7 +13,7 @@ import "../_libs/tinyglobby.mjs";
|
|
|
13
13
|
import "../_libs/compatx.mjs";
|
|
14
14
|
import "../_libs/klona.mjs";
|
|
15
15
|
import { n as a } from "../_libs/std-env.mjs";
|
|
16
|
-
import "../_chunks/
|
|
16
|
+
import "../_chunks/DKi6z_Js.mjs";
|
|
17
17
|
import "../_libs/escape-string-regexp.mjs";
|
|
18
18
|
import "../_libs/dot-prop.mjs";
|
|
19
19
|
import "../_chunks/B5ooyfLk.mjs";
|
|
@@ -2,7 +2,7 @@ import { T as resolve$1, _ as dirname$1, b as join$1, f as resolveModulePath, g
|
|
|
2
2
|
import { f as sanitizeFilePath } from "../_libs/local-pkg.mjs";
|
|
3
3
|
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
4
4
|
import { n as a, t as T } from "../_libs/std-env.mjs";
|
|
5
|
-
import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/
|
|
5
|
+
import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/DKi6z_Js.mjs";
|
|
6
6
|
import { c as prettyPath, o as scanHandlers } from "../_chunks/B5ooyfLk.mjs";
|
|
7
7
|
import { t as createProxyServer } from "../_libs/httpxy.mjs";
|
|
8
8
|
import { i as NodeDevWorker, r as NitroDevApp } from "../_dev.mjs";
|
|
@@ -229,10 +229,6 @@ function getNitroImportsPreset() {
|
|
|
229
229
|
from: "nitro/runtime/internal/storage",
|
|
230
230
|
imports: ["useStorage"]
|
|
231
231
|
},
|
|
232
|
-
{
|
|
233
|
-
from: "nitro/runtime/internal/renderer",
|
|
234
|
-
imports: ["defineRenderHandler"]
|
|
235
|
-
},
|
|
236
232
|
{
|
|
237
233
|
from: "nitro/runtime/internal/meta",
|
|
238
234
|
imports: ["defineRouteMeta"]
|
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);
|
package/dist/builder.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import "./_libs/tinyglobby.mjs";
|
|
|
13
13
|
import "./_libs/compatx.mjs";
|
|
14
14
|
import "./_libs/klona.mjs";
|
|
15
15
|
import "./_libs/std-env.mjs";
|
|
16
|
-
import { a as createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/
|
|
16
|
+
import { a as createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/DKi6z_Js.mjs";
|
|
17
17
|
import "./_libs/escape-string-regexp.mjs";
|
|
18
18
|
import "./_libs/dot-prop.mjs";
|
|
19
19
|
import { n as writeTypes } from "./_chunks/B5ooyfLk.mjs";
|
|
@@ -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/runtime/index.d.mts
CHANGED
|
@@ -7,8 +7,6 @@ export { defineNitroErrorHandler } from "./internal/error/utils.mjs";
|
|
|
7
7
|
export { useRuntimeConfig } from "./internal/runtime-config.mjs";
|
|
8
8
|
// Context
|
|
9
9
|
export { useRequest } from "./internal/context.mjs";
|
|
10
|
-
// Renderer
|
|
11
|
-
export { defineRenderHandler } from "./internal/renderer.mjs";
|
|
12
10
|
// Cache
|
|
13
11
|
export { defineCachedFunction, defineCachedEventHandler, defineCachedHandler, cachedFunction, cachedEventHandler } from "./internal/cache.mjs";
|
|
14
12
|
// ---- Internals that depends on virtual imports should come last ---- //
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -7,8 +7,6 @@ export { defineNitroErrorHandler } from "./internal/error/utils.mjs";
|
|
|
7
7
|
export { useRuntimeConfig } from "./internal/runtime-config.mjs";
|
|
8
8
|
// Context
|
|
9
9
|
export { useRequest } from "./internal/context.mjs";
|
|
10
|
-
// Renderer
|
|
11
|
-
export { defineRenderHandler } from "./internal/renderer.mjs";
|
|
12
10
|
// Cache
|
|
13
11
|
export { defineCachedFunction, defineCachedEventHandler, defineCachedHandler, cachedFunction, cachedEventHandler } from "./internal/cache.mjs";
|
|
14
12
|
// ---- Internals that depends on virtual imports should come last ---- //
|
package/dist/types/index.d.mts
CHANGED
|
@@ -180,8 +180,6 @@ interface NitroRuntimeHooks {
|
|
|
180
180
|
error: CaptureError;
|
|
181
181
|
request: (event: HTTPEvent) => void | Promise<void>;
|
|
182
182
|
response: (res: Response, event: HTTPEvent) => void | Promise<void>;
|
|
183
|
-
"render:before": (context: RenderContext) => void;
|
|
184
|
-
"render:response": (response: Partial<RenderResponse>, context: RenderContext) => void;
|
|
185
183
|
}
|
|
186
184
|
//#endregion
|
|
187
185
|
//#region src/types/runtime/task.d.ts
|
|
@@ -1787,6 +1785,14 @@ interface VercelOptions {
|
|
|
1787
1785
|
*/
|
|
1788
1786
|
regions?: string[];
|
|
1789
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";
|
|
1790
1796
|
}
|
|
1791
1797
|
//#endregion
|
|
1792
1798
|
//#region src/presets/_types.gen.d.ts
|
package/dist/vite.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import "./_libs/tinyglobby.mjs";
|
|
|
13
13
|
import "./_libs/compatx.mjs";
|
|
14
14
|
import "./_libs/klona.mjs";
|
|
15
15
|
import "./_libs/std-env.mjs";
|
|
16
|
-
import "./_chunks/
|
|
16
|
+
import "./_chunks/DKi6z_Js.mjs";
|
|
17
17
|
import "./_libs/escape-string-regexp.mjs";
|
|
18
18
|
import "./_libs/dot-prop.mjs";
|
|
19
19
|
import "./_chunks/B5ooyfLk.mjs";
|
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { defineHandler } from "h3";
|
|
2
|
-
import { useNitroHooks } from "./app.mjs";
|
|
3
|
-
import { useRuntimeConfig } from "./runtime-config.mjs";
|
|
4
|
-
export function defineRenderHandler(render) {
|
|
5
|
-
const runtimeConfig = useRuntimeConfig();
|
|
6
|
-
return defineHandler(async (event) => {
|
|
7
|
-
const nitroHooks = useNitroHooks();
|
|
8
|
-
// Create shared context for hooks
|
|
9
|
-
const ctx = {
|
|
10
|
-
event,
|
|
11
|
-
render,
|
|
12
|
-
response: undefined
|
|
13
|
-
};
|
|
14
|
-
// Call initial hook to prepare and optionally custom render
|
|
15
|
-
await nitroHooks.callHook("render:before", ctx);
|
|
16
|
-
if (!ctx.response) {
|
|
17
|
-
// TODO: Use serve-placeholder
|
|
18
|
-
if (event.url.pathname === `${runtimeConfig.app.baseURL}favicon.ico`) {
|
|
19
|
-
event.res.headers.set("Content-Type", "image/x-icon");
|
|
20
|
-
return "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
21
|
-
}
|
|
22
|
-
ctx.response = await ctx.render(event);
|
|
23
|
-
if (!ctx.response) {
|
|
24
|
-
const _currentStatus = event.res.status;
|
|
25
|
-
event.res.statusText = String(_currentStatus === 200 ? 500 : _currentStatus);
|
|
26
|
-
return "No response returned from render handler: " + event.url.pathname;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// Allow modifying response
|
|
30
|
-
await nitroHooks.callHook("render:response", ctx.response, ctx);
|
|
31
|
-
// Send headers
|
|
32
|
-
if (ctx.response.headers) {
|
|
33
|
-
for (const [key, value] of Object.entries(ctx.response.headers)) {
|
|
34
|
-
event.res.headers.set(key, value);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (ctx.response.status || ctx.response.statusText) {
|
|
38
|
-
event.res.status = ctx.response.status;
|
|
39
|
-
event.res.statusText = ctx.response.statusText;
|
|
40
|
-
}
|
|
41
|
-
// Send response body
|
|
42
|
-
return ctx.response.body;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
File without changes
|
|
File without changes
|