Skip to content

Commit

Permalink
Rename logWellKnownErrors to logErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Apr 10, 2024
1 parent bb6fe19 commit 87a5bec
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 74 deletions.
8 changes: 4 additions & 4 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ export default async function build(
manifestLoader,
nextConfig: config,
rewrites: emptyRewritesObjToBeImplemented,
logWellKnownErrors: false,
logErrors: false,
})

const progress = createProgress(
Expand Down Expand Up @@ -1489,7 +1489,7 @@ export default async function build(
entrypoints: currentEntrypoints,
manifestLoader,
rewrites: emptyRewritesObjToBeImplemented,
logWellKnownErrors: false,
logErrors: false,
})
)
}
Expand All @@ -1505,7 +1505,7 @@ export default async function build(
entrypoints: currentEntrypoints,
manifestLoader,
rewrites: emptyRewritesObjToBeImplemented,
logWellKnownErrors: false,
logErrors: false,
})
)
}
Expand All @@ -1516,7 +1516,7 @@ export default async function build(
entrypoints: currentEntrypoints,
manifestLoader,
rewrites: emptyRewritesObjToBeImplemented,
logWellKnownErrors: false,
logErrors: false,
})
)
await Promise.all(promises)
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/server/dev/hot-reloader-turbopack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ export async function createHotReloaderTurbopack(
manifestLoader,
nextConfig: opts.nextConfig,
rewrites: opts.fsChecker.rewrites,
logWellKnownErrors: true,
logErrors: true,

dev: {
assetMapper,
Expand Down Expand Up @@ -779,7 +779,7 @@ export async function createHotReloaderTurbopack(
entrypoints: currentEntrypoints,
manifestLoader,
rewrites: opts.fsChecker.rewrites,
logWellKnownErrors: true,
logErrors: true,

hooks: {
subscribeToChanges,
Expand Down Expand Up @@ -832,7 +832,7 @@ export async function createHotReloaderTurbopack(
manifestLoader,
readyIds,
rewrites: opts.fsChecker.rewrites,
logWellKnownErrors: true,
logErrors: true,

hooks: {
subscribeToChanges,
Expand Down
86 changes: 19 additions & 67 deletions packages/next/src/server/dev/turbopack-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export function processIssues(
key: EntryKey,
result: TurbopackResult,
throwIssue: boolean,
logWellKnownErrors: boolean
logErrors: boolean
) {
const newIssues = new Map<IssueKey, Issue>()
currentEntryIssues.set(key, newIssues)
Expand All @@ -203,7 +203,7 @@ export function processIssues(

if (issue.severity !== 'warning') {
relevantIssues.add(formatted)
if (logWellKnownErrors && isWellKnownError(issue)) {
if (logErrors && isWellKnownError(issue)) {
Log.error(formatted)
}
}
Expand Down Expand Up @@ -304,7 +304,7 @@ export async function handleRouteType({
readyIds,
rewrites,
hooks,
logWellKnownErrors,
logErrors,
}: {
dev: boolean
page: string
Expand All @@ -315,7 +315,7 @@ export async function handleRouteType({
entrypoints: Entrypoints
manifestLoader: TurbopackManifestLoader
rewrites: SetupOpts['fsChecker']['rewrites']
logWellKnownErrors: boolean
logErrors: boolean

readyIds?: ReadyIds // dev

Expand All @@ -337,7 +337,7 @@ export async function handleRouteType({
key,
writtenEndpoint,
false,
logWellKnownErrors
logErrors
)
}
await manifestLoader.loadBuildManifest('_app')
Expand All @@ -354,7 +354,7 @@ export async function handleRouteType({
key,
writtenEndpoint,
false,
logWellKnownErrors
logErrors
)
}
await manifestLoader.loadPagesManifest('_document')
Expand Down Expand Up @@ -385,7 +385,7 @@ export async function handleRouteType({
serverKey,
writtenEndpoint,
false,
logWellKnownErrors
logErrors
)
} finally {
// TODO subscriptions should only be caused by the WebSocket connections
Expand Down Expand Up @@ -438,13 +438,7 @@ export async function handleRouteType({
pageEntrypoints: entrypoints.page,
})

processIssues(
currentEntryIssues,
key,
writtenEndpoint,
true,
logWellKnownErrors
)
processIssues(currentEntryIssues, key, writtenEndpoint, true, logErrors)

break
}
Expand Down Expand Up @@ -488,13 +482,7 @@ export async function handleRouteType({
pageEntrypoints: entrypoints.page,
})

processIssues(
currentEntryIssues,
key,
writtenEndpoint,
dev,
logWellKnownErrors
)
processIssues(currentEntryIssues, key, writtenEndpoint, dev, logErrors)

break
}
Expand All @@ -517,13 +505,7 @@ export async function handleRouteType({
rewrites,
pageEntrypoints: entrypoints.page,
})
processIssues(
currentEntryIssues,
key,
writtenEndpoint,
true,
logWellKnownErrors
)
processIssues(currentEntryIssues, key, writtenEndpoint, true, logErrors)

break
}
Expand Down Expand Up @@ -677,7 +659,7 @@ export async function handleEntrypoints({
manifestLoader,
nextConfig,
rewrites,
logWellKnownErrors,
logErrors,
dev,
}: {
entrypoints: TurbopackResult<RawEntrypoints>
Expand All @@ -688,7 +670,7 @@ export async function handleEntrypoints({
manifestLoader: TurbopackManifestLoader
nextConfig: NextConfigComplete
rewrites: SetupOpts['fsChecker']['rewrites']
logWellKnownErrors: boolean
logErrors: boolean

dev?: HandleEntrypointsDevOpts
}) {
Expand Down Expand Up @@ -766,13 +748,7 @@ export async function handleEntrypoints({

const writtenEndpoint = await instrumentation[prop].writeToDisk()
dev?.hooks.handleWrittenEndpoint(key, writtenEndpoint)
processIssues(
currentEntryIssues,
key,
writtenEndpoint,
false,
logWellKnownErrors
)
processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)
}
await processInstrumentation('instrumentation.nodeJs', 'nodeJs')
await processInstrumentation('instrumentation.edge', 'edge')
Expand Down Expand Up @@ -810,13 +786,7 @@ export async function handleEntrypoints({
async function processMiddleware() {
const writtenEndpoint = await endpoint.writeToDisk()
dev?.hooks.handleWrittenEndpoint(key, writtenEndpoint)
processIssues(
currentEntryIssues,
key,
writtenEndpoint,
false,
logWellKnownErrors
)
processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)
await manifestLoader.loadMiddlewareManifest('middleware', 'middleware')
if (dev) {
dev.serverFields.middleware = {
Expand Down Expand Up @@ -939,15 +909,15 @@ export async function handlePagesErrorRoute({
entrypoints,
manifestLoader,
rewrites,
logWellKnownErrors,
logErrors,

hooks,
}: {
currentEntryIssues: EntryIssuesMap
entrypoints: Entrypoints
manifestLoader: TurbopackManifestLoader
rewrites: SetupOpts['fsChecker']['rewrites']
logWellKnownErrors: boolean
logErrors: boolean

hooks?: HandleRouteTypeHooks // dev
}) {
Expand All @@ -961,13 +931,7 @@ export async function handlePagesErrorRoute({
// https://github.com/vercel/next.js/blob/08d7a7e5189a835f5dcb82af026174e587575c0e/packages/next/src/client/page-bootstrap.ts#L69-L71
return { event: HMR_ACTIONS_SENT_TO_BROWSER.CLIENT_CHANGES }
})
processIssues(
currentEntryIssues,
key,
writtenEndpoint,
false,
logWellKnownErrors
)
processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)
}
await manifestLoader.loadBuildManifest('_app')
await manifestLoader.loadPagesManifest('_app')
Expand All @@ -981,13 +945,7 @@ export async function handlePagesErrorRoute({
hooks?.subscribeToChanges(key, false, entrypoints.global.document, () => {
return { action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE }
})
processIssues(
currentEntryIssues,
key,
writtenEndpoint,
false,
logWellKnownErrors
)
processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)
}
await manifestLoader.loadPagesManifest('_document')

Expand All @@ -1001,13 +959,7 @@ export async function handlePagesErrorRoute({
// https://github.com/vercel/next.js/blob/08d7a7e5189a835f5dcb82af026174e587575c0e/packages/next/src/client/page-bootstrap.ts#L69-L71
return { event: HMR_ACTIONS_SENT_TO_BROWSER.CLIENT_CHANGES }
})
processIssues(
currentEntryIssues,
key,
writtenEndpoint,
false,
logWellKnownErrors
)
processIssues(currentEntryIssues, key, writtenEndpoint, false, logErrors)
}
await manifestLoader.loadBuildManifest('_error')
await manifestLoader.loadPagesManifest('_error')
Expand Down

0 comments on commit 87a5bec

Please sign in to comment.