@farm.js/core 0.1.84 → 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 (88) hide show
  1. package/dist/{analyzer-7RNO3XKC.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-INU4K4U4.mjs → chunk-2DMOB6BH.mjs} +1 -1
  6. package/dist/{chunk-CVZY4TLW.cjs → chunk-3HWNYLQV.cjs} +1 -1
  7. package/dist/{chunk-XLULEFRW.mjs → chunk-3TCFONUE.mjs} +11 -2
  8. package/dist/{chunk-HOQ2MYBJ.cjs → chunk-7TPLDPNC.cjs} +2 -2
  9. package/dist/{chunk-57EEWWUS.cjs → chunk-BZN5HX7Y.cjs} +2 -2
  10. package/dist/{chunk-BZY3SRRD.mjs → chunk-CDZ55QRD.mjs} +1 -1
  11. package/dist/{chunk-KXVMWLTC.mjs → chunk-GFVPQ25Z.mjs} +82 -12
  12. package/dist/{chunk-OFVBMS6I.cjs → chunk-H6C45DCF.cjs} +48 -48
  13. package/dist/{chunk-USMRAC72.cjs → chunk-HKJIUZS5.cjs} +2 -2
  14. package/dist/{chunk-MUUDHWQZ.mjs → chunk-J7VIXTPQ.mjs} +1 -1
  15. package/dist/{chunk-EBSL5TW7.cjs → chunk-OYM6VJEF.cjs} +27 -18
  16. package/dist/{chunk-IRJSZAJB.mjs → chunk-PQR5A7R2.mjs} +1 -1
  17. package/dist/{chunk-OP7BIEUW.cjs → chunk-Q7GB3I4O.cjs} +2 -2
  18. package/dist/{chunk-YU6VL7H5.cjs → chunk-QUHDVJMR.cjs} +3 -3
  19. package/dist/{chunk-Z37PDUJR.cjs → chunk-RVJQHQCG.cjs} +4 -4
  20. package/dist/{chunk-22BTYPIX.cjs → chunk-TOUC6BR3.cjs} +4 -4
  21. package/dist/{chunk-DFDQGHPU.mjs → chunk-U6HUVY5R.mjs} +14 -9
  22. package/dist/{chunk-DSWSDDP2.cjs → chunk-UEQC4ZLP.cjs} +339 -269
  23. package/dist/{chunk-5I4ZGKP2.cjs → chunk-WYTK7HQS.cjs} +129 -124
  24. package/dist/{chunk-BRDGINBB.mjs → chunk-X7RSOEMQ.mjs} +6 -6
  25. package/dist/{chunk-I5CVJ24H.mjs → chunk-XIXAUXV3.mjs} +1 -1
  26. package/dist/{chunk-M5XU22PQ.mjs → chunk-YS647ASS.mjs} +1 -1
  27. package/dist/{chunk-3WM7VBGW.mjs → chunk-YX532KEF.mjs} +2 -2
  28. package/dist/{chunk-NLHSKKTT.mjs → chunk-Z3LOPHSO.mjs} +1 -1
  29. package/dist/{client-component.d-DLknFP8l.d.ts → client-component.d-CZG02pIh.d.ts} +2 -1
  30. package/dist/{client-component.d-DLMCzmUx.d.mts → client-component.d-miqIXyQv.d.mts} +2 -1
  31. package/dist/{devtools-MWQA5LVN.mjs → devtools-34ZQWX3M.mjs} +1 -1
  32. package/dist/{devtools-4SVIRV4P.cjs → devtools-SXL5RFE5.cjs} +2 -2
  33. package/dist/docs.cjs +3 -3
  34. package/dist/docs.mjs +2 -2
  35. package/dist/environment/vite.cjs +3 -3
  36. package/dist/environment/vite.mjs +2 -2
  37. package/dist/index.cjs +15 -15
  38. package/dist/index.d.mts +2 -2
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.mjs +14 -14
  41. package/dist/internal/build-runtime.cjs +14 -14
  42. package/dist/internal/build-runtime.mjs +13 -13
  43. package/dist/internal/cli-runtime.cjs +3 -3
  44. package/dist/internal/cli-runtime.mjs +2 -2
  45. package/dist/internal/client-error-overlay.cjs +4 -4
  46. package/dist/internal/client-error-overlay.mjs +1 -1
  47. package/dist/internal/config-runtime.cjs +3 -3
  48. package/dist/internal/config-runtime.mjs +2 -2
  49. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  50. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  51. package/dist/internal/islands-runtime.cjs +15 -8
  52. package/dist/internal/islands-runtime.d.mts +2 -3
  53. package/dist/internal/islands-runtime.d.ts +2 -3
  54. package/dist/internal/islands-runtime.mjs +15 -8
  55. package/dist/internal/islands-server-tree.cjs +8 -0
  56. package/dist/internal/islands-server-tree.d.mts +5 -0
  57. package/dist/internal/islands-server-tree.d.ts +5 -0
  58. package/dist/internal/islands-server-tree.mjs +8 -0
  59. package/dist/internal/islx-actions-server.d.mts +0 -3
  60. package/dist/internal/islx-actions-server.d.ts +0 -3
  61. package/dist/internal/native-server-fns.cjs +4 -4
  62. package/dist/internal/native-server-fns.mjs +3 -3
  63. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  64. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  65. package/dist/internal/production-runtime.cjs +7 -7
  66. package/dist/internal/production-runtime.mjs +8 -8
  67. package/dist/plugin.cjs +9 -9
  68. package/dist/plugin.d.mts +1 -1
  69. package/dist/plugin.d.ts +1 -1
  70. package/dist/plugin.mjs +8 -8
  71. package/dist/{rsc-pipeline-OWBEZ7HB.cjs → rsc-pipeline-ESPGX4VX.cjs} +3 -3
  72. package/dist/{rsc-pipeline-UT3Z2GDO.mjs → rsc-pipeline-MW2V3WEE.mjs} +2 -2
  73. package/dist/{runtime-SRMQ46SK.cjs → runtime-FCMLEBTX.cjs} +4 -4
  74. package/dist/{runtime-F5I3WY3B.mjs → runtime-KGSOEMLT.mjs} +2 -2
  75. package/dist/server.cjs +30 -30
  76. package/dist/server.d.mts +2 -2
  77. package/dist/server.d.ts +2 -2
  78. package/dist/server.mjs +10 -10
  79. package/dist/version.cjs +2 -2
  80. package/dist/version.mjs +1 -1
  81. package/dist/vite.cjs +9 -9
  82. package/dist/vite.d.mts +2 -2
  83. package/dist/vite.d.ts +2 -2
  84. package/dist/vite.mjs +8 -8
  85. package/package.json +6 -1
  86. package/dist/analyzer-PFKA5NI6.cjs +0 -17
  87. /package/dist/{chunk-EDBIBO67.mjs → chunk-4QCMTIBM.mjs} +0 -0
  88. /package/dist/{chunk-BOEDYXAX.cjs → chunk-BBX4RPOV.cjs} +0 -0
