@gigadrive/network-config 4.0.0 → 4.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/detection/detect-framework.ts","../src/detection/detect-package-manager.ts","../src/detection/frameworks/astro.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-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/schema-validator.ts","../src/services/v4-config-parser.ts","../src/services/vercel-build-output-parser.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 './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';\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 type { FrameworkDefinition } from '../types';\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};\n","import type { FrameworkDefinition } from '../types';\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};\n","import type { FrameworkDefinition } from '../types';\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};\n","import type { FrameworkDefinition } from '../types';\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};\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 {\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 * 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 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 // Prerender fallback file paths are repo-root-relative; walk up from the project\n // folder by the depth of `repoRootToProject` to recover the repo root.\n let repoRoot = projectFolder;\n if (manifest.repoRootToProject !== '.') {\n repoRoot = manifest.repoRootToProject.split('/').reduce((root) => pathService.dirname(root), repoRoot);\n }\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 // Rewrite each prerender fallback to an internal asset path and publish the shell\n // so the edge can seed fresh static/PPR responses without customer compute.\n const prerenders = manifest.outputs.prerenders.map((output) => {\n if (!output.fallback?.filePath) return output;\n const absolutePath = pathService.join(repoRoot, output.fallback.filePath);\n const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));\n if (projectRelativePath.startsWith('../')) return output;\n const internalAssetPath = `_gigadrive/prerender/${encodeURIComponent(output.id)}.html`;\n assetPaths.push(projectRelativePath);\n assetOverrides[projectRelativePath] = { path: internalAssetPath };\n return {\n ...output,\n fallback: { ...output.fallback, filePath: `/${internalAssetPath}` },\n };\n });\n\n const singleEntrypoint: NormalizedConfigEntrypoint = {\n displayName: 'next-server',\n path: entrypoint,\n runtime: defaults.runtime,\n memory: defaults.memory,\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 outputs: { prerenders, staticAssets: manifest.outputs.staticAssets },\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 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","import type { NormalizedImagePolicy } from './image-policy';\n\n/** JSON values accepted in the portable Next.js adapter manifest. */\nexport type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };\n\nexport interface GigadriveNextPrerenderOutput {\n id: string;\n type: 'PRERENDER';\n pathname: string;\n parentOutputId: string;\n groupId: number;\n pprChain?: { headers: Record<string, string> };\n parentFallbackMode?: JsonValue;\n fallback?: {\n filePath?: string;\n initialStatus?: number;\n initialHeaders?: Record<string, string | string[]>;\n initialExpiration?: number;\n initialRevalidate?: number | false;\n postponedState?: string;\n };\n config: {\n allowQuery?: string[];\n allowHeader?: string[];\n bypassFor?: JsonValue[];\n renderingMode?: string;\n partialFallback?: boolean;\n bypassToken?: string;\n };\n}\n\n/**\n * A directory subtree published under a single URL prefix, registered as one\n * descriptor instead of enumerating every file. Used to collapse `.next/static`\n * (thousands of content-hashed chunks) into a single edge-served prefix.\n */\nexport interface GigadriveNextStaticAssetPrefix {\n /** Project-relative source directory (e.g. `.next/static`). */\n sourceDir: string;\n /** Public URL prefix the subtree is served under (e.g. `_next/static`). */\n urlPrefix: string;\n /** Entries are content-hashed and safe to serve with immutable cache-control. */\n immutable: boolean;\n}\n\nexport interface GigadriveNextBuildManifestV1 {\n version: 1;\n output: 'standalone' | 'export';\n distDir: string;\n repoRootToProject: string;\n nextVersion: string;\n buildId: string;\n}\n\n/** Aggregated runtime configuration collapsed onto the single standalone server. */\nexport interface GigadriveNextServerDescriptor {\n maxDuration?: number;\n preferredRegion?: string | string[];\n env?: Record<string, string>;\n}\n\n/**\n * Portable runtime plan for the single standalone Next.js server (Next >= 16.2).\n *\n * The whole deployment runs as one `next start` standalone server, so the plan\n * carries only what the platform needs to route around it: prerender/ISR/PPR\n * seeds, the `.next/static` prefix, and the routing/image configuration. It\n * deliberately omits per-route outputs and entrypoints — the server owns\n * routing, middleware, edge routes, and PPR resume in-process.\n */\nexport interface GigadriveNextBuildManifestV2Standalone {\n version: 2;\n mode: 'standalone-v2';\n distDir: string;\n repoRootToProject: string;\n nextVersion: string;\n buildId: string;\n server: GigadriveNextServerDescriptor;\n config: {\n basePath: string;\n trailingSlash: boolean;\n cacheComponents: boolean;\n i18n?: JsonValue;\n images?: NormalizedImagePolicy;\n };\n routing: {\n beforeMiddleware: JsonValue[];\n beforeFiles: JsonValue[];\n afterFiles: JsonValue[];\n dynamicRoutes: JsonValue[];\n onMatch: JsonValue[];\n fallback: JsonValue[];\n shouldNormalizeNextData: boolean;\n rsc: JsonValue;\n };\n outputs: {\n prerenders: GigadriveNextPrerenderOutput[];\n staticAssets: GigadriveNextStaticAssetPrefix[];\n };\n}\n\n/** Minimal plan for static-export builds (Next >= 16.2). */\nexport interface GigadriveNextBuildManifestV2Export {\n version: 2;\n mode: 'export';\n distDir: string;\n repoRootToProject: string;\n nextVersion: string;\n buildId: string;\n}\n\nexport type GigadriveNextBuildManifestV2 = GigadriveNextBuildManifestV2Standalone | GigadriveNextBuildManifestV2Export;\n\nexport type GigadriveNextBuildManifest = GigadriveNextBuildManifestV1 | GigadriveNextBuildManifestV2;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null;\n\nconst isPortableRelativePath = (value: unknown, allowCurrentDirectory = false): value is string => {\n if (typeof value !== 'string') return false;\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('/').some((segment) => segment === '..')\n );\n};\n\nconst isStringRecord = (value: unknown): value is Record<string, string> =>\n isRecord(value) && Object.values(value).every((item) => typeof item === 'string');\n\nconst isJsonValue = (value: unknown): value is JsonValue => {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (Array.isArray(value)) return value.every(isJsonValue);\n return isRecord(value) && Object.values(value).every(isJsonValue);\n};\n\nconst isPrerenderOutput = (value: unknown): value is GigadriveNextPrerenderOutput =>\n isRecord(value) &&\n value.type === 'PRERENDER' &&\n typeof value.id === 'string' &&\n typeof value.pathname === 'string' &&\n typeof value.parentOutputId === 'string' &&\n typeof value.groupId === 'number' &&\n isRecord(value.config) &&\n (value.fallback === undefined ||\n (isRecord(value.fallback) &&\n (value.fallback.filePath === undefined || isPortableRelativePath(value.fallback.filePath))));\n\nconst isStaticAssetPrefix = (value: unknown): value is GigadriveNextStaticAssetPrefix =>\n isRecord(value) &&\n isPortableRelativePath(value.sourceDir) &&\n isPortableRelativePath(value.urlPrefix) &&\n typeof value.immutable === 'boolean';\n\nconst isServerDescriptor = (value: unknown): value is GigadriveNextServerDescriptor =>\n isRecord(value) &&\n (value.maxDuration === undefined || typeof value.maxDuration === 'number') &&\n (value.preferredRegion === undefined ||\n typeof value.preferredRegion === 'string' ||\n (Array.isArray(value.preferredRegion) && value.preferredRegion.every((region) => typeof region === 'string'))) &&\n (value.env === undefined || isStringRecord(value.env));\n\nconst isImagePolicy = (value: unknown): value is NormalizedImagePolicy =>\n isRecord(value) &&\n Array.isArray(value.localPatterns) &&\n Array.isArray(value.remotePatterns) &&\n value.remotePatterns.every((pattern) => isRecord(pattern) && typeof pattern.hostname === 'string') &&\n Array.isArray(value.widths) &&\n value.widths.every((item) => typeof item === 'number' && Number.isInteger(item) && item > 0) &&\n Array.isArray(value.heights) &&\n value.heights.every((item) => typeof item === 'number' && Number.isInteger(item) && item > 0) &&\n Array.isArray(value.qualities) &&\n value.qualities.every((item) => typeof item === 'number' && item >= 1 && item <= 100) &&\n Array.isArray(value.formats) &&\n value.formats.every((item) => ['image/avif', 'image/webp', 'image/jpeg', 'image/png'].includes(String(item))) &&\n typeof value.minimumCacheTTL === 'number' &&\n typeof value.dangerouslyAllowSVG === 'boolean' &&\n typeof value.contentSecurityPolicy === 'string' &&\n (value.contentDispositionType === 'inline' || value.contentDispositionType === 'attachment') &&\n typeof value.maximumRedirects === 'number' &&\n typeof value.maximumResponseBody === 'number' &&\n isRecord(value.variants);\n\n/** Parses and structurally validates adapter metadata before deployment code consumes it. */\nexport const parseGigadriveNextBuildManifest = (content: string): GigadriveNextBuildManifest | undefined => {\n try {\n const value: unknown = JSON.parse(content);\n if (!isRecord(value)) return undefined;\n\n if (value.version === 1) {\n if (\n (value.output !== 'standalone' && value.output !== 'export') ||\n !isPortableRelativePath(value.distDir) ||\n !isPortableRelativePath(value.repoRootToProject, true) ||\n typeof value.nextVersion !== 'string' ||\n typeof value.buildId !== 'string'\n ) {\n return undefined;\n }\n return value as unknown as GigadriveNextBuildManifestV1;\n }\n\n if (value.version === 2) {\n if (\n !isPortableRelativePath(value.distDir) ||\n !isPortableRelativePath(value.repoRootToProject, true) ||\n typeof value.nextVersion !== 'string' ||\n typeof value.buildId !== 'string'\n ) {\n return undefined;\n }\n\n if (value.mode === 'export') {\n return value as unknown as GigadriveNextBuildManifestV2Export;\n }\n\n if (value.mode === 'standalone-v2') {\n if (\n !isServerDescriptor(value.server) ||\n !isRecord(value.config) ||\n typeof value.config.basePath !== 'string' ||\n typeof value.config.trailingSlash !== 'boolean' ||\n typeof value.config.cacheComponents !== 'boolean' ||\n (value.config.images !== undefined && !isImagePolicy(value.config.images)) ||\n !isRecord(value.routing) ||\n !isJsonValue(value.routing) ||\n !isRecord(value.outputs) ||\n !Array.isArray(value.outputs.prerenders) ||\n !value.outputs.prerenders.every(isPrerenderOutput) ||\n !Array.isArray(value.outputs.staticAssets) ||\n !value.outputs.staticAssets.every(isStaticAssetPrefix)\n ) {\n return undefined;\n }\n return value as unknown as GigadriveNextBuildManifestV2Standalone;\n }\n\n // Legacy `mode: 'adapter-v2'` (per-route split) is no longer produced or consumed.\n return undefined;\n }\n\n return undefined;\n } catch {\n return undefined;\n }\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 } 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) {\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 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 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 defined with paths, 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 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: userConfig.assets?.paths && userConfig.assets.paths.length > 0 ? 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 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 * 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 services?: Array<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\nexport type NormalizedConfigServiceType = 'redis' | 'postgres';\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 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 envBindings?: Record<'url' | 'host' | 'port' | 'user' | 'password' | 'database', string>;\n postgresVersion?: '17' | '16' | '15' | '14';\n region?: NeonAWSRegion;\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'> & {\n type: 'nextjs';\n schemaVersion: 2;\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\n // Stricter check first: no functions, no assets, AND no routes → error\n if (result.entrypoints.length === 0 && (result.assets?.paths?.length || 0) === 0 && 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 && (result.assets?.paths?.length || 0) === 0) {\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';\n\nexport const ALLOWED_CONFIG_NAMES = [\n 'gigadrive.yaml',\n 'gigadrive.yml',\n 'nebula.yaml',\n 'nebula.yml',\n 'nebula.json',\n] as const;\n\nexport class RawConfigReader extends Effect.Service<RawConfigReader>()('RawConfigReader', {\n effect: Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\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 *\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 try {\n if (fileExtension === '.json') {\n parsed = JSON.parse(fileContents) as Record<string, unknown>;\n } else if (['.yml', '.yaml'].includes(fileExtension)) {\n parsed = parseYaml(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 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 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 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\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 entrypoints,\n errors: [],\n warnings: [],\n routes: (config.routes ?? []).map((route) => mapRoute(route, entrypoints)),\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","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[ ]+(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]+))?(?:[,](?:(?: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)?)|(?:[/][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\": \"Optionally, specify additional services like databases to deploy.\",\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 }\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 { 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 { 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(RawConfigReader.Default, SchemaValidator.Default, V4ConfigParser.Default);\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;;;ACAA,IAAAA,mBAAiC;AACjC,IAAAC,iBAAuB;;;ACDvB,sBAAiC;AACjC,oBAAuB;AAMvB,IAAM,eAA+D;AAAA,EACnE,EAAE,OAAO,CAAC,aAAa,UAAU,GAAG,IAAI,MAAM;AAAA,EAC9C,EAAE,OAAO,CAAC,gBAAgB,GAAG,IAAI,OAAO;AAAA,EACxC,EAAE,OAAO,CAAC,WAAW,GAAG,IAAI,OAAO;AAAA,EACnC,EAAE,OAAO,CAAC,mBAAmB,GAAG,IAAI,MAAM;AAAA,EAC1C,EAAE,OAAO,CAAC,eAAe,GAAG,IAAI,WAAW;AAC7C;AASO,IAAM,uBAAuB,qBAAO,GAAG,sBAAsB,EAAE,WAAW,eAAuB;AACtG,QAAM,KAAK,OAAO,2BAAW;AAC7B,QAAM,cAAc,OAAO,qBAAK;AAEhC,aAAW,EAAE,OAAO,GAAG,KAAK,cAAc;AACxC,eAAW,QAAQ,OAAO;AACxB,YAAM,SAAS,OAAO,GACnB,OAAO,YAAY,KAAK,eAAe,IAAI,CAAC,EAC5C,KAAK,qBAAO,S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B,SAAS,kBAAkB,QAAQ,gCAAgC,OAAO;AAAA,QAC1E;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO,UAAU,SAAS,QAAQ,QAAQ,QAAQ;AAElD,SAAO,OAAO,SAAS,MAAM,QAA+B,aAAa;AAC3E,CAAC;AASM,IAAM,cAAc,uBAAO,GAAG,aAAa,EAAE,WAAW,UAAkB,eAAuB;AACtG,QAAM,cAAgC,OAAO,eAAe,UAAU,aAAa;AACnF,SAAO,OAAO,kBAAkB,aAAa,aAAa;AAC5D,CAAC;AAYM,IAAM,oBAAoB,uBAAO,GAAG,mBAAmB,EAAE,WAC9D,QACA,eACA;AACA,QAAM,eAAe,OAAO;AAC5B,MAAI,SAAS,OAAO,aAAa,MAAM,QAAQ,aAAa;AAG5D,MAAI,OAAO,YAAY,WAAW,MAAM,OAAO,QAAQ,OAAO,UAAU,OAAO,KAAK,OAAO,OAAO,WAAW,GAAG;AAC9G,WAAO,OAAO;AAAA,MACZ;AAAA,IACF;AAAA,EACF,WAAW,OAAO,YAAY,WAAW,MAAM,OAAO,QAAQ,OAAO,UAAU,OAAO,GAAG;AACvF,WAAO,SAAS,KAAK,sEAAsE;AAAA,EAC7F;AAEA,WAAS,0BAA0B,MAAM;AAEzC,SAAO;AACT,CAAC;;;AU/FD,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;AAetB,IAAM,aAAa,sBAAM,SAAS,gBAAgB,SAAS,gBAAgB,SAAS,eAAe,OAAO;AAEnG,IAAM,oBAAoB,wBAAwB,QAAQ,KAAK,sBAAM,aAAa,UAAU,CAAC;","names":["import_platform","import_effect","import_platform","import_effect","outputPath","import_platform","import_effect","import_platform","import_effect","isRecord","import_platform","import_effect","import_effect","import_platform","import_effect","import_effect","import_effect","import_effect","path","import_effect","import_platform","import_effect","parseYaml","import_effect","Ajv","addFormats","import_platform","import_effect","path","safeRegex","import_platform","import_build_utils","import_effect","path","import_effect"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/detection/detect-framework.ts","../src/detection/detect-package-manager.ts","../src/detection/frameworks/astro.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-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/schema-validator.ts","../src/services/v4-config-parser.ts","../src/services/vercel-build-output-parser.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 './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';\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 type { FrameworkDefinition } from '../types';\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};\n","import type { FrameworkDefinition } from '../types';\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};\n","import type { FrameworkDefinition } from '../types';\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};\n","import type { FrameworkDefinition } from '../types';\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};\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 {\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 * Upper bound on the prerendered paths exported for CDN warming. Warming only\n * needs a representative sample; carrying the full table is what produced the\n * multi-megabyte gateway configuration this list replaces.\n */\nconst MAXIMUM_ENTRY_PAGE_PATHS = 50;\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 // Prerender shells are NOT published as assets here. The single standalone\n // server already ships every build-time prerender inside its own bundle\n // (`writeStandaloneDirectory` recursively copies `.next/server/{app,pages}`)\n // and the cache handler reads them from there, so uploading a second copy\n // produced one object + one asset row per prerendered output — tens of\n // thousands for a large content site — that nothing ever read.\n //\n // A bounded, representative sample of prerendered paths is still exported so\n // the platform can warm the CDN without carrying the full output table.\n const entryPagePaths = [\n ...new Set(\n manifest.outputs.prerenders\n .filter((output) => !output.fallback?.postponedState)\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: defaults.memory,\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 // The prerender table is deliberately not forwarded: the standalone server\n // serves build-time prerenders from its own bundle, so the platform only\n // needs the warming sample below.\n outputs: { prerenders: [], staticAssets: manifest.outputs.staticAssets },\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 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","import type { NormalizedImagePolicy } from './image-policy';\n\n/** JSON values accepted in the portable Next.js adapter manifest. */\nexport type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };\n\nexport interface GigadriveNextPrerenderOutput {\n id: string;\n type: 'PRERENDER';\n pathname: string;\n parentOutputId: string;\n groupId: number;\n pprChain?: { headers: Record<string, string> };\n parentFallbackMode?: JsonValue;\n fallback?: {\n filePath?: string;\n initialStatus?: number;\n initialHeaders?: Record<string, string | string[]>;\n initialExpiration?: number;\n initialRevalidate?: number | false;\n postponedState?: string;\n };\n config: {\n allowQuery?: string[];\n allowHeader?: string[];\n bypassFor?: JsonValue[];\n renderingMode?: string;\n partialFallback?: boolean;\n bypassToken?: string;\n };\n}\n\n/**\n * A directory subtree published under a single URL prefix, registered as one\n * descriptor instead of enumerating every file. Used to collapse `.next/static`\n * (thousands of content-hashed chunks) into a single edge-served prefix.\n */\nexport interface GigadriveNextStaticAssetPrefix {\n /** Project-relative source directory (e.g. `.next/static`). */\n sourceDir: string;\n /** Public URL prefix the subtree is served under (e.g. `_next/static`). */\n urlPrefix: string;\n /** Entries are content-hashed and safe to serve with immutable cache-control. */\n immutable: boolean;\n}\n\nexport interface GigadriveNextBuildManifestV1 {\n version: 1;\n output: 'standalone' | 'export';\n distDir: string;\n repoRootToProject: string;\n nextVersion: string;\n buildId: string;\n}\n\n/** Aggregated runtime configuration collapsed onto the single standalone server. */\nexport interface GigadriveNextServerDescriptor {\n maxDuration?: number;\n preferredRegion?: string | string[];\n env?: Record<string, string>;\n}\n\n/**\n * Portable runtime plan for the single standalone Next.js server (Next >= 16.2).\n *\n * The whole deployment runs as one `next start` standalone server, so the plan\n * carries only what the platform needs to route around it: prerender/ISR/PPR\n * seeds, the `.next/static` prefix, and the routing/image configuration. It\n * deliberately omits per-route outputs and entrypoints — the server owns\n * routing, middleware, edge routes, and PPR resume in-process.\n */\nexport interface GigadriveNextBuildManifestV2Standalone {\n version: 2;\n mode: 'standalone-v2';\n distDir: string;\n repoRootToProject: string;\n nextVersion: string;\n buildId: string;\n server: GigadriveNextServerDescriptor;\n config: {\n basePath: string;\n trailingSlash: boolean;\n cacheComponents: boolean;\n i18n?: JsonValue;\n images?: NormalizedImagePolicy;\n };\n routing: {\n beforeMiddleware: JsonValue[];\n beforeFiles: JsonValue[];\n afterFiles: JsonValue[];\n dynamicRoutes: JsonValue[];\n onMatch: JsonValue[];\n fallback: JsonValue[];\n shouldNormalizeNextData: boolean;\n rsc: JsonValue;\n };\n outputs: {\n prerenders: GigadriveNextPrerenderOutput[];\n staticAssets: GigadriveNextStaticAssetPrefix[];\n };\n}\n\n/** Minimal plan for static-export builds (Next >= 16.2). */\nexport interface GigadriveNextBuildManifestV2Export {\n version: 2;\n mode: 'export';\n distDir: string;\n repoRootToProject: string;\n nextVersion: string;\n buildId: string;\n}\n\nexport type GigadriveNextBuildManifestV2 = GigadriveNextBuildManifestV2Standalone | GigadriveNextBuildManifestV2Export;\n\nexport type GigadriveNextBuildManifest = GigadriveNextBuildManifestV1 | GigadriveNextBuildManifestV2;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null;\n\nconst isPortableRelativePath = (value: unknown, allowCurrentDirectory = false): value is string => {\n if (typeof value !== 'string') return false;\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('/').some((segment) => segment === '..')\n );\n};\n\nconst isStringRecord = (value: unknown): value is Record<string, string> =>\n isRecord(value) && Object.values(value).every((item) => typeof item === 'string');\n\nconst isJsonValue = (value: unknown): value is JsonValue => {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (Array.isArray(value)) return value.every(isJsonValue);\n return isRecord(value) && Object.values(value).every(isJsonValue);\n};\n\nconst isPrerenderOutput = (value: unknown): value is GigadriveNextPrerenderOutput =>\n isRecord(value) &&\n value.type === 'PRERENDER' &&\n typeof value.id === 'string' &&\n typeof value.pathname === 'string' &&\n typeof value.parentOutputId === 'string' &&\n typeof value.groupId === 'number' &&\n isRecord(value.config) &&\n (value.fallback === undefined ||\n (isRecord(value.fallback) &&\n (value.fallback.filePath === undefined || isPortableRelativePath(value.fallback.filePath))));\n\nconst isStaticAssetPrefix = (value: unknown): value is GigadriveNextStaticAssetPrefix =>\n isRecord(value) &&\n isPortableRelativePath(value.sourceDir) &&\n isPortableRelativePath(value.urlPrefix) &&\n typeof value.immutable === 'boolean';\n\nconst isServerDescriptor = (value: unknown): value is GigadriveNextServerDescriptor =>\n isRecord(value) &&\n (value.maxDuration === undefined || typeof value.maxDuration === 'number') &&\n (value.preferredRegion === undefined ||\n typeof value.preferredRegion === 'string' ||\n (Array.isArray(value.preferredRegion) && value.preferredRegion.every((region) => typeof region === 'string'))) &&\n (value.env === undefined || isStringRecord(value.env));\n\nconst isImagePolicy = (value: unknown): value is NormalizedImagePolicy =>\n isRecord(value) &&\n Array.isArray(value.localPatterns) &&\n Array.isArray(value.remotePatterns) &&\n value.remotePatterns.every((pattern) => isRecord(pattern) && typeof pattern.hostname === 'string') &&\n Array.isArray(value.widths) &&\n value.widths.every((item) => typeof item === 'number' && Number.isInteger(item) && item > 0) &&\n Array.isArray(value.heights) &&\n value.heights.every((item) => typeof item === 'number' && Number.isInteger(item) && item > 0) &&\n Array.isArray(value.qualities) &&\n value.qualities.every((item) => typeof item === 'number' && item >= 1 && item <= 100) &&\n Array.isArray(value.formats) &&\n value.formats.every((item) => ['image/avif', 'image/webp', 'image/jpeg', 'image/png'].includes(String(item))) &&\n typeof value.minimumCacheTTL === 'number' &&\n typeof value.dangerouslyAllowSVG === 'boolean' &&\n typeof value.contentSecurityPolicy === 'string' &&\n (value.contentDispositionType === 'inline' || value.contentDispositionType === 'attachment') &&\n typeof value.maximumRedirects === 'number' &&\n typeof value.maximumResponseBody === 'number' &&\n isRecord(value.variants);\n\n/** Parses and structurally validates adapter metadata before deployment code consumes it. */\nexport const parseGigadriveNextBuildManifest = (content: string): GigadriveNextBuildManifest | undefined => {\n try {\n const value: unknown = JSON.parse(content);\n if (!isRecord(value)) return undefined;\n\n if (value.version === 1) {\n if (\n (value.output !== 'standalone' && value.output !== 'export') ||\n !isPortableRelativePath(value.distDir) ||\n !isPortableRelativePath(value.repoRootToProject, true) ||\n typeof value.nextVersion !== 'string' ||\n typeof value.buildId !== 'string'\n ) {\n return undefined;\n }\n return value as unknown as GigadriveNextBuildManifestV1;\n }\n\n if (value.version === 2) {\n if (\n !isPortableRelativePath(value.distDir) ||\n !isPortableRelativePath(value.repoRootToProject, true) ||\n typeof value.nextVersion !== 'string' ||\n typeof value.buildId !== 'string'\n ) {\n return undefined;\n }\n\n if (value.mode === 'export') {\n return value as unknown as GigadriveNextBuildManifestV2Export;\n }\n\n if (value.mode === 'standalone-v2') {\n if (\n !isServerDescriptor(value.server) ||\n !isRecord(value.config) ||\n typeof value.config.basePath !== 'string' ||\n typeof value.config.trailingSlash !== 'boolean' ||\n typeof value.config.cacheComponents !== 'boolean' ||\n (value.config.images !== undefined && !isImagePolicy(value.config.images)) ||\n !isRecord(value.routing) ||\n !isJsonValue(value.routing) ||\n !isRecord(value.outputs) ||\n !Array.isArray(value.outputs.prerenders) ||\n !value.outputs.prerenders.every(isPrerenderOutput) ||\n !Array.isArray(value.outputs.staticAssets) ||\n !value.outputs.staticAssets.every(isStaticAssetPrefix)\n ) {\n return undefined;\n }\n return value as unknown as GigadriveNextBuildManifestV2Standalone;\n }\n\n // Legacy `mode: 'adapter-v2'` (per-route split) is no longer produced or consumed.\n return undefined;\n }\n\n return undefined;\n } catch {\n return undefined;\n }\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 } 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) {\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 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 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 defined with paths, 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 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: userConfig.assets?.paths && userConfig.assets.paths.length > 0 ? 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 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 * 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 services?: Array<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\nexport type NormalizedConfigServiceType = 'redis' | 'postgres';\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 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 envBindings?: Record<'url' | 'host' | 'port' | 'user' | 'password' | 'database', string>;\n postgresVersion?: '17' | '16' | '15' | '14';\n region?: NeonAWSRegion;\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'> & {\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\n // Stricter check first: no functions, no assets, AND no routes → error\n if (result.entrypoints.length === 0 && (result.assets?.paths?.length || 0) === 0 && 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 && (result.assets?.paths?.length || 0) === 0) {\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';\n\nexport const ALLOWED_CONFIG_NAMES = [\n 'gigadrive.yaml',\n 'gigadrive.yml',\n 'nebula.yaml',\n 'nebula.yml',\n 'nebula.json',\n] as const;\n\nexport class RawConfigReader extends Effect.Service<RawConfigReader>()('RawConfigReader', {\n effect: Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const pathService = yield* Path.Path;\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 *\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 try {\n if (fileExtension === '.json') {\n parsed = JSON.parse(fileContents) as Record<string, unknown>;\n } else if (['.yml', '.yaml'].includes(fileExtension)) {\n parsed = parseYaml(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 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 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 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\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 entrypoints,\n errors: [],\n warnings: [],\n routes: (config.routes ?? []).map((route) => mapRoute(route, entrypoints)),\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","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[ ]+(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|JU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(?: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\": \"Optionally, specify additional services like databases to deploy.\",\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 }\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 { 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 { 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(RawConfigReader.Default, SchemaValidator.Default, V4ConfigParser.Default);\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;;;ACAA,IAAAA,mBAAiC;AACjC,IAAAC,iBAAuB;;;ACDvB,sBAAiC;AACjC,oBAAuB;AAMvB,IAAM,eAA+D;AAAA,EACnE,EAAE,OAAO,CAAC,aAAa,UAAU,GAAG,IAAI,MAAM;AAAA,EAC9C,EAAE,OAAO,CAAC,gBAAgB,GAAG,IAAI,OAAO;AAAA,EACxC,EAAE,OAAO,CAAC,WAAW,GAAG,IAAI,OAAO;AAAA,EACnC,EAAE,OAAO,CAAC,mBAAmB,GAAG,IAAI,MAAM;AAAA,EAC1C,EAAE,OAAO,CAAC,eAAe,GAAG,IAAI,WAAW;AAC7C;AASO,IAAM,uBAAuB,qBAAO,GAAG,sBAAsB,EAAE,WAAW,eAAuB;AACtG,QAAM,KAAK,OAAO,2BAAW;AAC7B,QAAM,cAA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MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO,UAAU,SAAS,QAAQ,QAAQ,QAAQ;AAElD,SAAO,OAAO,SAAS,MAAM,QAA+B,aAAa;AAC3E,CAAC;AASM,IAAM,cAAc,uBAAO,GAAG,aAAa,EAAE,WAAW,UAAkB,eAAuB;AACtG,QAAM,cAAgC,OAAO,eAAe,UAAU,aAAa;AACnF,SAAO,OAAO,kBAAkB,aAAa,aAAa;AAC5D,CAAC;AAYM,IAAM,oBAAoB,uBAAO,GAAG,mBAAmB,EAAE,WAC9D,QACA,eACA;AACA,QAAM,eAAe,OAAO;AAC5B,MAAI,SAAS,OAAO,aAAa,MAAM,QAAQ,aAAa;AAG5D,MAAI,OAAO,YAAY,WAAW,MAAM,OAAO,QAAQ,OAAO,UAAU,OAAO,KAAK,OAAO,OAAO,WAAW,GAAG;AAC9G,WAAO,OAAO;AAAA,MACZ;AAAA,IACF;AAAA,EACF,WAAW,OAAO,YAAY,WAAW,MAAM,OAAO,QAAQ,OAAO,UAAU,OAAO,GAAG;AACvF,WAAO,SAAS,KAAK,sEAAsE;AAAA,EAC7F;AAEA,WAAS,0BAA0B,MAAM;AAEzC,SAAO;AACT,CAAC;;;AU/FD,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;AAetB,IAAM,aAAa,sBAAM,SAAS,gBAAgB,SAAS,gBAAgB,SAAS,eAAe,OAAO;AAEnG,IAAM,oBAAoB,wBAAwB,QAAQ,KAAK,sBAAM,aAAa,UAAU,CAAC;","names":["import_platform","import_effect","import_platform","import_effect","outputPath","import_platform","import_effect","import_platform","import_effect","isRecord","import_platform","import_effect","import_effect","import_platform","import_effect","import_effect","import_effect","import_effect","path","import_effect","import_platform","import_effect","parseYaml","import_effect","Ajv","addFormats","import_platform","import_effect","path","safeRegex","import_platform","import_build_utils","import_effect","path","import_effect"]}