@farm.js/core 0.1.31 → 0.1.34
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/README.md +1 -1
- package/dist/agent-runtime.cjs +69 -14
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +58 -3
- package/dist/api/route-manager.cjs +16 -13
- package/dist/api/route-manager.d.mts +1 -1
- package/dist/api/route-manager.d.ts +1 -1
- package/dist/api/route-manager.mjs +15 -12
- package/dist/api/runtime.cjs +9 -7
- package/dist/api/runtime.d.mts +1 -1
- package/dist/api/runtime.d.ts +1 -1
- package/dist/api/runtime.mjs +8 -6
- package/dist/api.cjs +19 -16
- package/dist/api.d.mts +2 -2
- package/dist/api.d.ts +2 -2
- package/dist/api.mjs +18 -15
- package/dist/{app-sUJ3jnTZ.d.ts → app-DgotYGbq.d.ts} +3 -3
- package/dist/app-markdown.cjs +8 -6
- 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-DAuUTIZf.d.mts → app-q4rmZlXK.d.mts} +3 -3
- package/dist/cache.cjs +2 -2
- package/dist/cache.d.mts +10 -1
- package/dist/cache.d.ts +10 -1
- package/dist/cache.mjs +1 -1
- package/dist/{chunk-YZTASLPQ.cjs → chunk-27ZWSI3W.cjs} +2 -2
- package/dist/{chunk-WBIH66JK.mjs → chunk-2ELDTQRN.mjs} +5 -2
- package/dist/{chunk-K7CELQLK.cjs → chunk-2F2ER724.cjs} +54 -29
- package/dist/{chunk-NRVGEI5I.mjs → chunk-2NNMOPDN.mjs} +4 -210
- package/dist/chunk-2NQQ5H5G.cjs +86 -0
- package/dist/{chunk-IFI5FXEZ.cjs → chunk-36MK5YCW.cjs} +334 -163
- package/dist/chunk-3BU22U3M.cjs +237 -0
- package/dist/{chunk-MM5D6VLP.mjs → chunk-3KZS4SUS.mjs} +33 -14
- package/dist/chunk-3SDFA7UF.cjs +701 -0
- package/dist/{chunk-4IEPYMHF.mjs → chunk-3UEVPCGW.mjs} +1 -1
- package/dist/{chunk-5LJCOSKT.mjs → chunk-3VSKDFAT.mjs} +1 -1
- package/dist/{chunk-5HGR3W6O.mjs → chunk-5SJWVY6R.mjs} +8 -0
- package/dist/{chunk-X7WVQMIB.mjs → chunk-657WJNRY.mjs} +10 -4
- package/dist/{chunk-MKMBQSNQ.mjs → chunk-6VVL3MHY.mjs} +3 -3
- package/dist/{chunk-QZRVZSPN.cjs → chunk-77GNHH2Z.cjs} +3 -3
- package/dist/{chunk-KZLND3D2.cjs → chunk-7BT4H4P7.cjs} +7 -5
- package/dist/{chunk-A777V5WU.cjs → chunk-7M52YUMY.cjs} +2 -2
- package/dist/{chunk-VUMAE7NC.mjs → chunk-7Y6ZNFPX.mjs} +81 -30
- package/dist/{chunk-MXDTKXO6.cjs → chunk-A5FGU2WU.cjs} +74 -23
- package/dist/{chunk-7QOCTYBS.mjs → chunk-AGC75XAE.mjs} +37 -1
- package/dist/{chunk-4ZQQL4IU.mjs → chunk-AHGECQEW.mjs} +1 -1
- package/dist/{chunk-RG3ZOTG5.cjs → chunk-AI7QMY7O.cjs} +10 -3
- package/dist/{chunk-O3DTUAX2.mjs → chunk-AQZFOP7S.mjs} +6 -77
- package/dist/{chunk-WNLBF77X.cjs → chunk-ATK2R4CH.cjs} +14 -12
- package/dist/{chunk-SORB3MAR.cjs → chunk-AWC4VUZL.cjs} +17 -17
- package/dist/{chunk-YMCXWPWK.mjs → chunk-BCMSYSN2.mjs} +4 -1
- package/dist/{chunk-FYRBX5IY.cjs → chunk-BTAG7LI7.cjs} +2 -2
- package/dist/{chunk-I6XDAKWQ.mjs → chunk-BTHHUD7Q.mjs} +14 -0
- package/dist/chunk-C4SPBWFM.cjs +26 -0
- package/dist/{chunk-JATSG2ZO.mjs → chunk-CLJYVZAD.mjs} +4 -2
- package/dist/{chunk-J3LOGE4T.cjs → chunk-DQQOKWYA.cjs} +5 -5
- package/dist/{chunk-JLRDISQL.cjs → chunk-DZ4DTRJ5.cjs} +7 -7
- package/dist/chunk-E5GNDG5F.mjs +701 -0
- package/dist/{chunk-E76XC6ZG.mjs → chunk-EZDQRNQ7.mjs} +2 -2
- package/dist/{chunk-TOVMYGYW.mjs → chunk-F2SE2VDO.mjs} +1 -1
- package/dist/{chunk-BSPQVJ4A.mjs → chunk-FDR64H6B.mjs} +13 -0
- package/dist/{chunk-5OVTOKGH.cjs → chunk-FFFW3OQ7.cjs} +2 -2
- package/dist/{chunk-D4JE5NNV.cjs → chunk-FNO7A7CM.cjs} +5 -5
- package/dist/chunk-FZ6YYU2W.mjs +65 -0
- package/dist/{chunk-PZNCMPJF.cjs → chunk-G26MUMKL.cjs} +14 -8
- package/dist/{chunk-IXUY2F5U.mjs → chunk-GCXWJJKH.mjs} +4 -7
- package/dist/{chunk-JLCQGPXE.mjs → chunk-GNSDTTWZ.mjs} +50 -61
- package/dist/{chunk-TEN4FIZU.mjs → chunk-GOABMOX3.mjs} +151 -3
- package/dist/{chunk-HBTUGXHS.cjs → chunk-HLJ6MBUZ.cjs} +7 -4
- package/dist/{chunk-GZYH4OER.mjs → chunk-HR5KPHC2.mjs} +1 -1
- package/dist/{chunk-ZCU4NZ3M.cjs → chunk-IE7XCHH3.cjs} +4 -4
- package/dist/{chunk-I26CZYPV.cjs → chunk-IHNIDL6H.cjs} +50 -7
- package/dist/{chunk-2FQHH5SC.mjs → chunk-IHNMMXHV.mjs} +49 -24
- package/dist/{chunk-VHJGDMCG.cjs → chunk-IWZKTWHZ.cjs} +2 -2
- package/dist/{chunk-DGXN3L4D.mjs → chunk-JDPAKVS4.mjs} +4 -4
- package/dist/chunk-JG6DJF5A.mjs +238 -0
- package/dist/{chunk-5TISYEQF.mjs → chunk-JM5XPKWH.mjs} +10 -3
- package/dist/{chunk-BJJATPEC.mjs → chunk-KN7K4VQN.mjs} +1 -1
- package/dist/{chunk-WPYFSQKK.cjs → chunk-KNBBQHO2.cjs} +15 -1
- package/dist/{chunk-XWAWFQFS.cjs → chunk-KXWRO25S.cjs} +7 -4
- package/dist/{chunk-QG5HNS7P.mjs → chunk-LHODW25H.mjs} +2 -2
- package/dist/{chunk-BXFWA23T.mjs → chunk-LMJ7VRHZ.mjs} +3 -3
- package/dist/{chunk-WG2KHOMN.mjs → chunk-LR5QSC2P.mjs} +380 -209
- package/dist/chunk-LSKZMJMP.cjs +65 -0
- package/dist/{chunk-2N5PX3LS.mjs → chunk-LYV44OIR.mjs} +7 -1
- package/dist/{chunk-5MKEDGLD.cjs → chunk-M64YUMA4.cjs} +11 -6
- package/dist/{chunk-EXLKRR4U.cjs → chunk-MIDIZJZC.cjs} +12 -12
- package/dist/{chunk-ES4B2IXW.cjs → chunk-MOKLYNHV.cjs} +2 -2
- package/dist/{chunk-IV6CQY7O.mjs → chunk-MSSFIQGM.mjs} +63 -13
- package/dist/{chunk-KH7BN726.cjs → chunk-N4UOK6ZI.cjs} +8 -2
- package/dist/{chunk-6VYZOPOT.mjs → chunk-NGVORZVZ.mjs} +1 -1
- package/dist/{chunk-JNGIWIY6.mjs → chunk-NPC7VWJE.mjs} +2 -2
- package/dist/{chunk-ILWLPEVO.mjs → chunk-NRSN7G7E.mjs} +2 -2
- package/dist/{chunk-AHAJGAYD.mjs → chunk-O27L4YAA.mjs} +1 -1
- package/dist/{chunk-VYZSOYR4.cjs → chunk-ODBZYBAB.cjs} +1 -1
- package/dist/{chunk-YVGAEAA5.cjs → chunk-P64MIF5B.cjs} +154 -6
- package/dist/{chunk-DFLLARUK.cjs → chunk-PQDFUSXD.cjs} +14 -14
- package/dist/{chunk-F6XEGFHO.mjs → chunk-PXKIEXZD.mjs} +10 -0
- package/dist/{chunk-S5GDHOE4.mjs → chunk-PZNL3WEG.mjs} +48 -5
- package/dist/{chunk-FV45CKBC.mjs → chunk-QCFBDFRS.mjs} +1 -1
- package/dist/{chunk-75BRBIFP.cjs → chunk-QCVE2OCI.cjs} +5 -8
- package/dist/{chunk-6ZCMSZ5U.mjs → chunk-QE6VAKLT.mjs} +1 -1
- package/dist/{chunk-75DYEVXI.cjs → chunk-QGYRXFU2.cjs} +9 -9
- package/dist/{chunk-CTV2TTNP.cjs → chunk-QJ3J6MZT.cjs} +16 -87
- package/dist/{chunk-O6XNAMBV.mjs → chunk-QLQ32WC4.mjs} +8 -3
- package/dist/{chunk-IMB4PIAR.cjs → chunk-SJVKK4JE.cjs} +839 -420
- package/dist/{chunk-3FCFQP5V.cjs → chunk-TA5G2HWD.cjs} +21 -21
- package/dist/{chunk-Z5HIWVDP.cjs → chunk-TDFPACVX.cjs} +62 -73
- package/dist/{chunk-ND224OE2.cjs → chunk-TKSCR644.cjs} +34 -15
- package/dist/{chunk-UAFSBWNT.mjs → chunk-U4PTAHW3.mjs} +64 -13
- package/dist/{chunk-ZHVYQL3H.cjs → chunk-U74I55WB.cjs} +86 -35
- package/dist/chunk-UBO4SGH4.mjs +86 -0
- package/dist/{chunk-IQXFRNY2.cjs → chunk-UFDAAQFX.cjs} +2 -2
- package/dist/{chunk-X7KZBF63.cjs → chunk-UX5S4JEO.cjs} +40 -4
- package/dist/{chunk-5ZSWG4UX.cjs → chunk-UXFQ3UDA.cjs} +14 -1
- package/dist/{chunk-L4DVIHOC.mjs → chunk-VCCUOMQN.mjs} +1 -1
- package/dist/{chunk-4V7GIE2U.mjs → chunk-VHANUNEG.mjs} +2 -2
- package/dist/{chunk-FXUUWYAX.cjs → chunk-VKNHTSAP.cjs} +10 -0
- package/dist/{chunk-2AKFKCHA.mjs → chunk-W7LF2J2S.mjs} +1 -1
- package/dist/{chunk-MNUGPHLN.mjs → chunk-WNNYOOIB.mjs} +5 -3
- package/dist/{chunk-VA62MHFV.mjs → chunk-X242HVD5.mjs} +1 -1
- package/dist/{chunk-UJ2C4ICS.cjs → chunk-XJXBIP67.cjs} +4 -4
- package/dist/{chunk-6L6DQR5W.mjs → chunk-XV5DJTBX.mjs} +539 -121
- package/dist/{chunk-KJ2TIHZZ.cjs → chunk-XXJU7FCC.cjs} +3 -2
- package/dist/{chunk-DYEJQTDN.cjs → chunk-YSCV4SJF.cjs} +4 -4
- package/dist/{chunk-2SDO73HK.cjs → chunk-YWN746US.cjs} +64 -14
- package/dist/chunk-Z2HLU4IX.cjs +238 -0
- package/dist/{chunk-2FXWWUE5.cjs → chunk-Z2YLTERK.cjs} +4 -4
- package/dist/{chunk-CUMINO7Z.cjs → chunk-ZHPHJPQP.cjs} +4 -4
- package/dist/{chunk-FJZ3DQLK.mjs → chunk-ZKP7C2B6.mjs} +4 -4
- package/dist/{chunk-JBC2FKRW.mjs → chunk-ZUSJDQ2Q.mjs} +2 -1
- package/dist/{client-plugins-BX2ptm4H.d.mts → client-plugins-CLObcuCq.d.mts} +26 -2
- package/dist/{client-plugins-BmxM5KW_.d.ts → client-plugins-DZjHC4Mi.d.ts} +26 -2
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +8 -8
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +7 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-EWRDHCD5.cjs → devtools-HU6Y2MNV.cjs} +11 -9
- package/dist/{devtools-BPBCYOU6.mjs → devtools-RNXCTS4R.mjs} +10 -8
- package/dist/docs.cjs +13 -11
- package/dist/docs.d.mts +5 -0
- package/dist/docs.d.ts +5 -0
- package/dist/docs.mjs +12 -10
- package/dist/environment/vite.cjs +2 -2
- package/dist/environment/vite.mjs +1 -1
- package/dist/headers.cjs +4 -4
- package/dist/headers.mjs +3 -3
- package/dist/i18n/client.cjs +14 -13
- package/dist/i18n/client.mjs +5 -4
- package/dist/i18n/index.cjs +3 -2
- package/dist/i18n/index.mjs +2 -1
- package/dist/i18n/server.cjs +6 -5
- package/dist/i18n/server.mjs +5 -4
- package/dist/image/server.cjs +2 -2
- package/dist/image/server.mjs +1 -1
- package/dist/image/sharp.cjs +9 -9
- package/dist/image/sharp.mjs +1 -1
- package/dist/index.cjs +67 -55
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +70 -58
- package/dist/integrations.cjs +6 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +7 -4
- package/dist/internal/app-markdown-runtime.cjs +7 -5
- package/dist/internal/app-markdown-runtime.d.mts +14 -3
- package/dist/internal/app-markdown-runtime.d.ts +14 -3
- package/dist/internal/app-markdown-runtime.mjs +6 -4
- package/dist/internal/build-runtime.cjs +38 -35
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +37 -34
- package/dist/internal/cli-runtime.cjs +20 -17
- package/dist/internal/cli-runtime.mjs +19 -16
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +4 -2
- package/dist/internal/client-runtime.d.mts +9 -1
- package/dist/internal/client-runtime.d.ts +9 -1
- package/dist/internal/client-runtime.mjs +3 -1
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +11 -9
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +10 -8
- package/dist/internal/infra-analytics-runtime.cjs +4 -4
- package/dist/internal/infra-analytics-runtime.mjs +2 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +20 -14
- package/dist/internal/production-runtime.d.mts +115 -8
- package/dist/internal/production-runtime.d.ts +115 -8
- package/dist/internal/production-runtime.mjs +19 -13
- package/dist/internal/request-cookies.cjs +4 -2
- package/dist/internal/request-cookies.d.mts +9 -1
- package/dist/internal/request-cookies.d.ts +9 -1
- package/dist/internal/request-cookies.mjs +3 -1
- package/dist/markdown.cjs +4 -4
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +3 -3
- package/dist/{metadata-DsEaK7mQ.d.mts → metadata-2HSU2i_w.d.mts} +1 -1
- package/dist/{metadata-fwZ3gfG6.d.ts → metadata-Cjs8JMRM.d.ts} +1 -1
- package/dist/middleware.cjs +18 -8
- package/dist/middleware.d.mts +24 -5
- package/dist/middleware.d.ts +24 -5
- package/dist/middleware.mjs +18 -8
- package/dist/navigation.cjs +6 -6
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +5 -5
- package/dist/{nitro-NAKCRVHX.mjs → nitro-4XGPNIK4.mjs} +3 -3
- package/dist/{nitro-VYDZGYFY.cjs → nitro-HSAQFXSS.cjs} +4 -4
- package/dist/plugin.cjs +33 -30
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +32 -29
- package/dist/{production-runtime-DNkpFnmg.d.ts → production-runtime-BU5ETAK9.d.ts} +8 -1
- package/dist/{production-runtime-Baqgwtvc.d.mts → production-runtime-CysZl3EV.d.mts} +8 -1
- package/dist/query/client.cjs +7 -7
- package/dist/query/client.mjs +3 -3
- package/dist/{render-plan-DhwQnmmX.d.mts → render-plan-CKr4ltOd.d.mts} +1 -1
- package/dist/{render-plan-rkIK9wd9.d.ts → render-plan-D72O1qm4.d.ts} +1 -1
- package/dist/renderer-client.cjs +39 -19
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +28 -8
- package/dist/{request-CFy1BltJ.d.mts → request-Be83WafN.d.mts} +7 -2
- package/dist/{request-BcY4RYPC.d.ts → request-DbyOYI2j.d.ts} +7 -2
- package/dist/request.cjs +2 -2
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering-BkS0TBlB.d.mts → route-rendering-BG56SzvJ.d.mts} +1 -1
- package/dist/{route-rendering-D4XpMjam.d.ts → route-rendering-CtVMpV-k.d.ts} +1 -1
- package/dist/{router-C4zPlC3V.d.mts → router-ALUvm8gC.d.mts} +1 -1
- package/dist/{router-Cq7BcZxg.d.ts → router-D94-SDlW.d.ts} +1 -1
- package/dist/routes.cjs +3 -3
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.mjs +2 -2
- package/dist/server-fn.cjs +3 -3
- package/dist/server-fn.mjs +2 -2
- package/dist/server-plugins.cjs +4 -4
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +3 -3
- package/dist/server-query-client.cjs +3 -3
- package/dist/server-query-client.mjs +2 -2
- package/dist/server-query.cjs +4 -4
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +60 -57
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +37 -34
- package/dist/{spa-router-B1HI3X9k.d.ts → spa-router-CxK3USIz.d.ts} +2 -2
- package/dist/{spa-router-DzPZH-AO.d.mts → spa-router-DbxNRKOB.d.mts} +2 -2
- package/dist/testing.cjs +19 -17
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +16 -14
- package/dist/theme/server.cjs +4 -3
- package/dist/theme/server.mjs +3 -2
- package/dist/{utils-DMD1Hzta.d.ts → utils-311Y8eoK.d.ts} +1 -1
- package/dist/{utils-CEBktlBG.d.mts → utils-4wVRcpOw.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +33 -30
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +32 -29
- package/package.json +2 -2
- package/dist/chunk-22GUSVNJ.cjs +0 -351
- package/dist/chunk-SWN467MP.cjs +0 -18
- package/dist/chunk-XGC343EY.cjs +0 -443
- package/dist/chunk-ZSH2Y4LN.mjs +0 -351
- /package/dist/{chunk-SUIBNSNO.cjs → chunk-SJNMVDDF.cjs} +0 -0
- /package/dist/{chunk-LNZ7JZUS.mjs → chunk-UDNPLXW7.mjs} +0 -0
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
loadFarmDocsPage,
|
|
4
4
|
resolveFarmDocsContentDir,
|
|
5
5
|
toFarmDocsMarkdownPage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-O27L4YAA.mjs";
|
|
7
7
|
import {
|
|
8
8
|
docsEngine,
|
|
9
9
|
loadFarmDocsEngine
|
|
10
10
|
} from "./chunk-2VQKKQ6D.mjs";
|
|
11
11
|
import {
|
|
12
12
|
resolveDocsConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZKP7C2B6.mjs";
|
|
14
14
|
import {
|
|
15
15
|
getFarmDocsAdapterConfigModule
|
|
16
16
|
} from "./chunk-VVBO3QH7.mjs";
|
|
@@ -124,6 +124,7 @@ async function createFarmDocsAdapterHandler(docs, options) {
|
|
|
124
124
|
__name(createFarmDocsAdapterHandler, "createFarmDocsAdapterHandler");
|
|
125
125
|
|
|
126
126
|
// src/docs/api.ts
|
|
127
|
+
import path2 from "path";
|
|
127
128
|
function isRecord(value) {
|
|
128
129
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
129
130
|
}
|
|
@@ -423,10 +424,64 @@ function buildAgentSpec(context, request) {
|
|
|
423
424
|
robots: spec.capabilities.robots,
|
|
424
425
|
post: false
|
|
425
426
|
},
|
|
426
|
-
|
|
427
|
+
// Same root-relative source paths the precompiled runtime serves.
|
|
428
|
+
pages: pages.map(({ sourcePath, ...page }) => {
|
|
429
|
+
const publicSourcePath = toPublicDocsPath(sourcePath, context.root);
|
|
430
|
+
return publicSourcePath ? { ...page, sourcePath: `./${publicSourcePath}` } : page;
|
|
431
|
+
})
|
|
427
432
|
};
|
|
428
433
|
}
|
|
429
434
|
__name(buildAgentSpec, "buildAgentSpec");
|
|
435
|
+
var REDACTED_DOCS_CONFIG_VALUE = "[redacted]";
|
|
436
|
+
function isSecretDocsConfigKey(key) {
|
|
437
|
+
const normalized = key.replace(/[-_]/g, "").toLowerCase();
|
|
438
|
+
if (!normalized || normalized.endsWith("env")) return false;
|
|
439
|
+
return /apikey|token|secret|password|authorization|credential/.test(normalized);
|
|
440
|
+
}
|
|
441
|
+
__name(isSecretDocsConfigKey, "isSecretDocsConfigKey");
|
|
442
|
+
function redactDocsConfigValue(value, key, inHeaders) {
|
|
443
|
+
if (Array.isArray(value)) {
|
|
444
|
+
return value.map((entry) => redactDocsConfigValue(entry, key, inHeaders));
|
|
445
|
+
}
|
|
446
|
+
if (isRecord(value) && !(value instanceof Date) && !(value instanceof URL)) {
|
|
447
|
+
const headers = inHeaders || key.toLowerCase() === "headers";
|
|
448
|
+
return Object.fromEntries(
|
|
449
|
+
Object.entries(value).map(([childKey, child]) => [
|
|
450
|
+
childKey,
|
|
451
|
+
redactDocsConfigValue(child, childKey, headers)
|
|
452
|
+
])
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
if (value === null || value === void 0 || typeof value === "function") return value;
|
|
456
|
+
return inHeaders || isSecretDocsConfigKey(key) ? REDACTED_DOCS_CONFIG_VALUE : value;
|
|
457
|
+
}
|
|
458
|
+
__name(redactDocsConfigValue, "redactDocsConfigValue");
|
|
459
|
+
function toPublicDocsPath(value, root) {
|
|
460
|
+
if (typeof value !== "string" || !value) return void 0;
|
|
461
|
+
if (!path2.isAbsolute(value)) return value;
|
|
462
|
+
const relative = path2.relative(root, value);
|
|
463
|
+
if (path2.isAbsolute(relative) || relative === ".." || relative.startsWith(`..${path2.sep}`)) {
|
|
464
|
+
return void 0;
|
|
465
|
+
}
|
|
466
|
+
return relative.split(path2.sep).join("/") || ".";
|
|
467
|
+
}
|
|
468
|
+
__name(toPublicDocsPath, "toPublicDocsPath");
|
|
469
|
+
function buildPublicConfig(context) {
|
|
470
|
+
const redacted = redactDocsConfigValue(context.docs.config, "", false);
|
|
471
|
+
const contentDir = toPublicDocsPath(redacted.contentDir, context.root);
|
|
472
|
+
const publicInput = { ...redacted, contentDir };
|
|
473
|
+
const map = docsEngine().buildDocsConfigMap(publicInput, {
|
|
474
|
+
file: toPublicDocsPath(context.docs.configPath, context.root) || "farm.config.ts"
|
|
475
|
+
});
|
|
476
|
+
const config = Object.fromEntries(Object.keys(map.values).map((key) => [key, publicInput[key]]));
|
|
477
|
+
return {
|
|
478
|
+
entry: context.docs.entry,
|
|
479
|
+
contentDir: toPublicDocsPath(context.docs.contentDir, context.root) || contentDir || null,
|
|
480
|
+
config,
|
|
481
|
+
map
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
__name(buildPublicConfig, "buildPublicConfig");
|
|
430
485
|
function buildDiagnostics(context) {
|
|
431
486
|
const pages = discoverFarmDocsPages(context.contentDir, context.docs);
|
|
432
487
|
const diagnostics = docsEngine().buildDocsDiagnostics(context.docs.config, {
|
|
@@ -505,7 +560,8 @@ async function resolveAPIContext(options) {
|
|
|
505
560
|
root,
|
|
506
561
|
srcDir,
|
|
507
562
|
docs,
|
|
508
|
-
contentDir: resolveFarmDocsContentDir(docs, { root, srcDir })
|
|
563
|
+
contentDir: resolveFarmDocsContentDir(docs, { root, srcDir }),
|
|
564
|
+
diagnostics: options.diagnostics === true
|
|
509
565
|
};
|
|
510
566
|
}
|
|
511
567
|
__name(resolveAPIContext, "resolveAPIContext");
|
|
@@ -517,21 +573,16 @@ async function handleDocsAPIGet(request, context) {
|
|
|
517
573
|
const format = getDocsAPIFormat(request);
|
|
518
574
|
const pathTarget = getDocsAPIPathTarget(request);
|
|
519
575
|
if (format === "config" || format === "docs-config") {
|
|
520
|
-
return json(
|
|
521
|
-
entry: context.docs.entry,
|
|
522
|
-
contentDir: context.docs.contentDir || context.docs.config.contentDir || null,
|
|
523
|
-
config: context.docs.config,
|
|
524
|
-
map: docsEngine().buildDocsConfigMap(context.docs.config, {
|
|
525
|
-
file: context.docs.configPath || "farm.config.ts"
|
|
526
|
-
})
|
|
527
|
-
});
|
|
576
|
+
return json(buildPublicConfig(context));
|
|
528
577
|
}
|
|
529
578
|
if (format === "skill")
|
|
530
579
|
return text(renderSkillDocument(context, request), "text/markdown; charset=utf-8");
|
|
531
580
|
if (format === "agents")
|
|
532
581
|
return text(renderAgentsDocument(context, request), "text/markdown; charset=utf-8");
|
|
533
582
|
if (format === "agent" || format === "agent-spec") return json(buildAgentSpec(context, request));
|
|
534
|
-
if (format === "diagnostics")
|
|
583
|
+
if (format === "diagnostics") {
|
|
584
|
+
return context.diagnostics ? json(buildDiagnostics(context)) : json({ error: "Docs diagnostics are only available in development" }, { status: 404 });
|
|
585
|
+
}
|
|
535
586
|
if (format === "llms")
|
|
536
587
|
return text(renderLlmsTxt(context, request, false), "text/plain; charset=utf-8");
|
|
537
588
|
if (format === "llms-full")
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunk2NQQ5H5Gcjs = require('./chunk-2NQQ5H5G.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
9
|
+
var _chunk3BU22U3Mcjs = require('./chunk-3BU22U3M.cjs');
|
|
8
10
|
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
|
|
11
16
|
|
|
12
17
|
|
|
13
18
|
var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
|
|
@@ -20,6 +25,9 @@ var _chunkBMWDEBXOcjs = require('./chunk-BMWDEBXO.cjs');
|
|
|
20
25
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
21
26
|
|
|
22
27
|
|
|
28
|
+
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
29
|
+
|
|
30
|
+
|
|
23
31
|
var _chunkE3UK5IIBcjs = require('./chunk-E3UK5IIB.cjs');
|
|
24
32
|
|
|
25
33
|
|
|
@@ -31,7 +39,7 @@ var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
|
|
|
31
39
|
var _chunkOX6O6WVAcjs = require('./chunk-OX6O6WVA.cjs');
|
|
32
40
|
|
|
33
41
|
|
|
34
|
-
var
|
|
42
|
+
var _chunkUXFQ3UDAcjs = require('./chunk-UXFQ3UDA.cjs');
|
|
35
43
|
|
|
36
44
|
|
|
37
45
|
var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
|
|
@@ -47,7 +55,7 @@ var _CookieJarImpl = class _CookieJarImpl {
|
|
|
47
55
|
constructor(req, res) {
|
|
48
56
|
this.req = req;
|
|
49
57
|
this.res = res;
|
|
50
|
-
this.cookies =
|
|
58
|
+
this.cookies = _chunk3BU22U3Mcjs.parseMiddlewareCookieHeader.call(void 0, req.headers.cookie);
|
|
51
59
|
const existing = res.getHeader("Set-Cookie");
|
|
52
60
|
this.setCookies = Array.isArray(existing) ? existing.map(String) : existing === void 0 ? [] : [String(existing)];
|
|
53
61
|
}
|
|
@@ -56,13 +64,13 @@ var _CookieJarImpl = class _CookieJarImpl {
|
|
|
56
64
|
}
|
|
57
65
|
set(name, value, options = {}) {
|
|
58
66
|
this.cookies[name] = value;
|
|
59
|
-
const cookieString =
|
|
67
|
+
const cookieString = _chunk3BU22U3Mcjs.serializeMiddlewareCookie.call(void 0, name, value, options);
|
|
60
68
|
this.setCookies.push(cookieString);
|
|
61
69
|
this.res.setHeader("Set-Cookie", this.setCookies);
|
|
62
70
|
}
|
|
63
71
|
delete(name, options = {}) {
|
|
64
72
|
delete this.cookies[name];
|
|
65
|
-
this.setCookies.push(
|
|
73
|
+
this.setCookies.push(_chunk3BU22U3Mcjs.serializeMiddlewareCookieDeletion.call(void 0, name, options));
|
|
66
74
|
this.res.setHeader("Set-Cookie", this.setCookies);
|
|
67
75
|
}
|
|
68
76
|
getAll() {
|
|
@@ -72,7 +80,7 @@ var _CookieJarImpl = class _CookieJarImpl {
|
|
|
72
80
|
_chunkS3JO3N4Hcjs.__name.call(void 0, _CookieJarImpl, "CookieJarImpl");
|
|
73
81
|
var CookieJarImpl = _CookieJarImpl;
|
|
74
82
|
function createContext(req, res, viteServer, parent, server) {
|
|
75
|
-
const url =
|
|
83
|
+
const url = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([server, 'optionalAccess', _ => _.trustProxy]) });
|
|
76
84
|
const headers = /* @__PURE__ */ new Map();
|
|
77
85
|
const data = _optionalChain([parent, 'optionalAccess', _2 => _2.data]) ? new Map(parent.data) : /* @__PURE__ */ new Map();
|
|
78
86
|
const locals = _optionalChain([parent, 'optionalAccess', _3 => _3.locals]) ? new Map(parent.locals) : /* @__PURE__ */ new Map();
|
|
@@ -185,12 +193,24 @@ var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
|
185
193
|
|
|
186
194
|
// src/middleware/path.ts
|
|
187
195
|
function appendMiddlewareRoutePath(routePath, directoryName) {
|
|
188
|
-
if (directoryName.startsWith("(") && directoryName.endsWith(")")) {
|
|
196
|
+
if (directoryName.startsWith("(") && directoryName.endsWith(")") || _chunk2NQQ5H5Gcjs.isRouteSlotSegment.call(void 0, directoryName)) {
|
|
189
197
|
return routePath;
|
|
190
198
|
}
|
|
191
199
|
return routePath === "/" ? `/${directoryName}` : `${routePath}/${directoryName}`;
|
|
192
200
|
}
|
|
193
201
|
_chunkS3JO3N4Hcjs.__name.call(void 0, appendMiddlewareRoutePath, "appendMiddlewareRoutePath");
|
|
202
|
+
function appendMiddlewareDirectory(directory, directoryName) {
|
|
203
|
+
return directory === "" ? directoryName : `${directory}/${directoryName}`;
|
|
204
|
+
}
|
|
205
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, appendMiddlewareDirectory, "appendMiddlewareDirectory");
|
|
206
|
+
function countSegments(value) {
|
|
207
|
+
return value.split("/").filter(Boolean).length;
|
|
208
|
+
}
|
|
209
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, countSegments, "countSegments");
|
|
210
|
+
function compareMiddlewareRouteLocations(left, right) {
|
|
211
|
+
return countSegments(left.path) - countSegments(right.path) || left.path.localeCompare(right.path) || countSegments(left.directory) - countSegments(right.directory) || left.directory.localeCompare(right.directory);
|
|
212
|
+
}
|
|
213
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, compareMiddlewareRouteLocations, "compareMiddlewareRouteLocations");
|
|
194
214
|
|
|
195
215
|
// src/middleware/manager.ts
|
|
196
216
|
function isMiddlewareResponse(value) {
|
|
@@ -198,13 +218,14 @@ function isMiddlewareResponse(value) {
|
|
|
198
218
|
}
|
|
199
219
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isMiddlewareResponse, "isMiddlewareResponse");
|
|
200
220
|
var _MiddlewareManager = class _MiddlewareManager {
|
|
201
|
-
constructor(appDir, viteServer, config, i18n, server) {
|
|
221
|
+
constructor(appDir, viteServer, config, i18n, server, apiBasePath) {
|
|
202
222
|
this.middleware = [];
|
|
203
223
|
this.configMiddleware = [];
|
|
204
224
|
this.appDirs = Array.isArray(appDir) ? [...appDir] : [appDir];
|
|
205
225
|
this.viteServer = viteServer;
|
|
206
226
|
this.i18n = i18n;
|
|
207
227
|
this.server = server;
|
|
228
|
+
this.toMiddlewarePathnames = _chunkKNBBQHO2cjs.createFarmAPIMiddlewarePathnames.call(void 0, apiBasePath);
|
|
208
229
|
this.configure(config);
|
|
209
230
|
}
|
|
210
231
|
configure(config) {
|
|
@@ -215,7 +236,7 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
215
236
|
for (const [index, entry] of entries.entries()) {
|
|
216
237
|
const handlers = this.getConfigHandlers(entry);
|
|
217
238
|
const middlewareConfig = this.toMiddlewareConfig(entry);
|
|
218
|
-
|
|
239
|
+
_chunkZ2HLU4IXcjs.compileMiddlewareConfig.call(void 0, middlewareConfig);
|
|
219
240
|
if (handlers.length === 0) {
|
|
220
241
|
this.globalConfig = middlewareConfig;
|
|
221
242
|
continue;
|
|
@@ -233,21 +254,16 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
233
254
|
* Discover all middleware.ts files
|
|
234
255
|
*/
|
|
235
256
|
async discover() {
|
|
236
|
-
const
|
|
257
|
+
const middlewareByDirectory = /* @__PURE__ */ new Map();
|
|
237
258
|
for (const appDir of this.appDirs) {
|
|
238
259
|
const discovered = [];
|
|
239
|
-
await this.discoverInDirectory(appDir, "/", discovered);
|
|
240
|
-
for (const
|
|
241
|
-
|
|
242
|
-
|
|
260
|
+
await this.discoverInDirectory(appDir, "/", "", discovered);
|
|
261
|
+
for (const entry of discovered) {
|
|
262
|
+
_chunkZ2HLU4IXcjs.compileMiddlewareRoute.call(void 0, entry.middleware);
|
|
263
|
+
middlewareByDirectory.set(entry.location.directory, entry);
|
|
243
264
|
}
|
|
244
265
|
}
|
|
245
|
-
this.middleware = Array.from(
|
|
246
|
-
this.middleware.sort((a, b) => {
|
|
247
|
-
const depthA = a.path.split("/").filter(Boolean).length;
|
|
248
|
-
const depthB = b.path.split("/").filter(Boolean).length;
|
|
249
|
-
return depthA - depthB;
|
|
250
|
-
});
|
|
266
|
+
this.middleware = Array.from(middlewareByDirectory.values()).sort((left, right) => compareMiddlewareRouteLocations(left.location, right.location)).map((entry) => entry.middleware);
|
|
251
267
|
if (process.env.FARM_VERBOSE && this.middleware.length > 0) {
|
|
252
268
|
_chunk5QIKR7RRcjs.logger.success(`Discovered ${this.middleware.length} middleware files`);
|
|
253
269
|
for (const mw of this.middleware) {
|
|
@@ -258,7 +274,7 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
258
274
|
/**
|
|
259
275
|
* Recursively discover middleware files
|
|
260
276
|
*/
|
|
261
|
-
async discoverInDirectory(dir, routePath, discovered) {
|
|
277
|
+
async discoverInDirectory(dir, routePath, directory, discovered) {
|
|
262
278
|
if (!fs.existsSync(dir)) {
|
|
263
279
|
return;
|
|
264
280
|
}
|
|
@@ -266,15 +282,18 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
266
282
|
if (middlewareFile) {
|
|
267
283
|
const middleware = await this.loadMiddleware(middlewareFile, routePath);
|
|
268
284
|
if (middleware) {
|
|
269
|
-
discovered.push(middleware);
|
|
285
|
+
discovered.push({ location: { path: routePath, directory }, middleware });
|
|
270
286
|
}
|
|
271
287
|
}
|
|
272
288
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
273
289
|
for (const entry of entries) {
|
|
274
290
|
if (entry.isDirectory() && !entry.name.startsWith(".") && !entry.name.startsWith("_")) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
291
|
+
await this.discoverInDirectory(
|
|
292
|
+
path.join(dir, entry.name),
|
|
293
|
+
appendMiddlewareRoutePath(routePath, entry.name),
|
|
294
|
+
appendMiddlewareDirectory(directory, entry.name),
|
|
295
|
+
discovered
|
|
296
|
+
);
|
|
278
297
|
}
|
|
279
298
|
}
|
|
280
299
|
}
|
|
@@ -305,12 +324,12 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
305
324
|
_chunkBMWDEBXOcjs.toFileModuleUrl.call(void 0, filePath)
|
|
306
325
|
);
|
|
307
326
|
}
|
|
308
|
-
const normalized =
|
|
327
|
+
const normalized = _chunk3BU22U3Mcjs.normalizeMiddlewareModule.call(void 0, module, routePath);
|
|
309
328
|
if (!normalized) {
|
|
310
329
|
throw new Error("must export a default handler or a named middleware handler");
|
|
311
330
|
}
|
|
312
331
|
if (normalized.config) {
|
|
313
|
-
|
|
332
|
+
_chunkZ2HLU4IXcjs.compileMiddlewareConfig.call(void 0, normalized.config);
|
|
314
333
|
}
|
|
315
334
|
return {
|
|
316
335
|
path: routePath,
|
|
@@ -327,9 +346,11 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
327
346
|
* Execute middleware for a request
|
|
328
347
|
*/
|
|
329
348
|
async execute(req, res) {
|
|
330
|
-
const url =
|
|
349
|
+
const url = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _6 => _6.server, 'optionalAccess', _7 => _7.trustProxy]) });
|
|
331
350
|
const pathname = url.pathname;
|
|
332
|
-
const
|
|
351
|
+
const toRoutePathname = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (value) => _optionalChain([this, 'access', _8 => _8.i18n, 'optionalAccess', _9 => _9.enabled]) ? _chunkBIDYX3SLcjs.stripFarmLocaleFromPathname.call(void 0, value, this.i18n) : _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, value, _nullishCoalesce(_optionalChain([this, 'access', _10 => _10.i18n, 'optionalAccess', _11 => _11.basePath]), () => ( "/"))), "toRoutePathname");
|
|
352
|
+
const routePathname = toRoutePathname(pathname);
|
|
353
|
+
const toMiddlewarePathnames = this.toMiddlewarePathnames;
|
|
333
354
|
const method = req.method || "GET";
|
|
334
355
|
const startTime = Date.now();
|
|
335
356
|
let parentData;
|
|
@@ -345,7 +366,10 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
345
366
|
}
|
|
346
367
|
const applicable = [
|
|
347
368
|
...this.configMiddleware.map((mw) => ({ mw, routeMatch: { matched: true } })),
|
|
348
|
-
...this.middleware.map((mw) => ({
|
|
369
|
+
...this.middleware.map((mw) => ({
|
|
370
|
+
mw,
|
|
371
|
+
routeMatch: _chunkZ2HLU4IXcjs.matchesMiddlewareRouteAt.call(void 0, toMiddlewarePathnames(routePathname), mw)
|
|
372
|
+
})).filter((entry) => entry.routeMatch.matched)
|
|
349
373
|
];
|
|
350
374
|
if (applicable.length === 0) {
|
|
351
375
|
return false;
|
|
@@ -360,12 +384,37 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
360
384
|
pc.dim(` (${(Date.now() - startTime).toFixed(2)}ms)`)
|
|
361
385
|
].join(" ");
|
|
362
386
|
console.log(log);
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
387
|
+
const ran = /* @__PURE__ */ new Set();
|
|
388
|
+
const allMiddleware = [...this.configMiddleware, ...this.middleware];
|
|
389
|
+
const globalConfig = this.globalConfig;
|
|
390
|
+
const trustProxy = _optionalChain([this, 'access', _12 => _12.server, 'optionalAccess', _13 => _13.trustProxy]);
|
|
391
|
+
function* applicableMiddleware() {
|
|
392
|
+
let passPathname = routePathname;
|
|
393
|
+
let pass = applicable;
|
|
394
|
+
for (; ; ) {
|
|
395
|
+
for (const entry of pass) yield { ...entry, pathname: passPathname };
|
|
396
|
+
const rewrittenPathname = toRoutePathname(
|
|
397
|
+
_chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy }).pathname
|
|
398
|
+
);
|
|
399
|
+
if (rewrittenPathname === passPathname) return;
|
|
400
|
+
passPathname = rewrittenPathname;
|
|
401
|
+
const passPathnames = toMiddlewarePathnames(passPathname);
|
|
402
|
+
if (globalConfig && !_chunkZ2HLU4IXcjs.matchesMiddlewareConfigAt.call(void 0, passPathnames, globalConfig, ctx).matched) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
pass = allMiddleware.filter((mw) => !ran.has(mw)).map((mw) => ({
|
|
406
|
+
mw,
|
|
407
|
+
routeMatch: mw.source === "config" ? { matched: true } : _chunkZ2HLU4IXcjs.matchesMiddlewareRouteAt.call(void 0, passPathnames, mw)
|
|
408
|
+
})).filter((entry) => entry.routeMatch.matched);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, applicableMiddleware, "applicableMiddleware");
|
|
412
|
+
for (const { mw, routeMatch, pathname: passPathname } of applicableMiddleware()) {
|
|
413
|
+
const configMatch = mw.config ? this.matchesConfig(passPathname, mw.config, ctx) : { matched: true };
|
|
366
414
|
if (!configMatch.matched) {
|
|
367
415
|
continue;
|
|
368
416
|
}
|
|
417
|
+
ran.add(mw);
|
|
369
418
|
if (routeMatch.params) {
|
|
370
419
|
ctx.params = { ...ctx.params, ...routeMatch.params };
|
|
371
420
|
}
|
|
@@ -466,7 +515,7 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
466
515
|
* Check if pathname matches middleware config
|
|
467
516
|
*/
|
|
468
517
|
matchesConfig(pathname, config, ctx) {
|
|
469
|
-
return
|
|
518
|
+
return _chunkZ2HLU4IXcjs.matchesMiddlewareConfigAt.call(void 0, this.toMiddlewarePathnames(pathname), config, ctx);
|
|
470
519
|
}
|
|
471
520
|
/**
|
|
472
521
|
* Reload middleware (for HMR)
|
|
@@ -502,4 +551,6 @@ var MiddlewareManager = _MiddlewareManager;
|
|
|
502
551
|
|
|
503
552
|
|
|
504
553
|
|
|
505
|
-
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
exports.createContext = createContext; exports.appendMiddlewareRoutePath = appendMiddlewareRoutePath; exports.appendMiddlewareDirectory = appendMiddlewareDirectory; exports.compareMiddlewareRouteLocations = compareMiddlewareRouteLocations; exports.MiddlewareManager = MiddlewareManager;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseRoutePath
|
|
3
|
+
} from "./chunk-KI3MESHB.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
7
|
+
|
|
8
|
+
// src/routing/route-slots.ts
|
|
9
|
+
var SLOT_SEGMENT = /^@([A-Za-z][A-Za-z0-9_-]*)$/;
|
|
10
|
+
function isRouteSlotSegment(segment) {
|
|
11
|
+
return SLOT_SEGMENT.test(segment);
|
|
12
|
+
}
|
|
13
|
+
__name(isRouteSlotSegment, "isRouteSlotSegment");
|
|
14
|
+
function parseRouteSlotFile(filePath) {
|
|
15
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
16
|
+
const parts = normalized.split("/").filter(Boolean);
|
|
17
|
+
const fileName = parts.at(-1) ?? "";
|
|
18
|
+
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte)$/, "");
|
|
19
|
+
if (baseName !== "page" && baseName !== "default") return null;
|
|
20
|
+
const slotIndex = parts.findIndex((part) => SLOT_SEGMENT.test(part));
|
|
21
|
+
if (slotIndex < 0) return null;
|
|
22
|
+
if (parts.slice(slotIndex + 1, -1).some((part) => SLOT_SEGMENT.test(part))) {
|
|
23
|
+
throw new Error(`Nested route slots are not supported in "${filePath}"`);
|
|
24
|
+
}
|
|
25
|
+
const slotMatch = parts[slotIndex].match(SLOT_SEGMENT);
|
|
26
|
+
const name = slotMatch?.[1];
|
|
27
|
+
if (!name) return null;
|
|
28
|
+
const ownerParts = parts.slice(0, slotIndex);
|
|
29
|
+
const contentParts = parts.slice(slotIndex + 1, -1);
|
|
30
|
+
const marker = parseInterceptionMarker(contentParts[0]);
|
|
31
|
+
let targetBase = ownerParts;
|
|
32
|
+
let targetParts = contentParts;
|
|
33
|
+
if (marker) {
|
|
34
|
+
targetBase = marker.root === true ? [] : ownerParts.slice(0, Math.max(0, ownerParts.length - marker.up));
|
|
35
|
+
targetParts = [...marker.remainder ? [marker.remainder] : [], ...contentParts.slice(1)];
|
|
36
|
+
}
|
|
37
|
+
const ownerFile = [...ownerParts, "layout.tsx"].join("/");
|
|
38
|
+
const routeFile = [
|
|
39
|
+
...baseName === "default" ? ownerParts : targetBase,
|
|
40
|
+
...baseName === "default" ? [] : targetParts,
|
|
41
|
+
"page.tsx"
|
|
42
|
+
].join("/");
|
|
43
|
+
return {
|
|
44
|
+
name,
|
|
45
|
+
ownerRoute: parseRoutePath(ownerFile || "layout.tsx"),
|
|
46
|
+
route: parseRoutePath(routeFile || "page.tsx"),
|
|
47
|
+
interception: marker !== null,
|
|
48
|
+
fallback: baseName === "default"
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
__name(parseRouteSlotFile, "parseRouteSlotFile");
|
|
52
|
+
function createRouteSlotContainerId(name, ownerPattern) {
|
|
53
|
+
const owner = ownerPattern === "/" ? "root" : ownerPattern.replace(/^\//, "").replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
54
|
+
return `__farm_slot_${name}_${owner || "root"}__`;
|
|
55
|
+
}
|
|
56
|
+
__name(createRouteSlotContainerId, "createRouteSlotContainerId");
|
|
57
|
+
function parseInterceptionMarker(segment) {
|
|
58
|
+
if (!segment) return null;
|
|
59
|
+
if (segment.startsWith("(...)")) {
|
|
60
|
+
return {
|
|
61
|
+
up: 0,
|
|
62
|
+
root: true,
|
|
63
|
+
remainder: segment.slice(5)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (segment.startsWith("(.)")) {
|
|
67
|
+
return {
|
|
68
|
+
up: 0,
|
|
69
|
+
remainder: segment.slice(3)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
let remainder = segment;
|
|
73
|
+
let up = 0;
|
|
74
|
+
while (remainder.startsWith("(..)")) {
|
|
75
|
+
up += 1;
|
|
76
|
+
remainder = remainder.slice(4);
|
|
77
|
+
}
|
|
78
|
+
return up > 0 ? { up, remainder } : null;
|
|
79
|
+
}
|
|
80
|
+
__name(parseInterceptionMarker, "parseInterceptionMarker");
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
isRouteSlotSegment,
|
|
84
|
+
parseRouteSlotFile,
|
|
85
|
+
createRouteSlotContainerId
|
|
86
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHLJ6MBUZcjs = require('./chunk-HLJ6MBUZ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -14,7 +14,7 @@ async function readFarmI18nCatalogs(config) {
|
|
|
14
14
|
}
|
|
15
15
|
const catalogs = {};
|
|
16
16
|
for (const locale of config.locales) {
|
|
17
|
-
const filePath =
|
|
17
|
+
const filePath = _chunkHLJ6MBUZcjs.resolveFarmI18nMessagePath.call(void 0, config, locale);
|
|
18
18
|
let source;
|
|
19
19
|
try {
|
|
20
20
|
source = await _promises.readFile.call(void 0, filePath, "utf8");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkXXJU7FCCcjs = require('./chunk-XXJU7FCC.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -107,6 +107,11 @@ function createFarmMarkdownRouteModule(input) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmMarkdownRouteModule, "createFarmMarkdownRouteModule");
|
|
110
|
+
var publicSourceResponses = /* @__PURE__ */ new WeakSet();
|
|
111
|
+
function isFarmMarkdownPublicSourceResponse(response) {
|
|
112
|
+
return publicSourceResponses.has(response);
|
|
113
|
+
}
|
|
114
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isFarmMarkdownPublicSourceResponse, "isFarmMarkdownPublicSourceResponse");
|
|
110
115
|
async function createFarmMarkdownSourceResponse(options) {
|
|
111
116
|
if (options.request.method !== "GET" && options.request.method !== "HEAD") {
|
|
112
117
|
return null;
|
|
@@ -116,7 +121,7 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
116
121
|
}
|
|
117
122
|
const url = new URL(options.request.url);
|
|
118
123
|
const hasMarkdownExtension = url.pathname.toLowerCase().endsWith(".md");
|
|
119
|
-
if (!hasMarkdownExtension && !
|
|
124
|
+
if (!hasMarkdownExtension && !_chunkXXJU7FCCcjs.requestAcceptsMarkdown.call(void 0, options.request.headers.get("accept"))) {
|
|
120
125
|
return null;
|
|
121
126
|
}
|
|
122
127
|
const targetPathname = normalizeFarmMarkdownRoutePath(url.pathname);
|
|
@@ -124,6 +129,36 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
124
129
|
if (!source) {
|
|
125
130
|
return null;
|
|
126
131
|
}
|
|
132
|
+
const anonymous = !options.request.headers.has("cookie") && !options.request.headers.has("authorization");
|
|
133
|
+
if (options.renderPage && (hasMarkdownExtension || !anonymous)) {
|
|
134
|
+
const publicUrl = new URL(url);
|
|
135
|
+
publicUrl.pathname = targetPathname;
|
|
136
|
+
const publicHeaders = new Headers(options.request.headers);
|
|
137
|
+
publicHeaders.delete("cookie");
|
|
138
|
+
publicHeaders.delete("authorization");
|
|
139
|
+
publicHeaders.set("accept", "text/markdown");
|
|
140
|
+
const publicResponse = await options.renderPage(
|
|
141
|
+
new Request(publicUrl, {
|
|
142
|
+
method: options.request.method,
|
|
143
|
+
headers: publicHeaders,
|
|
144
|
+
signal: options.request.signal
|
|
145
|
+
})
|
|
146
|
+
);
|
|
147
|
+
if (publicResponse.headers.get("X-Farm-Markdown-Route") === targetPathname) {
|
|
148
|
+
publicSourceResponses.add(publicResponse);
|
|
149
|
+
return publicResponse;
|
|
150
|
+
}
|
|
151
|
+
await _optionalChain([publicResponse, 'access', _11 => _11.body, 'optionalAccess', _12 => _12.cancel, 'call', _13 => _13()]);
|
|
152
|
+
if (!hasMarkdownExtension) return null;
|
|
153
|
+
return new Response(`No public Markdown version of ${targetPathname}.
|
|
154
|
+
`, {
|
|
155
|
+
status: 404,
|
|
156
|
+
headers: {
|
|
157
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
158
|
+
"Cache-Control": "private, no-store"
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
127
162
|
const headers = new Headers({
|
|
128
163
|
"Content-Type": "text/markdown; charset=utf-8",
|
|
129
164
|
"Content-Location": targetPathname === "/" ? "/index.md" : `${targetPathname}.md`,
|
|
@@ -134,7 +169,7 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
134
169
|
if (!hasMarkdownExtension) {
|
|
135
170
|
headers.set("Vary", "Accept");
|
|
136
171
|
}
|
|
137
|
-
return
|
|
172
|
+
return _chunkXXJU7FCCcjs.createFarmMarkdownViewResponse.call(void 0, {
|
|
138
173
|
request: options.request,
|
|
139
174
|
requestUrl: url,
|
|
140
175
|
markdown: source.source,
|
|
@@ -153,4 +188,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmMarkdownSourceResponse, "createF
|
|
|
153
188
|
|
|
154
189
|
|
|
155
190
|
|
|
156
|
-
|
|
191
|
+
|
|
192
|
+
exports.isFarmMarkdownPageFile = isFarmMarkdownPageFile; exports.normalizeFarmMarkdownRoutePath = normalizeFarmMarkdownRoutePath; exports.parseMarkdownFrontmatter = parseMarkdownFrontmatter; exports.titleFromMarkdown = titleFromMarkdown; exports.createMarkdownMetadata = createMarkdownMetadata; exports.createFarmMarkdownRouteModule = createFarmMarkdownRouteModule; exports.isFarmMarkdownPublicSourceResponse = isFarmMarkdownPublicSourceResponse; exports.createFarmMarkdownSourceResponse = createFarmMarkdownSourceResponse;
|
|
@@ -21,6 +21,13 @@ function getRequestStore() {
|
|
|
21
21
|
}
|
|
22
22
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getRequestStore, "getRequestStore");
|
|
23
23
|
var requestStore = getRequestStore();
|
|
24
|
+
var REQUEST_READS_KEY = /* @__PURE__ */ Symbol.for("@farm.js/core/request-reads");
|
|
25
|
+
function getRequestReads() {
|
|
26
|
+
const runtime = globalThis;
|
|
27
|
+
return _nullishCoalesce(runtime[REQUEST_READS_KEY], () => ( (runtime[REQUEST_READS_KEY] = /* @__PURE__ */ new WeakMap())));
|
|
28
|
+
}
|
|
29
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getRequestReads, "getRequestReads");
|
|
30
|
+
var requestReads = getRequestReads();
|
|
24
31
|
_chunkU4KT7QP3cjs._setCurrentRequestResolver.call(void 0, () => requestStore.getStore());
|
|
25
32
|
function resolveFarmRequestURL(req, options = {}) {
|
|
26
33
|
if (options.origin) {
|
|
@@ -109,9 +116,14 @@ function getCurrentRequest() {
|
|
|
109
116
|
"No current request is available. getCurrentRequest() can only be used during server rendering."
|
|
110
117
|
);
|
|
111
118
|
}
|
|
119
|
+
requestReads.set(request, (_nullishCoalesce(requestReads.get(request), () => ( 0))) + 1);
|
|
112
120
|
return request;
|
|
113
121
|
}
|
|
114
122
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getCurrentRequest, "getCurrentRequest");
|
|
123
|
+
function _getRequestReadCount(request = requestStore.getStore()) {
|
|
124
|
+
return request ? _nullishCoalesce(requestReads.get(request), () => ( 0)) : 0;
|
|
125
|
+
}
|
|
126
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, _getRequestReadCount, "_getRequestReadCount");
|
|
115
127
|
function getCurrentRequestOrNull() {
|
|
116
128
|
return _nullishCoalesce(requestStore.getStore(), () => ( null));
|
|
117
129
|
}
|
|
@@ -124,4 +136,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, getCurrentRequestOrNull, "getCurrentReques
|
|
|
124
136
|
|
|
125
137
|
|
|
126
138
|
|
|
127
|
-
|
|
139
|
+
|
|
140
|
+
exports.resolveFarmRequestURL = resolveFarmRequestURL; exports.resolveFarmWebRequestOrigin = resolveFarmWebRequestOrigin; exports.createWebRequestFromFarmRequest = createWebRequestFromFarmRequest; exports._runWithCurrentRequest = _runWithCurrentRequest; exports.getCurrentRequest = getCurrentRequest; exports._getRequestReadCount = _getRequestReadCount; exports.getCurrentRequestOrNull = getCurrentRequestOrNull;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
_runServerFunctionForCaller,
|
|
5
5
|
createServerFn,
|
|
6
6
|
createServerFunctionDescriptor
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HR5KPHC2.mjs";
|
|
8
8
|
import {
|
|
9
9
|
createFarmServerQueryResult
|
|
10
10
|
} from "./chunk-KGB5UXJJ.mjs";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
createRouteDataCacheTag,
|
|
16
16
|
getFarmDataCache
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MSSFIQGM.mjs";
|
|
18
18
|
import {
|
|
19
19
|
createFarmCacheKey,
|
|
20
20
|
createRouteDataCacheKey
|