Skip to content

Commit 8fee7c2

Browse files
authored
Merge branch 'v3' into sevalla-nitro
2 parents c473fda + 665348a commit 8fee7c2

File tree

28 files changed

+268
-241
lines changed

28 files changed

+268
-241
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "nitro-devcontainer",
55
"forwardPorts": [3000],
6-
"image": "node:22",
6+
"image": "node:lts",
77
"features": {},
88
"customizations": {
99
"vscode": {

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
You can involve in discussions using:
1010

11-
- [Github Discussions](discussions)
11+
- [GitHub Discussions](discussions)
1212
- [Nitro Discord](https://discord.nitro.build)
1313

1414
## Contribute to the Code

docs/1.guide/9.plugins.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ You can use plugins to register a hook that can run on request lifecycle:
9797

9898
```ts
9999
export default defineNitroPlugin((nitroApp) => {
100-
nitroApp.hooks.hook("request", (event) => {
101-
console.log("on request", event.path);
100+
nitroApp.hooks.hook("request", (req) => {
101+
console.log("on request", req.url);
102102
});
103103

104104
nitroApp.hooks.hook("beforeResponse", (event, { body }) => {

docs/2.deploy/20.providers/deno-deploy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cd .output
2121
deployctl deploy --project=my-project server/index.ts
2222
```
2323

24-
## Deploy within CI/CD using gitHub actions
24+
## Deploy within CI/CD using GitHub actions
2525

2626
You just need to include the deployctl GitHub Action as a step in your workflow.
2727

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"fs-extra": "^11.3.1",
8282
"globby": "^14.1.0",
8383
"gzip-size": "^7.0.0",
84-
"h3": "2.0.0-beta.3",
84+
"h3": "2.0.0-beta.4",
8585
"hookable": "^5.5.3",
8686
"httpxy": "^0.1.7",
8787
"ioredis": "^5.7.0",
@@ -107,7 +107,7 @@
107107
"serve-placeholder": "^2.0.2",
108108
"serve-static": "^2.2.0",
109109
"source-map": "^0.7.6",
110-
"srvx": "^0.8.6",
110+
"srvx": "^0.8.7",
111111
"std-env": "^3.9.0",
112112
"ufo": "^1.6.1",
113113
"ultrahtml": "^1.6.0",

pnpm-lock.yaml

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/build/vite/plugin.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,19 @@ function nitroServicePlugin(ctx: NitroPluginContext): VitePlugin {
248248
return id;
249249
}
250250

251+
// Run rollup resolve hooks in dev (VFS support)
252+
if (ctx.nitro?.options.dev) {
253+
for (const plugin of ctx.rollupConfig!.config
254+
.plugins as RollupPlugin[]) {
255+
if (typeof plugin.resolveId !== "function") continue;
256+
// prettier-ignore
257+
const resolved = await plugin.resolveId.call(this, id, importer, options);
258+
if (resolved) {
259+
return resolved;
260+
}
261+
}
262+
}
263+
251264
// Resolve built-in deps
252265
if (
253266
runtimeDependencies.some(
@@ -310,6 +323,18 @@ function nitroServicePlugin(ctx: NitroPluginContext): VitePlugin {
310323
}
311324
return `export const findService = ${rou3Compiler.compileRouterToString(router)};`;
312325
}
326+
327+
// Run rollup load hooks in dev (VFS support)
328+
if (ctx.nitro?.options.dev) {
329+
for (const plugin of ctx.rollupConfig!.config
330+
.plugins as RollupPlugin[]) {
331+
if (typeof plugin.load !== "function") continue;
332+
const resolved = await plugin.load.call(this, id);
333+
if (resolved) {
334+
return resolved;
335+
}
336+
}
337+
}
313338
},
314339
},
315340
};

src/presets/_nitro/runtime/nitro-dev.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ parentPort?.on("message", (msg) => {
2929

3030
const nitroApp = useNitroApp();
3131

32-
const server = new Server(toNodeHandler(nitroApp.h3App.fetch));
32+
const server = new Server(toNodeHandler(nitroApp.fetch));
3333
let listener: Server | undefined;
3434

3535
listen()
@@ -47,7 +47,7 @@ if (import.meta._websocket) {
4747
}
4848

4949
// Register tasks handlers
50-
nitroApp.h3App.get(
50+
nitroApp._h3?.get(
5151
"/_nitro/tasks",
5252
defineHandler(async (event) => {
5353
const _tasks = await Promise.all(
@@ -63,7 +63,7 @@ nitroApp.h3App.get(
6363
})
6464
);
6565

66-
nitroApp.h3App.use(
66+
nitroApp._h3?.use(
6767
"/_nitro/tasks/:name",
6868
defineHandler(async (event) => {
6969
const name = getRouterParam(event, "name") as string;

src/presets/_nitro/runtime/nitro-prerenderer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ export const closePrerenderer = () => nitroApp.hooks.callHook("close");
1212

1313
nitroApp.hooks.hook("error", (error, context) => {
1414
if (
15-
isEvent(context.event) &&
1615
!(error as HTTPError).unhandled &&
1716
(error as HTTPError).status >= 500 &&
17+
context.event?.req?.headers instanceof Headers &&
1818
context.event.req.headers.get("x-nitro-prerender")
1919
) {
20-
const url = getRequestURL(context.event).href;
2120
consola.error(
2221
`[prerender error]`,
2322
`[${context.event.req.method}]`,
24-
`[${url}]`,
23+
`[${context.event.req.url}]`,
2524
error
2625
);
2726
}

src/presets/aws-amplify/runtime/aws-amplify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { toNodeHandler } from "srvx/node";
66

77
const nitroApp = useNitroApp();
88

9-
const server = new Server(toNodeHandler(nitroApp.h3App.fetch));
9+
const server = new Server(toNodeHandler(nitroApp.fetch));
1010

1111
// @ts-ignore
1212
server.listen(3000, (err) => {

0 commit comments

Comments
 (0)