@farm.js/core 0.1.87 → 0.2.0-beta.1

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 (146) hide show
  1. package/dist/analyzer-IIWSUXSQ.cjs +17 -0
  2. package/dist/{analyzer-W4EB7DHL.mjs → analyzer-RYSF2BM3.mjs} +2 -2
  3. package/dist/api/route-manager.cjs +3 -3
  4. package/dist/api/route-manager.mjs +2 -2
  5. package/dist/api.cjs +4 -4
  6. package/dist/api.mjs +3 -3
  7. package/dist/{app.d-b3A4cca5.d.ts → app.d-CoY-zsJt.d.ts} +1 -1
  8. package/dist/{app.d-AVZXCfcO.d.mts → app.d-DE5KNbmf.d.mts} +1 -1
  9. package/dist/{chunk-B7L24VPX.cjs → chunk-22KXTL3I.cjs} +6 -4
  10. package/dist/{chunk-4SJ22WTT.mjs → chunk-23BZ7ZH6.mjs} +1 -1
  11. package/dist/{chunk-33WR5XV5.cjs → chunk-27ESPHQA.cjs} +4 -4
  12. package/dist/{chunk-FULX5RYX.cjs → chunk-2OR5WAD5.cjs} +19 -13
  13. package/dist/{chunk-3F55K4MC.mjs → chunk-2U2GRXP5.mjs} +1 -1
  14. package/dist/{chunk-K5FLQJW5.mjs → chunk-4A6A6P4T.mjs} +6 -4
  15. package/dist/chunk-65LZRVCZ.mjs +18 -0
  16. package/dist/{chunk-XFUPWRKT.cjs → chunk-6BMAGVDI.cjs} +4 -4
  17. package/dist/{chunk-VCZ4EM5K.cjs → chunk-6ETHVRFO.cjs} +143 -136
  18. package/dist/{chunk-LBJOHMTB.mjs → chunk-AMMFRXFW.mjs} +1 -1
  19. package/dist/{chunk-HQ2VAJLW.mjs → chunk-ANKMAGFJ.mjs} +1 -1
  20. package/dist/{chunk-EZYNIADW.mjs → chunk-CIQCJ72N.mjs} +45 -29
  21. package/dist/{chunk-A2PPQ5LB.mjs → chunk-CPMK7EFR.mjs} +1 -1
  22. package/dist/{chunk-B5QRNCIE.mjs → chunk-DATICPTO.mjs} +1 -1
  23. package/dist/{chunk-QLRI2BX5.mjs → chunk-DZC2XGK4.mjs} +24 -18
  24. package/dist/{chunk-O7K4HMAQ.mjs → chunk-EBKYRP2P.mjs} +1 -1
  25. package/dist/{chunk-IM422XKU.cjs → chunk-FJGA3XWL.cjs} +2 -2
  26. package/dist/{chunk-FLMALEY2.mjs → chunk-GGD57DJA.mjs} +3 -25
  27. package/dist/chunk-GTHBWZUK.mjs +17 -0
  28. package/dist/{chunk-CXHVRHM2.cjs → chunk-HENPVGZC.cjs} +2 -2
  29. package/dist/{chunk-N3VMHPIY.mjs → chunk-HZY63K5C.mjs} +2 -2
  30. package/dist/{chunk-5D73SKF3.mjs → chunk-ISSFWEPY.mjs} +1 -1
  31. package/dist/chunk-JIGWHFA5.mjs +32 -0
  32. package/dist/{chunk-YBXIVQCE.cjs → chunk-JP5TWUK2.cjs} +4 -4
  33. package/dist/{chunk-TI4BZV6M.cjs → chunk-KBIM7PFQ.cjs} +73 -67
  34. package/dist/{chunk-UGD53SNO.cjs → chunk-KQ6TYQU7.cjs} +16 -12
  35. package/dist/{chunk-XMVZXZ32.cjs → chunk-KRU3XPOW.cjs} +2 -2
  36. package/dist/{chunk-SDNYULFS.cjs → chunk-L4B7PB3H.cjs} +157 -141
  37. package/dist/{chunk-7BNVUIGL.cjs → chunk-M3JYBZO2.cjs} +2 -2
  38. package/dist/{chunk-VCI776NG.cjs → chunk-N2ZMSSPP.cjs} +12 -10
  39. package/dist/{chunk-2UYYXSUS.mjs → chunk-N5NRXLCX.mjs} +4 -2
  40. package/dist/{chunk-ZCX2XJPY.cjs → chunk-ND65INFS.cjs} +2 -2
  41. package/dist/{chunk-26HESRBL.mjs → chunk-NVXU5BEG.mjs} +47 -28
  42. package/dist/{chunk-OBVBII5K.cjs → chunk-NZRAUCUL.cjs} +2 -2
  43. package/dist/{chunk-U3A46QFD.cjs → chunk-OIPPISQ6.cjs} +81 -62
  44. package/dist/{chunk-6MZSTPD2.mjs → chunk-OQOII62L.mjs} +1 -1
  45. package/dist/{chunk-2PJVEL56.cjs → chunk-PCAEJNQF.cjs} +5 -27
  46. package/dist/{chunk-Q73LRKLP.mjs → chunk-PKV3JGMS.mjs} +1 -1
  47. package/dist/{chunk-3AV4DCXY.mjs → chunk-PWTBXYJY.mjs} +12 -6
  48. package/dist/{chunk-PO5MZIWK.mjs → chunk-QBXS4TNG.mjs} +6 -2
  49. package/dist/chunk-QZUCVJZJ.cjs +18 -0
  50. package/dist/chunk-SIECKBNK.cjs +17 -0
  51. package/dist/{chunk-HFRG2IQS.mjs → chunk-SPKZCFPH.mjs} +5 -4
  52. package/dist/{chunk-CN2JOTRO.cjs → chunk-THGSPDFD.cjs} +7 -7
  53. package/dist/{chunk-WSQ3S3NV.cjs → chunk-TWFJJPE7.cjs} +13 -12
  54. package/dist/{chunk-HYL372GW.cjs → chunk-V3Y3R3JJ.cjs} +1 -1
  55. package/dist/{chunk-QSDIJ45N.mjs → chunk-VZWAXQME.mjs} +1 -1
  56. package/dist/{chunk-A4WWKG2B.cjs → chunk-WEZTGM7N.cjs} +2 -2
  57. package/dist/{chunk-JB4BHRFK.cjs → chunk-WP77JDKI.cjs} +16 -16
  58. package/dist/{chunk-VPGEYX5Y.mjs → chunk-WX752VMN.mjs} +2 -2
  59. package/dist/chunk-YIGUFJMR.cjs +32 -0
  60. package/dist/{chunk-4FGTNYHE.mjs → chunk-YPAOC3FO.mjs} +2 -2
  61. package/dist/{chunk-LIWVPE72.mjs → chunk-Z7ZRBCAB.mjs} +23 -16
  62. package/dist/{chunk-RGYS5OPL.cjs → chunk-ZPQY7O64.cjs} +3 -3
  63. package/dist/client.cjs +8 -6
  64. package/dist/client.d.mts +5 -5
  65. package/dist/client.d.ts +5 -5
  66. package/dist/client.mjs +7 -5
  67. package/dist/{devtools-GWJZPWIW.mjs → devtools-5DBTT2DI.mjs} +1 -1
  68. package/dist/{devtools-GPIKZ5AV.cjs → devtools-JTJA2KIZ.cjs} +2 -2
  69. package/dist/docs.cjs +3 -3
  70. package/dist/docs.mjs +2 -2
  71. package/dist/environment/vite.cjs +3 -3
  72. package/dist/environment/vite.mjs +2 -2
  73. package/dist/i18n/client.cjs +11 -10
  74. package/dist/i18n/client.mjs +3 -2
  75. package/dist/index.cjs +30 -28
  76. package/dist/index.d.mts +5 -5
  77. package/dist/index.d.ts +5 -5
  78. package/dist/index.mjs +25 -23
  79. package/dist/internal/build-runtime.cjs +17 -17
  80. package/dist/internal/build-runtime.mjs +16 -16
  81. package/dist/internal/cli-runtime.cjs +5 -5
  82. package/dist/internal/cli-runtime.mjs +4 -4
  83. package/dist/internal/client-error-overlay.cjs +4 -4
  84. package/dist/internal/client-error-overlay.mjs +1 -1
  85. package/dist/internal/client-runtime.cjs +11 -12
  86. package/dist/internal/client-runtime.d.mts +6 -4
  87. package/dist/internal/client-runtime.d.ts +6 -4
  88. package/dist/internal/client-runtime.mjs +11 -12
  89. package/dist/internal/config-runtime.cjs +3 -3
  90. package/dist/internal/config-runtime.mjs +2 -2
  91. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  92. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  93. package/dist/internal/islands-boot.cjs +20 -15
  94. package/dist/internal/islands-boot.mjs +6 -1
  95. package/dist/internal/native-server-fns.cjs +4 -4
  96. package/dist/internal/native-server-fns.mjs +3 -3
  97. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  98. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  99. package/dist/internal/production-runtime.cjs +4 -4
  100. package/dist/internal/production-runtime.mjs +3 -3
  101. package/dist/internal/spa-router.cjs +4 -3
  102. package/dist/internal/spa-router.d.mts +1 -1
  103. package/dist/internal/spa-router.d.ts +1 -1
  104. package/dist/internal/spa-router.mjs +3 -2
  105. package/dist/{manager-PX4QN4HK.cjs → manager-37UJPUN4.cjs} +4 -4
  106. package/dist/{manager-OMTC5FOJ.mjs → manager-7BNSJKME.mjs} +3 -3
  107. package/dist/{navigation-delegate.d-ChfinbWB.d.mts → navigation-delegate.d-B9GjWbov.d.mts} +1 -1
  108. package/dist/{navigation-delegate.d-fMgELdAe.d.ts → navigation-delegate.d-BbW1_pf_.d.ts} +1 -1
  109. package/dist/navigation.cjs +6 -5
  110. package/dist/navigation.d.mts +2 -2
  111. package/dist/navigation.d.ts +2 -2
  112. package/dist/navigation.mjs +5 -4
  113. package/dist/plugin.cjs +12 -12
  114. package/dist/plugin.mjs +11 -11
  115. package/dist/query/client.cjs +8 -7
  116. package/dist/query/client.mjs +3 -2
  117. package/dist/renderer-client.cjs +14 -13
  118. package/dist/renderer-client.d.mts +3 -3
  119. package/dist/renderer-client.d.ts +3 -3
  120. package/dist/renderer-client.mjs +5 -4
  121. package/dist/{router.d-D5Mp7bpO.d.ts → router.d-Bm9FNSu3.d.ts} +1 -1
  122. package/dist/{router.d-DrQ1QDFk.d.mts → router.d-YKVirmj4.d.mts} +1 -1
  123. package/dist/{rsc-pipeline-TQOSDWOU.cjs → rsc-pipeline-LGXJGGMW.cjs} +3 -3
  124. package/dist/{rsc-pipeline-KLMQU3YP.mjs → rsc-pipeline-W5DSWDHD.mjs} +2 -2
  125. package/dist/{runtime-BDPBO65S.mjs → runtime-UOZKSM5S.mjs} +2 -2
  126. package/dist/{runtime-CQSCRVZ7.cjs → runtime-YV4X5FAK.cjs} +4 -4
  127. package/dist/server.cjs +48 -33
  128. package/dist/server.d.mts +1 -1
  129. package/dist/server.d.ts +1 -1
  130. package/dist/server.mjs +28 -13
  131. package/dist/{spa-router.d-CXgvy-7L.d.mts → spa-router.d-DGmropfK.d.mts} +3 -1
  132. package/dist/{spa-router.d-BXxoU3Cv.d.ts → spa-router.d-nE1jHNGt.d.ts} +3 -1
  133. package/dist/{store-core.d-D00BsbnO.d.ts → store-core.d-B5cwOd8g.d.ts} +2 -2
  134. package/dist/{store-core.d-CDbVAbTn.d.mts → store-core.d-C-gATBwd.d.mts} +2 -2
  135. package/dist/testing.cjs +2 -2
  136. package/dist/testing.mjs +2 -2
  137. package/dist/version.cjs +2 -2
  138. package/dist/version.mjs +1 -1
  139. package/dist/vite.cjs +12 -12
  140. package/dist/vite.mjs +11 -11
  141. package/package.json +3 -3
  142. package/dist/analyzer-LLU2Z6I4.cjs +0 -17
  143. package/dist/chunk-SBDWCDS6.cjs +0 -8
  144. package/dist/chunk-YX6AFPXC.mjs +0 -8
  145. /package/dist/{chunk-MZR22RAC.cjs → chunk-FLKG2PYH.cjs} +0 -0
  146. /package/dist/{chunk-ALOFMAFA.mjs → chunk-OOOUYA6L.mjs} +0 -0
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-D2VAANBS.mjs";
19
19
  import {
20
20
  FARM_VERSION
21
- } from "./chunk-O7K4HMAQ.mjs";
21
+ } from "./chunk-EBKYRP2P.mjs";
22
22
 
23
23
  // src/mobile/analyzer.ts
24
24
  import { createHash } from "crypto";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-YFTGIHNC.mjs";
4
4
  import {
5
5
  isFarmAPIRouteFileName
6
- } from "./chunk-YX6AFPXC.mjs";
6
+ } from "./chunk-GTHBWZUK.mjs";
7
7
  import {
8
8
  registerAPIRouteShape
9
9
  } from "./chunk-2LKUR5QJ.mjs";
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  collectFarmNativeServerFns,
34
34
  findFarmNativeScreenFiles
35
- } from "./chunk-3F55K4MC.mjs";
35
+ } from "./chunk-2U2GRXP5.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-QSDIJ45N.mjs";
43
+ } from "./chunk-VZWAXQME.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-ALOFMAFA.mjs";
73
+ } from "./chunk-OOOUYA6L.mjs";
74
74
  import {
75
75
  resolveFarmInstrumentationFile
76
76
  } from "./chunk-QRNYSISP.mjs";
@@ -116,7 +116,7 @@ import {
116
116
  resolveFarmNotFoundComponentPath,
117
117
  resolveFarmRouteRootStrategy,
118
118
  toBakedMarkdownSourcePath
119
- } from "./chunk-QLRI2BX5.mjs";
119
+ } from "./chunk-DZC2XGK4.mjs";
120
120
  import {
121
121
  TAILWIND_CSS_BROWSER_TARGET,
122
122
  generateFarmClientPluginEntryCode,
@@ -132,11 +132,11 @@ import {
132
132
  readRouteRenderingDirectiveFromFile,
133
133
  resolveRouteRenderingConfig,
134
134
  resolveRouteRenderingConfigFromFile
135
- } from "./chunk-4SJ22WTT.mjs";
135
+ } from "./chunk-23BZ7ZH6.mjs";
136
136
  import {
137
137
  FARM_PRERENDER_ENV,
138
138
  _farmWebMCPReportsEnabled
139
- } from "./chunk-5D73SKF3.mjs";
139
+ } from "./chunk-ISSFWEPY.mjs";
140
140
  import {
141
141
  HOISTED_HEAD_ELEMENT,
142
142
  appMiddlewareMayHandlePath,
@@ -163,7 +163,7 @@ import {
163
163
  listFarmBuiltInRoutePaths,
164
164
  resolveFarmApiCatalogInput,
165
165
  resolveFarmAppManifestInput
166
- } from "./chunk-4FGTNYHE.mjs";
166
+ } from "./chunk-YPAOC3FO.mjs";
167
167
  import {
168
168
  FARM_DEFAULT_MCP_PATH,
169
169
  createFarmDefaultMCPServer,
@@ -171,7 +171,7 @@ import {
171
171
  } from "./chunk-HR4N2K4V.mjs";
172
172
  import {
173
173
  isFarmPreviewDeploymentEnvironment
174
- } from "./chunk-Q73LRKLP.mjs";
174
+ } from "./chunk-PKV3JGMS.mjs";
175
175
  import {
176
176
  FARM_NATIVE_SERVER_FN_PLUGIN
177
177
  } from "./chunk-L4RTTTVE.mjs";
