From 6a5fbf2a965fffbcfa3150a160941c0ddeb994ee Mon Sep 17 00:00:00 2001 From: Bobbie Goede Date: Wed, 10 Jan 2024 21:38:29 +0100 Subject: [PATCH] refactor: integrate and replace `vue-i18n-routing` --- package.json | 3 +- pnpm-lock.yaml | 56 +-------------- specs/fixtures/basic_usage/app.vue | 2 - specs/issues/2617.spec.ts | 2 +- src/alias.ts | 4 +- src/constants.ts | 2 +- src/options.d.ts | 2 +- src/routing.ts | 2 +- src/runtime/plugins/i18n.ts | 33 ++------- src/runtime/routing/extends/i18n.ts | 8 +-- src/runtime/routing/extends/router.ts | 99 +++++++++++++++++++++++++++ src/runtime/routing/utils.ts | 2 +- src/runtime/utils.ts | 8 +-- src/types.ts | 32 ++++++--- test/pages/localize_routes.test.ts | 2 +- test/pages/utils.ts | 2 +- test/utils.test.ts | 2 +- tsconfig.json | 1 - 18 files changed, 146 insertions(+), 116 deletions(-) create mode 100644 src/runtime/routing/extends/router.ts diff --git a/package.json b/package.json index 99b50fa68..57054b8ac 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "prepack": "pnpm build", "release": "bumpp --commit \"release: v%s\" --push --tag", "changelog": "gh-changelogen --repo=nuxt-community/i18n-module", - "dev": "pnpm dev:prepare && pnpm build && nuxi dev playground", + "dev": "pnpm dev:prepare && pnpm build --sourcemap && nuxi dev playground", "dev:prepare": "nuxi prepare", "dev:build": "nuxi build playground", "dev:generate": "nuxi generate playground", @@ -96,7 +96,6 @@ "ufo": "^1.3.1", "unplugin": "^1.5.0", "vue-i18n": "^9.9.0", - "vue-i18n-routing": "^1.2.0", "vue-router": "^4.2.5" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac4476b27..a76c65861 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,9 +73,6 @@ importers: vue-i18n: specifier: ^9.9.0 version: 9.9.0(vue@3.4.7) - vue-i18n-routing: - specifier: ^1.2.0 - version: 1.2.0(vue-i18n@9.9.0)(vue-router@4.2.5)(vue@3.4.7) vue-router: specifier: ^4.2.5 version: 4.2.5(vue@3.4.7) @@ -1405,26 +1402,6 @@ packages: engines: {node: '>= 18'} dev: false - /@intlify/vue-i18n-bridge@1.1.0(vue-i18n@9.9.0): - resolution: {integrity: sha512-yBwGpr70Rc56pjsPdtvNRi/ju0P9h3670EkCOuxAzKKR5OH61uF9LprLUGmph/Uy2TXBO2DKqpnJBFXyXJQKeg==} - engines: {node: '>= 12'} - hasBin: true - requiresBuild: true - peerDependencies: - '@vue/composition-api': ^1.0.0-rc.1 - vue-i18n: ^8.26.1 || >=9.2.0 - vue-i18n-bridge: '>=9.2.0' - peerDependenciesMeta: - '@vue/composition-api': - optional: true - vue-i18n: - optional: true - vue-i18n-bridge: - optional: true - dependencies: - vue-i18n: 9.9.0(vue@3.4.7) - dev: false - /@intlify/vue-router-bridge@1.1.0(vue-router@4.2.5)(vue@3.4.7): resolution: {integrity: sha512-EX+KndT9VS3muMdZWFmc99D8nUaWTOXr322a8zNf5HnMCbpbogdifWYW8hat+nVE73St/gcDbPz6u5smVUPoQg==} engines: {node: '>= 12'} @@ -1443,6 +1420,7 @@ packages: vue-router: 4.2.5(vue@3.4.7) transitivePeerDependencies: - vue + dev: true /@ioredis/commands@1.2.0: resolution: {integrity: sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==} @@ -10625,41 +10603,11 @@ packages: optional: true dependencies: vue: 3.4.7(typescript@5.3.2) + dev: true /vue-devtools-stub@0.1.0: resolution: {integrity: sha512-RutnB7X8c5hjq39NceArgXg28WZtZpGc3+J16ljMiYnFhKvd8hITxSWQSQ5bvldxMDU6gG5mkxl1MTQLXckVSQ==} - /vue-i18n-routing@1.2.0(vue-i18n@9.9.0)(vue-router@4.2.5)(vue@3.4.7): - resolution: {integrity: sha512-pn+bIFRMX5BN1BVQJ5rn05dYVnBhU/QnkxhjEJAe9HnYtJhDubetvoY+yfgDNWwesNWfHbbvsilsgSGL6DJyeA==} - engines: {node: '>= 14.6'} - peerDependencies: - '@vue/composition-api': ^1.0.0-rc.1 - vue: ^2.6.14 || ^2.7.0 || ^3.2.0 - vue-i18n: ^8.26.1 || >=9.2.0 - vue-i18n-bridge: '>=9.2.0' - vue-router: ^3.5.3 || ^3.6.0 || ^4.0.0 - peerDependenciesMeta: - '@vue/composition-api': - optional: true - vue: - optional: true - vue-i18n: - optional: true - vue-i18n-bridge: - optional: true - vue-router: - optional: true - dependencies: - '@intlify/shared': 9.9.0 - '@intlify/vue-i18n-bridge': 1.1.0(vue-i18n@9.9.0) - '@intlify/vue-router-bridge': 1.1.0(vue-router@4.2.5)(vue@3.4.7) - ufo: 1.3.2 - vue: 3.4.7(typescript@5.3.2) - vue-demi: 0.14.6(vue@3.4.7) - vue-i18n: 9.9.0(vue@3.4.7) - vue-router: 4.2.5(vue@3.4.7) - dev: false - /vue-i18n@9.9.0(vue@3.4.7): resolution: {integrity: sha512-xQ5SxszUAqK5n84N+uUyHH/PiQl9xZ24FOxyAaNonmOQgXeN+rD9z/6DStOpOxNFQn4Cgcquot05gZc+CdOujA==} engines: {node: '>= 16'} diff --git a/specs/fixtures/basic_usage/app.vue b/specs/fixtures/basic_usage/app.vue index b3e68f671..868494c73 100644 --- a/specs/fixtures/basic_usage/app.vue +++ b/specs/fixtures/basic_usage/app.vue @@ -1,6 +1,4 @@ diff --git a/specs/issues/2617.spec.ts b/specs/issues/2617.spec.ts index f2ca69b7a..d3c0608c4 100644 --- a/specs/issues/2617.spec.ts +++ b/specs/issues/2617.spec.ts @@ -16,7 +16,7 @@ describe('#2617', async () => { consoleLogs.some( log => log.type === 'warning' && - log.text.includes('[vue-i18n-routing] Locale ISO code is required to generate alternate link') + log.text.includes('[nuxt-i18n-routing] Locale ISO code is required to generate alternate link') ) ).toBe(false) }) diff --git a/src/alias.ts b/src/alias.ts index f4100e35c..b38a7b6e6 100644 --- a/src/alias.ts +++ b/src/alias.ts @@ -4,7 +4,7 @@ import { VUE_I18N_PKG, // VUE_I18N_BRIDGE_PKG, // VUE_ROUTER_BRIDGE_PKG, - VUE_I18N_ROUTING_PKG, + // VUE_I18N_ROUTING_PKG, SHARED_PKG, MESSAGE_COMPILER_PKG, CORE_PKG, @@ -36,7 +36,7 @@ export async function setupAlias(nuxt: Nuxt, options: NuxtI18nOptions) { modules[UTILS_H3_PKG] = `${UTILS_PKG}/dist/h3.mjs` // for `@intlify/utils/h3` // modules[VUE_ROUTER_BRIDGE_PKG] = `${VUE_ROUTER_BRIDGE_PKG}/lib/index.mjs` // modules[VUE_I18N_BRIDGE_PKG] = `${VUE_I18N_BRIDGE_PKG}/lib/index.mjs` - modules[VUE_I18N_ROUTING_PKG] = `${VUE_I18N_ROUTING_PKG}/dist/vue-i18n-routing.mjs` + // modules[VUE_I18N_ROUTING_PKG] = `${VUE_I18N_ROUTING_PKG}/dist/vue-i18n-routing.mjs` modules[UFO_PKG] = UFO_PKG modules[IS_HTTPS_PKG] = IS_HTTPS_PKG diff --git a/src/constants.ts b/src/constants.ts index 965f69ee1..5d1a22f07 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -11,7 +11,7 @@ export const UTILS_PKG = '@intlify/utils' as const export const UTILS_H3_PKG = '@intlify/utils/h3' as const // export const VUE_I18N_BRIDGE_PKG = '@intlify/vue-i18n-bridge' as const // export const VUE_ROUTER_BRIDGE_PKG = '@intlify/vue-router-bridge' as const -export const VUE_I18N_ROUTING_PKG = 'vue-i18n-routing' as const +// export const VUE_I18N_ROUTING_PKG = 'vue-i18n-routing' as const export const UFO_PKG = 'ufo' as const export const IS_HTTPS_PKG = 'is-https' as const diff --git a/src/options.d.ts b/src/options.d.ts index b7ed73e90..b0fd31ea6 100644 --- a/src/options.d.ts +++ b/src/options.d.ts @@ -32,7 +32,7 @@ export const parallelPlugin: boolean export const STRATEGIES: typeof constants.STRATEGIES export const DEFAULT_LOCALE: typeof constants.DEFAULT_LOCALE -export const DEFAULT_STRATEGY: keyof typeof constants.STRATEGIES +export const DEFAULT_STRATEGY: (typeof STRATEGIES)[keyof typeof STRATEGIES] export const DEFAULT_TRAILING_SLASH: typeof constants.DEFAULT_TRAILING_SLASH export const DEFAULT_ROUTES_NAME_SEPARATOR: typeof constants.DEFAULT_ROUTES_NAME_SEPARATOR export const DEFAULT_LOCALE_ROUTE_NAME_SUFFIX: typeof constants.DEFAULT_LOCALE_ROUTE_NAME_SUFFIX diff --git a/src/routing.ts b/src/routing.ts index 5ad7d7151..3e79d54c2 100644 --- a/src/routing.ts +++ b/src/routing.ts @@ -50,7 +50,7 @@ export interface PrefixLocalizedRouteOptions { */ path: string } -function prefixLocalizedRoute( +export function prefixLocalizedRoute( localizeOptions: PrefixLocalizedRouteOptions, options: LocalizeRoutesParams, extra = false diff --git a/src/runtime/plugins/i18n.ts b/src/runtime/plugins/i18n.ts index 7c0fc543f..f073540af 100644 --- a/src/runtime/plugins/i18n.ts +++ b/src/runtime/plugins/i18n.ts @@ -1,14 +1,6 @@ import { computed } from 'vue' import { createI18n } from 'vue-i18n' -import { createLocaleFromRouteGetter, registerGlobalOptions } from 'vue-i18n-routing' -import { - defineNuxtPlugin, - useRouter, - useRoute, - addRouteMiddleware, - defineNuxtRouteMiddleware, - useNuxtApp -} from '#imports' +import { defineNuxtPlugin, useRoute, addRouteMiddleware, defineNuxtRouteMiddleware, useNuxtApp } from '#imports' import { localeCodes, vueI18nConfigs, @@ -28,8 +20,6 @@ import { navigate, injectNuxtHelpers, extendBaseUrl, - extendPrefixable, - extendSwitchLocalePathIntercepter, _setLocale } from '../utils' import { @@ -41,17 +31,16 @@ import { } from '../internal' import type { Composer, Locale, I18nOptions } from 'vue-i18n' -import type { ExtendProperyDescripters, VueI18nRoutingPluginOptions } from 'vue-i18n-routing' import type { NuxtApp } from '#app' import type { getRouteBaseName, localePath, localeRoute, switchLocalePath, localeHead } from '../routing/compatibles' import { getComposer, getLocale, setLocale } from '../routing/utils' -import { extendI18n } from '../routing/extends/i18n' +import { extendI18n, type ExtendPropertyDescriptors, type VueI18nRoutingPluginOptions } from '../routing/extends/i18n' +import { createLocaleFromRouteGetter } from '../routing/extends/router' export default defineNuxtPlugin({ name: 'i18n:plugin', parallel: parallelPlugin, async setup(nuxt) { - const router = useRouter() const route = useRoute() const { vueApp: app } = nuxt const nuxtContext = nuxt as unknown as NuxtApp @@ -91,18 +80,6 @@ export default defineNuxtPlugin({ vueI18nOptions.messages = vueI18nOptions.messages || {} vueI18nOptions.fallbackLocale = vueI18nOptions.fallbackLocale ?? false - // register nuxt/i18n options as global - // so global options is reffered by `vue-i18n-routing` - registerGlobalOptions(router, { - ...nuxtI18nOptions, - dynamicRouteParamsKey: 'nuxtI18n', - switchLocalePathIntercepter: extendSwitchLocalePathIntercepter( - nuxtI18nOptions.differentDomains, - normalizedLocales - ), - prefixable: extendPrefixable(nuxtI18nOptions.differentDomains) - }) - const getDefaultLocale = (defaultLocale: string) => defaultLocale || vueI18nOptions.locale || 'en-US' // detect initial locale @@ -265,7 +242,7 @@ export default defineNuxtPlugin({ } } }, - onExtendExportedGlobal(g: Composer): ExtendProperyDescripters { + onExtendExportedGlobal(g: Composer): ExtendPropertyDescriptors { return { strategy: { get() { @@ -332,7 +309,7 @@ export default defineNuxtPlugin({ } } }, - onExtendVueI18n(composer: Composer): ExtendProperyDescripters { + onExtendVueI18n(composer: Composer): ExtendPropertyDescriptors { return { strategy: { get() { diff --git a/src/runtime/routing/extends/i18n.ts b/src/runtime/routing/extends/i18n.ts index d6a9aa597..7883f4b10 100644 --- a/src/runtime/routing/extends/i18n.ts +++ b/src/runtime/routing/extends/i18n.ts @@ -62,12 +62,12 @@ export interface VueI18nRoutingPluginOptions { __vueI18nExtend?: VueI18nExtender } -export interface ExtendProperyDescripters { +export interface ExtendPropertyDescriptors { [key: string]: Pick } export type ExtendComposerHook = (compser: Composer) => void -export type ExtendVueI18nHook = (composer: Composer) => ExtendProperyDescripters -export type ExtendExportedGlobalHook = (global: Composer) => ExtendProperyDescripters +export type ExtendVueI18nHook = (composer: Composer) => ExtendPropertyDescriptors +export type ExtendExportedGlobalHook = (global: Composer) => ExtendPropertyDescriptors export interface ExtendHooks { onExtendComposer?: ExtendComposerHook @@ -214,7 +214,7 @@ function extendProperyDescripters( exported: any, // eslint-disable-line @typescript-eslint/no-explicit-any hook?: ExtendVueI18nHook | ExtendExportedGlobalHook ): void { - const properties: ExtendProperyDescripters[] = [ + const properties: ExtendPropertyDescriptors[] = [ { locales: { get() { diff --git a/src/runtime/routing/extends/router.ts b/src/runtime/routing/extends/router.ts new file mode 100644 index 000000000..8b7abd959 --- /dev/null +++ b/src/runtime/routing/extends/router.ts @@ -0,0 +1,99 @@ +import { isString, isObject, makeSymbol } from '@intlify/shared' +import { warn, getLocalesRegex } from '../utils' + +import type { I18nRoutingOptions } from '#build/i18n.options.mjs' +import type { RouteLocationNormalized, RouteLocationNormalizedLoaded, Router } from 'vue-router' + +/** + * Global options for i18n routing + */ +export type I18nRoutingGlobalOptions = Pick< + I18nRoutingOptions, + | 'defaultLocale' + | 'defaultDirection' + | 'defaultLocaleRouteNameSuffix' + | 'trailingSlash' + | 'routesNameSeparator' + | 'strategy' + | 'prefixable' + | 'switchLocalePathIntercepter' + | 'dynamicRouteParamsKey' +> & { localeCodes?: string[] } + +const GlobalOptionsRegistry = makeSymbol('nuxt-i18n-routing-gor') + +/** + * Register global i18n routing option registory + * + * @param router - A router instance, about router type + * @param options - A global options, about options type, see {@link I18nRoutingGlobalOptions} + */ +export function registerGlobalOptions( + router: Router, + options: I18nRoutingGlobalOptions +): void { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const _options: I18nRoutingGlobalOptions | undefined = (router as any)[GlobalOptionsRegistry] + if (_options) { + warn('already registered global options') + } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + ;(router as any)[GlobalOptionsRegistry] = options + } +} + +/** + * Get global i18n routing options + * + * @param router - A router instance, about router type + * + * @returns - {@link I18nRoutingGlobalOptions | global options} from i18n routing options registory, if registered, return it, else empty object + */ +export function getGlobalOptions(router: Router): I18nRoutingGlobalOptions { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (router as any)[GlobalOptionsRegistry] ?? {} +} + +export function createLocaleFromRouteGetter( + localeCodes: string[], + routesNameSeparator: string, + defaultLocaleRouteNameSuffix: string +) { + const localesPattern = `(${localeCodes.join('|')})` + const defaultSuffixPattern = `(?:${routesNameSeparator}${defaultLocaleRouteNameSuffix})?` + const regexpName = new RegExp(`${routesNameSeparator}${localesPattern}${defaultSuffixPattern}$`, 'i') + const regexpPath = getLocalesRegex(localeCodes) + + /** + * extract locale code from given route: + * - if route has a name, try to extract locale from it + * - otherwise, fall back to using the routes'path + */ + const getLocaleFromRoute = (route: RouteLocationNormalizedLoaded | RouteLocationNormalized | string): string => { + // extract from route name + if (isObject(route)) { + if (route.name) { + const name = isString(route.name) ? route.name : route.name.toString() + const matches = name.match(regexpName) + if (matches && matches.length > 1) { + return matches[1] + } + } else if (route.path) { + // Extract from path + const matches = route.path.match(regexpPath) + if (matches && matches.length > 1) { + return matches[1] + } + } + } else if (isString(route)) { + const matches = route.match(regexpPath) + if (matches && matches.length > 1) { + return matches[1] + } + } + + return '' + } + + return getLocaleFromRoute +} diff --git a/src/runtime/routing/utils.ts b/src/runtime/routing/utils.ts index 90ae2cce2..a4ca2680f 100644 --- a/src/runtime/routing/utils.ts +++ b/src/runtime/routing/utils.ts @@ -41,7 +41,7 @@ export const inBrowser = typeof window !== 'undefined' export function warn(msg: string, err?: Error): void { if (typeof console !== 'undefined') { - console.warn(`[vue-i18n-routing] ` + msg) + console.warn(`[nuxt-i18n-routing] ` + msg) /* istanbul ignore if */ if (err) { console.warn(err.stack) diff --git a/src/runtime/utils.ts b/src/runtime/utils.ts index aff22da87..19f83111e 100644 --- a/src/runtime/utils.ts +++ b/src/runtime/utils.ts @@ -1,5 +1,4 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { createLocaleFromRouteGetter } from 'vue-i18n-routing' import { joinURL, isEqual } from 'ufo' import { isString, isFunction, isArray, isObject } from '@intlify/shared' import { navigateTo, useNuxtApp, useRoute, useRuntimeConfig, useState } from '#imports' @@ -24,7 +23,6 @@ import { } from './internal' import { loadLocale, makeFallbackLocaleCodes } from './messages' -import type { RouteLocationNormalized, RouteLocationNormalizedLoaded } from 'vue-i18n-routing' import type { I18n, I18nOptions, Locale, FallbackLocale } from 'vue-i18n' import type { NuxtApp } from '#app' import type { @@ -52,6 +50,8 @@ import { localeHead } from './routing/compatibles' import { getComposer, getLocale, setLocale, getLocaleCodes } from './routing/utils' +import type { createLocaleFromRouteGetter } from './routing/extends/router' +import type { RouteLocationNormalized, RouteLocationNormalizedLoaded } from 'vue-router' export function _setLocale(i18n: I18n, locale: Locale) { return callVueI18nInterfaces(i18n, 'setLocale', locale) @@ -423,8 +423,8 @@ export function injectNuxtHelpers(nuxt: NuxtApp, i18n: I18n) { // override prefix for route path, support domain export function extendPrefixable(differentDomains: boolean) { - return (opts: PrefixableOptions): boolean => { - return DefaultPrefixable(opts) && !differentDomains + return (options: PrefixableOptions): boolean => { + return DefaultPrefixable(options) && !differentDomains } } diff --git a/src/types.ts b/src/types.ts index 024974446..e4d477e1c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -132,6 +132,7 @@ export type VueI18nConfig = () => Promise<{ default: I18nOptions | (() => I18nOp /* eslint-disable @typescript-eslint/no-explicit-any */ import type { RouterOptions } from 'vue-router' import type { STRATEGIES } from './constants' +import type { NuxtPage } from '@nuxt/schema' /** * Route config for vue-router v4 @@ -228,23 +229,19 @@ export type RouteOptionsResolver = (route: I18nRoute, localeCodes: string[]) => * * @public */ -export interface LocalizeRoutesPrefixableOptions { +export interface PrefixLocalizedRouteOptions { /** * Current locale */ - currentLocale: Locale + locale: Locale /** * Default locale */ - defaultLocale: Locale - /** - * Curernt strategy - */ - strategy: Strategies + defaultLocale?: Locale | undefined /** - * Whether the route to be resolved is child or not + * The parent route of the route to be resolved */ - isChild: boolean + parent: NuxtPage | undefined /** * The path of route */ @@ -256,7 +253,7 @@ export interface LocalizeRoutesPrefixableOptions { * * @public */ -export type LocalizeRoutesPrefixable = (options: LocalizeRoutesPrefixableOptions) => boolean +export type LocalizeRoutesPrefixable = (options: PrefixLocalizedRouteOptions) => boolean /** * Options to initialize a VueRouter instance @@ -445,7 +442,20 @@ export interface I18nHeadMetaInfo { /** * Route path prefix judgment options used in {@link Prefixable} */ -export type PrefixableOptions = Pick +export type PrefixableOptions = { + /** + * Current locale + */ + currentLocale: Locale + /** + * Default locale + */ + defaultLocale: Locale + /** + * Curernt strategy + */ + strategy: Strategies +} /** * Route path prefix judgment logic in {@link resolveRoute} function diff --git a/test/pages/localize_routes.test.ts b/test/pages/localize_routes.test.ts index d1aa0b616..f37c3d8d9 100644 --- a/test/pages/localize_routes.test.ts +++ b/test/pages/localize_routes.test.ts @@ -4,7 +4,7 @@ import { localizeRoutes } from '../../src/routing' import { getNuxtOptions } from './utils' import type { NuxtPage } from '@nuxt/schema' -import type { LocaleObject } from 'vue-i18n-routing' +import type { LocaleObject } from '../../src/types' const nuxtOptions = getNuxtOptions({}) nuxtOptions.locales = nuxtOptions.locales?.filter(x => (x as LocaleObject).code !== 'fr') as LocaleObject[] diff --git a/test/pages/utils.ts b/test/pages/utils.ts index e683179d9..39b5b8614 100644 --- a/test/pages/utils.ts +++ b/test/pages/utils.ts @@ -2,7 +2,7 @@ import type { NuxtI18nOptions } from '../../src/types' import type { NuxtPage } from '@nuxt/schema' import type { MarkRequired } from 'ts-essentials' -import type { LocaleObject } from 'vue-i18n-routing' +import type { LocaleObject } from '../../src/types' export function getNuxtOptions( pages: Required['pages'], diff --git a/test/utils.test.ts b/test/utils.test.ts index b2434c769..0a4246d45 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -1,5 +1,5 @@ import { parseSegment, getRoutePath, resolveLocales } from '../src/utils' -import type { LocaleObject } from 'vue-i18n-routing' +import type { LocaleObject } from '../src/types' vi.mock('pathe', async () => { const mod = await vi.importActual('pathe') diff --git a/tsconfig.json b/tsconfig.json index 86f8c7d3b..891cd6ce9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -43,7 +43,6 @@ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ "types": [ - "vue-i18n-routing/types", "vitest/globals" ] /* Specify type package names to be included without being referenced in a source file. */, // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */