[Exploration] Split into monorepo with 17 npm workspace packages#235
Draft
brnrdog wants to merge 4 commits intobrnrdog/descriptive-make-fnsfrom
Draft
[Exploration] Split into monorepo with 17 npm workspace packages#235brnrdog wants to merge 4 commits intobrnrdog/descriptive-make-fnsfrom
brnrdog wants to merge 4 commits intobrnrdog/descriptive-make-fnsfrom
Conversation
Reorganize the single @rescript/webapi package into a monorepo with npm workspaces. Type definitions stay in the base package while binding packages depend only on the base, eliminating circular dependencies. Packages: webapi (base), webapi-dom, webapi-fetch, webapi-file, webapi-canvas, webapi-webaudio, webapi-uievents, webapi-service-worker, webapi-web-workers, webapi-indexed-db, webapi-media, webapi-websockets, webapi-geolocation, webapi-webstorage, webapi-crypto, webapi-performance, webapi-global. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each package now has `npm run build` and `npm run clean` scripts. Root gets `build:packages` to build all packages independently via `npm run build --workspaces`.
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.
The current single-package
@rescript/webapibundles all Web API bindings together, which createssignificant overhead for consumers who only need a subset of the APIs. By splitting into independent
packages, we:
they actually use
don't need every API surface
Summary
@rescript/webapipackage into a monorepo with npm workspaces and 17independent packages
@rescript/webapipackage; binding packages depend only onthe base, eliminating circular dependencies
Package structure
Key changes
packages/directory with 17 packages, each withpackage.jsonandrescript.json.resfiles from flatsrc/into flattened packagesrc/directoriesopenstatements in type definition files (open Event→open EventTypes,open File→open FileTypes) to reference type modules directlyIntersectionObserverRoot.resto webapi-dom (depends on DOM bindings)File.isInstanceOfinFormDataEntryValue.resto avoid circular package dependency-open WebAPIWebWorkersto service-worker config forWorkerGlobalScope.Implbsc-flagswithcompiler-flagsacross all packagesbuild/cleanscripts to all packages andbuild:packagesto rootBuild scripts
Test plan
npm run clean && npm run build— all 336 modules compile from clean buildnpm run build:packages— each of the 17 packages builds independently