@@ -192,7 +192,7 @@ import {
192
192
  withFarmSourceSnapshot,
193
193
  withFarmSourceSnapshotOf,
194
194
  withPackageClientBoundaryCache
195
- } from "./chunk-26HESRBL.mjs";
195
+ } from "./chunk-NVXU5BEG.mjs";
196
196
  import {
197
197
  generateFarmDocsAdapterClientRuntime,
198
198
  getFarmDocsAdapterConfigModule
@@ -281,7 +281,10 @@ import {
281
281
  } from "./chunk-QD34VE4N.mjs";
282
282
  import {
283
283
  APIRouteManager
284
- } from "./chunk-HFRG2IQS.mjs";
284
+ } from "./chunk-SPKZCFPH.mjs";
285
+ import {
286
+ hasPolyroutePlugin
287
+ } from "./chunk-GTHBWZUK.mjs";
285
288
  import {
286
289
  readFarmI18nCatalogs
287
290
  } from "./chunk-VO55MMBX.mjs";
@@ -309,7 +312,7 @@ import {
309
312
  } from "./chunk-2I6PUKWJ.mjs";
310
313
  import {
311
314
  FARM_VERSION
312
- } from "./chunk-O7K4HMAQ.mjs";
315
+ } from "./chunk-EBKYRP2P.mjs";
313
316
  import {
314
317
  FARM_VIDEO_PLAYER_PATH
315
318
  } from "./chunk-AG27TI6Q.mjs";
