File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -136,9 +136,9 @@ async function rollupDtsFiles(
136
136
}
137
137
}
138
138
139
- function cleanDtsFiles ( options : NormalizedOptions ) {
139
+ async function cleanDtsFiles ( options : NormalizedOptions ) {
140
140
if ( options . clean ) {
141
- removeFiles ( [ '**/*.d.{ts,mts,cts}' ] , options . outDir )
141
+ await removeFiles ( [ '**/*.d.{ts,mts,cts}' ] , options . outDir )
142
142
}
143
143
}
144
144
@@ -156,7 +156,7 @@ export async function runDtsRollup(
156
156
if ( ! exports ) {
157
157
throw new Error ( 'Unexpected internal error: dts exports is not define' )
158
158
}
159
- cleanDtsFiles ( options )
159
+ await cleanDtsFiles ( options )
160
160
for ( const format of options . format ) {
161
161
await rollupDtsFiles ( options , exports , format )
162
162
}
Original file line number Diff line number Diff line change @@ -207,17 +207,21 @@ export async function build(_options: Options) {
207
207
logger . info ( 'CLI' , 'Running in watch mode' )
208
208
}
209
209
210
+ const experimentalDtsTask = async ( ) => {
211
+ if ( ! options . dts && options . experimentalDts ) {
212
+ const exports = runTypeScriptCompiler ( options ) ;
213
+ await runDtsRollup ( options , exports ) ;
214
+ }
215
+ }
216
+
210
217
const dtsTask = async ( ) => {
211
218
if ( options . dts && options . experimentalDts ) {
212
219
throw new Error (
213
220
"You can't use both `dts` and `experimentalDts` at the same time" ,
214
221
)
215
222
}
216
223
217
- if ( options . experimentalDts ) {
218
- const exports = runTypeScriptCompiler ( options )
219
- await runDtsRollup ( options , exports )
220
- }
224
+ experimentalDtsTask ( ) ;
221
225
222
226
if ( options . dts ) {
223
227
await new Promise < void > ( ( resolve , reject ) => {
@@ -351,6 +355,8 @@ export async function build(_options: Options) {
351
355
} ) ,
352
356
] )
353
357
358
+ experimentalDtsTask ( )
359
+
354
360
if ( options . onSuccess ) {
355
361
if ( typeof options . onSuccess === 'function' ) {
356
362
onSuccessCleanup = await options . onSuccess ( )
You can’t perform that action at this time.
0 commit comments