File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 16
16
"url" : " git+https://github.com/vuetifyjs/vuetify-loader.git"
17
17
},
18
18
"scripts" : {
19
- "build" : " unbuild && node ../../scripts/patchCJS.mjs" ,
19
+ "build" : " unbuild && node ../../scripts/patchCJS.mjs && node ../../scripts/patch.d.CJS.mjs " ,
20
20
"dev" : " unbuild --stub"
21
21
},
22
22
"author" : " Kael Watts-Deuchar" ,
Original file line number Diff line number Diff line change
1
+ /**
2
+
3
+ It converts
4
+
5
+ ```ts
6
+ export { vuePlugin as default };
7
+ ```
8
+
9
+ to
10
+
11
+ ```ts
12
+ export = vuePlugin;
13
+ export { vuePlugin as default };
14
+ ```
15
+ */
16
+
17
+ import { readFileSync , writeFileSync } from 'node:fs'
18
+ import colors from 'picocolors'
19
+
20
+ const files = [ 'dist/index.d.ts' , 'dist/index.d.cts' ]
21
+
22
+ for ( const indexPath of files ) {
23
+ let code = readFileSync ( indexPath , 'utf-8' )
24
+
25
+ const matchMixed = code . match ( / \n e x p o r t \{ ( \w + ) a s d e f a u l t } ; / )
26
+ if ( matchMixed ) {
27
+ const name = matchMixed [ 1 ]
28
+
29
+ code = code . slice ( 0 , matchMixed . index ) + `\nexport = ${ name } ;` + code . slice ( matchMixed . index )
30
+
31
+ writeFileSync ( indexPath , code )
32
+
33
+ console . log ( colors . bold ( `${ indexPath } d.CJS patched` ) )
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments