@@ -68,18 +68,31 @@ module S = Js_stmt_make
68
68
69
69
let (// ) = Filename. concat
70
70
71
- let string_of_module_id ~output_prefix
72
- (module_system : Js_packages_info.module_system )
73
- (x : Lam_module_ident.t ) : string =
74
- #if BS_COMPILER_IN_BROWSER then
71
+ let string_of_module_id_in_browser (x : Lam_module_ident.t ) =
75
72
match x.kind with
73
+ | External name -> name
76
74
| Runtime | Ml ->
77
75
" stdlib" // String. uncapitalize x.id.name
78
- | External name -> name
79
- #else
76
+
77
+
80
78
79
+ let string_of_module_id
80
+ ~hint_output_dir
81
+ (module_system : Js_packages_info.module_system )
82
+ (x : Lam_module_ident.t ) : string =
83
+ #if BS_COMPILER_IN_BROWSER then
84
+ string_of_module_id_in_browser x
85
+ #else
81
86
let result =
82
87
match x.kind with
88
+ | External name -> name (* the literal string for external package *)
89
+ (* * This may not be enough,
90
+ 1. For cross packages, we may need settle
91
+ down a single js package
92
+ 2. We may need es6 path for dead code elimination
93
+ But frankly, very few JS packages have no dependency,
94
+ so having plugin may sound not that bad
95
+ *)
83
96
| Runtime
84
97
| Ml ->
85
98
let id = x.id in
@@ -89,7 +102,7 @@ let string_of_module_id ~output_prefix
89
102
let current_unit_dir =
90
103
`Dir (Js_packages_info. get_output_dir
91
104
~pkg_dir: package_dir module_system
92
- output_prefix
105
+ ~hint_output_dir
93
106
current_package_info
94
107
) in
95
108
Ext_filename. node_relative_path different_package current_unit_dir dep
@@ -142,7 +155,7 @@ let string_of_module_id ~output_prefix
142
155
(Js_packages_info. get_output_dir
143
156
~pkg_dir: (Lazy. force Ext_filename. package_dir)
144
157
module_system
145
- output_prefix
158
+ ~hint_output_dir
146
159
(Js_packages_state. get_packages_info() )
147
160
)
148
161
((Filename. dirname
@@ -177,14 +190,7 @@ let string_of_module_id ~output_prefix
177
190
end
178
191
179
192
end
180
- | External name -> name (* the literal string for external package *)
181
- (* * This may not be enough,
182
- 1. For cross packages, we may need settle
183
- down a single js package
184
- 2. We may need es6 path for dead code elimination
185
- But frankly, very few JS packages have no dependency,
186
- so having plugin may sound not that bad
187
- *)
193
+
188
194
in
189
195
if Ext_sys. is_windows_or_cygwin then Ext_string. replace_backward_slash result
190
196
else result
@@ -203,17 +209,3 @@ let string_of_module_id ~output_prefix
203
209
FIXME: the module order matters?
204
210
*)
205
211
206
- let make_program name export_idents block : J.program =
207
-
208
- {
209
- name;
210
-
211
- exports = export_idents ;
212
- export_set = Ident_set. of_list export_idents;
213
- block = block;
214
-
215
- }
216
- let decorate_deps modules side_effect program : J.deps_program =
217
-
218
- { program ; modules ; side_effect }
219
-
0 commit comments