@farm.js/core 0.1.0-beta.23 → 0.1.0-beta.24

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/vite.cjs CHANGED
@@ -580,11 +580,11 @@ function resolveFarmServerHealthConfig(config) {
580
580
  return Object.freeze({ enabled: true, livenessPath, readinessPath });
581
581
  }
582
582
  function normalizeHealthPath(value, optionName) {
583
- const path26 = value.trim();
584
- if (!path26.startsWith("/") || path26.includes("?") || path26.includes("#") || path26.includes("*")) {
583
+ const path27 = value.trim();
584
+ if (!path27.startsWith("/") || path27.includes("?") || path27.includes("#") || path27.includes("*")) {
585
585
  throw new TypeError(`${optionName} must be an absolute pathname without a query or wildcard`);
586
586
  }
587
- return path26.length > 1 ? path26.replace(/\/+$/, "") || "/" : path26;
587
+ return path27.length > 1 ? path27.replace(/\/+$/, "") || "/" : path27;
588
588
  }
589
589
  function parseBodySizeLimit(value, optionName = "bodySizeLimit") {
590
590
  if (typeof value === "number") {
@@ -681,7 +681,7 @@ async function readNodeRequestBody(request, limit) {
681
681
  request.resume?.();
682
682
  throw error;
683
683
  }
684
- return await new Promise((resolve6, reject) => {
684
+ return await new Promise((resolve7, reject) => {
685
685
  const chunks = [];
686
686
  let total = 0;
687
687
  let settled = false;
@@ -710,7 +710,7 @@ async function readNodeRequestBody(request, limit) {
710
710
  if (settled) return;
711
711
  settled = true;
712
712
  cleanup();
713
- resolve6(Buffer.concat(chunks, total));
713
+ resolve7(Buffer.concat(chunks, total));
714
714
  }, "onEnd");
715
715
  const onError = /* @__PURE__ */ __name((error) => rejectOnce(error), "onError");
716
716
  request.on("data", onData);
@@ -939,22 +939,22 @@ async function prepareFarmWorkflowsForNitro(config) {
939
939
  }
940
940
  const root = config.root || process.cwd();
941
941
  const distDir = config.distDir || ".farm";
942
- const fs8 = await import("fs/promises");
943
- const path26 = await import("path");
944
- const generatedDir = path26.join(root, distDir, ".nitro", "farm-workflows");
945
- await fs8.mkdir(generatedDir, { recursive: true });
942
+ const fs9 = await import("fs/promises");
943
+ const path27 = await import("path");
944
+ const generatedDir = path27.join(root, distDir, ".nitro", "farm-workflows");
945
+ await fs9.mkdir(generatedDir, { recursive: true });
946
946
  const tasks = {};
947
947
  const scheduledTasks = createScheduledTasks(workflows);
948
948
  for (const workflow of workflows) {
949
- const wrapperPath = path26.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
950
- await fs8.writeFile(wrapperPath, createNitroTaskWrapper(workflow), "utf8");
949
+ const wrapperPath = path27.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
950
+ await fs9.writeFile(wrapperPath, createNitroTaskWrapper(workflow), "utf8");
951
951
  tasks[workflow.id] = {
952
952
  handler: wrapperPath,
953
953
  description: workflow.description || `Farm workflow ${workflow.id}`
954
954
  };
955
955
  }
956
- const handlerPath = path26.join(generatedDir, "http-handler.mjs");
957
- await fs8.writeFile(
956
+ const handlerPath = path27.join(generatedDir, "http-handler.mjs");
957
+ await fs9.writeFile(
958
958
  handlerPath,
959
959
  createNitroWorkflowHTTPHandler(
960
960
  workflowConfig,
@@ -963,8 +963,8 @@ async function prepareFarmWorkflowsForNitro(config) {
963
963
  ),
964
964
  "utf8"
965
965
  );
966
- const manifestPath = path26.join(generatedDir, "manifest.json");
967
- await fs8.writeFile(
966
+ const manifestPath = path27.join(generatedDir, "manifest.json");
967
+ await fs9.writeFile(
968
968
  manifestPath,
969
969
  JSON.stringify(
970
970
  {
@@ -1045,22 +1045,22 @@ function resolveWorkflowDefinition(module2) {
1045
1045
  return null;
1046
1046
  }
1047
1047
  async function findWorkflowFiles(root, dirs) {
1048
- const fs8 = await import("fs/promises");
1049
- const path26 = await import("path");
1048
+ const fs9 = await import("fs/promises");
1049
+ const path27 = await import("path");
1050
1050
  const files = [];
1051
1051
  for (const dir of dirs) {
1052
- const absoluteDir = path26.isAbsolute(dir) ? dir : path26.join(root, dir);
1052
+ const absoluteDir = path27.isAbsolute(dir) ? dir : path27.join(root, dir);
1053
1053
  if (!await pathExists(absoluteDir)) continue;
1054
1054
  await walkWorkflowDir(absoluteDir, files);
1055
1055
  }
1056
1056
  return files.sort();
1057
1057
  }
1058
1058
  async function walkWorkflowDir(dir, files) {
1059
- const fs8 = await import("fs/promises");
1060
- const path26 = await import("path");
1061
- const entries = await fs8.readdir(dir, { withFileTypes: true });
1059
+ const fs9 = await import("fs/promises");
1060
+ const path27 = await import("path");
1061
+ const entries = await fs9.readdir(dir, { withFileTypes: true });
1062
1062
  for (const entry of entries) {
1063
- const filePath = path26.join(dir, entry.name);
1063
+ const filePath = path27.join(dir, entry.name);
1064
1064
  if (entry.isDirectory()) {
1065
1065
  if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
1066
1066
  await walkWorkflowDir(filePath, files);
@@ -1072,20 +1072,20 @@ async function walkWorkflowDir(dir, files) {
1072
1072
  }
1073
1073
  }
1074
1074
  async function pathExists(filePath) {
1075
- const fs8 = await import("fs/promises");
1076
- return fs8.access(filePath).then(() => true).catch(() => false);
1075
+ const fs9 = await import("fs/promises");
1076
+ return fs9.access(filePath).then(() => true).catch(() => false);
1077
1077
  }
1078
1078
  function isWorkflowFile(fileName) {
1079
1079
  return /\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(fileName) && !/\.d\.[cm]?ts$/.test(fileName);
1080
1080
  }
1081
1081
  async function loadWorkflowModule(filePath, root) {
1082
- const fs8 = await import("fs/promises");
1083
- const path26 = await import("path");
1082
+ const fs9 = await import("fs/promises");
1083
+ const path27 = await import("path");
1084
1084
  const { pathToFileURL: pathToFileURL5 } = await import("url");
1085
1085
  const { build } = await import("esbuild");
1086
- const outDir = path26.join(root, ".farm", ".workflow-loader");
1087
- await fs8.mkdir(outDir, { recursive: true });
1088
- const outfile = path26.join(
1086
+ const outDir = path27.join(root, ".farm", ".workflow-loader");
1087
+ await fs9.mkdir(outDir, { recursive: true });
1088
+ const outfile = path27.join(
1089
1089
  outDir,
1090
1090
  `workflow-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
1091
1091
  );
@@ -1109,7 +1109,7 @@ async function loadWorkflowModule(filePath, root) {
1109
1109
  `${pathToFileURL5(outfile).href}?t=${Date.now()}`
1110
1110
  );
1111
1111
  } finally {
1112
- await fs8.unlink(outfile).catch(() => void 0);
1112
+ await fs9.unlink(outfile).catch(() => void 0);
1113
1113
  }
1114
1114
  }
1115
1115
  function workflowIdFromFile(root, filePath) {
@@ -1384,7 +1384,7 @@ function normalizeCronJob(name, job) {
1384
1384
  if (!job || typeof job !== "object" || Array.isArray(job)) {
1385
1385
  throw new TypeError(`Farm cron ${JSON.stringify(name)} must be a configuration object.`);
1386
1386
  }
1387
- const path26 = normalizeCronPath(name, job.path);
1387
+ const path27 = normalizeCronPath(name, job.path);
1388
1388
  const rawSchedule = Array.isArray(job.schedule) ? job.schedule : [job.schedule];
1389
1389
  const schedule = [...new Set(rawSchedule.map((value) => normalizeCronExpression(name, value)))];
1390
1390
  if (schedule.length === 0) {
@@ -1393,7 +1393,7 @@ function normalizeCronJob(name, job) {
1393
1393
  return {
1394
1394
  name,
1395
1395
  schedule,
1396
- path: path26,
1396
+ path: path27,
1397
1397
  description: job.description?.trim() || void 0
1398
1398
  };
1399
1399
  }
@@ -1401,13 +1401,13 @@ function normalizeCronPath(name, value) {
1401
1401
  if (typeof value !== "string" || !value.trim().startsWith("/")) {
1402
1402
  throw new TypeError(`Farm cron ${JSON.stringify(name)} path must start with "/".`);
1403
1403
  }
1404
- const path26 = value.trim();
1405
- if (path26.startsWith("//") || path26.includes("?") || path26.includes("#")) {
1404
+ const path27 = value.trim();
1405
+ if (path27.startsWith("//") || path27.includes("?") || path27.includes("#")) {
1406
1406
  throw new TypeError(
1407
1407
  `Farm cron ${JSON.stringify(name)} path must be an application pathname without a host, query, or hash.`
1408
1408
  );
1409
1409
  }
1410
- return path26.length > 1 ? path26.replace(/\/+$/, "") : path26;
1410
+ return path27.length > 1 ? path27.replace(/\/+$/, "") : path27;
1411
1411
  }
1412
1412
  function normalizeCronExpression(name, value) {
1413
1413
  if (typeof value !== "string") {
@@ -2243,7 +2243,7 @@ var init_server_action_security = __esm({
2243
2243
 
2244
2244
  // src/image-config.ts
2245
2245
  function resolveFarmImageConfig(config) {
2246
- const path26 = normalizeImagePath(config?.path ?? DEFAULT_FARM_IMAGE_PATH);
2246
+ const path27 = normalizeImagePath(config?.path ?? DEFAULT_FARM_IMAGE_PATH);
2247
2247
  const deviceSizes = normalizeIntegerList(
2248
2248
  config?.deviceSizes ?? DEFAULT_FARM_IMAGE_DEVICE_SIZES,
2249
2249
  "images.deviceSizes"
@@ -2271,7 +2271,7 @@ function resolveFarmImageConfig(config) {
2271
2271
  );
2272
2272
  return Object.freeze({
2273
2273
  provider: config?.provider ?? "auto",
2274
- path: path26,
2274
+ path: path27,
2275
2275
  domains: Object.freeze([
2276
2276
  ...new Set(
2277
2277
  (config?.domains ?? []).map((domain) => domain.trim().toLowerCase()).filter(Boolean)
@@ -2310,11 +2310,11 @@ function getPublicFarmImageConfig(config) {
2310
2310
  };
2311
2311
  }
2312
2312
  function normalizeImagePath(value) {
2313
- const path26 = value.trim().replace(/\/+$/, "") || "/";
2314
- if (!path26.startsWith("/") || path26.includes("?") || path26.includes("#")) {
2313
+ const path27 = value.trim().replace(/\/+$/, "") || "/";
2314
+ if (!path27.startsWith("/") || path27.includes("?") || path27.includes("#")) {
2315
2315
  throw new TypeError("images.path must be an absolute pathname without a query or hash");
2316
2316
  }
2317
- return path26;
2317
+ return path27;
2318
2318
  }
2319
2319
  function normalizeIntegerList(values, name, max) {
2320
2320
  if (values.length === 0) {
@@ -3164,9 +3164,9 @@ function getFarmIntegrationPluginOwner(plugin) {
3164
3164
  const value = plugin[FARM_INTEGRATION_PLUGIN_OWNER];
3165
3165
  return value && typeof value === "object" ? value : void 0;
3166
3166
  }
3167
- function defineTypedIntegrationRoute(method, path26, input) {
3167
+ function defineTypedIntegrationRoute(method, path27, input) {
3168
3168
  return {
3169
- path: path26,
3169
+ path: path27,
3170
3170
  method,
3171
3171
  middleware: input.middleware,
3172
3172
  before: input.before,
@@ -3176,7 +3176,7 @@ function defineTypedIntegrationRoute(method, path26, input) {
3176
3176
  input: normalizeIntegrationRouteInputSchemas(input),
3177
3177
  handler: input.handler,
3178
3178
  __operation: defineIntegrationAPIOperation({
3179
- path: path26,
3179
+ path: path27,
3180
3180
  method,
3181
3181
  bodyFormat: input.bodyFormat,
3182
3182
  responseFormat: input.responseFormat,
@@ -3188,52 +3188,52 @@ function defineTypedIntegrationRoute(method, path26, input) {
3188
3188
  }
3189
3189
  function createIntegrationRouteFactory() {
3190
3190
  return {
3191
- get(path26, input) {
3191
+ get(path27, input) {
3192
3192
  return defineTypedIntegrationRoute(
3193
3193
  "GET",
3194
- path26,
3194
+ path27,
3195
3195
  input
3196
3196
  );
3197
3197
  },
3198
- post(path26, input) {
3198
+ post(path27, input) {
3199
3199
  return defineTypedIntegrationRoute(
3200
3200
  "POST",
3201
- path26,
3201
+ path27,
3202
3202
  {
3203
3203
  bodyFormat: "json",
3204
3204
  ...input
3205
3205
  }
3206
3206
  );
3207
3207
  },
3208
- put(path26, input) {
3208
+ put(path27, input) {
3209
3209
  return defineTypedIntegrationRoute(
3210
3210
  "PUT",
3211
- path26,
3211
+ path27,
3212
3212
  {
3213
3213
  bodyFormat: "json",
3214
3214
  ...input
3215
3215
  }
3216
3216
  );
3217
3217
  },
3218
- patch(path26, input) {
3219
- return defineTypedIntegrationRoute("PATCH", path26, {
3218
+ patch(path27, input) {
3219
+ return defineTypedIntegrationRoute("PATCH", path27, {
3220
3220
  bodyFormat: "json",
3221
3221
  ...input
3222
3222
  });
3223
3223
  },
3224
- delete(path26, input) {
3225
- return defineTypedIntegrationRoute("DELETE", path26, {
3224
+ delete(path27, input) {
3225
+ return defineTypedIntegrationRoute("DELETE", path27, {
3226
3226
  bodyFormat: "json",
3227
3227
  ...input
3228
3228
  });
3229
3229
  },
3230
- options(path26, input) {
3231
- return defineTypedIntegrationRoute("OPTIONS", path26, input);
3230
+ options(path27, input) {
3231
+ return defineTypedIntegrationRoute("OPTIONS", path27, input);
3232
3232
  },
3233
- head(path26, input) {
3233
+ head(path27, input) {
3234
3234
  return defineTypedIntegrationRoute(
3235
3235
  "HEAD",
3236
- path26,
3236
+ path27,
3237
3237
  input
3238
3238
  );
3239
3239
  }
@@ -3570,8 +3570,8 @@ function normalizeIntegrationValidationIssues(source, error) {
3570
3570
  }
3571
3571
  ];
3572
3572
  }
3573
- function normalizeIntegrationValidationPath(path26) {
3574
- return (path26 || []).map((segment) => {
3573
+ function normalizeIntegrationValidationPath(path27) {
3574
+ return (path27 || []).map((segment) => {
3575
3575
  const key = typeof segment === "object" && segment !== null && "key" in segment ? segment.key : segment;
3576
3576
  return typeof key === "symbol" ? key.description || key.toString() : key;
3577
3577
  });
@@ -4274,8 +4274,8 @@ function createFarmDeploymentMismatchResponse(mismatch) {
4274
4274
  }
4275
4275
  );
4276
4276
  }
4277
- function createFarmDeploymentCookie(deploymentId, path26 = "/", secure = false) {
4278
- const normalizedPath = path26.startsWith("/") ? path26 : `/${path26}`;
4277
+ function createFarmDeploymentCookie(deploymentId, path27 = "/", secure = false) {
4278
+ const normalizedPath = path27.startsWith("/") ? path27 : `/${path27}`;
4279
4279
  return [
4280
4280
  `${FARM_DEPLOYMENT_COOKIE}=${encodeURIComponent(deploymentId)}`,
4281
4281
  `Path=${normalizedPath}`,
@@ -4852,11 +4852,11 @@ var init_type_generator = __esm({
4852
4852
  routeGroups.get(key).push(route);
4853
4853
  }
4854
4854
  const nestedStructure = {};
4855
- for (const [path26, routeList] of routeGroups) {
4855
+ for (const [path27, routeList] of routeGroups) {
4856
4856
  const route = routeList[0];
4857
4857
  const importPath = this.getRouteImportPath(route, options.outFile);
4858
4858
  const routeName = this.pathToRouteName(route.path);
4859
- const cleanPath = path26 === "/api" ? "" : path26.replace(/^\/api\//, "");
4859
+ const cleanPath = path27 === "/api" ? "" : path27.replace(/^\/api\//, "");
4860
4860
  const parts = cleanPath ? cleanPath.split("/") : [];
4861
4861
  const allMethods = routeList.flatMap((r) => r.methods);
4862
4862
  for (const method of allMethods) {
@@ -4915,8 +4915,8 @@ ${typeExports}
4915
4915
  const relativeImport = (0, import_path7.relative)((0, import_path7.dirname)(outFile), route.filePath).replace(/\\/g, "/").replace(/\.(ts|tsx|js|jsx)$/, "");
4916
4916
  return relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
4917
4917
  }
4918
- pathToRouteName(path26) {
4919
- return (path26 === "/api" ? "root" : path26.replace(/^\/api\//, "")).replace(/\//g, "_").replace(/[^a-zA-Z0-9_]/g, "");
4918
+ pathToRouteName(path27) {
4919
+ return (path27 === "/api" ? "root" : path27.replace(/^\/api\//, "")).replace(/\//g, "_").replace(/[^a-zA-Z0-9_]/g, "");
4920
4920
  }
4921
4921
  structureToTypeString(obj, indent) {
4922
4922
  const spaces = " ".repeat(indent);
@@ -4936,15 +4936,15 @@ ${typeExports}
4936
4936
  toTypePropertyKey(key) {
4937
4937
  return /^[$A-Z_][0-9A-Z_$]*$/i.test(key) ? key : JSON.stringify(key);
4938
4938
  }
4939
- getBaseExportName(path26) {
4940
- const cleanPath = path26.replace(/^\/api\//, "");
4939
+ getBaseExportName(path27) {
4940
+ const cleanPath = path27.replace(/^\/api\//, "");
4941
4941
  if (cleanPath === "") {
4942
4942
  return "api";
4943
4943
  }
4944
4944
  return cleanPath;
4945
4945
  }
4946
- getExportName(path26, method) {
4947
- const cleanPath = path26.replace(/^\/api\//, "");
4946
+ getExportName(path27, method) {
4947
+ const cleanPath = path27.replace(/^\/api\//, "");
4948
4948
  if (cleanPath === "") {
4949
4949
  return method.toLowerCase();
4950
4950
  }
@@ -9253,37 +9253,37 @@ function sanitizeDocsConfig(config) {
9253
9253
  return cloneSerializable(config) || {};
9254
9254
  }
9255
9255
  async function findDocsConfigPath(rootDir, configPath) {
9256
- const { existsSync: existsSync16 } = await import("fs");
9256
+ const { existsSync: existsSync17 } = await import("fs");
9257
9257
  const root = import_path9.default.resolve(rootDir || process.cwd());
9258
9258
  if (configPath) {
9259
9259
  const resolvedPath = import_path9.default.isAbsolute(configPath) ? configPath : import_path9.default.join(root, configPath);
9260
- if (!existsSync16(resolvedPath)) {
9260
+ if (!existsSync17(resolvedPath)) {
9261
9261
  throw new Error(`Could not find docs config at ${configPath}.`);
9262
9262
  }
9263
9263
  return import_path9.default.resolve(resolvedPath);
9264
9264
  }
9265
9265
  for (const filename of DOCS_CONFIG_FILENAMES) {
9266
9266
  const resolvedPath = import_path9.default.join(root, filename);
9267
- if (existsSync16(resolvedPath)) {
9267
+ if (existsSync17(resolvedPath)) {
9268
9268
  return resolvedPath;
9269
9269
  }
9270
9270
  }
9271
9271
  return void 0;
9272
9272
  }
9273
9273
  async function loadDocsConfig(rootDir, configPath) {
9274
- const fs8 = await import("fs/promises");
9274
+ const fs9 = await import("fs/promises");
9275
9275
  const { pathToFileURL: pathToFileURL5 } = await import("url");
9276
9276
  const root = import_path9.default.resolve(rootDir || process.cwd());
9277
9277
  const resolvedPath = await findDocsConfigPath(root, configPath);
9278
9278
  if (!resolvedPath) return void 0;
9279
9279
  try {
9280
9280
  if (resolvedPath.endsWith(".json")) {
9281
- const content = await fs8.readFile(resolvedPath, "utf8");
9281
+ const content = await fs9.readFile(resolvedPath, "utf8");
9282
9282
  return { config: JSON.parse(content), configPath: resolvedPath };
9283
9283
  }
9284
9284
  const { build } = await import("esbuild");
9285
9285
  const configCacheDir = import_path9.default.join(root, ".farm", ".config-loader");
9286
- await fs8.mkdir(configCacheDir, { recursive: true });
9286
+ await fs9.mkdir(configCacheDir, { recursive: true });
9287
9287
  const modulePath = import_path9.default.join(
9288
9288
  configCacheDir,
9289
9289
  `docs-config-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
@@ -9309,7 +9309,7 @@ async function loadDocsConfig(rootDir, configPath) {
9309
9309
  moduleUrl
9310
9310
  );
9311
9311
  } finally {
9312
- await fs8.unlink(modulePath).catch(() => void 0);
9312
+ await fs9.unlink(modulePath).catch(() => void 0);
9313
9313
  }
9314
9314
  return {
9315
9315
  config: importedConfig.default || importedConfig,
@@ -10192,8 +10192,8 @@ var init_generator = __esm({
10192
10192
  }
10193
10193
  routeGroups.get(key).push(route);
10194
10194
  }
10195
- for (const [path26, routeList] of routeGroups) {
10196
- const openAPIPath = this.convertToOpenAPIPath(path26);
10195
+ for (const [path27, routeList] of routeGroups) {
10196
+ const openAPIPath = this.convertToOpenAPIPath(path27);
10197
10197
  spec.paths[openAPIPath] = {};
10198
10198
  for (const route of routeList) {
10199
10199
  for (const method of route.methods) {
@@ -10207,8 +10207,8 @@ var init_generator = __esm({
10207
10207
  /**
10208
10208
  * Convert Farm.js API path to OpenAPI path format
10209
10209
  */
10210
- convertToOpenAPIPath(path26) {
10211
- return path26.replace(/^\/api/, "");
10210
+ convertToOpenAPIPath(path27) {
10211
+ return path27.replace(/^\/api/, "");
10212
10212
  }
10213
10213
  /**
10214
10214
  * Extract request body schema from endpoint
@@ -10370,8 +10370,8 @@ var init_generator = __esm({
10370
10370
  /**
10371
10371
  * Generate operation summary
10372
10372
  */
10373
- generateSummary(path26, method) {
10374
- const cleanPath = path26.replace(/^\/api\//, "");
10373
+ generateSummary(path27, method) {
10374
+ const cleanPath = path27.replace(/^\/api\//, "");
10375
10375
  const pathParts = cleanPath.split("/");
10376
10376
  const lastPart = pathParts[pathParts.length - 1];
10377
10377
  const action = method === "GET" ? "Get" : method === "POST" ? "Create" : method === "PUT" ? "Update" : method === "DELETE" ? "Delete" : method === "PATCH" ? "Update" : method;
@@ -10380,22 +10380,22 @@ var init_generator = __esm({
10380
10380
  /**
10381
10381
  * Generate operation description
10382
10382
  */
10383
- generateDescription(path26, method) {
10384
- const cleanPath = path26.replace(/^\/api\//, "");
10383
+ generateDescription(path27, method) {
10384
+ const cleanPath = path27.replace(/^\/api\//, "");
10385
10385
  return `${method} ${cleanPath} endpoint`;
10386
10386
  }
10387
10387
  /**
10388
10388
  * Generate operation ID
10389
10389
  */
10390
- generateOperationId(path26, method) {
10391
- const cleanPath = path26.replace(/^\/api\//, "").replace(/\//g, "_");
10390
+ generateOperationId(path27, method) {
10391
+ const cleanPath = path27.replace(/^\/api\//, "").replace(/\//g, "_");
10392
10392
  return `${method.toLowerCase()}_${cleanPath}`;
10393
10393
  }
10394
10394
  /**
10395
10395
  * Generate tags for grouping operations
10396
10396
  */
10397
- generateTags(path26) {
10398
- const cleanPath = path26.replace(/^\/api\//, "");
10397
+ generateTags(path27) {
10398
+ const cleanPath = path27.replace(/^\/api\//, "");
10399
10399
  const pathParts = cleanPath.split("/");
10400
10400
  if (pathParts.length > 1) {
10401
10401
  return [pathParts[0]];
@@ -10407,13 +10407,13 @@ var init_generator = __esm({
10407
10407
  */
10408
10408
  async generateSpecFile(routes, outputPath) {
10409
10409
  const spec = await this.generateSpec(routes);
10410
- const fs8 = require("fs");
10411
- const path26 = require("path");
10412
- const dir = path26.dirname(outputPath);
10413
- if (!fs8.existsSync(dir)) {
10414
- fs8.mkdirSync(dir, { recursive: true });
10410
+ const fs9 = require("fs");
10411
+ const path27 = require("path");
10412
+ const dir = path27.dirname(outputPath);
10413
+ if (!fs9.existsSync(dir)) {
10414
+ fs9.mkdirSync(dir, { recursive: true });
10415
10415
  }
10416
- fs8.writeFileSync(outputPath, JSON.stringify(spec, null, 2));
10416
+ fs9.writeFileSync(outputPath, JSON.stringify(spec, null, 2));
10417
10417
  }
10418
10418
  };
10419
10419
  __name(_OpenAPIGenerator, "OpenAPIGenerator");
@@ -12670,8 +12670,8 @@ function toViteModuleId(filePath, root) {
12670
12670
  __name(toViteModuleId, "toViteModuleId");
12671
12671
  async function fileExists(filePath) {
12672
12672
  try {
12673
- const fs8 = await import("fs/promises");
12674
- await fs8.access(filePath);
12673
+ const fs9 = await import("fs/promises");
12674
+ await fs9.access(filePath);
12675
12675
  return true;
12676
12676
  } catch {
12677
12677
  return false;
@@ -13940,7 +13940,7 @@ function normalizePositiveDuration(value, fallback, name) {
13940
13940
  }
13941
13941
  __name(normalizePositiveDuration, "normalizePositiveDuration");
13942
13942
  function delay(ms) {
13943
- return new Promise((resolve6) => setTimeout(resolve6, ms));
13943
+ return new Promise((resolve7) => setTimeout(resolve7, ms));
13944
13944
  }
13945
13945
  __name(delay, "delay");
13946
13946
  function normalizeCacheOptionsTags(options) {
@@ -14076,25 +14076,25 @@ function defineRoutes(input) {
14076
14076
  }
14077
14077
  __name(defineRoutes, "defineRoutes");
14078
14078
  var routesBuilder = {
14079
- page(path26, options) {
14079
+ page(path27, options) {
14080
14080
  return normalizeProgrammaticRoute({
14081
14081
  kind: "page",
14082
- path: path26,
14082
+ path: path27,
14083
14083
  ...options
14084
14084
  });
14085
14085
  },
14086
- layout(path26, options) {
14086
+ layout(path27, options) {
14087
14087
  return normalizeProgrammaticRoute({
14088
14088
  kind: "layout",
14089
- path: path26,
14089
+ path: path27,
14090
14090
  ...options
14091
14091
  });
14092
14092
  },
14093
- api(path26, options) {
14093
+ api(path27, options) {
14094
14094
  const { render, runtime, regions, maxDuration, ...methods } = options;
14095
14095
  return normalizeProgrammaticRoute({
14096
14096
  kind: "api",
14097
- path: path26,
14097
+ path: path27,
14098
14098
  render,
14099
14099
  runtime,
14100
14100
  regions,
@@ -14130,7 +14130,7 @@ function getProgrammaticRouteSearchClientOptions(search) {
14130
14130
  return Object.keys(options).length > 0 ? options : void 0;
14131
14131
  }
14132
14132
  __name(getProgrammaticRouteSearchClientOptions, "getProgrammaticRouteSearchClientOptions");
14133
- function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path26, routePath) {
14133
+ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path27, routePath) {
14134
14134
  const schema = getProgrammaticRouteSearchSchema(searchConfig);
14135
14135
  const search = parseProgrammaticSchema(schema, rawSearch, "search", routePath);
14136
14136
  const options = getProgrammaticRouteSearchOptions(searchConfig);
@@ -14139,7 +14139,7 @@ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path26, routePa
14139
14139
  schema,
14140
14140
  rawSearch,
14141
14141
  parsedSearch: search,
14142
- path: path26
14142
+ path: path27
14143
14143
  });
14144
14144
  return { search, canonicalPath };
14145
14145
  }
@@ -14322,7 +14322,7 @@ function createRouteModuleFromProgrammaticPage(route) {
14322
14322
  mod.__farmRouteData = route.data;
14323
14323
  mod.__farmRouteParsesProps = true;
14324
14324
  mod.__farmResolveRouteProps = (props) => resolveProgrammaticRouteProps(route, props);
14325
- mod.__farmResolveRouteCanonicalPath = (rawSearch, path26) => resolveProgrammaticRouteSearch(route.search, rawSearch, path26, route.path).canonicalPath;
14325
+ mod.__farmResolveRouteCanonicalPath = (rawSearch, path27) => resolveProgrammaticRouteSearch(route.search, rawSearch, path27, route.path).canonicalPath;
14326
14326
  }
14327
14327
  if (route.pending || route.error || route.notFound) {
14328
14328
  mod.__farmRouteComponents = {
@@ -15076,6 +15076,37 @@ function stripUseClientDirective(content) {
15076
15076
  return content.replace(/^\s*(["'])use client\1\s*;?\s*/, "");
15077
15077
  }
15078
15078
  __name(stripUseClientDirective, "stripUseClientDirective");
15079
+ function hasAsyncDefaultExport(content) {
15080
+ if (!content) return false;
15081
+ const tokens = tokenizeModuleSource(content);
15082
+ for (let index = 0; index < tokens.length - 2; index++) {
15083
+ const token = tokens[index];
15084
+ if (token.kind !== "identifier" || token.value !== "export") continue;
15085
+ if (tokens[index - 1]?.value === ".") continue;
15086
+ if (tokens[index + 1]?.value !== "default") continue;
15087
+ const exported = tokens[index + 2];
15088
+ if (exported.kind === "identifier" && exported.value === "async") {
15089
+ return true;
15090
+ }
15091
+ if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && tokens[index + 3]?.value !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
15092
+ return true;
15093
+ }
15094
+ }
15095
+ return false;
15096
+ }
15097
+ __name(hasAsyncDefaultExport, "hasAsyncDefaultExport");
15098
+ function isAsyncLocalDeclaration(tokens, name) {
15099
+ for (let index = 0; index < tokens.length - 2; index++) {
15100
+ if (tokens[index].value === "async" && tokens[index + 1]?.value === "function" && tokens[index + 2]?.value === name) {
15101
+ return true;
15102
+ }
15103
+ if (tokens[index].value === name && tokens[index + 1]?.value === "=" && tokens[index + 2]?.value === "async") {
15104
+ return true;
15105
+ }
15106
+ }
15107
+ return false;
15108
+ }
15109
+ __name(isAsyncLocalDeclaration, "isAsyncLocalDeclaration");
15079
15110
  function parseClientModuleMetadata(content, inspectIslandExport) {
15080
15111
  if (!content) {
15081
15112
  return {
@@ -15131,6 +15162,14 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
15131
15162
  }
15132
15163
  }
15133
15164
  const shouldHydrate = parsed.hasHydrateExport || importsClientBoundary;
15165
+ if (shouldHydrate && hasAsyncDefaultExport(content)) {
15166
+ return {
15167
+ isClientComponent: false,
15168
+ shouldHydrate: false,
15169
+ islandStrategy: null,
15170
+ suppressedAsyncHydration: true
15171
+ };
15172
+ }
15134
15173
  return {
15135
15174
  isClientComponent: false,
15136
15175
  shouldHydrate,
@@ -15846,6 +15885,7 @@ var _RouteManager = class _RouteManager {
15846
15885
  shouldHydrate: metadata.shouldHydrate,
15847
15886
  isClientComponent: metadata.isClientComponent,
15848
15887
  islandStrategy: metadata.islandStrategy,
15888
+ suppressedAsyncHydration: metadata.suppressedAsyncHydration,
15849
15889
  search: getProgrammaticRouteSearchClientOptions(programmaticPage?.search),
15850
15890
  segments: entry.route.segments.map((seg) => ({
15851
15891
  segment: seg.segment,
@@ -19089,6 +19129,15 @@ _setFarmThemeServerSnapshotResolver(() => {
19089
19129
  // src/server/renderer.ts
19090
19130
  var cachedClerkProvider = null;
19091
19131
  var importRuntimeModule = new Function("specifier", "return import(specifier);");
19132
+ var warnedSuppressedAsyncHydrationModules = /* @__PURE__ */ new Set();
19133
+ function warnSuppressedAsyncHydrationOnce(modulePath) {
19134
+ if (warnedSuppressedAsyncHydrationModules.has(modulePath)) return;
19135
+ warnedSuppressedAsyncHydrationModules.add(modulePath);
19136
+ logger.warn(
19137
+ `${modulePath} is an async server component that imports client components. React cannot hydrate async components in the browser, so this route stays server-rendered and its client imports are not interactive. Move the interactive UI into a "use client" child rendered by a synchronous page, or enable experimental server components support.`
19138
+ );
19139
+ }
19140
+ __name(warnSuppressedAsyncHydrationOnce, "warnSuppressedAsyncHydrationOnce");
19092
19141
  function hasRequestHeader(req, name) {
19093
19142
  const value = req.headers[name.toLowerCase()];
19094
19143
  return Array.isArray(value) ? value.length > 0 : Boolean(value);
@@ -19763,6 +19812,9 @@ var _ServerRenderer = class _ServerRenderer {
19763
19812
  })
19764
19813
  );
19765
19814
  const shouldHydrate = moduleMetadata.shouldHydrate;
19815
+ if (moduleMetadata.suppressedAsyncHydration) {
19816
+ warnSuppressedAsyncHydrationOnce(route.modulePath);
19817
+ }
19766
19818
  const layoutHydrationMetadata = layouts.map((layout2) => {
19767
19819
  const manifestEntry = routeManifest.layouts.find(
19768
19820
  (entry) => entry.pattern === layout2.pattern
@@ -20260,7 +20312,7 @@ var _ServerRenderer = class _ServerRenderer {
20260
20312
  }
20261
20313
  }
20262
20314
  async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
20263
- return new Promise((resolve6, reject) => {
20315
+ return new Promise((resolve7, reject) => {
20264
20316
  const streamStartTime = Date.now();
20265
20317
  const observabilityRoute = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
20266
20318
  const deploymentId = this.getDeploymentId();
@@ -20460,7 +20512,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
20460
20512
  route: observabilityRoute,
20461
20513
  durationMs: Date.now() - streamStartTime
20462
20514
  });
20463
- resolve6();
20515
+ resolve7();
20464
20516
  }
20465
20517
  });
20466
20518
  res.write(shell);
@@ -22982,8 +23034,8 @@ init_app_markdown();
22982
23034
  init_response();
22983
23035
  init_integrations();
22984
23036
  init_devtools_config();
22985
- var fs7 = __toESM(require("fs"));
22986
- var path25 = __toESM(require("path"));
23037
+ var fs8 = __toESM(require("fs"));
23038
+ var path26 = __toESM(require("path"));
22987
23039
  init_layers();
22988
23040
 
22989
23041
  // src/environment-vite.ts
@@ -23330,7 +23382,7 @@ function transformError(id, message) {
23330
23382
  __name(transformError, "transformError");
23331
23383
 
23332
23384
  // package.json
23333
- var version = "0.1.0-beta.23";
23385
+ var version = "0.1.0-beta.24";
23334
23386
 
23335
23387
  // src/version.ts
23336
23388
  var FARM_VERSION = version;
@@ -23364,8 +23416,8 @@ __name(reportAfterError, "reportAfterError");
23364
23416
  function createAfterRequestState(reportError = defaultAfterErrorReporter) {
23365
23417
  let resolveResponseFinished;
23366
23418
  let responseFinished = false;
23367
- const responseFinishedPromise = new Promise((resolve6) => {
23368
- resolveResponseFinished = resolve6;
23419
+ const responseFinishedPromise = new Promise((resolve7) => {
23420
+ resolveResponseFinished = resolve7;
23369
23421
  });
23370
23422
  const state = {
23371
23423
  completion: Promise.resolve(),
@@ -23436,6 +23488,34 @@ function _withAfterNodeMiddleware(handler) {
23436
23488
  }
23437
23489
  __name(_withAfterNodeMiddleware, "_withAfterNodeMiddleware");
23438
23490
 
23491
+ // src/dev-static.ts
23492
+ var fs7 = __toESM(require("fs"));
23493
+ var path17 = __toESM(require("path"));
23494
+ function devServableFileExists(pathname, baseDirs) {
23495
+ let decodedPathname;
23496
+ try {
23497
+ decodedPathname = decodeURIComponent(pathname);
23498
+ } catch {
23499
+ return false;
23500
+ }
23501
+ const relativePathname = decodedPathname.replace(/^\/+/, "");
23502
+ if (!relativePathname) return false;
23503
+ for (const baseDir of baseDirs) {
23504
+ if (typeof baseDir !== "string" || baseDir.length === 0) continue;
23505
+ const resolvedBase = path17.resolve(baseDir);
23506
+ const candidate = path17.resolve(resolvedBase, relativePathname);
23507
+ if (!candidate.startsWith(resolvedBase + path17.sep)) continue;
23508
+ try {
23509
+ if (fs7.existsSync(candidate) && fs7.statSync(candidate).isFile()) {
23510
+ return true;
23511
+ }
23512
+ } catch {
23513
+ }
23514
+ }
23515
+ return false;
23516
+ }
23517
+ __name(devServableFileExists, "devServableFileExists");
23518
+
23439
23519
  // src/vite.ts
23440
23520
  init_deployment();
23441
23521
  init_image_config();
@@ -23817,11 +23897,11 @@ function isPotentialProgrammaticRouteSourceFile(normalizedFile, srcDirSlug) {
23817
23897
  }
23818
23898
  __name(isPotentialProgrammaticRouteSourceFile, "isPotentialProgrammaticRouteSourceFile");
23819
23899
  function fileContainsProgrammaticPageRoute(file) {
23820
- if (!fs7.existsSync(file)) {
23900
+ if (!fs8.existsSync(file)) {
23821
23901
  return false;
23822
23902
  }
23823
23903
  try {
23824
- return scanProgrammaticPagePaths(fs7.readFileSync(file, "utf8")).length > 0;
23904
+ return scanProgrammaticPagePaths(fs8.readFileSync(file, "utf8")).length > 0;
23825
23905
  } catch {
23826
23906
  return false;
23827
23907
  }
@@ -23829,7 +23909,7 @@ function fileContainsProgrammaticPageRoute(file) {
23829
23909
  __name(fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
23830
23910
  function rewriteEarlySsrRelativeImports(options) {
23831
23911
  const cleanId = options.id.split("?", 1)[0];
23832
- if (!path25.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
23912
+ if (!path26.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
23833
23913
  return null;
23834
23914
  }
23835
23915
  const replacements = [];
@@ -23849,7 +23929,7 @@ function rewriteEarlySsrRelativeImports(options) {
23849
23929
  const suffixIndex = source.value.search(/[?#]/);
23850
23930
  const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
23851
23931
  const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
23852
- const resolvedPath = path25.resolve(path25.dirname(cleanId), sourcePath);
23932
+ const resolvedPath = path26.resolve(path26.dirname(cleanId), sourcePath);
23853
23933
  replacements.push({
23854
23934
  start: source.start,
23855
23935
  end: source.end,
@@ -23928,7 +24008,7 @@ function farmPlugin(options = {}, initialPluginManager) {
23928
24008
  ...layerRoots.length ? {
23929
24009
  server: {
23930
24010
  fs: {
23931
- allow: [path25.resolve(options.root || process.cwd()), ...layerRoots]
24011
+ allow: [path26.resolve(options.root || process.cwd()), ...layerRoots]
23932
24012
  }
23933
24013
  }
23934
24014
  } : {}
@@ -23959,13 +24039,13 @@ function farmPlugin(options = {}, initialPluginManager) {
23959
24039
  },
23960
24040
  server
23961
24041
  );
23962
- const globalsCSSPath = path25.join(server.config.root, "src/app/globals.css");
23963
- if (!fs7.existsSync(globalsCSSPath)) {
23964
- const appDir = path25.join(server.config.root, "src/app");
23965
- if (!fs7.existsSync(appDir)) {
23966
- fs7.mkdirSync(appDir, { recursive: true });
24042
+ const globalsCSSPath = path26.join(server.config.root, "src/app/globals.css");
24043
+ if (!fs8.existsSync(globalsCSSPath)) {
24044
+ const appDir = path26.join(server.config.root, "src/app");
24045
+ if (!fs8.existsSync(appDir)) {
24046
+ fs8.mkdirSync(appDir, { recursive: true });
23967
24047
  }
23968
- fs7.writeFileSync(globalsCSSPath, defaultGlobalCSS);
24048
+ fs8.writeFileSync(globalsCSSPath, defaultGlobalCSS);
23969
24049
  }
23970
24050
  await farmApp.initialize();
23971
24051
  const farmConfig = farmApp.getConfig();
@@ -23984,10 +24064,10 @@ function farmPlugin(options = {}, initialPluginManager) {
23984
24064
  });
23985
24065
  }
23986
24066
  const sourceRoots = getFarmSourceRoots(farmConfig);
23987
- server.watcher.add(sourceRoots.map((source) => path25.join(source.root, source.srcDir)));
24067
+ server.watcher.add(sourceRoots.map((source) => path26.join(source.root, source.srcDir)));
23988
24068
  if (farmConfig.i18n.enabled) {
23989
24069
  server.watcher.add(
23990
- farmConfig.i18n.messages.includes("{locale}") ? path25.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
24070
+ farmConfig.i18n.messages.includes("{locale}") ? path26.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
23991
24071
  );
23992
24072
  }
23993
24073
  const workflowConfig = farmConfig.workflows;
@@ -23997,7 +24077,7 @@ function farmPlugin(options = {}, initialPluginManager) {
23997
24077
  ...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
23998
24078
  ], "getExtraRouteTypes");
23999
24079
  const appDirSlugs = sourceRoots.map(
24000
- (source) => path25.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
24080
+ (source) => path26.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
24001
24081
  );
24002
24082
  const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
24003
24083
  try {
@@ -24037,7 +24117,7 @@ function farmPlugin(options = {}, initialPluginManager) {
24037
24117
  }, "generateTypeArtifacts");
24038
24118
  await generateTypeArtifacts("startup");
24039
24119
  const srcDirSlugs = sourceRoots.map(
24040
- (source) => path25.join(source.root, source.srcDir).replace(/\\/g, "/")
24120
+ (source) => path26.join(source.root, source.srcDir).replace(/\\/g, "/")
24041
24121
  );
24042
24122
  const layerConfigFiles = new Set(
24043
24123
  farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
@@ -24155,7 +24235,7 @@ function farmPlugin(options = {}, initialPluginManager) {
24155
24235
  await apiRouteManager.discoverRoutes();
24156
24236
  let discoveredWorkflows = [];
24157
24237
  const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
24158
- (dir) => fs7.existsSync(path25.isAbsolute(dir) ? dir : path25.join(farmConfig.root, dir))
24238
+ (dir) => fs8.existsSync(path26.isAbsolute(dir) ? dir : path26.join(farmConfig.root, dir))
24159
24239
  );
24160
24240
  if (hasWorkflowDirectory) {
24161
24241
  const { createFarmWorkflowRequestHandler: createFarmWorkflowRequestHandler2, discoverFarmWorkflows: discoverFarmWorkflows2 } = await loadFarmWorkflowsDevRuntime();
@@ -24389,12 +24469,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
24389
24469
  }
24390
24470
  }
24391
24471
  const farmDocsFontPath = farmDocsFontAssets.get(requestPathname);
24392
- if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath && fs7.existsSync(farmDocsFontPath)) {
24472
+ if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath && fs8.existsSync(farmDocsFontPath)) {
24393
24473
  res.statusCode = 200;
24394
24474
  res.setHeader("Content-Type", "font/woff2");
24395
24475
  res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
24396
24476
  if (requestMethod === "HEAD") res.end();
24397
- else fs7.createReadStream(farmDocsFontPath).pipe(res);
24477
+ else fs8.createReadStream(farmDocsFontPath).pipe(res);
24398
24478
  return;
24399
24479
  }
24400
24480
  if (requestMethod === "GET" && (requestPathname === FARM_DEVTOOLS_PATH || requestPathname === `${FARM_DEVTOOLS_PATH}.json`)) {
@@ -24492,7 +24572,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
24492
24572
  return null;
24493
24573
  }
24494
24574
  return {
24495
- source: await fs7.promises.readFile(sourcePath, "utf8"),
24575
+ source: await fs8.promises.readFile(sourcePath, "utf8"),
24496
24576
  filePath: sourcePath
24497
24577
  };
24498
24578
  }, "resolveSource")
@@ -24827,9 +24907,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
24827
24907
  res.end(JSON.stringify({ error: "API route not found", pathname: pathname2 }));
24828
24908
  return;
24829
24909
  }
24830
- if (req.url?.startsWith("/@") || req.url?.startsWith("/node_modules") || requestPathname.includes(".") && !requestPathname.endsWith(".html")) {
24910
+ if (req.url?.startsWith("/@") || req.url?.startsWith("/node_modules")) {
24831
24911
  return next();
24832
24912
  }
24913
+ if (requestPathname.includes(".") && !requestPathname.endsWith(".html")) {
24914
+ const matchesAppRoute = Boolean(
24915
+ farmApp?.getRouteManager()?.matchRoute(requestPathname)?.route
24916
+ );
24917
+ if (!matchesAppRoute || devServableFileExists(requestPathname, [server.config.publicDir, server.config.root])) {
24918
+ return next();
24919
+ }
24920
+ }
24833
24921
  if (req.url?.startsWith("/__farm/page-data")) {
24834
24922
  const urlObj = new URL(req.url, `http://${req.headers.host || "localhost:3000"}`);
24835
24923
  const targetPath = urlObj.searchParams.get("path") || "/";
@@ -25535,8 +25623,8 @@ if (import.meta.hot) {
25535
25623
  }
25536
25624
  logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
25537
25625
  logger.info("Pre-rendering SSG pages...");
25538
- const outDir = path25.join(server?.config.root || process.cwd(), options.outDir || "dist");
25539
- const clientDir = path25.join(outDir, "client");
25626
+ const outDir = path26.join(server?.config.root || process.cwd(), options.outDir || "dist");
25627
+ const clientDir = path26.join(outDir, "client");
25540
25628
  for (const page2 of ssgPages) {
25541
25629
  try {
25542
25630
  const staticRequest = new Request(new URL(page2.urlPath, "http://farm.static"));
@@ -25588,9 +25676,9 @@ if (import.meta.hot) {
25588
25676
  <script type="module" src="/assets/client.js"></script>
25589
25677
  </body>
25590
25678
  </html>`;
25591
- const outputPath = page2.urlPath === "/" ? path25.join(clientDir, "index.html") : path25.join(clientDir, page2.urlPath + ".html");
25592
- fs7.mkdirSync(path25.dirname(outputPath), { recursive: true });
25593
- fs7.writeFileSync(outputPath, fullHtml);
25679
+ const outputPath = page2.urlPath === "/" ? path26.join(clientDir, "index.html") : path26.join(clientDir, page2.urlPath + ".html");
25680
+ fs8.mkdirSync(path26.dirname(outputPath), { recursive: true });
25681
+ fs8.writeFileSync(outputPath, fullHtml);
25594
25682
  const revalidateInfo = page2.revalidate ? ` (revalidate: ${page2.revalidate}s)` : "";
25595
25683
  logger.success(` \u2713 ${page2.urlPath}${revalidateInfo}`);
25596
25684
  });
@@ -25598,8 +25686,8 @@ if (import.meta.hot) {
25598
25686
  logger.error(` \u2717 ${page2.urlPath}: ${error}`);
25599
25687
  }
25600
25688
  }
25601
- const manifestPath = path25.join(outDir, "__ssg_manifest.json");
25602
- fs7.writeFileSync(
25689
+ const manifestPath = path26.join(outDir, "__ssg_manifest.json");
25690
+ fs8.writeFileSync(
25603
25691
  manifestPath,
25604
25692
  JSON.stringify(
25605
25693
  ssgPages.map((p) => ({
@@ -25634,9 +25722,9 @@ if (import.meta.hot) {
25634
25722
  }
25635
25723
  const currentFarmConfig = farmApp?.getConfig();
25636
25724
  const normalizedFile = file.replace(/\\/g, "/");
25637
- const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path25.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
25725
+ const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path26.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
25638
25726
  if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
25639
- logUpdate("PAGE", `updated ${path25.basename(file)}`);
25727
+ logUpdate("PAGE", `updated ${path26.basename(file)}`);
25640
25728
  for (const mod of modules) {
25641
25729
  server2.moduleGraph.invalidateModule(mod);
25642
25730
  }
@@ -26822,6 +26910,19 @@ async function tryHydrateImportedPage(
26822
26910
  const PageComponent = pageModule?.default;
26823
26911
  if (!PageComponent) return false;
26824
26912
 
26913
+ if (
26914
+ typeof PageComponent === 'function' &&
26915
+ PageComponent.constructor &&
26916
+ PageComponent.constructor.name === 'AsyncFunction'
26917
+ ) {
26918
+ console.warn(
26919
+ '[Farm.js] Skipping hydration for ' + modulePath +
26920
+ ': async server components cannot run in the browser. ' +
26921
+ 'Server-rendered HTML is preserved; move interactive UI into a "use client" child of a synchronous page.'
26922
+ );
26923
+ return false;
26924
+ }
26925
+
26825
26926
  currentPageComponent = PageComponent;
26826
26927
  currentPageProps = await buildRouteComponentProps(
26827
26928
  pageModule,
@@ -27375,7 +27476,7 @@ function generateClientManifest(bundle) {
27375
27476
  __name(generateClientManifest, "generateClientManifest");
27376
27477
  async function defineConfig2(config = {}) {
27377
27478
  const tailwindcss = (await import("@tailwindcss/vite")).default;
27378
- const appRoot = path25.resolve(config.root || process.cwd());
27479
+ const appRoot = path26.resolve(config.root || process.cwd());
27379
27480
  if (config.extends?.length) {
27380
27481
  const { config: layeredConfig } = await Promise.resolve().then(() => (init_layers(), layers_exports)).then(
27381
27482
  ({ resolveFarmLayers: resolveFarmLayers2 }) => resolveFarmLayers2(config, {