@nuxt/docs-nightly 4.0.0-29161999.4b56bb92 → 4.0.0-29162105.8c587084
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.
- package/1.getting-started/01.introduction.md +3 -3
- package/1.getting-started/03.configuration.md +1 -1
- package/1.getting-started/07.routing.md +1 -1
- package/1.getting-started/10.data-fetching.md +1 -1
- package/1.getting-started/11.state-management.md +1 -1
- package/1.getting-started/12.error-handling.md +1 -1
- package/1.getting-started/15.prerendering.md +7 -7
- package/1.getting-started/16.deployment.md +2 -2
- package/1.getting-started/18.upgrade.md +9 -51
- package/2.guide/1.concepts/3.rendering.md +3 -3
- package/2.guide/1.concepts/5.modules.md +1 -1
- package/2.guide/1.concepts/8.typescript.md +6 -6
- package/2.guide/1.concepts/9.code-style.md +1 -1
- package/2.guide/2.directory-structure/{1.app/1.composables.md → 1.composables.md} +1 -1
- package/2.guide/2.directory-structure/1.content.md +1 -1
- package/2.guide/2.directory-structure/{1.app/1.pages.md → 1.pages.md} +2 -2
- package/2.guide/2.directory-structure/1.server.md +1 -1
- package/2.guide/2.directory-structure/2.env.md +4 -4
- package/2.guide/3.going-further/1.events.md +1 -1
- package/2.guide/3.going-further/1.experimental-features.md +1 -1
- package/2.guide/3.going-further/1.internals.md +2 -2
- package/2.guide/3.going-further/10.runtime-config.md +1 -1
- package/2.guide/3.going-further/11.nightly-release-channel.md +6 -2
- package/2.guide/3.going-further/3.modules.md +3 -3
- package/2.guide/3.going-further/9.debugging.md +5 -1
- package/2.guide/4.recipes/1.custom-routing.md +5 -5
- package/2.guide/4.recipes/4.sessions-and-authentication.md +2 -2
- package/3.api/1.components/10.nuxt-picture.md +1 -1
- package/3.api/1.components/9.nuxt-img.md +1 -1
- package/3.api/2.composables/use-async-data.md +1 -1
- package/3.api/2.composables/use-cookie.md +4 -5
- package/3.api/2.composables/use-fetch.md +1 -1
- package/3.api/2.composables/use-preview-mode.md +3 -3
- package/3.api/3.utils/define-page-meta.md +1 -1
- package/3.api/4.commands/add.md +20 -20
- package/3.api/4.commands/analyze.md +2 -2
- package/3.api/4.commands/build-module.md +2 -2
- package/3.api/4.commands/build.md +2 -2
- package/3.api/4.commands/cleanup.md +2 -2
- package/3.api/4.commands/dev.md +3 -3
- package/3.api/4.commands/devtools.md +3 -3
- package/3.api/4.commands/generate.md +3 -3
- package/3.api/4.commands/info.md +2 -2
- package/3.api/4.commands/init.md +3 -3
- package/3.api/4.commands/module.md +8 -8
- package/3.api/4.commands/prepare.md +2 -2
- package/3.api/4.commands/preview.md +3 -3
- package/3.api/4.commands/typecheck.md +2 -2
- package/3.api/4.commands/upgrade.md +2 -2
- package/3.api/5.kit/11.nitro.md +1 -48
- package/3.api/5.kit/4.autoimports.md +8 -8
- package/3.api/6.advanced/1.hooks.md +1 -1
- package/3.api/6.nuxt-config.md +3 -2932
- package/5.community/4.contribution.md +1 -1
- package/5.community/6.roadmap.md +12 -17
- package/5.community/7.changelog.md +1 -1
- package/7.migration/2.configuration.md +2 -2
- package/7.migration/7.component-options.md +1 -1
- package/package.json +1 -1
- package/2.guide/2.directory-structure/1.app/.navigation.yml +0 -5
- /package/2.guide/2.directory-structure/{1.app/1.assets.md → 1.assets.md} +0 -0
- /package/2.guide/2.directory-structure/{1.app/1.components.md → 1.components.md} +0 -0
- /package/2.guide/2.directory-structure/{1.app/1.layouts.md → 1.layouts.md} +0 -0
- /package/2.guide/2.directory-structure/{1.app/1.middleware.md → 1.middleware.md} +0 -0
- /package/2.guide/2.directory-structure/{1.app/1.plugins.md → 1.plugins.md} +0 -0
- /package/2.guide/2.directory-structure/{1.app/1.utils.md → 1.utils.md} +0 -0
- /package/2.guide/2.directory-structure/{1.app/3.app-config.md → 3.app-config.md} +0 -0
- /package/2.guide/2.directory-structure/{1.app/3.app.md → 3.app.md} +0 -0
- /package/2.guide/2.directory-structure/{1.app/3.error.md → 3.error.md} +0 -0
|
@@ -168,9 +168,8 @@ const user = useCookie(
|
|
|
168
168
|
}
|
|
169
169
|
)
|
|
170
170
|
|
|
171
|
-
if (user.value) {
|
|
172
|
-
//
|
|
173
|
-
user.value.score++
|
|
171
|
+
if (user.value && user.value !== null) {
|
|
172
|
+
user.value.score++; // userInfo cookie not update with this change
|
|
174
173
|
}
|
|
175
174
|
</script>
|
|
176
175
|
|
|
@@ -197,9 +196,9 @@ function add() {
|
|
|
197
196
|
}
|
|
198
197
|
|
|
199
198
|
function save() {
|
|
200
|
-
if (list.value) {
|
|
201
|
-
// the actual `list` cookie will be updated
|
|
199
|
+
if (list.value && list.value !== null) {
|
|
202
200
|
list.value = [...list.value]
|
|
201
|
+
// list cookie update with this change
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
</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
|
|
135
|
+
- `deep`: return data in a deep ref object. It is `false` by default to return data in a shallow ref object for performance.
|
|
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
|
|
107
|
-
npx
|
|
106
|
+
npx nuxi generate
|
|
107
|
+
npx nuxi 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 `
|
|
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.)
|
|
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 `~/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 `~/app/router.options.ts` (see [custom routing](/docs/guide/recipes/custom-routing#using-approuteroptions)) for more info.
|
|
140
140
|
|
|
141
141
|
**`[key: string]`**
|
|
142
142
|
|
package/3.api/4.commands/add.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "nuxi 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
|
|
13
|
+
npx nuxi 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
|
|
42
|
+
npx nuxi add plugin sockets --client
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
## `
|
|
45
|
+
## `nuxi 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
|
|
51
|
+
npx nuxi add component TheHeader
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
## `
|
|
54
|
+
## `nuxi add composable`
|
|
55
55
|
|
|
56
56
|
```bash [Terminal]
|
|
57
57
|
# Generates `composables/foo.ts`
|
|
58
|
-
npx
|
|
58
|
+
npx nuxi add composable foo
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
## `
|
|
61
|
+
## `nuxi add layout`
|
|
62
62
|
|
|
63
63
|
```bash [Terminal]
|
|
64
64
|
# Generates `layouts/custom.vue`
|
|
65
|
-
npx
|
|
65
|
+
npx nuxi add layout custom
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
## `
|
|
68
|
+
## `nuxi 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
|
|
74
|
+
npx nuxi add plugin analytics
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
## `
|
|
77
|
+
## `nuxi add page`
|
|
78
78
|
|
|
79
79
|
```bash [Terminal]
|
|
80
80
|
# Generates `pages/about.vue`
|
|
81
|
-
npx
|
|
81
|
+
npx nuxi add page about
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
```bash [Terminal]
|
|
85
85
|
# Generates `pages/category/[id].vue`
|
|
86
|
-
npx
|
|
86
|
+
npx nuxi add page "category/[id]"
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
## `
|
|
89
|
+
## `nuxi add middleware`
|
|
90
90
|
|
|
91
91
|
* Modifier flags: `--global`
|
|
92
92
|
|
|
93
93
|
```bash [Terminal]
|
|
94
94
|
# Generates `middleware/auth.ts`
|
|
95
|
-
npx
|
|
95
|
+
npx nuxi add middleware auth
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
## `
|
|
98
|
+
## `nuxi 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
|
|
104
|
+
npx nuxi add api hello
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
## `
|
|
107
|
+
## `nuxi add layer`
|
|
108
108
|
|
|
109
109
|
```bash [Terminal]
|
|
110
110
|
# Generates `layers/subscribe/nuxt.config.ts`
|
|
111
|
-
npx
|
|
111
|
+
npx nuxi add layer subscribe
|
|
112
112
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "nuxi 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
|
|
13
|
+
npx nuxi 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: '
|
|
2
|
+
title: 'nuxi 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
|
|
13
|
+
npx nuxi 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: "
|
|
2
|
+
title: "nuxi 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
|
|
13
|
+
npx nuxi 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: '
|
|
2
|
+
title: 'nuxi 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
|
|
13
|
+
npx nuxi cleanup [ROOTDIR] [--cwd=<directory>]
|
|
14
14
|
```
|
|
15
15
|
<!--/cleanup-cmd-->
|
|
16
16
|
|
package/3.api/4.commands/dev.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: '
|
|
2
|
+
title: 'nuxi 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
|
|
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]
|
|
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,
|
|
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.
|
|
54
54
|
|
|
55
55
|
This command sets `process.env.NODE_ENV` to `development`.
|
|
56
56
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "nuxi 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
|
|
13
|
+
npx nuxi devtools <COMMAND> [ROOTDIR] [--cwd=<directory>]
|
|
14
14
|
```
|
|
15
15
|
<!--/devtools-cmd-->
|
|
16
16
|
|
|
17
|
-
Running `
|
|
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`.
|
|
18
18
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "nuxi 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
|
|
13
|
+
npx nuxi 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 `
|
|
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`
|
|
18
18
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
package/3.api/4.commands/info.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "nuxi 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
|
|
13
|
+
npx nuxi info [ROOTDIR] [--cwd=<directory>]
|
|
14
14
|
```
|
|
15
15
|
<!--/info-cmd-->
|
|
16
16
|
|
package/3.api/4.commands/init.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "nuxi init"
|
|
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
|
-
|
|
13
|
+
npx nuxi init [DIR] [--cwd=<directory>] [-t, --template] [-f, --force] [--offline] [--preferOffline] [--no-install] [--gitInit] [--shell] [--packageManager]
|
|
14
14
|
```
|
|
15
15
|
<!--/init-cmd-->
|
|
16
16
|
|
|
17
|
-
The `
|
|
17
|
+
The `init` 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: "
|
|
2
|
+
title: "nuxi 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
|
-
|
|
11
|
+
Nuxi provides a few utilities to work with [Nuxt modules](/modules) seamlessly.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## nuxi module add
|
|
14
14
|
|
|
15
15
|
<!--module-add-cmd-->
|
|
16
16
|
```bash [Terminal]
|
|
17
|
-
npx
|
|
17
|
+
npx nuxi 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
|
|
50
|
+
npx nuxi module add pinia
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
##
|
|
53
|
+
## nuxi module search
|
|
54
54
|
|
|
55
55
|
<!--module-search-cmd-->
|
|
56
56
|
```bash [Terminal]
|
|
57
|
-
npx
|
|
57
|
+
npx nuxi 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
|
|
83
|
+
npx nuxi module search pinia
|
|
84
84
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: '
|
|
2
|
+
title: 'nuxi 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
|
|
13
|
+
npx nuxi 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: "
|
|
2
|
+
title: "nuxi 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
|
|
13
|
+
npx nuxi 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.)
|
|
43
43
|
::
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "nuxi 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
|
|
13
|
+
npx nuxi typecheck [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>]
|
|
14
14
|
```
|
|
15
15
|
<!--/typecheck-cmd-->
|
|
16
16
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "nuxi 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
|
|
13
|
+
npx nuxi upgrade [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dedupe] [-f, --force] [-ch, --channel=<stable|nightly>]
|
|
14
14
|
```
|
|
15
15
|
<!--/upgrade-cmd-->
|
|
16
16
|
|
package/3.api/5.kit/11.nitro.md
CHANGED
|
@@ -117,7 +117,7 @@ export default defineNuxtModule({
|
|
|
117
117
|
|
|
118
118
|
```ts twoslash
|
|
119
119
|
// @errors: 2391
|
|
120
|
-
import type { NitroDevEventHandler } from '
|
|
120
|
+
import type { NitroDevEventHandler } from 'nitro/types'
|
|
121
121
|
// ---cut---
|
|
122
122
|
function addDevServerHandler (handler: NitroDevEventHandler): void
|
|
123
123
|
```
|
|
@@ -293,53 +293,6 @@ 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
|
-
|
|
343
296
|
## `addServerImportsDir`
|
|
344
297
|
|
|
345
298
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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:
|
|
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
|
|
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`
|
|
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.
|