@gigadrive/network-config 5.1.0 → 5.3.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.mjs CHANGED
@@ -905,8 +905,8 @@ var detectContainerProject = Effect3.fn("detectContainerProject")(function* (pro
905
905
  });
906
906
 
907
907
  // src/detection/detect-framework.ts
908
- import { FileSystem as FileSystem11, Path as Path9 } from "@effect/platform";
909
- import { Effect as Effect13 } from "effect";
908
+ import { FileSystem as FileSystem12, Path as Path10 } from "@effect/platform";
909
+ import { Effect as Effect14 } from "effect";
910
910
 
911
911
  // src/detection/detect-package-manager.ts
912
912
  import { FileSystem as FileSystem4, Path as Path4 } from "@effect/platform";
@@ -955,6 +955,73 @@ var astro = {
955
955
  })
956
956
  };
957
957
 
958
+ // src/detection/generated-secret.ts
959
+ var generatedSecret = (format) => `{{gigadrive.secret:${format}}}`;
960
+
961
+ // src/detection/frameworks/php-front-controller.ts
962
+ var phpFrontControllerDefaults = ({
963
+ documentRoot,
964
+ writablePaths = [],
965
+ excludeFiles = [],
966
+ memory = 256,
967
+ environmentVariables = {}
968
+ }) => {
969
+ const entrypoint = documentRoot === "." ? "index.php" : `${documentRoot}/index.php`;
970
+ return {
971
+ runtime: "php-84",
972
+ memory,
973
+ maxDuration: 30,
974
+ streaming: false,
975
+ commands: [],
976
+ entrypoint,
977
+ assetsDir: documentRoot,
978
+ excludeFiles: [".ddev", "node_modules/", ...excludeFiles],
979
+ routes: [{ source: "/*", destination: entrypoint }],
980
+ environmentVariables,
981
+ ...writablePaths.length > 0 ? { package: { writablePaths } } : {}
982
+ };
983
+ };
984
+
985
+ // src/detection/frameworks/cakephp.ts
986
+ var cakephp = {
987
+ slug: "cakephp",
988
+ name: "CakePHP",
989
+ language: "php",
990
+ detectors: [{ matchPackage: "cakephp/cakephp" }, { path: "webroot/index.php" }],
991
+ priority: 80,
992
+ getDefaultConfig: () => phpFrontControllerDefaults({
993
+ documentRoot: "webroot",
994
+ // config/paths.php puts TMP and LOGS inside the project.
995
+ writablePaths: [
996
+ "tmp/cache/models",
997
+ "tmp/cache/persistent",
998
+ "tmp/cache/views",
999
+ "tmp/sessions",
1000
+ "tmp/tests",
1001
+ "logs"
1002
+ ],
1003
+ excludeFiles: ["tests/", "tmp/", "logs/"],
1004
+ // config/app.php reads the salt from env; app_local.php is not committed.
1005
+ environmentVariables: { SECURITY_SALT: generatedSecret("hex") }
1006
+ })
1007
+ };
1008
+
1009
+ // src/detection/frameworks/codeigniter.ts
1010
+ var codeigniter = {
1011
+ slug: "codeigniter",
1012
+ name: "CodeIgniter",
1013
+ language: "php",
1014
+ detectors: [{ matchPackage: "codeigniter4/framework" }, { path: "spark" }],
1015
+ priority: 80,
1016
+ getDefaultConfig: () => phpFrontControllerDefaults({
1017
+ documentRoot: "public",
1018
+ // WRITEPATH: the cache, file session and log handlers write below it.
1019
+ writablePaths: ["writable/cache", "writable/debugbar", "writable/logs", "writable/session", "writable/uploads"],
1020
+ excludeFiles: ["tests/", "writable/"],
1021
+ environmentVariables: { CI_ENVIRONMENT: "production" }
1022
+ })
1023
+ };
1024
+
958
1025
  // src/detection/frameworks/resolve-node-entrypoint.ts
959
1026
  import { FileSystem as FileSystem5, Path as Path5 } from "@effect/platform";
960
1027
  import { Effect as Effect5 } from "effect";
@@ -1112,6 +1179,21 @@ var hono = {
1112
1179
  refineDefaultConfig: resolveNodeServerEntrypoint
1113
1180
  };
1114
1181
 
1182
+ // src/detection/frameworks/laminas.ts
1183
+ var laminas = {
1184
+ slug: "laminas",
1185
+ name: "Laminas MVC",
1186
+ language: "php",
1187
+ detectors: [{ matchPackage: "laminas/laminas-mvc" }, { path: "public/index.php" }],
1188
+ priority: 80,
1189
+ getDefaultConfig: () => phpFrontControllerDefaults({
1190
+ documentRoot: "public",
1191
+ // The merged-config and module-map caches of the skeleton.
1192
+ writablePaths: ["data/cache"],
1193
+ excludeFiles: ["test/", "data/cache/"]
1194
+ })
1195
+ };
1196
+
1115
1197
  // src/detection/frameworks/laravel.ts
