@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.
@@ -283,11 +283,11 @@ function resolveFarmServerHealthConfig(config) {
283
283
  return Object.freeze({ enabled: true, livenessPath, readinessPath });
284
284
  }
285
285
  function normalizeHealthPath(value, optionName) {
286
- const path31 = value.trim();
287
- if (!path31.startsWith("/") || path31.includes("?") || path31.includes("#") || path31.includes("*")) {
286
+ const path32 = value.trim();
287
+ if (!path32.startsWith("/") || path32.includes("?") || path32.includes("#") || path32.includes("*")) {
288
288
  throw new TypeError(`${optionName} must be an absolute pathname without a query or wildcard`);
289
289
  }
290
- return path31.length > 1 ? path31.replace(/\/+$/, "") || "/" : path31;
290
+ return path32.length > 1 ? path32.replace(/\/+$/, "") || "/" : path32;
291
291
  }
292
292
  function parseBodySizeLimit(value, optionName = "bodySizeLimit") {
293
293
  if (typeof value === "number") {
@@ -384,7 +384,7 @@ async function readNodeRequestBody(request, limit) {
384
384
  request.resume?.();
385
385
  throw error;
386
386
  }
387
- return await new Promise((resolve6, reject) => {
387
+ return await new Promise((resolve7, reject) => {
388
388
  const chunks = [];
389
389
  let total = 0;
390
390
  let settled = false;
@@ -413,7 +413,7 @@ async function readNodeRequestBody(request, limit) {
413
413
  if (settled) return;
414
414
  settled = true;
415
415
  cleanup();
416
- resolve6(Buffer.concat(chunks, total));
416
+ resolve7(Buffer.concat(chunks, total));
417
417
  }, "onEnd");
418
418
  const onError = /* @__PURE__ */ __name((error) => rejectOnce(error), "onError");
419
419
  request.on("data", onData);
@@ -1086,9 +1086,9 @@ function getFarmIntegrationPluginOwner(plugin) {
1086
1086
  const value = plugin[FARM_INTEGRATION_PLUGIN_OWNER];
1087
1087
  return value && typeof value === "object" ? value : void 0;
1088
1088
  }
1089
- function defineTypedIntegrationRoute(method, path31, input) {
1089
+ function defineTypedIntegrationRoute(method, path32, input) {
1090
1090
  return {
1091
- path: path31,
1091
+ path: path32,
1092
1092
  method,
1093
1093
  middleware: input.middleware,
1094
1094
  before: input.before,
@@ -1098,7 +1098,7 @@ function defineTypedIntegrationRoute(method, path31, input) {
1098
1098
  input: normalizeIntegrationRouteInputSchemas(input),
1099
1099
  handler: input.handler,
1100
1100
  __operation: defineIntegrationAPIOperation({
1101
- path: path31,
1101
+ path: path32,
1102
1102
  method,
1103
1103
  bodyFormat: input.bodyFormat,
1104
1104
  responseFormat: input.responseFormat,
@@ -1110,52 +1110,52 @@ function defineTypedIntegrationRoute(method, path31, input) {
1110
1110
  }
1111
1111
  function createIntegrationRouteFactory() {
1112
1112
  return {
1113
- get(path31, input) {
1113
+ get(path32, input) {
1114
1114
  return defineTypedIntegrationRoute(
1115
1115
  "GET",
1116
- path31,
1116
+ path32,
1117
1117
  input
1118
1118
  );
1119
1119
  },
1120
- post(path31, input) {
1120
+ post(path32, input) {
1121
1121
  return defineTypedIntegrationRoute(
1122
1122
  "POST",
1123
- path31,
1123
+ path32,
1124
1124
  {
1125
1125
  bodyFormat: "json",
1126
1126
  ...input
1127
1127
  }
1128
1128
  );
1129
1129
  },
1130
- put(path31, input) {
1130
+ put(path32, input) {
1131
1131
  return defineTypedIntegrationRoute(
1132
1132
  "PUT",
1133
- path31,
1133
+ path32,
1134
1134
  {
1135
1135
  bodyFormat: "json",
1136
1136
  ...input
1137
1137
  }
1138
1138
  );
1139
1139
  },
1140
- patch(path31, input) {
1141
- return defineTypedIntegrationRoute("PATCH", path31, {
1140
+ patch(path32, input) {
1141
+ return defineTypedIntegrationRoute("PATCH", path32, {
1142
1142
  bodyFormat: "json",
1143
1143
  ...input
1144
1144
  });
1145
1145
  },
1146
- delete(path31, input) {
1147
- return defineTypedIntegrationRoute("DELETE", path31, {
1146
+ delete(path32, input) {
1147
+ return defineTypedIntegrationRoute("DELETE", path32, {
1148
1148
  bodyFormat: "json",
1149
1149
  ...input
1150
1150
  });
1151
1151
  },
1152
- options(path31, input) {
1153
- return defineTypedIntegrationRoute("OPTIONS", path31, input);
1152
+ options(path32, input) {
1153
+ return defineTypedIntegrationRoute("OPTIONS", path32, input);
1154
1154
  },
1155
- head(path31, input) {
1155
+ head(path32, input) {
1156
1156
  return defineTypedIntegrationRoute(
1157
1157
  "HEAD",
1158
- path31,
1158
+ path32,
1159
1159
  input
1160
1160
  );
1161
1161
  }
@@ -1429,8 +1429,8 @@ async function parseIntegrationConfigSchema(integration, schema, value) {
1429
1429
  function createIntegrationConfigValidationError(integration, error) {
1430
1430
  const issues = Array.isArray(error.issues) && error.issues.length > 0 ? error.issues.map((issue) => {
1431
1431
  const normalizedPath = normalizeIntegrationValidationPath(issue.path);
1432
- const path31 = normalizedPath.length ? `${normalizedPath.join(".")}: ` : "";
1433
- return `${path31}${issue.message || "Invalid config"}`;
1432
+ const path32 = normalizedPath.length ? `${normalizedPath.join(".")}: ` : "";
1433
+ return `${path32}${issue.message || "Invalid config"}`;
1434
1434
  }).join("; ") : error.message || "Invalid config";
1435
1435
  return new Error(`Integration "${integration.type}" config validation failed: ${issues}`);
1436
1436
  }
@@ -2127,8 +2127,8 @@ function normalizeIntegrationValidationIssues(source, error) {
2127
2127
  }
2128
2128
  ];
2129
2129
  }
2130
- function normalizeIntegrationValidationPath(path31) {
2131
- return (path31 || []).map((segment) => {
2130
+ function normalizeIntegrationValidationPath(path32) {
2131
+ return (path32 || []).map((segment) => {
2132
2132
  const key = typeof segment === "object" && segment !== null && "key" in segment ? segment.key : segment;
2133
2133
  return typeof key === "symbol" ? key.description || key.toString() : key;
2134
2134
  });
@@ -3341,22 +3341,22 @@ async function prepareFarmWorkflowsForNitro(config) {
3341
3341
  }
3342
3342
  const root = config.root || process.cwd();
3343
3343
  const distDir = config.distDir || ".farm";
3344
- const fs8 = await import("fs/promises");
3345
- const path31 = await import("path");
3346
- const generatedDir = path31.join(root, distDir, ".nitro", "farm-workflows");
3347
- await fs8.mkdir(generatedDir, { recursive: true });
3344
+ const fs9 = await import("fs/promises");
3345
+ const path32 = await import("path");
3346
+ const generatedDir = path32.join(root, distDir, ".nitro", "farm-workflows");
3347
+ await fs9.mkdir(generatedDir, { recursive: true });
3348
3348
  const tasks = {};
3349
3349
  const scheduledTasks = createScheduledTasks(workflows);
3350
3350
  for (const workflow of workflows) {
3351
- const wrapperPath = path31.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
3352
- await fs8.writeFile(wrapperPath, createNitroTaskWrapper(workflow), "utf8");
3351
+ const wrapperPath = path32.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
3352
+ await fs9.writeFile(wrapperPath, createNitroTaskWrapper(workflow), "utf8");
3353
3353
  tasks[workflow.id] = {
3354
3354
  handler: wrapperPath,
3355
3355
  description: workflow.description || `Farm workflow ${workflow.id}`
3356
3356
  };
3357
3357
  }
3358
- const handlerPath = path31.join(generatedDir, "http-handler.mjs");
3359
- await fs8.writeFile(
3358
+ const handlerPath = path32.join(generatedDir, "http-handler.mjs");
3359
+ await fs9.writeFile(
3360
3360
  handlerPath,
3361
3361
  createNitroWorkflowHTTPHandler(
3362
3362
  workflowConfig,
@@ -3365,8 +3365,8 @@ async function prepareFarmWorkflowsForNitro(config) {
3365
3365
  ),
3366
3366
  "utf8"
3367
3367
  );
3368
- const manifestPath = path31.join(generatedDir, "manifest.json");
3369
- await fs8.writeFile(
3368
+ const manifestPath = path32.join(generatedDir, "manifest.json");
3369
+ await fs9.writeFile(
3370
3370
  manifestPath,
3371
3371
  JSON.stringify(
3372
3372
  {
@@ -3447,22 +3447,22 @@ function resolveWorkflowDefinition(module2) {
3447
3447
  return null;
3448
3448
  }
3449
3449
  async function findWorkflowFiles(root, dirs) {
3450
- const fs8 = await import("fs/promises");
3451
- const path31 = await import("path");
3450
+ const fs9 = await import("fs/promises");
3451
+ const path32 = await import("path");
3452
3452
  const files = [];
3453
3453
  for (const dir of dirs) {
3454
- const absoluteDir = path31.isAbsolute(dir) ? dir : path31.join(root, dir);
3454
+ const absoluteDir = path32.isAbsolute(dir) ? dir : path32.join(root, dir);
3455
3455
  if (!await pathExists(absoluteDir)) continue;
3456
3456
  await walkWorkflowDir(absoluteDir, files);
3457
3457
  }
3458
3458
  return files.sort();
3459
3459
  }
3460
3460
  async function walkWorkflowDir(dir, files) {
3461
- const fs8 = await import("fs/promises");
3462
- const path31 = await import("path");
3463
- const entries = await fs8.readdir(dir, { withFileTypes: true });
3461
+ const fs9 = await import("fs/promises");
3462
+ const path32 = await import("path");
3463
+ const entries = await fs9.readdir(dir, { withFileTypes: true });
3464
3464
  for (const entry of entries) {
3465
- const filePath = path31.join(dir, entry.name);
3465
+ const filePath = path32.join(dir, entry.name);
3466
3466
  if (entry.isDirectory()) {
3467
3467
  if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
3468
3468
  await walkWorkflowDir(filePath, files);
@@ -3474,20 +3474,20 @@ async function walkWorkflowDir(dir, files) {
3474
3474
  }
3475
3475
  }
3476
3476
  async function pathExists(filePath) {
3477
- const fs8 = await import("fs/promises");
3478
- return fs8.access(filePath).then(() => true).catch(() => false);
3477
+ const fs9 = await import("fs/promises");
3478
+ return fs9.access(filePath).then(() => true).catch(() => false);
3479
3479
  }
3480
3480
  function isWorkflowFile(fileName) {
3481
3481
  return /\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(fileName) && !/\.d\.[cm]?ts$/.test(fileName);
3482
3482
  }
3483
3483
  async function loadWorkflowModule(filePath, root) {
3484
- const fs8 = await import("fs/promises");
3485
- const path31 = await import("path");
3484
+ const fs9 = await import("fs/promises");
3485
+ const path32 = await import("path");
3486
3486
  const { pathToFileURL: pathToFileURL5 } = await import("url");
3487
3487
  const { build: build2 } = await import("esbuild");
3488
- const outDir = path31.join(root, ".farm", ".workflow-loader");
3489
- await fs8.mkdir(outDir, { recursive: true });
3490
- const outfile = path31.join(
3488
+ const outDir = path32.join(root, ".farm", ".workflow-loader");
3489
+ await fs9.mkdir(outDir, { recursive: true });
3490
+ const outfile = path32.join(
3491
3491
  outDir,
3492
3492
  `workflow-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
3493
3493
  );
@@ -3511,7 +3511,7 @@ async function loadWorkflowModule(filePath, root) {
3511
3511
  `${pathToFileURL5(outfile).href}?t=${Date.now()}`
3512
3512
  );
3513
3513
  } finally {
3514
- await fs8.unlink(outfile).catch(() => void 0);
3514
+ await fs9.unlink(outfile).catch(() => void 0);
3515
3515
  }
3516
3516
  }
3517
3517
  function workflowIdFromFile(root, filePath) {
@@ -3781,14 +3781,14 @@ async function prepareFarmCronForNitro(config) {
3781
3781
  const cron = isResolvedCronConfig(config.cron) ? config.cron : resolveCronConfig(config.cron);
3782
3782
  const root = config.root || process.cwd();
3783
3783
  const distDir = config.distDir || ".farm";
3784
- const fs8 = await import("fs/promises");
3785
- const path31 = await import("path");
3786
- const manifestPath = path31.join(root, distDir, FARM_CRON_MANIFEST);
3787
- const generatedDir = path31.join(root, distDir, ".nitro", "farm-cron");
3784
+ const fs9 = await import("fs/promises");
3785
+ const path32 = await import("path");
3786
+ const manifestPath = path32.join(root, distDir, FARM_CRON_MANIFEST);
3787
+ const generatedDir = path32.join(root, distDir, ".nitro", "farm-cron");
3788
3788
  if (!cron.enabled) {
3789
3789
  await Promise.all([
3790
- fs8.rm(manifestPath, { force: true }),
3791
- fs8.rm(generatedDir, { recursive: true, force: true })
3790
+ fs9.rm(manifestPath, { force: true }),
3791
+ fs9.rm(generatedDir, { recursive: true, force: true })
3792
3792
  ]);
3793
3793
  return {
3794
3794
  jobs: [],
@@ -3796,21 +3796,21 @@ async function prepareFarmCronForNitro(config) {
3796
3796
  scheduledTasks: {}
3797
3797
  };
3798
3798
  }
3799
- await fs8.rm(generatedDir, { recursive: true, force: true });
3800
- await fs8.mkdir(generatedDir, { recursive: true });
3799
+ await fs9.rm(generatedDir, { recursive: true, force: true });
3800
+ await fs9.mkdir(generatedDir, { recursive: true });
3801
3801
  const tasks = {};
3802
3802
  for (const job of cron.jobs) {
3803
3803
  const taskName = getFarmCronTaskName(job.name);
3804
- const wrapperPath = path31.join(generatedDir, `${safeFileName2(job.name)}.mjs`);
3805
- await fs8.writeFile(wrapperPath, createNitroCronTaskWrapper(job, cron.secretEnv), "utf8");
3804
+ const wrapperPath = path32.join(generatedDir, `${safeFileName2(job.name)}.mjs`);
3805
+ await fs9.writeFile(wrapperPath, createNitroCronTaskWrapper(job, cron.secretEnv), "utf8");
3806
3806
  tasks[taskName] = {
3807
3807
  handler: wrapperPath,
3808
3808
  description: job.description || `Farm cron ${job.name}`
3809
3809
  };
3810
3810
  }
3811
3811
  const manifest = createFarmCronManifest(cron);
3812
- await fs8.mkdir(path31.dirname(manifestPath), { recursive: true });
3813
- await fs8.writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}
3812
+ await fs9.mkdir(path32.dirname(manifestPath), { recursive: true });
3813
+ await fs9.writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}
3814
3814
  `, "utf8");
3815
3815
  return {
3816
3816
  jobs: cron.jobs,
@@ -3891,7 +3891,7 @@ function normalizeCronJob(name, job) {
3891
3891
  if (!job || typeof job !== "object" || Array.isArray(job)) {
3892
3892
  throw new TypeError(`Farm cron ${JSON.stringify(name)} must be a configuration object.`);
3893
3893
  }
3894
- const path31 = normalizeCronPath(name, job.path);
3894
+ const path32 = normalizeCronPath(name, job.path);
3895
3895
  const rawSchedule = Array.isArray(job.schedule) ? job.schedule : [job.schedule];
3896
3896
  const schedule = [...new Set(rawSchedule.map((value) => normalizeCronExpression(name, value)))];
3897
3897
  if (schedule.length === 0) {
@@ -3900,7 +3900,7 @@ function normalizeCronJob(name, job) {
3900
3900
  return {
3901
3901
  name,
3902
3902
  schedule,
3903
- path: path31,
3903
+ path: path32,
3904
3904
  description: job.description?.trim() || void 0
3905
3905
  };
3906
3906
  }
@@ -3908,13 +3908,13 @@ function normalizeCronPath(name, value) {
3908
3908
  if (typeof value !== "string" || !value.trim().startsWith("/")) {
3909
3909
  throw new TypeError(`Farm cron ${JSON.stringify(name)} path must start with "/".`);
3910
3910
  }
3911
- const path31 = value.trim();
3912
- if (path31.startsWith("//") || path31.includes("?") || path31.includes("#")) {
3911
+ const path32 = value.trim();
3912
+ if (path32.startsWith("//") || path32.includes("?") || path32.includes("#")) {
3913
3913
  throw new TypeError(
3914
3914
  `Farm cron ${JSON.stringify(name)} path must be an application pathname without a host, query, or hash.`
3915
3915
  );
3916
3916
  }
3917
- return path31.length > 1 ? path31.replace(/\/+$/, "") : path31;
3917
+ return path32.length > 1 ? path32.replace(/\/+$/, "") : path32;
3918
3918
  }
3919
3919
  function normalizeCronExpression(name, value) {
3920
3920
  if (typeof value !== "string") {
@@ -5298,8 +5298,8 @@ function createFarmDeploymentMismatchResponse(mismatch) {
5298
5298
  }
5299
5299
  );
5300
5300
  }
5301
- function createFarmDeploymentCookie(deploymentId, path31 = "/", secure = false) {
5302
- const normalizedPath = path31.startsWith("/") ? path31 : `/${path31}`;
5301
+ function createFarmDeploymentCookie(deploymentId, path32 = "/", secure = false) {
5302
+ const normalizedPath = path32.startsWith("/") ? path32 : `/${path32}`;
5303
5303
  return [
5304
5304
  `${FARM_DEPLOYMENT_COOKIE}=${encodeURIComponent(deploymentId)}`,
5305
5305
  `Path=${normalizedPath}`,
@@ -5371,7 +5371,7 @@ var init_devtools_config = __esm({
5371
5371
 
5372
5372
  // src/image-config.ts
5373
5373
  function resolveFarmImageConfig(config) {
5374
- const path31 = normalizeImagePath(config?.path ?? DEFAULT_FARM_IMAGE_PATH);
5374
+ const path32 = normalizeImagePath(config?.path ?? DEFAULT_FARM_IMAGE_PATH);
5375
5375
  const deviceSizes = normalizeIntegerList(
5376
5376
  config?.deviceSizes ?? DEFAULT_FARM_IMAGE_DEVICE_SIZES,
5377
5377
  "images.deviceSizes"
@@ -5399,7 +5399,7 @@ function resolveFarmImageConfig(config) {
5399
5399
  );
5400
5400
  return Object.freeze({
5401
5401
  provider: config?.provider ?? "auto",
5402
- path: path31,
5402
+ path: path32,
5403
5403
  domains: Object.freeze([
5404
5404
  ...new Set(
5405
5405
  (config?.domains ?? []).map((domain) => domain.trim().toLowerCase()).filter(Boolean)
@@ -5438,11 +5438,11 @@ function getPublicFarmImageConfig(config) {
5438
5438
  };
5439
5439
  }
5440
5440
  function normalizeImagePath(value) {
5441
- const path31 = value.trim().replace(/\/+$/, "") || "/";
5442
- if (!path31.startsWith("/") || path31.includes("?") || path31.includes("#")) {
5441
+ const path32 = value.trim().replace(/\/+$/, "") || "/";
5442
+ if (!path32.startsWith("/") || path32.includes("?") || path32.includes("#")) {
5443
5443
  throw new TypeError("images.path must be an absolute pathname without a query or hash");
5444
5444
  }
5445
- return path31;
5445
+ return path32;
5446
5446
  }
5447
5447
  function normalizeIntegerList(values, name, max) {
5448
5448
  if (values.length === 0) {
@@ -6086,37 +6086,37 @@ function sanitizeDocsConfig(config) {
6086
6086
  return cloneSerializable(config) || {};
6087
6087
  }
6088
6088
  async function findDocsConfigPath(rootDir, configPath) {
6089
- const { existsSync: existsSync17 } = await import("fs");
6089
+ const { existsSync: existsSync18 } = await import("fs");
6090
6090
  const root = import_path2.default.resolve(rootDir || process.cwd());
6091
6091
  if (configPath) {
6092
6092
  const resolvedPath = import_path2.default.isAbsolute(configPath) ? configPath : import_path2.default.join(root, configPath);
6093
- if (!existsSync17(resolvedPath)) {
6093
+ if (!existsSync18(resolvedPath)) {
6094
6094
  throw new Error(`Could not find docs config at ${configPath}.`);
6095
6095
  }
6096
6096
  return import_path2.default.resolve(resolvedPath);
6097
6097
  }
6098
6098
  for (const filename of DOCS_CONFIG_FILENAMES) {
6099
6099
  const resolvedPath = import_path2.default.join(root, filename);
6100
- if (existsSync17(resolvedPath)) {
6100
+ if (existsSync18(resolvedPath)) {
6101
6101
  return resolvedPath;
6102
6102
  }
6103
6103
  }
6104
6104
  return void 0;
6105
6105
  }
6106
6106
  async function loadDocsConfig(rootDir, configPath) {
6107
- const fs8 = await import("fs/promises");
6107
+ const fs9 = await import("fs/promises");
6108
6108
  const { pathToFileURL: pathToFileURL5 } = await import("url");
6109
6109
  const root = import_path2.default.resolve(rootDir || process.cwd());
6110
6110
  const resolvedPath = await findDocsConfigPath(root, configPath);
6111
6111
  if (!resolvedPath) return void 0;
6112
6112
  try {
6113
6113
  if (resolvedPath.endsWith(".json")) {
6114
- const content = await fs8.readFile(resolvedPath, "utf8");
6114
+ const content = await fs9.readFile(resolvedPath, "utf8");
6115
6115
  return { config: JSON.parse(content), configPath: resolvedPath };
6116
6116
  }
6117
6117
  const { build: build2 } = await import("esbuild");
6118
6118
  const configCacheDir = import_path2.default.join(root, ".farm", ".config-loader");
6119
- await fs8.mkdir(configCacheDir, { recursive: true });
6119
+ await fs9.mkdir(configCacheDir, { recursive: true });
6120
6120
  const modulePath = import_path2.default.join(
6121
6121
  configCacheDir,
6122
6122
  `docs-config-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
@@ -6142,7 +6142,7 @@ async function loadDocsConfig(rootDir, configPath) {
6142
6142
  moduleUrl
6143
6143
  );
6144
6144
  } finally {
6145
- await fs8.unlink(modulePath).catch(() => void 0);
6145
+ await fs9.unlink(modulePath).catch(() => void 0);
6146
6146
  }
6147
6147
  return {
6148
6148
  config: importedConfig.default || importedConfig,
@@ -6333,7 +6333,7 @@ async function resolveConfig(userConfig, mode) {
6333
6333
  return resolved;
6334
6334
  }
6335
6335
  async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "production" ? "production" : "development", loadEnvironment) {
6336
- const { existsSync: existsSync17 } = await import("fs");
6336
+ const { existsSync: existsSync18 } = await import("fs");
6337
6337
  const loadEnv = loadEnvironment || (await import("vite")).loadEnv;
6338
6338
  const root = rootDir || process.cwd();
6339
6339
  const loadedEnv = loadEnv(mode, root, "");
@@ -6357,7 +6357,7 @@ async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "
6357
6357
  try {
6358
6358
  const absolutePath = relativePath2.startsWith("/") ? relativePath2 : import_path2.default.join(root, relativePath2);
6359
6359
  const normalizedPath = import_path2.default.resolve(absolutePath);
6360
- if (!existsSync17(normalizedPath)) {
6360
+ if (!existsSync18(normalizedPath)) {
6361
6361
  continue;
6362
6362
  }
6363
6363
  const loadedConfig = await loadFarmConfigFile(normalizedPath, { root });
@@ -6534,8 +6534,8 @@ function toViteModuleId(filePath, root) {
6534
6534
  }
6535
6535
  async function fileExists(filePath) {
6536
6536
  try {
6537
- const fs8 = await import("fs/promises");
6538
- await fs8.access(filePath);
6537
+ const fs9 = await import("fs/promises");
6538
+ await fs9.access(filePath);
6539
6539
  return true;
6540
6540
  } catch {
6541
6541
  return false;
@@ -7404,7 +7404,7 @@ function normalizePositiveDuration(value, fallback, name) {
7404
7404
  return Math.floor(value);
7405
7405
  }
7406
7406
  function delay(ms) {
7407
- return new Promise((resolve6) => setTimeout(resolve6, ms));
7407
+ return new Promise((resolve7) => setTimeout(resolve7, ms));
7408
7408
  }
7409
7409
  function normalizeCacheOptionsTags(options) {
7410
7410
  const tags = /* @__PURE__ */ new Set();
@@ -7964,7 +7964,7 @@ function getProgrammaticRouteSearchClientOptions(search) {
7964
7964
  if (search.temporary?.length) options.temporary = [...search.temporary];
7965
7965
  return Object.keys(options).length > 0 ? options : void 0;
7966
7966
  }
7967
- function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path31, routePath) {
7967
+ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path32, routePath) {
7968
7968
  const schema = getProgrammaticRouteSearchSchema(searchConfig);
7969
7969
  const search = parseProgrammaticSchema(schema, rawSearch, "search", routePath);
7970
7970
  const options = getProgrammaticRouteSearchOptions(searchConfig);
@@ -7973,7 +7973,7 @@ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path31, routePa
7973
7973
  schema,
7974
7974
  rawSearch,
7975
7975
  parsedSearch: search,
7976
- path: path31
7976
+ path: path32
7977
7977
  });
7978
7978
  return { search, canonicalPath };
7979
7979
  }
@@ -8140,7 +8140,7 @@ function createRouteModuleFromProgrammaticPage(route) {
8140
8140
  mod.__farmRouteData = route.data;
8141
8141
  mod.__farmRouteParsesProps = true;
8142
8142
  mod.__farmResolveRouteProps = (props) => resolveProgrammaticRouteProps(route, props);
8143
- mod.__farmResolveRouteCanonicalPath = (rawSearch, path31) => resolveProgrammaticRouteSearch(route.search, rawSearch, path31, route.path).canonicalPath;
8143
+ mod.__farmResolveRouteCanonicalPath = (rawSearch, path32) => resolveProgrammaticRouteSearch(route.search, rawSearch, path32, route.path).canonicalPath;
8144
8144
  }
8145
8145
  if (route.pending || route.error || route.notFound) {
8146
8146
  mod.__farmRouteComponents = {
@@ -8538,25 +8538,25 @@ var init_routes = __esm({
8538
8538
  ];
8539
8539
  __name(defineRoutes, "defineRoutes");
8540
8540
  routesBuilder = {
8541
- page(path31, options) {
8541
+ page(path32, options) {
8542
8542
  return normalizeProgrammaticRoute({
8543
8543
  kind: "page",
8544
- path: path31,
8544
+ path: path32,
8545
8545
  ...options
8546
8546
  });
8547
8547
  },
8548
- layout(path31, options) {
8548
+ layout(path32, options) {
8549
8549
  return normalizeProgrammaticRoute({
8550
8550
  kind: "layout",
8551
- path: path31,
8551
+ path: path32,
8552
8552
  ...options
8553
8553
  });
8554
8554
  },
8555
- api(path31, options) {
8555
+ api(path32, options) {
8556
8556
  const { render, runtime, regions, maxDuration, ...methods } = options;
8557
8557
  return normalizeProgrammaticRoute({
8558
8558
  kind: "api",
8559
- path: path31,
8559
+ path: path32,
8560
8560
  render,
8561
8561
  runtime,
8562
8562
  regions,
@@ -8926,6 +8926,35 @@ function getIslandStrategyExport(content) {
8926
8926
  function stripUseClientDirective(content) {
8927
8927
  return content.replace(/^\s*(["'])use client\1\s*;?\s*/, "");
8928
8928
  }
8929
+ function hasAsyncDefaultExport(content) {
8930
+ if (!content) return false;
8931
+ const tokens = tokenizeModuleSource(content);
8932
+ for (let index = 0; index < tokens.length - 2; index++) {
8933
+ const token = tokens[index];
8934
+ if (token.kind !== "identifier" || token.value !== "export") continue;
8935
+ if (tokens[index - 1]?.value === ".") continue;
8936
+ if (tokens[index + 1]?.value !== "default") continue;
8937
+ const exported = tokens[index + 2];
8938
+ if (exported.kind === "identifier" && exported.value === "async") {
8939
+ return true;
8940
+ }
8941
+ if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && tokens[index + 3]?.value !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
8942
+ return true;
8943
+ }
8944
+ }
8945
+ return false;
8946
+ }
8947
+ function isAsyncLocalDeclaration(tokens, name) {
8948
+ for (let index = 0; index < tokens.length - 2; index++) {
8949
+ if (tokens[index].value === "async" && tokens[index + 1]?.value === "function" && tokens[index + 2]?.value === name) {
8950
+ return true;
8951
+ }
8952
+ if (tokens[index].value === name && tokens[index + 1]?.value === "=" && tokens[index + 2]?.value === "async") {
8953
+ return true;
8954
+ }
8955
+ }
8956
+ return false;
8957
+ }
8929
8958
  function parseClientModuleMetadata(content, inspectIslandExport) {
8930
8959
  if (!content) {
8931
8960
  return {
@@ -8979,6 +9008,14 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
8979
9008
  }
8980
9009
  }
8981
9010
  const shouldHydrate = parsed.hasHydrateExport || importsClientBoundary;
9011
+ if (shouldHydrate && hasAsyncDefaultExport(content)) {
9012
+ return {
9013
+ isClientComponent: false,
9014
+ shouldHydrate: false,
9015
+ islandStrategy: null,
9016
+ suppressedAsyncHydration: true
9017
+ };
9018
+ }
8982
9019
  return {
8983
9020
  isClientComponent: false,
8984
9021
  shouldHydrate,
@@ -9279,6 +9316,8 @@ var init_client_component = __esm({
9279
9316
  __name(isIslandExportStart, "isIslandExportStart");
9280
9317
  __name(getIslandStrategyExport, "getIslandStrategyExport");
9281
9318
  __name(stripUseClientDirective, "stripUseClientDirective");
9319
+ __name(hasAsyncDefaultExport, "hasAsyncDefaultExport");
9320
+ __name(isAsyncLocalDeclaration, "isAsyncLocalDeclaration");
9282
9321
  __name(parseClientModuleMetadata, "parseClientModuleMetadata");
9283
9322
  __name(getClientModuleMetadata, "getClientModuleMetadata");
9284
9323
  __name(inspectClientModuleMetadata, "inspectClientModuleMetadata");
@@ -9839,6 +9878,7 @@ var init_route_manager = __esm({
9839
9878
  shouldHydrate: metadata.shouldHydrate,
9840
9879
  isClientComponent: metadata.isClientComponent,
9841
9880
  islandStrategy: metadata.islandStrategy,
9881
+ suppressedAsyncHydration: metadata.suppressedAsyncHydration,
9842
9882
  search: getProgrammaticRouteSearchClientOptions(programmaticPage?.search),
9843
9883
  segments: entry.route.segments.map((seg) => ({
9844
9884
  segment: seg.segment,
@@ -13159,6 +13199,13 @@ var init_server3 = __esm({
13159
13199
  });
13160
13200
 
13161
13201
  // src/server/renderer.ts
13202
+ function warnSuppressedAsyncHydrationOnce(modulePath) {
13203
+ if (warnedSuppressedAsyncHydrationModules.has(modulePath)) return;
13204
+ warnedSuppressedAsyncHydrationModules.add(modulePath);
13205
+ logger.warn(
13206
+ `${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.`
13207
+ );
13208
+ }
13162
13209
  function hasRequestHeader(req, name) {
13163
13210
  const value = req.headers[name.toLowerCase()];
13164
13211
  return Array.isArray(value) ? value.length > 0 : Boolean(value);
@@ -13313,7 +13360,7 @@ function createRouteStateProps(input) {
13313
13360
  context: input.pluginExposedContext.size > 0 ? { data: input.pluginExposedContext } : void 0
13314
13361
  };
13315
13362
  }
13316
- var import_react5, import_server2, fs2, path11, import_stream, cachedClerkProvider, importRuntimeModule, _FarmRouteErrorBoundary, FarmRouteErrorBoundary, _ServerRenderer, ServerRenderer;
13363
+ var import_react5, import_server2, fs2, path11, import_stream, cachedClerkProvider, importRuntimeModule, warnedSuppressedAsyncHydrationModules, _FarmRouteErrorBoundary, FarmRouteErrorBoundary, _ServerRenderer, ServerRenderer;
13317
13364
  var init_renderer = __esm({
13318
13365
  "src/server/renderer.ts"() {
13319
13366
  "use strict";
@@ -13347,6 +13394,8 @@ var init_renderer = __esm({
13347
13394
  init_server3();
13348
13395
  cachedClerkProvider = null;
13349
13396
  importRuntimeModule = new Function("specifier", "return import(specifier);");
13397
+ warnedSuppressedAsyncHydrationModules = /* @__PURE__ */ new Set();
13398
+ __name(warnSuppressedAsyncHydrationOnce, "warnSuppressedAsyncHydrationOnce");
13350
13399
  __name(hasRequestHeader, "hasRequestHeader");
13351
13400
  __name(serializeInlineValue2, "serializeInlineValue");
13352
13401
  __name(escapeHtmlAttribute2, "escapeHtmlAttribute");
@@ -13867,6 +13916,9 @@ var init_renderer = __esm({
13867
13916
  })
13868
13917
  );
13869
13918
  const shouldHydrate = moduleMetadata.shouldHydrate;
13919
+ if (moduleMetadata.suppressedAsyncHydration) {
13920
+ warnSuppressedAsyncHydrationOnce(route.modulePath);
13921
+ }
13870
13922
  const layoutHydrationMetadata = layouts.map((layout2) => {
13871
13923
  const manifestEntry = routeManifest.layouts.find(
13872
13924
  (entry) => entry.pattern === layout2.pattern
@@ -14364,7 +14416,7 @@ var init_renderer = __esm({
14364
14416
  }
14365
14417
  }
14366
14418
  async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
14367
- return new Promise((resolve6, reject) => {
14419
+ return new Promise((resolve7, reject) => {
14368
14420
  const streamStartTime = Date.now();
14369
14421
  const observabilityRoute = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
14370
14422
  const deploymentId = this.getDeploymentId();
@@ -14564,7 +14616,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
14564
14616
  route: observabilityRoute,
14565
14617
  durationMs: Date.now() - streamStartTime
14566
14618
  });
14567
- resolve6();
14619
+ resolve7();
14568
14620
  }
14569
14621
  });
14570
14622
  res.write(shell);
@@ -17547,11 +17599,11 @@ var init_type_generator = __esm({
17547
17599
  routeGroups.get(key).push(route);
17548
17600
  }
17549
17601
  const nestedStructure = {};
17550
- for (const [path31, routeList] of routeGroups) {
17602
+ for (const [path32, routeList] of routeGroups) {
17551
17603
  const route = routeList[0];
17552
17604
  const importPath = this.getRouteImportPath(route, options.outFile);
17553
17605
  const routeName = this.pathToRouteName(route.path);
17554
- const cleanPath = path31 === "/api" ? "" : path31.replace(/^\/api\//, "");
17606
+ const cleanPath = path32 === "/api" ? "" : path32.replace(/^\/api\//, "");
17555
17607
  const parts = cleanPath ? cleanPath.split("/") : [];
17556
17608
  const allMethods = routeList.flatMap((r) => r.methods);
17557
17609
  for (const method of allMethods) {
@@ -17610,8 +17662,8 @@ ${typeExports}
17610
17662
  const relativeImport = (0, import_path10.relative)((0, import_path10.dirname)(outFile), route.filePath).replace(/\\/g, "/").replace(/\.(ts|tsx|js|jsx)$/, "");
17611
17663
  return relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
17612
17664
  }
17613
- pathToRouteName(path31) {
17614
- return (path31 === "/api" ? "root" : path31.replace(/^\/api\//, "")).replace(/\//g, "_").replace(/[^a-zA-Z0-9_]/g, "");
17665
+ pathToRouteName(path32) {
17666
+ return (path32 === "/api" ? "root" : path32.replace(/^\/api\//, "")).replace(/\//g, "_").replace(/[^a-zA-Z0-9_]/g, "");
17615
17667
  }
17616
17668
  structureToTypeString(obj, indent) {
17617
17669
  const spaces = " ".repeat(indent);
@@ -17631,15 +17683,15 @@ ${typeExports}
17631
17683
  toTypePropertyKey(key) {
17632
17684
  return /^[$A-Z_][0-9A-Z_$]*$/i.test(key) ? key : JSON.stringify(key);
17633
17685
  }
17634
- getBaseExportName(path31) {
17635
- const cleanPath = path31.replace(/^\/api\//, "");
17686
+ getBaseExportName(path32) {
17687
+ const cleanPath = path32.replace(/^\/api\//, "");
17636
17688
  if (cleanPath === "") {
17637
17689
  return "api";
17638
17690
  }
17639
17691
  return cleanPath;
17640
17692
  }
17641
- getExportName(path31, method) {
17642
- const cleanPath = path31.replace(/^\/api\//, "");
17693
+ getExportName(path32, method) {
17694
+ const cleanPath = path32.replace(/^\/api\//, "");
17643
17695
  if (cleanPath === "") {
17644
17696
  return method.toLowerCase();
17645
17697
  }
@@ -18326,7 +18378,7 @@ var init_type_artifacts = __esm({
18326
18378
  var version;
18327
18379
  var init_package = __esm({
18328
18380
  "package.json"() {
18329
- version = "0.1.0-beta.23";
18381
+ version = "0.1.0-beta.24";
18330
18382
  }
18331
18383
  });
18332
18384
 
@@ -18363,8 +18415,8 @@ function reportAfterError(state, error) {
18363
18415
  function createAfterRequestState(reportError = defaultAfterErrorReporter) {
18364
18416
  let resolveResponseFinished;
18365
18417
  let responseFinished = false;
18366
- const responseFinishedPromise = new Promise((resolve6) => {
18367
- resolveResponseFinished = resolve6;
18418
+ const responseFinishedPromise = new Promise((resolve7) => {
18419
+ resolveResponseFinished = resolve7;
18368
18420
  });
18369
18421
  const state = {
18370
18422
  completion: Promise.resolve(),
@@ -18447,6 +18499,40 @@ var init_after = __esm({
18447
18499
  }
18448
18500
  });
18449
18501
 
18502
+ // src/dev-static.ts
18503
+ function devServableFileExists(pathname, baseDirs) {
18504
+ let decodedPathname;
18505
+ try {
18506
+ decodedPathname = decodeURIComponent(pathname);
18507
+ } catch {
18508
+ return false;
18509
+ }
18510
+ const relativePathname = decodedPathname.replace(/^\/+/, "");
18511
+ if (!relativePathname) return false;
18512
+ for (const baseDir of baseDirs) {
18513
+ if (typeof baseDir !== "string" || baseDir.length === 0) continue;
18514
+ const resolvedBase = path24.resolve(baseDir);
18515
+ const candidate = path24.resolve(resolvedBase, relativePathname);
18516
+ if (!candidate.startsWith(resolvedBase + path24.sep)) continue;
18517
+ try {
18518
+ if (fs7.existsSync(candidate) && fs7.statSync(candidate).isFile()) {
18519
+ return true;
18520
+ }
18521
+ } catch {
18522
+ }
18523
+ }
18524
+ return false;
18525
+ }
18526
+ var fs7, path24;
18527
+ var init_dev_static = __esm({
18528
+ "src/dev-static.ts"() {
18529
+ "use strict";
18530
+ fs7 = __toESM(require("fs"));
18531
+ path24 = __toESM(require("path"));
18532
+ __name(devServableFileExists, "devServableFileExists");
18533
+ }
18534
+ });
18535
+
18450
18536
  // src/image-vite.ts
18451
18537
  function farmImageImportsPlugin() {
18452
18538
  return {
@@ -23034,8 +23120,8 @@ var init_generator = __esm({
23034
23120
  }
23035
23121
  routeGroups.get(key).push(route);
23036
23122
  }
23037
- for (const [path31, routeList] of routeGroups) {
23038
- const openAPIPath = this.convertToOpenAPIPath(path31);
23123
+ for (const [path32, routeList] of routeGroups) {
23124
+ const openAPIPath = this.convertToOpenAPIPath(path32);
23039
23125
  spec.paths[openAPIPath] = {};
23040
23126
  for (const route of routeList) {
23041
23127
  for (const method of route.methods) {
@@ -23049,8 +23135,8 @@ var init_generator = __esm({
23049
23135
  /**
23050
23136
  * Convert Farm.js API path to OpenAPI path format
23051
23137
  */
23052
- convertToOpenAPIPath(path31) {
23053
- return path31.replace(/^\/api/, "");
23138
+ convertToOpenAPIPath(path32) {
23139
+ return path32.replace(/^\/api/, "");
23054
23140
  }
23055
23141
  /**
23056
23142
  * Extract request body schema from endpoint
@@ -23212,8 +23298,8 @@ var init_generator = __esm({
23212
23298
  /**
23213
23299
  * Generate operation summary
23214
23300
  */
23215
- generateSummary(path31, method) {
23216
- const cleanPath = path31.replace(/^\/api\//, "");
23301
+ generateSummary(path32, method) {
23302
+ const cleanPath = path32.replace(/^\/api\//, "");
23217
23303
  const pathParts = cleanPath.split("/");
23218
23304
  const lastPart = pathParts[pathParts.length - 1];
23219
23305
  const action = method === "GET" ? "Get" : method === "POST" ? "Create" : method === "PUT" ? "Update" : method === "DELETE" ? "Delete" : method === "PATCH" ? "Update" : method;
@@ -23222,22 +23308,22 @@ var init_generator = __esm({
23222
23308
  /**
23223
23309
  * Generate operation description
23224
23310
  */
23225
- generateDescription(path31, method) {
23226
- const cleanPath = path31.replace(/^\/api\//, "");
23311
+ generateDescription(path32, method) {
23312
+ const cleanPath = path32.replace(/^\/api\//, "");
23227
23313
  return `${method} ${cleanPath} endpoint`;
23228
23314
  }
23229
23315
  /**
23230
23316
  * Generate operation ID
23231
23317
  */
23232
- generateOperationId(path31, method) {
23233
- const cleanPath = path31.replace(/^\/api\//, "").replace(/\//g, "_");
23318
+ generateOperationId(path32, method) {
23319
+ const cleanPath = path32.replace(/^\/api\//, "").replace(/\//g, "_");
23234
23320
  return `${method.toLowerCase()}_${cleanPath}`;
23235
23321
  }
23236
23322
  /**
23237
23323
  * Generate tags for grouping operations
23238
23324
  */
23239
- generateTags(path31) {
23240
- const cleanPath = path31.replace(/^\/api\//, "");
23325
+ generateTags(path32) {
23326
+ const cleanPath = path32.replace(/^\/api\//, "");
23241
23327
  const pathParts = cleanPath.split("/");
23242
23328
  if (pathParts.length > 1) {
23243
23329
  return [pathParts[0]];
@@ -23249,13 +23335,13 @@ var init_generator = __esm({
23249
23335
  */
23250
23336
  async generateSpecFile(routes, outputPath) {
23251
23337
  const spec = await this.generateSpec(routes);
23252
- const fs8 = require("fs");
23253
- const path31 = require("path");
23254
- const dir = path31.dirname(outputPath);
23255
- if (!fs8.existsSync(dir)) {
23256
- fs8.mkdirSync(dir, { recursive: true });
23338
+ const fs9 = require("fs");
23339
+ const path32 = require("path");
23340
+ const dir = path32.dirname(outputPath);
23341
+ if (!fs9.existsSync(dir)) {
23342
+ fs9.mkdirSync(dir, { recursive: true });
23257
23343
  }
23258
- fs8.writeFileSync(outputPath, JSON.stringify(spec, null, 2));
23344
+ fs9.writeFileSync(outputPath, JSON.stringify(spec, null, 2));
23259
23345
  }
23260
23346
  };
23261
23347
  __name(_OpenAPIGenerator, "OpenAPIGenerator");
@@ -25543,18 +25629,18 @@ function isPotentialProgrammaticRouteSourceFile(normalizedFile, srcDirSlug) {
25543
25629
  return normalizedFile.startsWith(`${srcDirSlug}/`) && /\.(ts|tsx|js|jsx)$/.test(normalizedFile) && !normalizedFile.endsWith(".d.ts") && !normalizedFile.endsWith("/farm-routes.d.ts") && !normalizedFile.endsWith("/farm-env.d.ts") && !normalizedFile.endsWith("/lib/api.generated.ts");
25544
25630
  }
25545
25631
  function fileContainsProgrammaticPageRoute(file) {
25546
- if (!fs7.existsSync(file)) {
25632
+ if (!fs8.existsSync(file)) {
25547
25633
  return false;
25548
25634
  }
25549
25635
  try {
25550
- return scanProgrammaticPagePaths(fs7.readFileSync(file, "utf8")).length > 0;
25636
+ return scanProgrammaticPagePaths(fs8.readFileSync(file, "utf8")).length > 0;
25551
25637
  } catch {
25552
25638
  return false;
25553
25639
  }
25554
25640
  }
25555
25641
  function rewriteEarlySsrRelativeImports(options) {
25556
25642
  const cleanId = options.id.split("?", 1)[0];
25557
- if (!path27.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
25643
+ if (!path28.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
25558
25644
  return null;
25559
25645
  }
25560
25646
  const replacements = [];
@@ -25574,7 +25660,7 @@ function rewriteEarlySsrRelativeImports(options) {
25574
25660
  const suffixIndex = source.value.search(/[?#]/);
25575
25661
  const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
25576
25662
  const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
25577
- const resolvedPath = path27.resolve(path27.dirname(cleanId), sourcePath);
25663
+ const resolvedPath = path28.resolve(path28.dirname(cleanId), sourcePath);
25578
25664
  replacements.push({
25579
25665
  start: source.start,
25580
25666
  end: source.end,
@@ -25649,7 +25735,7 @@ function farmPlugin(options = {}, initialPluginManager) {
25649
25735
  ...layerRoots.length ? {
25650
25736
  server: {
25651
25737
  fs: {
25652
- allow: [path27.resolve(options.root || process.cwd()), ...layerRoots]
25738
+ allow: [path28.resolve(options.root || process.cwd()), ...layerRoots]
25653
25739
  }
25654
25740
  }
25655
25741
  } : {}
@@ -25680,13 +25766,13 @@ function farmPlugin(options = {}, initialPluginManager) {
25680
25766
  },
25681
25767
  server
25682
25768
  );
25683
- const globalsCSSPath = path27.join(server.config.root, "src/app/globals.css");
25684
- if (!fs7.existsSync(globalsCSSPath)) {
25685
- const appDir = path27.join(server.config.root, "src/app");
25686
- if (!fs7.existsSync(appDir)) {
25687
- fs7.mkdirSync(appDir, { recursive: true });
25769
+ const globalsCSSPath = path28.join(server.config.root, "src/app/globals.css");
25770
+ if (!fs8.existsSync(globalsCSSPath)) {
25771
+ const appDir = path28.join(server.config.root, "src/app");
25772
+ if (!fs8.existsSync(appDir)) {
25773
+ fs8.mkdirSync(appDir, { recursive: true });
25688
25774
  }
25689
- fs7.writeFileSync(globalsCSSPath, defaultGlobalCSS);
25775
+ fs8.writeFileSync(globalsCSSPath, defaultGlobalCSS);
25690
25776
  }
25691
25777
  await farmApp.initialize();
25692
25778
  const farmConfig = farmApp.getConfig();
@@ -25705,10 +25791,10 @@ function farmPlugin(options = {}, initialPluginManager) {
25705
25791
  });
25706
25792
  }
25707
25793
  const sourceRoots = getFarmSourceRoots(farmConfig);
25708
- server.watcher.add(sourceRoots.map((source) => path27.join(source.root, source.srcDir)));
25794
+ server.watcher.add(sourceRoots.map((source) => path28.join(source.root, source.srcDir)));
25709
25795
  if (farmConfig.i18n.enabled) {
25710
25796
  server.watcher.add(
25711
- farmConfig.i18n.messages.includes("{locale}") ? path27.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
25797
+ farmConfig.i18n.messages.includes("{locale}") ? path28.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
25712
25798
  );
25713
25799
  }
25714
25800
  const workflowConfig = farmConfig.workflows;
@@ -25718,7 +25804,7 @@ function farmPlugin(options = {}, initialPluginManager) {
25718
25804
  ...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
25719
25805
  ], "getExtraRouteTypes");
25720
25806
  const appDirSlugs = sourceRoots.map(
25721
- (source) => path27.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
25807
+ (source) => path28.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
25722
25808
  );
25723
25809
  const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
25724
25810
  try {
@@ -25758,7 +25844,7 @@ function farmPlugin(options = {}, initialPluginManager) {
25758
25844
  }, "generateTypeArtifacts");
25759
25845
  await generateTypeArtifacts("startup");
25760
25846
  const srcDirSlugs = sourceRoots.map(
25761
- (source) => path27.join(source.root, source.srcDir).replace(/\\/g, "/")
25847
+ (source) => path28.join(source.root, source.srcDir).replace(/\\/g, "/")
25762
25848
  );
25763
25849
  const layerConfigFiles = new Set(
25764
25850
  farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
@@ -25876,7 +25962,7 @@ function farmPlugin(options = {}, initialPluginManager) {
25876
25962
  await apiRouteManager.discoverRoutes();
25877
25963
  let discoveredWorkflows = [];
25878
25964
  const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
25879
- (dir) => fs7.existsSync(path27.isAbsolute(dir) ? dir : path27.join(farmConfig.root, dir))
25965
+ (dir) => fs8.existsSync(path28.isAbsolute(dir) ? dir : path28.join(farmConfig.root, dir))
25880
25966
  );
25881
25967
  if (hasWorkflowDirectory) {
25882
25968
  const { createFarmWorkflowRequestHandler: createFarmWorkflowRequestHandler2, discoverFarmWorkflows: discoverFarmWorkflows2 } = await loadFarmWorkflowsDevRuntime();
@@ -26110,12 +26196,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
26110
26196
  }
26111
26197
  }
26112
26198
  const farmDocsFontPath = farmDocsFontAssets.get(requestPathname);
26113
- if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath && fs7.existsSync(farmDocsFontPath)) {
26199
+ if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath && fs8.existsSync(farmDocsFontPath)) {
26114
26200
  res.statusCode = 200;
26115
26201
  res.setHeader("Content-Type", "font/woff2");
26116
26202
  res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
26117
26203
  if (requestMethod === "HEAD") res.end();
26118
- else fs7.createReadStream(farmDocsFontPath).pipe(res);
26204
+ else fs8.createReadStream(farmDocsFontPath).pipe(res);
26119
26205
  return;
26120
26206
  }
26121
26207
  if (requestMethod === "GET" && (requestPathname === FARM_DEVTOOLS_PATH || requestPathname === `${FARM_DEVTOOLS_PATH}.json`)) {
@@ -26213,7 +26299,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
26213
26299
  return null;
26214
26300
  }
26215
26301
  return {
26216
- source: await fs7.promises.readFile(sourcePath, "utf8"),
26302
+ source: await fs8.promises.readFile(sourcePath, "utf8"),
26217
26303
  filePath: sourcePath
26218
26304
  };
26219
26305
  }, "resolveSource")
@@ -26548,9 +26634,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
26548
26634
  res.end(JSON.stringify({ error: "API route not found", pathname: pathname2 }));
26549
26635
  return;
26550
26636
  }
26551
- if (req.url?.startsWith("/@") || req.url?.startsWith("/node_modules") || requestPathname.includes(".") && !requestPathname.endsWith(".html")) {
26637
+ if (req.url?.startsWith("/@") || req.url?.startsWith("/node_modules")) {
26552
26638
  return next();
26553
26639
  }
26640
+ if (requestPathname.includes(".") && !requestPathname.endsWith(".html")) {
26641
+ const matchesAppRoute = Boolean(
26642
+ farmApp?.getRouteManager()?.matchRoute(requestPathname)?.route
26643
+ );
26644
+ if (!matchesAppRoute || devServableFileExists(requestPathname, [server.config.publicDir, server.config.root])) {
26645
+ return next();
26646
+ }
26647
+ }
26554
26648
  if (req.url?.startsWith("/__farm/page-data")) {
26555
26649
  const urlObj = new URL(req.url, `http://${req.headers.host || "localhost:3000"}`);
26556
26650
  const targetPath = urlObj.searchParams.get("path") || "/";
@@ -27256,8 +27350,8 @@ if (import.meta.hot) {
27256
27350
  }
27257
27351
  logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
27258
27352
  logger.info("Pre-rendering SSG pages...");
27259
- const outDir = path27.join(server?.config.root || process.cwd(), options.outDir || "dist");
27260
- const clientDir = path27.join(outDir, "client");
27353
+ const outDir = path28.join(server?.config.root || process.cwd(), options.outDir || "dist");
27354
+ const clientDir = path28.join(outDir, "client");
27261
27355
  for (const page2 of ssgPages) {
27262
27356
  try {
27263
27357
  const staticRequest = new Request(new URL(page2.urlPath, "http://farm.static"));
@@ -27309,9 +27403,9 @@ if (import.meta.hot) {
27309
27403
  <script type="module" src="/assets/client.js"></script>
27310
27404
  </body>
27311
27405
  </html>`;
27312
- const outputPath = page2.urlPath === "/" ? path27.join(clientDir, "index.html") : path27.join(clientDir, page2.urlPath + ".html");
27313
- fs7.mkdirSync(path27.dirname(outputPath), { recursive: true });
27314
- fs7.writeFileSync(outputPath, fullHtml);
27406
+ const outputPath = page2.urlPath === "/" ? path28.join(clientDir, "index.html") : path28.join(clientDir, page2.urlPath + ".html");
27407
+ fs8.mkdirSync(path28.dirname(outputPath), { recursive: true });
27408
+ fs8.writeFileSync(outputPath, fullHtml);
27315
27409
  const revalidateInfo = page2.revalidate ? ` (revalidate: ${page2.revalidate}s)` : "";
27316
27410
  logger.success(` \u2713 ${page2.urlPath}${revalidateInfo}`);
27317
27411
  });
@@ -27319,8 +27413,8 @@ if (import.meta.hot) {
27319
27413
  logger.error(` \u2717 ${page2.urlPath}: ${error}`);
27320
27414
  }
27321
27415
  }
27322
- const manifestPath = path27.join(outDir, "__ssg_manifest.json");
27323
- fs7.writeFileSync(
27416
+ const manifestPath = path28.join(outDir, "__ssg_manifest.json");
27417
+ fs8.writeFileSync(
27324
27418
  manifestPath,
27325
27419
  JSON.stringify(
27326
27420
  ssgPages.map((p) => ({
@@ -27355,9 +27449,9 @@ if (import.meta.hot) {
27355
27449
  }
27356
27450
  const currentFarmConfig = farmApp?.getConfig();
27357
27451
  const normalizedFile = file.replace(/\\/g, "/");
27358
- const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path27.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
27452
+ const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path28.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
27359
27453
  if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
27360
- logUpdate("PAGE", `updated ${path27.basename(file)}`);
27454
+ logUpdate("PAGE", `updated ${path28.basename(file)}`);
27361
27455
  for (const mod of modules) {
27362
27456
  server2.moduleGraph.invalidateModule(mod);
27363
27457
  }
@@ -28537,6 +28631,19 @@ async function tryHydrateImportedPage(
28537
28631
  const PageComponent = pageModule?.default;
28538
28632
  if (!PageComponent) return false;
28539
28633
 
28634
+ if (
28635
+ typeof PageComponent === 'function' &&
28636
+ PageComponent.constructor &&
28637
+ PageComponent.constructor.name === 'AsyncFunction'
28638
+ ) {
28639
+ console.warn(
28640
+ '[Farm.js] Skipping hydration for ' + modulePath +
28641
+ ': async server components cannot run in the browser. ' +
28642
+ 'Server-rendered HTML is preserved; move interactive UI into a "use client" child of a synchronous page.'
28643
+ );
28644
+ return false;
28645
+ }
28646
+
28540
28647
  currentPageComponent = PageComponent;
28541
28648
  currentPageProps = await buildRouteComponentProps(
28542
28649
  pageModule,
@@ -29087,7 +29194,7 @@ function generateClientManifest(bundle) {
29087
29194
  }
29088
29195
  async function defineConfig2(config = {}) {
29089
29196
  const tailwindcss = (await import("@tailwindcss/vite")).default;
29090
- const appRoot = path27.resolve(config.root || process.cwd());
29197
+ const appRoot = path28.resolve(config.root || process.cwd());
29091
29198
  if (config.extends?.length) {
29092
29199
  const { config: layeredConfig } = await Promise.resolve().then(() => (init_layers(), layers_exports)).then(
29093
29200
  ({ resolveFarmLayers: resolveFarmLayers2 }) => resolveFarmLayers2(config, {
@@ -29294,7 +29401,7 @@ async function defineConfig2(config = {}) {
29294
29401
  }
29295
29402
  };
29296
29403
  }
29297
- var fs7, path27, ALL_TYPE_ARTIFACTS, createEmptyTypeArtifactSelection, FARM_I18N_CLIENT_BRIDGE_ID, EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, FARM_CONFIG_FILENAMES;
29404
+ var fs8, path28, ALL_TYPE_ARTIFACTS, createEmptyTypeArtifactSelection, FARM_I18N_CLIENT_BRIDGE_ID, EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, FARM_CONFIG_FILENAMES;
29298
29405
  var init_vite2 = __esm({
29299
29406
  "src/vite.ts"() {
29300
29407
  "use strict";
@@ -29313,13 +29420,14 @@ var init_vite2 = __esm({
29313
29420
  init_integrations();
29314
29421
  init_route_context();
29315
29422
  init_devtools_config();
29316
- fs7 = __toESM(require("fs"));
29317
- path27 = __toESM(require("path"));
29423
+ fs8 = __toESM(require("fs"));
29424
+ path28 = __toESM(require("path"));
29318
29425
  init_layers();
29319
29426
  init_environment_vite();
29320
29427
  init_version();
29321
29428
  init_deferred();
29322
29429
  init_after();
29430
+ init_dev_static();
29323
29431
  init_deployment();
29324
29432
  init_image_config();
29325
29433
  init_image_vite();
@@ -30859,10 +30967,10 @@ async function createFarmRouteRuntimeManifest(options) {
30859
30967
  }
30860
30968
  __name(createFarmRouteRuntimeManifest, "createFarmRouteRuntimeManifest");
30861
30969
  async function writeFarmRouteRuntimeManifest(directory, manifest) {
30862
- const fs8 = await import("fs/promises");
30970
+ const fs9 = await import("fs/promises");
30863
30971
  const manifestPath = import_path8.default.join(directory, FARM_ROUTE_RUNTIME_MANIFEST);
30864
- await fs8.mkdir(directory, { recursive: true });
30865
- await fs8.writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}
30972
+ await fs9.mkdir(directory, { recursive: true });
30973
+ await fs9.writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}
30866
30974
  `);
30867
30975
  return manifestPath;
30868
30976
  }
@@ -30908,7 +31016,7 @@ __name(normalizeManifestSource, "normalizeManifestSource");
30908
31016
  // src/nitro/vercel-route-runtime.ts
30909
31017
  var import_path9 = __toESM(require("path"));
30910
31018
  init_route_runtime();
30911
- async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs8) {
31019
+ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs9) {
30912
31020
  const dynamicRoutes = manifest.routes.filter(
30913
31021
  (route) => route.rendering === "dynamic" && route.runtime !== "edge"
30914
31022
  );
@@ -30939,8 +31047,8 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs8) {
30939
31047
  groupIndex += 1;
30940
31048
  const functionName = `__farm_runtime_${groupIndex}`;
30941
31049
  const functionDir = import_path9.default.join(functionsDir, `${functionName}.func`);
30942
- await fs8.cp(baseFunctionDir, functionDir, { recursive: true, force: true });
30943
- await configureVercelFunction(functionDir, group.config, fs8);
31050
+ await fs9.cp(baseFunctionDir, functionDir, { recursive: true, force: true });
31051
+ await configureVercelFunction(functionDir, group.config, fs9);
30944
31052
  destinations.set(key, `/${functionName}`);
30945
31053
  }
30946
31054
  const routes = [];
@@ -30987,15 +31095,15 @@ function farmRoutePatternToVercelSource(pattern) {
30987
31095
  return source || "/";
30988
31096
  }
30989
31097
  __name(farmRoutePatternToVercelSource, "farmRoutePatternToVercelSource");
30990
- async function configureVercelFunction(functionDir, config, fs8) {
31098
+ async function configureVercelFunction(functionDir, config, fs9) {
30991
31099
  const configPath = import_path9.default.join(functionDir, ".vc-config.json");
30992
- const current = JSON.parse(await fs8.readFile(configPath, "utf8"));
31100
+ const current = JSON.parse(await fs9.readFile(configPath, "utf8"));
30993
31101
  const next = {
30994
31102
  ...current,
30995
31103
  ...config.regions?.length ? { regions: config.regions } : {},
30996
31104
  ...config.maxDuration ? { maxDuration: config.maxDuration } : {}
30997
31105
  };
30998
- await fs8.writeFile(configPath, `${JSON.stringify(next, null, 2)}
31106
+ await fs9.writeFile(configPath, `${JSON.stringify(next, null, 2)}
30999
31107
  `);
31000
31108
  }
31001
31109
  __name(configureVercelFunction, "configureVercelFunction");
@@ -31637,7 +31745,7 @@ function hasProjectPostcssConfig(root) {
31637
31745
  }
31638
31746
  __name(hasProjectPostcssConfig, "hasProjectPostcssConfig");
31639
31747
  async function findFarmConfigPath(root) {
31640
- const fs8 = await import("fs/promises");
31748
+ const fs9 = await import("fs/promises");
31641
31749
  const candidates = [
31642
31750
  "farm.config.ts",
31643
31751
  "farm.config.mts",
@@ -31651,7 +31759,7 @@ async function findFarmConfigPath(root) {
31651
31759
  for (const candidate of candidates) {
31652
31760
  const resolvedPath = import_path12.default.join(root, candidate);
31653
31761
  try {
31654
- await fs8.access(resolvedPath);
31762
+ await fs9.access(resolvedPath);
31655
31763
  return resolvedPath;
31656
31764
  } catch {
31657
31765
  }
@@ -31678,13 +31786,13 @@ function hasFarmServerRuntimePlugins(config) {
31678
31786
  }
31679
31787
  __name(hasFarmServerRuntimePlugins, "hasFarmServerRuntimePlugins");
31680
31788
  async function discoverMiddlewareRoutes(appDir) {
31681
- const fs8 = await import("fs/promises");
31789
+ const fs9 = await import("fs/promises");
31682
31790
  const appDirs = Array.isArray(appDir) ? [...appDir] : [appDir];
31683
31791
  const routes = /* @__PURE__ */ new Map();
31684
31792
  async function walk(dir, routePath, discovered) {
31685
31793
  let entries;
31686
31794
  try {
31687
- entries = await fs8.readdir(dir, { withFileTypes: true });
31795
+ entries = await fs9.readdir(dir, { withFileTypes: true });
31688
31796
  } catch {
31689
31797
  return;
31690
31798
  }
@@ -31765,12 +31873,12 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
31765
31873
  })
31766
31874
  );
31767
31875
  logger.info(`\u{1F4CB} Found ${pageRoutes.length} page routes`);
31768
- const fs8 = await import("fs/promises");
31876
+ const fs9 = await import("fs/promises");
31769
31877
  const layoutRoutes = [];
31770
31878
  const appDir = import_path12.default.join(root, srcDir, "app");
31771
31879
  async function findLayoutsForClient(dir, routePrefix = "/") {
31772
31880
  try {
31773
- const entries = await fs8.readdir(dir, { withFileTypes: true });
31881
+ const entries = await fs9.readdir(dir, { withFileTypes: true });
31774
31882
  for (const entry of entries) {
31775
31883
  if (entry.isFile() && entry.name.match(/^layout\.(tsx?|jsx?)$/)) {
31776
31884
  layoutRoutes.push({
@@ -31904,7 +32012,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
31904
32012
  }
31905
32013
  __name(buildUniversal, "buildUniversal");
31906
32014
  async function writeSSRAssetsToClient(bundle, outputDir) {
31907
- const fs8 = await import("fs/promises");
32015
+ const fs9 = await import("fs/promises");
31908
32016
  for (const [fileName, output] of Object.entries(bundle)) {
31909
32017
  if (output.type !== "asset") continue;
31910
32018
  if (fileName === "farm-fonts.css") {
@@ -31912,29 +32020,29 @@ async function writeSSRAssetsToClient(bundle, outputDir) {
31912
32020
  continue;
31913
32021
  }
31914
32022
  const filePath = import_path12.default.join(outputDir, fileName);
31915
- await fs8.mkdir(import_path12.default.dirname(filePath), { recursive: true });
31916
- await fs8.writeFile(filePath, output.source);
32023
+ await fs9.mkdir(import_path12.default.dirname(filePath), { recursive: true });
32024
+ await fs9.writeFile(filePath, output.source);
31917
32025
  }
31918
32026
  }
31919
32027
  __name(writeSSRAssetsToClient, "writeSSRAssetsToClient");
31920
32028
  async function copyFarmDocsFontAssetsToClient(root, outputDir) {
31921
- const fs8 = await import("fs/promises");
32029
+ const fs9 = await import("fs/promises");
31922
32030
  await Promise.all(
31923
32031
  resolveFarmDocsFontAssets(root).map(async ({ sourcePath, url }) => {
31924
32032
  const targetPath = import_path12.default.join(outputDir, url.replace(/^\/+/, ""));
31925
- await fs8.mkdir(import_path12.default.dirname(targetPath), { recursive: true });
31926
- await fs8.copyFile(sourcePath, targetPath);
32033
+ await fs9.mkdir(import_path12.default.dirname(targetPath), { recursive: true });
32034
+ await fs9.copyFile(sourcePath, targetPath);
31927
32035
  })
31928
32036
  );
31929
32037
  }
31930
32038
  __name(copyFarmDocsFontAssetsToClient, "copyFarmDocsFontAssetsToClient");
31931
32039
  async function mergeBuiltFontCss(outputDir, fontCssSource) {
31932
- const fs8 = await import("fs/promises");
32040
+ const fs9 = await import("fs/promises");
31933
32041
  const fontCssPath = import_path12.default.join(outputDir, "farm-fonts.css");
31934
32042
  let fontCss = fontCssSource;
31935
32043
  if (fontCss === void 0) {
31936
32044
  try {
31937
- fontCss = await fs8.readFile(fontCssPath);
32045
+ fontCss = await fs9.readFile(fontCssPath);
31938
32046
  } catch {
31939
32047
  return;
31940
32048
  }
@@ -31942,12 +32050,12 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
31942
32050
  const clientCssPath = import_path12.default.join(outputDir, "farm-client.css");
31943
32051
  let clientCss = "";
31944
32052
  try {
31945
- clientCss = await fs8.readFile(clientCssPath, "utf8");
32053
+ clientCss = await fs9.readFile(clientCssPath, "utf8");
31946
32054
  } catch {
31947
32055
  }
31948
32056
  const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
31949
- await fs8.writeFile(fontCssPath, normalizedFontCss);
31950
- await fs8.writeFile(clientCssPath, mergeFarmFontCss(clientCss, normalizedFontCss));
32057
+ await fs9.writeFile(fontCssPath, normalizedFontCss);
32058
+ await fs9.writeFile(clientCssPath, mergeFarmFontCss(clientCss, normalizedFontCss));
31951
32059
  }
31952
32060
  __name(mergeBuiltFontCss, "mergeBuiltFontCss");
31953
32061
  var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
@@ -31959,11 +32067,11 @@ var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError
31959
32067
  __name(_IncompleteClientBuildOutputError, "IncompleteClientBuildOutputError");
31960
32068
  var IncompleteClientBuildOutputError = _IncompleteClientBuildOutputError;
31961
32069
  async function validateClientBuildOutput(root, srcDir, outputDir) {
31962
- const fs8 = await import("fs/promises");
32070
+ const fs9 = await import("fs/promises");
31963
32071
  const clientEntryPath = import_path12.default.join(outputDir, "farm-client.js");
31964
32072
  let clientEntrySize = 0;
31965
32073
  try {
31966
- const clientEntry = await fs8.stat(clientEntryPath);
32074
+ const clientEntry = await fs9.stat(clientEntryPath);
31967
32075
  if (clientEntry.isFile()) clientEntrySize = clientEntry.size;
31968
32076
  } catch {
31969
32077
  }
@@ -31974,12 +32082,12 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
31974
32082
  const globalsCssPath = import_path12.default.join(root, srcDir, "app", "globals.css");
31975
32083
  let expectsCss = false;
31976
32084
  try {
31977
- const globalsCss = await fs8.readFile(globalsCssPath, "utf8");
32085
+ const globalsCss = await fs9.readFile(globalsCssPath, "utf8");
31978
32086
  expectsCss = globalsCss.replace(/\/\*[\s\S]*?\*\//g, "").trim().length > 0;
31979
32087
  } catch {
31980
32088
  }
31981
32089
  try {
31982
- const clientCss = await fs8.stat(clientCssPath);
32090
+ const clientCss = await fs9.stat(clientCssPath);
31983
32091
  if (expectsCss && (!clientCss.isFile() || clientCss.size === 0)) {
31984
32092
  throw new IncompleteClientBuildOutputError("farm-client.css is empty");
31985
32093
  }
@@ -31988,7 +32096,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
31988
32096
  if (expectsCss) {
31989
32097
  throw new IncompleteClientBuildOutputError("farm-client.css is missing");
31990
32098
  }
31991
- await fs8.writeFile(clientCssPath, "");
32099
+ await fs9.writeFile(clientCssPath, "");
31992
32100
  }
31993
32101
  }
31994
32102
  __name(validateClientBuildOutput, "validateClientBuildOutput");
@@ -31996,7 +32104,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
31996
32104
  const viteBuild = productionVite.build;
31997
32105
  const { farmPlugin: farmPlugin2 } = await Promise.resolve().then(() => (init_vite2(), vite_exports));
31998
32106
  const { PluginManager: PluginManager2 } = await Promise.resolve().then(() => (init_plugin(), plugin_exports));
31999
- const fs8 = await import("fs/promises");
32107
+ const fs9 = await import("fs/promises");
32000
32108
  const pluginManager = new PluginManager2({
32001
32109
  config,
32002
32110
  isDev: false,
@@ -32032,6 +32140,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
32032
32140
  const applicableClientLayouts = clientLayouts.filter(
32033
32141
  (layout2) => layout2.shouldHydrate && layoutAppliesToRoute(layout2.pattern, route.pattern)
32034
32142
  );
32143
+ if (metadata.suppressedAsyncHydration) {
32144
+ logger.warn(
32145
+ `\u26A0\uFE0F ${route.pattern} is an async server component that imports client components; React cannot hydrate async components, so the route stays server-rendered and its client imports are not interactive.`
32146
+ );
32147
+ }
32035
32148
  if (metadata.shouldHydrate || applicableClientLayouts.length > 0) {
32036
32149
  const relativePath2 = route.modulePath.replace(root, "").replace(/^\//, "");
32037
32150
  const hydrationStrategies = [
@@ -32090,8 +32203,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
32090
32203
  `\u{1F4F1} Total hydratable routes detected: ${clientPages.length} pages, ${clientLayouts.filter((layout2) => layout2.shouldHydrate).length} layouts, and ${clientRouteSlots.length} slots`
32091
32204
  );
32092
32205
  const clientEntryRoot = import_path12.default.join(root, ".farm", "tmp");
32093
- await fs8.mkdir(clientEntryRoot, { recursive: true });
32094
- const clientEntryDir = await fs8.mkdtemp(import_path12.default.join(clientEntryRoot, "client-entry-"));
32206
+ await fs9.mkdir(clientEntryRoot, { recursive: true });
32207
+ const clientEntryDir = await fs9.mkdtemp(import_path12.default.join(clientEntryRoot, "client-entry-"));
32095
32208
  const clientEntryPath = import_path12.default.join(clientEntryDir, "farm-client-entry.tsx");
32096
32209
  const clientHydrationCode = generateClientHydrationEntry(
32097
32210
  clientPages,
@@ -32105,7 +32218,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
32105
32218
  config.i18n,
32106
32219
  config.plugins
32107
32220
  );
32108
- await fs8.writeFile(clientEntryPath, clientHydrationCode);
32221
+ await fs9.writeFile(clientEntryPath, clientHydrationCode);
32109
32222
  const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
32110
32223
  let postcssSearchPath;
32111
32224
  let tailwindVitePlugin = void 0;
@@ -32113,7 +32226,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
32113
32226
  logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
32114
32227
  } else {
32115
32228
  const postcssConfigPath = import_path12.default.join(clientEntryDir, "postcss.config.cjs");
32116
- await fs8.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
32229
+ await fs9.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
32117
32230
  postcssSearchPath = clientEntryDir;
32118
32231
  try {
32119
32232
  const tailwindVite = (await import("@tailwindcss/vite")).default;
@@ -32258,7 +32371,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
32258
32371
  await validateClientBuildOutput(root, srcDir, outputDir);
32259
32372
  } finally {
32260
32373
  try {
32261
- await fs8.rm(clientEntryDir, { recursive: true, force: true });
32374
+ await fs9.rm(clientEntryDir, { recursive: true, force: true });
32262
32375
  } catch {
32263
32376
  }
32264
32377
  }
@@ -32909,6 +33022,13 @@ async function createMatchedHydrationElement(matched, pathname, searchParams) {
32909
33022
  if (matched.route.pageShouldHydrate) {
32910
33023
  const Component = await loadRouteComponent(matched.route);
32911
33024
  if (!Component) return null;
33025
+ if (typeof Component === "function" && Component.constructor && Component.constructor.name === "AsyncFunction") {
33026
+ console.warn(
33027
+ "[Farm.js] Skipping hydration for " + pathname +
33028
+ ": async server components cannot run in the browser. Server-rendered HTML is preserved."
33029
+ );
33030
+ return null;
33031
+ }
32912
33032
  const props = { params: params, searchParams: Promise.resolve(searchParams) };
32913
33033
  pageElement = React.createElement(Component, props);
32914
33034
  } else if (hydrateLayouts) {
@@ -33566,7 +33686,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
33566
33686
  const viteBuild = productionVite.build;
33567
33687
  const { farmPlugin: farmPlugin2 } = await Promise.resolve().then(() => (init_vite2(), vite_exports));
33568
33688
  const { PluginManager: PluginManager2 } = await Promise.resolve().then(() => (init_plugin(), plugin_exports));
33569
- const fs8 = await import("fs/promises");
33689
+ const fs9 = await import("fs/promises");
33570
33690
  const pluginManager = new PluginManager2({
33571
33691
  config,
33572
33692
  isDev: false,
@@ -33577,8 +33697,8 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
33577
33697
  let postcssConfigDir;
33578
33698
  let tailwindVitePlugin = void 0;
33579
33699
  if (!hasScopedPostcssConfig) {
33580
- postcssConfigDir = await fs8.mkdtemp(import_path12.default.join(import_os.default.tmpdir(), "farm-postcss-"));
33581
- await fs8.writeFile(
33700
+ postcssConfigDir = await fs9.mkdtemp(import_path12.default.join(import_os.default.tmpdir(), "farm-postcss-"));
33701
+ await fs9.writeFile(
33582
33702
  import_path12.default.join(postcssConfigDir, "postcss.config.cjs"),
33583
33703
  "module.exports = { plugins: [] };\n"
33584
33704
  );
@@ -33608,7 +33728,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
33608
33728
  fileName: entry.fileName,
33609
33729
  sourceType: "static",
33610
33730
  staticInfo: entry.staticInfo,
33611
- data: (await fs8.readFile(entry.modulePath)).toString("base64")
33731
+ data: (await fs9.readFile(entry.modulePath)).toString("base64")
33612
33732
  });
33613
33733
  continue;
33614
33734
  }
@@ -33658,7 +33778,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
33658
33778
  for (const ext of notFoundExtensions) {
33659
33779
  const checkPath = import_path12.default.join(sourceAppDir, `not-found${ext}`);
33660
33780
  try {
33661
- await fs8.access(checkPath);
33781
+ await fs9.access(checkPath);
33662
33782
  notFoundPath = checkPath;
33663
33783
  break;
33664
33784
  } catch {
@@ -33870,7 +33990,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
33870
33990
  } finally {
33871
33991
  if (postcssConfigDir) {
33872
33992
  try {
33873
- await fs8.rm(postcssConfigDir, { recursive: true, force: true });
33993
+ await fs9.rm(postcssConfigDir, { recursive: true, force: true });
33874
33994
  } catch {
33875
33995
  }
33876
33996
  }
@@ -36765,7 +36885,7 @@ function getPhysicalPrerenderBypassReason(options) {
36765
36885
  }
36766
36886
  __name(getPhysicalPrerenderBypassReason, "getPhysicalPrerenderBypassReason");
36767
36887
  async function buildNitroUniversal(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, ssrBundle, ssrEntryFile, clientOutputDir, routeRuntimeManifest, configuredHeaderRoutes, nitroRuntimeResultPromise, pluginManager) {
36768
- const [fs8, nitroRuntimeResult] = await Promise.all([
36888
+ const [fs9, nitroRuntimeResult] = await Promise.all([
36769
36889
  import("fs/promises"),
36770
36890
  nitroRuntimeResultPromise
36771
36891
  ]);
@@ -36843,11 +36963,11 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
36843
36963
  }
36844
36964
  const scheduledTasks = mergeScheduledTasks(farmWorkflows.scheduledTasks, farmCron.scheduledTasks);
36845
36965
  const cloudflareCronConfig = createFarmCronCloudflareConfig(farmCron.jobs);
36846
- await fs8.mkdir(ssrOutputDir, { recursive: true });
36966
+ await fs9.mkdir(ssrOutputDir, { recursive: true });
36847
36967
  for (const [fileName, output] of Object.entries(ssrBundle)) {
36848
36968
  const filePath = import_path12.default.join(ssrOutputDir, fileName);
36849
- await fs8.mkdir(import_path12.default.dirname(filePath), { recursive: true });
36850
- await fs8.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
36969
+ await fs9.mkdir(import_path12.default.dirname(filePath), { recursive: true });
36970
+ await fs9.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
36851
36971
  }
36852
36972
  const nitroEntryPath = import_path12.default.join(ssrOutputDir, "nitro-entry.mjs");
36853
36973
  const nitroEntryCode = `
@@ -36913,10 +37033,10 @@ export default async function farmNitroEventHandler(event) {
36913
37033
  return response
36914
37034
  }
36915
37035
  `.trim();
36916
- await fs8.writeFile(nitroEntryPath, nitroEntryCode);
37036
+ await fs9.writeFile(nitroEntryPath, nitroEntryCode);
36917
37037
  const farmNodeServerEntryPath = preset === "node-server" ? import_path12.default.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
36918
37038
  if (farmNodeServerEntryPath) {
36919
- await fs8.writeFile(
37039
+ await fs9.writeFile(
36920
37040
  farmNodeServerEntryPath,
36921
37041
  createFarmNodeServerEntry({
36922
37042
  nitroEntryFile: import_path12.default.basename(nitroEntryPath),
@@ -37116,9 +37236,9 @@ export default async function farmNitroEventHandler(event) {
37116
37236
  import_path12.default.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
37117
37237
  {},
37118
37238
  false,
37119
- fs8
37239
+ fs9
37120
37240
  );
37121
- await registerPrebuiltSSRPackageImport(prerenderServerDir, ssrEntryFile, fs8);
37241
+ await registerPrebuiltSSRPackageImport(prerenderServerDir, ssrEntryFile, fs9);
37122
37242
  });
37123
37243
  });
37124
37244
  }
@@ -37150,17 +37270,17 @@ export default async function farmNitroEventHandler(event) {
37150
37270
  import_path12.default.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
37151
37271
  configuredEsbuildOptions,
37152
37272
  effectiveMinify,
37153
- fs8
37273
+ fs9
37154
37274
  ) : Promise.resolve(),
37155
- imageRuntime === "node" ? copySharpRuntime(config, root, import_path12.default.join(outputDir, "server"), fs8) : Promise.resolve(),
37156
- useExternalMetadataImageRuntime ? copyMetadataImageRuntime(root, import_path12.default.join(outputDir, "server"), fs8) : Promise.resolve()
37275
+ imageRuntime === "node" ? copySharpRuntime(config, root, import_path12.default.join(outputDir, "server"), fs9) : Promise.resolve(),
37276
+ useExternalMetadataImageRuntime ? copyMetadataImageRuntime(root, import_path12.default.join(outputDir, "server"), fs9) : Promise.resolve()
37157
37277
  ]);
37158
37278
  const failedCopy = copyResults.find(
37159
37279
  (result) => result.status === "rejected"
37160
37280
  );
37161
37281
  if (failedCopy) throw failedCopy.reason;
37162
37282
  if (canReusePrebuiltSSR) {
37163
- await registerPrebuiltSSRPackageImport(import_path12.default.join(outputDir, "server"), ssrEntryFile, fs8);
37283
+ await registerPrebuiltSSRPackageImport(import_path12.default.join(outputDir, "server"), ssrEntryFile, fs9);
37164
37284
  logger.info("\u26A1 Reused Farm's prebuilt SSR bundle for the Node output");
37165
37285
  }
37166
37286
  if (useRolldownBuilder) {
@@ -37175,12 +37295,12 @@ export default async function farmNitroEventHandler(event) {
37175
37295
  });
37176
37296
  }
37177
37297
  if (isVercel) {
37178
- await postProcessVercelOutput(root, outputDir, fs8, config, farmWorkflows, routeRuntimeManifest);
37298
+ await postProcessVercelOutput(root, outputDir, fs9, config, farmWorkflows, routeRuntimeManifest);
37179
37299
  }
37180
37300
  logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
37181
37301
  }
37182
37302
  __name(buildNitroUniversal, "buildNitroUniversal");
37183
- async function copyPrebuiltSSRBundle(ssrBundle, targetDir, configuredEsbuildOptions, minify, fs8) {
37303
+ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, configuredEsbuildOptions, minify, fs9) {
37184
37304
  const {
37185
37305
  include: _include,
37186
37306
  exclude: _exclude,
@@ -37197,13 +37317,13 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, configuredEsbuildOpti
37197
37317
  "node18"
37198
37318
  );
37199
37319
  const transform = minify || hasConfiguredTransforms ? (await import("esbuild")).transform : null;
37200
- await fs8.rm(targetDir, { recursive: true, force: true });
37320
+ await fs9.rm(targetDir, { recursive: true, force: true });
37201
37321
  await Promise.all(
37202
37322
  Object.entries(ssrBundle).map(async ([fileName, output]) => {
37203
37323
  const targetPath = import_path12.default.join(targetDir, fileName);
37204
- await fs8.mkdir(import_path12.default.dirname(targetPath), { recursive: true });
37324
+ await fs9.mkdir(import_path12.default.dirname(targetPath), { recursive: true });
37205
37325
  if (output.type === "asset") {
37206
- await fs8.writeFile(targetPath, output.source);
37326
+ await fs9.writeFile(targetPath, output.source);
37207
37327
  return;
37208
37328
  }
37209
37329
  let code = output.code;
@@ -37214,14 +37334,14 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, configuredEsbuildOpti
37214
37334
  });
37215
37335
  code = result.code;
37216
37336
  }
37217
- await fs8.writeFile(targetPath, code);
37337
+ await fs9.writeFile(targetPath, code);
37218
37338
  })
37219
37339
  );
37220
37340
  }
37221
37341
  __name(copyPrebuiltSSRBundle, "copyPrebuiltSSRBundle");
37222
- async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs8) {
37342
+ async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs9) {
37223
37343
  const packagePath = import_path12.default.join(serverDir, "package.json");
37224
- const packageJSON = await fs8.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
37344
+ const packageJSON = await fs9.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
37225
37345
  if (error.code === "ENOENT") return { type: "module" };
37226
37346
  throw error;
37227
37347
  });
@@ -37231,38 +37351,38 @@ async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs8) {
37231
37351
  ...existingImports,
37232
37352
  [FARM_SSR_PACKAGE_IMPORT]: `./${outputEntry}`
37233
37353
  };
37234
- await fs8.mkdir(serverDir, { recursive: true });
37235
- await fs8.writeFile(packagePath, `${JSON.stringify(packageJSON, null, 2)}
37354
+ await fs9.mkdir(serverDir, { recursive: true });
37355
+ await fs9.writeFile(packagePath, `${JSON.stringify(packageJSON, null, 2)}
37236
37356
  `);
37237
37357
  }
37238
37358
  __name(registerPrebuiltSSRPackageImport, "registerPrebuiltSSRPackageImport");
37239
- async function postProcessVercelOutput(root, outputDir, fs8, config, farmWorkflows, routeRuntimeManifest) {
37359
+ async function postProcessVercelOutput(root, outputDir, fs9, config, farmWorkflows, routeRuntimeManifest) {
37240
37360
  const serverDir = import_path12.default.join(outputDir, "server");
37241
37361
  const functionsDir = import_path12.default.join(outputDir, "functions");
37242
37362
  const nitroFuncDir = import_path12.default.join(functionsDir, "__nitro.func");
37243
37363
  const staticDir = import_path12.default.join(outputDir, "static");
37244
37364
  const publicDir = import_path12.default.join(outputDir, "public");
37245
- await fs8.mkdir(nitroFuncDir, { recursive: true });
37246
- const serverContents = await fs8.readdir(serverDir);
37365
+ await fs9.mkdir(nitroFuncDir, { recursive: true });
37366
+ const serverContents = await fs9.readdir(serverDir);
37247
37367
  for (const file of serverContents) {
37248
37368
  const src = import_path12.default.join(serverDir, file);
37249
37369
  const dest = import_path12.default.join(nitroFuncDir, file);
37250
- await fs8.rename(src, dest);
37370
+ await fs9.rename(src, dest);
37251
37371
  }
37252
- await fs8.rmdir(serverDir);
37372
+ await fs9.rmdir(serverDir);
37253
37373
  try {
37254
- await fs8.rename(publicDir, staticDir);
37374
+ await fs9.rename(publicDir, staticDir);
37255
37375
  } catch {
37256
37376
  }
37257
- await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs8);
37258
- await copyPrismaClientForVercel(root, nitroFuncDir, fs8);
37377
+ await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs9);
37378
+ await copyPrismaClientForVercel(root, nitroFuncDir, fs9);
37259
37379
  const configPath = import_path12.default.join(outputDir, "config.json");
37260
- const configContent = await fs8.readFile(configPath, "utf-8");
37380
+ const configContent = await fs9.readFile(configPath, "utf-8");
37261
37381
  const vercelConfig = JSON.parse(configContent);
37262
37382
  const runtimeRoutes = await createFarmVercelRouteRuntimeFunctions(
37263
37383
  outputDir,
37264
37384
  routeRuntimeManifest,
37265
- fs8
37385
+ fs9
37266
37386
  );
37267
37387
  vercelConfig.routes = [
37268
37388
  // Apply the header before the filesystem handler. `continue` lets Vercel
@@ -37297,24 +37417,24 @@ async function postProcessVercelOutput(root, outputDir, fs8, config, farmWorkflo
37297
37417
  vercelConfigWithWorkflowCrons,
37298
37418
  config.cron.jobs
37299
37419
  );
37300
- await fs8.writeFile(configPath, JSON.stringify(vercelConfigWithCrons, null, 2));
37420
+ await fs9.writeFile(configPath, JSON.stringify(vercelConfigWithCrons, null, 2));
37301
37421
  logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
37302
37422
  }
37303
37423
  __name(postProcessVercelOutput, "postProcessVercelOutput");
37304
- async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs8) {
37424
+ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs9) {
37305
37425
  const docsContentDir = resolveBuildDocsContentDir(config, root);
37306
37426
  if (!docsContentDir) return;
37307
37427
  const bundledContentDir = import_path12.default.join(nitroFuncDir, "chunks", "nitro", "farm-docs-content");
37308
37428
  const lastModifiedManifest = createFarmDocsLastModifiedManifest(docsContentDir, {
37309
37429
  fallback: "now"
37310
37430
  });
37311
- await fs8.rm(bundledContentDir, { recursive: true, force: true });
37312
- await fs8.mkdir(import_path12.default.dirname(bundledContentDir), { recursive: true });
37313
- await fs8.cp(docsContentDir, bundledContentDir, {
37431
+ await fs9.rm(bundledContentDir, { recursive: true, force: true });
37432
+ await fs9.mkdir(import_path12.default.dirname(bundledContentDir), { recursive: true });
37433
+ await fs9.cp(docsContentDir, bundledContentDir, {
37314
37434
  recursive: true,
37315
37435
  force: true
37316
37436
  });
37317
- await fs8.writeFile(
37437
+ await fs9.writeFile(
37318
37438
  import_path12.default.join(bundledContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST),
37319
37439
  `${JSON.stringify(lastModifiedManifest, null, 2)}
37320
37440
  `
@@ -37322,7 +37442,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs8) {
37322
37442
  logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${import_path12.default.relative(root, docsContentDir)}`);
37323
37443
  }
37324
37444
  __name(copyFarmDocsContentForVercel, "copyFarmDocsContentForVercel");
37325
- async function copySharpRuntime(config, root, nitroFuncDir, fs8) {
37445
+ async function copySharpRuntime(config, root, nitroFuncDir, fs9) {
37326
37446
  if (config.images.provider === "none") return;
37327
37447
  const projectRequire = (0, import_module2.createRequire)(import_path12.default.join(root, "package.json"));
37328
37448
  let sharpRequire = projectRequire;
@@ -37346,18 +37466,18 @@ async function copySharpRuntime(config, root, nitroFuncDir, fs8) {
37346
37466
  async function copyPackageOnce(packageName, parentRequire) {
37347
37467
  const packageJsonPath = resolvePackageJson(parentRequire, packageName);
37348
37468
  if (!packageJsonPath) return;
37349
- const packageJson = JSON.parse(await fs8.readFile(packageJsonPath, "utf8"));
37469
+ const packageJson = JSON.parse(await fs9.readFile(packageJsonPath, "utf8"));
37350
37470
  const packageDir = import_path12.default.dirname(packageJsonPath);
37351
37471
  const targetDir = import_path12.default.join(targetNodeModules, ...packageName.split("/"));
37352
37472
  copiedPackages.set(packageName, String(packageJson.version || "*"));
37353
- await fs8.mkdir(import_path12.default.dirname(targetDir), { recursive: true });
37473
+ await fs9.mkdir(import_path12.default.dirname(targetDir), { recursive: true });
37354
37474
  const packageRequire = (0, import_module2.createRequire)(packageJsonPath);
37355
37475
  const dependencies = {
37356
37476
  ...packageJson.dependencies,
37357
37477
  ...packageJson.optionalDependencies
37358
37478
  };
37359
37479
  await Promise.all([
37360
- fs8.cp(packageDir, targetDir, {
37480
+ fs9.cp(packageDir, targetDir, {
37361
37481
  recursive: true,
37362
37482
  force: true,
37363
37483
  dereference: true,
@@ -37376,16 +37496,16 @@ async function copySharpRuntime(config, root, nitroFuncDir, fs8) {
37376
37496
  );
37377
37497
  }
37378
37498
  const functionPackagePath = import_path12.default.join(nitroFuncDir, "package.json");
37379
- const functionPackage = JSON.parse(await fs8.readFile(functionPackagePath, "utf8"));
37499
+ const functionPackage = JSON.parse(await fs9.readFile(functionPackagePath, "utf8"));
37380
37500
  functionPackage.dependencies = {
37381
37501
  ...functionPackage.dependencies,
37382
37502
  ...Object.fromEntries([...copiedPackages].sort(([left], [right]) => left.localeCompare(right)))
37383
37503
  };
37384
- await fs8.writeFile(functionPackagePath, JSON.stringify(functionPackage, null, 2));
37504
+ await fs9.writeFile(functionPackagePath, JSON.stringify(functionPackage, null, 2));
37385
37505
  logger.info(`\u{1F5BC}\uFE0F Bundled Sharp image runtime (${copiedPackages.size} packages)`);
37386
37506
  }
37387
37507
  __name(copySharpRuntime, "copySharpRuntime");
37388
- async function copyMetadataImageRuntime(root, nitroFuncDir, fs8) {
37508
+ async function copyMetadataImageRuntime(root, nitroFuncDir, fs9) {
37389
37509
  const projectRequire = (0, import_module2.createRequire)(import_path12.default.join(root, "package.json"));
37390
37510
  let runtimeRequire = projectRequire;
37391
37511
  let packageJsonPath = resolvePackageJson(runtimeRequire, "@vercel/og");
@@ -37401,23 +37521,23 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs8) {
37401
37521
  "Generated metadata images require @vercel/og. Reinstall @farm.js/core with production dependencies."
37402
37522
  );
37403
37523
  }
37404
- const packageJson = JSON.parse(await fs8.readFile(packageJsonPath, "utf8"));
37524
+ const packageJson = JSON.parse(await fs9.readFile(packageJsonPath, "utf8"));
37405
37525
  const packageDir = import_path12.default.dirname(packageJsonPath);
37406
37526
  const targetDir = import_path12.default.join(nitroFuncDir, "node_modules", "@vercel", "og");
37407
- await fs8.mkdir(import_path12.default.dirname(targetDir), { recursive: true });
37408
- await fs8.cp(packageDir, targetDir, {
37527
+ await fs9.mkdir(import_path12.default.dirname(targetDir), { recursive: true });
37528
+ await fs9.cp(packageDir, targetDir, {
37409
37529
  recursive: true,
37410
37530
  force: true,
37411
37531
  dereference: true,
37412
37532
  mode: import_fs5.constants.COPYFILE_FICLONE
37413
37533
  });
37414
37534
  const functionPackagePath = import_path12.default.join(nitroFuncDir, "package.json");
37415
- const functionPackage = JSON.parse(await fs8.readFile(functionPackagePath, "utf8"));
37535
+ const functionPackage = JSON.parse(await fs9.readFile(functionPackagePath, "utf8"));
37416
37536
  functionPackage.dependencies = {
37417
37537
  ...functionPackage.dependencies,
37418
37538
  "@vercel/og": String(packageJson.version || "0.11.1")
37419
37539
  };
37420
- await fs8.writeFile(functionPackagePath, JSON.stringify(functionPackage, null, 2));
37540
+ await fs9.writeFile(functionPackagePath, JSON.stringify(functionPackage, null, 2));
37421
37541
  logger.info("\u{1F5BC}\uFE0F Bundled generated metadata image runtime");
37422
37542
  }
37423
37543
  __name(copyMetadataImageRuntime, "copyMetadataImageRuntime");
@@ -37431,7 +37551,7 @@ function resolvePackageJson(parentRequire, packageName) {
37431
37551
  return null;
37432
37552
  }
37433
37553
  __name(resolvePackageJson, "resolvePackageJson");
37434
- async function copyPrismaClientForVercel(root, nitroFuncDir, fs8) {
37554
+ async function copyPrismaClientForVercel(root, nitroFuncDir, fs9) {
37435
37555
  const projectRequire = (0, import_module2.createRequire)(import_path12.default.join(root, "package.json"));
37436
37556
  let prismaClientDir;
37437
37557
  try {
@@ -37441,7 +37561,7 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs8) {
37441
37561
  }
37442
37562
  const generatedClientDir = import_path12.default.join(prismaClientDir, "..", "..", ".prisma", "client");
37443
37563
  try {
37444
- await fs8.access(generatedClientDir);
37564
+ await fs9.access(generatedClientDir);
37445
37565
  } catch {
37446
37566
  return;
37447
37567
  }
@@ -37449,20 +37569,20 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs8) {
37449
37569
  const targetPrismaScopeDir = import_path12.default.join(targetNodeModules, "@prisma");
37450
37570
  const targetGeneratedDir = import_path12.default.join(targetNodeModules, ".prisma", "client");
37451
37571
  const targetClientDir = import_path12.default.join(targetPrismaScopeDir, "client");
37452
- await fs8.mkdir(targetPrismaScopeDir, { recursive: true });
37453
- await fs8.cp(prismaClientDir, targetClientDir, {
37572
+ await fs9.mkdir(targetPrismaScopeDir, { recursive: true });
37573
+ await fs9.cp(prismaClientDir, targetClientDir, {
37454
37574
  recursive: true,
37455
37575
  force: true
37456
37576
  });
37457
- await fs8.cp(generatedClientDir, targetGeneratedDir, {
37577
+ await fs9.cp(generatedClientDir, targetGeneratedDir, {
37458
37578
  recursive: true,
37459
37579
  force: true
37460
37580
  });
37461
37581
  const functionPackagePath = import_path12.default.join(nitroFuncDir, "package.json");
37462
37582
  const clientPackagePath = import_path12.default.join(prismaClientDir, "package.json");
37463
37583
  const [functionPackageContent, clientPackageContent] = await Promise.all([
37464
- fs8.readFile(functionPackagePath, "utf-8"),
37465
- fs8.readFile(clientPackagePath, "utf-8")
37584
+ fs9.readFile(functionPackagePath, "utf-8"),
37585
+ fs9.readFile(clientPackagePath, "utf-8")
37466
37586
  ]);
37467
37587
  const functionPackage = JSON.parse(functionPackageContent);
37468
37588
  const clientPackage = JSON.parse(clientPackageContent);
@@ -37470,7 +37590,7 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs8) {
37470
37590
  ...functionPackage.dependencies,
37471
37591
  "@prisma/client": clientPackage.version
37472
37592
  };
37473
- await fs8.writeFile(functionPackagePath, JSON.stringify(functionPackage, null, 2));
37593
+ await fs9.writeFile(functionPackagePath, JSON.stringify(functionPackage, null, 2));
37474
37594
  }
37475
37595
  __name(copyPrismaClientForVercel, "copyPrismaClientForVercel");
37476
37596
 
@@ -37792,10 +37912,10 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
37792
37912
  const manifestPath = import_path14.default.join(publicOutputDir, "farm-client-manifest.json");
37793
37913
  const assetsDir = import_path14.default.join(publicOutputDir, "assets");
37794
37914
  const manifestExists = await import("fs/promises").then(
37795
- (fs8) => fs8.access(manifestPath).then(() => true).catch(() => false)
37915
+ (fs9) => fs9.access(manifestPath).then(() => true).catch(() => false)
37796
37916
  );
37797
37917
  const assetsExist = await import("fs/promises").then(
37798
- (fs8) => fs8.access(assetsDir).then(() => true).catch(() => false)
37918
+ (fs9) => fs9.access(assetsDir).then(() => true).catch(() => false)
37799
37919
  );
37800
37920
  if (manifestExists && assetsExist) {
37801
37921
  logger.info("\u2705 Verified client assets are present");