Skip to content

Commit dc88609

Browse files
authored
Use destructured object for vercel#61993 (vercel#61996)
## What? Applies the suggestion to use an object for the parameter from vercel#61993. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> Closes NEXT-2475
1 parent f4f0293 commit dc88609

File tree

2 files changed

+94
-63
lines changed

2 files changed

+94
-63
lines changed

packages/next/src/server/dev/hot-reloader-turbopack.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ export async function createHotReloaderTurbopack(
463463
'instrumentation',
464464
'instrumentation'
465465
)
466-
await writeManifests(
467-
opts.fsChecker.rewrites,
466+
await writeManifests({
467+
rewrites: opts.fsChecker.rewrites,
468468
distDir,
469469
buildManifests,
470470
appBuildManifests,
@@ -474,8 +474,8 @@ export async function createHotReloaderTurbopack(
474474
actionManifests,
475475
fontManifests,
476476
loadableManifests,
477-
currentEntrypoints
478-
)
477+
currentEntrypoints,
478+
})
479479

480480
serverFields.actualInstrumentationHookFile = '/instrumentation'
481481
await propagateServerField(
@@ -533,8 +533,8 @@ export async function createHotReloaderTurbopack(
533533
'middleware',
534534
serverFields.middleware
535535
)
536-
await writeManifests(
537-
opts.fsChecker.rewrites,
536+
await writeManifests({
537+
rewrites: opts.fsChecker.rewrites,
538538
distDir,
539539
buildManifests,
540540
appBuildManifests,
@@ -544,8 +544,8 @@ export async function createHotReloaderTurbopack(
544544
actionManifests,
545545
fontManifests,
546546
loadableManifests,
547-
currentEntrypoints
548-
)
547+
currentEntrypoints,
548+
})
549549

550550
finishBuilding()
551551
return { event: HMR_ACTIONS_SENT_TO_BROWSER.MIDDLEWARE_CHANGES }
@@ -592,8 +592,8 @@ export async function createHotReloaderTurbopack(
592592
)
593593
)
594594
await currentEntriesHandling
595-
await writeManifests(
596-
opts.fsChecker.rewrites,
595+
await writeManifests({
596+
rewrites: opts.fsChecker.rewrites,
597597
distDir,
598598
buildManifests,
599599
appBuildManifests,
@@ -603,8 +603,8 @@ export async function createHotReloaderTurbopack(
603603
actionManifests,
604604
fontManifests,
605605
loadableManifests,
606-
currentEntrypoints
607-
)
606+
currentEntrypoints,
607+
})
608608
const overlayMiddleware = getOverlayMiddleware(project)
609609
const versionInfo: VersionInfo = await getVersionInfo(
610610
isTestMode || opts.telemetry.isEnabled
@@ -840,8 +840,8 @@ export async function createHotReloaderTurbopack(
840840
await loadPagesManifest(distDir, pagesManifests, '_error')
841841
await loadFontManifest(distDir, fontManifests, '_error')
842842

843-
await writeManifests(
844-
opts.fsChecker.rewrites,
843+
await writeManifests({
844+
rewrites: opts.fsChecker.rewrites,
845845
distDir,
846846
buildManifests,
847847
appBuildManifests,
@@ -851,8 +851,8 @@ export async function createHotReloaderTurbopack(
851851
actionManifests,
852852
fontManifests,
853853
loadableManifests,
854-
currentEntrypoints
855-
)
854+
currentEntrypoints,
855+
})
856856
} finally {
857857
finishBuilding()
858858
}
@@ -888,8 +888,8 @@ export async function createHotReloaderTurbopack(
888888

889889
const finishBuilding = startBuilding(page, requestUrl)
890890
try {
891-
await handleRouteType(
892-
opts.fsChecker.rewrites,
891+
await handleRouteType({
892+
rewrites: opts.fsChecker.rewrites,
893893
distDir,
894894
globalEntrypoints,
895895
currentIssues,
@@ -906,8 +906,8 @@ export async function createHotReloaderTurbopack(
906906
changeSubscription,
907907
readyIds,
908908
page,
909-
route
910-
)
909+
route,
910+
})
911911
} finally {
912912
finishBuilding()
913913
}

packages/next/src/server/dev/turbopack-utils.ts

+74-43
Original file line numberDiff line numberDiff line change
@@ -578,19 +578,31 @@ async function writeLoadableManifest(
578578
)
579579
}
580580

581-
export async function writeManifests(
582-
rewrites: SetupOpts['fsChecker']['rewrites'],
583-
distDir: string,
584-
buildManifests: BuildManifests,
585-
appBuildManifests: AppBuildManifests,
586-
pagesManifests: PagesManifests,
587-
appPathsManifests: AppPathsManifests,
588-
middlewareManifests: MiddlewareManifests,
589-
actionManifests: ActionManifests,
590-
fontManifests: FontManifests,
591-
loadableManifests: LoadableManifests,
581+
export async function writeManifests({
582+
rewrites,
583+
distDir,
584+
buildManifests,
585+
appBuildManifests,
586+
pagesManifests,
587+
appPathsManifests,
588+
middlewareManifests,
589+
actionManifests,
590+
fontManifests,
591+
loadableManifests,
592+
currentEntrypoints,
593+
}: {
594+
rewrites: SetupOpts['fsChecker']['rewrites']
595+
distDir: string
596+
buildManifests: BuildManifests
597+
appBuildManifests: AppBuildManifests
598+
pagesManifests: PagesManifests
599+
appPathsManifests: AppPathsManifests
600+
middlewareManifests: MiddlewareManifests
601+
actionManifests: ActionManifests
602+
fontManifests: FontManifests
603+
loadableManifests: LoadableManifests
592604
currentEntrypoints: CurrentEntrypoints
593-
): Promise<void> {
605+
}): Promise<void> {
594606
await writeBuildManifest(
595607
distDir,
596608
buildManifests,
@@ -778,26 +790,45 @@ export type ChangeSubscription = (
778790

779791
export type ReadyIds = Set<string>
780792

781-
export async function handleRouteType(
782-
rewrites: SetupOpts['fsChecker']['rewrites'],
783-
distDir: string,
784-
globalEntrypoints: GlobalEntrypoints,
785-
currentIssues: CurrentIssues,
786-
buildManifests: BuildManifests,
787-
appBuildManifests: AppBuildManifests,
788-
pagesManifests: PagesManifests,
789-
appPathsManifests: AppPathsManifests,
790-
middlewareManifests: MiddlewareManifests,
791-
actionManifests: ActionManifests,
792-
fontManifests: FontManifests,
793-
loadableManifests: LoadableManifests,
794-
currentEntrypoints: CurrentEntrypoints,
795-
handleRequireCacheClearing: HandleRequireCacheClearing | undefined,
796-
changeSubscription: ChangeSubscription | undefined,
797-
readyIds: ReadyIds,
798-
page: string,
793+
export async function handleRouteType({
794+
rewrites,
795+
distDir,
796+
globalEntrypoints,
797+
currentIssues,
798+
buildManifests,
799+
appBuildManifests,
800+
pagesManifests,
801+
appPathsManifests,
802+
middlewareManifests,
803+
actionManifests,
804+
fontManifests,
805+
loadableManifests,
806+
currentEntrypoints,
807+
handleRequireCacheClearing,
808+
changeSubscription,
809+
readyIds,
810+
page,
811+
route,
812+
}: {
813+
rewrites: SetupOpts['fsChecker']['rewrites']
814+
distDir: string
815+
globalEntrypoints: GlobalEntrypoints
816+
currentIssues: CurrentIssues
817+
buildManifests: BuildManifests
818+
appBuildManifests: AppBuildManifests
819+
pagesManifests: PagesManifests
820+
appPathsManifests: AppPathsManifests
821+
middlewareManifests: MiddlewareManifests
822+
actionManifests: ActionManifests
823+
fontManifests: FontManifests
824+
loadableManifests: LoadableManifests
825+
currentEntrypoints: CurrentEntrypoints
826+
handleRequireCacheClearing: HandleRequireCacheClearing | undefined
827+
changeSubscription: ChangeSubscription | undefined
828+
readyIds: ReadyIds
829+
page: string
799830
route: Route
800-
) {
831+
}) {
801832
switch (route.type) {
802833
case 'page': {
803834
try {
@@ -836,7 +867,7 @@ export async function handleRouteType(
836867
await loadFontManifest(distDir, fontManifests, page, 'pages')
837868
await loadLoadableManifest(distDir, loadableManifests, page, 'pages')
838869

839-
await writeManifests(
870+
await writeManifests({
840871
rewrites,
841872
distDir,
842873
buildManifests,
@@ -847,8 +878,8 @@ export async function handleRouteType(
847878
actionManifests,
848879
fontManifests,
849880
loadableManifests,
850-
currentEntrypoints
851-
)
881+
currentEntrypoints,
882+
})
852883

853884
processIssues(currentIssues, page, writtenEndpoint)
854885
} finally {
@@ -905,7 +936,7 @@ export async function handleRouteType(
905936
}
906937
await loadLoadableManifest(distDir, loadableManifests, page, 'pages')
907938

908-
await writeManifests(
939+
await writeManifests({
909940
rewrites,
910941
distDir,
911942
buildManifests,
@@ -916,8 +947,8 @@ export async function handleRouteType(
916947
actionManifests,
917948
fontManifests,
918949
loadableManifests,
919-
currentEntrypoints
920-
)
950+
currentEntrypoints,
951+
})
921952

922953
processIssues(currentIssues, page, writtenEndpoint)
923954

@@ -959,7 +990,7 @@ export async function handleRouteType(
959990
await loadAppPathManifest(distDir, appPathsManifests, page, 'app')
960991
await loadActionManifest(distDir, actionManifests, page)
961992
await loadFontManifest(distDir, fontManifests, page, 'app')
962-
await writeManifests(
993+
await writeManifests({
963994
rewrites,
964995
distDir,
965996
buildManifests,
@@ -970,8 +1001,8 @@ export async function handleRouteType(
9701001
actionManifests,
9711002
fontManifests,
9721003
loadableManifests,
973-
currentEntrypoints
974-
)
1004+
currentEntrypoints,
1005+
})
9751006

9761007
processIssues(currentIssues, page, writtenEndpoint, true)
9771008

@@ -995,7 +1026,7 @@ export async function handleRouteType(
9951026
middlewareManifests.delete(page)
9961027
}
9971028

998-
await writeManifests(
1029+
await writeManifests({
9991030
rewrites,
10001031
distDir,
10011032
buildManifests,
@@ -1006,8 +1037,8 @@ export async function handleRouteType(
10061037
actionManifests,
10071038
fontManifests,
10081039
loadableManifests,
1009-
currentEntrypoints
1010-
)
1040+
currentEntrypoints,
1041+
})
10111042
processIssues(currentIssues, page, writtenEndpoint, true)
10121043

10131044
break

0 commit comments

Comments
 (0)