@nuxt/docs-nightly 4.0.0-29162105.8c587084 → 4.0.0-29165109.5b7cbcb6

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 (69) hide show
  1. package/1.getting-started/01.introduction.md +3 -3
  2. package/1.getting-started/03.configuration.md +1 -1
  3. package/1.getting-started/07.routing.md +1 -1
  4. package/1.getting-started/10.data-fetching.md +1 -1
  5. package/1.getting-started/11.state-management.md +1 -1
  6. package/1.getting-started/12.error-handling.md +1 -1
  7. package/1.getting-started/15.prerendering.md +7 -7
  8. package/1.getting-started/16.deployment.md +2 -2
  9. package/1.getting-started/18.upgrade.md +51 -9
  10. package/2.guide/1.concepts/3.rendering.md +3 -3
  11. package/2.guide/1.concepts/5.modules.md +1 -1
  12. package/2.guide/1.concepts/8.typescript.md +6 -6
  13. package/2.guide/1.concepts/9.code-style.md +1 -1
  14. package/2.guide/2.directory-structure/1.app/.navigation.yml +5 -0
  15. package/2.guide/2.directory-structure/{1.composables.md → 1.app/1.composables.md} +1 -1
  16. package/2.guide/2.directory-structure/{1.pages.md → 1.app/1.pages.md} +2 -2
  17. package/2.guide/2.directory-structure/1.content.md +1 -1
  18. package/2.guide/2.directory-structure/1.server.md +1 -1
  19. package/2.guide/2.directory-structure/2.env.md +4 -4
  20. package/2.guide/3.going-further/1.events.md +1 -1
  21. package/2.guide/3.going-further/1.experimental-features.md +1 -1
  22. package/2.guide/3.going-further/1.internals.md +2 -2
  23. package/2.guide/3.going-further/10.runtime-config.md +1 -1
  24. package/2.guide/3.going-further/11.nightly-release-channel.md +2 -6
  25. package/2.guide/3.going-further/3.modules.md +3 -3
  26. package/2.guide/3.going-further/9.debugging.md +1 -5
  27. package/2.guide/4.recipes/1.custom-routing.md +5 -5
  28. package/2.guide/4.recipes/4.sessions-and-authentication.md +2 -2
  29. package/3.api/1.components/10.nuxt-picture.md +1 -1
  30. package/3.api/1.components/9.nuxt-img.md +1 -1
  31. package/3.api/2.composables/use-async-data.md +1 -1
  32. package/3.api/2.composables/use-cookie.md +5 -4
  33. package/3.api/2.composables/use-fetch.md +1 -1
  34. package/3.api/2.composables/use-preview-mode.md +3 -3
  35. package/3.api/3.utils/define-page-meta.md +1 -1
  36. package/3.api/4.commands/add.md +20 -20
  37. package/3.api/4.commands/analyze.md +2 -2
  38. package/3.api/4.commands/build-module.md +2 -2
  39. package/3.api/4.commands/build.md +2 -2
  40. package/3.api/4.commands/cleanup.md +2 -2
  41. package/3.api/4.commands/dev.md +3 -3
  42. package/3.api/4.commands/devtools.md +3 -3
  43. package/3.api/4.commands/generate.md +3 -3
  44. package/3.api/4.commands/info.md +2 -2
  45. package/3.api/4.commands/init.md +3 -3
  46. package/3.api/4.commands/module.md +8 -8
  47. package/3.api/4.commands/prepare.md +2 -2
  48. package/3.api/4.commands/preview.md +3 -3
  49. package/3.api/4.commands/typecheck.md +2 -2
  50. package/3.api/4.commands/upgrade.md +2 -2
  51. package/3.api/5.kit/11.nitro.md +48 -1
  52. package/3.api/5.kit/4.autoimports.md +8 -8
  53. package/3.api/6.advanced/1.hooks.md +1 -1
  54. package/3.api/6.nuxt-config.md +2932 -3
  55. package/5.community/4.contribution.md +1 -1
  56. package/5.community/6.roadmap.md +17 -12
  57. package/5.community/7.changelog.md +1 -1
  58. package/7.migration/2.configuration.md +2 -2
  59. package/7.migration/7.component-options.md +1 -1
  60. package/package.json +1 -1
  61. /package/2.guide/2.directory-structure/{1.assets.md → 1.app/1.assets.md} +0 -0
  62. /package/2.guide/2.directory-structure/{1.components.md → 1.app/1.components.md} +0 -0
  63. /package/2.guide/2.directory-structure/{1.layouts.md → 1.app/1.layouts.md} +0 -0
  64. /package/2.guide/2.directory-structure/{1.middleware.md → 1.app/1.middleware.md} +0 -0
  65. /package/2.guide/2.directory-structure/{1.plugins.md → 1.app/1.plugins.md} +0 -0
  66. /package/2.guide/2.directory-structure/{1.utils.md → 1.app/1.utils.md} +0 -0
  67. /package/2.guide/2.directory-structure/{3.app-config.md → 1.app/3.app-config.md} +0 -0
  68. /package/2.guide/2.directory-structure/{3.app.md → 1.app/3.app.md} +0 -0
  69. /package/2.guide/2.directory-structure/{3.error.md → 1.app/3.error.md} +0 -0
