@farm.js/core 0.1.20 → 0.1.22

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 (49) hide show
  1. package/dist/{app-D_6nTit-.d.mts → app-0e-oTC_R.d.mts} +7 -0
  2. package/dist/{app-DAyPE-gr.d.ts → app-B7qKw8Ny.d.ts} +7 -0
  3. package/dist/{chunk-A7T6JZNI.cjs → chunk-2HCEC2YO.cjs} +1 -1
  4. package/dist/{chunk-K6MG3SEG.mjs → chunk-AAWTJW2G.mjs} +215 -53
  5. package/dist/{chunk-OLYK7EAK.mjs → chunk-DAATZTKJ.mjs} +14 -0
  6. package/dist/{chunk-GQFSCBKJ.cjs → chunk-EXUMQVY3.cjs} +187 -208
  7. package/dist/{chunk-NRS46D4L.mjs → chunk-GKT4ONKN.mjs} +1 -1
  8. package/dist/{chunk-YP5JZ4LF.cjs → chunk-GXXONIAR.cjs} +3 -3
  9. package/dist/{chunk-W7MZXRXM.mjs → chunk-ONMW3EVV.mjs} +1 -1
  10. package/dist/{chunk-PZX6I4JW.cjs → chunk-P5HSJCXI.cjs} +441 -279
  11. package/dist/{chunk-5V37LKBG.mjs → chunk-PC33YKTC.mjs} +53 -74
  12. package/dist/{chunk-TFAXUHWX.cjs → chunk-PSV6XKPO.cjs} +15 -1
  13. package/dist/{chunk-ZE6ONQ5R.cjs → chunk-Q3PX2TGL.cjs} +2 -2
  14. package/dist/{chunk-XFFQSD2F.cjs → chunk-SO7CRMP6.cjs} +2 -2
  15. package/dist/{chunk-RMIJFZU3.mjs → chunk-SPSQFO3Z.mjs} +1 -1
  16. package/dist/{chunk-F7E2AZKQ.mjs → chunk-X2ZUD4GI.mjs} +1 -1
  17. package/dist/{devtools-R6MDDAZK.cjs → devtools-6DQHO7EK.cjs} +3 -3
  18. package/dist/{devtools-MTB5SA2B.mjs → devtools-EZ5ORGAK.mjs} +2 -2
  19. package/dist/docs.cjs +4 -4
  20. package/dist/docs.mjs +3 -3
  21. package/dist/index.cjs +8 -8
  22. package/dist/index.d.mts +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.mjs +7 -7
  25. package/dist/internal/build-runtime.cjs +8 -8
  26. package/dist/internal/build-runtime.mjs +7 -7
  27. package/dist/internal/cli-runtime.cjs +4 -4
  28. package/dist/internal/cli-runtime.mjs +3 -3
  29. package/dist/internal/client-error-overlay.cjs +4 -4
  30. package/dist/internal/client-error-overlay.mjs +1 -1
  31. package/dist/internal/config-runtime.cjs +3 -3
  32. package/dist/internal/config-runtime.mjs +2 -2
  33. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  34. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  35. package/dist/plugin.cjs +5 -5
  36. package/dist/plugin.mjs +4 -4
  37. package/dist/renderer.cjs +4 -2
  38. package/dist/renderer.d.mts +9 -1
  39. package/dist/renderer.d.ts +9 -1
  40. package/dist/renderer.mjs +3 -1
  41. package/dist/server.cjs +22 -28
  42. package/dist/server.d.mts +1 -1
  43. package/dist/server.d.ts +1 -1
  44. package/dist/server.mjs +7 -13
  45. package/dist/version.cjs +2 -2
  46. package/dist/version.mjs +1 -1
  47. package/dist/vite.cjs +5 -5
  48. package/dist/vite.mjs +4 -4
  49. package/package.json +7 -3
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkXFFQSD2Fcjs = require('./chunk-XFFQSD2F.cjs');
9
+ var _chunkSO7CRMP6cjs = require('./chunk-SO7CRMP6.cjs');
10
10
 
11
11
 
12
12
 
@@ -87,7 +87,8 @@ var _chunkY4YMF2NQcjs = require('./chunk-Y4YMF2NQ.cjs');
87
87
 
88
88
 
89
89
 
90
- var _chunkTFAXUHWXcjs = require('./chunk-TFAXUHWX.cjs');
90
+
91
+ var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
91
92
 
92
93
 
93
94
 
@@ -264,7 +265,7 @@ var _chunkQNPEUFHQcjs = require('./chunk-QNPEUFHQ.cjs');
264
265
  var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
265
266
 
266
267
 
267
- var _chunkA7T6JZNIcjs = require('./chunk-A7T6JZNI.cjs');
268
+ var _chunk2HCEC2YOcjs = require('./chunk-2HCEC2YO.cjs');
268
269
 
269
270
 
270
271
 
@@ -347,7 +348,7 @@ var _chunkNO3WWW3Ncjs = require('./chunk-NO3WWW3N.cjs');
347
348
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
348
349
 
349
350
  // src/routing/route-manager.ts
350
- var _path = require('path'); var path9 = _interopRequireWildcard(_path); var path4 = _interopRequireWildcard(_path); var path8 = _interopRequireWildcard(_path); var path16 = _interopRequireWildcard(_path); var path13 = _interopRequireWildcard(_path);
351
+ var _path = require('path'); var path9 = _interopRequireWildcard(_path); var path4 = _interopRequireWildcard(_path); var path8 = _interopRequireWildcard(_path); var path17 = _interopRequireWildcard(_path); var path14 = _interopRequireWildcard(_path);
351
352
 
352
353
  // src/utils/client-component.ts
353
354
  var _fs = require('fs'); var fs5 = _interopRequireWildcard(_fs); var fs2 = _interopRequireWildcard(_fs); var fs4 = _interopRequireWildcard(_fs); var fs9 = _interopRequireWildcard(_fs); var fs8 = _interopRequireWildcard(_fs);
@@ -400,7 +401,7 @@ function resolveModuleSourcePath(modulePath, root) {
400
401
  }
401
402
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveModuleSourcePath, "resolveModuleSourcePath");
402
403
  function getFarmClientHydrationPlanOptions(renderer, hasUnsupportedIntegrationProvider) {
403
- return { asyncOwnerIslands: _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, renderer) && !hasUnsupportedIntegrationProvider };
404
+ return { asyncOwnerIslands: _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && !hasUnsupportedIntegrationProvider };
404
405
  }
405
406
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmClientHydrationPlanOptions, "getFarmClientHydrationPlanOptions");
406
407
  function describeSuppressedAsyncHydration(subject, reason) {
@@ -1439,9 +1440,22 @@ function resolveImportedModule(importerPath, specifier, root) {
1439
1440
  }
1440
1441
  const aliased = resolveProjectAliasSourcePath(specifier, root);
1441
1442
  if (aliased) return { path: aliased, local: true };
1442
- return { path: resolvePackageModuleSourcePath(importerPath, specifier, root), local: false };
1443
+ const packagePath = resolvePackageModuleSourcePath(importerPath, specifier, root);
1444
+ if (!packagePath) warnUnresolvedAliasImport(importerPath, specifier, root);
1445
+ return { path: packagePath, local: false };
1443
1446
  }
1444
1447
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveImportedModule, "resolveImportedModule");
1448
+ var warnedUnresolvedAliasImports = /* @__PURE__ */ new Set();
1449
+ var ALIAS_IMPORT = /^(?:@\/|~\/|#)/;
1450
+ function warnUnresolvedAliasImport(importerPath, specifier, root) {
1451
+ if (!ALIAS_IMPORT.test(specifier) || warnedUnresolvedAliasImports.has(specifier)) return;
1452
+ warnedUnresolvedAliasImports.add(specifier);
1453
+ const importer = root ? path9.default.relative(root, importerPath) : importerPath;
1454
+ _chunk5QIKR7RRcjs.logger.warn(
1455
+ `Could not resolve "${specifier}" (imported by ${importer}) while checking which pages need client JavaScript. If it holds client components, they will not hydrate. Map the alias in tsconfig.json "paths" or package.json "imports".`
1456
+ );
1457
+ }
1458
+ _chunkS3JO3N4Hcjs.__name.call(void 0, warnUnresolvedAliasImport, "warnUnresolvedAliasImport");
1445
1459
  var projectImportAliasCache = /* @__PURE__ */ new Map();
1446
1460
  var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
1447
1461
  function resolveProjectAliasSourcePath(specifier, root) {
@@ -2471,7 +2485,7 @@ var _RouteManager = class _RouteManager {
2471
2485
  }
2472
2486
  async discoverFileRoutes(source) {
2473
2487
  const appDir = _chunk5QIKR7RRcjs.resolveAppPath.call(void 0, source.root, source.srcDir, "app");
2474
- const componentExtensions = _chunkTFAXUHWXcjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer).map(
2488
+ const componentExtensions = _chunkPSV6XKPOcjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer).map(
2475
2489
  (extension) => extension.slice(1)
2476
2490
  );
2477
2491
  const componentGlob = componentExtensions.join(",");
@@ -2489,7 +2503,7 @@ var _RouteManager = class _RouteManager {
2489
2503
  appDir
2490
2504
  );
2491
2505
  const canonicalPageGroups = /* @__PURE__ */ new Map();
2492
- for (const file of pageFiles.filter((candidate) => _chunkXFFQSD2Fcjs.parseRouteSlotFile.call(void 0, candidate) === null)) {
2506
+ for (const file of pageFiles.filter((candidate) => _chunkSO7CRMP6cjs.parseRouteSlotFile.call(void 0, candidate) === null)) {
2493
2507
  const route = _chunk5QIKR7RRcjs.parseRoutePath.call(void 0, file);
2494
2508
  const pattern = this.createRoutePattern(route);
2495
2509
  const group = canonicalPageGroups.get(pattern);
@@ -2562,7 +2576,7 @@ var _RouteManager = class _RouteManager {
2562
2576
  }
2563
2577
  }
2564
2578
  for (const file of [...pageFiles, ...slotDefaultFiles]) {
2565
- const slot = _chunkXFFQSD2Fcjs.parseRouteSlotFile.call(void 0, file);
2579
+ const slot = _chunkSO7CRMP6cjs.parseRouteSlotFile.call(void 0, file);
2566
2580
  if (!slot) continue;
2567
2581
  const modulePath = path9.default.join(appDir, file);
2568
2582
  const pattern = this.createRoutePattern(slot.route);
@@ -2584,7 +2598,7 @@ var _RouteManager = class _RouteManager {
2584
2598
  ownerPattern,
2585
2599
  interception: slot.interception,
2586
2600
  fallback: slot.fallback,
2587
- containerId: _chunkXFFQSD2Fcjs.createRouteSlotContainerId.call(void 0, slot.name, ownerPattern)
2601
+ containerId: _chunkSO7CRMP6cjs.createRouteSlotContainerId.call(void 0, slot.name, ownerPattern)
2588
2602
  });
2589
2603
  }
2590
2604
  for (const file of metadataImageFiles) {
@@ -2822,7 +2836,7 @@ var _RouteManager = class _RouteManager {
2822
2836
  pattern: entry.pattern
2823
2837
  }));
2824
2838
  const i18n = this.getI18nConfig();
2825
- const result = await _chunkXFFQSD2Fcjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
2839
+ const result = await _chunkSO7CRMP6cjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
2826
2840
  suggestStaticRendering: shouldSuggestStaticRenderingForI18n(i18n)
2827
2841
  });
