@grain/binaryen.ml 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.32.0](https://github.com/grain-lang/binaryen.ml/compare/v0.31.0...v0.32.0) (2025-11-12)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * Upgrade to Binaryen v122 ([#208](https://github.com/grain-lang/binaryen.ml/issues/208))
9
+ * Correct signature of `get_pass_argument` ([#247](https://github.com/grain-lang/binaryen.ml/issues/247))
10
+
11
+ ### Features
12
+
13
+ * Upgrade to Binaryen v122 ([#208](https://github.com/grain-lang/binaryen.ml/issues/208)) ([434417d](https://github.com/grain-lang/binaryen.ml/commit/434417df5720205824b3fdfa3ce82fa72465c444))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * Correct signature of `get_pass_argument` ([#247](https://github.com/grain-lang/binaryen.ml/issues/247)) ([986ecec](https://github.com/grain-lang/binaryen.ml/commit/986ecec07af320813f4137cfed4d454ae6c13f82))
19
+
3
20
  ## [0.31.0](https://github.com/grain-lang/binaryen.ml/compare/v0.30.0...v0.31.0) (2025-11-02)
4
21
 
5
22
 
@@ -1,5 +1,5 @@
1
1
  opam-version: "2.0"
2
- version: "0.31.0"
2
+ version: "0.32.0"
3
3
  synopsis: "OCaml bindings for Binaryen"
4
4
  maintainer: "oscar@grain-lang.org"
5
5
  author: "Oscar Spencer"
@@ -16,6 +16,6 @@ depends: [
16
16
  "dune" {>= "3.0.0"}
17
17
  "dune-configurator" {>= "3.0.0"}
18
18
  "js_of_ocaml-compiler" {>= "6.0.0" < "7.0.0"}
19
- "libbinaryen" {> "121.0.0" < "122.0.0"}
19
+ "libbinaryen" {>= "122.0.1" < "123.0.0"}
20
20
  ]
21
21
  x-maintenance-intent: ["0.(latest)"]
@@ -1,5 +1,5 @@
1
1
  {
2
- "checksum": "3a14718f627039c7bf5ab17940a38d14",
2
+ "checksum": "55b439676e74c57977482d2499504bd2",
3
3
  "root": "@grain/binaryen.ml@link-dev:./package.json",
4
4
  "node": {
5
5
  "ocaml@5.3.0@d41d8cd9": {
@@ -1960,14 +1960,14 @@
1960
1960
  [ "windows", "x86_64" ]
1961
1961
  ]
1962
1962
  },
1963
- "@grain/libbinaryen@121.0.0-b@d41d8cd9": {
1964
- "id": "@grain/libbinaryen@121.0.0-b@d41d8cd9",
1963
+ "@grain/libbinaryen@122.0.0@d41d8cd9": {
1964
+ "id": "@grain/libbinaryen@122.0.0@d41d8cd9",
1965
1965
  "name": "@grain/libbinaryen",
1966
- "version": "121.0.0-b",
1966
+ "version": "122.0.0",
1967
1967
  "source": {
1968
1968
  "type": "install",
1969
1969
  "source": [
1970
- "archive:https://registry.npmjs.org/@grain/libbinaryen/-/libbinaryen-121.0.0-b.tgz#sha1:0d6f99e9c9f9ed4dd07b3a012ba9c042c13e0783"
1970
+ "archive:https://registry.npmjs.org/@grain/libbinaryen/-/libbinaryen-122.0.0.tgz#sha1:63c01c799e798e88fbf86c60a5b4b151c062e635"
1971
1971
  ]
1972
1972
  },
1973
1973
  "overrides": [],
@@ -1978,7 +1978,6 @@
1978
1978
  "@opam/conf-cmake@github:grain-lang/cmake:esy.json#033cab656dc71a6488b3c1ca6ea45099f794bd03@d41d8cd9"
1979
1979
  ],
1980
1980
  "devDependencies": [],
1981
- "installConfig": { "pnp": false },
1982
1981
  "available": [
1983
1982
  [ "darwin", "x86_64" ],
1984
1983
  [ "darwin", "arm64" ],
@@ -2000,7 +1999,7 @@
2000
1999
  "ocaml@5.3.0@d41d8cd9",
2001
2000
  "@opam/dune-configurator@opam:3.20.2@7eb6ff01",
2002
2001
  "@opam/dune@opam:3.20.2@8daef28d",
2003
- "@grain/libbinaryen@121.0.0-b@d41d8cd9"
2002
+ "@grain/libbinaryen@122.0.0@d41d8cd9"
2004
2003
  ],
2005
2004
  "devDependencies": [
2006
2005
  "@opam/ocamlformat@opam:0.27.0@c40d4612",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@grain/binaryen.ml",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "OCaml bindings for Binaryen.",
5
5
  "author": "Oscar Spencer <oscar@grain-lang.org>",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {
8
8
  "ocaml": ">= 4.13.0 < 5.4.0",
9
- "@grain/libbinaryen": "121.0.0-b",
9
+ "@grain/libbinaryen": ">= 122.0.0 < 123.0.0",
10
10
  "@opam/dune": ">= 3.0.0",
11
11
  "@opam/dune-configurator": ">= 3.0.0"
12
12
  },
@@ -664,8 +664,7 @@ module Binary = struct
664
664
  end
665
665
 
666
666
  module Select = struct
667
- external make : Module.t -> t -> t -> t -> t
668
- = "caml_binaryen_select"
667
+ external make : Module.t -> t -> t -> t -> t = "caml_binaryen_select"
669
668
 
670
669
  (** Module, condition, true branch, false branch. *)
671
670
  let make wasm_mod cond tru fals = make wasm_mod cond tru fals
@@ -72,7 +72,11 @@ caml_binaryen_get_pass_argument(value _name) {
72
72
  CAMLparam1(_name);
73
73
  const char* name = Safe_String_val(_name);
74
74
  const char* val = BinaryenGetPassArgument(name);
75
- CAMLreturn(caml_copy_string(val));
75
+ if (val == NULL) {
76
+ CAMLreturn(Val_none);
77
+ } else {
78
+ CAMLreturn(caml_alloc_some(caml_copy_string(val)));
79
+ }
76
80
  }
77
81
 
78
82
  CAMLprim value
@@ -53,8 +53,11 @@ function caml_binaryen_set_low_memory_unused(on) {
53
53
  //Provides: caml_binaryen_get_pass_argument
54
54
  //Requires: Binaryen
55
55
  //Requires: caml_jsstring_of_string
56
+ //Requires: to_option
56
57
  function caml_binaryen_get_pass_argument(name) {
57
- return Binaryen.getPassArgument(caml_jsstring_of_string(name));
58
+ var val = Binaryen.getPassArgument(caml_jsstring_of_string(name));
59
+ var str = name != null ? val : null;
60
+ return to_option(str);
58
61
  }
59
62
 
60
63
  //Provides: caml_binaryen_set_pass_argument
@@ -11,7 +11,7 @@ external get_low_memory_unused : unit -> bool
11
11
  external set_low_memory_unused : bool -> unit
12
12
  = "caml_binaryen_set_low_memory_unused"
13
13
 
14
- external get_pass_argument : string -> string
14
+ external get_pass_argument : string -> string option
15
15
  = "caml_binaryen_get_pass_argument"
16
16
 
17
17
  external set_pass_argument : string -> string -> unit
@@ -6,7 +6,7 @@ val get_debug_info : unit -> bool
6
6
  val set_debug_info : bool -> unit
7
7
  val get_low_memory_unused : unit -> bool
8
8
  val set_low_memory_unused : bool -> unit
9
- val get_pass_argument : string -> string
9
+ val get_pass_argument : string -> string option
10
10
  val set_pass_argument : string -> string -> unit
11
11
  val get_always_inline_max_size : unit -> int
12
12
  val set_always_inline_max_size : int -> unit
@@ -21,6 +21,13 @@ let wasm_mod = Module.create ()
21
21
  let _ = Module.set_features wasm_mod [ Module.Feature.all ]
22
22
  let import_wasm_mod = Module.create ()
23
23
 
24
+ (* Testing pass_argument *)
25
+ let _ = assert (Settings.get_pass_argument "theKey" = None)
26
+ let _ = Settings.set_pass_argument "theKey" "theValue"
27
+ let _ = assert (Settings.get_pass_argument "theKey" = Some "theValue")
28
+ let _ = Settings.set_pass_argument "theKey" "theValue2"
29
+ let _ = assert (Settings.get_pass_argument "theKey" = Some "theValue2")
30
+
24
31
  let _ =
25
32
  Import.add_memory_import import_wasm_mod "internal_name" "external_name"
26
33
  "external_base_name" true