Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"author": "",
"license": "MIT",
"dependencies": {
"@rescript/core": "0.6.0",
"rescript": "11.0.0"
"@rescript/core": "1.6.1",
"rescript": "^12.0.0-alpha.5 "
}
}
4 changes: 2 additions & 2 deletions src/Assert.res
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ external assertLess: ('a, 'a, ~msg: string=?) => unit = "assertLess"
external assertLessOrEqual: ('a, 'a, ~msg: string=?) => unit = "assertLessOrEqual"

@module("https://deno.land/[email protected]/assert/mod.ts")
external assertMatch: (string, Js.Re.t, ~msg: string=?) => unit = "assertMatch"
external assertMatch: (string, RegExp.t, ~msg: string=?) => unit = "assertMatch"

@module("https://deno.land/[email protected]/assert/mod.ts")
external assertNotEquals: ('a, 'a, ~msg: string=?) => unit = "assertNotEquals"

@module("https://deno.land/[email protected]/assert/mod.ts")
external assertNotMatch: (string, Js.Re.t, ~msg: string=?) => unit = "assertNotMatch"
external assertNotMatch: (string, RegExp.t, ~msg: string=?) => unit = "assertNotMatch"

@module("https://deno.land/[email protected]/assert/mod.ts")
external assertNotStrictEquals: ('a, 'a, ~msg: string=?) => unit = "assertNotStrictEquals"
Expand Down
12 changes: 6 additions & 6 deletions src/Deno.res
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ module ListenTlsOptions = {
cert?: string,
certFile?: string,
keyFile?: string,
alpnProtocols?: Belt.Array.t<string>,
alpnProtocols?: array<string>,
}
}