2828
2842
  if (!i18n) {
@@ -2867,7 +2881,7 @@ var _RouteManager = class _RouteManager {
2867
2881
  async isRouteSSG(modulePath) {
2868
2882
  try {
2869
2883
  const mod = await this.loadRouteModule(modulePath);
2870
- const rendering = await _chunkXFFQSD2Fcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2884
+ const rendering = await _chunkSO7CRMP6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2871
2885
  return rendering.ssg;
2872
2886
  } catch (e10) {
2873
2887
  return false;
@@ -2879,7 +2893,7 @@ var _RouteManager = class _RouteManager {
2879
2893
  async hasRouteISR(modulePath) {
2880
2894
  try {
2881
2895
  const mod = await this.loadRouteModule(modulePath);
2882
- const rendering = await _chunkXFFQSD2Fcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2896
+ const rendering = await _chunkSO7CRMP6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2883
2897
  return rendering.ssg && typeof rendering.revalidate === "number" && rendering.revalidate > 0;
2884
2898
  } catch (e11) {
2885
2899
  return false;
@@ -2891,7 +2905,7 @@ var _RouteManager = class _RouteManager {
2891
2905
  async getRouteRevalidateInterval(modulePath) {
2892
2906
  try {
2893
2907
  const mod = await this.loadRouteModule(modulePath);
2894
- const rendering = await _chunkXFFQSD2Fcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2908
+ const rendering = await _chunkSO7CRMP6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2895
2909
  return rendering.revalidate;
2896
2910
  } catch (e12) {
2897
2911
  return void 0;
@@ -3130,7 +3144,7 @@ var _stream = require('stream');
3130
3144
 
3131
3145
 
3132
3146
  function resolveFarmNotFoundComponentPath(config, appDirs) {
3133
- const extensions = _chunkTFAXUHWXcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
3147
+ const extensions = _chunkPSV6XKPOcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
3134
3148
  const configuredPath = _optionalChain([config, 'access', _137 => _137.notFound, 'optionalAccess', _138 => _138.component, 'optionalAccess', _139 => _139.trim, 'call', _140 => _140()]);
3135
3149
  if (configuredPath) {
3136
3150
  const componentPath = path9.default.isAbsolute(configuredPath) ? path9.default.normalize(configuredPath) : path9.default.resolve(config.root, configuredPath);
@@ -4810,8 +4824,8 @@ var _ServerRenderer = class _ServerRenderer {
4810
4824
  if (_optionalChain([this, 'access', _148 => _148.config, 'access', _149 => _149.notFound, 'optionalAccess', _150 => _150.component, 'optionalAccess', _151 => _151.trim, 'call', _152 => _152()])) {
4811
4825
  resolveFarmNotFoundComponentPath(this.config, _chunkY4YMF2NQcjs.getFarmAppDirectories.call(void 0, this.config));
4812
4826
  }
4813
- const loaded = _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : this.viteServer ? await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, this.viteServer, this.config.renderer.server) : await import(_url.pathToFileURL.call(void 0,
4814
- _chunkTFAXUHWXcjs.resolveFarmRendererModule.call(void 0,
4827
+ const loaded = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : this.viteServer ? await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, this.viteServer, this.config.renderer.server) : await import(_url.pathToFileURL.call(void 0,
4828
+ _chunkPSV6XKPOcjs.resolveFarmRendererModule.call(void 0,
4815
4829
  this.config.root || process.cwd(),
4816
4830
  this.config.renderer.server
4817
4831
  )
@@ -4825,7 +4839,7 @@ var _ServerRenderer = class _ServerRenderer {
4825
4839
  );
4826
4840
  }
4827
4841
  }
4828
- _chunkTFAXUHWXcjs.assertFarmRendererStreamingRuntime.call(void 0,
4842
+ _chunkPSV6XKPOcjs.assertFarmRendererStreamingRuntime.call(void 0,
4829
4843
  this.config.renderer.name,
4830
4844
  this.config.renderer,
4831
4845
  runtime,
@@ -4833,6 +4847,29 @@ var _ServerRenderer = class _ServerRenderer {
4833
4847
  );
4834
4848
  this.rendererRuntime = runtime;
4835
4849
  _optionalChain([this, 'access', _153 => _153.routeManager, 'access', _154 => _154.setRendererRuntime, 'optionalCall', _155 => _155(this.rendererRuntime)]);
4850
+ await this.applyRendererAppSetup();
4851
+ }
4852
+ /**
4853
+ * Pass the app's renderer setup module (`renderer.appSetup`) to the renderer. In development
4854
+ * the module runner returns the cached module until the file changes, so an edit is
4855
+ * re-applied on the next request without restarting.
4856
+ */
4857
+ async applyRendererAppSetup() {
4858
+ const appSetupPath = _chunkPSV6XKPOcjs.resolveFarmRendererAppSetup.call(void 0,
4859
+ this.config.root || process.cwd(),
4860
+ this.config.renderer
4861
+ );
4862
+ if (!appSetupPath) return;
4863
+ const configureApp = this.rendererRuntime.configureApp;
4864
+ if (typeof configureApp !== "function") {
4865
+ throw new Error(
4866
+ `Renderer \`${this.config.renderer.name}\` does not support \`appSetup\`: its server module must export configureApp().`
4867
+ );
4868
+ }
4869
+ const setupModule = this.viteServer ? await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, this.viteServer, appSetupPath) : await import(_url.pathToFileURL.call(void 0, appSetupPath).href);
4870
+ if (setupModule === this.appliedAppSetupModule) return;
4871
+ this.appliedAppSetupModule = setupModule;
4872
+ configureApp(setupModule.default);
4836
4873
  }
4837
4874
  createPageBoundary(pageElement, options) {
4838
4875
  return this.rendererRuntime.createElement(
@@ -4897,7 +4934,7 @@ var _ServerRenderer = class _ServerRenderer {
4897
4934
  return this.rendererRuntime.wrapClientGraph(element);
4898
4935
  }
4899
4936
  async renderElementToCompleteHTML(element) {
4900
- const streaming = _chunkTFAXUHWXcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0, this.config.renderer, "node");
4937
+ const streaming = _chunkPSV6XKPOcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0, this.config.renderer, "node");
4901
4938
  const renderToPipeableStream = streaming.node ? this.rendererRuntime.renderToPipeableStream : void 0;
4902
4939
  if (renderToPipeableStream) {
4903
4940
  return await new Promise((resolve5, reject) => {
@@ -4927,7 +4964,7 @@ var _ServerRenderer = class _ServerRenderer {
4927
4964
  }
4928
4965
  if (streaming.web && this.rendererRuntime.renderToReadableStream) {
4929
4966
  const stream = await this.rendererRuntime.renderToReadableStream(element);
4930
- return await _chunkTFAXUHWXcjs.readFarmRendererWebStream.call(void 0, stream);
4967
+ return await _chunkPSV6XKPOcjs.readFarmRendererWebStream.call(void 0, stream);
4931
4968
  }
4932
4969
  return await this.rendererRuntime.renderToString(element);
4933
4970
  }
@@ -4949,6 +4986,7 @@ var _ServerRenderer = class _ServerRenderer {
4949
4986
  */
4950
4987
  async renderNavigationFragment(input) {
4951
4988
  await this.initialize();
4989
+ if (this.viteServer) await this.applyRendererAppSetup();
4952
4990
  _chunkI57LW5VZcjs.setFarmBasePath.call(void 0, this.config.basePath);
4953
4991
  _chunkOYEUREB6cjs.setFarmTrailingSlashPreference.call(void 0, this.config.trailingSlash);
4954
4992
  let element = this.rendererRuntime.createElement(input.PageComponent, input.pageProps);
@@ -5043,7 +5081,7 @@ var _ServerRenderer = class _ServerRenderer {
5043
5081
  * Check if a path should be served from SSG cache
5044
5082
  */
5045
5083
  async shouldServeSSG(pathname) {
5046
- const ssgPage = _chunkXFFQSD2Fcjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
5084
+ const ssgPage = _chunkSO7CRMP6cjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
5047
5085
  if (!ssgPage) return null;
5048
5086
  const cached = await this.getCachedSSGPage(pathname);
5049
5087
  if (cached && await this.dataCache.isStaleAsync(cached)) {
@@ -5274,6 +5312,7 @@ var _ServerRenderer = class _ServerRenderer {
5274
5312
  }
5275
5313
  async renderPage(req, res) {
5276
5314
  await this.initialize();
5315
+ if (this.viteServer) await this.applyRendererAppSetup();
5277
5316
  _chunkI57LW5VZcjs.setFarmBasePath.call(void 0, this.config.basePath);
5278
5317
  _chunkOYEUREB6cjs.setFarmTrailingSlashPreference.call(void 0, this.config.trailingSlash);
5279
5318
  const cspNonce = _chunkISTFC3MZcjs.createFarmCspNonce.call(void 0, this.security);
@@ -5458,7 +5497,7 @@ var _ServerRenderer = class _ServerRenderer {
5458
5497
  throw error;
5459
5498
  }
5460
5499
  }
5461
- const renderingConfig = await _chunkXFFQSD2Fcjs.resolveRouteRenderingConfigFromFile.call(void 0,
5500
+ const renderingConfig = await _chunkSO7CRMP6cjs.resolveRouteRenderingConfigFromFile.call(void 0,
5462
5501
  routeModule,
5463
5502
  route.modulePath,
5464
5503
  { experimentalPPR: _optionalChain([this, 'access', _176 => _176.config, 'access', _177 => _177.experimental, 'optionalAccess', _178 => _178.ppr]) === true }
@@ -5903,13 +5942,13 @@ var _ServerRenderer = class _ServerRenderer {
5903
5942
  for (let i = providers.length - 1; i >= 0; i--) {
5904
5943
  const provider = providers[i];
5905
5944
  if (provider.component || provider.type === "clerk") {
5906
- const rendererCapabilities = _chunkTFAXUHWXcjs.getFarmRendererCapabilities.call(void 0, this.config.renderer);
5945
+ const rendererCapabilities = _chunkPSV6XKPOcjs.getFarmRendererCapabilities.call(void 0, this.config.renderer);
5907
5946
  if (!rendererCapabilities.functionComponents) {
5908
5947
  throw new Error(
5909
5948
  `Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _191 => _191.config, 'access', _192 => _192.renderer, 'optionalAccess', _193 => _193.name]), () => ( "the configured renderer"))}\` cannot.`
5910
5949
  );
5911
5950
  }
5912
- if (provider.type === "clerk" && !_chunkTFAXUHWXcjs.isReactRenderer.call(void 0, this.config.renderer)) {
5951
+ if (provider.type === "clerk" && !_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, this.config.renderer)) {
5913
5952
  throw new Error(
5914
5953
  `Integration provider \`${provider.name}\` uses Clerk's React components, which require the React renderer.`
5915
5954
  );
@@ -5945,7 +5984,7 @@ var _ServerRenderer = class _ServerRenderer {
5945
5984
  }
5946
5985
  if (provider.type !== "clerk" && typeof this.rendererRuntime.markFunctionComponent === "function" && !isRendererCompiledComponent(
5947
5986
  _nullishCoalesce(providerSourceModule, () => ( "")),
5948
- _chunkTFAXUHWXcjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _194 => _194.config, 'access', _195 => _195.renderer, 'optionalAccess', _196 => _196.componentExtensions]))
5987
+ _chunkPSV6XKPOcjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _194 => _194.config, 'access', _195 => _195.renderer, 'optionalAccess', _196 => _196.componentExtensions]))
5949
5988
  )) {
5950
5989
  ProviderComponent = this.rendererRuntime.markFunctionComponent(ProviderComponent);
5951
5990
  }
@@ -7000,7 +7039,7 @@ window.__FARM_I18N__ = ${_chunkUJ2C4ICScjs.getFarmI18nClientSnapshot.call(void 0
7000
7039
  return;
7001
7040
  }
7002
7041
  const appDir = path9.join(this.config.root, this.config.srcDir, "app");
7003
- const notFoundExtensions = _chunkTFAXUHWXcjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
7042
+ const notFoundExtensions = _chunkPSV6XKPOcjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
7004
7043
  let layoutModule = null;
7005
7044
  try {
7006
7045
  for (const ext of notFoundExtensions) {
@@ -7069,7 +7108,7 @@ window.__FARM_I18N__ = ${_chunkUJ2C4ICScjs.getFarmI18nClientSnapshot.call(void 0
7069
7108
  stack: _optionalChain([diagnostics, 'optionalAccess', _266 => _266.stack]),
7070
7109
  sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _267 => _267.sourceFrame]),
7071
7110
  development: isDev,
7072
- farmVersion: _chunkA7T6JZNIcjs.FARM_VERSION,
7111
+ farmVersion: _chunk2HCEC2YOcjs.FARM_VERSION,
7073
7112
  nodeVersion: process.version,
7074
7113
  mode: isDev ? "development" : "production"
7075
7114
  });
@@ -7262,7 +7301,7 @@ var _FarmApp = class _FarmApp {
7262
7301
  outDir: config.outDir || "dist",
7263
7302
  basePath,
7264
7303
  trailingSlash: _nullishCoalesce(config.trailingSlash, () => ( false)),
7265
- renderer: _chunkTFAXUHWXcjs.resolveFarmRenderer.call(void 0, config.renderer),
7304
+ renderer: _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, config.renderer),
7266
7305
  preset: _nullishCoalesce(config.preset, () => ( "node-server")),
7267
7306
  deploy: config.deploy || {},
7268
7307
  storage: config.storage || {},
@@ -7337,7 +7376,7 @@ var _FarmApp = class _FarmApp {
7337
7376
  `App directory not found at ${appDir}. Please create a src/app directory or extend a Farm layer containing routes.`
7338
7377
  );
7339
7378
  }
7340
- const componentExtensions = _chunkTFAXUHWXcjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
7379
+ const componentExtensions = _chunkPSV6XKPOcjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
7341
7380
  const rootLayoutPaths = appDirs.flatMap(
7342
7381
  (appDir) => componentExtensions.map((extension) => path9.default.join(appDir, `layout${extension}`))
7343
7382
  );
@@ -7377,6 +7416,115 @@ function createFarmApp(config, viteServer) {
7377
7416
  }
7378
7417
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmApp, "createFarmApp");
7379
7418
 
7419
+ // src/build/tailwind.ts
7420
+
7421
+
7422
+ // src/optional-peer.ts
7423
+ function isMissingPackageError(error, packageName) {
7424
+ if (!error || typeof error !== "object") return false;
7425
+ const { code, message } = error;
7426
+ if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND") return false;
7427
+ if (typeof message !== "string") return false;
7428
+ return message.includes(`'${packageName}'`) || message.includes(`"${packageName}"`);
7429
+ }
7430
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isMissingPackageError, "isMissingPackageError");
7431
+ function formatOptionalPeerInstallHint(packageName, purpose, options = {}) {
7432
+ return `Install "${packageName}" to ${purpose}: pnpm add ${options.dev ? "-D " : ""}${packageName}`;
7433
+ }
7434
+ _chunkS3JO3N4Hcjs.__name.call(void 0, formatOptionalPeerInstallHint, "formatOptionalPeerInstallHint");
7435
+
7436
+ // src/build/vite-plugin-compat.ts
7437
+ function adaptTailwindVitePlugin(pluginOption, builder) {
7438
+ if (builder !== "rolldown") return pluginOption;
7439
+ return adaptPluginOption(pluginOption);
7440
+ }
7441
+ _chunkS3JO3N4Hcjs.__name.call(void 0, adaptTailwindVitePlugin, "adaptTailwindVitePlugin");
7442
+ function adaptPluginOption(pluginOption) {
7443
+ if (Array.isArray(pluginOption)) return pluginOption.map(adaptPluginOption);
7444
+ if (!pluginOption || typeof pluginOption !== "object") return pluginOption;
7445
+ const plugin = pluginOption;
7446
+ if (!_optionalChain([plugin, 'access', _293 => _293.name, 'optionalAccess', _294 => _294.startsWith, 'call', _295 => _295("@tailwindcss/vite:generate:")])) return pluginOption;
7447
+ if (isVitePluginHook(plugin.transform)) {
7448
+ return {
7449
+ ...plugin,
7450
+ transform: withVite5TransformContext(plugin.transform)
7451
+ };
7452
+ }
7453
+ if (plugin.transform && typeof plugin.transform === "object" && "handler" in plugin.transform && isVitePluginHook(plugin.transform.handler)) {
7454
+ return {
7455
+ ...plugin,
7456
+ transform: {
7457
+ ...plugin.transform,
7458
+ handler: withVite5TransformContext(plugin.transform.handler)
7459
+ }
7460
+ };
7461
+ }
7462
+ return pluginOption;
7463
+ }
7464
+ _chunkS3JO3N4Hcjs.__name.call(void 0, adaptPluginOption, "adaptPluginOption");
7465
+ function isVitePluginHook(value) {
7466
+ return typeof value === "function";
7467
+ }
7468
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isVitePluginHook, "isVitePluginHook");
7469
+ function withVite5TransformContext(handler) {
7470
+ return function(...args) {
7471
+ const context = new Proxy(this, {
7472
+ get(target, property, receiver) {
7473
+ if (property === "environment") return void 0;
7474
+ return Reflect.get(target, property, receiver);
7475
+ }
7476
+ });
7477
+ return handler.apply(context, args);
7478
+ };
7479
+ }
7480
+ _chunkS3JO3N4Hcjs.__name.call(void 0, withVite5TransformContext, "withVite5TransformContext");
7481
+
7482
+ // src/build/tailwind.ts
7483
+ var TAILWIND_CSS_IMPORT = /@import\s+["']tailwindcss["']/;
7484
+ var TAILWIND_VITE_INSTALL_HINT = formatOptionalPeerInstallHint(
7485
+ "@tailwindcss/vite",
7486
+ "enable built-in Tailwind CSS support",
7487
+ { dev: true }
7488
+ );
7489
+ var warnedMissingTailwind = false;
7490
+ async function loadTailwindVitePlugin(options = {}, importTailwind = () => import("@tailwindcss/vite")) {
7491
+ try {
7492
+ const tailwindVite = (await importTailwind()).default;
7493
+ const plugin = options.builder ? adaptTailwindVitePlugin(tailwindVite(), options.builder) : tailwindVite();
7494
+ if (options.announce) _chunk5QIKR7RRcjs.logger.info("\u{1F4E6} Enabled built-in Tailwind support (@tailwindcss/vite)");
7495
+ return plugin;
7496
+ } catch (error) {
7497
+ if (isMissingPackageError(error, "@tailwindcss/vite")) return createMissingTailwindPlugin();
7498
+ _chunk5QIKR7RRcjs.logger.warn(
7499
+ `Tailwind plugin auto-enable failed${options.label ? ` ${options.label}` : ""}; continuing without it: ${error.message}`
7500
+ );
7501
+ return void 0;
7502
+ }
7503
+ }
7504
+ _chunkS3JO3N4Hcjs.__name.call(void 0, loadTailwindVitePlugin, "loadTailwindVitePlugin");
7505
+ function createMissingTailwindPlugin() {
7506
+ let root = process.cwd();
7507
+ return {
7508
+ name: "farm:tailwind-missing",
7509
+ enforce: "pre",
7510
+ configResolved(config) {
7511
+ root = config.root;
7512
+ },
7513
+ transform(code, id) {
7514
+ if (warnedMissingTailwind || !/\.css(?:\?.*)?$/.test(id) || !TAILWIND_CSS_IMPORT.test(code)) {
7515
+ return null;
7516
+ }
7517
+ warnedMissingTailwind = true;
7518
+ const file = path9.default.relative(root, id.split("?", 1)[0]).replace(/\\/g, "/");
7519
+ _chunk5QIKR7RRcjs.logger.warn(
7520
+ `${file} imports Tailwind CSS, but @tailwindcss/vite is not installed; continuing without Tailwind. ${TAILWIND_VITE_INSTALL_HINT}`
7521
+ );
7522
+ return null;
7523
+ }
7524
+ };
7525
+ }
7526
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createMissingTailwindPlugin, "createMissingTailwindPlugin");
7527
+
7380
7528
  // src/schema-step-types.ts
7381
7529
  function validateSchemaSteps(owner, schema, steps) {
7382
7530
  if (steps === void 0) return;
@@ -7386,7 +7534,7 @@ function validateSchemaSteps(owner, schema, steps) {
7386
7534
  const models = _chunkJSROZYYOcjs.resolveSchemaModels.call(void 0, owner, schema);
7387
7535
  const ids = /* @__PURE__ */ new Set();
7388
7536
  for (const step of steps) {
7389
- const where = `${owner} migration "${_optionalChain([step, 'optionalAccess', _293 => _293.id])}"`;
7537
+ const where = `${owner} migration "${_optionalChain([step, 'optionalAccess', _296 => _296.id])}"`;
7390
7538
  if (!step || typeof step.id !== "string" || step.id.trim() === "") {
7391
7539
  throw new TypeError(`${owner}: every migration step needs a non-empty \`id\`.`);
7392
7540
  }
@@ -7463,8 +7611,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, validateSchemaSteps, "validateSchemaSteps"
7463
7611
  var _FarmPluginOptionsError = class _FarmPluginOptionsError extends TypeError {
7464
7612
  constructor(issues) {
7465
7613
  const lines = issues.map((issue) => {
7466
- const path17 = formatIssuePath(issue.path);
7467
- return ` - ${path17 ? `${path17}: ` : ""}${issue.message}`;
7614
+ const path18 = formatIssuePath(issue.path);
7615
+ return ` - ${path18 ? `${path18}: ` : ""}${issue.message}`;
7468
7616
  });
7469
7617
  super(`Invalid plugin options:
7470
7618
  ${lines.join("\n")}`);
@@ -7474,9 +7622,9 @@ ${lines.join("\n")}`);
7474
7622
  };
7475
7623
  _chunkS3JO3N4Hcjs.__name.call(void 0, _FarmPluginOptionsError, "FarmPluginOptionsError");
7476
7624
  var FarmPluginOptionsError = _FarmPluginOptionsError;
7477
- function formatIssuePath(path17) {
7478
- if (!_optionalChain([path17, 'optionalAccess', _294 => _294.length])) return "";
7479
- return path17.map((segment) => {
7625
+ function formatIssuePath(path18) {
7626
+ if (!_optionalChain([path18, 'optionalAccess', _297 => _297.length])) return "";
7627
+ return path18.map((segment) => {
7480
7628
  const key = typeof segment === "object" && segment !== null ? segment.key : segment;
7481
7629
  return typeof key === "symbol" ? key.toString() : String(key);
7482
7630
  }).join(".");
@@ -7489,11 +7637,11 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, isPromiseLike, "isPromiseLike");
7489
7637
  function isPluginOptionsSchema(value) {
7490
7638
  if (typeof value !== "object" && typeof value !== "function" || value === null) return false;
7491
7639
  const standard = value["~standard"];
7492
- return typeof _optionalChain([standard, 'optionalAccess', _295 => _295.validate]) === "function";
7640
+ return typeof _optionalChain([standard, 'optionalAccess', _298 => _298.validate]) === "function";
7493
7641
  }
7494
7642
  _chunkS3JO3N4Hcjs.__name.call(void 0, isPluginOptionsSchema, "isPluginOptionsSchema");
7495
7643
  function parsePluginOptions(schema, options) {
7496
- const standard = _optionalChain([schema, 'optionalAccess', _296 => _296["~standard"]]);
7644
+ const standard = _optionalChain([schema, 'optionalAccess', _299 => _299["~standard"]]);
7497
7645
  if (!standard || typeof standard.validate !== "function") {
7498
7646
  throw new TypeError(
7499
7647
  "A plugin's `options` needs a Standard Schema, such as a Zod, Valibot, or ArkType schema."
@@ -7553,9 +7701,9 @@ function normalizeRuntimeEndpointRequestPath(pathname) {
7553
7701
  _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeRuntimeEndpointRequestPath, "normalizeRuntimeEndpointRequestPath");
7554
7702
  function farmPluginMayAffectRuntimePath(plugin, pathname) {
7555
7703
  const runtime = plugin.runtime;
7556
- const endpoints = _optionalChain([runtime, 'optionalAccess', _297 => _297.endpoints]);
7704
+ const endpoints = _optionalChain([runtime, 'optionalAccess', _300 => _300.endpoints]);
7557
7705
  const hasUnscopedRequestHooks = Boolean(
7558
- plugin.init || plugin.ready || plugin.shutdown || _optionalChain([runtime, 'optionalAccess', _298 => _298.context]) || _optionalChain([runtime, 'optionalAccess', _299 => _299.before]) || _optionalChain([runtime, 'optionalAccess', _300 => _300.after]) || _optionalChain([runtime, 'optionalAccess', _301 => _301.error]) || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML || plugin.beforeRequest || plugin.afterResponse
7706
+ plugin.init || plugin.ready || plugin.shutdown || _optionalChain([runtime, 'optionalAccess', _301 => _301.context]) || _optionalChain([runtime, 'optionalAccess', _302 => _302.before]) || _optionalChain([runtime, 'optionalAccess', _303 => _303.after]) || _optionalChain([runtime, 'optionalAccess', _304 => _304.error]) || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML || plugin.beforeRequest || plugin.afterResponse
7559
7707
  );
7560
7708
  if (hasUnscopedRequestHooks) return true;
7561
7709
  if (Array.isArray(endpoints) && endpoints.length > 0) {
@@ -7567,7 +7715,7 @@ function farmPluginMayAffectRuntimePath(plugin, pathname) {
7567
7715
  ) === normalizedPathname
7568
7716
  );
7569
7717
  }
7570
- return Boolean(plugin.setup || _optionalChain([runtime, 'optionalAccess', _302 => _302.start]) || _optionalChain([runtime, 'optionalAccess', _303 => _303.close]));
7718
+ return Boolean(plugin.setup || _optionalChain([runtime, 'optionalAccess', _305 => _305.start]) || _optionalChain([runtime, 'optionalAccess', _306 => _306.close]));
7571
7719
  }
7572
7720
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmPluginMayAffectRuntimePath, "farmPluginMayAffectRuntimePath");
7573
7721
 
@@ -7701,7 +7849,7 @@ var _PluginManager = class _PluginManager {
7701
7849
  const endpoints = [];
7702
7850
  const owners = /* @__PURE__ */ new Map();
7703
7851
  for (const plugin of this.getSortedPlugins()) {
7704
- const configured = _optionalChain([plugin, 'access', _304 => _304.runtime, 'optionalAccess', _305 => _305.endpoints]);
7852
+ const configured = _optionalChain([plugin, 'access', _307 => _307.runtime, 'optionalAccess', _308 => _308.endpoints]);
7705
7853
  if (configured === void 0) continue;
7706
7854
  if (!Array.isArray(configured)) {
7707
7855
  throw new TypeError(`Farm plugin "${plugin.name}" runtime.endpoints must be an array`);
@@ -7712,23 +7860,23 @@ var _PluginManager = class _PluginManager {
7712
7860
  `Farm plugin "${plugin.name}" runtime.endpoints must contain endpoint objects`
7713
7861
  );
7714
7862
  }
7715
- const path17 = normalizeFarmPluginRuntimeEndpointPath(
7863
+ const path18 = normalizeFarmPluginRuntimeEndpointPath(
7716
7864
  endpoint.path,
7717
7865
  `Farm plugin "${plugin.name}" runtime endpoint`
7718
7866
  );
7719
7867
  if (typeof endpoint.handler !== "function") {
7720
7868
  throw new TypeError(
7721
- `Farm plugin "${plugin.name}" runtime endpoint ${path17} requires a handler`
7869
+ `Farm plugin "${plugin.name}" runtime endpoint ${path18} requires a handler`
7722
7870
  );
7723
7871
  }
7724
- const owner = owners.get(path17);
7872
+ const owner = owners.get(path18);
7725
7873
  if (owner) {
7726
7874
  throw new Error(
7727
- `Farm plugin runtime endpoint ${path17} from "${plugin.name}" conflicts with "${owner}"`
7875
+ `Farm plugin runtime endpoint ${path18} from "${plugin.name}" conflicts with "${owner}"`
7728
7876
  );
7729
7877
  }
7730
- owners.set(path17, plugin.name);
7731
- endpoints.push({ plugin, endpoint, path: path17 });
7878
+ owners.set(path18, plugin.name);
7879
+ endpoints.push({ plugin, endpoint, path: path18 });
7732
7880
  }
7733
7881
  }
7734
7882
  this.runtimeEndpoints = endpoints;
@@ -7772,7 +7920,7 @@ var _PluginManager = class _PluginManager {
7772
7920
  const values = {};
7773
7921
  const owners = /* @__PURE__ */ new Map();
7774
7922
  for (const plugin of this.getSortedPlugins()) {
7775
- const createContext = _optionalChain([plugin, 'access', _306 => _306.runtime, 'optionalAccess', _307 => _307.context]);
7923
+ const createContext = _optionalChain([plugin, 'access', _309 => _309.runtime, 'optionalAccess', _310 => _310.context]);
7776
7924
  if (!createContext) continue;
7777
7925
  const result = await createContext(
7778
7926
  this.createRuntimeBaseEvent(plugin, request2, options, waitUntil)
@@ -7798,7 +7946,7 @@ var _PluginManager = class _PluginManager {
7798
7946
  }
7799
7947
  async runRuntimeErrorHooks(request2, error, ctx, durationMs, options, waitUntil) {
7800
7948
  for (const plugin of this.getSortedPlugins()) {
7801
- const onError = _optionalChain([plugin, 'access', _308 => _308.runtime, 'optionalAccess', _309 => _309.error]);
7949
+ const onError = _optionalChain([plugin, 'access', _311 => _311.runtime, 'optionalAccess', _312 => _312.error]);
7802
7950
  if (!onError) continue;
7803
7951
  try {
7804
7952
  await onError({
@@ -7842,19 +7990,19 @@ var _PluginManager = class _PluginManager {
7842
7990
  case "config":
7843
7991
  if (plugin.configure) {
7844
7992
  hooks.push(
7845
- (config, context) => _optionalChain([plugin, 'access', _310 => _310.configure, 'optionalCall', _311 => _311(config, context)])
7993
+ (config, context) => _optionalChain([plugin, 'access', _313 => _313.configure, 'optionalCall', _314 => _314(config, context)])
7846
7994
  );
7847
7995
  }
7848
7996
  break;
7849
7997
  case "ready":
7850
- if (_optionalChain([plugin, 'access', _312 => _312.runtime, 'optionalAccess', _313 => _313.start])) {
7851
- hooks.push((context) => _optionalChain([plugin, 'access', _314 => _314.runtime, 'optionalAccess', _315 => _315.start, 'optionalCall', _316 => _316(withState(context))]));
7998
+ if (_optionalChain([plugin, 'access', _315 => _315.runtime, 'optionalAccess', _316 => _316.start])) {
7999
+ hooks.push((context) => _optionalChain([plugin, 'access', _317 => _317.runtime, 'optionalAccess', _318 => _318.start, 'optionalCall', _319 => _319(withState(context))]));
7852
8000
  }
7853
8001
  break;
7854
8002
  case "shutdown":
7855
- if (_optionalChain([plugin, 'access', _317 => _317.runtime, 'optionalAccess', _318 => _318.close])) {
8003
+ if (_optionalChain([plugin, 'access', _320 => _320.runtime, 'optionalAccess', _321 => _321.close])) {
7856
8004
  hooks.push(
7857
- (payload, context) => _optionalChain([plugin, 'access', _319 => _319.runtime, 'optionalAccess', _320 => _320.close, 'optionalCall', _321 => _321({
8005
+ (payload, context) => _optionalChain([plugin, 'access', _322 => _322.runtime, 'optionalAccess', _323 => _323.close, 'optionalCall', _324 => _324({
7858
8006
  ...withState(context),
7859
8007
  reason: payload.reason
7860
8008
  })])
@@ -7862,93 +8010,93 @@ var _PluginManager = class _PluginManager {
7862
8010
  }
7863
8011
  break;
7864
8012
  case "routeDiscovered":
7865
- if (_optionalChain([plugin, 'access', _322 => _322.router, 'optionalAccess', _323 => _323.discovered])) {
8013
+ if (_optionalChain([plugin, 'access', _325 => _325.router, 'optionalAccess', _326 => _326.discovered])) {
7866
8014
  hooks.push(
7867
- (route, context) => _optionalChain([plugin, 'access', _324 => _324.router, 'optionalAccess', _325 => _325.discovered, 'optionalCall', _326 => _326(route, withState(context))])
8015
+ (route, context) => _optionalChain([plugin, 'access', _327 => _327.router, 'optionalAccess', _328 => _328.discovered, 'optionalCall', _329 => _329(route, withState(context))])
7868
8016
  );
7869
8017
  }
7870
8018
  break;
7871
8019
  case "middlewareDiscovered":
7872
- if (_optionalChain([plugin, 'access', _327 => _327.router, 'optionalAccess', _328 => _328.discovered])) {
8020
+ if (_optionalChain([plugin, 'access', _330 => _330.router, 'optionalAccess', _331 => _331.discovered])) {
7873
8021
  hooks.push(
7874
- (route, context) => _optionalChain([plugin, 'access', _329 => _329.router, 'optionalAccess', _330 => _330.discovered, 'optionalCall', _331 => _331({ kind: "middleware", ...route }, withState(context))])
8022
+ (route, context) => _optionalChain([plugin, 'access', _332 => _332.router, 'optionalAccess', _333 => _333.discovered, 'optionalCall', _334 => _334({ kind: "middleware", ...route }, withState(context))])
7875
8023
  );
7876
8024
  }
7877
8025
  break;
7878
8026
  case "apiRouteDiscovered":
7879
- if (_optionalChain([plugin, 'access', _332 => _332.router, 'optionalAccess', _333 => _333.discovered])) {
8027
+ if (_optionalChain([plugin, 'access', _335 => _335.router, 'optionalAccess', _336 => _336.discovered])) {
7880
8028
  hooks.push(
7881
- (route, context) => _optionalChain([plugin, 'access', _334 => _334.router, 'optionalAccess', _335 => _335.discovered, 'optionalCall', _336 => _336({ kind: "api", ...route }, withState(context))])
8029
+ (route, context) => _optionalChain([plugin, 'access', _337 => _337.router, 'optionalAccess', _338 => _338.discovered, 'optionalCall', _339 => _339({ kind: "api", ...route }, withState(context))])
7882
8030
  );
7883
8031
  }
7884
8032
  break;
7885
8033
  case "routesGenerated":
7886
- if (_optionalChain([plugin, 'access', _337 => _337.router, 'optionalAccess', _338 => _338.generated])) {
8034
+ if (_optionalChain([plugin, 'access', _340 => _340.router, 'optionalAccess', _341 => _341.generated])) {
7887
8035
  hooks.push(
7888
- (routes, context) => _optionalChain([plugin, 'access', _339 => _339.router, 'optionalAccess', _340 => _340.generated, 'optionalCall', _341 => _341(routes, withState(context))])
8036
+ (routes, context) => _optionalChain([plugin, 'access', _342 => _342.router, 'optionalAccess', _343 => _343.generated, 'optionalCall', _344 => _344(routes, withState(context))])
7889
8037
  );
7890
8038
  }
7891
8039
  break;
7892
8040
  case "beforeRouteMatch":
7893
- if (_optionalChain([plugin, 'access', _342 => _342.router, 'optionalAccess', _343 => _343.before])) {
8041
+ if (_optionalChain([plugin, 'access', _345 => _345.router, 'optionalAccess', _346 => _346.before])) {
7894
8042
  hooks.push(
7895
- (route, context) => _optionalChain([plugin, 'access', _344 => _344.router, 'optionalAccess', _345 => _345.before, 'optionalCall', _346 => _346(route, withState(context))])
8043
+ (route, context) => _optionalChain([plugin, 'access', _347 => _347.router, 'optionalAccess', _348 => _348.before, 'optionalCall', _349 => _349(route, withState(context))])
7896
8044
  );
7897
8045
  }
7898
8046
  break;
7899
8047
  case "afterRouteMatch":
7900
- if (_optionalChain([plugin, 'access', _347 => _347.router, 'optionalAccess', _348 => _348.after])) {
8048
+ if (_optionalChain([plugin, 'access', _350 => _350.router, 'optionalAccess', _351 => _351.after])) {
7901
8049
  hooks.push(
7902
- (result, context) => _optionalChain([plugin, 'access', _349 => _349.router, 'optionalAccess', _350 => _350.after, 'optionalCall', _351 => _351(result, withState(context))])
8050
+ (result, context) => _optionalChain([plugin, 'access', _352 => _352.router, 'optionalAccess', _353 => _353.after, 'optionalCall', _354 => _354(result, withState(context))])
7903
8051
  );
7904
8052
  }
7905
8053
  break;
7906
8054
  case "beforeRender":
7907
- if (_optionalChain([plugin, 'access', _352 => _352.render, 'optionalAccess', _353 => _353.before])) {
8055
+ if (_optionalChain([plugin, 'access', _355 => _355.render, 'optionalAccess', _356 => _356.before])) {
7908
8056
  hooks.push(
7909
- (render, context) => _optionalChain([plugin, 'access', _354 => _354.render, 'optionalAccess', _355 => _355.before, 'optionalCall', _356 => _356(render, withState(context))])
8057
+ (render, context) => _optionalChain([plugin, 'access', _357 => _357.render, 'optionalAccess', _358 => _358.before, 'optionalCall', _359 => _359(render, withState(context))])
7910
8058
  );
7911
8059
  }
7912
8060
  break;
7913
8061
  case "afterRender":
7914
- if (_optionalChain([plugin, 'access', _357 => _357.render, 'optionalAccess', _358 => _358.html])) {
8062
+ if (_optionalChain([plugin, 'access', _360 => _360.render, 'optionalAccess', _361 => _361.html])) {
7915
8063
  hooks.push(
7916
- (html, render, context) => _optionalChain([plugin, 'access', _359 => _359.render, 'optionalAccess', _360 => _360.html, 'optionalCall', _361 => _361(html, render, withState(context))])
8064
+ (html, render, context) => _optionalChain([plugin, 'access', _362 => _362.render, 'optionalAccess', _363 => _363.html, 'optionalCall', _364 => _364(html, render, withState(context))])
7917
8065
  );
7918
8066
  }
7919
8067
  break;
7920
8068
  case "beforeBundle":
7921
- if (_optionalChain([plugin, 'access', _362 => _362.build, 'optionalAccess', _363 => _363.before])) {
8069
+ if (_optionalChain([plugin, 'access', _365 => _365.build, 'optionalAccess', _366 => _366.before])) {
7922
8070
  hooks.push(
7923
- (bundle, context) => _optionalChain([plugin, 'access', _364 => _364.build, 'optionalAccess', _365 => _365.before, 'optionalCall', _366 => _366(bundle, withState(context))])
8071
+ (bundle, context) => _optionalChain([plugin, 'access', _367 => _367.build, 'optionalAccess', _368 => _368.before, 'optionalCall', _369 => _369(bundle, withState(context))])
7924
8072
  );
7925
8073
  }
7926
8074
  break;
7927
8075
  case "beforeNitroBuild":
7928
- if (_optionalChain([plugin, 'access', _367 => _367.build, 'optionalAccess', _368 => _368.configure])) {
8076
+ if (_optionalChain([plugin, 'access', _370 => _370.build, 'optionalAccess', _371 => _371.configure])) {
7929
8077
  hooks.push(
7930
- (buildConfig, context) => _optionalChain([plugin, 'access', _369 => _369.build, 'optionalAccess', _370 => _370.configure, 'optionalCall', _371 => _371(buildConfig, withState(context))])
8078
+ (buildConfig, context) => _optionalChain([plugin, 'access', _372 => _372.build, 'optionalAccess', _373 => _373.configure, 'optionalCall', _374 => _374(buildConfig, withState(context))])
7931
8079
  );
7932
8080
  }
7933
8081
  break;
7934
8082
  case "afterBundle":
7935
- if (_optionalChain([plugin, 'access', _372 => _372.build, 'optionalAccess', _373 => _373.after])) {
8083
+ if (_optionalChain([plugin, 'access', _375 => _375.build, 'optionalAccess', _376 => _376.after])) {
7936
8084
  hooks.push(
7937
- (result, context) => _optionalChain([plugin, 'access', _374 => _374.build, 'optionalAccess', _375 => _375.after, 'optionalCall', _376 => _376(result, withState(context))])
8085
+ (result, context) => _optionalChain([plugin, 'access', _377 => _377.build, 'optionalAccess', _378 => _378.after, 'optionalCall', _379 => _379(result, withState(context))])
7938
8086
  );
7939
8087
  }
7940
8088
  break;
7941
8089
  case "devServerCreated":
7942
- if (_optionalChain([plugin, 'access', _377 => _377.dev, 'optionalAccess', _378 => _378.server])) {
8090
+ if (_optionalChain([plugin, 'access', _380 => _380.dev, 'optionalAccess', _381 => _381.server])) {
7943
8091
  hooks.push(
7944
- (server, context) => _optionalChain([plugin, 'access', _379 => _379.dev, 'optionalAccess', _380 => _380.server, 'optionalCall', _381 => _381(server, withState(context))])
8092
+ (server, context) => _optionalChain([plugin, 'access', _382 => _382.dev, 'optionalAccess', _383 => _383.server, 'optionalCall', _384 => _384(server, withState(context))])
7945
8093
  );
7946
8094
  }
7947
8095
  break;
7948
8096
  case "hmrUpdate":
7949
- if (_optionalChain([plugin, 'access', _382 => _382.dev, 'optionalAccess', _383 => _383.update])) {
8097
+ if (_optionalChain([plugin, 'access', _385 => _385.dev, 'optionalAccess', _386 => _386.update])) {
7950
8098
  hooks.push(
7951
- (update, context) => _optionalChain([plugin, 'access', _384 => _384.dev, 'optionalAccess', _385 => _385.update, 'optionalCall', _386 => _386(update, withState(context))])
8099
+ (update, context) => _optionalChain([plugin, 'access', _387 => _387.dev, 'optionalAccess', _388 => _388.update, 'optionalCall', _389 => _389(update, withState(context))])
7952
8100
  );
7953
8101
  }
7954
8102
  break;
@@ -7994,7 +8142,7 @@ var _PluginManager = class _PluginManager {
7994
8142
  hasRuntimeHook(hookName) {
7995
8143
  const cached = this.runtimeHookPresence.get(hookName);
7996
8144
  if (cached !== void 0) return cached;
7997
- const present = this.plugins.some((plugin) => typeof _optionalChain([plugin, 'access', _387 => _387.runtime, 'optionalAccess', _388 => _388[hookName]]) === "function");
8145
+ const present = this.plugins.some((plugin) => typeof _optionalChain([plugin, 'access', _390 => _390.runtime, 'optionalAccess', _391 => _391[hookName]]) === "function");
7998
8146
  this.runtimeHookPresence.set(hookName, present);
7999
8147
  return present;
8000
8148
  }
@@ -8073,7 +8221,7 @@ var _PluginManager = class _PluginManager {
8073
8221
  async beginRuntimeRequest(request2, options = {}) {
8074
8222
  await this.startRuntime();
8075
8223
  const startedAt = Date.now();
8076
- const waitUntil = options.waitUntil ? (promise) => _optionalChain([options, 'access', _389 => _389.waitUntil, 'optionalCall', _390 => _390(Promise.resolve(promise))]) : (promise) => {
8224
+ const waitUntil = options.waitUntil ? (promise) => _optionalChain([options, 'access', _392 => _392.waitUntil, 'optionalCall', _393 => _393(Promise.resolve(promise))]) : (promise) => {
8077
8225
  void Promise.resolve(promise).catch(() => {
8078
8226
  });
8079
8227
  };
@@ -8106,7 +8254,7 @@ var _PluginManager = class _PluginManager {
8106
8254
  );
8107
8255
  let response;
8108
8256
  for (const plugin of this.getSortedPlugins()) {
8109
- const before = _optionalChain([plugin, 'access', _391 => _391.runtime, 'optionalAccess', _392 => _392.before]);
8257
+ const before = _optionalChain([plugin, 'access', _394 => _394.runtime, 'optionalAccess', _395 => _395.before]);
8110
8258
  if (!before) continue;
8111
8259
  const result = await before({
8112
8260
  ...this.createRuntimeBaseEvent(plugin, activeRequest, activeOptions, waitUntil),
@@ -8152,7 +8300,7 @@ var _PluginManager = class _PluginManager {
8152
8300
  let response = initialResponse;
8153
8301
  try {
8154
8302
  for (const plugin of this.getSortedPlugins()) {
8155
- const after = _optionalChain([plugin, 'access', _393 => _393.runtime, 'optionalAccess', _394 => _394.after]);
8303
+ const after = _optionalChain([plugin, 'access', _396 => _396.runtime, 'optionalAccess', _397 => _397.after]);
8156
8304
  if (!after) continue;
8157
8305
  const result = await after({
8158
8306
  ...this.createRuntimeBaseEvent(
@@ -8241,7 +8389,7 @@ var _PluginManager = class _PluginManager {
8241
8389
  /** @internal Runs hooks for only the plugins selected by the runtime adapter. */
8242
8390
  async runHookParallelFiltered(hookName, include, ...args) {
8243
8391
  if (hookName === "shutdown" && !this.runtimeShutdownHooksRunning) {
8244
- await this.closeRuntime(_optionalChain([args, 'access', _395 => _395[0], 'optionalAccess', _396 => _396.reason]));
8392
+ await this.closeRuntime(_optionalChain([args, 'access', _398 => _398[0], 'optionalAccess', _399 => _399.reason]));
8245
8393
  return false;
8246
8394
  }
8247
8395
  const plugins = this.getSortedPlugins().filter(include);
@@ -8327,7 +8475,7 @@ function createPluginFactory(definition) {
8327
8475
  configure: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (config, context) => configure(config, { ...context, options }), "configure")
8328
8476
  } : {},
8329
8477
  setup(context) {
8330
- const state = _optionalChain([setup, 'optionalCall', _397 => _397({ ...context, options })]);
8478
+ const state = _optionalChain([setup, 'optionalCall', _400 => _400({ ...context, options })]);
8331
8479
  return state instanceof Promise ? state.then(resolveState) : resolveState(state);
8332
8480
  }
8333
8481
  });
@@ -8368,10 +8516,10 @@ function declarePluginSchema(plugin) {
8368
8516
  models: Object.keys(models).filter((key) => !models[key].external),
8369
8517
  ...plugin.dependsOn ? { dependsOn: plugin.dependsOn.map(_chunkQBPXNZGVcjs.pluginShortName) } : {},
8370
8518
  ...plugin.version ? { version: plugin.version } : {},
8371
- ..._optionalChain([plugin, 'access', _398 => _398.migrations, 'optionalAccess', _399 => _399.length]) ? { migrations: plugin.migrations } : {},
8372
- dialect: _optionalChain([database, 'optionalAccess', _400 => _400.dialect]),
8519
+ ..._optionalChain([plugin, 'access', _401 => _401.migrations, 'optionalAccess', _402 => _402.length]) ? { migrations: plugin.migrations } : {},
8520
+ dialect: _optionalChain([database, 'optionalAccess', _403 => _403.dialect]),
8373
8521
  resolveClient: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (config) => {
8374
- if (_optionalChain([database, 'optionalAccess', _401 => _401.client]) !== void 0 && database.client !== null) {
8522
+ if (_optionalChain([database, 'optionalAccess', _404 => _404.client]) !== void 0 && database.client !== null) {
8375
8523
  const client2 = typeof database.client === "function" ? await database.client() : database.client;
8376
8524
  if (client2 === void 0 || client2 === null) {
8377
8525
  throw new Error(`The ${name} plugin's \`database.client\` returned no connection.`);
@@ -8425,7 +8573,7 @@ function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
8425
8573
  }
8426
8574
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAppClientEntry, "resolveFarmAppClientEntry");
8427
8575
  function resolveFarmClientPlugins(plugins, _root) {
8428
- if (!_optionalChain([plugins, 'optionalAccess', _402 => _402.length])) return [];
8576
+ if (!_optionalChain([plugins, 'optionalAccess', _405 => _405.length])) return [];
8429
8577
  return plugins.flatMap((plugin) => {
8430
8578
  if (!plugin.client) return [];
8431
8579
  assertClientLifecycle(plugin.client, plugin.name);
@@ -8505,7 +8653,7 @@ function assertLifecycleObject(value, pluginName, location, allowedKeys) {
8505
8653
  throw new TypeError(`Client plugin "${pluginName}" has an unknown ${location}.${key} option`);
8506
8654
  }
8507
8655
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
8508
- if (!_optionalChain([descriptor, 'optionalAccess', _403 => _403.enumerable])) {
8656
+ if (!_optionalChain([descriptor, 'optionalAccess', _406 => _406.enumerable])) {
8509
8657
  throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} must be enumerable`);
8510
8658
  }
8511
8659
  if (!("value" in descriptor)) {
@@ -8629,7 +8777,7 @@ function assertPublicData(value, pluginName) {
8629
8777
  throwPublicDataError(pluginName, pathSegments, "cannot contain symbol keys");
8630
8778
  }
8631
8779
  const descriptor = Object.getOwnPropertyDescriptor(current, key);
8632
- if (!_optionalChain([descriptor, 'optionalAccess', _404 => _404.enumerable])) {
8780
+ if (!_optionalChain([descriptor, 'optionalAccess', _407 => _407.enumerable])) {
8633
8781
  throwPublicDataError(
8634
8782
  pluginName,
8635
8783
  [...pathSegments, key],
@@ -8675,8 +8823,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, isArrayIndex, "isArrayIndex");
8675
8823
 
8676
8824
  var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
8677
8825
  function resolveFarmClientCacheAdapterEntry(root, cache) {
8678
- const client = _optionalChain([cache, 'optionalAccess', _405 => _405.client]);
8679
- const adapter = _optionalChain([client, 'optionalAccess', _406 => _406.adapter]);
8826
+ const client = _optionalChain([cache, 'optionalAccess', _408 => _408.client]);
8827
+ const adapter = _optionalChain([client, 'optionalAccess', _409 => _409.adapter]);
8680
8828
  if (adapter === void 0) return void 0;
8681
8829
  if (typeof adapter !== "string" || adapter.trim().length === 0) {
8682
8830
  throw new Error(
@@ -8691,8 +8839,8 @@ function resolveFarmClientCacheAdapterEntry(root, cache) {
8691
8839
  );
8692
8840
  }
8693
8841
  const options = {};
8694
- if (_optionalChain([client, 'optionalAccess', _407 => _407.version]) !== void 0) options.version = client.version;
8695
- if (_optionalChain([client, 'optionalAccess', _408 => _408.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
8842
+ if (_optionalChain([client, 'optionalAccess', _410 => _410.version]) !== void 0) options.version = client.version;
8843
+ if (_optionalChain([client, 'optionalAccess', _411 => _411.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
8696
8844
  return { importPath: found.replace(/\\/g, "/"), options };
8697
8845
  }
8698
8846
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmClientCacheAdapterEntry, "resolveFarmClientCacheAdapterEntry");
@@ -8794,7 +8942,7 @@ function createFarmLayoutElement(Component, pattern, children, params) {
8794
8942
  function shouldBypassFarmRouterForDottedPath(pathname, routeManager, baseDirs, generatedPaths = []) {
8795
8943
  if (!pathname.includes(".") || pathname.endsWith(".html")) return false;
8796
8944
  const matchesAppRoute = Boolean(
8797
- _optionalChain([routeManager, 'optionalAccess', _409 => _409.matchRoute, 'call', _410 => _410(pathname), 'optionalAccess', _411 => _411.route]) || _optionalChain([routeManager, 'optionalAccess', _412 => _412.matchMetadataRoute, 'call', _413 => _413(pathname)]) || _optionalChain([routeManager, 'optionalAccess', _414 => _414.matchMetadataImage, 'call', _415 => _415(pathname)]) || generatedPaths.includes(pathname)
8945
+ _optionalChain([routeManager, 'optionalAccess', _412 => _412.matchRoute, 'call', _413 => _413(pathname), 'optionalAccess', _414 => _414.route]) || _optionalChain([routeManager, 'optionalAccess', _415 => _415.matchMetadataRoute, 'call', _416 => _416(pathname)]) || _optionalChain([routeManager, 'optionalAccess', _417 => _417.matchMetadataImage, 'call', _418 => _418(pathname)]) || generatedPaths.includes(pathname)
8798
8946
  );
8799
8947
  return !matchesAppRoute || devServableFileExists(pathname, baseDirs);
8800
8948
  }
@@ -8823,7 +8971,7 @@ var DOCS_ENGINE_APP_OWNABLE_PATHS = /* @__PURE__ */ new Set([
8823
8971
  ]);
8824
8972
  function farmAppOwnsDocsEnginePath(pathname, options) {
8825
8973
  if (!DOCS_ENGINE_APP_OWNABLE_PATHS.has(pathname)) return false;
8826
- return options.generatedPaths.includes(pathname) || Boolean(_optionalChain([options, 'access', _416 => _416.routeManager, 'optionalAccess', _417 => _417.matchMetadataRoute, 'call', _418 => _418(pathname)])) || devServableFileExists(pathname, [options.publicDir]);
8974
+ return options.generatedPaths.includes(pathname) || Boolean(_optionalChain([options, 'access', _419 => _419.routeManager, 'optionalAccess', _420 => _420.matchMetadataRoute, 'call', _421 => _421(pathname)])) || devServableFileExists(pathname, [options.publicDir]);
8827
8975
  }
8828
8976
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmAppOwnsDocsEnginePath, "farmAppOwnsDocsEnginePath");
8829
8977
  function devServableFileExists(pathname, baseDirs) {
@@ -8837,9 +8985,9 @@ function devServableFileExists(pathname, baseDirs) {
8837
8985
  if (!relativePathname) return false;
8838
8986
  for (const baseDir of baseDirs) {
8839
8987
  if (typeof baseDir !== "string" || baseDir.length === 0) continue;
8840
- const resolvedBase = path13.resolve(baseDir);
8841
- const candidate = path13.resolve(resolvedBase, relativePathname);
8842
- if (!candidate.startsWith(resolvedBase + path13.sep)) continue;
8988
+ const resolvedBase = path14.resolve(baseDir);
8989
+ const candidate = path14.resolve(resolvedBase, relativePathname);
8990
+ if (!candidate.startsWith(resolvedBase + path14.sep)) continue;
8843
8991
  try {
8844
8992
  if (fs8.existsSync(candidate) && fs8.statSync(candidate).isFile()) {
8845
8993
  return true;
@@ -8930,14 +9078,14 @@ function analyzeClientBoundary(program, publicKeys) {
8930
9078
  _chunkS3JO3N4Hcjs.__name.call(void 0, analyzeClientBoundary, "analyzeClientBoundary");
8931
9079
  function readNodeBuiltinSource(node) {
8932
9080
  if (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ImportExpression") {
8933
- const value = _optionalChain([node, 'access', _419 => _419.source, 'optionalAccess', _420 => _420.value]);
9081
+ const value = _optionalChain([node, 'access', _422 => _422.source, 'optionalAccess', _423 => _423.value]);
8934
9082
  return typeof value === "string" && value.startsWith("node:") ? value : void 0;
8935
9083
  }
8936
9084
  if (node.type === "CallExpression") {
8937
9085
  const callee = node.callee;
8938
- if (_optionalChain([callee, 'optionalAccess', _421 => _421.type]) === "Identifier" && callee.name === "require") {
8939
- const arg = _optionalChain([node, 'access', _422 => _422.arguments, 'optionalAccess', _423 => _423[0]]);
8940
- const value = _optionalChain([arg, 'optionalAccess', _424 => _424.type]) === "Literal" ? arg.value : void 0;
9086
+ if (_optionalChain([callee, 'optionalAccess', _424 => _424.type]) === "Identifier" && callee.name === "require") {
9087
+ const arg = _optionalChain([node, 'access', _425 => _425.arguments, 'optionalAccess', _426 => _426[0]]);
9088
+ const value = _optionalChain([arg, 'optionalAccess', _427 => _427.type]) === "Literal" ? arg.value : void 0;
8941
9089
  return typeof value === "string" && value.startsWith("node:") ? value : void 0;
8942
9090
  }
8943
9091
  }
@@ -8947,7 +9095,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, readNodeBuiltinSource, "readNodeBuiltinSou
8947
9095
  function readProcessEnvKey(node) {
8948
9096
  if (node.type !== "MemberExpression") return void 0;
8949
9097
  const object = node.object;
8950
- if (!object || object.type !== "MemberExpression" || _optionalChain([object, 'access', _425 => _425.object, 'optionalAccess', _426 => _426.type]) !== "Identifier" || object.object.name !== "process" || _optionalChain([object, 'access', _427 => _427.property, 'optionalAccess', _428 => _428.name]) !== "env") {
9098
+ if (!object || object.type !== "MemberExpression" || _optionalChain([object, 'access', _428 => _428.object, 'optionalAccess', _429 => _429.type]) !== "Identifier" || object.object.name !== "process" || _optionalChain([object, 'access', _430 => _430.property, 'optionalAccess', _431 => _431.name]) !== "env") {
8951
9099
  return void 0;
8952
9100
  }
8953
9101
  const property = node.property;
@@ -9012,7 +9160,7 @@ function farmImageImportsPlugin() {
9012
9160
  async transform(code, id) {
9013
9161
  const filePath = id.split("?", 1)[0];
9014
9162
  if (id.includes("?") || !STATIC_IMAGE_RE.test(filePath)) return null;
9015
- const defaultExport = _optionalChain([code, 'access', _429 => _429.match, 'call', _430 => _430(/^\s*export\s+default\s+(.+?);?\s*$/s), 'optionalAccess', _431 => _431[1]]);
9163
+ const defaultExport = _optionalChain([code, 'access', _432 => _432.match, 'call', _433 => _433(/^\s*export\s+default\s+(.+?);?\s*$/s), 'optionalAccess', _434 => _434[1]]);
9016
9164
  if (!defaultExport) return null;
9017
9165
  return createStaticImageModule(filePath, `const src = ${defaultExport};`);
9018
9166
  }
@@ -9073,7 +9221,7 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
9073
9221
  ];
9074
9222
  function getFarmClientOptimizeDepsInclude(renderer) {
9075
9223
  return Array.from(
9076
- /* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _432 => _432.optimizeDeps]) || []])
9224
+ /* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _435 => _435.optimizeDeps]) || []])
9077
9225
  );
9078
9226
  }
9079
9227
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmClientOptimizeDepsInclude, "getFarmClientOptimizeDepsInclude");
@@ -9098,7 +9246,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
9098
9246
  // Farm's HTML boots through a virtual module and imports route UI lazily.
9099
9247
  // Explicit entries let Vite finish that crawl before a navigation can
9100
9248
  // rotate the optimizer hash underneath a hydrated React runtime.
9101
- ..._optionalChain([entries, 'optionalAccess', _433 => _433.length]) ? { entries: [...entries] } : {}
9249
+ ..._optionalChain([entries, 'optionalAccess', _436 => _436.length]) ? { entries: [...entries] } : {}
9102
9250
  };
9103
9251
  }
9104
9252
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmClientOptimizeDepsConfig, "createFarmClientOptimizeDepsConfig");
@@ -9128,8 +9276,8 @@ function mergeAlias(farmValue, userValue) {
9128
9276
  }
9129
9277
  _chunkS3JO3N4Hcjs.__name.call(void 0, mergeAlias, "mergeAlias");
9130
9278
  function mergeFarmViteConfig(farmConfig, userConfig = {}) {
9131
- const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _434 => _434.optimizeDeps, 'optionalAccess', _435 => _435.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _436 => _436.optimizeDeps, 'optionalAccess', _437 => _437.noDiscovery])));
9132
- const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _438 => _438.optimizeDeps, 'optionalAccess', _439 => _439.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _440 => _440.optimizeDeps, 'optionalAccess', _441 => _441.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _442 => _442.optimizeDeps, 'optionalAccess', _443 => _443.holdUntilCrawlEnd]))));
9279
+ const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _437 => _437.optimizeDeps, 'optionalAccess', _438 => _438.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _439 => _439.optimizeDeps, 'optionalAccess', _440 => _440.noDiscovery])));
9280
+ const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _441 => _441.optimizeDeps, 'optionalAccess', _442 => _442.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _443 => _443.optimizeDeps, 'optionalAccess', _444 => _444.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _445 => _445.optimizeDeps, 'optionalAccess', _446 => _446.holdUntilCrawlEnd]))));
9133
9281
  return {
9134
9282
  ...farmConfig,
9135
9283
  ...userConfig,
@@ -9141,9 +9289,9 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
9141
9289
  resolve: {
9142
9290
  ...farmConfig.resolve,
9143
9291
  ...userConfig.resolve,
9144
- alias: mergeAlias(_optionalChain([farmConfig, 'access', _444 => _444.resolve, 'optionalAccess', _445 => _445.alias]), _optionalChain([userConfig, 'access', _446 => _446.resolve, 'optionalAccess', _447 => _447.alias])),
9292
+ alias: mergeAlias(_optionalChain([farmConfig, 'access', _447 => _447.resolve, 'optionalAccess', _448 => _448.alias]), _optionalChain([userConfig, 'access', _449 => _449.resolve, 'optionalAccess', _450 => _450.alias])),
9145
9293
  dedupe: Array.from(
9146
- /* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _448 => _448.resolve, 'optionalAccess', _449 => _449.dedupe]) || [], ..._optionalChain([userConfig, 'access', _450 => _450.resolve, 'optionalAccess', _451 => _451.dedupe]) || []])
9294
+ /* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _451 => _451.resolve, 'optionalAccess', _452 => _452.dedupe]) || [], ..._optionalChain([userConfig, 'access', _453 => _453.resolve, 'optionalAccess', _454 => _454.dedupe]) || []])
9147
9295
  )
9148
9296
  },
9149
9297
  optimizeDeps: {
@@ -9153,21 +9301,21 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
9153
9301
  holdUntilCrawlEnd,
9154
9302
  include: Array.from(
9155
9303
  /* @__PURE__ */ new Set([
9156
- ..._optionalChain([farmConfig, 'access', _452 => _452.optimizeDeps, 'optionalAccess', _453 => _453.include]) || [],
9157
- ..._optionalChain([userConfig, 'access', _454 => _454.optimizeDeps, 'optionalAccess', _455 => _455.include]) || []
9304
+ ..._optionalChain([farmConfig, 'access', _455 => _455.optimizeDeps, 'optionalAccess', _456 => _456.include]) || [],
9305
+ ..._optionalChain([userConfig, 'access', _457 => _457.optimizeDeps, 'optionalAccess', _458 => _458.include]) || []
9158
9306
  ])
9159
9307
  ),
9160
9308
  exclude: Array.from(
9161
9309
  /* @__PURE__ */ new Set([
9162
- ..._optionalChain([farmConfig, 'access', _456 => _456.optimizeDeps, 'optionalAccess', _457 => _457.exclude]) || [],
9163
- ..._optionalChain([userConfig, 'access', _458 => _458.optimizeDeps, 'optionalAccess', _459 => _459.exclude]) || []
9310
+ ..._optionalChain([farmConfig, 'access', _459 => _459.optimizeDeps, 'optionalAccess', _460 => _460.exclude]) || [],
9311
+ ..._optionalChain([userConfig, 'access', _461 => _461.optimizeDeps, 'optionalAccess', _462 => _462.exclude]) || []
9164
9312
  ])
9165
9313
  )
9166
9314
  },
9167
9315
  ssr: {
9168
9316
  ...farmConfig.ssr,
9169
9317
  ...userConfig.ssr,
9170
- noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _460 => _460.ssr, 'optionalAccess', _461 => _461.noExternal]), _optionalChain([userConfig, 'access', _462 => _462.ssr, 'optionalAccess', _463 => _463.noExternal]))
9318
+ noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _463 => _463.ssr, 'optionalAccess', _464 => _464.noExternal]), _optionalChain([userConfig, 'access', _465 => _465.ssr, 'optionalAccess', _466 => _466.noExternal]))
9171
9319
  }
9172
9320
  };
9173
9321
  }
@@ -9221,7 +9369,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
9221
9369
  ...farmConfig.build,
9222
9370
  rollupOptions: {
9223
9371
  ...userBundlerOptions,
9224
- ..._optionalChain([farmConfig, 'access', _464 => _464.build, 'optionalAccess', _465 => _465.rollupOptions])
9372
+ ..._optionalChain([farmConfig, 'access', _467 => _467.build, 'optionalAccess', _468 => _468.rollupOptions])
9225
9373
  }
9226
9374
  },
9227
9375
  css: farmConfig.css || userCss ? { ...farmConfig.css, ...userCss } : void 0,
@@ -9229,7 +9377,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
9229
9377
  esbuild: typeof userEsbuild === "object" && farmConfig.esbuild !== false ? { ...userEsbuild, ...farmConfig.esbuild } : _nullishCoalesce(farmConfig.esbuild, () => ( userEsbuild)),
9230
9378
  ssr: {
9231
9379
  ...merged.ssr,
9232
- external: mergeExternal(_optionalChain([farmConfig, 'access', _466 => _466.ssr, 'optionalAccess', _467 => _467.external]), _optionalChain([userConfig, 'access', _468 => _468.ssr, 'optionalAccess', _469 => _469.external]))
9380
+ external: mergeExternal(_optionalChain([farmConfig, 'access', _469 => _469.ssr, 'optionalAccess', _470 => _470.external]), _optionalChain([userConfig, 'access', _471 => _471.ssr, 'optionalAccess', _472 => _472.external]))
9233
9381
  }
9234
9382
  };
9235
9383
  }
@@ -9300,14 +9448,15 @@ function reportOpenAPIDevGenerationResult(spec, output = _chunk5QIKR7RRcjs.logge
9300
9448
  _chunkS3JO3N4Hcjs.__name.call(void 0, reportOpenAPIDevGenerationResult, "reportOpenAPIDevGenerationResult");
9301
9449
 
9302
9450
  // src/vite.ts
9451
+ var SERVER_FN_TRANSFORM_PLUGIN = "@farm.js/plugin/rsc:server-fn-actions";
9303
9452
  function farmLlmsTxtGeneratedPaths(config) {
9304
- const llms = _chunkISTFC3MZcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _470 => _470.agent, 'optionalAccess', _471 => _471.llmsTxt]));
9453
+ const llms = _chunkISTFC3MZcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _473 => _473.agent, 'optionalAccess', _474 => _474.llmsTxt]));
9305
9454
  if (!llms.enabled) return [];
9306
9455
  return llms.full ? ["/llms.txt", "/llms-full.txt"] : ["/llms.txt"];
9307
9456
  }
9308
9457
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmLlmsTxtGeneratedPaths, "farmLlmsTxtGeneratedPaths");
9309
9458
  function farmAgentGeneratedPaths(config) {
9310
- const crawlers = _chunkISTFC3MZcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _472 => _472.agent, 'optionalAccess', _473 => _473.crawlers]));
9459
+ const crawlers = _chunkISTFC3MZcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _475 => _475.agent, 'optionalAccess', _476 => _476.crawlers]));
9311
9460
  return [...farmLlmsTxtGeneratedPaths(config), ...crawlers.enabled ? ["/robots.txt"] : []];
9312
9461
  }
9313
9462
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmAgentGeneratedPaths, "farmAgentGeneratedPaths");
@@ -9353,7 +9502,7 @@ function loadFarmWorkflowsDevRuntime() {
9353
9502
  }
9354
9503
  _chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
9355
9504
  function loadFarmDevtoolsSnapshotRuntime() {
9356
- return import("./devtools-R6MDDAZK.cjs");
9505
+ return import("./devtools-6DQHO7EK.cjs");
9357
9506
  }
9358
9507
  _chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
9359
9508
  function loadFarmDevtoolsUIRuntime() {
@@ -9369,7 +9518,7 @@ function farmI18nClientBridgePlugin() {
9369
9518
  name: "farm:i18n-client-bridge",
9370
9519
  enforce: "pre",
9371
9520
  resolveId(id, _importer, options) {
9372
- if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess', _474 => _474.ssr])) {
9521
+ if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess', _477 => _477.ssr])) {
9373
9522
  return FARM_I18N_CLIENT_BRIDGE_ID;
9374
9523
  }
9375
9524
  return null;
@@ -9387,7 +9536,7 @@ function farmServerOnlyEntriesPlugin() {
9387
9536
  name: "farm:server-only-entries",
9388
9537
  enforce: "pre",
9389
9538
  resolveId(id, importer, options) {
9390
- if (_optionalChain([options, 'optionalAccess', _475 => _475.ssr]) || !FARM_SERVER_ONLY_ENTRIES.has(id)) return null;
9539
+ if (_optionalChain([options, 'optionalAccess', _478 => _478.ssr]) || !FARM_SERVER_ONLY_ENTRIES.has(id)) return null;
9391
9540
  this.error(
9392
9541
  `${id} is server-only and cannot be imported into client code${importer ? ` (imported by ${importer})` : ""}. Use it from an API route or another server module.`
9393
9542
  );
@@ -9429,7 +9578,7 @@ function renderFarmI18nStaticHead(requestPath, snapshot) {
9429
9578
  }
9430
9579
  _chunkS3JO3N4Hcjs.__name.call(void 0, renderFarmI18nStaticHead, "renderFarmI18nStaticHead");
9431
9580
  function getPublicEnvDefine(config) {
9432
- const publicEnv = _optionalChain([config, 'access', _476 => _476.env, 'optionalAccess', _477 => _477.public]);
9581
+ const publicEnv = _optionalChain([config, 'access', _479 => _479.env, 'optionalAccess', _480 => _480.public]);
9433
9582
  if (!isResolvedEnvScope(publicEnv)) {
9434
9583
  return {};
9435
9584
  }
@@ -9470,7 +9619,7 @@ function withFarmRequestTracing(handler, apiRuntime, resolveTraceUrl = (request2
9470
9619
  return;
9471
9620
  }
9472
9621
  if (res.headersSent) {
9473
- _optionalChain([res, 'access', _478 => _478.destroy, 'optionalCall', _479 => _479(error instanceof Error ? error : new Error(String(error)))]);
9622
+ _optionalChain([res, 'access', _481 => _481.destroy, 'optionalCall', _482 => _482(error instanceof Error ? error : new Error(String(error)))]);
9474
9623
  return;
9475
9624
  }
9476
9625
  res.statusCode = 500;
@@ -9569,7 +9718,7 @@ function interceptFarmDevPageResponse(options) {
9569
9718
  const originalWrite = res.write.bind(res);
9570
9719
  const originalEnd = res.end.bind(res);
9571
9720
  const originalWriteHead = res.writeHead.bind(res);
9572
- const originalFlushHeaders = _optionalChain([res, 'access', _480 => _480.flushHeaders, 'optionalAccess', _481 => _481.bind, 'call', _482 => _482(res)]);
9721
+ const originalFlushHeaders = _optionalChain([res, 'access', _483 => _483.flushHeaders, 'optionalAccess', _484 => _484.bind, 'call', _485 => _485(res)]);
9573
9722
  let afterResponseCalled = false;
9574
9723
  let interceptedEnd = false;
9575
9724
  const htmlChunks = [];
@@ -9609,7 +9758,7 @@ function interceptFarmDevPageResponse(options) {
9609
9758
  const shouldBufferResponse = isHtmlResponse ? bufferPluginResponse : Boolean(runtimeSession && hasRuntimeAfterHook);
9610
9759
  if (shouldBufferResponse) {
9611
9760
  const callback = args.find((arg) => typeof arg === "function");
9612
- _optionalChain([callback, 'optionalCall', _483 => _483()]);
9761
+ _optionalChain([callback, 'optionalCall', _486 => _486()]);
9613
9762
  return true;
9614
9763
  }
9615
9764
  const writeResult = originalWrite(chunk, ...args);
@@ -9724,14 +9873,14 @@ function getEnvDefines(config, configEnv) {
9724
9873
  _chunkYFPGHF5Fcjs.getPublicFarmImageConfig.call(void 0, _chunkYFPGHF5Fcjs.resolveFarmImageConfig.call(void 0, config.images))
9725
9874
  )
9726
9875
  };
9727
- if (_optionalChain([configEnv, 'optionalAccess', _484 => _484.isSsrBuild])) {
9876
+ if (_optionalChain([configEnv, 'optionalAccess', _487 => _487.isSsrBuild])) {
9728
9877
  defines.__FARM_ENV__ = JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, getFullEnvDefine(config)));
9729
9878
  }
9730
9879
  return defines;
9731
9880
  }
9732
9881
  _chunkS3JO3N4Hcjs.__name.call(void 0, getEnvDefines, "getEnvDefines");
9733
9882
  function getFarmAPIBaseURLDefine(config) {
9734
- const baseURL = _optionalChain([config, 'access', _485 => _485.api, 'optionalAccess', _486 => _486.baseURL]);
9883
+ const baseURL = _optionalChain([config, 'access', _488 => _488.api, 'optionalAccess', _489 => _489.baseURL]);
9735
9884
  return typeof baseURL === "string" && baseURL ? baseURL : _chunkS3A45T7Fcjs.DEFAULT_FARM_API_BASE_PATH;
9736
9885
  }
9737
9886
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmAPIBaseURLDefine, "getFarmAPIBaseURLDefine");
@@ -9761,7 +9910,7 @@ function fileContainsProgrammaticPageRoute(file) {
9761
9910
  _chunkS3JO3N4Hcjs.__name.call(void 0, fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
9762
9911
  function rewriteEarlySsrRelativeImports(options) {
9763
9912
  const cleanId = options.id.split("?", 1)[0];
9764
- if (!path16.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
9913
+ if (!path17.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
9765
9914
  return null;
9766
9915
  }
9767
9916
  const replacements = [];
@@ -9781,7 +9930,7 @@ function rewriteEarlySsrRelativeImports(options) {
9781
9930
  const suffixIndex = source.value.search(/[?#]/);
9782
9931
  const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
9783
9932
  const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
9784
- const resolvedPath = path16.resolve(path16.dirname(cleanId), sourcePath);
9933
+ const resolvedPath = path17.resolve(path17.dirname(cleanId), sourcePath);
9785
9934
  replacements.push({
9786
9935
  start: source.start,
9787
9936
  end: source.end,
@@ -9821,9 +9970,9 @@ function transformIsolatedClientBoundaryModule(options) {
9821
9970
  transformedExports++;
9822
9971
  }, "addWrapper");
9823
9972
  for (const node of body) {
9824
- if (_optionalChain([node, 'optionalAccess', _487 => _487.type]) === "ExportDefaultDeclaration" && node.declaration) {
9973
+ if (_optionalChain([node, 'optionalAccess', _490 => _490.type]) === "ExportDefaultDeclaration" && node.declaration) {
9825
9974
  const declaration2 = node.declaration;
9826
- if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access', _488 => _488.id, 'optionalAccess', _489 => _489.name])) {
9975
+ if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access', _491 => _491.id, 'optionalAccess', _492 => _492.name])) {
9827
9976
  replacements.push({
9828
9977
  start: node.start,
9829
9978
  end: node.end,
@@ -9841,14 +9990,14 @@ function transformIsolatedClientBoundaryModule(options) {
9841
9990
  }
9842
9991
  continue;
9843
9992
  }
9844
- if (_optionalChain([node, 'optionalAccess', _490 => _490.type]) !== "ExportNamedDeclaration" || !node.declaration) continue;
9993
+ if (_optionalChain([node, 'optionalAccess', _493 => _493.type]) !== "ExportNamedDeclaration" || !node.declaration) continue;
9845
9994
  const declaration = node.declaration;
9846
9995
  const declaredNames = [];
9847
- if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access', _491 => _491.id, 'optionalAccess', _492 => _492.name])) {
9996
+ if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access', _494 => _494.id, 'optionalAccess', _495 => _495.name])) {
9848
9997
  declaredNames.push(declaration.id.name);
9849
9998
  } else if (declaration.type === "VariableDeclaration") {
9850
9999
  for (const declarator of declaration.declarations || []) {
9851
- if (_optionalChain([declarator, 'access', _493 => _493.id, 'optionalAccess', _494 => _494.type]) === "Identifier") declaredNames.push(declarator.id.name);
10000
+ if (_optionalChain([declarator, 'access', _496 => _496.id, 'optionalAccess', _497 => _497.type]) === "Identifier") declaredNames.push(declarator.id.name);
9852
10001
  }
9853
10002
  }
9854
10003
  const componentNames = declaredNames.filter((name) => /^[A-Z]/.test(name));
@@ -9912,7 +10061,7 @@ function warnClientBoundaryOnce(context, id, code, config) {
9912
10061
  } catch (e27) {
9913
10062
  return;
9914
10063
  }
9915
- const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access', _495 => _495.env, 'optionalAccess', _496 => _496.public]), () => ( {}))));
10064
+ const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access', _498 => _498.env, 'optionalAccess', _499 => _499.public]), () => ( {}))));
9916
10065
  const findings = analyzeClientBoundary(program, publicKeys);
9917
10066
  if (findings.envKeys.length === 0 && findings.publicEnvKeys.length === 0 && findings.builtinImports.length === 0) {
9918
10067
  return;
@@ -9922,7 +10071,7 @@ function warnClientBoundaryOnce(context, id, code, config) {
9922
10071
  }
9923
10072
  _chunkS3JO3N4Hcjs.__name.call(void 0, warnClientBoundaryOnce, "warnClientBoundaryOnce");
9924
10073
  function shouldEmitFarmClientRootHmr(renderer) {
9925
- return _chunkTFAXUHWXcjs.getFarmRendererCapabilities.call(void 0, _chunkTFAXUHWXcjs.resolveFarmRenderer.call(void 0, renderer)).reconcilesRerenders;
10074
+ return _chunkPSV6XKPOcjs.getFarmRendererCapabilities.call(void 0, _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, renderer)).reconcilesRerenders;
9926
10075
  }
9927
10076
  _chunkS3JO3N4Hcjs.__name.call(void 0, shouldEmitFarmClientRootHmr, "shouldEmitFarmClientRootHmr");
9928
10077
  function hasViteAlias(alias, find) {
@@ -9941,6 +10090,7 @@ function farmPlugin(options = {}, initialPluginManager) {
9941
10090
  publicDir: options.publicDir
9942
10091
  });
9943
10092
  let farmApp;
10093
+ let serverFnTransformActive = false;
9944
10094
  let server;
9945
10095
  let apiRouteManager;
9946
10096
  let openAPIManager = null;
@@ -9963,7 +10113,7 @@ function farmPlugin(options = {}, initialPluginManager) {
9963
10113
  config(userConfig, configEnv) {
9964
10114
  isBuild = configEnv.command === "build";
9965
10115
  const layerAliases = _chunkY4YMF2NQcjs.getFarmLayerAliases.call(void 0, options.layers);
9966
- const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _497 => _497.resolve, 'optionalAccess', _498 => _498.alias]), "@") ? {} : createFarmSourceAlias(options.root || process.cwd(), options.srcDir);
10116
+ const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _500 => _500.resolve, 'optionalAccess', _501 => _501.alias]), "@") ? {} : createFarmSourceAlias(options.root || process.cwd(), options.srcDir);
9967
10117
  const layerRoots = (_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.root);
9968
10118
  return {
9969
10119
  // Honor Farm's publicDir so the dev server serves the same static
@@ -9979,7 +10129,7 @@ function farmPlugin(options = {}, initialPluginManager) {
9979
10129
  ...layerRoots.length ? {
9980
10130
  server: {
9981
10131
  fs: {
9982
- allow: [path16.resolve(options.root || process.cwd()), ...layerRoots]
10132
+ allow: [path17.resolve(options.root || process.cwd()), ...layerRoots]
9983
10133
  }
9984
10134
  }
9985
10135
  } : {}
@@ -9989,6 +10139,14 @@ function farmPlugin(options = {}, initialPluginManager) {
9989
10139
  if (typeof fontImports.configResolved === "function") {
9990
10140
  await fontImports.configResolved.call(this, config);
9991
10141
  }
10142
+ serverFnTransformActive = config.plugins.some(
10143
+ (plugin) => plugin.name === SERVER_FN_TRANSFORM_PLUGIN
10144
+ );
10145
+ if (_optionalChain([options, 'access', _502 => _502.experimental, 'optionalAccess', _503 => _503.serverActions]) === true && !serverFnTransformActive) {
10146
+ _chunk5QIKR7RRcjs.logger.warn(
10147
+ "experimental.serverActions has no effect without @farm.js/plugin/rsc in the Vite plugins. Server functions stay server-only, and importing one from client code is a build error."
10148
+ );
10149
+ }
9992
10150
  },
9993
10151
  async configureServer(viteServer) {
9994
10152
  if (typeof fontImports.configureServer === "function") {
@@ -10012,7 +10170,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10012
10170
  );
10013
10171
  await farmApp.initialize();
10014
10172
  const farmConfig = farmApp.getConfig();
10015
- if (_optionalChain([farmConfig, 'access', _499 => _499.agent, 'optionalAccess', _500 => _500.noindexPreviews])) {
10173
+ if (_optionalChain([farmConfig, 'access', _504 => _504.agent, 'optionalAccess', _505 => _505.noindexPreviews])) {
10016
10174
  server.middlewares.use((_req, res, next) => {
10017
10175
  if (_chunkCXP5U3RWcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
10018
10176
  res.setHeader("X-Robots-Tag", _chunkISTFC3MZcjs.FARM_PREVIEW_ROBOTS_TAG);
@@ -10031,7 +10189,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10031
10189
  validateRemoteUrl: createNodeImageUrlValidator(farmConfig.images),
10032
10190
  // Vite owns this address. Unlike request.url, it cannot be replaced by
10033
10191
  // a caller-controlled Host header.
10034
- trustedLocalOrigin: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _optionalChain([server, 'access', _501 => _501.resolvedUrls, 'optionalAccess', _502 => _502.local, 'access', _503 => _503[0]]), "trustedLocalOrigin"),
10192
+ trustedLocalOrigin: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _optionalChain([server, 'access', _506 => _506.resolvedUrls, 'optionalAccess', _507 => _507.local, 'access', _508 => _508[0]]), "trustedLocalOrigin"),
10035
10193
  onError(error) {
10036
10194
  _chunk5QIKR7RRcjs.logger.error(
10037
10195
  `Image optimization failed: ${error instanceof Error ? error.message : String(error)}`
@@ -10040,7 +10198,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10040
10198
  });
10041
10199
  }
10042
10200
  const sourceRoots = _chunkY4YMF2NQcjs.getFarmSourceRoots.call(void 0, farmConfig);
10043
- server.watcher.add(sourceRoots.map((source) => path16.join(source.root, source.srcDir)));
10201
+ server.watcher.add(sourceRoots.map((source) => path17.join(source.root, source.srcDir)));
10044
10202
  if (farmConfig.i18n.enabled) {
10045
10203
  server.watcher.add(
10046
10204
  farmConfig.i18n.locales.map(
@@ -10051,15 +10209,15 @@ function farmPlugin(options = {}, initialPluginManager) {
10051
10209
  const workflowConfig = farmConfig.workflows;
10052
10210
  const farmDocsDevRuntime = farmConfig.docs.enabled ? await loadFarmDocsDevRuntime() : null;
10053
10211
  const getExtraRouteTypes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => [
10054
- ..._optionalChain([options, 'access', _504 => _504.openapi, 'optionalAccess', _505 => _505.enabled]) && options.openapi.route ? [options.openapi.route] : [],
10055
- ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _506 => _506.getFarmDocsRouteTypeEntries, 'call', _507 => _507(farmConfig.docs)]), () => ( []))
10212
+ ..._optionalChain([options, 'access', _509 => _509.openapi, 'optionalAccess', _510 => _510.enabled]) && options.openapi.route ? [options.openapi.route] : [],
10213
+ ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _511 => _511.getFarmDocsRouteTypeEntries, 'call', _512 => _512(farmConfig.docs)]), () => ( []))
10056
10214
  ], "getExtraRouteTypes");
10057
10215
  const appDirSlugs = sourceRoots.map(
10058
- (source) => path16.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
10216
+ (source) => path17.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
10059
10217
  );
10060
10218
  const generateTypeArtifacts = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
10061
10219
  try {
10062
- const result = await _chunkXFFQSD2Fcjs.generateFarmTypeArtifacts.call(void 0, {
10220
+ const result = await _chunkSO7CRMP6cjs.generateFarmTypeArtifacts.call(void 0, {
10063
10221
  root: farmConfig.root,
10064
10222
  srcDir: farmConfig.srcDir,
10065
10223
  layers: farmConfig.layers,
@@ -10096,13 +10254,13 @@ function farmPlugin(options = {}, initialPluginManager) {
10096
10254
  }, "generateTypeArtifacts");
10097
10255
  await generateTypeArtifacts("startup");
10098
10256
  const srcDirSlugs = sourceRoots.map(
10099
- (source) => path16.join(source.root, source.srcDir).replace(/\\/g, "/")
10257
+ (source) => path17.join(source.root, source.srcDir).replace(/\\/g, "/")
10100
10258
  );
10101
10259
  const layerConfigFiles = new Set(
10102
- farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _508 => _508.configFile, 'optionalAccess', _509 => _509.replace, 'call', _510 => _510(/\\/g, "/")])).filter((file) => Boolean(file))
10260
+ farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _513 => _513.configFile, 'optionalAccess', _514 => _514.replace, 'call', _515 => _515(/\\/g, "/")])).filter((file) => Boolean(file))
10103
10261
  );
10104
10262
  const routeModuleExtensions = /* @__PURE__ */ new Set([
10105
- ..._chunkTFAXUHWXcjs.resolveFarmComponentExtensions.call(void 0, farmConfig.renderer.componentExtensions),
10263
+ ..._chunkPSV6XKPOcjs.resolveFarmComponentExtensions.call(void 0, farmConfig.renderer.componentExtensions),
10106
10264
  ".md",
10107
10265
  ".mdx"
10108
10266
  ]);
@@ -10178,7 +10336,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10178
10336
  scheduleTypeArtifactGen(file, ev, typeArtifacts);
10179
10337
  }
10180
10338
  if (isI18nCatalogFile(file)) {
10181
- _optionalChain([farmApp, 'optionalAccess', _511 => _511.getI18nRuntime, 'call', _512 => _512(), 'access', _513 => _513.reload, 'call', _514 => _514(), 'access', _515 => _515.then, 'call', _516 => _516(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _517 => _517.catch, 'call', _518 => _518((error) => _chunk5QIKR7RRcjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
10339
+ _optionalChain([farmApp, 'optionalAccess', _516 => _516.getI18nRuntime, 'call', _517 => _517(), 'access', _518 => _518.reload, 'call', _519 => _519(), 'access', _520 => _520.then, 'call', _521 => _521(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _522 => _522.catch, 'call', _523 => _523((error) => _chunk5QIKR7RRcjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
10182
10340
  }
10183
10341
  const isRouteRefreshEvent = (ev !== "change" || isStaticMetadataImageFile2(file)) && (isAppRuntimeFile(file) || isProgrammaticRouteFile(file) || isProgrammaticRouteSourceFile(file) && (ev === "unlink" || fileContainsProgrammaticPageRoute(file)));
10184
10342
  if (isRouteRefreshEvent) {
@@ -10191,8 +10349,8 @@ function farmPlugin(options = {}, initialPluginManager) {
10191
10349
  const reloadsMiddleware = pendingRouteRefreshIncludesMiddleware;
10192
10350
  pendingRouteRefreshIncludesMiddleware = false;
10193
10351
  Promise.all([
10194
- _optionalChain([refreshRouteDiscovery, 'optionalCall', _519 => _519(`${ev} ${file}`)]),
10195
- reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _520 => _520.reload, 'call', _521 => _521()]) : void 0
10352
+ _optionalChain([refreshRouteDiscovery, 'optionalCall', _524 => _524(`${ev} ${file}`)]),
10353
+ reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _525 => _525.reload, 'call', _526 => _526()]) : void 0
10196
10354
  ]).then(() => server.ws.send({ type: "full-reload", path: "*" })).catch((error) => _chunk5QIKR7RRcjs.logger.warn(`Route refresh failed: ${error.message}`));
10197
10355
  }, 50);
10198
10356
  }
@@ -10235,7 +10393,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10235
10393
  await apiRouteManager.discoverRoutes();
10236
10394
  let discoveredWorkflows = [];
10237
10395
  const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
10238
- (dir) => fs9.existsSync(path16.isAbsolute(dir) ? dir : path16.join(farmConfig.root, dir))
10396
+ (dir) => fs9.existsSync(path17.isAbsolute(dir) ? dir : path17.join(farmConfig.root, dir))
10239
10397
  );
10240
10398
  if (hasWorkflowDirectory) {
10241
10399
  const { createFarmWorkflowRequestHandler, discoverFarmWorkflows } = await loadFarmWorkflowsDevRuntime();
@@ -10281,11 +10439,11 @@ function farmPlugin(options = {}, initialPluginManager) {
10281
10439
  });
10282
10440
  }
10283
10441
  }
10284
- if (_optionalChain([options, 'access', _522 => _522.openapi, 'optionalAccess', _523 => _523.enabled])) {
10442
+ if (_optionalChain([options, 'access', _527 => _527.openapi, 'optionalAccess', _528 => _528.enabled])) {
10285
10443
  const { OpenAPIManager } = await loadFarmOpenAPIDevRuntime();
10286
10444
  openAPIManager = new OpenAPIManager(appDirs, options.openapi, {
10287
10445
  mode: "development",
10288
- apiBaseURL: typeof _optionalChain([options, 'access', _524 => _524.api, 'optionalAccess', _525 => _525.baseURL]) === "string" ? options.api.baseURL : void 0
10446
+ apiBaseURL: typeof _optionalChain([options, 'access', _529 => _529.api, 'optionalAccess', _530 => _530.baseURL]) === "string" ? options.api.baseURL : void 0
10289
10447
  });
10290
10448
  const spec = await openAPIManager.generateSpec();
10291
10449
  reportOpenAPIDevGenerationResult(spec);
@@ -10324,13 +10482,13 @@ function farmPlugin(options = {}, initialPluginManager) {
10324
10482
  ),
10325
10483
  loadModule: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (specifier) => {
10326
10484
  const resolved = await server.environments.ssr.pluginContainer.resolveId(specifier);
10327
- if (specifier === _optionalChain([farmConfig, 'access', _526 => _526.docs, 'access', _527 => _527.adapter, 'optionalAccess', _528 => _528.server]) && _optionalChain([resolved, 'optionalAccess', _529 => _529.id])) {
10485
+ if (specifier === _optionalChain([farmConfig, 'access', _531 => _531.docs, 'access', _532 => _532.adapter, 'optionalAccess', _533 => _533.server]) && _optionalChain([resolved, 'optionalAccess', _534 => _534.id])) {
10328
10486
  return import(
10329
10487
  /* @vite-ignore */
10330
10488
  _url.pathToFileURL.call(void 0, resolved.id).href
10331
10489
  );
10332
10490
  }
10333
- return _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _530 => _530.id]), () => ( specifier)));
10491
+ return _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _535 => _535.id]), () => ( specifier)));
10334
10492
  }, "loadModule")
10335
10493
  }) : farmDocsDevRuntime.createFarmDocsHandler(farmConfig.docs, {
10336
10494
  root: farmConfig.root,
@@ -10345,7 +10503,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10345
10503
  )
10346
10504
  }) : null;
10347
10505
  const wrapFarmDocsResponseWithLayouts = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (request2, response) => {
10348
- if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _531 => _531.headers, 'access', _532 => _532.get, 'call', _533 => _533("content-type"), 'optionalAccess', _534 => _534.toLowerCase, 'call', _535 => _535(), 'access', _536 => _536.includes, 'call', _537 => _537("text/html")])) {
10506
+ if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _536 => _536.headers, 'access', _537 => _537.get, 'call', _538 => _538("content-type"), 'optionalAccess', _539 => _539.toLowerCase, 'call', _540 => _540(), 'access', _541 => _541.includes, 'call', _542 => _542("text/html")])) {
10349
10507
  return response;
10350
10508
  }
10351
10509
  const pathname = new URL(request2.url).pathname;
@@ -10366,9 +10524,9 @@ function farmPlugin(options = {}, initialPluginManager) {
10366
10524
  headers: response.headers
10367
10525
  });
10368
10526
  }
10369
- const docsRenderer = _chunkTFAXUHWXcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _538 => _538.getConfig, 'call', _539 => _539()]), () => ( options))).renderer);
10527
+ const docsRenderer = _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _543 => _543.getConfig, 'call', _544 => _544()]), () => ( options))).renderer);
10370
10528
  const [rendererRuntime, layoutModules] = await Promise.all([
10371
- _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") : _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, docsRenderer.server),
10529
+ _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") : _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, docsRenderer.server),
10372
10530
  Promise.all(
10373
10531
  layoutEntries.map((layout) => routeManager.loadLayoutModule(layout.modulePath))
10374
10532
  )
@@ -10395,7 +10553,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10395
10553
  ])
10396
10554
  );
10397
10555
  const inlineValue = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e"), "inlineValue");
10398
- const pageModulePath = _optionalChain([matchedRoute, 'access', _540 => _540.route, 'optionalAccess', _541 => _541.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
10556
+ const pageModulePath = _optionalChain([matchedRoute, 'access', _545 => _545.route, 'optionalAccess', _546 => _546.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
10399
10557
  const bootstrapScript = `<script>
10400
10558
  window.__FARM_PROPS__ = ${inlineValue({ params })};
10401
10559
  window.__FARM_ROUTE_SLOTS__ = [];
@@ -10489,7 +10647,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10489
10647
  }, "dispatch")
10490
10648
  },
10491
10649
  (request2) => {
10492
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _542 => _542.getConfig, 'call', _543 => _543()]), () => ( options));
10650
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _547 => _547.getConfig, 'call', _548 => _548()]), () => ( options));
10493
10651
  const currentServerConfig = _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
10494
10652
  return _chunk5ZSWG4UXcjs.resolveFarmRequestURL.call(void 0, request2, {
10495
10653
  trustProxy: currentServerConfig.trustProxy
@@ -10500,7 +10658,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10500
10658
  withAPIRequestTracing(async (req, res, next) => {
10501
10659
  const requestUrl = req.url || "/";
10502
10660
  const requestMethod = req.method || "GET";
10503
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _544 => _544.getConfig, 'call', _545 => _545()]), () => ( options));
10661
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _549 => _549.getConfig, 'call', _550 => _550()]), () => ( options));
10504
10662
  const currentServerConfig = _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
10505
10663
  const parsedRequestUrl = _chunk5ZSWG4UXcjs.resolveFarmRequestURL.call(void 0, req, {
10506
10664
  trustProxy: currentServerConfig.trustProxy
@@ -10590,7 +10748,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10590
10748
  return;
10591
10749
  }
10592
10750
  const runAppMiddlewareForContentRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
10593
- if (!_optionalChain([middlewareManager, 'optionalAccess', _546 => _546.hasMiddleware, 'call', _547 => _547()])) return false;
10751
+ if (!_optionalChain([middlewareManager, 'optionalAccess', _551 => _551.hasMiddleware, 'call', _552 => _552()])) return false;
10594
10752
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
10595
10753
  return runFarmMiddlewareWithNavigation(
10596
10754
  farmApp.getServerRenderer(),
@@ -10601,7 +10759,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10601
10759
  );
10602
10760
  }, "runAppMiddlewareForContentRoute");
10603
10761
  const openAPIRequestPathname = openAPIManager ? _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) : requestPathname;
10604
- if (openAPIManager && _optionalChain([options, 'access', _548 => _548.openapi, 'optionalAccess', _549 => _549.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
10762
+ if (openAPIManager && _optionalChain([options, 'access', _553 => _553.openapi, 'optionalAccess', _554 => _554.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
10605
10763
  if (await runAppMiddlewareForContentRoute()) return;
10606
10764
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
10607
10765
  res.statusCode = 405;
@@ -10618,7 +10776,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10618
10776
  res.end(requestMethod === "HEAD" ? void 0 : body);
10619
10777
  return;
10620
10778
  }
10621
- if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _550 => _550.openapi, 'optionalAccess', _551 => _551.route])) {
10779
+ if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _555 => _555.openapi, 'optionalAccess', _556 => _556.route])) {
10622
10780
  if (await runAppMiddlewareForContentRoute()) return;
10623
10781
  const docsHandler = openAPIManager.getDocsRouteHandler(parsedRequestUrl.origin);
10624
10782
  return docsHandler(req, res);
@@ -10658,7 +10816,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10658
10816
  config: farmApp.getConfig().mdx,
10659
10817
  resolveSource: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (pathname2) => {
10660
10818
  const match = farmApp.getRouteManager().matchRoute(pathname2);
10661
- const sourcePath = _optionalChain([match, 'access', _552 => _552.route, 'optionalAccess', _553 => _553.markdownSourcePath]) || (match.route && _chunkAH7HOAQ3cjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
10819
+ const sourcePath = _optionalChain([match, 'access', _557 => _557.route, 'optionalAccess', _558 => _558.markdownSourcePath]) || (match.route && _chunkAH7HOAQ3cjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
10662
10820
  if (!sourcePath) {
10663
10821
  return null;
10664
10822
  }
@@ -10766,7 +10924,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10766
10924
  "beforeRequest",
10767
10925
  (plugin) => {
10768
10926
  const owner = _chunkZ5HIWVDPcjs.getFarmIntegrationPluginOwner.call(void 0, plugin);
10769
- return plugin.name !== _chunkYZTASLPQcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME && (_optionalChain([owner, 'optionalAccess', _554 => _554.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
10927
+ return plugin.name !== _chunkYZTASLPQcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME && (_optionalChain([owner, 'optionalAccess', _559 => _559.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
10770
10928
  },
10771
10929
  req,
10772
10930
  res
@@ -10896,7 +11054,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10896
11054
  const apiHandler = apiRouteManager.getHandler({ throwOnError: true });
10897
11055
  const hasExplicitAPIRoute = hasMatchedApiRoute || Boolean(apiRouteManager.matchRoute(pathname2));
10898
11056
  if (apiHandler && hasExplicitAPIRoute) {
10899
- const apiRoutePattern = _optionalChain([matchedApiRoute, 'optionalAccess', _555 => _555.route, 'access', _556 => _556.path]) || _optionalChain([apiRouteManager, 'access', _557 => _557.matchRoute, 'call', _558 => _558(pathname2), 'optionalAccess', _559 => _559.route, 'access', _560 => _560.path]) || urlPath2;
11057
+ const apiRoutePattern = _optionalChain([matchedApiRoute, 'optionalAccess', _560 => _560.route, 'access', _561 => _561.path]) || _optionalChain([apiRouteManager, 'access', _562 => _562.matchRoute, 'call', _563 => _563(pathname2), 'optionalAccess', _564 => _564.route, 'access', _565 => _565.path]) || urlPath2;
10900
11058
  _chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, {
10901
11059
  type: "route.matched",
10902
11060
  pathname: pathname2,
@@ -10986,7 +11144,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
10986
11144
  return;
10987
11145
  }
10988
11146
  }
10989
- if (farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _561 => _561.isFarmDocsAPIRequest, 'call', _562 => _562(pathname2)])) {
11147
+ if (farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _566 => _566.isFarmDocsAPIRequest, 'call', _567 => _567(pathname2)])) {
10990
11148
  try {
10991
11149
  const url = `http://${req.headers.host || "localhost:3000"}${req.url}`;
10992
11150
  const headers = new Headers();
@@ -11059,18 +11217,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11059
11217
  res.end(JSON.stringify({ error: "API route not found", pathname: pathname2 }));
11060
11218
  return;
11061
11219
  }
11062
- if (_optionalChain([req, 'access', _563 => _563.url, 'optionalAccess', _564 => _564.startsWith, 'call', _565 => _565("/@")]) || _optionalChain([req, 'access', _566 => _566.url, 'optionalAccess', _567 => _567.startsWith, 'call', _568 => _568("/node_modules")])) {
11220
+ if (_optionalChain([req, 'access', _568 => _568.url, 'optionalAccess', _569 => _569.startsWith, 'call', _570 => _570("/@")]) || _optionalChain([req, 'access', _571 => _571.url, 'optionalAccess', _572 => _572.startsWith, 'call', _573 => _573("/node_modules")])) {
11063
11221
  return next();
11064
11222
  }
11065
11223
  if (shouldBypassFarmRouterForDottedPath(
11066
11224
  requestPathname,
11067
- _optionalChain([farmApp, 'optionalAccess', _569 => _569.getRouteManager, 'call', _570 => _570()]),
11225
+ _optionalChain([farmApp, 'optionalAccess', _574 => _574.getRouteManager, 'call', _575 => _575()]),
11068
11226
  [server.config.publicDir, server.config.root],
11069
11227
  farmAgentGeneratedPaths(farmConfig)
11070
11228
  )) {
11071
11229
  return next();
11072
11230
  }
11073
- if (_optionalChain([req, 'access', _571 => _571.url, 'optionalAccess', _572 => _572.startsWith, 'call', _573 => _573("/__farm/page-data")])) {
11231
+ if (_optionalChain([req, 'access', _576 => _576.url, 'optionalAccess', _577 => _577.startsWith, 'call', _578 => _578("/__farm/page-data")])) {
11074
11232
  const urlObj = parsedRequestUrl;
11075
11233
  const targetPath = urlObj.searchParams.get("path") || "/";
11076
11234
  try {
@@ -11098,7 +11256,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11098
11256
  });
11099
11257
  let middlewareMap = /* @__PURE__ */ new Map();
11100
11258
  let middlewareContext = /* @__PURE__ */ new Map();
11101
- if (_optionalChain([middlewareManager, 'optionalAccess', _574 => _574.hasMiddleware, 'call', _575 => _575()])) {
11259
+ if (_optionalChain([middlewareManager, 'optionalAccess', _579 => _579.hasMiddleware, 'call', _580 => _580()])) {
11102
11260
  const targetNodeRequest = createPageDataMiddlewareRequest(req, targetRequestUrl);
11103
11261
  const handled = await runFarmMiddlewareWithNavigation(
11104
11262
  farmApp.getServerRenderer(),
@@ -11126,10 +11284,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11126
11284
  if (pm) {
11127
11285
  await pm.runHookParallel("afterRouteMatch", {
11128
11286
  pathname: targetPath,
11129
- matched: !!_optionalChain([match, 'optionalAccess', _576 => _576.route]),
11130
- routePattern: _optionalChain([match, 'optionalAccess', _577 => _577.route, 'optionalAccess', _578 => _578.pattern]) || null,
11131
- params: _optionalChain([match, 'optionalAccess', _579 => _579.params]) || {},
11132
- layoutPatterns: (_optionalChain([match, 'optionalAccess', _580 => _580.layouts]) || []).map((l) => l.pattern)
11287
+ matched: !!_optionalChain([match, 'optionalAccess', _581 => _581.route]),
11288
+ routePattern: _optionalChain([match, 'optionalAccess', _582 => _582.route, 'optionalAccess', _583 => _583.pattern]) || null,
11289
+ params: _optionalChain([match, 'optionalAccess', _584 => _584.params]) || {},
11290
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _585 => _585.layouts]) || []).map((l) => l.pattern)
11133
11291
  });
11134
11292
  }
11135
11293
  if (!match) {
@@ -11266,7 +11424,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11266
11424
  pageShouldHydrate: shouldHydrate,
11267
11425
  layoutShouldHydrate: shouldHydrateLayout,
11268
11426
  islandStrategy: hydrationIslandStrategy,
11269
- rendering: _chunkXFFQSD2Fcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
11427
+ rendering: _chunkSO7CRMP6cjs.resolveRouteRenderingConfig.call(void 0, routeModule)
11270
11428
  });
11271
11429
  const destinationLayoutPatterns = layouts.map((layout) => layout.pattern);
11272
11430
  const layoutStartIndex = getSharedLayoutPrefixLength(
@@ -11280,7 +11438,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11280
11438
  middlewareContext,
11281
11439
  () => renderer.renderNavigationFragment({
11282
11440
  PageComponent: routeModule.default,
11283
- LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _581 => _581.default]),
11441
+ LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _586 => _586.default]),
11284
11442
  pageProps: routeProps,
11285
11443
  params,
11286
11444
  layouts: layouts.map((layout, index) => ({
@@ -11386,14 +11544,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11386
11544
  trustProxy: currentServerConfig.trustProxy
11387
11545
  }).pathname;
11388
11546
  const routeManager2 = farmApp.getRouteManager();
11389
- const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _582 => _582.hasHook, 'call', _583 => _583("beforeRouteMatch")]), () => ( false));
11390
- const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _584 => _584.hasHook, 'call', _585 => _585("afterRouteMatch")]), () => ( false));
11391
- const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _586 => _586.hasHook, 'call', _587 => _587("beforeRequest")]), () => ( false));
11392
- const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _588 => _588.hasHook, 'call', _589 => _589("beforeRender")]), () => ( false));
11393
- const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _590 => _590.hasHook, 'call', _591 => _591("afterResponse")]), () => ( false));
11394
- const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _592 => _592.hasHook, 'call', _593 => _593("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _594 => _594.hasHook, 'call', _595 => _595("afterRender")]), () => ( false)));
11395
- const hasRuntimeRequestHooks = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _596 => _596.hasRuntimeRequestHooks, 'call', _597 => _597()]), () => ( false));
11396
- const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _598 => _598.hasRuntimeHook, 'call', _599 => _599("after")]), () => ( false));
11547
+ const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _587 => _587.hasHook, 'call', _588 => _588("beforeRouteMatch")]), () => ( false));
11548
+ const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _589 => _589.hasHook, 'call', _590 => _590("afterRouteMatch")]), () => ( false));
11549
+ const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _591 => _591.hasHook, 'call', _592 => _592("beforeRequest")]), () => ( false));
11550
+ const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _593 => _593.hasHook, 'call', _594 => _594("beforeRender")]), () => ( false));
11551
+ const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _595 => _595.hasHook, 'call', _596 => _596("afterResponse")]), () => ( false));
11552
+ const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _597 => _597.hasHook, 'call', _598 => _598("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _599 => _599.hasHook, 'call', _600 => _600("afterRender")]), () => ( false)));
11553
+ const hasRuntimeRequestHooks = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _601 => _601.hasRuntimeRequestHooks, 'call', _602 => _602()]), () => ( false));
11554
+ const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _603 => _603.hasRuntimeHook, 'call', _604 => _604("after")]), () => ( false));
11397
11555
  const requestedMatch = routeManager2.matchRoute(requestedPathname);
