@gigadrive/network-config 4.3.6 → 4.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +254 -173
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +216 -135
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -66,8 +66,8 @@ __export(src_exports, {
|
|
|
66
66
|
module.exports = __toCommonJS(src_exports);
|
|
67
67
|
|
|
68
68
|
// src/detection/detect-framework.ts
|
|
69
|
-
var
|
|
70
|
-
var
|
|
69
|
+
var import_platform8 = require("@effect/platform");
|
|
70
|
+
var import_effect10 = require("effect");
|
|
71
71
|
|
|
72
72
|
// src/detection/detect-package-manager.ts
|
|
73
73
|
var import_platform = require("@effect/platform");
|
|
@@ -116,6 +116,83 @@ var astro = {
|
|
|
116
116
|
})
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
+
// src/detection/frameworks/resolve-node-entrypoint.ts
|
|
120
|
+
var import_platform2 = require("@effect/platform");
|
|
121
|
+
var import_effect2 = require("effect");
|
|
122
|
+
var SCRIPT_RUNNERS = /* @__PURE__ */ new Set(["node", "bun", "tsx", "ts-node"]);
|
|
123
|
+
var COMMON_ENTRYPOINT_CANDIDATES = [
|
|
124
|
+
"index.js",
|
|
125
|
+
"src/index.js",
|
|
126
|
+
"index.ts",
|
|
127
|
+
"src/index.ts",
|
|
128
|
+
"app.js",
|
|
129
|
+
"src/app.js",
|
|
130
|
+
"server.js",
|
|
131
|
+
"src/server.js",
|
|
132
|
+
"app.ts",
|
|
133
|
+
"src/app.ts",
|
|
134
|
+
"server.ts",
|
|
135
|
+
"src/server.ts"
|
|
136
|
+
];
|
|
137
|
+
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
138
|
+
var parsePackageJson = (content) => {
|
|
139
|
+
try {
|
|
140
|
+
const parsed = JSON.parse(content);
|
|
141
|
+
if (!isRecord(parsed)) return void 0;
|
|
142
|
+
return parsed;
|
|
143
|
+
} catch {
|
|
144
|
+
return void 0;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
var normalizeEntrypointPath = (entrypoint) => {
|
|
148
|
+
const normalized = entrypoint.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
149
|
+
if (!normalized || normalized === "." || normalized.startsWith("/") || normalized.includes(":") || normalized.split("/").some((segment) => segment === "..")) {
|
|
150
|
+
return void 0;
|
|
151
|
+
}
|
|
152
|
+
return normalized;
|
|
153
|
+
};
|
|
154
|
+
var parseStartScript = (script) => {
|
|
155
|
+
const tokens = script.trim().split(/\s+/);
|
|
156
|
+
if (tokens.length < 2 || !SCRIPT_RUNNERS.has(tokens[0])) return void 0;
|
|
157
|
+
let index = 1;
|
|
158
|
+
if (tokens[0] === "bun" && tokens[index] === "run") index++;
|
|
159
|
+
while (index < tokens.length && tokens[index].startsWith("-")) index++;
|
|
160
|
+
return tokens[index];
|
|
161
|
+
};
|
|
162
|
+
var applyEntrypoint = (defaults, entrypoint) => ({
|
|
163
|
+
...defaults,
|
|
164
|
+
entrypoint,
|
|
165
|
+
routes: defaults.routes.map(
|
|
166
|
+
(route) => route.destination === defaults.entrypoint ? { ...route, destination: entrypoint } : route
|
|
167
|
+
)
|
|
168
|
+
});
|
|
169
|
+
var resolveNodeServerEntrypoint = (defaults, projectFolder) => import_effect2.Effect.gen(function* () {
|
|
170
|
+
const fs = yield* import_platform2.FileSystem.FileSystem;
|
|
171
|
+
const pathService = yield* import_platform2.Path.Path;
|
|
172
|
+
const isFile = (relativePath) => fs.stat(pathService.join(projectFolder, relativePath)).pipe(
|
|
173
|
+
import_effect2.Effect.map((info) => info.type === "File"),
|
|
174
|
+
import_effect2.Effect.catchAll(() => import_effect2.Effect.succeed(false))
|
|
175
|
+
);
|
|
176
|
+
const content = yield* fs.readFileString(pathService.join(projectFolder, "package.json")).pipe(import_effect2.Effect.catchAll(() => import_effect2.Effect.succeed(void 0)));
|
|
177
|
+
const manifest = content ? parsePackageJson(content) : void 0;
|
|
178
|
+
const startScript = typeof manifest?.scripts?.start === "string" ? manifest.scripts.start : void 0;
|
|
179
|
+
const candidates = [
|
|
180
|
+
typeof manifest?.main === "string" ? manifest.main : void 0,
|
|
181
|
+
startScript ? parseStartScript(startScript) : void 0,
|
|
182
|
+
defaults.entrypoint,
|
|
183
|
+
...COMMON_ENTRYPOINT_CANDIDATES
|
|
184
|
+
];
|
|
185
|
+
for (const candidate of candidates) {
|
|
186
|
+
if (!candidate) continue;
|
|
187
|
+
const normalized = normalizeEntrypointPath(candidate);
|
|
188
|
+
if (!normalized) continue;
|
|
189
|
+
if (yield* isFile(normalized)) {
|
|
190
|
+
return applyEntrypoint(defaults, normalized);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return defaults;
|
|
194
|
+
});
|
|
195
|
+
|
|
119
196
|
// src/detection/frameworks/elysia.ts
|
|
120
197
|
var elysia = {
|
|
121
198
|
slug: "elysia",
|
|
@@ -132,7 +209,8 @@ var elysia = {
|
|
|
132
209
|
entrypoint: "src/index.ts",
|
|
133
210
|
routes: [{ source: "/*", destination: "src/index.ts" }],
|
|
134
211
|
environmentVariables: { NODE_ENV: "production" }
|
|
135
|
-
})
|
|
212
|
+
}),
|
|
213
|
+
refineDefaultConfig: resolveNodeServerEntrypoint
|
|
136
214
|
};
|
|
137
215
|
|
|
138
216
|
// src/detection/frameworks/express.ts
|
|
@@ -151,7 +229,8 @@ var express = {
|
|
|
151
229
|
entrypoint: "index.js",
|
|
152
230
|
routes: [{ source: "/*", destination: "index.js" }],
|
|
153
231
|
environmentVariables: { NODE_ENV: "production" }
|
|
154
|
-
})
|
|
232
|
+
}),
|
|
233
|
+
refineDefaultConfig: resolveNodeServerEntrypoint
|
|
155
234
|
};
|
|
156
235
|
|
|
157
236
|
// src/detection/frameworks/fastify.ts
|
|
@@ -170,7 +249,8 @@ var fastify = {
|
|
|
170
249
|
entrypoint: "src/index.ts",
|
|
171
250
|
routes: [{ source: "/*", destination: "src/index.ts" }],
|
|
172
251
|
environmentVariables: { NODE_ENV: "production" }
|
|
173
|
-
})
|
|
252
|
+
}),
|
|
253
|
+
refineDefaultConfig: resolveNodeServerEntrypoint
|
|
174
254
|
};
|
|
175
255
|
|
|
176
256
|
// src/detection/frameworks/hono.ts
|
|
@@ -189,7 +269,8 @@ var hono = {
|
|
|
189
269
|
entrypoint: "src/index.ts",
|
|
190
270
|
routes: [{ source: "/*", destination: "src/index.ts" }],
|
|
191
271
|
environmentVariables: { NODE_ENV: "production" }
|
|
192
|
-
})
|
|
272
|
+
}),
|
|
273
|
+
refineDefaultConfig: resolveNodeServerEntrypoint
|
|
193
274
|
};
|
|
194
275
|
|
|
195
276
|
// src/detection/frameworks/laravel.ts
|
|
@@ -224,13 +305,13 @@ var laravel = {
|
|
|
224
305
|
};
|
|
225
306
|
|
|
226
307
|
// src/detection/frameworks/nestjs.ts
|
|
227
|
-
var
|
|
228
|
-
var
|
|
229
|
-
var
|
|
308
|
+
var import_platform3 = require("@effect/platform");
|
|
309
|
+
var import_effect3 = require("effect");
|
|
310
|
+
var isRecord2 = (value) => typeof value === "object" && value !== null;
|
|
230
311
|
var parseNestCliJson = (content) => {
|
|
231
312
|
try {
|
|
232
313
|
const parsed = JSON.parse(content);
|
|
233
|
-
if (!
|
|
314
|
+
if (!isRecord2(parsed)) return void 0;
|
|
234
315
|
return parsed;
|
|
235
316
|
} catch {
|
|
236
317
|
return void 0;
|
|
@@ -276,9 +357,9 @@ var nestjs = {
|
|
|
276
357
|
detectors: [{ matchPackage: "@nestjs/core" }],
|
|
277
358
|
priority: 90,
|
|
278
359
|
getDefaultConfig: () => createNestConfig("dist"),
|
|
279
|
-
refineDefaultConfig: (defaults, projectFolder) =>
|
|
280
|
-
const fs = yield*
|
|
281
|
-
const content = yield* fs.readFileString(`${projectFolder}/nest-cli.json`).pipe(
|
|
360
|
+
refineDefaultConfig: (defaults, projectFolder) => import_effect3.Effect.gen(function* () {
|
|
361
|
+
const fs = yield* import_platform3.FileSystem.FileSystem;
|
|
362
|
+
const content = yield* fs.readFileString(`${projectFolder}/nest-cli.json`).pipe(import_effect3.Effect.catchAll(() => import_effect3.Effect.succeed(void 0)));
|
|
282
363
|
if (!content) return defaults;
|
|
283
364
|
const nestConfig = parseNestCliJson(content);
|
|
284
365
|
const outputPath = nestConfig ? getProjectOutputPath(nestConfig) : void 0;
|
|
@@ -287,28 +368,28 @@ var nestjs = {
|
|
|
287
368
|
};
|
|
288
369
|
|
|
289
370
|
// src/detection/frameworks/nextjs.ts
|
|
290
|
-
var
|
|
291
|
-
var
|
|
371
|
+
var import_platform5 = require("@effect/platform");
|
|
372
|
+
var import_effect5 = require("effect");
|
|
292
373
|
|
|
293
374
|
// src/build-output-v3/get-default-path-map.ts
|
|
294
|
-
var
|
|
295
|
-
var
|
|
296
|
-
var getDefaultPathMap =
|
|
297
|
-
const fs = yield*
|
|
298
|
-
const pathService = yield*
|
|
375
|
+
var import_platform4 = require("@effect/platform");
|
|
376
|
+
var import_effect4 = require("effect");
|
|
377
|
+
var getDefaultPathMap = import_effect4.Effect.fn("getDefaultPathMap")(function* (directory) {
|
|
378
|
+
const fs = yield* import_platform4.FileSystem.FileSystem;
|
|
379
|
+
const pathService = yield* import_platform4.Path.Path;
|
|
299
380
|
const result = {};
|
|
300
|
-
const exists = yield* fs.exists(directory).pipe(
|
|
381
|
+
const exists = yield* fs.exists(directory).pipe(import_effect4.Effect.catchAll(() => import_effect4.Effect.succeed(false)));
|
|
301
382
|
if (!exists) {
|
|
302
383
|
return result;
|
|
303
384
|
}
|
|
304
385
|
const MAX_DEPTH = 100;
|
|
305
|
-
const processDirectory = (currentPath, basePath = "", depth = 0) =>
|
|
386
|
+
const processDirectory = (currentPath, basePath = "", depth = 0) => import_effect4.Effect.gen(function* () {
|
|
306
387
|
if (depth > MAX_DEPTH) return;
|
|
307
|
-
const entries = yield* fs.readDirectory(currentPath).pipe(
|
|
388
|
+
const entries = yield* fs.readDirectory(currentPath).pipe(import_effect4.Effect.catchAll(() => import_effect4.Effect.succeed([])));
|
|
308
389
|
for (const name of entries) {
|
|
309
390
|
const fullPath = pathService.join(currentPath, name);
|
|
310
391
|
const relativePath = basePath ? pathService.join(basePath, name) : name;
|
|
311
|
-
const stat = yield* fs.stat(fullPath).pipe(
|
|
392
|
+
const stat = yield* fs.stat(fullPath).pipe(import_effect4.Effect.catchAll(() => import_effect4.Effect.succeed(null)));
|
|
312
393
|
if (!stat) continue;
|
|
313
394
|
if (stat.type === "Directory") {
|
|
314
395
|
yield* processDirectory(fullPath, relativePath, depth + 1);
|
|
@@ -322,27 +403,27 @@ var getDefaultPathMap = import_effect3.Effect.fn("getDefaultPathMap")(function*
|
|
|
322
403
|
});
|
|
323
404
|
|
|
324
405
|
// src/nextjs-manifest.ts
|
|
325
|
-
var
|
|
406
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null;
|
|
326
407
|
var isPortableRelativePath = (value, allowCurrentDirectory = false) => {
|
|
327
408
|
if (typeof value !== "string") return false;
|
|
328
409
|
const normalized = value.replaceAll("\\", "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
329
410
|
return (allowCurrentDirectory || normalized !== "" && normalized !== ".") && !normalized.startsWith("/") && !/^[A-Za-z]:/.test(normalized) && !normalized.includes(":") && !normalized.split("/").some((segment) => segment === "..");
|
|
330
411
|
};
|
|
331
|
-
var isStringRecord = (value) =>
|
|
412
|
+
var isStringRecord = (value) => isRecord3(value) && Object.values(value).every((item) => typeof item === "string");
|
|
332
413
|
var isJsonValue = (value) => {
|
|
333
414
|
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
334
415
|
if (typeof value === "number") return Number.isFinite(value);
|
|
335
416
|
if (Array.isArray(value)) return value.every(isJsonValue);
|
|
336
|
-
return
|
|
417
|
+
return isRecord3(value) && Object.values(value).every(isJsonValue);
|
|
337
418
|
};
|
|
338
|
-
var isPrerenderOutput = (value) =>
|
|
339
|
-
var isStaticAssetPrefix = (value) =>
|
|
340
|
-
var isServerDescriptor = (value) =>
|
|
341
|
-
var isImagePolicy = (value) =>
|
|
419
|
+
var isPrerenderOutput = (value) => isRecord3(value) && value.type === "PRERENDER" && typeof value.id === "string" && typeof value.pathname === "string" && typeof value.parentOutputId === "string" && typeof value.groupId === "number" && isRecord3(value.config) && (value.fallback === void 0 || isRecord3(value.fallback) && (value.fallback.filePath === void 0 || isPortableRelativePath(value.fallback.filePath)));
|
|
420
|
+
var isStaticAssetPrefix = (value) => isRecord3(value) && isPortableRelativePath(value.sourceDir) && isPortableRelativePath(value.urlPrefix) && typeof value.immutable === "boolean";
|
|
421
|
+
var isServerDescriptor = (value) => isRecord3(value) && (value.maxDuration === void 0 || typeof value.maxDuration === "number") && (value.preferredRegion === void 0 || typeof value.preferredRegion === "string" || Array.isArray(value.preferredRegion) && value.preferredRegion.every((region) => typeof region === "string")) && (value.env === void 0 || isStringRecord(value.env));
|
|
422
|
+
var isImagePolicy = (value) => isRecord3(value) && Array.isArray(value.localPatterns) && Array.isArray(value.remotePatterns) && value.remotePatterns.every((pattern) => isRecord3(pattern) && typeof pattern.hostname === "string") && Array.isArray(value.widths) && value.widths.every((item) => typeof item === "number" && Number.isInteger(item) && item > 0) && Array.isArray(value.heights) && value.heights.every((item) => typeof item === "number" && Number.isInteger(item) && item > 0) && Array.isArray(value.qualities) && value.qualities.every((item) => typeof item === "number" && item >= 1 && item <= 100) && Array.isArray(value.formats) && value.formats.every((item) => ["image/avif", "image/webp", "image/jpeg", "image/png"].includes(String(item))) && typeof value.minimumCacheTTL === "number" && typeof value.dangerouslyAllowSVG === "boolean" && typeof value.contentSecurityPolicy === "string" && (value.contentDispositionType === "inline" || value.contentDispositionType === "attachment") && typeof value.maximumRedirects === "number" && typeof value.maximumResponseBody === "number" && isRecord3(value.variants);
|
|
342
423
|
var parseGigadriveNextBuildManifest = (content) => {
|
|
343
424
|
try {
|
|
344
425
|
const value = JSON.parse(content);
|
|
345
|
-
if (!
|
|
426
|
+
if (!isRecord3(value)) return void 0;
|
|
346
427
|
if (value.version === 1) {
|
|
347
428
|
if (value.output !== "standalone" && value.output !== "export" || !isPortableRelativePath(value.distDir) || !isPortableRelativePath(value.repoRootToProject, true) || typeof value.nextVersion !== "string" || typeof value.buildId !== "string") {
|
|
348
429
|
return void 0;
|
|
@@ -357,7 +438,7 @@ var parseGigadriveNextBuildManifest = (content) => {
|
|
|
357
438
|
return value;
|
|
358
439
|
}
|
|
359
440
|
if (value.mode === "standalone-v2") {
|
|
360
|
-
if (!isServerDescriptor(value.server) || !
|
|
441
|
+
if (!isServerDescriptor(value.server) || !isRecord3(value.config) || typeof value.config.basePath !== "string" || typeof value.config.trailingSlash !== "boolean" || typeof value.config.cacheComponents !== "boolean" || value.config.images !== void 0 && !isImagePolicy(value.config.images) || !isRecord3(value.routing) || !isJsonValue(value.routing) || !isRecord3(value.outputs) || !Array.isArray(value.outputs.prerenders) || !value.outputs.prerenders.every(isPrerenderOutput) || !Array.isArray(value.outputs.staticAssets) || !value.outputs.staticAssets.every(isStaticAssetPrefix)) {
|
|
361
442
|
return void 0;
|
|
362
443
|
}
|
|
363
444
|
return value;
|
|
@@ -396,22 +477,22 @@ var AVAILABLE_REGIONS = [...REGION_DEFINITIONS];
|
|
|
396
477
|
var toPortablePath = (value) => value.replaceAll("\\", "/");
|
|
397
478
|
var MAXIMUM_ENTRY_PAGE_PATHS = 50;
|
|
398
479
|
var STANDALONE_SERVER_MEMORY_MB = 1024;
|
|
399
|
-
var resolveStandaloneServer =
|
|
400
|
-
const fs = yield*
|
|
401
|
-
const pathService = yield*
|
|
480
|
+
var resolveStandaloneServer = import_effect5.Effect.fn("nextjs.resolveStandaloneServer")(function* (projectFolder, distDir, repoRootToProject) {
|
|
481
|
+
const fs = yield* import_platform5.FileSystem.FileSystem;
|
|
482
|
+
const pathService = yield* import_platform5.Path.Path;
|
|
402
483
|
const standaloneRoot = pathService.join(projectFolder, distDir, "standalone");
|
|
403
484
|
const monorepoServer = pathService.join(standaloneRoot, repoRootToProject, "server.js");
|
|
404
485
|
const rootServer = pathService.join(standaloneRoot, "server.js");
|
|
405
|
-
const monorepoServerExists = yield* fs.exists(monorepoServer).pipe(
|
|
486
|
+
const monorepoServerExists = yield* fs.exists(monorepoServer).pipe(import_effect5.Effect.catchAll(() => import_effect5.Effect.succeed(false)));
|
|
406
487
|
const serverPath = monorepoServerExists ? monorepoServer : rootServer;
|
|
407
|
-
const serverExists = yield* fs.exists(serverPath).pipe(
|
|
488
|
+
const serverExists = yield* fs.exists(serverPath).pipe(import_effect5.Effect.catchAll(() => import_effect5.Effect.succeed(false)));
|
|
408
489
|
if (!serverExists) return void 0;
|
|
409
490
|
const serverDirectory = pathService.dirname(serverPath);
|
|
410
491
|
const entrypoint = toPortablePath(pathService.relative(standaloneRoot, serverPath));
|
|
411
492
|
return { standaloneRoot, serverDirectory, entrypoint };
|
|
412
493
|
});
|
|
413
|
-
var buildStandalonePublicAssets =
|
|
414
|
-
const pathService = yield*
|
|
494
|
+
var buildStandalonePublicAssets = import_effect5.Effect.fn("nextjs.buildStandalonePublicAssets")(function* (projectFolder, standaloneRoot, serverDirectory) {
|
|
495
|
+
const pathService = yield* import_platform5.Path.Path;
|
|
415
496
|
const publicFiles = yield* getDefaultPathMap(pathService.join(projectFolder, "public"));
|
|
416
497
|
const assetPaths = [];
|
|
417
498
|
const assetOverrides = {};
|
|
@@ -427,8 +508,8 @@ var buildStandalonePublicAssets = import_effect4.Effect.fn("nextjs.buildStandalo
|
|
|
427
508
|
}
|
|
428
509
|
return { assetPaths, assetOverrides, filePathMap };
|
|
429
510
|
});
|
|
430
|
-
var createStaticExportConfig =
|
|
431
|
-
const pathService = yield*
|
|
511
|
+
var createStaticExportConfig = import_effect5.Effect.fn("nextjs.createStaticExportConfig")(function* (defaults, projectFolder) {
|
|
512
|
+
const pathService = yield* import_platform5.Path.Path;
|
|
432
513
|
const outputDirectory = pathService.join(projectFolder, "out");
|
|
433
514
|
const files = yield* getDefaultPathMap(outputDirectory);
|
|
434
515
|
const assetPaths = [];
|
|
@@ -451,8 +532,8 @@ var createStaticExportConfig = import_effect4.Effect.fn("nextjs.createStaticExpo
|
|
|
451
532
|
package: void 0
|
|
452
533
|
};
|
|
453
534
|
});
|
|
454
|
-
var createStandaloneConfig =
|
|
455
|
-
const pathService = yield*
|
|
535
|
+
var createStandaloneConfig = import_effect5.Effect.fn("nextjs.createStandaloneConfig")(function* (defaults, projectFolder, manifest) {
|
|
536
|
+
const pathService = yield* import_platform5.Path.Path;
|
|
456
537
|
const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);
|
|
457
538
|
if (!resolved) return defaults;
|
|
458
539
|
const { standaloneRoot, serverDirectory, entrypoint } = resolved;
|
|
@@ -485,7 +566,7 @@ var createStandaloneConfig = import_effect4.Effect.fn("nextjs.createStandaloneCo
|
|
|
485
566
|
}
|
|
486
567
|
};
|
|
487
568
|
});
|
|
488
|
-
var createStandaloneV2Config =
|
|
569
|
+
var createStandaloneV2Config = import_effect5.Effect.fn("nextjs.createStandaloneV2Config")(function* (defaults, projectFolder, manifest) {
|
|
489
570
|
const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);
|
|
490
571
|
if (!resolved) return defaults;
|
|
491
572
|
const { standaloneRoot, serverDirectory, entrypoint } = resolved;
|
|
@@ -586,9 +667,9 @@ var nextjs = {
|
|
|
586
667
|
routes: [{ source: "/*", destination: ".next/standalone/server.js" }],
|
|
587
668
|
environmentVariables: { NODE_ENV: "production" }
|
|
588
669
|
}),
|
|
589
|
-
refineDefaultConfig: (defaults, projectFolder) =>
|
|
590
|
-
const fs = yield*
|
|
591
|
-
const manifestContent = yield* fs.readFileString(`${projectFolder}/.gigadrive/nextjs.json`).pipe(
|
|
670
|
+
refineDefaultConfig: (defaults, projectFolder) => import_effect5.Effect.gen(function* () {
|
|
671
|
+
const fs = yield* import_platform5.FileSystem.FileSystem;
|
|
672
|
+
const manifestContent = yield* fs.readFileString(`${projectFolder}/.gigadrive/nextjs.json`).pipe(import_effect5.Effect.catchAll(() => import_effect5.Effect.succeed(void 0)));
|
|
592
673
|
const manifest = manifestContent ? parseGigadriveNextBuildManifest(manifestContent) : void 0;
|
|
593
674
|
if (!manifest) return defaults;
|
|
594
675
|
if (manifest.version === 2) {
|
|
@@ -599,8 +680,8 @@ var nextjs = {
|
|
|
599
680
|
};
|
|
600
681
|
|
|
601
682
|
// src/detection/frameworks/nuxt.ts
|
|
602
|
-
var
|
|
603
|
-
var
|
|
683
|
+
var import_platform6 = require("@effect/platform");
|
|
684
|
+
var import_effect6 = require("effect");
|
|
604
685
|
var isVercelBuildOutputV3 = (content) => {
|
|
605
686
|
try {
|
|
606
687
|
const config = JSON.parse(content);
|
|
@@ -627,9 +708,9 @@ var nuxt = {
|
|
|
627
708
|
routes: [{ source: "/*", destination: ".output/server/index.mjs" }],
|
|
628
709
|
environmentVariables: { NODE_ENV: "production", NITRO_PRESET: "node-server" }
|
|
629
710
|
}),
|
|
630
|
-
refineDefaultConfig: (defaults, projectFolder) =>
|
|
631
|
-
const fs = yield*
|
|
632
|
-
const buildOutputConfig = yield* fs.readFileString(`${projectFolder}/.vercel/output/config.json`).pipe(
|
|
711
|
+
refineDefaultConfig: (defaults, projectFolder) => import_effect6.Effect.gen(function* () {
|
|
712
|
+
const fs = yield* import_platform6.FileSystem.FileSystem;
|
|
713
|
+
const buildOutputConfig = yield* fs.readFileString(`${projectFolder}/.vercel/output/config.json`).pipe(import_effect6.Effect.catchAll(() => import_effect6.Effect.succeed(void 0)));
|
|
633
714
|
if (!buildOutputConfig || !isVercelBuildOutputV3(buildOutputConfig)) {
|
|
634
715
|
return defaults;
|
|
635
716
|
}
|
|
@@ -752,7 +833,7 @@ var FRAMEWORK_DEFINITIONS = [
|
|
|
752
833
|
].sort((a, b) => b.priority - a.priority);
|
|
753
834
|
|
|
754
835
|
// src/detection/generate-config.ts
|
|
755
|
-
var
|
|
836
|
+
var import_effect7 = require("effect");
|
|
756
837
|
var getInstallCommand = (pm) => {
|
|
757
838
|
switch (pm) {
|
|
758
839
|
case "bun":
|
|
@@ -768,11 +849,11 @@ var getInstallCommand = (pm) => {
|
|
|
768
849
|
return "npm install";
|
|
769
850
|
}
|
|
770
851
|
};
|
|
771
|
-
var generateConfig =
|
|
852
|
+
var generateConfig = import_effect7.Effect.fn("generateConfig")(function* (framework, packageManager, refinedDefaults) {
|
|
772
853
|
const defaults = refinedDefaults ?? framework.getDefaultConfig(packageManager);
|
|
773
854
|
const installCmd = defaults.installCommand ?? getInstallCommand(packageManager);
|
|
774
855
|
const commands = [installCmd, ...defaults.commands];
|
|
775
|
-
yield*
|
|
856
|
+
yield* import_effect7.Effect.logDebug(`Generating config for ${framework.name}`, {
|
|
776
857
|
runtime: defaults.runtime,
|
|
777
858
|
entrypoint: defaults.entrypoint,
|
|
778
859
|
commands
|
|
@@ -820,31 +901,31 @@ var generateConfig = import_effect6.Effect.fn("generateConfig")(function* (frame
|
|
|
820
901
|
});
|
|
821
902
|
|
|
822
903
|
// src/detection/read-dependencies.ts
|
|
823
|
-
var
|
|
824
|
-
var
|
|
904
|
+
var import_platform7 = require("@effect/platform");
|
|
905
|
+
var import_effect9 = require("effect");
|
|
825
906
|
|
|
826
907
|
// src/detection/types.ts
|
|
827
|
-
var
|
|
828
|
-
var ManifestNotFoundError = class extends
|
|
829
|
-
message:
|
|
830
|
-
filePath:
|
|
908
|
+
var import_effect8 = require("effect");
|
|
909
|
+
var ManifestNotFoundError = class extends import_effect8.Schema.TaggedError()("ManifestNotFoundError", {
|
|
910
|
+
message: import_effect8.Schema.String,
|
|
911
|
+
filePath: import_effect8.Schema.String
|
|
831
912
|
}) {
|
|
832
913
|
};
|
|
833
|
-
var ManifestReadError = class extends
|
|
834
|
-
message:
|
|
835
|
-
filePath:
|
|
914
|
+
var ManifestReadError = class extends import_effect8.Schema.TaggedError()("ManifestReadError", {
|
|
915
|
+
message: import_effect8.Schema.String,
|
|
916
|
+
filePath: import_effect8.Schema.String
|
|
836
917
|
}) {
|
|
837
918
|
};
|
|
838
|
-
var ManifestParseError = class extends
|
|
839
|
-
message:
|
|
840
|
-
filePath:
|
|
919
|
+
var ManifestParseError = class extends import_effect8.Schema.TaggedError()("ManifestParseError", {
|
|
920
|
+
message: import_effect8.Schema.String,
|
|
921
|
+
filePath: import_effect8.Schema.String
|
|
841
922
|
}) {
|
|
842
923
|
};
|
|
843
|
-
var FrameworkNotDetectedError = class extends
|
|
924
|
+
var FrameworkNotDetectedError = class extends import_effect8.Schema.TaggedError()(
|
|
844
925
|
"FrameworkNotDetectedError",
|
|
845
926
|
{
|
|
846
|
-
message:
|
|
847
|
-
directory:
|
|
927
|
+
message: import_effect8.Schema.String,
|
|
928
|
+
directory: import_effect8.Schema.String
|
|
848
929
|
}
|
|
849
930
|
) {
|
|
850
931
|
};
|
|
@@ -854,25 +935,25 @@ var MANIFEST_CONFIG = {
|
|
|
854
935
|
node: { file: "package.json", depKeys: ["dependencies", "devDependencies"] },
|
|
855
936
|
php: { file: "composer.json", depKeys: ["require", "require-dev"] }
|
|
856
937
|
};
|
|
857
|
-
var readManifest =
|
|
858
|
-
const fs = yield*
|
|
859
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
938
|
+
var readManifest = import_effect9.Effect.fn("readManifest")(function* (filePath) {
|
|
939
|
+
const fs = yield* import_platform7.FileSystem.FileSystem;
|
|
940
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect9.Effect.catchAll(() => import_effect9.Effect.succeed(false)));
|
|
860
941
|
if (!exists) {
|
|
861
|
-
return yield*
|
|
942
|
+
return yield* import_effect9.Effect.fail(new ManifestNotFoundError({ message: "Manifest not found", filePath }));
|
|
862
943
|
}
|
|
863
|
-
const content = yield* fs.readFileString(filePath).pipe(
|
|
864
|
-
const parsed = yield*
|
|
944
|
+
const content = yield* fs.readFileString(filePath).pipe(import_effect9.Effect.mapError(() => new ManifestReadError({ message: "Failed to read manifest", filePath })));
|
|
945
|
+
const parsed = yield* import_effect9.Effect.try({
|
|
865
946
|
try: () => JSON.parse(content),
|
|
866
947
|
catch: () => new ManifestParseError({ message: "Failed to parse manifest JSON", filePath })
|
|
867
948
|
});
|
|
868
949
|
return parsed;
|
|
869
950
|
});
|
|
870
|
-
var readDependencies =
|
|
871
|
-
const pathService = yield*
|
|
951
|
+
var readDependencies = import_effect9.Effect.fn("readDependencies")(function* (projectFolder, language) {
|
|
952
|
+
const pathService = yield* import_platform7.Path.Path;
|
|
872
953
|
const config = MANIFEST_CONFIG[language];
|
|
873
954
|
const filePath = pathService.join(projectFolder, config.file);
|
|
874
955
|
const manifest = yield* readManifest(filePath).pipe(
|
|
875
|
-
|
|
956
|
+
import_effect9.Effect.catchTag("ManifestNotFoundError", () => import_effect9.Effect.succeed(null))
|
|
876
957
|
);
|
|
877
958
|
if (!manifest) {
|
|
878
959
|
return /* @__PURE__ */ new Set();
|
|
@@ -890,9 +971,9 @@ var readDependencies = import_effect8.Effect.fn("readDependencies")(function* (p
|
|
|
890
971
|
});
|
|
891
972
|
|
|
892
973
|
// src/detection/detect-framework.ts
|
|
893
|
-
var matchesDetectionItem =
|
|
894
|
-
const fs = yield*
|
|
895
|
-
const pathService = yield*
|
|
974
|
+
var matchesDetectionItem = import_effect10.Effect.fn("matchesDetectionItem")(function* (item, projectFolder, framework, cachedReadDeps) {
|
|
975
|
+
const fs = yield* import_platform8.FileSystem.FileSystem;
|
|
976
|
+
const pathService = yield* import_platform8.Path.Path;
|
|
896
977
|
if (item.matchPackage != null) {
|
|
897
978
|
const deps = yield* cachedReadDeps(`${projectFolder}\0${framework.language}`);
|
|
898
979
|
if (!deps.has(item.matchPackage)) {
|
|
@@ -901,12 +982,12 @@ var matchesDetectionItem = import_effect9.Effect.fn("matchesDetectionItem")(func
|
|
|
901
982
|
}
|
|
902
983
|
if (item.path != null) {
|
|
903
984
|
const filePath = pathService.join(projectFolder, item.path);
|
|
904
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
985
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect10.Effect.catchAll(() => import_effect10.Effect.succeed(false)));
|
|
905
986
|
if (!exists) {
|
|
906
987
|
return false;
|
|
907
988
|
}
|
|
908
989
|
if (item.matchContent != null) {
|
|
909
|
-
const content = yield* fs.readFileString(filePath).pipe(
|
|
990
|
+
const content = yield* fs.readFileString(filePath).pipe(import_effect10.Effect.catchAll(() => import_effect10.Effect.succeed("")));
|
|
910
991
|
let regexMatch = false;
|
|
911
992
|
try {
|
|
912
993
|
regexMatch = new RegExp(item.matchContent).test(content);
|
|
@@ -919,7 +1000,7 @@ var matchesDetectionItem = import_effect9.Effect.fn("matchesDetectionItem")(func
|
|
|
919
1000
|
}
|
|
920
1001
|
return true;
|
|
921
1002
|
});
|
|
922
|
-
var matchesFramework =
|
|
1003
|
+
var matchesFramework = import_effect10.Effect.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
|
|
923
1004
|
for (const detector of framework.detectors) {
|
|
924
1005
|
const matches = yield* matchesDetectionItem(detector, projectFolder, framework, cachedReadDeps);
|
|
925
1006
|
if (!matches) {
|
|
@@ -928,9 +1009,9 @@ var matchesFramework = import_effect9.Effect.fn("matchesFramework")(function* (f
|
|
|
928
1009
|
}
|
|
929
1010
|
return true;
|
|
930
1011
|
});
|
|
931
|
-
var detectFramework =
|
|
932
|
-
yield*
|
|
933
|
-
const cachedReadDeps = yield*
|
|
1012
|
+
var detectFramework = import_effect10.Effect.fn("detectFramework")(function* (projectFolder) {
|
|
1013
|
+
yield* import_effect10.Effect.logDebug(`Detecting framework in ${projectFolder}`);
|
|
1014
|
+
const cachedReadDeps = yield* import_effect10.Effect.cachedFunction((key) => {
|
|
934
1015
|
const sepIndex = key.lastIndexOf("\0");
|
|
935
1016
|
const folder = key.slice(0, sepIndex);
|
|
936
1017
|
const language = key.slice(sepIndex + 1);
|
|
@@ -939,7 +1020,7 @@ var detectFramework = import_effect9.Effect.fn("detectFramework")(function* (pro
|
|
|
939
1020
|
for (const framework of FRAMEWORK_DEFINITIONS) {
|
|
940
1021
|
const matches = yield* matchesFramework(framework, projectFolder, cachedReadDeps);
|
|
941
1022
|
if (matches) {
|
|
942
|
-
yield*
|
|
1023
|
+
yield* import_effect10.Effect.log(`Detected framework: ${framework.name}`, { slug: framework.slug });
|
|
943
1024
|
const detectedPackageManager = yield* detectPackageManager(projectFolder);
|
|
944
1025
|
const packageManager = framework.language === "php" ? "composer" : detectedPackageManager;
|
|
945
1026
|
const defaults = framework.getDefaultConfig(packageManager);
|
|
@@ -948,7 +1029,7 @@ var detectFramework = import_effect9.Effect.fn("detectFramework")(function* (pro
|
|
|
948
1029
|
return { framework, packageManager, config };
|
|
949
1030
|
}
|
|
950
1031
|
}
|
|
951
|
-
return yield*
|
|
1032
|
+
return yield* import_effect10.Effect.fail(
|
|
952
1033
|
new FrameworkNotDetectedError({
|
|
953
1034
|
message: `No framework detected in project directory`,
|
|
954
1035
|
directory: projectFolder
|
|
@@ -957,9 +1038,9 @@ var detectFramework = import_effect9.Effect.fn("detectFramework")(function* (pro
|
|
|
957
1038
|
});
|
|
958
1039
|
|
|
959
1040
|
// src/detection/merge-config.ts
|
|
960
|
-
var
|
|
961
|
-
var mergeWithFrameworkDefaults =
|
|
962
|
-
yield*
|
|
1041
|
+
var import_effect11 = require("effect");
|
|
1042
|
+
var mergeWithFrameworkDefaults = import_effect11.Effect.fn("mergeWithFrameworkDefaults")(function* (userConfig, frameworkConfig) {
|
|
1043
|
+
yield* import_effect11.Effect.logDebug("Merging user config with framework defaults");
|
|
963
1044
|
const merged = {
|
|
964
1045
|
regions: userConfig.regions,
|
|
965
1046
|
commands: userConfig.commands.length > 0 ? userConfig.commands : frameworkConfig.commands,
|
|
@@ -980,41 +1061,41 @@ var mergeWithFrameworkDefaults = import_effect10.Effect.fn("mergeWithFrameworkDe
|
|
|
980
1061
|
});
|
|
981
1062
|
|
|
982
1063
|
// src/errors.ts
|
|
983
|
-
var
|
|
984
|
-
var ConfigFileNotFoundError = class extends
|
|
985
|
-
message:
|
|
986
|
-
filePath:
|
|
1064
|
+
var import_effect12 = require("effect");
|
|
1065
|
+
var ConfigFileNotFoundError = class extends import_effect12.Schema.TaggedError()("ConfigFileNotFoundError", {
|
|
1066
|
+
message: import_effect12.Schema.String,
|
|
1067
|
+
filePath: import_effect12.Schema.String
|
|
987
1068
|
}) {
|
|
988
1069
|
};
|
|
989
|
-
var ConfigFileEmptyError = class extends
|
|
990
|
-
message:
|
|
991
|
-
filePath:
|
|
1070
|
+
var ConfigFileEmptyError = class extends import_effect12.Schema.TaggedError()("ConfigFileEmptyError", {
|
|
1071
|
+
message: import_effect12.Schema.String,
|
|
1072
|
+
filePath: import_effect12.Schema.String
|
|
992
1073
|
}) {
|
|
993
1074
|
};
|
|
994
|
-
var ConfigFileParseError = class extends
|
|
995
|
-
message:
|
|
996
|
-
filePath:
|
|
997
|
-
cause:
|
|
1075
|
+
var ConfigFileParseError = class extends import_effect12.Schema.TaggedError()("ConfigFileParseError", {
|
|
1076
|
+
message: import_effect12.Schema.String,
|
|
1077
|
+
filePath: import_effect12.Schema.String,
|
|
1078
|
+
cause: import_effect12.Schema.optional(import_effect12.Schema.String)
|
|
998
1079
|
}) {
|
|
999
1080
|
};
|
|
1000
|
-
var ConfigVersionError = class extends
|
|
1001
|
-
message:
|
|
1002
|
-
filePath:
|
|
1003
|
-
version:
|
|
1081
|
+
var ConfigVersionError = class extends import_effect12.Schema.TaggedError()("ConfigVersionError", {
|
|
1082
|
+
message: import_effect12.Schema.String,
|
|
1083
|
+
filePath: import_effect12.Schema.String,
|
|
1084
|
+
version: import_effect12.Schema.optional(import_effect12.Schema.Number)
|
|
1004
1085
|
}) {
|
|
1005
1086
|
};
|
|
1006
|
-
var ConfigSchemaValidationError = class extends
|
|
1087
|
+
var ConfigSchemaValidationError = class extends import_effect12.Schema.TaggedError()(
|
|
1007
1088
|
"ConfigSchemaValidationError",
|
|
1008
1089
|
{
|
|
1009
|
-
message:
|
|
1010
|
-
filePath:
|
|
1011
|
-
validationErrors:
|
|
1090
|
+
message: import_effect12.Schema.String,
|
|
1091
|
+
filePath: import_effect12.Schema.String,
|
|
1092
|
+
validationErrors: import_effect12.Schema.Array(import_effect12.Schema.String)
|
|
1012
1093
|
}
|
|
1013
1094
|
) {
|
|
1014
1095
|
};
|
|
1015
|
-
var FunctionConfigError = class extends
|
|
1016
|
-
message:
|
|
1017
|
-
functionPath:
|
|
1096
|
+
var FunctionConfigError = class extends import_effect12.Schema.TaggedError()("FunctionConfigError", {
|
|
1097
|
+
message: import_effect12.Schema.String,
|
|
1098
|
+
functionPath: import_effect12.Schema.String
|
|
1018
1099
|
}) {
|
|
1019
1100
|
};
|
|
1020
1101
|
|
|
@@ -1034,11 +1115,11 @@ var DEFAULT_FUNCTION_DURATION_SECONDS = 30;
|
|
|
1034
1115
|
var MAX_FUNCTION_DURATION_SECONDS = 28800;
|
|
1035
1116
|
|
|
1036
1117
|
// src/parse-config.ts
|
|
1037
|
-
var
|
|
1118
|
+
var import_effect17 = require("effect");
|
|
1038
1119
|
|
|
1039
1120
|
// src/services/raw-config-reader.ts
|
|
1040
|
-
var
|
|
1041
|
-
var
|
|
1121
|
+
var import_platform9 = require("@effect/platform");
|
|
1122
|
+
var import_effect13 = require("effect");
|
|
1042
1123
|
var import_yaml = require("yaml");
|
|
1043
1124
|
var ALLOWED_CONFIG_NAMES = [
|
|
1044
1125
|
"gigadrive.yaml",
|
|
@@ -1047,34 +1128,34 @@ var ALLOWED_CONFIG_NAMES = [
|
|
|
1047
1128
|
"nebula.yml",
|
|
1048
1129
|
"nebula.json"
|
|
1049
1130
|
];
|
|
1050
|
-
var RawConfigReader = class extends
|
|
1051
|
-
effect:
|
|
1052
|
-
const fs = yield*
|
|
1053
|
-
const pathService = yield*
|
|
1054
|
-
const findConfig =
|
|
1131
|
+
var RawConfigReader = class extends import_effect13.Effect.Service()("RawConfigReader", {
|
|
1132
|
+
effect: import_effect13.Effect.gen(function* () {
|
|
1133
|
+
const fs = yield* import_platform9.FileSystem.FileSystem;
|
|
1134
|
+
const pathService = yield* import_platform9.Path.Path;
|
|
1135
|
+
const findConfig = import_effect13.Effect.fn("RawConfigReader.findConfig")(function* (projectFolder) {
|
|
1055
1136
|
for (const name of ALLOWED_CONFIG_NAMES) {
|
|
1056
1137
|
const filePath = pathService.join(projectFolder, name);
|
|
1057
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
1138
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect13.Effect.catchAll(() => import_effect13.Effect.succeed(false)));
|
|
1058
1139
|
if (exists) {
|
|
1059
1140
|
return filePath;
|
|
1060
1141
|
}
|
|
1061
1142
|
}
|
|
1062
1143
|
return null;
|
|
1063
1144
|
});
|
|
1064
|
-
const readRawConfig =
|
|
1065
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
1145
|
+
const readRawConfig = import_effect13.Effect.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
|
|
1146
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect13.Effect.catchAll(() => import_effect13.Effect.succeed(false)));
|
|
1066
1147
|
if (!exists) {
|
|
1067
|
-
return yield*
|
|
1148
|
+
return yield* import_effect13.Effect.fail(
|
|
1068
1149
|
new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })
|
|
1069
1150
|
);
|
|
1070
1151
|
}
|
|
1071
1152
|
const fileContents = yield* fs.readFileString(filePath).pipe(
|
|
1072
|
-
|
|
1153
|
+
import_effect13.Effect.mapError(
|
|
1073
1154
|
() => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })
|
|
1074
1155
|
)
|
|
1075
1156
|
);
|
|
1076
1157
|
if (fileContents.length === 0) {
|
|
1077
|
-
return yield*
|
|
1158
|
+
return yield* import_effect13.Effect.fail(
|
|
1078
1159
|
new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })
|
|
1079
1160
|
);
|
|
1080
1161
|
}
|
|
@@ -1089,7 +1170,7 @@ var RawConfigReader = class extends import_effect12.Effect.Service()("RawConfigR
|
|
|
1089
1170
|
parsed = (0, import_yaml.parse)(fileContents);
|
|
1090
1171
|
}
|
|
1091
1172
|
} catch (error) {
|
|
1092
|
-
return yield*
|
|
1173
|
+
return yield* import_effect13.Effect.fail(
|
|
1093
1174
|
new ConfigFileParseError({
|
|
1094
1175
|
message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1095
1176
|
filePath,
|
|
@@ -1098,21 +1179,21 @@ var RawConfigReader = class extends import_effect12.Effect.Service()("RawConfigR
|
|
|
1098
1179
|
);
|
|
1099
1180
|
}
|
|
1100
1181
|
if (parsed == null) {
|
|
1101
|
-
return yield*
|
|
1182
|
+
return yield* import_effect13.Effect.fail(
|
|
1102
1183
|
new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })
|
|
1103
1184
|
);
|
|
1104
1185
|
}
|
|
1105
1186
|
if (!options?.disableVersionCheck && typeof parsed.version !== "number") {
|
|
1106
|
-
return yield*
|
|
1187
|
+
return yield* import_effect13.Effect.fail(
|
|
1107
1188
|
new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })
|
|
1108
1189
|
);
|
|
1109
1190
|
}
|
|
1110
1191
|
return parsed;
|
|
1111
1192
|
});
|
|
1112
1193
|
const readConfigFile = (configFilePath) => readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1194
|
+
import_effect13.Effect.map((parsed) => parsed),
|
|
1195
|
+
import_effect13.Effect.catchTag("ConfigFileNotFoundError", () => import_effect13.Effect.succeed(null)),
|
|
1196
|
+
import_effect13.Effect.withSpan("RawConfigReader.readConfigFile")
|
|
1116
1197
|
);
|
|
1117
1198
|
return { findConfig, readRawConfig, readConfigFile };
|
|
1118
1199
|
})
|
|
@@ -1122,17 +1203,17 @@ var RawConfigReader = class extends import_effect12.Effect.Service()("RawConfigR
|
|
|
1122
1203
|
// src/services/schema-validator.ts
|
|
1123
1204
|
var import_ajv = __toESM(require("ajv"));
|
|
1124
1205
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1125
|
-
var
|
|
1126
|
-
var SchemaValidator = class extends
|
|
1127
|
-
effect:
|
|
1206
|
+
var import_effect14 = require("effect");
|
|
1207
|
+
var SchemaValidator = class extends import_effect14.Effect.Service()("SchemaValidator", {
|
|
1208
|
+
effect: import_effect14.Effect.gen(function* () {
|
|
1128
1209
|
const ajv = new import_ajv.default();
|
|
1129
1210
|
(0, import_ajv_formats.default)(ajv);
|
|
1130
|
-
const validate =
|
|
1211
|
+
const validate = import_effect14.Effect.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
|
|
1131
1212
|
const compiledValidate = ajv.compile(schema);
|
|
1132
1213
|
const valid = compiledValidate(config);
|
|
1133
1214
|
if (!valid) {
|
|
1134
1215
|
const errors = compiledValidate.errors?.map((e) => `${e.instancePath || "/"} ${e.message ?? ""}`.trim()) ?? [];
|
|
1135
|
-
return yield*
|
|
1216
|
+
return yield* import_effect14.Effect.fail(
|
|
1136
1217
|
new ConfigSchemaValidationError({
|
|
1137
1218
|
message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,
|
|
1138
1219
|
filePath,
|
|
@@ -1147,9 +1228,9 @@ var SchemaValidator = class extends import_effect13.Effect.Service()("SchemaVali
|
|
|
1147
1228
|
};
|
|
1148
1229
|
|
|
1149
1230
|
// src/services/v4-config-parser.ts
|
|
1150
|
-
var
|
|
1231
|
+
var import_platform10 = require("@effect/platform");
|
|
1151
1232
|
var import_build_utils = require("@gigadrive/build-utils");
|
|
1152
|
-
var
|
|
1233
|
+
var import_effect15 = require("effect");
|
|
1153
1234
|
var import_minimatch = require("minimatch");
|
|
1154
1235
|
var import_safe_regex2 = __toESM(require("safe-regex2"));
|
|
1155
1236
|
var MAX_ASSET_DEPTH = 100;
|
|
@@ -1238,7 +1319,7 @@ var mapRoute = (route, entrypoints) => ({
|
|
|
1238
1319
|
negativeRequirements: route.missing,
|
|
1239
1320
|
status: route.statusCode
|
|
1240
1321
|
});
|
|
1241
|
-
var parseEntrypoints =
|
|
1322
|
+
var parseEntrypoints = import_effect15.Effect.fn("parseEntrypoints")(function* (config, projectFolder) {
|
|
1242
1323
|
const entrypoints = [];
|
|
1243
1324
|
if (config.functions == null) return entrypoints;
|
|
1244
1325
|
for (const [fnPath, func] of Object.entries(config.functions)) {
|
|
@@ -1248,7 +1329,7 @@ var parseEntrypoints = import_effect14.Effect.fn("parseEntrypoints")(function* (
|
|
|
1248
1329
|
functionPath: fnPath
|
|
1249
1330
|
});
|
|
1250
1331
|
}
|
|
1251
|
-
const matchedFiles = yield*
|
|
1332
|
+
const matchedFiles = yield* import_effect15.Effect.tryPromise({
|
|
1252
1333
|
try: () => (0, import_build_utils.getFilesForPattern)(fnPath, projectFolder, func.excludeFiles),
|
|
1253
1334
|
catch: (error) => new FunctionConfigError({
|
|
1254
1335
|
message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -1284,14 +1365,14 @@ var parseEntrypoints = import_effect14.Effect.fn("parseEntrypoints")(function* (
|
|
|
1284
1365
|
}
|
|
1285
1366
|
return entrypoints;
|
|
1286
1367
|
});
|
|
1287
|
-
var collectAssets =
|
|
1368
|
+
var collectAssets = import_effect15.Effect.fn("collectAssets")(function* (config, projectFolder) {
|
|
1288
1369
|
if (config.assets == null) return [];
|
|
1289
|
-
const fs = yield*
|
|
1290
|
-
const pathService = yield*
|
|
1370
|
+
const fs = yield* import_platform10.FileSystem.FileSystem;
|
|
1371
|
+
const pathService = yield* import_platform10.Path.Path;
|
|
1291
1372
|
const assetsPath = pathService.join(projectFolder, config.assets);
|
|
1292
|
-
const assetsExist = yield* fs.exists(assetsPath).pipe(
|
|
1373
|
+
const assetsExist = yield* fs.exists(assetsPath).pipe(import_effect15.Effect.catchAll(() => import_effect15.Effect.succeed(false)));
|
|
1293
1374
|
if (!assetsExist) return [];
|
|
1294
|
-
const stat = yield* fs.stat(assetsPath).pipe(
|
|
1375
|
+
const stat = yield* fs.stat(assetsPath).pipe(import_effect15.Effect.catchAll(() => import_effect15.Effect.succeed(null)));
|
|
1295
1376
|
if (!stat || stat.type !== "Directory") return [];
|
|
1296
1377
|
const allFiles = yield* collectFilesRecursively(assetsPath);
|
|
1297
1378
|
const assets = [];
|
|
@@ -1302,18 +1383,18 @@ var collectAssets = import_effect14.Effect.fn("collectAssets")(function* (config
|
|
|
1302
1383
|
}
|
|
1303
1384
|
return assets;
|
|
1304
1385
|
});
|
|
1305
|
-
var collectFilesRecursively =
|
|
1386
|
+
var collectFilesRecursively = import_effect15.Effect.fn("collectFilesRecursively")(
|
|
1306
1387
|
function* (basePath, relativePath = "", depth = 0) {
|
|
1307
1388
|
if (depth > MAX_ASSET_DEPTH) return [];
|
|
1308
|
-
const fs = yield*
|
|
1309
|
-
const pathSvc = yield*
|
|
1389
|
+
const fs = yield* import_platform10.FileSystem.FileSystem;
|
|
1390
|
+
const pathSvc = yield* import_platform10.Path.Path;
|
|
1310
1391
|
const currentPath = relativePath ? pathSvc.join(basePath, relativePath) : basePath;
|
|
1311
|
-
const entries = yield* fs.readDirectory(currentPath).pipe(
|
|
1392
|
+
const entries = yield* fs.readDirectory(currentPath).pipe(import_effect15.Effect.catchAll(() => import_effect15.Effect.succeed([])));
|
|
1312
1393
|
const result = [];
|
|
1313
1394
|
for (const name of entries) {
|
|
1314
1395
|
const fullPath = pathSvc.join(currentPath, name);
|
|
1315
1396
|
const entryRelative = relativePath ? pathSvc.join(relativePath, name) : name;
|
|
1316
|
-
const stat = yield* fs.stat(fullPath).pipe(
|
|
1397
|
+
const stat = yield* fs.stat(fullPath).pipe(import_effect15.Effect.catchAll(() => import_effect15.Effect.succeed(null)));
|
|
1317
1398
|
if (!stat) continue;
|
|
1318
1399
|
if (stat.type === "Directory") {
|
|
1319
1400
|
const nested = yield* collectFilesRecursively(basePath, entryRelative, depth + 1);
|
|
@@ -1325,16 +1406,16 @@ var collectFilesRecursively = import_effect14.Effect.fn("collectFilesRecursively
|
|
|
1325
1406
|
return result;
|
|
1326
1407
|
}
|
|
1327
1408
|
);
|
|
1328
|
-
var V4ConfigParser = class extends
|
|
1409
|
+
var V4ConfigParser = class extends import_effect15.Effect.Service()("V4ConfigParser", {
|
|
1329
1410
|
accessors: true,
|
|
1330
|
-
effect:
|
|
1411
|
+
effect: import_effect15.Effect.succeed({
|
|
1331
1412
|
/**
|
|
1332
1413
|
* Parses a ConfigV4 into a NormalizedConfig.
|
|
1333
1414
|
*
|
|
1334
1415
|
* @param config - The raw V4 config object
|
|
1335
1416
|
* @param projectFolder - Absolute path to the project root
|
|
1336
1417
|
*/
|
|
1337
|
-
parse:
|
|
1418
|
+
parse: import_effect15.Effect.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
|
|
1338
1419
|
const entrypoints = yield* parseEntrypoints(config, projectFolder);
|
|
1339
1420
|
const assets = yield* collectAssets(config, projectFolder);
|
|
1340
1421
|
return {
|
|
@@ -1359,10 +1440,10 @@ var V4ConfigParser = class extends import_effect14.Effect.Service()("V4ConfigPar
|
|
|
1359
1440
|
};
|
|
1360
1441
|
|
|
1361
1442
|
// src/services/vercel-build-output-parser.ts
|
|
1362
|
-
var
|
|
1443
|
+
var import_platform11 = require("@effect/platform");
|
|
1363
1444
|
var import_build_utils2 = require("@gigadrive/build-utils");
|
|
1364
1445
|
var import_commons = require("@gigadrive/commons");
|
|
1365
|
-
var
|
|
1446
|
+
var import_effect16 = require("effect");
|
|
1366
1447
|
|
|
1367
1448
|
// src/build-output-v3/determine-repo-root.ts
|
|
1368
1449
|
var import_path = __toESM(require("path"));
|
|
@@ -1458,11 +1539,11 @@ var translateVercelRuntime = (runtime) => {
|
|
|
1458
1539
|
var CONFIG_PATH = ".vercel/output/config.json";
|
|
1459
1540
|
var FUNCTIONS_FOLDER = ".vercel/output/functions";
|
|
1460
1541
|
var FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;
|
|
1461
|
-
var VercelBuildOutputParser = class extends
|
|
1462
|
-
effect:
|
|
1542
|
+
var VercelBuildOutputParser = class extends import_effect16.Effect.Service()("VercelBuildOutputParser", {
|
|
1543
|
+
effect: import_effect16.Effect.gen(function* () {
|
|
1463
1544
|
const rawConfigReader = yield* RawConfigReader;
|
|
1464
|
-
const pathService = yield*
|
|
1465
|
-
const parse =
|
|
1545
|
+
const pathService = yield* import_platform11.Path.Path;
|
|
1546
|
+
const parse = import_effect16.Effect.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
|
|
1466
1547
|
const config = yield* rawConfigReader.readConfigFile(pathService.join(projectFolder, CONFIG_PATH));
|
|
1467
1548
|
if (!config || typeof config.version !== "number" || config.version < 3) {
|
|
1468
1549
|
return parseResult;
|
|
@@ -1474,8 +1555,8 @@ var VercelBuildOutputParser = class extends import_effect15.Effect.Service()("Ve
|
|
|
1474
1555
|
merged.regions = [...new Set(merged.regions)];
|
|
1475
1556
|
return merged;
|
|
1476
1557
|
});
|
|
1477
|
-
const loadFunctions =
|
|
1478
|
-
const functionConfigs = yield*
|
|
1558
|
+
const loadFunctions = import_effect16.Effect.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
|
|
1559
|
+
const functionConfigs = yield* import_effect16.Effect.tryPromise({
|
|
1479
1560
|
try: () => (0, import_build_utils2.getFilesForPattern)(FUNCTION_CONFIGS_PATTERN, projectFolder),
|
|
1480
1561
|
catch: (error) => new ConfigFileParseError({
|
|
1481
1562
|
message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -2040,7 +2121,7 @@ var schema_default = {
|
|
|
2040
2121
|
};
|
|
2041
2122
|
|
|
2042
2123
|
// src/parse-config.ts
|
|
2043
|
-
var parseConfigRaw =
|
|
2124
|
+
var parseConfigRaw = import_effect17.Effect.fn("parseConfigRaw")(function* (filePath, projectFolder) {
|
|
2044
2125
|
const rawReader = yield* RawConfigReader;
|
|
2045
2126
|
const validator = yield* SchemaValidator;
|
|
2046
2127
|
const v4Parser = yield* V4ConfigParser;
|
|
@@ -2051,7 +2132,7 @@ var parseConfigRaw = import_effect16.Effect.fn("parseConfigRaw")(function* (file
|
|
|
2051
2132
|
};
|
|
2052
2133
|
const schema = schemaMap[version];
|
|
2053
2134
|
if (!schema) {
|
|
2054
|
-
return yield*
|
|
2135
|
+
return yield* import_effect17.Effect.fail(
|
|
2055
2136
|
new ConfigVersionError({
|
|
2056
2137
|
message: `Config file at ${filePath} has an unsupported version: ${version}`,
|
|
2057
2138
|
filePath,
|
|
@@ -2062,11 +2143,11 @@ var parseConfigRaw = import_effect16.Effect.fn("parseConfigRaw")(function* (file
|
|
|
2062
2143
|
yield* validator.validate(parsed, schema, filePath);
|
|
2063
2144
|
return yield* v4Parser.parse(parsed, projectFolder);
|
|
2064
2145
|
});
|
|
2065
|
-
var parseConfig =
|
|
2146
|
+
var parseConfig = import_effect17.Effect.fn("parseConfig")(function* (filePath, projectFolder) {
|
|
2066
2147
|
const parseResult = yield* parseConfigRaw(filePath, projectFolder);
|
|
2067
2148
|
return yield* postProcessConfig(parseResult, projectFolder);
|
|
2068
2149
|
});
|
|
2069
|
-
var postProcessConfig =
|
|
2150
|
+
var postProcessConfig = import_effect17.Effect.fn("postProcessConfig")(function* (config, projectFolder) {
|
|
2070
2151
|
const vercelParser = yield* VercelBuildOutputParser;
|
|
2071
2152
|
let result = yield* vercelParser.parse(config, projectFolder);
|
|
2072
2153
|
if (result.entrypoints.length === 0 && (result.assets?.paths?.length || 0) === 0 && result.routes.length === 0) {
|
|
@@ -2094,9 +2175,9 @@ var RUNTIME_DEFINITIONS = [
|
|
|
2094
2175
|
var AVAILABLE_RUNTIMES = [...RUNTIME_DEFINITIONS];
|
|
2095
2176
|
|
|
2096
2177
|
// src/services/index.ts
|
|
2097
|
-
var
|
|
2098
|
-
var BaseLayers =
|
|
2099
|
-
var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(
|
|
2178
|
+
var import_effect18 = require("effect");
|
|
2179
|
+
var BaseLayers = import_effect18.Layer.mergeAll(RawConfigReader.Default, SchemaValidator.Default, V4ConfigParser.Default);
|
|
2180
|
+
var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect18.Layer.provideMerge(BaseLayers));
|
|
2100
2181
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2101
2182
|
0 && (module.exports = {
|
|
2102
2183
|
ALLOWED_CONFIG_NAMES,
|