Skip to content

Commit

Permalink
Merge branch 'v2' into feat/default-runtime-node-version
Browse files Browse the repository at this point in the history
  • Loading branch information
luc122c authored Oct 16, 2024
2 parents 761148c + b9fcc83 commit 75f1aa4
Show file tree
Hide file tree
Showing 13 changed files with 248 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "nitro-devcontainer",
"forwardPorts": [3000],
"image": "node:20.17.0",
"image": "node:20.18.0",
"features": {},
"customizations": {
"vscode": {
Expand Down
8 changes: 4 additions & 4 deletions docs/1.guide/1.utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ icon: ri:tools-line

# Server Utils

> Enjoy auto imported server utils and extend with your own utils.
> Enjoy auto-imported server utils and extend with your own utils.
## Auto imports

Expand All @@ -13,15 +13,15 @@ It is because Nitro uses [unjs/unimport](https://github.com/unjs/unimport) to au

## H3 utils

Nitro enables all [h3 utils](https://h3.unjs.io/utils) as auto imports so you can use `defineEventHandler`, `readBody`, etc without manually importing them.
Nitro enables all [h3 utils](https://h3.unjs.io/utils) as auto imports so you can use `defineEventHandler`, `readBody`, etc. without manually importing them.

::read-more{title="H3 Docs" to="https://h3.unjs.io/utils"}
::


### `utils` directory

You can add your application specific utils inside `utils/` directory and they will be auto imported when used.
You can add your application specific utils inside `utils/` directory and they will be auto-imported when used.
Every export in the `utils` directory and its subdirectories will become available globally in your application.


Expand Down Expand Up @@ -63,7 +63,7 @@ Check [the source code](https://github.com/unjs/nitro/blob/v2/src/core/config/re
::

::read-more{to="/guide/typescript"}
The types are auto generated for global auto-imports when running the `prepare` or `dev` command. See [TypeScript](/guide/typescript) guide, for IDE support.
The types are auto-generated for global auto-imports when running the `prepare` or `dev` command. See [TypeScript](/guide/typescript) guide, for IDE support.
::

## Manual imports
Expand Down
2 changes: 1 addition & 1 deletion docs/1.guide/2.routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ This behaviour can be overridden by some request properties (eg.: `Accept` or `U

Nitro allows you to add logic at the top-level for each route of your configuration. It can be used for redirecting, proxying, caching and adding headers to routes.

It is a map from route pattern (following [unjs/radix3](https://github.com/unjs/radix3#route-matcher)) to route options.
It is a map from route pattern (following [unjs/radix3](https://github.com/unjs/rou3/tree/radix3#route-matcher)) to route options.

When `cache` option is set, handlers matching pattern will be automatically wrapped with `defineCachedEventHandler`. See the [cache guide](/guide/cache) to learn more about this function.

Expand Down
16 changes: 16 additions & 0 deletions docs/2.deploy/20.providers/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ rules = [
bucket = ".output/public"
```
## Runtime hooks
You can use [runtime hooks](/guide/plugins#nitro-runtime-hooks) bellow in order to extend [worker handlers](https://developers.cloudflare.com/workers/runtime-apis/handlers/).
:read-more{to="/guide/plugins#nitro-runtime-hooks"}
> [!NOTE]
> This feature is currently available in [nightly channel](https://nitro.unjs.io/guide/nightly) only.
- [`cloudflare:scheduled`](https://developers.cloudflare.com/workers/runtime-apis/handlers/scheduled/)
- [`cloudflare:email`](https://developers.cloudflare.com/email-routing/email-workers/runtime-api/)
- [`cloudflare:queue`](https://developers.cloudflare.com/queues/configuration/javascript-apis/#consumer)
- [`cloudflare:tail`](https://developers.cloudflare.com/workers/runtime-apis/handlers/tail/)
- `cloudflare:trace`
### Preview your app locally
You can use [wrangler](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler), to preview your app locally:
Expand Down
2 changes: 1 addition & 1 deletion docs/3.config/0.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export default defineNitroErrorHandler((error, event) => {

**🧪 Experimental!**

Route options. It is a map from route pattern (following [unjs/radix3](https://github.com/unjs/radix3#route-matcher)) to route options.
Route options. It is a map from route pattern (following [unjs/radix3](https://github.com/unjs/rou3/tree/radix3#route-matcher)) to route options.

When `cache` option is set, handlers matching pattern will be automatically wrapped with `defineCachedEventHandler`.

Expand Down
Binary file modified docs/bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"build": "undocs build"
},
"devDependencies": {
"undocs": "^0.2.29"
"undocs": "^0.2.30"
}
}
2 changes: 1 addition & 1 deletion examples/api-routes/api/test.post.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default defineEventHandler(async () => {
export default defineEventHandler(async (event) => {
const body = await readBody(event);
return {
message: "Test post handler",
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
"resolutions": {
"nitropack": "link:.",
"undici": "^6.19.8"
"undici": "^6.20.0"
},
"dependencies": {
"@cloudflare/kv-asset-handler": "^0.3.4",
Expand All @@ -120,7 +120,7 @@
"cookie-es": "^1.2.2",
"croner": "^8.1.2",
"crossws": "^0.3.1",
"db0": "^0.2.0",
"db0": "^0.2.1",
"defu": "^6.1.4",
"destr": "^2.0.3",
"dot-prop": "^9.0.0",
Expand All @@ -138,7 +138,7 @@
"klona": "^2.0.6",
"knitwork": "^1.1.0",
"listhen": "^1.9.0",
"magic-string": "^0.30.11",
"magic-string": "^0.30.12",
"magicast": "^0.3.5",
"mime": "^4.0.4",
"mlly": "^1.7.2",
Expand Down Expand Up @@ -171,9 +171,9 @@
"devDependencies": {
"@azure/functions": "^3.5.1",
"@azure/static-web-apps-cli": "^1.1.10",
"@cloudflare/workers-types": "^4.20241004.0",
"@cloudflare/workers-types": "^4.20241011.0",
"@deno/types": "^0.0.1",
"@scalar/api-reference": "^1.25.32",
"@scalar/api-reference": "^1.25.35",
"@types/archiver": "^6.0.2",
"@types/aws-lambda": "^8.10.145",
"@types/estree": "^1.0.6",
Expand All @@ -195,10 +195,10 @@
"firebase-admin": "^12.6.0",
"firebase-functions": "^4.9.0",
"get-port-please": "^3.1.2",
"miniflare": "^3.20240925.1",
"miniflare": "^3.20241004.0",
"prettier": "^3.3.3",
"typescript": "^5.6.3",
"unbuild": "3.0.0-rc.10",
"unbuild": "3.0.0-rc.11",
"undici": "^6.20.0",
"vitest": "^2.1.2",
"xml2js": "^0.6.2"
Expand All @@ -211,7 +211,7 @@
"optional": true
}
},
"packageManager": "pnpm@9.11.0",
"packageManager": "pnpm@9.12.1",
"engines": {
"node": "^16.11.0 || >=17.0.0"
},
Expand Down
Loading

0 comments on commit 75f1aa4

Please sign in to comment.