-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: refactor build context/webpack build step
- Loading branch information
1 parent
e5a9d38
commit fb5149b
Showing
3 changed files
with
107 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { LoadedEnvFiles } from '@next/env' | ||
import { Ora } from 'next/dist/compiled/ora' | ||
import { Rewrite } from '../lib/load-custom-routes' | ||
import { __ApiPreviewProps } from '../server/api-utils' | ||
import { NextConfigComplete } from '../server/config-shared' | ||
import { Span } from '../trace' | ||
import { TelemetryPlugin } from './webpack/plugins/telemetry-plugin' | ||
|
||
// a global object to store context for the current build | ||
// this is used to pass data between different steps of the build without having | ||
// to pass it through function arguments. | ||
// Not exhaustive, but should be extended to as needed whilst refactoring | ||
export const NextBuildContext: Partial<{ | ||
// core fields | ||
dir: string | ||
buildId: string | ||
config: NextConfigComplete | ||
appDir: string | ||
pagesDir: string | ||
rewrites: { | ||
fallback: Rewrite[] | ||
afterFiles: Rewrite[] | ||
beforeFiles: Rewrite[] | ||
} | ||
loadedEnvFiles: LoadedEnvFiles | ||
previewProps: __ApiPreviewProps | ||
mappedPages: | ||
| { | ||
[page: string]: string | ||
} | ||
| undefined | ||
mappedAppPages: | ||
| { | ||
[page: string]: string | ||
} | ||
| undefined | ||
mappedRootPaths: { | ||
[page: string]: string | ||
} | ||
|
||
// misc fields | ||
telemetryPlugin: TelemetryPlugin | ||
buildSpinner: Ora | ||
nextBuildSpan: Span | ||
|
||
// cli fields | ||
reactProductionProfiling: boolean | ||
noMangling: boolean | ||
appDirOnly: boolean | ||
}> = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters