From e0089188230d7499a8c84e7beae26aeed5e4f79a Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Fri, 7 Jun 2024 23:52:24 -0300 Subject: [PATCH 1/2] update Core to v1.4 --- package-lock.json | 16 ++--- package.json | 2 +- src/ApiDocs.res | 2 +- src/components/SearchBox.res | 3 +- src/vendor/Json.res | 10 +-- src/vendor/Json.resi | 22 ++++--- src/vendor/Json_decode.res | 116 +++++++++++++++++------------------ src/vendor/Json_decode.resi | 42 ++++++------- src/vendor/Json_encode.res | 30 ++++----- src/vendor/Json_encode.resi | 44 ++++++------- 10 files changed, 145 insertions(+), 142 deletions(-) diff --git a/package-lock.json b/package-lock.json index f152fa7bb..ffaac814c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@docsearch/react": "^3.5.2", "@headlessui/react": "^1.2.0", "@mdx-js/loader": "^2.3.0", - "@rescript/core": "^1.3.0", + "@rescript/core": "^1.4.0", "@rescript/react": "^0.12.0-alpha.3", "@rescript/tools": "^0.5.0", "acorn": "^8.11.3", @@ -59,7 +59,7 @@ "tailwindcss": "^3.3.3" }, "engines": { - "node": ">=18" + "node": ">=20" } }, "node_modules/@algolia/autocomplete-core": { @@ -1571,9 +1571,9 @@ } }, "node_modules/@rescript/core": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@rescript/core/-/core-1.3.0.tgz", - "integrity": "sha512-wNZOZ63sYcaIYZCmTZeIPCeLa3HCGgPbIOR8zjyNkoBYUlxNV8Nb2ZyqlXR5Mb9ttvv8fTV56JbKhyVEZEYo8g==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@rescript/core/-/core-1.4.0.tgz", + "integrity": "sha512-2zwlYp/SFvjb9M4PcS+NCTNXeXJ9ZHSn5Q4o+EQq9Yfc1jOgsAWqBhu7RW6n2IceugH0H/6eZjqYT7IZAoLRsw==", "peerDependencies": { "rescript": "^11.1.0-rc.7" } @@ -14968,9 +14968,9 @@ } }, "@rescript/core": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@rescript/core/-/core-1.3.0.tgz", - "integrity": "sha512-wNZOZ63sYcaIYZCmTZeIPCeLa3HCGgPbIOR8zjyNkoBYUlxNV8Nb2ZyqlXR5Mb9ttvv8fTV56JbKhyVEZEYo8g==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@rescript/core/-/core-1.4.0.tgz", + "integrity": "sha512-2zwlYp/SFvjb9M4PcS+NCTNXeXJ9ZHSn5Q4o+EQq9Yfc1jOgsAWqBhu7RW6n2IceugH0H/6eZjqYT7IZAoLRsw==", "requires": {} }, "@rescript/react": { diff --git a/package.json b/package.json index 0ebd6c802..8257742c4 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@docsearch/react": "^3.5.2", "@headlessui/react": "^1.2.0", "@mdx-js/loader": "^2.3.0", - "@rescript/core": "^1.3.0", + "@rescript/core": "^1.4.0", "@rescript/react": "^0.12.0-alpha.3", "@rescript/tools": "^0.5.0", "acorn": "^8.11.3", diff --git a/src/ApiDocs.res b/src/ApiDocs.res index 453fb7816..0326e502e 100644 --- a/src/ApiDocs.res +++ b/src/ApiDocs.res @@ -477,7 +477,7 @@ let processStaticProps = (~slug: array, ~version: string) => { Variant({items: items})->Null.make } - | None => Js.Null.empty + | None => Null.null } Type({ id, diff --git a/src/components/SearchBox.res b/src/components/SearchBox.res index 2dc0c0c65..3e9c6ad21 100644 --- a/src/components/SearchBox.res +++ b/src/components/SearchBox.res @@ -29,8 +29,7 @@ let make = ( let onAreaFocus = evt => { let el = ReactEvent.Focus.target(evt) - // TODO(aspeddro): Replace with `Nullable.isNullable` when Core merge https://github.com/rescript-association/rescript-core/pull/227 and publish a new release - let isDiv = Js.Null_undefined.isNullable(el["type"]) + let isDiv = Nullable.isNullable(el["type"]) if isDiv && state === Inactive { focusInput() diff --git a/src/vendor/Json.res b/src/vendor/Json.res index 7ea25ccb2..873213579 100644 --- a/src/vendor/Json.res +++ b/src/vendor/Json.res @@ -4,18 +4,18 @@ module Encode = Json_encode exception ParseError(string) let parse = s => - try Some(Js.Json.parseExn(s)) catch { + try Some(JSON.parseExn(s)) catch { | _ => None } let parseOrRaise = s => - try Js.Json.parseExn(s) catch { - | Js.Exn.Error(e) => - let message = switch Js.Exn.message(e) { + try JSON.parseExn(s) catch { + | Exn.Error(e) => + let message = switch Exn.message(e) { | Some(m) => m | None => "Unknown error" } \"@@"(raise, ParseError(message)) } -@val external stringify: Js.Json.t => string = "JSON.stringify" +@val external stringify: JSON.t => string = "JSON.stringify" diff --git a/src/vendor/Json.resi b/src/vendor/Json.resi index f2cf4441d..be7f60f58 100644 --- a/src/vendor/Json.resi +++ b/src/vendor/Json.resi @@ -106,13 +106,19 @@ module Encode = Json_encode exception ParseError(string) -@ocaml.doc(" [parse s] returns [Some json] if s is a valid json string, [None] otherwise ") -let parse: string => option +/** +`parse(s)` returns `option` if s is a valid json string, `None` +otherwise +*/ +let parse: string => option -@ocaml.doc( - " [parse s] returns a [Js.Json.t] if s is a valid json string, raises [ParseError] otherwise " -) -let parseOrRaise: string => Js.Json.t +/** +`parse(s)` returns a `JSON.t` if `s` is a valid json string, raises +`ParseError` otherwise +*/ +let parseOrRaise: string => JSON.t -@ocaml.doc(" [stringify json] returns the [string] representation of the given [Js.Json.t] value ") -let stringify: Js.Json.t => string +/** +stringify(json)` returns the `string` representation of the given `JSON.t` value +*/ +let stringify: JSON.t => string diff --git a/src/vendor/Json_decode.res b/src/vendor/Json_decode.res index 1281a94dd..ec71e6107 100644 --- a/src/vendor/Json_decode.res +++ b/src/vendor/Json_decode.res @@ -1,27 +1,25 @@ @new external _unsafeCreateUninitializedArray: int => array<'a> = "Array" -@val external _stringify: Js.Json.t => string = "JSON.stringify" +let _isInteger = value => Float.isFinite(value) && Math.floor(value) === value -let _isInteger = value => Js.Float.isFinite(value) && Js.Math.floor_float(value) === value - -type decoder<'a> = Js.Json.t => 'a +type decoder<'a> = JSON.t => 'a exception DecodeError(string) let id = json => json let bool = json => - if Js.typeof(json) == "boolean" { - (Obj.magic((json: Js.Json.t)): bool) + if typeof(json) == #boolean { + (Obj.magic((json: JSON.t)): bool) } else { - \"@@"(raise, DecodeError("Expected boolean, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected boolean, got " ++ JSON.stringify(json))) } let float = json => - if Js.typeof(json) == "number" { - (Obj.magic((json: Js.Json.t)): float) + if typeof(json) == #number { + (Obj.magic((json: JSON.t)): float) } else { - \"@@"(raise, DecodeError("Expected number, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected number, got " ++ JSON.stringify(json))) } let int = json => { @@ -29,15 +27,15 @@ let int = json => { if _isInteger(f) { (Obj.magic((f: float)): int) } else { - \"@@"(raise, DecodeError("Expected integer, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected integer, got " ++ JSON.stringify(json))) } } let string = json => - if Js.typeof(json) == "string" { - (Obj.magic((json: Js.Json.t)): string) + if typeof(json) == #string { + (Obj.magic((json: JSON.t)): string) } else { - \"@@"(raise, DecodeError("Expected string, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected string, got " ++ JSON.stringify(json))) } let char = json => { @@ -45,51 +43,51 @@ let char = json => { if String.length(s) == 1 { OCamlCompat.String.get(s, 0) } else { - \"@@"(raise, DecodeError("Expected single-character string, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected single-character string, got " ++ JSON.stringify(json))) } } -let date = json => Js.Date.fromString(string(json)) +let date = json => Date.fromString(string(json)) let nullable = (decode, json) => - if (Obj.magic(json): Js.null<'a>) === Js.null { - Js.null + if (Obj.magic(json): Null.t<'a>) === Null.null { + Null.null } else { - Js.Null.return(decode(json)) + Null.make(decode(json)) } /* TODO: remove this? */ let nullAs = (value, json) => - if (Obj.magic(json): Js.null<'a>) === Js.null { + if (Obj.magic(json): Null.t<'a>) === Null.null { value } else { - \"@@"(raise, DecodeError("Expected null, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected null, got " ++ JSON.stringify(json))) } let array = (decode, json) => - if Js.Array.isArray(json) { - let source: array = Obj.magic((json: Js.Json.t)) - let length = Js.Array.length(source) + if Array.isArray(json) { + let source: array = Obj.magic((json: JSON.t)) + let length = Array.length(source) let target = _unsafeCreateUninitializedArray(length) for i in 0 to length - 1 { let value = try decode(Array.getUnsafe(source, i)) catch { | DecodeError(msg) => - \"@@"(raise, DecodeError(msg ++ ("\n\tin array at index " ++ string_of_int(i)))) + \"@@"(raise, DecodeError(msg ++ ("\n\tin array at index " ++ Int.toString(i)))) } Array.setUnsafe(target, i, value) } target } else { - \"@@"(raise, DecodeError("Expected array, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected array, got " ++ JSON.stringify(json))) } let list = (decode, json) => array(decode, json)->List.fromArray let pair = (decodeA, decodeB, json) => - if Js.Array.isArray(json) { - let source: array = Obj.magic((json: Js.Json.t)) - let length = Js.Array.length(source) + if Array.isArray(json) { + let source: array = Obj.magic((json: JSON.t)) + let length = Array.length(source) if length == 2 { try (decodeA(Array.getUnsafe(source, 0)), decodeB(Array.getUnsafe(source, 1))) catch { | DecodeError(msg) => \"@@"(raise, DecodeError(msg ++ "\n\tin pair/tuple2")) @@ -97,19 +95,19 @@ let pair = (decodeA, decodeB, json) => } else { \"@@"( raise, - DecodeError(`Expected array of length 2, got array of length ${length->string_of_int}`), + DecodeError(`Expected array of length 2, got array of length ${length->Int.toString}`), ) } } else { - \"@@"(raise, DecodeError("Expected array, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected array, got " ++ JSON.stringify(json))) } let tuple2 = pair let tuple3 = (decodeA, decodeB, decodeC, json) => - if Js.Array.isArray(json) { - let source: array = Obj.magic((json: Js.Json.t)) - let length = Js.Array.length(source) + if Array.isArray(json) { + let source: array = Obj.magic((json: JSON.t)) + let length = Array.length(source) if length == 3 { try ( decodeA(Array.getUnsafe(source, 0)), @@ -121,17 +119,17 @@ let tuple3 = (decodeA, decodeB, decodeC, json) => } else { \"@@"( raise, - DecodeError(`Expected array of length 3, got array of length ${length->string_of_int}`), + DecodeError(`Expected array of length 3, got array of length ${length->Int.toString}`), ) } } else { - \"@@"(raise, DecodeError("Expected array, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected array, got " ++ JSON.stringify(json))) } let tuple4 = (decodeA, decodeB, decodeC, decodeD, json) => - if Js.Array.isArray(json) { - let source: array = Obj.magic((json: Js.Json.t)) - let length = Js.Array.length(source) + if Array.isArray(json) { + let source: array = Obj.magic((json: JSON.t)) + let length = Array.length(source) if length == 4 { try ( decodeA(Array.getUnsafe(source, 0)), @@ -144,44 +142,44 @@ let tuple4 = (decodeA, decodeB, decodeC, decodeD, json) => } else { \"@@"( raise, - DecodeError(`Expected array of length 4, got array of length ${length->string_of_int}`), + DecodeError(`Expected array of length 4, got array of length ${length->Int.toString}`), ) } } else { - \"@@"(raise, DecodeError("Expected array, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected array, got " ++ JSON.stringify(json))) } let dict = (decode, json) => if ( - Js.typeof(json) == "object" && - (!Js.Array.isArray(json) && - !((Obj.magic(json): Js.null<'a>) === Js.null)) + typeof(json) == #object && + (!Array.isArray(json) && + !((Obj.magic(json): Null.t<'a>) === Null.null)) ) { - let source: Js.Dict.t = Obj.magic((json: Js.Json.t)) - let keys = Js.Dict.keys(source) - let l = Js.Array.length(keys) - let target = Js.Dict.empty() + let source: Dict.t = Obj.magic((json: JSON.t)) + let keys = Dict.keysToArray(source) + let l = Array.length(keys) + let target = Dict.make() for i in 0 to l - 1 { let key = Array.getUnsafe(keys, i) - let value = try decode(Js.Dict.unsafeGet(source, key)) catch { + let value = try decode(Dict.getUnsafe(source, key)) catch { | DecodeError(msg) => \"@@"(raise, DecodeError(msg ++ "\n\tin dict")) } - Js.Dict.set(target, key, value) + Dict.set(target, key, value) } target } else { - \"@@"(raise, DecodeError("Expected object, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected object, got " ++ JSON.stringify(json))) } let field = (key, decode, json) => if ( - Js.typeof(json) == "object" && - (!Js.Array.isArray(json) && - !((Obj.magic(json): Js.null<'a>) === Js.null)) + typeof(json) == #object && + (!Array.isArray(json) && + !((Obj.magic(json): Null.t<'a>) === Null.null)) ) { - let dict: Js.Dict.t = Obj.magic((json: Js.Json.t)) - switch Js.Dict.get(dict, key) { + let dict: Dict.t = Obj.magic((json: JSON.t)) + switch Dict.get(dict, key) { | Some(value) => try decode(value) catch { | DecodeError(msg) => \"@@"(raise, DecodeError(msg ++ ("\n\tat field '" ++ (key ++ "'")))) @@ -189,7 +187,7 @@ let field = (key, decode, json) => | None => \"@@"(raise, DecodeError(`Expected field '${key}'`)) } } else { - \"@@"(raise, DecodeError("Expected object, got " ++ _stringify(json))) + \"@@"(raise, DecodeError("Expected object, got " ++ JSON.stringify(json))) } let rec at = (key_path, decoder, json) => @@ -208,12 +206,12 @@ let oneOf = (decoders, json) => { let rec inner = (decoders, errors) => switch decoders { | list{} => - let formattedErrors = "\n- " ++ Js.Array.joinWith("\n- ", List.toArray(List.reverse(errors))) + let formattedErrors = "\n- " ++ Array.join(List.toArray(List.reverse(errors)), "\n- ") \"@@"( raise, DecodeError( `All decoders given to oneOf failed. Here are all the errors: ${formattedErrors}\\nAnd the JSON being decoded: ` ++ - _stringify(json), + JSON.stringify(json), ), ) | list{decode, ...rest} => diff --git a/src/vendor/Json_decode.resi b/src/vendor/Json_decode.resi index f558c5a81..af54f08e3 100644 --- a/src/vendor/Json_decode.resi +++ b/src/vendor/Json_decode.resi @@ -1,28 +1,28 @@ -type decoder<'a> = Js.Json.t => 'a +type decoder<'a> = JSON.t => 'a exception DecodeError(string) -let id: decoder -let bool: Js.Json.t => bool -let float: Js.Json.t => float -let int: Js.Json.t => int -let string: Js.Json.t => string -let char: Js.Json.t => char -let date: Js.Json.t => Js.Date.t -let nullable: ('a => 'b, 'a) => Js.Null.t<'b> -let nullAs: ('a, Js.Json.t) => 'a -let array: (decoder<'a>, Js.Json.t) => array<'a> -let list: (decoder<'a>, Js.Json.t) => list<'a> -let pair: (decoder<'a>, decoder<'b>, Js.Json.t) => ('a, 'b) -let tuple2: (decoder<'a>, decoder<'b>, Js.Json.t) => ('a, 'b) -let tuple3: (decoder<'a>, decoder<'b>, decoder<'c>, Js.Json.t) => ('a, 'b, 'c) -let tuple4: (decoder<'a>, decoder<'b>, decoder<'c>, decoder<'d>, Js.Json.t) => ('a, 'b, 'c, 'd) -let dict: (decoder<'a>, Js.Json.t) => Js.Dict.t<'a> -let field: (Js.Dict.key, decoder<'a>, Js.Json.t) => 'a -let at: (list, decoder<'a>, Js.Json.t) => 'a +let id: decoder +let bool: JSON.t => bool +let float: JSON.t => float +let int: JSON.t => int +let string: JSON.t => string +let char: JSON.t => char +let date: JSON.t => Date.t +let nullable: ('a => 'b, 'a) => Null.t<'b> +let nullAs: ('a, JSON.t) => 'a +let array: (decoder<'a>, JSON.t) => array<'a> +let list: (decoder<'a>, JSON.t) => list<'a> +let pair: (decoder<'a>, decoder<'b>, JSON.t) => ('a, 'b) +let tuple2: (decoder<'a>, decoder<'b>, JSON.t) => ('a, 'b) +let tuple3: (decoder<'a>, decoder<'b>, decoder<'c>, JSON.t) => ('a, 'b, 'c) +let tuple4: (decoder<'a>, decoder<'b>, decoder<'c>, decoder<'d>, JSON.t) => ('a, 'b, 'c, 'd) +let dict: (decoder<'a>, JSON.t) => Dict.t<'a> +let field: (string, decoder<'a>, JSON.t) => 'a +let at: (list, decoder<'a>, JSON.t) => 'a let optional: ('a => 'b, 'a) => option<'b> -let oneOf: (list>, Js.Json.t) => 'a -let either: (decoder<'a>, decoder<'a>) => Js.Json.t => 'a +let oneOf: (list>, JSON.t) => 'a +let either: (decoder<'a>, decoder<'a>) => JSON.t => 'a let withDefault: ('a, 'b => 'a, 'b) => 'a let map: ('a => 'b, 'c => 'a, 'c) => 'b let andThen: ('a => 'b => 'c, 'b => 'a, 'b) => 'c diff --git a/src/vendor/Json_encode.res b/src/vendor/Json_encode.res index dc798aa95..f66096108 100644 --- a/src/vendor/Json_encode.res +++ b/src/vendor/Json_encode.res @@ -1,14 +1,14 @@ -type encoder<'a> = 'a => Js.Json.t +type encoder<'a> = 'a => JSON.t -@val external null: Js.Json.t = "null" -external string: string => Js.Json.t = "%identity" -external float: float => Js.Json.t = "%identity" -external int: int => Js.Json.t = "%identity" -external bool: bool => Js.Json.t = "%identity" +@val external null: JSON.t = "null" +external string: string => JSON.t = "%identity" +external float: float => JSON.t = "%identity" +external int: int => JSON.t = "%identity" +external bool: bool => JSON.t = "%identity" let char = c => string(OCamlCompat.String.make(1, c)) -let date = d => string(Js.Date.toJSONUnsafe(d)) +let date = d => string(Date.toJSON(d)->Option.getUnsafe) let nullable = (encode, x) => switch x { @@ -22,16 +22,16 @@ let withDefault = (d, encode, x) => | Some(v) => encode(v) } -external jsonDict: Js_dict.t => Js.Json.t = "%identity" +external jsonDict: Dict.t => JSON.t = "%identity" let dict = (encode, d) => { - let pairs = Js.Dict.entries(d) + let pairs = Dict.toArray(d) let encodedPairs = pairs->Array.map(((k, v)) => (k, encode(v))) - jsonDict(Js.Dict.fromArray(encodedPairs)) + jsonDict(Dict.fromArray(encodedPairs)) } -let object_ = (props): Js.Json.t => jsonDict(Js.Dict.fromList(props)) +let object_ = (props): JSON.t => jsonDict(Dict.fromArray(props->List.toArray)) -external jsonArray: array => Js.Json.t = "%identity" +external jsonArray: array => JSON.t = "%identity" let array = (encode, l) => jsonArray(l->Array.map(x => encode(x))) let list = (encode, x) => switch x { @@ -56,6 +56,6 @@ let tuple3 = (encodeA, encodeB, encodeC, (a, b, c)) => let tuple4 = (encodeA, encodeB, encodeC, encodeD, (a, b, c, d)) => jsonArray([encodeA(a), encodeB(b), encodeC(c), encodeD(d)]) -external stringArray: array => Js.Json.t = "%identity" -external numberArray: array => Js.Json.t = "%identity" -external boolArray: array => Js.Json.t = "%identity" +external stringArray: array => JSON.t = "%identity" +external numberArray: array => JSON.t = "%identity" +external boolArray: array => JSON.t = "%identity" diff --git a/src/vendor/Json_encode.resi b/src/vendor/Json_encode.resi index 957fd1453..2ccf46ee3 100644 --- a/src/vendor/Json_encode.resi +++ b/src/vendor/Json_encode.resi @@ -1,24 +1,24 @@ -type encoder<'a> = 'a => Js.Json.t +type encoder<'a> = 'a => JSON.t -@val external null: Js.Json.t = "null" -external string: string => Js.Json.t = "%identity" -external float: float => Js.Json.t = "%identity" -external int: int => Js.Json.t = "%identity" -external bool: bool => Js.Json.t = "%identity" -let char: char => Js.Json.t -let date: Js.Date.t => Js.Json.t -let nullable: (encoder<'a>, option<'a>) => Js.Json.t +@val external null: JSON.t = "null" +external string: string => JSON.t = "%identity" +external float: float => JSON.t = "%identity" +external int: int => JSON.t = "%identity" +external bool: bool => JSON.t = "%identity" +let char: char => JSON.t +let date: Date.t => JSON.t +let nullable: (encoder<'a>, option<'a>) => JSON.t let withDefault: ('a, 'b => 'a, option<'b>) => 'a -external jsonDict: Js_dict.t => Js.Json.t = "%identity" -let dict: (encoder<'a>, Js.Dict.t<'a>) => Js.Json.t -let object_: list<(Js.Dict.key, Js.Json.t)> => Js.Json.t -external jsonArray: array => Js.Json.t = "%identity" -let array: (encoder<'a>, array<'a>) => Js.Json.t -let list: (encoder<'a>, list<'a>) => Js.Json.t -let pair: (encoder<'a>, encoder<'b>, ('a, 'b)) => Js.Json.t -let tuple2: (encoder<'a>, encoder<'b>, ('a, 'b)) => Js.Json.t -let tuple3: (encoder<'a>, encoder<'b>, encoder<'c>, ('a, 'b, 'c)) => Js.Json.t -let tuple4: (encoder<'a>, encoder<'b>, encoder<'c>, encoder<'d>, ('a, 'b, 'c, 'd)) => Js.Json.t -external stringArray: array => Js.Json.t = "%identity" -external numberArray: array => Js.Json.t = "%identity" -external boolArray: array => Js.Json.t = "%identity" +external jsonDict: Dict.t => JSON.t = "%identity" +let dict: (encoder<'a>, Dict.t<'a>) => JSON.t +let object_: list<(string, JSON.t)> => JSON.t +external jsonArray: array => JSON.t = "%identity" +let array: (encoder<'a>, array<'a>) => JSON.t +let list: (encoder<'a>, list<'a>) => JSON.t +let pair: (encoder<'a>, encoder<'b>, ('a, 'b)) => JSON.t +let tuple2: (encoder<'a>, encoder<'b>, ('a, 'b)) => JSON.t +let tuple3: (encoder<'a>, encoder<'b>, encoder<'c>, ('a, 'b, 'c)) => JSON.t +let tuple4: (encoder<'a>, encoder<'b>, encoder<'c>, encoder<'d>, ('a, 'b, 'c, 'd)) => JSON.t +external stringArray: array => JSON.t = "%identity" +external numberArray: array => JSON.t = "%identity" +external boolArray: array => JSON.t = "%identity" From f7698aa41ebc5fc0250203bbb82891c7557237b2 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sat, 8 Jun 2024 00:01:17 -0300 Subject: [PATCH 2/2] remove stringify --- src/vendor/Json.res | 2 -- src/vendor/Json.resi | 5 ----- 2 files changed, 7 deletions(-) diff --git a/src/vendor/Json.res b/src/vendor/Json.res index 873213579..155303735 100644 --- a/src/vendor/Json.res +++ b/src/vendor/Json.res @@ -17,5 +17,3 @@ let parseOrRaise = s => } \"@@"(raise, ParseError(message)) } - -@val external stringify: JSON.t => string = "JSON.stringify" diff --git a/src/vendor/Json.resi b/src/vendor/Json.resi index be7f60f58..debe862c1 100644 --- a/src/vendor/Json.resi +++ b/src/vendor/Json.resi @@ -117,8 +117,3 @@ let parse: string => option `ParseError` otherwise */ let parseOrRaise: string => JSON.t - -/** -stringify(json)` returns the `string` representation of the given `JSON.t` value -*/ -let stringify: JSON.t => string