11398
11556
  let runtimeSession;
11399
11557
  if (pm && hasRuntimeRequestHooks) {
@@ -11404,8 +11562,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11404
11562
  kind: "page",
11405
11563
  route: {
11406
11564
  pathname: requestedPathname,
11407
- pattern: _optionalChain([requestedMatch, 'optionalAccess', _600 => _600.route, 'optionalAccess', _601 => _601.pattern]) || null,
11408
- params: _optionalChain([requestedMatch, 'optionalAccess', _602 => _602.params]) || {}
11565
+ pattern: _optionalChain([requestedMatch, 'optionalAccess', _605 => _605.route, 'optionalAccess', _606 => _606.pattern]) || null,
11566
+ params: _optionalChain([requestedMatch, 'optionalAccess', _607 => _607.params]) || {}
11409
11567
  }
11410
11568
  }
11411
11569
  );
@@ -11438,17 +11596,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11438
11596
  if (pm && hasAfterRouteMatchHook) {
11439
11597
  await pm.runHookParallel("afterRouteMatch", {
11440
11598
  pathname,
11441
- matched: !!_optionalChain([routeMatch, 'optionalAccess', _603 => _603.route]),
11442
- routePattern: _optionalChain([routeMatch, 'optionalAccess', _604 => _604.route, 'optionalAccess', _605 => _605.pattern]) || null,
11443
- params: _optionalChain([routeMatch, 'optionalAccess', _606 => _606.params]) || {},
11444
- layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess', _607 => _607.layouts]) || []).map((l) => l.pattern)
11599
+ matched: !!_optionalChain([routeMatch, 'optionalAccess', _608 => _608.route]),
11600
+ routePattern: _optionalChain([routeMatch, 'optionalAccess', _609 => _609.route, 'optionalAccess', _610 => _610.pattern]) || null,
11601
+ params: _optionalChain([routeMatch, 'optionalAccess', _611 => _611.params]) || {},
11602
+ layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess', _612 => _612.layouts]) || []).map((l) => l.pattern)
11445
11603
  });
11446
11604
  }
