@farm.js/core 0.2.0-beta.0 → 0.2.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp-handler-IUL6OPC3.cjs → agent-mcp-handler-EXOG55M4.cjs} +5 -5
- package/dist/{agent-mcp-handler-GDY5CPPW.mjs → agent-mcp-handler-VX4NDDHR.mjs} +4 -4
- package/dist/{agent-mcp.d-BdM0pIrD.d.ts → agent-mcp.d-DBaonhLg.d.ts} +1 -1
- package/dist/{agent-mcp.d-CMGqpUbk.d.mts → agent-mcp.d-DhCEzIfu.d.mts} +1 -1
- package/dist/agent-runtime.cjs +2 -2
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +1 -1
- package/dist/analyzer-OWIHFO5M.cjs +17 -0
- package/dist/{analyzer-PWHYGER6.mjs → analyzer-T2U345WL.mjs} +2 -2
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- package/dist/api/route-manager.cjs +3 -3
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +2 -2
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.cjs +4 -4
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/api.mjs +3 -3
- package/dist/{app-manifest.d-COhjPgHn.d.ts → app-manifest.d-nLVFFd7N.d.ts} +1 -1
- package/dist/{app-manifest.d-BeDB2OVm.d.mts → app-manifest.d-uE0JGZKN.d.mts} +1 -1
- package/dist/app-markdown.cjs +6 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +7 -5
- package/dist/{app.d-b3A4cca5.d.ts → app.d-CwVkAUEU.d.ts} +14 -8
- package/dist/{app.d-AVZXCfcO.d.mts → app.d-DGGcNXV7.d.mts} +14 -8
- package/dist/{chunk-AG27TI6Q.mjs → chunk-23NBOP43.mjs} +3 -0
- package/dist/{chunk-BGEA4K7C.mjs → chunk-26ZTI2ZO.mjs} +4 -4
- package/dist/{chunk-L6ZL35ZJ.mjs → chunk-4A6A6P4T.mjs} +2 -2
- package/dist/{chunk-ZOD6EYWE.mjs → chunk-4Q263EQI.mjs} +2 -2
- package/dist/{chunk-2NOHVIJ3.cjs → chunk-5LJF4KUZ.cjs} +17 -4
- package/dist/{chunk-5AL2GXAU.mjs → chunk-7MMDEIVC.mjs} +1 -1
- package/dist/{chunk-GV5D5EM6.mjs → chunk-ANKMAGFJ.mjs} +1 -1
- package/dist/{chunk-QBXS4TNG.mjs → chunk-BL54BTVJ.mjs} +1 -1
- package/dist/{chunk-YCHIR3X6.mjs → chunk-BW563VZZ.mjs} +34 -2
- package/dist/{chunk-XRYLMTYF.cjs → chunk-CBB7I6HW.cjs} +3 -3
- package/dist/{chunk-KMGHXIDA.cjs → chunk-CHOOBTDD.cjs} +2 -2
- package/dist/{chunk-MRULVIH3.mjs → chunk-COK4IXOO.mjs} +35 -18
- package/dist/{chunk-YU2MNIIY.mjs → chunk-CRF5MOLO.mjs} +17 -4
- package/dist/{chunk-NQ3Y6E2T.mjs → chunk-CV4MOEMO.mjs} +2 -2
- package/dist/{chunk-OLKYHTLN.cjs → chunk-DA432P2F.cjs} +5 -5
- package/dist/{chunk-B3HQTGXS.cjs → chunk-DVAZ53X6.cjs} +6 -1
- package/dist/{chunk-XRSNW4IU.mjs → chunk-E72GG355.mjs} +5 -0
- package/dist/{chunk-CNGGEHXY.cjs → chunk-EA5HVG45.cjs} +2 -2
- package/dist/{chunk-NG2EZ6QS.cjs → chunk-EODGIFI7.cjs} +4 -2
- package/dist/{chunk-Y3DO7BIJ.cjs → chunk-EUZFBHPP.cjs} +3 -0
- package/dist/{chunk-ERV422FO.cjs → chunk-EXPVSFAG.cjs} +16 -13
- package/dist/{chunk-EACD6ND7.cjs → chunk-EZUTDTFM.cjs} +7 -7
- package/dist/{chunk-PTAGDZ7I.mjs → chunk-GTHBWZUK.mjs} +5 -1
- package/dist/{chunk-KCJBIWBM.mjs → chunk-GVORDLLV.mjs} +1 -1
- package/dist/{chunk-XGL42MQ7.mjs → chunk-HIDZM23B.mjs} +1 -1
- package/dist/{chunk-W3ZBLFLU.mjs → chunk-HNB5JHBO.mjs} +6 -3
- package/dist/{chunk-MM4U2NNI.mjs → chunk-HVGINJTO.mjs} +101 -42
- package/dist/{chunk-XJJQAFZX.mjs → chunk-I5KPOXUE.mjs} +1 -1
- package/dist/{chunk-HR5GU4UU.cjs → chunk-ILQSRLKK.cjs} +4 -4
- package/dist/{chunk-TQFIZRON.cjs → chunk-J2EKGR6E.cjs} +1030 -485
- package/dist/{chunk-26WP75W5.cjs → chunk-JDT733EW.cjs} +41 -27
- package/dist/{chunk-W53Z4WDI.cjs → chunk-JH4CDG4G.cjs} +8 -8
- package/dist/{chunk-KQ6TYQU7.cjs → chunk-KDQKTX3Q.cjs} +4 -4
- package/dist/{chunk-PEQJ4UUT.mjs → chunk-LP6DIYGA.mjs} +2 -2
- package/dist/{chunk-M4CNAZMS.mjs → chunk-LQ3FISSD.mjs} +61 -40
- package/dist/{chunk-PQ6DBVJ2.cjs → chunk-M4YXD6MD.cjs} +291 -232
- package/dist/{chunk-CFLRUCN7.cjs → chunk-MWAWMFG3.cjs} +415 -394
- package/dist/{chunk-ECVSRE4Y.mjs → chunk-N2BRIN7I.mjs} +1 -1
- package/dist/{chunk-SUACCCZG.cjs → chunk-N2ZMSSPP.cjs} +11 -11
- package/dist/{chunk-MO4UTDQ6.mjs → chunk-NNNMFSXG.mjs} +1 -1
- package/dist/{chunk-6266WH6X.cjs → chunk-NOSLIDSG.cjs} +1 -1
- package/dist/{chunk-ICOJ2BC6.mjs → chunk-NWF2FTFV.mjs} +24 -10
- package/dist/{chunk-HU4R2PPW.cjs → chunk-NZRAUCUL.cjs} +2 -2
- package/dist/{chunk-VMGQOP7X.cjs → chunk-OLIWLN4I.cjs} +2 -2
- package/dist/{chunk-H47EH24T.mjs → chunk-OQOII62L.mjs} +1 -1
- package/dist/{chunk-BJHXFEAF.mjs → chunk-P2TGLGRR.mjs} +4 -4
- package/dist/{chunk-THGSPDFD.cjs → chunk-PAKB6JHX.cjs} +7 -7
- package/dist/{chunk-WOTAU3BN.mjs → chunk-Q637AXGZ.mjs} +218 -74
- package/dist/{chunk-ZZGQD3LL.mjs → chunk-QO24II6C.mjs} +4 -2
- package/dist/{chunk-SG5RFGV6.cjs → chunk-RBSGFS5X.cjs} +66 -34
- package/dist/{chunk-IJPRCQHW.cjs → chunk-RGMUS3HO.cjs} +10 -10
- package/dist/{chunk-PA3VZNWU.cjs → chunk-RTAWQXME.cjs} +324 -180
- package/dist/{chunk-DMSXZNQR.cjs → chunk-RZI6436F.cjs} +2 -2
- package/dist/{chunk-HZY63K5C.mjs → chunk-S6MGFULY.mjs} +2 -2
- package/dist/{chunk-5GFTMTX3.cjs → chunk-SAUGKNCF.cjs} +2 -2
- package/dist/{chunk-JGUMFTZT.cjs → chunk-SCE7VWPN.cjs} +12 -12
- package/dist/{chunk-BQHIJOZM.cjs → chunk-SIECKBNK.cjs} +6 -2
- package/dist/{chunk-JDO3X7RB.mjs → chunk-SPKZCFPH.mjs} +1 -1
- package/dist/{chunk-LUGQUU4S.mjs → chunk-SSFAPTRD.mjs} +1 -1
- package/dist/{chunk-7LBNWL3L.cjs → chunk-SWPLGPYF.cjs} +7 -7
- package/dist/{chunk-3MY6TNNE.cjs → chunk-TWFJJPE7.cjs} +3 -3
- package/dist/{chunk-WP77JDKI.cjs → chunk-UCJCU2IL.cjs} +14 -14
- package/dist/{chunk-WX752VMN.mjs → chunk-UCRNNDNS.mjs} +1 -1
- package/dist/{chunk-FEWCWBOF.cjs → chunk-UGWKNZ4U.cjs} +44 -27
- package/dist/{chunk-IRPXOTEN.cjs → chunk-UOMSGJHK.cjs} +11 -11
- package/dist/{chunk-WPB6HJC7.mjs → chunk-UWDFH3ZV.mjs} +1 -1
- package/dist/{chunk-MZPPT5NA.mjs → chunk-V5FEFFHV.mjs} +1 -1
- package/dist/{chunk-HR4N2K4V.mjs → chunk-WABOJXAA.mjs} +2 -2
- package/dist/{chunk-LTXKRIST.mjs → chunk-WANLI3ZC.mjs} +2 -2
- package/dist/{chunk-5ZWXTIGE.cjs → chunk-WEZTGM7N.cjs} +2 -2
- package/dist/{chunk-HQEYZSF3.cjs → chunk-WPURVYXT.cjs} +2 -2
- package/dist/{chunk-TE7AX6HB.mjs → chunk-WV63R4GE.mjs} +1 -1
- package/dist/{chunk-SCOKBXHS.mjs → chunk-XOLYZZDX.mjs} +696 -151
- package/dist/{chunk-4ZVKDHS6.cjs → chunk-YSRZSKQB.cjs} +4 -4
- package/dist/{cli-runtime.d-jqZ7YCsm.d.ts → cli-runtime.d-Dbl-gIoz.d.ts} +5 -5
- package/dist/{cli-runtime.d-qL44rqYO.d.mts → cli-runtime.d-oUiNuspW.d.mts} +5 -5
- package/dist/{client-component.d-BDD5aiUb.d.ts → client-component.d-CT4q7tmy.d.ts} +1 -1
- package/dist/{client-component.d-B2L2LyAr.d.mts → client-component.d-DaUqOhZT.d.mts} +1 -1
- package/dist/{client-plugins.d-Crct3m_r.d.ts → client-plugins.d-24qhjX8c.d.ts} +30 -4
- package/dist/{client-plugins.d-Dzc3vOw_.d.mts → client-plugins.d-BfGTqbAH.d.mts} +30 -4
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +4 -4
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-RL4AU5KD.cjs → devtools-5WDQQDTA.cjs} +6 -6
- package/dist/{devtools-2CRVXV7E.mjs → devtools-DPYIYHTI.mjs} +5 -5
- package/dist/docs.cjs +8 -8
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +7 -7
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{handler.d-B1S1ZBqS.d.mts → handler.d-GfNuz57p.d.mts} +1 -1
- package/dist/{handler.d-ZweCBJD4.d.ts → handler.d-Oca5kNSz.d.ts} +1 -1
- package/dist/{headers.d-C-yGl_f6.d.mts → headers.d-C_lsQIWA.d.mts} +1 -1
- package/dist/{headers.d-BgBdQN8x.d.ts → headers.d-b8gHJDvu.d.ts} +1 -1
- package/dist/index.cjs +42 -38
- package/dist/{index.d-13h3oDu7.d.mts → index.d-BLtjh1aS.d.mts} +1 -1
- package/dist/{index.d-CtoniAXT.d.ts → index.d-Ckv6kHFm.d.ts} +1 -1
- package/dist/index.d.mts +23 -23
- package/dist/index.d.ts +23 -23
- package/dist/index.mjs +39 -35
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.cjs +4 -2
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +3 -1
- package/dist/internal/app-markdown-runtime.cjs +5 -3
- package/dist/internal/app-markdown-runtime.d.mts +10 -5
- package/dist/internal/app-markdown-runtime.d.ts +10 -5
- package/dist/internal/app-markdown-runtime.mjs +6 -4
- package/dist/internal/build-runtime.cjs +29 -29
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +28 -28
- package/dist/internal/cli-runtime.cjs +12 -12
- package/dist/internal/cli-runtime.d.mts +7 -7
- package/dist/internal/cli-runtime.d.ts +7 -7
- package/dist/internal/cli-runtime.mjs +11 -11
- 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 +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +7 -7
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +6 -6
- package/dist/internal/infra-analytics-runtime.cjs +9 -9
- package/dist/internal/infra-analytics-runtime.mjs +7 -7
- package/dist/internal/metadata-image-runtime.d.mts +2 -2
- package/dist/internal/metadata-image-runtime.d.ts +2 -2
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-node-env.cjs +2 -2
- package/dist/internal/production-node-env.mjs +1 -1
- package/dist/internal/production-runtime.cjs +12 -12
- package/dist/internal/production-runtime.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +11 -11
- package/dist/internal/spa-router.cjs +3 -3
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/spa-router.mjs +2 -2
- package/dist/internal/start-manifest.d.mts +1 -1
- package/dist/internal/start-manifest.d.ts +1 -1
- package/dist/{manager-D4DZRBRS.cjs → manager-37UJPUN4.cjs} +4 -4
- package/dist/{manager-PKPQGBAE.mjs → manager-7BNSJKME.mjs} +3 -3
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/{mount.d-_6Un9wdK.d.mts → mount.d-BCS8mD4E.d.mts} +1 -1
- package/dist/{mount.d-DyKlRR6z.d.ts → mount.d-DEX8eref.d.ts} +1 -1
- package/dist/{native-tree-5TENEQ7Y.cjs → native-tree-52CUAP3N.cjs} +3 -3
- package/dist/{native-tree-LNO7K6JR.mjs → native-tree-AO7PQ7FR.mjs} +2 -2
- package/dist/{navigation-delegate.d-BbW1_pf_.d.ts → navigation-delegate.d-Cgi28e5Q.d.ts} +1 -1
- package/dist/{navigation-delegate.d-B9GjWbov.d.mts → navigation-delegate.d-F83ugsZW.d.mts} +1 -1
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +4 -4
- package/dist/plugin.cjs +22 -22
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +21 -21
- package/dist/query/client.cjs +7 -7
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan.d-DaM1NPnm.d.mts → render-plan.d-BkVY4aFb.d.mts} +1 -1
- package/dist/{render-plan.d-D0FV9lDT.d.ts → render-plan.d-DCF2GZdD.d.ts} +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +22 -11
- package/dist/renderer.d.ts +22 -11
- package/dist/{request.d-CrXC7voZ.d.ts → request.d-C5o-4dU2.d.ts} +1 -1
- package/dist/{request.d-DVSLilGx.d.mts → request.d-DMPB53-i.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-CWi3UYtR.d.mts → route-rendering.d-DDvArvik.d.mts} +1 -1
- package/dist/{route-rendering.d-OfbM_rj8.d.ts → route-rendering.d-DfP6zRP7.d.ts} +1 -1
- package/dist/{router.d-YKVirmj4.d.mts → router.d-1Skf2XCO.d.mts} +1 -1
- package/dist/{router.d-Bm9FNSu3.d.ts → router.d-s40h7aoS.d.ts} +1 -1
- package/dist/routes.d.mts +3 -3
- package/dist/routes.d.ts +3 -3
- package/dist/{rsc-pipeline-LRB4ZG6I.mjs → rsc-pipeline-O2YMVHUF.mjs} +7 -7
- package/dist/{rsc-pipeline-3DYC5ZXW.cjs → rsc-pipeline-SFQSMVI7.cjs} +8 -8
- package/dist/{runtime-3WJNNAAR.mjs → runtime-K2X3IZAF.mjs} +6 -6
- package/dist/{runtime-CRFF32H6.cjs → runtime-WOTVFYQY.cjs} +8 -8
- package/dist/{runtime.d-BVj6apd0.d.mts → runtime.d-Bykc5Qfg.d.mts} +1 -1
- package/dist/{runtime.d-D7QYVJGO.d.ts → runtime.d-k-9kFUsM.d.ts} +1 -1
- package/dist/{server-components-status.d-BDVcxi0z.d.mts → server-components-status.d-D-HixBe0.d.mts} +1 -1
- package/dist/{server-components-status.d-CfKDpmCH.d.ts → server-components-status.d-DLNd1C5j.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +47 -46
- package/dist/server.d.mts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +26 -25
- package/dist/{spa-router.d-DGmropfK.d.mts → spa-router.d-DIlXwm00.d.mts} +2 -2
- package/dist/{spa-router.d-nE1jHNGt.d.ts → spa-router.d-Dl-EJeJT.d.ts} +2 -2
- package/dist/{ssg.d-DS-gXUbf.d.mts → ssg.d-D2ZV0bhs.d.mts} +2 -2
- package/dist/{ssg.d-jXlUAKzg.d.ts → ssg.d-bE-ylg0e.d.ts} +2 -2
- package/dist/{store-core.d-B5cwOd8g.d.ts → store-core.d-BmdnMopD.d.ts} +2 -2
- package/dist/{store-core.d-C-gATBwd.d.mts → store-core.d-DPsCYzV7.d.mts} +2 -2
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +2 -2
- package/dist/{utils.d-BODwBtkz.d.ts → utils.d-BFZQcBZV.d.ts} +1 -1
- package/dist/{utils.d-Cmj-fzds.d.mts → utils.d-nM3OHKq5.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +22 -22
- package/dist/vite.d.mts +6 -6
- package/dist/vite.d.ts +6 -6
- package/dist/vite.mjs +21 -21
- package/package.json +1 -1
- package/dist/analyzer-B2TRJT3B.cjs +0 -17
|
@@ -22,7 +22,7 @@ var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var _chunkEODGIFI7cjs = require('./chunk-EODGIFI7.cjs');
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
@@ -32,7 +32,7 @@ var _chunkMHKPXX3Jcjs = require('./chunk-MHKPXX3J.cjs');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkCBB7I6HWcjs = require('./chunk-CBB7I6HW.cjs');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
@@ -40,8 +40,8 @@ var _chunkXRYLMTYFcjs = require('./chunk-XRYLMTYF.cjs');
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var _chunkSG5RFGV6cjs = require('./chunk-SG5RFGV6.cjs');
|
|
44
43
|
|
|
44
|
+
var _chunkRBSGFS5Xcjs = require('./chunk-RBSGFS5X.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
@@ -53,7 +53,8 @@ var _chunkSG5RFGV6cjs = require('./chunk-SG5RFGV6.cjs');
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
var _chunkILQSRLKKcjs = require('./chunk-ILQSRLKK.cjs');
|
|
57
58
|
|
|
58
59
|
|
|
59
60
|
|
|
@@ -70,7 +71,7 @@ var _chunkNDOE76QCcjs = require('./chunk-NDOE76QC.cjs');
|
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
|
|
73
|
-
var
|
|
74
|
+
var _chunkUOMSGJHKcjs = require('./chunk-UOMSGJHK.cjs');
|
|
74
75
|
|
|
75
76
|
|
|
76
77
|
var _chunk3BTN3NP7cjs = require('./chunk-3BTN3NP7.cjs');
|
|
@@ -116,14 +117,14 @@ var _chunkO4JYMU5Ncjs = require('./chunk-O4JYMU5N.cjs');
|
|
|
116
117
|
|
|
117
118
|
|
|
118
119
|
|
|
119
|
-
var
|
|
120
|
+
var _chunkM4YXD6MDcjs = require('./chunk-M4YXD6MD.cjs');
|
|
120
121
|
|
|
121
122
|
|
|
122
123
|
|
|
123
124
|
|
|
124
125
|
|
|
125
126
|
|
|
126
|
-
var
|
|
127
|
+
var _chunkRZI6436Fcjs = require('./chunk-RZI6436F.cjs');
|
|
127
128
|
|
|
128
129
|
|
|
129
130
|
var _chunkVACYUMXWcjs = require('./chunk-VACYUMXW.cjs');
|
|
@@ -132,11 +133,11 @@ var _chunkVACYUMXWcjs = require('./chunk-VACYUMXW.cjs');
|
|
|
132
133
|
|
|
133
134
|
|
|
134
135
|
|
|
135
|
-
var
|
|
136
|
+
var _chunkEXPVSFAGcjs = require('./chunk-EXPVSFAG.cjs');
|
|
136
137
|
|
|
137
138
|
|
|
138
139
|
|
|
139
|
-
var
|
|
140
|
+
var _chunkUGWKNZ4Ucjs = require('./chunk-UGWKNZ4U.cjs');
|
|
140
141
|
|
|
141
142
|
|
|
142
143
|
|
|
@@ -149,12 +150,13 @@ var _chunkFEWCWBOFcjs = require('./chunk-FEWCWBOF.cjs');
|
|
|
149
150
|
|
|
150
151
|
|
|
151
152
|
|
|
152
|
-
var
|
|
153
|
+
var _chunkYSRZSKQBcjs = require('./chunk-YSRZSKQB.cjs');
|
|
153
154
|
|
|
154
155
|
|
|
155
156
|
var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
156
157
|
|
|
157
158
|
|
|
159
|
+
|
|
158
160
|
var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
159
161
|
|
|
160
162
|
|
|
@@ -163,15 +165,15 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
|
163
165
|
|
|
164
166
|
|
|
165
167
|
|
|
166
|
-
var
|
|
168
|
+
var _chunkSCE7VWPNcjs = require('./chunk-SCE7VWPN.cjs');
|
|
167
169
|
|
|
168
170
|
|
|
169
171
|
|
|
170
172
|
|
|
171
|
-
var
|
|
173
|
+
var _chunkJH4CDG4Gcjs = require('./chunk-JH4CDG4G.cjs');
|
|
172
174
|
|
|
173
175
|
|
|
174
|
-
var
|
|
176
|
+
var _chunkEA5HVG45cjs = require('./chunk-EA5HVG45.cjs');
|
|
175
177
|
|
|
176
178
|
|
|
177
179
|
var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
@@ -192,7 +194,7 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
|
192
194
|
|
|
193
195
|
|
|
194
196
|
|
|
195
|
-
var
|
|
197
|
+
var _chunkRTAWQXMEcjs = require('./chunk-RTAWQXME.cjs');
|
|
196
198
|
|
|
197
199
|
|
|
198
200
|
|
|
@@ -249,14 +251,14 @@ var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
|
|
|
249
251
|
|
|
250
252
|
|
|
251
253
|
|
|
252
|
-
var
|
|
254
|
+
var _chunkJDT733EWcjs = require('./chunk-JDT733EW.cjs');
|
|
253
255
|
|
|
254
256
|
|
|
255
257
|
|
|
256
258
|
var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
|
|
257
259
|
|
|
258
260
|
|
|
259
|
-
var
|
|
261
|
+
var _chunk5LJF4KUZcjs = require('./chunk-5LJF4KUZ.cjs');
|
|
260
262
|
|
|
261
263
|
|
|
262
264
|
var _chunkPWDBWXQIcjs = require('./chunk-PWDBWXQI.cjs');
|
|
@@ -267,7 +269,9 @@ var _chunkBSX5OGSDcjs = require('./chunk-BSX5OGSD.cjs');
|
|
|
267
269
|
|
|
268
270
|
|
|
269
271
|
|
|
270
|
-
|
|
272
|
+
|
|
273
|
+
var _chunkDVAZ53X6cjs = require('./chunk-DVAZ53X6.cjs');
|
|
274
|
+
|
|
271
275
|
|
|
272
276
|
|
|
273
277
|
var _chunkQKW6DLDTcjs = require('./chunk-QKW6DLDT.cjs');
|
|
@@ -281,10 +285,11 @@ var _chunkNW3DL2PMcjs = require('./chunk-NW3DL2PM.cjs');
|
|
|
281
285
|
var _chunkSHDCKRP4cjs = require('./chunk-SHDCKRP4.cjs');
|
|
282
286
|
|
|
283
287
|
|
|
284
|
-
var
|
|
288
|
+
var _chunkTWFJJPE7cjs = require('./chunk-TWFJJPE7.cjs');
|
|
289
|
+
|
|
285
290
|
|
|
286
291
|
|
|
287
|
-
var
|
|
292
|
+
var _chunkSIECKBNKcjs = require('./chunk-SIECKBNK.cjs');
|
|
288
293
|
|
|
289
294
|
|
|
290
295
|
var _chunkCYOTNHDFcjs = require('./chunk-CYOTNHDF.cjs');
|
|
@@ -312,10 +317,10 @@ var _chunk7U4XF76Rcjs = require('./chunk-7U4XF76R.cjs');
|
|
|
312
317
|
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
313
318
|
|
|
314
319
|
|
|
315
|
-
var
|
|
320
|
+
var _chunkNOSLIDSGcjs = require('./chunk-NOSLIDSG.cjs');
|
|
316
321
|
|
|
317
322
|
|
|
318
|
-
var
|
|
323
|
+
var _chunkEUZFBHPPcjs = require('./chunk-EUZFBHPP.cjs');
|
|
319
324
|
|
|
320
325
|
|
|
321
326
|
|
|
@@ -471,7 +476,8 @@ function parseRange(header, size) {
|
|
|
471
476
|
}
|
|
472
477
|
`;
|
|
473
478
|
function createNitroStaticRangePlugin(nitroPackageEntry, canonicalPages = []) {
|
|
474
|
-
const
|
|
479
|
+
const pages = [...new Set(canonicalPages.filter((url) => !url.startsWith("//")))];
|
|
480
|
+
const redirects = pages.filter((url) => url !== "/").map((url) => [url.endsWith("/") ? url.slice(0, -1) : url + "/", url]);
|
|
475
481
|
const original = "?farm-static-handler";
|
|
476
482
|
const handlerFile = _path2.default.join(_path2.default.dirname(nitroPackageEntry), "internal", "static.mjs");
|
|
477
483
|
const handlerIds = /* @__PURE__ */ new Set([toPosix(handlerFile)]);
|
|
@@ -490,13 +496,19 @@ function createNitroStaticRangePlugin(nitroPackageEntry, canonicalPages = []) {
|
|
|
490
496
|
handler(id) {
|
|
491
497
|
const file = id.split("?", 1)[0];
|
|
492
498
|
if (!handlerIds.has(toPosix(file))) return null;
|
|
493
|
-
if (
|
|
499
|
+
if (pages.length && !id.endsWith(original)) {
|
|
494
500
|
return `import serve from ${JSON.stringify(toPosix(file) + original)};
|
|
495
501
|
const redirects = new Map(${JSON.stringify(redirects)});
|
|
502
|
+
const pages = new Set(${JSON.stringify(pages)});
|
|
503
|
+
const MARKDOWN_ACCEPT = /text\\/(?:markdown|plain)/i;
|
|
496
504
|
export default function(event) {
|
|
497
505
|
const url = new URL(event.req.url);
|
|
498
506
|
const target = redirects.get(url.pathname);
|
|
499
507
|
if (target !== undefined) return new Response(null, { status: 308, headers: { Location: target + url.search } });
|
|
508
|
+
if (pages.has(url.pathname)) {
|
|
509
|
+
if (MARKDOWN_ACCEPT.test(event.req.headers.get("accept") || "")) return;
|
|
510
|
+
event.res.headers.append("Vary", "Accept");
|
|
511
|
+
}
|
|
500
512
|
return serve(event);
|
|
501
513
|
}`;
|
|
502
514
|
}
|
|
@@ -629,7 +641,7 @@ function getDocsTitle(docs) {
|
|
|
629
641
|
return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
|
|
630
642
|
}
|
|
631
643
|
function loadPages(contentDir, docs) {
|
|
632
|
-
return
|
|
644
|
+
return _chunkILQSRLKKcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkILQSRLKKcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
633
645
|
}
|
|
634
646
|
function findSocialImagePath(html, basePath) {
|
|
635
647
|
const match = /<meta\s+property=["']og:image["']\s+content=["']([^"']+)["']/i.exec(html) || /<meta\s+content=["']([^"']+)["']\s+property=["']og:image["']/i.exec(html);
|
|
@@ -647,7 +659,7 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
647
659
|
return response;
|
|
648
660
|
}
|
|
649
661
|
async function compileFarmDocsManifest(docs, options) {
|
|
650
|
-
const contentDir =
|
|
662
|
+
const contentDir = _chunkILQSRLKKcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
651
663
|
const pages = loadPages(contentDir, docs);
|
|
652
664
|
const basePath = _chunkD22BUQKWcjs.normalizeFarmBasePath.call(void 0, options.basePath);
|
|
653
665
|
const absolutePaths = [
|
|
@@ -655,7 +667,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
655
667
|
_path2.default.resolve(contentDir),
|
|
656
668
|
docs.configPath || ""
|
|
657
669
|
];
|
|
658
|
-
const handler =
|
|
670
|
+
const handler = _chunkILQSRLKKcjs.createFarmDocsHandler.call(void 0, docs, {
|
|
659
671
|
root: options.root,
|
|
660
672
|
srcDir: options.srcDir,
|
|
661
673
|
clientEntry: options.clientEntry,
|
|
@@ -665,7 +677,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
665
677
|
isPathGuarded: options.isPathGuarded,
|
|
666
678
|
basePath
|
|
667
679
|
});
|
|
668
|
-
const apiHandler =
|
|
680
|
+
const apiHandler = _chunkRBSGFS5Xcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
669
681
|
rootDir: options.root,
|
|
670
682
|
srcDir: options.srcDir,
|
|
671
683
|
docs,
|
|
@@ -677,7 +689,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
677
689
|
const apiMarkdown = {};
|
|
678
690
|
for (const page of pages) {
|
|
679
691
|
const htmlResponse = await addHandlerRoute(routes, page.href, handler, absolutePaths);
|
|
680
|
-
const markdownPath =
|
|
692
|
+
const markdownPath = _chunkILQSRLKKcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
|
|
681
693
|
await addHandlerRoute(routes, markdownPath, handler, absolutePaths);
|
|
682
694
|
if (htmlResponse) {
|
|
683
695
|
const socialImagePath = findSocialImagePath(await htmlResponse.text(), basePath);
|
|
@@ -762,7 +774,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
762
774
|
post: await compileResponse(postResponse, absolutePaths),
|
|
763
775
|
search: {
|
|
764
776
|
pages: publicPages.map((page) => ({
|
|
765
|
-
...
|
|
777
|
+
..._chunkILQSRLKKcjs.toFarmDocsMarkdownPage.call(void 0, page, basePath),
|
|
766
778
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
767
779
|
})),
|
|
768
780
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -778,6 +790,7 @@ var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(
|
|
|
778
790
|
|
|
779
791
|
var FARM_CLIENT_MODULE_PRELOADS_PLACEHOLDER = "__farm_client_module_preloads__";
|
|
780
792
|
var FARM_CLIENT_MODULE_PRELOADS_FILE = "client-module-preloads.json";
|
|
793
|
+
var ROLLDOWN_RUNTIME_MODULE = "\0rolldown/runtime.js";
|
|
781
794
|
function collectFarmClientModulePreloads(bundle, options) {
|
|
782
795
|
const chunks = Object.values(bundle).filter(
|
|
783
796
|
(output) => output.type === "chunk"
|
|
@@ -807,18 +820,38 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
807
820
|
};
|
|
808
821
|
const entryFiles = staticImports(entry, /* @__PURE__ */ new Set([entry.fileName]), []);
|
|
809
822
|
const entryLoaded = /* @__PURE__ */ new Set([entry.fileName, ...entryFiles]);
|
|
823
|
+
const entryModule = entry.facadeModuleId;
|
|
824
|
+
const stubEntry = _optionalChain([entry, 'access', _7 => _7.moduleIds, 'optionalAccess', _8 => _8.length]) === 0 && Boolean(entryModule);
|
|
825
|
+
const entryCodeFiles = entryFiles.filter((fileName) => {
|
|
826
|
+
const ids = _optionalChain([byFile, 'access', _9 => _9.get, 'call', _10 => _10(fileName), 'optionalAccess', _11 => _11.moduleIds]);
|
|
827
|
+
if (!ids) return false;
|
|
828
|
+
if (ids.length === 1 && ids[0] === ROLLDOWN_RUNTIME_MODULE) return true;
|
|
829
|
+
return stubEntry && ids.some((id) => id === entryModule || id === ROLLDOWN_RUNTIME_MODULE);
|
|
830
|
+
});
|
|
810
831
|
const modules = {};
|
|
832
|
+
const addModule = (id, chunk) => {
|
|
833
|
+
const moduleId = id.split("?")[0];
|
|
834
|
+
if (!_path2.default.isAbsolute(moduleId)) return;
|
|
835
|
+
const key = _chunk7U4XF76Rcjs.toViteModuleId.call(void 0, moduleId, options.root);
|
|
836
|
+
if (modules[key]) return;
|
|
837
|
+
const loaded = /* @__PURE__ */ new Set([...entryLoaded, chunk.fileName]);
|
|
838
|
+
modules[key] = [chunk.fileName, ...staticImports(chunk, loaded, [])].map(index);
|
|
839
|
+
};
|
|
811
840
|
for (const chunk of chunks) {
|
|
812
841
|
if (!chunk.isDynamicEntry || !chunk.facadeModuleId || entryLoaded.has(chunk.fileName)) {
|
|
813
842
|
continue;
|
|
814
843
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
844
|
+
addModule(chunk.facadeModuleId, chunk);
|
|
845
|
+
}
|
|
846
|
+
if (options.isDynamicallyImported) {
|
|
847
|
+
const dynamicTargets = new Set(chunks.flatMap((chunk) => _nullishCoalesce(chunk.dynamicImports, () => ( []))));
|
|
848
|
+
for (const chunk of chunks) {
|
|
849
|
+
if (chunk.facadeModuleId || !dynamicTargets.has(chunk.fileName)) continue;
|
|
850
|
+
if (entryLoaded.has(chunk.fileName)) continue;
|
|
851
|
+
for (const id of _nullishCoalesce(chunk.moduleIds, () => ( []))) {
|
|
852
|
+
if (options.isDynamicallyImported(id)) addModule(id, chunk);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
822
855
|
}
|
|
823
856
|
const dynamicFiles = (moduleIds, before = []) => {
|
|
824
857
|
const into = [];
|
|
@@ -828,7 +861,7 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
828
861
|
const chunk = _nullishCoalesce(chunks.find(
|
|
829
862
|
(candidate) => candidate.isDynamicEntry && candidate.facadeModuleId && is(candidate.facadeModuleId)
|
|
830
863
|
), () => ( // A module another dynamic import shares can land in a common chunk without a facade.
|
|
831
|
-
chunks.find((candidate) => !candidate.isEntry && _optionalChain([candidate, 'access',
|
|
864
|
+
chunks.find((candidate) => !candidate.isEntry && _optionalChain([candidate, 'access', _12 => _12.moduleIds, 'optionalAccess', _13 => _13.some, 'call', _14 => _14(is)]))));
|
|
832
865
|
if (!chunk || loaded.has(chunk.fileName)) continue;
|
|
833
866
|
loaded.add(chunk.fileName);
|
|
834
867
|
into.push(chunk.fileName);
|
|
@@ -843,6 +876,7 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
843
876
|
return {
|
|
844
877
|
files,
|
|
845
878
|
entry: entryFiles.map(index),
|
|
879
|
+
...entryCodeFiles.length > 0 ? { entryCode: entryCodeFiles.map(index) } : {},
|
|
846
880
|
router: dynamicFiles(options.routerModules).map(index),
|
|
847
881
|
...rendererFiles.length > 0 ? { renderer: rendererFiles.map(index) } : {},
|
|
848
882
|
...rootFiles.length > 0 ? { root: rootFiles.map(index) } : {},
|
|
@@ -875,7 +909,8 @@ function createFarmClientModulePreloadPlugin(options) {
|
|
|
875
909
|
...options,
|
|
876
910
|
rendererModules,
|
|
877
911
|
actionModules,
|
|
878
|
-
serverTreeModules
|
|
912
|
+
serverTreeModules,
|
|
913
|
+
isDynamicallyImported: (id) => (_nullishCoalesce(_optionalChain([this, 'access', _15 => _15.getModuleInfo, 'call', _16 => _16(id), 'optionalAccess', _17 => _17.dynamicImporters, 'access', _18 => _18.length]), () => ( 0))) > 0
|
|
879
914
|
})
|
|
880
915
|
)
|
|
881
916
|
);
|
|
@@ -898,72 +933,6 @@ function encodeFarmBuildJSONPlaceholder(value) {
|
|
|
898
933
|
return JSON.stringify(JSON.stringify(value)).slice(1, -1).replace(/'/g, "\\u0027").replace(/`/g, "\\u0060").replace(/\$/g, "\\u0024").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
899
934
|
}
|
|
900
935
|
|
|
901
|
-
// src/nitro/islands-react-chunk.ts
|
|
902
|
-
var REACT_MODULE = /[\\/]node_modules[\\/](?:react|react-dom|scheduler)[\\/]/;
|
|
903
|
-
var REACT_DOM_MODULE = /[\\/]node_modules[\\/]react-dom[\\/]/;
|
|
904
|
-
var FARM_EAGER_COMPILE_HINT = "//# allFunctionsCalledOnLoad";
|
|
905
|
-
function createFarmIslandsReactOutput() {
|
|
906
|
-
let entryImportsReact;
|
|
907
|
-
return {
|
|
908
|
-
codeSplitting: {
|
|
909
|
-
groups: [
|
|
910
|
-
{
|
|
911
|
-
debugName: "react",
|
|
912
|
-
name(moduleId, context) {
|
|
913
|
-
if (!REACT_MODULE.test(moduleId)) return null;
|
|
914
|
-
_nullishCoalesce(entryImportsReact, () => ( (entryImportsReact = reactLoadsWithAnEntry(moduleId, context))));
|
|
915
|
-
return entryImportsReact ? null : "react";
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
]
|
|
919
|
-
},
|
|
920
|
-
// After minification, so the hint stays the chunk's first line; its source map accounts for it.
|
|
921
|
-
// Rolldown adds a line after any string, an empty one too, so other chunks get none.
|
|
922
|
-
postBanner: ((chunk) => entryImportsReact === false && chunk.moduleIds.some((id) => REACT_DOM_MODULE.test(id)) ? FARM_EAGER_COMPILE_HINT : void 0)
|
|
923
|
-
};
|
|
924
|
-
}
|
|
925
|
-
function reactLoadsWithAnEntry(moduleId, context) {
|
|
926
|
-
const react = /* @__PURE__ */ new Set();
|
|
927
|
-
const pending = [moduleId];
|
|
928
|
-
for (let id = pending.pop(); id !== void 0; id = pending.pop()) {
|
|
929
|
-
if (react.has(id) || !REACT_MODULE.test(id)) continue;
|
|
930
|
-
react.add(id);
|
|
931
|
-
const info = context.getModuleInfo(id);
|
|
932
|
-
if (info) pending.push(...info.importedIds, ...info.importers);
|
|
933
|
-
}
|
|
934
|
-
const seen = /* @__PURE__ */ new Set();
|
|
935
|
-
pending.push(...react);
|
|
936
|
-
for (let id = pending.pop(); id !== void 0; id = pending.pop()) {
|
|
937
|
-
if (seen.has(id)) continue;
|
|
938
|
-
seen.add(id);
|
|
939
|
-
const info = context.getModuleInfo(id);
|
|
940
|
-
if (!info) continue;
|
|
941
|
-
if (info.isEntry) return true;
|
|
942
|
-
pending.push(...info.importers);
|
|
943
|
-
}
|
|
944
|
-
return false;
|
|
945
|
-
}
|
|
946
|
-
var CHUNKING_OPTIONS = [
|
|
947
|
-
"manualChunks",
|
|
948
|
-
"advancedChunks",
|
|
949
|
-
"codeSplitting",
|
|
950
|
-
"inlineDynamicImports"
|
|
951
|
-
];
|
|
952
|
-
function createFarmIslandsReactChunkPlugin() {
|
|
953
|
-
return {
|
|
954
|
-
name: "farm-islands-react-chunk",
|
|
955
|
-
enforce: "post",
|
|
956
|
-
outputOptions: {
|
|
957
|
-
order: "post",
|
|
958
|
-
handler(options) {
|
|
959
|
-
if (CHUNKING_OPTIONS.some((key) => options[key] !== void 0)) return null;
|
|
960
|
-
const { codeSplitting, postBanner } = createFarmIslandsReactOutput();
|
|
961
|
-
return { ...options, codeSplitting, postBanner: _nullishCoalesce(options.postBanner, () => ( postBanner)) };
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
};
|
|
965
|
-
}
|
|
966
|
-
|
|
967
936
|
// src/nitro/client-route-table.ts
|
|
968
937
|
|
|
969
938
|
|
|
@@ -1131,7 +1100,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
1131
1100
|
const routes = [];
|
|
1132
1101
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
1133
1102
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
1134
|
-
const rendering = await
|
|
1103
|
+
const rendering = await _chunkEXPVSFAGcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
1135
1104
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
1136
1105
|
routes.push({
|
|
1137
1106
|
kind: "page",
|
|
@@ -1218,7 +1187,7 @@ function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
|
1218
1187
|
`Route "${route.pattern}" requires the ${route.runtime} runtime, but preset "${preset}" emits ${runtime} functions. Choose a compatible preset or change the route runtime.`
|
|
1219
1188
|
);
|
|
1220
1189
|
}
|
|
1221
|
-
if (_optionalChain([route, 'access',
|
|
1190
|
+
if (_optionalChain([route, 'access', _19 => _19.regions, 'optionalAccess', _20 => _20.length]) && preset !== "vercel") {
|
|
1222
1191
|
warnings.add(
|
|
1223
1192
|
`Preset "${preset}" does not map per-route regions; Farm kept them in ${FARM_ROUTE_RUNTIME_MANIFEST} for deployment adapters.`
|
|
1224
1193
|
);
|
|
@@ -1265,7 +1234,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs5, b
|
|
|
1265
1234
|
const destinations = /* @__PURE__ */ new Map();
|
|
1266
1235
|
let groupIndex = 0;
|
|
1267
1236
|
for (const [key, group] of groups) {
|
|
1268
|
-
if (!_optionalChain([group, 'access',
|
|
1237
|
+
if (!_optionalChain([group, 'access', _21 => _21.config, 'access', _22 => _22.regions, 'optionalAccess', _23 => _23.length]) && !group.config.maxDuration) {
|
|
1269
1238
|
destinations.set(key, "/__nitro");
|
|
1270
1239
|
continue;
|
|
1271
1240
|
}
|
|
@@ -1315,14 +1284,14 @@ async function configureVercelFunction(functionDir, config, fs5) {
|
|
|
1315
1284
|
const current = JSON.parse(await fs5.readFile(configPath, "utf8"));
|
|
1316
1285
|
const next = {
|
|
1317
1286
|
...current,
|
|
1318
|
-
..._optionalChain([config, 'access',
|
|
1287
|
+
..._optionalChain([config, 'access', _24 => _24.regions, 'optionalAccess', _25 => _25.length]) ? { regions: config.regions } : {},
|
|
1319
1288
|
...config.maxDuration ? { maxDuration: config.maxDuration } : {}
|
|
1320
1289
|
};
|
|
1321
1290
|
await fs5.writeFile(configPath, `${JSON.stringify(next, null, 2)}
|
|
1322
1291
|
`);
|
|
1323
1292
|
}
|
|
1324
1293
|
function hasVercelFunctionControls(route) {
|
|
1325
|
-
return Boolean(_optionalChain([route, 'access',
|
|
1294
|
+
return Boolean(_optionalChain([route, 'access', _26 => _26.regions, 'optionalAccess', _27 => _27.length]) || route.maxDuration);
|
|
1326
1295
|
}
|
|
1327
1296
|
function compareRuntimeRoutes(left, right) {
|
|
1328
1297
|
const kindOrder = { page: 0, api: 0, metadata: 0, rule: 1 };
|
|
@@ -1367,7 +1336,7 @@ var FARM_HASHED_ASSET_DIRS = ["assets", "chunks"];
|
|
|
1367
1336
|
var LITERAL_ROUTE_PATH = /^\/[\w.~@/-]+$/;
|
|
1368
1337
|
function planFarmImmutableAssets(options) {
|
|
1369
1338
|
const cacheRulePatterns = Object.entries(_nullishCoalesce(options.routeRules, () => ( {}))).filter(
|
|
1370
|
-
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess',
|
|
1339
|
+
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess', _28 => _28.headers]), () => ( {}))).some((name) => name.toLowerCase() === "cache-control")
|
|
1371
1340
|
).map(([pattern]) => pattern);
|
|
1372
1341
|
const isImmutable = (file) => isFarmImmutableAssetPath(file) && !cacheRulePatterns.some((pattern) => _chunkIUKBPBM7cjs.farmRouteRuleMatches.call(void 0, pattern, file));
|
|
1373
1342
|
const routeDirs = new Set(
|
|
@@ -1421,21 +1390,31 @@ function createFarmVercelImmutableAssetRoute() {
|
|
|
1421
1390
|
};
|
|
1422
1391
|
}
|
|
1423
1392
|
function buildFarmVercelRoutes(options) {
|
|
1424
|
-
const {
|
|
1393
|
+
const {
|
|
1394
|
+
presetRoutes,
|
|
1395
|
+
runtimeRoutes,
|
|
1396
|
+
middlewareRoutes = [],
|
|
1397
|
+
canonicalSlashRoutes = [],
|
|
1398
|
+
markdownRoutes = [],
|
|
1399
|
+
notFoundRoutes
|
|
1400
|
+
} = options;
|
|
1425
1401
|
const filesystemIndex = presetRoutes.findIndex((route) => route.handle === "filesystem");
|
|
1426
1402
|
const sourceRoutes = filesystemIndex >= 0 ? presetRoutes.slice(0, filesystemIndex) : [];
|
|
1427
1403
|
const preservedSourceRoutes = sourceRoutes.filter((route) => route.continue !== true);
|
|
1428
1404
|
return [
|
|
1405
|
+
...markdownRoutes,
|
|
1429
1406
|
...middlewareRoutes,
|
|
1430
1407
|
...preservedSourceRoutes,
|
|
1431
1408
|
...canonicalSlashRoutes,
|
|
1432
1409
|
createFarmVercelImmutableAssetRoute(),
|
|
1433
1410
|
{ handle: "filesystem" },
|
|
1434
1411
|
...runtimeRoutes,
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1412
|
+
..._nullishCoalesce(notFoundRoutes, () => ( [
|
|
1413
|
+
{
|
|
1414
|
+
src: "/(.*)",
|
|
1415
|
+
dest: "/__nitro"
|
|
1416
|
+
}
|
|
1417
|
+
]))
|
|
1439
1418
|
];
|
|
1440
1419
|
}
|
|
1441
1420
|
function escapeRegExp2(value) {
|
|
@@ -1476,6 +1455,91 @@ function createFarmVercelCanonicalSlashRoutes(publicPaths) {
|
|
|
1476
1455
|
dest: "/__nitro"
|
|
1477
1456
|
}));
|
|
1478
1457
|
}
|
|
1458
|
+
var FARM_VERCEL_MARKDOWN_ACCEPT_PATTERN = ".*text/(?:markdown|plain).*";
|
|
1459
|
+
function createFarmVercelMarkdownRoutes(publicPaths) {
|
|
1460
|
+
return groupFarmVercelRouteAlternatives([...new Set(publicPaths)], escapeRegExp2).map((group) => ({
|
|
1461
|
+
src: group.src,
|
|
1462
|
+
has: [{ type: "header", key: "accept", value: FARM_VERCEL_MARKDOWN_ACCEPT_PATTERN }],
|
|
1463
|
+
dest: "/__nitro"
|
|
1464
|
+
}));
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
// src/nitro/vercel-not-found.ts
|
|
1468
|
+
var FARM_STATIC_NOT_FOUND_PATH = "/404.html";
|
|
1469
|
+
var FARM_STATIC_NOT_FOUND_REFUSAL_TYPE = "application/x-farm-static-not-found-refusal";
|
|
1470
|
+
function createFarmVercelStaticNotFoundRoutes(input) {
|
|
1471
|
+
const basePath = normalizeBasePath2(input.basePath);
|
|
1472
|
+
const alternatives = /* @__PURE__ */ new Set();
|
|
1473
|
+
for (const base of /* @__PURE__ */ new Set(["", basePath])) {
|
|
1474
|
+
for (const pattern of input.routePatterns) {
|
|
1475
|
+
alternatives.add(withOptionalTrailingSlash(farmRoutePatternToVercelSource(pattern, base)));
|
|
1476
|
+
}
|
|
1477
|
+
for (const pattern of input.prefixPatterns) {
|
|
1478
|
+
const source = farmRoutePatternToVercelSource(pattern, base);
|
|
1479
|
+
alternatives.add(source === "/" ? "/.*" : `${source}(?:/.*)?`);
|
|
1480
|
+
}
|
|
1481
|
+
for (const pathname of input.paths) {
|
|
1482
|
+
alternatives.add(withOptionalTrailingSlash(escapeRegExp3(withBasePath(pathname, base))));
|
|
1483
|
+
}
|
|
1484
|
+
for (const source of input.matcherSources) {
|
|
1485
|
+
const alternative = getFarmMatcherSourceAlternative(source);
|
|
1486
|
+
if (alternative === null) {
|
|
1487
|
+
throw new Error(
|
|
1488
|
+
`Farm cannot serve a static 404 page: ${JSON.stringify(source)} can match any path.`
|
|
1489
|
+
);
|
|
1490
|
+
}
|
|
1491
|
+
alternatives.add(`${escapeRegExp3(base)}${alternative}`);
|
|
1492
|
+
}
|
|
1493
|
+
alternatives.add(`${escapeRegExp3(base)}/.*\\.md`);
|
|
1494
|
+
}
|
|
1495
|
+
return [
|
|
1496
|
+
...groupFarmVercelRouteAlternatives([...alternatives], (source) => source).map((group) => ({
|
|
1497
|
+
src: group.src,
|
|
1498
|
+
dest: "/__nitro"
|
|
1499
|
+
})),
|
|
1500
|
+
{
|
|
1501
|
+
src: "/.*",
|
|
1502
|
+
has: [{ type: "header", key: "accept", value: FARM_VERCEL_MARKDOWN_ACCEPT_PATTERN }],
|
|
1503
|
+
dest: "/__nitro"
|
|
1504
|
+
},
|
|
1505
|
+
{ src: "/.*", dest: withBasePath(FARM_STATIC_NOT_FOUND_PATH, basePath), status: 404 }
|
|
1506
|
+
];
|
|
1507
|
+
}
|
|
1508
|
+
function getFarmMatcherSourceAlternative(source) {
|
|
1509
|
+
const normalized = source.startsWith("/") ? source : `/${source}`;
|
|
1510
|
+
const special = normalized.search(/[:*?()[\]{}+\\|^$]/);
|
|
1511
|
+
const literal = special === -1 ? normalized : normalized.slice(0, special);
|
|
1512
|
+
const prefix = literal.replace(/\/+$/, "");
|
|
1513
|
+
if (special === -1) return prefix ? `${escapeRegExp3(prefix)}(?:/.*)?` : "/?";
|
|
1514
|
+
if (literal.endsWith("/")) return prefix ? `${escapeRegExp3(prefix)}(?:/.*)?` : null;
|
|
1515
|
+
return `${escapeRegExp3(literal)}.*`;
|
|
1516
|
+
}
|
|
1517
|
+
function getFarmStaticNotFoundHandlerSources(handlers, farmHandlers) {
|
|
1518
|
+
const sources = [];
|
|
1519
|
+
for (const handler of handlers) {
|
|
1520
|
+
if (farmHandlers.has(handler.handler)) continue;
|
|
1521
|
+
if (!handler.route || getFarmMatcherSourceAlternative(handler.route) === null) return null;
|
|
1522
|
+
sources.push(handler.route);
|
|
1523
|
+
}
|
|
1524
|
+
return sources;
|
|
1525
|
+
}
|
|
1526
|
+
function withOptionalTrailingSlash(source) {
|
|
1527
|
+
return source === "/" || source.endsWith("/") ? source : `${source}/?`;
|
|
1528
|
+
}
|
|
1529
|
+
function withBasePath(pathname, basePath) {
|
|
1530
|
+
const normalized = pathname.startsWith("/") ? pathname : `/${pathname}`;
|
|
1531
|
+
if (!basePath) return normalized;
|
|
1532
|
+
return normalized === "/" ? basePath : `${basePath}${normalized}`;
|
|
1533
|
+
}
|
|
1534
|
+
function normalizeBasePath2(value) {
|
|
1535
|
+
const trimmed = _nullishCoalesce(_optionalChain([value, 'optionalAccess', _29 => _29.trim, 'call', _30 => _30()]), () => ( ""));
|
|
1536
|
+
if (!trimmed || trimmed === "/") return "";
|
|
1537
|
+
const withSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
1538
|
+
return withSlash.replace(/\/+$/g, "");
|
|
1539
|
+
}
|
|
1540
|
+
function escapeRegExp3(value) {
|
|
1541
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1542
|
+
}
|
|
1479
1543
|
|
|
1480
1544
|
// src/nitro/ssr-public-assets.ts
|
|
1481
1545
|
|
|
@@ -1495,7 +1559,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
|
|
|
1495
1559
|
function replaceServerFileReferences(bundle, chunkFileName, code, replace) {
|
|
1496
1560
|
return code.replace(SERVER_FILE_URL_RE, (reference, _quote, relativeUrl) => {
|
|
1497
1561
|
const target = resolveBundleFileName(chunkFileName, relativeUrl);
|
|
1498
|
-
return target && _optionalChain([bundle, 'access',
|
|
1562
|
+
return target && _optionalChain([bundle, 'access', _31 => _31[target], 'optionalAccess', _32 => _32.type]) === "asset" ? replace(target) : reference;
|
|
1499
1563
|
});
|
|
1500
1564
|
}
|
|
1501
1565
|
function collectServerReadSSRAssets(bundle) {
|
|
@@ -1549,7 +1613,7 @@ function assertServerReadSSRAssetsSupported(bundle, preset, root) {
|
|
|
1549
1613
|
if (assets.length === 0) return;
|
|
1550
1614
|
const sources = assets.map((fileName) => {
|
|
1551
1615
|
const output = bundle[fileName];
|
|
1552
|
-
const original = _optionalChain([output, 'optionalAccess',
|
|
1616
|
+
const original = _optionalChain([output, 'optionalAccess', _33 => _33.type]) === "asset" ? _optionalChain([output, 'access', _34 => _34.originalFileNames, 'optionalAccess', _35 => _35[0]]) : void 0;
|
|
1553
1617
|
if (!original) return fileName;
|
|
1554
1618
|
return _path2.default.relative(root, _path2.default.resolve(root, original)).split(_path2.default.sep).join("/");
|
|
1555
1619
|
});
|
|
@@ -1568,7 +1632,7 @@ function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
|
|
|
1568
1632
|
transform(code, id) {
|
|
1569
1633
|
if (!code.includes("import.meta.url")) return null;
|
|
1570
1634
|
const chunkFileName = _path2.default.relative(ssrOutputDir, id.split("?", 1)[0]).split(_path2.default.sep).join("/");
|
|
1571
|
-
if (_optionalChain([bundle, 'access',
|
|
1635
|
+
if (_optionalChain([bundle, 'access', _36 => _36[chunkFileName], 'optionalAccess', _37 => _37.type]) !== "chunk") return null;
|
|
1572
1636
|
let changed = false;
|
|
1573
1637
|
const transformed = replaceServerFileReferences(
|
|
1574
1638
|
bundle,
|
|
@@ -1664,7 +1728,7 @@ export default async function farmNetlifyHandler(request, context) {
|
|
|
1664
1728
|
var PLATFORM_CONFIG_KEYS = /* @__PURE__ */ new Set(["desktop", "mobile"]);
|
|
1665
1729
|
var CONFIG_FACTORIES = /* @__PURE__ */ new Set(["defineConfig", "defineFarmConfig"]);
|
|
1666
1730
|
function isConfigObject(node) {
|
|
1667
|
-
return _optionalChain([node, 'optionalAccess',
|
|
1731
|
+
return _optionalChain([node, 'optionalAccess', _38 => _38.type]) === "ObjectExpression";
|
|
1668
1732
|
}
|
|
1669
1733
|
function propertyName(property) {
|
|
1670
1734
|
if (property.type !== "Property" || property.computed) return void 0;
|
|
@@ -1685,7 +1749,7 @@ function collectConfigObjects(node, found) {
|
|
|
1685
1749
|
}
|
|
1686
1750
|
if (current.type === "CallExpression") {
|
|
1687
1751
|
const callee = current.callee;
|
|
1688
|
-
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access',
|
|
1752
|
+
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access', _39 => _39.property, 'optionalAccess', _40 => _40.name]);
|
|
1689
1753
|
const argument = current.arguments[0];
|
|
1690
1754
|
if (name && CONFIG_FACTORIES.has(name) && isConfigObject(argument)) found.push(argument);
|
|
1691
1755
|
}
|
|
@@ -1718,7 +1782,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1718
1782
|
const trailingComma = /^\s*,/.exec(code.slice(properties[last].end));
|
|
1719
1783
|
removals.push([
|
|
1720
1784
|
properties[first].start,
|
|
1721
|
-
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess',
|
|
1785
|
+
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess', _41 => _41[0], 'access', _42 => _42.length]), () => ( 0)))
|
|
1722
1786
|
]);
|
|
1723
1787
|
}
|
|
1724
1788
|
first = last;
|
|
@@ -1745,7 +1809,7 @@ function farmStripPlatformConfigPlugin(configFiles) {
|
|
|
1745
1809
|
// removed block used (`readFileSync` for a version, say).
|
|
1746
1810
|
enforce: "pre",
|
|
1747
1811
|
transform: {
|
|
1748
|
-
filter: { id:
|
|
1812
|
+
filter: { id: _chunkM4YXD6MDcjs.fileNamePattern.call(void 0, configFiles) },
|
|
1749
1813
|
async handler(code, id) {
|
|
1750
1814
|
const file = id.split("?", 1)[0];
|
|
1751
1815
|
if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
|
|
@@ -1798,7 +1862,7 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
|
|
|
1798
1862
|
return;
|
|
1799
1863
|
}
|
|
1800
1864
|
worker.once("message", (entries) => {
|
|
1801
|
-
void _optionalChain([worker, 'optionalAccess',
|
|
1865
|
+
void _optionalChain([worker, 'optionalAccess', _43 => _43.terminate, 'call', _44 => _44()]);
|
|
1802
1866
|
done(entries);
|
|
1803
1867
|
});
|
|
1804
1868
|
worker.once("error", () => done());
|
|
@@ -1807,7 +1871,7 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
|
|
|
1807
1871
|
return {
|
|
1808
1872
|
pages,
|
|
1809
1873
|
dispose() {
|
|
1810
|
-
void _optionalChain([worker, 'optionalAccess',
|
|
1874
|
+
void _optionalChain([worker, 'optionalAccess', _45 => _45.terminate, 'call', _46 => _46()]);
|
|
1811
1875
|
}
|
|
1812
1876
|
};
|
|
1813
1877
|
}
|
|
@@ -1882,6 +1946,95 @@ async function writeFarmClientBrotliAssets(clientOutputDir) {
|
|
|
1882
1946
|
await Promise.all(Array.from({ length: _os.availableParallelism.call(void 0, ) }, next));
|
|
1883
1947
|
}
|
|
1884
1948
|
|
|
1949
|
+
// src/nitro/islands-react-chunk.ts
|
|
1950
|
+
var REACT_MODULE = /[\\/]node_modules[\\/](?:react|react-dom|scheduler)[\\/]/;
|
|
1951
|
+
var REACT_DOM_MODULE = /[\\/]node_modules[\\/]react-dom[\\/]/;
|
|
1952
|
+
var FARM_EAGER_COMPILE_HINT = "//# allFunctionsCalledOnLoad";
|
|
1953
|
+
function createFarmIslandsReactOutput() {
|
|
1954
|
+
let entryImportsReact;
|
|
1955
|
+
return {
|
|
1956
|
+
codeSplitting: {
|
|
1957
|
+
groups: [
|
|
1958
|
+
{
|
|
1959
|
+
debugName: "react",
|
|
1960
|
+
name(moduleId, context) {
|
|
1961
|
+
if (!REACT_MODULE.test(moduleId)) return null;
|
|
1962
|
+
_nullishCoalesce(entryImportsReact, () => ( (entryImportsReact = reactLoadsWithAnEntry(moduleId, context))));
|
|
1963
|
+
return entryImportsReact ? null : "react";
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
]
|
|
1967
|
+
},
|
|
1968
|
+
// After minification, so the hint stays the chunk's first line; its source map accounts for it.
|
|
1969
|
+
// Rolldown adds a line after any string, an empty one too, so other chunks get none.
|
|
1970
|
+
postBanner: ((chunk) => entryImportsReact === false && chunk.moduleIds.some((id) => REACT_DOM_MODULE.test(id)) ? FARM_EAGER_COMPILE_HINT : void 0)
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
function reactLoadsWithAnEntry(moduleId, context) {
|
|
1974
|
+
const react = /* @__PURE__ */ new Set();
|
|
1975
|
+
const pending = [moduleId];
|
|
1976
|
+
for (let id = pending.pop(); id !== void 0; id = pending.pop()) {
|
|
1977
|
+
if (react.has(id) || !REACT_MODULE.test(id)) continue;
|
|
1978
|
+
react.add(id);
|
|
1979
|
+
const info = context.getModuleInfo(id);
|
|
1980
|
+
if (info) pending.push(...info.importedIds, ...info.importers);
|
|
1981
|
+
}
|
|
1982
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1983
|
+
pending.push(...react);
|
|
1984
|
+
for (let id = pending.pop(); id !== void 0; id = pending.pop()) {
|
|
1985
|
+
if (seen.has(id)) continue;
|
|
1986
|
+
seen.add(id);
|
|
1987
|
+
const info = context.getModuleInfo(id);
|
|
1988
|
+
if (!info) continue;
|
|
1989
|
+
if (info.isEntry) return true;
|
|
1990
|
+
pending.push(...info.importers);
|
|
1991
|
+
}
|
|
1992
|
+
return false;
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
// src/nitro/client-chunks.ts
|
|
1996
|
+
var FARM_CLIENT_INLINE_CHUNK_BYTES = 32 * 1024;
|
|
1997
|
+
var STYLE_MODULE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss|sss)(?:\?|$)/;
|
|
1998
|
+
var CHUNKING_OPTIONS = [
|
|
1999
|
+
"manualChunks",
|
|
2000
|
+
"advancedChunks",
|
|
2001
|
+
"codeSplitting",
|
|
2002
|
+
"inlineDynamicImports"
|
|
2003
|
+
];
|
|
2004
|
+
function canInlineCommonChunks(options) {
|
|
2005
|
+
const format = _nullishCoalesce(options.format, () => ( "es"));
|
|
2006
|
+
return (format === "es" || format === "esm" || format === "module") && options.strictExecutionOrder !== false && !options.preserveModules;
|
|
2007
|
+
}
|
|
2008
|
+
function createFarmClientChunksPlugin(options) {
|
|
2009
|
+
return {
|
|
2010
|
+
name: "farm-client-chunks",
|
|
2011
|
+
enforce: "post",
|
|
2012
|
+
outputOptions: {
|
|
2013
|
+
order: "post",
|
|
2014
|
+
handler(output) {
|
|
2015
|
+
if (CHUNKING_OPTIONS.some((key) => output[key] !== void 0)) return null;
|
|
2016
|
+
const inline = options.inlineCommonChunks && canInlineCommonChunks(output);
|
|
2017
|
+
const islands = options.islandsReact ? createFarmIslandsReactOutput() : void 0;
|
|
2018
|
+
if (!inline && !islands) return null;
|
|
2019
|
+
const codeSplitting = {
|
|
2020
|
+
..._optionalChain([islands, 'optionalAccess', _47 => _47.codeSplitting]),
|
|
2021
|
+
...inline ? {
|
|
2022
|
+
experimentalInlineCommonChunks: {
|
|
2023
|
+
maxSize: FARM_CLIENT_INLINE_CHUNK_BYTES,
|
|
2024
|
+
exclude: STYLE_MODULE
|
|
2025
|
+
}
|
|
2026
|
+
} : {}
|
|
2027
|
+
};
|
|
2028
|
+
return {
|
|
2029
|
+
...output,
|
|
2030
|
+
codeSplitting,
|
|
2031
|
+
...islands ? { postBanner: _nullishCoalesce(output.postBanner, () => ( islands.postBanner)) } : {}
|
|
2032
|
+
};
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
|
|
1885
2038
|
// src/middleware/static-config.ts
|
|
1886
2039
|
function literalMatcher(node) {
|
|
1887
2040
|
if (!node) return void 0;
|
|
@@ -1889,7 +2042,7 @@ function literalMatcher(node) {
|
|
|
1889
2042
|
if (node.type === "Literal" && node.regex)
|
|
1890
2043
|
return new RegExp(node.regex.pattern, node.regex.flags);
|
|
1891
2044
|
if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
|
|
1892
|
-
return _nullishCoalesce(_optionalChain([node, 'access',
|
|
2045
|
+
return _nullishCoalesce(_optionalChain([node, 'access', _48 => _48.quasis, 'access', _49 => _49[0], 'optionalAccess', _50 => _50.value, 'optionalAccess', _51 => _51.cooked]), () => ( void 0));
|
|
1893
2046
|
}
|
|
1894
2047
|
return void 0;
|
|
1895
2048
|
}
|
|
@@ -1913,7 +2066,7 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1913
2066
|
let found = null;
|
|
1914
2067
|
for (const statement of program.body) {
|
|
1915
2068
|
if (statement.type === "ExportNamedDeclaration" && !statement.declaration) {
|
|
1916
|
-
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access',
|
|
2069
|
+
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access', _52 => _52.exported, 'optionalAccess', _53 => _53.name]) === "config")) {
|
|
1917
2070
|
return "unknown";
|
|
1918
2071
|
}
|
|
1919
2072
|
continue;
|
|
@@ -1921,14 +2074,14 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1921
2074
|
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : null;
|
|
1922
2075
|
if (!declaration || declaration.type !== "VariableDeclaration") continue;
|
|
1923
2076
|
for (const declarator of declaration.declarations) {
|
|
1924
|
-
if (_optionalChain([declarator, 'access',
|
|
2077
|
+
if (_optionalChain([declarator, 'access', _54 => _54.id, 'optionalAccess', _55 => _55.type]) !== "Identifier" || declarator.id.name !== "config") continue;
|
|
1925
2078
|
if (declaration.kind !== "const" || !declarator.init) return "unknown";
|
|
1926
2079
|
const init = unwrap(declarator.init);
|
|
1927
2080
|
if (init.type !== "ObjectExpression") return "unknown";
|
|
1928
2081
|
const config = {};
|
|
1929
2082
|
for (const property of init.properties) {
|
|
1930
2083
|
if (property.type !== "Property" || property.computed) return "unknown";
|
|
1931
|
-
const key = _nullishCoalesce(_optionalChain([property, 'access',
|
|
2084
|
+
const key = _nullishCoalesce(_optionalChain([property, 'access', _56 => _56.key, 'optionalAccess', _57 => _57.name]), () => ( _optionalChain([property, 'access', _58 => _58.key, 'optionalAccess', _59 => _59.value])));
|
|
1932
2085
|
if (key === "runtime") {
|
|
1933
2086
|
const runtime = literalMatcher(unwrap(property.value));
|
|
1934
2087
|
if (runtime === "edge" || runtime === "nodejs") config.runtime = runtime;
|
|
@@ -1949,7 +2102,7 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1949
2102
|
try {
|
|
1950
2103
|
const [{ readFile: readFile2 }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1951
2104
|
const parsed = vite.parseSync(filePath, await readFile2(filePath, "utf8"));
|
|
1952
|
-
if (_optionalChain([parsed, 'access',
|
|
2105
|
+
if (_optionalChain([parsed, 'access', _60 => _60.errors, 'optionalAccess', _61 => _61.length])) return "unknown";
|
|
1953
2106
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1954
2107
|
} catch (e14) {
|
|
1955
2108
|
return "unknown";
|
|
@@ -1968,9 +2121,9 @@ function farmTargetRunsEdgeMiddleware(preset) {
|
|
|
1968
2121
|
return preset === "vercel";
|
|
1969
2122
|
}
|
|
1970
2123
|
function isFarmEdgeMiddlewareRoute(route) {
|
|
1971
|
-
return typeof route.config === "object" && _optionalChain([route, 'access',
|
|
2124
|
+
return typeof route.config === "object" && _optionalChain([route, 'access', _62 => _62.config, 'optionalAccess', _63 => _63.runtime]) === "edge";
|
|
1972
2125
|
}
|
|
1973
|
-
function
|
|
2126
|
+
function escapeRegExp4(value) {
|
|
1974
2127
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1975
2128
|
}
|
|
1976
2129
|
function toFarmVercelEdgeGuardedUrls(pathnames, basePath) {
|
|
@@ -1982,7 +2135,7 @@ function createFarmVercelEdgeMiddlewareRoutes(pathnames, basePath = "/") {
|
|
|
1982
2135
|
const publicPaths = toFarmVercelEdgeGuardedUrls(pathnames, basePath);
|
|
1983
2136
|
return groupFarmVercelRouteAlternatives(publicPaths, (pathname) => {
|
|
1984
2137
|
const trimmed = pathname.replace(/\/+$/, "");
|
|
1985
|
-
return trimmed ? `${
|
|
2138
|
+
return trimmed ? `${escapeRegExp4(trimmed)}(?:/|/index\\.html|\\.html)?` : "/(?:index\\.html)?";
|
|
1986
2139
|
}).map((group) => ({
|
|
1987
2140
|
src: group.src,
|
|
1988
2141
|
middlewarePath: FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION,
|
|
@@ -2005,7 +2158,7 @@ export default createFarmVercelEdgeMiddleware({
|
|
|
2005
2158
|
${modules.join("\n")}
|
|
2006
2159
|
],
|
|
2007
2160
|
i18n: ${JSON.stringify(config.i18n)},
|
|
2008
|
-
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access',
|
|
2161
|
+
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _64 => _64.server, 'optionalAccess', _65 => _65.trustProxy]) === true })},
|
|
2009
2162
|
apiBasePath: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
2010
2163
|
notFoundPath: ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_VERCEL_EDGE_NOT_FOUND_PATH, config.basePath))},
|
|
2011
2164
|
pages: ${JSON.stringify(toFarmVercelEdgeGuardedUrls(guardedPages, config.basePath))},
|
|
@@ -2064,7 +2217,7 @@ async function writeFarmVercelEdgeMiddlewareFunction(options) {
|
|
|
2064
2217
|
logLevel: "silent",
|
|
2065
2218
|
plugins: [edgeNodeModulesPlugin(coreDir, unsupported)],
|
|
2066
2219
|
resolve: {
|
|
2067
|
-
alias:
|
|
2220
|
+
alias: _chunkM4YXD6MDcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2068
2221
|
conditionNames: ["edge-light", "worker", "browser", "import", "module", "default"]
|
|
2069
2222
|
},
|
|
2070
2223
|
transform: {
|
|
@@ -2286,7 +2439,7 @@ function createPrerenderMarkdownPagesPlugin(pages) {
|
|
|
2286
2439
|
const compiled = await pages;
|
|
2287
2440
|
if (compiled.size === 0) return "";
|
|
2288
2441
|
return `globalThis[Symbol.for(${JSON.stringify(
|
|
2289
|
-
|
|
2442
|
+
_chunkJDT733EWcjs.FARM_MARKDOWN_PRECOMPILED_PAGES.description
|
|
2290
2443
|
)})] = new Map(${JSON.stringify([...compiled])});`;
|
|
2291
2444
|
}
|
|
2292
2445
|
};
|
|
@@ -2296,7 +2449,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
2296
2449
|
return {
|
|
2297
2450
|
name: "farm-prerender-runtime-resolver",
|
|
2298
2451
|
async resolveId(id, _importer, options) {
|
|
2299
|
-
if (_optionalChain([options, 'access',
|
|
2452
|
+
if (_optionalChain([options, 'access', _66 => _66.custom, 'optionalAccess', _67 => _67.farmPrerenderRuntimeResolve])) return null;
|
|
2300
2453
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
2301
2454
|
return null;
|
|
2302
2455
|
}
|
|
@@ -2466,7 +2619,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2466
2619
|
return {
|
|
2467
2620
|
name: "farm-omitted-metadata-image-runtime",
|
|
2468
2621
|
resolveId: {
|
|
2469
|
-
filter: { id:
|
|
2622
|
+
filter: { id: _chunkM4YXD6MDcjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
|
|
2470
2623
|
handler(source, importer) {
|
|
2471
2624
|
if (source !== "@vercel/og") return null;
|
|
2472
2625
|
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
|
|
@@ -2475,7 +2628,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2475
2628
|
}
|
|
2476
2629
|
},
|
|
2477
2630
|
load: {
|
|
2478
|
-
filter: { id:
|
|
2631
|
+
filter: { id: _chunkM4YXD6MDcjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
|
|
2479
2632
|
handler(id) {
|
|
2480
2633
|
if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
|
|
2481
2634
|
return `
|
|
@@ -2503,8 +2656,8 @@ function readVercelOgManifest(file) {
|
|
|
2503
2656
|
}
|
|
2504
2657
|
function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
2505
2658
|
const vercelOg = readVercelOgManifest(resolvedId);
|
|
2506
|
-
const entry = _optionalChain([vercelOg, 'optionalAccess',
|
|
2507
|
-
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess',
|
|
2659
|
+
const entry = _optionalChain([vercelOg, 'optionalAccess', _68 => _68.manifest, 'access', _69 => _69.exports, 'optionalAccess', _70 => _70["."], 'optionalAccess', _71 => _71[condition]]);
|
|
2660
|
+
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _72 => _72.default]);
|
|
2508
2661
|
return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
|
|
2509
2662
|
}
|
|
2510
2663
|
function createEdgeMetadataImageRuntimePlugin({
|
|
@@ -2520,7 +2673,7 @@ function createEdgeMetadataImageRuntimePlugin({
|
|
|
2520
2673
|
const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
|
|
2521
2674
|
return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
|
|
2522
2675
|
}
|
|
2523
|
-
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2676
|
+
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _73 => _73.replace, 'call', _74 => _74(/\\/g, "/"), 'access', _75 => _75.includes, 'call', _76 => _76("/@vercel/og/")])) {
|
|
2524
2677
|
return null;
|
|
2525
2678
|
}
|
|
2526
2679
|
const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
|
|
@@ -2542,7 +2695,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
|
2542
2695
|
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
2543
2696
|
});
|
|
2544
2697
|
if (inlined !== code) return { code: inlined, map: null };
|
|
2545
|
-
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call',
|
|
2698
|
+
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _77 => _77(file), 'optionalAccess', _78 => _78.manifest, 'access', _79 => _79.version]), () => ( "(unknown version)"));
|
|
2546
2699
|
this.error(
|
|
2547
2700
|
`@vercel/og ${version} cannot be bundled for ${runtime}: ${file} does not load its default font with fetch(new URL("./<font>.ttf", import.meta.url)), the pattern Farm inlines because an edge function cannot fetch it. Install a @vercel/og version whose edge build does, such as 1.0.1.`
|
|
2548
2701
|
);
|
|
@@ -2553,7 +2706,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
2553
2706
|
return {
|
|
2554
2707
|
name: "farm-metadata-image-wasm",
|
|
2555
2708
|
resolveId(source, importer) {
|
|
2556
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2709
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _80 => _80.replace, 'call', _81 => _81(/\\/g, "/"), 'access', _82 => _82.includes, 'call', _83 => _83("/@vercel/og/")])) {
|
|
2557
2710
|
return null;
|
|
2558
2711
|
}
|
|
2559
2712
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -2629,9 +2782,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
|
2629
2782
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
2630
2783
|
}
|
|
2631
2784
|
function nameCodeSplittingGroups(bundlerConfig) {
|
|
2632
|
-
const outputs = _optionalChain([bundlerConfig, 'optionalAccess',
|
|
2785
|
+
const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _84 => _84.output]);
|
|
2633
2786
|
for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
|
|
2634
|
-
const groups = _optionalChain([output, 'optionalAccess',
|
|
2787
|
+
const groups = _optionalChain([output, 'optionalAccess', _85 => _85.codeSplitting, 'optionalAccess', _86 => _86.groups]);
|
|
2635
2788
|
if (!Array.isArray(groups)) continue;
|
|
2636
2789
|
groups.forEach((group, index) => {
|
|
2637
2790
|
if (group && typeof group.name === "function" && !group.debugName) {
|
|
@@ -2692,9 +2845,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
2692
2845
|
throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
|
|
2693
2846
|
}
|
|
2694
2847
|
const restore = (node) => {
|
|
2695
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
2848
|
+
if (_optionalChain([node, 'optionalAccess', _87 => _87.type]) !== "TemplateLiteral") return;
|
|
2696
2849
|
const template = node;
|
|
2697
|
-
const value = _optionalChain([template, 'access',
|
|
2850
|
+
const value = _optionalChain([template, 'access', _88 => _88.quasis, 'access', _89 => _89[0], 'optionalAccess', _90 => _90.value, 'access', _91 => _91.cooked]);
|
|
2698
2851
|
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
2699
2852
|
replacements.push({
|
|
2700
2853
|
start: template.start,
|
|
@@ -2753,6 +2906,13 @@ function resolveBuildDocsContentDir(docs, root, srcDir) {
|
|
|
2753
2906
|
const rootDocsDir = _path2.default.join(root, entryDir);
|
|
2754
2907
|
return _fs.existsSync.call(void 0, rootDocsDir) ? rootDocsDir : null;
|
|
2755
2908
|
}
|
|
2909
|
+
function getFarmDocsBundledRootPaths(docs, root, srcDir) {
|
|
2910
|
+
return _chunkILQSRLKKcjs.getFarmDocsRoots.call(void 0, docs).slice(1).map((docsRoot) => {
|
|
2911
|
+
const contentDir = resolveBuildDocsContentDir(docsRoot, root, srcDir);
|
|
2912
|
+
const relativePath = contentDir ? _path2.default.relative(root, contentDir) : "";
|
|
2913
|
+
return relativePath === ".." || relativePath.startsWith(`..${_path2.default.sep}`) || _path2.default.isAbsolute(relativePath) ? "" : relativePath.split(_path2.default.sep).join("/");
|
|
2914
|
+
});
|
|
2915
|
+
}
|
|
2756
2916
|
function hasProjectPostcssConfig(root) {
|
|
2757
2917
|
const candidates = [
|
|
2758
2918
|
"postcss.config.js",
|
|
@@ -2804,7 +2964,7 @@ function hasFarmPluginRoutes(config) {
|
|
|
2804
2964
|
}
|
|
2805
2965
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
2806
2966
|
return (config.plugins || []).some(
|
|
2807
|
-
(plugin) =>
|
|
2967
|
+
(plugin) => _chunkDVAZ53X6cjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && // Mobile session tokens change only bearer requests and cookie-clearing responses, which a
|
|
2808
2968
|
// prerendered file never answers or sends; its endpoints live under /__farm/.
|
|
2809
2969
|
plugin.name !== _chunkMHKPXX3Jcjs.FARM_MOBILE_SESSION_PLUGIN && _chunk47JV57DAcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
2810
2970
|
);
|
|
@@ -2852,7 +3012,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2852
3012
|
return Array.from(routes.values()).sort(_chunkSHDCKRP4cjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
2853
3013
|
}
|
|
2854
3014
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
2855
|
-
if (!_optionalChain([config, 'access',
|
|
3015
|
+
if (!_optionalChain([config, 'access', _92 => _92.docs, 'optionalAccess', _93 => _93.enabled]) || !_optionalChain([config, 'access', _94 => _94.docs, 'access', _95 => _95.adapter, 'optionalAccess', _96 => _96.server]) || _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
2856
3016
|
return;
|
|
2857
3017
|
}
|
|
2858
3018
|
throw new Error(
|
|
@@ -2887,7 +3047,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
2887
3047
|
routeManager.getSearchPreserveRoutes().map((route) => [route.pattern, route])
|
|
2888
3048
|
);
|
|
2889
3049
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
2890
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
3050
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkJDT733EWcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
2891
3051
|
const searchPreserve = searchPreserveRoutes.get(entry.pattern);
|
|
2892
3052
|
pageRoutes.push({
|
|
2893
3053
|
pattern,
|
|
@@ -3033,7 +3193,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
3033
3193
|
);
|
|
3034
3194
|
}
|
|
3035
3195
|
}
|
|
3036
|
-
_optionalChain([sourceSnapshot, 'optionalAccess',
|
|
3196
|
+
_optionalChain([sourceSnapshot, 'optionalAccess', _97 => _97.clear, 'call', _98 => _98()]);
|
|
3037
3197
|
const ssrResult = ssrBuildResult.value;
|
|
3038
3198
|
const routeRuntimeManifest = routeRuntimeManifestResult.value;
|
|
3039
3199
|
const runtimeValidation = validateFarmRouteRuntimeDeployment(routeRuntimeManifest, preset);
|
|
@@ -3065,7 +3225,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
3065
3225
|
configuredHeaderRoutes,
|
|
3066
3226
|
nitroBuilderResultPromise,
|
|
3067
3227
|
lifecyclePluginManager,
|
|
3068
|
-
_optionalChain([markdownPrecompile, 'optionalAccess',
|
|
3228
|
+
_optionalChain([markdownPrecompile, 'optionalAccess', _99 => _99.pages])
|
|
3069
3229
|
);
|
|
3070
3230
|
const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
|
|
3071
3231
|
_path2.default.join(root, distDir),
|
|
@@ -3086,17 +3246,17 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
3086
3246
|
_chunk7U4XF76Rcjs.logger.error(`\u274C Build failed: ${error}`);
|
|
3087
3247
|
throw error;
|
|
3088
3248
|
} finally {
|
|
3089
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
3090
|
-
_optionalChain([markdownPrecompile, 'optionalAccess',
|
|
3249
|
+
_optionalChain([rendererBuild, 'optionalAccess', _100 => _100.abort, 'call', _101 => _101()]);
|
|
3250
|
+
_optionalChain([markdownPrecompile, 'optionalAccess', _102 => _102.dispose, 'call', _103 => _103()]);
|
|
3091
3251
|
}
|
|
3092
3252
|
}
|
|
3093
3253
|
function collectFarmPrerenderedMarkdownBodies(pageRoutes) {
|
|
3094
3254
|
const bodies = [];
|
|
3095
3255
|
for (const route of pageRoutes) {
|
|
3096
|
-
if (route.source === void 0 || !
|
|
3097
|
-
const { body } =
|
|
3098
|
-
const rendering =
|
|
3099
|
-
|
|
3256
|
+
if (route.source === void 0 || !_chunkJDT733EWcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) continue;
|
|
3257
|
+
const { body } = _chunkJDT733EWcjs.parseMarkdownFrontmatter.call(void 0, route.source);
|
|
3258
|
+
const rendering = _chunkEXPVSFAGcjs.resolveRouteRenderingConfig.call(void 0,
|
|
3259
|
+
_chunkJDT733EWcjs.readFarmMarkdownRouteConfig.call(void 0, body),
|
|
3100
3260
|
route.source
|
|
3101
3261
|
);
|
|
3102
3262
|
if (rendering.ssg && rendering.revalidate === void 0) bodies.push(body);
|
|
@@ -3110,7 +3270,7 @@ function varyFarmNitroCacheRules(rules, headerNames) {
|
|
|
3110
3270
|
if (headerNames.length === 0) return rules;
|
|
3111
3271
|
return Object.fromEntries(
|
|
3112
3272
|
Object.entries(rules).map(([source, rule]) => {
|
|
3113
|
-
const cached = _optionalChain([rule, 'optionalAccess',
|
|
3273
|
+
const cached = _optionalChain([rule, 'optionalAccess', _104 => _104.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _105 => _105.cache]) !== void 0 && rule.cache !== false;
|
|
3114
3274
|
if (!cached || rule.cache === false) return [source, rule];
|
|
3115
3275
|
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
3116
3276
|
const varies = [
|
|
@@ -3136,10 +3296,10 @@ async function writeSSRAssetsToClient(bundle, outputDir, polyroute) {
|
|
|
3136
3296
|
}
|
|
3137
3297
|
async function writeFarmVideoPlayerToClient(outputDir) {
|
|
3138
3298
|
const fs5 = await import("fs/promises");
|
|
3139
|
-
const filePath = _path2.default.join(outputDir,
|
|
3299
|
+
const filePath = _path2.default.join(outputDir, _chunkEUZFBHPPcjs.FARM_VIDEO_PLAYER_PATH.slice(1));
|
|
3140
3300
|
await fs5.mkdir(_path2.default.dirname(filePath), { recursive: true });
|
|
3141
3301
|
try {
|
|
3142
|
-
await fs5.writeFile(filePath,
|
|
3302
|
+
await fs5.writeFile(filePath, _chunkM4YXD6MDcjs.FARM_VIDEO_PLAYER_HTML, { flag: "wx" });
|
|
3143
3303
|
} catch (error) {
|
|
3144
3304
|
if (error.code !== "EEXIST") throw error;
|
|
3145
3305
|
}
|
|
@@ -3173,7 +3333,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
3173
3333
|
}
|
|
3174
3334
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
3175
3335
|
await fs5.writeFile(fontCssPath, normalizedFontCss);
|
|
3176
|
-
await fs5.writeFile(clientCssPath,
|
|
3336
|
+
await fs5.writeFile(clientCssPath, _chunkM4YXD6MDcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
3177
3337
|
}
|
|
3178
3338
|
function importsFarmClientBlockedPackage(id, packageName) {
|
|
3179
3339
|
return id === packageName || id.startsWith(`${packageName}/`);
|
|
@@ -3223,10 +3383,10 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3223
3383
|
}
|
|
3224
3384
|
}
|
|
3225
3385
|
function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, options = {}) {
|
|
3226
|
-
const key =
|
|
3386
|
+
const key = _chunkRTAWQXMEcjs.getClientModuleHydrationPlanKey.call(void 0, modulePath, root, mode, options);
|
|
3227
3387
|
let plan = cache.get(key);
|
|
3228
3388
|
if (!plan) {
|
|
3229
|
-
plan =
|
|
3389
|
+
plan = _chunkRTAWQXMEcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
3230
3390
|
cache.set(key, plan);
|
|
3231
3391
|
}
|
|
3232
3392
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -3249,50 +3409,50 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3249
3409
|
});
|
|
3250
3410
|
pluginManager.addPlugins(config.plugins || []);
|
|
3251
3411
|
const clientPages = [];
|
|
3252
|
-
const integrationProviders =
|
|
3412
|
+
const integrationProviders = _chunkDVAZ53X6cjs.getIntegrationProviders.call(void 0, config.integrations).filter(
|
|
3253
3413
|
(provider) => provider.component || provider.type === "clerk"
|
|
3254
3414
|
);
|
|
3255
3415
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
3256
|
-
(provider) =>
|
|
3416
|
+
(provider) => !_chunkDVAZ53X6cjs.providerSupportsIslands.call(void 0, provider)
|
|
3257
3417
|
);
|
|
3258
|
-
if (_optionalChain([config, 'access',
|
|
3418
|
+
if (_optionalChain([config, 'access', _106 => _106.experimental, 'optionalAccess', _107 => _107.isolatedClientHydration]) === "enabled" && _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _108 => _108.experimental, 'optionalAccess', _109 => _109.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
3259
3419
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3260
|
-
`[Farm.js]
|
|
3420
|
+
`[Farm.js] Client components hydrate with their route, not as islands, because integration provider "${unsupportedIntegrationProvider.name}" doesn't declare \`islands: true\`.`
|
|
3261
3421
|
);
|
|
3262
3422
|
}
|
|
3263
|
-
const isolatedMode =
|
|
3264
|
-
_optionalChain([config, 'access',
|
|
3423
|
+
const isolatedMode = _chunkRTAWQXMEcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
3424
|
+
_optionalChain([config, 'access', _110 => _110.experimental, 'optionalAccess', _111 => _111.isolatedClientHydration]),
|
|
3265
3425
|
{
|
|
3266
|
-
serverComponents: _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3426
|
+
serverComponents: _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverComponents])) === "rsc",
|
|
3267
3427
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
3268
3428
|
}
|
|
3269
3429
|
);
|
|
3270
|
-
const planOptions =
|
|
3430
|
+
const planOptions = _chunkRTAWQXMEcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
3271
3431
|
config.renderer,
|
|
3272
3432
|
Boolean(unsupportedIntegrationProvider)
|
|
3273
3433
|
);
|
|
3274
3434
|
const pagePlanOptions = {
|
|
3275
3435
|
...planOptions,
|
|
3276
|
-
serverOwners: _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3436
|
+
serverOwners: _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _114 => _114.experimental, 'optionalAccess', _115 => _115.serverComponents])) === "islands"
|
|
3277
3437
|
};
|
|
3278
3438
|
const layoutPlanOptions = {
|
|
3279
3439
|
...planOptions,
|
|
3280
3440
|
serverTreeLayouts: pagePlanOptions.serverOwners
|
|
3281
3441
|
};
|
|
3282
|
-
const layoutAppliesToRoute =
|
|
3442
|
+
const layoutAppliesToRoute = _chunkYSRZSKQBcjs.routeBoundaryCoversDirectory;
|
|
3283
3443
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
3284
|
-
const islandsMode = _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3444
|
+
const islandsMode = _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _116 => _116.experimental, 'optionalAccess', _117 => _117.serverComponents])) === "islands";
|
|
3285
3445
|
const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
|
|
3286
|
-
const docsEntries = _optionalChain([config, 'access',
|
|
3446
|
+
const docsEntries = _optionalChain([config, 'access', _118 => _118.docs, 'optionalAccess', _119 => _119.enabled]) ? _chunkILQSRLKKcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
3287
3447
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
3288
3448
|
) : [];
|
|
3289
3449
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
3290
3450
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
3291
3451
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
3292
3452
|
);
|
|
3293
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
3453
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _120 => _120.docs, 'optionalAccess', _121 => _121.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
3294
3454
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
3295
|
-
const plan = (operation) => sourceSnapshot ?
|
|
3455
|
+
const plan = (operation) => sourceSnapshot ? _chunkRTAWQXMEcjs.withFarmSourceSnapshotOf.call(void 0, sourceSnapshot, operation) : _chunkRTAWQXMEcjs.withFarmSourceSnapshot.call(void 0, operation);
|
|
3296
3456
|
const { clientLayouts, clientRouteSlots } = plan(() => {
|
|
3297
3457
|
const clientLayouts2 = layoutRoutes.map((layout) => {
|
|
3298
3458
|
try {
|
|
@@ -3339,7 +3499,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3339
3499
|
};
|
|
3340
3500
|
}
|
|
3341
3501
|
});
|
|
3342
|
-
const markdownPagePlan =
|
|
3502
|
+
const markdownPagePlan = _chunkRTAWQXMEcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
3343
3503
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
3344
3504
|
root,
|
|
3345
3505
|
isolatedMode,
|
|
@@ -3347,7 +3507,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3347
3507
|
);
|
|
3348
3508
|
const routePlans = pageRoutes.map((route) => ({
|
|
3349
3509
|
route,
|
|
3350
|
-
metadata:
|
|
3510
|
+
metadata: _chunkJDT733EWcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
3351
3511
|
route.modulePath,
|
|
3352
3512
|
root,
|
|
3353
3513
|
isolatedMode,
|
|
@@ -3355,7 +3515,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3355
3515
|
pagePlanOptions
|
|
3356
3516
|
)
|
|
3357
3517
|
}));
|
|
3358
|
-
|
|
3518
|
+
_chunkRTAWQXMEcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
3359
3519
|
clientLayouts2.map((layout) => ({
|
|
3360
3520
|
pattern: layout.pattern,
|
|
3361
3521
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -3364,7 +3524,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3364
3524
|
[
|
|
3365
3525
|
...routePlans.map(({ route, metadata }) => ({
|
|
3366
3526
|
pattern: routeDirectory(route),
|
|
3367
|
-
depth:
|
|
3527
|
+
depth: _chunkYSRZSKQBcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
3368
3528
|
metadata
|
|
3369
3529
|
})),
|
|
3370
3530
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -3389,7 +3549,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3389
3549
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
3390
3550
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
3391
3551
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3392
|
-
`\u26A0\uFE0F ${
|
|
3552
|
+
`\u26A0\uFE0F ${_chunkRTAWQXMEcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`
|
|
3393
3553
|
);
|
|
3394
3554
|
}
|
|
3395
3555
|
}
|
|
@@ -3424,7 +3584,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3424
3584
|
);
|
|
3425
3585
|
if (metadata.suppressedAsyncHydration) {
|
|
3426
3586
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3427
|
-
`\u26A0\uFE0F ${
|
|
3587
|
+
`\u26A0\uFE0F ${_chunkRTAWQXMEcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
3428
3588
|
);
|
|
3429
3589
|
}
|
|
3430
3590
|
const slotBoundaries = serverSlotPlans.filter(
|
|
@@ -3432,7 +3592,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3432
3592
|
).flatMap(({ plan: plan2 }) => plan2.isolatedBoundaries);
|
|
3433
3593
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
|
|
3434
3594
|
const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
|
|
3435
|
-
const islandStrategy =
|
|
3595
|
+
const islandStrategy = _chunkM4YXD6MDcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
3436
3596
|
route,
|
|
3437
3597
|
metadata,
|
|
3438
3598
|
clientLayouts2,
|
|
@@ -3451,7 +3611,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3451
3611
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
3452
3612
|
],
|
|
3453
3613
|
// The server renders a server tree only below a hydrating layout.
|
|
3454
|
-
...
|
|
3614
|
+
..._chunkRTAWQXMEcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
3455
3615
|
});
|
|
3456
3616
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
3457
3617
|
}
|
|
@@ -3488,7 +3648,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3488
3648
|
}
|
|
3489
3649
|
const clientRouteSlots2 = routeSlots.filter((slot) => {
|
|
3490
3650
|
try {
|
|
3491
|
-
const metadata =
|
|
3651
|
+
const metadata = _chunkRTAWQXMEcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
|
|
3492
3652
|
return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
|
|
3493
3653
|
} catch (error) {
|
|
3494
3654
|
_chunk7U4XF76Rcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
@@ -3500,8 +3660,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3500
3660
|
const docsEntryOwns = (pattern) => syntheticDocsEntry === "/" || pattern === syntheticDocsEntry || pattern.startsWith(`${syntheticDocsEntry}/`);
|
|
3501
3661
|
if (syntheticDocsEntry && clientPages.some((page) => !page.docs && docsEntryOwns(page.pattern))) {
|
|
3502
3662
|
const docsPagePaths = new Set(
|
|
3503
|
-
|
|
3504
|
-
|
|
3663
|
+
_chunkILQSRLKKcjs.discoverFarmDocsPages.call(void 0,
|
|
3664
|
+
_chunkILQSRLKKcjs.resolveFarmDocsContentDir.call(void 0, config.docs, { root: config.root, srcDir: config.srcDir }),
|
|
3505
3665
|
config.docs
|
|
3506
3666
|
).map((page) => page.href)
|
|
3507
3667
|
);
|
|
@@ -3532,20 +3692,20 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3532
3692
|
srcDir,
|
|
3533
3693
|
adapterOwnsDocsRuntime ? false : _chunkN3H7UPBMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
3534
3694
|
adapterOwnsDocsRuntime ? void 0 : _chunkN3H7UPBMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
3535
|
-
_optionalChain([config, 'access',
|
|
3695
|
+
_optionalChain([config, 'access', _122 => _122.docs, 'optionalAccess', _123 => _123.enabled]) ? _chunkILQSRLKKcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
3536
3696
|
adapterOwnsDocsRuntime ? _chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter) : void 0,
|
|
3537
3697
|
config.i18n,
|
|
3538
3698
|
config.plugins,
|
|
3539
3699
|
config.renderer,
|
|
3540
3700
|
config.publicRuntimeConfig,
|
|
3541
3701
|
config.trailingSlash,
|
|
3542
|
-
|
|
3702
|
+
_chunkDVAZ53X6cjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
3543
3703
|
config.basePath,
|
|
3544
|
-
|
|
3704
|
+
_chunkM4YXD6MDcjs.generateClientCachePersistenceCode.call(void 0, _chunkM4YXD6MDcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
3545
3705
|
adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
3546
|
-
_chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3706
|
+
_chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _124 => _124.experimental, 'optionalAccess', _125 => _125.serverComponents])) === "islands",
|
|
3547
3707
|
platform,
|
|
3548
|
-
islandsMode ?
|
|
3708
|
+
islandsMode ? _chunkRTAWQXMEcjs.collectFarmServerStylesheets.call(void 0,
|
|
3549
3709
|
[
|
|
3550
3710
|
...layoutRoutes.map((layout) => layout.modulePath),
|
|
3551
3711
|
...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
|
|
@@ -3569,7 +3729,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3569
3729
|
await fs5.writeFile(_path2.default.join(clientEntryDir, "farm-client-root.tsx"), clientEntry.root);
|
|
3570
3730
|
}
|
|
3571
3731
|
const clientInput = { [entryName]: clientEntryPath };
|
|
3572
|
-
if (platform === "web" &&
|
|
3732
|
+
if (platform === "web" && _chunkM4YXD6MDcjs.canBootFarmIslandsClient.call(void 0, config)) {
|
|
3573
3733
|
const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
|
|
3574
3734
|
await fs5.writeFile(
|
|
3575
3735
|
clientBootPath,
|
|
@@ -3590,7 +3750,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3590
3750
|
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
3591
3751
|
await fs5.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
3592
3752
|
postcssSearchPath = clientEntryDir;
|
|
3593
|
-
tailwindVitePlugin = await
|
|
3753
|
+
tailwindVitePlugin = await _chunkRZI6436Fcjs.loadTailwindVitePlugin.call(void 0, {
|
|
3594
3754
|
builder: productionVite.builder,
|
|
3595
3755
|
announce: true
|
|
3596
3756
|
});
|
|
@@ -3611,11 +3771,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3611
3771
|
target: FARM_CLIENT_BUILD_TARGET,
|
|
3612
3772
|
// Tailwind CSS 4 already requires newer browsers than that baseline. An app's own
|
|
3613
3773
|
// `build.target` or `build.cssTarget` still decides, as Vite derives one from the other.
|
|
3614
|
-
..._optionalChain([config, 'access',
|
|
3774
|
+
..._optionalChain([config, 'access', _126 => _126.vite, 'optionalAccess', _127 => _127.build, 'optionalAccess', _128 => _128.target]) === void 0 && _optionalChain([config, 'access', _129 => _129.vite, 'optionalAccess', _130 => _130.build, 'optionalAccess', _131 => _131.cssTarget]) === void 0 && (_chunkRZI6436Fcjs.includesTailwindVitePlugin.call(void 0, tailwindVitePlugin) || _chunkRZI6436Fcjs.includesTailwindVitePlugin.call(void 0, _optionalChain([config, 'access', _132 => _132.vite, 'optionalAccess', _133 => _133.plugins]))) ? { cssTarget: _chunkRZI6436Fcjs.TAILWIND_CSS_BROWSER_TARGET } : {},
|
|
3615
3775
|
outDir: outputDir,
|
|
3616
3776
|
emptyOutDir: platform === "web",
|
|
3617
3777
|
// Never public: see resolveFarmClientSourcemap.
|
|
3618
|
-
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access',
|
|
3778
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _134 => _134.vite, 'optionalAccess', _135 => _135.build, 'optionalAccess', _136 => _136.sourcemap])),
|
|
3619
3779
|
assetsInlineLimit: 0,
|
|
3620
3780
|
cssCodeSplit: false,
|
|
3621
3781
|
// Bundle all CSS into one file
|
|
@@ -3627,7 +3787,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3627
3787
|
hashCharacters: "hex",
|
|
3628
3788
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
3629
3789
|
assetFileNames: (assetInfo) => {
|
|
3630
|
-
if (_optionalChain([assetInfo, 'access',
|
|
3790
|
+
if (_optionalChain([assetInfo, 'access', _137 => _137.name, 'optionalAccess', _138 => _138.endsWith, 'call', _139 => _139(".css")])) {
|
|
3631
3791
|
return `${entryName}.css`;
|
|
3632
3792
|
}
|
|
3633
3793
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -3644,7 +3804,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3644
3804
|
}
|
|
3645
3805
|
},
|
|
3646
3806
|
plugins: [
|
|
3647
|
-
|
|
3807
|
+
_chunkM4YXD6MDcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
3648
3808
|
createFarmPrivateClientSourcemapsPlugin({
|
|
3649
3809
|
outDir: _path2.default.join(
|
|
3650
3810
|
_path2.default.dirname(outputDir),
|
|
@@ -3694,11 +3854,15 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3694
3854
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
3695
3855
|
...rendererVitePlugins,
|
|
3696
3856
|
...config.vite.plugins || [],
|
|
3697
|
-
//
|
|
3698
|
-
|
|
3857
|
+
// Small shared chunks copied into their readers, and React in one chunk in islands mode,
|
|
3858
|
+
// unless the app's config or one of its plugins splits chunks.
|
|
3859
|
+
createFarmClientChunksPlugin({
|
|
3860
|
+
inlineCommonChunks: platform === "web",
|
|
3861
|
+
islandsReact: islandsMode && _chunkT7UC2ORAcjs.isReactRenderer.call(void 0, config.renderer)
|
|
3862
|
+
}),
|
|
3699
3863
|
farmServerOnlyEntriesPlugin({ platform, distDir: config.distDir || ".farm" }),
|
|
3700
3864
|
farmNavigationPlugin(config.renderer),
|
|
3701
|
-
|
|
3865
|
+
_chunkM4YXD6MDcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
3702
3866
|
adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
3703
3867
|
),
|
|
3704
3868
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
@@ -3731,7 +3895,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3731
3895
|
},
|
|
3732
3896
|
load: {
|
|
3733
3897
|
filter: {
|
|
3734
|
-
id:
|
|
3898
|
+
id: _chunkM4YXD6MDcjs.exactIdPattern.call(void 0, [
|
|
3735
3899
|
"\0empty-module",
|
|
3736
3900
|
"\0empty-api-route",
|
|
3737
3901
|
"\0farm-i18n-client-bridge",
|
|
@@ -3769,7 +3933,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3769
3933
|
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes, sourceSnapshot },
|
|
3770
3934
|
pluginManager
|
|
3771
3935
|
),
|
|
3772
|
-
|
|
3936
|
+
_chunkRTAWQXMEcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
3773
3937
|
],
|
|
3774
3938
|
mode: "production",
|
|
3775
3939
|
css: postcssSearchPath ? {
|
|
@@ -3777,7 +3941,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3777
3941
|
} : void 0,
|
|
3778
3942
|
// Ensure React is bundled for client
|
|
3779
3943
|
resolve: {
|
|
3780
|
-
alias:
|
|
3944
|
+
alias: _chunkM4YXD6MDcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
3781
3945
|
dedupe: [...config.renderer.dedupe || []]
|
|
3782
3946
|
},
|
|
3783
3947
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -3791,7 +3955,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3791
3955
|
}
|
|
3792
3956
|
};
|
|
3793
3957
|
await viteBuild(
|
|
3794
|
-
|
|
3958
|
+
_chunkM4YXD6MDcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite, { clientOutput: true })
|
|
3795
3959
|
);
|
|
3796
3960
|
if (platform === "mobile") {
|
|
3797
3961
|
await fs5.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
@@ -3885,9 +4049,9 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
3885
4049
|
return response;
|
|
3886
4050
|
}
|
|
3887
4051
|
|
|
3888
|
-
${streamNavigations ? `${
|
|
4052
|
+
${streamNavigations ? `${_chunkM4YXD6MDcjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
|
|
3889
4053
|
|
|
3890
|
-
${
|
|
4054
|
+
${_chunkM4YXD6MDcjs.FARM_EARLY_NAVIGATION_SOURCE}` : ""}
|
|
3891
4055
|
|
|
3892
4056
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
3893
4057
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
@@ -4056,8 +4220,8 @@ for (const type of FARM_ROUTE_TABLE_INTENT_EVENTS) {
|
|
|
4056
4220
|
}`;
|
|
4057
4221
|
}
|
|
4058
4222
|
function getFarmClientLayoutMatch(pattern) {
|
|
4059
|
-
const groupScope =
|
|
4060
|
-
return groupScope ? { pattern, urlPattern:
|
|
4223
|
+
const groupScope = _chunkYSRZSKQBcjs.getRouteGroupScope.call(void 0, pattern);
|
|
4224
|
+
return groupScope ? { pattern, urlPattern: _chunkYSRZSKQBcjs.stripRouteGroups.call(void 0, pattern), groupScope } : { pattern };
|
|
4061
4225
|
}
|
|
4062
4226
|
function generateFarmClientLayoutSelectionSource() {
|
|
4063
4227
|
return `function selectFarmClientLayouts(layouts, routePathname, readDirectory) {
|
|
@@ -5060,7 +5224,7 @@ function readFarmEntryImports(source) {
|
|
|
5060
5224
|
for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
|
|
5061
5225
|
const from = match[2];
|
|
5062
5226
|
const named = /\{([^}]*)\}/.exec(match[1]);
|
|
5063
|
-
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess',
|
|
5227
|
+
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _140 => _140[1], 'optionalAccess', _141 => _141.split, 'call', _142 => _142(",")]), () => ( []))) {
|
|
5064
5228
|
const [imported, local] = specifier.trim().split(/\s+as\s+/);
|
|
5065
5229
|
if (imported)
|
|
5066
5230
|
bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
|
|
@@ -5197,7 +5361,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
5197
5361
|
direction: {}
|
|
5198
5362
|
}, plugins = [], renderer = _chunkT7UC2ORAcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform, serverStylesheets = []) {
|
|
5199
5363
|
const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
|
|
5200
|
-
const clientPluginEntry =
|
|
5364
|
+
const clientPluginEntry = _chunkRZI6436Fcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
5201
5365
|
plugins,
|
|
5202
5366
|
root,
|
|
5203
5367
|
srcDir,
|
|
@@ -5222,7 +5386,7 @@ import { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};
|
|
|
5222
5386
|
const React = { ...__farmRendererClient };`
|
|
5223
5387
|
);
|
|
5224
5388
|
const hydrateFarmRouteCall = _chunkT7UC2ORAcjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);";
|
|
5225
|
-
const providerClientCode =
|
|
5389
|
+
const providerClientCode = _chunkM4YXD6MDcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
5226
5390
|
integrationProviders,
|
|
5227
5391
|
root,
|
|
5228
5392
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -5246,12 +5410,12 @@ const React = { ...__farmRendererClient };`
|
|
|
5246
5410
|
const layoutRegistrations = [];
|
|
5247
5411
|
const layoutComponents = [];
|
|
5248
5412
|
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
5249
|
-
const treeLayoutPatterns = islandValues ?
|
|
5413
|
+
const treeLayoutPatterns = islandValues ? _chunkYSRZSKQBcjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
|
|
5250
5414
|
layoutRoutes.forEach((layout, index) => {
|
|
5251
5415
|
const relativePath = toImportPath(layout.modulePath);
|
|
5252
5416
|
const treeLayout = treeLayoutPatterns.has(layout.pattern);
|
|
5253
5417
|
const rendersOnClient = treeLayout || !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some(
|
|
5254
|
-
(pattern) =>
|
|
5418
|
+
(pattern) => _chunkYSRZSKQBcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
|
|
5255
5419
|
);
|
|
5256
5420
|
if (rendersOnClient && !treeLayout) {
|
|
5257
5421
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
@@ -5356,7 +5520,7 @@ mountFarmDocsSearch();
|
|
|
5356
5520
|
|
|
5357
5521
|
${generateUniversalRouterStateRuntime()}
|
|
5358
5522
|
|
|
5359
|
-
${
|
|
5523
|
+
${_chunkM4YXD6MDcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
5360
5524
|
|
|
5361
5525
|
// SPA Router for server-rendered pages (HTML swap)
|
|
5362
5526
|
const spaRouter = {
|
|
@@ -5898,7 +6062,7 @@ ${layoutRegistrations.join(",\n")}
|
|
|
5898
6062
|
${generateFarmClientRouteMatchSource({ lazyMatcher })}
|
|
5899
6063
|
|
|
5900
6064
|
${layoutComponentsRuntime}/*farm-root-start*/
|
|
5901
|
-
${
|
|
6065
|
+
${_chunkM4YXD6MDcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
5902
6066
|
// Wrap a page element with applicable layouts
|
|
5903
6067
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
5904
6068
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -5933,7 +6097,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
5933
6097
|
return React.createElement("div", props, pageElement);
|
|
5934
6098
|
}
|
|
5935
6099
|
let farmLastRouteState = null;
|
|
5936
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
6100
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkM4YXD6MDcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
5937
6101
|
function farmTreeLayoutsOf(pathname) {
|
|
5938
6102
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
5939
6103
|
return layout.serverTree === true;
|
|
@@ -6567,7 +6731,7 @@ function fitsSegmentResponse(currentRoot, nextRoot) {
|
|
|
6567
6731
|
return true;
|
|
6568
6732
|
}` : ""}
|
|
6569
6733
|
|
|
6570
|
-
${
|
|
6734
|
+
${_chunkM4YXD6MDcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
6571
6735
|
|
|
6572
6736
|
function activateNavigationScripts(root) {
|
|
6573
6737
|
for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
|
|
@@ -6673,7 +6837,7 @@ function getLayoutShell(root, patterns, index) {
|
|
|
6673
6837
|
return shell.innerHTML;
|
|
6674
6838
|
}
|
|
6675
6839
|
|
|
6676
|
-
${islandValues ?
|
|
6840
|
+
${islandValues ? _chunkM4YXD6MDcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
6677
6841
|
// A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
|
|
6678
6842
|
if (refresh) revealFarmStreamedContent(nextRoot);
|
|
6679
6843
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
@@ -7374,7 +7538,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7374
7538
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
7375
7539
|
"module.exports = { plugins: [] };\n"
|
|
7376
7540
|
);
|
|
7377
|
-
tailwindVitePlugin = await
|
|
7541
|
+
tailwindVitePlugin = await _chunkRZI6436Fcjs.loadTailwindVitePlugin.call(void 0, {
|
|
7378
7542
|
builder: productionVite.builder,
|
|
7379
7543
|
label: "for SSR"
|
|
7380
7544
|
});
|
|
@@ -7457,7 +7621,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7457
7621
|
const appDirs = _chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config);
|
|
7458
7622
|
let openAPIReference = null;
|
|
7459
7623
|
if (config.openapi.enabled && config.openapi.route) {
|
|
7460
|
-
const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-
|
|
7624
|
+
const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-37UJPUN4.cjs");
|
|
7461
7625
|
const openAPIManager = new OpenAPIManager(appDirs, config.openapi, {
|
|
7462
7626
|
mode: "production",
|
|
7463
7627
|
apiBaseURL: config.api.baseURL,
|
|
@@ -7482,7 +7646,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7482
7646
|
}))
|
|
7483
7647
|
);
|
|
7484
7648
|
const instrumentationPath = _chunk3BTN3NP7cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
7485
|
-
const notFoundPath =
|
|
7649
|
+
const notFoundPath = _chunkM4YXD6MDcjs.resolveFarmNotFoundComponentPath.call(void 0,
|
|
7486
7650
|
config,
|
|
7487
7651
|
appDirs,
|
|
7488
7652
|
routeManager.getRendererNotFoundPath()
|
|
@@ -7503,14 +7667,14 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7503
7667
|
const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
|
|
7504
7668
|
(integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
|
|
7505
7669
|
);
|
|
7506
|
-
const hasIntegrationProviders =
|
|
7670
|
+
const hasIntegrationProviders = _chunkDVAZ53X6cjs.getIntegrationProviders.call(void 0, config.integrations).some(
|
|
7507
7671
|
(provider) => provider.component || provider.type === "clerk"
|
|
7508
7672
|
);
|
|
7509
7673
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
7510
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
7511
|
-
const hasMiddlewareConfig =
|
|
7512
|
-
const hasRouteContextConfig =
|
|
7513
|
-
const hasServerRuntimePlugins =
|
|
7674
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _143 => _143.mdx, 'optionalAccess', _144 => _144.components]));
|
|
7675
|
+
const hasMiddlewareConfig = _chunkYSRZSKQBcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
7676
|
+
const hasRouteContextConfig = _chunkUOMSGJHKcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
7677
|
+
const hasServerRuntimePlugins = _chunkRZI6436Fcjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
|
|
7514
7678
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
7515
7679
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
7516
7680
|
const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasServerCacheConfig || hasFarmServerStorageConfig(config.storage) || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
|
|
@@ -7521,7 +7685,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7521
7685
|
);
|
|
7522
7686
|
if (_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
7523
7687
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
7524
|
-
|
|
7688
|
+
_chunkRBSGFS5Xcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
7525
7689
|
config.docs,
|
|
7526
7690
|
{ root, srcDir: config.srcDir },
|
|
7527
7691
|
(pathname) => adapterGuardedPaths.has(pathname),
|
|
@@ -7529,9 +7693,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7529
7693
|
);
|
|
7530
7694
|
}
|
|
7531
7695
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
7532
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
7696
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _145 => _145.docs, 'optionalAccess', _146 => _146.enabled]) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunk2RSVYJT6cjs._runWithFarmCspNonce.call(void 0,
|
|
7533
7697
|
farmDocsCspNonceMarker,
|
|
7534
|
-
async () => _optionalChain([config, 'access',
|
|
7698
|
+
async () => _optionalChain([config, 'access', _147 => _147.docs, 'access', _148 => _148.adapter, 'optionalAccess', _149 => _149.server]) ? await _chunkRBSGFS5Xcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
7535
7699
|
root,
|
|
7536
7700
|
srcDir: config.srcDir,
|
|
7537
7701
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -7645,7 +7809,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7645
7809
|
// Adapters can render provider scripts by serializing function source.
|
|
7646
7810
|
// keepNames injects helper calls into those functions; after Nitro
|
|
7647
7811
|
// minifies the server chunk the helper is no longer in script scope.
|
|
7648
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
7812
|
+
keepNames: !(_optionalChain([config, 'access', _150 => _150.docs, 'optionalAccess', _151 => _151.enabled]) && _optionalChain([config, 'access', _152 => _152.docs, 'access', _153 => _153.adapter, 'optionalAccess', _154 => _154.server])),
|
|
7649
7813
|
jsxDev: false
|
|
7650
7814
|
},
|
|
7651
7815
|
// SSR configuration to externalize problematic modules
|
|
@@ -7695,10 +7859,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7695
7859
|
define: {
|
|
7696
7860
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
7697
7861
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
7698
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
7862
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _155 => _155.env, 'optionalAccess', _156 => _156.public]) || {})
|
|
7699
7863
|
},
|
|
7700
7864
|
plugins: [
|
|
7701
|
-
|
|
7865
|
+
_chunkM4YXD6MDcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
7702
7866
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
7703
7867
|
...rendererVitePlugins,
|
|
7704
7868
|
...config.vite.plugins || [],
|
|
@@ -7718,7 +7882,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7718
7882
|
},
|
|
7719
7883
|
createVercelOgFontInlinePlugin(edgeMetadataImageRuntime.runtime)
|
|
7720
7884
|
] : [],
|
|
7721
|
-
{ ...
|
|
7885
|
+
{ ..._chunkEODGIFI7cjs.createReactProductionModePlugin.call(void 0, ), enforce: "pre" },
|
|
7722
7886
|
farmServerOnlyEntriesPlugin({ distDir: config.distDir || ".farm" }),
|
|
7723
7887
|
farmNavigationPlugin(config.renderer),
|
|
7724
7888
|
farmIslandContainersPlugin(config),
|
|
@@ -7730,7 +7894,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7730
7894
|
},
|
|
7731
7895
|
pluginManager
|
|
7732
7896
|
),
|
|
7733
|
-
|
|
7897
|
+
_chunkRTAWQXMEcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
|
|
7734
7898
|
...hasRuntimeConfigModule ? [
|
|
7735
7899
|
farmStripPlatformConfigPlugin(
|
|
7736
7900
|
[
|
|
@@ -7742,7 +7906,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7742
7906
|
{
|
|
7743
7907
|
name: "farm-virtual-ssr-entry",
|
|
7744
7908
|
resolveId: {
|
|
7745
|
-
filter: { id:
|
|
7909
|
+
filter: { id: _chunkM4YXD6MDcjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
|
|
7746
7910
|
handler(id) {
|
|
7747
7911
|
if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
|
|
7748
7912
|
return virtualEntryId;
|
|
@@ -7751,7 +7915,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7751
7915
|
}
|
|
7752
7916
|
},
|
|
7753
7917
|
load: {
|
|
7754
|
-
filter: { id:
|
|
7918
|
+
filter: { id: _chunkM4YXD6MDcjs.exactIdPattern.call(void 0, [virtualEntryId]) },
|
|
7755
7919
|
handler(id) {
|
|
7756
7920
|
if (id === virtualEntryId) {
|
|
7757
7921
|
return virtualEntryCode;
|
|
@@ -7763,7 +7927,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7763
7927
|
{
|
|
7764
7928
|
name: "capture-ssr-bundle",
|
|
7765
7929
|
configResolved(config2) {
|
|
7766
|
-
polyroute =
|
|
7930
|
+
polyroute = _chunkSIECKBNKcjs.hasPolyroutePlugin.call(void 0, config2.plugins);
|
|
7767
7931
|
},
|
|
7768
7932
|
enforce: "post",
|
|
7769
7933
|
generateBundle: {
|
|
@@ -7791,7 +7955,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7791
7955
|
resolve: {
|
|
7792
7956
|
alias: [
|
|
7793
7957
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
7794
|
-
...Object.entries(
|
|
7958
|
+
...Object.entries(_chunkM4YXD6MDcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
7795
7959
|
([find, replacement]) => ({ find, replacement })
|
|
7796
7960
|
)
|
|
7797
7961
|
],
|
|
@@ -7799,7 +7963,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7799
7963
|
dedupe: [...config.renderer.dedupe || []]
|
|
7800
7964
|
}
|
|
7801
7965
|
};
|
|
7802
|
-
await viteBuild(
|
|
7966
|
+
await viteBuild(_chunkM4YXD6MDcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
7803
7967
|
} finally {
|
|
7804
7968
|
if (postcssConfigDir) {
|
|
7805
7969
|
try {
|
|
@@ -7836,26 +8000,26 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
7836
8000
|
return lastModified;
|
|
7837
8001
|
}
|
|
7838
8002
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
7839
|
-
if (!_optionalChain([config, 'access',
|
|
8003
|
+
if (!_optionalChain([config, 'access', _157 => _157.docs, 'optionalAccess', _158 => _158.enabled])) return [];
|
|
7840
8004
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
7841
8005
|
const guards = {
|
|
7842
8006
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
7843
8007
|
middlewareRoutes
|
|
7844
8008
|
};
|
|
7845
|
-
return
|
|
7846
|
-
(docsRoot) =>
|
|
7847
|
-
).flatMap((page) => [page.href,
|
|
8009
|
+
return _chunkILQSRLKKcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
|
|
8010
|
+
(docsRoot) => _chunkILQSRLKKcjs.discoverFarmDocsPages.call(void 0, _chunkILQSRLKKcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
|
|
8011
|
+
).flatMap((page) => [page.href, _chunkILQSRLKKcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkYSRZSKQBcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
7848
8012
|
}
|
|
7849
8013
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
7850
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
8014
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _159 => _159.llmsTxt]);
|
|
7851
8015
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
7852
8016
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
7853
8017
|
);
|
|
7854
8018
|
return [
|
|
7855
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
7856
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
7857
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
7858
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
8019
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _160 => _160.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
8020
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _161 => _161.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
8021
|
+
..._optionalChain([agent, 'optionalAccess', _162 => _162.sitemap, 'optionalAccess', _163 => _163.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
8022
|
+
..._optionalChain([agent, 'optionalAccess', _164 => _164.crawlers, 'optionalAccess', _165 => _165.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
7859
8023
|
];
|
|
7860
8024
|
}
|
|
7861
8025
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -7866,10 +8030,13 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
7866
8030
|
docsPath: ${root}.entry,
|
|
7867
8031
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
7868
8032
|
}`;
|
|
7869
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
8033
|
+
if (_optionalChain([docs, 'optionalAccess', _166 => _166.roots, 'optionalAccess', _167 => _167.length])) {
|
|
7870
8034
|
return {
|
|
7871
8035
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
7872
|
-
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (
|
|
8036
|
+
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => ({
|
|
8037
|
+
...${runtimeConfig("farmDocsRoot")},
|
|
8038
|
+
rootDir: farmDocsRoot.rootDir || farmDocsRuntimeRoot,
|
|
8039
|
+
}))`
|
|
7873
8040
|
};
|
|
7874
8041
|
}
|
|
7875
8042
|
return {
|
|
@@ -7877,9 +8044,9 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
7877
8044
|
config: runtimeConfig("farmDocsResolvedConfig")
|
|
7878
8045
|
};
|
|
7879
8046
|
}
|
|
7880
|
-
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
8047
|
+
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false, bundledRootPaths = []) {
|
|
7881
8048
|
if (!docs.enabled) return "null";
|
|
7882
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
8049
|
+
const serializableDocs = _optionalChain([docs, 'access', _168 => _168.roots, 'optionalAccess', _169 => _169.length]) ? {
|
|
7883
8050
|
...docs,
|
|
7884
8051
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
7885
8052
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -7913,24 +8080,25 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
7913
8080
|
},
|
|
7914
8081
|
}
|
|
7915
8082
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
7916
|
-
if (!_optionalChain([docs, 'access',
|
|
7917
|
-
return `((farmDocs) => ({
|
|
8083
|
+
if (!_optionalChain([docs, 'access', _170 => _170.roots, 'optionalAccess', _171 => _171.length])) return expression;
|
|
8084
|
+
return `((farmDocs, farmDocsBundledRootPaths) => ({
|
|
7918
8085
|
...farmDocs,
|
|
7919
8086
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
7920
|
-
const
|
|
8087
|
+
const rootDir = farmDocsBundledRootsDir
|
|
7921
8088
|
? farmDocsJoin(farmDocsBundledRootsDir, String(index))
|
|
7922
8089
|
: null;
|
|
8090
|
+
const contentDir = rootDir && farmDocsJoin(rootDir, farmDocsBundledRootPaths[index] || "");
|
|
7923
8091
|
return contentDir && farmDocsExistsSync(contentDir)
|
|
7924
|
-
? { ...farmDocsRoot, contentDir, config: { ...farmDocsRoot.config, contentDir } }
|
|
8092
|
+
? { ...farmDocsRoot, rootDir, contentDir, config: { ...farmDocsRoot.config, contentDir } }
|
|
7925
8093
|
: farmDocsRoot;
|
|
7926
8094
|
}),
|
|
7927
|
-
}))(${expression})`;
|
|
8095
|
+
}))(${expression}, ${JSON.stringify(bundledRootPaths)})`;
|
|
7928
8096
|
}
|
|
7929
8097
|
function toVirtualEntryImportSpecifier(modulePath) {
|
|
7930
8098
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
7931
8099
|
}
|
|
7932
8100
|
function generateNativeAuthIntegrationSource(auth) {
|
|
7933
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
8101
|
+
if (_optionalChain([auth, 'optionalAccess', _172 => _172.enabled]) !== true) {
|
|
7934
8102
|
return { importSource: "", registerSource: "" };
|
|
7935
8103
|
}
|
|
7936
8104
|
return {
|
|
@@ -8245,30 +8413,31 @@ ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
|
8245
8413
|
}
|
|
8246
8414
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
|
|
8247
8415
|
const farmRendererDisabled = _chunkT7UC2ORAcjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
8416
|
+
const farmStaticNotFoundBuild = preset === "vercel" && _optionalChain([config, 'access', _173 => _173.experimental, 'optionalAccess', _174 => _174.staticNotFound]) === true && !farmRendererDisabled;
|
|
8248
8417
|
const searchPreserveRoutes = pageRoutes.flatMap(
|
|
8249
8418
|
(route) => route.searchPreserve ? [route.searchPreserve] : []
|
|
8250
8419
|
);
|
|
8251
8420
|
const searchPreserveRoutesSource = searchPreserveRoutes.length > 0 ? JSON.stringify(searchPreserveRoutes) : "";
|
|
8252
|
-
const farmIslandsMode = _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
8253
|
-
const farmRendererActions =
|
|
8254
|
-
const farmClientBoot =
|
|
8421
|
+
const farmIslandsMode = _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _175 => _175.experimental, 'optionalAccess', _176 => _176.serverComponents])) === "islands";
|
|
8422
|
+
const farmRendererActions = _chunkM4YXD6MDcjs.resolveFarmIslxActionsMode.call(void 0, config) === "renderer";
|
|
8423
|
+
const farmClientBoot = _chunkM4YXD6MDcjs.canBootFarmIslandsClient.call(void 0, config);
|
|
8255
8424
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
8256
8425
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
8257
8426
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "edge";
|
|
8258
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
8427
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _177 => _177.agent, 'optionalAccess', _178 => _178.crawlers, 'optionalAccess', _179 => _179.enabled])) && !applicationMetadataRoutes.some(
|
|
8259
8428
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
8260
8429
|
);
|
|
8261
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
8430
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _180 => _180.agent, 'optionalAccess', _181 => _181.sitemap, 'optionalAccess', _182 => _182.enabled])) && !applicationMetadataRoutes.some(
|
|
8262
8431
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
8263
8432
|
);
|
|
8264
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
8265
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
8433
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _183 => _183.agent, 'optionalAccess', _184 => _184.mcp]) === true && !_chunkJH4CDG4Gcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
8434
|
+
const servesAiCatalog = _optionalChain([config, 'access', _185 => _185.agent, 'optionalAccess', _186 => _186.aiCatalog]) !== false;
|
|
8266
8435
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
8267
8436
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
8268
|
-
const reportsWebMCPCalls = hasInfraAnalyticsRuntime &&
|
|
8437
|
+
const reportsWebMCPCalls = hasInfraAnalyticsRuntime && _chunkUGWKNZ4Ucjs._farmWebMCPReportsEnabled.call(void 0, config.plugins);
|
|
8269
8438
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
8270
8439
|
const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
|
|
8271
|
-
if (_optionalChain([config, 'access',
|
|
8440
|
+
if (_optionalChain([config, 'access', _187 => _187.docs, 'optionalAccess', _188 => _188.enabled]) && _optionalChain([config, 'access', _189 => _189.docs, 'access', _190 => _190.roots, 'optionalAccess', _191 => _191.length]) && !adapterOwnsDocsRuntime) {
|
|
8272
8441
|
throw new Error(
|
|
8273
8442
|
"Several docs roots need a docs adapter; Farm's built-in docs renderer serves a single docs root."
|
|
8274
8443
|
);
|
|
@@ -8340,9 +8509,9 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8340
8509
|
(image) => image.sourceType === "module"
|
|
8341
8510
|
);
|
|
8342
8511
|
const edgeMiddlewareFilePaths = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutes.filter(isFarmEdgeMiddlewareRoute).map((route) => route.filePath) : [];
|
|
8343
|
-
const hasMiddlewareRuntime = middlewareRoutes.length > 0 ||
|
|
8344
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
8345
|
-
const integrationProviders =
|
|
8512
|
+
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkYSRZSKQBcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
8513
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _192 => _192.docs, 'optionalAccess', _193 => _193.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
8514
|
+
const integrationProviders = _chunkDVAZ53X6cjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
8346
8515
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
8347
8516
|
(provider) => provider.component || provider.type === "clerk"
|
|
8348
8517
|
);
|
|
@@ -8351,16 +8520,16 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8351
8520
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
8352
8521
|
);
|
|
8353
8522
|
}
|
|
8354
|
-
const providerServerModules =
|
|
8523
|
+
const providerServerModules = _chunkM4YXD6MDcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
8355
8524
|
renderedIntegrationProviders,
|
|
8356
8525
|
config.root,
|
|
8357
8526
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
8358
8527
|
);
|
|
8359
8528
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
8360
8529
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
8361
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
8530
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _194 => _194.providers]);
|
|
8362
8531
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
8363
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
8532
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _195 => _195.component]) === "function")) {
|
|
8364
8533
|
throw new Error(
|
|
8365
8534
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
8366
8535
|
);
|
|
@@ -8369,24 +8538,24 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8369
8538
|
})
|
|
8370
8539
|
);
|
|
8371
8540
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
8372
|
-
(provider) =>
|
|
8541
|
+
(provider) => !_chunkDVAZ53X6cjs.providerSupportsIslands.call(void 0, provider)
|
|
8373
8542
|
);
|
|
8374
|
-
const isolatedHydrationMode =
|
|
8375
|
-
_optionalChain([config, 'access',
|
|
8543
|
+
const isolatedHydrationMode = _chunkRTAWQXMEcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
8544
|
+
_optionalChain([config, 'access', _196 => _196.experimental, 'optionalAccess', _197 => _197.isolatedClientHydration]),
|
|
8376
8545
|
{
|
|
8377
|
-
serverComponents: _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
8546
|
+
serverComponents: _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _198 => _198.experimental, 'optionalAccess', _199 => _199.serverComponents])) === "rsc",
|
|
8378
8547
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
8379
8548
|
}
|
|
8380
8549
|
);
|
|
8381
|
-
const hydrationPlanOptions =
|
|
8550
|
+
const hydrationPlanOptions = _chunkRTAWQXMEcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
8382
8551
|
config.renderer,
|
|
8383
8552
|
Boolean(unsupportedIntegrationProvider)
|
|
8384
8553
|
);
|
|
8385
8554
|
const pageHydrationPlanOptions = {
|
|
8386
8555
|
...hydrationPlanOptions,
|
|
8387
|
-
serverOwners: _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
8556
|
+
serverOwners: _chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _200 => _200.experimental, 'optionalAccess', _201 => _201.serverComponents])) === "islands"
|
|
8388
8557
|
};
|
|
8389
|
-
const { layoutHydrationPlans, pageHydrationPlans } =
|
|
8558
|
+
const { layoutHydrationPlans, pageHydrationPlans } = _chunkRTAWQXMEcjs.withFarmSourceSnapshot.call(void 0, () => {
|
|
8390
8559
|
const layoutHydrationPlans2 = layoutRoutes.map((layout) => ({
|
|
8391
8560
|
...layout,
|
|
8392
8561
|
hydration: getCachedClientModuleHydrationPlan(
|
|
@@ -8397,7 +8566,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8397
8566
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
8398
8567
|
)
|
|
8399
8568
|
}));
|
|
8400
|
-
const markdownPagePlan =
|
|
8569
|
+
const markdownPagePlan = _chunkRTAWQXMEcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
8401
8570
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
8402
8571
|
config.root,
|
|
8403
8572
|
isolatedHydrationMode,
|
|
@@ -8406,7 +8575,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8406
8575
|
const pageHydrationPlans2 = new Map(
|
|
8407
8576
|
pageRoutes.map((route) => [
|
|
8408
8577
|
route.modulePath,
|
|
8409
|
-
|
|
8578
|
+
_chunkJDT733EWcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
8410
8579
|
route.modulePath,
|
|
8411
8580
|
config.root,
|
|
8412
8581
|
isolatedHydrationMode,
|
|
@@ -8417,7 +8586,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8417
8586
|
);
|
|
8418
8587
|
return { layoutHydrationPlans: layoutHydrationPlans2, pageHydrationPlans: pageHydrationPlans2 };
|
|
8419
8588
|
});
|
|
8420
|
-
|
|
8589
|
+
_chunkRTAWQXMEcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
8421
8590
|
layoutHydrationPlans.map((layout) => ({
|
|
8422
8591
|
pattern: layout.pattern,
|
|
8423
8592
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -8426,10 +8595,10 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8426
8595
|
pageRoutes.map((route) => ({
|
|
8427
8596
|
// Compared by directory so a grouped layout applies only inside its group.
|
|
8428
8597
|
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
8429
|
-
depth:
|
|
8598
|
+
depth: _chunkYSRZSKQBcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
8430
8599
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
8431
8600
|
})),
|
|
8432
|
-
|
|
8601
|
+
_chunkYSRZSKQBcjs.routeBoundaryCoversDirectory,
|
|
8433
8602
|
{ serverOwners: pageHydrationPlanOptions.serverOwners }
|
|
8434
8603
|
);
|
|
8435
8604
|
const providerServerImports = [
|
|
@@ -8438,16 +8607,20 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8438
8607
|
].filter(Boolean).join("\n");
|
|
8439
8608
|
const apiImports = [];
|
|
8440
8609
|
const apiRegistrations = [];
|
|
8610
|
+
const nativeAPIRoutes = [];
|
|
8441
8611
|
apiRoutes.forEach((route, index) => {
|
|
8442
8612
|
if (!route.filePath) return;
|
|
8443
8613
|
const varName = `apiRoute${index}`;
|
|
8444
8614
|
apiImports.push(
|
|
8445
8615
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.filePath)};`
|
|
8446
8616
|
);
|
|
8617
|
+
if (_chunkSIECKBNKcjs.isPolyrouteRouteFileName.call(void 0, _path2.default.basename(route.filePath))) {
|
|
8618
|
+
nativeAPIRoutes.push(`[${JSON.stringify(route.path)}, ${varName}]`);
|
|
8619
|
+
}
|
|
8447
8620
|
apiRegistrations.push(`
|
|
8448
8621
|
{
|
|
8449
8622
|
path: ${JSON.stringify(route.path)},
|
|
8450
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
8623
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _202 => _202.pluginMethods, 'optionalAccess', _203 => _203.includes, 'call', _204 => _204(method)])))},
|
|
8451
8624
|
endpoints: ${varName},
|
|
8452
8625
|
}`);
|
|
8453
8626
|
});
|
|
@@ -8460,9 +8633,9 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8460
8633
|
}).map(({ route }) => route);
|
|
8461
8634
|
orderedPageRoutes.forEach((route, index) => {
|
|
8462
8635
|
const varName = `pageRoute${index}`;
|
|
8463
|
-
if (
|
|
8464
|
-
const renderingDirective2 =
|
|
8465
|
-
const markdownServerTree = pageHydrationPlanOptions.serverOwners &&
|
|
8636
|
+
if (_chunkJDT733EWcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
8637
|
+
const renderingDirective2 = _chunkEXPVSFAGcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
8638
|
+
const markdownServerTree = pageHydrationPlanOptions.serverOwners && _chunkRTAWQXMEcjs.usesFarmServerTree.call(void 0, pageHydrationPlans.get(route.modulePath));
|
|
8466
8639
|
pageRegistrations.push(`
|
|
8467
8640
|
{
|
|
8468
8641
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -8470,14 +8643,14 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8470
8643
|
rendering: ${JSON.stringify(renderingDirective2)},` : ""}${markdownServerTree ? "\n serverTree: true," : ""}
|
|
8471
8644
|
module: createFarmMarkdownRouteModule({
|
|
8472
8645
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
8473
|
-
filePath: ${JSON.stringify(
|
|
8646
|
+
filePath: ${JSON.stringify(_chunkM4YXD6MDcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.modulePath))},
|
|
8474
8647
|
components: farmMdxComponents,
|
|
8475
8648
|
config: farmMdxConfig,${_chunkT7UC2ORAcjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: React,"}
|
|
8476
8649
|
}),
|
|
8477
8650
|
markdownSource: {
|
|
8478
8651
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
8479
8652
|
filePath: ${JSON.stringify(
|
|
8480
|
-
|
|
8653
|
+
_chunkM4YXD6MDcjs.toBakedMarkdownSourcePath.call(void 0, config.root, _nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath)))
|
|
8481
8654
|
)},
|
|
8482
8655
|
},
|
|
8483
8656
|
}`);
|
|
@@ -8487,7 +8660,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8487
8660
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
8488
8661
|
);
|
|
8489
8662
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
8490
|
-
const renderingDirective =
|
|
8663
|
+
const renderingDirective = _chunkEXPVSFAGcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
8491
8664
|
pageRegistrations.push(`
|
|
8492
8665
|
{
|
|
8493
8666
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -8495,8 +8668,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8495
8668
|
module: ${varName},
|
|
8496
8669
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
8497
8670
|
clientModule: ${JSON.stringify(_chunk7U4XF76Rcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
8498
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
8499
|
-
const rootStrategy =
|
|
8671
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkRTAWQXMEcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
|
|
8672
|
+
const rootStrategy = _chunkM4YXD6MDcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
8500
8673
|
route,
|
|
8501
8674
|
clientMetadata,
|
|
8502
8675
|
layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
|
|
@@ -8509,13 +8682,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8509
8682
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
8510
8683
|
${route.source !== void 0 ? `markdownSource: {
|
|
8511
8684
|
source: ${JSON.stringify(route.source)},
|
|
8512
|
-
filePath: ${JSON.stringify(
|
|
8685
|
+
filePath: ${JSON.stringify(_chunkM4YXD6MDcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.markdownSourcePath))},
|
|
8513
8686
|
},` : ""}
|
|
8514
8687
|
}`);
|
|
8515
8688
|
});
|
|
8516
8689
|
const layoutImports = [];
|
|
8517
8690
|
const layoutRegistrations = [];
|
|
8518
|
-
const treeLayoutPatterns = farmIslandsMode ?
|
|
8691
|
+
const treeLayoutPatterns = farmIslandsMode ? _chunkYSRZSKQBcjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
8519
8692
|
layoutHydrationPlans.map((layout) => ({
|
|
8520
8693
|
pattern: layout.pattern,
|
|
8521
8694
|
shouldHydrate: layout.hydration.shouldHydrate,
|
|
@@ -8533,7 +8706,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8533
8706
|
pattern: ${JSON.stringify(layout.pattern)},
|
|
8534
8707
|
module: ${varName},
|
|
8535
8708
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},
|
|
8536
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode &&
|
|
8709
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode && _chunkM4YXD6MDcjs.canFarmSkipKeptLayoutRender.call(void 0, layout.modulePath, config.root) ? "\n skipKeptRender: true," : ""}${// A layout whose client components hydrate as islands of their own (islands mode,
|
|
8537
8710
|
// isolatedClientHydration, or an async layout): it wraps a docs page as an app page.
|
|
8538
8711
|
clientMetadata.hasIsolatedClientBoundaries ? "\n islands: true," : ""}
|
|
8539
8712
|
}`);
|
|
@@ -8561,7 +8734,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8561
8734
|
containerId: ${JSON.stringify(slot.containerId)},
|
|
8562
8735
|
interception: ${JSON.stringify(slot.interception)},
|
|
8563
8736
|
fallback: ${JSON.stringify(slot.fallback)},
|
|
8564
|
-
hydrates: ${!farmIslandsMode ||
|
|
8737
|
+
hydrates: ${!farmIslandsMode || _chunkRTAWQXMEcjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
|
|
8565
8738
|
module: ${varName},
|
|
8566
8739
|
}`);
|
|
8567
8740
|
});
|
|
@@ -8572,12 +8745,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8572
8745
|
errorImports.push(
|
|
8573
8746
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
8574
8747
|
);
|
|
8575
|
-
const groupScope =
|
|
8748
|
+
const groupScope = _chunkYSRZSKQBcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
8576
8749
|
errorRegistrations.push(`
|
|
8577
8750
|
{
|
|
8578
|
-
pattern: ${JSON.stringify(
|
|
8751
|
+
pattern: ${JSON.stringify(_chunkYSRZSKQBcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
8579
8752
|
groupScope: ${JSON.stringify(groupScope)},
|
|
8580
|
-
directoryDepth: ${
|
|
8753
|
+
directoryDepth: ${_chunkYSRZSKQBcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
8581
8754
|
module: ${varName},
|
|
8582
8755
|
}`);
|
|
8583
8756
|
});
|
|
@@ -8589,12 +8762,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8589
8762
|
loadingImports.push(
|
|
8590
8763
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(loadingRoute.modulePath)};`
|
|
8591
8764
|
);
|
|
8592
|
-
const groupScope =
|
|
8765
|
+
const groupScope = _chunkYSRZSKQBcjs.getRouteGroupScope.call(void 0, loadingRoute.pattern);
|
|
8593
8766
|
loadingRegistrations.push(`
|
|
8594
8767
|
{
|
|
8595
|
-
pattern: ${JSON.stringify(
|
|
8768
|
+
pattern: ${JSON.stringify(_chunkYSRZSKQBcjs.stripRouteGroups.call(void 0, loadingRoute.pattern))},${groupScope ? `
|
|
8596
8769
|
groupScope: ${JSON.stringify(groupScope)},
|
|
8597
|
-
directoryDepth: ${
|
|
8770
|
+
directoryDepth: ${_chunkYSRZSKQBcjs.getRouteDirectoryDepth.call(void 0, loadingRoute.pattern)},` : ""}
|
|
8598
8771
|
module: ${varName},
|
|
8599
8772
|
}`);
|
|
8600
8773
|
});
|
|
@@ -8607,7 +8780,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8607
8780
|
metadataImageImports.push(
|
|
8608
8781
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(image.modulePath)};`
|
|
8609
8782
|
);
|
|
8610
|
-
const component = !_chunkT7UC2ORAcjs.isReactRenderer.call(void 0, config.renderer) &&
|
|
8783
|
+
const component = !_chunkT7UC2ORAcjs.isReactRenderer.call(void 0, config.renderer) && _chunkM4YXD6MDcjs.isRendererCompiledComponent.call(void 0, image.modulePath, _nullishCoalesce(_optionalChain([config, 'access', _205 => _205.renderer, 'optionalAccess', _206 => _206.componentExtensions]), () => ( [])));
|
|
8611
8784
|
metadataImageRegistrations.push(`
|
|
8612
8785
|
{
|
|
8613
8786
|
pattern: ${JSON.stringify(image.pattern)},
|
|
@@ -8683,7 +8856,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8683
8856
|
createDefaultErrorMarkup,
|
|
8684
8857
|
createFarmInstrumentationLifecycle,
|
|
8685
8858
|
createFarmLayoutSelector,
|
|
8686
|
-
createFarmLayoutBoundary,${_optionalChain([config, 'access',
|
|
8859
|
+
createFarmLayoutBoundary,${_optionalChain([config, 'access', _207 => _207.docs, 'optionalAccess', _208 => _208.enabled]) ? "\n createFarmDocsLayoutTree,\n farmDocsLayoutsWrapPage,\n placeFarmDocsLayoutRoot," : ""}
|
|
8687
8860
|
isInFarmRouteGroupScope,
|
|
8688
8861
|
routeBoundaryCoversDirectory,
|
|
8689
8862
|
createFarmCacheKey,
|
|
@@ -8767,7 +8940,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8767
8940
|
createFarmDeploymentMismatchResponse,
|
|
8768
8941
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
8769
8942
|
getFarmDeploymentMismatch,
|
|
8770
|
-
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access',
|
|
8943
|
+
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access', _209 => _209.md, 'optionalAccess', _210 => _210.enabled]) || hasMarkdownPages) ? "\n toFarmTrailingSlashPageRequest," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}${searchPreserveRoutesSource ? "\n _setFarmSearchPreserveRoutes," : ""}
|
|
8771
8944
|
} from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
|
|
8772
8945
|
import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
|
|
8773
8946
|
// The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
|
|
@@ -8839,25 +9012,25 @@ function farmFormStateScript() { return ""; }`}`;
|
|
|
8839
9012
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
8840
9013
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
8841
9014
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
8842
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
9015
|
+
const docsHandlerImport = _optionalChain([config, 'access', _211 => _211.docs, 'optionalAccess', _212 => _212.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
8843
9016
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
8844
9017
|
const pathname = typeof requestOrPathname === "string"
|
|
8845
9018
|
? requestOrPathname
|
|
8846
9019
|
: new URL(requestOrPathname.url).pathname;
|
|
8847
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
9020
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _213 => _213.apiPath]) || "/api/docs")};
|
|
8848
9021
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
8849
9022
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
8850
|
-
import { ${_optionalChain([config, 'access',
|
|
9023
|
+
import { ${_optionalChain([config, 'access', _214 => _214.docs, 'access', _215 => _215.roots, 'optionalAccess', _216 => _216.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
8851
9024
|
import * as FarmDocsAdapterUI from ${JSON.stringify(_chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter))};${docsConfigModulePath ? `
|
|
8852
9025
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
8853
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
8854
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
9026
|
+
const docsFontImport = _optionalChain([config, 'access', _217 => _217.docs, 'optionalAccess', _218 => _218.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
9027
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _219 => _219.docs, 'optionalAccess', _220 => _220.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
8855
9028
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
8856
9029
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
8857
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
9030
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _221 => _221.md, 'optionalAccess', _222 => _222.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
8858
9031
|
const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
|
|
8859
9032
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
8860
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
9033
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _223 => _223.mdx, 'optionalAccess', _224 => _224.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
8861
9034
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
8862
9035
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
8863
9036
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -8877,14 +9050,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
8877
9050
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
8878
9051
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
8879
9052
|
const mobileSession = (config.plugins || []).some(
|
|
8880
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
9053
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _225 => _225.name]) === _chunkMHKPXX3Jcjs.FARM_MOBILE_SESSION_PLUGIN
|
|
8881
9054
|
);
|
|
8882
9055
|
const nativeServerFns = (config.plugins || []).some(
|
|
8883
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
8884
|
-
) ?
|
|
9056
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _226 => _226.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
|
|
9057
|
+
) ? _chunkCBB7I6HWcjs.collectFarmNativeServerFns.call(void 0, {
|
|
8885
9058
|
root: config.root,
|
|
8886
9059
|
srcDir: config.srcDir,
|
|
8887
|
-
entries:
|
|
9060
|
+
entries: _chunkCBB7I6HWcjs.findFarmNativeScreenFiles.call(void 0, _chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config))
|
|
8888
9061
|
}) : void 0;
|
|
8889
9062
|
const integrationImports = `
|
|
8890
9063
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
@@ -8899,7 +9072,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
|
|
|
8899
9072
|
${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
|
|
8900
9073
|
});` : ""}
|
|
8901
9074
|
`;
|
|
8902
|
-
const imageRuntime =
|
|
9075
|
+
const imageRuntime = _chunkM4YXD6MDcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
8903
9076
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
8904
9077
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
8905
9078
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -9081,7 +9254,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
9081
9254
|
|
|
9082
9255
|
function renderFarmDefault404Page() {
|
|
9083
9256
|
return React.createElement(React.Fragment, null,
|
|
9084
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
9257
|
+
React.createElement("style", null, ${JSON.stringify(_chunkM4YXD6MDcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
9085
9258
|
React.createElement("main", {
|
|
9086
9259
|
className: "farm-default-not-found",
|
|
9087
9260
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -9115,7 +9288,24 @@ const FarmDefault404Page = typeof React.markFunctionComponent === "function"
|
|
|
9115
9288
|
function createFarmNotFoundElement(pathname) {
|
|
9116
9289
|
const NotFoundPage = hasCustomNotFound && CustomNotFoundComponent ? CustomNotFoundComponent : FarmDefault404Page;
|
|
9117
9290
|
return React.createElement(NotFoundPage, { pathname: pathname });
|
|
9291
|
+
}${farmStaticNotFoundBuild ? `
|
|
9292
|
+
|
|
9293
|
+
// The build's own request for the not-found page it writes for Vercel. Nitro's prerender worker
|
|
9294
|
+
// sets the variable, so no visitor's request is mistaken for it.
|
|
9295
|
+
function isFarmStaticNotFoundPrerender(pathname) {
|
|
9296
|
+
return (
|
|
9297
|
+
typeof process !== "undefined" &&
|
|
9298
|
+
process.env?.${_chunkUGWKNZ4Ucjs.FARM_PRERENDER_ENV} === "1" &&
|
|
9299
|
+
pathname === ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_STATIC_NOT_FOUND_PATH, config.basePath))}
|
|
9300
|
+
);
|
|
9118
9301
|
}
|
|
9302
|
+
|
|
9303
|
+
function createFarmStaticNotFoundRefusal(reason) {
|
|
9304
|
+
return new Response(reason, {
|
|
9305
|
+
status: 404,
|
|
9306
|
+
headers: { "Content-Type": ${JSON.stringify(FARM_STATIC_NOT_FOUND_REFUSAL_TYPE)} },
|
|
9307
|
+
});
|
|
9308
|
+
}` : ""}
|
|
9119
9309
|
${nativeMCP.registerSource}
|
|
9120
9310
|
// Config middleware from layers is appended in layer order ahead of the
|
|
9121
9311
|
// project's, the same merge development applies (mergeFarmLayerConfig).
|
|
@@ -9237,24 +9427,24 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
9237
9427
|
validateRemoteUrl: createNodeImageUrlValidator(${JSON.stringify(config.images)}),
|
|
9238
9428
|
onError(error) { console.error("[Farm Image]", error); },
|
|
9239
9429
|
})`};
|
|
9240
|
-
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access',
|
|
9430
|
+
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access', _227 => _227.md, 'optionalAccess', _228 => _228.enabled]) || hasMarkdownPages ? config.trailingSlash ? `
|
|
9241
9431
|
// A Markdown mirror, and a page.md source's page check, read the page at the URL it answers at
|
|
9242
9432
|
// ('/about/'), so the trailing-slash 308 never answers in its place.
|
|
9243
9433
|
const toFarmMarkdownPageRequest = (request) => toFarmTrailingSlashPageRequest(request, true);` : `
|
|
9244
9434
|
const toFarmMarkdownPageRequest = (request) => request;` : ""}
|
|
9245
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
9246
|
-
${_optionalChain([config, 'access',
|
|
9435
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _229 => _229.agent, 'optionalAccess', _230 => _230.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
9436
|
+
${_optionalChain([config, 'access', _231 => _231.agent, 'optionalAccess', _232 => _232.llmsTxt, 'optionalAccess', _233 => _233.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
9247
9437
|
const farmMdxConfig = ${JSON.stringify({
|
|
9248
9438
|
...config.mdx,
|
|
9249
|
-
components: typeof _optionalChain([config, 'access',
|
|
9439
|
+
components: typeof _optionalChain([config, 'access', _234 => _234.mdx, 'optionalAccess', _235 => _235.components]) === "string" ? config.mdx.components : void 0
|
|
9250
9440
|
})};
|
|
9251
9441
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
9252
|
-
${_optionalChain([config, 'access',
|
|
9442
|
+
${_optionalChain([config, 'access', _236 => _236.agent, 'optionalAccess', _237 => _237.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
9253
9443
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
9254
9444
|
// to the build.
|
|
9255
9445
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
9256
9446
|
globalThis.process?.env,
|
|
9257
|
-
${JSON.stringify(
|
|
9447
|
+
${JSON.stringify(_chunkEA5HVG45cjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
|
|
9258
9448
|
);` : ""}
|
|
9259
9449
|
const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
|
|
9260
9450
|
const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
|
|
@@ -9300,7 +9490,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
9300
9490
|
});
|
|
9301
9491
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
9302
9492
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
9303
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
9493
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _238 => _238.docs, 'optionalAccess', _239 => _239.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
9304
9494
|
try {
|
|
9305
9495
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
9306
9496
|
const candidates = [
|
|
@@ -9312,7 +9502,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _224 => _2
|
|
|
9312
9502
|
} catch {
|
|
9313
9503
|
return null;
|
|
9314
9504
|
}
|
|
9315
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
9505
|
+
})()` : "null"};${_optionalChain([config, 'access', _240 => _240.docs, 'optionalAccess', _241 => _241.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _242 => _242.docs, 'access', _243 => _243.roots, 'optionalAccess', _244 => _244.length]) ? `
|
|
9316
9506
|
const farmDocsBundledRootsDir = (() => {
|
|
9317
9507
|
try {
|
|
9318
9508
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -9326,7 +9516,11 @@ const farmDocsBundledRootsDir = (() => {
|
|
|
9326
9516
|
return null;
|
|
9327
9517
|
}
|
|
9328
9518
|
})();` : ""}
|
|
9329
|
-
const farmDocsResolvedConfig = ${generateFarmDocsRuntimeConfigExpression(
|
|
9519
|
+
const farmDocsResolvedConfig = ${generateFarmDocsRuntimeConfigExpression(
|
|
9520
|
+
config.docs,
|
|
9521
|
+
hasPrecompiledDocs,
|
|
9522
|
+
_optionalChain([config, 'access', _245 => _245.docs, 'optionalAccess', _246 => _246.enabled]) && _optionalChain([config, 'access', _247 => _247.docs, 'access', _248 => _248.roots, 'optionalAccess', _249 => _249.length]) ? getFarmDocsBundledRootPaths(config.docs, config.root, config.srcDir) : []
|
|
9523
|
+
)};
|
|
9330
9524
|
const farmDocsRuntimeRoot = ${hasPrecompiledDocs ? '"."' : `farmDocsBundledContentDir || ${JSON.stringify(config.root)}`};
|
|
9331
9525
|
// Docs pages a path-specific guard covers, decided at build time. The docs API and the
|
|
9332
9526
|
// root llms/sitemap files answer anyone, so they leave these pages out.
|
|
@@ -9366,8 +9560,8 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
9366
9560
|
: undefined;
|
|
9367
9561
|
${adapterOwnsDocsRuntime && !hasPrecompiledDocs ? `// The renderer contract's server exports, for a docs UI that builds its pages with them.
|
|
9368
9562
|
const farmDocsAppRenderer = ${_chunkT7UC2ORAcjs.isReactRenderer.call(void 0, config.renderer) ? '{ name: "react", createElement: React.createElement, Fragment: React.Fragment, renderToString: ReactDOMServer.renderToString }' : "__farmRendererServer"};
|
|
9369
|
-
` : ""}const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
9370
|
-
rootDir: farmDocsRuntimeRoot
|
|
9563
|
+
` : ""}const farmDocsHandler = ${_optionalChain([config, 'access', _250 => _250.docs, 'optionalAccess', _251 => _251.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {${_optionalChain([config, 'access', _252 => _252.docs, 'access', _253 => _253.roots, 'optionalAccess', _254 => _254.length]) ? "" : `
|
|
9564
|
+
rootDir: farmDocsRuntimeRoot,`}
|
|
9371
9565
|
// A production build's content cannot change, so the adapter reads its
|
|
9372
9566
|
// navigation once instead of scanning the content directory per request.
|
|
9373
9567
|
immutableContent: true,
|
|
@@ -9390,7 +9584,7 @@ const farmDocsAppRenderer = ${_chunkT7UC2ORAcjs.isReactRenderer.call(void 0, con
|
|
|
9390
9584
|
registerMCPServer: registerFarmMCPServer,
|
|
9391
9585
|
// A page built with this keeps its HTML string, so the preload budget and the response
|
|
9392
9586
|
// writer use it instead of reading and re-encoding the body. Older adapters ignore it.
|
|
9393
|
-
createHtmlResponse: farmOwnedHtmlResponse,${
|
|
9587
|
+
createHtmlResponse: farmOwnedHtmlResponse,${_chunkRBSGFS5Xcjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
|
|
9394
9588
|
// The adapter keeps pages a path guard covers off search, llms.txt, the sitemap and MCP. It
|
|
9395
9589
|
// asks about any path its own content lists, so the guards decide here, not a page list.
|
|
9396
9590
|
isPathGuarded: (pathname) =>
|
|
@@ -9416,7 +9610,23 @@ const farmDocsAppRenderer = ${_chunkT7UC2ORAcjs.isReactRenderer.call(void 0, con
|
|
|
9416
9610
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
9417
9611
|
basePath: ${JSON.stringify(config.basePath)},
|
|
9418
9612
|
})` : "null"};
|
|
9419
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
9613
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _255 => _255.docs, 'optionalAccess', _256 => _256.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
|
|
9614
|
+
|
|
9615
|
+
// A long-running server calls this before it listens, so a Polyroute route's first request
|
|
9616
|
+
// doesn't wait for its WebAssembly to compile and its instance to start. Polyroute releases
|
|
9617
|
+
// without \`prepare()\` skip it. Polyroute doesn't keep a failed start, so a route that
|
|
9618
|
+
// fails here tries again on its first request, as it did before this step existed.
|
|
9619
|
+
export async function farmPrepareNativeRoutes() {${nativeAPIRoutes.length > 0 ? `
|
|
9620
|
+
await Promise.all(
|
|
9621
|
+
[${nativeAPIRoutes.join(", ")}].map(async ([routePath, routeModule]) => {
|
|
9622
|
+
try {
|
|
9623
|
+
await routeModule.default?.prepare?.();
|
|
9624
|
+
} catch (error) {
|
|
9625
|
+
console.error(\`[Farm] Couldn't prepare route \${routePath} before listening; its first request will try again:\`, error);
|
|
9626
|
+
}
|
|
9627
|
+
}),
|
|
9628
|
+
);
|
|
9629
|
+
` : ""}}
|
|
9420
9630
|
|
|
9421
9631
|
// API routes bundled at build time
|
|
9422
9632
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
@@ -9451,12 +9661,12 @@ const farmDeploymentCookiePath = ${JSON.stringify(config.basePath || "/")};
|
|
|
9451
9661
|
// runtime request.
|
|
9452
9662
|
const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
|
|
9453
9663
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
9454
|
-
${_optionalChain([config, 'access',
|
|
9455
|
-
` : ""}${_optionalChain([config, 'access',
|
|
9456
|
-
|
|
9664
|
+
${_optionalChain([config, 'access', _257 => _257.agent, 'optionalAccess', _258 => _258.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkSCE7VWPNcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
9665
|
+
` : ""}${_optionalChain([config, 'access', _259 => _259.agent, 'optionalAccess', _260 => _260.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
9666
|
+
_chunkSCE7VWPNcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
9457
9667
|
build: config.deploymentId,
|
|
9458
|
-
packages:
|
|
9459
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
9668
|
+
packages: _chunkM4YXD6MDcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
9669
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkM4YXD6MDcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
9460
9670
|
})
|
|
9461
9671
|
)};
|
|
9462
9672
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -9469,7 +9679,7 @@ farmAppManifestInput.guardCoversPath = (path) =>
|
|
|
9469
9679
|
path,
|
|
9470
9680
|
farmLocalAPIBasePath,
|
|
9471
9681
|
);
|
|
9472
|
-
${_optionalChain([config, 'access',
|
|
9682
|
+
${_optionalChain([config, 'access', _261 => _261.docs, 'optionalAccess', _262 => _262.enabled]) ? `// A docs runtime's MCP server lists its tools when asked over MCP, in process. A build
|
|
9473
9683
|
// can't change them, so they are read once.
|
|
9474
9684
|
if (farmDocsHandler) {
|
|
9475
9685
|
farmAppManifestInput.registeredMCP = (request) =>
|
|
@@ -10244,7 +10454,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
10244
10454
|
let inner = markup.replace(/^\\s+/, "");
|
|
10245
10455
|
let hoisted = "";
|
|
10246
10456
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
|
|
10247
|
-
const hoistable = /${
|
|
10457
|
+
const hoistable = /${_chunkYSRZSKQBcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
10248
10458
|
let match;
|
|
10249
10459
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
10250
10460
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -10273,7 +10483,7 @@ function opensFarmFullDocument(markup) {
|
|
|
10273
10483
|
// them: its own head takes them. Matches the dev renderer's takeFarmHoistedHead.
|
|
10274
10484
|
function takeFarmHoistedHead(markup) {
|
|
10275
10485
|
if (opensFarmFullDocument(markup)) return { head: "", body: markup };
|
|
10276
|
-
const hoistable = /${
|
|
10486
|
+
const hoistable = /${_chunkYSRZSKQBcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
10277
10487
|
let head = "";
|
|
10278
10488
|
let body = markup;
|
|
10279
10489
|
let match;
|
|
@@ -10471,10 +10681,14 @@ const FARM_ACTION_REFERENCE_PATTERN = /"\\$":"a"|name="\\$F_REF_/;
|
|
|
10471
10681
|
// A server tree in a document's markup: the payload a page or layout root rebuilds from.
|
|
10472
10682
|
const FARM_SERVER_TREE_PATTERN = /<script type="f\\/tree"/;
|
|
10473
10683
|
|
|
10684
|
+
// What the entry runs before its own code (Rolldown's runtime, and the chunk holding the entry's
|
|
10685
|
+
// code when the entry chunk is a stub) loads at the entry script's priority. The other preloads
|
|
10686
|
+
// are low, so they don't hold back the first paint's CSS and fonts.
|
|
10474
10687
|
function renderFarmClientModulePreload(index) {
|
|
10688
|
+
const entryCode = farmClientModulePreloads.entryCode;
|
|
10475
10689
|
return '\\n <link rel="modulepreload" href="/' +
|
|
10476
10690
|
escapeFarmHtmlAttribute(farmClientModulePreloads.files[index]) +
|
|
10477
|
-
'" fetchpriority="low">';
|
|
10691
|
+
(entryCode && entryCode.includes(index) ? '">' : '" fetchpriority="low">');
|
|
10478
10692
|
}
|
|
10479
10693
|
|
|
10480
10694
|
// The manifest indexes of the modules a document's hydrating page and its markup
|
|
@@ -10909,7 +11123,7 @@ function createFarmAgentRobotsResponse(request) {
|
|
|
10909
11123
|
// its nearest layout's.
|
|
10910
11124
|
const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
10911
11125
|
pageRoutes.map((route) => route.pattern).filter(
|
|
10912
|
-
(pattern) => !pattern.includes("[") &&
|
|
11126
|
+
(pattern) => !pattern.includes("[") && _chunkYSRZSKQBcjs.farmPathGuardCoversPage.call(void 0,
|
|
10913
11127
|
{
|
|
10914
11128
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
10915
11129
|
middlewareRoutes
|
|
@@ -10964,12 +11178,12 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
10964
11178
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
10965
11179
|
// registered at runtime, such as the docs engine's.
|
|
10966
11180
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
10967
|
-
|
|
11181
|
+
_chunkJH4CDG4Gcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkNOSLIDSGcjs.FARM_VERSION)
|
|
10968
11182
|
)};
|
|
10969
11183
|
let farmDefaultMCPRouteFree;
|
|
10970
11184
|
function getFarmDefaultMCPServer() {
|
|
10971
11185
|
if (farmDefaultMCPRouteFree === undefined) {
|
|
10972
|
-
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(
|
|
11186
|
+
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunkJH4CDG4Gcjs.FARM_DEFAULT_MCP_PATH)});
|
|
10973
11187
|
}
|
|
10974
11188
|
return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
|
|
10975
11189
|
}
|
|
@@ -11158,7 +11372,7 @@ ${edgeMiddlewareFilePaths.length > 0 ? `
|
|
|
11158
11372
|
// middleware guards is never prerendered. Read once: Nitro's prerender worker sets the variable.
|
|
11159
11373
|
const farmEdgeMiddlewareFiles = new Set(${JSON.stringify(edgeMiddlewareFilePaths)});
|
|
11160
11374
|
const farmPrerendering =
|
|
11161
|
-
typeof process !== "undefined" && process.env?.${
|
|
11375
|
+
typeof process !== "undefined" && process.env?.${_chunkUGWKNZ4Ucjs.FARM_PRERENDER_ENV} === "1";
|
|
11162
11376
|
` : ""}
|
|
11163
11377
|
const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewareRunner({
|
|
11164
11378
|
config: farmMiddlewareConfig,
|
|
@@ -11302,7 +11516,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
11302
11516
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
11303
11517
|
return true;
|
|
11304
11518
|
}
|
|
11305
|
-
${_optionalChain([config, 'access',
|
|
11519
|
+
${_optionalChain([config, 'access', _263 => _263.docs, 'optionalAccess', _264 => _264.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
11306
11520
|
// The docs answer below the basePath; their API stays at /api/docs, as API routes do.
|
|
11307
11521
|
const docsRoutePathname = stripFarmBasePath(pathname);
|
|
11308
11522
|
if (
|
|
@@ -11330,7 +11544,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
11330
11544
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
11331
11545
|
};
|
|
11332
11546
|
}
|
|
11333
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
11547
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _265 => _265.docs, 'optionalAccess', _266 => _266.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
11334
11548
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
11335
11549
|
pathname,
|
|
11336
11550
|
method: request.method,
|
|
@@ -11414,7 +11628,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
11414
11628
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
11415
11629
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
11416
11630
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
11417
|
-
|
|
11631
|
+
_chunkSCE7VWPNcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
11418
11632
|
agent: {
|
|
11419
11633
|
...config.agent,
|
|
11420
11634
|
aiCatalog: servesAiCatalog,
|
|
@@ -11425,9 +11639,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
11425
11639
|
openapi: openAPIReference
|
|
11426
11640
|
})
|
|
11427
11641
|
)});
|
|
11428
|
-
${_optionalChain([config, 'access',
|
|
11642
|
+
${_optionalChain([config, 'access', _267 => _267.docs, 'optionalAccess', _268 => _268.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
11429
11643
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
11430
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
11644
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _269 => _269.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _270 => _270.docs, 'access', _271 => _271.roots, 'optionalAccess', _272 => _272.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
|
|
11431
11645
|
pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
|
|
11432
11646
|
};
|
|
11433
11647
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
@@ -11443,11 +11657,11 @@ function labelFarmRequestOptions(options) {
|
|
|
11443
11657
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
11444
11658
|
return options;
|
|
11445
11659
|
}
|
|
11446
|
-
${_optionalChain([config, 'access',
|
|
11660
|
+
${_optionalChain([config, 'access', _273 => _273.docs, 'optionalAccess', _274 => _274.enabled]) ? `if (options.kind === "docs") {
|
|
11447
11661
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
11448
11662
|
return options;
|
|
11449
11663
|
}` : ""}
|
|
11450
|
-
${_optionalChain([config, 'access',
|
|
11664
|
+
${_optionalChain([config, 'access', _275 => _275.md, 'optionalAccess', _276 => _276.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
11451
11665
|
routePathname,
|
|
11452
11666
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
11453
11667
|
);
|
|
@@ -11482,7 +11696,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
11482
11696
|
return applicable;
|
|
11483
11697
|
}
|
|
11484
11698
|
|
|
11485
|
-
${_optionalChain([config, 'access',
|
|
11699
|
+
${_optionalChain([config, 'access', _277 => _277.docs, 'optionalAccess', _278 => _278.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
11486
11700
|
if (request.method === "HEAD") return response;
|
|
11487
11701
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
11488
11702
|
|
|
@@ -11588,7 +11802,7 @@ ${_optionalChain([config, 'access', _255 => _255.docs, 'optionalAccess', _256 =>
|
|
|
11588
11802
|
|
|
11589
11803
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
11590
11804
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
11591
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
11805
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _279 => _279.experimental, 'optionalAccess', _280 => _280.ppr]) === true)};
|
|
11592
11806
|
|
|
11593
11807
|
function resolveRouteRenderingView(route) {
|
|
11594
11808
|
// The same merge development uses: baked directive config under the
|
|
@@ -11708,7 +11922,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
11708
11922
|
},
|
|
11709
11923
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
11710
11924
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
11711
|
-
${_optionalChain([config, 'access',
|
|
11925
|
+
${_optionalChain([config, 'access', _281 => _281.md, 'optionalAccess', _282 => _282.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
11712
11926
|
if (matchPageRoute(pathname)) {
|
|
11713
11927
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
11714
11928
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -11925,7 +12139,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11925
12139
|
return renderFarmErrorJSONResponse();` : `
|
|
11926
12140
|
if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
|
|
11927
12141
|
// No page was selected, so only the root error boundary and layouts apply.
|
|
11928
|
-
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access',
|
|
12142
|
+
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _283 => _283.md, 'optionalAccess', _284 => _284.enabled]) ? `
|
|
11929
12143
|
// An agent asking for Markdown reads the error document as Markdown, as it
|
|
11930
12144
|
// does when a page throws. The helper answers null when Markdown is off.
|
|
11931
12145
|
const markdownErrorResponse = await createMarkdownMirrorResponse({
|
|
@@ -11967,7 +12181,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11967
12181
|
}
|
|
11968
12182
|
` : ""}
|
|
11969
12183
|
|
|
11970
|
-
${_optionalChain([config, 'access',
|
|
12184
|
+
${_optionalChain([config, 'access', _285 => _285.docs, 'optionalAccess', _286 => _286.enabled]) ? `
|
|
11971
12185
|
// Docs responses are served after app middleware so route guards and
|
|
11972
12186
|
// middleware headers apply to the docs engine like any other page content.
|
|
11973
12187
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -12027,6 +12241,10 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12027
12241
|
// In place for a page the adapter built with createHtmlResponse, so its HTML string stays.
|
|
12028
12242
|
const bufferedDocsResponse = farmPreloadHeadersResponse(wrappedDocsResponse, (headers) => {
|
|
12029
12243
|
headers.set("x-farm-preload-buffered", "1");
|
|
12244
|
+
// The docs engine answers this URL with Markdown for an Accept that asks for it, so a
|
|
12245
|
+
// shared cache keys the page on Accept. An adapter's page does not always say so, and
|
|
12246
|
+
// only a page that is also an app route gets it from Markdown negotiation.
|
|
12247
|
+
appendFarmVary(headers, "Accept");
|
|
12030
12248
|
});
|
|
12031
12249
|
return applyProductionMiddlewareHeaders(bufferedDocsResponse, middlewareHeaders);
|
|
12032
12250
|
}
|
|
@@ -12083,7 +12301,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12083
12301
|
}
|
|
12084
12302
|
` : ""}
|
|
12085
12303
|
|
|
12086
|
-
${_optionalChain([config, 'access',
|
|
12304
|
+
${_optionalChain([config, 'access', _287 => _287.md, 'optionalAccess', _288 => _288.enabled]) ? `
|
|
12087
12305
|
if (farmMarkdownConfig?.enabled) {
|
|
12088
12306
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
12089
12307
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -12187,11 +12405,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12187
12405
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
12188
12406
|
}
|
|
12189
12407
|
` : ""}
|
|
12190
|
-
${_optionalChain([config, 'access',
|
|
12408
|
+
${_optionalChain([config, 'access', _289 => _289.agent, 'optionalAccess', _290 => _290.manifest]) !== false ? `
|
|
12191
12409
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
12192
12410
|
// public manifest, the same document for every request.
|
|
12193
12411
|
if (
|
|
12194
|
-
[${JSON.stringify(
|
|
12412
|
+
[${JSON.stringify(_chunkSCE7VWPNcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkSCE7VWPNcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
12195
12413
|
normalizeRuntimePath(routePathname),
|
|
12196
12414
|
)
|
|
12197
12415
|
) {
|
|
@@ -12201,9 +12419,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12201
12419
|
);
|
|
12202
12420
|
}
|
|
12203
12421
|
` : ""}
|
|
12204
|
-
${_optionalChain([config, 'access',
|
|
12422
|
+
${_optionalChain([config, 'access', _291 => _291.agent, 'optionalAccess', _292 => _292.apiCatalog]) ? `
|
|
12205
12423
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
12206
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
12424
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkSCE7VWPNcjs.FARM_API_CATALOG_PATH)}) {
|
|
12207
12425
|
return applyProductionMiddlewareHeaders(
|
|
12208
12426
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
12209
12427
|
middlewareHeaders,
|
|
@@ -12228,11 +12446,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12228
12446
|
);
|
|
12229
12447
|
}
|
|
12230
12448
|
` : ""}
|
|
12231
|
-
${_optionalChain([config, 'access',
|
|
12449
|
+
${_optionalChain([config, 'access', _293 => _293.agent, 'optionalAccess', _294 => _294.llmsTxt, 'optionalAccess', _295 => _295.enabled]) ? `
|
|
12232
12450
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
12233
12451
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
12234
12452
|
? "llms"
|
|
12235
|
-
: ${_optionalChain([config, 'access',
|
|
12453
|
+
: ${_optionalChain([config, 'access', _296 => _296.agent, 'optionalAccess', _297 => _297.llmsTxt, 'optionalAccess', _298 => _298.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
12236
12454
|
if (farmGeneratedLlmsKind) {
|
|
12237
12455
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
12238
12456
|
// Renders are shared per origin the request reached, which is where pages are read.
|
|
@@ -12268,7 +12486,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12268
12486
|
}
|
|
12269
12487
|
` : ""}
|
|
12270
12488
|
|
|
12271
|
-
${_optionalChain([config, 'access',
|
|
12489
|
+
${_optionalChain([config, 'access', _299 => _299.docs, 'optionalAccess', _300 => _300.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
12272
12490
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
12273
12491
|
if (docsAPIResponse) {
|
|
12274
12492
|
return applyProductionMiddlewareHeaders(
|
|
@@ -12908,7 +13126,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12908
13126
|
);
|
|
12909
13127
|
}
|
|
12910
13128
|
}
|
|
12911
|
-
${_optionalChain([config, 'access',
|
|
13129
|
+
${_optionalChain([config, 'access', _301 => _301.md, 'optionalAccess', _302 => _302.enabled]) ? `
|
|
12912
13130
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
12913
13131
|
// using the public path the .md request will be resolved against.
|
|
12914
13132
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -12937,7 +13155,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12937
13155
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "cookie" });
|
|
12938
13156
|
}
|
|
12939
13157
|
|
|
12940
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
13158
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _303 => _303.agent, 'optionalAccess', _304 => _304.jsonLd]), () => ( false)))} });
|
|
12941
13159
|
const title = renderedMetadata.title;
|
|
12942
13160
|
const metaTags = renderedMetadata.tags;
|
|
12943
13161
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -13405,7 +13623,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
13405
13623
|
${servesDefaultMCP ? `
|
|
13406
13624
|
// agent.mcp: no app route answered /mcp, so the default read-only server may.
|
|
13407
13625
|
if (
|
|
13408
|
-
normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
13626
|
+
normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkJH4CDG4Gcjs.FARM_DEFAULT_MCP_PATH)} &&
|
|
13409
13627
|
getFarmDefaultMCPServer()
|
|
13410
13628
|
) {
|
|
13411
13629
|
return applyProductionMiddlewareHeaders(
|
|
@@ -13589,7 +13807,8 @@ ${farmRendererDisabled ? `
|
|
|
13589
13807
|
), middlewareHeaders);
|
|
13590
13808
|
}
|
|
13591
13809
|
|
|
13592
|
-
try {
|
|
13810
|
+
try {${farmStaticNotFoundBuild ? `
|
|
13811
|
+
const farmNotFoundRequestReads = _getRequestReadCount() + _getRequestCookieReadCount();` : ""}
|
|
13593
13812
|
// Wrap 404 page with root layout if available
|
|
13594
13813
|
let notFoundElement = createFarmNotFoundElement(pathname);
|
|
13595
13814
|
// No page matched, so a layout inside a route group cannot apply.
|
|
@@ -13613,8 +13832,16 @@ ${farmRendererDisabled ? `
|
|
|
13613
13832
|
hasCustomNotFound ? CustomNotFoundModule : null,
|
|
13614
13833
|
),
|
|
13615
13834
|
{ pathname },
|
|
13616
|
-
)
|
|
13617
|
-
|
|
13835
|
+
);${farmStaticNotFoundBuild ? `
|
|
13836
|
+
// experimental.staticNotFound: Vercel serves this render to every missing URL. A render that
|
|
13837
|
+
// read cookies or headers, here or through an auth helper, belongs to one visitor.
|
|
13838
|
+
if (
|
|
13839
|
+
isFarmStaticNotFoundPrerender(pathname) &&
|
|
13840
|
+
_getRequestReadCount() + _getRequestCookieReadCount() !== farmNotFoundRequestReads
|
|
13841
|
+
) {
|
|
13842
|
+
return createFarmStaticNotFoundRefusal("the not-found page reads cookies or headers");
|
|
13843
|
+
}` : ""}
|
|
13844
|
+
|
|
13618
13845
|
// Check if layout provides full HTML document
|
|
13619
13846
|
const fullDocument = extractFarmFullDocument(html);
|
|
13620
13847
|
const hasFullDocument = fullDocument !== null;
|
|
@@ -13683,7 +13910,11 @@ ${farmRendererDisabled ? `
|
|
|
13683
13910
|
}
|
|
13684
13911
|
}), middlewareHeaders), fullHtml);
|
|
13685
13912
|
} catch (error) {
|
|
13686
|
-
console.error("404 render error:", error)
|
|
13913
|
+
console.error("404 render error:", error);${farmStaticNotFoundBuild ? `
|
|
13914
|
+
// The fallback names this request's path, which a file served at every URL can't.
|
|
13915
|
+
if (isFarmStaticNotFoundPrerender(pathname)) {
|
|
13916
|
+
return createFarmStaticNotFoundRefusal("the not-found page failed to render");
|
|
13917
|
+
}` : ""}
|
|
13687
13918
|
const fallbackDocument = applyFarmThemeDocument(
|
|
13688
13919
|
\`<!DOCTYPE html><html><head><title>404</title></head><body><h1>404 - Page Not Found</h1><p>The page \${pathname} doesn't exist.</p><a href="\${escapeFarmHtmlAttribute(applyFarmBasePath("/", farmResolvedRuntimeConfig.basePath))}">Go Home</a></body></html>\`,
|
|
13689
13920
|
farmThemeConfig,
|
|
@@ -13782,11 +14013,11 @@ function createFarmRuntimeHookErrorResponse(request, error) {
|
|
|
13782
14013
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
13783
14014
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
13784
14015
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
13785
|
-
${_optionalChain([config, 'access',
|
|
14016
|
+
${_optionalChain([config, 'access', _305 => _305.agent, 'optionalAccess', _306 => _306.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
13786
14017
|
basePath: farmLocalAPIBasePath,
|
|
13787
14018
|
dispatch: async (localRequest) =>
|
|
13788
14019
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
13789
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
14020
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _307 => _307.agent, 'optionalAccess', _308 => _308.noindexPreviews]) ? `
|
|
13790
14021
|
// Keep every response of a preview deployment out of search indexes.
|
|
13791
14022
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
13792
14023
|
}
|
|
@@ -13996,7 +14227,7 @@ function getManifestPageEntry(manifest, pathname) {
|
|
|
13996
14227
|
})).sort((left, right) => _chunkML4TOUZPcjs.compareRouteSpecificity.call(void 0, left.specificity, right.specificity)).map(({ entry, matches }) => ({ entry, matches }));
|
|
13997
14228
|
manifestPageMatchers.set(manifest.routes, pages);
|
|
13998
14229
|
}
|
|
13999
|
-
return _optionalChain([pages, 'access',
|
|
14230
|
+
return _optionalChain([pages, 'access', _309 => _309.find, 'call', _310 => _310((page) => page.matches(pathname)), 'optionalAccess', _311 => _311.entry]);
|
|
14000
14231
|
}
|
|
14001
14232
|
function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
|
|
14002
14233
|
if (!edgeGuarded) return headers;
|
|
@@ -14033,13 +14264,13 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
14033
14264
|
if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
14034
14265
|
return "rewrite";
|
|
14035
14266
|
}
|
|
14036
|
-
if (
|
|
14037
|
-
if (
|
|
14038
|
-
if (
|
|
14267
|
+
if (_chunkYSRZSKQBcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
14268
|
+
if (_chunkYSRZSKQBcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
14269
|
+
if (_chunkUOMSGJHKcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
14039
14270
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
14040
14271
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
14041
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
14042
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
14272
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _312 => _312.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
14273
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _313 => _313.regions, 'optionalAccess', _314 => _314.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
14043
14274
|
return "route runtime controls";
|
|
14044
14275
|
}
|
|
14045
14276
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -14051,8 +14282,180 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
14051
14282
|
}
|
|
14052
14283
|
return void 0;
|
|
14053
14284
|
}
|
|
14285
|
+
function normalizeStaticNotFoundPath(pathname) {
|
|
14286
|
+
const normalized = pathname.startsWith("/") ? pathname : `/${pathname}`;
|
|
14287
|
+
return normalized.replace(/\/+$/, "") || "/";
|
|
14288
|
+
}
|
|
14289
|
+
var FARM_STATIC_NOT_FOUND_PROBE = "/__farm-static-not-found-probe__/0";
|
|
14290
|
+
async function resolveFarmStaticNotFoundPlan(options) {
|
|
14291
|
+
const { config, routeManager } = options;
|
|
14292
|
+
if (_optionalChain([config, 'access', _315 => _315.experimental, 'optionalAccess', _316 => _316.staticNotFound]) !== true) return null;
|
|
14293
|
+
if (options.preset !== "vercel") {
|
|
14294
|
+
return { reason: `it applies to the vercel target, not "${options.preset}"` };
|
|
14295
|
+
}
|
|
14296
|
+
if (_chunkT7UC2ORAcjs.isFarmRendererDisabled.call(void 0, config.renderer)) {
|
|
14297
|
+
return { reason: "the app sets `renderer: false`, so a missing URL gets a JSON 404" };
|
|
14298
|
+
}
|
|
14299
|
+
if (config.i18n.enabled) return { reason: "i18n may redirect any path to a locale" };
|
|
14300
|
+
const routePatterns = /* @__PURE__ */ new Set();
|
|
14301
|
+
const prefixPatterns = /* @__PURE__ */ new Set([
|
|
14302
|
+
"/api",
|
|
14303
|
+
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api),
|
|
14304
|
+
"/_farm",
|
|
14305
|
+
"/__farm",
|
|
14306
|
+
"/.well-known",
|
|
14307
|
+
"/mcp"
|
|
14308
|
+
]);
|
|
14309
|
+
const paths = /* @__PURE__ */ new Set([
|
|
14310
|
+
"/robots.txt",
|
|
14311
|
+
"/sitemap.xml",
|
|
14312
|
+
"/llms.txt",
|
|
14313
|
+
"/llms-full.txt",
|
|
14314
|
+
config.images.path
|
|
14315
|
+
]);
|
|
14316
|
+
const matcherSources = /* @__PURE__ */ new Set();
|
|
14317
|
+
const addMatcherSource = (source, owner) => {
|
|
14318
|
+
if (getFarmMatcherSourceAlternative(source) === null) {
|
|
14319
|
+
return `${owner} \`${source}\` may match any path`;
|
|
14320
|
+
}
|
|
14321
|
+
matcherSources.add(source);
|
|
14322
|
+
return null;
|
|
14323
|
+
};
|
|
14324
|
+
const addMatchers = (matcher, owner) => {
|
|
14325
|
+
const matchers = matcher === void 0 ? [] : Array.isArray(matcher) ? matcher : [matcher];
|
|
14326
|
+
if (matchers.length === 0) return `${owner} has no \`matcher\`, so it runs for every path`;
|
|
14327
|
+
for (const entry of matchers) {
|
|
14328
|
+
if (typeof entry !== "string") {
|
|
14329
|
+
return `${owner} has a function or regular-expression \`matcher\``;
|
|
14330
|
+
}
|
|
14331
|
+
const refusal = addMatcherSource(entry, `${owner}'s matcher`);
|
|
14332
|
+
if (refusal) return refusal;
|
|
14333
|
+
}
|
|
14334
|
+
return null;
|
|
14335
|
+
};
|
|
14336
|
+
for (const entry of options.routeRuntimeManifest.routes) {
|
|
14337
|
+
if (entry.kind !== "page" && entry.kind !== "metadata") continue;
|
|
14338
|
+
if (/^\/\[\[?\.\.\./.test(entry.pattern)) {
|
|
14339
|
+
return { reason: `the page \`${entry.pattern}\` answers every path` };
|
|
14340
|
+
}
|
|
14341
|
+
routePatterns.add(entry.pattern);
|
|
14342
|
+
}
|
|
14343
|
+
for (const image of routeManager.getMetadataImages().values()) {
|
|
14344
|
+
routePatterns.add(`${image.pattern === "/" ? "" : image.pattern}/${image.fileName}`);
|
|
14345
|
+
}
|
|
14346
|
+
for (const plugin of config.plugins || []) {
|
|
14347
|
+
if (_chunkDVAZ53X6cjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) continue;
|
|
14348
|
+
if (plugin.name === _chunkMHKPXX3Jcjs.FARM_MOBILE_SESSION_PLUGIN) continue;
|
|
14349
|
+
if (_chunk47JV57DAcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, FARM_STATIC_NOT_FOUND_PROBE)) {
|
|
14350
|
+
return { reason: `the server plugin "${plugin.name}" may answer any path` };
|
|
14351
|
+
}
|
|
14352
|
+
for (const endpoint of _nullishCoalesce(_optionalChain([plugin, 'access', _317 => _317.runtime, 'optionalAccess', _318 => _318.endpoints]), () => ( []))) {
|
|
14353
|
+
paths.add(
|
|
14354
|
+
_chunk47JV57DAcjs.normalizeFarmPluginRuntimeEndpointPath.call(void 0,
|
|
14355
|
+
endpoint.path,
|
|
14356
|
+
`Farm plugin "${plugin.name}" runtime endpoint`
|
|
14357
|
+
)
|
|
14358
|
+
);
|
|
14359
|
+
}
|
|
14360
|
+
}
|
|
14361
|
+
if (_chunkYSRZSKQBcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware)) {
|
|
14362
|
+
const entries = Array.isArray(config.middleware) ? config.middleware : [config.middleware];
|
|
14363
|
+
for (const entry of entries) {
|
|
14364
|
+
const refusal = addMatchers(entry.matcher, "middleware in the config");
|
|
14365
|
+
if (refusal) return { reason: refusal };
|
|
14366
|
+
}
|
|
14367
|
+
}
|
|
14368
|
+
for (const route of options.middlewareRoutes) {
|
|
14369
|
+
if (normalizeStaticNotFoundPath(route.path) !== "/") {
|
|
14370
|
+
prefixPatterns.add(route.path);
|
|
14371
|
+
continue;
|
|
14372
|
+
}
|
|
14373
|
+
const fileConfig = await _asyncNullishCoalesce(route.config, async () => ( await readMiddlewareFileConfig(route.filePath)));
|
|
14374
|
+
if (!fileConfig || fileConfig === "unknown") {
|
|
14375
|
+
return {
|
|
14376
|
+
reason: "middleware.ts at the app root has no literal `config.matcher`, so it runs for every path"
|
|
14377
|
+
};
|
|
14378
|
+
}
|
|
14379
|
+
const refusal = addMatchers(fileConfig.matcher, "middleware.ts at the app root");
|
|
14380
|
+
if (refusal) return { reason: refusal };
|
|
14381
|
+
}
|
|
14382
|
+
for (const [key, integration] of Object.entries(config.integrations || {})) {
|
|
14383
|
+
if (!_chunkQKW6DLDTcjs.isFarmIntegration.call(void 0, integration)) continue;
|
|
14384
|
+
for (const entry of _nullishCoalesce(integration.middleware, () => ( []))) {
|
|
14385
|
+
const refusal = addMatchers(entry.matcher, `the "${key}" integration's middleware`);
|
|
14386
|
+
if (refusal) return { reason: refusal };
|
|
14387
|
+
}
|
|
14388
|
+
for (const route of _nullishCoalesce(integration.routes, () => ( []))) {
|
|
14389
|
+
const refusal = addMatcherSource(route.path, `the "${key}" integration's route`);
|
|
14390
|
+
if (refusal) return { reason: refusal };
|
|
14391
|
+
}
|
|
14392
|
+
}
|
|
14393
|
+
for (const source of options.redirectSources) {
|
|
14394
|
+
const refusal = addMatcherSource(source, "the redirect source");
|
|
14395
|
+
if (refusal) return { reason: refusal };
|
|
14396
|
+
}
|
|
14397
|
+
for (const source of options.rewriteSources) {
|
|
14398
|
+
const refusal = addMatcherSource(source, "the rewrite source");
|
|
14399
|
+
if (refusal) return { reason: refusal };
|
|
14400
|
+
}
|
|
14401
|
+
if (_optionalChain([config, 'access', _319 => _319.docs, 'optionalAccess', _320 => _320.enabled])) {
|
|
14402
|
+
for (const docsRoot of _chunkILQSRLKKcjs.getFarmDocsRoots.call(void 0, config.docs)) {
|
|
14403
|
+
const entry = normalizeStaticNotFoundPath(docsRoot.entry);
|
|
14404
|
+
if (entry === "/") return { reason: "the docs entry is `/`, so docs answer every path" };
|
|
14405
|
+
prefixPatterns.add(entry);
|
|
14406
|
+
}
|
|
14407
|
+
if (_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
14408
|
+
const adapterRoutes = await _chunkRBSGFS5Xcjs.listFarmDocsAdapterRoutes.call(void 0, config.docs, {
|
|
14409
|
+
root: options.root,
|
|
14410
|
+
srcDir: config.srcDir
|
|
14411
|
+
});
|
|
14412
|
+
if (!adapterRoutes) {
|
|
14413
|
+
return {
|
|
14414
|
+
reason: `the docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list the paths it answers; upgrade it`
|
|
14415
|
+
};
|
|
14416
|
+
}
|
|
14417
|
+
for (const pathname of adapterRoutes.paths) paths.add(pathname);
|
|
14418
|
+
for (const prefix of adapterRoutes.prefixes) {
|
|
14419
|
+
if (normalizeStaticNotFoundPath(prefix) === "/") {
|
|
14420
|
+
return {
|
|
14421
|
+
reason: `the docs adapter ${JSON.stringify(config.docs.adapter.id)} answers every path`
|
|
14422
|
+
};
|
|
14423
|
+
}
|
|
14424
|
+
prefixPatterns.add(prefix);
|
|
14425
|
+
}
|
|
14426
|
+
}
|
|
14427
|
+
}
|
|
14428
|
+
if (config.server.health.enabled) {
|
|
14429
|
+
paths.add(config.server.health.livenessPath);
|
|
14430
|
+
paths.add(config.server.health.readinessPath);
|
|
14431
|
+
}
|
|
14432
|
+
if (config.openapi.enabled) {
|
|
14433
|
+
if (config.openapi.route) paths.add(config.openapi.route);
|
|
14434
|
+
if (config.openapi.specRoute) paths.add(config.openapi.specRoute);
|
|
14435
|
+
}
|
|
14436
|
+
if (config.workflows.route) prefixPatterns.add(config.workflows.route);
|
|
14437
|
+
const notFoundPath = _chunkM4YXD6MDcjs.resolveFarmNotFoundComponentPath.call(void 0,
|
|
14438
|
+
config,
|
|
14439
|
+
_chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config),
|
|
14440
|
+
routeManager.getRendererNotFoundPath()
|
|
14441
|
+
);
|
|
14442
|
+
if (notFoundPath && /\bpathname\b/.test(_fs.readFileSync.call(void 0, notFoundPath, "utf8"))) {
|
|
14443
|
+
return {
|
|
14444
|
+
reason: `the not-found page (${_path2.default.relative(options.root, notFoundPath)}) reads \`pathname\`, which a file served at every URL cannot give each one`
|
|
14445
|
+
};
|
|
14446
|
+
}
|
|
14447
|
+
return {
|
|
14448
|
+
input: {
|
|
14449
|
+
basePath: config.basePath,
|
|
14450
|
+
routePatterns: [...routePatterns],
|
|
14451
|
+
prefixPatterns: [...prefixPatterns],
|
|
14452
|
+
paths: [...paths],
|
|
14453
|
+
matcherSources: [...matcherSources]
|
|
14454
|
+
}
|
|
14455
|
+
};
|
|
14456
|
+
}
|
|
14054
14457
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
14055
|
-
if (!_optionalChain([config, 'access',
|
|
14458
|
+
if (!_optionalChain([config, 'access', _321 => _321.docs, 'optionalAccess', _322 => _322.enabled]) || !config.docs.prerender) return [];
|
|
14056
14459
|
if (_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
|
|
14057
14460
|
_chunk7U4XF76Rcjs.logger.info(
|
|
14058
14461
|
`\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
|
|
@@ -14060,7 +14463,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
14060
14463
|
return [];
|
|
14061
14464
|
}
|
|
14062
14465
|
if (!_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
14063
|
-
const { pages: pages2, originDependent } =
|
|
14466
|
+
const { pages: pages2, originDependent } = _chunkILQSRLKKcjs.listFarmDocsBuiltInPrerenderPages.call(void 0, config.docs, {
|
|
14064
14467
|
root,
|
|
14065
14468
|
srcDir: config.srcDir
|
|
14066
14469
|
});
|
|
@@ -14071,7 +14474,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
14071
14474
|
}
|
|
14072
14475
|
return pages2;
|
|
14073
14476
|
}
|
|
14074
|
-
const pages = await
|
|
14477
|
+
const pages = await _chunkRBSGFS5Xcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
14075
14478
|
if (!pages) {
|
|
14076
14479
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
14077
14480
|
`The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
|
|
@@ -14081,11 +14484,11 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
14081
14484
|
return pages;
|
|
14082
14485
|
}
|
|
14083
14486
|
async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
14084
|
-
if (!_optionalChain([config, 'access',
|
|
14487
|
+
if (!_optionalChain([config, 'access', _323 => _323.docs, 'optionalAccess', _324 => _324.enabled]) || config.analytics === false || _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "nodejs") {
|
|
14085
14488
|
return [];
|
|
14086
14489
|
}
|
|
14087
14490
|
try {
|
|
14088
|
-
return await
|
|
14491
|
+
return await _chunkRBSGFS5Xcjs.listFarmDocsPagePaths.call(void 0, config.docs, {
|
|
14089
14492
|
root,
|
|
14090
14493
|
srcDir: config.srcDir,
|
|
14091
14494
|
adapter: _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)
|
|
@@ -14099,12 +14502,21 @@ async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
|
14099
14502
|
}
|
|
14100
14503
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
14101
14504
|
return Object.values(routeRules || {}).some((rule) => {
|
|
14102
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
14103
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
14104
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
14505
|
+
const swr = _optionalChain([rule, 'optionalAccess', _325 => _325.swr]);
|
|
14506
|
+
const cache = _optionalChain([rule, 'optionalAccess', _326 => _326.cache]);
|
|
14507
|
+
const headers = _optionalChain([rule, 'optionalAccess', _327 => _327.headers]);
|
|
14105
14508
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
14106
14509
|
});
|
|
14107
14510
|
}
|
|
14511
|
+
function getFarmRouteRuleHeaderNames(routeRules) {
|
|
14512
|
+
const names = /* @__PURE__ */ new Set();
|
|
14513
|
+
for (const rule of Object.values(routeRules || {})) {
|
|
14514
|
+
const headers = _optionalChain([rule, 'optionalAccess', _328 => _328.headers]);
|
|
14515
|
+
if (!headers || typeof headers !== "object") continue;
|
|
14516
|
+
for (const name of Object.keys(headers)) names.add(name.toLowerCase());
|
|
14517
|
+
}
|
|
14518
|
+
return [...names].sort();
|
|
14519
|
+
}
|
|
14108
14520
|
async function buildNitroUniversal(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, ssrBundle, ssrEntryFile, clientOutputDir, routeRuntimeManifest, configuredHeaderRoutes, nitroBuilderResultPromise, pluginManager, markdownPrecompiledPages) {
|
|
14109
14521
|
const [fs5, nitroBuilderResult] = await Promise.all([
|
|
14110
14522
|
import("fs/promises"),
|
|
@@ -14114,10 +14526,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14114
14526
|
const nitroBuilder = nitroBuilderResult.value;
|
|
14115
14527
|
const isVercel = preset === "vercel";
|
|
14116
14528
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
14117
|
-
const outputDir =
|
|
14529
|
+
const outputDir = _chunkUOMSGJHKcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
14118
14530
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
14119
14531
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
14120
|
-
const imageRuntime =
|
|
14532
|
+
const imageRuntime = _chunkM4YXD6MDcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
14121
14533
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
14122
14534
|
(image) => image.sourceType === "module"
|
|
14123
14535
|
);
|
|
@@ -14173,7 +14585,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14173
14585
|
const edgeGuardedPrerenderRoutes = [];
|
|
14174
14586
|
const addPrerenderRoute = (pathname) => {
|
|
14175
14587
|
prerenderRoutes.push(pathname);
|
|
14176
|
-
if (
|
|
14588
|
+
if (_chunkYSRZSKQBcjs.appMiddlewareMayHandlePath.call(void 0, edgeMiddlewareRoutes, pathname)) {
|
|
14177
14589
|
edgeGuardedPrerenderRoutes.push(pathname);
|
|
14178
14590
|
}
|
|
14179
14591
|
};
|
|
@@ -14217,6 +14629,22 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14217
14629
|
for (const skipped of skippedPrerenderRoutes) {
|
|
14218
14630
|
_chunk7U4XF76Rcjs.logger.info(`\u21AA Keeping SSG route ${skipped.pathname} server-handled (${skipped.reason})`);
|
|
14219
14631
|
}
|
|
14632
|
+
const staticNotFoundPlan = await resolveFarmStaticNotFoundPlan({
|
|
14633
|
+
config,
|
|
14634
|
+
root,
|
|
14635
|
+
preset,
|
|
14636
|
+
routeManager,
|
|
14637
|
+
routeRuntimeManifest,
|
|
14638
|
+
middlewareRoutes,
|
|
14639
|
+
redirectSources,
|
|
14640
|
+
rewriteSources
|
|
14641
|
+
});
|
|
14642
|
+
if (staticNotFoundPlan && "reason" in staticNotFoundPlan) {
|
|
14643
|
+
_chunk7U4XF76Rcjs.logger.info(
|
|
14644
|
+
`\u21AA Keeping missing URLs server-handled: experimental.staticNotFound is off because ${staticNotFoundPlan.reason}`
|
|
14645
|
+
);
|
|
14646
|
+
}
|
|
14647
|
+
const staticNotFoundPrerenderPath = staticNotFoundPlan && "input" in staticNotFoundPlan ? _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_STATIC_NOT_FOUND_PATH, config.basePath) : null;
|
|
14220
14648
|
if (farmWorkflows.workflows.length > 0) {
|
|
14221
14649
|
_chunk7U4XF76Rcjs.logger.info(`\u23F1\uFE0F Found ${farmWorkflows.workflows.length} Farm workflow task(s)`);
|
|
14222
14650
|
}
|
|
@@ -14267,7 +14695,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14267
14695
|
webEntry: clientJsSrc,
|
|
14268
14696
|
webBoot: clientBootSrc,
|
|
14269
14697
|
stylesheet: clientCssHref,
|
|
14270
|
-
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess',
|
|
14698
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _329 => _329.files]), () => ( []))
|
|
14271
14699
|
})
|
|
14272
14700
|
) : null;
|
|
14273
14701
|
for (const output of Object.values(ssrBundle)) {
|
|
@@ -14315,17 +14743,19 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14315
14743
|
const nitroEntryPath = _path2.default.join(ssrOutputDir, "nitro-entry.mjs");
|
|
14316
14744
|
const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
|
|
14317
14745
|
const hasNitroCacheRouteRules = hasFarmNitroCacheRouteRule(config.routeRules);
|
|
14746
|
+
const hasPrerenderedPages = prerenderRoutes.length > 0;
|
|
14747
|
+
const usesNitroResponseHook = hasNitroCacheRouteRules || hasPrerenderedPages;
|
|
14318
14748
|
const nitroEntryCode = `
|
|
14319
14749
|
// Farm.js Nitro Entry
|
|
14320
14750
|
// This file adapts Farm's Web fetch handler to Nitro's event handler contract.
|
|
14321
14751
|
|
|
14322
14752
|
import { useNitroHooks } from '#nitro/runtime/app'
|
|
14323
|
-
import handler, { farmProductionLifecycle, createFarmNodeRequestAbortSignal${nodeAdapterModule ? ", getFarmOwnedBufferedHtml, useFarmNodePageResponse" : ""} } from './${ssrEntryFile}'${nodeAdapterModule ? `
|
|
14753
|
+
import handler, { farmPrepareNativeRoutes, farmProductionLifecycle, createFarmNodeRequestAbortSignal${nodeAdapterModule ? ", getFarmOwnedBufferedHtml, useFarmNodePageResponse" : ""} } from './${ssrEntryFile}'${nodeAdapterModule ? `
|
|
14324
14754
|
import { FastResponse } from ${JSON.stringify(nodeAdapterModule)}
|
|
14325
14755
|
|
|
14326
14756
|
useFarmNodePageResponse(FastResponse)` : ""}
|
|
14327
14757
|
|
|
14328
|
-
export { farmProductionLifecycle }
|
|
14758
|
+
export { farmPrepareNativeRoutes, farmProductionLifecycle }
|
|
14329
14759
|
|
|
14330
14760
|
let farmCloseHookRegistered = false
|
|
14331
14761
|
function registerFarmCloseHook() {
|
|
@@ -14335,12 +14765,50 @@ function registerFarmCloseHook() {
|
|
|
14335
14765
|
farmProductionLifecycle.close('production-server-closed')
|
|
14336
14766
|
)
|
|
14337
14767
|
}
|
|
14338
|
-
${
|
|
14768
|
+
${usesNitroResponseHook ? `
|
|
14769
|
+
const FARM_PRIVATE_CACHE_DIRECTIVE = /(?:^|,)\\s*(?:private|no-store)\\s*(?:[,=]|$)/i
|
|
14770
|
+
` : ""}${hasPrerenderedPages ? `
|
|
14771
|
+
// A prerendered page's route rule holds its static file's headers, and H3 sets them on
|
|
14772
|
+
// whatever the server answers at that URL after Farm answered: a Markdown request by
|
|
14773
|
+
// Accept, or the URL's other trailing-slash spelling. Farm's answer keeps its own headers,
|
|
14774
|
+
// so a CDN caches its Markdown as it does for a page that renders on request. Headers an
|
|
14775
|
+
// app's routeRules set still apply, and so does the file's private policy.
|
|
14776
|
+
const FARM_ROUTE_RULE_HEADERS = new Set(${JSON.stringify(getFarmRouteRuleHeaderNames(config.routeRules))})
|
|
14777
|
+
const farmPrerenderedPageHeadersKey = Symbol.for('farm.prerenderedPageHeaders')
|
|
14778
|
+
let farmPrerenderedPageHookRegistered = false
|
|
14779
|
+
function keepFarmPrerenderedPageHeaders(event, response) {
|
|
14780
|
+
const ruleHeaders = event.context?.routeRules?.headers
|
|
14781
|
+
if (!ruleHeaders || !event.context) return
|
|
14782
|
+
const own = []
|
|
14783
|
+
for (const name of Object.keys(ruleHeaders)) {
|
|
14784
|
+
const key = name.toLowerCase()
|
|
14785
|
+
if (FARM_ROUTE_RULE_HEADERS.has(key)) continue
|
|
14786
|
+
if (key === 'cache-control' && FARM_PRIVATE_CACHE_DIRECTIVE.test(String(ruleHeaders[name]))) continue
|
|
14787
|
+
own.push([key, response.headers.get(key)])
|
|
14788
|
+
}
|
|
14789
|
+
if (own.length === 0) return
|
|
14790
|
+
if (!farmPrerenderedPageHookRegistered) {
|
|
14791
|
+
farmPrerenderedPageHookRegistered = true
|
|
14792
|
+
useNitroHooks().hook('response', (response, responseEvent) => {
|
|
14793
|
+
const headers = responseEvent.context?.[farmPrerenderedPageHeadersKey]
|
|
14794
|
+
if (!headers) return
|
|
14795
|
+
try {
|
|
14796
|
+
for (const [key, value] of headers) {
|
|
14797
|
+
if (value === null) response.headers.delete(key)
|
|
14798
|
+
else if (response.headers.get(key) !== value) response.headers.set(key, value)
|
|
14799
|
+
}
|
|
14800
|
+
} catch {
|
|
14801
|
+
// Immutable headers belong to a response Nitro passed through untouched.
|
|
14802
|
+
}
|
|
14803
|
+
})
|
|
14804
|
+
}
|
|
14805
|
+
event.context[farmPrerenderedPageHeadersKey] = own
|
|
14806
|
+
}
|
|
14807
|
+
` : ""}${hasNitroCacheRouteRules ? `
|
|
14339
14808
|
// A swr route rule caches through Nitro, which writes its own public Cache-Control on
|
|
14340
14809
|
// the event after Farm answered, and a headers route rule sets its headers there too. H3
|
|
14341
14810
|
// lets those replace the response's. A response middleware let through keeps Farm's
|
|
14342
14811
|
// private policy and no CDN cache header, so no CDN serves it to others.
|
|
14343
|
-
const FARM_PRIVATE_CACHE_DIRECTIVE = /(?:^|,)\\s*(?:private|no-store)\\s*(?:[,=]|$)/i
|
|
14344
14812
|
const FARM_CDN_CACHE_CONTROL_HEADERS = [
|
|
14345
14813
|
'cdn-cache-control',
|
|
14346
14814
|
'vercel-cdn-cache-control',
|
|
@@ -14487,7 +14955,8 @@ ${hasNitroCacheRouteRules ? " let farmGuardedResponse = false\n" : ""} const r
|
|
|
14487
14955
|
if (farmVary) {
|
|
14488
14956
|
const nitroHeaders = event.res.headers
|
|
14489
14957
|
if (nitroHeaders.has('Vary')) mergeVaryHeaders(nitroHeaders, farmVary)
|
|
14490
|
-
}${
|
|
14958
|
+
}${hasPrerenderedPages ? `
|
|
14959
|
+
if (event.context?.routeRules?.prerender) keepFarmPrerenderedPageHeaders(event, response)` : ""}${hasNitroCacheRouteRules ? `
|
|
14491
14960
|
const farmCacheControl = response.headers.get('cache-control')
|
|
14492
14961
|
if (
|
|
14493
14962
|
// A guarded response, or any response Farm kept private under a swr or cache rule: the
|
|
@@ -14530,19 +14999,19 @@ function toFarmNodeResponse(request, response) {
|
|
|
14530
14999
|
);
|
|
14531
15000
|
}
|
|
14532
15001
|
await fs5.writeFile(
|
|
14533
|
-
_path2.default.join(ssrOutputDir,
|
|
14534
|
-
|
|
15002
|
+
_path2.default.join(ssrOutputDir, _chunkEODGIFI7cjs.FARM_DESKTOP_ENV_MODULE_FILE),
|
|
15003
|
+
_chunkEODGIFI7cjs.FARM_DESKTOP_ENV_MODULE_SOURCE
|
|
14535
15004
|
);
|
|
14536
15005
|
}
|
|
14537
15006
|
const farmNodeServerEntryPath = preset === "node-server" ? _path2.default.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
|
|
14538
15007
|
if (farmNodeServerEntryPath && nodeAdapterModule) {
|
|
14539
15008
|
await fs5.writeFile(
|
|
14540
|
-
_path2.default.join(ssrOutputDir,
|
|
14541
|
-
|
|
15009
|
+
_path2.default.join(ssrOutputDir, _chunkEODGIFI7cjs.FARM_NODE_ENV_MODULE_FILE),
|
|
15010
|
+
_chunkEODGIFI7cjs.FARM_NODE_ENV_MODULE_SOURCE
|
|
14542
15011
|
);
|
|
14543
15012
|
await fs5.writeFile(
|
|
14544
15013
|
farmNodeServerEntryPath,
|
|
14545
|
-
|
|
15014
|
+
_chunkEODGIFI7cjs.createFarmNodeServerEntry.call(void 0, {
|
|
14546
15015
|
nitroEntryFile: _path2.default.basename(nitroEntryPath),
|
|
14547
15016
|
nodeAdapterModule,
|
|
14548
15017
|
server: config.server,
|
|
@@ -14555,7 +15024,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14555
15024
|
if (farmBunServerEntryPath) {
|
|
14556
15025
|
await fs5.writeFile(
|
|
14557
15026
|
farmBunServerEntryPath,
|
|
14558
|
-
|
|
15027
|
+
_chunkEODGIFI7cjs.createFarmBunServerEntry.call(void 0, {
|
|
14559
15028
|
nitroEntryFile: _path2.default.basename(nitroEntryPath),
|
|
14560
15029
|
bunAdapterModule: resolveNitroRuntimeDependency(root, "srvx/bun"),
|
|
14561
15030
|
server: config.server,
|
|
@@ -14593,7 +15062,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14593
15062
|
varyFarmNitroCacheRules(_chunkIIHZ2BEEcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules), [
|
|
14594
15063
|
...config.md.enabled ? ["accept"] : [],
|
|
14595
15064
|
...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : [],
|
|
14596
|
-
..._chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
15065
|
+
..._chunkT7UC2ORAcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _330 => _330.experimental, 'optionalAccess', _331 => _331.serverComponents])) === "islands" ? ["f-layouts"] : []
|
|
14597
15066
|
]),
|
|
14598
15067
|
config.basePath,
|
|
14599
15068
|
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
@@ -14641,8 +15110,8 @@ function toFarmNodeResponse(request, response) {
|
|
|
14641
15110
|
...farmNodeServerEntryPath ? { entry: farmNodeServerEntryPath } : {},
|
|
14642
15111
|
...farmBunServerEntryPath ? { entry: farmBunServerEntryPath } : {},
|
|
14643
15112
|
...farmNetlifyEntryPath ? { entry: farmNetlifyEntryPath } : {},
|
|
14644
|
-
// The response
|
|
14645
|
-
...
|
|
15113
|
+
// The response hooks that keep Farm's headers under a route rule's (nitro-entry).
|
|
15114
|
+
...usesNitroResponseHook ? { features: { runtimeHooks: true } } : {},
|
|
14646
15115
|
rootDir: root,
|
|
14647
15116
|
// Farm registers every handler, task, and plugin explicitly. Scanning the
|
|
14648
15117
|
// project root would bundle an app's own `middleware/`, `api/`, `routes/`,
|
|
@@ -14667,7 +15136,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14667
15136
|
// print sizes after the build. A self-hosted server is never shipped compressed,
|
|
14668
15137
|
// so list plain sizes; zipped serverless and edge bundles keep the gzip column.
|
|
14669
15138
|
...preset === "node-server" || preset === "bun" ? { logging: { compressedSizes: false } } : {},
|
|
14670
|
-
...prerenderRoutes.length > 0 ? {
|
|
15139
|
+
...prerenderRoutes.length > 0 || staticNotFoundPrerenderPath ? {
|
|
14671
15140
|
prerender: {
|
|
14672
15141
|
crawlLinks: false,
|
|
14673
15142
|
failOnError: true,
|
|
@@ -14675,7 +15144,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
14675
15144
|
// answered independently, as by the production server, so keeping several
|
|
14676
15145
|
// in flight overlaps the worker's rendering with this thread's per-route work.
|
|
14677
15146
|
concurrency: Math.min(_os2.default.availableParallelism(), 8),
|
|
14678
|
-
routes:
|
|
15147
|
+
routes: [
|
|
15148
|
+
...prerenderRoutes.map(toPrerenderPublicPath),
|
|
15149
|
+
...staticNotFoundPrerenderPath ? [staticNotFoundPrerenderPath] : []
|
|
15150
|
+
],
|
|
14679
15151
|
// Cloudflare's asset server answers a directory index (about/index.html) at the
|
|
14680
15152
|
// trailing-slash URL and redirects the other spelling to it, so a page is written as
|
|
14681
15153
|
// about.html unless trailingSlash asks for the slash, as Nitro's Netlify and Vercel
|
|
@@ -14720,7 +15192,8 @@ function toFarmNodeResponse(request, response) {
|
|
|
14720
15192
|
...configuredNitroRouteRules,
|
|
14721
15193
|
// Exact user rules must retain their runtime settings without replacing
|
|
14722
15194
|
// the headers and prerender marker generated for a safe physical page.
|
|
14723
|
-
...prerenderNitroRouteRules
|
|
15195
|
+
...prerenderNitroRouteRules,
|
|
15196
|
+
...staticNotFoundPrerenderPath ? { [staticNotFoundPrerenderPath]: { prerender: true } } : {}
|
|
14724
15197
|
},
|
|
14725
15198
|
rollupConfig: {
|
|
14726
15199
|
external: nitroRollupExternal,
|
|
@@ -14732,7 +15205,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14732
15205
|
// Workers bundle React here rather than loading it from node_modules.
|
|
14733
15206
|
// Unenv rewrites `process` before Nitro's own replacements run, so
|
|
14734
15207
|
// React's development builds would otherwise ship next to production.
|
|
14735
|
-
...isCloudflareWorker ? [
|
|
15208
|
+
...isCloudflareWorker ? [_chunkEODGIFI7cjs.createReactProductionModePlugin.call(void 0, )] : []
|
|
14736
15209
|
]
|
|
14737
15210
|
},
|
|
14738
15211
|
// Keep the public Nitro boolean intact for build hooks. Farm replaces
|
|
@@ -14758,22 +15231,22 @@ function toFarmNodeResponse(request, response) {
|
|
|
14758
15231
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
14759
15232
|
);
|
|
14760
15233
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
14761
|
-
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
14762
|
-
_optionalChain([nitroConfig, 'access',
|
|
14763
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
15234
|
+
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _332 => _332.rollupConfig, 'optionalAccess', _333 => _333.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _334 => _334.rollupConfig, 'optionalAccess', _335 => _335.plugins])) && customRollupKeys.length === 0 && Boolean(
|
|
15235
|
+
_optionalChain([nitroConfig, 'access', _336 => _336.handlers, 'optionalAccess', _337 => _337.some, 'call', _338 => _338(
|
|
15236
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _339 => _339.handler]) || "") === nitroEntryPath
|
|
14764
15237
|
)])
|
|
14765
15238
|
);
|
|
14766
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access',
|
|
14767
|
-
const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
15239
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _340 => _340.output, 'optionalAccess', _341 => _341.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
|
|
15240
|
+
const prerenderReusesPrebuiltSSR = (prerenderRoutes.length > 0 || staticNotFoundPrerenderPath !== null) && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
14768
15241
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
14769
15242
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
14770
15243
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
14771
15244
|
const shouldMinify = nitroConfig.minify !== false;
|
|
14772
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
15245
|
+
const keepServerNames = !(_optionalChain([config, 'access', _342 => _342.docs, 'optionalAccess', _343 => _343.enabled]) && _optionalChain([config, 'access', _344 => _344.docs, 'access', _345 => _345.adapter, 'optionalAccess', _346 => _346.server]));
|
|
14773
15246
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
14774
15247
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
14775
15248
|
const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
|
|
14776
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
15249
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _347 => _347.rollupConfig, 'optionalAccess', _348 => _348.plugins]);
|
|
14777
15250
|
nitroConfig.rollupConfig = {
|
|
14778
15251
|
...nitroConfig.rollupConfig,
|
|
14779
15252
|
plugins: [
|
|
@@ -14812,7 +15285,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14812
15285
|
let skippedNonHtmlPrerenderRoute = false;
|
|
14813
15286
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
14814
15287
|
if (route.error || !prerenderPagePaths.has(route.route)) return;
|
|
14815
|
-
if (_optionalChain([route, 'access',
|
|
15288
|
+
if (_optionalChain([route, 'access', _349 => _349.contentType, 'optionalAccess', _350 => _350.toLowerCase, 'call', _351 => _351(), 'access', _352 => _352.includes, 'call', _353 => _353("html")])) return;
|
|
14816
15289
|
route.skip = true;
|
|
14817
15290
|
skippedNonHtmlPrerenderRoute = true;
|
|
14818
15291
|
const configuredRule = configuredNitroRouteRules[route.route];
|
|
@@ -14823,10 +15296,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
14823
15296
|
nitroInstance.hooks.hook("prerender:done", () => {
|
|
14824
15297
|
if (skippedNonHtmlPrerenderRoute) nitroInstance.routing.sync();
|
|
14825
15298
|
});
|
|
14826
|
-
if (_optionalChain([config, 'access',
|
|
15299
|
+
if (_optionalChain([config, 'access', _354 => _354.md, 'optionalAccess', _355 => _355.enabled])) {
|
|
14827
15300
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
14828
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
14829
|
-
const alternatePath =
|
|
15301
|
+
if (!route.contents || !_optionalChain([route, 'access', _356 => _356.contentType, 'optionalAccess', _357 => _357.toLowerCase, 'call', _358 => _358(), 'access', _359 => _359.includes, 'call', _360 => _360("html")])) return;
|
|
15302
|
+
const alternatePath = _chunk5LJF4KUZcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
|
|
14830
15303
|
routePathname: (pathname) => routeManager.toRoutePathname(pathname)
|
|
14831
15304
|
});
|
|
14832
15305
|
if (!alternatePath) return;
|
|
@@ -14848,7 +15321,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14848
15321
|
}
|
|
14849
15322
|
if (config.security.csp && config.security.csp.nonce) {
|
|
14850
15323
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
14851
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
15324
|
+
if (!route.contents || !_optionalChain([route, 'access', _361 => _361.contentType, 'optionalAccess', _362 => _362.toLowerCase, 'call', _363 => _363(), 'access', _364 => _364.includes, 'call', _365 => _365("html")])) return;
|
|
14852
15325
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
14853
15326
|
if (!staticCsp) return;
|
|
14854
15327
|
route.contents = staticCsp.html;
|
|
@@ -14864,6 +15337,22 @@ function toFarmNodeResponse(request, response) {
|
|
|
14864
15337
|
nitroInstance.routing.sync();
|
|
14865
15338
|
});
|
|
14866
15339
|
}
|
|
15340
|
+
let staticNotFoundWritten = false;
|
|
15341
|
+
let staticNotFoundRefusal = null;
|
|
15342
|
+
if (staticNotFoundPrerenderPath) {
|
|
15343
|
+
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
15344
|
+
if (route.route !== staticNotFoundPrerenderPath) return;
|
|
15345
|
+
const status = _nullishCoalesce(_optionalChain([route, 'access', _366 => _366.error, 'optionalAccess', _367 => _367.status]), () => ( 200));
|
|
15346
|
+
const contentType = _nullishCoalesce(_optionalChain([route, 'access', _368 => _368.contentType, 'optionalAccess', _369 => _369.toLowerCase, 'call', _370 => _370()]), () => ( ""));
|
|
15347
|
+
route.error = void 0;
|
|
15348
|
+
if (status === 404 && contentType.includes("text/html")) {
|
|
15349
|
+
staticNotFoundWritten = true;
|
|
15350
|
+
return;
|
|
15351
|
+
}
|
|
15352
|
+
route.skip = true;
|
|
15353
|
+
staticNotFoundRefusal = contentType.includes(FARM_STATIC_NOT_FOUND_REFUSAL_TYPE) ? route.contents || "the not-found page can't be served as a file" : `the build's request for the not-found page answered ${status} instead of 404`;
|
|
15354
|
+
});
|
|
15355
|
+
}
|
|
14867
15356
|
if (farmNodeServerEntryPath || farmBunServerEntryPath || farmNetlifyEntryPath) {
|
|
14868
15357
|
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
14869
15358
|
delete prerendererConfig.entry;
|
|
@@ -14884,7 +15373,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14884
15373
|
await nitroBuilder.copyPublicAssets(nitroInstance);
|
|
14885
15374
|
if (prerenderReusesPrebuiltSSR && !canReusePrebuiltSSR) {
|
|
14886
15375
|
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
14887
|
-
const configuredPlugins = _optionalChain([prerendererConfig, 'access',
|
|
15376
|
+
const configuredPlugins = _optionalChain([prerendererConfig, 'access', _371 => _371.rollupConfig, 'optionalAccess', _372 => _372.plugins]);
|
|
14888
15377
|
const plugins = Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [];
|
|
14889
15378
|
prerendererConfig.rollupConfig = {
|
|
14890
15379
|
...prerendererConfig.rollupConfig,
|
|
@@ -14920,6 +15409,15 @@ function toFarmNodeResponse(request, response) {
|
|
|
14920
15409
|
});
|
|
14921
15410
|
});
|
|
14922
15411
|
}
|
|
15412
|
+
if (isVercel && docsPrerenderPages.some((pathname) => prerenderRoutes.includes(pathname))) {
|
|
15413
|
+
nitroInstance.hooks.hook("prerender:init", (prerenderer) => {
|
|
15414
|
+
prerenderer.hooks.hook("compiled", async () => {
|
|
15415
|
+
await copyFarmDocsContentForVercel(config, root, prerenderer.options.output.serverDir, fs5, {
|
|
15416
|
+
log: false
|
|
15417
|
+
});
|
|
15418
|
+
});
|
|
15419
|
+
});
|
|
15420
|
+
}
|
|
14923
15421
|
nitroInstance.hooks.hook("rollup:before", (_nitro, rollupConfig) => {
|
|
14924
15422
|
nameCodeSplittingGroups(rollupConfig);
|
|
14925
15423
|
});
|
|
@@ -14939,15 +15437,17 @@ function toFarmNodeResponse(request, response) {
|
|
|
14939
15437
|
}
|
|
14940
15438
|
});
|
|
14941
15439
|
}
|
|
14942
|
-
if (prerenderRoutes.length > 0) {
|
|
14943
|
-
|
|
14944
|
-
|
|
14945
|
-
|
|
15440
|
+
if (prerenderRoutes.length > 0 || staticNotFoundPrerenderPath) {
|
|
15441
|
+
if (prerenderRoutes.length > 0) {
|
|
15442
|
+
_chunk7U4XF76Rcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
15443
|
+
}
|
|
15444
|
+
const previousPrerender = process.env[_chunkUGWKNZ4Ucjs.FARM_PRERENDER_ENV];
|
|
15445
|
+
process.env[_chunkUGWKNZ4Ucjs.FARM_PRERENDER_ENV] = "1";
|
|
14946
15446
|
try {
|
|
14947
15447
|
await nitroBuilder.prerender(nitroInstance);
|
|
14948
15448
|
} finally {
|
|
14949
|
-
if (previousPrerender === void 0) delete process.env[
|
|
14950
|
-
else process.env[
|
|
15449
|
+
if (previousPrerender === void 0) delete process.env[_chunkUGWKNZ4Ucjs.FARM_PRERENDER_ENV];
|
|
15450
|
+
else process.env[_chunkUGWKNZ4Ucjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
14951
15451
|
}
|
|
14952
15452
|
}
|
|
14953
15453
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs5, preset) : Promise.resolve(null);
|
|
@@ -15018,6 +15518,41 @@ function toFarmNodeResponse(request, response) {
|
|
|
15018
15518
|
outputDir
|
|
15019
15519
|
});
|
|
15020
15520
|
}
|
|
15521
|
+
let staticNotFoundRoutes;
|
|
15522
|
+
if (staticNotFoundPlan && "input" in staticNotFoundPlan && staticNotFoundPrerenderPath) {
|
|
15523
|
+
const toHandlerKey = (handler) => _chunk7U4XF76Rcjs.toPosixPath.call(void 0, _path2.default.resolve(root, handler));
|
|
15524
|
+
const handlerSources = getFarmStaticNotFoundHandlerSources(
|
|
15525
|
+
nitroInstance.options.handlers.map((handler) => ({
|
|
15526
|
+
route: handler.route,
|
|
15527
|
+
handler: toHandlerKey(handler.handler)
|
|
15528
|
+
})),
|
|
15529
|
+
new Set(
|
|
15530
|
+
[nitroEntryPath, farmWorkflows.handlerPath].filter((handler) => Boolean(handler)).map(toHandlerKey)
|
|
15531
|
+
)
|
|
15532
|
+
);
|
|
15533
|
+
if (!handlerSources) {
|
|
15534
|
+
staticNotFoundRefusal = "a Nitro handler that a plugin or module adds may answer any path";
|
|
15535
|
+
} else if (staticNotFoundWritten) {
|
|
15536
|
+
staticNotFoundRoutes = createFarmVercelStaticNotFoundRoutes({
|
|
15537
|
+
...staticNotFoundPlan.input,
|
|
15538
|
+
matcherSources: [...staticNotFoundPlan.input.matcherSources, ...handlerSources]
|
|
15539
|
+
});
|
|
15540
|
+
const fileHeaders = _optionalChain([nitroInstance, 'access', _373 => _373.options, 'access', _374 => _374.routeRules, 'access', _375 => _375[staticNotFoundPrerenderPath], 'optionalAccess', _376 => _376.headers]);
|
|
15541
|
+
const cspHeaders = Object.fromEntries(
|
|
15542
|
+
Object.entries(fileHeaders || {}).filter(
|
|
15543
|
+
([name]) => name.toLowerCase().startsWith("content-security-policy")
|
|
15544
|
+
)
|
|
15545
|
+
);
|
|
15546
|
+
const notFoundRoute = staticNotFoundRoutes[staticNotFoundRoutes.length - 1];
|
|
15547
|
+
if (notFoundRoute && Object.keys(cspHeaders).length > 0) notFoundRoute.headers = cspHeaders;
|
|
15548
|
+
_chunk7U4XF76Rcjs.logger.info("\u{1F4C4} Serving the not-found page as a file to missing URLs");
|
|
15549
|
+
}
|
|
15550
|
+
if (!staticNotFoundRoutes) {
|
|
15551
|
+
_chunk7U4XF76Rcjs.logger.info(
|
|
15552
|
+
`\u21AA Keeping missing URLs server-handled: experimental.staticNotFound is off because ${_nullishCoalesce(staticNotFoundRefusal, () => ( "the build did not write the not-found page"))}`
|
|
15553
|
+
);
|
|
15554
|
+
}
|
|
15555
|
+
}
|
|
15021
15556
|
if (isVercel) {
|
|
15022
15557
|
await postProcessVercelOutput(
|
|
15023
15558
|
root,
|
|
@@ -15032,7 +15567,8 @@ function toFarmNodeResponse(request, response) {
|
|
|
15032
15567
|
middlewareRoutes: edgeMiddlewareRoutes,
|
|
15033
15568
|
guardedPages: edgeGuardedPrerenderRoutes
|
|
15034
15569
|
},
|
|
15035
|
-
prerenderRoutes.map(toPrerenderPublicPath)
|
|
15570
|
+
prerenderRoutes.map(toPrerenderPublicPath),
|
|
15571
|
+
staticNotFoundRoutes
|
|
15036
15572
|
);
|
|
15037
15573
|
}
|
|
15038
15574
|
_chunk7U4XF76Rcjs.logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
|
|
@@ -15090,16 +15626,16 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs5) {
|
|
|
15090
15626
|
}
|
|
15091
15627
|
async function installFarmCompileCacheLauncher(serverDir, fs5) {
|
|
15092
15628
|
const entryPath = _path2.default.join(serverDir, "index.mjs");
|
|
15093
|
-
const serverPath = _path2.default.join(serverDir,
|
|
15629
|
+
const serverPath = _path2.default.join(serverDir, _chunkEODGIFI7cjs.FARM_SERVER_MODULE_FILE);
|
|
15094
15630
|
const entry = await fs5.readFile(entryPath, "utf8").catch((error) => {
|
|
15095
15631
|
if (error.code === "ENOENT") return null;
|
|
15096
15632
|
throw error;
|
|
15097
15633
|
});
|
|
15098
15634
|
if (entry === null) return false;
|
|
15099
|
-
if (entry.includes(`./${
|
|
15635
|
+
if (entry.includes(`./${_chunkEODGIFI7cjs.FARM_SERVER_MODULE_FILE}`)) return false;
|
|
15100
15636
|
await fs5.rename(entryPath, serverPath);
|
|
15101
|
-
await fs5.writeFile(entryPath,
|
|
15102
|
-
await fs5.rm(_path2.default.join(serverDir,
|
|
15637
|
+
await fs5.writeFile(entryPath, _chunkEODGIFI7cjs.createFarmCompileCacheLauncher.call(void 0, _chunkEODGIFI7cjs.FARM_SERVER_MODULE_FILE));
|
|
15638
|
+
await fs5.rm(_path2.default.join(serverDir, _chunkEODGIFI7cjs.FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
|
|
15103
15639
|
return true;
|
|
15104
15640
|
}
|
|
15105
15641
|
async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs5) {
|
|
@@ -15124,7 +15660,7 @@ async function moveVercelOutputPath(src, dest, fs5) {
|
|
|
15124
15660
|
await fs5.rename(src, dest);
|
|
15125
15661
|
return;
|
|
15126
15662
|
} catch (error) {
|
|
15127
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
15663
|
+
const code = _optionalChain([error, 'optionalAccess', _377 => _377.code]);
|
|
15128
15664
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
15129
15665
|
throw error;
|
|
15130
15666
|
}
|
|
@@ -15132,7 +15668,7 @@ async function moveVercelOutputPath(src, dest, fs5) {
|
|
|
15132
15668
|
await fs5.cp(src, dest, { recursive: true, force: true });
|
|
15133
15669
|
await fs5.rm(src, { recursive: true, force: true });
|
|
15134
15670
|
}
|
|
15135
|
-
async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware, prerenderedPages) {
|
|
15671
|
+
async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware, prerenderedPages, notFoundRoutes) {
|
|
15136
15672
|
const serverDir = _path2.default.join(outputDir, "server");
|
|
15137
15673
|
const functionsDir = _path2.default.join(outputDir, "functions");
|
|
15138
15674
|
const nitroFuncDir = _path2.default.join(functionsDir, "__nitro.func");
|
|
@@ -15150,7 +15686,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
15150
15686
|
try {
|
|
15151
15687
|
await moveVercelOutputPath(publicDir, staticDir, fs5);
|
|
15152
15688
|
} catch (error) {
|
|
15153
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
15689
|
+
if (_optionalChain([error, 'optionalAccess', _378 => _378.code]) !== "ENOENT") throw error;
|
|
15154
15690
|
}
|
|
15155
15691
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5);
|
|
15156
15692
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs5);
|
|
@@ -15164,7 +15700,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
15164
15700
|
config.basePath
|
|
15165
15701
|
);
|
|
15166
15702
|
const edgeMiddlewareRoutes = edgeMiddleware.middlewareRoutes.filter(
|
|
15167
|
-
(route) => edgeMiddleware.guardedPages.some((pathname) =>
|
|
15703
|
+
(route) => edgeMiddleware.guardedPages.some((pathname) => _chunkYSRZSKQBcjs.appMiddlewareMayHandlePath.call(void 0, [route], pathname))
|
|
15168
15704
|
);
|
|
15169
15705
|
if (edgeMiddlewareRoutes.length > 0) {
|
|
15170
15706
|
await writeFarmVercelEdgeMiddlewareFunction({
|
|
@@ -15181,7 +15717,9 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
15181
15717
|
presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
|
|
15182
15718
|
runtimeRoutes,
|
|
15183
15719
|
middlewareRoutes: edgeMiddlewareRoutes.length > 0 ? createFarmVercelEdgeMiddlewareRoutes(edgeMiddleware.guardedPages, config.basePath) : [],
|
|
15184
|
-
canonicalSlashRoutes: createFarmVercelCanonicalSlashRoutes(prerenderedPages)
|
|
15720
|
+
canonicalSlashRoutes: createFarmVercelCanonicalSlashRoutes(prerenderedPages),
|
|
15721
|
+
markdownRoutes: createFarmVercelMarkdownRoutes(prerenderedPages),
|
|
15722
|
+
notFoundRoutes
|
|
15185
15723
|
});
|
|
15186
15724
|
const vercelConfigWithWorkflowCrons = _chunkBSX5OGSDcjs.applyFarmWorkflowVercelCrons.call(void 0,
|
|
15187
15725
|
vercelConfig,
|
|
@@ -15191,34 +15729,39 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
15191
15729
|
await fs5.writeFile(configPath, JSON.stringify(vercelConfigWithCrons, null, 2));
|
|
15192
15730
|
_chunk7U4XF76Rcjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
15193
15731
|
}
|
|
15194
|
-
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
|
|
15195
|
-
if (!_optionalChain([config, 'access',
|
|
15196
|
-
const [mainRoot, ...extraRoots] =
|
|
15732
|
+
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5, options = {}) {
|
|
15733
|
+
if (!_optionalChain([config, 'access', _379 => _379.docs, 'optionalAccess', _380 => _380.enabled])) return;
|
|
15734
|
+
const [mainRoot, ...extraRoots] = _chunkILQSRLKKcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
15197
15735
|
await copyFarmDocsRootContent(
|
|
15198
15736
|
mainRoot,
|
|
15199
15737
|
root,
|
|
15200
15738
|
config.srcDir,
|
|
15201
15739
|
_path2.default.join(nitroFuncDir, "farm-docs-content"),
|
|
15202
|
-
fs5
|
|
15740
|
+
fs5,
|
|
15741
|
+
options
|
|
15203
15742
|
);
|
|
15743
|
+
const bundledRootPaths = getFarmDocsBundledRootPaths(config.docs, root, config.srcDir);
|
|
15204
15744
|
for (const [index, docsRoot] of extraRoots.entries()) {
|
|
15745
|
+
const bundledRootDir = _path2.default.join(nitroFuncDir, "farm-docs-roots", String(index));
|
|
15746
|
+
await fs5.rm(bundledRootDir, { recursive: true, force: true });
|
|
15205
15747
|
await copyFarmDocsRootContent(
|
|
15206
15748
|
docsRoot,
|
|
15207
15749
|
root,
|
|
15208
15750
|
config.srcDir,
|
|
15209
|
-
_path2.default.join(
|
|
15210
|
-
fs5
|
|
15751
|
+
_path2.default.join(bundledRootDir, ...bundledRootPaths[index].split("/")),
|
|
15752
|
+
fs5,
|
|
15753
|
+
options
|
|
15211
15754
|
);
|
|
15212
15755
|
}
|
|
15213
15756
|
}
|
|
15214
|
-
async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs5) {
|
|
15757
|
+
async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs5, { log = true } = {}) {
|
|
15215
15758
|
const docsContentDir = resolveBuildDocsContentDir(docs, root, srcDir);
|
|
15216
15759
|
if (!docsContentDir) return;
|
|
15217
|
-
const lastModifiedManifest =
|
|
15760
|
+
const lastModifiedManifest = _chunkILQSRLKKcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
15218
15761
|
fallback: "now"
|
|
15219
15762
|
});
|
|
15220
|
-
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access',
|
|
15221
|
-
if (undatedPages > 0) {
|
|
15763
|
+
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _381 => _381.unknown, 'optionalAccess', _382 => _382.length]), () => ( 0));
|
|
15764
|
+
if (log && undatedPages > 0) {
|
|
15222
15765
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
15223
15766
|
`${undatedPages} docs page(s) were last changed before this shallow clone's Git history, so they show no "Last updated" date. Build from a full clone (git fetch --unshallow) or set lastModified in the page's frontmatter.`
|
|
15224
15767
|
);
|
|
@@ -15231,11 +15774,13 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
15231
15774
|
dereference: true
|
|
15232
15775
|
});
|
|
15233
15776
|
await fs5.writeFile(
|
|
15234
|
-
_path2.default.join(bundledContentDir,
|
|
15777
|
+
_path2.default.join(bundledContentDir, _chunkILQSRLKKcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
15235
15778
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
15236
15779
|
`
|
|
15237
15780
|
);
|
|
15238
|
-
|
|
15781
|
+
if (log) {
|
|
15782
|
+
_chunk7U4XF76Rcjs.logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${_path2.default.relative(root, docsContentDir)}`);
|
|
15783
|
+
}
|
|
15239
15784
|
}
|
|
15240
15785
|
function resolveServerFunctionPlatform(preset) {
|
|
15241
15786
|
return preset === "vercel" || preset === "netlify" ? { os: "linux", cpu: "x64", libc: "glibc" } : null;
|
|
@@ -15302,7 +15847,7 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
15302
15847
|
try {
|
|
15303
15848
|
await copyPackage("sharp", sharpRequire);
|
|
15304
15849
|
if (!copiedPackages.has("sharp")) {
|
|
15305
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
15850
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkM4YXD6MDcjs.SHARP_INSTALL_HINT}`);
|
|
15306
15851
|
}
|
|
15307
15852
|
} catch (error) {
|
|
15308
15853
|
await fs5.rm(stageDir, { recursive: true, force: true });
|
|
@@ -15534,8 +16079,8 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
15534
16079
|
|
|
15535
16080
|
// src/build/index.ts
|
|
15536
16081
|
async function build(config, options = {}) {
|
|
15537
|
-
return
|
|
15538
|
-
() =>
|
|
16082
|
+
return _chunkEODGIFI7cjs.withProductionNodeEnv.call(void 0,
|
|
16083
|
+
() => _chunkRTAWQXMEcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
15539
16084
|
);
|
|
15540
16085
|
}
|
|
15541
16086
|
function createBuildTargetBaseline(config) {
|
|
@@ -15546,7 +16091,7 @@ function createBuildTargetBaseline(config) {
|
|
|
15546
16091
|
preset,
|
|
15547
16092
|
distDir,
|
|
15548
16093
|
outputDir,
|
|
15549
|
-
outputWasDerived: outputDir ===
|
|
16094
|
+
outputWasDerived: outputDir === _chunkUOMSGJHKcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
15550
16095
|
};
|
|
15551
16096
|
}
|
|
15552
16097
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -15555,8 +16100,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
15555
16100
|
const distDir = config.distDir || ".farm";
|
|
15556
16101
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
15557
16102
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
15558
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
15559
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
16103
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkUOMSGJHKcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
16104
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkUOMSGJHKcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
15560
16105
|
return {
|
|
15561
16106
|
root,
|
|
15562
16107
|
preset,
|
|
@@ -15564,7 +16109,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
15564
16109
|
distDir,
|
|
15565
16110
|
deployTarget,
|
|
15566
16111
|
outputDir,
|
|
15567
|
-
deployOutputDir:
|
|
16112
|
+
deployOutputDir: _chunkUOMSGJHKcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
15568
16113
|
};
|
|
15569
16114
|
}
|
|
15570
16115
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -15601,15 +16146,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15601
16146
|
};
|
|
15602
16147
|
config = {
|
|
15603
16148
|
...config,
|
|
15604
|
-
images:
|
|
16149
|
+
images: _chunkM4YXD6MDcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
15605
16150
|
root: targets.root,
|
|
15606
16151
|
preset: targets.preset
|
|
15607
16152
|
})
|
|
15608
16153
|
};
|
|
15609
|
-
if (_optionalChain([config, 'access',
|
|
16154
|
+
if (_optionalChain([config, 'access', _383 => _383.docs, 'optionalAccess', _384 => _384.enabled])) await _chunkNDOE76QCcjs.loadFarmDocsEngine.call(void 0, );
|
|
15610
16155
|
pluginManager.updateContext({ config });
|
|
15611
16156
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
15612
|
-
|
|
16157
|
+
_chunkRTAWQXMEcjs.usePackageClientBoundaryCacheFile.call(void 0, _chunkRTAWQXMEcjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
|
|
15613
16158
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
15614
16159
|
await pluginManager.setupPlugins();
|
|
15615
16160
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
@@ -15621,8 +16166,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15621
16166
|
});
|
|
15622
16167
|
_chunk7U4XF76Rcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
15623
16168
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
15624
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
15625
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
16169
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _385 => _385.status]) === "rejected") throw productionViteResult.reason;
|
|
16170
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _386 => _386.value]);
|
|
15626
16171
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
15627
16172
|
projectModuleServer = await createProjectModuleServer(
|
|
15628
16173
|
createViteServer,
|
|
@@ -15630,20 +16175,20 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15630
16175
|
root,
|
|
15631
16176
|
rendererBuild.signal
|
|
15632
16177
|
);
|
|
15633
|
-
const farmApp =
|
|
16178
|
+
const farmApp = _chunkM4YXD6MDcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
15634
16179
|
if (options.universal !== false) farmApp.getRouteManager().keepBuildSourceSnapshot();
|
|
15635
16180
|
await farmApp.initialize();
|
|
15636
16181
|
const routeManager = farmApp.getRouteManager();
|
|
15637
16182
|
const serverRenderer = farmApp.getServerRenderer();
|
|
15638
|
-
const typeArtifacts =
|
|
16183
|
+
const typeArtifacts = _chunkEXPVSFAGcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
15639
16184
|
root,
|
|
15640
16185
|
srcDir,
|
|
15641
16186
|
layers: config.layers,
|
|
15642
16187
|
storage: config.storage,
|
|
15643
16188
|
plugins: config.plugins,
|
|
15644
16189
|
extraRoutes: [
|
|
15645
|
-
..._optionalChain([config, 'access',
|
|
15646
|
-
...
|
|
16190
|
+
..._optionalChain([config, 'access', _387 => _387.openapi, 'optionalAccess', _388 => _388.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
16191
|
+
..._chunkILQSRLKKcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
15647
16192
|
],
|
|
15648
16193
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
15649
16194
|
componentExtensions: config.renderer.componentExtensions,
|
|
@@ -15653,7 +16198,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15653
16198
|
const message = error instanceof Error ? error.message : String(error);
|
|
15654
16199
|
_chunk7U4XF76Rcjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
|
|
15655
16200
|
});
|
|
15656
|
-
const apiRouteManager = new (0,
|
|
16201
|
+
const apiRouteManager = new (0, _chunkTWFJJPE7cjs.APIRouteManager)(
|
|
15657
16202
|
_chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config),
|
|
15658
16203
|
projectModuleServer,
|
|
15659
16204
|
{
|
|
@@ -15728,7 +16273,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15728
16273
|
throw error;
|
|
15729
16274
|
} finally {
|
|
15730
16275
|
try {
|
|
15731
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
16276
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _389 => _389.close, 'call', _390 => _390()]);
|
|
15732
16277
|
} finally {
|
|
15733
16278
|
rendererBuild.abort();
|
|
15734
16279
|
}
|
|
@@ -15740,7 +16285,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15740
16285
|
ssr: true,
|
|
15741
16286
|
buildLifetime
|
|
15742
16287
|
});
|
|
15743
|
-
const viteConfig =
|
|
16288
|
+
const viteConfig = _chunkM4YXD6MDcjs.mergeFarmViteConfig.call(void 0,
|
|
15744
16289
|
{
|
|
15745
16290
|
root,
|
|
15746
16291
|
appType: "custom",
|
|
@@ -15752,13 +16297,13 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15752
16297
|
},
|
|
15753
16298
|
plugins: [
|
|
15754
16299
|
...rendererVitePlugins,
|
|
15755
|
-
|
|
16300
|
+
_chunkM4YXD6MDcjs.farmFontImportsPlugin.call(void 0, {
|
|
15756
16301
|
root,
|
|
15757
16302
|
basePath: config.basePath,
|
|
15758
16303
|
publicDir: config.publicDir,
|
|
15759
|
-
isLayoutModule: (id) =>
|
|
16304
|
+
isLayoutModule: (id) => _chunkM4YXD6MDcjs.isFarmLayoutModule.call(void 0, id, _chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config))
|
|
15760
16305
|
}),
|
|
15761
|
-
|
|
16306
|
+
_chunkRTAWQXMEcjs.farmEnvironmentFunctionsPlugin.call(void 0, { renderer: config.renderer }),
|
|
15762
16307
|
// Route modules load here at build time (rendering config, prerendering): `server-only`
|
|
15763
16308
|
// resolves as it does in the server build. Module-entry packages load pre-bundled, as in
|
|
15764
16309
|
// `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
|
|
@@ -15774,7 +16319,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15774
16319
|
hmr: false
|
|
15775
16320
|
},
|
|
15776
16321
|
resolve: {
|
|
15777
|
-
alias:
|
|
16322
|
+
alias: _chunkM4YXD6MDcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
15778
16323
|
dedupe: [...config.renderer.dedupe || []]
|
|
15779
16324
|
},
|
|
15780
16325
|
optimizeDeps: {
|
|
@@ -15813,10 +16358,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15813
16358
|
noDiscovery: true
|
|
15814
16359
|
},
|
|
15815
16360
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
15816
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
16361
|
+
environments: _optionalChain([viteConfig, 'access', _391 => _391.environments, 'optionalAccess', _392 => _392.ssr, 'optionalAccess', _393 => _393.dev, 'optionalAccess', _394 => _394.createEnvironment]) ? viteConfig.environments : {
|
|
15817
16362
|
...viteConfig.environments,
|
|
15818
16363
|
ssr: {
|
|
15819
|
-
..._optionalChain([viteConfig, 'access',
|
|
16364
|
+
..._optionalChain([viteConfig, 'access', _395 => _395.environments, 'optionalAccess', _396 => _396.ssr]),
|
|
15820
16365
|
...await createFarmProjectModuleSsrEnvironment()
|
|
15821
16366
|
}
|
|
15822
16367
|
}
|
|
@@ -15852,7 +16397,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15852
16397
|
farmNavigationPlugin(config.renderer),
|
|
15853
16398
|
farmIslandContainersPlugin(config),
|
|
15854
16399
|
farmPlugin(config, pluginManager),
|
|
15855
|
-
|
|
16400
|
+
_chunkRTAWQXMEcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
15856
16401
|
],
|
|
15857
16402
|
mode: "production"
|
|
15858
16403
|
});
|
|
@@ -15880,13 +16425,13 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15880
16425
|
define: {
|
|
15881
16426
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
15882
16427
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
15883
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
16428
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _397 => _397.env, 'optionalAccess', _398 => _398.public]) || {})
|
|
15884
16429
|
},
|
|
15885
16430
|
plugins: [
|
|
15886
16431
|
farmI18nClientBridgePlugin(),
|
|
15887
16432
|
farmIslandContainersPlugin(config),
|
|
15888
16433
|
farmPlugin(config, pluginManager),
|
|
15889
|
-
|
|
16434
|
+
_chunkRTAWQXMEcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
15890
16435
|
],
|
|
15891
16436
|
mode: "production"
|
|
15892
16437
|
});
|
|
@@ -15914,7 +16459,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15914
16459
|
if (pluginManager) {
|
|
15915
16460
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
15916
16461
|
}
|
|
15917
|
-
const outputDir =
|
|
16462
|
+
const outputDir = _chunkUOMSGJHKcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
15918
16463
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
15919
16464
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
15920
16465
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -15985,7 +16530,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15985
16530
|
root,
|
|
15986
16531
|
preset,
|
|
15987
16532
|
distDir,
|
|
15988
|
-
outputDir:
|
|
16533
|
+
outputDir: _chunkUOMSGJHKcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
15989
16534
|
});
|
|
15990
16535
|
}
|
|
15991
16536
|
}
|