@@ -3,11 +3,11 @@ import {
3
3
  analyzeFarmMobileRoutes,
4
4
  readAliases,
5
5
  resolveFile
6
- } from "./chunk-BZY3SRRD.mjs";
6
+ } from "./chunk-CDZ55QRD.mjs";
7
7
  import "./chunk-IOEXXZK3.mjs";
8
8
  import "./chunk-423SSBYQ.mjs";
9
9
  import "./chunk-D2VAANBS.mjs";
10
- import "./chunk-I5CVJ24H.mjs";
10
+ import "./chunk-XIXAUXV3.mjs";
11
11
  import "./chunk-TIZJYHB7.mjs";
12
12
  export {
13
13
  CORE_PORTABLE,
@@ -0,0 +1,17 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkQ7GB3I4Ocjs = require('./chunk-Q7GB3I4O.cjs');
7
+ require('./chunk-WBTHHTBO.cjs');
8
+ require('./chunk-CCAUIBIS.cjs');
9
+ require('./chunk-WMRGIQTA.cjs');
10
+ require('./chunk-3HWNYLQV.cjs');
11
+ require('./chunk-UZM3PDKK.cjs');
12
+
13
+
14
+
15
+
16
+
17
+ exports.CORE_PORTABLE = _chunkQ7GB3I4Ocjs.CORE_PORTABLE; exports.analyzeFarmMobileRoutes = _chunkQ7GB3I4Ocjs.analyzeFarmMobileRoutes; exports.readAliases = _chunkQ7GB3I4Ocjs.readAliases; exports.resolveFile = _chunkQ7GB3I4Ocjs.resolveFile;
@@ -4,7 +4,7 @@ import { FarmCronResolvedConfig } from './cron.mjs';
4
4
  import { R as ResolvedFarmImageConfig } from './image-config.d-ByhQ0TT7.mjs';
5
5
  import { F as FarmSearchPreserveRoute, M as MetadataImageKind, c as createFarmDefaultMCPServer } from './agent-mcp.d-LChlR2au.mjs';
6
6
  import { ProgrammaticRedirectRoute, ProgrammaticRouteSearchClientOptions } from './routes.mjs';
7
- import { I as IsolatedClientBoundaryReference, F as FarmSourceSnapshotStore, C as ClientModuleHydrationPlan, P as ProgrammaticClientRoutes } from './client-component.d-DLMCzmUx.mjs';
7
+ import { I as IsolatedClientBoundaryReference, F as FarmSourceSnapshotStore, C as ClientModuleHydrationPlan, P as ProgrammaticClientRoutes } from './client-component.d-miqIXyQv.mjs';
8
8
  import { ViteDevServer } from 'vite';
9
9
  import { F as FarmIslandStrategy } from './island.d-CfGru1MO.mjs';
10
10
  import { FarmRenderer, FarmServerRendererRuntime } from './renderer.mjs';
@@ -4,7 +4,7 @@ import { FarmCronResolvedConfig } from './cron.js';
4
4
  import { R as ResolvedFarmImageConfig } from './image-config.d-ByhQ0TT7.js';
5
5
  import { F as FarmSearchPreserveRoute, M as MetadataImageKind, c as createFarmDefaultMCPServer } from './agent-mcp.d-7uKdOttc.js';
6
6
  import { ProgrammaticRedirectRoute, ProgrammaticRouteSearchClientOptions } from './routes.js';
7
- import { I as IsolatedClientBoundaryReference, F as FarmSourceSnapshotStore, C as ClientModuleHydrationPlan, P as ProgrammaticClientRoutes } from './client-component.d-DLknFP8l.js';
7
+ import { I as IsolatedClientBoundaryReference, F as FarmSourceSnapshotStore, C as ClientModuleHydrationPlan, P as ProgrammaticClientRoutes } from './client-component.d-CZG02pIh.js';
8
8
  import { ViteDevServer } from 'vite';
9
9
  import { F as FarmIslandStrategy } from './island.d-CfGru1MO.js';
10
10
  import { FarmRenderer, FarmServerRendererRuntime } from './renderer.js';
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-RLEAVG6G.mjs";
4
4
  import {
5
5
  resolveDeployOutputPath
6
- } from "./chunk-EDBIBO67.mjs";
6
+ } from "./chunk-4QCMTIBM.mjs";
7
7
  import {
8
8
  farmDesktopDevGuardPlugin,
9
9
  loadFarmReactPlugin
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
- var version = "0.1.84";
2
+ var version = "0.1.85";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-U6GMCDRS.mjs";
29
29
  import {
30
30
  FARM_VERSION
31
- } from "./chunk-I5CVJ24H.mjs";
31
+ } from "./chunk-XIXAUXV3.mjs";
32
32
 
