@farm.js/core 0.1.64 → 0.1.65

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 (82) hide show
  1. package/dist/analyzer-GHWK46LX.cjs +16 -0
  2. package/dist/{analyzer-Q3QXC6PD.mjs → analyzer-PE33SK5W.mjs} +2 -2
  3. package/dist/{chunk-O4FWNLQK.mjs → chunk-2L54YV25.mjs} +10 -8
  4. package/dist/{chunk-S25BQIFW.cjs → chunk-32RPJAAS.cjs} +2 -2
  5. package/dist/{chunk-FAP7CX7C.cjs → chunk-3KJPIO5D.cjs} +526 -3018
  6. package/dist/{chunk-OYF23QLG.mjs → chunk-6X5NKNBE.mjs} +36 -32
  7. package/dist/{chunk-LQDLEWPO.mjs → chunk-72JSHQQQ.mjs} +1 -1
  8. package/dist/{chunk-WNYRYI4D.mjs → chunk-7GYCZRTH.mjs} +379 -2871
  9. package/dist/chunk-7QVRWGBL.cjs +3704 -0
  10. package/dist/{chunk-O2XFIPNL.cjs → chunk-A3G5IY2W.cjs} +1 -1
  11. package/dist/{chunk-NXFA7G3Y.cjs → chunk-C7DCMGC4.cjs} +4 -4
  12. package/dist/chunk-CJNAUEVC.mjs +34 -0
  13. package/dist/{chunk-O7IEMY55.cjs → chunk-CZF4XIRZ.cjs} +3 -3
  14. package/dist/{chunk-SLYDIHLW.mjs → chunk-E2TSYUHV.mjs} +2 -2
  15. package/dist/{chunk-VVTJTMGQ.cjs → chunk-GL7N5UHF.cjs} +4 -4
  16. package/dist/{chunk-6NHSGVVA.mjs → chunk-GRBJ7VKH.mjs} +1 -1
  17. package/dist/{chunk-UR25Z5Z6.mjs → chunk-HCGWDRZO.mjs} +1 -1
  18. package/dist/{chunk-FH45OB37.mjs → chunk-HKNYNSOK.mjs} +1 -1
  19. package/dist/{chunk-DUSHDZQL.cjs → chunk-IMK32ERL.cjs} +15 -13
  20. package/dist/{chunk-XVWSDSUM.mjs → chunk-IP2KHSGF.mjs} +4 -2
  21. package/dist/{chunk-MG356ROI.cjs → chunk-OSFIUSYK.cjs} +3 -3
  22. package/dist/{chunk-SNFTMSHX.mjs → chunk-Q75QPLBA.mjs} +1 -1
  23. package/dist/{chunk-WFNAOWH4.mjs → chunk-QHRCR44V.mjs} +2 -2
  24. package/dist/{chunk-JCPSA4X5.cjs → chunk-T4M52BA5.cjs} +116 -112
  25. package/dist/{chunk-PAKCHVUS.mjs → chunk-TPA2PV5J.mjs} +3 -35
  26. package/dist/{chunk-N3Z3PLHC.cjs → chunk-TRIDJQ6A.cjs} +6 -6
  27. package/dist/{chunk-3EBHJET2.cjs → chunk-TZOGZKI7.cjs} +380 -269
  28. package/dist/{chunk-BPNOYILC.cjs → chunk-UVV3I5QA.cjs} +3 -35
  29. package/dist/{chunk-RAH5MT53.mjs → chunk-VHHLKIDZ.mjs} +153 -42
  30. package/dist/{chunk-S7ZW72JH.cjs → chunk-WNXVWXG3.cjs} +2 -2
  31. package/dist/{chunk-XZLZ6YPP.cjs → chunk-YD4J37RN.cjs} +90 -33
  32. package/dist/{chunk-NNLFW3P4.mjs → chunk-YUW7F6SK.mjs} +1 -1
  33. package/dist/chunk-ZAUOOGER.mjs +3704 -0
  34. package/dist/chunk-ZIHWAN55.cjs +34 -0
  35. package/dist/{chunk-EL4364S2.cjs → chunk-ZQQK4U66.cjs} +4 -2
  36. package/dist/{chunk-6NNYPY5W.mjs → chunk-ZX2JHEWW.mjs} +59 -2
  37. package/dist/{devtools-MX3FE733.mjs → devtools-PUVZB3F2.mjs} +4 -3
  38. package/dist/{devtools-WET5NAKO.cjs → devtools-SGYOG36E.cjs} +5 -4
  39. package/dist/docs.cjs +6 -5
  40. package/dist/docs.mjs +5 -4
  41. package/dist/environment/vite.cjs +9 -2
  42. package/dist/environment/vite.d.mts +3 -0
  43. package/dist/environment/vite.d.ts +3 -0
  44. package/dist/environment/vite.mjs +8 -1
  45. package/dist/index.cjs +20 -19
  46. package/dist/index.mjs +19 -18
  47. package/dist/internal/build-runtime.cjs +18 -17
  48. package/dist/internal/build-runtime.mjs +17 -16
  49. package/dist/internal/cli-runtime.cjs +6 -5
  50. package/dist/internal/cli-runtime.mjs +5 -4
  51. package/dist/internal/client-error-overlay.cjs +4 -4
  52. package/dist/internal/client-error-overlay.mjs +1 -1
  53. package/dist/internal/config-runtime.cjs +6 -5
  54. package/dist/internal/config-runtime.mjs +5 -4
  55. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  56. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  57. package/dist/internal/native-server-fns.cjs +4 -4
  58. package/dist/internal/native-server-fns.mjs +3 -3
  59. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  60. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  61. package/dist/internal/production-runtime.cjs +5 -5
  62. package/dist/internal/production-runtime.d.mts +7 -0
  63. package/dist/internal/production-runtime.d.ts +7 -0
  64. package/dist/internal/production-runtime.mjs +4 -4
  65. package/dist/{native-tree-WOX3JMBG.cjs → native-tree-HE2FLS72.cjs} +2 -2
  66. package/dist/{native-tree-BPEE2LAL.mjs → native-tree-YF2DSPKM.mjs} +1 -1
  67. package/dist/plugin.cjs +11 -10
  68. package/dist/plugin.mjs +10 -9
  69. package/dist/{rsc-pipeline-3LNVP2OO.mjs → rsc-pipeline-T3PWURLJ.mjs} +6 -5
  70. package/dist/{rsc-pipeline-G5WELVW3.cjs → rsc-pipeline-V4ANLRAA.cjs} +7 -6
  71. package/dist/{runtime-DMEULPE7.cjs → runtime-5AROV2C3.cjs} +12 -11
  72. package/dist/{runtime-HQJ2LLQL.mjs → runtime-LRIQ3XH7.mjs} +9 -8
  73. package/dist/server.cjs +36 -35
  74. package/dist/server.mjs +19 -18
  75. package/dist/version.cjs +2 -2
  76. package/dist/version.mjs +1 -1
  77. package/dist/vite.cjs +14 -12
  78. package/dist/vite.mjs +13 -11
  79. package/package.json +1 -1
  80. package/dist/analyzer-ODLF2Z6O.cjs +0 -16
  81. package/dist/chunk-NK2VWS7P.cjs +0 -954
  82. package/dist/chunk-ZQ5BDNKW.mjs +0 -954
