@@ -22621,6 +22621,8 @@ type error =
22621
22621
| Bs_package_not_found of string
22622
22622
| Bs_main_not_exist of string
22623
22623
| Bs_invalid_path of string
22624
+ | Missing_ml_dependency of string
22625
+ | Dependency_script_module_dependent_not of string
22624
22626
(*
22625
22627
TODO: In the futrue, we should refine dependency [bsb]
22626
22628
should not rely on such exception, it should have its own exception handling
@@ -22668,12 +22670,21 @@ type error =
22668
22670
| Bs_package_not_found of string
22669
22671
| Bs_main_not_exist of string
22670
22672
| Bs_invalid_path of string
22673
+ | Missing_ml_dependency of string
22674
+ | Dependency_script_module_dependent_not of string
22671
22675
(** TODO: we need add location handling *)
22672
22676
exception Error of error
22673
22677
22674
22678
let error err = raise (Error err)
22675
22679
22676
22680
let report_error ppf = function
22681
+ | Dependency_script_module_dependent_not s
22682
+ ->
22683
+ Format.fprintf ppf
22684
+ "%s is compiled in script mode while its dependent is not"
22685
+ s
22686
+ | Missing_ml_dependency s ->
22687
+ Format.fprintf ppf "Missing dependency %s in search path" s
22677
22688
| Cmj_not_found s ->
22678
22689
Format.fprintf ppf "%s not found, cmj format is generated by BuckleScript" s
22679
22690
| Js_not_found s ->
@@ -83071,21 +83082,16 @@ let string_of_module_id ~output_prefix
83071
83082
Js_config.get_current_package_name_and_path module_system
83072
83083
in
83073
83084
begin match module_system, dependency_pkg_info, current_pkg_info with
83074
- | _, NotFound , _ ->
83075
- Ext_pervasives.failwithf ~loc:__LOC__
83076
- " @[dependent module is not found while %s not in search path - compiling %s @] "
83077
- js_file !Location.input_name
83085
+ | _, NotFound , _
83086
+ ->
83087
+ Bs_exception.error (Missing_ml_dependency js_file)
83078
83088
| Goog, (Empty | Package_script _), _
83079
83089
->
83080
- Ext_pervasives.failwithf ~loc:__LOC__
83081
- " @[%s was not compiled with goog support in search path - while compiling %s @] "
83082
- js_file !Location.input_name
83090
+ Bs_exception.error (Dependency_script_module_dependent_not js_file)
83083
83091
| (AmdJS | NodeJS | Es6 | Es6_global | AmdJS_global),
83084
83092
( Empty | Package_script _) ,
83085
83093
Found _ ->
83086
- Ext_pervasives.failwithf ~loc:__LOC__
83087
- "@[dependency %s was compiled in script mode - while compiling %s in package mode @]"
83088
- js_file !Location.input_name
83094
+ Bs_exception.error (Dependency_script_module_dependent_not js_file)
83089
83095
| Goog , Found (package_name, x), _ ->
83090
83096
package_name ^ "." ^ String.uncapitalize id.name
83091
83097
| (AmdJS | NodeJS| Es6 | Es6_global|AmdJS_global),
@@ -83427,7 +83433,7 @@ let array_conv =
83427
83433
83428
83434
83429
83435
(* https://mathiasbynens.be/notes/javascript-escapes *)
83430
- let pp_string f ?(quote='"') (* ?(utf=false)*) s =
83436
+ let pp_string f (* ?(utf=false)*) s =
83431
83437
let pp_raw_string f (* ?(utf=false)*) s =
83432
83438
let l = String.length s in
83433
83439
for i = 0 to l - 1 do
@@ -83461,20 +83467,14 @@ let pp_string f ?(quote='"') (* ?(utf=false)*) s =
83461
83467
P.string f "\\x";
83462
83468
P.string f (Array.unsafe_get array_conv (c lsr 4));
83463
83469
P.string f (Array.unsafe_get array_conv (c land 0xf))
83464
- (* | '\'' -> P.string f "\\'" *)
83465
- (* | '\"' -> P.string f "\\\"" *)
83470
+ | '\"' -> P.string f "\\\"" (* quote*)
83466
83471
| _ ->
83467
- begin
83468
- (if c = quote then
83469
- P.string f "\\");
83470
83472
P.string f (Array.unsafe_get array_str1 (Char.code c))
83471
- end
83472
83473
done
83473
83474
in
83474
- let quote_s = String.make 1 quote in
83475
- P.string f quote_s;
83475
+ P.string f "\"";
83476
83476
pp_raw_string f (*~utf*) s ;
83477
- P.string f quote_s
83477
+ P.string f "\""
83478
83478
;;
83479
83479
83480
83480
(** used in printing keys
@@ -84982,7 +84982,7 @@ let imports cxt f (modules : (Ident.t * string) list ) =
84982
84982
P.nspace f (margin - String.length s + 1) ;
84983
84983
P.string f L.from;
84984
84984
P.space f;
84985
- pp_string f ( file ^ ".js") ;
84985
+ pp_string f file ;
84986
84986
semi f ;
84987
84987
P.newline f ;
84988
84988
) reversed_list;
0 commit comments