Skip to content

Commit 414737e

Browse files
committed
Merge branch 'canary' into fix/infinite-error-rendering
2 parents c326a64 + 57ed93b commit 414737e

File tree

575 files changed

+23916
-17575
lines changed

Some content is hidden

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

575 files changed

+23916
-17575
lines changed

.github/actions/next-stats-action/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"node-fetch": "^2.6.0",
1414
"prettier": "^1.18.2",
1515
"pretty-bytes": "^5.3.0",
16-
"pretty-ms": "^5.0.0"
16+
"pretty-ms": "^5.0.0",
17+
"semver": "7.3.4"
1718
}
1819
}

.github/actions/next-stats-action/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
7474
logger('Release detected, resetting mainRepo to last stable tag')
7575
const lastStableTag = await getLastStable(mainRepoDir, actionInfo.prRef)
7676
if (!lastStableTag) throw new Error('failed to get last stable tag')
77+
console.log('using latestStable', lastStableTag)
7778
await checkoutRef(lastStableTag, mainRepoDir)
7879

7980
/* eslint-disable-next-line */

.github/actions/next-stats-action/src/prepare/repo-setup.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const fs = require('fs-extra')
33
const exec = require('../util/exec')
44
const { remove } = require('fs-extra')
55
const logger = require('../util/logger')
6+
const semver = require('semver')
67

