@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkN4UOK6ZIcjs = require('./chunk-N4UOK6ZI.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunk63H6BKXGcjs = require('./chunk-63H6BKXG.cjs');
|
|
@@ -14,7 +14,7 @@ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
|
14
14
|
var _react = require('react');
|
|
15
15
|
function useServerQuery(query, input, options = {}) {
|
|
16
16
|
const cache = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, );
|
|
17
|
-
const key =
|
|
17
|
+
const key = _chunkN4UOK6ZIcjs.createServerQueryCallKey.call(void 0, query, input);
|
|
18
18
|
const inputRef = _react.useRef.call(void 0, input);
|
|
19
19
|
const optionsRef = _react.useRef.call(void 0, options);
|
|
20
20
|
const mountedKeyRef = _react.useRef.call(void 0, void 0);
|
|
@@ -36,7 +36,7 @@ function useServerQuery(query, input, options = {}) {
|
|
|
36
36
|
const run = _react.useCallback.call(void 0,
|
|
37
37
|
(force = false) => {
|
|
38
38
|
pendingInvalidationRef.current = false;
|
|
39
|
-
return
|
|
39
|
+
return _chunkN4UOK6ZIcjs.fetchServerQuery.call(void 0, query, inputRef.current, {
|
|
40
40
|
...optionsRef.current,
|
|
41
41
|
force
|
|
42
42
|
});
|
|
@@ -56,7 +56,7 @@ function useServerQuery(query, input, options = {}) {
|
|
|
56
56
|
}, [cache, entry, key, options.enabled, run]);
|
|
57
57
|
_react.useEffect.call(void 0, () => {
|
|
58
58
|
if (options.enabled === false) return;
|
|
59
|
-
return
|
|
59
|
+
return _chunkN4UOK6ZIcjs.attachRevalidationListeners.call(void 0,
|
|
60
60
|
() => {
|
|
61
61
|
if (cache.isStale(key)) void run().catch(() => void 0);
|
|
62
62
|
},
|
|
@@ -11,7 +11,7 @@ var _chunkSOR334EBcjs = require('./chunk-SOR334EB.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkYWN746UScjs = require('./chunk-YWN746US.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
var _chunkNYJMY3JAcjs = require('./chunk-NYJMY3JA.cjs');
|
|
@@ -282,7 +282,7 @@ function createRouteModuleFromProgrammaticPage(route, rendererRuntime) {
|
|
|
282
282
|
default: createProgrammaticPageComponent(route, rendererRuntime),
|
|
283
283
|
..._chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0, route, `Route "${route.path}"`)
|
|
284
284
|
};
|
|
285
|
-
if (route.params || route.search || route
|
|
285
|
+
if (route.params || route.search || hasProgrammaticServerProps(route)) {
|
|
286
286
|
mod.__farmRouteSchemas = {
|
|
287
287
|
params: route.params,
|
|
288
288
|
search: getProgrammaticRouteSearchSchema(route.search)
|
|
@@ -346,7 +346,7 @@ function scanProgrammaticPagePaths(source) {
|
|
|
346
346
|
}
|
|
347
347
|
_chunkS3JO3N4Hcjs.__name.call(void 0, scanProgrammaticPagePaths, "scanProgrammaticPagePaths");
|
|
348
348
|
function createProgrammaticPageComponent(route, rendererRuntime) {
|
|
349
|
-
if (!route.params && !route.search && !route
|
|
349
|
+
if (!route.params && !route.search && !hasProgrammaticServerProps(route) && !route.pending && !route.error && !route.notFound) {
|
|
350
350
|
return route.component;
|
|
351
351
|
}
|
|
352
352
|
const createElement = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (...args) => {
|
|
@@ -391,7 +391,22 @@ function createProgrammaticPageComponent(route, rendererRuntime) {
|
|
|
391
391
|
createElement(PageContent, props)
|
|
392
392
|
);
|
|
393
393
|
}, "FarmProgrammaticPage");
|
|
394
|
-
return
|
|
394
|
+
return markClientStrippedPage(
|
|
395
|
+
route,
|
|
396
|
+
markFunctionComponent(FarmProgrammaticPage)
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
if (getClientStrippedServerHooks(route)) {
|
|
400
|
+
const FarmProgrammaticClientPage = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, function FarmProgrammaticClientPage2(props) {
|
|
401
|
+
if (!isProgrammaticRoutePropsResolved(props)) {
|
|
402
|
+
throw createClientStrippedRouteError(route);
|
|
403
|
+
}
|
|
404
|
+
return createElement(Component, stripProgrammaticRoutePropsMarker(props));
|
|
405
|
+
}, "FarmProgrammaticClientPage");
|
|
406
|
+
return markClientStrippedPage(
|
|
407
|
+
route,
|
|
408
|
+
markFunctionComponent(FarmProgrammaticClientPage)
|
|
409
|
+
);
|
|
395
410
|
}
|
|
396
411
|
const FarmProgrammaticPageContent = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async function FarmProgrammaticPageContent2(props) {
|
|
397
412
|
try {
|
|
@@ -410,9 +425,34 @@ function createProgrammaticPageComponent(route, rendererRuntime) {
|
|
|
410
425
|
throw error;
|
|
411
426
|
}
|
|
412
427
|
}, "FarmProgrammaticPageContent");
|
|
413
|
-
return
|
|
428
|
+
return markClientStrippedPage(
|
|
429
|
+
route,
|
|
430
|
+
markFunctionComponent(FarmProgrammaticPageContent)
|
|
431
|
+
);
|
|
414
432
|
}
|
|
415
433
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createProgrammaticPageComponent, "createProgrammaticPageComponent");
|
|
434
|
+
function getClientStrippedServerHooks(route) {
|
|
435
|
+
const hooks = route.__farmServerHooks;
|
|
436
|
+
return Array.isArray(hooks) && hooks.length > 0 ? hooks : void 0;
|
|
437
|
+
}
|
|
438
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getClientStrippedServerHooks, "getClientStrippedServerHooks");
|
|
439
|
+
function createClientStrippedRouteError(route) {
|
|
440
|
+
return new Error(
|
|
441
|
+
`Route "${route.path}" resolves its ${getClientStrippedServerHooks(route).join(" and ")} on the server; the browser can only render it with server-resolved props.`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createClientStrippedRouteError, "createClientStrippedRouteError");
|
|
445
|
+
function hasProgrammaticServerProps(route) {
|
|
446
|
+
return Boolean(route.guard || route.data || getClientStrippedServerHooks(route));
|
|
447
|
+
}
|
|
448
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, hasProgrammaticServerProps, "hasProgrammaticServerProps");
|
|
449
|
+
function markClientStrippedPage(route, component) {
|
|
450
|
+
if (getClientStrippedServerHooks(route) && typeof component === "function") {
|
|
451
|
+
Object.defineProperty(component, "__farmServerProps", { value: true });
|
|
452
|
+
}
|
|
453
|
+
return component;
|
|
454
|
+
}
|
|
455
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, markClientStrippedPage, "markClientStrippedPage");
|
|
416
456
|
function readProgrammaticRouteProps(route, props, resources) {
|
|
417
457
|
if (isProgrammaticRoutePropsResolved(props)) {
|
|
418
458
|
return props;
|
|
@@ -479,6 +519,9 @@ async function resolveProgrammaticRouteProps(route, props) {
|
|
|
479
519
|
props.path,
|
|
480
520
|
route.path
|
|
481
521
|
);
|
|
522
|
+
if (getClientStrippedServerHooks(route)) {
|
|
523
|
+
throw createClientStrippedRouteError(route);
|
|
524
|
+
}
|
|
482
525
|
const routeContextValue = _chunk6QQDAAAZcjs.getFarmRouteContext.call(void 0, props);
|
|
483
526
|
const pluginContext = props.context;
|
|
484
527
|
const baseProps = {
|
|
@@ -529,7 +572,7 @@ async function resolveProgrammaticRouteData(route, dataHooks, context) {
|
|
|
529
572
|
const cacheKey = _chunkNYJMY3JAcjs.createFarmCacheKey.call(void 0, ["route-data", routeDataKey]);
|
|
530
573
|
const cacheOptions = {
|
|
531
574
|
tags: [
|
|
532
|
-
|
|
575
|
+
_chunkYWN746UScjs.createRouteDataCacheTag.call(void 0, routeDataKey),
|
|
533
576
|
...await resolveProgrammaticRouteDataKeys(dataHooks.tags, context)
|
|
534
577
|
],
|
|
535
578
|
paths: [
|
|
@@ -538,7 +581,7 @@ async function resolveProgrammaticRouteData(route, dataHooks, context) {
|
|
|
538
581
|
],
|
|
539
582
|
revalidate: normalizeProgrammaticRouteStaleTime(dataHooks.staleTime)
|
|
540
583
|
};
|
|
541
|
-
return
|
|
584
|
+
return _chunkYWN746UScjs.getFarmDataCache.call(void 0, ).getOrSet(cacheKey, () => dataHooks.main(context), cacheOptions);
|
|
542
585
|
}
|
|
543
586
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveProgrammaticRouteData, "resolveProgrammaticRouteData");
|
|
544
587
|
async function resolveProgrammaticRouteDataKeys(input, context) {
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
compileMiddlewareConfig,
|
|
3
|
-
compileMiddlewareRoute,
|
|
4
|
-
matchesMiddlewareConfig,
|
|
5
|
-
matchesMiddlewareRoute,
|
|
6
2
|
normalizeMiddlewareModule,
|
|
7
3
|
parseMiddlewareCookieHeader,
|
|
8
4
|
serializeMiddlewareCookie,
|
|
9
5
|
serializeMiddlewareCookieDeletion
|
|
10
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2NNMOPDN.mjs";
|
|
7
|
+
import {
|
|
8
|
+
compileMiddlewareConfig,
|
|
9
|
+
compileMiddlewareRoute,
|
|
10
|
+
matchesMiddlewareConfig,
|
|
11
|
+
matchesMiddlewareConfigAt,
|
|
12
|
+
matchesMiddlewareRouteAt
|
|
13
|
+
} from "./chunk-JG6DJF5A.mjs";
|
|
14
|
+
import {
|
|
15
|
+
createFarmAPIMiddlewarePathnames
|
|
16
|
+
} from "./chunk-BTHHUD7Q.mjs";
|
|
11
17
|
import {
|
|
12
18
|
emitFarmEvent
|
|
13
19
|
} from "./chunk-FUZEBRP3.mjs";
|
|
@@ -469,6 +475,7 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
469
475
|
const entries = [...configMiddleware.entries, ...fileMiddleware];
|
|
470
476
|
const globalConfig = configMiddleware.globalConfig;
|
|
471
477
|
if (globalConfig) compileMiddlewareConfig(globalConfig);
|
|
478
|
+
const toMiddlewarePathnames = createFarmAPIMiddlewarePathnames(options.apiBasePath);
|
|
472
479
|
return /* @__PURE__ */ __name(async function runProductionMiddleware(request, requestOptions = {}) {
|
|
473
480
|
if (!globalConfig && entries.length === 0) {
|
|
474
481
|
return emptyResult(request);
|
|
@@ -481,10 +488,22 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
481
488
|
);
|
|
482
489
|
let ctx = contextState.ctx;
|
|
483
490
|
let currentRequest = contextState.getRequest();
|
|
484
|
-
const
|
|
491
|
+
const toRoutePathname = /* @__PURE__ */ __name((pathname) => options.i18n?.enabled ? stripFarmLocaleFromPathname(pathname, options.i18n) : stripFarmBasePath(pathname, options.i18n?.basePath ?? "/"), "toRoutePathname");
|
|
492
|
+
const initialRequestPathname = ctx.pathname;
|
|
493
|
+
const initialPathname = toRoutePathname(initialRequestPathname);
|
|
494
|
+
const matchPathnames = /* @__PURE__ */ __name((pathname, requestPathname) => options.rawPathRouting && requestPathname !== pathname ? [
|
|
495
|
+
.../* @__PURE__ */ new Set([
|
|
496
|
+
...toMiddlewarePathnames(pathname),
|
|
497
|
+
...toMiddlewarePathnames(requestPathname)
|
|
498
|
+
])
|
|
499
|
+
] : toMiddlewarePathnames(pathname), "matchPathnames");
|
|
485
500
|
let parentData;
|
|
486
501
|
if (globalConfig) {
|
|
487
|
-
const globalMatch =
|
|
502
|
+
const globalMatch = matchesMiddlewareConfigAt(
|
|
503
|
+
matchPathnames(initialPathname, initialRequestPathname),
|
|
504
|
+
globalConfig,
|
|
505
|
+
ctx
|
|
506
|
+
);
|
|
488
507
|
if (!globalMatch.matched) {
|
|
489
508
|
return emptyResult(request);
|
|
490
509
|
}
|
|
@@ -492,26 +511,32 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
492
511
|
ctx.params = { ...ctx.params, ...globalMatch.params };
|
|
493
512
|
}
|
|
494
513
|
}
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
514
|
+
const ran = /* @__PURE__ */ new Set();
|
|
515
|
+
function* applicableMiddleware() {
|
|
516
|
+
for (let pathname = initialPathname, requestPathname = initialRequestPathname, pass = 0; ; pass++) {
|
|
517
|
+
const pathnames = matchPathnames(pathname, requestPathname);
|
|
518
|
+
if (pass > 0 && globalConfig) {
|
|
519
|
+
if (!matchesMiddlewareConfigAt(pathnames, globalConfig, ctx).matched) return;
|
|
520
|
+
}
|
|
521
|
+
for (const entry of entries) {
|
|
522
|
+
if (ran.has(entry)) continue;
|
|
523
|
+
const routeMatch = entry.source === "config" ? { matched: true } : matchesMiddlewareRouteAt(pathnames, entry);
|
|
524
|
+
if (routeMatch.matched) yield { entry, routeMatch, pathname, pathnames };
|
|
525
|
+
}
|
|
526
|
+
const rewrittenRequestPathname = new URL(currentRequest.url).pathname;
|
|
527
|
+
const rewrittenPathname = toRoutePathname(rewrittenRequestPathname);
|
|
528
|
+
if (rewrittenPathname === pathname && rewrittenRequestPathname === requestPathname) return;
|
|
529
|
+
pathname = rewrittenPathname;
|
|
530
|
+
requestPathname = rewrittenRequestPathname;
|
|
531
|
+
}
|
|
508
532
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
const configMatch = entry.config ?
|
|
533
|
+
__name(applicableMiddleware, "applicableMiddleware");
|
|
534
|
+
for (const { entry, routeMatch, pathname, pathnames } of applicableMiddleware()) {
|
|
535
|
+
const configMatch = entry.config ? matchesMiddlewareConfigAt(pathnames, entry.config, ctx) : { matched: true };
|
|
512
536
|
if (!configMatch.matched) {
|
|
513
537
|
continue;
|
|
514
538
|
}
|
|
539
|
+
ran.add(entry);
|
|
515
540
|
if (parentData) {
|
|
516
541
|
contextState = createWebMiddlewareContext(
|
|
517
542
|
currentRequest,
|
|
@@ -530,7 +555,7 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
530
555
|
const middlewareStartTime = Date.now();
|
|
531
556
|
const middlewareEvent = {
|
|
532
557
|
route: entry.path,
|
|
533
|
-
pathname
|
|
558
|
+
pathname,
|
|
534
559
|
name: entry.filePath
|
|
535
560
|
};
|
|
536
561
|
emitFarmEvent({ type: "middleware.start", ...middlewareEvent });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkYWN746UScjs = require('./chunk-YWN746US.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkARJWXNQLcjs = require('./chunk-ARJWXNQL.cjs');
|
|
@@ -220,7 +220,7 @@ async function applyEndpointInvalidations(declaration, context, result) {
|
|
|
220
220
|
"Endpoint invalidates must resolve to an array of { key }, { path }, or { tag } targets"
|
|
221
221
|
);
|
|
222
222
|
}
|
|
223
|
-
return
|
|
223
|
+
return _chunkYWN746UScjs.applyFarmCacheInvalidationTargets.call(void 0, targets);
|
|
224
224
|
}
|
|
225
225
|
_chunkS3JO3N4Hcjs.__name.call(void 0, applyEndpointInvalidations, "applyEndpointInvalidations");
|
|
226
226
|
function createInitialEndpointContext(value) {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-IOEH4VWN.mjs";
|
|
7
7
|
import {
|
|
8
8
|
APIRouteConflictError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LMJ7VRHZ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
findProgrammaticRouteFilesInDir
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UDNPLXW7.mjs";
|
|
13
13
|
import {
|
|
14
14
|
isFarmAPIRouteFileName
|
|
15
15
|
} from "./chunk-CU625VAY.mjs";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
matchAPIRouteAtBasePath,
|
|
21
21
|
mergePluginAPIRoutes,
|
|
22
22
|
resolveAPIRouteEndpoint
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-657WJNRY.mjs";
|
|
24
24
|
import {
|
|
25
25
|
isProgrammaticRoutesFileName
|
|
26
26
|
} from "./chunk-EA5K5BKU.mjs";
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
} from "./chunk-Z2RZJZIZ.mjs";
|
|
45
45
|
import {
|
|
46
46
|
resolveFarmRequestURL
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-FDR64H6B.mjs";
|
|
48
48
|
import {
|
|
49
49
|
AmbiguousRouteError,
|
|
50
50
|
assertUniqueRouteParameters,
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import {
|
|
2
|
+
canonicalizeRequestPathname
|
|
3
|
+
} from "./chunk-CQ6OSQ3K.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
7
|
+
|
|
8
|
+
// src/middleware/matcher.ts
|
|
9
|
+
var compiledConfigCache = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
var compiledRouteCache = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
function compileMiddlewareRoute(entry) {
|
|
12
|
+
const path = entry.path;
|
|
13
|
+
if (path === "/") return void 0;
|
|
14
|
+
const cached = compiledRouteCache.get(entry);
|
|
15
|
+
if (cached?.path === path) return cached;
|
|
16
|
+
const compiled = {
|
|
17
|
+
path,
|
|
18
|
+
exact: compilePattern(path),
|
|
19
|
+
nested: compilePattern(`${path}/:__farmRest*`)
|
|
20
|
+
};
|
|
21
|
+
compiledRouteCache.set(entry, compiled);
|
|
22
|
+
return compiled;
|
|
23
|
+
}
|
|
24
|
+
__name(compileMiddlewareRoute, "compileMiddlewareRoute");
|
|
25
|
+
function matchesMiddlewareRoute(pathname, entry) {
|
|
26
|
+
const compiled = compileMiddlewareRoute(entry);
|
|
27
|
+
if (!compiled) return { matched: true };
|
|
28
|
+
const canonicalPathname = canonicalizeRequestPathname(pathname);
|
|
29
|
+
const exactMatch = matchPattern(compiled.exact, canonicalPathname);
|
|
30
|
+
if (exactMatch.matched) return exactMatch;
|
|
31
|
+
const nestedMatch = matchPattern(compiled.nested, canonicalPathname);
|
|
32
|
+
if (!nestedMatch.matched) return { matched: false };
|
|
33
|
+
const params = { ...nestedMatch.params };
|
|
34
|
+
delete params.__farmRest;
|
|
35
|
+
return { matched: true, params: Object.keys(params).length > 0 ? params : void 0 };
|
|
36
|
+
}
|
|
37
|
+
__name(matchesMiddlewareRoute, "matchesMiddlewareRoute");
|
|
38
|
+
function matchesMiddlewareRouteAt(pathnames, entry) {
|
|
39
|
+
for (const pathname of pathnames) {
|
|
40
|
+
const match = matchesMiddlewareRoute(pathname, entry);
|
|
41
|
+
if (match.matched) return match;
|
|
42
|
+
}
|
|
43
|
+
return { matched: false };
|
|
44
|
+
}
|
|
45
|
+
__name(matchesMiddlewareRouteAt, "matchesMiddlewareRouteAt");
|
|
46
|
+
function sameEntries(current, previous) {
|
|
47
|
+
return current === void 0 || previous === void 0 ? current === previous : current.length === previous.length && current.every((entry, index) => entry === previous[index]);
|
|
48
|
+
}
|
|
49
|
+
__name(sameEntries, "sameEntries");
|
|
50
|
+
function toMatcherList(matcher) {
|
|
51
|
+
if (!matcher) return [];
|
|
52
|
+
return Array.isArray(matcher) ? matcher : [matcher];
|
|
53
|
+
}
|
|
54
|
+
__name(toMatcherList, "toMatcherList");
|
|
55
|
+
function escapeRegex(value) {
|
|
56
|
+
return value.replace(/[|\\{}()[\]^$*+?.]/g, "\\$&");
|
|
57
|
+
}
|
|
58
|
+
__name(escapeRegex, "escapeRegex");
|
|
59
|
+
function parseColonParam(segment) {
|
|
60
|
+
const raw = segment.slice(1);
|
|
61
|
+
const last = raw[raw.length - 1];
|
|
62
|
+
const modifier = last === "*" || last === "+" || last === "?" ? last : void 0;
|
|
63
|
+
return {
|
|
64
|
+
name: modifier ? raw.slice(0, -1) : raw,
|
|
65
|
+
modifier
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
__name(parseColonParam, "parseColonParam");
|
|
69
|
+
function compilePathPattern(pattern, trailingSlash = false) {
|
|
70
|
+
const params = [];
|
|
71
|
+
const segments = pattern.split("/").filter(Boolean);
|
|
72
|
+
if (segments.length === 0) {
|
|
73
|
+
return { kind: "path", regex: /^\/$/, params };
|
|
74
|
+
}
|
|
75
|
+
const parts = segments.map((segment) => {
|
|
76
|
+
if (segment === "**") {
|
|
77
|
+
return "(?:/.*)?";
|
|
78
|
+
}
|
|
79
|
+
if (segment === "*") {
|
|
80
|
+
return "/[^/]+";
|
|
81
|
+
}
|
|
82
|
+
if (segment.startsWith(":")) {
|
|
83
|
+
const { name, modifier } = parseColonParam(segment);
|
|
84
|
+
params.push(name);
|
|
85
|
+
if (modifier === "*") {
|
|
86
|
+
return "(?:/(.*))?";
|
|
87
|
+
}
|
|
88
|
+
if (modifier === "+") {
|
|
89
|
+
return "/(.+)";
|
|
90
|
+
}
|
|
91
|
+
if (modifier === "?") {
|
|
92
|
+
return "(?:/([^/]+))?";
|
|
93
|
+
}
|
|
94
|
+
return "/([^/]+)";
|
|
95
|
+
}
|
|
96
|
+
if (segment.startsWith("[[...") && segment.endsWith("]]")) {
|
|
97
|
+
params.push(segment.slice(5, -2));
|
|
98
|
+
return "(?:/(.*))?";
|
|
99
|
+
}
|
|
100
|
+
if (segment.startsWith("[...") && segment.endsWith("]")) {
|
|
101
|
+
params.push(segment.slice(4, -1));
|
|
102
|
+
return "(?:/(.*))?";
|
|
103
|
+
}
|
|
104
|
+
if (segment.startsWith("[") && segment.endsWith("]")) {
|
|
105
|
+
params.push(segment.slice(1, -1));
|
|
106
|
+
return "/([^/]+)";
|
|
107
|
+
}
|
|
108
|
+
return `/${escapeRegex(segment).replace(/\\\*/g, "[^/]*")}`;
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
kind: "path",
|
|
112
|
+
regex: new RegExp(`^${parts.join("")}${trailingSlash ? "/?" : ""}$`),
|
|
113
|
+
params
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
__name(compilePathPattern, "compilePathPattern");
|
|
117
|
+
function compileMatcherPattern(pattern) {
|
|
118
|
+
if (typeof pattern === "string" && pattern !== "*" && !pattern.endsWith("(.*)")) {
|
|
119
|
+
return compilePathPattern(pattern, true);
|
|
120
|
+
}
|
|
121
|
+
return compilePattern(pattern);
|
|
122
|
+
}
|
|
123
|
+
__name(compileMatcherPattern, "compileMatcherPattern");
|
|
124
|
+
function compilePattern(pattern) {
|
|
125
|
+
if (pattern instanceof RegExp) {
|
|
126
|
+
return { kind: "regexp", regex: pattern };
|
|
127
|
+
}
|
|
128
|
+
if (pattern === "*" || pattern === "/(.*)") {
|
|
129
|
+
return { kind: "all" };
|
|
130
|
+
}
|
|
131
|
+
if (pattern.endsWith("(.*)")) {
|
|
132
|
+
return {
|
|
133
|
+
kind: "subtree",
|
|
134
|
+
prefix: pattern.slice(0, -4).replace(/\/$/, "")
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return compilePathPattern(pattern);
|
|
138
|
+
}
|
|
139
|
+
__name(compilePattern, "compilePattern");
|
|
140
|
+
function compileMiddlewareConfig(config) {
|
|
141
|
+
const compiled = {
|
|
142
|
+
matcher: config.matcher ? toMatcherList(config.matcher).map(
|
|
143
|
+
(matcher) => typeof matcher === "function" ? matcher : compileMatcherPattern(matcher)
|
|
144
|
+
) : void 0,
|
|
145
|
+
exclude: config.exclude?.map(compilePattern)
|
|
146
|
+
};
|
|
147
|
+
compiledConfigCache.set(config, {
|
|
148
|
+
compiled,
|
|
149
|
+
matcher: config.matcher,
|
|
150
|
+
matcherEntries: Array.isArray(config.matcher) ? config.matcher.slice() : void 0,
|
|
151
|
+
excludeEntries: config.exclude?.slice()
|
|
152
|
+
});
|
|
153
|
+
return compiled;
|
|
154
|
+
}
|
|
155
|
+
__name(compileMiddlewareConfig, "compileMiddlewareConfig");
|
|
156
|
+
function matchPattern(pattern, pathname) {
|
|
157
|
+
if (pattern.kind === "all") {
|
|
158
|
+
return { matched: true };
|
|
159
|
+
}
|
|
160
|
+
if (pattern.kind === "subtree") {
|
|
161
|
+
return {
|
|
162
|
+
matched: pathname === pattern.prefix || pathname.startsWith(`${pattern.prefix}/`)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
pattern.regex.lastIndex = 0;
|
|
166
|
+
const match = pattern.regex.exec(pathname);
|
|
167
|
+
if (!match) {
|
|
168
|
+
return { matched: false };
|
|
169
|
+
}
|
|
170
|
+
if (pattern.kind === "regexp") {
|
|
171
|
+
return {
|
|
172
|
+
matched: true,
|
|
173
|
+
params: match.groups ? { ...match.groups } : void 0
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
const values = {};
|
|
177
|
+
pattern.params.forEach((param, index) => {
|
|
178
|
+
values[param] = match[index + 1] || "";
|
|
179
|
+
});
|
|
180
|
+
return {
|
|
181
|
+
matched: true,
|
|
182
|
+
params: Object.keys(values).length > 0 ? values : void 0
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
__name(matchPattern, "matchPattern");
|
|
186
|
+
function matchesCompiledMiddlewareConfig(pathname, config, ctx) {
|
|
187
|
+
let canonicalPathname;
|
|
188
|
+
const getCanonicalPathname = /* @__PURE__ */ __name(() => canonicalPathname ?? (canonicalPathname = canonicalizeRequestPathname(pathname)), "getCanonicalPathname");
|
|
189
|
+
if (config.exclude) {
|
|
190
|
+
for (const pattern of config.exclude) {
|
|
191
|
+
if (matchPattern(pattern, getCanonicalPathname()).matched) {
|
|
192
|
+
return { matched: false };
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (config.matcher) {
|
|
197
|
+
for (const matcher of config.matcher) {
|
|
198
|
+
if (typeof matcher === "function") {
|
|
199
|
+
if (matcher(ctx)) {
|
|
200
|
+
return { matched: true };
|
|
201
|
+
}
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
const result = matchPattern(matcher, getCanonicalPathname());
|
|
205
|
+
if (result.matched) {
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return { matched: false };
|
|
210
|
+
}
|
|
211
|
+
return { matched: true };
|
|
212
|
+
}
|
|
213
|
+
__name(matchesCompiledMiddlewareConfig, "matchesCompiledMiddlewareConfig");
|
|
214
|
+
function matchesMiddlewareConfig(pathname, config, ctx) {
|
|
215
|
+
const cached = compiledConfigCache.get(config);
|
|
216
|
+
const unchanged = cached && (Array.isArray(config.matcher) ? sameEntries(config.matcher, cached.matcherEntries) : config.matcher === cached.matcher) && sameEntries(config.exclude, cached.excludeEntries);
|
|
217
|
+
const compiled = unchanged ? cached.compiled : compileMiddlewareConfig(config);
|
|
218
|
+
return matchesCompiledMiddlewareConfig(pathname, compiled, ctx);
|
|
219
|
+
}
|
|
220
|
+
__name(matchesMiddlewareConfig, "matchesMiddlewareConfig");
|
|
221
|
+
function matchesMiddlewareConfigAt(pathnames, config, ctx) {
|
|
222
|
+
for (const pathname of pathnames) {
|
|
223
|
+
const match = matchesMiddlewareConfig(pathname, config, ctx);
|
|
224
|
+
if (match.matched) return match;
|
|
225
|
+
}
|
|
226
|
+
return { matched: false };
|
|
227
|
+
}
|
|
228
|
+
__name(matchesMiddlewareConfigAt, "matchesMiddlewareConfigAt");
|
|
229
|
+
|
|
230
|
+
export {
|
|
231
|
+
compileMiddlewareRoute,
|
|
232
|
+
matchesMiddlewareRoute,
|
|
233
|
+
matchesMiddlewareRouteAt,
|
|
234
|
+
compileMiddlewareConfig,
|
|
235
|
+
matchesCompiledMiddlewareConfig,
|
|
236
|
+
matchesMiddlewareConfig,
|
|
237
|
+
matchesMiddlewareConfigAt
|
|
238
|
+
};
|
|
@@ -9,17 +9,23 @@ function parseRequestCookieHeader(header) {
|
|
|
9
9
|
const separatorIndex = part.indexOf("=");
|
|
10
10
|
if (separatorIndex === -1) {
|
|
11
11
|
return {
|
|
12
|
-
name:
|
|
12
|
+
name: decodeCookieName(part),
|
|
13
13
|
value: ""
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
return {
|
|
17
|
-
name:
|
|
17
|
+
name: decodeCookieName(part.slice(0, separatorIndex).trim()),
|
|
18
18
|
value: decodeCookiePart(part.slice(separatorIndex + 1).trim())
|
|
19
19
|
};
|
|
20
20
|
}).filter((cookie) => cookie.name.length > 0);
|
|
21
21
|
}
|
|
22
22
|
__name(parseRequestCookieHeader, "parseRequestCookieHeader");
|
|
23
|
+
var RESERVED_PREFIX = /^__(host|secure)-/i;
|
|
24
|
+
function decodeCookieName(raw) {
|
|
25
|
+
const decoded = decodeCookiePart(raw);
|
|
26
|
+
return RESERVED_PREFIX.test(decoded) && !RESERVED_PREFIX.test(raw) ? raw : decoded;
|
|
27
|
+
}
|
|
28
|
+
__name(decodeCookieName, "decodeCookieName");
|
|
23
29
|
function decodeCookiePart(value) {
|
|
24
30
|
try {
|
|
25
31
|
return decodeURIComponent(value);
|
|
@@ -30,5 +36,6 @@ function decodeCookiePart(value) {
|
|
|
30
36
|
__name(decodeCookiePart, "decodeCookiePart");
|
|
31
37
|
|
|
32
38
|
export {
|
|
33
|
-
parseRequestCookieHeader
|
|
39
|
+
parseRequestCookieHeader,
|
|
40
|
+
decodeCookieName
|
|
34
41
|
};
|
|
@@ -25,6 +25,19 @@ function resolveFarmAPICanonicalPathname(pathname, serverBasePath = _chunkS3A45T
|
|
|
25
25
|
return pathname;
|
|
26
26
|
}
|
|
27
27
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAPICanonicalPathname, "resolveFarmAPICanonicalPathname");
|
|
28
|
+
function createFarmAPIMiddlewarePathnames(serverBasePath = _chunkS3A45T7Fcjs.DEFAULT_FARM_API_BASE_PATH) {
|
|
29
|
+
const basePath = _chunkS3A45T7Fcjs.normalizeFarmAPIBasePath.call(void 0, serverBasePath);
|
|
30
|
+
if (basePath === _chunkS3A45T7Fcjs.DEFAULT_FARM_API_BASE_PATH) return (pathname) => [pathname];
|
|
31
|
+
const prefix = _chunkS3A45T7Fcjs.DEFAULT_FARM_API_BASE_PATH;
|
|
32
|
+
return (pathname) => {
|
|
33
|
+
const canonical = resolveFarmAPICanonicalPathname(pathname, basePath);
|
|
34
|
+
if (canonical !== prefix && !canonical.startsWith(`${prefix}/`)) return [pathname];
|
|
35
|
+
const suffix = canonical.slice(prefix.length);
|
|
36
|
+
const publicPath = basePath === "/" ? suffix || "/" : `${basePath}${suffix}`;
|
|
37
|
+
return [.../* @__PURE__ */ new Set([pathname, canonical, publicPath])];
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmAPIMiddlewarePathnames, "createFarmAPIMiddlewarePathnames");
|
|
28
41
|
function resolveFarmAPIServerRoutePath(routePath, serverBasePath = _chunkS3A45T7Fcjs.DEFAULT_FARM_API_BASE_PATH) {
|
|
29
42
|
return _chunkS3A45T7Fcjs.resolveFarmAPIRequestURL.call(void 0, routePath, serverBasePath).pathname;
|
|
30
43
|
}
|
|
@@ -34,4 +47,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAPIServerRoutePath, "resolveFar
|
|
|
34
47
|
|
|
35
48
|
|
|
36
49
|
|
|
37
|
-
|
|
50
|
+
|
|
51
|
+
exports.resolveFarmAPIServerBasePath = resolveFarmAPIServerBasePath; exports.resolveFarmAPICanonicalPathname = resolveFarmAPICanonicalPathname; exports.createFarmAPIMiddlewarePathnames = createFarmAPIMiddlewarePathnames; exports.resolveFarmAPIServerRoutePath = resolveFarmAPIServerRoutePath;
|
|
@@ -6,7 +6,10 @@ var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
|
|
|
6
6
|
var _chunk7W3CPVXScjs = require('./chunk-7W3CPVXS.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkAI7QMY7Ocjs = require('./chunk-AI7QMY7O.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkUXFQ3UDAcjs = require('./chunk-UXFQ3UDA.cjs');
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -17,12 +20,12 @@ function _setDefaultFarmThemeConfig(config, basePath = "/") {
|
|
|
17
20
|
defaultThemeConfig = _chunkOI6CMLWXcjs.resolveFarmThemeConfig.call(void 0, config, basePath);
|
|
18
21
|
}
|
|
19
22
|
_chunkS3JO3N4Hcjs.__name.call(void 0, _setDefaultFarmThemeConfig, "_setDefaultFarmThemeConfig");
|
|
20
|
-
function getTheme(request =
|
|
23
|
+
function getTheme(request = _chunkUXFQ3UDAcjs.getCurrentRequestOrNull.call(void 0, )) {
|
|
21
24
|
if (!request) return defaultThemeConfig.default;
|
|
22
25
|
return readFarmThemePreference(request, defaultThemeConfig);
|
|
23
26
|
}
|
|
24
27
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getTheme, "getTheme");
|
|
25
|
-
function getThemeSnapshot(request =
|
|
28
|
+
function getThemeSnapshot(request = _chunkUXFQ3UDAcjs.getCurrentRequestOrNull.call(void 0, )) {
|
|
26
29
|
const theme = request ? readFarmThemePreference(request, defaultThemeConfig) : defaultThemeConfig.default;
|
|
27
30
|
return {
|
|
28
31
|
theme,
|
|
@@ -42,7 +45,7 @@ function readCookie(cookieHeader, name) {
|
|
|
42
45
|
for (const entry of cookieHeader.split(";")) {
|
|
43
46
|
const separator = entry.indexOf("=");
|
|
44
47
|
if (separator < 0) continue;
|
|
45
|
-
const key =
|
|
48
|
+
const key = _chunkAI7QMY7Ocjs.decodeCookieName.call(void 0, entry.slice(0, separator).trim());
|
|
46
49
|
if (key !== name) continue;
|
|
47
50
|
return decodeCookieValue(entry.slice(separator + 1).trim());
|
|
48
51
|
}
|