@nuxt/docs-nightly 4.5.1-29752449.30d24817 → 4.5.2-2610052030-052d82e

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.
Files changed (214) hide show
  1. package/1.getting-started/01.introduction.md +8 -8
  2. package/1.getting-started/02.installation.md +2 -4
  3. package/1.getting-started/03.configuration.md +16 -16
  4. package/1.getting-started/04.views.md +8 -8
  5. package/1.getting-started/05.assets.md +10 -10
  6. package/1.getting-started/06.styling.md +10 -10
  7. package/1.getting-started/07.routing.md +15 -15
  8. package/1.getting-started/08.seo-meta.md +15 -15
  9. package/1.getting-started/09.transitions.md +10 -10
  10. package/1.getting-started/10.data-fetching.md +61 -47
  11. package/1.getting-started/11.state-management.md +11 -11
  12. package/1.getting-started/12.error-handling.md +20 -18
  13. package/1.getting-started/13.server.md +7 -7
  14. package/1.getting-started/14.layers.md +6 -6
  15. package/1.getting-started/15.prerendering.md +22 -28
  16. package/1.getting-started/16.deployment.md +22 -6
  17. package/1.getting-started/17.testing.md +200 -21
  18. package/1.getting-started/18.upgrade.md +78 -278
  19. package/2.directory-structure/0.nuxt.md +2 -2
  20. package/2.directory-structure/0.output.md +3 -3
  21. package/2.directory-structure/1.app/1.assets.md +3 -3
  22. package/2.directory-structure/1.app/1.components.md +26 -109
  23. package/2.directory-structure/1.app/1.composables.md +5 -5
  24. package/2.directory-structure/1.app/1.layouts.md +10 -10
  25. package/2.directory-structure/1.app/1.middleware.md +14 -10
  26. package/2.directory-structure/1.app/1.pages.md +25 -20
  27. package/2.directory-structure/1.app/1.plugins.md +7 -7
  28. package/2.directory-structure/1.app/1.utils.md +9 -5
  29. package/2.directory-structure/1.app/3.app-config.md +7 -7
  30. package/2.directory-structure/1.app/3.app.md +6 -6
  31. package/2.directory-structure/1.app/3.error.md +1 -1
  32. package/2.directory-structure/1.content.md +1 -1
  33. package/2.directory-structure/1.layers.md +13 -13
  34. package/2.directory-structure/1.modules.md +3 -3
  35. package/2.directory-structure/1.node_modules.md +1 -1
  36. package/2.directory-structure/1.server.md +33 -14
  37. package/2.directory-structure/1.shared.md +7 -5
  38. package/2.directory-structure/1.test.md +25 -0
  39. package/2.directory-structure/2.env.md +7 -7
  40. package/2.directory-structure/2.nuxtignore.md +3 -3
  41. package/2.directory-structure/2.nuxtrc.md +3 -3
  42. package/2.directory-structure/3.nuxt-config.md +2 -2
  43. package/2.directory-structure/3.tsconfig.md +21 -11
  44. package/2.directory-structure/index.md +29 -25
  45. package/3.guide/0.index.md +6 -6
  46. package/3.guide/1.concepts/1.rendering.md +76 -12
  47. package/3.guide/1.concepts/10.vuejs-development.md +73 -8
  48. package/3.guide/1.concepts/2.nuxt-lifecycle.md +18 -18
  49. package/3.guide/1.concepts/3.auto-imports.md +11 -11
  50. package/3.guide/1.concepts/4.server-engine.md +6 -6
  51. package/3.guide/1.concepts/5.modules.md +4 -4
  52. package/3.guide/1.concepts/6.server-components.md +198 -0
  53. package/3.guide/1.concepts/7.esm.md +5 -5
  54. package/3.guide/1.concepts/8.typescript.md +9 -9
  55. package/3.guide/2.best-practices/accessibility.md +155 -0
  56. package/3.guide/2.best-practices/hydration.md +5 -5
  57. package/3.guide/2.best-practices/performance.md +13 -9
  58. package/3.guide/3.ai/1.mcp.md +104 -19
  59. package/3.guide/4.modules/2.module-anatomy.md +5 -5
  60. package/3.guide/4.modules/3.recipes-basics.md +8 -8
  61. package/3.guide/4.modules/4.module-dependencies.md +1 -1
  62. package/3.guide/4.modules/5.recipes-advanced.md +6 -8
  63. package/3.guide/4.modules/6.testing.md +2 -2
  64. package/3.guide/4.modules/7.best-practices.md +2 -2
  65. package/3.guide/4.modules/9.server-compatibility.md +215 -0
  66. package/3.guide/4.modules/index.md +9 -9
  67. package/3.guide/5.recipes/1.custom-routing.md +15 -11
  68. package/3.guide/5.recipes/2.vite-plugin.md +3 -3
  69. package/3.guide/5.recipes/3.custom-usefetch.md +5 -5
  70. package/3.guide/5.recipes/4.sessions-and-authentication.md +2 -2
  71. package/3.guide/5.recipes/5.mostly-static-sites.md +127 -0
  72. package/3.guide/6.going-further/1.events.md +1 -1
  73. package/3.guide/6.going-further/1.experimental-features.md +254 -22
  74. package/3.guide/6.going-further/1.features.md +42 -6
  75. package/3.guide/6.going-further/1.internals.md +10 -10
  76. package/3.guide/6.going-further/10.runtime-config.md +28 -6
  77. package/3.guide/6.going-further/11.nightly-release-channel.md +1 -1
  78. package/3.guide/6.going-further/2.hooks.md +6 -6
  79. package/3.guide/6.going-further/4.kit.md +4 -4
  80. package/3.guide/6.going-further/5.server-imports.md +221 -0
  81. package/3.guide/6.going-further/6.nuxt-app.md +7 -7
  82. package/3.guide/6.going-further/7.layers.md +13 -13
  83. package/3.guide/6.going-further/8.builders.md +38 -14
  84. package/4.api/1.components/1.nuxt-client-fallback.md +1 -1
  85. package/4.api/1.components/10.nuxt-picture.md +1 -1
  86. package/4.api/1.components/11.teleports.md +1 -1
  87. package/4.api/1.components/12.nuxt-route-announcer.md +5 -3
  88. package/4.api/1.components/14.nuxt-announcer.md +3 -3
  89. package/4.api/1.components/2.nuxt-page.md +5 -5
  90. package/4.api/1.components/3.nuxt-layout.md +8 -8
  91. package/4.api/1.components/4.nuxt-link.md +6 -4
  92. package/4.api/1.components/5.nuxt-loading-indicator.md +3 -3
  93. package/4.api/1.components/6.nuxt-error-boundary.md +1 -1
  94. package/4.api/1.components/8.nuxt-island.md +5 -5
  95. package/4.api/2.composables/create-use-async-data.md +51 -8
  96. package/4.api/2.composables/create-use-fetch.md +126 -9
  97. package/4.api/2.composables/use-announcer.md +3 -3
  98. package/4.api/2.composables/use-app-config.md +1 -1
  99. package/4.api/2.composables/use-async-data.md +19 -11
  100. package/4.api/2.composables/use-cookie.md +22 -6
  101. package/4.api/2.composables/use-error.md +1 -1
  102. package/4.api/2.composables/use-fetch.md +14 -10
  103. package/4.api/2.composables/use-head-safe.md +2 -2
  104. package/4.api/2.composables/use-head.md +2 -2
  105. package/4.api/2.composables/use-hydration.md +1 -1
  106. package/4.api/2.composables/use-layout.md +1 -1
  107. package/4.api/2.composables/use-lazy-async-data.md +8 -8
  108. package/4.api/2.composables/use-lazy-fetch.md +11 -11
  109. package/4.api/2.composables/use-loading-indicator.md +2 -2
  110. package/4.api/2.composables/use-nuxt-app.md +13 -13
  111. package/4.api/2.composables/use-nuxt-data.md +1 -1
  112. package/4.api/2.composables/use-preview-mode.md +3 -3
  113. package/4.api/2.composables/use-request-event.md +29 -3
  114. package/4.api/2.composables/use-request-fetch.md +2 -2
  115. package/4.api/2.composables/use-request-header.md +1 -1
  116. package/4.api/2.composables/use-request-headers.md +1 -1
  117. package/4.api/2.composables/use-request-url.md +1 -1
  118. package/4.api/2.composables/use-response-header.md +2 -2
  119. package/4.api/2.composables/use-route-announcer.md +4 -2
  120. package/4.api/2.composables/use-route.md +2 -2
  121. package/4.api/2.composables/use-router.md +5 -5
  122. package/4.api/2.composables/use-runtime-config.md +5 -5
  123. package/4.api/2.composables/use-runtime-hook.md +1 -1
  124. package/4.api/2.composables/use-seo-meta.md +3 -3
  125. package/4.api/2.composables/use-server-seo-meta.md +5 -5
  126. package/4.api/2.composables/use-state.md +4 -4
  127. package/4.api/3.utils/$fetch.md +5 -5
  128. package/4.api/3.utils/abort-navigation.md +1 -1
  129. package/4.api/3.utils/add-route-middleware.md +2 -2
  130. package/4.api/3.utils/call-once.md +3 -3
  131. package/4.api/3.utils/clear-error.md +2 -2
  132. package/4.api/3.utils/clear-nuxt-data.md +1 -1
  133. package/4.api/3.utils/clear-nuxt-state.md +2 -2
  134. package/4.api/3.utils/create-error.md +19 -1
  135. package/4.api/3.utils/define-nuxt-plugin.md +2 -2
  136. package/4.api/3.utils/define-nuxt-route-middleware.md +3 -3
  137. package/4.api/3.utils/define-page-meta.md +12 -12
  138. package/4.api/3.utils/define-route-rules.md +4 -4
  139. package/4.api/3.utils/define-use-async-data-addon.md +57 -0
  140. package/4.api/3.utils/define-use-fetch-addon.md +168 -0
  141. package/4.api/3.utils/navigate-to.md +6 -2
  142. package/4.api/3.utils/prefetch-components.md +1 -1
  143. package/4.api/3.utils/preload-route-components.md +2 -2
  144. package/4.api/3.utils/prerender-routes.md +3 -3
  145. package/4.api/3.utils/refresh-cookie.md +1 -1
  146. package/4.api/3.utils/refresh-nuxt-data.md +3 -3
  147. package/4.api/3.utils/reload-nuxt-app.md +1 -1
  148. package/4.api/3.utils/set-page-layout.md +1 -1
  149. package/4.api/3.utils/set-response-status.md +2 -2
  150. package/4.api/3.utils/show-error.md +3 -3
  151. package/4.api/3.utils/update-app-config.md +2 -2
  152. package/4.api/4.commands/README.md +9 -0
  153. package/4.api/5.kit/1.modules.md +3 -3
  154. package/4.api/5.kit/10.runtime-config.md +1 -1
  155. package/4.api/5.kit/10.templates.md +42 -0
  156. package/4.api/5.kit/12.nitro.md +59 -18
  157. package/4.api/5.kit/14.logging.md +56 -2
  158. package/4.api/5.kit/15.builder.md +1 -1
  159. package/4.api/5.kit/18.dependencies.md +90 -0
  160. package/4.api/5.kit/2.programmatic.md +78 -1
  161. package/4.api/5.kit/3.compatibility.md +2 -2
  162. package/4.api/5.kit/4.autoimports.md +13 -13
  163. package/4.api/5.kit/5.components.md +3 -3
  164. package/4.api/5.kit/6.context.md +2 -2
  165. package/4.api/5.kit/7.pages.md +35 -4
  166. package/4.api/5.kit/8.layout.md +1 -1
  167. package/4.api/6.advanced/1.hooks.md +6 -3
  168. package/4.api/6.nuxt-config.md +44 -21
  169. package/4.api/index.md +7 -7
  170. package/5.community/2.getting-help.md +1 -1
  171. package/5.community/3.reporting-bugs.md +1 -1
  172. package/5.community/4.contribution.md +14 -12
  173. package/5.community/5.framework-contribution.md +4 -4
  174. package/5.community/6.roadmap.md +6 -6
  175. package/6.bridge/1.overview.md +12 -12
  176. package/6.bridge/2.typescript.md +1 -1
  177. package/6.bridge/3.bridge-composition-api.md +6 -6
  178. package/6.bridge/4.plugins-and-middleware.md +4 -4
  179. package/6.bridge/5.nuxt3-compatible-api.md +9 -9
  180. package/6.bridge/6.meta.md +5 -5
  181. package/6.bridge/7.runtime-config.md +1 -1
  182. package/6.bridge/8.nitro.md +1 -1
  183. package/6.bridge/9.vite.md +1 -1
  184. package/7.migration/1.overview.md +2 -2
  185. package/7.migration/10.bundling.md +1 -1
  186. package/7.migration/11.server.md +3 -3
  187. package/7.migration/2.configuration.md +6 -6
  188. package/7.migration/20.module-authors.md +7 -7
  189. package/7.migration/3.auto-imports.md +3 -3
  190. package/7.migration/4.meta.md +4 -4
  191. package/7.migration/5.plugins-and-middleware.md +3 -3
  192. package/7.migration/6.pages-and-layouts.md +13 -13
  193. package/7.migration/7.component-options.md +15 -15
  194. package/7.migration/8.runtime-config.md +4 -4
  195. package/README.md +1 -1
  196. package/errors/e8007.md +28 -0
  197. package/package.json +2 -2
  198. package/4.api/4.commands/.navigation.yml +0 -3
  199. package/4.api/4.commands/add.md +0 -112
  200. package/4.api/4.commands/analyze.md +0 -42
  201. package/4.api/4.commands/build-module.md +0 -42
  202. package/4.api/4.commands/build.md +0 -48
  203. package/4.api/4.commands/cleanup.md +0 -38
  204. package/4.api/4.commands/dev.md +0 -61
  205. package/4.api/4.commands/devtools.md +0 -38
  206. package/4.api/4.commands/generate.md +0 -43
  207. package/4.api/4.commands/info.md +0 -33
  208. package/4.api/4.commands/init.md +0 -50
  209. package/4.api/4.commands/module.md +0 -84
  210. package/4.api/4.commands/prepare.md +0 -41
  211. package/4.api/4.commands/preview.md +0 -44
  212. package/4.api/4.commands/test.md +0 -40
  213. package/4.api/4.commands/typecheck.md +0 -44
  214. package/4.api/4.commands/upgrade.md +0 -37
