From 04a8b4d4e79768a60992dde87b33cc5e144045a4 Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Mon, 16 Nov 2026 16:04:38 -0500 Subject: [PATCH] build(webapi): upgrade to ReScript 13 alpha.7 [Codex] --- CHANGELOG.md | 10 +- README.md | 4 +- docs/components/signatureItem.astro | 50 +++--- docs/components/value.astro | 6 +- docs/content/docs/api-surface.mdx | 6 +- docs/content/docs/contributing/releasing.mdx | 2 +- docs/content/docs/contributing/testing.mdx | 7 +- docs/content/docs/index.mdx | 6 +- docs/content/docs/philosophy.mdx | 2 +- docs/content/docs/project-status.mdx | 8 +- docs/signatureParts.js | 39 +++++ package-lock.json | 157 +++++++++--------- package.json | 4 +- scripts/check-consumer.mjs | 20 ++- scripts/check-doc-type-links.test.mjs | 71 ++++++++ scripts/consumer-runtime.res | 30 +++- .../negative/ResponseRecordCannotCoerce.res | 17 ++ scripts/negative-fixtures.json | 6 + src/core/DOM.res | 1 + src/crypto/Crypto.res | 1 + src/crypto/SubtleCrypto.res | 2 + src/cssom/StylePropertyMap.res | 1 + src/cssom/StyleSheet.res | 1 + src/device/GamepadTypes.res | 1 + src/device/GeolocationTypes.res | 1 + src/dom-nodes/Range.res | 1 + src/fetch/FormData.res | 1 + src/fetch/Request.res | 1 + src/fetch/Response.res | 1 + src/file/Blob.res | 2 + src/file/FileSystemDirectoryEntry.res | 1 + src/file/FileSystemDirectoryHandle.res | 1 + src/file/FileSystemFileHandle.res | 1 + src/file/FileSystemWritableFileStream.res | 1 + src/file/FileTypes.res | 1 + src/geometry/DOMMatrix.res | 1 + src/geometry/DOMPoint.res | 1 + src/geometry/DOMRect.res | 1 + src/media/MediaCapabilitiesTypes.res | 1 + src/media/MediaDevices.res | 3 + src/media/MediaMetadata.res | 1 + src/media/MediaSession.res | 2 + src/media/MediaStreamTrack.res | 3 + src/messaging/MessageEvent.res | 1 + src/messaging/Notification.res | 5 + src/navigator/Navigator.res | 8 + src/performance/PerformanceMark.res | 1 + src/storage/StorageTypes.res | 1 + tests/BindingByteTypes__test.res | 2 + tests/DOMAPI/ImageData__test.res | 2 +- tests/FetchAPI/FormData__test.res | 2 + tests/FetchAPI/Request__test.res | 1 + tests/FetchAPI/Response__test.res | 1 + tests/FetchAPI/SafeFetch__test.res | 112 +++++++------ tests/Fetch__test.res | 3 + .../IntersectionObserver__test.res | 9 +- .../MutationObserver__test.res | 7 +- .../AudioDestinationNode__.test.res | 3 + tests/browser/BindingContracts__test.res | 64 +++++-- 59 files changed, 490 insertions(+), 209 deletions(-) create mode 100644 docs/signatureParts.js create mode 100644 scripts/fixtures/negative/ResponseRecordCannotCoerce.res diff --git a/CHANGELOG.md b/CHANGELOG.md index 0835093c..c964b210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,21 @@ are maintained by the release workflow; see the [alpha release readiness tracker ## 1.0.0-alpha.1 (candidate) -Planned first release in the `1.0.0-alpha.N` series. ReScript `13.0.0-alpha.5` is the tested +Planned first release in the `1.0.0-alpha.N` series. ReScript `13.0.0-alpha.7` is the tested compiler baseline. This alpha is not a stable API; review the migration notes below before upgrading from earlier prereleases. The release workflow is the source of truth for actual versioning and publication. ### Migration notes +- The minimum supported ReScript compiler is now `13.0.0-alpha.7` (peer range + `>=13.0.0-alpha.7 <13.0.0`). Coercing a different type into a private record is now rejected + by the compiler; use supported conversion helpers for native derived-to-base conversions. + This does not make all native records package-wide private. Typed arrays now have distinct + types: use their specific module operations, or explicitly upcast to `TypedArray.t` when a + binding requires the generic type. +- ReScript `13.0.0-alpha.7` no longer supports Intel Macs (`darwin-x64`). This package's new + compiler minimum therefore also excludes native compilation on Intel Macs. - WebSocket sends and worker `Request` fetches now preserve their native receiver (`this`) rather than calling receiver-bound methods unbound. - `WebAPI.Request.bytes`, `WebAPI.Response.bytes`, `WebAPI.Blob.bytes`, diff --git a/README.md b/README.md index 13fce610..8716da3d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Experimental successor to [rescript-webapi](https://github.com/TheSpyder/rescrip ## Getting started -ReScript `13.0.0-alpha.5` is the tested compiler baseline. Library alpha releases may contain +ReScript `13.0.0-alpha.7` is the compiler baseline. Library alpha releases may contain breaking changes. See the [project status](https://rescript-lang.github.io/experimental-rescript-webapi/project-status/) for the accepted peer range and its testing limits. @@ -14,7 +14,7 @@ Install the library and compiler in your application: ```shell npm install @rescript/webapi@alpha -npm install --save-dev rescript@13.0.0-alpha.5 +npm install --save-dev rescript@13.0.0-alpha.7 ``` The `@alpha` command targets the published alpha dist-tag. The planned `1.0.0-alpha.1` candidate diff --git a/docs/components/signatureItem.astro b/docs/components/signatureItem.astro index 9c020baa..a87612fa 100644 --- a/docs/components/signatureItem.astro +++ b/docs/components/signatureItem.astro @@ -1,44 +1,34 @@ --- import { apiModules, createAPIModuleLink, publicTypeTargets } from "../utils.js"; +import { signatureParts } from "../signatureParts.js"; const { item, typesInOwnModule } = Astro.props; -let link; -if (typesInOwnModule && typesInOwnModule.has(item.path)) { - link = `#${item.path}`; -} - -if (item.path.startsWith("WebAPI.")) { - const paths = item.path.split("."); - const moduleName = paths[1]; - if ( - paths.length === 3 && - moduleName && - apiModules.some((apiModule) => apiModule.moduleName === moduleName) - ) { - link = `${import.meta.env.BASE_URL}/${createAPIModuleLink(moduleName)}#${paths[2]}`; - } else if (paths.length === 3 && moduleName && paths[2]) { - const publicType = publicTypeTargets.get(`${moduleName}.${paths[2]}`); - if (publicType) { - link = `${import.meta.env.BASE_URL}/${createAPIModuleLink(publicType.moduleName)}#${publicType.typeName}`; +function typeLink(typePath) { + if (!typePath) return; + if (typesInOwnModule?.has(typePath)) return `#${typePath}`; + if (typePath.startsWith("WebAPI.")) { + const paths = typePath.split("."); + const moduleName = paths[1]; + if ( + paths.length === 3 && + moduleName && + apiModules.some((apiModule) => apiModule.moduleName === moduleName) + ) { + return `${import.meta.env.BASE_URL}/${createAPIModuleLink(moduleName)}#${paths[2]}`; + } else if (paths.length === 3 && moduleName && paths[2]) { + const publicType = publicTypeTargets.get(`${moduleName}.${paths[2]}`); + if (publicType) { + return `${import.meta.env.BASE_URL}/${createAPIModuleLink(publicType.moduleName)}#${publicType.typeName}`; + } } } } -const genericTypeParameters = item.genericTypeParameters || []; +const parts = signatureParts(item).map((part) => ({ ...part, link: typeLink(part.path) })); --- - {link ? {item.path} : item.path}{ - genericTypeParameters.length > 0 && ( - <> - {"<"} - {genericTypeParameters.map((subItem) => ( - - ))} - {">"} - - ) - } + {parts.map((part) => part.link ? {part.text} : part.text)}