Skip to content

Commit fb4d189

Browse files
authored
Merge pull request #111 from ocaml-wasm/jsoo
Get latest changes from js_of_ocaml
2 parents 102f8dd + badd68f commit fb4d189

File tree

139 files changed

+20620
-19082
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+20620
-19082
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ jobs:
5757
skip-effects: false
5858
skip-test: false
5959
skip-doc: false
60+
# Note this OCaml compiler is bytecode only
61+
- os: ubuntu-latest
62+
ocaml-compiler: "ocaml-variants.5.2.0+options,ocaml-option-32bit"
63+
skip-effects: true # disabled for the same reason than `skip-test`
64+
skip-test: true # the `time_now.0.17` package is pulled and doesn't work in 32 bits :(
65+
skip-doc: true
6066
- os: macos-latest
6167
ocaml-compiler: "5.2"
6268
skip-effects: true
@@ -82,7 +88,7 @@ jobs:
8288
# getting much better, but no luck yet, c.f:
8389
# https://github.com/ocaml/opam-repository/pull/26626
8490
- name: Install apt 32-bit dependencies
85-
if: matrix.ocaml-compiler == 'ocaml-variants.4.14.2+options,ocaml-option-32bit'
91+
if: contains( matrix.ocaml-compiler, 'ocaml-option-32bit')
8692
run: |
8793
sudo apt-get install aptitude
8894
sudo dpkg --add-architecture i386