@@ -13,9 +13,11 @@ links:
13
13
  This component is available in Nuxt v3.12+.
14
14
  ::
15
15
 
16
+ :read-more{title="Nuxt accessibility" to="/docs/guide/best-practices/accessibility#route-announcements"}
17
+
16
18
  ## Usage
17
19
 
18
- Add `<NuxtRouteAnnouncer/>` in your [`app.vue`](/docs/4.x/directory-structure/app/app) or [`app/layouts/`](/docs/4.x/directory-structure/app/layouts) to enhance accessibility by informing assistive technologies about page title changes. This ensures that navigational changes are announced to users relying on screen readers.
20
+ Add `<NuxtRouteAnnouncer/>` in your [`app.vue`](/docs/directory-structure/app/app) or [`app/layouts/`](/docs/directory-structure/app/layouts) to enhance accessibility by informing assistive technologies about page title changes. This ensures that navigational changes are announced to users relying on screen readers.
19
21
 
20
22
  ```vue [app/app.vue]
21
23
  <template>
@@ -51,9 +53,9 @@ To achieve full customization, you can implement your own one based on [its sour
51
53
  ::
52
54
 
53
55
  ::callout
54
- You can hook into the underlying announcer instance using [the `useRouteAnnouncer` composable](/docs/4.x/api/composables/use-route-announcer), which allows you to set a custom announcement message.
56
+ You can hook into the underlying announcer instance using [the `useRouteAnnouncer` composable](/docs/api/composables/use-route-announcer), which allows you to set a custom announcement message.
55
57
  ::
56
58
 
57
59
  ::callout
58
- For announcing in-page content changes (form validation, toast notifications, loading states, etc.), use the [`<NuxtAnnouncer>`](/docs/4.x/api/components/nuxt-announcer) component with the [`useAnnouncer`](/docs/4.x/api/composables/use-announcer) composable instead.
60
+ For announcing in-page content changes (form validation, toast notifications, loading states, etc.), use the [`<NuxtAnnouncer>`](/docs/api/components/nuxt-announcer) component with the [`useAnnouncer`](/docs/api/composables/use-announcer) composable instead.
59
61
  ::
@@ -15,7 +15,7 @@ This component is available in Nuxt v4.4.2+.
15
15
 
16
16
  ## Usage
17
17
 
18
- Add `<NuxtAnnouncer/>` in your [`app.vue`](/docs/4.x/directory-structure/app/app) or [`app/layouts/`](/docs/4.x/directory-structure/app/layouts) to enable announcing dynamic content changes to screen readers. This is useful for form validation, toast notifications, loading states, and other in-page updates.
18
+ Add `<NuxtAnnouncer/>` in your [`app.vue`](/docs/directory-structure/app/app) or [`app/layouts/`](/docs/directory-structure/app/layouts) to enable announcing dynamic content changes to screen readers. This is useful for form validation, toast notifications, loading states, and other in-page updates.
19
19
 
20
20
  ```vue [app/app.vue]
