Skip to content

Commit 46aa26d

Browse files
committed
build: use tsdown
1 parent 4b8ac59 commit 46aa26d

File tree

10 files changed

+2609
-963
lines changed

10 files changed

+2609
-963
lines changed

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@vue/router-root",
33
"private": true,
4-
"packageManager": "pnpm@9.10.0",
4+
"packageManager": "pnpm@10.13.1",
55
"type": "module",
66
"engines": {
77
"node": ">=20.9.0"
@@ -36,17 +36,17 @@
3636
"brotli": "^1.3.3",
3737
"chalk": "^5.4.1",
3838
"enquirer": "^2.4.1",
39-
"execa": "^9.5.2",
39+
"execa": "^9.6.0",
4040
"globby": "^14.1.0",
4141
"lint-staged": "^15.5.1",
4242
"minimist": "^1.2.8",
4343
"p-series": "^3.0.0",
4444
"prettier": "^3.5.3",
4545
"semver": "^7.7.1",
4646
"simple-git-hooks": "^2.13.0",
47-
"typedoc": "^0.26.11",
48-
"typedoc-plugin-markdown": "^4.2.10",
49-
"typescript": "~5.6.3",
47+
"typedoc": "^0.28.7",
48+
"typedoc-plugin-markdown": "^4.7.0",
49+
"typescript": "~5.8.3",
5050
"vitest": "^2.1.9"
5151
},
5252
"simple-git-hooks": {
@@ -71,7 +71,11 @@
7171
"@types/react",
7272
"react-dom"
7373
]
74-
}
74+
},
75+
"onlyBuiltDependencies": [
76+
"chromedriver",
77+
"geckodriver"
78+
]
7579
},
7680
"volta": {
7781
"node": "20.11.1"

packages/docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"docs:preview": "vitepress preview ."
1414
},
1515
"dependencies": {
16-
"simple-git": "^3.27.0",
17-
"vitepress": "1.5.0",
16+
"simple-git": "^3.28.0",
17+
"vitepress": "1.6.3",
1818
"vitepress-translation-helper": "^0.2.1",
1919
"vue-router": "workspace:*"
2020
}

packages/playground/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
"preview": "vite preview --port 4173"
1010
},
1111
"dependencies": {
12-
"vue": "~3.5.13"
12+
"vue": "~3.5.17"
1313
},
1414
"devDependencies": {
1515
"@types/node": "^20.17.31",
16-
"@vitejs/plugin-vue": "^5.2.3",
17-
"@vue/compiler-sfc": "~3.5.13",
18-
"@vue/tsconfig": "^0.6.0",
19-
"vite": "^5.4.18",
16+
"@vitejs/plugin-vue": "^5.2.4",
17+
"@vue/compiler-sfc": "~3.5.17",
18+
"@vue/tsconfig": "^0.7.0",
19+
"vite": "^5.4.19",
2020
"vue-router": "workspace:*",
21-
"vue-tsc": "^2.2.10"
21+
"vue-tsc": "^2.2.12"
2222
}
2323
}

