From c103d13e9b5a85057dde42a2d4ff6877858ba43f Mon Sep 17 00:00:00 2001 From: Bobbie Goede Date: Mon, 30 Sep 2024 13:38:01 +0200 Subject: [PATCH] feat: experimental typed routes (#3142) --- build.config.ts | 2 +- docs/content/docs/5.v9/3.options/10.misc.md | 3 + .../docs/5.v9/4.api/3.compiler-macros.md | 8 +- package.json | 1 + playground/nuxt.config.ts | 3 +- playground/pages/index.vue | 3 +- pnpm-lock.yaml | 3 + specs/experimental/typed_pages.spec.ts | 77 +++++++++++ .../typed_pages_explicit_disable.spec.ts | 35 +++++ src/constants.ts | 3 +- src/gen.ts | 88 ++++++++++++ src/module.ts | 2 +- src/pages.ts | 126 +++++++++++++++++- src/runtime/components/NuxtLinkLocale.ts | 22 ++- src/runtime/composables/index.ts | 60 +++++++-- src/runtime/shared-types.ts | 17 ++- 16 files changed, 416 insertions(+), 37 deletions(-) create mode 100644 specs/experimental/typed_pages.spec.ts create mode 100644 specs/experimental/typed_pages_explicit_disable.spec.ts diff --git a/build.config.ts b/build.config.ts index ed764f4b1..68ff1ed23 100644 --- a/build.config.ts +++ b/build.config.ts @@ -1,5 +1,5 @@ import { defineBuildConfig } from 'unbuild' export default defineBuildConfig({ - externals: ['node:fs', 'node:url', 'webpack', '@babel/parser'] + externals: ['node:fs', 'node:url', 'webpack', '@babel/parser', 'unplugin-vue-router', 'unplugin-vue-router/options'] }) diff --git a/docs/content/docs/5.v9/3.options/10.misc.md b/docs/content/docs/5.v9/3.options/10.misc.md index ae80b53bb..a5e212780 100644 --- a/docs/content/docs/5.v9/3.options/10.misc.md +++ b/docs/content/docs/5.v9/3.options/10.misc.md @@ -18,6 +18,9 @@ About how to define the locale detector, see the [`defineI18nLocaleDetector` API - `autoImportTranslationFunctions` (default: `false`) - Automatically imports/initializes `$t`, `$rt`, `$d`, `$n`, `$tm` and `$te` functions in `