@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.d.mts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +304 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +287 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -85,6 +85,7 @@ __export(src_exports, {
|
|
|
85
85
|
dockerFunctionContainerName: () => dockerFunctionContainerName,
|
|
86
86
|
filterFunctionsFromAssets: () => filterFunctionsFromAssets,
|
|
87
87
|
generateConfig: () => generateConfig,
|
|
88
|
+
generatedSecret: () => generatedSecret,
|
|
88
89
|
getFunctionSettings: () => getFunctionSettings,
|
|
89
90
|
mergeWithFrameworkDefaults: () => mergeWithFrameworkDefaults,
|
|
90
91
|
normalizeContainers: () => normalizeContainers,
|
|
@@ -1007,8 +1008,8 @@ var detectContainerProject = import_effect6.Effect.fn("detectContainerProject")(
|
|
|
1007
1008
|
});
|
|
1008
1009
|
|
|
1009
1010
|
// src/detection/detect-framework.ts
|
|
1010
|
-
var
|
|
1011
|
-
var
|
|
1011
|
+
var import_platform12 = require("@effect/platform");
|
|
1012
|
+
var import_effect18 = require("effect");
|
|
1012
1013
|
|
|
1013
1014
|
// src/detection/detect-package-manager.ts
|
|
1014
1015
|
var import_platform4 = require("@effect/platform");
|
|
@@ -1057,6 +1058,73 @@ var astro = {
|
|
|
1057
1058
|
})
|
|
1058
1059
|
};
|
|
1059
1060
|
|
|
1061
|
+
// src/detection/generated-secret.ts
|
|
1062
|
+
var generatedSecret = (format) => `{{gigadrive.secret:${format}}}`;
|
|
1063
|
+
|
|
1064
|
+
// src/detection/frameworks/php-front-controller.ts
|
|
1065
|
+
var phpFrontControllerDefaults = ({
|
|
1066
|
+
documentRoot,
|
|
1067
|
+
writablePaths = [],
|
|
1068
|
+
excludeFiles = [],
|
|
1069
|
+
memory = 256,
|
|
1070
|
+
environmentVariables = {}
|
|
1071
|
+
}) => {
|
|
1072
|
+
const entrypoint = documentRoot === "." ? "index.php" : `${documentRoot}/index.php`;
|
|
1073
|
+
return {
|
|
1074
|
+
runtime: "php-84",
|
|
1075
|
+
memory,
|
|
1076
|
+
maxDuration: 30,
|
|
1077
|
+
streaming: false,
|
|
1078
|
+
commands: [],
|
|
1079
|
+
entrypoint,
|
|
1080
|
+
assetsDir: documentRoot,
|
|
1081
|
+
excludeFiles: [".ddev", "node_modules/", ...excludeFiles],
|
|
1082
|
+
routes: [{ source: "/*", destination: entrypoint }],
|
|
1083
|
+
environmentVariables,
|
|
1084
|
+
...writablePaths.length > 0 ? { package: { writablePaths } } : {}
|
|
1085
|
+
};
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
// src/detection/frameworks/cakephp.ts
|
|
1089
|
+
var cakephp = {
|
|
1090
|
+
slug: "cakephp",
|
|
1091
|
+
name: "CakePHP",
|
|
1092
|
+
language: "php",
|
|
1093
|
+
detectors: [{ matchPackage: "cakephp/cakephp" }, { path: "webroot/index.php" }],
|
|
1094
|
+
priority: 80,
|
|
1095
|
+
getDefaultConfig: () => phpFrontControllerDefaults({
|
|
1096
|
+
documentRoot: "webroot",
|
|
1097
|
+
// config/paths.php puts TMP and LOGS inside the project.
|
|
1098
|
+
writablePaths: [
|
|
1099
|
+
"tmp/cache/models",
|
|
1100
|
+
"tmp/cache/persistent",
|
|
1101
|
+
"tmp/cache/views",
|
|
1102
|
+
"tmp/sessions",
|
|
1103
|
+
"tmp/tests",
|
|
1104
|
+
"logs"
|
|
1105
|
+
],
|
|
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") }
|
|
1109
|
+
})
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
// src/detection/frameworks/codeigniter.ts
|
|
1113
|
+
var codeigniter = {
|
|
1114
|
+
slug: "codeigniter",
|
|
1115
|
+
name: "CodeIgniter",
|
|
1116
|
+
language: "php",
|
|
1117
|
+
detectors: [{ matchPackage: "codeigniter4/framework" }, { path: "spark" }],
|
|
1118
|
+
priority: 80,
|
|
1119
|
+
getDefaultConfig: () => phpFrontControllerDefaults({
|
|
1120
|
+
documentRoot: "public",
|
|
1121
|
+
// WRITEPATH: the cache, file session and log handlers write below it.
|
|
1122
|
+
writablePaths: ["writable/cache", "writable/debugbar", "writable/logs", "writable/session", "writable/uploads"],
|
|
1123
|
+
excludeFiles: ["tests/", "writable/"],
|
|
1124
|
+
environmentVariables: { CI_ENVIRONMENT: "production" }
|
|
1125
|
+
})
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1060
1128
|
// src/detection/frameworks/resolve-node-entrypoint.ts
|
|
1061
1129
|
var import_platform5 = require("@effect/platform");
|
|
1062
1130
|
var import_effect8 = require("effect");
|
|
@@ -1214,6 +1282,21 @@ var hono = {
|
|
|
1214
1282
|
refineDefaultConfig: resolveNodeServerEntrypoint
|
|
1215
1283
|
};
|
|
1216
1284
|
|
|
1285
|
+
// src/detection/frameworks/laminas.ts
|
|
1286
|
+
var laminas = {
|
|
1287
|
+
slug: "laminas",
|
|
1288
|
+
name: "Laminas MVC",
|
|
1289
|
+
language: "php",
|
|
1290
|
+
detectors: [{ matchPackage: "laminas/laminas-mvc" }, { path: "public/index.php" }],
|
|
1291
|
+
priority: 80,
|
|
1292
|
+
getDefaultConfig: () => phpFrontControllerDefaults({
|
|
1293
|
+
documentRoot: "public",
|
|
1294
|
+
// The merged-config and module-map caches of the skeleton.
|
|
1295
|
+
writablePaths: ["data/cache"],
|
|
1296
|
+
excludeFiles: ["test/", "data/cache/"]
|
|
1297
|
+
})
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1217
1300
|
// src/detection/frameworks/laravel.ts
|
|
1218
1301
|
var laravel = {
|
|
1219
1302
|
slug: "laravel",
|
|
@@ -1232,7 +1315,21 @@ var laravel = {
|
|
|
1232
1315
|
populateAssetCache: true,
|
|
1233
1316
|
excludeFiles: ["tests/", "storage/", ".ddev", "node_modules/"],
|
|
1234
1317
|
routes: [{ source: "/*", destination: "public/index.php" }],
|
|
1318
|
+
package: {
|
|
1319
|
+
// storage/ is excluded, so the directories Laravel writes compiled
|
|
1320
|
+
// views, file caches, sessions and logs to are created empty.
|
|
1321
|
+
writablePaths: [
|
|
1322
|
+
"bootstrap/cache",
|
|
1323
|
+
"storage/app/public",
|
|
1324
|
+
"storage/framework/cache/data",
|
|
1325
|
+
"storage/framework/sessions",
|
|
1326
|
+
"storage/framework/views",
|
|
1327
|
+
"storage/logs"
|
|
1328
|
+
]
|
|
1329
|
+
},
|
|
1235
1330
|
environmentVariables: {
|
|
1331
|
+
// Encrypts cookies and sessions; Laravel cannot serve a page without it.
|
|
1332
|
+
APP_KEY: generatedSecret("laravel-app-key"),
|
|
1236
1333
|
APP_NAME: "Laravel",
|
|
1237
1334
|
APP_ENV: "production",
|
|
1238
1335
|
APP_DEBUG: "false",
|
|
@@ -1240,11 +1337,29 @@ var laravel = {
|
|
|
1240
1337
|
LOG_DEPRECATIONS_CHANNEL: "stderr",
|
|
1241
1338
|
LOG_LEVEL: "debug",
|
|
1242
1339
|
BROADCAST_DRIVER: "log",
|
|
1243
|
-
SESSION_DRIVER: "cookie"
|
|
1340
|
+
SESSION_DRIVER: "cookie",
|
|
1341
|
+
// The skeleton defaults both to `database`, which needs a migrated database.
|
|
1342
|
+
CACHE_STORE: "file",
|
|
1343
|
+
QUEUE_CONNECTION: "sync"
|
|
1244
1344
|
}
|
|
1245
1345
|
})
|
|
1246
1346
|
};
|
|
1247
1347
|
|
|
1348
|
+
// src/detection/frameworks/mezzio.ts
|
|
1349
|
+
var mezzio = {
|
|
1350
|
+
slug: "mezzio",
|
|
1351
|
+
name: "Mezzio",
|
|
1352
|
+
language: "php",
|
|
1353
|
+
detectors: [{ matchPackage: "mezzio/mezzio" }, { path: "public/index.php" }],
|
|
1354
|
+
priority: 80,
|
|
1355
|
+
getDefaultConfig: () => phpFrontControllerDefaults({
|
|
1356
|
+
documentRoot: "public",
|
|
1357
|
+
// config/config.php writes the merged config cache here.
|
|
1358
|
+
writablePaths: ["data/cache"],
|
|
1359
|
+
excludeFiles: ["test/", "data/cache/"]
|
|
1360
|
+
})
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1248
1363
|
// src/detection/frameworks/nestjs.ts
|
|
1249
1364
|
var import_platform6 = require("@effect/platform");
|
|
1250
1365
|
var import_effect9 = require("effect");
|
|
@@ -1848,6 +1963,43 @@ var nuxt = {
|
|
|
1848
1963
|
})
|
|
1849
1964
|
};
|
|
1850
1965
|
|
|
1966
|
+
// src/detection/frameworks/php.ts
|
|
1967
|
+
var import_platform10 = require("@effect/platform");
|
|
1968
|
+
var import_effect14 = require("effect");
|
|
1969
|
+
var COMPOSER_FILES = ["composer.json", "composer.lock"];
|
|
1970
|
+
var DOCUMENT_ROOTS = ["public", "web", "webroot", "public_html", "htdocs", "."];
|
|
1971
|
+
var refinePhpDocumentRoot = (defaults, projectFolder) => import_effect14.Effect.gen(function* () {
|
|
1972
|
+
const fs = yield* import_platform10.FileSystem.FileSystem;
|
|
1973
|
+
const pathService = yield* import_platform10.Path.Path;
|
|
1974
|
+
for (const documentRoot of DOCUMENT_ROOTS) {
|
|
1975
|
+
const frontController = pathService.join(projectFolder, documentRoot, "index.php");
|
|
1976
|
+
if (yield* fs.exists(frontController).pipe(import_effect14.Effect.catchAll(() => import_effect14.Effect.succeed(false)))) {
|
|
1977
|
+
return phpFrontControllerDefaults({ documentRoot, excludeFiles: COMPOSER_FILES });
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
return defaults;
|
|
1981
|
+
});
|
|
1982
|
+
var getDefaultConfig = () => phpFrontControllerDefaults({ documentRoot: ".", excludeFiles: COMPOSER_FILES });
|
|
1983
|
+
var frontControllerPath = (documentRoot) => documentRoot === "." ? "index.php" : `${documentRoot}/index.php`;
|
|
1984
|
+
var phpComposerProjects = DOCUMENT_ROOTS.map((documentRoot) => ({
|
|
1985
|
+
slug: "php",
|
|
1986
|
+
name: "PHP",
|
|
1987
|
+
language: "php",
|
|
1988
|
+
detectors: [{ path: "composer.json" }, { path: frontControllerPath(documentRoot) }],
|
|
1989
|
+
priority: 7,
|
|
1990
|
+
getDefaultConfig,
|
|
1991
|
+
refineDefaultConfig: refinePhpDocumentRoot
|
|
1992
|
+
}));
|
|
1993
|
+
var phpSites = DOCUMENT_ROOTS.map((documentRoot) => ({
|
|
1994
|
+
slug: "php-site",
|
|
1995
|
+
name: "PHP",
|
|
1996
|
+
language: "php",
|
|
1997
|
+
detectors: [{ path: frontControllerPath(documentRoot) }],
|
|
1998
|
+
priority: 6,
|
|
1999
|
+
getDefaultConfig: () => ({ ...getDefaultConfig(), installCommand: "" }),
|
|
2000
|
+
refineDefaultConfig: (defaults, projectFolder) => refinePhpDocumentRoot(defaults, projectFolder).pipe(import_effect14.Effect.map((refined) => ({ ...refined, installCommand: "" })))
|
|
2001
|
+
}));
|
|
2002
|
+
|
|
1851
2003
|
// src/detection/frameworks/remix.ts
|
|
1852
2004
|
var remix = {
|
|
1853
2005
|
slug: "remix",
|
|
@@ -1869,6 +2021,21 @@ var remix = {
|
|
|
1869
2021
|
})
|
|
1870
2022
|
};
|
|
1871
2023
|
|
|
2024
|
+
// src/detection/frameworks/slim.ts
|
|
2025
|
+
var slim = {
|
|
2026
|
+
slug: "slim",
|
|
2027
|
+
name: "Slim",
|
|
2028
|
+
language: "php",
|
|
2029
|
+
detectors: [{ matchPackage: "slim/slim" }, { path: "public/index.php" }],
|
|
2030
|
+
priority: 75,
|
|
2031
|
+
getDefaultConfig: () => phpFrontControllerDefaults({
|
|
2032
|
+
documentRoot: "public",
|
|
2033
|
+
// slim/slim-skeleton logs to logs/ and caches the container and routes in var/cache.
|
|
2034
|
+
writablePaths: ["logs", "var/cache"],
|
|
2035
|
+
excludeFiles: ["tests/", "logs/", "var/"]
|
|
2036
|
+
})
|
|
2037
|
+
};
|
|
2038
|
+
|
|
1872
2039
|
// src/detection/frameworks/sveltekit.ts
|
|
1873
2040
|
var sveltekit = {
|
|
1874
2041
|
slug: "sveltekit",
|
|
@@ -1908,12 +2075,15 @@ var symfony = {
|
|
|
1908
2075
|
assetsDir: "public",
|
|
1909
2076
|
populateAssetCache: true,
|
|
1910
2077
|
excludeFiles: ["tests/*", ".ddev", "var"],
|
|
1911
|
-
symlinks: { var: "/tmp" },
|
|
1912
2078
|
routes: [{ source: "/*", destination: "public/index.php" }],
|
|
2079
|
+
// The kernel's cache and log directories. A symlink to /tmp used to stand
|
|
2080
|
+
// in for them, which the build rejected as pointing outside the project.
|
|
2081
|
+
package: { writablePaths: ["var/cache", "var/log"] },
|
|
1913
2082
|
environmentVariables: {
|
|
1914
2083
|
APP_ENV: "prod",
|
|
1915
2084
|
APP_DEBUG: "false",
|
|
1916
|
-
|
|
2085
|
+
// CSRF tokens, signed URLs and remember-me cookies.
|
|
2086
|
+
APP_SECRET: generatedSecret("hex"),
|
|
1917
2087
|
MESSENGER_TRANSPORT_DSN: "doctrine://default?auto_setup=0"
|
|
1918
2088
|
}
|
|
1919
2089
|
})
|
|
@@ -1939,6 +2109,22 @@ var vite = {
|
|
|
1939
2109
|
})
|
|
1940
2110
|
};
|
|
1941
2111
|
|
|
2112
|
+
// src/detection/frameworks/yii.ts
|
|
2113
|
+
var yii = {
|
|
2114
|
+
slug: "yii",
|
|
2115
|
+
name: "Yii 2",
|
|
2116
|
+
language: "php",
|
|
2117
|
+
detectors: [{ matchPackage: "yiisoft/yii2" }, { path: "web/index.php" }],
|
|
2118
|
+
priority: 80,
|
|
2119
|
+
getDefaultConfig: () => phpFrontControllerDefaults({
|
|
2120
|
+
documentRoot: "web",
|
|
2121
|
+
// @runtime holds cache, logs and sessions; the asset manager publishes
|
|
2122
|
+
// bundles from vendor/ into web/assets when a page first uses them.
|
|
2123
|
+
writablePaths: ["runtime", "web/assets"],
|
|
2124
|
+
excludeFiles: ["tests/", "runtime/", "web/assets/"]
|
|
2125
|
+
})
|
|
2126
|
+
};
|
|
2127
|
+
|
|
1942
2128
|
// src/detection/frameworks/index.ts
|
|
1943
2129
|
var FRAMEWORK_DEFINITIONS = [
|
|
1944
2130
|
nextjs,
|
|
@@ -1949,15 +2135,23 @@ var FRAMEWORK_DEFINITIONS = [
|
|
|
1949
2135
|
astro,
|
|
1950
2136
|
laravel,
|
|
1951
2137
|
symfony,
|
|
2138
|
+
cakephp,
|
|
2139
|
+
codeigniter,
|
|
2140
|
+
laminas,
|
|
2141
|
+
mezzio,
|
|
2142
|
+
yii,
|
|
2143
|
+
slim,
|
|
1952
2144
|
hono,
|
|
1953
2145
|
elysia,
|
|
1954
2146
|
fastify,
|
|
1955
2147
|
express,
|
|
2148
|
+
...phpComposerProjects,
|
|
2149
|
+
...phpSites,
|
|
1956
2150
|
vite
|
|
1957
2151
|
].sort((a, b) => b.priority - a.priority);
|
|
1958
2152
|
|
|
1959
2153
|
// src/detection/generate-config.ts
|
|
1960
|
-
var
|
|
2154
|
+
var import_effect15 = require("effect");
|
|
1961
2155
|
var getInstallCommand = (pm) => {
|
|
1962
2156
|
switch (pm) {
|
|
1963
2157
|
case "bun":
|
|
@@ -1973,11 +2167,16 @@ var getInstallCommand = (pm) => {
|
|
|
1973
2167
|
return "npm install";
|
|
1974
2168
|
}
|
|
1975
2169
|
};
|
|
1976
|
-
var
|
|
2170
|
+
var COMPOSER_ROOT_FILES = /* @__PURE__ */ new Set(["composer.json", "composer.lock", "auth.json"]);
|
|
2171
|
+
var isPrivatePhpProjectFile = (projectPath) => {
|
|
2172
|
+
const segments = projectPath.split("/").filter((segment) => segment !== "" && segment !== ".");
|
|
2173
|
+
return segments.some((segment) => segment.startsWith(".")) || segments[0] === "vendor" || segments[0] === "node_modules" || segments.length === 1 && COMPOSER_ROOT_FILES.has(segments[0] ?? "");
|
|
2174
|
+
};
|
|
2175
|
+
var generateConfig = import_effect15.Effect.fn("generateConfig")(function* (framework, packageManager, projectFolder, refinedDefaults) {
|
|
1977
2176
|
const defaults = refinedDefaults ?? framework.getDefaultConfig(packageManager);
|
|
1978
2177
|
const installCmd = defaults.installCommand ?? getInstallCommand(packageManager);
|
|
1979
|
-
const commands = [installCmd, ...defaults.commands];
|
|
1980
|
-
yield*
|
|
2178
|
+
const commands = installCmd ? [installCmd, ...defaults.commands] : [...defaults.commands];
|
|
2179
|
+
yield* import_effect15.Effect.logDebug(`Generating config for ${framework.name}`, {
|
|
1981
2180
|
runtime: defaults.runtime,
|
|
1982
2181
|
entrypoint: defaults.entrypoint,
|
|
1983
2182
|
commands
|
|
@@ -2019,6 +2218,7 @@ var generateConfig = import_effect14.Effect.fn("generateConfig")(function* (fram
|
|
|
2019
2218
|
if (assetsDir && !defaults.assetPaths && !defaults.assetPrefixes && !defaults.assetManifests) {
|
|
2020
2219
|
for (const file of yield* collectAssetFiles(projectFolder, assetsDir)) {
|
|
2021
2220
|
if (framework.language === "php" && /\.(php|phtml|phar)$/i.test(file)) continue;
|
|
2221
|
+
if (framework.language === "php" && isPrivatePhpProjectFile(`${assetsDir}/${file}`)) continue;
|
|
2022
2222
|
paths.push(`${assetsDir}/${file}`);
|
|
2023
2223
|
if (!servesDirectoryIndexes || file in overrides) continue;
|
|
2024
2224
|
if (file === "index.html") {
|
|
@@ -2042,31 +2242,31 @@ var generateConfig = import_effect14.Effect.fn("generateConfig")(function* (fram
|
|
|
2042
2242
|
});
|
|
2043
2243
|
|
|
2044
2244
|
// src/detection/read-dependencies.ts
|
|
2045
|
-
var
|
|
2046
|
-
var
|
|
2245
|
+
var import_platform11 = require("@effect/platform");
|
|
2246
|
+
var import_effect17 = require("effect");
|
|
2047
2247
|
|
|
2048
2248
|
// src/detection/types.ts
|
|
2049
|
-
var
|
|
2050
|
-
var ManifestNotFoundError = class extends
|
|
2051
|
-
message:
|
|
2052
|
-
filePath:
|
|
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
|
|
2053
2253
|
}) {
|
|
2054
2254
|
};
|
|
2055
|
-
var ManifestReadError = class extends
|
|
2056
|
-
message:
|
|
2057
|
-
filePath:
|
|
2255
|
+
var ManifestReadError = class extends import_effect16.Schema.TaggedError()("ManifestReadError", {
|
|
2256
|
+
message: import_effect16.Schema.String,
|
|
2257
|
+
filePath: import_effect16.Schema.String
|
|
2058
2258
|
}) {
|
|
2059
2259
|
};
|
|
2060
|
-
var ManifestParseError = class extends
|
|
2061
|
-
message:
|
|
2062
|
-
filePath:
|
|
2260
|
+
var ManifestParseError = class extends import_effect16.Schema.TaggedError()("ManifestParseError", {
|
|
2261
|
+
message: import_effect16.Schema.String,
|
|
2262
|
+
filePath: import_effect16.Schema.String
|
|
2063
2263
|
}) {
|
|
2064
2264
|
};
|
|
2065
|
-
var FrameworkNotDetectedError = class extends
|
|
2265
|
+
var FrameworkNotDetectedError = class extends import_effect16.Schema.TaggedError()(
|
|
2066
2266
|
"FrameworkNotDetectedError",
|
|
2067
2267
|
{
|
|
2068
|
-
message:
|
|
2069
|
-
directory:
|
|
2268
|
+
message: import_effect16.Schema.String,
|
|
2269
|
+
directory: import_effect16.Schema.String
|
|
2070
2270
|
}
|
|
2071
2271
|
) {
|
|
2072
2272
|
};
|
|
@@ -2076,25 +2276,25 @@ var MANIFEST_CONFIG = {
|
|
|
2076
2276
|
node: { file: "package.json", depKeys: ["dependencies", "devDependencies"] },
|
|
2077
2277
|
php: { file: "composer.json", depKeys: ["require", "require-dev"] }
|
|
2078
2278
|
};
|
|
2079
|
-
var readManifest =
|
|
2080
|
-
const fs = yield*
|
|
2081
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
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)));
|
|
2082
2282
|
if (!exists) {
|
|
2083
|
-
return yield*
|
|
2283
|
+
return yield* import_effect17.Effect.fail(new ManifestNotFoundError({ message: "Manifest not found", filePath }));
|
|
2084
2284
|
}
|
|
2085
|
-
const content = yield* fs.readFileString(filePath).pipe(
|
|
2086
|
-
const parsed = yield*
|
|
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({
|
|
2087
2287
|
try: () => JSON.parse(content),
|
|
2088
2288
|
catch: () => new ManifestParseError({ message: "Failed to parse manifest JSON", filePath })
|
|
2089
2289
|
});
|
|
2090
2290
|
return parsed;
|
|
2091
2291
|
});
|
|
2092
|
-
var readDependencies =
|
|
2093
|
-
const pathService = yield*
|
|
2292
|
+
var readDependencies = import_effect17.Effect.fn("readDependencies")(function* (projectFolder, language) {
|
|
2293
|
+
const pathService = yield* import_platform11.Path.Path;
|
|
2094
2294
|
const config = MANIFEST_CONFIG[language];
|
|
2095
2295
|
const filePath = pathService.join(projectFolder, config.file);
|
|
2096
2296
|
const manifest = yield* readManifest(filePath).pipe(
|
|
2097
|
-
|
|
2297
|
+
import_effect17.Effect.catchTag("ManifestNotFoundError", () => import_effect17.Effect.succeed(null))
|
|
2098
2298
|
);
|
|
2099
2299
|
if (!manifest) {
|
|
2100
2300
|
return /* @__PURE__ */ new Set();
|
|
@@ -2112,9 +2312,9 @@ var readDependencies = import_effect16.Effect.fn("readDependencies")(function* (
|
|
|
2112
2312
|
});
|
|
2113
2313
|
|
|
2114
2314
|
// src/detection/detect-framework.ts
|
|
2115
|
-
var matchesDetectionItem =
|
|
2116
|
-
const fs = yield*
|
|
2117
|
-
const pathService = yield*
|
|
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;
|
|
2118
2318
|
if (item.matchPackage != null) {
|
|
2119
2319
|
const deps = yield* cachedReadDeps(`${projectFolder}\0${framework.language}`);
|
|
2120
2320
|
if (!deps.has(item.matchPackage)) {
|
|
@@ -2123,12 +2323,12 @@ var matchesDetectionItem = import_effect17.Effect.fn("matchesDetectionItem")(fun
|
|
|
2123
2323
|
}
|
|
2124
2324
|
if (item.path != null) {
|
|
2125
2325
|
const filePath = pathService.join(projectFolder, item.path);
|
|
2126
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
2326
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed(false)));
|
|
2127
2327
|
if (!exists) {
|
|
2128
2328
|
return false;
|
|
2129
2329
|
}
|
|
2130
2330
|
if (item.matchContent != null) {
|
|
2131
|
-
const content = yield* fs.readFileString(filePath).pipe(
|
|
2331
|
+
const content = yield* fs.readFileString(filePath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed("")));
|
|
2132
2332
|
let regexMatch = false;
|
|
2133
2333
|
try {
|
|
2134
2334
|
regexMatch = new RegExp(item.matchContent).test(content);
|
|
@@ -2141,7 +2341,7 @@ var matchesDetectionItem = import_effect17.Effect.fn("matchesDetectionItem")(fun
|
|
|
2141
2341
|
}
|
|
2142
2342
|
return true;
|
|
2143
2343
|
});
|
|
2144
|
-
var matchesFramework =
|
|
2344
|
+
var matchesFramework = import_effect18.Effect.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
|
|
2145
2345
|
for (const detector of framework.detectors) {
|
|
2146
2346
|
const matches = yield* matchesDetectionItem(detector, projectFolder, framework, cachedReadDeps);
|
|
2147
2347
|
if (!matches) {
|
|
@@ -2150,9 +2350,9 @@ var matchesFramework = import_effect17.Effect.fn("matchesFramework")(function* (
|
|
|
2150
2350
|
}
|
|
2151
2351
|
return true;
|
|
2152
2352
|
});
|
|
2153
|
-
var detectFramework =
|
|
2154
|
-
yield*
|
|
2155
|
-
const cachedReadDeps = yield*
|
|
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) => {
|
|
2156
2356
|
const sepIndex = key.lastIndexOf("\0");
|
|
2157
2357
|
const folder = key.slice(0, sepIndex);
|
|
2158
2358
|
const language = key.slice(sepIndex + 1);
|
|
@@ -2161,7 +2361,7 @@ var detectFramework = import_effect17.Effect.fn("detectFramework")(function* (pr
|
|
|
2161
2361
|
for (const framework of FRAMEWORK_DEFINITIONS) {
|
|
2162
2362
|
const matches = yield* matchesFramework(framework, projectFolder, cachedReadDeps);
|
|
2163
2363
|
if (matches) {
|
|
2164
|
-
yield*
|
|
2364
|
+
yield* import_effect18.Effect.log(`Detected framework: ${framework.name}`, { slug: framework.slug });
|
|
2165
2365
|
const detectedPackageManager = yield* detectPackageManager(projectFolder);
|
|
2166
2366
|
const packageManager = framework.language === "php" ? "composer" : detectedPackageManager;
|
|
2167
2367
|
const defaults = framework.getDefaultConfig(packageManager);
|
|
@@ -2170,7 +2370,7 @@ var detectFramework = import_effect17.Effect.fn("detectFramework")(function* (pr
|
|
|
2170
2370
|
return { framework, packageManager, config };
|
|
2171
2371
|
}
|
|
2172
2372
|
}
|
|
2173
|
-
return yield*
|
|
2373
|
+
return yield* import_effect18.Effect.fail(
|
|
2174
2374
|
new FrameworkNotDetectedError({
|
|
2175
2375
|
message: `No framework detected in project directory`,
|
|
2176
2376
|
directory: projectFolder
|
|
@@ -2179,9 +2379,9 @@ var detectFramework = import_effect17.Effect.fn("detectFramework")(function* (pr
|
|
|
2179
2379
|
});
|
|
2180
2380
|
|
|
2181
2381
|
// src/detection/merge-config.ts
|
|
2182
|
-
var
|
|
2183
|
-
var mergeWithFrameworkDefaults =
|
|
2184
|
-
yield*
|
|
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");
|
|
2185
2385
|
const userHasAssets = (userConfig.assets?.paths?.length ?? 0) > 0 || (userConfig.assets?.prefixes?.length ?? 0) > 0 || (userConfig.assets?.manifests?.length ?? 0) > 0;
|
|
2186
2386
|
const isContainer = (entrypoint) => entrypoint.runtime === CONTAINER_RUNTIME;
|
|
2187
2387
|
const userFileFunctions = userConfig.entrypoints.filter((entrypoint) => !isContainer(entrypoint));
|
|
@@ -2222,23 +2422,23 @@ var filterFunctionsFromAssets = (config) => {
|
|
|
2222
2422
|
};
|
|
2223
2423
|
|
|
2224
2424
|
// src/parse-config.ts
|
|
2225
|
-
var
|
|
2425
|
+
var import_effect25 = require("effect");
|
|
2226
2426
|
|
|
2227
2427
|
// src/services/raw-config-reader.ts
|
|
2228
|
-
var
|
|
2229
|
-
var
|
|
2428
|
+
var import_platform13 = require("@effect/platform");
|
|
2429
|
+
var import_effect21 = require("effect");
|
|
2230
2430
|
var import_yaml2 = require("yaml");
|
|
2231
2431
|
|
|
2232
2432
|
// src/services/config-module-loader.ts
|
|
2233
|
-
var
|
|
2433
|
+
var import_effect20 = require("effect");
|
|
2234
2434
|
var import_jiti = require("jiti");
|
|
2235
2435
|
var MISSING_DEFAULT_EXPORT = /* @__PURE__ */ Symbol("MissingDefaultExport");
|
|
2236
2436
|
var STRICT_DEFAULT_EXPORT_EXTENSIONS = [".ts", ".mts", ".mjs"];
|
|
2237
|
-
var ConfigModuleLoader = class extends
|
|
2238
|
-
effect:
|
|
2239
|
-
const loadConfigModule =
|
|
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) {
|
|
2240
2440
|
const extension = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
|
|
2241
|
-
const mod = yield*
|
|
2441
|
+
const mod = yield* import_effect20.Effect.tryPromise({
|
|
2242
2442
|
try: async () => {
|
|
2243
2443
|
const jiti = (0, import_jiti.createJiti)(filePath, { fsCache: false, interopDefault: true, moduleCache: false });
|
|
2244
2444
|
const namespace = await jiti.import(filePath);
|
|
@@ -2257,7 +2457,7 @@ var ConfigModuleLoader = class extends import_effect19.Effect.Service()("ConfigM
|
|
|
2257
2457
|
})
|
|
2258
2458
|
});
|
|
2259
2459
|
if (mod === MISSING_DEFAULT_EXPORT) {
|
|
2260
|
-
return yield*
|
|
2460
|
+
return yield* import_effect20.Effect.fail(
|
|
2261
2461
|
new ConfigModuleLoadError({
|
|
2262
2462
|
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.`,
|
|
2263
2463
|
filePath
|
|
@@ -2265,7 +2465,7 @@ var ConfigModuleLoader = class extends import_effect19.Effect.Service()("ConfigM
|
|
|
2265
2465
|
);
|
|
2266
2466
|
}
|
|
2267
2467
|
if (typeof mod === "function") {
|
|
2268
|
-
return yield*
|
|
2468
|
+
return yield* import_effect20.Effect.fail(
|
|
2269
2469
|
new ConfigModuleLoadError({
|
|
2270
2470
|
message: `Config module at ${filePath} default-exports a function; config factories are not supported. Export a config object instead (optionally wrapped in defineConfig).`,
|
|
2271
2471
|
filePath
|
|
@@ -2273,7 +2473,7 @@ var ConfigModuleLoader = class extends import_effect19.Effect.Service()("ConfigM
|
|
|
2273
2473
|
);
|
|
2274
2474
|
}
|
|
2275
2475
|
if (typeof mod !== "object" || mod === null || Array.isArray(mod)) {
|
|
2276
|
-
return yield*
|
|
2476
|
+
return yield* import_effect20.Effect.fail(
|
|
2277
2477
|
new ConfigModuleLoadError({
|
|
2278
2478
|
message: `Config module at ${filePath} must default-export a config object.`,
|
|
2279
2479
|
filePath
|
|
@@ -2303,36 +2503,36 @@ var ALLOWED_CONFIG_NAMES = [
|
|
|
2303
2503
|
"nebula.json"
|
|
2304
2504
|
];
|
|
2305
2505
|
var MODULE_EXTENSIONS = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"];
|
|
2306
|
-
var RawConfigReader = class extends
|
|
2506
|
+
var RawConfigReader = class extends import_effect21.Effect.Service()("RawConfigReader", {
|
|
2307
2507
|
dependencies: [ConfigModuleLoader.Default],
|
|
2308
|
-
effect:
|
|
2309
|
-
const fs = yield*
|
|
2310
|
-
const pathService = yield*
|
|
2508
|
+
effect: import_effect21.Effect.gen(function* () {
|
|
2509
|
+
const fs = yield* import_platform13.FileSystem.FileSystem;
|
|
2510
|
+
const pathService = yield* import_platform13.Path.Path;
|
|
2311
2511
|
const moduleLoader = yield* ConfigModuleLoader;
|
|
2312
|
-
const findConfig =
|
|
2512
|
+
const findConfig = import_effect21.Effect.fn("RawConfigReader.findConfig")(function* (projectFolder) {
|
|
2313
2513
|
for (const name of ALLOWED_CONFIG_NAMES) {
|
|
2314
2514
|
const filePath = pathService.join(projectFolder, name);
|
|
2315
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
2515
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect21.Effect.catchAll(() => import_effect21.Effect.succeed(false)));
|
|
2316
2516
|
if (exists) {
|
|
2317
2517
|
return filePath;
|
|
2318
2518
|
}
|
|
2319
2519
|
}
|
|
2320
2520
|
return null;
|
|
2321
2521
|
});
|
|
2322
|
-
const readRawConfig =
|
|
2323
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
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)));
|
|
2324
2524
|
if (!exists) {
|
|
2325
|
-
return yield*
|
|
2525
|
+
return yield* import_effect21.Effect.fail(
|
|
2326
2526
|
new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })
|
|
2327
2527
|
);
|
|
2328
2528
|
}
|
|
2329
2529
|
const fileContents = yield* fs.readFileString(filePath).pipe(
|
|
2330
|
-
|
|
2530
|
+
import_effect21.Effect.mapError(
|
|
2331
2531
|
() => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })
|
|
2332
2532
|
)
|
|
2333
2533
|
);
|
|
2334
2534
|
if (fileContents.length === 0) {
|
|
2335
|
-
return yield*
|
|
2535
|
+
return yield* import_effect21.Effect.fail(
|
|
2336
2536
|
new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })
|
|
2337
2537
|
);
|
|
2338
2538
|
}
|
|
@@ -2348,7 +2548,7 @@ var RawConfigReader = class extends import_effect20.Effect.Service()("RawConfigR
|
|
|
2348
2548
|
parsed = (0, import_yaml2.parse)(fileContents);
|
|
2349
2549
|
}
|
|
2350
2550
|
} catch (error) {
|
|
2351
|
-
return yield*
|
|
2551
|
+
return yield* import_effect21.Effect.fail(
|
|
2352
2552
|
new ConfigFileParseError({
|
|
2353
2553
|
message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2354
2554
|
filePath,
|
|
@@ -2358,21 +2558,21 @@ var RawConfigReader = class extends import_effect20.Effect.Service()("RawConfigR
|
|
|
2358
2558
|
}
|
|
2359
2559
|
}
|
|
2360
2560
|
if (parsed == null) {
|
|
2361
|
-
return yield*
|
|
2561
|
+
return yield* import_effect21.Effect.fail(
|
|
2362
2562
|
new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })
|
|
2363
2563
|
);
|
|
2364
2564
|
}
|
|
2365
2565
|
if (!options?.disableVersionCheck && typeof parsed.version !== "number") {
|
|
2366
|
-
return yield*
|
|
2566
|
+
return yield* import_effect21.Effect.fail(
|
|
2367
2567
|
new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })
|
|
2368
2568
|
);
|
|
2369
2569
|
}
|
|
2370
2570
|
return parsed;
|
|
2371
2571
|
});
|
|
2372
2572
|
const readConfigFile = (configFilePath) => readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
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")
|
|
2376
2576
|
);
|
|
2377
2577
|
return { findConfig, readRawConfig, readConfigFile };
|
|
2378
2578
|
})
|
|
@@ -2382,17 +2582,17 @@ var RawConfigReader = class extends import_effect20.Effect.Service()("RawConfigR
|
|
|
2382
2582
|
// src/services/schema-validator.ts
|
|
2383
2583
|
var import_ajv = __toESM(require("ajv"));
|
|
2384
2584
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
2385
|
-
var
|
|
2386
|
-
var SchemaValidator = class extends
|
|
2387
|
-
effect:
|
|
2585
|
+
var import_effect22 = require("effect");
|
|
2586
|
+
var SchemaValidator = class extends import_effect22.Effect.Service()("SchemaValidator", {
|
|
2587
|
+
effect: import_effect22.Effect.gen(function* () {
|
|
2388
2588
|
const ajv = new import_ajv.default();
|
|
2389
2589
|
(0, import_ajv_formats.default)(ajv);
|
|
2390
|
-
const validate =
|
|
2590
|
+
const validate = import_effect22.Effect.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
|
|
2391
2591
|
const compiledValidate = ajv.compile(schema);
|
|
2392
2592
|
const valid = compiledValidate(config);
|
|
2393
2593
|
if (!valid) {
|
|
2394
2594
|
const errors = compiledValidate.errors?.map((e) => `${e.instancePath || "/"} ${e.message ?? ""}`.trim()) ?? [];
|
|
2395
|
-
return yield*
|
|
2595
|
+
return yield* import_effect22.Effect.fail(
|
|
2396
2596
|
new ConfigSchemaValidationError({
|
|
2397
2597
|
message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,
|
|
2398
2598
|
filePath,
|
|
@@ -2448,7 +2648,7 @@ var getFilesForPattern = async (pattern, projectFolder, excludeFiles = []) => {
|
|
|
2448
2648
|
};
|
|
2449
2649
|
|
|
2450
2650
|
// src/services/v4-config-parser.ts
|
|
2451
|
-
var
|
|
2651
|
+
var import_effect23 = require("effect");
|
|
2452
2652
|
var import_minimatch2 = require("minimatch");
|
|
2453
2653
|
var import_node_path2 = require("path");
|
|
2454
2654
|
var import_safe_regex2 = __toESM(require("safe-regex2"));
|
|
@@ -2599,7 +2799,7 @@ var mapRoute = (route, entrypoints) => ({
|
|
|
2599
2799
|
negativeRequirements: route.missing,
|
|
2600
2800
|
status: route.statusCode
|
|
2601
2801
|
});
|
|
2602
|
-
var parseEntrypoints =
|
|
2802
|
+
var parseEntrypoints = import_effect23.Effect.fn("parseEntrypoints")(function* (config, projectFolder) {
|
|
2603
2803
|
const entrypoints = [];
|
|
2604
2804
|
const dockerFunctions = [];
|
|
2605
2805
|
if (config.functions == null) return { entrypoints, dockerFunctions };
|
|
@@ -2610,7 +2810,7 @@ var parseEntrypoints = import_effect22.Effect.fn("parseEntrypoints")(function* (
|
|
|
2610
2810
|
functionPath: fnPath
|
|
2611
2811
|
});
|
|
2612
2812
|
}
|
|
2613
|
-
const matchedFiles = yield*
|
|
2813
|
+
const matchedFiles = yield* import_effect23.Effect.tryPromise({
|
|
2614
2814
|
try: () => getFilesForPattern(fnPath, projectFolder, func.excludeFiles),
|
|
2615
2815
|
catch: (error) => new FunctionConfigError({
|
|
2616
2816
|
message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -2685,13 +2885,13 @@ var parseEntrypoints = import_effect22.Effect.fn("parseEntrypoints")(function* (
|
|
|
2685
2885
|
}
|
|
2686
2886
|
return { entrypoints, dockerFunctions };
|
|
2687
2887
|
});
|
|
2688
|
-
var collectAssets =
|
|
2888
|
+
var collectAssets = import_effect23.Effect.fn("collectAssets")(function* (config, projectFolder) {
|
|
2689
2889
|
if (config.assets == null) return [];
|
|
2690
2890
|
const assetNames = yield* collectAssetFiles(projectFolder, config.assets);
|
|
2691
2891
|
return assetNames.filter((assetName) => getFunctionSettings(`${config.assets}/${assetName}`, config) == null).map((assetName) => `${config.assets}/${assetName}`);
|
|
2692
2892
|
});
|
|
2693
2893
|
var reservedRuntimePorts = (entrypoint) => entrypoint.runtime === CONTAINER_RUNTIME ? [] : entrypoint.runtime.startsWith("php-") ? [8080, 9e3] : [8080];
|
|
2694
|
-
var parseContainers =
|
|
2894
|
+
var parseContainers = import_effect23.Effect.fn("parseContainers")(function* (config, projectFolder, fileEntrypoints, dockerFunctions) {
|
|
2695
2895
|
const warnings = [];
|
|
2696
2896
|
let containers = {};
|
|
2697
2897
|
if (config.compose != null) {
|
|
@@ -2724,16 +2924,16 @@ var parseContainers = import_effect22.Effect.fn("parseContainers")(function* (co
|
|
|
2724
2924
|
}
|
|
2725
2925
|
return { ...result, warnings };
|
|
2726
2926
|
});
|
|
2727
|
-
var V4ConfigParser = class extends
|
|
2927
|
+
var V4ConfigParser = class extends import_effect23.Effect.Service()("V4ConfigParser", {
|
|
2728
2928
|
accessors: true,
|
|
2729
|
-
effect:
|
|
2929
|
+
effect: import_effect23.Effect.succeed({
|
|
2730
2930
|
/**
|
|
2731
2931
|
* Parses a ConfigV4 into a NormalizedConfig.
|
|
2732
2932
|
*
|
|
2733
2933
|
* @param config - The raw V4 config object
|
|
2734
2934
|
* @param projectFolder - Absolute path to the project root
|
|
2735
2935
|
*/
|
|
2736
|
-
parse:
|
|
2936
|
+
parse: import_effect23.Effect.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
|
|
2737
2937
|
const { entrypoints: fileEntrypoints, dockerFunctions } = yield* parseEntrypoints(config, projectFolder);
|
|
2738
2938
|
const containers = yield* parseContainers(config, projectFolder, fileEntrypoints, dockerFunctions);
|
|
2739
2939
|
const entrypoints = [...fileEntrypoints, ...containers.entrypoints];
|
|
@@ -2775,7 +2975,7 @@ var V4ConfigParser = class extends import_effect22.Effect.Service()("V4ConfigPar
|
|
|
2775
2975
|
};
|
|
2776
2976
|
|
|
2777
2977
|
// src/services/vercel-build-output-parser.ts
|
|
2778
|
-
var
|
|
2978
|
+
var import_platform14 = require("@effect/platform");
|
|
2779
2979
|
|
|
2780
2980
|
// ../commons/src/deep-merge.ts
|
|
2781
2981
|
var deepMerge = (target, ...partials) => {
|
|
@@ -2804,7 +3004,7 @@ var deepMerge = (target, ...partials) => {
|
|
|
2804
3004
|
};
|
|
2805
3005
|
|
|
2806
3006
|
// src/services/vercel-build-output-parser.ts
|
|
2807
|
-
var
|
|
3007
|
+
var import_effect24 = require("effect");
|
|
2808
3008
|
|
|
2809
3009
|
// src/build-output-v3/determine-repo-root.ts
|
|
2810
3010
|
var import_path = __toESM(require("path"));
|
|
@@ -2900,11 +3100,11 @@ var translateVercelRuntime = (runtime) => {
|
|
|
2900
3100
|
var CONFIG_PATH = ".vercel/output/config.json";
|
|
2901
3101
|
var FUNCTIONS_FOLDER = ".vercel/output/functions";
|
|
2902
3102
|
var FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;
|
|
2903
|
-
var VercelBuildOutputParser = class extends
|
|
2904
|
-
effect:
|
|
3103
|
+
var VercelBuildOutputParser = class extends import_effect24.Effect.Service()("VercelBuildOutputParser", {
|
|
3104
|
+
effect: import_effect24.Effect.gen(function* () {
|
|
2905
3105
|
const rawConfigReader = yield* RawConfigReader;
|
|
2906
|
-
const pathService = yield*
|
|
2907
|
-
const parse =
|
|
3106
|
+
const pathService = yield* import_platform14.Path.Path;
|
|
3107
|
+
const parse = import_effect24.Effect.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
|
|
2908
3108
|
const config = yield* rawConfigReader.readConfigFile(pathService.join(projectFolder, CONFIG_PATH));
|
|
2909
3109
|
if (!config || typeof config.version !== "number" || config.version < 3) {
|
|
2910
3110
|
return parseResult;
|
|
@@ -2916,8 +3116,8 @@ var VercelBuildOutputParser = class extends import_effect23.Effect.Service()("Ve
|
|
|
2916
3116
|
merged.regions = [...new Set(merged.regions)];
|
|
2917
3117
|
return merged;
|
|
2918
3118
|
});
|
|
2919
|
-
const loadFunctions =
|
|
2920
|
-
const functionConfigs = yield*
|
|
3119
|
+
const loadFunctions = import_effect24.Effect.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
|
|
3120
|
+
const functionConfigs = yield* import_effect24.Effect.tryPromise({
|
|
2921
3121
|
try: () => getFilesForPattern(FUNCTION_CONFIGS_PATTERN, projectFolder),
|
|
2922
3122
|
catch: (error) => new ConfigFileParseError({
|
|
2923
3123
|
message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -3834,7 +4034,7 @@ var schema_default = {
|
|
|
3834
4034
|
};
|
|
3835
4035
|
|
|
3836
4036
|
// src/parse-config.ts
|
|
3837
|
-
var parseConfigRaw =
|
|
4037
|
+
var parseConfigRaw = import_effect25.Effect.fn("parseConfigRaw")(function* (filePath, projectFolder) {
|
|
3838
4038
|
const rawReader = yield* RawConfigReader;
|
|
3839
4039
|
const validator = yield* SchemaValidator;
|
|
3840
4040
|
const v4Parser = yield* V4ConfigParser;
|
|
@@ -3845,7 +4045,7 @@ var parseConfigRaw = import_effect24.Effect.fn("parseConfigRaw")(function* (file
|
|
|
3845
4045
|
};
|
|
3846
4046
|
const schema = schemaMap[version];
|
|
3847
4047
|
if (!schema) {
|
|
3848
|
-
return yield*
|
|
4048
|
+
return yield* import_effect25.Effect.fail(
|
|
3849
4049
|
new ConfigVersionError({
|
|
3850
4050
|
message: `Config file at ${filePath} has an unsupported version: ${version}`,
|
|
3851
4051
|
filePath,
|
|
@@ -3856,11 +4056,11 @@ var parseConfigRaw = import_effect24.Effect.fn("parseConfigRaw")(function* (file
|
|
|
3856
4056
|
yield* validator.validate(parsed, schema, filePath);
|
|
3857
4057
|
return yield* v4Parser.parse(parsed, projectFolder);
|
|
3858
4058
|
});
|
|
3859
|
-
var parseConfig =
|
|
4059
|
+
var parseConfig = import_effect25.Effect.fn("parseConfig")(function* (filePath, projectFolder) {
|
|
3860
4060
|
const parseResult = yield* parseConfigRaw(filePath, projectFolder);
|
|
3861
4061
|
return yield* postProcessConfig(parseResult, projectFolder);
|
|
3862
4062
|
});
|
|
3863
|
-
var postProcessConfig =
|
|
4063
|
+
var postProcessConfig = import_effect25.Effect.fn("postProcessConfig")(function* (config, projectFolder) {
|
|
3864
4064
|
const vercelParser = yield* VercelBuildOutputParser;
|
|
3865
4065
|
let result = yield* vercelParser.parse(config, projectFolder);
|
|
3866
4066
|
const hasAssets = (result.assets?.paths?.length ?? 0) > 0 || (result.assets?.prefixes?.length ?? 0) > 0 || (result.assets?.manifests?.length ?? 0) > 0;
|
|
@@ -3917,14 +4117,14 @@ var RUNTIME_DEFINITIONS = [
|
|
|
3917
4117
|
var AVAILABLE_RUNTIMES = [...RUNTIME_DEFINITIONS];
|
|
3918
4118
|
|
|
3919
4119
|
// src/services/index.ts
|
|
3920
|
-
var
|
|
3921
|
-
var BaseLayers =
|
|
4120
|
+
var import_effect26 = require("effect");
|
|
4121
|
+
var BaseLayers = import_effect26.Layer.mergeAll(
|
|
3922
4122
|
ConfigModuleLoader.Default,
|
|
3923
4123
|
RawConfigReader.Default,
|
|
3924
4124
|
SchemaValidator.Default,
|
|
3925
4125
|
V4ConfigParser.Default
|
|
3926
4126
|
);
|
|
3927
|
-
var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(
|
|
4127
|
+
var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect26.Layer.provideMerge(BaseLayers));
|
|
3928
4128
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3929
4129
|
0 && (module.exports = {
|
|
3930
4130
|
ALLOWED_CONFIG_NAMES,
|
|
@@ -3982,6 +4182,7 @@ var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect25.Lay
|
|
|
3982
4182
|
dockerFunctionContainerName,
|
|
3983
4183
|
filterFunctionsFromAssets,
|
|
3984
4184
|
generateConfig,
|
|
4185
|
+
generatedSecret,
|
|
3985
4186
|
getFunctionSettings,
|
|
3986
4187
|
mergeWithFrameworkDefaults,
|
|
3987
4188
|
normalizeContainers,
|