21
21
  <template>
@@ -27,7 +27,7 @@ Add `<NuxtAnnouncer/>` in your [`app.vue`](/docs/4.x/directory-structure/app/app
27
27
  </template>
28
28
  ```
29
29
 
30
- Then use the [`useAnnouncer`](/docs/4.x/api/composables/use-announcer) composable anywhere in your app to announce messages:
30
+ Then use the [`useAnnouncer`](/docs/api/composables/use-announcer) composable anywhere in your app to announce messages:
31
31
 
32
32
  ```vue [app/pages/contact.vue]
33
33
  <script setup lang="ts">
@@ -78,5 +78,5 @@ To achieve full customization, you can implement your own one based on [its sour
78
78
  ::
79
79
 
80
80
  ::callout
81
- You can hook into the underlying announcer instance using [the `useAnnouncer` composable](/docs/4.x/api/composables/use-announcer), which allows you to set custom announcement messages.
81
+ You can hook into the underlying announcer instance using [the `useAnnouncer` composable](/docs/api/composables/use-announcer), which allows you to set custom announcement messages.
82
82
  ::
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- `<NuxtPage>` is a built-in component that comes with Nuxt. It lets you display top-level or nested pages located in the [`app/pages/`](/docs/4.x/directory-structure/app/pages) directory.
11
+ `<NuxtPage>` is a built-in component that comes with Nuxt. It lets you display top-level or nested pages located in the [`app/pages/`](/docs/directory-structure/app/pages) directory.
12
12
 
13
13
  ::note
14
14
  `<NuxtPage>` is a wrapper around [`<RouterView>`](https://router.vuejs.org/api/interfaces/routerviewprops) from Vue Router. It should be used instead of `<RouterView>` because the former takes additional care of internal states. Otherwise, `useRoute()` may return incorrect paths.
@@ -44,7 +44,7 @@ In a typical Vue application, a new page component is mounted **only after** the
44
44
 
45
45
  ## Props
46
46
 
47
- - `name`: tells `<RouterView>` to render the component with the corresponding name in the matched route record's components option. See [Named Views](/docs/4.x/directory-structure/app/pages#named-views) for the `name@view.vue` filename convention.
47
+ - `name`: tells `<RouterView>` to render the component with the corresponding name in the matched route record's components option. See [Named Views](/docs/directory-structure/app/pages#named-views) for the `name@view.vue` filename convention.
48
48
  - type: `string`
49
49
  - `route`: route location that has all of its components resolved.
50
50
  - type: `RouteLocationNormalized`
@@ -79,7 +79,7 @@ You can also use a dynamic key based on the current route:
79
79
  Don't use `$route` object here as it can cause problems with how `<NuxtPage>` renders pages with `<Suspense>`.
80
80
  ::
81
81
 
82
- Alternatively, `pageKey` can be passed as a `key` value via [`definePageMeta`](/docs/4.x/api/utils/define-page-meta) from the `<script>` section of your Vue component in the `/pages` directory.
82
+ Alternatively, `pageKey` can be passed as a `key` value via [`definePageMeta`](/docs/api/utils/define-page-meta) from the `<script>` section of your Vue component in the `/pages` directory.
83
83
 
84
84
  ```vue [app/pages/my-page.vue]
85
85
  <script setup lang="ts">
@@ -89,7 +89,7 @@ definePageMeta({
89
89
  </script>
90
90
  ```
91
91
 
92
- :link-example{to="/docs/4.x/examples/routing/pages"}
92
+ :link-example{to="/docs/examples/routing/pages"}
93
93
 
94
94
  ## Page's Ref
95
95
 
@@ -151,4 +151,4 @@ console.log(attrs.foobar) // Outputs: 123
151
151
  </script>
152
152
  ```
153
153
 
154
- :read-more{to="/docs/4.x/directory-structure/app/pages"}
154
+ :read-more{to="/docs/directory-structure/app/pages"}
@@ -18,11 +18,11 @@ You can use `<NuxtLayout />` component to activate the `default` layout on `app.
18
18
  </template>
19
19
  ```
20
20
 
21
- :read-more{to="/docs/4.x/directory-structure/app/layouts"}
21
+ :read-more{to="/docs/directory-structure/app/layouts"}
22
22
 
23
23
  ## Props
24
24
 
25
- - `name`: Specify a layout name to be rendered, can be a string, reactive reference or a computed property. It **must** match the name of the corresponding layout file in the [`app/layouts/`](/docs/4.x/directory-structure/app/layouts) directory, or `false` to disable the layout.
25
+ - `name`: Specify a layout name to be rendered, can be a string, reactive reference or a computed property. It **must** match the name of the corresponding layout file in the [`app/layouts/`](/docs/directory-structure/app/layouts) directory, or `false` to disable the layout.
26
26
  - **type**: `string | false`
27
27
  - **default**: `default`
28
28
 
@@ -51,11 +51,11 @@ Please note the layout name is normalized to kebab-case, so if your layout file
51
51
  </template>
52
52
  ```
53
53
 
54
- ::read-more{to="/docs/4.x/directory-structure/app/layouts"}
54
+ ::read-more{to="/docs/directory-structure/app/layouts"}
55
55
  Read more about dynamic layouts.
56
56
  ::
57
57
 
58
- - `fallback`: If an invalid layout is passed to the `name` prop, no layout will be rendered. Specify a `fallback` layout to be rendered in this scenario. It **must** match the name of the corresponding layout file in the [`app/layouts/`](/docs/4.x/directory-structure/app/layouts) directory.
58
+ - `fallback`: If an invalid layout is passed to the `name` prop, no layout will be rendered. Specify a `fallback` layout to be rendered in this scenario. It **must** match the name of the corresponding layout file in the [`app/layouts/`](/docs/directory-structure/app/layouts) directory.
59
59
  - **type**: `string`
60
60
  - **default**: `null`
61
61
 
@@ -88,7 +88,7 @@ console.log(layoutCustomProps.title) // I am a custom layout
88
88
 
89
89
  ## Layout Props from Page Meta
90
90
 
91
- When using [`definePageMeta`](/docs/4.x/api/utils/define-page-meta) with the object syntax for `layout`, props are automatically passed to the layout component. The layout can receive them with `defineProps`:
91
+ When using [`definePageMeta`](/docs/api/utils/define-page-meta) with the object syntax for `layout`, props are automatically passed to the layout component. The layout can receive them with `defineProps`:
92
92
 
93
93
  ```vue [app/pages/dashboard.vue]
94
94
  <script setup lang="ts">
@@ -111,7 +111,7 @@ const props = defineProps<{
111
111
  </script>
112
112
  ```
113
113
 
114
- ::read-more{to="/docs/4.x/directory-structure/app/layouts#passing-props-to-layouts"}
114
+ ::read-more{to="/docs/directory-structure/app/layouts#passing-props-to-layouts"}
115
115
  Read more about passing props to layouts.
116
116
  ::
117
117
 
@@ -145,7 +145,7 @@ Read more about passing props to layouts.
145
145
 
146
146
  ::
147
147
 
148
- :read-more{to="/docs/4.x/getting-started/transitions"}
148
+ :read-more{to="/docs/getting-started/transitions"}
149
149
 
150
150
  ## Layout's Ref
151
151
 
@@ -187,4 +187,4 @@ defineExpose({
187
187
 
188
188
  ::
189
189
 
190
- :read-more{to="/docs/4.x/directory-structure/app/layouts"}
190
+ :read-more{to="/docs/directory-structure/app/layouts"}
@@ -12,6 +12,8 @@ links:
12
12
  `<NuxtLink>` is a drop-in replacement for both Vue Router's `<RouterLink>` component and HTML's `<a>` tag. It intelligently determines whether the link is _internal_ or _external_ and renders it accordingly with available optimizations (prefetching, default attributes, etc.)
13
13
  ::
14
14
 
15
+ :read-more{title="Nuxt accessibility" to="/docs/guide/best-practices/accessibility#links"}
16
+
15
17
  ## Internal Routing
16
18
 
17
19
  In this example, we use `<NuxtLink>` component to link to another page of the application.
@@ -281,7 +283,7 @@ When not using `external`, `<NuxtLink>` supports all Vue Router's [`RouterLink`
281
283
  - `href`: An alias for `to`. If used with `to`, `href` will be ignored
282
284
  - `noRel`: If set to `true`, no `rel` attribute will be added to the external link
283
285
  - `external`: Forces the link to be rendered as an `<a>` tag instead of a Vue Router `RouterLink`.
284
- - `prefetch`: When enabled will prefetch middleware, layouts and payloads (when using [payloadExtraction](/docs/4.x/guide/going-further/experimental-features#payloadextraction)) of links in the viewport. Used by the experimental [crossOriginPrefetch](/docs/4.x/guide/going-further/experimental-features#crossoriginprefetch) config.
286
+ - `prefetch`: When enabled will prefetch middleware, layouts and payloads (when using [payloadExtraction](/docs/guide/going-further/experimental-features#payloadextraction)) of links in the viewport. Used by the experimental [crossOriginPrefetch](/docs/guide/going-further/experimental-features#crossoriginprefetch) config.
285
287
  - `prefetchOn`: Allows custom control of when to prefetch links. Possible options are `interaction` and `visibility` (default). You can also pass an object for full control, for example: `{ interaction: true, visibility: true }`. This prop is only used when `prefetch` is enabled (default) and `noPrefetch` is not set.
286
288
  - `noPrefetch`: Disables prefetching.
287
289
  - `prefetchedClass`: A class to apply to links that have been prefetched.
@@ -296,14 +298,14 @@ With the `custom` prop, `prefetch`, `prefetchOn` and `prefetchedClass` do not at
296
298
  - `rel`: A `rel` attribute value to apply on the link. Defaults to `"noopener noreferrer"` for external links.
297
299
 
298
300
  ::tip
299
- Defaults can be overwritten, see [overwriting defaults](/docs/4.x/api/components/nuxt-link#overwriting-defaults) if you want to change them.
301
+ Defaults can be overwritten, see [overwriting defaults](/docs/api/components/nuxt-link#overwriting-defaults) if you want to change them.
300
302
  ::
301
303
 
302
304
  ## Overwriting Defaults
303
305
 
304
306
  ### In Nuxt Config
305
307
 
306
- You can overwrite some `<NuxtLink>` defaults in your [`nuxt.config`](/docs/4.x/guide/going-further/experimental-features#defaults)
308
+ You can overwrite some `<NuxtLink>` defaults in your [`nuxt.config`](/docs/guide/going-further/experimental-features#defaults)
307
309
 
308
310
  ::important
309
311
  These options will likely be moved elsewhere in the future, such as into `app.config` or into the `app/` directory.
@@ -370,4 +372,4 @@ function defineNuxtLink (options: NuxtLinkOptions): Component {}
370
372
  - `prefetchOn`: Granular control of which prefetch strategies to apply by default.
371
373
  - `prefetchedClass`: A default class to apply to links that have been prefetched.
372
374
 
373
- :link-example{to="/docs/4.x/examples/routing/pages"}
375
+ :link-example{to="/docs/examples/routing/pages"}
@@ -11,7 +11,7 @@ links:
11
11
 
12
12
  ## Usage
13
13
 
14
- Add `<NuxtLoadingIndicator/>` in your [`app.vue`](/docs/4.x/directory-structure/app/app) or [`app/layouts/`](/docs/4.x/directory-structure/app/layouts).
14
+ Add `<NuxtLoadingIndicator/>` in your [`app.vue`](/docs/directory-structure/app/app) or [`app/layouts/`](/docs/directory-structure/app/layouts).
15
15
 
16
16
  ```vue [app/app.vue]
17
17
  <template>
@@ -22,7 +22,7 @@ Add `<NuxtLoadingIndicator/>` in your [`app.vue`](/docs/4.x/directory-structure/
22
22
  </template>
23
23
  ```
24
24
 
25
- :link-example{to="/docs/4.x/examples/routing/pages"}
25
+ :link-example{to="/docs/examples/routing/pages"}
26
26
 
27
27
  ## Slots
28
28
 
@@ -43,7 +43,7 @@ To achieve full customization, you can implement your own one based on [its sour
43
43
  ::
44
44
 
45
45
  ::note
46
- You can hook into the underlying indicator instance using [the `useLoadingIndicator` composable](/docs/4.x/api/composables/use-loading-indicator), which will allow you to trigger start/finish events yourself.
46
+ You can hook into the underlying indicator instance using [the `useLoadingIndicator` composable](/docs/api/composables/use-loading-indicator), which will allow you to trigger start/finish events yourself.
47
47
  ::
48
48
 
49
49
  ::tip
@@ -43,7 +43,7 @@ The `<NuxtErrorBoundary>` uses Vue's [`onErrorCaptured`](https://vuejs.org/api/c
43
43
  </template>
44
44
  ```
45
45
 
46
- :read-more{to="/docs/4.x/getting-started/error-handling"}
46
+ :read-more{to="/docs/getting-started/error-handling"}
47
47
 
48
48
  ## Example
49
49
 
@@ -12,14 +12,14 @@ When rendering an island component, the content of the island component is stati
12
12
 
13
13
  Changing the island component props triggers a refetch of the island component to re-render it again.
14
14
 
15
- ::note
16
- Global styles of your application are sent with the response.
17
- ::
18
-
19
15
  ::tip
20
16
  Server only components use `<NuxtIsland>` under the hood
21
17
  ::
22
18
 
19
+ ::read-more{to="/docs/guide/concepts/server-components"}
20
+ Read the dedicated guide to server components and islands.
21
+ ::
22
+
23
23
  ## Props
24
24
 
25
25
  - `name` : Name of the component to render.
@@ -75,7 +75,7 @@ export default defineNuxtPlugin((nuxtApp) => {
75
75
 
76
76
  - **Identical islands still share the same ids.** Two instances of the same island rendered with the same name, props and context share a single server render (and payload entry), so their HTML — including any `useId`-generated ids — is identical, and the island context id used as prefix is the same. This results in duplicated `id` attributes in the DOM, which can break `aria-*` references and `<label for>` associations between the two instances. There is currently no workaround for this case.
77
77
 
78
- - **`useId` does not work in interactive components inside islands.** A component loaded with the [`nuxt-client` attribute](/docs/4.x/directory-structure/app/components#client-components-within-server-components) is server-rendered inside the island's app but hydrated by the main client app, so `useId` returns different values on the server and on the client, causing a hydration mismatch.
78
+ - **`useId` does not work in interactive components inside islands.** A component loaded with the [`nuxt-client` attribute](/docs/guide/concepts/server-components#selective-hydration-with-nuxt-client) is server-rendered inside the island's app but hydrated by the main client app, so `useId` returns different values on the server and on the client, causing a hydration mismatch.
79
79
 
80
80
  ## Slots
81
81
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: 'createUseAsyncData'
3
3
  description: A factory function to create a custom useAsyncData composable with pre-defined default options.
4
- minimalVersion: "4.2"
4
+ minimalVersion: "4.4"
5
5
  links:
6
6
  - label: Source
7
7
  icon: i-simple-icons-github
@@ -9,7 +9,7 @@ links:
9
9
  size: xs
10
10
  ---
11
11
 
12
- `createUseAsyncData` creates a custom [`useAsyncData`](/docs/4.x/api/composables/use-async-data) composable with pre-defined options. The resulting composable is fully typed and works exactly like `useAsyncData`, but with your defaults baked in.
12
+ `createUseAsyncData` creates a custom [`useAsyncData`](/docs/api/composables/use-async-data) composable with pre-defined options. The resulting composable is fully typed and works exactly like `useAsyncData`, but with your defaults baked in.
13
13
 
14
14
  ::note
15
15
  `createUseAsyncData` is a compiler macro. It must be used as an **exported** declaration in the `composables/` directory (or any directory scanned by the Nuxt compiler). Nuxt automatically injects de-duplication keys at build time.
@@ -34,13 +34,13 @@ const { data: mountains } = await useCachedData(
34
34
  </script>
35
35
  ```
36
36
 
37
- The resulting composable has the same signature and return type as [`useAsyncData`](/docs/4.x/api/composables/use-async-data), with all options available for the caller to use or override.
37
+ The resulting composable has the same signature and return type as [`useAsyncData`](/docs/api/composables/use-async-data), with all options available for the caller to use or override.
38
38
 
39
39
  ## Type
40
40
 
41
41
  ```ts [Signature]
42
42
  function createUseAsyncData (
43
- options?: Partial<AsyncDataOptions>,
43
+ options?: Partial<AsyncDataOptions> & { addons?: UseAsyncDataAddon[] },
44
44
  ): typeof useAsyncData
45
45
 
46
46
  function createUseAsyncData (
@@ -48,11 +48,13 @@ function createUseAsyncData (
48
48
  ): typeof useAsyncData
49
49
  ```
50
50
 
51
+ The returned composable's signature includes any custom options and return-value extensions contributed by the [addons](#addons).
52
+
51
53
  ## Options
52
54
 
53
- `createUseAsyncData` accepts all the same options as [`useAsyncData`](/docs/4.x/api/composables/use-async-data#parameters), including `server`, `lazy`, `immediate`, `default`, `transform`, `pick`, `getCachedData`, `deep`, `dedupe`, `timeout`, and `watch`.
55
+ `createUseAsyncData` accepts all the same options as [`useAsyncData`](/docs/api/composables/use-async-data#parameters), including `server`, `lazy`, `immediate`, `default`, `transform`, `pick`, `getCachedData`, `deep`, `dedupe`, `timeout`, and `watch`.
54
56
 
55
- See the full list of options in the [`useAsyncData` documentation](/docs/4.x/api/composables/use-async-data#parameters).
57
+ See the full list of options in the [`useAsyncData` documentation](/docs/api/composables/use-async-data#parameters).
56
58
 
57
59
  ## Default vs Override Mode
58
60
 
@@ -86,6 +88,47 @@ export const useStrictData = createUseAsyncData(callerOptions => ({
86
88
  }))
87
89
  ```
88
90
 
89
- :read-more{to="/docs/4.x/guide/recipes/custom-usefetch"}
91
+ ## Addons
92
+
93
+ In addition to `useAsyncData` options, `createUseAsyncData` accepts an `addons` array. Addons are reusable units of behavior defined with [`defineUseAsyncDataAddon`](/docs/api/utils/define-use-async-data-addon). They can declare custom call-site options, run middleware around the handler, extend the returned object, and attach custom logic to the composable.
94
+
95
+ For example, an addon that refreshes the data whenever the window regains focus, gated behind a custom `refreshOnFocus` option, so callers opt in per call:
96
+
97
+ ```ts [app/composables/useCustomAsyncData.ts]
98
+ const refreshOnFocus = defineUseAsyncDataAddon({
99
+ // augment the call-site options for the custom useAsyncData instance 👇
100
+ setup: (options: UseAsyncDataAddonOptions<{ refreshOnFocus?: boolean }>) => {
101
+ // 👈 run code *before* creating the `useAsyncData` instance
102
+ if (import.meta.server || !options.refreshOnFocus) { return }
103
+
104
+ return (asyncData) => {
105
+ // 👈 run code *after* creating the `useAsyncData` instance
106
+ const focused = useWindowFocus()
107
+ watch(focused, (focused) => {
108
+ if (focused) { asyncData.refresh() }
109
+ })
110
+
111
+ return { focused } // 👈 extend the returned object with a new property
112
+ }
113
+ },
114
+ })
115
+
116
+ export const useCustomAsyncData = createUseAsyncData({ addons: [refreshOnFocus] })
117
+ ```
118
+
119
+ ```vue [app/pages/index.vue]
120
+ <script setup lang="ts">
121
+ // `refreshOnFocus` is typed on the created composable
122
+ const { data } = await useCustomAsyncData(
123
+ 'mountains',
124
+ () => $fetch('https://api.nuxtjs.dev/mountains'),
125
+ { refreshOnFocus: true },
126
+ )
127
+ </script>
128
+ ```
129
+
130
+ :read-more{to="/docs/api/utils/define-use-async-data-addon"}
131
+
132
+ :read-more{to="/docs/guide/recipes/custom-usefetch"}
90
133
 
91
- :read-more{to="/docs/4.x/api/composables/use-async-data"}
134
+ :read-more{to="/docs/api/composables/use-async-data"}
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: 'createUseFetch'
3
3
  description: A factory function to create a custom useFetch composable with pre-defined default options.
4
- minimalVersion: "4.2"
4
+ minimalVersion: "4.4"
5
5
  links:
6
6
  - label: Source
7
7
  icon: i-simple-icons-github
@@ -9,7 +9,7 @@ links:
9
9
  size: xs
10
10
  ---
11
11
 
12
- `createUseFetch` creates a custom [`useFetch`](/docs/4.x/api/composables/use-fetch) composable with pre-defined options. The resulting composable is fully typed and works exactly like `useFetch`, but with your defaults baked in.
12
+ `createUseFetch` creates a custom [`useFetch`](/docs/api/composables/use-fetch) composable with pre-defined options. The resulting composable is fully typed and works exactly like `useFetch`, but with your defaults baked in.
13
13
 
14
14
  ::note
15
15
  `createUseFetch` is a compiler macro. It must be used as an **exported** declaration in the `composables/` directory (or any directory scanned by the Nuxt compiler). Nuxt automatically injects de-duplication keys at build time.
@@ -29,25 +29,102 @@ const { data: modules } = await useAPI('/modules')
29
29
  </script>
30
30
  ```
31
31
 
32
- The resulting `useAPI` composable has the same signature and return type as [`useFetch`](/docs/4.x/api/composables/use-fetch), with all options available for the caller to use or override.
32
+ The resulting `useAPI` composable has the same signature and return type as [`useFetch`](/docs/api/composables/use-fetch), with all options available for the caller to use or override.
33
33
 
34
34
  ## Type
35
35
 
36
36
  ```ts [Signature]
37
37
  function createUseFetch (
38
- options?: Partial<UseFetchOptions>,
38
+ options?: Partial<UseFetchOptions> & { addons?: UseFetchAddon[] },
39
39
  ): typeof useFetch
40
40
 
41
41
  function createUseFetch (
42
42
  options: (callerOptions: UseFetchOptions) => Partial<UseFetchOptions>,
43
43
  ): typeof useFetch
44
+
45
+ function createUseFetch<Routes> (
46
+ options: Partial<UseFetchOptions> & { routes: Routes, addons?: UseFetchAddon[] },
47
+ ): DeclaredUseFetch<Routes>
44
48
  ```
45
49
 
50
+ The returned composable's signature includes any custom options and return-value extensions contributed by the [addons](#addons).
51
+
46
52
  ## Options
47
53
 
48
- `createUseFetch` accepts all the same options as [`useFetch`](/docs/4.x/api/composables/use-fetch#parameters), including `baseURL`, `headers`, `query`, `onRequest`, `onResponse`, `server`, `lazy`, `transform`, `getCachedData`, and more.
54
+ `createUseFetch` accepts all the same options as [`useFetch`](/docs/api/composables/use-fetch#parameters), including `baseURL`, `headers`, `query`, `onRequest`, `onResponse`, `server`, `lazy`, `transform`, `getCachedData`, and more.
55
+
56
+ See the full list of options in the [`useFetch` documentation](/docs/api/composables/use-fetch#parameters).
57
+
58
+ ## Typing a Third-Party API
59
+
60
+ From Nuxt 4.6, pass `routes` to describe the API a composable calls. Its responses, query parameters,
61
+ and request bodies are typed from that route set, including when `experimental.routeTypedFetch` is off:
62
+
63
+ ```ts [app/composables/usePetStore.ts]
64
+ import type { DynamicParam, Endpoint } from 'nuxt/app'
65
+
66
+ interface Pet { id: number, name: string }
67
+
68
+ interface PetStoreRoutes {
69
+ '/pets': {
70
+ [Endpoint]: {
71
+ GET: { response: Pet[], query: { limit?: number } }
72
+ POST: { response: Pet, body: { name: string } }
73
+ }
74
+ [DynamicParam]: {
75
+ [Endpoint]: { GET: { response: Pet } }
76
+ }
77
+ }
78
+ }
79
+
80
+ export const usePetStore = createUseFetch({
81
+ baseURL: 'https://api.example.com',
82
+ routes: {} as PetStoreRoutes,
83
+ })
84
+ ```
85
+
86
+ ```vue [app/pages/pets.vue]
87
+ <script setup lang="ts">
88
+ const { data: pets } = await usePetStore('/pets', { query: { limit: 10 } })
89
+ const { data: pet } = await usePetStore('/pets/42')
90
+ await usePetStore('/pets', { method: 'post', body: { name: 'Rex' } })
91
+ </script>
92
+ ```
93
+
94
+ `pets.value` is typed as `Pet[] | undefined`, and `pet.value` as `Pet | undefined`. The `POST`
95
+ request requires a body with a `name` string.
96
+
97
+ Only the type of `routes` is read, so pass `{} as Routes`; the value is dropped before the request is
98
+ made. The declared paths are matched **as written**. Do not prefix them with the `baseURL`.
99
+ A path built at runtime resolves to `unknown`.
100
+
101
+ Unmatched paths and methods are accepted by default and resolve to `unknown`. To reject them, enable
102
+ [`routeTypedFetch`](/docs/guide/going-further/experimental-features#routetypedfetch) and
103
+ [`strictRouteTypes`](/docs/guide/going-further/experimental-features#strictroutetypes):
104
+
105
+ ```ts [nuxt.config.ts]
106
+ export default defineNuxtConfig({
107
+ experimental: {
108
+ routeTypedFetch: true,
109
+ strictRouteTypes: true,
110
+ },
111
+ })
112
+ ```
113
+
114
+ With these options enabled, `usePetStore('/pats')` and
115
+ `usePetStore('/pets', { method: 'put' })` are type errors.
116
+
117
+ ::note
118
+ The routes a client declares are its own. They are not added to your app's route set, so plain
119
+ `$fetch` and `useFetch` are unaffected. This client types requests against its declared routes,
120
+ not your own server's routes.
121
+ ::
49
122
 
50
- See the full list of options in the [`useFetch` documentation](/docs/4.x/api/composables/use-fetch#parameters).
123
+ ::tip
124
+ The interface above is the shape [`fetchdts`](https://github.com/unjs/fetchdts) uses. A module can
125
+ generate one from an API description, such as an OpenAPI document, with `compileRoutes` from
126
+ `fetchdts/compiler`, and pass the emitted interface to `routes`.
127
+ ::
51
128
 
52
129
  ## Default vs Override Mode
53
130
 
@@ -95,9 +172,49 @@ export const useAPI = createUseFetch(callerOptions => ({
95
172
  ```
96
173
 
97
174
  ::important
98
- The **function signature** (override mode) is required here so that [`useNuxtApp()`](/docs/4.x/api/composables/use-nuxt-app) is called in the setup context (at the composable call site) rather than in the module scope, where no Nuxt instance is available.
175
+ The **function signature** (override mode) is required here so that [`useNuxtApp()`](/docs/api/composables/use-nuxt-app) is called in the setup context (at the composable call site) rather than in the module scope, where no Nuxt instance is available.
99
176
  ::
100
177
 
101
- :read-more{to="/docs/4.x/guide/recipes/custom-usefetch"}
178
+ ## Addons
179
+
180
+ In addition to `useFetch` options, `createUseFetch` accepts an `addons` array. Addons are reusable units of behavior defined with [`defineUseFetchAddon`](/docs/api/utils/define-use-fetch-addon). They can declare custom call-site options, run middleware around the handler, extend the returned object, and attach custom logic to the composable.
181
+
182
+ For example, an addon that refreshes the data whenever the window regains focus, gated behind a custom `refreshOnFocus` option, so callers opt in per call:
183
+
184
+ ```ts [app/composables/useCustomFetch.ts]
185
+ const refreshOnFocus = defineUseFetchAddon({
186
+ // augment the call-site options for the custom useFetch instance 👇
187
+ setup: (options: UseFetchAddonOptions<{ refreshOnFocus?: boolean }>) => {
188
+ // 👈 run code *before* calling `useAsyncData` in `useFetch`
189
+ if (import.meta.server || !options.refreshOnFocus) { return }
190
+
191
+ return (asyncData) => {
192
+ // 👈 run code *after* calling `useAsyncData` in `useFetch`
193
+ const focused = useWindowFocus()
194
+ watch(focused, (focused) => {
195
+ if (focused) { asyncData.refresh() }
196
+ })
197
+
198
+ return { focused } // 👈 extend the returned object with a new property
199
+ }
200
+ },
201
+ })
202
+
203
+ export const useCustomFetch = createUseFetch({ addons: [refreshOnFocus] })
204
+ ```
205
+
206
+ ```vue [app/pages/index.vue]
207
+ <script setup lang="ts">
208
+ // `refreshOnFocus` is typed on the created composable
209
+ const { data } = await useCustomFetch(
210
+ 'https://api.nuxtjs.dev/mountains',
211
+ { refreshOnFocus: true },
212
+ )
213
+ </script>
214
+ ```
215
+
216
+ :read-more{to="/docs/api/utils/define-use-fetch-addon"}
217
+
218
+ :read-more{to="/docs/guide/recipes/custom-usefetch"}
102
219
 
103
- :read-more{to="/docs/4.x/api/composables/use-fetch"}
220
+ :read-more{to="/docs/api/composables/use-fetch"}
@@ -15,7 +15,7 @@ This composable is available in Nuxt v4.4.2+.
15
15
 
16
16
  ## Description
17
17
 
18
- A composable for announcing dynamic content changes to screen readers. Unlike [`useRouteAnnouncer`](/docs/4.x/api/composables/use-route-announcer) which automatically announces route changes, `useAnnouncer` gives you manual control over what and when to announce.
18
+ A composable for announcing dynamic content changes to screen readers. Unlike [`useRouteAnnouncer`](/docs/api/composables/use-route-announcer) which automatically announces route changes, `useAnnouncer` gives you manual control over what and when to announce.
19
19
 
20
20
  Use this for in-page updates like form validation, async operations, toast notifications, and live content changes.
21
21
 
@@ -121,9 +121,9 @@ watch(results, (newResults) => {
121
121
  ```
122
122
 
123
123
  ::callout
124
- You need to add the [`<NuxtAnnouncer>`](/docs/4.x/api/components/nuxt-announcer) component to your app for the announcements to be rendered in the DOM.
124
+ You need to add the [`<NuxtAnnouncer>`](/docs/api/components/nuxt-announcer) component to your app for the announcements to be rendered in the DOM.
125
125
  ::
126
126
 
127
127
  ::callout
128
- For automatic announcements of route/page changes, use [`useRouteAnnouncer`](/docs/4.x/api/composables/use-route-announcer) with the [`<NuxtRouteAnnouncer>`](/docs/4.x/api/components/nuxt-route-announcer) component instead.
128
+ For automatic announcements of route/page changes, use [`useRouteAnnouncer`](/docs/api/composables/use-route-announcer) with the [`<NuxtRouteAnnouncer>`](/docs/api/components/nuxt-route-announcer) component instead.
129
129
  ::
@@ -16,4 +16,4 @@ const appConfig = useAppConfig()
16
16
  console.log(appConfig)
17
17
  ```
18
18
 
19
- :read-more{to="/docs/4.x/directory-structure/app/app-config"}
19
+ :read-more{to="/docs/directory-structure/app/app-config"}