@farm.js/core 0.1.19 → 0.1.20
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 -3
- package/dist/agent-runtime.d.ts +2 -3
- package/dist/api/route-manager.cjs +5 -5
- package/dist/api/route-manager.d.mts +2 -3
- package/dist/api/route-manager.d.ts +2 -3
- package/dist/api/route-manager.mjs +4 -4
- package/dist/api.cjs +6 -6
- package/dist/api.d.mts +3 -4
- package/dist/api.d.ts +3 -4
- package/dist/api.mjs +5 -5
- package/dist/{app-BHY_10Lm.d.ts → app-DAyPE-gr.d.ts} +11 -4
- package/dist/{app-BMk0do23.d.mts → app-D_6nTit-.d.mts} +11 -4
- package/dist/app-markdown.d.mts +3 -4
- package/dist/app-markdown.d.ts +3 -4
- package/dist/{chunk-FS7FLPOG.mjs → chunk-2J7W2WND.mjs} +3 -2
- package/dist/{chunk-YS3TRKCG.mjs → chunk-2M435BUE.mjs} +6 -1
- package/dist/{chunk-WJ3HK3LJ.cjs → chunk-2QLBIPFT.cjs} +4 -4
- package/dist/{chunk-FJSWYIR7.cjs → chunk-3IL5UC5I.cjs} +2 -2
- package/dist/chunk-43FMW62B.mjs +67 -0
- package/dist/{chunk-A7T6345N.mjs → chunk-5UX4C5QI.mjs} +10 -7
- package/dist/{chunk-FVZGEVTO.mjs → chunk-5V37LKBG.mjs} +102 -38
- package/dist/chunk-75WGQVQA.cjs +46 -0
- package/dist/{chunk-RFYO7QUD.cjs → chunk-A7T6JZNI.cjs} +1 -1
- package/dist/{chunk-AFOD3LYZ.cjs → chunk-B3WK4DTX.cjs} +10 -9
- package/dist/{chunk-AORPIPNB.cjs → chunk-BHJUZ64B.cjs} +18 -14
- package/dist/chunk-BMWDEBXO.cjs +67 -0
- package/dist/{chunk-ATERBVHQ.mjs → chunk-CQHFU55R.mjs} +5 -4
- package/dist/{chunk-XSKZORAS.cjs → chunk-DX4VKYAJ.cjs} +5 -5
- package/dist/{chunk-2GNATDDE.mjs → chunk-F7E2AZKQ.mjs} +1 -1
- package/dist/{chunk-7WPA7GBZ.mjs → chunk-GHFS7RUB.mjs} +1 -1
- package/dist/{chunk-NSFC3LHB.cjs → chunk-GQFSCBKJ.cjs} +234 -170
- package/dist/{chunk-NZ2JVBT2.mjs → chunk-GZ3ZPTQV.mjs} +2 -2
- package/dist/{chunk-RKQVJN2O.mjs → chunk-JIKGGIOL.mjs} +1 -1
- package/dist/{chunk-WZXN4R5Y.mjs → chunk-K6MG3SEG.mjs} +106 -75
- package/dist/{chunk-OXSIH4D6.cjs → chunk-KNPRCKXK.cjs} +6 -1
- package/dist/{chunk-2ANEVVF7.mjs → chunk-NRS46D4L.mjs} +1 -1
- package/dist/{chunk-A72YEUZ3.mjs → chunk-OCE65DDM.mjs} +1 -1
- package/dist/{chunk-UDBJCUPA.mjs → chunk-PUCUVI7K.mjs} +11 -7
- package/dist/{chunk-XDGMADQM.cjs → chunk-PZX6I4JW.cjs} +384 -353
- package/dist/{chunk-GDSHDTJ4.cjs → chunk-Q5B3KJBP.cjs} +2 -2
- package/dist/{chunk-TSWW5BVH.mjs → chunk-QMV4QELL.mjs} +1 -1
- package/dist/{chunk-V4AICMQA.mjs → chunk-RMIJFZU3.mjs} +26 -2
- package/dist/{chunk-MKB2EGIR.cjs → chunk-SOR334EB.cjs} +3 -2
- package/dist/{chunk-57J3Y7Y3.mjs → chunk-TIKNUAU7.mjs} +3 -2
- package/dist/chunk-VVBO3QH7.mjs +46 -0
- package/dist/{chunk-QBPKKQTD.mjs → chunk-W7MZXRXM.mjs} +19 -4
- package/dist/{chunk-Y53ZSFN6.cjs → chunk-WM6HL7E7.cjs} +4 -3
- package/dist/{chunk-GPVTX3HT.cjs → chunk-XFFQSD2F.cjs} +2 -2
- package/dist/{chunk-62YJ2IEB.cjs → chunk-XI3GWPUS.cjs} +23 -20
- package/dist/{chunk-KVFPGF2M.cjs → chunk-YJJLXIIS.cjs} +7 -7
- package/dist/{chunk-U5BMPGS3.cjs → chunk-YP5JZ4LF.cjs} +32 -8
- package/dist/{chunk-S27FMYAM.cjs → chunk-ZE6ONQ5R.cjs} +28 -13
- package/dist/{client-plugins-JXXmZliS.d.mts → client-plugins-CWrhb1ir.d.mts} +26 -3
- package/dist/{client-plugins-C089bQhN.d.ts → client-plugins-DPf0qZey.d.ts} +26 -3
- package/dist/client-plugins.d.mts +2 -3
- package/dist/client-plugins.d.ts +2 -3
- package/dist/client.cjs +4 -4
- package/dist/client.d.mts +9 -38
- package/dist/client.d.ts +9 -38
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +2 -3
- package/dist/config.d.ts +2 -3
- package/dist/{devtools-FY5R7TQ4.mjs → devtools-MTB5SA2B.mjs} +3 -3
- package/dist/{devtools-5KGPDVKL.cjs → devtools-R6MDDAZK.cjs} +7 -7
- package/dist/docs.cjs +6 -5
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +5 -4
- package/dist/index.cjs +21 -20
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +20 -19
- package/dist/integrations.d.mts +2 -3
- package/dist/integrations.d.ts +2 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -3
- package/dist/internal/app-markdown-runtime.d.ts +2 -3
- package/dist/internal/build-runtime.cjs +15 -14
- package/dist/internal/build-runtime.d.mts +4 -5
- package/dist/internal/build-runtime.d.ts +4 -5
- package/dist/internal/build-runtime.mjs +14 -13
- package/dist/internal/cli-runtime.cjs +7 -7
- package/dist/internal/cli-runtime.mjs +6 -6
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +2 -3
- package/dist/internal/compression-runtime.d.ts +2 -3
- package/dist/internal/config-runtime.cjs +4 -4
- package/dist/internal/config-runtime.d.mts +3 -4
- package/dist/internal/config-runtime.d.ts +3 -4
- package/dist/internal/config-runtime.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +2 -2
- package/dist/internal/production-runtime.d.mts +8 -9
- package/dist/internal/production-runtime.d.ts +8 -9
- package/dist/internal/production-runtime.mjs +1 -1
- package/dist/{metadata-C1Z9vLbb.d.mts → metadata-CO9fRyyJ.d.mts} +1 -1
- package/dist/{metadata-BcNJP4fq.d.ts → metadata-zY9wltwH.d.ts} +1 -1
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +4 -11
- package/dist/middleware.d.ts +4 -11
- package/dist/middleware.mjs +3 -3
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +42 -3
- package/dist/navigation.d.ts +42 -3
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-CVZ36JM5.mjs → nitro-4LFVTT24.mjs} +2 -2
- package/dist/{nitro-4I2MYLY2.cjs → nitro-TSGDUJMN.cjs} +3 -3
- package/dist/plugin.cjs +17 -11
- package/dist/plugin.d.mts +3 -4
- package/dist/plugin.d.ts +3 -4
- package/dist/plugin.mjs +17 -11
- package/dist/{production-runtime-jcrTlRTb.d.mts → production-runtime-CywsHwnG.d.mts} +1 -1
- package/dist/{production-runtime-oKmC0WU-.d.ts → production-runtime-lkfwujwK.d.ts} +1 -1
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-DOB9cV-h.d.ts → render-plan-DHF0GeWo.d.ts} +1 -1
- package/dist/{render-plan-BLIfc4jt.d.mts → render-plan-LVy6sGQe.d.mts} +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +4 -5
- package/dist/renderer-client.d.ts +4 -5
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +3 -0
- package/dist/renderer.d.ts +3 -0
- package/dist/{request-Cr53NRHr.d.mts → request-6AkmhEYE.d.mts} +1 -1
- package/dist/{request-Dt2gNuQD.d.ts → request-BYxlRqA9.d.ts} +1 -1
- package/dist/request.d.mts +3 -4
- package/dist/request.d.ts +3 -4
- package/dist/{route-rendering-CWYd8Mv1.d.ts → route-rendering-CWaKiUbS.d.ts} +1 -1
- package/dist/{route-rendering-CeFBEAoZ.d.mts → route-rendering-Dd8Jmml7.d.mts} +1 -1
- package/dist/router-B2m4fvve.d.ts +50 -0
- package/dist/router-xwEE112q.d.mts +50 -0
- package/dist/routes.cjs +3 -3
- package/dist/routes.d.mts +2 -3
- package/dist/routes.d.ts +2 -3
- package/dist/routes.mjs +2 -2
- package/dist/server-plugins.d.mts +3 -4
- package/dist/server-plugins.d.ts +3 -4
- package/dist/server.cjs +25 -24
- package/dist/server.d.mts +8 -9
- package/dist/server.d.ts +8 -9
- package/dist/server.mjs +12 -11
- package/dist/{spa-router-CQWiYGxS.d.mts → spa-router-DVEHQnWo.d.mts} +3 -3
- package/dist/{spa-router-Wjiw-8hB.d.ts → spa-router-Y8rrXTVK.d.ts} +3 -3
- package/dist/testing.cjs +6 -6
- package/dist/testing.d.mts +2 -3
- package/dist/testing.d.ts +2 -3
- package/dist/testing.mjs +5 -5
- package/dist/{types-D-1WTE72.d.mts → types-DFbjpjXX.d.mts} +8 -0
- package/dist/{types-D-1WTE72.d.ts → types-DFbjpjXX.d.ts} +8 -0
- package/dist/{utils-uUxF0K0P.d.mts → utils-DSPx34-A.d.mts} +1 -1
- package/dist/{utils-B0XJmG_b.d.ts → utils-Dvuny_08.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +12 -11
- package/dist/vite.d.mts +2 -3
- package/dist/vite.d.ts +2 -3
- package/dist/vite.mjs +11 -10
- package/package.json +3 -3
- package/dist/chunk-7GNWGLWB.mjs +0 -14
- package/dist/chunk-VQDBNVOO.cjs +0 -14
- package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
- package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
- /package/dist/{chunk-IAMRBF3Z.cjs → chunk-N4RLRSWW.cjs} +0 -0
- /package/dist/{chunk-BNGS6KJ6.mjs → chunk-YOYF2E4U.mjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
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 _chunkSOR334EBcjs = require('./chunk-SOR334EB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkDVM4FKZLcjs = require('./chunk-DVM4FKZL.cjs');
|
|
@@ -34,7 +34,7 @@ function normalizeRouteRules(routeRules) {
|
|
|
34
34
|
}
|
|
35
35
|
normalized[normalizedSource] = {
|
|
36
36
|
...rule,
|
|
37
|
-
...
|
|
37
|
+
..._chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0, rule, `Route rule "${normalizedSource}"`)
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
return normalized;
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
normalizeRouteRules,
|
|
12
12
|
routeRulesToHeaders,
|
|
13
13
|
routeRulesToRedirects
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GHFS7RUB.mjs";
|
|
15
15
|
import {
|
|
16
16
|
loadFarmConfigFile,
|
|
17
17
|
resolveFarmLayers
|
|
@@ -460,6 +460,12 @@ function cloneSerializable(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
460
460
|
return void 0;
|
|
461
461
|
}
|
|
462
462
|
__name(cloneSerializable, "cloneSerializable");
|
|
463
|
+
function omitUndefined(value) {
|
|
464
|
+
return Object.fromEntries(
|
|
465
|
+
Object.entries(value).filter(([, entry]) => entry !== void 0)
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
__name(omitUndefined, "omitUndefined");
|
|
463
469
|
function sanitizeDocsConfig(config) {
|
|
464
470
|
return cloneSerializable(config) || {};
|
|
465
471
|
}
|
|
@@ -575,6 +581,17 @@ async function resolveDocsConfig(userDocs, options = {}) {
|
|
|
575
581
|
...inlineDocsConfig,
|
|
576
582
|
...directDocsConfig
|
|
577
583
|
};
|
|
584
|
+
const runtimeDocsConfig = {
|
|
585
|
+
...loadedConfig?.config || {},
|
|
586
|
+
...isRecord(docsOptions.config) ? docsOptions.config : {},
|
|
587
|
+
...omitUndefined({
|
|
588
|
+
...docsOptions,
|
|
589
|
+
adapter: void 0,
|
|
590
|
+
enabled: void 0,
|
|
591
|
+
config: void 0,
|
|
592
|
+
configPath: void 0
|
|
593
|
+
})
|
|
594
|
+
};
|
|
578
595
|
const explicitRoute = typeof docsOptions.entry === "string" ? docsOptions.entry : void 0;
|
|
579
596
|
const configuredDocsPath = typeof mergedDocsConfig.docsPath === "string" ? mergedDocsConfig.docsPath : void 0;
|
|
580
597
|
const configuredEntry = typeof mergedDocsConfig.entry === "string" ? mergedDocsConfig.entry : void 0;
|
|
@@ -597,7 +614,14 @@ async function resolveDocsConfig(userDocs, options = {}) {
|
|
|
597
614
|
entry: docsEntry,
|
|
598
615
|
docsPath: entryRoute,
|
|
599
616
|
...contentDir ? { contentDir } : {}
|
|
600
|
-
}
|
|
617
|
+
},
|
|
618
|
+
runtimeConfig: {
|
|
619
|
+
...runtimeDocsConfig,
|
|
620
|
+
entry: docsEntry,
|
|
621
|
+
docsPath: entryRoute,
|
|
622
|
+
...contentDir ? { contentDir } : {}
|
|
623
|
+
},
|
|
624
|
+
configOverrides: { ...inlineDocsConfig, ...directDocsConfig }
|
|
601
625
|
};
|
|
602
626
|
}
|
|
603
627
|
__name(resolveDocsConfig, "resolveDocsConfig");
|
|
@@ -7,10 +7,11 @@ function normalizeFarmRouteRuntimeConfig(value, source = "Route configuration")
|
|
|
7
7
|
if (!value) return {};
|
|
8
8
|
const normalized = {};
|
|
9
9
|
if (value.runtime !== void 0) {
|
|
10
|
-
|
|
10
|
+
const runtime = value.runtime === "nodejs" ? "node" : value.runtime;
|
|
11
|
+
if (runtime !== "auto" && runtime !== "node" && runtime !== "edge") {
|
|
11
12
|
throw new TypeError(`${source} runtime must be "auto", "node", or "edge"`);
|
|
12
13
|
}
|
|
13
|
-
normalized.runtime =
|
|
14
|
+
normalized.runtime = runtime;
|
|
14
15
|
}
|
|
15
16
|
if (value.regions !== void 0) {
|
|
16
17
|
if (value.regions === "auto") {
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
createCliColors
|
|
13
13
|
} from "./chunk-I2BHUNBU.mjs";
|
|
14
14
|
import {
|
|
15
|
+
loadFarmDevModule,
|
|
15
16
|
toFileModuleUrl
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-43FMW62B.mjs";
|
|
17
18
|
import {
|
|
18
19
|
logger
|
|
19
20
|
} from "./chunk-KI3MESHB.mjs";
|
|
@@ -297,7 +298,7 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
297
298
|
try {
|
|
298
299
|
let module;
|
|
299
300
|
if (this.viteServer) {
|
|
300
|
-
module = await this.viteServer
|
|
301
|
+
module = await loadFarmDevModule(this.viteServer, filePath);
|
|
301
302
|
} else {
|
|
302
303
|
module = await import(
|
|
303
304
|
/* @vite-ignore */
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
4
|
+
|
|
5
|
+
// src/docs/adapter-client.ts
|
|
6
|
+
function getFarmDocsAdapterConfigModule(docs) {
|
|
7
|
+
if (!docs?.enabled || !docs.adapter?.react || !docs.configPath) return void 0;
|
|
8
|
+
return docs.configPath.endsWith(".json") ? void 0 : docs.configPath.replace(/\\/g, "/");
|
|
9
|
+
}
|
|
10
|
+
__name(getFarmDocsAdapterConfigModule, "getFarmDocsAdapterConfigModule");
|
|
11
|
+
function generateFarmDocsAdapterClientRuntime(reactModule, configModule) {
|
|
12
|
+
if (!reactModule) {
|
|
13
|
+
return `
|
|
14
|
+
async function hydrateFarmDocsAdapterRuntime() {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
return `
|
|
20
|
+
async function hydrateFarmDocsAdapterRuntime() {
|
|
21
|
+
const runtime = window.__FARM_DOCS_ADAPTER__;
|
|
22
|
+
if (!runtime) return false;
|
|
23
|
+
const FarmDocsAdapterReact = await import(${JSON.stringify(reactModule)});
|
|
24
|
+
if (typeof FarmDocsAdapterReact.hydrateFarmDocs !== "function") {
|
|
25
|
+
throw new Error("The configured Farm docs adapter does not export hydrateFarmDocs().");
|
|
26
|
+
}
|
|
27
|
+
// The docs server flags pages whose config holds what its JSON copy cannot (icons,
|
|
28
|
+
// MDX components, callbacks); the adapter restores those from the module itself.
|
|
29
|
+
const configModule = runtime.configModule
|
|
30
|
+
? ${configModule ? `await import(${JSON.stringify(configModule)})` : "undefined"}
|
|
31
|
+
: undefined;
|
|
32
|
+
FarmDocsAdapterReact.hydrateFarmDocs({
|
|
33
|
+
config: runtime.config || {},
|
|
34
|
+
data: runtime.data,
|
|
35
|
+
...(configModule ? { configModule: configModule.default ?? configModule } : {}),
|
|
36
|
+
});
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
__name(generateFarmDocsAdapterClientRuntime, "generateFarmDocsAdapterClientRuntime");
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
getFarmDocsAdapterConfigModule,
|
|
45
|
+
generateFarmDocsAdapterClientRuntime
|
|
46
|
+
};
|
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-HSDL2AUR.mjs";
|
|
7
7
|
import {
|
|
8
8
|
resolveDocsConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RMIJFZU3.mjs";
|
|
10
|
+
import {
|
|
11
|
+
getFarmDocsAdapterConfigModule
|
|
12
|
+
} from "./chunk-VVBO3QH7.mjs";
|
|
10
13
|
import {
|
|
11
14
|
__name
|
|
12
15
|
} from "./chunk-LPEX4YW6.mjs";
|
|
@@ -19,9 +22,17 @@ function hasFarmDocsRuntimeAdapter(docs) {
|
|
|
19
22
|
return Boolean(docs?.enabled && docs.adapter?.server && docs.adapter.react);
|
|
20
23
|
}
|
|
21
24
|
__name(hasFarmDocsRuntimeAdapter, "hasFarmDocsRuntimeAdapter");
|
|
22
|
-
function
|
|
25
|
+
async function loadFarmDocsConfigModule(docs, loadModule) {
|
|
26
|
+
const configModule = getFarmDocsAdapterConfigModule(docs);
|
|
27
|
+
if (!configModule) return void 0;
|
|
28
|
+
const loaded = await loadModule(configModule);
|
|
29
|
+
const config = loaded?.default ?? loaded;
|
|
30
|
+
return config && typeof config === "object" ? config : void 0;
|
|
31
|
+
}
|
|
32
|
+
__name(loadFarmDocsConfigModule, "loadFarmDocsConfigModule");
|
|
33
|
+
function createFarmDocsAdapterRuntimeConfig(docs, options, moduleConfig) {
|
|
23
34
|
return {
|
|
24
|
-
...docs.config,
|
|
35
|
+
...moduleConfig ? { ...moduleConfig, ...docs.configOverrides } : docs.runtimeConfig ?? docs.config,
|
|
25
36
|
entry: docs.config.entry || docs.entry.replace(/^\/+|\/+$/g, "") || "docs",
|
|
26
37
|
docsPath: docs.entry,
|
|
27
38
|
contentDir: resolveFarmDocsContentDir(docs, options)
|
|
@@ -93,7 +104,11 @@ async function createFarmDocsAdapterHandler(docs, options) {
|
|
|
93
104
|
`Farm docs adapter ${adapterId} does not export createFarmDocsRuntimeHandler from ${serverEntry}. Upgrade the adapter to a runtime-enabled release.`
|
|
94
105
|
);
|
|
95
106
|
}
|
|
96
|
-
const runtimeConfig = createFarmDocsAdapterRuntimeConfig(
|
|
107
|
+
const runtimeConfig = createFarmDocsAdapterRuntimeConfig(
|
|
108
|
+
docs,
|
|
109
|
+
options,
|
|
110
|
+
await loadFarmDocsConfigModule(docs, options.loadModule)
|
|
111
|
+
);
|
|
97
112
|
return serverModule.createFarmDocsRuntimeHandler(runtimeConfig, {
|
|
98
113
|
rootDir: options.root,
|
|
99
114
|
clientEntry: options.clientEntry,
|
|
@@ -13,7 +13,8 @@ var _chunkXGC343EYcjs = require('./chunk-XGC343EY.cjs');
|
|
|
13
13
|
var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
var _chunkBMWDEBXOcjs = require('./chunk-BMWDEBXO.cjs');
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
@@ -297,11 +298,11 @@ var _MiddlewareManager = class _MiddlewareManager {
|
|
|
297
298
|
try {
|
|
298
299
|
let module;
|
|
299
300
|
if (this.viteServer) {
|
|
300
|
-
module = await this.viteServer
|
|
301
|
+
module = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, this.viteServer, filePath);
|
|
301
302
|
} else {
|
|
302
303
|
module = await import(
|
|
303
304
|
/* @vite-ignore */
|
|
304
|
-
|
|
305
|
+
_chunkBMWDEBXOcjs.toFileModuleUrl.call(void 0, filePath)
|
|
305
306
|
);
|
|
306
307
|
}
|
|
307
308
|
const normalized = _chunkXGC343EYcjs.normalizeMiddlewareModule.call(void 0, module, routePath);
|
|
@@ -26,7 +26,7 @@ var _chunkY4YMF2NQcjs = require('./chunk-Y4YMF2NQ.cjs');
|
|
|
26
26
|
var _chunkTFAXUHWXcjs = require('./chunk-TFAXUHWX.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunkN4RLRSWWcjs = require('./chunk-N4RLRSWW.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
var _chunkIQXFRNY2cjs = require('./chunk-IQXFRNY2.cjs');
|
|
@@ -805,7 +805,7 @@ async function createRouteTypeDeclarations(options, outPath) {
|
|
|
805
805
|
}
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
|
-
for (const route of await
|
|
808
|
+
for (const route of await _chunkN4RLRSWWcjs.discoverProgrammaticRoutePaths.call(void 0, source.root, source.srcDir)) {
|
|
809
809
|
patterns.add(route);
|
|
810
810
|
routeModulePatterns.add(route);
|
|
811
811
|
}
|
|
@@ -7,7 +7,7 @@ var _chunkSU7MH53Pcjs = require('./chunk-SU7MH53P.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk2QLBIPFTcjs = require('./chunk-2QLBIPFT.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunk5OVTOKGHcjs = require('./chunk-5OVTOKGH.cjs');
|
|
@@ -49,12 +49,15 @@ function shouldBlockUnload(options) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldBlockUnload, "shouldBlockUnload");
|
|
52
|
-
function navigateViaRouter(href, basePath, replace) {
|
|
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 = _chunk2QLBIPFTcjs.getInstalledFarmSPARouter.call(void 0, );
|
|
56
56
|
if (spaRouter) {
|
|
57
|
-
void spaRouter.navigate(url, {
|
|
57
|
+
void spaRouter.navigate(url, {
|
|
58
|
+
replace,
|
|
59
|
+
...options.scroll === void 0 ? {} : { scroll: options.scroll }
|
|
60
|
+
});
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
63
|
if (replace) {
|
|
@@ -62,7 +65,7 @@ function navigateViaRouter(href, basePath, replace) {
|
|
|
62
65
|
} else {
|
|
63
66
|
window.history.pushState(null, "", url);
|
|
64
67
|
}
|
|
65
|
-
|
|
68
|
+
_chunk2QLBIPFTcjs.notifyHistoryChange.call(void 0, "url-search");
|
|
66
69
|
}
|
|
67
70
|
_chunkS3JO3N4Hcjs.__name.call(void 0, navigateViaRouter, "navigateViaRouter");
|
|
68
71
|
function useRouter(options = {}) {
|
|
@@ -82,22 +85,22 @@ function useRouter(options = {}) {
|
|
|
82
85
|
setState(readRouterState(basePath, routeMatcher));
|
|
83
86
|
}, "handlePopState");
|
|
84
87
|
handlePopState();
|
|
85
|
-
const unsubscribe =
|
|
88
|
+
const unsubscribe = _chunk2QLBIPFTcjs.subscribeHistoryChange.call(void 0, handlePopState);
|
|
86
89
|
return unsubscribe;
|
|
87
90
|
}, [basePath, routeMatcher]);
|
|
88
|
-
const push = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (href) => {
|
|
89
|
-
navigateViaRouter(href, basePath, false);
|
|
91
|
+
const push = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (href, navigateOptions) => {
|
|
92
|
+
navigateViaRouter(href, basePath, false, navigateOptions);
|
|
90
93
|
}, "push");
|
|
91
|
-
const replace = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (href) => {
|
|
92
|
-
navigateViaRouter(href, basePath, true);
|
|
94
|
+
const replace = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (href, navigateOptions) => {
|
|
95
|
+
navigateViaRouter(href, basePath, true, navigateOptions);
|
|
93
96
|
}, "replace");
|
|
94
97
|
const pushState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
|
|
95
98
|
if (typeof window === "undefined") return;
|
|
96
|
-
|
|
99
|
+
_chunk2QLBIPFTcjs.getRouter.call(void 0, ).pushState(pageState, resolveClientHref(href, basePath));
|
|
97
100
|
}, "pushState");
|
|
98
101
|
const replaceState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
|
|
99
102
|
if (typeof window === "undefined") return;
|
|
100
|
-
|
|
103
|
+
_chunk2QLBIPFTcjs.getRouter.call(void 0, ).replaceState(pageState, resolveClientHref(href, basePath));
|
|
101
104
|
}, "replaceState");
|
|
102
105
|
const back = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
|
|
103
106
|
if (typeof window !== "undefined") {
|
|
@@ -121,25 +124,25 @@ function useRouter(options = {}) {
|
|
|
121
124
|
}
|
|
122
125
|
_chunkS3JO3N4Hcjs.__name.call(void 0, useRouter, "useRouter");
|
|
123
126
|
function usePageState() {
|
|
124
|
-
const [state, setState] = _react.useState.call(void 0, () =>
|
|
127
|
+
const [state, setState] = _react.useState.call(void 0, () => _chunk2QLBIPFTcjs.readPageState.call(void 0, ));
|
|
125
128
|
_react.useEffect.call(void 0, () => {
|
|
126
129
|
if (typeof window === "undefined") return;
|
|
127
130
|
const handlePopState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
|
|
128
|
-
setState(
|
|
131
|
+
setState(_chunk2QLBIPFTcjs.readPageState.call(void 0, ));
|
|
129
132
|
}, "handlePopState");
|
|
130
133
|
handlePopState();
|
|
131
|
-
return
|
|
134
|
+
return _chunk2QLBIPFTcjs.subscribeHistoryChange.call(void 0, handlePopState);
|
|
132
135
|
}, []);
|
|
133
136
|
return state;
|
|
134
137
|
}
|
|
135
138
|
_chunkS3JO3N4Hcjs.__name.call(void 0, usePageState, "usePageState");
|
|
136
139
|
function useNavigation() {
|
|
137
140
|
const [state, setState] = _react.useState.call(void 0,
|
|
138
|
-
() =>
|
|
141
|
+
() => _chunk2QLBIPFTcjs.getRouter.call(void 0, ).getNavigationState()
|
|
139
142
|
);
|
|
140
143
|
_react.useEffect.call(void 0, () => {
|
|
141
144
|
if (typeof window === "undefined") return;
|
|
142
|
-
return
|
|
145
|
+
return _chunk2QLBIPFTcjs.getRouter.call(void 0, ).subscribeNavigation(setState);
|
|
143
146
|
}, []);
|
|
144
147
|
return state;
|
|
145
148
|
}
|
|
@@ -152,7 +155,7 @@ function useBlocker(options) {
|
|
|
152
155
|
if (typeof window === "undefined" || !active) {
|
|
153
156
|
return;
|
|
154
157
|
}
|
|
155
|
-
return
|
|
158
|
+
return _chunk2QLBIPFTcjs.getRouter.call(void 0, ).addBlocker(
|
|
156
159
|
async (context) => {
|
|
157
160
|
const current = optionsRef.current;
|
|
158
161
|
const when = typeof current.when === "function" ? current.when(context) : current.when;
|
|
@@ -176,7 +179,7 @@ function useScrollRestoration(key) {
|
|
|
176
179
|
_react.useEffect.call(void 0, () => {
|
|
177
180
|
const element = ref.current;
|
|
178
181
|
if (!element) return;
|
|
179
|
-
return
|
|
182
|
+
return _chunk2QLBIPFTcjs.getRouter.call(void 0, ).registerScrollElement(key, element);
|
|
180
183
|
}, [key]);
|
|
181
184
|
return ref;
|
|
182
185
|
}
|
|
@@ -198,7 +201,7 @@ function readRouterState(basePath, routeMatcher) {
|
|
|
198
201
|
pathname,
|
|
199
202
|
searchParams: url.searchParams,
|
|
200
203
|
params: _optionalChain([routeMatcher, 'optionalAccess', _5 => _5.match, 'call', _6 => _6(routePathname), 'optionalAccess', _7 => _7.params]) || {},
|
|
201
|
-
pageState: typeof window === "undefined" ? null :
|
|
204
|
+
pageState: typeof window === "undefined" ? null : _chunk2QLBIPFTcjs.readPageState.call(void 0, )
|
|
202
205
|
};
|
|
203
206
|
}
|
|
204
207
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readRouterState, "readRouterState");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkXI3GWPUScjs = require('./chunk-XI3GWPUS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk2QLBIPFTcjs = require('./chunk-2QLBIPFT.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
@@ -13,7 +13,7 @@ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
|
13
13
|
|
|
14
14
|
// src/navigation.ts
|
|
15
15
|
function useRouter2() {
|
|
16
|
-
const router =
|
|
16
|
+
const router = _chunkXI3GWPUScjs.useRouter.call(void 0, );
|
|
17
17
|
return {
|
|
18
18
|
push: router.push,
|
|
19
19
|
replace: router.replace,
|
|
@@ -21,21 +21,21 @@ function useRouter2() {
|
|
|
21
21
|
forward: router.forward,
|
|
22
22
|
refresh() {
|
|
23
23
|
if (typeof window === "undefined") return Promise.resolve();
|
|
24
|
-
return
|
|
24
|
+
return _chunk2QLBIPFTcjs.getRouter.call(void 0, ).refresh();
|
|
25
25
|
},
|
|
26
26
|
prefetch(href) {
|
|
27
27
|
if (typeof window === "undefined") return Promise.resolve();
|
|
28
|
-
return
|
|
28
|
+
return _chunk2QLBIPFTcjs.getRouter.call(void 0, ).prefetch(_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href));
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
_chunkS3JO3N4Hcjs.__name.call(void 0, useRouter2, "useRouter");
|
|
33
33
|
function usePathname() {
|
|
34
|
-
return
|
|
34
|
+
return _chunkXI3GWPUScjs.useRouter.call(void 0, ).pathname;
|
|
35
35
|
}
|
|
36
36
|
_chunkS3JO3N4Hcjs.__name.call(void 0, usePathname, "usePathname");
|
|
37
37
|
function useSearchParams() {
|
|
38
|
-
return
|
|
38
|
+
return _chunkXI3GWPUScjs.useRouter.call(void 0, ).searchParams;
|
|
39
39
|
}
|
|
40
40
|
_chunkS3JO3N4Hcjs.__name.call(void 0, useSearchParams, "useSearchParams");
|
|
41
41
|
|
|
@@ -11,7 +11,7 @@ var _chunkYJRZR7VUcjs = require('./chunk-YJRZR7VU.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkQ5B3KJBPcjs = require('./chunk-Q5B3KJBP.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -460,6 +460,12 @@ function cloneSerializable(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
460
460
|
return void 0;
|
|
461
461
|
}
|
|
462
462
|
_chunkS3JO3N4Hcjs.__name.call(void 0, cloneSerializable, "cloneSerializable");
|
|
463
|
+
function omitUndefined(value) {
|
|
464
|
+
return Object.fromEntries(
|
|
465
|
+
Object.entries(value).filter(([, entry]) => entry !== void 0)
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, omitUndefined, "omitUndefined");
|
|
463
469
|
function sanitizeDocsConfig(config) {
|
|
464
470
|
return cloneSerializable(config) || {};
|
|
465
471
|
}
|
|
@@ -575,6 +581,17 @@ async function resolveDocsConfig(userDocs, options = {}) {
|
|
|
575
581
|
...inlineDocsConfig,
|
|
576
582
|
...directDocsConfig
|
|
577
583
|
};
|
|
584
|
+
const runtimeDocsConfig = {
|
|
585
|
+
..._optionalChain([loadedConfig, 'optionalAccess', _20 => _20.config]) || {},
|
|
586
|
+
...isRecord(docsOptions.config) ? docsOptions.config : {},
|
|
587
|
+
...omitUndefined({
|
|
588
|
+
...docsOptions,
|
|
589
|
+
adapter: void 0,
|
|
590
|
+
enabled: void 0,
|
|
591
|
+
config: void 0,
|
|
592
|
+
configPath: void 0
|
|
593
|
+
})
|
|
594
|
+
};
|
|
578
595
|
const explicitRoute = typeof docsOptions.entry === "string" ? docsOptions.entry : void 0;
|
|
579
596
|
const configuredDocsPath = typeof mergedDocsConfig.docsPath === "string" ? mergedDocsConfig.docsPath : void 0;
|
|
580
597
|
const configuredEntry = typeof mergedDocsConfig.entry === "string" ? mergedDocsConfig.entry : void 0;
|
|
@@ -591,13 +608,20 @@ async function resolveDocsConfig(userDocs, options = {}) {
|
|
|
591
608
|
entry: entryRoute,
|
|
592
609
|
...docsOptions.adapter ? { adapter: docsOptions.adapter } : {},
|
|
593
610
|
contentDir,
|
|
594
|
-
configPath: _optionalChain([loadedConfig, 'optionalAccess',
|
|
611
|
+
configPath: _optionalChain([loadedConfig, 'optionalAccess', _21 => _21.configPath]),
|
|
595
612
|
config: {
|
|
596
613
|
...mergedDocsConfig,
|
|
597
614
|
entry: docsEntry,
|
|
598
615
|
docsPath: entryRoute,
|
|
599
616
|
...contentDir ? { contentDir } : {}
|
|
600
|
-
}
|
|
617
|
+
},
|
|
618
|
+
runtimeConfig: {
|
|
619
|
+
...runtimeDocsConfig,
|
|
620
|
+
entry: docsEntry,
|
|
621
|
+
docsPath: entryRoute,
|
|
622
|
+
...contentDir ? { contentDir } : {}
|
|
623
|
+
},
|
|
624
|
+
configOverrides: { ...inlineDocsConfig, ...directDocsConfig }
|
|
601
625
|
};
|
|
602
626
|
}
|
|
603
627
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveDocsConfig, "resolveDocsConfig");
|
|
@@ -650,9 +674,9 @@ async function resolveConfig(userConfig, mode) {
|
|
|
650
674
|
validateConfigRouteSources(rewrites, "rewrites");
|
|
651
675
|
const headers = typeof userConfig.headers === "function" ? await userConfig.headers() : userConfig.headers || [];
|
|
652
676
|
validateConfigRouteSources(headers, "headers");
|
|
653
|
-
const routeRules =
|
|
654
|
-
const routeRuleRedirects =
|
|
655
|
-
const routeRuleHeaders =
|
|
677
|
+
const routeRules = _chunkQ5B3KJBPcjs.normalizeRouteRules.call(void 0, userConfig.routeRules);
|
|
678
|
+
const routeRuleRedirects = _chunkQ5B3KJBPcjs.routeRulesToRedirects.call(void 0, routeRules);
|
|
679
|
+
const routeRuleHeaders = _chunkQ5B3KJBPcjs.routeRulesToHeaders.call(void 0, routeRules);
|
|
656
680
|
const security = _chunkISTFC3MZcjs.resolveFarmSecurityConfig.call(void 0, userConfig.security);
|
|
657
681
|
const securityHeader = _chunkISTFC3MZcjs.getFarmSecurityHeader.call(void 0, security);
|
|
658
682
|
if (_chunkISTFC3MZcjs.farmCspBlocksFrameworkInlineScripts.call(void 0, security)) {
|
|
@@ -671,7 +695,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
671
695
|
const api = await _chunkS3A45T7Fcjs.resolveFarmAPIConfig.call(void 0, userConfig.api, { root, mode, env });
|
|
672
696
|
const auth = _chunkQBPXNZGVcjs.resolveFarmAuthConfig.call(void 0, userConfig.auth);
|
|
673
697
|
const mcp = resolveFarmMCPConfig(userConfig.mcp);
|
|
674
|
-
if (auth.enabled && _optionalChain([userConfig, 'access',
|
|
698
|
+
if (auth.enabled && _optionalChain([userConfig, 'access', _22 => _22.integrations, 'optionalAccess', _23 => _23.auth])) {
|
|
675
699
|
throw new Error(
|
|
676
700
|
"Choose either the top-level `auth` config or `integrations.auth`; they cannot both own the auth route."
|
|
677
701
|
);
|
|
@@ -681,7 +705,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
681
705
|
mode
|
|
682
706
|
});
|
|
683
707
|
const nativeMCPPlugin = await resolveFarmMCPPlugin(mcp, { root });
|
|
684
|
-
if (nativeMCPPlugin && _optionalChain([userConfig, 'access',
|
|
708
|
+
if (nativeMCPPlugin && _optionalChain([userConfig, 'access', _24 => _24.plugins, 'optionalAccess', _25 => _25.some, 'call', _26 => _26((plugin) => _optionalChain([plugin, 'optionalAccess', _27 => _27.name]) === "farm:api-mcp")])) {
|
|
685
709
|
throw new Error(
|
|
686
710
|
"Choose either the top-level `mcp` config or `apiMcp()` in `plugins`; they configure the same MCP transport."
|
|
687
711
|
);
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
var _chunkNBAHDVOJcjs = require('./chunk-NBAHDVOJ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkYP5JZ4LFcjs = require('./chunk-YP5JZ4LF.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk75WGQVQAcjs = require('./chunk-75WGQVQA.cjs');
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -19,9 +22,17 @@ function hasFarmDocsRuntimeAdapter(docs) {
|
|
|
19
22
|
return Boolean(_optionalChain([docs, 'optionalAccess', _ => _.enabled]) && _optionalChain([docs, 'access', _2 => _2.adapter, 'optionalAccess', _3 => _3.server]) && docs.adapter.react);
|
|
20
23
|
}
|
|
21
24
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmDocsRuntimeAdapter, "hasFarmDocsRuntimeAdapter");
|
|
22
|
-
function
|
|
25
|
+
async function loadFarmDocsConfigModule(docs, loadModule) {
|
|
26
|
+
const configModule = _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, docs);
|
|
27
|
+
if (!configModule) return void 0;
|
|
28
|
+
const loaded = await loadModule(configModule);
|
|
29
|
+
const config = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _4 => _4.default]), () => ( loaded));
|
|
30
|
+
return config && typeof config === "object" ? config : void 0;
|
|
31
|
+
}
|
|
32
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmDocsConfigModule, "loadFarmDocsConfigModule");
|
|
33
|
+
function createFarmDocsAdapterRuntimeConfig(docs, options, moduleConfig) {
|
|
23
34
|
return {
|
|
24
|
-
...docs.config,
|
|
35
|
+
...moduleConfig ? { ...moduleConfig, ...docs.configOverrides } : _nullishCoalesce(docs.runtimeConfig, () => ( docs.config)),
|
|
25
36
|
entry: docs.config.entry || docs.entry.replace(/^\/+|\/+$/g, "") || "docs",
|
|
26
37
|
docsPath: docs.entry,
|
|
27
38
|
contentDir: _chunkNBAHDVOJcjs.resolveFarmDocsContentDir.call(void 0, docs, options)
|
|
@@ -93,7 +104,11 @@ async function createFarmDocsAdapterHandler(docs, options) {
|
|
|
93
104
|
`Farm docs adapter ${adapterId} does not export createFarmDocsRuntimeHandler from ${serverEntry}. Upgrade the adapter to a runtime-enabled release.`
|
|
94
105
|
);
|
|
95
106
|
}
|
|
96
|
-
const runtimeConfig = createFarmDocsAdapterRuntimeConfig(
|
|
107
|
+
const runtimeConfig = createFarmDocsAdapterRuntimeConfig(
|
|
108
|
+
docs,
|
|
109
|
+
options,
|
|
110
|
+
await loadFarmDocsConfigModule(docs, options.loadModule)
|
|
111
|
+
);
|
|
97
112
|
return serverModule.createFarmDocsRuntimeHandler(runtimeConfig, {
|
|
98
113
|
rootDir: options.root,
|
|
99
114
|
clientEntry: options.clientEntry,
|
|
@@ -156,7 +171,7 @@ function omitHeadBody(response) {
|
|
|
156
171
|
}
|
|
157
172
|
_chunkS3JO3N4Hcjs.__name.call(void 0, omitHeadBody, "omitHeadBody");
|
|
158
173
|
function normalizeAction(value) {
|
|
159
|
-
return _optionalChain([value, 'optionalAccess',
|
|
174
|
+
return _optionalChain([value, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6(), 'access', _7 => _7.toLowerCase, 'call', _8 => _8(), 'access', _9 => _9.replace, 'call', _10 => _10(/_/g, "-")]) || void 0;
|
|
160
175
|
}
|
|
161
176
|
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeAction, "normalizeAction");
|
|
162
177
|
function getDocsTitle(docs) {
|
|
@@ -266,7 +281,7 @@ function getDocsAPIFormat(request) {
|
|
|
266
281
|
}
|
|
267
282
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsAPIFormat, "getDocsAPIFormat");
|
|
268
283
|
function getDocsDescription(docs) {
|
|
269
|
-
return _optionalChain([docs, 'access',
|
|
284
|
+
return _optionalChain([docs, 'access', _11 => _11.config, 'access', _12 => _12.metadata, 'optionalAccess', _13 => _13.description]);
|
|
270
285
|
}
|
|
271
286
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsDescription, "getDocsDescription");
|
|
272
287
|
function getLoadedDocsPages(context) {
|
|
@@ -475,19 +490,19 @@ async function searchDocs(context, request, query) {
|
|
|
475
490
|
const page = sourcePageByUrl.get(pageUrl);
|
|
476
491
|
return {
|
|
477
492
|
...result,
|
|
478
|
-
title: _optionalChain([page, 'optionalAccess',
|
|
479
|
-
href: _optionalChain([page, 'optionalAccess',
|
|
480
|
-
description: result.description || _optionalChain([page, 'optionalAccess',
|
|
493
|
+
title: _optionalChain([page, 'optionalAccess', _14 => _14.title]) || result.content,
|
|
494
|
+
href: _optionalChain([page, 'optionalAccess', _15 => _15.url]) || pageUrl,
|
|
495
|
+
description: result.description || _optionalChain([page, 'optionalAccess', _16 => _16.description])
|
|
481
496
|
};
|
|
482
497
|
});
|
|
483
498
|
}
|
|
484
499
|
_chunkS3JO3N4Hcjs.__name.call(void 0, searchDocs, "searchDocs");
|
|
485
500
|
async function resolveAPIContext(options) {
|
|
486
501
|
const runtimeConfig = globalThis.__FARM_DOCS_RUNTIME_CONFIG__;
|
|
487
|
-
const root = options.rootDir || options.root || _optionalChain([runtimeConfig, 'optionalAccess',
|
|
488
|
-
const srcDir = options.srcDir || _optionalChain([runtimeConfig, 'optionalAccess',
|
|
502
|
+
const root = options.rootDir || options.root || _optionalChain([runtimeConfig, 'optionalAccess', _17 => _17.root]) || process.cwd();
|
|
503
|
+
const srcDir = options.srcDir || _optionalChain([runtimeConfig, 'optionalAccess', _18 => _18.srcDir]) || "src";
|
|
489
504
|
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;
|
|
490
|
-
const docsInput = _nullishCoalesce(_nullishCoalesce(options.docs, () => ( (canUseRuntimeDocs ? _optionalChain([runtimeConfig, 'optionalAccess',
|
|
505
|
+
const docsInput = _nullishCoalesce(_nullishCoalesce(options.docs, () => ( (canUseRuntimeDocs ? _optionalChain([runtimeConfig, 'optionalAccess', _19 => _19.docs]) : void 0))), () => ( {
|
|
491
506
|
enabled: true,
|
|
492
507
|
entry: options.entry,
|
|
493
508
|
docsPath: options.docsPath,
|
|
@@ -495,7 +510,7 @@ async function resolveAPIContext(options) {
|
|
|
495
510
|
config: options.config,
|
|
496
511
|
configPath: options.configPath
|
|
497
512
|
}));
|
|
498
|
-
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await
|
|
513
|
+
const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkYP5JZ4LFcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
|
|
499
514
|
return {
|
|
500
515
|
root,
|
|
501
516
|
srcDir,
|