@@ -1503,7 +1506,7 @@ function collectServerReadSSRAssets(bundle) {
1503
1506
  }
1504
1507
  return assets;
1505
1508
  }
1506
- function collectServerOnlySSRAssets(bundle) {
1509
+ function collectServerOnlySSRAssets(bundle, polyroute = false) {
1507
1510
  const serverOnly = /* @__PURE__ */ new Set();
1508
1511
  const publicReferenceSources = [];
1509
1512
  for (const [fileName, output] of Object.entries(bundle)) {
@@ -1526,6 +1529,7 @@ function collectServerOnlySSRAssets(bundle) {
1526
1529
  }
1527
1530
  }
1528
1531
  for (const fileName of serverOnly) {
1532
+ if (polyroute && /(?:^|\/)polyroute\/[a-f0-9]+\/[^/]+\.wasm$/.test(fileName)) continue;
1529
1533
  const name = path10.posix.basename(fileName);
1530
1534
  if (publicReferenceSources.some((source) => source.includes(name))) {
1531
1535
  serverOnly.delete(fileName);
@@ -3035,7 +3039,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
3035
3039
  }
3036
3040
  const { bundle: ssrBundle, entryFile: ssrEntryFile, configuredHeaderRoutes } = ssrResult;
3037
3041
  assertServerReadSSRAssetsSupported(ssrBundle, preset, root);
3038
- await writeSSRAssetsToClient(ssrBundle, clientOutputDir);
3042
+ await writeSSRAssetsToClient(ssrBundle, clientOutputDir, ssrResult.polyroute);
3039
3043
  if (!rendererDisabled) {
3040
3044
  await writeFarmVideoPlayerToClient(clientOutputDir);
3041
3045
  }
@@ -3113,9 +3117,9 @@ function varyFarmNitroCacheRules(rules, headerNames) {
3113
3117
  })
3114
3118
  );
3115
3119
  }
