@nuxt/docs 0.0.0 → 3.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/.navigation.yml +2 -0
  2. package/1.getting-started/.navigation.yml +3 -0
  3. package/1.getting-started/01.introduction.md +81 -0
  4. package/1.getting-started/02.installation.md +109 -0
  5. package/1.getting-started/03.configuration.md +226 -0
  6. package/1.getting-started/04.views.md +163 -0
  7. package/1.getting-started/05.assets.md +48 -0
  8. package/1.getting-started/06.styling.md +565 -0
  9. package/1.getting-started/07.routing.md +149 -0
  10. package/1.getting-started/08.seo-meta.md +360 -0
  11. package/1.getting-started/09.transitions.md +473 -0
  12. package/1.getting-started/10.data-fetching.md +795 -0
  13. package/1.getting-started/11.state-management.md +223 -0
  14. package/1.getting-started/12.error-handling.md +233 -0
  15. package/1.getting-started/13.server.md +94 -0
  16. package/1.getting-started/14.layers.md +92 -0
  17. package/1.getting-started/15.prerendering.md +194 -0
  18. package/1.getting-started/16.deployment.md +130 -0
  19. package/1.getting-started/17.testing.md +728 -0
  20. package/1.getting-started/18.upgrade.md +997 -0
  21. package/2.guide/.navigation.yml +2 -0
  22. package/2.guide/0.index.md +22 -0
  23. package/2.guide/1.concepts/.navigation.yml +3 -0
  24. package/2.guide/1.concepts/1.auto-imports.md +205 -0
  25. package/2.guide/1.concepts/10.nuxt-lifecycle.md +141 -0
  26. package/2.guide/1.concepts/2.vuejs-development.md +103 -0
  27. package/2.guide/1.concepts/3.rendering.md +255 -0
  28. package/2.guide/1.concepts/4.server-engine.md +62 -0
  29. package/2.guide/1.concepts/5.modules.md +48 -0
  30. package/2.guide/1.concepts/7.esm.md +299 -0
  31. package/2.guide/1.concepts/8.typescript.md +97 -0
  32. package/2.guide/1.concepts/9.code-style.md +22 -0
  33. package/2.guide/2.directory-structure/.navigation.yml +3 -0
  34. package/2.guide/2.directory-structure/0.nuxt.md +20 -0
  35. package/2.guide/2.directory-structure/0.output.md +18 -0
  36. package/2.guide/2.directory-structure/1.assets.md +16 -0
  37. package/2.guide/2.directory-structure/1.components.md +608 -0
  38. package/2.guide/2.directory-structure/1.composables.md +121 -0
  39. package/2.guide/2.directory-structure/1.content.md +64 -0
  40. package/2.guide/2.directory-structure/1.layouts.md +180 -0
  41. package/2.guide/2.directory-structure/1.middleware.md +209 -0
  42. package/2.guide/2.directory-structure/1.modules.md +66 -0
  43. package/2.guide/2.directory-structure/1.node_modules.md +12 -0
  44. package/2.guide/2.directory-structure/1.pages.md +440 -0
  45. package/2.guide/2.directory-structure/1.plugins.md +299 -0
  46. package/2.guide/2.directory-structure/1.public.md +27 -0
  47. package/2.guide/2.directory-structure/1.server.md +546 -0
  48. package/2.guide/2.directory-structure/1.shared.md +104 -0
  49. package/2.guide/2.directory-structure/1.utils.md +49 -0
  50. package/2.guide/2.directory-structure/2.env.md +75 -0
  51. package/2.guide/2.directory-structure/2.gitignore.md +37 -0
  52. package/2.guide/2.directory-structure/2.nuxtignore.md +36 -0
  53. package/2.guide/2.directory-structure/2.nuxtrc.md +50 -0
  54. package/2.guide/2.directory-structure/3.app-config.md +177 -0
  55. package/2.guide/2.directory-structure/3.app.md +72 -0
  56. package/2.guide/2.directory-structure/3.error.md +55 -0
  57. package/2.guide/2.directory-structure/3.nuxt-config.md +34 -0
  58. package/2.guide/2.directory-structure/3.package.md +32 -0
  59. package/2.guide/2.directory-structure/3.tsconfig.md +24 -0
  60. package/2.guide/3.going-further/.navigation.yml +3 -0
  61. package/2.guide/3.going-further/1.experimental-features.md +689 -0
  62. package/2.guide/3.going-further/1.features.md +103 -0
  63. package/2.guide/3.going-further/1.internals.md +81 -0
  64. package/2.guide/3.going-further/10.runtime-config.md +174 -0
  65. package/2.guide/3.going-further/11.nightly-release-channel.md +68 -0
  66. package/2.guide/3.going-further/2.hooks.md +98 -0
  67. package/2.guide/3.going-further/3.modules.md +811 -0
  68. package/2.guide/3.going-further/4.kit.md +51 -0
  69. package/2.guide/3.going-further/6.nuxt-app.md +64 -0
  70. package/2.guide/3.going-further/7.layers.md +227 -0
  71. package/2.guide/3.going-further/9.debugging.md +115 -0
  72. package/2.guide/3.going-further/index.md +4 -0
  73. package/2.guide/4.recipes/.navigation.yml +3 -0
  74. package/2.guide/4.recipes/1.custom-routing.md +181 -0
  75. package/2.guide/4.recipes/2.vite-plugin.md +65 -0
  76. package/2.guide/4.recipes/3.custom-usefetch.md +125 -0
  77. package/2.guide/4.recipes/4.sessions-and-authentication.md +203 -0
  78. package/3.api/.navigation.yml +3 -0
  79. package/3.api/1.components/.navigation.yml +3 -0
  80. package/3.api/1.components/1.client-only.md +76 -0
  81. package/3.api/1.components/1.dev-only.md +51 -0
  82. package/3.api/1.components/1.nuxt-client-fallback.md +80 -0
  83. package/3.api/1.components/10.nuxt-picture.md +27 -0
  84. package/3.api/1.components/11.teleports.md +40 -0
  85. package/3.api/1.components/12.nuxt-route-announcer.md +56 -0
  86. package/3.api/1.components/13.nuxt-time.md +173 -0
  87. package/3.api/1.components/2.nuxt-page.md +154 -0
  88. package/3.api/1.components/3.nuxt-layout.md +156 -0
  89. package/3.api/1.components/4.nuxt-link.md +322 -0
  90. package/3.api/1.components/5.nuxt-loading-indicator.md +50 -0
  91. package/3.api/1.components/6.nuxt-error-boundary.md +65 -0
  92. package/3.api/1.components/7.nuxt-welcome.md +25 -0
  93. package/3.api/1.components/8.nuxt-island.md +70 -0
  94. package/3.api/1.components/9.nuxt-img.md +43 -0
  95. package/3.api/2.composables/.navigation.yml +3 -0
  96. package/3.api/2.composables/on-prehydrate.md +60 -0
  97. package/3.api/2.composables/use-app-config.md +19 -0
  98. package/3.api/2.composables/use-async-data.md +212 -0
  99. package/3.api/2.composables/use-cookie.md +233 -0
  100. package/3.api/2.composables/use-error.md +32 -0
  101. package/3.api/2.composables/use-fetch.md +217 -0
  102. package/3.api/2.composables/use-head-safe.md +55 -0
  103. package/3.api/2.composables/use-head.md +69 -0
  104. package/3.api/2.composables/use-hydration.md +68 -0
  105. package/3.api/2.composables/use-lazy-async-data.md +47 -0
  106. package/3.api/2.composables/use-lazy-fetch.md +55 -0
  107. package/3.api/2.composables/use-loading-indicator.md +77 -0
  108. package/3.api/2.composables/use-nuxt-app.md +294 -0
  109. package/3.api/2.composables/use-nuxt-data.md +112 -0
  110. package/3.api/2.composables/use-preview-mode.md +118 -0
  111. package/3.api/2.composables/use-request-event.md +23 -0
  112. package/3.api/2.composables/use-request-fetch.md +52 -0
  113. package/3.api/2.composables/use-request-header.md +34 -0
  114. package/3.api/2.composables/use-request-headers.md +37 -0
  115. package/3.api/2.composables/use-request-url.md +41 -0
  116. package/3.api/2.composables/use-response-header.md +48 -0
  117. package/3.api/2.composables/use-route-announcer.md +60 -0
  118. package/3.api/2.composables/use-route.md +52 -0
  119. package/3.api/2.composables/use-router.md +92 -0
  120. package/3.api/2.composables/use-runtime-config.md +142 -0
  121. package/3.api/2.composables/use-runtime-hook.md +43 -0
  122. package/3.api/2.composables/use-seo-meta.md +80 -0
  123. package/3.api/2.composables/use-server-seo-meta.md +27 -0
  124. package/3.api/2.composables/use-state.md +48 -0
  125. package/3.api/3.utils/$fetch.md +98 -0
  126. package/3.api/3.utils/.navigation.yml +3 -0
  127. package/3.api/3.utils/abort-navigation.md +73 -0
  128. package/3.api/3.utils/add-route-middleware.md +88 -0
  129. package/3.api/3.utils/call-once.md +92 -0
  130. package/3.api/3.utils/clear-error.md +29 -0
  131. package/3.api/3.utils/clear-nuxt-data.md +23 -0
  132. package/3.api/3.utils/clear-nuxt-state.md +23 -0
  133. package/3.api/3.utils/create-error.md +55 -0
  134. package/3.api/3.utils/define-nuxt-component.md +53 -0
  135. package/3.api/3.utils/define-nuxt-route-middleware.md +67 -0
  136. package/3.api/3.utils/define-page-meta.md +234 -0
  137. package/3.api/3.utils/define-route-rules.md +52 -0
  138. package/3.api/3.utils/navigate-to.md +230 -0
  139. package/3.api/3.utils/on-before-route-leave.md +11 -0
  140. package/3.api/3.utils/on-before-route-update.md +11 -0
  141. package/3.api/3.utils/on-nuxt-ready.md +25 -0
  142. package/3.api/3.utils/prefetch-components.md +28 -0
  143. package/3.api/3.utils/preload-components.md +23 -0
  144. package/3.api/3.utils/preload-route-components.md +41 -0
  145. package/3.api/3.utils/prerender-routes.md +46 -0
  146. package/3.api/3.utils/refresh-cookie.md +46 -0
  147. package/3.api/3.utils/refresh-nuxt-data.md +91 -0
  148. package/3.api/3.utils/reload-nuxt-app.md +74 -0
  149. package/3.api/3.utils/set-page-layout.md +24 -0
  150. package/3.api/3.utils/set-response-status.md +36 -0
  151. package/3.api/3.utils/show-error.md +31 -0
  152. package/3.api/3.utils/update-app-config.md +27 -0
  153. package/3.api/4.commands/.navigation.yml +3 -0
  154. package/3.api/4.commands/add.md +112 -0
  155. package/3.api/4.commands/analyze.md +41 -0
  156. package/3.api/4.commands/build-module.md +42 -0
  157. package/3.api/4.commands/build.md +46 -0
  158. package/3.api/4.commands/cleanup.md +38 -0
  159. package/3.api/4.commands/dev.md +59 -0
  160. package/3.api/4.commands/devtools.md +38 -0
  161. package/3.api/4.commands/generate.md +41 -0
  162. package/3.api/4.commands/info.md +33 -0
  163. package/3.api/4.commands/init.md +46 -0
  164. package/3.api/4.commands/module.md +84 -0
  165. package/3.api/4.commands/prepare.md +36 -0
  166. package/3.api/4.commands/preview.md +43 -0
  167. package/3.api/4.commands/typecheck.md +42 -0
  168. package/3.api/4.commands/upgrade.md +37 -0
  169. package/3.api/5.kit/.navigation.yml +3 -0
  170. package/3.api/5.kit/1.modules.md +172 -0
  171. package/3.api/5.kit/10.runtime-config.md +27 -0
  172. package/3.api/5.kit/10.templates.md +283 -0
  173. package/3.api/5.kit/11.nitro.md +409 -0
  174. package/3.api/5.kit/12.resolving.md +268 -0
  175. package/3.api/5.kit/13.logging.md +65 -0
  176. package/3.api/5.kit/14.builder.md +491 -0
  177. package/3.api/5.kit/15.examples.md +41 -0
  178. package/3.api/5.kit/2.programmatic.md +125 -0
  179. package/3.api/5.kit/3.compatibility.md +230 -0
  180. package/3.api/5.kit/4.autoimports.md +144 -0
  181. package/3.api/5.kit/5.components.md +127 -0
  182. package/3.api/5.kit/6.context.md +130 -0
  183. package/3.api/5.kit/7.pages.md +295 -0
  184. package/3.api/5.kit/8.layout.md +80 -0
  185. package/3.api/5.kit/9.plugins.md +263 -0
  186. package/3.api/6.advanced/.navigation.yml +1 -0
  187. package/3.api/6.advanced/1.hooks.md +105 -0
  188. package/3.api/6.advanced/2.import-meta.md +60 -0
  189. package/3.api/6.nuxt-config.md +12 -0
  190. package/3.api/index.md +31 -0
  191. package/5.community/.navigation.yml +3 -0
  192. package/5.community/2.getting-help.md +48 -0
  193. package/5.community/3.reporting-bugs.md +50 -0
  194. package/5.community/4.contribution.md +205 -0
  195. package/5.community/5.framework-contribution.md +142 -0
  196. package/5.community/6.roadmap.md +79 -0
  197. package/5.community/7.changelog.md +92 -0
  198. package/6.bridge/.navigation.yml +3 -0
  199. package/6.bridge/1.overview.md +137 -0
  200. package/6.bridge/10.configuration.md +96 -0
  201. package/6.bridge/2.typescript.md +46 -0
  202. package/6.bridge/3.bridge-composition-api.md +132 -0
  203. package/6.bridge/4.plugins-and-middleware.md +65 -0
  204. package/6.bridge/5.nuxt3-compatible-api.md +204 -0
  205. package/6.bridge/6.meta.md +117 -0
  206. package/6.bridge/7.runtime-config.md +38 -0
  207. package/6.bridge/8.nitro.md +102 -0
  208. package/6.bridge/9.vite.md +37 -0
  209. package/7.migration/.navigation.yml +3 -0
  210. package/7.migration/1.overview.md +24 -0
  211. package/7.migration/10.bundling.md +28 -0
  212. package/7.migration/11.server.md +17 -0
  213. package/7.migration/2.configuration.md +240 -0
  214. package/7.migration/20.module-authors.md +94 -0
  215. package/7.migration/3.auto-imports.md +18 -0
  216. package/7.migration/4.meta.md +127 -0
  217. package/7.migration/5.plugins-and-middleware.md +80 -0
  218. package/7.migration/6.pages-and-layouts.md +233 -0
  219. package/7.migration/7.component-options.md +156 -0
  220. package/7.migration/8.runtime-config.md +58 -0
  221. package/LICENSE +21 -0
  222. package/README.md +11 -0
  223. package/package.json +16 -4
  224. package/dist/.gitkeep +0 -0
