@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
@@ -28,7 +28,7 @@ var _chunkYUCU6XB4cjs = require('./chunk-YUCU6XB4.cjs');
28
28
  var _chunk7U4XF76Rcjs = require('./chunk-7U4XF76R.cjs');
29
29
 
30
30
 
31
- var _chunkHYL372GWcjs = require('./chunk-HYL372GW.cjs');
31
+ var _chunkV3Y3R3JJcjs = require('./chunk-V3Y3R3JJ.cjs');
32
32
 
33
33
  // src/environment-vite.ts
34
34
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
@@ -886,7 +886,7 @@ function usePackageScanCacheFile(file) {
886
886
  const stored = /* @__PURE__ */ new Map();
887
887
  try {
888
888
  const value = JSON.parse(_fs2.default.readFileSync(file, "utf8"));
889
- if (_optionalChain([value, 'optionalAccess', _68 => _68.schema]) === PACKAGE_SCAN_CACHE_SCHEMA && value.farm === _chunkHYL372GWcjs.FARM_VERSION && value.scans && typeof value.scans === "object") {
889
+ if (_optionalChain([value, 'optionalAccess', _68 => _68.schema]) === PACKAGE_SCAN_CACHE_SCHEMA && value.farm === _chunkV3Y3R3JJcjs.FARM_VERSION && value.scans && typeof value.scans === "object") {
890
890
  for (const [directory, scan] of Object.entries(value.scans)) {
891
891
  if (isStoredPackageScan(scan)) stored.set(directory, scan);
892
892
  }
@@ -915,7 +915,7 @@ function persistPackageScanCache() {
915
915
  _fs2.default.mkdirSync(_path2.default.dirname(cache2.file), { recursive: true });
916
916
  _fs2.default.writeFileSync(
917
917
  temporary,
918
- JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm: _chunkHYL372GWcjs.FARM_VERSION, scans })
918
+ JSON.stringify({ schema: PACKAGE_SCAN_CACHE_SCHEMA, farm: _chunkV3Y3R3JJcjs.FARM_VERSION, scans })
919
919
  );
920
920
  _fs2.default.renameSync(temporary, cache2.file);
921
921
  cache2.dirty = false;
@@ -1769,16 +1769,23 @@ function specifierPackage(specifier) {
1769
1769
  return specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
1770
1770
  }
1771
1771
  function packageLookup(directory, packageName) {
1772
- for (let current = directory; ; current = _path2.default.dirname(current)) {
1773
- if (_path2.default.basename(current) !== "node_modules") {
1774
- const candidate = _path2.default.join(current, "node_modules", packageName);
1775
- try {
1776
- return { from: current, real: _fs2.default.realpathSync(candidate) };
1777
- } catch (e26) {
1772
+ return memoizeInFarmSourceSnapshot(
1773
+ "package-lookup",
1774
+ `${farmSourceSnapshotPathKey(directory)}\0${packageName}`,
1775
+ () => {
1776
+ for (let current = directory; ; current = _path2.default.dirname(current)) {
1777
+ if (_path2.default.basename(current) !== "node_modules") {
1778
+ const candidate = _path2.default.join(current, "node_modules", packageName);
1779
+ try {
1780
+ return { from: current, real: _fs2.default.realpathSync(candidate) };
1781
+ } catch (e26) {
1782
+ }
1783
+ }
1784
+ if (_path2.default.dirname(current) === current) return null;
1778
1785
  }
1779
- }
1780
- if (_path2.default.dirname(current) === current) return null;
1781
- }
1786
+ },
1787
+ (result) => result !== null
1788
+ );
1782
1789
  }
1783
1790
  function referenceResolveFrom(root, specifier, importer) {
1784
1791
  const packageName = specifierPackage(specifier);
@@ -2218,7 +2225,7 @@ var PackageClientBoundaryCache = class {
2218
2225
  }
2219
2226
  const contents = JSON.stringify({
2220
2227
  schema: SCHEMA_VERSION,
2221
- farm: _chunkHYL372GWcjs.FARM_VERSION,
2228
+ farm: _chunkV3Y3R3JJcjs.FARM_VERSION,
2222
2229
  paths,
2223
2230
  entries
2224
2231
  });
@@ -2258,7 +2265,7 @@ function readStoredCache(file) {
2258
2265
  } catch (e37) {
2259
2266
  return null;
2260
2267
  }
2261
- if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkHYL372GWcjs.FARM_VERSION) {
2268
+ if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkV3Y3R3JJcjs.FARM_VERSION) {
2262
2269
  return null;
2263
2270
  }
2264
2271
  const { paths, entries } = value;
@@ -2269,7 +2276,7 @@ function readStoredCache(file) {
2269
2276
  const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
2270
2277
  if (usable.length > 0) valid[key] = usable;
2271
2278
  }
2272
- return { schema: SCHEMA_VERSION, farm: _chunkHYL372GWcjs.FARM_VERSION, paths, entries: valid };
2279
+ return { schema: SCHEMA_VERSION, farm: _chunkV3Y3R3JJcjs.FARM_VERSION, paths, entries: valid };
2273
2280
  }
2274
2281
  function isRecord(value) {
2275
2282
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -3909,9 +3916,12 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
3909
3916
  }
3910
3917
  function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
3911
3918
  if (_optionalChain([tokens, 'access', _240 => _240[startIndex], 'optionalAccess', _241 => _241.value]) !== "{") return false;
3912
- const closingBraceIndex = tokens.findIndex(
3913
- (token, index) => index > startIndex && index < endIndex && token.value === "}"
3914
- );
3919
+ let closingBraceIndex = -1;
3920
+ for (let index = startIndex + 1; index < endIndex; index++) {
3921
+ if (tokens[index].value !== "}") continue;
3922
+ closingBraceIndex = index;
3923
+ break;
3924
+ }
3915
3925
  if (closingBraceIndex === -1) return false;
3916
3926
  let entryStartsAt = startIndex + 1;
3917
3927
  for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
@@ -3986,19 +3996,22 @@ function matchProjectImportAlias(alias, specifier) {
3986
3996
  return specifier.slice(alias.prefix.length, specifier.length - alias.suffix.length);
3987
3997
  }
3988
3998
  function getProjectImportAliases(projectRoot) {
3989
- const stamp = PROJECT_ALIAS_FILES.map((file) => {
3990
- try {
3991
- return String(_fs2.default.statSync(_path2.default.join(projectRoot, file)).mtimeMs);
3992
- } catch (e43) {
3993
- return "-";
3994
- }
3995
- }).join(":");
3996
3999
  const sourceDir = _chunkMNUYXZV7cjs.getFarmProjectSourceDir.call(void 0, projectRoot);
3997
- const cacheStamp = `${stamp}:${sourceDir}`;
3998
4000
  const cached = projectImportAliasCache.get(projectRoot);
3999
- if (_optionalChain([cached, 'optionalAccess', _244 => _244.stamp]) === cacheStamp) return cached.aliases;
4001
+ const dependencies = new Set(
4002
+ _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _244 => _244.stamps, 'access', _245 => _245.keys, 'call', _246 => _246()]), () => ( PROJECT_ALIAS_FILES.map((file) => _path2.default.join(projectRoot, file))))
4003
+ );
4004
+ const stamps = /* @__PURE__ */ new Map();
4005
+ for (const file of dependencies) {
4006
+ noteFarmSourceRead(file);
4007
+ stamps.set(file, getFarmSourceStamp(file));
4008
+ }
4009
+ if (_optionalChain([cached, 'optionalAccess', _247 => _247.sourceDir]) === sourceDir && [...stamps].every(([file, stamp]) => cached.stamps.get(file) === stamp))
4010
+ return cached.aliases;
4011
+ dependencies.clear();
4012
+ for (const file of PROJECT_ALIAS_FILES) dependencies.add(_path2.default.join(projectRoot, file));
4000
4013
  const aliases = [
4001
- ...readTsconfigPathAliases(projectRoot),
4014
+ ...readTsconfigPathAliases(projectRoot, dependencies),
4002
4015
  ...readPackageImportAliases(projectRoot)
4003
4016
  ];
4004
4017
  if (!aliases.some((alias) => alias.prefix === "@/")) {
@@ -4009,15 +4022,20 @@ function getProjectImportAliases(projectRoot) {
4009
4022
  targets: [_path2.default.join(projectRoot, sourceDir, "*")]
4010
4023
  });
4011
4024
  }
