@@ -28,7 +28,7 @@ let (=) (x : int) (y:float) = assert false
28
28
(* "xx/lib/ocaml/js.cmj"
29
29
Enhancement: This can be delegated to build system
30
30
*)
31
- let runtime_package_path =
31
+ let runtime_package_path : string Lazy.t =
32
32
lazy (Filename. dirname (Filename. dirname
33
33
(Filename. dirname
34
34
(match Config_util. find_opt " js.cmj" with
@@ -47,14 +47,10 @@ let fix_path_for_windows : string -> string =
47
47
let string_of_module_id
48
48
(dep_module_id : Lam_module_ident.t )
49
49
~(output_dir : string )
50
- (module_system : Js_packages_info.module_system )
51
- (current_package_info : Js_packages_info.t )
52
- (get_package_path_from_cmj :
53
- Lam_module_ident.t -> (string * Js_packages_info.t * Ext_namespace.file_kind) option
54
- )
55
-
50
+ (module_system : Js_packages_info.module_system )
56
51
: string =
57
- fix_path_for_windows (
52
+ let current_package_info = Js_packages_state. get_packages_info () in
53
+ fix_path_for_windows (
58
54
match dep_module_id.kind with
59
55
| External name -> name (* the literal string for external package *)
60
56
(* * This may not be enough,
@@ -114,7 +110,7 @@ let string_of_module_id
114
110
Js_packages_info. query_package_infos current_package_info
115
111
module_system
116
112
in
117
- match get_package_path_from_cmj dep_module_id with
113
+ match Lam_compile_env. get_package_path_from_cmj dep_module_id with
118
114
| None ->
119
115
Bs_exception. error (Missing_ml_dependency dep_module_id.id.name)
120
116
| Some (cmj_path , package_info , little ) ->
@@ -202,7 +198,7 @@ let string_of_module_id
202
198
203
199
204
200
205
-
201
+ (* Override it in browser *)
206
202
#if BS_COMPILER_IN_BROWSER then
207
203
let string_of_module_id_in_browser (x : Lam_module_ident.t ) =
208
204
match x.kind with
@@ -214,18 +210,4 @@ let string_of_module_id
214
210
~output_dir :(_ :string )
215
211
(_module_system : Js_packages_info.module_system )
216
212
= string_of_module_id_in_browser id
217
- #else
218
-
219
- let string_of_module_id
220
- (id : Lam_module_ident.t )
221
- ~output_dir
222
- module_system
223
- =
224
- string_of_module_id
225
- id
226
- ~output_dir
227
- module_system
228
- (Js_packages_state. get_packages_info () )
229
- Lam_compile_env. get_package_path_from_cmj
230
-
231
213
#end
0 commit comments