@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
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
loadFarmConfigFile,
|
|
17
17
|
resolveFarmLayers
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JHWOVJ3M.mjs";
|
|
19
19
|
import {
|
|
20
20
|
isReactRenderer,
|
|
21
21
|
resolveFarmRenderer
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DAATZTKJ.mjs";
|
|
23
23
|
import {
|
|
24
24
|
farmCspBlocksFrameworkInlineScripts,
|
|
25
25
|
getFarmSecurityHeader,
|
|
@@ -48,9 +48,12 @@ import {
|
|
|
48
48
|
import {
|
|
49
49
|
resolveMarkdownConfig
|
|
50
50
|
} from "./chunk-OFEY6KHO.mjs";
|
|
51
|
+
import {
|
|
52
|
+
bundleNodeModule
|
|
53
|
+
} from "./chunk-SFGWNC43.mjs";
|
|
51
54
|
import {
|
|
52
55
|
resolveWorkflowsConfig
|
|
53
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-3ATMYLLJ.mjs";
|
|
54
57
|
import {
|
|
55
58
|
resolveFarmThemeConfig
|
|
56
59
|
} from "./chunk-AELACLOB.mjs";
|
|
@@ -500,25 +503,18 @@ async function loadDocsConfig(rootDir, configPath) {
|
|
|
500
503
|
const content = await fs.readFile(resolvedPath, "utf8");
|
|
501
504
|
return { config: JSON.parse(content), configPath: resolvedPath };
|
|
502
505
|
}
|
|
503
|
-
const { build } = await import("esbuild");
|
|
504
506
|
const configCacheDir = path3.join(root, ".farm", ".config-loader");
|
|
505
507
|
await fs.mkdir(configCacheDir, { recursive: true });
|
|
506
508
|
const modulePath = path3.join(
|
|
507
509
|
configCacheDir,
|
|
508
510
|
`docs-config-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
|
|
509
511
|
);
|
|
510
|
-
await
|
|
511
|
-
|
|
512
|
-
|
|
512
|
+
await bundleNodeModule({
|
|
513
|
+
root,
|
|
514
|
+
entry: resolvedPath,
|
|
513
515
|
outfile: modulePath,
|
|
514
|
-
bundle: true,
|
|
515
|
-
format: "esm",
|
|
516
|
-
platform: "node",
|
|
517
516
|
target: `node${process.versions.node.split(".")[0]}`,
|
|
518
|
-
|
|
519
|
-
jsx: "automatic",
|
|
520
|
-
logLevel: "silent",
|
|
521
|
-
sourcemap: "inline"
|
|
517
|
+
externalPackages: true
|
|
522
518
|
});
|
|
523
519
|
const moduleUrl = pathToFileURL3(modulePath).href + `?t=${Date.now()}`;
|
|
524
520
|
let importedConfig;
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-LPEX4YW6.mjs";
|
|
4
4
|
|
|
5
5
|
// src/renderer.ts
|
|
6
|
+
import fs from "fs";
|
|
6
7
|
import { createRequire } from "module";
|
|
7
8
|
import path from "path";
|
|
8
9
|
import { pathToFileURL } from "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
|
__name(isReactRenderer, "isReactRenderer");
|
|
162
|
+
function resolveFarmRendererAppSetup(root, renderer) {
|
|
163
|
+
if (!renderer.appSetup) return null;
|
|
164
|
+
const filePath = path.resolve(root, renderer.appSetup);
|
|
165
|
+
if (!fs.existsSync(filePath)) {
|
|
166
|
+
throw new Error(`Renderer \`${renderer.name}\` app setup module was not found: ${filePath}`);
|
|
167
|
+
}
|
|
168
|
+
return filePath;
|
|
169
|
+
}
|
|
170
|
+
__name(resolveFarmRendererAppSetup, "resolveFarmRendererAppSetup");
|
|
158
171
|
function resolveFarmRendererModule(root, specifier) {
|
|
159
172
|
const requireFromApp = createRequire(path.join(path.resolve(root), "package.json"));
|
|
160
173
|
return requireFromApp.resolve(specifier);
|
|
@@ -201,6 +214,7 @@ export {
|
|
|
201
214
|
resolveFarmRenderer,
|
|
202
215
|
readFarmRendererWebStream,
|
|
203
216
|
isReactRenderer,
|
|
217
|
+
resolveFarmRendererAppSetup,
|
|
204
218
|
resolveFarmRendererModule,
|
|
205
219
|
loadFarmRendererVitePlugins
|
|
206
220
|
};
|
|
@@ -15,11 +15,11 @@ var _chunkQ5B3KJBPcjs = require('./chunk-Q5B3KJBP.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkVPTDD5XFcjs = require('./chunk-VPTDD5XF.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
@@ -50,7 +50,10 @@ var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
|
|
|
50
50
|
var _chunkBBVSJVBZcjs = require('./chunk-BBVSJVBZ.cjs');
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
var
|
|
53
|
+
var _chunkUYIHRDE4cjs = require('./chunk-UYIHRDE4.cjs');
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var _chunkMPEYMSCFcjs = require('./chunk-MPEYMSCF.cjs');
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
|
|
@@ -500,25 +503,18 @@ async function loadDocsConfig(rootDir, configPath) {
|
|
|
500
503
|
const content = await fs.readFile(resolvedPath, "utf8");
|
|
501
504
|
return { config: JSON.parse(content), configPath: resolvedPath };
|
|
502
505
|
}
|
|
503
|
-
const { build } = await import("esbuild");
|
|
504
506
|
const configCacheDir = _path2.default.join(root, ".farm", ".config-loader");
|
|
505
507
|
await fs.mkdir(configCacheDir, { recursive: true });
|
|
506
508
|
const modulePath = _path2.default.join(
|
|
507
509
|
configCacheDir,
|
|
508
510
|
`docs-config-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
|
|
509
511
|
);
|
|
510
|
-
await
|
|
511
|
-
|
|
512
|
-
|
|
512
|
+
await _chunkUYIHRDE4cjs.bundleNodeModule.call(void 0, {
|
|
513
|
+
root,
|
|
514
|
+
entry: resolvedPath,
|
|
513
515
|
outfile: modulePath,
|
|
514
|
-
bundle: true,
|
|
515
|
-
format: "esm",
|
|
516
|
-
platform: "node",
|
|
517
516
|
target: `node${process.versions.node.split(".")[0]}`,
|
|
518
|
-
|
|
519
|
-
jsx: "automatic",
|
|
520
|
-
logLevel: "silent",
|
|
521
|
-
sourcemap: "inline"
|
|
517
|
+
externalPackages: true
|
|
522
518
|
});
|
|
523
519
|
const moduleUrl = pathToFileURL3(modulePath).href + `?t=${Date.now()}`;
|
|
524
520
|
let importedConfig;
|
|
@@ -646,7 +642,7 @@ function validateConfigRouteSources(routes, field) {
|
|
|
646
642
|
_chunkS3JO3N4Hcjs.__name.call(void 0, validateConfigRouteSources, "validateConfigRouteSources");
|
|
647
643
|
async function resolveConfig(userConfig, mode) {
|
|
648
644
|
const projectRoot = userConfig.root || process.cwd();
|
|
649
|
-
const layerResolution = await
|
|
645
|
+
const layerResolution = await _chunkVPTDD5XFcjs.resolveFarmLayers.call(void 0, userConfig, {
|
|
650
646
|
root: projectRoot,
|
|
651
647
|
mode
|
|
652
648
|
});
|
|
@@ -661,7 +657,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
661
657
|
'The top-level "output" option is not supported and has no effect. Configure `deploy.target`, `deploy.preset`, or `deploy.outputDir` for deployment output, and use route rendering configuration for static pages.'
|
|
662
658
|
);
|
|
663
659
|
}
|
|
664
|
-
if (
|
|
660
|
+
if (_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, userConfig.renderer))) {
|
|
665
661
|
userConfig = await applyFarmDocsFrameworkAutoDetection(userConfig, {
|
|
666
662
|
root: userConfig.root || projectRoot
|
|
667
663
|
});
|
|
@@ -735,7 +731,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
735
731
|
layers: layerResolution.layers,
|
|
736
732
|
outDir: userConfig.outDir || "dist",
|
|
737
733
|
basePath,
|
|
738
|
-
renderer:
|
|
734
|
+
renderer: _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, userConfig.renderer),
|
|
739
735
|
preset: deploy.preset || "node-server",
|
|
740
736
|
deploy,
|
|
741
737
|
docs,
|
|
@@ -743,7 +739,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
743
739
|
mdx,
|
|
744
740
|
migrations: resolveMigrationsConfig(userConfig.migrations),
|
|
745
741
|
cron: _chunk6EXBPJ24cjs.resolveCronConfig.call(void 0, userConfig.cron),
|
|
746
|
-
workflows:
|
|
742
|
+
workflows: _chunkMPEYMSCFcjs.resolveWorkflowsConfig.call(void 0, userConfig.workflows),
|
|
747
743
|
api,
|
|
748
744
|
observability: _nullishCoalesce(userConfig.observability, () => ( false)),
|
|
749
745
|
telemetry: userConfig.telemetry !== false,
|
|
@@ -857,7 +853,7 @@ async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "
|
|
|
857
853
|
if (!existsSync(normalizedPath)) {
|
|
858
854
|
continue;
|
|
859
855
|
}
|
|
860
|
-
const loadedConfig = await
|
|
856
|
+
const loadedConfig = await _chunkVPTDD5XFcjs.loadFarmConfigFile.call(void 0, normalizedPath, { root });
|
|
861
857
|
return loadedConfig.root === void 0 ? { ...loadedConfig, root } : loadedConfig;
|
|
862
858
|
} catch (error) {
|
|
863
859
|
const configError = new Error(
|
|
@@ -6,7 +6,7 @@ var _chunkE2ROOWQCcjs = require('./chunk-E2ROOWQC.cjs');
|
|
|
6
6
|
var _chunkJSROZYYOcjs = require('./chunk-JSROZYYO.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkXSIRSMAScjs = require('./chunk-XSIRSMAS.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkSYQ3MOWWcjs = require('./chunk-SYQ3MOWW.cjs');
|
|
@@ -20,10 +20,10 @@ var _chunkTIWHTW3Qcjs = require('./chunk-TIWHTW3Q.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkVPTDD5XFcjs = require('./chunk-VPTDD5XF.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
var _chunkN4RLRSWWcjs = require('./chunk-N4RLRSWW.cjs');
|
|
@@ -779,7 +779,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateRouteTypes, "generateRouteTypes");
|
|
|
779
779
|
async function createRouteTypeDeclarations(options, outPath) {
|
|
780
780
|
const { root, srcDir = "src", extraRoutes = [], suppressLintOnLink = false } = options;
|
|
781
781
|
const sourceRoots = _nullishCoalesce(options.sourceRoots, () => ( [{ name: "project", root, srcDir, layer: false }]));
|
|
782
|
-
const componentExtensions =
|
|
782
|
+
const componentExtensions = _chunkPSV6XKPOcjs.resolveFarmComponentExtensions.call(void 0, options.componentExtensions).map(
|
|
783
783
|
(extension) => extension.slice(1)
|
|
784
784
|
);
|
|
785
785
|
const patterns = /* @__PURE__ */ new Set();
|
|
@@ -1158,8 +1158,8 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
1158
1158
|
const shouldGenerateEnv = options.env !== false;
|
|
1159
1159
|
const shouldGenerateImages = options.images !== false;
|
|
1160
1160
|
const shouldGenerateI18n = options.i18n !== false && _optionalChain([options, 'access', _47 => _47.i18nConfig, 'optionalAccess', _48 => _48.enabled]);
|
|
1161
|
-
const sourceRoots =
|
|
1162
|
-
const appDirs =
|
|
1161
|
+
const sourceRoots = _chunkVPTDD5XFcjs.getFarmSourceRoots.call(void 0, { root, srcDir, layers: options.layers });
|
|
1162
|
+
const appDirs = _chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, { root, srcDir, layers: options.layers });
|
|
1163
1163
|
const result = {
|
|
1164
1164
|
apiRoutes: [],
|
|
1165
1165
|
stalePaths: []
|
|
@@ -1198,7 +1198,7 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
1200
|
if (shouldGenerateApi) {
|
|
1201
|
-
const generator = new (0,
|
|
1201
|
+
const generator = new (0, _chunkXSIRSMAScjs.APITypeGenerator)(appDirs);
|
|
1202
1202
|
const apiRoutes = generator.scanAPIRoutes();
|
|
1203
1203
|
const apiTypesPath = options.apiTypesOutFile ? _path.resolve.call(void 0, root, options.apiTypesOutFile) : _path.join.call(void 0, root, srcDir, "lib", "api.generated.ts");
|
|
1204
1204
|
const pluginRoutes = _chunkI4J452B7cjs.resolvePluginRoutes.call(void 0, options.plugins);
|
|
@@ -17,13 +17,15 @@ import { createRequire } from "module";
|
|
|
17
17
|
import { join, relative, dirname, extname } from "path";
|
|
18
18
|
import { initSync, parse } from "es-module-lexer";
|
|
19
19
|
var moduleLexerInitialized = false;
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
function transformJSXRoute(content,
|
|
23
|
-
|
|
24
|
-
"
|
|
20
|
+
var JSX_ROUTE_LANGS = { ".jsx": "jsx", ".tsx": "tsx" };
|
|
21
|
+
var oxcTransformSync;
|
|
22
|
+
function transformJSXRoute(content, lang, filePath) {
|
|
23
|
+
oxcTransformSync ?? (oxcTransformSync = createRequire(typeof __filename === "string" ? __filename : import.meta.url)(
|
|
24
|
+
"rolldown/utils"
|
|
25
25
|
).transformSync);
|
|
26
|
-
|
|
26
|
+
const result = oxcTransformSync(filePath, content, { lang, sourceType: "module" });
|
|
27
|
+
if (result.errors.length > 0) throw result.errors[0];
|
|
28
|
+
return result.code;
|
|
27
29
|
}
|
|
28
30
|
__name(transformJSXRoute, "transformJSXRoute");
|
|
29
31
|
var API_CLIENT_METHOD_SEGMENTS = /* @__PURE__ */ new Set([
|
|
@@ -120,8 +122,8 @@ var _APITypeGenerator = class _APITypeGenerator {
|
|
|
120
122
|
moduleLexerInitialized = true;
|
|
121
123
|
}
|
|
122
124
|
const httpMethods = ["GET", "HEAD", "QUERY", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"];
|
|
123
|
-
const
|
|
124
|
-
const source =
|
|
125
|
+
const lang = JSX_ROUTE_LANGS[extname(filePath)];
|
|
126
|
+
const source = lang ? transformJSXRoute(content, lang, filePath) : content;
|
|
125
127
|
const [, exports] = parse(source);
|
|
126
128
|
const valueExports = new Set(
|
|
127
129
|
exports.filter((specifier) => !this.isTypeOnlyExportSpecifier(source, specifier.s)).map((specifier) => specifier.n)
|