11447
11605
  const renderPayload = {
11448
11606
  pathname,
11449
11607
  method,
11450
- routePattern: _optionalChain([routeMatch, 'optionalAccess', _608 => _608.route, 'optionalAccess', _609 => _609.pattern]) || null,
11451
- params: _optionalChain([routeMatch, 'optionalAccess', _610 => _610.params]) || {}
11608
+ routePattern: _optionalChain([routeMatch, 'optionalAccess', _613 => _613.route, 'optionalAccess', _614 => _614.pattern]) || null,
11609
+ params: _optionalChain([routeMatch, 'optionalAccess', _615 => _615.params]) || {}
11452
11610
  };
11453
11611
  const shouldInterceptResponse = Boolean(
11454
11612
  pm && (hasAfterResponseHook || hasHTMLTransformHook || runtimeSession && hasRuntimeAfterHook)
@@ -11470,7 +11628,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11470
11628
  emitError: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (error) => emitPluginError("response-end", error, { pathname }), "emitError")
11471
11629
  }) : void 0;
11472
11630
  try {
11473
- if (_optionalChain([middlewareManager, 'optionalAccess', _611 => _611.hasMiddleware, 'call', _612 => _612()])) {
11631
+ if (_optionalChain([middlewareManager, 'optionalAccess', _616 => _616.hasMiddleware, 'call', _617 => _617()])) {
11474
11632
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
11475
11633
  const handled = await runFarmMiddlewareWithNavigation(
11476
11634
  farmApp.getServerRenderer(),
@@ -11480,7 +11638,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11480
11638
  () => middlewareManager.execute(req, res)
11481
11639
  );
11482
11640
  if (handled) {
11483
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _613 => _613.isEnded, 'call', _614 => _614()])) {
11641
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _618 => _618.isEnded, 'call', _619 => _619()])) {
11484
11642
  const duration = Date.now() - startTime;
11485
11643
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
11486
11644
  }