3116
- async function writeSSRAssetsToClient(bundle, outputDir) {
3120
+ async function writeSSRAssetsToClient(bundle, outputDir, polyroute) {
3117
3121
  const fs5 = await import("fs/promises");
3118
- const serverOnlyAssets = collectServerOnlySSRAssets(bundle);
3122
+ const serverOnlyAssets = collectServerOnlySSRAssets(bundle, polyroute);
3119
3123
  for (const [fileName, output] of Object.entries(bundle)) {
3120
3124
  if (output.type !== "asset" || serverOnlyAssets.has(fileName)) continue;
3121
3125
  if (fileName === "farm-fonts.css") {
@@ -5332,7 +5336,7 @@ function isFarmDocsPath() {
5332
5336
  // Farm.js Client Runtime (no client components)
5333
5337
  ${cssImport}
5334
5338
  ${layoutImports}
5335
- import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, runFarmNavigationDelegates, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
5339
+ import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, isFarmSameDocumentFragment, readFarmLinkNavigateOptions, targetsCurrentContext, rememberFarmLinkLocale, reconcileFarmDocumentHead, runFarmNavigationDelegates, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
5336
5340
  import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
5337
5341
  ${clientPluginEntry.imports}
5338
5342
  ${clientCachePersistence.imports}
@@ -5548,6 +5552,7 @@ ${generateUniversalRouterStateProperties()}
5548
5552
  }
5549
5553
  });
5550
5554
  }
5555
+ if (isFarmSameDocumentFragment(url.href, window.location.href)) return;
5551
5556
 
5552
5557
  const pathname = url.pathname + url.search;
5553
5558
  if (this.readFreshPrefetch(pathname) !== undefined) return;
@@ -5619,7 +5624,7 @@ document.addEventListener("click", function(e) {
5619
5624
  if (anchor.hasAttribute("download")) return;
5620
5625
  if (hasAbsoluteNavigationHref(href)) return;
5621
5626
  if (href.startsWith("#")) return;
5622
- if (anchor.target && anchor.target !== "_self") return;
5627
+ if (!targetsCurrentContext(anchor)) return;
5623
5628
  if (document.documentElement.dataset.farmDocsRuntime === "true") return;
5624
5629
  if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return;
5625
5630
  if (e.button !== 0) return;
@@ -5844,7 +5849,7 @@ ${lazyRoot ? "" : layoutImports}
5844
5849
  ${rendererClientImports}
5845
5850
  ${isolatedHydrationImport}
5846
5851
  ${providerClientCode.imports}
5847
- import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, keepFarmIslandValues, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, replayFarmQueuedInteraction, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
5852
+ import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, keepFarmIslandValues, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, isFarmSameDocumentFragment, readFarmLinkNavigateOptions, targetsCurrentContext, rememberFarmLinkLocale, reconcileFarmDocumentHead, replayFarmQueuedInteraction, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
5848
5853
  import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
5849
5854
  ${lazyMatcher ? "" : 'import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";'}
5850
5855
  ${clientPluginEntry.imports}
@@ -7237,6 +7242,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
7237
7242
  }
7238
7243
  });
7239
7244
  }
7245
+ if (isFarmSameDocumentFragment(url.href, window.location.href)) return;
7240
7246
  prefetchFarmClientRouteTable();
7241
7247
 
7242
7248
  // A prefetch warms an ordinary future navigation, which reads the bare
@@ -7318,7 +7324,7 @@ document.addEventListener("click", function(e) {
7318
7324
  if (anchor.hasAttribute("download")) return;
7319
7325
  if (hasAbsoluteNavigationHref(href)) return;
7320
7326
  if (href.startsWith("#")) return;
7321
- if (anchor.target && anchor.target !== "_self") return;
7327
+ if (!targetsCurrentContext(anchor)) return;
7322
7328
  if (document.documentElement.dataset.farmDocsRuntime === "true") return;
7323
7329
  if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return;
7324
7330
  if (e.button !== 0) return;
@@ -7370,6 +7376,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7370
7376
  label: "for SSR"
7371
7377
  });
7372
7378
  }
7379
+ let polyroute = false;
7373
7380
  let ssrBundle;
7374
7381
  let ssrEntryFile;
7375
7382
  const pageRoutes = collectedPageRoutes.map((route) => ({ ...route }));
@@ -7447,7 +7454,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7447
7454
  const appDirs = getFarmAppDirectories(config);
7448
7455
  let openAPIReference = null;
