@farm.js/core 0.1.68 → 0.1.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp.d-wkVPK1GA.d.mts → agent-mcp.d-DOfBMEzP.d.mts} +1 -1
- package/dist/{agent-mcp.d-Uh5xr7aX.d.ts → agent-mcp.d-DnIgriX1.d.ts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/{analyzer-CQDU7E3Y.mjs → analyzer-NAL5TJUP.mjs} +2 -2
- package/dist/analyzer-SAJSV6SP.cjs +16 -0
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.cjs +2 -2
- package/dist/api.d.mts +4 -21
- package/dist/api.d.ts +4 -21
- package/dist/api.mjs +1 -1
- package/dist/{app-manifest.d-BT5i2F-o.d.ts → app-manifest.d-CaAcaukR.d.ts} +1 -1
- package/dist/{app-manifest.d-Dd4q5CFx.d.mts → app-manifest.d-_BVbI0xp.d.mts} +1 -1
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/{app.d-BVOpL_f2.d.ts → app.d-BWeDqOaF.d.ts} +4 -4
- package/dist/{app.d-BhiDXex_.d.mts → app.d-CaPwtytN.d.mts} +4 -4
- package/dist/{base-path.d-BOUV5ozD.d.mts → base-path.d-CTDVF0Fc.d.mts} +2 -1
- package/dist/{base-path.d-BOUV5ozD.d.ts → base-path.d-CTDVF0Fc.d.ts} +2 -1
- package/dist/{chunk-SQ6IWJ3H.cjs → chunk-22LGTSBA.cjs} +1 -1
- package/dist/{chunk-T5XFZQCL.mjs → chunk-2P7UYHZP.mjs} +1 -1
- package/dist/{chunk-LDEXTX4I.cjs → chunk-4JRAMCUP.cjs} +11 -4
- package/dist/{chunk-TNK2TVRS.cjs → chunk-4W4ZWSV2.cjs} +196 -155
- package/dist/{chunk-MNJDNTGO.mjs → chunk-5TOWKGV3.mjs} +1 -1
- package/dist/{chunk-7LK5CTUM.cjs → chunk-6GQJVY4E.cjs} +18 -13
- package/dist/{chunk-5JKDFRTK.cjs → chunk-ABIBASLJ.cjs} +2 -2
- package/dist/{chunk-F6CMGWAL.mjs → chunk-ANMIR6US.mjs} +1 -1
- package/dist/{chunk-Z6SOXHAD.mjs → chunk-CKCKCUYO.mjs} +72 -31
- package/dist/{chunk-2ZOYOYEE.mjs → chunk-D5F7RPZP.mjs} +71 -1
- package/dist/{chunk-F36LS2C7.cjs → chunk-DHR2WDSL.cjs} +27 -27
- package/dist/{chunk-URN7VFO7.cjs → chunk-F6YLXK5L.cjs} +10 -11
- package/dist/{chunk-YTNBCXCW.cjs → chunk-GQ6QOH7T.cjs} +9 -5
- package/dist/{chunk-BZWTBELF.cjs → chunk-GTQOEEE7.cjs} +77 -7
- package/dist/{chunk-IGDYL2IA.cjs → chunk-GUMKIQJL.cjs} +2 -2
- package/dist/{chunk-4UAQB5LB.mjs → chunk-IYLZZTP6.mjs} +4 -4
- package/dist/{chunk-WUTFJOV7.cjs → chunk-JFPKARWM.cjs} +16 -8
- package/dist/{chunk-225APHKC.cjs → chunk-L5OZN6YW.cjs} +3 -3
- package/dist/{chunk-KWCZKJYU.cjs → chunk-L6NWQ3DR.cjs} +351 -277
- package/dist/{chunk-6OFOIMNS.mjs → chunk-MAGFDK4Q.mjs} +1 -1
- package/dist/{chunk-5IQ2ERQA.cjs → chunk-O47W53D3.cjs} +1 -1
- package/dist/{chunk-3TXKFRSO.mjs → chunk-OEL5EPOJ.mjs} +1 -1
- package/dist/{chunk-A3T445WK.mjs → chunk-PDQ6EGPK.mjs} +8 -1
- package/dist/{chunk-VRGY3X2I.mjs → chunk-PEYDQMSA.mjs} +5 -6
- package/dist/{chunk-KSZK34HU.mjs → chunk-PJQ5W356.mjs} +16 -8
- package/dist/{chunk-JSOCDYER.cjs → chunk-Q4HH5Q6A.cjs} +15 -1
- package/dist/{chunk-NT4W4H52.mjs → chunk-SZORL7EW.mjs} +18 -13
- package/dist/{chunk-Z3PW3DIR.cjs → chunk-TKYOJ5G2.cjs} +3 -3
- package/dist/{chunk-DIXFKAPM.mjs → chunk-UHU4QALN.mjs} +153 -79
- package/dist/{chunk-WPB67LE5.mjs → chunk-ULMXZYOA.mjs} +1 -1
- package/dist/{chunk-MZ4CRSY7.cjs → chunk-VO65MYJD.cjs} +4 -4
- package/dist/{chunk-DXZ57EPE.mjs → chunk-YOHHL2UE.mjs} +14 -0
- package/dist/{chunk-VFNAK6A5.mjs → chunk-ZR2QB45W.mjs} +7 -3
- package/dist/{chunk-KDO6T6OB.mjs → chunk-ZYCEEE3V.mjs} +1 -1
- package/dist/{client-component.d-DNVSLEPi.d.ts → client-component.d-CfJxuXZl.d.ts} +2 -2
- package/dist/{client-component.d-BvQOxSqh.d.mts → client-component.d-CnEeVvGG.d.mts} +2 -2
- package/dist/{client-plugins.d-CNDqcAuf.d.ts → client-plugins.d-D7dHV1Nf.d.ts} +15 -3
- package/dist/{client-plugins.d-CE1lVK2R.d.mts → client-plugins.d-Do5ULA0x.d.mts} +15 -3
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-R27T3BRY.cjs → devtools-7HNDS4SY.cjs} +2 -2
- package/dist/{devtools-2A2GPC7B.mjs → devtools-BP4EBTKQ.mjs} +1 -1
- package/dist/docs.cjs +5 -3
- package/dist/docs.d.mts +15 -3
- package/dist/docs.d.ts +15 -3
- package/dist/docs.mjs +5 -3
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/image/server.cjs +2 -2
- package/dist/image/server.mjs +1 -1
- package/dist/image/sharp.cjs +9 -9
- package/dist/image/sharp.mjs +1 -1
- package/dist/index.cjs +17 -16
- package/dist/{index.d-Bt3kl19W.d.mts → index.d-B1MpEJAo.d.mts} +1 -1
- package/dist/{index.d-Cx_-DaKV.d.ts → index.d-CVFk37uX.d.ts} +1 -1
- package/dist/index.d.mts +17 -17
- package/dist/index.d.ts +17 -17
- package/dist/index.mjs +17 -16
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/build-runtime.cjs +15 -16
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +14 -15
- package/dist/internal/cli-runtime.cjs +2 -2
- package/dist/internal/cli-runtime.mjs +1 -1
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +3 -3
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +2 -2
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +8 -4
- package/dist/internal/production-runtime.d.mts +19 -12
- package/dist/internal/production-runtime.d.ts +19 -12
- package/dist/internal/production-runtime.mjs +8 -4
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/{mount.d-Bki4pOaJ.d.mts → mount.d-CBqr-LfI.d.mts} +1 -1
- package/dist/{mount.d-DjR5aerM.d.ts → mount.d-CGzN61Kq.d.ts} +1 -1
- package/dist/{navigation-delegate.d-VDkziXTK.d.mts → navigation-delegate.d-BwCOhpj7.d.mts} +1 -1
- package/dist/{navigation-delegate.d-CtghaSP3.d.ts → navigation-delegate.d-CLH2dXjy.d.ts} +1 -1
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/{plugin-WIU4GDD4.cjs → plugin-F2O4BFTK.cjs} +2 -2
- package/dist/{plugin-SAS22JL7.mjs → plugin-VEBRN7A3.mjs} +1 -1
- package/dist/plugin.cjs +10 -10
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +9 -9
- package/dist/{render-plan.d-BSwV8PE4.d.mts → render-plan.d-CzGDjcT0.d.mts} +1 -1
- package/dist/{render-plan.d-i9sI4tc9.d.ts → render-plan.d-W6LmjD6y.d.ts} +1 -1
- package/dist/renderer-client.d.mts +4 -4
- package/dist/renderer-client.d.ts +4 -4
- package/dist/{request.d-Dgln8tuI.d.ts → request.d-CTVRZiQv.d.ts} +1 -1
- package/dist/{request.d-C24FNQ_7.d.mts → request.d-CgNVderU.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-Ds0BfwQi.d.mts → route-rendering.d-D0bmZVJA.d.mts} +1 -1
- package/dist/{route-rendering.d-CUylZKJA.d.ts → route-rendering.d-FDSNtCMg.d.ts} +1 -1
- package/dist/{router.d-B56rMOFm.d.ts → router.d-DZ3ldniI.d.ts} +1 -1
- package/dist/{router.d-CFPcbqzc.d.mts → router.d-GRKm_uAV.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{rsc-pipeline-3T7V6OUT.cjs → rsc-pipeline-J4KKBSCH.cjs} +4 -5
- package/dist/{rsc-pipeline-GA4AQWZI.mjs → rsc-pipeline-PJZOVYSY.mjs} +3 -4
- package/dist/{runtime-REUTNTI5.cjs → runtime-OLEO5NXF.cjs} +4 -4
- package/dist/{runtime-ZYCKKY7L.mjs → runtime-QDBSE4H6.mjs} +2 -2
- package/dist/{runtime.d-DLRO-ExG.d.mts → runtime.d-DqXihlxm.d.mts} +1 -1
- package/dist/{runtime.d-H7k9hOQE.d.ts → runtime.d-pqFQBU2N.d.ts} +1 -1
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server.cjs +31 -31
- package/dist/server.d.mts +9 -9
- package/dist/server.d.ts +9 -9
- package/dist/server.mjs +12 -12
- package/dist/{spa-router.d-Dr7oanhl.d.ts → spa-router.d-DhOhaQ-7.d.ts} +2 -2
- package/dist/{spa-router.d-g4CzhEH1.d.mts → spa-router.d-Dhvy60p4.d.mts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils.d-BxxyDEb8.d.ts → utils.d-BVCMRRau.d.ts} +1 -1
- package/dist/{utils.d-HIla3pD_.d.mts → utils.d-Q8EHCpkF.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +10 -10
- package/dist/vite.d.mts +4 -4
- package/dist/vite.d.ts +4 -4
- package/dist/vite.mjs +9 -9
- package/package.json +2 -2
- package/dist/analyzer-PPAHM4AW.cjs +0 -16
- package/dist/chunk-HHLEYA4B.cjs +0 -17
- package/dist/chunk-QYNZ3CTI.mjs +0 -17
|
@@ -550,6 +550,12 @@ async function applyFarmDocsFrameworkAutoDetection(userConfig, options) {
|
|
|
550
550
|
|
|
551
551
|
// src/config.ts
|
|
552
552
|
var FARM_RESOLVED_CUSTOM_CONTEXT = /* @__PURE__ */ Symbol.for("farm.resolvedCustomContext");
|
|
553
|
+
var FARM_DEPLOY_TARGET_PRESETS = {
|
|
554
|
+
vercel: "vercel",
|
|
555
|
+
cloudflare: "cloudflare-pages",
|
|
556
|
+
netlify: "netlify",
|
|
557
|
+
node: "node-server"
|
|
558
|
+
};
|
|
553
559
|
function resolveSchemaConfig(config) {
|
|
554
560
|
if (config === void 0) return {};
|
|
555
561
|
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
@@ -586,18 +592,8 @@ function normalizeDeployTarget(target) {
|
|
|
586
592
|
return target;
|
|
587
593
|
}
|
|
588
594
|
function getPresetForDeployTarget(target) {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
return "vercel";
|
|
592
|
-
case "cloudflare":
|
|
593
|
-
return "cloudflare-pages";
|
|
594
|
-
case "netlify":
|
|
595
|
-
return "netlify";
|
|
596
|
-
case "node":
|
|
597
|
-
return "node-server";
|
|
598
|
-
default:
|
|
599
|
-
return void 0;
|
|
600
|
-
}
|
|
595
|
+
const normalized = normalizeDeployTarget(target);
|
|
596
|
+
return normalized && Object.prototype.hasOwnProperty.call(FARM_DEPLOY_TARGET_PRESETS, normalized) ? FARM_DEPLOY_TARGET_PRESETS[normalized] : void 0;
|
|
601
597
|
}
|
|
602
598
|
function getDeployTargetForPreset(preset) {
|
|
603
599
|
if (!preset) return void 0;
|
|
@@ -640,8 +636,18 @@ function assertFarmDeployNameSupported(kind, name) {
|
|
|
640
636
|
`Deploy ${kind} "vercel-edge" is not supported: Farm's Nitro version has no vercel-edge preset. Use the "vercel" ${kind} instead, which deploys Vercel Functions on Fluid compute.`
|
|
641
637
|
);
|
|
642
638
|
}
|
|
639
|
+
function assertFarmDeployTargetSupported(target) {
|
|
640
|
+
if (!target || getPresetForDeployTarget(target)) return;
|
|
641
|
+
assertFarmDeployNameSupported("target", target);
|
|
642
|
+
const targets = Object.keys(FARM_DEPLOY_TARGET_PRESETS).map((name) => `"${name}"`).join(", ");
|
|
643
|
+
throw new Error(
|
|
644
|
+
`Unknown deploy target "${String(target)}". Farm's deploy targets are ${targets}. To build with another Nitro preset, set deploy.preset instead.`
|
|
645
|
+
);
|
|
646
|
+
}
|
|
643
647
|
function resolveDeployConfig(config, overrides = {}) {
|
|
644
648
|
const deploy = config.deploy || {};
|
|
649
|
+
assertFarmDeployTargetSupported(deploy.target);
|
|
650
|
+
assertFarmDeployTargetSupported(overrides.target);
|
|
645
651
|
const distDir = config.distDir || ".farm";
|
|
646
652
|
const overrideTarget = normalizeDeployTarget(overrides.target);
|
|
647
653
|
let target = overrideTarget ? overrideTarget : overrides.preset ? getDeployTargetForPreset(overrides.preset) : normalizeDeployTarget(deploy.target);
|
|
@@ -665,7 +671,6 @@ function resolveDeployConfig(config, overrides = {}) {
|
|
|
665
671
|
const preset = overrides.preset || overrideTargetPreset || configuredPreset || getPresetForDeployTarget(target) || "node-server";
|
|
666
672
|
const resolvedTarget = target || getDeployTargetForPreset(preset);
|
|
667
673
|
assertFarmDeployNameSupported("preset", preset);
|
|
668
|
-
assertFarmDeployNameSupported("target", resolvedTarget);
|
|
669
674
|
if (detectedTarget && resolvedTarget !== detectedTarget) {
|
|
670
675
|
const mismatchKey = `mismatch:${resolvedTarget}:${detectedTarget}`;
|
|
671
676
|
if (!warnedPlatformMismatches.has(mismatchKey)) {
|
|
@@ -15,14 +15,14 @@ var _chunkWBTHHTBOcjs = require('./chunk-WBTHHTBO.cjs');
|
|
|
15
15
|
var _chunkCCAUIBIScjs = require('./chunk-CCAUIBIS.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk22LGTSBAcjs = require('./chunk-22LGTSBA.cjs');
|
|
19
19
|
|
|
20
20
|
// src/mobile/analyzer.ts
|
|
21
21
|
var _crypto = require('crypto');
|
|
22
22
|
var _fs = require('fs');
|
|
23
23
|
var _promises = require('fs/promises');
|
|
24
24
|
var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
25
|
-
var ANALYZER_VERSION = `7:${
|
|
25
|
+
var ANALYZER_VERSION = `7:${_chunk22LGTSBAcjs.FARM_VERSION}`;
|
|
26
26
|
var INTRINSIC_KINDS = {};
|
|
27
27
|
for (const tag of "div section main article header footer nav aside figure hr li".split(" ")) {
|
|
28
28
|
INTRINSIC_KINDS[tag] = "View";
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
hasFarmServerRuntimePlugins
|
|
3
|
-
} from "./chunk-QYNZ3CTI.mjs";
|
|
4
1
|
import {
|
|
5
2
|
FARM_MOBILE_CLIENT_ENTRY_NAME,
|
|
6
3
|
FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER,
|
|
@@ -29,7 +26,7 @@ import {
|
|
|
29
26
|
import {
|
|
30
27
|
collectFarmNativeServerFns,
|
|
31
28
|
findFarmNativeScreenFiles
|
|
32
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-5TOWKGV3.mjs";
|
|
33
30
|
import {
|
|
34
31
|
generateNativeMCPPluginSource
|
|
35
32
|
} from "./chunk-KQH2COEJ.mjs";
|
|
@@ -42,8 +39,9 @@ import {
|
|
|
42
39
|
createFarmDocsAPIHandler,
|
|
43
40
|
farmDocsAdapterServesGuardedPages,
|
|
44
41
|
hasFarmDocsRuntimeAdapter,
|
|
45
|
-
listFarmDocsAdapterPages
|
|
46
|
-
|
|
42
|
+
listFarmDocsAdapterPages,
|
|
43
|
+
listFarmDocsPagePaths
|
|
44
|
+
} from "./chunk-PDQ6EGPK.mjs";
|
|
47
45
|
import {
|
|
48
46
|
FARM_DOCS_LAST_MODIFIED_MANIFEST,
|
|
49
47
|
createFarmDocsHandler,
|
|
@@ -67,7 +65,7 @@ import {
|
|
|
67
65
|
} from "./chunk-JL2YW5KX.mjs";
|
|
68
66
|
import {
|
|
69
67
|
FARM_PRERENDER_ENV
|
|
70
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-ZYCEEE3V.mjs";
|
|
71
69
|
import {
|
|
72
70
|
loadFarmDocsEngine
|
|
73
71
|
} from "./chunk-VE3FWJBO.mjs";
|
|
@@ -76,7 +74,7 @@ import {
|
|
|
76
74
|
getDeployTargetForPreset,
|
|
77
75
|
hasCustomFarmRouteContext,
|
|
78
76
|
resolveDeployOutputPath
|
|
79
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-SZORL7EW.mjs";
|
|
80
78
|
import {
|
|
81
79
|
resolveFarmInstrumentationFile
|
|
82
80
|
} from "./chunk-57QAQU4F.mjs";
|
|
@@ -112,14 +110,15 @@ import {
|
|
|
112
110
|
resolveFarmImageServerRuntime,
|
|
113
111
|
resolveFarmNotFoundComponentPath,
|
|
114
112
|
resolveFarmRouteRootStrategy
|
|
115
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-IYLZZTP6.mjs";
|
|
116
114
|
import {
|
|
117
115
|
generateFarmClientPluginEntryCode,
|
|
116
|
+
hasFarmServerRuntimePlugins,
|
|
118
117
|
loadTailwindVitePlugin
|
|
119
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-YOHHL2UE.mjs";
|
|
120
119
|
import {
|
|
121
120
|
PluginManager
|
|
122
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-PJQ5W356.mjs";
|
|
123
122
|
import {
|
|
124
123
|
generateFarmTypeArtifacts,
|
|
125
124
|
readRouteRenderingDirectiveFromFile,
|
|
@@ -151,7 +150,7 @@ import {
|
|
|
151
150
|
listFarmBuiltInRoutePaths,
|
|
152
151
|
resolveFarmApiCatalogInput,
|
|
153
152
|
resolveFarmAppManifestInput
|
|
154
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-ZR2QB45W.mjs";
|
|
155
154
|
import {
|
|
156
155
|
FARM_DEFAULT_MCP_PATH,
|
|
157
156
|
createFarmDefaultMCPServer,
|
|
@@ -159,7 +158,7 @@ import {
|
|
|
159
158
|
} from "./chunk-K6SXMVXO.mjs";
|
|
160
159
|
import {
|
|
161
160
|
isFarmPreviewDeploymentEnvironment
|
|
162
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-2P7UYHZP.mjs";
|
|
163
162
|
import {
|
|
164
163
|
FARM_NATIVE_SERVER_FN_PLUGIN
|
|
165
164
|
} from "./chunk-L4RTTTVE.mjs";
|
|
@@ -177,7 +176,7 @@ import {
|
|
|
177
176
|
usePackageClientBoundaryCacheFile,
|
|
178
177
|
usesFarmServerTree,
|
|
179
178
|
withPackageClientBoundaryCache
|
|
180
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-ULMXZYOA.mjs";
|
|
181
180
|
import {
|
|
182
181
|
generateFarmDocsAdapterClientRuntime,
|
|
183
182
|
getFarmDocsAdapterConfigModule
|
|
@@ -283,7 +282,7 @@ import {
|
|
|
283
282
|
} from "./chunk-2I6PUKWJ.mjs";
|
|
284
283
|
import {
|
|
285
284
|
FARM_VERSION
|
|
286
|
-
} from "./chunk-
|
|
285
|
+
} from "./chunk-ANMIR6US.mjs";
|
|
287
286
|
import {
|
|
288
287
|
normalizeFarmTrailingSlashPathname
|
|
289
288
|
} from "./chunk-YVPX5PI5.mjs";
|
|
@@ -965,13 +964,14 @@ function createFarmVercelImmutableAssetRoute() {
|
|
|
965
964
|
};
|
|
966
965
|
}
|
|
967
966
|
function buildFarmVercelRoutes(options) {
|
|
968
|
-
const { presetRoutes, runtimeRoutes, middlewareRoutes = [] } = options;
|
|
967
|
+
const { presetRoutes, runtimeRoutes, middlewareRoutes = [], canonicalSlashRoutes = [] } = options;
|
|
969
968
|
const filesystemIndex = presetRoutes.findIndex((route) => route.handle === "filesystem");
|
|
970
969
|
const sourceRoutes = filesystemIndex >= 0 ? presetRoutes.slice(0, filesystemIndex) : [];
|
|
971
970
|
const preservedSourceRoutes = sourceRoutes.filter((route) => route.continue !== true);
|
|
972
971
|
return [
|
|
973
972
|
...preservedSourceRoutes,
|
|
974
973
|
...middlewareRoutes,
|
|
974
|
+
...canonicalSlashRoutes,
|
|
975
975
|
createFarmVercelImmutableAssetRoute(),
|
|
976
976
|
{ handle: "filesystem" },
|
|
977
977
|
...runtimeRoutes,
|
|
@@ -981,6 +981,18 @@ function buildFarmVercelRoutes(options) {
|
|
|
981
981
|
}
|
|
982
982
|
];
|
|
983
983
|
}
|
|
984
|
+
function escapeRegExp2(value) {
|
|
985
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
986
|
+
}
|
|
987
|
+
function createFarmVercelCanonicalSlashRoutes(publicPaths) {
|
|
988
|
+
const otherSpellings = [
|
|
989
|
+
...new Set(
|
|
990
|
+
publicPaths.filter((pathname) => pathname !== "/").map((pathname) => pathname.endsWith("/") ? pathname.replace(/\/+$/, "") : `${pathname}/`).filter((pathname) => pathname !== "")
|
|
991
|
+
)
|
|
992
|
+
];
|
|
993
|
+
if (otherSpellings.length === 0) return [];
|
|
994
|
+
return [{ src: `^(?:${otherSpellings.map(escapeRegExp2).join("|")})$`, dest: "/__nitro" }];
|
|
995
|
+
}
|
|
984
996
|
|
|
985
997
|
// src/nitro/ssr-public-assets.ts
|
|
986
998
|
import path7 from "path";
|
|
@@ -1373,7 +1385,7 @@ function farmTargetRunsEdgeMiddleware(preset) {
|
|
|
1373
1385
|
function isFarmEdgeMiddlewareRoute(route) {
|
|
1374
1386
|
return typeof route.config === "object" && route.config?.runtime === "edge";
|
|
1375
1387
|
}
|
|
1376
|
-
function
|
|
1388
|
+
function escapeRegExp3(value) {
|
|
1377
1389
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1378
1390
|
}
|
|
1379
1391
|
function toFarmVercelEdgeGuardedUrls(pathnames, basePath) {
|
|
@@ -1385,7 +1397,7 @@ function createFarmVercelEdgeMiddlewareRoute(pathnames, basePath = "/") {
|
|
|
1385
1397
|
const publicPaths = toFarmVercelEdgeGuardedUrls(pathnames, basePath);
|
|
1386
1398
|
const alternatives = publicPaths.map((pathname) => {
|
|
1387
1399
|
const trimmed = pathname.replace(/\/+$/, "");
|
|
1388
|
-
return trimmed ? `${
|
|
1400
|
+
return trimmed ? `${escapeRegExp3(trimmed)}(?:/|/index\\.html|\\.html)?` : "/(?:index\\.html)?";
|
|
1389
1401
|
});
|
|
1390
1402
|
return {
|
|
1391
1403
|
src: `^(?:${alternatives.join("|")})$`,
|
|
@@ -2598,7 +2610,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2598
2610
|
if (!mobile) await removeFarmMobileClientManifest(path12.dirname(outputDir));
|
|
2599
2611
|
const viteBuild = productionVite.build;
|
|
2600
2612
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
2601
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
2613
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
|
|
2602
2614
|
const fs4 = await import("fs/promises");
|
|
2603
2615
|
const pluginManager = new PluginManager2({
|
|
2604
2616
|
config,
|
|
@@ -6000,7 +6012,7 @@ void hydrate();
|
|
|
6000
6012
|
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
|
|
6001
6013
|
const viteBuild = productionVite.build;
|
|
6002
6014
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
6003
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
6015
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
|
|
6004
6016
|
const fs4 = await import("fs/promises");
|
|
6005
6017
|
const pluginManager = new PluginManager2({
|
|
6006
6018
|
config,
|
|
@@ -6196,6 +6208,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6196
6208
|
if (farmDocsPrecompiledManifest && farmDocsCspNonceMarker) {
|
|
6197
6209
|
farmDocsPrecompiledManifest.cspNonceMarker = farmDocsCspNonceMarker;
|
|
6198
6210
|
}
|
|
6211
|
+
const farmDocsAnalyticsPages = await listFarmDocsAnalyticsPages(config, root, preset);
|
|
6199
6212
|
const virtualEntryCode = generateVirtualEntryCode(
|
|
6200
6213
|
apiRoutes,
|
|
6201
6214
|
pageRoutes,
|
|
@@ -6222,7 +6235,8 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6222
6235
|
i18nCatalogs,
|
|
6223
6236
|
isolatedClientBoundaryModules,
|
|
6224
6237
|
hydrationPlanCache,
|
|
6225
|
-
mobileShellLoadingRoutes
|
|
6238
|
+
mobileShellLoadingRoutes,
|
|
6239
|
+
farmDocsAnalyticsPages
|
|
6226
6240
|
);
|
|
6227
6241
|
const virtualEntryId = "\0virtual:farm-ssr-entry";
|
|
6228
6242
|
const useExternalMetadataImageRuntime = shouldUseExternalMetadataImageRuntime(preset, true);
|
|
@@ -6860,7 +6874,7 @@ if (typeof ReactDOMServer.configureApp !== "function") {
|
|
|
6860
6874
|
}
|
|
6861
6875
|
ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
6862
6876
|
}
|
|
6863
|
-
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = []) {
|
|
6877
|
+
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
|
|
6864
6878
|
const farmRendererDisabled = isFarmRendererDisabled(config.renderer);
|
|
6865
6879
|
const farmIslandsMode = resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands";
|
|
6866
6880
|
const farmClientBoot = canBootFarmIslandsClient(config);
|
|
@@ -9688,7 +9702,8 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
9688
9702
|
)});
|
|
9689
9703
|
${config.docs?.enabled ? `const farmDocsRouteLabelInput = {
|
|
9690
9704
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
9691
|
-
apiPath: ${JSON.stringify(farmDocsPrecompiledManifest?.apiPath || "/api/docs")},${config.docs.roots?.length ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
|
|
9705
|
+
apiPath: ${JSON.stringify(farmDocsPrecompiledManifest?.apiPath || "/api/docs")},${config.docs.roots?.length ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
|
|
9706
|
+
pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
|
|
9692
9707
|
};
|
|
9693
9708
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
9694
9709
|
const farmRouteLabelSlot = Symbol("farm.route.label.slot");
|
|
@@ -12147,6 +12162,23 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
12147
12162
|
}
|
|
12148
12163
|
return pages;
|
|
12149
12164
|
}
|
|
12165
|
+
async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
12166
|
+
if (!config.docs?.enabled || config.analytics === false || resolveFarmInstrumentationRuntime(preset) !== "nodejs") {
|
|
12167
|
+
return [];
|
|
12168
|
+
}
|
|
12169
|
+
try {
|
|
12170
|
+
return await listFarmDocsPagePaths(config.docs, {
|
|
12171
|
+
root,
|
|
12172
|
+
srcDir: config.srcDir,
|
|
12173
|
+
adapter: isReactRenderer(config.renderer) && hasFarmDocsRuntimeAdapter(config.docs)
|
|
12174
|
+
});
|
|
12175
|
+
} catch (error) {
|
|
12176
|
+
logger.warn(
|
|
12177
|
+
`Farm Infra analytics reports docs pages by the docs route, not each page's path: listing them failed (${error instanceof Error ? error.message : String(error)}).`
|
|
12178
|
+
);
|
|
12179
|
+
return [];
|
|
12180
|
+
}
|
|
12181
|
+
}
|
|
12150
12182
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
12151
12183
|
return Object.values(routeRules || {}).some((rule) => {
|
|
12152
12184
|
const swr = rule?.swr;
|
|
@@ -12468,12 +12500,19 @@ function resolveTrustedLocalOrigin(event, request) {
|
|
|
12468
12500
|
: requestURL.hostname
|
|
12469
12501
|
const isLoopback = (value) =>
|
|
12470
12502
|
value === 'localhost' || value === '::1' || /^127(?:[.][0-9]{1,3}){3}$/.test(value)
|
|
12471
|
-
|
|
12503
|
+
if (
|
|
12504
|
+
requestURL.protocol === protocol &&
|
|
12472
12505
|
requestPort === port &&
|
|
12473
12506
|
isLoopback(address) &&
|
|
12474
12507
|
isLoopback(normalizedRequestHostname)
|
|
12475
|
-
|
|
12476
|
-
|
|
12508
|
+
) {
|
|
12509
|
+
return requestURL.origin
|
|
12510
|
+
}
|
|
12511
|
+
// Any other Host is the client's to choose, so it must not decide where a local image is
|
|
12512
|
+
// fetched from: the optimizer reads local sources from this server's own socket address, as the
|
|
12513
|
+
// development server does. A TLS socket's certificate names the public host, not this address,
|
|
12514
|
+
// so there the request origin still stands in.
|
|
12515
|
+
return socket.encrypted ? undefined : origin
|
|
12477
12516
|
}
|
|
12478
12517
|
|
|
12479
12518
|
// Export the event handler for Nitro
|
|
@@ -13004,7 +13043,8 @@ function toFarmNodeResponse(request, response) {
|
|
|
13004
13043
|
buildDir: path12.join(root, distDir),
|
|
13005
13044
|
middlewareRoutes: edgeMiddlewareRoutes,
|
|
13006
13045
|
guardedPages: edgeGuardedPrerenderRoutes
|
|
13007
|
-
}
|
|
13046
|
+
},
|
|
13047
|
+
prerenderRoutes.map(toPrerenderPublicPath)
|
|
13008
13048
|
);
|
|
13009
13049
|
}
|
|
13010
13050
|
logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
|
|
@@ -13103,7 +13143,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
13103
13143
|
await fs4.cp(src, dest, { recursive: true, force: true });
|
|
13104
13144
|
await fs4.rm(src, { recursive: true, force: true });
|
|
13105
13145
|
}
|
|
13106
|
-
async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware) {
|
|
13146
|
+
async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware, prerenderedPages) {
|
|
13107
13147
|
const serverDir = path12.join(outputDir, "server");
|
|
13108
13148
|
const functionsDir = path12.join(outputDir, "functions");
|
|
13109
13149
|
const nitroFuncDir = path12.join(functionsDir, "__nitro.func");
|
|
@@ -13151,7 +13191,8 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
13151
13191
|
vercelConfig.routes = buildFarmVercelRoutes({
|
|
13152
13192
|
presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
|
|
13153
13193
|
runtimeRoutes,
|
|
13154
|
-
middlewareRoutes: edgeMiddlewareRoutes.length > 0 ? [createFarmVercelEdgeMiddlewareRoute(edgeMiddleware.guardedPages, config.basePath)] : []
|
|
13194
|
+
middlewareRoutes: edgeMiddlewareRoutes.length > 0 ? [createFarmVercelEdgeMiddlewareRoute(edgeMiddleware.guardedPages, config.basePath)] : [],
|
|
13195
|
+
canonicalSlashRoutes: createFarmVercelCanonicalSlashRoutes(prerenderedPages)
|
|
13155
13196
|
});
|
|
13156
13197
|
const vercelConfigWithWorkflowCrons = applyFarmWorkflowVercelCrons(
|
|
13157
13198
|
vercelConfig,
|
|
@@ -13782,7 +13823,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13782
13823
|
}
|
|
13783
13824
|
async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
13784
13825
|
const { farmI18nClientBridgePlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
13785
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
13826
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
|
|
13786
13827
|
const pluginManager = new PluginManager2({
|
|
13787
13828
|
config,
|
|
13788
13829
|
isDev: false,
|
|
@@ -13809,7 +13850,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
13809
13850
|
}
|
|
13810
13851
|
async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
13811
13852
|
const { farmI18nClientBridgePlugin, farmPlugin } = await import("./vite.mjs");
|
|
13812
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
13853
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-VEBRN7A3.mjs");
|
|
13813
13854
|
const pluginManager = new PluginManager2({
|
|
13814
13855
|
config,
|
|
13815
13856
|
isDev: false,
|
|
@@ -39,6 +39,10 @@ import {
|
|
|
39
39
|
import {
|
|
40
40
|
loadFarmDevModule
|
|
41
41
|
} from "./chunk-TUOO6IK3.mjs";
|
|
42
|
+
import {
|
|
43
|
+
isFarmI18nCatalogFile,
|
|
44
|
+
resolveFarmI18nConfig
|
|
45
|
+
} from "./chunk-MU5V7XHL.mjs";
|
|
42
46
|
import {
|
|
43
47
|
toPosixPath,
|
|
44
48
|
toViteModuleId
|
|
@@ -48,6 +52,10 @@ import {
|
|
|
48
52
|
readNodeRequestBody,
|
|
49
53
|
resolveFarmServerConfig
|
|
50
54
|
} from "./chunk-QDWMCFTH.mjs";
|
|
55
|
+
import {
|
|
56
|
+
createFarmLocaleCookie,
|
|
57
|
+
getFarmLocaleVaryHeaders
|
|
58
|
+
} from "./chunk-K76CBYQM.mjs";
|
|
51
59
|
import {
|
|
52
60
|
resolveFarmRequestURL
|
|
53
61
|
} from "./chunk-5OFNUETM.mjs";
|
|
@@ -59,6 +67,30 @@ import {
|
|
|
59
67
|
|
|
60
68
|
// src/api/vite-plugin.ts
|
|
61
69
|
import nodePath from "path";
|
|
70
|
+
function createDevI18n(server) {
|
|
71
|
+
const farmConfig = server.config;
|
|
72
|
+
if (!farmConfig.i18n) return void 0;
|
|
73
|
+
return loadDevI18n(
|
|
74
|
+
server,
|
|
75
|
+
resolveFarmI18nConfig(farmConfig.i18n, {
|
|
76
|
+
root: server.config.root,
|
|
77
|
+
mode: "development",
|
|
78
|
+
basePath: farmConfig.basePath ?? "/"
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
async function loadDevI18n(server, config) {
|
|
83
|
+
const { _runWithFarmI18nRequest, createFarmI18nRuntime } = await import("./i18n/server.mjs");
|
|
84
|
+
const runtime = createFarmI18nRuntime(config);
|
|
85
|
+
await runtime.initialize();
|
|
86
|
+
server.watcher?.on?.("change", (file) => {
|
|
87
|
+
if (!isFarmI18nCatalogFile(config, file)) return;
|
|
88
|
+
runtime.reload().catch((error) => {
|
|
89
|
+
console.error("[FARM] Could not reload the i18n catalogs:", error);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
return { runtime, run: _runWithFarmI18nRequest };
|
|
93
|
+
}
|
|
62
94
|
function farmApiPlugin(options = {}) {
|
|
63
95
|
const srcDir = options.srcDir ?? "src";
|
|
64
96
|
const apiDirFromRoot = options.apiDir ?? nodePath.join(srcDir, "api");
|
|
@@ -395,6 +427,43 @@ function farmApiPlugin(options = {}) {
|
|
|
395
427
|
isReady: () => discoveryComplete,
|
|
396
428
|
waitForDiscovery
|
|
397
429
|
};
|
|
430
|
+
const devI18n = createDevI18n(server);
|
|
431
|
+
devI18n?.catch(() => {
|
|
432
|
+
});
|
|
433
|
+
const runWithDevI18n = async (req, res, handle) => {
|
|
434
|
+
const i18n = await devI18n;
|
|
435
|
+
const pathname = (req.url || "/").split("?")[0];
|
|
436
|
+
if (!isFarmAPIPathname(pathname, basePath) && !matchAPIRouteAtBasePath(servedRoutes(), pathname, basePath)) {
|
|
437
|
+
return handle();
|
|
438
|
+
}
|
|
439
|
+
const headers = new Headers();
|
|
440
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
441
|
+
if (value) headers.set(key, Array.isArray(value) ? value.join(", ") : value);
|
|
442
|
+
}
|
|
443
|
+
const request = new Request(resolveFarmRequestURL(req), { headers });
|
|
444
|
+
return i18n.run(
|
|
445
|
+
i18n.runtime,
|
|
446
|
+
request,
|
|
447
|
+
(resolution) => {
|
|
448
|
+
const config = i18n.runtime.config;
|
|
449
|
+
const vary = getFarmLocaleVaryHeaders(config, resolution);
|
|
450
|
+
if (vary.length > 0) {
|
|
451
|
+
const current = String(res.getHeader("Vary") ?? "");
|
|
452
|
+
res.setHeader("Vary", [current, ...vary].filter(Boolean).join(", "));
|
|
453
|
+
}
|
|
454
|
+
if (resolution.persist) {
|
|
455
|
+
const cookies = res.getHeader("Set-Cookie");
|
|
456
|
+
const cookie = createFarmLocaleCookie(resolution.locale, config);
|
|
457
|
+
res.setHeader(
|
|
458
|
+
"Set-Cookie",
|
|
459
|
+
cookies === void 0 ? cookie : [...[cookies].flat().map(String), cookie]
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
return handle();
|
|
463
|
+
},
|
|
464
|
+
{ redirect: false }
|
|
465
|
+
);
|
|
466
|
+
};
|
|
398
467
|
return () => {
|
|
399
468
|
const apiMiddleware = _withAfterNodeMiddleware(async (req, res, next) => {
|
|
400
469
|
const url = req.url || "/";
|
|
@@ -473,13 +542,14 @@ function farmApiPlugin(options = {}) {
|
|
|
473
542
|
}
|
|
474
543
|
});
|
|
475
544
|
server.middlewares.use((req, res, next) => {
|
|
476
|
-
const
|
|
545
|
+
const handle = () => _runWithAPIRequestRuntime(
|
|
477
546
|
{
|
|
478
547
|
basePath: basePath ?? "/api",
|
|
479
548
|
dispatch: async (request) => apiRouterHandler ? apiRouterHandler(request) : Response.json({ error: "Not Found" }, { status: 404 })
|
|
480
549
|
},
|
|
481
550
|
() => apiMiddleware(req, res, next)
|
|
482
551
|
);
|
|
552
|
+
const result = devI18n ? runWithDevI18n(req, res, handle) : handle();
|
|
483
553
|
return Promise.resolve(result).catch((error) => {
|
|
484
554
|
console.error(
|
|
485
555
|
`[FARM] Unhandled API error while handling ${req.method || "GET"} ${req.url || "/"}:`,
|