@@ -11492,7 +11650,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11492
11650
  req.url || "/",
11493
11651
  `http://${req.headers.host || "localhost:3000"}`
11494
11652
  ).pathname;
11495
- const hasLocalPageRoute = Boolean(_optionalChain([routeManager2, 'access', _615 => _615.matchRoute, 'call', _616 => _616(currentPathname), 'optionalAccess', _617 => _617.route]));
11653
+ const hasLocalPageRoute = Boolean(_optionalChain([routeManager2, 'access', _620 => _620.matchRoute, 'call', _621 => _621(currentPathname), 'optionalAccess', _622 => _622.route]));
11496
11654
  await pm.runHookParallelFiltered(
11497
11655
  "beforeRequest",
11498
11656
  (plugin) => !hasLocalPageRoute || plugin.name !== _chunkYZTASLPQcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
@@ -11500,8 +11658,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11500
11658
  res
11501
11659
  );
11502
11660
  }
11503
- if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _618 => _618.isEnded, 'call', _619 => _619()])) {
11504
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _620 => _620.isEnded, 'call', _621 => _621()])) {
11661
+ if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _623 => _623.isEnded, 'call', _624 => _624()])) {
11662
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _625 => _625.isEnded, 'call', _626 => _626()])) {
11505
11663
  const duration = Date.now() - startTime;
11506
11664
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
11507
11665
  }
