Skip to content

Commit 5be1d05

Browse files
authored
Merge pull request #4393 from jchavarri/load-modules-3
Playground: Bring back load_modules API
2 parents 49698c1 + 856e0ad commit 5be1d05

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

jscomp/main/jsoo_main.ml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,6 @@ let implementation ~use_super_errors impl str : Js.Unsafe.obj =
103103
let compile impl ~use_super_errors =
104104
implementation ~use_super_errors impl
105105

106-
107-
108-
109-
(* let load_module cmi_path cmi_content cmj_name cmj_content =
110-
Js.create_file cmi_path cmi_content;
111-
Js_cmj_datasets.data_sets :=
112-
Map_string.add !Js_cmj_datasets.data_sets
113-
cmj_name (lazy (Js_cmj_format.from_string cmj_content))
114-
*)
115-
116-
117106
let export (field : string) v =
118107
Js.Unsafe.set (Js.Unsafe.global) field v
119108
;;
@@ -122,10 +111,8 @@ let export (field : string) v =
122111

123112
let dir_directory d =
124113
Config.load_path := d :: !Config.load_path
125-
126-
127114
let () =
128-
dir_directory "/static/cmis"
115+
dir_directory "/static"
129116

130117
let make_compiler name impl =
131118
export name
@@ -141,15 +128,12 @@ let make_compiler name impl =
141128
(fun _ code ->
142129
(compile impl ~use_super_errors:true (Js.to_string code)));
143130
"version", Js.Unsafe.inject (Js.string (Bs_version.version));
144-
(* "load_module",
131+
"load_module",
145132
inject @@
146133
Js.wrap_meth_callback
147-
(fun _ cmi_path cmi_content cmj_name cmj_content ->
148-
let cmj_bytestring = Js.to_bytestring cmj_content in
149-
(* HACK: force string tag to ASCII (9) to avoid
150-
* UTF-8 encoding *)
151-
Js.Unsafe.set cmj_bytestring "t" 9;
152-
load_module cmi_path cmi_content (Js.to_string cmj_name) cmj_bytestring); *)
134+
(fun _ cmi_path cmi_content cmj_path cmj_content ->
135+
Js.create_file cmi_path cmi_content;
136+
Js.create_file cmj_path cmj_content);
153137
|]))
154138
let () = make_compiler "ocaml" Parse.implementation
155139

0 commit comments

Comments
 (0)