@gigadrive/network-config 5.3.1 → 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");
@@ -2006,6 +2006,157 @@ var phpSites = DOCUMENT_ROOTS.map((documentRoot) => ({
2006
2006
  refineDefaultConfig: (defaults, projectFolder) => refinePhpDocumentRoot(defaults, projectFolder).pipe(import_effect14.Effect.map((refined) => ({ ...refined, installCommand: "" })))
2007
2007
  }));
2008
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
+
2009
2160
  // src/detection/frameworks/remix.ts
2010
2161
  var remix = {
2011
2162
  slug: "remix",
@@ -2154,10 +2305,10 @@ var FRAMEWORK_DEFINITIONS = [
2154
2305
  ...phpComposerProjects,
2155
2306
  ...phpSites,
2156
2307
  vite
2157
- ].sort((a, b) => b.priority - a.priority);
2308
+ ].map((framework) => framework.language === "php" ? withComposerPhpRuntime(framework) : framework).sort((a, b) => b.priority - a.priority);
2158
2309
 
2159
2310
  // src/detection/generate-config.ts
2160
- var import_effect15 = require("effect");
2311
+ var import_effect16 = require("effect");
2161
2312
  var getInstallCommand = (pm) => {
2162
2313
  switch (pm) {
2163
2314
  case "bun":
@@ -2178,11 +2329,11 @@ var isPrivatePhpProjectFile = (projectPath) => {
2178
2329
  const segments = projectPath.split("/").filter((segment) => segment !== "" && segment !== ".");
2179
2330
  return segments.some((segment) => segment.startsWith(".")) || segments[0] === "vendor" || segments[0] === "node_modules" || segments.length === 1 && COMPOSER_ROOT_FILES.has(segments[0] ?? "");
2180
2331
  };
2181
- 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) {
2182
2333
  const defaults = refinedDefaults ?? framework.getDefaultConfig(packageManager);
2183
2334
  const installCmd = defaults.installCommand ?? getInstallCommand(packageManager);
2184
2335
  const commands = installCmd ? [installCmd, ...defaults.commands] : [...defaults.commands];
2185
- yield* import_effect15.Effect.logDebug(`Generating config for ${framework.name}`, {
2336
+ yield* import_effect16.Effect.logDebug(`Generating config for ${framework.name}`, {
2186
2337
  runtime: defaults.runtime,
2187
2338
  entrypoint: defaults.entrypoint,
2188
2339
  commands
@@ -2248,31 +2399,31 @@ var generateConfig = import_effect15.Effect.fn("generateConfig")(function* (fram
2248
2399
  });
2249
2400
 
2250
2401
  // src/detection/read-dependencies.ts
2251
- var import_platform11 = require("@effect/platform");
2252
- var import_effect17 = require("effect");
2402
+ var import_platform12 = require("@effect/platform");
2403
+ var import_effect18 = require("effect");
2253
2404
 
2254
2405
  // src/detection/types.ts
2255
- var import_effect16 = require("effect");
2256
- var ManifestNotFoundError = class extends import_effect16.Schema.TaggedError()("ManifestNotFoundError", {
2257
- message: import_effect16.Schema.String,
2258
- 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
2259
2410
  }) {
2260
2411
  };
2261
- var ManifestReadError = class extends import_effect16.Schema.TaggedError()("ManifestReadError", {
2262
- message: import_effect16.Schema.String,
2263
- 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
2264
2415
  }) {
2265
2416
  };
2266
- var ManifestParseError = class extends import_effect16.Schema.TaggedError()("ManifestParseError", {
2267
- message: import_effect16.Schema.String,
2268
- 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
2269
2420
  }) {
2270
2421
  };
2271
- var FrameworkNotDetectedError = class extends import_effect16.Schema.TaggedError()(
2422
+ var FrameworkNotDetectedError = class extends import_effect17.Schema.TaggedError()(
2272
2423
  "FrameworkNotDetectedError",
2273
2424
  {
2274
- message: import_effect16.Schema.String,
2275
- directory: import_effect16.Schema.String
2425
+ message: import_effect17.Schema.String,
2426
+ directory: import_effect17.Schema.String
2276
2427
  }
2277
2428
  ) {
2278
2429
  };
@@ -2282,25 +2433,25 @@ var MANIFEST_CONFIG = {
2282
2433
  node: { file: "package.json", depKeys: ["dependencies", "devDependencies"] },
2283
2434
  php: { file: "composer.json", depKeys: ["require", "require-dev"] }
2284
2435
  };
2285
- var readManifest = import_effect17.Effect.fn("readManifest")(function* (filePath) {
2286
- const fs = yield* import_platform11.FileSystem.FileSystem;
2287
- 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)));
2288
2439
  if (!exists) {
2289
- 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 }));
2290
2441
  }
2291
- const content = yield* fs.readFileString(filePath).pipe(import_effect17.Effect.mapError(() => new ManifestReadError({ message: "Failed to read manifest", filePath })));
2292
- 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({
2293
2444
  try: () => JSON.parse(content),
2294
2445
  catch: () => new ManifestParseError({ message: "Failed to parse manifest JSON", filePath })
2295
2446
  });
2296
2447
  return parsed;
2297
2448
  });
2298
- var readDependencies = import_effect17.Effect.fn("readDependencies")(function* (projectFolder, language) {
2299
- 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;
2300
2451
  const config = MANIFEST_CONFIG[language];
2301
2452
  const filePath = pathService.join(projectFolder, config.file);
2302
2453
  const manifest = yield* readManifest(filePath).pipe(
2303
- import_effect17.Effect.catchTag("ManifestNotFoundError", () => import_effect17.Effect.succeed(null))
2454
+ import_effect18.Effect.catchTag("ManifestNotFoundError", () => import_effect18.Effect.succeed(null))
2304
2455
  );
2305
2456
  if (!manifest) {
2306
2457
  return /* @__PURE__ */ new Set();
@@ -2318,9 +2469,9 @@ var readDependencies = import_effect17.Effect.fn("readDependencies")(function* (
2318
2469
  });
2319
2470
 
2320
2471
  // src/detection/detect-framework.ts
2321
- var matchesDetectionItem = import_effect18.Effect.fn("matchesDetectionItem")(function* (item, projectFolder, framework, cachedReadDeps) {
2322
- const fs = yield* import_platform12.FileSystem.FileSystem;
2323
- 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;
2324
2475
  if (item.matchPackage != null) {
2325
2476
  const deps = yield* cachedReadDeps(`${projectFolder}\0${framework.language}`);
2326
2477
  if (!deps.has(item.matchPackage)) {
@@ -2329,12 +2480,12 @@ var matchesDetectionItem = import_effect18.Effect.fn("matchesDetectionItem")(fun
2329
2480
  }
2330
2481
  if (item.path != null) {
2331
2482
  const filePath = pathService.join(projectFolder, item.path);
2332
- 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)));
2333
2484
  if (!exists) {
2334
2485
  return false;
2335
2486
  }
2336
2487
  if (item.matchContent != null) {
2337
- 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("")));
2338
2489
  let regexMatch = false;
2339
2490
  try {
2340
2491
  regexMatch = new RegExp(item.matchContent).test(content);
@@ -2347,7 +2498,7 @@ var matchesDetectionItem = import_effect18.Effect.fn("matchesDetectionItem")(fun
2347
2498
  }
2348
2499
  return true;
2349
2500
  });
2350
- var matchesFramework = import_effect18.Effect.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
2501
+ var matchesFramework = import_effect19.Effect.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
2351
2502
  for (const detector of framework.detectors) {
2352
2503
  const matches = yield* matchesDetectionItem(detector, projectFolder, framework, cachedReadDeps);
2353
2504
  if (!matches) {
@@ -2356,9 +2507,9 @@ var matchesFramework = import_effect18.Effect.fn("matchesFramework")(function* (
2356
2507
  }
2357
2508
  return true;
2358
2509
  });
2359
- var detectFramework = import_effect18.Effect.fn("detectFramework")(function* (projectFolder) {
2360
- yield* import_effect18.Effect.logDebug(`Detecting framework in ${projectFolder}`);
2361
- 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) => {
2362
2513
  const sepIndex = key.lastIndexOf("\0");
2363
2514
  const folder = key.slice(0, sepIndex);
2364
2515
  const language = key.slice(sepIndex + 1);
@@ -2367,7 +2518,7 @@ var detectFramework = import_effect18.Effect.fn("detectFramework")(function* (pr
2367
2518
  for (const framework of FRAMEWORK_DEFINITIONS) {
2368
2519
  const matches = yield* matchesFramework(framework, projectFolder, cachedReadDeps);
2369
2520
  if (matches) {
2370
- 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 });
2371
2522
  const detectedPackageManager = yield* detectPackageManager(projectFolder);
2372
2523
  const packageManager = framework.language === "php" ? "composer" : detectedPackageManager;
2373
2524
  const defaults = framework.getDefaultConfig(packageManager);
@@ -2376,7 +2527,7 @@ var detectFramework = import_effect18.Effect.fn("detectFramework")(function* (pr
2376
2527
  return { framework, packageManager, config };
2377
2528
  }
2378
2529
  }
2379
- return yield* import_effect18.Effect.fail(
2530
+ return yield* import_effect19.Effect.fail(
2380
2531
  new FrameworkNotDetectedError({
2381
2532
  message: `No framework detected in project directory`,
2382
2533
  directory: projectFolder
@@ -2385,9 +2536,9 @@ var detectFramework = import_effect18.Effect.fn("detectFramework")(function* (pr
2385
2536
  });
2386
2537
 
2387
2538
  // src/detection/merge-config.ts
2388
- var import_effect19 = require("effect");
2389
- var mergeWithFrameworkDefaults = import_effect19.Effect.fn("mergeWithFrameworkDefaults")(function* (userConfig, frameworkConfig) {
2390
- 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");
2391
2542
  const userHasAssets = (userConfig.assets?.paths?.length ?? 0) > 0 || (userConfig.assets?.prefixes?.length ?? 0) > 0 || (userConfig.assets?.manifests?.length ?? 0) > 0;
2392
2543
  const isContainer = (entrypoint) => entrypoint.runtime === CONTAINER_RUNTIME;
2393
2544
  const userFileFunctions = userConfig.entrypoints.filter((entrypoint) => !isContainer(entrypoint));
@@ -2428,23 +2579,23 @@ var filterFunctionsFromAssets = (config) => {
2428
2579
  };
2429
2580
 
2430
2581
  // src/parse-config.ts
2431
- var import_effect25 = require("effect");
2582
+ var import_effect26 = require("effect");
2432
2583
 
2433
2584
  // src/services/raw-config-reader.ts
2434
- var import_platform13 = require("@effect/platform");
2435
- var import_effect21 = require("effect");
2585
+ var import_platform14 = require("@effect/platform");
2586
+ var import_effect22 = require("effect");
2436
2587
  var import_yaml2 = require("yaml");
2437
2588
 
2438
2589
  // src/services/config-module-loader.ts
2439
- var import_effect20 = require("effect");
2590
+ var import_effect21 = require("effect");
2440
2591
  var import_jiti = require("jiti");
2441
2592
  var MISSING_DEFAULT_EXPORT = /* @__PURE__ */ Symbol("MissingDefaultExport");
2442
2593
  var STRICT_DEFAULT_EXPORT_EXTENSIONS = [".ts", ".mts", ".mjs"];
2443
- var ConfigModuleLoader = class extends import_effect20.Effect.Service()("ConfigModuleLoader", {
2444
- effect: import_effect20.Effect.gen(function* () {
2445
- 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) {
2446
2597
  const extension = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
2447
- const mod = yield* import_effect20.Effect.tryPromise({
2598
+ const mod = yield* import_effect21.Effect.tryPromise({
2448
2599
  try: async () => {
2449
2600
  const jiti = (0, import_jiti.createJiti)(filePath, { fsCache: false, interopDefault: true, moduleCache: false });
2450
2601
  const namespace = await jiti.import(filePath);
@@ -2463,7 +2614,7 @@ var ConfigModuleLoader = class extends import_effect20.Effect.Service()("ConfigM
2463
2614
  })
2464
2615
  });
2465
2616
  if (mod === MISSING_DEFAULT_EXPORT) {
2466
- return yield* import_effect20.Effect.fail(
2617
+ return yield* import_effect21.Effect.fail(
2467
2618
  new ConfigModuleLoadError({
2468
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.`,
2469
2620
  filePath
@@ -2471,7 +2622,7 @@ var ConfigModuleLoader = class extends import_effect20.Effect.Service()("ConfigM
2471
2622
  );
2472
2623
  }
2473
2624
  if (typeof mod === "function") {
2474
- return yield* import_effect20.Effect.fail(
2625
+ return yield* import_effect21.Effect.fail(
2475
2626
  new ConfigModuleLoadError({
2476
2627
  message: `Config module at ${filePath} default-exports a function; config factories are not supported. Export a config object instead (optionally wrapped in defineConfig).`,
2477
2628
  filePath
@@ -2479,7 +2630,7 @@ var ConfigModuleLoader = class extends import_effect20.Effect.Service()("ConfigM
2479
2630
  );
2480
2631
  }
2481
2632
  if (typeof mod !== "object" || mod === null || Array.isArray(mod)) {
2482
- return yield* import_effect20.Effect.fail(
2633
+ return yield* import_effect21.Effect.fail(
2483
2634
  new ConfigModuleLoadError({
2484
2635
  message: `Config module at ${filePath} must default-export a config object.`,
2485
2636
  filePath
@@ -2509,36 +2660,36 @@ var ALLOWED_CONFIG_NAMES = [
2509
2660
  "nebula.json"
2510
2661
  ];
2511
2662
  var MODULE_EXTENSIONS = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"];
2512
- var RawConfigReader = class extends import_effect21.Effect.Service()("RawConfigReader", {
2663
+ var RawConfigReader = class extends import_effect22.Effect.Service()("RawConfigReader", {
2513
2664
  dependencies: [ConfigModuleLoader.Default],
2514
- effect: import_effect21.Effect.gen(function* () {
2515
- const fs = yield* import_platform13.FileSystem.FileSystem;
2516
- 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;
2517
2668
  const moduleLoader = yield* ConfigModuleLoader;
2518
- const findConfig = import_effect21.Effect.fn("RawConfigReader.findConfig")(function* (projectFolder) {
2669
+ const findConfig = import_effect22.Effect.fn("RawConfigReader.findConfig")(function* (projectFolder) {
2519
2670
  for (const name of ALLOWED_CONFIG_NAMES) {
2520
2671
  const filePath = pathService.join(projectFolder, name);
2521
- 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)));
2522
2673
  if (exists) {
2523
2674
  return filePath;
2524
2675
  }
2525
2676
  }
2526
2677
  return null;
2527
2678
  });
2528
- const readRawConfig = import_effect21.Effect.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
2529
- 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)));
2530
2681
  if (!exists) {
2531
- return yield* import_effect21.Effect.fail(
2682
+ return yield* import_effect22.Effect.fail(
2532
2683
  new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })
2533
2684
  );
2534
2685
  }
2535
2686
  const fileContents = yield* fs.readFileString(filePath).pipe(
2536
- import_effect21.Effect.mapError(
2687
+ import_effect22.Effect.mapError(
2537
2688
  () => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })
2538
2689
  )
2539
2690
  );
2540
2691
  if (fileContents.length === 0) {
2541
- return yield* import_effect21.Effect.fail(
2692
+ return yield* import_effect22.Effect.fail(
2542
2693
  new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })
2543
2694
  );
2544
2695
  }
@@ -2554,7 +2705,7 @@ var RawConfigReader = class extends import_effect21.Effect.Service()("RawConfigR
2554
2705
  parsed = (0, import_yaml2.parse)(fileContents);
2555
2706
  }
2556
2707
  } catch (error) {
2557
- return yield* import_effect21.Effect.fail(
2708
+ return yield* import_effect22.Effect.fail(
2558
2709
  new ConfigFileParseError({
2559
2710
  message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
2560
2711
  filePath,
@@ -2564,21 +2715,21 @@ var RawConfigReader = class extends import_effect21.Effect.Service()("RawConfigR
2564
2715
  }
2565
2716
  }
2566
2717
  if (parsed == null) {
2567
- return yield* import_effect21.Effect.fail(
2718
+ return yield* import_effect22.Effect.fail(
2568
2719
  new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })
2569
2720
  );
2570
2721
  }
2571
2722
  if (!options?.disableVersionCheck && typeof parsed.version !== "number") {
2572
- return yield* import_effect21.Effect.fail(
2723
+ return yield* import_effect22.Effect.fail(
2573
2724
  new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })
2574
2725
  );
2575
2726
  }
2576
2727
  return parsed;
2577
2728
  });
2578
2729
  const readConfigFile = (configFilePath) => readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(
2579
- import_effect21.Effect.map((parsed) => parsed),
2580
- import_effect21.Effect.catchTag("ConfigFileNotFoundError", () => import_effect21.Effect.succeed(null)),
2581
- 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")
2582
2733
  );
2583
2734
  return { findConfig, readRawConfig, readConfigFile };
2584
2735
  })
@@ -2588,17 +2739,17 @@ var RawConfigReader = class extends import_effect21.Effect.Service()("RawConfigR
2588
2739
  // src/services/schema-validator.ts
2589
2740
  var import_ajv = __toESM(require("ajv"));
2590
2741
  var import_ajv_formats = __toESM(require("ajv-formats"));
2591
- var import_effect22 = require("effect");
2592
- var SchemaValidator = class extends import_effect22.Effect.Service()("SchemaValidator", {
2593
- 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* () {
2594
2745
  const ajv = new import_ajv.default();
2595
2746
  (0, import_ajv_formats.default)(ajv);
2596
- 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) {
2597
2748
  const compiledValidate = ajv.compile(schema);
2598
2749
  const valid = compiledValidate(config);
2599
2750
  if (!valid) {
2600
2751
  const errors = compiledValidate.errors?.map((e) => `${e.instancePath || "/"} ${e.message ?? ""}`.trim()) ?? [];
2601
- return yield* import_effect22.Effect.fail(
2752
+ return yield* import_effect23.Effect.fail(
2602
2753
  new ConfigSchemaValidationError({
2603
2754
  message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,
2604
2755
  filePath,
@@ -2654,7 +2805,7 @@ var getFilesForPattern = async (pattern, projectFolder, excludeFiles = []) => {
2654
2805
  };
2655
2806
 
2656
2807
  // src/services/v4-config-parser.ts
2657
- var import_effect23 = require("effect");
2808
+ var import_effect24 = require("effect");
2658
2809
  var import_minimatch2 = require("minimatch");
2659
2810
  var import_node_path2 = require("path");
2660
2811
  var import_safe_regex2 = __toESM(require("safe-regex2"));
@@ -2805,7 +2956,7 @@ var mapRoute = (route, entrypoints) => ({
2805
2956
  negativeRequirements: route.missing,
2806
2957
  status: route.statusCode
2807
2958
  });
2808
- var parseEntrypoints = import_effect23.Effect.fn("parseEntrypoints")(function* (config, projectFolder) {
2959
+ var parseEntrypoints = import_effect24.Effect.fn("parseEntrypoints")(function* (config, projectFolder) {
2809
2960
  const entrypoints = [];
2810
2961
  const dockerFunctions = [];
2811
2962
  if (config.functions == null) return { entrypoints, dockerFunctions };
@@ -2816,7 +2967,7 @@ var parseEntrypoints = import_effect23.Effect.fn("parseEntrypoints")(function* (
2816
2967
  functionPath: fnPath
2817
2968
  });
2818
2969
  }
2819
- const matchedFiles = yield* import_effect23.Effect.tryPromise({
2970
+ const matchedFiles = yield* import_effect24.Effect.tryPromise({
2820
2971
  try: () => getFilesForPattern(fnPath, projectFolder, func.excludeFiles),
2821
2972
  catch: (error) => new FunctionConfigError({
2822
2973
  message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,
@@ -2891,13 +3042,13 @@ var parseEntrypoints = import_effect23.Effect.fn("parseEntrypoints")(function* (
2891
3042
  }
2892
3043
  return { entrypoints, dockerFunctions };
2893
3044
  });
2894
- var collectAssets = import_effect23.Effect.fn("collectAssets")(function* (config, projectFolder) {
3045
+ var collectAssets = import_effect24.Effect.fn("collectAssets")(function* (config, projectFolder) {
2895
3046
  if (config.assets == null) return [];
2896
3047
  const assetNames = yield* collectAssetFiles(projectFolder, config.assets);
2897
3048
  return assetNames.filter((assetName) => getFunctionSettings(`${config.assets}/${assetName}`, config) == null).map((assetName) => `${config.assets}/${assetName}`);
2898
3049
  });
2899
3050
  var reservedRuntimePorts = (entrypoint) => entrypoint.runtime === CONTAINER_RUNTIME ? [] : entrypoint.runtime.startsWith("php-") ? [8080, 9e3] : [8080];
2900
- 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) {
2901
3052
  const warnings = [];
2902
3053
  let containers = {};
2903
3054
  if (config.compose != null) {
@@ -2930,16 +3081,16 @@ var parseContainers = import_effect23.Effect.fn("parseContainers")(function* (co
2930
3081
  }
2931
3082
  return { ...result, warnings };
2932
3083
  });
2933
- var V4ConfigParser = class extends import_effect23.Effect.Service()("V4ConfigParser", {
3084
+ var V4ConfigParser = class extends import_effect24.Effect.Service()("V4ConfigParser", {
2934
3085
  accessors: true,
2935
- effect: import_effect23.Effect.succeed({
3086
+ effect: import_effect24.Effect.succeed({
2936
3087
  /**
2937
3088
  * Parses a ConfigV4 into a NormalizedConfig.
2938
3089
  *
2939
3090
  * @param config - The raw V4 config object
2940
3091
  * @param projectFolder - Absolute path to the project root
2941
3092
  */
2942
- parse: import_effect23.Effect.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
3093
+ parse: import_effect24.Effect.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
2943
3094
  const { entrypoints: fileEntrypoints, dockerFunctions } = yield* parseEntrypoints(config, projectFolder);
2944
3095
  const containers = yield* parseContainers(config, projectFolder, fileEntrypoints, dockerFunctions);
2945
3096
  const entrypoints = [...fileEntrypoints, ...containers.entrypoints];
@@ -2981,7 +3132,7 @@ var V4ConfigParser = class extends import_effect23.Effect.Service()("V4ConfigPar
2981
3132
  };
2982
3133
 
2983
3134
  // src/services/vercel-build-output-parser.ts
2984
- var import_platform14 = require("@effect/platform");
3135
+ var import_platform15 = require("@effect/platform");
2985
3136
 
2986
3137
  // ../commons/src/deep-merge.ts
2987
3138
  var deepMerge = (target, ...partials) => {
@@ -3010,7 +3161,7 @@ var deepMerge = (target, ...partials) => {
3010
3161
  };
3011
3162
 
3012
3163
  // src/services/vercel-build-output-parser.ts
3013
- var import_effect24 = require("effect");
3164
+ var import_effect25 = require("effect");
3014
3165
 
3015
3166
  // src/build-output-v3/determine-repo-root.ts
3016
3167
  var import_path = __toESM(require("path"));
@@ -3106,11 +3257,11 @@ var translateVercelRuntime = (runtime) => {
3106
3257
  var CONFIG_PATH = ".vercel/output/config.json";
3107
3258
  var FUNCTIONS_FOLDER = ".vercel/output/functions";
3108
3259
  var FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;
3109
- var VercelBuildOutputParser = class extends import_effect24.Effect.Service()("VercelBuildOutputParser", {
3110
- effect: import_effect24.Effect.gen(function* () {
3260
+ var VercelBuildOutputParser = class extends import_effect25.Effect.Service()("VercelBuildOutputParser", {
3261
+ effect: import_effect25.Effect.gen(function* () {
3111
3262
  const rawConfigReader = yield* RawConfigReader;
3112
- const pathService = yield* import_platform14.Path.Path;
3113
- 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) {
3114
3265
  const config = yield* rawConfigReader.readConfigFile(pathService.join(projectFolder, CONFIG_PATH));
3115
3266
  if (!config || typeof config.version !== "number" || config.version < 3) {
3116
3267
  return parseResult;
@@ -3122,8 +3273,8 @@ var VercelBuildOutputParser = class extends import_effect24.Effect.Service()("Ve
3122
3273
  merged.regions = [...new Set(merged.regions)];
3123
3274
  return merged;
3124
3275
  });
3125
- const loadFunctions = import_effect24.Effect.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
3126
- 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({
3127
3278
  try: () => getFilesForPattern(FUNCTION_CONFIGS_PATTERN, projectFolder),
3128
3279
  catch: (error) => new ConfigFileParseError({
3129
3280
  message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,
@@ -4040,7 +4191,7 @@ var schema_default = {
4040
4191
  };
4041
4192
 
4042
4193
  // src/parse-config.ts
4043
- var parseConfigRaw = import_effect25.Effect.fn("parseConfigRaw")(function* (filePath, projectFolder) {
4194
+ var parseConfigRaw = import_effect26.Effect.fn("parseConfigRaw")(function* (filePath, projectFolder) {
4044
4195
  const rawReader = yield* RawConfigReader;
4045
4196
  const validator = yield* SchemaValidator;
4046
4197
  const v4Parser = yield* V4ConfigParser;
@@ -4051,7 +4202,7 @@ var parseConfigRaw = import_effect25.Effect.fn("parseConfigRaw")(function* (file
4051
4202
  };
4052
4203
  const schema = schemaMap[version];
4053
4204
  if (!schema) {
4054
- return yield* import_effect25.Effect.fail(
4205
+ return yield* import_effect26.Effect.fail(
4055
4206
  new ConfigVersionError({
4056
4207
  message: `Config file at ${filePath} has an unsupported version: ${version}`,
4057
4208
  filePath,
@@ -4062,11 +4213,11 @@ var parseConfigRaw = import_effect25.Effect.fn("parseConfigRaw")(function* (file
4062
4213
  yield* validator.validate(parsed, schema, filePath);
4063
4214
  return yield* v4Parser.parse(parsed, projectFolder);
4064
4215
  });
4065
- var parseConfig = import_effect25.Effect.fn("parseConfig")(function* (filePath, projectFolder) {
4216
+ var parseConfig = import_effect26.Effect.fn("parseConfig")(function* (filePath, projectFolder) {
4066
4217
  const parseResult = yield* parseConfigRaw(filePath, projectFolder);
4067
4218
  return yield* postProcessConfig(parseResult, projectFolder);
4068
4219
  });
4069
- var postProcessConfig = import_effect25.Effect.fn("postProcessConfig")(function* (config, projectFolder) {
4220
+ var postProcessConfig = import_effect26.Effect.fn("postProcessConfig")(function* (config, projectFolder) {
4070
4221
  const vercelParser = yield* VercelBuildOutputParser;
4071
4222
  let result = yield* vercelParser.parse(config, projectFolder);
4072
4223
  const hasAssets = (result.assets?.paths?.length ?? 0) > 0 || (result.assets?.prefixes?.length ?? 0) > 0 || (result.assets?.manifests?.length ?? 0) > 0;
@@ -4123,14 +4274,14 @@ var RUNTIME_DEFINITIONS = [
4123
4274
  var AVAILABLE_RUNTIMES = [...RUNTIME_DEFINITIONS];
4124
4275
 
4125
4276
  // src/services/index.ts
4126
- var import_effect26 = require("effect");
4127
- var BaseLayers = import_effect26.Layer.mergeAll(
4277
+ var import_effect27 = require("effect");
4278
+ var BaseLayers = import_effect27.Layer.mergeAll(
4128
4279
  ConfigModuleLoader.Default,
4129
4280
  RawConfigReader.Default,
4130
4281
  SchemaValidator.Default,
4131
4282
  V4ConfigParser.Default
4132
4283
  );
4133
- var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect26.Layer.provideMerge(BaseLayers));
4284
+ var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect27.Layer.provideMerge(BaseLayers));
4134
4285
  // Annotate the CommonJS export names for ESM import in node:
4135
4286
  0 && (module.exports = {
4136
4287
  ALLOWED_CONFIG_NAMES,