4012
- projectImportAliasCache.set(projectRoot, { stamp: cacheStamp, aliases });
4025
+ stamps.clear();
4026
+ for (const file of dependencies) {
4027
+ noteFarmSourceRead(file);
4028
+ stamps.set(file, getFarmSourceStamp(file));
4029
+ }
4030
+ projectImportAliasCache.set(projectRoot, { sourceDir, stamps, aliases });
4013
4031
  return aliases;
4014
4032
  }
4015
- function readTsconfigPathAliases(projectRoot) {
4033
+ function readTsconfigPathAliases(projectRoot, dependencies) {
4016
4034
  for (const name of ["tsconfig.json", "jsconfig.json"]) {
4017
4035
  const configPath = _path2.default.join(projectRoot, name);
4018
4036
  if (!_fs2.default.existsSync(configPath)) continue;
4019
- const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
4020
- if (!_optionalChain([resolved, 'optionalAccess', _245 => _245.paths])) return [];
4037
+ const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set(), dependencies);
4038
+ if (!_optionalChain([resolved, 'optionalAccess', _248 => _248.paths])) return [];
4021
4039
  const base2 = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
4022
4040
  return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
4023
4041
  if (!Array.isArray(targets)) return [];
@@ -4034,9 +4052,10 @@ function readTsconfigPathAliases(projectRoot) {
4034
4052
  }
4035
4053
  return [];
4036
4054
  }
4037
- function readTsconfigPaths(configPath, visited) {
4055
+ function readTsconfigPaths(configPath, visited, dependencies) {
4038
4056
  if (visited.has(configPath)) return null;
4039
4057
  visited.add(configPath);
4058
+ dependencies.add(configPath);
4040
4059
  const config = readJsonWithComments(configPath);
4041
4060
  if (!config) return null;
4042
4061
  const directory = _path2.default.dirname(configPath);
@@ -4049,21 +4068,21 @@ function readTsconfigPaths(configPath, visited) {
4049
4068
  directory,
4050
4069
  parent.endsWith(".json") ? parent : `${parent}.json`
4051
4070
  );
4052
- inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
4071
+ inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited, dependencies), () => ( inherited));
4053
4072
  }
