@farm.js/core 0.1.0-beta.14 → 0.1.0-beta.17
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/after.d.mts +25 -0
- package/dist/after.d.ts +25 -0
- package/dist/agent-runtime.d.mts +96 -0
- package/dist/agent-runtime.d.ts +96 -0
- package/dist/api/route-manager.cjs.map +1 -1
- package/dist/api/route-manager.d.mts +66 -0
- package/dist/api/route-manager.d.ts +66 -0
- package/dist/api/route-manager.mjs +2 -2
- package/dist/api/runtime.cjs.map +1 -1
- package/dist/api/runtime.d.mts +3 -0
- package/dist/api/runtime.d.ts +3 -0
- package/dist/api/runtime.mjs +1 -1
- package/dist/api.cjs +18 -10
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.mts +48 -0
- package/dist/api.d.ts +48 -0
- package/dist/api.mjs +3 -3
- package/dist/app-B0tE1I3o.d.ts +306 -0
- package/dist/app-Dv2JJb7X.d.mts +306 -0
- package/dist/app-markdown.d.mts +24 -0
- package/dist/app-markdown.d.ts +24 -0
- package/dist/cache.d.mts +192 -0
- package/dist/cache.d.ts +192 -0
- package/dist/{chunk-VUL55IAX.mjs → chunk-2FLBZFPG.mjs} +19 -19
- package/dist/chunk-2FLBZFPG.mjs.map +1 -0
- package/dist/{chunk-B232I2GP.mjs → chunk-3HIVDX7J.mjs} +12 -1
- package/dist/chunk-3HIVDX7J.mjs.map +1 -0
- package/dist/{chunk-JDEOUK5V.mjs → chunk-6YXKHAFU.mjs} +3 -3
- package/dist/{chunk-Z5CQMP54.mjs → chunk-ARRYKOI5.mjs} +2 -2
- package/dist/{chunk-KLA67WKG.mjs → chunk-B3FFOIWS.mjs} +2 -2
- package/dist/chunk-E257KFBU.mjs +227 -0
- package/dist/chunk-E257KFBU.mjs.map +1 -0
- package/dist/{chunk-PFE6GMNE.mjs → chunk-HMRFYJK6.mjs} +19 -11
- package/dist/chunk-HMRFYJK6.mjs.map +1 -0
- package/dist/{chunk-OPHK6OJN.mjs → chunk-JAEAE27K.mjs} +2 -2
- package/dist/{chunk-32W4QEJP.mjs → chunk-KFTGPFRD.mjs} +1 -1
- package/dist/chunk-KFTGPFRD.mjs.map +1 -0
- package/dist/{chunk-L2PE36GQ.mjs → chunk-PZXBQKCH.mjs} +15 -6
- package/dist/chunk-PZXBQKCH.mjs.map +1 -0
- package/dist/{chunk-UXUAWNO5.mjs → chunk-RIXKJPGI.mjs} +117 -55
- package/dist/chunk-RIXKJPGI.mjs.map +1 -0
- package/dist/{chunk-PNFQQSRA.mjs → chunk-T2M5QANG.mjs} +143 -41
- package/dist/chunk-T2M5QANG.mjs.map +1 -0
- package/dist/{chunk-WDU6QXNK.mjs → chunk-UCYWGN2P.mjs} +1 -1
- package/dist/chunk-UCYWGN2P.mjs.map +1 -0
- package/dist/{chunk-65A7QIKI.mjs → chunk-UMVLB3PN.mjs} +3 -3
- package/dist/chunk-UMVLB3PN.mjs.map +1 -0
- package/dist/{chunk-ARCGE2VT.mjs → chunk-VFDBC3W7.mjs} +2 -2
- package/dist/{chunk-ARCGE2VT.mjs.map → chunk-VFDBC3W7.mjs.map} +1 -1
- package/dist/{chunk-VY2UYN5R.mjs → chunk-VPCFICID.mjs} +82 -3
- package/dist/chunk-VPCFICID.mjs.map +1 -0
- package/dist/{chunk-H3TE3LOV.mjs → chunk-XMFTIVJH.mjs} +2 -2
- package/dist/{chunk-UB5UOSHB.mjs → chunk-ZVMV3THA.mjs} +71 -2
- package/dist/chunk-ZVMV3THA.mjs.map +1 -0
- package/dist/chunk-recovery-lnQFzcQP.d.mts +26 -0
- package/dist/chunk-recovery-lnQFzcQP.d.ts +26 -0
- package/dist/client-BT1mFQas.d.mts +447 -0
- package/dist/client-Nn0q4eO4.d.ts +447 -0
- package/dist/client-cache-CIlyBlmx.d.ts +6 -0
- package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
- package/dist/client-plugins-278AvYHE.d.mts +2021 -0
- package/dist/client-plugins-CTQAkr7R.d.ts +2021 -0
- package/dist/client-plugins.d.mts +24 -0
- package/dist/client-plugins.d.ts +24 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.mts +452 -0
- package/dist/client.d.ts +452 -0
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +31 -0
- package/dist/config.d.ts +31 -0
- package/dist/cron.d.mts +78 -0
- package/dist/cron.d.ts +78 -0
- package/dist/deferred.d.mts +42 -0
- package/dist/deferred.d.ts +42 -0
- package/dist/deployment.cjs +12 -0
- package/dist/deployment.cjs.map +1 -1
- package/dist/deployment.d.mts +36 -0
- package/dist/deployment.d.ts +36 -0
- package/dist/deployment.mjs +3 -1
- package/dist/{devtools-GAZ7F3KL.mjs → devtools-K2ERKGNI.mjs} +5 -5
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.d.mts +80 -0
- package/dist/docs.d.ts +80 -0
- package/dist/docs.mjs +5 -5
- package/dist/env-types.d.mts +12 -0
- package/dist/env-types.d.ts +12 -0
- package/dist/env.d.mts +45 -0
- package/dist/env.d.ts +45 -0
- package/dist/environment/vite.d.mts +22 -0
- package/dist/environment/vite.d.ts +22 -0
- package/dist/environment.d.mts +18 -0
- package/dist/environment.d.ts +18 -0
- package/dist/font.d.mts +95 -0
- package/dist/font.d.ts +95 -0
- package/dist/headers.d.mts +22 -0
- package/dist/headers.d.ts +22 -0
- package/dist/i18n/client.d.mts +32 -0
- package/dist/i18n/client.d.ts +32 -0
- package/dist/i18n/index.d.mts +20 -0
- package/dist/i18n/index.d.ts +20 -0
- package/dist/i18n/server.d.mts +30 -0
- package/dist/i18n/server.d.ts +30 -0
- package/dist/image/server.d.mts +37 -0
- package/dist/image/server.d.ts +37 -0
- package/dist/image/sharp.d.mts +7 -0
- package/dist/image/sharp.d.ts +7 -0
- package/dist/image-config-Duob7wER.d.mts +50 -0
- package/dist/image-config-Duob7wER.d.ts +50 -0
- package/dist/image.d.mts +39 -0
- package/dist/image.d.ts +39 -0
- package/dist/index.cjs +598 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +477 -0
- package/dist/index.d.ts +477 -0
- package/dist/index.mjs +45 -29
- package/dist/index.mjs.map +1 -1
- package/dist/integration-api-CHT2OKAf.d.mts +93 -0
- package/dist/integration-api-CHT2OKAf.d.ts +93 -0
- package/dist/integrations.d.mts +24 -0
- package/dist/integrations.d.ts +24 -0
- package/dist/internal/build-runtime.cjs +438 -176
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +41 -0
- package/dist/internal/build-runtime.d.ts +41 -0
- package/dist/internal/build-runtime.mjs +13 -13
- package/dist/internal/client-runtime.d.mts +17 -0
- package/dist/internal/client-runtime.d.ts +17 -0
- package/dist/internal/config-runtime.cjs +140 -1
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +41 -0
- package/dist/internal/config-runtime.d.ts +41 -0
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/internal/metadata-image-runtime.d.mts +25 -0
- package/dist/internal/metadata-image-runtime.d.ts +25 -0
- package/dist/internal/production-node-env.d.mts +12 -0
- package/dist/internal/production-node-env.d.ts +12 -0
- package/dist/internal/production-runtime.d.mts +44 -0
- package/dist/internal/production-runtime.d.ts +44 -0
- package/dist/island-CfGru1MO.d.mts +9 -0
- package/dist/island-CfGru1MO.d.ts +9 -0
- package/dist/markdown.d.mts +60 -0
- package/dist/markdown.d.ts +60 -0
- package/dist/metadata-DmCudMw_.d.mts +22 -0
- package/dist/metadata-xghtOlbR.d.ts +22 -0
- package/dist/middleware.cjs +116 -98
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.d.mts +171 -0
- package/dist/middleware.d.ts +171 -0
- package/dist/middleware.mjs +5 -2
- package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
- package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.d.mts +14 -0
- package/dist/navigation.d.ts +14 -0
- package/dist/navigation.mjs +3 -3
- package/dist/observability.d.mts +335 -0
- package/dist/observability.d.ts +335 -0
- package/dist/params-BALtrRim.d.ts +15 -0
- package/dist/params-ry-lxqmy.d.mts +15 -0
- package/dist/plugin-BJDf43dc.d.mts +165 -0
- package/dist/plugin-BJDf43dc.d.ts +165 -0
- package/dist/plugin.cjs +247 -28
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +24 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/plugin.mjs +10 -10
- package/dist/production-runtime-BLxSv9cU.d.ts +79 -0
- package/dist/production-runtime-DFN2_RXq.d.mts +79 -0
- package/dist/query/client.d.mts +61 -0
- package/dist/query/client.d.ts +61 -0
- package/dist/query/index.d.mts +90 -0
- package/dist/query/index.d.ts +90 -0
- package/dist/query/parsers.d.mts +25 -0
- package/dist/query/parsers.d.ts +25 -0
- package/dist/query/server.d.mts +55 -0
- package/dist/query/server.d.ts +55 -0
- package/dist/request-Cq5d6qmE.d.mts +6 -0
- package/dist/request-LoxDW3lp.d.ts +6 -0
- package/dist/request.d.mts +25 -0
- package/dist/request.d.ts +25 -0
- package/dist/resolver-DJqjLMg_.d.mts +14 -0
- package/dist/resolver-IH4RmPEl.d.ts +14 -0
- package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
- package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
- package/dist/router.d.mts +36 -0
- package/dist/router.d.ts +36 -0
- package/dist/routes.d.mts +226 -0
- package/dist/routes.d.ts +226 -0
- package/dist/runtime-BA9TOSu1.d.mts +231 -0
- package/dist/runtime-Cxpq6xZN.d.mts +27 -0
- package/dist/runtime-DTAQ2HDv.d.ts +231 -0
- package/dist/runtime-bv63eUiO.d.ts +27 -0
- package/dist/server-action-security.cjs +23 -1
- package/dist/server-action-security.cjs.map +1 -1
- package/dist/server-action-security.d.mts +45 -0
- package/dist/server-action-security.d.ts +45 -0
- package/dist/server-action-security.mjs +1 -1
- package/dist/server-fn-client.cjs.map +1 -1
- package/dist/server-fn-client.d.mts +33 -0
- package/dist/server-fn-client.d.ts +33 -0
- package/dist/server-fn-client.mjs +1 -1
- package/dist/server-fn-error-DDh14a0V.d.mts +26 -0
- package/dist/server-fn-error-DDh14a0V.d.ts +26 -0
- package/dist/server-fn.cjs +140 -3
- package/dist/server-fn.cjs.map +1 -1
- package/dist/server-fn.d.mts +121 -0
- package/dist/server-fn.d.ts +121 -0
- package/dist/server-fn.mjs +14 -3
- package/dist/server-plugins.d.mts +57 -0
- package/dist/server-plugins.d.ts +57 -0
- package/dist/server-query-client.d.mts +51 -0
- package/dist/server-query-client.d.ts +51 -0
- package/dist/server-query.cjs +99 -1
- package/dist/server-query.cjs.map +1 -1
- package/dist/server-query.d.mts +37 -0
- package/dist/server-query.d.ts +37 -0
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +403 -33
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +51 -0
- package/dist/server.d.ts +51 -0
- package/dist/server.mjs +14 -14
- package/dist/storage.d.mts +52 -0
- package/dist/storage.d.ts +52 -0
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.mts +103 -0
- package/dist/testing.d.ts +103 -0
- package/dist/testing.mjs +3 -3
- package/dist/transport-BmbGTXA5.d.mts +49 -0
- package/dist/transport-BmbGTXA5.d.ts +49 -0
- package/dist/types-BMxWr97v.d.mts +81 -0
- package/dist/types-BMxWr97v.d.ts +81 -0
- package/dist/types-D1A6-XvH.d.mts +73 -0
- package/dist/types-D1A6-XvH.d.ts +73 -0
- package/dist/types-DTzm4TCl.d.mts +78 -0
- package/dist/types-DTzm4TCl.d.ts +78 -0
- package/dist/utils-B6GaYNJL.d.ts +23 -0
- package/dist/utils-CKSHiip6.d.mts +23 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.mts +3 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +255 -30
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +24 -0
- package/dist/vite.d.ts +24 -0
- package/dist/vite.mjs +10 -10
- package/dist/workflows.d.mts +110 -0
- package/dist/workflows.d.ts +110 -0
- package/package.json +1 -1
- package/types/middleware.d.ts +36 -11
- package/dist/chunk-32W4QEJP.mjs.map +0 -1
- package/dist/chunk-65A7QIKI.mjs.map +0 -1
- package/dist/chunk-B232I2GP.mjs.map +0 -1
- package/dist/chunk-I4CUBGVF.mjs +0 -93
- package/dist/chunk-I4CUBGVF.mjs.map +0 -1
- package/dist/chunk-L2PE36GQ.mjs.map +0 -1
- package/dist/chunk-PFE6GMNE.mjs.map +0 -1
- package/dist/chunk-PNFQQSRA.mjs.map +0 -1
- package/dist/chunk-UB5UOSHB.mjs.map +0 -1
- package/dist/chunk-UXUAWNO5.mjs.map +0 -1
- package/dist/chunk-VUL55IAX.mjs.map +0 -1
- package/dist/chunk-VY2UYN5R.mjs.map +0 -1
- package/dist/chunk-WDU6QXNK.mjs.map +0 -1
- /package/dist/{chunk-JDEOUK5V.mjs.map → chunk-6YXKHAFU.mjs.map} +0 -0
- /package/dist/{chunk-Z5CQMP54.mjs.map → chunk-ARRYKOI5.mjs.map} +0 -0
- /package/dist/{chunk-KLA67WKG.mjs.map → chunk-B3FFOIWS.mjs.map} +0 -0
- /package/dist/{chunk-OPHK6OJN.mjs.map → chunk-JAEAE27K.mjs.map} +0 -0
- /package/dist/{chunk-H3TE3LOV.mjs.map → chunk-XMFTIVJH.mjs.map} +0 -0
- /package/dist/{devtools-GAZ7F3KL.mjs.map → devtools-K2ERKGNI.mjs.map} +0 -0
|
@@ -35,8 +35,9 @@ import {
|
|
|
35
35
|
toFarmDocsPublicFontAssets
|
|
36
36
|
} from "./chunk-USLFXFFH.mjs";
|
|
37
37
|
import {
|
|
38
|
-
resolveFarmAuthConfig
|
|
39
|
-
|
|
38
|
+
resolveFarmAuthConfig,
|
|
39
|
+
resolveFarmSecurityConfig
|
|
40
|
+
} from "./chunk-E257KFBU.mjs";
|
|
40
41
|
import {
|
|
41
42
|
FARM_DEVTOOLS_LAUNCH_PARAM,
|
|
42
43
|
FARM_DEVTOOLS_PATH,
|
|
@@ -59,7 +60,7 @@ import {
|
|
|
59
60
|
} from "./chunk-GY2STC2S.mjs";
|
|
60
61
|
import {
|
|
61
62
|
resolveServerActionsConfig
|
|
62
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-ZVMV3THA.mjs";
|
|
63
64
|
import {
|
|
64
65
|
createFarmMarkdownRouteModuleFromFile,
|
|
65
66
|
createFarmMarkdownSourceResponse,
|
|
@@ -86,6 +87,9 @@ import {
|
|
|
86
87
|
getRequestContextSnapshot,
|
|
87
88
|
matchIntegrationRoute
|
|
88
89
|
} from "./chunk-K4667E2Q.mjs";
|
|
90
|
+
import {
|
|
91
|
+
initStorage
|
|
92
|
+
} from "./chunk-T4QJQK76.mjs";
|
|
89
93
|
import {
|
|
90
94
|
MiddlewareManager
|
|
91
95
|
} from "./chunk-MIUW47JX.mjs";
|
|
@@ -95,9 +99,6 @@ import {
|
|
|
95
99
|
_runWithMiddlewareContext,
|
|
96
100
|
_runWithMiddlewareData
|
|
97
101
|
} from "./chunk-P7QDS5AT.mjs";
|
|
98
|
-
import {
|
|
99
|
-
initStorage
|
|
100
|
-
} from "./chunk-T4QJQK76.mjs";
|
|
101
102
|
import {
|
|
102
103
|
_withAfterNodeMiddleware
|
|
103
104
|
} from "./chunk-E6EPN5BT.mjs";
|
|
@@ -109,7 +110,7 @@ import {
|
|
|
109
110
|
discoverProgrammaticRoutePaths,
|
|
110
111
|
findProgrammaticRouteFiles,
|
|
111
112
|
loadProgrammaticRouteManifests
|
|
112
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-ARRYKOI5.mjs";
|
|
113
114
|
import {
|
|
114
115
|
_runWithFarmI18nRequest,
|
|
115
116
|
_setDefaultFarmI18nRuntime,
|
|
@@ -160,13 +161,13 @@ import {
|
|
|
160
161
|
} from "./chunk-RHIFZZUI.mjs";
|
|
161
162
|
import {
|
|
162
163
|
FARM_VERSION
|
|
163
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-VFDBC3W7.mjs";
|
|
164
165
|
import {
|
|
165
166
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
166
167
|
createFarmDeploymentCookie,
|
|
167
168
|
createFarmDeploymentMismatchResponse,
|
|
168
169
|
getFarmDeploymentMismatch
|
|
169
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-3HIVDX7J.mjs";
|
|
170
171
|
import {
|
|
171
172
|
createDeferredDataResponse,
|
|
172
173
|
prepareDeferredData,
|
|
@@ -4725,6 +4726,7 @@ var _FarmApp = class _FarmApp {
|
|
|
4725
4726
|
routeRules: normalizeRouteRules(config.routeRules),
|
|
4726
4727
|
context: config.context || (() => void 0),
|
|
4727
4728
|
serverActions: resolveServerActionsConfig(config.serverActions),
|
|
4729
|
+
security: resolveFarmSecurityConfig(config.security),
|
|
4728
4730
|
images: resolveFarmImageConfig(config.images),
|
|
4729
4731
|
performance: resolveFarmPerformanceConfig(config.performance),
|
|
4730
4732
|
i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : resolveFarmI18nConfig(config.i18n, {
|
|
@@ -5131,7 +5133,7 @@ var HMRManager = _HMRManager;
|
|
|
5131
5133
|
|
|
5132
5134
|
// src/type-artifacts.ts
|
|
5133
5135
|
import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync2, unlinkSync } from "fs";
|
|
5134
|
-
import { dirname as dirname3, join as join4, resolve as resolve3 } from "path";
|
|
5136
|
+
import { dirname as dirname3, isAbsolute as isAbsolute2, join as join4, resolve as resolve3 } from "path";
|
|
5135
5137
|
|
|
5136
5138
|
// src/routing/generate-route-types.ts
|
|
5137
5139
|
import * as path7 from "path";
|
|
@@ -5165,6 +5167,15 @@ function routePatternToRouteLiteral(pattern) {
|
|
|
5165
5167
|
return JSON.stringify(pattern);
|
|
5166
5168
|
}
|
|
5167
5169
|
__name(routePatternToRouteLiteral, "routePatternToRouteLiteral");
|
|
5170
|
+
function renderTypeUnion(values) {
|
|
5171
|
+
return values.length <= 1 ? values[0] || "never" : `
|
|
5172
|
+
| ${values.join("\n | ")}`;
|
|
5173
|
+
}
|
|
5174
|
+
__name(renderTypeUnion, "renderTypeUnion");
|
|
5175
|
+
function renderTypeAlias(name, value) {
|
|
5176
|
+
return `export type ${name} =${value.startsWith("\n") ? "" : " "}${value};`;
|
|
5177
|
+
}
|
|
5178
|
+
__name(renderTypeAlias, "renderTypeAlias");
|
|
5168
5179
|
function createRoutePattern(route) {
|
|
5169
5180
|
if (route.segments.length === 0) return "/";
|
|
5170
5181
|
return "/" + route.segments.map((seg) => {
|
|
@@ -5227,9 +5238,9 @@ async function createRouteTypeDeclarations(options, outPath) {
|
|
|
5227
5238
|
const typeLiterals = Array.from(new Set(sortedPatterns.flatMap(routePatternToTsTypeLiterals)));
|
|
5228
5239
|
const patternLiterals = sortedPatterns.map(routePatternToRouteLiteral);
|
|
5229
5240
|
const routeModulePatternLiterals = Array.from(routeModulePatterns).sort().map(routePatternToRouteLiteral);
|
|
5230
|
-
const routePathType = suppressLintOnLink ? "string" : typeLiterals
|
|
5231
|
-
const routePatternType = suppressLintOnLink ? "string" : patternLiterals
|
|
5232
|
-
const routeModulePatternType = routeModulePatternLiterals
|
|
5241
|
+
const routePathType = suppressLintOnLink ? "string" : renderTypeUnion(typeLiterals);
|
|
5242
|
+
const routePatternType = suppressLintOnLink ? "string" : renderTypeUnion(patternLiterals);
|
|
5243
|
+
const routeModulePatternType = renderTypeUnion(routeModulePatternLiterals);
|
|
5233
5244
|
const routeTypesImportPath = `./${path7.basename(outPath).replace(/\.d\.ts$/, "")}`;
|
|
5234
5245
|
const linkAugmentationBlock = suppressLintOnLink ? "" : `
|
|
5235
5246
|
declare module "@farm.js/core/client" {
|
|
@@ -5271,9 +5282,9 @@ declare global {
|
|
|
5271
5282
|
* Regenerated on dev start and when routes change.
|
|
5272
5283
|
* Set suppressLintOnLink: true in farm.config.ts to accept any string on Link href.
|
|
5273
5284
|
*/
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5285
|
+
${renderTypeAlias("RoutePath", routePathType)}
|
|
5286
|
+
${renderTypeAlias("RoutePattern", routePatternType)}
|
|
5287
|
+
${renderTypeAlias("RouteModulePattern", routeModulePatternType)}${linkAugmentationBlock}${routeModuleAugmentationBlock}
|
|
5277
5288
|
`;
|
|
5278
5289
|
return content;
|
|
5279
5290
|
}
|
|
@@ -5378,7 +5389,8 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
5378
5389
|
const sourceRoots = getFarmSourceRoots({ root, srcDir, layers: options.layers });
|
|
5379
5390
|
const appDirs = getFarmAppDirectories({ root, srcDir, layers: options.layers });
|
|
5380
5391
|
const result = {
|
|
5381
|
-
apiRoutes: []
|
|
5392
|
+
apiRoutes: [],
|
|
5393
|
+
stalePaths: []
|
|
5382
5394
|
};
|
|
5383
5395
|
const unifiedTypesPath = join4(root, srcDir, "farm.d.ts");
|
|
5384
5396
|
const shouldRefreshUnifiedTypes = shouldGenerateRoutes && !options.routeTypesOutFile || shouldGenerateEnv && !options.envTypesOutFile || shouldGenerateI18n && !options.i18nTypesOutFile;
|
|
@@ -5394,22 +5406,29 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
5394
5406
|
unifiedSections.push(await createRouteTypeDeclarations(routeOptions, unifiedTypesPath));
|
|
5395
5407
|
result.routeTypesPath = unifiedTypesPath;
|
|
5396
5408
|
} else if (shouldGenerateRoutes) {
|
|
5397
|
-
|
|
5409
|
+
const routeOptions = {
|
|
5398
5410
|
root,
|
|
5399
5411
|
srcDir,
|
|
5400
5412
|
outFile: options.routeTypesOutFile,
|
|
5401
5413
|
extraRoutes: options.extraRoutes || [],
|
|
5402
5414
|
suppressLintOnLink: options.suppressLintOnLink,
|
|
5403
5415
|
sourceRoots
|
|
5404
|
-
}
|
|
5416
|
+
};
|
|
5417
|
+
if (options.check) {
|
|
5418
|
+
const routeTypesPath = resolveGeneratedPath(root, srcDir, options.routeTypesOutFile);
|
|
5419
|
+
const content = await createRouteTypeDeclarations(routeOptions, routeTypesPath);
|
|
5420
|
+
checkGeneratedFile(routeTypesPath, content, result.stalePaths);
|
|
5421
|
+
result.routeTypesPath = routeTypesPath;
|
|
5422
|
+
} else {
|
|
5423
|
+
result.routeTypesPath = await generateRouteTypes(routeOptions);
|
|
5424
|
+
}
|
|
5405
5425
|
}
|
|
5406
5426
|
if (shouldGenerateApi) {
|
|
5407
5427
|
const generator = new APITypeGenerator(appDirs);
|
|
5408
5428
|
const apiRoutes = generator.scanAPIRoutes();
|
|
5409
5429
|
const apiTypesPath = options.apiTypesOutFile ? resolve3(root, options.apiTypesOutFile) : join4(root, srcDir, "lib", "api.generated.ts");
|
|
5410
5430
|
const content = generator.generateAPIRouter(apiRoutes, { outFile: apiTypesPath });
|
|
5411
|
-
|
|
5412
|
-
writeFileIfChanged(apiTypesPath, content);
|
|
5431
|
+
writeOrCheckGeneratedFile(apiTypesPath, content, options.check, result.stalePaths);
|
|
5413
5432
|
result.apiTypesPath = apiTypesPath;
|
|
5414
5433
|
result.apiRoutes = apiRoutes;
|
|
5415
5434
|
}
|
|
@@ -5427,36 +5446,63 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
5427
5446
|
);
|
|
5428
5447
|
result.envTypesPath = unifiedTypesPath;
|
|
5429
5448
|
} else if (shouldGenerateEnv) {
|
|
5430
|
-
|
|
5449
|
+
const envOptions = {
|
|
5431
5450
|
root,
|
|
5432
5451
|
srcDir,
|
|
5433
5452
|
outFile: options.envTypesOutFile,
|
|
5434
5453
|
configPath: options.configPath,
|
|
5435
5454
|
layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
|
|
5436
|
-
}
|
|
5455
|
+
};
|
|
5456
|
+
if (options.check) {
|
|
5457
|
+
const envTypesPath = resolveGeneratedPath(root, srcDir, options.envTypesOutFile);
|
|
5458
|
+
checkGeneratedFile(
|
|
5459
|
+
envTypesPath,
|
|
5460
|
+
createEnvTypeDeclarations(envOptions, envTypesPath),
|
|
5461
|
+
result.stalePaths
|
|
5462
|
+
);
|
|
5463
|
+
result.envTypesPath = envTypesPath;
|
|
5464
|
+
} else {
|
|
5465
|
+
result.envTypesPath = await generateEnvTypes(envOptions);
|
|
5466
|
+
}
|
|
5437
5467
|
}
|
|
5438
5468
|
if (shouldGenerateImages && options.imageTypesOutFile) {
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
}
|
|
5469
|
+
const imageTypesPath = resolveGeneratedPath(root, srcDir, options.imageTypesOutFile, false);
|
|
5470
|
+
if (options.check) {
|
|
5471
|
+
checkGeneratedFile(imageTypesPath, createFarmImageTypeDeclarations(), result.stalePaths);
|
|
5472
|
+
result.imageTypesPath = imageTypesPath;
|
|
5473
|
+
} else {
|
|
5474
|
+
result.imageTypesPath = generateFarmImageTypes({
|
|
5475
|
+
root,
|
|
5476
|
+
srcDir,
|
|
5477
|
+
outFile: options.imageTypesOutFile
|
|
5478
|
+
});
|
|
5479
|
+
}
|
|
5444
5480
|
}
|
|
5445
5481
|
if (shouldRefreshUnifiedTypes && options.i18nConfig?.enabled && !options.i18nTypesOutFile) {
|
|
5446
5482
|
const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
|
|
5447
5483
|
unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
|
|
5448
5484
|
result.i18nTypesPath = unifiedTypesPath;
|
|
5449
5485
|
} else if (shouldGenerateI18n && options.i18nConfig) {
|
|
5450
|
-
|
|
5451
|
-
root,
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5486
|
+
if (options.check) {
|
|
5487
|
+
const i18nTypesPath = resolveGeneratedPath(root, srcDir, options.i18nTypesOutFile, false);
|
|
5488
|
+
const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
|
|
5489
|
+
checkGeneratedFile(
|
|
5490
|
+
i18nTypesPath,
|
|
5491
|
+
renderFarmI18nTypes(options.i18nConfig.locales, signatures),
|
|
5492
|
+
result.stalePaths
|
|
5493
|
+
);
|
|
5494
|
+
result.i18nTypesPath = i18nTypesPath;
|
|
5495
|
+
} else {
|
|
5496
|
+
result.i18nTypesPath = await generateFarmI18nTypes({
|
|
5497
|
+
root,
|
|
5498
|
+
srcDir,
|
|
5499
|
+
config: options.i18nConfig,
|
|
5500
|
+
outFile: options.i18nTypesOutFile
|
|
5501
|
+
});
|
|
5502
|
+
}
|
|
5456
5503
|
}
|
|
5457
5504
|
if (shouldRefreshUnifiedTypes) {
|
|
5458
|
-
|
|
5459
|
-
writeFileIfChanged(
|
|
5505
|
+
writeOrCheckGeneratedFile(
|
|
5460
5506
|
unifiedTypesPath,
|
|
5461
5507
|
`/**
|
|
5462
5508
|
* Generated by Farm.js. Do not edit.
|
|
@@ -5465,14 +5511,41 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
5465
5511
|
|
|
5466
5512
|
import "@farm.js/core/image";
|
|
5467
5513
|
|
|
5468
|
-
${unifiedSections.join("\n")}
|
|
5514
|
+
${unifiedSections.map((section) => section.trimEnd()).join("\n\n")}
|
|
5515
|
+
`,
|
|
5516
|
+
options.check,
|
|
5517
|
+
result.stalePaths
|
|
5469
5518
|
);
|
|
5470
5519
|
result.typesPath = unifiedTypesPath;
|
|
5471
|
-
|
|
5520
|
+
if (options.check) {
|
|
5521
|
+
collectLegacyTypeArtifacts(root, srcDir, result.stalePaths);
|
|
5522
|
+
} else {
|
|
5523
|
+
removeLegacyTypeArtifacts(root, srcDir);
|
|
5524
|
+
}
|
|
5472
5525
|
}
|
|
5473
5526
|
return result;
|
|
5474
5527
|
}
|
|
5475
5528
|
__name(generateFarmTypeArtifacts, "generateFarmTypeArtifacts");
|
|
5529
|
+
function resolveGeneratedPath(root, srcDir, outFile, relativeToSrc = true) {
|
|
5530
|
+
if (isAbsolute2(outFile)) return resolve3(outFile);
|
|
5531
|
+
return resolve3(root, relativeToSrc ? join4(srcDir, outFile) : outFile);
|
|
5532
|
+
}
|
|
5533
|
+
__name(resolveGeneratedPath, "resolveGeneratedPath");
|
|
5534
|
+
function writeOrCheckGeneratedFile(filePath, content, check, stalePaths) {
|
|
5535
|
+
if (check) {
|
|
5536
|
+
checkGeneratedFile(filePath, content, stalePaths);
|
|
5537
|
+
return;
|
|
5538
|
+
}
|
|
5539
|
+
mkdirSync4(dirname3(filePath), { recursive: true });
|
|
5540
|
+
writeFileIfChanged(filePath, content);
|
|
5541
|
+
}
|
|
5542
|
+
__name(writeOrCheckGeneratedFile, "writeOrCheckGeneratedFile");
|
|
5543
|
+
function checkGeneratedFile(filePath, content, stalePaths) {
|
|
5544
|
+
if (!existsSync4(filePath) || readFileSync2(filePath, "utf8") !== content) {
|
|
5545
|
+
stalePaths.push(filePath);
|
|
5546
|
+
}
|
|
5547
|
+
}
|
|
5548
|
+
__name(checkGeneratedFile, "checkGeneratedFile");
|
|
5476
5549
|
var LEGACY_TYPE_ARTIFACTS = [
|
|
5477
5550
|
["farm-routes.d.ts", "Auto-generated route types"],
|
|
5478
5551
|
["farm-env.d.ts", "Auto-generated env types"],
|
|
@@ -5490,6 +5563,14 @@ function removeLegacyTypeArtifacts(root, srcDir) {
|
|
|
5490
5563
|
}
|
|
5491
5564
|
}
|
|
5492
5565
|
__name(removeLegacyTypeArtifacts, "removeLegacyTypeArtifacts");
|
|
5566
|
+
function collectLegacyTypeArtifacts(root, srcDir, stalePaths) {
|
|
5567
|
+
for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
|
|
5568
|
+
const filePath = join4(root, srcDir, fileName);
|
|
5569
|
+
if (!existsSync4(filePath)) continue;
|
|
5570
|
+
if (readFileSync2(filePath, "utf8").includes(marker)) stalePaths.push(filePath);
|
|
5571
|
+
}
|
|
5572
|
+
}
|
|
5573
|
+
__name(collectLegacyTypeArtifacts, "collectLegacyTypeArtifacts");
|
|
5493
5574
|
|
|
5494
5575
|
// src/vite.ts
|
|
5495
5576
|
import * as fs4 from "fs";
|
|
@@ -5607,12 +5688,31 @@ function createFarmClientOptimizeDepsConfig(entries) {
|
|
|
5607
5688
|
};
|
|
5608
5689
|
}
|
|
5609
5690
|
__name(createFarmClientOptimizeDepsConfig, "createFarmClientOptimizeDepsConfig");
|
|
5691
|
+
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
5692
|
+
return {
|
|
5693
|
+
"@": path10.resolve(projectRoot, srcDir)
|
|
5694
|
+
};
|
|
5695
|
+
}
|
|
5696
|
+
__name(createFarmSourceAlias, "createFarmSourceAlias");
|
|
5610
5697
|
function mergeNoExternal(farmValue, userValue) {
|
|
5611
5698
|
if (farmValue === true || userValue === true) return true;
|
|
5612
5699
|
const normalize = /* @__PURE__ */ __name((value) => value == null || value === true ? [] : Array.isArray(value) ? value : [value], "normalize");
|
|
5613
5700
|
return Array.from(/* @__PURE__ */ new Set([...normalize(farmValue), ...normalize(userValue)]));
|
|
5614
5701
|
}
|
|
5615
5702
|
__name(mergeNoExternal, "mergeNoExternal");
|
|
5703
|
+
function mergeAlias(farmValue, userValue) {
|
|
5704
|
+
if (!farmValue) return userValue || {};
|
|
5705
|
+
if (!userValue) return farmValue;
|
|
5706
|
+
if (!Array.isArray(farmValue) && !Array.isArray(userValue)) {
|
|
5707
|
+
return {
|
|
5708
|
+
...farmValue,
|
|
5709
|
+
...userValue
|
|
5710
|
+
};
|
|
5711
|
+
}
|
|
5712
|
+
const normalize = /* @__PURE__ */ __name((value) => Array.isArray(value) ? [...value] : Object.entries(value).map(([find, replacement]) => ({ find, replacement })), "normalize");
|
|
5713
|
+
return [...normalize(userValue), ...normalize(farmValue)];
|
|
5714
|
+
}
|
|
5715
|
+
__name(mergeAlias, "mergeAlias");
|
|
5616
5716
|
function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
5617
5717
|
const noDiscovery = userConfig.optimizeDeps?.noDiscovery ?? farmConfig.optimizeDeps?.noDiscovery;
|
|
5618
5718
|
const holdUntilCrawlEnd = userConfig.optimizeDeps?.holdUntilCrawlEnd ?? (userConfig.optimizeDeps?.noDiscovery === true ? false : farmConfig.optimizeDeps?.holdUntilCrawlEnd);
|
|
@@ -5627,6 +5727,7 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
5627
5727
|
resolve: {
|
|
5628
5728
|
...farmConfig.resolve,
|
|
5629
5729
|
...userConfig.resolve,
|
|
5730
|
+
alias: mergeAlias(farmConfig.resolve?.alias, userConfig.resolve?.alias),
|
|
5630
5731
|
dedupe: Array.from(
|
|
5631
5732
|
/* @__PURE__ */ new Set([...farmConfig.resolve?.dedupe || [], ...userConfig.resolve?.dedupe || []])
|
|
5632
5733
|
)
|
|
@@ -5700,7 +5801,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
5700
5801
|
}
|
|
5701
5802
|
__name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
|
|
5702
5803
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
5703
|
-
return import("./devtools-
|
|
5804
|
+
return import("./devtools-K2ERKGNI.mjs");
|
|
5704
5805
|
}
|
|
5705
5806
|
__name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
|
|
5706
5807
|
function loadFarmDevtoolsUIRuntime() {
|
|
@@ -9414,7 +9515,7 @@ async function defineConfig(config = {}) {
|
|
|
9414
9515
|
// Stub out problematic server-only modules during dev mode
|
|
9415
9516
|
alias: {
|
|
9416
9517
|
...getFarmLayerAliases(config.layers),
|
|
9417
|
-
|
|
9518
|
+
...createFarmSourceAlias(appRoot, config.srcDir),
|
|
9418
9519
|
// Nitro internals that should not be resolved in browser
|
|
9419
9520
|
"supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
|
|
9420
9521
|
"@poppinss/dumper": "data:text/javascript,export default {};",
|
|
@@ -9461,10 +9562,11 @@ export {
|
|
|
9461
9562
|
generateFarmTypeArtifacts,
|
|
9462
9563
|
createFarmClientOptimizeDepsEntries,
|
|
9463
9564
|
createFarmClientOptimizeDepsConfig,
|
|
9565
|
+
createFarmSourceAlias,
|
|
9464
9566
|
mergeFarmViteConfig,
|
|
9465
9567
|
farmI18nClientBridgePlugin,
|
|
9466
9568
|
rewriteEarlySsrRelativeImports,
|
|
9467
9569
|
farmPlugin,
|
|
9468
9570
|
defineConfig
|
|
9469
9571
|
};
|
|
9470
|
-
//# sourceMappingURL=chunk-
|
|
9572
|
+
//# sourceMappingURL=chunk-T2M5QANG.mjs.map
|