@gigadrive/network-config 5.3.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1008,8 +1008,8 @@ var detectContainerProject = import_effect6.Effect.fn("detectContainerProject")(
1008
1008
  });
1009
1009
 
1010
1010
  // src/detection/detect-framework.ts
1011
- var import_platform12 = require("@effect/platform");
1012
- var import_effect18 = require("effect");
1011
+ var import_platform13 = require("@effect/platform");
1012
+ var import_effect19 = require("effect");
1013
1013
 
1014
1014
  // src/detection/detect-package-manager.ts
1015
1015
  var import_platform4 = require("@effect/platform");
@@ -1104,8 +1104,14 @@ var cakephp = {
1104
1104
  "logs"
1105
1105
  ],
1106
1106
  excludeFiles: ["tests/", "tmp/", "logs/"],
1107
- // config/app.php reads the salt from env; app_local.php is not committed.
1108
- environmentVariables: { SECURITY_SALT: generatedSecret("hex") }
1107
+ environmentVariables: {
1108
+ // The app_local.php that `composer install` copies from the example
1109
+ // reads env('DEBUG', true), which would run every deployment in debug
1110
+ // mode with stack traces in error pages.
1111
+ DEBUG: "false",
1112
+ // config/app.php reads the salt from env; app_local.php is not committed.
1113
+ SECURITY_SALT: generatedSecret("hex")
1114
+ }
1109
1115
  })
1110
1116
  };
1111
1117
 
@@ -2000,6 +2006,157 @@ var phpSites = DOCUMENT_ROOTS.map((documentRoot) => ({
2000
2006
  refineDefaultConfig: (defaults, projectFolder) => refinePhpDocumentRoot(defaults, projectFolder).pipe(import_effect14.Effect.map((refined) => ({ ...refined, installCommand: "" })))
2001
2007
  }));
2002
2008
 