4054
4073
  const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
4055
- const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _246 => _246.baseUrl]);
4074
+ const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _249 => _249.baseUrl]);
4056
4075
  if (options.paths && typeof options.paths === "object") {
4057
4076
  return { paths: options.paths, pathsDirectory: directory, baseUrl };
4058
4077
  }
4059
4078
  return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
4060
4079
  }
4061
4080
  function readPackageImportAliases(projectRoot) {
4062
- const imports = _optionalChain([readPackageJson, 'call', _247 => _247(_path2.default.join(projectRoot, "package.json")), 'optionalAccess', _248 => _248.imports]);
4081
+ const imports = _optionalChain([readPackageJson, 'call', _250 => _250(_path2.default.join(projectRoot, "package.json")), 'optionalAccess', _251 => _251.imports]);
4063
4082
  if (!imports || typeof imports !== "object") return [];
4064
4083
  return Object.entries(imports).flatMap(([pattern, value]) => {
4065
4084
  const target = resolveConditionalExportTarget(value);
4066
- if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _249 => _249.startsWith, 'call', _250 => _250("./")])) return [];
4085
+ if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _252 => _252.startsWith, 'call', _253 => _253("./")])) return [];
4067
4086
  const wildcardIndex = pattern.indexOf("*");
4068
4087
  return [
4069
4088
  {
@@ -4079,7 +4098,7 @@ function readJsonWithComments(filePath) {
4079
4098
  let source;
4080
4099
  try {
4081
4100
  source = _fs2.default.readFileSync(filePath, "utf8");
4082
- } catch (e44) {
4101
+ } catch (e43) {
4083
4102
  return null;
4084
4103
  }
4085
4104
  let output = "";
@@ -4107,7 +4126,7 @@ function readJsonWithComments(filePath) {
4107
4126
  }
4108
4127
  try {
4109
4128
  return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
4110
- } catch (e45) {
4129
+ } catch (e44) {
4111
4130
  return null;
4112
4131
  }
4113
4132
  }
@@ -4129,15 +4148,15 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
4129
4148
  const packageJsonPath = _path2.default.join(packageDirectory, "package.json");
4130
4149
  const packageJson = readPackageJson(packageJsonPath);
4131
4150
  const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
4132
- const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _251 => _251.exports]), exportKey);
4151
+ const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _254 => _254.exports]), exportKey);
4133
4152
  const candidates = /* @__PURE__ */ new Set();
