@farm.js/core 0.1.37 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp-BC0bAGVF.d.mts → agent-mcp-BhneNPb4.d.mts} +1 -1
- package/dist/{agent-mcp-jyDHbQKe.d.ts → agent-mcp-HcTYQmNX.d.ts} +1 -1
- package/dist/{agent-mcp-handler-SJAHFSPI.cjs → agent-mcp-handler-MRGP3WJ3.cjs} +5 -5
- package/dist/{agent-mcp-handler-LPJ2CADR.mjs → agent-mcp-handler-OLRMZONF.mjs} +4 -4
- package/dist/agent-runtime.cjs +3 -3
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +2 -2
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +5 -5
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +4 -4
- package/dist/api/runtime.cjs +4 -4
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api/runtime.mjs +3 -3
- package/dist/api.cjs +7 -7
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +6 -6
- package/dist/{app-CKO3iN1c.d.ts → app-CMkoghtp.d.ts} +21 -3
- package/dist/{app-Cbkj9ufe.d.mts → app-DVzmmbNO.d.mts} +21 -3
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/app-markdown.mjs +3 -3
- package/dist/chunk-2ZYGC6SS.cjs +576 -0
- package/dist/{chunk-75X755YZ.cjs → chunk-34UCJRQO.cjs} +2 -2
- package/dist/{chunk-CVH2BXPY.cjs → chunk-3LOLJTFV.cjs} +6 -6
- package/dist/{chunk-4GPOC4LN.cjs → chunk-472NCAZ7.cjs} +3 -3
- package/dist/{chunk-O6WAEAX3.mjs → chunk-5BWWFHR2.mjs} +70 -15
- package/dist/{chunk-6LGFV2CQ.cjs → chunk-5OKBARDN.cjs} +2 -2
- package/dist/{chunk-3IP27TCG.cjs → chunk-5PWXMJOH.cjs} +19 -19
- package/dist/{chunk-WT4TGLXT.cjs → chunk-5ULKUBIA.cjs} +6 -6
- package/dist/{chunk-WRPHYQVY.mjs → chunk-677THUVP.mjs} +1 -1
- package/dist/chunk-6BK3K2GB.mjs +318 -0
- package/dist/{chunk-HEVMCTSR.mjs → chunk-6HB6V3R7.mjs} +1 -1
- package/dist/{chunk-NICDYKBS.cjs → chunk-6XWDE2P2.cjs} +22 -4
- package/dist/{chunk-CXEN47J3.mjs → chunk-73WX6PRY.mjs} +25 -0
- package/dist/{chunk-EXG5LD6B.mjs → chunk-75HN5IZ3.mjs} +21 -9
- package/dist/{chunk-7O5M4UKW.cjs → chunk-A657YSP4.cjs} +2 -2
- package/dist/{chunk-LBDP3YT3.mjs → chunk-ARC7I3O2.mjs} +1 -1
- package/dist/{chunk-Q5FYSK45.cjs → chunk-AS2VPMEE.cjs} +640 -521
- package/dist/{chunk-Z5BEWYVO.mjs → chunk-ATSDUUFK.mjs} +27 -1
- package/dist/{chunk-EMMQ64QW.cjs → chunk-B5J2YVG7.cjs} +16 -16
- package/dist/{chunk-FWE7LEQC.cjs → chunk-BD3D7EZV.cjs} +4 -4
- package/dist/{chunk-Z7LA7MHQ.mjs → chunk-BFJTHYTN.mjs} +1 -1
- package/dist/{chunk-UJZLSXUB.cjs → chunk-BWIQR4DH.cjs} +30 -4
- package/dist/{chunk-W2YDNK66.cjs → chunk-BXDJXFQG.cjs} +4 -4
- package/dist/{chunk-MCIZVNOQ.mjs → chunk-BZHXGVMA.mjs} +1 -1
- package/dist/{chunk-7DWNJI73.cjs → chunk-CIOT4HGT.cjs} +37 -19
- package/dist/{chunk-KDTBF3UU.mjs → chunk-CNNOLE4O.mjs} +1 -1
- package/dist/{chunk-TDNWPAVR.mjs → chunk-CUM5NYL5.mjs} +1 -1
- package/dist/{chunk-HITLGIAO.cjs → chunk-CY2ZQ5C6.cjs} +7 -6
- package/dist/{chunk-KPFKMDM7.mjs → chunk-EGCTIS5F.mjs} +2 -2
- package/dist/{chunk-VR4GD5I3.cjs → chunk-EIPC3FDA.cjs} +12 -4
- package/dist/{chunk-B5PFZLKV.cjs → chunk-EKN7NSZO.cjs} +25 -8
- package/dist/{chunk-6SJ2KJTA.mjs → chunk-EPYU2EBL.mjs} +1 -1
- package/dist/{chunk-LBGILORX.mjs → chunk-GKBWWRBG.mjs} +101 -10
- package/dist/{chunk-PTZ2TVNE.cjs → chunk-H5CLOUZS.cjs} +5 -5
- package/dist/{chunk-DTSROJ5J.mjs → chunk-HD5CF3OE.mjs} +1 -1
- package/dist/{chunk-3A4KGQYI.cjs → chunk-HRETEZ2Z.cjs} +27 -15
- package/dist/{chunk-ATWHHSY2.cjs → chunk-HRSAQ23K.cjs} +7 -7
- package/dist/{chunk-IAIYV4RZ.mjs → chunk-HXRYZWTA.mjs} +1 -1
- package/dist/{chunk-4P6ULFMD.mjs → chunk-HYTZYOW2.mjs} +222 -103
- package/dist/{chunk-HMRSWN47.mjs → chunk-INL3THCU.mjs} +1 -1
- package/dist/{chunk-FBOJ55OM.mjs → chunk-IVLZZZEI.mjs} +1 -1
- package/dist/{chunk-ENLZ4R3Y.mjs → chunk-J7K2NZD6.mjs} +7 -6
- package/dist/{chunk-PMQHMWZU.cjs → chunk-JCYYXBAJ.cjs} +3 -3
- package/dist/{chunk-K3SAEIM3.mjs → chunk-KTSUBU2E.mjs} +2 -2
- package/dist/{chunk-LPFV45AY.cjs → chunk-LMPAPBUA.cjs} +19 -19
- package/dist/{chunk-EK4QAEFZ.cjs → chunk-LZESP4IR.cjs} +25 -0
- package/dist/{chunk-TW4GYDBJ.mjs → chunk-MLY2RP5R.mjs} +10 -2
- package/dist/{chunk-BHY547NB.cjs → chunk-NBBEQLOK.cjs} +9 -9
- package/dist/{chunk-WQ7T2263.mjs → chunk-OAHTRMIC.mjs} +3 -3
- package/dist/{chunk-HZFM2LWQ.mjs → chunk-P3PLW4FR.mjs} +34 -2
- package/dist/{chunk-UH6QN5NL.mjs → chunk-P664ZVTV.mjs} +2 -2
- package/dist/{chunk-TE2G5ION.cjs → chunk-PGZDEPTM.cjs} +88 -33
- package/dist/{chunk-3KGDJLJK.mjs → chunk-POSPE3IO.mjs} +19 -1
- package/dist/{chunk-FGRYBX5X.mjs → chunk-PVZE2JGJ.mjs} +2 -2
- package/dist/{chunk-TPLJVC7E.mjs → chunk-QFW2IH5E.mjs} +23 -6
- package/dist/{chunk-5BXGGEC7.cjs → chunk-QG775BRV.cjs} +17 -17
- package/dist/{chunk-S3VWVTVA.mjs → chunk-QRKIMN7T.mjs} +13 -1
- package/dist/chunk-QTXBII4Z.cjs +632 -0
- package/dist/{chunk-NQ6QFZWD.cjs → chunk-QUCXCDE2.cjs} +1 -1
- package/dist/{chunk-NFMDCAOS.mjs → chunk-QYMZOOC5.mjs} +3 -3
- package/dist/{chunk-CI6E3UOH.cjs → chunk-RG4A6LB2.cjs} +7 -7
- package/dist/{chunk-LOFKRKO7.cjs → chunk-RVXFINNS.cjs} +113 -22
- package/dist/{chunk-7SQ5SGYZ.cjs → chunk-RW63BOV7.cjs} +2 -2
- package/dist/{chunk-U6MPZ35Q.cjs → chunk-RWFLWR5J.cjs} +8 -8
- package/dist/{chunk-EUV4YR3V.cjs → chunk-SGBJ247Q.cjs} +18 -2
- package/dist/{chunk-J3ANCZKA.mjs → chunk-SKVTP5PR.mjs} +1 -1
- package/dist/{chunk-YCKO6FRS.mjs → chunk-SOP2EAA6.mjs} +1 -1
- package/dist/{chunk-ND2CWPOD.mjs → chunk-TS4JHGUJ.mjs} +1 -1
- package/dist/chunk-U6QLDL3G.mjs +576 -0
- package/dist/{chunk-OW67PDDS.cjs → chunk-ULASELLA.cjs} +13 -1
- package/dist/{chunk-4GWRFP22.cjs → chunk-UPJLHLJU.cjs} +35 -3
- package/dist/{chunk-WWIKMBRN.mjs → chunk-VNGH5MLF.mjs} +17 -1
- package/dist/{chunk-NNSAQX3U.mjs → chunk-VT4WFRHA.mjs} +1 -1
- package/dist/{chunk-JPNFPAZ4.mjs → chunk-VWBHM3F6.mjs} +2 -2
- package/dist/{chunk-ADOAUDQ6.cjs → chunk-VXEEATVD.cjs} +2 -2
- package/dist/{chunk-RRMVL6CJ.mjs → chunk-W36M2BQ4.mjs} +1 -1
- package/dist/{chunk-4WQ6PGSJ.cjs → chunk-WEW2JVA4.cjs} +4 -4
- package/dist/{chunk-4E5WBPEG.mjs → chunk-WFRT7JPX.mjs} +8 -533
- package/dist/{chunk-VXAWRDK7.mjs → chunk-WLL43JMO.mjs} +1 -1
- package/dist/chunk-WW46B6HA.cjs +318 -0
- package/dist/{chunk-D3C5LBQY.cjs → chunk-WXJLNP33.cjs} +2 -2
- package/dist/{chunk-NDILNQ4L.cjs → chunk-XKG2BLFN.cjs} +2 -2
- package/dist/{chunk-6TJITR2B.cjs → chunk-YFYUYWL7.cjs} +870 -751
- package/dist/{chunk-XOPOIFTJ.mjs → chunk-YKZRDB5Z.mjs} +25 -7
- package/dist/{chunk-K4I4O5TS.mjs → chunk-ZUPXLIGB.mjs} +790 -671
- package/dist/{chunk-G2TEB74S.cjs → chunk-ZXH4TS3F.cjs} +2 -2
- package/dist/{client-plugins-CV4eJ9De.d.mts → client-plugins-CsCuCLBz.d.mts} +58 -7
- package/dist/{client-plugins-C8DjftDF.d.ts → client-plugins-D0ke-Hc8.d.ts} +58 -7
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +7 -7
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +6 -6
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-KVOY2TCZ.mjs → devtools-5AFIPVUJ.mjs} +8 -6
- package/dist/{devtools-JXFQNWSH.cjs → devtools-LW4QQ5J3.cjs} +9 -7
- package/dist/docs.cjs +12 -10
- package/dist/docs.d.mts +20 -2
- package/dist/docs.d.ts +20 -2
- package/dist/docs.mjs +11 -9
- package/dist/headers.cjs +6 -4
- package/dist/headers.d.mts +11 -1
- package/dist/headers.d.ts +11 -1
- package/dist/headers.mjs +5 -3
- package/dist/index.cjs +55 -42
- package/dist/index.d.mts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.mjs +55 -42
- package/dist/integrations.cjs +5 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +4 -2
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +30 -29
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +29 -28
- package/dist/internal/cli-runtime.cjs +11 -9
- package/dist/internal/cli-runtime.mjs +10 -8
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.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 +9 -7
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +8 -6
- package/dist/internal/docs-precompiled-runtime.cjs +19 -13
- package/dist/internal/docs-precompiled-runtime.d.mts +5 -0
- package/dist/internal/docs-precompiled-runtime.d.ts +5 -0
- package/dist/internal/docs-precompiled-runtime.mjs +14 -8
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-node-env.cjs +6 -2
- package/dist/internal/production-node-env.d.mts +10 -1
- package/dist/internal/production-node-env.d.ts +10 -1
- package/dist/internal/production-node-env.mjs +5 -1
- package/dist/internal/production-runtime.cjs +38 -16
- package/dist/internal/production-runtime.d.mts +51 -11
- package/dist/internal/production-runtime.d.ts +51 -11
- package/dist/internal/production-runtime.mjs +40 -18
- package/dist/markdown.cjs +8 -2
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +7 -1
- package/dist/middleware.cjs +10 -8
- package/dist/middleware.d.mts +24 -4
- package/dist/middleware.d.ts +24 -4
- package/dist/middleware.mjs +10 -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/plugin.cjs +23 -22
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +22 -21
- package/dist/{production-runtime-C2kkrPVZ.d.ts → production-runtime-BaI3WHnV.d.ts} +1 -1
- package/dist/{production-runtime-Du_FHb2-.d.mts → production-runtime-DfRP0cV0.d.mts} +1 -1
- package/dist/query/client.cjs +8 -8
- package/dist/query/client.mjs +3 -3
- package/dist/{render-plan-BnnPTpus.d.ts → render-plan-CfIdJKAf.d.ts} +1 -1
- package/dist/{render-plan-Cgx7v8tJ.d.mts → render-plan-Dg8RBYFa.d.mts} +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +13 -4
- package/dist/renderer.d.ts +13 -4
- package/dist/{request-BNWr7r5e.d.ts → request-CEbHIIl4.d.ts} +4 -2
- package/dist/{request-sKayKcop.d.mts → request-DfE02G_A.d.mts} +4 -2
- 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-DWFp3Yq4.d.mts → route-rendering-BHyOfXjD.d.mts} +1 -1
- package/dist/{route-rendering-Bx4Auw6Q.d.ts → route-rendering-C4oHbv6C.d.ts} +1 -1
- package/dist/{router-BK6K42Ij.d.mts → router-DwhA61SB.d.mts} +1 -1
- package/dist/{router-DnW_2tQi.d.ts → router-uRN_29Em.d.ts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{runtime-DJDaCMd_.d.mts → runtime-BEdHhN4C.d.mts} +1 -1
- package/dist/{runtime-CA3Ei5k_.d.ts → runtime-COk03hmx.d.ts} +1 -1
- package/dist/server-fn.cjs +3 -3
- package/dist/server-fn.mjs +2 -2
- 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 +4 -4
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +49 -48
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +27 -26
- package/dist/{spa-router-Mwbd7g2L.d.ts → spa-router-DrVOBVGg.d.ts} +2 -2
- package/dist/{spa-router-D6fUA4Rn.d.mts → spa-router-w4aFOuyn.d.mts} +2 -2
- package/dist/testing.cjs +5 -5
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +4 -4
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-p9Hs-jCc.d.mts → utils-BtYehqeU.d.mts} +1 -1
- package/dist/{utils-BwVcAfUR.d.ts → utils-Dhuqwmd2.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +23 -22
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +22 -21
- package/package.json +1 -1
- package/dist/chunk-655RLQQL.mjs +0 -43
- package/dist/chunk-MRMI32SN.cjs +0 -1157
- package/dist/chunk-MT763TDW.cjs +0 -43
|
@@ -15,7 +15,10 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
15
15
|
var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk2ZYGC6SScjs = require('./chunk-2ZYGC6SS.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkSGBJ247Qcjs = require('./chunk-SGBJ247Q.cjs');
|
|
19
22
|
|
|
20
23
|
|
|
21
24
|
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
@@ -24,6 +27,12 @@ var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
|
24
27
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
25
28
|
|
|
26
29
|
// src/docs/handler.ts
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
27
36
|
var _fs = require('fs');
|
|
28
37
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
29
38
|
var _marked = require('marked');
|
|
@@ -718,15 +727,46 @@ function getRequestSlug(docs, request) {
|
|
|
718
727
|
return normalizeSlug(pathname.slice(entry.length));
|
|
719
728
|
}
|
|
720
729
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getRequestSlug, "getRequestSlug");
|
|
730
|
+
function isDiscoverableDocsEntryName(name) {
|
|
731
|
+
return Boolean(name) && !name.startsWith(".") && name !== "node_modules";
|
|
732
|
+
}
|
|
733
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isDiscoverableDocsEntryName, "isDiscoverableDocsEntryName");
|
|
734
|
+
function isDiscoverableDocsFile(contentDir, filePath) {
|
|
735
|
+
const segments = _path2.default.relative(contentDir, filePath).split(_path2.default.sep);
|
|
736
|
+
let dir = contentDir;
|
|
737
|
+
for (const [index, name] of segments.entries()) {
|
|
738
|
+
if (!isDiscoverableDocsEntryName(name)) return false;
|
|
739
|
+
let entry;
|
|
740
|
+
try {
|
|
741
|
+
entry = _fs.readdirSync.call(void 0, dir, { withFileTypes: true }).find(
|
|
742
|
+
(candidate) => candidate.name === name
|
|
743
|
+
);
|
|
744
|
+
} catch (e7) {
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
const isLast = index === segments.length - 1;
|
|
748
|
+
if (!entry || !(isLast ? entry.isFile() : entry.isDirectory())) return false;
|
|
749
|
+
dir = _path2.default.join(dir, name);
|
|
750
|
+
}
|
|
751
|
+
return true;
|
|
752
|
+
}
|
|
753
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isDiscoverableDocsFile, "isDiscoverableDocsFile");
|
|
721
754
|
function findDocsPageFile(contentDir, slug) {
|
|
722
|
-
const
|
|
723
|
-
|
|
755
|
+
const canonicalSlug = trimSlashes(slug);
|
|
756
|
+
const segments = canonicalSlug ? canonicalSlug.split("/") : [];
|
|
757
|
+
if (!segments.every((segment) => isSafeSegment(segment) && isDiscoverableDocsEntryName(segment))) {
|
|
758
|
+
return null;
|
|
759
|
+
}
|
|
724
760
|
const slugDir = _path2.default.join(contentDir, ...segments);
|
|
725
761
|
const candidates = segments.length === 0 ? DOCS_FILE_NAMES.map((filename) => _path2.default.join(contentDir, filename)) : [
|
|
726
762
|
...DOCS_FILE_NAMES.map((filename) => _path2.default.join(slugDir, filename)),
|
|
727
|
-
...DOCS_FILE_EXTENSIONS2.map(
|
|
763
|
+
...DOCS_FILE_EXTENSIONS2.map(
|
|
764
|
+
(extension) => _path2.default.join(contentDir, `${canonicalSlug}${extension}`)
|
|
765
|
+
)
|
|
728
766
|
];
|
|
729
767
|
for (const candidate of candidates) {
|
|
768
|
+
if (pathToSlug(contentDir, candidate) !== canonicalSlug) continue;
|
|
769
|
+
if (!isDiscoverableDocsFile(contentDir, candidate)) continue;
|
|
730
770
|
const safePath = resolveExistingFileInside(contentDir, candidate);
|
|
731
771
|
if (safePath) {
|
|
732
772
|
return safePath;
|
|
@@ -784,6 +824,10 @@ function loadFarmDocsPage(contentDir, docs, slug) {
|
|
|
784
824
|
};
|
|
785
825
|
}
|
|
786
826
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmDocsPage, "loadFarmDocsPage");
|
|
827
|
+
function getFarmDocsMarkdownPath(href) {
|
|
828
|
+
return href === "/" ? "/.md" : `${href}.md`;
|
|
829
|
+
}
|
|
830
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmDocsMarkdownPath, "getFarmDocsMarkdownPath");
|
|
787
831
|
function createDocsHref(entry, slug) {
|
|
788
832
|
const normalizedEntry = normalizeEntry2(entry);
|
|
789
833
|
const normalizedSlug = trimSlashes(slug);
|
|
@@ -861,8 +905,8 @@ function getDocsDescription(docs) {
|
|
|
861
905
|
return _optionalChain([docs, 'access', _51 => _51.config, 'access', _52 => _52.metadata, 'optionalAccess', _53 => _53.description]);
|
|
862
906
|
}
|
|
863
907
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsDescription, "getDocsDescription");
|
|
864
|
-
function getLoadedDocsPages(contentDir, docs) {
|
|
865
|
-
return discoverFarmDocsPages(contentDir, docs).map((page) => loadFarmDocsPage(contentDir, docs, page.slug)).filter((page) => Boolean(page));
|
|
908
|
+
function getLoadedDocsPages(contentDir, docs, isPathGuarded) {
|
|
909
|
+
return discoverFarmDocsPages(contentDir, docs).filter((page) => !_optionalChain([isPathGuarded, 'optionalCall', _54 => _54(page.href)])).map((page) => loadFarmDocsPage(contentDir, docs, page.slug)).filter((page) => Boolean(page));
|
|
866
910
|
}
|
|
867
911
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getLoadedDocsPages, "getLoadedDocsPages");
|
|
868
912
|
function toDocsLlmsPage(page) {
|
|
@@ -942,7 +986,7 @@ function resolveReadingTimeDisplayConfig(docs) {
|
|
|
942
986
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveReadingTimeDisplayConfig, "resolveReadingTimeDisplayConfig");
|
|
943
987
|
function countMarkdownWords(body, includeCode) {
|
|
944
988
|
const readable = (includeCode ? body : body.replace(/```[\s\S]*?```/g, " ").replace(/`[^`]*`/g, " ")).replace(/!\[[^\]]*]\([^)]*\)/g, " ").replace(/\[([^\]]+)]\([^)]*\)/g, "$1").replace(/<[^>]+>/g, " ").replace(/[#>*_~`|:-]/g, " ");
|
|
945
|
-
return _nullishCoalesce(_optionalChain([readable, 'access',
|
|
989
|
+
return _nullishCoalesce(_optionalChain([readable, 'access', _55 => _55.match, 'call', _56 => _56(/[A-Za-z0-9]+(?:[-'][A-Za-z0-9]+)*/g), 'optionalAccess', _57 => _57.length]), () => ( 0));
|
|
946
990
|
}
|
|
947
991
|
_chunkS3JO3N4Hcjs.__name.call(void 0, countMarkdownWords, "countMarkdownWords");
|
|
948
992
|
function renderReadingTimeMeta(page, docs) {
|
|
@@ -1057,10 +1101,10 @@ function getDocsDiscoveryOptions(docs, request) {
|
|
|
1057
1101
|
};
|
|
1058
1102
|
}
|
|
1059
1103
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsDiscoveryOptions, "getDocsDiscoveryOptions");
|
|
1060
|
-
function createFarmDocsPublicResponse(contentDir, docs, request) {
|
|
1104
|
+
function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded) {
|
|
1061
1105
|
const url = new URL(request.url);
|
|
1062
1106
|
let loadedPages;
|
|
1063
|
-
const getPages = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _nullishCoalesce(loadedPages, () => ( (loadedPages = getLoadedDocsPages(contentDir, docs)))), "getPages");
|
|
1107
|
+
const getPages = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _nullishCoalesce(loadedPages, () => ( (loadedPages = getLoadedDocsPages(contentDir, docs, isPathGuarded)))), "getPages");
|
|
1064
1108
|
const sitemapManifest = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsSitemapManifest({
|
|
1065
1109
|
pages: getPages().map(toDocsSitemapPage),
|
|
1066
1110
|
entry: docs.entry,
|
|
@@ -1181,11 +1225,11 @@ function shouldReturnMarkdown(request) {
|
|
|
1181
1225
|
if (url.pathname.endsWith(".md")) return true;
|
|
1182
1226
|
const accept = request.headers.get("accept");
|
|
1183
1227
|
const markdown = Math.max(
|
|
1184
|
-
|
|
1185
|
-
|
|
1228
|
+
_chunkSGBJ247Qcjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
|
|
1229
|
+
_chunkSGBJ247Qcjs.farmAcceptQuality.call(void 0, accept, "text/plain")
|
|
1186
1230
|
);
|
|
1187
1231
|
if (markdown <= 0) return false;
|
|
1188
|
-
return markdown >=
|
|
1232
|
+
return markdown >= _chunkSGBJ247Qcjs.farmAcceptQuality.call(void 0, accept, "text/html", { wildcards: true });
|
|
1189
1233
|
}
|
|
1190
1234
|
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldReturnMarkdown, "shouldReturnMarkdown");
|
|
1191
1235
|
function escapeAttribute(value) {
|
|
@@ -1212,7 +1256,7 @@ function stripHtml(value) {
|
|
|
1212
1256
|
_chunkS3JO3N4Hcjs.__name.call(void 0, stripHtml, "stripHtml");
|
|
1213
1257
|
function getCodeFence(line) {
|
|
1214
1258
|
const match = /^(?: {0,3})(`{3,}|~{3,})/.exec(line);
|
|
1215
|
-
const value = _optionalChain([match, 'optionalAccess',
|
|
1259
|
+
const value = _optionalChain([match, 'optionalAccess', _58 => _58[1]]);
|
|
1216
1260
|
if (!value) return null;
|
|
1217
1261
|
return { marker: value[0], length: value.length };
|
|
1218
1262
|
}
|
|
@@ -1297,16 +1341,16 @@ function isCodePathLabel(label) {
|
|
|
1297
1341
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isCodePathLabel, "isCodePathLabel");
|
|
1298
1342
|
function parseCodeInfo(info) {
|
|
1299
1343
|
const source = (info || "").trim();
|
|
1300
|
-
const language = _optionalChain([source, 'access',
|
|
1301
|
-
const explicitLabel = _optionalChain([source, 'access',
|
|
1344
|
+
const language = _optionalChain([source, 'access', _59 => _59.match, 'call', _60 => _60(/^\S+/), 'optionalAccess', _61 => _61[0]]) || "text";
|
|
1345
|
+
const explicitLabel = _optionalChain([source, 'access', _62 => _62.match, 'call', _63 => _63(/\b(?:title|filename|file|label|name)=["']([^"']+)["']/), 'optionalAccess', _64 => _64[1], 'optionalAccess', _65 => _65.trim, 'call', _66 => _66()]);
|
|
1302
1346
|
return { language, label: explicitLabel || language, hasExplicitLabel: Boolean(explicitLabel) };
|
|
1303
1347
|
}
|
|
1304
1348
|
_chunkS3JO3N4Hcjs.__name.call(void 0, parseCodeInfo, "parseCodeInfo");
|
|
1305
1349
|
function getStandaloneCodeLabel(line) {
|
|
1306
1350
|
const trimmed = line.trim();
|
|
1307
1351
|
const match = /^(?:\*\*([^*]+)\*\*|__([^_]+)__|`([^`]+)`)$/u.exec(trimmed);
|
|
1308
|
-
const label = _optionalChain([match, 'optionalAccess',
|
|
1309
|
-
return _optionalChain([label, 'optionalAccess',
|
|
1352
|
+
const label = _optionalChain([match, 'optionalAccess', _67 => _67[1]]) || _optionalChain([match, 'optionalAccess', _68 => _68[2]]) || _optionalChain([match, 'optionalAccess', _69 => _69[3]]);
|
|
1353
|
+
return _optionalChain([label, 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]) || null;
|
|
1310
1354
|
}
|
|
1311
1355
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getStandaloneCodeLabel, "getStandaloneCodeLabel");
|
|
1312
1356
|
function hasCodeFenceTitle(info) {
|
|
@@ -1438,7 +1482,7 @@ function getThemeName(docs) {
|
|
|
1438
1482
|
}
|
|
1439
1483
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getThemeName, "getThemeName");
|
|
1440
1484
|
function getThemeTocDepth(docs) {
|
|
1441
|
-
const toc = _optionalChain([getThemeUI, 'call',
|
|
1485
|
+
const toc = _optionalChain([getThemeUI, 'call', _72 => _72(docs), 'access', _73 => _73.layout, 'optionalAccess', _74 => _74.toc]);
|
|
1442
1486
|
return toc && typeof toc === "object" && typeof toc.depth === "number" ? toc.depth : 3;
|
|
1443
1487
|
}
|
|
1444
1488
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getThemeTocDepth, "getThemeTocDepth");
|
|
@@ -1593,7 +1637,7 @@ function renderSidebarLabel(docs, icon, label, className) {
|
|
|
1593
1637
|
}
|
|
1594
1638
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderSidebarLabel, "renderSidebarLabel");
|
|
1595
1639
|
function getSidebarPageLabel(item, configured) {
|
|
1596
|
-
if (_optionalChain([configured, 'optionalAccess',
|
|
1640
|
+
if (_optionalChain([configured, 'optionalAccess', _75 => _75.label])) return configured.label;
|
|
1597
1641
|
if (item.slug === "") return "Why?";
|
|
1598
1642
|
if (item.slug === "integrations") return "Overview";
|
|
1599
1643
|
if (item.slug === "integrations/ui-registry") return "UI Registry";
|
|
@@ -1606,7 +1650,7 @@ function getSidebarPageLabel(item, configured) {
|
|
|
1606
1650
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getSidebarPageLabel, "getSidebarPageLabel");
|
|
1607
1651
|
function renderSidebarLink(item, activeHref, docs, configured) {
|
|
1608
1652
|
const active = item.href === activeHref;
|
|
1609
|
-
return `<a class="fd-sidebar-link${active ? " fd-sidebar-link-active" : ""}" data-active="${active ? "true" : "false"}" href="${escapeAttribute(item.href)}">${renderSidebarLabel(docs, _optionalChain([configured, 'optionalAccess',
|
|
1653
|
+
return `<a class="fd-sidebar-link${active ? " fd-sidebar-link-active" : ""}" data-active="${active ? "true" : "false"}" href="${escapeAttribute(item.href)}">${renderSidebarLabel(docs, _optionalChain([configured, 'optionalAccess', _76 => _76.icon]), getSidebarPageLabel(item, configured), "sidebar-link-label fd-sidebar-link-label")}</a>`;
|
|
1610
1654
|
}
|
|
1611
1655
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderSidebarLink, "renderSidebarLink");
|
|
1612
1656
|
function collectConfiguredSidebarPages(items, maps, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -1786,11 +1830,11 @@ function renderDocsSearchTrigger(showIcon = true, className = "") {
|
|
|
1786
1830
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderDocsSearchTrigger, "renderDocsSearchTrigger");
|
|
1787
1831
|
function renderDocsSearchMount(clientEntry) {
|
|
1788
1832
|
return `<div id="farm-docs-search-root" data-farm-docs-search-root data-api="/api/docs"></div>
|
|
1789
|
-
|
|
1833
|
+
${_chunk2ZYGC6SScjs.stampFarmCspNonce.call(void 0, `<script type="module" src="${escapeAttribute(clientEntry)}"></script>`)}`;
|
|
1790
1834
|
}
|
|
1791
1835
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderDocsSearchMount, "renderDocsSearchMount");
|
|
1792
1836
|
function renderDocsSearchBootstrapScript() {
|
|
1793
|
-
return `<script>${_chunkMWWVKDW3cjs.generateFarmDocsSearchBootstrapRuntime.call(void 0, )}</script
|
|
1837
|
+
return _chunk2ZYGC6SScjs.stampFarmCspNonce.call(void 0, `<script>${_chunkMWWVKDW3cjs.generateFarmDocsSearchBootstrapRuntime.call(void 0, )}</script>`);
|
|
1794
1838
|
}
|
|
1795
1839
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderDocsSearchBootstrapScript, "renderDocsSearchBootstrapScript");
|
|
1796
1840
|
function renderPixelToc(items) {
|
|
@@ -1820,9 +1864,9 @@ function renderDocsHashRuntimeScript() {
|
|
|
1820
1864
|
}
|
|
1821
1865
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderDocsHashRuntimeScript, "renderDocsHashRuntimeScript");
|
|
1822
1866
|
function renderDocsRuntimeScripts(docs) {
|
|
1823
|
-
return `${renderDocsRuntimeScript(docs)}
|
|
1867
|
+
return _chunk2ZYGC6SScjs.stampFarmCspNonce.call(void 0, `${renderDocsRuntimeScript(docs)}
|
|
1824
1868
|
${renderDocsHashRuntimeScript()}
|
|
1825
|
-
${renderDocsPageActionsRuntimeScript()}
|
|
1869
|
+
${renderDocsPageActionsRuntimeScript()}`);
|
|
1826
1870
|
}
|
|
1827
1871
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderDocsRuntimeScripts, "renderDocsRuntimeScripts");
|
|
1828
1872
|
function renderFarmDocsFontPreloads(fontAssets) {
|
|
@@ -1837,8 +1881,8 @@ function renderFarmDocsFontPreloadHeader(fontAssets) {
|
|
|
1837
1881
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderFarmDocsFontPreloadHeader, "renderFarmDocsFontPreloadHeader");
|
|
1838
1882
|
function getFarmLayoutFontPreloads(layoutFonts) {
|
|
1839
1883
|
const seen = /* @__PURE__ */ new Set();
|
|
1840
|
-
return [_optionalChain([layoutFonts, 'optionalAccess',
|
|
1841
|
-
(font) => (_optionalChain([font, 'optionalAccess',
|
|
1884
|
+
return [_optionalChain([layoutFonts, 'optionalAccess', _77 => _77.body]), _optionalChain([layoutFonts, 'optionalAccess', _78 => _78.code])].flatMap(
|
|
1885
|
+
(font) => (_optionalChain([font, 'optionalAccess', _79 => _79.preloads]) || []).filter(({ href }) => {
|
|
1842
1886
|
if (seen.has(href)) return false;
|
|
1843
1887
|
seen.add(href);
|
|
1844
1888
|
return true;
|
|
@@ -1852,7 +1896,7 @@ function renderFarmLayoutFontPreloadHeader(layoutFonts) {
|
|
|
1852
1896
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderFarmLayoutFontPreloadHeader, "renderFarmLayoutFontPreloadHeader");
|
|
1853
1897
|
function renderPixelDocsHtml(page, pages, docs, clientEntry, faviconHref, requestUrl, fontAssets, fontStylesheetHref, globalStylesheetHref) {
|
|
1854
1898
|
const navTitle = typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Docs") : "Docs";
|
|
1855
|
-
const description = page.description || _optionalChain([docs, 'access',
|
|
1899
|
+
const description = page.description || _optionalChain([docs, 'access', _80 => _80.config, 'access', _81 => _81.metadata, 'optionalAccess', _82 => _82.description]) || "";
|
|
1856
1900
|
const renderedMarkdown = renderMarkdownDocument(page.body, getThemeTocDepth(docs));
|
|
1857
1901
|
const tocItems = renderedMarkdown.tocItems;
|
|
1858
1902
|
const themeName = getThemeName(docs);
|
|
@@ -1927,14 +1971,16 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1927
1971
|
const fontAssets = _nullishCoalesce(options.fontAssets, () => ( _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, options.root))));
|
|
1928
1972
|
const fallbackFontPreloadHeader = renderFarmDocsFontPreloadHeader(fontAssets);
|
|
1929
1973
|
return /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async function handleFarmDocsRequest(request) {
|
|
1930
|
-
if (!_optionalChain([docs, 'optionalAccess',
|
|
1974
|
+
if (!_optionalChain([docs, 'optionalAccess', _83 => _83.enabled]) || request.method !== "GET" && request.method !== "HEAD") return null;
|
|
1931
1975
|
await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
|
|
1932
1976
|
const contentDir = resolveFarmDocsContentDir(docs, options);
|
|
1933
1977
|
const requestUrl = new URL(request.url);
|
|
1934
1978
|
const socialImageSlug = getFarmDocsSocialImageSlug(docs, requestUrl);
|
|
1935
1979
|
if (socialImageSlug !== null) {
|
|
1936
1980
|
const socialImagePage = loadFarmDocsPage(contentDir, docs, socialImageSlug);
|
|
1937
|
-
if (!socialImagePage ||
|
|
1981
|
+
if (!socialImagePage || // The image sits outside the page's URL, where its guard does not reach, and
|
|
1982
|
+
// draws the page's title.
|
|
1983
|
+
_optionalChain([options, 'access', _84 => _84.isPathGuarded, 'optionalCall', _85 => _85(socialImagePage.href)]) || !isFarmDocsSocialImageEnabled(socialImagePage, docs) || getFarmDocsCustomSocialImage(socialImagePage)) {
|
|
1938
1984
|
return null;
|
|
1939
1985
|
}
|
|
1940
1986
|
const descriptor = createFarmDocsSocialImageDescriptor(socialImagePage, docs, requestUrl);
|
|
@@ -1953,12 +1999,20 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1953
1999
|
if (request.method === "HEAD") return new Response(null, { status: 200, headers });
|
|
1954
2000
|
return new Response(renderFarmDocsSocialImageSvg(descriptor), { status: 200, headers });
|
|
1955
2001
|
}
|
|
1956
|
-
const publicResponse = createFarmDocsPublicResponse(
|
|
2002
|
+
const publicResponse = createFarmDocsPublicResponse(
|
|
2003
|
+
contentDir,
|
|
2004
|
+
docs,
|
|
2005
|
+
request,
|
|
2006
|
+
options.isPathGuarded
|
|
2007
|
+
);
|
|
1957
2008
|
if (publicResponse) return omitFarmDocsHeadBody(request, publicResponse);
|
|
1958
2009
|
if (!isFarmDocsRequest(docs, request)) return null;
|
|
1959
2010
|
const page = loadPage(contentDir, docs, request);
|
|
1960
2011
|
if (!page) return null;
|
|
1961
2012
|
const negotiatesAccept = !requestUrl.pathname.endsWith(".md");
|
|
2013
|
+
if (!negotiatesAccept && _optionalChain([options, 'access', _86 => _86.isPathGuarded, 'optionalCall', _87 => _87(page.href)]) && !options.isPathGuarded(getFarmDocsMarkdownPath(page.href))) {
|
|
2014
|
+
return null;
|
|
2015
|
+
}
|
|
1962
2016
|
if (shouldReturnMarkdown(request)) {
|
|
1963
2017
|
const origin = new URL(request.url).origin;
|
|
1964
2018
|
return omitFarmDocsHeadBody(
|
|
@@ -1981,8 +2035,8 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1981
2035
|
);
|
|
1982
2036
|
}
|
|
1983
2037
|
const pathname = new URL(request.url).pathname;
|
|
1984
|
-
const layoutFonts = await _optionalChain([options, 'access',
|
|
1985
|
-
const usesLayoutFonts = Boolean(_optionalChain([layoutFonts, 'optionalAccess',
|
|
2038
|
+
const layoutFonts = await _optionalChain([options, 'access', _88 => _88.resolveLayoutFonts, 'optionalCall', _89 => _89(pathname)]);
|
|
2039
|
+
const usesLayoutFonts = Boolean(_optionalChain([layoutFonts, 'optionalAccess', _90 => _90.body]) || _optionalChain([layoutFonts, 'optionalAccess', _91 => _91.code]));
|
|
1986
2040
|
const activeFontAssets = usesLayoutFonts ? [] : fontAssets;
|
|
1987
2041
|
const fontPreloadHeader = usesLayoutFonts ? renderFarmLayoutFontPreloadHeader(layoutFonts) : fallbackFontPreloadHeader;
|
|
1988
2042
|
return omitFarmDocsHeadBody(
|
|
@@ -2025,4 +2079,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDocsHandler, "createFarmDocsHand
|
|
|
2025
2079
|
|
|
2026
2080
|
|
|
2027
2081
|
|
|
2028
|
-
|
|
2082
|
+
|
|
2083
|
+
exports.FARM_DOCS_LAST_MODIFIED_MANIFEST = FARM_DOCS_LAST_MODIFIED_MANIFEST; exports.createFarmDocsLastModifiedManifest = createFarmDocsLastModifiedManifest; exports.isFarmDocsRequest = isFarmDocsRequest; exports.resolveFarmDocsContentDir = resolveFarmDocsContentDir; exports.getFarmDocsRouteTypeEntries = getFarmDocsRouteTypeEntries; exports.getFarmDocsDocumentNavigationMatchers = getFarmDocsDocumentNavigationMatchers; exports.loadFarmDocsPage = loadFarmDocsPage; exports.getFarmDocsMarkdownPath = getFarmDocsMarkdownPath; exports.discoverFarmDocsPages = discoverFarmDocsPages; exports.toFarmDocsMarkdownPage = toFarmDocsMarkdownPage; exports.createFarmDocsHandler = createFarmDocsHandler;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
_setAppRequestView,
|
|
3
|
+
_setCspNonceResolver,
|
|
3
4
|
_setCurrentRequestResolver
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QRKIMN7T.mjs";
|
|
5
6
|
import {
|
|
6
7
|
__name
|
|
7
8
|
} from "./chunk-LPEX4YW6.mjs";
|
|
@@ -67,6 +68,22 @@ function getAppRequestView(request) {
|
|
|
67
68
|
}
|
|
68
69
|
__name(getAppRequestView, "getAppRequestView");
|
|
69
70
|
_setCurrentRequestResolver(() => requestStore.getStore());
|
|
71
|
+
var CSP_NONCE_STORAGE_KEY = /* @__PURE__ */ Symbol.for("@farm.js/core/csp-nonce-storage");
|
|
72
|
+
function getCspNonceStore() {
|
|
73
|
+
const runtime = globalThis;
|
|
74
|
+
const existing = runtime[CSP_NONCE_STORAGE_KEY];
|
|
75
|
+
if (existing instanceof AsyncLocalStorage) return existing;
|
|
76
|
+
const storage = new AsyncLocalStorage();
|
|
77
|
+
runtime[CSP_NONCE_STORAGE_KEY] = storage;
|
|
78
|
+
return storage;
|
|
79
|
+
}
|
|
80
|
+
__name(getCspNonceStore, "getCspNonceStore");
|
|
81
|
+
var cspNonceStore = getCspNonceStore();
|
|
82
|
+
_setCspNonceResolver(() => cspNonceStore.getStore());
|
|
83
|
+
function _runWithFarmCspNonce(nonce, fn) {
|
|
84
|
+
return nonce ? cspNonceStore.run(nonce, fn) : fn();
|
|
85
|
+
}
|
|
86
|
+
__name(_runWithFarmCspNonce, "_runWithFarmCspNonce");
|
|
70
87
|
_setAppRequestView(getAppRequestView);
|
|
71
88
|
function resolveFarmRequestURL(req, options = {}) {
|
|
72
89
|
if (options.origin) {
|
|
@@ -169,6 +186,7 @@ function getCurrentRequestOrNull() {
|
|
|
169
186
|
__name(getCurrentRequestOrNull, "getCurrentRequestOrNull");
|
|
170
187
|
|
|
171
188
|
export {
|
|
189
|
+
_runWithFarmCspNonce,
|
|
172
190
|
resolveFarmRequestURL,
|
|
173
191
|
resolveFarmWebRequestOrigin,
|
|
174
192
|
createWebRequestFromFarmRequest,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
parseMiddlewareCookieHeader,
|
|
4
4
|
serializeMiddlewareCookie,
|
|
5
5
|
serializeMiddlewareCookieDeletion
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SKVTP5PR.mjs";
|
|
7
7
|
import {
|
|
8
8
|
compileMiddlewareConfig,
|
|
9
9
|
compileMiddlewareRoute,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
matchesMiddlewareConfigAt,
|
|
12
12
|
matchesMiddlewareRouteAt,
|
|
13
13
|
toMiddlewareRoutePathname
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-P3PLW4FR.mjs";
|
|
15
15
|
import {
|
|
16
16
|
emitFarmEvent
|
|
17
17
|
} from "./chunk-FUZEBRP3.mjs";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
FARM_MARKDOWN_PAGE_CHECK_HEADER,
|
|
3
|
+
_getFarmMarkdownPageCheckToken,
|
|
2
4
|
createFarmMarkdownViewResponse,
|
|
3
5
|
requestAcceptsMarkdown
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VNGH5MLF.mjs";
|
|
5
7
|
import {
|
|
6
8
|
__name
|
|
7
9
|
} from "./chunk-LPEX4YW6.mjs";
|
|
@@ -159,6 +161,7 @@ var PAGE_CHECK_DROPPED_HEADERS = /* @__PURE__ */ new Set([
|
|
|
159
161
|
"if-unmodified-since",
|
|
160
162
|
"range"
|
|
161
163
|
]);
|
|
164
|
+
var PAGE_SEGMENT_MARKER = /<div\s[^>]*\bid=["']?__farm_page__["'\s>]/i;
|
|
162
165
|
async function anonymousVisitorOpensPage(options, url, targetPathname) {
|
|
163
166
|
const pageUrl = new URL(url);
|
|
164
167
|
pageUrl.pathname = targetPathname;
|
|
@@ -167,6 +170,7 @@ async function anonymousVisitorOpensPage(options, url, targetPathname) {
|
|
|
167
170
|
if (!PAGE_CHECK_DROPPED_HEADERS.has(name.toLowerCase())) headers.append(name, value);
|
|
168
171
|
}
|
|
169
172
|
headers.set("accept", "text/html");
|
|
173
|
+
headers.set(FARM_MARKDOWN_PAGE_CHECK_HEADER, _getFarmMarkdownPageCheckToken());
|
|
170
174
|
const response = await options.renderPage(
|
|
171
175
|
new Request(pageUrl, {
|
|
172
176
|
method: "GET",
|
|
@@ -175,9 +179,12 @@ async function anonymousVisitorOpensPage(options, url, targetPathname) {
|
|
|
175
179
|
signal: options.request.signal
|
|
176
180
|
})
|
|
177
181
|
);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
if (response.status < 200 || response.status >= 300 || !response.headers.get("content-type")?.toLowerCase().includes("text/html")) {
|
|
183
|
+
void response.body?.cancel().catch(() => {
|
|
184
|
+
});
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
return PAGE_SEGMENT_MARKER.test(await response.text());
|
|
181
188
|
}
|
|
182
189
|
__name(anonymousVisitorOpensPage, "anonymousVisitorOpensPage");
|
|
183
190
|
function hasOnlyAnonymousHeaders(headers) {
|
|
@@ -222,8 +229,18 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
222
229
|
})
|
|
223
230
|
);
|
|
224
231
|
if (publicResponse.headers.get("X-Farm-Markdown-Route") === targetPathname && publicResponse.headers.has("X-Farm-Markdown-Source")) {
|
|
225
|
-
|
|
226
|
-
|
|
232
|
+
let response = publicResponse;
|
|
233
|
+
if (options.request.headers.has("cookie") || options.request.headers.has("authorization")) {
|
|
234
|
+
const headers2 = new Headers(publicResponse.headers);
|
|
235
|
+
headers2.set("Cache-Control", "private, no-store");
|
|
236
|
+
response = new Response(publicResponse.body, {
|
|
237
|
+
status: publicResponse.status,
|
|
238
|
+
statusText: publicResponse.statusText,
|
|
239
|
+
headers: headers2
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
publicSourceResponses.add(response);
|
|
243
|
+
return response;
|
|
227
244
|
}
|
|
228
245
|
await publicResponse.body?.cancel();
|
|
229
246
|
if (!hasMarkdownExtension) return null;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkZXH4TS3Fcjs = require('./chunk-ZXH4TS3F.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ var _chunkG2TEB74Scjs = require('./chunk-G2TEB74S.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkUPJLHLJUcjs = require('./chunk-UPJLHLJU.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
var _chunkE3UK5IIBcjs = require('./chunk-E3UK5IIB.cjs');
|
|
@@ -83,19 +83,19 @@ var WebResponseHeaderMap = _WebResponseHeaderMap;
|
|
|
83
83
|
var _WebCookieJar = class _WebCookieJar {
|
|
84
84
|
constructor(request, headers) {
|
|
85
85
|
this.headers = headers;
|
|
86
|
-
this.cookies =
|
|
86
|
+
this.cookies = _chunkZXH4TS3Fcjs.parseMiddlewareCookieHeader.call(void 0, request.headers.get("cookie"));
|
|
87
87
|
}
|
|
88
88
|
get(name) {
|
|
89
89
|
return this.cookies[name];
|
|
90
90
|
}
|
|
91
91
|
set(name, value, options = {}) {
|
|
92
92
|
this.cookies[name] = value;
|
|
93
|
-
const cookieString =
|
|
93
|
+
const cookieString = _chunkZXH4TS3Fcjs.serializeMiddlewareCookie.call(void 0, name, value, options);
|
|
94
94
|
this.headers.appendSetCookie(cookieString);
|
|
95
95
|
}
|
|
96
96
|
delete(name, options = {}) {
|
|
97
97
|
delete this.cookies[name];
|
|
98
|
-
this.headers.appendSetCookie(
|
|
98
|
+
this.headers.appendSetCookie(_chunkZXH4TS3Fcjs.serializeMiddlewareCookieDeletion.call(void 0, name, options));
|
|
99
99
|
}
|
|
100
100
|
getAll() {
|
|
101
101
|
return { ...this.cookies };
|
|
@@ -282,7 +282,7 @@ function createWebMiddlewareContext(request, parent, trustProxy = false, clientA
|
|
|
282
282
|
response: responseShim.response,
|
|
283
283
|
url,
|
|
284
284
|
pathname: url.pathname,
|
|
285
|
-
routePathname:
|
|
285
|
+
routePathname: _chunkUPJLHLJUcjs.toMiddlewareRoutePathname.call(void 0, url.pathname, toRoutePathname),
|
|
286
286
|
searchParams: url.searchParams,
|
|
287
287
|
method: currentRequest.method || "GET",
|
|
288
288
|
params: {},
|
|
@@ -325,7 +325,7 @@ function createWebMiddlewareContext(request, parent, trustProxy = false, clientA
|
|
|
325
325
|
ctx.request = currentRequest;
|
|
326
326
|
ctx.url = nextUrl;
|
|
327
327
|
ctx.pathname = nextUrl.pathname;
|
|
328
|
-
ctx.routePathname =
|
|
328
|
+
ctx.routePathname = _chunkUPJLHLJUcjs.toMiddlewareRoutePathname.call(void 0, nextUrl.pathname, toRoutePathname);
|
|
329
329
|
ctx.searchParams = nextUrl.searchParams;
|
|
330
330
|
ctx.route = nextUrl.pathname;
|
|
331
331
|
},
|
|
@@ -378,7 +378,7 @@ function createWebMiddlewareContext(request, parent, trustProxy = false, clientA
|
|
|
378
378
|
}
|
|
379
379
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createWebMiddlewareContext, "createWebMiddlewareContext");
|
|
380
380
|
function matchesMiddlewareConfig2(pathname, config, ctx) {
|
|
381
|
-
return
|
|
381
|
+
return _chunkUPJLHLJUcjs.matchesMiddlewareConfig.call(void 0, pathname, config, ctx);
|
|
382
382
|
}
|
|
383
383
|
_chunkS3JO3N4Hcjs.__name.call(void 0, matchesMiddlewareConfig2, "matchesMiddlewareConfig");
|
|
384
384
|
function getConfigHandlers(entry) {
|
|
@@ -411,7 +411,7 @@ function normalizeConfigMiddleware(config) {
|
|
|
411
411
|
globalConfig = middlewareConfig;
|
|
412
412
|
continue;
|
|
413
413
|
}
|
|
414
|
-
|
|
414
|
+
_chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, middlewareConfig);
|
|
415
415
|
entries.push({
|
|
416
416
|
path: "/",
|
|
417
417
|
filePath: `farm.config.ts#middleware-${index}`,
|
|
@@ -426,11 +426,11 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeConfigMiddleware, "normalizeConfi
|
|
|
426
426
|
function normalizeFileMiddleware(modules = []) {
|
|
427
427
|
const entries = [];
|
|
428
428
|
for (const moduleEntry of modules) {
|
|
429
|
-
const normalized =
|
|
429
|
+
const normalized = _chunkZXH4TS3Fcjs.normalizeMiddlewareModule.call(void 0, moduleEntry.module, moduleEntry.path);
|
|
430
430
|
if (!normalized) {
|
|
431
431
|
continue;
|
|
432
432
|
}
|
|
433
|
-
if (normalized.config)
|
|
433
|
+
if (normalized.config) _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, normalized.config);
|
|
434
434
|
entries.push({
|
|
435
435
|
path: moduleEntry.path,
|
|
436
436
|
filePath: moduleEntry.filePath || moduleEntry.path,
|
|
@@ -474,10 +474,10 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, emptyResult, "emptyResult");
|
|
|
474
474
|
function createProductionMiddlewareRunner(options = {}) {
|
|
475
475
|
const configMiddleware = normalizeConfigMiddleware(options.config);
|
|
476
476
|
const fileMiddleware = normalizeFileMiddleware(options.modules);
|
|
477
|
-
for (const entry of fileMiddleware)
|
|
477
|
+
for (const entry of fileMiddleware) _chunkUPJLHLJUcjs.compileMiddlewareRoute.call(void 0, entry);
|
|
478
478
|
const entries = [...configMiddleware.entries, ...fileMiddleware];
|
|
479
479
|
const globalConfig = configMiddleware.globalConfig;
|
|
480
|
-
if (globalConfig)
|
|
480
|
+
if (globalConfig) _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, globalConfig);
|
|
481
481
|
const toMiddlewarePathnames = _chunkKNBBQHO2cjs.createFarmAPIMiddlewarePathnames.call(void 0, options.apiBasePath);
|
|
482
482
|
return /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async function runProductionMiddleware(request, requestOptions = {}) {
|
|
483
483
|
if (!globalConfig && entries.length === 0) {
|
|
@@ -503,7 +503,7 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
503
503
|
] : toMiddlewarePathnames(pathname), "matchPathnames");
|
|
504
504
|
let parentData;
|
|
505
505
|
if (globalConfig) {
|
|
506
|
-
const globalMatch =
|
|
506
|
+
const globalMatch = _chunkUPJLHLJUcjs.matchesMiddlewareConfigAt.call(void 0,
|
|
507
507
|
matchPathnames(initialPathname, initialRequestPathname),
|
|
508
508
|
globalConfig,
|
|
509
509
|
ctx
|
|
@@ -520,11 +520,11 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
520
520
|
for (let pathname = initialPathname, requestPathname = initialRequestPathname, pass = 0; ; pass++) {
|
|
521
521
|
const pathnames = matchPathnames(pathname, requestPathname);
|
|
522
522
|
if (pass > 0 && globalConfig) {
|
|
523
|
-
if (!
|
|
523
|
+
if (!_chunkUPJLHLJUcjs.matchesMiddlewareConfigAt.call(void 0, pathnames, globalConfig, ctx).matched) return;
|
|
524
524
|
}
|
|
525
525
|
for (const entry of entries) {
|
|
526
526
|
if (ran.has(entry)) continue;
|
|
527
|
-
const routeMatch = entry.source === "config" ? { matched: true } :
|
|
527
|
+
const routeMatch = entry.source === "config" ? { matched: true } : _chunkUPJLHLJUcjs.matchesMiddlewareRouteAt.call(void 0, pathnames, entry);
|
|
528
528
|
if (routeMatch.matched) yield { entry, routeMatch, pathname, pathnames };
|
|
529
529
|
}
|
|
530
530
|
const rewrittenRequestPathname = new URL(currentRequest.url).pathname;
|
|
@@ -536,7 +536,7 @@ function createProductionMiddlewareRunner(options = {}) {
|
|
|
536
536
|
}
|
|
537
537
|
_chunkS3JO3N4Hcjs.__name.call(void 0, applicableMiddleware, "applicableMiddleware");
|
|
538
538
|
for (const { entry, routeMatch, pathname, pathnames } of applicableMiddleware()) {
|
|
539
|
-
const configMatch = entry.config ?
|
|
539
|
+
const configMatch = entry.config ? _chunkUPJLHLJUcjs.matchesMiddlewareConfigAt.call(void 0, pathnames, entry.config, ctx) : { matched: true };
|
|
540
540
|
if (!configMatch.matched) {
|
|
541
541
|
continue;
|
|
542
542
|
}
|
|
@@ -27,10 +27,22 @@ function _resolveCurrentRequestForApp() {
|
|
|
27
27
|
return request && view ? view(request) : request;
|
|
28
28
|
}
|
|
29
29
|
__name(_resolveCurrentRequestForApp, "_resolveCurrentRequestForApp");
|
|
30
|
+
var CSP_NONCE_RESOLVER_KEY = /* @__PURE__ */ Symbol.for("farm.cspNonceResolver");
|
|
31
|
+
function _setCspNonceResolver(resolver) {
|
|
32
|
+
globalThis[CSP_NONCE_RESOLVER_KEY] = resolver;
|
|
33
|
+
}
|
|
34
|
+
__name(_setCspNonceResolver, "_setCspNonceResolver");
|
|
35
|
+
function _resolveCurrentCspNonce() {
|
|
36
|
+
const resolver = globalThis[CSP_NONCE_RESOLVER_KEY];
|
|
37
|
+
return resolver?.();
|
|
38
|
+
}
|
|
39
|
+
__name(_resolveCurrentCspNonce, "_resolveCurrentCspNonce");
|
|
30
40
|
|
|
31
41
|
export {
|
|
32
42
|
_setCurrentRequestResolver,
|
|
33
43
|
_resolveCurrentRequest,
|
|
34
44
|
_setAppRequestView,
|
|
35
|
-
_resolveCurrentRequestForApp
|
|
45
|
+
_resolveCurrentRequestForApp,
|
|
46
|
+
_setCspNonceResolver,
|
|
47
|
+
_resolveCurrentCspNonce
|
|
36
48
|
};
|