@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
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/cache-key.ts
|
|
6
|
+
function createRouteDataCacheKey(key) {
|
|
7
|
+
return createFarmCacheKey(Array.isArray(key) ? key : [key]);
|
|
8
|
+
}
|
|
9
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createRouteDataCacheKey, "createRouteDataCacheKey");
|
|
10
|
+
function createFarmCacheKey(parts) {
|
|
11
|
+
return stableSerialize(parts);
|
|
12
|
+
}
|
|
13
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmCacheKey, "createFarmCacheKey");
|
|
14
|
+
function getFunctionCacheIdentity(fn) {
|
|
15
|
+
const name = fn.name || "anonymous";
|
|
16
|
+
return `${name}:${hashFunctionSource(String(fn))}`;
|
|
17
|
+
}
|
|
18
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getFunctionCacheIdentity, "getFunctionCacheIdentity");
|
|
19
|
+
function hashFunctionSource(source) {
|
|
20
|
+
let hash = 2166136261;
|
|
21
|
+
for (let index = 0; index < source.length; index++) {
|
|
22
|
+
hash ^= source.charCodeAt(index);
|
|
23
|
+
hash = Math.imul(hash, 16777619);
|
|
24
|
+
}
|
|
25
|
+
return (hash >>> 0).toString(36);
|
|
26
|
+
}
|
|
27
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, hashFunctionSource, "hashFunctionSource");
|
|
28
|
+
function compareCodepoint(a, b) {
|
|
29
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
30
|
+
}
|
|
31
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, compareCodepoint, "compareCodepoint");
|
|
32
|
+
function serializeBinaryBytes(bytes) {
|
|
33
|
+
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
34
|
+
}
|
|
35
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, serializeBinaryBytes, "serializeBinaryBytes");
|
|
36
|
+
function serializeCanonicalStringEntries(entries, seen) {
|
|
37
|
+
const valuesByKey = /* @__PURE__ */ new Map();
|
|
38
|
+
for (const [key, item] of entries) {
|
|
39
|
+
const values = valuesByKey.get(key);
|
|
40
|
+
if (values) values.push(item);
|
|
41
|
+
else valuesByKey.set(key, [item]);
|
|
42
|
+
}
|
|
43
|
+
return Array.from(valuesByKey.keys()).sort(compareCodepoint).flatMap(
|
|
44
|
+
(key) => valuesByKey.get(key).map((item) => `[${stableSerialize(key, seen)},${stableSerialize(item, seen)}]`)
|
|
45
|
+
).join(",");
|
|
46
|
+
}
|
|
47
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, serializeCanonicalStringEntries, "serializeCanonicalStringEntries");
|
|
48
|
+
function isPlainCacheKeyObject(value) {
|
|
49
|
+
const prototype = Object.getPrototypeOf(value);
|
|
50
|
+
if (prototype === null) return true;
|
|
51
|
+
const constructor = _optionalChain([Object, 'access', _ => _.getOwnPropertyDescriptor, 'call', _2 => _2(prototype, "constructor"), 'optionalAccess', _3 => _3.value]);
|
|
52
|
+
return Object.getPrototypeOf(prototype) === null && typeof constructor === "function" && constructor.name === "Object";
|
|
53
|
+
}
|
|
54
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isPlainCacheKeyObject, "isPlainCacheKeyObject");
|
|
55
|
+
function getCacheKeyValueType(value) {
|
|
56
|
+
const prototype = Object.getPrototypeOf(value);
|
|
57
|
+
const constructor = prototype ? _optionalChain([Object, 'access', _4 => _4.getOwnPropertyDescriptor, 'call', _5 => _5(prototype, "constructor"), 'optionalAccess', _6 => _6.value]) : void 0;
|
|
58
|
+
if (typeof constructor === "function" && constructor.name) {
|
|
59
|
+
return constructor.name;
|
|
60
|
+
}
|
|
61
|
+
return Object.prototype.toString.call(value).slice(8, -1) || "object";
|
|
62
|
+
}
|
|
63
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getCacheKeyValueType, "getCacheKeyValueType");
|
|
64
|
+
function stableSerialize(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
65
|
+
if (value === null) return "null";
|
|
66
|
+
if (value === void 0) return "undefined";
|
|
67
|
+
const valueType = typeof value;
|
|
68
|
+
if (valueType === "string") return JSON.stringify(value);
|
|
69
|
+
if (valueType === "number" || valueType === "boolean" || valueType === "bigint") {
|
|
70
|
+
return `${valueType}:${String(value)}`;
|
|
71
|
+
}
|
|
72
|
+
if (valueType === "symbol") {
|
|
73
|
+
return `symbol:${String(value)}`;
|
|
74
|
+
}
|
|
75
|
+
if (valueType === "function") {
|
|
76
|
+
return `function:${getFunctionCacheIdentity(value)}`;
|
|
77
|
+
}
|
|
78
|
+
if (value instanceof Date) {
|
|
79
|
+
return Number.isNaN(value.getTime()) ? "date:invalid" : `date:${value.toISOString()}`;
|
|
80
|
+
}
|
|
81
|
+
if (value instanceof URL) {
|
|
82
|
+
return `url:${value.toString()}`;
|
|
83
|
+
}
|
|
84
|
+
if (value instanceof RegExp) {
|
|
85
|
+
return `regexp:${value.toString()}`;
|
|
86
|
+
}
|
|
87
|
+
if (value instanceof ArrayBuffer) {
|
|
88
|
+
return `arraybuffer:${serializeBinaryBytes(new Uint8Array(value))}`;
|
|
89
|
+
}
|
|
90
|
+
if (typeof SharedArrayBuffer !== "undefined" && value instanceof SharedArrayBuffer) {
|
|
91
|
+
return `sharedarraybuffer:${serializeBinaryBytes(new Uint8Array(value))}`;
|
|
92
|
+
}
|
|
93
|
+
if (ArrayBuffer.isView(value)) {
|
|
94
|
+
const viewType = Object.prototype.toString.call(value).slice(8, -1);
|
|
95
|
+
const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
96
|
+
return `binary:${viewType}:${serializeBinaryBytes(bytes)}`;
|
|
97
|
+
}
|
|
98
|
+
if (value && typeof value === "object") {
|
|
99
|
+
if (seen.has(value)) {
|
|
100
|
+
return "[Circular]";
|
|
101
|
+
}
|
|
102
|
+
seen.add(value);
|
|
103
|
+
if (Array.isArray(value)) {
|
|
104
|
+
const items = [];
|
|
105
|
+
for (let index = 0; index < value.length; index++) {
|
|
106
|
+
items.push(
|
|
107
|
+
Object.prototype.hasOwnProperty.call(value, index) ? stableSerialize(value[index], seen) : "[Hole]"
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
seen.delete(value);
|
|
111
|
+
return `[${items.join(",")}]`;
|
|
112
|
+
}
|
|
113
|
+
if (value instanceof Set) {
|
|
114
|
+
const items = Array.from(value, (item) => stableSerialize(item, seen)).sort(compareCodepoint);
|
|
115
|
+
seen.delete(value);
|
|
116
|
+
return `set:[${items.join(",")}]`;
|
|
117
|
+
}
|
|
118
|
+
if (value instanceof Map) {
|
|
119
|
+
const items = Array.from(
|
|
120
|
+
value,
|
|
121
|
+
([key, item]) => `[${stableSerialize(key, seen)},${stableSerialize(item, seen)}]`
|
|
122
|
+
).sort(compareCodepoint);
|
|
123
|
+
seen.delete(value);
|
|
124
|
+
return `map:[${items.join(",")}]`;
|
|
125
|
+
}
|
|
126
|
+
if (value instanceof URLSearchParams) {
|
|
127
|
+
const serialized2 = serializeCanonicalStringEntries(value, seen);
|
|
128
|
+
seen.delete(value);
|
|
129
|
+
return `urlsearchparams:[${serialized2}]`;
|
|
130
|
+
}
|
|
131
|
+
if (value instanceof Headers) {
|
|
132
|
+
const serialized2 = serializeCanonicalStringEntries(value, seen);
|
|
133
|
+
seen.delete(value);
|
|
134
|
+
return `headers:[${serialized2}]`;
|
|
135
|
+
}
|
|
136
|
+
if (!isPlainCacheKeyObject(value)) {
|
|
137
|
+
throw new TypeError(
|
|
138
|
+
`Cache keys do not support ${getCacheKeyValueType(value)} values. Convert the value to an explicit stable string or structured key before caching.`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
const entries = Object.entries(value).sort(
|
|
142
|
+
([a], [b]) => compareCodepoint(a, b)
|
|
143
|
+
);
|
|
144
|
+
const serialized = entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item, seen)}`).join(",");
|
|
145
|
+
seen.delete(value);
|
|
146
|
+
return `{${serialized}}`;
|
|
147
|
+
}
|
|
148
|
+
return String(value);
|
|
149
|
+
}
|
|
150
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, stableSerialize, "stableSerialize");
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
exports.createRouteDataCacheKey = createRouteDataCacheKey; exports.createFarmCacheKey = createFarmCacheKey; exports.getFunctionCacheIdentity = getFunctionCacheIdentity;
|
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
} from "./chunk-DAATZTKJ.mjs";
|
|
27
27
|
import {
|
|
28
28
|
discoverProgrammaticRoutePaths
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LNZ7JZUS.mjs";
|
|
30
30
|
import {
|
|
31
31
|
readFarmI18nCatalogs
|
|
32
32
|
} from "./chunk-FV45CKBC.mjs";
|
|
33
33
|
import {
|
|
34
34
|
resolvePluginRoutes
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-4IEPYMHF.mjs";
|
|
36
36
|
import {
|
|
37
37
|
parseRoutePath
|
|
38
38
|
} from "./chunk-KI3MESHB.mjs";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
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
2
|
|
|
3
|
+
var _chunkFJ3M4CUXcjs = require('./chunk-FJ3M4CUX.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
7
|
|
|
5
8
|
// src/plugins/compression.ts
|
|
@@ -57,8 +60,12 @@ function isCompressibleMediaType(mediaType) {
|
|
|
57
60
|
return COMPRESSIBLE_MEDIA_TYPE_SUFFIXES.some((suffix) => mediaType.endsWith(suffix));
|
|
58
61
|
}
|
|
59
62
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isCompressibleMediaType, "isCompressibleMediaType");
|
|
60
|
-
function isCompressionEligible(request, response) {
|
|
61
|
-
if (
|
|
63
|
+
function isCompressionEligible(request, response, bufferedText) {
|
|
64
|
+
if (
|
|
65
|
+
// Known buffered text proves a body without reading response.body, which
|
|
66
|
+
// would create a lazy response's Web stream.
|
|
67
|
+
request.method !== "HEAD" && bufferedText === void 0 && !response.body || response.status === 204 || response.status === 205 || response.status === 304 || response.headers.has("content-encoding") || response.headers.has("content-range") || _optionalChain([response, 'access', _11 => _11.headers, 'access', _12 => _12.get, 'call', _13 => _13("cache-control"), 'optionalAccess', _14 => _14.toLowerCase, 'call', _15 => _15(), 'access', _16 => _16.includes, 'call', _17 => _17("no-transform")])
|
|
68
|
+
) {
|
|
62
69
|
return false;
|
|
63
70
|
}
|
|
64
71
|
const mediaType = _optionalChain([response, 'access', _18 => _18.headers, 'access', _19 => _19.get, 'call', _20 => _20("content-type"), 'optionalAccess', _21 => _21.split, 'call', _22 => _22(";", 1), 'access', _23 => _23[0], 'optionalAccess', _24 => _24.trim, 'call', _25 => _25(), 'access', _26 => _26.toLowerCase, 'call', _27 => _27()]);
|
|
@@ -88,9 +95,9 @@ function compressedHeaders(response, encoding) {
|
|
|
88
95
|
return headers;
|
|
89
96
|
}
|
|
90
97
|
_chunkS3JO3N4Hcjs.__name.call(void 0, compressedHeaders, "compressedHeaders");
|
|
91
|
-
function compressBufferedResponse(response, text, encoding) {
|
|
98
|
+
function compressBufferedResponse(response, text, encoding, lazyBody) {
|
|
92
99
|
const headers = compressedHeaders(response, encoding);
|
|
93
|
-
_optionalChain([response, 'access', _28 => _28.body, 'optionalAccess', _29 => _29.cancel, 'call', _30 => _30(), 'access', _31 => _31.catch, 'call', _32 => _32(() => {
|
|
100
|
+
if (!lazyBody) _optionalChain([response, 'access', _28 => _28.body, 'optionalAccess', _29 => _29.cancel, 'call', _30 => _30(), 'access', _31 => _31.catch, 'call', _32 => _32(() => {
|
|
94
101
|
})]);
|
|
95
102
|
const input = Buffer.from(text);
|
|
96
103
|
let cancelled = false;
|
|
@@ -143,21 +150,15 @@ function compressResponse(response, encoding) {
|
|
|
143
150
|
}
|
|
144
151
|
_chunkS3JO3N4Hcjs.__name.call(void 0, compressResponse, "compressResponse");
|
|
145
152
|
function varyIdentityResponse(response) {
|
|
146
|
-
|
|
147
|
-
appendVary(headers, "Accept-Encoding");
|
|
148
|
-
return new Response(response.body, {
|
|
149
|
-
status: response.status,
|
|
150
|
-
statusText: response.statusText,
|
|
151
|
-
headers
|
|
152
|
-
});
|
|
153
|
+
return _chunkFJ3M4CUXcjs._withFarmResponseHeaders.call(void 0, response, (headers) => appendVary(headers, "Accept-Encoding"));
|
|
153
154
|
}
|
|
154
155
|
_chunkS3JO3N4Hcjs.__name.call(void 0, varyIdentityResponse, "varyIdentityResponse");
|
|
155
|
-
function compressFarmResponse(request, response, bufferedText) {
|
|
156
|
-
if (!isCompressionEligible(request, response)) return response;
|
|
156
|
+
function compressFarmResponse(request, response, bufferedText, lazyBody = false) {
|
|
157
|
+
if (!isCompressionEligible(request, response, bufferedText)) return response;
|
|
157
158
|
if (request.method === "HEAD") return varyIdentityResponse(response);
|
|
158
159
|
const encoding = selectEncoding(_nullishCoalesce(request.headers.get("accept-encoding"), () => ( "")));
|
|
159
160
|
if (!encoding) return varyIdentityResponse(response);
|
|
160
|
-
return bufferedText === void 0 ? compressResponse(response, encoding) : compressBufferedResponse(response, bufferedText, encoding);
|
|
161
|
+
return bufferedText === void 0 ? compressResponse(response, encoding) : compressBufferedResponse(response, bufferedText, encoding, lazyBody);
|
|
161
162
|
}
|
|
162
163
|
_chunkS3JO3N4Hcjs.__name.call(void 0, compressFarmResponse, "compressFarmResponse");
|
|
163
164
|
function createCompressionPlugin({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkVHJGDMCGcjs = require('./chunk-VHJGDMCG.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkWMAPPDMMcjs = require('./chunk-WMAPPDMM.cjs');
|
|
@@ -64,7 +64,7 @@ function mergePluginAPIRoutes(existing, plugins, expected, options = {}) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
const api = createPluginLocalAPI(existing, options.bodySizeLimit);
|
|
67
|
-
for (const definition of
|
|
67
|
+
for (const definition of _chunkVHJGDMCGcjs.resolvePluginRoutes.call(void 0, plugins, { api })) {
|
|
68
68
|
_chunkWMAPPDMMcjs.registerAPIRouteShape.call(void 0, shapes, definition.path, `plugin:${definition.path}`, "app");
|
|
69
69
|
let route = routes.get(definition.path);
|
|
70
70
|
if (_optionalChain([route, 'optionalAccess', _ => _.methods, 'access', _2 => _2.includes, 'call', _3 => _3(definition.method)])) {
|
|
@@ -256,7 +256,7 @@ async function invokeAPIRouteEndpointInContext(endpoint, request, params) {
|
|
|
256
256
|
invalidations: []
|
|
257
257
|
};
|
|
258
258
|
} catch (error) {
|
|
259
|
-
if (
|
|
259
|
+
if (_chunkVHJGDMCGcjs.isEndpointFailure.call(void 0, error)) {
|
|
260
260
|
return createEndpointFailureResponse(error);
|
|
261
261
|
}
|
|
262
262
|
throw error;
|
|
@@ -15,7 +15,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
15
15
|
var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk6CNX6Q3Kcjs = require('./chunk-6CNX6Q3K.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
|
|
@@ -1181,11 +1181,11 @@ function shouldReturnMarkdown(request) {
|
|
|
1181
1181
|
if (url.pathname.endsWith(".md")) return true;
|
|
1182
1182
|
const accept = request.headers.get("accept");
|
|
1183
1183
|
const markdown = Math.max(
|
|
1184
|
-
|
|
1185
|
-
|
|
1184
|
+
_chunk6CNX6Q3Kcjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
|
|
1185
|
+
_chunk6CNX6Q3Kcjs.farmAcceptQuality.call(void 0, accept, "text/plain")
|
|
1186
1186
|
);
|
|
1187
1187
|
if (markdown <= 0) return false;
|
|
1188
|
-
return markdown >=
|
|
1188
|
+
return markdown >= _chunk6CNX6Q3Kcjs.farmAcceptQuality.call(void 0, accept, "text/html", { wildcards: true });
|
|
1189
1189
|
}
|
|
1190
1190
|
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldReturnMarkdown, "shouldReturnMarkdown");
|
|
1191
1191
|
function escapeAttribute(value) {
|
|
@@ -182,7 +182,10 @@ function renderMetadataHead(metadata, options = {}) {
|
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
184
|
appendNamedMetaRecord(tags, resolvedMetadata.other);
|
|
185
|
-
appendOpenGraph(tags, resolvedMetadata.openGraph, metadataBase
|
|
185
|
+
appendOpenGraph(tags, resolvedMetadata.openGraph, metadataBase, {
|
|
186
|
+
title: explicitTitle,
|
|
187
|
+
description: resolvedMetadata.description
|
|
188
|
+
});
|
|
186
189
|
appendTwitter(tags, resolvedMetadata.twitter, metadataBase);
|
|
187
190
|
appendVerification(tags, resolvedMetadata.verification);
|
|
188
191
|
if (options.jsonLd) {
|
|
@@ -220,10 +223,12 @@ function mergeNestedMetadata(base, next) {
|
|
|
220
223
|
return next ?? base;
|
|
221
224
|
}
|
|
222
225
|
__name(mergeNestedMetadata, "mergeNestedMetadata");
|
|
223
|
-
function appendOpenGraph(tags,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
function appendOpenGraph(tags, input, metadataBase, page) {
|
|
227
|
+
const description = typeof page.description === "string" ? page.description : void 0;
|
|
228
|
+
if (!isRecord(input) && !page.title && !description) return;
|
|
229
|
+
const openGraph = isRecord(input) ? input : {};
|
|
230
|
+
appendMetaProperty(tags, "og:title", openGraph.title ?? page.title);
|
|
231
|
+
appendMetaProperty(tags, "og:description", openGraph.description ?? description);
|
|
227
232
|
appendMetaProperty(tags, "og:url", resolveMetadataUrl(openGraph.url, metadataBase));
|
|
228
233
|
appendMetaProperty(tags, "og:site_name", openGraph.siteName);
|
|
229
234
|
appendMetaProperty(tags, "og:type", openGraph.type ?? "website");
|
|
@@ -336,32 +336,49 @@ function assertPluginDependencies(plugins, integrations) {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
const state = /* @__PURE__ */ new Map();
|
|
339
|
-
const
|
|
339
|
+
const path3 = [];
|
|
340
340
|
const visit = /* @__PURE__ */ __name((plugin) => {
|
|
341
341
|
if (state.get(plugin) === "done") return;
|
|
342
342
|
if (state.get(plugin) === "visiting") {
|
|
343
|
-
const cycle = [...
|
|
343
|
+
const cycle = [...path3.slice(path3.indexOf(plugin)), plugin].map(
|
|
344
344
|
(entry) => pluginShortName(entry.name)
|
|
345
345
|
);
|
|
346
346
|
throw new Error(`Plugins depend on each other in a cycle: ${cycle.join(" \u2192 ")}.`);
|
|
347
347
|
}
|
|
348
348
|
state.set(plugin, "visiting");
|
|
349
|
-
|
|
349
|
+
path3.push(plugin);
|
|
350
350
|
for (const dependency of plugin.dependsOn ?? []) {
|
|
351
351
|
for (const candidate of plugins) {
|
|
352
352
|
if (candidate !== plugin && matches(candidate, dependency)) visit(candidate);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
|
|
355
|
+
path3.pop();
|
|
356
356
|
state.set(plugin, "done");
|
|
357
357
|
}, "visit");
|
|
358
358
|
for (const plugin of plugins) visit(plugin);
|
|
359
359
|
}
|
|
360
360
|
__name(assertPluginDependencies, "assertPluginDependencies");
|
|
361
361
|
|
|
362
|
+
// src/utils/source-dir.ts
|
|
363
|
+
import path from "path";
|
|
364
|
+
var FARM_PROJECT_SOURCE_DIRS = /* @__PURE__ */ Symbol.for("farm.projectSourceDirs");
|
|
365
|
+
function getProjectSourceDirs() {
|
|
366
|
+
const globalState = globalThis;
|
|
367
|
+
return globalState[FARM_PROJECT_SOURCE_DIRS] ?? (globalState[FARM_PROJECT_SOURCE_DIRS] = /* @__PURE__ */ new Map());
|
|
368
|
+
}
|
|
369
|
+
__name(getProjectSourceDirs, "getProjectSourceDirs");
|
|
370
|
+
function setFarmProjectSourceDir(root, srcDir) {
|
|
371
|
+
getProjectSourceDirs().set(path.resolve(root), srcDir);
|
|
372
|
+
}
|
|
373
|
+
__name(setFarmProjectSourceDir, "setFarmProjectSourceDir");
|
|
374
|
+
function getFarmProjectSourceDir(root) {
|
|
375
|
+
return getProjectSourceDirs().get(path.resolve(root)) ?? "src";
|
|
376
|
+
}
|
|
377
|
+
__name(getFarmProjectSourceDir, "getFarmProjectSourceDir");
|
|
378
|
+
|
|
362
379
|
// src/auth-config.ts
|
|
363
380
|
import { createRequire } from "module";
|
|
364
|
-
import
|
|
381
|
+
import path2 from "path";
|
|
365
382
|
import { pathToFileURL } from "url";
|
|
366
383
|
function resolveFarmAuthConfig(input) {
|
|
367
384
|
const config = input === true ? {} : input && typeof input === "object" ? input : {};
|
|
@@ -392,10 +409,10 @@ function resolveFarmAuthConfig(input) {
|
|
|
392
409
|
__name(resolveFarmAuthConfig, "resolveFarmAuthConfig");
|
|
393
410
|
async function resolveFarmAuthIntegration(config, options) {
|
|
394
411
|
if (!config.enabled) return void 0;
|
|
395
|
-
const root =
|
|
412
|
+
const root = path2.resolve(options.root);
|
|
396
413
|
let modulePath;
|
|
397
414
|
try {
|
|
398
|
-
const resolveFromApp = createRequire(
|
|
415
|
+
const resolveFromApp = createRequire(path2.join(root, "package.json"));
|
|
399
416
|
modulePath = resolveFromApp.resolve("@farm.js/auth/internal");
|
|
400
417
|
} catch {
|
|
401
418
|
throw new Error(
|
|
@@ -478,6 +495,8 @@ function validateFarmAuthConfig(config) {
|
|
|
478
495
|
__name(validateFarmAuthConfig, "validateFarmAuthConfig");
|
|
479
496
|
|
|
480
497
|
export {
|
|
498
|
+
setFarmProjectSourceDir,
|
|
499
|
+
getFarmProjectSourceDir,
|
|
481
500
|
resolveFarmDevIndicatorsConfig,
|
|
482
501
|
generateFarmDevIndicatorsClientRuntime,
|
|
483
502
|
resolveFarmAuthConfig,
|
|
@@ -9,10 +9,12 @@ import {
|
|
|
9
9
|
normalizeFarmRouteRuntimeConfig
|
|
10
10
|
} from "./chunk-2J7W2WND.mjs";
|
|
11
11
|
import {
|
|
12
|
-
createFarmCacheKey,
|
|
13
12
|
createRouteDataCacheTag,
|
|
14
13
|
getFarmDataCache
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IV6CQY7O.mjs";
|
|
15
|
+
import {
|
|
16
|
+
createFarmCacheKey
|
|
17
|
+
} from "./chunk-CNOQY6Z7.mjs";
|
|
16
18
|
import {
|
|
17
19
|
__name
|
|
18
20
|
} from "./chunk-LPEX4YW6.mjs";
|
|
@@ -7,7 +7,7 @@ var _chunkSU7MH53Pcjs = require('./chunk-SU7MH53P.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkWNLBF77Xcjs = require('./chunk-WNLBF77X.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunk5OVTOKGHcjs = require('./chunk-5OVTOKGH.cjs');
|
|
@@ -52,7 +52,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, shouldBlockUnload, "shouldBlockUnload");
|
|
|
52
52
|
function navigateViaRouter(href, basePath, replace, options = {}) {
|
|
53
53
|
if (typeof window === "undefined") return;
|
|
54
54
|
const url = _chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href, basePath);
|
|
55
|
-
const spaRouter =
|
|
55
|
+
const spaRouter = _chunkWNLBF77Xcjs.getInstalledFarmSPARouter.call(void 0, );
|
|
56
56
|
if (spaRouter) {
|
|
57
57
|
void spaRouter.navigate(url, {
|
|
58
58
|
replace,
|
|
@@ -65,7 +65,7 @@ function navigateViaRouter(href, basePath, replace, options = {}) {
|
|
|
65
65
|
} else {
|
|
66
66
|
window.history.pushState(null, "", url);
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
_chunkWNLBF77Xcjs.notifyHistoryChange.call(void 0, "url-search");
|
|
69
69
|
}
|
|
70
70
|
_chunkS3JO3N4Hcjs.__name.call(void 0, navigateViaRouter, "navigateViaRouter");
|
|
71
71
|
function useRouter(options = {}) {
|
|
@@ -85,7 +85,7 @@ function useRouter(options = {}) {
|
|
|
85
85
|
setState(readRouterState(basePath, routeMatcher));
|
|
86
86
|
}, "handlePopState");
|
|
87
87
|
handlePopState();
|
|
88
|
-
const unsubscribe =
|
|
88
|
+
const unsubscribe = _chunkWNLBF77Xcjs.subscribeHistoryChange.call(void 0, handlePopState);
|
|
89
89
|
return unsubscribe;
|
|
90
90
|
}, [basePath, routeMatcher]);
|
|
91
91
|
const push = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (href, navigateOptions) => {
|
|
@@ -96,11 +96,11 @@ function useRouter(options = {}) {
|
|
|
96
96
|
}, "replace");
|
|
97
97
|
const pushState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
|
|
98
98
|
if (typeof window === "undefined") return;
|
|
99
|
-
|
|
99
|
+
_chunkWNLBF77Xcjs.getRouter.call(void 0, ).pushState(pageState, resolveClientHref(href, basePath));
|
|
100
100
|
}, "pushState");
|
|
101
101
|
const replaceState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
|
|
102
102
|
if (typeof window === "undefined") return;
|
|
103
|
-
|
|
103
|
+
_chunkWNLBF77Xcjs.getRouter.call(void 0, ).replaceState(pageState, resolveClientHref(href, basePath));
|
|
104
104
|
}, "replaceState");
|
|
105
105
|
const back = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
|
|
106
106
|
if (typeof window !== "undefined") {
|
|
@@ -124,25 +124,25 @@ function useRouter(options = {}) {
|
|
|
124
124
|
}
|
|
125
125
|
_chunkS3JO3N4Hcjs.__name.call(void 0, useRouter, "useRouter");
|
|
126
126
|
function usePageState() {
|
|
127
|
-
const [state, setState] = _react.useState.call(void 0, () =>
|
|
127
|
+
const [state, setState] = _react.useState.call(void 0, () => _chunkWNLBF77Xcjs.readPageState.call(void 0, ));
|
|
128
128
|
_react.useEffect.call(void 0, () => {
|
|
129
129
|
if (typeof window === "undefined") return;
|
|
130
130
|
const handlePopState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
|
|
131
|
-
setState(
|
|
131
|
+
setState(_chunkWNLBF77Xcjs.readPageState.call(void 0, ));
|
|
132
132
|
}, "handlePopState");
|
|
133
133
|
handlePopState();
|
|
134
|
-
return
|
|
134
|
+
return _chunkWNLBF77Xcjs.subscribeHistoryChange.call(void 0, handlePopState);
|
|
135
135
|
}, []);
|
|
136
136
|
return state;
|
|
137
137
|
}
|
|
138
138
|
_chunkS3JO3N4Hcjs.__name.call(void 0, usePageState, "usePageState");
|
|
139
139
|
function useNavigation() {
|
|
140
140
|
const [state, setState] = _react.useState.call(void 0,
|
|
141
|
-
() =>
|
|
141
|
+
() => _chunkWNLBF77Xcjs.getRouter.call(void 0, ).getNavigationState()
|
|
142
142
|
);
|
|
143
143
|
_react.useEffect.call(void 0, () => {
|
|
144
144
|
if (typeof window === "undefined") return;
|
|
145
|
-
return
|
|
145
|
+
return _chunkWNLBF77Xcjs.getRouter.call(void 0, ).subscribeNavigation(setState);
|
|
146
146
|
}, []);
|
|
147
147
|
return state;
|
|
148
148
|
}
|
|
@@ -155,7 +155,7 @@ function useBlocker(options) {
|
|
|
155
155
|
if (typeof window === "undefined" || !active) {
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
return
|
|
158
|
+
return _chunkWNLBF77Xcjs.getRouter.call(void 0, ).addBlocker(
|
|
159
159
|
async (context) => {
|
|
160
160
|
const current = optionsRef.current;
|
|
161
161
|
const when = typeof current.when === "function" ? current.when(context) : current.when;
|
|
@@ -179,7 +179,7 @@ function useScrollRestoration(key) {
|
|
|
179
179
|
_react.useEffect.call(void 0, () => {
|
|
180
180
|
const element = ref.current;
|
|
181
181
|
if (!element) return;
|
|
182
|
-
return
|
|
182
|
+
return _chunkWNLBF77Xcjs.getRouter.call(void 0, ).registerScrollElement(key, element);
|
|
183
183
|
}, [key]);
|
|
184
184
|
return ref;
|
|
185
185
|
}
|
|
@@ -201,7 +201,7 @@ function readRouterState(basePath, routeMatcher) {
|
|
|
201
201
|
pathname,
|
|
202
202
|
searchParams: url.searchParams,
|
|
203
203
|
params: _optionalChain([routeMatcher, 'optionalAccess', _5 => _5.match, 'call', _6 => _6(routePathname), 'optionalAccess', _7 => _7.params]) || {},
|
|
204
|
-
pageState: typeof window === "undefined" ? null :
|
|
204
|
+
pageState: typeof window === "undefined" ? null : _chunkWNLBF77Xcjs.readPageState.call(void 0, )
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
207
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readRouterState, "readRouterState");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2SDO73HKcjs = require('./chunk-2SDO73HK.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkARJWXNQLcjs = require('./chunk-ARJWXNQL.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -220,7 +220,7 @@ async function applyEndpointInvalidations(declaration, context, result) {
|
|
|
220
220
|
"Endpoint invalidates must resolve to an array of { key }, { path }, or { tag } targets"
|
|
221
221
|
);
|
|
222
222
|
}
|
|
223
|
-
return
|
|
223
|
+
return _chunk2SDO73HKcjs.applyFarmCacheInvalidationTargets.call(void 0, targets);
|
|
224
224
|
}
|
|
225
225
|
_chunkS3JO3N4Hcjs.__name.call(void 0, applyEndpointInvalidations, "applyEndpointInvalidations");
|
|
226
226
|
function createInitialEndpointContext(value) {
|
|
@@ -16,7 +16,7 @@ var _chunkJ7FSKED3cjs = require('./chunk-J7FSKED3.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk3LUF2PE2cjs = require('./chunk-3LUF2PE2.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -30,7 +30,7 @@ var _chunkQBK2AA4Ucjs = require('./chunk-QBK2AA4U.cjs');
|
|
|
30
30
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
31
31
|
|
|
32
32
|
// src/client/metadata-reconciler.ts
|
|
33
|
-
var MANAGED_ATTRIBUTE =
|
|
33
|
+
var MANAGED_ATTRIBUTE = _chunk3LUF2PE2cjs.FARM_METADATA_ATTRIBUTE;
|
|
34
34
|
var OWNED_SELECTORS = [
|
|
35
35
|
'meta[name="description"]',
|
|
36
36
|
'meta[name="keywords"]',
|
|
@@ -65,8 +65,8 @@ function removeAll(selector) {
|
|
|
65
65
|
}
|
|
66
66
|
_chunkS3JO3N4Hcjs.__name.call(void 0, removeAll, "removeAll");
|
|
67
67
|
function applyFarmMetadataToDocument(metadata, pathname) {
|
|
68
|
-
document.title =
|
|
69
|
-
const rendered =
|
|
68
|
+
document.title = _chunk3LUF2PE2cjs.resolveMetadataTitle.call(void 0, _optionalChain([metadata, 'optionalAccess', _ => _.title])) || "Farm.js App";
|
|
69
|
+
const rendered = _chunk3LUF2PE2cjs.renderMetadataHead.call(void 0, metadata, { pathname });
|
|
70
70
|
const template = document.createElement("template");
|
|
71
71
|
template.innerHTML = rendered.tags;
|
|
72
72
|
removeAll(OWNED_SELECTORS);
|