Skip to content

Commit

Permalink
Merge branch 'canary' of https://github.com/hanneslund/next.js into n…
Browse files Browse the repository at this point in the history
…ext-swc-font-loaders
  • Loading branch information
Hannes Bornö committed Sep 19, 2022
2 parents b7d2a54 + d41ca43 commit cf58081
Show file tree
Hide file tree
Showing 623 changed files with 19,495 additions and 4,118 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -4,6 +4,7 @@
* @timneutkens @ijjk @shuding @huozhi
/.github/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @balazsorban44
/docs/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @balazsorban44
/errors/ @balazsorban44
/examples/ @timneutkens @ijjk @shuding @leerob @steven-tey @balazsorban44

# SWC Build & Telemetry (@padmaia)
Expand Down
12 changes: 10 additions & 2 deletions .github/actions/next-stats-action/src/index.js
Expand Up @@ -72,11 +72,15 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
}
/* eslint-disable-next-line */
actionInfo.commitId = await getCommitId(diffRepoDir)
let mainNextSwcVersion

if (!actionInfo.skipClone) {
if (actionInfo.isRelease) {
logger('Release detected, resetting mainRepo to last stable tag')
const lastStableTag = await getLastStable(mainRepoDir, actionInfo.prRef)
mainNextSwcVersion = {
'@next/swc-linux-x64-gnu': lastStableTag,
}
if (!lastStableTag) throw new Error('failed to get last stable tag')
console.log('using latestStable', lastStableTag)
await checkoutRef(lastStableTag, mainRepoDir)
Expand Down Expand Up @@ -130,9 +134,13 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
.catch(console.error)

logger(`Linking packages in ${dir}`)
const pkgPaths = await linkPackages(dir)
const isMainRepo = dir === mainRepoDir
const pkgPaths = await linkPackages(
dir,
isMainRepo ? mainNextSwcVersion : undefined
)

if (dir === mainRepoDir) mainRepoPkgPaths = pkgPaths
if (isMainRepo) mainRepoPkgPaths = pkgPaths
else diffRepoPkgPaths = pkgPaths
}

Expand Down
14 changes: 9 additions & 5 deletions .github/actions/next-stats-action/src/prepare/repo-setup.js
Expand Up @@ -53,7 +53,7 @@ module.exports = (actionInfo) => {
}
}
},
async linkPackages(repoDir = '') {
async linkPackages(repoDir = '', nextSwcPkg) {
const pkgPaths = new Map()
const pkgDatas = new Map()
let pkgs
Expand Down Expand Up @@ -109,11 +109,15 @@ module.exports = (actionInfo) => {
)
}
if (pkg === 'next') {
if (pkgDatas.get('@next/swc')) {
pkgData.dependencies['@next/swc'] =
pkgDatas.get('@next/swc').packedPkgPath
if (nextSwcPkg) {
Object.assign(pkgData.dependencies, nextSwcPkg)
} else {
pkgData.files.push('native')
if (pkgDatas.get('@next/swc')) {
pkgData.dependencies['@next/swc'] =
pkgDatas.get('@next/swc').packedPkgPath
} else {
pkgData.files.push('native')
}
}
}
await fs.writeFile(
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/next-stats-action/src/run/get-dir-size.js
Expand Up @@ -8,6 +8,10 @@ async function getDirSize(dir, ctx = { size: 0 }) {

await Promise.all(
subDirs.map(async (curDir) => {
// we use dev builds so the size isn't helpful to track
// here as it's not reflective of full releases
if (curDir.includes('@next/swc')) return

const fileStat = await fs.stat(curDir)
if (fileStat.isDirectory()) {
return getDirSize(curDir, ctx)
Expand Down
8 changes: 4 additions & 4 deletions .github/pull_request_template.md
@@ -1,14 +1,14 @@
<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

Expand All @@ -17,9 +17,9 @@ Choose the right checklist for the change that you're making:
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
8 changes: 4 additions & 4 deletions .github/workflows/build_test_deploy.yml
Expand Up @@ -51,7 +51,7 @@ jobs:
run: sudo ethtool -K eth0 tx off rx off

- name: Check non-docs only change
run: echo ::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')
run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
id: docs-change

- run: echo ${{steps.docs-change.outputs.DOCS_CHANGE}}
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}

- run: echo ::set-output name=SWC_CHANGE::$(node scripts/run-for-change.js --type next-swc --exec echo 'yup')
- run: echo "::set-output name=SWC_CHANGE::$(node scripts/run-for-change.js --type next-swc --exec echo 'yup')"
id: swc-change

- run: echo ${{ steps.swc-change.outputs.SWC_CHANGE }}
Expand Down Expand Up @@ -1102,7 +1102,7 @@ jobs:
with:
fetch-depth: 25

- run: echo ::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')
- run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
id: docs-change

- name: Setup node
Expand Down Expand Up @@ -1191,7 +1191,7 @@ jobs:
with:
fetch-depth: 25

- run: echo ::set-output name=SWC_CHANGE::$(node scripts/run-for-change.js --type next-swc --exec echo 'yup')
- run: echo "::set-output name=SWC_CHANGE::$(node scripts/run-for-change.js --type next-swc --exec echo 'yup')"
id: swc-change

- run: echo ${{ steps.swc-change.outputs.SWC_CHANGE }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_request_stats.yml
Expand Up @@ -24,7 +24,7 @@ jobs:
fetch-depth: 25

- name: Check non-docs only change
run: echo ::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')
run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
id: docs-change

- name: Setup node
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
fetch-depth: 25

- name: Check non-docs only change
run: echo ::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')
run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
id: docs-change

- uses: actions/download-artifact@v3
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/validate_issue.yml
Expand Up @@ -15,4 +15,3 @@ jobs:
run: node ./.github/actions/issue-validator/index.mjs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: 1
65 changes: 27 additions & 38 deletions .vscode/launch.json
Expand Up @@ -9,92 +9,81 @@
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "yarn",
"runtimeArgs": ["run", "debug-react-exp", "dev", "test/e2e/app-dir/app"],
"runtimeExecutable": "pnpm",
"runtimeArgs": ["debug-react-exp", "dev", "test/e2e/app-dir/app"],
"skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"],
"port": 9229,
"env": {
"NEXT_PRIVATE_LOCAL_WEBPACK5": "1"
"NEXT_PRIVATE_LOCAL_WEBPACK": "1"
}
},
{
"name": "Launch app development",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "yarn",
"runtimeArgs": ["run", "debug", "dev", "bench/nested-deps"],
"runtimeExecutable": "pnpm",
"runtimeArgs": ["debug", "dev", "examples/hello-world"],
"skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"],
"port": 9229,
"env": {
"NEXT_PRIVATE_LOCAL_WEBPACK5": "1"
"NEXT_PRIVATE_LOCAL_WEBPACK": "1"
}
},
{
"name": "Launch app build",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "yarn",
"runtimeArgs": ["run", "debug", "build", "bench/nested-deps"],
"runtimeExecutable": "pnpm",
"runtimeArgs": ["debug", "build", "examples/hello-world"],
"skipFiles": ["<node_internals>/**"],
"port": 9229,
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"],
"env": {
"NEXT_PRIVATE_LOCAL_WEBPACK5": "1"
"NEXT_PRIVATE_LOCAL_WEBPACK": "1"
}
},
{
"name": "Launch app build trace jaeger",
"name": "Launch app production",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "yarn",
"runtimeArgs": ["run", "clean-trace-jaeger"],
"runtimeExecutable": "pnpm",
"runtimeArgs": ["debug", "start", "examples/hello-world"],
"skipFiles": ["<node_internals>/**"],
"port": 9229,
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"],
"env": {
"NEXT_PRIVATE_LOCAL_WEBPACK5": "1"
"NEXT_PRIVATE_LOCAL_WEBPACK": "1"
}
},
{
"name": "Launch app production",
"name": "Launch current directory in development",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "yarn",
"runtimeArgs": ["run", "debug", "start", "bench/nested-deps"],
"runtimeExecutable": "pnpm",
"runtimeArgs": ["debug", "dev", "${fileDirname}"],
"skipFiles": ["<node_internals>/**"],
"port": 9229,
"env": {
"NEXT_PRIVATE_LOCAL_WEBPACK5": "1"
"NEXT_PRIVATE_LOCAL_WEBPACK": "1"
}
},
{
"name": "Launch app build trace jaeger",
"type": "node",
"request": "attach",
"name": "Attach to existing debugger",
"port": 9229,
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "pnpm",
"runtimeArgs": ["clean-trace-jaeger"],
"skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"],
"env": {
"NEXT_PRIVATE_LOCAL_WEBPACK5": "1"
"NEXT_PRIVATE_LOCAL_WEBPACK": "1"
}
},
{
"name": "Launch this example",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "yarn",
"runtimeArgs": ["run", "debug", "dev", "${fileDirname}"],
"skipFiles": ["<node_internals>/**"],
"request": "attach",
"name": "Attach to existing debugger",
"port": 9229,
"skipFiles": ["<node_internals>/**"],
"env": {
"NEXT_PRIVATE_LOCAL_WEBPACK5": "1"
"NEXT_PRIVATE_LOCAL_WEBPACK": "1"
}
}
]
Expand Down
8 changes: 4 additions & 4 deletions bench/nested-deps/package.json
@@ -1,11 +1,11 @@
{
"scripts": {
"prepare": "rimraf components && mkdir components && node ./fuzzponent.js -d 2 -s 206 -o components",
"dev": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 node ../../node_modules/next/dist/bin/next dev",
"build": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 node ../../node_modules/next/dist/bin/next build",
"start": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 node ../../node_modules/next/dist/bin/next start",
"dev": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK=1 node ../../node_modules/next/dist/bin/next dev",
"build": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK=1 node ../../node_modules/next/dist/bin/next build",
"start": "cross-env NEXT_PRIVATE_LOCAL_WEBPACK=1 node ../../node_modules/next/dist/bin/next start",
"dev-nocache": "rimraf .next && yarn dev",
"dev-cpuprofile-nocache": "rimraf .next && cross-env NEXT_PRIVATE_LOCAL_WEBPACK5=1 node --cpu-prof ../../node_modules/next/dist/bin/next",
"dev-cpuprofile-nocache": "rimraf .next && cross-env NEXT_PRIVATE_LOCAL_WEBPACK=1 node --cpu-prof ../../node_modules/next/dist/bin/next",
"build-nocache": "rimraf .next && yarn build"
},
"devDependencies": {
Expand Down

0 comments on commit cf58081

Please sign in to comment.