@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.
Files changed (115) hide show
  1. package/dist/{analyzer-Y6IY26HI.mjs → analyzer-R6KNJ6IO.mjs} +2 -2
  2. package/dist/analyzer-XVY76XMM.cjs +17 -0
  3. package/dist/{app.d-eSm7jgoc.d.mts → app.d-Bvpc2eJq.d.mts} +1 -1
  4. package/dist/{app.d-CVPu_hoD.d.ts → app.d-DEKpJEp4.d.ts} +1 -1
  5. package/dist/{chunk-R3VLM2MW.mjs → chunk-2DMOB6BH.mjs} +5 -5
  6. package/dist/{chunk-3CZ4MJHW.cjs → chunk-3HWNYLQV.cjs} +1 -1
  7. package/dist/{chunk-NGTZHWBG.cjs → chunk-3OKSEJ33.cjs} +31 -10
  8. package/dist/{chunk-B5SJYXJK.mjs → chunk-3TCFONUE.mjs} +16 -7
  9. package/dist/{chunk-U56Z3755.mjs → chunk-4QCMTIBM.mjs} +9 -9
  10. package/dist/{chunk-DZTWUEBB.cjs → chunk-7TPLDPNC.cjs} +10 -10
  11. package/dist/{chunk-55UJGUBP.cjs → chunk-BBX4RPOV.cjs} +13 -13
  12. package/dist/{chunk-RGTZAM6Y.mjs → chunk-BCCCPFHQ.mjs} +25 -4
  13. package/dist/{chunk-IABI62FH.cjs → chunk-BZN5HX7Y.cjs} +2 -2
  14. package/dist/{chunk-FFWSER54.mjs → chunk-CDZ55QRD.mjs} +1 -1
  15. package/dist/{chunk-IAIRQAHA.mjs → chunk-CWUQBECF.mjs} +1 -1
  16. package/dist/{chunk-BBVLOEND.cjs → chunk-F7JVO3OZ.cjs} +4 -4
  17. package/dist/{chunk-NDWI6FDH.mjs → chunk-GFVPQ25Z.mjs} +132 -33
  18. package/dist/{chunk-5X5GJU5A.cjs → chunk-GLNVLCUH.cjs} +6 -6
  19. package/dist/{chunk-JHRJ5V2F.cjs → chunk-H6C45DCF.cjs} +165 -162
  20. package/dist/{chunk-LN6FAYNB.cjs → chunk-HKJIUZS5.cjs} +2 -2
  21. package/dist/{chunk-ORBBAA7B.mjs → chunk-J7VIXTPQ.mjs} +1 -1
  22. package/dist/{chunk-HRH7OKBQ.cjs → chunk-L3BSHASB.cjs} +4 -4
  23. package/dist/{chunk-ELNRKD4V.mjs → chunk-L5HDCDFT.mjs} +1 -1
  24. package/dist/chunk-MAPHNGTF.cjs +98 -0
  25. package/dist/{chunk-RE5E2G5S.cjs → chunk-MNUYXZV7.cjs} +2 -18
  26. package/dist/{chunk-YSU3WCW6.mjs → chunk-MYSH5Y4E.mjs} +1 -1
  27. package/dist/{chunk-EFI6QWBQ.cjs → chunk-OYM6VJEF.cjs} +35 -26
  28. package/dist/{chunk-43N3X6OO.mjs → chunk-PQR5A7R2.mjs} +1 -1
  29. package/dist/{chunk-3DAJXBSL.cjs → chunk-Q7GB3I4O.cjs} +2 -2
  30. package/dist/{chunk-A5BHJHDF.cjs → chunk-QUHDVJMR.cjs} +3 -3
  31. package/dist/chunk-RJBUI5AN.mjs +18 -0
  32. package/dist/chunk-RQ6XX5IN.mjs +98 -0
  33. package/dist/{chunk-OM6JIIJU.cjs → chunk-RVJQHQCG.cjs} +4 -4
  34. package/dist/{chunk-WCSBYQOT.cjs → chunk-TOUC6BR3.cjs} +4 -4
  35. package/dist/{chunk-WZV2G2A6.mjs → chunk-U6HUVY5R.mjs} +90 -29
  36. package/dist/{chunk-SLIXHUMS.cjs → chunk-UEQC4ZLP.cjs} +446 -347
  37. package/dist/{chunk-7X2CYE66.cjs → chunk-WYTK7HQS.cjs} +261 -200
  38. package/dist/{chunk-DPUZVGXH.mjs → chunk-X7RSOEMQ.mjs} +33 -30
  39. package/dist/{chunk-NKVBWPXR.mjs → chunk-XIXAUXV3.mjs} +1 -1
  40. package/dist/{chunk-RNJX3MD6.mjs → chunk-YS647ASS.mjs} +1 -1
  41. package/dist/{chunk-VQ6IXALL.mjs → chunk-YX532KEF.mjs} +2 -2
  42. package/dist/{chunk-K3GHY7GY.mjs → chunk-Z3LOPHSO.mjs} +1 -1
  43. package/dist/{client-component.d-DLknFP8l.d.ts → client-component.d-CZG02pIh.d.ts} +2 -1
  44. package/dist/{client-component.d-DLMCzmUx.d.mts → client-component.d-miqIXyQv.d.mts} +2 -1
  45. package/dist/{devtools-OI52TCSD.mjs → devtools-34ZQWX3M.mjs} +4 -4
  46. package/dist/{devtools-ZM2AR36W.cjs → devtools-SXL5RFE5.cjs} +6 -6
  47. package/dist/docs.cjs +6 -6
  48. package/dist/docs.mjs +5 -5
  49. package/dist/environment/vite.cjs +5 -5
  50. package/dist/environment/vite.mjs +4 -4
  51. package/dist/index.cjs +26 -25
  52. package/dist/index.d.mts +2 -2
  53. package/dist/index.d.ts +2 -2
  54. package/dist/index.mjs +26 -25
  55. package/dist/internal/build-runtime.cjs +26 -25
  56. package/dist/internal/build-runtime.mjs +25 -24
  57. package/dist/internal/cli-runtime.cjs +8 -8
  58. package/dist/internal/cli-runtime.mjs +7 -7
  59. package/dist/internal/client-error-overlay.cjs +4 -4
  60. package/dist/internal/client-error-overlay.mjs +1 -1
  61. package/dist/internal/client-runtime.d.mts +3 -37
  62. package/dist/internal/client-runtime.d.ts +3 -37
  63. package/dist/internal/config-runtime.cjs +6 -6
  64. package/dist/internal/config-runtime.mjs +5 -5
  65. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  66. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  67. package/dist/internal/islands-runtime.cjs +15 -8
  68. package/dist/internal/islands-runtime.d.mts +2 -3
  69. package/dist/internal/islands-runtime.d.ts +2 -3
  70. package/dist/internal/islands-runtime.mjs +15 -8
  71. package/dist/internal/islands-server-tree.cjs +8 -0
  72. package/dist/internal/islands-server-tree.d.mts +5 -0
  73. package/dist/internal/islands-server-tree.d.ts +5 -0
  74. package/dist/internal/islands-server-tree.mjs +8 -0
  75. package/dist/internal/islx-actions-server.d.mts +0 -3
  76. package/dist/internal/islx-actions-server.d.ts +0 -3
  77. package/dist/internal/native-server-fns.cjs +4 -4
  78. package/dist/internal/native-server-fns.mjs +3 -3
  79. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  80. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  81. package/dist/internal/production-runtime.cjs +15 -15
  82. package/dist/internal/production-runtime.mjs +21 -21
  83. package/dist/internal/renderer-islands.cjs +47 -0
  84. package/dist/internal/renderer-islands.d.mts +32 -0
  85. package/dist/internal/renderer-islands.d.ts +32 -0
  86. package/dist/internal/renderer-islands.mjs +47 -0
  87. package/dist/island-runtime.d-BA7EPo1v.d.ts +38 -0
  88. package/dist/island-runtime.d-BBS_YUSX.d.mts +38 -0
  89. package/dist/plugin.cjs +20 -19
  90. package/dist/plugin.d.mts +1 -1
  91. package/dist/plugin.d.ts +1 -1
  92. package/dist/plugin.mjs +19 -18
  93. package/dist/renderer.cjs +8 -2
  94. package/dist/renderer.d.mts +81 -1
  95. package/dist/renderer.d.ts +81 -1
  96. package/dist/renderer.mjs +7 -1
  97. package/dist/{rsc-pipeline-MFJZGDPE.cjs → rsc-pipeline-ESPGX4VX.cjs} +9 -9
  98. package/dist/{rsc-pipeline-TRZVFCBX.mjs → rsc-pipeline-MW2V3WEE.mjs} +8 -8
  99. package/dist/{runtime-MJUG2HGR.cjs → runtime-FCMLEBTX.cjs} +13 -14
  100. package/dist/{runtime-O4Y3Z6V3.mjs → runtime-KGSOEMLT.mjs} +10 -11
  101. package/dist/server.cjs +50 -50
  102. package/dist/server.d.mts +2 -2
  103. package/dist/server.d.ts +2 -2
  104. package/dist/server.mjs +28 -28
  105. package/dist/version.cjs +2 -2
  106. package/dist/version.mjs +1 -1
  107. package/dist/vite.cjs +20 -19
  108. package/dist/vite.d.mts +8 -2
  109. package/dist/vite.d.ts +8 -2
  110. package/dist/vite.mjs +19 -18
  111. package/package.json +13 -3
  112. package/dist/analyzer-WGH6J2HN.cjs +0 -17
  113. package/dist/chunk-4QENVMG7.mjs +0 -34
  114. package/dist/{chunk-NEKO3HM2.cjs → chunk-4B6YJ5DS.cjs} +2 -2
  115. package/dist/{chunk-CA2HBLXP.mjs → chunk-4EEAPBNV.mjs} +3 -3
