Skip to content
Draft
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
117 changes: 117 additions & 0 deletions .yarn/patches/@rescript-react-npm-0.14.2-b830f5af4f.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
diff --git a/rescript.json b/rescript.json
index 599e1f6777dcf8806780daba11ad6745d088aced..1ed044b3005d9941b62ae4ba0c1f339dded4ef03 100644
--- a/rescript.json
+++ b/rescript.json
@@ -7,6 +7,6 @@
"sources": [{ "dir": "src", "subdirs": true }],
"package-specs": [{ "module": "commonjs", "in-source": true }],
"suffix": ".bs.js",
- "bs-dev-dependencies": [],
- "bsc-flags": []
+ "dev-dependencies": [],
+ "compiler-flags": []
}
diff --git a/src/React.res b/src/React.res
index 4eb876a264c10e0b0f08f97162386ddebf798cd9..0e5f16c887056ff2d162028577656349cab1a4a4 100644
--- a/src/React.res
+++ b/src/React.res
@@ -47,7 +47,7 @@ type fragmentProps = {children?: element}
type ref<'value> = {mutable current: 'value}

@module("react")
-external createRef: unit => ref<Js.nullable<'a>> = "createRef"
+external createRef: unit => ref<Nullable.t<'a>> = "createRef"

module Children = {
@module("react") @scope("Children")
@@ -82,7 +82,7 @@ module Context = {
external createContext: 'a => Context.t<'a> = "createContext"

@module("react")
-external forwardRef: (('props, Js.Nullable.t<ref<'a>>) => element) => component<'props> =
+external forwardRef: (('props, Nullable.t<ref<'a>>) => element) => component<'props> =
"forwardRef"

@module("react")
@@ -257,56 +257,56 @@ external usePromise: promise<'a> => 'a = "use"
@module("react") external useRef: 'value => ref<'value> = "useRef"

@module("react")
-external useImperativeHandleOnEveryRender: (Js.Nullable.t<ref<'value>>, unit => 'value) => unit =
+external useImperativeHandleOnEveryRender: (Nullable.t<ref<'value>>, unit => 'value) => unit =
"useImperativeHandle"

@module("react")
-external useImperativeHandle: (Js.Nullable.t<ref<'value>>, unit => 'value, 'deps) => unit =
+external useImperativeHandle: (Nullable.t<ref<'value>>, unit => 'value, 'deps) => unit =
"useImperativeHandle"

@module("react")
external useImperativeHandle0: (
- Js.Nullable.t<ref<'value>>,
+ Nullable.t<ref<'value>>,
unit => 'value,
@as(json`[]`) _,
) => unit = "useImperativeHandle"

@module("react")
-external useImperativeHandle1: (Js.Nullable.t<ref<'value>>, unit => 'value, array<'a>) => unit =
+external useImperativeHandle1: (Nullable.t<ref<'value>>, unit => 'value, array<'a>) => unit =
"useImperativeHandle"

@module("react")
-external useImperativeHandle2: (Js.Nullable.t<ref<'value>>, unit => 'value, ('a, 'b)) => unit =
+external useImperativeHandle2: (Nullable.t<ref<'value>>, unit => 'value, ('a, 'b)) => unit =
"useImperativeHandle"

@module("react")
-external useImperativeHandle3: (Js.Nullable.t<ref<'value>>, unit => 'value, ('a, 'b, 'c)) => unit =
+external useImperativeHandle3: (Nullable.t<ref<'value>>, unit => 'value, ('a, 'b, 'c)) => unit =
"useImperativeHandle"

@module("react")
external useImperativeHandle4: (
- Js.Nullable.t<ref<'value>>,
+ Nullable.t<ref<'value>>,
unit => 'value,
('a, 'b, 'c, 'd),
) => unit = "useImperativeHandle"

@module("react")
external useImperativeHandle5: (
- Js.Nullable.t<ref<'value>>,
+ Nullable.t<ref<'value>>,
unit => 'value,
('a, 'b, 'c, 'd, 'e),
) => unit = "useImperativeHandle"

@module("react")
external useImperativeHandle6: (
- Js.Nullable.t<ref<'value>>,
+ Nullable.t<ref<'value>>,
unit => 'value,
('a, 'b, 'c, 'd, 'e, 'f),
) => unit = "useImperativeHandle"

@module("react")
external useImperativeHandle7: (
- Js.Nullable.t<ref<'value>>,
+ Nullable.t<ref<'value>>,
unit => 'value,
('a, 'b, 'c, 'd, 'e, 'f, 'g),
) => unit = "useImperativeHandle"
diff --git a/src/ReactDOM.res b/src/ReactDOM.res
index fbd564bf4d35eb044eae8b5c7f06b11b4e7358de..c5a9e6381c83ebef9729510ebed67398c17378ea 100644
--- a/src/ReactDOM.res
+++ b/src/ReactDOM.res
@@ -82,8 +82,8 @@ type domRef = JsxDOM.domRef

module Ref = {
type t = domRef
- type currentDomRef = React.ref<Js.nullable<Dom.element>>
- type callbackDomRef = Js.nullable<Dom.element> => option<unit => unit>
+ type currentDomRef = React.ref<Nullable.t<Dom.element>>
+ type callbackDomRef = Nullable.t<Dom.element> => option<unit => unit>

external domRef: currentDomRef => domRef = "%identity"
external callbackDomRef: callbackDomRef => domRef = "%identity"
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/package.json b/package.json
index 2f84ef58d1bf7f2f6782aeb7240fd0724b225ffa..80140c3cc8d345e09e64705ef07982091bf5534e 100644
--- a/package.json
+++ b/package.json
@@ -53,6 +53,6 @@
"sharp": "^0.34.0"
},
"peerDependencies": {
- "rescript": ">=12.0.0 <13"
+ "rescript": ">=12.0.0 <14"
}
}
diff --git a/src/Fetch/FormData.res b/src/Fetch/FormData.res
index 709f31077b8daf3e7a4c136bfb61b3b9df4e31d9..478f1b2b2bf2f3f95e787d1f320c226a0cede535 100644
--- a/src/Fetch/FormData.res
+++ b/src/Fetch/FormData.res
@@ -50,13 +50,13 @@ external has: (t, string) => bool = "has"
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/entries)
*/
@send
-external entries: t => Iterator.t<(string, formDataEntryValue)> = "entries"
+external entries: t => Iterator.t<(string, formDataEntryValue), unit, unknown> = "entries"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/keys)
*/
@send
-external keys: t => Iterator.t<string> = "keys"
+external keys: t => Iterator.t<string, unit, unknown> = "keys"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/set)
diff --git a/src/URL/URLSearchParams.res b/src/URL/URLSearchParams.res
index 845a9f1654fb17e545e0dbd1716c7784f2029192..0e0d64287d1397e8d50b796317ccf4407f5ef8f2 100644
--- a/src/URL/URLSearchParams.res
+++ b/src/URL/URLSearchParams.res
@@ -46,7 +46,7 @@ Returns key/value pairs in the same order as they appear in the query string.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams/entries)
*/
@send
-external entries: t => Iterator.t<(string, string)> = "entries"
+external entries: t => Iterator.t<(string, string), unit, unknown> = "entries"

/**
Returns the first value associated to the given search parameter.
@@ -74,7 +74,7 @@ Returns an iterator allowing iteration through all keys contained in this object
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams/keys)
*/
@send
-external keys: t => Iterator.t<string> = "keys"
+external keys: t => Iterator.t<string, unit, unknown> = "keys"

/**
Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
@@ -101,4 +101,4 @@ Returns an iterator allowing iteration through all values contained in this obje
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams/values)
*/
@send
-external values: t => Iterator.t<string> = "values"
+external values: t => Iterator.t<string, unit, unknown> = "values"
6 changes: 3 additions & 3 deletions apps/docs/__tests__/BlogArticleBehavior_.test.res
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
open ReactRouter
open Vitest

@get external textContent: WebAPI.DOMAPI.element => string = "textContent"
@get external textContent: DomTypes.element => string = "textContent"

let mockAuthor: BlogFrontmatter.author = {
username: "test-author",
Expand Down Expand Up @@ -33,12 +33,12 @@ test("blog article marks body content for DocSearch crawling", async () => {
</BrowserRouter>,
)

switch document->WebAPI.Document.querySelector("article.DocSearch-content") {
switch document->Document.querySelector("article.DocSearch-content") {
| Value(_) => ()
| Null => failwith("expected blog article body to be marked as DocSearch content")
}

let lvl0 = switch document->WebAPI.Document.querySelector("article .DocSearch-lvl0") {
let lvl0 = switch document->Document.querySelector("article .DocSearch-lvl0") {
| Value(element) => element
| Null => failwith("expected blog article to render a DocSearch lvl0 marker")
}
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/__tests__/BreadcrumbsBehavior_.test.res
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
open ReactRouter
open Vitest

@get external textContent: WebAPI.DOMAPI.element => string = "textContent"
@get external textContent: DomTypes.element => string = "textContent"

test("breadcrumbs do not repeat the current page crumb when it is already included", async () => {
await viewport(1440, 900)
Expand All @@ -21,7 +21,7 @@ test("breadcrumbs do not repeat the current page crumb when it is already includ
)

let _breadcrumbs = await screen->getByTestId("breadcrumbs")
let breadcrumbs = switch document->WebAPI.Document.querySelector("[data-testid='breadcrumbs']") {
let breadcrumbs = switch document->Document.querySelector("[data-testid='breadcrumbs']") {
| Value(breadcrumbs) => breadcrumbs
| Null => failwith("expected breadcrumbs")
}
Expand Down
8 changes: 4 additions & 4 deletions apps/docs/__tests__/DocsLayoutBehavior_.test.res
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
open ReactRouter
open Vitest

@get external textContent: WebAPI.DOMAPI.element => string = "textContent"
@get external textContent: DomTypes.element => string = "textContent"

let mockCategories: array<SidebarNav.Category.t> = [
{
Expand Down Expand Up @@ -43,21 +43,21 @@ test("docs layout marks the textual content for DocSearch crawling", async () =>

let _mainContent = await screen->getByTestId("side-layout-children")

let mainContent = switch document->WebAPI.Document.querySelector(
let mainContent = switch document->Document.querySelector(
"[data-testid='side-layout-children']",
) {
| Value(element) => element
| Null => failwith("expected docs layout main content")
}

let className = switch mainContent->WebAPI.Element.getAttribute("class") {
let className = switch mainContent->Element.getAttribute("class") {
| Value(value) => value
| Null => ""
}

expect(className->String.includes("DocSearch-content"))->toBe(true)

let lvl0 = switch document->WebAPI.Document.querySelector(".DocSearch-lvl0") {
let lvl0 = switch document->Document.querySelector(".DocSearch-lvl0") {
| Value(element) => element
| Null => failwith("expected docs layout to render a DocSearch lvl0 marker")
}
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/__tests__/DocsOverviewBehavior_.test.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ test("docs overview uses unversioned docs links", async () => {
</MemoryRouter>,
)

let overviewLink = switch document->WebAPI.Document.querySelector(
let overviewLink = switch document->Document.querySelector(
"a[href='/docs/manual/introduction']",
) {
| Value(link) => link
| Null => failwith("expected docs overview to link to the unversioned manual introduction")
}
await element(overviewLink)->toBeVisible

let genTypeLink = switch document->WebAPI.Document.querySelector(
let genTypeLink = switch document->Document.querySelector(
"a[href='/docs/manual/typescript-integration']",
) {
| Value(link) => link
| Null => failwith("expected docs overview to link to the unversioned GenType docs page")
}
await element(genTypeLink)->toBeVisible

switch document->WebAPI.Document.querySelector("a[href*='/docs/manual/v']") {
switch document->Document.querySelector("a[href*='/docs/manual/v']") {
| Value(_) => failwith("expected docs overview to avoid versioned manual links")
| Null => ()
}
Expand Down
23 changes: 11 additions & 12 deletions apps/docs/__tests__/LandingPageBehavior_.test.res
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,20 @@ test(

let _ = await screen->getByText("Edit this example in Playground")

let href = switch document->WebAPI.Document.querySelector("a[href*='/try?code=']") {
let href = switch document->Document.querySelector("a[href*='/try?code=']") {
| Value(link) =>
switch link->WebAPI.Element.getAttribute("href") {
switch link->Element.getAttribute("href") {
| Value(href) => href
| Null => failwith("expected landing page playground link to have an href")
}
| Null => failwith("expected to find the landing page playground link")
}

let {pathname, searchParams} = WebAPI.URL.make(~url=href, ~base="https://rescript-lang.org")
let {pathname, searchParams} = URL.make(~url=href, ~base="https://rescript-lang.org")

expect(pathname)->toBe("/try")

let compressedCode =
searchParams->WebAPI.URLSearchParams.get("code")->Nullable.make->Nullable.toOption
let compressedCode = searchParams->URLSearchParams.get("code")->Null.toOption

let decodedCode =
compressedCode
Expand All @@ -63,14 +62,14 @@ test("landing page playground hero renders highlighted code tokens", async () =>

let _ = await screen->getByText("Write in ReScript")

let rescriptCodeBlock = switch document->WebAPI.Document.querySelector(
let rescriptCodeBlock = switch document->Document.querySelector(
"[data-testid='landing-playground-hero'] code.lang-res",
) {
| Value(codeBlock) => codeBlock
| Null => failwith("expected landing playground hero to render the ReScript code block")
}

let javascriptCodeBlock = switch document->WebAPI.Document.querySelector(
let javascriptCodeBlock = switch document->Document.querySelector(
"[data-testid='landing-playground-hero'] code.lang-js",
) {
| Value(codeBlock) => codeBlock
Expand All @@ -92,7 +91,7 @@ test(
</MemoryRouter>,
)

let sourceSection = switch document->WebAPI.Document.querySelector(
let sourceSection = switch document->Document.querySelector(
"[data-testid='landing-playground-hero']",
) {
| Value(section) => section
Expand All @@ -113,24 +112,24 @@ test(

let _ = await snapshotScreen->getByTestId(sandboxTestId)

let sandbox = switch document->WebAPI.Document.querySelector(
let sandbox = switch document->Document.querySelector(
"[data-testid='landing-playground-hero-sandbox']",
) {
| Value(sandbox) => sandbox
| Null => failwith("expected to find the sandboxed landing playground hero")
}

let sandboxRect: WebAPI.DOMAPI.domRect = sandbox->WebAPI.Element.getBoundingClientRect
let sandboxRect: DomTypes.domRect = sandbox->Element.getBoundingClientRect

let rescriptCodeBlock = switch document->WebAPI.Document.querySelector(
let rescriptCodeBlock = switch document->Document.querySelector(
"[data-testid='landing-playground-hero-sandbox'] code.lang-res",
) {
| Value(codeBlock) => codeBlock
| Null =>
failwith("expected sandboxed landing playground hero to render the ReScript code block")
}

let javascriptCodeBlock = switch document->WebAPI.Document.querySelector(
let javascriptCodeBlock = switch document->Document.querySelector(
"[data-testid='landing-playground-hero-sandbox'] code.lang-js",
) {
| Value(codeBlock) => codeBlock
Expand Down
Loading
Loading