@nuxt/docs 3.17.2 → 3.17.4

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.
@@ -48,7 +48,7 @@ disable SSR globally with the `ssr: false` option or leverage hybrid rendering b
48
48
 
49
49
  ### Server engine
50
50
 
51
- The Nuxt server engine [Nitro](https://nitro.unjs.io) unlocks new full-stack capabilities.
51
+ The Nuxt server engine [Nitro](https://nitro.build/) unlocks new full-stack capabilities.
52
52
 
53
53
  In development, it uses Rollup and Node.js workers for your server code and context isolation. It also generates your server API by reading files in `server/api/` and server middleware from `server/middleware/`.
54
54
 
@@ -21,7 +21,7 @@ Or follow the steps below to set up a new Nuxt project on your computer.
21
21
  <!-- markdownlint-disable-next-line MD001 -->
22
22
  #### Prerequisites
23
23
 
24
- - **Node.js** - [`18.x`](https://nodejs.org/en) or newer (but we recommend the [active LTS release](https://github.com/nodejs/release#release-schedule))
24
+ - **Node.js** - [`20.x`](https://nodejs.org/en) or newer (but we recommend the [active LTS release](https://github.com/nodejs/release#release-schedule))
25
25
  - **Text editor** - There is no IDE requirement, but we recommend [Visual Studio Code](https://code.visualstudio.com/) with the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (previously known as Volar) or [WebStorm](https://www.jetbrains.com/webstorm/), which, along with [other JetBrains IDEs](https://www.jetbrains.com/ides/), offers great Nuxt support right out-of-the-box.
26
26
  - **Terminal** - In order to run Nuxt commands
27
27
 
@@ -54,6 +54,10 @@ pnpm create nuxt <project-name>
54
54
  bun create nuxt <project-name>
55
55
  ```
56
56
 
57
+ ```bash [deno]
58
+ deno -A npm:create-nuxt@latest <project-name>
59
+ ```
60
+
57
61
  ::
58
62
 
59
63
  ::tip
@@ -96,6 +100,10 @@ bun run dev -o
96
100
  # To use the Bun runtime during development
97
101
  # bun --bun run dev -o
98
102
  ```
103
+
104
+ ```bash [deno]
105
+ deno run dev -o
106
+ ```
99
107
  ::
100
108
 
101
109
  ::tip{icon="i-lucide-circle-check"}
@@ -149,7 +149,7 @@ Nuxt uses [`nuxt.config.ts`](/docs/guide/directory-structure/nuxt-config) file a
149
149
 
150
150
  Name | Config File | How To Configure
151
151
  ---------------------------------------------|---------------------------|-------------------------
152
- [Nitro](https://nitro.unjs.io) | ~~`nitro.config.ts`~~ | Use [`nitro`](/docs/api/nuxt-config#nitro) key in `nuxt.config`
152
+ [Nitro](https://nitro.build) | ~~`nitro.config.ts`~~ | Use [`nitro`](/docs/api/nuxt-config#nitro) key in `nuxt.config`
153
153
  [PostCSS](https://postcss.org) | ~~`postcss.config.js`~~ | Use [`postcss`](/docs/api/nuxt-config#postcss) key in `nuxt.config`
154
154
  [Vite](https://vite.dev) | ~~`vite.config.ts`~~ | Use [`vite`](/docs/api/nuxt-config#vite) key in `nuxt.config`
155
155
  [webpack](https://webpack.js.org) | ~~`webpack.config.ts`~~ | Use [`webpack`](/docs/api/nuxt-config#webpack-1) key in `nuxt.config`
@@ -171,8 +171,8 @@ Name | Config File | How To
171
171
 
172
172
  If you need to pass options to `@vitejs/plugin-vue` or `@vitejs/plugin-vue-jsx`, you can do this in your `nuxt.config` file.
173
173
 
174
- - `vite.vue` for `@vitejs/plugin-vue`. Check available options [here](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue).
175
- - `vite.vueJsx` for `@vitejs/plugin-vue-jsx`. Check available options [here](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx).
174
+ - `vite.vue` for `@vitejs/plugin-vue`. Check [available options](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue).
175
+ - `vite.vueJsx` for `@vitejs/plugin-vue-jsx`. Check [available options](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx).
176
176
 
177
177
  ```ts twoslash [nuxt.config.ts]
178
178
  export default defineNuxtConfig({
@@ -145,7 +145,7 @@ useHead({
145
145
  })
146
146
  ```
147
147
 
148
- Nuxt uses `unhead` under the hood, and you can refer to its full documentation [here](https://unhead.unjs.io).
148
+ Nuxt uses `unhead` under the hood, and you can refer to [its full documentation](https://unhead.unjs.io).
149
149
 
150
150
  ### Modifying The Rendered Head With A Nitro Plugin
151
151
 
@@ -610,7 +610,7 @@ onMounted(() => console.log(document.cookie))
610
610
  </script>
611
611
  ```
612
612
 
613
- ## Options API support
613
+ ## Options API Support
614
614
 
615
615
  Nuxt provides a way to perform `asyncData` fetching within the Options API. You must wrap your component definition within `defineNuxtComponent` for this to work.
616
616
 
@@ -744,7 +744,7 @@ const { data } = await useFetch('/api/superjson', {
744
744
 
745
745
  ## Recipes
746
746
 
747
- ### Consuming SSE (Server Sent Events) via POST request
747
+ ### Consuming SSE (Server-Sent Events) via POST request
748
748
 
749
749
  ::tip
750
750
  If you're consuming SSE via GET request, you can use [`EventSource`](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) or VueUse composable [`useEventSource`](https://vueuse.org/core/useEventSource/).
@@ -79,7 +79,7 @@ export default defineNuxtConfig({
79
79
 
80
80
  Setting `nitro.prerender` to `true` is similar to `nitro.prerender.crawlLinks` to `true`.
81
81
 
82
- ::read-more{to="https://nitro.unjs.io/config#prerender"}
82
+ ::read-more{to="https://nitro.build/config#prerender"}
83
83
  Read more about pre-rendering in the Nitro documentation.
84
84
  ::
85
85
 
@@ -99,7 +99,7 @@ export default defineNuxtConfig({
99
99
  });
100
100
  ```
101
101
 
102
- ::read-more{to="https://nitro.unjs.io/config/#routerules"}
102
+ ::read-more{to="https://nitro.build/config/#routerules"}
103
103
  Read more about Nitro's `routeRules` configuration.
104
104
  ::
105
105
 
@@ -62,7 +62,7 @@ By default, the workload gets distributed to the workers with the round robin st
62
62
 
63
63
  ### Learn More
64
64
 
65
- :read-more{to="https://nitro.unjs.io/deploy/node" title="the Nitro documentation for node-server preset"}
65
+ :read-more{to="https://nitro.build/deploy/node" title="the Nitro documentation for node-server preset"}
66
66
 
67
67
  :video-accordion{title="Watch Daniel Roe's short video on the topic" videoId="0x1H6K5yOfs"}
68
68
 
@@ -111,7 +111,7 @@ export default defineNuxtConfig({
111
111
  NITRO_PRESET=node-server nuxt build
112
112
  ```
113
113
 
114
- 🔎 Check [the Nitro deployment](https://nitro.unjs.io/deploy) for all possible deployment presets and providers.
114
+ 🔎 Check [the Nitro deployment](https://nitro.build/deploy) for all possible deployment presets and providers.
115
115
 
116
116
  ## CDN Proxy
117
117
 
@@ -280,7 +280,7 @@ mockNuxtImport('useStorage', () => {
280
280
  ```
281
281
 
282
282
  ::note
283
- `mockNuxtImport` can only be used once per mocked import per test file. It is actually a macro that gets transformed to `vi.mock` and `vi.mock` is hoisted, as described [here](https://vitest.dev/api/vi.html#vi-mock).
283
+ `mockNuxtImport` can only be used once per mocked import per test file. It is actually a macro that gets transformed to `vi.mock` and `vi.mock` is hoisted, as described [in the Vitest docs](https://vitest.dev/api/vi.html#vi-mock).
284
284
  ::
285
285
 
286
286
  If you need to mock a Nuxt import and provide different implementations between tests, you can do it by creating and exposing your mocks using [`vi.hoisted`](https://vitest.dev/api/vi.html#vi-hoisted), and then use those mocks in `mockNuxtImport`. You then have access to the mocked imports, and can change the implementation between tests. Be careful to [restore mocks](https://vitest.dev/api/mock.html#mockrestore) before or after each test to undo mock state changes between runs.
@@ -35,9 +35,7 @@ bun x nuxi upgrade
35
35
  To use the latest Nuxt build and test features before their release, read about the [nightly release channel](/docs/guide/going-further/nightly-release-channel) guide.
36
36
 
37
37
  ::warning
38
- The nightly release channel `latest` tag is currently tracking the Nuxt v4 branch, meaning that it is particularly likely to have breaking changes right now - be careful!
39
-
40
- You can opt in to the 3.x branch nightly releases with `"nuxt": "npm:nuxt-nightly@3x"`.
38
+ The nightly release channel `latest` tag is currently tracking the Nuxt v4 branch, meaning that it is particularly likely to have breaking changes right now &mdash; be careful! You can opt in to the 3.x branch nightly releases with `"nuxt": "npm:nuxt-nightly@3x"`.
41
39
  ::
42
40
 
43
41
  ## Testing Nuxt 4
@@ -659,7 +657,7 @@ These aliases were removed, for greater clarity.
659
657
 
660
658
  The issue came up when adding `dedupe` as an option to `useAsyncData`, and we removed the boolean values as they ended up being _opposites_.
661
659
 
662
- `refresh({ dedupe: false })` meant 'do not _cancel_ existing requests in favour of this new one'. But passing `dedupe: true` within the options of `useAsyncData` means 'do not make any new requests if there is an existing pending request.' (See [PR](https://github.com/nuxt/nuxt/pull/24564#pullrequestreview-1764584361).)
660
+ `refresh({ dedupe: false })` meant **do not _cancel_ existing requests in favour of this new one**. But passing `dedupe: true` within the options of `useAsyncData` means **do not make any new requests if there is an existing pending request.** (See [PR](https://github.com/nuxt/nuxt/pull/24564#pullrequestreview-1764584361).)
663
661
 
664
662
  #### Migration Steps
665
663
 
@@ -152,7 +152,7 @@ Previously every route/page of a Nuxt application and server must use the same r
152
152
 
153
153
  Nuxt includes route rules and hybrid rendering support. Using route rules you can define rules for a group of nuxt routes, change rendering mode or assign a cache strategy based on route!
154
154
 
155
- Nuxt server will automatically register corresponding middleware and wrap routes with cache handlers using [Nitro caching layer](https://nitro.unjs.io/guide/cache).
155
+ Nuxt server will automatically register corresponding middleware and wrap routes with cache handlers using [Nitro caching layer](https://nitro.build/guide/cache).
156
156
 
157
157
  ```ts twoslash [nuxt.config.ts]
158
158
  export default defineNuxtConfig({
@@ -219,7 +219,7 @@ With ESR, the rendering process is pushed to the 'edge' of the network - the CDN
219
219
 
220
220
  When a request for a page is made, instead of going all the way to the original server, it's intercepted by the nearest edge server. This server generates the HTML for the page and sends it back to the user. This process minimizes the physical distance the data has to travel, **reducing latency and loading the page faster**.
221
221
 
222
- Edge-side rendering is possible thanks to [Nitro](https://nitro.unjs.io), the [server engine](/docs/guide/concepts/server-engine) that powers Nuxt. It offers cross-platform support for Node.js, Deno, Cloudflare Workers, and more.
222
+ Edge-side rendering is possible thanks to [Nitro](https://nitro.build/), the [server engine](/docs/guide/concepts/server-engine) that powers Nuxt. It offers cross-platform support for Node.js, Deno, Cloudflare Workers, and more.
223
223
 
224
224
  The current platforms where you can leverage ESR are:
225
225
  - [Cloudflare Pages](https://pages.cloudflare.com) with zero configuration using the git integration and the `nuxt build` command
@@ -3,7 +3,7 @@ title: Server Engine
3
3
  description: 'Nuxt is powered by a new server engine: Nitro.'
4
4
  ---
5
5
 
6
- While building Nuxt, we created a new server engine: [Nitro](https://nitro.unjs.io).
6
+ While building Nuxt, we created a new server engine: [Nitro](https://nitro.build/).
7
7
 
8
8
  It is shipped with many features:
9
9
 
@@ -109,12 +109,12 @@ export { utils } from './nested/utils.ts'
109
109
  export default defineNuxtConfig({
110
110
  imports: {
111
111
  dirs: [
112
- // Scan top-level modules
113
- 'composables',
114
- // ... or scan modules nested one level deep with a specific name and file extension
115
- 'composables/*/index.{ts,js,mjs,mts}',
116
- // ... or scan all modules within given directory
117
- 'composables/**'
112
+ // Scan top-level composables
113
+ '~/composables',
114
+ // ... or scan composables nested one level deep with a specific name and file extension
115
+ '~/composables/*/index.{ts,js,mjs,mts}',
116
+ // ... or scan all composables within given directory
117
+ '~/composables/**'
118
118
  ]
119
119
  }
120
120
  })
@@ -299,13 +299,13 @@ Of course, you are welcome to define metadata for your own use throughout your a
299
299
 
300
300
  #### `alias`
301
301
 
302
- You can define page aliases. They allow you to access the same page from different paths. It can be either a string or an array of strings as defined [here](https://router.vuejs.org/guide/essentials/redirect-and-alias.html#Alias) on vue-router documentation.
302
+ You can define page aliases. They allow you to access the same page from different paths. It can be either a string or an array of strings as defined [in the vue-router documentation](https://router.vuejs.org/guide/essentials/redirect-and-alias.html#Alias).
303
303
 
304
304
  #### `keepalive`
305
305
 
306
306
  Nuxt will automatically wrap your page in [the Vue `<KeepAlive>` component](https://vuejs.org/guide/built-ins/keep-alive.html#keepalive) if you set `keepalive: true` in your `definePageMeta`. This might be useful to do, for example, in a parent route that has dynamic child routes, if you want to preserve page state across route changes.
307
307
 
308
- When your goal is to preserve state for parent routes use this syntax: `<NuxtPage keepalive />`. You can also set props to be passed to `<KeepAlive>` (see a full list [here](https://vuejs.org/api/built-in-components.html#keepalive)).
308
+ When your goal is to preserve state for parent routes use this syntax: `<NuxtPage keepalive />`. You can also set props to be passed to `<KeepAlive>` (see [a full list](https://vuejs.org/api/built-in-components.html#keepalive)).
309
309
 
310
310
  You can set a default value for this property [in your `nuxt.config`](/docs/api/nuxt-config#keepalive).
311
311
 
@@ -319,7 +319,7 @@ You can define the layout used to render the route. This can be either false (to
319
319
 
320
320
  #### `layoutTransition` and `pageTransition`
321
321
 
322
- You can define transition properties for the `<transition>` component that wraps your pages and layouts, or pass `false` to disable the `<transition>` wrapper for that route. You can see a list of options that can be passed [here](https://vuejs.org/api/built-in-components.html#transition) or read [more about how transitions work](https://vuejs.org/guide/built-ins/transition.html#transition).
322
+ You can define transition properties for the `<transition>` component that wraps your pages and layouts, or pass `false` to disable the `<transition>` wrapper for that route. You can see [a list of options that can be passed](https://vuejs.org/api/built-in-components.html#transition) or read [more about how transitions work](https://vuejs.org/guide/built-ins/transition.html#transition).
323
323
 
324
324
  You can set default values for these properties [in your `nuxt.config`](/docs/api/nuxt-config#layouttransition).
325
325
 
@@ -97,7 +97,7 @@ export default defineNitroPlugin((nitroApp) => {
97
97
  })
98
98
  ```
99
99
 
100
- :read-more{to="https://nitro.unjs.io/guide/plugins" title="Nitro Plugins" target="_blank"}
100
+ :read-more{to="https://nitro.build/guide/plugins" title="Nitro Plugins" target="_blank"}
101
101
 
102
102
  ## Server Utilities
103
103
 
@@ -160,7 +160,7 @@ export default defineEventHandler((event) => {
160
160
  })
161
161
  ```
162
162
 
163
- ::tip{to="https://h3.unjs.io/examples/validate-data#validate-params"}
163
+ ::tip{to="https://h3.dev/examples/validate-data#validate-params"}
164
164
  Alternatively, use `getValidatedRouterParams` with a schema validator such as Zod for runtime and type safety.
165
165
  ::
166
166
 
@@ -389,7 +389,7 @@ export default eventHandler((event) => {
389
389
 
390
390
  ### Nitro Config
391
391
 
392
- You can use `nitro` key in `nuxt.config` to directly set [Nitro configuration](https://nitro.unjs.io/config).
392
+ You can use `nitro` key in `nuxt.config` to directly set [Nitro configuration](https://nitro.build/config).
393
393
 
394
394
  ::warning
395
395
  This is an advanced option. Custom config can affect production deployments, as the configuration interface might change over time when Nitro is upgraded in semver-minor versions of Nuxt.
@@ -397,7 +397,7 @@ This is an advanced option. Custom config can affect production deployments, as
397
397
 
398
398
  ```ts [nuxt.config.ts]
399
399
  export default defineNuxtConfig({
400
- // https://nitro.unjs.io/config
400
+ // https://nitro.build/config
401
401
  nitro: {}
402
402
  })
403
403
  ```
@@ -464,7 +464,7 @@ Never combine `next()` callback with a legacy middleware that is `async` or retu
464
464
 
465
465
  ### Server Storage
466
466
 
467
- Nitro provides a cross-platform [storage layer](https://nitro.unjs.io/guide/storage). In order to configure additional storage mount points, you can use `nitro.storage`, or [server plugins](#server-plugins).
467
+ Nitro provides a cross-platform [storage layer](https://nitro.build/guide/storage). In order to configure additional storage mount points, you can use `nitro.storage`, or [server plugins](#server-plugins).
468
468
 
469
469
  **Example of adding a Redis storage:**
470
470
 
@@ -506,7 +506,7 @@ export default defineEventHandler(async (event) => {
506
506
  })
507
507
  ```
508
508
 
509
- ::read-more{to="https://nitro.unjs.io/guide/storage" target="_blank"}
509
+ ::read-more{to="https://nitro.build/guide/storage" target="_blank"}
510
510
  Read more about Nitro Storage Layer.
511
511
  ::
512
512
 
@@ -16,9 +16,7 @@ Features that are only available on the nightly release channel are marked with
16
16
  ::
17
17
 
18
18
  ::warning
19
- The `latest` nightly release channel is currently tracking the Nuxt v4 branch, meaning that it is particularly likely to have breaking changes right now - be careful!
20
-
21
- You can opt in to the 3.x branch nightly releases with `"nuxt": "npm:nuxt-nightly@3x"`.
19
+ The `latest` nightly release channel is currently tracking the Nuxt v4 branch, meaning that it is particularly likely to have breaking changes right now &mdash; be careful! You can opt in to the 3.x branch nightly releases with `"nuxt": "npm:nuxt-nightly@3x"`.
22
20
  ::
23
21
 
24
22
  ## Opting In
@@ -24,7 +24,7 @@ yarn create nuxt -t module my-module
24
24
  ```
25
25
 
26
26
  ```bash [pnpm]
27
- pnpm create nuxt -- -t module my-module
27
+ pnpm create nuxt -t module my-module
28
28
  ```
29
29
 
30
30
  ```bash [bun]
@@ -108,5 +108,5 @@ async function addTodo () {
108
108
  ## Type
109
109
 
110
110
  ```ts
111
- useNuxtData<DataT = any> (key: string): { data: Ref<DataT | null> }
111
+ useNuxtData<DataT = any> (key: string): { data: Ref<DataT | undefined> }
112
112
  ```
@@ -11,9 +11,9 @@ links:
11
11
  `useRequestURL` is a helper function that returns an [URL object](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) working on both server-side and client-side.
12
12
 
13
13
  ::important
14
- When utilizing [Hybrid Rendering](/docs/guide/concepts/rendering#hybrid-rendering) with cache strategies, all incoming request headers are dropped when handling the cached responses via the [Nitro caching layer](https://nitro.unjs.io/guide/cache) (meaning `useRequestURL` will return `localhost` for the `host`).
14
+ When utilizing [Hybrid Rendering](/docs/guide/concepts/rendering#hybrid-rendering) with cache strategies, all incoming request headers are dropped when handling the cached responses via the [Nitro caching layer](https://nitro.build/guide/cache) (meaning `useRequestURL` will return `localhost` for the `host`).
15
15
 
16
- You can define the [`cache.varies` option](https://nitro.unjs.io/guide/cache#options) to specify headers that will be considered when caching and serving the responses, such as `host` and `x-forwarded-host` for multi-tenant environments.
16
+ You can define the [`cache.varies` option](https://nitro.build/guide/cache#options) to specify headers that will be considered when caching and serving the responses, such as `host` and `x-forwarded-host` for multi-tenant environments.
17
17
  ::
18
18
 
19
19
  ::code-group
@@ -17,7 +17,7 @@ Make sure to always use `await` or `return` on result of `navigateTo` when calli
17
17
  ::
18
18
 
19
19
  ::note
20
- `navigateTo` cannot be used within Nitro routes. To perform a server-side redirect in Nitro routes, use [`sendRedirect`](https://h3.unjs.io/utils/response#sendredirectevent-location-code) instead.
20
+ `navigateTo` cannot be used within Nitro routes. To perform a server-side redirect in Nitro routes, use [`sendRedirect`](https://h3.dev/utils/response#sendredirectevent-location-code) instead.
21
21
  ::
22
22
 
23
23
  ### Within a Vue Component
@@ -194,7 +194,7 @@ function useNitro (): Nitro
194
194
  Add plugin to extend Nitro's runtime behavior.
195
195
 
196
196
  ::tip
197
- You can read more about Nitro plugins in the [Nitro documentation](https://nitro.unjs.io/guide/plugins).
197
+ You can read more about Nitro plugins in the [Nitro documentation](https://nitro.build/guide/plugins).
198
198
  ::
199
199
 
200
200
  ### Usage
@@ -58,10 +58,10 @@ function extendPages(callback: (pages: NuxtPage[]) => void): void
58
58
 
59
59
  ## `extendRouteRules`
60
60
 
61
- Nuxt is powered by the [Nitro](https://nitro.unjs.io) server engine. With Nitro, you can incorporate high-level logic directly into your configuration, which is useful for actions like redirects, proxying, caching, and appending headers to routes. This configuration works by associating route patterns with specific route settings.
61
+ Nuxt is powered by the [Nitro](https://nitro.build/) server engine. With Nitro, you can incorporate high-level logic directly into your configuration, which is useful for actions like redirects, proxying, caching, and appending headers to routes. This configuration works by associating route patterns with specific route settings.
62
62
 
63
63
  ::tip
64
- You can read more about Nitro route rules in the [Nitro documentation](https://nitro.unjs.io/guide/routing#route-rules).
64
+ You can read more about Nitro route rules in the [Nitro documentation](https://nitro.build/guide/routing#route-rules).
65
65
  ::
66
66
 
67
67
  ::tip{icon="i-lucide-video" to="https://vueschool.io/lessons/adding-route-rules-and-route-middlewares?friend=nuxt" target="_blank"}
@@ -90,7 +90,7 @@ Hook | Arguments | Description
90
90
 
91
91
  ## Nitro App Hooks (runtime, server-side)
92
92
 
93
- See [Nitro](https://nitro.unjs.io/guide/plugins#available-hooks) for all available hooks.
93
+ See [Nitro](https://nitro.build/guide/plugins#available-hooks) for all available hooks.
94
94
 
95
95
  Hook | Arguments | Description | Types
96
96
  -----------------------|-----------------------|--------------------------------------|------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs",
3
- "version": "3.17.2",
3
+ "version": "3.17.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",