7449
7456
  if (config.openapi.enabled && config.openapi.route) {
7450
- const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-OMTC5FOJ.mjs");
7457
+ const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-7BNSJKME.mjs");
7451
7458
  const openAPIManager = new OpenAPIManager(appDirs, config.openapi, {
7452
7459
  mode: "production",
7453
7460
  apiBaseURL: config.api.baseURL,
@@ -7752,16 +7759,24 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7752
7759
  },
7753
7760
  {
7754
7761
  name: "capture-ssr-bundle",
7755
- generateBundle(_options, bundle) {
7756
- ssrBundle = bundle;
7757
- for (const [fileName, file] of Object.entries(bundle)) {
7758
- if (file.type === "chunk" && file.isEntry) {
7759
- ssrEntryFile = fileName;
7760
- break;
7762
+ configResolved(config2) {
7763
+ polyroute = hasPolyroutePlugin(config2.plugins);
7764
+ },
7765
+ enforce: "post",
7766
+ generateBundle: {
7767
+ // Retain assets emitted by user plugins, including post-generateBundle hooks.
7768
+ order: "post",
7769
+ handler(_options, bundle) {
7770
+ ssrBundle = bundle;
7771
+ for (const [fileName, file] of Object.entries(bundle)) {
7772
+ if (file.type === "chunk" && file.isEntry) {
7773
+ ssrEntryFile = fileName;
7774
+ break;
7775
+ }
7776
+ }
7777
+ if (!ssrEntryFile) {
7778
+ throw new Error("No entry point found in SSR bundle");
7761
7779
  }
7762
- }
7763
- if (!ssrEntryFile) {
7764
- throw new Error("No entry point found in SSR bundle");
7765
7780
  }
7766
7781
  }
7767
7782
  }
@@ -7791,6 +7806,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
7791
7806
  }
7792
7807
  }
7793
7808
  return {
7809
+ polyroute,
7794
7810
  bundle: ssrBundle,
7795
7811
  entryFile: ssrEntryFile,
7796
7812
  configuredHeaderRoutes
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-RLEAVG6G.mjs";
4
4
  import {
5
5
  resolveDeployOutputPath
6
- } from "./chunk-ALOFMAFA.mjs";
6
+ } from "./chunk-OOOUYA6L.mjs";
7
7
  import {
8
8
  farmDesktopDevGuardPlugin,
9
9
  loadFarmReactPlugin
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  compiledFarmI18nMessages,
3
3
  getFarmI18nClientState
4
- } from "./chunk-FLMALEY2.mjs";
4
+ } from "./chunk-GGD57DJA.mjs";
5
5
 
6
6
  // src/i18n/client-runtime.ts
7
7
  import IntlMessageFormat from "intl-messageformat";
@@ -9,7 +9,7 @@ import {
9
9
  collectSSGPages,
10
10
  matchSSGPage,
11
11
  resolveRouteRenderingConfigFromFile
12
- } from "./chunk-4SJ22WTT.mjs";
12
+ } from "./chunk-23BZ7ZH6.mjs";
13
13
  import {
14
14
  resolveFarmRendererRoutes
15
15
  } from "./chunk-YNPVG2GG.mjs";
@@ -59,7 +59,7 @@ import {
59
59
  } from "./chunk-PEQJ4UUT.mjs";
60
60
  import {
61
61
  listFarmMCPLlmsTxtLinks
62
- } from "./chunk-4FGTNYHE.mjs";
62
+ } from "./chunk-YPAOC3FO.mjs";
63
63
  import {
64
64
  FARM_DEFAULT_MCP_PATH,
65
65
  collectFarmDefaultMCPPages,
@@ -104,7 +104,7 @@ import {
104
104
  traceFarmSourceReads,
105
105
  usesFarmServerTree,
106
106
  withFarmSourceSnapshot
107
- } from "./chunk-26HESRBL.mjs";
107
+ } from "./chunk-NVXU5BEG.mjs";
108
108
  import {
109
109
  _setDefaultFarmThemeConfig,
110
110
  getTheme
@@ -304,7 +304,7 @@ import {
304
304
  } from "./chunk-EILUVBKS.mjs";
305
305
  import {
306
306
  FARM_VERSION
307
- } from "./chunk-O7K4HMAQ.mjs";
307
+ } from "./chunk-EBKYRP2P.mjs";
308
308
  import {
309
309
  normalizeFarmAPIConfig
310
310
  } from "./chunk-W6QLRQ3V.mjs";
@@ -524,7 +524,8 @@ var RouteManager = class _RouteManager {
524
524
  // read, so a production build can tell whether a route module's plan still holds.
525
525
  this.planStamps = /* @__PURE__ */ new Map();
526
526
  this.sourceChangeTracking = false;
527
- this.linkedSources = /* @__PURE__ */ new Map();
527
+ // planSourcePath of each file a plan read.
528
+ this.planSources = /* @__PURE__ */ new Map();
528
529
  // Whether each package directory under `node_modules` a plan read from links to a workspace.
529
530
  this.linkedPackages = /* @__PURE__ */ new Map();
530
531
  // Source files edited since the last plan; null when the next plan must recompute every module.
@@ -975,7 +976,7 @@ var RouteManager = class _RouteManager {
975
976
  }
976
977
  this.editedSources = null;
977
978
  this.sourceSnapshot?.clear();
978
- this.linkedSources.clear();
979
+ this.planSources.clear();
979
980
  this.linkedPackages.clear();
980
981
  }
981
982
  /**
@@ -1044,20 +1045,20 @@ var RouteManager = class _RouteManager {
1044
1045
  * installed package; a plan reads thousands of files of an icon package.
1045
1046
  */
