@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
package/dist/chunk-MRMI32SN.cjs
DELETED
|
@@ -1,1157 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
-
|
|
3
|
-
var _chunk4WQ6PGSJcjs = require('./chunk-4WQ6PGSJ.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _chunkFJ3M4CUXcjs = require('./chunk-FJ3M4CUX.cjs');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
17
|
-
|
|
18
|
-
// src/agent-crawlers.ts
|
|
19
|
-
var FARM_AI_CRAWLERS = {
|
|
20
|
-
search: [
|
|
21
|
-
"OAI-SearchBot",
|
|
22
|
-
"ChatGPT-User",
|
|
23
|
-
"Claude-SearchBot",
|
|
24
|
-
"Claude-User",
|
|
25
|
-
"PerplexityBot",
|
|
26
|
-
"Perplexity-User"
|
|
27
|
-
],
|
|
28
|
-
training: [
|
|
29
|
-
"GPTBot",
|
|
30
|
-
"ClaudeBot",
|
|
31
|
-
"Google-Extended",
|
|
32
|
-
"CCBot",
|
|
33
|
-
"Applebot-Extended",
|
|
34
|
-
"Meta-ExternalAgent",
|
|
35
|
-
"Bytespider"
|
|
36
|
-
]
|
|
37
|
-
};
|
|
38
|
-
var LINE_BREAK = /[\r\n]/;
|
|
39
|
-
function resolveFarmAgentCrawlers(input) {
|
|
40
|
-
if (!input) return { enabled: false, rules: [] };
|
|
41
|
-
if (input === true) return { enabled: true, rules: [] };
|
|
42
|
-
if (typeof input !== "object" || Array.isArray(input)) {
|
|
43
|
-
throw new TypeError("agent.crawlers must be true, false, or an options object.");
|
|
44
|
-
}
|
|
45
|
-
if (input.enabled === false) return { enabled: false, rules: [] };
|
|
46
|
-
for (const key of ["search", "training"]) {
|
|
47
|
-
const policy = input[key];
|
|
48
|
-
if (policy !== void 0 && policy !== "allow" && policy !== "block") {
|
|
49
|
-
throw new TypeError(`agent.crawlers.${key} must be "allow" or "block".`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
enabled: true,
|
|
54
|
-
...input.search ? { search: input.search } : {},
|
|
55
|
-
...input.training ? { training: input.training } : {},
|
|
56
|
-
rules: resolveRobotsRules(input.rules),
|
|
57
|
-
...input.sitemap !== void 0 ? { sitemap: resolveSitemapUrls(input.sitemap) } : {}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAgentCrawlers, "resolveFarmAgentCrawlers");
|
|
61
|
-
function resolveRobotsRules(value) {
|
|
62
|
-
if (value === void 0) return [];
|
|
63
|
-
if (!Array.isArray(value)) {
|
|
64
|
-
throw new TypeError("agent.crawlers.rules must be an array of robots.txt rules.");
|
|
65
|
-
}
|
|
66
|
-
return value.map((rule, index) => {
|
|
67
|
-
const name = `agent.crawlers.rules[${index}]`;
|
|
68
|
-
if (!rule || typeof rule !== "object" || Array.isArray(rule)) {
|
|
69
|
-
throw new TypeError(`${name} must be an object.`);
|
|
70
|
-
}
|
|
71
|
-
const userAgent = readDirectiveValues(rule.userAgent, `${name}.userAgent`);
|
|
72
|
-
if (userAgent.length === 0) {
|
|
73
|
-
throw new TypeError(`${name}.userAgent must name at least one user agent.`);
|
|
74
|
-
}
|
|
75
|
-
const allow = readDirectiveValues(rule.allow, `${name}.allow`);
|
|
76
|
-
const disallow = readDirectiveValues(rule.disallow, `${name}.disallow`);
|
|
77
|
-
if (rule.crawlDelay !== void 0 && (typeof rule.crawlDelay !== "number" || !Number.isFinite(rule.crawlDelay) || rule.crawlDelay < 0)) {
|
|
78
|
-
throw new TypeError(`${name}.crawlDelay must be a number of seconds.`);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
userAgent,
|
|
82
|
-
...allow.length ? { allow } : {},
|
|
83
|
-
...disallow.length ? { disallow } : {},
|
|
84
|
-
...rule.crawlDelay !== void 0 ? { crawlDelay: rule.crawlDelay } : {}
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveRobotsRules, "resolveRobotsRules");
|
|
89
|
-
function readDirectiveValues(value, name) {
|
|
90
|
-
if (value === void 0) return [];
|
|
91
|
-
const values = Array.isArray(value) ? value : [value];
|
|
92
|
-
for (const item of values) {
|
|
93
|
-
if (typeof item !== "string" || !item || LINE_BREAK.test(item)) {
|
|
94
|
-
throw new TypeError(`${name} must be a non-empty string or an array of them.`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return values;
|
|
98
|
-
}
|
|
99
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, readDirectiveValues, "readDirectiveValues");
|
|
100
|
-
function resolveSitemapUrls(value) {
|
|
101
|
-
const values = Array.isArray(value) ? value : [value];
|
|
102
|
-
for (const item of values) {
|
|
103
|
-
if (typeof item !== "string" || !toAbsoluteHttpUrl(item) || LINE_BREAK.test(item)) {
|
|
104
|
-
throw new TypeError("agent.crawlers.sitemap must be an absolute URL or an array of them.");
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return values;
|
|
108
|
-
}
|
|
109
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveSitemapUrls, "resolveSitemapUrls");
|
|
110
|
-
function toAbsoluteHttpUrl(value) {
|
|
111
|
-
if (typeof value !== "string" && !(value instanceof URL)) return null;
|
|
112
|
-
try {
|
|
113
|
-
const url = new URL(String(value));
|
|
114
|
-
return url.protocol === "https:" || url.protocol === "http:" ? url : null;
|
|
115
|
-
} catch (e) {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, toAbsoluteHttpUrl, "toAbsoluteHttpUrl");
|
|
120
|
-
function createFarmAgentRobots(options) {
|
|
121
|
-
const { crawlers } = options;
|
|
122
|
-
const rules = [];
|
|
123
|
-
for (const group of ["search", "training"]) {
|
|
124
|
-
const policy = crawlers[group];
|
|
125
|
-
if (!policy) continue;
|
|
126
|
-
rules.push({
|
|
127
|
-
userAgent: [...FARM_AI_CRAWLERS[group]],
|
|
128
|
-
...policy === "allow" ? { allow: "/" } : { disallow: "/" }
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
rules.push(...crawlers.rules);
|
|
132
|
-
const namesEveryAgent = crawlers.rules.some(
|
|
133
|
-
(rule) => (Array.isArray(rule.userAgent) ? rule.userAgent : [rule.userAgent]).includes("*")
|
|
134
|
-
);
|
|
135
|
-
if (!namesEveryAgent) rules.push({ userAgent: "*", allow: "/" });
|
|
136
|
-
const sitemap = _nullishCoalesce(crawlers.sitemap, () => ( resolveDefaultSitemap(options)));
|
|
137
|
-
return { rules, ...sitemap.length > 0 ? { sitemap } : {} };
|
|
138
|
-
}
|
|
139
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmAgentRobots, "createFarmAgentRobots");
|
|
140
|
-
function resolveDefaultSitemap(options) {
|
|
141
|
-
if (!options.sitemapPath) return [];
|
|
142
|
-
const base = toAbsoluteHttpUrl(options.metadataBase);
|
|
143
|
-
if (!base) return [];
|
|
144
|
-
return [new URL(_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, options.sitemapPath, options.basePath), base).href];
|
|
145
|
-
}
|
|
146
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveDefaultSitemap, "resolveDefaultSitemap");
|
|
147
|
-
|
|
148
|
-
// src/agent-sitemap.ts
|
|
149
|
-
function resolveFarmAgentSitemap(input) {
|
|
150
|
-
if (!input) return { enabled: false, include: [], exclude: [] };
|
|
151
|
-
if (input === true) return { enabled: true, include: [], exclude: [] };
|
|
152
|
-
if (typeof input !== "object") {
|
|
153
|
-
throw new TypeError("agent.sitemap must be true, false, or an options object.");
|
|
154
|
-
}
|
|
155
|
-
if (input.enabled === false) return { enabled: false, include: [], exclude: [] };
|
|
156
|
-
return {
|
|
157
|
-
enabled: true,
|
|
158
|
-
include: resolveRoutePatterns(input.include, "include"),
|
|
159
|
-
exclude: resolveRoutePatterns(input.exclude, "exclude")
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAgentSitemap, "resolveFarmAgentSitemap");
|
|
163
|
-
function resolveRoutePatterns(value, key) {
|
|
164
|
-
if (value === void 0) return [];
|
|
165
|
-
if (!Array.isArray(value)) {
|
|
166
|
-
throw new TypeError(`agent.sitemap.${key} must be an array of route patterns.`);
|
|
167
|
-
}
|
|
168
|
-
return value.map((pattern, index) => {
|
|
169
|
-
if (typeof pattern !== "string" || !pattern.startsWith("/")) {
|
|
170
|
-
throw new TypeError(
|
|
171
|
-
`agent.sitemap.${key}[${index}] must be a route pattern starting with "/", such as "/admin/[...path]".`
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
return pattern;
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveRoutePatterns, "resolveRoutePatterns");
|
|
178
|
-
function createFarmDefaultSitemap(sources, options) {
|
|
179
|
-
const { include, exclude } = options.config;
|
|
180
|
-
const base = _nullishCoalesce(toAbsoluteHttpOrigin(options.metadataBase), () => ( options.origin));
|
|
181
|
-
const entries = /* @__PURE__ */ new Map();
|
|
182
|
-
for (const source of sources) {
|
|
183
|
-
const path = source.pattern;
|
|
184
|
-
if (path.includes("[") || path.includes("(") || entries.has(path)) continue;
|
|
185
|
-
if (include.length && !include.some((pattern) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
if (exclude.some((pattern) => _chunkEUV4YR3Vcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
|
|
189
|
-
const module = isRecord(source.module) ? source.module : void 0;
|
|
190
|
-
if (_chunk4WQ6PGSJcjs.isFarmMetadataNoIndex.call(void 0, _optionalChain([module, 'optionalAccess', _2 => _2.metadata]))) continue;
|
|
191
|
-
if (_optionalChain([module, 'optionalAccess', _3 => _3.__farmRouteGuard])) continue;
|
|
192
|
-
entries.set(path, {
|
|
193
|
-
url: new URL(_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, path, options.basePath), base).href,
|
|
194
|
-
...source.lastModified ? { lastModified: source.lastModified } : {}
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
return [...entries.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([, entry]) => entry);
|
|
198
|
-
}
|
|
199
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDefaultSitemap, "createFarmDefaultSitemap");
|
|
200
|
-
function toAbsoluteHttpOrigin(value) {
|
|
201
|
-
if (typeof value !== "string" && !(value instanceof URL)) return void 0;
|
|
202
|
-
try {
|
|
203
|
-
const url = new URL(String(value));
|
|
204
|
-
return url.protocol === "https:" || url.protocol === "http:" ? url.origin : void 0;
|
|
205
|
-
} catch (e2) {
|
|
206
|
-
return void 0;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, toAbsoluteHttpOrigin, "toAbsoluteHttpOrigin");
|
|
210
|
-
function isRecord(value) {
|
|
211
|
-
return Boolean(value && typeof value === "object");
|
|
212
|
-
}
|
|
213
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, isRecord, "isRecord");
|
|
214
|
-
|
|
215
|
-
// src/security.ts
|
|
216
|
-
function resolveFarmSecurityConfig(input) {
|
|
217
|
-
if (input === void 0) return { csp: false };
|
|
218
|
-
if (!isPlainRecord(input)) {
|
|
219
|
-
throw new TypeError("security must be an object containing the csp option.");
|
|
220
|
-
}
|
|
221
|
-
if (Object.prototype.hasOwnProperty.call(input, "contentSecurityPolicy")) {
|
|
222
|
-
throw new TypeError(
|
|
223
|
-
"security.contentSecurityPolicy is not supported. Use security.csp instead."
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
const csp = input.csp;
|
|
227
|
-
if (csp === void 0 || csp === false) return { csp: false };
|
|
228
|
-
if (typeof csp === "string") {
|
|
229
|
-
return {
|
|
230
|
-
csp: {
|
|
231
|
-
value: validateSerializedCsp(csp),
|
|
232
|
-
reportOnly: false,
|
|
233
|
-
nonce: false
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
if (!isPlainRecord(csp)) {
|
|
238
|
-
throw new TypeError("security.csp must be a policy string, false, or an options object.");
|
|
239
|
-
}
|
|
240
|
-
const reportOnly = validateReportOnly(csp.reportOnly);
|
|
241
|
-
const nonce = validateNonce(csp.nonce);
|
|
242
|
-
if (Object.prototype.hasOwnProperty.call(csp, "value")) {
|
|
243
|
-
if (Object.prototype.hasOwnProperty.call(csp, "policy") || Object.prototype.hasOwnProperty.call(csp, "directives")) {
|
|
244
|
-
throw new TypeError(
|
|
245
|
-
"Resolved security.csp values cannot include policy or directives options."
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
return {
|
|
249
|
-
csp: {
|
|
250
|
-
value: validateSerializedCsp(csp.value),
|
|
251
|
-
reportOnly,
|
|
252
|
-
nonce
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
const { policy, directives } = csp;
|
|
257
|
-
if (policy !== void 0 && directives !== void 0) {
|
|
258
|
-
throw new TypeError("security.csp accepts either policy or directives, not both.");
|
|
259
|
-
}
|
|
260
|
-
if (policy === void 0 && directives === void 0) {
|
|
261
|
-
throw new TypeError("security.csp requires a policy string or directives object.");
|
|
262
|
-
}
|
|
263
|
-
return {
|
|
264
|
-
csp: {
|
|
265
|
-
value: policy !== void 0 ? validateSerializedCsp(policy) : serializeFarmCspDirectives(directives),
|
|
266
|
-
reportOnly,
|
|
267
|
-
nonce
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmSecurityConfig, "resolveFarmSecurityConfig");
|
|
272
|
-
function serializeFarmCspDirectives(directives) {
|
|
273
|
-
if (!isPlainRecord(directives)) {
|
|
274
|
-
throw new TypeError("security.csp.directives must be an object.");
|
|
275
|
-
}
|
|
276
|
-
const serialized = [];
|
|
277
|
-
const normalizedNames = /* @__PURE__ */ new Set();
|
|
278
|
-
for (const [configuredName, configuredValue] of Object.entries(directives)) {
|
|
279
|
-
if (configuredValue === false || configuredValue === null || configuredValue === void 0) {
|
|
280
|
-
continue;
|
|
281
|
-
}
|
|
282
|
-
const name = normalizeDirectiveName(configuredName);
|
|
283
|
-
if (normalizedNames.has(name)) {
|
|
284
|
-
throw new TypeError(`security.csp contains the duplicate directive ${JSON.stringify(name)}.`);
|
|
285
|
-
}
|
|
286
|
-
normalizedNames.add(name);
|
|
287
|
-
const values = configuredValue === true ? [] : (Array.isArray(configuredValue) ? configuredValue : [configuredValue]).map(
|
|
288
|
-
validateDirectiveValue
|
|
289
|
-
);
|
|
290
|
-
serialized.push(values.length > 0 ? `${name} ${values.join(" ")}` : name);
|
|
291
|
-
}
|
|
292
|
-
if (serialized.length === 0) {
|
|
293
|
-
throw new TypeError("security.csp.directives must contain at least one enabled directive.");
|
|
294
|
-
}
|
|
295
|
-
return serialized.join("; ");
|
|
296
|
-
}
|
|
297
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, serializeFarmCspDirectives, "serializeFarmCspDirectives");
|
|
298
|
-
function getFarmSecurityHeader(security, nonce) {
|
|
299
|
-
if (!security.csp) return void 0;
|
|
300
|
-
if (security.csp.nonce && !nonce) return void 0;
|
|
301
|
-
return {
|
|
302
|
-
key: security.csp.reportOnly ? "Content-Security-Policy-Report-Only" : "Content-Security-Policy",
|
|
303
|
-
value: nonce ? applyFarmCspNonceToPolicy(security.csp.value, nonce) : security.csp.value
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmSecurityHeader, "getFarmSecurityHeader");
|
|
307
|
-
function createFarmCspNonce(security) {
|
|
308
|
-
if (!security.csp || !security.csp.nonce) return void 0;
|
|
309
|
-
const bytes = new Uint8Array(16);
|
|
310
|
-
globalThis.crypto.getRandomValues(bytes);
|
|
311
|
-
return Array.from(bytes, (value) => value.toString(16).padStart(2, "0")).join("");
|
|
312
|
-
}
|
|
313
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmCspNonce, "createFarmCspNonce");
|
|
314
|
-
function applyFarmCspNonceToPolicy(policy, nonce) {
|
|
315
|
-
validateCspNonce(nonce);
|
|
316
|
-
return applyFarmCspScriptSourcesToPolicy(policy, [`'nonce-${nonce}'`]);
|
|
317
|
-
}
|
|
318
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmCspNonceToPolicy, "applyFarmCspNonceToPolicy");
|
|
319
|
-
function applyFarmCspHashesToPolicy(policy, hashes) {
|
|
320
|
-
const sources = hashes.map((hash) => {
|
|
321
|
-
if (!/^sha(?:256|384|512)-[A-Za-z0-9+/]+={0,2}$/.test(hash)) {
|
|
322
|
-
throw new TypeError(`Invalid CSP script hash: ${JSON.stringify(hash)}.`);
|
|
323
|
-
}
|
|
324
|
-
return `'${hash}'`;
|
|
325
|
-
});
|
|
326
|
-
return applyFarmCspScriptSourcesToPolicy(policy, sources);
|
|
327
|
-
}
|
|
328
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmCspHashesToPolicy, "applyFarmCspHashesToPolicy");
|
|
329
|
-
function applyFarmCspScriptSourcesToPolicy(policy, sources) {
|
|
330
|
-
const uniqueSources = [...new Set(sources)];
|
|
331
|
-
if (uniqueSources.length === 0) return policy;
|
|
332
|
-
const segments = policy.split(";").map((segment) => segment.trim()).filter(Boolean);
|
|
333
|
-
const names = segments.map((segment) => segment.split(/\s+/, 1)[0].toLowerCase());
|
|
334
|
-
const governingName = names.includes("script-src-elem") ? "script-src-elem" : names.includes("script-src") ? "script-src" : names.includes("default-src") ? "default-src" : void 0;
|
|
335
|
-
if (!governingName) return `${policy}; script-src ${uniqueSources.join(" ")}`;
|
|
336
|
-
return segments.map((segment, index) => {
|
|
337
|
-
if (names[index] !== governingName) return segment;
|
|
338
|
-
const existing = new Set(segment.split(/\s+/));
|
|
339
|
-
const missing = uniqueSources.filter((source) => !existing.has(source));
|
|
340
|
-
return missing.length > 0 ? `${segment} ${missing.join(" ")}` : segment;
|
|
341
|
-
}).join("; ");
|
|
342
|
-
}
|
|
343
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmCspScriptSourcesToPolicy, "applyFarmCspScriptSourcesToPolicy");
|
|
344
|
-
function addFarmCspNonceToScriptTags(html, nonce) {
|
|
345
|
-
validateCspNonce(nonce);
|
|
346
|
-
return createFarmCspNonceRewriter(nonce).write(html, true);
|
|
347
|
-
}
|
|
348
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, addFarmCspNonceToScriptTags, "addFarmCspNonceToScriptTags");
|
|
349
|
-
function removeFarmCspNoncesFromScriptTags(html) {
|
|
350
|
-
return createFarmScriptTagRewriter(stripScriptNonceAttribute).write(html, true);
|
|
351
|
-
}
|
|
352
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, removeFarmCspNoncesFromScriptTags, "removeFarmCspNoncesFromScriptTags");
|
|
353
|
-
async function createFarmCspScriptHashes(html) {
|
|
354
|
-
const hashes = [];
|
|
355
|
-
const seen = /* @__PURE__ */ new Set();
|
|
356
|
-
for (const content of collectFarmInlineScriptContents(html)) {
|
|
357
|
-
const digest = await globalThis.crypto.subtle.digest(
|
|
358
|
-
"SHA-256",
|
|
359
|
-
new TextEncoder().encode(content)
|
|
360
|
-
);
|
|
361
|
-
let binary = "";
|
|
362
|
-
for (const byte of new Uint8Array(digest)) binary += String.fromCharCode(byte);
|
|
363
|
-
const hash = `sha256-${globalThis.btoa(binary)}`;
|
|
364
|
-
if (!seen.has(hash)) {
|
|
365
|
-
seen.add(hash);
|
|
366
|
-
hashes.push(hash);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
return hashes;
|
|
370
|
-
}
|
|
371
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmCspScriptHashes, "createFarmCspScriptHashes");
|
|
372
|
-
async function applyFarmCspHashesToHtml(html, security) {
|
|
373
|
-
if (!security.csp || !security.csp.nonce) return void 0;
|
|
374
|
-
const staticHtml = removeFarmCspNoncesFromScriptTags(html);
|
|
375
|
-
const hashes = await createFarmCspScriptHashes(staticHtml);
|
|
376
|
-
return {
|
|
377
|
-
html: staticHtml,
|
|
378
|
-
header: {
|
|
379
|
-
key: security.csp.reportOnly ? "Content-Security-Policy-Report-Only" : "Content-Security-Policy",
|
|
380
|
-
value: applyFarmCspHashesToPolicy(security.csp.value, hashes)
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmCspHashesToHtml, "applyFarmCspHashesToHtml");
|
|
385
|
-
function applyFarmCspNonceToResponse(response, security) {
|
|
386
|
-
if (!security.csp || !security.csp.nonce) return response;
|
|
387
|
-
if (!_optionalChain([response, 'access', _4 => _4.headers, 'access', _5 => _5.get, 'call', _6 => _6("content-type"), 'optionalAccess', _7 => _7.toLowerCase, 'call', _8 => _8(), 'access', _9 => _9.includes, 'call', _10 => _10("text/html")])) return response;
|
|
388
|
-
const nonce = createFarmCspNonce(security);
|
|
389
|
-
const securityHeader = getFarmSecurityHeader(security, nonce);
|
|
390
|
-
if (!response.body) {
|
|
391
|
-
return _chunkFJ3M4CUXcjs._withFarmResponseHeaders.call(void 0, response, (headers2) => {
|
|
392
|
-
headers2.set(securityHeader.key, securityHeader.value);
|
|
393
|
-
headers2.delete("content-length");
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
const headers = new Headers(response.headers);
|
|
397
|
-
headers.set(securityHeader.key, securityHeader.value);
|
|
398
|
-
headers.delete("content-length");
|
|
399
|
-
const decoder = new TextDecoder();
|
|
400
|
-
const encoder = new TextEncoder();
|
|
401
|
-
const rewriter = createFarmCspNonceRewriter(nonce);
|
|
402
|
-
const body = response.body.pipeThrough(
|
|
403
|
-
new TransformStream({
|
|
404
|
-
transform(chunk, controller) {
|
|
405
|
-
const output = rewriter.write(decoder.decode(chunk, { stream: true }));
|
|
406
|
-
if (output) controller.enqueue(encoder.encode(output));
|
|
407
|
-
},
|
|
408
|
-
flush(controller) {
|
|
409
|
-
const output = rewriter.write(decoder.decode(), true);
|
|
410
|
-
if (output) controller.enqueue(encoder.encode(output));
|
|
411
|
-
}
|
|
412
|
-
})
|
|
413
|
-
);
|
|
414
|
-
return _chunkFJ3M4CUXcjs._markFarmOwnedResponse.call(void 0,
|
|
415
|
-
new Response(body, {
|
|
416
|
-
status: response.status,
|
|
417
|
-
statusText: response.statusText,
|
|
418
|
-
headers
|
|
419
|
-
})
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmCspNonceToResponse, "applyFarmCspNonceToResponse");
|
|
423
|
-
function farmCspBlocksFrameworkInlineScripts(security) {
|
|
424
|
-
if (!security.csp) return false;
|
|
425
|
-
if (security.csp.nonce) return false;
|
|
426
|
-
const directives = parseCspDirectives(security.csp.value);
|
|
427
|
-
const governing = _nullishCoalesce(_nullishCoalesce(directives.get("script-src-elem"), () => ( directives.get("script-src"))), () => ( directives.get("default-src")));
|
|
428
|
-
if (!governing) return false;
|
|
429
|
-
const sources = governing.map((source) => source.toLowerCase());
|
|
430
|
-
const disablesUnsafeInline = sources.some(
|
|
431
|
-
(value) => value === "'strict-dynamic'" || value.startsWith("'nonce-") || value.startsWith("'sha256-") || value.startsWith("'sha384-") || value.startsWith("'sha512-")
|
|
432
|
-
);
|
|
433
|
-
return !sources.includes("'unsafe-inline'") || disablesUnsafeInline;
|
|
434
|
-
}
|
|
435
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, farmCspBlocksFrameworkInlineScripts, "farmCspBlocksFrameworkInlineScripts");
|
|
436
|
-
function parseCspDirectives(value) {
|
|
437
|
-
const directives = /* @__PURE__ */ new Map();
|
|
438
|
-
for (const segment of value.split(";")) {
|
|
439
|
-
const parts = segment.trim().split(/\s+/).filter(Boolean);
|
|
440
|
-
if (parts.length === 0) continue;
|
|
441
|
-
const name = parts[0].toLowerCase();
|
|
442
|
-
if (!directives.has(name)) directives.set(name, parts.slice(1));
|
|
443
|
-
}
|
|
444
|
-
return directives;
|
|
445
|
-
}
|
|
446
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, parseCspDirectives, "parseCspDirectives");
|
|
447
|
-
function normalizeDirectiveName(value) {
|
|
448
|
-
const name = value.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
449
|
-
if (!/^[a-z][a-z0-9-]*$/.test(name)) {
|
|
450
|
-
throw new TypeError(`Invalid security.csp directive name: ${JSON.stringify(value)}.`);
|
|
451
|
-
}
|
|
452
|
-
return name;
|
|
453
|
-
}
|
|
454
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeDirectiveName, "normalizeDirectiveName");
|
|
455
|
-
function validateDirectiveValue(value) {
|
|
456
|
-
if (typeof value !== "string") {
|
|
457
|
-
throw new TypeError("security.csp directive values must be strings or booleans.");
|
|
458
|
-
}
|
|
459
|
-
const normalized = value.trim();
|
|
460
|
-
if (!normalized || /[;\r\n]/.test(normalized) || normalized.includes("\0")) {
|
|
461
|
-
throw new TypeError(`Invalid security.csp directive value: ${JSON.stringify(value)}.`);
|
|
462
|
-
}
|
|
463
|
-
return normalized;
|
|
464
|
-
}
|
|
465
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, validateDirectiveValue, "validateDirectiveValue");
|
|
466
|
-
function validateSerializedCsp(value) {
|
|
467
|
-
if (typeof value !== "string") {
|
|
468
|
-
throw new TypeError("security.csp policy must be a non-empty single-line string.");
|
|
469
|
-
}
|
|
470
|
-
const normalized = value.trim().replace(/;+$/g, "").trim();
|
|
471
|
-
if (!normalized || /[\r\n]/.test(normalized) || normalized.includes("\0")) {
|
|
472
|
-
throw new TypeError("security.csp policy must be a non-empty single-line string.");
|
|
473
|
-
}
|
|
474
|
-
return normalized;
|
|
475
|
-
}
|
|
476
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, validateSerializedCsp, "validateSerializedCsp");
|
|
477
|
-
function validateReportOnly(value) {
|
|
478
|
-
if (value === void 0) return false;
|
|
479
|
-
if (typeof value !== "boolean") {
|
|
480
|
-
throw new TypeError("security.csp.reportOnly must be a boolean.");
|
|
481
|
-
}
|
|
482
|
-
return value;
|
|
483
|
-
}
|
|
484
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, validateReportOnly, "validateReportOnly");
|
|
485
|
-
function validateNonce(value) {
|
|
486
|
-
if (value === void 0) return false;
|
|
487
|
-
if (typeof value !== "boolean") {
|
|
488
|
-
throw new TypeError("security.csp.nonce must be a boolean.");
|
|
489
|
-
}
|
|
490
|
-
return value;
|
|
491
|
-
}
|
|
492
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, validateNonce, "validateNonce");
|
|
493
|
-
function validateCspNonce(value) {
|
|
494
|
-
if (!/^[A-Za-z0-9+/_-]+={0,2}$/.test(value)) {
|
|
495
|
-
throw new TypeError("A CSP nonce must be a base64 or base64url value.");
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, validateCspNonce, "validateCspNonce");
|
|
499
|
-
function createFarmCspNonceRewriter(nonce) {
|
|
500
|
-
validateCspNonce(nonce);
|
|
501
|
-
return createFarmScriptTagRewriter((tag) => stampScriptTag(tag, nonce));
|
|
502
|
-
}
|
|
503
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmCspNonceRewriter, "createFarmCspNonceRewriter");
|
|
504
|
-
function createFarmScriptTagRewriter(transformScriptTag) {
|
|
505
|
-
let pending = "";
|
|
506
|
-
let rawTextElement;
|
|
507
|
-
return {
|
|
508
|
-
write(chunk, final = false) {
|
|
509
|
-
pending += chunk;
|
|
510
|
-
let output = "";
|
|
511
|
-
while (pending) {
|
|
512
|
-
if (rawTextElement) {
|
|
513
|
-
if (rawTextElement === "plaintext") {
|
|
514
|
-
output += pending;
|
|
515
|
-
pending = "";
|
|
516
|
-
break;
|
|
517
|
-
}
|
|
518
|
-
const closing = `</${rawTextElement}`;
|
|
519
|
-
const start2 = findRawTextEnd(pending, rawTextElement);
|
|
520
|
-
if (start2 === -1) {
|
|
521
|
-
if (final) {
|
|
522
|
-
output += pending;
|
|
523
|
-
pending = "";
|
|
524
|
-
} else {
|
|
525
|
-
const keep = matchingSuffixLength(pending, closing);
|
|
526
|
-
output += pending.slice(0, pending.length - keep);
|
|
527
|
-
pending = pending.slice(pending.length - keep);
|
|
528
|
-
}
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
531
|
-
output += pending.slice(0, start2);
|
|
532
|
-
pending = pending.slice(start2);
|
|
533
|
-
const end2 = findHtmlTagEnd(pending);
|
|
534
|
-
if (end2 === -1) {
|
|
535
|
-
if (final) {
|
|
536
|
-
output += pending;
|
|
537
|
-
pending = "";
|
|
538
|
-
}
|
|
539
|
-
break;
|
|
540
|
-
}
|
|
541
|
-
output += pending.slice(0, end2 + 1);
|
|
542
|
-
pending = pending.slice(end2 + 1);
|
|
543
|
-
rawTextElement = void 0;
|
|
544
|
-
continue;
|
|
545
|
-
}
|
|
546
|
-
const start = pending.indexOf("<");
|
|
547
|
-
if (start === -1) {
|
|
548
|
-
output += pending;
|
|
549
|
-
pending = "";
|
|
550
|
-
break;
|
|
551
|
-
}
|
|
552
|
-
output += pending.slice(0, start);
|
|
553
|
-
pending = pending.slice(start);
|
|
554
|
-
if (pending.startsWith("<!--")) {
|
|
555
|
-
const end2 = pending.indexOf("-->", 4);
|
|
556
|
-
if (end2 === -1) {
|
|
557
|
-
if (final) {
|
|
558
|
-
output += pending;
|
|
559
|
-
pending = "";
|
|
560
|
-
}
|
|
561
|
-
break;
|
|
562
|
-
}
|
|
563
|
-
output += pending.slice(0, end2 + 3);
|
|
564
|
-
pending = pending.slice(end2 + 3);
|
|
565
|
-
continue;
|
|
566
|
-
}
|
|
567
|
-
if (!final && "<!--".startsWith(pending)) break;
|
|
568
|
-
const tagNameMatch = pending.match(/^<\/?([a-z][a-z0-9:-]*)\b/i);
|
|
569
|
-
if (!tagNameMatch) {
|
|
570
|
-
if (!final && /^<\/?[a-z][a-z0-9:-]*$/i.test(pending)) break;
|
|
571
|
-
output += pending[0];
|
|
572
|
-
pending = pending.slice(1);
|
|
573
|
-
continue;
|
|
574
|
-
}
|
|
575
|
-
const end = findHtmlTagEnd(pending);
|
|
576
|
-
if (end === -1) {
|
|
577
|
-
if (!final) break;
|
|
578
|
-
output += pending;
|
|
579
|
-
pending = "";
|
|
580
|
-
break;
|
|
581
|
-
}
|
|
582
|
-
const tag = pending.slice(0, end + 1);
|
|
583
|
-
const tagName = tagNameMatch[1].toLowerCase();
|
|
584
|
-
const isClosing = pending.startsWith("</");
|
|
585
|
-
const isSelfClosing = /\/\s*>$/.test(tag);
|
|
586
|
-
output += !isClosing && tagName === "script" ? transformScriptTag(tag) : tag;
|
|
587
|
-
pending = pending.slice(end + 1);
|
|
588
|
-
if (!isClosing && !isSelfClosing && rawTextElements.has(tagName)) {
|
|
589
|
-
rawTextElement = tagName;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
return output;
|
|
593
|
-
}
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmScriptTagRewriter, "createFarmScriptTagRewriter");
|
|
597
|
-
var rawTextElements = /* @__PURE__ */ new Map([
|
|
598
|
-
["iframe", /<\/iframe(?=[\s/>]|$)/gi],
|
|
599
|
-
["noembed", /<\/noembed(?=[\s/>]|$)/gi],
|
|
600
|
-
["noframes", /<\/noframes(?=[\s/>]|$)/gi],
|
|
601
|
-
["plaintext", null],
|
|
602
|
-
["script", /<\/script(?=[\s/>]|$)/gi],
|
|
603
|
-
["style", /<\/style(?=[\s/>]|$)/gi],
|
|
604
|
-
["textarea", /<\/textarea(?=[\s/>]|$)/gi],
|
|
605
|
-
["title", /<\/title(?=[\s/>]|$)/gi],
|
|
606
|
-
["xmp", /<\/xmp(?=[\s/>]|$)/gi]
|
|
607
|
-
]);
|
|
608
|
-
function stampScriptTag(tag, nonce) {
|
|
609
|
-
const opening = _optionalChain([tag, 'access', _11 => _11.match, 'call', _12 => _12(/^<script\b/i), 'optionalAccess', _13 => _13[0]]);
|
|
610
|
-
if (!opening) return tag;
|
|
611
|
-
const attributes = stripScriptNonceAttribute(tag).slice(opening.length, -1);
|
|
612
|
-
return `<script nonce="${nonce}"${attributes}>`;
|
|
613
|
-
}
|
|
614
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, stampScriptTag, "stampScriptTag");
|
|
615
|
-
function stripScriptNonceAttribute(tag) {
|
|
616
|
-
let normalized = tag;
|
|
617
|
-
let range = findScriptTagAttributeRange(normalized, "nonce");
|
|
618
|
-
while (range) {
|
|
619
|
-
normalized = normalized.slice(0, range.start) + normalized.slice(range.end);
|
|
620
|
-
range = findScriptTagAttributeRange(normalized, "nonce");
|
|
621
|
-
}
|
|
622
|
-
return normalized;
|
|
623
|
-
}
|
|
624
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, stripScriptNonceAttribute, "stripScriptNonceAttribute");
|
|
625
|
-
function collectFarmInlineScriptContents(html) {
|
|
626
|
-
const contents = [];
|
|
627
|
-
let offset = 0;
|
|
628
|
-
while (offset < html.length) {
|
|
629
|
-
const start = html.indexOf("<", offset);
|
|
630
|
-
if (start === -1) break;
|
|
631
|
-
if (html.startsWith("<!--", start)) {
|
|
632
|
-
const commentEnd = html.indexOf("-->", start + 4);
|
|
633
|
-
offset = commentEnd === -1 ? html.length : commentEnd + 3;
|
|
634
|
-
continue;
|
|
635
|
-
}
|
|
636
|
-
const remaining = html.slice(start);
|
|
637
|
-
const tagNameMatch = remaining.match(/^<\/?([a-z][a-z0-9:-]*)\b/i);
|
|
638
|
-
if (!tagNameMatch) {
|
|
639
|
-
offset = start + 1;
|
|
640
|
-
continue;
|
|
641
|
-
}
|
|
642
|
-
const tagEnd = findHtmlTagEnd(remaining);
|
|
643
|
-
if (tagEnd === -1) break;
|
|
644
|
-
const tag = remaining.slice(0, tagEnd + 1);
|
|
645
|
-
const tagName = tagNameMatch[1].toLowerCase();
|
|
646
|
-
const isClosing = remaining.startsWith("</");
|
|
647
|
-
const isSelfClosing = /\/\s*>$/.test(tag);
|
|
648
|
-
offset = start + tagEnd + 1;
|
|
649
|
-
if (isClosing || isSelfClosing || !rawTextElements.has(tagName)) continue;
|
|
650
|
-
if (tagName === "plaintext") break;
|
|
651
|
-
const closingStart = findRawTextEnd(html, tagName, offset);
|
|
652
|
-
const contentEnd = closingStart === -1 ? html.length : closingStart;
|
|
653
|
-
if (tagName === "script" && !findScriptTagAttributeRange(tag, "src")) {
|
|
654
|
-
contents.push(html.slice(offset, contentEnd));
|
|
655
|
-
}
|
|
656
|
-
if (closingStart === -1) break;
|
|
657
|
-
const closingEnd = findHtmlTagEnd(html.slice(contentEnd));
|
|
658
|
-
if (closingEnd === -1) break;
|
|
659
|
-
offset = contentEnd + closingEnd + 1;
|
|
660
|
-
}
|
|
661
|
-
return contents;
|
|
662
|
-
}
|
|
663
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmInlineScriptContents, "collectFarmInlineScriptContents");
|
|
664
|
-
function findScriptTagAttributeRange(tag, expectedName) {
|
|
665
|
-
const opening = _optionalChain([tag, 'access', _14 => _14.match, 'call', _15 => _15(/^<script\b/i), 'optionalAccess', _16 => _16[0]]);
|
|
666
|
-
if (!opening) return void 0;
|
|
667
|
-
let offset = opening.length;
|
|
668
|
-
while (offset < tag.length - 1) {
|
|
669
|
-
const whitespaceStart = offset;
|
|
670
|
-
while (/\s/.test(tag[offset] || "")) offset++;
|
|
671
|
-
if (tag[offset] === "/" || tag[offset] === ">" || offset >= tag.length - 1) break;
|
|
672
|
-
const nameStart = offset;
|
|
673
|
-
while (offset < tag.length && !/[\s=/>]/.test(tag[offset])) offset++;
|
|
674
|
-
const name = tag.slice(nameStart, offset).toLowerCase();
|
|
675
|
-
while (/\s/.test(tag[offset] || "")) offset++;
|
|
676
|
-
if (tag[offset] === "=") {
|
|
677
|
-
offset++;
|
|
678
|
-
while (/\s/.test(tag[offset] || "")) offset++;
|
|
679
|
-
const quote = tag[offset] === '"' || tag[offset] === "'" ? tag[offset++] : void 0;
|
|
680
|
-
if (quote) {
|
|
681
|
-
while (offset < tag.length && tag[offset] !== quote) offset++;
|
|
682
|
-
if (tag[offset] === quote) offset++;
|
|
683
|
-
} else {
|
|
684
|
-
while (offset < tag.length && !/[\s>]/.test(tag[offset])) offset++;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
if (name === expectedName) return { start: whitespaceStart, end: offset };
|
|
688
|
-
}
|
|
689
|
-
return void 0;
|
|
690
|
-
}
|
|
691
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, findScriptTagAttributeRange, "findScriptTagAttributeRange");
|
|
692
|
-
function findRawTextEnd(input, tagName, offset = 0) {
|
|
693
|
-
const closing = rawTextElements.get(tagName);
|
|
694
|
-
closing.lastIndex = offset;
|
|
695
|
-
return _nullishCoalesce(_optionalChain([closing, 'access', _17 => _17.exec, 'call', _18 => _18(input), 'optionalAccess', _19 => _19.index]), () => ( -1));
|
|
696
|
-
}
|
|
697
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, findRawTextEnd, "findRawTextEnd");
|
|
698
|
-
function matchingSuffixLength(input, token) {
|
|
699
|
-
const limit = Math.min(token.length - 1, input.length);
|
|
700
|
-
for (let length = limit; length > 0; length--) {
|
|
701
|
-
if (token.startsWith(input.slice(-length).toLowerCase())) return length;
|
|
702
|
-
}
|
|
703
|
-
return 0;
|
|
704
|
-
}
|
|
705
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, matchingSuffixLength, "matchingSuffixLength");
|
|
706
|
-
function findHtmlTagEnd(tag) {
|
|
707
|
-
let quote;
|
|
708
|
-
for (let index = 1; index < tag.length; index++) {
|
|
709
|
-
const character = tag[index];
|
|
710
|
-
if (quote) {
|
|
711
|
-
if (character === quote) quote = void 0;
|
|
712
|
-
} else if (character === '"' || character === "'") {
|
|
713
|
-
quote = character;
|
|
714
|
-
} else if (character === ">") {
|
|
715
|
-
return index;
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
return -1;
|
|
719
|
-
}
|
|
720
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, findHtmlTagEnd, "findHtmlTagEnd");
|
|
721
|
-
function isPlainRecord(value) {
|
|
722
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
723
|
-
const prototype = Object.getPrototypeOf(value);
|
|
724
|
-
return prototype === Object.prototype || prototype === null;
|
|
725
|
-
}
|
|
726
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, isPlainRecord, "isPlainRecord");
|
|
727
|
-
|
|
728
|
-
// src/preload.ts
|
|
729
|
-
var DEFAULT_PRELOAD_CONFIG = {
|
|
730
|
-
mode: "enforce",
|
|
731
|
-
maxImages: 1,
|
|
732
|
-
maxFonts: 2
|
|
733
|
-
};
|
|
734
|
-
var reportedWarnings = /* @__PURE__ */ new Map();
|
|
735
|
-
var nextWarningExpiry = Infinity;
|
|
736
|
-
var PRELOAD_WARNING_TTL_MS = 6e4;
|
|
737
|
-
var MAX_REPORTED_PRELOAD_WARNINGS = 256;
|
|
738
|
-
function resolveFarmPerformanceConfig(config) {
|
|
739
|
-
return {
|
|
740
|
-
preload: {
|
|
741
|
-
mode: _optionalChain([config, 'optionalAccess', _20 => _20.preload, 'optionalAccess', _21 => _21.mode]) === "warn" ? "warn" : "enforce",
|
|
742
|
-
maxImages: normalizeBudget(_optionalChain([config, 'optionalAccess', _22 => _22.preload, 'optionalAccess', _23 => _23.maxImages]), DEFAULT_PRELOAD_CONFIG.maxImages),
|
|
743
|
-
maxFonts: normalizeBudget(_optionalChain([config, 'optionalAccess', _24 => _24.preload, 'optionalAccess', _25 => _25.maxFonts]), DEFAULT_PRELOAD_CONFIG.maxFonts)
|
|
744
|
-
}
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmPerformanceConfig, "resolveFarmPerformanceConfig");
|
|
748
|
-
function manageFarmHtmlPreloads(html, config) {
|
|
749
|
-
const elements = findHtmlLinkElements(html);
|
|
750
|
-
const candidates = elements.flatMap((element, index) => {
|
|
751
|
-
const kind = getHtmlPreloadKind(element.value);
|
|
752
|
-
return kind ? [
|
|
753
|
-
{
|
|
754
|
-
index,
|
|
755
|
-
kind,
|
|
756
|
-
href: readHtmlAttribute(element.value, "href"),
|
|
757
|
-
highPriority: _optionalChain([readHtmlAttribute, 'call', _26 => _26(element.value, "fetchpriority"), 'optionalAccess', _27 => _27.toLowerCase, 'call', _28 => _28()]) === "high"
|
|
758
|
-
}
|
|
759
|
-
] : [];
|
|
760
|
-
});
|
|
761
|
-
const budget = selectPreloadsWithinBudget(candidates, config);
|
|
762
|
-
if (config.mode === "warn" || budget.removed.size === 0) {
|
|
763
|
-
return { value: html, warnings: budget.warnings };
|
|
764
|
-
}
|
|
765
|
-
return {
|
|
766
|
-
value: removeHtmlLinkElements(html, elements, budget.removed),
|
|
767
|
-
warnings: budget.warnings
|
|
768
|
-
};
|
|
769
|
-
}
|
|
770
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, manageFarmHtmlPreloads, "manageFarmHtmlPreloads");
|
|
771
|
-
function manageFarmLinkHeaderPreloads(value, config) {
|
|
772
|
-
if (!value) return { value, warnings: [] };
|
|
773
|
-
const links = splitLinkHeader(value);
|
|
774
|
-
const candidates = links.flatMap((link, index) => {
|
|
775
|
-
const kind = getLinkHeaderPreloadKind(link);
|
|
776
|
-
return kind ? [
|
|
777
|
-
{
|
|
778
|
-
index,
|
|
779
|
-
kind,
|
|
780
|
-
href: getLinkHeaderTarget(link),
|
|
781
|
-
highPriority: _optionalChain([getLinkHeaderParameter, 'call', _29 => _29(link, "fetchpriority"), 'optionalAccess', _30 => _30.toLowerCase, 'call', _31 => _31()]) === "high"
|
|
782
|
-
}
|
|
783
|
-
] : [];
|
|
784
|
-
});
|
|
785
|
-
const budget = selectPreloadsWithinBudget(candidates, config);
|
|
786
|
-
return {
|
|
787
|
-
value: config.mode === "enforce" ? links.filter((_, index) => !budget.removed.has(index)).join(", ") : value,
|
|
788
|
-
warnings: budget.warnings
|
|
789
|
-
};
|
|
790
|
-
}
|
|
791
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, manageFarmLinkHeaderPreloads, "manageFarmLinkHeaderPreloads");
|
|
792
|
-
function manageFarmDocumentPreloads(html, linkHeader, config) {
|
|
793
|
-
const elements = findHtmlLinkElements(html);
|
|
794
|
-
const links = linkHeader ? splitLinkHeader(linkHeader) : [];
|
|
795
|
-
const headerOffset = elements.length;
|
|
796
|
-
const candidates = [];
|
|
797
|
-
for (const [index, element] of elements.entries()) {
|
|
798
|
-
const kind = getHtmlPreloadKind(element.value);
|
|
799
|
-
if (!kind) continue;
|
|
800
|
-
candidates.push({
|
|
801
|
-
index,
|
|
802
|
-
kind,
|
|
803
|
-
href: readHtmlAttribute(element.value, "href"),
|
|
804
|
-
highPriority: _optionalChain([readHtmlAttribute, 'call', _32 => _32(element.value, "fetchpriority"), 'optionalAccess', _33 => _33.toLowerCase, 'call', _34 => _34()]) === "high"
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
for (const [index, link] of links.entries()) {
|
|
808
|
-
const kind = getLinkHeaderPreloadKind(link);
|
|
809
|
-
if (!kind) continue;
|
|
810
|
-
candidates.push({
|
|
811
|
-
index: headerOffset + index,
|
|
812
|
-
kind,
|
|
813
|
-
href: getLinkHeaderTarget(link),
|
|
814
|
-
highPriority: _optionalChain([getLinkHeaderParameter, 'call', _35 => _35(link, "fetchpriority"), 'optionalAccess', _36 => _36.toLowerCase, 'call', _37 => _37()]) === "high"
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
const budget = selectPreloadsWithinBudget(candidates, config);
|
|
818
|
-
if (config.mode === "warn" || budget.removed.size === 0) {
|
|
819
|
-
return { html, linkHeader, warnings: budget.warnings };
|
|
820
|
-
}
|
|
821
|
-
return {
|
|
822
|
-
html: removeHtmlLinkElements(html, elements, budget.removed),
|
|
823
|
-
linkHeader: links.filter((_, index) => !budget.removed.has(headerOffset + index)).join(", "),
|
|
824
|
-
warnings: budget.warnings
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, manageFarmDocumentPreloads, "manageFarmDocumentPreloads");
|
|
828
|
-
function reportFarmPreloadWarnings(warnings, context = "the rendered document") {
|
|
829
|
-
if (warnings.length === 0 && reportedWarnings.size === 0) return;
|
|
830
|
-
const now = Date.now();
|
|
831
|
-
if (now >= nextWarningExpiry) {
|
|
832
|
-
nextWarningExpiry = Infinity;
|
|
833
|
-
for (const [key, reportedAt] of reportedWarnings) {
|
|
834
|
-
const expiresAt = reportedAt + PRELOAD_WARNING_TTL_MS;
|
|
835
|
-
if (now >= expiresAt) reportedWarnings.delete(key);
|
|
836
|
-
else nextWarningExpiry = Math.min(nextWarningExpiry, expiresAt);
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
for (const warning of warnings) {
|
|
840
|
-
const key = `${context}:${warning.kind}:${warning.count}:${warning.budget}:${warning.removed}`;
|
|
841
|
-
const reportedAt = reportedWarnings.get(key);
|
|
842
|
-
if (reportedAt !== void 0 && now - reportedAt < PRELOAD_WARNING_TTL_MS) continue;
|
|
843
|
-
reportedWarnings.set(key, now);
|
|
844
|
-
nextWarningExpiry = Math.min(nextWarningExpiry, now + PRELOAD_WARNING_TTL_MS);
|
|
845
|
-
while (reportedWarnings.size > MAX_REPORTED_PRELOAD_WARNINGS) {
|
|
846
|
-
const oldest = reportedWarnings.keys().next().value;
|
|
847
|
-
if (oldest === void 0) break;
|
|
848
|
-
reportedWarnings.delete(oldest);
|
|
849
|
-
}
|
|
850
|
-
const action = warning.removed > 0 ? ` Removed ${warning.removed} lower-priority hint(s).` : "";
|
|
851
|
-
const recommendation = warning.kind === "image" ? ' Mark only the LCP image with `preload` or `fetchPriority="high"`.' : " Set `preload: false` on fonts that are not required above the fold.";
|
|
852
|
-
console.warn(
|
|
853
|
-
`[Farm.js] ${context} emitted ${warning.count} ${warning.kind} preload hints (budget: ${warning.budget}).${action}${recommendation}`
|
|
854
|
-
);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, reportFarmPreloadWarnings, "reportFarmPreloadWarnings");
|
|
858
|
-
function selectPreloadsWithinBudget(candidates, config) {
|
|
859
|
-
const removed = /* @__PURE__ */ new Set();
|
|
860
|
-
const warnings = [];
|
|
861
|
-
for (const kind of ["image", "font"]) {
|
|
862
|
-
const resources = /* @__PURE__ */ new Map();
|
|
863
|
-
for (const candidate of candidates) {
|
|
864
|
-
if (candidate.kind !== kind) continue;
|
|
865
|
-
const key = _nullishCoalesce(candidate.href, () => ( `#${candidate.index}`));
|
|
866
|
-
const hints = resources.get(key);
|
|
867
|
-
if (hints) hints.push(candidate);
|
|
868
|
-
else resources.set(key, [candidate]);
|
|
869
|
-
}
|
|
870
|
-
const limit = kind === "image" ? config.maxImages : config.maxFonts;
|
|
871
|
-
if (resources.size <= limit) continue;
|
|
872
|
-
const ranked = [...resources.values()].map((hints) => ({
|
|
873
|
-
hints,
|
|
874
|
-
index: hints[0].index,
|
|
875
|
-
highPriority: hints.some((hint) => hint.highPriority)
|
|
876
|
-
})).sort(
|
|
877
|
-
(left, right) => Number(right.highPriority) - Number(left.highPriority) || left.index - right.index
|
|
878
|
-
);
|
|
879
|
-
if (config.mode === "enforce") {
|
|
880
|
-
for (const resource of ranked.slice(limit)) {
|
|
881
|
-
for (const hint of resource.hints) removed.add(hint.index);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
warnings.push({
|
|
885
|
-
kind,
|
|
886
|
-
count: resources.size,
|
|
887
|
-
budget: limit,
|
|
888
|
-
removed: config.mode === "enforce" ? resources.size - limit : 0
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
|
-
return { removed, warnings };
|
|
892
|
-
}
|
|
893
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, selectPreloadsWithinBudget, "selectPreloadsWithinBudget");
|
|
894
|
-
function getHtmlPreloadKind(link) {
|
|
895
|
-
const rel = _optionalChain([readHtmlAttribute, 'call', _38 => _38(link, "rel"), 'optionalAccess', _39 => _39.toLowerCase, 'call', _40 => _40(), 'access', _41 => _41.split, 'call', _42 => _42(/\s+/)]) || [];
|
|
896
|
-
if (!rel.includes("preload")) return void 0;
|
|
897
|
-
return normalizePreloadKind(readHtmlAttribute(link, "as"));
|
|
898
|
-
}
|
|
899
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, getHtmlPreloadKind, "getHtmlPreloadKind");
|
|
900
|
-
function getLinkHeaderPreloadKind(link) {
|
|
901
|
-
const relations = _nullishCoalesce(_optionalChain([getLinkHeaderParameter, 'call', _43 => _43(link, "rel"), 'optionalAccess', _44 => _44.toLowerCase, 'call', _45 => _45(), 'access', _46 => _46.split, 'call', _47 => _47(/\s+/)]), () => ( []));
|
|
902
|
-
if (!relations.includes("preload")) return void 0;
|
|
903
|
-
return normalizePreloadKind(getLinkHeaderParameter(link, "as"));
|
|
904
|
-
}
|
|
905
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, getLinkHeaderPreloadKind, "getLinkHeaderPreloadKind");
|
|
906
|
-
function getLinkHeaderTarget(link) {
|
|
907
|
-
const start = link.indexOf("<");
|
|
908
|
-
const end = link.indexOf(">", start + 1);
|
|
909
|
-
return start === -1 || end === -1 ? void 0 : link.slice(start + 1, end).trim();
|
|
910
|
-
}
|
|
911
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, getLinkHeaderTarget, "getLinkHeaderTarget");
|
|
912
|
-
function getLinkHeaderParameter(link, name) {
|
|
913
|
-
const uriEnd = link.indexOf(">");
|
|
914
|
-
if (uriEnd === -1) return void 0;
|
|
915
|
-
for (const parameter of splitLinkParameters(link.slice(uriEnd + 1))) {
|
|
916
|
-
const separator = parameter.indexOf("=");
|
|
917
|
-
const parameterName = (separator === -1 ? parameter : parameter.slice(0, separator)).trim().toLowerCase();
|
|
918
|
-
if (parameterName !== name.toLowerCase() || separator === -1) continue;
|
|
919
|
-
const rawValue = parameter.slice(separator + 1).trim();
|
|
920
|
-
if (rawValue.startsWith('"') && rawValue.endsWith('"')) {
|
|
921
|
-
return rawValue.slice(1, -1).replace(/\\([\\"])/g, "$1");
|
|
922
|
-
}
|
|
923
|
-
return rawValue;
|
|
924
|
-
}
|
|
925
|
-
return void 0;
|
|
926
|
-
}
|
|
927
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, getLinkHeaderParameter, "getLinkHeaderParameter");
|
|
928
|
-
function splitLinkParameters(value) {
|
|
929
|
-
const parameters = [];
|
|
930
|
-
let start = 0;
|
|
931
|
-
let quoted = false;
|
|
932
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
933
|
-
const character = value[index];
|
|
934
|
-
if (character === '"' && !isEscaped(value, index)) quoted = !quoted;
|
|
935
|
-
else if (character === ";" && !quoted) {
|
|
936
|
-
const parameter2 = value.slice(start, index).trim();
|
|
937
|
-
if (parameter2) parameters.push(parameter2);
|
|
938
|
-
start = index + 1;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
const parameter = value.slice(start).trim();
|
|
942
|
-
if (parameter) parameters.push(parameter);
|
|
943
|
-
return parameters;
|
|
944
|
-
}
|
|
945
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, splitLinkParameters, "splitLinkParameters");
|
|
946
|
-
function normalizePreloadKind(value) {
|
|
947
|
-
const normalized = _optionalChain([value, 'optionalAccess', _48 => _48.toLowerCase, 'call', _49 => _49()]);
|
|
948
|
-
return normalized === "image" || normalized === "font" ? normalized : void 0;
|
|
949
|
-
}
|
|
950
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizePreloadKind, "normalizePreloadKind");
|
|
951
|
-
function readHtmlAttribute(element, name) {
|
|
952
|
-
const match = element.match(
|
|
953
|
-
new RegExp(`\\s${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i")
|
|
954
|
-
);
|
|
955
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([match, 'optionalAccess', _50 => _50[1]]), () => ( _optionalChain([match, 'optionalAccess', _51 => _51[2]]))), () => ( _optionalChain([match, 'optionalAccess', _52 => _52[3]])));
|
|
956
|
-
}
|
|
957
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlAttribute, "readHtmlAttribute");
|
|
958
|
-
function findHtmlLinkElements(html) {
|
|
959
|
-
const lastToken = typeof html === "string" ? findLastPreloadToken(html) : Infinity;
|
|
960
|
-
if (lastToken === -1) return [];
|
|
961
|
-
const elements = [];
|
|
962
|
-
let lowerHtml = foldHtmlTagCase(
|
|
963
|
-
lastToken === Infinity ? html : html.slice(0, lastToken + RAW_TEXT_TAG_LOOKAHEAD)
|
|
964
|
-
);
|
|
965
|
-
const rawTextTag = /<(script|style|template|textarea|title|noscript|svg)(?=[\s/>])/y;
|
|
966
|
-
const linkTag = /<link(?=[\s/>])/iy;
|
|
967
|
-
const ordinaryTag = /<\/?[A-Za-z][\w:-]*(?=[\s/>])/y;
|
|
968
|
-
let cursor = 0;
|
|
969
|
-
while (cursor < html.length) {
|
|
970
|
-
const start = html.indexOf("<", cursor);
|
|
971
|
-
if (start === -1 || start > lastToken) break;
|
|
972
|
-
if (html.startsWith("<!--", start)) {
|
|
973
|
-
const commentEnd = html.indexOf("-->", start + 4);
|
|
974
|
-
cursor = commentEnd === -1 ? html.length : commentEnd + 3;
|
|
975
|
-
continue;
|
|
976
|
-
}
|
|
977
|
-
rawTextTag.lastIndex = start;
|
|
978
|
-
const rawText = rawTextTag.exec(lowerHtml);
|
|
979
|
-
if (_optionalChain([rawText, 'optionalAccess', _53 => _53[1]])) {
|
|
980
|
-
const openingEnd = findHtmlTagEnd2(html, start);
|
|
981
|
-
if (openingEnd === -1) break;
|
|
982
|
-
if (rawText[1] === "svg" && html[openingEnd - 2] === "/") {
|
|
983
|
-
cursor = openingEnd;
|
|
984
|
-
continue;
|
|
985
|
-
}
|
|
986
|
-
let closingStart = findHtmlClosingTag(lowerHtml, rawText[1], openingEnd);
|
|
987
|
-
if (closingStart === -1 && lowerHtml.length < html.length) {
|
|
988
|
-
lowerHtml = foldHtmlTagCase(html);
|
|
989
|
-
closingStart = findHtmlClosingTag(lowerHtml, rawText[1], openingEnd);
|
|
990
|
-
}
|
|
991
|
-
if (closingStart === -1) {
|
|
992
|
-
cursor = html.length;
|
|
993
|
-
continue;
|
|
994
|
-
}
|
|
995
|
-
const closingEnd = findHtmlTagEnd2(html, closingStart);
|
|
996
|
-
cursor = closingEnd === -1 ? html.length : closingEnd;
|
|
997
|
-
continue;
|
|
998
|
-
}
|
|
999
|
-
linkTag.lastIndex = start;
|
|
1000
|
-
if (linkTag.test(html)) {
|
|
1001
|
-
const end = findHtmlTagEnd2(html, start);
|
|
1002
|
-
if (end === -1) break;
|
|
1003
|
-
elements.push({ start, end, value: html.slice(start, end) });
|
|
1004
|
-
cursor = end;
|
|
1005
|
-
continue;
|
|
1006
|
-
}
|
|
1007
|
-
ordinaryTag.lastIndex = start;
|
|
1008
|
-
if (ordinaryTag.test(html)) {
|
|
1009
|
-
const end = findHtmlTagEnd2(html, start);
|
|
1010
|
-
cursor = end === -1 ? html.length : end;
|
|
1011
|
-
continue;
|
|
1012
|
-
}
|
|
1013
|
-
cursor = start + 1;
|
|
1014
|
-
}
|
|
1015
|
-
return elements;
|
|
1016
|
-
}
|
|
1017
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, findHtmlLinkElements, "findHtmlLinkElements");
|
|
1018
|
-
var RAW_TEXT_TAG_LOOKAHEAD = 16;
|
|
1019
|
-
var PRELOAD_TOKEN = /\bpreload\b/gi;
|
|
1020
|
-
function findLastPreloadToken(html) {
|
|
1021
|
-
let last = -1;
|
|
1022
|
-
PRELOAD_TOKEN.lastIndex = 0;
|
|
1023
|
-
for (let match = PRELOAD_TOKEN.exec(html); match; match = PRELOAD_TOKEN.exec(html)) {
|
|
1024
|
-
last = match.index;
|
|
1025
|
-
}
|
|
1026
|
-
return last;
|
|
1027
|
-
}
|
|
1028
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, findLastPreloadToken, "findLastPreloadToken");
|
|
1029
|
-
function foldHtmlTagCase(html) {
|
|
1030
|
-
const lowerHtml = html.toLowerCase();
|
|
1031
|
-
return lowerHtml.length === html.length ? lowerHtml : html.replace(/[A-Z]/g, (letter) => letter.toLowerCase());
|
|
1032
|
-
}
|
|
1033
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, foldHtmlTagCase, "foldHtmlTagCase");
|
|
1034
|
-
function findHtmlClosingTag(html, tagName, start) {
|
|
1035
|
-
const prefix = `</${tagName}`;
|
|
1036
|
-
let candidate = html.indexOf(prefix, start);
|
|
1037
|
-
while (candidate !== -1) {
|
|
1038
|
-
const boundary = html[candidate + prefix.length];
|
|
1039
|
-
if (boundary === ">" || boundary === "/" || /\s/.test(_nullishCoalesce(boundary, () => ( "")))) return candidate;
|
|
1040
|
-
candidate = html.indexOf(prefix, candidate + prefix.length);
|
|
1041
|
-
}
|
|
1042
|
-
return -1;
|
|
1043
|
-
}
|
|
1044
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, findHtmlClosingTag, "findHtmlClosingTag");
|
|
1045
|
-
function findHtmlTagEnd2(html, start) {
|
|
1046
|
-
let quote;
|
|
1047
|
-
for (let index = start + 1; index < html.length; index += 1) {
|
|
1048
|
-
const character = html[index];
|
|
1049
|
-
if (quote) {
|
|
1050
|
-
if (character === quote) quote = void 0;
|
|
1051
|
-
} else if (character === '"' || character === "'") {
|
|
1052
|
-
quote = character;
|
|
1053
|
-
} else if (character === ">") {
|
|
1054
|
-
return index + 1;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
return -1;
|
|
1058
|
-
}
|
|
1059
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, findHtmlTagEnd2, "findHtmlTagEnd");
|
|
1060
|
-
function removeHtmlLinkElements(html, elements, removed) {
|
|
1061
|
-
let cursor = 0;
|
|
1062
|
-
let output = "";
|
|
1063
|
-
for (const [index, element] of elements.entries()) {
|
|
1064
|
-
if (!removed.has(index)) continue;
|
|
1065
|
-
output += html.slice(cursor, element.start);
|
|
1066
|
-
cursor = element.end;
|
|
1067
|
-
}
|
|
1068
|
-
return output + html.slice(cursor);
|
|
1069
|
-
}
|
|
1070
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, removeHtmlLinkElements, "removeHtmlLinkElements");
|
|
1071
|
-
function splitLinkHeader(value) {
|
|
1072
|
-
const links = [];
|
|
1073
|
-
let start = 0;
|
|
1074
|
-
let insideAngleBrackets = false;
|
|
1075
|
-
let quoted = false;
|
|
1076
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
1077
|
-
const character = value[index];
|
|
1078
|
-
if (quoted) {
|
|
1079
|
-
if (character === '"' && !isEscaped(value, index)) quoted = false;
|
|
1080
|
-
continue;
|
|
1081
|
-
}
|
|
1082
|
-
if (character === '"') {
|
|
1083
|
-
quoted = true;
|
|
1084
|
-
} else if (character === "<") {
|
|
1085
|
-
insideAngleBrackets = true;
|
|
1086
|
-
} else if (character === ">") {
|
|
1087
|
-
insideAngleBrackets = false;
|
|
1088
|
-
} else if (character === "," && !insideAngleBrackets) {
|
|
1089
|
-
links.push(value.slice(start, index).trim());
|
|
1090
|
-
start = index + 1;
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
links.push(value.slice(start).trim());
|
|
1094
|
-
return links.filter(Boolean);
|
|
1095
|
-
}
|
|
1096
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, splitLinkHeader, "splitLinkHeader");
|
|
1097
|
-
function isEscaped(value, index) {
|
|
1098
|
-
let backslashes = 0;
|
|
1099
|
-
for (let cursor = index - 1; cursor >= 0 && value[cursor] === "\\"; cursor -= 1) {
|
|
1100
|
-
backslashes += 1;
|
|
1101
|
-
}
|
|
1102
|
-
return backslashes % 2 === 1;
|
|
1103
|
-
}
|
|
1104
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, isEscaped, "isEscaped");
|
|
1105
|
-
function normalizeBudget(value, fallback) {
|
|
1106
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : fallback;
|
|
1107
|
-
}
|
|
1108
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeBudget, "normalizeBudget");
|
|
1109
|
-
|
|
1110
|
-
// src/preview-noindex.ts
|
|
1111
|
-
var FARM_PREVIEW_ROBOTS_TAG = "noindex, nofollow";
|
|
1112
|
-
function resolveFarmNoindexPreviews(input) {
|
|
1113
|
-
if (input === void 0) return false;
|
|
1114
|
-
if (typeof input !== "boolean") {
|
|
1115
|
-
throw new TypeError("agent.noindexPreviews must be a boolean.");
|
|
1116
|
-
}
|
|
1117
|
-
return input;
|
|
1118
|
-
}
|
|
1119
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmNoindexPreviews, "resolveFarmNoindexPreviews");
|
|
1120
|
-
function applyFarmPreviewRobotsTag(response) {
|
|
1121
|
-
try {
|
|
1122
|
-
response.headers.set("X-Robots-Tag", FARM_PREVIEW_ROBOTS_TAG);
|
|
1123
|
-
return response;
|
|
1124
|
-
} catch (e3) {
|
|
1125
|
-
const headers = new Headers(response.headers);
|
|
1126
|
-
headers.set("X-Robots-Tag", FARM_PREVIEW_ROBOTS_TAG);
|
|
1127
|
-
return new Response(response.body, {
|
|
1128
|
-
status: response.status,
|
|
1129
|
-
statusText: response.statusText,
|
|
1130
|
-
headers
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmPreviewRobotsTag, "applyFarmPreviewRobotsTag");
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
exports.resolveFarmAgentCrawlers = resolveFarmAgentCrawlers; exports.createFarmAgentRobots = createFarmAgentRobots; exports.resolveFarmAgentSitemap = resolveFarmAgentSitemap; exports.createFarmDefaultSitemap = createFarmDefaultSitemap; exports.resolveFarmSecurityConfig = resolveFarmSecurityConfig; exports.getFarmSecurityHeader = getFarmSecurityHeader; exports.createFarmCspNonce = createFarmCspNonce; exports.addFarmCspNonceToScriptTags = addFarmCspNonceToScriptTags; exports.applyFarmCspHashesToHtml = applyFarmCspHashesToHtml; exports.applyFarmCspNonceToResponse = applyFarmCspNonceToResponse; exports.farmCspBlocksFrameworkInlineScripts = farmCspBlocksFrameworkInlineScripts; exports.createFarmCspNonceRewriter = createFarmCspNonceRewriter; exports.resolveFarmPerformanceConfig = resolveFarmPerformanceConfig; exports.manageFarmHtmlPreloads = manageFarmHtmlPreloads; exports.manageFarmLinkHeaderPreloads = manageFarmLinkHeaderPreloads; exports.manageFarmDocumentPreloads = manageFarmDocumentPreloads; exports.reportFarmPreloadWarnings = reportFarmPreloadWarnings; exports.FARM_PREVIEW_ROBOTS_TAG = FARM_PREVIEW_ROBOTS_TAG; exports.resolveFarmNoindexPreviews = resolveFarmNoindexPreviews; exports.applyFarmPreviewRobotsTag = applyFarmPreviewRobotsTag;
|