@farm.js/core 0.1.35 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{metadata-BnLDsUOS.d.ts → agent-mcp-BC0bAGVF.d.mts} +45 -2
- package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
- package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
- package/dist/{metadata-WGpBYcGn.d.mts → agent-mcp-jyDHbQKe.d.ts} +45 -2
- package/dist/agent-runtime.cjs +6 -4
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +5 -3
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +9 -9
- package/dist/api/route-manager.d.mts +10 -4
- package/dist/api/route-manager.d.ts +10 -4
- package/dist/api/route-manager.mjs +8 -8
- package/dist/api/runtime.cjs +6 -6
- package/dist/api/runtime.d.mts +4 -62
- package/dist/api/runtime.d.ts +4 -62
- package/dist/api/runtime.mjs +5 -5
- package/dist/api.cjs +13 -12
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +12 -11
- package/dist/{app-BXB3JZYc.d.ts → app-CKO3iN1c.d.ts} +17 -3
- package/dist/{app-D_j9AAVL.d.mts → app-Cbkj9ufe.d.mts} +17 -3
- package/dist/app-markdown.cjs +6 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +5 -3
- package/dist/{chunk-F7JZENPF.cjs → chunk-3A4KGQYI.cjs} +38 -30
- package/dist/{chunk-4MMGO7YW.cjs → chunk-3IP27TCG.cjs} +43 -32
- package/dist/{chunk-FDR64H6B.mjs → chunk-3KGDJLJK.mjs} +41 -2
- package/dist/{chunk-UJD4PHYB.mjs → chunk-4E5WBPEG.mjs} +72 -354
- package/dist/{chunk-KXWRO25S.cjs → chunk-4GPOC4LN.cjs} +3 -3
- package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
- package/dist/{chunk-4KU5Q7C2.mjs → chunk-4P6ULFMD.mjs} +253 -67
- package/dist/chunk-4WQ6PGSJ.cjs +367 -0
- package/dist/{chunk-SMHH4VDG.mjs → chunk-4WVJLURN.mjs} +1 -1
- package/dist/{chunk-2F2ER724.cjs → chunk-5BXGGEC7.cjs} +27 -22
- package/dist/{chunk-3BHT4WMP.cjs → chunk-5D2JIPLH.cjs} +8 -8
- package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
- package/dist/{chunk-GFHLGIYC.cjs → chunk-6LGFV2CQ.cjs} +8 -8
- package/dist/chunk-6SJ2KJTA.mjs +314 -0
- package/dist/{chunk-PFQKNERH.cjs → chunk-6TJITR2B.cjs} +457 -218
- package/dist/{chunk-73MC7ZL6.cjs → chunk-75X755YZ.cjs} +2 -2
- package/dist/{chunk-3UH7MRCP.cjs → chunk-7DWNJI73.cjs} +13 -13
- package/dist/{chunk-7L5V3KQO.cjs → chunk-7O5M4UKW.cjs} +2 -2
- package/dist/{chunk-BJPBQNIE.cjs → chunk-7SQ5SGYZ.cjs} +2 -2
- package/dist/{chunk-27ZWSI3W.cjs → chunk-ADOAUDQ6.cjs} +2 -2
- package/dist/{chunk-CP6X4AEU.mjs → chunk-AJQTP4OO.mjs} +1 -1
- package/dist/{chunk-YKX5BK66.cjs → chunk-ATWHHSY2.cjs} +7 -7
- package/dist/{chunk-EFCQPQMG.cjs → chunk-B5PFZLKV.cjs} +89 -8
- package/dist/{chunk-FNO7A7CM.cjs → chunk-BHY547NB.cjs} +34 -16
- package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
- package/dist/{chunk-7GLPRTTF.cjs → chunk-CGBDNNSM.cjs} +2 -2
- package/dist/chunk-CI6E3UOH.cjs +314 -0
- package/dist/{chunk-2G2NNLE2.mjs → chunk-CQMVIOYP.mjs} +5 -5
- package/dist/{chunk-X6W5FFH6.cjs → chunk-CVH2BXPY.cjs} +8 -8
- package/dist/{chunk-TKSCR644.cjs → chunk-D3C5LBQY.cjs} +2 -2
- package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
- package/dist/chunk-DTSROJ5J.mjs +367 -0
- package/dist/{chunk-DBNKI4NF.cjs → chunk-ECKF2BAM.cjs} +6 -2
- package/dist/{chunk-GQ3Z3IZI.cjs → chunk-EMMQ64QW.cjs} +18 -18
- package/dist/{chunk-6DU6UFUE.mjs → chunk-EXG5LD6B.mjs} +16 -8
- package/dist/{chunk-HUMR6LSU.mjs → chunk-F5QO4FNE.mjs} +1 -1
- package/dist/{chunk-YULD7ICZ.mjs → chunk-FBOJ55OM.mjs} +1 -1
- package/dist/{chunk-IHNMMXHV.mjs → chunk-FGRYBX5X.mjs} +15 -10
- package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
- package/dist/{chunk-3BU22U3M.cjs → chunk-G2TEB74S.cjs} +5 -2
- package/dist/{chunk-G5RT7EXW.mjs → chunk-HEVMCTSR.mjs} +21 -6
- package/dist/{chunk-W7LF2J2S.mjs → chunk-HMRSWN47.mjs} +1 -1
- package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
- package/dist/{chunk-UAORZ7QA.mjs → chunk-IAIYV4RZ.mjs} +2 -2
- package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
- package/dist/{chunk-2NNMOPDN.mjs → chunk-J3ANCZKA.mjs} +4 -1
- package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
- package/dist/{chunk-SC2WYWPF.mjs → chunk-JPNFPAZ4.mjs} +3 -3
- package/dist/{chunk-F6Z3Y5KL.mjs → chunk-K3SAEIM3.mjs} +5 -2
- package/dist/{chunk-QAU5JD57.mjs → chunk-K4I4O5TS.mjs} +289 -50
- package/dist/{chunk-KN7K4VQN.mjs → chunk-KDTBF3UU.mjs} +1 -1
- package/dist/{chunk-OMVAU7NT.cjs → chunk-KIIMAWOJ.cjs} +11 -1
- package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
- package/dist/{chunk-QORUJDIV.mjs → chunk-KPFKMDM7.mjs} +2 -2
- package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
- package/dist/{chunk-YDQZGSDS.mjs → chunk-LBDP3YT3.mjs} +1 -1
- package/dist/{chunk-6ETPZTJI.mjs → chunk-LBGILORX.mjs} +116 -55
- package/dist/{chunk-IPXLADVO.cjs → chunk-LOFKRKO7.cjs} +122 -61
- package/dist/{chunk-ULAWS2PA.cjs → chunk-LPFV45AY.cjs} +29 -26
- package/dist/{chunk-3KZS4SUS.mjs → chunk-MCIZVNOQ.mjs} +1 -1
- package/dist/{chunk-RU3M2FIK.cjs → chunk-MRMI32SN.cjs} +87 -369
- package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
- package/dist/{chunk-XCACDAZZ.cjs → chunk-NDILNQ4L.cjs} +25 -10
- package/dist/{chunk-6TJOML4E.mjs → chunk-NFMDCAOS.mjs} +14 -11
- package/dist/{chunk-UXFQ3UDA.cjs → chunk-NICDYKBS.cjs} +42 -3
- package/dist/{chunk-EZDQRNQ7.mjs → chunk-NNSAQX3U.mjs} +23 -5
- package/dist/{chunk-YC6V7PWE.cjs → chunk-NQ6QFZWD.cjs} +1 -1
- package/dist/{chunk-PDOCJ6RY.mjs → chunk-O6WAEAX3.mjs} +1 -1
- package/dist/{chunk-U4KT7QP3.cjs → chunk-OW67PDDS.cjs} +14 -1
- package/dist/{chunk-77GNHH2Z.cjs → chunk-PMQHMWZU.cjs} +3 -3
- package/dist/chunk-PTZ2TVNE.cjs +178 -0
- package/dist/{chunk-6WCPV6G2.mjs → chunk-Q2KB32T4.mjs} +1 -1
- package/dist/{chunk-ICUQICNC.cjs → chunk-Q5FYSK45.cjs} +718 -532
- package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
- package/dist/{chunk-Q3VLETLE.mjs → chunk-RRMVL6CJ.mjs} +4 -4
- package/dist/{chunk-IZY3V5XW.mjs → chunk-S3VWVTVA.mjs} +14 -1
- package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
- package/dist/{chunk-VFQT3LAO.cjs → chunk-SDOTRX3V.cjs} +5 -5
- package/dist/chunk-SGBZPZUW.mjs +75 -0
- package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
- package/dist/{chunk-ZXGAFZDO.cjs → chunk-T5OJPTVN.cjs} +2 -2
- package/dist/{chunk-2ELDTQRN.mjs → chunk-TDNWPAVR.mjs} +1 -1
- package/dist/{chunk-VZJR7UTG.cjs → chunk-TE2G5ION.cjs} +2 -2
- package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
- package/dist/{chunk-4JHOT46A.mjs → chunk-TPLJVC7E.mjs} +86 -5
- package/dist/{chunk-NRSN7G7E.mjs → chunk-TW4GYDBJ.mjs} +1 -1
- package/dist/{chunk-XBML5KMG.cjs → chunk-U6MPZ35Q.cjs} +24 -14
- package/dist/chunk-UH6QN5NL.mjs +178 -0
- package/dist/{chunk-FTFYRMQQ.cjs → chunk-UJZLSXUB.cjs} +53 -28
- package/dist/chunk-UXHS27O6.cjs +75 -0
- package/dist/{chunk-DQQOKWYA.cjs → chunk-VR4GD5I3.cjs} +3 -3
- package/dist/{chunk-22LTEMGQ.mjs → chunk-VXAWRDK7.mjs} +14 -4
- package/dist/{chunk-62XKI4Z3.cjs → chunk-W2YDNK66.cjs} +6 -3
- package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
- package/dist/{chunk-EJQT6KZN.cjs → chunk-WC5UV2HQ.cjs} +2 -2
- package/dist/{chunk-SAZVVAJH.mjs → chunk-WQ7T2263.mjs} +18 -7
- package/dist/chunk-WRPHYQVY.mjs +109 -0
- package/dist/chunk-WT4TGLXT.cjs +109 -0
- package/dist/{chunk-SOMHP6GF.mjs → chunk-XOPOIFTJ.mjs} +2 -2
- package/dist/{chunk-3PXS2MHU.mjs → chunk-YCKO6FRS.mjs} +1 -1
- package/dist/{chunk-C35ZBVRD.mjs → chunk-YWMZUGIS.mjs} +6 -2
- package/dist/{chunk-HMIJDL7S.mjs → chunk-Z5BEWYVO.mjs} +31 -6
- package/dist/{chunk-OKZUAXHF.mjs → chunk-Z7LA7MHQ.mjs} +1 -1
- package/dist/{chunk-Y7RKTKYI.mjs → chunk-ZMMBIVQM.mjs} +10 -0
- package/dist/{client-plugins-HIyulDym.d.ts → client-plugins-C8DjftDF.d.ts} +112 -5
- package/dist/{client-plugins-CvIslxWi.d.mts → client-plugins-CV4eJ9De.d.mts} +112 -5
- 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-EAUY43BS.cjs → devtools-JXFQNWSH.cjs} +11 -10
- package/dist/{devtools-EE5RIBTH.mjs → devtools-KVOY2TCZ.mjs} +10 -9
- package/dist/docs.cjs +13 -12
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +12 -11
- package/dist/headers.cjs +4 -4
- package/dist/headers.mjs +3 -3
- package/dist/i18n/client.cjs +11 -11
- package/dist/i18n/client.mjs +3 -3
- package/dist/image/server.cjs +3 -3
- package/dist/image/server.mjs +2 -2
- package/dist/image/sharp.cjs +10 -10
- package/dist/image/sharp.mjs +2 -2
- package/dist/index.cjs +61 -54
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +60 -53
- package/dist/integrations.cjs +8 -4
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +7 -3
- package/dist/internal/app-markdown-runtime.cjs +5 -3
- package/dist/internal/app-markdown-runtime.d.mts +19 -5
- package/dist/internal/app-markdown-runtime.d.ts +19 -5
- package/dist/internal/app-markdown-runtime.mjs +4 -2
- package/dist/internal/build-runtime.cjs +38 -34
- 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 -33
- package/dist/internal/cli-runtime.cjs +17 -16
- package/dist/internal/cli-runtime.mjs +16 -15
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.mjs +1 -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 -10
- 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 -9
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/isolated-boundary.cjs +2 -2
- package/dist/internal/isolated-boundary.d.mts +0 -1
- package/dist/internal/isolated-boundary.d.ts +0 -1
- package/dist/internal/isolated-boundary.mjs +1 -1
- package/dist/internal/metadata-image-runtime.cjs +3 -3
- package/dist/internal/metadata-image-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 +27 -48
- package/dist/internal/production-runtime.d.mts +67 -27
- package/dist/internal/production-runtime.d.ts +67 -27
- package/dist/internal/production-runtime.mjs +34 -55
- package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
- package/dist/layers-VUWIOFEO.cjs +18 -0
- package/dist/markdown.cjs +1 -1
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.cjs +10 -10
- package/dist/middleware.d.mts +6 -4
- package/dist/middleware.d.ts +6 -4
- package/dist/middleware.mjs +9 -9
- package/dist/navigation.cjs +7 -7
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +6 -6
- package/dist/{nitro-OVPLKPE2.cjs → nitro-7F65EZZS.cjs} +3 -3
- package/dist/{nitro-MXRDCXWZ.mjs → nitro-MPZJGPXK.mjs} +2 -2
- package/dist/plugin.cjs +31 -28
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +30 -27
- package/dist/{production-runtime-Crq6CJ-2.d.ts → production-runtime-C2kkrPVZ.d.ts} +1 -1
- package/dist/{production-runtime-0sRnuYc-.d.mts → production-runtime-Du_FHb2-.d.mts} +1 -1
- package/dist/query/client.cjs +9 -9
- package/dist/query/client.mjs +4 -4
- package/dist/{render-plan-8ozZh2Qv.d.ts → render-plan-BnnPTpus.d.ts} +1 -1
- package/dist/{render-plan-gs9GGPzw.d.mts → render-plan-Cgx7v8tJ.d.mts} +1 -1
- package/dist/renderer/react/server.cjs +3 -3
- package/dist/renderer/react/server.mjs +1 -1
- package/dist/renderer-client.cjs +12 -12
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +4 -4
- package/dist/{request-B5G8rLBH.d.ts → request-BNWr7r5e.d.ts} +1 -1
- package/dist/{request-fkhiynXe.d.mts → request-sKayKcop.d.mts} +1 -1
- package/dist/request.cjs +3 -3
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/request.mjs +2 -2
- package/dist/{route-rendering-lS5nUMua.d.ts → route-rendering-Bx4Auw6Q.d.ts} +1 -1
- package/dist/{route-rendering-CLnS7AZj.d.mts → route-rendering-DWFp3Yq4.d.mts} +1 -1
- package/dist/{router-ifU8Dui1.d.mts → router-BK6K42Ij.d.mts} +1 -1
- package/dist/{router-4iuiYnOW.d.ts → router-DnW_2tQi.d.ts} +1 -1
- package/dist/routes.cjs +2 -2
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.mjs +1 -1
- package/dist/runtime-CA3Ei5k_.d.ts +69 -0
- package/dist/runtime-DJDaCMd_.d.mts +69 -0
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +5 -5
- package/dist/server-fn.mjs +4 -4
- package/dist/server-plugins.cjs +5 -5
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +4 -4
- package/dist/server-query.cjs +6 -6
- package/dist/server-query.mjs +5 -5
- package/dist/server.cjs +57 -54
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +35 -32
- package/dist/{spa-router-Bq7VCOwx.d.mts → spa-router-D6fUA4Rn.d.mts} +2 -2
- package/dist/{spa-router-DaJk5Re4.d.ts → spa-router-Mwbd7g2L.d.ts} +2 -2
- package/dist/testing.cjs +13 -13
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +10 -10
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-BXLmFsVR.d.ts → utils-BwVcAfUR.d.ts} +1 -1
- package/dist/{utils-XJn0c9bj.d.mts → utils-p9Hs-jCc.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +31 -28
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +30 -27
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.mjs +2 -2
- package/package.json +1 -1
- package/types/middleware.d.ts +5 -1
- package/dist/chunk-FXEF4PPL.mjs +0 -47
- package/dist/chunk-XD32KALF.cjs +0 -47
- package/dist/layers-4PNE2HOY.cjs +0 -18
- /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
- /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
|
@@ -10,6 +10,14 @@ function isFarmBlockedNavigationURL(url) {
|
|
|
10
10
|
return true;
|
|
11
11
|
}
|
|
12
12
|
__name(isFarmBlockedNavigationURL, "isFarmBlockedNavigationURL");
|
|
13
|
+
function isFarmScriptURL(href) {
|
|
14
|
+
try {
|
|
15
|
+
return new URL(href, "http://farm.invalid").protocol === "javascript:";
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
__name(isFarmScriptURL, "isFarmScriptURL");
|
|
13
21
|
function isFarmExternalNavigationURL(url, currentOrigin) {
|
|
14
22
|
return url.protocol !== "http:" && url.protocol !== "https:" || url.origin !== currentOrigin;
|
|
15
23
|
}
|
|
@@ -21,6 +29,7 @@ __name(resolveFarmNavigationURL, "resolveFarmNavigationURL");
|
|
|
21
29
|
|
|
22
30
|
export {
|
|
23
31
|
isFarmBlockedNavigationURL,
|
|
32
|
+
isFarmScriptURL,
|
|
24
33
|
isFarmExternalNavigationURL,
|
|
25
34
|
resolveFarmNavigationURL
|
|
26
35
|
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getServerActionSignal,
|
|
5
5
|
isServerFnFailure,
|
|
6
6
|
runWithServerActionRequest
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4WVJLURN.mjs";
|
|
8
8
|
import {
|
|
9
9
|
applyFarmCacheInvalidationTargets
|
|
10
10
|
} from "./chunk-MSSFIQGM.mjs";
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
getFarmRedirectError
|
|
13
13
|
} from "./chunk-CBBLJMR5.mjs";
|
|
14
14
|
import {
|
|
15
|
-
|
|
16
|
-
} from "./chunk-
|
|
15
|
+
_resolveCurrentRequestForApp
|
|
16
|
+
} from "./chunk-S3VWVTVA.mjs";
|
|
17
17
|
import {
|
|
18
18
|
__name
|
|
19
19
|
} from "./chunk-LPEX4YW6.mjs";
|
|
@@ -118,7 +118,7 @@ function createServerFn(options) {
|
|
|
118
118
|
throw labelInputErrors && isSchemaValidationFailure(cause) ? new ServerFnInputError(cause) : cause;
|
|
119
119
|
}
|
|
120
120
|
const executionContext = getServerActionExecutionContext();
|
|
121
|
-
const request = executionContext?.request ??
|
|
121
|
+
const request = executionContext?.request ?? _resolveCurrentRequestForApp();
|
|
122
122
|
const signal = executionContext?.signal ?? request?.signal ?? getServerActionSignal();
|
|
123
123
|
const handlerContext = {
|
|
124
124
|
input,
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// src/server/request-bridge.ts
|
|
6
6
|
var CURRENT_REQUEST_RESOLVER_KEY = /* @__PURE__ */ Symbol.for("farm.currentRequestResolver");
|
|
7
|
+
var APP_REQUEST_VIEW_KEY = /* @__PURE__ */ Symbol.for("farm.appRequestView");
|
|
7
8
|
function getGlobalState() {
|
|
8
9
|
return globalThis;
|
|
9
10
|
}
|
|
@@ -16,8 +17,20 @@ function _resolveCurrentRequest() {
|
|
|
16
17
|
return getGlobalState()[CURRENT_REQUEST_RESOLVER_KEY]?.();
|
|
17
18
|
}
|
|
18
19
|
__name(_resolveCurrentRequest, "_resolveCurrentRequest");
|
|
20
|
+
function _setAppRequestView(view) {
|
|
21
|
+
getGlobalState()[APP_REQUEST_VIEW_KEY] = view;
|
|
22
|
+
}
|
|
23
|
+
__name(_setAppRequestView, "_setAppRequestView");
|
|
24
|
+
function _resolveCurrentRequestForApp() {
|
|
25
|
+
const request = _resolveCurrentRequest();
|
|
26
|
+
const view = getGlobalState()[APP_REQUEST_VIEW_KEY];
|
|
27
|
+
return request && view ? view(request) : request;
|
|
28
|
+
}
|
|
29
|
+
__name(_resolveCurrentRequestForApp, "_resolveCurrentRequestForApp");
|
|
19
30
|
|
|
20
31
|
export {
|
|
21
32
|
_setCurrentRequestResolver,
|
|
22
|
-
_resolveCurrentRequest
|
|
33
|
+
_resolveCurrentRequest,
|
|
34
|
+
_setAppRequestView,
|
|
35
|
+
_resolveCurrentRequestForApp
|
|
23
36
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
|
3
|
+
var _chunkJEZO6VURcjs = require('./chunk-JEZO6VUR.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkLIUGYUX3cjs = require('./chunk-LIUGYUX3.cjs');
|
|
@@ -48,7 +48,7 @@ function isFarmLocaleChangeHref(href) {
|
|
|
48
48
|
const snapshot = getFarmI18nClientState();
|
|
49
49
|
if (!snapshot || typeof window === "undefined") return false;
|
|
50
50
|
if (snapshot.routing === "none") return false;
|
|
51
|
-
const target =
|
|
51
|
+
const target = _chunkJEZO6VURcjs.resolveFarmNavigationURL.call(void 0, href, window.location.href);
|
|
52
52
|
const match = _chunkBIDYX3SLcjs.resolveFarmLocalePath.call(void 0, target.pathname, snapshot);
|
|
53
53
|
const targetLocale = match.locale || snapshot.defaultLocale;
|
|
54
54
|
return targetLocale !== snapshot.locale;
|
|
@@ -9,7 +9,7 @@ var _chunkCMGMGHUZcjs = require('./chunk-CMGMGHUZ.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
@@ -136,10 +136,10 @@ function createFarmWorkflowRequestHandler(options) {
|
|
|
136
136
|
try {
|
|
137
137
|
payload = await readWorkflowPayload(
|
|
138
138
|
request,
|
|
139
|
-
|
|
139
|
+
_chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, options.server).bodySizeLimit
|
|
140
140
|
);
|
|
141
141
|
} catch (error) {
|
|
142
|
-
const response =
|
|
142
|
+
const response = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
143
143
|
if (response) return response;
|
|
144
144
|
if (error instanceof SyntaxError) {
|
|
145
145
|
return Response.json({ error: "Invalid workflow request body." }, { status: 400 });
|
|
@@ -220,7 +220,7 @@ async function prepareFarmWorkflowsForNitro(config) {
|
|
|
220
220
|
createNitroWorkflowHTTPHandler(
|
|
221
221
|
workflowConfig,
|
|
222
222
|
workflows,
|
|
223
|
-
|
|
223
|
+
_chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, config.server)
|
|
224
224
|
),
|
|
225
225
|
"utf8"
|
|
226
226
|
);
|
|
@@ -591,7 +591,7 @@ async function readWorkflowPayload(request, bodySizeLimit) {
|
|
|
591
591
|
if (request.method === "GET" || request.method === "HEAD") {
|
|
592
592
|
return _chunkQNPEUFHQcjs.searchParamsToObject.call(void 0, url.searchParams);
|
|
593
593
|
}
|
|
594
|
-
const bytes = await
|
|
594
|
+
const bytes = await _chunkKIIMAWOJcjs.readFarmRequestBody.call(void 0, request, bodySizeLimit);
|
|
595
595
|
const text = new TextDecoder().decode(bytes);
|
|
596
596
|
if (!text) return {};
|
|
597
597
|
const contentType = (request.headers.get("content-type") || "").split(";", 1)[0].trim().toLowerCase();
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
4
|
+
|
|
5
|
+
// src/api/dev-dispatch.ts
|
|
6
|
+
import http from "http";
|
|
7
|
+
import https from "https";
|
|
8
|
+
import { Readable } from "stream";
|
|
9
|
+
function createFarmDevServerDispatch(server) {
|
|
10
|
+
return (request) => new Promise((resolve, reject) => {
|
|
11
|
+
const address = server.httpServer?.address();
|
|
12
|
+
if (!address || typeof address === "string") {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"Farm cannot dispatch an app endpoint request: the Vite dev server has no listening HTTP server."
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
const url = new URL(request.url);
|
|
18
|
+
const headers = {};
|
|
19
|
+
request.headers.forEach((value, name) => {
|
|
20
|
+
headers[name] = value;
|
|
21
|
+
});
|
|
22
|
+
headers.host = url.host;
|
|
23
|
+
const secure = Boolean(server.config.server.https);
|
|
24
|
+
const outgoing = (secure ? https : http).request(
|
|
25
|
+
{
|
|
26
|
+
host: loopbackAddress(address),
|
|
27
|
+
port: address.port,
|
|
28
|
+
method: request.method,
|
|
29
|
+
path: `${url.pathname}${url.search}`,
|
|
30
|
+
headers,
|
|
31
|
+
signal: request.signal,
|
|
32
|
+
// The listener is this process's own dev server, often with a self-signed certificate.
|
|
33
|
+
...secure ? { rejectUnauthorized: false } : {}
|
|
34
|
+
},
|
|
35
|
+
(incoming) => {
|
|
36
|
+
const responseHeaders = new Headers();
|
|
37
|
+
for (const [name, value] of Object.entries(incoming.headers)) {
|
|
38
|
+
if (value === void 0) continue;
|
|
39
|
+
for (const entry of Array.isArray(value) ? value : [value]) {
|
|
40
|
+
responseHeaders.append(name, entry);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const status = incoming.statusCode ?? 502;
|
|
44
|
+
const hasBody = request.method !== "HEAD" && status !== 204 && status !== 205 && status !== 304;
|
|
45
|
+
if (!hasBody) incoming.resume();
|
|
46
|
+
try {
|
|
47
|
+
resolve(
|
|
48
|
+
new Response(
|
|
49
|
+
hasBody ? Readable.toWeb(incoming) : null,
|
|
50
|
+
{ status, statusText: incoming.statusMessage, headers: responseHeaders }
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
incoming.destroy();
|
|
55
|
+
reject(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
outgoing.on("error", reject);
|
|
60
|
+
if (request.body) {
|
|
61
|
+
Readable.fromWeb(request.body).on("error", (error) => outgoing.destroy(error)).pipe(outgoing);
|
|
62
|
+
} else {
|
|
63
|
+
outgoing.end();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
__name(createFarmDevServerDispatch, "createFarmDevServerDispatch");
|
|
68
|
+
function loopbackAddress({ address }) {
|
|
69
|
+
return address === "0.0.0.0" ? "127.0.0.1" : address === "::" ? "::1" : address;
|
|
70
|
+
}
|
|
71
|
+
__name(loopbackAddress, "loopbackAddress");
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
createFarmDevServerDispatch
|
|
75
|
+
};
|
|
@@ -34,15 +34,42 @@ async function loadFarmDevModule(server, id, environmentName = "ssr") {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmDevModule, "loadFarmDevModule");
|
|
37
|
+
function invalidateFarmDevDependents(server, file, targets, environmentName = "ssr") {
|
|
38
|
+
const environment = server.environments[environmentName];
|
|
39
|
+
const graph = _optionalChain([environment, 'optionalAccess', _6 => _6.moduleGraph]);
|
|
40
|
+
if (!graph || targets.size === 0) return [];
|
|
41
|
+
const posix = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (filePath) => filePath.replace(/\\/g, "/"), "posix");
|
|
42
|
+
const byFile = new Map([...targets].map((target) => [posix(target), target]));
|
|
43
|
+
const reached = /* @__PURE__ */ new Set();
|
|
44
|
+
const seen = /* @__PURE__ */ new Set();
|
|
45
|
+
const queue = [..._nullishCoalesce(graph.getModulesByFile(posix(file)), () => ( []))];
|
|
46
|
+
while (queue.length > 0) {
|
|
47
|
+
const node = queue.pop();
|
|
48
|
+
if (seen.has(node)) continue;
|
|
49
|
+
seen.add(node);
|
|
50
|
+
const target = node.file ? byFile.get(posix(node.file)) : void 0;
|
|
51
|
+
if (target) reached.add(target);
|
|
52
|
+
queue.push(...node.importers);
|
|
53
|
+
}
|
|
54
|
+
if (reached.size === 0) return [];
|
|
55
|
+
const evaluatedModules = _optionalChain([environment, 'access', _7 => _7.runner, 'optionalAccess', _8 => _8.evaluatedModules]);
|
|
56
|
+
for (const node of seen) {
|
|
57
|
+
graph.invalidateModule(node);
|
|
58
|
+
const evaluated = node.id ? _optionalChain([evaluatedModules, 'optionalAccess', _9 => _9.getModuleById, 'call', _10 => _10(node.id)]) : void 0;
|
|
59
|
+
if (evaluated) evaluatedModules.invalidateModule(evaluated);
|
|
60
|
+
}
|
|
61
|
+
return [...reached];
|
|
62
|
+
}
|
|
63
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, invalidateFarmDevDependents, "invalidateFarmDevDependents");
|
|
37
64
|
function invalidateFailedFarmDevModules(server) {
|
|
38
65
|
for (const entry of Object.values(server.environments)) {
|
|
39
66
|
const environment = entry;
|
|
40
67
|
const failures = failedModules.get(environment);
|
|
41
|
-
if (!_optionalChain([failures, 'optionalAccess',
|
|
68
|
+
if (!_optionalChain([failures, 'optionalAccess', _11 => _11.size])) continue;
|
|
42
69
|
const runner = environment.runner;
|
|
43
70
|
for (const [id, failed] of failures) {
|
|
44
71
|
const evaluated = runner.evaluatedModules.getModuleById(id);
|
|
45
|
-
if (_optionalChain([evaluated, 'optionalAccess',
|
|
72
|
+
if (_optionalChain([evaluated, 'optionalAccess', _12 => _12.promise]) !== failed) continue;
|
|
46
73
|
const transformed = environment.moduleGraph.getModuleById(id);
|
|
47
74
|
if (transformed) environment.moduleGraph.invalidateModule(transformed);
|
|
48
75
|
if (evaluated) runner.evaluatedModules.invalidateModule(evaluated);
|
|
@@ -64,4 +91,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, toFileModuleUrl, "toFileModuleUrl");
|
|
|
64
91
|
|
|
65
92
|
|
|
66
93
|
|
|
67
|
-
|
|
94
|
+
|
|
95
|
+
exports.FarmDevEnvironmentError = FarmDevEnvironmentError; exports.loadFarmDevModule = loadFarmDevModule; exports.invalidateFarmDevDependents = invalidateFarmDevDependents; exports.invalidateFailedFarmDevModules = invalidateFailedFarmDevModules; exports.toFileModuleUrl = toFileModuleUrl;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
var _chunkSVRTJOUFcjs = require('./chunk-SVRTJOUF.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -107,7 +107,7 @@ function resolveServerActionsConfig(config) {
|
|
|
107
107
|
const allowedOrigins = (_nullishCoalesce(_optionalChain([config, 'optionalAccess', _ => _.allowedOrigins]), () => ( []))).map(
|
|
108
108
|
(value) => _chunkSVRTJOUFcjs.normalizeAllowedOriginPattern.call(void 0, value, SERVER_ACTION_ALLOWED_ORIGINS_LABEL)
|
|
109
109
|
);
|
|
110
|
-
const bodySizeLimit =
|
|
110
|
+
const bodySizeLimit = _chunkKIIMAWOJcjs.parseBodySizeLimit.call(void 0,
|
|
111
111
|
_nullishCoalesce(_optionalChain([config, 'optionalAccess', _2 => _2.bodySizeLimit]), () => ( DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT)),
|
|
112
112
|
"serverActions.bodySizeLimit"
|
|
113
113
|
);
|
|
@@ -18,7 +18,7 @@ var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
|
18
18
|
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -1947,7 +1947,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1947
1947
|
ETag: etag,
|
|
1948
1948
|
"X-Content-Type-Options": "nosniff"
|
|
1949
1949
|
});
|
|
1950
|
-
if (
|
|
1950
|
+
if (_chunkKIIMAWOJcjs.matchesFarmIfNoneMatch.call(void 0, request.headers.get("if-none-match"), etag)) {
|
|
1951
1951
|
return new Response(null, { status: 304, headers });
|
|
1952
1952
|
}
|
|
1953
1953
|
if (request.method === "HEAD") return new Response(null, { status: 200, headers });
|
|
@@ -569,6 +569,10 @@ async function resolveProgrammaticRouteData(route, dataHooks, context) {
|
|
|
569
569
|
if (routeDataKey == null) {
|
|
570
570
|
return dataHooks.main(context);
|
|
571
571
|
}
|
|
572
|
+
const revalidate = normalizeProgrammaticRouteStaleTime(dataHooks.staleTime, route.path);
|
|
573
|
+
if (revalidate === 0) {
|
|
574
|
+
return dataHooks.main(context);
|
|
575
|
+
}
|
|
572
576
|
const cacheKey = _chunkNYJMY3JAcjs.createFarmCacheKey.call(void 0, ["route-data", routeDataKey]);
|
|
573
577
|
const cacheOptions = {
|
|
574
578
|
tags: [
|
|
@@ -579,7 +583,7 @@ async function resolveProgrammaticRouteData(route, dataHooks, context) {
|
|
|
579
583
|
...typeof context.path === "string" ? [context.path] : [],
|
|
580
584
|
...await resolveProgrammaticRouteDataKeys(dataHooks.paths, context)
|
|
581
585
|
],
|
|
582
|
-
revalidate
|
|
586
|
+
revalidate
|
|
583
587
|
};
|
|
584
588
|
return _chunkYWN746UScjs.getFarmDataCache.call(void 0, ).getOrSet(cacheKey, () => dataHooks.main(context), cacheOptions);
|
|
585
589
|
}
|
|
@@ -590,20 +594,26 @@ async function resolveProgrammaticRouteDataKeys(input, context) {
|
|
|
590
594
|
return value.filter((item) => typeof item === "string" && item.trim().length > 0);
|
|
591
595
|
}
|
|
592
596
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveProgrammaticRouteDataKeys, "resolveProgrammaticRouteDataKeys");
|
|
593
|
-
function normalizeProgrammaticRouteStaleTime(staleTime) {
|
|
597
|
+
function normalizeProgrammaticRouteStaleTime(staleTime, routePath) {
|
|
594
598
|
if (staleTime === void 0) return void 0;
|
|
595
599
|
if (staleTime === false) return false;
|
|
600
|
+
let milliseconds;
|
|
596
601
|
if (typeof staleTime === "number") {
|
|
597
|
-
|
|
598
|
-
|
|
602
|
+
milliseconds = staleTime;
|
|
603
|
+
} else {
|
|
604
|
+
const match = typeof staleTime === "string" && staleTime.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)$/);
|
|
605
|
+
if (!match) {
|
|
606
|
+
throw new TypeError(
|
|
607
|
+
`Route "${routePath}" data.staleTime must be milliseconds or a duration like "250ms", "30s", "5m", or "1h".`
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
const unit = match[2];
|
|
611
|
+
milliseconds = Number(match[1]) * (unit === "ms" ? 1 : unit === "s" ? 1e3 : unit === "m" ? 6e4 : 36e5);
|
|
612
|
+
}
|
|
613
|
+
if (!Number.isFinite(milliseconds) || milliseconds < 0) {
|
|
614
|
+
throw new TypeError(`Route "${routePath}" data.staleTime must be a non-negative duration.`);
|
|
599
615
|
}
|
|
600
|
-
|
|
601
|
-
if (!match) return void 0;
|
|
602
|
-
const value = Number(match[1]);
|
|
603
|
-
if (!Number.isFinite(value) || value <= 0) return void 0;
|
|
604
|
-
const unit = match[2];
|
|
605
|
-
const milliseconds = unit === "ms" ? value : unit === "s" ? value * 1e3 : unit === "m" ? value * 6e4 : value * 36e5;
|
|
606
|
-
return Math.max(1, Math.ceil(milliseconds / 1e3));
|
|
616
|
+
return milliseconds === 0 ? 0 : Math.max(1, Math.ceil(milliseconds / 1e3));
|
|
607
617
|
}
|
|
608
618
|
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeProgrammaticRouteStaleTime, "normalizeProgrammaticRouteStaleTime");
|
|
609
619
|
function isProgrammaticRoutePropsResolved(value) {
|
|
@@ -662,6 +672,7 @@ function normalizeProgrammaticRoute(route) {
|
|
|
662
672
|
};
|
|
663
673
|
}
|
|
664
674
|
const routeActions = route.kind === "page" ? normalizeProgrammaticRouteActions(route) : void 0;
|
|
675
|
+
normalizeProgrammaticRouteStaleTime(_optionalChain([route, 'access', _11 => _11.data, 'optionalAccess', _12 => _12.staleTime]), route.path);
|
|
665
676
|
return {
|
|
666
677
|
...route,
|
|
667
678
|
...routeActions,
|
|
@@ -112,6 +112,82 @@ function isFarmMarkdownPublicSourceResponse(response) {
|
|
|
112
112
|
return publicSourceResponses.has(response);
|
|
113
113
|
}
|
|
114
114
|
__name(isFarmMarkdownPublicSourceResponse, "isFarmMarkdownPublicSourceResponse");
|
|
115
|
+
var ANONYMOUS_REQUEST_HEADERS = /* @__PURE__ */ new Set([
|
|
116
|
+
"accept",
|
|
117
|
+
"accept-encoding",
|
|
118
|
+
"accept-language",
|
|
119
|
+
"cache-control",
|
|
120
|
+
"connection",
|
|
121
|
+
"dnt",
|
|
122
|
+
"host",
|
|
123
|
+
"if-match",
|
|
124
|
+
"if-modified-since",
|
|
125
|
+
"if-none-match",
|
|
126
|
+
"if-range",
|
|
127
|
+
"if-unmodified-since",
|
|
128
|
+
"keep-alive",
|
|
129
|
+
"origin",
|
|
130
|
+
"pragma",
|
|
131
|
+
"priority",
|
|
132
|
+
"purpose",
|
|
133
|
+
"range",
|
|
134
|
+
"referer",
|
|
135
|
+
"save-data",
|
|
136
|
+
"sec-gpc",
|
|
137
|
+
"sec-purpose",
|
|
138
|
+
"te",
|
|
139
|
+
"traceparent",
|
|
140
|
+
"tracestate",
|
|
141
|
+
"upgrade-insecure-requests",
|
|
142
|
+
"user-agent",
|
|
143
|
+
"x-forwarded-host",
|
|
144
|
+
"x-forwarded-port",
|
|
145
|
+
"x-forwarded-proto",
|
|
146
|
+
"x-request-id"
|
|
147
|
+
]);
|
|
148
|
+
function isAnonymousRequestHeader(name) {
|
|
149
|
+
const lower = name.toLowerCase();
|
|
150
|
+
return ANONYMOUS_REQUEST_HEADERS.has(lower) || lower.startsWith("sec-fetch-") || lower.startsWith("sec-ch-");
|
|
151
|
+
}
|
|
152
|
+
__name(isAnonymousRequestHeader, "isAnonymousRequestHeader");
|
|
153
|
+
var PAGE_CHECK_DROPPED_HEADERS = /* @__PURE__ */ new Set([
|
|
154
|
+
"accept-encoding",
|
|
155
|
+
"if-match",
|
|
156
|
+
"if-modified-since",
|
|
157
|
+
"if-none-match",
|
|
158
|
+
"if-range",
|
|
159
|
+
"if-unmodified-since",
|
|
160
|
+
"range"
|
|
161
|
+
]);
|
|
162
|
+
async function anonymousVisitorOpensPage(options, url, targetPathname) {
|
|
163
|
+
const pageUrl = new URL(url);
|
|
164
|
+
pageUrl.pathname = targetPathname;
|
|
165
|
+
const headers = new Headers();
|
|
166
|
+
for (const [name, value] of options.request.headers) {
|
|
167
|
+
if (!PAGE_CHECK_DROPPED_HEADERS.has(name.toLowerCase())) headers.append(name, value);
|
|
168
|
+
}
|
|
169
|
+
headers.set("accept", "text/html");
|
|
170
|
+
const response = await options.renderPage(
|
|
171
|
+
new Request(pageUrl, {
|
|
172
|
+
method: "GET",
|
|
173
|
+
headers,
|
|
174
|
+
redirect: "manual",
|
|
175
|
+
signal: options.request.signal
|
|
176
|
+
})
|
|
177
|
+
);
|
|
178
|
+
void response.body?.cancel().catch(() => {
|
|
179
|
+
});
|
|
180
|
+
return response.status >= 200 && response.status < 300 && Boolean(response.headers.get("content-type")?.toLowerCase().includes("text/html"));
|
|
181
|
+
}
|
|
182
|
+
__name(anonymousVisitorOpensPage, "anonymousVisitorOpensPage");
|
|
183
|
+
function hasOnlyAnonymousHeaders(headers) {
|
|
184
|
+
for (const name of headers.keys()) {
|
|
185
|
+
if (!isAnonymousRequestHeader(name)) return false;
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
__name(hasOnlyAnonymousHeaders, "hasOnlyAnonymousHeaders");
|
|
190
|
+
var FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS = "192.0.2.1";
|
|
115
191
|
async function createFarmMarkdownSourceResponse(options) {
|
|
116
192
|
if (options.request.method !== "GET" && options.request.method !== "HEAD") {
|
|
117
193
|
return null;
|
|
@@ -129,13 +205,14 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
129
205
|
if (!source) {
|
|
130
206
|
return null;
|
|
131
207
|
}
|
|
132
|
-
const anonymous =
|
|
208
|
+
const anonymous = hasOnlyAnonymousHeaders(options.request.headers) && (!options.clientAddress || options.clientAddress === FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS);
|
|
133
209
|
if (options.renderPage && (hasMarkdownExtension || !anonymous)) {
|
|
134
210
|
const publicUrl = new URL(url);
|
|
135
211
|
publicUrl.pathname = targetPathname;
|
|
136
|
-
const publicHeaders = new Headers(
|
|
137
|
-
|
|
138
|
-
|
|
212
|
+
const publicHeaders = new Headers();
|
|
213
|
+
for (const [name, value] of options.request.headers) {
|
|
214
|
+
if (isAnonymousRequestHeader(name)) publicHeaders.append(name, value);
|
|
215
|
+
}
|
|
139
216
|
publicHeaders.set("accept", "text/markdown");
|
|
140
217
|
const publicResponse = await options.renderPage(
|
|
141
218
|
new Request(publicUrl, {
|
|
@@ -144,7 +221,7 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
144
221
|
signal: options.request.signal
|
|
145
222
|
})
|
|
146
223
|
);
|
|
147
|
-
if (publicResponse.headers.get("X-Farm-Markdown-Route") === targetPathname) {
|
|
224
|
+
if (publicResponse.headers.get("X-Farm-Markdown-Route") === targetPathname && publicResponse.headers.has("X-Farm-Markdown-Source")) {
|
|
148
225
|
publicSourceResponses.add(publicResponse);
|
|
149
226
|
return publicResponse;
|
|
150
227
|
}
|
|
@@ -159,6 +236,9 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
159
236
|
}
|
|
160
237
|
});
|
|
161
238
|
}
|
|
239
|
+
if (options.renderPage && !await anonymousVisitorOpensPage(options, url, targetPathname)) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
162
242
|
const headers = new Headers({
|
|
163
243
|
"Content-Type": "text/markdown; charset=utf-8",
|
|
164
244
|
"Content-Location": targetPathname === "/" ? "/index.md" : `${targetPathname}.md`,
|
|
@@ -188,5 +268,6 @@ export {
|
|
|
188
268
|
createMarkdownMetadata,
|
|
189
269
|
createFarmMarkdownRouteModule,
|
|
190
270
|
isFarmMarkdownPublicSourceResponse,
|
|
271
|
+
FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
|
|
191
272
|
createFarmMarkdownSourceResponse
|
|
192
273
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _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
|
|
3
|
+
var _chunkFUCSUGDMcjs = require('./chunk-FUCSUGDM.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
|
|
@@ -17,7 +17,7 @@ var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkNDILNQ4Lcjs = require('./chunk-NDILNQ4L.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
var _chunkWMAPPDMMcjs = require('./chunk-WMAPPDMM.cjs');
|
|
@@ -31,7 +31,7 @@ var _chunkSOR334EBcjs = require('./chunk-SOR334EB.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkSHLXACIOcjs = require('./chunk-SHLXACIO.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
@@ -68,6 +68,15 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
68
68
|
this.i18n = options.i18n;
|
|
69
69
|
this.bodySizeLimit = options.bodySizeLimit;
|
|
70
70
|
this.basePath = options.basePath;
|
|
71
|
+
this.dispatch = options.dispatch;
|
|
72
|
+
}
|
|
73
|
+
/** Every file the current handlers were loaded from: route files and root routes files. */
|
|
74
|
+
getSourceFiles() {
|
|
75
|
+
const files = /* @__PURE__ */ new Set();
|
|
76
|
+
for (const sources of this.endpointSources.values()) {
|
|
77
|
+
for (const { filePath } of sources.values()) files.add(filePath);
|
|
78
|
+
}
|
|
79
|
+
return files;
|
|
71
80
|
}
|
|
72
81
|
/**
|
|
73
82
|
* Discover route.ts files in /app/api and explicit endpoints in root routes.ts
|
|
@@ -93,8 +102,9 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
93
102
|
await this.loadProgrammaticApiRoutes(appDir);
|
|
94
103
|
}
|
|
95
104
|
this.routes = new Map(
|
|
96
|
-
|
|
97
|
-
bodySizeLimit: this.bodySizeLimit
|
|
105
|
+
_chunkNDILNQ4Lcjs.mergePluginAPIRoutes.call(void 0, [...this.routes.values()], this.plugins, void 0, {
|
|
106
|
+
bodySizeLimit: this.bodySizeLimit,
|
|
107
|
+
dispatch: this.dispatch
|
|
98
108
|
}).map((route) => [route.path, route])
|
|
99
109
|
);
|
|
100
110
|
} catch (error) {
|
|
@@ -140,7 +150,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
140
150
|
const routeModule = await this.loadModule(filePath);
|
|
141
151
|
const endpoints = {};
|
|
142
152
|
const availableMethods = [];
|
|
143
|
-
for (const method of
|
|
153
|
+
for (const method of _chunkNDILNQ4Lcjs.API_ROUTE_METHODS) {
|
|
144
154
|
if (routeModule[method]) {
|
|
145
155
|
endpoints[method] = routeModule[method];
|
|
146
156
|
availableMethods.push(method);
|
|
@@ -210,7 +220,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
210
220
|
async loadProgrammaticApiRoutes(appDir) {
|
|
211
221
|
const candidateRoots = [path.dirname(appDir), appDir];
|
|
212
222
|
const routeFiles = Array.from(
|
|
213
|
-
new Set(candidateRoots.flatMap((srcRoot) =>
|
|
223
|
+
new Set(candidateRoots.flatMap((srcRoot) => _chunkFUCSUGDMcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot)))
|
|
214
224
|
);
|
|
215
225
|
if (routeFiles.length === 0) return;
|
|
216
226
|
const { getProgrammaticRouteManifest } = await import("./routes.cjs");
|
|
@@ -256,11 +266,11 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
256
266
|
}
|
|
257
267
|
async loadModule(filePath) {
|
|
258
268
|
if (this.viteServer) {
|
|
259
|
-
return await
|
|
269
|
+
return await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, this.viteServer, filePath);
|
|
260
270
|
}
|
|
261
271
|
return await import(
|
|
262
272
|
/* @vite-ignore */
|
|
263
|
-
|
|
273
|
+
_chunkSHLXACIOcjs.toFileModuleUrl.call(void 0, filePath)
|
|
264
274
|
);
|
|
265
275
|
}
|
|
266
276
|
addEndpoint(routePath, filePath, method, endpoint, appDir, runtimeConfig = {}) {
|
|
@@ -322,7 +332,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
322
332
|
const url = new URL(request.url);
|
|
323
333
|
const pathname = url.pathname;
|
|
324
334
|
const method = request.method.toUpperCase();
|
|
325
|
-
const match =
|
|
335
|
+
const match = _chunkNDILNQ4Lcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
|
|
326
336
|
if (!match) {
|
|
327
337
|
return new Response(JSON.stringify({ error: "Not Found" }), {
|
|
328
338
|
status: 404,
|
|
@@ -330,19 +340,19 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
330
340
|
});
|
|
331
341
|
}
|
|
332
342
|
const { route, params } = match;
|
|
333
|
-
const endpoint =
|
|
343
|
+
const endpoint = _chunkNDILNQ4Lcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
|
|
334
344
|
if (!endpoint) {
|
|
335
345
|
return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
|
|
336
346
|
status: 405,
|
|
337
347
|
headers: {
|
|
338
|
-
Allow:
|
|
348
|
+
Allow: _chunkNDILNQ4Lcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
|
|
339
349
|
"Content-Type": "application/json"
|
|
340
350
|
}
|
|
341
351
|
});
|
|
342
352
|
}
|
|
343
353
|
const invoke = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
344
354
|
try {
|
|
345
|
-
return await
|
|
355
|
+
return await _chunkNDILNQ4Lcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, this.bodySizeLimit);
|
|
346
356
|
} catch (error) {
|
|
347
357
|
if (options.throwOnError) throw error;
|
|
348
358
|
console.error(`[API Error] ${pathname}:`, error);
|
|
@@ -364,7 +374,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
364
374
|
return Boolean(this.matchRoute(pathname));
|
|
365
375
|
}
|
|
366
376
|
matchRoute(pathname) {
|
|
367
|
-
return
|
|
377
|
+
return _chunkNDILNQ4Lcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
|
|
368
378
|
}
|
|
369
379
|
/**
|
|
370
380
|
* Get all routes for client type generation
|