File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change
1
+ import * as fs from 'node:fs/promises'
2
+
3
+ async function patchVueRouterDts ( ) {
4
+ const content = await fs . readFile ( './src/globalExtensions.ts' , {
5
+ encoding : 'utf-8' ,
6
+ } )
7
+ const moduleAugmentationIdx = content . indexOf ( '/**' )
8
+ if ( moduleAugmentationIdx === - 1 ) {
9
+ throw new Error (
10
+ 'Cannot find module augmentation in globalExtensions.ts, first /** comment is expected to start module augmentation'
11
+ )
12
+ }
13
+ const targetContent = await fs . readFile ( './dist/vue-router.d.ts' , {
14
+ encoding : 'utf-8' ,
15
+ } )
16
+ await fs . writeFile (
17
+ './dist/vue-router.d.ts' ,
18
+ `${ targetContent }
19
+ ${ content . slice ( moduleAugmentationIdx ) } `,
20
+ { encoding : 'utf8' }
21
+ )
22
+ }
23
+
24
+ patchVueRouterDts ( )
Original file line number Diff line number Diff line change 91
91
"dev" : " vitest --ui" ,
92
92
"changelog" : " conventional-changelog -p angular -i CHANGELOG.md -s -r 1" ,
93
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 " ,
94
+ "build:dts" : " api-extractor run --local --verbose && node ./add-dts-module-augmentation.js " ,
95
95
"build:playground" : " vue-tsc --noEmit && vite build --config playground/vite.config.ts" ,
96
96
"build:e2e" : " vue-tsc --noEmit && vite build --config e2e/vite.config.mjs" ,
97
97
"build:size" : " pnpm run build && rollup -c size-checks/rollup.config.mjs" ,
You can’t perform that action at this time.
0 commit comments