@nuxt/docs-nightly 5.0.0-29560209.2c61a3c1 → 5.0.0-29560959.2cd7cfc5

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.
@@ -151,7 +151,9 @@ The callback function of the `render:html` hook allows you to mutate the HTML be
151
151
  <!-- TODO: figure out how to use twoslash to inject types for a different context -->
152
152
 
153
153
  ```ts [server/plugins/extend-html.ts]
154
- export default defineNitroPlugin((nitroApp) => {
154
+ import { definePlugin } from 'nitro'
155
+
156
+ export default definePlugin((nitroApp) => {
155
157
  nitroApp.hooks.hook('render:html', (html, { event }) => {
156
158
  // This will be an object representation of the html template.
157
159
  console.log(html)
@@ -160,7 +160,9 @@ Create a plugin in `~~/server/plugins/my-plugin.ts` like this:
160
160
  <!-- TODO: figure out how to use twoslash to inject types for a different context -->
161
161
 
162
162
  ```ts [server/plugins/my-plugin.ts]
163
- export default defineNitroPlugin((nitro) => {
163
+ import { definePlugin } from 'nitro'
164
+
165
+ export default definePlugin((nitro) => {
164
166
  nitro.hooks.hook('render:html', (html) => {
165
167
  html.head.push('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">')
166
168
  })
@@ -234,7 +234,7 @@ The `nitropack` package has been renamed to `nitro`. All import paths have chang
234
234
  |---|---|
235
235
  | `nitropack` | `nitro` |
236
236
  | `nitropack/types` | `nitro/types` |
237
- | `nitropack/runtime` | `nitro/runtime` |
237
+ | `nitropack/runtime` | `nitro` |
238
238
  | `h3` (for server utilities) | `nitro/h3` |
239
239
 
240
240
  Auto-imports within server routes (`defineEventHandler`, `getQuery`, `readBody`, `useRuntimeConfig`, etc.) continue to work without changes.
@@ -345,7 +345,7 @@ If you define redirect route rules, the property name has changed:
345
345
 
346
346
  #### For Module Authors: Additional Changes
347
347
 
348
- - **Nitro plugin imports**: Use `import { defineNitroPlugin } from 'nitro/runtime'` for explicit imports (auto-imports still work).
348
+ - **Nitro plugin imports**: Use `import { definePlugin } from 'nitro'` for explicit imports (auto-imports still work).
349
349
  - **Runtime hooks**: `nitroApp.hooks.hook('beforeResponse', ...)` and `nitroApp.hooks.hook('afterResponse', ...)` have been replaced by `nitroApp.hooks.hook('response', ...)`.
350
350
  - **`getRouteRules()` from `nitro/app`**: On the server, the Nitro helper changed from `getRouteRules(event)` to `getRouteRules(method, pathname)`, which returns `{ routeRules }`.
351
351
 
@@ -94,7 +94,9 @@ Nuxt will automatically read any files in the `~~/server/plugins` directory and
94
94
  **Example:**
95
95
 
96
96
  ```ts [server/plugins/nitroPlugin.ts]
97
- export default defineNitroPlugin((nitroApp) => {
97
+ import { definePlugin } from 'nitro'
98
+
99
+ export default definePlugin((nitroApp) => {
98
100
  console.log('Nitro plugin', nitroApp)
99
101
  })
100
102
  ```
@@ -526,9 +528,10 @@ Alternatively, you can create a storage mount point using a server plugin and ru
526
528
 
527
529
  ::code-group
528
530
  ```ts [server/plugins/storage.ts]
531
+ import { definePlugin } from 'nitro'
529
532
  import redisDriver from 'unstorage/drivers/redis'
530
533
 
531
- export default defineNitroPlugin(() => {
534
+ export default definePlugin(() => {
532
535
  const storage = useStorage()
533
536
 
534
537
  // Dynamically pass in credentials from runtime configuration, or other sources
@@ -58,7 +58,9 @@ Explore all available App hooks.
58
58
  These hooks are available for [server plugins](/docs/4.x/directory-structure/server#server-plugins) to hook into Nitro's runtime behavior.
59
59
 
60
60
  ```ts [~~/server/plugins/test.ts]
61
- export default defineNitroPlugin((nitroApp) => {
61
+ import { definePlugin } from 'nitro'
62
+
63
+ export default definePlugin((nitroApp) => {
62
64
  nitroApp.hooks.hook('render:html', (html, { event }) => {
63
65
  console.log('render:html', html)
64
66
  html.bodyAppend.push('<hr>Appended by custom plugin')
@@ -200,7 +200,7 @@ You can read more about Nitro plugins in the [Nitro documentation](https://nitro
200
200
  ::
201
201
 
202
202
  ::warning
203
- It is necessary to explicitly import `defineNitroPlugin` from `nitro/runtime` within your plugin file. The same requirement applies to utilities such as `useRuntimeConfig`.
203
+ It is necessary to explicitly import `definePlugin` from `` within your plugin file. The same requirement applies to utilities such as `useRuntimeConfig`.
204
204
  ::
205
205
 
206
206
  ### Usage
@@ -244,9 +244,9 @@ export default defineNuxtModule({
244
244
  ```
245
245
 
246
246
  ```ts [runtime/plugin.ts]
247
- import { defineNitroPlugin } from 'nitro/runtime'
247
+ import { definePlugin } from 'nitro'
248
248
 
249
- export default defineNitroPlugin((nitroApp) => {
249
+ export default definePlugin((nitroApp) => {
250
250
  nitroApp.hooks.hook('request', (event) => {
251
251
  console.log('on request', event.req.url)
252
252
  })
@@ -1495,7 +1495,7 @@ Modules to generate deep aliases for within `compilerOptions.paths`. This does n
1495
1495
  ```json
1496
1496
  [
1497
1497
  "nitro/types",
1498
- "nitro/runtime",
1498
+ "nitro/runtime-config",
1499
1499
  "nitro",
1500
1500
  "defu",
1501
1501
  "h3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "5.0.0-29560209.2c61a3c1",
3
+ "version": "5.0.0-29560959.2cd7cfc5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",