@nuxt/docs 3.20.2 → 3.21.0
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 +4 -4
- package/1.getting-started/02.installation.md +4 -7
- package/1.getting-started/03.configuration.md +29 -29
- package/1.getting-started/04.views.md +6 -4
- package/1.getting-started/05.assets.md +2 -2
- package/1.getting-started/06.styling.md +22 -16
- package/1.getting-started/07.routing.md +6 -6
- package/1.getting-started/08.seo-meta.md +8 -4
- package/1.getting-started/09.transitions.md +6 -6
- package/1.getting-started/10.data-fetching.md +18 -18
- package/1.getting-started/11.state-management.md +5 -5
- package/1.getting-started/12.error-handling.md +25 -19
- package/1.getting-started/13.server.md +9 -9
- package/1.getting-started/14.layers.md +49 -15
- package/1.getting-started/15.prerendering.md +10 -4
- package/1.getting-started/16.deployment.md +2 -1
- package/1.getting-started/17.testing.md +17 -7
- package/1.getting-started/18.upgrade.md +111 -60
- package/2.directory-structure/0.output.md +1 -1
- package/2.directory-structure/1.assets.md +1 -1
- package/2.directory-structure/1.components.md +12 -8
- package/2.directory-structure/1.composables.md +2 -2
- package/2.directory-structure/1.content.md +1 -1
- package/2.directory-structure/1.layers.md +87 -0
- package/2.directory-structure/1.layouts.md +35 -3
- package/2.directory-structure/1.middleware.md +7 -7
- package/2.directory-structure/1.modules.md +8 -2
- package/2.directory-structure/1.node_modules.md +1 -1
- package/2.directory-structure/1.pages.md +39 -18
- package/2.directory-structure/1.plugins.md +4 -1
- package/2.directory-structure/1.public.md +1 -1
- package/2.directory-structure/1.server.md +28 -8
- package/2.directory-structure/1.shared.md +3 -3
- package/2.directory-structure/1.utils.md +2 -2
- package/2.directory-structure/2.env.md +3 -3
- package/2.directory-structure/2.nuxtignore.md +1 -0
- package/2.directory-structure/2.nuxtrc.md +5 -2
- package/2.directory-structure/3.app-config.md +2 -2
- package/2.directory-structure/3.app.md +3 -3
- package/2.directory-structure/3.error.md +9 -5
- package/2.directory-structure/3.nuxt-config.md +1 -1
- package/2.directory-structure/3.package.md +1 -1
- package/2.directory-structure/3.tsconfig.md +3 -2
- package/2.directory-structure/index.md +12 -8
- package/3.guide/0.index.md +8 -2
- package/3.guide/1.concepts/{3.rendering.md → 1.rendering.md} +7 -32
- package/3.guide/1.concepts/{2.vuejs-development.md → 10.vuejs-development.md} +9 -8
- package/3.guide/1.concepts/{10.nuxt-lifecycle.md → 2.nuxt-lifecycle.md} +31 -24
- package/3.guide/1.concepts/{1.auto-imports.md → 3.auto-imports.md} +6 -6
- package/3.guide/1.concepts/4.server-engine.md +2 -2
- package/3.guide/1.concepts/5.modules.md +14 -1
- package/3.guide/1.concepts/7.esm.md +5 -4
- package/3.guide/1.concepts/8.typescript.md +9 -15
- package/3.guide/1.concepts/9.code-style.md +1 -1
- package/3.guide/2.best-practices/hydration.md +1 -1
- package/3.guide/2.best-practices/performance.md +5 -5
- package/3.guide/3.ai/.navigation.yml +3 -0
- package/3.guide/3.ai/1.mcp.md +277 -0
- package/3.guide/3.ai/2.llms-txt.md +65 -0
- package/3.guide/4.modules/.navigation.yml +3 -0
- package/3.guide/4.modules/1.getting-started.md +103 -0
- package/3.guide/4.modules/2.module-anatomy.md +138 -0
- package/3.guide/4.modules/3.recipes-basics.md +330 -0
- package/3.guide/4.modules/4.recipes-advanced.md +243 -0
- package/3.guide/4.modules/5.testing.md +76 -0
- package/3.guide/4.modules/6.best-practices.md +104 -0
- package/3.guide/4.modules/7.ecosystem.md +32 -0
- package/3.guide/4.modules/index.md +36 -0
- package/3.guide/{3.recipes → 5.recipes}/1.custom-routing.md +3 -3
- package/3.guide/{3.recipes → 5.recipes}/2.vite-plugin.md +4 -0
- package/3.guide/{3.recipes → 5.recipes}/3.custom-usefetch.md +2 -2
- package/3.guide/{3.recipes → 5.recipes}/4.sessions-and-authentication.md +2 -2
- package/3.guide/{4.going-further → 6.going-further}/1.events.md +3 -4
- package/3.guide/{4.going-further → 6.going-further}/1.experimental-features.md +211 -86
- package/3.guide/6.going-further/1.features.md +108 -0
- package/3.guide/{4.going-further → 6.going-further}/1.internals.md +4 -3
- package/3.guide/{4.going-further → 6.going-further}/10.runtime-config.md +2 -2
- package/3.guide/{4.going-further → 6.going-further}/11.nightly-release-channel.md +1 -1
- package/3.guide/{4.going-further → 6.going-further}/2.hooks.md +5 -5
- package/3.guide/{4.going-further → 6.going-further}/4.kit.md +3 -3
- package/3.guide/{4.going-further → 6.going-further}/6.nuxt-app.md +6 -6
- package/3.guide/{4.going-further → 6.going-further}/7.layers.md +31 -5
- package/3.guide/{4.going-further → 6.going-further}/9.debugging.md +3 -2
- package/4.api/1.components/1.nuxt-client-fallback.md +5 -1
- package/4.api/1.components/10.nuxt-picture.md +1 -1
- package/4.api/1.components/11.teleports.md +2 -2
- package/4.api/1.components/12.nuxt-route-announcer.md +0 -2
- package/4.api/1.components/13.nuxt-time.md +0 -2
- package/4.api/1.components/2.nuxt-page.md +3 -3
- package/4.api/1.components/3.nuxt-layout.md +6 -6
- package/4.api/1.components/4.nuxt-link.md +13 -13
- package/4.api/1.components/5.nuxt-loading-indicator.md +1 -1
- package/4.api/1.components/6.nuxt-error-boundary.md +2 -2
- package/4.api/1.components/7.nuxt-welcome.md +2 -2
- package/4.api/1.components/8.nuxt-island.md +9 -2
- package/4.api/2.composables/use-app-config.md +1 -1
- package/4.api/2.composables/use-async-data.md +5 -5
- package/4.api/2.composables/use-cookie.md +16 -16
- package/4.api/2.composables/use-error.md +3 -3
- package/4.api/2.composables/use-fetch.md +37 -37
- package/4.api/2.composables/use-head-safe.md +1 -1
- package/4.api/2.composables/use-head.md +22 -7
- package/4.api/2.composables/use-lazy-async-data.md +1 -1
- package/4.api/2.composables/use-lazy-fetch.md +9 -9
- package/4.api/2.composables/use-nuxt-app.md +9 -7
- package/4.api/2.composables/use-route-announcer.md +0 -2
- package/4.api/2.composables/use-route.md +2 -2
- package/4.api/2.composables/use-router.md +15 -15
- package/4.api/2.composables/use-runtime-config.md +5 -5
- package/4.api/2.composables/use-seo-meta.md +2 -2
- package/4.api/2.composables/use-server-seo-meta.md +2 -2
- package/4.api/2.composables/use-state.md +12 -2
- package/4.api/3.utils/$fetch.md +1 -1
- package/4.api/3.utils/abort-navigation.md +2 -2
- package/4.api/3.utils/call-once.md +2 -4
- package/4.api/3.utils/clear-error.md +1 -1
- package/4.api/3.utils/create-error.md +7 -7
- package/4.api/3.utils/define-lazy-hydration-component.md +5 -5
- package/4.api/3.utils/define-nuxt-component.md +1 -1
- package/4.api/3.utils/define-nuxt-plugin.md +12 -12
- package/4.api/3.utils/define-nuxt-route-middleware.md +2 -2
- package/4.api/3.utils/define-page-meta.md +18 -11
- package/4.api/3.utils/define-route-rules.md +2 -2
- package/4.api/3.utils/navigate-to.md +14 -14
- package/4.api/3.utils/on-before-route-leave.md +1 -1
- package/4.api/3.utils/on-before-route-update.md +1 -1
- package/4.api/3.utils/preload-route-components.md +2 -2
- package/4.api/3.utils/refresh-cookie.md +0 -2
- package/4.api/3.utils/refresh-nuxt-data.md +1 -1
- package/4.api/3.utils/reload-nuxt-app.md +1 -1
- package/4.api/3.utils/set-page-layout.md +36 -0
- package/4.api/3.utils/set-response-status.md +3 -3
- package/4.api/3.utils/show-error.md +4 -4
- package/4.api/3.utils/update-app-config.md +1 -1
- package/4.api/4.commands/add.md +11 -11
- package/4.api/4.commands/analyze.md +11 -11
- package/4.api/4.commands/build-module.md +11 -11
- package/4.api/4.commands/build.md +12 -12
- package/4.api/4.commands/cleanup.md +6 -6
- package/4.api/4.commands/dev.md +23 -23
- package/4.api/4.commands/devtools.md +7 -7
- package/4.api/4.commands/generate.md +12 -12
- package/4.api/4.commands/info.md +6 -6
- package/4.api/4.commands/init.md +18 -18
- package/4.api/4.commands/module.md +18 -18
- package/4.api/4.commands/prepare.md +10 -10
- package/4.api/4.commands/preview.md +11 -11
- package/4.api/4.commands/test.md +9 -9
- package/4.api/4.commands/typecheck.md +10 -10
- package/4.api/4.commands/upgrade.md +10 -10
- package/4.api/5.kit/1.modules.md +31 -18
- package/4.api/5.kit/10.templates.md +23 -23
- package/4.api/5.kit/11.nitro.md +36 -36
- package/4.api/5.kit/12.resolving.md +2 -2
- package/4.api/5.kit/14.builder.md +35 -23
- package/4.api/5.kit/16.layers.md +16 -16
- package/4.api/5.kit/2.programmatic.md +2 -2
- package/4.api/5.kit/3.compatibility.md +2 -2
- package/4.api/5.kit/4.autoimports.md +18 -18
- package/4.api/5.kit/5.components.md +35 -35
- package/4.api/5.kit/6.context.md +1 -1
- package/4.api/5.kit/8.layout.md +1 -1
- package/4.api/6.advanced/1.hooks.md +85 -85
- package/4.api/index.md +7 -7
- package/5.community/4.contribution.md +10 -10
- package/5.community/5.framework-contribution.md +9 -9
- package/5.community/6.roadmap.md +25 -25
- package/5.community/7.changelog.md +10 -0
- package/6.bridge/1.overview.md +8 -0
- package/6.bridge/3.bridge-composition-api.md +2 -2
- package/6.bridge/4.plugins-and-middleware.md +2 -2
- package/6.bridge/5.nuxt3-compatible-api.md +1 -1
- package/6.bridge/8.nitro.md +4 -0
- package/7.migration/10.bundling.md +1 -1
- package/7.migration/11.server.md +3 -3
- package/7.migration/2.configuration.md +5 -5
- package/7.migration/20.module-authors.md +3 -3
- package/7.migration/4.meta.md +1 -1
- package/7.migration/5.plugins-and-middleware.md +3 -3
- package/7.migration/6.pages-and-layouts.md +5 -5
- package/7.migration/7.component-options.md +6 -6
- package/7.migration/8.runtime-config.md +1 -1
- package/package.json +1 -1
- package/3.guide/4.going-further/1.features.md +0 -103
- package/3.guide/4.going-further/3.modules.md +0 -901
- /package/3.guide/{3.recipes → 5.recipes}/.navigation.yml +0 -0
- /package/3.guide/{4.going-further → 6.going-further}/.navigation.yml +0 -0
- /package/3.guide/{4.going-further → 6.going-further}/index.md +0 -0
|
@@ -24,15 +24,15 @@ The `cleanup` command removes common generated Nuxt files and caches, including:
|
|
|
24
24
|
## Arguments
|
|
25
25
|
|
|
26
26
|
<!--cleanup-args-->
|
|
27
|
-
Argument
|
|
28
|
-
|
|
29
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
27
|
+
| Argument | Description |
|
|
28
|
+
|---------------|------------------------------------------------|
|
|
29
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
30
30
|
<!--/cleanup-args-->
|
|
31
31
|
|
|
32
32
|
## Options
|
|
33
33
|
|
|
34
34
|
<!--cleanup-opts-->
|
|
35
|
-
Option
|
|
36
|
-
|
|
37
|
-
`--cwd=<directory>` |
|
|
35
|
+
| Option | Default | Description |
|
|
36
|
+
|---------------------|---------|----------------------------------------------------------------------------------|
|
|
37
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
38
38
|
<!--/cleanup-opts-->
|
package/4.api/4.commands/dev.md
CHANGED
|
@@ -19,34 +19,34 @@ The `dev` command starts a development server with hot module replacement at [ht
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--dev-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
25
|
<!--/dev-args-->
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
29
|
<!--dev-opts-->
|
|
30
|
-
Option
|
|
31
|
-
|
|
32
|
-
`--cwd=<directory>`
|
|
33
|
-
`--logLevel=<silent\|info\|verbose>` |
|
|
34
|
-
`--dotenv`
|
|
35
|
-
`--envName`
|
|
36
|
-
`-e, --extends=<layer-name>`
|
|
37
|
-
`--clear`
|
|
38
|
-
`--no-f, --no-fork`
|
|
39
|
-
`-p, --port`
|
|
40
|
-
`-h, --host`
|
|
41
|
-
`--clipboard`
|
|
42
|
-
`-o, --open`
|
|
43
|
-
`--https`
|
|
44
|
-
`--publicURL`
|
|
45
|
-
`--qr`
|
|
46
|
-
`--public`
|
|
47
|
-
`--tunnel`
|
|
48
|
-
`--sslCert`
|
|
49
|
-
`--sslKey`
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `--dotenv` | | Path to `.env` file to load, relative to the root directory |
|
|
35
|
+
| `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) |
|
|
36
|
+
| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
|
|
37
|
+
| `--clear` | `false` | Clear console on restart |
|
|
38
|
+
| `--no-f, --no-fork` | | Disable forked mode |
|
|
39
|
+
| `-p, --port` | | Port to listen on (default: `NUXT_PORT \|\| NITRO_PORT \|\| PORT \|\| nuxtOptions.devServer.port`) |
|
|
40
|
+
| `-h, --host` | | Host to listen on (default: `NUXT_HOST \|\| NITRO_HOST \|\| HOST \|\| nuxtOptions.devServer?.host`) |
|
|
41
|
+
| `--clipboard` | `false` | Copy the URL to the clipboard |
|
|
42
|
+
| `-o, --open` | `false` | Open the URL in the browser |
|
|
43
|
+
| `--https` | | Enable HTTPS |
|
|
44
|
+
| `--publicURL` | | Displayed public URL (used for QR code) |
|
|
45
|
+
| `--qr` | | Display The QR code of public URL when available |
|
|
46
|
+
| `--public` | | Listen to all network interfaces |
|
|
47
|
+
| `--tunnel` | | Open a tunnel using https://github.com/unjs/untun |
|
|
48
|
+
| `--sslCert` | | (DEPRECATED) Use `--https.cert` instead. |
|
|
49
|
+
| `--sslKey` | | (DEPRECATED) Use `--https.key` instead. |
|
|
50
50
|
<!--/dev-opts-->
|
|
51
51
|
|
|
52
52
|
The port and host can also be set via NUXT_PORT, PORT, NUXT_HOST or HOST environment variables.
|
|
@@ -19,18 +19,18 @@ Running `nuxt devtools enable` will install the Nuxt DevTools globally, and also
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--devtools-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`COMMAND`
|
|
25
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `COMMAND` | Command to run (options: <enable\|disable>) |
|
|
25
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
26
26
|
<!--/devtools-args-->
|
|
27
27
|
|
|
28
28
|
## Options
|
|
29
29
|
|
|
30
30
|
<!--devtools-opts-->
|
|
31
|
-
Option
|
|
32
|
-
|
|
33
|
-
`--cwd=<directory>` |
|
|
31
|
+
| Option | Default | Description |
|
|
32
|
+
|---------------------|---------|----------------------------------------------------------------------------------|
|
|
33
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
34
34
|
<!--/devtools-opts-->
|
|
35
35
|
|
|
36
36
|
::read-more{icon="i-simple-icons-nuxtdotjs" to="https://devtools.nuxt.com" target="\_blank"}
|
|
@@ -19,24 +19,24 @@ The `generate` command pre-renders every route of your application and stores th
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--generate-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
25
|
<!--/generate-args-->
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
29
|
<!--generate-opts-->
|
|
30
|
-
Option
|
|
31
|
-
|
|
32
|
-
`--cwd=<directory>`
|
|
33
|
-
`--logLevel=<silent\|info\|verbose>` |
|
|
34
|
-
`--preset`
|
|
35
|
-
`--dotenv`
|
|
36
|
-
`--envName`
|
|
37
|
-
`-e, --extends=<layer-name>`
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `--preset` | | Nitro server preset |
|
|
35
|
+
| `--dotenv` | | Path to `.env` file to load, relative to the root directory |
|
|
36
|
+
| `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) |
|
|
37
|
+
| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
|
|
38
38
|
<!--/generate-opts-->
|
|
39
39
|
|
|
40
|
-
::read-more{to="/docs/getting-started/deployment#static-hosting"}
|
|
40
|
+
::read-more{to="/docs/3.x/getting-started/deployment#static-hosting"}
|
|
41
41
|
Read more about pre-rendering and static hosting.
|
|
42
42
|
::
|
package/4.api/4.commands/info.md
CHANGED
|
@@ -19,15 +19,15 @@ The `info` command logs information about the current or specified Nuxt project.
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--info-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
25
|
<!--/info-args-->
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
29
|
<!--info-opts-->
|
|
30
|
-
Option
|
|
31
|
-
|
|
32
|
-
`--cwd=<directory>` |
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|---------------------|---------|----------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
33
|
<!--/info-opts-->
|
package/4.api/4.commands/init.md
CHANGED
|
@@ -19,29 +19,29 @@ The `create-nuxt` command initializes a fresh Nuxt project using [unjs/giget](ht
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--init-args-->
|
|
22
|
-
Argument | Description
|
|
23
|
-
|
|
24
|
-
`DIR=""` | Project directory
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|----------|-------------------|
|
|
24
|
+
| `DIR=""` | Project directory |
|
|
25
25
|
<!--/init-args-->
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
29
|
<!--init-opts-->
|
|
30
|
-
Option
|
|
31
|
-
|
|
32
|
-
`--cwd=<directory>`
|
|
33
|
-
`--logLevel=<silent\|info\|verbose>` |
|
|
34
|
-
`-t, --template`
|
|
35
|
-
`-f, --force`
|
|
36
|
-
`--offline`
|
|
37
|
-
`--preferOffline`
|
|
38
|
-
`--no-install`
|
|
39
|
-
`--gitInit`
|
|
40
|
-
`--shell`
|
|
41
|
-
`--packageManager`
|
|
42
|
-
`-M, --modules`
|
|
43
|
-
`--no-modules`
|
|
44
|
-
`--nightly`
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------|---------|----------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | `.` | Specify the working directory |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `-t, --template` | | Template name |
|
|
35
|
+
| `-f, --force` | | Override existing directory |
|
|
36
|
+
| `--offline` | | Force offline mode |
|
|
37
|
+
| `--preferOffline` | | Prefer offline mode |
|
|
38
|
+
| `--no-install` | | Skip installing dependencies |
|
|
39
|
+
| `--gitInit` | | Initialize git repository |
|
|
40
|
+
| `--shell` | | Start shell after installation in project directory |
|
|
41
|
+
| `--packageManager` | | Package manager choice (npm, pnpm, yarn, bun) |
|
|
42
|
+
| `-M, --modules` | | Nuxt modules to install (comma separated without spaces) |
|
|
43
|
+
| `--no-modules` | | Skip module installation prompt |
|
|
44
|
+
| `--nightly` | | Use Nuxt nightly release channel (3x or latest) |
|
|
45
45
|
<!--/init-opts-->
|
|
46
46
|
|
|
47
47
|
## Environment variables
|
|
@@ -4,7 +4,7 @@ description: "Search and add modules to your Nuxt application with the command l
|
|
|
4
4
|
links:
|
|
5
5
|
- label: Source
|
|
6
6
|
icon: i-simple-icons-github
|
|
7
|
-
to: https://github.com/nuxt/cli/
|
|
7
|
+
to: https://github.com/nuxt/cli/tree/main/packages/nuxi/src/commands/module
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -19,19 +19,19 @@ npx nuxt module add <MODULENAME> [--cwd=<directory>] [--logLevel=<silent|info|ve
|
|
|
19
19
|
<!--/module-add-cmd-->
|
|
20
20
|
|
|
21
21
|
<!--module-add-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`MODULENAME` | Specify one or more modules to install by name, separated by spaces
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|--------------|---------------------------------------------------------------------|
|
|
24
|
+
| `MODULENAME` | Specify one or more modules to install by name, separated by spaces |
|
|
25
25
|
<!--/module-add-args-->
|
|
26
26
|
|
|
27
27
|
<!--module-add-opts-->
|
|
28
|
-
Option
|
|
29
|
-
|
|
30
|
-
`--cwd=<directory>`
|
|
31
|
-
`--logLevel=<silent\|info\|verbose>` |
|
|
32
|
-
`--skipInstall`
|
|
33
|
-
`--skipConfig`
|
|
34
|
-
`--dev`
|
|
28
|
+
| Option | Default | Description |
|
|
29
|
+
|--------------------------------------|---------|-------------------------------------|
|
|
30
|
+
| `--cwd=<directory>` | `.` | Specify the working directory |
|
|
31
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
32
|
+
| `--skipInstall` | | Skip npm install |
|
|
33
|
+
| `--skipConfig` | | Skip nuxt.config.ts update |
|
|
34
|
+
| `--dev` | | Install modules as dev dependencies |
|
|
35
35
|
<!--/module-add-opts-->
|
|
36
36
|
|
|
37
37
|
The command lets you install [Nuxt modules](/modules) in your application with no manual work.
|
|
@@ -61,18 +61,18 @@ npx nuxt module search <QUERY> [--cwd=<directory>] [--nuxtVersion=<2|3>]
|
|
|
61
61
|
### Arguments
|
|
62
62
|
|
|
63
63
|
<!--module-search-args-->
|
|
64
|
-
Argument | Description
|
|
65
|
-
|
|
66
|
-
`QUERY`
|
|
64
|
+
| Argument | Description |
|
|
65
|
+
|----------|------------------------|
|
|
66
|
+
| `QUERY` | keywords to search for |
|
|
67
67
|
<!--/module-search-args-->
|
|
68
68
|
|
|
69
69
|
### Options
|
|
70
70
|
|
|
71
71
|
<!--module-search-opts-->
|
|
72
|
-
Option
|
|
73
|
-
|
|
74
|
-
`--cwd=<directory>`
|
|
75
|
-
`--nuxtVersion=<2\|3>` |
|
|
72
|
+
| Option | Default | Description |
|
|
73
|
+
|------------------------|---------|------------------------------------------------------------------------------------|
|
|
74
|
+
| `--cwd=<directory>` | `.` | Specify the working directory |
|
|
75
|
+
| `--nuxtVersion=<2\|3>` | | Filter by Nuxt version and list compatible modules only (auto detected by default) |
|
|
76
76
|
<!--/module-search-opts-->
|
|
77
77
|
|
|
78
78
|
The command searches for Nuxt modules matching your query that are compatible with your Nuxt version.
|
|
@@ -19,21 +19,21 @@ The `prepare` command creates a [`.nuxt`](/docs/3.x/directory-structure/nuxt) di
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--prepare-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
25
|
<!--/prepare-args-->
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
29
|
<!--prepare-opts-->
|
|
30
|
-
Option
|
|
31
|
-
|
|
32
|
-
`--dotenv`
|
|
33
|
-
`--cwd=<directory>`
|
|
34
|
-
`--logLevel=<silent\|info\|verbose>` |
|
|
35
|
-
`--envName`
|
|
36
|
-
`-e, --extends=<layer-name>`
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
32
|
+
| `--dotenv` | | Path to `.env` file to load, relative to the root directory |
|
|
33
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
34
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
35
|
+
| `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) |
|
|
36
|
+
| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
|
|
37
37
|
<!--/prepare-opts-->
|
|
38
38
|
|
|
39
39
|
::note
|
|
@@ -19,22 +19,22 @@ The `preview` command starts a server to preview your Nuxt application after run
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--preview-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
25
|
<!--/preview-args-->
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
29
|
<!--preview-opts-->
|
|
30
|
-
Option
|
|
31
|
-
|
|
32
|
-
`--cwd=<directory>`
|
|
33
|
-
`--logLevel=<silent\|info\|verbose>` |
|
|
34
|
-
`--envName`
|
|
35
|
-
`-e, --extends=<layer-name>`
|
|
36
|
-
`-p, --port`
|
|
37
|
-
`--dotenv`
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) |
|
|
35
|
+
| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
|
|
36
|
+
| `-p, --port` | | Port to listen on (use `PORT` environment variable to override) |
|
|
37
|
+
| `--dotenv` | | Path to `.env` file to load, relative to the root directory |
|
|
38
38
|
<!--/preview-opts-->
|
|
39
39
|
|
|
40
40
|
This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a `.env` file or as command-line argument.
|
package/4.api/4.commands/test.md
CHANGED
|
@@ -19,20 +19,20 @@ The `test` command runs tests using [`@nuxt/test-utils`](/docs/getting-started/t
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--test-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
25
|
<!--/test-args-->
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
29
|
<!--test-opts-->
|
|
30
|
-
Option
|
|
31
|
-
|
|
32
|
-
`--cwd=<directory>`
|
|
33
|
-
`--logLevel=<silent\|info\|verbose>` |
|
|
34
|
-
`--dev`
|
|
35
|
-
`--watch`
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------|---------|----------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `--dev` | | Run in dev mode |
|
|
35
|
+
| `--watch` | | Watch mode |
|
|
36
36
|
<!--/test-opts-->
|
|
37
37
|
|
|
38
38
|
::note
|
|
@@ -19,26 +19,26 @@ The `typecheck` command runs [`vue-tsc`](https://github.com/vuejs/language-tools
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--typecheck-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
25
|
<!--/typecheck-args-->
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
29
|
<!--typecheck-opts-->
|
|
30
|
-
Option
|
|
31
|
-
|
|
32
|
-
`--cwd=<directory>`
|
|
33
|
-
`--logLevel=<silent\|info\|verbose>` |
|
|
34
|
-
`--dotenv`
|
|
35
|
-
`-e, --extends=<layer-name>`
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------|---------|----------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `--dotenv` | | Path to `.env` file to load, relative to the root directory |
|
|
35
|
+
| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
|
|
36
36
|
<!--/typecheck-opts-->
|
|
37
37
|
|
|
38
38
|
::note
|
|
39
39
|
This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a [`.env`](/docs/3.x/directory-structure/env) file or as a command-line argument.
|
|
40
40
|
::
|
|
41
41
|
|
|
42
|
-
::read-more{to="/docs/guide/concepts/typescript#type-checking"}
|
|
42
|
+
::read-more{to="/docs/3.x/guide/concepts/typescript#type-checking"}
|
|
43
43
|
Read more on how to enable type-checking at build or development time.
|
|
44
44
|
::
|
|
@@ -19,19 +19,19 @@ The `upgrade` command upgrades Nuxt to the latest version.
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--upgrade-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
25
|
<!--/upgrade-args-->
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
29
|
<!--upgrade-opts-->
|
|
30
|
-
Option
|
|
31
|
-
|
|
32
|
-
`--cwd=<directory>`
|
|
33
|
-
`--logLevel=<silent\|info\|verbose>`
|
|
34
|
-
`--dedupe`
|
|
35
|
-
`-f, --force`
|
|
36
|
-
`-ch, --channel=<stable\|nightly\|v3\|v4\|v4-nightly\|v3-nightly>` | `stable` | Specify a channel to install from (default: stable)
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------------------------------------|----------|----------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `--dedupe` | | Dedupe dependencies after upgrading |
|
|
35
|
+
| `-f, --force` | | Force upgrade to recreate lockfile and node_modules |
|
|
36
|
+
| `-ch, --channel=<stable\|nightly\|v3\|v4\|v4-nightly\|v3-nightly>` | `stable` | Specify a channel to install from (default: stable) |
|
|
37
37
|
<!--/upgrade-opts-->
|
package/4.api/5.kit/1.modules.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Nuxt Kit provides a set of utilities to help you create and use mod
|
|
|
4
4
|
links:
|
|
5
5
|
- label: Source
|
|
6
6
|
icon: i-simple-icons-github
|
|
7
|
-
to: https://github.com/nuxt/nuxt/
|
|
7
|
+
to: https://github.com/nuxt/nuxt/tree/main/packages/kit/src/module
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -56,16 +56,16 @@ export function defineNuxtModule<TOptions extends ModuleOptions> (): {
|
|
|
56
56
|
|
|
57
57
|
**definition**: A module definition object or a module function. The module definition object should contain the following properties:
|
|
58
58
|
|
|
59
|
-
| Property
|
|
60
|
-
|
|
61
|
-
| `meta`
|
|
62
|
-
| `defaults`
|
|
63
|
-
| `schema`
|
|
64
|
-
| `hooks`
|
|
65
|
-
| `moduleDependencies` | `Record<string, ModuleDependency> \| ((nuxt: Nuxt) => Record<string, ModuleDependency>)`{lang="ts"}
|
|
66
|
-
| `onInstall`
|
|
67
|
-
| `onUpgrade`
|
|
68
|
-
| `setup`
|
|
59
|
+
| Property | Type | Required | Description |
|
|
60
|
+
|----------------------|-------------------------------------------------------------------------------------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
61
|
+
| `meta` | `ModuleMeta` | `false` | Metadata of the module. It defines the module name, version, config key and compatibility. |
|
|
62
|
+
| `defaults` | `T \| ((nuxt: Nuxt) => T)`{lang="ts"} | `false` | Default options for the module. If a function is provided, it will be called with the Nuxt instance as the first argument. |
|
|
63
|
+
| `schema` | `T` | `false` | Schema for the module options. If provided, options will be applied to the schema. |
|
|
64
|
+
| `hooks` | `Partial<NuxtHooks>`{lang="ts"} | `false` | Hooks to be installed for the module. If provided, the module will install the hooks. |
|
|
65
|
+
| `moduleDependencies` | `Record<string, ModuleDependency> \| ((nuxt: Nuxt) => Record<string, ModuleDependency>)`{lang="ts"} | `false` | Dependencies on other modules with version constraints and configuration. Can be an object or a function that receives the Nuxt instance. See [example](/docs/3.x/api/kit/modules#specifying-module-dependencies). |
|
|
66
|
+
| `onInstall` | `(nuxt: Nuxt) => Awaitable<void>`{lang="ts"} | `false` | Lifecycle hook called when the module is first installed. Requires `meta.name` and `meta.version` to be defined. |
|
|
67
|
+
| `onUpgrade` | `(nuxt: Nuxt, options: T, previousVersion: string) => Awaitable<void>`{lang="ts"} | `false` | Lifecycle hook called when the module is upgraded to a newer version. Requires `meta.name` and `meta.version` to be defined. |
|
|
68
|
+
| `setup` | `(this: void, resolvedOptions: T, nuxt: Nuxt) => Awaitable<void \| false \| ModuleSetupInstallResult>`{lang="ts"} | `false` | Setup function for the module. If provided, the module will call the setup function. |
|
|
69
69
|
|
|
70
70
|
### Examples
|
|
71
71
|
|
|
@@ -103,6 +103,19 @@ export default defineNuxtConfig({
|
|
|
103
103
|
})
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
Users can also completely disable a module by setting the config key to `false`. This prevents the module's setup function from running while still generating types for module options.
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
export default defineNuxtConfig({
|
|
110
|
+
// Disable the module entirely
|
|
111
|
+
myModule: false,
|
|
112
|
+
})
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
::tip
|
|
116
|
+
This is particularly useful when you want to disable modules inherited from [Nuxt layers](/docs/3.x/guide/going-further/layers#disabling-modules-from-layers).
|
|
117
|
+
::
|
|
118
|
+
|
|
106
119
|
#### Defining Module Compatibility Requirements
|
|
107
120
|
|
|
108
121
|
If you're developing a Nuxt module and using APIs that are only supported in specific Nuxt versions, it's highly recommended to include `compatibility.nuxt`.
|
|
@@ -216,7 +229,7 @@ export default defineNuxtModule({
|
|
|
216
229
|
// - Perform initial data migration
|
|
217
230
|
},
|
|
218
231
|
|
|
219
|
-
onUpgrade (
|
|
232
|
+
onUpgrade (nuxt, options, previousVersion) {
|
|
220
233
|
// This runs when the module is upgraded to a newer version
|
|
221
234
|
console.log(`Upgrading my-awesome-module from ${previousVersion} to 1.2.0`)
|
|
222
235
|
|
|
@@ -324,7 +337,7 @@ export default defineNuxtModule({
|
|
|
324
337
|
## `installModule`
|
|
325
338
|
|
|
326
339
|
::callout{type="warning"}
|
|
327
|
-
**Deprecated:** Use the [`moduleDependencies`](#specifying-module-dependencies) option in `defineNuxtModule` instead. The `installModule` function will be removed (or may become non-blocking) in a future version.
|
|
340
|
+
**Deprecated:** Use the [`moduleDependencies`](/docs/3.x/api/kit/modules#specifying-module-dependencies) option in `defineNuxtModule` instead. The `installModule` function will be removed (or may become non-blocking) in a future version.
|
|
328
341
|
::
|
|
329
342
|
|
|
330
343
|
Install specified Nuxt module programmatically. This is helpful when your module depends on other modules. You can pass the module options as an object to `inlineOptions` and they will be passed to the module's `setup` function.
|
|
@@ -359,11 +372,11 @@ async function installModule (moduleToInstall: string | NuxtModule, inlineOption
|
|
|
359
372
|
|
|
360
373
|
### Parameters
|
|
361
374
|
|
|
362
|
-
| Property
|
|
363
|
-
|
|
364
|
-
| `moduleToInstall`
|
|
365
|
-
| `inlineOptions`
|
|
366
|
-
| `nuxt`
|
|
375
|
+
| Property | Type | Required | Description |
|
|
376
|
+
|-------------------|-----------------------------------|----------|-----------------------------------------------------------------------------------------------|
|
|
377
|
+
| `moduleToInstall` | `string \| NuxtModule`{lang="ts"} | `true` | The module to install. Can be either a string with the module name or a module object itself. |
|
|
378
|
+
| `inlineOptions` | `any` | `false` | An object with the module options to be passed to the module's `setup` function. |
|
|
379
|
+
| `nuxt` | `Nuxt` | `false` | Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call. |
|
|
367
380
|
|
|
368
381
|
### Examples
|
|
369
382
|
|