@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
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
hasFarmMobileClientEntry,
|
|
8
8
|
removeFarmMobileClientManifest
|
|
9
9
|
} from "./chunk-TM2E623I.mjs";
|
|
10
|
+
import {
|
|
11
|
+
loadFarmProductionVite
|
|
12
|
+
} from "./chunk-PSUYE5HR.mjs";
|
|
10
13
|
import {
|
|
11
14
|
FARM_COMPILE_CACHE_DIR,
|
|
12
15
|
FARM_DESKTOP_ENV_MODULE_FILE,
|
|
@@ -20,9 +23,6 @@ import {
|
|
|
20
23
|
createReactProductionModePlugin,
|
|
21
24
|
withProductionNodeEnv
|
|
22
25
|
} from "./chunk-ZZGQD3LL.mjs";
|
|
23
|
-
import {
|
|
24
|
-
loadFarmProductionVite
|
|
25
|
-
} from "./chunk-PSUYE5HR.mjs";
|
|
26
26
|
import {
|
|
27
27
|
generateNativeMCPPluginSource
|
|
28
28
|
} from "./chunk-KQH2COEJ.mjs";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
collectFarmNativeServerFns,
|
|
34
34
|
findFarmNativeScreenFiles
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-J7VIXTPQ.mjs";
|
|
36
36
|
import {
|
|
37
37
|
assertFarmDocsAdapterServesNoGuardedPages,
|
|
38
38
|
compileFarmDocsAdapterEdgeManifest,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
farmDocsAdapterServesGuardedPages,
|
|
41
41
|
listFarmDocsAdapterPages,
|
|
42
42
|
listFarmDocsPagePaths
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-Z3LOPHSO.mjs";
|
|
44
44
|
import {
|
|
45
45
|
FARM_DOCS_LAST_MODIFIED_MANIFEST,
|
|
46
46
|
createFarmDocsHandler,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
getDeployTargetForPreset,
|
|
71
71
|
hasCustomFarmRouteContext,
|
|
72
72
|
resolveDeployOutputPath
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-4QCMTIBM.mjs";
|
|
74
74
|
import {
|
|
75
75
|
resolveFarmInstrumentationFile
|
|
76
76
|
} from "./chunk-QRNYSISP.mjs";
|
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
resolveFarmNotFoundComponentPath,
|
|
116
116
|
resolveFarmRouteRootStrategy,
|
|
117
117
|
toBakedMarkdownSourcePath
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-X7RSOEMQ.mjs";
|
|
119
119
|
import {
|
|
120
120
|
TAILWIND_CSS_BROWSER_TARGET,
|
|
121
121
|
generateFarmClientPluginEntryCode,
|
|
@@ -131,7 +131,14 @@ import {
|
|
|
131
131
|
readRouteRenderingDirectiveFromFile,
|
|
132
132
|
resolveRouteRenderingConfig,
|
|
133
133
|
resolveRouteRenderingConfigFromFile
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-CWUQBECF.mjs";
|
|
135
|
+
import {
|
|
136
|
+
usesFarmRendererIslands
|
|
137
|
+
} from "./chunk-RQ6XX5IN.mjs";
|
|
138
|
+
import {
|
|
139
|
+
FARM_PRERENDER_ENV,
|
|
140
|
+
_farmWebMCPReportsEnabled
|
|
141
|
+
} from "./chunk-YS647ASS.mjs";
|
|
135
142
|
import {
|
|
136
143
|
HOISTED_HEAD_ELEMENT,
|
|
137
144
|
appMiddlewareMayHandlePath,
|
|
@@ -144,17 +151,13 @@ import {
|
|
|
144
151
|
layoutsCanCoverSamePage,
|
|
145
152
|
routeBoundaryCoversDirectory,
|
|
146
153
|
stripRouteGroups
|
|
147
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-4EEAPBNV.mjs";
|
|
148
155
|
import {
|
|
149
156
|
FARM_NATIVE_TREE_CONTENT_TYPE
|
|
150
157
|
} from "./chunk-LLZSYFOM.mjs";
|
|
151
158
|
import {
|
|
152
159
|
farmPluginMayAffectRuntimePath
|
|
153
160
|
} from "./chunk-UUMKLGUU.mjs";
|
|
154
|
-
import {
|
|
155
|
-
FARM_PRERENDER_ENV,
|
|
156
|
-
_farmWebMCPReportsEnabled
|
|
157
|
-
} from "./chunk-RNJX3MD6.mjs";
|
|
158
161
|
import {
|
|
159
162
|
FARM_API_CATALOG_PATH,
|
|
160
163
|
FARM_APP_MANIFEST_LEGACY_PATH,
|
|
@@ -162,7 +165,7 @@ import {
|
|
|
162
165
|
listFarmBuiltInRoutePaths,
|
|
163
166
|
resolveFarmApiCatalogInput,
|
|
164
167
|
resolveFarmAppManifestInput
|
|
165
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-YX532KEF.mjs";
|
|
166
169
|
import {
|
|
167
170
|
FARM_DEFAULT_MCP_PATH,
|
|
168
171
|
createFarmDefaultMCPServer,
|
|
@@ -170,7 +173,7 @@ import {
|
|
|
170
173
|
} from "./chunk-HR4N2K4V.mjs";
|
|
171
174
|
import {
|
|
172
175
|
isFarmPreviewDeploymentEnvironment
|
|
173
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-PQR5A7R2.mjs";
|
|
174
177
|
import {
|
|
175
178
|
FARM_NATIVE_SERVER_FN_PLUGIN
|
|
176
179
|
} from "./chunk-L4RTTTVE.mjs";
|
|
@@ -191,7 +194,7 @@ import {
|
|
|
191
194
|
withFarmSourceSnapshot,
|
|
192
195
|
withFarmSourceSnapshotOf,
|
|
193
196
|
withPackageClientBoundaryCache
|
|
194
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-3TCFONUE.mjs";
|
|
195
198
|
import {
|
|
196
199
|
generateFarmDocsAdapterClientRuntime,
|
|
197
200
|
getFarmDocsAdapterConfigModule
|
|
@@ -213,9 +216,6 @@ import {
|
|
|
213
216
|
applyFarmCspHashesToHtml,
|
|
214
217
|
createFarmCspNonce
|
|
215
218
|
} from "./chunk-22W4FNTG.mjs";
|
|
216
|
-
import {
|
|
217
|
-
resolveFarmServerComponentsMode
|
|
218
|
-
} from "./chunk-4QENVMG7.mjs";
|
|
219
219
|
import {
|
|
220
220
|
getFarmAppDirectories
|
|
221
221
|
} from "./chunk-Z3RM3VA2.mjs";
|
|
@@ -227,8 +227,9 @@ import {
|
|
|
227
227
|
isFarmRendererDisabled,
|
|
228
228
|
isReactRenderer,
|
|
229
229
|
loadFarmRendererVitePlugins,
|
|
230
|
-
resolveFarmRendererAppSetup
|
|
231
|
-
|
|
230
|
+
resolveFarmRendererAppSetup,
|
|
231
|
+
resolveFarmServerComponentsMode
|
|
232
|
+
} from "./chunk-BCCCPFHQ.mjs";
|
|
232
233
|
import {
|
|
233
234
|
applyFarmCronVercelCrons,
|
|
234
235
|
createFarmCronCloudflareConfig,
|
|
@@ -307,7 +308,7 @@ import {
|
|
|
307
308
|
} from "./chunk-2I6PUKWJ.mjs";
|
|
308
309
|
import {
|
|
309
310
|
FARM_VERSION
|
|
310
|
-
} from "./chunk-
|
|
311
|
+
} from "./chunk-XIXAUXV3.mjs";
|
|
311
312
|
import {
|
|
312
313
|
FARM_VIDEO_PLAYER_PATH
|
|
313
314
|
} from "./chunk-AG27TI6Q.mjs";
|
|
@@ -831,6 +832,7 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
831
832
|
const rendererFiles = dynamicFiles(options.rendererModules);
|
|
832
833
|
const rootFiles = dynamicFiles(options.rootModules);
|
|
833
834
|
const actionFiles = dynamicFiles(options.actionModules, rendererFiles);
|
|
835
|
+
const serverTreeFiles = dynamicFiles(options.serverTreeModules, rendererFiles);
|
|
834
836
|
return {
|
|
835
837
|
files,
|
|
836
838
|
entry: entryFiles.map(index),
|
|
@@ -838,6 +840,7 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
838
840
|
...rendererFiles.length > 0 ? { renderer: rendererFiles.map(index) } : {},
|
|
839
841
|
...rootFiles.length > 0 ? { root: rootFiles.map(index) } : {},
|
|
840
842
|
...actionFiles.length > 0 ? { actions: actionFiles.map(index) } : {},
|
|
843
|
+
...serverTreeFiles.length > 0 ? { serverTrees: serverTreeFiles.map(index) } : {},
|
|
841
844
|
modules
|
|
842
845
|
};
|
|
843
846
|
}
|
|
@@ -856,11 +859,17 @@ function createFarmClientModulePreloadPlugin(options) {
|
|
|
856
859
|
};
|
|
857
860
|
const rendererModules = await resolve(options.rendererImports);
|
|
858
861
|
const actionModules = await resolve(options.actionImports);
|
|
862
|
+
const serverTreeModules = await resolve(options.serverTreeImports);
|
|
859
863
|
await fs.mkdir(options.buildDir, { recursive: true });
|
|
860
864
|
await fs.writeFile(
|
|
861
865
|
path4.join(options.buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE),
|
|
862
866
|
JSON.stringify(
|
|
863
|
-
collectFarmClientModulePreloads(bundle, {
|
|
867
|
+
collectFarmClientModulePreloads(bundle, {
|
|
868
|
+
...options,
|
|
869
|
+
rendererModules,
|
|
870
|
+
actionModules,
|
|
871
|
+
serverTreeModules
|
|
872
|
+
})
|
|
864
873
|
)
|
|
865
874
|
);
|
|
866
875
|
}
|
|
@@ -882,6 +891,50 @@ function encodeFarmBuildJSONPlaceholder(value) {
|
|
|
882
891
|
return JSON.stringify(JSON.stringify(value)).slice(1, -1).replace(/'/g, "\\u0027").replace(/`/g, "\\u0060").replace(/\$/g, "\\u0024").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
883
892
|
}
|
|
884
893
|
|
|
894
|
+
// src/nitro/islands-react-chunk.ts
|
|
895
|
+
var REACT_MODULE = /[\\/]node_modules[\\/](?:react|react-dom|scheduler)[\\/]/;
|
|
896
|
+
function createFarmIslandsReactChunkGroup() {
|
|
897
|
+
let entryImportsReact;
|
|
898
|
+
return {
|
|
899
|
+
debugName: "react",
|
|
900
|
+
name(moduleId, context) {
|
|
901
|
+
if (!REACT_MODULE.test(moduleId)) return null;
|
|
902
|
+
entryImportsReact ?? (entryImportsReact = reactLoadsWithAnEntry(moduleId, context));
|
|
903
|
+
return entryImportsReact ? null : "react";
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
function reactLoadsWithAnEntry(moduleId, context) {
|
|
908
|
+
const react = /* @__PURE__ */ new Set();
|
|
909
|
+
const pending = [moduleId];
|
|
910
|
+
for (let id = pending.pop(); id !== void 0; id = pending.pop()) {
|
|
911
|
+
if (react.has(id) || !REACT_MODULE.test(id)) continue;
|
|
912
|
+
react.add(id);
|
|
913
|
+
const info = context.getModuleInfo(id);
|
|
914
|
+
if (info) pending.push(...info.importedIds, ...info.importers);
|
|
915
|
+
}
|
|
916
|
+
const seen = /* @__PURE__ */ new Set();
|
|
917
|
+
pending.push(...react);
|
|
918
|
+
for (let id = pending.pop(); id !== void 0; id = pending.pop()) {
|
|
919
|
+
if (seen.has(id)) continue;
|
|
920
|
+
seen.add(id);
|
|
921
|
+
const info = context.getModuleInfo(id);
|
|
922
|
+
if (!info) continue;
|
|
923
|
+
if (info.isEntry) return true;
|
|
924
|
+
pending.push(...info.importers);
|
|
925
|
+
}
|
|
926
|
+
return false;
|
|
927
|
+
}
|
|
928
|
+
function configuresFarmClientChunks(vite) {
|
|
929
|
+
const build2 = vite?.build;
|
|
930
|
+
const outputs = [build2?.rollupOptions?.output, build2?.rolldownOptions?.output].flat();
|
|
931
|
+
return outputs.some(
|
|
932
|
+
(output) => !!output && typeof output === "object" && ["manualChunks", "advancedChunks", "codeSplitting", "inlineDynamicImports"].some(
|
|
933
|
+
(key) => output[key] !== void 0
|
|
934
|
+
)
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
|
|
885
938
|
// src/nitro/client-route-table.ts
|
|
886
939
|
import fs2 from "fs/promises";
|
|
887
940
|
import path5 from "path";
|
|
@@ -3542,6 +3595,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3542
3595
|
entryFileNames: "[name]-h[hash].js",
|
|
3543
3596
|
chunkFileNames: "chunks/[name]-h[hash].js",
|
|
3544
3597
|
hashCharacters: "hex",
|
|
3598
|
+
...islandsMode && isReactRenderer(config.renderer) && !configuresFarmClientChunks(config.vite) ? { codeSplitting: { groups: [createFarmIslandsReactChunkGroup()] } } : {},
|
|
3545
3599
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
3546
3600
|
assetFileNames: (assetInfo) => {
|
|
3547
3601
|
if (assetInfo.name?.endsWith(".css")) {
|
|
@@ -3590,6 +3644,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3590
3644
|
],
|
|
3591
3645
|
// What a call's result is handled with, imported on the first (RFC 0013).
|
|
3592
3646
|
actionImports: ["@farm.js/core/internal/islands-action-client"],
|
|
3647
|
+
// What a root rebuilds a server tree with, imported with the first (RFC
|
|
3648
|
+
// 0013). A build without server trees has no chunk for it.
|
|
3649
|
+
serverTreeImports: ["@farm.js/core/internal/islands-server-tree"],
|
|
3593
3650
|
rendererImporter: clientEntryPath
|
|
3594
3651
|
} : {}
|
|
3595
3652
|
}),
|
|
@@ -5571,6 +5628,7 @@ installFarmLinkPrefetch();
|
|
|
5571
5628
|
}
|
|
5572
5629
|
});
|
|
5573
5630
|
const isolatedHydrationEnabled = isolatedBoundaryModules.size > 0;
|
|
5631
|
+
const rendererIslands = isolatedHydrationEnabled && !islandValues && !isReactRenderer(renderer) && getFarmRendererCapabilities(renderer).islands;
|
|
5574
5632
|
const serverTreeEnabled = isolatedHydrationEnabled && clientPages.some((page) => page.serverTree);
|
|
5575
5633
|
const islandsRuntimeExports = [
|
|
5576
5634
|
"createFarmIsolatedHydrationRuntime",
|
|
@@ -5610,7 +5668,7 @@ function loadFarmRenderer() {
|
|
|
5610
5668
|
}));
|
|
5611
5669
|
}
|
|
5612
5670
|
` : "";
|
|
5613
|
-
const isolatedHydrationImport = lazyRenderer ? "" : isolatedHydrationEnabled ? `${islandValues ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement${hasServerTreeLayouts ? ", createFarmServerTreeLayout" : ""} } from "@farm.js/core/internal/islands-runtime";` : 'import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";'}${serverTreeEnabled && !islandValues ? '\nimport { createFarmServerTreeElement } from "@farm.js/core/internal/server-tree";' : ""}` : "";
|
|
5671
|
+
const isolatedHydrationImport = lazyRenderer ? "" : rendererIslands ? 'import { createFarmRendererIslandRuntime } from "@farm.js/core/internal/renderer-islands";' : isolatedHydrationEnabled ? `${islandValues ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement${hasServerTreeLayouts ? ", createFarmServerTreeLayout" : ""} } from "@farm.js/core/internal/islands-runtime";` : 'import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";'}${serverTreeEnabled && !islandValues ? '\nimport { createFarmServerTreeElement } from "@farm.js/core/internal/server-tree";' : ""}` : "";
|
|
5614
5672
|
const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedBoundaryLoaders = {
|
|
5615
5673
|
${Array.from(isolatedBoundaryModules.entries()).map(
|
|
5616
5674
|
([reference, modulePath]) => ` ${JSON.stringify(reference)}: () => import(${JSON.stringify(modulePath)}),`
|
|
@@ -5686,7 +5744,15 @@ const farmIsolatedHydrationRuntime = {
|
|
|
5686
5744
|
endStream: function(root) {
|
|
5687
5745
|
whenFarmIslandsRuntime(root, function(runtime) { runtime.endStream(root); });
|
|
5688
5746
|
},
|
|
5689
|
-
};` : `const farmIsolatedHydrationRuntime =
|
|
5747
|
+
};` : rendererIslands ? `const farmIsolatedHydrationRuntime = createFarmRendererIslandRuntime({
|
|
5748
|
+
renderer: React,
|
|
5749
|
+
load: loadFarmIsolatedBoundary,
|
|
5750
|
+
schedule: scheduleFarmIslandHydration,
|
|
5751
|
+
});
|
|
5752
|
+
|
|
5753
|
+
// A hydrating layout keeps a page that doesn't hydrate as server HTML in a plain element. The
|
|
5754
|
+
// renderer's root never renders the page's islands, so the runtime starts them after each render.
|
|
5755
|
+
const FarmServerPage = "div";` : `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
|
|
5690
5756
|
ReactRuntime: React,
|
|
5691
5757
|
hydrateRoot,
|
|
5692
5758
|
load: loadFarmIsolatedBoundary,
|
|
@@ -5704,7 +5770,14 @@ function disposeFarmIsolatedClientBoundaries(scope) {
|
|
|
5704
5770
|
async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
|
|
5705
5771
|
await farmIsolatedHydrationRuntime.hydrate(scope, signal);
|
|
5706
5772
|
}
|
|
5707
|
-
${
|
|
5773
|
+
${rendererIslands ? `
|
|
5774
|
+
// After a hydrating layout renders another page: release the islands whose markup it replaced,
|
|
5775
|
+
// and start the new page's.
|
|
5776
|
+
async function hydrateFarmLayoutPageIslands(container) {
|
|
5777
|
+
farmIsolatedHydrationRuntime.prune();
|
|
5778
|
+
await hydrateFarmIsolatedClientBoundaries(container);
|
|
5779
|
+
}
|
|
5780
|
+
` : ""}${serverTreeEnabled ? `
|
|
5708
5781
|
/*farm-root-start*/
|
|
5709
5782
|
// A server-tree page (an async page below a hydrating layout) rebuilds in the layout's root.
|
|
5710
5783
|
async function createFarmServerTreePageElement(source, pathname) {
|
|
@@ -5723,7 +5796,7 @@ async function createFarmServerTreePageElement(source, pathname) {
|
|
|
5723
5796
|
/*farm-root-end*/` : "\n/*farm-root-start*/\nasync function createFarmServerTreePageElement() { return null; }\n/*farm-root-end*/"}` : `/*farm-root-start*/
|
|
5724
5797
|
async function createFarmServerTreePageElement() { return null; }
|
|
5725
5798
|
/*farm-root-end*/`;
|
|
5726
|
-
const routeClientGraphRuntime = isolatedHydrationEnabled ? `function wrapFarmRouteClientGraph(element) {
|
|
5799
|
+
const routeClientGraphRuntime = isolatedHydrationEnabled && !rendererIslands ? `function wrapFarmRouteClientGraph(element) {
|
|
5727
5800
|
return wrapFarmIsolatedClientGraph(React, element);
|
|
5728
5801
|
}` : `function wrapFarmRouteClientGraph(element) { return element; }`;
|
|
5729
5802
|
clientRouteSlots.forEach((slot, index) => {
|
|
@@ -6341,8 +6414,7 @@ ${lazyRenderer ? ` // React DOM and islx load with what first renders or hydrat
|
|
|
6341
6414
|
${isolatedHydrationEnabled ? `// Not cancelled with the page: a navigation disposes the islands it removes, and one in a
|
|
6342
6415
|
// layout it keeps still waits for its trigger, as on a page of islands only.
|
|
6343
6416
|
const isolatedHydration =
|
|
6344
|
-
!hasHydratableLayout(pathname)
|
|
6345
|
-
document.querySelector('f-island[src]')
|
|
6417
|
+
${rendererIslands ? "" : "!hasHydratableLayout(pathname) &&\n "}document.querySelector('f-island[src]')
|
|
6346
6418
|
? hydrateFarmIsolatedClientBoundaries(document)
|
|
6347
6419
|
: Promise.resolve();
|
|
6348
6420
|
await Promise.all([pageHydration, isolatedHydration]);` : "await pageHydration;"}
|
|
@@ -7011,7 +7083,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
7011
7083
|
if (routeState) {
|
|
7012
7084
|
farmRoot.renderFarmRoute(reactRoot, routeState);
|
|
7013
7085
|
window.__FARM_ROUTE_SLOTS__ = nextRouteSlots;
|
|
7014
|
-
setFarmHydrated();
|
|
7086
|
+
setFarmHydrated();${rendererIslands ? "\n await hydrateFarmLayoutPageIslands(currentRoot);" : ""}
|
|
7015
7087
|
return true;
|
|
7016
7088
|
}
|
|
7017
7089
|
}
|
|
@@ -7088,7 +7160,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
7088
7160
|
console.error("[Farm.js] Hydrating the page's islands failed:", error);
|
|
7089
7161
|
});
|
|
7090
7162
|
}
|
|
7091
|
-
}` : `if (matched.route.hasIsolatedClientBoundaries && !hydrateLayouts) {
|
|
7163
|
+
}` : `if (matched.route.hasIsolatedClientBoundaries${rendererIslands ? "" : " && !hydrateLayouts"}) {
|
|
7092
7164
|
await hydrateFarmIsolatedClientBoundaries(
|
|
7093
7165
|
isolatedHydrationScope,
|
|
7094
7166
|
navigation.controller.signal,
|
|
@@ -8160,6 +8232,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
8160
8232
|
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
8161
8233
|
const adapterHandler = generateFarmDocsAdapterHandlerArguments(config.docs, docsConfigModulePath);
|
|
8162
8234
|
const hasIsolatedClientGraphRuntime = isReactRenderer(config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
8235
|
+
const hasRendererIslandsGraph = isolatedClientBoundaryModules.size > 0 && usesFarmRendererIslands(config);
|
|
8163
8236
|
const rendererStreamingCapabilities = getFarmRendererStreamingCapabilitiesForRuntime(
|
|
8164
8237
|
config.renderer,
|
|
8165
8238
|
getFarmPresetRuntime(preset)
|
|
@@ -8198,6 +8271,18 @@ function renderFarmRouteServerTree(element, extra) {
|
|
|
8198
8271
|
isolate: isolateFarmRouteServerPage,${farmIslandsMode ? "\n values: true," : ""}
|
|
8199
8272
|
...extra,
|
|
8200
8273
|
});
|
|
8274
|
+
}` : hasRendererIslandsGraph ? `function wrapFarmRouteClientGraph(element) {
|
|
8275
|
+
return typeof ReactDOMServer.wrapClientGraph === "function" ? ReactDOMServer.wrapClientGraph(element) : element;
|
|
8276
|
+
}
|
|
8277
|
+
|
|
8278
|
+
function isolateFarmRouteServerPage(element) {
|
|
8279
|
+
return typeof ReactDOMServer.isolateServerPageGraph === "function" ? ReactDOMServer.isolateServerPageGraph(element) : element;
|
|
8280
|
+
}
|
|
8281
|
+
|
|
8282
|
+
function renderFarmRouteServerTree(element, extra) { return element; }
|
|
8283
|
+
|
|
8284
|
+
function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
8285
|
+
return React.createElement(Layout, { ...props, ...outlets });
|
|
8201
8286
|
}` : `function wrapFarmRouteClientGraph(element) { return element; }
|
|
8202
8287
|
|
|
8203
8288
|
function isolateFarmRouteServerPage(element) { return element; }
|
|
@@ -10339,6 +10424,8 @@ const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"([^>]*)>|"r
|
|
|
10339
10424
|
// A server action reference in a document's markup: an action in an island's or a client
|
|
10340
10425
|
// component's props (islx's \`{"$":"a",...}\`), or a server form posting one (its \`$F_REF_\` field).
|
|
10341
10426
|
const FARM_ACTION_REFERENCE_PATTERN = /"\\$":"a"|name="\\$F_REF_/;
|
|
10427
|
+
// A server tree in a document's markup: the payload a page or layout root rebuilds from.
|
|
10428
|
+
const FARM_SERVER_TREE_PATTERN = /<script type="f\\/tree"/;
|
|
10342
10429
|
|
|
10343
10430
|
function renderFarmClientModulePreload(index) {
|
|
10344
10431
|
return '\\n <link rel="modulepreload" href="/' +
|
|
@@ -10378,6 +10465,14 @@ function collectFarmClientActionModules(markup, listed) {
|
|
|
10378
10465
|
return actions.filter((index) => !listed.has(index) && listed.add(index));
|
|
10379
10466
|
}
|
|
10380
10467
|
|
|
10468
|
+
// The manifest indexes of islands mode's server trees (RFC 0013), for a document whose markup holds
|
|
10469
|
+
// one, leaving out those already listed. The islands runtime imports them with the first otherwise.
|
|
10470
|
+
function collectFarmClientServerTreeModules(markup, listed) {
|
|
10471
|
+
const trees = farmClientModulePreloads.serverTrees;
|
|
10472
|
+
if (!trees || typeof markup !== "string" || !FARM_SERVER_TREE_PATTERN.test(markup)) return [];
|
|
10473
|
+
return trees.filter((index) => !listed.has(index) && listed.add(index));
|
|
10474
|
+
}
|
|
10475
|
+
|
|
10381
10476
|
// The modulepreload links for a document: the entry's static imports and, unless it answers a
|
|
10382
10477
|
// client navigation, the renderer and, when a page or layout root hydrates in it (\`hydratesRoot\`),
|
|
10383
10478
|
// the code that renders it; then the modules its hydrating page and its markup load.
|
|
@@ -10391,6 +10486,7 @@ function renderFarmClientModulePreloads(markup, pageModule, navigation, hydrates
|
|
|
10391
10486
|
(hydratesRoot && !navigation ? farmClientRootPreloadTags : "") +
|
|
10392
10487
|
collectFarmClientDocumentModules(markup, pageModule, listed)
|
|
10393
10488
|
.concat(collectFarmClientActionModules(markup, listed))
|
|
10489
|
+
.concat(collectFarmClientServerTreeModules(markup, listed))
|
|
10394
10490
|
.map(renderFarmClientModulePreload)
|
|
10395
10491
|
.join("");
|
|
10396
10492
|
}
|
|
@@ -10423,11 +10519,14 @@ function renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy, na
|
|
|
10423
10519
|
)
|
|
10424
10520
|
: [];
|
|
10425
10521
|
const waitsForClick = rootStrategy === "interaction";
|
|
10426
|
-
// A call needs a hydrated island, so the action client comes with the renderer
|
|
10522
|
+
// A call needs a hydrated island, so the action client comes with the renderer, as do the server
|
|
10523
|
+
// trees a root rebuilds.
|
|
10524
|
+
const listed = new Set(entry.concat(rootModules));
|
|
10427
10525
|
const renderer = navigation
|
|
10428
10526
|
? []
|
|
10429
10527
|
: (farmClientModulePreloads.renderer || []).concat(
|
|
10430
|
-
collectFarmClientActionModules(markup,
|
|
10528
|
+
collectFarmClientActionModules(markup, listed),
|
|
10529
|
+
collectFarmClientServerTreeModules(markup, listed),
|
|
10431
10530
|
);
|
|
10432
10531
|
return attribute("data-farm-preload", waitsForClick ? entry : entry.concat(rootModules)) +
|
|
10433
10532
|
attribute("data-farm-preload-router", farmClientModulePreloads.router || []) +
|
|
@@ -5,7 +5,7 @@ var _chunkAQIRXBBYcjs = require('./chunk-AQIRXBBY.cjs');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk3OKSEJ33cjs = require('./chunk-3OKSEJ33.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunk2BEGVSDFcjs = require('./chunk-2BEGVSDF.cjs');
|
|
@@ -80,7 +80,7 @@ async function resolveFarmRendererRoutes(options) {
|
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
const extensions = [
|
|
83
|
-
...
|
|
83
|
+
..._chunk3OKSEJ33cjs.resolveFarmComponentExtensions.call(void 0, renderer.componentExtensions),
|
|
84
84
|
".md",
|
|
85
85
|
".mdx"
|
|
86
86
|
];
|
|
@@ -105,7 +105,7 @@ async function resolveFarmRendererRoutes(options) {
|
|
|
105
105
|
try {
|
|
106
106
|
rule = resolve2.call(rules, file);
|
|
107
107
|
} catch (error) {
|
|
108
|
-
throw
|
|
108
|
+
throw _chunk3OKSEJ33cjs.createFarmRendererHookError.call(void 0,
|
|
109
109
|
`${where} threw while resolving ${modulePath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
110
110
|
error
|
|
111
111
|
);
|
|
@@ -153,7 +153,7 @@ function readRouteRule(rule, where, extension, modulePath) {
|
|
|
153
153
|
try {
|
|
154
154
|
_chunk7U4XF76Rcjs.parseRoutePath.call(void 0, routeFile);
|
|
155
155
|
} catch (error) {
|
|
156
|
-
throw
|
|
156
|
+
throw _chunk3OKSEJ33cjs.createFarmRendererHookError.call(void 0,
|
|
157
157
|
`${where} returned \`pattern: ${JSON.stringify(pattern)}\`: ${error instanceof Error ? error.message : String(error)}`,
|
|
158
158
|
error
|
|
159
159
|
);
|
|
@@ -163,7 +163,7 @@ function readRouteRule(rule, where, extension, modulePath) {
|
|
|
163
163
|
pattern,
|
|
164
164
|
routeFile,
|
|
165
165
|
modulePath,
|
|
166
|
-
hydration:
|
|
166
|
+
hydration: _chunk3OKSEJ33cjs.readFarmRendererHydration.call(void 0, value, where)
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
function readPatternSegments(pattern, where) {
|
|
@@ -316,7 +316,7 @@ var PLATFORM_FILE = /^(?:(page|layout)\.(native|ios|android)\.(?:tsx|ts|jsx|js)|
|
|
|
316
316
|
async function scanRoutePatterns(options) {
|
|
317
317
|
const { root, srcDir = "src" } = options;
|
|
318
318
|
const sourceRoots = _nullishCoalesce(options.sourceRoots, () => ( [{ name: "project", root, srcDir, layer: false }]));
|
|
319
|
-
const componentExtensions =
|
|
319
|
+
const componentExtensions = _chunk3OKSEJ33cjs.resolveFarmComponentExtensions.call(void 0, options.componentExtensions).map(
|
|
320
320
|
(extension) => extension.slice(1)
|
|
321
321
|
);
|
|
322
322
|
const pages = /* @__PURE__ */ new Set();
|