@@ -1,18 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/server-components-mode.ts
2
- function resolveFarmServerComponentsMode(value) {
3
- if (value === void 0 || value === null || value === false) return void 0;
4
- if (value === true) return "rsc";
5
- const mode = typeof value === "object" ? value.mode : void 0;
6
- if (mode === "rsc" || mode === "islands") return mode;
7
- throw new TypeError(
8
- 'experimental.serverComponents must be true, false, { mode: "rsc" } or { mode: "islands" }.'
9
- );
10
- }
11
- function isExplicitFarmServerComponentsMode(value) {
12
- return typeof value === "object" && value !== null;
13
- }
14
-
15
- // src/dev-indicators.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/dev-indicators.ts
16
2
  function resolveFarmDevIndicatorsConfig(config, mode = "development") {
17
3
  return {
18
4
  buildActivity: mode === "development" && (_nullishCoalesce(_optionalChain([config, 'optionalAccess', _ => _.buildActivity]), () => ( true))),
@@ -312,23 +298,9 @@ if (import.meta.hot) {
312
298
  `;
313
299
  }
314
300
 
315
- // src/utils/source-dir.ts
316
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
317
- var FARM_PROJECT_SOURCE_DIRS = /* @__PURE__ */ Symbol.for("farm.projectSourceDirs");
318
- function getProjectSourceDirs() {
319
- const globalState = globalThis;
320
- return _nullishCoalesce(globalState[FARM_PROJECT_SOURCE_DIRS], () => ( (globalState[FARM_PROJECT_SOURCE_DIRS] = /* @__PURE__ */ new Map())));
321
- }
322
- function setFarmProjectSourceDir(root, srcDir) {
323
- getProjectSourceDirs().set(_path2.default.resolve(root), srcDir);
324
- }
325
- function getFarmProjectSourceDir(root) {
326
- return _nullishCoalesce(getProjectSourceDirs().get(_path2.default.resolve(root)), () => ( "src"));
327
- }
328
-
329
301
  // src/auth-config.ts
330
302
  var _module = require('module');
331
-
303
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
332
304
  var _url = require('url');
333
305
  function resolveFarmAuthConfig(input) {
334
306
  const config = input === true ? {} : input && typeof input === "object" ? input : {};
@@ -443,8 +415,4 @@ function validateFarmAuthConfig(config) {
443
415
 
444
416
 
445
417
 
446
-
447
-
448
-
449
-
450
- exports.resolveFarmServerComponentsMode = resolveFarmServerComponentsMode; exports.isExplicitFarmServerComponentsMode = isExplicitFarmServerComponentsMode; exports.setFarmProjectSourceDir = setFarmProjectSourceDir; exports.getFarmProjectSourceDir = getFarmProjectSourceDir; exports.resolveFarmDevIndicatorsConfig = resolveFarmDevIndicatorsConfig; exports.generateFarmDevIndicatorsClientRuntime = generateFarmDevIndicatorsClientRuntime; exports.resolveFarmAuthConfig = resolveFarmAuthConfig; exports.resolveFarmAuthIntegration = resolveFarmAuthIntegration;
418
+ exports.resolveFarmDevIndicatorsConfig = resolveFarmDevIndicatorsConfig; exports.generateFarmDevIndicatorsClientRuntime = generateFarmDevIndicatorsClientRuntime; exports.resolveFarmAuthConfig = resolveFarmAuthConfig; exports.resolveFarmAuthIntegration = resolveFarmAuthIntegration;
@@ -16,33 +16,19 @@ import {
16
16
  createFarmClientOptimizeDepsEntries,
17
17
  createFarmSourceAlias,
18
18
  createFarmThemeCssPlugin,
19
- ensureFarmPackageClientReference,
20
19
  farmFontImportsPlugin,
21
- farmRelativeImportFiles,
22
20
  generateClientCachePersistenceCode,
23
21
  generateFarmClientPluginEntryCode,
24
22
  generateFarmIntegrationProviderClientCode,
25
- getClientModuleMetadata,
26
- getFarmClientReachableModules,
27
- getIslandStrategyExport,
28
- hasUseClientDirective,
29
23
  inferFarmIslandStrategy,
30
- invalidateFarmClientReachableModules,
31
24
  isFarmDocsClientConfigModule,
32
- isFarmPackageClientBoundary,
33
- isIsolatableClientBoundarySource,
34
25
  redactFarmDocsClientConfig,
35
26
  resolveDevGlobalStylesheetHref,
36
27
  resolveFarmAppPackages,
37
28
  resolveFarmClientCacheAdapterEntry,
38
29
  resolveFarmImageProviderForRuntime,
39
- resolveFarmIsolatedClientHydrationMode,
40
- resolveFarmRouteRootStrategy,
41
- resolveModuleSourcePath,
42
- rewriteFarmPackageClientImports,
43
- rewriteFarmReactServerImports,
44
- stripUseClientDirective
45
- } from "./chunk-WNYRYI4D.mjs";
30
+ resolveFarmRouteRootStrategy
31
+ } from "./chunk-7GYCZRTH.mjs";
46
32
  import {
47
33
  loadTailwindVitePlugin
48
34
  } from "./chunk-OM7WILES.mjs";
@@ -84,13 +70,13 @@ import {
84
70
  resolveFarmMCPRouteLabel,
85
71
  resolveFarmMarkdownRouteLabel,
86
72
  setFarmRouteLabel
87
- } from "./chunk-SLYDIHLW.mjs";
73
+ } from "./chunk-E2TSYUHV.mjs";
88
74
  import {
89
75
  FARM_DEFAULT_MCP_PATH
90
76
  } from "./chunk-MESQF2JC.mjs";
91
77
  import {
92
78
  isFarmPreviewDeploymentEnvironment
93
- } from "./chunk-SNFTMSHX.mjs";
79
+ } from "./chunk-Q75QPLBA.mjs";
94
80
  import {
95
81
  createFarmServerFnBoundaryModule,
96
82
  isFarmServerFnBoundaryId,
@@ -100,13 +86,31 @@ import {
100
86
  resolveFarmLayoutFonts
101
87
  } from "./chunk-HZOMT5DY.mjs";
102
88
  import {
89
+ FARM_CLIENT_REFERENCE_DIRECTORY,
90
+ FARM_CLIENT_REFERENCE_PRAGMA,
91
+ collectFarmServerBundledPackages,
92
+ ensureFarmPackageClientReference,
103
93
  farmBrowserBuiltinsOptimizerPlugin,
104
94
  farmEnvironmentFunctionsPlugin,
95
+ farmRelativeImportFiles,
105
96
  generateProgrammaticClientRouteModule,
97
+ getClientModuleMetadata,
98
+ getFarmClientReachableModules,
99
+ getIslandStrategyExport,
100
+ hasUseClientDirective,
101
+ invalidateFarmClientOnlyScan,
102
+ invalidateFarmClientReachableModules,
103
+ isFarmPackageClientBoundary,
104
+ isIsolatableClientBoundarySource,
106
105
  loadFarmBrowserBuiltin,
107
106
  programmaticClientRouteKey,
108
- resolveFarmBrowserBuiltin
109
- } from "./chunk-ZQ5BDNKW.mjs";
107
+ resolveFarmBrowserBuiltin,
108
+ resolveFarmIsolatedClientHydrationMode,
109
+ resolveModuleSourcePath,
110
+ rewriteFarmPackageClientImports,
111
+ rewriteFarmReactServerImports,
112
+ stripUseClientDirective
113
+ } from "./chunk-ZAUOOGER.mjs";
110
114
  import {
111
115
  generateFarmDocsAdapterClientRuntime,
112
116
  getFarmDocsAdapterConfigModule
@@ -116,23 +120,13 @@ import {
116
120
  toFarmDocsPublicFontAssets
117
121
  } from "./chunk-NRNAHZ57.mjs";
118
122
  import {
119
- generateFarmDevIndicatorsClientRuntime,
120
- resolveFarmServerComponentsMode
121
- } from "./chunk-PAKCHVUS.mjs";
123
+ generateFarmDevIndicatorsClientRuntime
124
+ } from "./chunk-TPA2PV5J.mjs";
122
125
  import {
123
126
  FARM_DEVTOOLS_LAUNCH_PARAM,
124
127
  FARM_DEVTOOLS_PATH,
125
128
  resolveFarmDevtoolsConfig
126
129
  } from "./chunk-CU5SYTJG.mjs";
127
- import {
128
- REACT_RENDERER,
129
- getFarmRendererCapabilities,
130
- isReactRenderer,
131
- loadFarmRendererVitePlugins,
132
- resolveFarmComponentExtensions,
133
- resolveFarmRenderer,
134
- resolveFarmRendererAppSetup
135
- } from "./chunk-ES2LD2YD.mjs";
136
130
  import {
137
131
  FARM_PREVIEW_ROBOTS_TAG,
138
132
  resolveFarmAgentCrawlers,
@@ -141,11 +135,23 @@ import {
141
135
  import {
142
136
  resolveFarmLlmsTxtConfig
143
137
  } from "./chunk-KL7SHLQB.mjs";
138
+ import {
139
+ resolveFarmServerComponentsMode
140
+ } from "./chunk-CJNAUEVC.mjs";
144
141
  import {
145
142
  getFarmAppDirectories,
146
143
  getFarmLayerAliases,
147
144
  getFarmSourceRoots
148
145
  } from "./chunk-52Y3C3HG.mjs";
146
+ import {
147
+ REACT_RENDERER,
148
+ getFarmRendererCapabilities,
149
+ isReactRenderer,
150
+ loadFarmRendererVitePlugins,
151
+ resolveFarmComponentExtensions,
152
+ resolveFarmRenderer,
153
+ resolveFarmRendererAppSetup
154
+ } from "./chunk-ES2LD2YD.mjs";
149
155
  import {
150
156
  getPublicFarmImageConfig,
151
157
  resolveFarmImageConfig
@@ -257,7 +263,7 @@ import {
257
263
  } from "./chunk-QDWMCFTH.mjs";
258
264
  import {
259
265
  FARM_VERSION
260
- } from "./chunk-LQDLEWPO.mjs";
266
+ } from "./chunk-72JSHQQQ.mjs";
261
267
  import {
262
268
  DEFAULT_FARM_API_BASE_PATH
263
269
  } from "./chunk-W6QLRQ3V.mjs";
@@ -880,7 +886,7 @@ function loadFarmWorkflowsDevRuntime() {
880
886
  return import("./workflows.mjs");
881
887
  }
882
888
  function loadFarmDevtoolsSnapshotRuntime() {
883
- return import("./devtools-MX3FE733.mjs");
889
+ return import("./devtools-PUVZB3F2.mjs");
884
890
  }
885
891
  function loadFarmDevtoolsUIRuntime() {
886
892
  return import("./devtools-ui-CYBVFLPH.mjs");
@@ -923,11 +929,17 @@ function farmServerOnlyEntriesPlugin(options = {}) {
923
929
  return {
924
930
  name: "farm:server-only-entries",
925
931
  enforce: "pre",
926
- config() {
932
+ config(config) {
927
933
  return {
928
934
  optimizeDeps: { rolldownOptions: { plugins: [farmBrowserBuiltinsOptimizerPlugin()] } },
929
- // Resolve `server-only` here rather than in Node, which would load its throwing build.
930
- ssr: { noExternal: [SERVER_ONLY_PACKAGE] }
935
+ ssr: {
936
+ noExternal: [
937
+ // Resolve `server-only` here rather than in Node, which would load its throwing build.
938
+ SERVER_ONLY_PACKAGE,
939
+ // Packages Node cannot load as a bundler does (stylesheet imports, `module`-only ESM).
940
+ ...collectFarmServerBundledPackages(path6.resolve(config.root ?? process.cwd()))
941
+ ]
942
+ }
931
943
  };
932
944
  },
933
945
  configResolved(config) {
@@ -1157,23 +1169,86 @@ function interceptFarmDevPageResponse(options) {
1157
1169
  const contentType = typeof contentTypeHeader === "string" ? contentTypeHeader : "";
1158
1170
  return contentType.includes("text/html") ? bufferPluginResponse : Boolean(runtimeSession && hasRuntimeAfterHook);
1159
1171
  };
1172
+ let runtimeStream;
1173
+ const streamsThroughRuntime = () => {
1174
+ if (runtimeStream) return true;
1175
+ if (!runtimeSession || !hasRuntimeAfterHook) return false;
1176
+ if (!hasHTMLTransformHook) return true;
1177
+ const contentTypeHeader = res.getHeader("content-type") || res.getHeader("Content-Type");
1178
+ return !(typeof contentTypeHeader === "string" && contentTypeHeader.includes("text/html"));
1179
+ };
1180
+ const startRuntimeStream = () => {
1181
+ if (runtimeStream) return runtimeStream;
1182
+ let controller;
1183
+ const body = new ReadableStream({
1184
+ start(streamController) {
1185
+ controller = streamController;
1186
+ }
1187
+ });
1188
+ const status = res.statusCode || 200;
1189
+ const canHaveBody = method !== "HEAD" && status !== 204 && status !== 205 && status !== 304;
1190
+ pm.copyRequestContext(req, runtimeSession.request);
1191
+ const done = pm.endRuntimeRequest(
1192
+ runtimeSession,
1193
+ new Response(canHaveBody ? body : null, {
1194
+ status,
1195
+ headers: createHeadersFromNodeResponse(res)
1196
+ })
1197
+ ).then(async (runtimeResponse) => {
1198
+ applyWebResponseToNodeResponse(runtimeResponse, res);
1199
+ if (!res.headersSent) originalWriteHead(res.statusCode);
1200
+ originalFlushHeaders?.();
1201
+ if (!runtimeResponse.body) return;
1202
+ const reader = runtimeResponse.body.getReader();
1203
+ for (; ; ) {
1204
+ const chunk = await reader.read();
1205
+ if (chunk.done) break;
1206
+ originalWrite(chunk.value);
1207
+ if (typeof res.flush === "function") res.flush();
1208
+ }
1209
+ });
1210
+ done.catch(() => {
1211
+ });
1212
+ runtimeStream = { controller, done };
1213
+ return runtimeStream;
1214
+ };
1215
+ const streamRuntimeChunk = (chunk) => {
1216
+ const stream = startRuntimeStream();
1217
+ if (!chunk || chunk.byteLength === 0) return;
1218
+ try {
1219
+ stream.controller.enqueue(new Uint8Array(chunk));
1220
+ } catch {
1221
+ }
1222
+ };
1160
1223
  res.writeHead = ((statusCode, ...args) => {
1161
1224
  const statusMessage = typeof args[0] === "string" ? args[0] : void 0;
1162
1225
  const headers = statusMessage === void 0 ? args[0] : args[1];
1163
1226
  res.statusCode = statusCode;
1164
1227
  if (statusMessage !== void 0) res.statusMessage = statusMessage;
1165
1228
  applyNodeWriteHeadHeaders(res, headers);
1166
- if (shouldBufferCurrentResponse()) return res;
1229
+ if (streamsThroughRuntime() || shouldBufferCurrentResponse()) return res;
1167
1230
  return statusMessage === void 0 ? originalWriteHead(statusCode) : originalWriteHead(statusCode, statusMessage);
1168
1231
  });
1169
1232
  if (originalFlushHeaders) {
1170
- res.flushHeaders = (() => shouldBufferCurrentResponse() ? void 0 : originalFlushHeaders());
1233
+ res.flushHeaders = (() => {
1234
+ if (streamsThroughRuntime()) {
1235
+ startRuntimeStream();
1236
+ return void 0;
1237
+ }
1238
+ return shouldBufferCurrentResponse() ? void 0 : originalFlushHeaders();
1239
+ });
1171
1240
  }
1172
1241
  res.write = ((chunk, ...args) => {
1173
1242
  const contentTypeHeader = res.getHeader("content-type") || res.getHeader("Content-Type");
1174
1243
  const contentType = typeof contentTypeHeader === "string" ? contentTypeHeader : "";
1175
1244
  const isHtmlResponse = contentType.includes("text/html");
1176
1245
  const bufferChunk = toNodeResponseBuffer(chunk, args[0]);
1246
+ if (streamsThroughRuntime()) {
1247
+ streamRuntimeChunk(bufferChunk);
1248
+ const callback = args.find((arg) => typeof arg === "function");
1249
+ callback?.();
1250
+ return true;
1251
+ }
1177
1252
  if (isHtmlResponse && bufferChunk) {
1178
1253
  htmlChunks.push(bufferChunk);
1179
1254
  didStreamHtml = true;
@@ -1198,6 +1273,39 @@ function interceptFarmDevPageResponse(options) {
1198
1273
  options.logResponse(method, urlPath, res.statusCode || 200, Date.now() - startTime, "PAGE");
1199
1274
  const originalEndArgs = [...args];
1200
1275
  const callback = typeof originalEndArgs[originalEndArgs.length - 1] === "function" ? originalEndArgs[originalEndArgs.length - 1] : void 0;
1276
+ const restore = () => {
1277
+ res.write = originalWrite;
1278
+ res.end = originalEnd;
1279
+ res.writeHead = originalWriteHead;
1280
+ if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1281
+ delete res[FARM_NODE_RESPONSE_END_PENDING];
1282
+ };
1283
+ if (streamsThroughRuntime()) {
1284
+ const stream = startRuntimeStream();
1285
+ streamRuntimeChunk(toNodeResponseBuffer(args[0], args[1]));
1286
+ try {
1287
+ stream.controller.close();
1288
+ } catch {
1289
+ }
1290
+ stream.done.then(
1291
+ () => hasAfterResponseHook ? pm.runHookParallel("afterResponse", req, res) : void 0
1292
+ ).catch((error) => {
1293
+ void options.emitError(error);
1294
+ console.error("Error in afterResponse hook:", error);
1295
+ if (!res.headersSent) {
1296
+ res.statusCode = 500;
1297
+ res.removeHeader("Content-Length");
1298
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
1299
+ originalWriteHead(500);
1300
+ originalWrite("Internal Server Error");
1301
+ }
1302
+ }).finally(() => {
1303
+ restore();
1304
+ if (callback) originalEnd(callback);
1305
+ else originalEnd();
1306
+ });
1307
+ return res;
1308
+ }
1201
1309
  const contentTypeHeader = res.getHeader("content-type") || res.getHeader("Content-Type");
1202
1310
  const contentType = typeof contentTypeHeader === "string" ? contentTypeHeader : "";
1203
1311
  const isHtmlResponse = contentType.includes("text/html");
@@ -1385,6 +1493,7 @@ function transformIsolatedClientBoundaryModule(options) {
1385
1493
  return null;
1386
1494
  }
1387
1495
  const body = Array.isArray(ast.body) ? ast.body : [];
1496
+ const everyExportIsComponent = options.code.includes(FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(FARM_CLIENT_REFERENCE_DIRECTORY);
1388
1497
  const replacements = [];
1389
1498
  const wrapperStatements = [];
1390
1499
  const originalEntries = [];
@@ -1430,7 +1539,7 @@ function transformIsolatedClientBoundaryModule(options) {
1430
1539
  const specifierName = (name) => name?.name ?? String(name?.value ?? "");
1431
1540
  const isComponentExport = (specifier) => {
1432
1541
  const exported = specifierName(specifier.exported);
1433
- return exported === "default" || /^[A-Z]/.test(exported);
1542
+ return everyExportIsComponent || exported === "default" || /^[A-Z]/.test(exported);
1434
1543
  };
1435
1544
  if (!specifiers.some(isComponentExport)) continue;
1436
1545
  const imports = [];
@@ -2488,7 +2597,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2488
2597
  }
2489
2598
  }
2490
2599
  if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && req.headers.accept?.includes(FARM_NATIVE_TREE_CONTENT_TYPE)) {
2491
- const { createFarmNativeTreeResponse } = await import("./native-tree-BPEE2LAL.mjs");
2600
+ const { createFarmNativeTreeResponse } = await import("./native-tree-YF2DSPKM.mjs");
2492
2601
  const treeBodyInit = requestMethod === "POST" ? { body: createFarmNodeRequestBodyStream(req), duplex: "half" } : {};
2493
2602
  const treeResponse = await createFarmNativeTreeResponse({
2494
2603
  request: new Request(fullUrl, {
@@ -3807,7 +3916,8 @@ export const manifest = getManifest();
3807
3916
  const cleanId = id.split("?", 1)[0];
3808
3917
  const selectedIsolatedModules = options.isolatedClientBoundaryModules ?? farmApp?.getRouteManager().getIsolatedClientBoundaryModules(root);
3809
3918
  const selectedForIsolatedHydration = selectedIsolatedModules?.has(path6.resolve(cleanId)) === true;
3810
- if (isReactRenderer(resolveFarmRenderer(currentConfig.renderer)) && selectedForIsolatedHydration && isIsolatableClientBoundarySource(clientBoundarySource)) {
3919
+ if (isReactRenderer(resolveFarmRenderer(currentConfig.renderer)) && selectedForIsolatedHydration && (isIsolatableClientBoundarySource(clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
3920
+ cleanId.replace(/\\/g, "/").includes(FARM_CLIENT_REFERENCE_DIRECTORY))) {
3811
3921
  isolatedModuleReference = toViteModuleId(cleanId, root);
3812
3922
  const islandsMode = resolveFarmServerComponentsMode(currentConfig.experimental?.serverComponents) === "islands";
3813
3923
  const explicitStrategy = getIslandStrategyExport(clientBoundarySource);
@@ -3992,6 +4102,7 @@ if (import.meta.hot) {
3992
4102
  },
3993
4103
  watchChange() {
3994
4104
  invalidateFarmClientReachableModules();
4105
+ invalidateFarmClientOnlyScan();
3995
4106
  },
3996
4107
  async handleHotUpdate(ctx) {
3997
4108
  const { file, server: server2, modules } = ctx;
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkO2XFIPNLcjs = require('./chunk-O2XFIPNL.cjs');
3
+ var _chunkA3G5IY2Wcjs = require('./chunk-A3G5IY2W.cjs');
4
4
 
5
5
  // src/deployment-environment.ts
6
6
  function isFarmProductionDeploymentEnvironment(env = process.env) {
@@ -90,7 +90,7 @@ function createFarmProductionSiteReporter(options) {
90
90
  schemaVersion: FARM_PRODUCTION_SITE_TELEMETRY_SCHEMA_VERSION,
91
91
  eventType: FARM_PRODUCTION_SITE_ATTESTATION_EVENT_TYPE,
92
92
  packageName: FARM_PRODUCTION_SITE_TELEMETRY_PACKAGE_NAME,
93
- packageVersion: sanitizeDetail(_chunkO2XFIPNLcjs.FARM_VERSION, "unknown"),
93
+ packageVersion: sanitizeDetail(_chunkA3G5IY2Wcjs.FARM_VERSION, "unknown"),
94
94
  renderer: sanitizeDetail(options.renderer, "custom"),
95
95
  deployTarget: sanitizeDetail(options.deployTarget, "custom")
96
96
  };