1116
1198
  var laravel = {
1117
1199
  slug: "laravel",
@@ -1130,7 +1212,21 @@ var laravel = {
1130
1212
  populateAssetCache: true,
1131
1213
  excludeFiles: ["tests/", "storage/", ".ddev", "node_modules/"],
1132
1214
  routes: [{ source: "/*", destination: "public/index.php" }],
1215
+ package: {
1216
+ // storage/ is excluded, so the directories Laravel writes compiled
1217
+ // views, file caches, sessions and logs to are created empty.
1218
+ writablePaths: [
1219
+ "bootstrap/cache",
1220
+ "storage/app/public",
1221
+ "storage/framework/cache/data",
1222
+ "storage/framework/sessions",
1223
+ "storage/framework/views",
1224
+ "storage/logs"
1225
+ ]
1226
+ },
1133
1227
  environmentVariables: {
1228
+ // Encrypts cookies and sessions; Laravel cannot serve a page without it.
1229
+ APP_KEY: generatedSecret("laravel-app-key"),
1134
1230
  APP_NAME: "Laravel",
1135
1231
  APP_ENV: "production",
1136
1232
  APP_DEBUG: "false",
@@ -1138,11 +1234,29 @@ var laravel = {
1138
1234
  LOG_DEPRECATIONS_CHANNEL: "stderr",
1139
1235
  LOG_LEVEL: "debug",
1140
1236
  BROADCAST_DRIVER: "log",
1141
- SESSION_DRIVER: "cookie"
1237
+ SESSION_DRIVER: "cookie",
1238
+ // The skeleton defaults both to `database`, which needs a migrated database.
1239
+ CACHE_STORE: "file",
1240
+ QUEUE_CONNECTION: "sync"
1142
1241
  }
1143
1242
  })
1144
1243
  };
1145
1244
 
1245
+ // src/detection/frameworks/mezzio.ts
1246
+ var mezzio = {
1247
+ slug: "mezzio",
1248
+ name: "Mezzio",
1249
+ language: "php",
1250
+ detectors: [{ matchPackage: "mezzio/mezzio" }, { path: "public/index.php" }],
1251
+ priority: 80,
1252
+ getDefaultConfig: () => phpFrontControllerDefaults({
1253
+ documentRoot: "public",
1254
+ // config/config.php writes the merged config cache here.
1255
+ writablePaths: ["data/cache"],
1256
+ excludeFiles: ["test/", "data/cache/"]
1257
+ })
1258
+ };
1259
+
1146
1260
  // src/detection/frameworks/nestjs.ts
1147
1261
  import { FileSystem as FileSystem6 } from "@effect/platform";
1148
1262
  import { Effect as Effect6 } from "effect";
@@ -1746,6 +1860,43 @@ var nuxt = {
1746
1860
  })
1747
1861
  };
1748
1862
 
1863
+ // src/detection/frameworks/php.ts
1864
+ import { FileSystem as FileSystem10, Path as Path8 } from "@effect/platform";
1865
+ import { Effect as Effect10 } from "effect";
1866
+ var COMPOSER_FILES = ["composer.json", "composer.lock"];
1867
+ var DOCUMENT_ROOTS = ["public", "web", "webroot", "public_html", "htdocs", "."];
1868
+ var refinePhpDocumentRoot = (defaults, projectFolder) => Effect10.gen(function* () {
1869
+ const fs = yield* FileSystem10.FileSystem;
1870
+ const pathService = yield* Path8.Path;
1871
+ for (const documentRoot of DOCUMENT_ROOTS) {
1872
+ const frontController = pathService.join(projectFolder, documentRoot, "index.php");
1873
+ if (yield* fs.exists(frontController).pipe(Effect10.catchAll(() => Effect10.succeed(false)))) {
1874
+ return phpFrontControllerDefaults({ documentRoot, excludeFiles: COMPOSER_FILES });
1875
+ }
1876
+ }
1877
+ return defaults;
1878
+ });
1879
+ var getDefaultConfig = () => phpFrontControllerDefaults({ documentRoot: ".", excludeFiles: COMPOSER_FILES });
1880
+ var frontControllerPath = (documentRoot) => documentRoot === "." ? "index.php" : `${documentRoot}/index.php`;
1881
+ var phpComposerProjects = DOCUMENT_ROOTS.map((documentRoot) => ({
1882
+ slug: "php",
1883
+ name: "PHP",
1884
+ language: "php",
1885
+ detectors: [{ path: "composer.json" }, { path: frontControllerPath(documentRoot) }],
1886
+ priority: 7,
1887
+ getDefaultConfig,
1888
+ refineDefaultConfig: refinePhpDocumentRoot
1889
+ }));
1890
+ var phpSites = DOCUMENT_ROOTS.map((documentRoot) => ({
1891
+ slug: "php-site",
1892
+ name: "PHP",
1893
+ language: "php",
1894
+ detectors: [{ path: frontControllerPath(documentRoot) }],
1895
+ priority: 6,
1896
+ getDefaultConfig: () => ({ ...getDefaultConfig(), installCommand: "" }),
1897
+ refineDefaultConfig: (defaults, projectFolder) => refinePhpDocumentRoot(defaults, projectFolder).pipe(Effect10.map((refined) => ({ ...refined, installCommand: "" })))
1898
+ }));
1899
+
1749
1900
  // src/detection/frameworks/remix.ts
1750
1901
  var remix = {
1751
1902
  slug: "remix",
@@ -1767,6 +1918,21 @@ var remix = {
1767
1918
  })
1768
1919
  };
1769
1920
 
1921
+ // src/detection/frameworks/slim.ts
1922
+ var slim = {
1923
+ slug: "slim",
1924
+ name: "Slim",
1925
+ language: "php",
1926
+ detectors: [{ matchPackage: "slim/slim" }, { path: "public/index.php" }],
1927
+ priority: 75,
1928
+ getDefaultConfig: () => phpFrontControllerDefaults({
1929
+ documentRoot: "public",
1930
+ // slim/slim-skeleton logs to logs/ and caches the container and routes in var/cache.
1931
+ writablePaths: ["logs", "var/cache"],
1932
+ excludeFiles: ["tests/", "logs/", "var/"]
1933
+ })
1934
+ };
1935
+
1770
1936
  // src/detection/frameworks/sveltekit.ts
