Skip to content

Commit 9a2a1ee

Browse files
committed
playground: bring back load_modules
1 parent 676c4b5 commit 9a2a1ee

File tree

2 files changed

+5
-28
lines changed

2 files changed

+5
-28
lines changed

jscomp/core/config_util.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
let find_in_path_uncap path name =
3131
let uname = Ext_string.uncapitalize_ascii name in
3232
let rec try_dir = function
33-
| [] -> None
33+
| [] -> if Sys.file_exists name then Some name else None
3434
| dir::rem ->
3535
let ufullname = Filename.concat dir uname in
3636
if Sys.file_exists ufullname then Some ufullname

jscomp/main/jsoo_main.ml

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -103,30 +103,10 @@ 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
;;
120109

121-
(* To add a directory to the load path *)
122-
123-
let dir_directory d =
124-
Config.load_path := d :: !Config.load_path
125-
126-
127-
let () =
128-
dir_directory "/static/cmis"
129-
130110
let make_compiler name impl =
131111
export name
132112
(Js.Unsafe.(obj
@@ -141,15 +121,12 @@ let make_compiler name impl =
141121
(fun _ code ->
142122
(compile impl ~use_super_errors:true (Js.to_string code)));
143123
"version", Js.Unsafe.inject (Js.string (Bs_version.version));
144-
(* "load_module",
124+
"load_module",
145125
inject @@
146126
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); *)
127+
(fun _ cmi_path cmi_content cmj_path cmj_content ->
128+
Js.create_file cmi_path cmi_content;
129+
Js.create_file cmj_path cmj_content);
153130
|]))
154131
let () = make_compiler "ocaml" Parse.implementation
155132

0 commit comments

Comments
 (0)