@gigadrive/network-config 3.4.12 → 3.4.13
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/nextjs-adapter.js
CHANGED
|
@@ -238,7 +238,8 @@ ${imports}
|
|
|
238
238
|
})() : `import * as nextEntrypoint from ${JSON.stringify(importSpecifier)};
|
|
239
239
|
|
|
240
240
|
const resolveHandler = async () => {
|
|
241
|
-
const
|
|
241
|
+
const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);
|
|
242
|
+
const handler = nextEntrypoint.handler ?? loadedEntrypoint?.handler ?? loadedEntrypoint?.default?.handler ?? loadedEntrypoint?.default ?? loadedEntrypoint;
|
|
242
243
|
if (typeof handler !== 'function') throw new Error('Next.js middleware handler is unavailable');
|
|
243
244
|
return handler;
|
|
244
245
|
};`;
|
|
@@ -272,10 +273,16 @@ export async function fetch(request) {
|
|
|
272
273
|
import * as nextEntrypoint from ${JSON.stringify(importSpecifier)};
|
|
273
274
|
import { persistPprCacheEntry, revalidateNextPath } from ${JSON.stringify(pprRuntimeSpecifier)};
|
|
274
275
|
|
|
276
|
+
const resolveHandler = async () => {
|
|
277
|
+
const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);
|
|
278
|
+
const handler = nextEntrypoint.handler ?? loadedEntrypoint?.handler ?? loadedEntrypoint?.default?.handler ?? loadedEntrypoint?.default ?? loadedEntrypoint;
|
|
279
|
+
if (typeof handler !== 'function') throw new Error('Next.js Node handler is unavailable');
|
|
280
|
+
return handler;
|
|
281
|
+
};
|
|
282
|
+
|
|
275
283
|
export default async function handler(req, res) {
|
|
276
284
|
const pending = [];
|
|
277
|
-
const nextHandler =
|
|
278
|
-
if (typeof nextHandler !== 'function') throw new Error('Next.js Node handler is unavailable');
|
|
285
|
+
const nextHandler = await resolveHandler();
|
|
279
286
|
const hostname = Array.isArray(req.headers.host) ? req.headers.host[0] : req.headers.host;
|
|
280
287
|
await nextHandler(req, res, {
|
|
281
288
|
waitUntil(promise) { pending.push(Promise.resolve(promise)); },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/nextjs-adapter.ts"],"sourcesContent":["import type { NextAdapter } from 'next';\nimport { access, mkdir, realpath, stat, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { NormalizedImagePolicy } from './image-policy';\nimport type {\n GigadriveNextBuildManifestV1,\n GigadriveNextBuildManifestV2,\n GigadriveNextEntrypoint,\n GigadriveNextRouteOutput,\n GigadriveNextStaticOutput,\n JsonValue,\n} from './nextjs-manifest';\n\ntype BuildCompleteContext = Parameters<NonNullable<NextAdapter['onBuildComplete']>>[0];\ntype NextRouteOutput =\n | BuildCompleteContext['outputs']['pages'][number]\n | BuildCompleteContext['outputs']['pagesApi'][number]\n | BuildCompleteContext['outputs']['appPages'][number]\n | BuildCompleteContext['outputs']['appRoutes'][number]\n | NonNullable<BuildCompleteContext['outputs']['middleware']>;\ntype NextStaticOutput = BuildCompleteContext['outputs']['staticFiles'][number];\n\nconst PRODUCTION_BUILD_PHASE = 'phase-production-build';\nconst runtimeDirectory = typeof __dirname === 'string' ? __dirname : path.dirname(fileURLToPath(import.meta.url));\n\nconst runtimeModulePath = (environmentName: string, fileName: string): string =>\n process.env[environmentName] ?? path.join(runtimeDirectory, fileName);\n\nconst CACHE_HANDLER_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_CACHE_HANDLER_PATH', 'nextjs-cache-handler.js');\nconst CACHE_COMPONENTS_HANDLER_PATH = () =>\n runtimeModulePath('GIGADRIVE_NEXT_CACHE_COMPONENTS_HANDLER_PATH', 'nextjs-cache-components-handler.js');\nconst IMAGE_LOADER_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_IMAGE_LOADER_PATH', 'nextjs-image-loader.js');\nconst PPR_RUNTIME_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_PPR_RUNTIME_PATH', 'nextjs-ppr-runtime.js');\n\nconst toJsonValue = (value: unknown): JsonValue => {\n const serialized = JSON.stringify(value);\n return serialized === undefined ? null : (JSON.parse(serialized) as JsonValue);\n};\n\nconst supportsAdapterV2 = (nextVersion: string | undefined): boolean => {\n if (!nextVersion) return false;\n const [majorPart, minorPart] = nextVersion.split('.');\n const major = Number.parseInt(majorPart ?? '', 10);\n const minor = Number.parseInt(minorPart ?? '', 10);\n return Number.isFinite(major) && Number.isFinite(minor) && (major > 16 || (major === 16 && minor >= 2));\n};\n\nconst toPortableRelativePath = (from: string, to: string, allowCurrentDirectory = false): string => {\n const resolvedFrom = path.resolve(from);\n const resolvedTo = path.resolve(path.isAbsolute(to) ? to : path.join(from, to));\n const relativePath = path.relative(resolvedFrom, resolvedTo).replaceAll(path.sep, '/');\n const normalized = relativePath === '' ? '.' : relativePath;\n if (\n (!allowCurrentDirectory && normalized === '.') ||\n normalized.startsWith('/') ||\n /^[A-Za-z]:/.test(normalized) ||\n normalized.split('/').some((segment) => segment === '..')\n ) {\n throw new Error(`Next.js adapter output is outside the repository root: ${to}`);\n }\n return normalized;\n};\n\nasync function resolveReadablePath(repoRoot: string, filePath: string) {\n const absolutePath = path.resolve(path.isAbsolute(filePath) ? filePath : path.join(repoRoot, filePath));\n const portablePath = toPortableRelativePath(repoRoot, absolutePath);\n await access(absolutePath);\n const resolvedPath = await realpath(absolutePath);\n toPortableRelativePath(repoRoot, resolvedPath);\n const fileStat = await stat(absolutePath);\n return { portablePath, fileStat };\n}\n\nasync function requireReadableFile(repoRoot: string, filePath: string): Promise<string> {\n const { portablePath, fileStat } = await resolveReadablePath(repoRoot, filePath);\n if (!fileStat.isFile()) throw new Error(`Next.js adapter output is not a readable file: ${filePath}`);\n return portablePath;\n}\n\nasync function requireReadableAsset(repoRoot: string, filePath: string): Promise<string> {\n const { portablePath, fileStat } = await resolveReadablePath(repoRoot, filePath);\n if (!fileStat.isFile() && !fileStat.isDirectory()) {\n throw new Error(`Next.js adapter asset is not a readable file or directory: ${filePath}`);\n }\n return portablePath;\n}\n\nasync function serializeFileMap(repoRoot: string, files: Record<string, string>): Promise<Record<string, string>> {\n const entries = await Promise.all(\n Object.entries(files).map(async ([targetPath, sourcePath]) => [\n toPortableRelativePath(repoRoot, targetPath),\n await requireReadableAsset(repoRoot, sourcePath),\n ])\n );\n return Object.fromEntries(entries);\n}\n\nconst serializeRuntimeConfigAssets = async (\n projectDir: string,\n repoRoot: string,\n config: BuildCompleteContext['config']\n): Promise<Record<string, string>> => {\n const configuredPaths = new Set([\n config.cacheHandler,\n ...Object.values(config.cacheHandlers ?? {}),\n config.images.loaderFile,\n PPR_RUNTIME_PATH(),\n ]);\n const assets: Record<string, string> = {};\n for (const configuredPath of configuredPaths) {\n if (!configuredPath) continue;\n const absolutePath = path.resolve(\n path.isAbsolute(configuredPath) ? configuredPath : path.join(projectDir, configuredPath)\n );\n const portablePath = await requireReadableFile(repoRoot, absolutePath);\n assets[portablePath] = portablePath;\n }\n return assets;\n};\n\nconst serializeRouteOutput = async (repoRoot: string, output: NextRouteOutput): Promise<GigadriveNextRouteOutput> => {\n const matchers = (\n output.config as typeof output.config & {\n matchers?: Array<{\n source: string;\n sourceRegex: string;\n has?: unknown[];\n missing?: unknown[];\n }>;\n }\n ).matchers;\n return {\n id: output.id,\n type: String(output.type) as GigadriveNextRouteOutput['type'],\n filePath: await requireReadableFile(repoRoot, output.filePath),\n pathname: output.pathname,\n sourcePage: output.sourcePage,\n runtime: output.runtime,\n assets: await serializeFileMap(repoRoot, output.assets),\n ...(output.wasmAssets ? { wasmAssets: await serializeFileMap(repoRoot, output.wasmAssets) } : {}),\n ...(output.edgeRuntime\n ? {\n edgeRuntime: {\n modulePath: await requireReadableFile(repoRoot, output.edgeRuntime.modulePath),\n entryKey: output.edgeRuntime.entryKey,\n handlerExport: output.edgeRuntime.handlerExport,\n },\n }\n : {}),\n config: {\n maxDuration: output.config.maxDuration,\n preferredRegion: output.config.preferredRegion,\n env: output.config.env,\n ...(matchers\n ? {\n matchers: matchers.map((matcher) => ({\n source: matcher.source,\n sourceRegex: matcher.sourceRegex,\n ...(matcher.has ? { has: toJsonValue(matcher.has) as JsonValue[] } : {}),\n ...(matcher.missing ? { missing: toJsonValue(matcher.missing) as JsonValue[] } : {}),\n })),\n }\n : {}),\n },\n };\n};\n\nconst serializeStaticOutput = async (\n repoRoot: string,\n output: NextStaticOutput\n): Promise<GigadriveNextStaticOutput> => ({\n id: output.id,\n type: 'STATIC_FILE',\n filePath: await requireReadableFile(repoRoot, output.filePath),\n pathname: output.pathname,\n ...(output.immutableHash ? { immutableHash: output.immutableHash } : {}),\n});\n\nconst buildEntrypointPlan = (\n outputs: GigadriveNextRouteOutput[]\n): Pick<GigadriveNextBuildManifestV2, 'entrypoints' | 'outputEntrypoints'> => {\n const byIdentity = new Map<string, GigadriveNextEntrypoint>();\n const outputEntrypoints: Record<string, string> = {};\n\n for (const output of outputs) {\n const identity = JSON.stringify([\n output.type === 'MIDDLEWARE' ? 'middleware-web' : 'route',\n output.runtime,\n output.filePath,\n output.edgeRuntime?.modulePath,\n output.edgeRuntime?.entryKey,\n output.edgeRuntime?.handlerExport,\n ]);\n const existingEntrypoint = byIdentity.get(identity);\n const entrypoint: GigadriveNextEntrypoint = existingEntrypoint ?? {\n id: `next-${byIdentity.size}`,\n runtime: output.runtime,\n filePath: output.filePath,\n outputIds: [],\n assets: { ...output.assets },\n ...(output.wasmAssets ? { wasmAssets: { ...output.wasmAssets } } : {}),\n ...(output.edgeRuntime ? { edgeRuntime: { ...output.edgeRuntime } } : {}),\n config: {\n maxDuration: output.config.maxDuration,\n preferredRegion: output.config.preferredRegion,\n env: output.config.env,\n },\n };\n if (!existingEntrypoint) {\n byIdentity.set(identity, entrypoint);\n } else {\n Object.assign(entrypoint.assets, output.assets);\n if (output.wasmAssets) entrypoint.wasmAssets = { ...entrypoint.wasmAssets, ...output.wasmAssets };\n if (output.config.maxDuration !== undefined) {\n entrypoint.config.maxDuration = Math.max(entrypoint.config.maxDuration ?? 0, output.config.maxDuration);\n }\n }\n entrypoint.outputIds.push(output.id);\n outputEntrypoints[output.id] = entrypoint.id;\n }\n\n return { entrypoints: [...byIdentity.values()], outputEntrypoints };\n};\n\nconst writeEntrypointWrappers = async (\n projectDir: string,\n repoRoot: string,\n entrypoints: GigadriveNextEntrypoint[],\n pprRuntimePath: string,\n middlewareOutputId?: string\n): Promise<void> => {\n const wrapperDirectory = path.join(projectDir, '.gigadrive', 'nextjs', 'entrypoints');\n await mkdir(wrapperDirectory, { recursive: true });\n const portableWrapperDirectory = toPortableRelativePath(repoRoot, wrapperDirectory);\n const relativePprRuntimePath = path.posix.relative(portableWrapperDirectory, pprRuntimePath);\n const pprRuntimeSpecifier = relativePprRuntimePath.startsWith('.')\n ? relativePprRuntimePath\n : `./${relativePprRuntimePath}`;\n\n await Promise.all(\n entrypoints.map(async (entrypoint) => {\n const wrapperPath = path.join(wrapperDirectory, `${entrypoint.id}.mjs`);\n const executablePath = path.join(repoRoot, entrypoint.edgeRuntime?.modulePath ?? entrypoint.filePath);\n const relativeImport = path.relative(wrapperDirectory, executablePath).replaceAll(path.sep, '/');\n const importSpecifier = relativeImport.startsWith('.') ? relativeImport : `./${relativeImport}`;\n const isMiddleware = middlewareOutputId !== undefined && entrypoint.outputIds.includes(middlewareOutputId);\n const webHandlerPrelude =\n entrypoint.runtime === 'edge' && entrypoint.edgeRuntime\n ? (() => {\n const edgeMarker = '/server/edge/';\n const markerIndex = entrypoint.edgeRuntime.modulePath.indexOf(edgeMarker);\n const distDirectory =\n markerIndex >= 0\n ? entrypoint.edgeRuntime.modulePath.slice(0, markerIndex)\n : path.dirname(entrypoint.edgeRuntime.modulePath);\n const edgeRuntimeAssets = Object.entries(entrypoint.assets)\n .filter(([, sourcePath]) => sourcePath.startsWith(`${distDirectory}/`) && sourcePath.endsWith('.js'))\n .sort(([, leftSource], [, rightSource]) => {\n if (leftSource === entrypoint.edgeRuntime?.modulePath) return 1;\n if (rightSource === entrypoint.edgeRuntime?.modulePath) return -1;\n return leftSource.localeCompare(rightSource);\n });\n const imports = edgeRuntimeAssets\n .map(([targetPath, sourcePath]) => {\n // Next includes the executable Edge module in `assets` under a\n // deployment-relative target such as `server/edge/chunks/*`,\n // while `modulePath` retains its canonical `.next/server/*`\n // location. Function packaging installs the executable at the\n // canonical path, so the wrapper must import it there as well.\n const runtimeTargetPath =\n sourcePath === entrypoint.edgeRuntime?.modulePath ? entrypoint.edgeRuntime.modulePath : targetPath;\n const relativeAssetPath = path.posix.relative(portableWrapperDirectory, runtimeTargetPath);\n const assetSpecifier = relativeAssetPath.startsWith('.')\n ? relativeAssetPath\n : `./${relativeAssetPath}`;\n return ` await import(${JSON.stringify(assetSpecifier)});`;\n })\n .join('\\n');\n return `import { AsyncLocalStorage } from \"node:async_hooks\";\\n\\nconst resolveHandler = async () => {\\n globalThis.self ??= globalThis;\\n globalThis.AsyncLocalStorage ??= AsyncLocalStorage;\\n${imports}\\n const registry = globalThis._ENTRIES;\\n if (!registry) throw new Error('Next.js edge entry registry is unavailable');\\n const entry = await registry[${JSON.stringify(entrypoint.edgeRuntime.entryKey)}];\\n const handler = entry?.[${JSON.stringify(entrypoint.edgeRuntime.handlerExport)}];\\n if (typeof handler !== 'function') throw new Error('Next.js edge handler is unavailable');\\n return handler;\\n};`;\n })()\n : `import * as nextEntrypoint from ${JSON.stringify(importSpecifier)};\\n\\nconst resolveHandler = async () => {\\n const handler = nextEntrypoint.handler ?? nextEntrypoint.default?.handler ?? nextEntrypoint.default;\\n if (typeof handler !== 'function') throw new Error('Next.js middleware handler is unavailable');\\n return handler;\\n};`;\n const source =\n (entrypoint.runtime === 'edge' && entrypoint.edgeRuntime) || isMiddleware\n ? `import { persistPprCacheEntry } from ${JSON.stringify(pprRuntimeSpecifier)};\\n${webHandlerPrelude}\\n\\nexport async function fetch(request) {\\n const pending = [];\\n const handler = await resolveHandler();\\n const url = new URL(request.url);\\n const response = await handler(request, {\\n signal: request.signal,\\n waitUntil(promise) { pending.push(Promise.resolve(promise)); },\\n requestMeta: { hostname: url.hostname, invocationTarget: request.headers.get('x-gigadrive-next-invocation-target') ?? url.pathname, routeMatches: Object.fromEntries(new URLSearchParams(request.headers.get('x-now-route-matches') ?? '')), relativeProjectDir: ${JSON.stringify(\n toPortableRelativePath(repoRoot, projectDir, true)\n )}, onCacheEntryV2(cacheEntry, meta) { pending.push(persistPprCacheEntry(request.headers.get('x-gigadrive-next-cache-key') ?? meta.url ?? request.headers.get('x-matched-path') ?? url.pathname, cacheEntry)); return false; } },\\n });\\n if (!response.body) { await Promise.allSettled(pending); return response; }\\n const reader = response.body.getReader();\\n const body = new ReadableStream({\\n async pull(controller) {\\n const result = await reader.read();\\n if (result.done) { await Promise.allSettled(pending); controller.close(); return; }\\n controller.enqueue(result.value);\\n },\\n async cancel(reason) { try { await reader.cancel(reason); } finally { await Promise.allSettled(pending); } },\\n });\\n return new Response(body, response);\\n}\\n`\n : `import \"next/dist/build/adapter/setup-node-env.external.js\";\\nimport * as nextEntrypoint from ${JSON.stringify(importSpecifier)};\\nimport { persistPprCacheEntry, revalidateNextPath } from ${JSON.stringify(pprRuntimeSpecifier)};\\n\\nexport default async function handler(req, res) {\\n const pending = [];\\n const nextHandler = nextEntrypoint.handler ?? nextEntrypoint.default?.handler ?? nextEntrypoint.default;\\n if (typeof nextHandler !== 'function') throw new Error('Next.js Node handler is unavailable');\\n const hostname = Array.isArray(req.headers.host) ? req.headers.host[0] : req.headers.host;\\n await nextHandler(req, res, {\\n waitUntil(promise) { pending.push(Promise.resolve(promise)); },\\n requestMeta: { hostname, invocationTarget: req.headers['x-gigadrive-next-invocation-target'] ?? req.url, routeMatches: Object.fromEntries(new URLSearchParams(req.headers['x-now-route-matches'] ?? '')), relativeProjectDir: ${JSON.stringify(\n toPortableRelativePath(repoRoot, projectDir, true)\n )}, revalidate(input) { return revalidateNextPath({ ...input, hostname }); }, onCacheEntryV2(cacheEntry, meta) { const cacheKey = req.headers['x-gigadrive-next-cache-key']; const matchedPath = req.headers['x-matched-path']; pending.push(persistPprCacheEntry((Array.isArray(cacheKey) ? cacheKey[0] : cacheKey) ?? meta.url ?? (Array.isArray(matchedPath) ? matchedPath[0] : matchedPath) ?? req.url ?? '/', cacheEntry)); return false; } },\\n });\\n await Promise.allSettled(pending);\\n}\\n`;\n await writeFile(wrapperPath, source, 'utf8');\n const portableWrapperPath = toPortableRelativePath(repoRoot, wrapperPath);\n entrypoint.assets[portableWrapperPath] = portableWrapperPath;\n entrypoint.filePath = portableWrapperPath;\n })\n );\n};\n\nconst normalizeImages = (config: BuildCompleteContext['config']): NormalizedImagePolicy | undefined => {\n if (config.images.unoptimized) return undefined;\n return {\n localPatterns: config.images.localPatterns ?? [{ pathname: '/**' }],\n remotePatterns: config.images.remotePatterns.map((pattern) => {\n if (pattern instanceof URL) {\n return {\n protocol: pattern.protocol === 'http:' ? ('http' as const) : ('https' as const),\n hostname: pattern.hostname,\n port: pattern.port,\n pathname: pattern.pathname,\n search: pattern.search,\n };\n }\n return { ...pattern };\n }),\n widths: [...new Set([...config.images.deviceSizes, ...config.images.imageSizes])].sort((a, b) => a - b),\n heights: [],\n qualities: config.images.qualities ?? [75],\n formats: config.images.formats,\n minimumCacheTTL: config.images.minimumCacheTTL,\n dangerouslyAllowSVG: config.images.dangerouslyAllowSVG,\n contentSecurityPolicy: config.images.contentSecurityPolicy,\n contentDispositionType: config.images.contentDispositionType,\n maximumRedirects: config.images.maximumRedirects,\n maximumResponseBody: config.images.maximumResponseBody,\n variants: {},\n };\n};\n\n/**\n * Next.js deployment adapter used automatically by Gigadrive Network build workers.\n *\n * Next 16.2 and newer emit a portable, versioned runtime plan. Older releases retain\n * the standalone-server behavior because their experimental adapter context does not\n * expose the routing and runtime metadata required by the v2 contract.\n */\nconst gigadriveNextAdapter: NextAdapter = {\n name: 'Gigadrive Network',\n\n modifyConfig(config, { phase, nextVersion }) {\n if (phase !== PRODUCTION_BUILD_PHASE) return config;\n\n const deploymentId = config.deploymentId ?? process.env.GIGADRIVE_DEPLOYMENT_ID;\n if (!supportsAdapterV2(nextVersion)) {\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n output: config.output === 'export' ? 'export' : 'standalone',\n };\n }\n if (config.output === 'export') {\n return { ...config, ...(deploymentId ? { deploymentId } : {}) };\n }\n\n const injectCacheHandler = config.cacheHandler === undefined;\n const injectCacheComponentHandlers = config.cacheHandlers === undefined;\n const images = config.images;\n const injectImageLoader =\n images !== undefined && images.unoptimized !== true && images.loader === 'default' && !images.loaderFile;\n\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n ...(injectCacheHandler ? { cacheHandler: CACHE_HANDLER_PATH() } : {}),\n ...(injectCacheComponentHandlers\n ? {\n cacheHandlers: {\n default: CACHE_COMPONENTS_HANDLER_PATH(),\n remote: CACHE_COMPONENTS_HANDLER_PATH(),\n },\n }\n : {}),\n ...(injectCacheHandler || injectCacheComponentHandlers ? { cacheMaxMemorySize: 0 } : {}),\n ...(injectImageLoader\n ? {\n images: {\n ...images,\n loader: 'custom',\n loaderFile: IMAGE_LOADER_PATH(),\n },\n }\n : {}),\n };\n },\n\n async onBuildComplete({ projectDir, repoRoot, distDir, config, nextVersion, buildId, routing, outputs }) {\n const metadataDirectory = path.join(projectDir, '.gigadrive');\n if (!supportsAdapterV2(nextVersion)) {\n const manifest: GigadriveNextBuildManifestV1 = {\n version: 1,\n output: config.output === 'export' ? 'export' : 'standalone',\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir, true),\n nextVersion,\n buildId,\n };\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n return;\n }\n const portableOutputs = {\n pages: await Promise.all(outputs.pages.map((output) => serializeRouteOutput(repoRoot, output))),\n ...(outputs.middleware ? { middleware: await serializeRouteOutput(repoRoot, outputs.middleware) } : {}),\n appPages: await Promise.all(outputs.appPages.map((output) => serializeRouteOutput(repoRoot, output))),\n pagesApi: await Promise.all(outputs.pagesApi.map((output) => serializeRouteOutput(repoRoot, output))),\n appRoutes: await Promise.all(outputs.appRoutes.map((output) => serializeRouteOutput(repoRoot, output))),\n prerenders: await Promise.all(\n outputs.prerenders.map(async (output) => {\n const { bypassFor, ...prerenderConfig } = output.config;\n return {\n id: output.id,\n type: 'PRERENDER' as const,\n pathname: output.pathname,\n parentOutputId: output.parentOutputId,\n groupId: output.groupId,\n ...(output.pprChain ? { pprChain: output.pprChain } : {}),\n ...(output.parentFallbackMode !== undefined\n ? { parentFallbackMode: toJsonValue(output.parentFallbackMode) }\n : {}),\n ...(output.fallback\n ? {\n fallback: {\n ...(output.fallback.filePath\n ? { filePath: await requireReadableFile(repoRoot, output.fallback.filePath) }\n : {}),\n ...(output.fallback.initialStatus !== undefined\n ? { initialStatus: output.fallback.initialStatus }\n : {}),\n ...(output.fallback.initialHeaders ? { initialHeaders: output.fallback.initialHeaders } : {}),\n ...(output.fallback.initialExpiration !== undefined\n ? { initialExpiration: output.fallback.initialExpiration }\n : {}),\n ...(output.fallback.initialRevalidate !== undefined\n ? { initialRevalidate: output.fallback.initialRevalidate }\n : {}),\n ...(output.fallback.postponedState !== undefined\n ? { postponedState: output.fallback.postponedState }\n : {}),\n },\n }\n : {}),\n config: {\n ...prerenderConfig,\n ...(bypassFor ? { bypassFor: toJsonValue(bypassFor) as JsonValue[] } : {}),\n },\n };\n })\n ),\n staticFiles: await Promise.all(outputs.staticFiles.map((output) => serializeStaticOutput(repoRoot, output))),\n };\n const executableOutputs = [\n ...portableOutputs.pages,\n ...portableOutputs.pagesApi,\n ...portableOutputs.appPages,\n ...portableOutputs.appRoutes,\n ...(portableOutputs.middleware ? [portableOutputs.middleware] : []),\n ];\n const entrypointPlan = buildEntrypointPlan(executableOutputs);\n const runtimeConfigAssets = await serializeRuntimeConfigAssets(projectDir, repoRoot, config);\n for (const entrypoint of entrypointPlan.entrypoints) Object.assign(entrypoint.assets, runtimeConfigAssets);\n const pprRuntimePath = await requireReadableFile(repoRoot, PPR_RUNTIME_PATH());\n await writeEntrypointWrappers(\n projectDir,\n repoRoot,\n entrypointPlan.entrypoints,\n pprRuntimePath,\n portableOutputs.middleware?.id\n );\n const images = normalizeImages(config);\n const manifest: GigadriveNextBuildManifestV2 = {\n version: 2,\n mode: config.output === 'export' ? 'export' : 'adapter-v2',\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir, true),\n nextVersion,\n buildId,\n config: {\n basePath: config.basePath,\n trailingSlash: config.trailingSlash,\n cacheComponents: config.cacheComponents,\n ...(config.i18n ? { i18n: toJsonValue(config.i18n) } : {}),\n ...(images ? { images } : {}),\n },\n routing: {\n beforeMiddleware: toJsonValue(routing.beforeMiddleware) as JsonValue[],\n beforeFiles: toJsonValue(routing.beforeFiles) as JsonValue[],\n afterFiles: toJsonValue(routing.afterFiles) as JsonValue[],\n dynamicRoutes: toJsonValue(routing.dynamicRoutes) as JsonValue[],\n onMatch: toJsonValue(routing.onMatch) as JsonValue[],\n fallback: toJsonValue(routing.fallback) as JsonValue[],\n shouldNormalizeNextData: routing.shouldNormalizeNextData,\n rsc: toJsonValue(routing.rsc),\n },\n outputs: portableOutputs,\n ...entrypointPlan,\n };\n\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n },\n};\n\nexport default gigadriveNextAdapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAyD;AACzD,uBAAiB;AACjB,sBAA8B;AAH9B;AAuBA,IAAM,yBAAyB;AAC/B,IAAM,mBAAmB,OAAO,cAAc,WAAW,YAAY,iBAAAA,QAAK,YAAQ,+BAAc,YAAY,GAAG,CAAC;AAEhH,IAAM,oBAAoB,CAAC,iBAAyB,aAClD,QAAQ,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AAO,IAAI,EAAE,IAAI,CAAC;AAAA,QACxD,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;AAAA,MAC7B;AAAA,MACA,SAAS;AAAA,QACP,kBAAkB,YAAY,QAAQ,gBAAgB;AAAA,QACtD,aAAa,YAAY,QAAQ,WAAW;AAAA,QAC5C,YAAY,YAAY,QAAQ,UAAU;AAAA,QAC1C,eAAe,YAAY,QAAQ,aAAa;AAAA,QAChD,SAAS,YAAY,QAAQ,OAAO;AAAA,QACpC,UAAU,YAAY,QAAQ,QAAQ;AAAA,QACtC,yBAAyB,QAAQ;AAAA,QACjC,KAAK,YAAY,QAAQ,GAAG;AAAA,MAC9B;AAAA,MACA,SAAS;AAAA,MACT,GAAG;AAAA,IACL;AAEA,cAAM,uBAAM,mBAAmB,EAAE,WAAW,KAAK,CAAC;AAClD,cAAM,2BAAU,iBAAAD,QAAK,KAAK,mBAAmB,aAAa,GAAG,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,GAAM,MAAM;AAAA,EAC/G;AACF;AAEA,IAAO,yBAAQ;","names":["path","manifest"]}
|
|
1
|
+
{"version":3,"sources":["../src/nextjs-adapter.ts"],"sourcesContent":["import type { NextAdapter } from 'next';\nimport { access, mkdir, realpath, stat, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { NormalizedImagePolicy } from './image-policy';\nimport type {\n GigadriveNextBuildManifestV1,\n GigadriveNextBuildManifestV2,\n GigadriveNextEntrypoint,\n GigadriveNextRouteOutput,\n GigadriveNextStaticOutput,\n JsonValue,\n} from './nextjs-manifest';\n\ntype BuildCompleteContext = Parameters<NonNullable<NextAdapter['onBuildComplete']>>[0];\ntype NextRouteOutput =\n | BuildCompleteContext['outputs']['pages'][number]\n | BuildCompleteContext['outputs']['pagesApi'][number]\n | BuildCompleteContext['outputs']['appPages'][number]\n | BuildCompleteContext['outputs']['appRoutes'][number]\n | NonNullable<BuildCompleteContext['outputs']['middleware']>;\ntype NextStaticOutput = BuildCompleteContext['outputs']['staticFiles'][number];\n\nconst PRODUCTION_BUILD_PHASE = 'phase-production-build';\nconst runtimeDirectory = typeof __dirname === 'string' ? __dirname : path.dirname(fileURLToPath(import.meta.url));\n\nconst runtimeModulePath = (environmentName: string, fileName: string): string =>\n process.env[environmentName] ?? path.join(runtimeDirectory, fileName);\n\nconst CACHE_HANDLER_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_CACHE_HANDLER_PATH', 'nextjs-cache-handler.js');\nconst CACHE_COMPONENTS_HANDLER_PATH = () =>\n runtimeModulePath('GIGADRIVE_NEXT_CACHE_COMPONENTS_HANDLER_PATH', 'nextjs-cache-components-handler.js');\nconst IMAGE_LOADER_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_IMAGE_LOADER_PATH', 'nextjs-image-loader.js');\nconst PPR_RUNTIME_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_PPR_RUNTIME_PATH', 'nextjs-ppr-runtime.js');\n\nconst toJsonValue = (value: unknown): JsonValue => {\n const serialized = JSON.stringify(value);\n return serialized === undefined ? null : (JSON.parse(serialized) as JsonValue);\n};\n\nconst supportsAdapterV2 = (nextVersion: string | undefined): boolean => {\n if (!nextVersion) return false;\n const [majorPart, minorPart] = nextVersion.split('.');\n const major = Number.parseInt(majorPart ?? '', 10);\n const minor = Number.parseInt(minorPart ?? '', 10);\n return Number.isFinite(major) && Number.isFinite(minor) && (major > 16 || (major === 16 && minor >= 2));\n};\n\nconst toPortableRelativePath = (from: string, to: string, allowCurrentDirectory = false): string => {\n const resolvedFrom = path.resolve(from);\n const resolvedTo = path.resolve(path.isAbsolute(to) ? to : path.join(from, to));\n const relativePath = path.relative(resolvedFrom, resolvedTo).replaceAll(path.sep, '/');\n const normalized = relativePath === '' ? '.' : relativePath;\n if (\n (!allowCurrentDirectory && normalized === '.') ||\n normalized.startsWith('/') ||\n /^[A-Za-z]:/.test(normalized) ||\n normalized.split('/').some((segment) => segment === '..')\n ) {\n throw new Error(`Next.js adapter output is outside the repository root: ${to}`);\n }\n return normalized;\n};\n\nasync function resolveReadablePath(repoRoot: string, filePath: string) {\n const absolutePath = path.resolve(path.isAbsolute(filePath) ? filePath : path.join(repoRoot, filePath));\n const portablePath = toPortableRelativePath(repoRoot, absolutePath);\n await access(absolutePath);\n const resolvedPath = await realpath(absolutePath);\n toPortableRelativePath(repoRoot, resolvedPath);\n const fileStat = await stat(absolutePath);\n return { portablePath, fileStat };\n}\n\nasync function requireReadableFile(repoRoot: string, filePath: string): Promise<string> {\n const { portablePath, fileStat } = await resolveReadablePath(repoRoot, filePath);\n if (!fileStat.isFile()) throw new Error(`Next.js adapter output is not a readable file: ${filePath}`);\n return portablePath;\n}\n\nasync function requireReadableAsset(repoRoot: string, filePath: string): Promise<string> {\n const { portablePath, fileStat } = await resolveReadablePath(repoRoot, filePath);\n if (!fileStat.isFile() && !fileStat.isDirectory()) {\n throw new Error(`Next.js adapter asset is not a readable file or directory: ${filePath}`);\n }\n return portablePath;\n}\n\nasync function serializeFileMap(repoRoot: string, files: Record<string, string>): Promise<Record<string, string>> {\n const entries = await Promise.all(\n Object.entries(files).map(async ([targetPath, sourcePath]) => [\n toPortableRelativePath(repoRoot, targetPath),\n await requireReadableAsset(repoRoot, sourcePath),\n ])\n );\n return Object.fromEntries(entries);\n}\n\nconst serializeRuntimeConfigAssets = async (\n projectDir: string,\n repoRoot: string,\n config: BuildCompleteContext['config']\n): Promise<Record<string, string>> => {\n const configuredPaths = new Set([\n config.cacheHandler,\n ...Object.values(config.cacheHandlers ?? {}),\n config.images.loaderFile,\n PPR_RUNTIME_PATH(),\n ]);\n const assets: Record<string, string> = {};\n for (const configuredPath of configuredPaths) {\n if (!configuredPath) continue;\n const absolutePath = path.resolve(\n path.isAbsolute(configuredPath) ? configuredPath : path.join(projectDir, configuredPath)\n );\n const portablePath = await requireReadableFile(repoRoot, absolutePath);\n assets[portablePath] = portablePath;\n }\n return assets;\n};\n\nconst serializeRouteOutput = async (repoRoot: string, output: NextRouteOutput): Promise<GigadriveNextRouteOutput> => {\n const matchers = (\n output.config as typeof output.config & {\n matchers?: Array<{\n source: string;\n sourceRegex: string;\n has?: unknown[];\n missing?: unknown[];\n }>;\n }\n ).matchers;\n return {\n id: output.id,\n type: String(output.type) as GigadriveNextRouteOutput['type'],\n filePath: await requireReadableFile(repoRoot, output.filePath),\n pathname: output.pathname,\n sourcePage: output.sourcePage,\n runtime: output.runtime,\n assets: await serializeFileMap(repoRoot, output.assets),\n ...(output.wasmAssets ? { wasmAssets: await serializeFileMap(repoRoot, output.wasmAssets) } : {}),\n ...(output.edgeRuntime\n ? {\n edgeRuntime: {\n modulePath: await requireReadableFile(repoRoot, output.edgeRuntime.modulePath),\n entryKey: output.edgeRuntime.entryKey,\n handlerExport: output.edgeRuntime.handlerExport,\n },\n }\n : {}),\n config: {\n maxDuration: output.config.maxDuration,\n preferredRegion: output.config.preferredRegion,\n env: output.config.env,\n ...(matchers\n ? {\n matchers: matchers.map((matcher) => ({\n source: matcher.source,\n sourceRegex: matcher.sourceRegex,\n ...(matcher.has ? { has: toJsonValue(matcher.has) as JsonValue[] } : {}),\n ...(matcher.missing ? { missing: toJsonValue(matcher.missing) as JsonValue[] } : {}),\n })),\n }\n : {}),\n },\n };\n};\n\nconst serializeStaticOutput = async (\n repoRoot: string,\n output: NextStaticOutput\n): Promise<GigadriveNextStaticOutput> => ({\n id: output.id,\n type: 'STATIC_FILE',\n filePath: await requireReadableFile(repoRoot, output.filePath),\n pathname: output.pathname,\n ...(output.immutableHash ? { immutableHash: output.immutableHash } : {}),\n});\n\nconst buildEntrypointPlan = (\n outputs: GigadriveNextRouteOutput[]\n): Pick<GigadriveNextBuildManifestV2, 'entrypoints' | 'outputEntrypoints'> => {\n const byIdentity = new Map<string, GigadriveNextEntrypoint>();\n const outputEntrypoints: Record<string, string> = {};\n\n for (const output of outputs) {\n const identity = JSON.stringify([\n output.type === 'MIDDLEWARE' ? 'middleware-web' : 'route',\n output.runtime,\n output.filePath,\n output.edgeRuntime?.modulePath,\n output.edgeRuntime?.entryKey,\n output.edgeRuntime?.handlerExport,\n ]);\n const existingEntrypoint = byIdentity.get(identity);\n const entrypoint: GigadriveNextEntrypoint = existingEntrypoint ?? {\n id: `next-${byIdentity.size}`,\n runtime: output.runtime,\n filePath: output.filePath,\n outputIds: [],\n assets: { ...output.assets },\n ...(output.wasmAssets ? { wasmAssets: { ...output.wasmAssets } } : {}),\n ...(output.edgeRuntime ? { edgeRuntime: { ...output.edgeRuntime } } : {}),\n config: {\n maxDuration: output.config.maxDuration,\n preferredRegion: output.config.preferredRegion,\n env: output.config.env,\n },\n };\n if (!existingEntrypoint) {\n byIdentity.set(identity, entrypoint);\n } else {\n Object.assign(entrypoint.assets, output.assets);\n if (output.wasmAssets) entrypoint.wasmAssets = { ...entrypoint.wasmAssets, ...output.wasmAssets };\n if (output.config.maxDuration !== undefined) {\n entrypoint.config.maxDuration = Math.max(entrypoint.config.maxDuration ?? 0, output.config.maxDuration);\n }\n }\n entrypoint.outputIds.push(output.id);\n outputEntrypoints[output.id] = entrypoint.id;\n }\n\n return { entrypoints: [...byIdentity.values()], outputEntrypoints };\n};\n\nconst writeEntrypointWrappers = async (\n projectDir: string,\n repoRoot: string,\n entrypoints: GigadriveNextEntrypoint[],\n pprRuntimePath: string,\n middlewareOutputId?: string\n): Promise<void> => {\n const wrapperDirectory = path.join(projectDir, '.gigadrive', 'nextjs', 'entrypoints');\n await mkdir(wrapperDirectory, { recursive: true });\n const portableWrapperDirectory = toPortableRelativePath(repoRoot, wrapperDirectory);\n const relativePprRuntimePath = path.posix.relative(portableWrapperDirectory, pprRuntimePath);\n const pprRuntimeSpecifier = relativePprRuntimePath.startsWith('.')\n ? relativePprRuntimePath\n : `./${relativePprRuntimePath}`;\n\n await Promise.all(\n entrypoints.map(async (entrypoint) => {\n const wrapperPath = path.join(wrapperDirectory, `${entrypoint.id}.mjs`);\n const executablePath = path.join(repoRoot, entrypoint.edgeRuntime?.modulePath ?? entrypoint.filePath);\n const relativeImport = path.relative(wrapperDirectory, executablePath).replaceAll(path.sep, '/');\n const importSpecifier = relativeImport.startsWith('.') ? relativeImport : `./${relativeImport}`;\n const isMiddleware = middlewareOutputId !== undefined && entrypoint.outputIds.includes(middlewareOutputId);\n const webHandlerPrelude =\n entrypoint.runtime === 'edge' && entrypoint.edgeRuntime\n ? (() => {\n const edgeMarker = '/server/edge/';\n const markerIndex = entrypoint.edgeRuntime.modulePath.indexOf(edgeMarker);\n const distDirectory =\n markerIndex >= 0\n ? entrypoint.edgeRuntime.modulePath.slice(0, markerIndex)\n : path.dirname(entrypoint.edgeRuntime.modulePath);\n const edgeRuntimeAssets = Object.entries(entrypoint.assets)\n .filter(([, sourcePath]) => sourcePath.startsWith(`${distDirectory}/`) && sourcePath.endsWith('.js'))\n .sort(([, leftSource], [, rightSource]) => {\n if (leftSource === entrypoint.edgeRuntime?.modulePath) return 1;\n if (rightSource === entrypoint.edgeRuntime?.modulePath) return -1;\n return leftSource.localeCompare(rightSource);\n });\n const imports = edgeRuntimeAssets\n .map(([targetPath, sourcePath]) => {\n // Next includes the executable Edge module in `assets` under a\n // deployment-relative target such as `server/edge/chunks/*`,\n // while `modulePath` retains its canonical `.next/server/*`\n // location. Function packaging installs the executable at the\n // canonical path, so the wrapper must import it there as well.\n const runtimeTargetPath =\n sourcePath === entrypoint.edgeRuntime?.modulePath ? entrypoint.edgeRuntime.modulePath : targetPath;\n const relativeAssetPath = path.posix.relative(portableWrapperDirectory, runtimeTargetPath);\n const assetSpecifier = relativeAssetPath.startsWith('.')\n ? relativeAssetPath\n : `./${relativeAssetPath}`;\n return ` await import(${JSON.stringify(assetSpecifier)});`;\n })\n .join('\\n');\n return `import { AsyncLocalStorage } from \"node:async_hooks\";\\n\\nconst resolveHandler = async () => {\\n globalThis.self ??= globalThis;\\n globalThis.AsyncLocalStorage ??= AsyncLocalStorage;\\n${imports}\\n const registry = globalThis._ENTRIES;\\n if (!registry) throw new Error('Next.js edge entry registry is unavailable');\\n const entry = await registry[${JSON.stringify(entrypoint.edgeRuntime.entryKey)}];\\n const handler = entry?.[${JSON.stringify(entrypoint.edgeRuntime.handlerExport)}];\\n if (typeof handler !== 'function') throw new Error('Next.js edge handler is unavailable');\\n return handler;\\n};`;\n })()\n : `import * as nextEntrypoint from ${JSON.stringify(importSpecifier)};\\n\\nconst resolveHandler = async () => {\\n const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);\\n const handler = nextEntrypoint.handler ?? loadedEntrypoint?.handler ?? loadedEntrypoint?.default?.handler ?? loadedEntrypoint?.default ?? loadedEntrypoint;\\n if (typeof handler !== 'function') throw new Error('Next.js middleware handler is unavailable');\\n return handler;\\n};`;\n const source =\n (entrypoint.runtime === 'edge' && entrypoint.edgeRuntime) || isMiddleware\n ? `import { persistPprCacheEntry } from ${JSON.stringify(pprRuntimeSpecifier)};\\n${webHandlerPrelude}\\n\\nexport async function fetch(request) {\\n const pending = [];\\n const handler = await resolveHandler();\\n const url = new URL(request.url);\\n const response = await handler(request, {\\n signal: request.signal,\\n waitUntil(promise) { pending.push(Promise.resolve(promise)); },\\n requestMeta: { hostname: url.hostname, invocationTarget: request.headers.get('x-gigadrive-next-invocation-target') ?? url.pathname, routeMatches: Object.fromEntries(new URLSearchParams(request.headers.get('x-now-route-matches') ?? '')), relativeProjectDir: ${JSON.stringify(\n toPortableRelativePath(repoRoot, projectDir, true)\n )}, onCacheEntryV2(cacheEntry, meta) { pending.push(persistPprCacheEntry(request.headers.get('x-gigadrive-next-cache-key') ?? meta.url ?? request.headers.get('x-matched-path') ?? url.pathname, cacheEntry)); return false; } },\\n });\\n if (!response.body) { await Promise.allSettled(pending); return response; }\\n const reader = response.body.getReader();\\n const body = new ReadableStream({\\n async pull(controller) {\\n const result = await reader.read();\\n if (result.done) { await Promise.allSettled(pending); controller.close(); return; }\\n controller.enqueue(result.value);\\n },\\n async cancel(reason) { try { await reader.cancel(reason); } finally { await Promise.allSettled(pending); } },\\n });\\n return new Response(body, response);\\n}\\n`\n : `import \"next/dist/build/adapter/setup-node-env.external.js\";\\nimport * as nextEntrypoint from ${JSON.stringify(importSpecifier)};\\nimport { persistPprCacheEntry, revalidateNextPath } from ${JSON.stringify(pprRuntimeSpecifier)};\\n\\nconst resolveHandler = async () => {\\n const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);\\n const handler = nextEntrypoint.handler ?? loadedEntrypoint?.handler ?? loadedEntrypoint?.default?.handler ?? loadedEntrypoint?.default ?? loadedEntrypoint;\\n if (typeof handler !== 'function') throw new Error('Next.js Node handler is unavailable');\\n return handler;\\n};\\n\\nexport default async function handler(req, res) {\\n const pending = [];\\n const nextHandler = await resolveHandler();\\n const hostname = Array.isArray(req.headers.host) ? req.headers.host[0] : req.headers.host;\\n await nextHandler(req, res, {\\n waitUntil(promise) { pending.push(Promise.resolve(promise)); },\\n requestMeta: { hostname, invocationTarget: req.headers['x-gigadrive-next-invocation-target'] ?? req.url, routeMatches: Object.fromEntries(new URLSearchParams(req.headers['x-now-route-matches'] ?? '')), relativeProjectDir: ${JSON.stringify(\n toPortableRelativePath(repoRoot, projectDir, true)\n )}, revalidate(input) { return revalidateNextPath({ ...input, hostname }); }, onCacheEntryV2(cacheEntry, meta) { const cacheKey = req.headers['x-gigadrive-next-cache-key']; const matchedPath = req.headers['x-matched-path']; pending.push(persistPprCacheEntry((Array.isArray(cacheKey) ? cacheKey[0] : cacheKey) ?? meta.url ?? (Array.isArray(matchedPath) ? matchedPath[0] : matchedPath) ?? req.url ?? '/', cacheEntry)); return false; } },\\n });\\n await Promise.allSettled(pending);\\n}\\n`;\n await writeFile(wrapperPath, source, 'utf8');\n const portableWrapperPath = toPortableRelativePath(repoRoot, wrapperPath);\n entrypoint.assets[portableWrapperPath] = portableWrapperPath;\n entrypoint.filePath = portableWrapperPath;\n })\n );\n};\n\nconst normalizeImages = (config: BuildCompleteContext['config']): NormalizedImagePolicy | undefined => {\n if (config.images.unoptimized) return undefined;\n return {\n localPatterns: config.images.localPatterns ?? [{ pathname: '/**' }],\n remotePatterns: config.images.remotePatterns.map((pattern) => {\n if (pattern instanceof URL) {\n return {\n protocol: pattern.protocol === 'http:' ? ('http' as const) : ('https' as const),\n hostname: pattern.hostname,\n port: pattern.port,\n pathname: pattern.pathname,\n search: pattern.search,\n };\n }\n return { ...pattern };\n }),\n widths: [...new Set([...config.images.deviceSizes, ...config.images.imageSizes])].sort((a, b) => a - b),\n heights: [],\n qualities: config.images.qualities ?? [75],\n formats: config.images.formats,\n minimumCacheTTL: config.images.minimumCacheTTL,\n dangerouslyAllowSVG: config.images.dangerouslyAllowSVG,\n contentSecurityPolicy: config.images.contentSecurityPolicy,\n contentDispositionType: config.images.contentDispositionType,\n maximumRedirects: config.images.maximumRedirects,\n maximumResponseBody: config.images.maximumResponseBody,\n variants: {},\n };\n};\n\n/**\n * Next.js deployment adapter used automatically by Gigadrive Network build workers.\n *\n * Next 16.2 and newer emit a portable, versioned runtime plan. Older releases retain\n * the standalone-server behavior because their experimental adapter context does not\n * expose the routing and runtime metadata required by the v2 contract.\n */\nconst gigadriveNextAdapter: NextAdapter = {\n name: 'Gigadrive Network',\n\n modifyConfig(config, { phase, nextVersion }) {\n if (phase !== PRODUCTION_BUILD_PHASE) return config;\n\n const deploymentId = config.deploymentId ?? process.env.GIGADRIVE_DEPLOYMENT_ID;\n if (!supportsAdapterV2(nextVersion)) {\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n output: config.output === 'export' ? 'export' : 'standalone',\n };\n }\n if (config.output === 'export') {\n return { ...config, ...(deploymentId ? { deploymentId } : {}) };\n }\n\n const injectCacheHandler = config.cacheHandler === undefined;\n const injectCacheComponentHandlers = config.cacheHandlers === undefined;\n const images = config.images;\n const injectImageLoader =\n images !== undefined && images.unoptimized !== true && images.loader === 'default' && !images.loaderFile;\n\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n ...(injectCacheHandler ? { cacheHandler: CACHE_HANDLER_PATH() } : {}),\n ...(injectCacheComponentHandlers\n ? {\n cacheHandlers: {\n default: CACHE_COMPONENTS_HANDLER_PATH(),\n remote: CACHE_COMPONENTS_HANDLER_PATH(),\n },\n }\n : {}),\n ...(injectCacheHandler || injectCacheComponentHandlers ? { cacheMaxMemorySize: 0 } : {}),\n ...(injectImageLoader\n ? {\n images: {\n ...images,\n loader: 'custom',\n loaderFile: IMAGE_LOADER_PATH(),\n },\n }\n : {}),\n };\n },\n\n async onBuildComplete({ projectDir, repoRoot, distDir, config, nextVersion, buildId, routing, outputs }) {\n const metadataDirectory = path.join(projectDir, '.gigadrive');\n if (!supportsAdapterV2(nextVersion)) {\n const manifest: GigadriveNextBuildManifestV1 = {\n version: 1,\n output: config.output === 'export' ? 'export' : 'standalone',\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir, true),\n nextVersion,\n buildId,\n };\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n return;\n }\n const portableOutputs = {\n pages: await Promise.all(outputs.pages.map((output) => serializeRouteOutput(repoRoot, output))),\n ...(outputs.middleware ? { middleware: await serializeRouteOutput(repoRoot, outputs.middleware) } : {}),\n appPages: await Promise.all(outputs.appPages.map((output) => serializeRouteOutput(repoRoot, output))),\n pagesApi: await Promise.all(outputs.pagesApi.map((output) => serializeRouteOutput(repoRoot, output))),\n appRoutes: await Promise.all(outputs.appRoutes.map((output) => serializeRouteOutput(repoRoot, output))),\n prerenders: await Promise.all(\n outputs.prerenders.map(async (output) => {\n const { bypassFor, ...prerenderConfig } = output.config;\n return {\n id: output.id,\n type: 'PRERENDER' as const,\n pathname: output.pathname,\n parentOutputId: output.parentOutputId,\n groupId: output.groupId,\n ...(output.pprChain ? { pprChain: output.pprChain } : {}),\n ...(output.parentFallbackMode !== undefined\n ? { parentFallbackMode: toJsonValue(output.parentFallbackMode) }\n : {}),\n ...(output.fallback\n ? {\n fallback: {\n ...(output.fallback.filePath\n ? { filePath: await requireReadableFile(repoRoot, output.fallback.filePath) }\n : {}),\n ...(output.fallback.initialStatus !== undefined\n ? { initialStatus: output.fallback.initialStatus }\n : {}),\n ...(output.fallback.initialHeaders ? { initialHeaders: output.fallback.initialHeaders } : {}),\n ...(output.fallback.initialExpiration !== undefined\n ? { initialExpiration: output.fallback.initialExpiration }\n : {}),\n ...(output.fallback.initialRevalidate !== undefined\n ? { initialRevalidate: output.fallback.initialRevalidate }\n : {}),\n ...(output.fallback.postponedState !== undefined\n ? { postponedState: output.fallback.postponedState }\n : {}),\n },\n }\n : {}),\n config: {\n ...prerenderConfig,\n ...(bypassFor ? { bypassFor: toJsonValue(bypassFor) as JsonValue[] } : {}),\n },\n };\n })\n ),\n staticFiles: await Promise.all(outputs.staticFiles.map((output) => serializeStaticOutput(repoRoot, output))),\n };\n const executableOutputs = [\n ...portableOutputs.pages,\n ...portableOutputs.pagesApi,\n ...portableOutputs.appPages,\n ...portableOutputs.appRoutes,\n ...(portableOutputs.middleware ? [portableOutputs.middleware] : []),\n ];\n const entrypointPlan = buildEntrypointPlan(executableOutputs);\n const runtimeConfigAssets = await serializeRuntimeConfigAssets(projectDir, repoRoot, config);\n for (const entrypoint of entrypointPlan.entrypoints) Object.assign(entrypoint.assets, runtimeConfigAssets);\n const pprRuntimePath = await requireReadableFile(repoRoot, PPR_RUNTIME_PATH());\n await writeEntrypointWrappers(\n projectDir,\n repoRoot,\n entrypointPlan.entrypoints,\n pprRuntimePath,\n portableOutputs.middleware?.id\n );\n const images = normalizeImages(config);\n const manifest: GigadriveNextBuildManifestV2 = {\n version: 2,\n mode: config.output === 'export' ? 'export' : 'adapter-v2',\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir, true),\n nextVersion,\n buildId,\n config: {\n basePath: config.basePath,\n trailingSlash: config.trailingSlash,\n cacheComponents: config.cacheComponents,\n ...(config.i18n ? { i18n: toJsonValue(config.i18n) } : {}),\n ...(images ? { images } : {}),\n },\n routing: {\n beforeMiddleware: toJsonValue(routing.beforeMiddleware) as JsonValue[],\n beforeFiles: toJsonValue(routing.beforeFiles) as JsonValue[],\n afterFiles: toJsonValue(routing.afterFiles) as JsonValue[],\n dynamicRoutes: toJsonValue(routing.dynamicRoutes) as JsonValue[],\n onMatch: toJsonValue(routing.onMatch) as JsonValue[],\n fallback: toJsonValue(routing.fallback) as JsonValue[],\n shouldNormalizeNextData: routing.shouldNormalizeNextData,\n rsc: toJsonValue(routing.rsc),\n },\n outputs: portableOutputs,\n ...entrypointPlan,\n };\n\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n },\n};\n\nexport default gigadriveNextAdapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAyD;AACzD,uBAAiB;AACjB,sBAA8B;AAH9B;AAuBA,IAAM,yBAAyB;AAC/B,IAAM,mBAAmB,OAAO,cAAc,WAAW,YAAY,iBAAAA,QAAK,YAAQ,+BAAc,YAAY,GAAG,CAAC;AAEhH,IAAM,oBAAoB,CAAC,iBAAyB,aAClD,QAAQ,IAAI,eAAe,KAAK,iBAAAA,QAAK,KAAK,kBAAkB,QAAQ;AAEtE,IAAM,qBAAqB,MAAM,kBAAkB,qCAAqC,yBAAyB;AACjH,IAAM,gCAAgC,MACpC,kBAAkB,gDAAgD,oCAAoC;AACxG,IAAM,oBAAoB,MAAM,kBAAkB,oCAAoC,wBAAwB;AAC9G,IAAM,mBAAmB,MAAM,kBAAkB,mCAAmC,uBAAuB;AAE3G,IAAM,cAAc,CAAC,UAA8B;AACjD,QAAM,aAAa,KAAK,UAAU,KAAK;AACvC,SAAO,eAAe,SAAY,OAAQ,KAAK,MAAM,UAAU;AACjE;AAEA,IA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AAyB,QAAQ;AAAA,QACjC,KAAK,YAAY,QAAQ,GAAG;AAAA,MAC9B;AAAA,MACA,SAAS;AAAA,MACT,GAAG;AAAA,IACL;AAEA,cAAM,uBAAM,mBAAmB,EAAE,WAAW,KAAK,CAAC;AAClD,cAAM,2BAAU,iBAAAD,QAAK,KAAK,mBAAmB,aAAa,GAAG,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,GAAM,MAAM;AAAA,EAC/G;AACF;AAEA,IAAO,yBAAQ;","names":["path","manifest"]}
|
package/dist/nextjs-adapter.mjs
CHANGED
|
@@ -203,7 +203,8 @@ ${imports}
|
|
|
203
203
|
})() : `import * as nextEntrypoint from ${JSON.stringify(importSpecifier)};
|
|
204
204
|
|
|
205
205
|
const resolveHandler = async () => {
|
|
206
|
-
const
|
|
206
|
+
const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);
|
|
207
|
+
const handler = nextEntrypoint.handler ?? loadedEntrypoint?.handler ?? loadedEntrypoint?.default?.handler ?? loadedEntrypoint?.default ?? loadedEntrypoint;
|
|
207
208
|
if (typeof handler !== 'function') throw new Error('Next.js middleware handler is unavailable');
|
|
208
209
|
return handler;
|
|
209
210
|
};`;
|
|
@@ -237,10 +238,16 @@ export async function fetch(request) {
|
|
|
237
238
|
import * as nextEntrypoint from ${JSON.stringify(importSpecifier)};
|
|
238
239
|
import { persistPprCacheEntry, revalidateNextPath } from ${JSON.stringify(pprRuntimeSpecifier)};
|
|
239
240
|
|
|
241
|
+
const resolveHandler = async () => {
|
|
242
|
+
const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);
|
|
243
|
+
const handler = nextEntrypoint.handler ?? loadedEntrypoint?.handler ?? loadedEntrypoint?.default?.handler ?? loadedEntrypoint?.default ?? loadedEntrypoint;
|
|
244
|
+
if (typeof handler !== 'function') throw new Error('Next.js Node handler is unavailable');
|
|
245
|
+
return handler;
|
|
246
|
+
};
|
|
247
|
+
|
|
240
248
|
export default async function handler(req, res) {
|
|
241
249
|
const pending = [];
|
|
242
|
-
const nextHandler =
|
|
243
|
-
if (typeof nextHandler !== 'function') throw new Error('Next.js Node handler is unavailable');
|
|
250
|
+
const nextHandler = await resolveHandler();
|
|
244
251
|
const hostname = Array.isArray(req.headers.host) ? req.headers.host[0] : req.headers.host;
|
|
245
252
|
await nextHandler(req, res, {
|
|
246
253
|
waitUntil(promise) { pending.push(Promise.resolve(promise)); },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/nextjs-adapter.ts"],"sourcesContent":["import type { NextAdapter } from 'next';\nimport { access, mkdir, realpath, stat, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { NormalizedImagePolicy } from './image-policy';\nimport type {\n GigadriveNextBuildManifestV1,\n GigadriveNextBuildManifestV2,\n GigadriveNextEntrypoint,\n GigadriveNextRouteOutput,\n GigadriveNextStaticOutput,\n JsonValue,\n} from './nextjs-manifest';\n\ntype BuildCompleteContext = Parameters<NonNullable<NextAdapter['onBuildComplete']>>[0];\ntype NextRouteOutput =\n | BuildCompleteContext['outputs']['pages'][number]\n | BuildCompleteContext['outputs']['pagesApi'][number]\n | BuildCompleteContext['outputs']['appPages'][number]\n | BuildCompleteContext['outputs']['appRoutes'][number]\n | NonNullable<BuildCompleteContext['outputs']['middleware']>;\ntype NextStaticOutput = BuildCompleteContext['outputs']['staticFiles'][number];\n\nconst PRODUCTION_BUILD_PHASE = 'phase-production-build';\nconst runtimeDirectory = typeof __dirname === 'string' ? __dirname : path.dirname(fileURLToPath(import.meta.url));\n\nconst runtimeModulePath = (environmentName: string, fileName: string): string =>\n process.env[environmentName] ?? path.join(runtimeDirectory, fileName);\n\nconst CACHE_HANDLER_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_CACHE_HANDLER_PATH', 'nextjs-cache-handler.js');\nconst CACHE_COMPONENTS_HANDLER_PATH = () =>\n runtimeModulePath('GIGADRIVE_NEXT_CACHE_COMPONENTS_HANDLER_PATH', 'nextjs-cache-components-handler.js');\nconst IMAGE_LOADER_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_IMAGE_LOADER_PATH', 'nextjs-image-loader.js');\nconst PPR_RUNTIME_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_PPR_RUNTIME_PATH', 'nextjs-ppr-runtime.js');\n\nconst toJsonValue = (value: unknown): JsonValue => {\n const serialized = JSON.stringify(value);\n return serialized === undefined ? null : (JSON.parse(serialized) as JsonValue);\n};\n\nconst supportsAdapterV2 = (nextVersion: string | undefined): boolean => {\n if (!nextVersion) return false;\n const [majorPart, minorPart] = nextVersion.split('.');\n const major = Number.parseInt(majorPart ?? '', 10);\n const minor = Number.parseInt(minorPart ?? '', 10);\n return Number.isFinite(major) && Number.isFinite(minor) && (major > 16 || (major === 16 && minor >= 2));\n};\n\nconst toPortableRelativePath = (from: string, to: string, allowCurrentDirectory = false): string => {\n const resolvedFrom = path.resolve(from);\n const resolvedTo = path.resolve(path.isAbsolute(to) ? to : path.join(from, to));\n const relativePath = path.relative(resolvedFrom, resolvedTo).replaceAll(path.sep, '/');\n const normalized = relativePath === '' ? '.' : relativePath;\n if (\n (!allowCurrentDirectory && normalized === '.') ||\n normalized.startsWith('/') ||\n /^[A-Za-z]:/.test(normalized) ||\n normalized.split('/').some((segment) => segment === '..')\n ) {\n throw new Error(`Next.js adapter output is outside the repository root: ${to}`);\n }\n return normalized;\n};\n\nasync function resolveReadablePath(repoRoot: string, filePath: string) {\n const absolutePath = path.resolve(path.isAbsolute(filePath) ? filePath : path.join(repoRoot, filePath));\n const portablePath = toPortableRelativePath(repoRoot, absolutePath);\n await access(absolutePath);\n const resolvedPath = await realpath(absolutePath);\n toPortableRelativePath(repoRoot, resolvedPath);\n const fileStat = await stat(absolutePath);\n return { portablePath, fileStat };\n}\n\nasync function requireReadableFile(repoRoot: string, filePath: string): Promise<string> {\n const { portablePath, fileStat } = await resolveReadablePath(repoRoot, filePath);\n if (!fileStat.isFile()) throw new Error(`Next.js adapter output is not a readable file: ${filePath}`);\n return portablePath;\n}\n\nasync function requireReadableAsset(repoRoot: string, filePath: string): Promise<string> {\n const { portablePath, fileStat } = await resolveReadablePath(repoRoot, filePath);\n if (!fileStat.isFile() && !fileStat.isDirectory()) {\n throw new Error(`Next.js adapter asset is not a readable file or directory: ${filePath}`);\n }\n return portablePath;\n}\n\nasync function serializeFileMap(repoRoot: string, files: Record<string, string>): Promise<Record<string, string>> {\n const entries = await Promise.all(\n Object.entries(files).map(async ([targetPath, sourcePath]) => [\n toPortableRelativePath(repoRoot, targetPath),\n await requireReadableAsset(repoRoot, sourcePath),\n ])\n );\n return Object.fromEntries(entries);\n}\n\nconst serializeRuntimeConfigAssets = async (\n projectDir: string,\n repoRoot: string,\n config: BuildCompleteContext['config']\n): Promise<Record<string, string>> => {\n const configuredPaths = new Set([\n config.cacheHandler,\n ...Object.values(config.cacheHandlers ?? {}),\n config.images.loaderFile,\n PPR_RUNTIME_PATH(),\n ]);\n const assets: Record<string, string> = {};\n for (const configuredPath of configuredPaths) {\n if (!configuredPath) continue;\n const absolutePath = path.resolve(\n path.isAbsolute(configuredPath) ? configuredPath : path.join(projectDir, configuredPath)\n );\n const portablePath = await requireReadableFile(repoRoot, absolutePath);\n assets[portablePath] = portablePath;\n }\n return assets;\n};\n\nconst serializeRouteOutput = async (repoRoot: string, output: NextRouteOutput): Promise<GigadriveNextRouteOutput> => {\n const matchers = (\n output.config as typeof output.config & {\n matchers?: Array<{\n source: string;\n sourceRegex: string;\n has?: unknown[];\n missing?: unknown[];\n }>;\n }\n ).matchers;\n return {\n id: output.id,\n type: String(output.type) as GigadriveNextRouteOutput['type'],\n filePath: await requireReadableFile(repoRoot, output.filePath),\n pathname: output.pathname,\n sourcePage: output.sourcePage,\n runtime: output.runtime,\n assets: await serializeFileMap(repoRoot, output.assets),\n ...(output.wasmAssets ? { wasmAssets: await serializeFileMap(repoRoot, output.wasmAssets) } : {}),\n ...(output.edgeRuntime\n ? {\n edgeRuntime: {\n modulePath: await requireReadableFile(repoRoot, output.edgeRuntime.modulePath),\n entryKey: output.edgeRuntime.entryKey,\n handlerExport: output.edgeRuntime.handlerExport,\n },\n }\n : {}),\n config: {\n maxDuration: output.config.maxDuration,\n preferredRegion: output.config.preferredRegion,\n env: output.config.env,\n ...(matchers\n ? {\n matchers: matchers.map((matcher) => ({\n source: matcher.source,\n sourceRegex: matcher.sourceRegex,\n ...(matcher.has ? { has: toJsonValue(matcher.has) as JsonValue[] } : {}),\n ...(matcher.missing ? { missing: toJsonValue(matcher.missing) as JsonValue[] } : {}),\n })),\n }\n : {}),\n },\n };\n};\n\nconst serializeStaticOutput = async (\n repoRoot: string,\n output: NextStaticOutput\n): Promise<GigadriveNextStaticOutput> => ({\n id: output.id,\n type: 'STATIC_FILE',\n filePath: await requireReadableFile(repoRoot, output.filePath),\n pathname: output.pathname,\n ...(output.immutableHash ? { immutableHash: output.immutableHash } : {}),\n});\n\nconst buildEntrypointPlan = (\n outputs: GigadriveNextRouteOutput[]\n): Pick<GigadriveNextBuildManifestV2, 'entrypoints' | 'outputEntrypoints'> => {\n const byIdentity = new Map<string, GigadriveNextEntrypoint>();\n const outputEntrypoints: Record<string, string> = {};\n\n for (const output of outputs) {\n const identity = JSON.stringify([\n output.type === 'MIDDLEWARE' ? 'middleware-web' : 'route',\n output.runtime,\n output.filePath,\n output.edgeRuntime?.modulePath,\n output.edgeRuntime?.entryKey,\n output.edgeRuntime?.handlerExport,\n ]);\n const existingEntrypoint = byIdentity.get(identity);\n const entrypoint: GigadriveNextEntrypoint = existingEntrypoint ?? {\n id: `next-${byIdentity.size}`,\n runtime: output.runtime,\n filePath: output.filePath,\n outputIds: [],\n assets: { ...output.assets },\n ...(output.wasmAssets ? { wasmAssets: { ...output.wasmAssets } } : {}),\n ...(output.edgeRuntime ? { edgeRuntime: { ...output.edgeRuntime } } : {}),\n config: {\n maxDuration: output.config.maxDuration,\n preferredRegion: output.config.preferredRegion,\n env: output.config.env,\n },\n };\n if (!existingEntrypoint) {\n byIdentity.set(identity, entrypoint);\n } else {\n Object.assign(entrypoint.assets, output.assets);\n if (output.wasmAssets) entrypoint.wasmAssets = { ...entrypoint.wasmAssets, ...output.wasmAssets };\n if (output.config.maxDuration !== undefined) {\n entrypoint.config.maxDuration = Math.max(entrypoint.config.maxDuration ?? 0, output.config.maxDuration);\n }\n }\n entrypoint.outputIds.push(output.id);\n outputEntrypoints[output.id] = entrypoint.id;\n }\n\n return { entrypoints: [...byIdentity.values()], outputEntrypoints };\n};\n\nconst writeEntrypointWrappers = async (\n projectDir: string,\n repoRoot: string,\n entrypoints: GigadriveNextEntrypoint[],\n pprRuntimePath: string,\n middlewareOutputId?: string\n): Promise<void> => {\n const wrapperDirectory = path.join(projectDir, '.gigadrive', 'nextjs', 'entrypoints');\n await mkdir(wrapperDirectory, { recursive: true });\n const portableWrapperDirectory = toPortableRelativePath(repoRoot, wrapperDirectory);\n const relativePprRuntimePath = path.posix.relative(portableWrapperDirectory, pprRuntimePath);\n const pprRuntimeSpecifier = relativePprRuntimePath.startsWith('.')\n ? relativePprRuntimePath\n : `./${relativePprRuntimePath}`;\n\n await Promise.all(\n entrypoints.map(async (entrypoint) => {\n const wrapperPath = path.join(wrapperDirectory, `${entrypoint.id}.mjs`);\n const executablePath = path.join(repoRoot, entrypoint.edgeRuntime?.modulePath ?? entrypoint.filePath);\n const relativeImport = path.relative(wrapperDirectory, executablePath).replaceAll(path.sep, '/');\n const importSpecifier = relativeImport.startsWith('.') ? relativeImport : `./${relativeImport}`;\n const isMiddleware = middlewareOutputId !== undefined && entrypoint.outputIds.includes(middlewareOutputId);\n const webHandlerPrelude =\n entrypoint.runtime === 'edge' && entrypoint.edgeRuntime\n ? (() => {\n const edgeMarker = '/server/edge/';\n const markerIndex = entrypoint.edgeRuntime.modulePath.indexOf(edgeMarker);\n const distDirectory =\n markerIndex >= 0\n ? entrypoint.edgeRuntime.modulePath.slice(0, markerIndex)\n : path.dirname(entrypoint.edgeRuntime.modulePath);\n const edgeRuntimeAssets = Object.entries(entrypoint.assets)\n .filter(([, sourcePath]) => sourcePath.startsWith(`${distDirectory}/`) && sourcePath.endsWith('.js'))\n .sort(([, leftSource], [, rightSource]) => {\n if (leftSource === entrypoint.edgeRuntime?.modulePath) return 1;\n if (rightSource === entrypoint.edgeRuntime?.modulePath) return -1;\n return leftSource.localeCompare(rightSource);\n });\n const imports = edgeRuntimeAssets\n .map(([targetPath, sourcePath]) => {\n // Next includes the executable Edge module in `assets` under a\n // deployment-relative target such as `server/edge/chunks/*`,\n // while `modulePath` retains its canonical `.next/server/*`\n // location. Function packaging installs the executable at the\n // canonical path, so the wrapper must import it there as well.\n const runtimeTargetPath =\n sourcePath === entrypoint.edgeRuntime?.modulePath ? entrypoint.edgeRuntime.modulePath : targetPath;\n const relativeAssetPath = path.posix.relative(portableWrapperDirectory, runtimeTargetPath);\n const assetSpecifier = relativeAssetPath.startsWith('.')\n ? relativeAssetPath\n : `./${relativeAssetPath}`;\n return ` await import(${JSON.stringify(assetSpecifier)});`;\n })\n .join('\\n');\n return `import { AsyncLocalStorage } from \"node:async_hooks\";\\n\\nconst resolveHandler = async () => {\\n globalThis.self ??= globalThis;\\n globalThis.AsyncLocalStorage ??= AsyncLocalStorage;\\n${imports}\\n const registry = globalThis._ENTRIES;\\n if (!registry) throw new Error('Next.js edge entry registry is unavailable');\\n const entry = await registry[${JSON.stringify(entrypoint.edgeRuntime.entryKey)}];\\n const handler = entry?.[${JSON.stringify(entrypoint.edgeRuntime.handlerExport)}];\\n if (typeof handler !== 'function') throw new Error('Next.js edge handler is unavailable');\\n return handler;\\n};`;\n })()\n : `import * as nextEntrypoint from ${JSON.stringify(importSpecifier)};\\n\\nconst resolveHandler = async () => {\\n const handler = nextEntrypoint.handler ?? nextEntrypoint.default?.handler ?? nextEntrypoint.default;\\n if (typeof handler !== 'function') throw new Error('Next.js middleware handler is unavailable');\\n return handler;\\n};`;\n const source =\n (entrypoint.runtime === 'edge' && entrypoint.edgeRuntime) || isMiddleware\n ? `import { persistPprCacheEntry } from ${JSON.stringify(pprRuntimeSpecifier)};\\n${webHandlerPrelude}\\n\\nexport async function fetch(request) {\\n const pending = [];\\n const handler = await resolveHandler();\\n const url = new URL(request.url);\\n const response = await handler(request, {\\n signal: request.signal,\\n waitUntil(promise) { pending.push(Promise.resolve(promise)); },\\n requestMeta: { hostname: url.hostname, invocationTarget: request.headers.get('x-gigadrive-next-invocation-target') ?? url.pathname, routeMatches: Object.fromEntries(new URLSearchParams(request.headers.get('x-now-route-matches') ?? '')), relativeProjectDir: ${JSON.stringify(\n toPortableRelativePath(repoRoot, projectDir, true)\n )}, onCacheEntryV2(cacheEntry, meta) { pending.push(persistPprCacheEntry(request.headers.get('x-gigadrive-next-cache-key') ?? meta.url ?? request.headers.get('x-matched-path') ?? url.pathname, cacheEntry)); return false; } },\\n });\\n if (!response.body) { await Promise.allSettled(pending); return response; }\\n const reader = response.body.getReader();\\n const body = new ReadableStream({\\n async pull(controller) {\\n const result = await reader.read();\\n if (result.done) { await Promise.allSettled(pending); controller.close(); return; }\\n controller.enqueue(result.value);\\n },\\n async cancel(reason) { try { await reader.cancel(reason); } finally { await Promise.allSettled(pending); } },\\n });\\n return new Response(body, response);\\n}\\n`\n : `import \"next/dist/build/adapter/setup-node-env.external.js\";\\nimport * as nextEntrypoint from ${JSON.stringify(importSpecifier)};\\nimport { persistPprCacheEntry, revalidateNextPath } from ${JSON.stringify(pprRuntimeSpecifier)};\\n\\nexport default async function handler(req, res) {\\n const pending = [];\\n const nextHandler = nextEntrypoint.handler ?? nextEntrypoint.default?.handler ?? nextEntrypoint.default;\\n if (typeof nextHandler !== 'function') throw new Error('Next.js Node handler is unavailable');\\n const hostname = Array.isArray(req.headers.host) ? req.headers.host[0] : req.headers.host;\\n await nextHandler(req, res, {\\n waitUntil(promise) { pending.push(Promise.resolve(promise)); },\\n requestMeta: { hostname, invocationTarget: req.headers['x-gigadrive-next-invocation-target'] ?? req.url, routeMatches: Object.fromEntries(new URLSearchParams(req.headers['x-now-route-matches'] ?? '')), relativeProjectDir: ${JSON.stringify(\n toPortableRelativePath(repoRoot, projectDir, true)\n )}, revalidate(input) { return revalidateNextPath({ ...input, hostname }); }, onCacheEntryV2(cacheEntry, meta) { const cacheKey = req.headers['x-gigadrive-next-cache-key']; const matchedPath = req.headers['x-matched-path']; pending.push(persistPprCacheEntry((Array.isArray(cacheKey) ? cacheKey[0] : cacheKey) ?? meta.url ?? (Array.isArray(matchedPath) ? matchedPath[0] : matchedPath) ?? req.url ?? '/', cacheEntry)); return false; } },\\n });\\n await Promise.allSettled(pending);\\n}\\n`;\n await writeFile(wrapperPath, source, 'utf8');\n const portableWrapperPath = toPortableRelativePath(repoRoot, wrapperPath);\n entrypoint.assets[portableWrapperPath] = portableWrapperPath;\n entrypoint.filePath = portableWrapperPath;\n })\n );\n};\n\nconst normalizeImages = (config: BuildCompleteContext['config']): NormalizedImagePolicy | undefined => {\n if (config.images.unoptimized) return undefined;\n return {\n localPatterns: config.images.localPatterns ?? [{ pathname: '/**' }],\n remotePatterns: config.images.remotePatterns.map((pattern) => {\n if (pattern instanceof URL) {\n return {\n protocol: pattern.protocol === 'http:' ? ('http' as const) : ('https' as const),\n hostname: pattern.hostname,\n port: pattern.port,\n pathname: pattern.pathname,\n search: pattern.search,\n };\n }\n return { ...pattern };\n }),\n widths: [...new Set([...config.images.deviceSizes, ...config.images.imageSizes])].sort((a, b) => a - b),\n heights: [],\n qualities: config.images.qualities ?? [75],\n formats: config.images.formats,\n minimumCacheTTL: config.images.minimumCacheTTL,\n dangerouslyAllowSVG: config.images.dangerouslyAllowSVG,\n contentSecurityPolicy: config.images.contentSecurityPolicy,\n contentDispositionType: config.images.contentDispositionType,\n maximumRedirects: config.images.maximumRedirects,\n maximumResponseBody: config.images.maximumResponseBody,\n variants: {},\n };\n};\n\n/**\n * Next.js deployment adapter used automatically by Gigadrive Network build workers.\n *\n * Next 16.2 and newer emit a portable, versioned runtime plan. Older releases retain\n * the standalone-server behavior because their experimental adapter context does not\n * expose the routing and runtime metadata required by the v2 contract.\n */\nconst gigadriveNextAdapter: NextAdapter = {\n name: 'Gigadrive Network',\n\n modifyConfig(config, { phase, nextVersion }) {\n if (phase !== PRODUCTION_BUILD_PHASE) return config;\n\n const deploymentId = config.deploymentId ?? process.env.GIGADRIVE_DEPLOYMENT_ID;\n if (!supportsAdapterV2(nextVersion)) {\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n output: config.output === 'export' ? 'export' : 'standalone',\n };\n }\n if (config.output === 'export') {\n return { ...config, ...(deploymentId ? { deploymentId } : {}) };\n }\n\n const injectCacheHandler = config.cacheHandler === undefined;\n const injectCacheComponentHandlers = config.cacheHandlers === undefined;\n const images = config.images;\n const injectImageLoader =\n images !== undefined && images.unoptimized !== true && images.loader === 'default' && !images.loaderFile;\n\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n ...(injectCacheHandler ? { cacheHandler: CACHE_HANDLER_PATH() } : {}),\n ...(injectCacheComponentHandlers\n ? {\n cacheHandlers: {\n default: CACHE_COMPONENTS_HANDLER_PATH(),\n remote: CACHE_COMPONENTS_HANDLER_PATH(),\n },\n }\n : {}),\n ...(injectCacheHandler || injectCacheComponentHandlers ? { cacheMaxMemorySize: 0 } : {}),\n ...(injectImageLoader\n ? {\n images: {\n ...images,\n loader: 'custom',\n loaderFile: IMAGE_LOADER_PATH(),\n },\n }\n : {}),\n };\n },\n\n async onBuildComplete({ projectDir, repoRoot, distDir, config, nextVersion, buildId, routing, outputs }) {\n const metadataDirectory = path.join(projectDir, '.gigadrive');\n if (!supportsAdapterV2(nextVersion)) {\n const manifest: GigadriveNextBuildManifestV1 = {\n version: 1,\n output: config.output === 'export' ? 'export' : 'standalone',\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir, true),\n nextVersion,\n buildId,\n };\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n return;\n }\n const portableOutputs = {\n pages: await Promise.all(outputs.pages.map((output) => serializeRouteOutput(repoRoot, output))),\n ...(outputs.middleware ? { middleware: await serializeRouteOutput(repoRoot, outputs.middleware) } : {}),\n appPages: await Promise.all(outputs.appPages.map((output) => serializeRouteOutput(repoRoot, output))),\n pagesApi: await Promise.all(outputs.pagesApi.map((output) => serializeRouteOutput(repoRoot, output))),\n appRoutes: await Promise.all(outputs.appRoutes.map((output) => serializeRouteOutput(repoRoot, output))),\n prerenders: await Promise.all(\n outputs.prerenders.map(async (output) => {\n const { bypassFor, ...prerenderConfig } = output.config;\n return {\n id: output.id,\n type: 'PRERENDER' as const,\n pathname: output.pathname,\n parentOutputId: output.parentOutputId,\n groupId: output.groupId,\n ...(output.pprChain ? { pprChain: output.pprChain } : {}),\n ...(output.parentFallbackMode !== undefined\n ? { parentFallbackMode: toJsonValue(output.parentFallbackMode) }\n : {}),\n ...(output.fallback\n ? {\n fallback: {\n ...(output.fallback.filePath\n ? { filePath: await requireReadableFile(repoRoot, output.fallback.filePath) }\n : {}),\n ...(output.fallback.initialStatus !== undefined\n ? { initialStatus: output.fallback.initialStatus }\n : {}),\n ...(output.fallback.initialHeaders ? { initialHeaders: output.fallback.initialHeaders } : {}),\n ...(output.fallback.initialExpiration !== undefined\n ? { initialExpiration: output.fallback.initialExpiration }\n : {}),\n ...(output.fallback.initialRevalidate !== undefined\n ? { initialRevalidate: output.fallback.initialRevalidate }\n : {}),\n ...(output.fallback.postponedState !== undefined\n ? { postponedState: output.fallback.postponedState }\n : {}),\n },\n }\n : {}),\n config: {\n ...prerenderConfig,\n ...(bypassFor ? { bypassFor: toJsonValue(bypassFor) as JsonValue[] } : {}),\n },\n };\n })\n ),\n staticFiles: await Promise.all(outputs.staticFiles.map((output) => serializeStaticOutput(repoRoot, output))),\n };\n const executableOutputs = [\n ...portableOutputs.pages,\n ...portableOutputs.pagesApi,\n ...portableOutputs.appPages,\n ...portableOutputs.appRoutes,\n ...(portableOutputs.middleware ? [portableOutputs.middleware] : []),\n ];\n const entrypointPlan = buildEntrypointPlan(executableOutputs);\n const runtimeConfigAssets = await serializeRuntimeConfigAssets(projectDir, repoRoot, config);\n for (const entrypoint of entrypointPlan.entrypoints) Object.assign(entrypoint.assets, runtimeConfigAssets);\n const pprRuntimePath = await requireReadableFile(repoRoot, PPR_RUNTIME_PATH());\n await writeEntrypointWrappers(\n projectDir,\n repoRoot,\n entrypointPlan.entrypoints,\n pprRuntimePath,\n portableOutputs.middleware?.id\n );\n const images = normalizeImages(config);\n const manifest: GigadriveNextBuildManifestV2 = {\n version: 2,\n mode: config.output === 'export' ? 'export' : 'adapter-v2',\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir, true),\n nextVersion,\n buildId,\n config: {\n basePath: config.basePath,\n trailingSlash: config.trailingSlash,\n cacheComponents: config.cacheComponents,\n ...(config.i18n ? { i18n: toJsonValue(config.i18n) } : {}),\n ...(images ? { images } : {}),\n },\n routing: {\n beforeMiddleware: toJsonValue(routing.beforeMiddleware) as JsonValue[],\n beforeFiles: toJsonValue(routing.beforeFiles) as JsonValue[],\n afterFiles: toJsonValue(routing.afterFiles) as JsonValue[],\n dynamicRoutes: toJsonValue(routing.dynamicRoutes) as JsonValue[],\n onMatch: toJsonValue(routing.onMatch) as JsonValue[],\n fallback: toJsonValue(routing.fallback) as JsonValue[],\n shouldNormalizeNextData: routing.shouldNormalizeNextData,\n rsc: toJsonValue(routing.rsc),\n },\n outputs: portableOutputs,\n ...entrypointPlan,\n };\n\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n },\n};\n\nexport default gigadriveNextAdapter;\n"],"mappings":";AACA,SAAS,QAAQ,OAAO,UAAU,MAAM,iBAAiB;AACzD,O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AI,CAAC;AAAA,QACxD,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;AAAA,MAC7B;AAAA,MACA,SAAS;AAAA,QACP,kBAAkB,YAAY,QAAQ,gBAAgB;AAAA,QACtD,aAAa,YAAY,QAAQ,WAAW;AAAA,QAC5C,YAAY,YAAY,QAAQ,UAAU;AAAA,QAC1C,eAAe,YAAY,QAAQ,aAAa;AAAA,QAChD,SAAS,YAAY,QAAQ,OAAO;AAAA,QACpC,UAAU,YAAY,QAAQ,QAAQ;AAAA,QACtC,yBAAyB,QAAQ;AAAA,QACjC,KAAK,YAAY,QAAQ,GAAG;AAAA,MAC9B;AAAA,MACA,SAAS;AAAA,MACT,GAAG;AAAA,IACL;AAEA,UAAM,MAAM,mBAAmB,EAAE,WAAW,KAAK,CAAC;AAClD,UAAM,UAAU,KAAK,KAAK,mBAAmB,aAAa,GAAG,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,GAAM,MAAM;AAAA,EAC/G;AACF;AAEA,IAAO,yBAAQ;","names":["manifest"]}
|
|
1
|
+
{"version":3,"sources":["../src/nextjs-adapter.ts"],"sourcesContent":["import type { NextAdapter } from 'next';\nimport { access, mkdir, realpath, stat, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { NormalizedImagePolicy } from './image-policy';\nimport type {\n GigadriveNextBuildManifestV1,\n GigadriveNextBuildManifestV2,\n GigadriveNextEntrypoint,\n GigadriveNextRouteOutput,\n GigadriveNextStaticOutput,\n JsonValue,\n} from './nextjs-manifest';\n\ntype BuildCompleteContext = Parameters<NonNullable<NextAdapter['onBuildComplete']>>[0];\ntype NextRouteOutput =\n | BuildCompleteContext['outputs']['pages'][number]\n | BuildCompleteContext['outputs']['pagesApi'][number]\n | BuildCompleteContext['outputs']['appPages'][number]\n | BuildCompleteContext['outputs']['appRoutes'][number]\n | NonNullable<BuildCompleteContext['outputs']['middleware']>;\ntype NextStaticOutput = BuildCompleteContext['outputs']['staticFiles'][number];\n\nconst PRODUCTION_BUILD_PHASE = 'phase-production-build';\nconst runtimeDirectory = typeof __dirname === 'string' ? __dirname : path.dirname(fileURLToPath(import.meta.url));\n\nconst runtimeModulePath = (environmentName: string, fileName: string): string =>\n process.env[environmentName] ?? path.join(runtimeDirectory, fileName);\n\nconst CACHE_HANDLER_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_CACHE_HANDLER_PATH', 'nextjs-cache-handler.js');\nconst CACHE_COMPONENTS_HANDLER_PATH = () =>\n runtimeModulePath('GIGADRIVE_NEXT_CACHE_COMPONENTS_HANDLER_PATH', 'nextjs-cache-components-handler.js');\nconst IMAGE_LOADER_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_IMAGE_LOADER_PATH', 'nextjs-image-loader.js');\nconst PPR_RUNTIME_PATH = () => runtimeModulePath('GIGADRIVE_NEXT_PPR_RUNTIME_PATH', 'nextjs-ppr-runtime.js');\n\nconst toJsonValue = (value: unknown): JsonValue => {\n const serialized = JSON.stringify(value);\n return serialized === undefined ? null : (JSON.parse(serialized) as JsonValue);\n};\n\nconst supportsAdapterV2 = (nextVersion: string | undefined): boolean => {\n if (!nextVersion) return false;\n const [majorPart, minorPart] = nextVersion.split('.');\n const major = Number.parseInt(majorPart ?? '', 10);\n const minor = Number.parseInt(minorPart ?? '', 10);\n return Number.isFinite(major) && Number.isFinite(minor) && (major > 16 || (major === 16 && minor >= 2));\n};\n\nconst toPortableRelativePath = (from: string, to: string, allowCurrentDirectory = false): string => {\n const resolvedFrom = path.resolve(from);\n const resolvedTo = path.resolve(path.isAbsolute(to) ? to : path.join(from, to));\n const relativePath = path.relative(resolvedFrom, resolvedTo).replaceAll(path.sep, '/');\n const normalized = relativePath === '' ? '.' : relativePath;\n if (\n (!allowCurrentDirectory && normalized === '.') ||\n normalized.startsWith('/') ||\n /^[A-Za-z]:/.test(normalized) ||\n normalized.split('/').some((segment) => segment === '..')\n ) {\n throw new Error(`Next.js adapter output is outside the repository root: ${to}`);\n }\n return normalized;\n};\n\nasync function resolveReadablePath(repoRoot: string, filePath: string) {\n const absolutePath = path.resolve(path.isAbsolute(filePath) ? filePath : path.join(repoRoot, filePath));\n const portablePath = toPortableRelativePath(repoRoot, absolutePath);\n await access(absolutePath);\n const resolvedPath = await realpath(absolutePath);\n toPortableRelativePath(repoRoot, resolvedPath);\n const fileStat = await stat(absolutePath);\n return { portablePath, fileStat };\n}\n\nasync function requireReadableFile(repoRoot: string, filePath: string): Promise<string> {\n const { portablePath, fileStat } = await resolveReadablePath(repoRoot, filePath);\n if (!fileStat.isFile()) throw new Error(`Next.js adapter output is not a readable file: ${filePath}`);\n return portablePath;\n}\n\nasync function requireReadableAsset(repoRoot: string, filePath: string): Promise<string> {\n const { portablePath, fileStat } = await resolveReadablePath(repoRoot, filePath);\n if (!fileStat.isFile() && !fileStat.isDirectory()) {\n throw new Error(`Next.js adapter asset is not a readable file or directory: ${filePath}`);\n }\n return portablePath;\n}\n\nasync function serializeFileMap(repoRoot: string, files: Record<string, string>): Promise<Record<string, string>> {\n const entries = await Promise.all(\n Object.entries(files).map(async ([targetPath, sourcePath]) => [\n toPortableRelativePath(repoRoot, targetPath),\n await requireReadableAsset(repoRoot, sourcePath),\n ])\n );\n return Object.fromEntries(entries);\n}\n\nconst serializeRuntimeConfigAssets = async (\n projectDir: string,\n repoRoot: string,\n config: BuildCompleteContext['config']\n): Promise<Record<string, string>> => {\n const configuredPaths = new Set([\n config.cacheHandler,\n ...Object.values(config.cacheHandlers ?? {}),\n config.images.loaderFile,\n PPR_RUNTIME_PATH(),\n ]);\n const assets: Record<string, string> = {};\n for (const configuredPath of configuredPaths) {\n if (!configuredPath) continue;\n const absolutePath = path.resolve(\n path.isAbsolute(configuredPath) ? configuredPath : path.join(projectDir, configuredPath)\n );\n const portablePath = await requireReadableFile(repoRoot, absolutePath);\n assets[portablePath] = portablePath;\n }\n return assets;\n};\n\nconst serializeRouteOutput = async (repoRoot: string, output: NextRouteOutput): Promise<GigadriveNextRouteOutput> => {\n const matchers = (\n output.config as typeof output.config & {\n matchers?: Array<{\n source: string;\n sourceRegex: string;\n has?: unknown[];\n missing?: unknown[];\n }>;\n }\n ).matchers;\n return {\n id: output.id,\n type: String(output.type) as GigadriveNextRouteOutput['type'],\n filePath: await requireReadableFile(repoRoot, output.filePath),\n pathname: output.pathname,\n sourcePage: output.sourcePage,\n runtime: output.runtime,\n assets: await serializeFileMap(repoRoot, output.assets),\n ...(output.wasmAssets ? { wasmAssets: await serializeFileMap(repoRoot, output.wasmAssets) } : {}),\n ...(output.edgeRuntime\n ? {\n edgeRuntime: {\n modulePath: await requireReadableFile(repoRoot, output.edgeRuntime.modulePath),\n entryKey: output.edgeRuntime.entryKey,\n handlerExport: output.edgeRuntime.handlerExport,\n },\n }\n : {}),\n config: {\n maxDuration: output.config.maxDuration,\n preferredRegion: output.config.preferredRegion,\n env: output.config.env,\n ...(matchers\n ? {\n matchers: matchers.map((matcher) => ({\n source: matcher.source,\n sourceRegex: matcher.sourceRegex,\n ...(matcher.has ? { has: toJsonValue(matcher.has) as JsonValue[] } : {}),\n ...(matcher.missing ? { missing: toJsonValue(matcher.missing) as JsonValue[] } : {}),\n })),\n }\n : {}),\n },\n };\n};\n\nconst serializeStaticOutput = async (\n repoRoot: string,\n output: NextStaticOutput\n): Promise<GigadriveNextStaticOutput> => ({\n id: output.id,\n type: 'STATIC_FILE',\n filePath: await requireReadableFile(repoRoot, output.filePath),\n pathname: output.pathname,\n ...(output.immutableHash ? { immutableHash: output.immutableHash } : {}),\n});\n\nconst buildEntrypointPlan = (\n outputs: GigadriveNextRouteOutput[]\n): Pick<GigadriveNextBuildManifestV2, 'entrypoints' | 'outputEntrypoints'> => {\n const byIdentity = new Map<string, GigadriveNextEntrypoint>();\n const outputEntrypoints: Record<string, string> = {};\n\n for (const output of outputs) {\n const identity = JSON.stringify([\n output.type === 'MIDDLEWARE' ? 'middleware-web' : 'route',\n output.runtime,\n output.filePath,\n output.edgeRuntime?.modulePath,\n output.edgeRuntime?.entryKey,\n output.edgeRuntime?.handlerExport,\n ]);\n const existingEntrypoint = byIdentity.get(identity);\n const entrypoint: GigadriveNextEntrypoint = existingEntrypoint ?? {\n id: `next-${byIdentity.size}`,\n runtime: output.runtime,\n filePath: output.filePath,\n outputIds: [],\n assets: { ...output.assets },\n ...(output.wasmAssets ? { wasmAssets: { ...output.wasmAssets } } : {}),\n ...(output.edgeRuntime ? { edgeRuntime: { ...output.edgeRuntime } } : {}),\n config: {\n maxDuration: output.config.maxDuration,\n preferredRegion: output.config.preferredRegion,\n env: output.config.env,\n },\n };\n if (!existingEntrypoint) {\n byIdentity.set(identity, entrypoint);\n } else {\n Object.assign(entrypoint.assets, output.assets);\n if (output.wasmAssets) entrypoint.wasmAssets = { ...entrypoint.wasmAssets, ...output.wasmAssets };\n if (output.config.maxDuration !== undefined) {\n entrypoint.config.maxDuration = Math.max(entrypoint.config.maxDuration ?? 0, output.config.maxDuration);\n }\n }\n entrypoint.outputIds.push(output.id);\n outputEntrypoints[output.id] = entrypoint.id;\n }\n\n return { entrypoints: [...byIdentity.values()], outputEntrypoints };\n};\n\nconst writeEntrypointWrappers = async (\n projectDir: string,\n repoRoot: string,\n entrypoints: GigadriveNextEntrypoint[],\n pprRuntimePath: string,\n middlewareOutputId?: string\n): Promise<void> => {\n const wrapperDirectory = path.join(projectDir, '.gigadrive', 'nextjs', 'entrypoints');\n await mkdir(wrapperDirectory, { recursive: true });\n const portableWrapperDirectory = toPortableRelativePath(repoRoot, wrapperDirectory);\n const relativePprRuntimePath = path.posix.relative(portableWrapperDirectory, pprRuntimePath);\n const pprRuntimeSpecifier = relativePprRuntimePath.startsWith('.')\n ? relativePprRuntimePath\n : `./${relativePprRuntimePath}`;\n\n await Promise.all(\n entrypoints.map(async (entrypoint) => {\n const wrapperPath = path.join(wrapperDirectory, `${entrypoint.id}.mjs`);\n const executablePath = path.join(repoRoot, entrypoint.edgeRuntime?.modulePath ?? entrypoint.filePath);\n const relativeImport = path.relative(wrapperDirectory, executablePath).replaceAll(path.sep, '/');\n const importSpecifier = relativeImport.startsWith('.') ? relativeImport : `./${relativeImport}`;\n const isMiddleware = middlewareOutputId !== undefined && entrypoint.outputIds.includes(middlewareOutputId);\n const webHandlerPrelude =\n entrypoint.runtime === 'edge' && entrypoint.edgeRuntime\n ? (() => {\n const edgeMarker = '/server/edge/';\n const markerIndex = entrypoint.edgeRuntime.modulePath.indexOf(edgeMarker);\n const distDirectory =\n markerIndex >= 0\n ? entrypoint.edgeRuntime.modulePath.slice(0, markerIndex)\n : path.dirname(entrypoint.edgeRuntime.modulePath);\n const edgeRuntimeAssets = Object.entries(entrypoint.assets)\n .filter(([, sourcePath]) => sourcePath.startsWith(`${distDirectory}/`) && sourcePath.endsWith('.js'))\n .sort(([, leftSource], [, rightSource]) => {\n if (leftSource === entrypoint.edgeRuntime?.modulePath) return 1;\n if (rightSource === entrypoint.edgeRuntime?.modulePath) return -1;\n return leftSource.localeCompare(rightSource);\n });\n const imports = edgeRuntimeAssets\n .map(([targetPath, sourcePath]) => {\n // Next includes the executable Edge module in `assets` under a\n // deployment-relative target such as `server/edge/chunks/*`,\n // while `modulePath` retains its canonical `.next/server/*`\n // location. Function packaging installs the executable at the\n // canonical path, so the wrapper must import it there as well.\n const runtimeTargetPath =\n sourcePath === entrypoint.edgeRuntime?.modulePath ? entrypoint.edgeRuntime.modulePath : targetPath;\n const relativeAssetPath = path.posix.relative(portableWrapperDirectory, runtimeTargetPath);\n const assetSpecifier = relativeAssetPath.startsWith('.')\n ? relativeAssetPath\n : `./${relativeAssetPath}`;\n return ` await import(${JSON.stringify(assetSpecifier)});`;\n })\n .join('\\n');\n return `import { AsyncLocalStorage } from \"node:async_hooks\";\\n\\nconst resolveHandler = async () => {\\n globalThis.self ??= globalThis;\\n globalThis.AsyncLocalStorage ??= AsyncLocalStorage;\\n${imports}\\n const registry = globalThis._ENTRIES;\\n if (!registry) throw new Error('Next.js edge entry registry is unavailable');\\n const entry = await registry[${JSON.stringify(entrypoint.edgeRuntime.entryKey)}];\\n const handler = entry?.[${JSON.stringify(entrypoint.edgeRuntime.handlerExport)}];\\n if (typeof handler !== 'function') throw new Error('Next.js edge handler is unavailable');\\n return handler;\\n};`;\n })()\n : `import * as nextEntrypoint from ${JSON.stringify(importSpecifier)};\\n\\nconst resolveHandler = async () => {\\n const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);\\n const handler = nextEntrypoint.handler ?? loadedEntrypoint?.handler ?? loadedEntrypoint?.default?.handler ?? loadedEntrypoint?.default ?? loadedEntrypoint;\\n if (typeof handler !== 'function') throw new Error('Next.js middleware handler is unavailable');\\n return handler;\\n};`;\n const source =\n (entrypoint.runtime === 'edge' && entrypoint.edgeRuntime) || isMiddleware\n ? `import { persistPprCacheEntry } from ${JSON.stringify(pprRuntimeSpecifier)};\\n${webHandlerPrelude}\\n\\nexport async function fetch(request) {\\n const pending = [];\\n const handler = await resolveHandler();\\n const url = new URL(request.url);\\n const response = await handler(request, {\\n signal: request.signal,\\n waitUntil(promise) { pending.push(Promise.resolve(promise)); },\\n requestMeta: { hostname: url.hostname, invocationTarget: request.headers.get('x-gigadrive-next-invocation-target') ?? url.pathname, routeMatches: Object.fromEntries(new URLSearchParams(request.headers.get('x-now-route-matches') ?? '')), relativeProjectDir: ${JSON.stringify(\n toPortableRelativePath(repoRoot, projectDir, true)\n )}, onCacheEntryV2(cacheEntry, meta) { pending.push(persistPprCacheEntry(request.headers.get('x-gigadrive-next-cache-key') ?? meta.url ?? request.headers.get('x-matched-path') ?? url.pathname, cacheEntry)); return false; } },\\n });\\n if (!response.body) { await Promise.allSettled(pending); return response; }\\n const reader = response.body.getReader();\\n const body = new ReadableStream({\\n async pull(controller) {\\n const result = await reader.read();\\n if (result.done) { await Promise.allSettled(pending); controller.close(); return; }\\n controller.enqueue(result.value);\\n },\\n async cancel(reason) { try { await reader.cancel(reason); } finally { await Promise.allSettled(pending); } },\\n });\\n return new Response(body, response);\\n}\\n`\n : `import \"next/dist/build/adapter/setup-node-env.external.js\";\\nimport * as nextEntrypoint from ${JSON.stringify(importSpecifier)};\\nimport { persistPprCacheEntry, revalidateNextPath } from ${JSON.stringify(pprRuntimeSpecifier)};\\n\\nconst resolveHandler = async () => {\\n const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);\\n const handler = nextEntrypoint.handler ?? loadedEntrypoint?.handler ?? loadedEntrypoint?.default?.handler ?? loadedEntrypoint?.default ?? loadedEntrypoint;\\n if (typeof handler !== 'function') throw new Error('Next.js Node handler is unavailable');\\n return handler;\\n};\\n\\nexport default async function handler(req, res) {\\n const pending = [];\\n const nextHandler = await resolveHandler();\\n const hostname = Array.isArray(req.headers.host) ? req.headers.host[0] : req.headers.host;\\n await nextHandler(req, res, {\\n waitUntil(promise) { pending.push(Promise.resolve(promise)); },\\n requestMeta: { hostname, invocationTarget: req.headers['x-gigadrive-next-invocation-target'] ?? req.url, routeMatches: Object.fromEntries(new URLSearchParams(req.headers['x-now-route-matches'] ?? '')), relativeProjectDir: ${JSON.stringify(\n toPortableRelativePath(repoRoot, projectDir, true)\n )}, revalidate(input) { return revalidateNextPath({ ...input, hostname }); }, onCacheEntryV2(cacheEntry, meta) { const cacheKey = req.headers['x-gigadrive-next-cache-key']; const matchedPath = req.headers['x-matched-path']; pending.push(persistPprCacheEntry((Array.isArray(cacheKey) ? cacheKey[0] : cacheKey) ?? meta.url ?? (Array.isArray(matchedPath) ? matchedPath[0] : matchedPath) ?? req.url ?? '/', cacheEntry)); return false; } },\\n });\\n await Promise.allSettled(pending);\\n}\\n`;\n await writeFile(wrapperPath, source, 'utf8');\n const portableWrapperPath = toPortableRelativePath(repoRoot, wrapperPath);\n entrypoint.assets[portableWrapperPath] = portableWrapperPath;\n entrypoint.filePath = portableWrapperPath;\n })\n );\n};\n\nconst normalizeImages = (config: BuildCompleteContext['config']): NormalizedImagePolicy | undefined => {\n if (config.images.unoptimized) return undefined;\n return {\n localPatterns: config.images.localPatterns ?? [{ pathname: '/**' }],\n remotePatterns: config.images.remotePatterns.map((pattern) => {\n if (pattern instanceof URL) {\n return {\n protocol: pattern.protocol === 'http:' ? ('http' as const) : ('https' as const),\n hostname: pattern.hostname,\n port: pattern.port,\n pathname: pattern.pathname,\n search: pattern.search,\n };\n }\n return { ...pattern };\n }),\n widths: [...new Set([...config.images.deviceSizes, ...config.images.imageSizes])].sort((a, b) => a - b),\n heights: [],\n qualities: config.images.qualities ?? [75],\n formats: config.images.formats,\n minimumCacheTTL: config.images.minimumCacheTTL,\n dangerouslyAllowSVG: config.images.dangerouslyAllowSVG,\n contentSecurityPolicy: config.images.contentSecurityPolicy,\n contentDispositionType: config.images.contentDispositionType,\n maximumRedirects: config.images.maximumRedirects,\n maximumResponseBody: config.images.maximumResponseBody,\n variants: {},\n };\n};\n\n/**\n * Next.js deployment adapter used automatically by Gigadrive Network build workers.\n *\n * Next 16.2 and newer emit a portable, versioned runtime plan. Older releases retain\n * the standalone-server behavior because their experimental adapter context does not\n * expose the routing and runtime metadata required by the v2 contract.\n */\nconst gigadriveNextAdapter: NextAdapter = {\n name: 'Gigadrive Network',\n\n modifyConfig(config, { phase, nextVersion }) {\n if (phase !== PRODUCTION_BUILD_PHASE) return config;\n\n const deploymentId = config.deploymentId ?? process.env.GIGADRIVE_DEPLOYMENT_ID;\n if (!supportsAdapterV2(nextVersion)) {\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n output: config.output === 'export' ? 'export' : 'standalone',\n };\n }\n if (config.output === 'export') {\n return { ...config, ...(deploymentId ? { deploymentId } : {}) };\n }\n\n const injectCacheHandler = config.cacheHandler === undefined;\n const injectCacheComponentHandlers = config.cacheHandlers === undefined;\n const images = config.images;\n const injectImageLoader =\n images !== undefined && images.unoptimized !== true && images.loader === 'default' && !images.loaderFile;\n\n return {\n ...config,\n ...(deploymentId ? { deploymentId } : {}),\n ...(injectCacheHandler ? { cacheHandler: CACHE_HANDLER_PATH() } : {}),\n ...(injectCacheComponentHandlers\n ? {\n cacheHandlers: {\n default: CACHE_COMPONENTS_HANDLER_PATH(),\n remote: CACHE_COMPONENTS_HANDLER_PATH(),\n },\n }\n : {}),\n ...(injectCacheHandler || injectCacheComponentHandlers ? { cacheMaxMemorySize: 0 } : {}),\n ...(injectImageLoader\n ? {\n images: {\n ...images,\n loader: 'custom',\n loaderFile: IMAGE_LOADER_PATH(),\n },\n }\n : {}),\n };\n },\n\n async onBuildComplete({ projectDir, repoRoot, distDir, config, nextVersion, buildId, routing, outputs }) {\n const metadataDirectory = path.join(projectDir, '.gigadrive');\n if (!supportsAdapterV2(nextVersion)) {\n const manifest: GigadriveNextBuildManifestV1 = {\n version: 1,\n output: config.output === 'export' ? 'export' : 'standalone',\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir, true),\n nextVersion,\n buildId,\n };\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n return;\n }\n const portableOutputs = {\n pages: await Promise.all(outputs.pages.map((output) => serializeRouteOutput(repoRoot, output))),\n ...(outputs.middleware ? { middleware: await serializeRouteOutput(repoRoot, outputs.middleware) } : {}),\n appPages: await Promise.all(outputs.appPages.map((output) => serializeRouteOutput(repoRoot, output))),\n pagesApi: await Promise.all(outputs.pagesApi.map((output) => serializeRouteOutput(repoRoot, output))),\n appRoutes: await Promise.all(outputs.appRoutes.map((output) => serializeRouteOutput(repoRoot, output))),\n prerenders: await Promise.all(\n outputs.prerenders.map(async (output) => {\n const { bypassFor, ...prerenderConfig } = output.config;\n return {\n id: output.id,\n type: 'PRERENDER' as const,\n pathname: output.pathname,\n parentOutputId: output.parentOutputId,\n groupId: output.groupId,\n ...(output.pprChain ? { pprChain: output.pprChain } : {}),\n ...(output.parentFallbackMode !== undefined\n ? { parentFallbackMode: toJsonValue(output.parentFallbackMode) }\n : {}),\n ...(output.fallback\n ? {\n fallback: {\n ...(output.fallback.filePath\n ? { filePath: await requireReadableFile(repoRoot, output.fallback.filePath) }\n : {}),\n ...(output.fallback.initialStatus !== undefined\n ? { initialStatus: output.fallback.initialStatus }\n : {}),\n ...(output.fallback.initialHeaders ? { initialHeaders: output.fallback.initialHeaders } : {}),\n ...(output.fallback.initialExpiration !== undefined\n ? { initialExpiration: output.fallback.initialExpiration }\n : {}),\n ...(output.fallback.initialRevalidate !== undefined\n ? { initialRevalidate: output.fallback.initialRevalidate }\n : {}),\n ...(output.fallback.postponedState !== undefined\n ? { postponedState: output.fallback.postponedState }\n : {}),\n },\n }\n : {}),\n config: {\n ...prerenderConfig,\n ...(bypassFor ? { bypassFor: toJsonValue(bypassFor) as JsonValue[] } : {}),\n },\n };\n })\n ),\n staticFiles: await Promise.all(outputs.staticFiles.map((output) => serializeStaticOutput(repoRoot, output))),\n };\n const executableOutputs = [\n ...portableOutputs.pages,\n ...portableOutputs.pagesApi,\n ...portableOutputs.appPages,\n ...portableOutputs.appRoutes,\n ...(portableOutputs.middleware ? [portableOutputs.middleware] : []),\n ];\n const entrypointPlan = buildEntrypointPlan(executableOutputs);\n const runtimeConfigAssets = await serializeRuntimeConfigAssets(projectDir, repoRoot, config);\n for (const entrypoint of entrypointPlan.entrypoints) Object.assign(entrypoint.assets, runtimeConfigAssets);\n const pprRuntimePath = await requireReadableFile(repoRoot, PPR_RUNTIME_PATH());\n await writeEntrypointWrappers(\n projectDir,\n repoRoot,\n entrypointPlan.entrypoints,\n pprRuntimePath,\n portableOutputs.middleware?.id\n );\n const images = normalizeImages(config);\n const manifest: GigadriveNextBuildManifestV2 = {\n version: 2,\n mode: config.output === 'export' ? 'export' : 'adapter-v2',\n distDir: toPortableRelativePath(projectDir, distDir),\n repoRootToProject: toPortableRelativePath(repoRoot, projectDir, true),\n nextVersion,\n buildId,\n config: {\n basePath: config.basePath,\n trailingSlash: config.trailingSlash,\n cacheComponents: config.cacheComponents,\n ...(config.i18n ? { i18n: toJsonValue(config.i18n) } : {}),\n ...(images ? { images } : {}),\n },\n routing: {\n beforeMiddleware: toJsonValue(routing.beforeMiddleware) as JsonValue[],\n beforeFiles: toJsonValue(routing.beforeFiles) as JsonValue[],\n afterFiles: toJsonValue(routing.afterFiles) as JsonValue[],\n dynamicRoutes: toJsonValue(routing.dynamicRoutes) as JsonValue[],\n onMatch: toJsonValue(routing.onMatch) as JsonValue[],\n fallback: toJsonValue(routing.fallback) as JsonValue[],\n shouldNormalizeNextData: routing.shouldNormalizeNextData,\n rsc: toJsonValue(routing.rsc),\n },\n outputs: portableOutputs,\n ...entrypointPlan,\n };\n\n await mkdir(metadataDirectory, { recursive: true });\n await writeFile(path.join(metadataDirectory, 'nextjs.json'), `${JSON.stringify(manifest, null, 2)}\\n`, 'utf8');\n },\n};\n\nexport default gigadriveNextAdapter;\n"],"mappings":";AACA,SAAS,QAAQ,OAAO,UAAU,MAAM,iBAAiB;AACzD,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAoB9B,IAAM,yBAAyB;AAC/B,IAAM,mBAAmB,OAAO,cAAc,WAAW,YAAY,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAEhH,IAAM,oBAAoB,CAAC,iBAAyB,aAClD,QAAQ,IAAI,eAAe,KAAK,KAAK,KAAK,kBAAkB,QAAQ;AAEtE,IAAM,qBAAqB,MAAM,kBAAkB,qCAAqC,yBAAyB;AACjH,IAAM,gCAAgC,MACpC,kBAAkB,gDAAgD,oCAAoC;AACxG,IAAM,oBAAoB,MAAM,kBAAkB,oCAAoC,wBAAwB;AAC9G,IAAM,mBAAmB,MAAM,kBAAkB,mCAAmC,uBAAuB;AAE3G,IAAM,cAAc,CAAC,UAA8B;AACjD,QAAM,aAAa,KAAK,UAAU,KAAK;AACvC,SAAO,eAAe,SAAY,OAAQ,KAAK,MAAM,UAAU;AACjE;AAEA,IAAM,oBAAoB,CAAC,gBAA6C;AACtE,MAAI,CAAC,YAAa,QAAO;AACzB,QAAM,CAAC,WAAW,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