33
33
  // src/environment-vite.ts
34
34
  import { existsSync, readFileSync, realpathSync } from "fs";
@@ -863,6 +863,7 @@ function farmReactServerBuildReachesClientModules(importer, specifier, serverImp
863
863
  var IMPORT_SPECIFIER = /(?:\bfrom\s*|\bimport\s*\(?\s*)["']([^"'./][^"']*)["']/g;
864
864
  var STYLESHEET_IMPORT = /(?:\bfrom\s*|\bimport\s*\(?\s*|\brequire\s*\(\s*)["'][^"']+\.(?:css|scss|sass|less|styl)["']/;
865
865
  var MAX_SCANNED_FILES = 2e3;
866
+ var FARM_FONT_MODULE = "@farm.js/core/font";
866
867
  var packageScans = /* @__PURE__ */ new Map();
867
868
  var PACKAGE_SCAN_CACHE_SCHEMA = 1;
868
869
  var packageScanStamps = /* @__PURE__ */ new Map();
@@ -987,7 +988,10 @@ function findFarmServerBundledPackage(importer, specifier) {
987
988
  } catch {
988
989
  return null;
989
990
  }
990
- return scanPackage(directory).stylesheets ? { name: parsed.name, prebundle: false } : null;
991
+ const scan = scanPackage(directory);
992
+ if (scan.imports.has(FARM_FONT_MODULE))
993
+ return { name: parsed.name, prebundle: false, fonts: true };
994
+ return scan.stylesheets ? { name: parsed.name, prebundle: false } : null;
991
995
  }
992
996
  function isSelfContainedPackage(manifest, importer) {
993
997
  if (Object.keys(manifest.dependencies ?? {}).length > 0) return false;
@@ -4341,6 +4345,11 @@ function resolveFarmClientOptimizeDeps(directory, root) {
4341
4345
  const exclude = /* @__PURE__ */ new Set();
4342
4346
  const imports = scanFarmPackageImports(directory, root);
4343
4347
  for (const specifier of imports.client) {
4348
+ const fonts = findFarmServerBundledPackage(importer, specifier);
4349
+ if (fonts?.fonts) {
4350
+ exclude.add(fonts.name);
4351
+ continue;
4352
+ }
4344
4353
  const manifest = findFarmPackageManifest(importer, specifier);
4345
4354
  if (manifest && farmReactServerBuildReachesClientModules(importer, specifier, imports.server.has(specifier))) {
4346
4355
  exclude.add(manifest.name);
@@ -3,7 +3,7 @@
3
3
  var _chunkPWMJBCANcjs = require('./chunk-PWMJBCAN.cjs');
4
4
 
5
5
 
6
- var _chunkBOEDYXAXcjs = require('./chunk-BOEDYXAX.cjs');
6
+ var _chunkBBX4RPOVcjs = require('./chunk-BBX4RPOV.cjs');
7
7
 
8
8
 
9
9
 
@@ -163,7 +163,7 @@ async function createFarmRscViteConfig(userConfig, options) {
163
163
  server: { environmentName: "rsc" },
164
164
  config: {
165
165
  preset: options.preset,
166
- outputDir: options.outputDir && _chunkBOEDYXAXcjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
166
+ outputDir: options.outputDir && _chunkBBX4RPOVcjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
167
167
  }
168
168
  })
169
169
  ]
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkCVZY4TLWcjs = require('./chunk-CVZY4TLW.cjs');
3
+ var _chunk3HWNYLQVcjs = require('./chunk-3HWNYLQV.cjs');
4
4
 
5
5
  // src/deployment-environment.ts
6
6
  function isFarmProductionDeploymentEnvironment(env = process.env) {
@@ -90,7 +90,7 @@ function createFarmProductionSiteReporter(options) {
90
90
  schemaVersion: FARM_PRODUCTION_SITE_TELEMETRY_SCHEMA_VERSION,
91
91
  eventType: FARM_PRODUCTION_SITE_ATTESTATION_EVENT_TYPE,
92
92
  packageName: FARM_PRODUCTION_SITE_TELEMETRY_PACKAGE_NAME,
93
- packageVersion: sanitizeDetail(_chunkCVZY4TLWcjs.FARM_VERSION, "unknown"),
93
+ packageVersion: sanitizeDetail(_chunk3HWNYLQVcjs.FARM_VERSION, "unknown"),
94
94
  renderer: sanitizeDetail(options.renderer, "custom"),
95
95
  deployTarget: sanitizeDetail(options.deployTarget, "custom")
96
96
  };
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-D2VAANBS.mjs";
19
19
  import {
20
20
  FARM_VERSION
21
- } from "./chunk-I5CVJ24H.mjs";
21
+ } from "./chunk-XIXAUXV3.mjs";
22
22
 
23
23
  // src/mobile/analyzer.ts
24
24
  import { createHash } from "crypto";
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  collectFarmNativeServerFns,
34
34
  findFarmNativeScreenFiles
35
- } from "./chunk-MUUDHWQZ.mjs";
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-NLHSKKTT.mjs";
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-EDBIBO67.mjs";
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-BRDGINBB.mjs";
118
+ } from "./chunk-X7RSOEMQ.mjs";
119
119
  import {
120
120
  TAILWIND_CSS_BROWSER_TARGET,
121
121
  generateFarmClientPluginEntryCode,
@@ -138,7 +138,7 @@ import {
138
138
  import {
139
139
  FARM_PRERENDER_ENV,
140
140
  _farmWebMCPReportsEnabled
141
- } from "./chunk-M5XU22PQ.mjs";
141
+ } from "./chunk-YS647ASS.mjs";
142
142
  import {
143
143
  HOISTED_HEAD_ELEMENT,
144
144
  appMiddlewareMayHandlePath,
@@ -165,7 +165,7 @@ import {
165
165
  listFarmBuiltInRoutePaths,
166
166
  resolveFarmApiCatalogInput,
167
167
  resolveFarmAppManifestInput
168
- } from "./chunk-3WM7VBGW.mjs";
168
+ } from "./chunk-YX532KEF.mjs";
169
169
  import {
170
170
  FARM_DEFAULT_MCP_PATH,
171
171
  createFarmDefaultMCPServer,
@@ -173,7 +173,7 @@ import {
173
173
  } from "./chunk-HR4N2K4V.mjs";
174
174
  import {
175
175
  isFarmPreviewDeploymentEnvironment
176
- } from "./chunk-IRJSZAJB.mjs";
176
+ } from "./chunk-PQR5A7R2.mjs";
177
177
  import {
178
178
  FARM_NATIVE_SERVER_FN_PLUGIN
179
179
  } from "./chunk-L4RTTTVE.mjs";
@@ -194,7 +194,7 @@ import {
194
194
  withFarmSourceSnapshot,
195
195
  withFarmSourceSnapshotOf,
196
196
  withPackageClientBoundaryCache
197
- } from "./chunk-XLULEFRW.mjs";
197
+ } from "./chunk-3TCFONUE.mjs";
198
198
  import {
199
199
  generateFarmDocsAdapterClientRuntime,
200
200
  getFarmDocsAdapterConfigModule
@@ -308,7 +308,7 @@ import {
308
308
  } from "./chunk-2I6PUKWJ.mjs";
309
309
  import {
310
310
  FARM_VERSION
311
- } from "./chunk-I5CVJ24H.mjs";
311
+ } from "./chunk-XIXAUXV3.mjs";
312
312
  import {
313
313
  FARM_VIDEO_PLAYER_PATH
314
314
  } from "./chunk-AG27TI6Q.mjs";
@@ -832,6 +832,7 @@ function collectFarmClientModulePreloads(bundle, options) {
832
832
  const rendererFiles = dynamicFiles(options.rendererModules);
833
833
  const rootFiles = dynamicFiles(options.rootModules);
834
834
  const actionFiles = dynamicFiles(options.actionModules, rendererFiles);
835
+ const serverTreeFiles = dynamicFiles(options.serverTreeModules, rendererFiles);
835
836
  return {
836
837
  files,
837
838
  entry: entryFiles.map(index),
@@ -839,6 +840,7 @@ function collectFarmClientModulePreloads(bundle, options) {
839
840
  ...rendererFiles.length > 0 ? { renderer: rendererFiles.map(index) } : {},
840
841
  ...rootFiles.length > 0 ? { root: rootFiles.map(index) } : {},
841
842
  ...actionFiles.length > 0 ? { actions: actionFiles.map(index) } : {},
843
+ ...serverTreeFiles.length > 0 ? { serverTrees: serverTreeFiles.map(index) } : {},
842
844
  modules
843
845
  };
844
846
  }
@@ -857,11 +859,17 @@ function createFarmClientModulePreloadPlugin(options) {
857
859
  };
858
860
  const rendererModules = await resolve(options.rendererImports);
859
861
  const actionModules = await resolve(options.actionImports);
862
+ const serverTreeModules = await resolve(options.serverTreeImports);
860
863
  await fs.mkdir(options.buildDir, { recursive: true });
861
864
  await fs.writeFile(
862
865
  path4.join(options.buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE),
863
866
  JSON.stringify(
864
- collectFarmClientModulePreloads(bundle, { ...options, rendererModules, actionModules })
867
+ collectFarmClientModulePreloads(bundle, {
868
+ ...options,
869
+ rendererModules,
870
+ actionModules,
871
+ serverTreeModules
872
+ })
865
873
  )
866
874
  );
867
875
  }
@@ -883,6 +891,50 @@ function encodeFarmBuildJSONPlaceholder(value) {
883
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");
884
892
  }
885
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
+
886
938
  // src/nitro/client-route-table.ts
887
939
  import fs2 from "fs/promises";
888
940
  import path5 from "path";
@@ -3543,6 +3595,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3543
3595
  entryFileNames: "[name]-h[hash].js",
3544
3596
  chunkFileNames: "chunks/[name]-h[hash].js",
3545
3597
  hashCharacters: "hex",
3598
+ ...islandsMode && isReactRenderer(config.renderer) && !configuresFarmClientChunks(config.vite) ? { codeSplitting: { groups: [createFarmIslandsReactChunkGroup()] } } : {},
3546
3599
  // Use predictable name for CSS so we can reference it in SSR HTML
3547
3600
  assetFileNames: (assetInfo) => {
3548
3601
  if (assetInfo.name?.endsWith(".css")) {
@@ -3591,6 +3644,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3591
3644
  ],
3592
3645
  // What a call's result is handled with, imported on the first (RFC 0013).
3593
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"],
3594
3650
  rendererImporter: clientEntryPath
3595
3651
  } : {}
3596
3652
  }),
@@ -10368,6 +10424,8 @@ const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"([^>]*)>|"r
10368
10424
  // A server action reference in a document's markup: an action in an island's or a client
10369
10425
  // component's props (islx's \`{"$":"a",...}\`), or a server form posting one (its \`$F_REF_\` field).
10370
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"/;
10371
10429
 
10372
10430
  function renderFarmClientModulePreload(index) {
10373
10431
  return '\\n <link rel="modulepreload" href="/' +
@@ -10407,6 +10465,14 @@ function collectFarmClientActionModules(markup, listed) {
10407
10465
  return actions.filter((index) => !listed.has(index) && listed.add(index));
10408
10466
  }
10409
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
+
10410
10476
  // The modulepreload links for a document: the entry's static imports and, unless it answers a
10411
10477
  // client navigation, the renderer and, when a page or layout root hydrates in it (\`hydratesRoot\`),
10412
10478
  // the code that renders it; then the modules its hydrating page and its markup load.
@@ -10420,6 +10486,7 @@ function renderFarmClientModulePreloads(markup, pageModule, navigation, hydrates
10420
10486
  (hydratesRoot && !navigation ? farmClientRootPreloadTags : "") +
10421
10487
  collectFarmClientDocumentModules(markup, pageModule, listed)
10422
10488
  .concat(collectFarmClientActionModules(markup, listed))
10489
+ .concat(collectFarmClientServerTreeModules(markup, listed))
10423
10490
  .map(renderFarmClientModulePreload)
10424
10491
  .join("");
10425
10492
  }
@@ -10452,11 +10519,14 @@ function renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy, na
10452
10519
  )
10453
10520
  : [];
10454
10521
  const waitsForClick = rootStrategy === "interaction";
10455
- // 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));
10456
10525
  const renderer = navigation
10457
10526
  ? []
10458
10527
  : (farmClientModulePreloads.renderer || []).concat(
10459
- collectFarmClientActionModules(markup, new Set(entry.concat(rootModules))),
10528
+ collectFarmClientActionModules(markup, listed),
10529
+ collectFarmClientServerTreeModules(markup, listed),
10460
10530
  );
10461
10531
  return attribute("data-farm-preload", waitsForClick ? entry : entry.concat(rootModules)) +
10462
10532
  attribute("data-farm-preload-router", farmClientModulePreloads.router || []) +