From f2f95eaf34723970578b3c4ced7004a13e06ed1b Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 18 Sep 2025 17:24:18 +0200 Subject: [PATCH] chore: remove the need for tail improve build compat for non unix --- CLAUDE.md | Bin 4170 -> 4121 bytes package.json | 1 - packages/router/package.json | 3 +- packages/router/src/globalExtensions.ts | 82 --------------------- packages/router/src/index.ts | 90 ++++++++++++++++++++++-- scripts/release.mjs | 1 - 6 files changed, 85 insertions(+), 92 deletions(-) delete mode 100644 packages/router/src/globalExtensions.ts diff --git a/CLAUDE.md b/CLAUDE.md index 4fcb8a9cd6f717a22e702dfd3b1c72cc68caa8b3..4dc520db9334a6f3d3fe575001cf7f2d3696ef8b 100644 GIT binary patch literal 4121 zc-jFO5a#ayM@dveQdv+`06FsvPqW=x0vZ;&b&qFh3hWRTvR(W++sq}qKDi;e1)Ht> zPc>T`v;_DI&fp^!ho3#Sep%|E1EziY77$zWvxaTrc}dcY7lLiWRs z%o=Y)x|sg}`I+sEKA1%3!LK%a4*-*XA(n!&ie5W&tnKrqJ|h^_vSd~(h6REC?lU89 z5h8W}h99~Pda9{w@a0cwcJoE_Zm=O9^u^5q1Pf5iS?>Wd`}+c`9>rFbw5CTZ^1p`d z;~_SRVaIb?(;e}GmIxL~(6d%PN7L7j9SY>BSZ|cbUU3bW83cho%{osd+Y(OF9)#-! z+b&-`mN20uK8N2ZED{8-k$WJsYr3-UHklU<8Zumhz&DyK*doK=N`~G=n?`Sqs1c{K zKE#wbuL60rL9*X~TtiH~3W~|iE>Z&fDB`7zCdjkKP@1e>O~R4#gH~vs5$6CUTcz#c zTWY$Ne)&o)hpW+qvx!1p!U zgLXRG+?+tRwg8>wJsKfdF{!ki)(?lMG_TN)vtzoR-^|CV|KYtIH0hgV5db+&U1`D}rLaLVeKnbb$2IKup z9Q}eUP?lzqPeUuZPIDQV3V9y})IO0?O8k;cvvB#vZQL03QAiR|dF9J$Mrlg$GP<}h zNoh7IT9RyxzJ6yDBF&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1G` zDa1Km|6q}{0znX1$x_(bDHuliMDcH3<@r%iJE9iLSqP}R8s~ZEj{DAffn U$me?1A3FX_Z^k_<<9t@Vp2zSgDF6Tf diff --git a/package.json b/package.json index 91214ca1..6b562526 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "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", diff --git a/packages/router/package.json b/packages/router/package.json index 13a5e1c9..64796275 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -94,14 +94,13 @@ "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", diff --git a/packages/router/src/globalExtensions.ts b/packages/router/src/globalExtensions.ts deleted file mode 100644 index 22c49c3c..00000000 --- a/packages/router/src/globalExtensions.ts +++ /dev/null @@ -1,82 +0,0 @@ -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 - - /** - * 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 - } -} diff --git a/packages/router/src/index.ts b/packages/router/src/index.ts index 71899d34..ca57f530 100644 --- a/packages/router/src/index.ts +++ b/packages/router/src/index.ts @@ -1,3 +1,9 @@ +/** + * The official Router for Vue 3. + * + * @packageDocumentation + */ + export { createWebHistory } from './history/html5' export { createMemoryHistory } from './history/memory' export { createWebHashHistory } from './history/hash' @@ -167,10 +173,82 @@ export type { TypesConfig } from './config' 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 + + /** + * 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 + } +} diff --git a/scripts/release.mjs b/scripts/release.mjs index 4346f105..ef0d93ec 100644 --- a/scripts/release.mjs +++ b/scripts/release.mjs @@ -246,7 +246,6 @@ async function main() { step('\nBuilding all packages...') if (!skipBuild && !isDryRun) { await run('pnpm', ['run', 'build']) - await run('pnpm', ['run', 'build:dts']) } else { console.log(`(skipped)`) } -- 2.47.3