2009
+ // src/detection/frameworks/php-runtime.ts
2010
+ var import_platform11 = require("@effect/platform");
2011
+ var import_effect15 = require("effect");
2012
+
2013
+ // src/detection/frameworks/composer-constraint.ts
2014
+ var STABILITY_SUFFIX = /-(?:dev|alpha|beta|a|b|rc|patch|pl|p|stable)\.?\d*$/i;
2015
+ var parseVersion = (text) => {
2016
+ const parts = text.replace(/^v/i, "").replace(STABILITY_SUFFIX, "").split(".");
2017
+ if (parts.length > 4) {
2018
+ return void 0;
2019
+ }
2020
+ const segments = [];
2021
+ let wildcard = false;
2022
+ for (const part of parts) {
2023
+ if (/^[*x]$/i.test(part)) {
2024
+ wildcard = true;
2025
+ } else if (/^\d+$/.test(part) && !wildcard) {
2026
+ segments.push(Number(part));
2027
+ } else {
2028
+ return void 0;
2029
+ }
2030
+ }
2031
+ return { segments, wildcard };
2032
+ };
2033
+ var pad = (segments) => [segments[0] ?? 0, segments[1] ?? 0, segments[2] ?? 0, segments[3] ?? 0];
2034
+ var bump = (segments, position) => pad(segments.slice(0, position).map((segment, index) => index === position - 1 ? segment + 1 : segment));
2035
+ var compare = (a, b) => {
2036
+ for (let index = 0; index < 4; index++) {
2037
+ if (a[index] !== b[index]) {
2038
+ return a[index] - b[index];
2039
+ }
2040
+ }
2041
+ return 0;
2042
+ };
2043
+ var inRange = (version, lower, upper) => compare(version, lower) >= 0 && compare(version, upper) < 0;
2044
+ var allowsAtom = (atom, version) => {
2045
+ const match = /^(\^|~|>=|<=|<>|!=|==|=|>|<)?(.+)$/.exec(atom);
2046
+ const parsed = match ? parseVersion(match[2]) : void 0;
2047
+ if (!match || !parsed) {
2048
+ return void 0;
2049
+ }
2050
+ const operator = match[1];
2051
+ const { segments } = parsed;
2052
+ if (parsed.wildcard) {
2053
+ if (operator !== void 0) {
2054
+ return void 0;
2055
+ }
2056
+ return segments.length === 0 || inRange(version, pad(segments), bump(segments, segments.length));
2057
+ }
2058
+ const target = pad(segments);
2059
+ switch (operator) {
2060
+ case "^": {
2061
+ const position = segments[0] !== 0 || segments.length < 2 ? 1 : segments[1] !== 0 || segments.length < 3 ? 2 : 3;
2062
+ return inRange(version, target, bump(segments, position));
2063
+ }
2064
+ case "~":
2065
+ return inRange(version, target, bump(segments, Math.max(1, segments.length - 1)));
2066
+ case ">=":
2067
+ return compare(version, target) >= 0;
2068
+ case ">":
2069
+ return compare(version, target) > 0;
2070
+ case "<=":
2071
+ return compare(version, target) <= 0;
2072
+ case "<":
2073
+ return compare(version, target) < 0;
2074
+ case "!=":
2075
+ case "<>":
2076
+ return compare(version, target) !== 0;
2077
+ default:
2078
+ return compare(version, target) === 0;
2079
+ }
2080
+ };
2081
+ var allowsHyphenRange = (from, to, version) => {
2082
+ const lower = parseVersion(from);
2083
+ const upper = parseVersion(to);
2084
+ if (!lower || !upper || lower.wildcard || upper.wildcard) {
2085
+ return void 0;
2086
+ }
2087
+ const withinUpper = upper.segments.length >= 3 ? compare(version, pad(upper.segments)) <= 0 : compare(version, bump(upper.segments, upper.segments.length)) < 0;
2088
+ return compare(version, pad(lower.segments)) >= 0 && withinUpper;
2089
+ };
2090
+ var allowsAll = (branch, version) => {
2091
+ const tokens = branch.trim().replace(/([<>=!~^]+)\s+/g, "$1").split(/\s*,\s*|\s+/).filter((token) => token !== "");
2092
+ if (tokens.length === 0) {
2093
+ return void 0;
2094
+ }
2095
+ let allowed = true;
2096
+ for (let index = 0; index < tokens.length; index++) {
2097
+ let result;
2098
+ if (tokens[index + 1] === "-") {
2099
+ const to = tokens[index + 2];
2100
+ result = to === void 0 ? void 0 : allowsHyphenRange(tokens[index], to, version);
2101
+ index += 2;
2102
+ } else {
2103
+ result = allowsAtom(tokens[index], version);
2104
+ }
2105
+ if (result === void 0) {
2106
+ return void 0;
2107
+ }
2108
+ allowed &&= result;
2109
+ }
2110
+ return allowed;
2111
+ };
2112
+ var composerConstraintAllows = (constraint, version) => {
2113
+ const parsed = parseVersion(version);
2114
+ if (!parsed || parsed.wildcard || parsed.segments.length === 0) {
2115
+ return void 0;
2116
+ }
2117
+ const target = pad(parsed.segments);
2118
+ let allowed = false;
2119
+ for (const branch of constraint.replace(/@[a-z]+/gi, "").split(/\|\|?/)) {
2120
+ const result = allowsAll(branch, target);
2121
+ if (result === void 0) {
2122
+ return void 0;
2123
+ }
2124
+ allowed ||= result;
2125
+ }
2126
+ return allowed;
2127
+ };
2128
+
2129
+ // src/detection/frameworks/php-runtime.ts
2130
+ var PHP_RUNTIME_CANDIDATES = [
2131
+ { runtime: "php-84", newestVersion: "8.4.9999" },
2132
+ { runtime: "php-83", newestVersion: "8.3.9999" }
2133
+ ];
2134
+ var phpRuntimeForConstraint = (constraint) => PHP_RUNTIME_CANDIDATES.find(({ newestVersion }) => composerConstraintAllows(constraint, newestVersion) === true)?.runtime;
2135
+ var readPhpConstraint = import_effect15.Effect.fn("readPhpConstraint")(
2136
+ function* (projectFolder) {
2137
+ const fs = yield* import_platform11.FileSystem.FileSystem;
2138
+ const pathService = yield* import_platform11.Path.Path;
2139
+ const content = yield* fs.readFileString(pathService.join(projectFolder, "composer.json"));
2140
+ const manifest = yield* import_effect15.Effect.try(() => JSON.parse(content));
2141
+ const requires = manifest && typeof manifest === "object" && "require" in manifest ? manifest.require : void 0;
2142
+ const php = requires && typeof requires === "object" && "php" in requires ? requires.php : void 0;
2143
+ return typeof php === "string" ? import_effect15.Option.some(php) : import_effect15.Option.none();
2144
+ },
2145
+ import_effect15.Effect.catchAll(() => import_effect15.Effect.succeed(import_effect15.Option.none()))
2146
+ );
2147
+ var refineComposerPhpRuntime = import_effect15.Effect.fn("refineComposerPhpRuntime")(function* (defaults, projectFolder) {
2148
+ const constraint = yield* readPhpConstraint(projectFolder);
2149
+ const runtime = import_effect15.Option.getOrUndefined(import_effect15.Option.flatMapNullable(constraint, phpRuntimeForConstraint));
2150
+ return runtime ? { ...defaults, runtime } : defaults;
2151
+ });
2152
+ var withComposerPhpRuntime = (framework) => ({
2153
+ ...framework,
2154
+ refineDefaultConfig: (defaults, projectFolder) => import_effect15.Effect.gen(function* () {
2155
+ const refined = framework.refineDefaultConfig ? yield* framework.refineDefaultConfig(defaults, projectFolder) : defaults;
2156
+ return yield* refineComposerPhpRuntime(refined, projectFolder);
2157
+ })
2158
+ });
2159
+
2003
2160
  // src/detection/frameworks/remix.ts
2004
2161
  var remix = {
2005
2162
  slug: "remix",
@@ -2148,10 +2305,10 @@ var FRAMEWORK_DEFINITIONS = [
2148
2305
  ...phpComposerProjects,
2149
2306
  ...phpSites,
2150
2307
  vite
2151
- ].sort((a, b) => b.priority - a.priority);
2308
+ ].map((framework) => framework.language === "php" ? withComposerPhpRuntime(framework) : framework).sort((a, b) => b.priority - a.priority);
2152
2309
 
2153
2310
  // src/detection/generate-config.ts
