examples.ml lol that was hard

This commit is contained in:
cqc
2023-03-05 15:50:18 -06:00
parent ab91e5dee0
commit 420e350544
2 changed files with 88 additions and 60 deletions

146
dune
View File

@ -1,7 +1,8 @@
(env
(dev (flags (:standard -warn-error -A))
(js_of_ocaml (flags :standard --no-inline --debug-info --target-env browser --disable shortvar)
(js_of_ocaml (flags :standard)
(build_runtime_flags :standard --no-inline --debug-info)
(compilation_mode whole_program)
(link_flags :standard))))
(library
@ -35,33 +36,7 @@
uri
gg
lwd
log_js
))
(executables
(names toplevel)
(modules toplevel ppx_graph)
(libraries
js_of_ocaml-compiler
js_of_ocaml-tyxml
js_of_ocaml-toplevel
lwt
js_of_ocaml-lwt
;; not used directly
graphics
js_of_ocaml.deriving
js_of_ocaml-lwt.graphics
js_of_ocaml-ppx.as-lib
ocp-indent.lib
react
reactiveData
str
log_js)
(flags
(:standard -rectypes -linkall))
(modes byte)
(preprocess
(pps js_of_ocaml-ppx)))
log_js))
(rule
(targets test_dynlink.cmo test_dynlink.cmi)
@ -73,6 +48,11 @@
(action
(run %{bin:js_of_ocaml} --pretty --toplevel %{dep:test_dynlink.cmo})))
(rule
(targets embedded_fs.js)
(action
(run %{bin:jsoo_fs} -I . -o %{targets} %{dep:examples.ml} %{dep:test_dynlink.js})))
(rule
(targets export.txt)
(deps
@ -84,33 +64,36 @@
(package js_of_ocaml-toplevel))
(action
(run
jsoo_listunits
-o
%{targets}
stdlib
graphics
str
dynlink
js_of_ocaml-compiler.runtime
js_of_ocaml-lwt.graphics
js_of_ocaml-ppx.as-lib
js_of_ocaml.deriving
lwt
tyxml.functor
tyxml.functor:html_types.cmi
react
reactiveData
js_of_ocaml
js_of_ocaml-lwt
js_of_ocaml-tyxml
js_of_ocaml-toplevel
dynlink)))
jsoo_listunits
-o
%{targets}
stdlib
graphics
str
dynlink
js_of_ocaml-compiler.runtime
js_of_ocaml-lwt.graphics
js_of_ocaml-ppx.as-lib
js_of_ocaml.deriving
lwt
tyxml.functor
tyxml.functor:html_types.cmi
react
reactiveData
js_of_ocaml
js_of_ocaml-lwt
js_of_ocaml-tyxml
js_of_ocaml-toplevel
dynlink)))
(rule
(targets toplevel.js)
(action
(run
%{bin:js_of_ocaml}
(executables
(names toplevel)
(modules toplevel ppx_graph)
(flags
(:standard -rectypes -linkall))
(modes js)
(js_of_ocaml
(flags
compile
--pretty
--Werror
@ -123,10 +106,55 @@
shortvar
+toplevel.js
+dynlink.js
%{dep:toplevel.bc}
-o
%{targets})))
%{dep:embedded_fs.js}))
(preprocess
(pps js_of_ocaml-ppx))
(libraries
js_of_ocaml-compiler
js_of_ocaml-tyxml
js_of_ocaml-toplevel
lwt
js_of_ocaml-lwt
;; not used directly
graphics
js_of_ocaml.deriving
js_of_ocaml-lwt.graphics
js_of_ocaml-ppx.as-lib
compiler-libs
compiler-libs.common
compiler-libs.bytecomp
js_of_ocaml-compiler.runtime
ocp-indent.lib
react
reactiveData
str
log_js)
)
; (rule
; (targets toplevel.js)
; (deps examples.ml)
; (action
; (run
; %{bin:js_of_ocaml}
; compile
; --pretty
; --Werror
; --target-env
; browser
; --extern-fs
; "--file=%{dep:examples.ml}"
; --export
; %{dep:export.txt}
; --toplevel
; --disable
; shortvar
; +toplevel.js
; +dynlink.js
; %{dep:toplevel.bc}
; -o
; %{targets})))
(alias
(name default)
(deps toplevel.js index.html))
(name default)
(deps toplevel.bc.js index.html toplevel.html))

View File

@ -167,7 +167,7 @@
document.getElementsByTagName("head")[0].appendChild(fileref);
}
load_script("_build/default/exported-unit.cmis.js");
load_script("_build/default/toplevel.js");
load_script("_build/default/toplevel.bc.js");
</script>
</head>