Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
860c0281
Unverified
Commit
860c0281
authored
Jul 29, 2022
by
JJ Kasper
Committed by
GitHub
Jul 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add exportPathMap config type/schema field (#39171)
parent
b1a5821e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
+20
-6
index.ts
packages/next/export/index.ts
+2
-6
config-schema.ts
packages/next/server/config-schema.ts
+3
-0
config-shared.ts
packages/next/server/config-shared.ts
+15
-0
No files found.
packages/next/export/index.ts
View file @
860c0281
...
@@ -30,7 +30,7 @@ import {
...
@@ -30,7 +30,7 @@ import {
}
from
'../shared/lib/constants'
}
from
'../shared/lib/constants'
import
loadConfig
from
'../server/config'
import
loadConfig
from
'../server/config'
import
{
isTargetLikeServerless
}
from
'../server/utils'
import
{
isTargetLikeServerless
}
from
'../server/utils'
import
{
NextConfigComplete
}
from
'../server/config-shared'
import
{
ExportPathMap
,
NextConfigComplete
}
from
'../server/config-shared'
import
{
eventCliSession
}
from
'../telemetry/events'
import
{
eventCliSession
}
from
'../telemetry/events'
import
{
hasNextSupport
}
from
'../telemetry/ci-info'
import
{
hasNextSupport
}
from
'../telemetry/ci-info'
import
{
Telemetry
}
from
'../telemetry/storage'
import
{
Telemetry
}
from
'../telemetry/storage'
...
@@ -124,10 +124,6 @@ const createProgress = (total: number, label: string) => {
...
@@ -124,10 +124,6 @@ const createProgress = (total: number, label: string) => {
}
}
}
}
type
ExportPathMap
=
{
[
page
:
string
]:
{
page
:
string
;
query
?:
{
[
key
:
string
]:
string
}
}
}
interface
ExportOptions
{
interface
ExportOptions
{
outdir
:
string
outdir
:
string
silent
?:
boolean
silent
?:
boolean
...
@@ -318,7 +314,7 @@ export default async function exportApp(
...
@@ -318,7 +314,7 @@ export default async function exportApp(
`No "exportPathMap" found in "
${
nextConfig
.
configFile
}
". Generating map from "./pages"`
`No "exportPathMap" found in "
${
nextConfig
.
configFile
}
". Generating map from "./pages"`
)
)
}
}
nextConfig
.
exportPathMap
=
async
(
defaultMap
:
ExportPathMap
)
=>
{
nextConfig
.
exportPathMap
=
async
(
defaultMap
)
=>
{
return
defaultMap
return
defaultMap
}
}
}
}
...
...
packages/next/server/config-schema.ts
View file @
860c0281
...
@@ -391,6 +391,9 @@ const configSchema = {
...
@@ -391,6 +391,9 @@ const configSchema = {
},
},
type
:
'object'
,
type
:
'object'
,
},
},
exportPathMap
:
{
isFunction
:
true
,
}
as
any
,
future
:
{
future
:
{
additionalProperties
:
false
,
additionalProperties
:
false
,
properties
:
{},
properties
:
{},
...
...
packages/next/server/config-shared.ts
View file @
860c0281
...
@@ -148,11 +148,26 @@ export interface ExperimentalConfig {
...
@@ -148,11 +148,26 @@ export interface ExperimentalConfig {
largePageDataBytes
?:
number
largePageDataBytes
?:
number
}
}
export
type
ExportPathMap
=
{
[
path
:
string
]:
{
page
:
string
;
query
?:
Record
<
string
,
string
|
string
[]
>
}
}
/**
/**
* Next configuration object
* Next configuration object
* @see [configuration documentation](https://nextjs.org/docs/api-reference/next.config.js/introduction)
* @see [configuration documentation](https://nextjs.org/docs/api-reference/next.config.js/introduction)
*/
*/
export
interface
NextConfig
extends
Record
<
string
,
any
>
{
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
* Internationalization configuration
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment