@farm.js/core 0.1.15 → 0.1.16
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 +5 -2
- package/dist/agent-runtime.d.ts +5 -2
- package/dist/api/client.d.mts +3 -2
- package/dist/api/client.d.ts +3 -2
- package/dist/api/route-manager.d.mts +5 -2
- package/dist/api/route-manager.d.ts +5 -2
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/{api-client-C8d7BZNp.d.mts → api-client-B-n3pm_Q.d.mts} +2 -1
- package/dist/{api-client-BWrEbxfO.d.ts → api-client-C0_NZEBl.d.ts} +2 -1
- package/dist/api.d.mts +7 -4
- package/dist/api.d.ts +7 -4
- package/dist/{app-wIYse61b.d.ts → app-AyjEsCBq.d.ts} +3 -3
- package/dist/{app-B3nVSjen.d.mts → app-CYPHeOo_.d.mts} +3 -3
- package/dist/app-markdown.d.mts +6 -3
- package/dist/app-markdown.d.ts +6 -3
- package/dist/{chunk-FOGLGRDS.mjs → chunk-7HDZYYS4.mjs} +100 -8
- package/dist/{chunk-UE75PB52.mjs → chunk-IL5RWYK7.mjs} +1 -1
- package/dist/{chunk-GNTPTTLA.mjs → chunk-IXTEENRS.mjs} +1 -1
- package/dist/{chunk-JRF3C33L.mjs → chunk-NHHKW2T6.mjs} +5 -4
- package/dist/{chunk-NJ47VORC.mjs → chunk-NUD6XBMO.mjs} +1 -1
- package/dist/{chunk-FBHGHMOA.mjs → chunk-TYVVIQ5M.mjs} +10 -7
- package/dist/{chunk-W7IVHTOP.mjs → chunk-UQZPTIML.mjs} +15 -2
- package/dist/{chunk-S3QW3BIS.mjs → chunk-VVTREAG5.mjs} +89 -4
- package/dist/{client-plugins-C1EgdoJM.d.mts → client-plugins-CIPRtSsW.d.mts} +16 -4
- package/dist/{client-plugins-CslwYp3E.d.ts → client-plugins-CqVtZi5X.d.ts} +16 -4
- package/dist/client-plugins.d.mts +5 -2
- package/dist/client-plugins.d.ts +5 -2
- package/dist/client.d.mts +8 -7
- package/dist/client.d.ts +8 -7
- package/dist/config.d.mts +5 -2
- package/dist/config.d.ts +5 -2
- package/dist/{devtools-PCGEBRSC.mjs → devtools-IU7LKZOH.mjs} +2 -2
- package/dist/docs.cjs +74 -3
- package/dist/docs.mjs +3 -3
- package/dist/{route-C6UClI1z.d.mts → endpoint-Bu3XgeMK.d.mts} +3 -128
- package/dist/{route-CHBaW55F.d.ts → endpoint-kSAxE52R.d.ts} +3 -128
- package/dist/env.cjs +101 -8
- package/dist/env.d.mts +20 -2
- package/dist/env.d.ts +20 -2
- package/dist/env.mjs +3 -1
- package/dist/index.cjs +212 -19
- package/dist/index.d.mts +16 -15
- package/dist/index.d.ts +16 -15
- package/dist/index.mjs +20 -8
- package/dist/integrations.d.mts +5 -2
- package/dist/integrations.d.ts +5 -2
- package/dist/internal/app-markdown-runtime.d.mts +5 -2
- package/dist/internal/app-markdown-runtime.d.ts +5 -2
- package/dist/internal/build-runtime.cjs +264 -169
- package/dist/internal/build-runtime.d.mts +7 -4
- package/dist/internal/build-runtime.d.ts +7 -4
- package/dist/internal/build-runtime.mjs +6 -6
- package/dist/internal/cli-runtime.cjs +68 -4
- package/dist/internal/cli-runtime.mjs +2 -2
- package/dist/internal/client-error-overlay.cjs +1 -1
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +5 -2
- package/dist/internal/compression-runtime.d.ts +5 -2
- package/dist/internal/config-runtime.cjs +68 -4
- package/dist/internal/config-runtime.d.mts +6 -3
- package/dist/internal/config-runtime.d.ts +6 -3
- package/dist/internal/config-runtime.mjs +2 -2
- package/dist/internal/product-telemetry-runtime.cjs +1 -1
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.d.mts +11 -8
- package/dist/internal/production-runtime.d.ts +11 -8
- package/dist/{metadata-BsUcOEXg.d.ts → metadata-8g__AMPM.d.ts} +1 -1
- package/dist/{metadata-B1bxCPUY.d.mts → metadata-OMX6wFNf.d.mts} +1 -1
- package/dist/middleware.d.mts +7 -4
- package/dist/middleware.d.ts +7 -4
- package/dist/{nitro-ICBP5APY.mjs → nitro-3N4ZXRYM.mjs} +5 -2
- package/dist/plugin.cjs +108 -7
- package/dist/plugin.d.mts +5 -2
- package/dist/plugin.d.ts +5 -2
- package/dist/plugin.mjs +3 -3
- package/dist/{production-runtime-CsNn2-zx.d.ts → production-runtime-BJh7o6Cr.d.ts} +1 -1
- package/dist/{production-runtime-BDllolVh.d.mts → production-runtime-W3M0eNDV.d.mts} +1 -1
- package/dist/{render-plan-EG4hNFjy.d.ts → render-plan-Be4ZGTJP.d.ts} +1 -1
- package/dist/{render-plan-CNUlzylR.d.mts → render-plan-io7pvDNc.d.mts} +1 -1
- package/dist/renderer-client.d.mts +5 -4
- package/dist/renderer-client.d.ts +5 -4
- package/dist/{request-Blh_f7Z3.d.mts → request-DZkHYQ89.d.mts} +1 -1
- package/dist/{request-DsVSQVfD.d.ts → request-G8JhKr4F.d.ts} +1 -1
- package/dist/request.d.mts +6 -3
- package/dist/request.d.ts +6 -3
- package/dist/route-BxNJT447.d.ts +128 -0
- package/dist/route-C_eLaFTZ.d.mts +128 -0
- package/dist/{route-rendering-hUETRCbM.d.ts → route-rendering-BcLLPJgN.d.ts} +1 -1
- package/dist/{route-rendering-LT4XSoQK.d.mts → route-rendering-CbAKr1TY.d.mts} +1 -1
- package/dist/routes.d.mts +4 -2
- package/dist/routes.d.ts +4 -2
- package/dist/server-fn-client.d.mts +3 -2
- package/dist/server-fn-client.d.ts +3 -2
- package/dist/server-fn.cjs +141 -3
- package/dist/server-fn.d.mts +72 -1
- package/dist/server-fn.d.ts +72 -1
- package/dist/server-fn.mjs +12 -1
- package/dist/server-plugins.d.mts +6 -3
- package/dist/server-plugins.d.ts +6 -3
- package/dist/server-query-client.d.mts +1 -0
- package/dist/server-query-client.d.ts +1 -0
- package/dist/server-query.cjs +60 -3
- package/dist/server-query.d.mts +6 -1
- package/dist/server-query.d.ts +6 -1
- package/dist/server-query.mjs +3 -2
- package/dist/server.cjs +161 -11
- package/dist/server.d.mts +9 -8
- package/dist/server.d.ts +9 -8
- package/dist/server.mjs +6 -6
- package/dist/{spa-router-csKR9Ebj.d.mts → spa-router-BcS_4nqm.d.mts} +2 -2
- package/dist/{spa-router-Y_2FSJQK.d.ts → spa-router-BzFBUJkn.d.ts} +2 -2
- package/dist/testing.d.mts +5 -3
- package/dist/testing.d.ts +5 -3
- package/dist/{utils-DR2wfZAn.d.mts → utils-5kQP1mFR.d.mts} +1 -1
- package/dist/{utils-jISOE9SD.d.ts → utils-C4yrAhNc.d.ts} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +246 -149
- package/dist/vite.d.mts +5 -2
- package/dist/vite.d.ts +5 -2
- package/dist/vite.mjs +3 -3
- package/package.json +1 -1
|
@@ -31,6 +31,259 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
));
|
|
32
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
33
|
|
|
34
|
+
// src/env.ts
|
|
35
|
+
function resolveEnv(config, source = getProcessEnv()) {
|
|
36
|
+
const resolved = {
|
|
37
|
+
server: resolveEnvScope(config?.server, source, "server"),
|
|
38
|
+
public: resolveEnvScope(config?.public, source, "public")
|
|
39
|
+
};
|
|
40
|
+
return resolved;
|
|
41
|
+
}
|
|
42
|
+
function createBundledEnv(env2, source = getProcessEnv()) {
|
|
43
|
+
const resolved = normalizeResolvedEnv(env2 ?? {});
|
|
44
|
+
const server = {};
|
|
45
|
+
const runtime3 = {};
|
|
46
|
+
for (const [key, value] of Object.entries(resolved.server)) {
|
|
47
|
+
if (source[key] === void 0) {
|
|
48
|
+
server[key] = value;
|
|
49
|
+
} else {
|
|
50
|
+
runtime3[key] = getRuntimeEnvType(value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
server,
|
|
55
|
+
public: resolved.public,
|
|
56
|
+
...Object.keys(runtime3).length > 0 ? { runtime: { server: runtime3 } } : {}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function setEnv(env2) {
|
|
60
|
+
currentEnv = prepareEnv(env2);
|
|
61
|
+
if (typeof window === "undefined") {
|
|
62
|
+
farmEnvGlobal[FARM_ENV_SYMBOL] = currentEnv;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function getResolvedEnv() {
|
|
66
|
+
const env2 = getCurrentEnv();
|
|
67
|
+
if (typeof window === "undefined") readRuntimeServerEnv(env2);
|
|
68
|
+
return env2;
|
|
69
|
+
}
|
|
70
|
+
function resolveEnvScope(shape, source, scope) {
|
|
71
|
+
if (!shape) {
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
const resolved = {};
|
|
75
|
+
for (const [key, parser] of Object.entries(shape)) {
|
|
76
|
+
try {
|
|
77
|
+
resolved[key] = parseEnvValue(parser, source[key], key, scope);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
80
|
+
throw new Error(`Invalid ${scope} env "${key}": ${message}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return resolved;
|
|
84
|
+
}
|
|
85
|
+
function parseEnvValue(parser, value, key, scope) {
|
|
86
|
+
if (typeof parser === "function") {
|
|
87
|
+
return parser(value, { key, scope });
|
|
88
|
+
}
|
|
89
|
+
if (parser && typeof parser.parse === "function") {
|
|
90
|
+
return parser.parse(value);
|
|
91
|
+
}
|
|
92
|
+
throw new Error("expected a parser function or schema with parse()");
|
|
93
|
+
}
|
|
94
|
+
function createEnvProxy(scope) {
|
|
95
|
+
return new Proxy(
|
|
96
|
+
{},
|
|
97
|
+
{
|
|
98
|
+
get(_target, property) {
|
|
99
|
+
if (typeof property === "symbol") {
|
|
100
|
+
return void 0;
|
|
101
|
+
}
|
|
102
|
+
const env2 = getEnvScope(scope);
|
|
103
|
+
return scope === "server" ? readServerEnvKey(env2, property) : env2[property];
|
|
104
|
+
},
|
|
105
|
+
ownKeys() {
|
|
106
|
+
return Reflect.ownKeys(getEnvScope(scope));
|
|
107
|
+
},
|
|
108
|
+
getOwnPropertyDescriptor(_target, property) {
|
|
109
|
+
const env2 = getEnvScope(scope);
|
|
110
|
+
if (!(property in env2)) {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
configurable: true,
|
|
116
|
+
value: env2[property]
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
has(_target, property) {
|
|
120
|
+
return property in getEnvScope(scope);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
function getEnvScope(scope) {
|
|
126
|
+
const env2 = getCurrentEnv();
|
|
127
|
+
if (scope === "server") {
|
|
128
|
+
assertServerEnvAccess();
|
|
129
|
+
readRuntimeServerEnv(env2);
|
|
130
|
+
}
|
|
131
|
+
return env2[scope] || {};
|
|
132
|
+
}
|
|
133
|
+
function readServerEnvKey(server, key) {
|
|
134
|
+
const value = server[key];
|
|
135
|
+
if (value === void 0) {
|
|
136
|
+
const state = getCurrentEnv()[FARM_ENV_RUNTIME_SYMBOL];
|
|
137
|
+
if (state && key in state.pending && !state.warned.has(key)) {
|
|
138
|
+
state.warned.add(key);
|
|
139
|
+
console.warn(
|
|
140
|
+
`[Farm] Server env "${key}" was set when this app was built but is not set where the server runs, so it reads as undefined. Farm reads server env at runtime and does not store it in the build output; set "${key}" in the server's environment.`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
function readRuntimeServerEnv(env2) {
|
|
147
|
+
const state = env2[FARM_ENV_RUNTIME_SYMBOL];
|
|
148
|
+
if (!state) return;
|
|
149
|
+
const source = getProcessEnv();
|
|
150
|
+
for (const [key, type] of Object.entries(state.pending)) {
|
|
151
|
+
const raw = source[key];
|
|
152
|
+
if (raw === void 0) continue;
|
|
153
|
+
env2.server[key] = coerceRuntimeEnvValue(raw, type);
|
|
154
|
+
delete state.pending[key];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function getRuntimeEnvType(value) {
|
|
158
|
+
if (typeof value === "number") return "number";
|
|
159
|
+
if (typeof value === "boolean") return "boolean";
|
|
160
|
+
if (value !== null && typeof value === "object" && !(value instanceof Date)) return "json";
|
|
161
|
+
return "string";
|
|
162
|
+
}
|
|
163
|
+
function coerceRuntimeEnvValue(raw, type) {
|
|
164
|
+
if (type === "number") {
|
|
165
|
+
const value = Number(raw);
|
|
166
|
+
return raw.trim() !== "" && Number.isFinite(value) ? value : raw;
|
|
167
|
+
}
|
|
168
|
+
if (type === "boolean") {
|
|
169
|
+
if (/^(true|1)$/i.test(raw.trim())) return true;
|
|
170
|
+
if (/^(false|0|)$/i.test(raw.trim())) return false;
|
|
171
|
+
return raw;
|
|
172
|
+
}
|
|
173
|
+
if (type === "json") {
|
|
174
|
+
try {
|
|
175
|
+
return JSON.parse(raw);
|
|
176
|
+
} catch {
|
|
177
|
+
return raw;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return raw;
|
|
181
|
+
}
|
|
182
|
+
function prepareEnv(env2) {
|
|
183
|
+
const normalized = normalizeResolvedEnv(env2);
|
|
184
|
+
const runtime3 = env2.runtime?.server;
|
|
185
|
+
if (!isRecord(runtime3) || Object.keys(runtime3).length === 0) return normalized;
|
|
186
|
+
const prepared = { server: { ...normalized.server }, public: normalized.public };
|
|
187
|
+
Object.defineProperty(prepared, FARM_ENV_RUNTIME_SYMBOL, {
|
|
188
|
+
value: {
|
|
189
|
+
pending: { ...runtime3 },
|
|
190
|
+
warned: /* @__PURE__ */ new Set()
|
|
191
|
+
},
|
|
192
|
+
enumerable: false
|
|
193
|
+
});
|
|
194
|
+
return prepared;
|
|
195
|
+
}
|
|
196
|
+
function assertServerEnvAccess() {
|
|
197
|
+
if (typeof window !== "undefined") {
|
|
198
|
+
throw new Error("Farm server env is not available in the browser. Use publicEnv.");
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function getInitialEnv() {
|
|
202
|
+
const injectedEnv = getInjectedEnv();
|
|
203
|
+
if (injectedEnv) {
|
|
204
|
+
return injectedEnv;
|
|
205
|
+
}
|
|
206
|
+
if (typeof window === "undefined" && farmEnvGlobal[FARM_ENV_SYMBOL]) {
|
|
207
|
+
return normalizeResolvedEnv(farmEnvGlobal[FARM_ENV_SYMBOL]);
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
server: {},
|
|
211
|
+
public: getInjectedPublicEnv()
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function getCurrentEnv() {
|
|
215
|
+
if (typeof window === "undefined" && farmEnvGlobal[FARM_ENV_SYMBOL]) {
|
|
216
|
+
return farmEnvGlobal[FARM_ENV_SYMBOL];
|
|
217
|
+
}
|
|
218
|
+
return currentEnv;
|
|
219
|
+
}
|
|
220
|
+
function getInjectedEnv() {
|
|
221
|
+
try {
|
|
222
|
+
if (typeof __FARM_ENV__ !== "undefined" && __FARM_ENV__) {
|
|
223
|
+
return prepareEnv(__FARM_ENV__);
|
|
224
|
+
}
|
|
225
|
+
} catch {
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
function getInjectedPublicEnv() {
|
|
230
|
+
try {
|
|
231
|
+
if (typeof __FARM_PUBLIC_ENV__ !== "undefined" && __FARM_PUBLIC_ENV__) {
|
|
232
|
+
return __FARM_PUBLIC_ENV__;
|
|
233
|
+
}
|
|
234
|
+
} catch {
|
|
235
|
+
}
|
|
236
|
+
return {};
|
|
237
|
+
}
|
|
238
|
+
function normalizeResolvedEnv(env2) {
|
|
239
|
+
return {
|
|
240
|
+
server: isRecord(env2.server) ? env2.server : {},
|
|
241
|
+
public: isRecord(env2.public) ? env2.public : {}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function isRecord(value) {
|
|
245
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
246
|
+
}
|
|
247
|
+
function getProcessEnv() {
|
|
248
|
+
if (typeof process !== "undefined" && process.env) {
|
|
249
|
+
return process.env;
|
|
250
|
+
}
|
|
251
|
+
return {};
|
|
252
|
+
}
|
|
253
|
+
var FARM_ENV_SYMBOL, FARM_ENV_RUNTIME_SYMBOL, farmEnvGlobal, currentEnv, env, publicEnv;
|
|
254
|
+
var init_env = __esm({
|
|
255
|
+
"src/env.ts"() {
|
|
256
|
+
"use strict";
|
|
257
|
+
FARM_ENV_SYMBOL = /* @__PURE__ */ Symbol.for("farm.env");
|
|
258
|
+
FARM_ENV_RUNTIME_SYMBOL = /* @__PURE__ */ Symbol.for("farm.env.runtime");
|
|
259
|
+
farmEnvGlobal = globalThis;
|
|
260
|
+
currentEnv = getInitialEnv();
|
|
261
|
+
__name(resolveEnv, "resolveEnv");
|
|
262
|
+
__name(createBundledEnv, "createBundledEnv");
|
|
263
|
+
__name(setEnv, "setEnv");
|
|
264
|
+
__name(getResolvedEnv, "getResolvedEnv");
|
|
265
|
+
env = createEnvProxy("server");
|
|
266
|
+
publicEnv = createEnvProxy("public");
|
|
267
|
+
__name(resolveEnvScope, "resolveEnvScope");
|
|
268
|
+
__name(parseEnvValue, "parseEnvValue");
|
|
269
|
+
__name(createEnvProxy, "createEnvProxy");
|
|
270
|
+
__name(getEnvScope, "getEnvScope");
|
|
271
|
+
__name(readServerEnvKey, "readServerEnvKey");
|
|
272
|
+
__name(readRuntimeServerEnv, "readRuntimeServerEnv");
|
|
273
|
+
__name(getRuntimeEnvType, "getRuntimeEnvType");
|
|
274
|
+
__name(coerceRuntimeEnvValue, "coerceRuntimeEnvValue");
|
|
275
|
+
__name(prepareEnv, "prepareEnv");
|
|
276
|
+
__name(assertServerEnvAccess, "assertServerEnvAccess");
|
|
277
|
+
__name(getInitialEnv, "getInitialEnv");
|
|
278
|
+
__name(getCurrentEnv, "getCurrentEnv");
|
|
279
|
+
__name(getInjectedEnv, "getInjectedEnv");
|
|
280
|
+
__name(getInjectedPublicEnv, "getInjectedPublicEnv");
|
|
281
|
+
__name(normalizeResolvedEnv, "normalizeResolvedEnv");
|
|
282
|
+
__name(isRecord, "isRecord");
|
|
283
|
+
__name(getProcessEnv, "getProcessEnv");
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
34
287
|
// src/plugin-dependencies.ts
|
|
35
288
|
function pluginShortName(name2) {
|
|
36
289
|
return name2.slice(Math.max(name2.lastIndexOf(":"), name2.lastIndexOf("/")) + 1);
|
|
@@ -5786,168 +6039,6 @@ var init_cron = __esm({
|
|
|
5786
6039
|
}
|
|
5787
6040
|
});
|
|
5788
6041
|
|
|
5789
|
-
// src/env.ts
|
|
5790
|
-
function resolveEnv(config, source = getProcessEnv()) {
|
|
5791
|
-
const resolved = {
|
|
5792
|
-
server: resolveEnvScope(config?.server, source, "server"),
|
|
5793
|
-
public: resolveEnvScope(config?.public, source, "public")
|
|
5794
|
-
};
|
|
5795
|
-
return resolved;
|
|
5796
|
-
}
|
|
5797
|
-
function setEnv(env2) {
|
|
5798
|
-
currentEnv = normalizeResolvedEnv(env2);
|
|
5799
|
-
if (typeof window === "undefined") {
|
|
5800
|
-
farmEnvGlobal[FARM_ENV_SYMBOL] = currentEnv;
|
|
5801
|
-
}
|
|
5802
|
-
}
|
|
5803
|
-
function getResolvedEnv() {
|
|
5804
|
-
return getCurrentEnv();
|
|
5805
|
-
}
|
|
5806
|
-
function resolveEnvScope(shape, source, scope) {
|
|
5807
|
-
if (!shape) {
|
|
5808
|
-
return {};
|
|
5809
|
-
}
|
|
5810
|
-
const resolved = {};
|
|
5811
|
-
for (const [key, parser] of Object.entries(shape)) {
|
|
5812
|
-
try {
|
|
5813
|
-
resolved[key] = parseEnvValue(parser, source[key], key, scope);
|
|
5814
|
-
} catch (error) {
|
|
5815
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
5816
|
-
throw new Error(`Invalid ${scope} env "${key}": ${message}`);
|
|
5817
|
-
}
|
|
5818
|
-
}
|
|
5819
|
-
return resolved;
|
|
5820
|
-
}
|
|
5821
|
-
function parseEnvValue(parser, value, key, scope) {
|
|
5822
|
-
if (typeof parser === "function") {
|
|
5823
|
-
return parser(value, { key, scope });
|
|
5824
|
-
}
|
|
5825
|
-
if (parser && typeof parser.parse === "function") {
|
|
5826
|
-
return parser.parse(value);
|
|
5827
|
-
}
|
|
5828
|
-
throw new Error("expected a parser function or schema with parse()");
|
|
5829
|
-
}
|
|
5830
|
-
function createEnvProxy(scope) {
|
|
5831
|
-
return new Proxy(
|
|
5832
|
-
{},
|
|
5833
|
-
{
|
|
5834
|
-
get(_target, property) {
|
|
5835
|
-
if (typeof property === "symbol") {
|
|
5836
|
-
return void 0;
|
|
5837
|
-
}
|
|
5838
|
-
const env2 = getEnvScope(scope);
|
|
5839
|
-
return env2[property];
|
|
5840
|
-
},
|
|
5841
|
-
ownKeys() {
|
|
5842
|
-
return Reflect.ownKeys(getEnvScope(scope));
|
|
5843
|
-
},
|
|
5844
|
-
getOwnPropertyDescriptor(_target, property) {
|
|
5845
|
-
const env2 = getEnvScope(scope);
|
|
5846
|
-
if (!(property in env2)) {
|
|
5847
|
-
return void 0;
|
|
5848
|
-
}
|
|
5849
|
-
return {
|
|
5850
|
-
enumerable: true,
|
|
5851
|
-
configurable: true,
|
|
5852
|
-
value: env2[property]
|
|
5853
|
-
};
|
|
5854
|
-
},
|
|
5855
|
-
has(_target, property) {
|
|
5856
|
-
return property in getEnvScope(scope);
|
|
5857
|
-
}
|
|
5858
|
-
}
|
|
5859
|
-
);
|
|
5860
|
-
}
|
|
5861
|
-
function getEnvScope(scope) {
|
|
5862
|
-
if (scope === "server") {
|
|
5863
|
-
assertServerEnvAccess();
|
|
5864
|
-
}
|
|
5865
|
-
return getCurrentEnv()[scope] || {};
|
|
5866
|
-
}
|
|
5867
|
-
function assertServerEnvAccess() {
|
|
5868
|
-
if (typeof window !== "undefined") {
|
|
5869
|
-
throw new Error("Farm server env is not available in the browser. Use publicEnv.");
|
|
5870
|
-
}
|
|
5871
|
-
}
|
|
5872
|
-
function getInitialEnv() {
|
|
5873
|
-
const injectedEnv = getInjectedEnv();
|
|
5874
|
-
if (injectedEnv) {
|
|
5875
|
-
return injectedEnv;
|
|
5876
|
-
}
|
|
5877
|
-
if (typeof window === "undefined" && farmEnvGlobal[FARM_ENV_SYMBOL]) {
|
|
5878
|
-
return normalizeResolvedEnv(farmEnvGlobal[FARM_ENV_SYMBOL]);
|
|
5879
|
-
}
|
|
5880
|
-
return {
|
|
5881
|
-
server: {},
|
|
5882
|
-
public: getInjectedPublicEnv()
|
|
5883
|
-
};
|
|
5884
|
-
}
|
|
5885
|
-
function getCurrentEnv() {
|
|
5886
|
-
if (typeof window === "undefined" && farmEnvGlobal[FARM_ENV_SYMBOL]) {
|
|
5887
|
-
return farmEnvGlobal[FARM_ENV_SYMBOL];
|
|
5888
|
-
}
|
|
5889
|
-
return currentEnv;
|
|
5890
|
-
}
|
|
5891
|
-
function getInjectedEnv() {
|
|
5892
|
-
try {
|
|
5893
|
-
if (typeof __FARM_ENV__ !== "undefined" && __FARM_ENV__) {
|
|
5894
|
-
return normalizeResolvedEnv(__FARM_ENV__);
|
|
5895
|
-
}
|
|
5896
|
-
} catch {
|
|
5897
|
-
}
|
|
5898
|
-
return null;
|
|
5899
|
-
}
|
|
5900
|
-
function getInjectedPublicEnv() {
|
|
5901
|
-
try {
|
|
5902
|
-
if (typeof __FARM_PUBLIC_ENV__ !== "undefined" && __FARM_PUBLIC_ENV__) {
|
|
5903
|
-
return __FARM_PUBLIC_ENV__;
|
|
5904
|
-
}
|
|
5905
|
-
} catch {
|
|
5906
|
-
}
|
|
5907
|
-
return {};
|
|
5908
|
-
}
|
|
5909
|
-
function normalizeResolvedEnv(env2) {
|
|
5910
|
-
return {
|
|
5911
|
-
server: isRecord(env2.server) ? env2.server : {},
|
|
5912
|
-
public: isRecord(env2.public) ? env2.public : {}
|
|
5913
|
-
};
|
|
5914
|
-
}
|
|
5915
|
-
function isRecord(value) {
|
|
5916
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
5917
|
-
}
|
|
5918
|
-
function getProcessEnv() {
|
|
5919
|
-
if (typeof process !== "undefined" && process.env) {
|
|
5920
|
-
return process.env;
|
|
5921
|
-
}
|
|
5922
|
-
return {};
|
|
5923
|
-
}
|
|
5924
|
-
var FARM_ENV_SYMBOL, farmEnvGlobal, currentEnv, env, publicEnv;
|
|
5925
|
-
var init_env = __esm({
|
|
5926
|
-
"src/env.ts"() {
|
|
5927
|
-
"use strict";
|
|
5928
|
-
FARM_ENV_SYMBOL = /* @__PURE__ */ Symbol.for("farm.env");
|
|
5929
|
-
farmEnvGlobal = globalThis;
|
|
5930
|
-
currentEnv = getInitialEnv();
|
|
5931
|
-
__name(resolveEnv, "resolveEnv");
|
|
5932
|
-
__name(setEnv, "setEnv");
|
|
5933
|
-
__name(getResolvedEnv, "getResolvedEnv");
|
|
5934
|
-
env = createEnvProxy("server");
|
|
5935
|
-
publicEnv = createEnvProxy("public");
|
|
5936
|
-
__name(resolveEnvScope, "resolveEnvScope");
|
|
5937
|
-
__name(parseEnvValue, "parseEnvValue");
|
|
5938
|
-
__name(createEnvProxy, "createEnvProxy");
|
|
5939
|
-
__name(getEnvScope, "getEnvScope");
|
|
5940
|
-
__name(assertServerEnvAccess, "assertServerEnvAccess");
|
|
5941
|
-
__name(getInitialEnv, "getInitialEnv");
|
|
5942
|
-
__name(getCurrentEnv, "getCurrentEnv");
|
|
5943
|
-
__name(getInjectedEnv, "getInjectedEnv");
|
|
5944
|
-
__name(getInjectedPublicEnv, "getInjectedPublicEnv");
|
|
5945
|
-
__name(normalizeResolvedEnv, "normalizeResolvedEnv");
|
|
5946
|
-
__name(isRecord, "isRecord");
|
|
5947
|
-
__name(getProcessEnv, "getProcessEnv");
|
|
5948
|
-
}
|
|
5949
|
-
});
|
|
5950
|
-
|
|
5951
6042
|
// src/app-markdown-config.ts
|
|
5952
6043
|
function resolveMdxConfig(config) {
|
|
5953
6044
|
return {
|
|
@@ -20387,7 +20478,7 @@ var init_server3 = __esm({
|
|
|
20387
20478
|
var version;
|
|
20388
20479
|
var init_package = __esm({
|
|
20389
20480
|
"package.json"() {
|
|
20390
|
-
version = "0.1.
|
|
20481
|
+
version = "0.1.16";
|
|
20391
20482
|
}
|
|
20392
20483
|
});
|
|
20393
20484
|
|
|
@@ -36471,7 +36562,7 @@ function getEnvDefines(config, configEnv) {
|
|
|
36471
36562
|
)
|
|
36472
36563
|
};
|
|
36473
36564
|
if (configEnv?.isSsrBuild) {
|
|
36474
|
-
defines.__FARM_ENV__ = JSON.stringify(getFullEnvDefine(config));
|
|
36565
|
+
defines.__FARM_ENV__ = JSON.stringify(createBundledEnv(getFullEnvDefine(config)));
|
|
36475
36566
|
}
|
|
36476
36567
|
return defines;
|
|
36477
36568
|
}
|
|
@@ -40866,6 +40957,7 @@ var fs15, path43, import_node_url12, ALL_TYPE_ARTIFACTS, createEmptyTypeArtifact
|
|
|
40866
40957
|
var init_vite2 = __esm({
|
|
40867
40958
|
"src/vite.ts"() {
|
|
40868
40959
|
"use strict";
|
|
40960
|
+
init_env();
|
|
40869
40961
|
init_app();
|
|
40870
40962
|
init_utils();
|
|
40871
40963
|
init_plugin();
|
|
@@ -41081,7 +41173,7 @@ export const farmRegistry: {
|
|
|
41081
41173
|
clientManifest?: any;
|
|
41082
41174
|
routePaths?: Record<string, string>;
|
|
41083
41175
|
} = {
|
|
41084
|
-
env: ${JSON.stringify(config.env
|
|
41176
|
+
env: ${JSON.stringify(createBundledEnv(config.env), null, 2)},
|
|
41085
41177
|
deploymentId: ${JSON.stringify(config.deploymentId)},
|
|
41086
41178
|
basePath: ${JSON.stringify(config.basePath)},
|
|
41087
41179
|
apiBasePath: ${JSON.stringify(apiBasePath)},
|
|
@@ -41585,7 +41677,7 @@ export default defineEventHandler(async (event: H3Event) => {
|
|
|
41585
41677
|
farmRegistry.apiRouteManager = apiRouteManager;
|
|
41586
41678
|
farmRegistry.routeManager = routeManager;
|
|
41587
41679
|
farmRegistry.serverRenderer = serverRenderer;
|
|
41588
|
-
farmRegistry.env = config.env
|
|
41680
|
+
farmRegistry.env = createBundledEnv(config.env);
|
|
41589
41681
|
farmRegistry.deploymentId = config.deploymentId;
|
|
41590
41682
|
farmRegistry.basePath = config.basePath;
|
|
41591
41683
|
};
|
|
@@ -41650,6 +41742,7 @@ var import_path16;
|
|
|
41650
41742
|
var init_nitro = __esm({
|
|
41651
41743
|
"src/nitro/index.ts"() {
|
|
41652
41744
|
"use strict";
|
|
41745
|
+
init_env();
|
|
41653
41746
|
import_path16 = __toESM(require("path"));
|
|
41654
41747
|
init_workflows();
|
|
41655
41748
|
init_cron();
|
|
@@ -41672,6 +41765,7 @@ __export(build_runtime_exports, {
|
|
|
41672
41765
|
module.exports = __toCommonJS(build_runtime_exports);
|
|
41673
41766
|
|
|
41674
41767
|
// src/build/index.ts
|
|
41768
|
+
init_env();
|
|
41675
41769
|
init_config4();
|
|
41676
41770
|
var import_path17 = __toESM(require("path"));
|
|
41677
41771
|
var import_node_fs14 = require("fs");
|
|
@@ -41682,6 +41776,7 @@ init_server_path();
|
|
|
41682
41776
|
init_layers();
|
|
41683
41777
|
|
|
41684
41778
|
// src/nitro/universal-build.ts
|
|
41779
|
+
init_env();
|
|
41685
41780
|
init_config4();
|
|
41686
41781
|
|
|
41687
41782
|
// src/nitro/client-css-href.ts
|
|
@@ -46366,7 +46461,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
46366
46461
|
},
|
|
46367
46462
|
define: {
|
|
46368
46463
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
46369
|
-
__FARM_ENV__: JSON.stringify(config.env
|
|
46464
|
+
__FARM_ENV__: JSON.stringify(createBundledEnv(config.env)),
|
|
46370
46465
|
__FARM_PUBLIC_ENV__: JSON.stringify(config.env?.public || {})
|
|
46371
46466
|
},
|
|
46372
46467
|
plugins: [
|
|
@@ -51817,7 +51912,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
51817
51912
|
},
|
|
51818
51913
|
define: {
|
|
51819
51914
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
51820
|
-
__FARM_ENV__: JSON.stringify(config.env
|
|
51915
|
+
__FARM_ENV__: JSON.stringify(createBundledEnv(config.env)),
|
|
51821
51916
|
__FARM_PUBLIC_ENV__: JSON.stringify(config.env?.public || {})
|
|
51822
51917
|
},
|
|
51823
51918
|
plugins: [
|
|
@@ -51900,7 +51995,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
51900
51995
|
farmRegistry.apiRouteManager = apiRouteManager;
|
|
51901
51996
|
farmRegistry.routeManager = routeManager;
|
|
51902
51997
|
farmRegistry.serverRenderer = serverRenderer;
|
|
51903
|
-
farmRegistry.env = config.env
|
|
51998
|
+
farmRegistry.env = createBundledEnv(config.env);
|
|
51904
51999
|
const routePaths = {};
|
|
51905
52000
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
51906
52001
|
const bundledPath = entry.modulePath.replace(/.*\/src\/app\//, "").replace(/\.(tsx?|jsx?)$/, ".js");
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { b2 as loadConfig, b1 as resolveConfig, b3 as resolveDeployConfig } from '../client-plugins-
|
|
1
|
+
import { cg as ResolvedFarmConfig } from '../client-plugins-CIPRtSsW.mjs';
|
|
2
|
+
export { b2 as loadConfig, b1 as resolveConfig, b3 as resolveDeployConfig } from '../client-plugins-CIPRtSsW.mjs';
|
|
3
3
|
import { FarmProductionViteRuntime } from './config-runtime.mjs';
|
|
4
|
-
export { l as logger } from '../utils-
|
|
4
|
+
export { l as logger } from '../utils-5kQP1mFR.mjs';
|
|
5
5
|
import '../lifecycle-DK06VuKP.mjs';
|
|
6
|
-
import '../route-
|
|
6
|
+
import '../route-C_eLaFTZ.mjs';
|
|
7
|
+
import '../endpoint-Bu3XgeMK.mjs';
|
|
7
8
|
import '../cache.mjs';
|
|
8
9
|
import '../renderer.mjs';
|
|
9
10
|
import '../deployment.mjs';
|
|
@@ -30,6 +31,8 @@ import '../server-fn-error-DDh14a0V.mjs';
|
|
|
30
31
|
import 'esbuild';
|
|
31
32
|
import '../image-config-Duob7wER.mjs';
|
|
32
33
|
import '../types-Z0aotQ8w.mjs';
|
|
34
|
+
import '../server-fn.mjs';
|
|
35
|
+
import '../server-query.mjs';
|
|
33
36
|
import '../types-DQnyD3VD.mjs';
|
|
34
37
|
import '../font.mjs';
|
|
35
38
|
import '../after.mjs';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { b2 as loadConfig, b1 as resolveConfig, b3 as resolveDeployConfig } from '../client-plugins-
|
|
1
|
+
import { cg as ResolvedFarmConfig } from '../client-plugins-CqVtZi5X.js';
|
|
2
|
+
export { b2 as loadConfig, b1 as resolveConfig, b3 as resolveDeployConfig } from '../client-plugins-CqVtZi5X.js';
|
|
3
3
|
import { FarmProductionViteRuntime } from './config-runtime.js';
|
|
4
|
-
export { l as logger } from '../utils-
|
|
4
|
+
export { l as logger } from '../utils-C4yrAhNc.js';
|
|
5
5
|
import '../lifecycle-DK06VuKP.js';
|
|
6
|
-
import '../route-
|
|
6
|
+
import '../route-BxNJT447.js';
|
|
7
|
+
import '../endpoint-kSAxE52R.js';
|
|
7
8
|
import '../cache.js';
|
|
8
9
|
import '../renderer.js';
|
|
9
10
|
import '../deployment.js';
|
|
@@ -30,6 +31,8 @@ import '../server-fn-error-DDh14a0V.js';
|
|
|
30
31
|
import 'esbuild';
|
|
31
32
|
import '../image-config-Duob7wER.js';
|
|
32
33
|
import '../types-Z0aotQ8w.js';
|
|
34
|
+
import '../server-fn.js';
|
|
35
|
+
import '../server-query.js';
|
|
33
36
|
import '../types-DQnyD3VD.js';
|
|
34
37
|
import '../font.js';
|
|
35
38
|
import '../after.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
build
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-TYVVIQ5M.mjs";
|
|
4
4
|
import "../chunk-S3FNNQHR.mjs";
|
|
5
5
|
import "../chunk-655RLQQL.mjs";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-NUD6XBMO.mjs";
|
|
7
7
|
import "../chunk-MOQNHLTS.mjs";
|
|
8
8
|
import "../chunk-UP4CW6WP.mjs";
|
|
9
9
|
import "../chunk-TFQG7TBC.mjs";
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
loadConfig,
|
|
13
13
|
resolveConfig,
|
|
14
14
|
resolveDeployConfig
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-IXTEENRS.mjs";
|
|
16
16
|
import "../chunk-XZNTNMHT.mjs";
|
|
17
17
|
import "../chunk-F5D4XEAS.mjs";
|
|
18
18
|
import "../chunk-H77NVNJ2.mjs";
|
|
19
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-NHHKW2T6.mjs";
|
|
20
20
|
import "../chunk-27JNCYEK.mjs";
|
|
21
21
|
import "../chunk-DHDVMXYK.mjs";
|
|
22
22
|
import "../chunk-ZMSZZXOR.mjs";
|
|
@@ -43,7 +43,7 @@ import "../chunk-Q3MDL7TM.mjs";
|
|
|
43
43
|
import "../chunk-G2KY33I6.mjs";
|
|
44
44
|
import "../chunk-4L7SZOHZ.mjs";
|
|
45
45
|
import "../chunk-QCFFHV5H.mjs";
|
|
46
|
-
import "../chunk-
|
|
46
|
+
import "../chunk-7HDZYYS4.mjs";
|
|
47
47
|
import "../chunk-KATQ6I56.mjs";
|
|
48
48
|
import "../chunk-LUC2FAGW.mjs";
|
|
49
49
|
import "../chunk-FA2W42OV.mjs";
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
} from "../chunk-KI3MESHB.mjs";
|
|
84
84
|
import "../chunk-QVKYGNVM.mjs";
|
|
85
85
|
import "../chunk-Z2RZJZIZ.mjs";
|
|
86
|
-
import "../chunk-
|
|
86
|
+
import "../chunk-IL5RWYK7.mjs";
|
|
87
87
|
import "../chunk-54UPOYFS.mjs";
|
|
88
88
|
import "../chunk-WNSDDRNU.mjs";
|
|
89
89
|
import "../chunk-JPLUGGRV.mjs";
|