@farm.js/core 0.1.27 → 0.1.29
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-runtime.d.mts +3 -2
- package/dist/agent-runtime.d.ts +3 -2
- package/dist/api/client.cjs +4 -6
- package/dist/api/client.d.mts +1 -0
- package/dist/api/client.d.ts +1 -0
- package/dist/api/client.mjs +3 -5
- package/dist/api/route-manager.cjs +9 -8
- package/dist/api/route-manager.d.mts +2 -1
- package/dist/api/route-manager.d.ts +2 -1
- package/dist/api/route-manager.mjs +8 -7
- package/dist/api/runtime.cjs +7 -6
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/api/runtime.mjs +6 -5
- package/dist/api.cjs +12 -11
- package/dist/api.d.mts +19 -4
- package/dist/api.d.ts +19 -4
- package/dist/api.mjs +11 -10
- package/dist/{app-BfzZdjgX.d.mts → app-DAuUTIZf.d.mts} +3 -3
- package/dist/app-markdown.cjs +6 -5
- package/dist/app-markdown.d.mts +4 -3
- package/dist/app-markdown.d.ts +4 -3
- package/dist/app-markdown.mjs +5 -4
- package/dist/{app-CXK7Prrt.d.ts → app-sUJ3jnTZ.d.ts} +3 -3
- package/dist/cache-invalidation-BD0z_lfu.d.mts +4 -0
- package/dist/cache-invalidation-BD0z_lfu.d.ts +4 -0
- package/dist/cache.cjs +6 -4
- package/dist/cache.d.mts +11 -6
- package/dist/cache.d.ts +11 -6
- package/dist/cache.mjs +7 -5
- package/dist/{chunk-N6UROPT7.mjs → chunk-2FQHH5SC.mjs} +12 -13
- package/dist/{chunk-UUYF3CHN.mjs → chunk-2N5PX3LS.mjs} +2 -2
- package/dist/{chunk-H6G5INWM.cjs → chunk-2SDO73HK.cjs} +14 -156
- package/dist/{chunk-4FHDV7VM.mjs → chunk-2UABTL3Y.mjs} +2 -2
- package/dist/{chunk-LAHZ7LZA.cjs → chunk-3FCFQP5V.cjs} +32 -20
- package/dist/{chunk-3TQWUUNP.cjs → chunk-3LUF2PE2.cjs} +10 -5
- package/dist/{chunk-SYGGPS4A.mjs → chunk-4IEPYMHF.mjs} +3 -3
- package/dist/{chunk-WD5PNSOB.mjs → chunk-4V7GIE2U.mjs} +6 -4
- package/dist/{chunk-UWTQTZFN.mjs → chunk-5KDPVSS3.mjs} +271 -155
- package/dist/{chunk-I7PUUDGY.cjs → chunk-63H6BKXG.cjs} +2 -2
- package/dist/{chunk-ZSO5GWGD.cjs → chunk-6CNX6Q3K.cjs} +168 -51
- package/dist/{chunk-3PTVHMLD.mjs → chunk-6G3ZZ2IE.mjs} +1 -1
- package/dist/{chunk-QBPXNZGV.cjs → chunk-6MVFL3R5.cjs} +25 -6
- package/dist/{chunk-FG5H2VCJ.mjs → chunk-6ZCMSZ5U.mjs} +2 -2
- package/dist/{chunk-YZBV7733.cjs → chunk-74T3CEA7.cjs} +397 -281
- package/dist/{chunk-ZMN3H73H.cjs → chunk-75DYEVXI.cjs} +13 -11
- package/dist/{chunk-WIVTGKLY.mjs → chunk-7CXKSRKL.mjs} +18 -11
- package/dist/{chunk-POXI72VV.mjs → chunk-ATXI6LGT.mjs} +148 -31
- package/dist/{chunk-NL3ZSMZB.cjs → chunk-BJPBQNIE.cjs} +12 -12
- package/dist/{chunk-Q4BHBO6V.mjs → chunk-BXFWA23T.mjs} +2 -2
- package/dist/{chunk-MBFURXAC.mjs → chunk-BZ3CHOFX.mjs} +1 -1
- package/dist/{chunk-TDWFCC2T.cjs → chunk-BZAGKCKB.cjs} +2 -2
- package/dist/chunk-CNOQY6Z7.mjs +156 -0
- package/dist/{chunk-DW34V5SM.cjs → chunk-CTV2TTNP.cjs} +4 -4
- package/dist/{chunk-HG237IEY.mjs → chunk-D234YWNA.mjs} +1 -1
- package/dist/{chunk-YXM74XOW.cjs → chunk-D4JE5NNV.cjs} +12 -12
- package/dist/{chunk-O2LV5XDG.mjs → chunk-DGXN3L4D.mjs} +20 -8
- package/dist/{chunk-4UNKCNSL.mjs → chunk-E76XC6ZG.mjs} +2 -2
- package/dist/{chunk-QQQNJS2E.mjs → chunk-E7UN576T.mjs} +1 -1
- package/dist/{chunk-G3HRIVEY.cjs → chunk-ES4B2IXW.cjs} +2 -2
- package/dist/{chunk-JQGDQO2I.cjs → chunk-EXLKRR4U.cjs} +10 -10
- package/dist/chunk-FJ3M4CUX.cjs +46 -0
- package/dist/chunk-FXEF4PPL.mjs +47 -0
- package/dist/{chunk-WD4YXVLV.mjs → chunk-GZYH4OER.mjs} +1 -1
- package/dist/{chunk-DX4VKYAJ.cjs → chunk-I26CZYPV.cjs} +6 -4
- package/dist/{chunk-F6SJAKFJ.mjs → chunk-IV6CQY7O.mjs} +12 -154
- package/dist/{chunk-6D242YGO.mjs → chunk-JATSG2ZO.mjs} +1 -1
- package/dist/{chunk-KAERLFD3.cjs → chunk-JFHKNFEO.cjs} +30 -23
- package/dist/{chunk-U74A3P2P.cjs → chunk-JLRDISQL.cjs} +7 -7
- package/dist/{chunk-BYODCJD6.cjs → chunk-K7CELQLK.cjs} +12 -13
- package/dist/{chunk-Y4YWHNKU.cjs → chunk-KH7BN726.cjs} +9 -9
- package/dist/{chunk-3IL5UC5I.cjs → chunk-KZLND3D2.cjs} +2 -2
- package/dist/{chunk-TKDY6AJP.mjs → chunk-MKMBQSNQ.mjs} +1 -1
- package/dist/{chunk-OCE65DDM.mjs → chunk-MNUGPHLN.mjs} +1 -1
- package/dist/{chunk-WJKVTJJR.cjs → chunk-NPPL5YDT.cjs} +2 -2
- package/dist/{chunk-HF5SIACK.cjs → chunk-NXG66MR7.cjs} +3 -3
- package/dist/chunk-NYJMY3JA.cjs +156 -0
- package/dist/{chunk-VVJCWBIE.mjs → chunk-O3DTUAX2.mjs} +2 -2
- package/dist/{chunk-R6AIILII.cjs → chunk-OZVEHHMA.cjs} +15 -14
- package/dist/{chunk-FPW4W3VW.mjs → chunk-PQD2AI3B.mjs} +1 -1
- package/dist/{chunk-C7OUJ6JI.cjs → chunk-PZNCMPJF.cjs} +3 -3
- package/dist/{chunk-QI7WQSMI.cjs → chunk-Q5JFU33Q.cjs} +4 -4
- package/dist/{chunk-52SH7TKB.mjs → chunk-QG5HNS7P.mjs} +2 -2
- package/dist/{chunk-CEYUWDWA.mjs → chunk-QZCT2CQ4.mjs} +10 -5
- package/dist/{chunk-FZC7EEPM.mjs → chunk-RSOJ7DRT.mjs} +26 -7
- package/dist/{chunk-QMV4QELL.mjs → chunk-S5GDHOE4.mjs} +4 -2
- package/dist/{chunk-CRQPYWLK.cjs → chunk-SORB3MAR.cjs} +14 -14
- package/dist/{chunk-I4J452B7.cjs → chunk-VHJGDMCG.cjs} +3 -3
- package/dist/{chunk-B6ZCT36X.cjs → chunk-WNLBF77X.cjs} +4 -4
- package/dist/{chunk-FOT7LZEO.cjs → chunk-WPPX4G7Q.cjs} +1 -1
- package/dist/{chunk-UNSKL6BI.cjs → chunk-X4ZV4QC5.cjs} +266 -228
- package/dist/{chunk-6EG7U4NF.mjs → chunk-X7WVQMIB.mjs} +1 -1
- package/dist/chunk-XD32KALF.cjs +47 -0
- package/dist/{chunk-RDV44SED.mjs → chunk-XJJVLDM6.mjs} +15 -14
- package/dist/{chunk-DQMTHWPI.cjs → chunk-XLTV4VOG.cjs} +21 -16
- package/dist/{chunk-5SPPCN5J.mjs → chunk-XNPDONUH.mjs} +1 -1
- package/dist/{chunk-UOXGA6TO.mjs → chunk-YDQZGSDS.mjs} +1 -1
- package/dist/{chunk-JT25KHDI.mjs → chunk-YMUE7L3D.mjs} +18 -13
- package/dist/chunk-Z3HATSKO.mjs +46 -0
- package/dist/{chunk-C3VRMB6H.cjs → chunk-ZCU4NZ3M.cjs} +6 -6
- package/dist/{chunk-NPFGGBM5.cjs → chunk-ZDILFMWN.cjs} +13 -13
- package/dist/{chunk-OGHTEYXS.mjs → chunk-ZYVFAOBT.mjs} +72 -34
- package/dist/{client-plugins-1GS4zubE.d.mts → client-plugins-BX2ptm4H.d.mts} +42 -34
- package/dist/{client-plugins-B1Za6F5x.d.ts → client-plugins-BmxM5KW_.d.ts} +42 -34
- package/dist/client-plugins.d.mts +3 -2
- package/dist/client-plugins.d.ts +3 -2
- package/dist/client.cjs +11 -12
- package/dist/client.d.mts +6 -5
- package/dist/client.d.ts +6 -5
- package/dist/client.mjs +10 -11
- package/dist/config.d.mts +3 -2
- package/dist/config.d.ts +3 -2
- package/dist/{devtools-CQJ3H6MX.cjs → devtools-GGVPZHJX.cjs} +96 -21
- package/dist/{devtools-6RN6KHTW.mjs → devtools-THVNPI2M.mjs} +80 -5
- package/dist/{devtools-client-4WAPJY5L.cjs → devtools-client-CXQ6PXI6.cjs} +1 -1
- package/dist/{devtools-client-LEUIHHAS.mjs → devtools-client-HJS2T34Y.mjs} +1 -1
- package/dist/docs.cjs +9 -8
- package/dist/docs.mjs +8 -7
- package/dist/index.cjs +61 -57
- package/dist/index.d.mts +26 -15
- package/dist/index.d.ts +26 -15
- package/dist/index.mjs +69 -65
- package/dist/integrations.d.mts +3 -2
- package/dist/integrations.d.ts +3 -2
- package/dist/internal/app-markdown-runtime.cjs +5 -4
- package/dist/internal/app-markdown-runtime.d.mts +4 -3
- package/dist/internal/app-markdown-runtime.d.ts +4 -3
- package/dist/internal/app-markdown-runtime.mjs +4 -3
- package/dist/internal/build-runtime.cjs +26 -23
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +25 -22
- package/dist/internal/cli-runtime.cjs +15 -13
- package/dist/internal/cli-runtime.mjs +14 -12
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +5 -1
- package/dist/internal/client-runtime.d.mts +1 -0
- package/dist/internal/client-runtime.d.ts +1 -0
- package/dist/internal/client-runtime.mjs +4 -0
- package/dist/internal/compression-runtime.cjs +3 -2
- package/dist/internal/compression-runtime.d.mts +6 -3
- package/dist/internal/compression-runtime.d.ts +6 -3
- package/dist/internal/compression-runtime.mjs +2 -1
- package/dist/internal/config-runtime.cjs +7 -6
- package/dist/internal/config-runtime.d.mts +4 -3
- package/dist/internal/config-runtime.d.ts +4 -3
- package/dist/internal/config-runtime.mjs +6 -5
- package/dist/internal/product-telemetry-runtime.cjs +10 -6
- package/dist/internal/product-telemetry-runtime.mjs +9 -5
- package/dist/internal/production-runtime.cjs +29 -13
- package/dist/internal/production-runtime.d.mts +36 -8
- package/dist/internal/production-runtime.d.ts +36 -8
- package/dist/internal/production-runtime.mjs +32 -16
- package/dist/markdown.cjs +4 -3
- package/dist/markdown.d.mts +3 -2
- package/dist/markdown.d.ts +3 -2
- package/dist/markdown.mjs +3 -2
- package/dist/{metadata-B9mCxKgp.d.mts → metadata-DsEaK7mQ.d.mts} +1 -1
- package/dist/{metadata-7LKgQEWF.d.ts → metadata-fwZ3gfG6.d.ts} +1 -1
- package/dist/middleware.cjs +6 -5
- package/dist/middleware.d.mts +4 -3
- package/dist/middleware.d.ts +4 -3
- package/dist/middleware.mjs +5 -4
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +5 -4
- package/dist/navigation.d.ts +5 -4
- package/dist/navigation.mjs +4 -4
- package/dist/plugin.cjs +25 -20
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.mjs +25 -20
- package/dist/{production-runtime-DramhI0c.d.mts → production-runtime-Baqgwtvc.d.mts} +1 -1
- package/dist/{production-runtime-B3xnY6fI.d.ts → production-runtime-DNkpFnmg.d.ts} +1 -1
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-CtQB-zHS.d.mts → render-plan-DhwQnmmX.d.mts} +1 -1
- package/dist/{render-plan-CpW32tOL.d.ts → render-plan-rkIK9wd9.d.ts} +1 -1
- package/dist/renderer-client.cjs +13 -14
- package/dist/renderer-client.d.mts +4 -3
- package/dist/renderer-client.d.ts +4 -3
- package/dist/renderer-client.mjs +6 -7
- package/dist/{request-BVGGeQv4.d.ts → request-BcY4RYPC.d.ts} +1 -1
- package/dist/{request-DlLVBKe3.d.mts → request-CFy1BltJ.d.mts} +1 -1
- package/dist/request.d.mts +4 -3
- package/dist/request.d.ts +4 -3
- package/dist/{route-rendering-DChYLNdh.d.mts → route-rendering-BkS0TBlB.d.mts} +1 -1
- package/dist/{route-rendering-BdEldajn.d.ts → route-rendering-D4XpMjam.d.ts} +1 -1
- package/dist/{router-D5htHn_M.d.mts → router-C4zPlC3V.d.mts} +1 -1
- package/dist/{router-D0Az-1Nu.d.ts → router-Cq7BcZxg.d.ts} +1 -1
- package/dist/routes.cjs +6 -5
- package/dist/routes.d.mts +3 -2
- package/dist/routes.d.ts +3 -2
- package/dist/routes.mjs +5 -4
- package/dist/server-fn-client.d.mts +1 -0
- package/dist/server-fn-client.d.ts +1 -0
- package/dist/server-fn.cjs +6 -5
- package/dist/server-fn.d.mts +1 -0
- package/dist/server-fn.d.ts +1 -0
- package/dist/server-fn.mjs +5 -4
- package/dist/server-plugins.cjs +3 -2
- package/dist/server-plugins.d.mts +3 -2
- package/dist/server-plugins.d.ts +3 -2
- package/dist/server-plugins.mjs +2 -1
- package/dist/server-query-client.cjs +5 -7
- package/dist/server-query-client.d.mts +1 -0
- package/dist/server-query-client.d.ts +1 -0
- package/dist/server-query-client.mjs +4 -6
- package/dist/server-query.cjs +7 -6
- package/dist/server-query.d.mts +1 -0
- package/dist/server-query.d.ts +1 -0
- package/dist/server-query.mjs +6 -5
- package/dist/server.cjs +72 -57
- package/dist/server.d.mts +10 -9
- package/dist/server.d.ts +10 -9
- package/dist/server.mjs +56 -41
- package/dist/{spa-router-DmwP_7QL.d.ts → spa-router-B1HI3X9k.d.ts} +2 -2
- package/dist/{spa-router-DVfSJZ5o.d.mts → spa-router-DzPZH-AO.d.mts} +2 -2
- package/dist/testing.cjs +14 -13
- package/dist/testing.d.mts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.mjs +11 -10
- package/dist/{utils-B_Rmr0-n.d.mts → utils-CEBktlBG.d.mts} +1 -1
- package/dist/{utils-Dv0OuLtF.d.ts → utils-DMD1Hzta.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +21 -19
- package/dist/vite.d.mts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.mjs +20 -18
- package/package.json +1 -1
- package/dist/{chunk-YOYF2E4U.mjs → chunk-LNZ7JZUS.mjs} +0 -0
- package/dist/{chunk-N4RLRSWW.cjs → chunk-SUIBNSNO.cjs} +0 -0
- package/dist/{chunk-TIKNUAU7.mjs → chunk-VUMAE7NC.mjs} +3 -3
- package/dist/{chunk-WM6HL7E7.cjs → chunk-ZHVYQL3H.cjs} +2 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkES4B2IXWcjs = require('./chunk-ES4B2IXW.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkSK35NQKKcjs = require('./chunk-SK35NQKK.cjs');
|
|
@@ -14,9 +14,11 @@ var _chunkT5CERMEHcjs = require('./chunk-T5CERMEH.cjs');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
var _chunk2SDO73HKcjs = require('./chunk-2SDO73HK.cjs');
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
var _chunkNYJMY3JAcjs = require('./chunk-NYJMY3JA.cjs');
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -33,17 +35,17 @@ function createServerQuery(options) {
|
|
|
33
35
|
throw new TypeError("createServerQuery requires a key function");
|
|
34
36
|
}
|
|
35
37
|
const staleTime = normalizeServerQueryStaleTime(options.staleTime);
|
|
36
|
-
const execute =
|
|
38
|
+
const execute = _chunkES4B2IXWcjs.createServerFn.call(void 0, {
|
|
37
39
|
input: options.input,
|
|
38
40
|
middleware: options.middleware,
|
|
39
41
|
handler: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (context) => {
|
|
40
42
|
const routeKey = await options.key(context);
|
|
41
43
|
assertServerQueryKey(routeKey);
|
|
42
|
-
const clientKey =
|
|
43
|
-
const cacheKey =
|
|
44
|
+
const clientKey = _chunkNYJMY3JAcjs.createRouteDataCacheKey.call(void 0, routeKey);
|
|
45
|
+
const cacheKey = _chunkNYJMY3JAcjs.createFarmCacheKey.call(void 0, ["route-data", routeKey]);
|
|
44
46
|
const producer = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
45
47
|
const value = await options.handler(context);
|
|
46
|
-
return
|
|
48
|
+
return _chunkES4B2IXWcjs._parseServerFnSchema.call(void 0, options.output, value, "output", "createServerQuery");
|
|
47
49
|
}, "producer");
|
|
48
50
|
let data;
|
|
49
51
|
let updatedAt;
|
|
@@ -51,9 +53,9 @@ function createServerQuery(options) {
|
|
|
51
53
|
data = await dedupeServerQueryRequest(cacheKey, context.request, producer);
|
|
52
54
|
updatedAt = Date.now();
|
|
53
55
|
} else {
|
|
54
|
-
const cache =
|
|
56
|
+
const cache = _chunk2SDO73HKcjs.getFarmDataCache.call(void 0, );
|
|
55
57
|
data = await cache.getOrSet(cacheKey, producer, {
|
|
56
|
-
tags: [
|
|
58
|
+
tags: [_chunk2SDO73HKcjs.createRouteDataCacheTag.call(void 0, routeKey)],
|
|
57
59
|
revalidate: staleTime === false ? false : staleTime / 1e3
|
|
58
60
|
});
|
|
59
61
|
updatedAt = await _asyncNullishCoalesce(await _asyncOptionalChain([(await cache.getEntryAsync(cacheKey, { allowStale: true })), 'optionalAccess', async _ => _.createdAt]), async () => ( Date.now()));
|
|
@@ -88,10 +90,10 @@ function createServerQuery(options) {
|
|
|
88
90
|
enumerable: false
|
|
89
91
|
}
|
|
90
92
|
});
|
|
91
|
-
|
|
93
|
+
_chunkES4B2IXWcjs._attachServerFunctionDescriptor.call(void 0,
|
|
92
94
|
query,
|
|
93
|
-
|
|
94
|
-
const result = await
|
|
95
|
+
_chunkES4B2IXWcjs.createServerFunctionDescriptor.call(void 0, "query", options, async (value) => {
|
|
96
|
+
const result = await _chunkES4B2IXWcjs._runServerFunctionForCaller.call(void 0,
|
|
95
97
|
execute,
|
|
96
98
|
value
|
|
97
99
|
);
|
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
assertPluginDependencies,
|
|
3
3
|
resolveFarmAuthConfig,
|
|
4
4
|
resolveFarmAuthIntegration,
|
|
5
|
-
resolveFarmDevIndicatorsConfig
|
|
6
|
-
|
|
5
|
+
resolveFarmDevIndicatorsConfig,
|
|
6
|
+
setFarmProjectSourceDir
|
|
7
|
+
} from "./chunk-RSOJ7DRT.mjs";
|
|
7
8
|
import {
|
|
8
9
|
resolveFarmDevtoolsConfig
|
|
9
10
|
} from "./chunk-JBSVKMC5.mjs";
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
resolveFarmNoindexPreviews,
|
|
29
30
|
resolveFarmPerformanceConfig,
|
|
30
31
|
resolveFarmSecurityConfig
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-YMUE7L3D.mjs";
|
|
32
33
|
import {
|
|
33
34
|
resolveFarmImageConfig
|
|
34
35
|
} from "./chunk-G2KY33I6.mjs";
|
|
@@ -47,7 +48,7 @@ import {
|
|
|
47
48
|
} from "./chunk-FA2W42OV.mjs";
|
|
48
49
|
import {
|
|
49
50
|
resolveMarkdownConfig
|
|
50
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-ATXI6LGT.mjs";
|
|
51
52
|
import {
|
|
52
53
|
bundleNodeModule
|
|
53
54
|
} from "./chunk-SFGWNC43.mjs";
|
|
@@ -88,9 +89,6 @@ import {
|
|
|
88
89
|
__name
|
|
89
90
|
} from "./chunk-LPEX4YW6.mjs";
|
|
90
91
|
|
|
91
|
-
// src/config.ts
|
|
92
|
-
import path3 from "path";
|
|
93
|
-
|
|
94
92
|
// src/mcp-config.ts
|
|
95
93
|
import { createRequire } from "module";
|
|
96
94
|
import path from "path";
|
|
@@ -128,13 +126,19 @@ async function resolveFarmMCPPlugin(config, options) {
|
|
|
128
126
|
}
|
|
129
127
|
__name(resolveFarmMCPPlugin, "resolveFarmMCPPlugin");
|
|
130
128
|
|
|
129
|
+
// src/config.ts
|
|
130
|
+
import path3 from "path";
|
|
131
|
+
|
|
131
132
|
// src/agent-config.ts
|
|
132
|
-
|
|
133
|
+
var DEFAULT_JSON_LD = { type: "WebSite" };
|
|
134
|
+
function resolveFarmAgentConfig(input, context = {}) {
|
|
133
135
|
const jsonLd = input?.jsonLd;
|
|
134
136
|
return {
|
|
135
|
-
jsonLd: !jsonLd ? false : jsonLd === true ? {} : jsonLd,
|
|
137
|
+
jsonLd: jsonLd === void 0 ? { ...DEFAULT_JSON_LD } : !jsonLd ? false : jsonLd === true ? {} : jsonLd,
|
|
136
138
|
noindexPreviews: resolveFarmNoindexPreviews(input?.noindexPreviews),
|
|
137
|
-
|
|
139
|
+
// The docs engine answers /llms.txt with its own pages; a default here would replace it.
|
|
140
|
+
// llms-full.txt renders every listed page, so it stays opt-in.
|
|
141
|
+
llmsTxt: resolveFarmLlmsTxtConfig(input?.llmsTxt ?? (context.docs ? false : { full: false })),
|
|
138
142
|
crawlers: resolveFarmAgentCrawlers(input?.crawlers),
|
|
139
143
|
apiCatalog: resolveFarmApiCatalogEnabled(input?.apiCatalog)
|
|
140
144
|
};
|
|
@@ -694,6 +698,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
694
698
|
const deploy = resolveDeployConfig(userConfig);
|
|
695
699
|
const root = userConfig.root || process.cwd();
|
|
696
700
|
const srcDir = userConfig.srcDir || "src";
|
|
701
|
+
setFarmProjectSourceDir(root, srcDir);
|
|
697
702
|
const docs = await resolveDocsConfig(userConfig.docs, { root, srcDir });
|
|
698
703
|
const md = resolveMarkdownConfig(userConfig.md);
|
|
699
704
|
const mdx = resolveMdxConfig(userConfig.mdx);
|
|
@@ -769,7 +774,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
769
774
|
ppr: false,
|
|
770
775
|
...userConfig.experimental
|
|
771
776
|
},
|
|
772
|
-
agent: resolveFarmAgentConfig(userConfig.agent),
|
|
777
|
+
agent: resolveFarmAgentConfig(userConfig.agent, { docs: docs.enabled }),
|
|
773
778
|
plugins: [
|
|
774
779
|
...resolveIntegrationPlugins(integrations),
|
|
775
780
|
...nativeMCPPlugin ? [nativeMCPPlugin] : [],
|
|
@@ -879,6 +884,8 @@ async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "
|
|
|
879
884
|
__name(loadConfig, "loadConfig");
|
|
880
885
|
|
|
881
886
|
export {
|
|
887
|
+
resolveFarmMCPConfig,
|
|
888
|
+
resolveFarmMCPPlugin,
|
|
882
889
|
hasCustomFarmRouteContext,
|
|
883
890
|
isResolvedFarmConfig,
|
|
884
891
|
normalizeDeployTarget,
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
_findFarmMCPEndpointTool
|
|
6
6
|
} from "./chunk-O6XNAMBV.mjs";
|
|
7
|
+
import {
|
|
8
|
+
_withFarmResponseHeaders
|
|
9
|
+
} from "./chunk-Z3HATSKO.mjs";
|
|
7
10
|
import {
|
|
8
11
|
stripFarmBasePath
|
|
9
12
|
} from "./chunk-4RB44K6Z.mjs";
|
|
@@ -14,8 +17,7 @@ import {
|
|
|
14
17
|
// src/markdown-view.ts
|
|
15
18
|
var FENCE = /^\s{0,3}(`{3,}|~{3,})/;
|
|
16
19
|
var ATX_HEADING = /^\s{0,3}(#{1,6})[ \t]+(.+?)[ \t]*#*[ \t]*$/;
|
|
17
|
-
function
|
|
18
|
-
const lines = markdown.split("\n");
|
|
20
|
+
function parseMarkdownHeadingsFromLines(lines) {
|
|
19
21
|
const headings = [];
|
|
20
22
|
const used = /* @__PURE__ */ new Map();
|
|
21
23
|
let index = 0;
|
|
@@ -57,7 +59,7 @@ function parseFarmMarkdownHeadings(markdown) {
|
|
|
57
59
|
}
|
|
58
60
|
return headings;
|
|
59
61
|
}
|
|
60
|
-
__name(
|
|
62
|
+
__name(parseMarkdownHeadingsFromLines, "parseMarkdownHeadingsFromLines");
|
|
61
63
|
function slugifyHeading(text) {
|
|
62
64
|
return text.replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/[`*_~]/g, "").toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu, "").trim().replace(/\s/g, "-");
|
|
63
65
|
}
|
|
@@ -97,7 +99,7 @@ function selectFarmMarkdownView(markdown, searchParams, markdownPath) {
|
|
|
97
99
|
), "withinBudget");
|
|
98
100
|
if (!wantsOutline && sectionId === null) return withinBudget(markdown);
|
|
99
101
|
const lines = markdown.split("\n");
|
|
100
|
-
const headings =
|
|
102
|
+
const headings = parseMarkdownHeadingsFromLines(lines);
|
|
101
103
|
const sectionText = /* @__PURE__ */ __name((heading) => lines.slice(heading.start, heading.end).join("\n").trim(), "sectionText");
|
|
102
104
|
if (sectionId !== null) {
|
|
103
105
|
const heading = headings.find((candidate) => candidate.id === sectionId);
|
|
@@ -116,10 +118,20 @@ ${available}
|
|
|
116
118
|
` : "This page has no sections.\n")
|
|
117
119
|
};
|
|
118
120
|
}
|
|
121
|
+
const offsets = [];
|
|
122
|
+
let offset = 0;
|
|
123
|
+
for (const line of lines) {
|
|
124
|
+
offsets.push(offset);
|
|
125
|
+
offset += line.length + 1;
|
|
126
|
+
}
|
|
119
127
|
const minLevel = headings.reduce((min, heading) => Math.min(min, heading.level), 6);
|
|
120
128
|
const entries = headings.map((heading) => {
|
|
121
129
|
const indent = " ".repeat(heading.level - minLevel);
|
|
122
|
-
|
|
130
|
+
let last = heading.end - 1;
|
|
131
|
+
while (last > heading.start && lines[last].trim().length === 0) last--;
|
|
132
|
+
const first = lines[heading.start];
|
|
133
|
+
const length = offsets[last] + lines[last].trimEnd().length - offsets[heading.start] - (first.length - first.trimStart().length);
|
|
134
|
+
const tokens = Math.ceil(length / 4);
|
|
123
135
|
return `${indent}- [${heading.text}](${viewUrl({ section: heading.id })}) ~${tokens} tokens`;
|
|
124
136
|
});
|
|
125
137
|
return {
|
|
@@ -211,7 +223,9 @@ The page changed after this cursor was issued. Start again at ${partUrl()}.
|
|
|
211
223
|
const part = `${head}${lines.slice(start, end).join("\n").replace(/\n+$/, "")}${open ? `
|
|
212
224
|
${open.closer}` : ""}`;
|
|
213
225
|
const next = partUrl(`${end}.${version}`);
|
|
214
|
-
|
|
226
|
+
let remainingLength = lines.length - end - 1;
|
|
227
|
+
for (let index = end; index < lines.length; index++) remainingLength += lines[index].length;
|
|
228
|
+
const remaining = Math.ceil(remainingLength / 4);
|
|
215
229
|
return {
|
|
216
230
|
status: 200,
|
|
217
231
|
body: `${part}
|
|
@@ -282,8 +296,14 @@ function ifNoneMatchIncludes(header, etag) {
|
|
|
282
296
|
__name(ifNoneMatchIncludes, "ifNoneMatchIncludes");
|
|
283
297
|
function createFarmMarkdownViewResponse(options) {
|
|
284
298
|
const url = options.requestUrl ?? new URL(options.request.url);
|
|
285
|
-
const view = url.searchParams.has("actions") ? selectFarmPageActionsView(options.markdownPath, options.actions ?? [], options.headers) : selectFarmMarkdownView(options.markdown, url.searchParams, options.markdownPath);
|
|
286
|
-
|
|
299
|
+
const view = options.status >= 400 ? { status: options.status, body: options.markdown } : url.searchParams.has("actions") ? selectFarmPageActionsView(options.markdownPath, options.actions ?? [], options.headers) : selectFarmMarkdownView(options.markdown, url.searchParams, options.markdownPath);
|
|
300
|
+
let status = view.status === 200 ? options.status : view.status;
|
|
301
|
+
const ifMatch = options.request.headers.get("if-match");
|
|
302
|
+
const preconditionFailed = status >= 200 && status < 300 && ifMatch !== null && ifMatch.trim() !== "*";
|
|
303
|
+
if (preconditionFailed) {
|
|
304
|
+
status = 412;
|
|
305
|
+
options.headers.set("Cache-Control", "no-store");
|
|
306
|
+
}
|
|
287
307
|
emitFarmAgentRead(options.request, "markdown", status, readMarkdownViewName(url.searchParams));
|
|
288
308
|
for (const [name, value] of Object.entries(view.headers ?? {}))
|
|
289
309
|
options.headers.append(name, value);
|
|
@@ -292,7 +312,7 @@ function createFarmMarkdownViewResponse(options) {
|
|
|
292
312
|
if (status === 200 && ifNoneMatchIncludes(options.request.headers.get("if-none-match"), etag)) {
|
|
293
313
|
return new Response(null, { status: 304, headers: options.headers });
|
|
294
314
|
}
|
|
295
|
-
return new Response(options.request.method === "HEAD" ? null : view.body, {
|
|
315
|
+
return new Response(preconditionFailed || options.request.method === "HEAD" ? null : view.body, {
|
|
296
316
|
status,
|
|
297
317
|
headers: options.headers
|
|
298
318
|
});
|
|
@@ -380,36 +400,61 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
380
400
|
for (const name of FARM_MARKDOWN_VIEW_PARAMS) pageUrl.searchParams.delete(name);
|
|
381
401
|
const headers = new Headers(options.request.headers);
|
|
382
402
|
headers.set("accept", "text/html");
|
|
403
|
+
headers.delete("if-match");
|
|
404
|
+
headers.delete("if-unmodified-since");
|
|
405
|
+
headers.delete("if-none-match");
|
|
406
|
+
headers.delete("if-modified-since");
|
|
407
|
+
headers.delete("range");
|
|
408
|
+
headers.delete("if-range");
|
|
383
409
|
const pageResponse = await options.renderPage(
|
|
384
410
|
new Request(pageUrl, {
|
|
385
411
|
method: "GET",
|
|
386
|
-
headers
|
|
412
|
+
headers,
|
|
413
|
+
signal: options.request.signal
|
|
387
414
|
})
|
|
388
415
|
);
|
|
416
|
+
if (pageResponse.status === 204 || pageResponse.status === 205 || pageResponse.status === 304) {
|
|
417
|
+
return pageResponse;
|
|
418
|
+
}
|
|
389
419
|
const redirects = pageResponse.status >= 300 && pageResponse.status < 400 && pageResponse.headers.has("location");
|
|
390
420
|
if (redirects || !isHtmlResponse(pageResponse)) {
|
|
391
|
-
|
|
421
|
+
const accessResponse = createMarkdownAccessResponse(
|
|
392
422
|
pageResponse,
|
|
393
423
|
target.pathname,
|
|
394
424
|
pageUrl,
|
|
395
425
|
options.request.method === "HEAD"
|
|
396
426
|
);
|
|
427
|
+
if (accessResponse || options.request.method === "HEAD") {
|
|
428
|
+
void pageResponse.body?.cancel().catch(() => {
|
|
429
|
+
});
|
|
430
|
+
return accessResponse ?? new Response(null, {
|
|
431
|
+
status: pageResponse.status,
|
|
432
|
+
statusText: pageResponse.statusText,
|
|
433
|
+
headers: pageResponse.headers
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
return pageResponse;
|
|
397
437
|
}
|
|
398
438
|
const html = await pageResponse.text();
|
|
399
439
|
const markdownPath = target.pathname === "/" ? "/index.md" : `${target.pathname}.md`;
|
|
400
|
-
const
|
|
440
|
+
const region = pageResponse.status < 400 && /<form\b/i.test(html) ? readHtmlContentRegion(html) : void 0;
|
|
441
|
+
const actions = region === void 0 ? [] : extractPageActionsFromRegion(region, pageUrl);
|
|
401
442
|
for (const form of actions) {
|
|
402
443
|
if (!form.action?.startsWith("/")) continue;
|
|
403
444
|
const pathname = new URL(form.action, pageUrl.origin).pathname;
|
|
404
445
|
const tool = _findFarmMCPEndpointTool(form.method, pathname, options.apiServerBasePath) ?? _findFarmMCPEndpointTool(form.method, stripFarmBasePath(pathname), options.apiServerBasePath);
|
|
405
446
|
if (tool) form.tool = tool;
|
|
406
447
|
}
|
|
407
|
-
const markdown =
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
448
|
+
const markdown = pageResponse.status < 400 && requestUrl.searchParams.has("actions") ? "" : convertHtmlToMarkdown(
|
|
449
|
+
html,
|
|
450
|
+
{
|
|
451
|
+
title: target.route?.title,
|
|
452
|
+
includeMetadata: options.config?.includeMetadata ?? true,
|
|
453
|
+
sourcePath: target.pathname,
|
|
454
|
+
actionsPath: actions.length > 0 ? `${markdownPath}?actions` : void 0
|
|
455
|
+
},
|
|
456
|
+
region
|
|
457
|
+
);
|
|
413
458
|
const headersOut = new Headers({
|
|
414
459
|
"Content-Type": "text/markdown; charset=utf-8",
|
|
415
460
|
"Content-Location": markdownPath,
|
|
@@ -428,6 +473,10 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
428
473
|
"Cache-Control",
|
|
429
474
|
pageCacheControl && isPrivateCacheControl(pageCacheControl) ? pageCacheControl : createMarkdownCacheHeader(cache)
|
|
430
475
|
);
|
|
476
|
+
preserveMarkdownResponseCookies(pageResponse.headers, headersOut);
|
|
477
|
+
if (pageResponse.status >= 400) {
|
|
478
|
+
preserveMarkdownResponseControlHeaders(pageResponse.headers, headersOut);
|
|
479
|
+
}
|
|
431
480
|
const robots = [pageResponse.headers.get("x-robots-tag"), readHtmlMetaContent(html, "robots")].filter((value) => Boolean(value?.trim())).join(", ");
|
|
432
481
|
if (robots) headersOut.set("X-Robots-Tag", robots);
|
|
433
482
|
const canonical = readHtmlCanonicalHref(html);
|
|
@@ -457,6 +506,8 @@ function createMarkdownAccessResponse(pageResponse, pathname, pageUrl, head) {
|
|
|
457
506
|
"Cache-Control": "no-store",
|
|
458
507
|
"X-Farm-Markdown-Route": pathname
|
|
459
508
|
});
|
|
509
|
+
preserveMarkdownResponseCookies(pageResponse.headers, headers);
|
|
510
|
+
preserveMarkdownResponseControlHeaders(pageResponse.headers, headers);
|
|
460
511
|
let body;
|
|
461
512
|
if (redirect) {
|
|
462
513
|
let target;
|
|
@@ -471,8 +522,6 @@ function createMarkdownAccessResponse(pageResponse, pathname, pageUrl, head) {
|
|
|
471
522
|
\`${pathname}\` redirects to [${target}](${target}). The page may require signing in.
|
|
472
523
|
`;
|
|
473
524
|
} else {
|
|
474
|
-
const authenticate = pageResponse.headers.get("www-authenticate");
|
|
475
|
-
if (authenticate) headers.set("WWW-Authenticate", authenticate);
|
|
476
525
|
body = pageResponse.status === 401 ? `# Sign-in required
|
|
477
526
|
|
|
478
527
|
\`${pathname}\` requires signing in.
|
|
@@ -484,6 +533,21 @@ This account cannot read \`${pathname}\`.
|
|
|
484
533
|
return new Response(head ? null : body, { status: pageResponse.status, headers });
|
|
485
534
|
}
|
|
486
535
|
__name(createMarkdownAccessResponse, "createMarkdownAccessResponse");
|
|
536
|
+
function preserveMarkdownResponseControlHeaders(source, target) {
|
|
537
|
+
for (const name of ["WWW-Authenticate", "Proxy-Authenticate", "Retry-After", "Allow"]) {
|
|
538
|
+
const value = source.get(name);
|
|
539
|
+
if (value !== null) target.set(name, value);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
__name(preserveMarkdownResponseControlHeaders, "preserveMarkdownResponseControlHeaders");
|
|
543
|
+
function preserveMarkdownResponseCookies(source, target) {
|
|
544
|
+
const getSetCookie = source.getSetCookie;
|
|
545
|
+
const cookies = typeof getSetCookie === "function" ? getSetCookie.call(source) : source.has("set-cookie") ? [source.get("set-cookie")] : [];
|
|
546
|
+
if (cookies.length === 0) return;
|
|
547
|
+
for (const cookie of cookies) target.append("Set-Cookie", cookie);
|
|
548
|
+
target.set("Cache-Control", "private, no-store");
|
|
549
|
+
}
|
|
550
|
+
__name(preserveMarkdownResponseCookies, "preserveMarkdownResponseCookies");
|
|
487
551
|
function applyMarkdownNegotiationHeaders(response, options) {
|
|
488
552
|
if (!isHtmlResponse(response)) {
|
|
489
553
|
return response;
|
|
@@ -492,13 +556,9 @@ function applyMarkdownNegotiationHeaders(response, options) {
|
|
|
492
556
|
if (!alternatePath) {
|
|
493
557
|
return response;
|
|
494
558
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
return new Response(response.body, {
|
|
499
|
-
status: response.status,
|
|
500
|
-
statusText: response.statusText,
|
|
501
|
-
headers
|
|
559
|
+
return _withFarmResponseHeaders(response, (headers) => {
|
|
560
|
+
appendHeaderToken(headers, "Vary", "Accept");
|
|
561
|
+
headers.append("Link", `<${alternatePath}>; rel="alternate"; type="text/markdown"`);
|
|
502
562
|
});
|
|
503
563
|
}
|
|
504
564
|
__name(applyMarkdownNegotiationHeaders, "applyMarkdownNegotiationHeaders");
|
|
@@ -506,9 +566,61 @@ var CODE_BLOCK_MARK = "\0";
|
|
|
506
566
|
var CODE_BLOCK_PLACEHOLDER = /\u0000(\d+)\u0000/g;
|
|
507
567
|
var BLOCK_TAGS = /<\/?(ul|ol|main|section|article|header|footer|nav|aside|div|form|fieldset|legend|figure|figcaption|table|thead|tbody|tfoot|tr|dl|dt|dd|details|summary|address)\b[^>]*>/gi;
|
|
508
568
|
var BOX_TAGS = /<\/?(label|button|input|select|textarea|option|output|meter|progress|td|th)\b[^>]*>/gi;
|
|
569
|
+
var LAYOUT_ROW = /<(div|nav|section|header|footer|aside|main|article|figure|figcaption|dt|dd)\b([^>]*)>((?:(?!<\/?(?:div|nav|section|header|footer|aside|main|article|figure|figcaption|dt|dd|p|h[1-6]|ul|ol|li|table|pre|blockquote)\b)[\s\S])*?)<\/\1>/gi;
|
|
570
|
+
var HTML_TOKEN = /<\/?([a-zA-Z][\w:-]*)\b[^>]*?(\/?)>|[^<]+/g;
|
|
571
|
+
function separateLayoutRowItems(source) {
|
|
572
|
+
return source.replace(
|
|
573
|
+
LAYOUT_ROW,
|
|
574
|
+
(container, tag, attributes, content) => {
|
|
575
|
+
const boundaries = [];
|
|
576
|
+
const items = [];
|
|
577
|
+
let depth = 0;
|
|
578
|
+
let previousEnd = -1;
|
|
579
|
+
let item = "";
|
|
580
|
+
for (const match of content.matchAll(HTML_TOKEN)) {
|
|
581
|
+
const [token, name, selfClosing] = match;
|
|
582
|
+
const index = match.index ?? 0;
|
|
583
|
+
if (name === void 0) {
|
|
584
|
+
if (depth === 0) {
|
|
585
|
+
if (token.trim()) return container;
|
|
586
|
+
previousEnd = -1;
|
|
587
|
+
} else {
|
|
588
|
+
item += token;
|
|
589
|
+
}
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
const closing = token.startsWith("</");
|
|
593
|
+
const isVoid = selfClosing === "/" || VOID_TAGS.has(name.toLowerCase());
|
|
594
|
+
if (closing) {
|
|
595
|
+
depth = Math.max(0, depth - 1);
|
|
596
|
+
} else {
|
|
597
|
+
if (depth === 0 && previousEnd === index) boundaries.push(index);
|
|
598
|
+
if (!isVoid) depth += 1;
|
|
599
|
+
}
|
|
600
|
+
if (depth === 0) {
|
|
601
|
+
previousEnd = index + token.length;
|
|
602
|
+
items.push(decodeHtml(item).trim());
|
|
603
|
+
item = "";
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (boundaries.length === 0) return container;
|
|
607
|
+
if (items.filter(Boolean).every((text) => text.length === 1)) return container;
|
|
608
|
+
let separated = content;
|
|
609
|
+
for (const boundary of boundaries.reverse()) {
|
|
610
|
+
separated = `${separated.slice(0, boundary)} ${separated.slice(boundary)}`;
|
|
611
|
+
}
|
|
612
|
+
return `<${tag}${attributes}>${separated}</${tag}>`;
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
__name(separateLayoutRowItems, "separateLayoutRowItems");
|
|
509
617
|
function htmlToMarkdown(html, options = {}) {
|
|
618
|
+
return convertHtmlToMarkdown(html, options);
|
|
619
|
+
}
|
|
620
|
+
__name(htmlToMarkdown, "htmlToMarkdown");
|
|
621
|
+
function convertHtmlToMarkdown(html, options, region) {
|
|
510
622
|
const title = options.title ?? extractHtmlTitle(html);
|
|
511
|
-
let source = readHtmlContentRegion(html);
|
|
623
|
+
let source = region ?? readHtmlContentRegion(html);
|
|
512
624
|
const codeBlocks = [];
|
|
513
625
|
const setAsideCodeBlock = /* @__PURE__ */ __name((code, attributes) => {
|
|
514
626
|
const content = decodeHtml(stripTags(code)).trim();
|
|
@@ -549,6 +661,7 @@ ${CODE_BLOCK_MARK}${codeBlocks.length - 1}${CODE_BLOCK_MARK}
|
|
|
549
661
|
`;
|
|
550
662
|
}
|
|
551
663
|
);
|
|
664
|
+
source = separateLayoutRowItems(source);
|
|
552
665
|
source = source.replace(/<h([1-6])\b[^>]*>([\s\S]*?)<\/h\1>/gi, (_, level, content) => {
|
|
553
666
|
return `
|
|
554
667
|
|
|
@@ -619,7 +732,7 @@ ${markdown}` : ""}`;
|
|
|
619
732
|
return `${markdown}
|
|
620
733
|
`;
|
|
621
734
|
}
|
|
622
|
-
__name(
|
|
735
|
+
__name(convertHtmlToMarkdown, "convertHtmlToMarkdown");
|
|
623
736
|
function normalizeMarkdownRouteInput(input) {
|
|
624
737
|
if (typeof input === "string") {
|
|
625
738
|
return {
|
|
@@ -816,7 +929,10 @@ var FORM_ENCTYPES = /* @__PURE__ */ new Set([
|
|
|
816
929
|
]);
|
|
817
930
|
function extractFarmPageActions(html, pageUrl) {
|
|
818
931
|
if (!/<form\b/i.test(html)) return [];
|
|
819
|
-
|
|
932
|
+
return extractPageActionsFromRegion(readHtmlContentRegion(html), pageUrl);
|
|
933
|
+
}
|
|
934
|
+
__name(extractFarmPageActions, "extractFarmPageActions");
|
|
935
|
+
function extractPageActionsFromRegion(region, pageUrl) {
|
|
820
936
|
const labelsFor = /* @__PURE__ */ new Map();
|
|
821
937
|
for (const match of region.matchAll(/<label\b([^>]*)>([\s\S]*?)<\/label>/gi)) {
|
|
822
938
|
const target = readDecodedAttribute(match[1], "for");
|
|
@@ -829,7 +945,7 @@ function extractFarmPageActions(html, pageUrl) {
|
|
|
829
945
|
}
|
|
830
946
|
return actions;
|
|
831
947
|
}
|
|
832
|
-
__name(
|
|
948
|
+
__name(extractPageActionsFromRegion, "extractPageActionsFromRegion");
|
|
833
949
|
function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
834
950
|
const method = readDecodedAttribute(attributes, "method")?.trim().toLowerCase();
|
|
835
951
|
if (method === "dialog") return void 0;
|
|
@@ -1064,6 +1180,7 @@ var VOID_TAGS = /* @__PURE__ */ new Set([
|
|
|
1064
1180
|
"wbr"
|
|
1065
1181
|
]);
|
|
1066
1182
|
function removeHiddenElements(html) {
|
|
1183
|
+
if (!/hidden/i.test(html)) return html;
|
|
1067
1184
|
const openingTag = /<([a-zA-Z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g;
|
|
1068
1185
|
let closingTags;
|
|
1069
1186
|
let result = "";
|
|
@@ -7,7 +7,7 @@ var _chunkLTNGXMQ6cjs = require('./chunk-LTNGXMQ6.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk63H6BKXGcjs = require('./chunk-63H6BKXG.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkJ7FSKED3cjs = require('./chunk-J7FSKED3.cjs');
|
|
@@ -1148,7 +1148,7 @@ function createApiClients(options = {}) {
|
|
|
1148
1148
|
{
|
|
1149
1149
|
headers,
|
|
1150
1150
|
signal: currentRequest.signal,
|
|
1151
|
-
cache: new (0,
|
|
1151
|
+
cache: new (0, _chunk63H6BKXGcjs.FarmClientDataCache)({ subscribeToInvalidation: false }),
|
|
1152
1152
|
routeMeta,
|
|
1153
1153
|
fetch: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (url, init) => {
|
|
1154
1154
|
if (new URL(url).origin !== origin) {
|
|
@@ -1211,7 +1211,7 @@ function createAPIClientRuntime(options = {}, transport) {
|
|
|
1211
1211
|
const rootAliases = integrationOptions === false ? void 0 : {
|
|
1212
1212
|
integrations: integrationsClient(integrationOptions)
|
|
1213
1213
|
};
|
|
1214
|
-
const sharedCacheState = _nullishCoalesce(_optionalChain([transport, 'optionalAccess', _46 => _46.cache]), () => (
|
|
1214
|
+
const sharedCacheState = _nullishCoalesce(_optionalChain([transport, 'optionalAccess', _46 => _46.cache]), () => ( _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, )));
|
|
1215
1215
|
const localCaches = transport ? /* @__PURE__ */ new Set([sharedCacheState]) : void 0;
|
|
1216
1216
|
const sharedInflightState = /* @__PURE__ */ new Map();
|
|
1217
1217
|
let scopedRequestState;
|
|
@@ -1309,7 +1309,7 @@ function createAPIClientRuntime(options = {}, transport) {
|
|
|
1309
1309
|
...clientOptions.cache
|
|
1310
1310
|
} : void 0;
|
|
1311
1311
|
const configuredCacheKey = _nullishCoalesce(_optionalChain([clientOptions, 'optionalAccess', _65 => _65.key]), () => ( _optionalChain([cacheOptions, 'optionalAccess', _66 => _66.key])));
|
|
1312
|
-
const cacheKey =
|
|
1312
|
+
const cacheKey = _chunk63H6BKXGcjs.normalizeFarmClientCacheKey.call(void 0,
|
|
1313
1313
|
_nullishCoalesce(configuredCacheKey, () => ( buildCacheKey(methodUpper, path, input, baseURL, defaultHeaders)))
|
|
1314
1314
|
);
|
|
1315
1315
|
const now = Date.now();
|
|
@@ -1360,7 +1360,7 @@ function createAPIClientRuntime(options = {}, transport) {
|
|
|
1360
1360
|
}
|
|
1361
1361
|
_nullishCoalesce(scopedRequestState, () => ( (scopedRequestState = {
|
|
1362
1362
|
context: requestCacheContext,
|
|
1363
|
-
cache: new (0,
|
|
1363
|
+
cache: new (0, _chunk63H6BKXGcjs.FarmClientDataCache)({ subscribeToInvalidation: !transport }),
|
|
1364
1364
|
inflight: /* @__PURE__ */ new Map(),
|
|
1365
1365
|
retired: false
|
|
1366
1366
|
})));
|
|
@@ -2045,14 +2045,14 @@ function settleOptimisticUpdates(cacheState, optimisticState, snapshots, outcome
|
|
|
2045
2045
|
}
|
|
2046
2046
|
_chunkS3JO3N4Hcjs.__name.call(void 0, settleOptimisticUpdates, "settleOptimisticUpdates");
|
|
2047
2047
|
function applyServerFnOptimisticUpdates(updates, now = Date.now()) {
|
|
2048
|
-
const cacheState =
|
|
2048
|
+
const cacheState = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, );
|
|
2049
2049
|
const optimisticState = getOptimisticState(cacheState);
|
|
2050
2050
|
const snapshots = /* @__PURE__ */ new Map();
|
|
2051
2051
|
for (const update of updates) {
|
|
2052
2052
|
if (update.length !== 2) continue;
|
|
2053
2053
|
const [target, updater] = update;
|
|
2054
2054
|
if (typeof updater !== "function") continue;
|
|
2055
|
-
const targetKey = typeof target === "string" || Array.isArray(target) ?
|
|
2055
|
+
const targetKey = typeof target === "string" || Array.isArray(target) ? _chunk63H6BKXGcjs.normalizeFarmClientCacheKey.call(void 0, target) : null;
|
|
2056
2056
|
if (!targetKey) continue;
|
|
2057
2057
|
const targetEntry = getValidCacheEntry(cacheState, targetKey, now);
|
|
2058
2058
|
const currentEntry = cacheState.get(targetKey);
|
|
@@ -2102,7 +2102,7 @@ function applyServerFnOptimisticUpdates(updates, now = Date.now()) {
|
|
|
2102
2102
|
_chunkS3JO3N4Hcjs.__name.call(void 0, applyServerFnOptimisticUpdates, "applyServerFnOptimisticUpdates");
|
|
2103
2103
|
function settleServerFnOptimisticUpdates(snapshots, outcome) {
|
|
2104
2104
|
if (snapshots.length === 0) return;
|
|
2105
|
-
const cacheState =
|
|
2105
|
+
const cacheState = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, );
|
|
2106
2106
|
settleOptimisticUpdates(cacheState, getOptimisticState(cacheState), snapshots, outcome);
|
|
2107
2107
|
}
|
|
2108
2108
|
_chunkS3JO3N4Hcjs.__name.call(void 0, settleServerFnOptimisticUpdates, "settleServerFnOptimisticUpdates");
|
|
@@ -2112,9 +2112,9 @@ function resolveServerFnInvalidateTargets(invalidate) {
|
|
|
2112
2112
|
for (const target of targets) {
|
|
2113
2113
|
if (typeof target === "string" || Array.isArray(target)) {
|
|
2114
2114
|
if (Array.isArray(target) && typeof target[0] === "function") continue;
|
|
2115
|
-
keys.push(
|
|
2115
|
+
keys.push(_chunk63H6BKXGcjs.normalizeFarmClientCacheKey.call(void 0, target));
|
|
2116
2116
|
} else if (target && typeof target === "object" && "key" in target) {
|
|
2117
|
-
keys.push(
|
|
2117
|
+
keys.push(_chunk63H6BKXGcjs.normalizeFarmClientCacheKey.call(void 0, target.key));
|
|
2118
2118
|
}
|
|
2119
2119
|
}
|
|
2120
2120
|
return keys;
|
|
@@ -2219,9 +2219,9 @@ function resolveTargetKey(routeMeta, target, input, baseURL = "http://localhost:
|
|
|
2219
2219
|
if (typeof route === "function") {
|
|
2220
2220
|
return resolveTargetKey(routeMeta, route, routeInput, baseURL, defaultHeaders, localBaseURL);
|
|
2221
2221
|
}
|
|
2222
|
-
return
|
|
2222
|
+
return _chunk63H6BKXGcjs.normalizeFarmClientCacheKey.call(void 0, target);
|
|
2223
2223
|
}
|
|
2224
|
-
if ("key" in target) return
|
|
2224
|
+
if ("key" in target) return _chunk63H6BKXGcjs.normalizeFarmClientCacheKey.call(void 0, target.key);
|
|
2225
2225
|
if ("path" in target) {
|
|
2226
2226
|
const method = _nullishCoalesce(target.method, () => ( "GET"));
|
|
2227
2227
|
return buildCacheKey(method, target.path, _nullishCoalesce(target.input, () => ( {})), baseURL, defaultHeaders);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findProgrammaticRouteFilesInDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LNZ7JZUS.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isFarmAPIRouteFileName
|
|
6
6
|
} from "./chunk-CU625VAY.mjs";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
matchAPIRouteAtBasePath,
|
|
18
18
|
mergePluginAPIRoutes,
|
|
19
19
|
resolveAPIRouteEndpoint
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-X7WVQMIB.mjs";
|
|
21
21
|
import {
|
|
22
22
|
registerAPIRouteShape
|
|
23
23
|
} from "./chunk-W3B4PKAW.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNXG66MR7cjs = require('./chunk-NXG66MR7.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -11,7 +11,7 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
|
11
11
|
var _url = require('url');
|
|
12
12
|
async function createFarmMarkdownRouteModuleFromFile(filePath, options = {}) {
|
|
13
13
|
const source = await _promises.readFile.call(void 0, filePath, "utf8");
|
|
14
|
-
return
|
|
14
|
+
return _chunkNXG66MR7cjs.createFarmMarkdownRouteModule.call(void 0, {
|
|
15
15
|
source,
|
|
16
16
|
filePath,
|
|
17
17
|
components: options.components,
|