Skip to content

Commit

Permalink
Merge branch 'canary' into react-18.3.0-canary-fc801116c-20230629
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle authored Jun 30, 2023
2 parents 2bf1f05 + 0123a9d commit 95c8b9c
Show file tree
Hide file tree
Showing 28 changed files with 73 additions and 64 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "13.4.8-canary.12"
"version": "13.4.8-canary.13"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
"dependencies": {
"@next/eslint-plugin-next": "13.4.8-canary.12",
"@next/eslint-plugin-next": "13.4.8-canary.13",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.42.0",
"eslint-import-resolver-node": "^0.3.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"description": "ESLint plugin for NextJS.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
12 changes: 6 additions & 6 deletions packages/next-swc/crates/next-core/js/src/entry/app/hydrate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ let initialServerDataWriter: ReadableStreamDefaultController | undefined =
let initialServerDataLoaded = false
let initialServerDataFlushed = false

function nextServerDataCallback(
seg: [isBootStrap: 0] | [isNotBootstrap: 1, responsePartial: string]
): number {
if (seg[0] === 0) {
type IsBootStrap = 0
type ResponsePartial = string
function nextServerDataCallback(seg: IsBootStrap | ResponsePartial): number {
if (seg === 0) {
initialServerDataBuffer = []
} else {
if (!initialServerDataBuffer)
throw new Error('Unexpected server data: missing bootstrap script.')

if (initialServerDataWriter) {
initialServerDataWriter.enqueue(encoder.encode(seg[1]))
initialServerDataWriter.enqueue(encoder.encode(seg))
} else {
initialServerDataBuffer.push(seg[1])
initialServerDataBuffer.push(seg)
}
}
return 0
Expand Down
8 changes: 4 additions & 4 deletions packages/next-swc/crates/next-core/js/types/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ declare global {

var __next_require__: (id: string) => any
var __next_chunk_load__: (id: string) => Promise
var __next_f: (
| [isBootStrap: 0]
| [isNotBootstrap: 1, responsePartial: string]
)[]

type isBootStrap = 0
type responsePartial = string
var __next_f: (isBootStrap | responsePartial)[]
var next: {
version: string
appDir?: boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -83,7 +83,7 @@
]
},
"dependencies": {
"@next/env": "13.4.8-canary.12",
"@next/env": "13.4.8-canary.13",
"@swc/helpers": "0.5.1",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
Expand Down Expand Up @@ -141,11 +141,11 @@
"@jest/types": "29.5.0",
"@napi-rs/cli": "2.14.7",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.4.8-canary.12",
"@next/polyfill-nomodule": "13.4.8-canary.12",
"@next/react-dev-overlay": "13.4.8-canary.12",
"@next/react-refresh-utils": "13.4.8-canary.12",
"@next/swc": "13.4.8-canary.12",
"@next/polyfill-module": "13.4.8-canary.13",
"@next/polyfill-nomodule": "13.4.8-canary.13",
"@next/react-dev-overlay": "13.4.8-canary.13",
"@next/react-refresh-utils": "13.4.8-canary.13",
"@next/swc": "13.4.8-canary.13",
"@opentelemetry/api": "1.4.1",
"@segment/ajv-human-errors": "2.1.2",
"@taskr/clear": "1.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type EdgeAppRouteLoaderQuery = {
}

const EdgeAppRouteLoader: webpack.LoaderDefinitionFunction<EdgeAppRouteLoaderQuery> =
async function (this) {
function (this) {
const {
page,
absolutePagePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function swapDistFolderWithEsmDistFolder(path: string) {
}

const edgeSSRLoader: webpack.LoaderDefinitionFunction<EdgeSSRLoaderQuery> =
async function edgeSSRLoader(this) {
function edgeSSRLoader(this) {
const {
dev,
page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type NextFlightClientEntryLoaderOptions = {
server: boolean | 'true' | 'false'
}

export default async function transformSource(this: any): Promise<string> {
export default function transformSource(this: any) {
let { modules, server }: NextFlightClientEntryLoaderOptions =
this.getOptions()
const isServer = server === 'true'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getRSCModuleInformation } from '../../analysis/get-page-static-info'
import { getModuleBuildInfo } from './get-module-build-info'

export default async function transformSource(
export default function transformSource(
this: any,
source: string,
sourceMap: any
Expand All @@ -11,8 +11,6 @@ export default async function transformSource(
throw new Error('Expected source to have been transformed to a string.')
}

const callback = this.async()

// Assign the RSC meta information to buildInfo.
const buildInfo = getModuleBuildInfo(this._module)
buildInfo.rsc = getRSCModuleInformation(source, false)
Expand All @@ -31,5 +29,5 @@ ${source}
`
}

return callback(null, source, sourceMap)
return this.callback(null, source, sourceMap)
}
12 changes: 6 additions & 6 deletions packages/next/src/client/app-index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ let initialServerDataWriter: ReadableStreamDefaultController | undefined =
let initialServerDataLoaded = false
let initialServerDataFlushed = false

function nextServerDataCallback(
seg: [isBootStrap: 0] | [isNotBootstrap: 1, responsePartial: string]
): void {
if (seg[0] === 0) {
type IsBootStrap = 0
type ResponsePartial = string
function nextServerDataCallback(seg: IsBootStrap | ResponsePartial): void {
if (seg === 0) {
initialServerDataBuffer = []
} else {
if (!initialServerDataBuffer)
throw new Error('Unexpected server data: missing bootstrap script.')

if (initialServerDataWriter) {
initialServerDataWriter.enqueue(encoder.encode(seg[1]))
initialServerDataWriter.enqueue(encoder.encode(seg))
} else {
initialServerDataBuffer.push(seg[1])
initialServerDataBuffer.push(seg)
}
}
}
Expand Down
12 changes: 7 additions & 5 deletions packages/next/src/client/components/error-boundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,21 @@ export class ErrorBoundaryHandler extends React.Component<
}

export default function GlobalError({ error }: { error: any }) {
const digest: string | undefined = error?.digest
return (
<html>
<head></head>
<body>
<div style={styles.error}>
<div>
<h2 style={styles.text}>
Application error: a client-side exception has occurred (see the
browser console for more information).
{`Application error: a ${
digest ? 'server' : 'client'
}-side exception has occurred (see the ${
digest ? 'server logs' : 'browser console'
} for more information).`}
</h2>
{error?.digest && (
<p style={styles.text}>{`Digest: ${error.digest}`}</p>
)}
{digest ? <p style={styles.text}>{`Digest: ${digest}`}</p> : null}
</div>
</div>
</body>
Expand Down
12 changes: 9 additions & 3 deletions packages/next/src/server/app-render/use-flight-response.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function useFlightResponse(
writer.write(
encodeText(
`${startScriptTag}(self.__next_f=self.__next_f||[]).push(${htmlEscapeJsonString(
JSON.stringify([0])
JSON.stringify(0)
)})</script>`
)
)
Expand All @@ -63,8 +63,14 @@ export function useFlightResponse(
writer.close()
} else {
const responsePartial = decodeText(value, textDecoder)
const scripts = `${startScriptTag}self.__next_f.push(${htmlEscapeJsonString(
JSON.stringify([1, responsePartial])
const scripts = `${startScriptTag}__next_f.push(${htmlEscapeJsonString(
// Since the inlined payload is always a JSON-ish encoded string with
// many double quotes, we can safely un-escape these quotes and use
// a single quote to wrap the string. This saves a lot of bytes.
JSON.stringify(responsePartial)
.replace(/\\"/g, '"')
.replace(/'/g, "\\'")
.replace(/(^")|("$)/g, "'")
)})</script>`

writer.write(encodeText(scripts))
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "13.4.8-canary.12",
"version": "13.4.8-canary.13",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/e2e/app-dir/app/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ createNextDescribe(
expect(
await browser.waitForElementByCss('body').elementByCss('h2').text()
).toBe(
'Application error: a client-side exception has occurred (see the browser console for more information).'
'Application error: a server-side exception has occurred (see the server logs for more information).'
)
expect(
await browser.waitForElementByCss('body').elementByCss('p').text()
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/app-dir/not-found/not-found.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ createNextDescribe(
})

it('should allow to have a valid /not-found route', async () => {
const html = await next.render('/not-found')
expect(html).toContain("I'm still a valid page")
const browser = await next.browser('/not-found')
await check(
() => browser.elementByCss('h1').text(),
`I'm still a valid page`
)
})

if (isNextDev) {
Expand Down

0 comments on commit 95c8b9c

Please sign in to comment.