@farm.js/core 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-runtime.d.mts +3 -2
- package/dist/agent-runtime.d.ts +3 -2
- package/dist/api/route-manager.cjs +3 -2
- package/dist/api/route-manager.d.mts +3 -2
- package/dist/api/route-manager.d.ts +3 -2
- package/dist/api/route-manager.mjs +2 -1
- package/dist/api.cjs +4 -3
- package/dist/api.d.mts +4 -3
- package/dist/api.d.ts +4 -3
- package/dist/api.mjs +3 -2
- package/dist/{app-DAyPE-gr.d.ts → app-BV-7wV5q.d.ts} +10 -3
- package/dist/{app-D_6nTit-.d.mts → app-BZDWwwFa.d.mts} +10 -3
- package/dist/app-markdown.d.mts +4 -3
- package/dist/app-markdown.d.ts +4 -3
- package/dist/chunk-2VQKKQ6D.mjs +51 -0
- package/dist/{chunk-EGJDUF4Q.mjs → chunk-3ATMYLLJ.mjs} +6 -12
- package/dist/{chunk-HSDL2AUR.mjs → chunk-47H7VENP.mjs} +20 -32
- package/dist/{chunk-RWXZKZXB.cjs → chunk-4DKZ6JR3.cjs} +302 -339
- package/dist/{chunk-PUCUVI7K.mjs → chunk-72VJRKJD.mjs} +1 -1
- package/dist/{chunk-5L6NBNHI.mjs → chunk-7LU4IOXQ.mjs} +156 -193
- package/dist/{chunk-RMIJFZU3.mjs → chunk-BDJNP7AQ.mjs} +10 -14
- package/dist/{chunk-OLYK7EAK.mjs → chunk-DAATZTKJ.mjs} +14 -0
- package/dist/{chunk-YP5JZ4LF.cjs → chunk-DNLQMFER.cjs} +15 -19
- package/dist/{chunk-XFFQSD2F.cjs → chunk-DW34V5SM.cjs} +7 -7
- package/dist/{chunk-PKO4FCTL.mjs → chunk-EHUZ2MKO.mjs} +1 -1
- package/dist/{chunk-3NM6SRI6.mjs → chunk-F3VB7ONA.mjs} +10 -8
- package/dist/{chunk-L7ARWZYT.cjs → chunk-III667SJ.cjs} +496 -303
- package/dist/chunk-IK6LVLKC.cjs +51 -0
- package/dist/{chunk-B3WK4DTX.cjs → chunk-IMBMOEWT.cjs} +5 -1
- package/dist/{chunk-IILNZK5G.mjs → chunk-JHWOVJ3M.mjs} +46 -62
- package/dist/{chunk-TKNSDBBN.cjs → chunk-K3F2E6GS.cjs} +20 -1
- package/dist/{chunk-RTHIVJ2G.cjs → chunk-KCMTCM6I.cjs} +7 -8
- package/dist/{chunk-ZE6ONQ5R.cjs → chunk-LQIRVSBY.cjs} +30 -40
- package/dist/chunk-LYLEZIG3.cjs +73 -0
- package/dist/{chunk-NBAHDVOJ.cjs → chunk-LYM7HY34.cjs} +20 -32
- package/dist/{chunk-K6FNHVDR.cjs → chunk-MPEYMSCF.cjs} +6 -12
- package/dist/{chunk-TFAXUHWX.cjs → chunk-PSV6XKPO.cjs} +15 -1
- package/dist/{chunk-BHJUZ64B.cjs → chunk-QTBEAKCJ.cjs} +7 -7
- package/dist/{chunk-J6JRB2ER.mjs → chunk-S67OYZU7.mjs} +1 -1
- package/dist/chunk-SFGWNC43.mjs +97 -0
- package/dist/{chunk-AYJR42WX.cjs → chunk-UFDV5N3C.cjs} +2 -2
- package/dist/chunk-UYIHRDE4.cjs +97 -0
- package/dist/{chunk-Y4YMF2NQ.cjs → chunk-VPTDD5XF.cjs} +46 -62
- package/dist/{chunk-53G3OLTA.mjs → chunk-VPY755R2.mjs} +256 -63
- package/dist/{chunk-NRS46D4L.mjs → chunk-VVJCWBIE.mjs} +3 -3
- package/dist/{chunk-Q2TUENW2.cjs → chunk-VXCA7RZP.cjs} +1 -1
- package/dist/{chunk-CQHFU55R.mjs → chunk-WNUBR4CA.mjs} +5 -1
- package/dist/{chunk-CIAGU2X4.cjs → chunk-XSIRSMAS.cjs} +10 -8
- package/dist/{chunk-W7MZXRXM.mjs → chunk-YGMK6ESJ.mjs} +20 -30
- package/dist/chunk-YOZYCI6Z.mjs +73 -0
- package/dist/{chunk-HLCDYJY7.mjs → chunk-YQVSHTMR.mjs} +20 -1
- package/dist/{chunk-F5D4XEAS.mjs → chunk-ZZSRYEYU.mjs} +7 -8
- package/dist/{client-plugins-CWrhb1ir.d.mts → client-plugins-B_XzCegf.d.mts} +11 -9
- package/dist/{client-plugins-DPf0qZey.d.ts → client-plugins-CKsXQfXY.d.ts} +11 -9
- package/dist/client-plugins.d.mts +3 -2
- package/dist/client-plugins.d.ts +3 -2
- package/dist/client.d.mts +7 -6
- package/dist/client.d.ts +7 -6
- package/dist/config.d.mts +3 -2
- package/dist/config.d.ts +3 -2
- package/dist/{devtools-MTB5SA2B.mjs → devtools-OY4SNU3P.mjs} +5 -4
- package/dist/{devtools-R6MDDAZK.cjs → devtools-UHRSZ7VA.cjs} +6 -5
- package/dist/docs.cjs +10 -7
- package/dist/docs.mjs +9 -6
- package/dist/index.cjs +24 -21
- package/dist/index.d.mts +14 -13
- package/dist/index.d.ts +14 -13
- package/dist/index.mjs +19 -16
- package/dist/instrumentation.cjs +3 -2
- package/dist/instrumentation.mjs +2 -1
- package/dist/integrations.d.mts +3 -2
- package/dist/integrations.d.ts +3 -2
- 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 +18 -15
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +17 -14
- package/dist/internal/cli-runtime.cjs +11 -8
- package/dist/internal/cli-runtime.mjs +10 -7
- 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 +3 -2
- package/dist/internal/compression-runtime.d.ts +3 -2
- package/dist/internal/config-runtime.cjs +6 -5
- package/dist/internal/config-runtime.d.mts +4 -3
- package/dist/internal/config-runtime.d.ts +4 -3
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/metadata-image-runtime.cjs +3 -2
- package/dist/internal/metadata-image-runtime.mjs +2 -1
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.d.mts +9 -8
- package/dist/internal/production-runtime.d.ts +9 -8
- package/dist/layers-4PNE2HOY.cjs +18 -0
- package/dist/{layers-CJKSJGLN.mjs → layers-BRQF5ETU.mjs} +2 -1
- package/dist/{manager-NPG43N46.mjs → manager-RT733VRK.mjs} +2 -2
- package/dist/{manager-G4B2IPYE.cjs → manager-XZ5TX7AO.cjs} +3 -3
- package/dist/{metadata-CO9fRyyJ.d.mts → metadata-B08w4EYV.d.mts} +1 -1
- package/dist/{metadata-zY9wltwH.d.ts → metadata-IQEblkZp.d.ts} +1 -1
- package/dist/middleware.d.mts +5 -4
- package/dist/middleware.d.ts +5 -4
- package/dist/navigation.d.mts +6 -5
- package/dist/navigation.d.ts +6 -5
- package/dist/{nitro-TSGDUJMN.cjs → nitro-KQDU7CFE.cjs} +2 -2
- package/dist/{nitro-4LFVTT24.mjs → nitro-ZKLGOTVY.mjs} +1 -1
- package/dist/node-module-bundle-L5L7JCZ4.mjs +11 -0
- package/dist/node-module-bundle-VAFZOXMJ.cjs +11 -0
- package/dist/plugin.cjs +12 -10
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.mjs +11 -9
- package/dist/{production-runtime-CywsHwnG.d.mts → production-runtime-C3bGFEaM.d.mts} +1 -1
- package/dist/{production-runtime-lkfwujwK.d.ts → production-runtime-DRSOkc-d.d.ts} +1 -1
- package/dist/{render-plan-LVy6sGQe.d.mts → render-plan-B6CKNl4e.d.mts} +1 -1
- package/dist/{render-plan-DHF0GeWo.d.ts → render-plan-CCFuMLNS.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -4
- package/dist/renderer-client.d.ts +5 -4
- package/dist/renderer.cjs +4 -2
- package/dist/renderer.d.mts +9 -1
- package/dist/renderer.d.ts +9 -1
- package/dist/renderer.mjs +3 -1
- package/dist/{request-6AkmhEYE.d.mts → request-DgD1XsTx.d.mts} +1 -1
- package/dist/{request-BYxlRqA9.d.ts → request-Dn6VURbE.d.ts} +1 -1
- package/dist/request.d.mts +4 -3
- package/dist/request.d.ts +4 -3
- package/dist/{route-rendering-Dd8Jmml7.d.mts → route-rendering-76A5I_kE.d.mts} +1 -1
- package/dist/{route-rendering-CWaKiUbS.d.ts → route-rendering-LAmQEdyG.d.ts} +1 -1
- package/dist/{router-B2m4fvve.d.ts → router-BSOOGya2.d.ts} +1 -1
- package/dist/{router-xwEE112q.d.mts → router-CnrRSa9d.d.mts} +1 -1
- package/dist/routes.d.mts +3 -2
- package/dist/routes.d.ts +3 -2
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server.cjs +43 -36
- package/dist/server.d.mts +9 -8
- package/dist/server.d.ts +9 -8
- package/dist/server.mjs +27 -20
- package/dist/{spa-router-Y8rrXTVK.d.ts → spa-router-BMrSsG5b.d.ts} +2 -2
- package/dist/{spa-router-DVEHQnWo.d.mts → spa-router-DnYhWCvI.d.mts} +2 -2
- package/dist/testing.cjs +2 -1
- package/dist/testing.d.mts +3 -2
- package/dist/testing.d.ts +3 -2
- package/dist/testing.mjs +2 -1
- package/dist/{utils-DSPx34-A.d.mts → utils-ABkktwku.d.mts} +1 -1
- package/dist/{utils-Dvuny_08.d.ts → utils-C3GguS-Q.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +12 -10
- package/dist/vite.d.mts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.mjs +11 -9
- package/dist/workflows.cjs +2 -2
- package/dist/workflows.mjs +1 -1
- package/package.json +27 -13
- package/dist/layers-E4WPJNY5.cjs +0 -17
|
@@ -8,6 +8,10 @@ var _chunkKGZIORNLcjs = require('./chunk-KGZIORNL.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
11
15
|
var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
12
16
|
|
|
13
17
|
|
|
@@ -22,23 +26,6 @@ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
|
22
26
|
// src/docs/handler.ts
|
|
23
27
|
var _fs = require('fs');
|
|
24
28
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var _docs = require('@farming-labs/docs');
|
|
42
29
|
var _marked = require('marked');
|
|
43
30
|
var _sugarhigh = require('sugar-high');
|
|
44
31
|
|
|
@@ -1074,7 +1061,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
|
|
|
1074
1061
|
const url = new URL(request.url);
|
|
1075
1062
|
let loadedPages;
|
|
1076
1063
|
const getPages = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _nullishCoalesce(loadedPages, () => ( (loadedPages = getLoadedDocsPages(contentDir, docs)))), "getPages");
|
|
1077
|
-
const sitemapManifest = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () =>
|
|
1064
|
+
const sitemapManifest = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsSitemapManifest({
|
|
1078
1065
|
pages: getPages().map(toDocsSitemapPage),
|
|
1079
1066
|
entry: docs.entry,
|
|
1080
1067
|
siteTitle: getDocsTitle(docs),
|
|
@@ -1084,9 +1071,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
|
|
|
1084
1071
|
"Content-Type": contentType,
|
|
1085
1072
|
"Cache-Control": "public, max-age=60"
|
|
1086
1073
|
}), "textHeaders");
|
|
1087
|
-
const llmsFormat =
|
|
1074
|
+
const llmsFormat = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).resolveDocsLlmsTxtFormat(url);
|
|
1088
1075
|
if (llmsFormat) {
|
|
1089
|
-
const generated =
|
|
1076
|
+
const generated = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsLlmsTxt(
|
|
1090
1077
|
getPages().map(toDocsLlmsPage),
|
|
1091
1078
|
getDocsLlmsOptions(docs, request)
|
|
1092
1079
|
);
|
|
@@ -1095,10 +1082,10 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
|
|
|
1095
1082
|
headers: textHeaders("text/plain; charset=utf-8")
|
|
1096
1083
|
});
|
|
1097
1084
|
}
|
|
1098
|
-
const sitemapFormat =
|
|
1085
|
+
const sitemapFormat = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).resolveDocsSitemapRequest(url, _nullishCoalesce(docs.config.sitemap, () => ( true)));
|
|
1099
1086
|
if (sitemapFormat === "xml") {
|
|
1100
1087
|
return new Response(
|
|
1101
|
-
|
|
1088
|
+
_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsSitemapXml(sitemapManifest(), {
|
|
1102
1089
|
baseUrl: url.origin,
|
|
1103
1090
|
includeLastmod: true
|
|
1104
1091
|
}),
|
|
@@ -1110,7 +1097,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
|
|
|
1110
1097
|
}
|
|
1111
1098
|
if (sitemapFormat === "markdown") {
|
|
1112
1099
|
return new Response(
|
|
1113
|
-
|
|
1100
|
+
_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsSitemapMarkdown(sitemapManifest(), {
|
|
1114
1101
|
includeDescriptions: true
|
|
1115
1102
|
}),
|
|
1116
1103
|
{
|
|
@@ -1119,9 +1106,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
|
|
|
1119
1106
|
}
|
|
1120
1107
|
);
|
|
1121
1108
|
}
|
|
1122
|
-
if (
|
|
1109
|
+
if (_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).resolveDocsRobotsRequest(url, _nullishCoalesce(docs.config.robots, () => ( true)))) {
|
|
1123
1110
|
return new Response(
|
|
1124
|
-
|
|
1111
|
+
_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsRobotsTxt({
|
|
1125
1112
|
entry: docs.entry,
|
|
1126
1113
|
sitemap: _nullishCoalesce(docs.config.sitemap, () => ( true)),
|
|
1127
1114
|
robots: _nullishCoalesce(docs.config.robots, () => ( true)),
|
|
@@ -1133,8 +1120,8 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
|
|
|
1133
1120
|
}
|
|
1134
1121
|
);
|
|
1135
1122
|
}
|
|
1136
|
-
if (
|
|
1137
|
-
const spec =
|
|
1123
|
+
if (_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).isDocsAgentDiscoveryRequest(url)) {
|
|
1124
|
+
const spec = _chunkIK6LVLKCcjs.docsEngine.call(void 0, ).buildDocsAgentDiscoverySpec(getDocsDiscoveryOptions(docs, request));
|
|
1138
1125
|
const title = getDocsTitle(docs);
|
|
1139
1126
|
return new Response(
|
|
1140
1127
|
JSON.stringify({
|
|
@@ -1153,9 +1140,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
|
|
|
1153
1140
|
}
|
|
1154
1141
|
);
|
|
1155
1142
|
}
|
|
1156
|
-
if (
|
|
1143
|
+
if (_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).isDocsAgentsRequest(url)) {
|
|
1157
1144
|
return new Response(
|
|
1158
|
-
`${
|
|
1145
|
+
`${_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsAgentsDocument(getDocsDiscoveryOptions(docs, request)).trim()}
|
|
1159
1146
|
`,
|
|
1160
1147
|
{
|
|
1161
1148
|
status: 200,
|
|
@@ -1163,9 +1150,9 @@ function createFarmDocsPublicResponse(contentDir, docs, request) {
|
|
|
1163
1150
|
}
|
|
1164
1151
|
);
|
|
1165
1152
|
}
|
|
1166
|
-
if (
|
|
1153
|
+
if (_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).isDocsSkillRequest(url)) {
|
|
1167
1154
|
return new Response(
|
|
1168
|
-
`${
|
|
1155
|
+
`${_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsSkillDocument(getDocsDiscoveryOptions(docs, request)).trim()}
|
|
1169
1156
|
`,
|
|
1170
1157
|
{
|
|
1171
1158
|
status: 200,
|
|
@@ -1941,6 +1928,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1941
1928
|
const fallbackFontPreloadHeader = renderFarmDocsFontPreloadHeader(fontAssets);
|
|
1942
1929
|
return /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async function handleFarmDocsRequest(request) {
|
|
1943
1930
|
if (!_optionalChain([docs, 'optionalAccess', _82 => _82.enabled]) || request.method !== "GET" && request.method !== "HEAD") return null;
|
|
1931
|
+
await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
|
|
1944
1932
|
const contentDir = resolveFarmDocsContentDir(docs, options);
|
|
1945
1933
|
const requestUrl = new URL(request.url);
|
|
1946
1934
|
const socialImageSlug = getFarmDocsSocialImageSlug(docs, requestUrl);
|
|
@@ -1976,7 +1964,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1976
1964
|
return omitFarmDocsHeadBody(
|
|
1977
1965
|
request,
|
|
1978
1966
|
new Response(
|
|
1979
|
-
|
|
1967
|
+
_chunkIK6LVLKCcjs.docsEngine.call(void 0, ).renderDocsMarkdownDocument(toFarmDocsMarkdownPage(page), {
|
|
1980
1968
|
origin,
|
|
1981
1969
|
llms: _nullishCoalesce(docs.config.llmsTxt, () => ( true)),
|
|
1982
1970
|
sitemap: docs.config.sitemap
|
|
@@ -363,26 +363,20 @@ async function loadWorkflowModule(filePath, root) {
|
|
|
363
363
|
const fs = await import("fs/promises");
|
|
364
364
|
const path = await import("path");
|
|
365
365
|
const { pathToFileURL } = await import("url");
|
|
366
|
-
const { build } = await import("esbuild");
|
|
367
366
|
const outDir = path.join(root, ".farm", ".workflow-loader");
|
|
368
367
|
await fs.mkdir(outDir, { recursive: true });
|
|
369
368
|
const outfile = path.join(
|
|
370
369
|
outDir,
|
|
371
370
|
`workflow-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
|
|
372
371
|
);
|
|
373
|
-
await
|
|
374
|
-
|
|
375
|
-
|
|
372
|
+
const { bundleNodeModule } = await import("./node-module-bundle-VAFZOXMJ.cjs");
|
|
373
|
+
await bundleNodeModule({
|
|
374
|
+
root,
|
|
375
|
+
entry: filePath,
|
|
376
376
|
outfile,
|
|
377
|
-
bundle: true,
|
|
378
|
-
format: "esm",
|
|
379
|
-
platform: "node",
|
|
380
377
|
target: `node${process.versions.node.split(".")[0]}`,
|
|
381
|
-
|
|
382
|
-
external: [
|
|
383
|
-
jsx: "automatic",
|
|
384
|
-
logLevel: "silent",
|
|
385
|
-
sourcemap: "inline"
|
|
378
|
+
externalPackages: true,
|
|
379
|
+
external: [/^@farm\.js\/core(?:\/|$)/, /^nitro(?:\/|$)/]
|
|
386
380
|
});
|
|
387
381
|
try {
|
|
388
382
|
return await import(
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
4
|
|
|
5
5
|
// src/renderer.ts
|
|
6
|
+
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
6
7
|
var _module = require('module');
|
|
7
8
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
8
9
|
var _url = require('url');
|
|
@@ -128,6 +129,9 @@ function resolveFarmRenderer(renderer) {
|
|
|
128
129
|
throw new TypeError(`Farm renderer \`${field}\` must be a non-empty string.`);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
132
|
+
if (resolved.appSetup !== void 0 && (typeof resolved.appSetup !== "string" || resolved.appSetup.trim().length === 0)) {
|
|
133
|
+
throw new TypeError("Farm renderer `appSetup` must be a non-empty module path.");
|
|
134
|
+
}
|
|
131
135
|
return {
|
|
132
136
|
...resolved,
|
|
133
137
|
componentExtensions: [...resolved.componentExtensions || []],
|
|
@@ -155,6 +159,15 @@ function isReactRenderer(renderer) {
|
|
|
155
159
|
return !renderer || renderer.name === "react";
|
|
156
160
|
}
|
|
157
161
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isReactRenderer, "isReactRenderer");
|
|
162
|
+
function resolveFarmRendererAppSetup(root, renderer) {
|
|
163
|
+
if (!renderer.appSetup) return null;
|
|
164
|
+
const filePath = _path2.default.resolve(root, renderer.appSetup);
|
|
165
|
+
if (!_fs2.default.existsSync(filePath)) {
|
|
166
|
+
throw new Error(`Renderer \`${renderer.name}\` app setup module was not found: ${filePath}`);
|
|
167
|
+
}
|
|
168
|
+
return filePath;
|
|
169
|
+
}
|
|
170
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmRendererAppSetup, "resolveFarmRendererAppSetup");
|
|
158
171
|
function resolveFarmRendererModule(root, specifier) {
|
|
159
172
|
const requireFromApp = _module.createRequire.call(void 0, _path2.default.join(_path2.default.resolve(root), "package.json"));
|
|
160
173
|
return requireFromApp.resolve(specifier);
|
|
@@ -203,4 +216,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmRendererVitePlugins, "loadFarmRend
|
|
|
203
216
|
|
|
204
217
|
|
|
205
218
|
|
|
206
|
-
|
|
219
|
+
|
|
220
|
+
exports.getFarmRendererCapabilities = getFarmRendererCapabilities; exports.getFarmRendererStreamingCapabilitiesForRuntime = getFarmRendererStreamingCapabilitiesForRuntime; exports.assertFarmRendererStreamingRuntime = assertFarmRendererStreamingRuntime; exports.FARM_COMPONENT_EXTENSIONS = FARM_COMPONENT_EXTENSIONS; exports.resolveFarmComponentExtensions = resolveFarmComponentExtensions; exports.getFarmRendererComponentExtensions = getFarmRendererComponentExtensions; exports.REACT_RENDERER = REACT_RENDERER; exports.defineRenderer = defineRenderer; exports.resolveFarmRenderer = resolveFarmRenderer; exports.readFarmRendererWebStream = readFarmRendererWebStream; exports.isReactRenderer = isReactRenderer; exports.resolveFarmRendererAppSetup = resolveFarmRendererAppSetup; exports.resolveFarmRendererModule = resolveFarmRendererModule; exports.loadFarmRendererVitePlugins = loadFarmRendererVitePlugins;
|
|
@@ -6,7 +6,7 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
|
|
|
6
6
|
var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkIMBMOEWTcjs = require('./chunk-IMBMOEWT.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkN4RLRSWWcjs = require('./chunk-N4RLRSWW.cjs');
|
|
@@ -105,7 +105,7 @@ function farmApiPlugin(options = {}) {
|
|
|
105
105
|
const existing = apiRoutesCache.get(routePath);
|
|
106
106
|
const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
|
|
107
107
|
if (existingFile) {
|
|
108
|
-
throw new (0,
|
|
108
|
+
throw new (0, _chunkIMBMOEWTcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
|
|
109
109
|
}
|
|
110
110
|
if (existing) {
|
|
111
111
|
if (!existing.methods.includes(normalizedMethod)) {
|
|
@@ -268,7 +268,7 @@ function farmApiPlugin(options = {}) {
|
|
|
268
268
|
log(`API route discovered: ${availableMethods.join(", ")} ${routePath}`);
|
|
269
269
|
}
|
|
270
270
|
} catch (e) {
|
|
271
|
-
if (e instanceof
|
|
271
|
+
if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
272
272
|
log(`API route load failed at ${filePath}: ${e.message}`);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -295,7 +295,7 @@ function farmApiPlugin(options = {}) {
|
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
} catch (e) {
|
|
298
|
-
if (e instanceof
|
|
298
|
+
if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
299
299
|
log(`Root routes.ts load failed: ${e.message}`);
|
|
300
300
|
}
|
|
301
301
|
break;
|
|
@@ -326,7 +326,7 @@ function farmApiPlugin(options = {}) {
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
} catch (e) {
|
|
329
|
-
if (e instanceof
|
|
329
|
+
if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
330
330
|
log(`Programmatic routes file load failed at ${routeFile}: ${e.message}`);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
@@ -503,7 +503,7 @@ function farmApiPlugin(options = {}) {
|
|
|
503
503
|
log(`API router recreated`);
|
|
504
504
|
} catch (e) {
|
|
505
505
|
restoreRouteState(previousState);
|
|
506
|
-
if (e instanceof
|
|
506
|
+
if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
507
507
|
log(`Root routes.ts HMR failed: ${e.message}`);
|
|
508
508
|
}
|
|
509
509
|
return [];
|
|
@@ -541,7 +541,7 @@ function farmApiPlugin(options = {}) {
|
|
|
541
541
|
log(`API router recreated`);
|
|
542
542
|
} catch (e) {
|
|
543
543
|
restoreRouteState(previousState);
|
|
544
|
-
if (e instanceof
|
|
544
|
+
if (e instanceof _chunkIMBMOEWTcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
545
545
|
log(`API route HMR failed: ${e.message}`);
|
|
546
546
|
}
|
|
547
547
|
return [];
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
4
|
+
|
|
5
|
+
// src/build/node-module-bundle.ts
|
|
6
|
+
import { isBuiltin } from "module";
|
|
7
|
+
import path from "path";
|
|
8
|
+
import { stripVTControlCharacters } from "util";
|
|
9
|
+
var NON_PACKAGE_SPECIFIER_RE = /^(?:[./\\#]|[A-Za-z]:[\\/])/;
|
|
10
|
+
function isPackageSpecifier(specifier) {
|
|
11
|
+
return !specifier.startsWith("\0") && !NON_PACKAGE_SPECIFIER_RE.test(specifier) && !path.isAbsolute(specifier);
|
|
12
|
+
}
|
|
13
|
+
__name(isPackageSpecifier, "isPackageSpecifier");
|
|
14
|
+
var DECLARATION_FILE_RE = /\.d\.(?:[^./\\]+\.)?[cm]?ts$/;
|
|
15
|
+
function isDeclarationFile(id) {
|
|
16
|
+
return DECLARATION_FILE_RE.test(id.split("?", 1)[0]);
|
|
17
|
+
}
|
|
18
|
+
__name(isDeclarationFile, "isDeclarationFile");
|
|
19
|
+
var packageResolvers = /* @__PURE__ */ new Map();
|
|
20
|
+
async function resolvePackageWithoutTsconfig(source, importer, kind) {
|
|
21
|
+
const condition = kind === "require-call" ? "require" : "import";
|
|
22
|
+
let resolver = packageResolvers.get(condition);
|
|
23
|
+
if (!resolver) {
|
|
24
|
+
resolver = import("rolldown/experimental").then(
|
|
25
|
+
({ ResolverFactory }) => new ResolverFactory({
|
|
26
|
+
conditionNames: [condition, "node", "default"],
|
|
27
|
+
mainFields: ["main", "module"]
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
packageResolvers.set(condition, resolver);
|
|
31
|
+
}
|
|
32
|
+
const result = await (await resolver).async(path.dirname(importer), source);
|
|
33
|
+
return result.path ?? null;
|
|
34
|
+
}
|
|
35
|
+
__name(resolvePackageWithoutTsconfig, "resolvePackageWithoutTsconfig");
|
|
36
|
+
async function bundleNodeModule(options) {
|
|
37
|
+
const { rolldown } = await import("rolldown");
|
|
38
|
+
const plugins = options.externalPackages ? [externalizePackagesPlugin()] : [];
|
|
39
|
+
plugins.push(...options.plugins ?? []);
|
|
40
|
+
try {
|
|
41
|
+
const bundle = await rolldown({
|
|
42
|
+
cwd: options.root,
|
|
43
|
+
input: options.entry,
|
|
44
|
+
platform: "node",
|
|
45
|
+
logLevel: "silent",
|
|
46
|
+
external: options.external,
|
|
47
|
+
plugins,
|
|
48
|
+
// Package imports stay external by the path they were found at (as esbuild
|
|
49
|
+
// did), so a workspace symlink is not mistaken for a local alias target.
|
|
50
|
+
resolve: options.externalPackages ? { symlinks: false } : void 0,
|
|
51
|
+
transform: { target: options.target, jsx: { runtime: "automatic" } }
|
|
52
|
+
});
|
|
53
|
+
try {
|
|
54
|
+
await bundle.write({
|
|
55
|
+
file: options.outfile,
|
|
56
|
+
format: "esm",
|
|
57
|
+
sourcemap: "inline",
|
|
58
|
+
codeSplitting: false
|
|
59
|
+
});
|
|
60
|
+
} finally {
|
|
61
|
+
await bundle.close();
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
throw withPlainDiagnostics(error);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
__name(bundleNodeModule, "bundleNodeModule");
|
|
68
|
+
function externalizePackagesPlugin() {
|
|
69
|
+
return {
|
|
70
|
+
name: "farm-externalize-packages",
|
|
71
|
+
async resolveId(source, importer, extraOptions) {
|
|
72
|
+
if (!importer || !isPackageSpecifier(source) || isBuiltin(source)) return null;
|
|
73
|
+
const resolved = await this.resolve(source, importer, {
|
|
74
|
+
kind: extraOptions.kind,
|
|
75
|
+
skipSelf: true
|
|
76
|
+
});
|
|
77
|
+
if (resolved && !resolved.external && !resolved.id.startsWith("\0") && !resolved.id.split(/[\\/]/).includes("node_modules") && !isDeclarationFile(resolved.id)) {
|
|
78
|
+
return resolved;
|
|
79
|
+
}
|
|
80
|
+
return { id: source, external: true };
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
__name(externalizePackagesPlugin, "externalizePackagesPlugin");
|
|
85
|
+
function withPlainDiagnostics(error) {
|
|
86
|
+
if (!(error instanceof Error)) return error;
|
|
87
|
+
error.message = stripVTControlCharacters(error.message);
|
|
88
|
+
if (typeof error.stack === "string") error.stack = stripVTControlCharacters(error.stack);
|
|
89
|
+
return error;
|
|
90
|
+
}
|
|
91
|
+
__name(withPlainDiagnostics, "withPlainDiagnostics");
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
isDeclarationFile,
|
|
95
|
+
resolvePackageWithoutTsconfig,
|
|
96
|
+
bundleNodeModule
|
|
97
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkXSIRSMAScjs = require('./chunk-XSIRSMAS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -603,7 +603,7 @@ var _OpenAPIManager = class _OpenAPIManager {
|
|
|
603
603
|
this.appDir = appDirs[appDirs.length - 1];
|
|
604
604
|
this.config = config;
|
|
605
605
|
this.generator = new OpenAPIGenerator(this.appDir, config, context);
|
|
606
|
-
this.apiTypeGenerator = new (0,
|
|
606
|
+
this.apiTypeGenerator = new (0, _chunkXSIRSMAScjs.APITypeGenerator)(appDirs);
|
|
607
607
|
}
|
|
608
608
|
/**
|
|
609
609
|
* Generate OpenAPI spec from API routes
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/build/node-module-bundle.ts
|
|
6
|
+
var _module = require('module');
|
|
7
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
8
|
+
var _util = require('util');
|
|
9
|
+
var NON_PACKAGE_SPECIFIER_RE = /^(?:[./\\#]|[A-Za-z]:[\\/])/;
|
|
10
|
+
function isPackageSpecifier(specifier) {
|
|
11
|
+
return !specifier.startsWith("\0") && !NON_PACKAGE_SPECIFIER_RE.test(specifier) && !_path2.default.isAbsolute(specifier);
|
|
12
|
+
}
|
|
13
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isPackageSpecifier, "isPackageSpecifier");
|
|
14
|
+
var DECLARATION_FILE_RE = /\.d\.(?:[^./\\]+\.)?[cm]?ts$/;
|
|
15
|
+
function isDeclarationFile(id) {
|
|
16
|
+
return DECLARATION_FILE_RE.test(id.split("?", 1)[0]);
|
|
17
|
+
}
|
|
18
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isDeclarationFile, "isDeclarationFile");
|
|
19
|
+
var packageResolvers = /* @__PURE__ */ new Map();
|
|
20
|
+
async function resolvePackageWithoutTsconfig(source, importer, kind) {
|
|
21
|
+
const condition = kind === "require-call" ? "require" : "import";
|
|
22
|
+
let resolver = packageResolvers.get(condition);
|
|
23
|
+
if (!resolver) {
|
|
24
|
+
resolver = import("rolldown/experimental").then(
|
|
25
|
+
({ ResolverFactory }) => new ResolverFactory({
|
|
26
|
+
conditionNames: [condition, "node", "default"],
|
|
27
|
+
mainFields: ["main", "module"]
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
packageResolvers.set(condition, resolver);
|
|
31
|
+
}
|
|
32
|
+
const result = await (await resolver).async(_path2.default.dirname(importer), source);
|
|
33
|
+
return _nullishCoalesce(result.path, () => ( null));
|
|
34
|
+
}
|
|
35
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolvePackageWithoutTsconfig, "resolvePackageWithoutTsconfig");
|
|
36
|
+
async function bundleNodeModule(options) {
|
|
37
|
+
const { rolldown } = await import("rolldown");
|
|
38
|
+
const plugins = options.externalPackages ? [externalizePackagesPlugin()] : [];
|
|
39
|
+
plugins.push(..._nullishCoalesce(options.plugins, () => ( [])));
|
|
40
|
+
try {
|
|
41
|
+
const bundle = await rolldown({
|
|
42
|
+
cwd: options.root,
|
|
43
|
+
input: options.entry,
|
|
44
|
+
platform: "node",
|
|
45
|
+
logLevel: "silent",
|
|
46
|
+
external: options.external,
|
|
47
|
+
plugins,
|
|
48
|
+
// Package imports stay external by the path they were found at (as esbuild
|
|
49
|
+
// did), so a workspace symlink is not mistaken for a local alias target.
|
|
50
|
+
resolve: options.externalPackages ? { symlinks: false } : void 0,
|
|
51
|
+
transform: { target: options.target, jsx: { runtime: "automatic" } }
|
|
52
|
+
});
|
|
53
|
+
try {
|
|
54
|
+
await bundle.write({
|
|
55
|
+
file: options.outfile,
|
|
56
|
+
format: "esm",
|
|
57
|
+
sourcemap: "inline",
|
|
58
|
+
codeSplitting: false
|
|
59
|
+
});
|
|
60
|
+
} finally {
|
|
61
|
+
await bundle.close();
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
throw withPlainDiagnostics(error);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, bundleNodeModule, "bundleNodeModule");
|
|
68
|
+
function externalizePackagesPlugin() {
|
|
69
|
+
return {
|
|
70
|
+
name: "farm-externalize-packages",
|
|
71
|
+
async resolveId(source, importer, extraOptions) {
|
|
72
|
+
if (!importer || !isPackageSpecifier(source) || _module.isBuiltin.call(void 0, source)) return null;
|
|
73
|
+
const resolved = await this.resolve(source, importer, {
|
|
74
|
+
kind: extraOptions.kind,
|
|
75
|
+
skipSelf: true
|
|
76
|
+
});
|
|
77
|
+
if (resolved && !resolved.external && !resolved.id.startsWith("\0") && !resolved.id.split(/[\\/]/).includes("node_modules") && !isDeclarationFile(resolved.id)) {
|
|
78
|
+
return resolved;
|
|
79
|
+
}
|
|
80
|
+
return { id: source, external: true };
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, externalizePackagesPlugin, "externalizePackagesPlugin");
|
|
85
|
+
function withPlainDiagnostics(error) {
|
|
86
|
+
if (!(error instanceof Error)) return error;
|
|
87
|
+
error.message = _util.stripVTControlCharacters.call(void 0, error.message);
|
|
88
|
+
if (typeof error.stack === "string") error.stack = _util.stripVTControlCharacters.call(void 0, error.stack);
|
|
89
|
+
return error;
|
|
90
|
+
}
|
|
91
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, withPlainDiagnostics, "withPlainDiagnostics");
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
exports.isDeclarationFile = isDeclarationFile; exports.resolvePackageWithoutTsconfig = resolvePackageWithoutTsconfig; exports.bundleNodeModule = bundleNodeModule;
|