@farm.js/core 0.1.14 → 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.
Files changed (123) hide show
  1. package/dist/agent-runtime.d.mts +5 -2
  2. package/dist/agent-runtime.d.ts +5 -2
  3. package/dist/api/client.d.mts +3 -2
  4. package/dist/api/client.d.ts +3 -2
  5. package/dist/api/route-manager.d.mts +5 -2
  6. package/dist/api/route-manager.d.ts +5 -2
  7. package/dist/api/runtime.d.mts +3 -2
  8. package/dist/api/runtime.d.ts +3 -2
  9. package/dist/{api-client-C8d7BZNp.d.mts → api-client-B-n3pm_Q.d.mts} +2 -1
  10. package/dist/{api-client-BWrEbxfO.d.ts → api-client-C0_NZEBl.d.ts} +2 -1
  11. package/dist/api.d.mts +7 -4
  12. package/dist/api.d.ts +7 -4
  13. package/dist/{app-wIYse61b.d.ts → app-AyjEsCBq.d.ts} +3 -3
  14. package/dist/{app-B3nVSjen.d.mts → app-CYPHeOo_.d.mts} +3 -3
  15. package/dist/app-markdown.d.mts +6 -3
  16. package/dist/app-markdown.d.ts +6 -3
  17. package/dist/{chunk-FOGLGRDS.mjs → chunk-7HDZYYS4.mjs} +100 -8
  18. package/dist/{chunk-DNCKVMSV.mjs → chunk-IL5RWYK7.mjs} +1 -1
  19. package/dist/{chunk-GNTPTTLA.mjs → chunk-IXTEENRS.mjs} +1 -1
  20. package/dist/{chunk-J2F5LFQ2.mjs → chunk-NHHKW2T6.mjs} +175 -8
  21. package/dist/{chunk-NJ47VORC.mjs → chunk-NUD6XBMO.mjs} +1 -1
  22. package/dist/{chunk-U6CRU23N.mjs → chunk-TYVVIQ5M.mjs} +10 -7
  23. package/dist/{chunk-W7IVHTOP.mjs → chunk-UQZPTIML.mjs} +15 -2
  24. package/dist/{chunk-S3QW3BIS.mjs → chunk-VVTREAG5.mjs} +89 -4
  25. package/dist/{client-plugins-C1EgdoJM.d.mts → client-plugins-CIPRtSsW.d.mts} +16 -4
  26. package/dist/{client-plugins-CslwYp3E.d.ts → client-plugins-CqVtZi5X.d.ts} +16 -4
  27. package/dist/client-plugins.d.mts +5 -2
  28. package/dist/client-plugins.d.ts +5 -2
  29. package/dist/client.d.mts +8 -7
  30. package/dist/client.d.ts +8 -7
  31. package/dist/config.d.mts +5 -2
  32. package/dist/config.d.ts +5 -2
  33. package/dist/{devtools-PCGEBRSC.mjs → devtools-IU7LKZOH.mjs} +2 -2
  34. package/dist/docs.cjs +74 -3
  35. package/dist/docs.mjs +3 -3
  36. package/dist/{route-C6UClI1z.d.mts → endpoint-Bu3XgeMK.d.mts} +3 -128
  37. package/dist/{route-CHBaW55F.d.ts → endpoint-kSAxE52R.d.ts} +3 -128
  38. package/dist/env.cjs +101 -8
  39. package/dist/env.d.mts +20 -2
  40. package/dist/env.d.ts +20 -2
  41. package/dist/env.mjs +3 -1
  42. package/dist/index.cjs +383 -24
  43. package/dist/index.d.mts +16 -15
  44. package/dist/index.d.ts +16 -15
  45. package/dist/index.mjs +20 -8
  46. package/dist/integrations.d.mts +5 -2
  47. package/dist/integrations.d.ts +5 -2
  48. package/dist/internal/app-markdown-runtime.d.mts +5 -2
  49. package/dist/internal/app-markdown-runtime.d.ts +5 -2
  50. package/dist/internal/build-runtime.cjs +435 -174
  51. package/dist/internal/build-runtime.d.mts +7 -4
  52. package/dist/internal/build-runtime.d.ts +7 -4
  53. package/dist/internal/build-runtime.mjs +6 -6
  54. package/dist/internal/cli-runtime.cjs +68 -4
  55. package/dist/internal/cli-runtime.mjs +2 -2
  56. package/dist/internal/client-error-overlay.cjs +1 -1
  57. package/dist/internal/client-error-overlay.mjs +1 -1
  58. package/dist/internal/compression-runtime.d.mts +5 -2
  59. package/dist/internal/compression-runtime.d.ts +5 -2
  60. package/dist/internal/config-runtime.cjs +68 -4
  61. package/dist/internal/config-runtime.d.mts +6 -3
  62. package/dist/internal/config-runtime.d.ts +6 -3
  63. package/dist/internal/config-runtime.mjs +2 -2
  64. package/dist/internal/product-telemetry-runtime.cjs +1 -1
  65. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  66. package/dist/internal/production-runtime.d.mts +11 -8
  67. package/dist/internal/production-runtime.d.ts +11 -8
  68. package/dist/{metadata-BsUcOEXg.d.ts → metadata-8g__AMPM.d.ts} +1 -1
  69. package/dist/{metadata-B1bxCPUY.d.mts → metadata-OMX6wFNf.d.mts} +1 -1
  70. package/dist/middleware.d.mts +7 -4
  71. package/dist/middleware.d.ts +7 -4
  72. package/dist/{nitro-ICBP5APY.mjs → nitro-3N4ZXRYM.mjs} +5 -2
  73. package/dist/plugin.cjs +278 -11
  74. package/dist/plugin.d.mts +5 -2
  75. package/dist/plugin.d.ts +5 -2
  76. package/dist/plugin.mjs +3 -3
  77. package/dist/{production-runtime-CsNn2-zx.d.ts → production-runtime-BJh7o6Cr.d.ts} +1 -1
  78. package/dist/{production-runtime-BDllolVh.d.mts → production-runtime-W3M0eNDV.d.mts} +1 -1
  79. package/dist/{render-plan-EG4hNFjy.d.ts → render-plan-Be4ZGTJP.d.ts} +1 -1
  80. package/dist/{render-plan-CNUlzylR.d.mts → render-plan-io7pvDNc.d.mts} +1 -1
  81. package/dist/renderer-client.d.mts +5 -4
  82. package/dist/renderer-client.d.ts +5 -4
  83. package/dist/{request-Blh_f7Z3.d.mts → request-DZkHYQ89.d.mts} +1 -1
  84. package/dist/{request-DsVSQVfD.d.ts → request-G8JhKr4F.d.ts} +1 -1
  85. package/dist/request.d.mts +6 -3
  86. package/dist/request.d.ts +6 -3
  87. package/dist/route-BxNJT447.d.ts +128 -0
  88. package/dist/route-C_eLaFTZ.d.mts +128 -0
  89. package/dist/{route-rendering-hUETRCbM.d.ts → route-rendering-BcLLPJgN.d.ts} +1 -1
  90. package/dist/{route-rendering-LT4XSoQK.d.mts → route-rendering-CbAKr1TY.d.mts} +1 -1
  91. package/dist/routes.d.mts +4 -2
  92. package/dist/routes.d.ts +4 -2
  93. package/dist/server-fn-client.d.mts +3 -2
  94. package/dist/server-fn-client.d.ts +3 -2
  95. package/dist/server-fn.cjs +141 -3
  96. package/dist/server-fn.d.mts +72 -1
  97. package/dist/server-fn.d.ts +72 -1
  98. package/dist/server-fn.mjs +12 -1
  99. package/dist/server-plugins.d.mts +6 -3
  100. package/dist/server-plugins.d.ts +6 -3
  101. package/dist/server-query-client.d.mts +1 -0
  102. package/dist/server-query-client.d.ts +1 -0
  103. package/dist/server-query.cjs +60 -3
  104. package/dist/server-query.d.mts +6 -1
  105. package/dist/server-query.d.ts +6 -1
  106. package/dist/server-query.mjs +3 -2
  107. package/dist/server.cjs +331 -15
  108. package/dist/server.d.mts +9 -8
  109. package/dist/server.d.ts +9 -8
  110. package/dist/server.mjs +6 -6
  111. package/dist/{spa-router-csKR9Ebj.d.mts → spa-router-BcS_4nqm.d.mts} +2 -2
  112. package/dist/{spa-router-Y_2FSJQK.d.ts → spa-router-BzFBUJkn.d.ts} +2 -2
  113. package/dist/testing.d.mts +5 -3
  114. package/dist/testing.d.ts +5 -3
  115. package/dist/{utils-DR2wfZAn.d.mts → utils-5kQP1mFR.d.mts} +1 -1
  116. package/dist/{utils-jISOE9SD.d.ts → utils-C4yrAhNc.d.ts} +1 -1
  117. package/dist/version.cjs +1 -1
  118. package/dist/version.mjs +1 -1
  119. package/dist/vite.cjs +416 -153
  120. package/dist/vite.d.mts +5 -2
  121. package/dist/vite.d.ts +5 -2
  122. package/dist/vite.mjs +3 -3
  123. package/package.json +3 -3