78
module.exports = (actionInfo) => {
89
return {
@@ -22,8 +23,9 @@ module.exports = (actionInfo) => {
2223
const curTag = tags[i]
2324
// stable doesn't include `-canary` or `-beta`
2425
if (!curTag.includes('-') && !ref.includes(curTag)) {
25-
lastStableTag = curTag
26-
break
26+
if (!lastStableTag || semver.gt(curTag, lastStableTag)) {
27+
lastStableTag = curTag
28+
}
2729
}
2830
}
2931
return lastStableTag

.github/workflows/build_test_deploy.yml

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ jobs:
1515
docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }}
1616
steps:
1717
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 25
20+
1821
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
1922
- run: yarn install --frozen-lockfile --check-files
2023
- run: node run-tests.js --timings --write-timings -g 1/1
2124
- name: Check docs only change
22-
run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'docs-only')
25+
run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
2326
id: docs-change
2427
- run: echo ${{steps.docs-change.outputs.DOCS_CHANGE}}
2528
- uses: actions/cache@v2
@@ -47,13 +50,13 @@ jobs:
4750
NEXT_TELEMETRY_DISABLED: 1
4851
steps:
4952
- uses: actions/cache@v2
50-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
53+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
5154
id: restore-build
5255
with:
5356
path: ./*
5457
key: ${{ github.sha }}
5558
- run: ./check-pre-compiled.sh
56-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
59+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
5760

5861
testUnit:
5962
name: Test Unit
@@ -65,14 +68,14 @@ jobs:
6568
HEADLESS: true
6669
steps:
6770
- uses: actions/cache@v2
68-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
71+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
6972
id: restore-build
7073
with:
7174
path: ./*
7275
key: ${{ github.sha }}
7376

7477
- run: node run-tests.js --timings --type unit -g 1/1
75-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
78+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
7679

7780
testIntegration:
7881
name: Test Integration
@@ -89,18 +92,18 @@ jobs:
8992
steps:
9093
- run: echo ${{needs.build.outputs.docsChange}}
9194
- uses: actions/cache@v2
92-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
95+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
9396
id: restore-build
9497
with:
9598
path: ./*
9699
key: ${{ github.sha }}
97100

98101
# TODO: remove after we fix watchpack watching too much
99102
- run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
100-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
103+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
101104

102105
- run: xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/6 -c 3
103-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
106+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
104107

105108
testElectron:
106109
name: Test Electron
@@ -113,21 +116,21 @@ jobs:
113116
TEST_ELECTRON: 1
114117
steps:
115118
- uses: actions/cache@v2
116-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
119+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
117120
id: restore-build
118121
with:
119122
path: ./*
120123
key: ${{ github.sha }}
121124

122125
# TODO: remove after we fix watchpack watching too much
123126
- run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
124-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
127+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
125128

126129
- run: yarn add -W --dev spectron@7.0.0 electron@5.0.0
127-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
130+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
128131

129132
- run: xvfb-run node run-tests.js test/integration/with-electron/test/index.test.js
130-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
133+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
131134

132135
testYarnPnP:
133136
runs-on: ubuntu-latest
@@ -136,15 +139,17 @@ jobs:
136139
YARN_COMPRESSION_LEVEL: '0'
137140
steps:
138141
- uses: actions/checkout@v2
142+
with:
143+
fetch-depth: 25
139144

140-
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'docs-only')
145+
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
141146
id: docs-change
142147

143148
- run: yarn install --frozen-lockfile --check-files
144-
if: ${{steps.docs-change.outputs.DOCS_CHANGE != 'docs-only'}}
149+
if: ${{steps.docs-change.outputs.DOCS_CHANGE != 'docs only change'}}
145150

146151
- run: bash ./test-pnp.sh
147-
if: ${{steps.docs-change.outputs.DOCS_CHANGE != 'docs-only'}}
152+
if: ${{steps.docs-change.outputs.DOCS_CHANGE != 'docs only change'}}
148153

149154
testsPass:
150155
name: thank you, next
@@ -160,22 +165,24 @@ jobs:
160165
NEXT_TELEMETRY_DISABLED: 1
161166
NEXT_TEST_JOB: 1
162167
HEADLESS: true
163-
NEXT_WEBPACK5: 1
168+
NEXT_PRIVATE_TEST_WEBPACK5_MODE: 1
164169

165170
steps:
166171
- uses: actions/checkout@v2
172+
with:
173+
fetch-depth: 25
167174

168-
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'docs-only')
175+
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
169176
id: docs-change
170177

171178
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
172-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
179+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
173180

174181
- run: yarn install --check-files
175-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
182+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
176183

177-
- run: xvfb-run node run-tests.js test/integration/{link-ref,production,basic,async-modules,font-optimization,ssr-ctx,worker-loader}/test/index.test.js test/acceptance/*.test.js
178-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
184+
- run: xvfb-run node run-tests.js test/integration/{link-ref,production,basic,async-modules,font-optimization,ssr-ctx}/test/index.test.js test/acceptance/*.test.js
185+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
179186

180187
testLegacyReact:
181188
name: React 16 + Webpack 4 (Basic, Production, Acceptance)
@@ -187,27 +194,29 @@ jobs:
187194

188195
steps:
189196
- uses: actions/checkout@v2
197+
with:
198+
fetch-depth: 25
190199

191-
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'docs-only')
200+
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
192201
id: docs-change
193202

194203
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
195-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
204+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
196205

197206
- run: cat package.json | jq '.resolutions.react = "^16.14.0"' > package.json.tmp && mv package.json.tmp package.json
198-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
207+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
199208

200209
- run: cat package.json | jq '.resolutions."react-dom" = "^16.14.0"' > package.json.tmp && mv package.json.tmp package.json
201-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
210+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
202211

203212
- run: yarn install --check-files
204-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
213+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
205214

206215
- run: yarn list react react-dom
207-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
216+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
208217

209218
- run: xvfb-run node run-tests.js test/integration/{link-ref,production,basic,async-modules,font-optimization,ssr-ctx,worker-loader}/test/index.test.js test/acceptance/*.test.js
210-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
219+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
211220

212221
testFirefox:
213222
name: Test Firefox (production)
@@ -219,13 +228,13 @@ jobs:
219228
NEXT_TELEMETRY_DISABLED: 1
220229
steps:
221230
- uses: actions/cache@v2
222-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
231+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
223232
id: restore-build
224233
with:
225234
path: ./*
226235
key: ${{ github.sha }}
227236
- run: node run-tests.js test/integration/production/test/index.test.js
228-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
237+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
229238

230239
testSafari:
231240
name: Test Safari (production)
@@ -240,13 +249,13 @@ jobs:
240249
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
241250
steps:
242251
- uses: actions/cache@v2
243-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
252+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
244253
id: restore-build
245254
with:
246255
path: ./*
247256
key: ${{ github.sha }}
248257
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || node run-tests.js test/integration/production/test/index.test.js'
249-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
258+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
250259

251260
testSafariOld:
252261
name: Test Safari 10.1 (nav)
@@ -262,18 +271,18 @@ jobs:
262271
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
263272
steps:
264273
- uses: actions/cache@v2
265-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
274+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
266275
id: restore-build
267276
with:
268277
path: ./*
269278
key: ${{ github.sha }}
270279
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || node run-tests.js test/integration/production-nav/test/index.test.js'
271-
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
280+
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
272281

273282
publishRelease:
274283
name: Potentially publish release
275284
runs-on: ubuntu-latest
276-
needs: [testsPass]
285+
needs: build
277286
env:
278287
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
279288
steps:

.github/workflows/pull_request_stats.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
13-
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'docs-only')
13+
with:
14+
fetch-depth: 25
15+
16+
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
1417
id: docs-change
1518
- uses: ./.github/actions/next-stats-action
16-
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
19+
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@
2525
"port": 9229,
2626
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"]
2727
},
28+
{
29+
"name": "Launch app build trace",
30+
"type": "node",
31+
"request": "launch",
32+
"cwd": "${workspaceFolder}",
33+
"runtimeExecutable": "yarn",
34+
"runtimeArgs": ["run", "trace-debug", "build", "test/integration/basic"],
35+
"skipFiles": ["<node_internals>/**"],
36+
"port": 9229,
37+
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"]
38+
},
2839
{
2940
"name": "Launch app production",
3041
"type": "node",
@@ -42,6 +53,16 @@
4253
"port": 9229,
4354
"skipFiles": ["<node_internals>/**"],
4455
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"]
56+
},
57+
{
58+
"name": "Launch this example",
59+
"type": "node",
60+
"request": "launch",
61+
"cwd": "${workspaceFolder}",
62+
"runtimeExecutable": "yarn",
63+
"runtimeArgs": ["run", "debug", "dev", "${fileDirname}"],
64+
"skipFiles": ["<node_internals>/**"],
65+
"port": 9229
4566
}
4667
]
4768
}

bench/capture-trace.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
const http = require('http')
2+
const fs = require('fs')
3+
4+
const PORT = 9411
5+
const HOST = '0.0.0.0'
6+
7+
const traces = []
8+
9+
const onReady = () => console.log(`Listening on http://${HOST}:${PORT}`)
10+
const onRequest = async (req, res) => {
11+
if (
12+
req.method !== 'POST' ||
13+
req.url !== '/api/v2/spans' ||
14+
(req.headers && req.headers['content-type']) !== 'application/json'
15+
) {
16+
res.writeHead(200)
17+
return res.end()
18+
}
19+
20+
try {
21+
const body = JSON.parse(await getBody(req))
22+
for (const traceEvent of body) {
23+
traces.push(traceEvent)
24+
}
25+
res.writeHead(200)
26+
} catch (err) {
27+
console.warn(err)
28+
res.writeHead(500)
29+
}
30+
31+
res.end()
32+
}
33+
34+
const getBody = (req) =>
35+
new Promise((resolve, reject) => {
36+
let data = ''
37+
req.on('data', (chunk) => {
38+
data += chunk
39+
})
40+
req.on('end', () => {
41+
if (!req.complete) {
42+
return reject('Connection terminated before body was received.')
43+
}
44+
resolve(data)
45+
})
46+
req.on('aborted', () => reject('Connection aborted.'))
47+
req.on('error', () => reject('Connection error.'))
48+
})
49+
50+
const main = () => {
51+
const args = process.argv.slice(2)
52+
const outFile = args[0] || `./trace-${Date.now()}.json`
53+
54+
process.on('SIGINT', () => {
55+
console.log(`\nSaving to ${outFile}...`)
56+
fs.writeFileSync(outFile, JSON.stringify(traces, null, 2))
57+
process.exit()
58+
})
59+
60+
const server = http.createServer(onRequest)
61+
server.listen(PORT, HOST, onReady)
62+
}
63+
64+
if (require.main === module) {
65+
main()
66+
}

0 commit comments

Comments
 (0)