From 420e350544b655ee4eb546e739fdb8453d46e974 Mon Sep 17 00:00:00 2001 From: cqc Date: Sun, 5 Mar 2023 15:50:18 -0600 Subject: [PATCH] examples.ml lol that was hard --- dune | 146 ++++++++++++++++++++++++++++++-------------------- toplevel.html | 2 +- 2 files changed, 88 insertions(+), 60 deletions(-) diff --git a/dune b/dune index 3d29515..cab1f6e 100644 --- a/dune +++ b/dune @@ -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)) diff --git a/toplevel.html b/toplevel.html index 711a758..df63732 100644 --- a/toplevel.html +++ b/toplevel.html @@ -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");