@@ -0,0 +1,59 @@
1
+ ---
2
+ title: 'nuxi dev'
3
+ description: The dev command starts a development server with hot module replacement at http://localhost:3000
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/dev.ts
8
+ size: xs
9
+ ---
10
+
11
+ <!--dev-cmd-->
12
+ ```bash [Terminal]
13
+ npx nuxi dev [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [--envName] [--no-clear] [--no-fork] [-p, --port] [-h, --host] [--clipboard] [-o, --open] [--https] [--publicURL] [--qr] [--public] [--tunnel] [--sslCert] [--sslKey]
14
+ ```
15
+ <!--/dev-cmd-->
16
+
17
+ The `dev` command starts a development server with hot module replacement at [http://localhost:3000](https://localhost:3000)
18
+
19
+ ## Arguments
20
+
21
+ <!--dev-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `ROOTDIR="."` | Specifies the working directory (default: `.`)
25
+ <!--/dev-args-->
26
+
27
+ ## Options
28
+
29
+ <!--dev-opts-->
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
+ `--no-clear` | | Disable clear console on restart
37
+ `--no-fork` | | Disable forked mode
38
+ `-p, --port` | | Port to listen on (default: `NUXT_PORT \|\| NITRO_PORT \|\| PORT \|\| nuxtOptions.devServer.port`)
39
+ `-h, --host` | | Host to listen on (default: `NUXT_HOST \|\| NITRO_HOST \|\| HOST \|\| nuxtOptions._layers?.[0]?.devServer?.host`)
40
+ `--clipboard` | `false` | Copy the URL to the clipboard
41
+ `-o, --open` | `false` | Open the URL in the browser
42
+ `--https` | | Enable HTTPS
43
+ `--publicURL` | | Displayed public URL (used for QR code)
44
+ `--qr` | | Display The QR code of public URL when available
45
+ `--public` | | Listen to all network interfaces
46
+ `--tunnel` | | Open a tunnel using https://github.com/unjs/untun
47
+ `--sslCert` | | (DEPRECATED) Use `--https.cert` instead.
48
+ `--sslKey` | | (DEPRECATED) Use `--https.key` instead.
49
+ <!--/dev-opts-->
50
+
51
+ The port and host can also be set via NUXT_PORT, PORT, NUXT_HOST or HOST environment variables.
52
+
53
+ Additionally to the above options, `nuxi` can pass options through to `listhen`, e.g. `--no-qr` to turn off the dev server QR code. You can find the list of `listhen` options in the [unjs/listhen](https://github.com/unjs/listhen) docs.
54
+
55
+ This command sets `process.env.NODE_ENV` to `development`.
56
+
57
+ ::note
58
+ If you are using a self-signed certificate in development, you will need to set `NODE_TLS_REJECT_UNAUTHORIZED=0` in your environment.
59
+ ::
@@ -0,0 +1,38 @@
1
+ ---
2
+ title: "nuxi devtools"
3
+ description: The devtools command allows you to enable or disable Nuxt DevTools on a per-project basis.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/devtools.ts
8
+ size: xs
9
+ ---
10
+
11
+ <!--devtools-cmd-->
12
+ ```bash [Terminal]
13
+ npx nuxi devtools <COMMAND> [ROOTDIR] [--cwd=<directory>]
14
+ ```
15
+ <!--/devtools-cmd-->
16
+
17
+ Running `nuxi devtools enable` will install the Nuxt DevTools globally, and also enable it within the particular project you are using. It is saved as a preference in your user-level `.nuxtrc`. If you want to remove devtools support for a particular project, you can run `nuxi devtools disable`.
18
+
19
+ ## Arguments
20
+
21
+ <!--devtools-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `COMMAND` | Command to run (options: <enable\|disable>)
25
+ `ROOTDIR="."` | Specifies the working directory (default: `.`)
26
+ <!--/devtools-args-->
27
+
28
+ ## Options
29
+
30
+ <!--devtools-opts-->
31
+ Option | Default | Description
32
+ --- | --- | ---
33
+ `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`)
34
+ <!--/devtools-opts-->
35
+
36
+ ::read-more{icon="i-simple-icons-nuxtdotjs" to="https://devtools.nuxt.com" target="\_blank"}
37
+ Read more about the **Nuxt DevTools**.
38
+ ::
@@ -0,0 +1,41 @@
1
+ ---
2
+ title: "nuxi generate"
3
+ description: Pre-renders every route of the application and stores the result in plain HTML files.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/generate.ts
8
+ size: xs
9
+ ---
10
+
11
+ <!--generate-cmd-->
12
+ ```bash [Terminal]
13
+ npx nuxi generate [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--preset] [--dotenv] [--envName]
14
+ ```
15
+ <!--/generate-cmd-->
16
+
17
+ The `generate` command pre-renders every route of your application and stores the result in plain HTML files that you can deploy on any static hosting services. The command triggers the `nuxi build` command with the `prerender` argument set to `true`
18
+
19
+ ## Arguments
20
+
21
+ <!--generate-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `ROOTDIR="."` | Specifies the working directory (default: `.`)
25
+ <!--/generate-args-->
26
+
27
+ ## Options
28
+
29
+ <!--generate-opts-->
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
+ <!--/generate-opts-->
38
+
39
+ ::read-more{to="/docs/getting-started/deployment#static-hosting"}
40
+ Read more about pre-rendering and static hosting.
41
+ ::
@@ -0,0 +1,33 @@
1
+ ---
2
+ title: "nuxi info"
3
+ description: The info command logs information about the current or specified Nuxt project.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/info.ts
8
+ size: xs
9
+ ---
10
+
11
+ <!--info-cmd-->
12
+ ```bash [Terminal]
13
+ npx nuxi info [ROOTDIR] [--cwd=<directory>]
14
+ ```
15
+ <!--/info-cmd-->
16
+
17
+ The `info` command logs information about the current or specified Nuxt project.
18
+
19
+ ## Arguments
20
+
21
+ <!--info-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `ROOTDIR="."` | Specifies the working directory (default: `.`)
25
+ <!--/info-args-->
26
+
27
+ ## Options
28
+
29
+ <!--info-opts-->
30
+ Option | Default | Description
31
+ --- | --- | ---
32
+ `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`)
33
+ <!--/info-opts-->
@@ -0,0 +1,46 @@
1
+ ---
2
+ title: "nuxi init"
3
+ description: The init command initializes a fresh Nuxt project.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/init.ts
8
+ size: xs
9
+ ---
10
+
11
+ <!--init-cmd-->
12
+ ```bash [Terminal]
13
+ npx nuxi init [DIR] [--cwd=<directory>] [-t, --template] [-f, --force] [--offline] [--preferOffline] [--no-install] [--gitInit] [--shell] [--packageManager]
14
+ ```
15
+ <!--/init-cmd-->
16
+
17
+ The `init` command initializes a fresh Nuxt project using [unjs/giget](https://github.com/unjs/giget).
18
+
19
+ ## Arguments
20
+
21
+ <!--init-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `DIR=""` | Project directory
25
+ <!--/init-args-->
26
+
27
+ ## Options
28
+
29
+ <!--init-opts-->
30
+ Option | Default | Description
31
+ --- | --- | ---
32
+ `--cwd=<directory>` | `.` | Specify the working directory
33
+ `-t, --template` | | Template name
34
+ `-f, --force` | | Override existing directory
35
+ `--offline` | | Force offline mode
36
+ `--preferOffline` | | Prefer offline mode
37
+ `--no-install` | | Skip installing dependencies
38
+ `--gitInit` | | Initialize git repository
39
+ `--shell` | | Start shell after installation in project directory
40
+ `--packageManager` | | Package manager choice (npm, pnpm, yarn, bun)
41
+ <!--/init-opts-->
42
+
43
+ ## Environment variables
44
+
45
+ - `NUXI_INIT_REGISTRY`: Set to a custom template registry. ([learn more](https://github.com/unjs/giget#custom-registry)).
46
+ - Default registry is loaded from [nuxt/starter/templates](https://github.com/nuxt/starter/tree/templates/templates)
@@ -0,0 +1,84 @@
1
+ ---
2
+ title: "nuxi module"
3
+ description: "Search and add modules to your Nuxt application with the command line."
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/module/
8
+ size: xs
9
+ ---
10
+
11
+ Nuxi provides a few utilities to work with [Nuxt modules](/modules) seamlessly.
12
+
13
+ ## nuxi module add
14
+
15
+ <!--module-add-cmd-->
16
+ ```bash [Terminal]
17
+ npx nuxi module add <MODULENAME> [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--skipInstall] [--skipConfig] [--dev]
18
+ ```
19
+ <!--/module-add-cmd-->
20
+
21
+ <!--module-add-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `MODULENAME` | Module name
25
+ <!--/module-add-args-->
26
+
27
+ <!--module-add-opts-->
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 module as dev dependency
35
+ <!--/module-add-opts-->
36
+
37
+ The command lets you install [Nuxt modules](/modules) in your application with no manual work.
38
+
39
+ When running the command, it will:
40
+
41
+ - install the module as a dependency using your package manager
42
+ - add it to your [package.json](/docs/guide/directory-structure/package) file
43
+ - update your [`nuxt.config`](/docs/guide/directory-structure/nuxt-config) file
44
+
45
+ **Example:**
46
+
47
+ Installing the [`Pinia`](/modules/pinia) module
48
+
49
+ ```bash [Terminal]
50
+ npx nuxi module add pinia
51
+ ```
52
+
53
+ ## nuxi module search
54
+
55
+ <!--module-search-cmd-->
56
+ ```bash [Terminal]
57
+ npx nuxi module search <QUERY> [--cwd=<directory>] [--nuxtVersion=<2|3>]
58
+ ```
59
+ <!--/module-search-cmd-->
60
+
61
+ ### Arguments
62
+
63
+ <!--module-search-args-->
64
+ Argument | Description
65
+ --- | ---
66
+ `QUERY` | keywords to search for
67
+ <!--/module-search-args-->
68
+
69
+ ### Options
70
+
71
+ <!--module-search-opts-->
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
+ <!--/module-search-opts-->
77
+
78
+ The command searches for Nuxt modules matching your query that are compatible with your Nuxt version.
79
+
80
+ **Example:**
81
+
82
+ ```bash [Terminal]
83
+ npx nuxi module search pinia
84
+ ```
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: 'nuxi prepare'
3
+ description: The prepare command creates a .nuxt directory in your application and generates types.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/prepare.ts
8
+ size: xs
9
+ ---
10
+
11
+ <!--prepare-cmd-->
12
+ ```bash [Terminal]
13
+ npx nuxi prepare [ROOTDIR] [--dotenv] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--envName]
14
+ ```
15
+ <!--/prepare-cmd-->
16
+
17
+ The `prepare` command creates a [`.nuxt`](/docs/guide/directory-structure/nuxt) directory in your application and generates types. This can be useful in a CI environment or as a `postinstall` command in your [`package.json`](/docs/guide/directory-structure/package).
18
+
19
+ ## Arguments
20
+
21
+ <!--prepare-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `ROOTDIR="."` | Specifies the working directory (default: `.`)
25
+ <!--/prepare-args-->
26
+
27
+ ## Options
28
+
29
+ <!--prepare-opts-->
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
+ <!--/prepare-opts-->
@@ -0,0 +1,43 @@
1
+ ---
2
+ title: "nuxi preview"
3
+ description: The preview command starts a server to preview your application after the build command.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/preview.ts
8
+ size: xs
9
+ ---
10
+
11
+ <!--preview-cmd-->
12
+ ```bash [Terminal]
13
+ npx nuxi preview [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--envName] [--dotenv] [-p, --port]
14
+ ```
15
+ <!--/preview-cmd-->
16
+
17
+ The `preview` command starts a server to preview your Nuxt application after running the `build` command. The `start` command is an alias for `preview`. When running your application in production refer to the [Deployment section](/docs/getting-started/deployment).
18
+
19
+ ## Arguments
20
+
21
+ <!--preview-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `ROOTDIR="."` | Specifies the working directory (default: `.`)
25
+ <!--/preview-args-->
26
+
27
+ ## Options
28
+
29
+ <!--preview-opts-->
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
+ `--dotenv` | | Path to `.env` file to load, relative to the root directory
36
+ `-p, --port` | | Port to listen on (default: `NUXT_PORT \|\| NITRO_PORT \|\| PORT`)
37
+ <!--/preview-opts-->
38
+
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
+
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.)
43
+ ::
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: "nuxi typecheck"
3
+ description: The typecheck command runs vue-tsc to check types throughout your app.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/typecheck.ts
8
+ size: xs
9
+ ---
10
+
11
+ <!--typecheck-cmd-->
12
+ ```bash [Terminal]
13
+ npx nuxi typecheck [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>]
14
+ ```
15
+ <!--/typecheck-cmd-->
16
+
17
+ The `typecheck` command runs [`vue-tsc`](https://github.com/vuejs/language-tools/tree/master/packages/tsc) to check types throughout your app.
18
+
19
+ ## Arguments
20
+
21
+ <!--typecheck-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `ROOTDIR="."` | Specifies the working directory (default: `.`)
25
+ <!--/typecheck-args-->
26
+
27
+ ## Options
28
+
29
+ <!--typecheck-opts-->
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
+ <!--/typecheck-opts-->
35
+
36
+ ::note
37
+ This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a [`.env`](/docs/guide/directory-structure/env) file or as a command-line argument.
38
+ ::
39
+
40
+ ::read-more{to="/docs/guide/concepts/typescript#type-checking"}
41
+ Read more on how to enable type-checking at build or development time.
42
+ ::
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: "nuxi upgrade"
3
+ description: The upgrade command upgrades Nuxt to the latest version.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/upgrade.ts
8
+ size: xs
9
+ ---
10
+
11
+ <!--upgrade-cmd-->
12
+ ```bash [Terminal]
13
+ npx nuxi upgrade [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dedupe] [-f, --force] [-ch, --channel=<stable|nightly>]
14
+ ```
15
+ <!--/upgrade-cmd-->
16
+
17
+ The `upgrade` command upgrades Nuxt to the latest version.
18
+
19
+ ## Arguments
20
+
21
+ <!--upgrade-args-->
22
+ Argument | Description
23
+ --- | ---
24
+ `ROOTDIR="."` | Specifies the working directory (default: `.`)
25
+ <!--/upgrade-args-->
26
+
27
+ ## Options
28
+
29
+ <!--upgrade-opts-->
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` | | Will deduplicate dependencies but not recreate the lockfile
35
+ `-f, --force` | | Force upgrade to recreate lockfile and node_modules
36
+ `-ch, --channel=<stable\|nightly>` | `stable` | Specify a channel to install from (default: stable)
37
+ <!--/upgrade-opts-->
@@ -0,0 +1,3 @@
1
+ title: Nuxt Kit
2
+ titleTemplate: '%s · Nuxt Kit'
3
+ navigation.icon: i-lucide-package
@@ -0,0 +1,172 @@
1
+ ---
2
+ title: "Modules"
3
+ description: Nuxt Kit provides a set of utilities to help you create and use modules. You can use these utilities to create your own modules or to reuse existing modules.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/nuxt/blob/main/packages/kit/src/module
8
+ size: xs
9
+ ---
10
+
11
+ Modules are the building blocks of Nuxt. Kit provides a set of utilities to help you create and use modules. You can use these utilities to create your own modules or to reuse existing modules. For example, you can use the `defineNuxtModule` function to define a module and the `installModule` function to install a module programmatically.
12
+
13
+ ## `defineNuxtModule`
14
+
15
+ Define a Nuxt module, automatically merging defaults with user provided options, installing any hooks that are provided, and calling an optional setup function for full control.
16
+
17
+ ### Type
18
+
19
+ ```ts
20
+ function defineNuxtModule<OptionsT extends ModuleOptions> (definition: ModuleDefinition<OptionsT> | NuxtModule<OptionsT>): NuxtModule<OptionsT>
21
+
22
+ type ModuleOptions = Record<string, any>
23
+
24
+ interface ModuleDefinition<T extends ModuleOptions = ModuleOptions> {
25
+ meta?: ModuleMeta
26
+ defaults?: T | ((nuxt: Nuxt) => T)
27
+ schema?: T
28
+ hooks?: Partial<NuxtHooks>
29
+ setup?: (this: void, resolvedOptions: T, nuxt: Nuxt) => Awaitable<void | false | ModuleSetupReturn>
30
+ }
31
+
32
+ interface NuxtModule<T extends ModuleOptions = ModuleOptions> {
33
+ (this: void, inlineOptions: T, nuxt: Nuxt): Awaitable<void | false | ModuleSetupReturn>
34
+ getOptions?: (inlineOptions?: T, nuxt?: Nuxt) => Promise<T>
35
+ getMeta?: () => Promise<ModuleMeta>
36
+ }
37
+
38
+ interface ModuleSetupReturn {
39
+ timings?: {
40
+ setup?: number
41
+ [key: string]: number | undefined
42
+ }
43
+ }
44
+
45
+ interface ModuleMeta {
46
+ name?: string
47
+ version?: string
48
+ configKey?: string
49
+ compatibility?: NuxtCompatibility
50
+ [key: string]: unknown
51
+ }
52
+ ```
53
+
54
+ ### Parameters
55
+
56
+ #### `definition`
57
+
58
+ **Type**: `ModuleDefinition<T> | NuxtModule<T>`
59
+
60
+ **Required**: `true`
61
+
62
+ A module definition object or a module function.
63
+
64
+ - `meta` (optional)
65
+
66
+ **Type**: `ModuleMeta`
67
+
68
+ Metadata of the module. It defines the module name, version, config key and compatibility.
69
+
70
+ - `defaults` (optional)
71
+
72
+ **Type**: `T | ((nuxt: Nuxt) => T)`
73
+
74
+ Default options for the module. If a function is provided, it will be called with the Nuxt instance as the first argument.
75
+
76
+ - `schema` (optional)
77
+
78
+ **Type**: `T`
79
+
80
+ Schema for the module options. If provided, options will be applied to the schema.
81
+
82
+ - `hooks` (optional)
83
+
84
+ **Type**: `Partial<NuxtHooks>`
85
+
86
+ Hooks to be installed for the module. If provided, the module will install the hooks.
87
+
88
+ - `setup` (optional)
89
+
90
+ **Type**: `(this: void, resolvedOptions: T, nuxt: Nuxt) => Awaitable<void | false | ModuleSetupReturn>`
91
+
92
+ Setup function for the module. If provided, the module will call the setup function.
93
+
94
+ ### Examples
95
+
96
+ ```ts
97
+ // https://github.com/nuxt/starter/tree/module
98
+ import { defineNuxtModule } from '@nuxt/kit'
99
+
100
+ export default defineNuxtModule({
101
+ meta: {
102
+ name: 'my-module',
103
+ configKey: 'myModule'
104
+ },
105
+ defaults: {
106
+ test: 123
107
+ },
108
+ setup (options, nuxt) {
109
+ nuxt.hook('modules:done', () => {
110
+ console.log('My module is ready with current test option: ', options.test)
111
+ })
112
+ }
113
+ })
114
+ ```
115
+
116
+ ## `installModule`
117
+
118
+ 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.
119
+
120
+ ### Type
121
+
122
+ ```ts
123
+ async function installModule (moduleToInstall: string | NuxtModule, inlineOptions?: any, nuxt?: Nuxt)
124
+ ```
125
+
126
+ ### Parameters
127
+
128
+ #### `moduleToInstall`
129
+
130
+ **Type**: `string` | `NuxtModule`
131
+
132
+ **Required**: `true`
133
+
134
+ The module to install. Can be either a string with the module name or a module object itself.
135
+
136
+ #### `inlineOptions`
137
+
138
+ **Type**: `any`
139
+
140
+ **Default**: `{}`
141
+
142
+ An object with the module options to be passed to the module's `setup` function.
143
+
144
+ #### `nuxt`
145
+
146
+ **Type**: `Nuxt`
147
+
148
+ **Default**: `useNuxt()`
149
+
150
+ Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call.
151
+
152
+ ### Examples
153
+
154
+ ```ts
155
+ import { defineNuxtModule, installModule } from '@nuxt/kit'
156
+
157
+ export default defineNuxtModule({
158
+ async setup (options, nuxt) {
159
+ // will install @nuxtjs/fontaine with Roboto font and Impact fallback
160
+ await installModule('@nuxtjs/fontaine', {
161
+ // module configuration
162
+ fonts: [
163
+ {
164
+ family: 'Roboto',
165
+ fallbacks: ['Impact'],
166
+ fallbackName: 'fallback-a',
167
+ }
168
+ ]
169
+ })
170
+ }
171
+ })
172
+ ```
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: Runtime Config
3
+ description: Nuxt Kit provides a set of utilities to help you access and modify Nuxt runtime configuration.
4
+ links:
5
+ - label: Source
6
+ icon: i-simple-icons-github
7
+ to: https://github.com/nuxt/nuxt/blob/main/packages/kit/src/runtime-config.ts
8
+ size: xs
9
+ ---
10
+
11
+ ## `useRuntimeConfig`
12
+
13
+ At build-time, it is possible to access the resolved Nuxt [runtime config](/docs/guide/going-further/runtime-config).
14
+
15
+ ### Type
16
+
17
+ ```ts
18
+ function useRuntimeConfig (): Record<string, unknown>
19
+ ```
20
+
21
+ ## `updateRuntimeConfig`
22
+
23
+ It is also possible to update runtime configuration. This will be merged with the existing runtime configuration, and if Nitro has already been initialized it will trigger an HMR event to reload the Nitro runtime config.
24
+
25
+ ```ts
26
+ function updateRuntimeConfig (config: Record<string, unknown>): void | Promise<void>
27
+ ```