@@ -4,7 +4,7 @@
4
4
  var _chunkW53Z4WDIcjs = require('./chunk-W53Z4WDI.cjs');
5
5
 
6
6
 
7
- var _chunkIABI62FHcjs = require('./chunk-IABI62FH.cjs');
7
+ var _chunkBZN5HX7Ycjs = require('./chunk-BZN5HX7Y.cjs');
8
8
 
9
9
 
10
10
  var _chunkBTVDYS4Bcjs = require('./chunk-BTVDYS4B.cjs');
@@ -29,7 +29,7 @@ var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
29
29
  var _chunk7Q7UB4TLcjs = require('./chunk-7Q7UB4TL.cjs');
30
30
 
31
31
 
32
- var _chunk3CZ4MJHWcjs = require('./chunk-3CZ4MJHW.cjs');
32
+ var _chunk3HWNYLQVcjs = require('./chunk-3HWNYLQV.cjs');
33
33
 
34
34
 
35
35
  var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
@@ -288,7 +288,7 @@ function createFarmAppManifest(input, registered = []) {
288
288
  return {
289
289
  schemaVersion: 1,
290
290
  app: app ? {
291
- ...app.version ? { farm: _chunk3CZ4MJHWcjs.FARM_VERSION } : {},
291
+ ...app.version ? { farm: _chunk3HWNYLQVcjs.FARM_VERSION } : {},
292
292
  ...app.renderer ? { renderer: input.renderer } : {},
293
293
  basePath: input.basePath,
294
294
  ...app.build ? { build: input.build } : {}
@@ -319,7 +319,7 @@ function resolveFarmSiteUrl() {
319
319
  asUrl(read("RAILWAY_PUBLIC_DOMAIN"))
320
320
  ];
321
321
  for (const candidate of candidates) {
322
- const origin = candidate ? _chunkIABI62FHcjs.normalizeFarmProductionSiteOrigin.call(void 0, candidate) : void 0;
322
+ const origin = candidate ? _chunkBZN5HX7Ycjs.normalizeFarmProductionSiteOrigin.call(void 0, candidate) : void 0;
323
323
  if (origin) return origin;
324
324
  }
325
325
  return null;
@@ -43,7 +43,7 @@ import {
43
43
  resolveFarmIslxActionsMode,
44
44
  resolveFarmRouteRootStrategy,
45
45
  toBakedMarkdownSourcePath
46
- } from "./chunk-DPUZVGXH.mjs";
46
+ } from "./chunk-X7RSOEMQ.mjs";
47
47
  import {
48
48
  generateFarmClientPluginEntryCode,
49
49
  hasFarmServerRuntimePlugins,
@@ -52,13 +52,19 @@ import {
52
52
  import {
53
53
  FARM_NODE_RESPONSE_END_PENDING
54
54
  } from "./chunk-IVP5Q4BX.mjs";
55
+ import {
56
+ resolveFarmPlatform
57
+ } from "./chunk-SMUW7UST.mjs";
55
58
  import {
56
59
  generateFarmTypeArtifacts,
57
60
  resolveRouteRenderingConfig
58
- } from "./chunk-IAIRQAHA.mjs";
61
+ } from "./chunk-CWUQBECF.mjs";
59
62
  import {
60
- resolveFarmPlatform
61
- } from "./chunk-SMUW7UST.mjs";
63
+ usesFarmRendererIslands
64
+ } from "./chunk-RQ6XX5IN.mjs";
65
+ import {
66
+ _setFarmInfraAnalyticsWebMCPRoute
67
+ } from "./chunk-YS647ASS.mjs";
62
68
  import {
63
69
  createFarmRouteRenderPlan,
64
70
  farmPathGuardCoversEndpoint,
@@ -67,13 +73,10 @@ import {
67
73
  getSharedLayoutPrefixLength,
68
74
  parseFarmLayoutChainHeader,
69
75
  renderFarmLocaleAlternateLinks
70
- } from "./chunk-CA2HBLXP.mjs";
76
+ } from "./chunk-4EEAPBNV.mjs";
71
77
  import {
72
78
  FARM_NATIVE_TREE_CONTENT_TYPE
73
79
  } from "./chunk-LLZSYFOM.mjs";
74
- import {
75
- _setFarmInfraAnalyticsWebMCPRoute
76
- } from "./chunk-RNJX3MD6.mjs";
77
80
  import {
78
81
  FARM_API_CATALOG_PATH,
79
82
  createFarmAiCatalogResponse,
@@ -88,13 +91,13 @@ import {
88
91
  resolveFarmMCPRouteLabel,
89
92
  resolveFarmMarkdownRouteLabel,
90
93
  setFarmRouteLabel
91
- } from "./chunk-VQ6IXALL.mjs";
94
+ } from "./chunk-YX532KEF.mjs";
92
95
  import {
93
96
  FARM_DEFAULT_MCP_PATH
94
97
  } from "./chunk-HR4N2K4V.mjs";
95
98
  import {
96
99
  isFarmPreviewDeploymentEnvironment
97
- } from "./chunk-43N3X6OO.mjs";
100
+ } from "./chunk-PQR5A7R2.mjs";
98
101
  import {
99
102
  createFarmServerFnBoundaryModule,
100
103
  isFarmServerFnBoundaryId,
@@ -145,7 +148,7 @@ import {
145
148
  usePackageScanCacheFile,
146
149
  withFarmSourceSnapshotOf,
147
150
  wrapFarmIslandContainers
148
- } from "./chunk-B5SJYXJK.mjs";
151
+ } from "./chunk-3TCFONUE.mjs";
149
152
  import {
150
153
  generateFarmDocsAdapterClientRuntime,
151
154
  getFarmDocsAdapterConfigModule
@@ -175,9 +178,6 @@ import {
175
178
  import {
176
179
  resolveFarmLlmsTxtConfig
177
180
  } from "./chunk-XGL42MQ7.mjs";
178
- import {
179
- resolveFarmServerComponentsMode
180
- } from "./chunk-4QENVMG7.mjs";
181
181
  import {
182
182
  getFarmAppDirectories,
183
183
  getFarmLayerAliases,
@@ -191,8 +191,9 @@ import {
191
191
  loadFarmRendererVitePlugins,
192
192
  resolveFarmComponentExtensions,
193
193
  resolveFarmRenderer,
194
- resolveFarmRendererAppSetup
195
- } from "./chunk-RGTZAM6Y.mjs";
194
+ resolveFarmRendererAppSetup,
195
+ resolveFarmServerComponentsMode
196
+ } from "./chunk-BCCCPFHQ.mjs";
196
197
  import {
197
198
  getPublicFarmImageConfig,
198
199
  resolveFarmImageConfig
@@ -312,7 +313,7 @@ import {
312
313
  } from "./chunk-EILUVBKS.mjs";
313
314
  import {
314
315
  FARM_VERSION
315
- } from "./chunk-NKVBWPXR.mjs";
316
+ } from "./chunk-XIXAUXV3.mjs";
316
317
  import {
317
318
  DEFAULT_FARM_API_BASE_PATH
318
319
  } from "./chunk-W6QLRQ3V.mjs";
@@ -1287,7 +1288,7 @@ function loadFarmWorkflowsDevRuntime() {
1287
1288
  return import("./workflows.mjs");
1288
1289
  }
1289
1290
  function loadFarmDevtoolsSnapshotRuntime() {
1290
- return import("./devtools-OI52TCSD.mjs");
1291
+ return import("./devtools-34ZQWX3M.mjs");
1291
1292
  }
1292
1293
  function loadFarmDevtoolsUIRuntime() {
1293
1294
  return import("./devtools-ui-BOG33MT5.mjs");
@@ -1415,12 +1416,17 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1415
1416
  const prebundle = options.prebundleServerPackages ? createFarmServerPrebundleConfig(bundledPackages) : {};
1416
1417
  persistPackageScanCache();
1417
1418
  return {
1418
- optimizeDeps: { rolldownOptions: { plugins: [farmBrowserBuiltinsOptimizerPlugin()] } },
1419
+ optimizeDeps: {
1420
+ // A package that defines fonts is served unbundled, so Farm's font compiler sees it.
1421
+ exclude: bundledPackages.filter(({ fonts }) => fonts).map(({ name }) => name),
1422
+ rolldownOptions: { plugins: [farmBrowserBuiltinsOptimizerPlugin()] }
1423
+ },
1419
1424
  ssr: {
1420
1425
  noExternal: [
1421
1426
  // Resolve `server-only` here rather than in Node, which would load its throwing build.
1422
1427
  SERVER_ONLY_PACKAGE,
1423
- // Packages Node cannot load as a bundler does (stylesheet imports, `module`-only ESM).
1428
+ // Packages Node cannot load as a bundler does (stylesheet imports, `module`-only ESM,
1429
+ // fonts that only Farm's font compiler can build).
1424
1430
  ...bundledPackages.map(({ name }) => name)
1425
1431
  ],
1426
1432
  ...prebundle
@@ -2119,7 +2125,7 @@ function transformIsolatedClientBoundaryModule(options) {
2119
2125
  const wrapperName = `__farm_isolated_boundary_${safeName || "default"}__`;
2120
2126
  wrapperStatements.push(
2121
2127
  // Islands mode renders through islx; the older isolated hydration keeps Farm's boundary.
2122
- options.slots && options.inferredInteraction ? `const ${wrapperName} = __farm_islx_island__(${localName}, ${JSON.stringify(options.moduleReference)}, ${JSON.stringify(exportName)}, "interaction", { inferred: true });` : options.slots ? `const ${wrapperName} = __farm_islx_island__(${localName}, ${JSON.stringify(options.moduleReference)}, ${JSON.stringify(exportName)}, ${JSON.stringify(options.islandStrategy)});` : `const ${wrapperName} = __farm_create_isolated_boundary__(__farm_isolated_react__, ${localName}, ${JSON.stringify(options.moduleReference)}, ${JSON.stringify(exportName)}, ${JSON.stringify(options.islandStrategy)});`
2128
+ options.withIsland ? `const ${wrapperName} = __farm_with_island__(${localName}, { src: ${JSON.stringify(options.moduleReference)}, export: ${JSON.stringify(exportName)}, strategy: ${JSON.stringify(options.islandStrategy)} });` : options.slots && options.inferredInteraction ? `const ${wrapperName} = __farm_islx_island__(${localName}, ${JSON.stringify(options.moduleReference)}, ${JSON.stringify(exportName)}, "interaction", { inferred: true });` : options.slots ? `const ${wrapperName} = __farm_islx_island__(${localName}, ${JSON.stringify(options.moduleReference)}, ${JSON.stringify(exportName)}, ${JSON.stringify(options.islandStrategy)});` : `const ${wrapperName} = __farm_create_isolated_boundary__(__farm_isolated_react__, ${localName}, ${JSON.stringify(options.moduleReference)}, ${JSON.stringify(exportName)}, ${JSON.stringify(options.islandStrategy)});`
2123
2129
  );
2124
2130
  wrapperStatements.push(
2125
2131
  isDefault ? `export default ${wrapperName};` : `export { ${wrapperName} as ${exportName} };`
@@ -2207,7 +2213,11 @@ function transformIsolatedClientBoundaryModule(options) {
2207
2213
  output = output.slice(0, replacement.start) + replacement.code + output.slice(replacement.end);
2208
2214
  }
2209
2215
  const isComponent = `(value) => typeof value === "function" || (typeof value === "object" && value !== null && [Symbol.for("react.memo"), Symbol.for("react.forward_ref"), Symbol.for("react.lazy")].includes(value.$$typeof))`;
2210
- const runtimeImport = options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from ${islxReact};
2216
+ const runtimeImport = options.withIsland ? (
2217
+ // The renderer's withIsland returns a value that isn't one of its components unchanged.
2218
+ `import { withIsland as __farm_renderer_with_island__ } from ${JSON.stringify(options.withIsland)};
2219
+ const __farm_with_island__ = (component, reference) => component !== null && (typeof component === "function" || typeof component === "object") ? __farm_renderer_with_island__(component, reference) : component;`
2220
+ ) : options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from ${islxReact};
2211
2221
  const __farm_is_component__ = ${isComponent};
2212
2222
  const __farm_islx_island__ = (component, ...rest) => __farm_is_component__(component) ? __farm_islx_create_island__(component, ...rest) : component;` : `import * as __farm_isolated_react__ from "react";
2213
2223
  import { createFarmIsolatedClientBoundary as __farm_create_boundary__ } from ${isolatedBoundary};
@@ -5133,6 +5143,7 @@ export { manifest };
5133
5143
  transformed = true;
5134
5144
  const currentConfig = farmApp?.getConfig() ?? options;
5135
5145
  let isolatedModuleReference = null;
5146
+ let rendererIslandModule = false;
5136
5147
  const root = currentConfig.root || server?.config.root || process.cwd();
5137
5148
  const cleanId = id.split("?", 1)[0];
5138
5149
  const selectedIsolatedModules = options.isolatedClientBoundaryModules ?? farmApp?.getRouteManager().getIsolatedClientBoundaryModules(root);
@@ -5165,6 +5176,24 @@ export { manifest };
5165
5176
  );
5166
5177
  }
5167
5178
  transformedCode = transformedBoundary;
5179
+ } else if (selectedForIsolatedHydration && usesFarmRendererIslands(currentConfig) && (isIsolatableClientBoundarySource(clientBoundarySource) || cleanId.replace(/\\/g, "/").includes(FARM_CLIENT_REFERENCE_DIRECTORY))) {
5180
+ rendererIslandModule = true;
5181
+ if (transformOptions?.ssr === true) {
5182
+ const renderer = resolveFarmRenderer(currentConfig.renderer);
5183
+ const transformedBoundary = transformIsolatedClientBoundaryModule({
5184
+ code: transformedCode,
5185
+ moduleReference: toViteModuleId(cleanId, root),
5186
+ islandStrategy: getIslandStrategyExport(clientBoundarySource) ?? "load",
5187
+ parse: (source) => this.parse(source),
5188
+ withIsland: renderer.server
5189
+ });
5190
+ if (!transformedBoundary) {
5191
+ this.error(
5192
+ `[Farm.js] Could not compile the island module ${cleanId} for renderer \`${renderer.name}\`. Set experimental.isolatedClientHydration = "off" to hydrate its routes whole.`
5193
+ );
5194
+ }
5195
+ transformedCode = transformedBoundary;
5196
+ }
5168
5197
  }
5169
5198
  if (!farmApp) {
5170
5199
  return {
@@ -5187,7 +5216,7 @@ export { manifest };
5187
5216
  );
5188
5217
  return;
5189
5218
  }` : "";
5190
- const hmrCode = transformOptions?.ssr || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
5219
+ const hmrCode = transformOptions?.ssr || reactRefreshActive || rendererIslandModule || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
5191
5220
  if (import.meta.hot) {
5192
5221
  import.meta.hot.accept((newModule) => {
5193
5222
  ${isolatedHmrUpdate}
@@ -6043,14 +6072,46 @@ __farmConfigureApp(__farmAppSetup)` : `import * as __farmRendererClient from ${J
6043
6072
  import { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}
6044
6073
  const React = { ...__farmRendererClient }`
6045
6074
  );
6046
- const isolatedHydrationImport = isolatedHydrationEnabled ? `${islandValues ? "import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement, createFarmServerTreeLayout } from '@farm.js/core/internal/islands-runtime'" : "import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'\nimport { createFarmServerTreeElement } from '@farm.js/core/internal/server-tree'"}` : "";
6075
+ const rendererIslands = isolatedHydrationEnabled && !islandValues && !isReactRenderer(renderer) && getFarmRendererCapabilities(renderer).islands;
6076
+ const isolatedHydrationImport = rendererIslands ? "import { createFarmRendererIslandRuntime } from '@farm.js/core/internal/renderer-islands'" : isolatedHydrationEnabled ? `${islandValues ? "import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement, createFarmServerTreeLayout } from '@farm.js/core/internal/islands-runtime'" : "import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'\nimport { createFarmServerTreeElement } from '@farm.js/core/internal/server-tree'"}` : "";
6047
6077
  const docsAdapterImportBlock = generateFarmDocsAdapterClientRuntime(
6048
6078
  docsAdapterUI,
6049
6079
  docsConfigModule,
6050
6080
  // Config resolution keeps an adapter to its UI's renderer, so this is the UI's renderer too.
6051
6081
  isReactRenderer(renderer) ? void 0 : renderer.client
6052
6082
  );
6053
- const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
6083
+ const isolatedHydrationRuntime = rendererIslands ? `const farmIsolatedHydrationRuntime = createFarmRendererIslandRuntime({
6084
+ renderer: React,
6085
+ load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
6086
+ schedule: scheduleFarmIslandHydration,
6087
+ });
6088
+ window.__FARM_ISOLATED_HYDRATION_RUNTIME__ = farmIsolatedHydrationRuntime;
6089
+ // A hydrating layout keeps a page that doesn't hydrate as server HTML in a plain element. The
6090
+ // renderer's root never renders the page's islands, so the runtime starts them after each render.
6091
+ const FarmServerPage = 'div';
6092
+ // Island modules reach the browser as written, so a client tree has nothing to mark.
6093
+ function wrapFarmIsolatedClientGraph(_React, element) { return element; }
6094
+
6095
+ function disposeFarmIsolatedClientBoundaries(scope) {
6096
+ farmIsolatedHydrationRuntime.dispose(scope);
6097
+ }
6098
+
6099
+ async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
6100
+ await farmIsolatedHydrationRuntime.hydrate(scope, signal);
6101
+ }
6102
+
6103
+ // After a hydrating layout renders another page: release the islands whose markup it replaced,
6104
+ // and start the new page's.
6105
+ async function hydrateFarmLayoutPageIslands(container) {
6106
+ farmIsolatedHydrationRuntime.prune();
6107
+ await hydrateFarmIsolatedClientBoundaries(container);
6108
+ }
6109
+
6110
+ async function createFarmServerTreePageElement() { return null; }
6111
+ async function buildFarmTreeLayouts() { return true; }
6112
+ function getFarmTreeLayoutComponent() { return null; }
6113
+ let farmLastRouteState = null;
6114
+ function rerenderFarmTreeLayouts() {}` : isolatedHydrationEnabled ? `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
6054
6115
  ReactRuntime: React,
6055
6116
  hydrateRoot,
6056
6117
  load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
@@ -7679,6 +7740,7 @@ async function renderPage(pageData, info) {
7679
7740
  loadingModulePath: route.loadingModulePath,
7680
7741
  },
7681
7742
  );
7743
+ ${rendererIslands ? "await hydrateFarmLayoutPageIslands(container);" : ""}
7682
7744
  } else {
7683
7745
  ${isolatedHydrationEnabled ? "let isolatedHydrationScope = container;" : ""}
7684
7746
  ${islandValues ? "const keepValues = keepFarmIslandValues(container);" : ""}
@@ -7701,7 +7763,7 @@ async function renderPage(pageData, info) {
7701
7763
 
7702
7764
  const hydrationController = new AbortController();
7703
7765
  if (
7704
- shouldHydrate${isolatedHydrationEnabled ? " || (hasIsolatedClientBoundaries && !layoutShouldHydrate)" : ""}
7766
+ shouldHydrate${rendererIslands ? " || hasIsolatedClientBoundaries" : isolatedHydrationEnabled ? " || (hasIsolatedClientBoundaries && !layoutShouldHydrate)" : ""}
7705
7767
  ) {
7706
7768
  pendingPageHydrationController = hydrationController;
7707
7769
  }
@@ -7739,7 +7801,7 @@ async function renderPage(pageData, info) {
7739
7801
  });
7740
7802
  }
7741
7803
  }
7742
- ${isolatedHydrationEnabled ? `if (hasIsolatedClientBoundaries && !layoutShouldHydrate) {
7804
+ ${isolatedHydrationEnabled ? `if (hasIsolatedClientBoundaries${rendererIslands ? "" : " && !layoutShouldHydrate"}) {
7743
7805
  await hydrateFarmIsolatedClientBoundaries(
7744
7806
  isolatedHydrationScope,
7745
7807
  hydrationController.signal,
@@ -7958,8 +8020,7 @@ function farmIslandsOnlyDocument() {
7958
8020
  },
7959
8021
  });
7960
8022
  ${isolatedHydrationEnabled ? `const isolatedHydration =
7961
- hasIsolatedClientBoundaries &&
7962
- !layoutShouldHydrate
8023
+ hasIsolatedClientBoundaries${rendererIslands ? "" : " &&\n !layoutShouldHydrate"}
7963
8024
  ? hydrateFarmIsolatedClientBoundaries(rootContainer, hydrationController.signal)
7964
8025
  : Promise.resolve();
7965
8026
  await Promise.all([pageHydration, isolatedHydration]);` : "await pageHydration;"}