package/dist/vite.cjs CHANGED
@@ -31,6 +31,212 @@ 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 createBundledEnv(env2, source = getProcessEnv()) {
36
+ const resolved = normalizeResolvedEnv(env2 ?? {});
37
+ const server = {};
38
+ const runtime3 = {};
39
+ for (const [key, value] of Object.entries(resolved.server)) {
40
+ if (source[key] === void 0) {
41
+ server[key] = value;
42
+ } else {
43
+ runtime3[key] = getRuntimeEnvType(value);
44
+ }
45
+ }
46
+ return {
47
+ server,
48
+ public: resolved.public,
49
+ ...Object.keys(runtime3).length > 0 ? { runtime: { server: runtime3 } } : {}
50
+ };
51
+ }
52
+ function createEnvProxy(scope) {
53
+ return new Proxy(
54
+ {},
55
+ {
56
+ get(_target, property) {
57
+ if (typeof property === "symbol") {
58
+ return void 0;
59
+ }
60
+ const env2 = getEnvScope(scope);
61
+ return scope === "server" ? readServerEnvKey(env2, property) : env2[property];
62
+ },
63
+ ownKeys() {
64
+ return Reflect.ownKeys(getEnvScope(scope));
65
+ },
66
+ getOwnPropertyDescriptor(_target, property) {
67
+ const env2 = getEnvScope(scope);
68
+ if (!(property in env2)) {
69
+ return void 0;
70
+ }
71
+ return {
72
+ enumerable: true,
73
+ configurable: true,
74
+ value: env2[property]
75
+ };
76
+ },
77
+ has(_target, property) {
78
+ return property in getEnvScope(scope);
79
+ }
80
+ }
81
+ );
82
+ }
83
+ function getEnvScope(scope) {
84
+ const env2 = getCurrentEnv();
85
+ if (scope === "server") {
86
+ assertServerEnvAccess();
87
+ readRuntimeServerEnv(env2);
88
+ }
89
+ return env2[scope] || {};
90
+ }
91
+ function readServerEnvKey(server, key) {
92
+ const value = server[key];
93
+ if (value === void 0) {
94
+ const state = getCurrentEnv()[FARM_ENV_RUNTIME_SYMBOL];
95
+ if (state && key in state.pending && !state.warned.has(key)) {
96
+ state.warned.add(key);
97
+ console.warn(
98
+ `[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.`
99
+ );
100
+ }
101
+ }
102
+ return value;
103
+ }
104
+ function readRuntimeServerEnv(env2) {
105
+ const state = env2[FARM_ENV_RUNTIME_SYMBOL];
106
+ if (!state) return;
107
+ const source = getProcessEnv();
108
+ for (const [key, type] of Object.entries(state.pending)) {
109
+ const raw = source[key];
110
+ if (raw === void 0) continue;
111
+ env2.server[key] = coerceRuntimeEnvValue(raw, type);
112
+ delete state.pending[key];
113
+ }
114
+ }
115
+ function getRuntimeEnvType(value) {
116
+ if (typeof value === "number") return "number";
117
+ if (typeof value === "boolean") return "boolean";
118
+ if (value !== null && typeof value === "object" && !(value instanceof Date)) return "json";
119
+ return "string";
120
+ }
121
+ function coerceRuntimeEnvValue(raw, type) {
122
+ if (type === "number") {
123
+ const value = Number(raw);
124
+ return raw.trim() !== "" && Number.isFinite(value) ? value : raw;
125
+ }
126
+ if (type === "boolean") {
127
+ if (/^(true|1)$/i.test(raw.trim())) return true;
128
+ if (/^(false|0|)$/i.test(raw.trim())) return false;
129
+ return raw;
130
+ }
131
+ if (type === "json") {
132
+ try {
133
+ return JSON.parse(raw);
134
+ } catch {
135
+ return raw;
136
+ }
137
+ }
138
+ return raw;
139
+ }
140
+ function prepareEnv(env2) {
141
+ const normalized = normalizeResolvedEnv(env2);
142
+ const runtime3 = env2.runtime?.server;
143
+ if (!isRecord(runtime3) || Object.keys(runtime3).length === 0) return normalized;
144
+ const prepared = { server: { ...normalized.server }, public: normalized.public };
145
+ Object.defineProperty(prepared, FARM_ENV_RUNTIME_SYMBOL, {
146
+ value: {
147
+ pending: { ...runtime3 },
148
+ warned: /* @__PURE__ */ new Set()
149
+ },
150
+ enumerable: false
151
+ });
152
+ return prepared;
153
+ }
154
+ function assertServerEnvAccess() {
155
+ if (typeof window !== "undefined") {
156
+ throw new Error("Farm server env is not available in the browser. Use publicEnv.");
157
+ }
158
+ }
159
+ function getInitialEnv() {
160
+ const injectedEnv = getInjectedEnv();
161
+ if (injectedEnv) {
162
+ return injectedEnv;
163
+ }
164
+ if (typeof window === "undefined" && farmEnvGlobal[FARM_ENV_SYMBOL]) {
165
+ return normalizeResolvedEnv(farmEnvGlobal[FARM_ENV_SYMBOL]);
166
+ }
167
+ return {
168
+ server: {},
169
+ public: getInjectedPublicEnv()
170
+ };
171
+ }
172
+ function getCurrentEnv() {
173
+ if (typeof window === "undefined" && farmEnvGlobal[FARM_ENV_SYMBOL]) {
174
+ return farmEnvGlobal[FARM_ENV_SYMBOL];
175
+ }
176
+ return currentEnv;
177
+ }
178
+ function getInjectedEnv() {
179
+ try {
180
+ if (typeof __FARM_ENV__ !== "undefined" && __FARM_ENV__) {
181
+ return prepareEnv(__FARM_ENV__);
182
+ }
183
+ } catch {
184
+ }
185
+ return null;
186
+ }
187
+ function getInjectedPublicEnv() {
188
+ try {
189
+ if (typeof __FARM_PUBLIC_ENV__ !== "undefined" && __FARM_PUBLIC_ENV__) {
190
+ return __FARM_PUBLIC_ENV__;
191
+ }
192
+ } catch {
193
+ }
194
+ return {};
195
+ }
196
+ function normalizeResolvedEnv(env2) {
197
+ return {
198
+ server: isRecord(env2.server) ? env2.server : {},
199
+ public: isRecord(env2.public) ? env2.public : {}
200
+ };
201
+ }
202
+ function isRecord(value) {
203
+ return !!value && typeof value === "object" && !Array.isArray(value);
204
+ }
205
+ function getProcessEnv() {
206
+ if (typeof process !== "undefined" && process.env) {
207
+ return process.env;
208
+ }
209
+ return {};
210
+ }
211
+ var FARM_ENV_SYMBOL, FARM_ENV_RUNTIME_SYMBOL, farmEnvGlobal, currentEnv, env, publicEnv;
212
+ var init_env = __esm({
213
+ "src/env.ts"() {
214
+ "use strict";
215
+ FARM_ENV_SYMBOL = /* @__PURE__ */ Symbol.for("farm.env");
216
+ FARM_ENV_RUNTIME_SYMBOL = /* @__PURE__ */ Symbol.for("farm.env.runtime");
217
+ farmEnvGlobal = globalThis;
218
+ currentEnv = getInitialEnv();
219
+ __name(createBundledEnv, "createBundledEnv");
220
+ env = createEnvProxy("server");
221
+ publicEnv = createEnvProxy("public");
222
+ __name(createEnvProxy, "createEnvProxy");
223
+ __name(getEnvScope, "getEnvScope");
224
+ __name(readServerEnvKey, "readServerEnvKey");
225
+ __name(readRuntimeServerEnv, "readRuntimeServerEnv");
226
+ __name(getRuntimeEnvType, "getRuntimeEnvType");
227
+ __name(coerceRuntimeEnvValue, "coerceRuntimeEnvValue");
228
+ __name(prepareEnv, "prepareEnv");
229
+ __name(assertServerEnvAccess, "assertServerEnvAccess");
230
+ __name(getInitialEnv, "getInitialEnv");
231
+ __name(getCurrentEnv, "getCurrentEnv");
232
+ __name(getInjectedEnv, "getInjectedEnv");
233
+ __name(getInjectedPublicEnv, "getInjectedPublicEnv");
234
+ __name(normalizeResolvedEnv, "normalizeResolvedEnv");
235
+ __name(isRecord, "isRecord");
236
+ __name(getProcessEnv, "getProcessEnv");
237
+ }
238
+ });
239
+
34
240
  // src/app-markdown-config.ts