4134
- if (_optionalChain([exportTarget, 'optionalAccess', _252 => _252.startsWith, 'call', _253 => _253("./")])) {
4153
+ if (_optionalChain([exportTarget, 'optionalAccess', _255 => _255.startsWith, 'call', _256 => _256("./")])) {
4135
4154
  candidates.add(_path2.default.resolve(packageDirectory, exportTarget));
4136
4155
  }
4137
4156
  if (packageSubpath) {
4138
4157
  candidates.add(_path2.default.join(packageDirectory, packageSubpath));
4139
4158
  } else {
4140
- for (const entry of [_optionalChain([packageJson, 'optionalAccess', _254 => _254.browser]), _optionalChain([packageJson, 'optionalAccess', _255 => _255.module]), _optionalChain([packageJson, 'optionalAccess', _256 => _256.main])]) {
4159
+ for (const entry of [_optionalChain([packageJson, 'optionalAccess', _257 => _257.browser]), _optionalChain([packageJson, 'optionalAccess', _258 => _258.module]), _optionalChain([packageJson, 'optionalAccess', _259 => _259.main])]) {
4141
4160
  if (typeof entry === "string") candidates.add(_path2.default.resolve(packageDirectory, entry));
4142
4161
  }
4143
4162
  candidates.add(_path2.default.join(packageDirectory, "index"));
@@ -4173,7 +4192,7 @@ function findPackageDirectory2(importerPath, packageName, root) {
4173
4192
  function readPackageJson(packageJsonPath) {
4174
4193
  try {
4175
4194
  return JSON.parse(_fs2.default.readFileSync(packageJsonPath, "utf8"));
4176
- } catch (e46) {
4195
+ } catch (e45) {
4177
4196
  return null;
4178
4197
  }
4179
4198
  }
@@ -4202,7 +4221,7 @@ function resolvePackageExport(exportsField, exportKey) {
4202
4221
  if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
4203
4222
  const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
4204
4223
  const target = resolveConditionalExportTarget(value);
4205
- return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _257 => _257.replace, 'call', _258 => _258("*", wildcard)]), () => ( null));
4224
+ return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _260 => _260.replace, 'call', _261 => _261("*", wildcard)]), () => ( null));
4206
4225
  }
4207
4226
  return null;
4208
4227
  }
@@ -4245,8 +4264,8 @@ function resolveSourceCandidatePath(candidate) {
4245
4264
  }
4246
4265
  for (const sourcePath of paths) {
4247
4266
  try {
4248
- if (_optionalChain([_fs2.default, 'access', _259 => _259.statSync, 'call', _260 => _260(sourcePath, { throwIfNoEntry: false }), 'optionalAccess', _261 => _261.isFile, 'call', _262 => _262()])) return sourcePath;
4249
- } catch (e47) {
4267
+ if (_optionalChain([_fs2.default, 'access', _262 => _262.statSync, 'call', _263 => _263(sourcePath, { throwIfNoEntry: false }), 'optionalAccess', _264 => _264.isFile, 'call', _265 => _265()])) return sourcePath;
4268
+ } catch (e46) {
4250
4269
  }
4251
4270
  }
4252
4271
  return null;
