@gigadrive/network-config 4.4.0 → 4.5.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 +295 -107
- package/dist/index.d.ts +295 -107
- package/dist/index.js +418 -196
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +302 -93
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs-adapter.js +188 -9
- package/dist/nextjs-adapter.js.map +1 -1
- package/dist/nextjs-adapter.mjs +189 -10
- package/dist/nextjs-adapter.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42,6 +42,14 @@ __export(src_exports, {
|
|
|
42
42
|
FRAMEWORK_DEFINITIONS: () => FRAMEWORK_DEFINITIONS,
|
|
43
43
|
FrameworkNotDetectedError: () => FrameworkNotDetectedError,
|
|
44
44
|
FunctionConfigError: () => FunctionConfigError,
|
|
45
|
+
GigadriveNextBuildManifestSchema: () => GigadriveNextBuildManifestSchema,
|
|
46
|
+
GigadriveNextBuildManifestV1Schema: () => GigadriveNextBuildManifestV1Schema,
|
|
47
|
+
GigadriveNextBuildManifestV2ExportSchema: () => GigadriveNextBuildManifestV2ExportSchema,
|
|
48
|
+
GigadriveNextBuildManifestV2StandaloneSchema: () => GigadriveNextBuildManifestV2StandaloneSchema,
|
|
49
|
+
GigadriveNextPrerenderManifestV1Schema: () => GigadriveNextPrerenderManifestV1Schema,
|
|
50
|
+
GigadriveNextPrerenderOutputSchema: () => GigadriveNextPrerenderOutputSchema,
|
|
51
|
+
GigadriveNextServerDescriptorSchema: () => GigadriveNextServerDescriptorSchema,
|
|
52
|
+
GigadriveNextStaticAssetPrefixSchema: () => GigadriveNextStaticAssetPrefixSchema,
|
|
45
53
|
MAX_FUNCTION_DURATION_SECONDS: () => MAX_FUNCTION_DURATION_SECONDS,
|
|
46
54
|
ManifestNotFoundError: () => ManifestNotFoundError,
|
|
47
55
|
ManifestParseError: () => ManifestParseError,
|
|
@@ -49,6 +57,9 @@ __export(src_exports, {
|
|
|
49
57
|
NetworkConfigLive: () => NetworkConfigLive,
|
|
50
58
|
RawConfigReader: () => RawConfigReader,
|
|
51
59
|
SchemaValidator: () => SchemaValidator,
|
|
60
|
+
StaticAssetHeadersSchema: () => StaticAssetHeadersSchema,
|
|
61
|
+
StaticAssetManifestEntrySchema: () => StaticAssetManifestEntrySchema,
|
|
62
|
+
StaticAssetManifestV1Schema: () => StaticAssetManifestV1Schema,
|
|
52
63
|
V4ConfigParser: () => V4ConfigParser,
|
|
53
64
|
VercelBuildOutputParser: () => VercelBuildOutputParser,
|
|
54
65
|
detectFramework: () => detectFramework,
|
|
@@ -60,18 +71,77 @@ __export(src_exports, {
|
|
|
60
71
|
parseConfig: () => parseConfig,
|
|
61
72
|
parseConfigRaw: () => parseConfigRaw,
|
|
62
73
|
parseGigadriveNextBuildManifest: () => parseGigadriveNextBuildManifest,
|
|
74
|
+
parseGigadriveNextPrerenderManifest: () => parseGigadriveNextPrerenderManifest,
|
|
75
|
+
parseStaticAssetManifest: () => parseStaticAssetManifest,
|
|
63
76
|
postProcessConfig: () => postProcessConfig,
|
|
64
77
|
readDependencies: () => readDependencies
|
|
65
78
|
});
|
|
66
79
|
module.exports = __toCommonJS(src_exports);
|
|
67
80
|
|
|
81
|
+
// src/asset-manifest.ts
|
|
82
|
+
var import_effect2 = require("effect");
|
|
83
|
+
|
|
84
|
+
// src/manifest-schema.ts
|
|
85
|
+
var import_effect = require("effect");
|
|
86
|
+
var HTTP_HEADER_NAME = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
87
|
+
var HTTP_HEADER_VALUE = /^[\t\x20-\x7e\x80-\xff]*$/;
|
|
88
|
+
var URL_PATHNAME_FORBIDDEN_CHARACTER = /[\x00-\x1f\x7f?#\\]/;
|
|
89
|
+
var isUrlDotSegment = (segment) => {
|
|
90
|
+
const decodedDots = segment.replace(/%2e/gi, ".");
|
|
91
|
+
return decodedDots === "." || decodedDots === "..";
|
|
92
|
+
};
|
|
93
|
+
var isPortableRelativePath = (value, allowCurrentDirectory = false) => {
|
|
94
|
+
const normalized = value.replaceAll("\\", "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
95
|
+
return (allowCurrentDirectory || normalized !== "" && normalized !== ".") && !normalized.startsWith("/") && !/^[A-Za-z]:/.test(normalized) && !normalized.includes(":") && !normalized.split("/").includes("..");
|
|
96
|
+
};
|
|
97
|
+
var PortableRelativePathSchema = import_effect.Schema.String.pipe(import_effect.Schema.filter((value) => isPortableRelativePath(value)));
|
|
98
|
+
var RepositoryRelativePathSchema = import_effect.Schema.String.pipe(
|
|
99
|
+
import_effect.Schema.filter((value) => isPortableRelativePath(value, true))
|
|
100
|
+
);
|
|
101
|
+
var UrlPathnameSchema = import_effect.Schema.String.pipe(
|
|
102
|
+
import_effect.Schema.filter(
|
|
103
|
+
(value) => value.startsWith("/") && !URL_PATHNAME_FORBIDDEN_CHARACTER.test(value) && !value.split("/").some(isUrlDotSegment)
|
|
104
|
+
)
|
|
105
|
+
);
|
|
106
|
+
var HttpHeaderValueSchema = import_effect.Schema.String.pipe(import_effect.Schema.pattern(HTTP_HEADER_VALUE));
|
|
107
|
+
var HttpHeadersSchema = import_effect.Schema.mutable(
|
|
108
|
+
import_effect.Schema.Record({
|
|
109
|
+
key: import_effect.Schema.String,
|
|
110
|
+
value: import_effect.Schema.Union(HttpHeaderValueSchema, import_effect.Schema.mutable(import_effect.Schema.Array(HttpHeaderValueSchema)))
|
|
111
|
+
})
|
|
112
|
+
).pipe(import_effect.Schema.filter((headers) => Object.keys(headers).every((name) => HTTP_HEADER_NAME.test(name))));
|
|
113
|
+
var HttpSingleValueHeadersSchema = import_effect.Schema.mutable(
|
|
114
|
+
import_effect.Schema.Record({ key: import_effect.Schema.String, value: HttpHeaderValueSchema })
|
|
115
|
+
).pipe(import_effect.Schema.filter((headers) => Object.keys(headers).every((name) => HTTP_HEADER_NAME.test(name))));
|
|
116
|
+
var decodeUnknown = (schema, value) => import_effect.Schema.decodeUnknownOption(schema, { onExcessProperty: "preserve" })(value).pipe(import_effect.Option.getOrUndefined);
|
|
117
|
+
var decodeJson = (schema, content) => decodeUnknown(import_effect.Schema.parseJson(schema), content);
|
|
118
|
+
|
|
119
|
+
// src/asset-manifest.ts
|
|
120
|
+
var StaticAssetHeadersSchema = HttpHeadersSchema;
|
|
121
|
+
var StaticAssetManifestEntrySchema = import_effect2.Schema.mutable(
|
|
122
|
+
import_effect2.Schema.Struct({
|
|
123
|
+
source: PortableRelativePathSchema,
|
|
124
|
+
path: UrlPathnameSchema,
|
|
125
|
+
status: import_effect2.Schema.optional(import_effect2.Schema.Int.pipe(import_effect2.Schema.between(100, 599))),
|
|
126
|
+
headers: import_effect2.Schema.optional(StaticAssetHeadersSchema),
|
|
127
|
+
immutable: import_effect2.Schema.optional(import_effect2.Schema.Boolean)
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
var StaticAssetManifestV1Schema = import_effect2.Schema.mutable(
|
|
131
|
+
import_effect2.Schema.Struct({
|
|
132
|
+
version: import_effect2.Schema.Literal(1),
|
|
133
|
+
assets: import_effect2.Schema.mutable(import_effect2.Schema.Array(StaticAssetManifestEntrySchema))
|
|
134
|
+
})
|
|
135
|
+
).pipe(import_effect2.Schema.filter(({ assets }) => new Set(assets.map(({ path: path2 }) => path2)).size === assets.length));
|
|
136
|
+
var parseStaticAssetManifest = (content) => decodeJson(StaticAssetManifestV1Schema, content);
|
|
137
|
+
|
|
68
138
|
// src/detection/detect-framework.ts
|
|
69
139
|
var import_platform8 = require("@effect/platform");
|
|
70
|
-
var
|
|
140
|
+
var import_effect13 = require("effect");
|
|
71
141
|
|
|
72
142
|
// src/detection/detect-package-manager.ts
|
|
73
143
|
var import_platform = require("@effect/platform");
|
|
74
|
-
var
|
|
144
|
+
var import_effect3 = require("effect");
|
|
75
145
|
var LOCKFILE_MAP = [
|
|
76
146
|
{ files: ["bun.lockb", "bun.lock"], pm: "bun" },
|
|
77
147
|
{ files: ["pnpm-lock.yaml"], pm: "pnpm" },
|
|
@@ -79,19 +149,19 @@ var LOCKFILE_MAP = [
|
|
|
79
149
|
{ files: ["package-lock.json"], pm: "npm" },
|
|
80
150
|
{ files: ["composer.lock"], pm: "composer" }
|
|
81
151
|
];
|
|
82
|
-
var detectPackageManager =
|
|
152
|
+
var detectPackageManager = import_effect3.Effect.fn("detectPackageManager")(function* (projectFolder) {
|
|
83
153
|
const fs = yield* import_platform.FileSystem.FileSystem;
|
|
84
154
|
const pathService = yield* import_platform.Path.Path;
|
|
85
155
|
for (const { files, pm } of LOCKFILE_MAP) {
|
|
86
156
|
for (const file of files) {
|
|
87
|
-
const exists = yield* fs.exists(pathService.join(projectFolder, file)).pipe(
|
|
157
|
+
const exists = yield* fs.exists(pathService.join(projectFolder, file)).pipe(import_effect3.Effect.catchAll(() => import_effect3.Effect.succeed(false)));
|
|
88
158
|
if (exists) {
|
|
89
|
-
yield*
|
|
159
|
+
yield* import_effect3.Effect.logDebug(`Detected package manager: ${pm} (via ${file})`);
|
|
90
160
|
return pm;
|
|
91
161
|
}
|
|
92
162
|
}
|
|
93
163
|
}
|
|
94
|
-
yield*
|
|
164
|
+
yield* import_effect3.Effect.logDebug("No lockfile found, defaulting to npm");
|
|
95
165
|
return "npm";
|
|
96
166
|
});
|
|
97
167
|
|
|
@@ -118,7 +188,7 @@ var astro = {
|
|
|
118
188
|
|
|
119
189
|
// src/detection/frameworks/resolve-node-entrypoint.ts
|
|
120
190
|
var import_platform2 = require("@effect/platform");
|
|
121
|
-
var
|
|
191
|
+
var import_effect4 = require("effect");
|
|
122
192
|
var SCRIPT_RUNNERS = /* @__PURE__ */ new Set(["node", "bun", "tsx", "ts-node"]);
|
|
123
193
|
var COMMON_ENTRYPOINT_CANDIDATES = [
|
|
124
194
|
"index.js",
|
|
@@ -166,14 +236,14 @@ var applyEntrypoint = (defaults, entrypoint) => ({
|
|
|
166
236
|
(route) => route.destination === defaults.entrypoint ? { ...route, destination: entrypoint } : route
|
|
167
237
|
)
|
|
168
238
|
});
|
|
169
|
-
var resolveNodeServerEntrypoint = (defaults, projectFolder) =>
|
|
239
|
+
var resolveNodeServerEntrypoint = (defaults, projectFolder) => import_effect4.Effect.gen(function* () {
|
|
170
240
|
const fs = yield* import_platform2.FileSystem.FileSystem;
|
|
171
241
|
const pathService = yield* import_platform2.Path.Path;
|
|
172
242
|
const isFile = (relativePath) => fs.stat(pathService.join(projectFolder, relativePath)).pipe(
|
|
173
|
-
|
|
174
|
-
|
|
243
|
+
import_effect4.Effect.map((info) => info.type === "File"),
|
|
244
|
+
import_effect4.Effect.catchAll(() => import_effect4.Effect.succeed(false))
|
|
175
245
|
);
|
|
176
|
-
const content = yield* fs.readFileString(pathService.join(projectFolder, "package.json")).pipe(
|
|
246
|
+
const content = yield* fs.readFileString(pathService.join(projectFolder, "package.json")).pipe(import_effect4.Effect.catchAll(() => import_effect4.Effect.succeed(void 0)));
|
|
177
247
|
const manifest = content ? parsePackageJson(content) : void 0;
|
|
178
248
|
const startScript = typeof manifest?.scripts?.start === "string" ? manifest.scripts.start : void 0;
|
|
179
249
|
const candidates = [
|
|
@@ -306,7 +376,7 @@ var laravel = {
|
|
|
306
376
|
|
|
307
377
|
// src/detection/frameworks/nestjs.ts
|
|
308
378
|
var import_platform3 = require("@effect/platform");
|
|
309
|
-
var
|
|
379
|
+
var import_effect5 = require("effect");
|
|
310
380
|
var isRecord2 = (value) => typeof value === "object" && value !== null;
|
|
311
381
|
var parseNestCliJson = (content) => {
|
|
312
382
|
try {
|
|
@@ -357,9 +427,9 @@ var nestjs = {
|
|
|
357
427
|
detectors: [{ matchPackage: "@nestjs/core" }],
|
|
358
428
|
priority: 90,
|
|
359
429
|
getDefaultConfig: () => createNestConfig("dist"),
|
|
360
|
-
refineDefaultConfig: (defaults, projectFolder) =>
|
|
430
|
+
refineDefaultConfig: (defaults, projectFolder) => import_effect5.Effect.gen(function* () {
|
|
361
431
|
const fs = yield* import_platform3.FileSystem.FileSystem;
|
|
362
|
-
const content = yield* fs.readFileString(`${projectFolder}/nest-cli.json`).pipe(
|
|
432
|
+
const content = yield* fs.readFileString(`${projectFolder}/nest-cli.json`).pipe(import_effect5.Effect.catchAll(() => import_effect5.Effect.succeed(void 0)));
|
|
363
433
|
if (!content) return defaults;
|
|
364
434
|
const nestConfig = parseNestCliJson(content);
|
|
365
435
|
const outputPath = nestConfig ? getProjectOutputPath(nestConfig) : void 0;
|
|
@@ -369,27 +439,27 @@ var nestjs = {
|
|
|
369
439
|
|
|
370
440
|
// src/detection/frameworks/nextjs.ts
|
|
371
441
|
var import_platform5 = require("@effect/platform");
|
|
372
|
-
var
|
|
442
|
+
var import_effect8 = require("effect");
|
|
373
443
|
|
|
374
444
|
// src/build-output-v3/get-default-path-map.ts
|
|
375
445
|
var import_platform4 = require("@effect/platform");
|
|
376
|
-
var
|
|
377
|
-
var getDefaultPathMap =
|
|
446
|
+
var import_effect6 = require("effect");
|
|
447
|
+
var getDefaultPathMap = import_effect6.Effect.fn("getDefaultPathMap")(function* (directory) {
|
|
378
448
|
const fs = yield* import_platform4.FileSystem.FileSystem;
|
|
379
449
|
const pathService = yield* import_platform4.Path.Path;
|
|
380
450
|
const result = {};
|
|
381
|
-
const exists = yield* fs.exists(directory).pipe(
|
|
451
|
+
const exists = yield* fs.exists(directory).pipe(import_effect6.Effect.catchAll(() => import_effect6.Effect.succeed(false)));
|
|
382
452
|
if (!exists) {
|
|
383
453
|
return result;
|
|
384
454
|
}
|
|
385
455
|
const MAX_DEPTH = 100;
|
|
386
|
-
const processDirectory = (currentPath, basePath = "", depth = 0) =>
|
|
456
|
+
const processDirectory = (currentPath, basePath = "", depth = 0) => import_effect6.Effect.gen(function* () {
|
|
387
457
|
if (depth > MAX_DEPTH) return;
|
|
388
|
-
const entries = yield* fs.readDirectory(currentPath).pipe(
|
|
458
|
+
const entries = yield* fs.readDirectory(currentPath).pipe(import_effect6.Effect.catchAll(() => import_effect6.Effect.succeed([])));
|
|
389
459
|
for (const name of entries) {
|
|
390
460
|
const fullPath = pathService.join(currentPath, name);
|
|
391
461
|
const relativePath = basePath ? pathService.join(basePath, name) : name;
|
|
392
|
-
const stat = yield* fs.stat(fullPath).pipe(
|
|
462
|
+
const stat = yield* fs.stat(fullPath).pipe(import_effect6.Effect.catchAll(() => import_effect6.Effect.succeed(null)));
|
|
393
463
|
if (!stat) continue;
|
|
394
464
|
if (stat.type === "Directory") {
|
|
395
465
|
yield* processDirectory(fullPath, relativePath, depth + 1);
|
|
@@ -402,54 +472,189 @@ var getDefaultPathMap = import_effect4.Effect.fn("getDefaultPathMap")(function*
|
|
|
402
472
|
return result;
|
|
403
473
|
});
|
|
404
474
|
|
|
475
|
+
// src/nextjs-constants.ts
|
|
476
|
+
var MAXIMUM_ENTRY_PAGE_PATHS = 50;
|
|
477
|
+
|
|
405
478
|
// src/nextjs-manifest.ts
|
|
406
|
-
var
|
|
407
|
-
var
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
var
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
479
|
+
var import_effect7 = require("effect");
|
|
480
|
+
var StringArraySchema = import_effect7.Schema.mutable(import_effect7.Schema.Array(import_effect7.Schema.String));
|
|
481
|
+
var StringRecordSchema = import_effect7.Schema.mutable(import_effect7.Schema.Record({ key: import_effect7.Schema.String, value: import_effect7.Schema.String }));
|
|
482
|
+
var JsonValueSchema = import_effect7.Schema.suspend(
|
|
483
|
+
() => import_effect7.Schema.Union(
|
|
484
|
+
import_effect7.Schema.Null,
|
|
485
|
+
import_effect7.Schema.Boolean,
|
|
486
|
+
import_effect7.Schema.Number,
|
|
487
|
+
import_effect7.Schema.String,
|
|
488
|
+
import_effect7.Schema.mutable(import_effect7.Schema.Array(JsonValueSchema)),
|
|
489
|
+
import_effect7.Schema.mutable(import_effect7.Schema.Record({ key: import_effect7.Schema.String, value: JsonValueSchema }))
|
|
490
|
+
)
|
|
491
|
+
);
|
|
492
|
+
var ImageLocalPatternSchema = import_effect7.Schema.mutable(
|
|
493
|
+
import_effect7.Schema.Struct({
|
|
494
|
+
pathname: import_effect7.Schema.optional(import_effect7.Schema.String),
|
|
495
|
+
search: import_effect7.Schema.optional(import_effect7.Schema.String)
|
|
496
|
+
})
|
|
497
|
+
);
|
|
498
|
+
var ImageRemotePatternSchema = import_effect7.Schema.mutable(
|
|
499
|
+
import_effect7.Schema.Struct({
|
|
500
|
+
protocol: import_effect7.Schema.optional(import_effect7.Schema.Literal("http", "https")),
|
|
501
|
+
hostname: import_effect7.Schema.String,
|
|
502
|
+
port: import_effect7.Schema.optional(import_effect7.Schema.String),
|
|
503
|
+
pathname: import_effect7.Schema.optional(import_effect7.Schema.String),
|
|
504
|
+
search: import_effect7.Schema.optional(import_effect7.Schema.String)
|
|
505
|
+
})
|
|
506
|
+
);
|
|
507
|
+
var ImageVariantSchema = import_effect7.Schema.mutable(
|
|
508
|
+
import_effect7.Schema.Struct({
|
|
509
|
+
width: import_effect7.Schema.optional(import_effect7.Schema.Number),
|
|
510
|
+
height: import_effect7.Schema.optional(import_effect7.Schema.Number),
|
|
511
|
+
quality: import_effect7.Schema.optional(import_effect7.Schema.Number),
|
|
512
|
+
format: import_effect7.Schema.optional(import_effect7.Schema.Literal("image/avif", "image/webp", "image/jpeg", "image/png")),
|
|
513
|
+
fit: import_effect7.Schema.optional(import_effect7.Schema.Literal("contain", "cover", "fill", "inside", "outside"))
|
|
514
|
+
})
|
|
515
|
+
);
|
|
516
|
+
var PositiveIntSchema = import_effect7.Schema.Int.pipe(import_effect7.Schema.greaterThan(0));
|
|
517
|
+
var ImagePolicySchema = import_effect7.Schema.mutable(
|
|
518
|
+
import_effect7.Schema.Struct({
|
|
519
|
+
localPatterns: import_effect7.Schema.mutable(import_effect7.Schema.Array(ImageLocalPatternSchema)),
|
|
520
|
+
remotePatterns: import_effect7.Schema.mutable(import_effect7.Schema.Array(ImageRemotePatternSchema)),
|
|
521
|
+
widths: import_effect7.Schema.mutable(import_effect7.Schema.Array(PositiveIntSchema)),
|
|
522
|
+
heights: import_effect7.Schema.mutable(import_effect7.Schema.Array(PositiveIntSchema)),
|
|
523
|
+
qualities: import_effect7.Schema.mutable(import_effect7.Schema.Array(import_effect7.Schema.Number.pipe(import_effect7.Schema.between(1, 100)))),
|
|
524
|
+
formats: import_effect7.Schema.mutable(import_effect7.Schema.Array(import_effect7.Schema.Literal("image/avif", "image/webp", "image/jpeg", "image/png"))),
|
|
525
|
+
minimumCacheTTL: import_effect7.Schema.Number,
|
|
526
|
+
dangerouslyAllowSVG: import_effect7.Schema.Boolean,
|
|
527
|
+
contentSecurityPolicy: import_effect7.Schema.String,
|
|
528
|
+
contentDispositionType: import_effect7.Schema.Literal("inline", "attachment"),
|
|
529
|
+
maximumRedirects: import_effect7.Schema.Number,
|
|
530
|
+
maximumResponseBody: import_effect7.Schema.Number,
|
|
531
|
+
variants: import_effect7.Schema.mutable(import_effect7.Schema.Record({ key: import_effect7.Schema.String, value: ImageVariantSchema }))
|
|
532
|
+
})
|
|
533
|
+
);
|
|
534
|
+
var GigadriveNextPrerenderOutputSchema = import_effect7.Schema.mutable(
|
|
535
|
+
import_effect7.Schema.Struct({
|
|
536
|
+
id: import_effect7.Schema.String,
|
|
537
|
+
type: import_effect7.Schema.Literal("PRERENDER"),
|
|
538
|
+
pathname: UrlPathnameSchema,
|
|
539
|
+
parentOutputId: import_effect7.Schema.String,
|
|
540
|
+
groupId: import_effect7.Schema.Number,
|
|
541
|
+
pprChain: import_effect7.Schema.optional(import_effect7.Schema.mutable(import_effect7.Schema.Struct({ headers: HttpSingleValueHeadersSchema }))),
|
|
542
|
+
parentFallbackMode: import_effect7.Schema.optional(JsonValueSchema),
|
|
543
|
+
fallback: import_effect7.Schema.optional(
|
|
544
|
+
import_effect7.Schema.mutable(
|
|
545
|
+
import_effect7.Schema.Struct({
|
|
546
|
+
filePath: import_effect7.Schema.optional(PortableRelativePathSchema),
|
|
547
|
+
initialStatus: import_effect7.Schema.optional(import_effect7.Schema.Int.pipe(import_effect7.Schema.between(100, 599))),
|
|
548
|
+
initialHeaders: import_effect7.Schema.optional(HttpHeadersSchema),
|
|
549
|
+
initialExpiration: import_effect7.Schema.optional(import_effect7.Schema.Number),
|
|
550
|
+
initialRevalidate: import_effect7.Schema.optional(import_effect7.Schema.Union(import_effect7.Schema.Number, import_effect7.Schema.Literal(false))),
|
|
551
|
+
postponedState: import_effect7.Schema.optional(import_effect7.Schema.String)
|
|
552
|
+
})
|
|
553
|
+
)
|
|
554
|
+
),
|
|
555
|
+
config: import_effect7.Schema.mutable(
|
|
556
|
+
import_effect7.Schema.Struct({
|
|
557
|
+
allowQuery: import_effect7.Schema.optional(StringArraySchema),
|
|
558
|
+
allowHeader: import_effect7.Schema.optional(StringArraySchema),
|
|
559
|
+
bypassFor: import_effect7.Schema.optional(import_effect7.Schema.mutable(import_effect7.Schema.Array(JsonValueSchema))),
|
|
560
|
+
renderingMode: import_effect7.Schema.optional(import_effect7.Schema.String),
|
|
561
|
+
partialFallback: import_effect7.Schema.optional(import_effect7.Schema.Boolean),
|
|
562
|
+
bypassToken: import_effect7.Schema.optional(import_effect7.Schema.String)
|
|
563
|
+
})
|
|
564
|
+
)
|
|
565
|
+
})
|
|
566
|
+
);
|
|
567
|
+
var GigadriveNextStaticAssetPrefixSchema = import_effect7.Schema.mutable(
|
|
568
|
+
import_effect7.Schema.Struct({
|
|
569
|
+
sourceDir: PortableRelativePathSchema,
|
|
570
|
+
urlPrefix: PortableRelativePathSchema,
|
|
571
|
+
immutable: import_effect7.Schema.Boolean
|
|
572
|
+
})
|
|
573
|
+
);
|
|
574
|
+
var GigadriveNextServerDescriptorSchema = import_effect7.Schema.mutable(
|
|
575
|
+
import_effect7.Schema.Struct({
|
|
576
|
+
maxDuration: import_effect7.Schema.optional(import_effect7.Schema.Number),
|
|
577
|
+
preferredRegion: import_effect7.Schema.optional(import_effect7.Schema.Union(import_effect7.Schema.String, StringArraySchema)),
|
|
578
|
+
env: import_effect7.Schema.optional(StringRecordSchema)
|
|
579
|
+
})
|
|
580
|
+
);
|
|
581
|
+
var PrerenderArraySchema = import_effect7.Schema.mutable(import_effect7.Schema.Array(GigadriveNextPrerenderOutputSchema));
|
|
582
|
+
var StaticAssetArraySchema = import_effect7.Schema.mutable(import_effect7.Schema.Array(GigadriveNextStaticAssetPrefixSchema));
|
|
583
|
+
var JsonValueArraySchema = import_effect7.Schema.mutable(import_effect7.Schema.Array(JsonValueSchema));
|
|
584
|
+
var GigadriveNextBuildManifestV1Schema = import_effect7.Schema.mutable(
|
|
585
|
+
import_effect7.Schema.Struct({
|
|
586
|
+
version: import_effect7.Schema.Literal(1),
|
|
587
|
+
output: import_effect7.Schema.Literal("standalone", "export"),
|
|
588
|
+
distDir: PortableRelativePathSchema,
|
|
589
|
+
repoRootToProject: RepositoryRelativePathSchema,
|
|
590
|
+
nextVersion: import_effect7.Schema.String,
|
|
591
|
+
buildId: import_effect7.Schema.String
|
|
592
|
+
})
|
|
593
|
+
);
|
|
594
|
+
var GigadriveNextBuildManifestV2ExportSchema = import_effect7.Schema.mutable(
|
|
595
|
+
import_effect7.Schema.Struct({
|
|
596
|
+
version: import_effect7.Schema.Literal(2),
|
|
597
|
+
mode: import_effect7.Schema.Literal("export"),
|
|
598
|
+
distDir: PortableRelativePathSchema,
|
|
599
|
+
repoRootToProject: RepositoryRelativePathSchema,
|
|
600
|
+
nextVersion: import_effect7.Schema.String,
|
|
601
|
+
buildId: import_effect7.Schema.String
|
|
602
|
+
})
|
|
603
|
+
);
|
|
604
|
+
var GigadriveNextBuildManifestV2StandaloneSchema = import_effect7.Schema.mutable(
|
|
605
|
+
import_effect7.Schema.Struct({
|
|
606
|
+
version: import_effect7.Schema.Literal(2),
|
|
607
|
+
mode: import_effect7.Schema.Literal("standalone-v2"),
|
|
608
|
+
distDir: PortableRelativePathSchema,
|
|
609
|
+
repoRootToProject: RepositoryRelativePathSchema,
|
|
610
|
+
nextVersion: import_effect7.Schema.String,
|
|
611
|
+
buildId: import_effect7.Schema.String,
|
|
612
|
+
server: GigadriveNextServerDescriptorSchema,
|
|
613
|
+
config: import_effect7.Schema.mutable(
|
|
614
|
+
import_effect7.Schema.Struct({
|
|
615
|
+
basePath: import_effect7.Schema.String,
|
|
616
|
+
trailingSlash: import_effect7.Schema.Boolean,
|
|
617
|
+
cacheComponents: import_effect7.Schema.Boolean,
|
|
618
|
+
i18n: import_effect7.Schema.optional(JsonValueSchema),
|
|
619
|
+
images: import_effect7.Schema.optional(ImagePolicySchema)
|
|
620
|
+
})
|
|
621
|
+
),
|
|
622
|
+
routing: import_effect7.Schema.mutable(
|
|
623
|
+
import_effect7.Schema.Struct({
|
|
624
|
+
beforeMiddleware: JsonValueArraySchema,
|
|
625
|
+
beforeFiles: JsonValueArraySchema,
|
|
626
|
+
afterFiles: JsonValueArraySchema,
|
|
627
|
+
dynamicRoutes: JsonValueArraySchema,
|
|
628
|
+
onMatch: JsonValueArraySchema,
|
|
629
|
+
fallback: JsonValueArraySchema,
|
|
630
|
+
shouldNormalizeNextData: import_effect7.Schema.Boolean,
|
|
631
|
+
rsc: JsonValueSchema
|
|
632
|
+
})
|
|
633
|
+
),
|
|
634
|
+
outputs: import_effect7.Schema.mutable(
|
|
635
|
+
import_effect7.Schema.Struct({
|
|
636
|
+
prerenders: PrerenderArraySchema,
|
|
637
|
+
prerenderManifest: import_effect7.Schema.optional(PortableRelativePathSchema),
|
|
638
|
+
assetManifest: import_effect7.Schema.optional(PortableRelativePathSchema),
|
|
639
|
+
entryPagePaths: import_effect7.Schema.optional(import_effect7.Schema.mutable(import_effect7.Schema.Array(UrlPathnameSchema))),
|
|
640
|
+
staticAssets: StaticAssetArraySchema
|
|
641
|
+
})
|
|
642
|
+
)
|
|
643
|
+
})
|
|
644
|
+
);
|
|
645
|
+
var GigadriveNextBuildManifestSchema = import_effect7.Schema.Union(
|
|
646
|
+
GigadriveNextBuildManifestV1Schema,
|
|
647
|
+
GigadriveNextBuildManifestV2ExportSchema,
|
|
648
|
+
GigadriveNextBuildManifestV2StandaloneSchema
|
|
649
|
+
);
|
|
650
|
+
var GigadriveNextPrerenderManifestV1Schema = import_effect7.Schema.mutable(
|
|
651
|
+
import_effect7.Schema.Struct({
|
|
652
|
+
version: import_effect7.Schema.Literal(1),
|
|
653
|
+
prerenders: PrerenderArraySchema
|
|
654
|
+
})
|
|
655
|
+
);
|
|
656
|
+
var parseGigadriveNextBuildManifest = (content) => decodeJson(GigadriveNextBuildManifestSchema, content);
|
|
657
|
+
var parseGigadriveNextPrerenderManifest = (content) => decodeJson(GigadriveNextPrerenderManifestV1Schema, content);
|
|
453
658
|
|
|
454
659
|
// src/regions.ts
|
|
455
660
|
var REGION_DEFINITIONS = [
|
|
@@ -475,23 +680,22 @@ var AVAILABLE_REGIONS = [...REGION_DEFINITIONS];
|
|
|
475
680
|
|
|
476
681
|
// src/detection/frameworks/nextjs.ts
|
|
477
682
|
var toPortablePath = (value) => value.replaceAll("\\", "/");
|
|
478
|
-
var MAXIMUM_ENTRY_PAGE_PATHS = 50;
|
|
479
683
|
var STANDALONE_SERVER_MEMORY_MB = 1024;
|
|
480
|
-
var resolveStandaloneServer =
|
|
684
|
+
var resolveStandaloneServer = import_effect8.Effect.fn("nextjs.resolveStandaloneServer")(function* (projectFolder, distDir, repoRootToProject) {
|
|
481
685
|
const fs = yield* import_platform5.FileSystem.FileSystem;
|
|
482
686
|
const pathService = yield* import_platform5.Path.Path;
|
|
483
687
|
const standaloneRoot = pathService.join(projectFolder, distDir, "standalone");
|
|
484
688
|
const monorepoServer = pathService.join(standaloneRoot, repoRootToProject, "server.js");
|
|
485
689
|
const rootServer = pathService.join(standaloneRoot, "server.js");
|
|
486
|
-
const monorepoServerExists = yield* fs.exists(monorepoServer).pipe(
|
|
690
|
+
const monorepoServerExists = yield* fs.exists(monorepoServer).pipe(import_effect8.Effect.catchAll(() => import_effect8.Effect.succeed(false)));
|
|
487
691
|
const serverPath = monorepoServerExists ? monorepoServer : rootServer;
|
|
488
|
-
const serverExists = yield* fs.exists(serverPath).pipe(
|
|
692
|
+
const serverExists = yield* fs.exists(serverPath).pipe(import_effect8.Effect.catchAll(() => import_effect8.Effect.succeed(false)));
|
|
489
693
|
if (!serverExists) return void 0;
|
|
490
694
|
const serverDirectory = pathService.dirname(serverPath);
|
|
491
695
|
const entrypoint = toPortablePath(pathService.relative(standaloneRoot, serverPath));
|
|
492
696
|
return { standaloneRoot, serverDirectory, entrypoint };
|
|
493
697
|
});
|
|
494
|
-
var buildStandalonePublicAssets =
|
|
698
|
+
var buildStandalonePublicAssets = import_effect8.Effect.fn("nextjs.buildStandalonePublicAssets")(function* (projectFolder, standaloneRoot, serverDirectory) {
|
|
495
699
|
const pathService = yield* import_platform5.Path.Path;
|
|
496
700
|
const publicFiles = yield* getDefaultPathMap(pathService.join(projectFolder, "public"));
|
|
497
701
|
const assetPaths = [];
|
|
@@ -508,7 +712,7 @@ var buildStandalonePublicAssets = import_effect5.Effect.fn("nextjs.buildStandalo
|
|
|
508
712
|
}
|
|
509
713
|
return { assetPaths, assetOverrides, filePathMap };
|
|
510
714
|
});
|
|
511
|
-
var createStaticExportConfig =
|
|
715
|
+
var createStaticExportConfig = import_effect8.Effect.fn("nextjs.createStaticExportConfig")(function* (defaults, projectFolder) {
|
|
512
716
|
const pathService = yield* import_platform5.Path.Path;
|
|
513
717
|
const outputDirectory = pathService.join(projectFolder, "out");
|
|
514
718
|
const files = yield* getDefaultPathMap(outputDirectory);
|
|
@@ -532,7 +736,7 @@ var createStaticExportConfig = import_effect5.Effect.fn("nextjs.createStaticExpo
|
|
|
532
736
|
package: void 0
|
|
533
737
|
};
|
|
534
738
|
});
|
|
535
|
-
var createStandaloneConfig =
|
|
739
|
+
var createStandaloneConfig = import_effect8.Effect.fn("nextjs.createStandaloneConfig")(function* (defaults, projectFolder, manifest) {
|
|
536
740
|
const pathService = yield* import_platform5.Path.Path;
|
|
537
741
|
const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);
|
|
538
742
|
if (!resolved) return defaults;
|
|
@@ -566,7 +770,7 @@ var createStandaloneConfig = import_effect5.Effect.fn("nextjs.createStandaloneCo
|
|
|
566
770
|
}
|
|
567
771
|
};
|
|
568
772
|
});
|
|
569
|
-
var createStandaloneV2Config =
|
|
773
|
+
var createStandaloneV2Config = import_effect8.Effect.fn("nextjs.createStandaloneV2Config")(function* (defaults, projectFolder, manifest) {
|
|
570
774
|
const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);
|
|
571
775
|
if (!resolved) return defaults;
|
|
572
776
|
const { standaloneRoot, serverDirectory, entrypoint } = resolved;
|
|
@@ -580,9 +784,11 @@ var createStandaloneV2Config = import_effect5.Effect.fn("nextjs.createStandalone
|
|
|
580
784
|
immutable: staticAsset.immutable,
|
|
581
785
|
populateCache: true
|
|
582
786
|
}));
|
|
583
|
-
const
|
|
787
|
+
const assetManifests = manifest.outputs.assetManifest ? [{ source: manifest.outputs.assetManifest }] : void 0;
|
|
788
|
+
const { entryPagePaths: manifestEntryPagePaths, ...manifestOutputs } = manifest.outputs;
|
|
789
|
+
const entryPagePaths = manifestEntryPagePaths?.slice(0, MAXIMUM_ENTRY_PAGE_PATHS) ?? [
|
|
584
790
|
...new Set(
|
|
585
|
-
manifest.outputs.prerenders.filter((output) =>
|
|
791
|
+
manifest.outputs.prerenders.filter((output) => output.fallback?.postponedState === void 0).map((output) => output.pathname).filter((pathname) => pathname.startsWith("/") && !pathname.includes("["))
|
|
586
792
|
)
|
|
587
793
|
].sort((left, right) => left.split("/").length - right.split("/").length || left.localeCompare(right)).slice(0, MAXIMUM_ENTRY_PAGE_PATHS);
|
|
588
794
|
const singleEntrypoint = {
|
|
@@ -611,10 +817,9 @@ var createStandaloneV2Config = import_effect5.Effect.fn("nextjs.createStandalone
|
|
|
611
817
|
server: manifest.server,
|
|
612
818
|
config: manifest.config,
|
|
613
819
|
routing: manifest.routing,
|
|
614
|
-
//
|
|
615
|
-
//
|
|
616
|
-
|
|
617
|
-
outputs: { prerenders: [], staticAssets: manifest.outputs.staticAssets },
|
|
820
|
+
// Keep high-cardinality output metadata in portable sidecars rather than
|
|
821
|
+
// expanding it into normalized deployment configuration.
|
|
822
|
+
outputs: { ...manifestOutputs, prerenders: [] },
|
|
618
823
|
entryPagePaths,
|
|
619
824
|
type: "nextjs",
|
|
620
825
|
schemaVersion: 2
|
|
@@ -626,6 +831,7 @@ var createStandaloneV2Config = import_effect5.Effect.fn("nextjs.createStandalone
|
|
|
626
831
|
assetPaths,
|
|
627
832
|
assetOverrides,
|
|
628
833
|
assetPrefixes,
|
|
834
|
+
assetManifests,
|
|
629
835
|
assetsDir: manifest.distDir,
|
|
630
836
|
assetsPrefixToStrip: "",
|
|
631
837
|
populateAssetCache: true,
|
|
@@ -667,9 +873,9 @@ var nextjs = {
|
|
|
667
873
|
routes: [{ source: "/*", destination: ".next/standalone/server.js" }],
|
|
668
874
|
environmentVariables: { NODE_ENV: "production" }
|
|
669
875
|
}),
|
|
670
|
-
refineDefaultConfig: (defaults, projectFolder) =>
|
|
876
|
+
refineDefaultConfig: (defaults, projectFolder) => import_effect8.Effect.gen(function* () {
|
|
671
877
|
const fs = yield* import_platform5.FileSystem.FileSystem;
|
|
672
|
-
const manifestContent = yield* fs.readFileString(`${projectFolder}/.gigadrive/nextjs.json`).pipe(
|
|
878
|
+
const manifestContent = yield* fs.readFileString(`${projectFolder}/.gigadrive/nextjs.json`).pipe(import_effect8.Effect.catchAll(() => import_effect8.Effect.succeed(void 0)));
|
|
673
879
|
const manifest = manifestContent ? parseGigadriveNextBuildManifest(manifestContent) : void 0;
|
|
674
880
|
if (!manifest) return defaults;
|
|
675
881
|
if (manifest.version === 2) {
|
|
@@ -681,7 +887,7 @@ var nextjs = {
|
|
|
681
887
|
|
|
682
888
|
// src/detection/frameworks/nuxt.ts
|
|
683
889
|
var import_platform6 = require("@effect/platform");
|
|
684
|
-
var
|
|
890
|
+
var import_effect9 = require("effect");
|
|
685
891
|
var isVercelBuildOutputV3 = (content) => {
|
|
686
892
|
try {
|
|
687
893
|
const config = JSON.parse(content);
|
|
@@ -708,9 +914,9 @@ var nuxt = {
|
|
|
708
914
|
routes: [{ source: "/*", destination: ".output/server/index.mjs" }],
|
|
709
915
|
environmentVariables: { NODE_ENV: "production", NITRO_PRESET: "node-server" }
|
|
710
916
|
}),
|
|
711
|
-
refineDefaultConfig: (defaults, projectFolder) =>
|
|
917
|
+
refineDefaultConfig: (defaults, projectFolder) => import_effect9.Effect.gen(function* () {
|
|
712
918
|
const fs = yield* import_platform6.FileSystem.FileSystem;
|
|
713
|
-
const buildOutputConfig = yield* fs.readFileString(`${projectFolder}/.vercel/output/config.json`).pipe(
|
|
919
|
+
const buildOutputConfig = yield* fs.readFileString(`${projectFolder}/.vercel/output/config.json`).pipe(import_effect9.Effect.catchAll(() => import_effect9.Effect.succeed(void 0)));
|
|
714
920
|
if (!buildOutputConfig || !isVercelBuildOutputV3(buildOutputConfig)) {
|
|
715
921
|
return defaults;
|
|
716
922
|
}
|
|
@@ -833,7 +1039,7 @@ var FRAMEWORK_DEFINITIONS = [
|
|
|
833
1039
|
].sort((a, b) => b.priority - a.priority);
|
|
834
1040
|
|
|
835
1041
|
// src/detection/generate-config.ts
|
|
836
|
-
var
|
|
1042
|
+
var import_effect10 = require("effect");
|
|
837
1043
|
var getInstallCommand = (pm) => {
|
|
838
1044
|
switch (pm) {
|
|
839
1045
|
case "bun":
|
|
@@ -849,11 +1055,11 @@ var getInstallCommand = (pm) => {
|
|
|
849
1055
|
return "npm install";
|
|
850
1056
|
}
|
|
851
1057
|
};
|
|
852
|
-
var generateConfig =
|
|
1058
|
+
var generateConfig = import_effect10.Effect.fn("generateConfig")(function* (framework, packageManager, refinedDefaults) {
|
|
853
1059
|
const defaults = refinedDefaults ?? framework.getDefaultConfig(packageManager);
|
|
854
1060
|
const installCmd = defaults.installCommand ?? getInstallCommand(packageManager);
|
|
855
1061
|
const commands = [installCmd, ...defaults.commands];
|
|
856
|
-
yield*
|
|
1062
|
+
yield* import_effect10.Effect.logDebug(`Generating config for ${framework.name}`, {
|
|
857
1063
|
runtime: defaults.runtime,
|
|
858
1064
|
entrypoint: defaults.entrypoint,
|
|
859
1065
|
commands
|
|
@@ -887,12 +1093,13 @@ var generateConfig = import_effect7.Effect.fn("generateConfig")(function* (frame
|
|
|
887
1093
|
errors: [],
|
|
888
1094
|
...defaults.normalizedConfig
|
|
889
1095
|
};
|
|
890
|
-
if (defaults.assetsDir || defaults.assetPaths || defaults.assetPrefixes) {
|
|
1096
|
+
if (defaults.assetsDir || defaults.assetPaths || defaults.assetPrefixes || defaults.assetManifests) {
|
|
891
1097
|
config.assets = {
|
|
892
1098
|
paths: defaults.assetPaths ? [...defaults.assetPaths] : [],
|
|
893
1099
|
prefixToStrip: defaults.assetsPrefixToStrip ?? (defaults.assetsDir ? defaults.assetsDir + "/" : ""),
|
|
894
1100
|
overrides: defaults.assetOverrides ? { ...defaults.assetOverrides } : void 0,
|
|
895
1101
|
prefixes: defaults.assetPrefixes ? defaults.assetPrefixes.map((prefix) => ({ ...prefix })) : void 0,
|
|
1102
|
+
manifests: defaults.assetManifests ? defaults.assetManifests.map((manifest) => ({ ...manifest })) : void 0,
|
|
896
1103
|
dynamicRoutes: true,
|
|
897
1104
|
populateCache: defaults.populateAssetCache ?? false
|
|
898
1105
|
};
|
|
@@ -902,30 +1109,30 @@ var generateConfig = import_effect7.Effect.fn("generateConfig")(function* (frame
|
|
|
902
1109
|
|
|
903
1110
|
// src/detection/read-dependencies.ts
|
|
904
1111
|
var import_platform7 = require("@effect/platform");
|
|
905
|
-
var
|
|
1112
|
+
var import_effect12 = require("effect");
|
|
906
1113
|
|
|
907
1114
|
// src/detection/types.ts
|
|
908
|
-
var
|
|
909
|
-
var ManifestNotFoundError = class extends
|
|
910
|
-
message:
|
|
911
|
-
filePath:
|
|
1115
|
+
var import_effect11 = require("effect");
|
|
1116
|
+
var ManifestNotFoundError = class extends import_effect11.Schema.TaggedError()("ManifestNotFoundError", {
|
|
1117
|
+
message: import_effect11.Schema.String,
|
|
1118
|
+
filePath: import_effect11.Schema.String
|
|
912
1119
|
}) {
|
|
913
1120
|
};
|
|
914
|
-
var ManifestReadError = class extends
|
|
915
|
-
message:
|
|
916
|
-
filePath:
|
|
1121
|
+
var ManifestReadError = class extends import_effect11.Schema.TaggedError()("ManifestReadError", {
|
|
1122
|
+
message: import_effect11.Schema.String,
|
|
1123
|
+
filePath: import_effect11.Schema.String
|
|
917
1124
|
}) {
|
|
918
1125
|
};
|
|
919
|
-
var ManifestParseError = class extends
|
|
920
|
-
message:
|
|
921
|
-
filePath:
|
|
1126
|
+
var ManifestParseError = class extends import_effect11.Schema.TaggedError()("ManifestParseError", {
|
|
1127
|
+
message: import_effect11.Schema.String,
|
|
1128
|
+
filePath: import_effect11.Schema.String
|
|
922
1129
|
}) {
|
|
923
1130
|
};
|
|
924
|
-
var FrameworkNotDetectedError = class extends
|
|
1131
|
+
var FrameworkNotDetectedError = class extends import_effect11.Schema.TaggedError()(
|
|
925
1132
|
"FrameworkNotDetectedError",
|
|
926
1133
|
{
|
|
927
|
-
message:
|
|
928
|
-
directory:
|
|
1134
|
+
message: import_effect11.Schema.String,
|
|
1135
|
+
directory: import_effect11.Schema.String
|
|
929
1136
|
}
|
|
930
1137
|
) {
|
|
931
1138
|
};
|
|
@@ -935,25 +1142,25 @@ var MANIFEST_CONFIG = {
|
|
|
935
1142
|
node: { file: "package.json", depKeys: ["dependencies", "devDependencies"] },
|
|
936
1143
|
php: { file: "composer.json", depKeys: ["require", "require-dev"] }
|
|
937
1144
|
};
|
|
938
|
-
var readManifest =
|
|
1145
|
+
var readManifest = import_effect12.Effect.fn("readManifest")(function* (filePath) {
|
|
939
1146
|
const fs = yield* import_platform7.FileSystem.FileSystem;
|
|
940
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
1147
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect12.Effect.catchAll(() => import_effect12.Effect.succeed(false)));
|
|
941
1148
|
if (!exists) {
|
|
942
|
-
return yield*
|
|
1149
|
+
return yield* import_effect12.Effect.fail(new ManifestNotFoundError({ message: "Manifest not found", filePath }));
|
|
943
1150
|
}
|
|
944
|
-
const content = yield* fs.readFileString(filePath).pipe(
|
|
945
|
-
const parsed = yield*
|
|
1151
|
+
const content = yield* fs.readFileString(filePath).pipe(import_effect12.Effect.mapError(() => new ManifestReadError({ message: "Failed to read manifest", filePath })));
|
|
1152
|
+
const parsed = yield* import_effect12.Effect.try({
|
|
946
1153
|
try: () => JSON.parse(content),
|
|
947
1154
|
catch: () => new ManifestParseError({ message: "Failed to parse manifest JSON", filePath })
|
|
948
1155
|
});
|
|
949
1156
|
return parsed;
|
|
950
1157
|
});
|
|
951
|
-
var readDependencies =
|
|
1158
|
+
var readDependencies = import_effect12.Effect.fn("readDependencies")(function* (projectFolder, language) {
|
|
952
1159
|
const pathService = yield* import_platform7.Path.Path;
|
|
953
1160
|
const config = MANIFEST_CONFIG[language];
|
|
954
1161
|
const filePath = pathService.join(projectFolder, config.file);
|
|
955
1162
|
const manifest = yield* readManifest(filePath).pipe(
|
|
956
|
-
|
|
1163
|
+
import_effect12.Effect.catchTag("ManifestNotFoundError", () => import_effect12.Effect.succeed(null))
|
|
957
1164
|
);
|
|
958
1165
|
if (!manifest) {
|
|
959
1166
|
return /* @__PURE__ */ new Set();
|
|
@@ -971,7 +1178,7 @@ var readDependencies = import_effect9.Effect.fn("readDependencies")(function* (p
|
|
|
971
1178
|
});
|
|
972
1179
|
|
|
973
1180
|
// src/detection/detect-framework.ts
|
|
974
|
-
var matchesDetectionItem =
|
|
1181
|
+
var matchesDetectionItem = import_effect13.Effect.fn("matchesDetectionItem")(function* (item, projectFolder, framework, cachedReadDeps) {
|
|
975
1182
|
const fs = yield* import_platform8.FileSystem.FileSystem;
|
|
976
1183
|
const pathService = yield* import_platform8.Path.Path;
|
|
977
1184
|
if (item.matchPackage != null) {
|
|
@@ -982,12 +1189,12 @@ var matchesDetectionItem = import_effect10.Effect.fn("matchesDetectionItem")(fun
|
|
|
982
1189
|
}
|
|
983
1190
|
if (item.path != null) {
|
|
984
1191
|
const filePath = pathService.join(projectFolder, item.path);
|
|
985
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
1192
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect13.Effect.catchAll(() => import_effect13.Effect.succeed(false)));
|
|
986
1193
|
if (!exists) {
|
|
987
1194
|
return false;
|
|
988
1195
|
}
|
|
989
1196
|
if (item.matchContent != null) {
|
|
990
|
-
const content = yield* fs.readFileString(filePath).pipe(
|
|
1197
|
+
const content = yield* fs.readFileString(filePath).pipe(import_effect13.Effect.catchAll(() => import_effect13.Effect.succeed("")));
|
|
991
1198
|
let regexMatch = false;
|
|
992
1199
|
try {
|
|
993
1200
|
regexMatch = new RegExp(item.matchContent).test(content);
|
|
@@ -1000,7 +1207,7 @@ var matchesDetectionItem = import_effect10.Effect.fn("matchesDetectionItem")(fun
|
|
|
1000
1207
|
}
|
|
1001
1208
|
return true;
|
|
1002
1209
|
});
|
|
1003
|
-
var matchesFramework =
|
|
1210
|
+
var matchesFramework = import_effect13.Effect.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
|
|
1004
1211
|
for (const detector of framework.detectors) {
|
|
1005
1212
|
const matches = yield* matchesDetectionItem(detector, projectFolder, framework, cachedReadDeps);
|
|
1006
1213
|
if (!matches) {
|
|
@@ -1009,9 +1216,9 @@ var matchesFramework = import_effect10.Effect.fn("matchesFramework")(function* (
|
|
|
1009
1216
|
}
|
|
1010
1217
|
return true;
|
|
1011
1218
|
});
|
|
1012
|
-
var detectFramework =
|
|
1013
|
-
yield*
|
|
1014
|
-
const cachedReadDeps = yield*
|
|
1219
|
+
var detectFramework = import_effect13.Effect.fn("detectFramework")(function* (projectFolder) {
|
|
1220
|
+
yield* import_effect13.Effect.logDebug(`Detecting framework in ${projectFolder}`);
|
|
1221
|
+
const cachedReadDeps = yield* import_effect13.Effect.cachedFunction((key) => {
|
|
1015
1222
|
const sepIndex = key.lastIndexOf("\0");
|
|
1016
1223
|
const folder = key.slice(0, sepIndex);
|
|
1017
1224
|
const language = key.slice(sepIndex + 1);
|
|
@@ -1020,7 +1227,7 @@ var detectFramework = import_effect10.Effect.fn("detectFramework")(function* (pr
|
|
|
1020
1227
|
for (const framework of FRAMEWORK_DEFINITIONS) {
|
|
1021
1228
|
const matches = yield* matchesFramework(framework, projectFolder, cachedReadDeps);
|
|
1022
1229
|
if (matches) {
|
|
1023
|
-
yield*
|
|
1230
|
+
yield* import_effect13.Effect.log(`Detected framework: ${framework.name}`, { slug: framework.slug });
|
|
1024
1231
|
const detectedPackageManager = yield* detectPackageManager(projectFolder);
|
|
1025
1232
|
const packageManager = framework.language === "php" ? "composer" : detectedPackageManager;
|
|
1026
1233
|
const defaults = framework.getDefaultConfig(packageManager);
|
|
@@ -1029,7 +1236,7 @@ var detectFramework = import_effect10.Effect.fn("detectFramework")(function* (pr
|
|
|
1029
1236
|
return { framework, packageManager, config };
|
|
1030
1237
|
}
|
|
1031
1238
|
}
|
|
1032
|
-
return yield*
|
|
1239
|
+
return yield* import_effect13.Effect.fail(
|
|
1033
1240
|
new FrameworkNotDetectedError({
|
|
1034
1241
|
message: `No framework detected in project directory`,
|
|
1035
1242
|
directory: projectFolder
|
|
@@ -1038,15 +1245,16 @@ var detectFramework = import_effect10.Effect.fn("detectFramework")(function* (pr
|
|
|
1038
1245
|
});
|
|
1039
1246
|
|
|
1040
1247
|
// src/detection/merge-config.ts
|
|
1041
|
-
var
|
|
1042
|
-
var mergeWithFrameworkDefaults =
|
|
1043
|
-
yield*
|
|
1248
|
+
var import_effect14 = require("effect");
|
|
1249
|
+
var mergeWithFrameworkDefaults = import_effect14.Effect.fn("mergeWithFrameworkDefaults")(function* (userConfig, frameworkConfig) {
|
|
1250
|
+
yield* import_effect14.Effect.logDebug("Merging user config with framework defaults");
|
|
1251
|
+
const userHasAssets = (userConfig.assets?.paths?.length ?? 0) > 0 || (userConfig.assets?.prefixes?.length ?? 0) > 0 || (userConfig.assets?.manifests?.length ?? 0) > 0;
|
|
1044
1252
|
const merged = {
|
|
1045
1253
|
regions: userConfig.regions,
|
|
1046
1254
|
commands: userConfig.commands.length > 0 ? userConfig.commands : frameworkConfig.commands,
|
|
1047
1255
|
entrypoints: userConfig.entrypoints.length > 0 ? userConfig.entrypoints : frameworkConfig.entrypoints,
|
|
1048
1256
|
routes: userConfig.routes.length > 0 ? userConfig.routes : frameworkConfig.routes,
|
|
1049
|
-
assets:
|
|
1257
|
+
assets: userHasAssets ? userConfig.assets : frameworkConfig.assets,
|
|
1050
1258
|
environmentVariables: {
|
|
1051
1259
|
...frameworkConfig.environmentVariables,
|
|
1052
1260
|
...userConfig.environmentVariables
|
|
@@ -1061,41 +1269,41 @@ var mergeWithFrameworkDefaults = import_effect11.Effect.fn("mergeWithFrameworkDe
|
|
|
1061
1269
|
});
|
|
1062
1270
|
|
|
1063
1271
|
// src/errors.ts
|
|
1064
|
-
var
|
|
1065
|
-
var ConfigFileNotFoundError = class extends
|
|
1066
|
-
message:
|
|
1067
|
-
filePath:
|
|
1272
|
+
var import_effect15 = require("effect");
|
|
1273
|
+
var ConfigFileNotFoundError = class extends import_effect15.Schema.TaggedError()("ConfigFileNotFoundError", {
|
|
1274
|
+
message: import_effect15.Schema.String,
|
|
1275
|
+
filePath: import_effect15.Schema.String
|
|
1068
1276
|
}) {
|
|
1069
1277
|
};
|
|
1070
|
-
var ConfigFileEmptyError = class extends
|
|
1071
|
-
message:
|
|
1072
|
-
filePath:
|
|
1278
|
+
var ConfigFileEmptyError = class extends import_effect15.Schema.TaggedError()("ConfigFileEmptyError", {
|
|
1279
|
+
message: import_effect15.Schema.String,
|
|
1280
|
+
filePath: import_effect15.Schema.String
|
|
1073
1281
|
}) {
|
|
1074
1282
|
};
|
|
1075
|
-
var ConfigFileParseError = class extends
|
|
1076
|
-
message:
|
|
1077
|
-
filePath:
|
|
1078
|
-
cause:
|
|
1283
|
+
var ConfigFileParseError = class extends import_effect15.Schema.TaggedError()("ConfigFileParseError", {
|
|
1284
|
+
message: import_effect15.Schema.String,
|
|
1285
|
+
filePath: import_effect15.Schema.String,
|
|
1286
|
+
cause: import_effect15.Schema.optional(import_effect15.Schema.String)
|
|
1079
1287
|
}) {
|
|
1080
1288
|
};
|
|
1081
|
-
var ConfigVersionError = class extends
|
|
1082
|
-
message:
|
|
1083
|
-
filePath:
|
|
1084
|
-
version:
|
|
1289
|
+
var ConfigVersionError = class extends import_effect15.Schema.TaggedError()("ConfigVersionError", {
|
|
1290
|
+
message: import_effect15.Schema.String,
|
|
1291
|
+
filePath: import_effect15.Schema.String,
|
|
1292
|
+
version: import_effect15.Schema.optional(import_effect15.Schema.Number)
|
|
1085
1293
|
}) {
|
|
1086
1294
|
};
|
|
1087
|
-
var ConfigSchemaValidationError = class extends
|
|
1295
|
+
var ConfigSchemaValidationError = class extends import_effect15.Schema.TaggedError()(
|
|
1088
1296
|
"ConfigSchemaValidationError",
|
|
1089
1297
|
{
|
|
1090
|
-
message:
|
|
1091
|
-
filePath:
|
|
1092
|
-
validationErrors:
|
|
1298
|
+
message: import_effect15.Schema.String,
|
|
1299
|
+
filePath: import_effect15.Schema.String,
|
|
1300
|
+
validationErrors: import_effect15.Schema.Array(import_effect15.Schema.String)
|
|
1093
1301
|
}
|
|
1094
1302
|
) {
|
|
1095
1303
|
};
|
|
1096
|
-
var FunctionConfigError = class extends
|
|
1097
|
-
message:
|
|
1098
|
-
functionPath:
|
|
1304
|
+
var FunctionConfigError = class extends import_effect15.Schema.TaggedError()("FunctionConfigError", {
|
|
1305
|
+
message: import_effect15.Schema.String,
|
|
1306
|
+
functionPath: import_effect15.Schema.String
|
|
1099
1307
|
}) {
|
|
1100
1308
|
};
|
|
1101
1309
|
|
|
@@ -1115,11 +1323,11 @@ var DEFAULT_FUNCTION_DURATION_SECONDS = 30;
|
|
|
1115
1323
|
var MAX_FUNCTION_DURATION_SECONDS = 28800;
|
|
1116
1324
|
|
|
1117
1325
|
// src/parse-config.ts
|
|
1118
|
-
var
|
|
1326
|
+
var import_effect20 = require("effect");
|
|
1119
1327
|
|
|
1120
1328
|
// src/services/raw-config-reader.ts
|
|
1121
1329
|
var import_platform9 = require("@effect/platform");
|
|
1122
|
-
var
|
|
1330
|
+
var import_effect16 = require("effect");
|
|
1123
1331
|
var import_yaml = require("yaml");
|
|
1124
1332
|
var ALLOWED_CONFIG_NAMES = [
|
|
1125
1333
|
"gigadrive.yaml",
|
|
@@ -1128,34 +1336,34 @@ var ALLOWED_CONFIG_NAMES = [
|
|
|
1128
1336
|
"nebula.yml",
|
|
1129
1337
|
"nebula.json"
|
|
1130
1338
|
];
|
|
1131
|
-
var RawConfigReader = class extends
|
|
1132
|
-
effect:
|
|
1339
|
+
var RawConfigReader = class extends import_effect16.Effect.Service()("RawConfigReader", {
|
|
1340
|
+
effect: import_effect16.Effect.gen(function* () {
|
|
1133
1341
|
const fs = yield* import_platform9.FileSystem.FileSystem;
|
|
1134
1342
|
const pathService = yield* import_platform9.Path.Path;
|
|
1135
|
-
const findConfig =
|
|
1343
|
+
const findConfig = import_effect16.Effect.fn("RawConfigReader.findConfig")(function* (projectFolder) {
|
|
1136
1344
|
for (const name of ALLOWED_CONFIG_NAMES) {
|
|
1137
1345
|
const filePath = pathService.join(projectFolder, name);
|
|
1138
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
1346
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect16.Effect.catchAll(() => import_effect16.Effect.succeed(false)));
|
|
1139
1347
|
if (exists) {
|
|
1140
1348
|
return filePath;
|
|
1141
1349
|
}
|
|
1142
1350
|
}
|
|
1143
1351
|
return null;
|
|
1144
1352
|
});
|
|
1145
|
-
const readRawConfig =
|
|
1146
|
-
const exists = yield* fs.exists(filePath).pipe(
|
|
1353
|
+
const readRawConfig = import_effect16.Effect.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
|
|
1354
|
+
const exists = yield* fs.exists(filePath).pipe(import_effect16.Effect.catchAll(() => import_effect16.Effect.succeed(false)));
|
|
1147
1355
|
if (!exists) {
|
|
1148
|
-
return yield*
|
|
1356
|
+
return yield* import_effect16.Effect.fail(
|
|
1149
1357
|
new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })
|
|
1150
1358
|
);
|
|
1151
1359
|
}
|
|
1152
1360
|
const fileContents = yield* fs.readFileString(filePath).pipe(
|
|
1153
|
-
|
|
1361
|
+
import_effect16.Effect.mapError(
|
|
1154
1362
|
() => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })
|
|
1155
1363
|
)
|
|
1156
1364
|
);
|
|
1157
1365
|
if (fileContents.length === 0) {
|
|
1158
|
-
return yield*
|
|
1366
|
+
return yield* import_effect16.Effect.fail(
|
|
1159
1367
|
new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })
|
|
1160
1368
|
);
|
|
1161
1369
|
}
|
|
@@ -1170,7 +1378,7 @@ var RawConfigReader = class extends import_effect13.Effect.Service()("RawConfigR
|
|
|
1170
1378
|
parsed = (0, import_yaml.parse)(fileContents);
|
|
1171
1379
|
}
|
|
1172
1380
|
} catch (error) {
|
|
1173
|
-
return yield*
|
|
1381
|
+
return yield* import_effect16.Effect.fail(
|
|
1174
1382
|
new ConfigFileParseError({
|
|
1175
1383
|
message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1176
1384
|
filePath,
|
|
@@ -1179,21 +1387,21 @@ var RawConfigReader = class extends import_effect13.Effect.Service()("RawConfigR
|
|
|
1179
1387
|
);
|
|
1180
1388
|
}
|
|
1181
1389
|
if (parsed == null) {
|
|
1182
|
-
return yield*
|
|
1390
|
+
return yield* import_effect16.Effect.fail(
|
|
1183
1391
|
new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })
|
|
1184
1392
|
);
|
|
1185
1393
|
}
|
|
1186
1394
|
if (!options?.disableVersionCheck && typeof parsed.version !== "number") {
|
|
1187
|
-
return yield*
|
|
1395
|
+
return yield* import_effect16.Effect.fail(
|
|
1188
1396
|
new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })
|
|
1189
1397
|
);
|
|
1190
1398
|
}
|
|
1191
1399
|
return parsed;
|
|
1192
1400
|
});
|
|
1193
1401
|
const readConfigFile = (configFilePath) => readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1402
|
+
import_effect16.Effect.map((parsed) => parsed),
|
|
1403
|
+
import_effect16.Effect.catchTag("ConfigFileNotFoundError", () => import_effect16.Effect.succeed(null)),
|
|
1404
|
+
import_effect16.Effect.withSpan("RawConfigReader.readConfigFile")
|
|
1197
1405
|
);
|
|
1198
1406
|
return { findConfig, readRawConfig, readConfigFile };
|
|
1199
1407
|
})
|
|
@@ -1203,17 +1411,17 @@ var RawConfigReader = class extends import_effect13.Effect.Service()("RawConfigR
|
|
|
1203
1411
|
// src/services/schema-validator.ts
|
|
1204
1412
|
var import_ajv = __toESM(require("ajv"));
|
|
1205
1413
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1206
|
-
var
|
|
1207
|
-
var SchemaValidator = class extends
|
|
1208
|
-
effect:
|
|
1414
|
+
var import_effect17 = require("effect");
|
|
1415
|
+
var SchemaValidator = class extends import_effect17.Effect.Service()("SchemaValidator", {
|
|
1416
|
+
effect: import_effect17.Effect.gen(function* () {
|
|
1209
1417
|
const ajv = new import_ajv.default();
|
|
1210
1418
|
(0, import_ajv_formats.default)(ajv);
|
|
1211
|
-
const validate =
|
|
1419
|
+
const validate = import_effect17.Effect.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
|
|
1212
1420
|
const compiledValidate = ajv.compile(schema);
|
|
1213
1421
|
const valid = compiledValidate(config);
|
|
1214
1422
|
if (!valid) {
|
|
1215
1423
|
const errors = compiledValidate.errors?.map((e) => `${e.instancePath || "/"} ${e.message ?? ""}`.trim()) ?? [];
|
|
1216
|
-
return yield*
|
|
1424
|
+
return yield* import_effect17.Effect.fail(
|
|
1217
1425
|
new ConfigSchemaValidationError({
|
|
1218
1426
|
message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,
|
|
1219
1427
|
filePath,
|
|
@@ -1230,7 +1438,7 @@ var SchemaValidator = class extends import_effect14.Effect.Service()("SchemaVali
|
|
|
1230
1438
|
// src/services/v4-config-parser.ts
|
|
1231
1439
|
var import_platform10 = require("@effect/platform");
|
|
1232
1440
|
var import_build_utils = require("@gigadrive/build-utils");
|
|
1233
|
-
var
|
|
1441
|
+
var import_effect18 = require("effect");
|
|
1234
1442
|
var import_minimatch = require("minimatch");
|
|
1235
1443
|
var import_safe_regex2 = __toESM(require("safe-regex2"));
|
|
1236
1444
|
var MAX_ASSET_DEPTH = 100;
|
|
@@ -1336,7 +1544,7 @@ var mapRoute = (route, entrypoints) => ({
|
|
|
1336
1544
|
negativeRequirements: route.missing,
|
|
1337
1545
|
status: route.statusCode
|
|
1338
1546
|
});
|
|
1339
|
-
var parseEntrypoints =
|
|
1547
|
+
var parseEntrypoints = import_effect18.Effect.fn("parseEntrypoints")(function* (config, projectFolder) {
|
|
1340
1548
|
const entrypoints = [];
|
|
1341
1549
|
if (config.functions == null) return entrypoints;
|
|
1342
1550
|
for (const [fnPath, func] of Object.entries(config.functions)) {
|
|
@@ -1346,7 +1554,7 @@ var parseEntrypoints = import_effect15.Effect.fn("parseEntrypoints")(function* (
|
|
|
1346
1554
|
functionPath: fnPath
|
|
1347
1555
|
});
|
|
1348
1556
|
}
|
|
1349
|
-
const matchedFiles = yield*
|
|
1557
|
+
const matchedFiles = yield* import_effect18.Effect.tryPromise({
|
|
1350
1558
|
try: () => (0, import_build_utils.getFilesForPattern)(fnPath, projectFolder, func.excludeFiles),
|
|
1351
1559
|
catch: (error) => new FunctionConfigError({
|
|
1352
1560
|
message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -1382,14 +1590,14 @@ var parseEntrypoints = import_effect15.Effect.fn("parseEntrypoints")(function* (
|
|
|
1382
1590
|
}
|
|
1383
1591
|
return entrypoints;
|
|
1384
1592
|
});
|
|
1385
|
-
var collectAssets =
|
|
1593
|
+
var collectAssets = import_effect18.Effect.fn("collectAssets")(function* (config, projectFolder) {
|
|
1386
1594
|
if (config.assets == null) return [];
|
|
1387
1595
|
const fs = yield* import_platform10.FileSystem.FileSystem;
|
|
1388
1596
|
const pathService = yield* import_platform10.Path.Path;
|
|
1389
1597
|
const assetsPath = pathService.join(projectFolder, config.assets);
|
|
1390
|
-
const assetsExist = yield* fs.exists(assetsPath).pipe(
|
|
1598
|
+
const assetsExist = yield* fs.exists(assetsPath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed(false)));
|
|
1391
1599
|
if (!assetsExist) return [];
|
|
1392
|
-
const stat = yield* fs.stat(assetsPath).pipe(
|
|
1600
|
+
const stat = yield* fs.stat(assetsPath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed(null)));
|
|
1393
1601
|
if (!stat || stat.type !== "Directory") return [];
|
|
1394
1602
|
const allFiles = yield* collectFilesRecursively(assetsPath);
|
|
1395
1603
|
const assets = [];
|
|
@@ -1400,18 +1608,18 @@ var collectAssets = import_effect15.Effect.fn("collectAssets")(function* (config
|
|
|
1400
1608
|
}
|
|
1401
1609
|
return assets;
|
|
1402
1610
|
});
|
|
1403
|
-
var collectFilesRecursively =
|
|
1611
|
+
var collectFilesRecursively = import_effect18.Effect.fn("collectFilesRecursively")(
|
|
1404
1612
|
function* (basePath, relativePath = "", depth = 0) {
|
|
1405
1613
|
if (depth > MAX_ASSET_DEPTH) return [];
|
|
1406
1614
|
const fs = yield* import_platform10.FileSystem.FileSystem;
|
|
1407
1615
|
const pathSvc = yield* import_platform10.Path.Path;
|
|
1408
1616
|
const currentPath = relativePath ? pathSvc.join(basePath, relativePath) : basePath;
|
|
1409
|
-
const entries = yield* fs.readDirectory(currentPath).pipe(
|
|
1617
|
+
const entries = yield* fs.readDirectory(currentPath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed([])));
|
|
1410
1618
|
const result = [];
|
|
1411
1619
|
for (const name of entries) {
|
|
1412
1620
|
const fullPath = pathSvc.join(currentPath, name);
|
|
1413
1621
|
const entryRelative = relativePath ? pathSvc.join(relativePath, name) : name;
|
|
1414
|
-
const stat = yield* fs.stat(fullPath).pipe(
|
|
1622
|
+
const stat = yield* fs.stat(fullPath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed(null)));
|
|
1415
1623
|
if (!stat) continue;
|
|
1416
1624
|
if (stat.type === "Directory") {
|
|
1417
1625
|
const nested = yield* collectFilesRecursively(basePath, entryRelative, depth + 1);
|
|
@@ -1423,16 +1631,16 @@ var collectFilesRecursively = import_effect15.Effect.fn("collectFilesRecursively
|
|
|
1423
1631
|
return result;
|
|
1424
1632
|
}
|
|
1425
1633
|
);
|
|
1426
|
-
var V4ConfigParser = class extends
|
|
1634
|
+
var V4ConfigParser = class extends import_effect18.Effect.Service()("V4ConfigParser", {
|
|
1427
1635
|
accessors: true,
|
|
1428
|
-
effect:
|
|
1636
|
+
effect: import_effect18.Effect.succeed({
|
|
1429
1637
|
/**
|
|
1430
1638
|
* Parses a ConfigV4 into a NormalizedConfig.
|
|
1431
1639
|
*
|
|
1432
1640
|
* @param config - The raw V4 config object
|
|
1433
1641
|
* @param projectFolder - Absolute path to the project root
|
|
1434
1642
|
*/
|
|
1435
|
-
parse:
|
|
1643
|
+
parse: import_effect18.Effect.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
|
|
1436
1644
|
const entrypoints = yield* parseEntrypoints(config, projectFolder);
|
|
1437
1645
|
const assets = yield* collectAssets(config, projectFolder);
|
|
1438
1646
|
return {
|
|
@@ -1461,7 +1669,7 @@ var V4ConfigParser = class extends import_effect15.Effect.Service()("V4ConfigPar
|
|
|
1461
1669
|
var import_platform11 = require("@effect/platform");
|
|
1462
1670
|
var import_build_utils2 = require("@gigadrive/build-utils");
|
|
1463
1671
|
var import_commons = require("@gigadrive/commons");
|
|
1464
|
-
var
|
|
1672
|
+
var import_effect19 = require("effect");
|
|
1465
1673
|
|
|
1466
1674
|
// src/build-output-v3/determine-repo-root.ts
|
|
1467
1675
|
var import_path = __toESM(require("path"));
|
|
@@ -1557,11 +1765,11 @@ var translateVercelRuntime = (runtime) => {
|
|
|
1557
1765
|
var CONFIG_PATH = ".vercel/output/config.json";
|
|
1558
1766
|
var FUNCTIONS_FOLDER = ".vercel/output/functions";
|
|
1559
1767
|
var FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;
|
|
1560
|
-
var VercelBuildOutputParser = class extends
|
|
1561
|
-
effect:
|
|
1768
|
+
var VercelBuildOutputParser = class extends import_effect19.Effect.Service()("VercelBuildOutputParser", {
|
|
1769
|
+
effect: import_effect19.Effect.gen(function* () {
|
|
1562
1770
|
const rawConfigReader = yield* RawConfigReader;
|
|
1563
1771
|
const pathService = yield* import_platform11.Path.Path;
|
|
1564
|
-
const parse =
|
|
1772
|
+
const parse = import_effect19.Effect.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
|
|
1565
1773
|
const config = yield* rawConfigReader.readConfigFile(pathService.join(projectFolder, CONFIG_PATH));
|
|
1566
1774
|
if (!config || typeof config.version !== "number" || config.version < 3) {
|
|
1567
1775
|
return parseResult;
|
|
@@ -1573,8 +1781,8 @@ var VercelBuildOutputParser = class extends import_effect16.Effect.Service()("Ve
|
|
|
1573
1781
|
merged.regions = [...new Set(merged.regions)];
|
|
1574
1782
|
return merged;
|
|
1575
1783
|
});
|
|
1576
|
-
const loadFunctions =
|
|
1577
|
-
const functionConfigs = yield*
|
|
1784
|
+
const loadFunctions = import_effect19.Effect.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
|
|
1785
|
+
const functionConfigs = yield* import_effect19.Effect.tryPromise({
|
|
1578
1786
|
try: () => (0, import_build_utils2.getFilesForPattern)(FUNCTION_CONFIGS_PATTERN, projectFolder),
|
|
1579
1787
|
catch: (error) => new ConfigFileParseError({
|
|
1580
1788
|
message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -2173,7 +2381,7 @@ var schema_default = {
|
|
|
2173
2381
|
};
|
|
2174
2382
|
|
|
2175
2383
|
// src/parse-config.ts
|
|
2176
|
-
var parseConfigRaw =
|
|
2384
|
+
var parseConfigRaw = import_effect20.Effect.fn("parseConfigRaw")(function* (filePath, projectFolder) {
|
|
2177
2385
|
const rawReader = yield* RawConfigReader;
|
|
2178
2386
|
const validator = yield* SchemaValidator;
|
|
2179
2387
|
const v4Parser = yield* V4ConfigParser;
|
|
@@ -2184,7 +2392,7 @@ var parseConfigRaw = import_effect17.Effect.fn("parseConfigRaw")(function* (file
|
|
|
2184
2392
|
};
|
|
2185
2393
|
const schema = schemaMap[version];
|
|
2186
2394
|
if (!schema) {
|
|
2187
|
-
return yield*
|
|
2395
|
+
return yield* import_effect20.Effect.fail(
|
|
2188
2396
|
new ConfigVersionError({
|
|
2189
2397
|
message: `Config file at ${filePath} has an unsupported version: ${version}`,
|
|
2190
2398
|
filePath,
|
|
@@ -2195,18 +2403,19 @@ var parseConfigRaw = import_effect17.Effect.fn("parseConfigRaw")(function* (file
|
|
|
2195
2403
|
yield* validator.validate(parsed, schema, filePath);
|
|
2196
2404
|
return yield* v4Parser.parse(parsed, projectFolder);
|
|
2197
2405
|
});
|
|
2198
|
-
var parseConfig =
|
|
2406
|
+
var parseConfig = import_effect20.Effect.fn("parseConfig")(function* (filePath, projectFolder) {
|
|
2199
2407
|
const parseResult = yield* parseConfigRaw(filePath, projectFolder);
|
|
2200
2408
|
return yield* postProcessConfig(parseResult, projectFolder);
|
|
2201
2409
|
});
|
|
2202
|
-
var postProcessConfig =
|
|
2410
|
+
var postProcessConfig = import_effect20.Effect.fn("postProcessConfig")(function* (config, projectFolder) {
|
|
2203
2411
|
const vercelParser = yield* VercelBuildOutputParser;
|
|
2204
2412
|
let result = yield* vercelParser.parse(config, projectFolder);
|
|
2205
|
-
|
|
2413
|
+
const hasAssets = (result.assets?.paths?.length ?? 0) > 0 || (result.assets?.prefixes?.length ?? 0) > 0 || (result.assets?.manifests?.length ?? 0) > 0;
|
|
2414
|
+
if (result.entrypoints.length === 0 && !hasAssets && result.routes.length === 0) {
|
|
2206
2415
|
result.errors.push(
|
|
2207
2416
|
"The current project config does not resolve to any functions, assets or routes and can not be deployed."
|
|
2208
2417
|
);
|
|
2209
|
-
} else if (result.entrypoints.length === 0 &&
|
|
2418
|
+
} else if (result.entrypoints.length === 0 && !hasAssets) {
|
|
2210
2419
|
result.warnings.push("The current project does not have any functions or assets to deploy.");
|
|
2211
2420
|
}
|
|
2212
2421
|
result = filterFunctionsFromAssets(result);
|
|
@@ -2227,9 +2436,9 @@ var RUNTIME_DEFINITIONS = [
|
|
|
2227
2436
|
var AVAILABLE_RUNTIMES = [...RUNTIME_DEFINITIONS];
|
|
2228
2437
|
|
|
2229
2438
|
// src/services/index.ts
|
|
2230
|
-
var
|
|
2231
|
-
var BaseLayers =
|
|
2232
|
-
var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(
|
|
2439
|
+
var import_effect21 = require("effect");
|
|
2440
|
+
var BaseLayers = import_effect21.Layer.mergeAll(RawConfigReader.Default, SchemaValidator.Default, V4ConfigParser.Default);
|
|
2441
|
+
var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect21.Layer.provideMerge(BaseLayers));
|
|
2233
2442
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2234
2443
|
0 && (module.exports = {
|
|
2235
2444
|
ALLOWED_CONFIG_NAMES,
|
|
@@ -2244,6 +2453,14 @@ var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect18.Lay
|
|
|
2244
2453
|
FRAMEWORK_DEFINITIONS,
|
|
2245
2454
|
FrameworkNotDetectedError,
|
|
2246
2455
|
FunctionConfigError,
|
|
2456
|
+
GigadriveNextBuildManifestSchema,
|
|
2457
|
+
GigadriveNextBuildManifestV1Schema,
|
|
2458
|
+
GigadriveNextBuildManifestV2ExportSchema,
|
|
2459
|
+
GigadriveNextBuildManifestV2StandaloneSchema,
|
|
2460
|
+
GigadriveNextPrerenderManifestV1Schema,
|
|
2461
|
+
GigadriveNextPrerenderOutputSchema,
|
|
2462
|
+
GigadriveNextServerDescriptorSchema,
|
|
2463
|
+
GigadriveNextStaticAssetPrefixSchema,
|
|
2247
2464
|
MAX_FUNCTION_DURATION_SECONDS,
|
|
2248
2465
|
ManifestNotFoundError,
|
|
2249
2466
|
ManifestParseError,
|
|
@@ -2251,6 +2468,9 @@ var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect18.Lay
|
|
|
2251
2468
|
NetworkConfigLive,
|
|
2252
2469
|
RawConfigReader,
|
|
2253
2470
|
SchemaValidator,
|
|
2471
|
+
StaticAssetHeadersSchema,
|
|
2472
|
+
StaticAssetManifestEntrySchema,
|
|
2473
|
+
StaticAssetManifestV1Schema,
|
|
2254
2474
|
V4ConfigParser,
|
|
2255
2475
|
VercelBuildOutputParser,
|
|
2256
2476
|
detectFramework,
|
|
@@ -2262,6 +2482,8 @@ var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect18.Lay
|
|
|
2262
2482
|
parseConfig,
|
|
2263
2483
|
parseConfigRaw,
|
|
2264
2484
|
parseGigadriveNextBuildManifest,
|
|
2485
|
+
parseGigadriveNextPrerenderManifest,
|
|
2486
|
+
parseStaticAssetManifest,
|
|
2265
2487
|
postProcessConfig,
|
|
2266
2488
|
readDependencies
|
|
2267
2489
|
});
|