@farm.js/core 0.1.83 → 0.1.85
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/dist/{analyzer-Y6IY26HI.mjs → analyzer-R6KNJ6IO.mjs} +2 -2
- package/dist/analyzer-XVY76XMM.cjs +17 -0
- package/dist/{app.d-eSm7jgoc.d.mts → app.d-Bvpc2eJq.d.mts} +1 -1
- package/dist/{app.d-CVPu_hoD.d.ts → app.d-DEKpJEp4.d.ts} +1 -1
- package/dist/{chunk-R3VLM2MW.mjs → chunk-2DMOB6BH.mjs} +5 -5
- package/dist/{chunk-3CZ4MJHW.cjs → chunk-3HWNYLQV.cjs} +1 -1
- package/dist/{chunk-NGTZHWBG.cjs → chunk-3OKSEJ33.cjs} +31 -10
- package/dist/{chunk-B5SJYXJK.mjs → chunk-3TCFONUE.mjs} +16 -7
- package/dist/{chunk-U56Z3755.mjs → chunk-4QCMTIBM.mjs} +9 -9
- package/dist/{chunk-DZTWUEBB.cjs → chunk-7TPLDPNC.cjs} +10 -10
- package/dist/{chunk-55UJGUBP.cjs → chunk-BBX4RPOV.cjs} +13 -13
- package/dist/{chunk-RGTZAM6Y.mjs → chunk-BCCCPFHQ.mjs} +25 -4
- package/dist/{chunk-IABI62FH.cjs → chunk-BZN5HX7Y.cjs} +2 -2
- package/dist/{chunk-FFWSER54.mjs → chunk-CDZ55QRD.mjs} +1 -1
- package/dist/{chunk-IAIRQAHA.mjs → chunk-CWUQBECF.mjs} +1 -1
- package/dist/{chunk-BBVLOEND.cjs → chunk-F7JVO3OZ.cjs} +4 -4
- package/dist/{chunk-NDWI6FDH.mjs → chunk-GFVPQ25Z.mjs} +132 -33
- package/dist/{chunk-5X5GJU5A.cjs → chunk-GLNVLCUH.cjs} +6 -6
- package/dist/{chunk-JHRJ5V2F.cjs → chunk-H6C45DCF.cjs} +165 -162
- package/dist/{chunk-LN6FAYNB.cjs → chunk-HKJIUZS5.cjs} +2 -2
- package/dist/{chunk-ORBBAA7B.mjs → chunk-J7VIXTPQ.mjs} +1 -1
- package/dist/{chunk-HRH7OKBQ.cjs → chunk-L3BSHASB.cjs} +4 -4
- package/dist/{chunk-ELNRKD4V.mjs → chunk-L5HDCDFT.mjs} +1 -1
- package/dist/chunk-MAPHNGTF.cjs +98 -0
- package/dist/{chunk-RE5E2G5S.cjs → chunk-MNUYXZV7.cjs} +2 -18
- package/dist/{chunk-YSU3WCW6.mjs → chunk-MYSH5Y4E.mjs} +1 -1
- package/dist/{chunk-EFI6QWBQ.cjs → chunk-OYM6VJEF.cjs} +35 -26
- package/dist/{chunk-43N3X6OO.mjs → chunk-PQR5A7R2.mjs} +1 -1
- package/dist/{chunk-3DAJXBSL.cjs → chunk-Q7GB3I4O.cjs} +2 -2
- package/dist/{chunk-A5BHJHDF.cjs → chunk-QUHDVJMR.cjs} +3 -3
- package/dist/chunk-RJBUI5AN.mjs +18 -0
- package/dist/chunk-RQ6XX5IN.mjs +98 -0
- package/dist/{chunk-OM6JIIJU.cjs → chunk-RVJQHQCG.cjs} +4 -4
- package/dist/{chunk-WCSBYQOT.cjs → chunk-TOUC6BR3.cjs} +4 -4
- package/dist/{chunk-WZV2G2A6.mjs → chunk-U6HUVY5R.mjs} +90 -29
- package/dist/{chunk-SLIXHUMS.cjs → chunk-UEQC4ZLP.cjs} +446 -347
- package/dist/{chunk-7X2CYE66.cjs → chunk-WYTK7HQS.cjs} +261 -200
- package/dist/{chunk-DPUZVGXH.mjs → chunk-X7RSOEMQ.mjs} +33 -30
- package/dist/{chunk-NKVBWPXR.mjs → chunk-XIXAUXV3.mjs} +1 -1
- package/dist/{chunk-RNJX3MD6.mjs → chunk-YS647ASS.mjs} +1 -1
- package/dist/{chunk-VQ6IXALL.mjs → chunk-YX532KEF.mjs} +2 -2
- package/dist/{chunk-K3GHY7GY.mjs → chunk-Z3LOPHSO.mjs} +1 -1
- package/dist/{client-component.d-DLknFP8l.d.ts → client-component.d-CZG02pIh.d.ts} +2 -1
- package/dist/{client-component.d-DLMCzmUx.d.mts → client-component.d-miqIXyQv.d.mts} +2 -1
- package/dist/{devtools-OI52TCSD.mjs → devtools-34ZQWX3M.mjs} +4 -4
- package/dist/{devtools-ZM2AR36W.cjs → devtools-SXL5RFE5.cjs} +6 -6
- package/dist/docs.cjs +6 -6
- package/dist/docs.mjs +5 -5
- package/dist/environment/vite.cjs +5 -5
- package/dist/environment/vite.mjs +4 -4
- package/dist/index.cjs +26 -25
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +26 -25
- package/dist/internal/build-runtime.cjs +26 -25
- package/dist/internal/build-runtime.mjs +25 -24
- package/dist/internal/cli-runtime.cjs +8 -8
- package/dist/internal/cli-runtime.mjs +7 -7
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +3 -37
- package/dist/internal/client-runtime.d.ts +3 -37
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-runtime.cjs +15 -8
- package/dist/internal/islands-runtime.d.mts +2 -3
- package/dist/internal/islands-runtime.d.ts +2 -3
- package/dist/internal/islands-runtime.mjs +15 -8
- package/dist/internal/islands-server-tree.cjs +8 -0
- package/dist/internal/islands-server-tree.d.mts +5 -0
- package/dist/internal/islands-server-tree.d.ts +5 -0
- package/dist/internal/islands-server-tree.mjs +8 -0
- package/dist/internal/islx-actions-server.d.mts +0 -3
- package/dist/internal/islx-actions-server.d.ts +0 -3
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +15 -15
- package/dist/internal/production-runtime.mjs +21 -21
- package/dist/internal/renderer-islands.cjs +47 -0
- package/dist/internal/renderer-islands.d.mts +32 -0
- package/dist/internal/renderer-islands.d.ts +32 -0
- package/dist/internal/renderer-islands.mjs +47 -0
- package/dist/island-runtime.d-BA7EPo1v.d.ts +38 -0
- package/dist/island-runtime.d-BBS_YUSX.d.mts +38 -0
- package/dist/plugin.cjs +20 -19
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +19 -18
- package/dist/renderer.cjs +8 -2
- package/dist/renderer.d.mts +81 -1
- package/dist/renderer.d.ts +81 -1
- package/dist/renderer.mjs +7 -1
- package/dist/{rsc-pipeline-MFJZGDPE.cjs → rsc-pipeline-ESPGX4VX.cjs} +9 -9
- package/dist/{rsc-pipeline-TRZVFCBX.mjs → rsc-pipeline-MW2V3WEE.mjs} +8 -8
- package/dist/{runtime-MJUG2HGR.cjs → runtime-FCMLEBTX.cjs} +13 -14
- package/dist/{runtime-O4Y3Z6V3.mjs → runtime-KGSOEMLT.mjs} +10 -11
- package/dist/server.cjs +50 -50
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.mjs +28 -28
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +20 -19
- package/dist/vite.d.mts +8 -2
- package/dist/vite.d.ts +8 -2
- package/dist/vite.mjs +19 -18
- package/package.json +13 -3
- package/dist/analyzer-WGH6J2HN.cjs +0 -17
- package/dist/chunk-4QENVMG7.mjs +0 -34
- package/dist/{chunk-NEKO3HM2.cjs → chunk-4B6YJ5DS.cjs} +2 -2
- package/dist/{chunk-CA2HBLXP.mjs → chunk-4EEAPBNV.mjs} +3 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FarmRendererClientRoot } from '../renderer.js';
|
|
2
|
+
import { s as scheduleFarmIslandHydration } from '../island-runtime.d-BA7EPo1v.js';
|
|
3
|
+
import '../deployment.js';
|
|
4
|
+
import '../island.d-CfGru1MO.js';
|
|
5
|
+
|
|
6
|
+
interface FarmRendererIslandRuntimeOptions {
|
|
7
|
+
/** The renderer's client module. */
|
|
8
|
+
renderer: {
|
|
9
|
+
createElement(type: unknown, props?: unknown): unknown;
|
|
10
|
+
hydrateRoot(container: Element, element: unknown): FarmRendererClientRoot;
|
|
11
|
+
};
|
|
12
|
+
/** Imports an island's module by the reference `<f-island src>` carries. */
|
|
13
|
+
load(reference: string): Promise<Record<string, unknown>>;
|
|
14
|
+
schedule: typeof scheduleFarmIslandHydration;
|
|
15
|
+
}
|
|
16
|
+
interface FarmRendererIslandRuntime {
|
|
17
|
+
/** Starts the islands under `scope` that aren't started yet. */
|
|
18
|
+
hydrate(scope?: ParentNode, signal?: AbortSignal): Promise<void>;
|
|
19
|
+
/** Unmounts the islands under `scope`, and drops the ones there still waiting to start. */
|
|
20
|
+
dispose(scope?: ParentNode): void;
|
|
21
|
+
/**
|
|
22
|
+
* Unmounts the islands whose markup is gone. A root that re-renders the page around them, such
|
|
23
|
+
* as a hydrating layout on navigation, replaces their markup without telling the runtime.
|
|
24
|
+
*/
|
|
25
|
+
prune(): void;
|
|
26
|
+
/** Islands mode carries islands over a refresh; these islands start again instead. */
|
|
27
|
+
carryOver(): void;
|
|
28
|
+
rootCount(): number;
|
|
29
|
+
}
|
|
30
|
+
declare function createFarmRendererIslandRuntime(options: FarmRendererIslandRuntimeOptions): FarmRendererIslandRuntime;
|
|
31
|
+
|
|
32
|
+
export { type FarmRendererIslandRuntime, type FarmRendererIslandRuntimeOptions, createFarmRendererIslandRuntime };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import "../chunk-TIZJYHB7.mjs";
|
|
2
|
+
|
|
3
|
+
// src/client/renderer-islands.ts
|
|
4
|
+
import { createIslandRuntime, defineIslandRenderer } from "@farm.js/islx/islands/client";
|
|
5
|
+
function createFarmRendererIslandRuntime(options) {
|
|
6
|
+
const containers = /* @__PURE__ */ new Set();
|
|
7
|
+
const islands = createIslandRuntime({
|
|
8
|
+
renderer: defineIslandRenderer({
|
|
9
|
+
hydrate(container, component, props) {
|
|
10
|
+
const root = options.renderer.hydrateRoot(
|
|
11
|
+
container,
|
|
12
|
+
options.renderer.createElement(component, props)
|
|
13
|
+
);
|
|
14
|
+
containers.add(container);
|
|
15
|
+
return {
|
|
16
|
+
unmount() {
|
|
17
|
+
containers.delete(container);
|
|
18
|
+
root.unmount();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
load: options.load,
|
|
24
|
+
schedule: options.schedule,
|
|
25
|
+
report: (message, error) => console.error(`[Farm.js] ${message}`, error)
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
async hydrate(scope = document, signal) {
|
|
29
|
+
if (signal?.aborted) return;
|
|
30
|
+
await islands.hydrate(scope);
|
|
31
|
+
},
|
|
32
|
+
dispose(scope = document) {
|
|
33
|
+
islands.dispose(scope);
|
|
34
|
+
},
|
|
35
|
+
prune() {
|
|
36
|
+
for (const container of Array.from(containers)) {
|
|
37
|
+
if (!container.isConnected) islands.dispose(container);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
carryOver() {
|
|
41
|
+
},
|
|
42
|
+
rootCount: () => containers.size
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
createFarmRendererIslandRuntime
|
|
47
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { F as FarmIslandStrategy } from './island.d-CfGru1MO.js';
|
|
2
|
+
|
|
3
|
+
interface ScheduleFarmIslandHydrationOptions<T> {
|
|
4
|
+
container: Element;
|
|
5
|
+
strategy?: FarmIslandStrategy | null;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
hydrate: () => T | Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reproduce one entry of the pre-hydration queue as the kind of interaction it
|
|
11
|
+
* was. Every path that drains the queue has to use this: a held submit
|
|
12
|
+
* replayed as a click does nothing, because click() on a form is a no-op.
|
|
13
|
+
*/
|
|
14
|
+
declare function replayFarmQueuedInteraction(target: Element, kind: unknown): void;
|
|
15
|
+
/**
|
|
16
|
+
* Holds clicks and submits on islands that have not hydrated in the pre-hydration queue, as the
|
|
17
|
+
* boot script does, until the returned function runs. Islands mode's entry holds them while islx
|
|
18
|
+
* loads (RFC 0010): the boot stops holding once the entry runs, and each island's scheduler starts
|
|
19
|
+
* it and replays them when it reaches it. `island` is the islands' element name.
|
|
20
|
+
*/
|
|
21
|
+
declare function holdFarmIslandInteractions(island: string): () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Calls `due` once an island under `scope` reaches its trigger, by the rules the boot script and
|
|
24
|
+
* the scheduler follow, without holding or replaying anything. Islands mode's entry loads islx then
|
|
25
|
+
* (RFC 0010), and islx's schedulers take over: a held interaction is in the queue they read, and a
|
|
26
|
+
* trigger that fired fires again for them. A form counts as the boot counts it, as islx is what
|
|
27
|
+
* posts it without a page load. Returns null when an island is due already (it hydrates at load,
|
|
28
|
+
* holds an interaction, or is not observable) or a Suspense boundary waits for the browser, else a
|
|
29
|
+
* function that stops watching.
|
|
30
|
+
*/
|
|
31
|
+
declare function watchFarmIslandTriggers(scope: Document | Element, island: string, due: () => void): (() => void) | null;
|
|
32
|
+
/**
|
|
33
|
+
* Defer importing and hydrating a server-rendered client boundary until its
|
|
34
|
+
* configured trigger. The returned promise resolves with the hydration result.
|
|
35
|
+
*/
|
|
36
|
+
declare function scheduleFarmIslandHydration<T>({ container, strategy, signal, hydrate, }: ScheduleFarmIslandHydrationOptions<T>): Promise<T | undefined>;
|
|
37
|
+
|
|
38
|
+
export { holdFarmIslandInteractions as h, replayFarmQueuedInteraction as r, scheduleFarmIslandHydration as s, watchFarmIslandTriggers as w };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { F as FarmIslandStrategy } from './island.d-CfGru1MO.mjs';
|
|
2
|
+
|
|
3
|
+
interface ScheduleFarmIslandHydrationOptions<T> {
|
|
4
|
+
container: Element;
|
|
5
|
+
strategy?: FarmIslandStrategy | null;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
hydrate: () => T | Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reproduce one entry of the pre-hydration queue as the kind of interaction it
|
|
11
|
+
* was. Every path that drains the queue has to use this: a held submit
|
|
12
|
+
* replayed as a click does nothing, because click() on a form is a no-op.
|
|
13
|
+
*/
|
|
14
|
+
declare function replayFarmQueuedInteraction(target: Element, kind: unknown): void;
|
|
15
|
+
/**
|
|
16
|
+
* Holds clicks and submits on islands that have not hydrated in the pre-hydration queue, as the
|
|
17
|
+
* boot script does, until the returned function runs. Islands mode's entry holds them while islx
|
|
18
|
+
* loads (RFC 0010): the boot stops holding once the entry runs, and each island's scheduler starts
|
|
19
|
+
* it and replays them when it reaches it. `island` is the islands' element name.
|
|
20
|
+
*/
|
|
21
|
+
declare function holdFarmIslandInteractions(island: string): () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Calls `due` once an island under `scope` reaches its trigger, by the rules the boot script and
|
|
24
|
+
* the scheduler follow, without holding or replaying anything. Islands mode's entry loads islx then
|
|
25
|
+
* (RFC 0010), and islx's schedulers take over: a held interaction is in the queue they read, and a
|
|
26
|
+
* trigger that fired fires again for them. A form counts as the boot counts it, as islx is what
|
|
27
|
+
* posts it without a page load. Returns null when an island is due already (it hydrates at load,
|
|
28
|
+
* holds an interaction, or is not observable) or a Suspense boundary waits for the browser, else a
|
|
29
|
+
* function that stops watching.
|
|
30
|
+
*/
|
|
31
|
+
declare function watchFarmIslandTriggers(scope: Document | Element, island: string, due: () => void): (() => void) | null;
|
|
32
|
+
/**
|
|
33
|
+
* Defer importing and hydrating a server-rendered client boundary until its
|
|
34
|
+
* configured trigger. The returned promise resolves with the hydration result.
|
|
35
|
+
*/
|
|
36
|
+
declare function scheduleFarmIslandHydration<T>({ container, strategy, signal, hydrate, }: ScheduleFarmIslandHydrationOptions<T>): Promise<T | undefined>;
|
|
37
|
+
|
|
38
|
+
export { holdFarmIslandInteractions as h, replayFarmQueuedInteraction as r, scheduleFarmIslandHydration as s, watchFarmIslandTriggers as w };
|
package/dist/plugin.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWYTK7HQScjs = require('./chunk-WYTK7HQS.cjs');
|
|
4
4
|
require('./chunk-Y2FEFQAY.cjs');
|
|
5
5
|
require('./chunk-3SPECQXI.cjs');
|
|
6
6
|
require('./chunk-RDADQG5S.cjs');
|
|
7
7
|
require('./chunk-RQRTH57V.cjs');
|
|
8
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-H6C45DCF.cjs');
|
|
9
9
|
require('./chunk-DMSXZNQR.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
@@ -13,34 +13,35 @@ require('./chunk-DMSXZNQR.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunkVACYUMXWcjs = require('./chunk-VACYUMXW.cjs');
|
|
16
|
-
require('./chunk-
|
|
17
|
-
require('./chunk-
|
|
16
|
+
require('./chunk-AQLHD6HZ.cjs');
|
|
17
|
+
require('./chunk-YKHRCY4T.cjs');
|
|
18
|
+
require('./chunk-L3BSHASB.cjs');
|
|
19
|
+
require('./chunk-GLNVLCUH.cjs');
|
|
20
|
+
require('./chunk-F7JVO3OZ.cjs');
|
|
18
21
|
require('./chunk-2OFP3IVA.cjs');
|
|
19
|
-
require('./chunk-5X5GJU5A.cjs');
|
|
20
22
|
require('./chunk-A4WWKG2B.cjs');
|
|
21
23
|
require('./chunk-2LHZD3OP.cjs');
|
|
24
|
+
require('./chunk-MAPHNGTF.cjs');
|
|
25
|
+
require('./chunk-RVJQHQCG.cjs');
|
|
22
26
|
require('./chunk-VS7HLH4S.cjs');
|
|
23
|
-
require('./chunk-
|
|
24
|
-
require('./chunk-YKHRCY4T.cjs');
|
|
25
|
-
require('./chunk-NEKO3HM2.cjs');
|
|
27
|
+
require('./chunk-4B6YJ5DS.cjs');
|
|
26
28
|
require('./chunk-3HLQTOVU.cjs');
|
|
27
29
|
require('./chunk-47JV57DA.cjs');
|
|
28
30
|
require('./chunk-FDGYDQGL.cjs');
|
|
29
|
-
require('./chunk-
|
|
30
|
-
require('./chunk-OM6JIIJU.cjs');
|
|
31
|
-
require('./chunk-WCSBYQOT.cjs');
|
|
31
|
+
require('./chunk-TOUC6BR3.cjs');
|
|
32
32
|
require('./chunk-W53Z4WDI.cjs');
|
|
33
|
-
require('./chunk-
|
|
33
|
+
require('./chunk-BZN5HX7Y.cjs');
|
|
34
|
+
require('./chunk-OZUINP2P.cjs');
|
|
35
|
+
require('./chunk-CKPTIEDX.cjs');
|
|
34
36
|
require('./chunk-WOAXQ5MZ.cjs');
|
|
35
37
|
require('./chunk-4EBC7EMW.cjs');
|
|
36
38
|
require('./chunk-PIUTGRDI.cjs');
|
|
37
|
-
require('./chunk-CKPTIEDX.cjs');
|
|
38
39
|
require('./chunk-OWOUTKIJ.cjs');
|
|
39
40
|
require('./chunk-FB4CWSC2.cjs');
|
|
40
41
|
require('./chunk-PHCJJJZV.cjs');
|
|
41
42
|
require('./chunk-AQIRXBBY.cjs');
|
|
42
43
|
require('./chunk-7EPYN7GW.cjs');
|
|
43
|
-
require('./chunk-
|
|
44
|
+
require('./chunk-OYM6VJEF.cjs');
|
|
44
45
|
require('./chunk-WMRGIQTA.cjs');
|
|
45
46
|
require('./chunk-7KJJ4SBS.cjs');
|
|
46
47
|
require('./chunk-5AMH6AFA.cjs');
|
|
@@ -53,12 +54,12 @@ require('./chunk-LSHX2H5G.cjs');
|
|
|
53
54
|
|
|
54
55
|
var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
|
|
55
56
|
require('./chunk-EACD6ND7.cjs');
|
|
56
|
-
require('./chunk-6JHZPB52.cjs');
|
|
57
57
|
require('./chunk-BTVDYS4B.cjs');
|
|
58
58
|
require('./chunk-OLKYHTLN.cjs');
|
|
59
|
-
require('./chunk-
|
|
59
|
+
require('./chunk-6JHZPB52.cjs');
|
|
60
|
+
require('./chunk-MNUYXZV7.cjs');
|
|
60
61
|
require('./chunk-52Q4OB4A.cjs');
|
|
61
|
-
require('./chunk-
|
|
62
|
+
require('./chunk-3OKSEJ33.cjs');
|
|
62
63
|
require('./chunk-MCSRMEQV.cjs');
|
|
63
64
|
require('./chunk-HQKCSJEH.cjs');
|
|
64
65
|
require('./chunk-XRFGOYXG.cjs');
|
|
@@ -125,7 +126,7 @@ require('./chunk-7Q7UB4TL.cjs');
|
|
|
125
126
|
require('./chunk-JYT7AN37.cjs');
|
|
126
127
|
require('./chunk-SUCDVKUB.cjs');
|
|
127
128
|
require('./chunk-PLJMEUAN.cjs');
|
|
128
|
-
require('./chunk-
|
|
129
|
+
require('./chunk-3HWNYLQV.cjs');
|
|
129
130
|
require('./chunk-OOZEU5KK.cjs');
|
|
130
131
|
require('./chunk-HA7YRO53.cjs');
|
|
131
132
|
require('./chunk-PO5MXV5X.cjs');
|
|
@@ -168,4 +169,4 @@ require('./chunk-UZM3PDKK.cjs');
|
|
|
168
169
|
|
|
169
170
|
|
|
170
171
|
|
|
171
|
-
exports.FARM_NODE_RESPONSE_END_PENDING = _chunkVACYUMXWcjs.FARM_NODE_RESPONSE_END_PENDING; exports.FarmDevEnvironmentError = _chunk25JGHAGHcjs.FarmDevEnvironmentError; exports.FarmRuntimeShutdownError = _chunkVACYUMXWcjs.FarmRuntimeShutdownError; exports.PluginManager = _chunkVACYUMXWcjs.PluginManager; exports.definePlugin = _chunkVACYUMXWcjs.definePlugin; exports.farmPlugin =
|
|
172
|
+
exports.FARM_NODE_RESPONSE_END_PENDING = _chunkVACYUMXWcjs.FARM_NODE_RESPONSE_END_PENDING; exports.FarmDevEnvironmentError = _chunk25JGHAGHcjs.FarmDevEnvironmentError; exports.FarmRuntimeShutdownError = _chunkVACYUMXWcjs.FarmRuntimeShutdownError; exports.PluginManager = _chunkVACYUMXWcjs.PluginManager; exports.definePlugin = _chunkVACYUMXWcjs.definePlugin; exports.farmPlugin = _chunkWYTK7HQScjs.farmPlugin; exports.loadFarmDevModule = _chunk25JGHAGHcjs.loadFarmDevModule; exports.resolveFarmDevtoolsConfig = _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig;
|
package/dist/plugin.d.mts
CHANGED
|
@@ -39,7 +39,7 @@ import './image-config.d-ByhQ0TT7.mjs';
|
|
|
39
39
|
import './config.d-BKIhJtmr.mjs';
|
|
40
40
|
import './types.d-DQnyD3VD.mjs';
|
|
41
41
|
import './font.mjs';
|
|
42
|
-
import './client-component.d-
|
|
42
|
+
import './client-component.d-miqIXyQv.mjs';
|
|
43
43
|
import './platform.mjs';
|
|
44
44
|
import './after.mjs';
|
|
45
45
|
import 'node:http';
|
package/dist/plugin.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ import './image-config.d-ByhQ0TT7.js';
|
|
|
39
39
|
import './config.d-BKIhJtmr.js';
|
|
40
40
|
import './types.d-DQnyD3VD.js';
|
|
41
41
|
import './font.js';
|
|
42
|
-
import './client-component.d-
|
|
42
|
+
import './client-component.d-CZG02pIh.js';
|
|
43
43
|
import './platform.js';
|
|
44
44
|
import './after.js';
|
|
45
45
|
import 'node:http';
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
farmPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-U6HUVY5R.mjs";
|
|
4
4
|
import "./chunk-7V5M43ND.mjs";
|
|
5
5
|
import "./chunk-ZIEO3DQ3.mjs";
|
|
6
6
|
import "./chunk-UD6KTSJS.mjs";
|
|
7
7
|
import "./chunk-RDSHEHBA.mjs";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-X7RSOEMQ.mjs";
|
|
9
9
|
import "./chunk-MO4UTDQ6.mjs";
|
|
10
10
|
import {
|
|
11
11
|
FARM_NODE_RESPONSE_END_PENDING,
|
|
@@ -13,34 +13,35 @@ import {
|
|
|
13
13
|
PluginManager,
|
|
14
14
|
definePlugin
|
|
15
15
|
} from "./chunk-IVP5Q4BX.mjs";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-SMUW7UST.mjs";
|
|
17
|
+
import "./chunk-UB7RVEMX.mjs";
|
|
18
|
+
import "./chunk-CWUQBECF.mjs";
|
|
19
|
+
import "./chunk-L5HDCDFT.mjs";
|
|
20
|
+
import "./chunk-MYSH5Y4E.mjs";
|
|
18
21
|
import "./chunk-YHHOTKUT.mjs";
|
|
19
|
-
import "./chunk-ELNRKD4V.mjs";
|
|
20
22
|
import "./chunk-HQ2VAJLW.mjs";
|
|
21
23
|
import "./chunk-UTUS6JUH.mjs";
|
|
24
|
+
import "./chunk-RQ6XX5IN.mjs";
|
|
25
|
+
import "./chunk-YS647ASS.mjs";
|
|
22
26
|
import "./chunk-EZYKV24V.mjs";
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-UB7RVEMX.mjs";
|
|
25
|
-
import "./chunk-CA2HBLXP.mjs";
|
|
27
|
+
import "./chunk-4EEAPBNV.mjs";
|
|
26
28
|
import "./chunk-LLZSYFOM.mjs";
|
|
27
29
|
import "./chunk-UUMKLGUU.mjs";
|
|
28
30
|
import "./chunk-ZXDX7VYZ.mjs";
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-RNJX3MD6.mjs";
|
|
31
|
-
import "./chunk-VQ6IXALL.mjs";
|
|
31
|
+
import "./chunk-YX532KEF.mjs";
|
|
32
32
|
import "./chunk-HR4N2K4V.mjs";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-PQR5A7R2.mjs";
|
|
34
|
+
import "./chunk-V7HNYR76.mjs";
|
|
35
|
+
import "./chunk-X3EFRVXY.mjs";
|
|
34
36
|
import "./chunk-2PFGA6PB.mjs";
|
|
35
37
|
import "./chunk-L4RTTTVE.mjs";
|
|
36
38
|
import "./chunk-GNZIAJGB.mjs";
|
|
37
|
-
import "./chunk-X3EFRVXY.mjs";
|
|
38
39
|
import "./chunk-XAXTTBUT.mjs";
|
|
39
40
|
import "./chunk-INKVDO42.mjs";
|
|
40
41
|
import "./chunk-K6HIIWUB.mjs";
|
|
41
42
|
import "./chunk-YFTGIHNC.mjs";
|
|
42
43
|
import "./chunk-HZOMT5DY.mjs";
|
|
43
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-3TCFONUE.mjs";
|
|
44
45
|
import "./chunk-D2VAANBS.mjs";
|
|
45
46
|
import "./chunk-S32PDOLO.mjs";
|
|
46
47
|
import "./chunk-ZEWWZJPZ.mjs";
|
|
@@ -53,12 +54,12 @@ import {
|
|
|
53
54
|
resolveFarmDevtoolsConfig
|
|
54
55
|
} from "./chunk-CU5SYTJG.mjs";
|
|
55
56
|
import "./chunk-NQ3Y6E2T.mjs";
|
|
56
|
-
import "./chunk-22W4FNTG.mjs";
|
|
57
57
|
import "./chunk-SQ5O7I3L.mjs";
|
|
58
58
|
import "./chunk-XGL42MQ7.mjs";
|
|
59
|
-
import "./chunk-
|
|
59
|
+
import "./chunk-22W4FNTG.mjs";
|
|
60
|
+
import "./chunk-RJBUI5AN.mjs";
|
|
60
61
|
import "./chunk-Z3RM3VA2.mjs";
|
|
61
|
-
import "./chunk-
|
|
62
|
+
import "./chunk-BCCCPFHQ.mjs";
|
|
62
63
|
import "./chunk-AOIUYHPH.mjs";
|
|
63
64
|
import "./chunk-7VJXYB6S.mjs";
|
|
64
65
|
import "./chunk-NLATR3T3.mjs";
|
|
@@ -125,7 +126,7 @@ import "./chunk-YT2ZMLXK.mjs";
|
|
|
125
126
|
import "./chunk-D2LCAV6L.mjs";
|
|
126
127
|
import "./chunk-H3ASZDT7.mjs";
|
|
127
128
|
import "./chunk-EILUVBKS.mjs";
|
|
128
|
-
import "./chunk-
|
|
129
|
+
import "./chunk-XIXAUXV3.mjs";
|
|
129
130
|
import "./chunk-QPNVDSFZ.mjs";
|
|
130
131
|
import "./chunk-GYMGK467.mjs";
|
|
131
132
|
import "./chunk-5Y4GYKKH.mjs";
|
package/dist/renderer.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
+
var _chunkMAPHNGTFcjs = require('./chunk-MAPHNGTF.cjs');
|
|
4
|
+
require('./chunk-7KJJ4SBS.cjs');
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
|
|
@@ -18,7 +20,10 @@
|
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunk3OKSEJ33cjs = require('./chunk-3OKSEJ33.cjs');
|
|
26
|
+
require('./chunk-3BIASUGR.cjs');
|
|
22
27
|
require('./chunk-UZM3PDKK.cjs');
|
|
23
28
|
|
|
24
29
|
|
|
@@ -40,4 +45,5 @@ require('./chunk-UZM3PDKK.cjs');
|
|
|
40
45
|
|
|
41
46
|
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
|
|
49
|
+
exports.FARM_COMPONENT_EXTENSIONS = _chunk3OKSEJ33cjs.FARM_COMPONENT_EXTENSIONS; exports.NO_RENDERER = _chunk3OKSEJ33cjs.NO_RENDERER; exports.REACT_RENDERER = _chunk3OKSEJ33cjs.REACT_RENDERER; exports.assertFarmRendererServerModule = _chunk3OKSEJ33cjs.assertFarmRendererServerModule; exports.assertFarmRendererStreamingRuntime = _chunk3OKSEJ33cjs.assertFarmRendererStreamingRuntime; exports.createFarmRendererHookError = _chunk3OKSEJ33cjs.createFarmRendererHookError; exports.defineRenderer = _chunk3OKSEJ33cjs.defineRenderer; exports.getFarmRendererCapabilities = _chunk3OKSEJ33cjs.getFarmRendererCapabilities; exports.getFarmRendererComponentExtensions = _chunk3OKSEJ33cjs.getFarmRendererComponentExtensions; exports.getFarmRendererStreamingCapabilitiesForRuntime = _chunk3OKSEJ33cjs.getFarmRendererStreamingCapabilitiesForRuntime; exports.isFarmRendererDisabled = _chunk3OKSEJ33cjs.isFarmRendererDisabled; exports.isReactRenderer = _chunk3OKSEJ33cjs.isReactRenderer; exports.loadFarmRendererVitePlugins = _chunk3OKSEJ33cjs.loadFarmRendererVitePlugins; exports.readFarmRendererHydration = _chunk3OKSEJ33cjs.readFarmRendererHydration; exports.readFarmRendererWebStream = _chunk3OKSEJ33cjs.readFarmRendererWebStream; exports.resolveFarmComponentExtensions = _chunk3OKSEJ33cjs.resolveFarmComponentExtensions; exports.resolveFarmIsland = _chunkMAPHNGTFcjs.resolveFarmIsland; exports.resolveFarmRenderer = _chunk3OKSEJ33cjs.resolveFarmRenderer; exports.resolveFarmRendererAppSetup = _chunk3OKSEJ33cjs.resolveFarmRendererAppSetup; exports.resolveFarmRendererModule = _chunk3OKSEJ33cjs.resolveFarmRendererModule;
|
package/dist/renderer.d.mts
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
1
|
import { FarmPresetRuntime } from './deployment.mjs';
|
|
2
2
|
import { F as FarmIslandStrategy } from './island.d-CfGru1MO.mjs';
|
|
3
3
|
|
|
4
|
+
/** What `withIsland` gets for each export of a client module. */
|
|
5
|
+
interface FarmIslandReference {
|
|
6
|
+
/** The module id the browser imports, as `<f-island src>` carries it. */
|
|
7
|
+
readonly src: string;
|
|
8
|
+
/** The component's export in that module. */
|
|
9
|
+
readonly export: string;
|
|
10
|
+
/** The module's `island` export, or `"load"`. A `client:*` attribute overrides it. */
|
|
11
|
+
readonly strategy: FarmIslandStrategy;
|
|
12
|
+
}
|
|
13
|
+
/** A script element to write: its attributes, unescaped, and its text, already escaped. */
|
|
14
|
+
interface FarmIslandScript {
|
|
15
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
16
|
+
/** Escaped for a script element. Write it raw, not as text the renderer escapes again. */
|
|
17
|
+
readonly text: string;
|
|
18
|
+
}
|
|
19
|
+
/** An island to render: the parts to write around the component, and its props. */
|
|
20
|
+
interface FarmResolvedIsland {
|
|
21
|
+
/** The component's props, without `client:*`. */
|
|
22
|
+
readonly props: Record<string, unknown>;
|
|
23
|
+
/** Value scripts to write before the island: the values this response hasn't sent yet. */
|
|
24
|
+
readonly values: readonly FarmIslandScript[];
|
|
25
|
+
/**
|
|
26
|
+
* The island element to write around the component: its tag (`f-island`) and its attributes
|
|
27
|
+
* (src, export, props id, strategy, style), unescaped.
|
|
28
|
+
*/
|
|
29
|
+
readonly element: {
|
|
30
|
+
readonly tag: string;
|
|
31
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
32
|
+
};
|
|
33
|
+
/** The props script to write right after the element. */
|
|
34
|
+
readonly script: FarmIslandScript;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The attributes that set one island's strategy where a client component is used. Add them to
|
|
38
|
+
* the renderer's `JSX.IntrinsicAttributes`, so `<Counter client:visible />` type-checks.
|
|
39
|
+
*/
|
|
40
|
+
interface FarmIslandAttributes {
|
|
41
|
+
"client:load"?: boolean | "";
|
|
42
|
+
"client:idle"?: boolean | "";
|
|
43
|
+
"client:visible"?: boolean | "";
|
|
44
|
+
"client:interaction"?: boolean | "";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The island a renderer writes for a client component rendered from server output, with
|
|
48
|
+
* `props` as written where it's used:
|
|
49
|
+
*
|
|
50
|
+
* - `client:*` is removed from the props and picks the strategy, before the module's `island`
|
|
51
|
+
* export (`reference.strategy`).
|
|
52
|
+
* - The island gets an id unique within the response.
|
|
53
|
+
* - The props go through islx's codec: JSON, `Date`, `Map`, `Set` and its other tagged types,
|
|
54
|
+
* and server actions. A value several islands of one response get is sent once.
|
|
55
|
+
*
|
|
56
|
+
* Returns `undefined` when the props can't reach the browser, such as a function that isn't a
|
|
57
|
+
* server action. Farm logs why, once, and the renderer renders the component without an island,
|
|
58
|
+
* so its server HTML stays without client code. A `client:*` attribute that isn't a strategy, has
|
|
59
|
+
* a value, or is one of two on the same element throws.
|
|
60
|
+
*/
|
|
61
|
+
declare function resolveFarmIsland(props: Record<string, unknown>, reference: FarmIslandReference): FarmResolvedIsland | undefined;
|
|
62
|
+
|
|
4
63
|
/**
|
|
5
64
|
* A rendering-library integration used by Farm's compiler, server renderer,
|
|
6
65
|
* and browser hydration runtime.
|
|
@@ -190,6 +249,16 @@ interface FarmRendererCapabilities {
|
|
|
190
249
|
* hydration leaves the server's markup there.
|
|
191
250
|
*/
|
|
192
251
|
hydrationFallback: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Whether the server module exports `withIsland`, so a client component rendered from server
|
|
254
|
+
* output hydrates as its own island when the app sets
|
|
255
|
+
* `experimental.isolatedClientHydration: "enabled"`. Experimental.
|
|
256
|
+
*
|
|
257
|
+
* Farm wraps each export of a client module in the server graph with `withIsland`, and the
|
|
258
|
+
* browser starts each island with the client module's `createElement` and `hydrateRoot`.
|
|
259
|
+
* Without it, those apps take the path they take today.
|
|
260
|
+
*/
|
|
261
|
+
islands: boolean;
|
|
193
262
|
}
|
|
194
263
|
interface FarmRendererCapabilitiesInput {
|
|
195
264
|
streaming?: Partial<FarmRendererStreamingPrimitives> & {
|
|
@@ -198,6 +267,8 @@ interface FarmRendererCapabilitiesInput {
|
|
|
198
267
|
reconcilesRerenders?: boolean;
|
|
199
268
|
functionComponents?: boolean;
|
|
200
269
|
hydrationFallback?: boolean;
|
|
270
|
+
/** The server module exports `withIsland`. Experimental; see `FarmRendererCapabilities`. */
|
|
271
|
+
islands?: boolean;
|
|
201
272
|
}
|
|
202
273
|
/** A client layout participating in a renderer-owned route update. */
|
|
203
274
|
interface FarmRendererRouteLayout {
|
|
@@ -262,6 +333,7 @@ declare function getFarmRendererStreamingCapabilitiesForRuntime(renderer: Pick<F
|
|
|
262
333
|
declare function assertFarmRendererServerModule(runtime: unknown, renderer: {
|
|
263
334
|
readonly name: string;
|
|
264
335
|
readonly server: string;
|
|
336
|
+
readonly capabilities?: Pick<FarmRendererCapabilitiesInput, "islands">;
|
|
265
337
|
}): void;
|
|
266
338
|
declare function assertFarmRendererStreamingRuntime(name: string, renderer: Pick<FarmRenderer, "capabilities"> | undefined, runtimeModule: Pick<Partial<FarmServerRendererRuntime>, "capabilities" | "renderToPipeableStream" | "renderToReadableStream">, runtime: FarmRendererRuntime | "unknown"): FarmRendererStreamingPrimitives;
|
|
267
339
|
declare const FARM_COMPONENT_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".jsx"];
|
|
@@ -302,6 +374,14 @@ interface FarmServerRendererRuntime {
|
|
|
302
374
|
renderServerTreePage?(element: unknown, options?: {
|
|
303
375
|
values?: boolean;
|
|
304
376
|
}): Promise<unknown>;
|
|
377
|
+
/**
|
|
378
|
+
* Wraps a client component so that, rendered from server output, it starts an island: it calls
|
|
379
|
+
* `resolveFarmIsland` and renders the result around the component. Inside a tree that
|
|
380
|
+
* `wrapClientGraph` marks, it renders the component plain. Farm calls it on each export of a
|
|
381
|
+
* client module in the server graph. Required when the descriptor declares
|
|
382
|
+
* `capabilities.islands`.
|
|
383
|
+
*/
|
|
384
|
+
withIsland?(component: unknown, reference: FarmIslandReference): unknown;
|
|
305
385
|
/**
|
|
306
386
|
* Optional: tag a plain function component so a renderer that compiles its
|
|
307
387
|
* own components can tell the two apart. Renderers without the hook treat
|
|
@@ -416,4 +496,4 @@ declare function loadFarmRendererVitePlugins(renderer: FarmRenderer, root: strin
|
|
|
416
496
|
buildLifetime?: AbortSignal;
|
|
417
497
|
}): Promise<unknown[]>;
|
|
418
498
|
|
|
419
|
-
export { FARM_COMPONENT_EXTENSIONS, type FarmRenderer, type FarmRendererCapabilities, type FarmRendererCapabilitiesInput, type FarmRendererClientRoot, type FarmRendererClientRuntime, type FarmRendererHydration, type FarmRendererHydrationOptions, type FarmRendererRenderOptions, type FarmRendererRoute, type FarmRendererRouteFile, type FarmRendererRouteKind, type FarmRendererRouteLayout, type FarmRendererRouteState, type FarmRendererRoutes, type FarmRendererRoutesContext, type FarmRendererRuntime, type FarmRendererStreamingCapabilities, type FarmRendererStreamingPrimitives, type FarmRendererViteModule, type FarmServerRendererRuntime, NO_RENDERER, REACT_RENDERER, assertFarmRendererServerModule, assertFarmRendererStreamingRuntime, createFarmRendererHookError, defineRenderer, getFarmRendererCapabilities, getFarmRendererComponentExtensions, getFarmRendererStreamingCapabilitiesForRuntime, isFarmRendererDisabled, isReactRenderer, loadFarmRendererVitePlugins, readFarmRendererHydration, readFarmRendererWebStream, resolveFarmComponentExtensions, resolveFarmRenderer, resolveFarmRendererAppSetup, resolveFarmRendererModule };
|
|
499
|
+
export { FARM_COMPONENT_EXTENSIONS, type FarmIslandAttributes, type FarmIslandReference, type FarmIslandScript, type FarmRenderer, type FarmRendererCapabilities, type FarmRendererCapabilitiesInput, type FarmRendererClientRoot, type FarmRendererClientRuntime, type FarmRendererHydration, type FarmRendererHydrationOptions, type FarmRendererRenderOptions, type FarmRendererRoute, type FarmRendererRouteFile, type FarmRendererRouteKind, type FarmRendererRouteLayout, type FarmRendererRouteState, type FarmRendererRoutes, type FarmRendererRoutesContext, type FarmRendererRuntime, type FarmRendererStreamingCapabilities, type FarmRendererStreamingPrimitives, type FarmRendererViteModule, type FarmResolvedIsland, type FarmServerRendererRuntime, NO_RENDERER, REACT_RENDERER, assertFarmRendererServerModule, assertFarmRendererStreamingRuntime, createFarmRendererHookError, defineRenderer, getFarmRendererCapabilities, getFarmRendererComponentExtensions, getFarmRendererStreamingCapabilitiesForRuntime, isFarmRendererDisabled, isReactRenderer, loadFarmRendererVitePlugins, readFarmRendererHydration, readFarmRendererWebStream, resolveFarmComponentExtensions, resolveFarmIsland, resolveFarmRenderer, resolveFarmRendererAppSetup, resolveFarmRendererModule };
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
1
|
import { FarmPresetRuntime } from './deployment.js';
|
|
2
2
|
import { F as FarmIslandStrategy } from './island.d-CfGru1MO.js';
|
|
3
3
|
|
|
4
|
+
/** What `withIsland` gets for each export of a client module. */
|
|
5
|
+
interface FarmIslandReference {
|
|
6
|
+
/** The module id the browser imports, as `<f-island src>` carries it. */
|
|
7
|
+
readonly src: string;
|
|
8
|
+
/** The component's export in that module. */
|
|
9
|
+
readonly export: string;
|
|
10
|
+
/** The module's `island` export, or `"load"`. A `client:*` attribute overrides it. */
|
|
11
|
+
readonly strategy: FarmIslandStrategy;
|
|
12
|
+
}
|
|
13
|
+
/** A script element to write: its attributes, unescaped, and its text, already escaped. */
|
|
14
|
+
interface FarmIslandScript {
|
|
15
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
16
|
+
/** Escaped for a script element. Write it raw, not as text the renderer escapes again. */
|
|
17
|
+
readonly text: string;
|
|
18
|
+
}
|
|
19
|
+
/** An island to render: the parts to write around the component, and its props. */
|
|
20
|
+
interface FarmResolvedIsland {
|
|
21
|
+
/** The component's props, without `client:*`. */
|
|
22
|
+
readonly props: Record<string, unknown>;
|
|
23
|
+
/** Value scripts to write before the island: the values this response hasn't sent yet. */
|
|
24
|
+
readonly values: readonly FarmIslandScript[];
|
|
25
|
+
/**
|
|
26
|
+
* The island element to write around the component: its tag (`f-island`) and its attributes
|
|
27
|
+
* (src, export, props id, strategy, style), unescaped.
|
|
28
|
+
*/
|
|
29
|
+
readonly element: {
|
|
30
|
+
readonly tag: string;
|
|
31
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
32
|
+
};
|
|
33
|
+
/** The props script to write right after the element. */
|
|
34
|
+
readonly script: FarmIslandScript;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The attributes that set one island's strategy where a client component is used. Add them to
|
|
38
|
+
* the renderer's `JSX.IntrinsicAttributes`, so `<Counter client:visible />` type-checks.
|
|
39
|
+
*/
|
|
40
|
+
interface FarmIslandAttributes {
|
|
41
|
+
"client:load"?: boolean | "";
|
|
42
|
+
"client:idle"?: boolean | "";
|
|
43
|
+
"client:visible"?: boolean | "";
|
|
44
|
+
"client:interaction"?: boolean | "";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The island a renderer writes for a client component rendered from server output, with
|
|
48
|
+
* `props` as written where it's used:
|
|
49
|
+
*
|
|
50
|
+
* - `client:*` is removed from the props and picks the strategy, before the module's `island`
|
|
51
|
+
* export (`reference.strategy`).
|
|
52
|
+
* - The island gets an id unique within the response.
|
|
53
|
+
* - The props go through islx's codec: JSON, `Date`, `Map`, `Set` and its other tagged types,
|
|
54
|
+
* and server actions. A value several islands of one response get is sent once.
|
|
55
|
+
*
|
|
56
|
+
* Returns `undefined` when the props can't reach the browser, such as a function that isn't a
|
|
57
|
+
* server action. Farm logs why, once, and the renderer renders the component without an island,
|
|
58
|
+
* so its server HTML stays without client code. A `client:*` attribute that isn't a strategy, has
|
|
59
|
+
* a value, or is one of two on the same element throws.
|
|
60
|
+
*/
|
|
61
|
+
declare function resolveFarmIsland(props: Record<string, unknown>, reference: FarmIslandReference): FarmResolvedIsland | undefined;
|
|
62
|
+
|
|
4
63
|
/**
|
|
5
64
|
* A rendering-library integration used by Farm's compiler, server renderer,
|
|
6
65
|
* and browser hydration runtime.
|
|
@@ -190,6 +249,16 @@ interface FarmRendererCapabilities {
|
|
|
190
249
|
* hydration leaves the server's markup there.
|
|
191
250
|
*/
|
|
192
251
|
hydrationFallback: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Whether the server module exports `withIsland`, so a client component rendered from server
|
|
254
|
+
* output hydrates as its own island when the app sets
|
|
255
|
+
* `experimental.isolatedClientHydration: "enabled"`. Experimental.
|
|
256
|
+
*
|
|
257
|
+
* Farm wraps each export of a client module in the server graph with `withIsland`, and the
|
|
258
|
+
* browser starts each island with the client module's `createElement` and `hydrateRoot`.
|
|
259
|
+
* Without it, those apps take the path they take today.
|
|
260
|
+
*/
|
|
261
|
+
islands: boolean;
|
|
193
262
|
}
|
|
194
263
|
interface FarmRendererCapabilitiesInput {
|
|
195
264
|
streaming?: Partial<FarmRendererStreamingPrimitives> & {
|
|
@@ -198,6 +267,8 @@ interface FarmRendererCapabilitiesInput {
|
|
|
198
267
|
reconcilesRerenders?: boolean;
|
|
199
268
|
functionComponents?: boolean;
|
|
200
269
|
hydrationFallback?: boolean;
|
|
270
|
+
/** The server module exports `withIsland`. Experimental; see `FarmRendererCapabilities`. */
|
|
271
|
+
islands?: boolean;
|
|
201
272
|
}
|
|
202
273
|
/** A client layout participating in a renderer-owned route update. */
|
|
203
274
|
interface FarmRendererRouteLayout {
|
|
@@ -262,6 +333,7 @@ declare function getFarmRendererStreamingCapabilitiesForRuntime(renderer: Pick<F
|
|
|
262
333
|
declare function assertFarmRendererServerModule(runtime: unknown, renderer: {
|
|
263
334
|
readonly name: string;
|
|
264
335
|
readonly server: string;
|
|
336
|
+
readonly capabilities?: Pick<FarmRendererCapabilitiesInput, "islands">;
|
|
265
337
|
}): void;
|
|
266
338
|
declare function assertFarmRendererStreamingRuntime(name: string, renderer: Pick<FarmRenderer, "capabilities"> | undefined, runtimeModule: Pick<Partial<FarmServerRendererRuntime>, "capabilities" | "renderToPipeableStream" | "renderToReadableStream">, runtime: FarmRendererRuntime | "unknown"): FarmRendererStreamingPrimitives;
|
|
267
339
|
declare const FARM_COMPONENT_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".jsx"];
|
|
@@ -302,6 +374,14 @@ interface FarmServerRendererRuntime {
|
|
|
302
374
|
renderServerTreePage?(element: unknown, options?: {
|
|
303
375
|
values?: boolean;
|
|
304
376
|
}): Promise<unknown>;
|
|
377
|
+
/**
|
|
378
|
+
* Wraps a client component so that, rendered from server output, it starts an island: it calls
|
|
379
|
+
* `resolveFarmIsland` and renders the result around the component. Inside a tree that
|
|
380
|
+
* `wrapClientGraph` marks, it renders the component plain. Farm calls it on each export of a
|
|
381
|
+
* client module in the server graph. Required when the descriptor declares
|
|
382
|
+
* `capabilities.islands`.
|
|
383
|
+
*/
|
|
384
|
+
withIsland?(component: unknown, reference: FarmIslandReference): unknown;
|
|
305
385
|
/**
|
|
306
386
|
* Optional: tag a plain function component so a renderer that compiles its
|
|
307
387
|
* own components can tell the two apart. Renderers without the hook treat
|
|
@@ -416,4 +496,4 @@ declare function loadFarmRendererVitePlugins(renderer: FarmRenderer, root: strin
|
|
|
416
496
|
buildLifetime?: AbortSignal;
|
|
417
497
|
}): Promise<unknown[]>;
|
|
418
498
|
|
|
419
|
-
export { FARM_COMPONENT_EXTENSIONS, type FarmRenderer, type FarmRendererCapabilities, type FarmRendererCapabilitiesInput, type FarmRendererClientRoot, type FarmRendererClientRuntime, type FarmRendererHydration, type FarmRendererHydrationOptions, type FarmRendererRenderOptions, type FarmRendererRoute, type FarmRendererRouteFile, type FarmRendererRouteKind, type FarmRendererRouteLayout, type FarmRendererRouteState, type FarmRendererRoutes, type FarmRendererRoutesContext, type FarmRendererRuntime, type FarmRendererStreamingCapabilities, type FarmRendererStreamingPrimitives, type FarmRendererViteModule, type FarmServerRendererRuntime, NO_RENDERER, REACT_RENDERER, assertFarmRendererServerModule, assertFarmRendererStreamingRuntime, createFarmRendererHookError, defineRenderer, getFarmRendererCapabilities, getFarmRendererComponentExtensions, getFarmRendererStreamingCapabilitiesForRuntime, isFarmRendererDisabled, isReactRenderer, loadFarmRendererVitePlugins, readFarmRendererHydration, readFarmRendererWebStream, resolveFarmComponentExtensions, resolveFarmRenderer, resolveFarmRendererAppSetup, resolveFarmRendererModule };
|
|
499
|
+
export { FARM_COMPONENT_EXTENSIONS, type FarmIslandAttributes, type FarmIslandReference, type FarmIslandScript, type FarmRenderer, type FarmRendererCapabilities, type FarmRendererCapabilitiesInput, type FarmRendererClientRoot, type FarmRendererClientRuntime, type FarmRendererHydration, type FarmRendererHydrationOptions, type FarmRendererRenderOptions, type FarmRendererRoute, type FarmRendererRouteFile, type FarmRendererRouteKind, type FarmRendererRouteLayout, type FarmRendererRouteState, type FarmRendererRoutes, type FarmRendererRoutesContext, type FarmRendererRuntime, type FarmRendererStreamingCapabilities, type FarmRendererStreamingPrimitives, type FarmRendererViteModule, type FarmResolvedIsland, type FarmServerRendererRuntime, NO_RENDERER, REACT_RENDERER, assertFarmRendererServerModule, assertFarmRendererStreamingRuntime, createFarmRendererHookError, defineRenderer, getFarmRendererCapabilities, getFarmRendererComponentExtensions, getFarmRendererStreamingCapabilitiesForRuntime, isFarmRendererDisabled, isReactRenderer, loadFarmRendererVitePlugins, readFarmRendererHydration, readFarmRendererWebStream, resolveFarmComponentExtensions, resolveFarmIsland, resolveFarmRenderer, resolveFarmRendererAppSetup, resolveFarmRendererModule };
|