@@ -11559,36 +11717,36 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11559
11717
  if (imageModule) return imageModule;
11560
11718
  }
11561
11719
  if (_chunk6V4TDWECcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
11562
- const renderer = _optionalChain([farmApp, 'optionalAccess', _622 => _622.getConfig, 'call', _623 => _623(), 'access', _624 => _624.renderer]) || _chunkTFAXUHWXcjs.resolveFarmRenderer.call(void 0, options.renderer);
11563
- return generateProgrammaticRouteModule(id, _optionalChain([server, 'optionalAccess', _625 => _625.config, 'access', _626 => _626.root]) || options.root, renderer);
11720
+ const renderer = _optionalChain([farmApp, 'optionalAccess', _627 => _627.getConfig, 'call', _628 => _628(), 'access', _629 => _629.renderer]) || _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, options.renderer);
11721
+ return generateProgrammaticRouteModule(id, _optionalChain([server, 'optionalAccess', _630 => _630.config, 'access', _631 => _631.root]) || options.root, renderer);
11564
11722
  }
11565
11723
  if (isFarmClientVirtualId(id)) {
11566
- const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _627 => _627.getConfig, 'call', _628 => _628()]);
11567
- const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _629 => _629.renderer]) || _chunkTFAXUHWXcjs.resolveFarmRenderer.call(void 0, options.renderer);
11568
- const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _630 => _630.integrations]) || options.integrations;
11569
- const root = _optionalChain([resolvedConfig, 'optionalAccess', _631 => _631.root]) || _optionalChain([server, 'optionalAccess', _632 => _632.config, 'access', _633 => _633.root]) || process.cwd();
11570
- const docs = _optionalChain([resolvedConfig, 'optionalAccess', _634 => _634.docs]);
11724
+ const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _632 => _632.getConfig, 'call', _633 => _633()]);
11725
+ const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _634 => _634.renderer]) || _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, options.renderer);
11726
+ const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _635 => _635.integrations]) || options.integrations;
11727
+ const root = _optionalChain([resolvedConfig, 'optionalAccess', _636 => _636.root]) || _optionalChain([server, 'optionalAccess', _637 => _637.config, 'access', _638 => _638.root]) || process.cwd();
11728
+ const docs = _optionalChain([resolvedConfig, 'optionalAccess', _639 => _639.docs]);
11571
11729
  const adapterOwnsDocsRuntime = Boolean(
11572
- _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _635 => _635.adapter, 'optionalAccess', _636 => _636.server]) && docs.adapter.react
11730
+ _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _640 => _640.adapter, 'optionalAccess', _641 => _641.server]) && docs.adapter.react
11573
11731
  );
