Skip to content

Commit

Permalink
Merge branch 'canary' into fix/47299-rsc-in-jest
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Sep 4, 2023
2 parents f057bbc + fd91ac4 commit 8819e4b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
10 changes: 5 additions & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -30,8 +30,8 @@

/packages/next/src/build/ @timneutkens @ijjk @shuding @huozhi @vercel/web-tooling
/packages/next/src/telemetry/ @timneutkens @ijjk @shuding @padmaia
/packages/next-swc/ @timneutkens @ijjk @shuding @vercel/web-tooling
Cargo.toml @timneutkens @ijjk @shuding @vercel/web-tooling
Cargo.lock @timneutkens @ijjk @shuding @vercel/web-tooling
/.cargo/config.toml @timneutkens @ijjk @shuding @vercel/web-tooling
/.config/nextest.toml @timneutkens @ijjk @shuding @vercel/web-tooling
/packages/next-swc/ @timneutkens @ijjk @shuding @huozhi @vercel/web-tooling
Cargo.toml @timneutkens @ijjk @shuding @huozhi @vercel/web-tooling
Cargo.lock @timneutkens @ijjk @shuding @huozhi @vercel/web-tooling
/.cargo/config.toml @timneutkens @ijjk @shuding @huozhi @vercel/web-tooling
/.config/nextest.toml @timneutkens @ijjk @shuding @huozhi @vercel/web-tooling
2 changes: 1 addition & 1 deletion packages/next/src/client/page-bootstrap.ts
Expand Up @@ -17,7 +17,7 @@ export function pageBootrap(assetPrefix: string) {
let buildIndicatorHandler: (obj: Record<string, any>) => void = () => {}

function devPagesHmrListener(payload: any) {
if (payload.action === 'serverError' && payload.errorJSON) {
if (payload.action === 'serverError') {
const { stack, message } = JSON.parse(payload.errorJSON)
const error = new Error(message)
error.stack = stack
Expand Down
7 changes: 7 additions & 0 deletions packages/next/src/server/dev/hot-reloader-types.ts
Expand Up @@ -18,6 +18,12 @@ export const enum HMR_ACTIONS_SENT_TO_BROWSER {
PONG = 'pong',
DEV_PAGES_MANIFEST_UPDATE = 'devPagesManifestUpdate',
TURBOPACK_MESSAGE = 'turbopack-message',
SERVER_ERROR = 'serverError',
}

interface ServerErrorAction {
action: HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR
errorJSON: string
}

interface TurboPackMessageAction {
Expand Down Expand Up @@ -96,6 +102,7 @@ export type HMR_ACTION_TYPES =
| MiddlewareChangesAction
| ServerOnlyChangesAction
| DevPagesManifestUpdateAction
| ServerErrorAction

export interface NextJsHotReloaderInterface {
activeWebpackConfigs?: Array<Awaited<ReturnType<typeof getBaseWebpackConfig>>>
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/server/dev/hot-reloader-webpack.ts
Expand Up @@ -1385,6 +1385,7 @@ export default class HotReloader implements NextJsHotReloaderInterface {
})

this.onDemandEntries = onDemandEntryHandler({
hotReloader: this,
multiCompiler: this.multiCompiler,
pagesDir: this.pagesDir,
appDir: this.appDir,
Expand Down
14 changes: 8 additions & 6 deletions packages/next/src/server/dev/on-demand-entry-handler.ts
Expand Up @@ -35,6 +35,8 @@ import {
} from '../../shared/lib/constants'
import { RouteMatch } from '../future/route-matches/route-match'
import { isAppPageRouteMatch } from '../future/route-matches/app-page-route-match'
import { HMR_ACTIONS_SENT_TO_BROWSER } from './hot-reloader-types'
import HotReloader from './hot-reloader-webpack'

const debug = origDebug('next:on-demand-entry-handler')

Expand Down Expand Up @@ -498,6 +500,7 @@ async function findRoutePathData(
}

export function onDemandEntryHandler({
hotReloader,
maxInactiveAge,
multiCompiler,
nextConfig,
Expand All @@ -506,6 +509,7 @@ export function onDemandEntryHandler({
rootDir,
appDir,
}: {
hotReloader: HotReloader
maxInactiveAge: number
multiCompiler: webpack.MultiCompiler
nextConfig: NextConfigComplete
Expand Down Expand Up @@ -947,12 +951,10 @@ export function onDemandEntryHandler({

// New error occurred: buffered error is flushed and new error occurred
if (!bufferedHmrServerError && error) {
client.send(
JSON.stringify({
action: 'serverError',
errorJSON: stringifyError(error),
})
)
hotReloader.send({
action: HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR,
errorJSON: stringifyError(error),
})
bufferedHmrServerError = null
}

Expand Down

0 comments on commit 8819e4b

Please sign in to comment.