refactor: carry over post-monorepo pre-alpha cleanup#252
Merged
Conversation
Port the surviving API cleanup from the final pre-alpha branch onto the monorepo split introduced in #249. This adds the missing concrete modules, translates the fetch/runtime/canvas/websocket/media surface cleanup into the package layout, and keeps the branch green with updated tests.
brnrdog
reviewed
Apr 19, 2026
| */ | ||
| @new | ||
| external make2: Types.mediaStream => Types.mediaStream = "MediaStream" | ||
| external make2: t => t = "MediaStream" |
Collaborator
There was a problem hiding this comment.
Suggested change
| external make2: t => t = "MediaStream" | |
| external makeFromMediaStream: t => t = "MediaStream" |
brnrdog
reviewed
Apr 19, 2026
| */ | ||
| @new | ||
| external make3: array<Types.mediaStreamTrack> => Types.mediaStream = "MediaStream" | ||
| external make3: array<MediaStreamTrack.t> => t = "MediaStream" |
Collaborator
There was a problem hiding this comment.
Suggested change
| external make3: array<MediaStreamTrack.t> => t = "MediaStream" | |
| external makeFromMediaStreams: array<MediaStreamTrack.t> => t = "MediaStream" |
tsnobip
reviewed
Apr 19, 2026
Comment on lines
+1
to
+14
| type t = Types.formDataEntryValue | ||
|
|
||
| external fromString: string => t = "%identity" | ||
| external fromFile: WebApiFile.File.t => t = "%identity" | ||
|
|
||
| type decoded = | ||
| | String(string) | ||
| | File(WebApiFile.File.t) | ||
|
|
||
| let decode = (t: t): decoded => | ||
| switch t { | ||
| | Types.String(value) => String(value) | ||
| | Types.File(file) => File(file) | ||
| } |
Member
There was a problem hiding this comment.
formDataEntryValue can be replaced with a unboxed variant, was done here:
03277f7#diff-d4a2e4ec907d1df1e5420e4f844ef31a97a80624a93463ca8a52d6b0be08274eR220-R223
tsnobip
reviewed
Apr 19, 2026
Comment on lines
+5
to
+21
| type messageEvent<'t> = { | ||
| ...event, | ||
| data: 't, | ||
| origin: string, | ||
| lastEventId: string, | ||
| source: Null.t<messageEventSource>, | ||
| ports: array<WebApiChannelMessaging.Types.messagePort>, | ||
| } | ||
|
|
||
| type messageEventInit<'t> = { | ||
| ...WebApiEvent.Types.eventInit, | ||
| mutable data?: 't, | ||
| mutable origin?: string, | ||
| mutable lastEventId?: string, | ||
| mutable source?: Null.t<messageEventSource>, | ||
| mutable ports?: array<WebApiChannelMessaging.Types.messagePort>, | ||
| } |
Member
There was a problem hiding this comment.
this should be inside packages/WebSockets/src/Types.res
tsnobip
reviewed
Apr 19, 2026
Comment on lines
+3
to
+14
| let blob: WebApiFile.Blob.t = WebApiFile.Blob.make(~blobParts=[]) | ||
| let file: WebApiFile.File.t = WebApiFile.File.make(~fileBits=[], ~fileName="hello.txt") | ||
| let params: WebApiURL.URLSearchParams.t = WebApiURL.URLSearchParams.fromString("greeting=hello") | ||
| let formData: WebApiFetch.FormData.t = WebApiFetch.FormData.make() | ||
| let stream: WebApiFile.ReadableStream.t<array<int>> = WebApiFile.ReadableStream.make() | ||
|
|
||
| let stringBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromString("hello") | ||
| let blobBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromBlob(blob) | ||
| let fileBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromFile(file) | ||
| let paramsBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromURLSearchParams(params) | ||
| let formDataBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromFormData(formData) | ||
| let streamBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromReadableStream(stream) |
Member
There was a problem hiding this comment.
should not be annotated, probably better defined inline
tsnobip
reviewed
Apr 19, 2026
Comment on lines
+1
to
+6
| let headers: WebApiFetch.HeadersInit.t = WebApiFetch.HeadersInit.fromDict(dict{"X-Fruit": "Peach"}) | ||
| let blob: WebApiFile.Blob.t = WebApiFile.Blob.make(~blobParts=[]) | ||
| let file: WebApiFile.File.t = WebApiFile.File.make(~fileBits=[], ~fileName="pong.txt") | ||
| let params: WebApiURL.URLSearchParams.t = WebApiURL.URLSearchParams.fromString("fruit=peach") | ||
| let formData: WebApiFetch.FormData.t = WebApiFetch.FormData.make() | ||
| let stream: WebApiFile.ReadableStream.t<array<int>> = WebApiFile.ReadableStream.make() |
tsnobip
reviewed
Apr 19, 2026
Comment on lines
+53
to
+58
| let _setIntervalWithCallback = WebApiDOM.Window.setIntervalWithCallback | ||
| let _alertWithMessage = WebApiDOM.Window.alertWithMessage | ||
| let _postMessageWithOptions = WebApiDOM.Window.postMessageWithOptions | ||
| let _scrollXY = WebApiDOM.Window.scrollXY | ||
| let _scrollToXY = WebApiDOM.Window.scrollToXY | ||
| let _scrollByXY = WebApiDOM.Window.scrollByXY |
tsnobip
reviewed
Apr 19, 2026
| @@ -402,6 +414,12 @@ external alert: Types.window => unit = "alert" | |||
| @send | |||
| external alert2: (Types.window, string) => unit = "alert" | |||
Member
There was a problem hiding this comment.
should be replaced by the following bindings
tsnobip
reviewed
Apr 19, 2026
Comment on lines
538
to
539
| @send | ||
| external scroll2: (Types.window, ~x: float, ~y: float) => unit = "scroll" |
Member
There was a problem hiding this comment.
should be replaced by the following binding
tsnobip
reviewed
Apr 19, 2026
Comment on lines
556
to
557
| @send | ||
| external scrollTo2: (Types.window, ~x: float, ~y: float) => unit = "scrollTo" |
tsnobip
reviewed
Apr 19, 2026
Comment on lines
574
to
575
| @send | ||
| external scrollBy2: (Types.window, ~x: float, ~y: float) => unit = "scrollBy" |
Drop scroll2/scrollTo2/scrollBy2 and keep the descriptive *XY overload names requested in review. Co-authored-by: Codex <codex@openai.com>
…with-commits-and-responses Address review feedback: rename constructors, unbox FormDataEntryValue, reuse MessageEvent types, simplify tests
tsnobip
added a commit
that referenced
this pull request
Apr 19, 2026
* clean types in Prelude * split into subpackages * add back getter functions for Window * move back Navigator to DOM * remove globals package * delete files that should not be versioned * add some more typealiases in DOM/Types * format * delete JS files * format package.json * fix docs generation * change namespace to `@rescript/webapi-[section]` * publish all subpackages in CI * refactor: carry over post-monorepo pre-alpha cleanup (#252) * refactor: carry over post-monorepo pre-alpha cleanup Port the surviving API cleanup from the final pre-alpha branch onto the monorepo split introduced in #249. This adds the missing concrete modules, translates the fetch/runtime/canvas/websocket/media surface cleanup into the package layout, and keeps the branch green with updated tests. * refactor(DOM): remove numeric scroll overloads Drop scroll2/scrollTo2/scrollBy2 and keep the descriptive *XY overload names requested in review. Co-authored-by: Codex <codex@openai.com> --------- Co-authored-by: Codex <codex@openai.com> * format * simplify FOrmDataEntryValue type * clean alert and postMessage * fix CI * remove useless namespace * mark bindings of classes/interfaces as private records to prevent creation records that have mutable fields were not marked as private for now because mutating these mutable fields is not allowed * format * add missing getters for Navigator * add Window.t type --------- Co-authored-by: Josh Vlk <josh@vlkpack.com> Co-authored-by: Codex <codex@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
surfaces
Test Plan