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
Copy file name to clipboardExpand all lines: docs/content/docs/philosophy.mdx
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,12 +16,13 @@ The bindings are generated from the [MDN Web API documentation](https://develope
16
16
17
17
In other words, if you are searching for a specific JavaScript binding, begin your journey at the [MDN Web API documentation](https://developer.mozilla.org/en-US/docs/Web/API) and determine which module contains your sample. Ensure that the module is available in the bindings by checking the specific API. Please [open an issue](https://github.com/rescript-lang/experimental-rescript-webapi/issues/new/choose) if you require an API that is not yet present.
18
18
19
-
Each feature is grouped under a `WebApi.<Feature>` module so related interfaces and helper modules stay together without relying on flat package-wide names.
19
+
The bindings are exposed under the `WebAPI` namespace, with feature entry modules such as `WebAPI.DOM` available when you want to scope imports more narrowly.
20
20
21
21
```ReScript
22
-
open WebApi.DOM.Global
22
+
open WebAPI.Global
23
+
// or WebAPI.DOM
23
24
24
-
let myElement: WebApi.DOM.Types.element = document->WebApi.DOM.Document.createElement("div")
25
+
let myElement: WebAPI.Element.t = document->WebAPI.Document.createElement("div")
25
26
```
26
27
27
28
## Interfaces
@@ -43,10 +44,11 @@ JavaScript supports function overloads, where a function can have multiple signa
43
44
In some cases, type conversion will be required. Subtypes can safely be cast to their base type using conversion helpers within their module.
44
45
45
46
```ReScript
46
-
open WebApi.DOM.Global
47
+
open WebAPI.Global
48
+
// or WebAPI.DOM
47
49
48
-
let element: WebApi.DOM.Types.element = document->WebApi.DOM.Document.createElement("div")
49
-
let node: WebApi.DOM.Types.node = element->WebApi.DOM.Element.asNode
50
+
let element: WebAPI.Element.t = document->WebAPI.Document.createElement("div")
51
+
let node: WebAPI.Node.t = element->WebAPI.Element.asNode
50
52
```
51
53
52
54
Any other conversions should be treated as unsafe casts and used with caution, because the type system cannot guarantee they are valid at runtime.
Copy file name to clipboardExpand all lines: docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Unmonorepo WebApi Design
1
+
# Unmonorepo WebAPI Design
2
2
3
3
**Date:** 2026-04-22
4
4
**Status:** Approved in conversation, written for review before implementation
@@ -7,15 +7,15 @@
7
7
8
8
The repository was split into npm workspaces so each Web API area could build and publish independently from `packages/*`. The ReScript compiler now supports feature-gated source directories and feature-gated dependencies, so the package split is no longer required to support partial builds.
9
9
10
-
The new target is a single published npm package, `@rescript/webapi`, with a unified internal build and an external API that still preserves feature-level boundaries such as `WebApi.DOM`, `WebApi.Fetch`, and `WebApi.Base`.
10
+
The new target is a single published npm package, `@rescript/webapi`, with a unified internal build and an external API that still preserves feature-level boundaries such as `WebAPI.DOM`, `WebAPI.Fetch`, and `WebAPI.Base`.
11
11
12
12
## Goals
13
13
14
14
- Remove the monorepo/workspace package split.
15
15
- Move all feature sources from `packages/<Pkg>/src` to `src/<Pkg>`.
16
16
- Delete every subpackage `package.json` and `rescript.json`.
17
17
- Make the root `rescript.json` the single source of truth for sources, features, and ReScript dependencies.
18
-
- Preserve the logical public API boundaries as `WebApi.<Feature>`.
18
+
- Preserve the logical public API boundaries as `WebAPI.<Feature>`.
19
19
- Keep internal helper modules private through the new `public` source setting.
20
20
- Publish one npm package: `@rescript/webapi`.
21
21
- Let internal builds and downstream consumers compile only the features they need.
@@ -62,13 +62,13 @@ Each former package source directory is listed as its own source entry. Example
62
62
{
63
63
"dir": "src/DOM",
64
64
"subdirs": true,
65
-
"feature": "WebApi.DOM",
65
+
"feature": "WebAPI.DOM",
66
66
"public": ["DOM"]
67
67
},
68
68
{
69
69
"dir": "src/Fetch",
70
70
"subdirs": true,
71
-
"feature": "WebApi.Fetch",
71
+
"feature": "WebAPI.Fetch",
72
72
"public": ["Fetch"]
73
73
},
74
74
{
@@ -83,7 +83,7 @@ Each former package source directory is listed as its own source entry. Example
83
83
Rules:
84
84
85
85
- Every former package gets one root source entry.
86
-
- The `feature` value matches the public module name, for example `"WebApi.DOM"` and `"WebApi.Fetch"`.
86
+
- The `feature` value matches the public module name, for example `"WebAPI.DOM"` and `"WebAPI.Fetch"`.
87
87
- The `public` list exposes only the feature entry module for that source directory.
88
88
- Helper modules such as `DomTypes` and `DomGlobal` stay internal because they are not listed in `public`.
The unified build must not expose raw internal file modules as first-class public API. Consumers should interact with a curated surface through the feature entry modules only.
@@ -240,7 +240,7 @@ The most important regression risks are:
240
240
241
241
- Use a single package instead of npm workspaces.
242
242
- Preserve feature boundaries in the external API.
243
-
- Use `WebApi.*` spelling, not `WebAPI.*`.
244
-
- Map feature names to public module names such as `"WebApi.DOM"`.
243
+
- Use `WebAPI.*` spelling, not `WebApi.*`.
244
+
- Map feature names to public module names such as `"WebAPI.DOM"`.
245
245
- Rename generic internal modules to feature-qualified names.
246
246
- Use source-level `public` settings so only the feature entry module is exposed.
0 commit comments