From 84c5aa7fa718845c97cb3ddfbbf39751f130108d Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Sun, 4 Aug 2024 11:35:15 -0400 Subject: [PATCH 1/5] Begin trying to get source maps working --- src/haz3lcore/dune | 3 +-- src/haz3lweb/dune | 13 +++---------- src/util/dune | 3 +-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/haz3lcore/dune b/src/haz3lcore/dune index 6a2a51984d..d6e9f32450 100644 --- a/src/haz3lcore/dune +++ b/src/haz3lcore/dune @@ -4,8 +4,7 @@ (name haz3lcore) (libraries util sexplib unionFind uuidm virtual_dom yojson core) (js_of_ocaml - (flags - (:include js-of-ocaml-flags-%{profile}))) + (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap)) (preprocess (pps ppx_yojson_conv diff --git a/src/haz3lweb/dune b/src/haz3lweb/dune index 4874cbf066..e25a0c1413 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 @@ -50,7 +48,7 @@ omd) (js_of_ocaml (flags - (:include js-of-ocaml-flags-%{profile}))) + (:standard --debuginfo --noinline --dynlink --linkall --sourcemap))) (preprocess (pps js_of_ocaml-ppx @@ -64,9 +62,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 @@ -84,9 +79,7 @@ (pps js_of_ocaml-ppx))) (env - (dev - (js_of_ocaml - (flags (:standard)))) + (dev (js_of_ocaml)) (release (js_of_ocaml (flags (:standard))))) diff --git a/src/util/dune b/src/util/dune index 868e2e0fb9..17646a68b8 100644 --- a/src/util/dune +++ b/src/util/dune @@ -2,8 +2,7 @@ (name util) (libraries re base ptmap incr_dom virtual_dom yojson) (js_of_ocaml - (flags - (:include js-of-ocaml-flags-%{profile}))) + (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap)) (preprocess (pps ppx_yojson_conv From fda7f35a3cfb0791350cdfbfaf9e66ef40fee50a Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Tue, 6 Aug 2024 11:40:58 -0400 Subject: [PATCH 2/5] Move flags to env and remove rules --- src/haz3lcore/dune | 17 ++++++++--------- src/haz3lweb/dune | 16 ++++------------ src/util/dune | 17 ++++++++--------- 3 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/haz3lcore/dune b/src/haz3lcore/dune index d6e9f32450..77e2ca3fe1 100644 --- a/src/haz3lcore/dune +++ b/src/haz3lcore/dune @@ -3,8 +3,7 @@ (library (name haz3lcore) (libraries util sexplib unionFind uuidm virtual_dom yojson core) - (js_of_ocaml - (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap)) + (js_of_ocaml) (preprocess (pps ppx_yojson_conv @@ -13,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/haz3lweb/dune b/src/haz3lweb/dune index e25a0c1413..8d25155dc5 100644 --- a/src/haz3lweb/dune +++ b/src/haz3lweb/dune @@ -46,9 +46,7 @@ haz3lschool pretty omd) - (js_of_ocaml - (flags - (:standard --debuginfo --noinline --dynlink --linkall --sourcemap))) + (js_of_ocaml) (preprocess (pps js_of_ocaml-ppx @@ -79,15 +77,9 @@ (pps js_of_ocaml-ppx))) (env - (dev (js_of_ocaml)) + (dev + (js_of_ocaml + (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/util/dune b/src/util/dune index 17646a68b8..889c95bd2c 100644 --- a/src/util/dune +++ b/src/util/dune @@ -1,8 +1,7 @@ (library (name util) (libraries re base ptmap incr_dom virtual_dom yojson) - (js_of_ocaml - (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap)) + (js_of_ocaml) (preprocess (pps ppx_yojson_conv @@ -11,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)))) From 458dd6c98a413d4db0d81a77892257d04607bf58 Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Fri, 9 Aug 2024 11:13:16 -0400 Subject: [PATCH 3/5] Update readme on source maps --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bc155e407..7cfd06cc6a 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,18 @@ 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: +```dune +(env + (dev + (js_of_ocaml + (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap))) + (release + (js_of_ocaml + (flags :standard)))) +``` + +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. From 990f5e8d797761b11b99524caaa8df77cdca843a Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Fri, 9 Aug 2024 11:27:34 -0400 Subject: [PATCH 4/5] Add js_of_caml env stanzas to pretty and haz3lschool --- src/haz3lschool/dune | 8 ++++++++ src/pretty/dune | 8 ++++++++ 2 files changed, 16 insertions(+) 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/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)))) From 0f3d80d3ac7e07670b26e0ec4ae47036723b12ef Mon Sep 17 00:00:00 2001 From: Cyrus Omar Date: Fri, 9 Aug 2024 20:17:59 -0400 Subject: [PATCH 5/5] don't need dune code in README --- README.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/README.md b/README.md index 7cfd06cc6a..a15bdd424e 100644 --- a/README.md +++ b/README.md @@ -185,16 +185,7 @@ 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 -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: -```dune -(env - (dev - (js_of_ocaml - (flags :standard --debuginfo --noinline --dynlink --linkall --sourcemap))) - (release - (js_of_ocaml - (flags :standard)))) -``` +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.