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(
136136 }
137137}
138138
139- function cleanDtsFiles ( options : NormalizedOptions ) {
139+ async function cleanDtsFiles ( options : NormalizedOptions ) {
140140 if ( options . clean ) {
141- removeFiles ( [ '**/*.d.{ts,mts,cts}' ] , options . outDir )
141+ await removeFiles ( [ '**/*.d.{ts,mts,cts}' ] , options . outDir )
142142 }
143143}
144144
@@ -156,7 +156,7 @@ export async function runDtsRollup(
156156 if ( ! exports ) {
157157 throw new Error ( 'Unexpected internal error: dts exports is not define' )
158158 }
159- cleanDtsFiles ( options )
159+ await cleanDtsFiles ( options )
160160 for ( const format of options . format ) {
161161 await rollupDtsFiles ( options , exports , format )
162162 }
Original file line number Diff line number Diff line change @@ -207,17 +207,21 @@ export async function build(_options: Options) {
207207 logger . info ( 'CLI' , 'Running in watch mode' )
208208 }
209209
210+ const experimentalDtsTask = async ( ) => {
211+ if ( ! options . dts && options . experimentalDts ) {
212+ const exports = runTypeScriptCompiler ( options ) ;
213+ await runDtsRollup ( options , exports ) ;
214+ }
215+ }
216+
210217 const dtsTask = async ( ) => {
211218 if ( options . dts && options . experimentalDts ) {
212219 throw new Error (
213220 "You can't use both `dts` and `experimentalDts` at the same time" ,
214221 )
215222 }
216223
217- if ( options . experimentalDts ) {
218- const exports = runTypeScriptCompiler ( options )
219- await runDtsRollup ( options , exports )
220- }
224+ experimentalDtsTask ( ) ;
221225
222226 if ( options . dts ) {
223227 await new Promise < void > ( ( resolve , reject ) => {
@@ -351,6 +355,8 @@ export async function build(_options: Options) {
351355 } ) ,
352356 ] )
353357
358+ experimentalDtsTask ( )
359+
354360 if ( options . onSuccess ) {
355361 if ( typeof options . onSuccess === 'function' ) {
356362 onSuccessCleanup = await options . onSuccess ( )
You can’t perform that action at this time.
0 commit comments