@@ -25,41 +25,41 @@ pub fn gather_state(
25
25
26
26
let maybe_opts = M2PresetOptions :: get_opts ( & req. state ( ) . program_config )
27
27
. expect ( "should clone program config" ) ;
28
- let bundle_path = maybe_opts. bundle_config ;
29
28
30
- match bundle_path {
31
- Some ( bun_config_path) => match BundleConfig :: from_file ( & bun_config_path) {
32
- Ok ( bundle_config) => {
33
- let module_blacklist = bundle_config. module_blacklist . clone ( ) . unwrap_or ( vec ! [ ] ) ;
34
- let mut blacklist = vec ! [ "js-translation" . to_string( ) ] ;
35
- blacklist. extend ( module_blacklist) ;
29
+ let bundle_config = match maybe_opts. bundle_config {
30
+ Some ( bc_path) => BundleConfig :: from_file ( & bc_path) ,
31
+ None => Ok ( BundleConfig :: default ( ) ) ,
32
+ } ;
36
33
37
- let filtered =
38
- RequireJsBuildConfig :: drop_blacklisted ( & modules. to_vec ( ) , & blacklist) ;
39
- let bundle_modules = config_gen:: generate_modules ( filtered, bundle_config) ;
40
- let mut derived_build_config = RequireJsBuildConfig :: default ( ) ;
34
+ match bundle_config {
35
+ Err ( e) => Err ( e. to_string ( ) ) ,
36
+ Ok ( bundle_config) => {
37
+ let module_blacklist = bundle_config. module_blacklist . clone ( ) . unwrap_or ( vec ! [ ] ) ;
38
+ let mut blacklist = vec ! [ "js-translation" . to_string( ) ] ;
39
+ blacklist. extend ( module_blacklist) ;
41
40
42
- derived_build_config . deps = client_config . deps . clone ( ) ;
43
- derived_build_config . map = client_config . map . clone ( ) ;
44
- derived_build_config. config = client_config . config . clone ( ) ;
41
+ let filtered = RequireJsBuildConfig :: drop_blacklisted ( & modules . to_vec ( ) , & blacklist ) ;
42
+ let bundle_modules = config_gen :: generate_modules ( filtered , bundle_config ) ;
43
+ let mut derived_build_config = RequireJsBuildConfig :: default ( ) ;
45
44
46
- let mut c = client_config. paths . clone ( ) ;
47
- derived_build_config. paths = RequireJsBuildConfig :: strip_paths ( & c) ;
45
+ derived_build_config. deps = client_config. deps . clone ( ) ;
46
+ derived_build_config. map = client_config. map . clone ( ) ;
47
+ derived_build_config. config = client_config. config . clone ( ) ;
48
48
49
- let mut shims = client_config. shim . clone ( ) ;
49
+ let mut c = client_config. paths . clone ( ) ;
50
+ derived_build_config. paths = RequireJsBuildConfig :: strip_paths ( & c) ;
50
51
51
- {
52
- RequireJsBuildConfig :: fix_shims ( & mut shims) ;
53
- }
52
+ let mut shims = client_config. shim . clone ( ) ;
54
53
55
- derived_build_config. shim = shims;
54
+ {
55
+ RequireJsBuildConfig :: fix_shims ( & mut shims) ;
56
+ }
56
57
57
- derived_build_config. modules = Some ( bundle_modules . clone ( ) ) ;
58
+ derived_build_config. shim = shims ;
58
59
59
- Ok ( ( derived_build_config, bundle_modules) )
60
- }
61
- Err ( e) => Err ( e. to_string ( ) ) ,
62
- } ,
63
- _ => Err ( "didnt match both" . to_string ( ) ) ,
60
+ derived_build_config. modules = Some ( bundle_modules. clone ( ) ) ;
61
+
62
+ Ok ( ( derived_build_config, bundle_modules) )
63
+ }
64
64
}
65
65
}
0 commit comments