@@ -98,7 +98,7 @@ The `handler` function should be **side-effect free** to ensure predictable beha
98
98
  Which only caches data when `experimental.payloadExtraction` of `nuxt.config` is enabled.
99
99
  - `pick`: only pick specified keys in this array from the `handler` function result
100
100
  - `watch`: watch reactive sources to auto-refresh
101
- - `deep`: return data in a deep ref object. It is `false` by default to return data in a shallow ref object for performance.
101
+ - `deep`: return data in a deep ref object. It is `false` by default to return data in a shallow ref object, which can improve performance if your data does not need to be deeply reactive.
102
102
  - `dedupe`: avoid fetching same key more than once at a time (defaults to `cancel`). Possible options:
103
103
  - `cancel` - cancels existing requests when a new one is made
104
104
  - `defer` - does not make new requests at all if there is a pending request
@@ -168,8 +168,9 @@ const user = useCookie(
168
168
  }
169
169
  )
170
170
 
171
- if (user.value && user.value !== null) {
172
- user.value.score++; // userInfo cookie not update with this change
171
+ if (user.value) {
172
+ // the actual `userInfo` cookie will not be updated
173
+ user.value.score++
173
174
  }
174
175
  </script>
175
176
 
@@ -196,9 +197,9 @@ function add() {
196
197
  }
197
198
 
198
199
  function save() {
199
- if (list.value && list.value !== null) {
200
+ if (list.value) {
201
+ // the actual `list` cookie will be updated
200
202
  list.value = [...list.value]
201
- // list cookie update with this change
202
203
  }
203
204
  }
204
205
  </script>
@@ -132,7 +132,7 @@ All fetch options can be given a `computed` or `ref` value. These will be watche
132
132
  Which only caches data when `experimental.payloadExtraction` of `nuxt.config` is enabled.
133
133
  - `pick`: only pick specified keys in this array from the `handler` function result
134
134
  - `watch`: watch an array of reactive sources and auto-refresh the fetch result when they change. Fetch options and URL are watched by default. You can completely ignore reactive sources by using `watch: false`. Together with `immediate: false`, this allows for a fully-manual `useFetch`. (You can [see an example here](/docs/getting-started/data-fetching#watch) of using `watch`.)
135
- - `deep`: return data in a deep ref object. It is `false` by default to return data in a shallow ref object for performance.
135
+ - `deep`: return data in a deep ref object. It is `false` by default to return data in a shallow ref object, which can improve performance if your data does not need to be deeply reactive.
136
136
  - `dedupe`: avoid fetching same key more than once at a time (defaults to `cancel`). Possible options:
137
137
  - `cancel` - cancels existing requests when a new one is made
138
138
  - `defer` - does not make new requests at all if there is a pending request
@@ -103,8 +103,8 @@ const { data } = await useFetch('/api/preview', {
103
103
  Now you can generate your site and serve it:
104
104
 
105
105
  ```bash [Terminal]
106
- npx nuxi generate
107
- npx nuxi preview
106
+ npx nuxt generate
107
+ npx nuxt preview
108
108
  ```
109
109
 
110
110
  Then you can see your preview page by adding the query param `preview` to the end of the page you want to see once:
@@ -114,5 +114,5 @@ Then you can see your preview page by adding the query param `preview` to the en
114
114
  ```
115
115
 
116
116
  ::note
117
- `usePreviewMode` should be tested locally with `nuxi generate` and then `nuxi preview` rather than `nuxi dev`. (The [preview command](/docs/api/commands/preview) is not related to preview mode.)
117
+ `usePreviewMode` should be tested locally with `nuxt generate` and then `nuxt preview` rather than `nuxt dev`. (The [preview command](/docs/api/commands/preview) is not related to preview mode.)
118
118
  ::
@@ -136,7 +136,7 @@ interface PageMeta {
136
136
 
137
137
  - **Type**: `boolean | (to: RouteLocationNormalized, from: RouteLocationNormalized) => boolean`
138
138
 
139
- Tell Nuxt to scroll to the top before rendering the page or not. If you want to overwrite the default scroll behavior of Nuxt, you can do so in `~/app/router.options.ts` (see [custom routing](/docs/guide/recipes/custom-routing#using-approuteroptions)) for more info.
139
+ Tell Nuxt to scroll to the top before rendering the page or not. If you want to overwrite the default scroll behavior of Nuxt, you can do so in `~/router.options.ts` (see [custom routing](/docs/guide/recipes/custom-routing#using-approuteroptions)) for more info.
140
140
 
141
141
  **`[key: string]`**
142
142
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi add"
2
+ title: "nuxt add"
3
3
  description: "Scaffold an entity into your Nuxt application."
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--add-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi add <TEMPLATE> <NAME> [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--force]
13
+ npx nuxt add <TEMPLATE> <NAME> [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--force]
14
14
  ```
15
15
  <!--/add-cmd-->
16
16
 
@@ -39,74 +39,74 @@ Some templates support additional modifier flags to add a suffix (like `.client`
39
39
 
40
40
  ```bash [Terminal]
41
41
  # Generates `/plugins/sockets.client.ts`
42
- npx nuxi add plugin sockets --client
42
+ npx nuxt add plugin sockets --client
43
43
  ```
44
44
 
45
- ## `nuxi add component`
45
+ ## `nuxt add component`
46
46
 
47
47
  * Modifier flags: `--mode client|server` or `--client` or `--server`
48
48
 
49
49
  ```bash [Terminal]
50
50
  # Generates `components/TheHeader.vue`
51
- npx nuxi add component TheHeader
51
+ npx nuxt add component TheHeader
52
52
  ```
53
53
 
54
- ## `nuxi add composable`
54
+ ## `nuxt add composable`
55
55
 
56
56
  ```bash [Terminal]
57
57
  # Generates `composables/foo.ts`
58
- npx nuxi add composable foo
58
+ npx nuxt add composable foo
59
59
  ```
60
60
 
61
- ## `nuxi add layout`
61
+ ## `nuxt add layout`
62
62
 
63
63
  ```bash [Terminal]
64
64
  # Generates `layouts/custom.vue`
65
- npx nuxi add layout custom
65
+ npx nuxt add layout custom
66
66
  ```
67
67
 
68
- ## `nuxi add plugin`
68
+ ## `nuxt add plugin`
69
69
 
70
70
  * Modifier flags: `--mode client|server` or `--client`or `--server`
71
71
 
72
72
  ```bash [Terminal]
73
73
  # Generates `plugins/analytics.ts`
74
- npx nuxi add plugin analytics
74
+ npx nuxt add plugin analytics
75
75
  ```
76
76
 
77
- ## `nuxi add page`
77
+ ## `nuxt add page`
78
78
 
79
79
  ```bash [Terminal]
80
80
  # Generates `pages/about.vue`
81
- npx nuxi add page about
81
+ npx nuxt add page about
82
82
  ```
83
83
 
84
84
  ```bash [Terminal]
85
85
  # Generates `pages/category/[id].vue`
86
- npx nuxi add page "category/[id]"
86
+ npx nuxt add page "category/[id]"
87
87
  ```
88
88
 
89
- ## `nuxi add middleware`
89
+ ## `nuxt add middleware`
90
90
 
91
91
  * Modifier flags: `--global`
92
92
 
93
93
  ```bash [Terminal]
94
94
  # Generates `middleware/auth.ts`
95
- npx nuxi add middleware auth
95
+ npx nuxt add middleware auth
96
96
  ```
97
97
 
98
- ## `nuxi add api`
98
+ ## `nuxt add api`
99
99
 
100
100
  * Modifier flags: `--method` (can accept `connect`, `delete`, `get`, `head`, `options`, `patch`, `post`, `put` or `trace`) or alternatively you can directly use `--get`, `--post`, etc.
101
101
 
102
102
  ```bash [Terminal]
103
103
  # Generates `server/api/hello.ts`
104
- npx nuxi add api hello
104
+ npx nuxt add api hello
105
105
  ```
106
106
 
107
- ## `nuxi add layer`
107
+ ## `nuxt add layer`
108
108
 
109
109
  ```bash [Terminal]
110
110
  # Generates `layers/subscribe/nuxt.config.ts`
111
- npx nuxi add layer subscribe
111
+ npx nuxt add layer subscribe
112
112
  ```
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi analyze"
2
+ title: "nuxt analyze"
3
3
  description: "Analyze the production bundle or your Nuxt application."
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--analyze-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi analyze [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [--name=<name>] [--no-serve]
13
+ npx nuxt analyze [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [--name=<name>] [--no-serve]
14
14
  ```
15
15
  <!--/analyze-cmd-->
16
16
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: 'nuxi build-module'
2
+ title: 'nuxt build-module'
3
3
  description: 'Nuxt command to build your Nuxt module before publishing.'
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--build-module-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi build-module [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--build] [--stub] [--sourcemap] [--prepare]
13
+ npx nuxt build-module [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--build] [--stub] [--sourcemap] [--prepare]
14
14
  ```
15
15
  <!--/build-module-cmd-->
16
16
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi build"
2
+ title: "nuxt build"
3
3
  description: "Build your Nuxt application."
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--build-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi build [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--prerender] [--preset] [--dotenv] [--envName]
13
+ npx nuxt build [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--prerender] [--preset] [--dotenv] [--envName]
14
14
  ```
15
15
  <!--/build-cmd-->
16
16
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: 'nuxi cleanup'
2
+ title: 'nuxt cleanup'
3
3
  description: 'Remove common generated Nuxt files and caches.'
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--cleanup-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi cleanup [ROOTDIR] [--cwd=<directory>]
13
+ npx nuxt cleanup [ROOTDIR] [--cwd=<directory>]
14
14
  ```
15
15
  <!--/cleanup-cmd-->
16
16
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: 'nuxi dev'
2
+ title: 'nuxt dev'
3
3
  description: The dev command starts a development server with hot module replacement at http://localhost:3000
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--dev-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi dev [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [--envName] [--no-clear] [--no-fork] [-p, --port] [-h, --host] [--clipboard] [-o, --open] [--https] [--publicURL] [--qr] [--public] [--tunnel] [--sslCert] [--sslKey]
13
+ npx nuxt dev [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [--envName] [--no-clear] [--no-fork] [-p, --port] [-h, --host] [--clipboard] [-o, --open] [--https] [--publicURL] [--qr] [--public] [--tunnel] [--sslCert] [--sslKey]
14
14
  ```
15
15
  <!--/dev-cmd-->
16
16
 
@@ -50,7 +50,7 @@ Option | Default | Description
50
50
 
51
51
  The port and host can also be set via NUXT_PORT, PORT, NUXT_HOST or HOST environment variables.
52
52
 
53
- Additionally to the above options, `nuxi` can pass options through to `listhen`, e.g. `--no-qr` to turn off the dev server QR code. You can find the list of `listhen` options in the [unjs/listhen](https://github.com/unjs/listhen) docs.
53
+ Additionally to the above options, `@nuxt/cli` can pass options through to `listhen`, e.g. `--no-qr` to turn off the dev server QR code. You can find the list of `listhen` options in the [unjs/listhen](https://github.com/unjs/listhen) docs.
54
54
 
55
55
  This command sets `process.env.NODE_ENV` to `development`.
56
56
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi devtools"
2
+ title: "nuxt devtools"
3
3
  description: The devtools command allows you to enable or disable Nuxt DevTools on a per-project basis.
4
4
  links:
5
5
  - label: Source
@@ -10,11 +10,11 @@ links:
10
10
 
11
11
  <!--devtools-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi devtools <COMMAND> [ROOTDIR] [--cwd=<directory>]
13
+ npx nuxt devtools <COMMAND> [ROOTDIR] [--cwd=<directory>]
14
14
  ```
15
15
  <!--/devtools-cmd-->
16
16
 
17
- Running `nuxi devtools enable` will install the Nuxt DevTools globally, and also enable it within the particular project you are using. It is saved as a preference in your user-level `.nuxtrc`. If you want to remove devtools support for a particular project, you can run `nuxi devtools disable`.
17
+ Running `nuxt devtools enable` will install the Nuxt DevTools globally, and also enable it within the particular project you are using. It is saved as a preference in your user-level `.nuxtrc`. If you want to remove devtools support for a particular project, you can run `nuxt devtools disable`.
18
18
 
19
19
  ## Arguments
20
20
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi generate"
2
+ title: "nuxt generate"
3
3
  description: Pre-renders every route of the application and stores the result in plain HTML files.
4
4
  links:
5
5
  - label: Source
@@ -10,11 +10,11 @@ links:
10
10
 
11
11
  <!--generate-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi generate [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--preset] [--dotenv] [--envName]
13
+ npx nuxt generate [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--preset] [--dotenv] [--envName]
14
14
  ```
15
15
  <!--/generate-cmd-->
16
16
 
17
- The `generate` command pre-renders every route of your application and stores the result in plain HTML files that you can deploy on any static hosting services. The command triggers the `nuxi build` command with the `prerender` argument set to `true`
17
+ The `generate` command pre-renders every route of your application and stores the result in plain HTML files that you can deploy on any static hosting services. The command triggers the `nuxt build` command with the `prerender` argument set to `true`
18
18
 
19
19
  ## Arguments
20
20
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi info"
2
+ title: "nuxt info"
3
3
  description: The info command logs information about the current or specified Nuxt project.
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--info-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi info [ROOTDIR] [--cwd=<directory>]
13
+ npx nuxt info [ROOTDIR] [--cwd=<directory>]
14
14
  ```
15
15
  <!--/info-cmd-->
16
16
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi init"
2
+ title: "create nuxt"
3
3
  description: The init command initializes a fresh Nuxt project.
4
4
  links:
5
5
  - label: Source
@@ -10,11 +10,11 @@ links:
10
10
 
11
11
  <!--init-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi init [DIR] [--cwd=<directory>] [-t, --template] [-f, --force] [--offline] [--preferOffline] [--no-install] [--gitInit] [--shell] [--packageManager]
13
+ npm create nuxt@latest [DIR] [--cwd=<directory>] [-t, --template] [-f, --force] [--offline] [--preferOffline] [--no-install] [--gitInit] [--shell] [--packageManager]
14
14
  ```
15
15
  <!--/init-cmd-->
16
16
 
17
- The `init` command initializes a fresh Nuxt project using [unjs/giget](https://github.com/unjs/giget).
17
+ The `create-nuxt` command initializes a fresh Nuxt project using [unjs/giget](https://github.com/unjs/giget).
18
18
 
19
19
  ## Arguments
20
20
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi module"
2
+ title: "nuxt module"
3
3
  description: "Search and add modules to your Nuxt application with the command line."
4
4
  links:
5
5
  - label: Source
@@ -8,13 +8,13 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- Nuxi provides a few utilities to work with [Nuxt modules](/modules) seamlessly.
11
+ Nuxt provides a few utilities to work with [Nuxt modules](/modules) seamlessly.
12
12
 
13
- ## nuxi module add
13
+ ## nuxt module add
14
14
 
15
15
  <!--module-add-cmd-->
16
16
  ```bash [Terminal]
17
- npx nuxi module add <MODULENAME> [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--skipInstall] [--skipConfig] [--dev]
17
+ npx nuxt module add <MODULENAME> [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--skipInstall] [--skipConfig] [--dev]
18
18
  ```
19
19
  <!--/module-add-cmd-->
20
20
 
@@ -47,14 +47,14 @@ When running the command, it will:
47
47
  Installing the [`Pinia`](/modules/pinia) module
48
48
 
49
49
  ```bash [Terminal]
50
- npx nuxi module add pinia
50
+ npx nuxt module add pinia
51
51
  ```
52
52
 
53
- ## nuxi module search
53
+ ## nuxt module search
54
54
 
55
55
  <!--module-search-cmd-->
56
56
  ```bash [Terminal]
57
- npx nuxi module search <QUERY> [--cwd=<directory>] [--nuxtVersion=<2|3>]
57
+ npx nuxt module search <QUERY> [--cwd=<directory>] [--nuxtVersion=<2|3>]
58
58
  ```
59
59
  <!--/module-search-cmd-->
60
60
 
@@ -80,5 +80,5 @@ The command searches for Nuxt modules matching your query that are compatible wi
80
80
  **Example:**
81
81
 
82
82
  ```bash [Terminal]
83
- npx nuxi module search pinia
83
+ npx nuxt module search pinia
84
84
  ```
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: 'nuxi prepare'
2
+ title: 'nuxt prepare'
3
3
  description: The prepare command creates a .nuxt directory in your application and generates types.
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--prepare-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi prepare [ROOTDIR] [--dotenv] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--envName]
13
+ npx nuxt prepare [ROOTDIR] [--dotenv] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--envName]
14
14
  ```
15
15
  <!--/prepare-cmd-->
16
16
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi preview"
2
+ title: "nuxt preview"
3
3
  description: The preview command starts a server to preview your application after the build command.
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--preview-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi preview [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--envName] [--dotenv] [-p, --port]
13
+ npx nuxt preview [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--envName] [--dotenv] [-p, --port]
14
14
  ```
15
15
  <!--/preview-cmd-->
16
16
 
@@ -39,5 +39,5 @@ Option | Default | Description
39
39
  This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a `.env` file or as command-line argument.
40
40
 
41
41
  ::note
42
- For convenience, in preview mode, your [`.env`](/docs/guide/directory-structure/env) file will be loaded into `process.env`. (However, in production you will need to ensure your environment variables are set yourself.)
42
+ For convenience, in preview mode, your [`.env`](/docs/guide/directory-structure/env) file will be loaded into `process.env`. (However, in production you will need to ensure your environment variables are set yourself. For example, with Node.js 20+ you could do this by running `node --env-file .env .output/server/index.mjs` to start your server.)
43
43
  ::
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi typecheck"
2
+ title: "nuxt typecheck"
3
3
  description: The typecheck command runs vue-tsc to check types throughout your app.
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--typecheck-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi typecheck [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>]
13
+ npx nuxt typecheck [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>]
14
14
  ```
15
15
  <!--/typecheck-cmd-->
16
16
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: "nuxi upgrade"
2
+ title: "nuxt upgrade"
3
3
  description: The upgrade command upgrades Nuxt to the latest version.
4
4
  links:
5
5
  - label: Source
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  <!--upgrade-cmd-->
12
12
  ```bash [Terminal]
13
- npx nuxi upgrade [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dedupe] [-f, --force] [-ch, --channel=<stable|nightly>]
13
+ npx nuxt upgrade [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dedupe] [-f, --force] [-ch, --channel=<stable|nightly>]
14
14
  ```
15
15
  <!--/upgrade-cmd-->
16
16
 
@@ -117,7 +117,7 @@ export default defineNuxtModule({
117
117
 
118
118
  ```ts twoslash
119
119
  // @errors: 2391
120
- import type { NitroDevEventHandler } from 'nitro/types'
120
+ import type { NitroDevEventHandler } from 'nitropack/types'
121
121
  // ---cut---
122
122
  function addDevServerHandler (handler: NitroDevEventHandler): void
123
123
  ```
@@ -293,6 +293,53 @@ function addPrerenderRoutes (routes: string | string[]): void
293
293
  | ----------- | ------------------------------- | -------- | ---------------------------------------------- |
294
294
  | `routes` | `string \| string[]`{lang="ts"} | `true` | A route or an array of routes to prerender. |
295
295
 
296
+ ## `addServerImports`
297
+
298
+ Add imports to the server. It makes your imports available in Nitro without the need to import them manually.
299
+
300
+ ### Usage
301
+
302
+ ```ts twoslash
303
+ import { defineNuxtModule, createResolver, addServerImports } from '@nuxt/kit'
304
+
305
+ export default defineNuxtModule({
306
+ setup(options) {
307
+ const names = [
308
+ 'useStoryblok',
309
+ 'useStoryblokApi',
310
+ 'useStoryblokBridge',
311
+ 'renderRichText',
312
+ 'RichTextSchema'
313
+ ]
314
+
315
+ names.forEach((name) =>
316
+ addServerImports({ name, as: name, from: '@storyblok/vue' })
317
+ )
318
+ }
319
+ })
320
+ ```
321
+
322
+ ### Type
323
+
324
+ ```ts
325
+ function addServerImports (dirs: Import | Import[]): void
326
+ ```
327
+
328
+ ### Parameters
329
+
330
+ `imports`: An object or an array of objects with the following properties:
331
+
332
+ | Property | Type | Required | Description |
333
+ | ------------------ | ---------------------------- | -------- | --------------------------------------------------------------------------------------------------------------- |
334
+ | `name` | `string` | `true` | Import name to be detected. |
335
+ | `from` | `string` | `true` | Module specifier to import from. |
336
+ | `priority` | `number` | `false` | Priority of the import; if multiple imports have the same name, the one with the highest priority will be used. |
337
+ | `disabled` | `boolean` | `false` | If this import is disabled. |
338
+ | `meta` | `Record<string, any>` | `false` | Metadata of the import. |
339
+ | `type` | `boolean` | `false` | If this import is a pure type import. |
340
+ | `typeFrom` | `string` | `false` | Use this as the `from` value when generating type declarations. |
341
+ | `as` | `string` | `false` | Import as this name. |
342
+
296
343
  ## `addServerImportsDir`
297
344
 
298
345
  Add a directory to be scanned for auto-imports by Nitro.
@@ -34,16 +34,16 @@ import { defineNuxtModule, addImports } from "@nuxt/kit";
34
34
  export default defineNuxtModule({
35
35
  setup(options, nuxt) {
36
36
  const names = [
37
- "useStoryblok",
38
- "useStoryblokApi",
39
- "useStoryblokBridge",
40
- "renderRichText",
41
- "RichTextSchema"
42
- ];
37
+ 'useStoryblok',
38
+ 'useStoryblokApi',
39
+ 'useStoryblokBridge',
40
+ 'renderRichText',
41
+ 'RichTextSchema'
42
+ ]
43
43
 
44
44
  names.forEach((name) =>
45
- addImports({ name, as: name, from: "@storyblok/vue" })
46
- );
45
+ addImports({ name, as: name, from: '@storyblok/vue' })
46
+ )
47
47
  }
48
48
  })
49
49
  ```
@@ -68,7 +68,7 @@ Hook | Arguments | Description
68
68
  `nitro:build:public-assets` | `nitro` | Called after copying public assets. Allows modifying public assets before Nitro server is built.
69
69
  `prerender:routes` | `ctx` | Allows extending the routes to be pre-rendered.
70
70
  `build:error` | `error` | Called when an error occurs at build time.
71
- `prepare:types` | `options` | Called before Nuxi writes `.nuxt/tsconfig.json` and `.nuxt/nuxt.d.ts`, allowing addition of custom references and declarations in `nuxt.d.ts`, or directly modifying the options in `tsconfig.json`
71
+ `prepare:types` | `options` | Called before `@nuxt/cli` writes `.nuxt/tsconfig.json` and `.nuxt/nuxt.d.ts`, allowing addition of custom references and declarations in `nuxt.d.ts`, or directly modifying the options in `tsconfig.json`
72
72
  `listen` | `listenerServer, listener` | Called when the dev server is loading.
73
73
  `schema:extend` | `schemas` | Allows extending default schemas.
74
74
  `schema:resolved` | `schema` | Allows extending resolved schema.