You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rename overloaded constructor bindings from numbered make* names to semantic from* names, while keeping singleton and true default constructors named make. This pass should also update constructor source comments so generated API docs describe each overload's input shape, add compile-coverage tests for every renamed constructor, and update contributor docs with the constructor naming and documentation rules.
Plan source: docs/superpowers/plans/2026-04-18-constructor-make-rename-plan.md
PR #234 (Rename a few bindings with a proper descriptive naming) is the prior rename pass for this area. It was authored against the pre-*API module layout, so treat paths like src/DOM/* and src/WebSockets/* in that PR as earlier equivalents of the current src/DOMAPI/* and src/WebSocketsAPI/* files.
Use PR #234 as source material only for the overlapping constructor families in this issue:
FontFace: make2 -> fromDataView, make3 -> fromArrayBuffer, but the string constructor stayed make
VideoFrame: make2 through make10 were renamed, but the HTML image constructor stayed make and several names were shorter than the source-type names this issue wants (fromSvgImage, fromVideoElement, fromCanvasElement)
Keep true default constructors named make, even inside overloaded families.
Rename typed constructor overloads in overloaded families to from* names based on the source input type.
Do not change existing makeWith* constructors in this pass.
If an optional labeled argument currently hides the default constructor, split it into a real make plus typed from* overloads.
Scope
Rename pure overload families
src/CSSFontLoadingAPI/FontFace.res
fromString
fromDataView
fromArrayBuffer
src/DOMAPI/VideoFrame.res
fromHTMLImageElement
fromSVGImageElement
fromHTMLVideoElement
fromHTMLCanvasElement
fromImageBitmap
fromOffscreenCanvas
fromVideoFrame
fromArrayBuffer
fromSharedArrayBuffer
fromDataView
src/WebSocketsAPI/WebSocket.res
fromURL
fromURLWithProtocols
src/WebAudioAPI/OfflineAudioContext.res
fromOptions
fromChannelCountLengthAndSampleRate
Update mixed default-plus-typed families
src/MediaCaptureAndStreamsAPI/MediaStream.res
keep make() as the default constructor
rename typed overloads to fromMediaStream and fromTracks
src/FileAPI.res
add type underlyingSource<'t> = any near the existing stream support types
src/FileAPI/ReadableStream.res
make make generic: unit => readableStream<'t>
rename typed overloads to fromUnderlyingSource and fromUnderlyingSourceWithStrategy
Split constructor bindings that currently hide the default constructor
src/CanvasAPI/Path2D.res
split into make(), fromPath2D(~path), fromString(~path)
src/DOMAPI/DOMMatrix.res
split into make(), fromString(~init), fromArray(~init)
src/DOMAPI/DOMMatrixReadOnly.res
split into make(), fromString(~init), fromArray(~init)
Documentation
Rewrite every touched constructor comment to use the final function name in the signature line and example.
Add a Source shape: block for every touched constructor comment.
Include MDN links for the input type.
Include ReScript stdlib links when the source input is a stdlib type such as string, array<'a>, ArrayBuffer.t, or DataView.t.
Include local source links when the shape is a project-local record or alias.
Preserve the existing constructor-level MDN link in each comment.
Update docs/content/docs/contributing/api-modelling.mdx with a constructor-overload subsection covering make vs from* naming and overload splitting.
Update docs/content/docs/contributing/documentation.mdx so the documented comment structure explicitly includes source-shape links and shows a constructor overload example.
Do not hand-edit docs/pages/apidocs/**; those pages are template-driven from source comments.
Summary
Rename overloaded constructor bindings from numbered
make*names to semanticfrom*names, while keeping singleton and true default constructors namedmake. This pass should also update constructor source comments so generated API docs describe each overload's input shape, add compile-coverage tests for every renamed constructor, and update contributor docs with the constructor naming and documentation rules.Plan source:
docs/superpowers/plans/2026-04-18-constructor-make-rename-plan.mdContext from PR #234
PR #234 (
Rename a few bindings with a proper descriptive naming) is the prior rename pass for this area. It was authored against the pre-*APImodule layout, so treat paths likesrc/DOM/*andsrc/WebSockets/*in that PR as earlier equivalents of the currentsrc/DOMAPI/*andsrc/WebSocketsAPI/*files.Use PR #234 as source material only for the overlapping constructor families in this issue:
FontFace:make2->fromDataView,make3->fromArrayBuffer, but the string constructor stayedmakeVideoFrame:make2throughmake10were renamed, but the HTML image constructor stayedmakeand several names were shorter than the source-type names this issue wants (fromSvgImage,fromVideoElement,fromCanvasElement)MediaStream:make2->fromStream,make3->fromTracksPath2D:make2->fromString, but the default constructor and copy constructor were not splitDOMMatrix/DOMMatrixReadOnly:make2->fromFloatArray, but the string overload stayed merged intomakeOfflineAudioContext:make2->makeWithParamsWebSocket:make2->makeWithProtocolsReadableStream:make2andmake3were removed instead of being remodeled as typed constructorsThis issue intentionally supersedes the constructor naming choices from PR #234 where they do not match the
make/from*rules:makefromMediaStream,fromURL,fromURLWithProtocols,fromHTMLVideoElement,fromString, andfromArraymake()plus typedfrom*overloadsRules to enforce
make.make, even inside overloaded families.from*names based on the source input type.makeWith*constructors in this pass.makeplus typedfrom*overloads.Scope
Rename pure overload families
src/CSSFontLoadingAPI/FontFace.resfromStringfromDataViewfromArrayBuffersrc/DOMAPI/VideoFrame.resfromHTMLImageElementfromSVGImageElementfromHTMLVideoElementfromHTMLCanvasElementfromImageBitmapfromOffscreenCanvasfromVideoFramefromArrayBufferfromSharedArrayBufferfromDataViewsrc/WebSocketsAPI/WebSocket.resfromURLfromURLWithProtocolssrc/WebAudioAPI/OfflineAudioContext.resfromOptionsfromChannelCountLengthAndSampleRateUpdate mixed default-plus-typed families
src/MediaCaptureAndStreamsAPI/MediaStream.resmake()as the default constructorfromMediaStreamandfromTrackssrc/FileAPI.restype underlyingSource<'t> = anynear the existing stream support typessrc/FileAPI/ReadableStream.resmakegeneric:unit => readableStream<'t>fromUnderlyingSourceandfromUnderlyingSourceWithStrategySplit constructor bindings that currently hide the default constructor
src/CanvasAPI/Path2D.resmake(),fromPath2D(~path),fromString(~path)src/DOMAPI/DOMMatrix.resmake(),fromString(~init),fromArray(~init)src/DOMAPI/DOMMatrixReadOnly.resmake(),fromString(~init),fromArray(~init)Documentation
Source shape:block for every touched constructor comment.string,array<'a>,ArrayBuffer.t, orDataView.t.docs/content/docs/contributing/api-modelling.mdxwith a constructor-overload subsection coveringmakevsfrom*naming and overload splitting.docs/content/docs/contributing/documentation.mdxso the documented comment structure explicitly includes source-shape links and shows a constructor overload example.docs/pages/apidocs/**; those pages are template-driven from source comments.Tests and generated artifacts
tests/CSSFontLoadingAPI/FontFace__test.restests/DOMAPI/VideoFrame__test.restests/WebSocketsAPI/WebSocket__test.restests/WebAudioAPI/OfflineAudioContext__test.restests/MediaCaptureAndStreamsAPI/MediaStream__test.restests/FileAPI/ReadableStream__test.restests/CanvasAPI/Path2D__test.restests/DOMAPI/DOMMatrix__test.restests/DOMAPI/DOMMatrixReadOnly__test.restests/**/*.jssnapshots for those new coverage modules.lib/**; it should be regenerated through the normal build.Verification
npm run buildnpm run testnpm run build:docsnpm run format:checkExpected results:
.jssnapshots and no leftover snapshot diffsOut of scope
Rollout order
ReadableStreamsupport types insrc/FileAPI.resfirst.makeplus typedfrom*overloads.