1771
1937
  var sveltekit = {
1772
1938
  slug: "sveltekit",
@@ -1806,12 +1972,15 @@ var symfony = {
1806
1972
  assetsDir: "public",
1807
1973
  populateAssetCache: true,
1808
1974
  excludeFiles: ["tests/*", ".ddev", "var"],
1809
- symlinks: { var: "/tmp" },
1810
1975
  routes: [{ source: "/*", destination: "public/index.php" }],
1976
+ // The kernel's cache and log directories. A symlink to /tmp used to stand
1977
+ // in for them, which the build rejected as pointing outside the project.
1978
+ package: { writablePaths: ["var/cache", "var/log"] },
1811
1979
  environmentVariables: {
1812
1980
  APP_ENV: "prod",
1813
1981
  APP_DEBUG: "false",
1814
- APP_SECRET: "please_change_this_value_in_your_settings",
1982
+ // CSRF tokens, signed URLs and remember-me cookies.
1983
+ APP_SECRET: generatedSecret("hex"),
1815
1984
  MESSENGER_TRANSPORT_DSN: "doctrine://default?auto_setup=0"
1816
1985
  }
1817
1986
  })
@@ -1837,6 +2006,22 @@ var vite = {
1837
2006
  })
1838
2007
  };
1839
2008
 
2009
+ // src/detection/frameworks/yii.ts
2010
+ var yii = {
2011
+ slug: "yii",
2012
+ name: "Yii 2",
2013
+ language: "php",
2014
+ detectors: [{ matchPackage: "yiisoft/yii2" }, { path: "web/index.php" }],
2015
+ priority: 80,
2016
+ getDefaultConfig: () => phpFrontControllerDefaults({
2017
+ documentRoot: "web",
2018
+ // @runtime holds cache, logs and sessions; the asset manager publishes
2019
+ // bundles from vendor/ into web/assets when a page first uses them.
2020
+ writablePaths: ["runtime", "web/assets"],
2021
+ excludeFiles: ["tests/", "runtime/", "web/assets/"]
2022
+ })
2023
+ };
2024
+
1840
2025
  // src/detection/frameworks/index.ts
