@farm.js/core 0.1.67 → 0.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp.d-BFu9xHAi.d.ts → agent-mcp.d-Uh5xr7aX.d.ts} +1 -1
- package/dist/{agent-mcp.d-DWyWkTSy.d.mts → agent-mcp.d-wkVPK1GA.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +5 -3
- package/dist/agent-runtime.d.ts +5 -3
- package/dist/{analyzer-TTIIXXMQ.mjs → analyzer-CQDU7E3Y.mjs} +2 -2
- package/dist/analyzer-PPAHM4AW.cjs +16 -0
- package/dist/api/node.d.mts +7 -5
- package/dist/api/node.d.ts +7 -5
- package/dist/api/route-manager.d.mts +7 -5
- package/dist/api/route-manager.d.ts +7 -5
- package/dist/api/runtime.d.mts +6 -4
- package/dist/api/runtime.d.ts +6 -4
- package/dist/api.d.mts +8 -6
- package/dist/api.d.ts +8 -6
- package/dist/{app-manifest.d-CwfhGrVR.d.ts → app-manifest.d-BT5i2F-o.d.ts} +1 -1
- package/dist/{app-manifest.d-CRmjN5j9.d.mts → app-manifest.d-Dd4q5CFx.d.mts} +1 -1
- package/dist/app-markdown.cjs +3 -3
- package/dist/app-markdown.d.mts +10 -10
- package/dist/app-markdown.d.ts +10 -10
- package/dist/app-markdown.mjs +2 -2
- package/dist/{app.d-BX9LVTiP.d.ts → app.d-BVOpL_f2.d.ts} +6 -6
- package/dist/{app.d-uBBUxwyV.d.mts → app.d-BhiDXex_.d.mts} +6 -6
- package/dist/{chunk-23PVOIPT.cjs → chunk-225APHKC.cjs} +3 -3
- package/dist/{chunk-4JX3M4C6.cjs → chunk-23VJEGKC.cjs} +2 -1
- package/dist/{chunk-Q37INCXG.cjs → chunk-3EEINK7G.cjs} +11 -2
- package/dist/{chunk-BRWIVOV4.cjs → chunk-3GNHJ3RN.cjs} +10 -8
- package/dist/{chunk-QJVW76JG.mjs → chunk-3Y52TWYU.mjs} +2 -2
- package/dist/{chunk-OB3IFUK6.cjs → chunk-437QZIC2.cjs} +4 -4
- package/dist/{chunk-WGHY3OL5.mjs → chunk-4UAQB5LB.mjs} +232 -49
- package/dist/{chunk-JWSI5WO4.mjs → chunk-4ZXKYCYK.mjs} +1 -1
- package/dist/{chunk-N35YPV4N.mjs → chunk-57QAQU4F.mjs} +9 -7
- package/dist/{chunk-AQDLVHNF.mjs → chunk-5FBZJJGA.mjs} +17 -0
- package/dist/{chunk-PL6RTBDE.cjs → chunk-5JKDFRTK.cjs} +2 -2
- package/dist/{chunk-CO3YMZFD.mjs → chunk-6OFOIMNS.mjs} +1 -1
- package/dist/{chunk-556H7JCE.cjs → chunk-7LK5CTUM.cjs} +14 -14
- package/dist/{chunk-E6CD45JK.mjs → chunk-A3T445WK.mjs} +19 -5
- package/dist/{chunk-DQJ2CIH7.cjs → chunk-ASYOWPSR.cjs} +2 -1
- package/dist/{chunk-QGJ4FI2G.mjs → chunk-C6HGUTXB.mjs} +113 -29
- package/dist/{chunk-IRA2CZAY.mjs → chunk-CRVSYDHV.mjs} +2 -2
- package/dist/{chunk-XNZWMXCF.mjs → chunk-DIXFKAPM.mjs} +183 -76
- package/dist/{chunk-QGQP6QKO.cjs → chunk-DWLNLU55.cjs} +2 -2
- package/dist/{chunk-52Y3C3HG.mjs → chunk-E7VF3LQ5.mjs} +3 -2
- package/dist/{chunk-N5DQMOAG.cjs → chunk-F36LS2C7.cjs} +273 -90
- package/dist/{chunk-H37MDCPR.mjs → chunk-F6CMGWAL.mjs} +1 -1
- package/dist/{chunk-HNVAZGQD.cjs → chunk-FJMC24KG.cjs} +2 -2
- package/dist/{chunk-KCY52OUQ.cjs → chunk-FSODPZRT.cjs} +1 -1
- package/dist/{chunk-PPX7UOFY.cjs → chunk-FVYBEMOD.cjs} +55 -38
- package/dist/{chunk-6YBYX4K4.mjs → chunk-G7NBPP7H.mjs} +1 -1
- package/dist/{chunk-HFHJJXSV.mjs → chunk-GFPS7MNE.mjs} +1 -1
- package/dist/{chunk-3T5TLFCQ.mjs → chunk-HEJM46HQ.mjs} +11 -2
- package/dist/chunk-HHLEYA4B.cjs +17 -0
- package/dist/{chunk-F43OG25P.cjs → chunk-I7J5RLGO.cjs} +15 -1
- package/dist/chunk-ICFPTHXM.mjs +97 -0
- package/dist/{chunk-6V5YWI4W.cjs → chunk-IGDYL2IA.cjs} +2 -2
- package/dist/{chunk-TEG6HJVF.mjs → chunk-JL2YW5KX.mjs} +1 -0
- package/dist/{chunk-JVM3DKZE.mjs → chunk-KDO6T6OB.mjs} +1 -1
- package/dist/{chunk-QITSS4TD.cjs → chunk-KWCZKJYU.cjs} +352 -245
- package/dist/{chunk-DCXSIEFE.cjs → chunk-LDEXTX4I.cjs} +51 -37
- package/dist/{chunk-3T7ALZJF.cjs → chunk-LR4KP3I7.cjs} +2 -2
- package/dist/{chunk-VFXE6NWR.mjs → chunk-MGKWYPE3.mjs} +2 -1
- package/dist/{chunk-5TA63JD3.mjs → chunk-MGZVDX4R.mjs} +1 -1
- package/dist/{chunk-6SQZXRJ2.cjs → chunk-MMDKYJ5V.cjs} +7 -7
- package/dist/{chunk-HP2DQGQH.mjs → chunk-MNJDNTGO.mjs} +1 -1
- package/dist/{chunk-5Y2P454O.cjs → chunk-MTBDJ326.cjs} +6 -5
- package/dist/{chunk-XUES6OET.mjs → chunk-MV7NWU23.mjs} +1 -1
- package/dist/{chunk-4DRINDGN.cjs → chunk-MZ4CRSY7.cjs} +254 -125
- package/dist/{chunk-4IHMHFQB.cjs → chunk-NG2EZ6QS.cjs} +28 -1
- package/dist/{chunk-WDD5CTZW.mjs → chunk-NT4W4H52.mjs} +6 -6
- package/dist/{chunk-F7JKVHU2.mjs → chunk-NVOMQLI2.mjs} +15 -1
- package/dist/{chunk-22IWL4YD.cjs → chunk-OCNV4CI2.cjs} +21 -2
- package/dist/{chunk-72KCTHLV.cjs → chunk-PRL7FXG4.cjs} +113 -29
- package/dist/{chunk-YVTS3S3F.cjs → chunk-QOGIZKSO.cjs} +3 -3
- package/dist/{chunk-DB2HSHQA.cjs → chunk-QSUYB3RH.cjs} +14 -14
- package/dist/chunk-QYNZ3CTI.mjs +17 -0
- package/dist/{chunk-724MGMIL.mjs → chunk-R2ZHU37O.mjs} +19 -0
- package/dist/{chunk-YQYTQJZN.mjs → chunk-RLH5AH2M.mjs} +1 -1
- package/dist/{chunk-HM7AGSKU.cjs → chunk-SQ6IWJ3H.cjs} +1 -1
- package/dist/{chunk-V5MQMQ2P.mjs → chunk-T5XFZQCL.mjs} +1 -1
- package/dist/{chunk-Q5UX55YA.cjs → chunk-TNK2TVRS.cjs} +831 -470
- package/dist/{chunk-J7JHVCWA.cjs → chunk-UKZ6AWKZ.cjs} +2 -1
- package/dist/{chunk-V5RTHYJB.cjs → chunk-URN7VFO7.cjs} +91 -22
- package/dist/{chunk-HRPTMX5C.mjs → chunk-VFNAK6A5.mjs} +2 -2
- package/dist/{chunk-VK54PDQ6.mjs → chunk-VRGY3X2I.mjs} +86 -17
- package/dist/chunk-W44X6IC2.cjs +97 -0
- package/dist/{chunk-GTV2ABO7.mjs → chunk-WPB67LE5.mjs} +162 -33
- package/dist/{chunk-UHE5JUKB.mjs → chunk-XCAQTCGK.mjs} +1 -1
- package/dist/{chunk-DGOFR7D5.cjs → chunk-Y6KHPJDB.cjs} +2 -2
- package/dist/{chunk-LPIZMU7D.cjs → chunk-YTNBCXCW.cjs} +4 -4
- package/dist/{chunk-KWFNUODD.mjs → chunk-YVPX5PI5.mjs} +1 -0
- package/dist/{chunk-6R53ZWX2.cjs → chunk-Z3PW3DIR.cjs} +3 -3
- package/dist/{chunk-UHNSY2PQ.mjs → chunk-Z6SOXHAD.mjs} +772 -411
- package/dist/{chunk-5FE5YT2N.mjs → chunk-ZZGQD3LL.mjs} +28 -1
- package/dist/{client-component.d-CDRvRmbU.d.mts → client-component.d-BvQOxSqh.d.mts} +2 -2
- package/dist/{client-component.d-DWRKyAp5.d.ts → client-component.d-DNVSLEPi.d.ts} +2 -2
- package/dist/{client-plugins.d-BNILjfX3.d.mts → client-plugins.d-CE1lVK2R.d.mts} +23 -234
- package/dist/{client-plugins.d-CrKZiNSN.d.ts → client-plugins.d-CNDqcAuf.d.ts} +23 -234
- package/dist/client-plugins.d.mts +5 -3
- package/dist/client-plugins.d.ts +5 -3
- package/dist/client.cjs +6 -6
- package/dist/client.d.mts +10 -8
- package/dist/client.d.ts +10 -8
- package/dist/client.mjs +5 -5
- package/dist/config.d.mts +5 -3
- package/dist/config.d.ts +5 -3
- package/dist/deployment.cjs +4 -2
- package/dist/deployment.d.mts +15 -1
- package/dist/deployment.d.ts +15 -1
- package/dist/deployment.mjs +3 -1
- package/dist/desktop.d.mts +6 -4
- package/dist/desktop.d.ts +6 -4
- package/dist/{devtools-UFQYT3VA.mjs → devtools-2A2GPC7B.mjs} +6 -6
- package/dist/{devtools-RZVT4JVN.cjs → devtools-R27T3BRY.cjs} +7 -7
- package/dist/docs.cjs +9 -9
- package/dist/docs.d.mts +6 -4
- package/dist/docs.d.ts +6 -4
- package/dist/docs.mjs +8 -8
- package/dist/environment/vite.cjs +5 -5
- package/dist/environment/vite.d.mts +1 -1
- package/dist/environment/vite.d.ts +1 -1
- package/dist/environment/vite.mjs +4 -4
- package/dist/{generate-route-types.d-BL2pq6xC.d.ts → generate-route-types.d-B76M5R11.d.ts} +1 -1
- package/dist/{generate-route-types.d-BoVDU8qX.d.mts → generate-route-types.d-CaGMIaNI.d.mts} +1 -1
- package/dist/index.cjs +41 -36
- package/dist/{index.d-Bdm6866n.d.mts → index.d-Bt3kl19W.d.mts} +1 -1
- package/dist/{index.d-Dey5T14f.d.ts → index.d-Cx_-DaKV.d.ts} +1 -1
- package/dist/index.d.mts +25 -22
- package/dist/index.d.ts +25 -22
- package/dist/index.mjs +43 -38
- package/dist/instrumentation.cjs +3 -3
- package/dist/instrumentation.mjs +2 -2
- package/dist/integrations/orm.d.mts +5 -3
- package/dist/integrations/orm.d.ts +5 -3
- package/dist/integrations.d.mts +5 -3
- package/dist/integrations.d.ts +5 -3
- package/dist/internal/app-markdown-runtime.cjs +2 -2
- package/dist/internal/app-markdown-runtime.d.mts +12 -5
- package/dist/internal/app-markdown-runtime.d.ts +12 -5
- package/dist/internal/app-markdown-runtime.mjs +1 -1
- package/dist/internal/build-runtime.cjs +33 -30
- package/dist/internal/build-runtime.d.mts +7 -5
- package/dist/internal/build-runtime.d.ts +7 -5
- package/dist/internal/build-runtime.mjs +32 -29
- package/dist/internal/cli-runtime.cjs +10 -10
- package/dist/internal/cli-runtime.mjs +9 -9
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +31 -36
- package/dist/internal/client-runtime.d.mts +8 -6
- package/dist/internal/client-runtime.d.ts +8 -6
- package/dist/internal/client-runtime.mjs +22 -27
- package/dist/internal/compression-runtime.d.mts +5 -3
- package/dist/internal/compression-runtime.d.ts +5 -3
- package/dist/internal/config-runtime.cjs +8 -8
- package/dist/internal/config-runtime.d.mts +9 -7
- package/dist/internal/config-runtime.d.ts +9 -7
- package/dist/internal/config-runtime.mjs +7 -7
- package/dist/internal/form-actions.cjs +7 -2
- package/dist/internal/form-actions.d.mts +10 -3
- package/dist/internal/form-actions.d.ts +10 -3
- package/dist/internal/form-actions.mjs +8 -3
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-boot.cjs +6 -1
- package/dist/internal/islands-boot.mjs +6 -1
- 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 +4 -2
- package/dist/internal/production-node-env.d.mts +22 -1
- package/dist/internal/production-node-env.d.ts +22 -1
- package/dist/internal/production-node-env.mjs +3 -1
- package/dist/internal/production-runtime.cjs +13 -9
- package/dist/internal/production-runtime.d.mts +21 -16
- package/dist/internal/production-runtime.d.ts +21 -16
- package/dist/internal/production-runtime.mjs +13 -9
- package/dist/internal/server-tree.cjs +2 -2
- package/dist/internal/server-tree.d.mts +0 -5
- package/dist/internal/server-tree.d.ts +0 -5
- package/dist/internal/server-tree.mjs +1 -1
- package/dist/internal/vercel-edge-middleware.cjs +87 -0
- package/dist/internal/vercel-edge-middleware.d.mts +39 -0
- package/dist/internal/vercel-edge-middleware.d.ts +39 -0
- package/dist/internal/vercel-edge-middleware.mjs +87 -0
- package/dist/layers-7P4RLKVX.cjs +20 -0
- package/dist/{layers-T55SA47E.mjs → layers-XQ7VFMWO.mjs} +4 -2
- package/dist/{layers.d-CcS42OGR.d.mts → layers.d-CH0bC4QL.d.mts} +2 -1
- package/dist/{layers.d-CcS42OGR.d.ts → layers.d-CH0bC4QL.d.ts} +2 -1
- package/dist/markdown.d.mts +5 -3
- package/dist/markdown.d.ts +5 -3
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +8 -5
- package/dist/middleware.d.ts +8 -5
- package/dist/middleware.mjs +6 -6
- package/dist/mobile.d.mts +4 -4
- package/dist/mobile.d.ts +4 -4
- package/dist/{mount.d-BP0nLYQO.d.mts → mount.d-Bki4pOaJ.d.mts} +1 -1
- package/dist/{mount.d-CkiPky_F.d.ts → mount.d-DjR5aerM.d.ts} +1 -1
- package/dist/{navigation-delegate.d-DchcGzAQ.d.ts → navigation-delegate.d-CtghaSP3.d.ts} +1 -1
- package/dist/{navigation-delegate.d-CdBP-hkZ.d.mts → navigation-delegate.d-VDkziXTK.d.mts} +1 -1
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +8 -6
- package/dist/navigation.d.ts +8 -6
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-55YOZWRA.mjs → nitro-NSTXT7LB.mjs} +2 -2
- package/dist/{nitro-EEX2J3KB.cjs → nitro-Y3LGITW3.cjs} +4 -4
- package/dist/node-module-bundle-LIZ2KMVW.cjs +13 -0
- package/dist/node-module-bundle-VR6NV6AI.mjs +13 -0
- package/dist/plugin.cjs +20 -20
- package/dist/plugin.d.mts +7 -5
- package/dist/plugin.d.ts +7 -5
- package/dist/plugin.mjs +19 -19
- package/dist/{production-runtime.d-Dou_Htas.d.ts → production-runtime.d-BMyyLGBB.d.ts} +3 -57
- package/dist/{production-runtime.d-VwsBzIee.d.mts → production-runtime.d-DMZY3OgV.d.mts} +3 -57
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan.d-LKymStDJ.d.mts → render-plan.d-BSwV8PE4.d.mts} +1 -1
- package/dist/{render-plan.d-D8UakAIk.d.ts → render-plan.d-i9sI4tc9.d.ts} +1 -1
- package/dist/renderer/react/server.cjs +2 -2
- package/dist/renderer/react/server.mjs +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +8 -6
- package/dist/renderer-client.d.ts +8 -6
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +5 -0
- package/dist/renderer.d.ts +5 -0
- package/dist/{request.d-KG-4d2eG.d.mts → request.d-C24FNQ_7.d.mts} +1 -1
- package/dist/{request.d-B928QjWy.d.ts → request.d-Dgln8tuI.d.ts} +1 -1
- package/dist/request.d.mts +6 -4
- package/dist/request.d.ts +6 -4
- package/dist/{route-rendering.d-DoEe_w9t.d.ts → route-rendering.d-CUylZKJA.d.ts} +1 -1
- package/dist/{route-rendering.d-NIHQeb4m.d.mts → route-rendering.d-Ds0BfwQi.d.mts} +1 -1
- package/dist/{router.d-DYnRHQwz.d.ts → router.d-B56rMOFm.d.ts} +1 -1
- package/dist/{router.d-B8PkJSGp.d.mts → router.d-CFPcbqzc.d.mts} +1 -1
- package/dist/{routes.d-uUBZyWoK.d.ts → routes.d-9GFFNioh.d.ts} +1 -1
- package/dist/{routes.d-DgZ_jgGG.d.mts → routes.d-CrEy0lJS.d.mts} +1 -1
- package/dist/routes.d.mts +5 -3
- package/dist/routes.d.ts +5 -3
- package/dist/{rsc-pipeline-7K5H2RPH.cjs → rsc-pipeline-3T7V6OUT.cjs} +10 -9
- package/dist/{rsc-pipeline-4OJ5ZQNZ.mjs → rsc-pipeline-GA4AQWZI.mjs} +9 -8
- package/dist/{runtime-X52Q7JFR.cjs → runtime-REUTNTI5.cjs} +20 -20
- package/dist/{runtime-U7O3HZOZ.mjs → runtime-ZYCKKY7L.mjs} +12 -12
- package/dist/{runtime.d-BxQIzwfy.d.mts → runtime.d-DLRO-ExG.d.mts} +1 -1
- package/dist/{runtime.d-DP7mEkEF.d.ts → runtime.d-H7k9hOQE.d.ts} +1 -1
- package/dist/server-http.d-rAe7lAQc.d.mts +70 -0
- package/dist/server-http.d-rAe7lAQc.d.ts +70 -0
- package/dist/server-plugins.d.mts +6 -4
- package/dist/server-plugins.d.ts +6 -4
- package/dist/server.cjs +46 -44
- package/dist/server.d-C5FFrZAo.d.ts +57 -0
- package/dist/server.d-DgC8xew5.d.mts +57 -0
- package/dist/server.d.mts +13 -11
- package/dist/server.d.ts +13 -11
- package/dist/server.mjs +28 -26
- package/dist/{spa-router.d-DsFDHTsv.d.ts → spa-router.d-Dr7oanhl.d.ts} +2 -2
- package/dist/{spa-router.d-BgHPVMhz.d.mts → spa-router.d-g4CzhEH1.d.mts} +2 -2
- package/dist/testing.d.mts +5 -3
- package/dist/testing.d.ts +5 -3
- package/dist/types.d-xCIhyjOq.d.mts +233 -0
- package/dist/types.d-xCIhyjOq.d.ts +233 -0
- package/dist/{utils.d-zxAVcf_V.d.ts → utils.d-BxxyDEb8.d.ts} +1 -1
- package/dist/{utils.d-BKyKDBR1.d.mts → utils.d-HIla3pD_.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +20 -20
- package/dist/vite.d.mts +10 -8
- package/dist/vite.d.ts +10 -8
- package/dist/vite.mjs +19 -19
- package/dist/workflows.cjs +2 -2
- package/dist/workflows.d.mts +121 -1
- package/dist/workflows.d.ts +121 -1
- package/dist/workflows.mjs +1 -1
- package/package.json +7 -2
- package/dist/analyzer-KVZGVY5Q.cjs +0 -16
- package/dist/chunk-CLFEQGET.cjs +0 -60
- package/dist/chunk-MK5E44WP.mjs +0 -60
- package/dist/layers-DMRXRL7F.cjs +0 -18
- package/dist/node-module-bundle-7JHPPF6B.mjs +0 -11
- package/dist/node-module-bundle-YJGYBOGK.cjs +0 -11
- package/dist/workflows.d-CRMzQZ3k.d.mts +0 -188
- package/dist/workflows.d-CRMzQZ3k.d.ts +0 -188
|
@@ -74,16 +74,25 @@ async function evaluateMdxSource(source, filePath) {
|
|
|
74
74
|
}
|
|
75
75
|
function createFarmMarkdownRouteModule(input) {
|
|
76
76
|
const { body } = parseMarkdownFrontmatter(input.source);
|
|
77
|
-
const components = input.components || {};
|
|
78
77
|
const className = _optionalChain([input, 'access', _6 => _6.config, 'optionalAccess', _7 => _7.className]) || "farm-markdown";
|
|
79
78
|
let evaluatedPromise;
|
|
79
|
+
let componentsPromise;
|
|
80
80
|
const loadContent = async () => {
|
|
81
81
|
_nullishCoalesce(evaluatedPromise, () => ( (evaluatedPromise = evaluateMdxSource(body, input.filePath))));
|
|
82
82
|
return evaluatedPromise;
|
|
83
83
|
};
|
|
84
|
+
const loadComponents = () => {
|
|
85
|
+
const configured = input.components;
|
|
86
|
+
if (typeof configured !== "function") return configured || {};
|
|
87
|
+
_nullishCoalesce(componentsPromise, () => ( (componentsPromise = configured().catch((error) => {
|
|
88
|
+
componentsPromise = void 0;
|
|
89
|
+
throw error;
|
|
90
|
+
}))));
|
|
91
|
+
return componentsPromise;
|
|
92
|
+
};
|
|
84
93
|
async function FarmMarkdownPage(props) {
|
|
85
94
|
const { createElement } = await import("react");
|
|
86
|
-
const evaluated = await loadContent();
|
|
95
|
+
const [evaluated, components] = await Promise.all([loadContent(), loadComponents()]);
|
|
87
96
|
const MDXContent = evaluated.default;
|
|
88
97
|
return createElement(
|
|
89
98
|
"article",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkASYOWPSRcjs = require('./chunk-ASYOWPSR.cjs');
|
|
4
4
|
|
|
5
5
|
// src/instrumentation.ts
|
|
6
6
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -9,12 +9,14 @@ var _url = require('url');
|
|
|
9
9
|
var INSTRUMENTATION_EXTENSIONS = ["ts", "mts", "js", "mjs"];
|
|
10
10
|
function resolveFarmInstrumentationFile(root, srcDir = "src") {
|
|
11
11
|
const candidates = [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
.../* @__PURE__ */ new Set([
|
|
13
|
+
...INSTRUMENTATION_EXTENSIONS.map(
|
|
14
|
+
(extension) => _path2.default.join(root, srcDir, `instrumentation.${extension}`)
|
|
15
|
+
),
|
|
16
|
+
...INSTRUMENTATION_EXTENSIONS.map(
|
|
17
|
+
(extension) => _path2.default.join(root, `instrumentation.${extension}`)
|
|
18
|
+
)
|
|
19
|
+
])
|
|
18
20
|
].filter((candidate) => _fs2.default.existsSync(candidate));
|
|
19
21
|
if (candidates.length > 1) {
|
|
20
22
|
throw new Error(
|
|
@@ -30,7 +32,7 @@ async function loadFarmInstrumentation(filePath, root) {
|
|
|
30
32
|
const outputDirectory = _path2.default.join(root, ".farm", ".instrumentation-loader");
|
|
31
33
|
const outputFile = _path2.default.join(outputDirectory, "instrumentation.mjs");
|
|
32
34
|
await _fs2.default.promises.mkdir(outputDirectory, { recursive: true });
|
|
33
|
-
await
|
|
35
|
+
await _chunkASYOWPSRcjs.bundleNodeModule.call(void 0, {
|
|
34
36
|
root,
|
|
35
37
|
entry: filePath,
|
|
36
38
|
outfile: outputFile,
|
|
@@ -93,7 +93,7 @@ function formatFarmRscBlockingMessage(blockingKeys) {
|
|
|
93
93
|
var warnedFallback = false;
|
|
94
94
|
async function resolveFarmRscCheckConfig(config, root, mode) {
|
|
95
95
|
if (!config?.extends) return config;
|
|
96
|
-
const { resolveFarmLayers } = await import("./layers-
|
|
96
|
+
const { resolveFarmLayers } = await import("./layers-XQ7VFMWO.mjs");
|
|
97
97
|
return (await resolveFarmLayers(config, { root, mode })).config;
|
|
98
98
|
}
|
|
99
99
|
function farmAppUsesRscPipeline(config, root) {
|
|
@@ -127,7 +127,7 @@ function formatFarmRscIgnoredMessage(ignoredKeys) {
|
|
|
127
127
|
}
|
|
128
128
|
if (others.length < ignoredKeys.length) {
|
|
129
129
|
clauses.push(
|
|
130
|
-
"runs only the browser `client` hooks of `plugins` and ignores their other hooks."
|
|
130
|
+
"runs only the `configure` and browser `client` hooks of `plugins` and ignores their other hooks."
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
133
|
return `experimental.serverComponents runs on the RSC pipeline, which ${clauses.join(" It also ")}`;
|
|
@@ -29,7 +29,7 @@ var _chunkCQL5ZGFUcjs = require('./chunk-CQL5ZGFU.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkI7J5RLGOcjs = require('./chunk-I7J5RLGO.cjs');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
|
|
@@ -687,7 +687,7 @@ var SPARouter = class {
|
|
|
687
687
|
async requestPageData(path, recover, interceptFrom, activeLayoutChain, signal, cacheData, resolvePrefetch) {
|
|
688
688
|
const response = await fetch(`/__farm/page-data?path=${encodeURIComponent(path)}`, {
|
|
689
689
|
signal,
|
|
690
|
-
headers:
|
|
690
|
+
headers: _chunkI7J5RLGOcjs.createFarmDeploymentRequestHeaders.call(void 0, this.options.deploymentId, {
|
|
691
691
|
Accept: "application/x-farm-deferred+json, application/json",
|
|
692
692
|
"X-Farm-SPA": "1",
|
|
693
693
|
...activeLayoutChain ? { "X-Farm-Layout-Chain": activeLayoutChain } : {},
|
|
@@ -696,8 +696,8 @@ var SPARouter = class {
|
|
|
696
696
|
..._chunkCQL5ZGFUcjs.getFarmIslandValueHeaders.call(void 0, )
|
|
697
697
|
})
|
|
698
698
|
});
|
|
699
|
-
if (
|
|
700
|
-
const error =
|
|
699
|
+
if (_chunkI7J5RLGOcjs.isFarmDeploymentMismatchResponse.call(void 0, response, this.options.deploymentId)) {
|
|
700
|
+
const error = _chunkI7J5RLGOcjs.createFarmDeploymentMismatchError.call(void 0,
|
|
701
701
|
response,
|
|
702
702
|
this.options.deploymentId || "unknown"
|
|
703
703
|
);
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
resolveFarmAppClientEntry,
|
|
3
3
|
resolveFarmClientPlugins
|
|
4
4
|
} from "./chunk-DXZ57EPE.mjs";
|
|
5
|
+
import {
|
|
6
|
+
resolveFarmPlatform
|
|
7
|
+
} from "./chunk-SMUW7UST.mjs";
|
|
5
8
|
import {
|
|
6
9
|
collectSSGPages,
|
|
7
10
|
matchSSGPage,
|
|
8
11
|
resolveRouteRenderingConfigFromFile
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-G7NBPP7H.mjs";
|
|
10
13
|
import {
|
|
11
14
|
createFarmMetadataImageResponse
|
|
12
15
|
} from "./chunk-CROAFCMW.mjs";
|
|
13
|
-
import {
|
|
14
|
-
resolveFarmPlatform
|
|
15
|
-
} from "./chunk-SMUW7UST.mjs";
|
|
16
16
|
import {
|
|
17
17
|
classifyFarmDocumentPrefix,
|
|
18
18
|
composeFarmFullDocument,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
} from "./chunk-ZPKJPM7K.mjs";
|
|
43
43
|
import {
|
|
44
44
|
listFarmMCPLlmsTxtLinks
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-VFNAK6A5.mjs";
|
|
46
46
|
import {
|
|
47
47
|
FARM_DEFAULT_MCP_PATH,
|
|
48
48
|
collectFarmDefaultMCPPages,
|
|
@@ -52,8 +52,10 @@ import {
|
|
|
52
52
|
resolveFarmDefaultMCPServer
|
|
53
53
|
} from "./chunk-K6SXMVXO.mjs";
|
|
54
54
|
import {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
getFarmFormState,
|
|
56
|
+
handleFarmFormActionRequest,
|
|
57
|
+
renderFarmFormStateScript
|
|
58
|
+
} from "./chunk-ICFPTHXM.mjs";
|
|
57
59
|
import {
|
|
58
60
|
installFarmIslandValues,
|
|
59
61
|
uninstallFarmIslandValues
|
|
@@ -74,7 +76,7 @@ import {
|
|
|
74
76
|
resolveProgrammaticClientRoutes,
|
|
75
77
|
runWithPackageClientBoundaryCacheFile,
|
|
76
78
|
usesFarmServerTree
|
|
77
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-WPB67LE5.mjs";
|
|
78
80
|
import {
|
|
79
81
|
FARM_ISLAND_REPLAYABLE_SELECTOR
|
|
80
82
|
} from "./chunk-S32PDOLO.mjs";
|
|
@@ -91,7 +93,7 @@ import {
|
|
|
91
93
|
} from "./chunk-TPA2PV5J.mjs";
|
|
92
94
|
import {
|
|
93
95
|
normalizeRouteRules
|
|
94
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-R2ZHU37O.mjs";
|
|
95
97
|
import {
|
|
96
98
|
resolveFarmDevtoolsConfig
|
|
97
99
|
} from "./chunk-CU5SYTJG.mjs";
|
|
@@ -126,7 +128,7 @@ import {
|
|
|
126
128
|
import {
|
|
127
129
|
getFarmAppDirectories,
|
|
128
130
|
getFarmSourceRoots
|
|
129
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-E7VF3LQ5.mjs";
|
|
130
132
|
import {
|
|
131
133
|
assertFarmRendererStreamingRuntime,
|
|
132
134
|
getFarmRendererCapabilities,
|
|
@@ -152,10 +154,10 @@ import {
|
|
|
152
154
|
import {
|
|
153
155
|
createFarmMarkdownRouteModuleFromFile,
|
|
154
156
|
loadFarmMdxComponents
|
|
155
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-MV7NWU23.mjs";
|
|
156
158
|
import {
|
|
157
159
|
isFarmMarkdownPageFile
|
|
158
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-HEJM46HQ.mjs";
|
|
159
161
|
import {
|
|
160
162
|
resolveFarmMdxComponentsModulePath,
|
|
161
163
|
resolveMdxConfig
|
|
@@ -171,7 +173,7 @@ import {
|
|
|
171
173
|
} from "./chunk-IFR74W6S.mjs";
|
|
172
174
|
import {
|
|
173
175
|
resolveWorkflowsConfig
|
|
174
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-MGZVDX4R.mjs";
|
|
175
177
|
import {
|
|
176
178
|
resolveFarmThemeConfig
|
|
177
179
|
} from "./chunk-YWPNIYUP.mjs";
|
|
@@ -276,11 +278,11 @@ import {
|
|
|
276
278
|
} from "./chunk-2DA7CLY7.mjs";
|
|
277
279
|
import {
|
|
278
280
|
FARM_VERSION
|
|
279
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-F6CMGWAL.mjs";
|
|
280
282
|
import {
|
|
281
283
|
resolveFarmTrailingSlashRedirect,
|
|
282
284
|
setFarmTrailingSlashPreference
|
|
283
|
-
} from "./chunk-
|
|
285
|
+
} from "./chunk-YVPX5PI5.mjs";
|
|
284
286
|
import {
|
|
285
287
|
normalizeFarmAPIConfig
|
|
286
288
|
} from "./chunk-W6QLRQ3V.mjs";
|
|
@@ -303,7 +305,7 @@ import {
|
|
|
303
305
|
import {
|
|
304
306
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
305
307
|
createFarmDeploymentCookie
|
|
306
|
-
} from "./chunk-
|
|
308
|
+
} from "./chunk-NVOMQLI2.mjs";
|
|
307
309
|
import {
|
|
308
310
|
prepareDeferredData,
|
|
309
311
|
snapshotDeferredData
|
|
@@ -1042,12 +1044,13 @@ var RouteManager = class {
|
|
|
1042
1044
|
}
|
|
1043
1045
|
if (isFarmMarkdownPageFile(modulePath)) {
|
|
1044
1046
|
const mdxConfig = resolveMdxConfig(this.config.mdx);
|
|
1045
|
-
const
|
|
1046
|
-
root: this.config.root,
|
|
1047
|
-
loadModule: this.viteServer ? (componentModulePath) => loadFarmDevModule(this.viteServer, componentModulePath) : void 0
|
|
1048
|
-
});
|
|
1047
|
+
const viteServer = this.viteServer;
|
|
1049
1048
|
return await createFarmMarkdownRouteModuleFromFile(modulePath, {
|
|
1050
|
-
|
|
1049
|
+
// Loaded on render: the route runtime manifest only reads metadata and rendering config.
|
|
1050
|
+
components: () => loadFarmMdxComponents(mdxConfig, {
|
|
1051
|
+
root: this.config.root,
|
|
1052
|
+
loadModule: viteServer ? (componentModulePath) => loadFarmDevModule(viteServer, componentModulePath) : void 0
|
|
1053
|
+
}),
|
|
1051
1054
|
config: mdxConfig
|
|
1052
1055
|
});
|
|
1053
1056
|
}
|
|
@@ -1487,12 +1490,12 @@ var RouteManager = class {
|
|
|
1487
1490
|
}
|
|
1488
1491
|
}
|
|
1489
1492
|
}
|
|
1490
|
-
/** The page routes
|
|
1493
|
+
/** The page routes the docs runtime answers before Farm's own page rendering. */
|
|
1491
1494
|
getDocsAdapterRoutes() {
|
|
1492
1495
|
const docs = this.config.docs;
|
|
1493
|
-
if (!docs || typeof docs !== "object" || !docs.enabled
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
+
if (!docs || typeof docs !== "object" || !docs.enabled) return void 0;
|
|
1497
|
+
const usesAdapter = Boolean(docs.adapter && docs.adapter.server && docs.adapter.react);
|
|
1498
|
+
if (usesAdapter && !isReactRenderer(this.config.renderer)) return void 0;
|
|
1496
1499
|
const entry = `/${String(docs.entry || "docs").replace(/^\/+|\/+$/g, "")}`;
|
|
1497
1500
|
return {
|
|
1498
1501
|
owns: (routePath) => entry === "/" || routePath === entry || routePath.startsWith(`${entry}/`),
|
|
@@ -2651,7 +2654,7 @@ function isFontLoaderKind(value) {
|
|
|
2651
2654
|
return typeof value === "string" && FONT_FUNCTIONS.has(value);
|
|
2652
2655
|
}
|
|
2653
2656
|
function containsFontFunction(code) {
|
|
2654
|
-
return Array.from(FONT_FUNCTIONS).some((name) => code.includes(name));
|
|
2657
|
+
return code.includes("@farm.js/core") && Array.from(FONT_FUNCTIONS).some((name) => code.includes(name));
|
|
2655
2658
|
}
|
|
2656
2659
|
function requireString(value, id, label) {
|
|
2657
2660
|
if (typeof value !== "string" || value.trim() === "") {
|
|
@@ -3355,7 +3358,7 @@ function createPPRRefreshScript() {
|
|
|
3355
3358
|
}
|
|
3356
3359
|
function createPreHydrationClickQueueScript() {
|
|
3357
3360
|
const selector = JSON.stringify(FARM_ISLAND_REPLAYABLE_SELECTOR);
|
|
3358
|
-
return `<script>(function(){if(window.__FARM_PREHYDRATION_CLICK_QUEUE__)return;var queue=[];window.__FARM_PREHYDRATION_CLICK_QUEUE__=queue;window.__FARM_HYDRATED__=false;document.documentElement.dataset.farmHydrated="false";function isModified(event){return !!(event.metaKey||event.altKey||event.ctrlKey||event.shiftKey)}function inHydrated(node){return !!(node&&node.closest&&node.closest('[data-farm-island-hydrated="true"]'))}function closestQueuedTarget(target){while(target&&target!==document.documentElement){if(target.matches&&target.matches(${selector}))return target;target=target.parentElement}return null}function announce(target,kind){document.dispatchEvent(new CustomEvent("farm:island-interaction",{detail:{target:target,kind:kind||null}}))}function hold(event,target,kind){if(!queue.some(function(item){return item.target===target})){queue.push({target:target,kind:kind,createdAt:Date.now()});announce(target,kind)}event.preventDefault();event.stopImmediatePropagation()}document.addEventListener("click",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented||event.button!==0||isModified(event))return;var target=closestQueuedTarget(event.target);if(!target||target.closest&&target.closest("a[href]")||inHydrated(target))return;hold(event,target,"click")},true);document.addEventListener("submit",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented)return;var form=event.target;if(!form||form.nodeName!=="FORM"||inHydrated(form))return;hold(event,form,"submit")},true);function observe(event){if(window.__FARM_HYDRATED__)return;var target=event.target;if(!(target&&target.closest)||inHydrated(target))return;announce(target,null)}document.addEventListener("pointerdown",observe,true);document.addEventListener("focusin",observe,true);})();</script>`;
|
|
3361
|
+
return `<script>(function(){if(window.__FARM_PREHYDRATION_CLICK_QUEUE__)return;var queue=[];window.__FARM_PREHYDRATION_CLICK_QUEUE__=queue;window.__FARM_HYDRATED__=false;document.documentElement.dataset.farmHydrated="false";function isModified(event){return !!(event.metaKey||event.altKey||event.ctrlKey||event.shiftKey)}function inHydrated(node){return !!(node&&node.closest&&node.closest('[data-farm-island-hydrated="true"]'))}function closestQueuedTarget(target){while(target&&target!==document.documentElement){if(target.matches&&target.matches(${selector}))return target;target=target.parentElement}return null}function announce(target,kind){document.dispatchEvent(new CustomEvent("farm:island-interaction",{detail:{target:target,kind:kind||null}}))}function submits(target,kind){return kind==="submit"||!!(target.form&&target.type==="submit")}function hold(event,target,kind){if(!(submits(target,kind)&&queue.some(function(item){return item.target===target}))){queue.push({target:target,kind:kind,createdAt:Date.now()});announce(target,kind)}event.preventDefault();event.stopImmediatePropagation()}document.addEventListener("click",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented||event.button!==0||isModified(event))return;var target=closestQueuedTarget(event.target);if(!target||target.closest&&target.closest("a[href]")||inHydrated(target))return;hold(event,target,"click")},true);document.addEventListener("submit",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented)return;var form=event.target;if(!form||form.nodeName!=="FORM"||inHydrated(form))return;hold(event,form,"submit")},true);function observe(event){if(window.__FARM_HYDRATED__)return;var target=event.target;if(!(target&&target.closest)||inHydrated(target))return;announce(target,null)}document.addEventListener("pointerdown",observe,true);document.addEventListener("focusin",observe,true);})();</script>`;
|
|
3359
3362
|
}
|
|
3360
3363
|
function rendererRenderOptions() {
|
|
3361
3364
|
const nonce = _resolveCurrentCspNonce();
|
|
@@ -3659,6 +3662,7 @@ var ServerRenderer = class {
|
|
|
3659
3662
|
writable.once("error", reject);
|
|
3660
3663
|
const stream = renderToPipeableStream(element, {
|
|
3661
3664
|
nonce: _resolveCurrentCspNonce(),
|
|
3665
|
+
formState: getFarmFormState(),
|
|
3662
3666
|
...inlineBoundaries ? {
|
|
3663
3667
|
progressiveChunkSize: Number.MAX_SAFE_INTEGER,
|
|
3664
3668
|
onAllReady() {
|
|
@@ -4200,7 +4204,12 @@ var ServerRenderer = class {
|
|
|
4200
4204
|
toMiddlewareMap(req.__FARM_MIDDLEWARE_CONTEXT__),
|
|
4201
4205
|
() => handleFarmFormActionRequest(
|
|
4202
4206
|
formActionRequest,
|
|
4203
|
-
resolveServerActionsConfig(this.config.serverActions)
|
|
4207
|
+
resolveServerActionsConfig(this.config.serverActions),
|
|
4208
|
+
// Before a rewrite, the URL the browser posted to.
|
|
4209
|
+
new URL(
|
|
4210
|
+
req.originalUrl ?? req.url ?? "/",
|
|
4211
|
+
formActionRequest.url
|
|
4212
|
+
).href
|
|
4204
4213
|
)
|
|
4205
4214
|
)
|
|
4206
4215
|
);
|
|
@@ -5803,7 +5812,7 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(
|
|
|
5803
5812
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
5804
5813
|
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(getRegisteredIntegrationAPIManifest())};
|
|
5805
5814
|
window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getFarmI18nClientSnapshot()) : "null"};
|
|
5806
|
-
</script
|
|
5815
|
+
</script>${renderFarmFormStateScript()}`;
|
|
5807
5816
|
const islandsOnlyPage = this.islandValues() && req.__FARM_PAGE_SHOULD_HYDRATE__ !== true && req.__FARM_LAYOUT_SHOULD_HYDRATE__ !== true && req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ !== true;
|
|
5808
5817
|
const rootStrategy = req.__FARM_ISLAND_STRATEGY__;
|
|
5809
5818
|
const waitingRoot = this.islandValues() && !islandsOnlyPage && req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ !== true && rootStrategy !== void 0 && rootStrategy !== "load" ? req.__FARM_LAYOUT_SHOULD_HYDRATE__ === true ? "root" : "__farm_page__" : null;
|
|
@@ -5842,6 +5851,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
5842
5851
|
const earlyClientScript = bootClient ? createFarmDevBootScript(waitingRoot, rootStrategy) : FARM_DEV_EARLY_CLIENT_SCRIPT;
|
|
5843
5852
|
const { pipe, abort } = renderToPipeableStream(streamRoot, {
|
|
5844
5853
|
nonce: cspNonce,
|
|
5854
|
+
formState: getFarmFormState(),
|
|
5845
5855
|
onShellReady() {
|
|
5846
5856
|
if (pendingNavigationError) {
|
|
5847
5857
|
abort?.(pendingNavigationError);
|
|
@@ -7069,6 +7079,83 @@ async function buildFarmTreeLayouts(layouts, params, source, options) {
|
|
|
7069
7079
|
}
|
|
7070
7080
|
`;
|
|
7071
7081
|
|
|
7082
|
+
// src/client/navigation-scripts.ts
|
|
7083
|
+
var FARM_NAVIGATION_SCRIPT_SOURCE = `// The nonce the page's Content Security Policy trusts: the one of the response that loaded the
|
|
7084
|
+
// document, read once, before a navigation adds scripts that carry another response's nonce.
|
|
7085
|
+
const farmDocumentScriptNonce = (function() {
|
|
7086
|
+
if (typeof document === "undefined") return "";
|
|
7087
|
+
const script = document.querySelector("script[data-farm-runtime]") || document.querySelector("script[nonce]");
|
|
7088
|
+
return (script && script.nonce) || "";
|
|
7089
|
+
})();
|
|
7090
|
+
|
|
7091
|
+
// A runnable copy of a script a navigation inserted as markup. A script its response nonced runs
|
|
7092
|
+
// with the page's nonce; one it left without a nonce stays without, so the policy still blocks it.
|
|
7093
|
+
function createFarmNavigationScript(script) {
|
|
7094
|
+
const freshScript = document.createElement("script");
|
|
7095
|
+
for (const attribute of Array.from(script.attributes)) {
|
|
7096
|
+
if (attribute.name !== "nonce") freshScript.setAttribute(attribute.name, attribute.value);
|
|
7097
|
+
}
|
|
7098
|
+
if (farmDocumentScriptNonce && (script.nonce || script.getAttribute("nonce"))) {
|
|
7099
|
+
freshScript.nonce = farmDocumentScriptNonce;
|
|
7100
|
+
}
|
|
7101
|
+
freshScript.textContent = script.textContent || "";
|
|
7102
|
+
return freshScript;
|
|
7103
|
+
}
|
|
7104
|
+
// React streams Suspense content after its fallback, in a hidden segment that a reveal script
|
|
7105
|
+
// ($RC for a boundary, $RS for a segment placeholder) moves into place. This makes the same moves
|
|
7106
|
+
// in a parsed page, before it goes on screen, and drops the calls it made, so the islands in that
|
|
7107
|
+
// content are where the swap looks for them (a refresh keeps them).
|
|
7108
|
+
function revealFarmStreamedContent(root) {
|
|
7109
|
+
const find = function(id) {
|
|
7110
|
+
return root.querySelector('[id="' + id.replace(/"/g, "") + '"]');
|
|
7111
|
+
};
|
|
7112
|
+
for (const script of Array.from(root.querySelectorAll("script:not([type]), script[type='text/javascript']"))) {
|
|
7113
|
+
const source = script.textContent || "";
|
|
7114
|
+
if (source.indexOf("$RC(") === -1 && source.indexOf("$RS(") === -1) continue;
|
|
7115
|
+
let rest = source;
|
|
7116
|
+
for (const call of source.matchAll(/\\$R([CS])\\("([^"]+)","([^"]+)"\\);?/g)) {
|
|
7117
|
+
const [text, kind, first, second] = call;
|
|
7118
|
+
if (kind === "S") {
|
|
7119
|
+
const segment = find(first);
|
|
7120
|
+
const placeholder = find(second);
|
|
7121
|
+
if (!segment || !placeholder) continue;
|
|
7122
|
+
while (segment.firstChild) placeholder.parentNode.insertBefore(segment.firstChild, placeholder);
|
|
7123
|
+
placeholder.remove();
|
|
7124
|
+
segment.remove();
|
|
7125
|
+
} else {
|
|
7126
|
+
const boundary = find(first);
|
|
7127
|
+
const segment = find(second);
|
|
7128
|
+
if (!boundary || !segment) continue;
|
|
7129
|
+
const parent = boundary.parentNode;
|
|
7130
|
+
const start = boundary.previousSibling;
|
|
7131
|
+
// The fallback goes, up to the boundary's closing comment (nested boundaries skipped).
|
|
7132
|
+
let node = boundary;
|
|
7133
|
+
let depth = 0;
|
|
7134
|
+
while (node) {
|
|
7135
|
+
if (node.nodeType === 8) {
|
|
7136
|
+
const data = node.data;
|
|
7137
|
+
if (data === "/$" || data === "/&") {
|
|
7138
|
+
if (depth === 0) break;
|
|
7139
|
+
depth--;
|
|
7140
|
+
} else if (data === "$" || data === "$?" || data === "$~" || data === "$!" || data === "&") {
|
|
7141
|
+
depth++;
|
|
7142
|
+
}
|
|
7143
|
+
}
|
|
7144
|
+
const next = node.nextSibling;
|
|
7145
|
+
parent.removeChild(node);
|
|
7146
|
+
node = next;
|
|
7147
|
+
}
|
|
7148
|
+
while (segment.firstChild) parent.insertBefore(segment.firstChild, node);
|
|
7149
|
+
segment.remove();
|
|
7150
|
+
if (start && start.nodeType === 8) start.data = "$";
|
|
7151
|
+
}
|
|
7152
|
+
rest = rest.replace(text, "");
|
|
7153
|
+
}
|
|
7154
|
+
script.textContent = rest;
|
|
7155
|
+
}
|
|
7156
|
+
}
|
|
7157
|
+
`;
|
|
7158
|
+
|
|
7072
7159
|
// src/client/navigation-stream-client.ts
|
|
7073
7160
|
var FARM_NAVIGATION_STREAM_READER_SOURCE = `// Reads a streamed navigation (F-Stream) up to the end of React's shell. \`next\` then resolves
|
|
7074
7161
|
// with each later flush as it ends, and null at the end; a document without a marker is all shell.
|
|
@@ -7113,10 +7200,95 @@ async function readFarmNavigationStream(body, flushToken) {
|
|
|
7113
7200
|
};
|
|
7114
7201
|
}`;
|
|
7115
7202
|
|
|
7116
|
-
// src/
|
|
7203
|
+
// src/client/refresh-fields.ts
|
|
7204
|
+
var FARM_REFRESH_FIELDS_SOURCE = `// The server-rendered fields of a tree: islands keep their own.
|
|
7205
|
+
function listFarmServerFields(root) {
|
|
7206
|
+
return Array.from(root.querySelectorAll("input, textarea, select")).filter(function(field) {
|
|
7207
|
+
return !field.closest("f-island");
|
|
7208
|
+
});
|
|
7209
|
+
}
|
|
7210
|
+
|
|
7211
|
+
// Reads the fields of a tree about to be replaced: their order, and which one has the focus.
|
|
7212
|
+
function captureFarmServerFields(root) {
|
|
7213
|
+
const fields = listFarmServerFields(root);
|
|
7214
|
+
const focused = fields.indexOf(document.activeElement);
|
|
7215
|
+
const field = fields[focused];
|
|
7216
|
+
let selection = null;
|
|
7217
|
+
try {
|
|
7218
|
+
if (field && typeof field.selectionStart === "number") {
|
|
7219
|
+
selection = [field.selectionStart, field.selectionEnd, field.selectionDirection];
|
|
7220
|
+
}
|
|
7221
|
+
} catch {}
|
|
7222
|
+
return { fields, focused, selection };
|
|
7223
|
+
}
|
|
7224
|
+
|
|
7225
|
+
function isSameFarmField(current, next) {
|
|
7226
|
+
return current.tagName === next.tagName &&
|
|
7227
|
+
current.type === next.type &&
|
|
7228
|
+
current.name === next.name &&
|
|
7229
|
+
current.id === next.id;
|
|
7230
|
+
}
|
|
7231
|
+
|
|
7232
|
+
// Gives the replacing tree's fields what the user changed in the replaced one, and the focus.
|
|
7233
|
+
function restoreFarmServerFields(captured, root) {
|
|
7234
|
+
const fields = listFarmServerFields(root);
|
|
7235
|
+
captured.fields.forEach(function(current, index) {
|
|
7236
|
+
const next = fields[index];
|
|
7237
|
+
if (!next || !isSameFarmField(current, next)) return;
|
|
7238
|
+
if (current.form && current.form.getAttribute("aria-busy") === "true") return;
|
|
7239
|
+
if (current.tagName === "SELECT") {
|
|
7240
|
+
const changed = Array.from(current.options).some(function(option) {
|
|
7241
|
+
return option.selected !== option.defaultSelected;
|
|
7242
|
+
});
|
|
7243
|
+
if (!changed) return;
|
|
7244
|
+
const values = new Set(Array.from(current.selectedOptions, function(option) {
|
|
7245
|
+
return option.value;
|
|
7246
|
+
}));
|
|
7247
|
+
Array.from(next.options).forEach(function(option) {
|
|
7248
|
+
option.selected = values.has(option.value);
|
|
7249
|
+
});
|
|
7250
|
+
} else if (current.type === "checkbox" || current.type === "radio") {
|
|
7251
|
+
if (current.checked !== current.defaultChecked) next.checked = current.checked;
|
|
7252
|
+
} else if (current.type !== "file" && current.value !== current.defaultValue) {
|
|
7253
|
+
next.value = current.value;
|
|
7254
|
+
}
|
|
7255
|
+
});
|
|
7256
|
+
const focused = fields[captured.focused];
|
|
7257
|
+
if (!focused || !isSameFarmField(captured.fields[captured.focused], focused)) return;
|
|
7258
|
+
focused.focus({ preventScroll: true });
|
|
7259
|
+
if (captured.selection) {
|
|
7260
|
+
try {
|
|
7261
|
+
focused.setSelectionRange(captured.selection[0], captured.selection[1], captured.selection[2]);
|
|
7262
|
+
} catch {}
|
|
7263
|
+
}
|
|
7264
|
+
}
|
|
7265
|
+
`;
|
|
7266
|
+
|
|
7267
|
+
// src/utils/hook-filters.ts
|
|
7117
7268
|
import { realpathSync as realpathSync2 } from "fs";
|
|
7118
|
-
import { createRequire as createRequire3 } from "module";
|
|
7119
7269
|
import path14 from "path";
|
|
7270
|
+
function escapeRegExp(value) {
|
|
7271
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7272
|
+
}
|
|
7273
|
+
function exactIdPattern(ids) {
|
|
7274
|
+
return new RegExp(`^(?:${ids.map(escapeRegExp).join("|")})(?:\\?.*)?$`);
|
|
7275
|
+
}
|
|
7276
|
+
function fileNamePattern(files) {
|
|
7277
|
+
const names = /* @__PURE__ */ new Set();
|
|
7278
|
+
for (const file of files) {
|
|
7279
|
+
names.add(path14.basename(file));
|
|
7280
|
+
try {
|
|
7281
|
+
names.add(path14.basename(realpathSync2(file)));
|
|
7282
|
+
} catch {
|
|
7283
|
+
}
|
|
7284
|
+
}
|
|
7285
|
+
return new RegExp(`(?:^|/)(?:${[...names].map(escapeRegExp).join("|")})(?:\\?.*)?$`);
|
|
7286
|
+
}
|
|
7287
|
+
|
|
7288
|
+
// src/docs/client-config.ts
|
|
7289
|
+
import { realpathSync as realpathSync3 } from "fs";
|
|
7290
|
+
import { createRequire as createRequire3 } from "module";
|
|
7291
|
+
import path15 from "path";
|
|
7120
7292
|
var parseAst3;
|
|
7121
7293
|
function propertyKeyName(property2) {
|
|
7122
7294
|
if (property2.computed) return void 0;
|
|
@@ -7129,7 +7301,7 @@ function redactFarmDocsClientConfig(code, filename) {
|
|
|
7129
7301
|
parseAst3 ?? (parseAst3 = createRequire3(typeof __filename === "string" ? __filename : import.meta.url)(
|
|
7130
7302
|
"rolldown/parseAst"
|
|
7131
7303
|
).parseAst);
|
|
7132
|
-
const extension =
|
|
7304
|
+
const extension = path15.extname(filename);
|
|
7133
7305
|
const program = parseAst3(code, {
|
|
7134
7306
|
lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
|
|
7135
7307
|
});
|
|
@@ -7173,7 +7345,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
|
|
|
7173
7345
|
const file = id.split("?")[0].replace(/\\/g, "/");
|
|
7174
7346
|
if (file === configModule) return true;
|
|
7175
7347
|
try {
|
|
7176
|
-
return file ===
|
|
7348
|
+
return file === realpathSync3(configModule).replace(/\\/g, "/");
|
|
7177
7349
|
} catch {
|
|
7178
7350
|
return false;
|
|
7179
7351
|
}
|
|
@@ -7182,16 +7354,20 @@ function farmDocsClientConfigPlugin(configModule) {
|
|
|
7182
7354
|
return {
|
|
7183
7355
|
name: "farm:docs-client-config",
|
|
7184
7356
|
enforce: "pre",
|
|
7185
|
-
transform
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7357
|
+
transform: {
|
|
7358
|
+
// Never matches without a docs config module, so the bundler never calls the handler.
|
|
7359
|
+
filter: { id: configModule ? fileNamePattern([configModule]) : /(?!)/ },
|
|
7360
|
+
handler(code, id, options) {
|
|
7361
|
+
if (options?.ssr || !isFarmDocsClientConfigModule(id, configModule)) return null;
|
|
7362
|
+
const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
|
|
7363
|
+
return redacted === null ? null : { code: redacted, map: null };
|
|
7364
|
+
}
|
|
7189
7365
|
}
|
|
7190
7366
|
};
|
|
7191
7367
|
}
|
|
7192
7368
|
|
|
7193
7369
|
// src/server/vite-config.ts
|
|
7194
|
-
import
|
|
7370
|
+
import path16 from "path";
|
|
7195
7371
|
var FARM_CLIENT_ENTRY_PATTERN = "**/{page,layout,loading,error,not-found,default}.{js,jsx,ts,tsx}";
|
|
7196
7372
|
var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
7197
7373
|
"react",
|
|
@@ -7218,9 +7394,9 @@ function getFarmClientOptimizeDepsInclude(renderer) {
|
|
|
7218
7394
|
);
|
|
7219
7395
|
}
|
|
7220
7396
|
function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
|
|
7221
|
-
const resolvedProjectRoot =
|
|
7397
|
+
const resolvedProjectRoot = path16.resolve(projectRoot);
|
|
7222
7398
|
return appDirectories.map((appDirectory) => {
|
|
7223
|
-
const relativeAppDirectory =
|
|
7399
|
+
const relativeAppDirectory = path16.relative(resolvedProjectRoot, path16.resolve(appDirectory)).replace(/\\/g, "/");
|
|
7224
7400
|
const prefix = relativeAppDirectory || ".";
|
|
7225
7401
|
return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
|
|
7226
7402
|
});
|
|
@@ -7243,7 +7419,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
|
|
|
7243
7419
|
}
|
|
7244
7420
|
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
7245
7421
|
return {
|
|
7246
|
-
"@":
|
|
7422
|
+
"@": path16.resolve(projectRoot, srcDir)
|
|
7247
7423
|
};
|
|
7248
7424
|
}
|
|
7249
7425
|
function mergeNoExternal(farmValue, userValue) {
|
|
@@ -7375,17 +7551,20 @@ function createFarmThemeCssPlugin(input, basePath = "/") {
|
|
|
7375
7551
|
return {
|
|
7376
7552
|
name: "farm:theme-css",
|
|
7377
7553
|
enforce: "pre",
|
|
7378
|
-
transform
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7554
|
+
transform: {
|
|
7555
|
+
filter: { id: /\.css(?:\?.*)?$/, code: /@import\s+["']tailwindcss["']/ },
|
|
7556
|
+
handler(code, id) {
|
|
7557
|
+
if (!config.enabled || !/\.css(?:\?.*)?$/.test(id) || !/@import\s+["']tailwindcss["']/.test(code) || /@custom-variant\s+dark\b/.test(code)) {
|
|
7558
|
+
return null;
|
|
7559
|
+
}
|
|
7560
|
+
return {
|
|
7561
|
+
code: `${code.trimEnd()}
|
|
7384
7562
|
|
|
7385
7563
|
${FARM_DARK_VARIANT}
|
|
7386
7564
|
`,
|
|
7387
|
-
|
|
7388
|
-
|
|
7565
|
+
map: null
|
|
7566
|
+
};
|
|
7567
|
+
}
|
|
7389
7568
|
}
|
|
7390
7569
|
};
|
|
7391
7570
|
}
|
|
@@ -7415,7 +7594,11 @@ export {
|
|
|
7415
7594
|
generateClientCachePersistenceCode,
|
|
7416
7595
|
FARM_LAYOUT_ELEMENT_CLIENT_SOURCE,
|
|
7417
7596
|
FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE,
|
|
7597
|
+
FARM_NAVIGATION_SCRIPT_SOURCE,
|
|
7418
7598
|
FARM_NAVIGATION_STREAM_READER_SOURCE,
|
|
7599
|
+
FARM_REFRESH_FIELDS_SOURCE,
|
|
7600
|
+
exactIdPattern,
|
|
7601
|
+
fileNamePattern,
|
|
7419
7602
|
redactFarmDocsClientConfig,
|
|
7420
7603
|
isFarmDocsClientConfigModule,
|
|
7421
7604
|
farmDocsClientConfigPlugin,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bundleNodeModule
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MGKWYPE3.mjs";
|
|
4
4
|
|
|
5
5
|
// src/instrumentation.ts
|
|
6
6
|
import fs from "fs";
|
|
@@ -9,12 +9,14 @@ import { pathToFileURL } from "url";
|
|
|
9
9
|
var INSTRUMENTATION_EXTENSIONS = ["ts", "mts", "js", "mjs"];
|
|
10
10
|
function resolveFarmInstrumentationFile(root, srcDir = "src") {
|
|
11
11
|
const candidates = [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
.../* @__PURE__ */ new Set([
|
|
13
|
+
...INSTRUMENTATION_EXTENSIONS.map(
|
|
14
|
+
(extension) => path.join(root, srcDir, `instrumentation.${extension}`)
|
|
15
|
+
),
|
|
16
|
+
...INSTRUMENTATION_EXTENSIONS.map(
|
|
17
|
+
(extension) => path.join(root, `instrumentation.${extension}`)
|
|
18
|
+
)
|
|
19
|
+
])
|
|
18
20
|
].filter((candidate) => fs.existsSync(candidate));
|
|
19
21
|
if (candidates.length > 1) {
|
|
20
22
|
throw new Error(
|