2154
- var import_effect15 = require("effect");
2311
+ var import_effect16 = require("effect");
2155
2312
  var getInstallCommand = (pm) => {
2156
2313
  switch (pm) {
2157
2314
  case "bun":
@@ -2172,11 +2329,11 @@ var isPrivatePhpProjectFile = (projectPath) => {
2172
2329
  const segments = projectPath.split("/").filter((segment) => segment !== "" && segment !== ".");
2173
2330
  return segments.some((segment) => segment.startsWith(".")) || segments[0] === "vendor" || segments[0] === "node_modules" || segments.length === 1 && COMPOSER_ROOT_FILES.has(segments[0] ?? "");
2174
2331
  };
2175
- var generateConfig = import_effect15.Effect.fn("generateConfig")(function* (framework, packageManager, projectFolder, refinedDefaults) {
2332
+ var generateConfig = import_effect16.Effect.fn("generateConfig")(function* (framework, packageManager, projectFolder, refinedDefaults) {
2176
2333
  const defaults = refinedDefaults ?? framework.getDefaultConfig(packageManager);
2177
2334
  const installCmd = defaults.installCommand ?? getInstallCommand(packageManager);
2178
2335
  const commands = installCmd ? [installCmd, ...defaults.commands] : [...defaults.commands];
2179
- yield* import_effect15.Effect.logDebug(`Generating config for ${framework.name}`, {
2336
+ yield* import_effect16.Effect.logDebug(`Generating config for ${framework.name}`, {
2180
2337
  runtime: defaults.runtime,
2181
2338
  entrypoint: defaults.entrypoint,
2182
2339
  commands
@@ -2242,31 +2399,31 @@ var generateConfig = import_effect15.Effect.fn("generateConfig")(function* (fram
2242
2399
  });
2243
2400
 
2244
2401
  // src/detection/read-dependencies.ts
2245
- var import_platform11 = require("@effect/platform");
2246
- var import_effect17 = require("effect");
2402
+ var import_platform12 = require("@effect/platform");
2403
+ var import_effect18 = require("effect");
2247
2404
 
2248
2405
  // src/detection/types.ts
2249
- var import_effect16 = require("effect");
2250
- var ManifestNotFoundError = class extends import_effect16.Schema.TaggedError()("ManifestNotFoundError", {
2251
- message: import_effect16.Schema.String,
2252
- filePath: import_effect16.Schema.String
2406
+ var import_effect17 = require("effect");
2407
+ var ManifestNotFoundError = class extends import_effect17.Schema.TaggedError()("ManifestNotFoundError", {
2408
+ message: import_effect17.Schema.String,
2409
+ filePath: import_effect17.Schema.String
2253
2410
  }) {
2254
2411
  };
2255
- var ManifestReadError = class extends import_effect16.Schema.TaggedError()("ManifestReadError", {
2256
- message: import_effect16.Schema.String,
2257
- filePath: import_effect16.Schema.String
2412
+ var ManifestReadError = class extends import_effect17.Schema.TaggedError()("ManifestReadError", {
2413
+ message: import_effect17.Schema.String,
2414
+ filePath: import_effect17.Schema.String
2258
2415
  }) {
2259
2416
  };
2260
- var ManifestParseError = class extends import_effect16.Schema.TaggedError()("ManifestParseError", {
2261
- message: import_effect16.Schema.String,
2262
- filePath: import_effect16.Schema.String
2417
+ var ManifestParseError = class extends import_effect17.Schema.TaggedError()("ManifestParseError", {
2418
+ message: import_effect17.Schema.String,
2419
+ filePath: import_effect17.Schema.String
2263
2420
  }) {
2264
2421
  };
2265
- var FrameworkNotDetectedError = class extends import_effect16.Schema.TaggedError()(
2422
+ var FrameworkNotDetectedError = class extends import_effect17.Schema.TaggedError()(
2266
2423
  "FrameworkNotDetectedError",
2267
2424
  {
2268
- message: import_effect16.Schema.String,
2269
- directory: import_effect16.Schema.String
2425
+ message: import_effect17.Schema.String,
2426
+ directory: import_effect17.Schema.String
2270
2427
  }
2271
2428
  ) {
2272
2429
  };
@@ -2276,25 +2433,25 @@ var MANIFEST_CONFIG = {
2276
2433
  node: { file: "package.json", depKeys: ["dependencies", "devDependencies"] },
2277
2434
  php: { file: "composer.json", depKeys: ["require", "require-dev"] }
2278
2435
  };
2279
- var readManifest = import_effect17.Effect.fn("readManifest")(function* (filePath) {
2280
- const fs = yield* import_platform11.FileSystem.FileSystem;
2281
- const exists = yield* fs.exists(filePath).pipe(import_effect17.Effect.catchAll(() => import_effect17.Effect.succeed(false)));
2436
+ var readManifest = import_effect18.Effect.fn("readManifest")(function* (filePath) {
2437
+ const fs = yield* import_platform12.FileSystem.FileSystem;
2438
+ const exists = yield* fs.exists(filePath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed(false)));
2282
2439
  if (!exists) {
2283
- return yield* import_effect17.Effect.fail(new ManifestNotFoundError({ message: "Manifest not found", filePath }));
2440
+ return yield* import_effect18.Effect.fail(new ManifestNotFoundError({ message: "Manifest not found", filePath }));
2284
2441
  }
2285
- const content = yield* fs.readFileString(filePath).pipe(import_effect17.Effect.mapError(() => new ManifestReadError({ message: "Failed to read manifest", filePath })));
2286
- const parsed = yield* import_effect17.Effect.try({
2442
+ const content = yield* fs.readFileString(filePath).pipe(import_effect18.Effect.mapError(() => new ManifestReadError({ message: "Failed to read manifest", filePath })));
2443
+ const parsed = yield* import_effect18.Effect.try({
2287
2444
  try: () => JSON.parse(content),
2288
2445
  catch: () => new ManifestParseError({ message: "Failed to parse manifest JSON", filePath })
2289
2446
  });
2290
2447
  return parsed;
2291
2448
  });
2292
- var readDependencies = import_effect17.Effect.fn("readDependencies")(function* (projectFolder, language) {
2293
- const pathService = yield* import_platform11.Path.Path;
2449
+ var readDependencies = import_effect18.Effect.fn("readDependencies")(function* (projectFolder, language) {
2450
+ const pathService = yield* import_platform12.Path.Path;
2294
2451
  const config = MANIFEST_CONFIG[language];
2295
2452
  const filePath = pathService.join(projectFolder, config.file);
2296
2453
  const manifest = yield* readManifest(filePath).pipe(
2297
- import_effect17.Effect.catchTag("ManifestNotFoundError", () => import_effect17.Effect.succeed(null))
2454
+ import_effect18.Effect.catchTag("ManifestNotFoundError", () => import_effect18.Effect.succeed(null))
2298
2455
  );
2299
2456
  if (!manifest) {
2300
2457
  return /* @__PURE__ */ new Set();
@@ -2312,9 +2469,9 @@ var readDependencies = import_effect17.Effect.fn("readDependencies")(function* (
2312
2469
  });
2313
2470
 
2314
2471
  // src/detection/detect-framework.ts
2315
- var matchesDetectionItem = import_effect18.Effect.fn("matchesDetectionItem")(function* (item, projectFolder, framework, cachedReadDeps) {
2316
- const fs = yield* import_platform12.FileSystem.FileSystem;
2317
- const pathService = yield* import_platform12.Path.Path;
2472
+ var matchesDetectionItem = import_effect19.Effect.fn("matchesDetectionItem")(function* (item, projectFolder, framework, cachedReadDeps) {
2473
+ const fs = yield* import_platform13.FileSystem.FileSystem;
2474
+ const pathService = yield* import_platform13.Path.Path;
2318
2475
  if (item.matchPackage != null) {
2319
2476
  const deps = yield* cachedReadDeps(`${projectFolder}\0${framework.language}`);
2320
2477
  if (!deps.has(item.matchPackage)) {
@@ -2323,12 +2480,12 @@ var matchesDetectionItem = import_effect18.Effect.fn("matchesDetectionItem")(fun
2323
2480
  }
2324
2481
  if (item.path != null) {
2325
2482
  const filePath = pathService.join(projectFolder, item.path);
2326
- const exists = yield* fs.exists(filePath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed(false)));
2483
+ const exists = yield* fs.exists(filePath).pipe(import_effect19.Effect.catchAll(() => import_effect19.Effect.succeed(false)));
2327
2484
  if (!exists) {
2328
2485
  return false;
2329
2486
  }
2330
2487
  if (item.matchContent != null) {
2331
- const content = yield* fs.readFileString(filePath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed("")));
2488
+ const content = yield* fs.readFileString(filePath).pipe(import_effect19.Effect.catchAll(() => import_effect19.Effect.succeed("")));
2332
2489
  let regexMatch = false;
2333
2490
  try {
2334
2491
  regexMatch = new RegExp(item.matchContent).test(content);
@@ -2341,7 +2498,7 @@ var matchesDetectionItem = import_effect18.Effect.fn("matchesDetectionItem")(fun
2341
2498
  }
2342
2499
  return true;
2343
2500
  });
2344
- var matchesFramework = import_effect18.Effect.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
2501
+ var matchesFramework = import_effect19.Effect.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
2345
2502
  for (const detector of framework.detectors) {
2346
2503
  const matches = yield* matchesDetectionItem(detector, projectFolder, framework, cachedReadDeps);
2347
2504
  if (!matches) {
@@ -2350,9 +2507,9 @@ var matchesFramework = import_effect18.Effect.fn("matchesFramework")(function* (
2350
2507
  }
2351
2508
  return true;
2352
2509
  });
2353
- var detectFramework = import_effect18.Effect.fn("detectFramework")(function* (projectFolder) {
2354
- yield* import_effect18.Effect.logDebug(`Detecting framework in ${projectFolder}`);
2355
- const cachedReadDeps = yield* import_effect18.Effect.cachedFunction((key) => {
2510
+ var detectFramework = import_effect19.Effect.fn("detectFramework")(function* (projectFolder) {
2511
+ yield* import_effect19.Effect.logDebug(`Detecting framework in ${projectFolder}`);
2512
+ const cachedReadDeps = yield* import_effect19.Effect.cachedFunction((key) => {
2356
2513
  const sepIndex = key.lastIndexOf("\0");
2357
2514
  const folder = key.slice(0, sepIndex);
2358
2515
  const language = key.slice(sepIndex + 1);
@@ -2361,7 +2518,7 @@ var detectFramework = import_effect18.Effect.fn("detectFramework")(function* (pr
2361
2518
  for (const framework of FRAMEWORK_DEFINITIONS) {
2362
2519
  const matches = yield* matchesFramework(framework, projectFolder, cachedReadDeps);
2363
2520
  if (matches) {
2364
- yield* import_effect18.Effect.log(`Detected framework: ${framework.name}`, { slug: framework.slug });
2521
+ yield* import_effect19.Effect.log(`Detected framework: ${framework.name}`, { slug: framework.slug });
2365
2522
  const detectedPackageManager = yield* detectPackageManager(projectFolder);
2366
2523
  const packageManager = framework.language === "php" ? "composer" : detectedPackageManager;
2367
2524
  const defaults = framework.getDefaultConfig(packageManager);
@@ -2370,7 +2527,7 @@ var detectFramework = import_effect18.Effect.fn("detectFramework")(function* (pr
2370
2527
  return { framework, packageManager, config };
2371
2528
  }
2372
2529
  }
2373
- return yield* import_effect18.Effect.fail(
2530
+ return yield* import_effect19.Effect.fail(
2374
2531
  new FrameworkNotDetectedError({
2375
2532
  message: `No framework detected in project directory`,
2376
2533
  directory: projectFolder
@@ -2379,9 +2536,9 @@ var detectFramework = import_effect18.Effect.fn("detectFramework")(function* (pr
2379
2536
  });
2380
2537
 
2381
2538
  // src/detection/merge-config.ts
2382
- var import_effect19 = require("effect");
2383
- var mergeWithFrameworkDefaults = import_effect19.Effect.fn("mergeWithFrameworkDefaults")(function* (userConfig, frameworkConfig) {
2384
- yield* import_effect19.Effect.logDebug("Merging user config with framework defaults");
2539
+ var import_effect20 = require("effect");
2540
+ var mergeWithFrameworkDefaults = import_effect20.Effect.fn("mergeWithFrameworkDefaults")(function* (userConfig, frameworkConfig) {
2541
+ yield* import_effect20.Effect.logDebug("Merging user config with framework defaults");
2385
2542
  const userHasAssets = (userConfig.assets?.paths?.length ?? 0) > 0 || (userConfig.assets?.prefixes?.length ?? 0) > 0 || (userConfig.assets?.manifests?.length ?? 0) > 0;
2386
2543
  const isContainer = (entrypoint) => entrypoint.runtime === CONTAINER_RUNTIME;
2387
2544
  const userFileFunctions = userConfig.entrypoints.filter((entrypoint) => !isContainer(entrypoint));
@@ -2422,23 +2579,23 @@ var filterFunctionsFromAssets = (config) => {
2422
2579
  };
2423
2580
 
2424
2581
  // src/parse-config.ts
2425
- var import_effect25 = require("effect");
2582
+ var import_effect26 = require("effect");
2426
2583
 
2427
2584
  // src/services/raw-config-reader.ts
2428
- var import_platform13 = require("@effect/platform");
2429
- var import_effect21 = require("effect");
2585
+ var import_platform14 = require("@effect/platform");
2586
+ var import_effect22 = require("effect");
2430
2587
  var import_yaml2 = require("yaml");
2431
2588
 
2432
2589
  // src/services/config-module-loader.ts
2433
- var import_effect20 = require("effect");
2590
+ var import_effect21 = require("effect");
2434
2591
  var import_jiti = require("jiti");
2435
2592
  var MISSING_DEFAULT_EXPORT = /* @__PURE__ */ Symbol("MissingDefaultExport");
2436
2593
  var STRICT_DEFAULT_EXPORT_EXTENSIONS = [".ts", ".mts", ".mjs"];
2437
- var ConfigModuleLoader = class extends import_effect20.Effect.Service()("ConfigModuleLoader", {
2438
- effect: import_effect20.Effect.gen(function* () {
2439
- const loadConfigModule = import_effect20.Effect.fn("ConfigModuleLoader.loadConfigModule")(function* (filePath) {
2594
+ var ConfigModuleLoader = class extends import_effect21.Effect.Service()("ConfigModuleLoader", {
2595
+ effect: import_effect21.Effect.gen(function* () {
2596
+ const loadConfigModule = import_effect21.Effect.fn("ConfigModuleLoader.loadConfigModule")(function* (filePath) {
2440
2597
  const extension = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
2441
- const mod = yield* import_effect20.Effect.tryPromise({
2598
+ const mod = yield* import_effect21.Effect.tryPromise({
2442
2599
  try: async () => {
2443
2600
  const jiti = (0, import_jiti.createJiti)(filePath, { fsCache: false, interopDefault: true, moduleCache: false });
2444
2601
  const namespace = await jiti.import(filePath);
@@ -2457,7 +2614,7 @@ var ConfigModuleLoader = class extends import_effect20.Effect.Service()("ConfigM
2457
2614
  })
2458
2615
  });
2459
2616
  if (mod === MISSING_DEFAULT_EXPORT) {
2460
- return yield* import_effect20.Effect.fail(
2617
+ return yield* import_effect21.Effect.fail(
2461
2618
  new ConfigModuleLoadError({
2462
2619
  message: `Config module at ${filePath} does not have a default export. Export the config object as the default export (or via module.exports for CommonJS files), optionally wrapped in defineConfig.`,
2463
2620
  filePath
@@ -2465,7 +2622,7 @@ var ConfigModuleLoader = class extends import_effect20.Effect.Service()("ConfigM
2465
2622
  );
2466
2623
  }
2467
2624
  if (typeof mod === "function") {
2468
- return yield* import_effect20.Effect.fail(
2625
+ return yield* import_effect21.Effect.fail(
2469
2626
  new ConfigModuleLoadError({
2470
2627
  message: `Config module at ${filePath} default-exports a function; config factories are not supported. Export a config object instead (optionally wrapped in defineConfig).`,
2471
2628
  filePath
@@ -2473,7 +2630,7 @@ var ConfigModuleLoader = class extends import_effect20.Effect.Service()("ConfigM
2473
2630
  );
2474
2631
  }
2475
2632
  if (typeof mod !== "object" || mod === null || Array.isArray(mod)) {
2476
- return yield* import_effect20.Effect.fail(
2633
+ return yield* import_effect21.Effect.fail(
2477
2634
  new ConfigModuleLoadError({
2478
2635
  message: `Config module at ${filePath} must default-export a config object.`,
2479
2636
  filePath
@@ -2503,36 +2660,36 @@ var ALLOWED_CONFIG_NAMES = [
2503
2660
  "nebula.json"
2504
2661
  ];
2505
2662
  var MODULE_EXTENSIONS = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"];
2506
- var RawConfigReader = class extends import_effect21.Effect.Service()("RawConfigReader", {
2663
+ var RawConfigReader = class extends import_effect22.Effect.Service()("RawConfigReader", {
2507
2664
  dependencies: [ConfigModuleLoader.Default],
2508
- effect: import_effect21.Effect.gen(function* () {
2509
- const fs = yield* import_platform13.FileSystem.FileSystem;
2510
- const pathService = yield* import_platform13.Path.Path;
2665
+ effect: import_effect22.Effect.gen(function* () {
2666
+ const fs = yield* import_platform14.FileSystem.FileSystem;
2667
+ const pathService = yield* import_platform14.Path.Path;
2511
2668
  const moduleLoader = yield* ConfigModuleLoader;
2512
- const findConfig = import_effect21.Effect.fn("RawConfigReader.findConfig")(function* (projectFolder) {
2669
+ const findConfig = import_effect22.Effect.fn("RawConfigReader.findConfig")(function* (projectFolder) {
2513
2670
  for (const name of ALLOWED_CONFIG_NAMES) {
2514
2671
  const filePath = pathService.join(projectFolder, name);
2515
- const exists = yield* fs.exists(filePath).pipe(import_effect21.Effect.catchAll(() => import_effect21.Effect.succeed(false)));
2672
+ const exists = yield* fs.exists(filePath).pipe(import_effect22.Effect.catchAll(() => import_effect22.Effect.succeed(false)));
2516
2673
  if (exists) {
2517
2674
  return filePath;
2518
2675
  }
2519
2676
  }
2520
2677
  return null;
2521
2678
  });
2522
- const readRawConfig = import_effect21.Effect.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
2523
- const exists = yield* fs.exists(filePath).pipe(import_effect21.Effect.catchAll(() => import_effect21.Effect.succeed(false)));
2679
+ const readRawConfig = import_effect22.Effect.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
2680
+ const exists = yield* fs.exists(filePath).pipe(import_effect22.Effect.catchAll(() => import_effect22.Effect.succeed(false)));
2524
2681
  if (!exists) {
2525
- return yield* import_effect21.Effect.fail(
2682
+ return yield* import_effect22.Effect.fail(
2526
2683
  new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })
2527
2684
  );
2528
2685
  }
2529
2686
  const fileContents = yield* fs.readFileString(filePath).pipe(
2530
- import_effect21.Effect.mapError(
2687
+ import_effect22.Effect.mapError(
2531
2688
  () => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })
2532
2689
  )
2533
2690
  );
2534
2691
  if (fileContents.length === 0) {
2535
- return yield* import_effect21.Effect.fail(
2692
+ return yield* import_effect22.Effect.fail(
2536
2693
  new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })
2537
2694
  );
2538
2695
  }
@@ -2548,7 +2705,7 @@ var RawConfigReader = class extends import_effect21.Effect.Service()("RawConfigR
2548
2705
  parsed = (0, import_yaml2.parse)(fileContents);
2549
2706
  }
2550
2707
  } catch (error) {
2551
- return yield* import_effect21.Effect.fail(
2708
+ return yield* import_effect22.Effect.fail(
2552
2709
  new ConfigFileParseError({
2553
2710
  message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
2554
2711
  filePath,
@@ -2558,21 +2715,21 @@ var RawConfigReader = class extends import_effect21.Effect.Service()("RawConfigR
2558
2715
  }
2559
2716
  }
2560
2717
  if (parsed == null) {
2561
- return yield* import_effect21.Effect.fail(
2718
+ return yield* import_effect22.Effect.fail(
2562
2719
  new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })
2563
2720
  );
2564
2721
  }
2565
2722
  if (!options?.disableVersionCheck && typeof parsed.version !== "number") {
2566
- return yield* import_effect21.Effect.fail(
2723
+ return yield* import_effect22.Effect.fail(
2567
2724
  new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })
2568
2725
  );
2569
2726
  }
2570
2727
  return parsed;
2571
2728
  });
2572
2729
  const readConfigFile = (configFilePath) => readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(
2573
- import_effect21.Effect.map((parsed) => parsed),
2574
- import_effect21.Effect.catchTag("ConfigFileNotFoundError", () => import_effect21.Effect.succeed(null)),
2575
- import_effect21.Effect.withSpan("RawConfigReader.readConfigFile")
2730
+ import_effect22.Effect.map((parsed) => parsed),
2731
+ import_effect22.Effect.catchTag("ConfigFileNotFoundError", () => import_effect22.Effect.succeed(null)),
2732
+ import_effect22.Effect.withSpan("RawConfigReader.readConfigFile")
2576
2733
  );
2577
2734
  return { findConfig, readRawConfig, readConfigFile };
2578
2735
  })
@@ -2582,17 +2739,17 @@ var RawConfigReader = class extends import_effect21.Effect.Service()("RawConfigR
2582
2739
  // src/services/schema-validator.ts
2583
2740
  var import_ajv = __toESM(require("ajv"));
2584
2741
  var import_ajv_formats = __toESM(require("ajv-formats"));
2585
- var import_effect22 = require("effect");
2586
- var SchemaValidator = class extends import_effect22.Effect.Service()("SchemaValidator", {
2587
- effect: import_effect22.Effect.gen(function* () {
2742
+ var import_effect23 = require("effect");
2743
+ var SchemaValidator = class extends import_effect23.Effect.Service()("SchemaValidator", {
2744
+ effect: import_effect23.Effect.gen(function* () {
2588
2745
  const ajv = new import_ajv.default();
2589
2746
  (0, import_ajv_formats.default)(ajv);
2590
- const validate = import_effect22.Effect.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
2747
+ const validate = import_effect23.Effect.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
2591
2748
  const compiledValidate = ajv.compile(schema);
2592
2749
  const valid = compiledValidate(config);
2593
2750
  if (!valid) {
2594
2751
  const errors = compiledValidate.errors?.map((e) => `${e.instancePath || "/"} ${e.message ?? ""}`.trim()) ?? [];
2595
- return yield* import_effect22.Effect.fail(
2752
+ return yield* import_effect23.Effect.fail(
2596
2753
  new ConfigSchemaValidationError({
2597
2754
  message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,
2598
2755
  filePath,
@@ -2648,7 +2805,7 @@ var getFilesForPattern = async (pattern, projectFolder, excludeFiles = []) => {
2648
2805
  };
2649
2806
 
2650
2807
  // src/services/v4-config-parser.ts
2651
- var import_effect23 = require("effect");
2808
+ var import_effect24 = require("effect");
2652
2809
  var import_minimatch2 = require("minimatch");
2653
2810
  var import_node_path2 = require("path");
2654
2811
  var import_safe_regex2 = __toESM(require("safe-regex2"));
@@ -2799,7 +2956,7 @@ var mapRoute = (route, entrypoints) => ({
2799
2956
  negativeRequirements: route.missing,
2800
2957
  status: route.statusCode
2801
2958
  });
2802
- var parseEntrypoints = import_effect23.Effect.fn("parseEntrypoints")(function* (config, projectFolder) {
2959
+ var parseEntrypoints = import_effect24.Effect.fn("parseEntrypoints")(function* (config, projectFolder) {
2803
2960
  const entrypoints = [];
2804
2961
  const dockerFunctions = [];
2805
2962
  if (config.functions == null) return { entrypoints, dockerFunctions };
@@ -2810,7 +2967,7 @@ var parseEntrypoints = import_effect23.Effect.fn("parseEntrypoints")(function* (
2810
2967
  functionPath: fnPath
2811
2968
  });
2812
2969
  }
2813
- const matchedFiles = yield* import_effect23.Effect.tryPromise({
2970
+ const matchedFiles = yield* import_effect24.Effect.tryPromise({
2814
2971
  try: () => getFilesForPattern(fnPath, projectFolder, func.excludeFiles),
2815
2972
  catch: (error) => new FunctionConfigError({
2816
2973
  message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,
@@ -2885,13 +3042,13 @@ var parseEntrypoints = import_effect23.Effect.fn("parseEntrypoints")(function* (
2885
3042
  }
2886
3043
  return { entrypoints, dockerFunctions };
2887
3044
  });
2888
- var collectAssets = import_effect23.Effect.fn("collectAssets")(function* (config, projectFolder) {
3045
+ var collectAssets = import_effect24.Effect.fn("collectAssets")(function* (config, projectFolder) {
2889
3046
  if (config.assets == null) return [];
2890
3047
  const assetNames = yield* collectAssetFiles(projectFolder, config.assets);
2891
3048
  return assetNames.filter((assetName) => getFunctionSettings(`${config.assets}/${assetName}`, config) == null).map((assetName) => `${config.assets}/${assetName}`);
2892
3049
  });
2893
3050
  var reservedRuntimePorts = (entrypoint) => entrypoint.runtime === CONTAINER_RUNTIME ? [] : entrypoint.runtime.startsWith("php-") ? [8080, 9e3] : [8080];
2894
- var parseContainers = import_effect23.Effect.fn("parseContainers")(function* (config, projectFolder, fileEntrypoints, dockerFunctions) {
3051
+ var parseContainers = import_effect24.Effect.fn("parseContainers")(function* (config, projectFolder, fileEntrypoints, dockerFunctions) {
2895
3052
  const warnings = [];
2896
3053
  let containers = {};
2897
3054
  if (config.compose != null) {
@@ -2924,16 +3081,16 @@ var parseContainers = import_effect23.Effect.fn("parseContainers")(function* (co
2924
3081
  }
2925
3082
  return { ...result, warnings };
2926
3083
  });
2927
- var V4ConfigParser = class extends import_effect23.Effect.Service()("V4ConfigParser", {
3084
+ var V4ConfigParser = class extends import_effect24.Effect.Service()("V4ConfigParser", {
2928
3085
  accessors: true,
2929
- effect: import_effect23.Effect.succeed({
3086
+ effect: import_effect24.Effect.succeed({
2930
3087
  /**
2931
3088
  * Parses a ConfigV4 into a NormalizedConfig.
2932
3089
  *
2933
3090
  * @param config - The raw V4 config object
2934
3091
  * @param projectFolder - Absolute path to the project root
2935
3092
  */
2936
- parse: import_effect23.Effect.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
3093
+ parse: import_effect24.Effect.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
2937
3094
  const { entrypoints: fileEntrypoints, dockerFunctions } = yield* parseEntrypoints(config, projectFolder);
2938
3095
  const containers = yield* parseContainers(config, projectFolder, fileEntrypoints, dockerFunctions);
2939
3096
  const entrypoints = [...fileEntrypoints, ...containers.entrypoints];
@@ -2975,7 +3132,7 @@ var V4ConfigParser = class extends import_effect23.Effect.Service()("V4ConfigPar
2975
3132
  };
2976
3133
 
2977
3134
  // src/services/vercel-build-output-parser.ts
2978
- var import_platform14 = require("@effect/platform");
3135
+ var import_platform15 = require("@effect/platform");
2979
3136
 
2980
3137
  // ../commons/src/deep-merge.ts
2981
3138
  var deepMerge = (target, ...partials) => {
@@ -3004,7 +3161,7 @@ var deepMerge = (target, ...partials) => {
3004
3161
  };
3005
3162
 
3006
3163
  // src/services/vercel-build-output-parser.ts
3007
- var import_effect24 = require("effect");
3164
+ var import_effect25 = require("effect");
3008
3165
 
3009
3166
  // src/build-output-v3/determine-repo-root.ts
3010
3167
  var import_path = __toESM(require("path"));
@@ -3100,11 +3257,11 @@ var translateVercelRuntime = (runtime) => {
3100
3257
  var CONFIG_PATH = ".vercel/output/config.json";
3101
3258
  var FUNCTIONS_FOLDER = ".vercel/output/functions";
3102
3259
  var FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;
3103
- var VercelBuildOutputParser = class extends import_effect24.Effect.Service()("VercelBuildOutputParser", {
3104
- effect: import_effect24.Effect.gen(function* () {
3260
+ var VercelBuildOutputParser = class extends import_effect25.Effect.Service()("VercelBuildOutputParser", {
3261
+ effect: import_effect25.Effect.gen(function* () {
3105
3262
  const rawConfigReader = yield* RawConfigReader;
3106
- const pathService = yield* import_platform14.Path.Path;
3107
- const parse = import_effect24.Effect.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
3263
+ const pathService = yield* import_platform15.Path.Path;
3264
+ const parse = import_effect25.Effect.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
3108
3265
  const config = yield* rawConfigReader.readConfigFile(pathService.join(projectFolder, CONFIG_PATH));
3109
3266
  if (!config || typeof config.version !== "number" || config.version < 3) {
3110
3267
  return parseResult;
@@ -3116,8 +3273,8 @@ var VercelBuildOutputParser = class extends import_effect24.Effect.Service()("Ve
3116
3273
  merged.regions = [...new Set(merged.regions)];
3117
3274
  return merged;
3118
3275
  });
3119
- const loadFunctions = import_effect24.Effect.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
3120
- const functionConfigs = yield* import_effect24.Effect.tryPromise({
3276
+ const loadFunctions = import_effect25.Effect.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
3277
+ const functionConfigs = yield* import_effect25.Effect.tryPromise({
3121
3278
  try: () => getFilesForPattern(FUNCTION_CONFIGS_PATTERN, projectFolder),
3122
3279
  catch: (error) => new ConfigFileParseError({
3123
3280
  message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,
@@ -4034,7 +4191,7 @@ var schema_default = {
4034
4191
  };
4035
4192
 
4036
4193
  // src/parse-config.ts
4037
- var parseConfigRaw = import_effect25.Effect.fn("parseConfigRaw")(function* (filePath, projectFolder) {
4194
+ var parseConfigRaw = import_effect26.Effect.fn("parseConfigRaw")(function* (filePath, projectFolder) {
4038
4195
  const rawReader = yield* RawConfigReader;
4039
4196
  const validator = yield* SchemaValidator;
4040
4197
  const v4Parser = yield* V4ConfigParser;
@@ -4045,7 +4202,7 @@ var parseConfigRaw = import_effect25.Effect.fn("parseConfigRaw")(function* (file
4045
4202
  };
4046
4203
  const schema = schemaMap[version];
4047
4204
  if (!schema) {
4048
- return yield* import_effect25.Effect.fail(
4205
+ return yield* import_effect26.Effect.fail(
4049
4206
  new ConfigVersionError({
4050
4207
  message: `Config file at ${filePath} has an unsupported version: ${version}`,
4051
4208
  filePath,
@@ -4056,11 +4213,11 @@ var parseConfigRaw = import_effect25.Effect.fn("parseConfigRaw")(function* (file
4056
4213
  yield* validator.validate(parsed, schema, filePath);
4057
4214
  return yield* v4Parser.parse(parsed, projectFolder);
4058
4215
  });
4059
- var parseConfig = import_effect25.Effect.fn("parseConfig")(function* (filePath, projectFolder) {
4216
+ var parseConfig = import_effect26.Effect.fn("parseConfig")(function* (filePath, projectFolder) {
4060
4217
  const parseResult = yield* parseConfigRaw(filePath, projectFolder);
4061
4218
  return yield* postProcessConfig(parseResult, projectFolder);
4062
4219
  });
4063
- var postProcessConfig = import_effect25.Effect.fn("postProcessConfig")(function* (config, projectFolder) {
4220
+ var postProcessConfig = import_effect26.Effect.fn("postProcessConfig")(function* (config, projectFolder) {
4064
4221
  const vercelParser = yield* VercelBuildOutputParser;
4065
4222
  let result = yield* vercelParser.parse(config, projectFolder);
4066
4223
  const hasAssets = (result.assets?.paths?.length ?? 0) > 0 || (result.assets?.prefixes?.length ?? 0) > 0 || (result.assets?.manifests?.length ?? 0) > 0;
@@ -4117,14 +4274,14 @@ var RUNTIME_DEFINITIONS = [
4117
4274
  var AVAILABLE_RUNTIMES = [...RUNTIME_DEFINITIONS];
4118
4275
 
4119
4276
  // src/services/index.ts
4120
- var import_effect26 = require("effect");
4121
- var BaseLayers = import_effect26.Layer.mergeAll(
4277
+ var import_effect27 = require("effect");
4278
+ var BaseLayers = import_effect27.Layer.mergeAll(
4122
4279
  ConfigModuleLoader.Default,
4123
4280
  RawConfigReader.Default,
4124
4281
  SchemaValidator.Default,
4125
4282
  V4ConfigParser.Default
4126
4283
  );
4127
- var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect26.Layer.provideMerge(BaseLayers));
4284
+ var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect27.Layer.provideMerge(BaseLayers));
4128
4285
  // Annotate the CommonJS export names for ESM import in node:
4129
4286
  0 && (module.exports = {
4130
4287
  ALLOWED_CONFIG_NAMES,