1841
2026
  var FRAMEWORK_DEFINITIONS = [
1842
2027
  nextjs,
@@ -1847,15 +2032,23 @@ var FRAMEWORK_DEFINITIONS = [
1847
2032
  astro,
1848
2033
  laravel,
1849
2034
  symfony,
2035
+ cakephp,
2036
+ codeigniter,
2037
+ laminas,
2038
+ mezzio,
2039
+ yii,
2040
+ slim,
1850
2041
  hono,
1851
2042
  elysia,
1852
2043
  fastify,
1853
2044
  express,
2045
+ ...phpComposerProjects,
2046
+ ...phpSites,
1854
2047
  vite
1855
2048
  ].sort((a, b) => b.priority - a.priority);
1856
2049
 
1857
2050
  // src/detection/generate-config.ts
1858
- import { Effect as Effect10 } from "effect";
2051
+ import { Effect as Effect11 } from "effect";
1859
2052
  var getInstallCommand = (pm) => {
1860
2053
  switch (pm) {
1861
2054
  case "bun":
@@ -1871,11 +2064,16 @@ var getInstallCommand = (pm) => {
1871
2064
  return "npm install";
1872
2065
  }
1873
2066
  };
1874
- var generateConfig = Effect10.fn("generateConfig")(function* (framework, packageManager, projectFolder, refinedDefaults) {
2067
+ var COMPOSER_ROOT_FILES = /* @__PURE__ */ new Set(["composer.json", "composer.lock", "auth.json"]);
2068
+ var isPrivatePhpProjectFile = (projectPath) => {
2069
+ const segments = projectPath.split("/").filter((segment) => segment !== "" && segment !== ".");
2070
+ return segments.some((segment) => segment.startsWith(".")) || segments[0] === "vendor" || segments[0] === "node_modules" || segments.length === 1 && COMPOSER_ROOT_FILES.has(segments[0] ?? "");
2071
+ };
2072
+ var generateConfig = Effect11.fn("generateConfig")(function* (framework, packageManager, projectFolder, refinedDefaults) {
1875
2073
  const defaults = refinedDefaults ?? framework.getDefaultConfig(packageManager);
1876
2074
  const installCmd = defaults.installCommand ?? getInstallCommand(packageManager);
1877
- const commands = [installCmd, ...defaults.commands];
1878
- yield* Effect10.logDebug(`Generating config for ${framework.name}`, {
2075
+ const commands = installCmd ? [installCmd, ...defaults.commands] : [...defaults.commands];
2076
+ yield* Effect11.logDebug(`Generating config for ${framework.name}`, {
1879
2077
  runtime: defaults.runtime,
1880
2078
  entrypoint: defaults.entrypoint,
1881
2079
  commands
@@ -1917,6 +2115,7 @@ var generateConfig = Effect10.fn("generateConfig")(function* (framework, package
1917
2115
  if (assetsDir && !defaults.assetPaths && !defaults.assetPrefixes && !defaults.assetManifests) {
1918
2116
  for (const file of yield* collectAssetFiles(projectFolder, assetsDir)) {
1919
2117
  if (framework.language === "php" && /\.(php|phtml|phar)$/i.test(file)) continue;
2118
+ if (framework.language === "php" && isPrivatePhpProjectFile(`${assetsDir}/${file}`)) continue;
1920
2119
  paths.push(`${assetsDir}/${file}`);
1921
2120
  if (!servesDirectoryIndexes || file in overrides) continue;
1922
2121
  if (file === "index.html") {
@@ -1940,8 +2139,8 @@ var generateConfig = Effect10.fn("generateConfig")(function* (framework, package
1940
2139
  });
1941
2140
 
1942
2141
  // src/detection/read-dependencies.ts
1943
- import { FileSystem as FileSystem10, Path as Path8 } from "@effect/platform";
1944
- import { Effect as Effect12 } from "effect";
2142
+ import { FileSystem as FileSystem11, Path as Path9 } from "@effect/platform";
2143
+ import { Effect as Effect13 } from "effect";
1945
2144
 
1946
2145
  // src/detection/types.ts
1947
2146
  import { Schema as Schema5 } from "effect";
@@ -1974,25 +2173,25 @@ var MANIFEST_CONFIG = {
1974
2173
  node: { file: "package.json", depKeys: ["dependencies", "devDependencies"] },
1975
2174
  php: { file: "composer.json", depKeys: ["require", "require-dev"] }
1976
2175
  };
1977
- var readManifest = Effect12.fn("readManifest")(function* (filePath) {
1978
- const fs = yield* FileSystem10.FileSystem;
1979
- const exists = yield* fs.exists(filePath).pipe(Effect12.catchAll(() => Effect12.succeed(false)));
2176
+ var readManifest = Effect13.fn("readManifest")(function* (filePath) {
2177
+ const fs = yield* FileSystem11.FileSystem;
2178
+ const exists = yield* fs.exists(filePath).pipe(Effect13.catchAll(() => Effect13.succeed(false)));
1980
2179
  if (!exists) {
1981
- return yield* Effect12.fail(new ManifestNotFoundError({ message: "Manifest not found", filePath }));
2180
+ return yield* Effect13.fail(new ManifestNotFoundError({ message: "Manifest not found", filePath }));
1982
2181
  }
1983
- const content = yield* fs.readFileString(filePath).pipe(Effect12.mapError(() => new ManifestReadError({ message: "Failed to read manifest", filePath })));
1984
- const parsed = yield* Effect12.try({
2182
+ const content = yield* fs.readFileString(filePath).pipe(Effect13.mapError(() => new ManifestReadError({ message: "Failed to read manifest", filePath })));
2183
+ const parsed = yield* Effect13.try({
1985
2184
  try: () => JSON.parse(content),
1986
2185
  catch: () => new ManifestParseError({ message: "Failed to parse manifest JSON", filePath })
1987
2186
  });
1988
2187
  return parsed;
1989
2188
  });
1990
- var readDependencies = Effect12.fn("readDependencies")(function* (projectFolder, language) {
1991
- const pathService = yield* Path8.Path;
2189
+ var readDependencies = Effect13.fn("readDependencies")(function* (projectFolder, language) {
2190
+ const pathService = yield* Path9.Path;
1992
2191
  const config = MANIFEST_CONFIG[language];
1993
2192
  const filePath = pathService.join(projectFolder, config.file);
1994
2193
  const manifest = yield* readManifest(filePath).pipe(
1995
- Effect12.catchTag("ManifestNotFoundError", () => Effect12.succeed(null))
2194
+ Effect13.catchTag("ManifestNotFoundError", () => Effect13.succeed(null))
1996
2195
  );
1997
2196
  if (!manifest) {
1998
2197
  return /* @__PURE__ */ new Set();
@@ -2010,9 +2209,9 @@ var readDependencies = Effect12.fn("readDependencies")(function* (projectFolder,
2010
2209
  });
2011
2210
 
2012
2211
  // src/detection/detect-framework.ts
2013
- var matchesDetectionItem = Effect13.fn("matchesDetectionItem")(function* (item, projectFolder, framework, cachedReadDeps) {
2014
- const fs = yield* FileSystem11.FileSystem;
2015
- const pathService = yield* Path9.Path;
2212
+ var matchesDetectionItem = Effect14.fn("matchesDetectionItem")(function* (item, projectFolder, framework, cachedReadDeps) {
2213
+ const fs = yield* FileSystem12.FileSystem;
2214
+ const pathService = yield* Path10.Path;
2016
2215
  if (item.matchPackage != null) {
2017
2216
  const deps = yield* cachedReadDeps(`${projectFolder}\0${framework.language}`);
2018
2217
  if (!deps.has(item.matchPackage)) {
@@ -2021,12 +2220,12 @@ var matchesDetectionItem = Effect13.fn("matchesDetectionItem")(function* (item,
2021
2220
  }
2022
2221
  if (item.path != null) {
2023
2222
  const filePath = pathService.join(projectFolder, item.path);
2024
- const exists = yield* fs.exists(filePath).pipe(Effect13.catchAll(() => Effect13.succeed(false)));
2223
+ const exists = yield* fs.exists(filePath).pipe(Effect14.catchAll(() => Effect14.succeed(false)));
2025
2224
  if (!exists) {
2026
2225
  return false;
2027
2226
  }
2028
2227
  if (item.matchContent != null) {
2029
- const content = yield* fs.readFileString(filePath).pipe(Effect13.catchAll(() => Effect13.succeed("")));
2228
+ const content = yield* fs.readFileString(filePath).pipe(Effect14.catchAll(() => Effect14.succeed("")));
2030
2229
  let regexMatch = false;
2031
2230
  try {
2032
2231
  regexMatch = new RegExp(item.matchContent).test(content);
@@ -2039,7 +2238,7 @@ var matchesDetectionItem = Effect13.fn("matchesDetectionItem")(function* (item,
2039
2238
  }
2040
2239
  return true;
2041
2240
  });
2042
- var matchesFramework = Effect13.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
2241
+ var matchesFramework = Effect14.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
2043
2242
  for (const detector of framework.detectors) {
2044
2243
  const matches = yield* matchesDetectionItem(detector, projectFolder, framework, cachedReadDeps);
2045
2244
  if (!matches) {
@@ -2048,9 +2247,9 @@ var matchesFramework = Effect13.fn("matchesFramework")(function* (framework, pro
2048
2247
  }
2049
2248
  return true;
2050
2249
  });
2051
- var detectFramework = Effect13.fn("detectFramework")(function* (projectFolder) {
2052
- yield* Effect13.logDebug(`Detecting framework in ${projectFolder}`);
2053
- const cachedReadDeps = yield* Effect13.cachedFunction((key) => {
2250
+ var detectFramework = Effect14.fn("detectFramework")(function* (projectFolder) {
2251
+ yield* Effect14.logDebug(`Detecting framework in ${projectFolder}`);
2252
+ const cachedReadDeps = yield* Effect14.cachedFunction((key) => {
2054
2253
  const sepIndex = key.lastIndexOf("\0");
2055
2254
  const folder = key.slice(0, sepIndex);
2056
2255
  const language = key.slice(sepIndex + 1);
@@ -2059,7 +2258,7 @@ var detectFramework = Effect13.fn("detectFramework")(function* (projectFolder) {
2059
2258
  for (const framework of FRAMEWORK_DEFINITIONS) {
2060
2259
  const matches = yield* matchesFramework(framework, projectFolder, cachedReadDeps);
2061
2260
  if (matches) {
2062
- yield* Effect13.log(`Detected framework: ${framework.name}`, { slug: framework.slug });
2261
+ yield* Effect14.log(`Detected framework: ${framework.name}`, { slug: framework.slug });
2063
2262
  const detectedPackageManager = yield* detectPackageManager(projectFolder);
2064
2263
  const packageManager = framework.language === "php" ? "composer" : detectedPackageManager;
2065
2264
  const defaults = framework.getDefaultConfig(packageManager);
@@ -2068,7 +2267,7 @@ var detectFramework = Effect13.fn("detectFramework")(function* (projectFolder) {
2068
2267
  return { framework, packageManager, config };
2069
2268
  }
2070
2269
  }
2071
- return yield* Effect13.fail(
2270
+ return yield* Effect14.fail(
2072
2271
  new FrameworkNotDetectedError({
2073
2272
  message: `No framework detected in project directory`,
2074
2273
  directory: projectFolder
@@ -2077,9 +2276,9 @@ var detectFramework = Effect13.fn("detectFramework")(function* (projectFolder) {
2077
2276
  });
2078
2277
 
2079
2278
  // src/detection/merge-config.ts
2080
- import { Effect as Effect14 } from "effect";
2081
- var mergeWithFrameworkDefaults = Effect14.fn("mergeWithFrameworkDefaults")(function* (userConfig, frameworkConfig) {
2082
- yield* Effect14.logDebug("Merging user config with framework defaults");
2279
+ import { Effect as Effect15 } from "effect";
2280
+ var mergeWithFrameworkDefaults = Effect15.fn("mergeWithFrameworkDefaults")(function* (userConfig, frameworkConfig) {
2281
+ yield* Effect15.logDebug("Merging user config with framework defaults");
2083
2282
  const userHasAssets = (userConfig.assets?.paths?.length ?? 0) > 0 || (userConfig.assets?.prefixes?.length ?? 0) > 0 || (userConfig.assets?.manifests?.length ?? 0) > 0;
2084
2283
  const isContainer = (entrypoint) => entrypoint.runtime === CONTAINER_RUNTIME;
2085
2284
  const userFileFunctions = userConfig.entrypoints.filter((entrypoint) => !isContainer(entrypoint));
@@ -2120,23 +2319,23 @@ var filterFunctionsFromAssets = (config) => {
2120
2319
  };
2121
2320
 
2122
2321
  // src/parse-config.ts
2123
- import { Effect as Effect20 } from "effect";
2322
+ import { Effect as Effect21 } from "effect";
2124
2323
 
2125
2324
  // src/services/raw-config-reader.ts
2126
- import { FileSystem as FileSystem12, Path as Path10 } from "@effect/platform";
2127
- import { Effect as Effect16 } from "effect";
2325
+ import { FileSystem as FileSystem13, Path as Path11 } from "@effect/platform";
2326
+ import { Effect as Effect17 } from "effect";
2128
2327
  import { parse as parseYaml2 } from "yaml";
2129
2328
 
2130
2329
  // src/services/config-module-loader.ts
2131
- import { Effect as Effect15 } from "effect";
2330
+ import { Effect as Effect16 } from "effect";
2132
2331
  import { createJiti } from "jiti";
2133
2332
  var MISSING_DEFAULT_EXPORT = /* @__PURE__ */ Symbol("MissingDefaultExport");
2134
2333
  var STRICT_DEFAULT_EXPORT_EXTENSIONS = [".ts", ".mts", ".mjs"];
2135
- var ConfigModuleLoader = class extends Effect15.Service()("ConfigModuleLoader", {
2136
- effect: Effect15.gen(function* () {
2137
- const loadConfigModule = Effect15.fn("ConfigModuleLoader.loadConfigModule")(function* (filePath) {
2334
+ var ConfigModuleLoader = class extends Effect16.Service()("ConfigModuleLoader", {
2335
+ effect: Effect16.gen(function* () {
2336
+ const loadConfigModule = Effect16.fn("ConfigModuleLoader.loadConfigModule")(function* (filePath) {
2138
2337
  const extension = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
2139
- const mod = yield* Effect15.tryPromise({
2338
+ const mod = yield* Effect16.tryPromise({
2140
2339
  try: async () => {
2141
2340
  const jiti = createJiti(filePath, { fsCache: false, interopDefault: true, moduleCache: false });
2142
2341
  const namespace = await jiti.import(filePath);
@@ -2155,7 +2354,7 @@ var ConfigModuleLoader = class extends Effect15.Service()("ConfigModuleLoader",
2155
2354
  })
2156
2355
  });
2157
2356
  if (mod === MISSING_DEFAULT_EXPORT) {
2158
- return yield* Effect15.fail(
2357
+ return yield* Effect16.fail(
2159
2358
  new ConfigModuleLoadError({
2160
2359
  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.`,
2161
2360
  filePath
@@ -2163,7 +2362,7 @@ var ConfigModuleLoader = class extends Effect15.Service()("ConfigModuleLoader",
2163
2362
  );
2164
2363
  }
2165
2364
  if (typeof mod === "function") {
2166
- return yield* Effect15.fail(
2365
+ return yield* Effect16.fail(
2167
2366
  new ConfigModuleLoadError({
2168
2367
  message: `Config module at ${filePath} default-exports a function; config factories are not supported. Export a config object instead (optionally wrapped in defineConfig).`,
2169
2368
  filePath
@@ -2171,7 +2370,7 @@ var ConfigModuleLoader = class extends Effect15.Service()("ConfigModuleLoader",
2171
2370
  );
2172
2371
  }
2173
2372
  if (typeof mod !== "object" || mod === null || Array.isArray(mod)) {
2174
- return yield* Effect15.fail(
2373
+ return yield* Effect16.fail(
2175
2374
  new ConfigModuleLoadError({
2176
2375
  message: `Config module at ${filePath} must default-export a config object.`,
2177
2376
  filePath
@@ -2201,36 +2400,36 @@ var ALLOWED_CONFIG_NAMES = [
2201
2400
  "nebula.json"
2202
2401
  ];
2203
2402
  var MODULE_EXTENSIONS = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"];
2204
- var RawConfigReader = class extends Effect16.Service()("RawConfigReader", {
2403
+ var RawConfigReader = class extends Effect17.Service()("RawConfigReader", {
2205
2404
  dependencies: [ConfigModuleLoader.Default],
2206
- effect: Effect16.gen(function* () {
2207
- const fs = yield* FileSystem12.FileSystem;
2208
- const pathService = yield* Path10.Path;
2405
+ effect: Effect17.gen(function* () {
2406
+ const fs = yield* FileSystem13.FileSystem;
2407
+ const pathService = yield* Path11.Path;
2209
2408
  const moduleLoader = yield* ConfigModuleLoader;
2210
- const findConfig = Effect16.fn("RawConfigReader.findConfig")(function* (projectFolder) {
2409
+ const findConfig = Effect17.fn("RawConfigReader.findConfig")(function* (projectFolder) {
2211
2410
  for (const name of ALLOWED_CONFIG_NAMES) {
2212
2411
  const filePath = pathService.join(projectFolder, name);
2213
- const exists = yield* fs.exists(filePath).pipe(Effect16.catchAll(() => Effect16.succeed(false)));
2412
+ const exists = yield* fs.exists(filePath).pipe(Effect17.catchAll(() => Effect17.succeed(false)));
2214
2413
  if (exists) {
2215
2414
  return filePath;
2216
2415
  }
2217
2416
  }
2218
2417
  return null;
2219
2418
  });
2220
- const readRawConfig = Effect16.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
2221
- const exists = yield* fs.exists(filePath).pipe(Effect16.catchAll(() => Effect16.succeed(false)));
2419
+ const readRawConfig = Effect17.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
2420
+ const exists = yield* fs.exists(filePath).pipe(Effect17.catchAll(() => Effect17.succeed(false)));
2222
2421
  if (!exists) {
2223
- return yield* Effect16.fail(
2422
+ return yield* Effect17.fail(
2224
2423
  new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })
2225
2424
  );
2226
2425
  }
2227
2426
  const fileContents = yield* fs.readFileString(filePath).pipe(
2228
- Effect16.mapError(
2427
+ Effect17.mapError(
2229
2428
  () => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })
2230
2429
  )
2231
2430
  );
2232
2431
  if (fileContents.length === 0) {
2233
- return yield* Effect16.fail(
2432
+ return yield* Effect17.fail(
2234
2433
  new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })
2235
2434
  );
2236
2435
  }
@@ -2246,7 +2445,7 @@ var RawConfigReader = class extends Effect16.Service()("RawConfigReader", {
2246
2445
  parsed = parseYaml2(fileContents);
2247
2446
  }
2248
2447
  } catch (error) {
2249
- return yield* Effect16.fail(
2448
+ return yield* Effect17.fail(
2250
2449
  new ConfigFileParseError({
2251
2450
  message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
2252
2451
  filePath,
@@ -2256,21 +2455,21 @@ var RawConfigReader = class extends Effect16.Service()("RawConfigReader", {
2256
2455
  }
2257
2456
  }
2258
2457
  if (parsed == null) {
2259
- return yield* Effect16.fail(
2458
+ return yield* Effect17.fail(
2260
2459
  new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })
2261
2460
  );
2262
2461
  }
2263
2462
  if (!options?.disableVersionCheck && typeof parsed.version !== "number") {
2264
- return yield* Effect16.fail(
2463
+ return yield* Effect17.fail(
2265
2464
  new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })
2266
2465
  );
2267
2466
  }
2268
2467
  return parsed;
2269
2468
  });
2270
2469
  const readConfigFile = (configFilePath) => readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(
2271
- Effect16.map((parsed) => parsed),
2272
- Effect16.catchTag("ConfigFileNotFoundError", () => Effect16.succeed(null)),
2273
- Effect16.withSpan("RawConfigReader.readConfigFile")
2470
+ Effect17.map((parsed) => parsed),
2471
+ Effect17.catchTag("ConfigFileNotFoundError", () => Effect17.succeed(null)),
2472
+ Effect17.withSpan("RawConfigReader.readConfigFile")
2274
2473
  );
2275
2474
  return { findConfig, readRawConfig, readConfigFile };
2276
2475
  })
@@ -2280,17 +2479,17 @@ var RawConfigReader = class extends Effect16.Service()("RawConfigReader", {
2280
2479
  // src/services/schema-validator.ts
2281
2480
  import Ajv from "ajv";
2282
2481
  import addFormats from "ajv-formats";
2283
- import { Effect as Effect17 } from "effect";
2284
- var SchemaValidator = class extends Effect17.Service()("SchemaValidator", {
2285
- effect: Effect17.gen(function* () {
2482
+ import { Effect as Effect18 } from "effect";
2483
+ var SchemaValidator = class extends Effect18.Service()("SchemaValidator", {
2484
+ effect: Effect18.gen(function* () {
2286
2485
  const ajv = new Ajv();
2287
2486
  addFormats(ajv);
2288
- const validate = Effect17.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
2487
+ const validate = Effect18.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
2289
2488
  const compiledValidate = ajv.compile(schema);
2290
2489
  const valid = compiledValidate(config);
2291
2490
  if (!valid) {
2292
2491
  const errors = compiledValidate.errors?.map((e) => `${e.instancePath || "/"} ${e.message ?? ""}`.trim()) ?? [];
2293
- return yield* Effect17.fail(
2492
+ return yield* Effect18.fail(
2294
2493
  new ConfigSchemaValidationError({
2295
2494
  message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,
2296
2495
  filePath,
@@ -2346,7 +2545,7 @@ var getFilesForPattern = async (pattern, projectFolder, excludeFiles = []) => {
2346
2545
  };
2347
2546
 
2348
2547
  // src/services/v4-config-parser.ts
2349
- import { Effect as Effect18 } from "effect";
2548
+ import { Effect as Effect19 } from "effect";
2350
2549
  import { minimatch as minimatch2 } from "minimatch";
2351
2550
  import { posix as posix2 } from "path";
2352
2551
  import safeRegex from "safe-regex2";
@@ -2497,7 +2696,7 @@ var mapRoute = (route, entrypoints) => ({
2497
2696
  negativeRequirements: route.missing,
2498
2697
  status: route.statusCode
2499
2698
  });
2500
- var parseEntrypoints = Effect18.fn("parseEntrypoints")(function* (config, projectFolder) {
2699
+ var parseEntrypoints = Effect19.fn("parseEntrypoints")(function* (config, projectFolder) {
2501
2700
  const entrypoints = [];
2502
2701
  const dockerFunctions = [];
2503
2702
  if (config.functions == null) return { entrypoints, dockerFunctions };
@@ -2508,7 +2707,7 @@ var parseEntrypoints = Effect18.fn("parseEntrypoints")(function* (config, projec
2508
2707
  functionPath: fnPath
2509
2708
  });
2510
2709
  }
2511
- const matchedFiles = yield* Effect18.tryPromise({
2710
+ const matchedFiles = yield* Effect19.tryPromise({
2512
2711
  try: () => getFilesForPattern(fnPath, projectFolder, func.excludeFiles),
2513
2712
  catch: (error) => new FunctionConfigError({
2514
2713
  message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,
@@ -2583,13 +2782,13 @@ var parseEntrypoints = Effect18.fn("parseEntrypoints")(function* (config, projec
2583
2782
  }
2584
2783
  return { entrypoints, dockerFunctions };
2585
2784
  });
2586
- var collectAssets = Effect18.fn("collectAssets")(function* (config, projectFolder) {
2785
+ var collectAssets = Effect19.fn("collectAssets")(function* (config, projectFolder) {
2587
2786
  if (config.assets == null) return [];
2588
2787
  const assetNames = yield* collectAssetFiles(projectFolder, config.assets);
2589
2788
  return assetNames.filter((assetName) => getFunctionSettings(`${config.assets}/${assetName}`, config) == null).map((assetName) => `${config.assets}/${assetName}`);
2590
2789
  });
2591
2790
  var reservedRuntimePorts = (entrypoint) => entrypoint.runtime === CONTAINER_RUNTIME ? [] : entrypoint.runtime.startsWith("php-") ? [8080, 9e3] : [8080];
2592
- var parseContainers = Effect18.fn("parseContainers")(function* (config, projectFolder, fileEntrypoints, dockerFunctions) {
2791
+ var parseContainers = Effect19.fn("parseContainers")(function* (config, projectFolder, fileEntrypoints, dockerFunctions) {
2593
2792
  const warnings = [];
2594
2793
  let containers = {};
2595
2794
  if (config.compose != null) {
@@ -2622,16 +2821,16 @@ var parseContainers = Effect18.fn("parseContainers")(function* (config, projectF
2622
2821
  }
2623
2822
  return { ...result, warnings };
2624
2823
  });
2625
- var V4ConfigParser = class extends Effect18.Service()("V4ConfigParser", {
2824
+ var V4ConfigParser = class extends Effect19.Service()("V4ConfigParser", {
2626
2825
  accessors: true,
2627
- effect: Effect18.succeed({
2826
+ effect: Effect19.succeed({
2628
2827
  /**
2629
2828
  * Parses a ConfigV4 into a NormalizedConfig.
2630
2829
  *
2631
2830
  * @param config - The raw V4 config object
2632
2831
  * @param projectFolder - Absolute path to the project root
2633
2832
  */
2634
- parse: Effect18.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
2833
+ parse: Effect19.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
2635
2834
  const { entrypoints: fileEntrypoints, dockerFunctions } = yield* parseEntrypoints(config, projectFolder);
2636
2835
  const containers = yield* parseContainers(config, projectFolder, fileEntrypoints, dockerFunctions);
2637
2836
  const entrypoints = [...fileEntrypoints, ...containers.entrypoints];
@@ -2673,7 +2872,7 @@ var V4ConfigParser = class extends Effect18.Service()("V4ConfigParser", {
2673
2872
  };
2674
2873
 
2675
2874
  // src/services/vercel-build-output-parser.ts
2676
- import { Path as Path11 } from "@effect/platform";
2875
+ import { Path as Path12 } from "@effect/platform";
2677
2876
 
2678
2877
  // ../commons/src/deep-merge.ts
2679
2878
  var deepMerge = (target, ...partials) => {
@@ -2702,7 +2901,7 @@ var deepMerge = (target, ...partials) => {
2702
2901
  };
2703
2902
 
2704
2903
  // src/services/vercel-build-output-parser.ts
2705
- import { Effect as Effect19 } from "effect";
2904
+ import { Effect as Effect20 } from "effect";
2706
2905
 
2707
2906
  // src/build-output-v3/determine-repo-root.ts
2708
2907
  import path from "path";
@@ -2798,11 +2997,11 @@ var translateVercelRuntime = (runtime) => {
2798
2997
  var CONFIG_PATH = ".vercel/output/config.json";
2799
2998
  var FUNCTIONS_FOLDER = ".vercel/output/functions";
2800
2999
  var FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;
2801
- var VercelBuildOutputParser = class extends Effect19.Service()("VercelBuildOutputParser", {
2802
- effect: Effect19.gen(function* () {
3000
+ var VercelBuildOutputParser = class extends Effect20.Service()("VercelBuildOutputParser", {
3001
+ effect: Effect20.gen(function* () {
2803
3002
  const rawConfigReader = yield* RawConfigReader;
2804
- const pathService = yield* Path11.Path;
2805
- const parse = Effect19.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
3003
+ const pathService = yield* Path12.Path;
3004
+ const parse = Effect20.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
2806
3005
  const config = yield* rawConfigReader.readConfigFile(pathService.join(projectFolder, CONFIG_PATH));
2807
3006
  if (!config || typeof config.version !== "number" || config.version < 3) {
2808
3007
  return parseResult;
@@ -2814,8 +3013,8 @@ var VercelBuildOutputParser = class extends Effect19.Service()("VercelBuildOutpu
2814
3013
  merged.regions = [...new Set(merged.regions)];
2815
3014
  return merged;
2816
3015
  });
2817
- const loadFunctions = Effect19.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
2818
- const functionConfigs = yield* Effect19.tryPromise({
3016
+ const loadFunctions = Effect20.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
3017
+ const functionConfigs = yield* Effect20.tryPromise({
2819
3018
  try: () => getFilesForPattern(FUNCTION_CONFIGS_PATTERN, projectFolder),
2820
3019
  catch: (error) => new ConfigFileParseError({
2821
3020
  message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,
@@ -3732,7 +3931,7 @@ var schema_default = {
3732
3931
  };
3733
3932
 
3734
3933
  // src/parse-config.ts
3735
- var parseConfigRaw = Effect20.fn("parseConfigRaw")(function* (filePath, projectFolder) {
3934
+ var parseConfigRaw = Effect21.fn("parseConfigRaw")(function* (filePath, projectFolder) {
3736
3935
  const rawReader = yield* RawConfigReader;
3737
3936
  const validator = yield* SchemaValidator;
3738
3937
  const v4Parser = yield* V4ConfigParser;
@@ -3743,7 +3942,7 @@ var parseConfigRaw = Effect20.fn("parseConfigRaw")(function* (filePath, projectF
3743
3942
  };
3744
3943
  const schema = schemaMap[version];
3745
3944
  if (!schema) {
3746
- return yield* Effect20.fail(
3945
+ return yield* Effect21.fail(
3747
3946
  new ConfigVersionError({
3748
3947
  message: `Config file at ${filePath} has an unsupported version: ${version}`,
3749
3948
  filePath,
@@ -3754,11 +3953,11 @@ var parseConfigRaw = Effect20.fn("parseConfigRaw")(function* (filePath, projectF
3754
3953
  yield* validator.validate(parsed, schema, filePath);
3755
3954
  return yield* v4Parser.parse(parsed, projectFolder);
3756
3955
  });
3757
- var parseConfig = Effect20.fn("parseConfig")(function* (filePath, projectFolder) {
3956
+ var parseConfig = Effect21.fn("parseConfig")(function* (filePath, projectFolder) {
3758
3957
  const parseResult = yield* parseConfigRaw(filePath, projectFolder);
3759
3958
  return yield* postProcessConfig(parseResult, projectFolder);
3760
3959
  });
3761
- var postProcessConfig = Effect20.fn("postProcessConfig")(function* (config, projectFolder) {
3960
+ var postProcessConfig = Effect21.fn("postProcessConfig")(function* (config, projectFolder) {
3762
3961
  const vercelParser = yield* VercelBuildOutputParser;
3763
3962
  let result = yield* vercelParser.parse(config, projectFolder);
3764
3963
  const hasAssets = (result.assets?.paths?.length ?? 0) > 0 || (result.assets?.prefixes?.length ?? 0) > 0 || (result.assets?.manifests?.length ?? 0) > 0;
@@ -3879,6 +4078,7 @@ export {
3879
4078
  dockerFunctionContainerName,
3880
4079
  filterFunctionsFromAssets,
3881
4080
  generateConfig,
4081
+ generatedSecret,
3882
4082
  getFunctionSettings,
3883
4083
  mergeWithFrameworkDefaults,
3884
4084
  normalizeContainers,