@@ -4288,7 +4307,7 @@ function scanFarmPackageImports(directory, root) {
4288
4307
  let entries;
4289
4308
  try {
4290
4309
  entries = _fs2.default.readdirSync(current, { withFileTypes: true });
4291
- } catch (e48) {
4310
+ } catch (e47) {
4292
4311
  return;
4293
4312
  }
4294
4313
  for (const entry of entries) {
@@ -4321,7 +4340,7 @@ function collectFarmServerBundledPackageInfo(directory) {
4321
4340
  let entries;
4322
4341
  try {
4323
4342
  entries = _fs2.default.readdirSync(current, { withFileTypes: true });
4324
- } catch (e49) {
4343
+ } catch (e48) {
4325
4344
  return;
4326
4345
  }
4327
4346
  for (const entry of entries) {
@@ -4360,7 +4379,7 @@ function getFarmClientReachableModules(directory, root) {
4360
4379
  let entries;
4361
4380
  try {
4362
4381
  entries = _fs2.default.readdirSync(current, { withFileTypes: true });
4363
- } catch (e50) {
4382
+ } catch (e49) {
4364
4383
  return;
4365
4384
  }
4366
4385
  for (const entry of entries) {
@@ -4395,7 +4414,7 @@ function resolveFarmClientOptimizeDeps(directory, root) {
4395
4414
  const imports = scanFarmPackageImports(directory, root);
4396
4415
  for (const specifier of imports.client) {
4397
4416
  const fonts = findFarmServerBundledPackage(importer, specifier);
4398
- if (_optionalChain([fonts, 'optionalAccess', _263 => _263.fonts])) {
4417
+ if (_optionalChain([fonts, 'optionalAccess', _266 => _266.fonts])) {
4399
4418
  exclude.add(fonts.name);
4400
4419
  continue;
4401
4420
  }
@@ -4471,13 +4490,13 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4471
4490
  let projectRoot = process.cwd();
4472
4491
  let sources;
4473
4492
  const routeSourceFiles = () => {
4474
- const clientRoutes = _optionalChain([farmApi, 'optionalAccess', _264 => _264.getProgrammaticClientRoutes, 'call', _265 => _265()]);
4475
- if (_optionalChain([sources, 'optionalAccess', _266 => _266.for]) !== clientRoutes || !sources) {
4493
+ const clientRoutes = _optionalChain([farmApi, 'optionalAccess', _267 => _267.getProgrammaticClientRoutes, 'call', _268 => _268()]);
4494
+ if (_optionalChain([sources, 'optionalAccess', _269 => _269.for]) !== clientRoutes || !sources) {
4476
4495
  sources = {
4477
4496
  for: clientRoutes,
4478
4497
  files: /* @__PURE__ */ new Set([
4479
4498
  ...routesFiles,
4480
- ...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess', _267 => _267.routeSourceFiles]), () => ( []))].map(resolvedFile)
4499
+ ...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess', _270 => _270.routeSourceFiles]), () => ( []))].map(resolvedFile)
4481
4500
  ])
4482
4501
  };
4483
4502
  }
@@ -4498,7 +4517,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4498
4517
  configResolved(config) {
4499
4518
  isBuild = config.command === "build";
4500
4519
  projectRoot = config.root;
4501
- farmApi = _optionalChain([config, 'access', _268 => _268.plugins, 'access', _269 => _269.find, 'call', _270 => _270((plugin) => plugin.name === "farm"), 'optionalAccess', _271 => _271.api]);
4520
+ farmApi = _optionalChain([config, 'access', _271 => _271.plugins, 'access', _272 => _272.find, 'call', _273 => _273((plugin) => plugin.name === "farm"), 'optionalAccess', _274 => _274.api]);
4502
4521
  sources = void 0;
4503
4522
  routesFiles = new Set(
4504
4523
  _chunk52Q4OB4Acjs.getFarmSourceRoots.call(void 0, { ...options, root: _nullishCoalesce(options.root, () => ( config.root)) }).flatMap(
@@ -4511,7 +4530,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4511
4530
  transform(code, id, transformOptions) {
4512
4531
  const environment = resolveBuildEnvironment(
4513
4532
  this,
4514
- _optionalChain([transformOptions, 'optionalAccess', _272 => _272.ssr])
4533
+ _optionalChain([transformOptions, 'optionalAccess', _275 => _275.ssr])
4515
4534
  );
4516
4535
  const parse3 = (source) => this.parse(source);
4517
4536
  const result = transformEnvironmentFunctions({
@@ -4524,7 +4543,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4524
4543
  if (environment === "client" && !isBuild && !_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id) && routeSourceFiles().has(moduleFile(id)) && !isProgrammaticRouteActionProxy(code)) {
4525
4544
  this.error(routeSourceError(moduleFile(id)));
4526
4545
  }
4527
- if (environment === "server" && _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access', _273 => _273.experimental, 'optionalAccess', _274 => _274.serverComponents])) === "islands" && isApplicationScript(id)) {
4546
+ if (environment === "server" && _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access', _276 => _276.experimental, 'optionalAccess', _277 => _277.serverComponents])) === "islands" && isApplicationScript(id)) {
4528
4547
  const file = id.split("?", 1)[0];
4529
4548
  const root = _fs.realpathSync.call(void 0, _nullishCoalesce(options.root, () => ( projectRoot)));
4530
4549
  const clientCode = getFarmClientReachableModules(root, root).has(_path2.default.resolve(file)) || _fs.existsSync.call(void 0, file) && hasUseClientDirective(_fs.readFileSync.call(void 0, file, "utf8"));
@@ -4558,7 +4577,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4558
4577
  for (const id of this.getModuleIds()) {
4559
4578
  if (_chunkYUCU6XB4cjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
4560
4579
  const chain = findClientNodeBuiltinChain(id, (moduleId) => {
4561
- return _optionalChain([this, 'access', _275 => _275.getModuleInfo, 'call', _276 => _276(moduleId), 'optionalAccess', _277 => _277.importedIds]);
4580
+ return _optionalChain([this, 'access', _278 => _278.getModuleInfo, 'call', _279 => _279(moduleId), 'optionalAccess', _280 => _280.importedIds]);
4562
4581
  });
4563
4582
  if (chain) {
4564
4583
  this.error(
@@ -4576,8 +4595,8 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
4576
4595
  }
4577
4596
  if (!forbidden.has(moduleFile(id))) continue;
4578
4597
  const info = this.getModuleInfo(id);
4579
- if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess', _278 => _278.code]))) continue;
4580
- this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess', _279 => _279.importers, 'access', _280 => _280.map, 'call', _281 => _281(moduleFile)])));
4598
+ if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess', _281 => _281.code]))) continue;
4599
+ this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess', _282 => _282.importers, 'access', _283 => _283.map, 'call', _284 => _284(moduleFile)])));
4581
4600
  }
4582
4601
  }
4583
4602
  };
@@ -4591,13 +4610,13 @@ function moduleFile(id) {
4591
4610
  function resolvedFile(filePath) {
4592
4611
  try {
4593
4612
  return moduleFile(_fs.realpathSync.call(void 0, filePath));
4594
- } catch (e51) {
4613
+ } catch (e50) {
4595
4614
  return moduleFile(filePath);
4596
4615
  }
4597
4616
  }
4598
4617
  function resolveBuildEnvironment(context, ssr) {
4599
- if (_optionalChain([context, 'access', _282 => _282.environment, 'optionalAccess', _283 => _283.name]) === "client") return "client";
4600
- if (_optionalChain([context, 'access', _284 => _284.environment, 'optionalAccess', _285 => _285.name]) === "rsc" || _optionalChain([context, 'access', _286 => _286.environment, 'optionalAccess', _287 => _287.name]) === "ssr") {
4618
+ if (_optionalChain([context, 'access', _285 => _285.environment, 'optionalAccess', _286 => _286.name]) === "client") return "client";
4619
+ if (_optionalChain([context, 'access', _287 => _287.environment, 'optionalAccess', _288 => _288.name]) === "rsc" || _optionalChain([context, 'access', _289 => _289.environment, 'optionalAccess', _290 => _290.name]) === "ssr") {
4601
4620
  return "server";
4602
4621
  }
4603
4622
  return ssr ? "server" : "client";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  APITypeGenerator
3
- } from "./chunk-HQ2VAJLW.mjs";
3
+ } from "./chunk-ANKMAGFJ.mjs";
4
4
  import {
5
5
  resolveRouteOpenAPIConfig
6
6
  } from "./chunk-NRWEY2CM.mjs";
@@ -1,5 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkYIGUFJMRcjs = require('./chunk-YIGUFJMR.cjs');
4
+
5
+
3
6
  var _chunk7Q2YWZF7cjs = require('./chunk-7Q2YWZF7.cjs');
4
7
 
5
8
 
@@ -9,27 +12,6 @@ var _chunkAOKXITZ6cjs = require('./chunk-AOKXITZ6.cjs');
9
12
 
10
13
  var _chunkGYJT2U7Jcjs = require('./chunk-GYJT2U7J.cjs');
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 (e) {
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();
@@ -62,7 +44,7 @@ function isFarmLocaleChangeHref(href) {
62
44
  const snapshot = getFarmI18nClientState();
63
45
  if (!snapshot || typeof window === "undefined") return false;
64
46
  if (snapshot.routing === "none") return false;
65
- const target = resolveFarmNavigationURL(href, window.location.href);
47
+ const target = _chunkYIGUFJMRcjs.resolveFarmNavigationURL.call(void 0, href, window.location.href);
66
48
  const match = _chunkGYJT2U7Jcjs.resolveFarmLocalePath.call(void 0, target.pathname, snapshot);
67
49
  const targetLocale = match.locale || snapshot.defaultLocale;
68
50
  return targetLocale !== snapshot.locale;
@@ -83,8 +65,4 @@ function rememberFarmLinkLocale(anchor) {
83
65
 
84
66
 
85
67
 
86
-
87
-
88
-
89
-
90
- exports.isFarmBlockedNavigationURL = isFarmBlockedNavigationURL; exports.isFarmScriptURL = isFarmScriptURL; exports.isFarmExternalNavigationURL = isFarmExternalNavigationURL; exports.resolveFarmNavigationURL = resolveFarmNavigationURL; exports.compiledFarmI18nMessages = compiledFarmI18nMessages; exports.getFarmI18nClientState = getFarmI18nClientState; exports.subscribeFarmI18n = subscribeFarmI18n; exports._hydrateFarmI18n = _hydrateFarmI18n; exports.localizeActiveFarmHref = localizeActiveFarmHref; exports.isFarmLocaleChangeHref = isFarmLocaleChangeHref; exports.rememberFarmLinkLocale = rememberFarmLinkLocale;
68
+ exports.compiledFarmI18nMessages = compiledFarmI18nMessages; exports.getFarmI18nClientState = getFarmI18nClientState; exports.subscribeFarmI18n = subscribeFarmI18n; exports._hydrateFarmI18n = _hydrateFarmI18n; exports.localizeActiveFarmHref = localizeActiveFarmHref; exports.isFarmLocaleChangeHref = isFarmLocaleChangeHref; exports.rememberFarmLinkLocale = rememberFarmLinkLocale;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FARM_VERSION
3
- } from "./chunk-O7K4HMAQ.mjs";
3
+ } from "./chunk-EBKYRP2P.mjs";
4
4
 
5
5
  // src/deployment-environment.ts
6
6
  function isFarmProductionDeploymentEnvironment(env = process.env) {
@@ -1,3 +1,6 @@
1
+ import {
2
+ targetsCurrentContext
3
+ } from "./chunk-65LZRVCZ.mjs";
1
4
  import {
2
5
  invokeMutationWithRetry
3
6
  } from "./chunk-GL3ZDHKI.mjs";
@@ -17,13 +20,15 @@ import {
17
20
  normalizeStoreKeys,
18
21
  pickStoreState,
19
22
  resolveFarmLink
20
- } from "./chunk-2UYYXSUS.mjs";
23
+ } from "./chunk-N5NRXLCX.mjs";
21
24
  import {
22
- isFarmBlockedNavigationURL,
23
25
  isFarmLocaleChangeHref,
24
- rememberFarmLinkLocale,
26
+ rememberFarmLinkLocale
27
+ } from "./chunk-GGD57DJA.mjs";
28
+ import {
29
+ isFarmBlockedNavigationURL,
25
30
  resolveFarmNavigationURL
26
- } from "./chunk-FLMALEY2.mjs";
31
+ } from "./chunk-JIGWHFA5.mjs";
27
32
  import {
28
33
  getFarmClientDataCache
29
34
  } from "./chunk-C64XOPBZ.mjs";
@@ -1115,10 +1120,12 @@ function LinkInner({
1115
1120
  if (event.defaultPrevented) return;
1116
1121
  if (isExternal) return;
1117
1122
  if (event.currentTarget.hasAttribute("download")) return;
1118
- if (target && target !== "_self") return;
1123
+ if (!targetsCurrentContext(event.currentTarget)) return;
1119
1124
  if (isModifierEvent(event)) return;
1120
1125
  if (event.button !== 0) return;
1121
1126
  if (typeof window !== "undefined") {
1127
+ if (!event.currentTarget.target && window.__FARM_RSC_HYDRATED)
1128
+ return;
1122
1129
  event.preventDefault();
1123
1130
  if (isFarmLocaleChangeHref(localizedHref)) {
1124
1131
  rememberFarmLinkLocale(event.currentTarget);
@@ -1140,7 +1147,6 @@ function LinkInner({
1140
1147
  replace,
1141
1148
  scroll,
1142
1149
  viewTransition,
1143
- target,
1144
1150
  isExternal,
1145
1151
  isScriptHref,
1146
1152
  onClick
@@ -4,11 +4,14 @@ import {
4
4
  } from "./chunk-RSEAX5MW.mjs";
5
5
  import {
6
6
  _hydrateFarmI18n,
7
+ isFarmLocaleChangeHref
8
+ } from "./chunk-GGD57DJA.mjs";
9
+ import {
7
10
  isFarmBlockedNavigationURL,
8
11
  isFarmExternalNavigationURL,
9
- isFarmLocaleChangeHref,
12
+ isFarmSameDocumentFragment,
10
13
  resolveFarmNavigationURL
11
- } from "./chunk-FLMALEY2.mjs";
14
+ } from "./chunk-JIGWHFA5.mjs";
12
15
  import {
13
16
  createClientCancellation
14
17
  } from "./chunk-H227LYHT.mjs";
@@ -468,6 +471,7 @@ var SPARouter = class {
468
471
  if (isFarmLocaleChangeHref(href)) return;
469
472
  const url = resolveFarmNavigationURL(href, window.location.href);
470
473
  if (isFarmExternalNavigationURL(url, window.location.origin)) return;
474
+ if (isFarmSameDocumentFragment(url.href, window.location.href)) return;
471
475
  if (this.options.shouldUseDocumentNavigation(url.pathname)) return;
472
476
  const fullPath = url.pathname + url.search;
473
477
  const interceptFrom = window.location.pathname + window.location.search;
@@ -0,0 +1,18 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }// src/client/link-navigation.ts
2
+ function targetsCurrentContext(anchor) {
3
+ const target = anchor.target || _optionalChain([anchor, 'access', _ => _.ownerDocument, 'access', _2 => _2.querySelector, 'call', _3 => _3("base[target]"), 'optionalAccess', _4 => _4.target]);
4
+ return !target || target === "_self";
5
+ }
6
+ function readFarmLinkNavigateOptions(anchor) {
7
+ const viewTransition = anchor.getAttribute("data-view-transition");
8
+ return {
9
+ replace: anchor.hasAttribute("data-replace"),
10
+ scroll: !anchor.hasAttribute("data-no-scroll"),
11
+ viewTransition: viewTransition === "auto" ? "auto" : viewTransition === "true"
12
+ };
13
+ }
14
+
15
+
16
+
17
+
18
+ exports.targetsCurrentContext = targetsCurrentContext; exports.readFarmLinkNavigateOptions = readFarmLinkNavigateOptions;
@@ -0,0 +1,17 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }// src/api/route-files.ts
2
+ function hasPolyroutePlugin(plugins) {
3
+ return _optionalChain([plugins, 'optionalAccess', _ => _.some, 'call', _2 => _2((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
+
14
+
15
+
16
+
17
+ exports.hasPolyroutePlugin = hasPolyroutePlugin; exports.isPolyrouteRouteFileName = isPolyrouteRouteFileName; exports.isFarmAPIRouteFileName = isFarmAPIRouteFileName;
@@ -5,8 +5,9 @@ import {
5
5
  findProgrammaticRouteFilesInDir
6
6
  } from "./chunk-URBP6DLH.mjs";
7
7
  import {
8
+ hasPolyroutePlugin,
8
9
  isFarmAPIRouteFileName
9
- } from "./chunk-YX6AFPXC.mjs";
10
+ } from "./chunk-GTHBWZUK.mjs";
10
11
  import {
11
12
  _runWithFarmI18nRequest
12
13
  } from "./chunk-O7JEFGUV.mjs";
@@ -137,7 +138,7 @@ var APIRouteManager = class _APIRouteManager {
137
138
  /**
138
139
  * Recursively find all route.ts files
139
140
  */
140
- findRouteFiles(dir) {
141
+ findRouteFiles(dir, polyroute = hasPolyroutePlugin(this.viteServer?.config?.plugins)) {
141
142
  const files = [];
142
143
  if (!fs.existsSync(dir)) {
143
144
  return files;
@@ -146,8 +147,8 @@ var APIRouteManager = class _APIRouteManager {
146
147
  for (const entry of entries) {
147
148
  const fullPath = path.join(dir, entry.name);
148
149
  if (entry.isDirectory()) {
149
- files.push(...this.findRouteFiles(fullPath));
150
- } else if (isFarmAPIRouteFileName(entry.name)) {
150
+ files.push(...this.findRouteFiles(fullPath, polyroute));
151
+ } else if (isFarmAPIRouteFileName(entry.name, polyroute)) {
151
152
  files.push(fullPath);
152
153
  }
153
154
  }
@@ -1,16 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJB4BHRFKcjs = require('./chunk-JB4BHRFK.cjs');
3
+ var _chunkWP77JDKIcjs = require('./chunk-WP77JDKI.cjs');
4
4
 
5
5
 
6
- var _chunkUGD53SNOcjs = require('./chunk-UGD53SNO.cjs');
6
+ var _chunkKQ6TYQU7cjs = require('./chunk-KQ6TYQU7.cjs');
7
7
 
8
8
 
9
9
  var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
10
10
 
11
11
  // src/navigation.ts
12
12
  function useRouter2() {
13
- const router = _chunkJB4BHRFKcjs.useRouter.call(void 0, );
13
+ const router = _chunkWP77JDKIcjs.useRouter.call(void 0, );
14
14
  return {
15
15
  push: router.push,
16
16
  replace: router.replace,
@@ -18,19 +18,19 @@ function useRouter2() {
18
18
  forward: router.forward,
19
19
  refresh() {
20
20
  if (typeof window === "undefined") return Promise.resolve();
21
- return _chunkUGD53SNOcjs.getRouter.call(void 0, ).refresh();
21
+ return _chunkKQ6TYQU7cjs.getRouter.call(void 0, ).refresh();
22
22
  },
23
23
  prefetch(href) {
24
24
  if (typeof window === "undefined") return Promise.resolve();
25
- return _chunkUGD53SNOcjs.getRouter.call(void 0, ).prefetch(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, href));
25
+ return _chunkKQ6TYQU7cjs.getRouter.call(void 0, ).prefetch(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, href));
26
26
  }
27
27
  };
28
28
  }
29
29
  function usePathname() {
30
- return _chunkJB4BHRFKcjs.useRouter.call(void 0, ).pathname;
30
+ return _chunkWP77JDKIcjs.useRouter.call(void 0, ).pathname;
31
31
  }
32
32
  function useSearchParams() {
33
- return _chunkJB4BHRFKcjs.useRouter.call(void 0, ).searchParams;
33
+ return _chunkWP77JDKIcjs.useRouter.call(void 0, ).searchParams;
34
34
  }
35
35
 
36
36