packages/router/package.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"unpkg": "dist/vue-router.global.js",
66
"jsdelivr": "dist/vue-router.global.js",
77
"module": "dist/vue-router.mjs",
8-
"types": "dist/vue-router.d.ts",
8+
"types": "dist/vue-router.d.mts",
99
"exports": {
1010
".": {
11-
"types": "./dist/vue-router.d.ts",
11+
"types": "./dist/vue-router.d.mts",
1212
"node": {
1313
"import": {
1414
"production": "./dist/vue-router.node.mjs",
@@ -80,7 +80,7 @@
8080
"files": [
8181
"index.js",
8282
"dist/*.{js,cjs,mjs}",
83-
"dist/vue-router.d.ts",
83+
"dist/vue-router.d.{ts,mts}",
8484
"vue-router-auto.d.ts",
8585
"vue-router-auto-routes.d.ts",
8686
"vetur/tags.json",
@@ -90,8 +90,8 @@
9090
"scripts": {
9191
"dev": "vitest --ui",
9292
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
93-
"build": "rimraf dist && rollup -c rollup.config.mjs",
94-
"build:dts": "api-extractor run --local --verbose && tail -n +10 src/globalExtensions.ts >> dist/vue-router.d.ts",
93+
"build": "tsdown",
94+
"build:dts": "tail -n +10 src/globalExtensions.ts >> dist/vue-router.d.mts",
9595
"build:playground": "vue-tsc --noEmit && vite build --config playground/vite.config.ts",
9696
"build:e2e": "vue-tsc --noEmit && vite build --config e2e/vite.config.mjs",
9797
"build:size": "pnpm run build && rollup -c size-checks/rollup.config.mjs",
@@ -117,33 +117,36 @@
117117
"@vue/devtools-api": "^6.6.4"
118118
},
119119
"devDependencies": {
120-
"@microsoft/api-extractor": "^7.48.0",
120+
"@microsoft/api-extractor": "^7.52.8",
121121
"@rollup/plugin-alias": "^5.1.1",
122122
"@rollup/plugin-commonjs": "^25.0.8",
123123
"@rollup/plugin-node-resolve": "^15.3.1",
124124
"@rollup/plugin-replace": "^5.0.7",
125125
"@rollup/plugin-terser": "^0.4.4",
126126
"@types/jsdom": "^21.1.7",
127127
"@types/nightwatch": "^2.3.32",
128-
"@vitejs/plugin-vue": "^5.2.3",
129-
"@vue/compiler-sfc": "~3.5.13",
130-
"@vue/server-renderer": "~3.5.13",
128+
"@typescript/native-preview": "7.0.0-dev.20250718.1",
129+
"@vitejs/plugin-vue": "^5.2.4",
130+
"@vue/compiler-sfc": "~3.5.17",
131+
"@vue/server-renderer": "~3.5.17",
131132
"@vue/test-utils": "^2.4.6",
132133
"browserstack-local": "^1.5.6",
133-
"chromedriver": "^131.0.5",
134+
"chromedriver": "^138.0.3",
134135
"connect-history-api-fallback": "^1.6.0",
135136
"conventional-changelog-cli": "^2.2.2",
136137
"dotenv": "^16.5.0",
137138
"faked-promise": "^2.2.2",
138-
"geckodriver": "^4.5.1",
139+
"geckodriver": "^5.0.0",
139140
"happy-dom": "^15.11.7",
140141
"nightwatch": "^2.6.25",
141142
"nightwatch-helpers": "^1.2.0",
142143
"rimraf": "^6.0.1",
143144
"rollup": "^3.29.5",
144145
"rollup-plugin-analyzer": "^4.0.0",
145146
"rollup-plugin-typescript2": "^0.36.0",
146-
"vite": "^5.4.18",
147-
"vue": "~3.5.13"
147+
"tsdown": "^0.12.9",
148+
"tsup": "^8.5.0",
149+
"vite": "^5.4.19",
150+
"vue": "~3.5.17"
148151
}
149152
}

packages/router/rollup.config.mjs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ function createReplacePlugin(
182182
isNodeBuild
183183
) {
184184
const replacements = {
185-
__COMMIT__: `"${process.env.COMMIT}"`,
186-
__VERSION__: `"${pkg.version}"`,
187185
__DEV__: isBundlerESMBuild
188186
? // preserve to be handled by bundlers
189187
`(process.env.NODE_ENV !== 'production')`
@@ -196,11 +194,6 @@ function createReplacePlugin(
196194
__FEATURE_PROD_DEVTOOLS__: isBundlerESMBuild
197195
? `__VUE_PROD_DEVTOOLS__`
198196
: 'false',
199-
// is targeting bundlers?
200-
__BUNDLER__: JSON.stringify(isBundlerESMBuild),
201-
__GLOBAL__: JSON.stringify(isGlobalBuild),
202-
// is targeting Node (SSR)?
203-
__NODE_JS__: JSON.stringify(isNodeBuild),
204197
}
205198
// allow inline overrides like
206199
//__RUNTIME_COMPILE__=true yarn build

packages/router/src/experimental/router.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ export interface EXPERIMENTAL_RouteRecordNormalized
205205
mods: Record<string, unknown>
206206
}
207207

208+
// TODO: probably need some generic types
209+
// <TResolver extends NEW_RouterResolver_Base>,
208210
/**
209211
* Options to initialize an experimental {@link EXPERIMENTAL_Router} instance.
210212
* @experimental
211213
*/
212-
export interface EXPERIMENTAL_RouterOptions<
213-
// TODO: probably need some generic types
214-
// TResolver extends NEW_RouterResolver_Base,
215-
>extends EXPERIMENTAL_RouterOptions_Base {
214+
export interface EXPERIMENTAL_RouterOptions
215+
extends EXPERIMENTAL_RouterOptions_Base {
216216
/**
217217
* Matcher to use to resolve routes.
218218
*

packages/router/src/global.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ declare var __DEV__: boolean
33
declare var __TEST__: boolean
44
declare var __FEATURE_PROD_DEVTOOLS__: boolean
55
declare var __BROWSER__: boolean
6-
declare var __NODE_JS__: boolean
7-
declare var __CI__: boolean
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
// export * from '../dist/vue-router'
2-
export * from '../src'
1+
export * from '../dist/vue-router.mjs'
2+
// Uncomment for testing local changes without having to build
3+
// export * from '../src'

packages/router/tsdown.config.ts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import { type Options } from 'tsdown'
2+
import pkg from './package.json' with { type: 'json' }
3+
4+
const banner = `
5+
/*!
6+
* ${pkg.name} v${pkg.version}
7+
* (c) ${new Date().getFullYear()} Eduardo San Martin Morote
8+
* @license MIT
9+
*/
10+
`.trim()
11+
12+
const commonOptions = {
13+
sourcemap: false,
14+
format: ['esm'],
15+
entry: {
16+
'vue-router': './src/index.ts',
17+
},
18+
outputOptions: {
19+
banner,
20+
name: 'VueRouter',
21+
globals: {
22+
vue: 'Vue',
23+
'@vue/devtools-api': 'VueDevtoolsApi',
24+
},
25+
},
26+
define: {
27+
__DEV__: `(process.env.NODE_ENV !== 'production')`,
28+
// this is only used during tests
29+
__TEST__: 'false',
30+
// If the build is expected to run directly in the browser (global / esm builds)
31+
// FIXME: makes no sense anymore
32+
__BROWSER__: 'true',
33+
// is replaced by the vite vue plugin
34+
__FEATURE_PROD_DEVTOOLS__: `__VUE_PROD_DEVTOOLS__`,
35+
},
36+
dts: false,
37+
} satisfies Options
38+
39+
const esm = {
40+
...commonOptions,
41+
platform: 'neutral',
42+
dts: true,
43+
// sourcemap: true,
44+
} satisfies Options
45+
46+
const cjs = {
47+
...commonOptions,
48+
format: 'cjs',
49+
outputOptions: {
50+
...commonOptions.outputOptions,
51+
dir: undefined, // must be unset with file
52+
file: 'dist/vue-router.cjs',
53+
},
54+
define: {
55+
...commonOptions.define,
56+
// TODO: what is the right value
57+
__BROWSER__: 'false',
58+
__FEATURE_PROD_DEVTOOLS__: `false`,
59+
},
60+
} satisfies Options
61+
62+
const cjsProd = {
63+
...cjs,
64+
minify: true,
65+
outputOptions: {
66+
...cjs.outputOptions,
67+
file: 'dist/vue-router.prod.cjs',
68+
},
69+
} satisfies Options
70+
71+
const iife = {
72+
...commonOptions,
73+
format: 'iife',
74+
// TODO: remove when upgrading to devtools-api v7 because it's too big
75+
noExternal: ['@vue/devtools-api'],
76+
outputOptions: {
77+
...commonOptions.outputOptions,
78+
dir: undefined, // must be unset with file
79+
file: 'dist/vue-router.global.js',
80+
},
81+
define: {
82+
...commonOptions.define,
83+
__DEV__: 'true',
84+
__FEATURE_PROD_DEVTOOLS__: `true`,
85+
},
86+
} satisfies Options
87+
88+
const iifeProd = {
89+
...iife,
90+
minify: true,
91+
outputOptions: {
92+
...iife.outputOptions,
93+
file: 'dist/vue-router.global.prod.js',
94+
},
95+
define: {
96+
...iife.define,
97+
__DEV__: 'false',
98+
__FEATURE_PROD_DEVTOOLS__: `false`,
99+
},
100+
} satisfies Options
101+
102+
export default [
103+
//
104+
esm,
105+
cjs,
106+
cjsProd,
107+
iife,
108+
iifeProd,
109+
]

0 commit comments

Comments
 (0)