1046
1047
  planSourcePath(file) {
1048
+ let source = this.planSources.get(file);
1049
+ if (source !== void 0) return source;
1050
+ source = file;
1047
1051
  const index = file.lastIndexOf(NODE_MODULES_SEGMENT);
1048
- if (index === -1) return file;
1049
- const directory = getInstalledPackageDirectory(file, index + NODE_MODULES_SEGMENT.length);
1050
- let linked = this.linkedPackages.get(directory);
1051
- if (linked === void 0) {
1052
- linked = realPathOutsideNodeModules(directory) !== null;
1053
- this.linkedPackages.set(directory, linked);
1054
- }
1055
- if (!linked) return null;
1056
- let source = this.linkedSources.get(file);
1057
- if (source === void 0) {
1058
- source = realPathOutsideNodeModules(file);
1059
- this.linkedSources.set(file, source);
1052
+ if (index !== -1) {
1053
+ const directory = getInstalledPackageDirectory(file, index + NODE_MODULES_SEGMENT.length);
1054
+ let linked = this.linkedPackages.get(directory);
1055
+ if (linked === void 0) {
1056
+ linked = realPathOutsideNodeModules(directory) !== null;
1057
+ this.linkedPackages.set(directory, linked);
1058
+ }
1059
+ source = linked ? realPathOutsideNodeModules(file) : null;
1060
1060
  }
1061
+ this.planSources.set(file, source);
1061
1062
  return source;
1062
1063
  }
1063
1064
  /**
@@ -8654,6 +8655,11 @@ function getFarmClientOptimizeDepsInclude(renderer, root) {
8654
8655
  // renderer stays source: pre-bundling it would copy the packages it shares with the app's
8655
8656
  // components into the bundle, so a hook would read a different copy than the renderer set.
8656
8657
  ...renderer && root && !isReactRenderer(renderer) && isPackageSpecifier(renderer.client) && isInstalledPackage(root, renderer.client) ? [renderer.client] : [],
8658
+ // Farm's renderer API, which a renderer's bindings import. An app's components reach it only
8659
+ // through them, from files Vite's scan may not read, such as a custom renderer's own format.
8660
+ // Served as source from a linked renderer, its imports were found on the first page request,
8661
+ // and Vite bundled again and reloaded the page while it loaded.
8662
+ ...renderer && !isReactRenderer(renderer) ? ["@farm.js/core/renderer-client"] : [],
8657
8663
  // The islands runtime of a renderer that declares `islands`, which only Farm's entry imports.
8658
8664
  ...renderer && !isReactRenderer(renderer) && getFarmRendererCapabilities(renderer).islands ? [
8659
8665
  "@farm.js/core/internal/renderer-islands",
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.1.87";
2
+ var version = "0.2.0-beta.1";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -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 _chunkHYL372GWcjs = require('./chunk-HYL372GW.cjs');
3
+ var _chunkV3Y3R3JJcjs = require('./chunk-V3Y3R3JJ.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(_chunkHYL372GWcjs.FARM_VERSION, "unknown"),
93
+ packageVersion: sanitizeDetail(_chunkV3Y3R3JJcjs.FARM_VERSION, "unknown"),
94
94
  renderer: sanitizeDetail(options.renderer, "custom"),
95
95
  deployTarget: sanitizeDetail(options.deployTarget, "custom")
96
96
  };
@@ -1,3 +1,6 @@
1
+ import {
2
+ resolveFarmNavigationURL
3
+ } from "./chunk-JIGWHFA5.mjs";
1
4
  import {
2
5
  createFarmLocaleCookie
3
6
  } from "./chunk-UJIBSFUE.mjs";
@@ -9,27 +12,6 @@ import {
9
12
  resolveFarmLocalePath
10
13
  } from "./chunk-4QBFYEDC.mjs";
11
14
 
12
- // src/client/navigation-url.ts
13
- var FARM_NAVIGATION_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]);
14
- function isFarmBlockedNavigationURL(url) {
15
- if (FARM_NAVIGATION_PROTOCOLS.has(url.protocol)) return false;
16
- console.error(`[Farm.js] Blocked navigation to a ${url.protocol} URL as a security precaution.`);
17
- return true;
18
- }
19
- function isFarmScriptURL(href) {
20
- try {
21
- return new URL(href, "http://farm.invalid").protocol === "javascript:";
22
- } catch {
23
- return false;
24
- }
25
- }
26
- function isFarmExternalNavigationURL(url, currentOrigin) {
27
- return url.protocol !== "http:" && url.protocol !== "https:" || url.origin !== currentOrigin;
28
- }
29
- function resolveFarmNavigationURL(href, documentUrl) {
30
- return new URL(href, documentUrl);
31
- }
32
-
33
15
  // src/i18n/client-state.ts
34
16
  var listeners = /* @__PURE__ */ new Set();
35
17
  var compiledFarmI18nMessages = /* @__PURE__ */ new Map();
@@ -76,10 +58,6 @@ function rememberFarmLinkLocale(anchor) {
76
58
  }
77
59
 
78
60
  export {
79
- isFarmBlockedNavigationURL,
80
- isFarmScriptURL,
81
- isFarmExternalNavigationURL,
82
- resolveFarmNavigationURL,
83
61
  compiledFarmI18nMessages,
84
62
  getFarmI18nClientState,
85
63
  subscribeFarmI18n,
@@ -0,0 +1,17 @@
1
+ // src/api/route-files.ts
2
+ function hasPolyroutePlugin(plugins) {
3
+ return plugins?.some((plugin) => plugin.name === "polyroute") === true;
4
+ }
5
+ function isPolyrouteRouteFileName(fileName) {
6
+ return fileName === "route.rs" || fileName === "route.go";
7
+ }
8
+ function isFarmAPIRouteFileName(fileName, polyroute = false) {
9
+ if (polyroute && isPolyrouteRouteFileName(fileName)) return true;
10
+ return /^route\.(?:ts|tsx|js|jsx)$/.test(fileName);
11
+ }
12
+
13
+ export {
14
+ hasPolyroutePlugin,
15
+ isPolyrouteRouteFileName,
16
+ isFarmAPIRouteFileName
17
+ };
@@ -18,7 +18,7 @@ var _chunkHR5GU4UUcjs = require('./chunk-HR5GU4UU.cjs');
18
18
  var _chunkNDOE76QCcjs = require('./chunk-NDOE76QC.cjs');
19
19
 
20
20
 
21
- var _chunkMZR22RACcjs = require('./chunk-MZR22RAC.cjs');
21
+ var _chunkFLKG2PYHcjs = require('./chunk-FLKG2PYH.cjs');
22
22
 
23
23
 
24
24
 
@@ -599,7 +599,7 @@ async function resolveAPIContext(options) {
599
599
  config: options.config,
600
600
  configPath: options.configPath
601
601
  }));
