diff --git a/README.md b/README.md index 0bc155e407..a15bdd424e 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,9 @@ helper functions for printing and serializing this data. For a type named `t`, t for a type named something else like `q`, it will be `show_q`. #### Source Maps -`js_of_ocaml` does support source maps and has some other flags that might be useful. If you experiment with those and get them to work, please update this README with some notes. +Source maps for `js_of_ocaml` should be configured when making locally with the dev profile (`make`). This is configured using the env stanzas present in the `dune` files for each top-level directory. + +Since source maps are generated browser developer tools should show reason code in the debugger and source tree. Stack traces should also include reason line numbers. #### Debug Mode If Hazel is hanging on load or when you perform certain actions, you can load into Debug Mode by appending `#debug` to the URL and reloading. From there, you have some buttons that will change settings or reset local storage. Refresh without the `#debug` flag and hopefully you can resolve the situation from there. diff --git a/src/haz3lcore/dune b/src/haz3lcore/dune index 6a2a51984d..77e2ca3fe1 100644 --- a/src/haz3lcore/dune +++ b/src/haz3lcore/dune @@ -3,9 +3,7 @@ (library (name haz3lcore) (libraries util sexplib unionFind uuidm virtual_dom yojson core) - (js_of_ocaml - (flags - (:include js-of-ocaml-flags-%{profile}))) + (js_of_ocaml) (preprocess (pps ppx_yojson_conv @@ -14,10 +12,10 @@ ppx_sexp_conv ppx_deriving.show))) -(rule - (write-file - js-of-ocaml-flags-dev - "(:standard --debuginfo --noinline --dynlink --linkall --sourcemap)")) - -(rule - (write-file js-of-ocaml-flags-release "(:standard)")) +(env + (dev + (js_of_ocaml + (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap))) + (release + (js_of_ocaml + (flags :standard)))) diff --git a/src/haz3lschool/dune b/src/haz3lschool/dune index d9c50213a5..a9f7575c78 100644 --- a/src/haz3lschool/dune +++ b/src/haz3lschool/dune @@ -13,3 +13,11 @@ (libraries ppx_yojson_conv.expander haz3lcore haz3lschool) (preprocess (pps ppx_yojson_conv ppx_let ppx_sexp_conv ppx_deriving.show))) + +(env + (dev + (js_of_ocaml + (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap))) + (release + (js_of_ocaml + (flags :standard)))) diff --git a/src/haz3lweb/dune b/src/haz3lweb/dune index 4874cbf066..8d25155dc5 100644 --- a/src/haz3lweb/dune +++ b/src/haz3lweb/dune @@ -17,9 +17,7 @@ haz3lschool pretty omd) - (js_of_ocaml - (flags - (:include js-of-ocaml-flags-%{profile}))) + (js_of_ocaml) (preprocess (pps ppx_yojson_conv @@ -48,9 +46,7 @@ haz3lschool pretty omd) - (js_of_ocaml - (flags - (:include js-of-ocaml-flags-%{profile}))) + (js_of_ocaml) (preprocess (pps js_of_ocaml-ppx @@ -64,9 +60,6 @@ (modules Main) (libraries ppx_yojson_conv.expander haz3lweb) (modes js) - (js_of_ocaml - (flags - (:include js-of-ocaml-flags-%{profile}))) (preprocess (pps ppx_yojson_conv @@ -86,15 +79,7 @@ (env (dev (js_of_ocaml - (flags (:standard)))) + (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap))) (release (js_of_ocaml (flags (:standard))))) - -(rule - (write-file - js-of-ocaml-flags-dev - "(:standard --debuginfo --noinline --dynlink --linkall --sourcemap)")) - -(rule - (write-file js-of-ocaml-flags-release "(:standard)")) diff --git a/src/pretty/dune b/src/pretty/dune index 8ad0954572..868d03defc 100644 --- a/src/pretty/dune +++ b/src/pretty/dune @@ -5,3 +5,11 @@ (libraries util sexplib) (preprocess (pps ppx_let ppx_sexp_conv))) + +(env + (dev + (js_of_ocaml + (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap))) + (release + (js_of_ocaml + (flags :standard)))) diff --git a/src/util/dune b/src/util/dune index 868e2e0fb9..889c95bd2c 100644 --- a/src/util/dune +++ b/src/util/dune @@ -1,9 +1,7 @@ (library (name util) (libraries re base ptmap incr_dom virtual_dom yojson) - (js_of_ocaml - (flags - (:include js-of-ocaml-flags-%{profile}))) + (js_of_ocaml) (preprocess (pps ppx_yojson_conv @@ -12,10 +10,10 @@ ppx_sexp_conv ppx_deriving.show))) -(rule - (write-file - js-of-ocaml-flags-dev - "(:standard --debuginfo --noinline --dynlink --linkall --sourcemap)")) - -(rule - (write-file js-of-ocaml-flags-release "(:standard)")) +(env + (dev + (js_of_ocaml + (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap))) + (release + (js_of_ocaml + (flags :standard))))