"release": "node scripts/release.mjs",
"size": "node scripts/check-size.mjs",
"build": "pnpm run -r build",
- "build:dts": "pnpm run -r build:dts",
"docs": "pnpm run --filter ./packages/docs -r docs",
"docs:api": "pnpm run --filter ./packages/docs -r docs:api",
"docs:translation:compare": "pnpm run --filter ./packages/docs -r docs:translation:compare",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
"build": "tsdown",
"build:old": "rimraf dist && rollup -c rollup.config.mjs",
- "build:dts": "tail -n +10 src/globalExtensions.ts >> dist/vue-router.d.mts",
"build:playground": "vue-tsc --noEmit && vite build --config playground/vite.config.ts",
"build:e2e": "vue-tsc --noEmit && vite build --config e2e/vite.config.mjs",
"build:size": "pnpm run build && rollup -c size-checks/rollup.config.mjs",
"dev:e2e": "vite --config e2e/vite.config.mjs",
"test:types": "tsc --build tsconfig.json",
"test:unit": "vitest --coverage run",
- "test": "pnpm run build && pnpm run build:dts && pnpm run test:types && pnpm run test:unit && pnpm run test:e2e",
+ "test": "pnpm run build && pnpm run test:types && pnpm run test:unit && pnpm run test:e2e",
"test:e2e": "pnpm run test:e2e:headless",
"test:e2e:headless": "node e2e/runner.mjs --env chrome-headless",
"test:e2e:native": "node e2e/runner.mjs --env chrome",
+++ /dev/null
-import type {
- NavigationGuardWithThis,
- NavigationGuard,
- RouteLocationNormalizedLoaded,
-} from './typed-routes'
-import type { RouterView } from './RouterView'
-import type { RouterLink } from './RouterLink'
-import type { Router } from './router'
-import type { TypesConfig } from './config'
-
-/**
- * NOTE: this used to be `@vue/runtime-core` but it should have been `vue` for a long time. Using both declaration at
- * the same time breaks so using only one everywhere is the preferred way.
- */
-declare module 'vue' {
- export interface ComponentCustomOptions {
- /**
- * Guard called when the router is navigating to the route that is rendering
- * this component from a different route. Differently from `beforeRouteUpdate`
- * and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
- * component instance through `this` because it triggers before the component
- * is even mounted.
- *
- * @param to - RouteLocationRaw we are navigating to
- * @param from - RouteLocationRaw we are navigating from
- * @param next - function to validate, cancel or modify (by redirecting) the
- * navigation
- */
- beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T>
- ? T
- : NavigationGuardWithThis<undefined>
-
- /**
- * Guard called whenever the route that renders this component has changed, but
- * it is reused for the new route. This allows you to guard for changes in
- * params, the query or the hash.
- *
- * @param to - RouteLocationRaw we are navigating to
- * @param from - RouteLocationRaw we are navigating from
- * @param next - function to validate, cancel or modify (by redirecting) the
- * navigation
- */
- beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T>
- ? T
- : NavigationGuard
-
- /**
- * Guard called when the router is navigating away from the current route that
- * is rendering this component.
- *
- * @param to - RouteLocationRaw we are navigating to
- * @param from - RouteLocationRaw we are navigating from
- * @param next - function to validate, cancel or modify (by redirecting) the
- * navigation
- */
- beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T>
- ? T
- : NavigationGuard
- }
-
- export interface ComponentCustomProperties {
- /**
- * Normalized current location. See {@link RouteLocationNormalizedLoaded}.
- */
- $route: TypesConfig extends Record<'$route', infer T>
- ? T
- : RouteLocationNormalizedLoaded
- /**
- * {@link Router} instance used by the application.
- */
- $router: TypesConfig extends Record<'$router', infer T> ? T : Router
- }
-
- export interface GlobalComponents {
- RouterView: TypesConfig extends Record<'RouterView', infer T>
- ? T
- : typeof RouterView
- RouterLink: TypesConfig extends Record<'RouterLink', infer T>
- ? T
- : typeof RouterLink
- }
-}
+/**
+ * The official Router for Vue 3.
+ *
+ * @packageDocumentation
+ */
+
export { createWebHistory } from './history/html5'
export { createMemoryHistory } from './history/memory'
export { createWebHashHistory } from './history/hash'
export * from './useApi'
-export * from './globalExtensions'
+// Global extensions for Vue
+import type { TypesConfig } from './config'
+import type { Router } from './router'
+import type { RouterLink } from './RouterLink'
+import type { RouterView } from './RouterView'
+import type {
+ NavigationGuard,
+ NavigationGuardWithThis,
+ RouteLocationNormalizedLoaded,
+} from './typed-routes'
-/**
- * The official Router for Vue 3.
- *
- * @packageDocumentation
- */
+declare module 'vue' {
+ export interface ComponentCustomOptions {
+ /**
+ * Guard called when the router is navigating to the route that is rendering
+ * this component from a different route. Differently from `beforeRouteUpdate`
+ * and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
+ * component instance through `this` because it triggers before the component
+ * is even mounted.
+ *
+ * @param to - RouteLocationRaw we are navigating to
+ * @param from - RouteLocationRaw we are navigating from
+ * @param next - function to validate, cancel or modify (by redirecting) the
+ * navigation
+ */
+ beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T>
+ ? T
+ : NavigationGuardWithThis<undefined>
+
+ /**
+ * Guard called whenever the route that renders this component has changed, but
+ * it is reused for the new route. This allows you to guard for changes in
+ * params, the query or the hash.
+ *
+ * @param to - RouteLocationRaw we are navigating to
+ * @param from - RouteLocationRaw we are navigating from
+ * @param next - function to validate, cancel or modify (by redirecting) the
+ * navigation
+ */
+ beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T>
+ ? T
+ : NavigationGuard
+
+ /**
+ * Guard called when the router is navigating away from the current route that
+ * is rendering this component.
+ *
+ * @param to - RouteLocationRaw we are navigating to
+ * @param from - RouteLocationRaw we are navigating from
+ * @param next - function to validate, cancel or modify (by redirecting) the
+ * navigation
+ */
+ beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T>
+ ? T
+ : NavigationGuard
+ }
+
+ export interface ComponentCustomProperties {
+ /**
+ * Normalized current location. See {@link RouteLocationNormalizedLoaded}.
+ */
+ $route: TypesConfig extends Record<'$route', infer T>
+ ? T
+ : RouteLocationNormalizedLoaded
+ /**
+ * {@link Router} instance used by the application.
+ */
+ $router: TypesConfig extends Record<'$router', infer T> ? T : Router
+ }
+
+ export interface GlobalComponents {
+ RouterView: TypesConfig extends Record<'RouterView', infer T>
+ ? T
+ : typeof RouterView
+ RouterLink: TypesConfig extends Record<'RouterLink', infer T>
+ ? T
+ : typeof RouterLink
+ }
+}
step('\nBuilding all packages...')
if (!skipBuild && !isDryRun) {
await run('pnpm', ['run', 'build'])
- await run('pnpm', ['run', 'build:dts'])
} else {
console.log(`(skipped)`)
}