35
241
  function resolveMdxConfig(config) {
36
242
  return {
@@ -8942,7 +9148,7 @@ function serializeFarmLlmsTxt(value) {
8942
9148
  return value.endsWith("\n") ? value : `${value}
8943
9149
  `;
8944
9150
  }
8945
- if (!isRecord2(value)) {
9151
+ if (!isRecord3(value)) {
8946
9152
  throw new TypeError("llms.ts must return llms.txt text, an llms.txt object, or a Response");
8947
9153
  }
8948
9154
  const title = requireText(value.title, "llms.ts must return a non-empty title");
@@ -8955,7 +9161,7 @@ function serializeFarmLlmsTxt(value) {
8955
9161
  if (summary?.trim()) blocks.push(`> ${toSingleLine(summary)}`);
8956
9162
  if (details?.trim()) blocks.push(details.trim());
8957
9163
  for (const [sectionIndex, section] of (value.sections ?? []).entries()) {
8958
- if (!isRecord2(section)) {
9164
+ if (!isRecord3(section)) {
8959
9165
  throw new TypeError(`llms.ts section ${sectionIndex} must be an object`);
8960
9166
  }
8961
9167
  const sectionTitle = requireText(
@@ -8967,7 +9173,7 @@ function serializeFarmLlmsTxt(value) {
8967
9173
  }
8968
9174
  const links = section.links.map((link, linkIndex) => {
8969
9175
  const where = `llms.ts section "${sectionTitle}" link ${linkIndex}`;
8970
- if (!isRecord2(link)) throw new TypeError(`${where} must be an object`);
9176
+ if (!isRecord3(link)) throw new TypeError(`${where} must be an object`);
8971
9177
  const linkTitle = requireText(link.title, `${where} must include a non-empty title`);
8972
9178
  const url = requireText(link.url, `${where} must include a non-empty url`);
8973
9179
  const description = optionalText(link.description, `${where} description must be a string`);
@@ -9053,10 +9259,10 @@ async function mapWithConcurrency(items, limit, run) {
9053
9259
  return results;
9054
9260
  }
9055
9261
  function readMetadataTitle(metadata) {
9056
- if (!isRecord2(metadata)) return void 0;
9262
+ if (!isRecord3(metadata)) return void 0;
9057
9263
  const { title } = metadata;
9058
9264
  if (typeof title === "string") return title.trim() || void 0;
9059
- if (isRecord2(title)) {
9265
+ if (isRecord3(title)) {
9060
9266
  for (const key of ["absolute", "default"]) {
9061
9267
  const value = title[key];
9062
9268
  if (typeof value === "string" && value.trim()) return value.trim();
@@ -9065,7 +9271,7 @@ function readMetadataTitle(metadata) {
9065
9271
  return void 0;
9066
9272
  }
9067
9273
  function readMetadataString(metadata, key) {
9068
- if (!isRecord2(metadata)) return void 0;
9274
+ if (!isRecord3(metadata)) return void 0;
9069
9275
  const value = metadata[key];
9070
9276
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
9071
9277
  }
@@ -9097,7 +9303,7 @@ function optionalText(value, message) {
9097
9303
  if (typeof value !== "string") throw new TypeError(message);
9098
9304
  return value;
9099
9305
  }
9100
- function isRecord2(value) {
9306
+ function isRecord3(value) {
9101
9307
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
9102
9308
  }
9103
9309
  var init_llms_txt = __esm({
@@ -9123,7 +9329,7 @@ var init_llms_txt = __esm({
9123
9329
  __name(escapeLinkUrl, "escapeLinkUrl");
9124
9330
  __name(requireText, "requireText");
9125
9331
  __name(optionalText, "optionalText");
9126
- __name(isRecord2, "isRecord");
9332
+ __name(isRecord3, "isRecord");
9127
9333
  }
9128
9334
  });
9129
9335
 
@@ -10346,116 +10552,6 @@ var init_config3 = __esm({
10346
10552
  }
10347
10553
  });
10348
10554
 
10349
- // src/env.ts
10350
- function createEnvProxy(scope) {
10351
- return new Proxy(
10352
- {},
10353
- {
10354
- get(_target, property) {
10355
- if (typeof property === "symbol") {
10356
- return void 0;
10357
- }
10358
- const env2 = getEnvScope(scope);
10359
- return env2[property];
10360
- },
10361
- ownKeys() {
10362
- return Reflect.ownKeys(getEnvScope(scope));
10363
- },
10364
- getOwnPropertyDescriptor(_target, property) {
10365
- const env2 = getEnvScope(scope);
10366
- if (!(property in env2)) {
10367
- return void 0;
10368
- }
10369
- return {
10370
- enumerable: true,
10371
- configurable: true,
10372
- value: env2[property]
10373
- };
10374
- },
10375
- has(_target, property) {
10376
- return property in getEnvScope(scope);
10377
- }
10378
- }
10379
- );
10380
- }
10381
- function getEnvScope(scope) {
10382
- if (scope === "server") {
10383
- assertServerEnvAccess();
10384
- }
10385
- return getCurrentEnv()[scope] || {};
10386
- }
10387
- function assertServerEnvAccess() {
10388
- if (typeof window !== "undefined") {
10389
- throw new Error("Farm server env is not available in the browser. Use publicEnv.");
10390
- }
10391
- }
10392
- function getInitialEnv() {
10393
- const injectedEnv = getInjectedEnv();
10394
- if (injectedEnv) {
10395
- return injectedEnv;
10396
- }
10397
- if (typeof window === "undefined" && farmEnvGlobal[FARM_ENV_SYMBOL]) {
10398
- return normalizeResolvedEnv(farmEnvGlobal[FARM_ENV_SYMBOL]);
10399
- }
10400
- return {
10401
- server: {},
10402
- public: getInjectedPublicEnv()
10403
- };
10404
- }
10405
- function getCurrentEnv() {
10406
- if (typeof window === "undefined" && farmEnvGlobal[FARM_ENV_SYMBOL]) {
10407
- return farmEnvGlobal[FARM_ENV_SYMBOL];
10408
- }
10409
- return currentEnv;
10410
- }
10411
- function getInjectedEnv() {
10412
- try {
10413
- if (typeof __FARM_ENV__ !== "undefined" && __FARM_ENV__) {
10414
- return normalizeResolvedEnv(__FARM_ENV__);
10415
- }
10416
- } catch {
10417
- }
10418
- return null;
10419
- }
10420
- function getInjectedPublicEnv() {
10421
- try {
10422
- if (typeof __FARM_PUBLIC_ENV__ !== "undefined" && __FARM_PUBLIC_ENV__) {
10423
- return __FARM_PUBLIC_ENV__;
10424
- }
10425
- } catch {
10426
- }
10427
- return {};
10428
- }
10429
- function normalizeResolvedEnv(env2) {
10430
- return {
10431
- server: isRecord4(env2.server) ? env2.server : {},
10432
- public: isRecord4(env2.public) ? env2.public : {}
10433
- };
10434
- }
10435
- function isRecord4(value) {
10436
- return !!value && typeof value === "object" && !Array.isArray(value);
10437
- }
10438
- var FARM_ENV_SYMBOL, farmEnvGlobal, currentEnv, env, publicEnv;
10439
- var init_env = __esm({
10440
- "src/env.ts"() {
10441
- "use strict";
10442
- FARM_ENV_SYMBOL = /* @__PURE__ */ Symbol.for("farm.env");
10443
- farmEnvGlobal = globalThis;
10444
- currentEnv = getInitialEnv();
10445
- env = createEnvProxy("server");
10446
- publicEnv = createEnvProxy("public");
10447
- __name(createEnvProxy, "createEnvProxy");
10448
- __name(getEnvScope, "getEnvScope");
10449
- __name(assertServerEnvAccess, "assertServerEnvAccess");
10450
- __name(getInitialEnv, "getInitialEnv");
10451
- __name(getCurrentEnv, "getCurrentEnv");
10452
- __name(getInjectedEnv, "getInjectedEnv");
10453
- __name(getInjectedPublicEnv, "getInjectedPublicEnv");
10454
- __name(normalizeResolvedEnv, "normalizeResolvedEnv");
10455
- __name(isRecord4, "isRecord");
10456
- }
10457
- });
10458
-
10459
10555
  // src/plugin-dependencies.ts
10460
10556
  function pluginShortName(name2) {
10461
10557
  return name2.slice(Math.max(name2.lastIndexOf(":"), name2.lastIndexOf("/")) + 1);
@@ -17453,6 +17549,7 @@ __export(vite_exports, {
17453
17549
  withFarmRequestTracing: () => withFarmRequestTracing
17454
17550
  });
17455
17551
  module.exports = __toCommonJS(vite_exports);
17552
+ init_env();
17456
17553
 
17457
17554
  // src/app.ts
17458
17555
  init_app_markdown_config();
@@ -19260,9 +19357,10 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
19260
19357
  const importedBindings = getStaticImportBindings(content);
19261
19358
  let estimatedBoundaryCount2 = 0;
19262
19359
  for (const specifier of new Set(getImportSpecifiers(content))) {
19263
- const importedPath = resolveImportedModuleSourcePath(moduleSourcePath, specifier, root);
19360
+ const imported = resolveImportedModule(moduleSourcePath, specifier, root);
19361
+ const importedPath = imported.path;
19264
19362
  if (!importedPath) continue;
19265
- if (!specifier.startsWith(".") && !specifier.startsWith("/")) {
19363
+ if (!imported.local) {
19266
19364
  const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
19267
19365
  if (packageMetadata.shouldHydrate) {
19268
19366
  if (options.staticPackageBoundaries) {
@@ -19331,8 +19429,8 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
19331
19429
  let importsClientBoundary = false;
19332
19430
  let importedIslandStrategy = null;
19333
19431
  for (const specifier of getImportSpecifiers(content)) {
19334
- const importedPath = resolveImportedModuleSourcePath(resolvedPath, specifier, root);
19335
- const importedMetadata = !specifier.startsWith(".") && !specifier.startsWith("/") ? inspectPackageClientBoundary(importedPath, root, visited) : inspectClientModuleMetadata(importedPath, root, visited, false);
19432
+ const imported = resolveImportedModule(resolvedPath, specifier, root);
19433
+ const importedMetadata = imported.local ? inspectClientModuleMetadata(imported.path, root, visited, false) : inspectPackageClientBoundary(imported.path, root, visited);
19336
19434
  if (importedMetadata.isClientComponent || importedMetadata.shouldHydrate) {
19337
19435
  importsClientBoundary = true;
19338
19436
  if (importedIslandStrategy === null) {
@@ -19461,6 +19559,171 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
19461
19559
  return true;
19462
19560
  }
19463
19561
  __name(isTypeOnlyNamedClause, "isTypeOnlyNamedClause");
19562
+ function resolveImportedModule(importerPath, specifier, root) {
19563
+ if (specifier.startsWith(".") || specifier.startsWith("/")) {
19564
+ return { path: resolveImportedModuleSourcePath(importerPath, specifier, root), local: true };
19565
+ }
19566
+ const aliased = resolveProjectAliasSourcePath(specifier, root);
19567
+ if (aliased !== void 0) return { path: aliased, local: true };
19568
+ return { path: resolvePackageModuleSourcePath(importerPath, specifier, root), local: false };
19569
+ }
19570
+ __name(resolveImportedModule, "resolveImportedModule");
19571
+ var projectImportAliasCache = /* @__PURE__ */ new Map();
19572
+ var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
19573
+ function resolveProjectAliasSourcePath(specifier, root) {
19574
+ if (!root) return void 0;
19575
+ const projectRoot = import_path4.default.resolve(root);
19576
+ let match;
19577
+ for (const alias of getProjectImportAliases(projectRoot)) {
19578
+ const captured = matchProjectImportAlias(alias, specifier);
19579
+ if (captured === null) continue;
19580
+ if (!match || alias.prefix.length > match.alias.prefix.length) match = { alias, captured };
19581
+ }
19582
+ if (!match) return void 0;
19583
+ return resolveSourceCandidate(
19584
+ match.alias.targets.map(
19585
+ (target) => import_path4.default.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
19586
+ )
19587
+ );
19588
+ }
19589
+ __name(resolveProjectAliasSourcePath, "resolveProjectAliasSourcePath");
19590
+ function matchProjectImportAlias(alias, specifier) {
19591
+ if (!alias.wildcard) return specifier === alias.prefix ? "" : null;
19592
+ if (specifier.length < alias.prefix.length + alias.suffix.length || !specifier.startsWith(alias.prefix) || !specifier.endsWith(alias.suffix)) {
19593
+ return null;
19594
+ }
19595
+ return specifier.slice(alias.prefix.length, specifier.length - alias.suffix.length);
19596
+ }
19597
+ __name(matchProjectImportAlias, "matchProjectImportAlias");
19598
+ function getProjectImportAliases(projectRoot) {
19599
+ const stamp = PROJECT_ALIAS_FILES.map((file) => {
19600
+ try {
19601
+ return String(import_fs2.default.statSync(import_path4.default.join(projectRoot, file)).mtimeMs);
19602
+ } catch {
19603
+ return "-";
19604
+ }
19605
+ }).join(":");
19606
+ const cached = projectImportAliasCache.get(projectRoot);
19607
+ if (cached?.stamp === stamp) return cached.aliases;
19608
+ const aliases = [
19609
+ ...readTsconfigPathAliases(projectRoot),
19610
+ ...readPackageImportAliases(projectRoot)
19611
+ ];
19612
+ if (!aliases.some((alias) => alias.prefix === "@/")) {
19613
+ aliases.push({
19614
+ prefix: "@/",
19615
+ suffix: "",
19616
+ wildcard: true,
19617
+ targets: [import_path4.default.join(projectRoot, "src", "*")]
19618
+ });
19619
+ }
19620
+ projectImportAliasCache.set(projectRoot, { stamp, aliases });
19621
+ return aliases;
19622
+ }
19623
+ __name(getProjectImportAliases, "getProjectImportAliases");
19624
+ function readTsconfigPathAliases(projectRoot) {
19625
+ for (const name2 of ["tsconfig.json", "jsconfig.json"]) {
19626
+ const configPath = import_path4.default.join(projectRoot, name2);
19627
+ if (!import_fs2.default.existsSync(configPath)) continue;
19628
+ const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
19629
+ if (!resolved?.paths) return [];
19630
+ const base = resolved.baseUrl ?? resolved.pathsDirectory;
19631
+ return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
19632
+ if (!Array.isArray(targets)) return [];
19633
+ const wildcardIndex = pattern.indexOf("*");
19634
+ return [
19635
+ {
19636
+ prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
19637
+ suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
19638
+ wildcard: wildcardIndex !== -1,
19639
+ targets: targets.filter((target) => typeof target === "string").map((target) => import_path4.default.resolve(base, target))
19640
+ }
19641
+ ];
19642
+ });
19643
+ }
19644
+ return [];
19645
+ }
19646
+ __name(readTsconfigPathAliases, "readTsconfigPathAliases");
19647
+ function readTsconfigPaths(configPath, visited) {
19648
+ if (visited.has(configPath)) return null;
19649
+ visited.add(configPath);
19650
+ const config = readJsonWithComments(configPath);
19651
+ if (!config) return null;
19652
+ const directory = import_path4.default.dirname(configPath);
19653
+ const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
19654
+ (parent) => typeof parent === "string" && parent.startsWith(".")
19655
+ );
19656
+ let inherited = null;
19657
+ for (const parent of parents) {
19658
+ const parentPath = import_path4.default.resolve(
19659
+ directory,
19660
+ parent.endsWith(".json") ? parent : `${parent}.json`
19661
+ );
19662
+ inherited = readTsconfigPaths(parentPath, visited) ?? inherited;
19663
+ }
19664
+ const options = config.compilerOptions ?? {};
19665
+ const baseUrl = typeof options.baseUrl === "string" ? import_path4.default.resolve(directory, options.baseUrl) : inherited?.baseUrl;
19666
+ if (options.paths && typeof options.paths === "object") {
19667
+ return { paths: options.paths, pathsDirectory: directory, baseUrl };
19668
+ }
19669
+ return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
19670
+ }
19671
+ __name(readTsconfigPaths, "readTsconfigPaths");
19672
+ function readPackageImportAliases(projectRoot) {
19673
+ const imports = readPackageJson(import_path4.default.join(projectRoot, "package.json"))?.imports;
19674
+ if (!imports || typeof imports !== "object") return [];
19675
+ return Object.entries(imports).flatMap(([pattern, value]) => {
19676
+ const target = resolveConditionalExportTarget(value);
19677
+ if (!pattern.startsWith("#") || !target?.startsWith("./")) return [];
19678
+ const wildcardIndex = pattern.indexOf("*");
19679
+ return [
19680
+ {
19681
+ prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
19682
+ suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
19683
+ wildcard: wildcardIndex !== -1,
19684
+ targets: [import_path4.default.resolve(projectRoot, target)]
19685
+ }
19686
+ ];
19687
+ });
19688
+ }
19689
+ __name(readPackageImportAliases, "readPackageImportAliases");
19690
+ function readJsonWithComments(filePath) {
19691
+ let source;
19692
+ try {
19693
+ source = import_fs2.default.readFileSync(filePath, "utf8");
19694
+ } catch {
19695
+ return null;
19696
+ }
19697
+ let output = "";
19698
+ let inString = false;
19699
+ for (let index = 0; index < source.length; index++) {
19700
+ const char = source[index];
19701
+ if (inString) {
19702
+ output += char;
19703
+ if (char === "\\") output += source[++index] ?? "";
19704
+ else if (char === '"') inString = false;
19705
+ continue;
19706
+ }
19707
+ if (char === '"') {
19708
+ inString = true;
19709
+ output += char;
19710
+ } else if (char === "/" && source[index + 1] === "/") {
19711
+ while (index < source.length && source[index] !== "\n") index++;
19712
+ output += "\n";
19713
+ } else if (char === "/" && source[index + 1] === "*") {
19714
+ const end = source.indexOf("*/", index + 2);
19715
+ index = end === -1 ? source.length : end + 1;
19716
+ } else {
19717
+ output += char;
19718
+ }
19719
+ }
19720
+ try {
19721
+ return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
19722
+ } catch {
19723
+ return null;
19724
+ }
19725
+ }
19726
+ __name(readJsonWithComments, "readJsonWithComments");
19464
19727
  function resolveImportedModuleSourcePath(importerPath, specifier, root) {
19465
19728
  if (!specifier.startsWith(".") && !specifier.startsWith("/")) {
19466
19729
  return resolvePackageModuleSourcePath(importerPath, specifier, root);
@@ -21304,11 +21567,11 @@ function mergeMetadata(base, next) {
21304
21567
  __name(mergeMetadata, "mergeMetadata");
21305
21568
  function mergeMetadataTitle(base, next) {
21306
21569
  if (next === void 0) return base;
21307
- const parentTemplate = isRecord(base) ? normalizeContent(base.template) : void 0;
21570
+ const parentTemplate = isRecord2(base) ? normalizeContent(base.template) : void 0;
21308
21571
  if (typeof next === "string") {
21309
21572
  return parentTemplate ? applyTitleTemplate(parentTemplate, next) : next;
21310
21573
  }
21311
- if (!isRecord(next)) return next;
21574
+ if (!isRecord2(next)) return next;
21312
21575
  const defaultTitle = normalizeContent(next.default) ?? resolveMetadataTitle(base);
21313
21576
  return {
21314
21577
  ...next,
@@ -21359,8 +21622,8 @@ __name(addMetadataImageReference, "addMetadataImageReference");
21359
21622
  var MARKDOWN_MIME_TYPE = "text/markdown";
21360
21623
  function addMetadataMarkdownAlternate(metadata, href) {
21361
21624
  if (!href) return metadata;
21362
- const alternates = isRecord(metadata.alternates) ? metadata.alternates : {};
21363
- const types = isRecord(alternates.types) ? alternates.types : {};
21625
+ const alternates = isRecord2(metadata.alternates) ? metadata.alternates : {};
21626
+ const types = isRecord2(alternates.types) ? alternates.types : {};
21364
21627
  if (Object.keys(types).some((type) => type.toLowerCase() === MARKDOWN_MIME_TYPE)) {
21365
21628
  return metadata;
21366
21629
  }
@@ -21393,26 +21656,26 @@ function renderMetadataHead(metadata, options = {}) {
21393
21656
  appendMetaName(tags, "creator", resolvedMetadata.creator);
21394
21657
  appendMetaName(tags, "publisher", resolvedMetadata.publisher);
21395
21658
  appendMetaName(tags, "robots", normalizeRobots(resolvedMetadata.robots));
21396
- if (isRecord(resolvedMetadata.robots)) {
21659
+ if (isRecord2(resolvedMetadata.robots)) {
21397
21660
  appendMetaName(tags, "googlebot", normalizeRobots(resolvedMetadata.robots.googleBot));
21398
21661
  }
21399
21662
  const alternates = resolvedMetadata.alternates;
21400
- const explicitCanonical = isRecord(alternates) ? alternates.canonical : void 0;
21663
+ const explicitCanonical = isRecord2(alternates) ? alternates.canonical : void 0;
21401
21664
  const canonicalHref = explicitCanonical != null ? resolveMetadataUrl(explicitCanonical, metadataBase) : options.pathname ? resolveMetadataUrl(sanitizeSelfCanonicalPathname(options.pathname), metadataBase) : void 0;
21402
21665
  if (canonicalHref) {
21403
21666
  appendLink(tags, "canonical", canonicalHref);
21404
21667
  }
21405
- if (isRecord(alternates) && isRecord(alternates.languages)) {
21668
+ if (isRecord2(alternates) && isRecord2(alternates.languages)) {
21406
21669
  for (const [language, href] of Object.entries(alternates.languages)) {
21407
21670
  appendLink(tags, "alternate", resolveMetadataUrl(href, metadataBase), {
21408
21671
  hreflang: language
21409
21672
  });
21410
21673
  }
21411
21674
  }
21412
- if (isRecord(alternates) && isRecord(alternates.types)) {
21675
+ if (isRecord2(alternates) && isRecord2(alternates.types)) {
21413
21676
  for (const [type, value] of Object.entries(alternates.types)) {
21414
21677
  for (const entry of normalizeArray(value)) {
21415
- const link = isRecord(entry) ? entry : { url: entry };
21678
+ const link = isRecord2(entry) ? entry : { url: entry };
21416
21679
  appendLink(tags, "alternate", resolveMetadataUrl(link.url, metadataBase), {
21417
21680
  type,
21418
21681
  title: link.title
@@ -21436,14 +21699,14 @@ function renderMetadataHead(metadata, options = {}) {
21436
21699
  const jsonLdConfig = options.jsonLd === true ? {} : options.jsonLd;
21437
21700
  const jsonLdScript = renderFarmAgentJsonLd(jsonLdConfig, {
21438
21701
  metadataBase,
21439
- siteName: isRecord(resolvedMetadata.openGraph) ? normalizeContent(resolvedMetadata.openGraph.siteName) : void 0,
21702
+ siteName: isRecord2(resolvedMetadata.openGraph) ? normalizeContent(resolvedMetadata.openGraph.siteName) : void 0,
21440
21703
  title: explicitTitle,
21441
21704
  description: normalizeContent(resolvedMetadata.description)
21442
21705
  });
21443
21706
  if (jsonLdScript) tags.push(jsonLdScript);
21444
21707
  }
21445
21708
  for (const entry of normalizeArray(resolvedMetadata.jsonLd)) {
21446
- if (!isRecord(entry)) continue;
21709
+ if (!isRecord2(entry)) continue;
21447
21710
  tags.push(
21448
21711
  `<script type="application/ld+json" ${FARM_METADATA_ATTRIBUTE}>${serializeJsonLd(entry)}</script>`
21449
21712
  );
@@ -21458,7 +21721,7 @@ function renderMetadataHead(metadata, options = {}) {
21458
21721
  }
21459
21722
  __name(renderMetadataHead, "renderMetadataHead");
21460
21723
  function mergeNestedMetadata(base, next) {
21461
- if (isRecord(base) && isRecord(next)) {
21724
+ if (isRecord2(base) && isRecord2(next)) {
21462
21725
  return {
21463
21726
  ...base,
21464
21727
  ...next
@@ -21468,7 +21731,7 @@ function mergeNestedMetadata(base, next) {
21468
21731
  }
21469
21732
  __name(mergeNestedMetadata, "mergeNestedMetadata");
21470
21733
  function appendOpenGraph(tags, openGraph, metadataBase) {
21471
- if (!isRecord(openGraph)) return;
21734
+ if (!isRecord2(openGraph)) return;
21472
21735
  appendMetaProperty(tags, "og:title", openGraph.title);
21473
21736
  appendMetaProperty(tags, "og:description", openGraph.description);
21474
21737
  appendMetaProperty(tags, "og:url", resolveMetadataUrl(openGraph.url, metadataBase));
@@ -21500,7 +21763,7 @@ function appendOpenGraph(tags, openGraph, metadataBase) {
21500
21763
  }
21501
21764
  __name(appendOpenGraph, "appendOpenGraph");
21502
21765
  function appendTwitter(tags, twitter, metadataBase) {
21503
- if (!isRecord(twitter)) return;
21766
+ if (!isRecord2(twitter)) return;
21504
21767
  appendMetaName(tags, "twitter:card", twitter.card);
21505
21768
  appendMetaName(tags, "twitter:site", twitter.site);
21506
21769
  appendMetaName(tags, "twitter:creator", twitter.creator);
@@ -21513,7 +21776,7 @@ function appendTwitter(tags, twitter, metadataBase) {
21513
21776
  }
21514
21777
  __name(appendTwitter, "appendTwitter");
21515
21778
  function appendNamedMetaRecord(tags, record) {
21516
- if (!isRecord(record)) return;
21779
+ if (!isRecord2(record)) return;
21517
21780
  for (const [name2, value] of Object.entries(record)) {
21518
21781
  for (const content of normalizeArray(value)) {
21519
21782
  appendMetaName(tags, name2, content, true);
@@ -21528,7 +21791,7 @@ function appendIcons(tags, icons, metadataBase) {
21528
21791
  appendLink(tags, "icon", resolveMetadataUrl(icons, metadataBase));
21529
21792
  return tags.length > initialTagCount2;
21530
21793
  }
21531
- if (!isRecord(icons)) return false;
21794
+ if (!isRecord2(icons)) return false;
21532
21795
  const initialTagCount = tags.length;
21533
21796
  appendIconList(tags, "icon", icons.icon, metadataBase);
21534
21797
  appendIconList(tags, "shortcut icon", icons.shortcut, metadataBase);
@@ -21543,7 +21806,7 @@ function appendIconList(tags, rel, value, metadataBase) {
21543
21806
  appendLink(tags, rel, resolveMetadataUrl(icon2, metadataBase));
21544
21807
  continue;
21545
21808
  }
21546
- if (!isRecord(icon2)) continue;
21809
+ if (!isRecord2(icon2)) continue;
21547
21810
  appendLink(tags, rel, resolveMetadataUrl(icon2.url, metadataBase), {
21548
21811
  sizes: icon2.sizes,
21549
21812
  type: icon2.type
@@ -21574,7 +21837,7 @@ var VERIFICATION_META_NAMES = [
21574
21837
  ["yandex", "yandex-verification"]
21575
21838
  ];
21576
21839
  function appendVerification(tags, verification) {
21577
- if (!isRecord(verification)) return;
21840
+ if (!isRecord2(verification)) return;
21578
21841
  for (const [key, name2] of VERIFICATION_META_NAMES) {
21579
21842
  for (const token of normalizeArray(verification[key])) {
21580
21843
  appendMetaName(tags, name2, token);
@@ -21600,7 +21863,7 @@ function normalizeMetadataImages(value, metadataBase) {
21600
21863
  if (typeof item === "string") {
21601
21864
  return { url: resolveMetadataUrl(item, metadataBase) || item };
21602
21865
  }
21603
- if (!isRecord(item)) return null;
21866
+ if (!isRecord2(item)) return null;
21604
21867
  const rawUrl = item.url || item.src;
21605
21868
  const url = resolveMetadataUrl(rawUrl, metadataBase);
21606
21869
  if (!url) return null;
@@ -21625,7 +21888,7 @@ function hasMetadataImages(value) {
21625
21888
  __name(hasMetadataImages, "hasMetadataImages");
21626
21889
  function resolveMetadataTitle(title) {
21627
21890
  if (typeof title === "string") return title;
21628
- if (isRecord(title)) {
21891
+ if (isRecord2(title)) {
21629
21892
  return normalizeContent(title.default);
21630
21893
  }
21631
21894
  return void 0;
@@ -21645,7 +21908,7 @@ var ROBOTS_VALUES = [
21645
21908
  ];
21646
21909
  function normalizeRobots(robots) {
21647
21910
  if (typeof robots === "string") return robots;
21648
- if (!isRecord(robots)) return void 0;
21911
+ if (!isRecord2(robots)) return void 0;
21649
21912
  const values = [];
21650
21913
  if (typeof robots.index === "boolean") values.push(robots.index ? "index" : "noindex");
21651
21914
  if (typeof robots.follow === "boolean") values.push(robots.follow ? "follow" : "nofollow");
@@ -21706,10 +21969,10 @@ function normalizeContent(value) {
21706
21969
  return void 0;
21707
21970
  }
21708
21971
  __name(normalizeContent, "normalizeContent");
21709
- function isRecord(value) {
21972
+ function isRecord2(value) {
21710
21973
  return !!value && typeof value === "object" && !Array.isArray(value);
21711
21974
  }
21712
- __name(isRecord, "isRecord");
21975
+ __name(isRecord2, "isRecord");
21713
21976
  function escapeText(value) {
21714
21977
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
21715
21978
  }
@@ -23753,10 +24016,10 @@ function isResponse2(value) {
23753
24016
  ));
23754
24017
  }
23755
24018
  __name(isResponse2, "isResponse");
23756
- function isRecord3(value) {
24019
+ function isRecord4(value) {
23757
24020
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
23758
24021
  }
23759
- __name(isRecord3, "isRecord");
24022
+ __name(isRecord4, "isRecord");
23760
24023
  function resolveCacheControl2(revalidate) {
23761
24024
  if (revalidate === false) {
23762
24025
  return "public, max-age=31536000, immutable";
@@ -23776,7 +24039,7 @@ function serializeSitemap(value) {
23776
24039
  throw new TypeError("sitemap.ts must return an array or a Response");
23777
24040
  }
23778
24041
  const entries = value.map((candidate, index) => {
23779
- if (!isRecord3(candidate) || typeof candidate.url !== "string" || !candidate.url) {
24042
+ if (!isRecord4(candidate) || typeof candidate.url !== "string" || !candidate.url) {
23780
24043
  throw new TypeError(`sitemap.ts entry ${index} must include a non-empty url`);
23781
24044
  }
23782
24045
  return candidate;
@@ -23818,7 +24081,7 @@ function toArray2(value) {
23818
24081
  }
23819
24082
  __name(toArray2, "toArray");
23820
24083
  function serializeRobots(value) {
23821
- if (!isRecord3(value)) {
24084
+ if (!isRecord4(value)) {
23822
24085
  throw new TypeError("robots.ts must return a robots object or a Response");
23823
24086
  }
23824
24087
  const robots = value;
@@ -23827,7 +24090,7 @@ function serializeRobots(value) {
23827
24090
  throw new TypeError("robots.ts must return at least one rule");
23828
24091
  }
23829
24092
  const sections = rules.map((rule, index) => {
23830
- if (!isRecord3(rule)) {
24093
+ if (!isRecord4(rule)) {
23831
24094
  throw new TypeError(`robots.ts rule ${index} must be an object`);
23832
24095
  }
23833
24096
  const userAgents = toArray2(rule.userAgent).filter(
@@ -23851,7 +24114,7 @@ function serializeRobots(value) {
23851
24114
  }
23852
24115
  __name(serializeRobots, "serializeRobots");
23853
24116
  function serializeManifest(value) {
23854
- if (!isRecord3(value)) {
24117
+ if (!isRecord4(value)) {
23855
24118
  throw new TypeError("manifest.ts must return a manifest object or a Response");
23856
24119
  }
23857
24120
  return `${JSON.stringify(value, null, 2)}
@@ -24913,7 +25176,7 @@ _setFarmThemeServerSnapshotResolver(() => {
24913
25176
  });
24914
25177
 
24915
25178
  // package.json
24916
- var version = "0.1.14";
25179
+ var version = "0.1.16";
24917
25180
 
24918
25181
  // src/version.ts
24919
25182
  var FARM_VERSION = version;
@@ -32926,7 +33189,7 @@ function getEnvDefines(config, configEnv) {
32926
33189
  )
32927
33190
  };
32928
33191
  if (configEnv?.isSsrBuild) {
32929
- defines.__FARM_ENV__ = JSON.stringify(getFullEnvDefine(config));
33192
+ defines.__FARM_ENV__ = JSON.stringify(createBundledEnv(getFullEnvDefine(config)));
32930
33193
  }
32931
33194
  return defines;
32932
33195
  }