CHANGES.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@
1717
* Compiler: introduce a Targetint module
1818
that follows the semantic of the backend (js or wasm)
1919
* Compiler: warn on joo_global_object
20+
* Compiler: revisit static env handling (#1708)
21+
* Compiler: Emit index source_map to avoid changing mappings (#1714, #1715)
22+
* Compiler: improved source map generation (#1716)
2023
* Runtime: change Sys.os_type on windows (Cygwin -> Win32)
2124
* Runtime: backtraces are really expensive, they need to be be explicitly
2225
requested at compile time (--enable with-js-error) or at startup (OCAMLRUNPARAM=b=1)
2326
* Runtime: allow dynlink of precompiled js with separate compilation (#1676)
27+
* Runtime: reimplement the runtime of weak and ephemeron (#1707)
2428
* Lib: Modify Typed_array API for compatibility with WebAssembly
25-
29+
* Toplevel: no longer set globals for toplevel initialization
2630

2731
## Bug fixes
2832
* Runtime: fix parsing of unsigned integers (0u2147483648) (#1633, #1666)
2933
* Runtime: fix incorrect pos_in after unmarshalling
34+
* Runtime: make float_of_string stricter (#1609)
3035
* Toplevel: fix missing primitives with separate compilation
3136
* Compiler: fix link of packed modules with separate compilation
3237
* Compiler: Fixed the static evaluation of some equalities (#1659)

biome.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222
"noSwitchDeclarations": "off"
2323
},
2424
"nursery": {
25-
"noUselessEscapeInRegex": "error"
26-
},
27-
"security": {
28-
"noGlobalEval": "off"
25+
"noUselessEscapeInRegex": "error",
26+
"noSubstr": "error"
2927
},
3028
"style": {
3129
"noArguments": "off",
@@ -39,10 +37,7 @@
3937
},
4038
"suspicious": {
4139
"noAssignInExpressions": "off",
42-
"noDoubleEquals": "off",
43-
"noFallthroughSwitchClause": "off",
4440
"noRedeclare": "off",
45-
"noSelfCompare": "off",
4641
"noRedundantUseStrict": "off"
4742
}
4843
}

compiler/bin-js_of_ocaml/build_fs.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ function jsoo_create_file_extern(name,content){
5454
if(globalThis.jsoo_create_file)
5555
globalThis.jsoo_create_file(name,content);
5656
else {
57-
if(!globalThis.caml_fs_tmp) globalThis.caml_fs_tmp = [];
58-
globalThis.caml_fs_tmp.push({name:name,content:content});
57+
if(!globalThis.jsoo_fs_tmp) globalThis.jsoo_fs_tmp = [];
58+
globalThis.jsoo_fs_tmp.push({name:name,content:content});
5959
}
6060
return 0;
6161
}
@@ -74,12 +74,13 @@ function jsoo_create_file_extern(name,content){
7474
let code = Code.prepend Code.empty instr in
7575
Filename.gen_file output_file (fun chan ->
7676
let pfs_fmt = Pretty_print.to_out_channel chan in
77-
let (_ : Source_map.t option) =
77+
let (_ : Source_map.info) =
7878
Driver.f
7979
~standalone:true
8080
~wrap_with_fun:`Iife
8181
~link:`Needed
8282
~formatter:pfs_fmt
83+
~source_map:false
8384
(Parse_bytecode.Debug.create ~include_cmis:false false)
8485
code
8586
in

compiler/bin-js_of_ocaml/cmd_arg.ml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type t =
4343
{ common : Jsoo_cmdline.Arg.t
4444
; (* compile option *)
4545
profile : Driver.profile option
46-
; source_map : (string option * Source_map.t) option
46+
; source_map : (string option * Source_map.Standard.t) option
4747
; runtime_files : string list
4848
; no_runtime : bool
4949
; include_runtime : bool
@@ -280,6 +280,7 @@ let options =
280280
input_file
281281
js_files
282282
keep_unit_names =
283+
let inline_source_content = not sourcemap_don't_inline_content in
283284
let chop_extension s = try Filename.chop_extension s with Invalid_argument _ -> s in
284285
let runtime_files = js_files in
285286
let fs_external = fs_external || (toplevel && no_cmis) in
@@ -302,19 +303,15 @@ let options =
302303
then
303304
let file, sm_output_file =
304305
match output_file with
305-
| `Name file, _ when sourcemap_inline_in_js -> file, None
306-
| `Name file, _ -> file, Some (chop_extension file ^ ".map")
307-
| `Stdout, _ -> "STDIN", None
306+
| `Name file, _ when sourcemap_inline_in_js -> Some file, None
307+
| `Name file, _ -> Some file, Some (chop_extension file ^ ".map")
308+
| `Stdout, _ -> None, None
308309
in
309310
Some
310311
( sm_output_file
311-
, { Source_map.version = 3
312-
; file
312+
, { (Source_map.Standard.empty ~inline_source_content) with
313+
file
313314
; sourceroot = sourcemap_root
314-
; sources = []
315-
; sources_content = (if sourcemap_don't_inline_content then None else Some [])
316-
; names = []
317-
; mappings = Source_map.Mappings.empty
318315
} )
319316
else None
320317
in
@@ -519,6 +516,7 @@ let options_runtime_only =
519516
target_env
520517
output_file
521518
js_files =
519+
let inline_source_content = not sourcemap_don't_inline_content in
522520
let chop_extension s = try Filename.chop_extension s with Invalid_argument _ -> s in
523521
let runtime_files = js_files in
524522
let output_file =
@@ -531,19 +529,15 @@ let options_runtime_only =
531529
then
532530
let file, sm_output_file =
533531
match output_file with
534-
| `Name file, _ when sourcemap_inline_in_js -> file, None
535-
| `Name file, _ -> file, Some (chop_extension file ^ ".map")
536-
| `Stdout, _ -> "STDIN", None
532+
| `Name file, _ when sourcemap_inline_in_js -> Some file, None
533+
| `Name file, _ -> Some file, Some (chop_extension file ^ ".map")
534+
| `Stdout, _ -> None, None
537535
in
538536
Some
539537
( sm_output_file
540-
, { Source_map.version = 3
541-
; file
538+
, { (Source_map.Standard.empty ~inline_source_content) with
539+
file
542540
; sourceroot = sourcemap_root
543-
; sources = []
544-
; sources_content = (if sourcemap_don't_inline_content then None else Some [])
545-
; names = []
546-
; mappings = Source_map.Mappings.empty
547541
} )
548542
else None
549543
in

compiler/bin-js_of_ocaml/cmd_arg.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type t =
2323
{ common : Jsoo_cmdline.Arg.t
2424
; (* compile option *)
2525
profile : Driver.profile option
26-
; source_map : (string option * Source_map.t) option
26+
; source_map : (string option * Source_map.Standard.t) option
2727
; runtime_files : string list
2828
; no_runtime : bool
2929
; include_runtime : bool

0 commit comments

Comments
 (0)