@farm.js/core 0.1.64 → 0.1.66
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.
- package/dist/{analyzer-Q3QXC6PD.mjs → analyzer-4UFP4HVP.mjs} +3 -3
- package/dist/analyzer-H7SIX6BJ.cjs +16 -0
- package/dist/{chunk-XVWSDSUM.mjs → chunk-27FPUFWR.mjs} +60 -5
- package/dist/{chunk-JCEFKP5M.mjs → chunk-423SSBYQ.mjs} +6 -0
- package/dist/{chunk-SLYDIHLW.mjs → chunk-435QJNC2.mjs} +2 -2
- package/dist/{chunk-XZLZ6YPP.cjs → chunk-4OSOLDPL.cjs} +118 -50
- package/dist/{chunk-MG356ROI.cjs → chunk-4TVPYN32.cjs} +3 -3
- package/dist/chunk-672ISQIG.mjs +3704 -0
- package/dist/{chunk-NXFA7G3Y.cjs → chunk-752IHQTD.cjs} +4 -4
- package/dist/chunk-7ONGIFYX.cjs +3704 -0
- package/dist/{chunk-RAH5MT53.mjs → chunk-AZUUKA66.mjs} +153 -42
- package/dist/{chunk-O2XFIPNL.cjs → chunk-BIF5MLTH.cjs} +1 -1
- package/dist/{chunk-FH45OB37.mjs → chunk-BYRZ5VTH.mjs} +1 -1
- package/dist/{chunk-V727H3RI.cjs → chunk-CCAUIBIS.cjs} +6 -0
- package/dist/{chunk-DUSHDZQL.cjs → chunk-CHYTADNK.cjs} +15 -13
- package/dist/chunk-CJNAUEVC.mjs +34 -0
- package/dist/{chunk-S25BQIFW.cjs → chunk-DVKH2RVN.cjs} +2 -2
- package/dist/{chunk-FAP7CX7C.cjs → chunk-E4UDLFWR.cjs} +527 -3019
- package/dist/{chunk-EFZGB7JC.cjs → chunk-E5UN4OWX.cjs} +1 -0
- package/dist/{chunk-WNYRYI4D.mjs → chunk-EMNKZGF4.mjs} +380 -2872
- package/dist/{chunk-VVTJTMGQ.cjs → chunk-GL7N5UHF.cjs} +4 -4
- package/dist/{chunk-UR25Z5Z6.mjs → chunk-HCGWDRZO.mjs} +1 -1
- package/dist/{chunk-EL4364S2.cjs → chunk-HZPKJRYA.cjs} +74 -19
- package/dist/{chunk-3EBHJET2.cjs → chunk-IT6WRNGB.cjs} +380 -269
- package/dist/{chunk-LQDLEWPO.mjs → chunk-MPIGW42F.mjs} +1 -1
- package/dist/{chunk-S7ZW72JH.cjs → chunk-MPJEIHW2.cjs} +2 -2
- package/dist/{chunk-53ZCZ46B.cjs → chunk-NHQM2Q4I.cjs} +2 -1
- package/dist/{chunk-UYRI6U3P.mjs → chunk-O75GQVUK.mjs} +2 -1
- package/dist/{chunk-OYF23QLG.mjs → chunk-OB7VKCUZ.mjs} +38 -33
- package/dist/{chunk-JCPSA4X5.cjs → chunk-OP7LHY4Y.cjs} +128 -123
- package/dist/{chunk-O7IEMY55.cjs → chunk-RY4ABNPE.cjs} +3 -3
- package/dist/{chunk-6NHSGVVA.mjs → chunk-SK7QSNWE.mjs} +1 -1
- package/dist/{chunk-NNLFW3P4.mjs → chunk-TKK5QHKZ.mjs} +1 -1
- package/dist/{chunk-ZNXTU4YH.mjs → chunk-TM2E623I.mjs} +1 -0
- package/dist/{chunk-PAKCHVUS.mjs → chunk-TPA2PV5J.mjs} +3 -35
- package/dist/{chunk-6NNYPY5W.mjs → chunk-UBMHQVWN.mjs} +78 -10
- package/dist/{chunk-BPNOYILC.cjs → chunk-UVV3I5QA.cjs} +3 -35
- package/dist/{chunk-N3Z3PLHC.cjs → chunk-VBCQ5WOI.cjs} +6 -6
- package/dist/{chunk-WFNAOWH4.mjs → chunk-WFWFECDW.mjs} +2 -2
- package/dist/{chunk-SNFTMSHX.mjs → chunk-WVYRLP5E.mjs} +1 -1
- package/dist/{chunk-O4FWNLQK.mjs → chunk-XBSLKXBL.mjs} +10 -8
- package/dist/chunk-ZIHWAN55.cjs +34 -0
- package/dist/{devtools-WET5NAKO.cjs → devtools-N2JQCMXB.cjs} +5 -4
- package/dist/{devtools-MX3FE733.mjs → devtools-NZUVNUP3.mjs} +4 -3
- package/dist/docs.cjs +6 -5
- package/dist/docs.mjs +5 -4
- package/dist/environment/vite.cjs +9 -2
- package/dist/environment/vite.d.mts +3 -0
- package/dist/environment/vite.d.ts +3 -0
- package/dist/environment/vite.mjs +8 -1
- package/dist/index.cjs +22 -21
- package/dist/index.mjs +21 -20
- package/dist/internal/build-runtime.cjs +20 -19
- package/dist/internal/build-runtime.mjs +19 -18
- package/dist/internal/cli-runtime.cjs +6 -5
- package/dist/internal/cli-runtime.mjs +5 -4
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/config-runtime.cjs +6 -5
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/native-server-fns.cjs +5 -5
- package/dist/internal/native-server-fns.mjs +4 -4
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +7 -7
- package/dist/internal/production-runtime.d.mts +14 -0
- package/dist/internal/production-runtime.d.ts +14 -0
- package/dist/internal/production-runtime.mjs +6 -6
- package/dist/{native-tree-WOX3JMBG.cjs → native-tree-7LPH57Z4.cjs} +3 -3
- package/dist/{native-tree-BPEE2LAL.mjs → native-tree-VV6WN3GX.mjs} +2 -2
- package/dist/plugin.cjs +11 -10
- package/dist/plugin.mjs +10 -9
- package/dist/{port-UFUZL6RI.mjs → port-CLL4BC4O.mjs} +1 -1
- package/dist/{port-VTLHPZOI.cjs → port-HASZTQGY.cjs} +9 -9
- package/dist/{rsc-pipeline-3LNVP2OO.mjs → rsc-pipeline-7PNVJSTR.mjs} +6 -5
- package/dist/{rsc-pipeline-G5WELVW3.cjs → rsc-pipeline-Z7QBZOIJ.cjs} +7 -6
- package/dist/{runtime-DMEULPE7.cjs → runtime-FKFCUHSK.cjs} +21 -20
- package/dist/{runtime-HQJ2LLQL.mjs → runtime-QQHX4BP3.mjs} +12 -11
- package/dist/server.cjs +36 -35
- package/dist/server.mjs +19 -18
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +14 -12
- package/dist/vite.mjs +13 -11
- package/package.json +1 -1
- package/dist/analyzer-ODLF2Z6O.cjs +0 -16
- package/dist/chunk-NK2VWS7P.cjs +0 -954
- package/dist/chunk-ZQ5BDNKW.mjs +0 -954
|
@@ -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
|
-
|
|
40
|
-
|
|
41
|
-
resolveModuleSourcePath,
|
|
42
|
-
rewriteFarmPackageClientImports,
|
|
43
|
-
rewriteFarmReactServerImports,
|
|
44
|
-
stripUseClientDirective
|
|
45
|
-
} from "./chunk-WNYRYI4D.mjs";
|
|
30
|
+
resolveFarmRouteRootStrategy
|
|
31
|
+
} from "./chunk-EMNKZGF4.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-
|
|
73
|
+
} from "./chunk-435QJNC2.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-
|
|
79
|
+
} from "./chunk-WVYRLP5E.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
|
-
|
|
107
|
+
resolveFarmBrowserBuiltin,
|
|
108
|
+
resolveFarmIsolatedClientHydrationMode,
|
|
109
|
+
resolveModuleSourcePath,
|
|
110
|
+
rewriteFarmPackageClientImports,
|
|
111
|
+
rewriteFarmReactServerImports,
|
|
112
|
+
stripUseClientDirective
|
|
113
|
+
} from "./chunk-672ISQIG.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
|
-
|
|
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-
|
|
266
|
+
} from "./chunk-MPIGW42F.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-
|
|
889
|
+
return import("./devtools-NZUVNUP3.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
|
-
|
|
930
|
-
|
|
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 = (() =>
|
|
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-
|
|
2600
|
+
const { createFarmNativeTreeResponse } = await import("./native-tree-VV6WN3GX.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;
|
|
@@ -448,6 +448,9 @@ function utility(token) {
|
|
|
448
448
|
case "shrink-0":
|
|
449
449
|
return { flexShrink: 0 };
|
|
450
450
|
case "flex-nowrap":
|
|
451
|
+
case "table-auto":
|
|
452
|
+
case "table-fixed":
|
|
453
|
+
case "border-collapse":
|
|
451
454
|
return {};
|
|
452
455
|
case "flex-wrap":
|
|
453
456
|
return { flexWrap: "wrap" };
|
|
@@ -746,6 +749,9 @@ function cssColor(value) {
|
|
|
746
749
|
return `#${hex}${Math.round(Math.min(1, alpha) * 255).toString(16).padStart(2, "0")}`;
|
|
747
750
|
}
|
|
748
751
|
var IGNORED_PROPERTIES = /* @__PURE__ */ new Set([
|
|
752
|
+
// A native table always lays out like `table-layout: fixed`, its cells' borders side by side.
|
|
753
|
+
"border-collapse",
|
|
754
|
+
"table-layout",
|
|
749
755
|
// No effect on a static, touch-only screen, or the shell owns it.
|
|
750
756
|
"cursor",
|
|
751
757
|
"outline",
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkBPNOYILCcjs = require('./chunk-BPNOYILC.cjs');
|
|
5
|
+
var _chunkUVV3I5QAcjs = require('./chunk-UVV3I5QA.cjs');
|
|
8
6
|
|
|
9
7
|
|
|
10
8
|
|
|
@@ -19,10 +17,6 @@ var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
|
|
|
19
17
|
|
|
20
18
|
|
|
21
19
|
|
|
22
|
-
var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
20
|
|
|
27
21
|
|
|
28
22
|
var _chunkO6L3YYPMcjs = require('./chunk-O6L3YYPM.cjs');
|
|
@@ -40,9 +34,17 @@ var _chunkFJWN7RV4cjs = require('./chunk-FJWN7RV4.cjs');
|
|
|
40
34
|
|
|
41
35
|
|
|
42
36
|
|
|
37
|
+
var _chunkZIHWAN55cjs = require('./chunk-ZIHWAN55.cjs');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
43
41
|
var _chunk5Y2P454Ocjs = require('./chunk-5Y2P454O.cjs');
|
|
44
42
|
|
|
45
43
|
|
|
44
|
+
|
|
45
|
+
var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
|
|
46
|
+
|
|
47
|
+
|
|
46
48
|
var _chunkHEPJIKKQcjs = require('./chunk-HEPJIKKQ.cjs');
|
|
47
49
|
|
|
48
50
|
|
|
@@ -1029,7 +1031,7 @@ function validateConfigRouteSources(routes, field) {
|
|
|
1029
1031
|
return routes;
|
|
1030
1032
|
}
|
|
1031
1033
|
async function resolveConfig(userConfig, mode) {
|
|
1032
|
-
|
|
1034
|
+
_chunkZIHWAN55cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([userConfig, 'access', _43 => _43.experimental, 'optionalAccess', _44 => _44.serverComponents]));
|
|
1033
1035
|
const projectRoot = userConfig.root || process.cwd();
|
|
1034
1036
|
const layerResolution = await _chunk5Y2P454Ocjs.resolveFarmLayers.call(void 0, userConfig, {
|
|
1035
1037
|
root: projectRoot,
|
|
@@ -1074,7 +1076,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
1074
1076
|
if (desktopSetup) userConfig = desktopSetup.userConfig;
|
|
1075
1077
|
const deploy = resolveDeployConfig(userConfig, _optionalChain([desktopSetup, 'optionalAccess', _47 => _47.deploy]));
|
|
1076
1078
|
const srcDir = userConfig.srcDir || "src";
|
|
1077
|
-
|
|
1079
|
+
_chunkZIHWAN55cjs.setFarmProjectSourceDir.call(void 0, root, srcDir);
|
|
1078
1080
|
const docs = await resolveDocsConfig(userConfig.docs, { root, srcDir });
|
|
1079
1081
|
const md = _chunk2C5L5RPMcjs.resolveMarkdownConfig.call(void 0, userConfig.md);
|
|
1080
1082
|
const mdx = _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, userConfig.mdx);
|
|
@@ -1082,14 +1084,14 @@ async function resolveConfig(userConfig, mode) {
|
|
|
1082
1084
|
_chunk3EIPOTZVcjs.setEnv.call(void 0, env);
|
|
1083
1085
|
const api = await _chunkPMJSG4JScjs.resolveFarmAPIConfig.call(void 0, userConfig.api, { root, mode, env });
|
|
1084
1086
|
const cron = await resolveProjectCronJobs({ root, srcDir, cron: userConfig.cron });
|
|
1085
|
-
const auth =
|
|
1087
|
+
const auth = _chunkUVV3I5QAcjs.resolveFarmAuthConfig.call(void 0, userConfig.auth);
|
|
1086
1088
|
const mcp = resolveFarmMCPConfig(userConfig.mcp);
|
|
1087
1089
|
if (auth.enabled && _optionalChain([userConfig, 'access', _48 => _48.integrations, 'optionalAccess', _49 => _49.auth])) {
|
|
1088
1090
|
throw new Error(
|
|
1089
1091
|
"Choose either the top-level `auth` config or `integrations.auth`; they cannot both own the auth route."
|
|
1090
1092
|
);
|
|
1091
1093
|
}
|
|
1092
|
-
const nativeAuthIntegration = await
|
|
1094
|
+
const nativeAuthIntegration = await _chunkUVV3I5QAcjs.resolveFarmAuthIntegration.call(void 0, auth, {
|
|
1093
1095
|
root,
|
|
1094
1096
|
mode
|
|
1095
1097
|
});
|
|
@@ -1159,7 +1161,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
1159
1161
|
serverActions: false,
|
|
1160
1162
|
// Islands mode hydrates client components as islands (RFC 0003); an app can still pick
|
|
1161
1163
|
// isolatedClientHydration itself.
|
|
1162
|
-
isolatedClientHydration:
|
|
1164
|
+
isolatedClientHydration: _chunkZIHWAN55cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([userConfig, 'access', _54 => _54.experimental, 'optionalAccess', _55 => _55.serverComponents])) === "islands" ? "enabled" : "off",
|
|
1163
1165
|
ppr: false,
|
|
1164
1166
|
...userConfig.experimental
|
|
1165
1167
|
},
|
|
@@ -1199,7 +1201,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
1199
1201
|
distDir: userConfig.distDir || ".farm",
|
|
1200
1202
|
generateBuildId,
|
|
1201
1203
|
compress: _nullishCoalesce(userConfig.compress, () => ( true)),
|
|
1202
|
-
devIndicators:
|
|
1204
|
+
devIndicators: _chunkUVV3I5QAcjs.resolveFarmDevIndicatorsConfig.call(void 0, userConfig.devIndicators, mode),
|
|
1203
1205
|
serverRuntimeConfig: userConfig.serverRuntimeConfig || {},
|
|
1204
1206
|
publicRuntimeConfig: userConfig.publicRuntimeConfig || {},
|
|
1205
1207
|
env,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// 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/utils/source-dir.ts
|
|
16
|
+
import path from "path";
|
|
17
|
+
var FARM_PROJECT_SOURCE_DIRS = /* @__PURE__ */ Symbol.for("farm.projectSourceDirs");
|
|
18
|
+
function getProjectSourceDirs() {
|
|
19
|
+
const globalState = globalThis;
|
|
20
|
+
return globalState[FARM_PROJECT_SOURCE_DIRS] ?? (globalState[FARM_PROJECT_SOURCE_DIRS] = /* @__PURE__ */ new Map());
|
|
21
|
+
}
|
|
22
|
+
function setFarmProjectSourceDir(root, srcDir) {
|
|
23
|
+
getProjectSourceDirs().set(path.resolve(root), srcDir);
|
|
24
|
+
}
|
|
25
|
+
function getFarmProjectSourceDir(root) {
|
|
26
|
+
return getProjectSourceDirs().get(path.resolve(root)) ?? "src";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
resolveFarmServerComponentsMode,
|
|
31
|
+
isExplicitFarmServerComponentsMode,
|
|
32
|
+
setFarmProjectSourceDir,
|
|
33
|
+
getFarmProjectSourceDir
|
|
34
|
+
};
|
|
@@ -12,7 +12,7 @@ var _chunkWMTBBQHYcjs = require('./chunk-WMTBBQHY.cjs');
|
|
|
12
12
|
var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkCHYTADNKcjs = require('./chunk-CHYTADNK.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -568,7 +568,7 @@ async function resolveAPIContext(options) {
|
|
|
568
568
|
config: options.config,
|
|
569
569
|
configPath: options.configPath
|
|
570
570
|
}));
|
|
571
|
-
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await
|
|
571
|
+
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkCHYTADNKcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
|
|
572
572
|
const guardedPaths = new Set(_nullishCoalesce(_optionalChain([runtimeConfig, 'optionalAccess', _24 => _24.guardedPaths]), () => ( [])));
|
|
573
573
|
return {
|
|
574
574
|
root,
|