@nuxt/docs-nightly 5.0.0-29845811.468b7e53 → 5.0.0-29846154.7802b2c2

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.
@@ -1467,7 +1467,7 @@ If the module is yours, learn how to write server code that runs on either Nitro
1467
1467
 
1468
1468
  ### Your Own `server/` Directory
1469
1469
 
1470
- Your own server code is not covered by default, because the errors you get are what show you where the work is. If you want to ship the upgrade before doing that work, turn on `nitroLegacy`:
1470
+ Your own server code is not covered by default, because the errors you get are what show you where the work is. When `nitroLegacy` is off, `NUXT_B9005` lists the files in your `server/` directory that import from `nitropack`, use h3 v1 helpers, or read `event.node`. If you want to ship the upgrade before doing that work, turn on `nitroLegacy`:
1471
1471
 
1472
1472
  ```ts [nuxt.config.ts]
1473
1473
  export default defineNuxtConfig({
@@ -130,7 +130,7 @@ export default defineNuxtModule({
130
130
 
131
131
  ### Declaring What You Cannot Infer
132
132
 
133
- Nuxt reads a registered file's imports to decide which API it uses, so you don't need to declare your compatibility. But if this isn't sufficient, you can set `meta.compatibility.server`:
133
+ Nuxt reads the imports of each registered file, and of the files it imports, to decide which API it uses, so you don't need to declare your compatibility. Type-only imports (`import type`) are ignored, as are files in your runtime directory that no registered file imports. But if this isn't sufficient, you can set `meta.compatibility.server`:
134
134
 
135
135
  ```ts [module.ts]
136
136
  export default defineNuxtModule({
@@ -143,6 +143,20 @@ export default defineNuxtModule({
143
143
 
144
144
  If we can't tell, code will be treated as `nitro2`.
145
145
 
146
+ ### Typing Runtime Config and Events
147
+
148
+ To type runtime config keys your module adds, augment `RuntimeConfig` (or `PublicRuntimeConfig`) from `nuxt/schema`. The keys are then typed in `nuxt`, `nitro2` and `nitro3` files alike.
149
+
150
+ ```ts [module.ts]
151
+ declare module 'nuxt/schema' {
152
+ interface RuntimeConfig {
153
+ myModule: { apiKey: string }
154
+ }
155
+ }
156
+ ```
157
+
158
+ Builder-specific types, such as `H3Event` for `useRequestEvent()` or the full Nitro config in the `nitro:config` hook, come from the generated `.nuxt/nuxt.d.ts`. Without it, they resolve to builder-agnostic types (`RequestEvent` and a reduced Nitro config). Type utilities that accept an event against `RequestEvent` to support any server builder.
159
+
146
160
  ## Nitro-specific Code
147
161
 
148
162
  `nuxt/server` covers request and response work: handlers, errors, router params, query and body reading and validation, headers, CORS, cookies, sessions, redirects, route rules, runtime config and app config. But Nitro covers a lot more, so if you need any of these areas, you might need to stay on Nitro's own imports inside a `nitro2` or `nitro3` file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "5.0.0-29845811.468b7e53",
3
+ "version": "5.0.0-29846154.7802b2c2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",