11574
- const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _637 => _637.devtools]), () => ( _chunkYJRZR7VUcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
11732
+ const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _642 => _642.devtools]), () => ( _chunkYJRZR7VUcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
11575
11733
  const [docsRuntime, docsSearchRuntime, devtoolsClientRuntime] = await Promise.all([
11576
- _optionalChain([docs, 'optionalAccess', _638 => _638.enabled]) ? loadFarmDocsDevRuntime() : null,
11577
- _optionalChain([docs, 'optionalAccess', _639 => _639.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
11734
+ _optionalChain([docs, 'optionalAccess', _643 => _643.enabled]) ? loadFarmDocsDevRuntime() : null,
11735
+ _optionalChain([docs, 'optionalAccess', _644 => _644.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
11578
11736
  devtools.enabled ? loadFarmDevtoolsClientRuntime() : null
11579
11737
  ]);
11580
- const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _640 => _640.isFarmDocsSearchEnabled, 'call', _641 => _641(docs)]), () => ( false));
11738
+ const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _645 => _645.isFarmDocsSearchEnabled, 'call', _646 => _646(docs)]), () => ( false));
11581
11739
  const generatedDocsSearchRuntime = docsSearchRuntime ? docsSearchRuntime.generateFarmDocsSearchClientRuntime(
11582
11740
  docsSearchEnabled,
11583
11741
  docsSearchEnabled ? docsSearchRuntime.resolveFarmDocsSearchClientModule(root) : void 0
11584
11742
  ) : EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME;
11585
11743
  const generatedDevtoolsClientRuntime = devtoolsClientRuntime ? devtoolsClientRuntime.generateFarmDevtoolsClientRuntime(devtools) : "";
11586
11744
  const generatedDevIndicatorsClientRuntime = farmApp ? _chunkQBPXNZGVcjs.generateFarmDevIndicatorsClientRuntime.call(void 0, farmApp.getConfig().devIndicators) : "";
11587
- const integrationProviders = _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, renderer) ? _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, integrations) : [];
11745
+ const integrationProviders = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, integrations) : [];
11588
11746
  const isolatedHydrationMode = resolveFarmIsolatedClientHydrationMode(
11589
- _optionalChain([resolvedConfig, 'optionalAccess', _642 => _642.experimental, 'optionalAccess', _643 => _643.isolatedClientHydration]),
11747
+ _optionalChain([resolvedConfig, 'optionalAccess', _647 => _647.experimental, 'optionalAccess', _648 => _648.isolatedClientHydration]),
11590
11748
  {
11591
- serverComponents: _optionalChain([resolvedConfig, 'optionalAccess', _644 => _644.experimental, 'optionalAccess', _645 => _645.serverComponents]) === true,
11749
+ serverComponents: _optionalChain([resolvedConfig, 'optionalAccess', _649 => _649.experimental, 'optionalAccess', _650 => _650.serverComponents]) === true,
11592
11750
  hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
11593
11751
  }
11594
11752
  );
@@ -11596,31 +11754,31 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11596
11754
  integrationProviders,
11597
11755
  [
11598
11756
  ..._chunkZ5HIWVDPcjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
11599
- ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _646 => _646.getFarmDocsDocumentNavigationMatchers, 'call', _647 => _647(docs)]), () => ( []))
11757
+ ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _651 => _651.getFarmDocsDocumentNavigationMatchers, 'call', _652 => _652(docs)]), () => ( []))
11600
11758
  ],
11601
11759
  generatedDocsSearchRuntime,
11602
11760
  `${generatedDevtoolsClientRuntime}
11603
11761
  ${generatedDevIndicatorsClientRuntime}`,
11604
- _optionalChain([resolvedConfig, 'optionalAccess', _648 => _648.plugins]) || [],
11762
+ _optionalChain([resolvedConfig, 'optionalAccess', _653 => _653.plugins]) || [],
11605
11763
  root,
11606
- _optionalChain([resolvedConfig, 'optionalAccess', _649 => _649.srcDir]) || options.srcDir || "src",
11607
- _optionalChain([resolvedConfig, 'optionalAccess', _650 => _650.publicRuntimeConfig]) || options.publicRuntimeConfig,
11608
- _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _651 => _651.adapter, 'optionalAccess', _652 => _652.react]) : void 0,
11764
+ _optionalChain([resolvedConfig, 'optionalAccess', _654 => _654.srcDir]) || options.srcDir || "src",
11765
+ _optionalChain([resolvedConfig, 'optionalAccess', _655 => _655.publicRuntimeConfig]) || options.publicRuntimeConfig,
11766
+ _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _656 => _656.adapter, 'optionalAccess', _657 => _657.react]) : void 0,
11609
11767
  renderer,
11610
- isolatedHydrationMode === "enabled" || _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _653 => _653.getRouteManager, 'call', _654 => _654(), 'access', _655 => _655.getIsolatedClientBoundaryModules, 'call', _656 => _656(root)])))), 'optionalAccess', _657 => _657.size]) > 0,
11611
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _658 => _658.trailingSlash]), () => ( false)),
11612
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _659 => _659.basePath]), () => ( "/")),
11768
+ isolatedHydrationMode === "enabled" || _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _658 => _658.getRouteManager, 'call', _659 => _659(), 'access', _660 => _660.getIsolatedClientBoundaryModules, 'call', _661 => _661(root)])))), 'optionalAccess', _662 => _662.size]) > 0,
11769
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _663 => _663.trailingSlash]), () => ( false)),
11770
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _664 => _664.basePath]), () => ( "/")),
11613
11771
  generateClientCachePersistenceCode(
11614
- resolveFarmClientCacheAdapterEntry(root, _optionalChain([resolvedConfig, 'optionalAccess', _660 => _660.cache]))
11772
+ resolveFarmClientCacheAdapterEntry(root, _optionalChain([resolvedConfig, 'optionalAccess', _665 => _665.cache]))
11615
11773
  ),
11616
- _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, renderer) ? _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0
11774
+ _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0
11617
11775
  );
11618
11776
  }
11619
11777
  if (id === "/@farm/server") {
11620
11778
  return generateServerCode();
11621
11779
  }
