@atolljs/react-island 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Justin Henry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,11 +1,15 @@
1
1
  # @atolljs/react-island
2
2
 
3
+ [![CI](https://github.com/jwhenry3/atolljs/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jwhenry3/atolljs/actions/workflows/ci.yml)
4
+ [![codecov](https://codecov.io/gh/jwhenry3/atolljs/graph/badge.svg?branch=main)](https://codecov.io/gh/jwhenry3/atolljs)
5
+ [![Socket Badge](https://badge.socket.dev/npm/package/@atolljs/react-island)](https://badge.socket.dev/npm/package/@atolljs/react-island)
6
+
3
7
  The React shell surface for `@atolljs/islands` — mount a worker-hosted React
4
8
  (or imperative proxy-DOM) tree as an ordinary element in a main-thread React
5
9
  app. The worker's render loop produces a serialized op stream; this package's
6
10
  components own the mount lifecycle and replay it onto a real `div`.
7
11
 
8
- **[Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/#/quickstart)**
12
+ **[Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/quickstart/)**
9
13
 
10
14
  ## Install
11
15
 
@@ -111,9 +115,9 @@ the SAME worker (separate reconcilers, op queues, and pids — one OS thread).
111
115
 
112
116
  ## Documentation
113
117
 
114
- - [Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/#/quickstart)
115
- - [Worker islands for React](https://jwhenry3.github.io/atolljs/consumer/#/fw-react/worker-islands)
116
- - [Worker islands](https://jwhenry3.github.io/atolljs/consumer/#/islands) —
118
+ - [Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/quickstart/)
119
+ - [Worker islands for React](https://jwhenry3.github.io/atolljs/consumer/fw-react/worker-islands/)
120
+ - [Worker islands](https://jwhenry3.github.io/atolljs/consumer/islands/) —
117
121
  `mountIsland` options, `IslandHandle`, island rules
118
122
  - In-repo internals: [`docs/islands.md`](../../docs/islands.md),
119
123
  [`docs/islands-worker.md`](../../docs/islands-worker.md)
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@atolljs/react-island",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "React shell components for atoll-islands islands — <Island/>, islandComponent, lazyIsland",
5
- "homepage": "https://jwhenry3.github.io/atolljs/consumer/#/quickstart",
5
+ "homepage": "https://jwhenry3.github.io/atolljs/consumer/quickstart/",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": "./src/index.tsx",
@@ -16,8 +16,8 @@
16
16
  "registry": "https://registry.npmjs.org"
17
17
  },
18
18
  "peerDependencies": {
19
- "@atolljs/core": "0.1.1",
20
- "@atolljs/islands": "0.1.1",
19
+ "@atolljs/core": "0.1.3",
20
+ "@atolljs/islands": "0.1.3",
21
21
  "react": "^19.3.0",
22
22
  "react-dom": "^19.3.0",
23
23
  "react-reconciler": "^0.34.0"
@@ -34,5 +34,6 @@
34
34
  },
35
35
  "bugs": {
36
36
  "url": "https://github.com/jwhenry3/atolljs/issues"
37
- }
37
+ },
38
+ "license": "MIT"
38
39
  }
package/src/index.tsx CHANGED
@@ -82,8 +82,13 @@ export interface IslandProps<A = string>
82
82
  */
83
83
  worker?: (() => Worker) | URL;
84
84
  client?: IslandClient;
85
- /** Extra pool options — concurrency, taskTimeout, respawn… (poolSize stays 1). */
86
- workerOptions?: IslandWorkerOptions;
85
+ /**
86
+ * Extra pool options — concurrency, taskTimeout, respawn… (poolSize stays
87
+ * 1). `doorbell: false` builds the shorthand client message-only — no
88
+ * SharedArrayBuffer, no COOP/COEP requirement (same as `mode: 'poll'` on
89
+ * a direct `mountIsland` shorthand mount).
90
+ */
91
+ workerOptions?: IslandWorkerOptions & { doorbell?: boolean };
87
92
  /**
88
93
  * Initial flush mode — 'push' (default) drives op replay off the
89
94
  * shared-memory doorbell (needs cross-origin isolation); 'poll' drains on
@@ -272,7 +277,8 @@ export interface IslandShellProps {
272
277
  /** How to reach the worker — see IslandProps.worker/client. */
273
278
  worker?: (() => Worker) | URL;
274
279
  client?: IslandClient;
275
- workerOptions?: IslandWorkerOptions;
280
+ /** See IslandProps.workerOptions — `doorbell` included. */
281
+ workerOptions?: IslandWorkerOptions & { doorbell?: boolean };
276
282
  /** Initial flush mode — see IslandProps.mode. */
277
283
  mode?: Mode;
278
284
  /** Island → shell channel: every `emit` op lands here. */
@@ -323,12 +329,14 @@ const splitProxyProps = (
323
329
 
324
330
  /* ── Shared proxy implementation ─────────────────────────────────────────── */
325
331
 
326
- type LazyModule<A> = A | { default: A } | { app: A; worker?: (() => Worker) | URL };
332
+ type LazyModule<A> = A | { default: A } | { app: A | string; worker?: (() => Worker) | URL };
327
333
 
328
334
  /** Cached state for a lazy loader. One cache entry per loader function. */
329
335
  interface LazyState {
330
336
  promise: Promise<unknown>;
331
- value?: IslandAppLike;
337
+ // Contract modules may carry a registry-key string instead of the app —
338
+ // `Island`'s `app` prop accepts `IslandAppRef` (name or reference).
339
+ value?: IslandAppLike | string;
332
340
  worker?: (() => Worker) | URL;
333
341
  error?: unknown;
334
342
  }
@@ -337,7 +345,7 @@ const lazyCache = new WeakMap<() => Promise<LazyModule<IslandAppLike>>, LazyStat
337
345
 
338
346
  /** Resolve a lazy module through Suspense; reused across re-renders. */
339
347
  function useLazyApp(loader: () => Promise<LazyModule<IslandAppLike>>): {
340
- app?: IslandAppLike;
348
+ app?: IslandAppLike | string;
341
349
  worker?: (() => Worker) | URL;
342
350
  } {
343
351
  let state = lazyCache.get(loader);
@@ -1,3 +1,4 @@
1
+ /// <reference path="./react-reconciler.d.ts" />
1
2
  /**
2
3
  * The React-runtime half of a React island — `react`, `react-reconciler`
3
4
  * and the host config live HERE so a worker bundle whose registry holds only
package/src/worker.ts CHANGED
@@ -97,9 +97,10 @@ export interface ReactPolyWorkerRegistry {
97
97
  /**
98
98
  * Name → React component (or `{ imperative }` app) registry, mirroring
99
99
  * `definePolyWorker({ apps })`. Components pass through `reactIslandApp`;
100
- * imperative defs register as-is.
100
+ * imperative defs and already-wrapped apps (e.g. `reactIsland()` results)
101
+ * register as-is.
101
102
  */
102
- apps: Record<string, AnyComponent | ImperativeIslandApp>;
103
+ apps: Record<string, AnyComponent | ImperativeIslandApp | RenderedIslandApp>;
103
104
  /** Doorbell contract override — forwarded to `definePolyWorker`. */
104
105
  sharedMemory?: SharedMemory<DoorbellSpec>;
105
106
  }
@@ -129,7 +130,7 @@ export function defineReactPolyWorker(
129
130
  * component (or `{ imperative }` app), the isolated-bundle host shape.
130
131
  */
131
132
  export function defineReactMonoWorker(
132
- app: AnyComponent | ImperativeIslandApp,
133
+ app: AnyComponent | ImperativeIslandApp | RenderedIslandApp,
133
134
  options?: { sharedMemory?: SharedMemory<DoorbellSpec> },
134
135
  ): WorkerDefinition<DoorbellSpec, IslandWorkerMethods> {
135
136
  return typeof app === 'function'