602
- const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkMZR22RACcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
602
+ const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkFLKG2PYHcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
603
603
  const guardedPaths = new Set(_nullishCoalesce(_optionalChain([runtimeConfig, 'optionalAccess', _25 => _25.guardedPaths]), () => ( [])));
604
604
  return {
605
605
  root,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useRouter
3
- } from "./chunk-VPGEYX5Y.mjs";
3
+ } from "./chunk-WX752VMN.mjs";
4
4
  import {
5
5
  getRouter
6
- } from "./chunk-PO5MZIWK.mjs";
6
+ } from "./chunk-QBXS4TNG.mjs";
7
7
  import {
8
8
  applyFarmBasePath
9
9
  } from "./chunk-SF3JB56B.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getFarmRouteLabel
3
- } from "./chunk-4FGTNYHE.mjs";
3
+ } from "./chunk-YPAOC3FO.mjs";
4
4
  import {
5
5
  _classifyFarmMCPSession,
6
6
  _farmMCPClientSession,
@@ -0,0 +1,32 @@
1
+ // src/client/navigation-url.ts
2
+ var FARM_NAVIGATION_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]);
3
+ function isFarmBlockedNavigationURL(url) {
4
+ if (FARM_NAVIGATION_PROTOCOLS.has(url.protocol)) return false;
5
+ console.error(`[Farm.js] Blocked navigation to a ${url.protocol} URL as a security precaution.`);
6
+ return true;
7
+ }
8
+ function isFarmScriptURL(href) {
9
+ try {
10
+ return new URL(href, "http://farm.invalid").protocol === "javascript:";
11
+ } catch {
12
+ return false;
13
+ }
14
+ }
15
+ function isFarmSameDocumentFragment(href, currentHref) {
16
+ const fragment = href.indexOf("#");
17
+ return fragment >= 0 && href.slice(0, fragment) === currentHref.split("#", 1)[0];
18
+ }
19
+ function isFarmExternalNavigationURL(url, currentOrigin) {
20
+ return url.protocol !== "http:" && url.protocol !== "https:" || url.origin !== currentOrigin;
21
+ }
22
+ function resolveFarmNavigationURL(href, documentUrl) {
23
+ return new URL(href, documentUrl);
24
+ }
25
+
26
+ export {
27
+ isFarmBlockedNavigationURL,
28
+ isFarmScriptURL,
29
+ isFarmSameDocumentFragment,
30
+ isFarmExternalNavigationURL,
31
+ resolveFarmNavigationURL
32
+ };
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunk2PJVEL56cjs = require('./chunk-2PJVEL56.cjs');
4
+ var _chunkPCAEJNQFcjs = require('./chunk-PCAEJNQF.cjs');
5
5
 
6
6
  // src/i18n/client-runtime.ts
7
7
  var _intlmessageformat = require('intl-messageformat'); var _intlmessageformat2 = _interopRequireDefault(_intlmessageformat);
@@ -11,10 +11,10 @@ var translate = (key, values, rich = false) => {
11
11
  const message = readOwnMessage(snapshot.messages, key);
12
12
  if (message === void 0) return key;
13
13
  const cacheKey = `${snapshot.locale}\0${key}\0${message}`;
14
- let formatter = _chunk2PJVEL56cjs.compiledFarmI18nMessages.get(cacheKey);
14
+ let formatter = _chunkPCAEJNQFcjs.compiledFarmI18nMessages.get(cacheKey);
15
15
  if (!formatter) {
16
16
  formatter = new (0, _intlmessageformat2.default)(message, snapshot.locale);
17
- _chunk2PJVEL56cjs.compiledFarmI18nMessages.set(cacheKey, formatter);
17
+ _chunkPCAEJNQFcjs.compiledFarmI18nMessages.set(cacheKey, formatter);
18
18
  }
19
19
  const result = formatter.format(values);
20
20
  if (rich) return Array.isArray(result) && result.length === 1 ? result[0] : result;
@@ -31,7 +31,7 @@ function createFarmClientTranslator() {
31
31
  return ((key, ...args) => t(key, ...args));
32
32
  }
33
33
  function requireSnapshot() {
34
- const snapshot = _chunk2PJVEL56cjs.getFarmI18nClientState.call(void 0, );
34
+ const snapshot = _chunkPCAEJNQFcjs.getFarmI18nClientState.call(void 0, );
35
35
  if (!snapshot) {
36
36
  throw new Error("Farm i18n is not configured or has not been hydrated.");
37
37
  }