Expand Down Expand Up @@ -352,8 +352,8 @@ module ConnectTlsOptions = {
port: int,
hostname?: string,
certFile?: string,
caCerts?: Belt.Array.t<string>,
alpnProtocols?: Belt.Array.t<string>,
caCerts?: array<string>,
alpnProtocols?: array<string>,
certChain?: string,
privateKey?: string,
}
Expand Down Expand Up @@ -408,14 +408,14 @@ module ResolveDnsOptions = {
module StartTlsOptions = {
type t = {
hostname?: string,
caCerts?: Belt.Array.t<string>,
alpnProtocols?: Belt.Array.t<string>,
caCerts?: array<string>,
alpnProtocols?: array<string>,
}
}

module CommandOptions = {
type t<'a> = {
args?: Belt.Array.t<string>,
args?: array<string>,
cwd?: string,
clearEnv?: bool,
env?: 'a,
Expand Down
190 changes: 85 additions & 105 deletions src/Globals.res
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module Event = {
@get external _CAPTURING_PHASE: t => int = "CAPTURING_PHASE"
@get external _NONE: t => int = "NONE"

@send external composedPath: t => Belt.Array.t<EventTarget.t> = "composedPath"
@send external composedPath: t => array<EventTarget.t> = "composedPath"
@send external preventDefault: t => unit = "preventDefault"
@send external stopImmediatePropagation: t => unit = "stopImmediatePropagation"
@send external stopPropagation: t => unit = "stopPropagation"
Expand Down Expand Up @@ -204,7 +204,7 @@ module GPUSupportedLimits = {

module GPUDeviceDescriptor = {
type t
@get external requiredFeatures: t => Belt.Array.t<string> = "extensions"
@get external requiredFeatures: t => array<string> = "extensions"
@get external requiredLimits: t => 'a = "requiredLimits"
}

Expand Down Expand Up @@ -246,10 +246,8 @@ module GPUAdapter = {
@get external limits: t => GPUSupportedLimits.t = "limits"
@get external isFallbackAdapter: t => bool = "isFallbackAdapter"
@send
external requestAdapterInfo: (
t,
~unmaskHints: Belt.Array.t<string>=?,
) => Promise.t<GPUAdapterInfo.t> = "requestAdapterInfo"
external requestAdapterInfo: (t, ~unmaskHints: array<string>=?) => Promise.t<GPUAdapterInfo.t> =
"requestAdapterInfo"
@send
external requestDevice: (t, ~descriptor: GPUDeviceDescriptor.t=?) => Promise.t<GPUDevice.t> =
"requestDevice"
Expand All @@ -268,7 +266,7 @@ module Navigator = {
@get external hardwareConcurrency: t => int = "hardwareConcurrency"
@get external userAgent: t => string = "userAgent"
@get external language: t => string = "language"
@get external languages: t => Belt.Array.t<string> = "languages"
@get external languages: t => array<string> = "languages"
}

module URLSearchParams = {
Expand All @@ -277,11 +275,11 @@ module URLSearchParams = {
@get external size: t => int = "size"
@send external append: (t, string, string) => unit = "append"
@send external delete: (t, string) => unit = "delete"
@send external getAll: (t, string) => Belt.Array.t<string> = "getAll"
@send external getAll: (t, string) => array<string> = "getAll"
@send external entries: t => 'a = "entries"
@send external forEach: (t, (string, string, 'b) => unit, ~thisArg: 'c=?) => unit = "forEach"
@send external get: (t, string) => string = "get"
@send external getAll: (t, string) => Belt.Array.t<string> = "getAll"
@send external getAll: (t, string) => array<string> = "getAll"
@send external has: (t, string) => bool = "has"
@send external keys: t => 'a = "keys"
@send external set: (t, string, string) => unit = "set"
Expand Down Expand Up @@ -351,7 +349,7 @@ module URLPattern = {

@send external test: (t, URLPatternInput.t, ~baseURL: string=?) => bool = "test"
@send
external exec: (t, URLPatternInput.t, ~baseURL: string=?) => option<Belt.Array.t<string>> = "exec"
external exec: (t, URLPatternInput.t, ~baseURL: string=?) => option<array<string>> = "exec"
}

module ErrorEventInit = {
Expand Down Expand Up @@ -469,7 +467,7 @@ module ReadableStream = {

@send external pipeTo: ('a, ~options: PipeOptions.t=?) => Promise.t<unit> = "pipeTo"

@send external tee: t<'a> => Belt.Array.t<t<'b>> = "tee"
@send external tee: t<'a> => array<t<'b>> = "tee"

@send external values: (t<'a>, ~options: 'b=?) => 'c = "values"
}
Expand All @@ -489,7 +487,7 @@ module Headers = {
@send external get: (t, string) => option<string> = "get"
@send external has: (t, string) => bool = "has"
@send external set: (t, string, string) => unit = "set"
@send external getSetCookie: t => Belt.Array.t<string> = "getSetCookie"
@send external getSetCookie: t => array<string> = "getSetCookie"
}

module BufferSource = {
Expand All @@ -498,8 +496,8 @@ module BufferSource = {

module BlobParts = {
type t =
| BufferSources(Belt.Array.t<BufferSource.t>)
| Strings(Belt.Array.t<string>)
| BufferSources(array<BufferSource.t>)
| Strings(array<string>)
}

module BlobPropertyBag = {
Expand Down Expand Up @@ -590,7 +588,7 @@ module FormData = {

@send external get: (t, string) => option<FormDataEntryValue.t> = "get"

@send external getAll: (t, string) => Belt.Array.t<FormDataEntryValue.t> = "getAll"
@send external getAll: (t, string) => array<FormDataEntryValue.t> = "getAll"

@send external has: (t, string) => bool = "has"

Expand Down Expand Up @@ -671,137 +669,119 @@ module RequestInit = {
let _newBlob = (init: t<'a, 'b>, body: Blob.t) => {
{
body: Some(body),
cache: Belt.Option.getWithDefault(init.cache, ""),
credentials: Belt.Option.getWithDefault(init.credentials, ""),
destination: Belt.Option.getWithDefault(init.destination, ""),
cache: Option.getOr(init.cache, ""),
credentials: Option.getOr(init.credentials, ""),
destination: Option.getOr(init.destination, ""),
headers: init.headers,
integrity: Belt.Option.getWithDefault(init.integrity, ""),
keepalive: Belt.Option.getWithDefault(init.keepalive, true),
method: Belt.Option.getWithDefault(init.method, "GET"),
mode: Belt.Option.getWithDefault(init.mode, "cors"),
redirect: Belt.Option.getWithDefault(init.redirect, "follow"),
referer: Belt.Option.getWithDefault(init.referer, ""),
refererPolicy: Belt.Option.getWithDefault(init.refererPolicy, ""),
signal: Belt.Option.getWithDefault(
init.signal,
AbortController.signal(AbortController.new()),
),
window: Belt.Option.getWithDefault(init.window, Window.window),
integrity: Option.getOr(init.integrity, ""),
keepalive: Option.getOr(init.keepalive, true),
method: Option.getOr(init.method, "GET"),
mode: Option.getOr(init.mode, "cors"),
redirect: Option.getOr(init.redirect, "follow"),
referer: Option.getOr(init.referer, ""),
refererPolicy: Option.getOr(init.refererPolicy, ""),
signal: Option.getOr(init.signal, AbortController.signal(AbortController.new())),
window: Option.getOr(init.window, Window.window),
}
}

@new
let _newBufferSource = (init: t<'a, 'b>, body: BufferSource.t) => {
{
body: Some(body),
cache: Belt.Option.getWithDefault(init.cache, ""),
credentials: Belt.Option.getWithDefault(init.credentials, ""),
destination: Belt.Option.getWithDefault(init.destination, ""),
cache: Option.getOr(init.cache, ""),
credentials: Option.getOr(init.credentials, ""),
destination: Option.getOr(init.destination, ""),
headers: init.headers,
integrity: Belt.Option.getWithDefault(init.integrity, ""),
keepalive: Belt.Option.getWithDefault(init.keepalive, true),
method: Belt.Option.getWithDefault(init.method, "GET"),
mode: Belt.Option.getWithDefault(init.mode, "cors"),
redirect: Belt.Option.getWithDefault(init.redirect, "follow"),
referer: Belt.Option.getWithDefault(init.referer, ""),
refererPolicy: Belt.Option.getWithDefault(init.refererPolicy, ""),
signal: Belt.Option.getWithDefault(
init.signal,
AbortController.signal(AbortController.new()),
),
window: Belt.Option.getWithDefault(init.window, Window.window),
integrity: Option.getOr(init.integrity, ""),
keepalive: Option.getOr(init.keepalive, true),
method: Option.getOr(init.method, "GET"),
mode: Option.getOr(init.mode, "cors"),
redirect: Option.getOr(init.redirect, "follow"),
referer: Option.getOr(init.referer, ""),
refererPolicy: Option.getOr(init.refererPolicy, ""),
signal: Option.getOr(init.signal, AbortController.signal(AbortController.new())),
window: Option.getOr(init.window, Window.window),
}
}

@new
let _newFormData = (init: t<'a, 'b>, body: FormData.t) => {
{
body: Some(body),
cache: Belt.Option.getWithDefault(init.cache, ""),
credentials: Belt.Option.getWithDefault(init.credentials, ""),
destination: Belt.Option.getWithDefault(init.destination, ""),
cache: Option.getOr(init.cache, ""),
credentials: Option.getOr(init.credentials, ""),
destination: Option.getOr(init.destination, ""),
headers: init.headers,
integrity: Belt.Option.getWithDefault(init.integrity, ""),
keepalive: Belt.Option.getWithDefault(init.keepalive, true),
method: Belt.Option.getWithDefault(init.method, "GET"),
mode: Belt.Option.getWithDefault(init.mode, "cors"),
redirect: Belt.Option.getWithDefault(init.redirect, "follow"),
referer: Belt.Option.getWithDefault(init.referer, ""),
refererPolicy: Belt.Option.getWithDefault(init.refererPolicy, ""),
signal: Belt.Option.getWithDefault(
init.signal,
AbortController.signal(AbortController.new()),
),
window: Belt.Option.getWithDefault(init.window, Window.window),
integrity: Option.getOr(init.integrity, ""),
keepalive: Option.getOr(init.keepalive, true),
method: Option.getOr(init.method, "GET"),
mode: Option.getOr(init.mode, "cors"),
redirect: Option.getOr(init.redirect, "follow"),
referer: Option.getOr(init.referer, ""),
refererPolicy: Option.getOr(init.refererPolicy, ""),
signal: Option.getOr(init.signal, AbortController.signal(AbortController.new())),
window: Option.getOr(init.window, Window.window),
}
}

@new
let _newURLSearchParams = (init: t<'a, 'b>, body: URLSearchParams.t) => {
{
body: Some(body),
cache: Belt.Option.getWithDefault(init.cache, ""),
credentials: Belt.Option.getWithDefault(init.credentials, ""),
destination: Belt.Option.getWithDefault(init.destination, ""),
cache: Option.getOr(init.cache, ""),
credentials: Option.getOr(init.credentials, ""),
destination: Option.getOr(init.destination, ""),
headers: init.headers,
integrity: Belt.Option.getWithDefault(init.integrity, ""),
keepalive: Belt.Option.getWithDefault(init.keepalive, true),
method: Belt.Option.getWithDefault(init.method, "GET"),
mode: Belt.Option.getWithDefault(init.mode, "cors"),
redirect: Belt.Option.getWithDefault(init.redirect, "follow"),
referer: Belt.Option.getWithDefault(init.referer, ""),
refererPolicy: Belt.Option.getWithDefault(init.refererPolicy, ""),
signal: Belt.Option.getWithDefault(
init.signal,
AbortController.signal(AbortController.new()),
),
window: Belt.Option.getWithDefault(init.window, Window.window),
integrity: Option.getOr(init.integrity, ""),
keepalive: Option.getOr(init.keepalive, true),
method: Option.getOr(init.method, "GET"),
mode: Option.getOr(init.mode, "cors"),
redirect: Option.getOr(init.redirect, "follow"),
referer: Option.getOr(init.referer, ""),
refererPolicy: Option.getOr(init.refererPolicy, ""),
signal: Option.getOr(init.signal, AbortController.signal(AbortController.new())),
window: Option.getOr(init.window, Window.window),
}
}

@new
let _newReadableStream = (init: t<'a, 'b>, body: ReadableStream.t<Uint8Array.t>) => {
{
body: Some(body),
cache: Belt.Option.getWithDefault(init.cache, ""),
credentials: Belt.Option.getWithDefault(init.credentials, ""),
destination: Belt.Option.getWithDefault(init.destination, ""),
cache: Option.getOr(init.cache, ""),
credentials: Option.getOr(init.credentials, ""),
destination: Option.getOr(init.destination, ""),
headers: init.headers,
integrity: Belt.Option.getWithDefault(init.integrity, ""),
keepalive: Belt.Option.getWithDefault(init.keepalive, true),
method: Belt.Option.getWithDefault(init.method, "GET"),
mode: Belt.Option.getWithDefault(init.mode, "cors"),
redirect: Belt.Option.getWithDefault(init.redirect, "follow"),
referer: Belt.Option.getWithDefault(init.referer, ""),
refererPolicy: Belt.Option.getWithDefault(init.refererPolicy, ""),
signal: Belt.Option.getWithDefault(
init.signal,
AbortController.signal(AbortController.new()),
),
window: Belt.Option.getWithDefault(init.window, Window.window),
integrity: Option.getOr(init.integrity, ""),
keepalive: Option.getOr(init.keepalive, true),
method: Option.getOr(init.method, "GET"),
mode: Option.getOr(init.mode, "cors"),
redirect: Option.getOr(init.redirect, "follow"),
referer: Option.getOr(init.referer, ""),
refererPolicy: Option.getOr(init.refererPolicy, ""),
signal: Option.getOr(init.signal, AbortController.signal(AbortController.new())),
window: Option.getOr(init.window, Window.window),
}
}

@new
let _newString = (init: t<'a, 'b>, body: string) => {
{
body: Some(body),
cache: Belt.Option.getWithDefault(init.cache, ""),
credentials: Belt.Option.getWithDefault(init.credentials, ""),
destination: Belt.Option.getWithDefault(init.destination, ""),
cache: Option.getOr(init.cache, ""),
credentials: Option.getOr(init.credentials, ""),
destination: Option.getOr(init.destination, ""),
headers: init.headers,
integrity: Belt.Option.getWithDefault(init.integrity, ""),
keepalive: Belt.Option.getWithDefault(init.keepalive, true),
method: Belt.Option.getWithDefault(init.method, "GET"),
mode: Belt.Option.getWithDefault(init.mode, "cors"),
redirect: Belt.Option.getWithDefault(init.redirect, "follow"),
referer: Belt.Option.getWithDefault(init.referer, ""),
refererPolicy: Belt.Option.getWithDefault(init.refererPolicy, ""),
signal: Belt.Option.getWithDefault(
init.signal,
AbortController.signal(AbortController.new()),
),
window: Belt.Option.getWithDefault(init.window, Window.window),
integrity: Option.getOr(init.integrity, ""),
keepalive: Option.getOr(init.keepalive, true),
method: Option.getOr(init.method, "GET"),
mode: Option.getOr(init.mode, "cors"),
redirect: Option.getOr(init.redirect, "follow"),
referer: Option.getOr(init.referer, ""),
refererPolicy: Option.getOr(init.refererPolicy, ""),
signal: Option.getOr(init.signal, AbortController.signal(AbortController.new())),
window: Option.getOr(init.window, Window.window),
}
}
}
Expand Down