@nuxt/docs-nightly 4.2.2-29404491.1c73525a → 4.2.2-29413365.2a912219
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/03.configuration.md +23 -23
- package/1.getting-started/18.upgrade.md +17 -17
- package/4.api/2.composables/use-cookie.md +15 -15
- package/4.api/2.composables/use-fetch.md +31 -31
- package/4.api/2.composables/use-lazy-fetch.md +8 -8
- package/4.api/3.utils/define-nuxt-plugin.md +10 -10
- package/4.api/3.utils/navigate-to.md +9 -9
- package/4.api/4.commands/add.md +10 -10
- 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 +11 -11
- 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 +17 -17
- 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 +9 -9
- package/4.api/4.commands/upgrade.md +10 -10
- package/4.api/5.kit/1.modules.md +15 -15
- package/4.api/5.kit/10.templates.md +23 -23
- package/4.api/5.kit/11.nitro.md +35 -35
- package/4.api/5.kit/14.builder.md +15 -15
- package/4.api/5.kit/16.layers.md +12 -12
- package/4.api/5.kit/4.autoimports.md +18 -18
- package/4.api/5.kit/5.components.md +35 -35
- package/4.api/6.advanced/1.hooks.md +84 -84
- package/5.community/6.roadmap.md +25 -25
- package/package.json +1 -1
|
@@ -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,22 +19,22 @@ 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
40
|
::read-more{to="/docs/4.x/getting-started/deployment#static-hosting"}
|
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
|
|
@@ -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/4.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,20 +19,20 @@ 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
|
|
@@ -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
|
@@ -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/4.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` | `(options: T, nuxt: Nuxt, 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
|
|
|
@@ -359,11 +359,11 @@ async function installModule (moduleToInstall: string | NuxtModule, inlineOption
|
|
|
359
359
|
|
|
360
360
|
### Parameters
|
|
361
361
|
|
|
362
|
-
| Property
|
|
363
|
-
|
|
364
|
-
| `moduleToInstall`
|
|
365
|
-
| `inlineOptions`
|
|
366
|
-
| `nuxt`
|
|
362
|
+
| Property | Type | Required | Description |
|
|
363
|
+
|-------------------|-----------------------------------|----------|-----------------------------------------------------------------------------------------------|
|
|
364
|
+
| `moduleToInstall` | `string \| NuxtModule`{lang="ts"} | `true` | The module to install. Can be either a string with the module name or a module object itself. |
|
|
365
|
+
| `inlineOptions` | `any` | `false` | An object with the module options to be passed to the module's `setup` function. |
|
|
366
|
+
| `nuxt` | `Nuxt` | `false` | Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call. |
|
|
367
367
|
|
|
368
368
|
### Examples
|
|
369
369
|
|
|
@@ -48,14 +48,14 @@ function addTemplate (template: NuxtTemplate | string): ResolvedNuxtTemplate
|
|
|
48
48
|
|
|
49
49
|
**template**: A template object or a string with the path to the template. If a string is provided, it will be converted to a template object with `src` set to the string value. If a template object is provided, it must have the following properties:
|
|
50
50
|
|
|
51
|
-
| Property
|
|
52
|
-
|
|
53
|
-
| `src`
|
|
54
|
-
| `filename`
|
|
55
|
-
| `dst`
|
|
56
|
-
| `options`
|
|
51
|
+
| Property | Type | Required | Description |
|
|
52
|
+
|---------------|-----------------------------------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
53
|
+
| `src` | `string` | `false` | Path to the template. If `src` is not provided, `getContents` must be provided instead. |
|
|
54
|
+
| `filename` | `string` | `false` | Filename of the template. If `filename` is not provided, it will be generated from the `src` path. In this case, the `src` option is required. |
|
|
55
|
+
| `dst` | `string` | `false` | Path to the destination file. If `dst` is not provided, it will be generated from the `filename` path and nuxt `buildDir` option. |
|
|
56
|
+
| `options` | `Options` | `false` | Options to pass to the template. |
|
|
57
57
|
| `getContents` | `(data: Options) => string \| Promise<string>`{lang="ts"} | `false` | A function that will be called with the `options` object. It should return a string or a promise that resolves to a string. If `src` is provided, this function will be ignored. |
|
|
58
|
-
| `write`
|
|
58
|
+
| `write` | `boolean` | `false` | If set to `true`, the template will be written to the destination file. Otherwise, the template will be used only in virtual filesystem. |
|
|
59
59
|
|
|
60
60
|
### Examples
|
|
61
61
|
|
|
@@ -133,20 +133,20 @@ function addTypeTemplate (template: NuxtTypeTemplate | string, context?: { nitro
|
|
|
133
133
|
|
|
134
134
|
**template**: A template object or a string with the path to the template. If a string is provided, it will be converted to a template object with `src` set to the string value. If a template object is provided, it must have the following properties:
|
|
135
135
|
|
|
136
|
-
| Property
|
|
137
|
-
|
|
138
|
-
| `src`
|
|
139
|
-
| `filename`
|
|
140
|
-
| `dst`
|
|
141
|
-
| `options`
|
|
136
|
+
| Property | Type | Required | Description |
|
|
137
|
+
|---------------|-----------------------------------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
138
|
+
| `src` | `string` | `false` | Path to the template. If `src` is not provided, `getContents` must be provided instead. |
|
|
139
|
+
| `filename` | `string` | `false` | Filename of the template. If `filename` is not provided, it will be generated from the `src` path. In this case, the `src` option is required. |
|
|
140
|
+
| `dst` | `string` | `false` | Path to the destination file. If `dst` is not provided, it will be generated from the `filename` path and nuxt `buildDir` option. |
|
|
141
|
+
| `options` | `Options` | `false` | Options to pass to the template. |
|
|
142
142
|
| `getContents` | `(data: Options) => string \| Promise<string>`{lang="ts"} | `false` | A function that will be called with the `options` object. It should return a string or a promise that resolves to a string. If `src` is provided, this function will be ignored. |
|
|
143
143
|
|
|
144
144
|
**context**: An optional context object can be passed to control where the type is added. If omitted, the type will only be added to the Nuxt context. This object supports the following properties:
|
|
145
145
|
|
|
146
|
-
| Property
|
|
147
|
-
|
|
148
|
-
| `nuxt`
|
|
149
|
-
| `nitro`
|
|
146
|
+
| Property | Type | Required | Description |
|
|
147
|
+
|----------|-----------|----------|----------------------------------------------------------------|
|
|
148
|
+
| `nuxt` | `boolean` | `false` | If set to `true`, the type will be added to the Nuxt context. |
|
|
149
|
+
| `nitro` | `boolean` | `false` | If set to `true`, the type will be added to the Nitro context. |
|
|
150
150
|
|
|
151
151
|
### Examples
|
|
152
152
|
|
|
@@ -226,9 +226,9 @@ function addServerTemplate (template: NuxtServerTemplate): NuxtServerTemplate
|
|
|
226
226
|
|
|
227
227
|
**template**: A template object. It must have the following properties:
|
|
228
228
|
|
|
229
|
-
| Property | Type | Required | Description
|
|
230
|
-
|
|
231
|
-
| `filename` | `string` | `true` | Filename of the template.
|
|
229
|
+
| Property | Type | Required | Description |
|
|
230
|
+
|---------------|----------------------------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------|
|
|
231
|
+
| `filename` | `string` | `true` | Filename of the template. |
|
|
232
232
|
| `getContents` | `() => string \| Promise<string>`{lang="ts"} | `true` | A function that will be called with the `options` object. It should return a string or a promise that resolves to a string. |
|
|
233
233
|
|
|
234
234
|
### Examples
|
|
@@ -304,6 +304,6 @@ async function updateTemplates (options: UpdateTemplatesOptions): void
|
|
|
304
304
|
|
|
305
305
|
**options**: Options to pass to the template. This object can have the following property:
|
|
306
306
|
|
|
307
|
-
| Property
|
|
308
|
-
|
|
309
|
-
| `filter`
|
|
307
|
+
| Property | Type | Required | Description |
|
|
308
|
+
|----------|----------------------------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
309
|
+
| `filter` | `(template: ResolvedNuxtTemplate) => boolean`{lang="ts"} | `false` | A function that will be called with the `template` object. It should return a boolean indicating whether the template should be regenerated. If `filter` is not provided, all templates will be regenerated. |
|