@atolljs/react-island 0.1.1 → 0.1.2
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/README.md +4 -4
- package/package.json +4 -4
- package/src/index.tsx +14 -6
- package/src/worker.ts +4 -3
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ The React shell surface for `@atolljs/islands` — mount a worker-hosted React
|
|
|
5
5
|
app. The worker's render loop produces a serialized op stream; this package's
|
|
6
6
|
components own the mount lifecycle and replay it onto a real `div`.
|
|
7
7
|
|
|
8
|
-
**[Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer
|
|
8
|
+
**[Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/quickstart/)**
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
@@ -111,9 +111,9 @@ the SAME worker (separate reconcilers, op queues, and pids — one OS thread).
|
|
|
111
111
|
|
|
112
112
|
## Documentation
|
|
113
113
|
|
|
114
|
-
- [Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer
|
|
115
|
-
- [Worker islands for React](https://jwhenry3.github.io/atolljs/consumer
|
|
116
|
-
- [Worker islands](https://jwhenry3.github.io/atolljs/consumer
|
|
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/) —
|
|
117
117
|
`mountIsland` options, `IslandHandle`, island rules
|
|
118
118
|
- In-repo internals: [`docs/islands.md`](../../docs/islands.md),
|
|
119
119
|
[`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.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "React shell components for atoll-islands islands — <Island/>, islandComponent, lazyIsland",
|
|
5
|
-
"homepage": "https://jwhenry3.github.io/atolljs/consumer
|
|
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.
|
|
20
|
-
"@atolljs/islands": "0.1.
|
|
19
|
+
"@atolljs/core": "0.1.2",
|
|
20
|
+
"@atolljs/islands": "0.1.2",
|
|
21
21
|
"react": "^19.3.0",
|
|
22
22
|
"react-dom": "^19.3.0",
|
|
23
23
|
"react-reconciler": "^0.34.0"
|
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
|
-
/**
|
|
86
|
-
|
|
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
|
|
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
|
-
|
|
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);
|
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
|
|
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'
|