11622
11780
  if (id === "/@farm/manifest") {
11623
- const routeManager = _optionalChain([farmApp, 'optionalAccess', _661 => _661.getRouteManager, 'call', _662 => _662()]);
11781
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _666 => _666.getRouteManager, 'call', _667 => _667()]);
11624
11782
  if (!routeManager) {
11625
11783
  return `
11626
11784
  export const getManifest = () => ({
@@ -11635,7 +11793,7 @@ export const getManifest = () => ({
11635
11793
  const manifest = routeManager.generateClientManifest(server.config.root);
11636
11794
  const globalStylesheetHref = resolveDevGlobalStylesheetHref(
11637
11795
  server.config.root,
11638
- _optionalChain([farmApp, 'optionalAccess', _663 => _663.getConfig, 'call', _664 => _664(), 'access', _665 => _665.srcDir])
11796
+ _optionalChain([farmApp, 'optionalAccess', _668 => _668.getConfig, 'call', _669 => _669(), 'access', _670 => _670.srcDir])
11639
11797
  );
11640
11798
  const fullManifest = {
11641
11799
  clientEntry: "/@farm/client.js",
@@ -11686,17 +11844,17 @@ export const manifest = getManifest();
11686
11844
  }
11687
11845
  },
11688
11846
  async transform(code, id, transformOptions) {
11689
- if (!_optionalChain([transformOptions, 'optionalAccess', _666 => _666.ssr])) {
11690
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _667 => _667.getConfig, 'call', _668 => _668()]), () => ( options));
11691
- if (_optionalChain([currentConfig, 'access', _669 => _669.experimental, 'optionalAccess', _670 => _670.serverActions]) !== true) {
11847
+ if (!_optionalChain([transformOptions, 'optionalAccess', _671 => _671.ssr])) {
11848
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _672 => _672.getConfig, 'call', _673 => _673()]), () => ( options));
11849
+ if (_optionalChain([currentConfig, 'access', _674 => _674.experimental, 'optionalAccess', _675 => _675.serverActions]) !== true || !serverFnTransformActive) {
11692
11850
  const violation = findClientServerFnViolation(code, id);
11693
11851
  if (violation) {
11694
11852
  this.error(formatServerFnBoundaryError(violation, id));
11695
11853
  }
11696
11854
  }
11697
11855
  }
11698
- if (!_optionalChain([transformOptions, 'optionalAccess', _671 => _671.ssr]) && shouldInspectClientBoundary(id, code)) {
11699
- warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _672 => _672.getConfig, 'call', _673 => _673()]), () => ( options)));
11856
+ if (!_optionalChain([transformOptions, 'optionalAccess', _676 => _676.ssr]) && shouldInspectClientBoundary(id, code)) {
11857
+ warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _677 => _677.getConfig, 'call', _678 => _678()]), () => ( options)));
11700
11858
  }
11701
11859
  if (typeof imageImports.transform === "function") {
11702
11860
  const imageModule = await imageImports.transform.call(this, code, id, transformOptions);
@@ -11711,13 +11869,13 @@ export const manifest = getManifest();
11711
11869
  id,
11712
11870
  transformOptions
11713
11871
  );
11714
- const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _674 => _674.code, 'optionalAccess', _675 => _675.toString, 'call', _676 => _676()]);
11872
+ const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _679 => _679.code, 'optionalAccess', _680 => _680.toString, 'call', _681 => _681()]);
11715
11873
  if (fontCode) {
11716
11874
  transformedCode = fontCode;
11717
11875
  transformed = true;
11718
11876
  }
11719
11877
  }
11720
- if (_optionalChain([transformOptions, 'optionalAccess', _677 => _677.ssr]) && server) {
11878
+ if (_optionalChain([transformOptions, 'optionalAccess', _682 => _682.ssr]) && server) {
11721
11879
  const rewrittenImports = rewriteEarlySsrRelativeImports({
11722
11880
  code: transformedCode,
11723
11881
  id,
@@ -11737,13 +11895,13 @@ export const manifest = getManifest();
11737
11895
  }
11738
11896
  transformedCode = stripUseClientDirective(transformedCode);
11739
11897
  transformed = true;
11740
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _678 => _678.getConfig, 'call', _679 => _679()]), () => ( options));
11898
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _683 => _683.getConfig, 'call', _684 => _684()]), () => ( options));
11741
11899
  let isolatedModuleReference = null;
11742
- const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _680 => _680.config, 'access', _681 => _681.root]) || process.cwd();
11900
+ const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _685 => _685.config, 'access', _686 => _686.root]) || process.cwd();
11743
11901
  const cleanId = id.split("?", 1)[0];
11744
- const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _682 => _682.getRouteManager, 'call', _683 => _683(), 'access', _684 => _684.getIsolatedClientBoundaryModules, 'call', _685 => _685(root)])));
11745
- const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _686 => _686.has, 'call', _687 => _687(path16.resolve(cleanId))]) === true;
11746
- if (_chunkTFAXUHWXcjs.isReactRenderer.call(void 0, _chunkTFAXUHWXcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && isIsolatableClientBoundarySource(clientBoundarySource)) {
11902
+ const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _687 => _687.getRouteManager, 'call', _688 => _688(), 'access', _689 => _689.getIsolatedClientBoundaryModules, 'call', _690 => _690(root)])));
11903
+ const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _691 => _691.has, 'call', _692 => _692(path17.resolve(cleanId))]) === true;
11904
+ if (_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && isIsolatableClientBoundarySource(clientBoundarySource)) {
11747
11905
  isolatedModuleReference = _chunk5QIKR7RRcjs.toViteModuleId.call(void 0, cleanId, root);
11748
11906
  const transformedBoundary = transformIsolatedClientBoundaryModule({
11749
11907
  code: transformedCode,
@@ -11779,7 +11937,7 @@ export const manifest = getManifest();
11779
11937
  );
11780
11938
  return;
11781
11939
  }` : "";
11782
- const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _688 => _688.ssr]) || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
11940
+ const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _693 => _693.ssr]) || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
11783
11941
  if (import.meta.hot) {
11784
11942
  import.meta.hot.accept((newModule) => {
11785
11943
  ${isolatedHmrUpdate}
@@ -11833,14 +11991,14 @@ if (import.meta.hot) {
11833
11991
  }
11834
11992
  _chunk5QIKR7RRcjs.logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
11835
11993
  _chunk5QIKR7RRcjs.logger.info("Pre-rendering SSG pages...");
11836
- const outDir = path16.join(_optionalChain([server, 'optionalAccess', _689 => _689.config, 'access', _690 => _690.root]) || process.cwd(), options.outDir || "dist");
11837
- const clientDir = path16.join(outDir, "client");
11994
+ const outDir = path17.join(_optionalChain([server, 'optionalAccess', _694 => _694.config, 'access', _695 => _695.root]) || process.cwd(), options.outDir || "dist");
11995
+ const clientDir = path17.join(outDir, "client");
11838
11996
  for (const page of ssgPages) {
11839
11997
  try {
11840
11998
  const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
11841
11999
  await farmApp.getServerRenderer().runWithRequestContext(staticRequest, async () => {
11842
12000
  const mod = await routeManager.loadRouteModule(page.filePath);
11843
- if (!_optionalChain([mod, 'optionalAccess', _691 => _691.default])) return;
12001
+ if (!_optionalChain([mod, 'optionalAccess', _696 => _696.default])) return;
11844
12002
  const { layouts } = routeManager.matchRoute(page.urlPath);
11845
12003
  const layoutModules = await Promise.all(
11846
12004
  layouts.map((l) => routeManager.loadLayoutModule(l.modulePath))
@@ -11872,7 +12030,7 @@ if (import.meta.hot) {
11872
12030
  const i18nSnapshot = _chunkUJ2C4ICScjs.getFarmI18nClientSnapshot.call(void 0, );
11873
12031
  const i18nHead = renderFarmI18nStaticHead(page.urlPath, i18nSnapshot);
11874
12032
  const fullHtml = `<!DOCTYPE html>
11875
- <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _692 => _692.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
12033
+ <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _697 => _697.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
11876
12034
  <head>
11877
12035
  <meta charset="utf-8">
11878
12036
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -11886,8 +12044,8 @@ if (import.meta.hot) {
11886
12044
  <script type="module" src="/assets/client.js"></script>
11887
12045
  </body>
11888
12046
  </html>`;
11889
- const outputPath = page.urlPath === "/" ? path16.join(clientDir, "index.html") : path16.join(clientDir, page.urlPath + ".html");
11890
- fs9.mkdirSync(path16.dirname(outputPath), { recursive: true });
12047
+ const outputPath = page.urlPath === "/" ? path17.join(clientDir, "index.html") : path17.join(clientDir, page.urlPath + ".html");
12048
+ fs9.mkdirSync(path17.dirname(outputPath), { recursive: true });
11891
12049
  fs9.writeFileSync(outputPath, fullHtml);
11892
12050
  const revalidateInfo = page.revalidate ? ` (revalidate: ${page.revalidate}s)` : "";
11893
12051
  _chunk5QIKR7RRcjs.logger.success(` \u2713 ${page.urlPath}${revalidateInfo}`);
@@ -11896,7 +12054,7 @@ if (import.meta.hot) {
11896
12054
  _chunk5QIKR7RRcjs.logger.error(` \u2717 ${page.urlPath}: ${error}`);
11897
12055
  }
11898
12056
  }
11899
- const manifestPath = path16.join(outDir, "__ssg_manifest.json");
12057
+ const manifestPath = path17.join(outDir, "__ssg_manifest.json");
11900
12058
  fs9.writeFileSync(
11901
12059
  manifestPath,
11902
12060
  JSON.stringify(
@@ -11930,23 +12088,23 @@ if (import.meta.hot) {
11930
12088
  });
11931
12089
  }
11932
12090
  }
11933
- const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _693 => _693.getConfig, 'call', _694 => _694()]);
12091
+ const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _698 => _698.getConfig, 'call', _699 => _699()]);
11934
12092
  const normalizedFile = file.replace(/\\/g, "/");
11935
12093
  if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) && _chunkY4YMF2NQcjs.getFarmAppDirectories.call(void 0, currentFarmConfig).some(
11936
12094
  (appDir) => normalizedFile.startsWith(`${_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appDir)}/api/`)
11937
12095
  )) {
11938
12096
  for (const mod of modules) server2.moduleGraph.invalidateModule(mod);
11939
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _695 => _695(`updated ${file}`)]);
12097
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _700 => _700(`updated ${file}`)]);
11940
12098
  server2.ws.send({ type: "full-reload", path: "*" });
11941
12099
  return [];
11942
12100
  }
11943
- const currentSrcRoot = currentFarmConfig ? _chunkY4YMF2NQcjs.getFarmSourceRoots.call(void 0, currentFarmConfig).map((source) => path16.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
12101
+ const currentSrcRoot = currentFarmConfig ? _chunkY4YMF2NQcjs.getFarmSourceRoots.call(void 0, currentFarmConfig).map((source) => path17.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
11944
12102
  if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && _chunk6V4TDWECcjs.isProgrammaticRoutesFileName.call(void 0, normalizedFile)) {
11945
- logUpdate("PAGE", `updated ${path16.basename(file)}`);
12103
+ logUpdate("PAGE", `updated ${path17.basename(file)}`);
11946
12104
  for (const mod of modules) {
11947
12105
  server2.moduleGraph.invalidateModule(mod);
11948
12106
  }
11949
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _696 => _696(`updated ${file}`)]);
12107
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _701 => _701(`updated ${file}`)]);
11950
12108
  server2.ws.send({
11951
12109
  type: "full-reload",
11952
12110
  path: "*"
@@ -11959,17 +12117,17 @@ if (import.meta.hot) {
11959
12117
  for (const mod of modules) {
11960
12118
  server2.moduleGraph.invalidateModule(mod);
11961
12119
  }
11962
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _697 => _697(`updated ${file}`)]);
12120
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _702 => _702(`updated ${file}`)]);
11963
12121
  server2.ws.send({
11964
12122
  type: "full-reload",
11965
12123
  path: "*"
11966
12124
  });
11967
12125
  return [];
11968
12126
  }
11969
- const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _698 => _698.experimental, 'optionalAccess', _699 => _699.isolatedClientHydration]);
11970
- const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _700 => _700.getRouteManager, 'call', _701 => _701()]);
12127
+ const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _703 => _703.experimental, 'optionalAccess', _704 => _704.isolatedClientHydration]);
12128
+ const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _705 => _705.getRouteManager, 'call', _706 => _706()]);
11971
12129
  const isHydrationPlanSource = currentSrcRoot !== null && normalizedFile.startsWith(`${currentSrcRoot}/`) && /\.[cm]?[jt]sx?$/.test(normalizedFile);
11972
- const tracksAsyncOwnerIslands = _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _702 => _702.renderer])) && planRouteManager !== void 0;
12130
+ const tracksAsyncOwnerIslands = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _707 => _707.renderer])) && planRouteManager !== void 0;
11973
12131
  if (isHydrationPlanSource && (isolatedHydrationMode === "enabled" || isolatedHydrationMode === "analyze" || tracksAsyncOwnerIslands)) {
11974
12132
  const routeManager = planRouteManager;
11975
12133
  if (routeManager) {
@@ -12029,7 +12187,7 @@ if (import.meta.hot) {
12029
12187
  }
12030
12188
  return [];
12031
12189
  }
12032
- _optionalChain([farmApp, 'optionalAccess', _703 => _703.getRouteManager, 'call', _704 => _704(), 'access', _705 => _705.invalidateClientManifest, 'call', _706 => _706()]);
12190
+ _optionalChain([farmApp, 'optionalAccess', _708 => _708.getRouteManager, 'call', _709 => _709(), 'access', _710 => _710.invalidateClientManifest, 'call', _711 => _711()]);
12033
12191
  const manifestModule = server2.moduleGraph.getModuleById("/@farm/manifest");
12034
12192
  if (manifestModule) {
12035
12193
  server2.moduleGraph.invalidateModule(manifestModule);
@@ -12073,10 +12231,10 @@ function createPageDataMiddlewareRequest(req, target) {
12073
12231
  _chunkS3JO3N4Hcjs.__name.call(void 0, createPageDataMiddlewareRequest, "createPageDataMiddlewareRequest");
12074
12232
  function resolveDevelopmentRoot(farmRoot, viteRoot) {
12075
12233
  if (!farmRoot) return viteRoot;
12076
- if (path16.resolve(farmRoot) === path16.resolve(viteRoot)) return farmRoot;
12234
+ if (path17.resolve(farmRoot) === path17.resolve(viteRoot)) return farmRoot;
12077
12235
  try {
12078
12236
  if (fs9.realpathSync(farmRoot) === fs9.realpathSync(viteRoot)) {
12079
- return path16.resolve(viteRoot);
12237
+ return path17.resolve(viteRoot);
12080
12238
  }
12081
12239
  } catch (e30) {
12082
12240
  }
@@ -12088,7 +12246,7 @@ function isFarmClientVirtualId(id) {
12088
12246
  return pathname === "/@farm/client" || pathname === "/@farm/client.js";
12089
12247
  }
12090
12248
  _chunkS3JO3N4Hcjs.__name.call(void 0, isFarmClientVirtualId, "isFarmClientVirtualId");
12091
- function generateProgrammaticRouteModule(moduleId, root, renderer = _chunkTFAXUHWXcjs.REACT_RENDERER) {
12249
+ function generateProgrammaticRouteModule(moduleId, root, renderer = _chunkPSV6XKPOcjs.REACT_RENDERER) {
12092
12250
  const parsed = _chunk6V4TDWECcjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
12093
12251
  if (!parsed) {
12094
12252
  return "";
@@ -12398,12 +12556,12 @@ async function parseRouteModuleProps2(routeModule, input) {
12398
12556
  }
12399
12557
  const schemas = routeModule.__farmRouteSchemas;
12400
12558
  const params = parseRouteModuleSchema2(
12401
- _optionalChain([schemas, 'optionalAccess', _707 => _707.params]),
12559
+ _optionalChain([schemas, 'optionalAccess', _712 => _712.params]),
12402
12560
  input.props.params,
12403
12561
  "params",
12404
12562
  input.routePath
12405
12563
  );
12406
- const search = parseRouteModuleSchema2(_optionalChain([schemas, 'optionalAccess', _708 => _708.search]), input.search, "search", input.routePath);
12564
+ const search = parseRouteModuleSchema2(_optionalChain([schemas, 'optionalAccess', _713 => _713.search]), input.search, "search", input.routePath);
12407
12565
  return {
12408
12566
  ...input.props,
12409
12567
  params,
@@ -12424,7 +12582,7 @@ function parseRouteModuleSchema2(schema, value, label, routePath) {
12424
12582
  }
12425
12583
  }
12426
12584
  _chunkS3JO3N4Hcjs.__name.call(void 0, parseRouteModuleSchema2, "parseRouteModuleSchema");
12427
- function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = _chunkTFAXUHWXcjs.REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
12585
+ function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
12428
12586
  const providerClientCode = generateFarmIntegrationProviderClientCode(
12429
12587
  integrationProviders,
12430
12588
  root,
@@ -12436,8 +12594,11 @@ function generateClientCode(integrationProviders = [], documentNavigationMatcher
12436
12594
  srcDir,
12437
12595
  publicRuntimeConfig
12438
12596
  );
12439
- const rendererClientImports = _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, renderer) ? `import React from 'react'
12440
- import { hydrateRoot, createRoot } from 'react-dom/client'` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
12597
+ const appSetupPath = _chunkPSV6XKPOcjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
12598
+ const rendererClientImports = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? `import React from 'react'
12599
+ import { hydrateRoot, createRoot } from 'react-dom/client'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
12600
+ import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toViteModuleId.call(void 0, appSetupPath, root))}
12601
+ __farmConfigureApp(__farmAppSetup)` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
12441
12602
  const isolatedHydrationImport = isolatedHydrationEnabled ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'` : "";
12442
12603
  const docsAdapterImportBlock = _chunk75WGQVQAcjs.generateFarmDocsAdapterClientRuntime.call(void 0,
12443
12604
  docsAdapterReact,
@@ -13285,7 +13446,7 @@ async function buildWrappedHydrationElement(PageComponent, pageProps, layouts =
13285
13446
  }
13286
13447
 
13287
13448
  function hydrateFarmRoute(container, route) {
13288
- ${_chunkTFAXUHWXcjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);"}
13449
+ ${_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);"}
13289
13450
  }
13290
13451
 
13291
13452
  function renderFarmRoute(root, route) {
@@ -13994,9 +14155,9 @@ function generateClientManifest(bundle) {
13994
14155
  }
13995
14156
  _chunkS3JO3N4Hcjs.__name.call(void 0, generateClientManifest, "generateClientManifest");
13996
14157
  async function defineConfig(config = {}) {
13997
- const tailwindcss = (await import("@tailwindcss/vite")).default;
13998
- const appRoot = path16.resolve(config.root || process.cwd());
13999
- if (_optionalChain([config, 'access', _709 => _709.extends, 'optionalAccess', _710 => _710.length])) {
14158
+ const tailwindVitePlugin = await loadTailwindVitePlugin();
14159
+ const appRoot = path17.resolve(config.root || process.cwd());
14160
+ if (_optionalChain([config, 'access', _714 => _714.extends, 'optionalAccess', _715 => _715.length])) {
14000
14161
  const { config: layeredConfig } = await import("./layers-E4WPJNY5.cjs").then(
14001
14162
  ({ resolveFarmLayers }) => resolveFarmLayers(config, {
14002
14163
  root: appRoot,
@@ -14005,8 +14166,8 @@ async function defineConfig(config = {}) {
14005
14166
  );
14006
14167
  config = layeredConfig;
14007
14168
  }
14008
- config.renderer = _chunkTFAXUHWXcjs.resolveFarmRenderer.call(void 0, config.renderer);
14009
- const rendererVitePlugins = await _chunkTFAXUHWXcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, appRoot, {
14169
+ config.renderer = _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, config.renderer);
14170
+ const rendererVitePlugins = await _chunkPSV6XKPOcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, appRoot, {
14010
14171
  ssr: true
14011
14172
  });
14012
14173
  const nodeBuiltinStubs = {
@@ -14096,13 +14257,13 @@ async function defineConfig(config = {}) {
14096
14257
  if (!serverStarted) {
14097
14258
  serverStarted = true;
14098
14259
  const elapsed = Date.now() - startTime;
14099
- const address = _optionalChain([server, 'access', _711 => _711.httpServer, 'optionalAccess', _712 => _712.address, 'call', _713 => _713()]);
14260
+ const address = _optionalChain([server, 'access', _716 => _716.httpServer, 'optionalAccess', _717 => _717.address, 'call', _718 => _718()]);
14100
14261
  const resolvedPort = typeof address === "object" && address ? address.port : server.config.server.port || port || 3e3;
14101
14262
  const hostConfig = server.config.server.host;
14102
14263
  const isExposed = hostConfig === true || hostConfig === "0.0.0.0";
14103
14264
  console.log("");
14104
14265
  console.log(
14105
- ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkA7T6JZNIcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
14266
+ ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunk2HCEC2YOcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
14106
14267
  );
14107
14268
  console.log("");
14108
14269
  console.log(
@@ -14135,7 +14296,7 @@ async function defineConfig(config = {}) {
14135
14296
  return {
14136
14297
  plugins: [
14137
14298
  createFarmThemeCssPlugin(config.theme, config.basePath),
14138
- tailwindcss(),
14299
+ tailwindVitePlugin,
14139
14300
  ...rendererVitePlugins,
14140
14301
  viteBrowserExternalPlugin,
14141
14302
  farmI18nClientBridgePlugin(),
@@ -14253,4 +14414,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, defineConfig, "defineConfig");
14253
14414
 
14254
14415
 
14255
14416
 
14256
- exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.RouteManager = RouteManager; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.FarmPluginOptionsError = FarmPluginOptionsError; exports.farmPluginMayAffectRuntimePath = farmPluginMayAffectRuntimePath; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin; exports.farmI18nClientBridgePlugin = farmI18nClientBridgePlugin; exports.farmServerOnlyEntriesPlugin = farmServerOnlyEntriesPlugin; exports.withFarmRequestTracing = withFarmRequestTracing; exports.rewriteEarlySsrRelativeImports = rewriteEarlySsrRelativeImports; exports.transformIsolatedClientBoundaryModule = transformIsolatedClientBoundaryModule; exports.shouldEmitFarmClientRootHmr = shouldEmitFarmClientRootHmr; exports.farmPlugin = farmPlugin; exports.defineConfig = defineConfig; exports.FARM_NODE_RESPONSE_END_PENDING = FARM_NODE_RESPONSE_END_PENDING; exports.FarmRuntimeShutdownError = FarmRuntimeShutdownError; exports.PluginManager = PluginManager; exports.definePlugin = definePlugin;
14417
+
14418
+ exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.RouteManager = RouteManager; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.FarmPluginOptionsError = FarmPluginOptionsError; exports.farmPluginMayAffectRuntimePath = farmPluginMayAffectRuntimePath; exports.loadTailwindVitePlugin = loadTailwindVitePlugin; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin; exports.farmI18nClientBridgePlugin = farmI18nClientBridgePlugin; exports.farmServerOnlyEntriesPlugin = farmServerOnlyEntriesPlugin; exports.withFarmRequestTracing = withFarmRequestTracing; exports.rewriteEarlySsrRelativeImports = rewriteEarlySsrRelativeImports; exports.transformIsolatedClientBoundaryModule = transformIsolatedClientBoundaryModule; exports.shouldEmitFarmClientRootHmr = shouldEmitFarmClientRootHmr; exports.farmPlugin = farmPlugin; exports.defineConfig = defineConfig; exports.FARM_NODE_RESPONSE_END_PENDING = FARM_NODE_RESPONSE_END_PENDING; exports.FarmRuntimeShutdownError = FarmRuntimeShutdownError; exports.PluginManager = PluginManager; exports.definePlugin = definePlugin;