@@ -58,19 +58,14 @@ pub fn remove_compile_assets(package: &packages::Package, source_file: &Path) {
58
58
}
59
59
}
60
60
61
- pub fn clean_mjs_files ( build_state : & BuildState ) {
61
+ fn clean_source_files ( build_state : & BuildState , root_package : & packages :: Package ) {
62
62
// get all rescript file locations
63
63
let rescript_file_locations = build_state
64
64
. modules
65
65
. values ( )
66
66
. filter_map ( |module| match & module. source_type {
67
67
SourceType :: SourceFile ( source_file) => {
68
68
let package = build_state. packages . get ( & module. package_name ) . unwrap ( ) ;
69
- let root_package = build_state
70
- . packages
71
- . get ( & build_state. root_config_name )
72
- . expect ( "Could not find root package" ) ;
73
-
74
69
Some (
75
70
root_package
76
71
. config
@@ -391,10 +386,6 @@ pub fn clean(path: &Path, show_progress: bool, snapshot_output: bool, build_dev_
391
386
}
392
387
393
388
let timing_clean_mjs = Instant :: now ( ) ;
394
- if !snapshot_output && show_progress {
395
- println ! ( "{} {}Cleaning mjs files..." , style( "[2/2]" ) . bold( ) . dim( ) , SWEEP ) ;
396
- let _ = std:: io:: stdout ( ) . flush ( ) ;
397
- }
398
389
let mut build_state = BuildState :: new (
399
390
project_root. to_owned ( ) ,
400
391
root_config_name,
@@ -403,15 +394,33 @@ pub fn clean(path: &Path, show_progress: bool, snapshot_output: bool, build_dev_
403
394
bsc_path,
404
395
) ;
405
396
packages:: parse_packages ( & mut build_state) ;
406
- clean_mjs_files ( & build_state) ;
397
+ let root_package = build_state
398
+ . packages
399
+ . get ( & build_state. root_config_name )
400
+ . expect ( "Could not find root package" ) ;
401
+
402
+ let suffix = root_package. config . suffix . as_deref ( ) . unwrap_or ( ".res.mjs" ) ;
403
+
404
+ if !snapshot_output && show_progress {
405
+ println ! (
406
+ "{} {}Cleaning {} files..." ,
407
+ style( "[2/2]" ) . bold( ) . dim( ) ,
408
+ SWEEP ,
409
+ suffix
410
+ ) ;
411
+ let _ = std:: io:: stdout ( ) . flush ( ) ;
412
+ }
413
+
414
+ clean_source_files ( & build_state, root_package) ;
407
415
let timing_clean_mjs_elapsed = timing_clean_mjs. elapsed ( ) ;
408
416
409
417
if !snapshot_output && show_progress {
410
418
println ! (
411
- "{}{} {}Cleaned mjs files in {:.2}s" ,
419
+ "{}{} {}Cleaned {} files in {:.2}s" ,
412
420
LINE_CLEAR ,
413
421
style( "[2/2]" ) . bold( ) . dim( ) ,
414
422
SWEEP ,
423
+ suffix,
415
424
timing_clean_mjs_elapsed. as_secs_f64( )
416
425
) ;
417
426
let _ = std:: io:: stdout ( ) . flush ( ) ;
0 commit comments