@farm.js/core 0.1.82 → 0.1.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp.d-C2Su3x4D.d.ts → agent-mcp.d-7uKdOttc.d.ts} +1 -1
- package/dist/{agent-mcp.d-Yak-LqRd.d.mts → agent-mcp.d-LChlR2au.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -1
- package/dist/agent-runtime.d.ts +2 -1
- package/dist/{analyzer-RPU2KG4J.mjs → analyzer-7RNO3XKC.mjs} +2 -2
- package/dist/analyzer-PFKA5NI6.cjs +17 -0
- package/dist/api/node.d.mts +4 -3
- package/dist/api/node.d.ts +4 -3
- package/dist/api/route-manager.d.mts +4 -3
- package/dist/api/route-manager.d.ts +4 -3
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/api.d.mts +5 -4
- package/dist/api.d.ts +5 -4
- package/dist/{app-manifest.d-DZyXaICz.d.ts → app-manifest.d-CRp21oAz.d.ts} +1 -1
- package/dist/{app-manifest.d-BcyOFMrg.d.mts → app-manifest.d-QMdmqqCr.d.mts} +1 -1
- package/dist/app-markdown.d.mts +3 -2
- package/dist/app-markdown.d.ts +3 -2
- package/dist/{app.d-CIoXsAbN.d.ts → app.d-CVPu_hoD.d.ts} +34 -4
- package/dist/{app.d-C0ePpuaG.d.mts → app.d-eSm7jgoc.d.mts} +34 -4
- package/dist/{chunk-B2PGVHBG.cjs → chunk-22BTYPIX.cjs} +4 -4
- package/dist/{chunk-BCTHOQPP.cjs → chunk-3OKSEJ33.cjs} +98 -10
- package/dist/{chunk-QSMUMK7Y.mjs → chunk-3WM7VBGW.mjs} +2 -2
- package/dist/{chunk-XMHERKSE.mjs → chunk-42IBGQTN.mjs} +5 -12
- package/dist/{chunk-RMPUEH5T.cjs → chunk-57EEWWUS.cjs} +2 -2
- package/dist/{chunk-Q2VOT3K2.cjs → chunk-5I4ZGKP2.cjs} +395 -333
- package/dist/{chunk-TPA2PV5J.mjs → chunk-5V6HSJFG.mjs} +24 -1
- package/dist/{chunk-RMLR5RMH.mjs → chunk-BCCCPFHQ.mjs} +92 -4
- package/dist/{chunk-LM2ZDNDD.cjs → chunk-BOEDYXAX.cjs} +30 -25
- package/dist/{chunk-NRCKBDYP.mjs → chunk-BRDGINBB.mjs} +153 -47
- package/dist/chunk-BUQR7KKO.mjs +17 -0
- package/dist/{chunk-63ZE6B6M.mjs → chunk-BZY3SRRD.mjs} +1 -1
- package/dist/{chunk-724WT3NI.mjs → chunk-CRE642TW.mjs} +1 -1
- package/dist/{chunk-JK26IMT7.cjs → chunk-CVZY4TLW.cjs} +1 -1
- package/dist/{chunk-ZIZRIZLP.mjs → chunk-CWUQBECF.mjs} +3 -1
- package/dist/{chunk-DAXU2NBE.mjs → chunk-DFDQGHPU.mjs} +104 -42
- package/dist/{chunk-AIPZDBP6.cjs → chunk-DSWSDDP2.cjs} +844 -553
- package/dist/{chunk-DRO3NXA3.cjs → chunk-EBSL5TW7.cjs} +203 -93
- package/dist/{chunk-CJDBTTLB.mjs → chunk-EDBIBO67.mjs} +18 -13
- package/dist/{chunk-BBVLOEND.cjs → chunk-F7JVO3OZ.cjs} +4 -4
- package/dist/chunk-FZ7OUN5M.cjs +30 -0
- package/dist/chunk-GLNVLCUH.cjs +426 -0
- package/dist/{chunk-5MMKNW7Q.cjs → chunk-H7REG7OX.cjs} +15 -8
- package/dist/{chunk-N2EFMN2K.cjs → chunk-HOQ2MYBJ.cjs} +10 -10
- package/dist/{chunk-OP5VI4TP.mjs → chunk-I5CVJ24H.mjs} +1 -1
- package/dist/{chunk-I4DR3HCH.mjs → chunk-INU4K4U4.mjs} +5 -5
- package/dist/{chunk-4X7LSGM6.mjs → chunk-IRJSZAJB.mjs} +1 -1
- package/dist/{chunk-EX6ZSN5P.cjs → chunk-IZYFP7IN.cjs} +17 -24
- package/dist/chunk-J6RFB324.cjs +17 -0
- package/dist/{chunk-47I2MYIR.mjs → chunk-KXVMWLTC.mjs} +484 -193
- package/dist/{chunk-UVV3I5QA.cjs → chunk-L2GUEYHR.cjs} +29 -6
- package/dist/{chunk-VMBIKDKW.cjs → chunk-L3BSHASB.cjs} +6 -4
- package/dist/chunk-L5HDCDFT.mjs +426 -0
- package/dist/{chunk-GXLNARPO.mjs → chunk-M5XU22PQ.mjs} +1 -1
- package/dist/chunk-M6AJZ4XR.mjs +30 -0
- package/dist/chunk-MAPHNGTF.cjs +98 -0
- package/dist/{chunk-RE5E2G5S.cjs → chunk-MNUYXZV7.cjs} +2 -18
- package/dist/{chunk-C3VCYOU4.mjs → chunk-MUUDHWQZ.mjs} +1 -1
- package/dist/{chunk-YSU3WCW6.mjs → chunk-MYSH5Y4E.mjs} +1 -1
- package/dist/{chunk-OMB7UGVW.mjs → chunk-NLHSKKTT.mjs} +14 -9
- package/dist/{chunk-ARORZ3MH.cjs → chunk-OFVBMS6I.cjs} +439 -333
- package/dist/{chunk-5MUFW5UU.cjs → chunk-OP7BIEUW.cjs} +2 -2
- package/dist/{chunk-I4WZRG73.mjs → chunk-RB5IGN3N.mjs} +13 -6
- package/dist/chunk-RJBUI5AN.mjs +18 -0
- package/dist/chunk-RQ6XX5IN.mjs +98 -0
- package/dist/{chunk-EJCVG25Z.mjs → chunk-S3R4JDRO.mjs} +17 -9
- package/dist/{chunk-WFVSAT7Y.cjs → chunk-T7HGXF7D.cjs} +3 -3
- package/dist/{chunk-HHQEKLZL.cjs → chunk-USMRAC72.cjs} +36 -31
- package/dist/{chunk-SM2SYWAR.cjs → chunk-XJDB564A.cjs} +18 -10
- package/dist/{chunk-EL2Z6YFZ.mjs → chunk-XLULEFRW.mjs} +180 -70
- package/dist/{chunk-6BPFIYGY.cjs → chunk-YU6VL7H5.cjs} +3 -3
- package/dist/{chunk-CD5Z7RR5.cjs → chunk-Z37PDUJR.cjs} +4 -4
- package/dist/{cli-runtime.d-Hnvvadz7.d.mts → cli-runtime.d-C7aMfoTq.d.mts} +8 -6
- package/dist/{cli-runtime.d-I0MphTbc.d.ts → cli-runtime.d-DaElKjaL.d.ts} +8 -6
- package/dist/{client-component.d-DapRqtSC.d.mts → client-component.d-DLMCzmUx.d.mts} +1 -1
- package/dist/{client-component.d-5QEvtJsg.d.ts → client-component.d-DLknFP8l.d.ts} +1 -1
- package/dist/{client-plugins.d-DcmDzcSC.d.ts → client-plugins.d-BVXjyIkY.d.ts} +14 -0
- package/dist/{client-plugins.d-C1WM3ieD.d.mts → client-plugins.d-BwKwuO_0.d.mts} +14 -0
- package/dist/client-plugins.d.mts +2 -1
- package/dist/client-plugins.d.ts +2 -1
- package/dist/client.cjs +4 -3
- package/dist/client.d.mts +10 -9
- package/dist/client.d.ts +10 -9
- package/dist/client.mjs +3 -2
- package/dist/config.d.mts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/desktop.d.mts +3 -2
- package/dist/desktop.d.ts +3 -2
- package/dist/{devtools-5B7NZE6F.cjs → devtools-4SVIRV4P.cjs} +7 -7
- package/dist/{devtools-C5GXZZ7E.mjs → devtools-MWQA5LVN.mjs} +5 -5
- package/dist/docs.cjs +10 -9
- package/dist/docs.d.mts +15 -6
- package/dist/docs.d.ts +15 -6
- package/dist/docs.mjs +9 -8
- package/dist/environment/vite.cjs +5 -5
- package/dist/environment/vite.d.mts +1 -0
- package/dist/environment/vite.d.ts +1 -0
- package/dist/environment/vite.mjs +4 -4
- package/dist/{generate-route-types.d-CaGMIaNI.d.mts → generate-route-types.d-BFOMM8Ef.d.mts} +3 -0
- package/dist/{generate-route-types.d-B76M5R11.d.ts → generate-route-types.d-C2m8myHb.d.ts} +3 -0
- package/dist/{handler.d-B8bPCBzl.d.mts → handler.d-BKTWzzNA.d.mts} +1 -1
- package/dist/{handler.d-Cliwo6Nu.d.ts → handler.d-Dzpyg3-N.d.ts} +1 -1
- package/dist/{headers.d-CVwSpSGX.d.mts → headers.d-5opjyhXw.d.mts} +1 -1
- package/dist/{headers.d-C_btqjV6.d.ts → headers.d-PZyXcDAH.d.ts} +1 -1
- package/dist/index.cjs +32 -29
- package/dist/{index.d-DFuMZk9-.d.mts → index.d-C0Mie66f.d.mts} +1 -1
- package/dist/{index.d-hOEbMcLk.d.ts → index.d-DV2q-0mE.d.ts} +1 -1
- package/dist/index.d.mts +26 -25
- package/dist/index.d.ts +26 -25
- package/dist/index.mjs +32 -29
- package/dist/integrations/orm.d.mts +2 -1
- package/dist/integrations/orm.d.ts +2 -1
- package/dist/integrations.d.mts +2 -1
- package/dist/integrations.d.ts +2 -1
- package/dist/internal/app-markdown-runtime.d.mts +3 -2
- package/dist/internal/app-markdown-runtime.d.ts +3 -2
- package/dist/internal/build-runtime.cjs +28 -27
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +27 -26
- package/dist/internal/cli-runtime.cjs +9 -9
- package/dist/internal/cli-runtime.d.mts +8 -7
- package/dist/internal/cli-runtime.d.ts +8 -7
- package/dist/internal/cli-runtime.mjs +8 -8
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +8 -42
- package/dist/internal/client-runtime.d.ts +8 -42
- package/dist/internal/compression-runtime.d.mts +2 -1
- package/dist/internal/compression-runtime.d.ts +2 -1
- package/dist/internal/config-runtime.cjs +7 -7
- package/dist/internal/config-runtime.d.mts +6 -5
- package/dist/internal/config-runtime.d.ts +6 -5
- package/dist/internal/config-runtime.mjs +6 -6
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-action-client.cjs +18 -0
- package/dist/internal/islands-action-client.d.mts +18 -0
- package/dist/internal/islands-action-client.d.ts +18 -0
- package/dist/internal/islands-action-client.mjs +18 -0
- package/dist/internal/islands-runtime.cjs +3 -8
- package/dist/internal/islands-runtime.mjs +4 -9
- package/dist/internal/islx-actions-client.cjs +4 -3
- package/dist/internal/islx-actions-client.mjs +3 -2
- package/dist/internal/islx-actions-server.d.mts +0 -2
- package/dist/internal/islx-actions-server.d.ts +0 -2
- package/dist/internal/islx-client.cjs +13 -1
- package/dist/internal/islx-client.d.mts +11 -0
- package/dist/internal/islx-client.d.ts +11 -0
- package/dist/internal/islx-client.mjs +14 -0
- package/dist/internal/metadata-image-runtime.d.mts +1 -0
- package/dist/internal/metadata-image-runtime.d.ts +1 -0
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +13 -13
- package/dist/internal/production-runtime.d.mts +11 -11
- package/dist/internal/production-runtime.d.ts +11 -11
- package/dist/internal/production-runtime.mjs +19 -19
- package/dist/internal/renderer-islands.cjs +47 -0
- package/dist/internal/renderer-islands.d.mts +32 -0
- package/dist/internal/renderer-islands.d.ts +32 -0
- package/dist/internal/renderer-islands.mjs +47 -0
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/start-manifest.d.mts +2 -1
- package/dist/internal/start-manifest.d.ts +2 -1
- package/dist/island-runtime.d-BA7EPo1v.d.ts +38 -0
- package/dist/island-runtime.d-BBS_YUSX.d.mts +38 -0
- package/dist/markdown.d.mts +2 -1
- package/dist/markdown.d.ts +2 -1
- package/dist/middleware.d.mts +2 -1
- package/dist/middleware.d.ts +2 -1
- package/dist/mobile.d.mts +6 -3
- package/dist/mobile.d.ts +6 -3
- package/dist/{mount.d-DLeYxeRR.d.mts → mount.d-CZ_qL1iS.d.mts} +1 -1
- package/dist/{mount.d-CAovYKfs.d.ts → mount.d-gWul1GA1.d.ts} +1 -1
- package/dist/{navigation-delegate.d-Chv93QS6.d.mts → navigation-delegate.d-BBTzhJLj.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BLM-8Q3Z.d.ts → navigation-delegate.d-BZsYEAet.d.ts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/plugin.cjs +23 -22
- package/dist/plugin.d.mts +6 -6
- package/dist/plugin.d.ts +6 -6
- package/dist/plugin.mjs +22 -21
- package/dist/{render-plan.d-BSTjTH8h.d.ts → render-plan.d-AaJsYPX-.d.ts} +1 -1
- package/dist/{render-plan.d-CK5Lggyb.d.mts → render-plan.d-bnWxS12w.d.mts} +1 -1
- package/dist/renderer-client.cjs +6 -5
- package/dist/renderer-client.d.mts +8 -7
- package/dist/renderer-client.d.ts +8 -7
- package/dist/renderer-client.mjs +2 -1
- package/dist/renderer.cjs +12 -2
- package/dist/renderer.d.mts +167 -4
- package/dist/renderer.d.ts +167 -4
- package/dist/renderer.mjs +11 -1
- package/dist/{request.d-BhggxQf3.d.mts → request.d-C2HOn3Hi.d.mts} +1 -1
- package/dist/{request.d-CyJS9bjm.d.ts → request.d-CAeitOG1.d.ts} +1 -1
- package/dist/request.d.mts +3 -2
- package/dist/request.d.ts +3 -2
- package/dist/{route-rendering.d-BLPPmI5I.d.ts → route-rendering.d-A1dIkUK5.d.ts} +1 -1
- package/dist/{route-rendering.d-CUpG2mZJ.d.mts → route-rendering.d-CYA-ulnX.d.mts} +1 -1
- package/dist/{router.d-2NQM1Kgw.d.mts → router.d-8lxnzlkr.d.mts} +1 -1
- package/dist/{router.d-0X2Ki6rf.d.ts → router.d-A_Yt6jYz.d.ts} +1 -1
- package/dist/{routes.d-CCccJRrp.d.mts → routes.d-BWvpUoYu.d.mts} +1 -1
- package/dist/{routes.d-b7khoRoU.d.ts → routes.d-D7RWvfqL.d.ts} +1 -1
- package/dist/routes.d.mts +2 -1
- package/dist/routes.d.ts +2 -1
- package/dist/{rsc-pipeline-5AOF64FL.cjs → rsc-pipeline-OWBEZ7HB.cjs} +10 -10
- package/dist/{rsc-pipeline-DNRLYOJ7.mjs → rsc-pipeline-UT3Z2GDO.mjs} +9 -9
- package/dist/{runtime-EHG2FRXZ.mjs → runtime-F5I3WY3B.mjs} +12 -12
- package/dist/{runtime-ZVHG5SRB.cjs → runtime-SRMQ46SK.cjs} +15 -15
- package/dist/{runtime.d-CXuwkUgr.d.ts → runtime.d-BPyvWrgQ.d.ts} +1 -1
- package/dist/{runtime.d-CaFXcu_Q.d.mts → runtime.d-C_rZ9_DD.d.mts} +1 -1
- package/dist/{server-components-status.d-Cp7zvBm5.d.mts → server-components-status.d-BpxiEMQE.d.mts} +1 -1
- package/dist/{server-components-status.d-BdeFD8ZH.d.ts → server-components-status.d-C2UEKJn7.d.ts} +1 -1
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server-query-call.d-rVM_lsYk.d.mts +15 -0
- package/dist/server-query-call.d-rVM_lsYk.d.ts +15 -0
- package/dist/server-query-client.cjs +5 -3
- package/dist/server-query-client.d.mts +3 -2
- package/dist/server-query-client.d.ts +3 -2
- package/dist/server-query-client.mjs +5 -3
- package/dist/{server-query-runtime.d-DXRNhX_3.d.ts → server-query-runtime.d-BlHd90D0.d.ts} +2 -8
- package/dist/{server-query-runtime.d-aP52iuL5.d.mts → server-query-runtime.d-CCLGkQtE.d.mts} +2 -8
- package/dist/server.cjs +52 -52
- package/dist/server.d.mts +12 -12
- package/dist/server.d.ts +12 -12
- package/dist/server.mjs +30 -30
- package/dist/{spa-router.d-l3G38xHa.d.mts → spa-router.d-BD-6WX1R.d.mts} +2 -2
- package/dist/{spa-router.d-Bjgl-Osi.d.ts → spa-router.d-Cw5i_15e.d.ts} +2 -2
- package/dist/{ssg.d-DDca17Lc.d.ts → ssg.d-Bifiq0EL.d.ts} +2 -2
- package/dist/{ssg.d-RnlHOqUL.d.mts → ssg.d-CCE9aob5.d.mts} +2 -2
- package/dist/{store-core.d-BaOUOPf7.d.ts → store-core.d-5tVn5vi1.d.ts} +3 -3
- package/dist/{store-core.d-BZjuC6Zc.d.mts → store-core.d-BN2MxSG9.d.mts} +3 -3
- package/dist/testing.d.mts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/{utils.d-D8TWmpWo.d.ts → utils.d-BUjpSNIO.d.ts} +1 -1
- package/dist/{utils.d-tdzw0_zQ.d.mts → utils.d-wGPLeVbq.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +23 -22
- package/dist/vite.d.mts +12 -6
- package/dist/vite.d.ts +12 -6
- package/dist/vite.mjs +22 -21
- package/package.json +13 -3
- package/dist/analyzer-LV23T6QN.cjs +0 -17
- package/dist/chunk-4QENVMG7.mjs +0 -34
- package/dist/chunk-AUFEM3FB.mjs +0 -229
- package/dist/chunk-S7WZUK3B.cjs +0 -229
- package/dist/{chunk-NEKO3HM2.cjs → chunk-4B6YJ5DS.cjs} +2 -2
- package/dist/{chunk-CA2HBLXP.mjs → chunk-4EEAPBNV.mjs} +3 -3
|
@@ -18,14 +18,14 @@ var _chunkCCAUIBIScjs = require('./chunk-CCAUIBIS.cjs');
|
|
|
18
18
|
var _chunkWMRGIQTAcjs = require('./chunk-WMRGIQTA.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkCVZY4TLWcjs = require('./chunk-CVZY4TLW.cjs');
|
|
22
22
|
|
|
23
23
|
// src/mobile/analyzer.ts
|
|
24
24
|
var _crypto = require('crypto');
|
|
25
25
|
var _fs = require('fs');
|
|
26
26
|
var _promises = require('fs/promises');
|
|
27
27
|
var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
28
|
-
var ANALYZER_VERSION = `8:${
|
|
28
|
+
var ANALYZER_VERSION = `8:${_chunkCVZY4TLWcjs.FARM_VERSION}`;
|
|
29
29
|
var INTRINSIC_KINDS = {};
|
|
30
30
|
for (const tag of "div section main article header footer nav aside figure hr li".split(" ")) {
|
|
31
31
|
INTRINSIC_KINDS[tag] = "View";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
beginFarmServerQueryAction,
|
|
3
2
|
completeFarmServerQueryAction,
|
|
4
3
|
shouldApplyFarmServerQueryActionResult
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-42IBGQTN.mjs";
|
|
5
|
+
import {
|
|
6
|
+
beginFarmServerQueryAction
|
|
7
|
+
} from "./chunk-BUQR7KKO.mjs";
|
|
6
8
|
import {
|
|
7
9
|
isFarmIslandsActionResult
|
|
8
10
|
} from "./chunk-X3EFRVXY.mjs";
|
|
@@ -30,11 +32,10 @@ function createFarmServerFnTransportError(value) {
|
|
|
30
32
|
error.name = "ServerActionError";
|
|
31
33
|
return error;
|
|
32
34
|
}
|
|
33
|
-
|
|
34
|
-
const invocation = beginFarmServerQueryAction(call.id, call.args);
|
|
35
|
+
async function completeFarmIslandsAction(invocation, response) {
|
|
35
36
|
let result;
|
|
36
37
|
try {
|
|
37
|
-
result = await
|
|
38
|
+
result = await response;
|
|
38
39
|
} catch (error2) {
|
|
39
40
|
if (error2 instanceof Error && error2.message.startsWith("Server action failed")) {
|
|
40
41
|
throw createFarmServerFnTransportError(void 0);
|
|
@@ -47,8 +48,14 @@ var farmIslandsActionInterceptor = async (call, next) => {
|
|
|
47
48
|
applyFarmCacheInvalidations(invalidations);
|
|
48
49
|
if (error) throw createFarmServerFnTransportError(error);
|
|
49
50
|
return completeFarmServerQueryAction(invocation, result.value);
|
|
50
|
-
}
|
|
51
|
+
}
|
|
52
|
+
var farmIslandsActionInterceptor = (call, next) => (
|
|
53
|
+
// Taken when the call is made: a server query reads the call it is making at that moment.
|
|
54
|
+
completeFarmIslandsAction(beginFarmServerQueryAction(call.id, call.args), next())
|
|
55
|
+
);
|
|
51
56
|
|
|
52
57
|
export {
|
|
58
|
+
createFarmServerFnTransportError,
|
|
59
|
+
completeFarmIslandsAction,
|
|
53
60
|
farmIslandsActionInterceptor
|
|
54
61
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/utils/source-dir.ts
|
|
2
|
+
import path from "path";
|
|
3
|
+
var FARM_PROJECT_SOURCE_DIRS = /* @__PURE__ */ Symbol.for("farm.projectSourceDirs");
|
|
4
|
+
function getProjectSourceDirs() {
|
|
5
|
+
const globalState = globalThis;
|
|
6
|
+
return globalState[FARM_PROJECT_SOURCE_DIRS] ?? (globalState[FARM_PROJECT_SOURCE_DIRS] = /* @__PURE__ */ new Map());
|
|
7
|
+
}
|
|
8
|
+
function setFarmProjectSourceDir(root, srcDir) {
|
|
9
|
+
getProjectSourceDirs().set(path.resolve(root), srcDir);
|
|
10
|
+
}
|
|
11
|
+
function getFarmProjectSourceDir(root) {
|
|
12
|
+
return getProjectSourceDirs().get(path.resolve(root)) ?? "src";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
setFarmProjectSourceDir,
|
|
17
|
+
getFarmProjectSourceDir
|
|
18
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isFarmIslandStrategy
|
|
3
|
+
} from "./chunk-S32PDOLO.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getFarmRendererCapabilities,
|
|
6
|
+
isReactRenderer,
|
|
7
|
+
resolveFarmRenderer,
|
|
8
|
+
resolveFarmServerComponentsMode
|
|
9
|
+
} from "./chunk-BCCCPFHQ.mjs";
|
|
10
|
+
import {
|
|
11
|
+
_peekCurrentRequest
|
|
12
|
+
} from "./chunk-VIXTAVEA.mjs";
|
|
13
|
+
|
|
14
|
+
// src/renderer-islands.ts
|
|
15
|
+
import { resolveIslandMarkup } from "@farm.js/islx/islands/server";
|
|
16
|
+
var CLIENT_ATTRIBUTE = "client:";
|
|
17
|
+
var responses = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
var detached = 0;
|
|
19
|
+
function currentResponse() {
|
|
20
|
+
const request = _peekCurrentRequest();
|
|
21
|
+
if (!request) return void 0;
|
|
22
|
+
let response = responses.get(request);
|
|
23
|
+
if (!response) responses.set(request, response = { next: 0, sent: /* @__PURE__ */ new Set() });
|
|
24
|
+
return response;
|
|
25
|
+
}
|
|
26
|
+
function islandName(reference) {
|
|
27
|
+
return `${reference.export} (${reference.src})`;
|
|
28
|
+
}
|
|
29
|
+
function readClientAttributes(props, reference) {
|
|
30
|
+
const rest = {};
|
|
31
|
+
let strategy;
|
|
32
|
+
for (const [key, value] of Object.entries(props)) {
|
|
33
|
+
if (!key.startsWith(CLIENT_ATTRIBUTE)) {
|
|
34
|
+
rest[key] = value;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (value === void 0) continue;
|
|
38
|
+
const name = key.slice(CLIENT_ATTRIBUTE.length);
|
|
39
|
+
if (!isFarmIslandStrategy(name)) {
|
|
40
|
+
throw new TypeError(
|
|
41
|
+
`\`${key}\` on ${islandName(reference)} is not an island strategy. Use \`client:load\`, \`client:idle\`, \`client:visible\` or \`client:interaction\`.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (value !== true && value !== "") {
|
|
45
|
+
throw new TypeError(
|
|
46
|
+
`\`${key}\` on ${islandName(reference)} takes no value. Write \`${key}\` alone.`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
if (strategy) {
|
|
50
|
+
throw new TypeError(
|
|
51
|
+
`${islandName(reference)} has two strategies, \`client:${strategy}\` and \`${key}\`. Keep one.`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
strategy = name;
|
|
55
|
+
}
|
|
56
|
+
return { props: rest, strategy };
|
|
57
|
+
}
|
|
58
|
+
var reported = /* @__PURE__ */ new Set();
|
|
59
|
+
function resolveFarmIsland(props, reference) {
|
|
60
|
+
const { props: islandProps, strategy } = readClientAttributes(props, reference);
|
|
61
|
+
const response = currentResponse();
|
|
62
|
+
const id = response ? `fi${response.next++}` : `fi-${detached++}`;
|
|
63
|
+
try {
|
|
64
|
+
const parts = resolveIslandMarkup({
|
|
65
|
+
src: reference.src,
|
|
66
|
+
export: reference.export,
|
|
67
|
+
strategy: strategy ?? reference.strategy ?? "load",
|
|
68
|
+
id,
|
|
69
|
+
props: islandProps,
|
|
70
|
+
sent: response?.sent
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
props: islandProps,
|
|
74
|
+
values: parts.values,
|
|
75
|
+
element: parts.element,
|
|
76
|
+
script: parts.script
|
|
77
|
+
};
|
|
78
|
+
} catch (error) {
|
|
79
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
80
|
+
const key = `${reference.src}#${reference.export}:${message}`;
|
|
81
|
+
if (!reported.has(key)) {
|
|
82
|
+
reported.add(key);
|
|
83
|
+
console.warn(
|
|
84
|
+
`[Farm.js] ${message}. The server-rendered component was preserved without client hydration.`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function usesFarmRendererIslands(config) {
|
|
91
|
+
const renderer = resolveFarmRenderer(config.renderer);
|
|
92
|
+
return !isReactRenderer(renderer) && getFarmRendererCapabilities(renderer).islands && config.experimental?.isolatedClientHydration === "enabled" && resolveFarmServerComponentsMode(config.experimental?.serverComponents) === void 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
resolveFarmIsland,
|
|
97
|
+
usesFarmRendererIslands
|
|
98
|
+
};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFarmDocsAdapterUIModule
|
|
3
|
+
} from "./chunk-5V6HSJFG.mjs";
|
|
4
|
+
|
|
1
5
|
// src/docs/adapter-client.ts
|
|
2
6
|
function getFarmDocsAdapterConfigModule(docs) {
|
|
3
|
-
if (!docs?.enabled || !docs.adapter
|
|
7
|
+
if (!docs?.enabled || !getFarmDocsAdapterUIModule(docs.adapter) || !docs.configPath) {
|
|
8
|
+
return void 0;
|
|
9
|
+
}
|
|
4
10
|
return docs.configPath.endsWith(".json") ? void 0 : docs.configPath.replace(/\\/g, "/");
|
|
5
11
|
}
|
|
6
|
-
function generateFarmDocsAdapterClientRuntime(
|
|
7
|
-
if (!
|
|
12
|
+
function generateFarmDocsAdapterClientRuntime(uiModule, configModule, rendererClient) {
|
|
13
|
+
if (!uiModule) {
|
|
8
14
|
return `
|
|
9
15
|
async function hydrateFarmDocsAdapterRuntime() {
|
|
10
16
|
return false;
|
|
@@ -18,17 +24,19 @@ async function hydrateFarmDocsAdapterRuntime() {
|
|
|
18
24
|
// The docs server flags pages whose config holds what its JSON copy cannot (icons,
|
|
19
25
|
// MDX components, callbacks); the adapter restores those from the module itself.
|
|
20
26
|
// Fetch it alongside the adapter rather than after it: they don't depend on each other.
|
|
21
|
-
const [
|
|
22
|
-
import(${JSON.stringify(
|
|
23
|
-
runtime.configModule ? ${configModule ? `import(${JSON.stringify(configModule)})` : "undefined"} : undefined
|
|
27
|
+
const [FarmDocsAdapterUI, configModule${rendererClient ? ", renderer" : ""}] = await Promise.all([
|
|
28
|
+
import(${JSON.stringify(uiModule)}),
|
|
29
|
+
runtime.configModule ? ${configModule ? `import(${JSON.stringify(configModule)})` : "undefined"} : undefined,${rendererClient ? `
|
|
30
|
+
import(${JSON.stringify(rendererClient)}),` : ""}
|
|
24
31
|
]);
|
|
25
|
-
if (typeof
|
|
32
|
+
if (typeof FarmDocsAdapterUI.hydrateFarmDocs !== "function") {
|
|
26
33
|
throw new Error("The configured Farm docs adapter does not export hydrateFarmDocs().");
|
|
27
34
|
}
|
|
28
|
-
|
|
35
|
+
FarmDocsAdapterUI.hydrateFarmDocs({
|
|
29
36
|
config: runtime.config || {},
|
|
30
37
|
data: runtime.data,
|
|
31
|
-
...(configModule ? { configModule: configModule.default ?? configModule } : {})
|
|
38
|
+
...(configModule ? { configModule: configModule.default ?? configModule } : {}),${rendererClient ? `
|
|
39
|
+
renderer,` : ""}
|
|
32
40
|
});
|
|
33
41
|
return true;
|
|
34
42
|
}
|
|
@@ -4,7 +4,7 @@ var _chunkN4AQNEXRcjs = require('./chunk-N4AQNEXR.cjs');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkIZYFP7INcjs = require('./chunk-IZYFP7IN.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkI2BYNELAcjs = require('./chunk-I2BYNELA.cjs');
|
|
@@ -13,7 +13,7 @@ var _chunkI2BYNELAcjs = require('./chunk-I2BYNELA.cjs');
|
|
|
13
13
|
var _react = require('react');
|
|
14
14
|
function useServerQuery(query, input, options = {}) {
|
|
15
15
|
const cache = _chunkI2BYNELAcjs.getFarmClientDataCache.call(void 0, );
|
|
16
|
-
const key =
|
|
16
|
+
const key = _chunkIZYFP7INcjs.createServerQueryCallKey.call(void 0, query, input);
|
|
17
17
|
const inputRef = _react.useRef.call(void 0, input);
|
|
18
18
|
const optionsRef = _react.useRef.call(void 0, options);
|
|
19
19
|
const mountedKeyRef = _react.useRef.call(void 0, void 0);
|
|
@@ -35,7 +35,7 @@ function useServerQuery(query, input, options = {}) {
|
|
|
35
35
|
const run = _react.useCallback.call(void 0,
|
|
36
36
|
(force = false) => {
|
|
37
37
|
pendingInvalidationRef.current = false;
|
|
38
|
-
return
|
|
38
|
+
return _chunkIZYFP7INcjs.fetchServerQuery.call(void 0, query, inputRef.current, {
|
|
39
39
|
...optionsRef.current,
|
|
40
40
|
force
|
|
41
41
|
});
|
|
@@ -18,11 +18,16 @@ var _chunkHR5GU4UUcjs = require('./chunk-HR5GU4UU.cjs');
|
|
|
18
18
|
var _chunkNDOE76QCcjs = require('./chunk-NDOE76QC.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkBOEDYXAXcjs = require('./chunk-BOEDYXAX.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var _chunkXJDB564Acjs = require('./chunk-XJDB564A.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _chunkL2GUEYHRcjs = require('./chunk-L2GUEYHR.cjs');
|
|
26
31
|
|
|
27
32
|
|
|
28
33
|
var _chunk7Q7UB4TLcjs = require('./chunk-7Q7UB4TL.cjs');
|
|
@@ -35,16 +40,13 @@ var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
|
|
|
35
40
|
var _module = require('module');
|
|
36
41
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
37
42
|
var _url = require('url');
|
|
38
|
-
function hasFarmDocsRuntimeAdapter(docs) {
|
|
39
|
-
return Boolean(_optionalChain([docs, 'optionalAccess', _ => _.enabled]) && _optionalChain([docs, 'access', _2 => _2.adapter, 'optionalAccess', _3 => _3.server]) && docs.adapter.react);
|
|
40
|
-
}
|
|
41
43
|
function farmDocsAdapterServesGuardedPages(docs) {
|
|
42
44
|
return Boolean(
|
|
43
|
-
hasFarmDocsRuntimeAdapter(docs) && _optionalChain([docs, 'access',
|
|
45
|
+
_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, docs) && _optionalChain([docs, 'access', _ => _.adapter, 'access', _2 => _2.capabilities, 'optionalAccess', _3 => _3.includes, 'call', _4 => _4("guarded-pages")])
|
|
44
46
|
);
|
|
45
47
|
}
|
|
46
48
|
function assertFarmDocsAdapterServesNoGuardedPages(docs, options, isPathGuarded, runtime = "node") {
|
|
47
|
-
if (!isPathGuarded || !hasFarmDocsRuntimeAdapter(docs)) return;
|
|
49
|
+
if (!isPathGuarded || !_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, docs)) return;
|
|
48
50
|
const servesGuardedPages = farmDocsAdapterServesGuardedPages(docs);
|
|
49
51
|
if (servesGuardedPages && runtime !== "edge") return;
|
|
50
52
|
const guarded = _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, docs).flatMap((root) => _chunkHR5GU4UUcjs.discoverFarmDocsPages.call(void 0, _chunkHR5GU4UUcjs.resolveFarmDocsContentDir.call(void 0, root, options), root)).filter((page) => isPathGuarded(page.href) || isPathGuarded(_chunkHR5GU4UUcjs.getFarmDocsMarkdownPath.call(void 0, page.href))).map((page) => page.href);
|
|
@@ -59,10 +61,10 @@ function assertFarmDocsAdapterServesNoGuardedPages(docs, options, isPathGuarded,
|
|
|
59
61
|
);
|
|
60
62
|
}
|
|
61
63
|
async function loadFarmDocsConfigModule(docs, loadModule) {
|
|
62
|
-
const configModule =
|
|
64
|
+
const configModule = _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, docs);
|
|
63
65
|
if (!configModule) return void 0;
|
|
64
66
|
const loaded = await loadModule(configModule);
|
|
65
|
-
const config = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess',
|
|
67
|
+
const config = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _5 => _5.default]), () => ( loaded));
|
|
66
68
|
return config && typeof config === "object" ? config : void 0;
|
|
67
69
|
}
|
|
68
70
|
function getFarmDocsConfigModuleRoot(moduleConfig, entry) {
|
|
@@ -87,10 +89,10 @@ function getFarmDocsAdapterStylesheets(options) {
|
|
|
87
89
|
);
|
|
88
90
|
}
|
|
89
91
|
async function compileFarmDocsAdapterEdgeManifest(docs, options) {
|
|
90
|
-
if (!hasFarmDocsRuntimeAdapter(docs)) {
|
|
91
|
-
throw new Error("Farm docs adapter requires server and
|
|
92
|
+
if (!_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, docs)) {
|
|
93
|
+
throw new Error("Farm docs adapter requires `server` and `ui` entries.");
|
|
92
94
|
}
|
|
93
|
-
if (_optionalChain([docs, 'access',
|
|
95
|
+
if (_optionalChain([docs, 'access', _6 => _6.roots, 'optionalAccess', _7 => _7.length])) {
|
|
94
96
|
throw new Error(
|
|
95
97
|
"Several docs roots are not supported on edge deployments yet; they need a Node.js deployment target."
|
|
96
98
|
);
|
|
@@ -136,7 +138,7 @@ async function compileFarmDocsAdapterEdgeManifest(docs, options) {
|
|
|
136
138
|
return manifest;
|
|
137
139
|
}
|
|
138
140
|
async function listFarmDocsAdapterPages(docs, options) {
|
|
139
|
-
if (!hasFarmDocsRuntimeAdapter(docs)) return null;
|
|
141
|
+
if (!_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, docs)) return null;
|
|
140
142
|
const requireFromApp = _module.createRequire.call(void 0, _path2.default.join(options.root, "package.json"));
|
|
141
143
|
const serverModule = await import(
|
|
142
144
|
/* @vite-ignore */
|
|
@@ -163,14 +165,14 @@ async function listFarmDocsPagePaths(docs, options) {
|
|
|
163
165
|
);
|
|
164
166
|
}
|
|
165
167
|
async function createFarmDocsAdapterHandler(docs, options) {
|
|
166
|
-
if (!hasFarmDocsRuntimeAdapter(docs)) {
|
|
167
|
-
throw new Error("Farm docs adapter requires server and
|
|
168
|
+
if (!_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, docs)) {
|
|
169
|
+
throw new Error("Farm docs adapter requires `server` and `ui` entries.");
|
|
168
170
|
}
|
|
169
171
|
assertFarmDocsAdapterServesNoGuardedPages(docs, options, options.isPathGuarded);
|
|
170
172
|
const serverModule = await options.loadModule(
|
|
171
173
|
docs.adapter.server
|
|
172
174
|
);
|
|
173
|
-
const multiRoot = Boolean(_optionalChain([docs, 'access',
|
|
175
|
+
const multiRoot = Boolean(_optionalChain([docs, 'access', _8 => _8.roots, 'optionalAccess', _9 => _9.length]));
|
|
174
176
|
const handlerExport = multiRoot ? "createFarmDocsMultiRuntimeHandler" : "createFarmDocsRuntimeHandler";
|
|
175
177
|
if (typeof serverModule[handlerExport] !== "function") {
|
|
176
178
|
const adapterId = JSON.stringify(docs.adapter.id);
|
|
@@ -180,12 +182,16 @@ async function createFarmDocsAdapterHandler(docs, options) {
|
|
|
180
182
|
);
|
|
181
183
|
}
|
|
182
184
|
const moduleConfig = await loadFarmDocsConfigModule(docs, options.loadModule);
|
|
185
|
+
const uiModule = _chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, docs.adapter);
|
|
186
|
+
const loadUIModule = () => options.loadModule(uiModule);
|
|
183
187
|
const handlerOptions = {
|
|
184
188
|
rootDir: options.root,
|
|
185
189
|
clientEntry: options.clientEntry,
|
|
186
190
|
stylesheets: getFarmDocsAdapterStylesheets(options),
|
|
187
191
|
resolveLayoutFonts: options.resolveLayoutFonts,
|
|
188
|
-
|
|
192
|
+
loadUIModule,
|
|
193
|
+
..._chunkL2GUEYHRcjs.getFarmDocsAdapterRenderer.call(void 0, docs.adapter) === "react" ? { loadReactModule: loadUIModule } : {},
|
|
194
|
+
...options.rendererServer ? { loadRenderer: () => options.loadModule(options.rendererServer) } : {},
|
|
189
195
|
...options.registerMCPServer ? { registerMCPServer: options.registerMCPServer } : {},
|
|
190
196
|
...options.isPathGuarded && farmDocsAdapterServesGuardedPages(docs) ? { isPathGuarded: options.isPathGuarded } : {}
|
|
191
197
|
};
|
|
@@ -235,7 +241,7 @@ function omitHeadBody(response) {
|
|
|
235
241
|
});
|
|
236
242
|
}
|
|
237
243
|
function normalizeAction(value) {
|
|
238
|
-
return _optionalChain([value, 'optionalAccess',
|
|
244
|
+
return _optionalChain([value, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11(), 'access', _12 => _12.toLowerCase, 'call', _13 => _13(), 'access', _14 => _14.replace, 'call', _15 => _15(/_/g, "-")]) || void 0;
|
|
239
245
|
}
|
|
240
246
|
function getDocsTitle(docs) {
|
|
241
247
|
return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
|
|
@@ -334,7 +340,7 @@ function getDocsAPIFormat(request) {
|
|
|
334
340
|
return normalizeAction(url.searchParams.get("format") || url.searchParams.get("type")) || getDocsAPIPathTarget(request).format;
|
|
335
341
|
}
|
|
336
342
|
function getDocsDescription(docs) {
|
|
337
|
-
return _optionalChain([docs, 'access',
|
|
343
|
+
return _optionalChain([docs, 'access', _16 => _16.config, 'access', _17 => _17.metadata, 'optionalAccess', _18 => _18.description]);
|
|
338
344
|
}
|
|
339
345
|
function getLoadedDocsPages(context) {
|
|
340
346
|
return _chunkHR5GU4UUcjs.discoverFarmDocsPages.call(void 0, context.contentDir, context.docs).filter((page) => !context.isPathGuarded(page.href)).map((page) => _chunkHR5GU4UUcjs.loadFarmDocsPage.call(void 0, context.contentDir, context.docs, page.slug)).filter((page) => Boolean(page));
|
|
@@ -496,7 +502,7 @@ function redactDocsConfigValue(value, key, inHeaders) {
|
|
|
496
502
|
);
|
|
497
503
|
}
|
|
498
504
|
if (value === null || value === void 0 || typeof value === "function") return value;
|
|
499
|
-
return inHeaders ||
|
|
505
|
+
return inHeaders || _chunkXJDB564Acjs.isSecretDocsConfigKey.call(void 0, key) ? REDACTED_DOCS_CONFIG_VALUE : value;
|
|
500
506
|
}
|
|
501
507
|
function toPublicDocsPath(value, root) {
|
|
502
508
|
if (typeof value !== "string" || !value) return void 0;
|
|
@@ -573,19 +579,19 @@ async function searchDocs(context, request, query) {
|
|
|
573
579
|
const page = sourcePageByUrl.get(pageUrl);
|
|
574
580
|
return {
|
|
575
581
|
...result,
|
|
576
|
-
title: _optionalChain([page, 'optionalAccess',
|
|
577
|
-
href: _optionalChain([page, 'optionalAccess',
|
|
578
|
-
description: result.description || _optionalChain([page, 'optionalAccess',
|
|
582
|
+
title: _optionalChain([page, 'optionalAccess', _19 => _19.title]) || result.content,
|
|
583
|
+
href: _optionalChain([page, 'optionalAccess', _20 => _20.url]) || pageUrl,
|
|
584
|
+
description: result.description || _optionalChain([page, 'optionalAccess', _21 => _21.description])
|
|
579
585
|
};
|
|
580
586
|
});
|
|
581
587
|
}
|
|
582
588
|
async function resolveAPIContext(options) {
|
|
583
589
|
await _chunkNDOE76QCcjs.loadFarmDocsEngine.call(void 0, );
|
|
584
590
|
const runtimeConfig = globalThis.__FARM_DOCS_RUNTIME_CONFIG__;
|
|
585
|
-
const root = options.rootDir || options.root || _optionalChain([runtimeConfig, 'optionalAccess',
|
|
586
|
-
const srcDir = options.srcDir || _optionalChain([runtimeConfig, 'optionalAccess',
|
|
591
|
+
const root = options.rootDir || options.root || _optionalChain([runtimeConfig, 'optionalAccess', _22 => _22.root]) || process.cwd();
|
|
592
|
+
const srcDir = options.srcDir || _optionalChain([runtimeConfig, 'optionalAccess', _23 => _23.srcDir]) || "src";
|
|
587
593
|
const canUseRuntimeDocs = options.docs === void 0 && options.config === void 0 && options.configPath === void 0 && options.entry === void 0 && options.docsPath === void 0 && options.contentDir === void 0 && options.root === void 0 && options.rootDir === void 0 && options.srcDir === void 0;
|
|
588
|
-
const docsInput = _nullishCoalesce(_nullishCoalesce(options.docs, () => ( (canUseRuntimeDocs ? _optionalChain([runtimeConfig, 'optionalAccess',
|
|
594
|
+
const docsInput = _nullishCoalesce(_nullishCoalesce(options.docs, () => ( (canUseRuntimeDocs ? _optionalChain([runtimeConfig, 'optionalAccess', _24 => _24.docs]) : void 0))), () => ( {
|
|
589
595
|
enabled: true,
|
|
590
596
|
entry: options.entry,
|
|
591
597
|
docsPath: options.docsPath,
|
|
@@ -593,8 +599,8 @@ async function resolveAPIContext(options) {
|
|
|
593
599
|
config: options.config,
|
|
594
600
|
configPath: options.configPath
|
|
595
601
|
}));
|
|
596
|
-
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await
|
|
597
|
-
const guardedPaths = new Set(_nullishCoalesce(_optionalChain([runtimeConfig, 'optionalAccess',
|
|
602
|
+
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkBOEDYXAXcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
|
|
603
|
+
const guardedPaths = new Set(_nullishCoalesce(_optionalChain([runtimeConfig, 'optionalAccess', _25 => _25.guardedPaths]), () => ( [])));
|
|
598
604
|
return {
|
|
599
605
|
root,
|
|
600
606
|
srcDir,
|
|
@@ -602,7 +608,7 @@ async function resolveAPIContext(options) {
|
|
|
602
608
|
contentDir: _chunkHR5GU4UUcjs.resolveFarmDocsContentDir.call(void 0, docs, { root, srcDir }),
|
|
603
609
|
diagnostics: options.diagnostics === true,
|
|
604
610
|
isPathGuarded: _nullishCoalesce(options.isPathGuarded, () => ( ((pathname) => guardedPaths.has(pathname)))),
|
|
605
|
-
basePath: _chunkD22BUQKWcjs.normalizeFarmBasePath.call(void 0, _nullishCoalesce(options.basePath, () => ( _optionalChain([runtimeConfig, 'optionalAccess',
|
|
611
|
+
basePath: _chunkD22BUQKWcjs.normalizeFarmBasePath.call(void 0, _nullishCoalesce(options.basePath, () => ( _optionalChain([runtimeConfig, 'optionalAccess', _26 => _26.basePath]))))
|
|
606
612
|
};
|
|
607
613
|
}
|
|
608
614
|
async function handleDocsAPIGet(request, context) {
|
|
@@ -743,5 +749,4 @@ function createFarmDocsAPIHandler(options = {}, cloudIntegration) {
|
|
|
743
749
|
|
|
744
750
|
|
|
745
751
|
|
|
746
|
-
|
|
747
|
-
exports.hasFarmDocsRuntimeAdapter = hasFarmDocsRuntimeAdapter; exports.farmDocsAdapterServesGuardedPages = farmDocsAdapterServesGuardedPages; exports.assertFarmDocsAdapterServesNoGuardedPages = assertFarmDocsAdapterServesNoGuardedPages; exports.getFarmDocsConfigModuleRoot = getFarmDocsConfigModuleRoot; exports.compileFarmDocsAdapterEdgeManifest = compileFarmDocsAdapterEdgeManifest; exports.listFarmDocsAdapterPages = listFarmDocsAdapterPages; exports.listFarmDocsPagePaths = listFarmDocsPagePaths; exports.createFarmDocsAdapterHandler = createFarmDocsAdapterHandler; exports.isFarmDocsAPIRequest = isFarmDocsAPIRequest; exports.createDocsAPI = createDocsAPI; exports.createFarmDocsAPIHandler = createFarmDocsAPIHandler;
|
|
752
|
+
exports.farmDocsAdapterServesGuardedPages = farmDocsAdapterServesGuardedPages; exports.assertFarmDocsAdapterServesNoGuardedPages = assertFarmDocsAdapterServesNoGuardedPages; exports.getFarmDocsConfigModuleRoot = getFarmDocsConfigModuleRoot; exports.compileFarmDocsAdapterEdgeManifest = compileFarmDocsAdapterEdgeManifest; exports.listFarmDocsAdapterPages = listFarmDocsAdapterPages; exports.listFarmDocsPagePaths = listFarmDocsPagePaths; exports.createFarmDocsAdapterHandler = createFarmDocsAdapterHandler; exports.isFarmDocsAPIRequest = isFarmDocsAPIRequest; exports.createDocsAPI = createDocsAPI; exports.createFarmDocsAPIHandler = createFarmDocsAPIHandler;
|
|
@@ -1,10 +1,16 @@
|
|
|
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; }
|
|
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 _chunkL2GUEYHRcjs = require('./chunk-L2GUEYHR.cjs');
|
|
4
|
+
|
|
5
|
+
// src/docs/adapter-client.ts
|
|
2
6
|
function getFarmDocsAdapterConfigModule(docs) {
|
|
3
|
-
if (!_optionalChain([docs, 'optionalAccess', _ => _.enabled]) || !
|
|
7
|
+
if (!_optionalChain([docs, 'optionalAccess', _ => _.enabled]) || !_chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, docs.adapter) || !docs.configPath) {
|
|
8
|
+
return void 0;
|
|
9
|
+
}
|
|
4
10
|
return docs.configPath.endsWith(".json") ? void 0 : docs.configPath.replace(/\\/g, "/");
|
|
5
11
|
}
|
|
6
|
-
function generateFarmDocsAdapterClientRuntime(
|
|
7
|
-
if (!
|
|
12
|
+
function generateFarmDocsAdapterClientRuntime(uiModule, configModule, rendererClient) {
|
|
13
|
+
if (!uiModule) {
|
|
8
14
|
return `
|
|
9
15
|
async function hydrateFarmDocsAdapterRuntime() {
|
|
10
16
|
return false;
|
|
@@ -18,17 +24,19 @@ async function hydrateFarmDocsAdapterRuntime() {
|
|
|
18
24
|
// The docs server flags pages whose config holds what its JSON copy cannot (icons,
|
|
19
25
|
// MDX components, callbacks); the adapter restores those from the module itself.
|
|
20
26
|
// Fetch it alongside the adapter rather than after it: they don't depend on each other.
|
|
21
|
-
const [
|
|
22
|
-
import(${JSON.stringify(
|
|
23
|
-
runtime.configModule ? ${configModule ? `import(${JSON.stringify(configModule)})` : "undefined"} : undefined
|
|
27
|
+
const [FarmDocsAdapterUI, configModule${rendererClient ? ", renderer" : ""}] = await Promise.all([
|
|
28
|
+
import(${JSON.stringify(uiModule)}),
|
|
29
|
+
runtime.configModule ? ${configModule ? `import(${JSON.stringify(configModule)})` : "undefined"} : undefined,${rendererClient ? `
|
|
30
|
+
import(${JSON.stringify(rendererClient)}),` : ""}
|
|
24
31
|
]);
|
|
25
|
-
if (typeof
|
|
32
|
+
if (typeof FarmDocsAdapterUI.hydrateFarmDocs !== "function") {
|
|
26
33
|
throw new Error("The configured Farm docs adapter does not export hydrateFarmDocs().");
|
|
27
34
|
}
|
|
28
|
-
|
|
35
|
+
FarmDocsAdapterUI.hydrateFarmDocs({
|
|
29
36
|
config: runtime.config || {},
|
|
30
37
|
data: runtime.data,
|
|
31
|
-
...(configModule ? { configModule: configModule.default ?? configModule } : {})
|
|
38
|
+
...(configModule ? { configModule: configModule.default ?? configModule } : {}),${rendererClient ? `
|
|
39
|
+
renderer,` : ""}
|
|
32
40
|
});
|
|
33
41
|
return true;
|
|
34
42
|
}
|