Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use destructured object for #61993 #61996

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions packages/next/src/server/dev/hot-reloader-turbopack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ export async function createHotReloaderTurbopack(
'instrumentation',
'instrumentation'
)
await writeManifests(
opts.fsChecker.rewrites,
await writeManifests({
rewrites: opts.fsChecker.rewrites,
distDir,
buildManifests,
appBuildManifests,
Expand All @@ -474,8 +474,8 @@ export async function createHotReloaderTurbopack(
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints
)
currentEntrypoints,
})

serverFields.actualInstrumentationHookFile = '/instrumentation'
await propagateServerField(
Expand Down Expand Up @@ -533,8 +533,8 @@ export async function createHotReloaderTurbopack(
'middleware',
serverFields.middleware
)
await writeManifests(
opts.fsChecker.rewrites,
await writeManifests({
rewrites: opts.fsChecker.rewrites,
distDir,
buildManifests,
appBuildManifests,
Expand All @@ -544,8 +544,8 @@ export async function createHotReloaderTurbopack(
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints
)
currentEntrypoints,
})

finishBuilding()
return { event: HMR_ACTIONS_SENT_TO_BROWSER.MIDDLEWARE_CHANGES }
Expand Down Expand Up @@ -592,8 +592,8 @@ export async function createHotReloaderTurbopack(
)
)
await currentEntriesHandling
await writeManifests(
opts.fsChecker.rewrites,
await writeManifests({
rewrites: opts.fsChecker.rewrites,
distDir,
buildManifests,
appBuildManifests,
Expand All @@ -603,8 +603,8 @@ export async function createHotReloaderTurbopack(
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints
)
currentEntrypoints,
})
const overlayMiddleware = getOverlayMiddleware(project)
const versionInfo: VersionInfo = await getVersionInfo(
isTestMode || opts.telemetry.isEnabled
Expand Down Expand Up @@ -840,8 +840,8 @@ export async function createHotReloaderTurbopack(
await loadPagesManifest(distDir, pagesManifests, '_error')
await loadFontManifest(distDir, fontManifests, '_error')

await writeManifests(
opts.fsChecker.rewrites,
await writeManifests({
rewrites: opts.fsChecker.rewrites,
distDir,
buildManifests,
appBuildManifests,
Expand All @@ -851,8 +851,8 @@ export async function createHotReloaderTurbopack(
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints
)
currentEntrypoints,
})
} finally {
finishBuilding()
}
Expand Down Expand Up @@ -888,8 +888,8 @@ export async function createHotReloaderTurbopack(

const finishBuilding = startBuilding(page, requestUrl)
try {
await handleRouteType(
opts.fsChecker.rewrites,
await handleRouteType({
rewrites: opts.fsChecker.rewrites,
distDir,
globalEntrypoints,
currentIssues,
Expand All @@ -906,8 +906,8 @@ export async function createHotReloaderTurbopack(
changeSubscription,
readyIds,
page,
route
)
route,
})
} finally {
finishBuilding()
}
Expand Down
117 changes: 74 additions & 43 deletions packages/next/src/server/dev/turbopack-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,19 +578,31 @@ async function writeLoadableManifest(
)
}

export async function writeManifests(
rewrites: SetupOpts['fsChecker']['rewrites'],
distDir: string,
buildManifests: BuildManifests,
appBuildManifests: AppBuildManifests,
pagesManifests: PagesManifests,
appPathsManifests: AppPathsManifests,
middlewareManifests: MiddlewareManifests,
actionManifests: ActionManifests,
fontManifests: FontManifests,
loadableManifests: LoadableManifests,
export async function writeManifests({
rewrites,
distDir,
buildManifests,
appBuildManifests,
pagesManifests,
appPathsManifests,
middlewareManifests,
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints,
}: {
rewrites: SetupOpts['fsChecker']['rewrites']
distDir: string
buildManifests: BuildManifests
appBuildManifests: AppBuildManifests
pagesManifests: PagesManifests
appPathsManifests: AppPathsManifests
middlewareManifests: MiddlewareManifests
actionManifests: ActionManifests
fontManifests: FontManifests
loadableManifests: LoadableManifests
currentEntrypoints: CurrentEntrypoints
): Promise<void> {
}): Promise<void> {
await writeBuildManifest(
distDir,
buildManifests,
Expand Down Expand Up @@ -778,26 +790,45 @@ export type ChangeSubscription = (

export type ReadyIds = Set<string>

export async function handleRouteType(
rewrites: SetupOpts['fsChecker']['rewrites'],
distDir: string,
globalEntrypoints: GlobalEntrypoints,
currentIssues: CurrentIssues,
buildManifests: BuildManifests,
appBuildManifests: AppBuildManifests,
pagesManifests: PagesManifests,
appPathsManifests: AppPathsManifests,
middlewareManifests: MiddlewareManifests,
actionManifests: ActionManifests,
fontManifests: FontManifests,
loadableManifests: LoadableManifests,
currentEntrypoints: CurrentEntrypoints,
handleRequireCacheClearing: HandleRequireCacheClearing | undefined,
changeSubscription: ChangeSubscription | undefined,
readyIds: ReadyIds,
page: string,
export async function handleRouteType({
rewrites,
distDir,
globalEntrypoints,
currentIssues,
buildManifests,
appBuildManifests,
pagesManifests,
appPathsManifests,
middlewareManifests,
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints,
handleRequireCacheClearing,
changeSubscription,
readyIds,
page,
route,
}: {
rewrites: SetupOpts['fsChecker']['rewrites']
distDir: string
globalEntrypoints: GlobalEntrypoints
currentIssues: CurrentIssues
buildManifests: BuildManifests
appBuildManifests: AppBuildManifests
pagesManifests: PagesManifests
appPathsManifests: AppPathsManifests
middlewareManifests: MiddlewareManifests
actionManifests: ActionManifests
fontManifests: FontManifests
loadableManifests: LoadableManifests
currentEntrypoints: CurrentEntrypoints
handleRequireCacheClearing: HandleRequireCacheClearing | undefined
changeSubscription: ChangeSubscription | undefined
readyIds: ReadyIds
page: string
route: Route
) {
}) {
switch (route.type) {
case 'page': {
try {
Expand Down Expand Up @@ -836,7 +867,7 @@ export async function handleRouteType(
await loadFontManifest(distDir, fontManifests, page, 'pages')
await loadLoadableManifest(distDir, loadableManifests, page, 'pages')

await writeManifests(
await writeManifests({
rewrites,
distDir,
buildManifests,
Expand All @@ -847,8 +878,8 @@ export async function handleRouteType(
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints
)
currentEntrypoints,
})

processIssues(currentIssues, page, writtenEndpoint)
} finally {
Expand Down Expand Up @@ -905,7 +936,7 @@ export async function handleRouteType(
}
await loadLoadableManifest(distDir, loadableManifests, page, 'pages')

await writeManifests(
await writeManifests({
rewrites,
distDir,
buildManifests,
Expand All @@ -916,8 +947,8 @@ export async function handleRouteType(
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints
)
currentEntrypoints,
})

processIssues(currentIssues, page, writtenEndpoint)

Expand Down Expand Up @@ -959,7 +990,7 @@ export async function handleRouteType(
await loadAppPathManifest(distDir, appPathsManifests, page, 'app')
await loadActionManifest(distDir, actionManifests, page)
await loadFontManifest(distDir, fontManifests, page, 'app')
await writeManifests(
await writeManifests({
rewrites,
distDir,
buildManifests,
Expand All @@ -970,8 +1001,8 @@ export async function handleRouteType(
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints
)
currentEntrypoints,
})

processIssues(currentIssues, page, writtenEndpoint, true)

Expand All @@ -995,7 +1026,7 @@ export async function handleRouteType(
middlewareManifests.delete(page)
}

await writeManifests(
await writeManifests({
rewrites,
distDir,
buildManifests,
Expand All @@ -1006,8 +1037,8 @@ export async function handleRouteType(
actionManifests,
fontManifests,
loadableManifests,
currentEntrypoints
)
currentEntrypoints,
})
processIssues(currentIssues, page, writtenEndpoint, true)

break
Expand Down
Loading