@farm.js/core 0.1.51-beta.2 → 0.1.51-beta.3
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/{agent-mcp-handler-WWCC4GLG.mjs → agent-mcp-handler-7JSKGSOW.mjs} +4 -4
- package/dist/{agent-mcp-handler-RT3COCEL.cjs → agent-mcp-handler-YE4AGWHN.cjs} +5 -5
- package/dist/{agent-mcp.d-CR5Ov83o.d.ts → agent-mcp.d-BAR9njbJ.d.ts} +1 -1
- package/dist/{agent-mcp.d-Z5DuwrqW.d.mts → agent-mcp.d-BJKChOrO.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/{analyzer-Z6TNEAET.mjs → analyzer-OTPEWH5W.mjs} +14 -3
- package/dist/{analyzer-T76CN3S7.cjs → analyzer-TSQXZCZN.cjs} +14 -3
- package/dist/api/route-manager.d.mts +4 -4
- package/dist/api/route-manager.d.ts +4 -4
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/{app-manifest.d-DiWr_Jfx.d.ts → app-manifest.d-BLFbaqx8.d.ts} +1 -1
- package/dist/{app-manifest.d-CAHkOBFa.d.mts → app-manifest.d-DEQNnNhV.d.mts} +1 -1
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +3 -3
- package/dist/{app.d-DmapqkbV.d.ts → app.d-CNPaUYaa.d.ts} +4 -4
- package/dist/{app.d-BfgJCsTQ.d.mts → app.d-CT7xDkj2.d.mts} +4 -4
- package/dist/{chunk-YVJV7Q2X.mjs → chunk-3BLEXUGE.mjs} +1 -1
- package/dist/chunk-3HLQTOVU.cjs +6 -0
- package/dist/{chunk-E6LTONL4.mjs → chunk-3SMXQNFD.mjs} +2 -2
- package/dist/{chunk-PMKUU273.mjs → chunk-3TLKUBXG.mjs} +411 -166
- package/dist/{chunk-74Z5KX4A.mjs → chunk-3WSIYBMG.mjs} +41 -19
- package/dist/{chunk-GNJIYJMS.cjs → chunk-3XQ57EFI.cjs} +16 -16
- package/dist/{chunk-GW4YUIHW.mjs → chunk-3Z63X45F.mjs} +1 -1
- package/dist/{chunk-IBSAYAWB.mjs → chunk-4353ZRE5.mjs} +1 -1
- package/dist/{chunk-SBABQKPT.cjs → chunk-46KXZBOG.cjs} +5 -5
- package/dist/{chunk-YU42A5MA.cjs → chunk-4CGOMZP3.cjs} +221 -199
- package/dist/{chunk-J3LBO2O4.cjs → chunk-4SEHMBL4.cjs} +10 -10
- package/dist/{chunk-E73PGHSR.mjs → chunk-4TKAIO2F.mjs} +3 -3
- package/dist/{chunk-NJLTQR5P.cjs → chunk-53SACYBY.cjs} +7 -7
- package/dist/{chunk-FM2UEKS2.mjs → chunk-5FXPJIOT.mjs} +2 -2
- package/dist/{chunk-QXPSWMUD.cjs → chunk-7MD37P5V.cjs} +5 -5
- package/dist/{chunk-JATTVAHA.cjs → chunk-B3GM5I6N.cjs} +4 -4
- package/dist/{chunk-WJFFPXCV.cjs → chunk-D7UQC4O6.cjs} +10 -8
- package/dist/{chunk-KRRZJ77U.mjs → chunk-E5DXF5GE.mjs} +2 -2
- package/dist/chunk-EFZGB7JC.cjs +114 -0
- package/dist/{chunk-NYQSC4DX.cjs → chunk-FFE2EMF7.cjs} +5 -5
- package/dist/{chunk-CTM4SPB3.mjs → chunk-GAO7MS5O.mjs} +4 -3
- package/dist/{chunk-HIFIG6HL.cjs → chunk-H33PJEXN.cjs} +5 -5
- package/dist/{chunk-NXBHYO7S.cjs → chunk-HLWOWZFX.cjs} +2 -2
- package/dist/chunk-JXEPLIXD.cjs +389 -0
- package/dist/{chunk-NPQLMP7M.cjs → chunk-KLNFJDFM.cjs} +10 -9
- package/dist/{chunk-KBRZAYI7.mjs → chunk-LDNSSHEG.mjs} +2 -2
- package/dist/chunk-LLZSYFOM.mjs +6 -0
- package/dist/{chunk-N77JBPLC.mjs → chunk-LPDKG6RA.mjs} +9 -7
- package/dist/chunk-MIGFX2FN.mjs +758 -0
- package/dist/{chunk-72D2NX77.mjs → chunk-MRNDAJEV.mjs} +1 -1
- package/dist/{chunk-4SSRBCBR.mjs → chunk-NOTSHVRN.mjs} +355 -218
- package/dist/{chunk-GUJTVM36.cjs → chunk-OAMUSC7H.cjs} +1 -1
- package/dist/chunk-P6MHI5O2.cjs +758 -0
- package/dist/{chunk-6CYQQQGR.mjs → chunk-R4PHCZ3G.mjs} +1 -1
- package/dist/{chunk-WZW6LEHM.cjs → chunk-TQMI6BYO.cjs} +675 -430
- package/dist/{chunk-76GHW3WI.cjs → chunk-TSFMFPRU.cjs} +4 -4
- package/dist/{chunk-5N7QAGEA.cjs → chunk-TWHXBMLJ.cjs} +37 -7
- package/dist/{chunk-BOVGCUDZ.cjs → chunk-UJL4JOXV.cjs} +2 -2
- package/dist/chunk-UQF3OJVE.mjs +389 -0
- package/dist/{chunk-DTU4PX7V.cjs → chunk-WGUHDWT5.cjs} +557 -420
- package/dist/{chunk-LAZK6UV7.mjs → chunk-YAJTD3ZG.mjs} +1 -1
- package/dist/{chunk-7UPCJDB5.mjs → chunk-YUEYBL35.mjs} +2 -2
- package/dist/{chunk-EIMK7D2D.mjs → chunk-ZD2VKAUI.mjs} +34 -4
- package/dist/chunk-ZNXTU4YH.mjs +114 -0
- package/dist/{client-plugins.d-Bx3FXpqm.d.mts → client-plugins.d-DllmH8eM.d.mts} +17 -4
- package/dist/{client-plugins.d-TiLbS5j4.d.ts → client-plugins.d-n3iWY1EJ.d.ts} +17 -4
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/{config.d-iRPI16ku.d.ts → config.d-DqKaCr1r.d.mts} +8 -1
- package/dist/{config.d-iRPI16ku.d.mts → config.d-DqKaCr1r.d.ts} +8 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/desktop.d.mts +3 -3
- package/dist/desktop.d.ts +3 -3
- package/dist/{devtools-6XWCZIGO.cjs → devtools-TO6TAO32.cjs} +5 -5
- package/dist/{devtools-UQLDAOEI.mjs → devtools-UESYARTF.mjs} +4 -4
- package/dist/docs.cjs +7 -7
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +6 -6
- package/dist/index.cjs +22 -18
- package/dist/{index.d-YxJ2AiDF.d.mts → index.d-BL7KKiwa.d.mts} +1 -1
- package/dist/{index.d-yueUNipJ.d.ts → index.d-BXsAXm1U.d.ts} +1 -1
- package/dist/index.d.mts +17 -17
- package/dist/index.d.ts +17 -17
- package/dist/index.mjs +22 -18
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +20 -18
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +19 -17
- package/dist/internal/cli-runtime.cjs +7 -7
- package/dist/internal/cli-runtime.mjs +6 -6
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +2 -2
- package/dist/internal/compression-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.d.mts +31 -7
- package/dist/internal/config-runtime.d.ts +31 -7
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/infra-analytics-runtime.cjs +8 -8
- package/dist/internal/infra-analytics-runtime.mjs +6 -6
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +87 -9
- package/dist/internal/production-runtime.d.mts +44 -12
- package/dist/internal/production-runtime.d.ts +44 -12
- package/dist/internal/production-runtime.mjs +86 -8
- package/dist/markdown.cjs +4 -2
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.mjs +3 -1
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/mobile.d.mts +21 -5
- package/dist/mobile.d.ts +21 -5
- package/dist/native-tree-EBPDFTRW.mjs +25 -0
- package/dist/native-tree-MMZS7S6W.cjs +25 -0
- package/dist/{navigation-delegate.d-HnDXhlyP.d.mts → navigation-delegate.d-C76gXTmO.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BY1e_Xrh.d.ts → navigation-delegate.d-DIyDslxt.d.ts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/plugin.cjs +14 -13
- package/dist/plugin.d.mts +5 -4
- package/dist/plugin.d.ts +5 -4
- package/dist/plugin.mjs +13 -12
- package/dist/{production-runtime.d-BpJUDzP8.d.mts → production-runtime.d-CDHztggO.d.mts} +1 -1
- package/dist/{production-runtime.d-lMjvE9cf.d.ts → production-runtime.d-tyaGdbk6.d.ts} +1 -1
- package/dist/{programmatic-routes-client.d-BlFp5hv4.d.ts → programmatic-routes-client.d-XfmIrCK1.d.ts} +2 -2
- package/dist/{programmatic-routes-client.d-6CGQ3TCk.d.mts → programmatic-routes-client.d-aAWiDd64.d.mts} +2 -2
- package/dist/{render-plan.d-BH9edqKs.d.mts → render-plan.d-Diwybxo8.d.mts} +1 -1
- package/dist/{render-plan.d-DhP0mTHF.d.ts → render-plan.d-Dr5WRjoV.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/{request.d-BVZrsR1v.d.ts → request.d-D01fRn--.d.ts} +1 -1
- package/dist/{request.d-DJFRdKi8.d.mts → request.d-Dd3AFR79.d.mts} +1 -1
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/{route-rendering.d-Bpmw7PED.d.mts → route-rendering.d-BQ53lJ_D.d.mts} +1 -1
- package/dist/{route-rendering.d-B00JtK_-.d.ts → route-rendering.d-Bhx4QoJt.d.ts} +1 -1
- package/dist/{router.d-e0jQ3jQ-.d.mts → router.d-Bi23a6Xc.d.mts} +1 -1
- package/dist/{router.d-Bd1x9XxQ.d.ts → router.d-DQ3k7EYn.d.ts} +1 -1
- package/dist/{routes.d-Cmv8TgVq.d.mts → routes.d-BgTd7vI4.d.mts} +3 -3
- package/dist/{routes.d-D96Dq9lz.d.ts → routes.d-C7jMJFvP.d.ts} +3 -3
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/{rsc-pipeline-ZQ4CTVEG.mjs → rsc-pipeline-K3ER3Q4N.mjs} +5 -5
- package/dist/{rsc-pipeline-DX4OC5FN.cjs → rsc-pipeline-OCZIT5OF.cjs} +6 -6
- package/dist/{runtime-NQ3EDSA7.cjs → runtime-DKNSIH7V.cjs} +30 -23
- package/dist/{runtime-NPDRDV6R.mjs → runtime-MKYDEUZT.mjs} +20 -13
- package/dist/{runtime.d-CgB3IJDq.d.mts → runtime.d-B2Js6qZ2.d.mts} +1 -1
- package/dist/{runtime.d-D-td-RR3.d.ts → runtime.d-BL-CGwoi.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +31 -30
- package/dist/server.d.mts +11 -10
- package/dist/server.d.ts +11 -10
- package/dist/server.mjs +16 -15
- package/dist/{spa-router.d-BWDhS0FK.d.mts → spa-router.d-B2rIFGs0.d.mts} +2 -2
- package/dist/{spa-router.d-CO01mVOM.d.ts → spa-router.d-DqZ6Lfs0.d.ts} +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/{utils.d-B77__yh8.d.ts → utils.d-Bv2MPeLR.d.ts} +1 -1
- package/dist/{utils.d-DRDazhCA.d.mts → utils.d-fqXe8lNc.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +14 -13
- package/dist/vite.d.mts +12 -6
- package/dist/vite.d.ts +12 -6
- package/dist/vite.mjs +13 -12
- package/package.json +1 -1
|
@@ -30,10 +30,10 @@ var _chunkUQHIWZZ6cjs = require('./chunk-UQHIWZZ6.cjs');
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkTSFMFPRUcjs = require('./chunk-TSFMFPRU.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _chunk4SEHMBL4cjs = require('./chunk-4SEHMBL4.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
@@ -41,7 +41,7 @@ var _chunkJ3LBO2O4cjs = require('./chunk-J3LBO2O4.cjs');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _chunk46KXZBOGcjs = require('./chunk-46KXZBOG.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
var _chunkYB44NKC2cjs = require('./chunk-YB44NKC2.cjs');
|
|
@@ -64,10 +64,10 @@ var _chunkNK2VWS7Pcjs = require('./chunk-NK2VWS7P.cjs');
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
var
|
|
67
|
+
var _chunkUJL4JOXVcjs = require('./chunk-UJL4JOXV.cjs');
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
var
|
|
70
|
+
var _chunkB3GM5I6Ncjs = require('./chunk-B3GM5I6N.cjs');
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
@@ -105,14 +105,14 @@ var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
var
|
|
108
|
+
var _chunkFFE2EMF7cjs = require('./chunk-FFE2EMF7.cjs');
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
var
|
|
115
|
+
var _chunkH33PJEXNcjs = require('./chunk-H33PJEXN.cjs');
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
|
|
@@ -152,7 +152,7 @@ var _chunkWT6RAN2Icjs = require('./chunk-WT6RAN2I.cjs');
|
|
|
152
152
|
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
var
|
|
155
|
+
var _chunkD7UQC4O6cjs = require('./chunk-D7UQC4O6.cjs');
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
var _chunkJMYXO572cjs = require('./chunk-JMYXO572.cjs');
|
|
@@ -254,7 +254,7 @@ var _chunkJYT7AN37cjs = require('./chunk-JYT7AN37.cjs');
|
|
|
254
254
|
var _chunkB5BBTPJQcjs = require('./chunk-B5BBTPJQ.cjs');
|
|
255
255
|
|
|
256
256
|
|
|
257
|
-
var
|
|
257
|
+
var _chunkOAMUSC7Hcjs = require('./chunk-OAMUSC7H.cjs');
|
|
258
258
|
|
|
259
259
|
|
|
260
260
|
|
|
@@ -329,16 +329,241 @@ var _chunkYTVSWXEZcjs = require('./chunk-YTVSWXEZ.cjs');
|
|
|
329
329
|
var _chunkBTZ5O6VMcjs = require('./chunk-BTZ5O6VM.cjs');
|
|
330
330
|
|
|
331
331
|
// src/utils/client-component.ts
|
|
332
|
-
var _fs = require('fs'); var
|
|
333
|
-
var _path = require('path'); var
|
|
332
|
+
var _fs = require('fs'); var fs3 = _interopRequireWildcard(_fs); var fs6 = _interopRequireWildcard(_fs); var fs5 = _interopRequireWildcard(_fs);
|
|
333
|
+
var _path = require('path'); var path5 = _interopRequireWildcard(_path); var path10 = _interopRequireWildcard(_path); var path9 = _interopRequireWildcard(_path);
|
|
334
334
|
var _url = require('url');
|
|
335
|
+
|
|
336
|
+
// src/utils/package-client-boundary-cache.ts
|
|
337
|
+
var _async_hooks = require('async_hooks');
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
var SCHEMA_VERSION = 1;
|
|
341
|
+
var NODE_MODULES_SEGMENT = `${path5.default.sep}node_modules${path5.default.sep}`;
|
|
342
|
+
var PackageInspectionTrace = class {
|
|
343
|
+
constructor() {
|
|
344
|
+
this.files = /* @__PURE__ */ new Set();
|
|
345
|
+
this.stops = /* @__PURE__ */ new Set();
|
|
346
|
+
this.fileStamps = [];
|
|
347
|
+
this.directoryStamps = /* @__PURE__ */ new Map();
|
|
348
|
+
}
|
|
349
|
+
visit(file) {
|
|
350
|
+
this.files.add(file);
|
|
351
|
+
const directory = path5.default.dirname(file);
|
|
352
|
+
if (!this.directoryStamps.has(directory)) {
|
|
353
|
+
this.directoryStamps.set(directory, stampPackagePath(directory, "directory"));
|
|
354
|
+
}
|
|
355
|
+
this.fileStamps.push(stampPackagePath(file, "file"));
|
|
356
|
+
}
|
|
357
|
+
/** The inspection reached `file` after it was already visited. */
|
|
358
|
+
stop(file) {
|
|
359
|
+
if (!this.files.has(file)) this.stops.add(file);
|
|
360
|
+
}
|
|
361
|
+
toEntry(result) {
|
|
362
|
+
const entry = {
|
|
363
|
+
result: { ...result },
|
|
364
|
+
files: Array.from(this.files),
|
|
365
|
+
stops: Array.from(this.stops)
|
|
366
|
+
};
|
|
367
|
+
const files = this.fileStamps.filter((stamp) => stamp !== void 0);
|
|
368
|
+
const directories = Array.from(this.directoryStamps.values()).filter(
|
|
369
|
+
(stamp) => stamp !== void 0
|
|
370
|
+
);
|
|
371
|
+
if (files.length === this.fileStamps.length && directories.length === this.directoryStamps.size) {
|
|
372
|
+
entry.stamps = { files, directories };
|
|
373
|
+
}
|
|
374
|
+
return entry;
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
function stampPackagePath(target, kind) {
|
|
378
|
+
if (!`${target}${path5.default.sep}`.includes(NODE_MODULES_SEGMENT)) return void 0;
|
|
379
|
+
try {
|
|
380
|
+
const stat = fs3.default.statSync(target, { throwIfNoEntry: false });
|
|
381
|
+
if (!stat || (kind === "file" ? !stat.isFile() : !stat.isDirectory())) return void 0;
|
|
382
|
+
return [target, stat.size, stat.mtimeMs, stat.ctimeMs];
|
|
383
|
+
} catch (e) {
|
|
384
|
+
return void 0;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
var PackageClientBoundaryCache = class {
|
|
388
|
+
constructor() {
|
|
389
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
390
|
+
this.stored = /* @__PURE__ */ new Map();
|
|
391
|
+
this.storedPaths = [];
|
|
392
|
+
this.unchangedPaths = /* @__PURE__ */ new Map();
|
|
393
|
+
this.dirty = false;
|
|
394
|
+
}
|
|
395
|
+
load(file) {
|
|
396
|
+
this.file = file;
|
|
397
|
+
const stored = readStoredCache(file);
|
|
398
|
+
if (!stored) {
|
|
399
|
+
this.dirty = true;
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
this.storedPaths = stored.paths;
|
|
403
|
+
this.stored = new Map(Object.entries(stored.entries));
|
|
404
|
+
}
|
|
405
|
+
/** An inspection of `key` that applies to `visited`. */
|
|
406
|
+
find(key, visited) {
|
|
407
|
+
let entries = this.entries.get(key);
|
|
408
|
+
const stored = this.stored.get(key);
|
|
409
|
+
if (stored) {
|
|
410
|
+
this.stored.delete(key);
|
|
411
|
+
_nullishCoalesce(entries, () => ( (entries = [])));
|
|
412
|
+
this.entries.set(key, entries);
|
|
413
|
+
for (const entry of stored) {
|
|
414
|
+
const restored = this.restore(entry);
|
|
415
|
+
if (restored) entries.push(restored);
|
|
416
|
+
else this.dirty = true;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return _optionalChain([entries, 'optionalAccess', _2 => _2.find, 'call', _3 => _3(
|
|
420
|
+
(entry) => entry.stops.every((file) => visited.has(file)) && !entry.files.some((file) => visited.has(file))
|
|
421
|
+
)]);
|
|
422
|
+
}
|
|
423
|
+
add(key, entry) {
|
|
424
|
+
const entries = this.entries.get(key);
|
|
425
|
+
if (entries) entries.push(entry);
|
|
426
|
+
else this.entries.set(key, [entry]);
|
|
427
|
+
if (entry.stamps) this.dirty = true;
|
|
428
|
+
}
|
|
429
|
+
async persist() {
|
|
430
|
+
const file = this.file;
|
|
431
|
+
if (!file || !this.dirty && this.stored.size === 0) return;
|
|
432
|
+
const paths = [];
|
|
433
|
+
const pathIndexes = /* @__PURE__ */ new Map();
|
|
434
|
+
const indexOf = (stamp) => {
|
|
435
|
+
let index = pathIndexes.get(stamp[0]);
|
|
436
|
+
if (index === void 0) {
|
|
437
|
+
index = paths.push(stamp) - 1;
|
|
438
|
+
pathIndexes.set(stamp[0], index);
|
|
439
|
+
}
|
|
440
|
+
return index;
|
|
441
|
+
};
|
|
442
|
+
const entries = {};
|
|
443
|
+
for (const [key, variants] of this.entries) {
|
|
444
|
+
const persisted = variants.flatMap(
|
|
445
|
+
({ result, stops, stamps }) => stamps ? [
|
|
446
|
+
{
|
|
447
|
+
result,
|
|
448
|
+
files: stamps.files.map(indexOf),
|
|
449
|
+
directories: stamps.directories.map(indexOf),
|
|
450
|
+
stops
|
|
451
|
+
}
|
|
452
|
+
] : []
|
|
453
|
+
);
|
|
454
|
+
if (persisted.length > 0) entries[key] = persisted;
|
|
455
|
+
}
|
|
456
|
+
const contents = JSON.stringify({
|
|
457
|
+
schema: SCHEMA_VERSION,
|
|
458
|
+
farm: _chunkOAMUSC7Hcjs.FARM_VERSION,
|
|
459
|
+
paths,
|
|
460
|
+
entries
|
|
461
|
+
});
|
|
462
|
+
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
463
|
+
try {
|
|
464
|
+
await fs3.default.promises.mkdir(path5.default.dirname(file), { recursive: true });
|
|
465
|
+
await fs3.default.promises.writeFile(temporary, contents);
|
|
466
|
+
await fs3.default.promises.rename(temporary, file);
|
|
467
|
+
} catch (e2) {
|
|
468
|
+
await fs3.default.promises.rm(temporary, { force: true }).catch(() => {
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
restore(entry) {
|
|
473
|
+
const files = this.restoreStamps(entry.files, "file");
|
|
474
|
+
const directories = this.restoreStamps(entry.directories, "directory");
|
|
475
|
+
if (!files || !directories) return void 0;
|
|
476
|
+
return {
|
|
477
|
+
result: entry.result,
|
|
478
|
+
files: files.map(([file]) => file),
|
|
479
|
+
stops: entry.stops,
|
|
480
|
+
stamps: { files, directories }
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
restoreStamps(indexes, kind) {
|
|
484
|
+
const stamps = [];
|
|
485
|
+
for (const index of indexes) {
|
|
486
|
+
const stamp = this.storedPaths[index];
|
|
487
|
+
let unchanged = this.unchangedPaths.get(index);
|
|
488
|
+
if (unchanged === void 0) {
|
|
489
|
+
const current = stampPackagePath(stamp[0], kind);
|
|
490
|
+
unchanged = current !== void 0 && current[1] === stamp[1] && current[2] === stamp[2] && current[3] === stamp[3];
|
|
491
|
+
this.unchangedPaths.set(index, unchanged);
|
|
492
|
+
}
|
|
493
|
+
if (!unchanged) return void 0;
|
|
494
|
+
stamps.push(stamp);
|
|
495
|
+
}
|
|
496
|
+
return stamps;
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
function readStoredCache(file) {
|
|
500
|
+
let value;
|
|
501
|
+
try {
|
|
502
|
+
value = JSON.parse(fs3.default.readFileSync(file, "utf8"));
|
|
503
|
+
} catch (e3) {
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
506
|
+
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkOAMUSC7Hcjs.FARM_VERSION) {
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
509
|
+
const { paths, entries } = value;
|
|
510
|
+
if (!Array.isArray(paths) || !paths.every(isPathStamp) || !isRecord(entries)) return null;
|
|
511
|
+
const valid = {};
|
|
512
|
+
for (const [key, variants] of Object.entries(entries)) {
|
|
513
|
+
if (!Array.isArray(variants)) continue;
|
|
514
|
+
const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
|
|
515
|
+
if (usable.length > 0) valid[key] = usable;
|
|
516
|
+
}
|
|
517
|
+
return { schema: SCHEMA_VERSION, farm: _chunkOAMUSC7Hcjs.FARM_VERSION, paths, entries: valid };
|
|
518
|
+
}
|
|
519
|
+
function isRecord(value) {
|
|
520
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
521
|
+
}
|
|
522
|
+
function isPathStamp(value) {
|
|
523
|
+
return Array.isArray(value) && value.length === 4 && typeof value[0] === "string" && path5.default.isAbsolute(value[0]) && value.slice(1).every((part) => typeof part === "number" && Number.isFinite(part));
|
|
524
|
+
}
|
|
525
|
+
function isPathIndexList(value, pathCount) {
|
|
526
|
+
return Array.isArray(value) && value.length > 0 && value.every((index) => Number.isSafeInteger(index) && index >= 0 && index < pathCount);
|
|
527
|
+
}
|
|
528
|
+
function isStoredEntry(value, pathCount) {
|
|
529
|
+
if (!isRecord(value) || !isRecord(value.result)) return false;
|
|
530
|
+
const { isClientComponent, shouldHydrate, islandStrategy } = value.result;
|
|
531
|
+
return isPathIndexList(value.files, pathCount) && isPathIndexList(value.directories, pathCount) && Array.isArray(value.stops) && value.stops.every((file) => typeof file === "string" && path5.default.isAbsolute(file)) && typeof isClientComponent === "boolean" && typeof shouldHydrate === "boolean" && (islandStrategy === null || _chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, islandStrategy)) && Object.keys(value.result).length === 3;
|
|
532
|
+
}
|
|
533
|
+
var STORAGE_KEY = /* @__PURE__ */ Symbol.for("@farm.js/core/package-client-boundary-cache");
|
|
534
|
+
function getStorage() {
|
|
535
|
+
const runtime = globalThis;
|
|
536
|
+
const existing = runtime[STORAGE_KEY];
|
|
537
|
+
if (existing instanceof _async_hooks.AsyncLocalStorage) {
|
|
538
|
+
return existing;
|
|
539
|
+
}
|
|
540
|
+
const storage = new (0, _async_hooks.AsyncLocalStorage)();
|
|
541
|
+
runtime[STORAGE_KEY] = storage;
|
|
542
|
+
return storage;
|
|
543
|
+
}
|
|
544
|
+
function getPackageClientBoundaryCache() {
|
|
545
|
+
return getStorage().getStore();
|
|
546
|
+
}
|
|
547
|
+
async function withPackageClientBoundaryCache(operation) {
|
|
548
|
+
const cache2 = new PackageClientBoundaryCache();
|
|
549
|
+
try {
|
|
550
|
+
return await getStorage().run(cache2, operation);
|
|
551
|
+
} finally {
|
|
552
|
+
await cache2.persist();
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function usePackageClientBoundaryCacheFile(file) {
|
|
556
|
+
_optionalChain([getPackageClientBoundaryCache, 'call', _4 => _4(), 'optionalAccess', _5 => _5.load, 'call', _6 => _6(file)]);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// src/utils/client-component.ts
|
|
335
560
|
function readIfExists(filePath) {
|
|
336
561
|
try {
|
|
337
|
-
if (!filePath || !
|
|
562
|
+
if (!filePath || !fs3.default.existsSync(filePath)) {
|
|
338
563
|
return null;
|
|
339
564
|
}
|
|
340
|
-
return
|
|
341
|
-
} catch (
|
|
565
|
+
return fs3.default.readFileSync(filePath, "utf-8");
|
|
566
|
+
} catch (e4) {
|
|
342
567
|
return null;
|
|
343
568
|
}
|
|
344
569
|
}
|
|
@@ -351,26 +576,26 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
351
576
|
if (modulePath.startsWith("file://")) {
|
|
352
577
|
try {
|
|
353
578
|
candidates.add(_url.fileURLToPath.call(void 0, modulePath));
|
|
354
|
-
} catch (
|
|
579
|
+
} catch (e5) {
|
|
355
580
|
}
|
|
356
581
|
}
|
|
357
582
|
if (modulePath.startsWith("/@fs/")) {
|
|
358
583
|
const fsPath = withoutQuery.slice("/@fs/".length);
|
|
359
|
-
candidates.add(
|
|
584
|
+
candidates.add(path5.default.normalize(/^[A-Za-z]:/.test(fsPath) ? fsPath : `/${fsPath}`));
|
|
360
585
|
}
|
|
361
586
|
}
|
|
362
587
|
if (root && modulePath) {
|
|
363
588
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
364
|
-
candidates.add(
|
|
365
|
-
candidates.add(
|
|
589
|
+
candidates.add(path5.default.join(root, normalized));
|
|
590
|
+
candidates.add(path5.default.resolve(root, normalized));
|
|
366
591
|
}
|
|
367
|
-
if (_optionalChain([withoutQuery, 'optionalAccess',
|
|
592
|
+
if (_optionalChain([withoutQuery, 'optionalAccess', _7 => _7.startsWith, 'call', _8 => _8("/src/")])) {
|
|
368
593
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
369
|
-
candidates.add(
|
|
370
|
-
candidates.add(
|
|
594
|
+
candidates.add(path5.default.join(process.cwd(), normalized));
|
|
595
|
+
candidates.add(path5.default.resolve(process.cwd(), normalized));
|
|
371
596
|
}
|
|
372
597
|
for (const candidate of candidates) {
|
|
373
|
-
if (
|
|
598
|
+
if (fs3.default.existsSync(candidate)) {
|
|
374
599
|
return candidate;
|
|
375
600
|
}
|
|
376
601
|
}
|
|
@@ -387,8 +612,8 @@ var FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES = 4;
|
|
|
387
612
|
function isolatedHydrationBoundaryLimit() {
|
|
388
613
|
const benchmarkRoot = process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_ROOT;
|
|
389
614
|
const benchmarkLimit = Number(process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_LIMIT);
|
|
390
|
-
const resolvedBenchmarkRoot = benchmarkRoot ?
|
|
391
|
-
const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${
|
|
615
|
+
const resolvedBenchmarkRoot = benchmarkRoot ? path5.default.resolve(benchmarkRoot) : null;
|
|
616
|
+
const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${path5.default.sep}`));
|
|
392
617
|
return isBenchmarkFixture && Number.isSafeInteger(benchmarkLimit) && benchmarkLimit > FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES ? benchmarkLimit : FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES;
|
|
393
618
|
}
|
|
394
619
|
var RESOLVABLE_SOURCE_EXTENSIONS = [
|
|
@@ -443,7 +668,7 @@ function hasHydrateExport(content) {
|
|
|
443
668
|
for (const match of content.matchAll(/\bexport\s*\{([^}]*)\}/g)) {
|
|
444
669
|
for (const specifier of match[1].split(",")) {
|
|
445
670
|
const parts = specifier.trim().split(/\s+as\s+/);
|
|
446
|
-
const exportedName = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess',
|
|
671
|
+
const exportedName = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess', _9 => _9.trim, 'call', _10 => _10()]);
|
|
447
672
|
if (exportedName === "hydrate") {
|
|
448
673
|
return true;
|
|
449
674
|
}
|
|
@@ -611,7 +836,7 @@ function isIslandExportStart(tokens, index) {
|
|
|
611
836
|
const token = tokens[index];
|
|
612
837
|
const previous = tokens[index - 1];
|
|
613
838
|
const startsStatement = !previous || previous.value === ";" || previous.value === "{" || previous.value === "}" || token.line > previous.line;
|
|
614
|
-
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access',
|
|
839
|
+
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access', _11 => _11[index + 1], 'optionalAccess', _12 => _12.value]) === "const" && _optionalChain([tokens, 'access', _13 => _13[index + 2], 'optionalAccess', _14 => _14.value]) === "island";
|
|
615
840
|
}
|
|
616
841
|
function getIslandStrategyExport(content) {
|
|
617
842
|
if (!content) return null;
|
|
@@ -619,15 +844,15 @@ function getIslandStrategyExport(content) {
|
|
|
619
844
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
620
845
|
if (!isIslandExportStart(tokens, index)) continue;
|
|
621
846
|
let valueIndex = index + 3;
|
|
622
|
-
if (_optionalChain([tokens, 'access',
|
|
847
|
+
if (_optionalChain([tokens, 'access', _15 => _15[valueIndex], 'optionalAccess', _16 => _16.value]) === ":") {
|
|
623
848
|
while (valueIndex < tokens.length && tokens[valueIndex].value !== "=") valueIndex++;
|
|
624
849
|
}
|
|
625
|
-
if (_optionalChain([tokens, 'access',
|
|
850
|
+
if (_optionalChain([tokens, 'access', _17 => _17[valueIndex], 'optionalAccess', _18 => _18.value]) !== "=") break;
|
|
626
851
|
valueIndex++;
|
|
627
852
|
const literal = tokens[valueIndex];
|
|
628
853
|
if (!literal || literal.kind !== "string" || !_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, literal.value)) break;
|
|
629
854
|
let trailingIndex = valueIndex + 1;
|
|
630
|
-
if (_optionalChain([tokens, 'access',
|
|
855
|
+
if (_optionalChain([tokens, 'access', _19 => _19[trailingIndex], 'optionalAccess', _20 => _20.value]) === "as" && _optionalChain([tokens, 'access', _21 => _21[trailingIndex + 1], 'optionalAccess', _22 => _22.value]) === "const") {
|
|
631
856
|
trailingIndex += 2;
|
|
632
857
|
}
|
|
633
858
|
const trailing = tokens[trailingIndex];
|
|
@@ -653,13 +878,13 @@ function hasAsyncDefaultExport(content) {
|
|
|
653
878
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
654
879
|
const token = tokens[index];
|
|
655
880
|
if (token.kind !== "identifier" || token.value !== "export") continue;
|
|
656
|
-
if (_optionalChain([tokens, 'access',
|
|
657
|
-
if (_optionalChain([tokens, 'access',
|
|
881
|
+
if (_optionalChain([tokens, 'access', _23 => _23[index - 1], 'optionalAccess', _24 => _24.value]) === ".") continue;
|
|
882
|
+
if (_optionalChain([tokens, 'access', _25 => _25[index + 1], 'optionalAccess', _26 => _26.value]) !== "default") continue;
|
|
658
883
|
const exported = tokens[index + 2];
|
|
659
884
|
if (exported.kind === "identifier" && exported.value === "async") {
|
|
660
885
|
return true;
|
|
661
886
|
}
|
|
662
|
-
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access',
|
|
887
|
+
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access', _27 => _27[index + 3], 'optionalAccess', _28 => _28.value]) !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
|
|
663
888
|
return true;
|
|
664
889
|
}
|
|
665
890
|
}
|
|
@@ -667,10 +892,10 @@ function hasAsyncDefaultExport(content) {
|
|
|
667
892
|
}
|
|
668
893
|
function isAsyncLocalDeclaration(tokens, name) {
|
|
669
894
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
670
|
-
if (tokens[index].value === "async" && _optionalChain([tokens, 'access',
|
|
895
|
+
if (tokens[index].value === "async" && _optionalChain([tokens, 'access', _29 => _29[index + 1], 'optionalAccess', _30 => _30.value]) === "function" && _optionalChain([tokens, 'access', _31 => _31[index + 2], 'optionalAccess', _32 => _32.value]) === name) {
|
|
671
896
|
return true;
|
|
672
897
|
}
|
|
673
|
-
if (tokens[index].value === name && _optionalChain([tokens, 'access',
|
|
898
|
+
if (tokens[index].value === name && _optionalChain([tokens, 'access', _33 => _33[index + 1], 'optionalAccess', _34 => _34.value]) === "=" && _optionalChain([tokens, 'access', _35 => _35[index + 2], 'optionalAccess', _36 => _36.value]) === "async") {
|
|
674
899
|
return true;
|
|
675
900
|
}
|
|
676
901
|
}
|
|
@@ -823,7 +1048,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
823
1048
|
return plan;
|
|
824
1049
|
}
|
|
825
1050
|
function usesFarmServerTree(plan) {
|
|
826
|
-
return _optionalChain([plan, 'optionalAccess',
|
|
1051
|
+
return _optionalChain([plan, 'optionalAccess', _37 => _37.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0 && plan.isolatedBoundaries.every((boundary) => boundary.islandStrategy === "load");
|
|
827
1052
|
}
|
|
828
1053
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
829
1054
|
const plan = {
|
|
@@ -952,7 +1177,7 @@ function getStaticImportBindings(content) {
|
|
|
952
1177
|
if (!content) return bindings;
|
|
953
1178
|
const tokens = tokenizeModuleSource(content);
|
|
954
1179
|
for (let index = 0; index < tokens.length; index++) {
|
|
955
|
-
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access',
|
|
1180
|
+
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _38 => _38[index - 1], 'optionalAccess', _39 => _39.value]) === ".") continue;
|
|
956
1181
|
const first = tokens[index + 1];
|
|
957
1182
|
if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
|
|
958
1183
|
continue;
|
|
@@ -960,7 +1185,7 @@ function getStaticImportBindings(content) {
|
|
|
960
1185
|
let fromIndex = -1;
|
|
961
1186
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
962
1187
|
if (tokens[cursor].value === ";") break;
|
|
963
|
-
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access',
|
|
1188
|
+
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _40 => _40[cursor + 1], 'optionalAccess', _41 => _41.kind]) === "string") {
|
|
964
1189
|
fromIndex = cursor;
|
|
965
1190
|
break;
|
|
966
1191
|
}
|
|
@@ -969,13 +1194,13 @@ function getStaticImportBindings(content) {
|
|
|
969
1194
|
const specifier = tokens[fromIndex + 1].value;
|
|
970
1195
|
const clause = tokens.slice(index + 1, fromIndex);
|
|
971
1196
|
const localNames = [];
|
|
972
|
-
if (_optionalChain([clause, 'access',
|
|
1197
|
+
if (_optionalChain([clause, 'access', _42 => _42[0], 'optionalAccess', _43 => _43.kind]) === "identifier" && clause[0].value !== "type") {
|
|
973
1198
|
localNames.push(clause[0].value);
|
|
974
1199
|
}
|
|
975
1200
|
const namespaceAs = clause.findIndex(
|
|
976
|
-
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access',
|
|
1201
|
+
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _44 => _44[clauseIndex + 1], 'optionalAccess', _45 => _45.value]) === "as"
|
|
977
1202
|
);
|
|
978
|
-
if (namespaceAs !== -1 && _optionalChain([clause, 'access',
|
|
1203
|
+
if (namespaceAs !== -1 && _optionalChain([clause, 'access', _46 => _46[namespaceAs + 2], 'optionalAccess', _47 => _47.kind]) === "identifier") {
|
|
979
1204
|
localNames.push(clause[namespaceAs + 2].value);
|
|
980
1205
|
}
|
|
981
1206
|
const openingBrace = clause.findIndex((token) => token.value === "{");
|
|
@@ -985,11 +1210,11 @@ function getStaticImportBindings(content) {
|
|
|
985
1210
|
if (openingBrace !== -1 && closingBrace !== -1) {
|
|
986
1211
|
let entryStart = openingBrace + 1;
|
|
987
1212
|
for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
|
|
988
|
-
if (cursor !== closingBrace && _optionalChain([clause, 'access',
|
|
1213
|
+
if (cursor !== closingBrace && _optionalChain([clause, 'access', _48 => _48[cursor], 'optionalAccess', _49 => _49.value]) !== ",") continue;
|
|
989
1214
|
const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
|
|
990
1215
|
const asIndex = entry.findIndex((token) => token.value === "as");
|
|
991
1216
|
const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
|
|
992
|
-
if (_optionalChain([local, 'optionalAccess',
|
|
1217
|
+
if (_optionalChain([local, 'optionalAccess', _50 => _50.kind]) === "identifier") localNames.push(local.value);
|
|
993
1218
|
entryStart = cursor + 1;
|
|
994
1219
|
}
|
|
995
1220
|
}
|
|
@@ -1026,14 +1251,14 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
1026
1251
|
const open = [];
|
|
1027
1252
|
const isSelfClosing = (openingIndex) => {
|
|
1028
1253
|
for (let index = openingIndex; index < tokens.length; index++) {
|
|
1029
|
-
if (tokens[index].value === ">") return _optionalChain([tokens, 'access',
|
|
1254
|
+
if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _51 => _51[index - 1], 'optionalAccess', _52 => _52.value]) === "/";
|
|
1030
1255
|
}
|
|
1031
1256
|
return false;
|
|
1032
1257
|
};
|
|
1033
1258
|
for (let index = 0; index < tokens.length - 1; index++) {
|
|
1034
1259
|
if (tokens[index].value !== "<") continue;
|
|
1035
1260
|
if (tokens[index + 1].value === "/") {
|
|
1036
|
-
const closing = _optionalChain([tokens, 'access',
|
|
1261
|
+
const closing = _optionalChain([tokens, 'access', _53 => _53[index + 2], 'optionalAccess', _54 => _54.value]);
|
|
1037
1262
|
const at = closing ? open.lastIndexOf(closing) : -1;
|
|
1038
1263
|
if (at !== -1) open.length = at;
|
|
1039
1264
|
continue;
|
|
@@ -1076,7 +1301,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
|
|
|
1076
1301
|
}
|
|
1077
1302
|
function containsClientJsx(tokens, start, end, clientBindings) {
|
|
1078
1303
|
for (let index = start; index < end; index++) {
|
|
1079
|
-
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access',
|
|
1304
|
+
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _55 => _55[index + 1], 'optionalAccess', _56 => _56.value]))) return true;
|
|
1080
1305
|
}
|
|
1081
1306
|
return false;
|
|
1082
1307
|
}
|
|
@@ -1114,7 +1339,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
1114
1339
|
let helperName;
|
|
1115
1340
|
let bodyStart = -1;
|
|
1116
1341
|
let bodyEnd = -1;
|
|
1117
|
-
if (tokens[index].value === "function" && _optionalChain([tokens, 'access',
|
|
1342
|
+
if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _57 => _57[index + 1], 'optionalAccess', _58 => _58.kind]) === "identifier") {
|
|
1118
1343
|
helperName = tokens[index + 1].value;
|
|
1119
1344
|
const parametersStart = tokens.findIndex(
|
|
1120
1345
|
(token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
|
|
@@ -1124,21 +1349,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
1124
1349
|
(token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
|
|
1125
1350
|
);
|
|
1126
1351
|
if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
|
|
1127
|
-
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access',
|
|
1352
|
+
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _59 => _59[index + 1], 'optionalAccess', _60 => _60.kind]) === "identifier") {
|
|
1128
1353
|
helperName = tokens[index + 1].value;
|
|
1129
1354
|
let assignmentIndex = -1;
|
|
1130
1355
|
let arrowIndex = -1;
|
|
1131
1356
|
for (let cursor = index + 2; cursor < tokens.length; cursor++) {
|
|
1132
1357
|
if (tokens[cursor].value === ";") break;
|
|
1133
1358
|
if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
|
|
1134
|
-
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access',
|
|
1359
|
+
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _61 => _61[cursor + 1], 'optionalAccess', _62 => _62.value]) === ">") {
|
|
1135
1360
|
arrowIndex = cursor;
|
|
1136
1361
|
break;
|
|
1137
1362
|
}
|
|
1138
1363
|
}
|
|
1139
1364
|
if (arrowIndex !== -1) {
|
|
1140
1365
|
bodyStart = arrowIndex + 2;
|
|
1141
|
-
bodyEnd = _optionalChain([tokens, 'access',
|
|
1366
|
+
bodyEnd = _optionalChain([tokens, 'access', _63 => _63[bodyStart], 'optionalAccess', _64 => _64.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
|
|
1142
1367
|
} else if (assignmentIndex !== -1) {
|
|
1143
1368
|
bodyStart = assignmentIndex + 1;
|
|
1144
1369
|
bodyEnd = findStatementEnd(tokens, bodyStart);
|
|
@@ -1178,14 +1403,14 @@ function passesElementValuedProps(content, localBindings) {
|
|
|
1178
1403
|
else if (value === "}") braceDepth--;
|
|
1179
1404
|
else if (value === "<" && braceDepth > 0) return true;
|
|
1180
1405
|
else if (value === ">" && braceDepth === 0) {
|
|
1181
|
-
selfClosing = _optionalChain([tokens, 'access',
|
|
1406
|
+
selfClosing = _optionalChain([tokens, 'access', _65 => _65[cursor - 1], 'optionalAccess', _66 => _66.value]) === "/";
|
|
1182
1407
|
break;
|
|
1183
1408
|
}
|
|
1184
1409
|
}
|
|
1185
1410
|
if (selfClosing || cursor >= tokens.length) continue;
|
|
1186
1411
|
for (let child = cursor + 1; child < tokens.length; child++) {
|
|
1187
1412
|
if (tokens[child].value !== "<") continue;
|
|
1188
|
-
const closesBoundary = _optionalChain([tokens, 'access',
|
|
1413
|
+
const closesBoundary = _optionalChain([tokens, 'access', _67 => _67[child + 1], 'optionalAccess', _68 => _68.value]) === "/" && _optionalChain([tokens, 'access', _69 => _69[child + 2], 'optionalAccess', _70 => _70.value]) === name;
|
|
1189
1414
|
if (!closesBoundary) return true;
|
|
1190
1415
|
break;
|
|
1191
1416
|
}
|
|
@@ -1200,9 +1425,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
1200
1425
|
const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
|
|
1201
1426
|
for (let index = 0; index < tokens.length; index++) {
|
|
1202
1427
|
let callStart = -1;
|
|
1203
|
-
if (tokens[index].value === "." && (_optionalChain([tokens, 'access',
|
|
1428
|
+
if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _71 => _71[index + 1], 'optionalAccess', _72 => _72.value]) === "map" || _optionalChain([tokens, 'access', _73 => _73[index + 1], 'optionalAccess', _74 => _74.value]) === "flatMap") && _optionalChain([tokens, 'access', _75 => _75[index + 2], 'optionalAccess', _76 => _76.value]) === "(") {
|
|
1204
1429
|
callStart = index + 2;
|
|
1205
|
-
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access',
|
|
1430
|
+
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _77 => _77[index + 1], 'optionalAccess', _78 => _78.value]) === "." && _optionalChain([tokens, 'access', _79 => _79[index + 2], 'optionalAccess', _80 => _80.value]) === "from" && _optionalChain([tokens, 'access', _81 => _81[index + 3], 'optionalAccess', _82 => _82.value]) === "(") {
|
|
1206
1431
|
callStart = index + 3;
|
|
1207
1432
|
}
|
|
1208
1433
|
if (callStart !== -1) {
|
|
@@ -1211,10 +1436,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
1211
1436
|
index = callEnd;
|
|
1212
1437
|
continue;
|
|
1213
1438
|
}
|
|
1214
|
-
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access',
|
|
1439
|
+
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _83 => _83[index + 1], 'optionalAccess', _84 => _84.value]) === "(") {
|
|
1215
1440
|
const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
|
|
1216
1441
|
const bodyStart = conditionEnd + 1;
|
|
1217
|
-
const bodyEnd = _optionalChain([tokens, 'access',
|
|
1442
|
+
const bodyEnd = _optionalChain([tokens, 'access', _85 => _85[bodyStart], 'optionalAccess', _86 => _86.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
|
|
1218
1443
|
if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
|
|
1219
1444
|
}
|
|
1220
1445
|
}
|
|
@@ -1228,7 +1453,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
1228
1453
|
let fallbackReason;
|
|
1229
1454
|
let fallbackHint;
|
|
1230
1455
|
let costGuardExceeded = false;
|
|
1231
|
-
const projectRoot = root ?
|
|
1456
|
+
const projectRoot = root ? path5.default.resolve(root) : void 0;
|
|
1232
1457
|
const visit = (moduleSourcePath) => {
|
|
1233
1458
|
if (fallbackReason) return 0;
|
|
1234
1459
|
const cached = estimates.get(moduleSourcePath);
|
|
@@ -1238,7 +1463,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
1238
1463
|
const content = readIfExists(moduleSourcePath);
|
|
1239
1464
|
const parsed = parseClientModuleMetadata(content, false);
|
|
1240
1465
|
if (parsed.isClientComponent) {
|
|
1241
|
-
if (projectRoot && !
|
|
1466
|
+
if (projectRoot && !path5.default.resolve(moduleSourcePath).startsWith(`${projectRoot}${path5.default.sep}`)) {
|
|
1242
1467
|
fallbackReason = `client boundary ${moduleSourcePath} is outside the application root`;
|
|
1243
1468
|
fallbackHint = "Move the component into the application, or publish it as a package (package client components render as static HTML)";
|
|
1244
1469
|
return 0;
|
|
@@ -1371,7 +1596,24 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
1371
1596
|
};
|
|
1372
1597
|
}
|
|
1373
1598
|
function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
1599
|
+
const cache2 = getPackageClientBoundaryCache();
|
|
1600
|
+
if (!cache2 || !resolvedPath || visited.has(resolvedPath)) {
|
|
1601
|
+
return traversePackageClientBoundary(resolvedPath, root, visited);
|
|
1602
|
+
}
|
|
1603
|
+
const key = `${_nullishCoalesce(root, () => ( ""))}\0${resolvedPath}`;
|
|
1604
|
+
const cached = cache2.find(key, visited);
|
|
1605
|
+
if (cached) {
|
|
1606
|
+
for (const file of cached.files) visited.add(file);
|
|
1607
|
+
return { ...cached.result };
|
|
1608
|
+
}
|
|
1609
|
+
const trace = new PackageInspectionTrace();
|
|
1610
|
+
const result = traversePackageClientBoundary(resolvedPath, root, visited, trace);
|
|
1611
|
+
cache2.add(key, trace.toEntry(result));
|
|
1612
|
+
return result;
|
|
1613
|
+
}
|
|
1614
|
+
function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
1374
1615
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
1616
|
+
if (resolvedPath) _optionalChain([trace, 'optionalAccess', _87 => _87.stop, 'call', _88 => _88(resolvedPath)]);
|
|
1375
1617
|
return {
|
|
1376
1618
|
isClientComponent: false,
|
|
1377
1619
|
shouldHydrate: false,
|
|
@@ -1379,6 +1621,7 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
1379
1621
|
};
|
|
1380
1622
|
}
|
|
1381
1623
|
visited.add(resolvedPath);
|
|
1624
|
+
_optionalChain([trace, 'optionalAccess', _89 => _89.visit, 'call', _90 => _90(resolvedPath)]);
|
|
1382
1625
|
const content = readIfExists(resolvedPath);
|
|
1383
1626
|
const parsed = parseClientModuleMetadata(content, false);
|
|
1384
1627
|
let importsClientBoundary = false;
|
|
@@ -1386,7 +1629,7 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
1386
1629
|
for (const specifier of getImportSpecifiers(content)) {
|
|
1387
1630
|
if (!specifier.startsWith(".") && !specifier.startsWith("/")) continue;
|
|
1388
1631
|
const importedPath = resolveImportedModuleSourcePath(resolvedPath, specifier, root);
|
|
1389
|
-
const importedMetadata =
|
|
1632
|
+
const importedMetadata = traversePackageClientBoundary(importedPath, root, visited, trace);
|
|
1390
1633
|
if (!importedMetadata.shouldHydrate) continue;
|
|
1391
1634
|
importsClientBoundary = true;
|
|
1392
1635
|
if (importedIslandStrategy === null) {
|
|
@@ -1422,7 +1665,7 @@ function getImportSpecifiers(content) {
|
|
|
1422
1665
|
continue;
|
|
1423
1666
|
}
|
|
1424
1667
|
const previous = tokens[index - 1];
|
|
1425
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
1668
|
+
if (_optionalChain([previous, 'optionalAccess', _91 => _91.value]) === ".") continue;
|
|
1426
1669
|
const first = tokens[index + 1];
|
|
1427
1670
|
if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
|
|
1428
1671
|
continue;
|
|
@@ -1438,7 +1681,7 @@ function getImportSpecifiers(content) {
|
|
|
1438
1681
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
1439
1682
|
const token = tokens[cursor];
|
|
1440
1683
|
if (token.value === ";") break;
|
|
1441
|
-
if (token.value === "from" && _optionalChain([tokens, 'access',
|
|
1684
|
+
if (token.value === "from" && _optionalChain([tokens, 'access', _92 => _92[cursor + 1], 'optionalAccess', _93 => _93.kind]) === "string") {
|
|
1442
1685
|
fromIndex = cursor;
|
|
1443
1686
|
break;
|
|
1444
1687
|
}
|
|
@@ -1456,14 +1699,14 @@ function getImportSpecifiers(content) {
|
|
|
1456
1699
|
return Array.from(matches);
|
|
1457
1700
|
}
|
|
1458
1701
|
function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
1459
|
-
if (_optionalChain([tokens, 'access',
|
|
1702
|
+
if (_optionalChain([tokens, 'access', _94 => _94[startIndex], 'optionalAccess', _95 => _95.value]) !== "{") return false;
|
|
1460
1703
|
const closingBraceIndex = tokens.findIndex(
|
|
1461
1704
|
(token, index) => index > startIndex && index < endIndex && token.value === "}"
|
|
1462
1705
|
);
|
|
1463
1706
|
if (closingBraceIndex === -1) return false;
|
|
1464
1707
|
let entryStartsAt = startIndex + 1;
|
|
1465
1708
|
for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
|
|
1466
|
-
if (index !== closingBraceIndex && _optionalChain([tokens, 'access',
|
|
1709
|
+
if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _96 => _96[index], 'optionalAccess', _97 => _97.value]) !== ",") continue;
|
|
1467
1710
|
const entry = tokens.slice(entryStartsAt, index);
|
|
1468
1711
|
if (entry.length > 0 && entry[0].value !== "type") return false;
|
|
1469
1712
|
entryStartsAt = index + 1;
|
|
@@ -1485,7 +1728,7 @@ var ALIAS_IMPORT = /^(?:@\/|~\/|#)/;
|
|
|
1485
1728
|
function warnUnresolvedAliasImport(importerPath, specifier, root) {
|
|
1486
1729
|
if (!ALIAS_IMPORT.test(specifier) || warnedUnresolvedAliasImports.has(specifier)) return;
|
|
1487
1730
|
warnedUnresolvedAliasImports.add(specifier);
|
|
1488
|
-
const importer = root ?
|
|
1731
|
+
const importer = root ? path5.default.relative(root, importerPath) : importerPath;
|
|
1489
1732
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
1490
1733
|
`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".`
|
|
1491
1734
|
);
|
|
@@ -1494,7 +1737,7 @@ var projectImportAliasCache = /* @__PURE__ */ new Map();
|
|
|
1494
1737
|
var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
|
|
1495
1738
|
function resolveProjectAliasSourcePath(specifier, root) {
|
|
1496
1739
|
if (!root) return void 0;
|
|
1497
|
-
const projectRoot =
|
|
1740
|
+
const projectRoot = path5.default.resolve(root);
|
|
1498
1741
|
let match;
|
|
1499
1742
|
for (const alias of getProjectImportAliases(projectRoot)) {
|
|
1500
1743
|
const captured = matchProjectImportAlias(alias, specifier);
|
|
@@ -1504,7 +1747,7 @@ function resolveProjectAliasSourcePath(specifier, root) {
|
|
|
1504
1747
|
if (!match) return void 0;
|
|
1505
1748
|
const resolved = resolveSourceCandidate(
|
|
1506
1749
|
match.alias.targets.map(
|
|
1507
|
-
(target) =>
|
|
1750
|
+
(target) => path5.default.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
|
|
1508
1751
|
)
|
|
1509
1752
|
);
|
|
1510
1753
|
return resolved && /\.d\.[cm]?ts$/.test(resolved) ? null : resolved;
|
|
@@ -1519,15 +1762,15 @@ function matchProjectImportAlias(alias, specifier) {
|
|
|
1519
1762
|
function getProjectImportAliases(projectRoot) {
|
|
1520
1763
|
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
1521
1764
|
try {
|
|
1522
|
-
return String(
|
|
1523
|
-
} catch (
|
|
1765
|
+
return String(fs3.default.statSync(path5.default.join(projectRoot, file)).mtimeMs);
|
|
1766
|
+
} catch (e6) {
|
|
1524
1767
|
return "-";
|
|
1525
1768
|
}
|
|
1526
1769
|
}).join(":");
|
|
1527
1770
|
const sourceDir = _chunkBPNOYILCcjs.getFarmProjectSourceDir.call(void 0, projectRoot);
|
|
1528
1771
|
const cacheStamp = `${stamp}:${sourceDir}`;
|
|
1529
1772
|
const cached = projectImportAliasCache.get(projectRoot);
|
|
1530
|
-
if (_optionalChain([cached, 'optionalAccess',
|
|
1773
|
+
if (_optionalChain([cached, 'optionalAccess', _98 => _98.stamp]) === cacheStamp) return cached.aliases;
|
|
1531
1774
|
const aliases = [
|
|
1532
1775
|
...readTsconfigPathAliases(projectRoot),
|
|
1533
1776
|
...readPackageImportAliases(projectRoot)
|
|
@@ -1537,7 +1780,7 @@ function getProjectImportAliases(projectRoot) {
|
|
|
1537
1780
|
prefix: "@/",
|
|
1538
1781
|
suffix: "",
|
|
1539
1782
|
wildcard: true,
|
|
1540
|
-
targets: [
|
|
1783
|
+
targets: [path5.default.join(projectRoot, sourceDir, "*")]
|
|
1541
1784
|
});
|
|
1542
1785
|
}
|
|
1543
1786
|
projectImportAliasCache.set(projectRoot, { stamp: cacheStamp, aliases });
|
|
@@ -1545,10 +1788,10 @@ function getProjectImportAliases(projectRoot) {
|
|
|
1545
1788
|
}
|
|
1546
1789
|
function readTsconfigPathAliases(projectRoot) {
|
|
1547
1790
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
1548
|
-
const configPath =
|
|
1549
|
-
if (!
|
|
1791
|
+
const configPath = path5.default.join(projectRoot, name);
|
|
1792
|
+
if (!fs3.default.existsSync(configPath)) continue;
|
|
1550
1793
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
1551
|
-
if (!_optionalChain([resolved, 'optionalAccess',
|
|
1794
|
+
if (!_optionalChain([resolved, 'optionalAccess', _99 => _99.paths])) return [];
|
|
1552
1795
|
const base = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
|
|
1553
1796
|
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
1554
1797
|
if (!Array.isArray(targets)) return [];
|
|
@@ -1558,7 +1801,7 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
1558
1801
|
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
1559
1802
|
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
1560
1803
|
wildcard: wildcardIndex !== -1,
|
|
1561
|
-
targets: targets.filter((target) => typeof target === "string").map((target) =>
|
|
1804
|
+
targets: targets.filter((target) => typeof target === "string").map((target) => path5.default.resolve(base, target))
|
|
1562
1805
|
}
|
|
1563
1806
|
];
|
|
1564
1807
|
});
|
|
@@ -1570,38 +1813,38 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
1570
1813
|
visited.add(configPath);
|
|
1571
1814
|
const config = readJsonWithComments(configPath);
|
|
1572
1815
|
if (!config) return null;
|
|
1573
|
-
const directory =
|
|
1816
|
+
const directory = path5.default.dirname(configPath);
|
|
1574
1817
|
const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
|
|
1575
1818
|
(parent) => typeof parent === "string" && parent.startsWith(".")
|
|
1576
1819
|
);
|
|
1577
1820
|
let inherited = null;
|
|
1578
1821
|
for (const parent of parents) {
|
|
1579
|
-
const parentPath =
|
|
1822
|
+
const parentPath = path5.default.resolve(
|
|
1580
1823
|
directory,
|
|
1581
1824
|
parent.endsWith(".json") ? parent : `${parent}.json`
|
|
1582
1825
|
);
|
|
1583
1826
|
inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
|
|
1584
1827
|
}
|
|
1585
1828
|
const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
|
|
1586
|
-
const baseUrl = typeof options.baseUrl === "string" ?
|
|
1829
|
+
const baseUrl = typeof options.baseUrl === "string" ? path5.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _100 => _100.baseUrl]);
|
|
1587
1830
|
if (options.paths && typeof options.paths === "object") {
|
|
1588
1831
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
1589
1832
|
}
|
|
1590
1833
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
1591
1834
|
}
|
|
1592
1835
|
function readPackageImportAliases(projectRoot) {
|
|
1593
|
-
const imports = _optionalChain([readPackageJson, 'call',
|
|
1836
|
+
const imports = _optionalChain([readPackageJson, 'call', _101 => _101(path5.default.join(projectRoot, "package.json")), 'optionalAccess', _102 => _102.imports]);
|
|
1594
1837
|
if (!imports || typeof imports !== "object") return [];
|
|
1595
1838
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
1596
1839
|
const target = resolveConditionalExportTarget(value);
|
|
1597
|
-
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess',
|
|
1840
|
+
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _103 => _103.startsWith, 'call', _104 => _104("./")])) return [];
|
|
1598
1841
|
const wildcardIndex = pattern.indexOf("*");
|
|
1599
1842
|
return [
|
|
1600
1843
|
{
|
|
1601
1844
|
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
1602
1845
|
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
1603
1846
|
wildcard: wildcardIndex !== -1,
|
|
1604
|
-
targets: [
|
|
1847
|
+
targets: [path5.default.resolve(projectRoot, target)]
|
|
1605
1848
|
}
|
|
1606
1849
|
];
|
|
1607
1850
|
});
|
|
@@ -1609,8 +1852,8 @@ function readPackageImportAliases(projectRoot) {
|
|
|
1609
1852
|
function readJsonWithComments(filePath) {
|
|
1610
1853
|
let source;
|
|
1611
1854
|
try {
|
|
1612
|
-
source =
|
|
1613
|
-
} catch (
|
|
1855
|
+
source = fs3.default.readFileSync(filePath, "utf8");
|
|
1856
|
+
} catch (e7) {
|
|
1614
1857
|
return null;
|
|
1615
1858
|
}
|
|
1616
1859
|
let output = "";
|
|
@@ -1638,7 +1881,7 @@ function readJsonWithComments(filePath) {
|
|
|
1638
1881
|
}
|
|
1639
1882
|
try {
|
|
1640
1883
|
return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
|
|
1641
|
-
} catch (
|
|
1884
|
+
} catch (e8) {
|
|
1642
1885
|
return null;
|
|
1643
1886
|
}
|
|
1644
1887
|
}
|
|
@@ -1647,7 +1890,7 @@ function resolveImportedModuleSourcePath(importerPath, specifier, root) {
|
|
|
1647
1890
|
return resolvePackageModuleSourcePath(importerPath, specifier, root);
|
|
1648
1891
|
}
|
|
1649
1892
|
const candidates = /* @__PURE__ */ new Set();
|
|
1650
|
-
const basePath = specifier.startsWith(".") ?
|
|
1893
|
+
const basePath = specifier.startsWith(".") ? path5.default.resolve(path5.default.dirname(importerPath), specifier) : root ? path5.default.resolve(root, specifier.replace(/^\/+/, "")) : path5.default.resolve(specifier);
|
|
1651
1894
|
candidates.add(basePath);
|
|
1652
1895
|
return resolveSourceCandidate(candidates);
|
|
1653
1896
|
}
|
|
@@ -1657,45 +1900,45 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
1657
1900
|
const packageSubpath = packageParts.slice(packageName.startsWith("@") ? 2 : 1).join("/");
|
|
1658
1901
|
const packageDirectory = findPackageDirectory(importerPath, packageName, root);
|
|
1659
1902
|
if (!packageDirectory) return null;
|
|
1660
|
-
const packageJsonPath =
|
|
1903
|
+
const packageJsonPath = path5.default.join(packageDirectory, "package.json");
|
|
1661
1904
|
const packageJson = readPackageJson(packageJsonPath);
|
|
1662
1905
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
1663
|
-
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess',
|
|
1906
|
+
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _105 => _105.exports]), exportKey);
|
|
1664
1907
|
const candidates = /* @__PURE__ */ new Set();
|
|
1665
|
-
if (_optionalChain([exportTarget, 'optionalAccess',
|
|
1666
|
-
candidates.add(
|
|
1908
|
+
if (_optionalChain([exportTarget, 'optionalAccess', _106 => _106.startsWith, 'call', _107 => _107("./")])) {
|
|
1909
|
+
candidates.add(path5.default.resolve(packageDirectory, exportTarget));
|
|
1667
1910
|
}
|
|
1668
1911
|
if (packageSubpath) {
|
|
1669
|
-
candidates.add(
|
|
1912
|
+
candidates.add(path5.default.join(packageDirectory, packageSubpath));
|
|
1670
1913
|
} else {
|
|
1671
|
-
for (const entry of [_optionalChain([packageJson, 'optionalAccess',
|
|
1672
|
-
if (typeof entry === "string") candidates.add(
|
|
1914
|
+
for (const entry of [_optionalChain([packageJson, 'optionalAccess', _108 => _108.browser]), _optionalChain([packageJson, 'optionalAccess', _109 => _109.module]), _optionalChain([packageJson, 'optionalAccess', _110 => _110.main])]) {
|
|
1915
|
+
if (typeof entry === "string") candidates.add(path5.default.resolve(packageDirectory, entry));
|
|
1673
1916
|
}
|
|
1674
|
-
candidates.add(
|
|
1917
|
+
candidates.add(path5.default.join(packageDirectory, "index"));
|
|
1675
1918
|
}
|
|
1676
1919
|
return resolveSourceCandidate(candidates);
|
|
1677
1920
|
}
|
|
1678
1921
|
function findPackageDirectory(importerPath, packageName, root) {
|
|
1679
1922
|
const searchRoots = /* @__PURE__ */ new Set();
|
|
1680
|
-
let current =
|
|
1923
|
+
let current = path5.default.dirname(importerPath);
|
|
1681
1924
|
while (true) {
|
|
1682
1925
|
searchRoots.add(current);
|
|
1683
|
-
const parent =
|
|
1926
|
+
const parent = path5.default.dirname(current);
|
|
1684
1927
|
if (parent === current) break;
|
|
1685
1928
|
current = parent;
|
|
1686
1929
|
}
|
|
1687
1930
|
if (root) {
|
|
1688
|
-
current =
|
|
1931
|
+
current = path5.default.resolve(root);
|
|
1689
1932
|
while (true) {
|
|
1690
1933
|
searchRoots.add(current);
|
|
1691
|
-
const parent =
|
|
1934
|
+
const parent = path5.default.dirname(current);
|
|
1692
1935
|
if (parent === current) break;
|
|
1693
1936
|
current = parent;
|
|
1694
1937
|
}
|
|
1695
1938
|
}
|
|
1696
1939
|
for (const searchRoot of searchRoots) {
|
|
1697
|
-
const packageDirectory =
|
|
1698
|
-
if (
|
|
1940
|
+
const packageDirectory = path5.default.join(searchRoot, "node_modules", packageName);
|
|
1941
|
+
if (fs3.default.existsSync(path5.default.join(packageDirectory, "package.json"))) {
|
|
1699
1942
|
return packageDirectory;
|
|
1700
1943
|
}
|
|
1701
1944
|
}
|
|
@@ -1703,8 +1946,8 @@ function findPackageDirectory(importerPath, packageName, root) {
|
|
|
1703
1946
|
}
|
|
1704
1947
|
function readPackageJson(packageJsonPath) {
|
|
1705
1948
|
try {
|
|
1706
|
-
return JSON.parse(
|
|
1707
|
-
} catch (
|
|
1949
|
+
return JSON.parse(fs3.default.readFileSync(packageJsonPath, "utf8"));
|
|
1950
|
+
} catch (e9) {
|
|
1708
1951
|
return null;
|
|
1709
1952
|
}
|
|
1710
1953
|
}
|
|
@@ -1733,7 +1976,7 @@ function resolvePackageExport(exportsField, exportKey) {
|
|
|
1733
1976
|
if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
|
|
1734
1977
|
const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
|
|
1735
1978
|
const target = resolveConditionalExportTarget(value);
|
|
1736
|
-
return _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
1979
|
+
return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _111 => _111.replace, 'call', _112 => _112("*", wildcard)]), () => ( null));
|
|
1737
1980
|
}
|
|
1738
1981
|
return null;
|
|
1739
1982
|
}
|
|
@@ -1761,12 +2004,12 @@ function resolveSourceCandidate(candidates) {
|
|
|
1761
2004
|
for (const candidate of candidates) {
|
|
1762
2005
|
const paths = [candidate];
|
|
1763
2006
|
for (const extension of RESOLVABLE_SOURCE_EXTENSIONS) {
|
|
1764
|
-
paths.push(`${candidate}${extension}`,
|
|
2007
|
+
paths.push(`${candidate}${extension}`, path5.default.join(candidate, `index${extension}`));
|
|
1765
2008
|
}
|
|
1766
2009
|
for (const sourcePath of paths) {
|
|
1767
2010
|
try {
|
|
1768
|
-
if (
|
|
1769
|
-
} catch (
|
|
2011
|
+
if (fs3.default.statSync(sourcePath).isFile()) return sourcePath;
|
|
2012
|
+
} catch (e10) {
|
|
1770
2013
|
}
|
|
1771
2014
|
}
|
|
1772
2015
|
}
|
|
@@ -1821,13 +2064,13 @@ async function inspectStaticMetadataImage(filePath) {
|
|
|
1821
2064
|
};
|
|
1822
2065
|
}
|
|
1823
2066
|
function getStaticMetadataImageAltPath(filePath) {
|
|
1824
|
-
return
|
|
1825
|
-
|
|
1826
|
-
`${
|
|
2067
|
+
return path5.default.join(
|
|
2068
|
+
path5.default.dirname(filePath),
|
|
2069
|
+
`${path5.default.basename(filePath, path5.default.extname(filePath))}.alt.txt`
|
|
1827
2070
|
);
|
|
1828
2071
|
}
|
|
1829
2072
|
function getStaticMetadataImageExtension(filePath) {
|
|
1830
|
-
const extension =
|
|
2073
|
+
const extension = path5.default.extname(filePath).slice(1).toLowerCase();
|
|
1831
2074
|
return STATIC_METADATA_IMAGE_EXTENSIONS.includes(extension) ? extension : null;
|
|
1832
2075
|
}
|
|
1833
2076
|
async function readAltText(filePath) {
|
|
@@ -1925,8 +2168,8 @@ var RouteManager = class {
|
|
|
1925
2168
|
)
|
|
1926
2169
|
);
|
|
1927
2170
|
this.orderedLayouts = Array.from(this.layouts.values()).sort(
|
|
1928
|
-
(left, right) =>
|
|
1929
|
-
).map((entry) => ({ entry, groupScope:
|
|
2171
|
+
(left, right) => _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, right.pattern)
|
|
2172
|
+
).map((entry) => ({ entry, groupScope: _chunkTSFMFPRUcjs.getRouteGroupScope.call(void 0, entry.pattern) }));
|
|
1930
2173
|
for (const slot of this.routeSlots.values()) {
|
|
1931
2174
|
if (!this.routeSlotOwnerSegments.has(slot.ownerPattern)) {
|
|
1932
2175
|
this.routeSlotOwnerSegments.set(
|
|
@@ -2037,7 +2280,7 @@ var RouteManager = class {
|
|
|
2037
2280
|
matchRedirect(pathname, search = "") {
|
|
2038
2281
|
const i18n = this.getI18nConfig();
|
|
2039
2282
|
const localeMatch = i18n ? _chunkOWQV6MLMcjs.resolveFarmLocalePath.call(void 0, pathname, i18n) : void 0;
|
|
2040
|
-
const routePathname = _optionalChain([localeMatch, 'optionalAccess',
|
|
2283
|
+
const routePathname = _optionalChain([localeMatch, 'optionalAccess', _113 => _113.pathname]) || pathname;
|
|
2041
2284
|
const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
|
|
2042
2285
|
for (const redirectEntry of this.redirects.values()) {
|
|
2043
2286
|
const match = _chunkVQJYGZNXcjs.matchRoute.call(void 0, normalizedPath, redirectEntry.route.segments);
|
|
@@ -2048,7 +2291,7 @@ var RouteManager = class {
|
|
|
2048
2291
|
destination: _chunkHXNLKCWHcjs.appendFarmRedirectQuery.call(void 0,
|
|
2049
2292
|
this.localizeRedirectDestination(
|
|
2050
2293
|
interpolateRedirectDestination(redirectEntry.definition.destination, match.params),
|
|
2051
|
-
_optionalChain([localeMatch, 'optionalAccess',
|
|
2294
|
+
_optionalChain([localeMatch, 'optionalAccess', _114 => _114.locale])
|
|
2052
2295
|
),
|
|
2053
2296
|
search
|
|
2054
2297
|
),
|
|
@@ -2155,14 +2398,14 @@ var RouteManager = class {
|
|
|
2155
2398
|
* Requests still fetch route data, but never inspect component source.
|
|
2156
2399
|
*/
|
|
2157
2400
|
generateClientManifest(projectRoot = this.config.root) {
|
|
2158
|
-
const normalizedProjectRoot =
|
|
2159
|
-
if (_optionalChain([this, 'access',
|
|
2401
|
+
const normalizedProjectRoot = path5.default.resolve(projectRoot);
|
|
2402
|
+
if (_optionalChain([this, 'access', _115 => _115.clientManifestCache, 'optionalAccess', _116 => _116.projectRoot]) === normalizedProjectRoot) {
|
|
2160
2403
|
return this.clientManifestCache.manifest;
|
|
2161
2404
|
}
|
|
2162
2405
|
const toUrlPath = (absolutePath) => {
|
|
2163
2406
|
const rootRelative = _chunkVQJYGZNXcjs.toRootRelativeUrlPath.call(void 0, absolutePath, normalizedProjectRoot);
|
|
2164
2407
|
if (rootRelative !== void 0) return rootRelative;
|
|
2165
|
-
if (
|
|
2408
|
+
if (path5.default.isAbsolute(absolutePath)) {
|
|
2166
2409
|
const normalized = absolutePath.replace(/\\/g, "/");
|
|
2167
2410
|
return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
|
|
2168
2411
|
}
|
|
@@ -2174,15 +2417,15 @@ var RouteManager = class {
|
|
|
2174
2417
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2175
2418
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2176
2419
|
);
|
|
2177
|
-
if (_optionalChain([this, 'access',
|
|
2420
|
+
if (_optionalChain([this, 'access', _117 => _117.config, 'access', _118 => _118.experimental, 'optionalAccess', _119 => _119.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _120 => _120.config, 'access', _121 => _121.experimental, 'optionalAccess', _122 => _122.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
2178
2421
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
2179
2422
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2180
2423
|
);
|
|
2181
2424
|
}
|
|
2182
2425
|
const isolatedMode = resolveFarmIsolatedClientHydrationMode(
|
|
2183
|
-
_optionalChain([this, 'access',
|
|
2426
|
+
_optionalChain([this, 'access', _123 => _123.config, 'access', _124 => _124.experimental, 'optionalAccess', _125 => _125.isolatedClientHydration]),
|
|
2184
2427
|
{
|
|
2185
|
-
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
2428
|
+
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _126 => _126.config, 'access', _127 => _127.experimental, 'optionalAccess', _128 => _128.serverComponents])) === "rsc",
|
|
2186
2429
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2187
2430
|
}
|
|
2188
2431
|
);
|
|
@@ -2190,7 +2433,7 @@ var RouteManager = class {
|
|
|
2190
2433
|
this.config.renderer,
|
|
2191
2434
|
Boolean(unsupportedIntegrationProvider)
|
|
2192
2435
|
);
|
|
2193
|
-
const islandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
2436
|
+
const islandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _129 => _129.config, 'access', _130 => _130.experimental, 'optionalAccess', _131 => _131.serverComponents])) === "islands";
|
|
2194
2437
|
const layoutEntries = Array.from(this.layouts.values()).map((entry) => ({
|
|
2195
2438
|
entry,
|
|
2196
2439
|
metadata: getClientModuleHydrationPlan(
|
|
@@ -2208,29 +2451,29 @@ var RouteManager = class {
|
|
|
2208
2451
|
);
|
|
2209
2452
|
const routeEntries = Array.from(this.routes.values()).map((entry) => ({
|
|
2210
2453
|
entry,
|
|
2211
|
-
metadata:
|
|
2454
|
+
metadata: _chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(entry.modulePath, normalizedProjectRoot, isolatedMode, {
|
|
2212
2455
|
...planOptions,
|
|
2213
|
-
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
2456
|
+
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _132 => _132.config, 'access', _133 => _133.experimental, 'optionalAccess', _134 => _134.serverComponents])) === "islands"
|
|
2214
2457
|
})
|
|
2215
2458
|
}));
|
|
2216
2459
|
const markdownFallback = routeEntries.find(
|
|
2217
|
-
({ entry, metadata }) =>
|
|
2460
|
+
({ entry, metadata }) => _chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
|
|
2218
2461
|
);
|
|
2219
2462
|
if (markdownFallback) {
|
|
2220
2463
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
2221
2464
|
`[Farm.js] client components in Markdown pages stay static: ${markdownFallback.metadata.fallbackReason}.`
|
|
2222
2465
|
);
|
|
2223
2466
|
}
|
|
2224
|
-
const markdownStaticPackages = _optionalChain([routeEntries, 'access',
|
|
2225
|
-
({ entry, metadata }) =>
|
|
2226
|
-
), 'optionalAccess',
|
|
2467
|
+
const markdownStaticPackages = _optionalChain([routeEntries, 'access', _135 => _135.find, 'call', _136 => _136(
|
|
2468
|
+
({ entry, metadata }) => _chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
|
|
2469
|
+
), 'optionalAccess', _137 => _137.metadata, 'access', _138 => _138.staticPackageBoundaries]);
|
|
2227
2470
|
if (markdownStaticPackages) {
|
|
2228
2471
|
_chunkVQJYGZNXcjs.logger.info(
|
|
2229
2472
|
`[Farm.js] Markdown pages render client components from ${markdownStaticPackages.join(", ")} as static HTML: package client components cannot be isolated yet.`
|
|
2230
2473
|
);
|
|
2231
2474
|
}
|
|
2232
2475
|
for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
|
|
2233
|
-
if (
|
|
2476
|
+
if (_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) || !metadata.staticPackageBoundaries) continue;
|
|
2234
2477
|
_chunkVQJYGZNXcjs.logger.info(
|
|
2235
2478
|
`[Farm.js] ${entry.pattern} is async, so it renders client components from ${metadata.staticPackageBoundaries.join(", ")} as static HTML: package client components cannot be isolated yet.`
|
|
2236
2479
|
);
|
|
@@ -2238,15 +2481,15 @@ var RouteManager = class {
|
|
|
2238
2481
|
enforceFarmIsolatedHydrationRouteBudget(
|
|
2239
2482
|
layoutEntries.map(({ entry, metadata }) => ({
|
|
2240
2483
|
pattern: entry.pattern,
|
|
2241
|
-
depth:
|
|
2484
|
+
depth: _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
|
|
2242
2485
|
metadata
|
|
2243
2486
|
})),
|
|
2244
2487
|
routeEntries.map(({ entry, metadata }) => ({
|
|
2245
2488
|
pattern: getRouteEntryDirectory(entry),
|
|
2246
|
-
depth:
|
|
2489
|
+
depth: _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
|
|
2247
2490
|
metadata
|
|
2248
2491
|
})),
|
|
2249
|
-
|
|
2492
|
+
_chunkTSFMFPRUcjs.routeBoundaryCoversDirectory
|
|
2250
2493
|
);
|
|
2251
2494
|
for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
|
|
2252
2495
|
if (!metadata.costGuardExceeded) continue;
|
|
@@ -2265,7 +2508,7 @@ var RouteManager = class {
|
|
|
2265
2508
|
const routes = routeEntries.map(({ entry, metadata }) => {
|
|
2266
2509
|
const programmaticPage = this.programmaticPages.get(entry.modulePath);
|
|
2267
2510
|
const layoutShouldHydrate = layoutEntries.some(
|
|
2268
|
-
({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate &&
|
|
2511
|
+
({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkTSFMFPRUcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
|
|
2269
2512
|
);
|
|
2270
2513
|
return {
|
|
2271
2514
|
pattern: entry.pattern,
|
|
@@ -2282,14 +2525,14 @@ var RouteManager = class {
|
|
|
2282
2525
|
}))
|
|
2283
2526
|
} : {},
|
|
2284
2527
|
...usesFarmServerTree(metadata) ? { serverTree: true } : {},
|
|
2285
|
-
renderPlan:
|
|
2528
|
+
renderPlan: _chunkTSFMFPRUcjs.createFarmRouteRenderPlan.call(void 0, {
|
|
2286
2529
|
pageShouldHydrate: metadata.shouldHydrate,
|
|
2287
2530
|
layoutShouldHydrate,
|
|
2288
2531
|
islandStrategy: metadata.islandStrategy
|
|
2289
2532
|
}),
|
|
2290
2533
|
suppressedAsyncHydration: metadata.suppressedAsyncHydration,
|
|
2291
2534
|
...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {},
|
|
2292
|
-
search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess',
|
|
2535
|
+
search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _139 => _139.search])),
|
|
2293
2536
|
segments: entry.route.segments.map((seg) => ({
|
|
2294
2537
|
segment: seg.segment,
|
|
2295
2538
|
isDynamic: seg.isDynamic,
|
|
@@ -2298,7 +2541,7 @@ var RouteManager = class {
|
|
|
2298
2541
|
}))
|
|
2299
2542
|
};
|
|
2300
2543
|
});
|
|
2301
|
-
const treeLayoutPatterns = islandsMode ?
|
|
2544
|
+
const treeLayoutPatterns = islandsMode ? _chunkTSFMFPRUcjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
2302
2545
|
layoutEntries.map(({ entry, metadata }) => ({
|
|
2303
2546
|
pattern: entry.pattern,
|
|
2304
2547
|
shouldHydrate: metadata.shouldHydrate,
|
|
@@ -2341,7 +2584,7 @@ var RouteManager = class {
|
|
|
2341
2584
|
for (const { metadata } of [...layoutEntries, ...routeEntries]) {
|
|
2342
2585
|
if (!metadata.hasIsolatedClientBoundaries && !metadata.serverTreeLayout) continue;
|
|
2343
2586
|
for (const boundary of metadata.isolatedBoundaries) {
|
|
2344
|
-
isolatedClientBoundaryModules.add(
|
|
2587
|
+
isolatedClientBoundaryModules.add(path5.default.resolve(boundary.modulePath));
|
|
2345
2588
|
}
|
|
2346
2589
|
}
|
|
2347
2590
|
const islandsErrors = [
|
|
@@ -2392,17 +2635,17 @@ var RouteManager = class {
|
|
|
2392
2635
|
}
|
|
2393
2636
|
/** @internal Client modules selected by the compiled hydration ownership plan. */
|
|
2394
2637
|
getIsolatedClientBoundaryModules(projectRoot = this.config.root) {
|
|
2395
|
-
const normalizedProjectRoot =
|
|
2638
|
+
const normalizedProjectRoot = path5.default.resolve(projectRoot);
|
|
2396
2639
|
this.generateClientManifest(normalizedProjectRoot);
|
|
2397
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2640
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _140 => _140.clientManifestCache, 'optionalAccess', _141 => _141.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
|
|
2398
2641
|
}
|
|
2399
2642
|
/**
|
|
2400
2643
|
* @internal Islands-mode pages with a client component that cannot become an island. Hydrating
|
|
2401
2644
|
* such a page whole would ship its server code to the browser, so it stays static instead.
|
|
2402
2645
|
*/
|
|
2403
2646
|
getIslandsErrors(projectRoot = this.config.root) {
|
|
2404
|
-
this.generateClientManifest(
|
|
2405
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2647
|
+
this.generateClientManifest(path5.default.resolve(projectRoot));
|
|
2648
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _142 => _142.clientManifestCache, 'optionalAccess', _143 => _143.islandsErrors]), () => ( []));
|
|
2406
2649
|
}
|
|
2407
2650
|
/**
|
|
2408
2651
|
* Invalidate build-time route metadata after a page or layout changes in dev.
|
|
@@ -2421,13 +2664,13 @@ var RouteManager = class {
|
|
|
2421
2664
|
const { createRouteModuleFromProgrammaticPage } = await import("./routes.cjs");
|
|
2422
2665
|
return createRouteModuleFromProgrammaticPage(programmaticPage, this.rendererRuntime);
|
|
2423
2666
|
}
|
|
2424
|
-
if (
|
|
2667
|
+
if (_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, modulePath)) {
|
|
2425
2668
|
const mdxConfig = _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, this.config.mdx);
|
|
2426
|
-
const components = await
|
|
2669
|
+
const components = await _chunkUJL4JOXVcjs.loadFarmMdxComponents.call(void 0, mdxConfig, {
|
|
2427
2670
|
root: this.config.root,
|
|
2428
2671
|
loadModule: this.viteServer ? (componentModulePath) => _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, componentModulePath) : void 0
|
|
2429
2672
|
});
|
|
2430
|
-
return await
|
|
2673
|
+
return await _chunkUJL4JOXVcjs.createFarmMarkdownRouteModuleFromFile.call(void 0, modulePath, {
|
|
2431
2674
|
components,
|
|
2432
2675
|
config: mdxConfig
|
|
2433
2676
|
});
|
|
@@ -2477,7 +2720,7 @@ var RouteManager = class {
|
|
|
2477
2720
|
*/
|
|
2478
2721
|
createRoutePattern(route) {
|
|
2479
2722
|
if (route.segments.length === 0) return "/";
|
|
2480
|
-
return "/" + route.segments.map(
|
|
2723
|
+
return "/" + route.segments.map(_chunkTSFMFPRUcjs.formatRouteSegment).join("/");
|
|
2481
2724
|
}
|
|
2482
2725
|
registerPageRoute(entry) {
|
|
2483
2726
|
_chunkYTVSWXEZcjs.assertUniqueRouteParameters.call(void 0, entry.pattern);
|
|
@@ -2528,25 +2771,25 @@ var RouteManager = class {
|
|
|
2528
2771
|
}
|
|
2529
2772
|
}
|
|
2530
2773
|
for (const [pattern, group] of canonicalPageGroups) {
|
|
2531
|
-
const componentFiles = group.files.filter((file) => !
|
|
2532
|
-
const markdownFiles = group.files.filter(
|
|
2774
|
+
const componentFiles = group.files.filter((file) => !_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, file));
|
|
2775
|
+
const markdownFiles = group.files.filter(_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile);
|
|
2533
2776
|
if (componentFiles.length > 1) {
|
|
2534
2777
|
throw new Error(
|
|
2535
|
-
`Duplicate page route "${pattern}". Found ${componentFiles.map((file) =>
|
|
2778
|
+
`Duplicate page route "${pattern}". Found ${componentFiles.map((file) => path5.default.join(appDir, file)).join(" and ")}.`
|
|
2536
2779
|
);
|
|
2537
2780
|
}
|
|
2538
2781
|
if (markdownFiles.length > 1) {
|
|
2539
2782
|
throw new Error(
|
|
2540
|
-
`Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) =>
|
|
2783
|
+
`Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) => path5.default.join(appDir, file)).join(" and ")}.`
|
|
2541
2784
|
);
|
|
2542
2785
|
}
|
|
2543
2786
|
const componentFile = componentFiles[0];
|
|
2544
2787
|
const markdownFile = markdownFiles[0];
|
|
2545
2788
|
const primaryFile = componentFile || markdownFile;
|
|
2546
2789
|
if (!primaryFile) continue;
|
|
2547
|
-
const modulePath =
|
|
2790
|
+
const modulePath = path5.default.join(appDir, primaryFile);
|
|
2548
2791
|
const existing = this.routes.get(pattern);
|
|
2549
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
2792
|
+
if (_optionalChain([existing, 'optionalAccess', _144 => _144.sourceRoot]) === source.root) {
|
|
2550
2793
|
throw new Error(
|
|
2551
2794
|
`Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
2552
2795
|
);
|
|
@@ -2555,7 +2798,7 @@ var RouteManager = class {
|
|
|
2555
2798
|
route: group.route,
|
|
2556
2799
|
modulePath,
|
|
2557
2800
|
...markdownFile ? {
|
|
2558
|
-
markdownSourcePath:
|
|
2801
|
+
markdownSourcePath: path5.default.join(appDir, markdownFile)
|
|
2559
2802
|
} : {},
|
|
2560
2803
|
pattern,
|
|
2561
2804
|
...getPageDirectoryField(group.route, pattern),
|
|
@@ -2570,10 +2813,10 @@ var RouteManager = class {
|
|
|
2570
2813
|
]) {
|
|
2571
2814
|
for (const file of files) {
|
|
2572
2815
|
const route = _chunkVQJYGZNXcjs.parseRoutePath.call(void 0, file);
|
|
2573
|
-
const modulePath =
|
|
2574
|
-
const pattern =
|
|
2816
|
+
const modulePath = path5.default.join(appDir, file);
|
|
2817
|
+
const pattern = _chunkTSFMFPRUcjs.createRouteDirectoryPattern.call(void 0, route);
|
|
2575
2818
|
const existing = target.get(pattern);
|
|
2576
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
2819
|
+
if (_optionalChain([existing, 'optionalAccess', _145 => _145.sourceRoot]) === source.root) {
|
|
2577
2820
|
throw new Error(
|
|
2578
2821
|
`Duplicate ${kind} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
2579
2822
|
);
|
|
@@ -2590,13 +2833,13 @@ var RouteManager = class {
|
|
|
2590
2833
|
for (const file of [...pageFiles, ...slotDefaultFiles]) {
|
|
2591
2834
|
const slot = _chunkEHB77D5Ucjs.parseRouteSlotFile.call(void 0, file);
|
|
2592
2835
|
if (!slot) continue;
|
|
2593
|
-
const modulePath =
|
|
2836
|
+
const modulePath = path5.default.join(appDir, file);
|
|
2594
2837
|
const pattern = this.createRoutePattern(slot.route);
|
|
2595
2838
|
const ownerPattern = this.createRoutePattern(slot.ownerRoute);
|
|
2596
|
-
const ownerDirectory =
|
|
2839
|
+
const ownerDirectory = _chunkTSFMFPRUcjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
|
|
2597
2840
|
const key = `${ownerPattern}:${slot.name}:${slot.interception ? "intercept" : "slot"}:${slot.fallback ? "default" : pattern}`;
|
|
2598
2841
|
const existing = this.routeSlots.get(key);
|
|
2599
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
2842
|
+
if (_optionalChain([existing, 'optionalAccess', _146 => _146.sourceRoot]) === source.root) {
|
|
2600
2843
|
throw new Error(
|
|
2601
2844
|
`Duplicate route slot "${slot.name}" for "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
2602
2845
|
);
|
|
@@ -2616,16 +2859,16 @@ var RouteManager = class {
|
|
|
2616
2859
|
});
|
|
2617
2860
|
}
|
|
2618
2861
|
for (const file of metadataImageFiles) {
|
|
2619
|
-
const fileBase =
|
|
2862
|
+
const fileBase = path5.default.basename(file, path5.default.extname(file));
|
|
2620
2863
|
const kind = fileBase === "twitter-image" ? "twitter" : "opengraph";
|
|
2621
2864
|
const fileName = kind === "twitter" ? "twitter-image" : "opengraph-image";
|
|
2622
2865
|
const route = _chunkVQJYGZNXcjs.parseRoutePath.call(void 0, file);
|
|
2623
|
-
const modulePath =
|
|
2866
|
+
const modulePath = path5.default.join(appDir, file);
|
|
2624
2867
|
const pattern = this.createRoutePattern(route);
|
|
2625
2868
|
const key = `${kind}:${pattern}`;
|
|
2626
2869
|
const existing = this.metadataImages.get(key);
|
|
2627
2870
|
const sourceType = isStaticMetadataImageFile(file) ? "static" : "module";
|
|
2628
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
2871
|
+
if (_optionalChain([existing, 'optionalAccess', _147 => _147.sourceRoot]) === source.root) {
|
|
2629
2872
|
throw new Error(
|
|
2630
2873
|
`Duplicate ${fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one static image or module per route segment.`
|
|
2631
2874
|
);
|
|
@@ -2645,15 +2888,15 @@ var RouteManager = class {
|
|
|
2645
2888
|
}
|
|
2646
2889
|
for (const file of metadataRouteFiles) {
|
|
2647
2890
|
const descriptor = getApplicationMetadataRouteDescriptor(
|
|
2648
|
-
|
|
2891
|
+
path5.default.basename(file, path5.default.extname(file))
|
|
2649
2892
|
);
|
|
2650
2893
|
if (!descriptor) continue;
|
|
2651
2894
|
const route = _chunkVQJYGZNXcjs.parseRoutePath.call(void 0, file);
|
|
2652
|
-
const modulePath =
|
|
2895
|
+
const modulePath = path5.default.join(appDir, file);
|
|
2653
2896
|
const pattern = this.createRoutePattern(route);
|
|
2654
2897
|
const key = `${descriptor.kind}:${pattern}`;
|
|
2655
2898
|
const existing = this.metadataRoutes.get(key);
|
|
2656
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
2899
|
+
if (_optionalChain([existing, 'optionalAccess', _148 => _148.sourceRoot]) === source.root) {
|
|
2657
2900
|
throw new Error(
|
|
2658
2901
|
`Duplicate ${descriptor.fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one .ts or .js metadata route per segment.`
|
|
2659
2902
|
);
|
|
@@ -2692,7 +2935,7 @@ var RouteManager = class {
|
|
|
2692
2935
|
const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "page");
|
|
2693
2936
|
const pattern = this.createRoutePattern(route);
|
|
2694
2937
|
const existing = this.routes.get(pattern);
|
|
2695
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
2938
|
+
if (_optionalChain([existing, 'optionalAccess', _149 => _149.sourceRoot]) === source.root) {
|
|
2696
2939
|
throw new Error(
|
|
2697
2940
|
`Duplicate page route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
|
|
2698
2941
|
);
|
|
@@ -2710,9 +2953,9 @@ var RouteManager = class {
|
|
|
2710
2953
|
}
|
|
2711
2954
|
if (definition.kind === "layout") {
|
|
2712
2955
|
const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "layout");
|
|
2713
|
-
const pattern =
|
|
2956
|
+
const pattern = _chunkTSFMFPRUcjs.createRouteDirectoryPattern.call(void 0, route);
|
|
2714
2957
|
const existing = this.layouts.get(pattern);
|
|
2715
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
2958
|
+
if (_optionalChain([existing, 'optionalAccess', _150 => _150.sourceRoot]) === source.root) {
|
|
2716
2959
|
throw new Error(
|
|
2717
2960
|
`Duplicate layout route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
|
|
2718
2961
|
);
|
|
@@ -2741,7 +2984,7 @@ var RouteManager = class {
|
|
|
2741
2984
|
}
|
|
2742
2985
|
async loadProgrammaticRoutesModule(filePath) {
|
|
2743
2986
|
if (this.viteServer) {
|
|
2744
|
-
const viteRoot = _optionalChain([this, 'access',
|
|
2987
|
+
const viteRoot = _optionalChain([this, 'access', _151 => _151.viteServer, 'access', _152 => _152.config, 'optionalAccess', _153 => _153.root]) || this.config.root || process.cwd();
|
|
2745
2988
|
return await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, filePath, viteRoot));
|
|
2746
2989
|
}
|
|
2747
2990
|
return await import(
|
|
@@ -2757,7 +3000,7 @@ var RouteManager = class {
|
|
|
2757
3000
|
const matchingLayouts = [];
|
|
2758
3001
|
for (const { entry, groupScope } of this.orderedLayouts) {
|
|
2759
3002
|
if (!_chunkVQJYGZNXcjs.matchRoutePrefixParts.call(void 0, pathnameParts, entry.route.segments)) continue;
|
|
2760
|
-
if (groupScope !== null && !
|
|
3003
|
+
if (groupScope !== null && !_chunkTSFMFPRUcjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
|
|
2761
3004
|
continue;
|
|
2762
3005
|
}
|
|
2763
3006
|
matchingLayouts.push(entry);
|
|
@@ -2838,14 +3081,14 @@ var RouteManager = class {
|
|
|
2838
3081
|
let page = route;
|
|
2839
3082
|
for (const boundaryEntry of boundaries.values()) {
|
|
2840
3083
|
if (!_chunkVQJYGZNXcjs.matchRoutePrefix.call(void 0, normalizedPath, boundaryEntry.route.segments)) continue;
|
|
2841
|
-
const groupScope =
|
|
3084
|
+
const groupScope = _chunkTSFMFPRUcjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
|
|
2842
3085
|
if (groupScope !== null) {
|
|
2843
3086
|
if (page === void 0) page = this.matchPageRoute(_chunkVQJYGZNXcjs.splitRoutePath.call(void 0, normalizedPath));
|
|
2844
|
-
if (!
|
|
3087
|
+
if (!_chunkTSFMFPRUcjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
|
|
2845
3088
|
}
|
|
2846
3089
|
const depth = boundaryEntry.route.segments.length;
|
|
2847
|
-
const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess',
|
|
2848
|
-
if (!bestMatch || depth > bestDepth || depth === bestDepth &&
|
|
3090
|
+
const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _154 => _154.route, 'access', _155 => _155.segments, 'access', _156 => _156.length]), () => ( -1));
|
|
3091
|
+
if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
|
|
2849
3092
|
bestMatch = boundaryEntry;
|
|
2850
3093
|
}
|
|
2851
3094
|
}
|
|
@@ -2943,7 +3186,7 @@ var RouteManager = class {
|
|
|
2943
3186
|
const mod = await this.loadRouteModule(modulePath);
|
|
2944
3187
|
const rendering = await _chunkUQHIWZZ6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
2945
3188
|
return rendering.ssg;
|
|
2946
|
-
} catch (
|
|
3189
|
+
} catch (e11) {
|
|
2947
3190
|
return false;
|
|
2948
3191
|
}
|
|
2949
3192
|
}
|
|
@@ -2955,7 +3198,7 @@ var RouteManager = class {
|
|
|
2955
3198
|
const mod = await this.loadRouteModule(modulePath);
|
|
2956
3199
|
const rendering = await _chunkUQHIWZZ6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
2957
3200
|
return rendering.ssg && typeof rendering.revalidate === "number" && rendering.revalidate > 0;
|
|
2958
|
-
} catch (
|
|
3201
|
+
} catch (e12) {
|
|
2959
3202
|
return false;
|
|
2960
3203
|
}
|
|
2961
3204
|
}
|
|
@@ -2967,13 +3210,13 @@ var RouteManager = class {
|
|
|
2967
3210
|
const mod = await this.loadRouteModule(modulePath);
|
|
2968
3211
|
const rendering = await _chunkUQHIWZZ6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
2969
3212
|
return rendering.revalidate;
|
|
2970
|
-
} catch (
|
|
3213
|
+
} catch (e13) {
|
|
2971
3214
|
return void 0;
|
|
2972
3215
|
}
|
|
2973
3216
|
}
|
|
2974
3217
|
};
|
|
2975
3218
|
function getPageDirectoryField(route, pattern) {
|
|
2976
|
-
const directory =
|
|
3219
|
+
const directory = _chunkTSFMFPRUcjs.createRouteDirectoryPattern.call(void 0, route);
|
|
2977
3220
|
return directory === pattern ? {} : { directory };
|
|
2978
3221
|
}
|
|
2979
3222
|
function interpolateRedirectDestination(destination, params) {
|
|
@@ -3047,14 +3290,14 @@ function replaceAll(input, search, replacement) {
|
|
|
3047
3290
|
async function safeGlobFiles(pattern, cwd) {
|
|
3048
3291
|
try {
|
|
3049
3292
|
return await _chunkVQJYGZNXcjs.globFiles.call(void 0, pattern, cwd);
|
|
3050
|
-
} catch (
|
|
3293
|
+
} catch (e14) {
|
|
3051
3294
|
return [];
|
|
3052
3295
|
}
|
|
3053
3296
|
}
|
|
3054
3297
|
function toRealPath(filePath) {
|
|
3055
3298
|
try {
|
|
3056
3299
|
return _fs.realpathSync.call(void 0, filePath);
|
|
3057
|
-
} catch (
|
|
3300
|
+
} catch (e15) {
|
|
3058
3301
|
return filePath;
|
|
3059
3302
|
}
|
|
3060
3303
|
}
|
|
@@ -3063,9 +3306,9 @@ function toRealPath(filePath) {
|
|
|
3063
3306
|
|
|
3064
3307
|
|
|
3065
3308
|
function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
|
|
3066
|
-
const file =
|
|
3067
|
-
if (!
|
|
3068
|
-
return `/${
|
|
3309
|
+
const file = path5.join(root, srcDir, "app", "globals.css");
|
|
3310
|
+
if (!fs3.existsSync(file)) return void 0;
|
|
3311
|
+
return `/${path5.relative(root, file).split(path5.sep).join("/")}`;
|
|
3069
3312
|
}
|
|
3070
3313
|
var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
|
|
3071
3314
|
var ALREADY_LINKED = "/src/app/globals.css";
|
|
@@ -3144,7 +3387,7 @@ function farmFontImportsPlugin(options = {}) {
|
|
|
3144
3387
|
return;
|
|
3145
3388
|
}
|
|
3146
3389
|
const resource = registry.getDevResource(pathname);
|
|
3147
|
-
if (!_optionalChain([resource, 'optionalAccess',
|
|
3390
|
+
if (!_optionalChain([resource, 'optionalAccess', _157 => _157.bytes])) {
|
|
3148
3391
|
next();
|
|
3149
3392
|
return;
|
|
3150
3393
|
}
|
|
@@ -3426,7 +3669,7 @@ ${FONT_SECTION_END}
|
|
|
3426
3669
|
let url;
|
|
3427
3670
|
try {
|
|
3428
3671
|
url = new URL(input.source);
|
|
3429
|
-
} catch (
|
|
3672
|
+
} catch (e16) {
|
|
3430
3673
|
throw fontError(input.moduleId, `remoteFont() source must be an absolute HTTPS URL`);
|
|
3431
3674
|
}
|
|
3432
3675
|
if (url.protocol !== "https:") {
|
|
@@ -3445,7 +3688,7 @@ ${FONT_SECTION_END}
|
|
|
3445
3688
|
return resource;
|
|
3446
3689
|
}
|
|
3447
3690
|
const bytes2 = await fetchRemoteFont(url, input.integrity);
|
|
3448
|
-
return this.createSelfHostedResource(bytes2, extension,
|
|
3691
|
+
return this.createSelfHostedResource(bytes2, extension, path5.default.basename(url.pathname));
|
|
3449
3692
|
}
|
|
3450
3693
|
if (input.source.startsWith("/")) {
|
|
3451
3694
|
return this.createPublicResource(input.moduleId, input.source);
|
|
@@ -3468,8 +3711,8 @@ ${FONT_SECTION_END}
|
|
|
3468
3711
|
}
|
|
3469
3712
|
return this.createSelfHostedResource(
|
|
3470
3713
|
bytes,
|
|
3471
|
-
|
|
3472
|
-
|
|
3714
|
+
path5.default.extname(resolvedPath),
|
|
3715
|
+
path5.default.basename(resolvedPath)
|
|
3473
3716
|
);
|
|
3474
3717
|
}
|
|
3475
3718
|
async createPublicResource(moduleId, source) {
|
|
@@ -3480,7 +3723,7 @@ ${FONT_SECTION_END}
|
|
|
3480
3723
|
);
|
|
3481
3724
|
}
|
|
3482
3725
|
const publicPath = normalizePublicFontPath(source, moduleId);
|
|
3483
|
-
const resolvedPath =
|
|
3726
|
+
const resolvedPath = path5.default.resolve(this.publicDir, `.${publicPath}`);
|
|
3484
3727
|
if (!isPathInside(this.publicDir, resolvedPath)) {
|
|
3485
3728
|
throw fontError(moduleId, `public font path must stay inside publicDir`);
|
|
3486
3729
|
}
|
|
@@ -3496,7 +3739,7 @@ ${FONT_SECTION_END}
|
|
|
3496
3739
|
`could not read ${JSON.stringify(source)} from publicDir: ${error.message}`
|
|
3497
3740
|
);
|
|
3498
3741
|
}
|
|
3499
|
-
const extension =
|
|
3742
|
+
const extension = path5.default.extname(resolvedPath).toLowerCase();
|
|
3500
3743
|
const hash = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex").slice(0, 12);
|
|
3501
3744
|
const resource = {
|
|
3502
3745
|
extension,
|
|
@@ -3511,7 +3754,7 @@ ${FONT_SECTION_END}
|
|
|
3511
3754
|
createSelfHostedResource(bytes, extension, fileName) {
|
|
3512
3755
|
const normalizedExtension = extension.toLowerCase();
|
|
3513
3756
|
const hash = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex").slice(0, 12);
|
|
3514
|
-
const baseName = sanitizeFileName(
|
|
3757
|
+
const baseName = sanitizeFileName(path5.default.basename(fileName, extension)) || "font";
|
|
3515
3758
|
const outputFileName = `assets/fonts/${baseName}-h${hash}${normalizedExtension}`;
|
|
3516
3759
|
const key = `${hash}${normalizedExtension}`;
|
|
3517
3760
|
const existing = this.resources.get(key);
|
|
@@ -3662,7 +3905,7 @@ function readFontOptions(code, id, call) {
|
|
|
3662
3905
|
const declaration = call.ancestors.at(-2);
|
|
3663
3906
|
const statement = call.ancestors.at(-3);
|
|
3664
3907
|
const statementParent = call.ancestors.at(-4);
|
|
3665
|
-
const isModuleScope = _optionalChain([declaration, 'optionalAccess',
|
|
3908
|
+
const isModuleScope = _optionalChain([declaration, 'optionalAccess', _158 => _158.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _159 => _159.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _160 => _160.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _161 => _161.type]) === "Program");
|
|
3666
3909
|
if (!isModuleScope || call.ancestors.some((ancestor) => isFunctionNode(ancestor))) {
|
|
3667
3910
|
throw fontError(id, `${call.kind}() must be declared directly at module scope`);
|
|
3668
3911
|
}
|
|
@@ -3864,24 +4107,24 @@ function verifyIntegrity(bytes, integrity) {
|
|
|
3864
4107
|
if (!matches) throw new Error("downloaded font did not match its integrity value");
|
|
3865
4108
|
}
|
|
3866
4109
|
function resolveLocalFontPath(source, importer, root) {
|
|
3867
|
-
if (source.startsWith(".")) return
|
|
3868
|
-
if (
|
|
4110
|
+
if (source.startsWith(".")) return path5.default.resolve(path5.default.dirname(importer), source);
|
|
4111
|
+
if (path5.default.isAbsolute(source)) {
|
|
3869
4112
|
return source;
|
|
3870
4113
|
}
|
|
3871
4114
|
try {
|
|
3872
4115
|
return _module.createRequire.call(void 0, _url.pathToFileURL.call(void 0, importer)).resolve(source);
|
|
3873
|
-
} catch (
|
|
4116
|
+
} catch (e17) {
|
|
3874
4117
|
const segments = source.replace(/\\/g, "/").split("/");
|
|
3875
|
-
if (segments.includes("..")) return
|
|
3876
|
-
let current =
|
|
3877
|
-
const filesystemRoot =
|
|
4118
|
+
if (segments.includes("..")) return path5.default.resolve(root, source);
|
|
4119
|
+
let current = path5.default.dirname(importer);
|
|
4120
|
+
const filesystemRoot = path5.default.parse(current).root;
|
|
3878
4121
|
while (true) {
|
|
3879
|
-
const candidate =
|
|
4122
|
+
const candidate = path5.default.join(current, "node_modules", ...segments);
|
|
3880
4123
|
if (_fs.existsSync.call(void 0, candidate)) return candidate;
|
|
3881
4124
|
if (current === filesystemRoot) break;
|
|
3882
|
-
current =
|
|
4125
|
+
current = path5.default.dirname(current);
|
|
3883
4126
|
}
|
|
3884
|
-
return
|
|
4127
|
+
return path5.default.resolve(root, "node_modules", ...segments);
|
|
3885
4128
|
}
|
|
3886
4129
|
}
|
|
3887
4130
|
function replaceFontSection(css, section) {
|
|
@@ -3914,11 +4157,11 @@ function getGlobalMap(key) {
|
|
|
3914
4157
|
return created;
|
|
3915
4158
|
}
|
|
3916
4159
|
function normalizeRoot(root) {
|
|
3917
|
-
return
|
|
4160
|
+
return path5.default.resolve(root).replace(/\\/g, "/");
|
|
3918
4161
|
}
|
|
3919
4162
|
function normalizePublicDir(root, publicDir) {
|
|
3920
4163
|
if (publicDir === false || publicDir === "") return false;
|
|
3921
|
-
return
|
|
4164
|
+
return path5.default.resolve(root, publicDir || "public");
|
|
3922
4165
|
}
|
|
3923
4166
|
function normalizePublicFontPath(source, moduleId) {
|
|
3924
4167
|
if (source.includes("?") || source.includes("#")) {
|
|
@@ -3927,8 +4170,8 @@ function normalizePublicFontPath(source, moduleId) {
|
|
|
3927
4170
|
return `/${source.replace(/\\/g, "/").replace(/^\/+/, "")}`;
|
|
3928
4171
|
}
|
|
3929
4172
|
function isPathInside(parent, child) {
|
|
3930
|
-
const relative3 =
|
|
3931
|
-
return relative3 === "" || !relative3.startsWith("..") && !
|
|
4173
|
+
const relative3 = path5.default.relative(parent, child);
|
|
4174
|
+
return relative3 === "" || !relative3.startsWith("..") && !path5.default.isAbsolute(relative3);
|
|
3932
4175
|
}
|
|
3933
4176
|
function normalizeBasePath(value) {
|
|
3934
4177
|
if (!value || value === "/") return "/";
|
|
@@ -3938,7 +4181,7 @@ function joinBasePath(basePath, value) {
|
|
|
3938
4181
|
return basePath === "/" ? value : `${basePath.replace(/\/$/, "")}${value}`;
|
|
3939
4182
|
}
|
|
3940
4183
|
function extensionFromPath(pathname) {
|
|
3941
|
-
const extension =
|
|
4184
|
+
const extension = path5.default.extname(pathname).toLowerCase();
|
|
3942
4185
|
if (!FONT_EXTENSION_RE.test(extension)) {
|
|
3943
4186
|
throw new Error(`[Farm fonts] Remote font URL must end in .woff2, .woff, .ttf, or .otf`);
|
|
3944
4187
|
}
|
|
@@ -4180,7 +4423,7 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
|
|
|
4180
4423
|
}
|
|
4181
4424
|
function resolveProviderModule(moduleId, root) {
|
|
4182
4425
|
if (!moduleId.startsWith(".")) return moduleId;
|
|
4183
|
-
return _chunkVQJYGZNXcjs.toViteModuleId.call(void 0,
|
|
4426
|
+
return _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, path5.default.resolve(root, moduleId), root);
|
|
4184
4427
|
}
|
|
4185
4428
|
|
|
4186
4429
|
// src/server/renderer.ts
|
|
@@ -4196,15 +4439,15 @@ var _stream = require('stream');
|
|
|
4196
4439
|
|
|
4197
4440
|
function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
4198
4441
|
const extensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
|
|
4199
|
-
const configuredPath = _optionalChain([config, 'access',
|
|
4442
|
+
const configuredPath = _optionalChain([config, 'access', _162 => _162.notFound, 'optionalAccess', _163 => _163.component, 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()]);
|
|
4200
4443
|
if (configuredPath) {
|
|
4201
|
-
const componentPath =
|
|
4444
|
+
const componentPath = path5.default.isAbsolute(configuredPath) ? path5.default.normalize(configuredPath) : path5.default.resolve(config.root, configuredPath);
|
|
4202
4445
|
if (!extensions.some((extension) => componentPath.endsWith(extension))) {
|
|
4203
4446
|
throw new Error(
|
|
4204
4447
|
`notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
|
|
4205
4448
|
);
|
|
4206
4449
|
}
|
|
4207
|
-
if (!
|
|
4450
|
+
if (!fs3.default.existsSync(componentPath) || !fs3.default.statSync(componentPath).isFile()) {
|
|
4208
4451
|
throw new Error(`notFound.component was not found: ${componentPath}`);
|
|
4209
4452
|
}
|
|
4210
4453
|
return componentPath;
|
|
@@ -4212,8 +4455,8 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
|
4212
4455
|
let discoveredPath = null;
|
|
4213
4456
|
for (const appDir of appDirs) {
|
|
4214
4457
|
for (const extension of extensions) {
|
|
4215
|
-
const candidate =
|
|
4216
|
-
if (
|
|
4458
|
+
const candidate = path5.default.join(appDir, `not-found${extension}`);
|
|
4459
|
+
if (fs3.default.existsSync(candidate) && fs3.default.statSync(candidate).isFile()) {
|
|
4217
4460
|
discoveredPath = candidate;
|
|
4218
4461
|
break;
|
|
4219
4462
|
}
|
|
@@ -4389,14 +4632,14 @@ function redactErrorText(value) {
|
|
|
4389
4632
|
return value.replace(BEARER_PATTERN, "$1[REDACTED]").replace(SECRET_VALUE_PATTERN, "$1=[REDACTED]");
|
|
4390
4633
|
}
|
|
4391
4634
|
function isPathInsideRoot(root, filePath) {
|
|
4392
|
-
const relative3 =
|
|
4393
|
-
return relative3 === "" || !relative3.startsWith("..") && !
|
|
4635
|
+
const relative3 = path9.relative(root, filePath);
|
|
4636
|
+
return relative3 === "" || !relative3.startsWith("..") && !path9.isAbsolute(relative3);
|
|
4394
4637
|
}
|
|
4395
4638
|
function normalizeStackPath(value) {
|
|
4396
4639
|
const withoutQuery = value.replace(/[?#].*$/, "");
|
|
4397
4640
|
try {
|
|
4398
4641
|
return withoutQuery.startsWith("file://") ? _url.fileURLToPath.call(void 0, withoutQuery) : withoutQuery;
|
|
4399
|
-
} catch (
|
|
4642
|
+
} catch (e18) {
|
|
4400
4643
|
return void 0;
|
|
4401
4644
|
}
|
|
4402
4645
|
}
|
|
@@ -4407,13 +4650,13 @@ function findStackLocation(stack, root) {
|
|
|
4407
4650
|
);
|
|
4408
4651
|
if (!match) continue;
|
|
4409
4652
|
const candidate = normalizeStackPath(match[1]);
|
|
4410
|
-
if (!candidate || candidate.includes(`${
|
|
4411
|
-
const absolutePath =
|
|
4412
|
-
if (!isPathInsideRoot(root, absolutePath) || !
|
|
4413
|
-
const relativePath =
|
|
4653
|
+
if (!candidate || candidate.includes(`${path9.sep}node_modules${path9.sep}`)) continue;
|
|
4654
|
+
const absolutePath = path9.resolve(candidate);
|
|
4655
|
+
if (!isPathInsideRoot(root, absolutePath) || !fs5.existsSync(absolutePath)) continue;
|
|
4656
|
+
const relativePath = path9.relative(root, absolutePath).split(path9.sep).join("/");
|
|
4414
4657
|
return {
|
|
4415
4658
|
absolutePath,
|
|
4416
|
-
displayPath: relativePath ||
|
|
4659
|
+
displayPath: relativePath || path9.basename(absolutePath),
|
|
4417
4660
|
line: Number(match[2]),
|
|
4418
4661
|
column: Number(match[3])
|
|
4419
4662
|
};
|
|
@@ -4422,7 +4665,7 @@ function findStackLocation(stack, root) {
|
|
|
4422
4665
|
}
|
|
4423
4666
|
function createSourceFrame(location) {
|
|
4424
4667
|
try {
|
|
4425
|
-
const sourceLines =
|
|
4668
|
+
const sourceLines = fs5.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
|
|
4426
4669
|
if (location.line < 1 || location.line > sourceLines.length) return void 0;
|
|
4427
4670
|
const start = Math.max(1, location.line - 2);
|
|
4428
4671
|
const end = Math.min(sourceLines.length, location.line + 2);
|
|
@@ -4440,18 +4683,18 @@ function createSourceFrame(location) {
|
|
|
4440
4683
|
column: location.column,
|
|
4441
4684
|
lines
|
|
4442
4685
|
};
|
|
4443
|
-
} catch (
|
|
4686
|
+
} catch (e19) {
|
|
4444
4687
|
return void 0;
|
|
4445
4688
|
}
|
|
4446
4689
|
}
|
|
4447
4690
|
function sanitizeStack(stack, root) {
|
|
4448
|
-
const normalizedRoot =
|
|
4691
|
+
const normalizedRoot = path9.resolve(root);
|
|
4449
4692
|
return redactErrorText(stack).split(normalizedRoot).join("<project>").replace(/<project>[^\s)]*/g, (segment) => segment.split("\\").join("/")).split("\n").filter((line, index) => index === 0 || !line.includes("node:internal")).slice(0, 14).join("\n");
|
|
4450
4693
|
}
|
|
4451
4694
|
function createDefaultErrorDiagnostics(error, root) {
|
|
4452
4695
|
const normalizedError = error instanceof Error ? error : new Error(typeof error === "string" ? error : "Unknown server rendering error");
|
|
4453
4696
|
const rawStack = normalizedError.stack || `${normalizedError.name}: ${normalizedError.message}`;
|
|
4454
|
-
const location = findStackLocation(rawStack,
|
|
4697
|
+
const location = findStackLocation(rawStack, path9.resolve(root));
|
|
4455
4698
|
return {
|
|
4456
4699
|
name: redactErrorText(normalizedError.name || "Error"),
|
|
4457
4700
|
message: redactErrorText(normalizedError.message || "Unknown server rendering error"),
|
|
@@ -4577,7 +4820,7 @@ function appendResponseVary(res, value) {
|
|
|
4577
4820
|
function renderI18nAlternateLinks(requestPath, snapshot, options) {
|
|
4578
4821
|
if (snapshot.routing === "none") return "";
|
|
4579
4822
|
const url = new URL(requestPath, "http://farm.local");
|
|
4580
|
-
return
|
|
4823
|
+
return _chunkTSFMFPRUcjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
|
|
4581
4824
|
}
|
|
4582
4825
|
var PPR_REFRESH_MAX_ATTEMPTS = 3;
|
|
4583
4826
|
function createPPRRefreshScript() {
|
|
@@ -4668,12 +4911,12 @@ async function parseRouteModuleProps(routeModule, input) {
|
|
|
4668
4911
|
}
|
|
4669
4912
|
const schemas = routeModule.__farmRouteSchemas;
|
|
4670
4913
|
const params = parseRouteModuleSchema(
|
|
4671
|
-
_optionalChain([schemas, 'optionalAccess',
|
|
4914
|
+
_optionalChain([schemas, 'optionalAccess', _166 => _166.params]),
|
|
4672
4915
|
input.props.params,
|
|
4673
4916
|
"params",
|
|
4674
4917
|
input.routePath
|
|
4675
4918
|
);
|
|
4676
|
-
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess',
|
|
4919
|
+
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _167 => _167.search]), input.search, "search", input.routePath);
|
|
4677
4920
|
return {
|
|
4678
4921
|
...input.props,
|
|
4679
4922
|
params,
|
|
@@ -4705,9 +4948,9 @@ function createRouteStateProps(input) {
|
|
|
4705
4948
|
function readAppPackageIdentity(root) {
|
|
4706
4949
|
try {
|
|
4707
4950
|
return JSON.parse(
|
|
4708
|
-
|
|
4951
|
+
fs6.readFileSync(path10.join(root || process.cwd(), "package.json"), "utf8")
|
|
4709
4952
|
);
|
|
4710
|
-
} catch (
|
|
4953
|
+
} catch (e20) {
|
|
4711
4954
|
return {};
|
|
4712
4955
|
}
|
|
4713
4956
|
}
|
|
@@ -4731,7 +4974,7 @@ var ServerRenderer = class {
|
|
|
4731
4974
|
} else {
|
|
4732
4975
|
_chunkXGJVRPYLcjs.uninstallFarmIslandValues.call(void 0, );
|
|
4733
4976
|
}
|
|
4734
|
-
if (_optionalChain([this, 'access',
|
|
4977
|
+
if (_optionalChain([this, 'access', _168 => _168.config, 'access', _169 => _169.notFound, 'optionalAccess', _170 => _170.component, 'optionalAccess', _171 => _171.trim, 'call', _172 => _172()])) {
|
|
4735
4978
|
resolveFarmNotFoundComponentPath(this.config, _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, this.config));
|
|
4736
4979
|
}
|
|
4737
4980
|
const loaded = _chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : this.viteServer ? await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, this.config.renderer.server) : await import(_url.pathToFileURL.call(void 0,
|
|
@@ -4756,7 +4999,7 @@ var ServerRenderer = class {
|
|
|
4756
4999
|
"node"
|
|
4757
5000
|
);
|
|
4758
5001
|
this.rendererRuntime = islands && this.islandValues() ? withFarmIslandsRenders(runtime, islands) : runtime;
|
|
4759
|
-
_optionalChain([this, 'access',
|
|
5002
|
+
_optionalChain([this, 'access', _173 => _173.routeManager, 'access', _174 => _174.setRendererRuntime, 'optionalCall', _175 => _175(this.rendererRuntime)]);
|
|
4760
5003
|
await this.applyRendererAppSetup();
|
|
4761
5004
|
}
|
|
4762
5005
|
/**
|
|
@@ -4813,7 +5056,7 @@ var ServerRenderer = class {
|
|
|
4813
5056
|
/// Stylesheets the app imported through JS (fontsource packages, component
|
|
4814
5057
|
/// CSS) that the document must link alongside globals.css — see #658.
|
|
4815
5058
|
collectDevStyleHrefs() {
|
|
4816
|
-
const graph = _optionalChain([this, 'access',
|
|
5059
|
+
const graph = _optionalChain([this, 'access', _176 => _176.viteServer, 'optionalAccess', _177 => _177.moduleGraph]);
|
|
4817
5060
|
if (!graph) return [];
|
|
4818
5061
|
return collectDevStylesheetUrls(
|
|
4819
5062
|
graph.idToModuleMap.values(),
|
|
@@ -4917,7 +5160,7 @@ var ServerRenderer = class {
|
|
|
4917
5160
|
}
|
|
4918
5161
|
/** Islands mode sends large prop values once, keyed by content (RFC 0003). */
|
|
4919
5162
|
islandValues() {
|
|
4920
|
-
return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
5163
|
+
return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _178 => _178.config, 'access', _179 => _179.experimental, 'optionalAccess', _180 => _180.serverComponents])) === "islands";
|
|
4921
5164
|
}
|
|
4922
5165
|
/**
|
|
4923
5166
|
* Render the route tree used by client navigation without producing a second
|
|
@@ -4992,7 +5235,7 @@ var ServerRenderer = class {
|
|
|
4992
5235
|
async runWithRequestContext(request2, fn) {
|
|
4993
5236
|
return _chunkHNAISJFDcjs._runWithCurrentRequest.call(void 0,
|
|
4994
5237
|
request2,
|
|
4995
|
-
() => _optionalChain([this, 'access',
|
|
5238
|
+
() => _optionalChain([this, 'access', _181 => _181.i18nRuntime, 'optionalAccess', _182 => _182.config, 'access', _183 => _183.enabled]) ? _chunkRVGLYMJMcjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
|
|
4996
5239
|
redirect: false
|
|
4997
5240
|
}) : fn()
|
|
4998
5241
|
);
|
|
@@ -5004,10 +5247,10 @@ var ServerRenderer = class {
|
|
|
5004
5247
|
* Load SSG manifest from build output
|
|
5005
5248
|
*/
|
|
5006
5249
|
loadSSGManifest() {
|
|
5007
|
-
const manifestPath =
|
|
5250
|
+
const manifestPath = path10.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
|
|
5008
5251
|
let content;
|
|
5009
5252
|
try {
|
|
5010
|
-
content =
|
|
5253
|
+
content = fs6.readFileSync(manifestPath, "utf-8");
|
|
5011
5254
|
} catch (error) {
|
|
5012
5255
|
if (error.code === "ENOENT") {
|
|
5013
5256
|
return;
|
|
@@ -5140,7 +5383,7 @@ var ServerRenderer = class {
|
|
|
5140
5383
|
setImmediate(async () => {
|
|
5141
5384
|
try {
|
|
5142
5385
|
const mod = await this.routeManager.loadRouteModule(page.filePath);
|
|
5143
|
-
if (!_optionalChain([mod, 'optionalAccess',
|
|
5386
|
+
if (!_optionalChain([mod, 'optionalAccess', _184 => _184.default])) return;
|
|
5144
5387
|
const { route, layouts } = this.routeManager.matchRoute(page.urlPath);
|
|
5145
5388
|
const layoutModules = await Promise.all(
|
|
5146
5389
|
layouts.map((l) => this.routeManager.loadLayoutModule(l.modulePath))
|
|
@@ -5154,7 +5397,7 @@ var ServerRenderer = class {
|
|
|
5154
5397
|
};
|
|
5155
5398
|
let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
|
|
5156
5399
|
const pageMetadata = _nullishCoalesce(routeManifest.routes.find(
|
|
5157
|
-
(entry) => entry.pattern === _optionalChain([route, 'optionalAccess',
|
|
5400
|
+
(entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _185 => _185.pattern])
|
|
5158
5401
|
), () => ( {
|
|
5159
5402
|
shouldHydrate: false,
|
|
5160
5403
|
islandStrategy: null
|
|
@@ -5226,10 +5469,10 @@ var ServerRenderer = class {
|
|
|
5226
5469
|
return true;
|
|
5227
5470
|
}
|
|
5228
5471
|
try {
|
|
5229
|
-
const htmlPath = page.urlPath === "/" ?
|
|
5230
|
-
if (
|
|
5231
|
-
const stat =
|
|
5232
|
-
const html =
|
|
5472
|
+
const htmlPath = page.urlPath === "/" ? path10.join(this.config.root, this.config.outDir, "client", "index.html") : path10.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
|
|
5473
|
+
if (fs6.existsSync(htmlPath)) {
|
|
5474
|
+
const stat = fs6.statSync(htmlPath);
|
|
5475
|
+
const html = fs6.readFileSync(htmlPath, "utf-8");
|
|
5233
5476
|
await this.cacheSSGPage(page, html, {
|
|
5234
5477
|
document: true,
|
|
5235
5478
|
createdAt: stat.mtimeMs
|
|
@@ -5264,10 +5507,10 @@ var ServerRenderer = class {
|
|
|
5264
5507
|
res.setHeader(header.key, header.value);
|
|
5265
5508
|
}
|
|
5266
5509
|
const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5267
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5510
|
+
trustProxy: _optionalChain([this, 'access', _186 => _186.config, 'access', _187 => _187.server, 'optionalAccess', _188 => _188.trustProxy])
|
|
5268
5511
|
});
|
|
5269
5512
|
const runtime = this.i18nRuntime;
|
|
5270
|
-
if (_optionalChain([runtime, 'optionalAccess',
|
|
5513
|
+
if (_optionalChain([runtime, 'optionalAccess', _189 => _189.config, 'access', _190 => _190.enabled])) {
|
|
5271
5514
|
const resolution = runtime.resolveRequest(request2);
|
|
5272
5515
|
const varyHeaders = _chunkVOQ7XZZTcjs.getFarmLocaleVaryHeaders.call(void 0, runtime.config, resolution);
|
|
5273
5516
|
for (const header of varyHeaders) appendResponseVary(res, header);
|
|
@@ -5313,7 +5556,7 @@ var ServerRenderer = class {
|
|
|
5313
5556
|
});
|
|
5314
5557
|
};
|
|
5315
5558
|
try {
|
|
5316
|
-
const url = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
5559
|
+
const url = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _191 => _191.config, 'access', _192 => _192.server, 'optionalAccess', _193 => _193.trustProxy]) });
|
|
5317
5560
|
pathname = url.pathname;
|
|
5318
5561
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.start", route: pathname, pathname });
|
|
5319
5562
|
searchParamsObject = _chunkSUCDVKUBcjs.searchParamsToObject.call(void 0, url.searchParams);
|
|
@@ -5376,7 +5619,7 @@ var ServerRenderer = class {
|
|
|
5376
5619
|
layouts = match.layouts;
|
|
5377
5620
|
routeSlots = _nullishCoalesce(match.slots, () => ( []));
|
|
5378
5621
|
if (!route) {
|
|
5379
|
-
if (
|
|
5622
|
+
if (_chunk46KXZBOGcjs.isFarmDefaultMCPPathname.call(void 0, pathname) && this.getDefaultMCPServer()) {
|
|
5380
5623
|
await this.renderDefaultMCP(req, res);
|
|
5381
5624
|
completeRender(res.statusCode || 200, pathname);
|
|
5382
5625
|
return;
|
|
@@ -5393,13 +5636,13 @@ var ServerRenderer = class {
|
|
|
5393
5636
|
params
|
|
5394
5637
|
});
|
|
5395
5638
|
let actionRequest;
|
|
5396
|
-
if (req.method === "POST" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
5639
|
+
if (req.method === "POST" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _194 => _194.config, 'access', _195 => _195.experimental, 'optionalAccess', _196 => _196.serverComponents])) === "islands") {
|
|
5397
5640
|
await Promise.all([
|
|
5398
5641
|
this.routeManager.loadRouteModule(route.modulePath),
|
|
5399
5642
|
...layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
|
|
5400
5643
|
]);
|
|
5401
5644
|
actionRequest = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5402
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5645
|
+
trustProxy: _optionalChain([this, 'access', _197 => _197.config, 'access', _198 => _198.server, 'optionalAccess', _199 => _199.trustProxy])
|
|
5403
5646
|
});
|
|
5404
5647
|
const actionResponse = await _chunk3OWVWZ6Rcjs.handleFarmFormActionRequest.call(void 0,
|
|
5405
5648
|
actionRequest,
|
|
@@ -5419,7 +5662,7 @@ var ServerRenderer = class {
|
|
|
5419
5662
|
exposedOnly: true
|
|
5420
5663
|
});
|
|
5421
5664
|
const currentRequest = _nullishCoalesce(actionRequest, () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5422
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5665
|
+
trustProxy: _optionalChain([this, 'access', _200 => _200.config, 'access', _201 => _201.server, 'optionalAccess', _202 => _202.trustProxy])
|
|
5423
5666
|
})));
|
|
5424
5667
|
const routeContext = await this.resolveRouteContext({
|
|
5425
5668
|
request: currentRequest,
|
|
@@ -5461,11 +5704,11 @@ var ServerRenderer = class {
|
|
|
5461
5704
|
searchParams: _chunkSUCDVKUBcjs.createFarmSearchParams.call(void 0, searchParamsObject),
|
|
5462
5705
|
error
|
|
5463
5706
|
};
|
|
5464
|
-
if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess',
|
|
5707
|
+
if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _203 => _203.notFound])) {
|
|
5465
5708
|
res.statusCode = 404;
|
|
5466
5709
|
PageComponent = programmaticRouteComponents.notFound;
|
|
5467
5710
|
pageProps = routeStateProps;
|
|
5468
|
-
} else if (_optionalChain([programmaticRouteComponents, 'optionalAccess',
|
|
5711
|
+
} else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _204 => _204.error])) {
|
|
5469
5712
|
res.statusCode = 500;
|
|
5470
5713
|
PageComponent = programmaticRouteComponents.error;
|
|
5471
5714
|
pageProps = routeStateProps;
|
|
@@ -5476,7 +5719,7 @@ var ServerRenderer = class {
|
|
|
5476
5719
|
const renderingConfig = await _chunkUQHIWZZ6cjs.resolveRouteRenderingConfigFromFile.call(void 0,
|
|
5477
5720
|
routeModule,
|
|
5478
5721
|
route.modulePath,
|
|
5479
|
-
{ experimentalPPR: _optionalChain([this, 'access',
|
|
5722
|
+
{ experimentalPPR: _optionalChain([this, 'access', _205 => _205.config, 'access', _206 => _206.experimental, 'optionalAccess', _207 => _207.ppr]) === true }
|
|
5480
5723
|
);
|
|
5481
5724
|
const pprBypassReason = renderingConfig.ppr ? this.getPPRShellBypassReason(req, middlewareMap, middlewareContext, pluginExposedContext) : void 0;
|
|
5482
5725
|
const canCachePPRShell = renderingConfig.ppr && !pprBypassReason;
|
|
@@ -5484,7 +5727,7 @@ var ServerRenderer = class {
|
|
|
5484
5727
|
const pprShellOptions = canCachePPRShell ? {
|
|
5485
5728
|
pathname,
|
|
5486
5729
|
search: url.search,
|
|
5487
|
-
locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess',
|
|
5730
|
+
locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _208 => _208.locale]), () => ( "")),
|
|
5488
5731
|
origin: pprI18nSnapshot && pprI18nSnapshot.routing !== "none" ? url.origin : "",
|
|
5489
5732
|
revalidate: renderingConfig.revalidate
|
|
5490
5733
|
} : void 0;
|
|
@@ -5607,20 +5850,20 @@ var ServerRenderer = class {
|
|
|
5607
5850
|
if (moduleMetadata.suppressedAsyncHydration) {
|
|
5608
5851
|
warnSuppressedAsyncHydrationOnce(
|
|
5609
5852
|
route.modulePath,
|
|
5610
|
-
_optionalChain([routeManifestEntry, 'optionalAccess',
|
|
5853
|
+
_optionalChain([routeManifestEntry, 'optionalAccess', _209 => _209.suppressedAsyncHydrationReason])
|
|
5611
5854
|
);
|
|
5612
5855
|
}
|
|
5613
5856
|
const layoutHydrationMetadata = layouts.map((layout) => {
|
|
5614
5857
|
const manifestEntry = routeManifest.layouts.find(
|
|
5615
5858
|
(entry) => entry.pattern === layout.pattern
|
|
5616
5859
|
);
|
|
5617
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
5860
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _210 => _210.suppressedAsyncHydration])) {
|
|
5618
5861
|
warnSuppressedAsyncHydrationOnce(
|
|
5619
5862
|
layout.modulePath,
|
|
5620
5863
|
manifestEntry.suppressedAsyncHydrationReason
|
|
5621
5864
|
);
|
|
5622
5865
|
}
|
|
5623
|
-
if (typeof _optionalChain([manifestEntry, 'optionalAccess',
|
|
5866
|
+
if (typeof _optionalChain([manifestEntry, 'optionalAccess', _211 => _211.shouldHydrate]) === "boolean") {
|
|
5624
5867
|
return {
|
|
5625
5868
|
isClientComponent: manifestEntry.isClientComponent === true,
|
|
5626
5869
|
shouldHydrate: manifestEntry.shouldHydrate,
|
|
@@ -5641,11 +5884,11 @@ var ServerRenderer = class {
|
|
|
5641
5884
|
const clientLayouts = layouts.map((layout, index) => ({
|
|
5642
5885
|
pattern: layout.pattern,
|
|
5643
5886
|
modulePath: _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, layout.modulePath, this.config.root),
|
|
5644
|
-
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access',
|
|
5645
|
-
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access',
|
|
5646
|
-
..._optionalChain([layoutHydrationMetadata, 'access',
|
|
5887
|
+
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _212 => _212[index], 'optionalAccess', _213 => _213.shouldHydrate]) === true,
|
|
5888
|
+
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _214 => _214[index], 'optionalAccess', _215 => _215.islandStrategy]), () => ( null)),
|
|
5889
|
+
..._optionalChain([layoutHydrationMetadata, 'access', _216 => _216[index], 'optionalAccess', _217 => _217.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {},
|
|
5647
5890
|
// Islands mode: the browser rebuilds this layout from its tree, not its module.
|
|
5648
|
-
...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access',
|
|
5891
|
+
...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _218 => _218[index], 'optionalAccess', _219 => _219.serverTree]) === true ? { serverTree: true } : {}
|
|
5649
5892
|
}));
|
|
5650
5893
|
const hydrationStrategies = [
|
|
5651
5894
|
...shouldHydrate && moduleMetadata.islandStrategy ? [moduleMetadata.islandStrategy] : [],
|
|
@@ -5659,7 +5902,7 @@ var ServerRenderer = class {
|
|
|
5659
5902
|
const hasHydratableRouteSlots = renderedRouteSlots.some(
|
|
5660
5903
|
(slot) => slot.isClientComponent || slot.shouldHydrate
|
|
5661
5904
|
);
|
|
5662
|
-
const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess',
|
|
5905
|
+
const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _220 => _220.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
|
|
5663
5906
|
req.__FARM_PAGE_PATH__ = route.modulePath;
|
|
5664
5907
|
req.__FARM_ROUTE__ = pathname;
|
|
5665
5908
|
req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
|
|
@@ -5672,7 +5915,7 @@ var ServerRenderer = class {
|
|
|
5672
5915
|
req.__FARM_SHOULD_HYDRATE__ = shouldHydrate || shouldHydrateLayout || hasIsolatedClientBoundaries;
|
|
5673
5916
|
req.__FARM_ISLAND_STRATEGY__ = hydrationIslandStrategy;
|
|
5674
5917
|
req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ = hasHydratableRouteSlots;
|
|
5675
|
-
req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess',
|
|
5918
|
+
req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _221 => _221.modulePath]) ? _chunkVQJYGZNXcjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
|
|
5676
5919
|
req.__FARM_ROUTE_SLOTS__ = renderedRouteSlots.map((slot) => ({
|
|
5677
5920
|
name: slot.name,
|
|
5678
5921
|
ownerPattern: slot.ownerPattern,
|
|
@@ -5744,7 +5987,7 @@ var ServerRenderer = class {
|
|
|
5744
5987
|
} else if (shouldHydrateLayout && !(isClientComponent || shouldHydrate) && this.rendererRuntime.isolateServerPageGraph) {
|
|
5745
5988
|
pageElement = await this.isolateServerPage(
|
|
5746
5989
|
pageElement,
|
|
5747
|
-
_optionalChain([routeManifestEntry, 'optionalAccess',
|
|
5990
|
+
_optionalChain([routeManifestEntry, 'optionalAccess', _222 => _222.serverTree]) === true
|
|
5748
5991
|
);
|
|
5749
5992
|
}
|
|
5750
5993
|
pageElement = this.createPageBoundary(pageElement, {
|
|
@@ -5776,7 +6019,7 @@ var ServerRenderer = class {
|
|
|
5776
6019
|
);
|
|
5777
6020
|
slotProps[slot.name] = slotElement;
|
|
5778
6021
|
}
|
|
5779
|
-
wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access',
|
|
6022
|
+
wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _223 => _223[i], 'optionalAccess', _224 => _224.serverTree]) === true && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
|
|
5780
6023
|
LayoutComponent,
|
|
5781
6024
|
{ params },
|
|
5782
6025
|
{ children: wrappedElement, ...slotProps },
|
|
@@ -5907,7 +6150,7 @@ var ServerRenderer = class {
|
|
|
5907
6150
|
}
|
|
5908
6151
|
}
|
|
5909
6152
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.error", route: pathname, error });
|
|
5910
|
-
const errorStatus =
|
|
6153
|
+
const errorStatus = _chunkTSFMFPRUcjs.resolveDefaultErrorStatus.call(void 0, error);
|
|
5911
6154
|
if (pprRefreshRoute) {
|
|
5912
6155
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
5913
6156
|
type: "ppr.refresh.error",
|
|
@@ -5951,7 +6194,7 @@ var ServerRenderer = class {
|
|
|
5951
6194
|
const rendererCapabilities = _chunkRD623KW4cjs.getFarmRendererCapabilities.call(void 0, this.config.renderer);
|
|
5952
6195
|
if (!rendererCapabilities.functionComponents) {
|
|
5953
6196
|
throw new Error(
|
|
5954
|
-
`Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access',
|
|
6197
|
+
`Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _225 => _225.config, 'access', _226 => _226.renderer, 'optionalAccess', _227 => _227.name]), () => ( "the configured renderer"))}\` cannot.`
|
|
5955
6198
|
);
|
|
5956
6199
|
}
|
|
5957
6200
|
if (provider.type === "clerk" && !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer)) {
|
|
@@ -5964,11 +6207,11 @@ var ServerRenderer = class {
|
|
|
5964
6207
|
if (_chunkCECUDGXQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
|
|
5965
6208
|
providerSourceModule = provider.component.module;
|
|
5966
6209
|
const providerModuleId = provider.component.module.startsWith(".") ? _chunkVQJYGZNXcjs.toViteModuleId.call(void 0,
|
|
5967
|
-
|
|
6210
|
+
path10.resolve(this.config.root, provider.component.module),
|
|
5968
6211
|
this.config.root
|
|
5969
6212
|
) : provider.component.module;
|
|
5970
6213
|
const providerModule = this.viteServer ? await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, providerModuleId) : await importRuntimeModule(
|
|
5971
|
-
provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0,
|
|
6214
|
+
provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0, path10.resolve(this.config.root, provider.component.module)).href : provider.component.module
|
|
5972
6215
|
);
|
|
5973
6216
|
ProviderComponent = providerModule[provider.component.export || "default"];
|
|
5974
6217
|
} else if (typeof provider.component === "function") {
|
|
@@ -5990,7 +6233,7 @@ var ServerRenderer = class {
|
|
|
5990
6233
|
}
|
|
5991
6234
|
if (provider.type !== "clerk" && typeof this.rendererRuntime.markFunctionComponent === "function" && !isRendererCompiledComponent(
|
|
5992
6235
|
_nullishCoalesce(providerSourceModule, () => ( "")),
|
|
5993
|
-
_chunkRD623KW4cjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access',
|
|
6236
|
+
_chunkRD623KW4cjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _228 => _228.config, 'access', _229 => _229.renderer, 'optionalAccess', _230 => _230.componentExtensions]))
|
|
5994
6237
|
)) {
|
|
5995
6238
|
ProviderComponent = this.rendererRuntime.markFunctionComponent(ProviderComponent);
|
|
5996
6239
|
}
|
|
@@ -6059,7 +6302,7 @@ var ServerRenderer = class {
|
|
|
6059
6302
|
);
|
|
6060
6303
|
metadata = _chunk6IOZPJ3Icjs.addMetadataMarkdownAlternate.call(void 0,
|
|
6061
6304
|
metadata,
|
|
6062
|
-
|
|
6305
|
+
_chunkD7UQC4O6cjs.getFarmMarkdownAlternatePath.call(void 0, _chunkD7UQC4O6cjs.resolveMarkdownConfig.call(void 0, this.config.md), publicPathname)
|
|
6063
6306
|
);
|
|
6064
6307
|
return metadata;
|
|
6065
6308
|
}
|
|
@@ -6117,7 +6360,7 @@ var ServerRenderer = class {
|
|
|
6117
6360
|
);
|
|
6118
6361
|
}
|
|
6119
6362
|
const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6120
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6363
|
+
trustProxy: _optionalChain([this, 'access', _231 => _231.config, 'access', _232 => _232.server, 'optionalAccess', _233 => _233.trustProxy])
|
|
6121
6364
|
});
|
|
6122
6365
|
const url = new URL(request2.url);
|
|
6123
6366
|
const llmsContext = match.metadata.kind === "llms" || match.metadata.kind === "llms-full" ? await this.createLlmsTxtContext(request2, {
|
|
@@ -6131,11 +6374,11 @@ var ServerRenderer = class {
|
|
|
6131
6374
|
path: match.routePath,
|
|
6132
6375
|
...llmsContext
|
|
6133
6376
|
}) : routeModule.default;
|
|
6134
|
-
const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await
|
|
6377
|
+
const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await _chunkH33PJEXNcjs.renderFarmLlmsFullTxt.call(void 0, value, {
|
|
6135
6378
|
origin: url.origin,
|
|
6136
6379
|
readMarkdown: llmsContext.markdown
|
|
6137
6380
|
}) : value;
|
|
6138
|
-
const response =
|
|
6381
|
+
const response = _chunkTSFMFPRUcjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
|
|
6139
6382
|
method,
|
|
6140
6383
|
request: request2
|
|
6141
6384
|
});
|
|
@@ -6153,7 +6396,7 @@ var ServerRenderer = class {
|
|
|
6153
6396
|
}
|
|
6154
6397
|
/** `/llms.txt` and `/llms-full.txt` from `agent.llmsTxt` when no file route owns them. */
|
|
6155
6398
|
getGeneratedLlmsKind(pathname) {
|
|
6156
|
-
const config =
|
|
6399
|
+
const config = _chunkH33PJEXNcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _234 => _234.config, 'access', _235 => _235.agent, 'optionalAccess', _236 => _236.llmsTxt]));
|
|
6157
6400
|
if (!config.enabled) return null;
|
|
6158
6401
|
if (pathname === "/llms.txt") return "llms";
|
|
6159
6402
|
return pathname === "/llms-full.txt" && config.full ? "llms-full" : null;
|
|
@@ -6161,17 +6404,17 @@ var ServerRenderer = class {
|
|
|
6161
6404
|
async renderGeneratedLlmsTxt(req, res, kind) {
|
|
6162
6405
|
try {
|
|
6163
6406
|
const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6164
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6407
|
+
trustProxy: _optionalChain([this, 'access', _237 => _237.config, 'access', _238 => _238.server, 'optionalAccess', _239 => _239.trustProxy])
|
|
6165
6408
|
});
|
|
6166
|
-
const config =
|
|
6409
|
+
const config = _chunkH33PJEXNcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _240 => _240.config, 'access', _241 => _241.agent, 'optionalAccess', _242 => _242.llmsTxt]));
|
|
6167
6410
|
const context = await this.createLlmsTxtContext(request2, { full: kind === "llms-full", req });
|
|
6168
|
-
const body = kind === "llms-full" ? await
|
|
6411
|
+
const body = kind === "llms-full" ? await _chunkH33PJEXNcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
|
|
6169
6412
|
origin: new URL(request2.url).origin,
|
|
6170
6413
|
readMarkdown: context.markdown
|
|
6171
6414
|
}) : context.defaults;
|
|
6172
6415
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
|
|
6173
6416
|
res,
|
|
6174
|
-
|
|
6417
|
+
_chunkTSFMFPRUcjs.createFarmMetadataRouteResponse.call(void 0,
|
|
6175
6418
|
kind,
|
|
6176
6419
|
body,
|
|
6177
6420
|
{ revalidate: config.revalidate },
|
|
@@ -6190,23 +6433,23 @@ var ServerRenderer = class {
|
|
|
6190
6433
|
}
|
|
6191
6434
|
}
|
|
6192
6435
|
getAgentCrawlers() {
|
|
6193
|
-
return
|
|
6436
|
+
return _chunkFFE2EMF7cjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _243 => _243.config, 'access', _244 => _244.agent, 'optionalAccess', _245 => _245.crawlers]));
|
|
6194
6437
|
}
|
|
6195
6438
|
/** `/robots.txt` from `agent.crawlers` when no robots.ts owns it. */
|
|
6196
6439
|
async renderGeneratedRobotsTxt(req, res) {
|
|
6197
6440
|
try {
|
|
6198
|
-
const sitemapPath = _optionalChain([this, 'access',
|
|
6441
|
+
const sitemapPath = _optionalChain([this, 'access', _246 => _246.routeManager, 'access', _247 => _247.matchMetadataRoute, 'call', _248 => _248("/sitemap.xml"), 'optionalAccess', _249 => _249.metadata, 'access', _250 => _250.kind]) === "sitemap" || this.getAgentSitemap().enabled ? "/sitemap.xml" : void 0;
|
|
6199
6442
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
6200
6443
|
const rootMetadata = sitemapPath && rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
6201
|
-
const robots =
|
|
6444
|
+
const robots = _chunkFFE2EMF7cjs.createFarmAgentRobots.call(void 0, {
|
|
6202
6445
|
crawlers: this.getAgentCrawlers(),
|
|
6203
6446
|
sitemapPath,
|
|
6204
|
-
metadataBase: _optionalChain([rootMetadata, 'optionalAccess',
|
|
6447
|
+
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _251 => _251.metadataBase]),
|
|
6205
6448
|
basePath: this.config.basePath
|
|
6206
6449
|
});
|
|
6207
6450
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
|
|
6208
6451
|
res,
|
|
6209
|
-
|
|
6452
|
+
_chunkTSFMFPRUcjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
|
|
6210
6453
|
);
|
|
6211
6454
|
} catch (error) {
|
|
6212
6455
|
_chunkVQJYGZNXcjs.logger.error(`Generated robots.txt failed: ${error}`);
|
|
@@ -6220,13 +6463,13 @@ var ServerRenderer = class {
|
|
|
6220
6463
|
}
|
|
6221
6464
|
}
|
|
6222
6465
|
getAgentSitemap() {
|
|
6223
|
-
return
|
|
6466
|
+
return _chunkFFE2EMF7cjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access', _252 => _252.config, 'access', _253 => _253.agent, 'optionalAccess', _254 => _254.sitemap]));
|
|
6224
6467
|
}
|
|
6225
6468
|
/** `/sitemap.xml` from `agent.sitemap` when no sitemap.ts owns it. */
|
|
6226
6469
|
async renderGeneratedSitemap(req, res) {
|
|
6227
6470
|
try {
|
|
6228
6471
|
const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6229
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6472
|
+
trustProxy: _optionalChain([this, 'access', _255 => _255.config, 'access', _256 => _256.server, 'optionalAccess', _257 => _257.trustProxy])
|
|
6230
6473
|
});
|
|
6231
6474
|
const sources = await Promise.all(
|
|
6232
6475
|
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
@@ -6235,22 +6478,22 @@ var ServerRenderer = class {
|
|
|
6235
6478
|
_chunkVQJYGZNXcjs.logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
|
|
6236
6479
|
return void 0;
|
|
6237
6480
|
}),
|
|
6238
|
-
|
|
6481
|
+
fs6.promises.stat(route.modulePath).catch(() => void 0)
|
|
6239
6482
|
]);
|
|
6240
|
-
return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess',
|
|
6483
|
+
return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess', _258 => _258.mtime, 'access', _259 => _259.toISOString, 'call', _260 => _260()]) };
|
|
6241
6484
|
})
|
|
6242
6485
|
);
|
|
6243
6486
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
6244
6487
|
const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
6245
|
-
const sitemap =
|
|
6488
|
+
const sitemap = _chunkFFE2EMF7cjs.createFarmDefaultSitemap.call(void 0, sources, {
|
|
6246
6489
|
origin: new URL(request2.url).origin,
|
|
6247
6490
|
config: this.getAgentSitemap(),
|
|
6248
|
-
metadataBase: _optionalChain([rootMetadata, 'optionalAccess',
|
|
6491
|
+
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _261 => _261.metadataBase]),
|
|
6249
6492
|
basePath: this.config.basePath
|
|
6250
6493
|
});
|
|
6251
6494
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
|
|
6252
6495
|
res,
|
|
6253
|
-
|
|
6496
|
+
_chunkTSFMFPRUcjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
|
|
6254
6497
|
);
|
|
6255
6498
|
} catch (error) {
|
|
6256
6499
|
_chunkVQJYGZNXcjs.logger.error(`Generated sitemap.xml failed: ${error}`);
|
|
@@ -6277,9 +6520,9 @@ var ServerRenderer = class {
|
|
|
6277
6520
|
* matcher) covers, as the production build decides.
|
|
6278
6521
|
*/
|
|
6279
6522
|
getAgentListedRoutes() {
|
|
6280
|
-
const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access',
|
|
6523
|
+
const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access', _262 => _262.middlewareRoutes, 'optionalCall', _263 => _263()]), () => ( [])) };
|
|
6281
6524
|
return [...this.routeManager.getRoutes()].filter(
|
|
6282
|
-
([pattern]) => !pattern.includes("[") && !
|
|
6525
|
+
([pattern]) => !pattern.includes("[") && !_chunkTSFMFPRUcjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
|
|
6283
6526
|
);
|
|
6284
6527
|
}
|
|
6285
6528
|
/**
|
|
@@ -6288,20 +6531,20 @@ var ServerRenderer = class {
|
|
|
6288
6531
|
* or a registered server such as the docs engine's. Production applies the same rules.
|
|
6289
6532
|
*/
|
|
6290
6533
|
getDefaultMCPServer() {
|
|
6291
|
-
if (_optionalChain([this, 'access',
|
|
6292
|
-
if (_optionalChain([this, 'access',
|
|
6293
|
-
if (this.routeManager.matchRoute(
|
|
6294
|
-
_nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer =
|
|
6534
|
+
if (_optionalChain([this, 'access', _264 => _264.config, 'access', _265 => _265.agent, 'optionalAccess', _266 => _266.mcp]) !== true || _chunk46KXZBOGcjs.farmConfigMountsMCP.call(void 0, this.config)) return void 0;
|
|
6535
|
+
if (_optionalChain([this, 'access', _267 => _267.apiRouteExists, 'optionalCall', _268 => _268("/api/mcp")])) return void 0;
|
|
6536
|
+
if (this.routeManager.matchRoute(_chunk46KXZBOGcjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
|
|
6537
|
+
_nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunk46KXZBOGcjs.createFarmDefaultMCPServer.call(void 0,
|
|
6295
6538
|
readAppPackageIdentity(this.config.root),
|
|
6296
|
-
|
|
6539
|
+
_chunkOAMUSC7Hcjs.FARM_VERSION
|
|
6297
6540
|
))));
|
|
6298
|
-
return
|
|
6541
|
+
return _chunk46KXZBOGcjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
|
|
6299
6542
|
}
|
|
6300
6543
|
async renderDefaultMCP(req, res) {
|
|
6301
6544
|
const server = this.getDefaultMCPServer();
|
|
6302
|
-
const request2 = _nullishCoalesce(_chunkHNAISJFDcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
6545
|
+
const request2 = _nullishCoalesce(_chunkHNAISJFDcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _269 => _269.config, 'access', _270 => _270.server, 'optionalAccess', _271 => _271.trustProxy]) })));
|
|
6303
6546
|
try {
|
|
6304
|
-
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-
|
|
6547
|
+
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-YE4AGWHN.cjs");
|
|
6305
6548
|
const origin = new URL(request2.url).origin;
|
|
6306
6549
|
const response = await handleFarmDefaultMCPRequest(request2, {
|
|
6307
6550
|
server,
|
|
@@ -6315,10 +6558,10 @@ var ServerRenderer = class {
|
|
|
6315
6558
|
module: await this.routeManager.loadRouteModule(route.modulePath).catch(() => ({ __farmRouteGuard: true }))
|
|
6316
6559
|
}))
|
|
6317
6560
|
);
|
|
6318
|
-
return
|
|
6561
|
+
return _chunk46KXZBOGcjs.collectFarmDefaultMCPPages.call(void 0, sources, {
|
|
6319
6562
|
origin,
|
|
6320
6563
|
basePath: this.config.basePath,
|
|
6321
|
-
markdown:
|
|
6564
|
+
markdown: _chunkD7UQC4O6cjs.resolveMarkdownConfig.call(void 0, this.config.md)
|
|
6322
6565
|
});
|
|
6323
6566
|
},
|
|
6324
6567
|
// Pages are read through this server's own socket, with no cookies, as llms-full.txt does.
|
|
@@ -6342,7 +6585,7 @@ var ServerRenderer = class {
|
|
|
6342
6585
|
}
|
|
6343
6586
|
/** Same inputs the production server gives llms.txt: static pages and root metadata. */
|
|
6344
6587
|
async createLlmsTxtContext(request2, options = {}) {
|
|
6345
|
-
const config =
|
|
6588
|
+
const config = _chunkH33PJEXNcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _272 => _272.config, 'access', _273 => _273.agent, 'optionalAccess', _274 => _274.llmsTxt]));
|
|
6346
6589
|
const origin = new URL(request2.url).origin;
|
|
6347
6590
|
const sources = await Promise.all(
|
|
6348
6591
|
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
@@ -6358,24 +6601,24 @@ var ServerRenderer = class {
|
|
|
6358
6601
|
);
|
|
6359
6602
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
6360
6603
|
const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
6361
|
-
const pages =
|
|
6604
|
+
const pages = _chunkH33PJEXNcjs.collectFarmLlmsTxtPages.call(void 0,
|
|
6362
6605
|
sources.filter((source) => source !== null),
|
|
6363
6606
|
{
|
|
6364
6607
|
origin,
|
|
6365
6608
|
basePath: this.config.basePath,
|
|
6366
|
-
markdown:
|
|
6609
|
+
markdown: _chunkD7UQC4O6cjs.resolveMarkdownConfig.call(void 0, this.config.md),
|
|
6367
6610
|
include: config.include,
|
|
6368
6611
|
exclude: config.exclude
|
|
6369
6612
|
}
|
|
6370
6613
|
);
|
|
6371
6614
|
return {
|
|
6372
6615
|
pages,
|
|
6373
|
-
defaults:
|
|
6616
|
+
defaults: _chunkH33PJEXNcjs.createFarmDefaultLlmsTxt.call(void 0, {
|
|
6374
6617
|
origin,
|
|
6375
6618
|
pages,
|
|
6376
6619
|
config,
|
|
6377
6620
|
rootMetadata,
|
|
6378
|
-
mcp: _optionalChain([this, 'access',
|
|
6621
|
+
mcp: _optionalChain([this, 'access', _275 => _275.config, 'access', _276 => _276.agent, 'optionalAccess', _277 => _277.aiCatalog]) === false ? [] : _chunk4SEHMBL4cjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
|
|
6379
6622
|
basePath: this.config.basePath,
|
|
6380
6623
|
apiServerBasePath: _chunkB5BBTPJQcjs.resolveFarmAPIServerBasePath.call(void 0,
|
|
6381
6624
|
_chunkIWFV5ZEDcjs.normalizeFarmAPIConfig.call(void 0,
|
|
@@ -6398,17 +6641,17 @@ var ServerRenderer = class {
|
|
|
6398
6641
|
* body is discarded.
|
|
6399
6642
|
*/
|
|
6400
6643
|
createDevMarkdownReader(req) {
|
|
6401
|
-
const socket = _optionalChain([req, 'optionalAccess',
|
|
6402
|
-
if (_optionalChain([req, 'optionalAccess',
|
|
6644
|
+
const socket = _optionalChain([req, 'optionalAccess', _278 => _278.socket]);
|
|
6645
|
+
if (_optionalChain([req, 'optionalAccess', _279 => _279.method, 'optionalAccess', _280 => _280.toUpperCase, 'call', _281 => _281()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _282 => _282.localAddress]) || !socket.localPort) {
|
|
6403
6646
|
return async () => null;
|
|
6404
6647
|
}
|
|
6405
6648
|
if (socket.encrypted) {
|
|
6406
6649
|
const address = { host: socket.localAddress, port: socket.localPort };
|
|
6407
|
-
return
|
|
6650
|
+
return _chunkH33PJEXNcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => requestOwnHttpsServer(page, address));
|
|
6408
6651
|
}
|
|
6409
6652
|
const host = socket.localAddress.includes(":") ? `[${socket.localAddress}]` : socket.localAddress;
|
|
6410
6653
|
const localOrigin = `http://${host}:${socket.localPort}`;
|
|
6411
|
-
const read =
|
|
6654
|
+
const read = _chunkH33PJEXNcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => fetch(page));
|
|
6412
6655
|
return (url) => {
|
|
6413
6656
|
const target = new URL(url);
|
|
6414
6657
|
return read(`${localOrigin}${target.pathname}${target.search}`);
|
|
@@ -6465,7 +6708,7 @@ var ServerRenderer = class {
|
|
|
6465
6708
|
}
|
|
6466
6709
|
const etag = `"${image.staticInfo.hash}"`;
|
|
6467
6710
|
const requestUrl = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
6468
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6711
|
+
trustProxy: _optionalChain([this, 'access', _283 => _283.config, 'access', _284 => _284.server, 'optionalAccess', _285 => _285.trustProxy])
|
|
6469
6712
|
});
|
|
6470
6713
|
const isVersioned = requestUrl.searchParams.get("v") === image.staticInfo.hash;
|
|
6471
6714
|
res.setHeader("Content-Type", image.staticInfo.contentType);
|
|
@@ -6486,7 +6729,7 @@ var ServerRenderer = class {
|
|
|
6486
6729
|
res.end();
|
|
6487
6730
|
return;
|
|
6488
6731
|
}
|
|
6489
|
-
res.write(await
|
|
6732
|
+
res.write(await fs6.promises.readFile(image.modulePath));
|
|
6490
6733
|
res.end();
|
|
6491
6734
|
}
|
|
6492
6735
|
async renderRouteErrorBoundary(req, res, options) {
|
|
@@ -6645,7 +6888,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6645
6888
|
</script>`);
|
|
6646
6889
|
const deferredScript = farmScripts(createDeferredHydrationScript(deferredProps.records));
|
|
6647
6890
|
const rendererHydrationScript = farmScripts(
|
|
6648
|
-
_optionalChain([this, 'access',
|
|
6891
|
+
_optionalChain([this, 'access', _286 => _286.rendererRuntime, 'access', _287 => _287.generateHydrationScript, 'optionalCall', _288 => _288()]) || ""
|
|
6649
6892
|
);
|
|
6650
6893
|
const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
|
|
6651
6894
|
const farmClientScript = farmScripts(
|
|
@@ -6654,8 +6897,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6654
6897
|
const { html: content, head: rendererHead } = await this.renderElementToDocumentParts(
|
|
6655
6898
|
element,
|
|
6656
6899
|
{
|
|
6657
|
-
rejectLateNavigation:
|
|
6658
|
-
_optionalChain([req, 'access',
|
|
6900
|
+
rejectLateNavigation: _chunkD7UQC4O6cjs._isFarmMarkdownPageCheck.call(void 0,
|
|
6901
|
+
_optionalChain([req, 'access', _289 => _289.headers, 'optionalAccess', _290 => _290[_chunkD7UQC4O6cjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])
|
|
6659
6902
|
)
|
|
6660
6903
|
}
|
|
6661
6904
|
);
|
|
@@ -6667,7 +6910,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6667
6910
|
viewport: viewportTags
|
|
6668
6911
|
} = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
6669
6912
|
pathname: getFarmMetadataPathname(req),
|
|
6670
|
-
jsonLd: _optionalChain([this, 'access',
|
|
6913
|
+
jsonLd: _optionalChain([this, 'access', _291 => _291.config, 'access', _292 => _292.agent, 'optionalAccess', _293 => _293.jsonLd])
|
|
6671
6914
|
});
|
|
6672
6915
|
const documentTitleTag = !hasExplicitTitle && /<title[\s>]/i.test(rendererHead) ? "" : `<title>${title}</title>`;
|
|
6673
6916
|
const rendererHasTitle = /<title[\s>]/i.test(rendererHead);
|
|
@@ -6677,19 +6920,19 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6677
6920
|
i18nSnapshot,
|
|
6678
6921
|
this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
|
|
6679
6922
|
) : "";
|
|
6680
|
-
const themeDocument =
|
|
6923
|
+
const themeDocument = _chunkTSFMFPRUcjs.createFarmThemeDocumentParts.call(void 0,
|
|
6681
6924
|
this.config.theme,
|
|
6682
6925
|
this.config.basePath,
|
|
6683
6926
|
_chunk4ZJ5C7UJcjs.getTheme.call(void 0, )
|
|
6684
6927
|
);
|
|
6685
6928
|
themeDocument.head = farmScripts(themeDocument.head);
|
|
6686
|
-
const fullDocument =
|
|
6929
|
+
const fullDocument = _chunkTSFMFPRUcjs.extractFarmFullDocument.call(void 0, content);
|
|
6687
6930
|
let html;
|
|
6688
6931
|
if (fullDocument) {
|
|
6689
6932
|
const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
|
|
6690
|
-
const documentHtml = shouldReplaceLayoutTitle ?
|
|
6691
|
-
const effectiveRendererHead = hasExplicitTitle ?
|
|
6692
|
-
html =
|
|
6933
|
+
const documentHtml = shouldReplaceLayoutTitle ? _chunkTSFMFPRUcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
|
|
6934
|
+
const effectiveRendererHead = hasExplicitTitle ? _chunkTSFMFPRUcjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
|
|
6935
|
+
html = _chunkTSFMFPRUcjs.composeFarmFullDocument.call(void 0, documentHtml, {
|
|
6693
6936
|
fallbackIcon: !hasFavicon,
|
|
6694
6937
|
viewport: viewportTags,
|
|
6695
6938
|
htmlAttributes: `${i18nSnapshot ? ` lang="${escapeHtmlAttribute2(i18nSnapshot.locale)}" dir="${escapeHtmlAttribute2(i18nSnapshot.direction)}"` : ""}${themeDocument.attributes}`,
|
|
@@ -6715,7 +6958,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6715
6958
|
});
|
|
6716
6959
|
} else {
|
|
6717
6960
|
html = `<!DOCTYPE html>
|
|
6718
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
6961
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _294 => _294.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
6719
6962
|
<head>
|
|
6720
6963
|
${themeDocument.head}
|
|
6721
6964
|
<meta charset="utf-8">
|
|
@@ -6746,7 +6989,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6746
6989
|
const securedHtml = this.secureDocumentHTML(req, html);
|
|
6747
6990
|
if ((req.method || "GET").toUpperCase() !== "HEAD") res.write(securedHtml);
|
|
6748
6991
|
res.end();
|
|
6749
|
-
if (!options.captureStaticShell) await _optionalChain([options, 'access',
|
|
6992
|
+
if (!options.captureStaticShell) await _optionalChain([options, 'access', _295 => _295.onComplete, 'optionalCall', _296 => _296(securedHtml)]);
|
|
6750
6993
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
6751
6994
|
type: "render.stream.complete",
|
|
6752
6995
|
route,
|
|
@@ -6756,7 +6999,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6756
6999
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.error", route, error });
|
|
6757
7000
|
throw error;
|
|
6758
7001
|
} finally {
|
|
6759
|
-
_optionalChain([clearMiddlewareData, 'optionalCall',
|
|
7002
|
+
_optionalChain([clearMiddlewareData, 'optionalCall', _297 => _297()]);
|
|
6760
7003
|
}
|
|
6761
7004
|
}
|
|
6762
7005
|
/**
|
|
@@ -6771,7 +7014,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6771
7014
|
if (!rootLayout) return false;
|
|
6772
7015
|
try {
|
|
6773
7016
|
const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
|
|
6774
|
-
if (typeof Layout !== "function" || _optionalChain([Layout, 'access',
|
|
7017
|
+
if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _298 => _298.prototype, 'optionalAccess', _299 => _299.isReactComponent]) || _optionalChain([Layout, 'access', _300 => _300.constructor, 'optionalAccess', _301 => _301.name]) === "AsyncFunction") {
|
|
6775
7018
|
return false;
|
|
6776
7019
|
}
|
|
6777
7020
|
const cached = documentLayouts.get(Layout);
|
|
@@ -6783,12 +7026,12 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6783
7026
|
params: {}
|
|
6784
7027
|
});
|
|
6785
7028
|
rendersDocument = this.rendererRuntime.isValidElement(rendered) && rendered.type === "html";
|
|
6786
|
-
} catch (
|
|
7029
|
+
} catch (e21) {
|
|
6787
7030
|
rendersDocument = false;
|
|
6788
7031
|
}
|
|
6789
7032
|
documentLayouts.set(Layout, rendersDocument);
|
|
6790
7033
|
return rendersDocument;
|
|
6791
|
-
} catch (
|
|
7034
|
+
} catch (e22) {
|
|
6792
7035
|
return false;
|
|
6793
7036
|
}
|
|
6794
7037
|
}
|
|
@@ -6796,7 +7039,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6796
7039
|
const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
|
|
6797
7040
|
const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
6798
7041
|
const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument();
|
|
6799
|
-
if (!renderToPipeableStream ||
|
|
7042
|
+
if (!renderToPipeableStream || _chunkD7UQC4O6cjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access', _302 => _302.headers, 'optionalAccess', _303 => _303[_chunkD7UQC4O6cjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])) || streamDocument && (options.captureStaticShell || !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer))) {
|
|
6800
7043
|
return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
|
|
6801
7044
|
}
|
|
6802
7045
|
return new Promise((resolve3, reject) => {
|
|
@@ -6912,7 +7155,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6912
7155
|
viewport: viewportTags
|
|
6913
7156
|
} = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
6914
7157
|
pathname: getFarmMetadataPathname(req),
|
|
6915
|
-
jsonLd: _optionalChain([this, 'access',
|
|
7158
|
+
jsonLd: _optionalChain([this, 'access', _304 => _304.config, 'access', _305 => _305.agent, 'optionalAccess', _306 => _306.jsonLd])
|
|
6916
7159
|
});
|
|
6917
7160
|
const i18nSnapshot = _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
6918
7161
|
const i18nAlternateTags = i18nSnapshot ? renderI18nAlternateLinks(
|
|
@@ -6921,7 +7164,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6921
7164
|
this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
|
|
6922
7165
|
) : "";
|
|
6923
7166
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
6924
|
-
const themeDocument =
|
|
7167
|
+
const themeDocument = _chunkTSFMFPRUcjs.createFarmThemeDocumentParts.call(void 0,
|
|
6925
7168
|
this.config.theme,
|
|
6926
7169
|
this.config.basePath,
|
|
6927
7170
|
_chunk4ZJ5C7UJcjs.getTheme.call(void 0, )
|
|
@@ -6938,7 +7181,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6938
7181
|
nonce: cspNonce,
|
|
6939
7182
|
onShellReady() {
|
|
6940
7183
|
if (pendingNavigationError) {
|
|
6941
|
-
_optionalChain([abort, 'optionalCall',
|
|
7184
|
+
_optionalChain([abort, 'optionalCall', _307 => _307(pendingNavigationError)]);
|
|
6942
7185
|
if (clearMiddlewareData) {
|
|
6943
7186
|
clearMiddlewareData();
|
|
6944
7187
|
}
|
|
@@ -6956,7 +7199,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6956
7199
|
console.log(`[FARM STREAM] onShellReady at ${shellReadyMs}ms`);
|
|
6957
7200
|
}
|
|
6958
7201
|
const shell = `<!DOCTYPE html>
|
|
6959
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
7202
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _308 => _308.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
6960
7203
|
<head>
|
|
6961
7204
|
${themeDocument.head}
|
|
6962
7205
|
<meta charset="utf-8">
|
|
@@ -6977,7 +7220,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6977
7220
|
const securedShell = streamDocument ? "" : stampDocumentHTML(shell);
|
|
6978
7221
|
if (securedShell) {
|
|
6979
7222
|
htmlParts.push(securedShell);
|
|
6980
|
-
_optionalChain([staticShellParts, 'optionalAccess',
|
|
7223
|
+
_optionalChain([staticShellParts, 'optionalAccess', _309 => _309.push, 'call', _310 => _310(securedShell)]);
|
|
6981
7224
|
}
|
|
6982
7225
|
const withEarlyClient = (document) => earlyClient ? {
|
|
6983
7226
|
...document,
|
|
@@ -6987,10 +7230,10 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6987
7230
|
${stampDocumentHTML(FARM_DEV_EARLY_CLIENT_SCRIPT)}`
|
|
6988
7231
|
)
|
|
6989
7232
|
} : document;
|
|
6990
|
-
const documentTransform = streamDocument ?
|
|
7233
|
+
const documentTransform = streamDocument ? _chunkTSFMFPRUcjs.createFarmStreamedDocumentTransform.call(void 0,
|
|
6991
7234
|
(opening) => withEarlyClient(
|
|
6992
|
-
|
|
6993
|
-
hasExplicitTitle ?
|
|
7235
|
+
_chunkTSFMFPRUcjs.openFarmStreamedDocument.call(void 0,
|
|
7236
|
+
hasExplicitTitle ? _chunkTSFMFPRUcjs.removeFarmDocumentTitles.call(void 0, opening) : opening,
|
|
6994
7237
|
{
|
|
6995
7238
|
fallbackIcon: !hasFavicon,
|
|
6996
7239
|
viewport: viewportTags,
|
|
@@ -7029,7 +7272,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7029
7272
|
const recordRenderedChunk = (chunkText, renderedText = chunkText) => {
|
|
7030
7273
|
if (!checkedFullDocument && renderedText) {
|
|
7031
7274
|
documentPrefix += renderedText;
|
|
7032
|
-
const prefix =
|
|
7275
|
+
const prefix = _chunkTSFMFPRUcjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
|
|
7033
7276
|
if (prefix !== "pending") {
|
|
7034
7277
|
checkedFullDocument = true;
|
|
7035
7278
|
documentPrefix = "";
|
|
@@ -7048,7 +7291,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7048
7291
|
staticShellClosed = true;
|
|
7049
7292
|
if (!suspenseHoleEmitted) {
|
|
7050
7293
|
suspenseHoleEmitted = true;
|
|
7051
|
-
_optionalChain([options, 'access',
|
|
7294
|
+
_optionalChain([options, 'access', _311 => _311.onSuspenseHoleDetected, 'optionalCall', _312 => _312()]);
|
|
7052
7295
|
}
|
|
7053
7296
|
} else {
|
|
7054
7297
|
staticShellParts.push(chunkText);
|
|
@@ -7104,8 +7347,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7104
7347
|
recordRenderedChunk(tail, rewritten);
|
|
7105
7348
|
if (tail) res.write(tail);
|
|
7106
7349
|
}
|
|
7107
|
-
const documentEnd = _optionalChain([documentTransform, 'optionalAccess',
|
|
7108
|
-
if (_optionalChain([documentEnd, 'optionalAccess',
|
|
7350
|
+
const documentEnd = _optionalChain([documentTransform, 'optionalAccess', _313 => _313.end, 'call', _314 => _314()]);
|
|
7351
|
+
if (_optionalChain([documentEnd, 'optionalAccess', _315 => _315.text])) {
|
|
7109
7352
|
recordRenderedChunk(documentEnd.text, "");
|
|
7110
7353
|
res.write(documentEnd.text);
|
|
7111
7354
|
}
|
|
@@ -7116,7 +7359,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7116
7359
|
deferredHydrationScript: createDeferredHydrationScript(deferredProps.records),
|
|
7117
7360
|
earlyClient,
|
|
7118
7361
|
// A full document: Farm's #root closes only where Farm opened it.
|
|
7119
|
-
..._optionalChain([documentEnd, 'optionalAccess',
|
|
7362
|
+
..._optionalChain([documentEnd, 'optionalAccess', _316 => _316.document]) ? { closeRoot: documentEnd.rootOpened } : {}
|
|
7120
7363
|
})
|
|
7121
7364
|
);
|
|
7122
7365
|
htmlParts.push(footer);
|
|
@@ -7220,7 +7463,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7220
7463
|
return await this.routeManager.loadRouteModule(notFoundPath);
|
|
7221
7464
|
}
|
|
7222
7465
|
async loadNotFoundComponent() {
|
|
7223
|
-
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async
|
|
7466
|
+
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _317 => _317.default]), async () => ( null));
|
|
7224
7467
|
}
|
|
7225
7468
|
/** The not-found document's head: layout and not-found metadata, as production renders it. */
|
|
7226
7469
|
async notFoundMetadataHead(layoutModule, notFoundModule) {
|
|
@@ -7243,13 +7486,13 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7243
7486
|
*/
|
|
7244
7487
|
async createLateNavigationRecoveryHTML(req, error) {
|
|
7245
7488
|
if (_chunk7JUIK547cjs.isFarmRedirectError.call(void 0, error)) {
|
|
7246
|
-
return
|
|
7489
|
+
return _chunkTSFMFPRUcjs.createLateRedirectRecovery.call(void 0,
|
|
7247
7490
|
this.localizeRedirectUrl(_chunk7JUIK547cjs.getFarmRedirectError.call(void 0, error).url),
|
|
7248
7491
|
this.getCspNonce(req) || ""
|
|
7249
7492
|
);
|
|
7250
7493
|
}
|
|
7251
7494
|
const pathname = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7252
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7495
|
+
trustProxy: _optionalChain([this, 'access', _318 => _318.config, 'access', _319 => _319.server, 'optionalAccess', _320 => _320.trustProxy])
|
|
7253
7496
|
}).pathname;
|
|
7254
7497
|
let content = this.defaultNotFoundContent();
|
|
7255
7498
|
const NotFoundComponent = await this.loadNotFoundComponent();
|
|
@@ -7265,29 +7508,29 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7265
7508
|
_chunkVQJYGZNXcjs.logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
|
|
7266
7509
|
}
|
|
7267
7510
|
}
|
|
7268
|
-
return
|
|
7511
|
+
return _chunkTSFMFPRUcjs.createLateNotFoundRecovery.call(void 0, content, this.getCspNonce(req) || "");
|
|
7269
7512
|
}
|
|
7270
7513
|
async render404(req, res) {
|
|
7271
7514
|
res.statusCode = 404;
|
|
7272
7515
|
const pathname = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7273
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7516
|
+
trustProxy: _optionalChain([this, 'access', _321 => _321.config, 'access', _322 => _322.server, 'optionalAccess', _323 => _323.trustProxy])
|
|
7274
7517
|
}).pathname;
|
|
7275
7518
|
const acceptHeader = req.headers.accept;
|
|
7276
7519
|
const accept = Array.isArray(acceptHeader) ? acceptHeader.join(",") : acceptHeader;
|
|
7277
|
-
if (
|
|
7278
|
-
res.setHeader("Content-Type",
|
|
7520
|
+
if (_chunkD7UQC4O6cjs.farmRequestWantsMarkdown.call(void 0, pathname, accept)) {
|
|
7521
|
+
res.setHeader("Content-Type", _chunkD7UQC4O6cjs.FARM_MARKDOWN_CONTENT_TYPE);
|
|
7279
7522
|
res.setHeader("X-Farm-Markdown-Error", "404");
|
|
7280
7523
|
res.setHeader("Cache-Control", "no-store");
|
|
7281
|
-
res.end(
|
|
7524
|
+
res.end(_chunkD7UQC4O6cjs.createFarmMarkdownErrorBody.call(void 0, 404, pathname, this.config.basePath || "/"));
|
|
7282
7525
|
return;
|
|
7283
7526
|
}
|
|
7284
|
-
const appDir =
|
|
7527
|
+
const appDir = path10.join(this.config.root, this.config.srcDir, "app");
|
|
7285
7528
|
const notFoundExtensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
|
|
7286
7529
|
let layoutModule = null;
|
|
7287
7530
|
try {
|
|
7288
7531
|
for (const ext of notFoundExtensions) {
|
|
7289
|
-
const layoutPath =
|
|
7290
|
-
if (
|
|
7532
|
+
const layoutPath = path10.join(appDir, `layout${ext}`);
|
|
7533
|
+
if (fs6.existsSync(layoutPath)) {
|
|
7291
7534
|
layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
|
|
7292
7535
|
break;
|
|
7293
7536
|
}
|
|
@@ -7298,9 +7541,9 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7298
7541
|
);
|
|
7299
7542
|
if (notFoundPath) {
|
|
7300
7543
|
const notFoundModule = await this.loadNotFoundModule();
|
|
7301
|
-
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess',
|
|
7544
|
+
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _324 => _324.default]), () => ( null));
|
|
7302
7545
|
if (NotFoundComponent) {
|
|
7303
|
-
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess',
|
|
7546
|
+
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _325 => _325.default]), () => ( null));
|
|
7304
7547
|
let element = this.rendererRuntime.createElement(NotFoundComponent, { pathname });
|
|
7305
7548
|
if (LayoutComponent) {
|
|
7306
7549
|
element = this.rendererRuntime.createElement(LayoutComponent, {
|
|
@@ -7340,23 +7583,23 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7340
7583
|
res.statusCode = statusCode;
|
|
7341
7584
|
const isDev = process.env.NODE_ENV === "development";
|
|
7342
7585
|
const requestUrl = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7343
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7586
|
+
trustProxy: _optionalChain([this, 'access', _326 => _326.config, 'access', _327 => _327.server, 'optionalAccess', _328 => _328.trustProxy])
|
|
7344
7587
|
});
|
|
7345
7588
|
const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
|
|
7346
|
-
const statusText =
|
|
7589
|
+
const statusText = _chunkTSFMFPRUcjs.getDefaultErrorStatusText.call(void 0, statusCode);
|
|
7347
7590
|
const content = this.stampFarmScripts(
|
|
7348
7591
|
req,
|
|
7349
|
-
|
|
7592
|
+
_chunkTSFMFPRUcjs.createDefaultErrorMarkup.call(void 0, {
|
|
7350
7593
|
statusCode,
|
|
7351
7594
|
statusText,
|
|
7352
7595
|
requestPath: requestUrl.pathname,
|
|
7353
7596
|
method: req.method || "GET",
|
|
7354
|
-
message: _optionalChain([diagnostics, 'optionalAccess',
|
|
7355
|
-
errorName: _optionalChain([diagnostics, 'optionalAccess',
|
|
7356
|
-
stack: _optionalChain([diagnostics, 'optionalAccess',
|
|
7357
|
-
sourceFrame: _optionalChain([diagnostics, 'optionalAccess',
|
|
7597
|
+
message: _optionalChain([diagnostics, 'optionalAccess', _329 => _329.message]),
|
|
7598
|
+
errorName: _optionalChain([diagnostics, 'optionalAccess', _330 => _330.name]),
|
|
7599
|
+
stack: _optionalChain([diagnostics, 'optionalAccess', _331 => _331.stack]),
|
|
7600
|
+
sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _332 => _332.sourceFrame]),
|
|
7358
7601
|
development: isDev,
|
|
7359
|
-
farmVersion:
|
|
7602
|
+
farmVersion: _chunkOAMUSC7Hcjs.FARM_VERSION,
|
|
7360
7603
|
nodeVersion: process.version,
|
|
7361
7604
|
mode: isDev ? "development" : "production"
|
|
7362
7605
|
})
|
|
@@ -7382,8 +7625,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7382
7625
|
*/
|
|
7383
7626
|
getI18nAlternateOptions(req, metadata) {
|
|
7384
7627
|
return {
|
|
7385
|
-
metadataBase: _optionalChain([metadata, 'optionalAccess',
|
|
7386
|
-
origin: req ? _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
7628
|
+
metadataBase: _optionalChain([metadata, 'optionalAccess', _333 => _333.metadataBase]),
|
|
7629
|
+
origin: req ? _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _334 => _334.config, 'access', _335 => _335.server, 'optionalAccess', _336 => _336.trustProxy]) }).origin : void 0
|
|
7387
7630
|
};
|
|
7388
7631
|
}
|
|
7389
7632
|
createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
|
|
@@ -7402,20 +7645,20 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
7402
7645
|
this.getI18nAlternateOptions(alternates.req, alternates.metadata)
|
|
7403
7646
|
) : "";
|
|
7404
7647
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
7405
|
-
const themeDocument =
|
|
7648
|
+
const themeDocument = _chunkTSFMFPRUcjs.createFarmThemeDocumentParts.call(void 0,
|
|
7406
7649
|
this.config.theme,
|
|
7407
7650
|
this.config.basePath,
|
|
7408
7651
|
_chunk4ZJ5C7UJcjs.getTheme.call(void 0, )
|
|
7409
7652
|
);
|
|
7410
7653
|
themeDocument.head = farmScripts(themeDocument.head);
|
|
7411
7654
|
const rendererHydrationScript = farmScripts(
|
|
7412
|
-
_optionalChain([this, 'access',
|
|
7655
|
+
_optionalChain([this, 'access', _337 => _337.rendererRuntime, 'access', _338 => _338.generateHydrationScript, 'optionalCall', _339 => _339()]) || ""
|
|
7413
7656
|
);
|
|
7414
|
-
const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access',
|
|
7415
|
-
const fullDocument =
|
|
7657
|
+
const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _340 => _340.metadata, 'optionalAccess', _341 => _341.viewport]));
|
|
7658
|
+
const fullDocument = _chunkTSFMFPRUcjs.extractFarmFullDocument.call(void 0, content);
|
|
7416
7659
|
if (fullDocument) {
|
|
7417
|
-
return
|
|
7418
|
-
metadataHead ?
|
|
7660
|
+
return _chunkTSFMFPRUcjs.composeFarmFullDocument.call(void 0,
|
|
7661
|
+
metadataHead ? _chunkTSFMFPRUcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
|
|
7419
7662
|
{
|
|
7420
7663
|
fallbackIcon: !metadataHead,
|
|
7421
7664
|
viewport: viewportTags,
|
|
@@ -7441,7 +7684,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
7441
7684
|
);
|
|
7442
7685
|
}
|
|
7443
7686
|
return `<!DOCTYPE html>
|
|
7444
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
7687
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _342 => _342.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
7445
7688
|
<head>
|
|
7446
7689
|
${themeDocument.head}
|
|
7447
7690
|
<meta charset="utf-8">
|
|
@@ -7483,7 +7726,7 @@ ${clientScript}
|
|
|
7483
7726
|
res.setHeader(_chunkE552H232cjs.FARM_DEPLOYMENT_ID_HEADER, deploymentId);
|
|
7484
7727
|
if ((req.method || "GET").toUpperCase() !== "GET") return;
|
|
7485
7728
|
const forwardedProto = req.headers["x-forwarded-proto"];
|
|
7486
|
-
const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess',
|
|
7729
|
+
const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _343 => _343.split, 'call', _344 => _344(","), 'access', _345 => _345[0], 'optionalAccess', _346 => _346.trim, 'call', _347 => _347()]) === "https" || Boolean(_optionalChain([req, 'access', _348 => _348.socket, 'optionalAccess', _349 => _349.encrypted]));
|
|
7487
7730
|
const cookie = _chunkE552H232cjs.createFarmDeploymentCookie.call(void 0, deploymentId, this.config.basePath || "/", isSecure);
|
|
7488
7731
|
const existing = res.getHeader("Set-Cookie");
|
|
7489
7732
|
if (Array.isArray(existing)) {
|
|
@@ -7583,7 +7826,7 @@ var FarmApp = class {
|
|
|
7583
7826
|
serverActions: _chunkFK25QSVCcjs.resolveServerActionsConfig.call(void 0, config.serverActions),
|
|
7584
7827
|
security: _chunk6JHZPB52cjs.resolveFarmSecurityConfig.call(void 0, config.security),
|
|
7585
7828
|
images: _chunkHEPJIKKQcjs.resolveFarmImageConfig.call(void 0, config.images),
|
|
7586
|
-
performance:
|
|
7829
|
+
performance: _chunkFFE2EMF7cjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
|
|
7587
7830
|
theme: _chunkWT6RAN2Icjs.resolveFarmThemeConfig.call(void 0, config.theme, basePath),
|
|
7588
7831
|
i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : _chunkLNVGXUL3cjs.resolveFarmI18nConfig.call(void 0, config.i18n, {
|
|
7589
7832
|
root,
|
|
@@ -7595,7 +7838,7 @@ var FarmApp = class {
|
|
|
7595
7838
|
serverRuntimeConfig: config.serverRuntimeConfig || {},
|
|
7596
7839
|
publicRuntimeConfig: config.publicRuntimeConfig || {},
|
|
7597
7840
|
docs: isResolvedDocsConfig(config.docs) ? config.docs : defaultDocsConfig,
|
|
7598
|
-
md:
|
|
7841
|
+
md: _chunkD7UQC4O6cjs.resolveMarkdownConfig.call(void 0, config.md),
|
|
7599
7842
|
mdx: _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx),
|
|
7600
7843
|
observability: _nullishCoalesce(config.observability, () => ( false)),
|
|
7601
7844
|
telemetry: config.telemetry !== false,
|
|
@@ -7611,10 +7854,10 @@ var FarmApp = class {
|
|
|
7611
7854
|
env: config.env || { server: {}, public: {} },
|
|
7612
7855
|
suppressLintOnLink: _nullishCoalesce(config.suppressLintOnLink, () => ( false)),
|
|
7613
7856
|
experimental: {
|
|
7614
|
-
serverComponents: _nullishCoalesce(_optionalChain([config, 'access',
|
|
7615
|
-
serverActions: _nullishCoalesce(_optionalChain([config, 'access',
|
|
7616
|
-
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access',
|
|
7617
|
-
ppr: _nullishCoalesce(_optionalChain([config, 'access',
|
|
7857
|
+
serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _350 => _350.experimental, 'optionalAccess', _351 => _351.serverComponents]), () => ( false)),
|
|
7858
|
+
serverActions: _nullishCoalesce(_optionalChain([config, 'access', _352 => _352.experimental, 'optionalAccess', _353 => _353.serverActions]), () => ( false)),
|
|
7859
|
+
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _354 => _354.experimental, 'optionalAccess', _355 => _355.isolatedClientHydration]), () => ( "off")),
|
|
7860
|
+
ppr: _nullishCoalesce(_optionalChain([config, 'access', _356 => _356.experimental, 'optionalAccess', _357 => _357.ppr]), () => ( false)),
|
|
7618
7861
|
...config.experimental
|
|
7619
7862
|
},
|
|
7620
7863
|
agent: _nullishCoalesce(config.agent, () => ( {})),
|
|
@@ -7640,7 +7883,7 @@ var FarmApp = class {
|
|
|
7640
7883
|
}
|
|
7641
7884
|
const componentExtensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
|
|
7642
7885
|
const rootLayoutPaths = appDirs.flatMap(
|
|
7643
|
-
(appDir) => componentExtensions.map((extension) =>
|
|
7886
|
+
(appDir) => componentExtensions.map((extension) => path5.default.join(appDir, `layout${extension}`))
|
|
7644
7887
|
);
|
|
7645
7888
|
const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => _chunkVQJYGZNXcjs.fileExists.call(void 0, p))).then(
|
|
7646
7889
|
(results) => results.some(Boolean)
|
|
@@ -7661,7 +7904,7 @@ function isResolvedAuthConfig(value) {
|
|
|
7661
7904
|
);
|
|
7662
7905
|
}
|
|
7663
7906
|
function normalizeFarmAppAPIConfig(config) {
|
|
7664
|
-
if (typeof _optionalChain([config, 'optionalAccess',
|
|
7907
|
+
if (typeof _optionalChain([config, 'optionalAccess', _358 => _358.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _359 => _359.basePath]) === "function") {
|
|
7665
7908
|
throw new Error(
|
|
7666
7909
|
"Farm API config resolver functions must be processed with resolveConfig() before creating a FarmApp."
|
|
7667
7910
|
);
|
|
@@ -7676,7 +7919,7 @@ function createFarmApp(config, viteServer) {
|
|
|
7676
7919
|
var SHARP_INSTALL_HINT = _chunkKORZ6PREcjs.formatOptionalPeerInstallHint.call(void 0, "sharp", "optimize images");
|
|
7677
7920
|
var CLOUDFLARE_IMAGE_PRESETS = /* @__PURE__ */ new Set(["cloudflare", "cloudflare-pages", "cloudflare-module"]);
|
|
7678
7921
|
function resolveFarmImageProviderForRuntime(images, options) {
|
|
7679
|
-
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess',
|
|
7922
|
+
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _360 => _360.provider]), () => ( "auto"));
|
|
7680
7923
|
if (provider === "none") return images;
|
|
7681
7924
|
const usesSharp = options.dev ? true : provider === "node" || provider === "auto" && !CLOUDFLARE_IMAGE_PRESETS.has(options.preset || "");
|
|
7682
7925
|
if (!usesSharp || _chunkKORZ6PREcjs.isOptionalPeerInstalled.call(void 0, options.root, "sharp")) return images;
|
|
@@ -7710,8 +7953,8 @@ var FARM_PACKAGE = /^@(?:farm\.js|farming-labs)\/[a-z0-9._-]+$/;
|
|
|
7710
7953
|
function resolveFarmAppPackages(root) {
|
|
7711
7954
|
let manifest;
|
|
7712
7955
|
try {
|
|
7713
|
-
manifest = JSON.parse(
|
|
7714
|
-
} catch (
|
|
7956
|
+
manifest = JSON.parse(fs3.default.readFileSync(path5.default.join(root, "package.json"), "utf8"));
|
|
7957
|
+
} catch (e23) {
|
|
7715
7958
|
return {};
|
|
7716
7959
|
}
|
|
7717
7960
|
const names = new Set(
|
|
@@ -7725,13 +7968,13 @@ function resolveFarmAppPackages(root) {
|
|
|
7725
7968
|
for (let dir = root; ; ) {
|
|
7726
7969
|
try {
|
|
7727
7970
|
const { version } = JSON.parse(
|
|
7728
|
-
|
|
7971
|
+
fs3.default.readFileSync(path5.default.join(dir, "node_modules", name, "package.json"), "utf8")
|
|
7729
7972
|
);
|
|
7730
7973
|
if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
|
|
7731
7974
|
versions[name] = version;
|
|
7732
7975
|
break;
|
|
7733
|
-
} catch (
|
|
7734
|
-
const parent =
|
|
7976
|
+
} catch (e24) {
|
|
7977
|
+
const parent = path5.default.dirname(dir);
|
|
7735
7978
|
if (parent === dir) break;
|
|
7736
7979
|
dir = parent;
|
|
7737
7980
|
}
|
|
@@ -7805,9 +8048,9 @@ function staticValue(node) {
|
|
|
7805
8048
|
}
|
|
7806
8049
|
}
|
|
7807
8050
|
function property(object, name) {
|
|
7808
|
-
return _optionalChain([object, 'access',
|
|
8051
|
+
return _optionalChain([object, 'access', _361 => _361.properties, 'access', _362 => _362.find, 'call', _363 => _363(
|
|
7809
8052
|
(entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
|
|
7810
|
-
), 'optionalAccess',
|
|
8053
|
+
), 'optionalAccess', _364 => _364.value]);
|
|
7811
8054
|
}
|
|
7812
8055
|
function toolFromObject(object) {
|
|
7813
8056
|
const name = staticValue(property(object, "name"));
|
|
@@ -7838,14 +8081,14 @@ function toolFromObject(object) {
|
|
|
7838
8081
|
}
|
|
7839
8082
|
function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
7840
8083
|
if (!code.includes(WEBMCP_CLIENT)) return [];
|
|
7841
|
-
const lang = _nullishCoalesce(LANGS[
|
|
8084
|
+
const lang = _nullishCoalesce(LANGS[path5.default.extname(filename).slice(1)], () => ( "tsx"));
|
|
7842
8085
|
_nullishCoalesce(parseAst, () => ( (parseAst = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
|
|
7843
8086
|
"rolldown/parseAst"
|
|
7844
8087
|
).parseAst)));
|
|
7845
8088
|
let program;
|
|
7846
8089
|
try {
|
|
7847
8090
|
program = parseAst(code, { lang });
|
|
7848
|
-
} catch (
|
|
8091
|
+
} catch (e25) {
|
|
7849
8092
|
return [];
|
|
7850
8093
|
}
|
|
7851
8094
|
const locals = /* @__PURE__ */ new Map();
|
|
@@ -7853,7 +8096,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
7853
8096
|
if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
|
|
7854
8097
|
continue;
|
|
7855
8098
|
for (const specifier of statement.specifiers) {
|
|
7856
|
-
const imported = _nullishCoalesce(_optionalChain([specifier, 'access',
|
|
8099
|
+
const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _365 => _365.imported, 'optionalAccess', _366 => _366.name]), () => ( _optionalChain([specifier, 'access', _367 => _367.imported, 'optionalAccess', _368 => _368.value])));
|
|
7857
8100
|
if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
|
|
7858
8101
|
locals.set(specifier.local.name, imported);
|
|
7859
8102
|
}
|
|
@@ -7869,7 +8112,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
7869
8112
|
const [argument] = current.arguments;
|
|
7870
8113
|
if (definer && argument) {
|
|
7871
8114
|
const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
|
|
7872
|
-
(element) => _optionalChain([element, 'optionalAccess',
|
|
8115
|
+
(element) => _optionalChain([element, 'optionalAccess', _369 => _369.type]) === "ObjectExpression"
|
|
7873
8116
|
) : [] : argument.type === "ObjectExpression" ? [argument] : [];
|
|
7874
8117
|
for (const object of objects) {
|
|
7875
8118
|
const tool = toolFromObject(object);
|
|
@@ -7885,7 +8128,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
7885
8128
|
}
|
|
7886
8129
|
var cache = /* @__PURE__ */ new Map();
|
|
7887
8130
|
function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
7888
|
-
const base =
|
|
8131
|
+
const base = path5.default.resolve(root, srcDir);
|
|
7889
8132
|
let files;
|
|
7890
8133
|
try {
|
|
7891
8134
|
files = _tinyglobby.globSync.call(void 0, "**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
|
|
@@ -7894,7 +8137,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
7894
8137
|
expandDirectories: false,
|
|
7895
8138
|
ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
|
|
7896
8139
|
});
|
|
7897
|
-
} catch (
|
|
8140
|
+
} catch (e26) {
|
|
7898
8141
|
return [];
|
|
7899
8142
|
}
|
|
7900
8143
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -7902,16 +8145,16 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
7902
8145
|
for (const file of files.sort()) {
|
|
7903
8146
|
let mtimeMs;
|
|
7904
8147
|
try {
|
|
7905
|
-
mtimeMs =
|
|
7906
|
-
} catch (
|
|
8148
|
+
mtimeMs = fs3.default.statSync(file).mtimeMs;
|
|
8149
|
+
} catch (e27) {
|
|
7907
8150
|
continue;
|
|
7908
8151
|
}
|
|
7909
8152
|
let entry = cache.get(file);
|
|
7910
8153
|
if (!entry || entry.mtimeMs !== mtimeMs) {
|
|
7911
8154
|
let code = "";
|
|
7912
8155
|
try {
|
|
7913
|
-
code =
|
|
7914
|
-
} catch (
|
|
8156
|
+
code = fs3.default.readFileSync(file, "utf8");
|
|
8157
|
+
} catch (e28) {
|
|
7915
8158
|
}
|
|
7916
8159
|
entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
|
|
7917
8160
|
cache.set(file, entry);
|
|
@@ -7947,15 +8190,15 @@ var MOBILE_SHELL_CLIENT_REGISTRATION = ` {
|
|
|
7947
8190
|
}`;
|
|
7948
8191
|
var APP_CLIENT_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
7949
8192
|
function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
|
|
7950
|
-
const sourceRoot =
|
|
8193
|
+
const sourceRoot = path5.default.resolve(root, srcDir);
|
|
7951
8194
|
for (const extension of APP_CLIENT_EXTENSIONS) {
|
|
7952
|
-
const candidate =
|
|
7953
|
-
if (
|
|
8195
|
+
const candidate = path5.default.join(sourceRoot, `client.${extension}`);
|
|
8196
|
+
if (fs3.default.existsSync(candidate) && fs3.default.statSync(candidate).isFile()) return candidate;
|
|
7954
8197
|
}
|
|
7955
8198
|
return void 0;
|
|
7956
8199
|
}
|
|
7957
8200
|
function resolveFarmClientPlugins(plugins, _root) {
|
|
7958
|
-
if (!_optionalChain([plugins, 'optionalAccess',
|
|
8201
|
+
if (!_optionalChain([plugins, 'optionalAccess', _370 => _370.length])) return [];
|
|
7959
8202
|
return plugins.flatMap((plugin) => {
|
|
7960
8203
|
if (!plugin.client) return [];
|
|
7961
8204
|
assertClientLifecycle(plugin.client, plugin.name);
|
|
@@ -7971,11 +8214,11 @@ function resolveFarmClientPlugins(plugins, _root) {
|
|
|
7971
8214
|
];
|
|
7972
8215
|
});
|
|
7973
8216
|
}
|
|
7974
|
-
function generateFarmClientPluginEntryCode(plugins, root, srcDir = "src", appPublicData) {
|
|
8217
|
+
function generateFarmClientPluginEntryCode(plugins, root, srcDir = "src", appPublicData, platform = _chunkAQLHD6HZcjs.resolveFarmPlatform.call(void 0, )) {
|
|
7975
8218
|
const resolved = resolveFarmClientPlugins(plugins, root);
|
|
7976
8219
|
const appClientEntry = root ? resolveFarmAppClientEntry(root, srcDir) : void 0;
|
|
7977
8220
|
const appImport = appClientEntry ? `import farmAppClientDefinition from ${JSON.stringify(appClientEntry.replace(/\\/g, "/"))};` : "";
|
|
7978
|
-
const mobileShell =
|
|
8221
|
+
const mobileShell = platform === "mobile";
|
|
7979
8222
|
const imports = mobileShell ? [MOBILE_SHELL_CLIENT_IMPORT, appImport].filter(Boolean).join("\n") : appImport;
|
|
7980
8223
|
const serializedPlugins = mobileShell ? [MOBILE_SHELL_CLIENT_REGISTRATION] : [];
|
|
7981
8224
|
serializedPlugins.push(
|
|
@@ -8037,7 +8280,7 @@ function assertLifecycleObject(value, pluginName, location, allowedKeys) {
|
|
|
8037
8280
|
throw new TypeError(`Client plugin "${pluginName}" has an unknown ${location}.${key} option`);
|
|
8038
8281
|
}
|
|
8039
8282
|
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
8040
|
-
if (!_optionalChain([descriptor, 'optionalAccess',
|
|
8283
|
+
if (!_optionalChain([descriptor, 'optionalAccess', _371 => _371.enumerable])) {
|
|
8041
8284
|
throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} must be enumerable`);
|
|
8042
8285
|
}
|
|
8043
8286
|
if (!("value" in descriptor)) {
|
|
@@ -8155,7 +8398,7 @@ function assertPublicData(value, pluginName) {
|
|
|
8155
8398
|
throwPublicDataError(pluginName, pathSegments, "cannot contain symbol keys");
|
|
8156
8399
|
}
|
|
8157
8400
|
const descriptor = Object.getOwnPropertyDescriptor(current, key);
|
|
8158
|
-
if (!_optionalChain([descriptor, 'optionalAccess',
|
|
8401
|
+
if (!_optionalChain([descriptor, 'optionalAccess', _372 => _372.enumerable])) {
|
|
8159
8402
|
throwPublicDataError(
|
|
8160
8403
|
pluginName,
|
|
8161
8404
|
[...pathSegments, key],
|
|
@@ -8196,15 +8439,15 @@ function isArrayIndex(key) {
|
|
|
8196
8439
|
|
|
8197
8440
|
var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
8198
8441
|
function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
8199
|
-
const client = _optionalChain([cache2, 'optionalAccess',
|
|
8200
|
-
const adapter = _optionalChain([client, 'optionalAccess',
|
|
8442
|
+
const client = _optionalChain([cache2, 'optionalAccess', _373 => _373.client]);
|
|
8443
|
+
const adapter = _optionalChain([client, 'optionalAccess', _374 => _374.adapter]);
|
|
8201
8444
|
if (adapter === void 0) return void 0;
|
|
8202
8445
|
if (typeof adapter !== "string" || adapter.trim().length === 0) {
|
|
8203
8446
|
throw new Error(
|
|
8204
8447
|
'cache.client.adapter must be a module path string, for example "./src/cache-adapter".'
|
|
8205
8448
|
);
|
|
8206
8449
|
}
|
|
8207
|
-
const resolved =
|
|
8450
|
+
const resolved = path5.default.resolve(root, adapter);
|
|
8208
8451
|
const found = resolveAdapterFile(resolved);
|
|
8209
8452
|
if (!found) {
|
|
8210
8453
|
throw new Error(
|
|
@@ -8212,15 +8455,15 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
|
8212
8455
|
);
|
|
8213
8456
|
}
|
|
8214
8457
|
const options = {};
|
|
8215
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
8216
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
8458
|
+
if (_optionalChain([client, 'optionalAccess', _375 => _375.version]) !== void 0) options.version = client.version;
|
|
8459
|
+
if (_optionalChain([client, 'optionalAccess', _376 => _376.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
|
|
8217
8460
|
return { importPath: found.replace(/\\/g, "/"), options };
|
|
8218
8461
|
}
|
|
8219
8462
|
function resolveAdapterFile(resolved) {
|
|
8220
|
-
if (
|
|
8463
|
+
if (fs3.default.existsSync(resolved) && fs3.default.statSync(resolved).isFile()) return resolved;
|
|
8221
8464
|
for (const extension of ADAPTER_EXTENSIONS) {
|
|
8222
8465
|
const candidate = `${resolved}.${extension}`;
|
|
8223
|
-
if (
|
|
8466
|
+
if (fs3.default.existsSync(candidate) && fs3.default.statSync(candidate).isFile()) return candidate;
|
|
8224
8467
|
}
|
|
8225
8468
|
return void 0;
|
|
8226
8469
|
}
|
|
@@ -8399,7 +8642,7 @@ function redactFarmDocsClientConfig(code, filename) {
|
|
|
8399
8642
|
_nullishCoalesce(parseAst2, () => ( (parseAst2 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
|
|
8400
8643
|
"rolldown/parseAst"
|
|
8401
8644
|
).parseAst)));
|
|
8402
|
-
const extension =
|
|
8645
|
+
const extension = path5.default.extname(filename);
|
|
8403
8646
|
const program = parseAst2(code, {
|
|
8404
8647
|
lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
|
|
8405
8648
|
});
|
|
@@ -8413,7 +8656,7 @@ function redactFarmDocsClientConfig(code, filename) {
|
|
|
8413
8656
|
const current = node;
|
|
8414
8657
|
if (current.type === "Property") {
|
|
8415
8658
|
const name = propertyKeyName(current);
|
|
8416
|
-
const valueType = _optionalChain([current, 'access',
|
|
8659
|
+
const valueType = _optionalChain([current, 'access', _377 => _377.value, 'optionalAccess', _378 => _378.type]);
|
|
8417
8660
|
const credential = name !== void 0 && (name.toLowerCase() === "headers" || _chunkSM2SYWARcjs.isSecretDocsConfigKey.call(void 0, name) && valueType !== "ObjectExpression" && valueType !== "ArrayExpression");
|
|
8418
8661
|
if (name && credential) {
|
|
8419
8662
|
edits.push(
|
|
@@ -8444,7 +8687,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
|
|
|
8444
8687
|
if (file === configModule) return true;
|
|
8445
8688
|
try {
|
|
8446
8689
|
return file === _fs.realpathSync.call(void 0, configModule).replace(/\\/g, "/");
|
|
8447
|
-
} catch (
|
|
8690
|
+
} catch (e29) {
|
|
8448
8691
|
return false;
|
|
8449
8692
|
}
|
|
8450
8693
|
}
|
|
@@ -8453,7 +8696,7 @@ function farmDocsClientConfigPlugin(configModule) {
|
|
|
8453
8696
|
name: "farm:docs-client-config",
|
|
8454
8697
|
enforce: "pre",
|
|
8455
8698
|
transform(code, id, options) {
|
|
8456
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
8699
|
+
if (_optionalChain([options, 'optionalAccess', _379 => _379.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
|
|
8457
8700
|
const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
|
|
8458
8701
|
return redacted === null ? null : { code: redacted, map: null };
|
|
8459
8702
|
}
|
|
@@ -8484,13 +8727,13 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
|
8484
8727
|
];
|
|
8485
8728
|
function getFarmClientOptimizeDepsInclude(renderer) {
|
|
8486
8729
|
return Array.from(
|
|
8487
|
-
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess',
|
|
8730
|
+
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _380 => _380.optimizeDeps]) || []])
|
|
8488
8731
|
);
|
|
8489
8732
|
}
|
|
8490
8733
|
function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
|
|
8491
|
-
const resolvedProjectRoot =
|
|
8734
|
+
const resolvedProjectRoot = path5.default.resolve(projectRoot);
|
|
8492
8735
|
return appDirectories.map((appDirectory) => {
|
|
8493
|
-
const relativeAppDirectory =
|
|
8736
|
+
const relativeAppDirectory = path5.default.relative(resolvedProjectRoot, path5.default.resolve(appDirectory)).replace(/\\/g, "/");
|
|
8494
8737
|
const prefix = relativeAppDirectory || ".";
|
|
8495
8738
|
return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
|
|
8496
8739
|
});
|
|
@@ -8507,12 +8750,12 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
|
|
|
8507
8750
|
// Farm's HTML boots through a virtual module and imports route UI lazily.
|
|
8508
8751
|
// Explicit entries let Vite finish that crawl before a navigation can
|
|
8509
8752
|
// rotate the optimizer hash underneath a hydrated React runtime.
|
|
8510
|
-
..._optionalChain([entries, 'optionalAccess',
|
|
8753
|
+
..._optionalChain([entries, 'optionalAccess', _381 => _381.length]) ? { entries: [...entries] } : {}
|
|
8511
8754
|
};
|
|
8512
8755
|
}
|
|
8513
8756
|
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
8514
8757
|
return {
|
|
8515
|
-
"@":
|
|
8758
|
+
"@": path5.default.resolve(projectRoot, srcDir)
|
|
8516
8759
|
};
|
|
8517
8760
|
}
|
|
8518
8761
|
function mergeNoExternal(farmValue, userValue) {
|
|
@@ -8533,8 +8776,8 @@ function mergeAlias(farmValue, userValue) {
|
|
|
8533
8776
|
return [...normalize(userValue), ...normalize(farmValue)];
|
|
8534
8777
|
}
|
|
8535
8778
|
function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
8536
|
-
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
8537
|
-
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
8779
|
+
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _382 => _382.optimizeDeps, 'optionalAccess', _383 => _383.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _384 => _384.optimizeDeps, 'optionalAccess', _385 => _385.noDiscovery])));
|
|
8780
|
+
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _386 => _386.optimizeDeps, 'optionalAccess', _387 => _387.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _388 => _388.optimizeDeps, 'optionalAccess', _389 => _389.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _390 => _390.optimizeDeps, 'optionalAccess', _391 => _391.holdUntilCrawlEnd]))));
|
|
8538
8781
|
return {
|
|
8539
8782
|
...farmConfig,
|
|
8540
8783
|
...userConfig,
|
|
@@ -8546,9 +8789,9 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
8546
8789
|
resolve: {
|
|
8547
8790
|
...farmConfig.resolve,
|
|
8548
8791
|
...userConfig.resolve,
|
|
8549
|
-
alias: mergeAlias(_optionalChain([farmConfig, 'access',
|
|
8792
|
+
alias: mergeAlias(_optionalChain([farmConfig, 'access', _392 => _392.resolve, 'optionalAccess', _393 => _393.alias]), _optionalChain([userConfig, 'access', _394 => _394.resolve, 'optionalAccess', _395 => _395.alias])),
|
|
8550
8793
|
dedupe: Array.from(
|
|
8551
|
-
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access',
|
|
8794
|
+
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _396 => _396.resolve, 'optionalAccess', _397 => _397.dedupe]) || [], ..._optionalChain([userConfig, 'access', _398 => _398.resolve, 'optionalAccess', _399 => _399.dedupe]) || []])
|
|
8552
8795
|
)
|
|
8553
8796
|
},
|
|
8554
8797
|
optimizeDeps: {
|
|
@@ -8558,21 +8801,21 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
8558
8801
|
holdUntilCrawlEnd,
|
|
8559
8802
|
include: Array.from(
|
|
8560
8803
|
/* @__PURE__ */ new Set([
|
|
8561
|
-
..._optionalChain([farmConfig, 'access',
|
|
8562
|
-
..._optionalChain([userConfig, 'access',
|
|
8804
|
+
..._optionalChain([farmConfig, 'access', _400 => _400.optimizeDeps, 'optionalAccess', _401 => _401.include]) || [],
|
|
8805
|
+
..._optionalChain([userConfig, 'access', _402 => _402.optimizeDeps, 'optionalAccess', _403 => _403.include]) || []
|
|
8563
8806
|
])
|
|
8564
8807
|
),
|
|
8565
8808
|
exclude: Array.from(
|
|
8566
8809
|
/* @__PURE__ */ new Set([
|
|
8567
|
-
..._optionalChain([farmConfig, 'access',
|
|
8568
|
-
..._optionalChain([userConfig, 'access',
|
|
8810
|
+
..._optionalChain([farmConfig, 'access', _404 => _404.optimizeDeps, 'optionalAccess', _405 => _405.exclude]) || [],
|
|
8811
|
+
..._optionalChain([userConfig, 'access', _406 => _406.optimizeDeps, 'optionalAccess', _407 => _407.exclude]) || []
|
|
8569
8812
|
])
|
|
8570
8813
|
)
|
|
8571
8814
|
},
|
|
8572
8815
|
ssr: {
|
|
8573
8816
|
...farmConfig.ssr,
|
|
8574
8817
|
...userConfig.ssr,
|
|
8575
|
-
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access',
|
|
8818
|
+
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _408 => _408.ssr, 'optionalAccess', _409 => _409.noExternal]), _optionalChain([userConfig, 'access', _410 => _410.ssr, 'optionalAccess', _411 => _411.noExternal]))
|
|
8576
8819
|
}
|
|
8577
8820
|
};
|
|
8578
8821
|
}
|
|
@@ -8624,7 +8867,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
|
|
|
8624
8867
|
...farmConfig.build,
|
|
8625
8868
|
rollupOptions: {
|
|
8626
8869
|
...userBundlerOptions,
|
|
8627
|
-
..._optionalChain([farmConfig, 'access',
|
|
8870
|
+
..._optionalChain([farmConfig, 'access', _412 => _412.build, 'optionalAccess', _413 => _413.rollupOptions])
|
|
8628
8871
|
}
|
|
8629
8872
|
},
|
|
8630
8873
|
css: farmConfig.css || userCss ? { ...farmConfig.css, ...userCss } : void 0,
|
|
@@ -8632,7 +8875,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
|
|
|
8632
8875
|
esbuild: typeof userEsbuild === "object" && farmConfig.esbuild !== false ? { ...userEsbuild, ...farmConfig.esbuild } : _nullishCoalesce(farmConfig.esbuild, () => ( userEsbuild)),
|
|
8633
8876
|
ssr: {
|
|
8634
8877
|
...merged.ssr,
|
|
8635
|
-
external: mergeExternal(_optionalChain([farmConfig, 'access',
|
|
8878
|
+
external: mergeExternal(_optionalChain([farmConfig, 'access', _414 => _414.ssr, 'optionalAccess', _415 => _415.external]), _optionalChain([userConfig, 'access', _416 => _416.ssr, 'optionalAccess', _417 => _417.external]))
|
|
8636
8879
|
}
|
|
8637
8880
|
};
|
|
8638
8881
|
}
|
|
@@ -8703,4 +8946,6 @@ ${FARM_DARK_VARIANT}
|
|
|
8703
8946
|
|
|
8704
8947
|
|
|
8705
8948
|
|
|
8706
|
-
|
|
8949
|
+
|
|
8950
|
+
|
|
8951
|
+
exports.withPackageClientBoundaryCache = withPackageClientBoundaryCache; exports.usePackageClientBoundaryCacheFile = usePackageClientBoundaryCacheFile; exports.resolveModuleSourcePath = resolveModuleSourcePath; exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.hasUseClientDirective = hasUseClientDirective; exports.getIslandStrategyExport = getIslandStrategyExport; exports.stripUseClientDirective = stripUseClientDirective; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.RouteManager = RouteManager; exports.resolveDevGlobalStylesheetHref = resolveDevGlobalStylesheetHref; 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.SHARP_INSTALL_HINT = SHARP_INSTALL_HINT; exports.resolveFarmImageProviderForRuntime = resolveFarmImageProviderForRuntime; exports.resolveFarmImageServerRuntime = resolveFarmImageServerRuntime; exports.resolveFarmAppPackages = resolveFarmAppPackages; exports.collectFarmWebMCPTools = collectFarmWebMCPTools; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE = FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE; exports.redactFarmDocsClientConfig = redactFarmDocsClientConfig; exports.isFarmDocsClientConfigModule = isFarmDocsClientConfigModule; exports.farmDocsClientConfigPlugin = farmDocsClientConfigPlugin; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin;
|