@farm.js/core 0.1.27 → 0.1.28
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 +2 -1
- package/dist/agent-runtime.d.ts +2 -1
- 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 +2 -1
- package/dist/api/runtime.d.ts +2 -1
- package/dist/api/runtime.mjs +6 -5
- package/dist/api.cjs +12 -11
- package/dist/api.d.mts +3 -2
- package/dist/api.d.ts +3 -2
- package/dist/api.mjs +11 -10
- package/dist/{app-BfzZdjgX.d.mts → app-DSSq6wiN.d.mts} +3 -3
- package/dist/{app-CXK7Prrt.d.ts → app-M8nVWvNU.d.ts} +3 -3
- package/dist/app-markdown.cjs +5 -5
- package/dist/app-markdown.d.mts +3 -2
- package/dist/app-markdown.d.ts +3 -2
- package/dist/app-markdown.mjs +4 -4
- 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-4FHDV7VM.mjs → chunk-2CNBR3EB.mjs} +2 -2
- package/dist/{chunk-MBFURXAC.mjs → chunk-2DLN6HG4.mjs} +1 -1
- package/dist/{chunk-UUYF3CHN.mjs → chunk-2N5PX3LS.mjs} +2 -2
- package/dist/{chunk-H6G5INWM.cjs → chunk-2SDO73HK.cjs} +14 -156
- 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-DQMTHWPI.cjs → chunk-55ZY4ZA7.cjs} +4 -4
- package/dist/{chunk-I7PUUDGY.cjs → chunk-63H6BKXG.cjs} +2 -2
- package/dist/{chunk-FG5H2VCJ.mjs → chunk-6ZCMSZ5U.mjs} +2 -2
- package/dist/{chunk-ZMN3H73H.cjs → chunk-75DYEVXI.cjs} +13 -11
- package/dist/{chunk-WJKVTJJR.cjs → chunk-A672WZEG.cjs} +2 -2
- package/dist/{chunk-NL3ZSMZB.cjs → chunk-BJPBQNIE.cjs} +12 -12
- package/dist/{chunk-Q4BHBO6V.mjs → chunk-BXFWA23T.mjs} +2 -2
- package/dist/chunk-CNOQY6Z7.mjs +156 -0
- package/dist/{chunk-DW34V5SM.cjs → chunk-CTV2TTNP.cjs} +4 -4
- package/dist/{chunk-YXM74XOW.cjs → chunk-D4JE5NNV.cjs} +12 -12
- package/dist/{chunk-4UNKCNSL.mjs → chunk-E76XC6ZG.mjs} +2 -2
- package/dist/{chunk-G3HRIVEY.cjs → chunk-ES4B2IXW.cjs} +2 -2
- package/dist/{chunk-TDWFCC2T.cjs → chunk-EWZ3XHKQ.cjs} +2 -2
- package/dist/{chunk-JQGDQO2I.cjs → chunk-EXLKRR4U.cjs} +10 -10
- package/dist/{chunk-YZBV7733.cjs → chunk-F52CDFJM.cjs} +81 -81
- package/dist/{chunk-HG237IEY.mjs → chunk-FB3H4INL.mjs} +1 -1
- package/dist/{chunk-UWTQTZFN.mjs → chunk-FVCSLZWT.mjs} +11 -11
- package/dist/{chunk-WD4YXVLV.mjs → chunk-GZYH4OER.mjs} +1 -1
- package/dist/{chunk-DX4VKYAJ.cjs → chunk-I26CZYPV.cjs} +6 -4
- package/dist/{chunk-UNSKL6BI.cjs → chunk-ID6OVSLH.cjs} +163 -129
- package/dist/{chunk-F6SJAKFJ.mjs → chunk-IV6CQY7O.mjs} +12 -154
- package/dist/{chunk-6D242YGO.mjs → chunk-JATSG2ZO.mjs} +1 -1
- package/dist/{chunk-U74A3P2P.cjs → chunk-JLRDISQL.cjs} +7 -7
- package/dist/{chunk-LAHZ7LZA.cjs → chunk-JUFRXDTK.cjs} +18 -18
- package/dist/{chunk-POXI72VV.mjs → chunk-K3YEZLSY.mjs} +53 -8
- package/dist/{chunk-Y4YWHNKU.cjs → chunk-KH7BN726.cjs} +9 -9
- package/dist/{chunk-KAERLFD3.cjs → chunk-KOQ555NR.cjs} +16 -13
- package/dist/{chunk-O2LV5XDG.mjs → chunk-KXGDXYUC.mjs} +3 -3
- package/dist/{chunk-3IL5UC5I.cjs → chunk-KZLND3D2.cjs} +2 -2
- package/dist/{chunk-NPFGGBM5.cjs → chunk-MH24QDVJ.cjs} +13 -13
- package/dist/{chunk-TKDY6AJP.mjs → chunk-MKMBQSNQ.mjs} +1 -1
- package/dist/{chunk-OCE65DDM.mjs → chunk-MNUGPHLN.mjs} +1 -1
- package/dist/{chunk-3PTVHMLD.mjs → chunk-NVBS5WSZ.mjs} +1 -1
- package/dist/chunk-NYJMY3JA.cjs +156 -0
- package/dist/{chunk-VVJCWBIE.mjs → chunk-O3DTUAX2.mjs} +2 -2
- package/dist/{chunk-C7OUJ6JI.cjs → chunk-PZNCMPJF.cjs} +3 -3
- package/dist/{chunk-WIVTGKLY.mjs → chunk-PZPDGOU5.mjs} +9 -6
- package/dist/{chunk-52SH7TKB.mjs → chunk-QG5HNS7P.mjs} +2 -2
- package/dist/{chunk-CEYUWDWA.mjs → chunk-QZCT2CQ4.mjs} +10 -5
- package/dist/{chunk-JT25KHDI.mjs → chunk-REGFZJEJ.mjs} +1 -1
- package/dist/{chunk-QMV4QELL.mjs → chunk-S5GDHOE4.mjs} +4 -2
- package/dist/{chunk-CRQPYWLK.cjs → chunk-SORB3MAR.cjs} +14 -14
- package/dist/{chunk-FPW4W3VW.mjs → chunk-T7HQ3I4C.mjs} +1 -1
- package/dist/{chunk-HF5SIACK.cjs → chunk-TII23GJC.cjs} +3 -3
- package/dist/{chunk-QQQNJS2E.mjs → chunk-UX2DD2VK.mjs} +1 -1
- package/dist/{chunk-I4J452B7.cjs → chunk-VHJGDMCG.cjs} +3 -3
- package/dist/{chunk-QI7WQSMI.cjs → chunk-VQXDC5UV.cjs} +4 -4
- package/dist/{chunk-B6ZCT36X.cjs → chunk-WNLBF77X.cjs} +4 -4
- package/dist/{chunk-6EG7U4NF.mjs → chunk-X7WVQMIB.mjs} +1 -1
- package/dist/{chunk-5SPPCN5J.mjs → chunk-XNPDONUH.mjs} +1 -1
- package/dist/{chunk-ZSO5GWGD.cjs → chunk-XSPGWQWA.cjs} +75 -30
- package/dist/{chunk-FOT7LZEO.cjs → chunk-Y7GW7J46.cjs} +1 -1
- package/dist/{chunk-UOXGA6TO.mjs → chunk-YDQZGSDS.mjs} +1 -1
- package/dist/{chunk-C3VRMB6H.cjs → chunk-ZCU4NZ3M.cjs} +6 -6
- package/dist/{chunk-OGHTEYXS.mjs → chunk-ZRIE4KMG.mjs} +62 -28
- package/dist/{client-plugins-1GS4zubE.d.mts → client-plugins-CgYNY7jF.d.mts} +35 -32
- package/dist/{client-plugins-B1Za6F5x.d.ts → client-plugins-Fl9Og3yB.d.ts} +35 -32
- package/dist/client-plugins.d.mts +2 -1
- package/dist/client-plugins.d.ts +2 -1
- 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 +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/{devtools-6RN6KHTW.mjs → devtools-3E7ZANMZ.mjs} +4 -4
- package/dist/{devtools-CQJ3H6MX.cjs → devtools-5AREISIA.cjs} +5 -5
- package/dist/docs.cjs +7 -7
- package/dist/docs.mjs +6 -6
- package/dist/index.cjs +56 -54
- package/dist/index.d.mts +14 -13
- package/dist/index.d.ts +14 -13
- package/dist/index.mjs +64 -62
- package/dist/integrations.d.mts +2 -1
- package/dist/integrations.d.ts +2 -1
- package/dist/internal/app-markdown-runtime.cjs +4 -4
- package/dist/internal/app-markdown-runtime.d.mts +3 -2
- package/dist/internal/app-markdown-runtime.d.ts +3 -2
- package/dist/internal/app-markdown-runtime.mjs +3 -3
- package/dist/internal/build-runtime.cjs +23 -22
- package/dist/internal/build-runtime.d.mts +4 -3
- package/dist/internal/build-runtime.d.ts +4 -3
- package/dist/internal/build-runtime.mjs +22 -21
- package/dist/internal/cli-runtime.cjs +13 -12
- package/dist/internal/cli-runtime.mjs +12 -11
- 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.d.mts +2 -1
- package/dist/internal/compression-runtime.d.ts +2 -1
- package/dist/internal/config-runtime.cjs +5 -5
- package/dist/internal/config-runtime.d.mts +3 -2
- package/dist/internal/config-runtime.d.ts +3 -2
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +17 -15
- package/dist/internal/production-runtime.d.mts +8 -7
- package/dist/internal/production-runtime.d.ts +8 -7
- package/dist/internal/production-runtime.mjs +17 -15
- package/dist/markdown.cjs +3 -3
- package/dist/markdown.d.mts +2 -1
- package/dist/markdown.d.ts +2 -1
- package/dist/markdown.mjs +2 -2
- package/dist/{metadata-B9mCxKgp.d.mts → metadata-B0X-qtcQ.d.mts} +1 -1
- package/dist/{metadata-7LKgQEWF.d.ts → metadata-BdDKgd7K.d.ts} +1 -1
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +4 -3
- package/dist/middleware.d.ts +4 -3
- package/dist/middleware.mjs +3 -3
- 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 +23 -19
- package/dist/plugin.d.mts +2 -1
- package/dist/plugin.d.ts +2 -1
- package/dist/plugin.mjs +23 -19
- package/dist/{production-runtime-DramhI0c.d.mts → production-runtime-BjgFgDIg.d.mts} +1 -1
- package/dist/{production-runtime-B3xnY6fI.d.ts → production-runtime-Dx_qMA3t.d.ts} +1 -1
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-CpW32tOL.d.ts → render-plan-B41EWmBb.d.ts} +1 -1
- package/dist/{render-plan-CtQB-zHS.d.mts → render-plan-_1TAWODt.d.mts} +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-DlLVBKe3.d.mts → request-BhE4luLv.d.mts} +1 -1
- package/dist/{request-BVGGeQv4.d.ts → request-Dbf3G0zM.d.ts} +1 -1
- package/dist/request.d.mts +3 -2
- package/dist/request.d.ts +3 -2
- package/dist/{route-rendering-BdEldajn.d.ts → route-rendering-Z7PveTZE.d.ts} +1 -1
- package/dist/{route-rendering-DChYLNdh.d.mts → route-rendering-zzfx_GHf.d.mts} +1 -1
- package/dist/{router-D5htHn_M.d.mts → router-BatNMsa1.d.mts} +1 -1
- package/dist/{router-D0Az-1Nu.d.ts → router-DtNRhQl3.d.ts} +1 -1
- package/dist/routes.cjs +6 -5
- package/dist/routes.d.mts +2 -1
- package/dist/routes.d.ts +2 -1
- 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.d.mts +3 -2
- package/dist/server-plugins.d.ts +3 -2
- 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 +64 -54
- package/dist/server.d.mts +9 -8
- package/dist/server.d.ts +9 -8
- package/dist/server.mjs +48 -38
- package/dist/{spa-router-DmwP_7QL.d.ts → spa-router-BE3bwU-J.d.ts} +2 -2
- package/dist/{spa-router-DVfSJZ5o.d.mts → spa-router-DQOnHZVj.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-DLK1ERNl.d.mts} +1 -1
- package/dist/{utils-Dv0OuLtF.d.ts → utils-u7ZBSWAK.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +19 -18
- package/dist/vite.d.mts +2 -1
- package/dist/vite.d.ts +2 -1
- package/dist/vite.mjs +18 -17
- 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
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkXSPGWQWAcjs = require('./chunk-XSPGWQWA.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -116,7 +116,7 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
116
116
|
}
|
|
117
117
|
const url = new URL(options.request.url);
|
|
118
118
|
const hasMarkdownExtension = url.pathname.toLowerCase().endsWith(".md");
|
|
119
|
-
if (!hasMarkdownExtension && !
|
|
119
|
+
if (!hasMarkdownExtension && !_chunkXSPGWQWAcjs.requestAcceptsMarkdown.call(void 0, options.request.headers.get("accept"))) {
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
122
122
|
const targetPathname = normalizeFarmMarkdownRoutePath(url.pathname);
|
|
@@ -134,7 +134,7 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
134
134
|
if (!hasMarkdownExtension) {
|
|
135
135
|
headers.set("Vary", "Accept");
|
|
136
136
|
}
|
|
137
|
-
return
|
|
137
|
+
return _chunkXSPGWQWAcjs.createFarmMarkdownViewResponse.call(void 0, {
|
|
138
138
|
request: options.request,
|
|
139
139
|
requestUrl: url,
|
|
140
140
|
markdown: source.source,
|
|
@@ -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) {
|
|
@@ -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 _chunkXSPGWQWAcjs = require('./chunk-XSPGWQWA.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
|
+
_chunkXSPGWQWAcjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
|
|
1185
|
+
_chunkXSPGWQWAcjs.farmAcceptQuality.call(void 0, accept, "text/plain")
|
|
1186
1186
|
);
|
|
1187
1187
|
if (markdown <= 0) return false;
|
|
1188
|
-
return markdown >=
|
|
1188
|
+
return markdown >= _chunkXSPGWQWAcjs.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) {
|
|
@@ -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);
|
|
@@ -282,8 +282,14 @@ function ifNoneMatchIncludes(header, etag) {
|
|
|
282
282
|
_chunkS3JO3N4Hcjs.__name.call(void 0, ifNoneMatchIncludes, "ifNoneMatchIncludes");
|
|
283
283
|
function createFarmMarkdownViewResponse(options) {
|
|
284
284
|
const url = _nullishCoalesce(options.requestUrl, () => ( new URL(options.request.url)));
|
|
285
|
-
const view = url.searchParams.has("actions") ? selectFarmPageActionsView(options.markdownPath, _nullishCoalesce(options.actions, () => ( [])), options.headers) : selectFarmMarkdownView(options.markdown, url.searchParams, options.markdownPath);
|
|
286
|
-
|
|
285
|
+
const view = options.status >= 400 ? { status: options.status, body: options.markdown } : url.searchParams.has("actions") ? selectFarmPageActionsView(options.markdownPath, _nullishCoalesce(options.actions, () => ( [])), options.headers) : selectFarmMarkdownView(options.markdown, url.searchParams, options.markdownPath);
|
|
286
|
+
let status = view.status === 200 ? options.status : view.status;
|
|
287
|
+
const ifMatch = options.request.headers.get("if-match");
|
|
288
|
+
const preconditionFailed = status >= 200 && status < 300 && ifMatch !== null && ifMatch.trim() !== "*";
|
|
289
|
+
if (preconditionFailed) {
|
|
290
|
+
status = 412;
|
|
291
|
+
options.headers.set("Cache-Control", "no-store");
|
|
292
|
+
}
|
|
287
293
|
_chunkJ63ZH5OQcjs.emitFarmAgentRead.call(void 0, options.request, "markdown", status, readMarkdownViewName(url.searchParams));
|
|
288
294
|
for (const [name, value] of Object.entries(_nullishCoalesce(view.headers, () => ( {}))))
|
|
289
295
|
options.headers.append(name, value);
|
|
@@ -292,7 +298,7 @@ function createFarmMarkdownViewResponse(options) {
|
|
|
292
298
|
if (status === 200 && ifNoneMatchIncludes(options.request.headers.get("if-none-match"), etag)) {
|
|
293
299
|
return new Response(null, { status: 304, headers: options.headers });
|
|
294
300
|
}
|
|
295
|
-
return new Response(options.request.method === "HEAD" ? null : view.body, {
|
|
301
|
+
return new Response(preconditionFailed || options.request.method === "HEAD" ? null : view.body, {
|
|
296
302
|
status,
|
|
297
303
|
headers: options.headers
|
|
298
304
|
});
|
|
@@ -380,33 +386,53 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
380
386
|
for (const name of FARM_MARKDOWN_VIEW_PARAMS) pageUrl.searchParams.delete(name);
|
|
381
387
|
const headers = new Headers(options.request.headers);
|
|
382
388
|
headers.set("accept", "text/html");
|
|
389
|
+
headers.delete("if-match");
|
|
390
|
+
headers.delete("if-unmodified-since");
|
|
391
|
+
headers.delete("if-none-match");
|
|
392
|
+
headers.delete("if-modified-since");
|
|
393
|
+
headers.delete("range");
|
|
394
|
+
headers.delete("if-range");
|
|
383
395
|
const pageResponse = await options.renderPage(
|
|
384
396
|
new Request(pageUrl, {
|
|
385
397
|
method: "GET",
|
|
386
|
-
headers
|
|
398
|
+
headers,
|
|
399
|
+
signal: options.request.signal
|
|
387
400
|
})
|
|
388
401
|
);
|
|
402
|
+
if (pageResponse.status === 204 || pageResponse.status === 205 || pageResponse.status === 304) {
|
|
403
|
+
return pageResponse;
|
|
404
|
+
}
|
|
389
405
|
const redirects = pageResponse.status >= 300 && pageResponse.status < 400 && pageResponse.headers.has("location");
|
|
390
406
|
if (redirects || !isHtmlResponse(pageResponse)) {
|
|
391
|
-
|
|
407
|
+
const accessResponse = createMarkdownAccessResponse(
|
|
392
408
|
pageResponse,
|
|
393
409
|
target.pathname,
|
|
394
410
|
pageUrl,
|
|
395
411
|
options.request.method === "HEAD"
|
|
396
412
|
);
|
|
413
|
+
if (accessResponse || options.request.method === "HEAD") {
|
|
414
|
+
void _optionalChain([pageResponse, 'access', _11 => _11.body, 'optionalAccess', _12 => _12.cancel, 'call', _13 => _13(), 'access', _14 => _14.catch, 'call', _15 => _15(() => {
|
|
415
|
+
})]);
|
|
416
|
+
return _nullishCoalesce(accessResponse, () => ( new Response(null, {
|
|
417
|
+
status: pageResponse.status,
|
|
418
|
+
statusText: pageResponse.statusText,
|
|
419
|
+
headers: pageResponse.headers
|
|
420
|
+
})));
|
|
421
|
+
}
|
|
422
|
+
return pageResponse;
|
|
397
423
|
}
|
|
398
424
|
const html = await pageResponse.text();
|
|
399
425
|
const markdownPath = target.pathname === "/" ? "/index.md" : `${target.pathname}.md`;
|
|
400
|
-
const actions = extractFarmPageActions(html, pageUrl);
|
|
426
|
+
const actions = pageResponse.status >= 400 ? [] : extractFarmPageActions(html, pageUrl);
|
|
401
427
|
for (const form of actions) {
|
|
402
|
-
if (!_optionalChain([form, 'access',
|
|
428
|
+
if (!_optionalChain([form, 'access', _16 => _16.action, 'optionalAccess', _17 => _17.startsWith, 'call', _18 => _18("/")])) continue;
|
|
403
429
|
const pathname = new URL(form.action, pageUrl.origin).pathname;
|
|
404
430
|
const tool = _nullishCoalesce(_chunk5MKEDGLDcjs._findFarmMCPEndpointTool.call(void 0, form.method, pathname, options.apiServerBasePath), () => ( _chunk5MKEDGLDcjs._findFarmMCPEndpointTool.call(void 0, form.method, _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname), options.apiServerBasePath)));
|
|
405
431
|
if (tool) form.tool = tool;
|
|
406
432
|
}
|
|
407
433
|
const markdown = htmlToMarkdown(html, {
|
|
408
|
-
title: _optionalChain([target, 'access',
|
|
409
|
-
includeMetadata: _nullishCoalesce(_optionalChain([options, 'access',
|
|
434
|
+
title: _optionalChain([target, 'access', _19 => _19.route, 'optionalAccess', _20 => _20.title]),
|
|
435
|
+
includeMetadata: _nullishCoalesce(_optionalChain([options, 'access', _21 => _21.config, 'optionalAccess', _22 => _22.includeMetadata]), () => ( true)),
|
|
410
436
|
sourcePath: target.pathname,
|
|
411
437
|
actionsPath: actions.length > 0 ? `${markdownPath}?actions` : void 0
|
|
412
438
|
});
|
|
@@ -418,17 +444,21 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
418
444
|
if (!hasMarkdownExtension) {
|
|
419
445
|
headersOut.set("Vary", "Accept");
|
|
420
446
|
}
|
|
421
|
-
for (const token of _nullishCoalesce(_optionalChain([pageResponse, 'access',
|
|
447
|
+
for (const token of _nullishCoalesce(_optionalChain([pageResponse, 'access', _23 => _23.headers, 'access', _24 => _24.get, 'call', _25 => _25("vary"), 'optionalAccess', _26 => _26.split, 'call', _27 => _27(",")]), () => ( []))) {
|
|
422
448
|
const name = token.trim();
|
|
423
449
|
if (name && name.toLowerCase() !== "accept") appendHeaderToken(headersOut, "Vary", name);
|
|
424
450
|
}
|
|
425
451
|
const pageCacheControl = pageResponse.headers.get("cache-control");
|
|
426
|
-
const cache = _nullishCoalesce(_nullishCoalesce(_optionalChain([target, 'access',
|
|
452
|
+
const cache = _nullishCoalesce(_nullishCoalesce(_optionalChain([target, 'access', _28 => _28.route, 'optionalAccess', _29 => _29.cache]), () => ( _optionalChain([options, 'access', _30 => _30.config, 'optionalAccess', _31 => _31.cache]))), () => ( false));
|
|
427
453
|
headersOut.set(
|
|
428
454
|
"Cache-Control",
|
|
429
455
|
pageCacheControl && isPrivateCacheControl(pageCacheControl) ? pageCacheControl : createMarkdownCacheHeader(cache)
|
|
430
456
|
);
|
|
431
|
-
|
|
457
|
+
preserveMarkdownResponseCookies(pageResponse.headers, headersOut);
|
|
458
|
+
if (pageResponse.status >= 400) {
|
|
459
|
+
preserveMarkdownResponseControlHeaders(pageResponse.headers, headersOut);
|
|
460
|
+
}
|
|
461
|
+
const robots = [pageResponse.headers.get("x-robots-tag"), readHtmlMetaContent(html, "robots")].filter((value) => Boolean(_optionalChain([value, 'optionalAccess', _32 => _32.trim, 'call', _33 => _33()]))).join(", ");
|
|
432
462
|
if (robots) headersOut.set("X-Robots-Tag", robots);
|
|
433
463
|
const canonical = readHtmlCanonicalHref(html);
|
|
434
464
|
if (canonical) {
|
|
@@ -457,6 +487,8 @@ function createMarkdownAccessResponse(pageResponse, pathname, pageUrl, head) {
|
|
|
457
487
|
"Cache-Control": "no-store",
|
|
458
488
|
"X-Farm-Markdown-Route": pathname
|
|
459
489
|
});
|
|
490
|
+
preserveMarkdownResponseCookies(pageResponse.headers, headers);
|
|
491
|
+
preserveMarkdownResponseControlHeaders(pageResponse.headers, headers);
|
|
460
492
|
let body;
|
|
461
493
|
if (redirect) {
|
|
462
494
|
let target;
|
|
@@ -471,8 +503,6 @@ function createMarkdownAccessResponse(pageResponse, pathname, pageUrl, head) {
|
|
|
471
503
|
\`${pathname}\` redirects to [${target}](${target}). The page may require signing in.
|
|
472
504
|
`;
|
|
473
505
|
} else {
|
|
474
|
-
const authenticate = pageResponse.headers.get("www-authenticate");
|
|
475
|
-
if (authenticate) headers.set("WWW-Authenticate", authenticate);
|
|
476
506
|
body = pageResponse.status === 401 ? `# Sign-in required
|
|
477
507
|
|
|
478
508
|
\`${pathname}\` requires signing in.
|
|
@@ -484,6 +514,21 @@ This account cannot read \`${pathname}\`.
|
|
|
484
514
|
return new Response(head ? null : body, { status: pageResponse.status, headers });
|
|
485
515
|
}
|
|
486
516
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createMarkdownAccessResponse, "createMarkdownAccessResponse");
|
|
517
|
+
function preserveMarkdownResponseControlHeaders(source, target) {
|
|
518
|
+
for (const name of ["WWW-Authenticate", "Proxy-Authenticate", "Retry-After", "Allow"]) {
|
|
519
|
+
const value = source.get(name);
|
|
520
|
+
if (value !== null) target.set(name, value);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, preserveMarkdownResponseControlHeaders, "preserveMarkdownResponseControlHeaders");
|
|
524
|
+
function preserveMarkdownResponseCookies(source, target) {
|
|
525
|
+
const getSetCookie = source.getSetCookie;
|
|
526
|
+
const cookies = typeof getSetCookie === "function" ? getSetCookie.call(source) : source.has("set-cookie") ? [source.get("set-cookie")] : [];
|
|
527
|
+
if (cookies.length === 0) return;
|
|
528
|
+
for (const cookie of cookies) target.append("Set-Cookie", cookie);
|
|
529
|
+
target.set("Cache-Control", "private, no-store");
|
|
530
|
+
}
|
|
531
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, preserveMarkdownResponseCookies, "preserveMarkdownResponseCookies");
|
|
487
532
|
function applyMarkdownNegotiationHeaders(response, options) {
|
|
488
533
|
if (!isHtmlResponse(response)) {
|
|
489
534
|
return response;
|
|
@@ -685,7 +730,7 @@ function getFarmMarkdownAlternatePath(config, pathname) {
|
|
|
685
730
|
}
|
|
686
731
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmMarkdownAlternatePath, "getFarmMarkdownAlternatePath");
|
|
687
732
|
function isFarmMarkdownMirrorExposed(config, pathname) {
|
|
688
|
-
if (!_optionalChain([config, 'optionalAccess',
|
|
733
|
+
if (!_optionalChain([config, 'optionalAccess', _34 => _34.enabled])) return false;
|
|
689
734
|
return config.expose === true || findExposedMarkdownRoute(config, pathname) !== null;
|
|
690
735
|
}
|
|
691
736
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isFarmMarkdownMirrorExposed, "isFarmMarkdownMirrorExposed");
|
|
@@ -778,7 +823,7 @@ function extractHtmlBody(html) {
|
|
|
778
823
|
const body = rootMatch ? rootMatch[1] : bodyMatch ? bodyMatch[1] : html;
|
|
779
824
|
const main = extractFirstElementContent(body, ["main"]);
|
|
780
825
|
if (main !== void 0) return main;
|
|
781
|
-
const articles = _nullishCoalesce(_optionalChain([body, 'access',
|
|
826
|
+
const articles = _nullishCoalesce(_optionalChain([body, 'access', _35 => _35.match, 'call', _36 => _36(/<article\b/gi), 'optionalAccess', _37 => _37.length]), () => ( 0));
|
|
782
827
|
return articles === 1 ? _nullishCoalesce(extractFirstElementContent(body, ["article"]), () => ( body)) : body;
|
|
783
828
|
}
|
|
784
829
|
_chunkS3JO3N4Hcjs.__name.call(void 0, extractHtmlBody, "extractHtmlBody");
|
|
@@ -794,7 +839,7 @@ function extractFirstElementContent(html, tagNames) {
|
|
|
794
839
|
_chunkS3JO3N4Hcjs.__name.call(void 0, extractFirstElementContent, "extractFirstElementContent");
|
|
795
840
|
function readHtmlMetaContent(html, name) {
|
|
796
841
|
for (const match of html.matchAll(/<meta\b([^>]*)>/gi)) {
|
|
797
|
-
if (_optionalChain([readHtmlAttribute, 'call',
|
|
842
|
+
if (_optionalChain([readHtmlAttribute, 'call', _38 => _38(match[1], "name"), 'optionalAccess', _39 => _39.toLowerCase, 'call', _40 => _40()]) === name) {
|
|
798
843
|
return readHtmlAttribute(match[1], "content");
|
|
799
844
|
}
|
|
800
845
|
}
|
|
@@ -803,8 +848,8 @@ function readHtmlMetaContent(html, name) {
|
|
|
803
848
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlMetaContent, "readHtmlMetaContent");
|
|
804
849
|
function readHtmlCanonicalHref(html) {
|
|
805
850
|
for (const match of html.matchAll(/<link\b([^>]*)>/gi)) {
|
|
806
|
-
const rel = _optionalChain([readHtmlAttribute, 'call',
|
|
807
|
-
if (_optionalChain([rel, 'optionalAccess',
|
|
851
|
+
const rel = _optionalChain([readHtmlAttribute, 'call', _41 => _41(match[1], "rel"), 'optionalAccess', _42 => _42.toLowerCase, 'call', _43 => _43(), 'access', _44 => _44.split, 'call', _45 => _45(/\s+/)]);
|
|
852
|
+
if (_optionalChain([rel, 'optionalAccess', _46 => _46.includes, 'call', _47 => _47("canonical")])) return readHtmlAttribute(match[1], "href");
|
|
808
853
|
}
|
|
809
854
|
return void 0;
|
|
810
855
|
}
|
|
@@ -831,7 +876,7 @@ function extractFarmPageActions(html, pageUrl) {
|
|
|
831
876
|
}
|
|
832
877
|
_chunkS3JO3N4Hcjs.__name.call(void 0, extractFarmPageActions, "extractFarmPageActions");
|
|
833
878
|
function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
834
|
-
const method = _optionalChain([readDecodedAttribute, 'call',
|
|
879
|
+
const method = _optionalChain([readDecodedAttribute, 'call', _48 => _48(attributes, "method"), 'optionalAccess', _49 => _49.trim, 'call', _50 => _50(), 'access', _51 => _51.toLowerCase, 'call', _52 => _52()]);
|
|
835
880
|
if (method === "dialog") return void 0;
|
|
836
881
|
const target = resolveFormTarget(readDecodedAttribute(attributes, "action"), pageUrl);
|
|
837
882
|
const form = {
|
|
@@ -841,11 +886,11 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
|
841
886
|
submit: []
|
|
842
887
|
};
|
|
843
888
|
const name = _nullishCoalesce(_nullishCoalesce(readDecodedAttribute(attributes, "aria-label"), () => ( readDecodedAttribute(attributes, "name"))), () => ( readDecodedAttribute(attributes, "id")));
|
|
844
|
-
if (_optionalChain([name, 'optionalAccess',
|
|
889
|
+
if (_optionalChain([name, 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()])) form.name = name.trim();
|
|
845
890
|
if (target) form.action = target;
|
|
846
891
|
else form.requiresJavaScript = true;
|
|
847
892
|
if (form.method === "POST") {
|
|
848
|
-
const enctype = _optionalChain([readDecodedAttribute, 'call',
|
|
893
|
+
const enctype = _optionalChain([readDecodedAttribute, 'call', _55 => _55(attributes, "enctype"), 'optionalAccess', _56 => _56.trim, 'call', _57 => _57(), 'access', _58 => _58.toLowerCase, 'call', _59 => _59()]);
|
|
849
894
|
form.enctype = enctype && FORM_ENCTYPES.has(enctype) ? enctype : "application/x-www-form-urlencoded";
|
|
850
895
|
}
|
|
851
896
|
const wrappingLabels = [...content.matchAll(/<label\b[^>]*>([\s\S]*?)<\/label>/gi)].map(
|
|
@@ -856,13 +901,13 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
|
856
901
|
})
|
|
857
902
|
);
|
|
858
903
|
const labelOf = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (controlAttributes, index) => {
|
|
859
|
-
const aria = _optionalChain([readDecodedAttribute, 'call',
|
|
904
|
+
const aria = _optionalChain([readDecodedAttribute, 'call', _60 => _60(controlAttributes, "aria-label"), 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()]);
|
|
860
905
|
if (aria) return aria;
|
|
861
906
|
const id = readDecodedAttribute(controlAttributes, "id");
|
|
862
907
|
const forLabel = id ? labelsFor.get(id) : void 0;
|
|
863
908
|
if (forLabel) return forLabel;
|
|
864
909
|
const wrapping = wrappingLabels.find((label) => label.start < index && index < label.end);
|
|
865
|
-
return _optionalChain([wrapping, 'optionalAccess',
|
|
910
|
+
return _optionalChain([wrapping, 'optionalAccess', _63 => _63.text]) || void 0;
|
|
866
911
|
}, "labelOf");
|
|
867
912
|
const groups = /* @__PURE__ */ new Map();
|
|
868
913
|
const controls = /<(input)\b([^>]*)>|<(select|textarea|button)\b([^>]*)>([\s\S]*?)<\/\3>/gi;
|
|
@@ -873,7 +918,7 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
|
873
918
|
if (hasHtmlAttribute(controlAttributes, "disabled")) continue;
|
|
874
919
|
const label = labelOf(controlAttributes, match.index);
|
|
875
920
|
const fieldName = readDecodedAttribute(controlAttributes, "name");
|
|
876
|
-
const typeAttribute = _optionalChain([readDecodedAttribute, 'call',
|
|
921
|
+
const typeAttribute = _optionalChain([readDecodedAttribute, 'call', _64 => _64(controlAttributes, "type"), 'optionalAccess', _65 => _65.trim, 'call', _66 => _66(), 'access', _67 => _67.toLowerCase, 'call', _68 => _68()]);
|
|
877
922
|
const type = tag === "input" ? _nullishCoalesce(typeAttribute, () => ( "text")) : tag === "button" ? _nullishCoalesce(typeAttribute, () => ( "submit")) : tag;
|
|
878
923
|
if (tag === "button" && !["button", "reset"].includes(type) || tag === "input" && (type === "submit" || type === "image")) {
|
|
879
924
|
const submit = {
|
|
@@ -887,7 +932,7 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
|
|
|
887
932
|
const resolved = resolveFormTarget(formAction, pageUrl);
|
|
888
933
|
if (resolved) submit.action = resolved;
|
|
889
934
|
}
|
|
890
|
-
const formMethod = _optionalChain([readDecodedAttribute, 'call',
|
|
935
|
+
const formMethod = _optionalChain([readDecodedAttribute, 'call', _69 => _69(controlAttributes, "formmethod"), 'optionalAccess', _70 => _70.toLowerCase, 'call', _71 => _71()]);
|
|
891
936
|
if (formMethod === "get" || formMethod === "post") submit.method = formMethod.toUpperCase();
|
|
892
937
|
form.submit.push(submit);
|
|
893
938
|
continue;
|
|
@@ -966,7 +1011,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, readPageForm, "readPageForm");
|
|
|
966
1011
|
function resolveFormTarget(action, pageUrl) {
|
|
967
1012
|
let target;
|
|
968
1013
|
try {
|
|
969
|
-
target = new URL(_optionalChain([action, 'optionalAccess',
|
|
1014
|
+
target = new URL(_optionalChain([action, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()]) || pageUrl.href, pageUrl);
|
|
970
1015
|
} catch (e4) {
|
|
971
1016
|
return void 0;
|
|
972
1017
|
}
|
|
@@ -998,7 +1043,7 @@ function readHtmlAttribute(attributes, name) {
|
|
|
998
1043
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlAttribute, "readHtmlAttribute");
|
|
999
1044
|
function readCodeLanguage(attributesList) {
|
|
1000
1045
|
for (const attributes of attributesList) {
|
|
1001
|
-
const language = _nullishCoalesce(_nullishCoalesce(readHtmlAttribute(attributes, "data-language"), () => ( readHtmlAttribute(attributes, "data-lang"))), () => ( _optionalChain([readHtmlAttribute, 'call',
|
|
1046
|
+
const language = _nullishCoalesce(_nullishCoalesce(readHtmlAttribute(attributes, "data-language"), () => ( readHtmlAttribute(attributes, "data-lang"))), () => ( _optionalChain([readHtmlAttribute, 'call', _74 => _74(attributes, "class"), 'optionalAccess', _75 => _75.match, 'call', _76 => _76(/(?:^|\s)lang(?:uage)?-(\S+)/), 'optionalAccess', _77 => _77[1]])));
|
|
1002
1047
|
if (language && /^[\w#+.-]+$/.test(language)) return language;
|
|
1003
1048
|
}
|
|
1004
1049
|
return void 0;
|
|
@@ -1111,7 +1156,7 @@ function matchClosingTags(html) {
|
|
|
1111
1156
|
while (match = tags.exec(html)) {
|
|
1112
1157
|
const name = match[2].toLowerCase();
|
|
1113
1158
|
if (match[1]) {
|
|
1114
|
-
const start = _optionalChain([open, 'access',
|
|
1159
|
+
const start = _optionalChain([open, 'access', _78 => _78.get, 'call', _79 => _79(name), 'optionalAccess', _80 => _80.pop, 'call', _81 => _81()]);
|
|
1115
1160
|
if (start !== void 0) closes.set(start, match.index + match[0].length);
|
|
1116
1161
|
} else if (!VOID_TAGS.has(name) && !isSelfClosingTag(match[0])) {
|
|
1117
1162
|
let starts = open.get(name);
|
|
@@ -1146,7 +1191,7 @@ function resolveStreamedBoundaries(html, { boundaries, placeholders }) {
|
|
|
1146
1191
|
let cursor = 0;
|
|
1147
1192
|
let match;
|
|
1148
1193
|
while (match = openingTag.exec(html)) {
|
|
1149
|
-
const id = _optionalChain([/\sid="([^"]*)"/, 'access',
|
|
1194
|
+
const id = _optionalChain([/\sid="([^"]*)"/, 'access', _82 => _82.exec, 'call', _83 => _83(match[2]), 'optionalAccess', _84 => _84[1]]);
|
|
1150
1195
|
if (!id || !wanted.has(id) || segments.has(id)) continue;
|
|
1151
1196
|
const close = closingTags.get(match.index);
|
|
1152
1197
|
if (close === void 0) continue;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkKH7BN726cjs = require('./chunk-KH7BN726.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk63H6BKXGcjs = require('./chunk-63H6BKXG.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -13,8 +13,8 @@ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
|
13
13
|
// src/server-query-client.ts
|
|
14
14
|
var _react = require('react');
|
|
15
15
|
function useServerQuery(query, input, options = {}) {
|
|
16
|
-
const cache =
|
|
17
|
-
const key =
|
|
16
|
+
const cache = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, );
|
|
17
|
+
const key = _chunkKH7BN726cjs.createServerQueryCallKey.call(void 0, query, input);
|
|
18
18
|
const inputRef = _react.useRef.call(void 0, input);
|
|
19
19
|
const optionsRef = _react.useRef.call(void 0, options);
|
|
20
20
|
const mountedKeyRef = _react.useRef.call(void 0, void 0);
|
|
@@ -36,7 +36,7 @@ function useServerQuery(query, input, options = {}) {
|
|
|
36
36
|
const run = _react.useCallback.call(void 0,
|
|
37
37
|
(force = false) => {
|
|
38
38
|
pendingInvalidationRef.current = false;
|
|
39
|
-
return
|
|
39
|
+
return _chunkKH7BN726cjs.fetchServerQuery.call(void 0, query, inputRef.current, {
|
|
40
40
|
...optionsRef.current,
|
|
41
41
|
force
|
|
42
42
|
});
|
|
@@ -56,7 +56,7 @@ function useServerQuery(query, input, options = {}) {
|
|
|
56
56
|
}, [cache, entry, key, options.enabled, run]);
|
|
57
57
|
_react.useEffect.call(void 0, () => {
|
|
58
58
|
if (options.enabled === false) return;
|
|
59
|
-
return
|
|
59
|
+
return _chunkKH7BN726cjs.attachRevalidationListeners.call(void 0,
|
|
60
60
|
() => {
|
|
61
61
|
if (cache.isStale(key)) void run().catch(() => void 0);
|
|
62
62
|
},
|