Skip to content

Commit 4eea6ab

Browse files
authored
Merge branch 'canary' into shu/gk4j
2 parents d3a2b43 + 11b01e0 commit 4eea6ab

File tree

42 files changed

+1817
-1424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1817
-1424
lines changed

.github/workflows/code_freeze.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
type:
5+
description: Enable/disable code freeze
6+
required: true
7+
type: choice
8+
options:
9+
- enable
10+
- disable
11+
12+
secrets:
13+
CODE_FREEZE_TOKEN:
14+
required: true
15+
16+
name: Code Freeze
17+
18+
env:
19+
NAPI_CLI_VERSION: 2.14.7
20+
TURBO_VERSION: 1.10.9
21+
NODE_MAINTENANCE_VERSION: 16
22+
NODE_LTS_VERSION: 18
23+
24+
jobs:
25+
start:
26+
runs-on: ubuntu-latest
27+
28+
environment: release-${{ github.event.inputs.releaseType }}
29+
steps:
30+
- name: Setup node
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: 18
34+
check-latest: true
35+
36+
- run: git clone https://github.com/vercel/next.js.git --depth=1 .
37+
38+
# https://github.com/actions/virtual-environments/issues/1187
39+
- name: tune linux network
40+
run: sudo ethtool -K eth0 tx off rx off
41+
42+
- run: node ./scripts/code-freeze.js --type ${{ github.event.inputs.type }}
43+
env:
44+
CODE_FREEZE_TOKEN: ${{ secrets.CODE_FREEZE_TOKEN }}

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
"registry": "https://registry.npmjs.org/"
1717
}
1818
},
19-
"version": "13.5.4-canary.9"
19+
"version": "13.5.4"
2020
}

packages/create-next-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-next-app",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"keywords": [
55
"react",
66
"next",

