From 9a0fc577247b6c697908b371f6b7ec6d293d29ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Wed, 6 Apr 2022 07:56:08 +0200 Subject: [PATCH] docs: update sitemap (#4063) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Chopin Co-authored-by: pooya parsa --- docs/.gitignore | 2 +- docs/README.md | 4 + docs/assets/nuxt.css | 4 + docs/components/templates/AutoGenerated.vue | 8 + .../components/templates/NeedContribution.vue | 11 ++ docs/components/templates/ReadMore.vue | 30 ++++ .../1.getting-started/1.introduction.md | 95 ----------- .../{2.installation.md => 1.quick-start.md} | 39 +++-- docs/content/1.getting-started/2.migration.md | 28 ++++ docs/content/1.getting-started/3.commands.md | 73 --------- docs/content/1.getting-started/index.md | 2 +- .../1.concepts}/1.introduction.md | 4 +- .../1.concepts}/2.vuejs-development.md | 12 +- .../1.concepts}/3.rendering.md | 6 +- .../1.concepts}/4.auto-imports.md | 12 +- .../1.concepts}/4.server-engine.md | 6 +- .../1.concepts}/6.typescript.md | 6 +- docs/content/2.guide/1.concepts/index.md | 6 + docs/content/2.guide/2.features/1.views.md | 13 ++ .../2.features/10.runtime-config.md} | 2 +- .../2.features/11.teleports.md} | 0 docs/content/2.guide/2.features/13.modules.md | 10 ++ docs/content/2.guide/2.features/2.routing.md | 10 ++ docs/content/2.guide/2.features/3.assets.md | 10 ++ .../2.features/4.head-management.md} | 5 +- .../2.features/5.data-fetching.md} | 97 ++--------- .../2.features/6.state-management.md} | 18 +-- .../2.features/7.error-handling.md} | 21 ++- docs/content/2.guide/2.features/8.plugins.md | 7 + .../2.guide/2.features/9.api-routes.md | 7 + docs/content/2.guide/2.features/index.md | 6 + .../3.directory-structure}/1.nuxt.md | 0 .../3.directory-structure}/10.pages.md | 12 +- .../3.directory-structure}/11.plugins.md | 2 +- .../3.directory-structure}/12.public.md | 0 .../3.directory-structure}/13.server.md | 2 +- .../3.directory-structure}/14.gitignore.md | 0 .../3.directory-structure}/15.app.md | 6 +- .../3.directory-structure}/17.nuxtignore.md | 2 +- .../3.directory-structure/18.nuxt.config.md | 20 +++ .../3.directory-structure}/18.package.md | 0 .../3.directory-structure}/19.tsconfig.md | 2 +- .../3.directory-structure}/2.output.md | 2 +- .../3.directory-structure}/3.assets.md | 4 +- .../3.directory-structure}/4.components.md | 0 .../3.directory-structure}/5.composables.md | 2 +- .../3.directory-structure}/6.layouts.md | 4 +- .../3.directory-structure}/7.middleware.md | 2 +- .../3.directory-structure}/9.node_modules.md | 0 .../3.directory-structure}/index.md | 3 +- .../5.deployment}/1.azure.md | 0 .../5.deployment}/2.cloudflare.md | 2 +- .../5.deployment}/3.firebase.md | 0 .../5.deployment}/4.netlify.md | 4 +- .../5.deployment}/5.pm2.md | 2 +- .../5.deployment}/6.vercel.md | 2 +- .../2.guide/5.deployment/99.presets.md | 17 ++ .../5.deployment}/99.presets/custom.md | 2 +- .../5.deployment}/99.presets/lambda.md | 4 +- .../5.deployment}/99.presets/node.md | 4 +- .../5.deployment}/99.presets/server.md | 4 +- .../99.presets/service-worker.md | 6 +- .../5.deployment}/index.md | 4 +- .../6.going-further/1.internals.md} | 16 +- .../2.guide/6.going-further/2.hooks.md | 45 ++++++ .../6.going-further/3.modules.md} | 10 +- .../6.going-further/4.esm.md} | 2 +- docs/content/2.guide/6.going-further/4.kit.md | 38 +++++ .../6.going-further}/5.testing.md | 26 +-- .../6.going-further/6.nuxt-app.md} | 0 docs/content/2.guide/6.going-further/index.md | 6 + docs/content/2.guide/index.md | 6 + .../3.api/1.composables/use-async-data.md | 45 ++++++ .../1.composables/use-cookie.md} | 4 +- docs/content/3.api/1.composables/use-error.md | 7 + docs/content/3.api/1.composables/use-fetch.md | 33 ++++ docs/content/3.api/1.composables/use-head.md | 7 + .../3.api/1.composables/use-hydration.md | 7 + .../1.composables/use-lazy-async-data.md | 10 ++ .../3.api/1.composables/use-lazy-fetch.md | 10 ++ .../3.api/1.composables/use-nuxt-app.md | 4 + .../1.composables/use-request-headers.md} | 4 +- docs/content/3.api/1.composables/use-route.md | 7 + .../content/3.api/1.composables/use-router.md | 7 + docs/content/3.api/1.composables/use-state.md | 12 ++ .../content/3.api/2.components/1.nuxt-page.md | 7 + .../3.api/2.components/2.nuxt-layout.md | 7 + .../2.components/4.nuxt-link.md} | 5 +- .../2.components/5.nuxt-error-boundary.md | 7 + docs/content/3.api/2.components/index.md | 6 + docs/content/3.api/3.utils/$fetch.md | 13 ++ .../content/3.api/3.utils/abort-navigation.md | 7 + .../3.api/3.utils/add-route-middleware.md | 7 + docs/content/3.api/3.utils/clear-error.md | 7 + .../3.api/3.utils/define-nuxt-component.md | 4 + .../3.utils/define-nuxt-route-middleware.md | 7 + .../content/3.api/3.utils/define-page-meta.md | 7 + docs/content/3.api/3.utils/index.md | 6 + docs/content/3.api/3.utils/navigate-to.md | 7 + .../3.api/3.utils/refresh-nuxt-data.md | 12 ++ docs/content/3.api/3.utils/throw-error.md | 7 + docs/content/3.api/4.advanced/1.hooks.md | 27 ++++ .../3.kit.md => 3.api/4.advanced/2.kit.md} | 49 +----- docs/content/3.api/5.commands/add.md | 30 ++++ docs/content/3.api/5.commands/analyze.md | 13 ++ docs/content/3.api/5.commands/build.md | 13 ++ docs/content/3.api/5.commands/dev.md | 22 +++ docs/content/3.api/5.commands/info.md | 11 ++ docs/content/3.api/5.commands/init.md | 13 ++ docs/content/3.api/5.commands/preview.md | 17 ++ docs/content/3.api/5.commands/typecheck.md | 13 ++ docs/content/3.api/5.commands/upgrade.md | 11 ++ docs/content/3.api/index.md | 7 + docs/content/3.docs/1.usage/8.cli.md | 151 ------------------ docs/content/3.docs/1.usage/index.md | 7 - docs/content/3.docs/3.migration/index.md | 6 - .../content/3.docs/8.deployment/99.presets.md | 17 -- docs/content/3.docs/9.advanced/4.hooks.md | 63 -------- docs/content/3.docs/index.md | 6 - .../4.examples/0.essentials/hello-world.md | 3 +- .../4.examples/1.app/error-handling.md | 3 +- docs/content/4.examples/1.app/plugins.md | 3 +- docs/content/4.examples/1.app/teleport.md | 3 +- .../4.examples/2.auto-imports/components.md | 3 +- .../4.examples/2.auto-imports/composables.md | 3 +- .../3.composables/use-async-data.md | 8 +- .../4.examples/3.composables/use-cookie.md | 5 +- .../4.examples/3.composables/use-fetch.md | 8 +- .../4.examples/3.composables/use-head.md | 10 +- .../4.examples/3.composables/use-state.md | 10 +- docs/content/4.examples/4.routing/layouts.md | 3 +- .../4.examples/4.routing/middleware.md | 3 +- .../content/4.examples/4.routing/nuxt-link.md | 9 +- docs/content/4.examples/4.routing/pages.md | 3 +- .../4.examples/4.routing/universal-router.md | 3 + .../5.advanced/module-extend-pages.md | 3 +- docs/content/4.examples/5.advanced/test.md | 7 - docs/content/4.examples/5.advanced/testing.md | 14 ++ .../6.experimental/reactivity-transform.md | 3 +- docs/content/_collections/header.md | 10 +- .../4.bridge.md => bridge/1.overview.md} | 27 ++-- .../2.bridge-composition-api.md} | 15 +- docs/content/{2.concepts => bridge}/index.md | 5 +- docs/content/index.md | 14 +- .../3.migration => migration}/1.overview.md | 20 ++- .../3.migration => migration}/10.bundling.md | 7 +- .../3.migration => migration}/11.server.md | 7 +- .../2.configuration.md | 18 ++- .../20.module-authors.md | 17 +- .../3.auto-imports.md | 11 +- .../3.migration => migration}/4.meta.md | 13 +- .../5.plugins-and-middleware.md | 11 +- .../6.pages-and-layouts.md | 21 ++- .../7.component-options.md | 21 ++- .../8.runtime-config.md | 13 +- docs/content/migration/index.md | 6 + docs/package.json | 2 + docs/scripts/gen-docs.ts | 24 ++- docs/scripts/nuxt.config.md | 24 ++- docs/static/_redirects | 33 ++++ examples/advanced/{test => testing}/app.vue | 0 .../advanced/{test => testing}/nuxt.config.ts | 0 .../advanced/{test => testing}/package.json | 2 +- .../{test => testing}/tests/basic.test.ts | 0 .../advanced/{test => testing}/tsconfig.json | 0 package.json | 3 +- yarn.lock | 4 +- 167 files changed, 1173 insertions(+), 828 deletions(-) create mode 100644 docs/README.md create mode 100644 docs/components/templates/AutoGenerated.vue create mode 100644 docs/components/templates/NeedContribution.vue create mode 100644 docs/components/templates/ReadMore.vue delete mode 100644 docs/content/1.getting-started/1.introduction.md rename docs/content/1.getting-started/{2.installation.md => 1.quick-start.md} (54%) create mode 100644 docs/content/1.getting-started/2.migration.md delete mode 100644 docs/content/1.getting-started/3.commands.md rename docs/content/{2.concepts => 2.guide/1.concepts}/1.introduction.md (94%) rename docs/content/{2.concepts => 2.guide/1.concepts}/2.vuejs-development.md (89%) rename docs/content/{2.concepts => 2.guide/1.concepts}/3.rendering.md (93%) rename docs/content/{2.concepts => 2.guide/1.concepts}/4.auto-imports.md (75%) rename docs/content/{2.concepts => 2.guide/1.concepts}/4.server-engine.md (88%) rename docs/content/{2.concepts => 2.guide/1.concepts}/6.typescript.md (84%) create mode 100644 docs/content/2.guide/1.concepts/index.md create mode 100644 docs/content/2.guide/2.features/1.views.md rename docs/content/{3.docs/1.usage/5.runtime-config.md => 2.guide/2.features/10.runtime-config.md} (95%) rename docs/content/{3.docs/1.usage/10.teleports.md => 2.guide/2.features/11.teleports.md} (100%) create mode 100644 docs/content/2.guide/2.features/13.modules.md create mode 100644 docs/content/2.guide/2.features/2.routing.md create mode 100644 docs/content/2.guide/2.features/3.assets.md rename docs/content/{3.docs/1.usage/3.meta-tags.md => 2.guide/2.features/4.head-management.md} (97%) rename docs/content/{3.docs/1.usage/1.data-fetching.md => 2.guide/2.features/5.data-fetching.md} (75%) rename docs/content/{3.docs/1.usage/2.state.md => 2.guide/2.features/6.state-management.md} (81%) rename docs/content/{3.docs/1.usage/8.error-handling.md => 2.guide/2.features/7.error-handling.md} (93%) create mode 100644 docs/content/2.guide/2.features/8.plugins.md create mode 100644 docs/content/2.guide/2.features/9.api-routes.md create mode 100644 docs/content/2.guide/2.features/index.md rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/1.nuxt.md (100%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/10.pages.md (94%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/11.plugins.md (97%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/12.public.md (100%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/13.server.md (97%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/14.gitignore.md (100%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/15.app.md (61%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/17.nuxtignore.md (77%) create mode 100644 docs/content/2.guide/3.directory-structure/18.nuxt.config.md rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/18.package.md (100%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/19.tsconfig.md (63%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/2.output.md (86%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/3.assets.md (68%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/4.components.md (100%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/5.composables.md (97%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/6.layouts.md (94%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/7.middleware.md (98%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/9.node_modules.md (100%) rename docs/content/{3.docs/2.directory-structure => 2.guide/3.directory-structure}/index.md (50%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/1.azure.md (100%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/2.cloudflare.md (96%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/3.firebase.md (100%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/4.netlify.md (83%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/5.pm2.md (93%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/6.vercel.md (93%) create mode 100644 docs/content/2.guide/5.deployment/99.presets.md rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/99.presets/custom.md (95%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/99.presets/lambda.md (88%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/99.presets/node.md (88%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/99.presets/server.md (92%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/99.presets/service-worker.md (77%) rename docs/content/{3.docs/8.deployment => 2.guide/5.deployment}/index.md (58%) rename docs/content/{3.docs/9.advanced/1.nuxt.md => 2.guide/6.going-further/1.internals.md} (78%) create mode 100644 docs/content/2.guide/6.going-further/2.hooks.md rename docs/content/{3.docs/9.advanced/2.modules.md => 2.guide/6.going-further/3.modules.md} (94%) rename docs/content/{2.concepts/5.esm.md => 2.guide/6.going-further/4.esm.md} (99%) create mode 100644 docs/content/2.guide/6.going-further/4.kit.md rename docs/content/{3.docs/4.advanced => 2.guide/6.going-further}/5.testing.md (94%) rename docs/content/{3.docs/1.usage/4.nuxt-app.md => 2.guide/6.going-further/6.nuxt-app.md} (100%) create mode 100644 docs/content/2.guide/6.going-further/index.md create mode 100644 docs/content/2.guide/index.md create mode 100644 docs/content/3.api/1.composables/use-async-data.md rename docs/content/{3.docs/1.usage/6.cookies.md => 3.api/1.composables/use-cookie.md} (99%) create mode 100644 docs/content/3.api/1.composables/use-error.md create mode 100644 docs/content/3.api/1.composables/use-fetch.md create mode 100644 docs/content/3.api/1.composables/use-head.md create mode 100644 docs/content/3.api/1.composables/use-hydration.md create mode 100644 docs/content/3.api/1.composables/use-lazy-async-data.md create mode 100644 docs/content/3.api/1.composables/use-lazy-fetch.md create mode 100644 docs/content/3.api/1.composables/use-nuxt-app.md rename docs/content/{3.docs/1.usage/7.ssr.md => 3.api/1.composables/use-request-headers.md} (92%) create mode 100644 docs/content/3.api/1.composables/use-route.md create mode 100644 docs/content/3.api/1.composables/use-router.md create mode 100644 docs/content/3.api/1.composables/use-state.md create mode 100644 docs/content/3.api/2.components/1.nuxt-page.md create mode 100644 docs/content/3.api/2.components/2.nuxt-layout.md rename docs/content/{3.docs/1.usage/9.nuxt-link.md => 3.api/2.components/4.nuxt-link.md} (98%) create mode 100644 docs/content/3.api/2.components/5.nuxt-error-boundary.md create mode 100644 docs/content/3.api/2.components/index.md create mode 100644 docs/content/3.api/3.utils/$fetch.md create mode 100644 docs/content/3.api/3.utils/abort-navigation.md create mode 100644 docs/content/3.api/3.utils/add-route-middleware.md create mode 100644 docs/content/3.api/3.utils/clear-error.md create mode 100644 docs/content/3.api/3.utils/define-nuxt-component.md create mode 100644 docs/content/3.api/3.utils/define-nuxt-route-middleware.md create mode 100644 docs/content/3.api/3.utils/define-page-meta.md create mode 100644 docs/content/3.api/3.utils/index.md create mode 100644 docs/content/3.api/3.utils/navigate-to.md create mode 100644 docs/content/3.api/3.utils/refresh-nuxt-data.md create mode 100644 docs/content/3.api/3.utils/throw-error.md create mode 100644 docs/content/3.api/4.advanced/1.hooks.md rename docs/content/{3.docs/9.advanced/3.kit.md => 3.api/4.advanced/2.kit.md} (56%) create mode 100644 docs/content/3.api/5.commands/add.md create mode 100644 docs/content/3.api/5.commands/analyze.md create mode 100644 docs/content/3.api/5.commands/build.md create mode 100644 docs/content/3.api/5.commands/dev.md create mode 100644 docs/content/3.api/5.commands/info.md create mode 100644 docs/content/3.api/5.commands/init.md create mode 100644 docs/content/3.api/5.commands/preview.md create mode 100644 docs/content/3.api/5.commands/typecheck.md create mode 100644 docs/content/3.api/5.commands/upgrade.md create mode 100644 docs/content/3.api/index.md delete mode 100644 docs/content/3.docs/1.usage/8.cli.md delete mode 100644 docs/content/3.docs/1.usage/index.md delete mode 100644 docs/content/3.docs/3.migration/index.md delete mode 100644 docs/content/3.docs/8.deployment/99.presets.md delete mode 100644 docs/content/3.docs/9.advanced/4.hooks.md delete mode 100644 docs/content/3.docs/index.md delete mode 100644 docs/content/4.examples/5.advanced/test.md create mode 100644 docs/content/4.examples/5.advanced/testing.md rename docs/content/{1.getting-started/4.bridge.md => bridge/1.overview.md} (88%) rename docs/content/{1.getting-started/5.bridge-composition-api.md => bridge/2.bridge-composition-api.md} (93%) rename docs/content/{2.concepts => bridge}/index.md (55%) rename docs/content/{3.docs/3.migration => migration}/1.overview.md (85%) rename docs/content/{3.docs/3.migration => migration}/10.bundling.md (89%) rename docs/content/{3.docs/3.migration => migration}/11.server.md (84%) rename docs/content/{3.docs/3.migration => migration}/2.configuration.md (84%) rename docs/content/{3.docs/3.migration => migration}/20.module-authors.md (76%) rename docs/content/{3.docs/3.migration => migration}/3.auto-imports.md (70%) rename docs/content/{3.docs/3.migration => migration}/4.meta.md (88%) rename docs/content/{3.docs/3.migration => migration}/5.plugins-and-middleware.md (87%) rename docs/content/{3.docs/3.migration => migration}/6.pages-and-layouts.md (87%) rename docs/content/{3.docs/3.migration => migration}/7.component-options.md (82%) rename docs/content/{3.docs/3.migration => migration}/8.runtime-config.md (77%) create mode 100644 docs/content/migration/index.md create mode 100644 docs/static/_redirects rename examples/advanced/{test => testing}/app.vue (100%) rename examples/advanced/{test => testing}/nuxt.config.ts (100%) rename examples/advanced/{test => testing}/package.json (85%) rename examples/advanced/{test => testing}/tests/basic.test.ts (100%) rename examples/advanced/{test => testing}/tsconfig.json (100%) diff --git a/docs/.gitignore b/docs/.gitignore index cc46f5e6e8..b4a500fb84 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,2 +1,2 @@ schema -*.nuxt.config.md +**/*.configuration/nuxt.config.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000000..007b17fc7a --- /dev/null +++ b/docs/README.md @@ -0,0 +1,4 @@ +# Nuxt 3 Docs + +- Website: https://v3.nuxtjs.org/ +- Setup and Contribution Guide: https://v3.nuxtjs.org/community/contribution#documentation-guide diff --git a/docs/assets/nuxt.css b/docs/assets/nuxt.css index 1cb8f98642..26cbe0958d 100644 --- a/docs/assets/nuxt.css +++ b/docs/assets/nuxt.css @@ -24,3 +24,7 @@ button:focus-visible, div:focus-visible, a:focus-visible { border-radius: 2px; box-shadow: 0 0 0 2px #00DC82; } + +h1 > code, h2 > code, h3 > code, h4 > code, h5 > code, h6 > code { + font-size: inherit !important; +} diff --git a/docs/components/templates/AutoGenerated.vue b/docs/components/templates/AutoGenerated.vue new file mode 100644 index 0000000000..4eb0c5de15 --- /dev/null +++ b/docs/components/templates/AutoGenerated.vue @@ -0,0 +1,8 @@ + + + diff --git a/docs/components/templates/NeedContribution.vue b/docs/components/templates/NeedContribution.vue new file mode 100644 index 0000000000..2468444655 --- /dev/null +++ b/docs/components/templates/NeedContribution.vue @@ -0,0 +1,11 @@ + + + diff --git a/docs/components/templates/ReadMore.vue b/docs/components/templates/ReadMore.vue new file mode 100644 index 0000000000..666d5a16a0 --- /dev/null +++ b/docs/components/templates/ReadMore.vue @@ -0,0 +1,30 @@ + + + diff --git a/docs/content/1.getting-started/1.introduction.md b/docs/content/1.getting-started/1.introduction.md deleted file mode 100644 index ab2e1d8070..0000000000 --- a/docs/content/1.getting-started/1.introduction.md +++ /dev/null @@ -1,95 +0,0 @@ -# Introduction - -Getting started with Nuxt 3 is straightforward. - -::alert{type=warning icon=🚧} -Nuxt 3 is currently in beta, keep in mind that **it is not yet production-ready**.
-Thank you in advance for your understanding πŸ’› Check out the [roadmap](/community/roadmap) for more info. -:: - -## What is Nuxt? - -If this is the first time you're learning about Nuxt or you want to get more familiar with Nuxt 3, we recommend you begin by reading the [Concepts section](/concepts). - -## Prerequisites - -Before getting started, please make sure you have installed the recommended setup. - -* **Node.js*** (latest LTS version) πŸ‘‰ [[Download](https://nodejs.org/en/download/)] -* **Visual Studio Code** πŸ‘‰ [[Download](https://code.visualstudio.com/)] -* **Volar Extension** πŸ‘‰ [[Download](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)] - * Either enable [**Take Over Mode**](https://github.com/johnsoncodehk/volar/discussions/471) (recommended) - * ... or add **TypeScript Vue Plugin (Volar)** πŸ‘‰ [[Download](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.vscode-typescript-vue-plugin)] - -* If you already have Node.js installed, check with `node --version` that you are using `v14` or `v16`. - -::alert{type=info} - -If you have enabled **Take Over Mode** or installed the **TypeScript Vue Plugin (Volar)** you can disable generating the shim for `*.vue` files: - -```js -export default defineNuxtConfig({ - typescript: { - shim: false - } -}) -``` - -:: - -## Nuxt 3 or Bridge? - -Next, decide whether to start from scratch or upgrade an existing Nuxt 2 project. - -### Starting a fresh Nuxt project - -::list{type=info} - -* Enjoy using Vue 3 -* All the new composables are available -* New templating system and conventions are enabled -:: - -::alert{icon=πŸ‘‰} -Checkout the [Installation section](/getting-started/installation). -:: - -### Migrating a Nuxt 2 project - -If you have an existing Nuxt 2 project, we **strongly recommend** you begin by using Nuxt Bridge. This way you can try most new features while keeping breaking changes to a minimum. - -::list{type=info} - -* It's risk-free! You can always remove the module from your config -* Makes your project (almost) ready for Nuxt 3 -* Enjoy new DX improvements without major rewrites for Vue 3 -* Use Nitro engine for platform-agnostic and optimized deployments -* Help us stabilize Nuxt 3 and discover flaws -* Nuxt Bridge is more stable than Nuxt 3 at the moment -:: - -::alert{icon=πŸ‘‰} -Checkout the [Bridge installation section](/getting-started/bridge). -:: - -### ‍Comparison - -In the table below, there is a quick comparison between 3 versions of Nuxt: - -Feature / Version | Nuxt 2 | Nuxt Bridge | Nuxt 3 --------------------------|-----------------|------------------|--------- -Vue | 2 | 2 | 3 -Stability | 😊 Stable | 😌 Semi-stable | 😬 Unstable -Performance | 🏎 Fast | ✈️ Faster | πŸš€ Fastest -Nitro Engine | ❌ | βœ… | βœ… -ESM support | πŸŒ™ Partial | πŸ‘ Better | βœ… -TypeScript | β˜‘οΈ Opt-in | 🚧 Partial | βœ… -Composition API | ❌ | 🚧 Partial | βœ… -Options API | βœ… | βœ… | βœ… -Components Auto Import | βœ… | βœ… | βœ… -` ``` -## Isomorphic fetch +## Isomorphic `fetch` and `$fetch` When we call `fetch` in the browser, user headers like `cookie` will be directly sent to the API. But during server-side-rendering, since the `fetch` request takes place 'internally' within the server, it doesn't include the user's browser cookies, nor does it pass on cookies from the fetch response. +::ReadMore{link="/api/utils/$fetch"} +:: + ### Example: Bypass API headers to client -We can use [`useRequestHeaders`](/docs/usage/ssr) to access and proxy cookies to the API from server-side. +We can use [`useRequestHeaders`](/api/composables/use-request-headers) to access and proxy cookies to the API from server-side. The example below adds the request headers to an isomorphic `fetch` call to ensure that the API endpoint has access to the same `cookie` header originally sent by the user. diff --git a/docs/content/3.docs/1.usage/2.state.md b/docs/content/2.guide/2.features/6.state-management.md similarity index 81% rename from docs/content/3.docs/1.usage/2.state.md rename to docs/content/2.guide/2.features/6.state-management.md index e71cf5ba81..33f5e4b8fd 100644 --- a/docs/content/3.docs/1.usage/2.state.md +++ b/docs/content/2.guide/2.features/6.state-management.md @@ -1,18 +1,11 @@ -# State +# State Management Nuxt provides `useState` composable to create a reactive and SSR-friendly shared state across components. `useState` is an SSR-friendly [`ref`](https://vuejs.org/api/reactivity-core.html#ref) replacement. Its value will be preserved after server-side rendering (during client-side hydration) and shared across all components using a unique key. -## Signature - -```ts -useState(key: string, init?: () => T): Ref -``` - -* **key**: A unique key ensuring that data fetching can be properly de-duplicated across requests -* **init**: A function that provides initial value for the state when it's not initiated -* **T**: (typescript only) Specify the type of state +::ReadMore{link="/api/composables/use-state"} +:: ::alert{icon=πŸ‘‰} `useState` only works during `setup` or [`Lifecycle Hooks`](https://vuejs.org/api/composition-api-lifecycle.html#composition-api-lifecycle-hooks). @@ -54,6 +47,9 @@ const counter = useState('counter', () => Math.round(Math.random() * 1000)) :button-link[Open on StackBlitz]{href="https://stackblitz.com/github/nuxt/framework/tree/main/examples/use-state?terminal=dev" blank} +::ReadMore{link="/api/composables/use-state"} +:: + ### Advanced In this example, we use a composable that detects the user's default locale from the HTTP request headers and keeps it in a `locale` state. @@ -62,7 +58,7 @@ In this example, we use a composable that detects the user's default locale from ## Shared state -By using [auto-imported composables](/docs/directory-structure/composables) we can define global type-safe states and import them across the app. +By using [auto-imported composables](/guide/directory-structure/composables) we can define global type-safe states and import them across the app. ```ts [composables/states.ts] export const useCounter = () => useState('counter', () => 0) diff --git a/docs/content/3.docs/1.usage/8.error-handling.md b/docs/content/2.guide/2.features/7.error-handling.md similarity index 93% rename from docs/content/3.docs/1.usage/8.error-handling.md rename to docs/content/2.guide/2.features/7.error-handling.md index 81a328ca9f..a5d2d575e0 100644 --- a/docs/content/3.docs/1.usage/8.error-handling.md +++ b/docs/content/2.guide/2.features/7.error-handling.md @@ -1,4 +1,4 @@ -# Error handling +# Error Handling ## Handling errors @@ -71,24 +71,33 @@ const handleError = () => clearError({ redirect: '/' }) ## Error helper methods -### useError +### `useError` * `function useError (): Ref` This function will return the global Nuxt error that is being handled. -### throwError +::ReadMore{link="/api/composables/use-error"} +:: + +### `throwError` * `function throwError (err: string | Error): Error` You can call this function at any point on client-side, or (on server side) directly within middleware, plugins or `setup()` functions. It will trigger a full-screen error page (as above) which you can clear with `clearError`. -### clearError +::ReadMore{link="/api/composables/throw-error"} +:: + +### `clearError` * `function clearError (redirect?: string): Promise` This function will clear the currently handled Nuxt error. It also takes an optional path to redirect to (for example, if you want to navigate to a 'safe' page). +::ReadMore{link="/api/composables/clear-error"} +:: + ## Rendering errors within your app Nuxt also provides a `` component that allows you to handle client-side errors within your app, without replacing your entire site with an error page. @@ -105,9 +114,9 @@ If you navigate to another route, the error will be cleared automatically. ```vue [pages/index.vue]