@gigadrive/network-config 4.5.0 → 4.6.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/define-config.d.mts +304 -0
- package/dist/define-config.d.ts +304 -0
- package/dist/define-config.js +31 -0
- package/dist/define-config.js.map +1 -0
- package/dist/define-config.mjs +6 -0
- package/dist/define-config.mjs.map +1 -0
- package/dist/index.d.mts +365 -316
- package/dist/index.d.ts +365 -316
- package/dist/index.js +153 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +148 -59
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs-adapter.js +22 -1
- package/dist/nextjs-adapter.js.map +1 -1
- package/dist/nextjs-adapter.mjs +22 -1
- package/dist/nextjs-adapter.mjs.map +1 -1
- package/package.json +8 -2
package/dist/index.mjs
CHANGED
|
@@ -55,6 +55,9 @@ var StaticAssetManifestV1Schema = Schema2.mutable(
|
|
|
55
55
|
).pipe(Schema2.filter(({ assets }) => new Set(assets.map(({ path: path2 }) => path2)).size === assets.length));
|
|
56
56
|
var parseStaticAssetManifest = (content) => decodeJson(StaticAssetManifestV1Schema, content);
|
|
57
57
|
|
|
58
|
+
// src/define-config.ts
|
|
59
|
+
var defineConfig = (config) => config;
|
|
60
|
+
|
|
58
61
|
// src/detection/detect-framework.ts
|
|
59
62
|
import { FileSystem as FileSystem8, Path as Path6 } from "@effect/platform";
|
|
60
63
|
import { Effect as Effect10 } from "effect";
|
|
@@ -1206,6 +1209,12 @@ var ConfigFileParseError = class extends Schema5.TaggedError()("ConfigFileParseE
|
|
|
1206
1209
|
cause: Schema5.optional(Schema5.String)
|
|
1207
1210
|
}) {
|
|
1208
1211
|
};
|
|
1212
|
+
var ConfigModuleLoadError = class extends Schema5.TaggedError()("ConfigModuleLoadError", {
|
|
1213
|
+
message: Schema5.String,
|
|
1214
|
+
filePath: Schema5.String,
|
|
1215
|
+
cause: Schema5.optional(Schema5.String)
|
|
1216
|
+
}) {
|
|
1217
|
+
};
|
|
1209
1218
|
var ConfigVersionError = class extends Schema5.TaggedError()("ConfigVersionError", {
|
|
1210
1219
|
message: Schema5.String,
|
|
1211
1220
|
filePath: Schema5.String,
|
|
@@ -1243,85 +1252,157 @@ var DEFAULT_FUNCTION_DURATION_SECONDS = 30;
|
|
|
1243
1252
|
var MAX_FUNCTION_DURATION_SECONDS = 28800;
|
|
1244
1253
|
|
|
1245
1254
|
// src/parse-config.ts
|
|
1246
|
-
import { Effect as
|
|
1255
|
+
import { Effect as Effect17 } from "effect";
|
|
1247
1256
|
|
|
1248
1257
|
// src/services/raw-config-reader.ts
|
|
1249
1258
|
import { FileSystem as FileSystem9, Path as Path7 } from "@effect/platform";
|
|
1250
|
-
import { Effect as
|
|
1259
|
+
import { Effect as Effect13 } from "effect";
|
|
1251
1260
|
import { parse as parseYaml } from "yaml";
|
|
1261
|
+
|
|
1262
|
+
// src/services/config-module-loader.ts
|
|
1263
|
+
import { Effect as Effect12 } from "effect";
|
|
1264
|
+
import { createJiti } from "jiti";
|
|
1265
|
+
var MISSING_DEFAULT_EXPORT = /* @__PURE__ */ Symbol("MissingDefaultExport");
|
|
1266
|
+
var STRICT_DEFAULT_EXPORT_EXTENSIONS = [".ts", ".mts", ".mjs"];
|
|
1267
|
+
var ConfigModuleLoader = class extends Effect12.Service()("ConfigModuleLoader", {
|
|
1268
|
+
effect: Effect12.gen(function* () {
|
|
1269
|
+
const loadConfigModule = Effect12.fn("ConfigModuleLoader.loadConfigModule")(function* (filePath) {
|
|
1270
|
+
const extension = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
|
|
1271
|
+
const mod = yield* Effect12.tryPromise({
|
|
1272
|
+
try: async () => {
|
|
1273
|
+
const jiti = createJiti(filePath, { fsCache: false, interopDefault: true, moduleCache: false });
|
|
1274
|
+
const namespace = await jiti.import(filePath);
|
|
1275
|
+
if (typeof namespace === "object" && namespace !== null && "default" in namespace) {
|
|
1276
|
+
return namespace.default;
|
|
1277
|
+
}
|
|
1278
|
+
if (!STRICT_DEFAULT_EXPORT_EXTENSIONS.includes(extension)) {
|
|
1279
|
+
return namespace.default ?? MISSING_DEFAULT_EXPORT;
|
|
1280
|
+
}
|
|
1281
|
+
return MISSING_DEFAULT_EXPORT;
|
|
1282
|
+
},
|
|
1283
|
+
catch: (error) => new ConfigModuleLoadError({
|
|
1284
|
+
message: `Failed to load config module at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1285
|
+
filePath,
|
|
1286
|
+
cause: error instanceof Error ? error.message : void 0
|
|
1287
|
+
})
|
|
1288
|
+
});
|
|
1289
|
+
if (mod === MISSING_DEFAULT_EXPORT) {
|
|
1290
|
+
return yield* Effect12.fail(
|
|
1291
|
+
new ConfigModuleLoadError({
|
|
1292
|
+
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.`,
|
|
1293
|
+
filePath
|
|
1294
|
+
})
|
|
1295
|
+
);
|
|
1296
|
+
}
|
|
1297
|
+
if (typeof mod === "function") {
|
|
1298
|
+
return yield* Effect12.fail(
|
|
1299
|
+
new ConfigModuleLoadError({
|
|
1300
|
+
message: `Config module at ${filePath} default-exports a function; config factories are not supported. Export a config object instead (optionally wrapped in defineConfig).`,
|
|
1301
|
+
filePath
|
|
1302
|
+
})
|
|
1303
|
+
);
|
|
1304
|
+
}
|
|
1305
|
+
if (typeof mod !== "object" || mod === null || Array.isArray(mod)) {
|
|
1306
|
+
return yield* Effect12.fail(
|
|
1307
|
+
new ConfigModuleLoadError({
|
|
1308
|
+
message: `Config module at ${filePath} must default-export a config object.`,
|
|
1309
|
+
filePath
|
|
1310
|
+
})
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
return mod;
|
|
1314
|
+
});
|
|
1315
|
+
return { loadConfigModule };
|
|
1316
|
+
})
|
|
1317
|
+
}) {
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1320
|
+
// src/services/raw-config-reader.ts
|
|
1252
1321
|
var ALLOWED_CONFIG_NAMES = [
|
|
1322
|
+
"gigadrive.ts",
|
|
1323
|
+
"gigadrive.mts",
|
|
1324
|
+
"gigadrive.cts",
|
|
1325
|
+
"gigadrive.js",
|
|
1326
|
+
"gigadrive.mjs",
|
|
1327
|
+
"gigadrive.cjs",
|
|
1253
1328
|
"gigadrive.yaml",
|
|
1254
1329
|
"gigadrive.yml",
|
|
1330
|
+
"gigadrive.json",
|
|
1255
1331
|
"nebula.yaml",
|
|
1256
1332
|
"nebula.yml",
|
|
1257
1333
|
"nebula.json"
|
|
1258
1334
|
];
|
|
1259
|
-
var
|
|
1260
|
-
|
|
1335
|
+
var MODULE_EXTENSIONS = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"];
|
|
1336
|
+
var RawConfigReader = class extends Effect13.Service()("RawConfigReader", {
|
|
1337
|
+
dependencies: [ConfigModuleLoader.Default],
|
|
1338
|
+
effect: Effect13.gen(function* () {
|
|
1261
1339
|
const fs = yield* FileSystem9.FileSystem;
|
|
1262
1340
|
const pathService = yield* Path7.Path;
|
|
1263
|
-
const
|
|
1341
|
+
const moduleLoader = yield* ConfigModuleLoader;
|
|
1342
|
+
const findConfig = Effect13.fn("RawConfigReader.findConfig")(function* (projectFolder) {
|
|
1264
1343
|
for (const name of ALLOWED_CONFIG_NAMES) {
|
|
1265
1344
|
const filePath = pathService.join(projectFolder, name);
|
|
1266
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
1345
|
+
const exists = yield* fs.exists(filePath).pipe(Effect13.catchAll(() => Effect13.succeed(false)));
|
|
1267
1346
|
if (exists) {
|
|
1268
1347
|
return filePath;
|
|
1269
1348
|
}
|
|
1270
1349
|
}
|
|
1271
1350
|
return null;
|
|
1272
1351
|
});
|
|
1273
|
-
const readRawConfig =
|
|
1274
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
1352
|
+
const readRawConfig = Effect13.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
|
|
1353
|
+
const exists = yield* fs.exists(filePath).pipe(Effect13.catchAll(() => Effect13.succeed(false)));
|
|
1275
1354
|
if (!exists) {
|
|
1276
|
-
return yield*
|
|
1355
|
+
return yield* Effect13.fail(
|
|
1277
1356
|
new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })
|
|
1278
1357
|
);
|
|
1279
1358
|
}
|
|
1280
1359
|
const fileContents = yield* fs.readFileString(filePath).pipe(
|
|
1281
|
-
|
|
1360
|
+
Effect13.mapError(
|
|
1282
1361
|
() => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })
|
|
1283
1362
|
)
|
|
1284
1363
|
);
|
|
1285
1364
|
if (fileContents.length === 0) {
|
|
1286
|
-
return yield*
|
|
1365
|
+
return yield* Effect13.fail(
|
|
1287
1366
|
new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })
|
|
1288
1367
|
);
|
|
1289
1368
|
}
|
|
1290
1369
|
const fileExtension = pathService.extname(filePath).toLowerCase();
|
|
1291
1370
|
let parsed;
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1371
|
+
if (MODULE_EXTENSIONS.includes(fileExtension)) {
|
|
1372
|
+
parsed = yield* moduleLoader.loadConfigModule(filePath);
|
|
1373
|
+
} else {
|
|
1374
|
+
try {
|
|
1375
|
+
if (fileExtension === ".json") {
|
|
1376
|
+
parsed = JSON.parse(fileContents);
|
|
1377
|
+
} else {
|
|
1378
|
+
parsed = parseYaml(fileContents);
|
|
1379
|
+
}
|
|
1380
|
+
} catch (error) {
|
|
1381
|
+
return yield* Effect13.fail(
|
|
1382
|
+
new ConfigFileParseError({
|
|
1383
|
+
message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1384
|
+
filePath,
|
|
1385
|
+
cause: error instanceof Error ? error.message : void 0
|
|
1386
|
+
})
|
|
1387
|
+
);
|
|
1299
1388
|
}
|
|
1300
|
-
} catch (error) {
|
|
1301
|
-
return yield* Effect12.fail(
|
|
1302
|
-
new ConfigFileParseError({
|
|
1303
|
-
message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1304
|
-
filePath,
|
|
1305
|
-
cause: error instanceof Error ? error.message : void 0
|
|
1306
|
-
})
|
|
1307
|
-
);
|
|
1308
1389
|
}
|
|
1309
1390
|
if (parsed == null) {
|
|
1310
|
-
return yield*
|
|
1391
|
+
return yield* Effect13.fail(
|
|
1311
1392
|
new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })
|
|
1312
1393
|
);
|
|
1313
1394
|
}
|
|
1314
1395
|
if (!options?.disableVersionCheck && typeof parsed.version !== "number") {
|
|
1315
|
-
return yield*
|
|
1396
|
+
return yield* Effect13.fail(
|
|
1316
1397
|
new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })
|
|
1317
1398
|
);
|
|
1318
1399
|
}
|
|
1319
1400
|
return parsed;
|
|
1320
1401
|
});
|
|
1321
1402
|
const readConfigFile = (configFilePath) => readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1403
|
+
Effect13.map((parsed) => parsed),
|
|
1404
|
+
Effect13.catchTag("ConfigFileNotFoundError", () => Effect13.succeed(null)),
|
|
1405
|
+
Effect13.withSpan("RawConfigReader.readConfigFile")
|
|
1325
1406
|
);
|
|
1326
1407
|
return { findConfig, readRawConfig, readConfigFile };
|
|
1327
1408
|
})
|
|
@@ -1331,17 +1412,17 @@ var RawConfigReader = class extends Effect12.Service()("RawConfigReader", {
|
|
|
1331
1412
|
// src/services/schema-validator.ts
|
|
1332
1413
|
import Ajv from "ajv";
|
|
1333
1414
|
import addFormats from "ajv-formats";
|
|
1334
|
-
import { Effect as
|
|
1335
|
-
var SchemaValidator = class extends
|
|
1336
|
-
effect:
|
|
1415
|
+
import { Effect as Effect14 } from "effect";
|
|
1416
|
+
var SchemaValidator = class extends Effect14.Service()("SchemaValidator", {
|
|
1417
|
+
effect: Effect14.gen(function* () {
|
|
1337
1418
|
const ajv = new Ajv();
|
|
1338
1419
|
addFormats(ajv);
|
|
1339
|
-
const validate =
|
|
1420
|
+
const validate = Effect14.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
|
|
1340
1421
|
const compiledValidate = ajv.compile(schema);
|
|
1341
1422
|
const valid = compiledValidate(config);
|
|
1342
1423
|
if (!valid) {
|
|
1343
1424
|
const errors = compiledValidate.errors?.map((e) => `${e.instancePath || "/"} ${e.message ?? ""}`.trim()) ?? [];
|
|
1344
|
-
return yield*
|
|
1425
|
+
return yield* Effect14.fail(
|
|
1345
1426
|
new ConfigSchemaValidationError({
|
|
1346
1427
|
message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,
|
|
1347
1428
|
filePath,
|
|
@@ -1358,7 +1439,7 @@ var SchemaValidator = class extends Effect13.Service()("SchemaValidator", {
|
|
|
1358
1439
|
// src/services/v4-config-parser.ts
|
|
1359
1440
|
import { FileSystem as FileSystem10, Path as Path8 } from "@effect/platform";
|
|
1360
1441
|
import { getFilesForPattern } from "@gigadrive/build-utils";
|
|
1361
|
-
import { Effect as
|
|
1442
|
+
import { Effect as Effect15 } from "effect";
|
|
1362
1443
|
import { minimatch } from "minimatch";
|
|
1363
1444
|
import safeRegex from "safe-regex2";
|
|
1364
1445
|
var MAX_ASSET_DEPTH = 100;
|
|
@@ -1464,7 +1545,7 @@ var mapRoute = (route, entrypoints) => ({
|
|
|
1464
1545
|
negativeRequirements: route.missing,
|
|
1465
1546
|
status: route.statusCode
|
|
1466
1547
|
});
|
|
1467
|
-
var parseEntrypoints =
|
|
1548
|
+
var parseEntrypoints = Effect15.fn("parseEntrypoints")(function* (config, projectFolder) {
|
|
1468
1549
|
const entrypoints = [];
|
|
1469
1550
|
if (config.functions == null) return entrypoints;
|
|
1470
1551
|
for (const [fnPath, func] of Object.entries(config.functions)) {
|
|
@@ -1474,7 +1555,7 @@ var parseEntrypoints = Effect14.fn("parseEntrypoints")(function* (config, projec
|
|
|
1474
1555
|
functionPath: fnPath
|
|
1475
1556
|
});
|
|
1476
1557
|
}
|
|
1477
|
-
const matchedFiles = yield*
|
|
1558
|
+
const matchedFiles = yield* Effect15.tryPromise({
|
|
1478
1559
|
try: () => getFilesForPattern(fnPath, projectFolder, func.excludeFiles),
|
|
1479
1560
|
catch: (error) => new FunctionConfigError({
|
|
1480
1561
|
message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -1510,14 +1591,14 @@ var parseEntrypoints = Effect14.fn("parseEntrypoints")(function* (config, projec
|
|
|
1510
1591
|
}
|
|
1511
1592
|
return entrypoints;
|
|
1512
1593
|
});
|
|
1513
|
-
var collectAssets =
|
|
1594
|
+
var collectAssets = Effect15.fn("collectAssets")(function* (config, projectFolder) {
|
|
1514
1595
|
if (config.assets == null) return [];
|
|
1515
1596
|
const fs = yield* FileSystem10.FileSystem;
|
|
1516
1597
|
const pathService = yield* Path8.Path;
|
|
1517
1598
|
const assetsPath = pathService.join(projectFolder, config.assets);
|
|
1518
|
-
const assetsExist = yield* fs.exists(assetsPath).pipe(
|
|
1599
|
+
const assetsExist = yield* fs.exists(assetsPath).pipe(Effect15.catchAll(() => Effect15.succeed(false)));
|
|
1519
1600
|
if (!assetsExist) return [];
|
|
1520
|
-
const stat = yield* fs.stat(assetsPath).pipe(
|
|
1601
|
+
const stat = yield* fs.stat(assetsPath).pipe(Effect15.catchAll(() => Effect15.succeed(null)));
|
|
1521
1602
|
if (!stat || stat.type !== "Directory") return [];
|
|
1522
1603
|
const allFiles = yield* collectFilesRecursively(assetsPath);
|
|
1523
1604
|
const assets = [];
|
|
@@ -1528,18 +1609,18 @@ var collectAssets = Effect14.fn("collectAssets")(function* (config, projectFolde
|
|
|
1528
1609
|
}
|
|
1529
1610
|
return assets;
|
|
1530
1611
|
});
|
|
1531
|
-
var collectFilesRecursively =
|
|
1612
|
+
var collectFilesRecursively = Effect15.fn("collectFilesRecursively")(
|
|
1532
1613
|
function* (basePath, relativePath = "", depth = 0) {
|
|
1533
1614
|
if (depth > MAX_ASSET_DEPTH) return [];
|
|
1534
1615
|
const fs = yield* FileSystem10.FileSystem;
|
|
1535
1616
|
const pathSvc = yield* Path8.Path;
|
|
1536
1617
|
const currentPath = relativePath ? pathSvc.join(basePath, relativePath) : basePath;
|
|
1537
|
-
const entries = yield* fs.readDirectory(currentPath).pipe(
|
|
1618
|
+
const entries = yield* fs.readDirectory(currentPath).pipe(Effect15.catchAll(() => Effect15.succeed([])));
|
|
1538
1619
|
const result = [];
|
|
1539
1620
|
for (const name of entries) {
|
|
1540
1621
|
const fullPath = pathSvc.join(currentPath, name);
|
|
1541
1622
|
const entryRelative = relativePath ? pathSvc.join(relativePath, name) : name;
|
|
1542
|
-
const stat = yield* fs.stat(fullPath).pipe(
|
|
1623
|
+
const stat = yield* fs.stat(fullPath).pipe(Effect15.catchAll(() => Effect15.succeed(null)));
|
|
1543
1624
|
if (!stat) continue;
|
|
1544
1625
|
if (stat.type === "Directory") {
|
|
1545
1626
|
const nested = yield* collectFilesRecursively(basePath, entryRelative, depth + 1);
|
|
@@ -1551,16 +1632,16 @@ var collectFilesRecursively = Effect14.fn("collectFilesRecursively")(
|
|
|
1551
1632
|
return result;
|
|
1552
1633
|
}
|
|
1553
1634
|
);
|
|
1554
|
-
var V4ConfigParser = class extends
|
|
1635
|
+
var V4ConfigParser = class extends Effect15.Service()("V4ConfigParser", {
|
|
1555
1636
|
accessors: true,
|
|
1556
|
-
effect:
|
|
1637
|
+
effect: Effect15.succeed({
|
|
1557
1638
|
/**
|
|
1558
1639
|
* Parses a ConfigV4 into a NormalizedConfig.
|
|
1559
1640
|
*
|
|
1560
1641
|
* @param config - The raw V4 config object
|
|
1561
1642
|
* @param projectFolder - Absolute path to the project root
|
|
1562
1643
|
*/
|
|
1563
|
-
parse:
|
|
1644
|
+
parse: Effect15.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
|
|
1564
1645
|
const entrypoints = yield* parseEntrypoints(config, projectFolder);
|
|
1565
1646
|
const assets = yield* collectAssets(config, projectFolder);
|
|
1566
1647
|
return {
|
|
@@ -1589,7 +1670,7 @@ var V4ConfigParser = class extends Effect14.Service()("V4ConfigParser", {
|
|
|
1589
1670
|
import { Path as Path9 } from "@effect/platform";
|
|
1590
1671
|
import { getFilesForPattern as getFilesForPattern2 } from "@gigadrive/build-utils";
|
|
1591
1672
|
import { deepMerge } from "@gigadrive/commons";
|
|
1592
|
-
import { Effect as
|
|
1673
|
+
import { Effect as Effect16 } from "effect";
|
|
1593
1674
|
|
|
1594
1675
|
// src/build-output-v3/determine-repo-root.ts
|
|
1595
1676
|
import path from "path";
|
|
@@ -1685,11 +1766,11 @@ var translateVercelRuntime = (runtime) => {
|
|
|
1685
1766
|
var CONFIG_PATH = ".vercel/output/config.json";
|
|
1686
1767
|
var FUNCTIONS_FOLDER = ".vercel/output/functions";
|
|
1687
1768
|
var FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;
|
|
1688
|
-
var VercelBuildOutputParser = class extends
|
|
1689
|
-
effect:
|
|
1769
|
+
var VercelBuildOutputParser = class extends Effect16.Service()("VercelBuildOutputParser", {
|
|
1770
|
+
effect: Effect16.gen(function* () {
|
|
1690
1771
|
const rawConfigReader = yield* RawConfigReader;
|
|
1691
1772
|
const pathService = yield* Path9.Path;
|
|
1692
|
-
const parse =
|
|
1773
|
+
const parse = Effect16.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
|
|
1693
1774
|
const config = yield* rawConfigReader.readConfigFile(pathService.join(projectFolder, CONFIG_PATH));
|
|
1694
1775
|
if (!config || typeof config.version !== "number" || config.version < 3) {
|
|
1695
1776
|
return parseResult;
|
|
@@ -1701,8 +1782,8 @@ var VercelBuildOutputParser = class extends Effect15.Service()("VercelBuildOutpu
|
|
|
1701
1782
|
merged.regions = [...new Set(merged.regions)];
|
|
1702
1783
|
return merged;
|
|
1703
1784
|
});
|
|
1704
|
-
const loadFunctions =
|
|
1705
|
-
const functionConfigs = yield*
|
|
1785
|
+
const loadFunctions = Effect16.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
|
|
1786
|
+
const functionConfigs = yield* Effect16.tryPromise({
|
|
1706
1787
|
try: () => getFilesForPattern2(FUNCTION_CONFIGS_PATTERN, projectFolder),
|
|
1707
1788
|
catch: (error) => new ConfigFileParseError({
|
|
1708
1789
|
message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -2301,7 +2382,7 @@ var schema_default = {
|
|
|
2301
2382
|
};
|
|
2302
2383
|
|
|
2303
2384
|
// src/parse-config.ts
|
|
2304
|
-
var parseConfigRaw =
|
|
2385
|
+
var parseConfigRaw = Effect17.fn("parseConfigRaw")(function* (filePath, projectFolder) {
|
|
2305
2386
|
const rawReader = yield* RawConfigReader;
|
|
2306
2387
|
const validator = yield* SchemaValidator;
|
|
2307
2388
|
const v4Parser = yield* V4ConfigParser;
|
|
@@ -2312,7 +2393,7 @@ var parseConfigRaw = Effect16.fn("parseConfigRaw")(function* (filePath, projectF
|
|
|
2312
2393
|
};
|
|
2313
2394
|
const schema = schemaMap[version];
|
|
2314
2395
|
if (!schema) {
|
|
2315
|
-
return yield*
|
|
2396
|
+
return yield* Effect17.fail(
|
|
2316
2397
|
new ConfigVersionError({
|
|
2317
2398
|
message: `Config file at ${filePath} has an unsupported version: ${version}`,
|
|
2318
2399
|
filePath,
|
|
@@ -2323,11 +2404,11 @@ var parseConfigRaw = Effect16.fn("parseConfigRaw")(function* (filePath, projectF
|
|
|
2323
2404
|
yield* validator.validate(parsed, schema, filePath);
|
|
2324
2405
|
return yield* v4Parser.parse(parsed, projectFolder);
|
|
2325
2406
|
});
|
|
2326
|
-
var parseConfig =
|
|
2407
|
+
var parseConfig = Effect17.fn("parseConfig")(function* (filePath, projectFolder) {
|
|
2327
2408
|
const parseResult = yield* parseConfigRaw(filePath, projectFolder);
|
|
2328
2409
|
return yield* postProcessConfig(parseResult, projectFolder);
|
|
2329
2410
|
});
|
|
2330
|
-
var postProcessConfig =
|
|
2411
|
+
var postProcessConfig = Effect17.fn("postProcessConfig")(function* (config, projectFolder) {
|
|
2331
2412
|
const vercelParser = yield* VercelBuildOutputParser;
|
|
2332
2413
|
let result = yield* vercelParser.parse(config, projectFolder);
|
|
2333
2414
|
const hasAssets = (result.assets?.paths?.length ?? 0) > 0 || (result.assets?.prefixes?.length ?? 0) > 0 || (result.assets?.manifests?.length ?? 0) > 0;
|
|
@@ -2357,7 +2438,12 @@ var AVAILABLE_RUNTIMES = [...RUNTIME_DEFINITIONS];
|
|
|
2357
2438
|
|
|
2358
2439
|
// src/services/index.ts
|
|
2359
2440
|
import { Layer } from "effect";
|
|
2360
|
-
var BaseLayers = Layer.mergeAll(
|
|
2441
|
+
var BaseLayers = Layer.mergeAll(
|
|
2442
|
+
ConfigModuleLoader.Default,
|
|
2443
|
+
RawConfigReader.Default,
|
|
2444
|
+
SchemaValidator.Default,
|
|
2445
|
+
V4ConfigParser.Default
|
|
2446
|
+
);
|
|
2361
2447
|
var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(Layer.provideMerge(BaseLayers));
|
|
2362
2448
|
export {
|
|
2363
2449
|
ALLOWED_CONFIG_NAMES,
|
|
@@ -2366,6 +2452,8 @@ export {
|
|
|
2366
2452
|
ConfigFileEmptyError,
|
|
2367
2453
|
ConfigFileNotFoundError,
|
|
2368
2454
|
ConfigFileParseError,
|
|
2455
|
+
ConfigModuleLoadError,
|
|
2456
|
+
ConfigModuleLoader,
|
|
2369
2457
|
ConfigSchemaValidationError,
|
|
2370
2458
|
ConfigVersionError,
|
|
2371
2459
|
DEFAULT_FUNCTION_DURATION_SECONDS,
|
|
@@ -2392,6 +2480,7 @@ export {
|
|
|
2392
2480
|
StaticAssetManifestV1Schema,
|
|
2393
2481
|
V4ConfigParser,
|
|
2394
2482
|
VercelBuildOutputParser,
|
|
2483
|
+
defineConfig,
|
|
2395
2484
|
detectFramework,
|
|
2396
2485
|
detectPackageManager,
|
|
2397
2486
|
filterFunctionsFromAssets,
|