@gigadrive/network-config 4.6.0 → 5.0.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.js CHANGED
@@ -48,8 +48,12 @@ __export(src_exports, {
48
48
  GigadriveNextBuildManifestV1Schema: () => GigadriveNextBuildManifestV1Schema,
49
49
  GigadriveNextBuildManifestV2ExportSchema: () => GigadriveNextBuildManifestV2ExportSchema,
50
50
  GigadriveNextBuildManifestV2StandaloneSchema: () => GigadriveNextBuildManifestV2StandaloneSchema,
51
+ GigadriveNextMiddlewareDescriptorSchema: () => GigadriveNextMiddlewareDescriptorSchema,
52
+ GigadriveNextMiddlewareMatcherSchema: () => GigadriveNextMiddlewareMatcherSchema,
51
53
  GigadriveNextPrerenderManifestV1Schema: () => GigadriveNextPrerenderManifestV1Schema,
52
54
  GigadriveNextPrerenderOutputSchema: () => GigadriveNextPrerenderOutputSchema,
55
+ GigadriveNextPrerenderSeedMethodsSchema: () => GigadriveNextPrerenderSeedMethodsSchema,
56
+ GigadriveNextRouteConditionSchema: () => GigadriveNextRouteConditionSchema,
53
57
  GigadriveNextServerDescriptorSchema: () => GigadriveNextServerDescriptorSchema,
54
58
  GigadriveNextStaticAssetPrefixSchema: () => GigadriveNextStaticAssetPrefixSchema,
55
59
  MAX_FUNCTION_DURATION_SECONDS: () => MAX_FUNCTION_DURATION_SECONDS,
@@ -64,6 +68,7 @@ __export(src_exports, {
64
68
  StaticAssetManifestV1Schema: () => StaticAssetManifestV1Schema,
65
69
  V4ConfigParser: () => V4ConfigParser,
66
70
  VercelBuildOutputParser: () => VercelBuildOutputParser,
71
+ collectAssetFiles: () => collectAssetFiles,
67
72
  defineConfig: () => defineConfig,
68
73
  detectFramework: () => detectFramework,
69
74
  detectPackageManager: () => detectPackageManager,
@@ -138,16 +143,54 @@ var StaticAssetManifestV1Schema = import_effect2.Schema.mutable(
138
143
  ).pipe(import_effect2.Schema.filter(({ assets }) => new Set(assets.map(({ path: path2 }) => path2)).size === assets.length));
139
144
  var parseStaticAssetManifest = (content) => decodeJson(StaticAssetManifestV1Schema, content);
140
145
 
146
+ // src/collect-asset-files.ts
147
+ var import_platform = require("@effect/platform");
148
+ var import_effect3 = require("effect");
149
+ var MAX_ASSET_DEPTH = 100;
150
+ var DISALLOWED_ASSET_EXTENSIONS = [".htaccess", ".htpasswd"];
151
+ var collectFilesRecursively = import_effect3.Effect.fn("collectFilesRecursively")(
152
+ function* (basePath, relativePath = "", depth = 0) {
153
+ if (depth > MAX_ASSET_DEPTH) return [];
154
+ const fs = yield* import_platform.FileSystem.FileSystem;
155
+ const pathSvc = yield* import_platform.Path.Path;
156
+ const currentPath = relativePath ? pathSvc.join(basePath, relativePath) : basePath;
157
+ const entries = yield* fs.readDirectory(currentPath).pipe(import_effect3.Effect.catchAll(() => import_effect3.Effect.succeed([])));
158
+ const result = [];
159
+ for (const name of entries) {
160
+ const fullPath = pathSvc.join(currentPath, name);
161
+ const entryRelative = relativePath ? pathSvc.join(relativePath, name) : name;
162
+ const stat = yield* fs.stat(fullPath).pipe(import_effect3.Effect.catchAll(() => import_effect3.Effect.succeed(null)));
163
+ if (!stat) continue;
164
+ if (stat.type === "Directory") {
165
+ const nested = yield* collectFilesRecursively(basePath, entryRelative, depth + 1);
166
+ result.push(...nested);
167
+ } else {
168
+ result.push(entryRelative);
169
+ }
170
+ }
171
+ return result;
172
+ }
173
+ );
174
+ var collectAssetFiles = import_effect3.Effect.fn("collectAssetFiles")(function* (projectFolder, assetsDir) {
175
+ const fs = yield* import_platform.FileSystem.FileSystem;
176
+ const pathService = yield* import_platform.Path.Path;
177
+ const assetsPath = pathService.join(projectFolder, assetsDir);
178
+ const stat = yield* fs.stat(assetsPath).pipe(import_effect3.Effect.catchAll(() => import_effect3.Effect.succeed(null)));
179
+ if (!stat || stat.type !== "Directory") return [];
180
+ const files = yield* collectFilesRecursively(assetsPath);
181
+ return files.map((file) => file.replaceAll("\\", "/")).filter((file) => !DISALLOWED_ASSET_EXTENSIONS.some((extension) => file.toLowerCase().endsWith(extension))).sort();
182
+ });
183
+
141
184
  // src/define-config.ts
142
185
  var defineConfig = (config) => config;
143
186
 
144
187
  // src/detection/detect-framework.ts
145
- var import_platform8 = require("@effect/platform");
146
- var import_effect13 = require("effect");
188
+ var import_platform9 = require("@effect/platform");
189
+ var import_effect14 = require("effect");
147
190
 
148
191
  // src/detection/detect-package-manager.ts
149
- var import_platform = require("@effect/platform");
150
- var import_effect3 = require("effect");
192
+ var import_platform2 = require("@effect/platform");
193
+ var import_effect4 = require("effect");
151
194
  var LOCKFILE_MAP = [
152
195
  { files: ["bun.lockb", "bun.lock"], pm: "bun" },
153
196
  { files: ["pnpm-lock.yaml"], pm: "pnpm" },
@@ -155,19 +198,19 @@ var LOCKFILE_MAP = [
155
198
  { files: ["package-lock.json"], pm: "npm" },
156
199
  { files: ["composer.lock"], pm: "composer" }
157
200
  ];
158
- var detectPackageManager = import_effect3.Effect.fn("detectPackageManager")(function* (projectFolder) {
159
- const fs = yield* import_platform.FileSystem.FileSystem;
160
- const pathService = yield* import_platform.Path.Path;
201
+ var detectPackageManager = import_effect4.Effect.fn("detectPackageManager")(function* (projectFolder) {
202
+ const fs = yield* import_platform2.FileSystem.FileSystem;
203
+ const pathService = yield* import_platform2.Path.Path;
161
204
  for (const { files, pm } of LOCKFILE_MAP) {
162
205
  for (const file of files) {
163
- const exists = yield* fs.exists(pathService.join(projectFolder, file)).pipe(import_effect3.Effect.catchAll(() => import_effect3.Effect.succeed(false)));
206
+ const exists = yield* fs.exists(pathService.join(projectFolder, file)).pipe(import_effect4.Effect.catchAll(() => import_effect4.Effect.succeed(false)));
164
207
  if (exists) {
165
- yield* import_effect3.Effect.logDebug(`Detected package manager: ${pm} (via ${file})`);
208
+ yield* import_effect4.Effect.logDebug(`Detected package manager: ${pm} (via ${file})`);
166
209
  return pm;
167
210
  }
168
211
  }
169
212
  }
170
- yield* import_effect3.Effect.logDebug("No lockfile found, defaulting to npm");
213
+ yield* import_effect4.Effect.logDebug("No lockfile found, defaulting to npm");
171
214
  return "npm";
172
215
  });
173
216
 
@@ -193,8 +236,8 @@ var astro = {
193
236
  };
194
237
 
195
238
  // src/detection/frameworks/resolve-node-entrypoint.ts
196
- var import_platform2 = require("@effect/platform");
197
- var import_effect4 = require("effect");
239
+ var import_platform3 = require("@effect/platform");
240
+ var import_effect5 = require("effect");
198
241
  var SCRIPT_RUNNERS = /* @__PURE__ */ new Set(["node", "bun", "tsx", "ts-node"]);
199
242
  var COMMON_ENTRYPOINT_CANDIDATES = [
200
243
  "index.js",
@@ -242,14 +285,14 @@ var applyEntrypoint = (defaults, entrypoint) => ({
242
285
  (route) => route.destination === defaults.entrypoint ? { ...route, destination: entrypoint } : route
243
286
  )
244
287
  });
245
- var resolveNodeServerEntrypoint = (defaults, projectFolder) => import_effect4.Effect.gen(function* () {
246
- const fs = yield* import_platform2.FileSystem.FileSystem;
247
- const pathService = yield* import_platform2.Path.Path;
288
+ var resolveNodeServerEntrypoint = (defaults, projectFolder) => import_effect5.Effect.gen(function* () {
289
+ const fs = yield* import_platform3.FileSystem.FileSystem;
290
+ const pathService = yield* import_platform3.Path.Path;
248
291
  const isFile = (relativePath) => fs.stat(pathService.join(projectFolder, relativePath)).pipe(
249
- import_effect4.Effect.map((info) => info.type === "File"),
250
- import_effect4.Effect.catchAll(() => import_effect4.Effect.succeed(false))
292
+ import_effect5.Effect.map((info) => info.type === "File"),
293
+ import_effect5.Effect.catchAll(() => import_effect5.Effect.succeed(false))
251
294
  );
252
- const content = yield* fs.readFileString(pathService.join(projectFolder, "package.json")).pipe(import_effect4.Effect.catchAll(() => import_effect4.Effect.succeed(void 0)));
295
+ const content = yield* fs.readFileString(pathService.join(projectFolder, "package.json")).pipe(import_effect5.Effect.catchAll(() => import_effect5.Effect.succeed(void 0)));
253
296
  const manifest = content ? parsePackageJson(content) : void 0;
254
297
  const startScript = typeof manifest?.scripts?.start === "string" ? manifest.scripts.start : void 0;
255
298
  const candidates = [
@@ -381,8 +424,8 @@ var laravel = {
381
424
  };
382
425
 
383
426
  // src/detection/frameworks/nestjs.ts
384
- var import_platform3 = require("@effect/platform");
385
- var import_effect5 = require("effect");
427
+ var import_platform4 = require("@effect/platform");
428
+ var import_effect6 = require("effect");
386
429
  var isRecord2 = (value) => typeof value === "object" && value !== null;
387
430
  var parseNestCliJson = (content) => {
388
431
  try {
@@ -433,9 +476,9 @@ var nestjs = {
433
476
  detectors: [{ matchPackage: "@nestjs/core" }],
434
477
  priority: 90,
435
478
  getDefaultConfig: () => createNestConfig("dist"),
436
- refineDefaultConfig: (defaults, projectFolder) => import_effect5.Effect.gen(function* () {
437
- const fs = yield* import_platform3.FileSystem.FileSystem;
438
- const content = yield* fs.readFileString(`${projectFolder}/nest-cli.json`).pipe(import_effect5.Effect.catchAll(() => import_effect5.Effect.succeed(void 0)));
479
+ refineDefaultConfig: (defaults, projectFolder) => import_effect6.Effect.gen(function* () {
480
+ const fs = yield* import_platform4.FileSystem.FileSystem;
481
+ const content = yield* fs.readFileString(`${projectFolder}/nest-cli.json`).pipe(import_effect6.Effect.catchAll(() => import_effect6.Effect.succeed(void 0)));
439
482
  if (!content) return defaults;
440
483
  const nestConfig = parseNestCliJson(content);
441
484
  const outputPath = nestConfig ? getProjectOutputPath(nestConfig) : void 0;
@@ -444,28 +487,28 @@ var nestjs = {
444
487
  };
445
488
 
446
489
  // src/detection/frameworks/nextjs.ts
447
- var import_platform5 = require("@effect/platform");
448
- var import_effect8 = require("effect");
490
+ var import_platform6 = require("@effect/platform");
491
+ var import_effect9 = require("effect");
449
492
 
450
493
  // src/build-output-v3/get-default-path-map.ts
451
- var import_platform4 = require("@effect/platform");
452
- var import_effect6 = require("effect");
453
- var getDefaultPathMap = import_effect6.Effect.fn("getDefaultPathMap")(function* (directory) {
454
- const fs = yield* import_platform4.FileSystem.FileSystem;
455
- const pathService = yield* import_platform4.Path.Path;
494
+ var import_platform5 = require("@effect/platform");
495
+ var import_effect7 = require("effect");
496
+ var getDefaultPathMap = import_effect7.Effect.fn("getDefaultPathMap")(function* (directory) {
497
+ const fs = yield* import_platform5.FileSystem.FileSystem;
498
+ const pathService = yield* import_platform5.Path.Path;
456
499
  const result = {};
457
- const exists = yield* fs.exists(directory).pipe(import_effect6.Effect.catchAll(() => import_effect6.Effect.succeed(false)));
500
+ const exists = yield* fs.exists(directory).pipe(import_effect7.Effect.catchAll(() => import_effect7.Effect.succeed(false)));
458
501
  if (!exists) {
459
502
  return result;
460
503
  }
461
504
  const MAX_DEPTH = 100;
462
- const processDirectory = (currentPath, basePath = "", depth = 0) => import_effect6.Effect.gen(function* () {
505
+ const processDirectory = (currentPath, basePath = "", depth = 0) => import_effect7.Effect.gen(function* () {
463
506
  if (depth > MAX_DEPTH) return;
464
- const entries = yield* fs.readDirectory(currentPath).pipe(import_effect6.Effect.catchAll(() => import_effect6.Effect.succeed([])));
507
+ const entries = yield* fs.readDirectory(currentPath).pipe(import_effect7.Effect.catchAll(() => import_effect7.Effect.succeed([])));
465
508
  for (const name of entries) {
466
509
  const fullPath = pathService.join(currentPath, name);
467
510
  const relativePath = basePath ? pathService.join(basePath, name) : name;
468
- const stat = yield* fs.stat(fullPath).pipe(import_effect6.Effect.catchAll(() => import_effect6.Effect.succeed(null)));
511
+ const stat = yield* fs.stat(fullPath).pipe(import_effect7.Effect.catchAll(() => import_effect7.Effect.succeed(null)));
469
512
  if (!stat) continue;
470
513
  if (stat.type === "Directory") {
471
514
  yield* processDirectory(fullPath, relativePath, depth + 1);
@@ -482,180 +525,244 @@ var getDefaultPathMap = import_effect6.Effect.fn("getDefaultPathMap")(function*
482
525
  var MAXIMUM_ENTRY_PAGE_PATHS = 50;
483
526
 
484
527
  // src/nextjs-manifest.ts
485
- var import_effect7 = require("effect");
486
- var StringArraySchema = import_effect7.Schema.mutable(import_effect7.Schema.Array(import_effect7.Schema.String));
487
- var StringRecordSchema = import_effect7.Schema.mutable(import_effect7.Schema.Record({ key: import_effect7.Schema.String, value: import_effect7.Schema.String }));
488
- var JsonValueSchema = import_effect7.Schema.suspend(
489
- () => import_effect7.Schema.Union(
490
- import_effect7.Schema.Null,
491
- import_effect7.Schema.Boolean,
492
- import_effect7.Schema.Number,
493
- import_effect7.Schema.String,
494
- import_effect7.Schema.mutable(import_effect7.Schema.Array(JsonValueSchema)),
495
- import_effect7.Schema.mutable(import_effect7.Schema.Record({ key: import_effect7.Schema.String, value: JsonValueSchema }))
528
+ var import_effect8 = require("effect");
529
+ var StringArraySchema = import_effect8.Schema.mutable(import_effect8.Schema.Array(import_effect8.Schema.String));
530
+ var StringRecordSchema = import_effect8.Schema.mutable(import_effect8.Schema.Record({ key: import_effect8.Schema.String, value: import_effect8.Schema.String }));
531
+ var JsonValueSchema = import_effect8.Schema.suspend(
532
+ () => import_effect8.Schema.Union(
533
+ import_effect8.Schema.Null,
534
+ import_effect8.Schema.Boolean,
535
+ import_effect8.Schema.Number,
536
+ import_effect8.Schema.String,
537
+ import_effect8.Schema.mutable(import_effect8.Schema.Array(JsonValueSchema)),
538
+ import_effect8.Schema.mutable(import_effect8.Schema.Record({ key: import_effect8.Schema.String, value: JsonValueSchema }))
496
539
  )
497
540
  );
498
- var ImageLocalPatternSchema = import_effect7.Schema.mutable(
499
- import_effect7.Schema.Struct({
500
- pathname: import_effect7.Schema.optional(import_effect7.Schema.String),
501
- search: import_effect7.Schema.optional(import_effect7.Schema.String)
541
+ var ImageLocalPatternSchema = import_effect8.Schema.mutable(
542
+ import_effect8.Schema.Struct({
543
+ pathname: import_effect8.Schema.optional(import_effect8.Schema.String),
544
+ search: import_effect8.Schema.optional(import_effect8.Schema.String)
502
545
  })
503
546
  );
504
- var ImageRemotePatternSchema = import_effect7.Schema.mutable(
505
- import_effect7.Schema.Struct({
506
- protocol: import_effect7.Schema.optional(import_effect7.Schema.Literal("http", "https")),
507
- hostname: import_effect7.Schema.String,
508
- port: import_effect7.Schema.optional(import_effect7.Schema.String),
509
- pathname: import_effect7.Schema.optional(import_effect7.Schema.String),
510
- search: import_effect7.Schema.optional(import_effect7.Schema.String)
547
+ var ImageRemotePatternSchema = import_effect8.Schema.mutable(
548
+ import_effect8.Schema.Struct({
549
+ protocol: import_effect8.Schema.optional(import_effect8.Schema.Literal("http", "https")),
550
+ hostname: import_effect8.Schema.String,
551
+ port: import_effect8.Schema.optional(import_effect8.Schema.String),
552
+ pathname: import_effect8.Schema.optional(import_effect8.Schema.String),
553
+ search: import_effect8.Schema.optional(import_effect8.Schema.String)
511
554
  })
512
555
  );
513
- var ImageVariantSchema = import_effect7.Schema.mutable(
514
- import_effect7.Schema.Struct({
515
- width: import_effect7.Schema.optional(import_effect7.Schema.Number),
516
- height: import_effect7.Schema.optional(import_effect7.Schema.Number),
517
- quality: import_effect7.Schema.optional(import_effect7.Schema.Number),
518
- format: import_effect7.Schema.optional(import_effect7.Schema.Literal("image/avif", "image/webp", "image/jpeg", "image/png")),
519
- fit: import_effect7.Schema.optional(import_effect7.Schema.Literal("contain", "cover", "fill", "inside", "outside"))
556
+ var ImageVariantSchema = import_effect8.Schema.mutable(
557
+ import_effect8.Schema.Struct({
558
+ width: import_effect8.Schema.optional(import_effect8.Schema.Number),
559
+ height: import_effect8.Schema.optional(import_effect8.Schema.Number),
560
+ quality: import_effect8.Schema.optional(import_effect8.Schema.Number),
561
+ format: import_effect8.Schema.optional(import_effect8.Schema.Literal("image/avif", "image/webp", "image/jpeg", "image/png")),
562
+ fit: import_effect8.Schema.optional(import_effect8.Schema.Literal("contain", "cover", "fill", "inside", "outside"))
520
563
  })
521
564
  );
522
- var PositiveIntSchema = import_effect7.Schema.Int.pipe(import_effect7.Schema.greaterThan(0));
523
- var ImagePolicySchema = import_effect7.Schema.mutable(
524
- import_effect7.Schema.Struct({
525
- localPatterns: import_effect7.Schema.mutable(import_effect7.Schema.Array(ImageLocalPatternSchema)),
526
- remotePatterns: import_effect7.Schema.mutable(import_effect7.Schema.Array(ImageRemotePatternSchema)),
527
- widths: import_effect7.Schema.mutable(import_effect7.Schema.Array(PositiveIntSchema)),
528
- heights: import_effect7.Schema.mutable(import_effect7.Schema.Array(PositiveIntSchema)),
529
- qualities: import_effect7.Schema.mutable(import_effect7.Schema.Array(import_effect7.Schema.Number.pipe(import_effect7.Schema.between(1, 100)))),
530
- formats: import_effect7.Schema.mutable(import_effect7.Schema.Array(import_effect7.Schema.Literal("image/avif", "image/webp", "image/jpeg", "image/png"))),
531
- minimumCacheTTL: import_effect7.Schema.Number,
532
- dangerouslyAllowSVG: import_effect7.Schema.Boolean,
533
- contentSecurityPolicy: import_effect7.Schema.String,
534
- contentDispositionType: import_effect7.Schema.Literal("inline", "attachment"),
535
- maximumRedirects: import_effect7.Schema.Number,
536
- maximumResponseBody: import_effect7.Schema.Number,
537
- variants: import_effect7.Schema.mutable(import_effect7.Schema.Record({ key: import_effect7.Schema.String, value: ImageVariantSchema }))
565
+ var PositiveIntSchema = import_effect8.Schema.Int.pipe(import_effect8.Schema.greaterThan(0));
566
+ var ImagePolicySchema = import_effect8.Schema.mutable(
567
+ import_effect8.Schema.Struct({
568
+ localPatterns: import_effect8.Schema.mutable(import_effect8.Schema.Array(ImageLocalPatternSchema)),
569
+ remotePatterns: import_effect8.Schema.mutable(import_effect8.Schema.Array(ImageRemotePatternSchema)),
570
+ widths: import_effect8.Schema.mutable(import_effect8.Schema.Array(PositiveIntSchema)),
571
+ heights: import_effect8.Schema.mutable(import_effect8.Schema.Array(PositiveIntSchema)),
572
+ qualities: import_effect8.Schema.mutable(import_effect8.Schema.Array(import_effect8.Schema.Number.pipe(import_effect8.Schema.between(1, 100)))),
573
+ formats: import_effect8.Schema.mutable(import_effect8.Schema.Array(import_effect8.Schema.Literal("image/avif", "image/webp", "image/jpeg", "image/png"))),
574
+ minimumCacheTTL: import_effect8.Schema.Number,
575
+ dangerouslyAllowSVG: import_effect8.Schema.Boolean,
576
+ contentSecurityPolicy: import_effect8.Schema.String,
577
+ contentDispositionType: import_effect8.Schema.Literal("inline", "attachment"),
578
+ maximumRedirects: import_effect8.Schema.Number,
579
+ maximumResponseBody: import_effect8.Schema.Number,
580
+ variants: import_effect8.Schema.mutable(import_effect8.Schema.Record({ key: import_effect8.Schema.String, value: ImageVariantSchema }))
538
581
  })
539
582
  );
540
- var GigadriveNextPrerenderOutputSchema = import_effect7.Schema.mutable(
541
- import_effect7.Schema.Struct({
542
- id: import_effect7.Schema.String,
543
- type: import_effect7.Schema.Literal("PRERENDER"),
544
- pathname: UrlPathnameSchema,
545
- parentOutputId: import_effect7.Schema.String,
546
- groupId: import_effect7.Schema.Number,
547
- pprChain: import_effect7.Schema.optional(import_effect7.Schema.mutable(import_effect7.Schema.Struct({ headers: HttpSingleValueHeadersSchema }))),
548
- parentFallbackMode: import_effect7.Schema.optional(JsonValueSchema),
549
- fallback: import_effect7.Schema.optional(
550
- import_effect7.Schema.mutable(
551
- import_effect7.Schema.Struct({
552
- filePath: import_effect7.Schema.optional(PortableRelativePathSchema),
553
- initialStatus: import_effect7.Schema.optional(import_effect7.Schema.Int.pipe(import_effect7.Schema.between(100, 599))),
554
- initialHeaders: import_effect7.Schema.optional(HttpHeadersSchema),
555
- initialExpiration: import_effect7.Schema.optional(import_effect7.Schema.Number),
556
- initialRevalidate: import_effect7.Schema.optional(import_effect7.Schema.Union(import_effect7.Schema.Number, import_effect7.Schema.Literal(false))),
557
- postponedState: import_effect7.Schema.optional(import_effect7.Schema.String)
558
- })
559
- )
560
- ),
561
- config: import_effect7.Schema.mutable(
562
- import_effect7.Schema.Struct({
563
- allowQuery: import_effect7.Schema.optional(StringArraySchema),
564
- allowHeader: import_effect7.Schema.optional(StringArraySchema),
565
- bypassFor: import_effect7.Schema.optional(import_effect7.Schema.mutable(import_effect7.Schema.Array(JsonValueSchema))),
566
- renderingMode: import_effect7.Schema.optional(import_effect7.Schema.String),
567
- partialFallback: import_effect7.Schema.optional(import_effect7.Schema.Boolean),
568
- bypassToken: import_effect7.Schema.optional(import_effect7.Schema.String)
583
+ var GigadriveNextPrerenderOutputFields = {
584
+ id: import_effect8.Schema.String,
585
+ type: import_effect8.Schema.Literal("PRERENDER"),
586
+ pathname: UrlPathnameSchema,
587
+ route: import_effect8.Schema.optional(UrlPathnameSchema),
588
+ parentOutputId: import_effect8.Schema.String,
589
+ groupId: import_effect8.Schema.Number,
590
+ pprChain: import_effect8.Schema.optional(import_effect8.Schema.mutable(import_effect8.Schema.Struct({ headers: HttpSingleValueHeadersSchema }))),
591
+ parentFallbackMode: import_effect8.Schema.optional(JsonValueSchema),
592
+ fallback: import_effect8.Schema.optional(
593
+ import_effect8.Schema.mutable(
594
+ import_effect8.Schema.Struct({
595
+ filePath: import_effect8.Schema.optional(PortableRelativePathSchema),
596
+ initialStatus: import_effect8.Schema.optional(import_effect8.Schema.Int.pipe(import_effect8.Schema.between(100, 599))),
597
+ initialHeaders: import_effect8.Schema.optional(HttpHeadersSchema),
598
+ initialExpiration: import_effect8.Schema.optional(import_effect8.Schema.Number),
599
+ initialRevalidate: import_effect8.Schema.optional(import_effect8.Schema.Union(import_effect8.Schema.Number, import_effect8.Schema.Literal(false))),
600
+ postponedState: import_effect8.Schema.optional(import_effect8.Schema.String)
569
601
  })
570
602
  )
571
- })
603
+ ),
604
+ config: import_effect8.Schema.mutable(
605
+ import_effect8.Schema.Struct({
606
+ allowQuery: import_effect8.Schema.optional(StringArraySchema),
607
+ allowHeader: import_effect8.Schema.optional(StringArraySchema),
608
+ bypassFor: import_effect8.Schema.optional(import_effect8.Schema.mutable(import_effect8.Schema.Array(JsonValueSchema))),
609
+ renderingMode: import_effect8.Schema.optional(import_effect8.Schema.String),
610
+ partialFallback: import_effect8.Schema.optional(import_effect8.Schema.Boolean),
611
+ bypassToken: import_effect8.Schema.optional(import_effect8.Schema.String)
612
+ })
613
+ )
614
+ };
615
+ var GigadriveNextPrerenderClassificationSchema = import_effect8.Schema.Struct({
616
+ routeType: import_effect8.Schema.Literal("route", "fallback", "shell", "page"),
617
+ response: import_effect8.Schema.Literal("empty", "initial", "complete"),
618
+ compute: import_effect8.Schema.Literal("blocking", "resuming", "static"),
619
+ htmlSize: import_effect8.Schema.optional(import_effect8.Schema.Number)
620
+ });
621
+ var GigadriveNextPrerenderWithoutClassificationSchema = import_effect8.Schema.Struct({
622
+ routeType: import_effect8.Schema.optional(import_effect8.Schema.Never),
623
+ response: import_effect8.Schema.optional(import_effect8.Schema.Never),
624
+ compute: import_effect8.Schema.optional(import_effect8.Schema.Never),
625
+ htmlSize: import_effect8.Schema.optional(import_effect8.Schema.Never)
626
+ });
627
+ var GigadriveNextPrerenderOutputSchema = import_effect8.Schema.Union(
628
+ import_effect8.Schema.mutable(
629
+ import_effect8.Schema.Struct({ ...GigadriveNextPrerenderOutputFields, ...GigadriveNextPrerenderClassificationSchema.fields })
630
+ ),
631
+ import_effect8.Schema.mutable(
632
+ import_effect8.Schema.Struct({
633
+ ...GigadriveNextPrerenderOutputFields,
634
+ ...GigadriveNextPrerenderWithoutClassificationSchema.fields
635
+ })
636
+ )
572
637
  );
573
- var GigadriveNextStaticAssetPrefixSchema = import_effect7.Schema.mutable(
574
- import_effect7.Schema.Struct({
638
+ var GigadriveNextStaticAssetPrefixSchema = import_effect8.Schema.mutable(
639
+ import_effect8.Schema.Struct({
575
640
  sourceDir: PortableRelativePathSchema,
576
641
  urlPrefix: PortableRelativePathSchema,
577
- immutable: import_effect7.Schema.Boolean
642
+ immutable: import_effect8.Schema.Boolean
578
643
  })
579
644
  );
580
- var GigadriveNextServerDescriptorSchema = import_effect7.Schema.mutable(
581
- import_effect7.Schema.Struct({
582
- maxDuration: import_effect7.Schema.optional(import_effect7.Schema.Number),
583
- preferredRegion: import_effect7.Schema.optional(import_effect7.Schema.Union(import_effect7.Schema.String, StringArraySchema)),
584
- env: import_effect7.Schema.optional(StringRecordSchema)
645
+ var GigadriveNextRouteConditionSchema = import_effect8.Schema.Union(
646
+ import_effect8.Schema.mutable(
647
+ import_effect8.Schema.Struct({
648
+ type: import_effect8.Schema.Literal("header", "cookie", "query"),
649
+ key: import_effect8.Schema.String,
650
+ value: import_effect8.Schema.optional(import_effect8.Schema.String)
651
+ })
652
+ ),
653
+ import_effect8.Schema.mutable(
654
+ import_effect8.Schema.Struct({
655
+ type: import_effect8.Schema.Literal("host"),
656
+ value: import_effect8.Schema.String
657
+ })
658
+ )
659
+ );
660
+ var GigadriveNextMiddlewareMatcherSchema = import_effect8.Schema.mutable(
661
+ import_effect8.Schema.Struct({
662
+ source: import_effect8.Schema.String,
663
+ sourceRegex: import_effect8.Schema.String,
664
+ has: import_effect8.Schema.optional(import_effect8.Schema.mutable(import_effect8.Schema.Array(GigadriveNextRouteConditionSchema))),
665
+ missing: import_effect8.Schema.optional(import_effect8.Schema.mutable(import_effect8.Schema.Array(GigadriveNextRouteConditionSchema)))
585
666
  })
586
667
  );
587
- var PrerenderArraySchema = import_effect7.Schema.mutable(import_effect7.Schema.Array(GigadriveNextPrerenderOutputSchema));
588
- var StaticAssetArraySchema = import_effect7.Schema.mutable(import_effect7.Schema.Array(GigadriveNextStaticAssetPrefixSchema));
589
- var JsonValueArraySchema = import_effect7.Schema.mutable(import_effect7.Schema.Array(JsonValueSchema));
590
- var GigadriveNextBuildManifestV1Schema = import_effect7.Schema.mutable(
591
- import_effect7.Schema.Struct({
592
- version: import_effect7.Schema.Literal(1),
593
- output: import_effect7.Schema.Literal("standalone", "export"),
668
+ var GigadriveNextMiddlewareDescriptorSchema = import_effect8.Schema.Union(
669
+ import_effect8.Schema.mutable(
670
+ import_effect8.Schema.Struct({
671
+ present: import_effect8.Schema.Literal(true),
672
+ matchers: import_effect8.Schema.mutable(import_effect8.Schema.Array(GigadriveNextMiddlewareMatcherSchema))
673
+ })
674
+ ),
675
+ import_effect8.Schema.mutable(
676
+ import_effect8.Schema.Struct({
677
+ present: import_effect8.Schema.Literal(false),
678
+ matchers: import_effect8.Schema.mutable(import_effect8.Schema.Tuple())
679
+ })
680
+ )
681
+ );
682
+ var GigadriveNextServerDescriptorSchema = import_effect8.Schema.mutable(
683
+ import_effect8.Schema.Struct({
684
+ maxDuration: import_effect8.Schema.optional(import_effect8.Schema.Number),
685
+ preferredRegion: import_effect8.Schema.optional(import_effect8.Schema.Union(import_effect8.Schema.String, StringArraySchema)),
686
+ env: import_effect8.Schema.optional(StringRecordSchema)
687
+ })
688
+ );
689
+ var PrerenderArraySchema = import_effect8.Schema.mutable(import_effect8.Schema.Array(GigadriveNextPrerenderOutputSchema));
690
+ var StaticAssetArraySchema = import_effect8.Schema.mutable(import_effect8.Schema.Array(GigadriveNextStaticAssetPrefixSchema));
691
+ var JsonValueArraySchema = import_effect8.Schema.mutable(import_effect8.Schema.Array(JsonValueSchema));
692
+ var GigadriveNextPrerenderSeedMethodsSchema = import_effect8.Schema.mutable(
693
+ import_effect8.Schema.Tuple(import_effect8.Schema.Literal("GET"), import_effect8.Schema.Literal("HEAD"))
694
+ );
695
+ var GigadriveNextBuildManifestV1Schema = import_effect8.Schema.mutable(
696
+ import_effect8.Schema.Struct({
697
+ version: import_effect8.Schema.Literal(1),
698
+ output: import_effect8.Schema.Literal("standalone", "export"),
594
699
  distDir: PortableRelativePathSchema,
595
700
  repoRootToProject: RepositoryRelativePathSchema,
596
- nextVersion: import_effect7.Schema.String,
597
- buildId: import_effect7.Schema.String
701
+ nextVersion: import_effect8.Schema.String,
702
+ buildId: import_effect8.Schema.String
598
703
  })
599
704
  );
600
- var GigadriveNextBuildManifestV2ExportSchema = import_effect7.Schema.mutable(
601
- import_effect7.Schema.Struct({
602
- version: import_effect7.Schema.Literal(2),
603
- mode: import_effect7.Schema.Literal("export"),
705
+ var GigadriveNextBuildManifestV2ExportSchema = import_effect8.Schema.mutable(
706
+ import_effect8.Schema.Struct({
707
+ version: import_effect8.Schema.Literal(2),
708
+ mode: import_effect8.Schema.Literal("export"),
604
709
  distDir: PortableRelativePathSchema,
605
710
  repoRootToProject: RepositoryRelativePathSchema,
606
- nextVersion: import_effect7.Schema.String,
607
- buildId: import_effect7.Schema.String
711
+ nextVersion: import_effect8.Schema.String,
712
+ buildId: import_effect8.Schema.String
608
713
  })
609
714
  );
610
- var GigadriveNextBuildManifestV2StandaloneSchema = import_effect7.Schema.mutable(
611
- import_effect7.Schema.Struct({
612
- version: import_effect7.Schema.Literal(2),
613
- mode: import_effect7.Schema.Literal("standalone-v2"),
715
+ var GigadriveNextBuildManifestV2StandaloneSchema = import_effect8.Schema.mutable(
716
+ import_effect8.Schema.Struct({
717
+ version: import_effect8.Schema.Literal(2),
718
+ mode: import_effect8.Schema.Literal("standalone-v2"),
614
719
  distDir: PortableRelativePathSchema,
615
720
  repoRootToProject: RepositoryRelativePathSchema,
616
- nextVersion: import_effect7.Schema.String,
617
- buildId: import_effect7.Schema.String,
721
+ nextVersion: import_effect8.Schema.String,
722
+ buildId: import_effect8.Schema.String,
618
723
  server: GigadriveNextServerDescriptorSchema,
619
- config: import_effect7.Schema.mutable(
620
- import_effect7.Schema.Struct({
621
- basePath: import_effect7.Schema.String,
622
- trailingSlash: import_effect7.Schema.Boolean,
623
- cacheComponents: import_effect7.Schema.Boolean,
624
- i18n: import_effect7.Schema.optional(JsonValueSchema),
625
- images: import_effect7.Schema.optional(ImagePolicySchema)
724
+ config: import_effect8.Schema.mutable(
725
+ import_effect8.Schema.Struct({
726
+ basePath: import_effect8.Schema.String,
727
+ trailingSlash: import_effect8.Schema.Boolean,
728
+ cacheComponents: import_effect8.Schema.Boolean,
729
+ i18n: import_effect8.Schema.optional(JsonValueSchema),
730
+ images: import_effect8.Schema.optional(ImagePolicySchema)
626
731
  })
627
732
  ),
628
- routing: import_effect7.Schema.mutable(
629
- import_effect7.Schema.Struct({
733
+ routing: import_effect8.Schema.mutable(
734
+ import_effect8.Schema.Struct({
630
735
  beforeMiddleware: JsonValueArraySchema,
631
736
  beforeFiles: JsonValueArraySchema,
632
737
  afterFiles: JsonValueArraySchema,
633
738
  dynamicRoutes: JsonValueArraySchema,
634
739
  onMatch: JsonValueArraySchema,
635
740
  fallback: JsonValueArraySchema,
636
- shouldNormalizeNextData: import_effect7.Schema.Boolean,
741
+ shouldNormalizeNextData: import_effect8.Schema.Boolean,
637
742
  rsc: JsonValueSchema
638
743
  })
639
744
  ),
640
- outputs: import_effect7.Schema.mutable(
641
- import_effect7.Schema.Struct({
745
+ outputs: import_effect8.Schema.mutable(
746
+ import_effect8.Schema.Struct({
642
747
  prerenders: PrerenderArraySchema,
643
- prerenderManifest: import_effect7.Schema.optional(PortableRelativePathSchema),
644
- assetManifest: import_effect7.Schema.optional(PortableRelativePathSchema),
645
- entryPagePaths: import_effect7.Schema.optional(import_effect7.Schema.mutable(import_effect7.Schema.Array(UrlPathnameSchema))),
646
- staticAssets: StaticAssetArraySchema
748
+ prerenderManifest: import_effect8.Schema.optional(PortableRelativePathSchema),
749
+ assetManifest: import_effect8.Schema.optional(PortableRelativePathSchema),
750
+ entryPagePaths: import_effect8.Schema.optional(import_effect8.Schema.mutable(import_effect8.Schema.Array(UrlPathnameSchema))),
751
+ staticAssets: StaticAssetArraySchema,
752
+ middleware: import_effect8.Schema.optional(GigadriveNextMiddlewareDescriptorSchema)
647
753
  })
648
754
  )
649
755
  })
650
756
  );
651
- var GigadriveNextBuildManifestSchema = import_effect7.Schema.Union(
757
+ var GigadriveNextBuildManifestSchema = import_effect8.Schema.Union(
652
758
  GigadriveNextBuildManifestV1Schema,
653
759
  GigadriveNextBuildManifestV2ExportSchema,
654
760
  GigadriveNextBuildManifestV2StandaloneSchema
655
761
  );
656
- var GigadriveNextPrerenderManifestV1Schema = import_effect7.Schema.mutable(
657
- import_effect7.Schema.Struct({
658
- version: import_effect7.Schema.Literal(1),
762
+ var GigadriveNextPrerenderManifestV1Schema = import_effect8.Schema.mutable(
763
+ import_effect8.Schema.Struct({
764
+ version: import_effect8.Schema.Literal(1),
765
+ seedMethods: import_effect8.Schema.optional(GigadriveNextPrerenderSeedMethodsSchema),
659
766
  prerenders: PrerenderArraySchema
660
767
  })
661
768
  );
@@ -687,22 +794,22 @@ var AVAILABLE_REGIONS = [...REGION_DEFINITIONS];
687
794
  // src/detection/frameworks/nextjs.ts
688
795
  var toPortablePath = (value) => value.replaceAll("\\", "/");
689
796
  var STANDALONE_SERVER_MEMORY_MB = 1024;
690
- var resolveStandaloneServer = import_effect8.Effect.fn("nextjs.resolveStandaloneServer")(function* (projectFolder, distDir, repoRootToProject) {
691
- const fs = yield* import_platform5.FileSystem.FileSystem;
692
- const pathService = yield* import_platform5.Path.Path;
797
+ var resolveStandaloneServer = import_effect9.Effect.fn("nextjs.resolveStandaloneServer")(function* (projectFolder, distDir, repoRootToProject) {
798
+ const fs = yield* import_platform6.FileSystem.FileSystem;
799
+ const pathService = yield* import_platform6.Path.Path;
693
800
  const standaloneRoot = pathService.join(projectFolder, distDir, "standalone");
694
801
  const monorepoServer = pathService.join(standaloneRoot, repoRootToProject, "server.js");
695
802
  const rootServer = pathService.join(standaloneRoot, "server.js");
696
- const monorepoServerExists = yield* fs.exists(monorepoServer).pipe(import_effect8.Effect.catchAll(() => import_effect8.Effect.succeed(false)));
803
+ const monorepoServerExists = yield* fs.exists(monorepoServer).pipe(import_effect9.Effect.catchAll(() => import_effect9.Effect.succeed(false)));
697
804
  const serverPath = monorepoServerExists ? monorepoServer : rootServer;
698
- const serverExists = yield* fs.exists(serverPath).pipe(import_effect8.Effect.catchAll(() => import_effect8.Effect.succeed(false)));
805
+ const serverExists = yield* fs.exists(serverPath).pipe(import_effect9.Effect.catchAll(() => import_effect9.Effect.succeed(false)));
699
806
  if (!serverExists) return void 0;
700
807
  const serverDirectory = pathService.dirname(serverPath);
701
808
  const entrypoint = toPortablePath(pathService.relative(standaloneRoot, serverPath));
702
809
  return { standaloneRoot, serverDirectory, entrypoint };
703
810
  });
704
- var buildStandalonePublicAssets = import_effect8.Effect.fn("nextjs.buildStandalonePublicAssets")(function* (projectFolder, standaloneRoot, serverDirectory) {
705
- const pathService = yield* import_platform5.Path.Path;
811
+ var buildStandalonePublicAssets = import_effect9.Effect.fn("nextjs.buildStandalonePublicAssets")(function* (projectFolder, standaloneRoot, serverDirectory) {
812
+ const pathService = yield* import_platform6.Path.Path;
706
813
  const publicFiles = yield* getDefaultPathMap(pathService.join(projectFolder, "public"));
707
814
  const assetPaths = [];
708
815
  const assetOverrides = {};
@@ -718,8 +825,8 @@ var buildStandalonePublicAssets = import_effect8.Effect.fn("nextjs.buildStandalo
718
825
  }
719
826
  return { assetPaths, assetOverrides, filePathMap };
720
827
  });
721
- var createStaticExportConfig = import_effect8.Effect.fn("nextjs.createStaticExportConfig")(function* (defaults, projectFolder) {
722
- const pathService = yield* import_platform5.Path.Path;
828
+ var createStaticExportConfig = import_effect9.Effect.fn("nextjs.createStaticExportConfig")(function* (defaults, projectFolder) {
829
+ const pathService = yield* import_platform6.Path.Path;
723
830
  const outputDirectory = pathService.join(projectFolder, "out");
724
831
  const files = yield* getDefaultPathMap(outputDirectory);
725
832
  const assetPaths = [];
@@ -742,8 +849,8 @@ var createStaticExportConfig = import_effect8.Effect.fn("nextjs.createStaticExpo
742
849
  package: void 0
743
850
  };
744
851
  });
745
- var createStandaloneConfig = import_effect8.Effect.fn("nextjs.createStandaloneConfig")(function* (defaults, projectFolder, manifest) {
746
- const pathService = yield* import_platform5.Path.Path;
852
+ var createStandaloneConfig = import_effect9.Effect.fn("nextjs.createStandaloneConfig")(function* (defaults, projectFolder, manifest) {
853
+ const pathService = yield* import_platform6.Path.Path;
747
854
  const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);
748
855
  if (!resolved) return defaults;
749
856
  const { standaloneRoot, serverDirectory, entrypoint } = resolved;
@@ -776,7 +883,7 @@ var createStandaloneConfig = import_effect8.Effect.fn("nextjs.createStandaloneCo
776
883
  }
777
884
  };
778
885
  });
779
- var createStandaloneV2Config = import_effect8.Effect.fn("nextjs.createStandaloneV2Config")(function* (defaults, projectFolder, manifest) {
886
+ var createStandaloneV2Config = import_effect9.Effect.fn("nextjs.createStandaloneV2Config")(function* (defaults, projectFolder, manifest) {
780
887
  const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);
781
888
  if (!resolved) return defaults;
782
889
  const { standaloneRoot, serverDirectory, entrypoint } = resolved;
@@ -874,14 +981,19 @@ var nextjs = {
874
981
  streaming: true,
875
982
  commands: ["next build"],
876
983
  entrypoint: ".next/standalone/server.js",
877
- assetsDir: ".next/static",
984
+ // No `assetsDir`: this is only the fallback for a standalone build whose
985
+ // Gigadrive manifest is missing, and `.next/static` answers
986
+ // `/_next/static/...` rather than its own stripped prefix. Every path that
987
+ // resolves a real Next.js build (`refineDefaultConfig`) maps those chunks
988
+ // itself, so declaring the directory here would publish them at the wrong
989
+ // URLs.
878
990
  populateAssetCache: true,
879
991
  routes: [{ source: "/*", destination: ".next/standalone/server.js" }],
880
992
  environmentVariables: { NODE_ENV: "production" }
881
993
  }),
882
- refineDefaultConfig: (defaults, projectFolder) => import_effect8.Effect.gen(function* () {
883
- const fs = yield* import_platform5.FileSystem.FileSystem;
884
- const manifestContent = yield* fs.readFileString(`${projectFolder}/.gigadrive/nextjs.json`).pipe(import_effect8.Effect.catchAll(() => import_effect8.Effect.succeed(void 0)));
994
+ refineDefaultConfig: (defaults, projectFolder) => import_effect9.Effect.gen(function* () {
995
+ const fs = yield* import_platform6.FileSystem.FileSystem;
996
+ const manifestContent = yield* fs.readFileString(`${projectFolder}/.gigadrive/nextjs.json`).pipe(import_effect9.Effect.catchAll(() => import_effect9.Effect.succeed(void 0)));
885
997
  const manifest = manifestContent ? parseGigadriveNextBuildManifest(manifestContent) : void 0;
886
998
  if (!manifest) return defaults;
887
999
  if (manifest.version === 2) {
@@ -892,8 +1004,8 @@ var nextjs = {
892
1004
  };
893
1005
 
894
1006
  // src/detection/frameworks/nuxt.ts
895
- var import_platform6 = require("@effect/platform");
896
- var import_effect9 = require("effect");
1007
+ var import_platform7 = require("@effect/platform");
1008
+ var import_effect10 = require("effect");
897
1009
  var isVercelBuildOutputV3 = (content) => {
898
1010
  try {
899
1011
  const config = JSON.parse(content);
@@ -920,9 +1032,9 @@ var nuxt = {
920
1032
  routes: [{ source: "/*", destination: ".output/server/index.mjs" }],
921
1033
  environmentVariables: { NODE_ENV: "production", NITRO_PRESET: "node-server" }
922
1034
  }),
923
- refineDefaultConfig: (defaults, projectFolder) => import_effect9.Effect.gen(function* () {
924
- const fs = yield* import_platform6.FileSystem.FileSystem;
925
- const buildOutputConfig = yield* fs.readFileString(`${projectFolder}/.vercel/output/config.json`).pipe(import_effect9.Effect.catchAll(() => import_effect9.Effect.succeed(void 0)));
1035
+ refineDefaultConfig: (defaults, projectFolder) => import_effect10.Effect.gen(function* () {
1036
+ const fs = yield* import_platform7.FileSystem.FileSystem;
1037
+ const buildOutputConfig = yield* fs.readFileString(`${projectFolder}/.vercel/output/config.json`).pipe(import_effect10.Effect.catchAll(() => import_effect10.Effect.succeed(void 0)));
926
1038
  if (!buildOutputConfig || !isVercelBuildOutputV3(buildOutputConfig)) {
927
1039
  return defaults;
928
1040
  }
@@ -1045,7 +1157,7 @@ var FRAMEWORK_DEFINITIONS = [
1045
1157
  ].sort((a, b) => b.priority - a.priority);
1046
1158
 
1047
1159
  // src/detection/generate-config.ts
1048
- var import_effect10 = require("effect");
1160
+ var import_effect11 = require("effect");
1049
1161
  var getInstallCommand = (pm) => {
1050
1162
  switch (pm) {
1051
1163
  case "bun":
@@ -1061,11 +1173,11 @@ var getInstallCommand = (pm) => {
1061
1173
  return "npm install";
1062
1174
  }
1063
1175
  };
1064
- var generateConfig = import_effect10.Effect.fn("generateConfig")(function* (framework, packageManager, refinedDefaults) {
1176
+ var generateConfig = import_effect11.Effect.fn("generateConfig")(function* (framework, packageManager, projectFolder, refinedDefaults) {
1065
1177
  const defaults = refinedDefaults ?? framework.getDefaultConfig(packageManager);
1066
1178
  const installCmd = defaults.installCommand ?? getInstallCommand(packageManager);
1067
1179
  const commands = [installCmd, ...defaults.commands];
1068
- yield* import_effect10.Effect.logDebug(`Generating config for ${framework.name}`, {
1180
+ yield* import_effect11.Effect.logDebug(`Generating config for ${framework.name}`, {
1069
1181
  runtime: defaults.runtime,
1070
1182
  entrypoint: defaults.entrypoint,
1071
1183
  commands
@@ -1100,10 +1212,26 @@ var generateConfig = import_effect10.Effect.fn("generateConfig")(function* (fram
1100
1212
  ...defaults.normalizedConfig
1101
1213
  };
1102
1214
  if (defaults.assetsDir || defaults.assetPaths || defaults.assetPrefixes || defaults.assetManifests) {
1215
+ const paths = defaults.assetPaths ? [...defaults.assetPaths] : [];
1216
+ const overrides = { ...defaults.assetOverrides };
1217
+ const servesDirectoryIndexes = entrypoints.length === 0 && routes.length === 0;
1218
+ const assetsDir = defaults.assetsDir;
1219
+ if (assetsDir && !defaults.assetPaths && !defaults.assetPrefixes && !defaults.assetManifests) {
1220
+ for (const file of yield* collectAssetFiles(projectFolder, assetsDir)) {
1221
+ if (framework.language === "php" && /\.(php|phtml|phar)$/i.test(file)) continue;
1222
+ paths.push(`${assetsDir}/${file}`);
1223
+ if (!servesDirectoryIndexes || file in overrides) continue;
1224
+ if (file === "index.html") {
1225
+ overrides[file] = { path: "" };
1226
+ } else if (file.endsWith("/index.html")) {
1227
+ overrides[file] = { path: file.slice(0, -"/index.html".length) };
1228
+ }
1229
+ }
1230
+ }
1103
1231
  config.assets = {
1104
- paths: defaults.assetPaths ? [...defaults.assetPaths] : [],
1232
+ paths,
1105
1233
  prefixToStrip: defaults.assetsPrefixToStrip ?? (defaults.assetsDir ? defaults.assetsDir + "/" : ""),
1106
- overrides: defaults.assetOverrides ? { ...defaults.assetOverrides } : void 0,
1234
+ overrides: Object.keys(overrides).length > 0 ? overrides : void 0,
1107
1235
  prefixes: defaults.assetPrefixes ? defaults.assetPrefixes.map((prefix) => ({ ...prefix })) : void 0,
1108
1236
  manifests: defaults.assetManifests ? defaults.assetManifests.map((manifest) => ({ ...manifest })) : void 0,
1109
1237
  dynamicRoutes: true,
@@ -1114,31 +1242,31 @@ var generateConfig = import_effect10.Effect.fn("generateConfig")(function* (fram
1114
1242
  });
1115
1243
 
1116
1244
  // src/detection/read-dependencies.ts
1117
- var import_platform7 = require("@effect/platform");
1118
- var import_effect12 = require("effect");
1245
+ var import_platform8 = require("@effect/platform");
1246
+ var import_effect13 = require("effect");
1119
1247
 
1120
1248
  // src/detection/types.ts
1121
- var import_effect11 = require("effect");
1122
- var ManifestNotFoundError = class extends import_effect11.Schema.TaggedError()("ManifestNotFoundError", {
1123
- message: import_effect11.Schema.String,
1124
- filePath: import_effect11.Schema.String
1249
+ var import_effect12 = require("effect");
1250
+ var ManifestNotFoundError = class extends import_effect12.Schema.TaggedError()("ManifestNotFoundError", {
1251
+ message: import_effect12.Schema.String,
1252
+ filePath: import_effect12.Schema.String
1125
1253
  }) {
1126
1254
  };
1127
- var ManifestReadError = class extends import_effect11.Schema.TaggedError()("ManifestReadError", {
1128
- message: import_effect11.Schema.String,
1129
- filePath: import_effect11.Schema.String
1255
+ var ManifestReadError = class extends import_effect12.Schema.TaggedError()("ManifestReadError", {
1256
+ message: import_effect12.Schema.String,
1257
+ filePath: import_effect12.Schema.String
1130
1258
  }) {
1131
1259
  };
1132
- var ManifestParseError = class extends import_effect11.Schema.TaggedError()("ManifestParseError", {
1133
- message: import_effect11.Schema.String,
1134
- filePath: import_effect11.Schema.String
1260
+ var ManifestParseError = class extends import_effect12.Schema.TaggedError()("ManifestParseError", {
1261
+ message: import_effect12.Schema.String,
1262
+ filePath: import_effect12.Schema.String
1135
1263
  }) {
1136
1264
  };
1137
- var FrameworkNotDetectedError = class extends import_effect11.Schema.TaggedError()(
1265
+ var FrameworkNotDetectedError = class extends import_effect12.Schema.TaggedError()(
1138
1266
  "FrameworkNotDetectedError",
1139
1267
  {
1140
- message: import_effect11.Schema.String,
1141
- directory: import_effect11.Schema.String
1268
+ message: import_effect12.Schema.String,
1269
+ directory: import_effect12.Schema.String
1142
1270
  }
1143
1271
  ) {
1144
1272
  };
@@ -1148,25 +1276,25 @@ var MANIFEST_CONFIG = {
1148
1276
  node: { file: "package.json", depKeys: ["dependencies", "devDependencies"] },
1149
1277
  php: { file: "composer.json", depKeys: ["require", "require-dev"] }
1150
1278
  };
1151
- var readManifest = import_effect12.Effect.fn("readManifest")(function* (filePath) {
1152
- const fs = yield* import_platform7.FileSystem.FileSystem;
1153
- const exists = yield* fs.exists(filePath).pipe(import_effect12.Effect.catchAll(() => import_effect12.Effect.succeed(false)));
1279
+ var readManifest = import_effect13.Effect.fn("readManifest")(function* (filePath) {
1280
+ const fs = yield* import_platform8.FileSystem.FileSystem;
1281
+ const exists = yield* fs.exists(filePath).pipe(import_effect13.Effect.catchAll(() => import_effect13.Effect.succeed(false)));
1154
1282
  if (!exists) {
1155
- return yield* import_effect12.Effect.fail(new ManifestNotFoundError({ message: "Manifest not found", filePath }));
1283
+ return yield* import_effect13.Effect.fail(new ManifestNotFoundError({ message: "Manifest not found", filePath }));
1156
1284
  }
1157
- const content = yield* fs.readFileString(filePath).pipe(import_effect12.Effect.mapError(() => new ManifestReadError({ message: "Failed to read manifest", filePath })));
1158
- const parsed = yield* import_effect12.Effect.try({
1285
+ const content = yield* fs.readFileString(filePath).pipe(import_effect13.Effect.mapError(() => new ManifestReadError({ message: "Failed to read manifest", filePath })));
1286
+ const parsed = yield* import_effect13.Effect.try({
1159
1287
  try: () => JSON.parse(content),
1160
1288
  catch: () => new ManifestParseError({ message: "Failed to parse manifest JSON", filePath })
1161
1289
  });
1162
1290
  return parsed;
1163
1291
  });
1164
- var readDependencies = import_effect12.Effect.fn("readDependencies")(function* (projectFolder, language) {
1165
- const pathService = yield* import_platform7.Path.Path;
1292
+ var readDependencies = import_effect13.Effect.fn("readDependencies")(function* (projectFolder, language) {
1293
+ const pathService = yield* import_platform8.Path.Path;
1166
1294
  const config = MANIFEST_CONFIG[language];
1167
1295
  const filePath = pathService.join(projectFolder, config.file);
1168
1296
  const manifest = yield* readManifest(filePath).pipe(
1169
- import_effect12.Effect.catchTag("ManifestNotFoundError", () => import_effect12.Effect.succeed(null))
1297
+ import_effect13.Effect.catchTag("ManifestNotFoundError", () => import_effect13.Effect.succeed(null))
1170
1298
  );
1171
1299
  if (!manifest) {
1172
1300
  return /* @__PURE__ */ new Set();
@@ -1184,9 +1312,9 @@ var readDependencies = import_effect12.Effect.fn("readDependencies")(function* (
1184
1312
  });
1185
1313
 
1186
1314
  // src/detection/detect-framework.ts
1187
- var matchesDetectionItem = import_effect13.Effect.fn("matchesDetectionItem")(function* (item, projectFolder, framework, cachedReadDeps) {
1188
- const fs = yield* import_platform8.FileSystem.FileSystem;
1189
- const pathService = yield* import_platform8.Path.Path;
1315
+ var matchesDetectionItem = import_effect14.Effect.fn("matchesDetectionItem")(function* (item, projectFolder, framework, cachedReadDeps) {
1316
+ const fs = yield* import_platform9.FileSystem.FileSystem;
1317
+ const pathService = yield* import_platform9.Path.Path;
1190
1318
  if (item.matchPackage != null) {
1191
1319
  const deps = yield* cachedReadDeps(`${projectFolder}\0${framework.language}`);
1192
1320
  if (!deps.has(item.matchPackage)) {
@@ -1195,12 +1323,12 @@ var matchesDetectionItem = import_effect13.Effect.fn("matchesDetectionItem")(fun
1195
1323
  }
1196
1324
  if (item.path != null) {
1197
1325
  const filePath = pathService.join(projectFolder, item.path);
1198
- const exists = yield* fs.exists(filePath).pipe(import_effect13.Effect.catchAll(() => import_effect13.Effect.succeed(false)));
1326
+ const exists = yield* fs.exists(filePath).pipe(import_effect14.Effect.catchAll(() => import_effect14.Effect.succeed(false)));
1199
1327
  if (!exists) {
1200
1328
  return false;
1201
1329
  }
1202
1330
  if (item.matchContent != null) {
1203
- const content = yield* fs.readFileString(filePath).pipe(import_effect13.Effect.catchAll(() => import_effect13.Effect.succeed("")));
1331
+ const content = yield* fs.readFileString(filePath).pipe(import_effect14.Effect.catchAll(() => import_effect14.Effect.succeed("")));
1204
1332
  let regexMatch = false;
1205
1333
  try {
1206
1334
  regexMatch = new RegExp(item.matchContent).test(content);
@@ -1213,7 +1341,7 @@ var matchesDetectionItem = import_effect13.Effect.fn("matchesDetectionItem")(fun
1213
1341
  }
1214
1342
  return true;
1215
1343
  });
1216
- var matchesFramework = import_effect13.Effect.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
1344
+ var matchesFramework = import_effect14.Effect.fn("matchesFramework")(function* (framework, projectFolder, cachedReadDeps) {
1217
1345
  for (const detector of framework.detectors) {
1218
1346
  const matches = yield* matchesDetectionItem(detector, projectFolder, framework, cachedReadDeps);
1219
1347
  if (!matches) {
@@ -1222,9 +1350,9 @@ var matchesFramework = import_effect13.Effect.fn("matchesFramework")(function* (
1222
1350
  }
1223
1351
  return true;
1224
1352
  });
1225
- var detectFramework = import_effect13.Effect.fn("detectFramework")(function* (projectFolder) {
1226
- yield* import_effect13.Effect.logDebug(`Detecting framework in ${projectFolder}`);
1227
- const cachedReadDeps = yield* import_effect13.Effect.cachedFunction((key) => {
1353
+ var detectFramework = import_effect14.Effect.fn("detectFramework")(function* (projectFolder) {
1354
+ yield* import_effect14.Effect.logDebug(`Detecting framework in ${projectFolder}`);
1355
+ const cachedReadDeps = yield* import_effect14.Effect.cachedFunction((key) => {
1228
1356
  const sepIndex = key.lastIndexOf("\0");
1229
1357
  const folder = key.slice(0, sepIndex);
1230
1358
  const language = key.slice(sepIndex + 1);
@@ -1233,16 +1361,16 @@ var detectFramework = import_effect13.Effect.fn("detectFramework")(function* (pr
1233
1361
  for (const framework of FRAMEWORK_DEFINITIONS) {
1234
1362
  const matches = yield* matchesFramework(framework, projectFolder, cachedReadDeps);
1235
1363
  if (matches) {
1236
- yield* import_effect13.Effect.log(`Detected framework: ${framework.name}`, { slug: framework.slug });
1364
+ yield* import_effect14.Effect.log(`Detected framework: ${framework.name}`, { slug: framework.slug });
1237
1365
  const detectedPackageManager = yield* detectPackageManager(projectFolder);
1238
1366
  const packageManager = framework.language === "php" ? "composer" : detectedPackageManager;
1239
1367
  const defaults = framework.getDefaultConfig(packageManager);
1240
1368
  const refinedDefaults = framework.refineDefaultConfig ? yield* framework.refineDefaultConfig(defaults, projectFolder) : defaults;
1241
- const config = yield* generateConfig(framework, packageManager, refinedDefaults);
1369
+ const config = yield* generateConfig(framework, packageManager, projectFolder, refinedDefaults);
1242
1370
  return { framework, packageManager, config };
1243
1371
  }
1244
1372
  }
1245
- return yield* import_effect13.Effect.fail(
1373
+ return yield* import_effect14.Effect.fail(
1246
1374
  new FrameworkNotDetectedError({
1247
1375
  message: `No framework detected in project directory`,
1248
1376
  directory: projectFolder
@@ -1251,9 +1379,9 @@ var detectFramework = import_effect13.Effect.fn("detectFramework")(function* (pr
1251
1379
  });
1252
1380
 
1253
1381
  // src/detection/merge-config.ts
1254
- var import_effect14 = require("effect");
1255
- var mergeWithFrameworkDefaults = import_effect14.Effect.fn("mergeWithFrameworkDefaults")(function* (userConfig, frameworkConfig) {
1256
- yield* import_effect14.Effect.logDebug("Merging user config with framework defaults");
1382
+ var import_effect15 = require("effect");
1383
+ var mergeWithFrameworkDefaults = import_effect15.Effect.fn("mergeWithFrameworkDefaults")(function* (userConfig, frameworkConfig) {
1384
+ yield* import_effect15.Effect.logDebug("Merging user config with framework defaults");
1257
1385
  const userHasAssets = (userConfig.assets?.paths?.length ?? 0) > 0 || (userConfig.assets?.prefixes?.length ?? 0) > 0 || (userConfig.assets?.manifests?.length ?? 0) > 0;
1258
1386
  const merged = {
1259
1387
  regions: userConfig.regions,
@@ -1275,47 +1403,47 @@ var mergeWithFrameworkDefaults = import_effect14.Effect.fn("mergeWithFrameworkDe
1275
1403
  });
1276
1404
 
1277
1405
  // src/errors.ts
1278
- var import_effect15 = require("effect");
1279
- var ConfigFileNotFoundError = class extends import_effect15.Schema.TaggedError()("ConfigFileNotFoundError", {
1280
- message: import_effect15.Schema.String,
1281
- filePath: import_effect15.Schema.String
1406
+ var import_effect16 = require("effect");
1407
+ var ConfigFileNotFoundError = class extends import_effect16.Schema.TaggedError()("ConfigFileNotFoundError", {
1408
+ message: import_effect16.Schema.String,
1409
+ filePath: import_effect16.Schema.String
1282
1410
  }) {
1283
1411
  };
1284
- var ConfigFileEmptyError = class extends import_effect15.Schema.TaggedError()("ConfigFileEmptyError", {
1285
- message: import_effect15.Schema.String,
1286
- filePath: import_effect15.Schema.String
1412
+ var ConfigFileEmptyError = class extends import_effect16.Schema.TaggedError()("ConfigFileEmptyError", {
1413
+ message: import_effect16.Schema.String,
1414
+ filePath: import_effect16.Schema.String
1287
1415
  }) {
1288
1416
  };
1289
- var ConfigFileParseError = class extends import_effect15.Schema.TaggedError()("ConfigFileParseError", {
1290
- message: import_effect15.Schema.String,
1291
- filePath: import_effect15.Schema.String,
1292
- cause: import_effect15.Schema.optional(import_effect15.Schema.String)
1417
+ var ConfigFileParseError = class extends import_effect16.Schema.TaggedError()("ConfigFileParseError", {
1418
+ message: import_effect16.Schema.String,
1419
+ filePath: import_effect16.Schema.String,
1420
+ cause: import_effect16.Schema.optional(import_effect16.Schema.String)
1293
1421
  }) {
1294
1422
  };
1295
- var ConfigModuleLoadError = class extends import_effect15.Schema.TaggedError()("ConfigModuleLoadError", {
1296
- message: import_effect15.Schema.String,
1297
- filePath: import_effect15.Schema.String,
1298
- cause: import_effect15.Schema.optional(import_effect15.Schema.String)
1423
+ var ConfigModuleLoadError = class extends import_effect16.Schema.TaggedError()("ConfigModuleLoadError", {
1424
+ message: import_effect16.Schema.String,
1425
+ filePath: import_effect16.Schema.String,
1426
+ cause: import_effect16.Schema.optional(import_effect16.Schema.String)
1299
1427
  }) {
1300
1428
  };
1301
- var ConfigVersionError = class extends import_effect15.Schema.TaggedError()("ConfigVersionError", {
1302
- message: import_effect15.Schema.String,
1303
- filePath: import_effect15.Schema.String,
1304
- version: import_effect15.Schema.optional(import_effect15.Schema.Number)
1429
+ var ConfigVersionError = class extends import_effect16.Schema.TaggedError()("ConfigVersionError", {
1430
+ message: import_effect16.Schema.String,
1431
+ filePath: import_effect16.Schema.String,
1432
+ version: import_effect16.Schema.optional(import_effect16.Schema.Number)
1305
1433
  }) {
1306
1434
  };
1307
- var ConfigSchemaValidationError = class extends import_effect15.Schema.TaggedError()(
1435
+ var ConfigSchemaValidationError = class extends import_effect16.Schema.TaggedError()(
1308
1436
  "ConfigSchemaValidationError",
1309
1437
  {
1310
- message: import_effect15.Schema.String,
1311
- filePath: import_effect15.Schema.String,
1312
- validationErrors: import_effect15.Schema.Array(import_effect15.Schema.String)
1438
+ message: import_effect16.Schema.String,
1439
+ filePath: import_effect16.Schema.String,
1440
+ validationErrors: import_effect16.Schema.Array(import_effect16.Schema.String)
1313
1441
  }
1314
1442
  ) {
1315
1443
  };
1316
- var FunctionConfigError = class extends import_effect15.Schema.TaggedError()("FunctionConfigError", {
1317
- message: import_effect15.Schema.String,
1318
- functionPath: import_effect15.Schema.String
1444
+ var FunctionConfigError = class extends import_effect16.Schema.TaggedError()("FunctionConfigError", {
1445
+ message: import_effect16.Schema.String,
1446
+ functionPath: import_effect16.Schema.String
1319
1447
  }) {
1320
1448
  };
1321
1449
 
@@ -1335,23 +1463,23 @@ var DEFAULT_FUNCTION_DURATION_SECONDS = 30;
1335
1463
  var MAX_FUNCTION_DURATION_SECONDS = 28800;
1336
1464
 
1337
1465
  // src/parse-config.ts
1338
- var import_effect21 = require("effect");
1466
+ var import_effect22 = require("effect");
1339
1467
 
1340
1468
  // src/services/raw-config-reader.ts
1341
- var import_platform9 = require("@effect/platform");
1342
- var import_effect17 = require("effect");
1469
+ var import_platform10 = require("@effect/platform");
1470
+ var import_effect18 = require("effect");
1343
1471
  var import_yaml = require("yaml");
1344
1472
 
1345
1473
  // src/services/config-module-loader.ts
1346
- var import_effect16 = require("effect");
1474
+ var import_effect17 = require("effect");
1347
1475
  var import_jiti = require("jiti");
1348
1476
  var MISSING_DEFAULT_EXPORT = /* @__PURE__ */ Symbol("MissingDefaultExport");
1349
1477
  var STRICT_DEFAULT_EXPORT_EXTENSIONS = [".ts", ".mts", ".mjs"];
1350
- var ConfigModuleLoader = class extends import_effect16.Effect.Service()("ConfigModuleLoader", {
1351
- effect: import_effect16.Effect.gen(function* () {
1352
- const loadConfigModule = import_effect16.Effect.fn("ConfigModuleLoader.loadConfigModule")(function* (filePath) {
1478
+ var ConfigModuleLoader = class extends import_effect17.Effect.Service()("ConfigModuleLoader", {
1479
+ effect: import_effect17.Effect.gen(function* () {
1480
+ const loadConfigModule = import_effect17.Effect.fn("ConfigModuleLoader.loadConfigModule")(function* (filePath) {
1353
1481
  const extension = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
1354
- const mod = yield* import_effect16.Effect.tryPromise({
1482
+ const mod = yield* import_effect17.Effect.tryPromise({
1355
1483
  try: async () => {
1356
1484
  const jiti = (0, import_jiti.createJiti)(filePath, { fsCache: false, interopDefault: true, moduleCache: false });
1357
1485
  const namespace = await jiti.import(filePath);
@@ -1370,7 +1498,7 @@ var ConfigModuleLoader = class extends import_effect16.Effect.Service()("ConfigM
1370
1498
  })
1371
1499
  });
1372
1500
  if (mod === MISSING_DEFAULT_EXPORT) {
1373
- return yield* import_effect16.Effect.fail(
1501
+ return yield* import_effect17.Effect.fail(
1374
1502
  new ConfigModuleLoadError({
1375
1503
  message: `Config module at ${filePath} does not have a default export. Export the config object as the default export (or via module.exports for CommonJS files), optionally wrapped in defineConfig.`,
1376
1504
  filePath
@@ -1378,7 +1506,7 @@ var ConfigModuleLoader = class extends import_effect16.Effect.Service()("ConfigM
1378
1506
  );
1379
1507
  }
1380
1508
  if (typeof mod === "function") {
1381
- return yield* import_effect16.Effect.fail(
1509
+ return yield* import_effect17.Effect.fail(
1382
1510
  new ConfigModuleLoadError({
1383
1511
  message: `Config module at ${filePath} default-exports a function; config factories are not supported. Export a config object instead (optionally wrapped in defineConfig).`,
1384
1512
  filePath
@@ -1386,7 +1514,7 @@ var ConfigModuleLoader = class extends import_effect16.Effect.Service()("ConfigM
1386
1514
  );
1387
1515
  }
1388
1516
  if (typeof mod !== "object" || mod === null || Array.isArray(mod)) {
1389
- return yield* import_effect16.Effect.fail(
1517
+ return yield* import_effect17.Effect.fail(
1390
1518
  new ConfigModuleLoadError({
1391
1519
  message: `Config module at ${filePath} must default-export a config object.`,
1392
1520
  filePath
@@ -1416,36 +1544,36 @@ var ALLOWED_CONFIG_NAMES = [
1416
1544
  "nebula.json"
1417
1545
  ];
1418
1546
  var MODULE_EXTENSIONS = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"];
1419
- var RawConfigReader = class extends import_effect17.Effect.Service()("RawConfigReader", {
1547
+ var RawConfigReader = class extends import_effect18.Effect.Service()("RawConfigReader", {
1420
1548
  dependencies: [ConfigModuleLoader.Default],
1421
- effect: import_effect17.Effect.gen(function* () {
1422
- const fs = yield* import_platform9.FileSystem.FileSystem;
1423
- const pathService = yield* import_platform9.Path.Path;
1549
+ effect: import_effect18.Effect.gen(function* () {
1550
+ const fs = yield* import_platform10.FileSystem.FileSystem;
1551
+ const pathService = yield* import_platform10.Path.Path;
1424
1552
  const moduleLoader = yield* ConfigModuleLoader;
1425
- const findConfig = import_effect17.Effect.fn("RawConfigReader.findConfig")(function* (projectFolder) {
1553
+ const findConfig = import_effect18.Effect.fn("RawConfigReader.findConfig")(function* (projectFolder) {
1426
1554
  for (const name of ALLOWED_CONFIG_NAMES) {
1427
1555
  const filePath = pathService.join(projectFolder, name);
1428
- const exists = yield* fs.exists(filePath).pipe(import_effect17.Effect.catchAll(() => import_effect17.Effect.succeed(false)));
1556
+ const exists = yield* fs.exists(filePath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed(false)));
1429
1557
  if (exists) {
1430
1558
  return filePath;
1431
1559
  }
1432
1560
  }
1433
1561
  return null;
1434
1562
  });
1435
- const readRawConfig = import_effect17.Effect.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
1436
- const exists = yield* fs.exists(filePath).pipe(import_effect17.Effect.catchAll(() => import_effect17.Effect.succeed(false)));
1563
+ const readRawConfig = import_effect18.Effect.fn("RawConfigReader.readRawConfig")(function* (filePath, options) {
1564
+ const exists = yield* fs.exists(filePath).pipe(import_effect18.Effect.catchAll(() => import_effect18.Effect.succeed(false)));
1437
1565
  if (!exists) {
1438
- return yield* import_effect17.Effect.fail(
1566
+ return yield* import_effect18.Effect.fail(
1439
1567
  new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })
1440
1568
  );
1441
1569
  }
1442
1570
  const fileContents = yield* fs.readFileString(filePath).pipe(
1443
- import_effect17.Effect.mapError(
1571
+ import_effect18.Effect.mapError(
1444
1572
  () => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })
1445
1573
  )
1446
1574
  );
1447
1575
  if (fileContents.length === 0) {
1448
- return yield* import_effect17.Effect.fail(
1576
+ return yield* import_effect18.Effect.fail(
1449
1577
  new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })
1450
1578
  );
1451
1579
  }
@@ -1461,7 +1589,7 @@ var RawConfigReader = class extends import_effect17.Effect.Service()("RawConfigR
1461
1589
  parsed = (0, import_yaml.parse)(fileContents);
1462
1590
  }
1463
1591
  } catch (error) {
1464
- return yield* import_effect17.Effect.fail(
1592
+ return yield* import_effect18.Effect.fail(
1465
1593
  new ConfigFileParseError({
1466
1594
  message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`,
1467
1595
  filePath,
@@ -1471,21 +1599,21 @@ var RawConfigReader = class extends import_effect17.Effect.Service()("RawConfigR
1471
1599
  }
1472
1600
  }
1473
1601
  if (parsed == null) {
1474
- return yield* import_effect17.Effect.fail(
1602
+ return yield* import_effect18.Effect.fail(
1475
1603
  new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })
1476
1604
  );
1477
1605
  }
1478
1606
  if (!options?.disableVersionCheck && typeof parsed.version !== "number") {
1479
- return yield* import_effect17.Effect.fail(
1607
+ return yield* import_effect18.Effect.fail(
1480
1608
  new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })
1481
1609
  );
1482
1610
  }
1483
1611
  return parsed;
1484
1612
  });
1485
1613
  const readConfigFile = (configFilePath) => readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(
1486
- import_effect17.Effect.map((parsed) => parsed),
1487
- import_effect17.Effect.catchTag("ConfigFileNotFoundError", () => import_effect17.Effect.succeed(null)),
1488
- import_effect17.Effect.withSpan("RawConfigReader.readConfigFile")
1614
+ import_effect18.Effect.map((parsed) => parsed),
1615
+ import_effect18.Effect.catchTag("ConfigFileNotFoundError", () => import_effect18.Effect.succeed(null)),
1616
+ import_effect18.Effect.withSpan("RawConfigReader.readConfigFile")
1489
1617
  );
1490
1618
  return { findConfig, readRawConfig, readConfigFile };
1491
1619
  })
@@ -1495,17 +1623,17 @@ var RawConfigReader = class extends import_effect17.Effect.Service()("RawConfigR
1495
1623
  // src/services/schema-validator.ts
1496
1624
  var import_ajv = __toESM(require("ajv"));
1497
1625
  var import_ajv_formats = __toESM(require("ajv-formats"));
1498
- var import_effect18 = require("effect");
1499
- var SchemaValidator = class extends import_effect18.Effect.Service()("SchemaValidator", {
1500
- effect: import_effect18.Effect.gen(function* () {
1626
+ var import_effect19 = require("effect");
1627
+ var SchemaValidator = class extends import_effect19.Effect.Service()("SchemaValidator", {
1628
+ effect: import_effect19.Effect.gen(function* () {
1501
1629
  const ajv = new import_ajv.default();
1502
1630
  (0, import_ajv_formats.default)(ajv);
1503
- const validate = import_effect18.Effect.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
1631
+ const validate = import_effect19.Effect.fn("SchemaValidator.validate")(function* (config, schema, filePath) {
1504
1632
  const compiledValidate = ajv.compile(schema);
1505
1633
  const valid = compiledValidate(config);
1506
1634
  if (!valid) {
1507
1635
  const errors = compiledValidate.errors?.map((e) => `${e.instancePath || "/"} ${e.message ?? ""}`.trim()) ?? [];
1508
- return yield* import_effect18.Effect.fail(
1636
+ return yield* import_effect19.Effect.fail(
1509
1637
  new ConfigSchemaValidationError({
1510
1638
  message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,
1511
1639
  filePath,
@@ -1519,14 +1647,51 @@ var SchemaValidator = class extends import_effect18.Effect.Service()("SchemaVali
1519
1647
  }) {
1520
1648
  };
1521
1649
 
1522
- // src/services/v4-config-parser.ts
1523
- var import_platform10 = require("@effect/platform");
1524
- var import_build_utils = require("@gigadrive/build-utils");
1525
- var import_effect19 = require("effect");
1650
+ // ../build-utils/src/get-files-for-pattern.ts
1526
1651
  var import_minimatch = require("minimatch");
1652
+ var import_promises = require("fs/promises");
1653
+ var getFilesForPattern = async (pattern, projectFolder, excludeFiles = []) => {
1654
+ const files = [];
1655
+ const filesInFolder = await (0, import_promises.readdir)(projectFolder, { recursive: true });
1656
+ const exactFiles = new Set(filesInFolder.filter((file) => typeof file === "string"));
1657
+ let regex = null;
1658
+ if (!exactFiles.has(pattern)) {
1659
+ try {
1660
+ regex = new RegExp(`^(?:${pattern})$`);
1661
+ } catch {
1662
+ }
1663
+ }
1664
+ const finalExclusions = Array.isArray(excludeFiles) ? excludeFiles : [excludeFiles];
1665
+ for (const file of filesInFolder) {
1666
+ if (typeof file !== "string") {
1667
+ continue;
1668
+ }
1669
+ if (finalExclusions.some((excludeFile) => {
1670
+ if ((0, import_minimatch.minimatch)(file, excludeFile)) {
1671
+ return true;
1672
+ }
1673
+ if (!exactFiles.has(excludeFile)) {
1674
+ try {
1675
+ return new RegExp(`^(?:${excludeFile})$`).test(file);
1676
+ } catch {
1677
+ return false;
1678
+ }
1679
+ }
1680
+ return false;
1681
+ })) {
1682
+ continue;
1683
+ }
1684
+ if ((0, import_minimatch.minimatch)(file, pattern) || regex != null && regex.test(file)) {
1685
+ files.push(file);
1686
+ }
1687
+ }
1688
+ return files;
1689
+ };
1690
+
1691
+ // src/services/v4-config-parser.ts
1692
+ var import_effect20 = require("effect");
1693
+ var import_minimatch2 = require("minimatch");
1527
1694
  var import_safe_regex2 = __toESM(require("safe-regex2"));
1528
- var MAX_ASSET_DEPTH = 100;
1529
- var DISALLOWED_ASSET_EXTENSIONS = [".htaccess", ".htpasswd"];
1530
1695
  var DEFAULT_FUNCTION_SETTINGS = {
1531
1696
  memory: 128,
1532
1697
  max_duration: DEFAULT_FUNCTION_DURATION_SECONDS,
@@ -1588,7 +1753,7 @@ var destinationMatchesEntrypoint = (destination, entrypointPath) => {
1588
1753
  return new RegExp(`^${pattern}$`).test(entrypointPath);
1589
1754
  };
1590
1755
  var matchesPattern = (path2, pattern) => {
1591
- if ((0, import_minimatch.minimatch)(path2, pattern)) return true;
1756
+ if ((0, import_minimatch2.minimatch)(path2, pattern)) return true;
1592
1757
  try {
1593
1758
  if ((0, import_safe_regex2.default)(pattern)) {
1594
1759
  return new RegExp(pattern).test(path2);
@@ -1628,7 +1793,7 @@ var mapRoute = (route, entrypoints) => ({
1628
1793
  negativeRequirements: route.missing,
1629
1794
  status: route.statusCode
1630
1795
  });
1631
- var parseEntrypoints = import_effect19.Effect.fn("parseEntrypoints")(function* (config, projectFolder) {
1796
+ var parseEntrypoints = import_effect20.Effect.fn("parseEntrypoints")(function* (config, projectFolder) {
1632
1797
  const entrypoints = [];
1633
1798
  if (config.functions == null) return entrypoints;
1634
1799
  for (const [fnPath, func] of Object.entries(config.functions)) {
@@ -1638,8 +1803,8 @@ var parseEntrypoints = import_effect19.Effect.fn("parseEntrypoints")(function* (
1638
1803
  functionPath: fnPath
1639
1804
  });
1640
1805
  }
1641
- const matchedFiles = yield* import_effect19.Effect.tryPromise({
1642
- try: () => (0, import_build_utils.getFilesForPattern)(fnPath, projectFolder, func.excludeFiles),
1806
+ const matchedFiles = yield* import_effect20.Effect.tryPromise({
1807
+ try: () => getFilesForPattern(fnPath, projectFolder, func.excludeFiles),
1643
1808
  catch: (error) => new FunctionConfigError({
1644
1809
  message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,
1645
1810
  functionPath: fnPath
@@ -1674,57 +1839,21 @@ var parseEntrypoints = import_effect19.Effect.fn("parseEntrypoints")(function* (
1674
1839
  }
1675
1840
  return entrypoints;
1676
1841
  });
1677
- var collectAssets = import_effect19.Effect.fn("collectAssets")(function* (config, projectFolder) {
1842
+ var collectAssets = import_effect20.Effect.fn("collectAssets")(function* (config, projectFolder) {
1678
1843
  if (config.assets == null) return [];
1679
- const fs = yield* import_platform10.FileSystem.FileSystem;
1680
- const pathService = yield* import_platform10.Path.Path;
1681
- const assetsPath = pathService.join(projectFolder, config.assets);
1682
- const assetsExist = yield* fs.exists(assetsPath).pipe(import_effect19.Effect.catchAll(() => import_effect19.Effect.succeed(false)));
1683
- if (!assetsExist) return [];
1684
- const stat = yield* fs.stat(assetsPath).pipe(import_effect19.Effect.catchAll(() => import_effect19.Effect.succeed(null)));
1685
- if (!stat || stat.type !== "Directory") return [];
1686
- const allFiles = yield* collectFilesRecursively(assetsPath);
1687
- const assets = [];
1688
- for (const assetName of allFiles) {
1689
- if (DISALLOWED_ASSET_EXTENSIONS.some((ext) => assetName.toLowerCase().endsWith(ext.toLowerCase()))) continue;
1690
- if (getFunctionSettings(`${config.assets}/${assetName}`, config) != null) continue;
1691
- assets.push(`${config.assets}/${assetName}`);
1692
- }
1693
- return assets;
1844
+ const assetNames = yield* collectAssetFiles(projectFolder, config.assets);
1845
+ return assetNames.filter((assetName) => getFunctionSettings(`${config.assets}/${assetName}`, config) == null).map((assetName) => `${config.assets}/${assetName}`);
1694
1846
  });
1695
- var collectFilesRecursively = import_effect19.Effect.fn("collectFilesRecursively")(
1696
- function* (basePath, relativePath = "", depth = 0) {
1697
- if (depth > MAX_ASSET_DEPTH) return [];
1698
- const fs = yield* import_platform10.FileSystem.FileSystem;
1699
- const pathSvc = yield* import_platform10.Path.Path;
1700
- const currentPath = relativePath ? pathSvc.join(basePath, relativePath) : basePath;
1701
- const entries = yield* fs.readDirectory(currentPath).pipe(import_effect19.Effect.catchAll(() => import_effect19.Effect.succeed([])));
1702
- const result = [];
1703
- for (const name of entries) {
1704
- const fullPath = pathSvc.join(currentPath, name);
1705
- const entryRelative = relativePath ? pathSvc.join(relativePath, name) : name;
1706
- const stat = yield* fs.stat(fullPath).pipe(import_effect19.Effect.catchAll(() => import_effect19.Effect.succeed(null)));
1707
- if (!stat) continue;
1708
- if (stat.type === "Directory") {
1709
- const nested = yield* collectFilesRecursively(basePath, entryRelative, depth + 1);
1710
- result.push(...nested);
1711
- } else {
1712
- result.push(entryRelative);
1713
- }
1714
- }
1715
- return result;
1716
- }
1717
- );
1718
- var V4ConfigParser = class extends import_effect19.Effect.Service()("V4ConfigParser", {
1847
+ var V4ConfigParser = class extends import_effect20.Effect.Service()("V4ConfigParser", {
1719
1848
  accessors: true,
1720
- effect: import_effect19.Effect.succeed({
1849
+ effect: import_effect20.Effect.succeed({
1721
1850
  /**
1722
1851
  * Parses a ConfigV4 into a NormalizedConfig.
1723
1852
  *
1724
1853
  * @param config - The raw V4 config object
1725
1854
  * @param projectFolder - Absolute path to the project root
1726
1855
  */
1727
- parse: import_effect19.Effect.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
1856
+ parse: import_effect20.Effect.fn("V4ConfigParser.parse")(function* (config, projectFolder) {
1728
1857
  const entrypoints = yield* parseEntrypoints(config, projectFolder);
1729
1858
  const assets = yield* collectAssets(config, projectFolder);
1730
1859
  return {
@@ -1751,9 +1880,35 @@ var V4ConfigParser = class extends import_effect19.Effect.Service()("V4ConfigPar
1751
1880
 
1752
1881
  // src/services/vercel-build-output-parser.ts
1753
1882
  var import_platform11 = require("@effect/platform");
1754
- var import_build_utils2 = require("@gigadrive/build-utils");
1755
- var import_commons = require("@gigadrive/commons");
1756
- var import_effect20 = require("effect");
1883
+
1884
+ // ../commons/src/deep-merge.ts
1885
+ var deepMerge = (target, ...partials) => {
1886
+ const isObject = (item) => item !== null && typeof item === "object";
1887
+ if (!isObject(target)) {
1888
+ return target;
1889
+ }
1890
+ for (const partial of partials) {
1891
+ if (!isObject(partial)) {
1892
+ continue;
1893
+ }
1894
+ Object.keys(partial).forEach((key) => {
1895
+ if (key === "__proto__" || key === "constructor") return;
1896
+ const targetValue = target[key];
1897
+ const sourceValue = partial[key];
1898
+ if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
1899
+ targetValue.push(...sourceValue);
1900
+ } else if (isObject(targetValue) && isObject(sourceValue)) {
1901
+ deepMerge(targetValue, sourceValue);
1902
+ } else {
1903
+ target[key] = sourceValue;
1904
+ }
1905
+ });
1906
+ }
1907
+ return target;
1908
+ };
1909
+
1910
+ // src/services/vercel-build-output-parser.ts
1911
+ var import_effect21 = require("effect");
1757
1912
 
1758
1913
  // src/build-output-v3/determine-repo-root.ts
1759
1914
  var import_path = __toESM(require("path"));
@@ -1849,11 +2004,11 @@ var translateVercelRuntime = (runtime) => {
1849
2004
  var CONFIG_PATH = ".vercel/output/config.json";
1850
2005
  var FUNCTIONS_FOLDER = ".vercel/output/functions";
1851
2006
  var FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;
1852
- var VercelBuildOutputParser = class extends import_effect20.Effect.Service()("VercelBuildOutputParser", {
1853
- effect: import_effect20.Effect.gen(function* () {
2007
+ var VercelBuildOutputParser = class extends import_effect21.Effect.Service()("VercelBuildOutputParser", {
2008
+ effect: import_effect21.Effect.gen(function* () {
1854
2009
  const rawConfigReader = yield* RawConfigReader;
1855
2010
  const pathService = yield* import_platform11.Path.Path;
1856
- const parse = import_effect20.Effect.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
2011
+ const parse = import_effect21.Effect.fn("VercelBuildOutputParser.parse")(function* (parseResult, projectFolder) {
1857
2012
  const config = yield* rawConfigReader.readConfigFile(pathService.join(projectFolder, CONFIG_PATH));
1858
2013
  if (!config || typeof config.version !== "number" || config.version < 3) {
1859
2014
  return parseResult;
@@ -1861,13 +2016,13 @@ var VercelBuildOutputParser = class extends import_effect20.Effect.Service()("Ve
1861
2016
  const functionData = yield* loadFunctions(config, parseResult, projectFolder);
1862
2017
  const assetOverrides = loadAssetOverrides(config, parseResult);
1863
2018
  const imagePolicy = loadImagePolicy(config);
1864
- const merged = (0, import_commons.deepMerge)(parseResult, functionData, assetOverrides, imagePolicy);
2019
+ const merged = deepMerge(parseResult, functionData, assetOverrides, imagePolicy);
1865
2020
  merged.regions = [...new Set(merged.regions)];
1866
2021
  return merged;
1867
2022
  });
1868
- const loadFunctions = import_effect20.Effect.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
1869
- const functionConfigs = yield* import_effect20.Effect.tryPromise({
1870
- try: () => (0, import_build_utils2.getFilesForPattern)(FUNCTION_CONFIGS_PATTERN, projectFolder),
2023
+ const loadFunctions = import_effect21.Effect.fn("VercelBuildOutputParser.loadFunctions")(function* (config, parseResult, projectFolder) {
2024
+ const functionConfigs = yield* import_effect21.Effect.tryPromise({
2025
+ try: () => getFilesForPattern(FUNCTION_CONFIGS_PATTERN, projectFolder),
1871
2026
  catch: (error) => new ConfigFileParseError({
1872
2027
  message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,
1873
2028
  filePath: projectFolder
@@ -2465,7 +2620,7 @@ var schema_default = {
2465
2620
  };
2466
2621
 
2467
2622
  // src/parse-config.ts
2468
- var parseConfigRaw = import_effect21.Effect.fn("parseConfigRaw")(function* (filePath, projectFolder) {
2623
+ var parseConfigRaw = import_effect22.Effect.fn("parseConfigRaw")(function* (filePath, projectFolder) {
2469
2624
  const rawReader = yield* RawConfigReader;
2470
2625
  const validator = yield* SchemaValidator;
2471
2626
  const v4Parser = yield* V4ConfigParser;
@@ -2476,7 +2631,7 @@ var parseConfigRaw = import_effect21.Effect.fn("parseConfigRaw")(function* (file
2476
2631
  };
2477
2632
  const schema = schemaMap[version];
2478
2633
  if (!schema) {
2479
- return yield* import_effect21.Effect.fail(
2634
+ return yield* import_effect22.Effect.fail(
2480
2635
  new ConfigVersionError({
2481
2636
  message: `Config file at ${filePath} has an unsupported version: ${version}`,
2482
2637
  filePath,
@@ -2487,11 +2642,11 @@ var parseConfigRaw = import_effect21.Effect.fn("parseConfigRaw")(function* (file
2487
2642
  yield* validator.validate(parsed, schema, filePath);
2488
2643
  return yield* v4Parser.parse(parsed, projectFolder);
2489
2644
  });
2490
- var parseConfig = import_effect21.Effect.fn("parseConfig")(function* (filePath, projectFolder) {
2645
+ var parseConfig = import_effect22.Effect.fn("parseConfig")(function* (filePath, projectFolder) {
2491
2646
  const parseResult = yield* parseConfigRaw(filePath, projectFolder);
2492
2647
  return yield* postProcessConfig(parseResult, projectFolder);
2493
2648
  });
2494
- var postProcessConfig = import_effect21.Effect.fn("postProcessConfig")(function* (config, projectFolder) {
2649
+ var postProcessConfig = import_effect22.Effect.fn("postProcessConfig")(function* (config, projectFolder) {
2495
2650
  const vercelParser = yield* VercelBuildOutputParser;
2496
2651
  let result = yield* vercelParser.parse(config, projectFolder);
2497
2652
  const hasAssets = (result.assets?.paths?.length ?? 0) > 0 || (result.assets?.prefixes?.length ?? 0) > 0 || (result.assets?.manifests?.length ?? 0) > 0;
@@ -2520,14 +2675,14 @@ var RUNTIME_DEFINITIONS = [
2520
2675
  var AVAILABLE_RUNTIMES = [...RUNTIME_DEFINITIONS];
2521
2676
 
2522
2677
  // src/services/index.ts
2523
- var import_effect22 = require("effect");
2524
- var BaseLayers = import_effect22.Layer.mergeAll(
2678
+ var import_effect23 = require("effect");
2679
+ var BaseLayers = import_effect23.Layer.mergeAll(
2525
2680
  ConfigModuleLoader.Default,
2526
2681
  RawConfigReader.Default,
2527
2682
  SchemaValidator.Default,
2528
2683
  V4ConfigParser.Default
2529
2684
  );
2530
- var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect22.Layer.provideMerge(BaseLayers));
2685
+ var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect23.Layer.provideMerge(BaseLayers));
2531
2686
  // Annotate the CommonJS export names for ESM import in node:
2532
2687
  0 && (module.exports = {
2533
2688
  ALLOWED_CONFIG_NAMES,
@@ -2548,8 +2703,12 @@ var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect22.Lay
2548
2703
  GigadriveNextBuildManifestV1Schema,
2549
2704
  GigadriveNextBuildManifestV2ExportSchema,
2550
2705
  GigadriveNextBuildManifestV2StandaloneSchema,
2706
+ GigadriveNextMiddlewareDescriptorSchema,
2707
+ GigadriveNextMiddlewareMatcherSchema,
2551
2708
  GigadriveNextPrerenderManifestV1Schema,
2552
2709
  GigadriveNextPrerenderOutputSchema,
2710
+ GigadriveNextPrerenderSeedMethodsSchema,
2711
+ GigadriveNextRouteConditionSchema,
2553
2712
  GigadriveNextServerDescriptorSchema,
2554
2713
  GigadriveNextStaticAssetPrefixSchema,
2555
2714
  MAX_FUNCTION_DURATION_SECONDS,
@@ -2564,6 +2723,7 @@ var NetworkConfigLive = VercelBuildOutputParser.Default.pipe(import_effect22.Lay
2564
2723
  StaticAssetManifestV1Schema,
2565
2724
  V4ConfigParser,
2566
2725
  VercelBuildOutputParser,
2726
+ collectAssetFiles,
2567
2727
  defineConfig,
2568
2728
  detectFramework,
2569
2729
  detectPackageManager,