@farm.js/core 0.1.60 → 0.1.62
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.d-C-2S9bnP.d.mts → agent-mcp.d-BKZ3UNbt.d.mts} +1 -1
- package/dist/{agent-mcp.d-SIoCUP1I.d.ts → agent-mcp.d-C1zr_nGS.d.ts} +1 -1
- package/dist/agent-runtime.cjs +3 -3
- package/dist/agent-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/agent-runtime.mjs +2 -2
- package/dist/analyzer-2AHWJJR7.cjs +15 -0
- package/dist/analyzer-YESYU3GK.mjs +15 -0
- package/dist/api/route-manager.cjs +4 -4
- package/dist/api/route-manager.d.mts +4 -4
- package/dist/api/route-manager.d.ts +4 -4
- package/dist/api/route-manager.mjs +3 -3
- package/dist/api/runtime.cjs +3 -3
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api/runtime.mjs +2 -2
- package/dist/api.cjs +5 -5
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/api.mjs +4 -4
- package/dist/{app-manifest.d-DrSAHskY.d.mts → app-manifest.d-BpvhfKRH.d.mts} +1 -1
- package/dist/{app-manifest.d-Tb3CJpL4.d.ts → app-manifest.d-ntch_bvA.d.ts} +1 -1
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/{app.d-CmWlYpZJ.d.ts → app.d-AE8_v3Db.d.ts} +4 -10
- package/dist/{app.d-D6QQM_kk.d.mts → app.d-CysWA_8v.d.mts} +4 -10
- package/dist/{chunk-FORSVMEJ.mjs → chunk-2CNKQC3G.mjs} +1 -1
- package/dist/{chunk-ZFUKPWFC.mjs → chunk-2JYBLE63.mjs} +416 -208
- package/dist/{chunk-QRX4JRBO.cjs → chunk-3CCAICF7.cjs} +5 -5
- package/dist/{chunk-ANHZ6SUL.mjs → chunk-3TXKFRSO.mjs} +1 -1
- package/dist/{chunk-BHJAYPYU.mjs → chunk-3UZVPO72.mjs} +1 -1
- package/dist/{chunk-6UUH4N4J.mjs → chunk-43V3ANPQ.mjs} +1 -1
- package/dist/chunk-4EBC7EMW.cjs +8 -0
- package/dist/{chunk-VZY7MAVS.cjs → chunk-4IHMHFQB.cjs} +27 -1
- package/dist/{chunk-FK25QSVC.cjs → chunk-4P5634G6.cjs} +2 -2
- package/dist/{chunk-4JTQPOKO.cjs → chunk-53ZCZ46B.cjs} +2 -2
- package/dist/{chunk-NQJDO7K7.cjs → chunk-545WJ5UG.cjs} +321 -37
- package/dist/{chunk-VU3MYZPO.mjs → chunk-5FE5YT2N.mjs} +26 -0
- package/dist/{chunk-A5BJKSZE.cjs → chunk-5IQ2ERQA.cjs} +2 -2
- package/dist/{chunk-SJRCWF4Z.mjs → chunk-5Y22WNTO.mjs} +2 -2
- package/dist/{chunk-U4BJKNIR.cjs → chunk-752XUZIM.cjs} +11 -6
- package/dist/{chunk-JBK7UJOI.cjs → chunk-AJB3DHN6.cjs} +2 -2
- package/dist/{chunk-YB44NKC2.cjs → chunk-AXVRUDMB.cjs} +2 -2
- package/dist/{chunk-LJVNMGE3.mjs → chunk-BM2LH2JM.mjs} +8 -3
- package/dist/{chunk-YI6FKTTN.cjs → chunk-BT4SEFLC.cjs} +261 -38
- package/dist/{chunk-LIFUPCXW.cjs → chunk-CFG4QERR.cjs} +13 -2
- package/dist/{chunk-3OWVWZ6R.cjs → chunk-CLFEQGET.cjs} +6 -6
- package/dist/{chunk-OZK2DS44.mjs → chunk-CROAFCMW.mjs} +1 -1
- package/dist/{chunk-2KTYMMWT.mjs → chunk-DPE53XWL.mjs} +1 -1
- package/dist/{chunk-3PX4AIXO.mjs → chunk-DQF3QLOH.mjs} +258 -35
- package/dist/{chunk-FSQMN2MQ.mjs → chunk-E46NXBNJ.mjs} +1 -1
- package/dist/{chunk-EGVC4LIG.mjs → chunk-E4RDMG3K.mjs} +1 -1
- package/dist/{chunk-X2CZTWQA.mjs → chunk-ECKQFEX2.mjs} +1 -1
- package/dist/{chunk-MTWXOEI4.cjs → chunk-EXXFSZOC.cjs} +246 -193
- package/dist/{chunk-UYSTTPYJ.cjs → chunk-GGNJAGGE.cjs} +643 -435
- package/dist/{chunk-XTG73QZA.cjs → chunk-GVOMPU3Y.cjs} +12 -8
- package/dist/{chunk-ZP32GNJQ.cjs → chunk-I32V5CZL.cjs} +14 -13
- package/dist/{chunk-37PYUEK5.mjs → chunk-IOF4KXMP.mjs} +7 -3
- package/dist/{chunk-ILMTRGBG.mjs → chunk-IQIKPKFP.mjs} +157 -45
- package/dist/{chunk-5JNUYGNF.cjs → chunk-IWRLV46X.cjs} +2 -2
- package/dist/{chunk-KPOMS5RO.cjs → chunk-J3GFOQOL.cjs} +3 -3
- package/dist/{chunk-NHD7BAKD.mjs → chunk-JCEFKP5M.mjs} +41 -25
- package/dist/{analyzer-LCSI3NSH.cjs → chunk-JEJQGZI7.cjs} +16 -13
- package/dist/{chunk-LB3DPQP6.cjs → chunk-JLDNXURZ.cjs} +23 -23
- package/dist/{chunk-VGG74PSU.cjs → chunk-L2JG337G.cjs} +2 -2
- package/dist/chunk-L4RTTTVE.mjs +8 -0
- package/dist/chunk-LEJDW34D.cjs +115 -0
- package/dist/{analyzer-22BEYV7S.mjs → chunk-LVWGURLD.mjs} +6 -3
- package/dist/{chunk-Z5A6CNV2.mjs → chunk-MK5E44WP.mjs} +1 -1
- package/dist/{chunk-T4EW7AAD.mjs → chunk-NKRZLQUK.mjs} +2 -2
- package/dist/{chunk-HPWB57PZ.mjs → chunk-NT3QDN2E.mjs} +1 -1
- package/dist/{chunk-T7I62A4C.mjs → chunk-OUWRNHTV.mjs} +81 -28
- package/dist/{chunk-GFT5AHAT.mjs → chunk-QDWMCFTH.mjs} +12 -1
- package/dist/{chunk-AER5I65K.mjs → chunk-QTD6EMN2.mjs} +1 -1
- package/dist/{chunk-UDJY2ZGY.cjs → chunk-RMUD75WT.cjs} +413 -301
- package/dist/chunk-RZNCMRD3.mjs +141 -0
- package/dist/{chunk-D7LTCK3U.mjs → chunk-SA7MLSP4.mjs} +11 -6
- package/dist/{chunk-2FRLSDBT.cjs → chunk-SM25ZC4S.cjs} +1 -1
- package/dist/{chunk-3YMLUNL2.cjs → chunk-SVXOCTQ2.cjs} +1 -1
- package/dist/{chunk-W2RZ73IU.cjs → chunk-SYXPWJ7N.cjs} +8 -8
- package/dist/{chunk-F6Y7ZAPQ.mjs → chunk-T46NNU4D.mjs} +6 -3
- package/dist/{chunk-IFHPDLIS.mjs → chunk-TGULJSHD.mjs} +5 -4
- package/dist/{chunk-JPIUGDK4.mjs → chunk-TZVUF5JJ.mjs} +1 -1
- package/dist/chunk-UWI3SJAK.cjs +141 -0
- package/dist/{chunk-JI5D7MXY.mjs → chunk-UYRI6U3P.mjs} +1 -1
- package/dist/{chunk-D2X5MUF5.cjs → chunk-V727H3RI.cjs} +47 -31
- package/dist/{chunk-ZMHAFH4R.mjs → chunk-VM7X5CKC.mjs} +2 -2
- package/dist/{chunk-VPTWKOCY.mjs → chunk-VWW4Q3BJ.mjs} +287 -6
- package/dist/{chunk-4P23B7DU.cjs → chunk-WKJQ2FJA.cjs} +3 -3
- package/dist/{chunk-HASX6DC7.cjs → chunk-WKPBIT5Q.cjs} +8 -8
- package/dist/{chunk-RAWWCDCT.cjs → chunk-WYAXRIYP.cjs} +3 -3
- package/dist/{chunk-3TL3AH25.cjs → chunk-X4K7TYN6.cjs} +12 -7
- package/dist/chunk-XCXHQBMM.mjs +115 -0
- package/dist/{chunk-DPJ66FSI.cjs → chunk-XX32BOMM.cjs} +7 -7
- package/dist/{chunk-2IAPKPEB.cjs → chunk-YN6BHOYY.cjs} +6 -6
- package/dist/{chunk-CBKRS3M4.cjs → chunk-Z7P2BTZ3.cjs} +7 -6
- package/dist/{chunk-SX7EECTS.mjs → chunk-ZBUAOGMY.mjs} +1 -1
- package/dist/{chunk-RPUJHJHE.mjs → chunk-ZFWYCVKS.mjs} +4 -3
- package/dist/{chunk-IFXSBJPN.cjs → chunk-ZVIEFTUA.cjs} +20 -17
- package/dist/{chunk-EXUONJYV.mjs → chunk-ZZI56IUY.mjs} +3 -3
- package/dist/{programmatic-routes-client.d-CLG2N1yH.d.ts → client-component.d-Bgt3x5Fu.d.ts} +18 -3
- package/dist/{programmatic-routes-client.d-CPbNqtIi.d.mts → client-component.d-BoqC2MLC.d.mts} +18 -3
- package/dist/{client-plugins.d-vXrbcfJ1.d.ts → client-plugins.d-BcqIy4au.d.ts} +1 -1
- package/dist/{client-plugins.d-CgQQ-EAv.d.mts → client-plugins.d-CWyYBxXf.d.mts} +1 -1
- 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-DqZkLwef.d.ts → config.d-qt-mE8O5.d.mts} +6 -2
- package/dist/{config.d-DqZkLwef.d.mts → config.d-qt-mE8O5.d.ts} +6 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/cron.cjs +12 -2
- package/dist/cron.d.mts +101 -3
- package/dist/cron.d.ts +101 -3
- package/dist/cron.mjs +11 -1
- package/dist/desktop.d.mts +3 -3
- package/dist/desktop.d.ts +3 -3
- package/dist/{devtools-KQZ6SRCJ.mjs → devtools-NUVXYG7I.mjs} +6 -6
- package/dist/{devtools-UF6JYHUN.cjs → devtools-SVRSGPNC.cjs} +8 -8
- package/dist/docs.cjs +9 -9
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +8 -8
- package/dist/image/server.cjs +3 -3
- package/dist/image/server.mjs +2 -2
- package/dist/image/sharp.cjs +10 -10
- package/dist/image/sharp.mjs +2 -2
- package/dist/index.cjs +42 -27
- package/dist/{index.d-Dmfb7Kb_.d.mts → index.d-BDaiu2i5.d.mts} +1 -1
- package/dist/{index.d-DlCELfhf.d.ts → index.d-nAncqTXz.d.ts} +1 -1
- package/dist/index.d.mts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.mjs +42 -27
- package/dist/integrations.cjs +3 -3
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/integrations.mjs +2 -2
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.cjs +27 -22
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +26 -21
- package/dist/internal/cli-runtime.cjs +12 -11
- package/dist/internal/cli-runtime.mjs +11 -10
- 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 +8 -8
- package/dist/internal/config-runtime.d.mts +5 -5
- package/dist/internal/config-runtime.d.ts +5 -5
- package/dist/internal/config-runtime.mjs +7 -7
- package/dist/internal/form-actions.cjs +4 -4
- package/dist/internal/form-actions.mjs +3 -3
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/metadata-image-runtime.cjs +3 -3
- package/dist/internal/metadata-image-runtime.mjs +2 -2
- package/dist/internal/native-server-fns.cjs +25 -0
- package/dist/internal/native-server-fns.d.mts +42 -0
- package/dist/internal/native-server-fns.d.ts +42 -0
- package/dist/internal/native-server-fns.mjs +25 -0
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-node-env.cjs +2 -2
- package/dist/internal/production-node-env.mjs +1 -1
- package/dist/internal/production-runtime.cjs +16 -10
- package/dist/internal/production-runtime.d.mts +39 -12
- package/dist/internal/production-runtime.d.ts +39 -12
- package/dist/internal/production-runtime.mjs +15 -9
- package/dist/internal/react-cache.cjs +51 -0
- package/dist/internal/react-cache.d.mts +3 -0
- package/dist/internal/react-cache.d.ts +3 -0
- package/dist/internal/react-cache.mjs +51 -0
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/middleware.cjs +3 -3
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/middleware.mjs +2 -2
- package/dist/mobile.d.mts +10 -4
- package/dist/mobile.d.ts +10 -4
- package/dist/{modules-VHD7BELU.mjs → modules-KOKD4XS6.mjs} +2 -2
- package/dist/modules-QTP7WJPD.cjs +13 -0
- package/dist/native-server-fn-handler-GLRHAYWV.mjs +28 -0
- package/dist/native-server-fn-handler-J5MYRXN6.cjs +28 -0
- package/dist/native-specs-5OLED4MM.cjs +15 -0
- package/dist/{native-specs-BD7HOTMJ.mjs → native-specs-LDV6IZ4N.mjs} +1 -1
- package/dist/{native-tree-VWNW2MQ2.mjs → native-tree-AS5L3ID3.mjs} +2 -2
- package/dist/{native-tree-6G5O53O3.cjs → native-tree-Z2WYUJEV.cjs} +3 -3
- package/dist/native.cjs +1 -1
- package/dist/native.d.mts +5 -5
- package/dist/native.d.ts +5 -5
- package/dist/native.mjs +1 -1
- package/dist/{navigation-delegate.d-JXx40JzR.d.ts → navigation-delegate.d-BbUHRXxG.d.ts} +1 -1
- package/dist/{navigation-delegate.d-CnOTWOyi.d.mts → navigation-delegate.d-CSCm8ZxL.d.mts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/{nitro-FLN6DRGJ.mjs → nitro-DD4QCA66.mjs} +5 -5
- package/dist/{nitro-HXAZZQKY.cjs → nitro-VRDX2H4M.cjs} +8 -8
- package/dist/plugin.cjs +19 -18
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +18 -17
- package/dist/{port-WOOQ3V56.mjs → port-UFUZL6RI.mjs} +2 -2
- package/dist/{port-C6GBH4C6.cjs → port-VTLHPZOI.cjs} +10 -10
- package/dist/{production-runtime.d-CP5s6RuY.d.mts → production-runtime.d-CcQiDko5.d.mts} +1 -1
- package/dist/{production-runtime.d-N-cE3pmy.d.ts → production-runtime.d-DgT24A0f.d.ts} +1 -1
- package/dist/{render-plan.d-DZ-qjjdG.d.mts → render-plan.d-BH9WF-JZ.d.mts} +1 -1
- package/dist/{render-plan.d-B9lAP3uX.d.ts → render-plan.d-CyrX6MDs.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/{request.d-BiicaNxb.d.ts → request.d-BB8M8bcD.d.ts} +1 -1
- package/dist/{request.d-DV0oeUit.d.mts → request.d-CUrPnCW7.d.mts} +1 -1
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/{route-rendering.d-BrIKA51A.d.mts → route-rendering.d-CYxlzaFm.d.mts} +1 -1
- package/dist/{route-rendering.d-Iss0C7GR.d.ts → route-rendering.d-DYqZMIf4.d.ts} +1 -1
- package/dist/{router.d-mNTbOGV_.d.mts → router.d-7o24CD8u.d.mts} +1 -1
- package/dist/{router.d-DjGn_al7.d.ts → router.d-DaKo507j.d.ts} +1 -1
- package/dist/{routes.d-BKSjHuH9.d.ts → routes.d-BknKQcTu.d.ts} +7 -1
- package/dist/{routes.d-qd8Qf4LG.d.mts → routes.d-D1IrO9KK.d.mts} +7 -1
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/{rsc-pipeline-SVLBTY7H.cjs → rsc-pipeline-OF2I7PCX.cjs} +8 -8
- package/dist/{rsc-pipeline-WBLBDQXA.mjs → rsc-pipeline-RFLHDAKD.mjs} +7 -7
- package/dist/{runtime-DGUOWSMF.cjs → runtime-LBTK62AD.cjs} +70 -47
- package/dist/{runtime-HFZTVNFF.mjs → runtime-M6UJCSLA.mjs} +38 -15
- package/dist/{runtime.d-Bm_4hP5T.d.ts → runtime.d-CN73a-IL.d.ts} +1 -1
- package/dist/{runtime.d-BNVbojF1.d.mts → runtime.d-CcNuzhX6.d.mts} +1 -1
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +4 -4
- package/dist/server-fn.mjs +3 -3
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server-query.cjs +5 -5
- package/dist/server-query.mjs +4 -4
- package/dist/server.cjs +38 -37
- package/dist/server.d.mts +10 -10
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +23 -22
- package/dist/{spa-router.d-DHDoXxDE.d.mts → spa-router.d-CNi77LZm.d.mts} +2 -2
- package/dist/{spa-router.d-DAtnNoBe.d.ts → spa-router.d-Cvgf5QP4.d.ts} +2 -2
- package/dist/testing.cjs +6 -6
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.mjs +4 -4
- package/dist/{utils.d-DwZ-KLSB.d.ts → utils.d-C3H-14_Y.d.ts} +1 -1
- package/dist/{utils.d-uKZcKJk4.d.mts → utils.d-D8VfzZYn.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +21 -18
- package/dist/vite.d.mts +5 -5
- package/dist/vite.d.ts +5 -5
- package/dist/vite.mjs +20 -17
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.mjs +2 -2
- package/package.json +12 -2
- package/dist/modules-WT5D3AWY.cjs +0 -13
- package/dist/native-specs-IQQRJOOW.cjs +0 -15
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunkAXVRUDMBcjs = require('./chunk-AXVRUDMB.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
|
|
8
|
-
var
|
|
11
|
+
var _chunkX4K7TYN6cjs = require('./chunk-X4K7TYN6.cjs');
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -35,10 +38,10 @@ var _chunk3TL3AH25cjs = require('./chunk-3TL3AH25.cjs');
|
|
|
35
38
|
var _chunkO27PLNQZcjs = require('./chunk-O27PLNQZ.cjs');
|
|
36
39
|
|
|
37
40
|
|
|
38
|
-
var
|
|
41
|
+
var _chunkCLFEQGETcjs = require('./chunk-CLFEQGET.cjs');
|
|
39
42
|
|
|
40
43
|
|
|
41
|
-
var
|
|
44
|
+
var _chunkXX32BOMMcjs = require('./chunk-XX32BOMM.cjs');
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
|
|
@@ -49,9 +52,6 @@ var _chunkDPJ66FSIcjs = require('./chunk-DPJ66FSI.cjs');
|
|
|
49
52
|
var _chunkQAS7KE7Jcjs = require('./chunk-QAS7KE7J.cjs');
|
|
50
53
|
|
|
51
54
|
|
|
52
|
-
var _chunkYB44NKC2cjs = require('./chunk-YB44NKC2.cjs');
|
|
53
|
-
|
|
54
|
-
|
|
55
55
|
|
|
56
56
|
var _chunkXGJVRPYLcjs = require('./chunk-XGJVRPYL.cjs');
|
|
57
57
|
|
|
@@ -141,13 +141,13 @@ var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
|
|
|
141
141
|
var _chunkLT4VAF5Zcjs = require('./chunk-LT4VAF5Z.cjs');
|
|
142
142
|
|
|
143
143
|
|
|
144
|
-
var
|
|
144
|
+
var _chunk3CCAICF7cjs = require('./chunk-3CCAICF7.cjs');
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
var
|
|
147
|
+
var _chunkBT4SEFLCcjs = require('./chunk-BT4SEFLC.cjs');
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
var
|
|
150
|
+
var _chunk4P5634G6cjs = require('./chunk-4P5634G6.cjs');
|
|
151
151
|
|
|
152
152
|
|
|
153
153
|
|
|
@@ -166,7 +166,7 @@ var _chunkX333W5KVcjs = require('./chunk-X333W5KV.cjs');
|
|
|
166
166
|
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
var
|
|
169
|
+
var _chunkI32V5CZLcjs = require('./chunk-I32V5CZL.cjs');
|
|
170
170
|
|
|
171
171
|
|
|
172
172
|
|
|
@@ -250,13 +250,13 @@ var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
|
250
250
|
|
|
251
251
|
|
|
252
252
|
|
|
253
|
-
var
|
|
253
|
+
var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
|
|
254
254
|
|
|
255
255
|
|
|
256
256
|
var _chunkJYT7AN37cjs = require('./chunk-JYT7AN37.cjs');
|
|
257
257
|
|
|
258
258
|
|
|
259
|
-
var
|
|
259
|
+
var _chunkSM25ZC4Scjs = require('./chunk-SM25ZC4S.cjs');
|
|
260
260
|
|
|
261
261
|
|
|
262
262
|
|
|
@@ -330,9 +330,149 @@ var _chunkYTVSWXEZcjs = require('./chunk-YTVSWXEZ.cjs');
|
|
|
330
330
|
|
|
331
331
|
var _chunkBTZ5O6VMcjs = require('./chunk-BTZ5O6VM.cjs');
|
|
332
332
|
|
|
333
|
+
// src/islands-package-references.ts
|
|
334
|
+
var _fs = require('fs'); var fs4 = _interopRequireWildcard(_fs); var fs9 = _interopRequireWildcard(_fs); var fs8 = _interopRequireWildcard(_fs);
|
|
335
|
+
var _path = require('path'); var path6 = _interopRequireWildcard(_path); var path13 = _interopRequireWildcard(_path); var path12 = _interopRequireWildcard(_path);
|
|
336
|
+
var _parseAst = require('rolldown/parseAst');
|
|
337
|
+
var IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
338
|
+
function parse(code, file) {
|
|
339
|
+
const extension = path6.default.extname(file).slice(1);
|
|
340
|
+
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
|
|
341
|
+
try {
|
|
342
|
+
return _parseAst.parseAst.call(void 0, code, { lang });
|
|
343
|
+
} catch (e) {
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function walk(node, visit, parent = null) {
|
|
348
|
+
if (!node || typeof node !== "object") return;
|
|
349
|
+
if (Array.isArray(node)) {
|
|
350
|
+
for (const child of node) walk(child, visit, parent);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const current = node;
|
|
354
|
+
if (typeof current.type !== "string") return;
|
|
355
|
+
visit(current, parent);
|
|
356
|
+
for (const [key, value] of Object.entries(current)) {
|
|
357
|
+
if (key === "start" || key === "end" || key === "loc" || key === "range") continue;
|
|
358
|
+
if (value && typeof value === "object") walk(value, visit, current);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function namespaceMembers(program, local, declaration) {
|
|
362
|
+
const members = /* @__PURE__ */ new Set();
|
|
363
|
+
let opaque = false;
|
|
364
|
+
walk(program, (node, parent) => {
|
|
365
|
+
if (opaque || node === declaration) return;
|
|
366
|
+
const name = node.type === "Identifier" || node.type === "JSXIdentifier" ? node.name : null;
|
|
367
|
+
if (name !== local) return;
|
|
368
|
+
if (_optionalChain([parent, 'optionalAccess', _2 => _2.type]) === "ImportNamespaceSpecifier") return;
|
|
369
|
+
const member = (_optionalChain([parent, 'optionalAccess', _3 => _3.type]) === "MemberExpression" || _optionalChain([parent, 'optionalAccess', _4 => _4.type]) === "JSXMemberExpression") && parent.object === node ? parent.property : null;
|
|
370
|
+
const property2 = member && !parent.computed && (member.type === "Identifier" || member.type === "JSXIdentifier") ? member.name : null;
|
|
371
|
+
if (property2) members.add(property2);
|
|
372
|
+
else opaque = true;
|
|
373
|
+
});
|
|
374
|
+
return opaque ? null : [...members];
|
|
375
|
+
}
|
|
376
|
+
function findFarmPackageClientImports(code, file, isClientPackage) {
|
|
377
|
+
if (!code.includes("import")) return [];
|
|
378
|
+
const program = parse(code, file);
|
|
379
|
+
if (!program) return [];
|
|
380
|
+
const found = [];
|
|
381
|
+
for (const node of _nullishCoalesce(program.body, () => ( []))) {
|
|
382
|
+
if (node.type !== "ImportDeclaration" || node.importKind === "type") continue;
|
|
383
|
+
const specifier = _optionalChain([node, 'access', _5 => _5.source, 'optionalAccess', _6 => _6.value]);
|
|
384
|
+
if (typeof specifier !== "string" || specifier.startsWith(".") || specifier.startsWith("/"))
|
|
385
|
+
continue;
|
|
386
|
+
const specifiers = (_nullishCoalesce(node.specifiers, () => ( []))).filter(
|
|
387
|
+
(entry2) => entry2.importKind !== "type"
|
|
388
|
+
);
|
|
389
|
+
if (specifiers.length === 0 || !isClientPackage(specifier)) continue;
|
|
390
|
+
const entry = {
|
|
391
|
+
start: node.start,
|
|
392
|
+
end: node.end,
|
|
393
|
+
specifier,
|
|
394
|
+
named: []
|
|
395
|
+
};
|
|
396
|
+
let supported = true;
|
|
397
|
+
for (const binding of specifiers) {
|
|
398
|
+
if (binding.type === "ImportDefaultSpecifier") entry.defaultLocal = binding.local.name;
|
|
399
|
+
else if (binding.type === "ImportNamespaceSpecifier") {
|
|
400
|
+
const members = namespaceMembers(program, binding.local.name, node);
|
|
401
|
+
if (!members || members.some((member) => !IDENTIFIER.test(member))) supported = false;
|
|
402
|
+
else entry.namespace = { local: binding.local.name, members };
|
|
403
|
+
} else {
|
|
404
|
+
const imported = _optionalChain([binding, 'access', _7 => _7.imported, 'optionalAccess', _8 => _8.type]) === "Identifier" ? binding.imported.name : _optionalChain([binding, 'access', _9 => _9.imported, 'optionalAccess', _10 => _10.value]);
|
|
405
|
+
if (typeof imported !== "string" || !IDENTIFIER.test(imported)) supported = false;
|
|
406
|
+
else entry.named.push({ imported, local: binding.local.name });
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (supported) found.push(entry);
|
|
410
|
+
}
|
|
411
|
+
return found;
|
|
412
|
+
}
|
|
413
|
+
function farmPackageClientImportExports(entry) {
|
|
414
|
+
return [
|
|
415
|
+
...entry.defaultLocal ? ["default"] : [],
|
|
416
|
+
...entry.named.map((binding) => binding.imported),
|
|
417
|
+
..._nullishCoalesce(_optionalChain([entry, 'access', _11 => _11.namespace, 'optionalAccess', _12 => _12.members]), () => ( []))
|
|
418
|
+
];
|
|
419
|
+
}
|
|
420
|
+
function farmPackageClientReferencePath(root, specifier, exportName) {
|
|
421
|
+
const directory = specifier.replace(/^@/, "").replace(/[^A-Za-z0-9._-]/g, "+");
|
|
422
|
+
return path6.default.join(root, ".farm", "client-references", directory, `${exportName}.tsx`);
|
|
423
|
+
}
|
|
424
|
+
function ensureFarmPackageClientReference(root, specifier, exportName) {
|
|
425
|
+
const file = farmPackageClientReferencePath(root, specifier, exportName);
|
|
426
|
+
const source = [
|
|
427
|
+
`// Generated by Farm: ${specifier}'s ${exportName} export, as a client reference for server components.`,
|
|
428
|
+
'"use client";',
|
|
429
|
+
`export { ${exportName} } from ${JSON.stringify(specifier)};`,
|
|
430
|
+
""
|
|
431
|
+
].join("\n");
|
|
432
|
+
let current = null;
|
|
433
|
+
try {
|
|
434
|
+
current = fs4.default.readFileSync(file, "utf8");
|
|
435
|
+
} catch (e2) {
|
|
436
|
+
}
|
|
437
|
+
if (current !== source) {
|
|
438
|
+
fs4.default.mkdirSync(path6.default.dirname(file), { recursive: true });
|
|
439
|
+
fs4.default.writeFileSync(file, source);
|
|
440
|
+
}
|
|
441
|
+
return file;
|
|
442
|
+
}
|
|
443
|
+
function rewriteFarmPackageClientImports(options) {
|
|
444
|
+
const imports = findFarmPackageClientImports(options.code, options.file, options.isClientPackage);
|
|
445
|
+
if (imports.length === 0) return null;
|
|
446
|
+
const reference = (specifier, exportName) => JSON.stringify(ensureFarmPackageClientReference(options.root, specifier, exportName));
|
|
447
|
+
let output = options.code;
|
|
448
|
+
let next = 0;
|
|
449
|
+
for (const entry of [...imports].sort((left, right) => right.start - left.start)) {
|
|
450
|
+
const lines = [];
|
|
451
|
+
if (entry.defaultLocal) {
|
|
452
|
+
lines.push(`import ${entry.defaultLocal} from ${reference(entry.specifier, "default")};`);
|
|
453
|
+
}
|
|
454
|
+
for (const binding of entry.named) {
|
|
455
|
+
lines.push(
|
|
456
|
+
`import { ${binding.imported} as ${binding.local} } from ${reference(entry.specifier, binding.imported)};`
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
if (entry.namespace) {
|
|
460
|
+
const fields = [];
|
|
461
|
+
for (const member of entry.namespace.members) {
|
|
462
|
+
const local = `__farm_package_reference_${next++}__`;
|
|
463
|
+
lines.push(`import { ${member} as ${local} } from ${reference(entry.specifier, member)};`);
|
|
464
|
+
fields.push(`${member}: ${local}`);
|
|
465
|
+
}
|
|
466
|
+
lines.push(`const ${entry.namespace.local} = Object.freeze({ ${fields.join(", ")} });`);
|
|
467
|
+
}
|
|
468
|
+
output = output.slice(0, entry.start) + lines.join("\n") + output.slice(entry.end);
|
|
469
|
+
}
|
|
470
|
+
return output;
|
|
471
|
+
}
|
|
472
|
+
|
|
333
473
|
// src/utils/client-component.ts
|
|
334
|
-
|
|
335
|
-
|
|
474
|
+
|
|
475
|
+
|
|
336
476
|
var _url = require('url');
|
|
337
477
|
|
|
338
478
|
// src/utils/package-client-boundary-cache.ts
|
|
@@ -340,7 +480,7 @@ var _async_hooks = require('async_hooks');
|
|
|
340
480
|
|
|
341
481
|
|
|
342
482
|
var SCHEMA_VERSION = 1;
|
|
343
|
-
var NODE_MODULES_SEGMENT = `${
|
|
483
|
+
var NODE_MODULES_SEGMENT = `${path6.default.sep}node_modules${path6.default.sep}`;
|
|
344
484
|
var PackageInspectionTrace = class {
|
|
345
485
|
constructor() {
|
|
346
486
|
this.files = /* @__PURE__ */ new Set();
|
|
@@ -350,7 +490,7 @@ var PackageInspectionTrace = class {
|
|
|
350
490
|
}
|
|
351
491
|
visit(file) {
|
|
352
492
|
this.files.add(file);
|
|
353
|
-
const directory =
|
|
493
|
+
const directory = path6.default.dirname(file);
|
|
354
494
|
if (!this.directoryStamps.has(directory)) {
|
|
355
495
|
this.directoryStamps.set(directory, stampPackagePath(directory, "directory"));
|
|
356
496
|
}
|
|
@@ -377,12 +517,12 @@ var PackageInspectionTrace = class {
|
|
|
377
517
|
}
|
|
378
518
|
};
|
|
379
519
|
function stampPackagePath(target, kind) {
|
|
380
|
-
if (!`${target}${
|
|
520
|
+
if (!`${target}${path6.default.sep}`.includes(NODE_MODULES_SEGMENT)) return void 0;
|
|
381
521
|
try {
|
|
382
|
-
const stat =
|
|
522
|
+
const stat = fs4.default.statSync(target, { throwIfNoEntry: false });
|
|
383
523
|
if (!stat || (kind === "file" ? !stat.isFile() : !stat.isDirectory())) return void 0;
|
|
384
524
|
return [target, stat.size, stat.mtimeMs, stat.ctimeMs];
|
|
385
|
-
} catch (
|
|
525
|
+
} catch (e3) {
|
|
386
526
|
return void 0;
|
|
387
527
|
}
|
|
388
528
|
}
|
|
@@ -418,7 +558,7 @@ var PackageClientBoundaryCache = class {
|
|
|
418
558
|
else this.dirty = true;
|
|
419
559
|
}
|
|
420
560
|
}
|
|
421
|
-
return _optionalChain([entries, 'optionalAccess',
|
|
561
|
+
return _optionalChain([entries, 'optionalAccess', _13 => _13.find, 'call', _14 => _14(
|
|
422
562
|
(entry) => entry.stops.every((file) => visited.has(file)) && !entry.files.some((file) => visited.has(file))
|
|
423
563
|
)]);
|
|
424
564
|
}
|
|
@@ -457,17 +597,17 @@ var PackageClientBoundaryCache = class {
|
|
|
457
597
|
}
|
|
458
598
|
const contents = JSON.stringify({
|
|
459
599
|
schema: SCHEMA_VERSION,
|
|
460
|
-
farm:
|
|
600
|
+
farm: _chunkSM25ZC4Scjs.FARM_VERSION,
|
|
461
601
|
paths,
|
|
462
602
|
entries
|
|
463
603
|
});
|
|
464
604
|
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
465
605
|
try {
|
|
466
|
-
await
|
|
467
|
-
await
|
|
468
|
-
await
|
|
469
|
-
} catch (
|
|
470
|
-
await
|
|
606
|
+
await fs4.default.promises.mkdir(path6.default.dirname(file), { recursive: true });
|
|
607
|
+
await fs4.default.promises.writeFile(temporary, contents);
|
|
608
|
+
await fs4.default.promises.rename(temporary, file);
|
|
609
|
+
} catch (e4) {
|
|
610
|
+
await fs4.default.promises.rm(temporary, { force: true }).catch(() => {
|
|
471
611
|
});
|
|
472
612
|
}
|
|
473
613
|
}
|
|
@@ -501,11 +641,11 @@ var PackageClientBoundaryCache = class {
|
|
|
501
641
|
function readStoredCache(file) {
|
|
502
642
|
let value;
|
|
503
643
|
try {
|
|
504
|
-
value = JSON.parse(
|
|
505
|
-
} catch (
|
|
644
|
+
value = JSON.parse(fs4.default.readFileSync(file, "utf8"));
|
|
645
|
+
} catch (e5) {
|
|
506
646
|
return null;
|
|
507
647
|
}
|
|
508
|
-
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !==
|
|
648
|
+
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkSM25ZC4Scjs.FARM_VERSION) {
|
|
509
649
|
return null;
|
|
510
650
|
}
|
|
511
651
|
const { paths, entries } = value;
|
|
@@ -516,13 +656,13 @@ function readStoredCache(file) {
|
|
|
516
656
|
const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
|
|
517
657
|
if (usable.length > 0) valid[key] = usable;
|
|
518
658
|
}
|
|
519
|
-
return { schema: SCHEMA_VERSION, farm:
|
|
659
|
+
return { schema: SCHEMA_VERSION, farm: _chunkSM25ZC4Scjs.FARM_VERSION, paths, entries: valid };
|
|
520
660
|
}
|
|
521
661
|
function isRecord(value) {
|
|
522
662
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
523
663
|
}
|
|
524
664
|
function isPathStamp(value) {
|
|
525
|
-
return Array.isArray(value) && value.length === 4 && typeof value[0] === "string" &&
|
|
665
|
+
return Array.isArray(value) && value.length === 4 && typeof value[0] === "string" && path6.default.isAbsolute(value[0]) && value.slice(1).every((part) => typeof part === "number" && Number.isFinite(part));
|
|
526
666
|
}
|
|
527
667
|
function isPathIndexList(value, pathCount) {
|
|
528
668
|
return Array.isArray(value) && value.length > 0 && value.every((index) => Number.isSafeInteger(index) && index >= 0 && index < pathCount);
|
|
@@ -530,7 +670,7 @@ function isPathIndexList(value, pathCount) {
|
|
|
530
670
|
function isStoredEntry(value, pathCount) {
|
|
531
671
|
if (!isRecord(value) || !isRecord(value.result)) return false;
|
|
532
672
|
const { isClientComponent, shouldHydrate, islandStrategy } = value.result;
|
|
533
|
-
return isPathIndexList(value.files, pathCount) && isPathIndexList(value.directories, pathCount) && Array.isArray(value.stops) && value.stops.every((file) => typeof file === "string" &&
|
|
673
|
+
return isPathIndexList(value.files, pathCount) && isPathIndexList(value.directories, pathCount) && Array.isArray(value.stops) && value.stops.every((file) => typeof file === "string" && path6.default.isAbsolute(file)) && typeof isClientComponent === "boolean" && typeof shouldHydrate === "boolean" && (islandStrategy === null || _chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, islandStrategy)) && Object.keys(value.result).length === 3;
|
|
534
674
|
}
|
|
535
675
|
var STORAGE_KEY = /* @__PURE__ */ Symbol.for("@farm.js/core/package-client-boundary-cache");
|
|
536
676
|
function getStorage() {
|
|
@@ -555,17 +695,17 @@ async function withPackageClientBoundaryCache(operation) {
|
|
|
555
695
|
}
|
|
556
696
|
}
|
|
557
697
|
function usePackageClientBoundaryCacheFile(file) {
|
|
558
|
-
_optionalChain([getPackageClientBoundaryCache, 'call',
|
|
698
|
+
_optionalChain([getPackageClientBoundaryCache, 'call', _15 => _15(), 'optionalAccess', _16 => _16.load, 'call', _17 => _17(file)]);
|
|
559
699
|
}
|
|
560
700
|
|
|
561
701
|
// src/utils/client-component.ts
|
|
562
702
|
function readIfExists(filePath) {
|
|
563
703
|
try {
|
|
564
|
-
if (!filePath || !
|
|
704
|
+
if (!filePath || !fs4.default.existsSync(filePath)) {
|
|
565
705
|
return null;
|
|
566
706
|
}
|
|
567
|
-
return
|
|
568
|
-
} catch (
|
|
707
|
+
return fs4.default.readFileSync(filePath, "utf-8");
|
|
708
|
+
} catch (e6) {
|
|
569
709
|
return null;
|
|
570
710
|
}
|
|
571
711
|
}
|
|
@@ -578,26 +718,26 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
578
718
|
if (modulePath.startsWith("file://")) {
|
|
579
719
|
try {
|
|
580
720
|
candidates.add(_url.fileURLToPath.call(void 0, modulePath));
|
|
581
|
-
} catch (
|
|
721
|
+
} catch (e7) {
|
|
582
722
|
}
|
|
583
723
|
}
|
|
584
724
|
if (modulePath.startsWith("/@fs/")) {
|
|
585
725
|
const fsPath = withoutQuery.slice("/@fs/".length);
|
|
586
|
-
candidates.add(
|
|
726
|
+
candidates.add(path6.default.normalize(/^[A-Za-z]:/.test(fsPath) ? fsPath : `/${fsPath}`));
|
|
587
727
|
}
|
|
588
728
|
}
|
|
589
729
|
if (root && modulePath) {
|
|
590
730
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
591
|
-
candidates.add(
|
|
592
|
-
candidates.add(
|
|
731
|
+
candidates.add(path6.default.join(root, normalized));
|
|
732
|
+
candidates.add(path6.default.resolve(root, normalized));
|
|
593
733
|
}
|
|
594
|
-
if (_optionalChain([withoutQuery, 'optionalAccess',
|
|
734
|
+
if (_optionalChain([withoutQuery, 'optionalAccess', _18 => _18.startsWith, 'call', _19 => _19("/src/")])) {
|
|
595
735
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
596
|
-
candidates.add(
|
|
597
|
-
candidates.add(
|
|
736
|
+
candidates.add(path6.default.join(process.cwd(), normalized));
|
|
737
|
+
candidates.add(path6.default.resolve(process.cwd(), normalized));
|
|
598
738
|
}
|
|
599
739
|
for (const candidate of candidates) {
|
|
600
|
-
if (
|
|
740
|
+
if (fs4.default.existsSync(candidate)) {
|
|
601
741
|
return candidate;
|
|
602
742
|
}
|
|
603
743
|
}
|
|
@@ -614,8 +754,8 @@ var FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES = 4;
|
|
|
614
754
|
function isolatedHydrationBoundaryLimit() {
|
|
615
755
|
const benchmarkRoot = process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_ROOT;
|
|
616
756
|
const benchmarkLimit = Number(process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_LIMIT);
|
|
617
|
-
const resolvedBenchmarkRoot = benchmarkRoot ?
|
|
618
|
-
const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${
|
|
757
|
+
const resolvedBenchmarkRoot = benchmarkRoot ? path6.default.resolve(benchmarkRoot) : null;
|
|
758
|
+
const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${path6.default.sep}`));
|
|
619
759
|
return isBenchmarkFixture && Number.isSafeInteger(benchmarkLimit) && benchmarkLimit > FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES ? benchmarkLimit : FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES;
|
|
620
760
|
}
|
|
621
761
|
var RESOLVABLE_SOURCE_EXTENSIONS = [
|
|
@@ -670,7 +810,7 @@ function hasHydrateExport(content) {
|
|
|
670
810
|
for (const match of content.matchAll(/\bexport\s*\{([^}]*)\}/g)) {
|
|
671
811
|
for (const specifier of match[1].split(",")) {
|
|
672
812
|
const parts = specifier.trim().split(/\s+as\s+/);
|
|
673
|
-
const exportedName = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess',
|
|
813
|
+
const exportedName = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess', _20 => _20.trim, 'call', _21 => _21()]);
|
|
674
814
|
if (exportedName === "hydrate") {
|
|
675
815
|
return true;
|
|
676
816
|
}
|
|
@@ -838,7 +978,7 @@ function isIslandExportStart(tokens, index) {
|
|
|
838
978
|
const token = tokens[index];
|
|
839
979
|
const previous = tokens[index - 1];
|
|
840
980
|
const startsStatement = !previous || previous.value === ";" || previous.value === "{" || previous.value === "}" || token.line > previous.line;
|
|
841
|
-
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access',
|
|
981
|
+
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access', _22 => _22[index + 1], 'optionalAccess', _23 => _23.value]) === "const" && _optionalChain([tokens, 'access', _24 => _24[index + 2], 'optionalAccess', _25 => _25.value]) === "island";
|
|
842
982
|
}
|
|
843
983
|
function getIslandStrategyExport(content) {
|
|
844
984
|
if (!content) return null;
|
|
@@ -846,15 +986,15 @@ function getIslandStrategyExport(content) {
|
|
|
846
986
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
847
987
|
if (!isIslandExportStart(tokens, index)) continue;
|
|
848
988
|
let valueIndex = index + 3;
|
|
849
|
-
if (_optionalChain([tokens, 'access',
|
|
989
|
+
if (_optionalChain([tokens, 'access', _26 => _26[valueIndex], 'optionalAccess', _27 => _27.value]) === ":") {
|
|
850
990
|
while (valueIndex < tokens.length && tokens[valueIndex].value !== "=") valueIndex++;
|
|
851
991
|
}
|
|
852
|
-
if (_optionalChain([tokens, 'access',
|
|
992
|
+
if (_optionalChain([tokens, 'access', _28 => _28[valueIndex], 'optionalAccess', _29 => _29.value]) !== "=") break;
|
|
853
993
|
valueIndex++;
|
|
854
994
|
const literal = tokens[valueIndex];
|
|
855
995
|
if (!literal || literal.kind !== "string" || !_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, literal.value)) break;
|
|
856
996
|
let trailingIndex = valueIndex + 1;
|
|
857
|
-
if (_optionalChain([tokens, 'access',
|
|
997
|
+
if (_optionalChain([tokens, 'access', _30 => _30[trailingIndex], 'optionalAccess', _31 => _31.value]) === "as" && _optionalChain([tokens, 'access', _32 => _32[trailingIndex + 1], 'optionalAccess', _33 => _33.value]) === "const") {
|
|
858
998
|
trailingIndex += 2;
|
|
859
999
|
}
|
|
860
1000
|
const trailing = tokens[trailingIndex];
|
|
@@ -880,13 +1020,13 @@ function hasAsyncDefaultExport(content) {
|
|
|
880
1020
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
881
1021
|
const token = tokens[index];
|
|
882
1022
|
if (token.kind !== "identifier" || token.value !== "export") continue;
|
|
883
|
-
if (_optionalChain([tokens, 'access',
|
|
884
|
-
if (_optionalChain([tokens, 'access',
|
|
1023
|
+
if (_optionalChain([tokens, 'access', _34 => _34[index - 1], 'optionalAccess', _35 => _35.value]) === ".") continue;
|
|
1024
|
+
if (_optionalChain([tokens, 'access', _36 => _36[index + 1], 'optionalAccess', _37 => _37.value]) !== "default") continue;
|
|
885
1025
|
const exported = tokens[index + 2];
|
|
886
1026
|
if (exported.kind === "identifier" && exported.value === "async") {
|
|
887
1027
|
return true;
|
|
888
1028
|
}
|
|
889
|
-
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access',
|
|
1029
|
+
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access', _38 => _38[index + 3], 'optionalAccess', _39 => _39.value]) !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
|
|
890
1030
|
return true;
|
|
891
1031
|
}
|
|
892
1032
|
}
|
|
@@ -894,10 +1034,10 @@ function hasAsyncDefaultExport(content) {
|
|
|
894
1034
|
}
|
|
895
1035
|
function isAsyncLocalDeclaration(tokens, name) {
|
|
896
1036
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
897
|
-
if (tokens[index].value === "async" && _optionalChain([tokens, 'access',
|
|
1037
|
+
if (tokens[index].value === "async" && _optionalChain([tokens, 'access', _40 => _40[index + 1], 'optionalAccess', _41 => _41.value]) === "function" && _optionalChain([tokens, 'access', _42 => _42[index + 2], 'optionalAccess', _43 => _43.value]) === name) {
|
|
898
1038
|
return true;
|
|
899
1039
|
}
|
|
900
|
-
if (tokens[index].value === name && _optionalChain([tokens, 'access',
|
|
1040
|
+
if (tokens[index].value === name && _optionalChain([tokens, 'access', _44 => _44[index + 1], 'optionalAccess', _45 => _45.value]) === "=" && _optionalChain([tokens, 'access', _46 => _46[index + 2], 'optionalAccess', _47 => _47.value]) === "async") {
|
|
901
1041
|
return true;
|
|
902
1042
|
}
|
|
903
1043
|
}
|
|
@@ -987,7 +1127,7 @@ function getClientModuleHydrationPlan(modulePath, root, mode = "off", options =
|
|
|
987
1127
|
const layout = collectIsolatedClientBoundaries(resolvedPath, root, {
|
|
988
1128
|
allowDynamicCardinality: true,
|
|
989
1129
|
allowElementProps: true,
|
|
990
|
-
|
|
1130
|
+
packageReferences: true
|
|
991
1131
|
});
|
|
992
1132
|
const routeWide = {
|
|
993
1133
|
...plan,
|
|
@@ -1046,7 +1186,9 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
1046
1186
|
allowDynamicCardinality: asyncOwner,
|
|
1047
1187
|
allowElementProps: asyncOwner,
|
|
1048
1188
|
staticPackageBoundaries: asyncOwner,
|
|
1049
|
-
staticPackageLeaves: options.serverTreeLayouts === true && options.asyncOwnerIslands === true
|
|
1189
|
+
staticPackageLeaves: options.serverTreeLayouts === true && options.asyncOwnerIslands === true,
|
|
1190
|
+
// Islands mode: pages carry `serverOwners`, layouts `serverTreeLayouts`.
|
|
1191
|
+
packageReferences: options.serverOwners === true || options.serverTreeLayouts === true
|
|
1050
1192
|
});
|
|
1051
1193
|
if (inspection.fallbackReason && asyncOwner && options.serverOwners === true) {
|
|
1052
1194
|
return {
|
|
@@ -1096,7 +1238,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
1096
1238
|
return plan;
|
|
1097
1239
|
}
|
|
1098
1240
|
function usesFarmServerTree(plan) {
|
|
1099
|
-
return _optionalChain([plan, 'optionalAccess',
|
|
1241
|
+
return _optionalChain([plan, 'optionalAccess', _48 => _48.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0 && plan.isolatedBoundaries.every((boundary) => boundary.islandStrategy === "load");
|
|
1100
1242
|
}
|
|
1101
1243
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
1102
1244
|
const plan = {
|
|
@@ -1118,7 +1260,8 @@ function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off",
|
|
|
1118
1260
|
}
|
|
1119
1261
|
const inspection = collectIsolatedClientBoundaries(resolvedPath, root, {
|
|
1120
1262
|
allowDynamicCardinality: true,
|
|
1121
|
-
staticPackageBoundaries: true
|
|
1263
|
+
staticPackageBoundaries: true,
|
|
1264
|
+
packageReferences: options.packageReferences === true
|
|
1122
1265
|
});
|
|
1123
1266
|
if (inspection.fallbackReason) return { ...plan, fallbackReason: inspection.fallbackReason };
|
|
1124
1267
|
if (inspection.staticPackages.length > 0)
|
|
@@ -1225,7 +1368,7 @@ function getStaticImportBindings(content) {
|
|
|
1225
1368
|
if (!content) return bindings;
|
|
1226
1369
|
const tokens = tokenizeModuleSource(content);
|
|
1227
1370
|
for (let index = 0; index < tokens.length; index++) {
|
|
1228
|
-
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access',
|
|
1371
|
+
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _49 => _49[index - 1], 'optionalAccess', _50 => _50.value]) === ".") continue;
|
|
1229
1372
|
const first = tokens[index + 1];
|
|
1230
1373
|
if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
|
|
1231
1374
|
continue;
|
|
@@ -1233,7 +1376,7 @@ function getStaticImportBindings(content) {
|
|
|
1233
1376
|
let fromIndex = -1;
|
|
1234
1377
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
1235
1378
|
if (tokens[cursor].value === ";") break;
|
|
1236
|
-
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access',
|
|
1379
|
+
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _51 => _51[cursor + 1], 'optionalAccess', _52 => _52.kind]) === "string") {
|
|
1237
1380
|
fromIndex = cursor;
|
|
1238
1381
|
break;
|
|
1239
1382
|
}
|
|
@@ -1242,13 +1385,13 @@ function getStaticImportBindings(content) {
|
|
|
1242
1385
|
const specifier = tokens[fromIndex + 1].value;
|
|
1243
1386
|
const clause = tokens.slice(index + 1, fromIndex);
|
|
1244
1387
|
const localNames = [];
|
|
1245
|
-
if (_optionalChain([clause, 'access',
|
|
1388
|
+
if (_optionalChain([clause, 'access', _53 => _53[0], 'optionalAccess', _54 => _54.kind]) === "identifier" && clause[0].value !== "type") {
|
|
1246
1389
|
localNames.push(clause[0].value);
|
|
1247
1390
|
}
|
|
1248
1391
|
const namespaceAs = clause.findIndex(
|
|
1249
|
-
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access',
|
|
1392
|
+
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _55 => _55[clauseIndex + 1], 'optionalAccess', _56 => _56.value]) === "as"
|
|
1250
1393
|
);
|
|
1251
|
-
if (namespaceAs !== -1 && _optionalChain([clause, 'access',
|
|
1394
|
+
if (namespaceAs !== -1 && _optionalChain([clause, 'access', _57 => _57[namespaceAs + 2], 'optionalAccess', _58 => _58.kind]) === "identifier") {
|
|
1252
1395
|
localNames.push(clause[namespaceAs + 2].value);
|
|
1253
1396
|
}
|
|
1254
1397
|
const openingBrace = clause.findIndex((token) => token.value === "{");
|
|
@@ -1258,11 +1401,11 @@ function getStaticImportBindings(content) {
|
|
|
1258
1401
|
if (openingBrace !== -1 && closingBrace !== -1) {
|
|
1259
1402
|
let entryStart = openingBrace + 1;
|
|
1260
1403
|
for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
|
|
1261
|
-
if (cursor !== closingBrace && _optionalChain([clause, 'access',
|
|
1404
|
+
if (cursor !== closingBrace && _optionalChain([clause, 'access', _59 => _59[cursor], 'optionalAccess', _60 => _60.value]) !== ",") continue;
|
|
1262
1405
|
const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
|
|
1263
1406
|
const asIndex = entry.findIndex((token) => token.value === "as");
|
|
1264
1407
|
const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
|
|
1265
|
-
if (_optionalChain([local, 'optionalAccess',
|
|
1408
|
+
if (_optionalChain([local, 'optionalAccess', _61 => _61.kind]) === "identifier") localNames.push(local.value);
|
|
1266
1409
|
entryStart = cursor + 1;
|
|
1267
1410
|
}
|
|
1268
1411
|
}
|
|
@@ -1299,14 +1442,14 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
1299
1442
|
const open = [];
|
|
1300
1443
|
const isSelfClosing = (openingIndex) => {
|
|
1301
1444
|
for (let index = openingIndex; index < tokens.length; index++) {
|
|
1302
|
-
if (tokens[index].value === ">") return _optionalChain([tokens, 'access',
|
|
1445
|
+
if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _62 => _62[index - 1], 'optionalAccess', _63 => _63.value]) === "/";
|
|
1303
1446
|
}
|
|
1304
1447
|
return false;
|
|
1305
1448
|
};
|
|
1306
1449
|
for (let index = 0; index < tokens.length - 1; index++) {
|
|
1307
1450
|
if (tokens[index].value !== "<") continue;
|
|
1308
1451
|
if (tokens[index + 1].value === "/") {
|
|
1309
|
-
const closing = _optionalChain([tokens, 'access',
|
|
1452
|
+
const closing = _optionalChain([tokens, 'access', _64 => _64[index + 2], 'optionalAccess', _65 => _65.value]);
|
|
1310
1453
|
const at = closing ? open.lastIndexOf(closing) : -1;
|
|
1311
1454
|
if (at !== -1) open.length = at;
|
|
1312
1455
|
continue;
|
|
@@ -1349,7 +1492,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
|
|
|
1349
1492
|
}
|
|
1350
1493
|
function containsClientJsx(tokens, start, end, clientBindings) {
|
|
1351
1494
|
for (let index = start; index < end; index++) {
|
|
1352
|
-
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access',
|
|
1495
|
+
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _66 => _66[index + 1], 'optionalAccess', _67 => _67.value]))) return true;
|
|
1353
1496
|
}
|
|
1354
1497
|
return false;
|
|
1355
1498
|
}
|
|
@@ -1387,7 +1530,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
1387
1530
|
let helperName;
|
|
1388
1531
|
let bodyStart = -1;
|
|
1389
1532
|
let bodyEnd = -1;
|
|
1390
|
-
if (tokens[index].value === "function" && _optionalChain([tokens, 'access',
|
|
1533
|
+
if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _68 => _68[index + 1], 'optionalAccess', _69 => _69.kind]) === "identifier") {
|
|
1391
1534
|
helperName = tokens[index + 1].value;
|
|
1392
1535
|
const parametersStart = tokens.findIndex(
|
|
1393
1536
|
(token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
|
|
@@ -1397,21 +1540,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
1397
1540
|
(token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
|
|
1398
1541
|
);
|
|
1399
1542
|
if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
|
|
1400
|
-
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access',
|
|
1543
|
+
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _70 => _70[index + 1], 'optionalAccess', _71 => _71.kind]) === "identifier") {
|
|
1401
1544
|
helperName = tokens[index + 1].value;
|
|
1402
1545
|
let assignmentIndex = -1;
|
|
1403
1546
|
let arrowIndex = -1;
|
|
1404
1547
|
for (let cursor = index + 2; cursor < tokens.length; cursor++) {
|
|
1405
1548
|
if (tokens[cursor].value === ";") break;
|
|
1406
1549
|
if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
|
|
1407
|
-
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access',
|
|
1550
|
+
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _72 => _72[cursor + 1], 'optionalAccess', _73 => _73.value]) === ">") {
|
|
1408
1551
|
arrowIndex = cursor;
|
|
1409
1552
|
break;
|
|
1410
1553
|
}
|
|
1411
1554
|
}
|
|
1412
1555
|
if (arrowIndex !== -1) {
|
|
1413
1556
|
bodyStart = arrowIndex + 2;
|
|
1414
|
-
bodyEnd = _optionalChain([tokens, 'access',
|
|
1557
|
+
bodyEnd = _optionalChain([tokens, 'access', _74 => _74[bodyStart], 'optionalAccess', _75 => _75.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
|
|
1415
1558
|
} else if (assignmentIndex !== -1) {
|
|
1416
1559
|
bodyStart = assignmentIndex + 1;
|
|
1417
1560
|
bodyEnd = findStatementEnd(tokens, bodyStart);
|
|
@@ -1451,14 +1594,14 @@ function passesElementValuedProps(content, localBindings) {
|
|
|
1451
1594
|
else if (value === "}") braceDepth--;
|
|
1452
1595
|
else if (value === "<" && braceDepth > 0) return true;
|
|
1453
1596
|
else if (value === ">" && braceDepth === 0) {
|
|
1454
|
-
selfClosing = _optionalChain([tokens, 'access',
|
|
1597
|
+
selfClosing = _optionalChain([tokens, 'access', _76 => _76[cursor - 1], 'optionalAccess', _77 => _77.value]) === "/";
|
|
1455
1598
|
break;
|
|
1456
1599
|
}
|
|
1457
1600
|
}
|
|
1458
1601
|
if (selfClosing || cursor >= tokens.length) continue;
|
|
1459
1602
|
for (let child = cursor + 1; child < tokens.length; child++) {
|
|
1460
1603
|
if (tokens[child].value !== "<") continue;
|
|
1461
|
-
const closesBoundary = _optionalChain([tokens, 'access',
|
|
1604
|
+
const closesBoundary = _optionalChain([tokens, 'access', _78 => _78[child + 1], 'optionalAccess', _79 => _79.value]) === "/" && _optionalChain([tokens, 'access', _80 => _80[child + 2], 'optionalAccess', _81 => _81.value]) === name;
|
|
1462
1605
|
if (!closesBoundary) return true;
|
|
1463
1606
|
break;
|
|
1464
1607
|
}
|
|
@@ -1480,7 +1623,7 @@ function rendersOnlyLeafElements(content, localBindings) {
|
|
|
1480
1623
|
else if (value === "<" && braceDepth > 0) return false;
|
|
1481
1624
|
else if (value === ">" && braceDepth === 0) break;
|
|
1482
1625
|
}
|
|
1483
|
-
if (cursor >= tokens.length || _optionalChain([tokens, 'access',
|
|
1626
|
+
if (cursor >= tokens.length || _optionalChain([tokens, 'access', _82 => _82[cursor - 1], 'optionalAccess', _83 => _83.value]) !== "/") return false;
|
|
1484
1627
|
}
|
|
1485
1628
|
return true;
|
|
1486
1629
|
}
|
|
@@ -1492,9 +1635,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
1492
1635
|
const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
|
|
1493
1636
|
for (let index = 0; index < tokens.length; index++) {
|
|
1494
1637
|
let callStart = -1;
|
|
1495
|
-
if (tokens[index].value === "." && (_optionalChain([tokens, 'access',
|
|
1638
|
+
if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _84 => _84[index + 1], 'optionalAccess', _85 => _85.value]) === "map" || _optionalChain([tokens, 'access', _86 => _86[index + 1], 'optionalAccess', _87 => _87.value]) === "flatMap") && _optionalChain([tokens, 'access', _88 => _88[index + 2], 'optionalAccess', _89 => _89.value]) === "(") {
|
|
1496
1639
|
callStart = index + 2;
|
|
1497
|
-
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access',
|
|
1640
|
+
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _90 => _90[index + 1], 'optionalAccess', _91 => _91.value]) === "." && _optionalChain([tokens, 'access', _92 => _92[index + 2], 'optionalAccess', _93 => _93.value]) === "from" && _optionalChain([tokens, 'access', _94 => _94[index + 3], 'optionalAccess', _95 => _95.value]) === "(") {
|
|
1498
1641
|
callStart = index + 3;
|
|
1499
1642
|
}
|
|
1500
1643
|
if (callStart !== -1) {
|
|
@@ -1503,10 +1646,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
1503
1646
|
index = callEnd;
|
|
1504
1647
|
continue;
|
|
1505
1648
|
}
|
|
1506
|
-
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access',
|
|
1649
|
+
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _96 => _96[index + 1], 'optionalAccess', _97 => _97.value]) === "(") {
|
|
1507
1650
|
const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
|
|
1508
1651
|
const bodyStart = conditionEnd + 1;
|
|
1509
|
-
const bodyEnd = _optionalChain([tokens, 'access',
|
|
1652
|
+
const bodyEnd = _optionalChain([tokens, 'access', _98 => _98[bodyStart], 'optionalAccess', _99 => _99.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
|
|
1510
1653
|
if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
|
|
1511
1654
|
}
|
|
1512
1655
|
}
|
|
@@ -1520,7 +1663,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
1520
1663
|
let fallbackReason;
|
|
1521
1664
|
let fallbackHint;
|
|
1522
1665
|
let costGuardExceeded = false;
|
|
1523
|
-
const projectRoot = root ?
|
|
1666
|
+
const projectRoot = root ? path6.default.resolve(root) : void 0;
|
|
1524
1667
|
const visit = (moduleSourcePath) => {
|
|
1525
1668
|
if (fallbackReason) return 0;
|
|
1526
1669
|
const cached = estimates.get(moduleSourcePath);
|
|
@@ -1530,7 +1673,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
1530
1673
|
const content = readIfExists(moduleSourcePath);
|
|
1531
1674
|
const parsed = parseClientModuleMetadata(content, false);
|
|
1532
1675
|
if (parsed.isClientComponent) {
|
|
1533
|
-
if (projectRoot && !
|
|
1676
|
+
if (projectRoot && !path6.default.resolve(moduleSourcePath).startsWith(`${projectRoot}${path6.default.sep}`)) {
|
|
1534
1677
|
fallbackReason = `client boundary ${moduleSourcePath} is outside the application root`;
|
|
1535
1678
|
fallbackHint = "Move the component into the application, or publish it as a package (package client components render as static HTML)";
|
|
1536
1679
|
return 0;
|
|
@@ -1559,20 +1702,35 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
1559
1702
|
const imported = resolveImportedModule(moduleSourcePath, specifier, root);
|
|
1560
1703
|
const importedPath = imported.path;
|
|
1561
1704
|
if (!importedPath) continue;
|
|
1562
|
-
|
|
1705
|
+
let importedBoundaryCount;
|
|
1706
|
+
if (imported.local) {
|
|
1707
|
+
importedBoundaryCount = visit(importedPath);
|
|
1708
|
+
} else {
|
|
1563
1709
|
const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
|
|
1564
|
-
if (packageMetadata.shouldHydrate)
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1710
|
+
if (!packageMetadata.shouldHydrate) continue;
|
|
1711
|
+
const references = options.packageReferences && projectRoot ? findFarmPackageClientImports(
|
|
1712
|
+
_nullishCoalesce(content, () => ( "")),
|
|
1713
|
+
moduleSourcePath,
|
|
1714
|
+
(candidate) => candidate === specifier
|
|
1715
|
+
) : [];
|
|
1716
|
+
if (references.length > 0) {
|
|
1717
|
+
importedBoundaryCount = 0;
|
|
1718
|
+
for (const reference of references) {
|
|
1719
|
+
for (const exportName of farmPackageClientImportExports(reference)) {
|
|
1720
|
+
importedBoundaryCount += visit(
|
|
1721
|
+
ensureFarmPackageClientReference(projectRoot, specifier, exportName)
|
|
1722
|
+
);
|
|
1723
|
+
}
|
|
1568
1724
|
}
|
|
1725
|
+
} else if (options.staticPackageBoundaries || options.staticPackageLeaves && rendersOnlyLeafElements(content, _nullishCoalesce(importedBindings.get(specifier), () => ( [])))) {
|
|
1726
|
+
staticPackages.add(specifier);
|
|
1727
|
+
continue;
|
|
1728
|
+
} else {
|
|
1569
1729
|
fallbackReason = `package client boundary ${specifier} cannot yet be isolated`;
|
|
1570
1730
|
fallbackHint = `Render it from a local "use client" module (a providers.tsx that renders the ${specifier} component)`;
|
|
1571
1731
|
return 0;
|
|
1572
1732
|
}
|
|
1573
|
-
continue;
|
|
1574
1733
|
}
|
|
1575
|
-
const importedBoundaryCount = visit(importedPath);
|
|
1576
1734
|
if (fallbackReason || importedBoundaryCount === 0) continue;
|
|
1577
1735
|
const localBindings = _nullishCoalesce(importedBindings.get(specifier), () => ( []));
|
|
1578
1736
|
const staticUses = countStaticJsxUses(content, localBindings);
|
|
@@ -1680,7 +1838,7 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
1680
1838
|
}
|
|
1681
1839
|
function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
1682
1840
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
1683
|
-
if (resolvedPath) _optionalChain([trace, 'optionalAccess',
|
|
1841
|
+
if (resolvedPath) _optionalChain([trace, 'optionalAccess', _100 => _100.stop, 'call', _101 => _101(resolvedPath)]);
|
|
1684
1842
|
return {
|
|
1685
1843
|
isClientComponent: false,
|
|
1686
1844
|
shouldHydrate: false,
|
|
@@ -1688,7 +1846,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
|
1688
1846
|
};
|
|
1689
1847
|
}
|
|
1690
1848
|
visited.add(resolvedPath);
|
|
1691
|
-
_optionalChain([trace, 'optionalAccess',
|
|
1849
|
+
_optionalChain([trace, 'optionalAccess', _102 => _102.visit, 'call', _103 => _103(resolvedPath)]);
|
|
1692
1850
|
const content = readIfExists(resolvedPath);
|
|
1693
1851
|
const parsed = parseClientModuleMetadata(content, false);
|
|
1694
1852
|
let importsClientBoundary = false;
|
|
@@ -1732,7 +1890,7 @@ function getImportSpecifiers(content) {
|
|
|
1732
1890
|
continue;
|
|
1733
1891
|
}
|
|
1734
1892
|
const previous = tokens[index - 1];
|
|
1735
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
1893
|
+
if (_optionalChain([previous, 'optionalAccess', _104 => _104.value]) === ".") continue;
|
|
1736
1894
|
const first = tokens[index + 1];
|
|
1737
1895
|
if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
|
|
1738
1896
|
continue;
|
|
@@ -1748,7 +1906,7 @@ function getImportSpecifiers(content) {
|
|
|
1748
1906
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
1749
1907
|
const token = tokens[cursor];
|
|
1750
1908
|
if (token.value === ";") break;
|
|
1751
|
-
if (token.value === "from" && _optionalChain([tokens, 'access',
|
|
1909
|
+
if (token.value === "from" && _optionalChain([tokens, 'access', _105 => _105[cursor + 1], 'optionalAccess', _106 => _106.kind]) === "string") {
|
|
1752
1910
|
fromIndex = cursor;
|
|
1753
1911
|
break;
|
|
1754
1912
|
}
|
|
@@ -1766,14 +1924,14 @@ function getImportSpecifiers(content) {
|
|
|
1766
1924
|
return Array.from(matches);
|
|
1767
1925
|
}
|
|
1768
1926
|
function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
1769
|
-
if (_optionalChain([tokens, 'access',
|
|
1927
|
+
if (_optionalChain([tokens, 'access', _107 => _107[startIndex], 'optionalAccess', _108 => _108.value]) !== "{") return false;
|
|
1770
1928
|
const closingBraceIndex = tokens.findIndex(
|
|
1771
1929
|
(token, index) => index > startIndex && index < endIndex && token.value === "}"
|
|
1772
1930
|
);
|
|
1773
1931
|
if (closingBraceIndex === -1) return false;
|
|
1774
1932
|
let entryStartsAt = startIndex + 1;
|
|
1775
1933
|
for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
|
|
1776
|
-
if (index !== closingBraceIndex && _optionalChain([tokens, 'access',
|
|
1934
|
+
if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _109 => _109[index], 'optionalAccess', _110 => _110.value]) !== ",") continue;
|
|
1777
1935
|
const entry = tokens.slice(entryStartsAt, index);
|
|
1778
1936
|
if (entry.length > 0 && entry[0].value !== "type") return false;
|
|
1779
1937
|
entryStartsAt = index + 1;
|
|
@@ -1795,7 +1953,7 @@ var ALIAS_IMPORT = /^(?:@\/|~\/|#)/;
|
|
|
1795
1953
|
function warnUnresolvedAliasImport(importerPath, specifier, root) {
|
|
1796
1954
|
if (!ALIAS_IMPORT.test(specifier) || warnedUnresolvedAliasImports.has(specifier)) return;
|
|
1797
1955
|
warnedUnresolvedAliasImports.add(specifier);
|
|
1798
|
-
const importer = root ?
|
|
1956
|
+
const importer = root ? path6.default.relative(root, importerPath) : importerPath;
|
|
1799
1957
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
1800
1958
|
`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".`
|
|
1801
1959
|
);
|
|
@@ -1804,7 +1962,7 @@ var projectImportAliasCache = /* @__PURE__ */ new Map();
|
|
|
1804
1962
|
var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
|
|
1805
1963
|
function resolveProjectAliasSourcePath(specifier, root) {
|
|
1806
1964
|
if (!root) return void 0;
|
|
1807
|
-
const projectRoot =
|
|
1965
|
+
const projectRoot = path6.default.resolve(root);
|
|
1808
1966
|
let match;
|
|
1809
1967
|
for (const alias of getProjectImportAliases(projectRoot)) {
|
|
1810
1968
|
const captured = matchProjectImportAlias(alias, specifier);
|
|
@@ -1814,7 +1972,7 @@ function resolveProjectAliasSourcePath(specifier, root) {
|
|
|
1814
1972
|
if (!match) return void 0;
|
|
1815
1973
|
const resolved = resolveSourceCandidate(
|
|
1816
1974
|
match.alias.targets.map(
|
|
1817
|
-
(target) =>
|
|
1975
|
+
(target) => path6.default.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
|
|
1818
1976
|
)
|
|
1819
1977
|
);
|
|
1820
1978
|
return resolved && /\.d\.[cm]?ts$/.test(resolved) ? null : resolved;
|
|
@@ -1829,15 +1987,15 @@ function matchProjectImportAlias(alias, specifier) {
|
|
|
1829
1987
|
function getProjectImportAliases(projectRoot) {
|
|
1830
1988
|
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
1831
1989
|
try {
|
|
1832
|
-
return String(
|
|
1833
|
-
} catch (
|
|
1990
|
+
return String(fs4.default.statSync(path6.default.join(projectRoot, file)).mtimeMs);
|
|
1991
|
+
} catch (e8) {
|
|
1834
1992
|
return "-";
|
|
1835
1993
|
}
|
|
1836
1994
|
}).join(":");
|
|
1837
1995
|
const sourceDir = _chunkBPNOYILCcjs.getFarmProjectSourceDir.call(void 0, projectRoot);
|
|
1838
1996
|
const cacheStamp = `${stamp}:${sourceDir}`;
|
|
1839
1997
|
const cached = projectImportAliasCache.get(projectRoot);
|
|
1840
|
-
if (_optionalChain([cached, 'optionalAccess',
|
|
1998
|
+
if (_optionalChain([cached, 'optionalAccess', _111 => _111.stamp]) === cacheStamp) return cached.aliases;
|
|
1841
1999
|
const aliases = [
|
|
1842
2000
|
...readTsconfigPathAliases(projectRoot),
|
|
1843
2001
|
...readPackageImportAliases(projectRoot)
|
|
@@ -1847,7 +2005,7 @@ function getProjectImportAliases(projectRoot) {
|
|
|
1847
2005
|
prefix: "@/",
|
|
1848
2006
|
suffix: "",
|
|
1849
2007
|
wildcard: true,
|
|
1850
|
-
targets: [
|
|
2008
|
+
targets: [path6.default.join(projectRoot, sourceDir, "*")]
|
|
1851
2009
|
});
|
|
1852
2010
|
}
|
|
1853
2011
|
projectImportAliasCache.set(projectRoot, { stamp: cacheStamp, aliases });
|
|
@@ -1855,10 +2013,10 @@ function getProjectImportAliases(projectRoot) {
|
|
|
1855
2013
|
}
|
|
1856
2014
|
function readTsconfigPathAliases(projectRoot) {
|
|
1857
2015
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
1858
|
-
const configPath =
|
|
1859
|
-
if (!
|
|
2016
|
+
const configPath = path6.default.join(projectRoot, name);
|
|
2017
|
+
if (!fs4.default.existsSync(configPath)) continue;
|
|
1860
2018
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
1861
|
-
if (!_optionalChain([resolved, 'optionalAccess',
|
|
2019
|
+
if (!_optionalChain([resolved, 'optionalAccess', _112 => _112.paths])) return [];
|
|
1862
2020
|
const base = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
|
|
1863
2021
|
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
1864
2022
|
if (!Array.isArray(targets)) return [];
|
|
@@ -1868,7 +2026,7 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
1868
2026
|
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
1869
2027
|
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
1870
2028
|
wildcard: wildcardIndex !== -1,
|
|
1871
|
-
targets: targets.filter((target) => typeof target === "string").map((target) =>
|
|
2029
|
+
targets: targets.filter((target) => typeof target === "string").map((target) => path6.default.resolve(base, target))
|
|
1872
2030
|
}
|
|
1873
2031
|
];
|
|
1874
2032
|
});
|
|
@@ -1880,38 +2038,38 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
1880
2038
|
visited.add(configPath);
|
|
1881
2039
|
const config = readJsonWithComments(configPath);
|
|
1882
2040
|
if (!config) return null;
|
|
1883
|
-
const directory =
|
|
2041
|
+
const directory = path6.default.dirname(configPath);
|
|
1884
2042
|
const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
|
|
1885
2043
|
(parent) => typeof parent === "string" && parent.startsWith(".")
|
|
1886
2044
|
);
|
|
1887
2045
|
let inherited = null;
|
|
1888
2046
|
for (const parent of parents) {
|
|
1889
|
-
const parentPath =
|
|
2047
|
+
const parentPath = path6.default.resolve(
|
|
1890
2048
|
directory,
|
|
1891
2049
|
parent.endsWith(".json") ? parent : `${parent}.json`
|
|
1892
2050
|
);
|
|
1893
2051
|
inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
|
|
1894
2052
|
}
|
|
1895
2053
|
const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
|
|
1896
|
-
const baseUrl = typeof options.baseUrl === "string" ?
|
|
2054
|
+
const baseUrl = typeof options.baseUrl === "string" ? path6.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _113 => _113.baseUrl]);
|
|
1897
2055
|
if (options.paths && typeof options.paths === "object") {
|
|
1898
2056
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
1899
2057
|
}
|
|
1900
2058
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
1901
2059
|
}
|
|
1902
2060
|
function readPackageImportAliases(projectRoot) {
|
|
1903
|
-
const imports = _optionalChain([readPackageJson, 'call',
|
|
2061
|
+
const imports = _optionalChain([readPackageJson, 'call', _114 => _114(path6.default.join(projectRoot, "package.json")), 'optionalAccess', _115 => _115.imports]);
|
|
1904
2062
|
if (!imports || typeof imports !== "object") return [];
|
|
1905
2063
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
1906
2064
|
const target = resolveConditionalExportTarget(value);
|
|
1907
|
-
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess',
|
|
2065
|
+
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _116 => _116.startsWith, 'call', _117 => _117("./")])) return [];
|
|
1908
2066
|
const wildcardIndex = pattern.indexOf("*");
|
|
1909
2067
|
return [
|
|
1910
2068
|
{
|
|
1911
2069
|
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
1912
2070
|
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
1913
2071
|
wildcard: wildcardIndex !== -1,
|
|
1914
|
-
targets: [
|
|
2072
|
+
targets: [path6.default.resolve(projectRoot, target)]
|
|
1915
2073
|
}
|
|
1916
2074
|
];
|
|
1917
2075
|
});
|
|
@@ -1919,8 +2077,8 @@ function readPackageImportAliases(projectRoot) {
|
|
|
1919
2077
|
function readJsonWithComments(filePath) {
|
|
1920
2078
|
let source;
|
|
1921
2079
|
try {
|
|
1922
|
-
source =
|
|
1923
|
-
} catch (
|
|
2080
|
+
source = fs4.default.readFileSync(filePath, "utf8");
|
|
2081
|
+
} catch (e9) {
|
|
1924
2082
|
return null;
|
|
1925
2083
|
}
|
|
1926
2084
|
let output = "";
|
|
@@ -1948,7 +2106,7 @@ function readJsonWithComments(filePath) {
|
|
|
1948
2106
|
}
|
|
1949
2107
|
try {
|
|
1950
2108
|
return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
|
|
1951
|
-
} catch (
|
|
2109
|
+
} catch (e10) {
|
|
1952
2110
|
return null;
|
|
1953
2111
|
}
|
|
1954
2112
|
}
|
|
@@ -1957,7 +2115,7 @@ function resolveImportedModuleSourcePath(importerPath, specifier, root) {
|
|
|
1957
2115
|
return resolvePackageModuleSourcePath(importerPath, specifier, root);
|
|
1958
2116
|
}
|
|
1959
2117
|
const candidates = /* @__PURE__ */ new Set();
|
|
1960
|
-
const basePath = specifier.startsWith(".") ?
|
|
2118
|
+
const basePath = specifier.startsWith(".") ? path6.default.resolve(path6.default.dirname(importerPath), specifier) : root ? path6.default.resolve(root, specifier.replace(/^\/+/, "")) : path6.default.resolve(specifier);
|
|
1961
2119
|
candidates.add(basePath);
|
|
1962
2120
|
return resolveSourceCandidate(candidates);
|
|
1963
2121
|
}
|
|
@@ -1967,45 +2125,45 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
1967
2125
|
const packageSubpath = packageParts.slice(packageName.startsWith("@") ? 2 : 1).join("/");
|
|
1968
2126
|
const packageDirectory = findPackageDirectory(importerPath, packageName, root);
|
|
1969
2127
|
if (!packageDirectory) return null;
|
|
1970
|
-
const packageJsonPath =
|
|
2128
|
+
const packageJsonPath = path6.default.join(packageDirectory, "package.json");
|
|
1971
2129
|
const packageJson = readPackageJson(packageJsonPath);
|
|
1972
2130
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
1973
|
-
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess',
|
|
2131
|
+
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _118 => _118.exports]), exportKey);
|
|
1974
2132
|
const candidates = /* @__PURE__ */ new Set();
|
|
1975
|
-
if (_optionalChain([exportTarget, 'optionalAccess',
|
|
1976
|
-
candidates.add(
|
|
2133
|
+
if (_optionalChain([exportTarget, 'optionalAccess', _119 => _119.startsWith, 'call', _120 => _120("./")])) {
|
|
2134
|
+
candidates.add(path6.default.resolve(packageDirectory, exportTarget));
|
|
1977
2135
|
}
|
|
1978
2136
|
if (packageSubpath) {
|
|
1979
|
-
candidates.add(
|
|
2137
|
+
candidates.add(path6.default.join(packageDirectory, packageSubpath));
|
|
1980
2138
|
} else {
|
|
1981
|
-
for (const entry of [_optionalChain([packageJson, 'optionalAccess',
|
|
1982
|
-
if (typeof entry === "string") candidates.add(
|
|
2139
|
+
for (const entry of [_optionalChain([packageJson, 'optionalAccess', _121 => _121.browser]), _optionalChain([packageJson, 'optionalAccess', _122 => _122.module]), _optionalChain([packageJson, 'optionalAccess', _123 => _123.main])]) {
|
|
2140
|
+
if (typeof entry === "string") candidates.add(path6.default.resolve(packageDirectory, entry));
|
|
1983
2141
|
}
|
|
1984
|
-
candidates.add(
|
|
2142
|
+
candidates.add(path6.default.join(packageDirectory, "index"));
|
|
1985
2143
|
}
|
|
1986
2144
|
return resolveSourceCandidate(candidates);
|
|
1987
2145
|
}
|
|
1988
2146
|
function findPackageDirectory(importerPath, packageName, root) {
|
|
1989
2147
|
const searchRoots = /* @__PURE__ */ new Set();
|
|
1990
|
-
let current =
|
|
2148
|
+
let current = path6.default.dirname(importerPath);
|
|
1991
2149
|
while (true) {
|
|
1992
2150
|
searchRoots.add(current);
|
|
1993
|
-
const parent =
|
|
2151
|
+
const parent = path6.default.dirname(current);
|
|
1994
2152
|
if (parent === current) break;
|
|
1995
2153
|
current = parent;
|
|
1996
2154
|
}
|
|
1997
2155
|
if (root) {
|
|
1998
|
-
current =
|
|
2156
|
+
current = path6.default.resolve(root);
|
|
1999
2157
|
while (true) {
|
|
2000
2158
|
searchRoots.add(current);
|
|
2001
|
-
const parent =
|
|
2159
|
+
const parent = path6.default.dirname(current);
|
|
2002
2160
|
if (parent === current) break;
|
|
2003
2161
|
current = parent;
|
|
2004
2162
|
}
|
|
2005
2163
|
}
|
|
2006
2164
|
for (const searchRoot of searchRoots) {
|
|
2007
|
-
const packageDirectory =
|
|
2008
|
-
if (
|
|
2165
|
+
const packageDirectory = path6.default.join(searchRoot, "node_modules", packageName);
|
|
2166
|
+
if (fs4.default.existsSync(path6.default.join(packageDirectory, "package.json"))) {
|
|
2009
2167
|
return packageDirectory;
|
|
2010
2168
|
}
|
|
2011
2169
|
}
|
|
@@ -2013,8 +2171,8 @@ function findPackageDirectory(importerPath, packageName, root) {
|
|
|
2013
2171
|
}
|
|
2014
2172
|
function readPackageJson(packageJsonPath) {
|
|
2015
2173
|
try {
|
|
2016
|
-
return JSON.parse(
|
|
2017
|
-
} catch (
|
|
2174
|
+
return JSON.parse(fs4.default.readFileSync(packageJsonPath, "utf8"));
|
|
2175
|
+
} catch (e11) {
|
|
2018
2176
|
return null;
|
|
2019
2177
|
}
|
|
2020
2178
|
}
|
|
@@ -2043,7 +2201,7 @@ function resolvePackageExport(exportsField, exportKey) {
|
|
|
2043
2201
|
if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
|
|
2044
2202
|
const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
|
|
2045
2203
|
const target = resolveConditionalExportTarget(value);
|
|
2046
|
-
return _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
2204
|
+
return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _124 => _124.replace, 'call', _125 => _125("*", wildcard)]), () => ( null));
|
|
2047
2205
|
}
|
|
2048
2206
|
return null;
|
|
2049
2207
|
}
|
|
@@ -2071,17 +2229,64 @@ function resolveSourceCandidate(candidates) {
|
|
|
2071
2229
|
for (const candidate of candidates) {
|
|
2072
2230
|
const paths = [candidate];
|
|
2073
2231
|
for (const extension of RESOLVABLE_SOURCE_EXTENSIONS) {
|
|
2074
|
-
paths.push(`${candidate}${extension}`,
|
|
2232
|
+
paths.push(`${candidate}${extension}`, path6.default.join(candidate, `index${extension}`));
|
|
2075
2233
|
}
|
|
2076
2234
|
for (const sourcePath of paths) {
|
|
2077
2235
|
try {
|
|
2078
|
-
if (
|
|
2079
|
-
} catch (
|
|
2236
|
+
if (fs4.default.statSync(sourcePath).isFile()) return sourcePath;
|
|
2237
|
+
} catch (e12) {
|
|
2080
2238
|
}
|
|
2081
2239
|
}
|
|
2082
2240
|
}
|
|
2083
2241
|
return null;
|
|
2084
2242
|
}
|
|
2243
|
+
function isFarmPackageClientBoundary(importerPath, specifier, root) {
|
|
2244
|
+
const imported = resolveImportedModule(importerPath, specifier, root);
|
|
2245
|
+
if (imported.local || !imported.path) return false;
|
|
2246
|
+
return inspectPackageClientBoundary(imported.path, root, /* @__PURE__ */ new Set()).shouldHydrate;
|
|
2247
|
+
}
|
|
2248
|
+
var CLIENT_PACKAGE_SCAN_EXTENSIONS = /\.(?:[cm]?[jt]sx?)$/;
|
|
2249
|
+
var CLIENT_PACKAGE_SCAN_SKIP = /* @__PURE__ */ new Set(["node_modules", ".farm", ".git", "dist", ".output"]);
|
|
2250
|
+
function bareSpecifierPackage(specifier) {
|
|
2251
|
+
if (specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("#") || specifier.startsWith("node:") || specifier.startsWith("virtual:") || specifier.includes("\0") || // A package's stylesheet or asset is not a module for the optimizer.
|
|
2252
|
+
/\.(?:css|scss|sass|less|styl|svg|png|jpe?g|gif|webp|avif|ico|woff2?|ttf|json|wasm)$/.test(
|
|
2253
|
+
specifier
|
|
2254
|
+
)) {
|
|
2255
|
+
return null;
|
|
2256
|
+
}
|
|
2257
|
+
return specifier;
|
|
2258
|
+
}
|
|
2259
|
+
function collectFarmClientPackageImports(directory, root) {
|
|
2260
|
+
const found = /* @__PURE__ */ new Set();
|
|
2261
|
+
const walk2 = (current) => {
|
|
2262
|
+
let entries;
|
|
2263
|
+
try {
|
|
2264
|
+
entries = fs4.default.readdirSync(current, { withFileTypes: true });
|
|
2265
|
+
} catch (e13) {
|
|
2266
|
+
return;
|
|
2267
|
+
}
|
|
2268
|
+
for (const entry of entries) {
|
|
2269
|
+
if (entry.name.startsWith(".") && entry.isDirectory()) continue;
|
|
2270
|
+
const file = path6.default.join(current, entry.name);
|
|
2271
|
+
if (entry.isDirectory()) {
|
|
2272
|
+
if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
2273
|
+
continue;
|
|
2274
|
+
}
|
|
2275
|
+
if (!CLIENT_PACKAGE_SCAN_EXTENSIONS.test(entry.name) || entry.name.endsWith(".d.ts"))
|
|
2276
|
+
continue;
|
|
2277
|
+
const content = readIfExists(file);
|
|
2278
|
+
if (!content) continue;
|
|
2279
|
+
const client = hasUseClientDirective(content);
|
|
2280
|
+
for (const specifier of new Set(getImportSpecifiers(content))) {
|
|
2281
|
+
const name = bareSpecifierPackage(specifier);
|
|
2282
|
+
if (!name || found.has(name)) continue;
|
|
2283
|
+
if (client || isFarmPackageClientBoundary(file, name, root)) found.add(name);
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
2287
|
+
walk2(directory);
|
|
2288
|
+
return [...found].sort();
|
|
2289
|
+
}
|
|
2085
2290
|
|
|
2086
2291
|
// src/routing/route-manager.ts
|
|
2087
2292
|
|
|
@@ -2131,13 +2336,13 @@ async function inspectStaticMetadataImage(filePath) {
|
|
|
2131
2336
|
};
|
|
2132
2337
|
}
|
|
2133
2338
|
function getStaticMetadataImageAltPath(filePath) {
|
|
2134
|
-
return
|
|
2135
|
-
|
|
2136
|
-
`${
|
|
2339
|
+
return path6.default.join(
|
|
2340
|
+
path6.default.dirname(filePath),
|
|
2341
|
+
`${path6.default.basename(filePath, path6.default.extname(filePath))}.alt.txt`
|
|
2137
2342
|
);
|
|
2138
2343
|
}
|
|
2139
2344
|
function getStaticMetadataImageExtension(filePath) {
|
|
2140
|
-
const extension =
|
|
2345
|
+
const extension = path6.default.extname(filePath).slice(1).toLowerCase();
|
|
2141
2346
|
return STATIC_METADATA_IMAGE_EXTENSIONS.includes(extension) ? extension : null;
|
|
2142
2347
|
}
|
|
2143
2348
|
async function readAltText(filePath) {
|
|
@@ -2347,7 +2552,7 @@ var RouteManager = class {
|
|
|
2347
2552
|
matchRedirect(pathname, search = "") {
|
|
2348
2553
|
const i18n = this.getI18nConfig();
|
|
2349
2554
|
const localeMatch = i18n ? _chunkOWQV6MLMcjs.resolveFarmLocalePath.call(void 0, pathname, i18n) : void 0;
|
|
2350
|
-
const routePathname = _optionalChain([localeMatch, 'optionalAccess',
|
|
2555
|
+
const routePathname = _optionalChain([localeMatch, 'optionalAccess', _126 => _126.pathname]) || pathname;
|
|
2351
2556
|
const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
|
|
2352
2557
|
for (const redirectEntry of this.redirects.values()) {
|
|
2353
2558
|
const match = _chunkQMNWKQL4cjs.matchRoute.call(void 0, normalizedPath, redirectEntry.route.segments);
|
|
@@ -2358,7 +2563,7 @@ var RouteManager = class {
|
|
|
2358
2563
|
destination: _chunkHXNLKCWHcjs.appendFarmRedirectQuery.call(void 0,
|
|
2359
2564
|
this.localizeRedirectDestination(
|
|
2360
2565
|
interpolateRedirectDestination(redirectEntry.definition.destination, match.params),
|
|
2361
|
-
_optionalChain([localeMatch, 'optionalAccess',
|
|
2566
|
+
_optionalChain([localeMatch, 'optionalAccess', _127 => _127.locale])
|
|
2362
2567
|
),
|
|
2363
2568
|
search
|
|
2364
2569
|
),
|
|
@@ -2465,34 +2670,34 @@ var RouteManager = class {
|
|
|
2465
2670
|
* Requests still fetch route data, but never inspect component source.
|
|
2466
2671
|
*/
|
|
2467
2672
|
generateClientManifest(projectRoot = this.config.root) {
|
|
2468
|
-
const normalizedProjectRoot =
|
|
2469
|
-
if (_optionalChain([this, 'access',
|
|
2673
|
+
const normalizedProjectRoot = path6.default.resolve(projectRoot);
|
|
2674
|
+
if (_optionalChain([this, 'access', _128 => _128.clientManifestCache, 'optionalAccess', _129 => _129.projectRoot]) === normalizedProjectRoot) {
|
|
2470
2675
|
return this.clientManifestCache.manifest;
|
|
2471
2676
|
}
|
|
2472
2677
|
const toUrlPath = (absolutePath) => {
|
|
2473
2678
|
const rootRelative = _chunkQMNWKQL4cjs.toRootRelativeUrlPath.call(void 0, absolutePath, normalizedProjectRoot);
|
|
2474
2679
|
if (rootRelative !== void 0) return rootRelative;
|
|
2475
|
-
if (
|
|
2680
|
+
if (path6.default.isAbsolute(absolutePath)) {
|
|
2476
2681
|
const normalized = absolutePath.replace(/\\/g, "/");
|
|
2477
2682
|
return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
|
|
2478
2683
|
}
|
|
2479
2684
|
return absolutePath;
|
|
2480
2685
|
};
|
|
2481
|
-
const integrationProviders =
|
|
2686
|
+
const integrationProviders = _chunkI32V5CZLcjs.getIntegrationProviders.call(void 0, this.config.integrations).filter(
|
|
2482
2687
|
(provider) => provider.component || provider.type === "clerk"
|
|
2483
2688
|
);
|
|
2484
2689
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2485
2690
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2486
2691
|
);
|
|
2487
|
-
if (_optionalChain([this, 'access',
|
|
2692
|
+
if (_optionalChain([this, 'access', _130 => _130.config, 'access', _131 => _131.experimental, 'optionalAccess', _132 => _132.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _133 => _133.config, 'access', _134 => _134.experimental, 'optionalAccess', _135 => _135.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
2488
2693
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
2489
2694
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2490
2695
|
);
|
|
2491
2696
|
}
|
|
2492
2697
|
const isolatedMode = resolveFarmIsolatedClientHydrationMode(
|
|
2493
|
-
_optionalChain([this, 'access',
|
|
2698
|
+
_optionalChain([this, 'access', _136 => _136.config, 'access', _137 => _137.experimental, 'optionalAccess', _138 => _138.isolatedClientHydration]),
|
|
2494
2699
|
{
|
|
2495
|
-
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
2700
|
+
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _139 => _139.config, 'access', _140 => _140.experimental, 'optionalAccess', _141 => _141.serverComponents])) === "rsc",
|
|
2496
2701
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2497
2702
|
}
|
|
2498
2703
|
);
|
|
@@ -2500,7 +2705,7 @@ var RouteManager = class {
|
|
|
2500
2705
|
this.config.renderer,
|
|
2501
2706
|
Boolean(unsupportedIntegrationProvider)
|
|
2502
2707
|
);
|
|
2503
|
-
const islandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
2708
|
+
const islandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _142 => _142.config, 'access', _143 => _143.experimental, 'optionalAccess', _144 => _144.serverComponents])) === "islands";
|
|
2504
2709
|
const layoutEntries = Array.from(this.layouts.values()).map((entry) => ({
|
|
2505
2710
|
entry,
|
|
2506
2711
|
metadata: getClientModuleHydrationPlan(
|
|
@@ -2514,13 +2719,13 @@ var RouteManager = class {
|
|
|
2514
2719
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, this.config.mdx), normalizedProjectRoot),
|
|
2515
2720
|
normalizedProjectRoot,
|
|
2516
2721
|
isolatedMode,
|
|
2517
|
-
planOptions
|
|
2722
|
+
{ ...planOptions, packageReferences: islandsMode }
|
|
2518
2723
|
);
|
|
2519
2724
|
const routeEntries = Array.from(this.routes.values()).map((entry) => ({
|
|
2520
2725
|
entry,
|
|
2521
2726
|
metadata: _chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(entry.modulePath, normalizedProjectRoot, isolatedMode, {
|
|
2522
2727
|
...planOptions,
|
|
2523
|
-
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
2728
|
+
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _145 => _145.config, 'access', _146 => _146.experimental, 'optionalAccess', _147 => _147.serverComponents])) === "islands"
|
|
2524
2729
|
})
|
|
2525
2730
|
}));
|
|
2526
2731
|
const markdownFallback = routeEntries.find(
|
|
@@ -2531,9 +2736,9 @@ var RouteManager = class {
|
|
|
2531
2736
|
`[Farm.js] client components in Markdown pages stay static: ${markdownFallback.metadata.fallbackReason}.`
|
|
2532
2737
|
);
|
|
2533
2738
|
}
|
|
2534
|
-
const markdownStaticPackages = _optionalChain([routeEntries, 'access',
|
|
2739
|
+
const markdownStaticPackages = _optionalChain([routeEntries, 'access', _148 => _148.find, 'call', _149 => _149(
|
|
2535
2740
|
({ entry, metadata }) => _chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
|
|
2536
|
-
), 'optionalAccess',
|
|
2741
|
+
), 'optionalAccess', _150 => _150.metadata, 'access', _151 => _151.staticPackageBoundaries]);
|
|
2537
2742
|
if (markdownStaticPackages) {
|
|
2538
2743
|
_chunkQMNWKQL4cjs.logger.info(
|
|
2539
2744
|
`[Farm.js] Markdown pages render client components from ${markdownStaticPackages.join(", ")} as static HTML: package client components cannot be isolated yet.`
|
|
@@ -2600,7 +2805,7 @@ var RouteManager = class {
|
|
|
2600
2805
|
}),
|
|
2601
2806
|
suppressedAsyncHydration: metadata.suppressedAsyncHydration,
|
|
2602
2807
|
...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {},
|
|
2603
|
-
search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess',
|
|
2808
|
+
search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _152 => _152.search])),
|
|
2604
2809
|
segments: entry.route.segments.map((seg) => ({
|
|
2605
2810
|
segment: seg.segment,
|
|
2606
2811
|
isDynamic: seg.isDynamic,
|
|
@@ -2652,7 +2857,7 @@ var RouteManager = class {
|
|
|
2652
2857
|
for (const { metadata } of [...layoutEntries, ...routeEntries]) {
|
|
2653
2858
|
if (!metadata.hasIsolatedClientBoundaries && !metadata.serverTreeLayout) continue;
|
|
2654
2859
|
for (const boundary of metadata.isolatedBoundaries) {
|
|
2655
|
-
isolatedClientBoundaryModules.add(
|
|
2860
|
+
isolatedClientBoundaryModules.add(path6.default.resolve(boundary.modulePath));
|
|
2656
2861
|
}
|
|
2657
2862
|
}
|
|
2658
2863
|
const islandsErrors = [
|
|
@@ -2703,17 +2908,17 @@ var RouteManager = class {
|
|
|
2703
2908
|
}
|
|
2704
2909
|
/** @internal Client modules selected by the compiled hydration ownership plan. */
|
|
2705
2910
|
getIsolatedClientBoundaryModules(projectRoot = this.config.root) {
|
|
2706
|
-
const normalizedProjectRoot =
|
|
2911
|
+
const normalizedProjectRoot = path6.default.resolve(projectRoot);
|
|
2707
2912
|
this.generateClientManifest(normalizedProjectRoot);
|
|
2708
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2913
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _153 => _153.clientManifestCache, 'optionalAccess', _154 => _154.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
|
|
2709
2914
|
}
|
|
2710
2915
|
/**
|
|
2711
2916
|
* @internal Islands-mode pages with a client component that cannot become an island. Hydrating
|
|
2712
2917
|
* such a page whole would ship its server code to the browser, so it stays static instead.
|
|
2713
2918
|
*/
|
|
2714
2919
|
getIslandsErrors(projectRoot = this.config.root) {
|
|
2715
|
-
this.generateClientManifest(
|
|
2716
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2920
|
+
this.generateClientManifest(path6.default.resolve(projectRoot));
|
|
2921
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _155 => _155.clientManifestCache, 'optionalAccess', _156 => _156.islandsErrors]), () => ( []));
|
|
2717
2922
|
}
|
|
2718
2923
|
/**
|
|
2719
2924
|
* Invalidate build-time route metadata after a page or layout changes in dev.
|
|
@@ -2843,21 +3048,21 @@ var RouteManager = class {
|
|
|
2843
3048
|
const markdownFiles = group.files.filter(_chunkPRFNLQSPcjs.isFarmMarkdownPageFile);
|
|
2844
3049
|
if (componentFiles.length > 1) {
|
|
2845
3050
|
throw new Error(
|
|
2846
|
-
`Duplicate page route "${pattern}". Found ${componentFiles.map((file) =>
|
|
3051
|
+
`Duplicate page route "${pattern}". Found ${componentFiles.map((file) => path6.default.join(appDir, file)).join(" and ")}.`
|
|
2847
3052
|
);
|
|
2848
3053
|
}
|
|
2849
3054
|
if (markdownFiles.length > 1) {
|
|
2850
3055
|
throw new Error(
|
|
2851
|
-
`Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) =>
|
|
3056
|
+
`Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) => path6.default.join(appDir, file)).join(" and ")}.`
|
|
2852
3057
|
);
|
|
2853
3058
|
}
|
|
2854
3059
|
const componentFile = componentFiles[0];
|
|
2855
3060
|
const markdownFile = markdownFiles[0];
|
|
2856
3061
|
const primaryFile = componentFile || markdownFile;
|
|
2857
3062
|
if (!primaryFile) continue;
|
|
2858
|
-
const modulePath =
|
|
3063
|
+
const modulePath = path6.default.join(appDir, primaryFile);
|
|
2859
3064
|
const existing = this.routes.get(pattern);
|
|
2860
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3065
|
+
if (_optionalChain([existing, 'optionalAccess', _157 => _157.sourceRoot]) === source.root) {
|
|
2861
3066
|
throw new Error(
|
|
2862
3067
|
`Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
2863
3068
|
);
|
|
@@ -2866,7 +3071,7 @@ var RouteManager = class {
|
|
|
2866
3071
|
route: group.route,
|
|
2867
3072
|
modulePath,
|
|
2868
3073
|
...markdownFile ? {
|
|
2869
|
-
markdownSourcePath:
|
|
3074
|
+
markdownSourcePath: path6.default.join(appDir, markdownFile)
|
|
2870
3075
|
} : {},
|
|
2871
3076
|
pattern,
|
|
2872
3077
|
...getPageDirectoryField(group.route, pattern),
|
|
@@ -2881,10 +3086,10 @@ var RouteManager = class {
|
|
|
2881
3086
|
]) {
|
|
2882
3087
|
for (const file of files) {
|
|
2883
3088
|
const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
|
|
2884
|
-
const modulePath =
|
|
3089
|
+
const modulePath = path6.default.join(appDir, file);
|
|
2885
3090
|
const pattern = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, route);
|
|
2886
3091
|
const existing = target.get(pattern);
|
|
2887
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3092
|
+
if (_optionalChain([existing, 'optionalAccess', _158 => _158.sourceRoot]) === source.root) {
|
|
2888
3093
|
throw new Error(
|
|
2889
3094
|
`Duplicate ${kind} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
2890
3095
|
);
|
|
@@ -2901,13 +3106,13 @@ var RouteManager = class {
|
|
|
2901
3106
|
for (const file of [...pageFiles, ...slotDefaultFiles]) {
|
|
2902
3107
|
const slot = _chunkZDAEHG2Ocjs.parseRouteSlotFile.call(void 0, file);
|
|
2903
3108
|
if (!slot) continue;
|
|
2904
|
-
const modulePath =
|
|
3109
|
+
const modulePath = path6.default.join(appDir, file);
|
|
2905
3110
|
const pattern = this.createRoutePattern(slot.route);
|
|
2906
3111
|
const ownerPattern = this.createRoutePattern(slot.ownerRoute);
|
|
2907
3112
|
const ownerDirectory = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
|
|
2908
3113
|
const key = `${ownerPattern}:${slot.name}:${slot.interception ? "intercept" : "slot"}:${slot.fallback ? "default" : pattern}`;
|
|
2909
3114
|
const existing = this.routeSlots.get(key);
|
|
2910
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3115
|
+
if (_optionalChain([existing, 'optionalAccess', _159 => _159.sourceRoot]) === source.root) {
|
|
2911
3116
|
throw new Error(
|
|
2912
3117
|
`Duplicate route slot "${slot.name}" for "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
2913
3118
|
);
|
|
@@ -2927,16 +3132,16 @@ var RouteManager = class {
|
|
|
2927
3132
|
});
|
|
2928
3133
|
}
|
|
2929
3134
|
for (const file of metadataImageFiles) {
|
|
2930
|
-
const fileBase =
|
|
3135
|
+
const fileBase = path6.default.basename(file, path6.default.extname(file));
|
|
2931
3136
|
const kind = fileBase === "twitter-image" ? "twitter" : "opengraph";
|
|
2932
3137
|
const fileName = kind === "twitter" ? "twitter-image" : "opengraph-image";
|
|
2933
3138
|
const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
|
|
2934
|
-
const modulePath =
|
|
3139
|
+
const modulePath = path6.default.join(appDir, file);
|
|
2935
3140
|
const pattern = this.createRoutePattern(route);
|
|
2936
3141
|
const key = `${kind}:${pattern}`;
|
|
2937
3142
|
const existing = this.metadataImages.get(key);
|
|
2938
3143
|
const sourceType = isStaticMetadataImageFile(file) ? "static" : "module";
|
|
2939
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3144
|
+
if (_optionalChain([existing, 'optionalAccess', _160 => _160.sourceRoot]) === source.root) {
|
|
2940
3145
|
throw new Error(
|
|
2941
3146
|
`Duplicate ${fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one static image or module per route segment.`
|
|
2942
3147
|
);
|
|
@@ -2956,15 +3161,15 @@ var RouteManager = class {
|
|
|
2956
3161
|
}
|
|
2957
3162
|
for (const file of metadataRouteFiles) {
|
|
2958
3163
|
const descriptor = getApplicationMetadataRouteDescriptor(
|
|
2959
|
-
|
|
3164
|
+
path6.default.basename(file, path6.default.extname(file))
|
|
2960
3165
|
);
|
|
2961
3166
|
if (!descriptor) continue;
|
|
2962
3167
|
const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
|
|
2963
|
-
const modulePath =
|
|
3168
|
+
const modulePath = path6.default.join(appDir, file);
|
|
2964
3169
|
const pattern = this.createRoutePattern(route);
|
|
2965
3170
|
const key = `${descriptor.kind}:${pattern}`;
|
|
2966
3171
|
const existing = this.metadataRoutes.get(key);
|
|
2967
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3172
|
+
if (_optionalChain([existing, 'optionalAccess', _161 => _161.sourceRoot]) === source.root) {
|
|
2968
3173
|
throw new Error(
|
|
2969
3174
|
`Duplicate ${descriptor.fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one .ts or .js metadata route per segment.`
|
|
2970
3175
|
);
|
|
@@ -3003,7 +3208,7 @@ var RouteManager = class {
|
|
|
3003
3208
|
const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "page");
|
|
3004
3209
|
const pattern = this.createRoutePattern(route);
|
|
3005
3210
|
const existing = this.routes.get(pattern);
|
|
3006
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3211
|
+
if (_optionalChain([existing, 'optionalAccess', _162 => _162.sourceRoot]) === source.root) {
|
|
3007
3212
|
throw new Error(
|
|
3008
3213
|
`Duplicate page route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
|
|
3009
3214
|
);
|
|
@@ -3023,7 +3228,7 @@ var RouteManager = class {
|
|
|
3023
3228
|
const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "layout");
|
|
3024
3229
|
const pattern = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, route);
|
|
3025
3230
|
const existing = this.layouts.get(pattern);
|
|
3026
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3231
|
+
if (_optionalChain([existing, 'optionalAccess', _163 => _163.sourceRoot]) === source.root) {
|
|
3027
3232
|
throw new Error(
|
|
3028
3233
|
`Duplicate layout route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
|
|
3029
3234
|
);
|
|
@@ -3052,7 +3257,7 @@ var RouteManager = class {
|
|
|
3052
3257
|
}
|
|
3053
3258
|
async loadProgrammaticRoutesModule(filePath) {
|
|
3054
3259
|
if (this.viteServer) {
|
|
3055
|
-
const viteRoot = _optionalChain([this, 'access',
|
|
3260
|
+
const viteRoot = _optionalChain([this, 'access', _164 => _164.viteServer, 'access', _165 => _165.config, 'optionalAccess', _166 => _166.root]) || this.config.root || process.cwd();
|
|
3056
3261
|
return await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, filePath, viteRoot));
|
|
3057
3262
|
}
|
|
3058
3263
|
return await import(
|
|
@@ -3155,7 +3360,7 @@ var RouteManager = class {
|
|
|
3155
3360
|
if (!_chunkO27PLNQZcjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
|
|
3156
3361
|
}
|
|
3157
3362
|
const depth = boundaryEntry.route.segments.length;
|
|
3158
|
-
const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess',
|
|
3363
|
+
const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _167 => _167.route, 'access', _168 => _168.segments, 'access', _169 => _169.length]), () => ( -1));
|
|
3159
3364
|
if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
|
|
3160
3365
|
bestMatch = boundaryEntry;
|
|
3161
3366
|
}
|
|
@@ -3206,7 +3411,7 @@ var RouteManager = class {
|
|
|
3206
3411
|
}));
|
|
3207
3412
|
const i18n = this.getI18nConfig();
|
|
3208
3413
|
const docsAdapterRoutes = this.getDocsAdapterRoutes();
|
|
3209
|
-
const result = await
|
|
3414
|
+
const result = await _chunkX4K7TYN6cjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
|
|
3210
3415
|
suggestStaticRendering: shouldSuggestStaticRenderingForI18n(i18n),
|
|
3211
3416
|
...docsAdapterRoutes ? { docsAdapterRoutes } : {}
|
|
3212
3417
|
});
|
|
@@ -3252,9 +3457,9 @@ var RouteManager = class {
|
|
|
3252
3457
|
async isRouteSSG(modulePath) {
|
|
3253
3458
|
try {
|
|
3254
3459
|
const mod = await this.loadRouteModule(modulePath);
|
|
3255
|
-
const rendering = await
|
|
3460
|
+
const rendering = await _chunkX4K7TYN6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
3256
3461
|
return rendering.ssg;
|
|
3257
|
-
} catch (
|
|
3462
|
+
} catch (e14) {
|
|
3258
3463
|
return false;
|
|
3259
3464
|
}
|
|
3260
3465
|
}
|
|
@@ -3264,9 +3469,9 @@ var RouteManager = class {
|
|
|
3264
3469
|
async hasRouteISR(modulePath) {
|
|
3265
3470
|
try {
|
|
3266
3471
|
const mod = await this.loadRouteModule(modulePath);
|
|
3267
|
-
const rendering = await
|
|
3472
|
+
const rendering = await _chunkX4K7TYN6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
3268
3473
|
return rendering.ssg && typeof rendering.revalidate === "number" && rendering.revalidate > 0;
|
|
3269
|
-
} catch (
|
|
3474
|
+
} catch (e15) {
|
|
3270
3475
|
return false;
|
|
3271
3476
|
}
|
|
3272
3477
|
}
|
|
@@ -3276,9 +3481,9 @@ var RouteManager = class {
|
|
|
3276
3481
|
async getRouteRevalidateInterval(modulePath) {
|
|
3277
3482
|
try {
|
|
3278
3483
|
const mod = await this.loadRouteModule(modulePath);
|
|
3279
|
-
const rendering = await
|
|
3484
|
+
const rendering = await _chunkX4K7TYN6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
3280
3485
|
return rendering.revalidate;
|
|
3281
|
-
} catch (
|
|
3486
|
+
} catch (e16) {
|
|
3282
3487
|
return void 0;
|
|
3283
3488
|
}
|
|
3284
3489
|
}
|
|
@@ -3358,14 +3563,14 @@ function replaceAll(input, search, replacement) {
|
|
|
3358
3563
|
async function safeGlobFiles(pattern, cwd) {
|
|
3359
3564
|
try {
|
|
3360
3565
|
return await _chunkQMNWKQL4cjs.globFiles.call(void 0, pattern, cwd);
|
|
3361
|
-
} catch (
|
|
3566
|
+
} catch (e17) {
|
|
3362
3567
|
return [];
|
|
3363
3568
|
}
|
|
3364
3569
|
}
|
|
3365
3570
|
function toRealPath(filePath) {
|
|
3366
3571
|
try {
|
|
3367
3572
|
return _fs.realpathSync.call(void 0, filePath);
|
|
3368
|
-
} catch (
|
|
3573
|
+
} catch (e18) {
|
|
3369
3574
|
return filePath;
|
|
3370
3575
|
}
|
|
3371
3576
|
}
|
|
@@ -3374,9 +3579,9 @@ function toRealPath(filePath) {
|
|
|
3374
3579
|
|
|
3375
3580
|
|
|
3376
3581
|
function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
|
|
3377
|
-
const file =
|
|
3378
|
-
if (!
|
|
3379
|
-
return `/${
|
|
3582
|
+
const file = path6.join(root, srcDir, "app", "globals.css");
|
|
3583
|
+
if (!fs4.existsSync(file)) return void 0;
|
|
3584
|
+
return `/${path6.relative(root, file).split(path6.sep).join("/")}`;
|
|
3380
3585
|
}
|
|
3381
3586
|
var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
|
|
3382
3587
|
var ALREADY_LINKED = "/src/app/globals.css";
|
|
@@ -3456,7 +3661,7 @@ function farmFontImportsPlugin(options = {}) {
|
|
|
3456
3661
|
return;
|
|
3457
3662
|
}
|
|
3458
3663
|
const resource = registry.getDevResource(pathname);
|
|
3459
|
-
if (!_optionalChain([resource, 'optionalAccess',
|
|
3664
|
+
if (!_optionalChain([resource, 'optionalAccess', _170 => _170.bytes])) {
|
|
3460
3665
|
next();
|
|
3461
3666
|
return;
|
|
3462
3667
|
}
|
|
@@ -3738,7 +3943,7 @@ ${FONT_SECTION_END}
|
|
|
3738
3943
|
let url;
|
|
3739
3944
|
try {
|
|
3740
3945
|
url = new URL(input.source);
|
|
3741
|
-
} catch (
|
|
3946
|
+
} catch (e19) {
|
|
3742
3947
|
throw fontError(input.moduleId, `remoteFont() source must be an absolute HTTPS URL`);
|
|
3743
3948
|
}
|
|
3744
3949
|
if (url.protocol !== "https:") {
|
|
@@ -3757,7 +3962,7 @@ ${FONT_SECTION_END}
|
|
|
3757
3962
|
return resource;
|
|
3758
3963
|
}
|
|
3759
3964
|
const bytes2 = await fetchRemoteFont(url, input.integrity);
|
|
3760
|
-
return this.createSelfHostedResource(bytes2, extension,
|
|
3965
|
+
return this.createSelfHostedResource(bytes2, extension, path6.default.basename(url.pathname));
|
|
3761
3966
|
}
|
|
3762
3967
|
if (input.source.startsWith("/")) {
|
|
3763
3968
|
return this.createPublicResource(input.moduleId, input.source);
|
|
@@ -3780,8 +3985,8 @@ ${FONT_SECTION_END}
|
|
|
3780
3985
|
}
|
|
3781
3986
|
return this.createSelfHostedResource(
|
|
3782
3987
|
bytes,
|
|
3783
|
-
|
|
3784
|
-
|
|
3988
|
+
path6.default.extname(resolvedPath),
|
|
3989
|
+
path6.default.basename(resolvedPath)
|
|
3785
3990
|
);
|
|
3786
3991
|
}
|
|
3787
3992
|
async createPublicResource(moduleId, source) {
|
|
@@ -3792,7 +3997,7 @@ ${FONT_SECTION_END}
|
|
|
3792
3997
|
);
|
|
3793
3998
|
}
|
|
3794
3999
|
const publicPath = normalizePublicFontPath(source, moduleId);
|
|
3795
|
-
const resolvedPath =
|
|
4000
|
+
const resolvedPath = path6.default.resolve(this.publicDir, `.${publicPath}`);
|
|
3796
4001
|
if (!isPathInside(this.publicDir, resolvedPath)) {
|
|
3797
4002
|
throw fontError(moduleId, `public font path must stay inside publicDir`);
|
|
3798
4003
|
}
|
|
@@ -3808,7 +4013,7 @@ ${FONT_SECTION_END}
|
|
|
3808
4013
|
`could not read ${JSON.stringify(source)} from publicDir: ${error.message}`
|
|
3809
4014
|
);
|
|
3810
4015
|
}
|
|
3811
|
-
const extension =
|
|
4016
|
+
const extension = path6.default.extname(resolvedPath).toLowerCase();
|
|
3812
4017
|
const hash = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex").slice(0, 12);
|
|
3813
4018
|
const resource = {
|
|
3814
4019
|
extension,
|
|
@@ -3823,7 +4028,7 @@ ${FONT_SECTION_END}
|
|
|
3823
4028
|
createSelfHostedResource(bytes, extension, fileName) {
|
|
3824
4029
|
const normalizedExtension = extension.toLowerCase();
|
|
3825
4030
|
const hash = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex").slice(0, 12);
|
|
3826
|
-
const baseName = sanitizeFileName(
|
|
4031
|
+
const baseName = sanitizeFileName(path6.default.basename(fileName, extension)) || "font";
|
|
3827
4032
|
const outputFileName = `assets/fonts/${baseName}-h${hash}${normalizedExtension}`;
|
|
3828
4033
|
const key = `${hash}${normalizedExtension}`;
|
|
3829
4034
|
const existing = this.resources.get(key);
|
|
@@ -3974,7 +4179,7 @@ function readFontOptions(code, id, call) {
|
|
|
3974
4179
|
const declaration = call.ancestors.at(-2);
|
|
3975
4180
|
const statement = call.ancestors.at(-3);
|
|
3976
4181
|
const statementParent = call.ancestors.at(-4);
|
|
3977
|
-
const isModuleScope = _optionalChain([declaration, 'optionalAccess',
|
|
4182
|
+
const isModuleScope = _optionalChain([declaration, 'optionalAccess', _171 => _171.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _172 => _172.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _173 => _173.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _174 => _174.type]) === "Program");
|
|
3978
4183
|
if (!isModuleScope || call.ancestors.some((ancestor) => isFunctionNode(ancestor))) {
|
|
3979
4184
|
throw fontError(id, `${call.kind}() must be declared directly at module scope`);
|
|
3980
4185
|
}
|
|
@@ -4176,24 +4381,24 @@ function verifyIntegrity(bytes, integrity) {
|
|
|
4176
4381
|
if (!matches) throw new Error("downloaded font did not match its integrity value");
|
|
4177
4382
|
}
|
|
4178
4383
|
function resolveLocalFontPath(source, importer, root) {
|
|
4179
|
-
if (source.startsWith(".")) return
|
|
4180
|
-
if (
|
|
4384
|
+
if (source.startsWith(".")) return path6.default.resolve(path6.default.dirname(importer), source);
|
|
4385
|
+
if (path6.default.isAbsolute(source)) {
|
|
4181
4386
|
return source;
|
|
4182
4387
|
}
|
|
4183
4388
|
try {
|
|
4184
4389
|
return _module.createRequire.call(void 0, _url.pathToFileURL.call(void 0, importer)).resolve(source);
|
|
4185
|
-
} catch (
|
|
4390
|
+
} catch (e20) {
|
|
4186
4391
|
const segments = source.replace(/\\/g, "/").split("/");
|
|
4187
|
-
if (segments.includes("..")) return
|
|
4188
|
-
let current =
|
|
4189
|
-
const filesystemRoot =
|
|
4392
|
+
if (segments.includes("..")) return path6.default.resolve(root, source);
|
|
4393
|
+
let current = path6.default.dirname(importer);
|
|
4394
|
+
const filesystemRoot = path6.default.parse(current).root;
|
|
4190
4395
|
while (true) {
|
|
4191
|
-
const candidate =
|
|
4396
|
+
const candidate = path6.default.join(current, "node_modules", ...segments);
|
|
4192
4397
|
if (_fs.existsSync.call(void 0, candidate)) return candidate;
|
|
4193
4398
|
if (current === filesystemRoot) break;
|
|
4194
|
-
current =
|
|
4399
|
+
current = path6.default.dirname(current);
|
|
4195
4400
|
}
|
|
4196
|
-
return
|
|
4401
|
+
return path6.default.resolve(root, "node_modules", ...segments);
|
|
4197
4402
|
}
|
|
4198
4403
|
}
|
|
4199
4404
|
function replaceFontSection(css, section) {
|
|
@@ -4226,11 +4431,11 @@ function getGlobalMap(key) {
|
|
|
4226
4431
|
return created;
|
|
4227
4432
|
}
|
|
4228
4433
|
function normalizeRoot(root) {
|
|
4229
|
-
return
|
|
4434
|
+
return path6.default.resolve(root).replace(/\\/g, "/");
|
|
4230
4435
|
}
|
|
4231
4436
|
function normalizePublicDir(root, publicDir) {
|
|
4232
4437
|
if (publicDir === false || publicDir === "") return false;
|
|
4233
|
-
return
|
|
4438
|
+
return path6.default.resolve(root, publicDir || "public");
|
|
4234
4439
|
}
|
|
4235
4440
|
function normalizePublicFontPath(source, moduleId) {
|
|
4236
4441
|
if (source.includes("?") || source.includes("#")) {
|
|
@@ -4239,8 +4444,8 @@ function normalizePublicFontPath(source, moduleId) {
|
|
|
4239
4444
|
return `/${source.replace(/\\/g, "/").replace(/^\/+/, "")}`;
|
|
4240
4445
|
}
|
|
4241
4446
|
function isPathInside(parent, child) {
|
|
4242
|
-
const relative3 =
|
|
4243
|
-
return relative3 === "" || !relative3.startsWith("..") && !
|
|
4447
|
+
const relative3 = path6.default.relative(parent, child);
|
|
4448
|
+
return relative3 === "" || !relative3.startsWith("..") && !path6.default.isAbsolute(relative3);
|
|
4244
4449
|
}
|
|
4245
4450
|
function normalizeBasePath(value) {
|
|
4246
4451
|
if (!value || value === "/") return "/";
|
|
@@ -4250,7 +4455,7 @@ function joinBasePath(basePath, value) {
|
|
|
4250
4455
|
return basePath === "/" ? value : `${basePath.replace(/\/$/, "")}${value}`;
|
|
4251
4456
|
}
|
|
4252
4457
|
function extensionFromPath(pathname) {
|
|
4253
|
-
const extension =
|
|
4458
|
+
const extension = path6.default.extname(pathname).toLowerCase();
|
|
4254
4459
|
if (!FONT_EXTENSION_RE.test(extension)) {
|
|
4255
4460
|
throw new Error(`[Farm fonts] Remote font URL must end in .woff2, .woff, .ttf, or .otf`);
|
|
4256
4461
|
}
|
|
@@ -4410,7 +4615,7 @@ function generateFarmIntegrationProviderClientCode(providers, root, rendererComp
|
|
|
4410
4615
|
let hasClerkProvider = false;
|
|
4411
4616
|
renderedProviders.forEach((provider, index) => {
|
|
4412
4617
|
let componentExpression = "null";
|
|
4413
|
-
if (
|
|
4618
|
+
if (_chunkI32V5CZLcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
|
|
4414
4619
|
const namespace = `FarmIntegrationProviderModule${index}`;
|
|
4415
4620
|
imports.push(
|
|
4416
4621
|
`import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
|
|
@@ -4467,7 +4672,7 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
|
|
|
4467
4672
|
const entries = [];
|
|
4468
4673
|
let needsMarkHelper = false;
|
|
4469
4674
|
providers.forEach((provider, index) => {
|
|
4470
|
-
if (!
|
|
4675
|
+
if (!_chunkI32V5CZLcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) return;
|
|
4471
4676
|
const namespace = `FarmServerIntegrationProviderModule${index}`;
|
|
4472
4677
|
imports.push(
|
|
4473
4678
|
`import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
|
|
@@ -4492,14 +4697,14 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
|
|
|
4492
4697
|
}
|
|
4493
4698
|
function resolveProviderModule(moduleId, root) {
|
|
4494
4699
|
if (!moduleId.startsWith(".")) return moduleId;
|
|
4495
|
-
return _chunkQMNWKQL4cjs.toViteModuleId.call(void 0,
|
|
4700
|
+
return _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, path6.default.resolve(root, moduleId), root);
|
|
4496
4701
|
}
|
|
4497
4702
|
|
|
4498
4703
|
// src/island-inference.ts
|
|
4499
4704
|
|
|
4500
4705
|
|
|
4501
4706
|
var _compiler = require('@farm.js/islx/compiler');
|
|
4502
|
-
|
|
4707
|
+
|
|
4503
4708
|
var PARSE_LANGS = /* @__PURE__ */ new Map([
|
|
4504
4709
|
[".tsx", "tsx"],
|
|
4505
4710
|
[".ts", "ts"],
|
|
@@ -4508,29 +4713,29 @@ var PARSE_LANGS = /* @__PURE__ */ new Map([
|
|
|
4508
4713
|
[".mjs", "js"]
|
|
4509
4714
|
]);
|
|
4510
4715
|
function parseFarmIslandSource(file, code) {
|
|
4511
|
-
const lang = PARSE_LANGS.get(
|
|
4512
|
-
if (!lang) throw new Error(`${
|
|
4716
|
+
const lang = PARSE_LANGS.get(path6.default.extname(file));
|
|
4717
|
+
if (!lang) throw new Error(`${path6.default.basename(file)} is not a script module`);
|
|
4513
4718
|
return _parseAst.parseAst.call(void 0, code, { lang });
|
|
4514
4719
|
}
|
|
4515
4720
|
function modifiedAt(file) {
|
|
4516
4721
|
try {
|
|
4517
|
-
return
|
|
4518
|
-
} catch (
|
|
4722
|
+
return fs4.default.statSync(file).mtimeMs;
|
|
4723
|
+
} catch (e21) {
|
|
4519
4724
|
return -1;
|
|
4520
4725
|
}
|
|
4521
4726
|
}
|
|
4522
4727
|
var inferences = /* @__PURE__ */ new Map();
|
|
4523
4728
|
function inferFarmIslandStrategy(filePath, root) {
|
|
4524
|
-
const file =
|
|
4729
|
+
const file = path6.default.resolve(filePath);
|
|
4525
4730
|
const cached = inferences.get(file);
|
|
4526
4731
|
if (cached && cached.stamps.every(([read, stamp]) => modifiedAt(read) === stamp)) {
|
|
4527
4732
|
return cached.result;
|
|
4528
4733
|
}
|
|
4529
4734
|
let code;
|
|
4530
4735
|
try {
|
|
4531
|
-
code =
|
|
4532
|
-
} catch (
|
|
4533
|
-
return { strategy: null, files: [file], reason: `${
|
|
4736
|
+
code = fs4.default.readFileSync(file, "utf8");
|
|
4737
|
+
} catch (e22) {
|
|
4738
|
+
return { strategy: null, files: [file], reason: `${path6.default.basename(file)} could not be read` };
|
|
4534
4739
|
}
|
|
4535
4740
|
const result = _compiler.inferStrategy.call(void 0, file, code, {
|
|
4536
4741
|
parse: parseFarmIslandSource,
|
|
@@ -4554,7 +4759,7 @@ function inferFarmRouteRootStrategy(owners, root) {
|
|
|
4554
4759
|
return {
|
|
4555
4760
|
strategy: null,
|
|
4556
4761
|
files,
|
|
4557
|
-
reason: `${
|
|
4762
|
+
reason: `${path6.default.basename(owner)}: its client components could not be listed`
|
|
4558
4763
|
};
|
|
4559
4764
|
}
|
|
4560
4765
|
modules.push(...rendered);
|
|
@@ -4562,8 +4767,8 @@ function inferFarmRouteRootStrategy(owners, root) {
|
|
|
4562
4767
|
for (const module of modules) {
|
|
4563
4768
|
let source = null;
|
|
4564
4769
|
try {
|
|
4565
|
-
source =
|
|
4566
|
-
} catch (
|
|
4770
|
+
source = fs4.default.readFileSync(module, "utf8");
|
|
4771
|
+
} catch (e23) {
|
|
4567
4772
|
}
|
|
4568
4773
|
if (getIslandStrategyExport(source) !== null) return { strategy: null, files, declared: true };
|
|
4569
4774
|
}
|
|
@@ -4619,15 +4824,15 @@ var MOBILE_SHELL_CLIENT_REGISTRATION = ` {
|
|
|
4619
4824
|
}`;
|
|
4620
4825
|
var APP_CLIENT_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
4621
4826
|
function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
|
|
4622
|
-
const sourceRoot =
|
|
4827
|
+
const sourceRoot = path6.default.resolve(root, srcDir);
|
|
4623
4828
|
for (const extension of APP_CLIENT_EXTENSIONS) {
|
|
4624
|
-
const candidate =
|
|
4625
|
-
if (
|
|
4829
|
+
const candidate = path6.default.join(sourceRoot, `client.${extension}`);
|
|
4830
|
+
if (fs4.default.existsSync(candidate) && fs4.default.statSync(candidate).isFile()) return candidate;
|
|
4626
4831
|
}
|
|
4627
4832
|
return void 0;
|
|
4628
4833
|
}
|
|
4629
4834
|
function resolveFarmClientPlugins(plugins, _root) {
|
|
4630
|
-
if (!_optionalChain([plugins, 'optionalAccess',
|
|
4835
|
+
if (!_optionalChain([plugins, 'optionalAccess', _175 => _175.length])) return [];
|
|
4631
4836
|
return plugins.flatMap((plugin) => {
|
|
4632
4837
|
if (!plugin.client) return [];
|
|
4633
4838
|
assertClientLifecycle(plugin.client, plugin.name);
|
|
@@ -4709,7 +4914,7 @@ function assertLifecycleObject(value, pluginName, location, allowedKeys) {
|
|
|
4709
4914
|
throw new TypeError(`Client plugin "${pluginName}" has an unknown ${location}.${key} option`);
|
|
4710
4915
|
}
|
|
4711
4916
|
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
4712
|
-
if (!_optionalChain([descriptor, 'optionalAccess',
|
|
4917
|
+
if (!_optionalChain([descriptor, 'optionalAccess', _176 => _176.enumerable])) {
|
|
4713
4918
|
throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} must be enumerable`);
|
|
4714
4919
|
}
|
|
4715
4920
|
if (!("value" in descriptor)) {
|
|
@@ -4827,7 +5032,7 @@ function assertPublicData(value, pluginName) {
|
|
|
4827
5032
|
throwPublicDataError(pluginName, pathSegments, "cannot contain symbol keys");
|
|
4828
5033
|
}
|
|
4829
5034
|
const descriptor = Object.getOwnPropertyDescriptor(current, key);
|
|
4830
|
-
if (!_optionalChain([descriptor, 'optionalAccess',
|
|
5035
|
+
if (!_optionalChain([descriptor, 'optionalAccess', _177 => _177.enumerable])) {
|
|
4831
5036
|
throwPublicDataError(
|
|
4832
5037
|
pluginName,
|
|
4833
5038
|
[...pathSegments, key],
|
|
@@ -4876,15 +5081,15 @@ var _stream = require('stream');
|
|
|
4876
5081
|
|
|
4877
5082
|
function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
4878
5083
|
const extensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
|
|
4879
|
-
const configuredPath = _optionalChain([config, 'access',
|
|
5084
|
+
const configuredPath = _optionalChain([config, 'access', _178 => _178.notFound, 'optionalAccess', _179 => _179.component, 'optionalAccess', _180 => _180.trim, 'call', _181 => _181()]);
|
|
4880
5085
|
if (configuredPath) {
|
|
4881
|
-
const componentPath =
|
|
5086
|
+
const componentPath = path6.default.isAbsolute(configuredPath) ? path6.default.normalize(configuredPath) : path6.default.resolve(config.root, configuredPath);
|
|
4882
5087
|
if (!extensions.some((extension) => componentPath.endsWith(extension))) {
|
|
4883
5088
|
throw new Error(
|
|
4884
5089
|
`notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
|
|
4885
5090
|
);
|
|
4886
5091
|
}
|
|
4887
|
-
if (!
|
|
5092
|
+
if (!fs4.default.existsSync(componentPath) || !fs4.default.statSync(componentPath).isFile()) {
|
|
4888
5093
|
throw new Error(`notFound.component was not found: ${componentPath}`);
|
|
4889
5094
|
}
|
|
4890
5095
|
return componentPath;
|
|
@@ -4892,8 +5097,8 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
|
4892
5097
|
let discoveredPath = null;
|
|
4893
5098
|
for (const appDir of appDirs) {
|
|
4894
5099
|
for (const extension of extensions) {
|
|
4895
|
-
const candidate =
|
|
4896
|
-
if (
|
|
5100
|
+
const candidate = path6.default.join(appDir, `not-found${extension}`);
|
|
5101
|
+
if (fs4.default.existsSync(candidate) && fs4.default.statSync(candidate).isFile()) {
|
|
4897
5102
|
discoveredPath = candidate;
|
|
4898
5103
|
break;
|
|
4899
5104
|
}
|
|
@@ -5098,14 +5303,14 @@ function redactErrorText(value) {
|
|
|
5098
5303
|
return value.replace(BEARER_PATTERN, "$1[REDACTED]").replace(SECRET_VALUE_PATTERN, "$1=[REDACTED]");
|
|
5099
5304
|
}
|
|
5100
5305
|
function isPathInsideRoot(root, filePath) {
|
|
5101
|
-
const relative3 =
|
|
5102
|
-
return relative3 === "" || !relative3.startsWith("..") && !
|
|
5306
|
+
const relative3 = path12.relative(root, filePath);
|
|
5307
|
+
return relative3 === "" || !relative3.startsWith("..") && !path12.isAbsolute(relative3);
|
|
5103
5308
|
}
|
|
5104
5309
|
function normalizeStackPath(value) {
|
|
5105
5310
|
const withoutQuery = value.replace(/[?#].*$/, "");
|
|
5106
5311
|
try {
|
|
5107
5312
|
return withoutQuery.startsWith("file://") ? _url.fileURLToPath.call(void 0, withoutQuery) : withoutQuery;
|
|
5108
|
-
} catch (
|
|
5313
|
+
} catch (e24) {
|
|
5109
5314
|
return void 0;
|
|
5110
5315
|
}
|
|
5111
5316
|
}
|
|
@@ -5116,13 +5321,13 @@ function findStackLocation(stack, root) {
|
|
|
5116
5321
|
);
|
|
5117
5322
|
if (!match) continue;
|
|
5118
5323
|
const candidate = normalizeStackPath(match[1]);
|
|
5119
|
-
if (!candidate || candidate.includes(`${
|
|
5120
|
-
const absolutePath =
|
|
5121
|
-
if (!isPathInsideRoot(root, absolutePath) || !
|
|
5122
|
-
const relativePath =
|
|
5324
|
+
if (!candidate || candidate.includes(`${path12.sep}node_modules${path12.sep}`)) continue;
|
|
5325
|
+
const absolutePath = path12.resolve(candidate);
|
|
5326
|
+
if (!isPathInsideRoot(root, absolutePath) || !fs8.existsSync(absolutePath)) continue;
|
|
5327
|
+
const relativePath = path12.relative(root, absolutePath).split(path12.sep).join("/");
|
|
5123
5328
|
return {
|
|
5124
5329
|
absolutePath,
|
|
5125
|
-
displayPath: relativePath ||
|
|
5330
|
+
displayPath: relativePath || path12.basename(absolutePath),
|
|
5126
5331
|
line: Number(match[2]),
|
|
5127
5332
|
column: Number(match[3])
|
|
5128
5333
|
};
|
|
@@ -5131,7 +5336,7 @@ function findStackLocation(stack, root) {
|
|
|
5131
5336
|
}
|
|
5132
5337
|
function createSourceFrame(location) {
|
|
5133
5338
|
try {
|
|
5134
|
-
const sourceLines =
|
|
5339
|
+
const sourceLines = fs8.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
|
|
5135
5340
|
if (location.line < 1 || location.line > sourceLines.length) return void 0;
|
|
5136
5341
|
const start = Math.max(1, location.line - 2);
|
|
5137
5342
|
const end = Math.min(sourceLines.length, location.line + 2);
|
|
@@ -5149,18 +5354,18 @@ function createSourceFrame(location) {
|
|
|
5149
5354
|
column: location.column,
|
|
5150
5355
|
lines
|
|
5151
5356
|
};
|
|
5152
|
-
} catch (
|
|
5357
|
+
} catch (e25) {
|
|
5153
5358
|
return void 0;
|
|
5154
5359
|
}
|
|
5155
5360
|
}
|
|
5156
5361
|
function sanitizeStack(stack, root) {
|
|
5157
|
-
const normalizedRoot =
|
|
5362
|
+
const normalizedRoot = path12.resolve(root);
|
|
5158
5363
|
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");
|
|
5159
5364
|
}
|
|
5160
5365
|
function createDefaultErrorDiagnostics(error, root) {
|
|
5161
5366
|
const normalizedError = error instanceof Error ? error : new Error(typeof error === "string" ? error : "Unknown server rendering error");
|
|
5162
5367
|
const rawStack = normalizedError.stack || `${normalizedError.name}: ${normalizedError.message}`;
|
|
5163
|
-
const location = findStackLocation(rawStack,
|
|
5368
|
+
const location = findStackLocation(rawStack, path12.resolve(root));
|
|
5164
5369
|
return {
|
|
5165
5370
|
name: redactErrorText(normalizedError.name || "Error"),
|
|
5166
5371
|
message: redactErrorText(normalizedError.message || "Unknown server rendering error"),
|
|
@@ -5173,7 +5378,7 @@ function createDefaultErrorDiagnostics(error, root) {
|
|
|
5173
5378
|
function canBootFarmIslandsClient(config) {
|
|
5174
5379
|
const docs = config.docs;
|
|
5175
5380
|
const docsEnabled = docs === true || typeof docs === "object" && docs !== null && docs.enabled !== false;
|
|
5176
|
-
return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
5381
|
+
return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _182 => _182.experimental, 'optionalAccess', _183 => _183.serverComponents])) === "islands" && !docsEnabled && resolveFarmClientPlugins(config.plugins, config.root).length === 0 && !resolveFarmAppClientEntry(config.root, config.srcDir || "src");
|
|
5177
5382
|
}
|
|
5178
5383
|
|
|
5179
5384
|
// src/server/renderer.ts
|
|
@@ -5283,7 +5488,7 @@ function appendResponseHeader(res, name, value) {
|
|
|
5283
5488
|
}
|
|
5284
5489
|
}
|
|
5285
5490
|
function requestHeader(req, name) {
|
|
5286
|
-
const value = _optionalChain([req, 'access',
|
|
5491
|
+
const value = _optionalChain([req, 'access', _184 => _184.headers, 'optionalAccess', _185 => _185[name]]);
|
|
5287
5492
|
return Array.isArray(value) ? value[0] : value;
|
|
5288
5493
|
}
|
|
5289
5494
|
function appendResponseVary(res, value) {
|
|
@@ -5392,12 +5597,12 @@ async function parseRouteModuleProps(routeModule, input) {
|
|
|
5392
5597
|
}
|
|
5393
5598
|
const schemas = routeModule.__farmRouteSchemas;
|
|
5394
5599
|
const params = parseRouteModuleSchema(
|
|
5395
|
-
_optionalChain([schemas, 'optionalAccess',
|
|
5600
|
+
_optionalChain([schemas, 'optionalAccess', _186 => _186.params]),
|
|
5396
5601
|
input.props.params,
|
|
5397
5602
|
"params",
|
|
5398
5603
|
input.routePath
|
|
5399
5604
|
);
|
|
5400
|
-
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess',
|
|
5605
|
+
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _187 => _187.search]), input.search, "search", input.routePath);
|
|
5401
5606
|
return {
|
|
5402
5607
|
...input.props,
|
|
5403
5608
|
params,
|
|
@@ -5429,9 +5634,9 @@ function createRouteStateProps(input) {
|
|
|
5429
5634
|
function readAppPackageIdentity(root) {
|
|
5430
5635
|
try {
|
|
5431
5636
|
return JSON.parse(
|
|
5432
|
-
|
|
5637
|
+
fs9.readFileSync(path13.join(root || process.cwd(), "package.json"), "utf8")
|
|
5433
5638
|
);
|
|
5434
|
-
} catch (
|
|
5639
|
+
} catch (e26) {
|
|
5435
5640
|
return {};
|
|
5436
5641
|
}
|
|
5437
5642
|
}
|
|
@@ -5455,7 +5660,7 @@ var ServerRenderer = class {
|
|
|
5455
5660
|
} else {
|
|
5456
5661
|
_chunkXGJVRPYLcjs.uninstallFarmIslandValues.call(void 0, );
|
|
5457
5662
|
}
|
|
5458
|
-
if (_optionalChain([this, 'access',
|
|
5663
|
+
if (_optionalChain([this, 'access', _188 => _188.config, 'access', _189 => _189.notFound, 'optionalAccess', _190 => _190.component, 'optionalAccess', _191 => _191.trim, 'call', _192 => _192()])) {
|
|
5459
5664
|
resolveFarmNotFoundComponentPath(this.config, _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, this.config));
|
|
5460
5665
|
}
|
|
5461
5666
|
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,
|
|
@@ -5480,7 +5685,7 @@ var ServerRenderer = class {
|
|
|
5480
5685
|
"node"
|
|
5481
5686
|
);
|
|
5482
5687
|
this.rendererRuntime = islands && this.islandValues() ? withFarmIslandsRenders(runtime, islands) : runtime;
|
|
5483
|
-
_optionalChain([this, 'access',
|
|
5688
|
+
_optionalChain([this, 'access', _193 => _193.routeManager, 'access', _194 => _194.setRendererRuntime, 'optionalCall', _195 => _195(this.rendererRuntime)]);
|
|
5484
5689
|
await this.applyRendererAppSetup();
|
|
5485
5690
|
}
|
|
5486
5691
|
/**
|
|
@@ -5537,7 +5742,7 @@ var ServerRenderer = class {
|
|
|
5537
5742
|
/// Stylesheets the app imported through JS (fontsource packages, component
|
|
5538
5743
|
/// CSS) that the document must link alongside globals.css — see #658.
|
|
5539
5744
|
collectDevStyleHrefs() {
|
|
5540
|
-
const graph = _optionalChain([this, 'access',
|
|
5745
|
+
const graph = _optionalChain([this, 'access', _196 => _196.viteServer, 'optionalAccess', _197 => _197.moduleGraph]);
|
|
5541
5746
|
if (!graph) return [];
|
|
5542
5747
|
return collectDevStylesheetUrls(
|
|
5543
5748
|
graph.idToModuleMap.values(),
|
|
@@ -5562,7 +5767,7 @@ var ServerRenderer = class {
|
|
|
5562
5767
|
"data-farm-layout-boundary": "true",
|
|
5563
5768
|
"data-farm-layout-pattern": pattern,
|
|
5564
5769
|
...segment ? { "data-farm-layout-key": segment.key } : {},
|
|
5565
|
-
..._optionalChain([segment, 'optionalAccess',
|
|
5770
|
+
..._optionalChain([segment, 'optionalAccess', _198 => _198.kept]) ? { "data-farm-layout-kept": "true" } : {},
|
|
5566
5771
|
style: { display: "contents" }
|
|
5567
5772
|
},
|
|
5568
5773
|
layoutElement
|
|
@@ -5649,7 +5854,7 @@ var ServerRenderer = class {
|
|
|
5649
5854
|
}
|
|
5650
5855
|
/** Islands mode sends large prop values once, keyed by content (RFC 0003). */
|
|
5651
5856
|
islandValues() {
|
|
5652
|
-
return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
5857
|
+
return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _199 => _199.config, 'access', _200 => _200.experimental, 'optionalAccess', _201 => _201.serverComponents])) === "islands";
|
|
5653
5858
|
}
|
|
5654
5859
|
/**
|
|
5655
5860
|
* Render the route tree used by client navigation without producing a second
|
|
@@ -5724,7 +5929,7 @@ var ServerRenderer = class {
|
|
|
5724
5929
|
async runWithRequestContext(request2, fn) {
|
|
5725
5930
|
return _chunkHNAISJFDcjs._runWithCurrentRequest.call(void 0,
|
|
5726
5931
|
request2,
|
|
5727
|
-
() => _optionalChain([this, 'access',
|
|
5932
|
+
() => _optionalChain([this, 'access', _202 => _202.i18nRuntime, 'optionalAccess', _203 => _203.config, 'access', _204 => _204.enabled]) ? _chunkRVGLYMJMcjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
|
|
5728
5933
|
redirect: false
|
|
5729
5934
|
}) : fn()
|
|
5730
5935
|
);
|
|
@@ -5736,10 +5941,10 @@ var ServerRenderer = class {
|
|
|
5736
5941
|
* Load SSG manifest from build output
|
|
5737
5942
|
*/
|
|
5738
5943
|
loadSSGManifest() {
|
|
5739
|
-
const manifestPath =
|
|
5944
|
+
const manifestPath = path13.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
|
|
5740
5945
|
let content;
|
|
5741
5946
|
try {
|
|
5742
|
-
content =
|
|
5947
|
+
content = fs9.readFileSync(manifestPath, "utf-8");
|
|
5743
5948
|
} catch (error) {
|
|
5744
5949
|
if (error.code === "ENOENT") {
|
|
5745
5950
|
return;
|
|
@@ -5755,7 +5960,7 @@ var ServerRenderer = class {
|
|
|
5755
5960
|
* Check if a path should be served from SSG cache
|
|
5756
5961
|
*/
|
|
5757
5962
|
async shouldServeSSG(pathname) {
|
|
5758
|
-
const ssgPage =
|
|
5963
|
+
const ssgPage = _chunkX4K7TYN6cjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
|
|
5759
5964
|
if (!ssgPage) return null;
|
|
5760
5965
|
const cached = await this.getCachedSSGPage(pathname);
|
|
5761
5966
|
if (cached && await this.dataCache.isStaleAsync(cached)) {
|
|
@@ -5872,7 +6077,7 @@ var ServerRenderer = class {
|
|
|
5872
6077
|
setImmediate(async () => {
|
|
5873
6078
|
try {
|
|
5874
6079
|
const mod = await this.routeManager.loadRouteModule(page.filePath);
|
|
5875
|
-
if (!_optionalChain([mod, 'optionalAccess',
|
|
6080
|
+
if (!_optionalChain([mod, 'optionalAccess', _205 => _205.default])) return;
|
|
5876
6081
|
const { route, layouts } = this.routeManager.matchRoute(page.urlPath);
|
|
5877
6082
|
const layoutModules = await Promise.all(
|
|
5878
6083
|
layouts.map((l) => this.routeManager.loadLayoutModule(l.modulePath))
|
|
@@ -5886,7 +6091,7 @@ var ServerRenderer = class {
|
|
|
5886
6091
|
};
|
|
5887
6092
|
let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
|
|
5888
6093
|
const pageMetadata = _nullishCoalesce(routeManifest.routes.find(
|
|
5889
|
-
(entry) => entry.pattern === _optionalChain([route, 'optionalAccess',
|
|
6094
|
+
(entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _206 => _206.pattern])
|
|
5890
6095
|
), () => ( {
|
|
5891
6096
|
shouldHydrate: false,
|
|
5892
6097
|
islandStrategy: null
|
|
@@ -5958,10 +6163,10 @@ var ServerRenderer = class {
|
|
|
5958
6163
|
return true;
|
|
5959
6164
|
}
|
|
5960
6165
|
try {
|
|
5961
|
-
const htmlPath = page.urlPath === "/" ?
|
|
5962
|
-
if (
|
|
5963
|
-
const stat =
|
|
5964
|
-
const html =
|
|
6166
|
+
const htmlPath = page.urlPath === "/" ? path13.join(this.config.root, this.config.outDir, "client", "index.html") : path13.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
|
|
6167
|
+
if (fs9.existsSync(htmlPath)) {
|
|
6168
|
+
const stat = fs9.statSync(htmlPath);
|
|
6169
|
+
const html = fs9.readFileSync(htmlPath, "utf-8");
|
|
5965
6170
|
await this.cacheSSGPage(page, html, {
|
|
5966
6171
|
document: true,
|
|
5967
6172
|
createdAt: stat.mtimeMs
|
|
@@ -5996,10 +6201,10 @@ var ServerRenderer = class {
|
|
|
5996
6201
|
res.setHeader(header.key, header.value);
|
|
5997
6202
|
}
|
|
5998
6203
|
const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5999
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6204
|
+
trustProxy: _optionalChain([this, 'access', _207 => _207.config, 'access', _208 => _208.server, 'optionalAccess', _209 => _209.trustProxy])
|
|
6000
6205
|
});
|
|
6001
6206
|
const runtime = this.i18nRuntime;
|
|
6002
|
-
if (_optionalChain([runtime, 'optionalAccess',
|
|
6207
|
+
if (_optionalChain([runtime, 'optionalAccess', _210 => _210.config, 'access', _211 => _211.enabled])) {
|
|
6003
6208
|
const resolution = runtime.resolveRequest(request2);
|
|
6004
6209
|
const varyHeaders = _chunkVOQ7XZZTcjs.getFarmLocaleVaryHeaders.call(void 0, runtime.config, resolution);
|
|
6005
6210
|
for (const header of varyHeaders) appendResponseVary(res, header);
|
|
@@ -6045,7 +6250,7 @@ var ServerRenderer = class {
|
|
|
6045
6250
|
});
|
|
6046
6251
|
};
|
|
6047
6252
|
try {
|
|
6048
|
-
const url = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
6253
|
+
const url = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _212 => _212.config, 'access', _213 => _213.server, 'optionalAccess', _214 => _214.trustProxy]) });
|
|
6049
6254
|
pathname = url.pathname;
|
|
6050
6255
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.start", route: pathname, pathname });
|
|
6051
6256
|
searchParamsObject = _chunkSUCDVKUBcjs.searchParamsToObject.call(void 0, url.searchParams);
|
|
@@ -6125,17 +6330,17 @@ var ServerRenderer = class {
|
|
|
6125
6330
|
params
|
|
6126
6331
|
});
|
|
6127
6332
|
let actionRequest;
|
|
6128
|
-
if (req.method === "POST" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
6333
|
+
if (req.method === "POST" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _215 => _215.config, 'access', _216 => _216.experimental, 'optionalAccess', _217 => _217.serverComponents])) === "islands") {
|
|
6129
6334
|
await Promise.all([
|
|
6130
6335
|
this.routeManager.loadRouteModule(route.modulePath),
|
|
6131
6336
|
...layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
|
|
6132
6337
|
]);
|
|
6133
6338
|
actionRequest = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6134
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6339
|
+
trustProxy: _optionalChain([this, 'access', _218 => _218.config, 'access', _219 => _219.server, 'optionalAccess', _220 => _220.trustProxy])
|
|
6135
6340
|
});
|
|
6136
|
-
const actionResponse = await
|
|
6341
|
+
const actionResponse = await _chunkCLFEQGETcjs.handleFarmFormActionRequest.call(void 0,
|
|
6137
6342
|
actionRequest,
|
|
6138
|
-
|
|
6343
|
+
_chunk4P5634G6cjs.resolveServerActionsConfig.call(void 0, this.config.serverActions)
|
|
6139
6344
|
);
|
|
6140
6345
|
if (actionResponse) {
|
|
6141
6346
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, actionResponse);
|
|
@@ -6151,7 +6356,7 @@ var ServerRenderer = class {
|
|
|
6151
6356
|
exposedOnly: true
|
|
6152
6357
|
});
|
|
6153
6358
|
const currentRequest = _nullishCoalesce(actionRequest, () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6154
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6359
|
+
trustProxy: _optionalChain([this, 'access', _221 => _221.config, 'access', _222 => _222.server, 'optionalAccess', _223 => _223.trustProxy])
|
|
6155
6360
|
})));
|
|
6156
6361
|
const routeContext = await this.resolveRouteContext({
|
|
6157
6362
|
request: currentRequest,
|
|
@@ -6193,11 +6398,11 @@ var ServerRenderer = class {
|
|
|
6193
6398
|
searchParams: _chunkSUCDVKUBcjs.createFarmSearchParams.call(void 0, searchParamsObject),
|
|
6194
6399
|
error
|
|
6195
6400
|
};
|
|
6196
|
-
if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess',
|
|
6401
|
+
if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _224 => _224.notFound])) {
|
|
6197
6402
|
res.statusCode = 404;
|
|
6198
6403
|
PageComponent = programmaticRouteComponents.notFound;
|
|
6199
6404
|
pageProps = routeStateProps;
|
|
6200
|
-
} else if (_optionalChain([programmaticRouteComponents, 'optionalAccess',
|
|
6405
|
+
} else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _225 => _225.error])) {
|
|
6201
6406
|
res.statusCode = 500;
|
|
6202
6407
|
PageComponent = programmaticRouteComponents.error;
|
|
6203
6408
|
pageProps = routeStateProps;
|
|
@@ -6205,10 +6410,10 @@ var ServerRenderer = class {
|
|
|
6205
6410
|
throw error;
|
|
6206
6411
|
}
|
|
6207
6412
|
}
|
|
6208
|
-
const renderingConfig = await
|
|
6413
|
+
const renderingConfig = await _chunkX4K7TYN6cjs.resolveRouteRenderingConfigFromFile.call(void 0,
|
|
6209
6414
|
routeModule,
|
|
6210
6415
|
route.modulePath,
|
|
6211
|
-
{ experimentalPPR: _optionalChain([this, 'access',
|
|
6416
|
+
{ experimentalPPR: _optionalChain([this, 'access', _226 => _226.config, 'access', _227 => _227.experimental, 'optionalAccess', _228 => _228.ppr]) === true }
|
|
6212
6417
|
);
|
|
6213
6418
|
const pprBypassReason = renderingConfig.ppr ? this.getPPRShellBypassReason(req, middlewareMap, middlewareContext, pluginExposedContext) : void 0;
|
|
6214
6419
|
const islandsNavigationRequest = Boolean(
|
|
@@ -6219,7 +6424,7 @@ var ServerRenderer = class {
|
|
|
6219
6424
|
const pprShellOptions = canCachePPRShell ? {
|
|
6220
6425
|
pathname,
|
|
6221
6426
|
search: url.search,
|
|
6222
|
-
locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess',
|
|
6427
|
+
locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _229 => _229.locale]), () => ( "")),
|
|
6223
6428
|
origin: pprI18nSnapshot && pprI18nSnapshot.routing !== "none" ? url.origin : "",
|
|
6224
6429
|
revalidate: renderingConfig.revalidate
|
|
6225
6430
|
} : void 0;
|
|
@@ -6342,20 +6547,20 @@ var ServerRenderer = class {
|
|
|
6342
6547
|
if (moduleMetadata.suppressedAsyncHydration) {
|
|
6343
6548
|
warnSuppressedAsyncHydrationOnce(
|
|
6344
6549
|
route.modulePath,
|
|
6345
|
-
_optionalChain([routeManifestEntry, 'optionalAccess',
|
|
6550
|
+
_optionalChain([routeManifestEntry, 'optionalAccess', _230 => _230.suppressedAsyncHydrationReason])
|
|
6346
6551
|
);
|
|
6347
6552
|
}
|
|
6348
6553
|
const layoutHydrationMetadata = layouts.map((layout) => {
|
|
6349
6554
|
const manifestEntry = routeManifest.layouts.find(
|
|
6350
6555
|
(entry) => entry.pattern === layout.pattern
|
|
6351
6556
|
);
|
|
6352
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
6557
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _231 => _231.suppressedAsyncHydration])) {
|
|
6353
6558
|
warnSuppressedAsyncHydrationOnce(
|
|
6354
6559
|
layout.modulePath,
|
|
6355
6560
|
manifestEntry.suppressedAsyncHydrationReason
|
|
6356
6561
|
);
|
|
6357
6562
|
}
|
|
6358
|
-
if (typeof _optionalChain([manifestEntry, 'optionalAccess',
|
|
6563
|
+
if (typeof _optionalChain([manifestEntry, 'optionalAccess', _232 => _232.shouldHydrate]) === "boolean") {
|
|
6359
6564
|
return {
|
|
6360
6565
|
isClientComponent: manifestEntry.isClientComponent === true,
|
|
6361
6566
|
shouldHydrate: manifestEntry.shouldHydrate,
|
|
@@ -6376,11 +6581,11 @@ var ServerRenderer = class {
|
|
|
6376
6581
|
const clientLayouts = layouts.map((layout, index) => ({
|
|
6377
6582
|
pattern: layout.pattern,
|
|
6378
6583
|
modulePath: _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, layout.modulePath, this.config.root),
|
|
6379
|
-
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access',
|
|
6380
|
-
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access',
|
|
6381
|
-
..._optionalChain([layoutHydrationMetadata, 'access',
|
|
6584
|
+
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _233 => _233[index], 'optionalAccess', _234 => _234.shouldHydrate]) === true,
|
|
6585
|
+
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _235 => _235[index], 'optionalAccess', _236 => _236.islandStrategy]), () => ( null)),
|
|
6586
|
+
..._optionalChain([layoutHydrationMetadata, 'access', _237 => _237[index], 'optionalAccess', _238 => _238.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {},
|
|
6382
6587
|
// Islands mode: the browser rebuilds this layout from its tree, not its module.
|
|
6383
|
-
...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access',
|
|
6588
|
+
...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _239 => _239[index], 'optionalAccess', _240 => _240.serverTree]) === true ? { serverTree: true } : {}
|
|
6384
6589
|
}));
|
|
6385
6590
|
const hydrationStrategies = [
|
|
6386
6591
|
...shouldHydrate && moduleMetadata.islandStrategy ? [moduleMetadata.islandStrategy] : [],
|
|
@@ -6394,9 +6599,9 @@ var ServerRenderer = class {
|
|
|
6394
6599
|
layouts.map((layout, index) => ({
|
|
6395
6600
|
pattern: layout.pattern,
|
|
6396
6601
|
modulePath: layout.modulePath,
|
|
6397
|
-
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access',
|
|
6398
|
-
hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access',
|
|
6399
|
-
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access',
|
|
6602
|
+
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _241 => _241[index], 'optionalAccess', _242 => _242.shouldHydrate]) === true,
|
|
6603
|
+
hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _243 => _243[index], 'optionalAccess', _244 => _244.hasIsolatedClientBoundaries]) === true,
|
|
6604
|
+
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _245 => _245[index], 'optionalAccess', _246 => _246.islandStrategy]), () => ( null))
|
|
6400
6605
|
})),
|
|
6401
6606
|
this.config.root || process.cwd(),
|
|
6402
6607
|
true
|
|
@@ -6404,7 +6609,7 @@ var ServerRenderer = class {
|
|
|
6404
6609
|
const hasHydratableRouteSlots = renderedRouteSlots.some(
|
|
6405
6610
|
(slot) => slot.isClientComponent || slot.shouldHydrate
|
|
6406
6611
|
);
|
|
6407
|
-
const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess',
|
|
6612
|
+
const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _247 => _247.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
|
|
6408
6613
|
req.__FARM_PAGE_PATH__ = route.modulePath;
|
|
6409
6614
|
req.__FARM_ROUTE__ = pathname;
|
|
6410
6615
|
req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
|
|
@@ -6417,7 +6622,7 @@ var ServerRenderer = class {
|
|
|
6417
6622
|
req.__FARM_SHOULD_HYDRATE__ = shouldHydrate || shouldHydrateLayout || hasIsolatedClientBoundaries;
|
|
6418
6623
|
req.__FARM_ISLAND_STRATEGY__ = hydrationIslandStrategy;
|
|
6419
6624
|
req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ = hasHydratableRouteSlots;
|
|
6420
|
-
req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess',
|
|
6625
|
+
req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _248 => _248.modulePath]) ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
|
|
6421
6626
|
req.__FARM_ROUTE_SLOTS__ = renderedRouteSlots.map((slot) => ({
|
|
6422
6627
|
name: slot.name,
|
|
6423
6628
|
ownerPattern: slot.ownerPattern,
|
|
@@ -6489,7 +6694,7 @@ var ServerRenderer = class {
|
|
|
6489
6694
|
} else if (shouldHydrateLayout && !(isClientComponent || shouldHydrate) && this.rendererRuntime.isolateServerPageGraph) {
|
|
6490
6695
|
pageElement = await this.isolateServerPage(
|
|
6491
6696
|
pageElement,
|
|
6492
|
-
_optionalChain([routeManifestEntry, 'optionalAccess',
|
|
6697
|
+
_optionalChain([routeManifestEntry, 'optionalAccess', _249 => _249.serverTree]) === true
|
|
6493
6698
|
);
|
|
6494
6699
|
}
|
|
6495
6700
|
pageElement = this.createPageBoundary(pageElement, {
|
|
@@ -6532,7 +6737,7 @@ var ServerRenderer = class {
|
|
|
6532
6737
|
);
|
|
6533
6738
|
slotProps[slot.name] = slotElement;
|
|
6534
6739
|
}
|
|
6535
|
-
wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access',
|
|
6740
|
+
wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _250 => _250[i], 'optionalAccess', _251 => _251.serverTree]) === true && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
|
|
6536
6741
|
LayoutComponent,
|
|
6537
6742
|
{ params },
|
|
6538
6743
|
{ children: wrappedElement, ...slotProps },
|
|
@@ -6703,7 +6908,7 @@ var ServerRenderer = class {
|
|
|
6703
6908
|
}
|
|
6704
6909
|
}
|
|
6705
6910
|
async wrapWithIntegrationProviders(element) {
|
|
6706
|
-
const providers =
|
|
6911
|
+
const providers = _chunkI32V5CZLcjs.getIntegrationProviders.call(void 0, this.config.integrations);
|
|
6707
6912
|
let wrapped = element;
|
|
6708
6913
|
for (let i = providers.length - 1; i >= 0; i--) {
|
|
6709
6914
|
const provider = providers[i];
|
|
@@ -6711,7 +6916,7 @@ var ServerRenderer = class {
|
|
|
6711
6916
|
const rendererCapabilities = _chunkRD623KW4cjs.getFarmRendererCapabilities.call(void 0, this.config.renderer);
|
|
6712
6917
|
if (!rendererCapabilities.functionComponents) {
|
|
6713
6918
|
throw new Error(
|
|
6714
|
-
`Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access',
|
|
6919
|
+
`Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _252 => _252.config, 'access', _253 => _253.renderer, 'optionalAccess', _254 => _254.name]), () => ( "the configured renderer"))}\` cannot.`
|
|
6715
6920
|
);
|
|
6716
6921
|
}
|
|
6717
6922
|
if (provider.type === "clerk" && !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer)) {
|
|
@@ -6721,14 +6926,14 @@ var ServerRenderer = class {
|
|
|
6721
6926
|
}
|
|
6722
6927
|
let ProviderComponent;
|
|
6723
6928
|
let providerSourceModule;
|
|
6724
|
-
if (
|
|
6929
|
+
if (_chunkI32V5CZLcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
|
|
6725
6930
|
providerSourceModule = provider.component.module;
|
|
6726
6931
|
const providerModuleId = provider.component.module.startsWith(".") ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0,
|
|
6727
|
-
|
|
6932
|
+
path13.resolve(this.config.root, provider.component.module),
|
|
6728
6933
|
this.config.root
|
|
6729
6934
|
) : provider.component.module;
|
|
6730
6935
|
const providerModule = this.viteServer ? await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, providerModuleId) : await importRuntimeModule(
|
|
6731
|
-
provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0,
|
|
6936
|
+
provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0, path13.resolve(this.config.root, provider.component.module)).href : provider.component.module
|
|
6732
6937
|
);
|
|
6733
6938
|
ProviderComponent = providerModule[provider.component.export || "default"];
|
|
6734
6939
|
} else if (typeof provider.component === "function") {
|
|
@@ -6750,7 +6955,7 @@ var ServerRenderer = class {
|
|
|
6750
6955
|
}
|
|
6751
6956
|
if (provider.type !== "clerk" && typeof this.rendererRuntime.markFunctionComponent === "function" && !isRendererCompiledComponent(
|
|
6752
6957
|
_nullishCoalesce(providerSourceModule, () => ( "")),
|
|
6753
|
-
_chunkRD623KW4cjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access',
|
|
6958
|
+
_chunkRD623KW4cjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _255 => _255.config, 'access', _256 => _256.renderer, 'optionalAccess', _257 => _257.componentExtensions]))
|
|
6754
6959
|
)) {
|
|
6755
6960
|
ProviderComponent = this.rendererRuntime.markFunctionComponent(ProviderComponent);
|
|
6756
6961
|
}
|
|
@@ -6877,7 +7082,7 @@ var ServerRenderer = class {
|
|
|
6877
7082
|
);
|
|
6878
7083
|
}
|
|
6879
7084
|
const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6880
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7085
|
+
trustProxy: _optionalChain([this, 'access', _258 => _258.config, 'access', _259 => _259.server, 'optionalAccess', _260 => _260.trustProxy])
|
|
6881
7086
|
});
|
|
6882
7087
|
const url = new URL(request2.url);
|
|
6883
7088
|
const llmsContext = match.metadata.kind === "llms" || match.metadata.kind === "llms-full" ? await this.createLlmsTxtContext(request2, {
|
|
@@ -6913,7 +7118,7 @@ var ServerRenderer = class {
|
|
|
6913
7118
|
}
|
|
6914
7119
|
/** `/llms.txt` and `/llms-full.txt` from `agent.llmsTxt` when no file route owns them. */
|
|
6915
7120
|
getGeneratedLlmsKind(pathname) {
|
|
6916
|
-
const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access',
|
|
7121
|
+
const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _261 => _261.config, 'access', _262 => _262.agent, 'optionalAccess', _263 => _263.llmsTxt]));
|
|
6917
7122
|
if (!config.enabled) return null;
|
|
6918
7123
|
if (pathname === "/llms.txt") return "llms";
|
|
6919
7124
|
return pathname === "/llms-full.txt" && config.full ? "llms-full" : null;
|
|
@@ -6921,9 +7126,9 @@ var ServerRenderer = class {
|
|
|
6921
7126
|
async renderGeneratedLlmsTxt(req, res, kind) {
|
|
6922
7127
|
try {
|
|
6923
7128
|
const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6924
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7129
|
+
trustProxy: _optionalChain([this, 'access', _264 => _264.config, 'access', _265 => _265.server, 'optionalAccess', _266 => _266.trustProxy])
|
|
6925
7130
|
});
|
|
6926
|
-
const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access',
|
|
7131
|
+
const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _267 => _267.config, 'access', _268 => _268.agent, 'optionalAccess', _269 => _269.llmsTxt]));
|
|
6927
7132
|
const context = await this.createLlmsTxtContext(request2, { full: kind === "llms-full", req });
|
|
6928
7133
|
const body = kind === "llms-full" ? await _chunkMEQN6DDAcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
|
|
6929
7134
|
origin: new URL(request2.url).origin,
|
|
@@ -6950,18 +7155,18 @@ var ServerRenderer = class {
|
|
|
6950
7155
|
}
|
|
6951
7156
|
}
|
|
6952
7157
|
getAgentCrawlers() {
|
|
6953
|
-
return _chunkDZPR2W6Ucjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access',
|
|
7158
|
+
return _chunkDZPR2W6Ucjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _270 => _270.config, 'access', _271 => _271.agent, 'optionalAccess', _272 => _272.crawlers]));
|
|
6954
7159
|
}
|
|
6955
7160
|
/** `/robots.txt` from `agent.crawlers` when no robots.ts owns it. */
|
|
6956
7161
|
async renderGeneratedRobotsTxt(req, res) {
|
|
6957
7162
|
try {
|
|
6958
|
-
const sitemapPath = _optionalChain([this, 'access',
|
|
7163
|
+
const sitemapPath = _optionalChain([this, 'access', _273 => _273.routeManager, 'access', _274 => _274.matchMetadataRoute, 'call', _275 => _275("/sitemap.xml"), 'optionalAccess', _276 => _276.metadata, 'access', _277 => _277.kind]) === "sitemap" || this.getAgentSitemap().enabled ? "/sitemap.xml" : void 0;
|
|
6959
7164
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
6960
7165
|
const rootMetadata = sitemapPath && rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
6961
7166
|
const robots = _chunkDZPR2W6Ucjs.createFarmAgentRobots.call(void 0, {
|
|
6962
7167
|
crawlers: this.getAgentCrawlers(),
|
|
6963
7168
|
sitemapPath,
|
|
6964
|
-
metadataBase: _optionalChain([rootMetadata, 'optionalAccess',
|
|
7169
|
+
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _278 => _278.metadataBase]),
|
|
6965
7170
|
basePath: this.config.basePath
|
|
6966
7171
|
});
|
|
6967
7172
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
|
|
@@ -6980,13 +7185,13 @@ var ServerRenderer = class {
|
|
|
6980
7185
|
}
|
|
6981
7186
|
}
|
|
6982
7187
|
getAgentSitemap() {
|
|
6983
|
-
return _chunkDZPR2W6Ucjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access',
|
|
7188
|
+
return _chunkDZPR2W6Ucjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access', _279 => _279.config, 'access', _280 => _280.agent, 'optionalAccess', _281 => _281.sitemap]));
|
|
6984
7189
|
}
|
|
6985
7190
|
/** `/sitemap.xml` from `agent.sitemap` when no sitemap.ts owns it. */
|
|
6986
7191
|
async renderGeneratedSitemap(req, res) {
|
|
6987
7192
|
try {
|
|
6988
7193
|
const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6989
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7194
|
+
trustProxy: _optionalChain([this, 'access', _282 => _282.config, 'access', _283 => _283.server, 'optionalAccess', _284 => _284.trustProxy])
|
|
6990
7195
|
});
|
|
6991
7196
|
const sources = await Promise.all(
|
|
6992
7197
|
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
@@ -6995,9 +7200,9 @@ var ServerRenderer = class {
|
|
|
6995
7200
|
_chunkQMNWKQL4cjs.logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
|
|
6996
7201
|
return void 0;
|
|
6997
7202
|
}),
|
|
6998
|
-
|
|
7203
|
+
fs9.promises.stat(route.modulePath).catch(() => void 0)
|
|
6999
7204
|
]);
|
|
7000
|
-
return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess',
|
|
7205
|
+
return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess', _285 => _285.mtime, 'access', _286 => _286.toISOString, 'call', _287 => _287()]) };
|
|
7001
7206
|
})
|
|
7002
7207
|
);
|
|
7003
7208
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
@@ -7005,7 +7210,7 @@ var ServerRenderer = class {
|
|
|
7005
7210
|
const sitemap = _chunkDZPR2W6Ucjs.createFarmDefaultSitemap.call(void 0, sources, {
|
|
7006
7211
|
origin: new URL(request2.url).origin,
|
|
7007
7212
|
config: this.getAgentSitemap(),
|
|
7008
|
-
metadataBase: _optionalChain([rootMetadata, 'optionalAccess',
|
|
7213
|
+
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _288 => _288.metadataBase]),
|
|
7009
7214
|
basePath: this.config.basePath
|
|
7010
7215
|
});
|
|
7011
7216
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
|
|
@@ -7037,7 +7242,7 @@ var ServerRenderer = class {
|
|
|
7037
7242
|
* matcher) covers, as the production build decides.
|
|
7038
7243
|
*/
|
|
7039
7244
|
getAgentListedRoutes() {
|
|
7040
|
-
const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access',
|
|
7245
|
+
const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access', _289 => _289.middlewareRoutes, 'optionalCall', _290 => _290()]), () => ( [])) };
|
|
7041
7246
|
return [...this.routeManager.getRoutes()].filter(
|
|
7042
7247
|
([pattern]) => !pattern.includes("[") && !_chunkO27PLNQZcjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
|
|
7043
7248
|
);
|
|
@@ -7048,18 +7253,18 @@ var ServerRenderer = class {
|
|
|
7048
7253
|
* or a registered server such as the docs engine's. Production applies the same rules.
|
|
7049
7254
|
*/
|
|
7050
7255
|
getDefaultMCPServer() {
|
|
7051
|
-
if (_optionalChain([this, 'access',
|
|
7052
|
-
if (_optionalChain([this, 'access',
|
|
7256
|
+
if (_optionalChain([this, 'access', _291 => _291.config, 'access', _292 => _292.agent, 'optionalAccess', _293 => _293.mcp]) !== true || _chunkQAS7KE7Jcjs.farmConfigMountsMCP.call(void 0, this.config)) return void 0;
|
|
7257
|
+
if (_optionalChain([this, 'access', _294 => _294.apiRouteExists, 'optionalCall', _295 => _295("/api/mcp")])) return void 0;
|
|
7053
7258
|
if (this.routeManager.matchRoute(_chunkQAS7KE7Jcjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
|
|
7054
7259
|
_nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunkQAS7KE7Jcjs.createFarmDefaultMCPServer.call(void 0,
|
|
7055
7260
|
readAppPackageIdentity(this.config.root),
|
|
7056
|
-
|
|
7261
|
+
_chunkSM25ZC4Scjs.FARM_VERSION
|
|
7057
7262
|
))));
|
|
7058
7263
|
return _chunkQAS7KE7Jcjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
|
|
7059
7264
|
}
|
|
7060
7265
|
async renderDefaultMCP(req, res) {
|
|
7061
7266
|
const server = this.getDefaultMCPServer();
|
|
7062
|
-
const request2 = _nullishCoalesce(_chunkHNAISJFDcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
7267
|
+
const request2 = _nullishCoalesce(_chunkHNAISJFDcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _296 => _296.config, 'access', _297 => _297.server, 'optionalAccess', _298 => _298.trustProxy]) })));
|
|
7063
7268
|
try {
|
|
7064
7269
|
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-OV4WRFBL.cjs");
|
|
7065
7270
|
const origin = new URL(request2.url).origin;
|
|
@@ -7102,7 +7307,7 @@ var ServerRenderer = class {
|
|
|
7102
7307
|
}
|
|
7103
7308
|
/** Same inputs the production server gives llms.txt: static pages and root metadata. */
|
|
7104
7309
|
async createLlmsTxtContext(request2, options = {}) {
|
|
7105
|
-
const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access',
|
|
7310
|
+
const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _299 => _299.config, 'access', _300 => _300.agent, 'optionalAccess', _301 => _301.llmsTxt]));
|
|
7106
7311
|
const origin = new URL(request2.url).origin;
|
|
7107
7312
|
const sources = await Promise.all(
|
|
7108
7313
|
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
@@ -7135,7 +7340,7 @@ var ServerRenderer = class {
|
|
|
7135
7340
|
pages,
|
|
7136
7341
|
config,
|
|
7137
7342
|
rootMetadata,
|
|
7138
|
-
mcp: _optionalChain([this, 'access',
|
|
7343
|
+
mcp: _optionalChain([this, 'access', _302 => _302.config, 'access', _303 => _303.agent, 'optionalAccess', _304 => _304.aiCatalog]) === false ? [] : _chunkXX32BOMMcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
|
|
7139
7344
|
basePath: this.config.basePath,
|
|
7140
7345
|
apiServerBasePath: _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0,
|
|
7141
7346
|
_chunkPMJSG4JScjs.normalizeFarmAPIConfig.call(void 0,
|
|
@@ -7158,8 +7363,8 @@ var ServerRenderer = class {
|
|
|
7158
7363
|
* body is discarded.
|
|
7159
7364
|
*/
|
|
7160
7365
|
createDevMarkdownReader(req) {
|
|
7161
|
-
const socket = _optionalChain([req, 'optionalAccess',
|
|
7162
|
-
if (_optionalChain([req, 'optionalAccess',
|
|
7366
|
+
const socket = _optionalChain([req, 'optionalAccess', _305 => _305.socket]);
|
|
7367
|
+
if (_optionalChain([req, 'optionalAccess', _306 => _306.method, 'optionalAccess', _307 => _307.toUpperCase, 'call', _308 => _308()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _309 => _309.localAddress]) || !socket.localPort) {
|
|
7163
7368
|
return async () => null;
|
|
7164
7369
|
}
|
|
7165
7370
|
if (socket.encrypted) {
|
|
@@ -7208,7 +7413,7 @@ var ServerRenderer = class {
|
|
|
7208
7413
|
}
|
|
7209
7414
|
async writeMetadataImageResponse(req, res, value, imageModule) {
|
|
7210
7415
|
const ifNoneMatch = req.headers["if-none-match"];
|
|
7211
|
-
const response = await
|
|
7416
|
+
const response = await _chunkAXVRUDMBcjs.createFarmMetadataImageResponse.call(void 0, value, imageModule, {
|
|
7212
7417
|
method: req.method,
|
|
7213
7418
|
ifNoneMatch: Array.isArray(ifNoneMatch) ? ifNoneMatch[0] : ifNoneMatch,
|
|
7214
7419
|
renderer: _chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer) ? void 0 : this.rendererRuntime
|
|
@@ -7225,7 +7430,7 @@ var ServerRenderer = class {
|
|
|
7225
7430
|
}
|
|
7226
7431
|
const etag = `"${image.staticInfo.hash}"`;
|
|
7227
7432
|
const requestUrl = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7228
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7433
|
+
trustProxy: _optionalChain([this, 'access', _310 => _310.config, 'access', _311 => _311.server, 'optionalAccess', _312 => _312.trustProxy])
|
|
7229
7434
|
});
|
|
7230
7435
|
const isVersioned = requestUrl.searchParams.get("v") === image.staticInfo.hash;
|
|
7231
7436
|
res.setHeader("Content-Type", image.staticInfo.contentType);
|
|
@@ -7236,7 +7441,7 @@ var ServerRenderer = class {
|
|
|
7236
7441
|
"Cache-Control",
|
|
7237
7442
|
isVersioned ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate"
|
|
7238
7443
|
);
|
|
7239
|
-
if (
|
|
7444
|
+
if (_chunkCFG4QERRcjs.matchesFarmIfNoneMatch.call(void 0, req.headers["if-none-match"], etag)) {
|
|
7240
7445
|
res.statusCode = 304;
|
|
7241
7446
|
res.end();
|
|
7242
7447
|
return;
|
|
@@ -7246,7 +7451,7 @@ var ServerRenderer = class {
|
|
|
7246
7451
|
res.end();
|
|
7247
7452
|
return;
|
|
7248
7453
|
}
|
|
7249
|
-
res.write(await
|
|
7454
|
+
res.write(await fs9.promises.readFile(image.modulePath));
|
|
7250
7455
|
res.end();
|
|
7251
7456
|
}
|
|
7252
7457
|
async renderRouteErrorBoundary(req, res, options) {
|
|
@@ -7400,12 +7605,12 @@ window.__FARM_ISLAND_STRATEGY__ = ${JSON.stringify(req.__FARM_ISLAND_STRATEGY__
|
|
|
7400
7605
|
window.__FARM_PAGE_MODULE__ = ${JSON.stringify(relativePath)};
|
|
7401
7606
|
window.__FARM_LOADING_MODULE__ = ${JSON.stringify(req.__FARM_LOADING_MODULE_PATH__ || null)};
|
|
7402
7607
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
7403
|
-
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(
|
|
7608
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkI32V5CZLcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
7404
7609
|
window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
|
|
7405
7610
|
</script>`);
|
|
7406
7611
|
const deferredScript = farmScripts(createDeferredHydrationScript(deferredProps.records));
|
|
7407
7612
|
const rendererHydrationScript = farmScripts(
|
|
7408
|
-
_optionalChain([this, 'access',
|
|
7613
|
+
_optionalChain([this, 'access', _313 => _313.rendererRuntime, 'access', _314 => _314.generateHydrationScript, 'optionalCall', _315 => _315()]) || ""
|
|
7409
7614
|
);
|
|
7410
7615
|
const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
|
|
7411
7616
|
const farmClientScript = farmScripts(
|
|
@@ -7415,7 +7620,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7415
7620
|
element,
|
|
7416
7621
|
{
|
|
7417
7622
|
rejectLateNavigation: _chunkLT4VAF5Zcjs._isFarmMarkdownPageCheck.call(void 0,
|
|
7418
|
-
_optionalChain([req, 'access',
|
|
7623
|
+
_optionalChain([req, 'access', _316 => _316.headers, 'optionalAccess', _317 => _317[_chunkLT4VAF5Zcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])
|
|
7419
7624
|
)
|
|
7420
7625
|
}
|
|
7421
7626
|
);
|
|
@@ -7427,7 +7632,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7427
7632
|
viewport: viewportTags
|
|
7428
7633
|
} = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
7429
7634
|
pathname: getFarmMetadataPathname(req),
|
|
7430
|
-
jsonLd: _optionalChain([this, 'access',
|
|
7635
|
+
jsonLd: _optionalChain([this, 'access', _318 => _318.config, 'access', _319 => _319.agent, 'optionalAccess', _320 => _320.jsonLd])
|
|
7431
7636
|
});
|
|
7432
7637
|
const documentTitleTag = !hasExplicitTitle && /<title[\s>]/i.test(rendererHead) ? "" : `<title>${title}</title>`;
|
|
7433
7638
|
const rendererHasTitle = /<title[\s>]/i.test(rendererHead);
|
|
@@ -7475,7 +7680,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7475
7680
|
});
|
|
7476
7681
|
} else {
|
|
7477
7682
|
html = `<!DOCTYPE html>
|
|
7478
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
7683
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _321 => _321.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
7479
7684
|
<head>
|
|
7480
7685
|
${themeDocument.head}
|
|
7481
7686
|
<meta charset="utf-8">
|
|
@@ -7506,7 +7711,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7506
7711
|
const securedHtml = this.secureDocumentHTML(req, html);
|
|
7507
7712
|
if ((req.method || "GET").toUpperCase() !== "HEAD") res.write(securedHtml);
|
|
7508
7713
|
res.end();
|
|
7509
|
-
if (!options.captureStaticShell) await _optionalChain([options, 'access',
|
|
7714
|
+
if (!options.captureStaticShell) await _optionalChain([options, 'access', _322 => _322.onComplete, 'optionalCall', _323 => _323(securedHtml)]);
|
|
7510
7715
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
7511
7716
|
type: "render.stream.complete",
|
|
7512
7717
|
route,
|
|
@@ -7516,7 +7721,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7516
7721
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.error", route, error });
|
|
7517
7722
|
throw error;
|
|
7518
7723
|
} finally {
|
|
7519
|
-
_optionalChain([clearMiddlewareData, 'optionalCall',
|
|
7724
|
+
_optionalChain([clearMiddlewareData, 'optionalCall', _324 => _324()]);
|
|
7520
7725
|
}
|
|
7521
7726
|
}
|
|
7522
7727
|
/**
|
|
@@ -7531,7 +7736,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7531
7736
|
if (!rootLayout) return false;
|
|
7532
7737
|
try {
|
|
7533
7738
|
const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
|
|
7534
|
-
if (typeof Layout !== "function" || _optionalChain([Layout, 'access',
|
|
7739
|
+
if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _325 => _325.prototype, 'optionalAccess', _326 => _326.isReactComponent]) || _optionalChain([Layout, 'access', _327 => _327.constructor, 'optionalAccess', _328 => _328.name]) === "AsyncFunction") {
|
|
7535
7740
|
return false;
|
|
7536
7741
|
}
|
|
7537
7742
|
const cached = documentLayouts.get(Layout);
|
|
@@ -7543,12 +7748,12 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7543
7748
|
params: {}
|
|
7544
7749
|
});
|
|
7545
7750
|
rendersDocument = this.rendererRuntime.isValidElement(rendered) && rendered.type === "html";
|
|
7546
|
-
} catch (
|
|
7751
|
+
} catch (e27) {
|
|
7547
7752
|
rendersDocument = false;
|
|
7548
7753
|
}
|
|
7549
7754
|
documentLayouts.set(Layout, rendersDocument);
|
|
7550
7755
|
return rendersDocument;
|
|
7551
|
-
} catch (
|
|
7756
|
+
} catch (e28) {
|
|
7552
7757
|
return false;
|
|
7553
7758
|
}
|
|
7554
7759
|
}
|
|
@@ -7556,7 +7761,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7556
7761
|
const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
|
|
7557
7762
|
const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
7558
7763
|
const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument();
|
|
7559
|
-
if (!renderToPipeableStream || _chunkLT4VAF5Zcjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access',
|
|
7764
|
+
if (!renderToPipeableStream || _chunkLT4VAF5Zcjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access', _329 => _329.headers, 'optionalAccess', _330 => _330[_chunkLT4VAF5Zcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])) || streamDocument && (options.captureStaticShell || !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer))) {
|
|
7560
7765
|
return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
|
|
7561
7766
|
}
|
|
7562
7767
|
return new Promise((resolve3, reject) => {
|
|
@@ -7672,7 +7877,7 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(
|
|
|
7672
7877
|
req.__FARM_LOADING_MODULE_PATH__ || null
|
|
7673
7878
|
)};
|
|
7674
7879
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
7675
|
-
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(
|
|
7880
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkI32V5CZLcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
7676
7881
|
window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
|
|
7677
7882
|
</script>`;
|
|
7678
7883
|
const islandsOnlyPage = this.islandValues() && req.__FARM_PAGE_SHOULD_HYDRATE__ !== true && req.__FARM_LAYOUT_SHOULD_HYDRATE__ !== true && req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ !== true;
|
|
@@ -7688,7 +7893,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7688
7893
|
viewport: viewportTags
|
|
7689
7894
|
} = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
7690
7895
|
pathname: getFarmMetadataPathname(req),
|
|
7691
|
-
jsonLd: _optionalChain([this, 'access',
|
|
7896
|
+
jsonLd: _optionalChain([this, 'access', _331 => _331.config, 'access', _332 => _332.agent, 'optionalAccess', _333 => _333.jsonLd])
|
|
7692
7897
|
});
|
|
7693
7898
|
const i18nSnapshot = _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
7694
7899
|
const i18nAlternateTags = i18nSnapshot ? renderI18nAlternateLinks(
|
|
@@ -7715,7 +7920,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7715
7920
|
nonce: cspNonce,
|
|
7716
7921
|
onShellReady() {
|
|
7717
7922
|
if (pendingNavigationError) {
|
|
7718
|
-
_optionalChain([abort, 'optionalCall',
|
|
7923
|
+
_optionalChain([abort, 'optionalCall', _334 => _334(pendingNavigationError)]);
|
|
7719
7924
|
if (clearMiddlewareData) {
|
|
7720
7925
|
clearMiddlewareData();
|
|
7721
7926
|
}
|
|
@@ -7733,7 +7938,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7733
7938
|
console.log(`[FARM STREAM] onShellReady at ${shellReadyMs}ms`);
|
|
7734
7939
|
}
|
|
7735
7940
|
const shell = `<!DOCTYPE html>
|
|
7736
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
7941
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _335 => _335.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
7737
7942
|
<head>
|
|
7738
7943
|
${themeDocument.head}
|
|
7739
7944
|
<meta charset="utf-8">
|
|
@@ -7754,7 +7959,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7754
7959
|
const securedShell = streamDocument ? "" : stampDocumentHTML(shell);
|
|
7755
7960
|
if (securedShell) {
|
|
7756
7961
|
htmlParts.push(securedShell);
|
|
7757
|
-
_optionalChain([staticShellParts, 'optionalAccess',
|
|
7962
|
+
_optionalChain([staticShellParts, 'optionalAccess', _336 => _336.push, 'call', _337 => _337(securedShell)]);
|
|
7758
7963
|
}
|
|
7759
7964
|
const withEarlyClient = (document) => earlyClient ? {
|
|
7760
7965
|
...document,
|
|
@@ -7825,7 +8030,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7825
8030
|
staticShellClosed = true;
|
|
7826
8031
|
if (!suspenseHoleEmitted) {
|
|
7827
8032
|
suspenseHoleEmitted = true;
|
|
7828
|
-
_optionalChain([options, 'access',
|
|
8033
|
+
_optionalChain([options, 'access', _338 => _338.onSuspenseHoleDetected, 'optionalCall', _339 => _339()]);
|
|
7829
8034
|
}
|
|
7830
8035
|
} else {
|
|
7831
8036
|
staticShellParts.push(chunkText);
|
|
@@ -7889,8 +8094,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7889
8094
|
recordRenderedChunk(tail, rewritten);
|
|
7890
8095
|
if (tail) res.write(tail);
|
|
7891
8096
|
}
|
|
7892
|
-
const documentEnd = _optionalChain([documentTransform, 'optionalAccess',
|
|
7893
|
-
if (_optionalChain([documentEnd, 'optionalAccess',
|
|
8097
|
+
const documentEnd = _optionalChain([documentTransform, 'optionalAccess', _340 => _340.end, 'call', _341 => _341()]);
|
|
8098
|
+
if (_optionalChain([documentEnd, 'optionalAccess', _342 => _342.text])) {
|
|
7894
8099
|
recordRenderedChunk(documentEnd.text, "");
|
|
7895
8100
|
res.write(documentEnd.text);
|
|
7896
8101
|
}
|
|
@@ -7901,7 +8106,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7901
8106
|
deferredHydrationScript: createDeferredHydrationScript(deferredProps.records),
|
|
7902
8107
|
earlyClient,
|
|
7903
8108
|
// A full document: Farm's #root closes only where Farm opened it.
|
|
7904
|
-
..._optionalChain([documentEnd, 'optionalAccess',
|
|
8109
|
+
..._optionalChain([documentEnd, 'optionalAccess', _343 => _343.document]) ? { closeRoot: documentEnd.rootOpened } : {}
|
|
7905
8110
|
})
|
|
7906
8111
|
);
|
|
7907
8112
|
htmlParts.push(footer);
|
|
@@ -8006,7 +8211,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
8006
8211
|
return await this.routeManager.loadRouteModule(notFoundPath);
|
|
8007
8212
|
}
|
|
8008
8213
|
async loadNotFoundComponent() {
|
|
8009
|
-
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async
|
|
8214
|
+
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _344 => _344.default]), async () => ( null));
|
|
8010
8215
|
}
|
|
8011
8216
|
/** The not-found document's head: layout and not-found metadata, as production renders it. */
|
|
8012
8217
|
async notFoundMetadataHead(layoutModule, notFoundModule) {
|
|
@@ -8035,7 +8240,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
8035
8240
|
);
|
|
8036
8241
|
}
|
|
8037
8242
|
const pathname = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
8038
|
-
trustProxy: _optionalChain([this, 'access',
|
|
8243
|
+
trustProxy: _optionalChain([this, 'access', _345 => _345.config, 'access', _346 => _346.server, 'optionalAccess', _347 => _347.trustProxy])
|
|
8039
8244
|
}).pathname;
|
|
8040
8245
|
let content = this.defaultNotFoundContent();
|
|
8041
8246
|
const NotFoundComponent = await this.loadNotFoundComponent();
|
|
@@ -8056,7 +8261,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
8056
8261
|
async render404(req, res) {
|
|
8057
8262
|
res.statusCode = 404;
|
|
8058
8263
|
const pathname = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
8059
|
-
trustProxy: _optionalChain([this, 'access',
|
|
8264
|
+
trustProxy: _optionalChain([this, 'access', _348 => _348.config, 'access', _349 => _349.server, 'optionalAccess', _350 => _350.trustProxy])
|
|
8060
8265
|
}).pathname;
|
|
8061
8266
|
const acceptHeader = req.headers.accept;
|
|
8062
8267
|
const accept = Array.isArray(acceptHeader) ? acceptHeader.join(",") : acceptHeader;
|
|
@@ -8067,13 +8272,13 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
8067
8272
|
res.end(_chunkLT4VAF5Zcjs.createFarmMarkdownErrorBody.call(void 0, 404, pathname, this.config.basePath || "/"));
|
|
8068
8273
|
return;
|
|
8069
8274
|
}
|
|
8070
|
-
const appDir =
|
|
8275
|
+
const appDir = path13.join(this.config.root, this.config.srcDir, "app");
|
|
8071
8276
|
const notFoundExtensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
|
|
8072
8277
|
let layoutModule = null;
|
|
8073
8278
|
try {
|
|
8074
8279
|
for (const ext of notFoundExtensions) {
|
|
8075
|
-
const layoutPath =
|
|
8076
|
-
if (
|
|
8280
|
+
const layoutPath = path13.join(appDir, `layout${ext}`);
|
|
8281
|
+
if (fs9.existsSync(layoutPath)) {
|
|
8077
8282
|
layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
|
|
8078
8283
|
break;
|
|
8079
8284
|
}
|
|
@@ -8084,9 +8289,9 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
8084
8289
|
);
|
|
8085
8290
|
if (notFoundPath) {
|
|
8086
8291
|
const notFoundModule = await this.loadNotFoundModule();
|
|
8087
|
-
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess',
|
|
8292
|
+
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _351 => _351.default]), () => ( null));
|
|
8088
8293
|
if (NotFoundComponent) {
|
|
8089
|
-
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess',
|
|
8294
|
+
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _352 => _352.default]), () => ( null));
|
|
8090
8295
|
let element = this.rendererRuntime.createElement(NotFoundComponent, { pathname });
|
|
8091
8296
|
if (LayoutComponent) {
|
|
8092
8297
|
element = this.rendererRuntime.createElement(LayoutComponent, {
|
|
@@ -8126,7 +8331,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
8126
8331
|
res.statusCode = statusCode;
|
|
8127
8332
|
const isDev = process.env.NODE_ENV === "development";
|
|
8128
8333
|
const requestUrl = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
8129
|
-
trustProxy: _optionalChain([this, 'access',
|
|
8334
|
+
trustProxy: _optionalChain([this, 'access', _353 => _353.config, 'access', _354 => _354.server, 'optionalAccess', _355 => _355.trustProxy])
|
|
8130
8335
|
});
|
|
8131
8336
|
const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
|
|
8132
8337
|
const statusText = _chunkO27PLNQZcjs.getDefaultErrorStatusText.call(void 0, statusCode);
|
|
@@ -8137,12 +8342,12 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
8137
8342
|
statusText,
|
|
8138
8343
|
requestPath: requestUrl.pathname,
|
|
8139
8344
|
method: req.method || "GET",
|
|
8140
|
-
message: _optionalChain([diagnostics, 'optionalAccess',
|
|
8141
|
-
errorName: _optionalChain([diagnostics, 'optionalAccess',
|
|
8142
|
-
stack: _optionalChain([diagnostics, 'optionalAccess',
|
|
8143
|
-
sourceFrame: _optionalChain([diagnostics, 'optionalAccess',
|
|
8345
|
+
message: _optionalChain([diagnostics, 'optionalAccess', _356 => _356.message]),
|
|
8346
|
+
errorName: _optionalChain([diagnostics, 'optionalAccess', _357 => _357.name]),
|
|
8347
|
+
stack: _optionalChain([diagnostics, 'optionalAccess', _358 => _358.stack]),
|
|
8348
|
+
sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _359 => _359.sourceFrame]),
|
|
8144
8349
|
development: isDev,
|
|
8145
|
-
farmVersion:
|
|
8350
|
+
farmVersion: _chunkSM25ZC4Scjs.FARM_VERSION,
|
|
8146
8351
|
nodeVersion: process.version,
|
|
8147
8352
|
mode: isDev ? "development" : "production"
|
|
8148
8353
|
})
|
|
@@ -8168,8 +8373,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
8168
8373
|
*/
|
|
8169
8374
|
getI18nAlternateOptions(req, metadata) {
|
|
8170
8375
|
return {
|
|
8171
|
-
metadataBase: _optionalChain([metadata, 'optionalAccess',
|
|
8172
|
-
origin: req ? _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
8376
|
+
metadataBase: _optionalChain([metadata, 'optionalAccess', _360 => _360.metadataBase]),
|
|
8377
|
+
origin: req ? _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _361 => _361.config, 'access', _362 => _362.server, 'optionalAccess', _363 => _363.trustProxy]) }).origin : void 0
|
|
8173
8378
|
};
|
|
8174
8379
|
}
|
|
8175
8380
|
createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
|
|
@@ -8179,7 +8384,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
8179
8384
|
const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
|
|
8180
8385
|
const integrationManifestScript = farmScripts(`<script>
|
|
8181
8386
|
window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
|
|
8182
|
-
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(
|
|
8387
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkI32V5CZLcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
8183
8388
|
${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};` : ""}
|
|
8184
8389
|
</script>`);
|
|
8185
8390
|
const alternateLinks = i18nSnapshot ? renderI18nAlternateLinks(
|
|
@@ -8195,9 +8400,9 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
8195
8400
|
);
|
|
8196
8401
|
themeDocument.head = farmScripts(themeDocument.head);
|
|
8197
8402
|
const rendererHydrationScript = farmScripts(
|
|
8198
|
-
_optionalChain([this, 'access',
|
|
8403
|
+
_optionalChain([this, 'access', _364 => _364.rendererRuntime, 'access', _365 => _365.generateHydrationScript, 'optionalCall', _366 => _366()]) || ""
|
|
8199
8404
|
);
|
|
8200
|
-
const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access',
|
|
8405
|
+
const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _367 => _367.metadata, 'optionalAccess', _368 => _368.viewport]));
|
|
8201
8406
|
const fullDocument = _chunkO27PLNQZcjs.extractFarmFullDocument.call(void 0, content);
|
|
8202
8407
|
if (fullDocument) {
|
|
8203
8408
|
return _chunkO27PLNQZcjs.composeFarmFullDocument.call(void 0,
|
|
@@ -8227,7 +8432,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
8227
8432
|
);
|
|
8228
8433
|
}
|
|
8229
8434
|
return `<!DOCTYPE html>
|
|
8230
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
8435
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _369 => _369.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
8231
8436
|
<head>
|
|
8232
8437
|
${themeDocument.head}
|
|
8233
8438
|
<meta charset="utf-8">
|
|
@@ -8269,7 +8474,7 @@ ${clientScript}
|
|
|
8269
8474
|
res.setHeader(_chunkE552H232cjs.FARM_DEPLOYMENT_ID_HEADER, deploymentId);
|
|
8270
8475
|
if ((req.method || "GET").toUpperCase() !== "GET") return;
|
|
8271
8476
|
const forwardedProto = req.headers["x-forwarded-proto"];
|
|
8272
|
-
const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess',
|
|
8477
|
+
const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _370 => _370.split, 'call', _371 => _371(","), 'access', _372 => _372[0], 'optionalAccess', _373 => _373.trim, 'call', _374 => _374()]) === "https" || Boolean(_optionalChain([req, 'access', _375 => _375.socket, 'optionalAccess', _376 => _376.encrypted]));
|
|
8273
8478
|
const cookie = _chunkE552H232cjs.createFarmDeploymentCookie.call(void 0, deploymentId, this.config.basePath || "/", isSecure);
|
|
8274
8479
|
const existing = res.getHeader("Set-Cookie");
|
|
8275
8480
|
if (Array.isArray(existing)) {
|
|
@@ -8359,14 +8564,14 @@ var FarmApp = class {
|
|
|
8359
8564
|
integrations: config.integrations || {},
|
|
8360
8565
|
plugins: config.plugins || [],
|
|
8361
8566
|
migrations: config.migrations || { commands: [] },
|
|
8362
|
-
cron:
|
|
8363
|
-
workflows:
|
|
8567
|
+
cron: _chunkBT4SEFLCcjs.resolveCronConfig.call(void 0, config.cron),
|
|
8568
|
+
workflows: _chunk3CCAICF7cjs.resolveWorkflowsConfig.call(void 0, config.workflows),
|
|
8364
8569
|
api: normalizeFarmAppAPIConfig(config.api),
|
|
8365
8570
|
middleware: config.middleware || {},
|
|
8366
8571
|
routeRules: _chunkV56632LAcjs.normalizeRouteRules.call(void 0, config.routeRules),
|
|
8367
8572
|
context: config.context || (() => void 0),
|
|
8368
|
-
server:
|
|
8369
|
-
serverActions:
|
|
8573
|
+
server: _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, config.server),
|
|
8574
|
+
serverActions: _chunk4P5634G6cjs.resolveServerActionsConfig.call(void 0, config.serverActions),
|
|
8370
8575
|
security: _chunk6JHZPB52cjs.resolveFarmSecurityConfig.call(void 0, config.security),
|
|
8371
8576
|
images: _chunkHEPJIKKQcjs.resolveFarmImageConfig.call(void 0, config.images),
|
|
8372
8577
|
performance: _chunkDZPR2W6Ucjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
|
|
@@ -8397,10 +8602,10 @@ var FarmApp = class {
|
|
|
8397
8602
|
env: config.env || { server: {}, public: {} },
|
|
8398
8603
|
suppressLintOnLink: _nullishCoalesce(config.suppressLintOnLink, () => ( false)),
|
|
8399
8604
|
experimental: {
|
|
8400
|
-
serverComponents: _nullishCoalesce(_optionalChain([config, 'access',
|
|
8401
|
-
serverActions: _nullishCoalesce(_optionalChain([config, 'access',
|
|
8402
|
-
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access',
|
|
8403
|
-
ppr: _nullishCoalesce(_optionalChain([config, 'access',
|
|
8605
|
+
serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _377 => _377.experimental, 'optionalAccess', _378 => _378.serverComponents]), () => ( false)),
|
|
8606
|
+
serverActions: _nullishCoalesce(_optionalChain([config, 'access', _379 => _379.experimental, 'optionalAccess', _380 => _380.serverActions]), () => ( false)),
|
|
8607
|
+
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _381 => _381.experimental, 'optionalAccess', _382 => _382.isolatedClientHydration]), () => ( "off")),
|
|
8608
|
+
ppr: _nullishCoalesce(_optionalChain([config, 'access', _383 => _383.experimental, 'optionalAccess', _384 => _384.ppr]), () => ( false)),
|
|
8404
8609
|
...config.experimental
|
|
8405
8610
|
},
|
|
8406
8611
|
agent: _nullishCoalesce(config.agent, () => ( {})),
|
|
@@ -8426,7 +8631,7 @@ var FarmApp = class {
|
|
|
8426
8631
|
}
|
|
8427
8632
|
const componentExtensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
|
|
8428
8633
|
const rootLayoutPaths = appDirs.flatMap(
|
|
8429
|
-
(appDir) => componentExtensions.map((extension) =>
|
|
8634
|
+
(appDir) => componentExtensions.map((extension) => path6.default.join(appDir, `layout${extension}`))
|
|
8430
8635
|
);
|
|
8431
8636
|
const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => _chunkQMNWKQL4cjs.fileExists.call(void 0, p))).then(
|
|
8432
8637
|
(results) => results.some(Boolean)
|
|
@@ -8447,7 +8652,7 @@ function isResolvedAuthConfig(value) {
|
|
|
8447
8652
|
);
|
|
8448
8653
|
}
|
|
8449
8654
|
function normalizeFarmAppAPIConfig(config) {
|
|
8450
|
-
if (typeof _optionalChain([config, 'optionalAccess',
|
|
8655
|
+
if (typeof _optionalChain([config, 'optionalAccess', _385 => _385.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _386 => _386.basePath]) === "function") {
|
|
8451
8656
|
throw new Error(
|
|
8452
8657
|
"Farm API config resolver functions must be processed with resolveConfig() before creating a FarmApp."
|
|
8453
8658
|
);
|
|
@@ -8462,7 +8667,7 @@ function createFarmApp(config, viteServer) {
|
|
|
8462
8667
|
var SHARP_INSTALL_HINT = _chunkKORZ6PREcjs.formatOptionalPeerInstallHint.call(void 0, "sharp", "optimize images");
|
|
8463
8668
|
var CLOUDFLARE_IMAGE_PRESETS = /* @__PURE__ */ new Set(["cloudflare", "cloudflare-pages", "cloudflare-module"]);
|
|
8464
8669
|
function resolveFarmImageProviderForRuntime(images, options) {
|
|
8465
|
-
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess',
|
|
8670
|
+
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _387 => _387.provider]), () => ( "auto"));
|
|
8466
8671
|
if (provider === "none") return images;
|
|
8467
8672
|
const usesSharp = options.dev ? true : provider === "node" || provider === "auto" && !CLOUDFLARE_IMAGE_PRESETS.has(options.preset || "");
|
|
8468
8673
|
if (!usesSharp || _chunkKORZ6PREcjs.isOptionalPeerInstalled.call(void 0, options.root, "sharp")) return images;
|
|
@@ -8496,8 +8701,8 @@ var FARM_PACKAGE = /^@(?:farm\.js|farming-labs)\/[a-z0-9._-]+$/;
|
|
|
8496
8701
|
function resolveFarmAppPackages(root) {
|
|
8497
8702
|
let manifest;
|
|
8498
8703
|
try {
|
|
8499
|
-
manifest = JSON.parse(
|
|
8500
|
-
} catch (
|
|
8704
|
+
manifest = JSON.parse(fs4.default.readFileSync(path6.default.join(root, "package.json"), "utf8"));
|
|
8705
|
+
} catch (e29) {
|
|
8501
8706
|
return {};
|
|
8502
8707
|
}
|
|
8503
8708
|
const names = new Set(
|
|
@@ -8511,13 +8716,13 @@ function resolveFarmAppPackages(root) {
|
|
|
8511
8716
|
for (let dir = root; ; ) {
|
|
8512
8717
|
try {
|
|
8513
8718
|
const { version } = JSON.parse(
|
|
8514
|
-
|
|
8719
|
+
fs4.default.readFileSync(path6.default.join(dir, "node_modules", name, "package.json"), "utf8")
|
|
8515
8720
|
);
|
|
8516
8721
|
if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
|
|
8517
8722
|
versions[name] = version;
|
|
8518
8723
|
break;
|
|
8519
|
-
} catch (
|
|
8520
|
-
const parent =
|
|
8724
|
+
} catch (e30) {
|
|
8725
|
+
const parent = path6.default.dirname(dir);
|
|
8521
8726
|
if (parent === dir) break;
|
|
8522
8727
|
dir = parent;
|
|
8523
8728
|
}
|
|
@@ -8547,7 +8752,7 @@ var LANGS = {
|
|
|
8547
8752
|
cjs: "jsx",
|
|
8548
8753
|
jsx: "jsx"
|
|
8549
8754
|
};
|
|
8550
|
-
var
|
|
8755
|
+
var parseAst3;
|
|
8551
8756
|
function staticValue(node) {
|
|
8552
8757
|
if (!node) return NOT_STATIC;
|
|
8553
8758
|
switch (node.type) {
|
|
@@ -8591,9 +8796,9 @@ function staticValue(node) {
|
|
|
8591
8796
|
}
|
|
8592
8797
|
}
|
|
8593
8798
|
function property(object, name) {
|
|
8594
|
-
return _optionalChain([object, 'access',
|
|
8799
|
+
return _optionalChain([object, 'access', _388 => _388.properties, 'access', _389 => _389.find, 'call', _390 => _390(
|
|
8595
8800
|
(entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
|
|
8596
|
-
), 'optionalAccess',
|
|
8801
|
+
), 'optionalAccess', _391 => _391.value]);
|
|
8597
8802
|
}
|
|
8598
8803
|
function toolFromObject(object) {
|
|
8599
8804
|
const name = staticValue(property(object, "name"));
|
|
@@ -8624,14 +8829,14 @@ function toolFromObject(object) {
|
|
|
8624
8829
|
}
|
|
8625
8830
|
function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
8626
8831
|
if (!code.includes(WEBMCP_CLIENT)) return [];
|
|
8627
|
-
const lang = _nullishCoalesce(LANGS[
|
|
8628
|
-
_nullishCoalesce(
|
|
8832
|
+
const lang = _nullishCoalesce(LANGS[path6.default.extname(filename).slice(1)], () => ( "tsx"));
|
|
8833
|
+
_nullishCoalesce(parseAst3, () => ( (parseAst3 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
|
|
8629
8834
|
"rolldown/parseAst"
|
|
8630
8835
|
).parseAst)));
|
|
8631
8836
|
let program;
|
|
8632
8837
|
try {
|
|
8633
|
-
program =
|
|
8634
|
-
} catch (
|
|
8838
|
+
program = parseAst3(code, { lang });
|
|
8839
|
+
} catch (e31) {
|
|
8635
8840
|
return [];
|
|
8636
8841
|
}
|
|
8637
8842
|
const locals = /* @__PURE__ */ new Map();
|
|
@@ -8639,7 +8844,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
8639
8844
|
if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
|
|
8640
8845
|
continue;
|
|
8641
8846
|
for (const specifier of statement.specifiers) {
|
|
8642
|
-
const imported = _nullishCoalesce(_optionalChain([specifier, 'access',
|
|
8847
|
+
const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _392 => _392.imported, 'optionalAccess', _393 => _393.name]), () => ( _optionalChain([specifier, 'access', _394 => _394.imported, 'optionalAccess', _395 => _395.value])));
|
|
8643
8848
|
if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
|
|
8644
8849
|
locals.set(specifier.local.name, imported);
|
|
8645
8850
|
}
|
|
@@ -8655,7 +8860,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
8655
8860
|
const [argument] = current.arguments;
|
|
8656
8861
|
if (definer && argument) {
|
|
8657
8862
|
const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
|
|
8658
|
-
(element) => _optionalChain([element, 'optionalAccess',
|
|
8863
|
+
(element) => _optionalChain([element, 'optionalAccess', _396 => _396.type]) === "ObjectExpression"
|
|
8659
8864
|
) : [] : argument.type === "ObjectExpression" ? [argument] : [];
|
|
8660
8865
|
for (const object of objects) {
|
|
8661
8866
|
const tool = toolFromObject(object);
|
|
@@ -8671,7 +8876,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
8671
8876
|
}
|
|
8672
8877
|
var cache = /* @__PURE__ */ new Map();
|
|
8673
8878
|
function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
8674
|
-
const base =
|
|
8879
|
+
const base = path6.default.resolve(root, srcDir);
|
|
8675
8880
|
let files;
|
|
8676
8881
|
try {
|
|
8677
8882
|
files = _tinyglobby.globSync.call(void 0, "**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
|
|
@@ -8680,7 +8885,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
8680
8885
|
expandDirectories: false,
|
|
8681
8886
|
ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
|
|
8682
8887
|
});
|
|
8683
|
-
} catch (
|
|
8888
|
+
} catch (e32) {
|
|
8684
8889
|
return [];
|
|
8685
8890
|
}
|
|
8686
8891
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -8688,16 +8893,16 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
8688
8893
|
for (const file of files.sort()) {
|
|
8689
8894
|
let mtimeMs;
|
|
8690
8895
|
try {
|
|
8691
|
-
mtimeMs =
|
|
8692
|
-
} catch (
|
|
8896
|
+
mtimeMs = fs4.default.statSync(file).mtimeMs;
|
|
8897
|
+
} catch (e33) {
|
|
8693
8898
|
continue;
|
|
8694
8899
|
}
|
|
8695
8900
|
let entry = cache.get(file);
|
|
8696
8901
|
if (!entry || entry.mtimeMs !== mtimeMs) {
|
|
8697
8902
|
let code = "";
|
|
8698
8903
|
try {
|
|
8699
|
-
code =
|
|
8700
|
-
} catch (
|
|
8904
|
+
code = fs4.default.readFileSync(file, "utf8");
|
|
8905
|
+
} catch (e34) {
|
|
8701
8906
|
}
|
|
8702
8907
|
entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
|
|
8703
8908
|
cache.set(file, entry);
|
|
@@ -8716,15 +8921,15 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
8716
8921
|
|
|
8717
8922
|
var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
8718
8923
|
function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
8719
|
-
const client = _optionalChain([cache2, 'optionalAccess',
|
|
8720
|
-
const adapter = _optionalChain([client, 'optionalAccess',
|
|
8924
|
+
const client = _optionalChain([cache2, 'optionalAccess', _397 => _397.client]);
|
|
8925
|
+
const adapter = _optionalChain([client, 'optionalAccess', _398 => _398.adapter]);
|
|
8721
8926
|
if (adapter === void 0) return void 0;
|
|
8722
8927
|
if (typeof adapter !== "string" || adapter.trim().length === 0) {
|
|
8723
8928
|
throw new Error(
|
|
8724
8929
|
'cache.client.adapter must be a module path string, for example "./src/cache-adapter".'
|
|
8725
8930
|
);
|
|
8726
8931
|
}
|
|
8727
|
-
const resolved =
|
|
8932
|
+
const resolved = path6.default.resolve(root, adapter);
|
|
8728
8933
|
const found = resolveAdapterFile(resolved);
|
|
8729
8934
|
if (!found) {
|
|
8730
8935
|
throw new Error(
|
|
@@ -8732,15 +8937,15 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
|
8732
8937
|
);
|
|
8733
8938
|
}
|
|
8734
8939
|
const options = {};
|
|
8735
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
8736
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
8940
|
+
if (_optionalChain([client, 'optionalAccess', _399 => _399.version]) !== void 0) options.version = client.version;
|
|
8941
|
+
if (_optionalChain([client, 'optionalAccess', _400 => _400.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
|
|
8737
8942
|
return { importPath: found.replace(/\\/g, "/"), options };
|
|
8738
8943
|
}
|
|
8739
8944
|
function resolveAdapterFile(resolved) {
|
|
8740
|
-
if (
|
|
8945
|
+
if (fs4.default.existsSync(resolved) && fs4.default.statSync(resolved).isFile()) return resolved;
|
|
8741
8946
|
for (const extension of ADAPTER_EXTENSIONS) {
|
|
8742
8947
|
const candidate = `${resolved}.${extension}`;
|
|
8743
|
-
if (
|
|
8948
|
+
if (fs4.default.existsSync(candidate) && fs4.default.statSync(candidate).isFile()) return candidate;
|
|
8744
8949
|
}
|
|
8745
8950
|
return void 0;
|
|
8746
8951
|
}
|
|
@@ -8951,7 +9156,7 @@ async function readFarmNavigationStream(body, flushToken) {
|
|
|
8951
9156
|
|
|
8952
9157
|
|
|
8953
9158
|
|
|
8954
|
-
var
|
|
9159
|
+
var parseAst4;
|
|
8955
9160
|
function propertyKeyName(property2) {
|
|
8956
9161
|
if (property2.computed) return void 0;
|
|
8957
9162
|
const key = property2.key;
|
|
@@ -8960,11 +9165,11 @@ function propertyKeyName(property2) {
|
|
|
8960
9165
|
return void 0;
|
|
8961
9166
|
}
|
|
8962
9167
|
function redactFarmDocsClientConfig(code, filename) {
|
|
8963
|
-
_nullishCoalesce(
|
|
9168
|
+
_nullishCoalesce(parseAst4, () => ( (parseAst4 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
|
|
8964
9169
|
"rolldown/parseAst"
|
|
8965
9170
|
).parseAst)));
|
|
8966
|
-
const extension =
|
|
8967
|
-
const program =
|
|
9171
|
+
const extension = path6.default.extname(filename);
|
|
9172
|
+
const program = parseAst4(code, {
|
|
8968
9173
|
lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
|
|
8969
9174
|
});
|
|
8970
9175
|
const edits = [];
|
|
@@ -8977,7 +9182,7 @@ function redactFarmDocsClientConfig(code, filename) {
|
|
|
8977
9182
|
const current = node;
|
|
8978
9183
|
if (current.type === "Property") {
|
|
8979
9184
|
const name = propertyKeyName(current);
|
|
8980
|
-
const valueType = _optionalChain([current, 'access',
|
|
9185
|
+
const valueType = _optionalChain([current, 'access', _401 => _401.value, 'optionalAccess', _402 => _402.type]);
|
|
8981
9186
|
const credential = name !== void 0 && (name.toLowerCase() === "headers" || _chunkSM2SYWARcjs.isSecretDocsConfigKey.call(void 0, name) && valueType !== "ObjectExpression" && valueType !== "ArrayExpression");
|
|
8982
9187
|
if (name && credential) {
|
|
8983
9188
|
edits.push(
|
|
@@ -9008,7 +9213,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
|
|
|
9008
9213
|
if (file === configModule) return true;
|
|
9009
9214
|
try {
|
|
9010
9215
|
return file === _fs.realpathSync.call(void 0, configModule).replace(/\\/g, "/");
|
|
9011
|
-
} catch (
|
|
9216
|
+
} catch (e35) {
|
|
9012
9217
|
return false;
|
|
9013
9218
|
}
|
|
9014
9219
|
}
|
|
@@ -9017,7 +9222,7 @@ function farmDocsClientConfigPlugin(configModule) {
|
|
|
9017
9222
|
name: "farm:docs-client-config",
|
|
9018
9223
|
enforce: "pre",
|
|
9019
9224
|
transform(code, id, options) {
|
|
9020
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9225
|
+
if (_optionalChain([options, 'optionalAccess', _403 => _403.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
|
|
9021
9226
|
const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
|
|
9022
9227
|
return redacted === null ? null : { code: redacted, map: null };
|
|
9023
9228
|
}
|
|
@@ -9048,13 +9253,13 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
|
9048
9253
|
];
|
|
9049
9254
|
function getFarmClientOptimizeDepsInclude(renderer) {
|
|
9050
9255
|
return Array.from(
|
|
9051
|
-
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess',
|
|
9256
|
+
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _404 => _404.optimizeDeps]) || []])
|
|
9052
9257
|
);
|
|
9053
9258
|
}
|
|
9054
9259
|
function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
|
|
9055
|
-
const resolvedProjectRoot =
|
|
9260
|
+
const resolvedProjectRoot = path6.default.resolve(projectRoot);
|
|
9056
9261
|
return appDirectories.map((appDirectory) => {
|
|
9057
|
-
const relativeAppDirectory =
|
|
9262
|
+
const relativeAppDirectory = path6.default.relative(resolvedProjectRoot, path6.default.resolve(appDirectory)).replace(/\\/g, "/");
|
|
9058
9263
|
const prefix = relativeAppDirectory || ".";
|
|
9059
9264
|
return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
|
|
9060
9265
|
});
|
|
@@ -9071,12 +9276,12 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
|
|
|
9071
9276
|
// Farm's HTML boots through a virtual module and imports route UI lazily.
|
|
9072
9277
|
// Explicit entries let Vite finish that crawl before a navigation can
|
|
9073
9278
|
// rotate the optimizer hash underneath a hydrated React runtime.
|
|
9074
|
-
..._optionalChain([entries, 'optionalAccess',
|
|
9279
|
+
..._optionalChain([entries, 'optionalAccess', _405 => _405.length]) ? { entries: [...entries] } : {}
|
|
9075
9280
|
};
|
|
9076
9281
|
}
|
|
9077
9282
|
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
9078
9283
|
return {
|
|
9079
|
-
"@":
|
|
9284
|
+
"@": path6.default.resolve(projectRoot, srcDir)
|
|
9080
9285
|
};
|
|
9081
9286
|
}
|
|
9082
9287
|
function mergeNoExternal(farmValue, userValue) {
|
|
@@ -9097,8 +9302,8 @@ function mergeAlias(farmValue, userValue) {
|
|
|
9097
9302
|
return [...normalize(userValue), ...normalize(farmValue)];
|
|
9098
9303
|
}
|
|
9099
9304
|
function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
9100
|
-
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
9101
|
-
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
9305
|
+
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _406 => _406.optimizeDeps, 'optionalAccess', _407 => _407.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _408 => _408.optimizeDeps, 'optionalAccess', _409 => _409.noDiscovery])));
|
|
9306
|
+
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _410 => _410.optimizeDeps, 'optionalAccess', _411 => _411.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _412 => _412.optimizeDeps, 'optionalAccess', _413 => _413.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _414 => _414.optimizeDeps, 'optionalAccess', _415 => _415.holdUntilCrawlEnd]))));
|
|
9102
9307
|
return {
|
|
9103
9308
|
...farmConfig,
|
|
9104
9309
|
...userConfig,
|
|
@@ -9110,9 +9315,9 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
9110
9315
|
resolve: {
|
|
9111
9316
|
...farmConfig.resolve,
|
|
9112
9317
|
...userConfig.resolve,
|
|
9113
|
-
alias: mergeAlias(_optionalChain([farmConfig, 'access',
|
|
9318
|
+
alias: mergeAlias(_optionalChain([farmConfig, 'access', _416 => _416.resolve, 'optionalAccess', _417 => _417.alias]), _optionalChain([userConfig, 'access', _418 => _418.resolve, 'optionalAccess', _419 => _419.alias])),
|
|
9114
9319
|
dedupe: Array.from(
|
|
9115
|
-
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access',
|
|
9320
|
+
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _420 => _420.resolve, 'optionalAccess', _421 => _421.dedupe]) || [], ..._optionalChain([userConfig, 'access', _422 => _422.resolve, 'optionalAccess', _423 => _423.dedupe]) || []])
|
|
9116
9321
|
)
|
|
9117
9322
|
},
|
|
9118
9323
|
optimizeDeps: {
|
|
@@ -9122,21 +9327,21 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
9122
9327
|
holdUntilCrawlEnd,
|
|
9123
9328
|
include: Array.from(
|
|
9124
9329
|
/* @__PURE__ */ new Set([
|
|
9125
|
-
..._optionalChain([farmConfig, 'access',
|
|
9126
|
-
..._optionalChain([userConfig, 'access',
|
|
9330
|
+
..._optionalChain([farmConfig, 'access', _424 => _424.optimizeDeps, 'optionalAccess', _425 => _425.include]) || [],
|
|
9331
|
+
..._optionalChain([userConfig, 'access', _426 => _426.optimizeDeps, 'optionalAccess', _427 => _427.include]) || []
|
|
9127
9332
|
])
|
|
9128
9333
|
),
|
|
9129
9334
|
exclude: Array.from(
|
|
9130
9335
|
/* @__PURE__ */ new Set([
|
|
9131
|
-
..._optionalChain([farmConfig, 'access',
|
|
9132
|
-
..._optionalChain([userConfig, 'access',
|
|
9336
|
+
..._optionalChain([farmConfig, 'access', _428 => _428.optimizeDeps, 'optionalAccess', _429 => _429.exclude]) || [],
|
|
9337
|
+
..._optionalChain([userConfig, 'access', _430 => _430.optimizeDeps, 'optionalAccess', _431 => _431.exclude]) || []
|
|
9133
9338
|
])
|
|
9134
9339
|
)
|
|
9135
9340
|
},
|
|
9136
9341
|
ssr: {
|
|
9137
9342
|
...farmConfig.ssr,
|
|
9138
9343
|
...userConfig.ssr,
|
|
9139
|
-
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access',
|
|
9344
|
+
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _432 => _432.ssr, 'optionalAccess', _433 => _433.noExternal]), _optionalChain([userConfig, 'access', _434 => _434.ssr, 'optionalAccess', _435 => _435.noExternal]))
|
|
9140
9345
|
}
|
|
9141
9346
|
};
|
|
9142
9347
|
}
|
|
@@ -9188,7 +9393,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
|
|
|
9188
9393
|
...farmConfig.build,
|
|
9189
9394
|
rollupOptions: {
|
|
9190
9395
|
...userBundlerOptions,
|
|
9191
|
-
..._optionalChain([farmConfig, 'access',
|
|
9396
|
+
..._optionalChain([farmConfig, 'access', _436 => _436.build, 'optionalAccess', _437 => _437.rollupOptions])
|
|
9192
9397
|
}
|
|
9193
9398
|
},
|
|
9194
9399
|
css: farmConfig.css || userCss ? { ...farmConfig.css, ...userCss } : void 0,
|
|
@@ -9196,7 +9401,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
|
|
|
9196
9401
|
esbuild: typeof userEsbuild === "object" && farmConfig.esbuild !== false ? { ...userEsbuild, ...farmConfig.esbuild } : _nullishCoalesce(farmConfig.esbuild, () => ( userEsbuild)),
|
|
9197
9402
|
ssr: {
|
|
9198
9403
|
...merged.ssr,
|
|
9199
|
-
external: mergeExternal(_optionalChain([farmConfig, 'access',
|
|
9404
|
+
external: mergeExternal(_optionalChain([farmConfig, 'access', _438 => _438.ssr, 'optionalAccess', _439 => _439.external]), _optionalChain([userConfig, 'access', _440 => _440.ssr, 'optionalAccess', _441 => _441.external]))
|
|
9200
9405
|
}
|
|
9201
9406
|
};
|
|
9202
9407
|
}
|
|
@@ -9274,4 +9479,7 @@ ${FARM_DARK_VARIANT}
|
|
|
9274
9479
|
|
|
9275
9480
|
|
|
9276
9481
|
|
|
9277
|
-
|
|
9482
|
+
|
|
9483
|
+
|
|
9484
|
+
|
|
9485
|
+
exports.rewriteFarmPackageClientImports = rewriteFarmPackageClientImports; 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.collectFarmServerStylesheets = collectFarmServerStylesheets; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.isFarmPackageClientBoundary = isFarmPackageClientBoundary; exports.collectFarmClientPackageImports = collectFarmClientPackageImports; 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.inferFarmIslandStrategy = inferFarmIslandStrategy; exports.resolveFarmRouteRootStrategy = resolveFarmRouteRootStrategy; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.canBootFarmIslandsClient = canBootFarmIslandsClient; 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.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.FARM_NAVIGATION_STREAM_READER_SOURCE = FARM_NAVIGATION_STREAM_READER_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;
|