packages/eslint-config-next/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-next",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"description": "ESLint configuration used by Next.js.",
55
"main": "index.js",
66
"license": "MIT",
@@ -10,7 +10,7 @@
1010
},
1111
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
1212
"dependencies": {
13-
"@next/eslint-plugin-next": "13.5.4-canary.9",
13+
"@next/eslint-plugin-next": "13.5.4",
1414
"@rushstack/eslint-patch": "^1.3.3",
1515
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0",
1616
"eslint-import-resolver-node": "^0.3.6",

packages/eslint-plugin-next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/eslint-plugin-next",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"description": "ESLint plugin for Next.js.",
55
"main": "dist/index.js",
66
"license": "MIT",

packages/font/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/font",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"repository": {
55
"url": "vercel/next.js",
66
"directory": "packages/font"

packages/next-bundle-analyzer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/bundle-analyzer",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"main": "index.js",
55
"types": "index.d.ts",
66
"license": "MIT",

packages/next-codemod/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/codemod",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"license": "MIT",
55
"repository": {
66
"type": "git",

packages/next-env/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/env",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"keywords": [
55
"react",
66
"next",

packages/next-mdx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/mdx",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"main": "index.js",
55
"license": "MIT",
66
"repository": {

packages/next-plugin-storybook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/plugin-storybook",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"repository": {
55
"url": "vercel/next.js",
66
"directory": "packages/next-plugin-storybook"

packages/next-polyfill-module/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/polyfill-module",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
55
"main": "dist/polyfill-module.js",
66
"license": "MIT",

packages/next-polyfill-nomodule/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/polyfill-nomodule",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"description": "A polyfill for non-dead, nomodule browsers.",
55
"main": "dist/polyfill-nomodule.js",
66
"license": "MIT",

packages/next-swc/crates/core/src/server_actions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<C: Comments> ServerActions<C> {
110110
handler
111111
.struct_span_err(
112112
body.span,
113-
"It is not allowed to define inline \"use server\" annotated Server Actions in Client Components.\nTo use Server Actions in a Client Component, you can either export them from a separate file with \"use server\" at the top, or pass them down through props from a Server Component.\n\nRead more: https://nextjs.org/docs/app/api-reference/server-actions#with-client-components\n",
113+
"It is not allowed to define inline \"use server\" annotated Server Actions in Client Components.\nTo use Server Actions in a Client Component, you can either export them from a separate file with \"use server\" at the top, or pass them down through props from a Server Component.\n\nRead more: https://nextjs.org/docs/app/api-reference/functions/server-actions#with-client-components\n",
114114
)
115115
.emit()
116116
});

packages/next-swc/crates/core/tests/errors/server-actions/client-graph/1/output.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
x It is not allowed to define inline "use server" annotated Server Actions in Client Components.
33
| To use Server Actions in a Client Component, you can either export them from a separate file with "use server" at the top, or pass them down through props from a Server Component.
44
|
5-
| Read more: https://nextjs.org/docs/app/api-reference/server-actions#with-client-components
5+
| Read more: https://nextjs.org/docs/app/api-reference/functions/server-actions#with-client-components
66
|
77
,-[input.js:3:1]
88
3 | export default function App() {

packages/next-swc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/swc",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"private": true,
55
"scripts": {
66
"clean": "node ../../scripts/rm.mjs native",

packages/next/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next",
3-
"version": "13.5.4-canary.9",
3+
"version": "13.5.4",
44
"description": "The React Framework",
55
"main": "./dist/server/next.js",
66
"license": "MIT",
@@ -90,7 +90,7 @@
9090
]
9191
},
9292
"dependencies": {
93-
"@next/env": "13.5.4-canary.9",
93+
"@next/env": "13.5.4",
9494
"@swc/helpers": "0.5.2",
9595
"busboy": "1.6.0",
9696
"caniuse-lite": "^1.0.30001406",
@@ -144,11 +144,11 @@
144144
"@mswjs/interceptors": "0.23.0",
145145
"@napi-rs/cli": "2.16.2",
146146
"@napi-rs/triples": "1.1.0",
147-
"@next/polyfill-module": "13.5.4-canary.9",
148-
"@next/polyfill-nomodule": "13.5.4-canary.9",
149-
"@next/react-dev-overlay": "13.5.4-canary.9",
150-
"@next/react-refresh-utils": "13.5.4-canary.9",
151-
"@next/swc": "13.5.4-canary.9",
147+
"@next/polyfill-module": "13.5.4",
148+
"@next/polyfill-nomodule": "13.5.4",
149+
"@next/react-dev-overlay": "13.5.4",
150+
"@next/react-refresh-utils": "13.5.4",
151+
"@next/swc": "13.5.4",
152152
"@opentelemetry/api": "1.4.1",
153153
"@playwright/test": "^1.35.1",
154154
"@segment/ajv-human-errors": "2.1.2",

packages/next/src/build/build-context.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type { __ApiPreviewProps } from '../server/api-utils'
55
import type { NextConfigComplete } from '../server/config-shared'
66
import type { Span } from '../trace'
77
import type getBaseWebpackConfig from './webpack-config'
8-
import type { PagesManifest } from './webpack/plugins/pages-manifest-plugin'
98
import type { TelemetryPlugin } from './webpack/plugins/telemetry-plugin'
109

1110
// A layer for storing data that is used by plugins to communicate with each
@@ -48,12 +47,6 @@ export function getPluginState() {
4847
export const NextBuildContext: Partial<{
4948
compilerIdx?: number
5049
pluginState: Record<string, any>
51-
serializedPagesManifestEntries: {
52-
edgeServerPages?: PagesManifest
53-
nodeServerPages?: PagesManifest
54-
edgeServerAppPaths?: PagesManifest
55-
nodeServerAppPaths?: PagesManifest
56-
}
5750
// core fields
5851
dir: string
5952
buildId: string

packages/next/src/build/collect-build-traces.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Span } from '../trace'
1+
import { Span } from '../trace'
22
import type { NextConfigComplete } from '../server/config-shared'
33

44
import {
@@ -18,20 +18,23 @@ import { PageInfo } from './utils'
1818
import { loadBindings } from './swc'
1919
import { nonNullable } from '../lib/non-nullable'
2020
import * as ciEnvironment from '../telemetry/ci-info'
21+
import debugOriginal from 'next/dist/compiled/debug'
2122
import { isMatch } from 'next/dist/compiled/micromatch'
2223
import { defaultOverrides } from '../server/require-hook'
2324
import { nodeFileTrace } from 'next/dist/compiled/@vercel/nft'
2425
import { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'
2526
import { normalizeAppPath } from '../shared/lib/router/utils/app-paths'
2627

28+
const debug = debugOriginal('next:build:build-traces')
29+
2730
export async function collectBuildTraces({
2831
dir,
2932
config,
3033
distDir,
3134
pageKeys,
3235
pageInfos,
3336
staticPages,
34-
nextBuildSpan,
37+
nextBuildSpan = new Span({ name: 'build' }),
3538
hasSsrAmpPages,
3639
buildTraceContext,
3740
outputFileTracingRoot,
@@ -42,14 +45,16 @@ export async function collectBuildTraces({
4245
app?: string[]
4346
pages: string[]
4447
}
45-
staticPages: Set<string>
48+
staticPages: string[]
4649
hasSsrAmpPages: boolean
4750
outputFileTracingRoot: string
48-
pageInfos: Map<string, PageInfo>
49-
nextBuildSpan: Span
51+
pageInfos: [string, PageInfo][]
52+
nextBuildSpan?: Span
5053
config: NextConfigComplete
5154
buildTraceContext?: BuildTraceContext
5255
}) {
56+
const startTime = Date.now()
57+
debug('starting build traces')
5358
let turboTasksForTrace: unknown
5459
let bindings = await loadBindings()
5560

@@ -99,7 +104,7 @@ export async function collectBuildTraces({
99104
// The turbo trace doesn't provide the traced file type and reason at present
100105
// let's write the traced files into the first [entry].nft.json
101106
const [[, entryName]] = Array.from<[string, string]>(
102-
entryNameMap.entries()
107+
Object.entries(entryNameMap)
103108
).filter(([k]) => k.startsWith(buildTraceContextAppDir))
104109
const traceOutputPath = path.join(
105110
outputPath,
@@ -119,7 +124,7 @@ export async function collectBuildTraces({
119124
const outputPagesPath = path.join(outputPath, '..', 'pages')
120125
return (
121126
!f.startsWith(outputPagesPath) ||
122-
!staticPages.has(
127+
!staticPages.includes(
123128
// strip `outputPagesPath` and file ext from absolute
124129
f.substring(outputPagesPath.length, f.length - 3)
125130
)
@@ -369,10 +374,13 @@ export async function collectBuildTraces({
369374
}
370375
}
371376

377+
const { entryNameFilesMap } = buildTraceContext?.chunksTrace || {}
378+
372379
await Promise.all(
373380
[
374-
...(buildTraceContext?.chunksTrace?.entryNameFilesMap.entries() ||
375-
new Map()),
381+
...(entryNameFilesMap
382+
? Object.entries(entryNameFilesMap)
383+
: new Map()),
376384
].map(async ([entryName, entryNameFiles]) => {
377385
const isApp = entryName.startsWith('app/')
378386
const isPages = entryName.startsWith('pages/')
@@ -387,7 +395,7 @@ export async function collectBuildTraces({
387395

388396
// we don't need to trace for automatically statically optimized
389397
// pages as they don't have server bundles
390-
if (staticPages.has(route)) {
398+
if (staticPages.includes(route)) {
391399
return
392400
}
393401
const entryOutputPath = path.join(
@@ -504,7 +512,7 @@ export async function collectBuildTraces({
504512

505513
for (let page of pageKeys.pages) {
506514
// edge routes have no trace files
507-
const pageInfo = pageInfos.get(page)
515+
const [, pageInfo] = pageInfos.find((item) => item[0] === page) || []
508516
if (pageInfo?.runtime === 'edge') {
509517
continue
510518
}
@@ -584,4 +592,6 @@ export async function collectBuildTraces({
584592
)
585593
}
586594
})
595+
596+
debug(`finished build tracing ${Date.now() - startTime}ms`)
587597
}

packages/next/src/build/handle-externals.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,10 @@ export function makeExternalHandler({
301301
return resolveResult.localRes
302302
}
303303

304-
if (request === 'styled-jsx/style' && !isAppLayer) {
305-
return `commonjs ${defaultOverrides['styled-jsx/style']}`
304+
// Forcedly resolve the styled-jsx installed by next.js,
305+
// since `resolveExternal` cannot find the styled-jsx dep with pnpm
306+
if (request === 'styled-jsx/style') {
307+
resolveResult.res = defaultOverrides['styled-jsx/style']
306308
}
307309

308310
const { res, isEsm } = resolveResult

0 commit comments

Comments
 (0)