@gigadrive/network-config 4.6.1 → 5.1.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.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/asset-manifest.ts","../src/manifest-schema.ts","../src/define-config.ts","../src/detection/detect-framework.ts","../src/detection/detect-package-manager.ts","../src/detection/frameworks/astro.ts","../src/detection/frameworks/resolve-node-entrypoint.ts","../src/detection/frameworks/elysia.ts","../src/detection/frameworks/express.ts","../src/detection/frameworks/fastify.ts","../src/detection/frameworks/hono.ts","../src/detection/frameworks/laravel.ts","../src/detection/frameworks/nestjs.ts","../src/detection/frameworks/nextjs.ts","../src/build-output-v3/get-default-path-map.ts","../src/nextjs-constants.ts","../src/nextjs-manifest.ts","../src/regions.ts","../src/detection/frameworks/nuxt.ts","../src/detection/frameworks/remix.ts","../src/detection/frameworks/sveltekit.ts","../src/detection/frameworks/symfony.ts","../src/detection/frameworks/vite.ts","../src/detection/frameworks/index.ts","../src/detection/generate-config.ts","../src/detection/read-dependencies.ts","../src/detection/types.ts","../src/detection/merge-config.ts","../src/errors.ts","../src/filter-functions-from-assets.ts","../src/normalized-config.ts","../src/parse-config.ts","../src/services/raw-config-reader.ts","../src/services/config-module-loader.ts","../src/services/schema-validator.ts","../src/services/v4-config-parser.ts","../../build-utils/src/get-files-for-pattern.ts","../src/services/vercel-build-output-parser.ts","../../commons/src/deep-merge.ts","../src/build-output-v3/determine-repo-root.ts","../src/build-output-v3/get-monorepo-files.ts","../src/build-output-v3/translate-vercel-region.ts","../src/build-output-v3/translate-vercel-runtime.ts","../src/v4/schema.json","../src/runtime.ts","../src/services/index.ts"],"sourcesContent":["export * from './asset-manifest';\nexport * from './define-config';\nexport * from './detection';\nexport * from './errors';\nexport * from './filter-functions-from-assets';\nexport * from './image-policy';\nexport * from './nextjs-manifest';\nexport * from './normalized-config';\nexport * from './parse-config';\nexport * from './regions';\nexport * from './runtime';\nexport * from './services';\nexport * from './v4';\n","import { Schema } from 'effect';\nimport { decodeJson, HttpHeadersSchema, PortableRelativePathSchema, UrlPathnameSchema } from './manifest-schema';\n\nexport const StaticAssetHeadersSchema = HttpHeadersSchema;\nexport type StaticAssetHeaders = Schema.Schema.Type<typeof StaticAssetHeadersSchema>;\n\n/** One logical static asset whose source is relative to the project root. */\nexport const StaticAssetManifestEntrySchema = Schema.mutable(\n Schema.Struct({\n source: PortableRelativePathSchema,\n path: UrlPathnameSchema,\n status: Schema.optional(Schema.Int.pipe(Schema.between(100, 599))),\n headers: Schema.optional(StaticAssetHeadersSchema),\n immutable: Schema.optional(Schema.Boolean),\n })\n);\nexport type StaticAssetManifestEntry = Schema.Schema.Type<typeof StaticAssetManifestEntrySchema>;\n\n/** Portable manifest for declaring many logical assets without expanding deployment configuration. */\nexport const StaticAssetManifestV1Schema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(1),\n assets: Schema.mutable(Schema.Array(StaticAssetManifestEntrySchema)),\n })\n).pipe(Schema.filter(({ assets }) => new Set(assets.map(({ path }) => path)).size === assets.length));\nexport type StaticAssetManifestV1 = Schema.Schema.Type<typeof StaticAssetManifestV1Schema>;\nexport type StaticAssetManifest = StaticAssetManifestV1;\n\n/**\n * Parses and validates a portable static asset manifest.\n *\n * @param content JSON manifest content.\n * @returns The validated manifest, or `undefined` when malformed.\n */\nexport const parseStaticAssetManifest = (content: string): StaticAssetManifest | undefined =>\n decodeJson(StaticAssetManifestV1Schema, content);\n","import { Option, Schema } from 'effect';\n\nconst HTTP_HEADER_NAME = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\nconst HTTP_HEADER_VALUE = /^[\\t\\x20-\\x7e\\x80-\\xff]*$/;\nconst URL_PATHNAME_FORBIDDEN_CHARACTER = /[\\x00-\\x1f\\x7f?#\\\\]/;\n\nconst isUrlDotSegment = (segment: string): boolean => {\n const decodedDots = segment.replace(/%2e/gi, '.');\n return decodedDots === '.' || decodedDots === '..';\n};\n\nconst isPortableRelativePath = (value: string, allowCurrentDirectory = false): boolean => {\n const normalized = value.replaceAll('\\\\', '/').replace(/^\\.\\//, '').replace(/\\/+$/, '');\n return (\n (allowCurrentDirectory || (normalized !== '' && normalized !== '.')) &&\n !normalized.startsWith('/') &&\n !/^[A-Za-z]:/.test(normalized) &&\n !normalized.includes(':') &&\n !normalized.split('/').includes('..')\n );\n};\n\nexport const PortableRelativePathSchema = Schema.String.pipe(Schema.filter((value) => isPortableRelativePath(value)));\n\nexport const RepositoryRelativePathSchema = Schema.String.pipe(\n Schema.filter((value) => isPortableRelativePath(value, true))\n);\n\nexport const UrlPathnameSchema = Schema.String.pipe(\n Schema.filter(\n (value) =>\n value.startsWith('/') && !URL_PATHNAME_FORBIDDEN_CHARACTER.test(value) && !value.split('/').some(isUrlDotSegment)\n )\n);\n\nexport const HttpHeaderValueSchema = Schema.String.pipe(Schema.pattern(HTTP_HEADER_VALUE));\nexport const HttpHeadersSchema = Schema.mutable(\n Schema.Record({\n key: Schema.String,\n value: Schema.Union(HttpHeaderValueSchema, Schema.mutable(Schema.Array(HttpHeaderValueSchema))),\n })\n).pipe(Schema.filter((headers) => Object.keys(headers).every((name) => HTTP_HEADER_NAME.test(name))));\nexport const HttpSingleValueHeadersSchema = Schema.mutable(\n Schema.Record({ key: Schema.String, value: HttpHeaderValueSchema })\n).pipe(Schema.filter((headers) => Object.keys(headers).every((name) => HTTP_HEADER_NAME.test(name))));\n\n/**\n * Decode an unknown value with an Effect schema.\n *\n * @param schema - Schema used to validate and decode the value.\n * @param value - Unknown input to decode.\n * @returns The decoded value, or `undefined` when validation fails.\n * @example\n * decodeUnknown(Schema.String, 'value');\n */\nexport const decodeUnknown = <A, I>(schema: Schema.Schema<A, I, never>, value: unknown): A | undefined =>\n Schema.decodeUnknownOption(schema, { onExcessProperty: 'preserve' })(value).pipe(Option.getOrUndefined);\n\n/**\n * Decode a JSON string with an Effect schema.\n *\n * @param schema - Schema used to validate and decode the parsed JSON value.\n * @param content - JSON string to parse and decode.\n * @returns The decoded value, or `undefined` when parsing or validation fails.\n * @example\n * decodeJson(Schema.Struct({ version: Schema.Number }), '{\"version\":1}');\n */\nexport const decodeJson = <A, I>(schema: Schema.Schema<A, I, never>, content: string): A | undefined =>\n decodeUnknown(Schema.parseJson(schema), content);\n","import type { ConfigV4 } from './v4';\n\n/**\n * Identity helper providing type inference and checking for `gigadrive.ts`\n * config files. Using it is optional — a plain object default export works the\n * same, but `defineConfig` gives editor autocompletion without a type\n * annotation. Requires `@gigadrive/network-config` to be installed in the\n * project (e.g. as a devDependency).\n *\n * Prefer importing from the `@gigadrive/network-config/define-config` subpath:\n * it is dependency-free, whereas the package root eagerly imports peer\n * dependencies (`effect`, `@effect/platform`) that package managers which do\n * not auto-install peers (e.g. Yarn) will not have installed.\n *\n * Note that a `gigadrive.ts` config is executed as code when the config is\n * read — the same trust model as `build_commands`.\n *\n * @param config - The deployment configuration\n * @returns The configuration, unchanged\n * @example\n * ```ts\n * // gigadrive.ts\n * import { defineConfig } from '@gigadrive/network-config/define-config';\n *\n * export default defineConfig({\n * version: 4,\n * regions: ['eu-central-1'],\n * });\n * ```\n */\nexport const defineConfig = (config: ConfigV4): ConfigV4 => config;\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport { detectPackageManager } from './detect-package-manager';\nimport { FRAMEWORK_DEFINITIONS } from './frameworks';\nimport { generateConfig } from './generate-config';\nimport { readDependencies } from './read-dependencies';\nimport type { FrameworkDefinition, FrameworkDetectionItem, ManifestParseError, ManifestReadError } from './types';\nimport { FrameworkNotDetectedError } from './types';\n\n/**\n * Evaluates whether a single detection item matches the project.\n *\n * @param cachedReadDeps - Memoized version of readDependencies keyed by `projectFolder\\0language`\n */\nconst matchesDetectionItem = Effect.fn('matchesDetectionItem')(function* (\n item: FrameworkDetectionItem,\n projectFolder: string,\n framework: FrameworkDefinition,\n cachedReadDeps: (\n key: string\n ) => Effect.Effect<Set<string>, ManifestReadError | ManifestParseError, FileSystem.FileSystem | Path.Path>\n) {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n\n // Check matchPackage (uses memoized reader to avoid re-reading the same manifest)\n if (item.matchPackage != null) {\n const deps = yield* cachedReadDeps(`${projectFolder}\\0${framework.language}`);\n\n if (!deps.has(item.matchPackage)) {\n return false;\n }\n }\n\n // Check path existence\n if (item.path != null) {\n const filePath = pathService.join(projectFolder, item.path);\n const exists = yield* fs.exists(filePath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n\n if (!exists) {\n return false;\n }\n\n // Check matchContent (only when path is set)\n if (item.matchContent != null) {\n const content = yield* fs.readFileString(filePath).pipe(Effect.catchAll(() => Effect.succeed('')));\n\n let regexMatch = false;\n try {\n regexMatch = new RegExp(item.matchContent).test(content);\n } catch {\n // Invalid regex pattern in framework definition — treat as no match\n }\n\n if (!regexMatch) {\n return false;\n }\n }\n }\n\n return true;\n});\n\n/**\n * Evaluates whether all detectors for a framework match the project.\n */\nconst matchesFramework = Effect.fn('matchesFramework')(function* (\n framework: FrameworkDefinition,\n projectFolder: string,\n cachedReadDeps: (\n key: string\n ) => Effect.Effect<Set<string>, ManifestReadError | ManifestParseError, FileSystem.FileSystem | Path.Path>\n) {\n for (const detector of framework.detectors) {\n const matches = yield* matchesDetectionItem(detector, projectFolder, framework, cachedReadDeps);\n if (!matches) {\n return false;\n }\n }\n\n return true;\n});\n\n/**\n * Detects the framework used in a project by checking framework definitions\n * against the project's dependencies and file structure.\n *\n * Framework definitions are checked in priority order (highest first).\n * All detectors for a framework must match for it to be selected.\n *\n * @param projectFolder - Absolute path to the project root\n * @returns DetectionResult with framework, package manager, and generated config\n */\nexport const detectFramework = Effect.fn('detectFramework')(function* (projectFolder: string) {\n yield* Effect.logDebug(`Detecting framework in ${projectFolder}`);\n\n // Memoize dependency reads so each manifest (package.json, composer.json) is read at most once.\n // Uses \\0 (null byte) as delimiter to avoid conflicts with ':' in Windows paths (e.g. C:\\...)\n const cachedReadDeps = yield* Effect.cachedFunction((key: string) => {\n const sepIndex = key.lastIndexOf('\\0');\n const folder = key.slice(0, sepIndex);\n const language = key.slice(sepIndex + 1) as 'node' | 'php';\n return readDependencies(folder, language);\n });\n\n for (const framework of FRAMEWORK_DEFINITIONS) {\n const matches = yield* matchesFramework(framework, projectFolder, cachedReadDeps);\n\n if (matches) {\n yield* Effect.log(`Detected framework: ${framework.name}`, { slug: framework.slug });\n\n const detectedPackageManager = yield* detectPackageManager(projectFolder);\n const packageManager = framework.language === 'php' ? 'composer' : detectedPackageManager;\n const defaults = framework.getDefaultConfig(packageManager);\n const refinedDefaults = framework.refineDefaultConfig\n ? yield* framework.refineDefaultConfig(defaults, projectFolder)\n : defaults;\n const config = yield* generateConfig(framework, packageManager, refinedDefaults);\n\n return { framework, packageManager, config };\n }\n }\n\n return yield* Effect.fail(\n new FrameworkNotDetectedError({\n message: `No framework detected in project directory`,\n directory: projectFolder,\n })\n );\n});\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { PackageManager } from './types';\n\n/**\n * Lockfile-to-package-manager mapping, checked in priority order.\n */\nconst LOCKFILE_MAP: Array<{ files: string[]; pm: PackageManager }> = [\n { files: ['bun.lockb', 'bun.lock'], pm: 'bun' },\n { files: ['pnpm-lock.yaml'], pm: 'pnpm' },\n { files: ['yarn.lock'], pm: 'yarn' },\n { files: ['package-lock.json'], pm: 'npm' },\n { files: ['composer.lock'], pm: 'composer' },\n];\n\n/**\n * Detects the package manager by checking for lockfiles in the project folder.\n * Falls back to `npm` if no lockfile is found.\n *\n * @param projectFolder - Absolute path to the project root\n * @returns The detected package manager\n */\nexport const detectPackageManager = Effect.fn('detectPackageManager')(function* (projectFolder: string) {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n\n for (const { files, pm } of LOCKFILE_MAP) {\n for (const file of files) {\n const exists = yield* fs\n .exists(pathService.join(projectFolder, file))\n .pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (exists) {\n yield* Effect.logDebug(`Detected package manager: ${pm} (via ${file})`);\n return pm;\n }\n }\n }\n\n yield* Effect.logDebug('No lockfile found, defaulting to npm');\n return 'npm' satisfies PackageManager;\n});\n","import type { FrameworkDefinition } from '../types';\n\nexport const astro: FrameworkDefinition = {\n slug: 'astro',\n name: 'Astro',\n language: 'node',\n detectors: [{ matchPackage: 'astro' }],\n priority: 85,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['astro build'],\n entrypoint: 'dist/server/entry.mjs',\n assetsDir: 'dist/client',\n populateAssetCache: true,\n routes: [{ source: '/*', destination: 'dist/server/entry.mjs' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n};\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { FrameworkDefaultConfig } from '../types';\n\ninterface PackageJsonManifest {\n main?: unknown;\n scripts?: Record<string, unknown>;\n}\n\n/** Script runners whose first file argument is the server entrypoint. */\nconst SCRIPT_RUNNERS = new Set(['node', 'bun', 'tsx', 'ts-node']);\n\n/** Common entrypoint locations probed on disk, in order of preference. */\nconst COMMON_ENTRYPOINT_CANDIDATES = [\n 'index.js',\n 'src/index.js',\n 'index.ts',\n 'src/index.ts',\n 'app.js',\n 'src/app.js',\n 'server.js',\n 'src/server.js',\n 'app.ts',\n 'src/app.ts',\n 'server.ts',\n 'src/server.ts',\n];\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null;\n\nconst parsePackageJson = (content: string): PackageJsonManifest | undefined => {\n try {\n const parsed: unknown = JSON.parse(content);\n if (!isRecord(parsed)) return undefined;\n return parsed;\n } catch {\n return undefined;\n }\n};\n\nconst normalizeEntrypointPath = (entrypoint: string): string | undefined => {\n const normalized = entrypoint.replace(/\\\\/g, '/').replace(/^\\.\\//, '');\n if (\n !normalized ||\n normalized === '.' ||\n normalized.startsWith('/') ||\n normalized.includes(':') ||\n normalized.split('/').some((segment) => segment === '..')\n ) {\n return undefined;\n }\n return normalized;\n};\n\n/**\n * Extracts the entrypoint file from a `start` script such as `node src/index.js`\n * or `bun run src/index.ts`. Flags are skipped; anything more complex than a\n * single runner invocation is ignored.\n */\nconst parseStartScript = (script: string): string | undefined => {\n const tokens = script.trim().split(/\\s+/);\n if (tokens.length < 2 || !SCRIPT_RUNNERS.has(tokens[0])) return undefined;\n\n let index = 1;\n if (tokens[0] === 'bun' && tokens[index] === 'run') index++;\n while (index < tokens.length && tokens[index].startsWith('-')) index++;\n\n return tokens[index];\n};\n\nconst applyEntrypoint = (defaults: FrameworkDefaultConfig, entrypoint: string): FrameworkDefaultConfig => ({\n ...defaults,\n entrypoint,\n routes: defaults.routes.map((route) =>\n route.destination === defaults.entrypoint ? { ...route, destination: entrypoint } : route\n ),\n});\n\n/**\n * Resolves the server entrypoint for minimal Node/Bun server frameworks\n * (Express, Fastify, Hono, Elysia) from the project instead of trusting the\n * preset's guessed path.\n *\n * Resolution order:\n * 1. `package.json` `main` field (if it points to an existing file)\n * 2. a `node <file>` / `bun run <file>` pattern in `scripts.start`\n * 3. the preset's default entrypoint, then common candidates that exist on disk\n * 4. the preset's default entrypoint as last resort (unchanged defaults)\n *\n * The `routes` destinations that pointed at the default entrypoint follow the\n * resolved entrypoint.\n */\nexport const resolveNodeServerEntrypoint = (\n defaults: FrameworkDefaultConfig,\n projectFolder: string\n): Effect.Effect<FrameworkDefaultConfig, never, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n\n const isFile = (relativePath: string) =>\n fs.stat(pathService.join(projectFolder, relativePath)).pipe(\n Effect.map((info) => info.type === 'File'),\n Effect.catchAll(() => Effect.succeed(false))\n );\n\n const content = yield* fs\n .readFileString(pathService.join(projectFolder, 'package.json'))\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n const manifest = content ? parsePackageJson(content) : undefined;\n\n const startScript = typeof manifest?.scripts?.start === 'string' ? manifest.scripts.start : undefined;\n\n const candidates = [\n typeof manifest?.main === 'string' ? manifest.main : undefined,\n startScript ? parseStartScript(startScript) : undefined,\n defaults.entrypoint,\n ...COMMON_ENTRYPOINT_CANDIDATES,\n ];\n\n for (const candidate of candidates) {\n if (!candidate) continue;\n\n const normalized = normalizeEntrypointPath(candidate);\n if (!normalized) continue;\n\n if (yield* isFile(normalized)) {\n return applyEntrypoint(defaults, normalized);\n }\n }\n\n return defaults;\n });\n","import type { FrameworkDefinition } from '../types';\nimport { resolveNodeServerEntrypoint } from './resolve-node-entrypoint';\n\nexport const elysia: FrameworkDefinition = {\n slug: 'elysia',\n name: 'Elysia',\n language: 'node',\n detectors: [{ matchPackage: 'elysia' }],\n priority: 45,\n getDefaultConfig: () => ({\n runtime: 'bun-1',\n memory: 128,\n maxDuration: 30,\n streaming: true,\n commands: [],\n entrypoint: 'src/index.ts',\n routes: [{ source: '/*', destination: 'src/index.ts' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: resolveNodeServerEntrypoint,\n};\n","import type { FrameworkDefinition } from '../types';\nimport { resolveNodeServerEntrypoint } from './resolve-node-entrypoint';\n\nexport const express: FrameworkDefinition = {\n slug: 'express',\n name: 'Express',\n language: 'node',\n detectors: [{ matchPackage: 'express' }],\n priority: 10,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 128,\n maxDuration: 30,\n streaming: true,\n commands: [],\n entrypoint: 'index.js',\n routes: [{ source: '/*', destination: 'index.js' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: resolveNodeServerEntrypoint,\n};\n","import type { FrameworkDefinition } from '../types';\nimport { resolveNodeServerEntrypoint } from './resolve-node-entrypoint';\n\nexport const fastify: FrameworkDefinition = {\n slug: 'fastify',\n name: 'Fastify',\n language: 'node',\n detectors: [{ matchPackage: 'fastify' }],\n priority: 40,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 128,\n maxDuration: 30,\n streaming: true,\n commands: [],\n entrypoint: 'src/index.ts',\n routes: [{ source: '/*', destination: 'src/index.ts' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: resolveNodeServerEntrypoint,\n};\n","import type { FrameworkDefinition } from '../types';\nimport { resolveNodeServerEntrypoint } from './resolve-node-entrypoint';\n\nexport const hono: FrameworkDefinition = {\n slug: 'hono',\n name: 'Hono',\n language: 'node',\n detectors: [{ matchPackage: 'hono' }],\n priority: 50,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 128,\n maxDuration: 30,\n streaming: true,\n commands: [],\n entrypoint: 'src/index.ts',\n routes: [{ source: '/*', destination: 'src/index.ts' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: resolveNodeServerEntrypoint,\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const laravel: FrameworkDefinition = {\n slug: 'laravel',\n name: 'Laravel',\n language: 'php',\n detectors: [{ matchPackage: 'laravel/framework' }, { path: 'artisan' }],\n priority: 80,\n getDefaultConfig: () => ({\n runtime: 'php-84',\n memory: 256,\n maxDuration: 30,\n streaming: false,\n commands: ['composer require bref/laravel-bridge --update-with-dependencies', 'bun install', 'bun run build'],\n entrypoint: 'public/index.php',\n assetsDir: 'public',\n populateAssetCache: true,\n excludeFiles: ['tests/', 'storage/', '.ddev', 'node_modules/'],\n routes: [{ source: '/*', destination: 'public/index.php' }],\n environmentVariables: {\n APP_NAME: 'Laravel',\n APP_ENV: 'production',\n APP_DEBUG: 'false',\n LOG_CHANNEL: 'stderr',\n LOG_DEPRECATIONS_CHANNEL: 'stderr',\n LOG_LEVEL: 'debug',\n BROADCAST_DRIVER: 'log',\n SESSION_DRIVER: 'cookie',\n },\n }),\n};\n","import { FileSystem } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { FrameworkDefaultConfig, FrameworkDefinition } from '../types';\n\ninterface NestCliJson {\n compilerOptions?: {\n outputPath?: unknown;\n };\n defaultProject?: unknown;\n projects?: Record<\n string,\n {\n compilerOptions?: {\n outputPath?: unknown;\n };\n }\n >;\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null;\n\nconst parseNestCliJson = (content: string): NestCliJson | undefined => {\n try {\n const parsed: unknown = JSON.parse(content);\n if (!isRecord(parsed)) return undefined;\n return parsed;\n } catch {\n return undefined;\n }\n};\n\nconst getProjectOutputPath = (config: NestCliJson): string | undefined => {\n if (typeof config.compilerOptions?.outputPath === 'string') {\n return config.compilerOptions.outputPath;\n }\n\n if (typeof config.defaultProject === 'string') {\n const outputPath = config.projects?.[config.defaultProject]?.compilerOptions?.outputPath;\n if (typeof outputPath === 'string') return outputPath;\n }\n\n const firstProject = Object.values(config.projects ?? {})[0];\n const outputPath = firstProject?.compilerOptions?.outputPath;\n return typeof outputPath === 'string' ? outputPath : undefined;\n};\n\nconst normalizeOutputPath = (outputPath: string): string | undefined => {\n const normalized = outputPath.replace(/\\\\/g, '/').replace(/^\\.\\//, '').replace(/\\/+$/, '');\n if (\n !normalized ||\n normalized === '.' ||\n normalized.startsWith('/') ||\n /^[A-Za-z]:/.test(normalized) ||\n normalized.includes(':') ||\n normalized.split('/').some((segment) => segment === '..')\n ) {\n return undefined;\n }\n return normalized;\n};\n\nconst createNestConfig = (outputPath: string): FrameworkDefaultConfig => {\n const outputDirectory = normalizeOutputPath(outputPath) ?? 'dist';\n const entrypoint = `${outputDirectory}/main.js`;\n\n return {\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['nest build'],\n entrypoint,\n routes: [{ source: '/*', destination: entrypoint }],\n environmentVariables: { NODE_ENV: 'production' },\n };\n};\n\nexport const nestjs: FrameworkDefinition = {\n slug: 'nestjs',\n name: 'NestJS',\n language: 'node',\n detectors: [{ matchPackage: '@nestjs/core' }],\n priority: 90,\n getDefaultConfig: () => createNestConfig('dist'),\n refineDefaultConfig: (defaults, projectFolder) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const content = yield* fs\n .readFileString(`${projectFolder}/nest-cli.json`)\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n\n if (!content) return defaults;\n\n const nestConfig = parseNestCliJson(content);\n const outputPath = nestConfig ? getProjectOutputPath(nestConfig) : undefined;\n\n return outputPath ? createNestConfig(outputPath) : defaults;\n }),\n};\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport { getDefaultPathMap } from '../../build-output-v3/get-default-path-map';\nimport { MAXIMUM_ENTRY_PAGE_PATHS } from '../../nextjs-constants';\nimport {\n parseGigadriveNextBuildManifest,\n type GigadriveNextBuildManifestV1,\n type GigadriveNextBuildManifestV2Standalone,\n} from '../../nextjs-manifest';\nimport type { NormalizedConfigEntrypoint } from '../../normalized-config';\nimport { AVAILABLE_REGIONS } from '../../regions';\nimport type { FrameworkDefaultConfig, FrameworkDefinition } from '../types';\n\nconst toPortablePath = (value: string): string => value.replaceAll('\\\\', '/');\n\n/**\n * Memory for the single standalone server, in MB.\n *\n * The per-route default (256 MB) sized a function that served one route with a\n * small module graph. One standalone server instead holds the whole\n * application's graph and renders its heaviest pages, so the same floor leaves\n * it thrashing the garbage collector on large documents. Node itself sizes its\n * old-space heap from the container limit, which makes 256 MB actively harmful\n * for server rendering rather than merely tight.\n */\nconst STANDALONE_SERVER_MEMORY_MB = 1024;\n\n/**\n * Locates the standalone `server.js` produced by `output: 'standalone'`, preferring\n * the monorepo-nested path (`standalone/<repoRootToProject>/server.js`) over the root\n * one. Returns `undefined` when neither exists (e.g. a build that did not run in\n * standalone mode), so callers can fall back to plain framework defaults.\n */\nconst resolveStandaloneServer = Effect.fn('nextjs.resolveStandaloneServer')(function* (\n projectFolder: string,\n distDir: string,\n repoRootToProject: string\n) {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n const standaloneRoot = pathService.join(projectFolder, distDir, 'standalone');\n const monorepoServer = pathService.join(standaloneRoot, repoRootToProject, 'server.js');\n const rootServer = pathService.join(standaloneRoot, 'server.js');\n const monorepoServerExists = yield* fs.exists(monorepoServer).pipe(Effect.catchAll(() => Effect.succeed(false)));\n const serverPath = monorepoServerExists ? monorepoServer : rootServer;\n const serverExists = yield* fs.exists(serverPath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (!serverExists) return undefined;\n\n const serverDirectory = pathService.dirname(serverPath);\n const entrypoint = toPortablePath(pathService.relative(standaloneRoot, serverPath));\n return { standaloneRoot, serverDirectory, entrypoint };\n});\n\n/**\n * Enumerates the project `public/` tree into per-file static assets plus a package\n * map that copies each file into the standalone server directory. Public files sit\n * at arbitrary root paths and are low-cardinality, so they stay per-file (only the\n * high-cardinality `.next/static` tree is collapsed to a prefix).\n */\nconst buildStandalonePublicAssets = Effect.fn('nextjs.buildStandalonePublicAssets')(function* (\n projectFolder: string,\n standaloneRoot: string,\n serverDirectory: string\n) {\n const pathService = yield* Path.Path;\n const publicFiles = yield* getDefaultPathMap(pathService.join(projectFolder, 'public'));\n const assetPaths: string[] = [];\n const assetOverrides: Record<string, { path: string }> = {};\n const filePathMap: Record<string, string> = {};\n for (const [absolutePath, relativePath] of Object.entries(publicFiles)) {\n const portableRelativePath = toPortablePath(relativePath);\n const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));\n assetPaths.push(projectRelativePath);\n assetOverrides[projectRelativePath] = { path: portableRelativePath };\n filePathMap[absolutePath] = toPortablePath(\n pathService.relative(standaloneRoot, pathService.join(serverDirectory, 'public', relativePath))\n );\n }\n return { assetPaths, assetOverrides, filePathMap };\n});\n\nconst createStaticExportConfig = Effect.fn('nextjs.createStaticExportConfig')(function* (\n defaults: FrameworkDefaultConfig,\n projectFolder: string\n) {\n const pathService = yield* Path.Path;\n const outputDirectory = pathService.join(projectFolder, 'out');\n const files = yield* getDefaultPathMap(outputDirectory);\n const assetPaths: string[] = [];\n const assetOverrides: Record<string, { path: string }> = {};\n\n for (const absolutePath of Object.keys(files)) {\n const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));\n const outputRelativePath = toPortablePath(pathService.relative(outputDirectory, absolutePath));\n assetPaths.push(projectRelativePath);\n\n const routePath =\n outputRelativePath === 'index.html'\n ? ''\n : outputRelativePath.endsWith('/index.html')\n ? outputRelativePath.slice(0, -'/index.html'.length)\n : outputRelativePath;\n assetOverrides[projectRelativePath] = { path: routePath };\n }\n\n return {\n ...defaults,\n entrypoint: undefined,\n routes: [],\n assetsDir: 'out',\n assetsPrefixToStrip: '',\n assetPaths,\n assetOverrides,\n package: undefined,\n };\n});\n\nconst createStandaloneConfig = Effect.fn('nextjs.createStandaloneConfig')(function* (\n defaults: FrameworkDefaultConfig,\n projectFolder: string,\n manifest: GigadriveNextBuildManifestV1\n) {\n const pathService = yield* Path.Path;\n const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);\n if (!resolved) return defaults;\n const { standaloneRoot, serverDirectory, entrypoint } = resolved;\n\n const publicAssets = yield* buildStandalonePublicAssets(projectFolder, standaloneRoot, serverDirectory);\n const assetPaths = [...publicAssets.assetPaths];\n const assetOverrides: Record<string, { path: string }> = { ...publicAssets.assetOverrides };\n const filePathMap: Record<string, string> = { ...publicAssets.filePathMap };\n\n // Legacy path (Next < 16.2): the network prefix matcher may not be available,\n // so `.next/static` stays enumerated per file and copied into the standalone tree.\n const staticFiles = yield* getDefaultPathMap(pathService.join(projectFolder, manifest.distDir, 'static'));\n for (const [absolutePath, relativePath] of Object.entries(staticFiles)) {\n const portableRelativePath = toPortablePath(relativePath);\n const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));\n assetPaths.push(projectRelativePath);\n assetOverrides[projectRelativePath] = { path: `_next/static/${portableRelativePath}` };\n filePathMap[absolutePath] = toPortablePath(\n pathService.relative(standaloneRoot, pathService.join(serverDirectory, manifest.distDir, 'static', relativePath))\n );\n }\n\n return {\n ...defaults,\n entrypoint,\n routes: [{ source: '/*', destination: entrypoint }],\n assetsDir: manifest.distDir,\n assetsPrefixToStrip: '',\n assetPaths,\n assetOverrides,\n package: {\n trace: false,\n rootOverwrite: standaloneRoot,\n filePathMap,\n },\n };\n});\n\nconst createStandaloneV2Config = Effect.fn('nextjs.createStandaloneV2Config')(function* (\n defaults: FrameworkDefaultConfig,\n projectFolder: string,\n manifest: GigadriveNextBuildManifestV2Standalone\n) {\n const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);\n if (!resolved) return defaults;\n const { standaloneRoot, serverDirectory, entrypoint } = resolved;\n\n const publicAssets = yield* buildStandalonePublicAssets(projectFolder, standaloneRoot, serverDirectory);\n const assetPaths = [...publicAssets.assetPaths];\n const assetOverrides: Record<string, { path: string }> = { ...publicAssets.assetOverrides };\n const filePathMap: Record<string, string> = { ...publicAssets.filePathMap };\n\n // `.next/static` collapses into edge-served prefixes (one descriptor, not one\n // registration per hashed chunk). The subtree is served by the edge, not copied\n // into the server package, so it is deliberately absent from `filePathMap`.\n const assetPrefixes = manifest.outputs.staticAssets.map((staticAsset) => ({\n source: staticAsset.sourceDir,\n destination: staticAsset.urlPrefix,\n immutable: staticAsset.immutable,\n populateCache: true,\n }));\n\n const assetManifests = manifest.outputs.assetManifest ? [{ source: manifest.outputs.assetManifest }] : undefined;\n const { entryPagePaths: manifestEntryPagePaths, ...manifestOutputs } = manifest.outputs;\n\n // The complete prerender table is referenced through a sidecar. Keep only a\n // bounded path sample inline so normalized configuration remains compact.\n const entryPagePaths =\n manifestEntryPagePaths?.slice(0, MAXIMUM_ENTRY_PAGE_PATHS) ??\n [\n ...new Set(\n manifest.outputs.prerenders\n .filter((output) => output.fallback?.postponedState === undefined)\n .map((output) => output.pathname)\n .filter((pathname) => pathname.startsWith('/') && !pathname.includes('['))\n ),\n ]\n .sort((left, right) => left.split('/').length - right.split('/').length || left.localeCompare(right))\n .slice(0, MAXIMUM_ENTRY_PAGE_PATHS);\n\n const singleEntrypoint: NormalizedConfigEntrypoint = {\n displayName: 'next-server',\n path: entrypoint,\n runtime: defaults.runtime,\n memory: Math.max(defaults.memory, STANDALONE_SERVER_MEMORY_MB),\n maxDuration: manifest.server.maxDuration ?? defaults.maxDuration,\n streaming: true,\n environmentVariables: {\n NEXT_BUILD_ID: manifest.buildId,\n ...manifest.server.env,\n },\n package: {\n trace: false,\n rootOverwrite: standaloneRoot,\n filePathMap,\n },\n };\n\n const framework = {\n mode: manifest.mode,\n distDir: manifest.distDir,\n repoRootToProject: manifest.repoRootToProject,\n nextVersion: manifest.nextVersion,\n buildId: manifest.buildId,\n server: manifest.server,\n config: manifest.config,\n routing: manifest.routing,\n // Keep high-cardinality output metadata in portable sidecars rather than\n // expanding it into normalized deployment configuration.\n outputs: { ...manifestOutputs, prerenders: [] },\n entryPagePaths,\n type: 'nextjs' as const,\n schemaVersion: 2 as const,\n };\n\n return {\n ...defaults,\n entrypoint: undefined,\n routes: [],\n assetPaths,\n assetOverrides,\n assetPrefixes,\n assetManifests,\n assetsDir: manifest.distDir,\n assetsPrefixToStrip: '',\n populateAssetCache: true,\n package: undefined,\n normalizedConfig: {\n regions: [...AVAILABLE_REGIONS],\n entrypoints: [singleEntrypoint],\n routes: [\n {\n path: '/*',\n destination: entrypoint,\n handler: 'SERVERLESS_FUNCTION_STREAMING' as const,\n methods: ['ANY' as const],\n headers: {},\n },\n ],\n framework,\n images: manifest.config.images,\n sharedArtifacts: [],\n userArchive: { rootOverwrite: standaloneRoot },\n },\n };\n});\n\nexport const nextjs: FrameworkDefinition = {\n slug: 'nextjs',\n name: 'Next.js',\n language: 'node',\n detectors: [{ matchPackage: 'next' }],\n priority: 100,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['next build'],\n entrypoint: '.next/standalone/server.js',\n assetsDir: '.next/static',\n populateAssetCache: true,\n routes: [{ source: '/*', destination: '.next/standalone/server.js' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: (defaults, projectFolder) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const manifestContent = yield* fs\n .readFileString(`${projectFolder}/.gigadrive/nextjs.json`)\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n const manifest = manifestContent ? parseGigadriveNextBuildManifest(manifestContent) : undefined;\n if (!manifest) return defaults;\n\n if (manifest.version === 2) {\n return manifest.mode === 'export'\n ? yield* createStaticExportConfig(defaults, projectFolder)\n : yield* createStandaloneV2Config(defaults, projectFolder, manifest);\n }\n return manifest.output === 'export'\n ? yield* createStaticExportConfig(defaults, projectFolder)\n : yield* createStandaloneConfig(defaults, projectFolder, manifest);\n }),\n};\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\n\n/**\n * Creates a mapping of absolute file paths to their relative paths\n * starting from the provided directory.\n *\n * This is the default path map that will be used for Vercel-based functions,\n * when the function does not specify a filePathMap.\n *\n * @param directory - The absolute path of the directory to process\n * @returns A record where keys are absolute file paths and values are relative paths\n */\nexport const getDefaultPathMap = Effect.fn('getDefaultPathMap')(function* (directory: string) {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n const result: Record<string, string> = {};\n\n const exists = yield* fs.exists(directory).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (!exists) {\n return result;\n }\n\n const MAX_DEPTH = 100;\n\n // Inner helper that closes over `fs`, `pathService`, and `result` — not extracted\n // to Effect.fn because it mutates the outer `result` record via closure.\n const processDirectory = (currentPath: string, basePath: string = '', depth: number = 0): Effect.Effect<void> =>\n Effect.gen(function* () {\n if (depth > MAX_DEPTH) return;\n\n const entries = yield* fs.readDirectory(currentPath).pipe(Effect.catchAll(() => Effect.succeed([] as string[])));\n\n for (const name of entries) {\n const fullPath = pathService.join(currentPath, name);\n const relativePath = basePath ? pathService.join(basePath, name) : name;\n\n const stat = yield* fs.stat(fullPath).pipe(Effect.catchAll(() => Effect.succeed(null)));\n if (!stat) continue;\n\n if (stat.type === 'Directory') {\n yield* processDirectory(fullPath, relativePath, depth + 1);\n } else {\n result[fullPath] = relativePath;\n }\n }\n });\n\n yield* processDirectory(directory);\n return result;\n});\n","/**\n * A representative sample is enough for cache warming. The complete prerender\n * table stays in its sidecar so it cannot expand gateway configuration by\n * thousands of paths.\n */\nexport const MAXIMUM_ENTRY_PAGE_PATHS = 50;\n","import { Schema } from 'effect';\nimport type { NormalizedImagePolicy } from './image-policy';\nimport {\n decodeJson,\n HttpHeadersSchema,\n HttpSingleValueHeadersSchema,\n PortableRelativePathSchema,\n RepositoryRelativePathSchema,\n UrlPathnameSchema,\n} from './manifest-schema';\n\n/** JSON values accepted in the portable Next.js adapter manifest. */\nexport type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };\n\nconst StringArraySchema = Schema.mutable(Schema.Array(Schema.String));\nconst StringRecordSchema = Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.String }));\n\nconst JsonValueSchema: Schema.Schema<JsonValue> = Schema.suspend(() =>\n Schema.Union(\n Schema.Null,\n Schema.Boolean,\n Schema.Number,\n Schema.String,\n Schema.mutable(Schema.Array(JsonValueSchema)),\n Schema.mutable(Schema.Record({ key: Schema.String, value: JsonValueSchema }))\n )\n);\n\nconst ImageLocalPatternSchema = Schema.mutable(\n Schema.Struct({\n pathname: Schema.optional(Schema.String),\n search: Schema.optional(Schema.String),\n })\n);\nconst ImageRemotePatternSchema = Schema.mutable(\n Schema.Struct({\n protocol: Schema.optional(Schema.Literal('http', 'https')),\n hostname: Schema.String,\n port: Schema.optional(Schema.String),\n pathname: Schema.optional(Schema.String),\n search: Schema.optional(Schema.String),\n })\n);\nconst ImageVariantSchema = Schema.mutable(\n Schema.Struct({\n width: Schema.optional(Schema.Number),\n height: Schema.optional(Schema.Number),\n quality: Schema.optional(Schema.Number),\n format: Schema.optional(Schema.Literal('image/avif', 'image/webp', 'image/jpeg', 'image/png')),\n fit: Schema.optional(Schema.Literal('contain', 'cover', 'fill', 'inside', 'outside')),\n })\n);\nconst PositiveIntSchema = Schema.Int.pipe(Schema.greaterThan(0));\nconst ImagePolicySchema: Schema.Schema<NormalizedImagePolicy> = Schema.mutable(\n Schema.Struct({\n localPatterns: Schema.mutable(Schema.Array(ImageLocalPatternSchema)),\n remotePatterns: Schema.mutable(Schema.Array(ImageRemotePatternSchema)),\n widths: Schema.mutable(Schema.Array(PositiveIntSchema)),\n heights: Schema.mutable(Schema.Array(PositiveIntSchema)),\n qualities: Schema.mutable(Schema.Array(Schema.Number.pipe(Schema.between(1, 100)))),\n formats: Schema.mutable(Schema.Array(Schema.Literal('image/avif', 'image/webp', 'image/jpeg', 'image/png'))),\n minimumCacheTTL: Schema.Number,\n dangerouslyAllowSVG: Schema.Boolean,\n contentSecurityPolicy: Schema.String,\n contentDispositionType: Schema.Literal('inline', 'attachment'),\n maximumRedirects: Schema.Number,\n maximumResponseBody: Schema.Number,\n variants: Schema.mutable(Schema.Record({ key: Schema.String, value: ImageVariantSchema })),\n })\n);\n\nconst GigadriveNextPrerenderOutputFields = {\n id: Schema.String,\n type: Schema.Literal('PRERENDER'),\n pathname: UrlPathnameSchema,\n route: Schema.optional(UrlPathnameSchema),\n parentOutputId: Schema.String,\n groupId: Schema.Number,\n pprChain: Schema.optional(Schema.mutable(Schema.Struct({ headers: HttpSingleValueHeadersSchema }))),\n parentFallbackMode: Schema.optional(JsonValueSchema),\n fallback: Schema.optional(\n Schema.mutable(\n Schema.Struct({\n filePath: Schema.optional(PortableRelativePathSchema),\n initialStatus: Schema.optional(Schema.Int.pipe(Schema.between(100, 599))),\n initialHeaders: Schema.optional(HttpHeadersSchema),\n initialExpiration: Schema.optional(Schema.Number),\n initialRevalidate: Schema.optional(Schema.Union(Schema.Number, Schema.Literal(false))),\n postponedState: Schema.optional(Schema.String),\n })\n )\n ),\n config: Schema.mutable(\n Schema.Struct({\n allowQuery: Schema.optional(StringArraySchema),\n allowHeader: Schema.optional(StringArraySchema),\n bypassFor: Schema.optional(Schema.mutable(Schema.Array(JsonValueSchema))),\n renderingMode: Schema.optional(Schema.String),\n partialFallback: Schema.optional(Schema.Boolean),\n bypassToken: Schema.optional(Schema.String),\n })\n ),\n} as const;\n\nconst GigadriveNextPrerenderClassificationSchema = Schema.Struct({\n routeType: Schema.Literal('route', 'fallback', 'shell', 'page'),\n response: Schema.Literal('empty', 'initial', 'complete'),\n compute: Schema.Literal('blocking', 'resuming', 'static'),\n htmlSize: Schema.optional(Schema.Number),\n});\n\nconst GigadriveNextPrerenderWithoutClassificationSchema = Schema.Struct({\n routeType: Schema.optional(Schema.Never),\n response: Schema.optional(Schema.Never),\n compute: Schema.optional(Schema.Never),\n htmlSize: Schema.optional(Schema.Never),\n});\n\n/**\n * Portable Next.js prerender metadata.\n *\n * A fallback file is a mutable incremental-cache build seed, not a permanently\n * authoritative static asset. Consumers must evaluate bypass, preview,\n * revalidation, and PPR metadata before using it, and may only short-circuit\n * ordinary GET and HEAD requests.\n */\nexport const GigadriveNextPrerenderOutputSchema = Schema.Union(\n Schema.mutable(\n Schema.Struct({ ...GigadriveNextPrerenderOutputFields, ...GigadriveNextPrerenderClassificationSchema.fields })\n ),\n Schema.mutable(\n Schema.Struct({\n ...GigadriveNextPrerenderOutputFields,\n ...GigadriveNextPrerenderWithoutClassificationSchema.fields,\n })\n )\n);\nexport type GigadriveNextPrerenderOutput = Schema.Schema.Type<typeof GigadriveNextPrerenderOutputSchema>;\n\n/** A directory subtree published under one URL prefix. */\nexport const GigadriveNextStaticAssetPrefixSchema = Schema.mutable(\n Schema.Struct({\n sourceDir: PortableRelativePathSchema,\n urlPrefix: PortableRelativePathSchema,\n immutable: Schema.Boolean,\n })\n);\nexport type GigadriveNextStaticAssetPrefix = Schema.Schema.Type<typeof GigadriveNextStaticAssetPrefixSchema>;\n\n/** Portable request condition used by a Next.js middleware/Proxy matcher. */\nexport const GigadriveNextRouteConditionSchema = Schema.Union(\n Schema.mutable(\n Schema.Struct({\n type: Schema.Literal('header', 'cookie', 'query'),\n key: Schema.String,\n value: Schema.optional(Schema.String),\n })\n ),\n Schema.mutable(\n Schema.Struct({\n type: Schema.Literal('host'),\n value: Schema.String,\n })\n )\n);\nexport type GigadriveNextRouteCondition = Schema.Schema.Type<typeof GigadriveNextRouteConditionSchema>;\n\n/** Validated public matcher metadata for a Next.js middleware or Proxy entrypoint. */\nexport const GigadriveNextMiddlewareMatcherSchema = Schema.mutable(\n Schema.Struct({\n source: Schema.String,\n sourceRegex: Schema.String,\n has: Schema.optional(Schema.mutable(Schema.Array(GigadriveNextRouteConditionSchema))),\n missing: Schema.optional(Schema.mutable(Schema.Array(GigadriveNextRouteConditionSchema))),\n })\n);\nexport type GigadriveNextMiddlewareMatcher = Schema.Schema.Type<typeof GigadriveNextMiddlewareMatcherSchema>;\n\n/**\n * Portable middleware/Proxy discovery result.\n *\n * The object is emitted for every new standalone build. Its optional position\n * in the containing manifest preserves parsing of manifests written by older\n * SDK releases, where absence means that middleware presence is unknown.\n */\nexport const GigadriveNextMiddlewareDescriptorSchema = Schema.Union(\n Schema.mutable(\n Schema.Struct({\n present: Schema.Literal(true),\n matchers: Schema.mutable(Schema.Array(GigadriveNextMiddlewareMatcherSchema)),\n })\n ),\n Schema.mutable(\n Schema.Struct({\n present: Schema.Literal(false),\n matchers: Schema.mutable(Schema.Tuple()),\n })\n )\n);\nexport type GigadriveNextMiddlewareDescriptor = Schema.Schema.Type<typeof GigadriveNextMiddlewareDescriptorSchema>;\n\n/** Aggregated runtime configuration for the standalone server. */\nexport const GigadriveNextServerDescriptorSchema = Schema.mutable(\n Schema.Struct({\n maxDuration: Schema.optional(Schema.Number),\n preferredRegion: Schema.optional(Schema.Union(Schema.String, StringArraySchema)),\n env: Schema.optional(StringRecordSchema),\n })\n);\nexport type GigadriveNextServerDescriptor = Schema.Schema.Type<typeof GigadriveNextServerDescriptorSchema>;\n\nconst PrerenderArraySchema = Schema.mutable(Schema.Array(GigadriveNextPrerenderOutputSchema));\nconst StaticAssetArraySchema = Schema.mutable(Schema.Array(GigadriveNextStaticAssetPrefixSchema));\nconst JsonValueArraySchema = Schema.mutable(Schema.Array(JsonValueSchema));\n\n/** Methods for which a validated prerender seed may participate in response lookup. */\nexport const GigadriveNextPrerenderSeedMethodsSchema = Schema.mutable(\n Schema.Tuple(Schema.Literal('GET'), Schema.Literal('HEAD'))\n);\nexport type GigadriveNextPrerenderSeedMethods = Schema.Schema.Type<typeof GigadriveNextPrerenderSeedMethodsSchema>;\n\nexport const GigadriveNextBuildManifestV1Schema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(1),\n output: Schema.Literal('standalone', 'export'),\n distDir: PortableRelativePathSchema,\n repoRootToProject: RepositoryRelativePathSchema,\n nextVersion: Schema.String,\n buildId: Schema.String,\n })\n);\nexport type GigadriveNextBuildManifestV1 = Schema.Schema.Type<typeof GigadriveNextBuildManifestV1Schema>;\n\n/** Minimal plan for static-export builds. */\nexport const GigadriveNextBuildManifestV2ExportSchema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(2),\n mode: Schema.Literal('export'),\n distDir: PortableRelativePathSchema,\n repoRootToProject: RepositoryRelativePathSchema,\n nextVersion: Schema.String,\n buildId: Schema.String,\n })\n);\nexport type GigadriveNextBuildManifestV2Export = Schema.Schema.Type<typeof GigadriveNextBuildManifestV2ExportSchema>;\n\n/** Portable runtime plan for a standalone Next.js server. */\nexport const GigadriveNextBuildManifestV2StandaloneSchema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(2),\n mode: Schema.Literal('standalone-v2'),\n distDir: PortableRelativePathSchema,\n repoRootToProject: RepositoryRelativePathSchema,\n nextVersion: Schema.String,\n buildId: Schema.String,\n server: GigadriveNextServerDescriptorSchema,\n config: Schema.mutable(\n Schema.Struct({\n basePath: Schema.String,\n trailingSlash: Schema.Boolean,\n cacheComponents: Schema.Boolean,\n i18n: Schema.optional(JsonValueSchema),\n images: Schema.optional(ImagePolicySchema),\n })\n ),\n routing: Schema.mutable(\n Schema.Struct({\n beforeMiddleware: JsonValueArraySchema,\n beforeFiles: JsonValueArraySchema,\n afterFiles: JsonValueArraySchema,\n dynamicRoutes: JsonValueArraySchema,\n onMatch: JsonValueArraySchema,\n fallback: JsonValueArraySchema,\n shouldNormalizeNextData: Schema.Boolean,\n rsc: JsonValueSchema,\n })\n ),\n outputs: Schema.mutable(\n Schema.Struct({\n prerenders: PrerenderArraySchema,\n prerenderManifest: Schema.optional(PortableRelativePathSchema),\n assetManifest: Schema.optional(PortableRelativePathSchema),\n entryPagePaths: Schema.optional(Schema.mutable(Schema.Array(UrlPathnameSchema))),\n staticAssets: StaticAssetArraySchema,\n middleware: Schema.optional(GigadriveNextMiddlewareDescriptorSchema),\n })\n ),\n })\n);\nexport type GigadriveNextBuildManifestV2Standalone = Schema.Schema.Type<\n typeof GigadriveNextBuildManifestV2StandaloneSchema\n>;\n\nexport const GigadriveNextBuildManifestSchema = Schema.Union(\n GigadriveNextBuildManifestV1Schema,\n GigadriveNextBuildManifestV2ExportSchema,\n GigadriveNextBuildManifestV2StandaloneSchema\n);\nexport type GigadriveNextBuildManifestV2 = GigadriveNextBuildManifestV2Standalone | GigadriveNextBuildManifestV2Export;\nexport type GigadriveNextBuildManifest = Schema.Schema.Type<typeof GigadriveNextBuildManifestSchema>;\n\n/**\n * Portable sidecar containing high-cardinality Next.js prerender build seeds.\n *\n * `seedMethods` is optional only for parsing sidecars emitted by older SDK\n * releases. New adapters always emit the explicit GET/HEAD method scope.\n */\nexport const GigadriveNextPrerenderManifestV1Schema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(1),\n seedMethods: Schema.optional(GigadriveNextPrerenderSeedMethodsSchema),\n prerenders: PrerenderArraySchema,\n })\n);\nexport type GigadriveNextPrerenderManifestV1 = Schema.Schema.Type<typeof GigadriveNextPrerenderManifestV1Schema>;\n\n/** Parses and structurally validates adapter metadata before deployment code consumes it. */\nexport const parseGigadriveNextBuildManifest = (content: string): GigadriveNextBuildManifest | undefined =>\n decodeJson(GigadriveNextBuildManifestSchema, content);\n\n/** Parses and validates a portable Next.js prerender sidecar. */\nexport const parseGigadriveNextPrerenderManifest = (content: string): GigadriveNextPrerenderManifestV1 | undefined =>\n decodeJson(GigadriveNextPrerenderManifestV1Schema, content);\n","// Define all available regions in a single array\nconst REGION_DEFINITIONS = [\n 'us-east-1',\n 'us-east-2',\n 'us-west-1',\n 'us-west-2',\n 'ap-south-1',\n 'ap-northeast-3',\n 'ap-northeast-2',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ap-northeast-1',\n 'ca-central-1',\n 'eu-central-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'eu-north-1',\n 'sa-east-1',\n] as const;\n\n// Generate the Region type from the array\nexport type Region = (typeof REGION_DEFINITIONS)[number];\n\n// Export the available regions\nexport const AVAILABLE_REGIONS: Region[] = [...REGION_DEFINITIONS];\n","import { FileSystem } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { FrameworkDefinition } from '../types';\n\nconst isVercelBuildOutputV3 = (content: string): boolean => {\n try {\n const config: unknown = JSON.parse(content);\n return (\n typeof config === 'object' &&\n config !== null &&\n 'version' in config &&\n typeof config.version === 'number' &&\n config.version >= 3\n );\n } catch {\n return false;\n }\n};\n\nexport const nuxt: FrameworkDefinition = {\n slug: 'nuxt',\n name: 'Nuxt',\n language: 'node',\n detectors: [{ matchPackage: 'nuxt' }],\n priority: 95,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['nuxt build'],\n entrypoint: '.output/server/index.mjs',\n assetsDir: '.output/public',\n populateAssetCache: true,\n routes: [{ source: '/*', destination: '.output/server/index.mjs' }],\n environmentVariables: { NODE_ENV: 'production', NITRO_PRESET: 'node-server' },\n }),\n refineDefaultConfig: (defaults, projectFolder) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const buildOutputConfig = yield* fs\n .readFileString(`${projectFolder}/.vercel/output/config.json`)\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n\n if (!buildOutputConfig || !isVercelBuildOutputV3(buildOutputConfig)) {\n return defaults;\n }\n\n return {\n ...defaults,\n entrypoint: undefined,\n assetsDir: '.vercel/output/static',\n routes: [],\n environmentVariables: { ...defaults.environmentVariables, NITRO_PRESET: 'vercel' },\n };\n }),\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const remix: FrameworkDefinition = {\n slug: 'remix',\n name: 'Remix',\n language: 'node',\n detectors: [{ matchPackage: '@remix-run/dev' }],\n priority: 90,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['remix build'],\n entrypoint: 'build/server/index.js',\n assetsDir: 'build/client',\n populateAssetCache: true,\n routes: [{ source: '/*', destination: 'build/server/index.js' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const sveltekit: FrameworkDefinition = {\n slug: 'sveltekit',\n name: 'SvelteKit',\n language: 'node',\n detectors: [{ matchPackage: '@sveltejs/kit' }],\n priority: 90,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['vite build'],\n entrypoint: 'build/index.js',\n assetsDir: 'build/client',\n populateAssetCache: true,\n routes: [{ source: '/*', destination: 'build/index.js' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const symfony: FrameworkDefinition = {\n slug: 'symfony',\n name: 'Symfony',\n language: 'php',\n detectors: [{ matchPackage: 'symfony/framework-bundle' }, { path: 'bin/console' }],\n priority: 80,\n getDefaultConfig: () => ({\n runtime: 'php-84',\n memory: 512,\n maxDuration: 30,\n streaming: false,\n installCommand: 'composer install --prefer-dist --optimize-autoloader --no-dev',\n commands: ['bun install', 'bun run build'],\n entrypoint: 'public/index.php',\n assetsDir: 'public',\n populateAssetCache: true,\n excludeFiles: ['tests/*', '.ddev', 'var'],\n symlinks: { var: '/tmp' },\n routes: [{ source: '/*', destination: 'public/index.php' }],\n environmentVariables: {\n APP_ENV: 'prod',\n APP_DEBUG: 'false',\n APP_SECRET: 'please_change_this_value_in_your_settings',\n MESSENGER_TRANSPORT_DSN: 'doctrine://default?auto_setup=0',\n },\n }),\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const vite: FrameworkDefinition = {\n slug: 'vite',\n name: 'Vite',\n language: 'node',\n detectors: [{ matchPackage: 'vite' }],\n priority: 5,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 128,\n maxDuration: 30,\n streaming: false,\n commands: ['vite build'],\n assetsDir: 'dist',\n populateAssetCache: true,\n routes: [],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n};\n","import type { FrameworkDefinition } from '../types';\nimport { astro } from './astro';\nimport { elysia } from './elysia';\nimport { express } from './express';\nimport { fastify } from './fastify';\nimport { hono } from './hono';\nimport { laravel } from './laravel';\nimport { nestjs } from './nestjs';\nimport { nextjs } from './nextjs';\nimport { nuxt } from './nuxt';\nimport { remix } from './remix';\nimport { sveltekit } from './sveltekit';\nimport { symfony } from './symfony';\nimport { vite } from './vite';\n\n/**\n * All supported framework definitions, sorted by priority descending.\n * Higher priority frameworks are checked first during detection.\n */\nexport const FRAMEWORK_DEFINITIONS: FrameworkDefinition[] = [\n nextjs,\n nuxt,\n nestjs,\n remix,\n sveltekit,\n astro,\n laravel,\n symfony,\n hono,\n elysia,\n fastify,\n express,\n vite,\n].sort((a, b) => b.priority - a.priority);\n","import { Effect } from 'effect';\nimport type { NormalizedConfig } from '../normalized-config';\nimport { AVAILABLE_REGIONS } from '../regions';\nimport type { FrameworkDefaultConfig, FrameworkDefinition, PackageManager } from './types';\n\n/**\n * Returns the install command for the given package manager.\n */\nconst getInstallCommand = (pm: PackageManager): string => {\n switch (pm) {\n case 'bun':\n return 'bun install';\n case 'pnpm':\n return 'pnpm install';\n case 'yarn':\n return 'yarn install';\n case 'composer':\n return 'composer install';\n case 'npm':\n default:\n return 'npm install';\n }\n};\n\n/**\n * Generates a NormalizedConfig from a framework definition and detected package manager.\n * Prepends the install command and builds a complete deployment configuration.\n *\n * @param framework - The detected framework definition\n * @param packageManager - The detected package manager\n * @returns A complete NormalizedConfig with framework defaults\n */\nexport const generateConfig = Effect.fn('generateConfig')(function* (\n framework: FrameworkDefinition,\n packageManager: PackageManager,\n refinedDefaults?: FrameworkDefaultConfig\n) {\n const defaults = refinedDefaults ?? framework.getDefaultConfig(packageManager);\n\n const installCmd = defaults.installCommand ?? getInstallCommand(packageManager);\n const commands = [installCmd, ...defaults.commands];\n\n yield* Effect.logDebug(`Generating config for ${framework.name}`, {\n runtime: defaults.runtime,\n entrypoint: defaults.entrypoint,\n commands,\n });\n\n const entrypoints =\n defaults.normalizedConfig?.entrypoints ??\n (defaults.entrypoint\n ? [\n {\n path: defaults.entrypoint,\n runtime: defaults.runtime,\n memory: defaults.memory,\n maxDuration: defaults.maxDuration,\n streaming: defaults.streaming,\n symlinks: defaults.symlinks,\n package: defaults.package,\n },\n ]\n : []);\n\n const routes =\n defaults.normalizedConfig?.routes ??\n (defaults.entrypoint\n ? defaults.routes.map((route) => ({\n path: route.source,\n destination: route.destination,\n handler: defaults.streaming ? ('SERVERLESS_FUNCTION_STREAMING' as const) : ('SERVERLESS_FUNCTION' as const),\n methods: ['ANY' as const],\n headers: {},\n }))\n : []);\n\n const config: NormalizedConfig = {\n regions: [...AVAILABLE_REGIONS],\n environmentVariables: { ...defaults.environmentVariables },\n commands,\n entrypoints,\n routes,\n excludeFiles: defaults.excludeFiles && defaults.excludeFiles.length > 0 ? [...defaults.excludeFiles] : undefined,\n warnings: [`Auto-detected framework: ${framework.name}. Create a gigadrive.yaml to customize.`],\n errors: [],\n ...defaults.normalizedConfig,\n };\n\n if (defaults.assetsDir || defaults.assetPaths || defaults.assetPrefixes || defaults.assetManifests) {\n config.assets = {\n paths: defaults.assetPaths ? [...defaults.assetPaths] : [],\n prefixToStrip: defaults.assetsPrefixToStrip ?? (defaults.assetsDir ? defaults.assetsDir + '/' : ''),\n overrides: defaults.assetOverrides ? { ...defaults.assetOverrides } : undefined,\n prefixes: defaults.assetPrefixes ? defaults.assetPrefixes.map((prefix) => ({ ...prefix })) : undefined,\n manifests: defaults.assetManifests ? defaults.assetManifests.map((manifest) => ({ ...manifest })) : undefined,\n dynamicRoutes: true,\n populateCache: defaults.populateAssetCache ?? false,\n };\n }\n\n return config;\n});\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { FrameworkLanguage } from './types';\nimport { ManifestNotFoundError, ManifestParseError, ManifestReadError } from './types';\n\n/**\n * Manifest file configuration for each supported language.\n */\nconst MANIFEST_CONFIG: Record<FrameworkLanguage, { file: string; depKeys: string[] }> = {\n node: { file: 'package.json', depKeys: ['dependencies', 'devDependencies'] },\n php: { file: 'composer.json', depKeys: ['require', 'require-dev'] },\n};\n\n/**\n * Reads and parses a JSON manifest file, returning the parsed object.\n *\n * @param filePath - Absolute path to the manifest file\n * @returns The parsed JSON object, or fails with ManifestReadError\n */\nconst readManifest = Effect.fn('readManifest')(function* (filePath: string) {\n const fs = yield* FileSystem.FileSystem;\n\n const exists = yield* fs.exists(filePath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (!exists) {\n return yield* Effect.fail(new ManifestNotFoundError({ message: 'Manifest not found', filePath }));\n }\n\n const content = yield* fs\n .readFileString(filePath)\n .pipe(Effect.mapError(() => new ManifestReadError({ message: 'Failed to read manifest', filePath })));\n\n const parsed = yield* Effect.try({\n try: () => JSON.parse(content) as Record<string, unknown>,\n catch: () => new ManifestParseError({ message: 'Failed to parse manifest JSON', filePath }),\n });\n\n return parsed;\n});\n\n/**\n * Reads dependency names from the appropriate manifest file for a language.\n * Returns a set of all dependency names (production + dev).\n *\n * If the manifest file does not exist, returns an empty set (graceful).\n * If the file exists but cannot be read (`ManifestReadError`) or parsed\n * (`ManifestParseError`), the error propagates — this indicates a real\n * problem the user should know about.\n *\n * @param projectFolder - Absolute path to the project root\n * @param language - The framework language to determine which manifest to read\n * @returns A set of dependency package names\n */\nexport const readDependencies = Effect.fn('readDependencies')(function* (\n projectFolder: string,\n language: FrameworkLanguage\n) {\n const pathService = yield* Path.Path;\n const config = MANIFEST_CONFIG[language];\n const filePath = pathService.join(projectFolder, config.file);\n\n const manifest = yield* readManifest(filePath).pipe(\n Effect.catchTag('ManifestNotFoundError', () => Effect.succeed(null))\n );\n\n if (!manifest) {\n return new Set<string>();\n }\n\n const deps = new Set<string>();\n\n for (const key of config.depKeys) {\n const section = manifest[key];\n if (section && typeof section === 'object' && !Array.isArray(section)) {\n for (const name of Object.keys(section)) {\n deps.add(name);\n }\n }\n }\n\n return deps;\n});\n","import type { FileSystem, Path } from '@effect/platform';\nimport { Effect, Schema } from 'effect';\nimport type { NormalizedConfig } from '../normalized-config';\nimport type { Runtime } from '../runtime';\n\n// ---------------------------------------------------------------------------\n// Tagged Errors\n// ---------------------------------------------------------------------------\n\nexport class ManifestNotFoundError extends Schema.TaggedError<ManifestNotFoundError>()('ManifestNotFoundError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class ManifestReadError extends Schema.TaggedError<ManifestReadError>()('ManifestReadError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class ManifestParseError extends Schema.TaggedError<ManifestParseError>()('ManifestParseError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class FrameworkNotDetectedError extends Schema.TaggedError<FrameworkNotDetectedError>()(\n 'FrameworkNotDetectedError',\n {\n message: Schema.String,\n directory: Schema.String,\n }\n) {}\n\n// ---------------------------------------------------------------------------\n// Core Types\n// ---------------------------------------------------------------------------\n\nexport interface FrameworkDetectionItem {\n /** Check manifest dependencies for this package (routed by framework language) */\n matchPackage?: string;\n /** Check if this file exists (relative to project root) */\n path?: string;\n /** If path is set, also check file content matches this regex */\n matchContent?: string;\n}\n\nexport type FrameworkLanguage = 'node' | 'php';\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'composer';\n\nexport interface FrameworkDefinition {\n slug: string;\n name: string;\n language: FrameworkLanguage;\n /** ALL items must match for the framework to be detected */\n detectors: FrameworkDetectionItem[];\n /** Higher = higher priority (specific frameworks beat generic ones) */\n priority: number;\n /** Generates deployment defaults for this framework */\n getDefaultConfig: (packageManager: PackageManager) => FrameworkDefaultConfig;\n /** Refines defaults with project files after a framework match, e.g. framework CLI config. */\n refineDefaultConfig?: (\n defaults: FrameworkDefaultConfig,\n projectFolder: string\n ) => Effect.Effect<FrameworkDefaultConfig, never, FileSystem.FileSystem | Path.Path>;\n}\n\nexport interface FrameworkDefaultConfig {\n runtime: Runtime;\n memory: number;\n maxDuration: number;\n streaming: boolean;\n /** Overrides the auto-generated install command (e.g. for custom composer flags) */\n installCommand?: string;\n /** Build commands (install command is auto-prepended by generateConfig) */\n commands: string[];\n entrypoint?: string;\n assetsDir?: string;\n assetsPrefixToStrip?: string;\n /** Explicit project-relative files to publish as static assets. */\n assetPaths?: string[];\n /** Public path overrides keyed by project-relative asset path. */\n assetOverrides?: Record<string, { path?: string; contentType?: string }>;\n /** Directory subtrees to publish under a URL prefix without per-file enumeration. */\n assetPrefixes?: Array<{\n source: string;\n destination: string;\n immutable?: boolean;\n populateCache?: boolean;\n contentType?: string;\n }>;\n /** Project-relative manifests containing logical static asset entries. */\n assetManifests?: Array<{ source: string }>;\n populateAssetCache?: boolean;\n routes: Array<{ source: string; destination: string }>;\n environmentVariables: Record<string, string>;\n symlinks?: Record<string, string>;\n excludeFiles?: string[];\n package?: {\n trace?: boolean;\n includeProjectFiles?: boolean;\n preserveSymlinks?: boolean;\n rootOverwrite?: string;\n filePathMap?: Record<string, string>;\n includeFiles?: string[];\n excludeFiles?: string[];\n };\n /** Advanced framework output that replaces the one-entrypoint defaults. */\n normalizedConfig?: Partial<NormalizedConfig>;\n}\n\nexport interface DetectionResult {\n framework: FrameworkDefinition;\n packageManager: PackageManager;\n config: NormalizedConfig;\n}\n","import { Effect } from 'effect';\nimport type { NormalizedConfig } from '../normalized-config';\n\n/**\n * Merges framework defaults with a user-provided config.\n * User config always takes precedence; framework defaults fill gaps.\n *\n * - commands: use user's if non-empty, otherwise framework's\n * - entrypoints: use user's if non-empty, otherwise framework's\n * - routes: use user's if non-empty, otherwise framework's\n * - assets: use user's if it declares any sources, otherwise framework's\n * - excludeFiles: use user's if non-empty, otherwise framework's\n * - regions: always use user's (always populated from parsing)\n * - environmentVariables: deep merge (framework base, user overrides)\n * - services: always use user's (frameworks don't define services)\n * - warnings/errors: concatenate both\n *\n * @param userConfig - The config parsed from the user's config file\n * @param frameworkConfig - The config generated from framework detection\n * @returns The merged config\n */\nexport const mergeWithFrameworkDefaults = Effect.fn('mergeWithFrameworkDefaults')(function* (\n userConfig: NormalizedConfig,\n frameworkConfig: NormalizedConfig\n) {\n yield* Effect.logDebug('Merging user config with framework defaults');\n\n const userHasAssets =\n (userConfig.assets?.paths?.length ?? 0) > 0 ||\n (userConfig.assets?.prefixes?.length ?? 0) > 0 ||\n (userConfig.assets?.manifests?.length ?? 0) > 0;\n\n const merged: NormalizedConfig = {\n regions: userConfig.regions,\n\n commands: userConfig.commands.length > 0 ? userConfig.commands : frameworkConfig.commands,\n\n entrypoints: userConfig.entrypoints.length > 0 ? userConfig.entrypoints : frameworkConfig.entrypoints,\n\n routes: userConfig.routes.length > 0 ? userConfig.routes : frameworkConfig.routes,\n\n assets: userHasAssets ? userConfig.assets : frameworkConfig.assets,\n\n environmentVariables: {\n ...frameworkConfig.environmentVariables,\n ...userConfig.environmentVariables,\n },\n\n excludeFiles:\n userConfig.excludeFiles && userConfig.excludeFiles.length > 0\n ? userConfig.excludeFiles\n : frameworkConfig.excludeFiles,\n\n services: userConfig.services,\n userArchive: userConfig.userArchive,\n\n warnings: [...frameworkConfig.warnings, ...userConfig.warnings],\n errors: [...frameworkConfig.errors, ...userConfig.errors],\n };\n\n return merged;\n});\n","import { Schema } from 'effect';\n\nexport class ConfigFileNotFoundError extends Schema.TaggedError<ConfigFileNotFoundError>()('ConfigFileNotFoundError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class ConfigFileEmptyError extends Schema.TaggedError<ConfigFileEmptyError>()('ConfigFileEmptyError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class ConfigFileParseError extends Schema.TaggedError<ConfigFileParseError>()('ConfigFileParseError', {\n message: Schema.String,\n filePath: Schema.String,\n cause: Schema.optional(Schema.String),\n}) {}\n\nexport class ConfigModuleLoadError extends Schema.TaggedError<ConfigModuleLoadError>()('ConfigModuleLoadError', {\n message: Schema.String,\n filePath: Schema.String,\n cause: Schema.optional(Schema.String),\n}) {}\n\nexport class ConfigVersionError extends Schema.TaggedError<ConfigVersionError>()('ConfigVersionError', {\n message: Schema.String,\n filePath: Schema.String,\n version: Schema.optional(Schema.Number),\n}) {}\n\nexport class ConfigSchemaValidationError extends Schema.TaggedError<ConfigSchemaValidationError>()(\n 'ConfigSchemaValidationError',\n {\n message: Schema.String,\n filePath: Schema.String,\n validationErrors: Schema.Array(Schema.String),\n }\n) {}\n\nexport class FunctionConfigError extends Schema.TaggedError<FunctionConfigError>()('FunctionConfigError', {\n message: Schema.String,\n functionPath: Schema.String,\n}) {}\n","import { NormalizedConfig } from './normalized-config';\n\n/**\n * Ensure a normalized config has no function files that are also defined as assets.\n * For example, a file `public/index.php` should not be defined as an asset, when it is a function and `public` is an asset folder.\n * @param config The normalized config to filter.\n * @returns A promise that resolves to the filtered config.\n */\nexport const filterFunctionsFromAssets = (config: NormalizedConfig): NormalizedConfig => {\n return {\n ...config,\n assets: {\n ...config.assets,\n paths: config.assets?.paths?.filter((path) => !config.entrypoints.some((entrypoint) => entrypoint.path === path)),\n },\n };\n};\n","import type { NormalizedImagePolicy } from './image-policy';\nimport type { GigadriveNextBuildManifestV2Standalone } from './nextjs-manifest';\nimport { type Region } from './regions';\nimport { type Runtime } from './runtime';\n\nexport type {\n NormalizedImageFit,\n NormalizedImageFormat,\n NormalizedImageLocalPattern,\n NormalizedImagePolicy,\n NormalizedImageRemotePattern,\n NormalizedImageVariant,\n} from './image-policy';\n\n/**\n * A map of file paths to their corresponding paths in the deployment.\n *\n * Left side should be an absolute path on the file system.\n * Right side should be a relative path in the deployment package.\n */\nexport type FilePathMap = Record<string, string>;\n\n/**\n * The object structure that all config versions will be parsed into.\n * This is done to provide a consistent interface for the rest of the codebase and easily provision the necessary resources, regardless of the config version.\n */\nexport interface NormalizedConfig {\n /**\n * The regions to deploy the project to.\n */\n regions: Region[];\n\n assets?: {\n /**\n * The relative file paths of the static assets to be deployed to the edge.\n */\n paths?: string[];\n\n /**\n * The prefix to strip from the asset path when serving.\n */\n prefixToStrip?: string;\n\n /**\n * Overrides for specific assets. Can be used to change the path or Content-Type of an asset.\n */\n overrides?: Record<\n string,\n {\n path?: string;\n contentType?: string;\n }\n >;\n\n /**\n * Directory subtrees published under a single URL prefix, registered as one\n * descriptor each instead of enumerating every file. Used to collapse\n * high-cardinality immutable trees such as `.next/static` into a single\n * edge-served prefix (one object-storage sync + one route, not one per file).\n */\n prefixes?: Array<{\n /** Project-relative source directory root (e.g. `.next/static`). */\n source: string;\n /** Public URL prefix to serve the subtree under (e.g. `_next/static`). */\n destination: string;\n /** Serve with immutable cache-control (content-hashed assets). */\n immutable?: boolean;\n /** Populate the edge cache for this subtree at deployment time. */\n populateCache?: boolean;\n /** Optional Content-Type override applied to the whole subtree. */\n contentType?: string;\n }>;\n\n /**\n * Project-relative manifests containing logical static asset entries. A\n * manifest keeps high-cardinality path mappings out of this configuration.\n */\n manifests?: Array<{\n /** Project-relative path to a {@link StaticAssetManifest}. */\n source: string;\n }>;\n\n /**\n * Whether routes for the assets should be generated during deployment.\n */\n dynamicRoutes?: boolean;\n\n /**\n * If true, the assets will be cached at the edge during deployment.\n */\n populateCache?: boolean;\n };\n\n /** Framework-specific runtime metadata understood by the Network gateway. */\n framework?: NormalizedFramework;\n\n /** Provider-neutral managed image optimization policy. */\n images?: NormalizedImagePolicy;\n\n /** Content-addressable files mounted into more than one function package. */\n sharedArtifacts?: NormalizedSharedArtifact[];\n\n /**\n * Additional environment variables to set during runtime and build.\n */\n environmentVariables: Record<string, string>;\n\n /**\n * The bash commands that will be run to build the project.\n */\n commands: string[];\n\n entrypoints: Array<NormalizedConfigEntrypoint>;\n\n routes: Array<NormalizedConfigRoute>;\n\n /** Managed infrastructure declarations supplied through `gigadrive.yaml`. */\n services?: NormalizedConfigService[];\n\n /**\n * Settings related to the archive the user uploads to the build workers.\n */\n userArchive?: {\n /**\n * Overwrite the root of the user-uploaded package. This is mostly used for monorepos to make sure all relevant files are included.\n */\n rootOverwrite?: string;\n\n /**\n * Use a whitelist to only include relevant files in monorepos. May be a glob pattern.\n * @see getFilesForPattern\n */\n fileWhitelist?: string[];\n };\n\n /**\n * Glob or regex patterns for files to exclude from the deployment archive.\n * Sourced from framework auto-detection (e.g. `tests/`, `node_modules/`) or\n * user config. Patterns are matched via minimatch and RegExp against relative\n * paths in the project directory.\n */\n excludeFiles?: string[];\n\n /**\n * Warning codes to be printed to the output during deployment.\n */\n warnings: string[];\n\n /**\n * Error codes to be printed to the output during deployment.\n */\n errors: string[];\n}\n\nexport interface NormalizedConfigService {\n type: NormalizedConfigServiceType;\n}\n\n/** Service kinds supported by the normalized deployment configuration. */\nexport type NormalizedConfigServiceType = 'redis' | 'postgres' | 'storage';\n\n/** Fully normalized managed-service declaration consumed by provisioning. */\nexport type NormalizedConfigServiceDefinition =\n NormalizedConfigServiceRedis | NormalizedConfigServicePostgres | NormalizedConfigServiceStorage;\n\nexport type UpstashAWSRegion =\n | 'us-east-1'\n | 'us-east-2'\n | 'us-west-1'\n | 'us-west-2'\n | 'eu-central-1'\n | 'eu-west-1'\n | 'eu-west-2'\n | 'sa-east-1'\n | 'ap-south-1'\n | 'ap-northeast-1'\n | 'ap-southeast-1'\n | 'ap-southeast-2';\n\nexport interface NormalizedConfigServiceRedis extends NormalizedConfigService {\n type: 'redis';\n envBindings?: Record<'url' | 'host' | 'port' | 'password' | 'db' | 'ssl', string>;\n primaryRegion?: UpstashAWSRegion | 'us-central1';\n readRegions?: UpstashAWSRegion[];\n eviction?: boolean;\n}\n\nexport type NeonAWSRegion =\n | 'us-east-1'\n | 'us-east-2'\n | 'us-west-2'\n | 'ap-southeast-1'\n | 'ap-southeast-2'\n | 'eu-central-1'\n | 'eu-west-2'\n | 'sa-east-1';\n\nexport interface NormalizedConfigServicePostgres extends NormalizedConfigService {\n type: 'postgres';\n envBindings?: Record<'url' | 'host' | 'port' | 'user' | 'password' | 'database', string>;\n postgresVersion?: '17' | '16' | '15' | '14';\n region?: NeonAWSRegion;\n}\n\n/** Declarative File Storage service provisioned in the deployment environment. */\nexport interface NormalizedConfigServiceStorage extends NormalizedConfigService {\n type: 'storage';\n /**\n * Buckets sorted by name for deterministic deployment plans.\n *\n * Names are preserved exactly after schema validation. The deployment\n * environment is authoritative, and global CDN/S3 slugs are generated by\n * the File Storage API rather than stored in configuration.\n */\n buckets: NormalizedConfigStorageBucket[];\n}\n\n/** Desired state for one environment-scoped File Storage bucket. */\nexport interface NormalizedConfigStorageBucket {\n /** Immutable environment-scoped API and IaC identifier. */\n name: string;\n /** Access policy to apply when the bucket is first provisioned. */\n visibility: 'public' | 'private';\n}\n\n/** Default maximum lifetime of one function invocation, in seconds. */\nexport const DEFAULT_FUNCTION_DURATION_SECONDS = 30;\n\n/** Maximum configurable lifetime of one function invocation, in seconds (eight hours). */\nexport const MAX_FUNCTION_DURATION_SECONDS = 28_800;\n\nexport interface NormalizedConfigEntrypoint {\n displayName?: string;\n path: string;\n runtime: Runtime;\n memory: number;\n /**\n * Maximum lifetime of one HTTP request, response stream, or WebSocket connection, in seconds.\n *\n * The limit applies to an invocation, not to the reusable compute environment that happens to\n * serve it. The platform may suspend or reuse that environment after all invocations finish.\n */\n maxDuration: number;\n schedule?: string;\n symlinks?: Record<string, string>;\n environmentVariables?: Record<string, string>;\n streaming?: boolean;\n package?: {\n /** Disable dependency tracing when the framework output is already self-contained. */\n trace?: boolean;\n /** Include the package root in addition to explicitly mapped files. Defaults to true. */\n includeProjectFiles?: boolean;\n /** Preserve mapped symbolic links instead of recursively copying their targets. */\n preserveSymlinks?: boolean;\n rootOverwrite?: string;\n filePathMap?: FilePathMap;\n includeFiles?: string[];\n excludeFiles?: string[];\n /** Shared deployment artifacts that must be mounted before this overlay. */\n sharedArtifactIds?: string[];\n };\n}\n\nexport type NormalizedFramework = NormalizedNextjsFramework;\n\n/**\n * Framework runtime metadata the Network gateway consumes. Mirrors the single\n * standalone-server manifest (minus the wire `version`) plus the persisted\n * discriminators. The whole deployment runs as one standalone server, so this\n * carries prerender/routing/image metadata but no per-route entrypoints.\n */\nexport type NormalizedNextjsFramework = Omit<GigadriveNextBuildManifestV2Standalone, 'version' | 'outputs'> & {\n outputs: Omit<GigadriveNextBuildManifestV2Standalone['outputs'], 'entryPagePaths'>;\n type: 'nextjs';\n schemaVersion: 2;\n /**\n * Bounded sample of prerendered page paths, used to warm the CDN. Replaces\n * carrying the deployment's full prerender table, which grew to tens of\n * thousands of entries on large content sites.\n */\n entryPagePaths?: string[];\n};\n\nexport interface NormalizedSharedArtifact {\n id: string;\n filePathMap: FilePathMap;\n}\n\nexport interface NormalizedConfigRoute {\n path: string;\n destination: string;\n handler: NormalizedConfigRouteHandler | undefined;\n methods: NormalizedConfigRouteMethod[];\n headers: Record<string, string>;\n positiveRequirements?: NormalizedConfigRouteMatchRequirements;\n negativeRequirements?: NormalizedConfigRouteMatchRequirements;\n status?: number;\n}\n\nexport type NormalizedConfigRouteHandler =\n 'SERVERLESS_FUNCTION' | 'SERVERLESS_FUNCTION_STREAMING' | 'HTTP_REDIRECT' | 'HTTP_PROXY' | 'ASSET';\n\nexport type NormalizedConfigRouteMethod = 'ANY' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';\n\nexport type NormalizedConfigRouteMatchRequirements =\n | []\n | [\n | {\n /**\n * The type of request element to check\n */\n type: 'host';\n /**\n * A regular expression used to match the value. Named groups can be used in the destination\n */\n value: string;\n }\n | {\n /**\n * The type of request element to check\n */\n type: 'header' | 'cookie' | 'query';\n /**\n * The name of the element contained in the particular type\n */\n key: string;\n /**\n * A regular expression used to match the value. Named groups can be used in the destination\n */\n value?: string;\n },\n ];\n","import { Effect } from 'effect';\nimport { ConfigVersionError } from './errors';\nimport { filterFunctionsFromAssets } from './filter-functions-from-assets';\nimport type { NormalizedConfig } from './normalized-config';\nimport { RawConfigReader } from './services/raw-config-reader';\nimport { SchemaValidator } from './services/schema-validator';\nimport { V4ConfigParser } from './services/v4-config-parser';\nimport { VercelBuildOutputParser } from './services/vercel-build-output-parser';\nimport type { ConfigV4 } from './v4';\nimport schemaV4 from './v4/schema.json';\n\nexport interface Config {\n version: number;\n env?: Record<string, string>;\n}\n\n/**\n * Parses a config file at the given path and validates it against the appropriate\n * JSON Schema, returning a NormalizedConfig **without** post-processing.\n *\n * Use {@link parseConfig} when you also want Vercel BOv3 merging, empty-deployment\n * checks, and function/asset deduplication applied automatically.\n *\n * @param filePath - Absolute path to the config file\n * @param projectFolder - Absolute path to the project root\n */\nexport const parseConfigRaw = Effect.fn('parseConfigRaw')(function* (filePath: string, projectFolder: string) {\n const rawReader = yield* RawConfigReader;\n const validator = yield* SchemaValidator;\n const v4Parser = yield* V4ConfigParser;\n\n const parsed = yield* rawReader.readRawConfig(filePath);\n const version = parsed.version as number;\n\n const schemaMap: Record<number, object> = {\n 4: schemaV4,\n };\n\n const schema = schemaMap[version];\n\n if (!schema) {\n return yield* Effect.fail(\n new ConfigVersionError({\n message: `Config file at ${filePath} has an unsupported version: ${version}`,\n filePath,\n version,\n })\n );\n }\n\n yield* validator.validate(parsed, schema, filePath);\n\n return yield* v4Parser.parse(parsed as unknown as ConfigV4, projectFolder);\n});\n\n/**\n * Parses a config file at the given path, validates it against the appropriate\n * JSON Schema, converts it to a NormalizedConfig, and applies post-processing.\n *\n * @param filePath - Absolute path to the config file\n * @param projectFolder - Absolute path to the project root\n */\nexport const parseConfig = Effect.fn('parseConfig')(function* (filePath: string, projectFolder: string) {\n const parseResult: NormalizedConfig = yield* parseConfigRaw(filePath, projectFolder);\n return yield* postProcessConfig(parseResult, projectFolder);\n});\n\n/**\n * Applies post-processing transformers to a NormalizedConfig:\n * - Vercel Build Output v3 (merges functions/routes from .vercel/output if present)\n * - Empty deployment validation\n * - Filter functions from assets\n *\n * @param config - The parsed NormalizedConfig\n * @param projectFolder - Absolute path to the project root\n * @returns The post-processed NormalizedConfig\n */\nexport const postProcessConfig = Effect.fn('postProcessConfig')(function* (\n config: NormalizedConfig,\n projectFolder: string\n) {\n const vercelParser = yield* VercelBuildOutputParser;\n let result = yield* vercelParser.parse(config, projectFolder);\n const hasAssets =\n (result.assets?.paths?.length ?? 0) > 0 ||\n (result.assets?.prefixes?.length ?? 0) > 0 ||\n (result.assets?.manifests?.length ?? 0) > 0;\n\n // Stricter check first: no functions, no assets, AND no routes → error\n if (result.entrypoints.length === 0 && !hasAssets && result.routes.length === 0) {\n result.errors.push(\n 'The current project config does not resolve to any functions, assets or routes and can not be deployed.'\n );\n } else if (result.entrypoints.length === 0 && !hasAssets) {\n result.warnings.push('The current project does not have any functions or assets to deploy.');\n }\n\n result = filterFunctionsFromAssets(result);\n\n return result;\n});\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport { parse as parseYaml } from 'yaml';\nimport { ConfigFileEmptyError, ConfigFileNotFoundError, ConfigFileParseError, ConfigVersionError } from '../errors';\nimport { ConfigModuleLoader } from './config-module-loader';\n\nexport const ALLOWED_CONFIG_NAMES = [\n 'gigadrive.ts',\n 'gigadrive.mts',\n 'gigadrive.cts',\n 'gigadrive.js',\n 'gigadrive.mjs',\n 'gigadrive.cjs',\n 'gigadrive.yaml',\n 'gigadrive.yml',\n 'gigadrive.json',\n 'nebula.yaml',\n 'nebula.yml',\n 'nebula.json',\n] as const;\n\nconst MODULE_EXTENSIONS = ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs'];\n\nexport class RawConfigReader extends Effect.Service<RawConfigReader>()('RawConfigReader', {\n dependencies: [ConfigModuleLoader.Default],\n effect: Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n const moduleLoader = yield* ConfigModuleLoader;\n\n /**\n * Scans for a known config filename in the given project folder.\n *\n * @param projectFolder - Absolute path to the project root\n * @returns The absolute path to the first matching config file, or null\n */\n const findConfig = Effect.fn('RawConfigReader.findConfig')(function* (projectFolder: string) {\n for (const name of ALLOWED_CONFIG_NAMES) {\n const filePath = pathService.join(projectFolder, name);\n const exists = yield* fs.exists(filePath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (exists) {\n return filePath;\n }\n }\n return null as string | null;\n });\n\n /**\n * Reads a config file from disk and parses it as YAML or JSON.\n * TypeScript/JavaScript config files (.ts/.mts/.cts/.js/.mjs/.cjs) are\n * evaluated as modules and must default-export the config object\n * (`module.exports` for CommonJS files).\n *\n * @param filePath - Absolute path to the config file\n * @param options - Optional settings (e.g. disableVersionCheck)\n * @returns The parsed config as a record\n */\n const readRawConfig = Effect.fn('RawConfigReader.readRawConfig')(function* (\n filePath: string,\n options?: { disableVersionCheck?: boolean }\n ) {\n const exists = yield* fs.exists(filePath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (!exists) {\n return yield* Effect.fail(\n new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })\n );\n }\n\n const fileContents = yield* fs\n .readFileString(filePath)\n .pipe(\n Effect.mapError(\n () => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })\n )\n );\n\n if (fileContents.length === 0) {\n return yield* Effect.fail(\n new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })\n );\n }\n\n const fileExtension = pathService.extname(filePath).toLowerCase();\n\n let parsed: Record<string, unknown>;\n if (MODULE_EXTENSIONS.includes(fileExtension)) {\n parsed = yield* moduleLoader.loadConfigModule(filePath);\n } else {\n try {\n if (fileExtension === '.json') {\n parsed = JSON.parse(fileContents) as Record<string, unknown>;\n } else {\n parsed = parseYaml(fileContents) as Record<string, unknown>;\n }\n } catch (error) {\n return yield* Effect.fail(\n new ConfigFileParseError({\n message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : 'Unknown error'}`,\n filePath,\n cause: error instanceof Error ? error.message : undefined,\n })\n );\n }\n }\n\n if (parsed == null) {\n return yield* Effect.fail(\n new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })\n );\n }\n\n if (!options?.disableVersionCheck && typeof parsed.version !== 'number') {\n return yield* Effect.fail(\n new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })\n );\n }\n\n return parsed;\n });\n\n /**\n * Convenience wrapper: reads and parses a config file, returning null if the file\n * does not exist. Version checking is disabled (used for Vercel build output files).\n *\n * @param configFilePath - Absolute path to the config file\n * @returns The parsed object cast to T, or null when not found\n */\n const readConfigFile = <T>(configFilePath: string) =>\n readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(\n Effect.map((parsed) => parsed as unknown as T),\n Effect.catchTag('ConfigFileNotFoundError', () => Effect.succeed(null as T | null)),\n Effect.withSpan('RawConfigReader.readConfigFile')\n );\n\n return { findConfig, readRawConfig, readConfigFile };\n }),\n}) {}\n","import { Effect } from 'effect';\nimport { createJiti } from 'jiti';\nimport { ConfigModuleLoadError } from '../errors';\n\n/** Sentinel distinguishing \"module has no default export\" from `export default undefined`. */\nconst MISSING_DEFAULT_EXPORT = Symbol('MissingDefaultExport');\n\n/**\n * Extensions that can only be ESM-authored, where a missing default export is\n * a user mistake worth a specific error. `.js`, `.cjs`, and `.cts` files may\n * be CommonJS, whose `module.exports` only surfaces through jiti's interop\n * default rather than as a genuine `default` binding.\n */\nconst STRICT_DEFAULT_EXPORT_EXTENSIONS = ['.ts', '.mts', '.mjs'];\n\nexport class ConfigModuleLoader extends Effect.Service<ConfigModuleLoader>()('ConfigModuleLoader', {\n effect: Effect.gen(function* () {\n /**\n * Evaluates a TypeScript or JavaScript config module (e.g. gigadrive.ts)\n * and returns its default export (`module.exports` for CommonJS files).\n * Relative imports and node_modules are resolved from the config file's\n * own directory, so `import { defineConfig } from\n * '@gigadrive/network-config'` works when the package is installed in the\n * user's project.\n *\n * @param filePath - Absolute path to the config module\n * @returns The module's default export as a record\n */\n const loadConfigModule = Effect.fn('ConfigModuleLoader.loadConfigModule')(function* (filePath: string) {\n const extension = filePath.slice(filePath.lastIndexOf('.')).toLowerCase();\n\n const mod = yield* Effect.tryPromise({\n try: async () => {\n const jiti = createJiti(filePath, { fsCache: false, interopDefault: true, moduleCache: false });\n const namespace: unknown = await jiti.import(filePath);\n if (typeof namespace === 'object' && namespace !== null && 'default' in namespace) {\n return namespace.default;\n }\n if (!STRICT_DEFAULT_EXPORT_EXTENSIONS.includes(extension)) {\n return (namespace as { default?: unknown }).default ?? MISSING_DEFAULT_EXPORT;\n }\n return MISSING_DEFAULT_EXPORT;\n },\n catch: (error) =>\n new ConfigModuleLoadError({\n message: `Failed to load config module at ${filePath}: ${error instanceof Error ? error.message : 'Unknown error'}`,\n filePath,\n cause: error instanceof Error ? error.message : undefined,\n }),\n });\n\n if (mod === MISSING_DEFAULT_EXPORT) {\n return yield* Effect.fail(\n new ConfigModuleLoadError({\n 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.`,\n filePath,\n })\n );\n }\n\n if (typeof mod === 'function') {\n return yield* Effect.fail(\n new ConfigModuleLoadError({\n message: `Config module at ${filePath} default-exports a function; config factories are not supported. Export a config object instead (optionally wrapped in defineConfig).`,\n filePath,\n })\n );\n }\n\n if (typeof mod !== 'object' || mod === null || Array.isArray(mod)) {\n return yield* Effect.fail(\n new ConfigModuleLoadError({\n message: `Config module at ${filePath} must default-export a config object.`,\n filePath,\n })\n );\n }\n\n return mod as Record<string, unknown>;\n });\n\n return { loadConfigModule };\n }),\n}) {}\n","import Ajv from 'ajv';\nimport addFormats from 'ajv-formats';\nimport { Effect } from 'effect';\nimport { ConfigSchemaValidationError } from '../errors';\n\nexport class SchemaValidator extends Effect.Service<SchemaValidator>()('SchemaValidator', {\n effect: Effect.gen(function* () {\n const ajv = new Ajv();\n addFormats(ajv);\n\n /**\n * Validates a parsed config object against a JSON Schema.\n *\n * @param config - The parsed config record\n * @param schema - The JSON Schema to validate against\n * @param filePath - Path used in error messages\n */\n const validate = Effect.fn('SchemaValidator.validate')(function* (\n config: Record<string, unknown>,\n schema: object,\n filePath: string\n ) {\n const compiledValidate = ajv.compile(schema);\n const valid = compiledValidate(config);\n\n if (!valid) {\n const errors = compiledValidate.errors?.map((e) => `${e.instancePath || '/'} ${e.message ?? ''}`.trim()) ?? [];\n return yield* Effect.fail(\n new ConfigSchemaValidationError({\n message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,\n filePath,\n validationErrors: errors,\n })\n );\n }\n });\n\n return { validate };\n }),\n}) {}\n","import { FileSystem, Path } from '@effect/platform';\nimport { getFilesForPattern } from '@gigadrive/build-utils';\nimport { Effect } from 'effect';\nimport { minimatch } from 'minimatch';\nimport safeRegex from 'safe-regex2';\nimport { FunctionConfigError } from '../errors';\nimport {\n DEFAULT_FUNCTION_DURATION_SECONDS,\n type NormalizedConfigEntrypoint,\n type NormalizedConfigRoute,\n type NormalizedConfigRouteHandler,\n type NormalizedConfigServiceDefinition,\n type NormalizedImagePolicy,\n} from '../normalized-config';\nimport { AVAILABLE_REGIONS, type Region } from '../regions';\nimport type { ConfigV4, ConfigV4FunctionSettings } from '../v4';\n\n/**\n * Maximum directory nesting depth for asset collection.\n * Guards against symlink-induced infinite recursion where constructed paths\n * grow monotonically (e.g. `/assets/link/link/link/...`).\n */\nconst MAX_ASSET_DEPTH = 100;\n\nconst DISALLOWED_ASSET_EXTENSIONS = ['.htaccess', '.htpasswd'];\n\nconst DEFAULT_FUNCTION_SETTINGS: Required<Pick<ConfigV4FunctionSettings, 'memory' | 'max_duration'>> &\n Pick<ConfigV4FunctionSettings, 'schedule' | 'symlinks' | 'excludeFiles' | 'includeFiles'> = {\n memory: 128,\n max_duration: DEFAULT_FUNCTION_DURATION_SECONDS,\n schedule: undefined,\n symlinks: undefined,\n excludeFiles: undefined,\n includeFiles: undefined,\n};\n\nconst toArray = (value: string | string[] | undefined): string[] | undefined => {\n if (value == null) return undefined;\n return Array.isArray(value) ? value : [value];\n};\n\nconst runtimeStreamsByDefault = (runtime: ConfigV4FunctionSettings['runtime'] | undefined): boolean =>\n runtime == null || runtime.startsWith('node-') || runtime.startsWith('bun-');\n\nconst normalizeImagePolicy = (images: ConfigV4['images']): NormalizedImagePolicy | undefined => {\n if (!images) return undefined;\n return {\n localPatterns: images.localPatterns ?? [{ pathname: '/**' }],\n remotePatterns: images.remotePatterns ?? [],\n widths: images.widths ?? [640, 750, 828, 1080, 1200, 1920, 2048, 3840],\n heights: images.heights ?? [],\n qualities: images.qualities ?? [75],\n formats: images.formats ?? ['image/avif', 'image/webp'],\n minimumCacheTTL: images.minimumCacheTTL ?? 14_400,\n dangerouslyAllowSVG: images.dangerouslyAllowSVG ?? false,\n contentSecurityPolicy: images.contentSecurityPolicy ?? \"default-src 'self'; script-src 'none'; sandbox;\",\n contentDispositionType: images.contentDispositionType ?? 'attachment',\n maximumRedirects: images.maximumRedirects ?? 3,\n maximumResponseBody: images.maximumResponseBody ?? 50 * 1024 * 1024,\n variants: images.variants ?? {},\n };\n};\n\n/**\n * Converts keyed v4 service declarations into the stable normalized list used\n * by deployment provisioning.\n *\n * Storage bucket names are preserved exactly after schema validation and\n * sorted to keep deployment plans deterministic. Bucket visibility defaults\n * to private, matching the File Storage API creation contract.\n */\nconst normalizeServices = (services: ConfigV4['services']): NormalizedConfigServiceDefinition[] | undefined => {\n if (services == null) return undefined;\n\n const normalized: NormalizedConfigServiceDefinition[] = [];\n\n if (services.redis !== undefined) {\n normalized.push({ type: 'redis', ...(services.redis ?? {}) });\n }\n\n if (services.postgres !== undefined) {\n normalized.push({ type: 'postgres', ...(services.postgres ?? {}) });\n }\n\n if (services.storage !== undefined) {\n normalized.push({\n type: 'storage',\n buckets: Object.entries(services.storage.buckets)\n .map(([name, bucket]) => ({ name, visibility: bucket?.visibility ?? 'private' }))\n .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0)),\n });\n }\n\n return normalized.length > 0 ? normalized : undefined;\n};\n\nconst normalizeRouteDestination = (destination: string): string => {\n const [withoutHash] = destination.split('#', 1);\n const [withoutQuery] = withoutHash.split('?', 1);\n return withoutQuery.replace(/^\\/+/, '');\n};\n\nconst destinationMatchesEntrypoint = (destination: string, entrypointPath: string): boolean => {\n const normalizedDestination = normalizeRouteDestination(destination);\n if (normalizedDestination === entrypointPath) return true;\n if (!normalizedDestination.includes('$')) return false;\n\n const pattern = normalizedDestination.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\\\\\$[\\w]+/g, '.+');\n return new RegExp(`^${pattern}$`).test(entrypointPath);\n};\n\n// -- Pure helpers (no Effect needed) ----------------------------------------------------------\n\n/**\n * Tests whether a path matches a function pattern via glob or safe regex.\n */\nconst matchesPattern = (path: string, pattern: string): boolean => {\n if (minimatch(path, pattern)) return true;\n\n try {\n if (safeRegex(pattern)) {\n return new RegExp(pattern).test(path);\n }\n } catch {\n // pattern is not valid regex (e.g. glob like **), skip\n }\n\n return false;\n};\n\n/**\n * Resolves merged function settings for a given path by iterating all function\n * patterns in the config. Later patterns override earlier ones.\n *\n * @returns The merged settings, or undefined when no pattern matches the path.\n */\nexport const getFunctionSettings = (path: string, config: ConfigV4): ConfigV4FunctionSettings | undefined => {\n let settings: ConfigV4FunctionSettings | undefined;\n\n for (const [pattern, value] of Object.entries(config.functions ?? {})) {\n if (!matchesPattern(path, pattern)) continue;\n\n settings = { ...DEFAULT_FUNCTION_SETTINGS, ...settings, ...value };\n }\n\n return settings;\n};\n\n/**\n * Determines the route handler type based on destination and redirect flag.\n */\nconst resolveRouteHandler = (\n destination: string,\n redirect: boolean | undefined,\n entrypoints: readonly NormalizedConfigEntrypoint[] = []\n): NormalizedConfigRouteHandler => {\n const isExternal =\n destination.toLowerCase().startsWith('http://') || destination.toLowerCase().startsWith('https://');\n\n if (redirect === true) return 'HTTP_REDIRECT';\n if (isExternal) return 'HTTP_PROXY';\n\n const matchingEntrypoints = entrypoints.filter((item) => destinationMatchesEntrypoint(destination, item.path));\n return matchingEntrypoints.length > 0 && matchingEntrypoints.every((entrypoint) => entrypoint.streaming === true)\n ? 'SERVERLESS_FUNCTION_STREAMING'\n : 'SERVERLESS_FUNCTION';\n};\n\n/** Type guard that validates a string is a known Region. */\nconst isRegion = (r: string): r is Region => AVAILABLE_REGIONS.includes(r as Region);\n\n/**\n * Resolves the region list from config, expanding 'global' to all available regions.\n */\nconst resolveRegions = (configRegions?: string[] | null): Region[] => {\n if (configRegions?.includes('global') === true) return AVAILABLE_REGIONS;\n const valid = configRegions?.filter(isRegion);\n return valid && valid.length > 0 ? valid : AVAILABLE_REGIONS;\n};\n\n/**\n * Maps a V4 route definition to a NormalizedConfigRoute.\n */\nconst mapRoute = (\n route: NonNullable<ConfigV4['routes']>[number],\n entrypoints: readonly NormalizedConfigEntrypoint[]\n): NormalizedConfigRoute => ({\n path: route.source,\n destination: route.destination,\n handler: resolveRouteHandler(route.destination, route.redirect, entrypoints),\n headers: route.headers ?? {},\n methods: route.methods ?? ['ANY'],\n positiveRequirements: route.has,\n negativeRequirements: route.missing,\n status: route.statusCode,\n});\n\n// -- Effectful helpers ------------------------------------------------------------------------\n\n/**\n * Resolves function entrypoints from the config's `functions` section.\n */\nconst parseEntrypoints = Effect.fn('parseEntrypoints')(function* (config: ConfigV4, projectFolder: string) {\n const entrypoints: NormalizedConfigEntrypoint[] = [];\n if (config.functions == null) return entrypoints;\n\n for (const [fnPath, func] of Object.entries(config.functions)) {\n if (getFunctionSettings(fnPath, config) == null) {\n return yield* new FunctionConfigError({\n message: `Settings invalid for function at path '${fnPath}'`,\n functionPath: fnPath,\n });\n }\n\n const matchedFiles = yield* Effect.tryPromise({\n try: () => getFilesForPattern(fnPath, projectFolder, func.excludeFiles),\n catch: (error) =>\n new FunctionConfigError({\n message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,\n functionPath: fnPath,\n }),\n });\n\n for (const file of matchedFiles) {\n if (entrypoints.some((ep) => ep.path === file)) continue;\n if (Object.keys(config.functions).some((f) => f === file && f !== fnPath)) continue;\n\n const settings = getFunctionSettings(file, config);\n if (settings == null) {\n return yield* new FunctionConfigError({\n message: `Settings invalid for function at path '${file}'`,\n functionPath: file,\n });\n }\n\n const runtime = settings.runtime ?? 'node-20';\n const streaming = settings.streaming ?? runtimeStreamsByDefault(runtime);\n\n entrypoints.push({\n path: file,\n runtime,\n memory: settings.memory ?? 128,\n maxDuration: settings.max_duration ?? DEFAULT_FUNCTION_DURATION_SECONDS,\n schedule: func.schedule,\n symlinks: func.symlinks,\n streaming,\n package:\n settings.includeFiles != null || settings.excludeFiles != null\n ? {\n includeFiles: toArray(settings.includeFiles),\n excludeFiles: toArray(settings.excludeFiles),\n }\n : undefined,\n });\n }\n }\n\n return entrypoints;\n});\n\n/**\n * Collects static asset paths from the configured assets directory.\n */\nconst collectAssets = Effect.fn('collectAssets')(function* (config: ConfigV4, projectFolder: string) {\n if (config.assets == null) return [] as string[];\n\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n\n const assetsPath = pathService.join(projectFolder, config.assets);\n const assetsExist = yield* fs.exists(assetsPath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (!assetsExist) return [] as string[];\n\n const stat = yield* fs.stat(assetsPath).pipe(Effect.catchAll(() => Effect.succeed(null)));\n if (!stat || stat.type !== 'Directory') return [] as string[];\n\n const allFiles = yield* collectFilesRecursively(assetsPath);\n const assets: string[] = [];\n\n for (const assetName of allFiles) {\n if (DISALLOWED_ASSET_EXTENSIONS.some((ext) => assetName.toLowerCase().endsWith(ext.toLowerCase()))) continue;\n if (getFunctionSettings(`${config.assets}/${assetName}`, config) != null) continue;\n\n assets.push(`${config.assets}/${assetName}`);\n }\n\n return assets;\n});\n\n/**\n * Recursively collects all file paths relative to the base directory.\n */\nconst collectFilesRecursively: (\n basePath: string,\n relativePath?: string,\n depth?: number\n) => Effect.Effect<string[], never, FileSystem.FileSystem | Path.Path> = Effect.fn('collectFilesRecursively')(\n function* (basePath: string, relativePath: string = '', depth: number = 0) {\n if (depth > MAX_ASSET_DEPTH) return [] as string[];\n\n const fs = yield* FileSystem.FileSystem;\n const pathSvc = yield* Path.Path;\n\n const currentPath = relativePath ? pathSvc.join(basePath, relativePath) : basePath;\n\n const entries = yield* fs.readDirectory(currentPath).pipe(Effect.catchAll(() => Effect.succeed([] as string[])));\n const result: string[] = [];\n\n for (const name of entries) {\n const fullPath = pathSvc.join(currentPath, name);\n const entryRelative = relativePath ? pathSvc.join(relativePath, name) : name;\n const stat = yield* fs.stat(fullPath).pipe(Effect.catchAll(() => Effect.succeed(null)));\n\n if (!stat) continue;\n\n if (stat.type === 'Directory') {\n const nested = yield* collectFilesRecursively(basePath, entryRelative, depth + 1);\n result.push(...nested);\n } else {\n result.push(entryRelative);\n }\n }\n\n return result;\n }\n);\n\n// -- Service ----------------------------------------------------------------------------------\n\nexport class V4ConfigParser extends Effect.Service<V4ConfigParser>()('V4ConfigParser', {\n accessors: true,\n\n effect: Effect.succeed({\n /**\n * Parses a ConfigV4 into a NormalizedConfig.\n *\n * @param config - The raw V4 config object\n * @param projectFolder - Absolute path to the project root\n */\n parse: Effect.fn('V4ConfigParser.parse')(function* (config: ConfigV4, projectFolder: string) {\n const entrypoints = yield* parseEntrypoints(config, projectFolder);\n const assets = yield* collectAssets(config, projectFolder);\n\n return {\n regions: resolveRegions(config.regions),\n assets: {\n paths: assets.sort(),\n prefixToStrip: (config.assets ?? '') + '/',\n dynamicRoutes: true,\n populateCache: config.populateAssetCache ?? false,\n },\n environmentVariables: config.env ?? {},\n commands: config.build_commands ?? [],\n images: normalizeImagePolicy(config.images),\n services: normalizeServices(config.services),\n entrypoints,\n errors: [],\n warnings: [],\n routes: (config.routes ?? []).map((route) => mapRoute(route, entrypoints)),\n };\n }),\n }),\n}) {}\n","import { minimatch } from 'minimatch';\nimport { readdir } from 'node:fs/promises';\n\n/**\n * Gets paths to all files that match a certain pattern (glob or regex) in a given project folder.\n * @param pattern The pattern to match files against. Can be a glob or regex pattern.\n * @param projectFolder The folder to search for files in.\n * @param excludeFiles An array of file names, folder names, glob patterns or regex patterns to exclude from the search.\n */\nexport const getFilesForPattern = async (\n pattern: string,\n projectFolder: string,\n excludeFiles: string | string[] = []\n): Promise<string[]> => {\n const files: string[] = [];\n const filesInFolder = await readdir(projectFolder, { recursive: true });\n const exactFiles = new Set(filesInFolder.filter((file): file is string => typeof file === 'string'));\n\n let regex: RegExp | null = null;\n\n if (!exactFiles.has(pattern)) {\n try {\n regex = new RegExp(`^(?:${pattern})$`);\n } catch {\n // ignored\n }\n }\n\n const finalExclusions = Array.isArray(excludeFiles) ? excludeFiles : [excludeFiles];\n\n for (const file of filesInFolder) {\n if (typeof file !== 'string') {\n continue;\n }\n\n if (\n finalExclusions.some((excludeFile) => {\n if (minimatch(file, excludeFile)) {\n return true;\n }\n\n if (!exactFiles.has(excludeFile)) {\n try {\n return new RegExp(`^(?:${excludeFile})$`).test(file);\n } catch {\n return false;\n }\n }\n\n return false;\n })\n ) {\n continue;\n }\n\n if (minimatch(file, pattern) || (regex != null && regex.test(file))) {\n files.push(file);\n }\n }\n\n return files;\n};\n","import { Path } from '@effect/platform';\nimport { getFilesForPattern } from '@gigadrive/build-utils';\nimport { deepMerge } from '@gigadrive/commons';\nimport { Effect } from 'effect';\nimport { type Config, type ServerlessFunctionConfig } from '../build-output-v3';\nimport { determineRepoRoot } from '../build-output-v3/determine-repo-root';\nimport { getDefaultPathMap } from '../build-output-v3/get-default-path-map';\nimport { getMonorepoFiles } from '../build-output-v3/get-monorepo-files';\nimport { translateVercelRegion } from '../build-output-v3/translate-vercel-region';\nimport { translateVercelRuntime } from '../build-output-v3/translate-vercel-runtime';\nimport { ConfigFileParseError } from '../errors';\nimport type {\n NormalizedConfig,\n NormalizedConfigRoute,\n NormalizedConfigRouteHandler,\n NormalizedConfigRouteMethod,\n} from '../normalized-config';\nimport type { Region } from '../regions';\nimport { RawConfigReader } from './raw-config-reader';\n\nconst CONFIG_PATH = '.vercel/output/config.json';\nconst FUNCTIONS_FOLDER = '.vercel/output/functions';\nconst FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;\n\nexport class VercelBuildOutputParser extends Effect.Service<VercelBuildOutputParser>()('VercelBuildOutputParser', {\n effect: Effect.gen(function* () {\n const rawConfigReader = yield* RawConfigReader;\n const pathService = yield* Path.Path;\n\n /**\n * Transforms a parsed config using Vercel's Build Output API v3.\n *\n * @param parseResult - The base NormalizedConfig\n * @param projectFolder - Absolute path to the project root\n */\n const parse = Effect.fn('VercelBuildOutputParser.parse')(function* (\n parseResult: NormalizedConfig,\n projectFolder: string\n ) {\n const config = yield* rawConfigReader.readConfigFile<Config>(pathService.join(projectFolder, CONFIG_PATH));\n\n if (!config || typeof config.version !== 'number' || config.version < 3) {\n return parseResult;\n }\n\n const functionData = yield* loadFunctions(config, parseResult, projectFolder);\n const assetOverrides = loadAssetOverrides(config, parseResult);\n const imagePolicy = loadImagePolicy(config);\n\n const merged = deepMerge(parseResult, functionData, assetOverrides, imagePolicy);\n merged.regions = [...new Set(merged.regions)] as Region[];\n return merged;\n });\n\n const loadFunctions = Effect.fn('VercelBuildOutputParser.loadFunctions')(function* (\n config: Config,\n parseResult: NormalizedConfig,\n projectFolder: string\n ) {\n const functionConfigs = yield* Effect.tryPromise({\n try: () => getFilesForPattern(FUNCTION_CONFIGS_PATTERN, projectFolder),\n catch: (error) =>\n new ConfigFileParseError({\n message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,\n filePath: projectFolder,\n }),\n });\n\n const result: Partial<NormalizedConfig> = {\n entrypoints: [],\n routes: [],\n regions: [],\n errors: [],\n };\n\n for (const functionConfigPath of functionConfigs) {\n const functionConfig = yield* rawConfigReader.readConfigFile<ServerlessFunctionConfig>(\n pathService.join(projectFolder, functionConfigPath)\n );\n\n if (!functionConfig) {\n result.errors!.push(`Failed to read function config at ${functionConfigPath}`);\n continue;\n }\n\n const functionPathRelative = pathService.dirname(functionConfigPath).replace(FUNCTIONS_FOLDER, '');\n const functionName = functionPathRelative.replace(/^\\/|\\.func$/g, '');\n const runtime = translateVercelRuntime(functionConfig.runtime);\n\n if (!runtime) {\n result.errors!.push(`Unsupported runtime for function ${functionName}: ${functionConfig.runtime}`);\n continue;\n }\n\n const functionDirectory = `.vercel/output/functions/${functionName}.func`;\n const {\n handler,\n maxDuration,\n memory,\n regions = [],\n environment,\n filePathMap: configFilePathMap = {},\n } = functionConfig;\n\n const functionEntrypointPath = pathService.join(functionDirectory, handler);\n\n const translatedRegions = regions.length > 0 ? regions.map(translateVercelRegion) : ['us-east-1'];\n result.regions = Array.from(new Set([...(result.regions ?? []), ...translatedRegions])) as Region[];\n\n const environmentVariables: Record<string, string> = {};\n if (environment && typeof environment === 'object') {\n for (const env of Object.values(environment)) {\n Object.assign(environmentVariables, env);\n }\n }\n\n const streaming =\n functionConfig.supportsResponseStreaming ??\n functionConfig.experimentalResponseStreaming ??\n runtime.startsWith('node-');\n\n const filePathMap: Record<string, string> = {};\n for (const [key, value] of Object.entries(configFilePathMap)) {\n filePathMap[pathService.join(projectFolder, key)] = pathService.join(functionDirectory, value);\n }\n\n if (Object.keys(filePathMap).length === 0) {\n const defaultPathMap = yield* getDefaultPathMap(pathService.join(projectFolder, functionDirectory));\n for (const [key, value] of Object.entries(defaultPathMap)) {\n filePathMap[key] = pathService.join(functionDirectory, value);\n }\n }\n\n if (!result.entrypoints) {\n result.entrypoints = [];\n }\n\n result.entrypoints.push({\n displayName: functionName,\n runtime,\n path: functionEntrypointPath,\n memory: memory ?? 1024,\n maxDuration: maxDuration ?? 15,\n environmentVariables,\n streaming,\n package: {\n filePathMap,\n },\n });\n\n const handlerType: NormalizedConfigRouteHandler = streaming\n ? 'SERVERLESS_FUNCTION_STREAMING'\n : 'SERVERLESS_FUNCTION';\n\n const defaultRoute: NormalizedConfigRoute = {\n path: `/${functionName}`,\n methods: ['ANY'],\n headers: {},\n destination: functionEntrypointPath,\n handler: handlerType,\n };\n\n const configRoutes =\n config.routes\n ?.filter((r) => 'dest' in r && r.dest === `/${functionName}`)\n .map((r) => ({\n path: ('src' in r ? r.src : undefined) ?? `/${functionName}`,\n methods: ['ANY'] as NormalizedConfigRouteMethod[],\n headers: {},\n destination: functionEntrypointPath,\n handler: handlerType,\n })) ?? [];\n\n if (!result.routes) {\n result.routes = [];\n }\n\n result.routes.push(defaultRoute, ...configRoutes);\n }\n\n return {\n ...result,\n userArchive: {\n rootOverwrite: determineRepoRoot(projectFolder, result),\n fileWhitelist: [\n `${projectFolder}/*`,\n ...getMonorepoFiles(projectFolder, result.entrypoints?.map((e) => e.package?.filePathMap ?? {}) ?? []),\n ],\n },\n };\n });\n\n return { parse };\n }),\n}) {}\n\nconst loadAssetOverrides = (config: Config, parseResult: NormalizedConfig): Partial<NormalizedConfig> => {\n return {\n assets: {\n overrides: {\n ...(parseResult.assets?.overrides ?? {}),\n ...config.overrides,\n },\n },\n };\n};\n\nconst loadImagePolicy = (config: Config): Partial<NormalizedConfig> => {\n if (!config.images) return {};\n const images = config.images;\n return {\n images: {\n localPatterns: images.localPatterns ?? [{ pathname: '/**' }],\n remotePatterns: [...(images.remotePatterns ?? []), ...images.domains.map((hostname) => ({ hostname }))],\n widths: images.sizes,\n heights: [],\n qualities: images.qualities ?? [75],\n formats: images.formats ?? ['image/webp'],\n minimumCacheTTL: images.minimumCacheTTL ?? 60,\n dangerouslyAllowSVG: images.dangerouslyAllowSVG ?? false,\n contentSecurityPolicy: images.contentSecurityPolicy ?? \"default-src 'self'; script-src 'none'; sandbox;\",\n contentDispositionType: images.contentDispositionType === 'inline' ? 'inline' : 'attachment',\n maximumRedirects: 3,\n maximumResponseBody: 50 * 1024 * 1024,\n variants: {},\n },\n };\n};\n","/**\n * Deeply merges a partial object into a target object.\n *\n * This function recursively merges properties from the partial object into the target object.\n * Arrays are concatenated, objects are recursively merged, and primitive values are overwritten.\n *\n * @param target - The target object to merge into\n * @param partial - The partial object containing properties to merge\n * @returns The modified target object with merged properties\n */\nexport const deepMerge = <T extends object>(target: T, ...partials: Partial<T>[]): T => {\n const isObject = (item: unknown): item is object => item !== null && typeof item === 'object';\n\n if (!isObject(target)) {\n return target;\n }\n\n for (const partial of partials) {\n if (!isObject(partial)) {\n continue;\n }\n\n Object.keys(partial).forEach((key) => {\n if (key === '__proto__' || key === 'constructor') return;\n const targetValue = target[key as keyof T];\n const sourceValue = partial[key as keyof T];\n\n if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {\n (targetValue as unknown[]).push(...(sourceValue as unknown[]));\n } else if (isObject(targetValue) && isObject(sourceValue)) {\n deepMerge(targetValue, sourceValue);\n } else {\n (target as Record<string, unknown>)[key] = sourceValue;\n }\n });\n }\n\n return target;\n};\n","import path from 'path';\nimport { NormalizedConfig } from '../normalized-config';\n\n/**\n * Determines the root of the repository based on the project folder and configuration.\n * Analyzes file paths in entrypoint packages to find the common root directory.\n *\n * @param projectFolder - The base folder path of the project\n * @param config - The normalized configuration that may contain entrypoints with file path maps\n * @returns The determined repository root path\n */\nexport const determineRepoRoot = (projectFolder: string, config: Partial<NormalizedConfig>): string => {\n // Default to project folder if no entrypoints or file paths\n if (!config.entrypoints?.length) {\n return projectFolder;\n }\n\n // Collect all file paths from entrypoints\n const filePaths: string[] = [];\n for (const entrypoint of config.entrypoints) {\n if (entrypoint.package?.filePathMap) {\n filePaths.push(...Object.keys(entrypoint.package.filePathMap));\n }\n }\n\n // If no file paths found, return project folder\n if (filePaths.length === 0) {\n return projectFolder;\n }\n\n // Get common path components\n const pathParts = filePaths.map((p) => p.split(path.sep));\n const firstPath = pathParts[0];\n\n const commonParts: string[] = [];\n for (let i = 0; i < firstPath.length; i++) {\n const part = firstPath[i];\n if (pathParts.every((parts) => parts[i] === part)) {\n commonParts.push(part);\n } else {\n break;\n }\n }\n\n // Join common parts to form the common root\n const commonRoot = commonParts.join(path.sep);\n\n // Only return common root if it's higher in the directory tree than the project folder\n // (i.e., project folder is a subdirectory of the common root)\n if (commonRoot && projectFolder.startsWith(commonRoot) && commonRoot !== projectFolder) {\n return commonRoot;\n }\n\n return projectFolder;\n};\n","import { FilePathMap } from '../normalized-config';\n\n/**\n * Returns files that are not part of the project directory\n * @param directory Absolute path of a directory\n * @param filePathMaps Array of file path maps for functions\n * @returns Array of file paths that are not within the directory\n */\nexport function getMonorepoFiles(directory: string, filePathMaps: FilePathMap[]): string[] {\n const result: string[] = [];\n\n for (const filePathMap of filePathMaps ?? []) {\n if (!filePathMap) {\n continue;\n }\n\n for (const file of Object.keys(filePathMap)) {\n if (!file.startsWith(directory)) {\n result.push(file);\n }\n }\n }\n\n return result;\n}\n","/**\n * Translates Vercel region codes to AWS region codes.\n *\n * Vercel uses three-letter codes (e.g., \"iad1\") to identify their regions,\n * while AWS uses longer region codes (e.g., \"us-east-1\").\n * This function maps the Vercel region code to its corresponding AWS region code.\n *\n * @param region - The Vercel region code to translate\n * @returns The corresponding AWS region code, defaults to 'us-east-1' if not found\n * @link https://vercel.com/docs/edge-network/regions#region-list\n */\nexport const translateVercelRegion = (region: string): string => {\n const regionMap: Record<string, string> = {\n arn1: 'eu-north-1',\n bom1: 'ap-south-1',\n cdg1: 'eu-west-3',\n cle1: 'us-east-2',\n cpt1: 'af-south-1',\n dub1: 'eu-west-1',\n fra1: 'eu-central-1',\n gru1: 'sa-east-1',\n hkg1: 'ap-east-1',\n hnd1: 'ap-northeast-1',\n iad1: 'us-east-1',\n icn1: 'ap-northeast-2',\n kix1: 'ap-northeast-3',\n lhr1: 'eu-west-2',\n pdx1: 'us-west-2',\n sfo1: 'us-west-1',\n sin1: 'ap-southeast-1',\n syd1: 'ap-southeast-2',\n };\n\n return regionMap[region.toLowerCase()] ?? 'us-east-1';\n};\n","import { Runtime } from '../runtime';\n\n/**\n * Translates Vercel runtime strings to our standardized Runtime format\n *\n * @param runtime - The Vercel runtime identifier (e.g. 'nodejs18.x')\n * @returns The corresponding Runtime value or null if no match is found\n */\nexport const translateVercelRuntime = (runtime: string): Runtime | null => {\n switch (runtime) {\n case 'nodejs12.x':\n case 'nodejs14.x':\n case 'nodejs16.x':\n case 'nodejs18.x':\n return 'node-18';\n case 'nodejs20.x':\n case 'nodejs22.x': // TODO: Update when Lambda supports Node.js 22\n return 'node-20';\n default:\n return null;\n }\n};\n","{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"title\": \"Config V4\",\n \"description\": \"Configuration schema for version 4\",\n \"type\": \"object\",\n \"required\": [\"version\"],\n \"properties\": {\n \"version\": {\n \"type\": \"integer\",\n \"enum\": [4],\n \"description\": \"The version of the configuration file\"\n },\n \"presets\": {\n \"type\": [\"array\", \"null\"],\n \"items\": {\n \"type\": \"string\",\n \"format\": \"uri\"\n },\n \"description\": \"A list of presets to apply to the project. Each preset will be applied in order.\"\n },\n \"assets\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"The folder which holds the assets to be deployed to the edge. Defaults to none.\"\n },\n \"populateAssetCache\": {\n \"type\": [\"boolean\", \"null\"],\n \"description\": \"If true, the assets will be cached at the edge during deployment. This may increase the deployment time, depending on the size of the assets. Defaults to false.\"\n },\n \"images\": {\n \"type\": [\"object\", \"null\"],\n \"description\": \"Managed image optimization policy for this deployment.\",\n \"additionalProperties\": false,\n \"properties\": {\n \"localPatterns\": {\n \"type\": \"array\",\n \"maxItems\": 64,\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"pathname\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 2048 },\n \"search\": { \"type\": \"string\", \"maxLength\": 2048 }\n }\n }\n },\n \"remotePatterns\": {\n \"type\": \"array\",\n \"maxItems\": 64,\n \"items\": {\n \"type\": \"object\",\n \"required\": [\"hostname\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"protocol\": { \"type\": \"string\", \"enum\": [\"http\", \"https\"] },\n \"hostname\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 253 },\n \"port\": { \"type\": \"string\", \"pattern\": \"^[0-9]{0,5}$\" },\n \"pathname\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 2048 },\n \"search\": { \"type\": \"string\", \"maxLength\": 2048 }\n }\n }\n },\n \"widths\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 64,\n \"uniqueItems\": true,\n \"items\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 8192 }\n },\n \"heights\": {\n \"type\": \"array\",\n \"maxItems\": 64,\n \"uniqueItems\": true,\n \"items\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 8192 }\n },\n \"qualities\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 100,\n \"uniqueItems\": true,\n \"items\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 100 }\n },\n \"formats\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 4,\n \"uniqueItems\": true,\n \"items\": { \"type\": \"string\", \"enum\": [\"image/avif\", \"image/webp\", \"image/jpeg\", \"image/png\"] }\n },\n \"minimumCacheTTL\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 31536000 },\n \"dangerouslyAllowSVG\": { \"type\": \"boolean\" },\n \"contentSecurityPolicy\": { \"type\": \"string\", \"maxLength\": 4096 },\n \"contentDispositionType\": { \"type\": \"string\", \"enum\": [\"inline\", \"attachment\"] },\n \"maximumRedirects\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 10 },\n \"maximumResponseBody\": { \"type\": \"integer\", \"minimum\": 1024, \"maximum\": 104857600 },\n \"variants\": {\n \"type\": \"object\",\n \"maxProperties\": 100,\n \"propertyNames\": { \"pattern\": \"^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$\" },\n \"additionalProperties\": {\n \"type\": \"object\",\n \"minProperties\": 1,\n \"additionalProperties\": false,\n \"properties\": {\n \"width\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 8192 },\n \"height\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 8192 },\n \"quality\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 100 },\n \"format\": { \"type\": \"string\", \"enum\": [\"image/avif\", \"image/webp\", \"image/jpeg\", \"image/png\"] },\n \"fit\": { \"type\": \"string\", \"enum\": [\"contain\", \"cover\", \"fill\", \"inside\", \"outside\"] }\n }\n }\n }\n }\n },\n \"regions\": {\n \"type\": [\"array\", \"null\"],\n \"description\": \"The regions to which the project will be deployed. Use \\\"global\\\" to deploy to all regions. More regions will incur higher costs.\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"build_commands\": {\n \"type\": [\"array\", \"null\"],\n \"description\": \"The commands to run to build the project. For example, `bun install` or `npm install`.\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"functions\": {\n \"type\": [\"object\", \"null\"],\n \"description\": \"The serverless functions to deploy.\",\n \"additionalProperties\": {\n \"type\": \"object\",\n \"properties\": {\n \"memory\": {\n \"type\": \"number\",\n \"description\": \"The memory in MB to allocate to the function. Defaults to 128.\",\n \"maximum\": 3009,\n \"minimum\": 128\n },\n \"max_duration\": {\n \"type\": \"number\",\n \"description\": \"The maximum lifetime in seconds of one HTTP request, response stream, or WebSocket connection. Defaults to 30. The reusable execution environment is not terminated with the invocation.\",\n \"maximum\": 28800,\n \"minimum\": 1\n },\n \"runtime\": {\n \"$ref\": \"#/$defs/runtimes\",\n \"description\": \"The runtime to use for the function.\"\n },\n \"streaming\": {\n \"type\": \"boolean\",\n \"description\": \"Enable function response streaming. When omitted, Node and Bun runtimes stream by default.\"\n },\n \"schedule\": {\n \"type\": \"string\",\n \"description\": \"An expression to schedule the function to run at specific times.\",\n \"pattern\": \"^(?:rate[(](?:(?:1[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0-9]+))?)*)))|(?:(?:(?:(?:(?:[1-3]?[0-9])W?)|LW|[L*])(?:(?:[-](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*]))|(?:[/][0-9]+))?(?:[,](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*])(?:(?:[-](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?(?:[,](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?)*)[ ]+[?]))[ ]+(?:(?:(?:[12][0-9]{3})|[*])(?:(?:[-](?:(?:[12][0-9]{3})|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[12][0-9]{3})|[*])(?:(?:[-](?:(?:[12][0-9]{3})|[*]))|(?:[/][0-9]+))?)*)[)])$\"\n },\n \"symlinks\": {\n \"type\": \"object\",\n \"description\": \"A list of symbolic links to create in the function's package.\",\n \"maxProperties\": 100,\n \"minProperties\": 1,\n \"patternProperties\": {\n \"^.{1,256}$\": {\n \"type\": \"string\",\n \"maxLength\": 256\n }\n },\n \"additionalProperties\": false\n },\n \"excludeFiles\": {\n \"oneOf\": [{ \"type\": \"string\" }, { \"type\": \"array\", \"items\": { \"type\": \"string\" } }],\n \"description\": \"A glob pattern to match files that should be excluded from your Serverless Function. If you're using a Community Runtime, the behavior might vary.\"\n },\n \"includeFiles\": {\n \"oneOf\": [{ \"type\": \"string\" }, { \"type\": \"array\", \"items\": { \"type\": \"string\" } }],\n \"description\": \"A glob pattern to match files that should be included in your Serverless Function. If you're using a Community Runtime, the behavior might vary.\"\n }\n }\n }\n },\n \"env\": {\n \"type\": \"object\",\n \"maxProperties\": 100,\n \"minProperties\": 0,\n \"patternProperties\": {\n \".+\": {\n \"maxLength\": 65536,\n \"minLength\": 0,\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false,\n \"description\": \"Additional environment variables to set during runtime and build.\"\n },\n \"routes\": {\n \"type\": [\"array\", \"null\"],\n \"description\": \"A list of route definitions.\",\n \"maxItems\": 1024,\n \"items\": {\n \"type\": \"object\",\n \"required\": [\"source\", \"destination\"],\n \"properties\": {\n \"source\": {\n \"description\": \"A pattern that matches each incoming pathname (excluding querystring).\",\n \"type\": \"string\",\n \"maxLength\": 4096\n },\n \"destination\": {\n \"description\": \"An absolute pathname to an existing resource or an external URL.\",\n \"type\": \"string\",\n \"maxLength\": 4096\n },\n \"has\": {\n \"$ref\": \"#/$defs/matchRequirements\"\n },\n \"missing\": {\n \"$ref\": \"#/$defs/matchRequirements\"\n },\n \"statusCode\": {\n \"description\": \"An optional integer to override the status code of the response.\",\n \"type\": \"integer\",\n \"minimum\": 100,\n \"maximum\": 999\n },\n \"redirect\": {\n \"type\": \"boolean\",\n \"description\": \"An optional boolean to force a redirect response.\"\n },\n \"methods\": {\n \"type\": \"array\",\n \"description\": \"The HTTP methods to match for the route. Defaults to all methods.\",\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\"ANY\", \"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"HEAD\", \"OPTIONS\"]\n }\n },\n \"headers\": {\n \"type\": \"object\",\n \"description\": \"Additional headers to add to the response.\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"services\": {\n \"type\": \"object\",\n \"description\": \"Managed services to provision for the deployment environment.\",\n \"additionalProperties\": false,\n \"properties\": {\n \"redis\": {\n \"oneOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"envBindings\": {\n \"type\": \"object\",\n \"description\": \"Optionally, specify what environment variables the credentials will be bound to. For example: `{ url: 'REDIS_URL' }` will bind the `url` environment variable to the Redis URL. If you don't specify any bindings, they will be bound to the REDIS_URL, REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, REDIS_DB, and REDIS_SSL environment variables.\",\n \"additionalProperties\": false,\n \"properties\": {\n \"url\": { \"type\": \"string\" },\n \"host\": { \"type\": \"string\" },\n \"port\": { \"type\": \"string\" },\n \"password\": { \"type\": \"string\" },\n \"db\": { \"type\": \"string\" },\n \"ssl\": { \"type\": \"string\" }\n }\n },\n \"primaryRegion\": {\n \"type\": \"string\",\n \"description\": \"The primary region to deploy the Redis instance to.\",\n \"enum\": [\n \"us-east-1\",\n \"us-east-2\",\n \"us-west-1\",\n \"us-west-2\",\n \"eu-central-1\",\n \"eu-west-1\",\n \"eu-west-2\",\n \"sa-east-1\",\n \"ap-south-1\",\n \"ap-northeast-1\",\n \"ap-southeast-1\",\n \"ap-southeast-2\",\n \"us-central1\"\n ]\n },\n \"readRegions\": {\n \"type\": \"array\",\n \"description\": \"Optionally, add additional regions to read from. More regions will incur higher costs.\",\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\n \"us-east-1\",\n \"us-east-2\",\n \"us-west-1\",\n \"us-west-2\",\n \"eu-central-1\",\n \"eu-west-1\",\n \"eu-west-2\",\n \"sa-east-1\",\n \"ap-south-1\",\n \"ap-northeast-1\",\n \"ap-southeast-1\",\n \"ap-southeast-2\"\n ]\n }\n },\n \"eviction\": {\n \"type\": \"boolean\",\n \"description\": \"Optionally, enable Redis eviction. This will evict the least recently used keys in order to make space for new ones.\"\n }\n }\n }\n ]\n },\n \"postgres\": {\n \"oneOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"envBindings\": {\n \"type\": \"object\",\n \"description\": \"Optionally, specify what environment variables the credentials will be bound to. For example: `{ url: 'POSTGRES_URL' }` will bind the `url` environment variable to the Postgres URL. If you don't specify any bindings, they will be bound to the POSTGRES_URL, POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DATABASE environment variables.\",\n \"additionalProperties\": false,\n \"properties\": {\n \"url\": { \"type\": \"string\" },\n \"host\": { \"type\": \"string\" },\n \"port\": { \"type\": \"string\" },\n \"user\": { \"type\": \"string\" },\n \"password\": { \"type\": \"string\" },\n \"database\": { \"type\": \"string\" }\n }\n },\n \"postgresVersion\": {\n \"type\": \"string\",\n \"description\": \"The version of Postgres to deploy.\",\n \"enum\": [\"17\", \"16\", \"15\", \"14\"]\n },\n \"region\": {\n \"type\": \"string\",\n \"description\": \"The region to deploy the Postgres instance to.\",\n \"enum\": [\n \"us-east-1\",\n \"us-east-2\",\n \"us-west-2\",\n \"ap-southeast-1\",\n \"ap-southeast-2\",\n \"eu-central-1\",\n \"eu-west-2\",\n \"sa-east-1\"\n ]\n }\n }\n }\n ]\n },\n \"storage\": {\n \"type\": \"object\",\n \"required\": [\"buckets\"],\n \"additionalProperties\": false,\n \"description\": \"File Storage buckets to provision in the deployment environment. The environment and global delivery/S3 slug are assigned by the platform.\",\n \"properties\": {\n \"buckets\": {\n \"type\": \"object\",\n \"description\": \"Buckets keyed by immutable environment-scoped name. Use null or an empty object for the default private visibility.\",\n \"propertyNames\": {\n \"minLength\": 3,\n \"maxLength\": 63,\n \"pattern\": \"^(?![0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$\"\n },\n \"additionalProperties\": {\n \"oneOf\": [\n { \"type\": \"null\" },\n {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"visibility\": {\n \"type\": \"string\",\n \"enum\": [\"public\", \"private\"],\n \"description\": \"Bucket access policy. Defaults to private when omitted. Public buckets can serve objects through their CDN hostname.\"\n }\n }\n }\n ]\n }\n }\n }\n }\n }\n }\n },\n \"$defs\": {\n \"runtimes\": {\n \"type\": \"string\",\n \"enum\": [\"php-84\", \"php-83\", \"php-81\", \"node-22\", \"node-20\", \"node-18\", \"node-16\", \"bun-1\"]\n },\n \"matchRequirements\": {\n \"description\": \"An array of requirements that are needed to match\",\n \"type\": \"array\",\n \"maxItems\": 16,\n \"items\": {\n \"anyOf\": [\n {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"type\", \"value\"],\n \"properties\": {\n \"type\": {\n \"description\": \"The type of request element to check\",\n \"type\": \"string\",\n \"enum\": [\"host\"]\n },\n \"value\": {\n \"description\": \"A regular expression used to match the value. Named groups can be used in the destination\",\n \"type\": \"string\",\n \"maxLength\": 4096\n }\n }\n },\n {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"type\", \"key\"],\n \"properties\": {\n \"type\": {\n \"description\": \"The type of request element to check\",\n \"type\": \"string\",\n \"enum\": [\"header\", \"cookie\", \"query\"]\n },\n \"key\": {\n \"description\": \"The name of the element contained in the particular type\",\n \"type\": \"string\",\n \"maxLength\": 4096\n },\n \"value\": {\n \"description\": \"A regular expression used to match the value. Named groups can be used in the destination\",\n \"type\": \"string\",\n \"maxLength\": 4096\n }\n }\n }\n ]\n }\n }\n }\n}\n","// Define all available runtimes in a single array\nconst RUNTIME_DEFINITIONS = [\n 'php-84',\n 'php-83',\n 'php-81',\n 'node-22',\n 'node-20',\n 'node-18',\n 'node-16',\n 'bun-1',\n] as const;\n\n// Generate the Runtime type from the array\nexport type Runtime = (typeof RUNTIME_DEFINITIONS)[number];\n\n// Export the available runtimes\nexport const AVAILABLE_RUNTIMES: Runtime[] = [...RUNTIME_DEFINITIONS];\n","import { Layer } from 'effect';\nimport { ConfigModuleLoader } from './config-module-loader';\nimport { RawConfigReader } from './raw-config-reader';\nimport { SchemaValidator } from './schema-validator';\nimport { V4ConfigParser } from './v4-config-parser';\nimport { VercelBuildOutputParser } from './vercel-build-output-parser';\n\nexport { ConfigModuleLoader } from './config-module-loader';\nexport { ALLOWED_CONFIG_NAMES, RawConfigReader } from './raw-config-reader';\nexport { SchemaValidator } from './schema-validator';\nexport { getFunctionSettings, V4ConfigParser } from './v4-config-parser';\nexport { VercelBuildOutputParser } from './vercel-build-output-parser';\n\n/**\n * Composed layer providing all network-config services.\n * Requires `FileSystem.FileSystem` (e.g. via `NodeContext.layer`).\n */\nconst BaseLayers = Layer.mergeAll(\n ConfigModuleLoader.Default,\n RawConfigReader.Default,\n SchemaValidator.Default,\n V4ConfigParser.Default\n);\n\nexport const NetworkConfigLive = VercelBuildOutputParser.Default.pipe(Layer.provideMerge(BaseLayers));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,iBAAuB;;;ACAvB,oBAA+B;AAE/B,IAAM,mBAAmB;AACzB,IAAM,oBAAoB;AAC1B,IAAM,mCAAmC;AAEzC,IAAM,kBAAkB,CAAC,YAA6B;AACpD,QAAM,cAAc,QAAQ,QAAQ,SAAS,GAAG;AAChD,SAAO,gBAAgB,OAAO,gBAAgB;AAChD;AAEA,IAAM,yBAAyB,CAAC,OAAe,wBAAwB,UAAmB;AACxF,QAAM,aAAa,MAAM,WAAW,MAAM,GAAG,EAAE,QAAQ,SAAS,EAAE,EAAE,QAAQ,QAAQ,EAAE;AACtF,UACG,yBAA0B,eAAe,MAAM,e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H,OAAO,QAAQ,OAAO,UAAU,KAAK,MACrC,OAAO,QAAQ,UAAU,UAAU,KAAK,MACxC,OAAO,QAAQ,WAAW,UAAU,KAAK;AAG5C,MAAI,OAAO,YAAY,WAAW,KAAK,CAAC,aAAa,OAAO,OAAO,WAAW,GAAG;AAC/E,WAAO,OAAO;AAAA,MACZ;AAAA,IACF;AAAA,EACF,WAAW,OAAO,YAAY,WAAW,KAAK,CAAC,WAAW;AACxD,WAAO,SAAS,KAAK,sEAAsE;AAAA,EAC7F;AAEA,WAAS,0BAA0B,MAAM;AAEzC,SAAO;AACT,CAAC;;;AanGD,IAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAMO,IAAM,qBAAgC,CAAC,GAAG,mBAAmB;;;AChBpE,IAAAC,kBAAsB;AAiBtB,IAAM,aAAa,sBAAM;AAAA,EACvB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AACjB;AAEO,IAAM,oBAAoB,wBAAwB,QAAQ,KAAK,sBAAM,aAAa,UAAU,CAAC;","names":["import_effect","path","import_platform","import_effect","import_effect","import_platform","import_effect","import_platform","import_effect","isRecord","outputPath","import_platform","import_effect","import_platform","import_effect","import_effect","import_platform","import_effect","import_effect","import_platform","import_effect","import_effect","import_effect","import_effect","path","import_effect","import_platform","import_effect","import_effect","parseYaml","import_effect","Ajv","addFormats","import_platform","import_effect","import_minimatch","path","safeRegex","import_platform","import_effect","path","import_effect"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/asset-manifest.ts","../src/manifest-schema.ts","../src/collect-asset-files.ts","../src/containers.ts","../src/errors.ts","../src/normalized-config.ts","../src/define-config.ts","../src/detection/detect-container-project.ts","../src/regions.ts","../src/detection/detect-framework.ts","../src/detection/detect-package-manager.ts","../src/detection/frameworks/astro.ts","../src/detection/frameworks/resolve-node-entrypoint.ts","../src/detection/frameworks/elysia.ts","../src/detection/frameworks/express.ts","../src/detection/frameworks/fastify.ts","../src/detection/frameworks/hono.ts","../src/detection/frameworks/laravel.ts","../src/detection/frameworks/nestjs.ts","../src/detection/frameworks/nextjs.ts","../src/build-output-v3/get-default-path-map.ts","../src/nextjs-constants.ts","../src/nextjs-manifest.ts","../src/detection/frameworks/nuxt.ts","../src/detection/frameworks/remix.ts","../src/detection/frameworks/sveltekit.ts","../src/detection/frameworks/symfony.ts","../src/detection/frameworks/vite.ts","../src/detection/frameworks/index.ts","../src/detection/generate-config.ts","../src/detection/read-dependencies.ts","../src/detection/types.ts","../src/detection/merge-config.ts","../src/filter-functions-from-assets.ts","../src/parse-config.ts","../src/services/raw-config-reader.ts","../src/services/config-module-loader.ts","../src/services/schema-validator.ts","../../build-utils/src/get-files-for-pattern.ts","../src/services/v4-config-parser.ts","../src/services/vercel-build-output-parser.ts","../../commons/src/deep-merge.ts","../src/build-output-v3/determine-repo-root.ts","../src/build-output-v3/get-monorepo-files.ts","../src/build-output-v3/translate-vercel-region.ts","../src/build-output-v3/translate-vercel-runtime.ts","../src/v4/schema.json","../src/runtime.ts","../src/services/index.ts"],"sourcesContent":["export * from './asset-manifest';\nexport * from './collect-asset-files';\nexport * from './containers';\nexport * from './define-config';\nexport * from './detection';\nexport * from './errors';\nexport * from './filter-functions-from-assets';\nexport * from './image-policy';\nexport * from './nextjs-manifest';\nexport * from './normalized-config';\nexport * from './parse-config';\nexport * from './regions';\nexport * from './runtime';\nexport * from './services';\nexport * from './v4';\n","import { Schema } from 'effect';\nimport { decodeJson, HttpHeadersSchema, PortableRelativePathSchema, UrlPathnameSchema } from './manifest-schema';\n\nexport const StaticAssetHeadersSchema = HttpHeadersSchema;\nexport type StaticAssetHeaders = Schema.Schema.Type<typeof StaticAssetHeadersSchema>;\n\n/** One logical static asset whose source is relative to the project root. */\nexport const StaticAssetManifestEntrySchema = Schema.mutable(\n Schema.Struct({\n source: PortableRelativePathSchema,\n path: UrlPathnameSchema,\n status: Schema.optional(Schema.Int.pipe(Schema.between(100, 599))),\n headers: Schema.optional(StaticAssetHeadersSchema),\n immutable: Schema.optional(Schema.Boolean),\n })\n);\nexport type StaticAssetManifestEntry = Schema.Schema.Type<typeof StaticAssetManifestEntrySchema>;\n\n/** Portable manifest for declaring many logical assets without expanding deployment configuration. */\nexport const StaticAssetManifestV1Schema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(1),\n assets: Schema.mutable(Schema.Array(StaticAssetManifestEntrySchema)),\n })\n).pipe(Schema.filter(({ assets }) => new Set(assets.map(({ path }) => path)).size === assets.length));\nexport type StaticAssetManifestV1 = Schema.Schema.Type<typeof StaticAssetManifestV1Schema>;\nexport type StaticAssetManifest = StaticAssetManifestV1;\n\n/**\n * Parses and validates a portable static asset manifest.\n *\n * @param content JSON manifest content.\n * @returns The validated manifest, or `undefined` when malformed.\n */\nexport const parseStaticAssetManifest = (content: string): StaticAssetManifest | undefined =>\n decodeJson(StaticAssetManifestV1Schema, content);\n","import { Option, Schema } from 'effect';\n\nconst HTTP_HEADER_NAME = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\nconst HTTP_HEADER_VALUE = /^[\\t\\x20-\\x7e\\x80-\\xff]*$/;\nconst URL_PATHNAME_FORBIDDEN_CHARACTER = /[\\x00-\\x1f\\x7f?#\\\\]/;\n\nconst isUrlDotSegment = (segment: string): boolean => {\n const decodedDots = segment.replace(/%2e/gi, '.');\n return decodedDots === '.' || decodedDots === '..';\n};\n\nconst isPortableRelativePath = (value: string, allowCurrentDirectory = false): boolean => {\n const normalized = value.replaceAll('\\\\', '/').replace(/^\\.\\//, '').replace(/\\/+$/, '');\n return (\n (allowCurrentDirectory || (normalized !== '' && normalized !== '.')) &&\n !normalized.startsWith('/') &&\n !/^[A-Za-z]:/.test(normalized) &&\n !normalized.includes(':') &&\n !normalized.split('/').includes('..')\n );\n};\n\nexport const PortableRelativePathSchema = Schema.String.pipe(Schema.filter((value) => isPortableRelativePath(value)));\n\nexport const RepositoryRelativePathSchema = Schema.String.pipe(\n Schema.filter((value) => isPortableRelativePath(value, true))\n);\n\nexport const UrlPathnameSchema = Schema.String.pipe(\n Schema.filter(\n (value) =>\n value.startsWith('/') && !URL_PATHNAME_FORBIDDEN_CHARACTER.test(value) && !value.split('/').some(isUrlDotSegment)\n )\n);\n\nexport const HttpHeaderValueSchema = Schema.String.pipe(Schema.pattern(HTTP_HEADER_VALUE));\nexport const HttpHeadersSchema = Schema.mutable(\n Schema.Record({\n key: Schema.String,\n value: Schema.Union(HttpHeaderValueSchema, Schema.mutable(Schema.Array(HttpHeaderValueSchema))),\n })\n).pipe(Schema.filter((headers) => Object.keys(headers).every((name) => HTTP_HEADER_NAME.test(name))));\nexport const HttpSingleValueHeadersSchema = Schema.mutable(\n Schema.Record({ key: Schema.String, value: HttpHeaderValueSchema })\n).pipe(Schema.filter((headers) => Object.keys(headers).every((name) => HTTP_HEADER_NAME.test(name))));\n\n/**\n * Decode an unknown value with an Effect schema.\n *\n * @param schema - Schema used to validate and decode the value.\n * @param value - Unknown input to decode.\n * @returns The decoded value, or `undefined` when validation fails.\n * @example\n * decodeUnknown(Schema.String, 'value');\n */\nexport const decodeUnknown = <A, I>(schema: Schema.Schema<A, I, never>, value: unknown): A | undefined =>\n Schema.decodeUnknownOption(schema, { onExcessProperty: 'preserve' })(value).pipe(Option.getOrUndefined);\n\n/**\n * Decode a JSON string with an Effect schema.\n *\n * @param schema - Schema used to validate and decode the parsed JSON value.\n * @param content - JSON string to parse and decode.\n * @returns The decoded value, or `undefined` when parsing or validation fails.\n * @example\n * decodeJson(Schema.Struct({ version: Schema.Number }), '{\"version\":1}');\n */\nexport const decodeJson = <A, I>(schema: Schema.Schema<A, I, never>, content: string): A | undefined =>\n decodeUnknown(Schema.parseJson(schema), content);\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\n\n/**\n * Maximum directory nesting depth for asset collection.\n * Guards against symlink-induced infinite recursion where constructed paths\n * grow monotonically (e.g. `/assets/link/link/link/...`).\n */\nconst MAX_ASSET_DEPTH = 100;\n\n/** Server configuration files that must never be published as static assets. */\nconst DISALLOWED_ASSET_EXTENSIONS = ['.htaccess', '.htpasswd'];\n\n/**\n * Recursively collects all file paths relative to the base directory.\n */\nconst collectFilesRecursively: (\n basePath: string,\n relativePath?: string,\n depth?: number\n) => Effect.Effect<string[], never, FileSystem.FileSystem | Path.Path> = Effect.fn('collectFilesRecursively')(\n function* (basePath: string, relativePath: string = '', depth: number = 0) {\n if (depth > MAX_ASSET_DEPTH) return [] as string[];\n\n const fs = yield* FileSystem.FileSystem;\n const pathSvc = yield* Path.Path;\n\n const currentPath = relativePath ? pathSvc.join(basePath, relativePath) : basePath;\n\n const entries = yield* fs.readDirectory(currentPath).pipe(Effect.catchAll(() => Effect.succeed([] as string[])));\n const result: string[] = [];\n\n for (const name of entries) {\n const fullPath = pathSvc.join(currentPath, name);\n const entryRelative = relativePath ? pathSvc.join(relativePath, name) : name;\n const stat = yield* fs.stat(fullPath).pipe(Effect.catchAll(() => Effect.succeed(null)));\n\n if (!stat) continue;\n\n if (stat.type === 'Directory') {\n const nested = yield* collectFilesRecursively(basePath, entryRelative, depth + 1);\n result.push(...nested);\n } else {\n result.push(entryRelative);\n }\n }\n\n return result;\n }\n);\n\n/**\n * Lists every publishable file inside a static asset directory.\n *\n * Both the `assets:` key of a user config and a framework's `assetsDir` mean\n * \"publish this directory to the edge\", and both resolve that declaration into\n * concrete file paths through this walker.\n *\n * @param projectFolder - Absolute path to the project root\n * @param assetsDir - Project-relative asset directory (e.g. `dist`, `.output/public`)\n * @returns Sorted forward-slash paths relative to `assetsDir`. Empty when the\n * directory is missing or is not a directory, so a project that never produced\n * the expected build output fails config validation instead of the walker.\n */\nexport const collectAssetFiles = Effect.fn('collectAssetFiles')(function* (projectFolder: string, assetsDir: string) {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n\n const assetsPath = pathService.join(projectFolder, assetsDir);\n const stat = yield* fs.stat(assetsPath).pipe(Effect.catchAll(() => Effect.succeed(null)));\n if (!stat || stat.type !== 'Directory') return [] as string[];\n\n const files = yield* collectFilesRecursively(assetsPath);\n\n return files\n .map((file) => file.replaceAll('\\\\', '/'))\n .filter((file) => !DISALLOWED_ASSET_EXTENSIONS.some((extension) => file.toLowerCase().endsWith(extension)))\n .sort();\n});\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect, Option } from 'effect';\nimport { posix } from 'node:path';\nimport { parse as parseYaml, YAMLError } from 'yaml';\nimport { ContainerConfigError } from './errors';\nimport {\n CONTAINER_ENTRYPOINT_PREFIX,\n CONTAINER_RUNTIME,\n DEFAULT_CONTAINER_MEMORY_MB,\n DEFAULT_FUNCTION_DURATION_SECONDS,\n DEFAULT_SIDECAR_MEMORY_MB,\n MAX_SIDECARS,\n type NormalizedConfigEntrypoint,\n type NormalizedContainerImageSource,\n type NormalizedContainerSpec,\n type NormalizedSidecar,\n} from './normalized-config';\nimport type { ConfigV4Container, ConfigV4ContainerBuild } from './v4';\n\n/** Compose file names, in the order `docker compose` looks for them. */\nexport const COMPOSE_FILE_NAMES = ['compose.yaml', 'compose.yml', 'docker-compose.yaml', 'docker-compose.yml'] as const;\n\n/**\n * Valid container name, which is also the hostname a sidecar answers to. It\n * starts with a letter so that no name (`1234`) reads as an IPv4 literal before\n * `/etc/hosts` is consulted. Mirrors the v4 schema and the network decoder.\n */\nconst CONTAINER_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,62}$/;\n\n/** Rules a container name breaks, phrased for error messages. */\nconst CONTAINER_NAME_RULES =\n \"1 to 63 lowercase letters, digits, '-' or '_', starting with a letter, and not 'localhost'\";\n\n/** Memory bounds of a container, in MB. Mirrors the v4 schema. */\nconst MIN_CONTAINER_MEMORY_MB = 128;\nconst MAX_CONTAINER_MEMORY_MB = 3009;\n\n/** Bounds of the container environment. Mirror the v4 schema. */\nconst MAX_CONTAINER_ENV_VARS = 100;\nconst MAX_CONTAINER_ENV_VALUE_LENGTH = 65_536;\n\n/**\n * Returns the synthetic entrypoint path of a container function, which routes\n * use as their `destination`.\n *\n * @example\n * ```ts\n * containerEntrypointPath('web'); // 'container:web'\n * ```\n */\nexport const containerEntrypointPath = (name: string): string => `${CONTAINER_ENTRYPOINT_PREFIX}${name}`;\n\n/**\n * Turns an arbitrary label into a valid container name: lowercased, runs of\n * other characters replaced with `-`, and `app-` in front when it would not\n * start with a letter. An empty result, or `localhost`, becomes `app`.\n */\nconst toContainerName = (raw: string): string => {\n const cleaned = raw\n .toLowerCase()\n .replace(/[^a-z0-9_-]+/g, '-')\n .replace(/^[^a-z0-9]+/, '');\n const name = (cleaned === '' || /^[a-z]/.test(cleaned) ? cleaned : `app-${cleaned}`).slice(0, 63);\n return name === '' || name === 'localhost' ? 'app' : name;\n};\n\n/**\n * Derives the container name of a `functions` entry that runs a Dockerfile\n * (`runtime: docker`): the directory the Dockerfile sits in, plus any suffix\n * or prefix around `Dockerfile` in its file name. A root `Dockerfile` is `app`,\n * and a name that would not start with a letter gets an `app-` prefix.\n *\n * @param file - Project-relative path of the Dockerfile\n * @returns A valid container name\n * @example\n * ```ts\n * dockerFunctionContainerName('Dockerfile'); // 'app'\n * dockerFunctionContainerName('services/api/Dockerfile'); // 'api'\n * dockerFunctionContainerName('docker/worker.Dockerfile'); // 'docker-worker'\n * dockerFunctionContainerName('services/1/Dockerfile'); // 'app-1'\n * ```\n */\nexport const dockerFunctionContainerName = (file: string): string => {\n const { dir, base } = posix.parse(file);\n const variant = base.replace(/^Dockerfile[.-]?/i, '').replace(/[.-]?Dockerfile$/i, '');\n const raw = [posix.basename(dir), variant === base ? posix.parse(base).name : variant]\n .filter((part) => part !== '')\n .join('-');\n return toContainerName(raw);\n};\n\n/**\n * Splits a command string into words the way Compose does: whitespace\n * separates words, single and double quotes group them, and a backslash\n * escapes the next character outside single quotes. No shell runs.\n *\n * @param input - Command as written, e.g. `redis-server --save \"\"`\n * @returns The argv words\n * @throws Error when a quote is left open\n * @example\n * ```ts\n * splitCommandWords('sh -c \"echo hi\"'); // ['sh', '-c', 'echo hi']\n * ```\n */\nexport const splitCommandWords = (input: string): string[] => {\n const words: string[] = [];\n let current = '';\n let inWord = false;\n let quote: \"'\" | '\"' | undefined;\n\n for (let index = 0; index < input.length; index += 1) {\n const char = input[index];\n\n if (quote === \"'\") {\n if (char === \"'\") quote = undefined;\n else current += char;\n } else if (char === '\\\\' && index + 1 < input.length) {\n index += 1;\n current += input[index];\n inWord = true;\n } else if (quote === '\"') {\n if (char === '\"') quote = undefined;\n else current += char;\n } else if (char === \"'\" || char === '\"') {\n quote = char;\n inWord = true;\n } else if (/\\s/.test(char)) {\n if (inWord) words.push(current);\n current = '';\n inWord = false;\n } else {\n current += char;\n inWord = true;\n }\n }\n\n if (quote) throw new Error(`Unterminated ${quote} quote`);\n if (inWord) words.push(current);\n return words;\n};\n\n/**\n * Normalizes a project-relative path and refuses one that leaves the project.\n *\n * @returns The normalized POSIX path (`.` for the root), or `undefined` when it escapes\n */\nconst normalizeProjectPath = (input: string): string | undefined => {\n if (posix.isAbsolute(input)) return undefined;\n const normalized = posix.normalize(input.replace(/\\\\/g, '/')).replace(/\\/+$/, '') || '.';\n if (normalized === '..' || normalized.startsWith('../')) return undefined;\n return normalized;\n};\n\n/** Real path of the project root, so that a project reached through a symbolic link still contains its own files. */\nconst resolveProjectRoot = (projectFolder: string) =>\n Effect.flatMap(FileSystem.FileSystem, (fs) =>\n fs.realPath(projectFolder).pipe(Effect.orElseSucceed(() => projectFolder))\n );\n\n/**\n * Resolves a project-relative path through every symbolic link on the way and\n * refuses a target outside the project. Checking the path string alone is not\n * enough: a committed `app.env -> /proc/self/environ` or a Dockerfile linked to\n * `~/.aws/credentials` would otherwise pull files of the machine that reads the\n * config into the deployment.\n *\n * @param projectRoot - Real path of the project root\n * @param projectRelative - Normalized project-relative path\n * @param subject - What the path is, for the error message, e.g. `Compose file 'compose.yaml'`\n * @returns The real path, or `None` when nothing exists there\n */\nconst resolveInsideProject = (\n projectRoot: string,\n projectRelative: string,\n subject: string,\n context: { containerName?: string; filePath?: string }\n) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const pathSvc = yield* Path.Path;\n const resolved = yield* fs.realPath(pathSvc.join(projectRoot, projectRelative)).pipe(Effect.option);\n if (Option.isNone(resolved)) return resolved;\n const relative = pathSvc.relative(projectRoot, resolved.value);\n if (relative === '..' || relative.startsWith(`..${pathSvc.sep}`) || pathSvc.isAbsolute(relative)) {\n return yield* new ContainerConfigError({\n message: `${subject} leads through a symbolic link to a location outside the project. Only files inside the project can be deployed.`,\n ...context,\n });\n }\n return resolved;\n });\n\n/** Reads a project file through {@link resolveInsideProject}. `None` when it does not exist or cannot be read. */\nconst readInsideProject = (\n projectRoot: string,\n projectRelative: string,\n subject: string,\n context: { containerName?: string; filePath?: string }\n) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const resolved = yield* resolveInsideProject(projectRoot, projectRelative, subject, context);\n if (Option.isNone(resolved)) return Option.none<string>();\n return yield* fs.readFileString(resolved.value).pipe(Effect.option);\n });\n\nconst toArgv = (name: string, key: 'entrypoint' | 'command', value: string | string[] | undefined) =>\n value === undefined\n ? Effect.succeed(undefined)\n : Array.isArray(value)\n ? Effect.succeed(value)\n : Effect.try({\n try: () => splitCommandWords(value),\n catch: (error) =>\n new ContainerConfigError({\n message: `Container '${name}' has an invalid ${key}: ${error instanceof Error ? error.message : String(error)}`,\n containerName: name,\n }),\n });\n\nconst isIntegerBetween = (value: number, min: number, max: number) =>\n Number.isInteger(value) && value >= min && value <= max;\n\n/**\n * Applies the v4 schema's bounds to one container. A service imported from\n * Compose never passes the schema, so this is what makes it fail as early and\n * as clearly as a `containers` entry would. The network decoder enforces the\n * same bounds. Messages name keys but never echo environment values.\n */\nconst validateContainer = (name: string, container: ConfigV4Container) => {\n const build = typeof container.build === 'object' ? container.build : undefined;\n const buildArgs = Object.values(build?.args ?? {});\n const env = Object.entries(container.env ?? {});\n const user = container.user === undefined ? undefined : String(container.user);\n const badEnvKey = env.find(([key]) => key === '' || key.includes('=') || key.includes('\\0'))?.[0];\n const longEnvKey = env.find(([, value]) => value.length > MAX_CONTAINER_ENV_VALUE_LENGTH)?.[0];\n\n const problem = (\n [\n [\n container.image !== undefined && !/^\\S{1,512}$/.test(container.image),\n 'has an invalid image reference. Use 1 to 512 characters without whitespace.',\n ],\n [\n container.port !== undefined && !isIntegerBetween(container.port, 1, 65_535),\n `listens on port ${container.port}. Use a whole number from 1 to 65535.`,\n ],\n [\n container.memory !== undefined &&\n !isIntegerBetween(container.memory, MIN_CONTAINER_MEMORY_MB, MAX_CONTAINER_MEMORY_MB),\n `asks for ${container.memory} MB of memory. Use a whole number from ${MIN_CONTAINER_MEMORY_MB} to ${MAX_CONTAINER_MEMORY_MB}.`,\n ],\n [\n container.working_dir !== undefined &&\n !(container.working_dir.startsWith('/') && container.working_dir.length <= 1024),\n `sets working_dir '${container.working_dir}', which must be an absolute path of at most 1024 characters.`,\n ],\n [\n typeof container.user === 'number' && !isIntegerBetween(container.user, 0, Number.MAX_SAFE_INTEGER),\n `sets user ${container.user}. A numeric user must be a non-negative whole number.`,\n ],\n [\n user !== undefined && (user.length === 0 || user.length > 256),\n 'sets an empty or overlong user. Use 1 to 256 characters: a name, a uid, name:group or uid:gid.',\n ],\n [\n build?.target !== undefined && (build.target.length === 0 || build.target.length > 128),\n 'has an empty build target or one longer than 128 characters.',\n ],\n [\n buildArgs.length > MAX_CONTAINER_ENV_VARS ||\n buildArgs.some((value) => value.length > MAX_CONTAINER_ENV_VALUE_LENGTH),\n `sets more than ${MAX_CONTAINER_ENV_VARS} build args, or one longer than ${MAX_CONTAINER_ENV_VALUE_LENGTH} characters.`,\n ],\n [\n env.length > MAX_CONTAINER_ENV_VARS,\n `sets ${env.length} environment variables. At most ${MAX_CONTAINER_ENV_VARS} are allowed.`,\n ],\n [\n badEnvKey !== undefined,\n `sets an environment variable named '${badEnvKey}'. Names must be non-empty and contain no '='.`,\n ],\n [\n longEnvKey !== undefined,\n `sets environment variable '${longEnvKey}' to a value longer than ${MAX_CONTAINER_ENV_VALUE_LENGTH} characters.`,\n ],\n ] satisfies Array<[boolean, string]>\n ).find(([failed]) => failed)?.[1];\n\n return problem === undefined\n ? Effect.void\n : Effect.fail(new ContainerConfigError({ message: `Container '${name}' ${problem}`, containerName: name }));\n};\n\n/**\n * Resolves one `containers` entry into the image spec the deployment builds.\n * The build context and Dockerfile must exist inside the project, also after\n * following symbolic links.\n */\nconst toContainerSpec = Effect.fn('toContainerSpec')(function* (\n name: string,\n container: ConfigV4Container,\n projectFolder: string\n) {\n yield* validateContainer(name, container);\n\n let source: NormalizedContainerImageSource;\n if (container.image !== undefined && container.build === undefined) {\n source = { type: 'registry', reference: container.image };\n } else if (container.build !== undefined && container.image === undefined) {\n const build: ConfigV4ContainerBuild =\n typeof container.build === 'string' ? { context: container.build } : container.build;\n const dockerfile = build.dockerfile ?? 'Dockerfile';\n const context = normalizeProjectPath(build.context ?? '.');\n const dockerfilePath =\n context === undefined || posix.isAbsolute(dockerfile)\n ? undefined\n : normalizeProjectPath(posix.join(context, dockerfile));\n\n if (context === undefined || dockerfilePath === undefined) {\n return yield* new ContainerConfigError({\n message: `Container '${name}' has a build context or Dockerfile outside the project.`,\n containerName: name,\n });\n }\n\n const projectRoot = yield* resolveProjectRoot(projectFolder);\n yield* resolveInsideProject(projectRoot, context, `The build context '${context}' of container '${name}'`, {\n containerName: name,\n });\n const dockerfileReal = yield* resolveInsideProject(\n projectRoot,\n dockerfilePath,\n `The Dockerfile '${dockerfilePath}' of container '${name}'`,\n { containerName: name }\n );\n if (Option.isNone(dockerfileReal)) {\n return yield* new ContainerConfigError({\n message: `Container '${name}' builds '${dockerfilePath}', which does not exist.`,\n containerName: name,\n });\n }\n\n source = {\n type: 'dockerfile',\n context,\n dockerfile: posix.relative(context, dockerfilePath),\n ...(build.target !== undefined && { target: build.target }),\n ...(build.args !== undefined && Object.keys(build.args).length > 0 && { buildArgs: { ...build.args } }),\n };\n } else {\n return yield* new ContainerConfigError({\n message: `Container '${name}' must set exactly one of 'image' and 'build'.`,\n containerName: name,\n });\n }\n\n const entrypoint = yield* toArgv(name, 'entrypoint', container.entrypoint);\n const command = yield* toArgv(name, 'command', container.command);\n\n const spec: NormalizedContainerSpec = {\n name,\n source,\n ...(container.port !== undefined && { port: container.port }),\n ...(entrypoint !== undefined && { entrypoint }),\n ...(command !== undefined && { command }),\n ...(container.working_dir !== undefined && { workingDirectory: container.working_dir }),\n ...(container.user !== undefined && { user: String(container.user) }),\n ...(container.env !== undefined &&\n Object.keys(container.env).length > 0 && { environmentVariables: { ...container.env } }),\n };\n return spec;\n});\n\n/**\n * Turns the `containers` map into container-function entrypoints and sidecars.\n *\n * Validates names, the bounds the v4 schema sets (so Compose-imported entries\n * fail as early as written ones), the sidecar count, and explicitly declared\n * ports that would collide inside one microVM. Ports an image only exposes are\n * checked later, once the image config is known.\n *\n * @param containers - The `containers` map, after any Compose import\n * @param projectFolder - Absolute path to the project root\n */\nexport const normalizeContainers = Effect.fn('normalizeContainers')(function* (\n containers: Readonly<Record<string, ConfigV4Container>>,\n projectFolder: string\n) {\n const entrypoints: NormalizedConfigEntrypoint[] = [];\n const sidecars: NormalizedSidecar[] = [];\n const warnings: string[] = [];\n\n for (const [name, container] of Object.entries(containers)) {\n if (!CONTAINER_NAME_PATTERN.test(name) || name === 'localhost') {\n return yield* new ContainerConfigError({\n message: `Container name '${name}' is invalid. The name is also the hostname the function reaches the container by, so it must be ${CONTAINER_NAME_RULES}. Try '${toContainerName(name)}'.`,\n containerName: name,\n });\n }\n\n const spec = yield* toContainerSpec(name, container, projectFolder);\n\n if (container.sidecar === true) {\n const ignored = (['max_duration', 'streaming', 'schedule'] as const).filter(\n (key) => container[key] !== undefined\n );\n if (ignored.length > 0) {\n warnings.push(\n `Sidecar '${name}' ignores ${ignored.join(', ')}: those settings apply to container functions only.`\n );\n }\n sidecars.push({ ...spec, memory: container.memory ?? DEFAULT_SIDECAR_MEMORY_MB });\n continue;\n }\n\n entrypoints.push({\n path: containerEntrypointPath(name),\n displayName: name,\n runtime: CONTAINER_RUNTIME,\n memory: container.memory ?? DEFAULT_CONTAINER_MEMORY_MB,\n maxDuration: container.max_duration ?? DEFAULT_FUNCTION_DURATION_SECONDS,\n streaming: container.streaming ?? true,\n ...(container.schedule !== undefined && { schedule: container.schedule }),\n container: spec,\n });\n }\n\n if (sidecars.length > MAX_SIDECARS) {\n return yield* new ContainerConfigError({\n message: `A deployment may declare at most ${MAX_SIDECARS} sidecars; this one declares ${sidecars.length}.`,\n });\n }\n\n const sidecarPorts = new Map<number, string>();\n for (const sidecar of sidecars) {\n if (sidecar.port === undefined) continue;\n const owner = sidecarPorts.get(sidecar.port);\n if (owner !== undefined) {\n return yield* new ContainerConfigError({\n message: `Sidecars '${owner}' and '${sidecar.name}' both listen on port ${sidecar.port}. Sidecars share one network namespace, so their ports must differ.`,\n containerName: sidecar.name,\n });\n }\n sidecarPorts.set(sidecar.port, sidecar.name);\n }\n\n for (const entrypoint of entrypoints) {\n const port = entrypoint.container?.port;\n const sidecar = port === undefined ? undefined : sidecarPorts.get(port);\n if (sidecar !== undefined) {\n return yield* new ContainerConfigError({\n message: `Container '${entrypoint.displayName}' and sidecar '${sidecar}' both listen on port ${port}. Sidecars run inside the function's microVM, so their ports must differ.`,\n containerName: sidecar,\n });\n }\n }\n\n return { entrypoints, sidecars, warnings };\n});\n\n// -- Compose import -----------------------------------------------------------------------------\n\ntype ComposeRecord = Record<string, unknown>;\n\nconst isRecord = (value: unknown): value is ComposeRecord =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'string');\n\n/** Compose writes scalar values unquoted, so `PORT: 8080` and `DEBUG: true` arrive as numbers and booleans. */\nconst scalarToString = (value: unknown): string | undefined =>\n typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' ? String(value) : undefined;\n\n/** The `x-gigadrive` extension of a Compose service: `public`, `sidecar` and `skip` markers. */\nconst gigadriveExtension = (service: ComposeRecord): ComposeRecord =>\n isRecord(service['x-gigadrive']) ? service['x-gigadrive'] : {};\n\n/** Override files `docker compose` merges over a Compose file it found under a default name. */\nconst COMPOSE_OVERRIDE_FILE_NAMES = [\n 'compose.override.yaml',\n 'compose.override.yml',\n 'docker-compose.override.yaml',\n 'docker-compose.override.yml',\n] as const;\n\n/** Index of the quote that closes a value opened by `quote`, skipping backslash escapes inside double quotes. */\nconst findClosingQuote = (body: string, quote: string): number => {\n for (let index = 0; index < body.length; index += 1) {\n if (quote === '\"' && body[index] === '\\\\') index += 1;\n else if (body[index] === quote) return index;\n }\n return -1;\n};\n\nconst DOUBLE_QUOTE_ESCAPES: Readonly<Record<string, string>> = { n: '\\n', r: '\\r', t: '\\t' };\n\n/**\n * Reads `KEY=VALUE` lines the way Compose reads `.env` and `env_file`: an\n * optional `export`, quoted values that may span lines and be followed by a\n * comment, escapes inside double quotes, and ` #` comments after unquoted values.\n */\nconst parseDotEnv = (content: string): Record<string, string> => {\n const values: Record<string, string> = {};\n const lines = content.split(/\\r?\\n/);\n for (let index = 0; index < lines.length; index += 1) {\n const match = /^\\s*(?:export\\s+)?([A-Za-z_][A-Za-z0-9_.-]*)\\s*=(.*)$/.exec(lines[index]);\n if (!match) continue;\n const [, key, rest] = match;\n const quote = rest.trimStart()[0];\n if (quote === '\"' || quote === \"'\") {\n let body = rest.trimStart().slice(1);\n let end = index;\n let close = findClosingQuote(body, quote);\n while (close === -1 && end + 1 < lines.length) {\n end += 1;\n body += `\\n${lines[end]}`;\n close = findClosingQuote(body, quote);\n }\n if (close !== -1) {\n const raw = body.slice(0, close);\n values[key] =\n quote === '\"'\n ? raw.replace(/\\\\([nrt\"\\\\])/g, (_match, char: string) => DOUBLE_QUOTE_ESCAPES[char] ?? char)\n : raw;\n index = end;\n continue;\n }\n }\n values[key] = rest.replace(/\\s+#.*$/, '').trim();\n }\n return values;\n};\n\n/** A Compose interpolation that cannot be resolved. The message completes \"Compose service 'x' …\". */\nclass InterpolationError extends Error {}\n\n/** Index of the `}` closing a `${` whose body starts at `start`, skipping nested `${…}` and `$$`. */\nconst findClosingBrace = (value: string, start: number): number => {\n let depth = 0;\n for (let index = start; index < value.length; index += 1) {\n if (value[index] === '$' && (value[index + 1] === '$' || value[index + 1] === '{')) {\n if (value[index + 1] === '{') depth += 1;\n index += 1;\n } else if (value[index] === '}') {\n if (depth === 0) return index;\n depth -= 1;\n }\n }\n return -1;\n};\n\n/**\n * Applies Compose variable interpolation: `$$`, `$VAR`, `${VAR}`, and the\n * `${VAR:-default}`, `${VAR-default}`, `${VAR:?error}`, `${VAR?error}`,\n * `${VAR:+replacement}` and `${VAR+replacement}` forms, whose operands may\n * nest further substitutions. The `:` forms treat an empty value as unset. An\n * unset variable without a default becomes an empty string, as in Compose, and\n * is reported once. A `$` before anything else stays as written.\n *\n * @param where - Location of the value in the service, for error messages\n * @throws InterpolationError for an unset required variable, as `docker compose` aborts, or a malformed `${`\n */\nconst interpolate = (\n value: string,\n variables: Readonly<Record<string, string>>,\n missing: Set<string>,\n where: string\n): string => {\n let result = '';\n let index = 0;\n while (index < value.length) {\n const dollar = value.indexOf('$', index);\n if (dollar === -1) {\n result += value.slice(index);\n break;\n }\n result += value.slice(index, dollar);\n const next = value[dollar + 1];\n\n if (next === '$') {\n result += '$';\n index = dollar + 2;\n continue;\n }\n\n if (next === '{') {\n const close = findClosingBrace(value, dollar + 2);\n const expression =\n close === -1 ? null : /^([A-Za-z_][A-Za-z0-9_]*)(?:(:?[-?+])([\\s\\S]*))?$/.exec(value.slice(dollar + 2, close));\n if (expression === null) {\n throw new InterpolationError(`has an invalid variable reference in ${where}. Write '$$' for a literal '$'.`);\n }\n const [, name, operator, operand = ''] = expression;\n const current = variables[name];\n const isSet = current !== undefined && !(operator?.startsWith(':') === true && current === '');\n if (operator === undefined) {\n if (current === undefined) missing.add(name);\n result += current ?? '';\n } else if (operator.endsWith('-')) {\n result += isSet ? current : interpolate(operand, variables, missing, where);\n } else if (operator.endsWith('+')) {\n result += isSet ? interpolate(operand, variables, missing, where) : '';\n } else if (isSet) {\n result += current;\n } else {\n const reason = interpolate(operand, variables, missing, where);\n throw new InterpolationError(\n `needs variable '${name}' in ${where}, which is ${current === undefined ? 'not set' : 'empty'}${reason === '' ? '' : `: ${reason}`}. Compose variables come only from the .env file next to the Compose file.`\n );\n }\n index = close + 1;\n continue;\n }\n\n const bare = /^[A-Za-z_][A-Za-z0-9_]*/.exec(value.slice(dollar + 1))?.[0];\n if (bare === undefined) {\n result += '$';\n index = dollar + 1;\n continue;\n }\n if (variables[bare] === undefined) missing.add(bare);\n result += variables[bare] ?? '';\n index = dollar + 1 + bare.length;\n }\n return result;\n};\n\n/** Recursively interpolates every string inside a parsed Compose service; `where` tracks the key path. */\nconst interpolateDeep = (\n value: unknown,\n variables: Readonly<Record<string, string>>,\n missing: Set<string>,\n where: string\n): unknown => {\n if (typeof value === 'string') return interpolate(value, variables, missing, where);\n if (Array.isArray(value)) {\n return value.map((item, index) => interpolateDeep(item, variables, missing, `${where}[${index}]`));\n }\n if (isRecord(value)) {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n interpolateDeep(item, variables, missing, where === '' ? key : `${where}.${key}`),\n ])\n );\n }\n return value;\n};\n\n/**\n * Converts a Compose memory size to MB, rounding up. Units are binary however\n * they are spelled, as Docker reads them: `512m`, `512MiB`, `512 MB`, `1.5g`,\n * `1GiB`, or a plain byte count.\n *\n * @returns MB, or `undefined` when Docker would not accept the value\n */\nconst parseComposeMemory = (value: unknown): number | undefined => {\n if (typeof value === 'number') {\n return Number.isFinite(value) && value >= 0 ? Math.ceil(value / 1024 ** 2) : undefined;\n }\n if (typeof value !== 'string') return undefined;\n const match = /^(\\d+(?:\\.\\d+)?) ?([kmgtp])?i?b?$/i.exec(value.trim());\n if (!match) return undefined;\n const exponent = ' kmgtp'.indexOf((match[2] ?? ' ').toLowerCase());\n return Math.ceil((Number(match[1]) * 1024 ** exponent) / 1024 ** 2);\n};\n\n/**\n * Container-side TCP port of a Compose `ports` or `expose` entry: `3000`,\n * `\"8080:80\"`, `\"127.0.0.1:8080:80/tcp\"`, or the long syntax\n * `{ target: 80, published: \"8080\" }`, whose values may be strings after\n * interpolation. UDP entries yield no port.\n */\nconst parseComposePort = (entry: unknown): number | undefined => {\n let port: unknown = entry;\n if (isRecord(entry)) {\n if (typeof entry.protocol === 'string' && entry.protocol.toLowerCase() !== 'tcp') return undefined;\n port = entry.target;\n } else if (typeof entry === 'string') {\n const [withoutProtocol, protocol] = entry.split('/');\n if (protocol !== undefined && protocol.toLowerCase() !== 'tcp') return undefined;\n port = (withoutProtocol.split(':').at(-1) ?? '').split('-')[0];\n }\n const number = typeof port === 'number' ? port : typeof port === 'string' && /^\\d+$/.test(port) ? Number(port) : NaN;\n return isIntegerBetween(number, 1, 65_535) ? number : undefined;\n};\n\nconst parseComposeEnvironment = (\n serviceName: string,\n value: unknown,\n warnings: string[]\n): Record<string, string> | undefined => {\n if (value === undefined || value === null) return undefined;\n const environment: Record<string, string> = {};\n if (Array.isArray(value)) {\n for (const item of value) {\n if (typeof item !== 'string') continue;\n const separator = item.indexOf('=');\n if (separator === -1) {\n warnings.push(\n `Compose service '${serviceName}' takes '${item}' from the host environment, which deployments do not have. Set it in the console instead.`\n );\n continue;\n }\n environment[item.slice(0, separator)] = item.slice(separator + 1);\n }\n } else if (isRecord(value)) {\n for (const [key, item] of Object.entries(value)) {\n const scalar = scalarToString(item);\n if (scalar === undefined) {\n warnings.push(\n `Compose service '${serviceName}' takes '${key}' from the host environment, which deployments do not have. Set it in the console instead.`\n );\n continue;\n }\n environment[key] = scalar;\n }\n }\n return environment;\n};\n\nconst isPublicMarked = (service: ComposeRecord) => gigadriveExtension(service).public === true;\n\nconst buildsFromSource = (service: ComposeRecord) =>\n service.build !== undefined && gigadriveExtension(service).sidecar !== true;\n\n/**\n * Reads and parses a Compose file, and returns the services `docker compose up`\n * would start: those outside any profile and not marked\n * `x-gigadrive: { skip: true }`. Values are not interpolated yet. The file must\n * resolve inside the project, and parse errors never echo its contents.\n */\nconst loadComposeServices = Effect.fn('loadComposeServices')(function* (composePath: string, projectFolder: string) {\n const relativePath = normalizeProjectPath(composePath);\n if (relativePath === undefined) {\n return yield* new ContainerConfigError({\n message: `Compose file '${composePath}' is outside the project.`,\n filePath: composePath,\n });\n }\n\n const projectRoot = yield* resolveProjectRoot(projectFolder);\n const content = yield* readInsideProject(projectRoot, relativePath, `Compose file '${relativePath}'`, {\n filePath: relativePath,\n });\n if (Option.isNone(content)) {\n return yield* new ContainerConfigError({\n message: `Compose file '${relativePath}' could not be read.`,\n filePath: relativePath,\n });\n }\n\n const document = yield* Effect.try({\n try: () => parseYaml(content.value) as unknown,\n catch: (error) => {\n const position = error instanceof YAMLError ? error.linePos?.[0] : undefined;\n return new ContainerConfigError({\n message: `Compose file '${relativePath}' is not valid YAML${position ? ` (line ${position.line}, column ${position.col})` : ''}.`,\n filePath: relativePath,\n });\n },\n });\n\n if (!isRecord(document) || !isRecord(document.services) || Object.keys(document.services).length === 0) {\n return yield* new ContainerConfigError({\n message: `Compose file '${relativePath}' declares no services.`,\n filePath: relativePath,\n });\n }\n\n const services = Object.entries(document.services).filter(\n (entry): entry is [string, ComposeRecord] =>\n isRecord(entry[1]) &&\n !(isStringArray(entry[1].profiles) && entry[1].profiles.length > 0) &&\n gigadriveExtension(entry[1]).skip !== true\n );\n return { relativePath, projectRoot, services };\n});\n\n/**\n * Tells whether a Compose file names an application to deploy: a service\n * marked `x-gigadrive: { public: true }`, or one that builds from source.\n * Auto-detection skips a Compose file without one, such as one that only runs\n * a database for local development.\n *\n * @param composePath - Project-relative path of the Compose file\n * @param projectFolder - Absolute path to the project root\n */\nexport const composeDeclaresApp = Effect.fn('composeDeclaresApp')(function* (\n composePath: string,\n projectFolder: string\n) {\n const { services } = yield* loadComposeServices(composePath, projectFolder);\n return services.some(([, service]) => isPublicMarked(service) || buildsFromSource(service));\n});\n\n/**\n * Reads a Compose file and maps its services onto `containers` entries.\n *\n * The container function is the service marked `x-gigadrive: { public: true }`,\n * or else the only service that builds from source; anything else is\n * ambiguous and fails. Every other service becomes a sidecar that the function\n * reaches by its service name, the way Compose's default network resolves it.\n * Services behind a profile are skipped, as `docker compose up` skips them.\n * Volumes, networks, health checks and restart policies have no equivalent and\n * are dropped; volumes, `extends` and override files are reported.\n *\n * Every file read (the Compose file, `.env`, `env_file`) must resolve inside\n * the project after following symbolic links.\n *\n * @param composePath - Project-relative path of the Compose file\n * @param projectFolder - Absolute path to the project root\n */\nexport const readComposeContainers = Effect.fn('readComposeContainers')(function* (\n composePath: string,\n projectFolder: string\n) {\n const fs = yield* FileSystem.FileSystem;\n const pathSvc = yield* Path.Path;\n\n const { relativePath, projectRoot, services } = yield* loadComposeServices(composePath, projectFolder);\n const composeDirectory = posix.dirname(relativePath);\n const warnings: string[] = [];\n\n for (const [name] of services) {\n if (!CONTAINER_NAME_PATTERN.test(name) || name === 'localhost') {\n return yield* new ContainerConfigError({\n message: `Compose service '${name}' cannot be imported under that name. The service name becomes the hostname the function reaches it by, so it must be ${CONTAINER_NAME_RULES}. Rename the service to '${toContainerName(name)}' in '${relativePath}'.`,\n containerName: name,\n filePath: relativePath,\n });\n }\n }\n\n const marked = services.filter(([, service]) => isPublicMarked(service)).map(([name]) => name);\n const built = services.filter(([, service]) => buildsFromSource(service)).map(([name]) => name);\n if (marked.length > 1) {\n return yield* new ContainerConfigError({\n message: `Compose file '${relativePath}' marks ${marked.map((name) => `'${name}'`).join(', ')} as public. One service serves HTTP: keep 'x-gigadrive: { public: true }' on that one only.`,\n filePath: relativePath,\n });\n }\n const publicService = marked[0] ?? (built.length === 1 ? built[0] : undefined);\n if (publicService === undefined) {\n return yield* new ContainerConfigError({\n message:\n built.length === 0\n ? `Compose file '${relativePath}' has no service that builds from source, so it is unclear which service serves HTTP. Mark it with 'x-gigadrive: { public: true }'.`\n : `Compose file '${relativePath}' builds ${built.map((name) => `'${name}'`).join(', ')} from source, so it is unclear which service serves HTTP. Mark it with 'x-gigadrive: { public: true }'.`,\n filePath: relativePath,\n });\n }\n\n if ((COMPOSE_FILE_NAMES as readonly string[]).includes(posix.basename(relativePath))) {\n for (const overrideName of COMPOSE_OVERRIDE_FILE_NAMES) {\n const overridePath = posix.join(composeDirectory, overrideName);\n const overrideExists = yield* fs\n .exists(pathSvc.join(projectRoot, overridePath))\n .pipe(Effect.orElseSucceed(() => false));\n if (overrideExists) {\n warnings.push(\n `Compose file '${relativePath}' has the override file '${overridePath}' next to it, which is not merged. Move its settings into '${relativePath}' or gigadrive.yaml.`\n );\n }\n }\n }\n\n const dotEnv = yield* readInsideProject(\n projectRoot,\n posix.join(composeDirectory, '.env'),\n `The .env file next to '${relativePath}'`,\n { filePath: relativePath }\n );\n const variables = Option.isSome(dotEnv) ? parseDotEnv(dotEnv.value) : {};\n const missing = new Set<string>();\n\n const containers: Record<string, ConfigV4Container> = {};\n for (const [name, rawService] of services) {\n const isPublic = name === publicService;\n const service = yield* Effect.try({\n try: () => interpolateDeep(rawService, variables, missing, '') as ComposeRecord,\n catch: (error) =>\n new ContainerConfigError({\n message: `Compose service '${name}' ${error instanceof InterpolationError ? error.message : 'could not be interpolated.'}`,\n containerName: name,\n filePath: relativePath,\n }),\n });\n const container: ConfigV4Container = {};\n\n if (service.extends !== undefined) {\n warnings.push(\n `Compose service '${name}' uses 'extends', which is not supported. The service is deployed as written, without the settings it would inherit.`\n );\n }\n\n if (typeof service.image === 'string' && service.build === undefined) {\n container.image = service.image;\n } else if (typeof service.build === 'string' || isRecord(service.build)) {\n const build = typeof service.build === 'string' ? { context: service.build } : service.build;\n if (build.dockerfile_inline !== undefined) {\n return yield* new ContainerConfigError({\n message: `Compose service '${name}' uses build.dockerfile_inline, which is not supported. Commit the Dockerfile and point build.dockerfile at it.`,\n containerName: name,\n filePath: relativePath,\n });\n }\n const rawContext = typeof build.context === 'string' ? build.context : '.';\n // An absolute context stays absolute, so normalizeContainers refuses it as outside the project.\n const context = posix.isAbsolute(rawContext) ? rawContext : posix.join(composeDirectory, rawContext);\n const args = Array.isArray(build.args)\n ? Object.fromEntries(\n build.args\n .filter((item): item is string => typeof item === 'string' && item.includes('='))\n .map((item) => [item.slice(0, item.indexOf('=')), item.slice(item.indexOf('=') + 1)])\n )\n : isRecord(build.args)\n ? Object.fromEntries(Object.entries(build.args).map(([key, item]) => [key, scalarToString(item) ?? '']))\n : undefined;\n container.build = {\n context,\n ...(typeof build.dockerfile === 'string' && { dockerfile: build.dockerfile }),\n ...(typeof build.target === 'string' && { target: build.target }),\n ...(args !== undefined && Object.keys(args).length > 0 && { args }),\n };\n } else {\n return yield* new ContainerConfigError({\n message: `Compose service '${name}' has neither an image nor a build.`,\n containerName: name,\n filePath: relativePath,\n });\n }\n\n if (!isPublic) container.sidecar = true;\n\n const ports = [\n ...(isPublic && Array.isArray(service.ports) ? service.ports : []),\n ...(Array.isArray(service.expose) ? service.expose : []),\n ...(!isPublic && Array.isArray(service.ports) ? service.ports : []),\n ];\n const port = ports.map(parseComposePort).find((value) => value !== undefined);\n if (port !== undefined) container.port = port;\n\n for (const key of ['entrypoint', 'command'] as const) {\n const value = service[key];\n if (typeof value === 'string' || isStringArray(value)) container[key] = value;\n }\n\n const environment: Record<string, string> = {};\n const envFiles = (\n typeof service.env_file === 'string'\n ? [service.env_file]\n : Array.isArray(service.env_file)\n ? service.env_file\n : []\n ).flatMap((entry: unknown): Array<{ path: string; required?: boolean }> =>\n typeof entry === 'string'\n ? [{ path: entry }]\n : isRecord(entry) && typeof entry.path === 'string'\n ? [{ path: entry.path, ...(typeof entry.required === 'boolean' && { required: entry.required }) }]\n : []\n );\n for (const envFile of envFiles) {\n const envFilePath = posix.isAbsolute(envFile.path)\n ? undefined\n : normalizeProjectPath(posix.join(composeDirectory, envFile.path));\n const envContent =\n envFilePath === undefined\n ? Option.none<string>()\n : yield* readInsideProject(\n projectRoot,\n envFilePath,\n `The env_file '${envFile.path}' of Compose service '${name}'`,\n { containerName: name, filePath: relativePath }\n );\n if (Option.isSome(envContent)) {\n Object.assign(environment, parseDotEnv(envContent.value));\n } else if (envFile.required === true) {\n return yield* new ContainerConfigError({\n message: `Compose service '${name}' requires env_file '${envFile.path}', which is not in the deployed source. Commit it, mark it 'required: false', or set those variables in the console.`,\n containerName: name,\n filePath: relativePath,\n });\n } else if (envFile.required === undefined) {\n warnings.push(\n `Compose service '${name}' reads env_file '${envFile.path}', which is not in the deployed source. Set those variables in the console instead.`\n );\n }\n }\n Object.assign(environment, parseComposeEnvironment(name, service.environment, warnings));\n if (Object.keys(environment).length > 0) container.env = environment;\n\n if (typeof service.working_dir === 'string') container.working_dir = service.working_dir;\n if (typeof service.user === 'string' || typeof service.user === 'number') container.user = String(service.user);\n\n const deploy = isRecord(service.deploy) ? service.deploy : {};\n const resources = isRecord(deploy.resources) ? deploy.resources : {};\n const limits = isRecord(resources.limits) ? resources.limits : {};\n const memoryLimit = limits.memory ?? service.mem_limit;\n if (memoryLimit !== undefined && memoryLimit !== null) {\n const memory = parseComposeMemory(memoryLimit);\n if (memory === undefined) {\n warnings.push(\n `Compose service '${name}' sets the memory limit ${JSON.stringify(memoryLimit)}, which is not a size Docker accepts. The default is used instead.`\n );\n } else if (memory >= MIN_CONTAINER_MEMORY_MB && memory <= MAX_CONTAINER_MEMORY_MB) {\n container.memory = memory;\n // Docker reads 0 as no limit, which leaves the default in place without a warning.\n } else if (memory > 0) {\n warnings.push(\n `Compose service '${name}' asks for ${memory} MB of memory, outside the supported ${MIN_CONTAINER_MEMORY_MB} to ${MAX_CONTAINER_MEMORY_MB} MB. The default is used instead.`\n );\n }\n }\n\n if (service.volumes !== undefined) {\n warnings.push(\n `Compose service '${name}' declares volumes. Containers on Gigadrive Network have no persistent volumes, so anything written there is lost when the instance stops.`\n );\n }\n\n containers[name] = container;\n }\n\n if (missing.size > 0) {\n warnings.push(\n `Compose file '${relativePath}' uses ${[...missing].sort().join(', ')}, which ${missing.size === 1 ? 'is' : 'are'} not set. ${missing.size === 1 ? 'It was' : 'They were'} replaced with an empty string.`\n );\n }\n\n return { containers, publicService, warnings };\n});\n","import { Schema } from 'effect';\n\nexport class ConfigFileNotFoundError extends Schema.TaggedError<ConfigFileNotFoundError>()('ConfigFileNotFoundError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class ConfigFileEmptyError extends Schema.TaggedError<ConfigFileEmptyError>()('ConfigFileEmptyError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class ConfigFileParseError extends Schema.TaggedError<ConfigFileParseError>()('ConfigFileParseError', {\n message: Schema.String,\n filePath: Schema.String,\n cause: Schema.optional(Schema.String),\n}) {}\n\nexport class ConfigModuleLoadError extends Schema.TaggedError<ConfigModuleLoadError>()('ConfigModuleLoadError', {\n message: Schema.String,\n filePath: Schema.String,\n cause: Schema.optional(Schema.String),\n}) {}\n\nexport class ConfigVersionError extends Schema.TaggedError<ConfigVersionError>()('ConfigVersionError', {\n message: Schema.String,\n filePath: Schema.String,\n version: Schema.optional(Schema.Number),\n}) {}\n\nexport class ConfigSchemaValidationError extends Schema.TaggedError<ConfigSchemaValidationError>()(\n 'ConfigSchemaValidationError',\n {\n message: Schema.String,\n filePath: Schema.String,\n validationErrors: Schema.Array(Schema.String),\n }\n) {}\n\nexport class FunctionConfigError extends Schema.TaggedError<FunctionConfigError>()('FunctionConfigError', {\n message: Schema.String,\n functionPath: Schema.String,\n}) {}\n\n/** A `containers` entry, or a Compose file imported into one, cannot be deployed as written. */\nexport class ContainerConfigError extends Schema.TaggedError<ContainerConfigError>()('ContainerConfigError', {\n message: Schema.String,\n containerName: Schema.optional(Schema.String),\n filePath: Schema.optional(Schema.String),\n}) {}\n","import type { NormalizedImagePolicy } from './image-policy';\nimport type { GigadriveNextBuildManifestV2Standalone } from './nextjs-manifest';\nimport { type Region } from './regions';\nimport { type Runtime } from './runtime';\n\nexport type {\n NormalizedImageFit,\n NormalizedImageFormat,\n NormalizedImageLocalPattern,\n NormalizedImagePolicy,\n NormalizedImageRemotePattern,\n NormalizedImageVariant,\n} from './image-policy';\n\n/**\n * A map of file paths to their corresponding paths in the deployment.\n *\n * Left side should be an absolute path on the file system.\n * Right side should be a relative path in the deployment package.\n */\nexport type FilePathMap = Record<string, string>;\n\n/**\n * The object structure that all config versions will be parsed into.\n * This is done to provide a consistent interface for the rest of the codebase and easily provision the necessary resources, regardless of the config version.\n */\nexport interface NormalizedConfig {\n /**\n * The regions to deploy the project to.\n */\n regions: Region[];\n\n assets?: {\n /**\n * The relative file paths of the static assets to be deployed to the edge.\n */\n paths?: string[];\n\n /**\n * The prefix to strip from the asset path when serving.\n */\n prefixToStrip?: string;\n\n /**\n * Overrides for specific assets. Can be used to change the path or Content-Type of an asset.\n */\n overrides?: Record<\n string,\n {\n path?: string;\n contentType?: string;\n }\n >;\n\n /**\n * Directory subtrees published under a single URL prefix, registered as one\n * descriptor each instead of enumerating every file. Used to collapse\n * high-cardinality immutable trees such as `.next/static` into a single\n * edge-served prefix (one object-storage sync + one route, not one per file).\n */\n prefixes?: Array<{\n /** Project-relative source directory root (e.g. `.next/static`). */\n source: string;\n /** Public URL prefix to serve the subtree under (e.g. `_next/static`). */\n destination: string;\n /** Serve with immutable cache-control (content-hashed assets). */\n immutable?: boolean;\n /** Populate the edge cache for this subtree at deployment time. */\n populateCache?: boolean;\n /** Optional Content-Type override applied to the whole subtree. */\n contentType?: string;\n }>;\n\n /**\n * Project-relative manifests containing logical static asset entries. A\n * manifest keeps high-cardinality path mappings out of this configuration.\n */\n manifests?: Array<{\n /** Project-relative path to a {@link StaticAssetManifest}. */\n source: string;\n }>;\n\n /**\n * Whether routes for the assets should be generated during deployment.\n */\n dynamicRoutes?: boolean;\n\n /**\n * If true, the assets will be cached at the edge during deployment.\n */\n populateCache?: boolean;\n };\n\n /** Framework-specific runtime metadata understood by the Network gateway. */\n framework?: NormalizedFramework;\n\n /** Provider-neutral managed image optimization policy. */\n images?: NormalizedImagePolicy;\n\n /** Content-addressable files mounted into more than one function package. */\n sharedArtifacts?: NormalizedSharedArtifact[];\n\n /**\n * Additional environment variables to set during runtime and build.\n */\n environmentVariables: Record<string, string>;\n\n /**\n * The bash commands that will be run to build the project.\n */\n commands: string[];\n\n entrypoints: Array<NormalizedConfigEntrypoint>;\n\n routes: Array<NormalizedConfigRoute>;\n\n /** Managed infrastructure declarations supplied through `gigadrive.yaml`. */\n services?: NormalizedConfigService[];\n\n /**\n * Container images that run inside the microVM of every function instance of\n * the deployment, next to the function. Each one is reachable from the\n * function, and from every other sidecar, at `<name>:<port>`.\n *\n * Sidecar state belongs to one instance: it is lost when the instance is\n * retired, and two replicas of a function never share a sidecar.\n */\n sidecars?: NormalizedSidecar[];\n\n /**\n * Settings related to the archive the user uploads to the build workers.\n */\n userArchive?: {\n /**\n * Overwrite the root of the user-uploaded package. This is mostly used for monorepos to make sure all relevant files are included.\n */\n rootOverwrite?: string;\n\n /**\n * Use a whitelist to only include relevant files in monorepos. May be a glob pattern.\n * @see getFilesForPattern\n */\n fileWhitelist?: string[];\n };\n\n /**\n * Glob or regex patterns for files to exclude from the deployment archive.\n * Sourced from framework auto-detection (e.g. `tests/`, `node_modules/`) or\n * user config. Patterns are matched via minimatch and RegExp against relative\n * paths in the project directory.\n */\n excludeFiles?: string[];\n\n /**\n * Warning codes to be printed to the output during deployment.\n */\n warnings: string[];\n\n /**\n * Error codes to be printed to the output during deployment.\n */\n errors: string[];\n}\n\nexport interface NormalizedConfigService {\n type: NormalizedConfigServiceType;\n}\n\n/** Service kinds supported by the normalized deployment configuration. */\nexport type NormalizedConfigServiceType = 'redis' | 'postgres' | 'storage' | 'queues';\n\n/** Fully normalized managed-service declaration consumed by provisioning. */\nexport type NormalizedConfigServiceDefinition =\n | NormalizedConfigServiceRedis\n | NormalizedConfigServicePostgres\n | NormalizedConfigServiceStorage\n | NormalizedConfigServiceQueues;\n\nexport type UpstashAWSRegion =\n | 'us-east-1'\n | 'us-east-2'\n | 'us-west-1'\n | 'us-west-2'\n | 'eu-central-1'\n | 'eu-west-1'\n | 'eu-west-2'\n | 'sa-east-1'\n | 'ap-south-1'\n | 'ap-northeast-1'\n | 'ap-southeast-1'\n | 'ap-southeast-2';\n\nexport interface NormalizedConfigServiceRedis extends NormalizedConfigService {\n type: 'redis';\n envBindings?: Record<'url' | 'host' | 'port' | 'password' | 'db' | 'ssl', string>;\n primaryRegion?: UpstashAWSRegion | 'us-central1';\n readRegions?: UpstashAWSRegion[];\n eviction?: boolean;\n}\n\nexport type NeonAWSRegion =\n | 'us-east-1'\n | 'us-east-2'\n | 'us-west-2'\n | 'ap-southeast-1'\n | 'ap-southeast-2'\n | 'eu-central-1'\n | 'eu-west-2'\n | 'sa-east-1';\n\nexport interface NormalizedConfigServicePostgres extends NormalizedConfigService {\n type: 'postgres';\n envBindings?: Record<'url' | 'host' | 'port' | 'user' | 'password' | 'database', string>;\n postgresVersion?: '17' | '16' | '15' | '14';\n region?: NeonAWSRegion;\n}\n\n/** Declarative File Storage service provisioned in the deployment environment. */\nexport interface NormalizedConfigServiceStorage extends NormalizedConfigService {\n type: 'storage';\n /**\n * Buckets sorted by name for deterministic deployment plans.\n *\n * Names are preserved exactly after schema validation. The deployment\n * environment is authoritative, and global CDN/S3 slugs are generated by\n * the File Storage API rather than stored in configuration.\n */\n buckets: NormalizedConfigStorageBucket[];\n}\n\n/** Desired state for one environment-scoped File Storage bucket. */\nexport interface NormalizedConfigStorageBucket {\n /** Immutable environment-scoped API and IaC identifier. */\n name: string;\n /** Access policy to apply when the bucket is first provisioned. */\n visibility: 'public' | 'private';\n}\n\n/**\n * Declarative queues provisioned in the deployment environment.\n *\n * Durations are resolved to seconds and schedule bodies to strings, so the\n * platform receives one canonical shape. Settings the config omits stay\n * absent and keep the platform's defaults.\n */\nexport interface NormalizedConfigServiceQueues extends NormalizedConfigService {\n type: 'queues';\n /** Queues sorted by name for deterministic deployment plans. */\n queues: NormalizedConfigQueue[];\n}\n\n/** Desired state for one environment-scoped queue. */\nexport interface NormalizedConfigQueue {\n name: string;\n /** Push consumer path; absent or `null` declares a pull queue. */\n consumer?: string | null;\n visibilityTimeoutSeconds?: number;\n retentionSeconds?: number;\n maxAttempts?: number;\n retryBackoffMinSeconds?: number;\n retryBackoffMaxSeconds?: number;\n deduplicationWindowSeconds?: number;\n concurrency?: number | null;\n rateLimit?: { count: number; periodSeconds: number } | null;\n deadLetter?: boolean;\n /** Schedules sorted by name. */\n schedules?: NormalizedConfigQueueSchedule[];\n}\n\n/** One cron schedule that sends into a declared queue. */\nexport interface NormalizedConfigQueueSchedule {\n name: string;\n cron: string;\n timezone?: string;\n body?: string;\n contentType?: string;\n headers?: Record<string, string>;\n enabled?: boolean;\n}\n\n/** Default maximum lifetime of one function invocation, in seconds. */\nexport const DEFAULT_FUNCTION_DURATION_SECONDS = 30;\n\n/** Maximum configurable lifetime of one function invocation, in seconds (eight hours). */\nexport const MAX_FUNCTION_DURATION_SECONDS = 28_800;\n\n/**\n * Runtime tag of an entrypoint that runs a container image instead of a\n * managed language runtime. Such an entrypoint always carries a\n * {@link NormalizedConfigEntrypoint.container} spec.\n */\nexport const CONTAINER_RUNTIME = 'docker';\n\n/** Runtime tag of a container entrypoint. */\nexport type ContainerRuntime = typeof CONTAINER_RUNTIME;\n\n/**\n * Prefix of the synthetic `path` a container entrypoint carries. Routes target a\n * container function with `destination: container:<name>`.\n */\nexport const CONTAINER_ENTRYPOINT_PREFIX = 'container:';\n\n/** Default memory of a container function, in MB. */\nexport const DEFAULT_CONTAINER_MEMORY_MB = 512;\n\n/** Default memory of a sidecar, in MB. It is added to the memory of every function it runs next to. */\nexport const DEFAULT_SIDECAR_MEMORY_MB = 256;\n\n/** Most sidecars one deployment may declare. */\nexport const MAX_SIDECARS = 4;\n\n/** Where the root filesystem of a container comes from. */\nexport type NormalizedContainerImageSource =\n | {\n type: 'registry';\n /** Image reference as written, e.g. `redis:7-alpine` or `ghcr.io/acme/api@sha256:...`. */\n reference: string;\n }\n | {\n type: 'dockerfile';\n /** Project-relative build context directory, `.` for the project root. */\n context: string;\n /** Dockerfile path relative to {@link context}. */\n dockerfile: string;\n /** Build stage to stop at, for multi-stage Dockerfiles. */\n target?: string;\n /** `--build-arg` values. */\n buildArgs?: Record<string, string>;\n };\n\n/**\n * A container image plus the settings that override its image config. The\n * overrides are baked into the signed launch metadata at build time.\n */\nexport interface NormalizedContainerSpec {\n /** Name from the `containers` map. Also the hostname a sidecar answers to. */\n name: string;\n source: NormalizedContainerImageSource;\n /** TCP port the process listens on. Defaults to the image's first exposed port, then 8080. */\n port?: number;\n /** Replaces the image `ENTRYPOINT`. */\n entrypoint?: string[];\n /** Replaces the image `CMD`. */\n command?: string[];\n /** Replaces the image `WORKDIR`. */\n workingDirectory?: string;\n /** Replaces the image `USER`: a name, a uid, `name:group` or `uid:gid`. */\n user?: string;\n /** Merged over the image `ENV`. */\n environmentVariables?: Record<string, string>;\n}\n\n/** A container that runs next to every function instance of the deployment. */\nexport interface NormalizedSidecar extends NormalizedContainerSpec {\n /** Memory reserved for the sidecar, in MB. Added to each function's memory. */\n memory: number;\n}\n\nexport interface NormalizedConfigEntrypoint {\n displayName?: string;\n /**\n * Project-relative file of the function, or `container:<name>` for a\n * container function.\n */\n path: string;\n runtime: Runtime | ContainerRuntime;\n /** Image to run, present exactly when {@link runtime} is `docker`. */\n container?: NormalizedContainerSpec;\n memory: number;\n /**\n * Maximum lifetime of one HTTP request, response stream, or WebSocket connection, in seconds.\n *\n * The limit applies to an invocation, not to the reusable compute environment that happens to\n * serve it. The platform may suspend or reuse that environment after all invocations finish.\n */\n maxDuration: number;\n schedule?: string;\n symlinks?: Record<string, string>;\n environmentVariables?: Record<string, string>;\n streaming?: boolean;\n package?: {\n /** Disable dependency tracing when the framework output is already self-contained. */\n trace?: boolean;\n /** Include the package root in addition to explicitly mapped files. Defaults to true. */\n includeProjectFiles?: boolean;\n /** Preserve mapped symbolic links instead of recursively copying their targets. */\n preserveSymlinks?: boolean;\n rootOverwrite?: string;\n filePathMap?: FilePathMap;\n includeFiles?: string[];\n excludeFiles?: string[];\n /** Shared deployment artifacts that must be mounted before this overlay. */\n sharedArtifactIds?: string[];\n };\n}\n\nexport type NormalizedFramework = NormalizedNextjsFramework;\n\n/**\n * Framework runtime metadata the Network gateway consumes. Mirrors the single\n * standalone-server manifest (minus the wire `version`) plus the persisted\n * discriminators. The whole deployment runs as one standalone server, so this\n * carries prerender/routing/image metadata but no per-route entrypoints.\n */\nexport type NormalizedNextjsFramework = Omit<GigadriveNextBuildManifestV2Standalone, 'version' | 'outputs'> & {\n outputs: Omit<GigadriveNextBuildManifestV2Standalone['outputs'], 'entryPagePaths'>;\n type: 'nextjs';\n schemaVersion: 2;\n /**\n * Bounded sample of prerendered page paths, used to warm the CDN. Replaces\n * carrying the deployment's full prerender table, which grew to tens of\n * thousands of entries on large content sites.\n */\n entryPagePaths?: string[];\n};\n\nexport interface NormalizedSharedArtifact {\n id: string;\n filePathMap: FilePathMap;\n}\n\nexport interface NormalizedConfigRoute {\n path: string;\n destination: string;\n handler: NormalizedConfigRouteHandler | undefined;\n methods: NormalizedConfigRouteMethod[];\n headers: Record<string, string>;\n positiveRequirements?: NormalizedConfigRouteMatchRequirements;\n negativeRequirements?: NormalizedConfigRouteMatchRequirements;\n status?: number;\n}\n\nexport type NormalizedConfigRouteHandler =\n 'SERVERLESS_FUNCTION' | 'SERVERLESS_FUNCTION_STREAMING' | 'HTTP_REDIRECT' | 'HTTP_PROXY' | 'ASSET';\n\nexport type NormalizedConfigRouteMethod = 'ANY' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';\n\nexport type NormalizedConfigRouteMatchRequirements =\n | []\n | [\n | {\n /**\n * The type of request element to check\n */\n type: 'host';\n /**\n * A regular expression used to match the value. Named groups can be used in the destination\n */\n value: string;\n }\n | {\n /**\n * The type of request element to check\n */\n type: 'header' | 'cookie' | 'query';\n /**\n * The name of the element contained in the particular type\n */\n key: string;\n /**\n * A regular expression used to match the value. Named groups can be used in the destination\n */\n value?: string;\n },\n ];\n","import type { ConfigV4 } from './v4';\n\n/**\n * Identity helper providing type inference and checking for `gigadrive.ts`\n * config files. Using it is optional — a plain object default export works the\n * same, but `defineConfig` gives editor autocompletion without a type\n * annotation. Requires `@gigadrive/network-config` to be installed in the\n * project (e.g. as a devDependency).\n *\n * Prefer importing from the `@gigadrive/network-config/define-config` subpath:\n * it is dependency-free, whereas the package root eagerly imports peer\n * dependencies (`effect`, `@effect/platform`) that package managers which do\n * not auto-install peers (e.g. Yarn) will not have installed.\n *\n * Note that a `gigadrive.ts` config is executed as code when the config is\n * read — the same trust model as `build_commands`.\n *\n * @param config - The deployment configuration\n * @returns The configuration, unchanged\n * @example\n * ```ts\n * // gigadrive.ts\n * import { defineConfig } from '@gigadrive/network-config/define-config';\n *\n * export default defineConfig({\n * version: 4,\n * regions: ['eu-central-1'],\n * });\n * ```\n */\nexport const defineConfig = (config: ConfigV4): ConfigV4 => config;\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport { COMPOSE_FILE_NAMES, composeDeclaresApp, normalizeContainers, readComposeContainers } from '../containers';\nimport type { NormalizedConfig } from '../normalized-config';\nimport { AVAILABLE_REGIONS } from '../regions';\nimport type { ConfigV4Container } from '../v4';\n\n/** How a container project was recognized. */\nexport interface ContainerProjectDetection {\n /** `compose` for a Compose file, `dockerfile` for a lone root `Dockerfile`. */\n kind: 'compose' | 'dockerfile';\n /** Project-relative file the configuration came from. */\n file: string;\n /** Deployable configuration: one container function behind a catch-all route, plus any sidecars. */\n config: NormalizedConfig;\n}\n\n/**\n * Recognizes a project that ships as container images: a Compose file first,\n * then a `Dockerfile` at the project root.\n *\n * Callers try this only after finding neither a `gigadrive.yaml` nor a\n * framework. A framework project often carries a Compose file for local\n * databases, and deploying that file instead of the framework would change\n * what an existing project deploys. For the same reason a Compose file counts\n * only when it names an application: a service that builds from source or is\n * marked `x-gigadrive: { public: true }`. One that only runs, say, a database\n * for local development is ignored, and the root `Dockerfile` check follows.\n *\n * @param projectFolder - Absolute path to the project root\n * @returns The detection, or `undefined` when the project has neither file\n */\nexport const detectContainerProject = Effect.fn('detectContainerProject')(function* (projectFolder: string) {\n const fs = yield* FileSystem.FileSystem;\n const pathSvc = yield* Path.Path;\n const exists = (file: string) =>\n fs.exists(pathSvc.join(projectFolder, file)).pipe(Effect.catchAll(() => Effect.succeed(false)));\n\n let detection: {\n kind: ContainerProjectDetection['kind'];\n file: string;\n containers: Record<string, ConfigV4Container>;\n };\n const warnings: string[] = [];\n\n const composeFile = yield* Effect.findFirst(COMPOSE_FILE_NAMES, exists);\n if (composeFile._tag === 'Some' && (yield* composeDeclaresApp(composeFile.value, projectFolder))) {\n const imported = yield* readComposeContainers(composeFile.value, projectFolder);\n warnings.push(...imported.warnings);\n detection = { kind: 'compose', file: composeFile.value, containers: imported.containers };\n } else if (yield* exists('Dockerfile')) {\n detection = { kind: 'dockerfile', file: 'Dockerfile', containers: { app: { build: '.' } } };\n } else {\n return undefined;\n }\n\n const {\n entrypoints,\n sidecars,\n warnings: containerWarnings,\n } = yield* normalizeContainers(detection.containers, projectFolder);\n const [publicContainer] = entrypoints;\n\n const config: NormalizedConfig = {\n regions: [...AVAILABLE_REGIONS],\n environmentVariables: {},\n commands: [],\n entrypoints,\n ...(sidecars.length > 0 && { sidecars }),\n routes: publicContainer\n ? [\n {\n path: '/*',\n destination: publicContainer.path,\n handler: 'SERVERLESS_FUNCTION_STREAMING',\n methods: ['ANY'],\n headers: {},\n },\n ]\n : [],\n warnings: [\n `Auto-detected ${detection.kind === 'compose' ? 'Docker Compose' : 'Dockerfile'} project (${detection.file}). Create a gigadrive.yaml to customize.`,\n ...warnings,\n ...containerWarnings,\n ],\n errors: [],\n };\n\n return { kind: detection.kind, file: detection.file, config } satisfies ContainerProjectDetection;\n});\n","// Define all available regions in a single array\nconst REGION_DEFINITIONS = [\n 'us-east-1',\n 'us-east-2',\n 'us-west-1',\n 'us-west-2',\n 'ap-south-1',\n 'ap-northeast-3',\n 'ap-northeast-2',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ap-northeast-1',\n 'ca-central-1',\n 'eu-central-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'eu-north-1',\n 'sa-east-1',\n] as const;\n\n// Generate the Region type from the array\nexport type Region = (typeof REGION_DEFINITIONS)[number];\n\n// Export the available regions\nexport const AVAILABLE_REGIONS: Region[] = [...REGION_DEFINITIONS];\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport { detectPackageManager } from './detect-package-manager';\nimport { FRAMEWORK_DEFINITIONS } from './frameworks';\nimport { generateConfig } from './generate-config';\nimport { readDependencies } from './read-dependencies';\nimport type { FrameworkDefinition, FrameworkDetectionItem, ManifestParseError, ManifestReadError } from './types';\nimport { FrameworkNotDetectedError } from './types';\n\n/**\n * Evaluates whether a single detection item matches the project.\n *\n * @param cachedReadDeps - Memoized version of readDependencies keyed by `projectFolder\\0language`\n */\nconst matchesDetectionItem = Effect.fn('matchesDetectionItem')(function* (\n item: FrameworkDetectionItem,\n projectFolder: string,\n framework: FrameworkDefinition,\n cachedReadDeps: (\n key: string\n ) => Effect.Effect<Set<string>, ManifestReadError | ManifestParseError, FileSystem.FileSystem | Path.Path>\n) {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n\n // Check matchPackage (uses memoized reader to avoid re-reading the same manifest)\n if (item.matchPackage != null) {\n const deps = yield* cachedReadDeps(`${projectFolder}\\0${framework.language}`);\n\n if (!deps.has(item.matchPackage)) {\n return false;\n }\n }\n\n // Check path existence\n if (item.path != null) {\n const filePath = pathService.join(projectFolder, item.path);\n const exists = yield* fs.exists(filePath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n\n if (!exists) {\n return false;\n }\n\n // Check matchContent (only when path is set)\n if (item.matchContent != null) {\n const content = yield* fs.readFileString(filePath).pipe(Effect.catchAll(() => Effect.succeed('')));\n\n let regexMatch = false;\n try {\n regexMatch = new RegExp(item.matchContent).test(content);\n } catch {\n // Invalid regex pattern in framework definition — treat as no match\n }\n\n if (!regexMatch) {\n return false;\n }\n }\n }\n\n return true;\n});\n\n/**\n * Evaluates whether all detectors for a framework match the project.\n */\nconst matchesFramework = Effect.fn('matchesFramework')(function* (\n framework: FrameworkDefinition,\n projectFolder: string,\n cachedReadDeps: (\n key: string\n ) => Effect.Effect<Set<string>, ManifestReadError | ManifestParseError, FileSystem.FileSystem | Path.Path>\n) {\n for (const detector of framework.detectors) {\n const matches = yield* matchesDetectionItem(detector, projectFolder, framework, cachedReadDeps);\n if (!matches) {\n return false;\n }\n }\n\n return true;\n});\n\n/**\n * Detects the framework used in a project by checking framework definitions\n * against the project's dependencies and file structure.\n *\n * Framework definitions are checked in priority order (highest first).\n * All detectors for a framework must match for it to be selected.\n *\n * @param projectFolder - Absolute path to the project root\n * @returns DetectionResult with framework, package manager, and generated config\n */\nexport const detectFramework = Effect.fn('detectFramework')(function* (projectFolder: string) {\n yield* Effect.logDebug(`Detecting framework in ${projectFolder}`);\n\n // Memoize dependency reads so each manifest (package.json, composer.json) is read at most once.\n // Uses \\0 (null byte) as delimiter to avoid conflicts with ':' in Windows paths (e.g. C:\\...)\n const cachedReadDeps = yield* Effect.cachedFunction((key: string) => {\n const sepIndex = key.lastIndexOf('\\0');\n const folder = key.slice(0, sepIndex);\n const language = key.slice(sepIndex + 1) as 'node' | 'php';\n return readDependencies(folder, language);\n });\n\n for (const framework of FRAMEWORK_DEFINITIONS) {\n const matches = yield* matchesFramework(framework, projectFolder, cachedReadDeps);\n\n if (matches) {\n yield* Effect.log(`Detected framework: ${framework.name}`, { slug: framework.slug });\n\n const detectedPackageManager = yield* detectPackageManager(projectFolder);\n const packageManager = framework.language === 'php' ? 'composer' : detectedPackageManager;\n const defaults = framework.getDefaultConfig(packageManager);\n const refinedDefaults = framework.refineDefaultConfig\n ? yield* framework.refineDefaultConfig(defaults, projectFolder)\n : defaults;\n const config = yield* generateConfig(framework, packageManager, projectFolder, refinedDefaults);\n\n return { framework, packageManager, config };\n }\n }\n\n return yield* Effect.fail(\n new FrameworkNotDetectedError({\n message: `No framework detected in project directory`,\n directory: projectFolder,\n })\n );\n});\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { PackageManager } from './types';\n\n/**\n * Lockfile-to-package-manager mapping, checked in priority order.\n */\nconst LOCKFILE_MAP: Array<{ files: string[]; pm: PackageManager }> = [\n { files: ['bun.lockb', 'bun.lock'], pm: 'bun' },\n { files: ['pnpm-lock.yaml'], pm: 'pnpm' },\n { files: ['yarn.lock'], pm: 'yarn' },\n { files: ['package-lock.json'], pm: 'npm' },\n { files: ['composer.lock'], pm: 'composer' },\n];\n\n/**\n * Detects the package manager by checking for lockfiles in the project folder.\n * Falls back to `npm` if no lockfile is found.\n *\n * @param projectFolder - Absolute path to the project root\n * @returns The detected package manager\n */\nexport const detectPackageManager = Effect.fn('detectPackageManager')(function* (projectFolder: string) {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n\n for (const { files, pm } of LOCKFILE_MAP) {\n for (const file of files) {\n const exists = yield* fs\n .exists(pathService.join(projectFolder, file))\n .pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (exists) {\n yield* Effect.logDebug(`Detected package manager: ${pm} (via ${file})`);\n return pm;\n }\n }\n }\n\n yield* Effect.logDebug('No lockfile found, defaulting to npm');\n return 'npm' satisfies PackageManager;\n});\n","import type { FrameworkDefinition } from '../types';\n\nexport const astro: FrameworkDefinition = {\n slug: 'astro',\n name: 'Astro',\n language: 'node',\n detectors: [{ matchPackage: 'astro' }],\n priority: 85,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['astro build'],\n entrypoint: 'dist/server/entry.mjs',\n assetsDir: 'dist/client',\n populateAssetCache: true,\n routes: [{ source: '/*', destination: 'dist/server/entry.mjs' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n};\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { FrameworkDefaultConfig } from '../types';\n\ninterface PackageJsonManifest {\n main?: unknown;\n scripts?: Record<string, unknown>;\n}\n\n/** Script runners whose first file argument is the server entrypoint. */\nconst SCRIPT_RUNNERS = new Set(['node', 'bun', 'tsx', 'ts-node']);\n\n/** Common entrypoint locations probed on disk, in order of preference. */\nconst COMMON_ENTRYPOINT_CANDIDATES = [\n 'index.js',\n 'src/index.js',\n 'index.ts',\n 'src/index.ts',\n 'app.js',\n 'src/app.js',\n 'server.js',\n 'src/server.js',\n 'app.ts',\n 'src/app.ts',\n 'server.ts',\n 'src/server.ts',\n];\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null;\n\nconst parsePackageJson = (content: string): PackageJsonManifest | undefined => {\n try {\n const parsed: unknown = JSON.parse(content);\n if (!isRecord(parsed)) return undefined;\n return parsed;\n } catch {\n return undefined;\n }\n};\n\nconst normalizeEntrypointPath = (entrypoint: string): string | undefined => {\n const normalized = entrypoint.replace(/\\\\/g, '/').replace(/^\\.\\//, '');\n if (\n !normalized ||\n normalized === '.' ||\n normalized.startsWith('/') ||\n normalized.includes(':') ||\n normalized.split('/').some((segment) => segment === '..')\n ) {\n return undefined;\n }\n return normalized;\n};\n\n/**\n * Extracts the entrypoint file from a `start` script such as `node src/index.js`\n * or `bun run src/index.ts`. Flags are skipped; anything more complex than a\n * single runner invocation is ignored.\n */\nconst parseStartScript = (script: string): string | undefined => {\n const tokens = script.trim().split(/\\s+/);\n if (tokens.length < 2 || !SCRIPT_RUNNERS.has(tokens[0])) return undefined;\n\n let index = 1;\n if (tokens[0] === 'bun' && tokens[index] === 'run') index++;\n while (index < tokens.length && tokens[index].startsWith('-')) index++;\n\n return tokens[index];\n};\n\nconst applyEntrypoint = (defaults: FrameworkDefaultConfig, entrypoint: string): FrameworkDefaultConfig => ({\n ...defaults,\n entrypoint,\n routes: defaults.routes.map((route) =>\n route.destination === defaults.entrypoint ? { ...route, destination: entrypoint } : route\n ),\n});\n\n/**\n * Resolves the server entrypoint for minimal Node/Bun server frameworks\n * (Express, Fastify, Hono, Elysia) from the project instead of trusting the\n * preset's guessed path.\n *\n * Resolution order:\n * 1. `package.json` `main` field (if it points to an existing file)\n * 2. a `node <file>` / `bun run <file>` pattern in `scripts.start`\n * 3. the preset's default entrypoint, then common candidates that exist on disk\n * 4. the preset's default entrypoint as last resort (unchanged defaults)\n *\n * The `routes` destinations that pointed at the default entrypoint follow the\n * resolved entrypoint.\n */\nexport const resolveNodeServerEntrypoint = (\n defaults: FrameworkDefaultConfig,\n projectFolder: string\n): Effect.Effect<FrameworkDefaultConfig, never, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n\n const isFile = (relativePath: string) =>\n fs.stat(pathService.join(projectFolder, relativePath)).pipe(\n Effect.map((info) => info.type === 'File'),\n Effect.catchAll(() => Effect.succeed(false))\n );\n\n const content = yield* fs\n .readFileString(pathService.join(projectFolder, 'package.json'))\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n const manifest = content ? parsePackageJson(content) : undefined;\n\n const startScript = typeof manifest?.scripts?.start === 'string' ? manifest.scripts.start : undefined;\n\n const candidates = [\n typeof manifest?.main === 'string' ? manifest.main : undefined,\n startScript ? parseStartScript(startScript) : undefined,\n defaults.entrypoint,\n ...COMMON_ENTRYPOINT_CANDIDATES,\n ];\n\n for (const candidate of candidates) {\n if (!candidate) continue;\n\n const normalized = normalizeEntrypointPath(candidate);\n if (!normalized) continue;\n\n if (yield* isFile(normalized)) {\n return applyEntrypoint(defaults, normalized);\n }\n }\n\n return defaults;\n });\n","import type { FrameworkDefinition } from '../types';\nimport { resolveNodeServerEntrypoint } from './resolve-node-entrypoint';\n\nexport const elysia: FrameworkDefinition = {\n slug: 'elysia',\n name: 'Elysia',\n language: 'node',\n detectors: [{ matchPackage: 'elysia' }],\n priority: 45,\n getDefaultConfig: () => ({\n runtime: 'bun-1',\n memory: 128,\n maxDuration: 30,\n streaming: true,\n commands: [],\n entrypoint: 'src/index.ts',\n routes: [{ source: '/*', destination: 'src/index.ts' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: resolveNodeServerEntrypoint,\n};\n","import type { FrameworkDefinition } from '../types';\nimport { resolveNodeServerEntrypoint } from './resolve-node-entrypoint';\n\nexport const express: FrameworkDefinition = {\n slug: 'express',\n name: 'Express',\n language: 'node',\n detectors: [{ matchPackage: 'express' }],\n priority: 10,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 128,\n maxDuration: 30,\n streaming: true,\n commands: [],\n entrypoint: 'index.js',\n routes: [{ source: '/*', destination: 'index.js' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: resolveNodeServerEntrypoint,\n};\n","import type { FrameworkDefinition } from '../types';\nimport { resolveNodeServerEntrypoint } from './resolve-node-entrypoint';\n\nexport const fastify: FrameworkDefinition = {\n slug: 'fastify',\n name: 'Fastify',\n language: 'node',\n detectors: [{ matchPackage: 'fastify' }],\n priority: 40,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 128,\n maxDuration: 30,\n streaming: true,\n commands: [],\n entrypoint: 'src/index.ts',\n routes: [{ source: '/*', destination: 'src/index.ts' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: resolveNodeServerEntrypoint,\n};\n","import type { FrameworkDefinition } from '../types';\nimport { resolveNodeServerEntrypoint } from './resolve-node-entrypoint';\n\nexport const hono: FrameworkDefinition = {\n slug: 'hono',\n name: 'Hono',\n language: 'node',\n detectors: [{ matchPackage: 'hono' }],\n priority: 50,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 128,\n maxDuration: 30,\n streaming: true,\n commands: [],\n entrypoint: 'src/index.ts',\n routes: [{ source: '/*', destination: 'src/index.ts' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: resolveNodeServerEntrypoint,\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const laravel: FrameworkDefinition = {\n slug: 'laravel',\n name: 'Laravel',\n language: 'php',\n detectors: [{ matchPackage: 'laravel/framework' }, { path: 'artisan' }],\n priority: 80,\n getDefaultConfig: () => ({\n runtime: 'php-84',\n memory: 256,\n maxDuration: 30,\n streaming: false,\n commands: ['composer require bref/laravel-bridge --update-with-dependencies', 'bun install', 'bun run build'],\n entrypoint: 'public/index.php',\n assetsDir: 'public',\n populateAssetCache: true,\n excludeFiles: ['tests/', 'storage/', '.ddev', 'node_modules/'],\n routes: [{ source: '/*', destination: 'public/index.php' }],\n environmentVariables: {\n APP_NAME: 'Laravel',\n APP_ENV: 'production',\n APP_DEBUG: 'false',\n LOG_CHANNEL: 'stderr',\n LOG_DEPRECATIONS_CHANNEL: 'stderr',\n LOG_LEVEL: 'debug',\n BROADCAST_DRIVER: 'log',\n SESSION_DRIVER: 'cookie',\n },\n }),\n};\n","import { FileSystem } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { FrameworkDefaultConfig, FrameworkDefinition } from '../types';\n\ninterface NestCliJson {\n compilerOptions?: {\n outputPath?: unknown;\n };\n defaultProject?: unknown;\n projects?: Record<\n string,\n {\n compilerOptions?: {\n outputPath?: unknown;\n };\n }\n >;\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null;\n\nconst parseNestCliJson = (content: string): NestCliJson | undefined => {\n try {\n const parsed: unknown = JSON.parse(content);\n if (!isRecord(parsed)) return undefined;\n return parsed;\n } catch {\n return undefined;\n }\n};\n\nconst getProjectOutputPath = (config: NestCliJson): string | undefined => {\n if (typeof config.compilerOptions?.outputPath === 'string') {\n return config.compilerOptions.outputPath;\n }\n\n if (typeof config.defaultProject === 'string') {\n const outputPath = config.projects?.[config.defaultProject]?.compilerOptions?.outputPath;\n if (typeof outputPath === 'string') return outputPath;\n }\n\n const firstProject = Object.values(config.projects ?? {})[0];\n const outputPath = firstProject?.compilerOptions?.outputPath;\n return typeof outputPath === 'string' ? outputPath : undefined;\n};\n\nconst normalizeOutputPath = (outputPath: string): string | undefined => {\n const normalized = outputPath.replace(/\\\\/g, '/').replace(/^\\.\\//, '').replace(/\\/+$/, '');\n if (\n !normalized ||\n normalized === '.' ||\n normalized.startsWith('/') ||\n /^[A-Za-z]:/.test(normalized) ||\n normalized.includes(':') ||\n normalized.split('/').some((segment) => segment === '..')\n ) {\n return undefined;\n }\n return normalized;\n};\n\nconst createNestConfig = (outputPath: string): FrameworkDefaultConfig => {\n const outputDirectory = normalizeOutputPath(outputPath) ?? 'dist';\n const entrypoint = `${outputDirectory}/main.js`;\n\n return {\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['nest build'],\n entrypoint,\n routes: [{ source: '/*', destination: entrypoint }],\n environmentVariables: { NODE_ENV: 'production' },\n };\n};\n\nexport const nestjs: FrameworkDefinition = {\n slug: 'nestjs',\n name: 'NestJS',\n language: 'node',\n detectors: [{ matchPackage: '@nestjs/core' }],\n priority: 90,\n getDefaultConfig: () => createNestConfig('dist'),\n refineDefaultConfig: (defaults, projectFolder) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const content = yield* fs\n .readFileString(`${projectFolder}/nest-cli.json`)\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n\n if (!content) return defaults;\n\n const nestConfig = parseNestCliJson(content);\n const outputPath = nestConfig ? getProjectOutputPath(nestConfig) : undefined;\n\n return outputPath ? createNestConfig(outputPath) : defaults;\n }),\n};\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport { getDefaultPathMap } from '../../build-output-v3/get-default-path-map';\nimport { MAXIMUM_ENTRY_PAGE_PATHS } from '../../nextjs-constants';\nimport {\n parseGigadriveNextBuildManifest,\n type GigadriveNextBuildManifestV1,\n type GigadriveNextBuildManifestV2Standalone,\n} from '../../nextjs-manifest';\nimport type { NormalizedConfigEntrypoint } from '../../normalized-config';\nimport { AVAILABLE_REGIONS } from '../../regions';\nimport type { FrameworkDefaultConfig, FrameworkDefinition } from '../types';\n\nconst toPortablePath = (value: string): string => value.replaceAll('\\\\', '/');\n\n/**\n * Memory for the single standalone server, in MB.\n *\n * The per-route default (256 MB) sized a function that served one route with a\n * small module graph. One standalone server instead holds the whole\n * application's graph and renders its heaviest pages, so the same floor leaves\n * it thrashing the garbage collector on large documents. Node itself sizes its\n * old-space heap from the container limit, which makes 256 MB actively harmful\n * for server rendering rather than merely tight.\n */\nconst STANDALONE_SERVER_MEMORY_MB = 1024;\n\n/**\n * Locates the standalone `server.js` produced by `output: 'standalone'`, preferring\n * the monorepo-nested path (`standalone/<repoRootToProject>/server.js`) over the root\n * one. Returns `undefined` when neither exists (e.g. a build that did not run in\n * standalone mode), so callers can fall back to plain framework defaults.\n */\nconst resolveStandaloneServer = Effect.fn('nextjs.resolveStandaloneServer')(function* (\n projectFolder: string,\n distDir: string,\n repoRootToProject: string\n) {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n const standaloneRoot = pathService.join(projectFolder, distDir, 'standalone');\n const monorepoServer = pathService.join(standaloneRoot, repoRootToProject, 'server.js');\n const rootServer = pathService.join(standaloneRoot, 'server.js');\n const monorepoServerExists = yield* fs.exists(monorepoServer).pipe(Effect.catchAll(() => Effect.succeed(false)));\n const serverPath = monorepoServerExists ? monorepoServer : rootServer;\n const serverExists = yield* fs.exists(serverPath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (!serverExists) return undefined;\n\n const serverDirectory = pathService.dirname(serverPath);\n const entrypoint = toPortablePath(pathService.relative(standaloneRoot, serverPath));\n return { standaloneRoot, serverDirectory, entrypoint };\n});\n\n/**\n * Enumerates the project `public/` tree into per-file static assets plus a package\n * map that copies each file into the standalone server directory. Public files sit\n * at arbitrary root paths and are low-cardinality, so they stay per-file (only the\n * high-cardinality `.next/static` tree is collapsed to a prefix).\n */\nconst buildStandalonePublicAssets = Effect.fn('nextjs.buildStandalonePublicAssets')(function* (\n projectFolder: string,\n standaloneRoot: string,\n serverDirectory: string\n) {\n const pathService = yield* Path.Path;\n const publicFiles = yield* getDefaultPathMap(pathService.join(projectFolder, 'public'));\n const assetPaths: string[] = [];\n const assetOverrides: Record<string, { path: string }> = {};\n const filePathMap: Record<string, string> = {};\n for (const [absolutePath, relativePath] of Object.entries(publicFiles)) {\n const portableRelativePath = toPortablePath(relativePath);\n const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));\n assetPaths.push(projectRelativePath);\n assetOverrides[projectRelativePath] = { path: portableRelativePath };\n filePathMap[absolutePath] = toPortablePath(\n pathService.relative(standaloneRoot, pathService.join(serverDirectory, 'public', relativePath))\n );\n }\n return { assetPaths, assetOverrides, filePathMap };\n});\n\nconst createStaticExportConfig = Effect.fn('nextjs.createStaticExportConfig')(function* (\n defaults: FrameworkDefaultConfig,\n projectFolder: string\n) {\n const pathService = yield* Path.Path;\n const outputDirectory = pathService.join(projectFolder, 'out');\n const files = yield* getDefaultPathMap(outputDirectory);\n const assetPaths: string[] = [];\n const assetOverrides: Record<string, { path: string }> = {};\n\n for (const absolutePath of Object.keys(files)) {\n const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));\n const outputRelativePath = toPortablePath(pathService.relative(outputDirectory, absolutePath));\n assetPaths.push(projectRelativePath);\n\n const routePath =\n outputRelativePath === 'index.html'\n ? ''\n : outputRelativePath.endsWith('/index.html')\n ? outputRelativePath.slice(0, -'/index.html'.length)\n : outputRelativePath;\n assetOverrides[projectRelativePath] = { path: routePath };\n }\n\n return {\n ...defaults,\n entrypoint: undefined,\n routes: [],\n assetsDir: 'out',\n assetsPrefixToStrip: '',\n assetPaths,\n assetOverrides,\n package: undefined,\n };\n});\n\nconst createStandaloneConfig = Effect.fn('nextjs.createStandaloneConfig')(function* (\n defaults: FrameworkDefaultConfig,\n projectFolder: string,\n manifest: GigadriveNextBuildManifestV1\n) {\n const pathService = yield* Path.Path;\n const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);\n if (!resolved) return defaults;\n const { standaloneRoot, serverDirectory, entrypoint } = resolved;\n\n const publicAssets = yield* buildStandalonePublicAssets(projectFolder, standaloneRoot, serverDirectory);\n const assetPaths = [...publicAssets.assetPaths];\n const assetOverrides: Record<string, { path: string }> = { ...publicAssets.assetOverrides };\n const filePathMap: Record<string, string> = { ...publicAssets.filePathMap };\n\n // Legacy path (Next < 16.2): the network prefix matcher may not be available,\n // so `.next/static` stays enumerated per file and copied into the standalone tree.\n const staticFiles = yield* getDefaultPathMap(pathService.join(projectFolder, manifest.distDir, 'static'));\n for (const [absolutePath, relativePath] of Object.entries(staticFiles)) {\n const portableRelativePath = toPortablePath(relativePath);\n const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));\n assetPaths.push(projectRelativePath);\n assetOverrides[projectRelativePath] = { path: `_next/static/${portableRelativePath}` };\n filePathMap[absolutePath] = toPortablePath(\n pathService.relative(standaloneRoot, pathService.join(serverDirectory, manifest.distDir, 'static', relativePath))\n );\n }\n\n return {\n ...defaults,\n entrypoint,\n routes: [{ source: '/*', destination: entrypoint }],\n assetsDir: manifest.distDir,\n assetsPrefixToStrip: '',\n assetPaths,\n assetOverrides,\n package: {\n trace: false,\n rootOverwrite: standaloneRoot,\n filePathMap,\n },\n };\n});\n\nconst createStandaloneV2Config = Effect.fn('nextjs.createStandaloneV2Config')(function* (\n defaults: FrameworkDefaultConfig,\n projectFolder: string,\n manifest: GigadriveNextBuildManifestV2Standalone\n) {\n const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);\n if (!resolved) return defaults;\n const { standaloneRoot, serverDirectory, entrypoint } = resolved;\n\n const publicAssets = yield* buildStandalonePublicAssets(projectFolder, standaloneRoot, serverDirectory);\n const assetPaths = [...publicAssets.assetPaths];\n const assetOverrides: Record<string, { path: string }> = { ...publicAssets.assetOverrides };\n const filePathMap: Record<string, string> = { ...publicAssets.filePathMap };\n\n // `.next/static` collapses into edge-served prefixes (one descriptor, not one\n // registration per hashed chunk). The subtree is served by the edge, not copied\n // into the server package, so it is deliberately absent from `filePathMap`.\n const assetPrefixes = manifest.outputs.staticAssets.map((staticAsset) => ({\n source: staticAsset.sourceDir,\n destination: staticAsset.urlPrefix,\n immutable: staticAsset.immutable,\n populateCache: true,\n }));\n\n const assetManifests = manifest.outputs.assetManifest ? [{ source: manifest.outputs.assetManifest }] : undefined;\n const { entryPagePaths: manifestEntryPagePaths, ...manifestOutputs } = manifest.outputs;\n\n // The complete prerender table is referenced through a sidecar. Keep only a\n // bounded path sample inline so normalized configuration remains compact.\n const entryPagePaths =\n manifestEntryPagePaths?.slice(0, MAXIMUM_ENTRY_PAGE_PATHS) ??\n [\n ...new Set(\n manifest.outputs.prerenders\n .filter((output) => output.fallback?.postponedState === undefined)\n .map((output) => output.pathname)\n .filter((pathname) => pathname.startsWith('/') && !pathname.includes('['))\n ),\n ]\n .sort((left, right) => left.split('/').length - right.split('/').length || left.localeCompare(right))\n .slice(0, MAXIMUM_ENTRY_PAGE_PATHS);\n\n const singleEntrypoint: NormalizedConfigEntrypoint = {\n displayName: 'next-server',\n path: entrypoint,\n runtime: defaults.runtime,\n memory: Math.max(defaults.memory, STANDALONE_SERVER_MEMORY_MB),\n maxDuration: manifest.server.maxDuration ?? defaults.maxDuration,\n streaming: true,\n environmentVariables: {\n NEXT_BUILD_ID: manifest.buildId,\n ...manifest.server.env,\n },\n package: {\n trace: false,\n rootOverwrite: standaloneRoot,\n filePathMap,\n },\n };\n\n const framework = {\n mode: manifest.mode,\n distDir: manifest.distDir,\n repoRootToProject: manifest.repoRootToProject,\n nextVersion: manifest.nextVersion,\n buildId: manifest.buildId,\n server: manifest.server,\n config: manifest.config,\n routing: manifest.routing,\n // Keep high-cardinality output metadata in portable sidecars rather than\n // expanding it into normalized deployment configuration.\n outputs: { ...manifestOutputs, prerenders: [] },\n entryPagePaths,\n type: 'nextjs' as const,\n schemaVersion: 2 as const,\n };\n\n return {\n ...defaults,\n entrypoint: undefined,\n routes: [],\n assetPaths,\n assetOverrides,\n assetPrefixes,\n assetManifests,\n assetsDir: manifest.distDir,\n assetsPrefixToStrip: '',\n populateAssetCache: true,\n package: undefined,\n normalizedConfig: {\n regions: [...AVAILABLE_REGIONS],\n entrypoints: [singleEntrypoint],\n routes: [\n {\n path: '/*',\n destination: entrypoint,\n handler: 'SERVERLESS_FUNCTION_STREAMING' as const,\n methods: ['ANY' as const],\n headers: {},\n },\n ],\n framework,\n images: manifest.config.images,\n sharedArtifacts: [],\n userArchive: { rootOverwrite: standaloneRoot },\n },\n };\n});\n\nexport const nextjs: FrameworkDefinition = {\n slug: 'nextjs',\n name: 'Next.js',\n language: 'node',\n detectors: [{ matchPackage: 'next' }],\n priority: 100,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['next build'],\n entrypoint: '.next/standalone/server.js',\n // No `assetsDir`: this is only the fallback for a standalone build whose\n // Gigadrive manifest is missing, and `.next/static` answers\n // `/_next/static/...` rather than its own stripped prefix. Every path that\n // resolves a real Next.js build (`refineDefaultConfig`) maps those chunks\n // itself, so declaring the directory here would publish them at the wrong\n // URLs.\n populateAssetCache: true,\n routes: [{ source: '/*', destination: '.next/standalone/server.js' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n refineDefaultConfig: (defaults, projectFolder) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const manifestContent = yield* fs\n .readFileString(`${projectFolder}/.gigadrive/nextjs.json`)\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n const manifest = manifestContent ? parseGigadriveNextBuildManifest(manifestContent) : undefined;\n if (!manifest) return defaults;\n\n if (manifest.version === 2) {\n return manifest.mode === 'export'\n ? yield* createStaticExportConfig(defaults, projectFolder)\n : yield* createStandaloneV2Config(defaults, projectFolder, manifest);\n }\n return manifest.output === 'export'\n ? yield* createStaticExportConfig(defaults, projectFolder)\n : yield* createStandaloneConfig(defaults, projectFolder, manifest);\n }),\n};\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\n\n/**\n * Creates a mapping of absolute file paths to their relative paths\n * starting from the provided directory.\n *\n * This is the default path map that will be used for Vercel-based functions,\n * when the function does not specify a filePathMap.\n *\n * @param directory - The absolute path of the directory to process\n * @returns A record where keys are absolute file paths and values are relative paths\n */\nexport const getDefaultPathMap = Effect.fn('getDefaultPathMap')(function* (directory: string) {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n const result: Record<string, string> = {};\n\n const exists = yield* fs.exists(directory).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (!exists) {\n return result;\n }\n\n const MAX_DEPTH = 100;\n\n // Inner helper that closes over `fs`, `pathService`, and `result` — not extracted\n // to Effect.fn because it mutates the outer `result` record via closure.\n const processDirectory = (currentPath: string, basePath: string = '', depth: number = 0): Effect.Effect<void> =>\n Effect.gen(function* () {\n if (depth > MAX_DEPTH) return;\n\n const entries = yield* fs.readDirectory(currentPath).pipe(Effect.catchAll(() => Effect.succeed([] as string[])));\n\n for (const name of entries) {\n const fullPath = pathService.join(currentPath, name);\n const relativePath = basePath ? pathService.join(basePath, name) : name;\n\n const stat = yield* fs.stat(fullPath).pipe(Effect.catchAll(() => Effect.succeed(null)));\n if (!stat) continue;\n\n if (stat.type === 'Directory') {\n yield* processDirectory(fullPath, relativePath, depth + 1);\n } else {\n result[fullPath] = relativePath;\n }\n }\n });\n\n yield* processDirectory(directory);\n return result;\n});\n","/**\n * A representative sample is enough for cache warming. The complete prerender\n * table stays in its sidecar so it cannot expand gateway configuration by\n * thousands of paths.\n */\nexport const MAXIMUM_ENTRY_PAGE_PATHS = 50;\n","import { Schema } from 'effect';\nimport type { NormalizedImagePolicy } from './image-policy';\nimport {\n decodeJson,\n HttpHeadersSchema,\n HttpSingleValueHeadersSchema,\n PortableRelativePathSchema,\n RepositoryRelativePathSchema,\n UrlPathnameSchema,\n} from './manifest-schema';\n\n/** JSON values accepted in the portable Next.js adapter manifest. */\nexport type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };\n\nconst StringArraySchema = Schema.mutable(Schema.Array(Schema.String));\nconst StringRecordSchema = Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.String }));\n\nconst JsonValueSchema: Schema.Schema<JsonValue> = Schema.suspend(() =>\n Schema.Union(\n Schema.Null,\n Schema.Boolean,\n Schema.Number,\n Schema.String,\n Schema.mutable(Schema.Array(JsonValueSchema)),\n Schema.mutable(Schema.Record({ key: Schema.String, value: JsonValueSchema }))\n )\n);\n\nconst ImageLocalPatternSchema = Schema.mutable(\n Schema.Struct({\n pathname: Schema.optional(Schema.String),\n search: Schema.optional(Schema.String),\n })\n);\nconst ImageRemotePatternSchema = Schema.mutable(\n Schema.Struct({\n protocol: Schema.optional(Schema.Literal('http', 'https')),\n hostname: Schema.String,\n port: Schema.optional(Schema.String),\n pathname: Schema.optional(Schema.String),\n search: Schema.optional(Schema.String),\n })\n);\nconst ImageVariantSchema = Schema.mutable(\n Schema.Struct({\n width: Schema.optional(Schema.Number),\n height: Schema.optional(Schema.Number),\n quality: Schema.optional(Schema.Number),\n format: Schema.optional(Schema.Literal('image/avif', 'image/webp', 'image/jpeg', 'image/png')),\n fit: Schema.optional(Schema.Literal('contain', 'cover', 'fill', 'inside', 'outside')),\n })\n);\nconst PositiveIntSchema = Schema.Int.pipe(Schema.greaterThan(0));\nconst ImagePolicySchema: Schema.Schema<NormalizedImagePolicy> = Schema.mutable(\n Schema.Struct({\n localPatterns: Schema.mutable(Schema.Array(ImageLocalPatternSchema)),\n remotePatterns: Schema.mutable(Schema.Array(ImageRemotePatternSchema)),\n widths: Schema.mutable(Schema.Array(PositiveIntSchema)),\n heights: Schema.mutable(Schema.Array(PositiveIntSchema)),\n qualities: Schema.mutable(Schema.Array(Schema.Number.pipe(Schema.between(1, 100)))),\n formats: Schema.mutable(Schema.Array(Schema.Literal('image/avif', 'image/webp', 'image/jpeg', 'image/png'))),\n minimumCacheTTL: Schema.Number,\n dangerouslyAllowSVG: Schema.Boolean,\n contentSecurityPolicy: Schema.String,\n contentDispositionType: Schema.Literal('inline', 'attachment'),\n maximumRedirects: Schema.Number,\n maximumResponseBody: Schema.Number,\n variants: Schema.mutable(Schema.Record({ key: Schema.String, value: ImageVariantSchema })),\n })\n);\n\nconst GigadriveNextPrerenderOutputFields = {\n id: Schema.String,\n type: Schema.Literal('PRERENDER'),\n pathname: UrlPathnameSchema,\n route: Schema.optional(UrlPathnameSchema),\n parentOutputId: Schema.String,\n groupId: Schema.Number,\n pprChain: Schema.optional(Schema.mutable(Schema.Struct({ headers: HttpSingleValueHeadersSchema }))),\n parentFallbackMode: Schema.optional(JsonValueSchema),\n fallback: Schema.optional(\n Schema.mutable(\n Schema.Struct({\n filePath: Schema.optional(PortableRelativePathSchema),\n initialStatus: Schema.optional(Schema.Int.pipe(Schema.between(100, 599))),\n initialHeaders: Schema.optional(HttpHeadersSchema),\n initialExpiration: Schema.optional(Schema.Number),\n initialRevalidate: Schema.optional(Schema.Union(Schema.Number, Schema.Literal(false))),\n postponedState: Schema.optional(Schema.String),\n })\n )\n ),\n config: Schema.mutable(\n Schema.Struct({\n allowQuery: Schema.optional(StringArraySchema),\n allowHeader: Schema.optional(StringArraySchema),\n bypassFor: Schema.optional(Schema.mutable(Schema.Array(JsonValueSchema))),\n renderingMode: Schema.optional(Schema.String),\n partialFallback: Schema.optional(Schema.Boolean),\n bypassToken: Schema.optional(Schema.String),\n })\n ),\n} as const;\n\nconst GigadriveNextPrerenderClassificationSchema = Schema.Struct({\n routeType: Schema.Literal('route', 'fallback', 'shell', 'page'),\n response: Schema.Literal('empty', 'initial', 'complete'),\n compute: Schema.Literal('blocking', 'resuming', 'static'),\n htmlSize: Schema.optional(Schema.Number),\n});\n\nconst GigadriveNextPrerenderWithoutClassificationSchema = Schema.Struct({\n routeType: Schema.optional(Schema.Never),\n response: Schema.optional(Schema.Never),\n compute: Schema.optional(Schema.Never),\n htmlSize: Schema.optional(Schema.Never),\n});\n\n/**\n * Portable Next.js prerender metadata.\n *\n * A fallback file is a mutable incremental-cache build seed, not a permanently\n * authoritative static asset. Consumers must evaluate bypass, preview,\n * revalidation, and PPR metadata before using it, and may only short-circuit\n * ordinary GET and HEAD requests.\n */\nexport const GigadriveNextPrerenderOutputSchema = Schema.Union(\n Schema.mutable(\n Schema.Struct({ ...GigadriveNextPrerenderOutputFields, ...GigadriveNextPrerenderClassificationSchema.fields })\n ),\n Schema.mutable(\n Schema.Struct({\n ...GigadriveNextPrerenderOutputFields,\n ...GigadriveNextPrerenderWithoutClassificationSchema.fields,\n })\n )\n);\nexport type GigadriveNextPrerenderOutput = Schema.Schema.Type<typeof GigadriveNextPrerenderOutputSchema>;\n\n/** A directory subtree published under one URL prefix. */\nexport const GigadriveNextStaticAssetPrefixSchema = Schema.mutable(\n Schema.Struct({\n sourceDir: PortableRelativePathSchema,\n urlPrefix: PortableRelativePathSchema,\n immutable: Schema.Boolean,\n })\n);\nexport type GigadriveNextStaticAssetPrefix = Schema.Schema.Type<typeof GigadriveNextStaticAssetPrefixSchema>;\n\n/** Portable request condition used by a Next.js middleware/Proxy matcher. */\nexport const GigadriveNextRouteConditionSchema = Schema.Union(\n Schema.mutable(\n Schema.Struct({\n type: Schema.Literal('header', 'cookie', 'query'),\n key: Schema.String,\n value: Schema.optional(Schema.String),\n })\n ),\n Schema.mutable(\n Schema.Struct({\n type: Schema.Literal('host'),\n value: Schema.String,\n })\n )\n);\nexport type GigadriveNextRouteCondition = Schema.Schema.Type<typeof GigadriveNextRouteConditionSchema>;\n\n/** Validated public matcher metadata for a Next.js middleware or Proxy entrypoint. */\nexport const GigadriveNextMiddlewareMatcherSchema = Schema.mutable(\n Schema.Struct({\n source: Schema.String,\n sourceRegex: Schema.String,\n has: Schema.optional(Schema.mutable(Schema.Array(GigadriveNextRouteConditionSchema))),\n missing: Schema.optional(Schema.mutable(Schema.Array(GigadriveNextRouteConditionSchema))),\n })\n);\nexport type GigadriveNextMiddlewareMatcher = Schema.Schema.Type<typeof GigadriveNextMiddlewareMatcherSchema>;\n\n/**\n * Portable middleware/Proxy discovery result.\n *\n * The object is emitted for every new standalone build. Its optional position\n * in the containing manifest preserves parsing of manifests written by older\n * SDK releases, where absence means that middleware presence is unknown.\n */\nexport const GigadriveNextMiddlewareDescriptorSchema = Schema.Union(\n Schema.mutable(\n Schema.Struct({\n present: Schema.Literal(true),\n matchers: Schema.mutable(Schema.Array(GigadriveNextMiddlewareMatcherSchema)),\n })\n ),\n Schema.mutable(\n Schema.Struct({\n present: Schema.Literal(false),\n matchers: Schema.mutable(Schema.Tuple()),\n })\n )\n);\nexport type GigadriveNextMiddlewareDescriptor = Schema.Schema.Type<typeof GigadriveNextMiddlewareDescriptorSchema>;\n\n/** Aggregated runtime configuration for the standalone server. */\nexport const GigadriveNextServerDescriptorSchema = Schema.mutable(\n Schema.Struct({\n maxDuration: Schema.optional(Schema.Number),\n preferredRegion: Schema.optional(Schema.Union(Schema.String, StringArraySchema)),\n env: Schema.optional(StringRecordSchema),\n })\n);\nexport type GigadriveNextServerDescriptor = Schema.Schema.Type<typeof GigadriveNextServerDescriptorSchema>;\n\nconst PrerenderArraySchema = Schema.mutable(Schema.Array(GigadriveNextPrerenderOutputSchema));\nconst StaticAssetArraySchema = Schema.mutable(Schema.Array(GigadriveNextStaticAssetPrefixSchema));\nconst JsonValueArraySchema = Schema.mutable(Schema.Array(JsonValueSchema));\n\n/** Methods for which a validated prerender seed may participate in response lookup. */\nexport const GigadriveNextPrerenderSeedMethodsSchema = Schema.mutable(\n Schema.Tuple(Schema.Literal('GET'), Schema.Literal('HEAD'))\n);\nexport type GigadriveNextPrerenderSeedMethods = Schema.Schema.Type<typeof GigadriveNextPrerenderSeedMethodsSchema>;\n\nexport const GigadriveNextBuildManifestV1Schema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(1),\n output: Schema.Literal('standalone', 'export'),\n distDir: PortableRelativePathSchema,\n repoRootToProject: RepositoryRelativePathSchema,\n nextVersion: Schema.String,\n buildId: Schema.String,\n })\n);\nexport type GigadriveNextBuildManifestV1 = Schema.Schema.Type<typeof GigadriveNextBuildManifestV1Schema>;\n\n/** Minimal plan for static-export builds. */\nexport const GigadriveNextBuildManifestV2ExportSchema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(2),\n mode: Schema.Literal('export'),\n distDir: PortableRelativePathSchema,\n repoRootToProject: RepositoryRelativePathSchema,\n nextVersion: Schema.String,\n buildId: Schema.String,\n })\n);\nexport type GigadriveNextBuildManifestV2Export = Schema.Schema.Type<typeof GigadriveNextBuildManifestV2ExportSchema>;\n\n/** Portable runtime plan for a standalone Next.js server. */\nexport const GigadriveNextBuildManifestV2StandaloneSchema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(2),\n mode: Schema.Literal('standalone-v2'),\n distDir: PortableRelativePathSchema,\n repoRootToProject: RepositoryRelativePathSchema,\n nextVersion: Schema.String,\n buildId: Schema.String,\n server: GigadriveNextServerDescriptorSchema,\n config: Schema.mutable(\n Schema.Struct({\n basePath: Schema.String,\n trailingSlash: Schema.Boolean,\n cacheComponents: Schema.Boolean,\n i18n: Schema.optional(JsonValueSchema),\n images: Schema.optional(ImagePolicySchema),\n })\n ),\n routing: Schema.mutable(\n Schema.Struct({\n beforeMiddleware: JsonValueArraySchema,\n beforeFiles: JsonValueArraySchema,\n afterFiles: JsonValueArraySchema,\n dynamicRoutes: JsonValueArraySchema,\n onMatch: JsonValueArraySchema,\n fallback: JsonValueArraySchema,\n shouldNormalizeNextData: Schema.Boolean,\n rsc: JsonValueSchema,\n })\n ),\n outputs: Schema.mutable(\n Schema.Struct({\n prerenders: PrerenderArraySchema,\n prerenderManifest: Schema.optional(PortableRelativePathSchema),\n assetManifest: Schema.optional(PortableRelativePathSchema),\n entryPagePaths: Schema.optional(Schema.mutable(Schema.Array(UrlPathnameSchema))),\n staticAssets: StaticAssetArraySchema,\n middleware: Schema.optional(GigadriveNextMiddlewareDescriptorSchema),\n })\n ),\n })\n);\nexport type GigadriveNextBuildManifestV2Standalone = Schema.Schema.Type<\n typeof GigadriveNextBuildManifestV2StandaloneSchema\n>;\n\nexport const GigadriveNextBuildManifestSchema = Schema.Union(\n GigadriveNextBuildManifestV1Schema,\n GigadriveNextBuildManifestV2ExportSchema,\n GigadriveNextBuildManifestV2StandaloneSchema\n);\nexport type GigadriveNextBuildManifestV2 = GigadriveNextBuildManifestV2Standalone | GigadriveNextBuildManifestV2Export;\nexport type GigadriveNextBuildManifest = Schema.Schema.Type<typeof GigadriveNextBuildManifestSchema>;\n\n/**\n * Portable sidecar containing high-cardinality Next.js prerender build seeds.\n *\n * `seedMethods` is optional only for parsing sidecars emitted by older SDK\n * releases. New adapters always emit the explicit GET/HEAD method scope.\n */\nexport const GigadriveNextPrerenderManifestV1Schema = Schema.mutable(\n Schema.Struct({\n version: Schema.Literal(1),\n seedMethods: Schema.optional(GigadriveNextPrerenderSeedMethodsSchema),\n prerenders: PrerenderArraySchema,\n })\n);\nexport type GigadriveNextPrerenderManifestV1 = Schema.Schema.Type<typeof GigadriveNextPrerenderManifestV1Schema>;\n\n/** Parses and structurally validates adapter metadata before deployment code consumes it. */\nexport const parseGigadriveNextBuildManifest = (content: string): GigadriveNextBuildManifest | undefined =>\n decodeJson(GigadriveNextBuildManifestSchema, content);\n\n/** Parses and validates a portable Next.js prerender sidecar. */\nexport const parseGigadriveNextPrerenderManifest = (content: string): GigadriveNextPrerenderManifestV1 | undefined =>\n decodeJson(GigadriveNextPrerenderManifestV1Schema, content);\n","import { FileSystem } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { FrameworkDefinition } from '../types';\n\nconst isVercelBuildOutputV3 = (content: string): boolean => {\n try {\n const config: unknown = JSON.parse(content);\n return (\n typeof config === 'object' &&\n config !== null &&\n 'version' in config &&\n typeof config.version === 'number' &&\n config.version >= 3\n );\n } catch {\n return false;\n }\n};\n\nexport const nuxt: FrameworkDefinition = {\n slug: 'nuxt',\n name: 'Nuxt',\n language: 'node',\n detectors: [{ matchPackage: 'nuxt' }],\n priority: 95,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['nuxt build'],\n entrypoint: '.output/server/index.mjs',\n assetsDir: '.output/public',\n populateAssetCache: true,\n routes: [{ source: '/*', destination: '.output/server/index.mjs' }],\n environmentVariables: { NODE_ENV: 'production', NITRO_PRESET: 'node-server' },\n }),\n refineDefaultConfig: (defaults, projectFolder) =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const buildOutputConfig = yield* fs\n .readFileString(`${projectFolder}/.vercel/output/config.json`)\n .pipe(Effect.catchAll(() => Effect.succeed(undefined)));\n\n if (!buildOutputConfig || !isVercelBuildOutputV3(buildOutputConfig)) {\n return defaults;\n }\n\n return {\n ...defaults,\n entrypoint: undefined,\n assetsDir: '.vercel/output/static',\n routes: [],\n environmentVariables: { ...defaults.environmentVariables, NITRO_PRESET: 'vercel' },\n };\n }),\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const remix: FrameworkDefinition = {\n slug: 'remix',\n name: 'Remix',\n language: 'node',\n detectors: [{ matchPackage: '@remix-run/dev' }],\n priority: 90,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['remix build'],\n entrypoint: 'build/server/index.js',\n assetsDir: 'build/client',\n populateAssetCache: true,\n routes: [{ source: '/*', destination: 'build/server/index.js' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const sveltekit: FrameworkDefinition = {\n slug: 'sveltekit',\n name: 'SvelteKit',\n language: 'node',\n detectors: [{ matchPackage: '@sveltejs/kit' }],\n priority: 90,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 256,\n maxDuration: 30,\n streaming: true,\n commands: ['vite build'],\n entrypoint: 'build/index.js',\n assetsDir: 'build/client',\n populateAssetCache: true,\n routes: [{ source: '/*', destination: 'build/index.js' }],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const symfony: FrameworkDefinition = {\n slug: 'symfony',\n name: 'Symfony',\n language: 'php',\n detectors: [{ matchPackage: 'symfony/framework-bundle' }, { path: 'bin/console' }],\n priority: 80,\n getDefaultConfig: () => ({\n runtime: 'php-84',\n memory: 512,\n maxDuration: 30,\n streaming: false,\n installCommand: 'composer install --prefer-dist --optimize-autoloader --no-dev',\n commands: ['bun install', 'bun run build'],\n entrypoint: 'public/index.php',\n assetsDir: 'public',\n populateAssetCache: true,\n excludeFiles: ['tests/*', '.ddev', 'var'],\n symlinks: { var: '/tmp' },\n routes: [{ source: '/*', destination: 'public/index.php' }],\n environmentVariables: {\n APP_ENV: 'prod',\n APP_DEBUG: 'false',\n APP_SECRET: 'please_change_this_value_in_your_settings',\n MESSENGER_TRANSPORT_DSN: 'doctrine://default?auto_setup=0',\n },\n }),\n};\n","import type { FrameworkDefinition } from '../types';\n\nexport const vite: FrameworkDefinition = {\n slug: 'vite',\n name: 'Vite',\n language: 'node',\n detectors: [{ matchPackage: 'vite' }],\n priority: 5,\n getDefaultConfig: () => ({\n runtime: 'node-22',\n memory: 128,\n maxDuration: 30,\n streaming: false,\n commands: ['vite build'],\n assetsDir: 'dist',\n populateAssetCache: true,\n routes: [],\n environmentVariables: { NODE_ENV: 'production' },\n }),\n};\n","import type { FrameworkDefinition } from '../types';\nimport { astro } from './astro';\nimport { elysia } from './elysia';\nimport { express } from './express';\nimport { fastify } from './fastify';\nimport { hono } from './hono';\nimport { laravel } from './laravel';\nimport { nestjs } from './nestjs';\nimport { nextjs } from './nextjs';\nimport { nuxt } from './nuxt';\nimport { remix } from './remix';\nimport { sveltekit } from './sveltekit';\nimport { symfony } from './symfony';\nimport { vite } from './vite';\n\n/**\n * All supported framework definitions, sorted by priority descending.\n * Higher priority frameworks are checked first during detection.\n */\nexport const FRAMEWORK_DEFINITIONS: FrameworkDefinition[] = [\n nextjs,\n nuxt,\n nestjs,\n remix,\n sveltekit,\n astro,\n laravel,\n symfony,\n hono,\n elysia,\n fastify,\n express,\n vite,\n].sort((a, b) => b.priority - a.priority);\n","import { Effect } from 'effect';\nimport { collectAssetFiles } from '../collect-asset-files';\nimport type { NormalizedConfig } from '../normalized-config';\nimport { AVAILABLE_REGIONS } from '../regions';\nimport type { FrameworkDefaultConfig, FrameworkDefinition, PackageManager } from './types';\n\n/**\n * Returns the install command for the given package manager.\n */\nconst getInstallCommand = (pm: PackageManager): string => {\n switch (pm) {\n case 'bun':\n return 'bun install';\n case 'pnpm':\n return 'pnpm install';\n case 'yarn':\n return 'yarn install';\n case 'composer':\n return 'composer install';\n case 'npm':\n default:\n return 'npm install';\n }\n};\n\n/**\n * Generates a NormalizedConfig from a framework definition and detected package manager.\n * Prepends the install command and builds a complete deployment configuration.\n *\n * Runs after the customer build, so a framework's `assetsDir` is resolved\n * against real build output.\n *\n * @param framework - The detected framework definition\n * @param packageManager - The detected package manager\n * @param projectFolder - Absolute path to the project root, used to enumerate `assetsDir`\n * @returns A complete NormalizedConfig with framework defaults\n */\nexport const generateConfig = Effect.fn('generateConfig')(function* (\n framework: FrameworkDefinition,\n packageManager: PackageManager,\n projectFolder: string,\n refinedDefaults?: FrameworkDefaultConfig\n) {\n const defaults = refinedDefaults ?? framework.getDefaultConfig(packageManager);\n\n const installCmd = defaults.installCommand ?? getInstallCommand(packageManager);\n const commands = [installCmd, ...defaults.commands];\n\n yield* Effect.logDebug(`Generating config for ${framework.name}`, {\n runtime: defaults.runtime,\n entrypoint: defaults.entrypoint,\n commands,\n });\n\n const entrypoints =\n defaults.normalizedConfig?.entrypoints ??\n (defaults.entrypoint\n ? [\n {\n path: defaults.entrypoint,\n runtime: defaults.runtime,\n memory: defaults.memory,\n maxDuration: defaults.maxDuration,\n streaming: defaults.streaming,\n symlinks: defaults.symlinks,\n package: defaults.package,\n },\n ]\n : []);\n\n const routes =\n defaults.normalizedConfig?.routes ??\n (defaults.entrypoint\n ? defaults.routes.map((route) => ({\n path: route.source,\n destination: route.destination,\n handler: defaults.streaming ? ('SERVERLESS_FUNCTION_STREAMING' as const) : ('SERVERLESS_FUNCTION' as const),\n methods: ['ANY' as const],\n headers: {},\n }))\n : []);\n\n const config: NormalizedConfig = {\n regions: [...AVAILABLE_REGIONS],\n environmentVariables: { ...defaults.environmentVariables },\n commands,\n entrypoints,\n routes,\n excludeFiles: defaults.excludeFiles && defaults.excludeFiles.length > 0 ? [...defaults.excludeFiles] : undefined,\n warnings: [`Auto-detected framework: ${framework.name}. Create a gigadrive.yaml to customize.`],\n errors: [],\n ...defaults.normalizedConfig,\n };\n\n if (defaults.assetsDir || defaults.assetPaths || defaults.assetPrefixes || defaults.assetManifests) {\n const paths = defaults.assetPaths ? [...defaults.assetPaths] : [];\n const overrides: Record<string, { path?: string; contentType?: string }> = { ...defaults.assetOverrides };\n\n // With neither an entrypoint nor a route the deployment is nothing but\n // static files, so directory index files also answer their extensionless\n // path, the way every static host serves them. Anywhere a function or route\n // could own those paths, the index files keep their literal path.\n const servesDirectoryIndexes = entrypoints.length === 0 && routes.length === 0;\n\n // `assetsDir` is a framework's declaration that a build output directory\n // belongs on the edge, and nothing downstream expands it into files: a\n // detected framework that only set `assetsDir` used to deploy zero static\n // assets. Frameworks that resolve their own sources (Next.js, and any\n // prefix- or manifest-backed collection) keep them untouched.\n const assetsDir = defaults.assetsDir;\n if (assetsDir && !defaults.assetPaths && !defaults.assetPrefixes && !defaults.assetManifests) {\n for (const file of yield* collectAssetFiles(projectFolder, assetsDir)) {\n // A PHP framework's asset directory is its document root, so it also\n // holds the scripts the runtime executes. An exact-path asset route\n // outranks the front controller's wildcard, so publishing one would\n // serve its source instead of running it.\n if (framework.language === 'php' && /\\.(php|phtml|phar)$/i.test(file)) continue;\n\n paths.push(`${assetsDir}/${file}`);\n\n // Overrides are keyed by the prefix-stripped path, which is the key\n // asset publication resolves them by.\n if (!servesDirectoryIndexes || file in overrides) continue;\n if (file === 'index.html') {\n overrides[file] = { path: '' };\n } else if (file.endsWith('/index.html')) {\n overrides[file] = { path: file.slice(0, -'/index.html'.length) };\n }\n }\n }\n\n config.assets = {\n paths,\n prefixToStrip: defaults.assetsPrefixToStrip ?? (defaults.assetsDir ? defaults.assetsDir + '/' : ''),\n overrides: Object.keys(overrides).length > 0 ? overrides : undefined,\n prefixes: defaults.assetPrefixes ? defaults.assetPrefixes.map((prefix) => ({ ...prefix })) : undefined,\n manifests: defaults.assetManifests ? defaults.assetManifests.map((manifest) => ({ ...manifest })) : undefined,\n dynamicRoutes: true,\n populateCache: defaults.populateAssetCache ?? false,\n };\n }\n\n return config;\n});\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport type { FrameworkLanguage } from './types';\nimport { ManifestNotFoundError, ManifestParseError, ManifestReadError } from './types';\n\n/**\n * Manifest file configuration for each supported language.\n */\nconst MANIFEST_CONFIG: Record<FrameworkLanguage, { file: string; depKeys: string[] }> = {\n node: { file: 'package.json', depKeys: ['dependencies', 'devDependencies'] },\n php: { file: 'composer.json', depKeys: ['require', 'require-dev'] },\n};\n\n/**\n * Reads and parses a JSON manifest file, returning the parsed object.\n *\n * @param filePath - Absolute path to the manifest file\n * @returns The parsed JSON object, or fails with ManifestReadError\n */\nconst readManifest = Effect.fn('readManifest')(function* (filePath: string) {\n const fs = yield* FileSystem.FileSystem;\n\n const exists = yield* fs.exists(filePath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (!exists) {\n return yield* Effect.fail(new ManifestNotFoundError({ message: 'Manifest not found', filePath }));\n }\n\n const content = yield* fs\n .readFileString(filePath)\n .pipe(Effect.mapError(() => new ManifestReadError({ message: 'Failed to read manifest', filePath })));\n\n const parsed = yield* Effect.try({\n try: () => JSON.parse(content) as Record<string, unknown>,\n catch: () => new ManifestParseError({ message: 'Failed to parse manifest JSON', filePath }),\n });\n\n return parsed;\n});\n\n/**\n * Reads dependency names from the appropriate manifest file for a language.\n * Returns a set of all dependency names (production + dev).\n *\n * If the manifest file does not exist, returns an empty set (graceful).\n * If the file exists but cannot be read (`ManifestReadError`) or parsed\n * (`ManifestParseError`), the error propagates — this indicates a real\n * problem the user should know about.\n *\n * @param projectFolder - Absolute path to the project root\n * @param language - The framework language to determine which manifest to read\n * @returns A set of dependency package names\n */\nexport const readDependencies = Effect.fn('readDependencies')(function* (\n projectFolder: string,\n language: FrameworkLanguage\n) {\n const pathService = yield* Path.Path;\n const config = MANIFEST_CONFIG[language];\n const filePath = pathService.join(projectFolder, config.file);\n\n const manifest = yield* readManifest(filePath).pipe(\n Effect.catchTag('ManifestNotFoundError', () => Effect.succeed(null))\n );\n\n if (!manifest) {\n return new Set<string>();\n }\n\n const deps = new Set<string>();\n\n for (const key of config.depKeys) {\n const section = manifest[key];\n if (section && typeof section === 'object' && !Array.isArray(section)) {\n for (const name of Object.keys(section)) {\n deps.add(name);\n }\n }\n }\n\n return deps;\n});\n","import type { FileSystem, Path } from '@effect/platform';\nimport { Effect, Schema } from 'effect';\nimport type { NormalizedConfig } from '../normalized-config';\nimport type { Runtime } from '../runtime';\n\n// ---------------------------------------------------------------------------\n// Tagged Errors\n// ---------------------------------------------------------------------------\n\nexport class ManifestNotFoundError extends Schema.TaggedError<ManifestNotFoundError>()('ManifestNotFoundError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class ManifestReadError extends Schema.TaggedError<ManifestReadError>()('ManifestReadError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class ManifestParseError extends Schema.TaggedError<ManifestParseError>()('ManifestParseError', {\n message: Schema.String,\n filePath: Schema.String,\n}) {}\n\nexport class FrameworkNotDetectedError extends Schema.TaggedError<FrameworkNotDetectedError>()(\n 'FrameworkNotDetectedError',\n {\n message: Schema.String,\n directory: Schema.String,\n }\n) {}\n\n// ---------------------------------------------------------------------------\n// Core Types\n// ---------------------------------------------------------------------------\n\nexport interface FrameworkDetectionItem {\n /** Check manifest dependencies for this package (routed by framework language) */\n matchPackage?: string;\n /** Check if this file exists (relative to project root) */\n path?: string;\n /** If path is set, also check file content matches this regex */\n matchContent?: string;\n}\n\nexport type FrameworkLanguage = 'node' | 'php';\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'composer';\n\nexport interface FrameworkDefinition {\n slug: string;\n name: string;\n language: FrameworkLanguage;\n /** ALL items must match for the framework to be detected */\n detectors: FrameworkDetectionItem[];\n /** Higher = higher priority (specific frameworks beat generic ones) */\n priority: number;\n /** Generates deployment defaults for this framework */\n getDefaultConfig: (packageManager: PackageManager) => FrameworkDefaultConfig;\n /** Refines defaults with project files after a framework match, e.g. framework CLI config. */\n refineDefaultConfig?: (\n defaults: FrameworkDefaultConfig,\n projectFolder: string\n ) => Effect.Effect<FrameworkDefaultConfig, never, FileSystem.FileSystem | Path.Path>;\n}\n\nexport interface FrameworkDefaultConfig {\n runtime: Runtime;\n memory: number;\n maxDuration: number;\n streaming: boolean;\n /** Overrides the auto-generated install command (e.g. for custom composer flags) */\n installCommand?: string;\n /** Build commands (install command is auto-prepended by generateConfig) */\n commands: string[];\n entrypoint?: string;\n assetsDir?: string;\n assetsPrefixToStrip?: string;\n /** Explicit project-relative files to publish as static assets. */\n assetPaths?: string[];\n /** Public path overrides keyed by project-relative asset path. */\n assetOverrides?: Record<string, { path?: string; contentType?: string }>;\n /** Directory subtrees to publish under a URL prefix without per-file enumeration. */\n assetPrefixes?: Array<{\n source: string;\n destination: string;\n immutable?: boolean;\n populateCache?: boolean;\n contentType?: string;\n }>;\n /** Project-relative manifests containing logical static asset entries. */\n assetManifests?: Array<{ source: string }>;\n populateAssetCache?: boolean;\n routes: Array<{ source: string; destination: string }>;\n environmentVariables: Record<string, string>;\n symlinks?: Record<string, string>;\n excludeFiles?: string[];\n package?: {\n trace?: boolean;\n includeProjectFiles?: boolean;\n preserveSymlinks?: boolean;\n rootOverwrite?: string;\n filePathMap?: Record<string, string>;\n includeFiles?: string[];\n excludeFiles?: string[];\n };\n /** Advanced framework output that replaces the one-entrypoint defaults. */\n normalizedConfig?: Partial<NormalizedConfig>;\n}\n\nexport interface DetectionResult {\n framework: FrameworkDefinition;\n packageManager: PackageManager;\n config: NormalizedConfig;\n}\n","import { Effect } from 'effect';\nimport { CONTAINER_RUNTIME, type NormalizedConfig } from '../normalized-config';\n\n/**\n * Merges framework defaults with a user-provided config.\n * User config always takes precedence; framework defaults fill gaps.\n *\n * - commands: use user's if non-empty, otherwise framework's\n * - entrypoints: use user's if non-empty, otherwise framework's. Container\n * functions (`runtime: docker`) do not count: they are always kept, next to\n * whichever file functions win, because a framework never declares them.\n * - routes: use user's if any of them targets something other than a container\n * function, otherwise the framework's, preceded by the user's routes to\n * container functions so that e.g. `/api/*` wins over a framework catch-all.\n * - assets: use user's if it declares any sources, otherwise framework's\n * - excludeFiles: use user's if non-empty, otherwise framework's\n * - regions: always use user's (always populated from parsing)\n * - environmentVariables: deep merge (framework base, user overrides)\n * - services: always use user's (frameworks don't define services)\n * - sidecars: always use user's (frameworks don't define sidecars)\n * - warnings/errors: concatenate both\n *\n * @param userConfig - The config parsed from the user's config file\n * @param frameworkConfig - The config generated from framework detection\n * @returns The merged config\n */\nexport const mergeWithFrameworkDefaults = Effect.fn('mergeWithFrameworkDefaults')(function* (\n userConfig: NormalizedConfig,\n frameworkConfig: NormalizedConfig\n) {\n yield* Effect.logDebug('Merging user config with framework defaults');\n\n const userHasAssets =\n (userConfig.assets?.paths?.length ?? 0) > 0 ||\n (userConfig.assets?.prefixes?.length ?? 0) > 0 ||\n (userConfig.assets?.manifests?.length ?? 0) > 0;\n\n const isContainer = (entrypoint: NormalizedConfig['entrypoints'][number]) => entrypoint.runtime === CONTAINER_RUNTIME;\n const userFileFunctions = userConfig.entrypoints.filter((entrypoint) => !isContainer(entrypoint));\n const containerPaths = new Set(userConfig.entrypoints.filter(isContainer).map((entrypoint) => entrypoint.path));\n const targetsContainer = (route: NormalizedConfig['routes'][number]) =>\n containerPaths.has(route.destination.replace(/^\\/+/, ''));\n\n const merged: NormalizedConfig = {\n regions: userConfig.regions,\n\n commands: userConfig.commands.length > 0 ? userConfig.commands : frameworkConfig.commands,\n\n entrypoints: [\n ...(userFileFunctions.length > 0 ? userFileFunctions : frameworkConfig.entrypoints),\n ...userConfig.entrypoints.filter(isContainer),\n ],\n\n routes:\n containerPaths.size > 0 && userConfig.routes.every(targetsContainer)\n ? [...userConfig.routes, ...frameworkConfig.routes]\n : userConfig.routes.length > 0\n ? userConfig.routes\n : frameworkConfig.routes,\n\n assets: userHasAssets ? userConfig.assets : frameworkConfig.assets,\n\n environmentVariables: {\n ...frameworkConfig.environmentVariables,\n ...userConfig.environmentVariables,\n },\n\n excludeFiles:\n userConfig.excludeFiles && userConfig.excludeFiles.length > 0\n ? userConfig.excludeFiles\n : frameworkConfig.excludeFiles,\n\n services: userConfig.services,\n ...(userConfig.sidecars !== undefined && { sidecars: userConfig.sidecars }),\n userArchive: userConfig.userArchive,\n\n warnings: [...frameworkConfig.warnings, ...userConfig.warnings],\n errors: [...frameworkConfig.errors, ...userConfig.errors],\n };\n\n return merged;\n});\n","import { NormalizedConfig } from './normalized-config';\n\n/**\n * Ensure a normalized config has no function files that are also defined as assets.\n * For example, a file `public/index.php` should not be defined as an asset, when it is a function and `public` is an asset folder.\n * @param config The normalized config to filter.\n * @returns A promise that resolves to the filtered config.\n */\nexport const filterFunctionsFromAssets = (config: NormalizedConfig): NormalizedConfig => {\n return {\n ...config,\n assets: {\n ...config.assets,\n paths: config.assets?.paths?.filter((path) => !config.entrypoints.some((entrypoint) => entrypoint.path === path)),\n },\n };\n};\n","import { Effect } from 'effect';\nimport { ConfigVersionError } from './errors';\nimport { filterFunctionsFromAssets } from './filter-functions-from-assets';\nimport { CONTAINER_RUNTIME, type NormalizedConfig } from './normalized-config';\nimport { RawConfigReader } from './services/raw-config-reader';\nimport { SchemaValidator } from './services/schema-validator';\nimport { V4ConfigParser } from './services/v4-config-parser';\nimport { VercelBuildOutputParser } from './services/vercel-build-output-parser';\nimport type { ConfigV4 } from './v4';\nimport schemaV4 from './v4/schema.json';\n\nexport interface Config {\n version: number;\n env?: Record<string, string>;\n}\n\n/**\n * Parses a config file at the given path and validates it against the appropriate\n * JSON Schema, returning a NormalizedConfig **without** post-processing.\n *\n * Use {@link parseConfig} when you also want Vercel BOv3 merging, empty-deployment\n * checks, and function/asset deduplication applied automatically.\n *\n * @param filePath - Absolute path to the config file\n * @param projectFolder - Absolute path to the project root\n */\nexport const parseConfigRaw = Effect.fn('parseConfigRaw')(function* (filePath: string, projectFolder: string) {\n const rawReader = yield* RawConfigReader;\n const validator = yield* SchemaValidator;\n const v4Parser = yield* V4ConfigParser;\n\n const parsed = yield* rawReader.readRawConfig(filePath);\n const version = parsed.version as number;\n\n const schemaMap: Record<number, object> = {\n 4: schemaV4,\n };\n\n const schema = schemaMap[version];\n\n if (!schema) {\n return yield* Effect.fail(\n new ConfigVersionError({\n message: `Config file at ${filePath} has an unsupported version: ${version}`,\n filePath,\n version,\n })\n );\n }\n\n yield* validator.validate(parsed, schema, filePath);\n\n return yield* v4Parser.parse(parsed as unknown as ConfigV4, projectFolder);\n});\n\n/**\n * Parses a config file at the given path, validates it against the appropriate\n * JSON Schema, converts it to a NormalizedConfig, and applies post-processing.\n *\n * @param filePath - Absolute path to the config file\n * @param projectFolder - Absolute path to the project root\n */\nexport const parseConfig = Effect.fn('parseConfig')(function* (filePath: string, projectFolder: string) {\n const parseResult: NormalizedConfig = yield* parseConfigRaw(filePath, projectFolder);\n return yield* postProcessConfig(parseResult, projectFolder);\n});\n\n/**\n * Applies post-processing transformers to a NormalizedConfig:\n * - Vercel Build Output v3 (merges functions/routes from .vercel/output if present)\n * - Empty deployment validation\n * - Filter functions from assets\n *\n * @param config - The parsed NormalizedConfig\n * @param projectFolder - Absolute path to the project root\n * @returns The post-processed NormalizedConfig\n */\nexport const postProcessConfig = Effect.fn('postProcessConfig')(function* (\n config: NormalizedConfig,\n projectFolder: string\n) {\n const vercelParser = yield* VercelBuildOutputParser;\n let result = yield* vercelParser.parse(config, projectFolder);\n const hasAssets =\n (result.assets?.paths?.length ?? 0) > 0 ||\n (result.assets?.prefixes?.length ?? 0) > 0 ||\n (result.assets?.manifests?.length ?? 0) > 0;\n\n // Container functions are judged on the final config, after a framework's\n // defaults and build output have been merged in, so that one declared next\n // to a detected framework neither replaces nor shadows the framework's app.\n const containerFunctions = result.entrypoints.filter((entrypoint) => entrypoint.runtime === CONTAINER_RUNTIME);\n const [onlyFunction] = result.entrypoints;\n if (\n onlyFunction !== undefined &&\n onlyFunction.runtime === CONTAINER_RUNTIME &&\n result.entrypoints.length === 1 &&\n result.routes.length === 0 &&\n !hasAssets\n ) {\n // A project that is nothing but one container function serves every path\n // from it, the way a project with one detected framework does.\n result = {\n ...result,\n routes: [\n {\n path: '/*',\n destination: onlyFunction.path,\n handler: onlyFunction.streaming === true ? 'SERVERLESS_FUNCTION_STREAMING' : 'SERVERLESS_FUNCTION',\n methods: ['ANY'],\n headers: {},\n },\n ],\n };\n } else {\n for (const entrypoint of containerFunctions) {\n const routed = result.routes.some((route) => route.destination.replace(/^\\/+/, '') === entrypoint.path);\n if (!routed && entrypoint.schedule === undefined) {\n result.warnings.push(\n `Container function '${entrypoint.displayName ?? entrypoint.path}' has no route and no schedule, so nothing reaches it. Add a route with destination '${entrypoint.path}'.`\n );\n }\n }\n }\n if ((result.sidecars?.length ?? 0) > 0 && result.entrypoints.length === 0) {\n result.warnings.push('Sidecars run next to functions, and this deployment has none, so no sidecar will start.');\n }\n\n // Stricter check first: no functions, no assets, AND no routes → error\n if (result.entrypoints.length === 0 && !hasAssets && result.routes.length === 0) {\n result.errors.push(\n 'The current project config does not resolve to any functions, assets or routes and can not be deployed.'\n );\n } else if (result.entrypoints.length === 0 && !hasAssets) {\n result.warnings.push('The current project does not have any functions or assets to deploy.');\n }\n\n result = filterFunctionsFromAssets(result);\n\n return result;\n});\n","import { FileSystem, Path } from '@effect/platform';\nimport { Effect } from 'effect';\nimport { parse as parseYaml } from 'yaml';\nimport { ConfigFileEmptyError, ConfigFileNotFoundError, ConfigFileParseError, ConfigVersionError } from '../errors';\nimport { ConfigModuleLoader } from './config-module-loader';\n\nexport const ALLOWED_CONFIG_NAMES = [\n 'gigadrive.ts',\n 'gigadrive.mts',\n 'gigadrive.cts',\n 'gigadrive.js',\n 'gigadrive.mjs',\n 'gigadrive.cjs',\n 'gigadrive.yaml',\n 'gigadrive.yml',\n 'gigadrive.json',\n 'nebula.yaml',\n 'nebula.yml',\n 'nebula.json',\n] as const;\n\nconst MODULE_EXTENSIONS = ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs'];\n\nexport class RawConfigReader extends Effect.Service<RawConfigReader>()('RawConfigReader', {\n dependencies: [ConfigModuleLoader.Default],\n effect: Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\n const moduleLoader = yield* ConfigModuleLoader;\n\n /**\n * Scans for a known config filename in the given project folder.\n *\n * @param projectFolder - Absolute path to the project root\n * @returns The absolute path to the first matching config file, or null\n */\n const findConfig = Effect.fn('RawConfigReader.findConfig')(function* (projectFolder: string) {\n for (const name of ALLOWED_CONFIG_NAMES) {\n const filePath = pathService.join(projectFolder, name);\n const exists = yield* fs.exists(filePath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (exists) {\n return filePath;\n }\n }\n return null as string | null;\n });\n\n /**\n * Reads a config file from disk and parses it as YAML or JSON.\n * TypeScript/JavaScript config files (.ts/.mts/.cts/.js/.mjs/.cjs) are\n * evaluated as modules and must default-export the config object\n * (`module.exports` for CommonJS files).\n *\n * @param filePath - Absolute path to the config file\n * @param options - Optional settings (e.g. disableVersionCheck)\n * @returns The parsed config as a record\n */\n const readRawConfig = Effect.fn('RawConfigReader.readRawConfig')(function* (\n filePath: string,\n options?: { disableVersionCheck?: boolean }\n ) {\n const exists = yield* fs.exists(filePath).pipe(Effect.catchAll(() => Effect.succeed(false)));\n if (!exists) {\n return yield* Effect.fail(\n new ConfigFileNotFoundError({ message: `Config file not found at ${filePath}`, filePath })\n );\n }\n\n const fileContents = yield* fs\n .readFileString(filePath)\n .pipe(\n Effect.mapError(\n () => new ConfigFileParseError({ message: `Failed to read config file at ${filePath}`, filePath })\n )\n );\n\n if (fileContents.length === 0) {\n return yield* Effect.fail(\n new ConfigFileEmptyError({ message: `Config file is empty at ${filePath}`, filePath })\n );\n }\n\n const fileExtension = pathService.extname(filePath).toLowerCase();\n\n let parsed: Record<string, unknown>;\n if (MODULE_EXTENSIONS.includes(fileExtension)) {\n parsed = yield* moduleLoader.loadConfigModule(filePath);\n } else {\n try {\n if (fileExtension === '.json') {\n parsed = JSON.parse(fileContents) as Record<string, unknown>;\n } else {\n parsed = parseYaml(fileContents) as Record<string, unknown>;\n }\n } catch (error) {\n return yield* Effect.fail(\n new ConfigFileParseError({\n message: `Failed to parse config file at ${filePath}: ${error instanceof Error ? error.message : 'Unknown error'}`,\n filePath,\n cause: error instanceof Error ? error.message : undefined,\n })\n );\n }\n }\n\n if (parsed == null) {\n return yield* Effect.fail(\n new ConfigFileParseError({ message: `Config file could not be parsed at ${filePath}`, filePath })\n );\n }\n\n if (!options?.disableVersionCheck && typeof parsed.version !== 'number') {\n return yield* Effect.fail(\n new ConfigVersionError({ message: `Config file is missing version at ${filePath}`, filePath })\n );\n }\n\n return parsed;\n });\n\n /**\n * Convenience wrapper: reads and parses a config file, returning null if the file\n * does not exist. Version checking is disabled (used for Vercel build output files).\n *\n * @param configFilePath - Absolute path to the config file\n * @returns The parsed object cast to T, or null when not found\n */\n const readConfigFile = <T>(configFilePath: string) =>\n readRawConfig(configFilePath, { disableVersionCheck: true }).pipe(\n Effect.map((parsed) => parsed as unknown as T),\n Effect.catchTag('ConfigFileNotFoundError', () => Effect.succeed(null as T | null)),\n Effect.withSpan('RawConfigReader.readConfigFile')\n );\n\n return { findConfig, readRawConfig, readConfigFile };\n }),\n}) {}\n","import { Effect } from 'effect';\nimport { createJiti } from 'jiti';\nimport { ConfigModuleLoadError } from '../errors';\n\n/** Sentinel distinguishing \"module has no default export\" from `export default undefined`. */\nconst MISSING_DEFAULT_EXPORT = Symbol('MissingDefaultExport');\n\n/**\n * Extensions that can only be ESM-authored, where a missing default export is\n * a user mistake worth a specific error. `.js`, `.cjs`, and `.cts` files may\n * be CommonJS, whose `module.exports` only surfaces through jiti's interop\n * default rather than as a genuine `default` binding.\n */\nconst STRICT_DEFAULT_EXPORT_EXTENSIONS = ['.ts', '.mts', '.mjs'];\n\nexport class ConfigModuleLoader extends Effect.Service<ConfigModuleLoader>()('ConfigModuleLoader', {\n effect: Effect.gen(function* () {\n /**\n * Evaluates a TypeScript or JavaScript config module (e.g. gigadrive.ts)\n * and returns its default export (`module.exports` for CommonJS files).\n * Relative imports and node_modules are resolved from the config file's\n * own directory, so `import { defineConfig } from\n * '@gigadrive/network-config'` works when the package is installed in the\n * user's project.\n *\n * @param filePath - Absolute path to the config module\n * @returns The module's default export as a record\n */\n const loadConfigModule = Effect.fn('ConfigModuleLoader.loadConfigModule')(function* (filePath: string) {\n const extension = filePath.slice(filePath.lastIndexOf('.')).toLowerCase();\n\n const mod = yield* Effect.tryPromise({\n try: async () => {\n const jiti = createJiti(filePath, { fsCache: false, interopDefault: true, moduleCache: false });\n const namespace: unknown = await jiti.import(filePath);\n if (typeof namespace === 'object' && namespace !== null && 'default' in namespace) {\n return namespace.default;\n }\n if (!STRICT_DEFAULT_EXPORT_EXTENSIONS.includes(extension)) {\n return (namespace as { default?: unknown }).default ?? MISSING_DEFAULT_EXPORT;\n }\n return MISSING_DEFAULT_EXPORT;\n },\n catch: (error) =>\n new ConfigModuleLoadError({\n message: `Failed to load config module at ${filePath}: ${error instanceof Error ? error.message : 'Unknown error'}`,\n filePath,\n cause: error instanceof Error ? error.message : undefined,\n }),\n });\n\n if (mod === MISSING_DEFAULT_EXPORT) {\n return yield* Effect.fail(\n new ConfigModuleLoadError({\n 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.`,\n filePath,\n })\n );\n }\n\n if (typeof mod === 'function') {\n return yield* Effect.fail(\n new ConfigModuleLoadError({\n message: `Config module at ${filePath} default-exports a function; config factories are not supported. Export a config object instead (optionally wrapped in defineConfig).`,\n filePath,\n })\n );\n }\n\n if (typeof mod !== 'object' || mod === null || Array.isArray(mod)) {\n return yield* Effect.fail(\n new ConfigModuleLoadError({\n message: `Config module at ${filePath} must default-export a config object.`,\n filePath,\n })\n );\n }\n\n return mod as Record<string, unknown>;\n });\n\n return { loadConfigModule };\n }),\n}) {}\n","import Ajv from 'ajv';\nimport addFormats from 'ajv-formats';\nimport { Effect } from 'effect';\nimport { ConfigSchemaValidationError } from '../errors';\n\nexport class SchemaValidator extends Effect.Service<SchemaValidator>()('SchemaValidator', {\n effect: Effect.gen(function* () {\n const ajv = new Ajv();\n addFormats(ajv);\n\n /**\n * Validates a parsed config object against a JSON Schema.\n *\n * @param config - The parsed config record\n * @param schema - The JSON Schema to validate against\n * @param filePath - Path used in error messages\n */\n const validate = Effect.fn('SchemaValidator.validate')(function* (\n config: Record<string, unknown>,\n schema: object,\n filePath: string\n ) {\n const compiledValidate = ajv.compile(schema);\n const valid = compiledValidate(config);\n\n if (!valid) {\n const errors = compiledValidate.errors?.map((e) => `${e.instancePath || '/'} ${e.message ?? ''}`.trim()) ?? [];\n return yield* Effect.fail(\n new ConfigSchemaValidationError({\n message: `Config file at ${filePath} is invalid: ${ajv.errorsText(compiledValidate.errors)}`,\n filePath,\n validationErrors: errors,\n })\n );\n }\n });\n\n return { validate };\n }),\n}) {}\n","import { minimatch } from 'minimatch';\nimport { readdir } from 'node:fs/promises';\n\n/**\n * Gets paths to all files that match a certain pattern (glob or regex) in a given project folder.\n * @param pattern The pattern to match files against. Can be a glob or regex pattern.\n * @param projectFolder The folder to search for files in.\n * @param excludeFiles An array of file names, folder names, glob patterns or regex patterns to exclude from the search.\n */\nexport const getFilesForPattern = async (\n pattern: string,\n projectFolder: string,\n excludeFiles: string | string[] = []\n): Promise<string[]> => {\n const files: string[] = [];\n const filesInFolder = await readdir(projectFolder, { recursive: true });\n const exactFiles = new Set(filesInFolder.filter((file): file is string => typeof file === 'string'));\n\n let regex: RegExp | null = null;\n\n if (!exactFiles.has(pattern)) {\n try {\n regex = new RegExp(`^(?:${pattern})$`);\n } catch {\n // ignored\n }\n }\n\n const finalExclusions = Array.isArray(excludeFiles) ? excludeFiles : [excludeFiles];\n\n for (const file of filesInFolder) {\n if (typeof file !== 'string') {\n continue;\n }\n\n if (\n finalExclusions.some((excludeFile) => {\n if (minimatch(file, excludeFile)) {\n return true;\n }\n\n if (!exactFiles.has(excludeFile)) {\n try {\n return new RegExp(`^(?:${excludeFile})$`).test(file);\n } catch {\n return false;\n }\n }\n\n return false;\n })\n ) {\n continue;\n }\n\n if (minimatch(file, pattern) || (regex != null && regex.test(file))) {\n files.push(file);\n }\n }\n\n return files;\n};\n","import { getFilesForPattern } from '@gigadrive/build-utils';\nimport { Effect } from 'effect';\nimport { minimatch } from 'minimatch';\nimport { posix } from 'node:path';\nimport safeRegex from 'safe-regex2';\nimport { collectAssetFiles } from '../collect-asset-files';\nimport {\n containerEntrypointPath,\n dockerFunctionContainerName,\n normalizeContainers,\n readComposeContainers,\n} from '../containers';\nimport { ContainerConfigError, FunctionConfigError } from '../errors';\nimport {\n CONTAINER_RUNTIME,\n DEFAULT_FUNCTION_DURATION_SECONDS,\n type NormalizedConfigEntrypoint,\n type NormalizedConfigQueue,\n type NormalizedConfigRoute,\n type NormalizedConfigRouteHandler,\n type NormalizedConfigServiceDefinition,\n type NormalizedImagePolicy,\n} from '../normalized-config';\nimport { AVAILABLE_REGIONS, type Region } from '../regions';\nimport type {\n ConfigV4,\n ConfigV4Container,\n ConfigV4FunctionSettings,\n ConfigV4Queue,\n ConfigV4QueueDuration,\n} from '../v4';\n\nconst DEFAULT_FUNCTION_SETTINGS: Required<Pick<ConfigV4FunctionSettings, 'memory' | 'max_duration'>> &\n Pick<ConfigV4FunctionSettings, 'schedule' | 'symlinks' | 'excludeFiles' | 'includeFiles'> = {\n memory: 128,\n max_duration: DEFAULT_FUNCTION_DURATION_SECONDS,\n schedule: undefined,\n symlinks: undefined,\n excludeFiles: undefined,\n includeFiles: undefined,\n};\n\nconst toArray = (value: string | string[] | undefined): string[] | undefined => {\n if (value == null) return undefined;\n return Array.isArray(value) ? value : [value];\n};\n\nconst runtimeStreamsByDefault = (runtime: ConfigV4FunctionSettings['runtime'] | undefined): boolean =>\n runtime == null || runtime.startsWith('node-') || runtime.startsWith('bun-');\n\nconst normalizeImagePolicy = (images: ConfigV4['images']): NormalizedImagePolicy | undefined => {\n if (!images) return undefined;\n return {\n localPatterns: images.localPatterns ?? [{ pathname: '/**' }],\n remotePatterns: images.remotePatterns ?? [],\n widths: images.widths ?? [640, 750, 828, 1080, 1200, 1920, 2048, 3840],\n heights: images.heights ?? [],\n qualities: images.qualities ?? [75],\n formats: images.formats ?? ['image/avif', 'image/webp'],\n minimumCacheTTL: images.minimumCacheTTL ?? 14_400,\n dangerouslyAllowSVG: images.dangerouslyAllowSVG ?? false,\n contentSecurityPolicy: images.contentSecurityPolicy ?? \"default-src 'self'; script-src 'none'; sandbox;\",\n contentDispositionType: images.contentDispositionType ?? 'attachment',\n maximumRedirects: images.maximumRedirects ?? 3,\n maximumResponseBody: images.maximumResponseBody ?? 50 * 1024 * 1024,\n variants: images.variants ?? {},\n };\n};\n\nconst DURATION_UNIT_SECONDS = { s: 1, m: 60, h: 3_600, d: 86_400 } as const;\n\n/** Resolves a queue duration (`90`, `'10m'`) to whole seconds; schema validation guarantees the shape. */\nconst queueDurationSeconds = (value: ConfigV4QueueDuration | undefined): number | undefined => {\n if (value === undefined) return undefined;\n if (typeof value === 'number') return value;\n const match = /^(\\d+(?:\\.\\d+)?)(s|m|h|d)$/.exec(value);\n if (!match)\n throw new Error(`Invalid queue duration \"${value}\". Use seconds or a string such as 30s, 10m, 1.5h or 4d.`);\n return Math.ceil(Number(match[1]) * DURATION_UNIT_SECONDS[match[2] as keyof typeof DURATION_UNIT_SECONDS]);\n};\n\nconst byName = <T extends { name: string }>(left: T, right: T) =>\n left.name < right.name ? -1 : left.name > right.name ? 1 : 0;\n\n/** Drops keys whose value is `undefined`, so absent settings stay absent in the normalized config. */\nconst definedOnly = <T extends object>(value: T): T =>\n Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined)) as T;\n\nconst normalizeQueue = (name: string, queue: ConfigV4Queue | null): NormalizedConfigQueue => {\n if (queue === null) return { name };\n const schedules = queue.schedules\n ? Object.entries(queue.schedules)\n .map(([scheduleName, schedule]) =>\n definedOnly({\n name: scheduleName,\n cron: schedule.cron,\n timezone: schedule.timezone,\n body:\n schedule.body === undefined || typeof schedule.body === 'string'\n ? schedule.body\n : JSON.stringify(schedule.body),\n // A plain-text body labelled JSON would fail to decode on every fire.\n contentType:\n schedule.contentType ?? (typeof schedule.body === 'string' ? 'text/plain; charset=utf-8' : undefined),\n headers: schedule.headers,\n enabled: schedule.enabled,\n })\n )\n .sort(byName)\n : undefined;\n return definedOnly({\n name,\n consumer: queue.consumer,\n visibilityTimeoutSeconds: queueDurationSeconds(queue.visibilityTimeout),\n retentionSeconds: queueDurationSeconds(queue.retention),\n maxAttempts: queue.maxAttempts,\n retryBackoffMinSeconds: queueDurationSeconds(queue.retryBackoff?.min),\n retryBackoffMaxSeconds: queueDurationSeconds(queue.retryBackoff?.max),\n deduplicationWindowSeconds: queueDurationSeconds(queue.deduplicationWindow),\n concurrency: queue.concurrency,\n rateLimit:\n queue.rateLimit == null\n ? queue.rateLimit\n : { count: queue.rateLimit.count, periodSeconds: queueDurationSeconds(queue.rateLimit.period) ?? 1 },\n deadLetter: queue.deadLetter,\n schedules,\n });\n};\n\n/**\n * Converts keyed v4 service declarations into the stable normalized list used\n * by deployment provisioning.\n *\n * Storage bucket names are preserved exactly after schema validation and\n * sorted to keep deployment plans deterministic. Bucket visibility defaults\n * to private, matching the File Storage API creation contract. Queue\n * durations resolve to seconds and object schedule bodies to JSON.\n */\nconst normalizeServices = (services: ConfigV4['services']): NormalizedConfigServiceDefinition[] | undefined => {\n if (services == null) return undefined;\n\n const normalized: NormalizedConfigServiceDefinition[] = [];\n\n if (services.redis !== undefined) {\n normalized.push({ type: 'redis', ...(services.redis ?? {}) });\n }\n\n if (services.postgres !== undefined) {\n normalized.push({ type: 'postgres', ...(services.postgres ?? {}) });\n }\n\n if (services.storage !== undefined) {\n normalized.push({\n type: 'storage',\n buckets: Object.entries(services.storage.buckets)\n .map(([name, bucket]) => ({ name, visibility: bucket?.visibility ?? 'private' }))\n .sort(byName),\n });\n }\n\n if (services.queues !== undefined) {\n normalized.push({\n type: 'queues',\n queues: Object.entries(services.queues)\n .map(([name, queue]) => normalizeQueue(name, queue))\n .sort(byName),\n });\n }\n\n return normalized.length > 0 ? normalized : undefined;\n};\n\nconst normalizeRouteDestination = (destination: string): string => {\n const [withoutHash] = destination.split('#', 1);\n const [withoutQuery] = withoutHash.split('?', 1);\n return withoutQuery.replace(/^\\/+/, '');\n};\n\nconst destinationMatchesEntrypoint = (destination: string, entrypointPath: string): boolean => {\n const normalizedDestination = normalizeRouteDestination(destination);\n if (normalizedDestination === entrypointPath) return true;\n if (!normalizedDestination.includes('$')) return false;\n\n const pattern = normalizedDestination.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\\\\\$[\\w]+/g, '.+');\n return new RegExp(`^${pattern}$`).test(entrypointPath);\n};\n\n// -- Pure helpers (no Effect needed) ----------------------------------------------------------\n\n/**\n * Tests whether a path matches a function pattern via glob or safe regex.\n */\nconst matchesPattern = (path: string, pattern: string): boolean => {\n if (minimatch(path, pattern)) return true;\n\n try {\n if (safeRegex(pattern)) {\n return new RegExp(pattern).test(path);\n }\n } catch {\n // pattern is not valid regex (e.g. glob like **), skip\n }\n\n return false;\n};\n\n/**\n * Resolves merged function settings for a given path by iterating all function\n * patterns in the config. Later patterns override earlier ones.\n *\n * @returns The merged settings, or undefined when no pattern matches the path.\n */\nexport const getFunctionSettings = (path: string, config: ConfigV4): ConfigV4FunctionSettings | undefined => {\n let settings: ConfigV4FunctionSettings | undefined;\n\n for (const [pattern, value] of Object.entries(config.functions ?? {})) {\n if (!matchesPattern(path, pattern)) continue;\n\n settings = { ...DEFAULT_FUNCTION_SETTINGS, ...settings, ...value };\n }\n\n return settings;\n};\n\n/**\n * Determines the route handler type based on destination and redirect flag.\n */\nconst resolveRouteHandler = (\n destination: string,\n redirect: boolean | undefined,\n entrypoints: readonly NormalizedConfigEntrypoint[] = []\n): NormalizedConfigRouteHandler => {\n const isExternal =\n destination.toLowerCase().startsWith('http://') || destination.toLowerCase().startsWith('https://');\n\n if (redirect === true) return 'HTTP_REDIRECT';\n if (isExternal) return 'HTTP_PROXY';\n\n const matchingEntrypoints = entrypoints.filter((item) => destinationMatchesEntrypoint(destination, item.path));\n return matchingEntrypoints.length > 0 && matchingEntrypoints.every((entrypoint) => entrypoint.streaming === true)\n ? 'SERVERLESS_FUNCTION_STREAMING'\n : 'SERVERLESS_FUNCTION';\n};\n\n/** Type guard that validates a string is a known Region. */\nconst isRegion = (r: string): r is Region => AVAILABLE_REGIONS.includes(r as Region);\n\n/**\n * Resolves the region list from config, expanding 'global' to all available regions.\n */\nconst resolveRegions = (configRegions?: string[] | null): Region[] => {\n if (configRegions?.includes('global') === true) return AVAILABLE_REGIONS;\n const valid = configRegions?.filter(isRegion);\n return valid && valid.length > 0 ? valid : AVAILABLE_REGIONS;\n};\n\n/**\n * Maps a V4 route definition to a NormalizedConfigRoute.\n */\nconst mapRoute = (\n route: NonNullable<ConfigV4['routes']>[number],\n entrypoints: readonly NormalizedConfigEntrypoint[]\n): NormalizedConfigRoute => ({\n path: route.source,\n destination: route.destination,\n handler: resolveRouteHandler(route.destination, route.redirect, entrypoints),\n headers: route.headers ?? {},\n methods: route.methods ?? ['ANY'],\n positiveRequirements: route.has,\n negativeRequirements: route.missing,\n status: route.statusCode,\n});\n\n// -- Effectful helpers ------------------------------------------------------------------------\n\n/** A `functions` entry with `runtime: docker`: its Dockerfile, and the container it becomes. */\ninterface DockerFunction {\n readonly file: string;\n readonly name: string;\n readonly container: ConfigV4Container;\n}\n\n/**\n * Resolves function entrypoints from the config's `functions` section.\n *\n * Files matched under `runtime: docker` are Dockerfiles. They are returned as\n * `dockerFunctions` instead, and become container functions alongside the\n * `containers` map.\n */\nconst parseEntrypoints = Effect.fn('parseEntrypoints')(function* (config: ConfigV4, projectFolder: string) {\n const entrypoints: NormalizedConfigEntrypoint[] = [];\n const dockerFunctions: DockerFunction[] = [];\n if (config.functions == null) return { entrypoints, dockerFunctions };\n\n for (const [fnPath, func] of Object.entries(config.functions)) {\n if (getFunctionSettings(fnPath, config) == null) {\n return yield* new FunctionConfigError({\n message: `Settings invalid for function at path '${fnPath}'`,\n functionPath: fnPath,\n });\n }\n\n const matchedFiles = yield* Effect.tryPromise({\n try: () => getFilesForPattern(fnPath, projectFolder, func.excludeFiles),\n catch: (error) =>\n new FunctionConfigError({\n message: `Failed to resolve files for function pattern '${fnPath}': ${error instanceof Error ? error.message : String(error)}`,\n functionPath: fnPath,\n }),\n });\n\n for (const file of matchedFiles) {\n if (entrypoints.some((ep) => ep.path === file)) continue;\n if (Object.keys(config.functions).some((f) => f === file && f !== fnPath)) continue;\n\n const settings = getFunctionSettings(file, config);\n if (settings == null) {\n return yield* new FunctionConfigError({\n message: `Settings invalid for function at path '${file}'`,\n functionPath: file,\n });\n }\n\n if (settings.runtime === CONTAINER_RUNTIME) {\n const unsupported = (['symlinks', 'includeFiles'] as const).filter((key) => settings[key] !== undefined);\n if (unsupported.length > 0) {\n return yield* new FunctionConfigError({\n message: `Function '${file}' runs a Dockerfile, so ${unsupported.join(' and ')} do not apply. Copy files in the Dockerfile instead.`,\n functionPath: file,\n });\n }\n // Only what the config declares: an unset `memory` takes the container default, not 128 MB.\n const declared = Object.entries(config.functions)\n .filter(([pattern]) => matchesPattern(file, pattern))\n .reduce<ConfigV4FunctionSettings>((merged, [, value]) => ({ ...merged, ...value }), {});\n dockerFunctions.push({\n file,\n name: dockerFunctionContainerName(file),\n container: {\n build: { context: posix.dirname(file), dockerfile: posix.basename(file) },\n ...(declared.port !== undefined && { port: declared.port }),\n ...(declared.memory !== undefined && { memory: declared.memory }),\n ...(declared.max_duration !== undefined && { max_duration: declared.max_duration }),\n ...(declared.streaming !== undefined && { streaming: declared.streaming }),\n ...(func.schedule !== undefined && { schedule: func.schedule }),\n },\n });\n continue;\n }\n if (settings.port !== undefined) {\n return yield* new FunctionConfigError({\n message: `Function '${file}' sets port, which only applies to 'runtime: docker'.`,\n functionPath: file,\n });\n }\n\n const runtime = settings.runtime ?? 'node-20';\n const streaming = settings.streaming ?? runtimeStreamsByDefault(runtime);\n\n entrypoints.push({\n path: file,\n runtime,\n memory: settings.memory ?? 128,\n maxDuration: settings.max_duration ?? DEFAULT_FUNCTION_DURATION_SECONDS,\n schedule: func.schedule,\n symlinks: func.symlinks,\n streaming,\n package:\n settings.includeFiles != null || settings.excludeFiles != null\n ? {\n includeFiles: toArray(settings.includeFiles),\n excludeFiles: toArray(settings.excludeFiles),\n }\n : undefined,\n });\n }\n }\n\n // Globs list files in directory order, so sort for a stable config.\n dockerFunctions.sort((left, right) => (left.file < right.file ? -1 : left.file > right.file ? 1 : 0));\n for (const [index, { file, name }] of dockerFunctions.entries()) {\n const clash = dockerFunctions.slice(0, index).find((candidate) => candidate.name === name);\n if (clash !== undefined) {\n return yield* new FunctionConfigError({\n message: `Functions '${clash.file}' and '${file}' would both be named '${name}'. Declare one of them under 'containers' with an explicit name.`,\n functionPath: file,\n });\n }\n }\n\n return { entrypoints, dockerFunctions };\n});\n\n/**\n * Collects static asset paths from the configured assets directory.\n */\nconst collectAssets = Effect.fn('collectAssets')(function* (config: ConfigV4, projectFolder: string) {\n if (config.assets == null) return [] as string[];\n\n const assetNames = yield* collectAssetFiles(projectFolder, config.assets);\n\n return assetNames\n .filter((assetName) => getFunctionSettings(`${config.assets}/${assetName}`, config) == null)\n .map((assetName) => `${config.assets}/${assetName}`);\n});\n\n/**\n * Ports a managed runtime binds inside the function microVM, which a sidecar\n * running next to it must not take: the guest runtime's HTTP port, and the\n * php-fpm port for PHP functions.\n */\nconst reservedRuntimePorts = (entrypoint: NormalizedConfigEntrypoint): number[] =>\n entrypoint.runtime === CONTAINER_RUNTIME ? [] : entrypoint.runtime.startsWith('php-') ? [8080, 9000] : [8080];\n\n/**\n * Resolves the `compose` import and the `containers` map into container\n * entrypoints, sidecars and the routes a lone container function implies.\n */\nconst parseContainers = Effect.fn('parseContainers')(function* (\n config: ConfigV4,\n projectFolder: string,\n fileEntrypoints: readonly NormalizedConfigEntrypoint[],\n dockerFunctions: readonly DockerFunction[]\n) {\n const warnings: string[] = [];\n let containers: Record<string, ConfigV4Container> = {};\n\n if (config.compose != null) {\n const imported = yield* readComposeContainers(config.compose, projectFolder);\n containers = imported.containers;\n warnings.push(...imported.warnings);\n }\n containers = { ...containers, ...(config.containers ?? {}) };\n for (const { file, name, container } of dockerFunctions) {\n if (containers[name] !== undefined) {\n return yield* new ContainerConfigError({\n message: `Function '${file}' runs as container '${name}', which 'containers' or the Compose file already declares. Rename one of them.`,\n containerName: name,\n });\n }\n containers[name] = container;\n }\n\n const result = yield* normalizeContainers(containers, projectFolder);\n warnings.push(...result.warnings);\n\n for (const entrypoint of fileEntrypoints) {\n for (const port of reservedRuntimePorts(entrypoint)) {\n const sidecar = result.sidecars.find((candidate) => candidate.port === port);\n if (sidecar !== undefined) {\n return yield* new ContainerConfigError({\n message: `Sidecar '${sidecar.name}' listens on port ${port}, which the ${entrypoint.runtime} runtime of '${entrypoint.path}' uses inside the same microVM. Choose another port.`,\n containerName: sidecar.name,\n });\n }\n }\n }\n\n return { ...result, warnings };\n});\n\n// -- Service ----------------------------------------------------------------------------------\n\nexport class V4ConfigParser extends Effect.Service<V4ConfigParser>()('V4ConfigParser', {\n accessors: true,\n\n effect: Effect.succeed({\n /**\n * Parses a ConfigV4 into a NormalizedConfig.\n *\n * @param config - The raw V4 config object\n * @param projectFolder - Absolute path to the project root\n */\n parse: Effect.fn('V4ConfigParser.parse')(function* (config: ConfigV4, projectFolder: string) {\n const { entrypoints: fileEntrypoints, dockerFunctions } = yield* parseEntrypoints(config, projectFolder);\n const containers = yield* parseContainers(config, projectFolder, fileEntrypoints, dockerFunctions);\n const entrypoints = [...fileEntrypoints, ...containers.entrypoints];\n const assets = yield* collectAssets(config, projectFolder);\n // A route reaches a `runtime: docker` function by its Dockerfile path, like any function file.\n const dockerFunctionPaths = new Map(\n dockerFunctions.map(({ file, name }) => [file, containerEntrypointPath(name)])\n );\n const routes = (config.routes ?? []).map((route) =>\n mapRoute(\n {\n ...route,\n destination: dockerFunctionPaths.get(normalizeRouteDestination(route.destination)) ?? route.destination,\n },\n entrypoints\n )\n );\n const warnings = [...containers.warnings];\n\n return {\n regions: resolveRegions(config.regions),\n assets: {\n paths: assets.sort(),\n prefixToStrip: (config.assets ?? '') + '/',\n dynamicRoutes: true,\n populateCache: config.populateAssetCache ?? false,\n },\n environmentVariables: config.env ?? {},\n commands: config.build_commands ?? [],\n images: normalizeImagePolicy(config.images),\n services: normalizeServices(config.services),\n ...(containers.sidecars.length > 0 && { sidecars: containers.sidecars }),\n entrypoints,\n errors: [],\n warnings,\n routes,\n };\n }),\n }),\n}) {}\n","import { Path } from '@effect/platform';\nimport { getFilesForPattern } from '@gigadrive/build-utils';\nimport { deepMerge } from '@gigadrive/commons';\nimport { Effect } from 'effect';\nimport { type Config, type ServerlessFunctionConfig } from '../build-output-v3';\nimport { determineRepoRoot } from '../build-output-v3/determine-repo-root';\nimport { getDefaultPathMap } from '../build-output-v3/get-default-path-map';\nimport { getMonorepoFiles } from '../build-output-v3/get-monorepo-files';\nimport { translateVercelRegion } from '../build-output-v3/translate-vercel-region';\nimport { translateVercelRuntime } from '../build-output-v3/translate-vercel-runtime';\nimport { ConfigFileParseError } from '../errors';\nimport type {\n NormalizedConfig,\n NormalizedConfigRoute,\n NormalizedConfigRouteHandler,\n NormalizedConfigRouteMethod,\n} from '../normalized-config';\nimport type { Region } from '../regions';\nimport { RawConfigReader } from './raw-config-reader';\n\nconst CONFIG_PATH = '.vercel/output/config.json';\nconst FUNCTIONS_FOLDER = '.vercel/output/functions';\nconst FUNCTION_CONFIGS_PATTERN = `${FUNCTIONS_FOLDER}/**/*.func/.vc-config.json`;\n\nexport class VercelBuildOutputParser extends Effect.Service<VercelBuildOutputParser>()('VercelBuildOutputParser', {\n effect: Effect.gen(function* () {\n const rawConfigReader = yield* RawConfigReader;\n const pathService = yield* Path.Path;\n\n /**\n * Transforms a parsed config using Vercel's Build Output API v3.\n *\n * @param parseResult - The base NormalizedConfig\n * @param projectFolder - Absolute path to the project root\n */\n const parse = Effect.fn('VercelBuildOutputParser.parse')(function* (\n parseResult: NormalizedConfig,\n projectFolder: string\n ) {\n const config = yield* rawConfigReader.readConfigFile<Config>(pathService.join(projectFolder, CONFIG_PATH));\n\n if (!config || typeof config.version !== 'number' || config.version < 3) {\n return parseResult;\n }\n\n const functionData = yield* loadFunctions(config, parseResult, projectFolder);\n const assetOverrides = loadAssetOverrides(config, parseResult);\n const imagePolicy = loadImagePolicy(config);\n\n const merged = deepMerge(parseResult, functionData, assetOverrides, imagePolicy);\n merged.regions = [...new Set(merged.regions)] as Region[];\n return merged;\n });\n\n const loadFunctions = Effect.fn('VercelBuildOutputParser.loadFunctions')(function* (\n config: Config,\n parseResult: NormalizedConfig,\n projectFolder: string\n ) {\n const functionConfigs = yield* Effect.tryPromise({\n try: () => getFilesForPattern(FUNCTION_CONFIGS_PATTERN, projectFolder),\n catch: (error) =>\n new ConfigFileParseError({\n message: `Failed to scan for function configs: ${error instanceof Error ? error.message : String(error)}`,\n filePath: projectFolder,\n }),\n });\n\n const result: Partial<NormalizedConfig> = {\n entrypoints: [],\n routes: [],\n regions: [],\n errors: [],\n };\n\n for (const functionConfigPath of functionConfigs) {\n const functionConfig = yield* rawConfigReader.readConfigFile<ServerlessFunctionConfig>(\n pathService.join(projectFolder, functionConfigPath)\n );\n\n if (!functionConfig) {\n result.errors!.push(`Failed to read function config at ${functionConfigPath}`);\n continue;\n }\n\n const functionPathRelative = pathService.dirname(functionConfigPath).replace(FUNCTIONS_FOLDER, '');\n const functionName = functionPathRelative.replace(/^\\/|\\.func$/g, '');\n const runtime = translateVercelRuntime(functionConfig.runtime);\n\n if (!runtime) {\n result.errors!.push(`Unsupported runtime for function ${functionName}: ${functionConfig.runtime}`);\n continue;\n }\n\n const functionDirectory = `.vercel/output/functions/${functionName}.func`;\n const {\n handler,\n maxDuration,\n memory,\n regions = [],\n environment,\n filePathMap: configFilePathMap = {},\n } = functionConfig;\n\n const functionEntrypointPath = pathService.join(functionDirectory, handler);\n\n const translatedRegions = regions.length > 0 ? regions.map(translateVercelRegion) : ['us-east-1'];\n result.regions = Array.from(new Set([...(result.regions ?? []), ...translatedRegions])) as Region[];\n\n const environmentVariables: Record<string, string> = {};\n if (environment && typeof environment === 'object') {\n for (const env of Object.values(environment)) {\n Object.assign(environmentVariables, env);\n }\n }\n\n const streaming =\n functionConfig.supportsResponseStreaming ??\n functionConfig.experimentalResponseStreaming ??\n runtime.startsWith('node-');\n\n const filePathMap: Record<string, string> = {};\n for (const [key, value] of Object.entries(configFilePathMap)) {\n filePathMap[pathService.join(projectFolder, key)] = pathService.join(functionDirectory, value);\n }\n\n if (Object.keys(filePathMap).length === 0) {\n const defaultPathMap = yield* getDefaultPathMap(pathService.join(projectFolder, functionDirectory));\n for (const [key, value] of Object.entries(defaultPathMap)) {\n filePathMap[key] = pathService.join(functionDirectory, value);\n }\n }\n\n if (!result.entrypoints) {\n result.entrypoints = [];\n }\n\n result.entrypoints.push({\n displayName: functionName,\n runtime,\n path: functionEntrypointPath,\n memory: memory ?? 1024,\n maxDuration: maxDuration ?? 15,\n environmentVariables,\n streaming,\n package: {\n filePathMap,\n },\n });\n\n const handlerType: NormalizedConfigRouteHandler = streaming\n ? 'SERVERLESS_FUNCTION_STREAMING'\n : 'SERVERLESS_FUNCTION';\n\n const defaultRoute: NormalizedConfigRoute = {\n path: `/${functionName}`,\n methods: ['ANY'],\n headers: {},\n destination: functionEntrypointPath,\n handler: handlerType,\n };\n\n const configRoutes =\n config.routes\n ?.filter((r) => 'dest' in r && r.dest === `/${functionName}`)\n .map((r) => ({\n path: ('src' in r ? r.src : undefined) ?? `/${functionName}`,\n methods: ['ANY'] as NormalizedConfigRouteMethod[],\n headers: {},\n destination: functionEntrypointPath,\n handler: handlerType,\n })) ?? [];\n\n if (!result.routes) {\n result.routes = [];\n }\n\n result.routes.push(defaultRoute, ...configRoutes);\n }\n\n return {\n ...result,\n userArchive: {\n rootOverwrite: determineRepoRoot(projectFolder, result),\n fileWhitelist: [\n `${projectFolder}/*`,\n ...getMonorepoFiles(projectFolder, result.entrypoints?.map((e) => e.package?.filePathMap ?? {}) ?? []),\n ],\n },\n };\n });\n\n return { parse };\n }),\n}) {}\n\nconst loadAssetOverrides = (config: Config, parseResult: NormalizedConfig): Partial<NormalizedConfig> => {\n return {\n assets: {\n overrides: {\n ...(parseResult.assets?.overrides ?? {}),\n ...config.overrides,\n },\n },\n };\n};\n\nconst loadImagePolicy = (config: Config): Partial<NormalizedConfig> => {\n if (!config.images) return {};\n const images = config.images;\n return {\n images: {\n localPatterns: images.localPatterns ?? [{ pathname: '/**' }],\n remotePatterns: [...(images.remotePatterns ?? []), ...images.domains.map((hostname) => ({ hostname }))],\n widths: images.sizes,\n heights: [],\n qualities: images.qualities ?? [75],\n formats: images.formats ?? ['image/webp'],\n minimumCacheTTL: images.minimumCacheTTL ?? 60,\n dangerouslyAllowSVG: images.dangerouslyAllowSVG ?? false,\n contentSecurityPolicy: images.contentSecurityPolicy ?? \"default-src 'self'; script-src 'none'; sandbox;\",\n contentDispositionType: images.contentDispositionType === 'inline' ? 'inline' : 'attachment',\n maximumRedirects: 3,\n maximumResponseBody: 50 * 1024 * 1024,\n variants: {},\n },\n };\n};\n","/**\n * Deeply merges a partial object into a target object.\n *\n * This function recursively merges properties from the partial object into the target object.\n * Arrays are concatenated, objects are recursively merged, and primitive values are overwritten.\n *\n * @param target - The target object to merge into\n * @param partial - The partial object containing properties to merge\n * @returns The modified target object with merged properties\n */\nexport const deepMerge = <T extends object>(target: T, ...partials: Partial<T>[]): T => {\n const isObject = (item: unknown): item is object => item !== null && typeof item === 'object';\n\n if (!isObject(target)) {\n return target;\n }\n\n for (const partial of partials) {\n if (!isObject(partial)) {\n continue;\n }\n\n Object.keys(partial).forEach((key) => {\n if (key === '__proto__' || key === 'constructor') return;\n const targetValue = target[key as keyof T];\n const sourceValue = partial[key as keyof T];\n\n if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {\n (targetValue as unknown[]).push(...(sourceValue as unknown[]));\n } else if (isObject(targetValue) && isObject(sourceValue)) {\n deepMerge(targetValue, sourceValue);\n } else {\n (target as Record<string, unknown>)[key] = sourceValue;\n }\n });\n }\n\n return target;\n};\n","import path from 'path';\nimport { NormalizedConfig } from '../normalized-config';\n\n/**\n * Determines the root of the repository based on the project folder and configuration.\n * Analyzes file paths in entrypoint packages to find the common root directory.\n *\n * @param projectFolder - The base folder path of the project\n * @param config - The normalized configuration that may contain entrypoints with file path maps\n * @returns The determined repository root path\n */\nexport const determineRepoRoot = (projectFolder: string, config: Partial<NormalizedConfig>): string => {\n // Default to project folder if no entrypoints or file paths\n if (!config.entrypoints?.length) {\n return projectFolder;\n }\n\n // Collect all file paths from entrypoints\n const filePaths: string[] = [];\n for (const entrypoint of config.entrypoints) {\n if (entrypoint.package?.filePathMap) {\n filePaths.push(...Object.keys(entrypoint.package.filePathMap));\n }\n }\n\n // If no file paths found, return project folder\n if (filePaths.length === 0) {\n return projectFolder;\n }\n\n // Get common path components\n const pathParts = filePaths.map((p) => p.split(path.sep));\n const firstPath = pathParts[0];\n\n const commonParts: string[] = [];\n for (let i = 0; i < firstPath.length; i++) {\n const part = firstPath[i];\n if (pathParts.every((parts) => parts[i] === part)) {\n commonParts.push(part);\n } else {\n break;\n }\n }\n\n // Join common parts to form the common root\n const commonRoot = commonParts.join(path.sep);\n\n // Only return common root if it's higher in the directory tree than the project folder\n // (i.e., project folder is a subdirectory of the common root)\n if (commonRoot && projectFolder.startsWith(commonRoot) && commonRoot !== projectFolder) {\n return commonRoot;\n }\n\n return projectFolder;\n};\n","import { FilePathMap } from '../normalized-config';\n\n/**\n * Returns files that are not part of the project directory\n * @param directory Absolute path of a directory\n * @param filePathMaps Array of file path maps for functions\n * @returns Array of file paths that are not within the directory\n */\nexport function getMonorepoFiles(directory: string, filePathMaps: FilePathMap[]): string[] {\n const result: string[] = [];\n\n for (const filePathMap of filePathMaps ?? []) {\n if (!filePathMap) {\n continue;\n }\n\n for (const file of Object.keys(filePathMap)) {\n if (!file.startsWith(directory)) {\n result.push(file);\n }\n }\n }\n\n return result;\n}\n","/**\n * Translates Vercel region codes to AWS region codes.\n *\n * Vercel uses three-letter codes (e.g., \"iad1\") to identify their regions,\n * while AWS uses longer region codes (e.g., \"us-east-1\").\n * This function maps the Vercel region code to its corresponding AWS region code.\n *\n * @param region - The Vercel region code to translate\n * @returns The corresponding AWS region code, defaults to 'us-east-1' if not found\n * @link https://vercel.com/docs/edge-network/regions#region-list\n */\nexport const translateVercelRegion = (region: string): string => {\n const regionMap: Record<string, string> = {\n arn1: 'eu-north-1',\n bom1: 'ap-south-1',\n cdg1: 'eu-west-3',\n cle1: 'us-east-2',\n cpt1: 'af-south-1',\n dub1: 'eu-west-1',\n fra1: 'eu-central-1',\n gru1: 'sa-east-1',\n hkg1: 'ap-east-1',\n hnd1: 'ap-northeast-1',\n iad1: 'us-east-1',\n icn1: 'ap-northeast-2',\n kix1: 'ap-northeast-3',\n lhr1: 'eu-west-2',\n pdx1: 'us-west-2',\n sfo1: 'us-west-1',\n sin1: 'ap-southeast-1',\n syd1: 'ap-southeast-2',\n };\n\n return regionMap[region.toLowerCase()] ?? 'us-east-1';\n};\n","import { Runtime } from '../runtime';\n\n/**\n * Translates Vercel runtime strings to our standardized Runtime format\n *\n * @param runtime - The Vercel runtime identifier (e.g. 'nodejs18.x')\n * @returns The corresponding Runtime value or null if no match is found\n */\nexport const translateVercelRuntime = (runtime: string): Runtime | null => {\n switch (runtime) {\n case 'nodejs12.x':\n case 'nodejs14.x':\n case 'nodejs16.x':\n case 'nodejs18.x':\n return 'node-18';\n case 'nodejs20.x':\n case 'nodejs22.x': // TODO: Update when Lambda supports Node.js 22\n return 'node-20';\n default:\n return null;\n }\n};\n","{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"title\": \"Config V4\",\n \"description\": \"Configuration schema for version 4\",\n \"type\": \"object\",\n \"required\": [\"version\"],\n \"properties\": {\n \"version\": {\n \"type\": \"integer\",\n \"enum\": [4],\n \"description\": \"The version of the configuration file\"\n },\n \"presets\": {\n \"type\": [\"array\", \"null\"],\n \"items\": {\n \"type\": \"string\",\n \"format\": \"uri\"\n },\n \"description\": \"A list of presets to apply to the project. Each preset will be applied in order.\"\n },\n \"assets\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"The folder which holds the assets to be deployed to the edge. Defaults to none.\"\n },\n \"populateAssetCache\": {\n \"type\": [\"boolean\", \"null\"],\n \"description\": \"If true, the assets will be cached at the edge during deployment. This may increase the deployment time, depending on the size of the assets. Defaults to false.\"\n },\n \"images\": {\n \"type\": [\"object\", \"null\"],\n \"description\": \"Managed image optimization policy for this deployment.\",\n \"additionalProperties\": false,\n \"properties\": {\n \"localPatterns\": {\n \"type\": \"array\",\n \"maxItems\": 64,\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"pathname\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 2048 },\n \"search\": { \"type\": \"string\", \"maxLength\": 2048 }\n }\n }\n },\n \"remotePatterns\": {\n \"type\": \"array\",\n \"maxItems\": 64,\n \"items\": {\n \"type\": \"object\",\n \"required\": [\"hostname\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"protocol\": { \"type\": \"string\", \"enum\": [\"http\", \"https\"] },\n \"hostname\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 253 },\n \"port\": { \"type\": \"string\", \"pattern\": \"^[0-9]{0,5}$\" },\n \"pathname\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 2048 },\n \"search\": { \"type\": \"string\", \"maxLength\": 2048 }\n }\n }\n },\n \"widths\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 64,\n \"uniqueItems\": true,\n \"items\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 8192 }\n },\n \"heights\": {\n \"type\": \"array\",\n \"maxItems\": 64,\n \"uniqueItems\": true,\n \"items\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 8192 }\n },\n \"qualities\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 100,\n \"uniqueItems\": true,\n \"items\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 100 }\n },\n \"formats\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 4,\n \"uniqueItems\": true,\n \"items\": { \"type\": \"string\", \"enum\": [\"image/avif\", \"image/webp\", \"image/jpeg\", \"image/png\"] }\n },\n \"minimumCacheTTL\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 31536000 },\n \"dangerouslyAllowSVG\": { \"type\": \"boolean\" },\n \"contentSecurityPolicy\": { \"type\": \"string\", \"maxLength\": 4096 },\n \"contentDispositionType\": { \"type\": \"string\", \"enum\": [\"inline\", \"attachment\"] },\n \"maximumRedirects\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 10 },\n \"maximumResponseBody\": { \"type\": \"integer\", \"minimum\": 1024, \"maximum\": 104857600 },\n \"variants\": {\n \"type\": \"object\",\n \"maxProperties\": 100,\n \"propertyNames\": { \"pattern\": \"^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$\" },\n \"additionalProperties\": {\n \"type\": \"object\",\n \"minProperties\": 1,\n \"additionalProperties\": false,\n \"properties\": {\n \"width\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 8192 },\n \"height\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 8192 },\n \"quality\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 100 },\n \"format\": { \"type\": \"string\", \"enum\": [\"image/avif\", \"image/webp\", \"image/jpeg\", \"image/png\"] },\n \"fit\": { \"type\": \"string\", \"enum\": [\"contain\", \"cover\", \"fill\", \"inside\", \"outside\"] }\n }\n }\n }\n }\n },\n \"regions\": {\n \"type\": [\"array\", \"null\"],\n \"description\": \"The regions to which the project will be deployed. Use \\\"global\\\" to deploy to all regions. More regions will incur higher costs.\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"build_commands\": {\n \"type\": [\"array\", \"null\"],\n \"description\": \"The commands to run to build the project. For example, `bun install` or `npm install`.\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"functions\": {\n \"type\": [\"object\", \"null\"],\n \"description\": \"The serverless functions to deploy.\",\n \"additionalProperties\": {\n \"type\": \"object\",\n \"properties\": {\n \"memory\": {\n \"type\": \"number\",\n \"description\": \"The memory in MB to allocate to the function. Defaults to 128.\",\n \"maximum\": 3009,\n \"minimum\": 128\n },\n \"max_duration\": {\n \"type\": \"number\",\n \"description\": \"The maximum lifetime in seconds of one HTTP request, response stream, or WebSocket connection. Defaults to 30. The reusable execution environment is not terminated with the invocation.\",\n \"maximum\": 28800,\n \"minimum\": 1\n },\n \"runtime\": {\n \"anyOf\": [{ \"$ref\": \"#/$defs/runtimes\" }, { \"const\": \"docker\" }],\n \"description\": \"The runtime to use for the function. `docker` builds the matched file as a Dockerfile, with its directory as the build context, and runs the image as the function.\"\n },\n \"port\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 65535,\n \"description\": \"TCP port the image listens on. Only for `runtime: docker`. Defaults to the first exposed port of the image, then 8080.\"\n },\n \"streaming\": {\n \"type\": \"boolean\",\n \"description\": \"Enable function response streaming. When omitted, Node and Bun runtimes stream by default.\"\n },\n \"schedule\": {\n \"$ref\": \"#/$defs/schedule\",\n \"description\": \"An expression to schedule the function to run at specific times.\"\n },\n \"symlinks\": {\n \"type\": \"object\",\n \"description\": \"A list of symbolic links to create in the function's package.\",\n \"maxProperties\": 100,\n \"minProperties\": 1,\n \"patternProperties\": {\n \"^.{1,256}$\": {\n \"type\": \"string\",\n \"maxLength\": 256\n }\n },\n \"additionalProperties\": false\n },\n \"excludeFiles\": {\n \"oneOf\": [{ \"type\": \"string\" }, { \"type\": \"array\", \"items\": { \"type\": \"string\" } }],\n \"description\": \"A glob pattern to match files that should be excluded from your Serverless Function. If you're using a Community Runtime, the behavior might vary.\"\n },\n \"includeFiles\": {\n \"oneOf\": [{ \"type\": \"string\" }, { \"type\": \"array\", \"items\": { \"type\": \"string\" } }],\n \"description\": \"A glob pattern to match files that should be included in your Serverless Function. If you're using a Community Runtime, the behavior might vary.\"\n }\n }\n }\n },\n \"env\": {\n \"type\": \"object\",\n \"maxProperties\": 100,\n \"minProperties\": 0,\n \"patternProperties\": {\n \".+\": {\n \"maxLength\": 65536,\n \"minLength\": 0,\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false,\n \"description\": \"Additional environment variables to set during runtime and build.\"\n },\n \"routes\": {\n \"type\": [\"array\", \"null\"],\n \"description\": \"A list of route definitions.\",\n \"maxItems\": 1024,\n \"items\": {\n \"type\": \"object\",\n \"required\": [\"source\", \"destination\"],\n \"properties\": {\n \"source\": {\n \"description\": \"A pattern that matches each incoming pathname (excluding querystring).\",\n \"type\": \"string\",\n \"maxLength\": 4096\n },\n \"destination\": {\n \"description\": \"An absolute pathname to an existing resource or an external URL.\",\n \"type\": \"string\",\n \"maxLength\": 4096\n },\n \"has\": {\n \"$ref\": \"#/$defs/matchRequirements\"\n },\n \"missing\": {\n \"$ref\": \"#/$defs/matchRequirements\"\n },\n \"statusCode\": {\n \"description\": \"An optional integer to override the status code of the response.\",\n \"type\": \"integer\",\n \"minimum\": 100,\n \"maximum\": 999\n },\n \"redirect\": {\n \"type\": \"boolean\",\n \"description\": \"An optional boolean to force a redirect response.\"\n },\n \"methods\": {\n \"type\": \"array\",\n \"description\": \"The HTTP methods to match for the route. Defaults to all methods.\",\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\"ANY\", \"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"HEAD\", \"OPTIONS\"]\n }\n },\n \"headers\": {\n \"type\": \"object\",\n \"description\": \"Additional headers to add to the response.\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"compose\": {\n \"type\": [\"string\", \"null\"],\n \"minLength\": 1,\n \"maxLength\": 1024,\n \"description\": \"Project-relative path of a Compose file whose services are imported as containers. Entries in `containers` win over imported services of the same name.\"\n },\n \"containers\": {\n \"type\": [\"object\", \"null\"],\n \"description\": \"Container images to run, keyed by name. A container runs as a function unless `sidecar` is true; routes target it with `destination: container:<name>`. A sidecar runs next to every function instance and answers at `<name>:<port>`.\",\n \"maxProperties\": 16,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9_-]{0,62}$\",\n \"not\": {\n \"enum\": [\"localhost\"]\n }\n },\n \"additionalProperties\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"oneOf\": [\n {\n \"required\": [\"image\"]\n },\n {\n \"required\": [\"build\"]\n }\n ],\n \"properties\": {\n \"image\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 512,\n \"pattern\": \"^[^\\\\s]+$\",\n \"description\": \"Registry image reference, e.g. `redis:7-alpine` or `ghcr.io/acme/api:1.4`.\"\n },\n \"build\": {\n \"description\": \"Build context directory, or the full build settings, for a Dockerfile in the repository.\",\n \"oneOf\": [\n {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 1024\n },\n {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"context\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 1024\n },\n \"dockerfile\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 1024\n },\n \"target\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 128\n },\n \"args\": {\n \"type\": \"object\",\n \"maxProperties\": 100,\n \"additionalProperties\": {\n \"type\": \"string\",\n \"maxLength\": 65536\n }\n }\n }\n }\n ]\n },\n \"sidecar\": {\n \"type\": \"boolean\",\n \"description\": \"Run next to every function instance instead of serving routes. Defaults to false.\"\n },\n \"port\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 65535,\n \"description\": \"TCP port the container listens on. Defaults to the first exposed port of the image, then 8080.\"\n },\n \"entrypoint\": {\n \"$ref\": \"#/$defs/stringOrStringArray\",\n \"description\": \"Replaces the image ENTRYPOINT. A string is split into words the way Compose splits it.\"\n },\n \"command\": {\n \"$ref\": \"#/$defs/stringOrStringArray\",\n \"description\": \"Replaces the image CMD. A string is split into words the way Compose splits it.\"\n },\n \"env\": {\n \"type\": \"object\",\n \"maxProperties\": 100,\n \"additionalProperties\": {\n \"type\": \"string\",\n \"maxLength\": 65536\n },\n \"description\": \"Environment variables baked into the container, merged over the image ENV.\"\n },\n \"working_dir\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 1024,\n \"pattern\": \"^/\",\n \"description\": \"Replaces the image WORKDIR. Must be absolute.\"\n },\n \"user\": {\n \"oneOf\": [\n {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 256\n },\n {\n \"type\": \"integer\",\n \"minimum\": 0\n }\n ],\n \"description\": \"Replaces the image USER: a name, a uid, `name:group` or `uid:gid`. A bare uid may be a number.\"\n },\n \"memory\": {\n \"type\": \"integer\",\n \"minimum\": 128,\n \"maximum\": 3009,\n \"description\": \"Memory in MB. Defaults to 512 for a container function and 256 for a sidecar.\"\n },\n \"max_duration\": {\n \"type\": \"number\",\n \"minimum\": 1,\n \"maximum\": 28800,\n \"description\": \"Maximum lifetime in seconds of one request. Container functions only.\"\n },\n \"streaming\": {\n \"type\": \"boolean\",\n \"description\": \"Stream responses. Defaults to true. Container functions only.\"\n },\n \"schedule\": {\n \"$ref\": \"#/$defs/schedule\",\n \"description\": \"An expression to run the container function at specific times. Container functions only.\"\n }\n }\n }\n },\n \"services\": {\n \"type\": \"object\",\n \"description\": \"Managed services to provision for the deployment environment.\",\n \"additionalProperties\": false,\n \"properties\": {\n \"redis\": {\n \"oneOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"envBindings\": {\n \"type\": \"object\",\n \"description\": \"Optionally, specify what environment variables the credentials will be bound to. For example: `{ url: 'REDIS_URL' }` will bind the `url` environment variable to the Redis URL. If you don't specify any bindings, they will be bound to the REDIS_URL, REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, REDIS_DB, and REDIS_SSL environment variables.\",\n \"additionalProperties\": false,\n \"properties\": {\n \"url\": { \"type\": \"string\" },\n \"host\": { \"type\": \"string\" },\n \"port\": { \"type\": \"string\" },\n \"password\": { \"type\": \"string\" },\n \"db\": { \"type\": \"string\" },\n \"ssl\": { \"type\": \"string\" }\n }\n },\n \"primaryRegion\": {\n \"type\": \"string\",\n \"description\": \"The primary region to deploy the Redis instance to.\",\n \"enum\": [\n \"us-east-1\",\n \"us-east-2\",\n \"us-west-1\",\n \"us-west-2\",\n \"eu-central-1\",\n \"eu-west-1\",\n \"eu-west-2\",\n \"sa-east-1\",\n \"ap-south-1\",\n \"ap-northeast-1\",\n \"ap-southeast-1\",\n \"ap-southeast-2\",\n \"us-central1\"\n ]\n },\n \"readRegions\": {\n \"type\": \"array\",\n \"description\": \"Optionally, add additional regions to read from. More regions will incur higher costs.\",\n \"items\": {\n \"type\": \"string\",\n \"enum\": [\n \"us-east-1\",\n \"us-east-2\",\n \"us-west-1\",\n \"us-west-2\",\n \"eu-central-1\",\n \"eu-west-1\",\n \"eu-west-2\",\n \"sa-east-1\",\n \"ap-south-1\",\n \"ap-northeast-1\",\n \"ap-southeast-1\",\n \"ap-southeast-2\"\n ]\n }\n },\n \"eviction\": {\n \"type\": \"boolean\",\n \"description\": \"Optionally, enable Redis eviction. This will evict the least recently used keys in order to make space for new ones.\"\n }\n }\n }\n ]\n },\n \"postgres\": {\n \"oneOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"envBindings\": {\n \"type\": \"object\",\n \"description\": \"Optionally, specify what environment variables the credentials will be bound to. For example: `{ url: 'POSTGRES_URL' }` will bind the `url` environment variable to the Postgres URL. If you don't specify any bindings, they will be bound to the POSTGRES_URL, POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DATABASE environment variables.\",\n \"additionalProperties\": false,\n \"properties\": {\n \"url\": { \"type\": \"string\" },\n \"host\": { \"type\": \"string\" },\n \"port\": { \"type\": \"string\" },\n \"user\": { \"type\": \"string\" },\n \"password\": { \"type\": \"string\" },\n \"database\": { \"type\": \"string\" }\n }\n },\n \"postgresVersion\": {\n \"type\": \"string\",\n \"description\": \"The version of Postgres to deploy.\",\n \"enum\": [\"17\", \"16\", \"15\", \"14\"]\n },\n \"region\": {\n \"type\": \"string\",\n \"description\": \"The region to deploy the Postgres instance to.\",\n \"enum\": [\n \"us-east-1\",\n \"us-east-2\",\n \"us-west-2\",\n \"ap-southeast-1\",\n \"ap-southeast-2\",\n \"eu-central-1\",\n \"eu-west-2\",\n \"sa-east-1\"\n ]\n }\n }\n }\n ]\n },\n \"storage\": {\n \"type\": \"object\",\n \"required\": [\"buckets\"],\n \"additionalProperties\": false,\n \"description\": \"File Storage buckets to provision in the deployment environment. The environment and global delivery/S3 slug are assigned by the platform.\",\n \"properties\": {\n \"buckets\": {\n \"type\": \"object\",\n \"description\": \"Buckets keyed by immutable environment-scoped name. Use null or an empty object for the default private visibility.\",\n \"propertyNames\": {\n \"minLength\": 3,\n \"maxLength\": 63,\n \"pattern\": \"^(?![0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$\"\n },\n \"additionalProperties\": {\n \"oneOf\": [\n { \"type\": \"null\" },\n {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"visibility\": {\n \"type\": \"string\",\n \"enum\": [\"public\", \"private\"],\n \"description\": \"Bucket access policy. Defaults to private when omitted. Public buckets can serve objects through their CDN hostname.\"\n }\n }\n }\n ]\n }\n }\n }\n },\n \"queues\": {\n \"type\": \"object\",\n \"description\": \"Queues to provision in the deployment environment, keyed by name. Use null for a pull queue with default settings. Queues you stop declaring are kept, with their messages.\",\n \"propertyNames\": {\n \"maxLength\": 255,\n \"pattern\": \"^[A-Za-z0-9_][A-Za-z0-9_.~:@+=-]*$\"\n },\n \"additionalProperties\": {\n \"oneOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"consumer\": {\n \"type\": [\"string\", \"null\"],\n \"pattern\": \"^/(?!/)\\\\S*$\",\n \"maxLength\": 2048,\n \"description\": \"Deployment-relative path that receives each message as a signed POST, for example /api/queues/emails. Omit it for a pull queue that you drain with receive.\"\n },\n \"visibilityTimeout\": {\n \"$ref\": \"#/$defs/queueDuration\",\n \"description\": \"How long a push delivery may run, or how long a received message stays leased. Defaults to 60 seconds, at most 12 hours.\"\n },\n \"retention\": {\n \"$ref\": \"#/$defs/queueDuration\",\n \"description\": \"How long an undelivered message is kept. Defaults to 4 days, at most 14 days.\"\n },\n \"maxAttempts\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 100,\n \"description\": \"Deliveries per message before it moves to the dead-letter list. Defaults to 10.\"\n },\n \"retryBackoff\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"description\": \"Exponential backoff between failed deliveries. Defaults to 5 seconds, doubling up to 15 minutes.\",\n \"properties\": {\n \"min\": {\n \"$ref\": \"#/$defs/queueDuration\"\n },\n \"max\": {\n \"$ref\": \"#/$defs/queueDuration\"\n }\n }\n },\n \"deduplicationWindow\": {\n \"$ref\": \"#/$defs/queueDuration\",\n \"description\": \"How long a deduplication key is remembered. Defaults to 24 hours, at most 7 days.\"\n },\n \"concurrency\": {\n \"type\": [\"integer\", \"null\"],\n \"minimum\": 1,\n \"maximum\": 1000,\n \"description\": \"Most push deliveries in flight at once. Defaults to 100.\"\n },\n \"rateLimit\": {\n \"oneOf\": [\n {\n \"type\": \"null\"\n },\n {\n \"type\": \"object\",\n \"required\": [\"count\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"count\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 1000000\n },\n \"period\": {\n \"$ref\": \"#/$defs/queueDuration\"\n }\n }\n }\n ],\n \"description\": \"Most deliveries started per period. The period defaults to one second.\"\n },\n \"deadLetter\": {\n \"type\": \"boolean\",\n \"description\": \"Keep messages that run out of attempts so you can inspect and redrive them. Defaults to true.\"\n },\n \"schedules\": {\n \"type\": \"object\",\n \"description\": \"Cron schedules that send a message into this queue, keyed by schedule name.\",\n \"propertyNames\": {\n \"maxLength\": 128,\n \"pattern\": \"^[A-Za-z0-9_][A-Za-z0-9_.-]*$\"\n },\n \"additionalProperties\": {\n \"type\": \"object\",\n \"required\": [\"cron\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"cron\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 255,\n \"description\": \"Five-field cron expression, or a macro such as @hourly or @daily.\"\n },\n \"timezone\": {\n \"type\": \"string\",\n \"description\": \"IANA time zone the expression is evaluated in. Defaults to UTC.\"\n },\n \"body\": {\n \"description\": \"Message body. Strings are sent as is; any other value is sent as JSON.\"\n },\n \"contentType\": {\n \"type\": \"string\",\n \"description\": \"Content type of the body. Defaults to text/plain for a string body and application/json otherwise.\"\n },\n \"headers\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n },\n \"description\": \"Headers delivered with every message from this schedule.\"\n },\n \"enabled\": {\n \"type\": \"boolean\",\n \"description\": \"Set to false to keep the schedule without sending. Defaults to true.\"\n }\n }\n }\n }\n }\n }\n ]\n }\n }\n }\n }\n },\n \"$defs\": {\n \"schedule\": {\n \"type\": \"string\",\n \"pattern\": \"^(?:rate[(](?:(?:1[ ]+(hour|minute|day))|(?:[0-9]+[ ]+(hours|minutes|days)))[)])|(?:cron[(](?:(?:(?:[0-5]?[0-9])|[*])(?:(?:[-](?:(?:[0-5]?[0-9])|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[0-5]?[0-9])|[*])(?:(?:[-](?:(?:[0-5]?[0-9])|[*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[0-2]?[0-9])|[*])(?:(?:[-](?:(?:[0-2]?[0-9])|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[0-2]?[0-9])|[*])(?:(?:[-](?:(?:[0-2]?[0-9])|[*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:[?][ ]+(?:(?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?(?:[,](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))[#][0-5])|(?:(?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*])(?:(?:[-](?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*]))|(?:[/][0-9]+))?(?:[,](?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*])(?:(?:[-](?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*]))|(?:[/][0-9]+))?)*)))|(?:(?:(?:(?:(?:[1-3]?[0-9])W?)|LW|[L*])(?:(?:[-](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*]))|(?:[/][0-9]+))?(?:[,](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*])(?:(?:[-](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?(?:[,](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?)*)[ ]+[?]))[ ]+(?:(?:(?:[12][0-9]{3})|[*])(?:(?:[-](?:(?:[12][0-9]{3})|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[12][0-9]{3})|[*])(?:(?:[-](?:(?:[12][0-9]{3})|[*]))|(?:[/][0-9]+))?)*)[)])$\"\n },\n \"stringOrStringArray\": {\n \"oneOf\": [\n {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 4096\n },\n {\n \"type\": \"array\",\n \"maxItems\": 256,\n \"items\": {\n \"type\": \"string\",\n \"maxLength\": 4096\n }\n }\n ]\n },\n \"queueDuration\": {\n \"oneOf\": [\n {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n {\n \"type\": \"string\",\n \"pattern\": \"^[0-9]+(\\\\.[0-9]+)?(s|m|h|d)$\"\n }\n ],\n \"description\": \"A duration in seconds, or a string such as 30s, 10m, 1.5h or 4d.\"\n },\n \"runtimes\": {\n \"type\": \"string\",\n \"enum\": [\"php-84\", \"php-83\", \"php-81\", \"node-22\", \"node-20\", \"node-18\", \"node-16\", \"bun-1\"]\n },\n \"matchRequirements\": {\n \"description\": \"An array of requirements that are needed to match\",\n \"type\": \"array\",\n \"maxItems\": 16,\n \"items\": {\n \"anyOf\": [\n {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"type\", \"value\"],\n \"properties\": {\n \"type\": {\n \"description\": \"The type of request element to check\",\n \"type\": \"string\",\n \"enum\": [\"host\"]\n },\n \"value\": {\n \"description\": \"A regular expression used to match the value. Named groups can be used in the destination\",\n \"type\": \"string\",\n \"maxLength\": 4096\n }\n }\n },\n {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"type\", \"key\"],\n \"properties\": {\n \"type\": {\n \"description\": \"The type of request element to check\",\n \"type\": \"string\",\n \"enum\": [\"header\", \"cookie\", \"query\"]\n },\n \"key\": {\n \"description\": \"The name of the element contained in the particular type\",\n \"type\": \"string\",\n \"maxLength\": 4096\n },\n \"value\": {\n \"description\": \"A regular expression used to match the value. Named groups can be used in the destination\",\n \"type\": \"string\",\n \"maxLength\": 4096\n }\n }\n }\n ]\n }\n }\n }\n}\n","// Define all available runtimes in a single array\nconst RUNTIME_DEFINITIONS = [\n 'php-84',\n 'php-83',\n 'php-81',\n 'node-22',\n 'node-20',\n 'node-18',\n 'node-16',\n 'bun-1',\n] as const;\n\n// Generate the Runtime type from the array\nexport type Runtime = (typeof RUNTIME_DEFINITIONS)[number];\n\n// Export the available runtimes\nexport const AVAILABLE_RUNTIMES: Runtime[] = [...RUNTIME_DEFINITIONS];\n","import { Layer } from 'effect';\nimport { ConfigModuleLoader } from './config-module-loader';\nimport { RawConfigReader } from './raw-config-reader';\nimport { SchemaValidator } from './schema-validator';\nimport { V4ConfigParser } from './v4-config-parser';\nimport { VercelBuildOutputParser } from './vercel-build-output-parser';\n\nexport { ConfigModuleLoader } from './config-module-loader';\nexport { ALLOWED_CONFIG_NAMES, RawConfigReader } from './raw-config-reader';\nexport { SchemaValidator } from './schema-validator';\nexport { getFunctionSettings, V4ConfigParser } from './v4-config-parser';\nexport { VercelBuildOutputParser } from './vercel-build-output-parser';\n\n/**\n * Composed layer providing all network-config services.\n * Requires `FileSystem.FileSystem` (e.g. via `NodeContext.layer`).\n */\nconst BaseLayers = Layer.mergeAll(\n ConfigModuleLoader.Default,\n RawConfigReader.Default,\n SchemaValidator.Default,\n V4ConfigParser.Default\n);\n\nexport const NetworkConfigLive = VercelBuildOutputParser.Default.pipe(Layer.provideMerge(BaseLayers));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,iBAAuB;;;ACAvB,oBAA+B;AAE/B,IAAM,mBAAmB;AACzB,IAAM,oBAAoB;AA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M;AAAA,EACvB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AACjB;AAEO,IAAM,oBAAoB,wBAAwB,QAAQ,KAAK,sBAAM,aAAa,UAAU,CAAC;","names":["import_effect","path","import_effect","import_platform","import_effect","import_effect","parseYaml","import_platform","import_effect","import_platform","import_effect","import_platform","import_effect","import_platform","import_effect","isRecord","import_platform","import_effect","isRecord","outputPath","import_platform","import_effect","import_platform","import_effect","import_effect","import_platform","import_effect","import_effect","import_platform","import_effect","import_effect","import_effect","path","import_effect","import_platform","import_effect","import_yaml","import_effect","parseYaml","import_effect","Ajv","addFormats","import_effect","import_minimatch","import_node_path","path","safeRegex","import_platform","import_effect","path","import_effect"]}