Unverified Commit 860c0281 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Add exportPathMap config type/schema field (#39171)

parent b1a5821e
......@@ -30,7 +30,7 @@ import {
} from '../shared/lib/constants'
import loadConfig from '../server/config'
import { isTargetLikeServerless } from '../server/utils'
import { NextConfigComplete } from '../server/config-shared'
import { ExportPathMap, NextConfigComplete } from '../server/config-shared'
import { eventCliSession } from '../telemetry/events'
import { hasNextSupport } from '../telemetry/ci-info'
import { Telemetry } from '../telemetry/storage'
......@@ -124,10 +124,6 @@ const createProgress = (total: number, label: string) => {
}
}
type ExportPathMap = {
[page: string]: { page: string; query?: { [key: string]: string } }
}
interface ExportOptions {
outdir: string
silent?: boolean
......@@ -318,7 +314,7 @@ export default async function exportApp(
`No "exportPathMap" found in "${nextConfig.configFile}". Generating map from "./pages"`
)
}
nextConfig.exportPathMap = async (defaultMap: ExportPathMap) => {
nextConfig.exportPathMap = async (defaultMap) => {
return defaultMap
}
}
......
......@@ -391,6 +391,9 @@ const configSchema = {
},
type: 'object',
},
exportPathMap: {
isFunction: true,
} as any,
future: {
additionalProperties: false,
properties: {},
......
......@@ -148,11 +148,26 @@ export interface ExperimentalConfig {
largePageDataBytes?: number
}
export type ExportPathMap = {
[path: string]: { page: string; query?: Record<string, string | string[]> }
}
/**
* Next configuration object
* @see [configuration documentation](https://nextjs.org/docs/api-reference/next.config.js/introduction)
*/
export interface NextConfig extends Record<string, any> {
exportPathMap?: (
defaultMap: ExportPathMap,
ctx: {
dev: boolean
dir: string
outDir: string | null
distDir: string
buildId: string
}
) => Promise<ExportPathMap> | ExportPathMap
/**
* Internationalization configuration
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment