Commit b98469c8 authored by Tobias Koppers's avatar Tobias Koppers

Merge df38582da of vercel/turbo into canary

parents 2e516901 baa22255

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

CODE_OF_CONDUCT.md
examples/
{
"allow": [
"attacks",
"color",
"dead",
"execute",
"executed",
"executes",
"execution",
"executions",
"failed",
"failure",
"failures",
"fire",
"fires",
"hook",
"hooks",
"host-hostess",
"invalid",
"remains",
"white"
]
}
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
ARG VARIANT=16-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
# [Optional] Uncomment this section to install additional OS packages.
# These are required to run playwright properly
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
gconf-service libxext6 libxfixes3 libxi6 libxrandr2 \
libxrender1 libcairo2 libcups2 libdbus-1-3 libexpat1 \
libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 \
libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 \
libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 \
libxdamage1 libxss1 libxtst6 libappindicator1 libnss3 libasound2 \
libatk1.0-0 libc6 libdrm-dev libgbm-dev ca-certificates fonts-liberation lsb-release xdg-utils wget
# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
# [Optional] Uncomment if you want to install more global node modules
# RUN su node -c "npm install -g <your-package-list-here>"
# Enable pnpm
RUN corepack enable pnpm
\ No newline at end of file
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
ARG VARIANT=16-bullseye
FROM node:${VARIANT}
# [Option] Install zsh
ARG INSTALL_ZSH="true"
# [Option] Upgrade OS packages to their latest versions
ARG UPGRADE_PACKAGES="true"
# Install needed packages, yarn, nvm and setup non-root user. Use a separate RUN statement to add your own dependencies.
ARG USERNAME=node
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG NPM_GLOBAL=/usr/local/share/npm-global
ENV NVM_DIR=/usr/local/share/nvm
ENV NVM_SYMLINK_CURRENT=true \
PATH=${NPM_GLOBAL}/bin:${NVM_DIR}/current/bin:${PATH}
COPY library-scripts/*.sh library-scripts/*.env /tmp/library-scripts/
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131
&& apt-get purge -y imagemagick imagemagick-6-common \
# Install common packages, non-root user, update yarn and install nvm
&& bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
# Install yarn, nvm
&& rm -rf /opt/yarn-* /usr/local/bin/yarn /usr/local/bin/yarnpkg \
&& bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "none" "${USERNAME}" \
# Configure global npm install location, use group to adapt to UID/GID changes
&& if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
&& usermod -a -G npm ${USERNAME} \
&& umask 0002 \
&& mkdir -p ${NPM_GLOBAL} \
&& touch /usr/local/etc/npmrc \
&& chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \
&& chmod g+s ${NPM_GLOBAL} \
&& npm config -g set prefix ${NPM_GLOBAL} \
&& sudo -u ${USERNAME} npm config -g set prefix ${NPM_GLOBAL} \
# Install eslint
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
&& npm cache clean --force > /dev/null 2>&1 \
# Install python-is-python3 on bullseye to prevent node-gyp regressions
&& . /etc/os-release \
&& if [ "${VERSION_CODENAME}" = "bullseye" ]; then apt-get -y install --no-install-recommends python-is-python3; fi \
# Clean up
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /root/.gnupg /tmp/library-scripts
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
# [Optional] Uncomment if you want to install more global node modules
# RUN su node -c "npm install -g <your-package-list-here>""
\ No newline at end of file
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/javascript-node
{
"name": "Next.js Dev Container",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 18, 16, 14.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local arm64/Apple Silicon.
"args": {
"VARIANT": "16-bullseye"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": ["dbaeumer.vscode-eslint"]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node",
"features": {
// For some reason "git" or "rust" doesn't work
"ghcr.io/devcontainers/features/git:1": "os-provided",
"ghcr.io/devcontainers/features/rust:1": "latest"
// Github latest can't be installed due to GPG issues: https://github.com/cli/cli/discussions/6222
// "github-cli": "latest",
},
"remoteEnv": {
"DISPLAY": ":0"
}
}
node_modules
**/.next/**
**/_next/**
**/dist/**
e2e-tests/**
examples/with-eslint/**
examples/with-typescript-eslint-jest/**
examples/with-kea/**
examples/with-custom-babel-config/**
examples/with-flow/**
examples/with-jest/**
examples/with-mobx-state-tree/**
examples/with-mobx/**
examples/with-tigris/db/models/todoItems.ts
packages/next/src/bundles/webpack/packages/*.runtime.js
packages/next/src/bundles/webpack/packages/lazy-compilation-*.js
packages/next/src/compiled/**/*
packages/react-refresh-utils/**/*.js
packages/react-dev-overlay/lib/**
**/__tmp__/**
.github/actions/next-stats-action/.work
.github/actions/issue-validator/index.mjs
packages/next-codemod/transforms/__testfixtures__/**/*
packages/next-codemod/transforms/__tests__/**/*
packages/next-codemod/**/*.js
packages/next-codemod/**/*.d.ts
packages/next-env/**/*.d.ts
packages/create-next-app/templates/**
test/integration/eslint/**
test/integration/script-loader/**/*
test/development/basic/legacy-decorators/**/*
test/production/emit-decorator-metadata/**/*.js
test/e2e/app-dir/rsc-errors/app/swc/use-client/page.js
test-timings.json
packages/next-swc/crates/**
bench/nested-deps/pages/**
bench/nested-deps/components/**
packages/next-bundle-analyzer/index.d.ts
examples/with-typescript-graphql/lib/gql/
test/development/basic/hmr/components/parse-error.js
This diff is collapsed.
packages/next/bundles/** -text
packages/next/compiled/** -text
# .kodiak.toml
version = 1
[merge]
automerge_label = "ready to land"
require_automerge_label = false
method = "squash"
delete_branch_on_merge = true
optimistic_updates = true
prioritize_ready_to_merge = true
notify_on_conflict = false
[merge.message]
title = "pull_request_title"
body = "pull_request_body"
include_coauthors= true
include_pr_number = true
body_type = "markdown"
strip_html_comments = true
# Learn how to add code owners here:
# https://help.github.com/en/articles/about-code-owners
* @timneutkens @ijjk @shuding @huozhi @feedthejim
/.github/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @balazsorban44 @jankaifer
/docs/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @balazsorban44 @jankaifer
/errors/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @balazsorban44 @jankaifer
/examples/ @timneutkens @ijjk @shuding @leerob @steven-tey @balazsorban44 @jankaifer
# SWC Build & Telemetry (@padmaia)
/packages/next/build/ @timneutkens @ijjk @shuding @padmaia @huozhi
/packages/next/telemetry/ @timneutkens @ijjk @shuding @padmaia
/packages/next-swc/ @timneutkens @ijjk @shuding @vercel/web-tooling
/packages/next/build/swc/ @timneutkens @ijjk @shuding @vercel/web-tooling
# Image Component (@styfle)
/**/*image* @timneutkens @ijjk @shuding @styfle
/**/*image*/** @timneutkens @ijjk @shuding @styfle
/packages/next/client/use-intersection.tsx @timneutkens @ijjk @shuding @styfle
/packages/next/server/lib/squoosh/ @timneutkens @ijjk @shuding @styfle
/packages/next/server/serve-static.ts @timneutkens @ijjk @shuding @styfle
/packages/next/server/config.ts @timneutkens @ijjk @shuding @styfle
body:
- type: textarea
attributes:
label: Summary
description: What do you need help with?
validations:
required: true
- type: textarea
attributes:
label: Additional information
description: Any code snippets, error messages, or dependency details that may be related? (`next info`)
render: js
validations:
required: false
- type: input
attributes:
label: Example
description: A link to a minimal reproduction is helpful for collaborative debugging!
validations:
required: false
body:
- type: textarea
attributes:
label: Goals
description: Short list of what the feature request aims to address?
value: |
1.
2.
3.
validations:
required: true
- type: textarea
attributes:
label: Non-Goals
description: Short list of what the feature request _does not_ aim to address?
value: |
1.
2.
3.
validations:
required: false
- type: textarea
attributes:
label: Background
description: Discuss prior art, why do you think this feature is needed? Are there current alternatives?
validations:
required: true
- type: textarea
attributes:
label: Proposal
description: How should this feature be implemented? Are you interested in contributing?
validations:
required: true
name: Bug Report
description: Create a bug report for the Next.js core
labels: ['template: bug']
body:
- type: markdown
attributes:
value: |
*Note:* If you leave out sections, the issue might be moved to the ["Help" section](https://github.com/vercel/next.js/discussions/categories/help).
[examples](https://github.com/vercel/next.js/tree/canary/examples) related issue should be reported using [this](https://github.com/vercel/next.js/issues/new?assignees=&labels=type%3A+example%2Ctemplate%3A+bug&template=2.example_bug_report.yml) issue template instead.
Feature requests should be opened as [discussions](https://github.com/vercel/next.js/discussions/new?category=ideas). [Read more](https://github.com/vercel/next.js/blob/canary/contributing/core/adding-features.md).
- type: checkboxes
attributes:
label: Verify canary release
description: '`next@canary` is the canary version of Next.js that ships daily. It includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces before opening a new issue.'
options:
- label: I verified that the issue exists in the latest Next.js canary release
required: true
- type: textarea
attributes:
label: Provide environment information
description: Please run `next info` in the root directory of your project and paste the results. You might need to use `npx --no-install next info` if next is not in the current PATH.
render: bash
validations:
required: true
- type: dropdown
attributes:
label: Which area(s) of Next.js are affected? (leave empty if unsure)
multiple: true
options:
- 'App directory (appDir: true)'
- 'CLI (create-next-app)'
- 'Data fetching (gS(S)P, getInitialProps)'
- 'Dynamic imports (next/dynamic)'
- 'ESLint (eslint-config-next)'
- 'Font optimization (@next/font)'
- 'Image optimization (next/image, next/legacy/image)'
- 'Internationalization (i18n)'
- 'Jest (next/jest)'
- 'MDX (@next/mdx)'
- 'Metadata (metadata, generateMetadata, next/head, head.js)'
- 'Middleware / Edge (API routes, runtime)'
- 'Package manager (npm, pnpm, Yarn)'
- 'Routing (next/router, next/navigation, next/link)'
- 'Script optimization (next/script)'
- 'Standalone mode (output: "standalone")'
- 'Static HTML Export (next export)'
- 'SWC minifier (swcMinify: true)'
- 'SWC transpilation'
- 'Turbopack (--turbo)'
- 'TypeScript'
- type: input
attributes:
label: Link to the code that reproduces this issue
description: |
A link to a GitHub repository, a [CodeSandbox](https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template) or a [StackBlitz](https://stackblitz.com/fork/github/vercel/next.js/tree/canary/examples/reproduction-template) minimal reproduction. Minimal reproductions should be created from our [bug report template with `npx create-next-app -e reproduction-template`](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template) and should include only changes that contribute to the issue.
To report an App Router related issue, you can use these templates: [CodeSandbox](https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template-app-dir), [StackBlitz](https://stackblitz.com/fork/github/vercel/next.js/tree/canary/examples/reproduction-template-app-dir) or [`npx create-next-app -e reproduction-template-app-dir`](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template-app-dir)
validations:
required: true
- type: textarea
attributes:
label: To Reproduce
description: Steps to reproduce the behavior, please provide a clear description of how to reproduce the issue, based on the linked minimal reproduction. Screenshots can be provided in the issue body below. If using code blocks, make sure that [syntax highlighting is correct](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting) and double check that the rendered preview is not broken.
validations:
required: true
- type: textarea
attributes:
label: Describe the Bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: markdown
attributes:
value: Before posting the issue go through the steps you've written down to make sure the steps provided are detailed and clear.
- type: markdown
attributes:
value: Contributors should be able to follow the steps provided in order to reproduce the bug.
- type: markdown
attributes:
value: These steps are used to add integration tests to ensure the same issue does not happen again. Thanks in advance!
- type: input
attributes:
label: Which browser are you using? (if relevant)
description: 'Please specify the exact version. For example: Chrome 100.0.4878.0'
- type: input
attributes:
label: How are you deploying your application? (if relevant)
description: 'For example: next start, next export, Vercel, Other platform'
name: Bug Report for Examples
description: Create a bug report for one of the Next.js examples
labels: ['area: examples']
body:
- type: markdown
attributes:
value: |
*Note:* If you leave out sections, the issue might be moved to the ["Help" section](https://github.com/vercel/next.js/discussions/categories/help).
Thanks for taking the time to file a bug report for [one of the examples](https://github.com/vercel/next.js/tree/canary/examples)! Please fill out this form as completely as possible.
- type: checkboxes
attributes:
label: Verify canary release
description: '`next@canary` is the canary version of Next.js that ships daily. It includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces before opening a new issue.'
options:
- label: I verified that the issue exists in the latest Next.js canary release
required: true
- type: textarea
attributes:
label: Provide environment information
description: Please run `next info` in the root directory of your project and paste the results. You might need to use `npx --no-install next info` if next is not in the current PATH.
render: bash
validations:
required: true
- type: input
attributes:
label: Which example does this report relate to?
description: "See a complete list in the [examples folder](https://github.com/vercel/next.js/tree/canary/examples). For example: `with-styled-components`. Note: Examples not in the examples folder might be maintained by the example's library author. Check out their projects before opening the issue on Next.js"
validations:
required: true
- type: input
attributes:
label: What browser are you using? (if relevant)
description: 'Please specify the exact version. For example: Chrome 100.0.4878.0'
- type: input
attributes:
label: How are you deploying your application? (if relevant)
description: 'For example: next start, next export, Vercel, Other platform'
- type: textarea
attributes:
label: Describe the Bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: To Reproduce
description: Steps to reproduce the behavior, please provide a clear description of how to reproduce the issue, based on the relevant example. Screenshots can be provided in the issue body below. If using code blocks, make sure that [syntax highlighting is correct](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting) and double check that the rendered preview is not broken.
validations:
required: true
- type: markdown
attributes:
value: Before posting the issue go through the steps you've written down to make sure the steps provided are detailed and clear.
- type: markdown
attributes:
value: Contributors should be able to follow the steps provided in order to reproduce the bug.
- type: markdown
attributes:
value: Thanks in advance!
name: 'Docs Request for an Update or Improvement'
description: A request to update or improve Next.js documentation
title: 'Docs: '
labels:
- 'template: documentation'
body:
- type: textarea
attributes:
label: What is the improvement or update you wish to see?
description: 'Example: I would like to see more examples of how to use the `<Link>` component. Or, the `<Link>` component docs are missing information.'
validations:
required: true
- type: textarea
attributes:
label: Is there any context that might help us understand?
description: A clear description of any added context that might help us understand.
validations:
required: true
- type: input
attributes:
label: Does the docs page already exist? Please link to it.
description: 'Example: https://nextjs.org/docs/api-reference/next/link'
validations:
required: false
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/vercel/next.js/discussions
about: Ask questions and discuss with other community members
- name: Feature request
url: https://github.com/vercel/next.js/discussions/new?category=ideas
about: Feature requests should be opened as discussions
!package-lock.json
lib/
\ No newline at end of file
name: 'Issue auto label'
description: 'vercel/next.js specific auto-labeling action'
author: 'Next.js team'
runs:
using: 'node16'
main: 'index.js'
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"private": true,
"exports": "./index.js",
"files": [
"src"
],
"scripts": {
"types": "tsc",
"pack": "ncc -m -o . build lib/index.js --license licenses.txt",
"build": "npm run types && npm run pack"
},
"devDependencies": {
"@types/node": "^18.11.0",
"@vercel/ncc": "0.34.0",
"typescript": "^4.4.4"
},
"dependencies": {
"@actions/core": "1.10.0",
"@actions/github": "5.1.1"
},
"packageManager": "npm@9.2.0"
}
import * as github from '@actions/github'
import * as core from '@actions/core'
const LABELS = {
VERIFY_CANARY: 'please verify canary',
ADD_REPRODUCTION: 'please add a complete reproduction',
NEEDS_TRIAGE: 'type: needs triage',
}
const labelsRequireUserInput = [LABELS.VERIFY_CANARY, LABELS.ADD_REPRODUCTION]
function assertNotNullable<T>(value: T): asserts value is NonNullable<T> {
if (value === undefined || value === null)
throw new Error('Unexpected nullable value')
}
async function run() {
try {
const { payload, repo } = github.context
const { issue, comment } = payload
assertNotNullable(issue)
assertNotNullable(comment)
if (!process.env.GITHUB_TOKEN) return
const client = github.getOctokit(process.env.GITHUB_TOKEN).rest
const issueCommon = { ...repo, issue_number: issue.number }
const issueLabels: string[] = issue.labels.map((label: any) => label.name)
if (labelsRequireUserInput.some((label) => issueLabels.includes(label))) {
if (comment.user.type !== 'Bot') {
client.issues.addLabels({
...issueCommon,
labels: [LABELS.NEEDS_TRIAGE],
})
}
}
} catch (error: any) {
core.setFailed(error.message)
}
}
run()
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true,
"typeRoots": ["./node_modules/@types"]
},
"exclude": ["node_modules", "../../../node_modules"]
}
!dist
!package-lock.json
\ No newline at end of file
Please verify that your issue can be recreated with `next@canary`.
### **Why was this issue marked with the `please verify canary` label?**
We noticed the provided reproduction was using an older version of Next.js, instead of `canary`.
The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. You can think of canary as a _public beta_. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running `npm install next@canary` and test it in your project, using your reproduction steps.
If the issue does not reproduce with the `canary` version, then it has already been fixed and this issue can be closed.
### **How can I quickly verify if my issue has been fixed in `canary`?**
The safest way is to install `next@canary` in your project and test it, but you can also search through [closed Next.js issues](https://github.com/vercel/next.js/issues?q=is%3Aissue+is%3Aclosed) for duplicates or check the [Next.js releases](https://github.com/vercel/next.js/releases). You can also use the GitHub [template](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template) (preferred), or the [CodeSandbox](https://codesandbox.io/s/github/vercel/next.js/tree/canary/examples/reproduction-template) or [StackBlitz](https://stackblitz.com/fork/github/vercel/next.js/tree/canary/examples/reproduction-template) templates to create a reproduction with `canary` from scratch.
### **My issue has been open for a long time, why do I need to verify `canary` now?**
Next.js does not backport bug fixes to older versions of Next.js. Instead, we are trying to introduce only a minimal amount of breaking changes between major releases.
### **What happens if I don't verify against the canary version of Next.js?**
An issue with the `please verify canary` that receives no meaningful activity (e.g. new comments that acknowledge verification against `canary`) will be automatically closed and locked after 30 days.
If your issue has not been resolved in that time and it has been closed/locked, please open a new issue, with the required reproduction, using `next@canary`.
### **I did not open this issue, but it is relevant to me, what can I do to help?**
Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the :+1: reaction on the topmost comment (please **do not** comment "I have the same issue" without reproduction steps). Then, we can sort issues by votes to prioritize.
### **I think my reproduction is good enough, why aren't you looking into it quicker?**
We look into every Next.js issue and constantly monitor open issues for new comments.
However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.
Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.
### **Useful Resources**
- [How to Contribute to Open Source (Next.js)](https://www.youtube.com/watch?v=cuoNzXFLitc)
- [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve)
- [Reporting a Next.js bug](https://github.com/vercel/next.js/blob/canary/.github/ISSUE_TEMPLATE/1.bug_report.yml)
- [Next.js Triaging issues](https://github.com/vercel/next.js/blob/canary/contributing/repository/triaging.md)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"private": true,
"exports": "./index.mjs",
"scripts": {
"build": "ncc -m -o . build src/index.mjs --license licenses.txt"
},
"devDependencies": {
"@vercel/ncc": "0.34.0"
},
"dependencies": {
"@actions/core": "1.10.0",
"@actions/github": "5.1.1"
}
}
We cannot recreate the issue with the provided information. **Please add a reproduction in order for us to be able to investigate.**
### **Why was this issue marked with the `please add a complete reproduction` label?**
To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository ([template](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template)), but you can also use a tool like [CodeSandbox](https://codesandbox.io/s/github/vercel/next.js/tree/canary/examples/reproduction-template) or [StackBlitz](https://stackblitz.com/fork/github/vercel/next.js/tree/canary/examples/reproduction-template).
To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as **minimal** as possible. This means that you should **remove unnecessary code, files, and dependencies** that do not contribute to the issue.
Please test your reproduction against the latest version of Next.js (`next@canary`) to make sure your issue has not already been fixed.
### **I added a link, why was it still marked?**
Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "[example.com](http://example.com/)", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.
### **What happens if I don't provide a sufficient minimal reproduction?**
Issues with the `please add a complete reproduction` label that receives no meaningful activity (e.g. new comments with a reproduction link) are automatically closed and locked after 30 days.
If your issue has _not_ been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction.
### **I did not open this issue, but it is relevant to me, what can I do to help?**
Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the :+1: reaction on the topmost comment (please **do not** comment "I have the same issue" without reproduction steps). Then, we can sort issues by votes to prioritize.
### **I think my reproduction is good enough, why aren't you looking into it quicker?**
We look into every Next.js issue and constantly monitor open issues for new comments.
However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.
Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.
### **Useful Resources**
- [How to Contribute to Open Source (Next.js)](https://www.youtube.com/watch?v=cuoNzXFLitc)
- [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve)
- [Reporting a Next.js bug](https://github.com/vercel/next.js/blob/canary/.github/ISSUE_TEMPLATE/1.bug_report.yml)
- [Next.js Triaging issues](https://github.com/vercel/next.js/blob/canary/contributing/repository/triaging.md)
// @ts-check
// @ts-expect-error
import * as github from '@actions/github'
// @ts-expect-error
import * as core from '@actions/core'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
const verifyCanaryLabel = 'please verify canary'
const addReproductionLabel = 'please add a complete reproduction'
// const bugLabel = 'template: bug'
const __dirname =
'/home/runner/work/next.js/next.js/.github/actions/issue-validator'
/**
* @typedef {{
* id :number
* node_id :string
* url :string
* name :string
* description :string
* color :string
* default :boolean
* }} Label
*
* @typedef {{
* pull_request: any
* issue?: {body: string, number: number, labels: Label[]}
* label: Label
* }} Payload
*
* @typedef {{
* payload: Payload
* repo: any
* }} Context
*/
async function run() {
try {
/** @type {Context} */
const { payload, repo } = github.context
const {
issue,
pull_request,
label: { name: newLabel },
} = payload
if (pull_request || !issue?.body || !process.env.GITHUB_TOKEN) return
const labels = issue.labels.map((l) => l.name)
// const isBugReport =
// labels.includes(bugLabel) || newLabel === bugLabel || !labels.length
if (
// !(isBugReport && issue.number > 43554) &&
![verifyCanaryLabel, addReproductionLabel].includes(newLabel) &&
!(
labels.includes(verifyCanaryLabel) ||
labels.includes(addReproductionLabel)
)
) {
return core.info(
'Not a bug report or not manually labeled or already labeled.'
)
}
// /** @param {string|null|undefined} link */
// async function hasRepro(link) {
// if (!link) return false
// try {
// const url = new URL(link)
// if (['example.com'].includes(url.hostname)) {
// return false
// }
// } catch {
// return false
// }
// const response = await fetch(link)
// return response.ok
// }
// const hasValidRepro =
// isBugReport &&
// (await hasRepro(
// issue.body.match(
// /will be addressed faster\n\n(.*)\n\n### To Reproduce/i
// )?.[1]
// ))
const client = github.getOctokit(process.env.GITHUB_TOKEN).rest
const issueCommon = { ...repo, issue_number: issue.number }
if (
newLabel === addReproductionLabel
// || !hasValidRepro
) {
await Promise.all([
client.issues.addLabels({
...issueCommon,
labels: [addReproductionLabel],
}),
client.issues.createComment({
...issueCommon,
body: readFileSync(join(__dirname, 'repro.md'), 'utf8'),
}),
])
return core.info(
'Commented on issue, because it did not have a sufficient reproduction.'
)
}
// const isVerifyCanaryChecked =
// isBugReport &&
// issue.body.match(
// /- \[x\] I verified that the issue exists in the latest Next.js canary release/i
// )
if (
newLabel === verifyCanaryLabel
// || !isVerifyCanaryChecked
) {
await Promise.all([
client.issues.addLabels({
...issueCommon,
labels: [verifyCanaryLabel],
}),
client.issues.createComment({
...issueCommon,
body: readFileSync(join(__dirname, 'canary.md'), 'utf8'),
}),
])
return core.info(
'Commented on issue, because it was not verified against canary.'
)
}
} catch (error) {
core.setFailed(error.message)
}
}
run()
**/node_modules
out.md
.work
\ No newline at end of file
FROM node:16-bullseye
LABEL com.github.actions.name="Next.js PR Stats"
LABEL com.github.actions.description="Compares stats of a PR with the main branch"
LABEL repository="https://github.com/vercel/next-stats-action"
COPY . /next-stats
# Install node_modules
RUN npm i -g pnpm@7.24.3
RUN cd /next-stats && pnpm install --production
RUN git config --global user.email 'stats@localhost'
RUN git config --global user.name 'next stats'
RUN apt update
RUN apt install apache2-utils -y
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# Next.js Stats GitHub Action
> Downloads and runs project with provided configs gathering stats to compare branches
See it in action at Next.js https://github.com/vercel/next.js
## Getting Started
1. Add a `.stats-app` folder to your project with a [`stats-config.js`](#stats-config) and any files to run against for example a test app that is to be built
2. Add the action to your [workflow](https://help.github.com/en/articles/configuring-a-workflow)
3. Enjoy the stats
## Stats Config
```TypeScript
const StatsConfig = {
// the Heading to show at the top of stats comments
commentHeading: 'Stats from current PR' | undefined,
commentReleaseHeading: 'Stats from current release' | undefined,
// the command to build your project if not done on post install
initialBuildCommand: undefined | string,
skipInitialInstall: undefined | boolean,
// the command to build the app (app source should be in `.stats-app`)
appBuildCommand: string,
appStartCommand: string | undefined,
// the main branch to compare against (what PRs will be merging into)
mainBranch: 'canary',
// the main repository path (relative to https://github.com/)
mainRepo: 'vercel/next.js',
// whether to attempt auto merging the main branch into PR before running stats
autoMergeMain: boolean | undefined,
// an array of configs for each run
configs: [
{ // first run's config
// title of the run
title: 'fastMode stats',
// whether to diff the outputted files (default: onOutputChange)
diff: 'onOutputChange' | false | undefined,
// config files to add before running diff (if `undefined` uses `configFiles`)
diffConfigFiles: [] | undefined,
// renames to apply to make file names deterministic
renames: [
{
srcGlob: 'main-*.js',
dest: 'main.js'
}
],
// config files to add before running (removed before successive runs)
configFiles: [
{
path: './next.config.js',
content: 'module.exports = { fastMode: true }'
}
],
// an array of file groups to diff/track
filesToTrack: [
{
name: 'Pages',
globs: [
'build/pages/**/*.js'
]
}
],
// an array of URLs to fetch while `appStartCommand` is running
// will be output to fetched-pages/${pathname}.html
pagesToFetch: [
'https://localhost:$PORT/page-1'
]
},
{ // second run's config
title: 'slowMode stats',
diff: false,
configFiles: [
{
path: './next.config.js',
content: 'module.exports = { slowMode: true }'
}
],
filesToTrack: [
{
name: 'Main Bundles',
globs: [
'build/runtime/webpack-*.js',
'build/runtime/main-*.js',
]
}
]
},
]
}
module.exports = StatsConfig
```
#!/usr/bin/env bash
set -eu # stop on error
export HOME=/root
node /next-stats/src/index.js
{
"private": true,
"main": "src/index.js",
"dependencies": {
"async-sema": "^3.1.0",
"execa": "2.0.3",
"fs-extra": "^8.1.0",
"get-port": "^5.0.0",
"glob": "^7.1.4",
"gzip-size": "^5.1.1",
"minimatch": "^3.0.4",
"node-fetch": "^2.6.0",
"prettier": "^1.18.2",
"pretty-bytes": "^5.3.0",
"pretty-ms": "^5.0.0",
"semver": "7.3.4"
}
}
const path = require('path')
const fs = require('fs').promises
const fetch = require('node-fetch')
const prettyMs = require('pretty-ms')
const logger = require('./util/logger')
const prettyBytes = require('pretty-bytes')
const { benchTitle } = require('./constants')
const gzipIgnoreRegex = new RegExp(`(General|^Serverless|${benchTitle})`)
const prettify = (val, type = 'bytes') => {
if (typeof val !== 'number') return 'N/A'
return type === 'bytes' ? prettyBytes(val) : prettyMs(val)
}
const round = (num, places) => {
const placesFactor = Math.pow(10, places)
return Math.round(num * placesFactor) / placesFactor
}
const shortenLabel = (itemKey) =>
itemKey.length > 24
? `${itemKey.slice(0, 12)}..${itemKey.slice(-12)}`
: itemKey
const twoMB = 2 * 1024 * 1024
module.exports = async function addComment(
results = [],
actionInfo,
statsConfig
) {
let comment = `# ${
actionInfo.isRelease
? statsConfig.commentReleaseHeading || 'Stats from current release'
: statsConfig.commentHeading || 'Stats from current PR'
}\n\n`
const tableHead = `| | ${statsConfig.mainRepo} ${statsConfig.mainBranch} ${
actionInfo.lastStableTag || ''
} | ${actionInfo.prRepo} ${actionInfo.prRef} | Change |\n| - | - | - | - |\n`
for (let i = 0; i < results.length; i++) {
const result = results[i]
const isLastResult = i === results.length - 1
let resultHasIncrease = false
let resultHasDecrease = false
let resultContent = ''
Object.keys(result.mainRepoStats).forEach((groupKey) => {
const isBenchmark = groupKey === benchTitle
const mainRepoGroup = result.mainRepoStats[groupKey]
const diffRepoGroup = result.diffRepoStats[groupKey]
const itemKeys = new Set([
...Object.keys(mainRepoGroup),
...Object.keys(diffRepoGroup),
])
let groupTable = tableHead
let mainRepoTotal = 0
let diffRepoTotal = 0
let totalChange = 0
itemKeys.forEach((itemKey) => {
const prettyType = itemKey.match(/(length|duration)/i) ? 'ms' : 'bytes'
const isGzipItem = itemKey.endsWith('gzip')
const mainItemVal = mainRepoGroup[itemKey]
const diffItemVal = diffRepoGroup[itemKey]
const useRawValue = isBenchmark && prettyType !== 'ms'
const mainItemStr = useRawValue
? mainItemVal
: prettify(mainItemVal, prettyType)
const diffItemStr = useRawValue
? diffItemVal
: prettify(diffItemVal, prettyType)
let change = '✓'
// Don't show gzip values for serverless as they aren't
// deterministic currently
if (groupKey.startsWith('Serverless') && isGzipItem) return
// otherwise only show gzip values
else if (!isGzipItem && !groupKey.match(gzipIgnoreRegex)) return
if (
!itemKey.startsWith('buildDuration') ||
(isBenchmark && itemKey.match(/req\/sec/))
) {
if (typeof mainItemVal === 'number') mainRepoTotal += mainItemVal
if (typeof diffItemVal === 'number') diffRepoTotal += diffItemVal
}
// calculate the change
if (mainItemVal !== diffItemVal) {
if (
typeof mainItemVal === 'number' &&
typeof diffItemVal === 'number'
) {
change = round(diffItemVal - mainItemVal, 2)
// check if there is still a change after rounding
if (change !== 0) {
const absChange = Math.abs(change)
const warnIfNegative = isBenchmark && itemKey.match(/req\/sec/)
const warn = warnIfNegative
? change < 0
? '⚠️ '
: ''
: change > 0
? '⚠️ '
: ''
change = `${warn}${change < 0 ? '-' : '+'}${
useRawValue ? absChange : prettify(absChange, prettyType)
}`
}
} else {
change = 'N/A'
}
}
groupTable += `| ${
isBenchmark ? itemKey : shortenLabel(itemKey)
} | ${mainItemStr} | ${diffItemStr} | ${change} |\n`
})
let groupTotalChange = ''
totalChange = diffRepoTotal - mainRepoTotal
if (totalChange !== 0) {
if (totalChange < 0) {
resultHasDecrease = true
groupTotalChange = ` Overall decrease ${isBenchmark ? '⚠️' : '✓'}`
} else {
if (
(groupKey !== 'General' && totalChange > 5) ||
totalChange > twoMB
) {
resultHasIncrease = true
}
groupTotalChange = ` Overall increase ${isBenchmark ? '✓' : '⚠️'}`
}
}
if (groupKey !== 'General' && groupKey !== benchTitle) {
let totalChangeSign = ''
if (totalChange === 0) {
totalChange = '✓'
} else {
totalChangeSign = totalChange < 0 ? '-' : '⚠️ +'
}
totalChange = `${totalChangeSign}${
typeof totalChange === 'number'
? prettify(Math.abs(totalChange))
: totalChange
}`
groupTable += `| Overall change | ${prettyBytes(
round(mainRepoTotal, 2)
)} | ${prettyBytes(round(diffRepoTotal, 2))} | ${totalChange} |\n`
}
if (itemKeys.size > 0) {
resultContent += `<details>\n`
resultContent += `<summary><strong>${groupKey}</strong>${groupTotalChange}</summary>\n\n`
resultContent += groupTable
resultContent += `\n</details>\n\n`
}
})
// add diffs
if (result.diffs) {
const diffHeading = '#### Diffs\n'
let diffContent = diffHeading
Object.keys(result.diffs).forEach((itemKey) => {
const curDiff = result.diffs[itemKey]
diffContent += `<details>\n`
diffContent += `<summary>Diff for <strong>${shortenLabel(
itemKey
)}</strong></summary>\n\n`
if (curDiff.length > 36 * 1000) {
diffContent += 'Diff too large to display'
} else {
diffContent += `\`\`\`diff\n${curDiff}\n\`\`\``
}
diffContent += `\n</details>\n`
})
if (diffContent !== diffHeading) {
resultContent += diffContent
}
}
let increaseDecreaseNote = ''
if (resultHasIncrease) {
increaseDecreaseNote = ' (Increase detected ⚠️)'
} else if (resultHasDecrease) {
increaseDecreaseNote = ' (Decrease detected ✓)'
}
comment += `<details>\n`
comment += `<summary><strong>${result.title}</strong>${increaseDecreaseNote}</summary>\n\n<br/>\n\n`
comment += resultContent
comment += '</details>\n'
if (!isLastResult) {
comment += `<hr/>\n`
}
}
if (process.env.LOCAL_STATS) {
const statsPath = path.resolve('pr-stats.md')
await fs.writeFile(statsPath, comment)
console.log(`Output PR stats to ${statsPath}`)
} else {
logger('\n--stats start--\n', comment, '\n--stats end--\n')
}
if (
actionInfo.customCommentEndpoint ||
(actionInfo.githubToken && actionInfo.commentEndpoint)
) {
logger(`Posting results to ${actionInfo.commentEndpoint}`)
const body = {
body: comment,
...(!actionInfo.githubToken
? {
isRelease: actionInfo.isRelease,
commitId: actionInfo.commitId,
issueId: actionInfo.issueId,
}
: {}),
}
if (actionInfo.customCommentEndpoint) {
logger(`Using body ${JSON.stringify({ ...body, body: 'OMITTED' })}`)
}
try {
const res = await fetch(actionInfo.commentEndpoint, {
method: 'POST',
headers: {
...(actionInfo.githubToken
? {
Authorization: `bearer ${actionInfo.githubToken}`,
}
: {
'content-type': 'application/json',
}),
},
body: JSON.stringify(body),
})
if (!res.ok) {
logger.error(`Failed to post results ${res.status}`)
try {
logger.error(await res.text())
} catch (_) {
/* no-op */
}
} else {
logger('Successfully posted results')
}
} catch (err) {
logger.error(`Error occurred posting results`, err)
}
} else {
logger(
`Not posting results`,
actionInfo.githubToken ? 'No comment endpoint' : 'no GitHub token'
)
}
}
const path = require('path')
const os = require('os')
const fs = require('fs')
const benchTitle = 'Page Load Tests'
const workDir = fs.mkdtempSync(path.join(os.tmpdir(), 'next-stats'))
const mainRepoDir = path.join(workDir, 'main-repo')
const diffRepoDir = path.join(workDir, 'diff-repo')
const statsAppDir = path.join(workDir, 'stats-app')
const diffingDir = path.join(workDir, 'diff')
const yarnEnvValues = {
YARN_CACHE_FOLDER: path.join(workDir, 'yarn-cache'),
}
const allowedConfigLocations = [
'./',
'.stats-app',
'test/.stats-app',
'.github/.stats-app',
]
module.exports = {
benchTitle,
workDir,
diffingDir,
mainRepoDir,
diffRepoDir,
statsAppDir,
yarnEnvValues,
allowedConfigLocations,
}
const path = require('path')
const fs = require('fs-extra')
const exec = require('./util/exec')
const logger = require('./util/logger')
const runConfigs = require('./run')
const addComment = require('./add-comment')
const actionInfo = require('./prepare/action-info')()
const { mainRepoDir, diffRepoDir } = require('./constants')
const loadStatsConfig = require('./prepare/load-stats-config')
const {
cloneRepo,
checkoutRef,
mergeBranch,
getCommitId,
linkPackages,
getLastStable,
} = require('./prepare/repo-setup')(actionInfo)
const allowedActions = new Set(['synchronize', 'opened'])
if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
logger(
`Not running for ${actionInfo.actionName} event action on repo: ${actionInfo.prRepo} and ref ${actionInfo.prRef}`
)
process.exit(0)
}
;(async () => {
try {
if (await fs.pathExists(path.join(__dirname, '../SKIP_NEXT_STATS.txt'))) {
console.log(
'SKIP_NEXT_STATS.txt file present, exiting stats generation..'
)
process.exit(0)
}
const { stdout: gitName } = await exec(
'git config user.name && git config user.email'
)
console.log('git author result:', gitName)
// clone PR/newer repository/ref first to get settings
if (!actionInfo.skipClone) {
await cloneRepo(actionInfo.prRepo, diffRepoDir)
await checkoutRef(actionInfo.prRef, diffRepoDir)
}
if (actionInfo.isRelease) {
process.env.STATS_IS_RELEASE = 'true'
}
// load stats config from allowed locations
const { statsConfig, relativeStatsAppDir } = loadStatsConfig()
if (actionInfo.isLocal && actionInfo.prRef === statsConfig.mainBranch) {
throw new Error(
`'GITHUB_REF' can not be the same as mainBranch in 'stats-config.js'.\n` +
`This will result in comparing against the same branch`
)
}
if (actionInfo.isLocal) {
// make sure to use local repo location instead of the
// one provided in statsConfig
statsConfig.mainRepo = actionInfo.prRepo
}
// clone main repository/ref
if (!actionInfo.skipClone) {
await cloneRepo(statsConfig.mainRepo, mainRepoDir)
await checkoutRef(statsConfig.mainBranch, mainRepoDir)
}
/* 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 = lastStableTag
if (!lastStableTag) throw new Error('failed to get last stable tag')
console.log('using latestStable', lastStableTag)
await checkoutRef(lastStableTag, mainRepoDir)
/* eslint-disable-next-line */
actionInfo.lastStableTag = lastStableTag
/* eslint-disable-next-line */
actionInfo.commitId = await getCommitId(diffRepoDir)
if (!actionInfo.customCommentEndpoint) {
/* eslint-disable-next-line */
actionInfo.commentEndpoint = `https://api.github.com/repos/${statsConfig.mainRepo}/commits/${actionInfo.commitId}/comments`
}
} else if (statsConfig.autoMergeMain) {
logger('Attempting auto merge of main branch')
await mergeBranch(statsConfig.mainBranch, mainRepoDir, diffRepoDir)
}
}
let mainRepoPkgPaths
let diffRepoPkgPaths
// run install/initialBuildCommand
const repoDirs = [mainRepoDir, diffRepoDir]
for (const dir of repoDirs) {
logger(`Running initial build for ${dir}`)
if (!actionInfo.skipClone) {
const usePnpm = await fs.pathExists(path.join(dir, 'pnpm-lock.yaml'))
let buildCommand = `cd ${dir}${
!statsConfig.skipInitialInstall
? usePnpm
? // --no-frozen-lockfile is used here to tolerate lockfile
// changes from merging latest changes
` && pnpm install --no-frozen-lockfile && pnpm run build`
: ' && yarn install --network-timeout 1000000'
: ''
}`
if (statsConfig.initialBuildCommand) {
buildCommand += ` && ${statsConfig.initialBuildCommand}`
}
// allow 5 minutes node_modules install + building all packages
// in case of noisy environment slowing down initial repo build
await exec(buildCommand, false, { timeout: 5 * 60 * 1000 })
}
await fs
.copy(
path.join(__dirname, '../native'),
path.join(dir, 'packages/next-swc/native')
)
.catch(console.error)
logger(`Linking packages in ${dir}`)
const isMainRepo = dir === mainRepoDir
const pkgPaths = await linkPackages({
repoDir: dir,
nextSwcVersion: isMainRepo ? mainNextSwcVersion : undefined,
})
if (isMainRepo) mainRepoPkgPaths = pkgPaths
else diffRepoPkgPaths = pkgPaths
}
// run the configs and post the comment
const results = await runConfigs(statsConfig.configs, {
statsConfig,
mainRepoPkgPaths,
diffRepoPkgPaths,
relativeStatsAppDir,
})
await addComment(results, actionInfo, statsConfig)
logger('finished')
process.exit(0)
} catch (err) {
console.error('Error occurred generating stats:')
console.error(err)
process.exit(1)
}
})()
const path = require('path')
const logger = require('../util/logger')
const { execSync } = require('child_process')
const releaseTypes = new Set(['release', 'published'])
module.exports = function actionInfo() {
let {
ISSUE_ID,
SKIP_CLONE,
GITHUB_REF,
LOCAL_STATS,
GIT_ROOT_DIR,
GITHUB_ACTION,
COMMENT_ENDPOINT,
GITHUB_REPOSITORY,
GITHUB_EVENT_PATH,
PR_STATS_COMMENT_TOKEN,
} = process.env
delete process.env.GITHUB_TOKEN
delete process.env.PR_STATS_COMMENT_TOKEN
// only use custom endpoint if we don't have a token
const commentEndpoint = !PR_STATS_COMMENT_TOKEN && COMMENT_ENDPOINT
if (LOCAL_STATS === 'true') {
const cwd = process.cwd()
const parentDir = path.join(cwd, '../..')
if (!GITHUB_REF) {
// get the current branch name
GITHUB_REF = execSync(`cd "${cwd}" && git rev-parse --abbrev-ref HEAD`)
.toString()
.trim()
}
if (!GIT_ROOT_DIR) {
GIT_ROOT_DIR = path.join(parentDir, '/')
}
if (!GITHUB_REPOSITORY) {
GITHUB_REPOSITORY = path.relative(parentDir, cwd)
}
if (!GITHUB_ACTION) {
GITHUB_ACTION = 'opened'
}
}
const info = {
commentEndpoint,
skipClone: SKIP_CLONE,
actionName: GITHUB_ACTION,
githubToken: PR_STATS_COMMENT_TOKEN,
customCommentEndpoint: !!commentEndpoint,
gitRoot: GIT_ROOT_DIR || 'https://github.com/',
prRepo: GITHUB_REPOSITORY,
prRef: GITHUB_REF,
isLocal: LOCAL_STATS,
commitId: null,
issueId: ISSUE_ID,
isRelease:
GITHUB_REPOSITORY === 'vercel/next.js' &&
(GITHUB_REF || '').includes('canary'),
}
// get comment
if (GITHUB_EVENT_PATH) {
const event = require(GITHUB_EVENT_PATH)
info.actionName = event.action || info.actionName
if (releaseTypes.has(info.actionName)) {
info.isRelease = true
} else {
// since GITHUB_REPOSITORY and REF might not match the fork
// use event data to get repository and ref info
const prData = event['pull_request']
if (prData) {
info.prRepo = prData.head.repo.full_name
info.prRef = prData.head.ref
info.issueId = prData.number
if (!info.commentEndpoint) {
info.commentEndpoint = prData._links.comments || ''
}
// comment endpoint might be under `href`
if (typeof info.commentEndpoint === 'object') {
info.commentEndpoint = info.commentEndpoint.href
}
}
}
}
logger('Got actionInfo:')
logger.json({
...info,
githubToken: PR_STATS_COMMENT_TOKEN ? 'found' : 'missing',
})
return info
}
const path = require('path')
const logger = require('../util/logger')
const { diffRepoDir, allowedConfigLocations } = require('../constants')
// load stats-config
function loadStatsConfig() {
let statsConfig
let relativeStatsAppDir
for (const configPath of allowedConfigLocations) {
try {
relativeStatsAppDir = configPath
statsConfig = require(path.join(
diffRepoDir,
configPath,
'stats-config.js'
))
break
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND') {
console.error('Failed to load stats-config at', configPath, err)
}
/* */
}
}
if (!statsConfig) {
throw new Error(
`Failed to locate \`.stats-app\`, allowed locations are: ${allowedConfigLocations.join(
', '
)}`
)
}
logger(
'Got statsConfig at',
path.join(relativeStatsAppDir, 'stats-config.js'),
statsConfig,
'\n'
)
return { statsConfig, relativeStatsAppDir }
}
module.exports = loadStatsConfig
const path = require('path')
const fs = require('fs-extra')
const exec = require('../util/exec')
const { remove } = require('fs-extra')
const logger = require('../util/logger')
const semver = require('semver')
const execa = require('execa')
module.exports = (actionInfo) => {
return {
async cloneRepo(repoPath = '', dest = '') {
await remove(dest)
await exec(`git clone ${actionInfo.gitRoot}${repoPath} ${dest}`)
},
async checkoutRef(ref = '', repoDir = '') {
await exec(`cd ${repoDir} && git fetch && git checkout ${ref}`)
},
async getLastStable(repoDir = '', ref) {
const { stdout } = await exec(`cd ${repoDir} && git tag -l`)
const tags = stdout.trim().split('\n')
let lastStableTag
for (let i = tags.length - 1; i >= 0; i--) {
const curTag = tags[i]
// stable doesn't include `-canary` or `-beta`
if (!curTag.includes('-') && !ref.includes(curTag)) {
if (!lastStableTag || semver.gt(curTag, lastStableTag)) {
lastStableTag = curTag
}
}
}
return lastStableTag
},
async getCommitId(repoDir = '') {
const { stdout } = await exec(`cd ${repoDir} && git rev-parse HEAD`)
return stdout.trim()
},
async resetToRef(ref = '', repoDir = '') {
await exec(`cd ${repoDir} && git reset --hard ${ref}`)
},
async mergeBranch(ref = '', origRepoDir = '', destRepoDir = '') {
await exec(`cd ${destRepoDir} && git remote add upstream ${origRepoDir}`)
await exec(`cd ${destRepoDir} && git fetch upstream`)
try {
await exec(`cd ${destRepoDir} && git merge upstream/${ref}`)
logger('Auto merge of main branch successful')
} catch (err) {
logger.error('Failed to auto merge main branch:', err)
if (err.stdout && err.stdout.includes('CONFLICT')) {
await exec(`cd ${destRepoDir} && git merge --abort`)
logger('aborted auto merge')
}
}
},
async linkPackages({ repoDir, nextSwcVersion }) {
let useTestPack = process.env.NEXT_TEST_PACK
if (useTestPack) {
execa.sync('pnpm', ['turbo', 'run', 'test-pack'], {
cwd: repoDir,
env: { NEXT_SWC_VERSION: nextSwcVersion },
})
const pkgPaths = new Map()
const pkgs = (await fs.readdir(path.join(repoDir, 'packages'))).filter(
(item) => !item.startsWith('.')
)
pkgs.forEach((pkgDirname) => {
const { name } = require(path.join(
repoDir,
'packages',
pkgDirname,
'package.json'
))
pkgPaths.set(
name,
path.join(
repoDir,
'packages',
pkgDirname,
`packed-${pkgDirname}.tgz`
)
)
})
return pkgPaths
} else {
// TODO: remove after next stable release (current v13.1.2)
const pkgPaths = new Map()
const pkgDatas = new Map()
let pkgs
try {
pkgs = await fs.readdir(path.join(repoDir, 'packages'))
} catch (err) {
if (err.code === 'ENOENT') {
require('console').log('no packages to link')
return pkgPaths
}
throw err
}
for (const pkg of pkgs) {
const pkgPath = path.join(repoDir, 'packages', pkg)
const packedPkgPath = path.join(pkgPath, `${pkg}-packed.tgz`)
const pkgDataPath = path.join(pkgPath, 'package.json')
if (!fs.existsSync(pkgDataPath)) {
require('console').log(`Skipping ${pkgDataPath}`)
continue
}
const pkgData = require(pkgDataPath)
const { name } = pkgData
pkgDatas.set(name, {
pkgDataPath,
pkg,
pkgPath,
pkgData,
packedPkgPath,
})
pkgPaths.set(name, packedPkgPath)
}
for (const pkg of pkgDatas.keys()) {
const { pkgDataPath, pkgData } = pkgDatas.get(pkg)
for (const pkg of pkgDatas.keys()) {
const { packedPkgPath } = pkgDatas.get(pkg)
if (!pkgData.dependencies || !pkgData.dependencies[pkg]) continue
pkgData.dependencies[pkg] = packedPkgPath
}
// make sure native binaries are included in local linking
if (pkg === '@next/swc') {
if (!pkgData.files) {
pkgData.files = []
}
pkgData.files.push('native/*')
require('console').log(
'using swc binaries: ',
await exec(`ls ${path.join(path.dirname(pkgDataPath), 'native')}`)
)
}
if (pkg === 'next') {
if (nextSwcVersion) {
Object.assign(pkgData.dependencies, {
'@next/swc-linux-x64-gnu': nextSwcVersion,
})
} else {
if (pkgDatas.get('@next/swc')) {
pkgData.dependencies['@next/swc'] =
pkgDatas.get('@next/swc').packedPkgPath
} else {
pkgData.files.push('native/*')
}
}
}
if (pkgData?.scripts?.prepublishOnly) {
// There's a bug in `pnpm pack` where it will run
// the prepublishOnly script and that will fail.
// See https://github.com/pnpm/pnpm/issues/2941
delete pkgData.scripts.prepublishOnly
}
await fs.writeFile(
pkgDataPath,
JSON.stringify(pkgData, null, 2),
'utf8'
)
}
// wait to pack packages until after dependency paths have been updated
// to the correct versions
await Promise.all(
Array.from(pkgDatas.keys()).map(async (pkgName) => {
const { pkg, pkgPath, pkgData, packedPkgPath } =
pkgDatas.get(pkgName)
// Copied from pnpm source: https://github.com/pnpm/pnpm/blob/5a5512f14c47f4778b8d2b6d957fb12c7ef40127/releasing/plugin-commands-publishing/src/pack.ts#L96
const tmpTarball = path.join(
pkgPath,
`${pkgData.name.replace('@', '').replace('/', '-')}-${
pkgData.version
}.tgz`
)
await execa('pnpm', ['pack'], {
cwd: pkgPath,
})
await fs.copyFile(tmpTarball, packedPkgPath)
})
)
return pkgPaths
}
},
}
}
const exec = require('../util/exec')
const parseField = (stdout = '', field = '') => {
return stdout.split(field).pop().trim().split(/\s/).shift().trim()
}
// benchmark an url
async function benchmarkUrl(
url = '',
options = {
reqTimeout: 60,
concurrency: 50,
numRequests: 2500,
}
) {
const { numRequests, concurrency, reqTimeout } = options
const { stdout } = await exec(
`ab -n ${numRequests} -c ${concurrency} -s ${reqTimeout} "${url}"`
)
const totalTime = parseFloat(parseField(stdout, 'Time taken for tests:'), 10)
const failedRequests = parseInt(parseField(stdout, 'Failed requests:'), 10)
const avgReqPerSec = parseFloat(parseField(stdout, 'Requests per second:'))
return {
totalTime,
avgReqPerSec,
failedRequests,
}
}
module.exports = benchmarkUrl
const path = require('path')
const fs = require('fs-extra')
const exec = require('../util/exec')
const glob = require('../util/glob')
const logger = require('../util/logger')
const { statsAppDir, diffingDir } = require('../constants')
module.exports = async function collectDiffs(
filesToTrack = [],
initial = false
) {
if (initial) {
logger('Setting up directory for diffing')
// set-up diffing directory
await fs.remove(diffingDir)
await fs.mkdirp(diffingDir)
await exec(`cd ${diffingDir} && git init`)
} else {
// remove any previous files in case they won't be overwritten
const toRemove = await glob('!(.git)', { cwd: diffingDir, dot: true })
await Promise.all(
toRemove.map((file) => fs.remove(path.join(diffingDir, file)))
)
}
const diffs = {}
await Promise.all(
filesToTrack.map(async (fileGroup) => {
const { globs } = fileGroup
const curFiles = []
await Promise.all(
globs.map(async (pattern) => {
curFiles.push(...(await glob(pattern, { cwd: statsAppDir })))
})
)
for (let file of curFiles) {
const absPath = path.join(statsAppDir, file)
const diffDest = path.join(diffingDir, file)
await fs.copy(absPath, diffDest)
}
if (curFiles.length > 0) {
const prettierPath = path.join(
__dirname,
'../../node_modules/.bin/prettier'
)
await exec(
`cd "${process.env.LOCAL_STATS ? process.cwd() : diffingDir}" && ` +
`${prettierPath} --write ${curFiles
.map((f) => path.join(diffingDir, f))
.join(' ')}`
)
}
})
)
await exec(`cd ${diffingDir} && git add .`, true)
if (initial) {
await exec(`cd ${diffingDir} && git commit -m 'initial commit'`)
} else {
let { stdout: renamedFiles } = await exec(
`cd ${diffingDir} && git diff --name-status HEAD`
)
renamedFiles = renamedFiles
.trim()
.split('\n')
.filter((line) => line.startsWith('R'))
diffs._renames = []
for (const line of renamedFiles) {
const [, prev, cur] = line.split('\t')
await fs.move(path.join(diffingDir, cur), path.join(diffingDir, prev))
diffs._renames.push({
prev,
cur,
})
}
await exec(`cd ${diffingDir} && git add .`)
let { stdout: changedFiles } = await exec(
`cd ${diffingDir} && git diff --name-only HEAD`
)
changedFiles = changedFiles.trim().split('\n')
for (const file of changedFiles) {
const fileKey = path.basename(file)
const hasFile = await fs.exists(path.join(diffingDir, file))
if (!hasFile) {
diffs[fileKey] = 'deleted'
continue
}
try {
let { stdout } = await exec(
`cd ${diffingDir} && git diff --minimal HEAD ${file}`
)
stdout = (stdout.split(file).pop() || '').trim()
if (stdout.length > 0) {
diffs[fileKey] = stdout
}
} catch (err) {
console.error(`Failed to diff ${file}: ${err.message}`)
diffs[fileKey] = `failed to diff`
}
}
}
return diffs
}
const path = require('path')
const fs = require('fs-extra')
const getPort = require('get-port')
const fetch = require('node-fetch')
const glob = require('../util/glob')
const gzipSize = require('gzip-size')
const logger = require('../util/logger')
const { spawn } = require('../util/exec')
const { parse: urlParse } = require('url')
const benchmarkUrl = require('./benchmark-url')
const { statsAppDir, diffingDir, benchTitle } = require('../constants')
module.exports = async function collectStats(
runConfig = {},
statsConfig = {},
fromDiff = false
) {
const stats = {
[benchTitle]: {},
}
const orderedStats = {
[benchTitle]: {},
}
const curDir = fromDiff ? diffingDir : statsAppDir
const hasPagesToFetch =
Array.isArray(runConfig.pagesToFetch) && runConfig.pagesToFetch.length > 0
const hasPagesToBench =
Array.isArray(runConfig.pagesToBench) && runConfig.pagesToBench.length > 0
if (
!fromDiff &&
statsConfig.appStartCommand &&
(hasPagesToFetch || hasPagesToBench)
) {
const port = await getPort()
const startTime = Date.now()
const child = spawn(statsConfig.appStartCommand, {
cwd: curDir,
env: {
PORT: port,
},
stdio: 'pipe',
})
let exitCode = null
let logStderr = true
let serverReadyResolve
let serverReadyResolved = false
const serverReadyPromise = new Promise((resolve) => {
serverReadyResolve = resolve
})
child.stdout.on('data', (data) => {
if (data.toString().includes('started server') && !serverReadyResolved) {
serverReadyResolved = true
serverReadyResolve()
}
process.stdout.write(data)
})
child.stderr.on('data', (data) => logStderr && process.stderr.write(data))
child.on('exit', (code) => {
if (!serverReadyResolved) {
serverReadyResolve()
serverReadyResolved = true
}
exitCode = code
})
await serverReadyPromise
if (!orderedStats['General']) {
orderedStats['General'] = {}
}
orderedStats['General']['nextStartReadyDuration (ms)'] =
Date.now() - startTime
if (exitCode !== null) {
throw new Error(
`Failed to run \`${statsConfig.appStartCommand}\` process exited with code ${exitCode}`
)
}
if (hasPagesToFetch) {
const fetchedPagesDir = path.join(curDir, 'fetched-pages')
await fs.mkdirp(fetchedPagesDir)
for (let url of runConfig.pagesToFetch) {
url = url.replace('$PORT', port)
const { pathname } = urlParse(url)
try {
const res = await fetch(url)
if (!res.ok) {
throw new Error(`Failed to fetch ${url} got status: ${res.status}`)
}
const responseText = (await res.text()).trim()
let fileName = pathname === '/' ? '/index' : pathname
if (fileName.endsWith('/')) fileName = fileName.slice(0, -1)
logger(
`Writing file to ${path.join(fetchedPagesDir, `${fileName}.html`)}`
)
await fs.writeFile(
path.join(fetchedPagesDir, `${fileName}.html`),
responseText,
'utf8'
)
} catch (err) {
logger.error(err)
}
}
}
if (hasPagesToBench) {
// disable stderr so we don't clobber logs while benchmarking
// any pages that create logs
logStderr = false
for (let url of runConfig.pagesToBench) {
url = url.replace('$PORT', port)
logger(`Benchmarking ${url}`)
const results = await benchmarkUrl(url, runConfig.benchOptions)
logger(`Finished benchmarking ${url}`)
const { pathname: key } = urlParse(url)
stats[benchTitle][`${key} failed reqs`] = results.failedRequests
stats[benchTitle][`${key} total time (seconds)`] = results.totalTime
stats[benchTitle][`${key} avg req/sec`] = results.avgReqPerSec
}
}
child.kill()
}
for (const fileGroup of runConfig.filesToTrack) {
const { name, globs } = fileGroup
const groupStats = {}
const curFiles = new Set()
for (const pattern of globs) {
const results = await glob(pattern, { cwd: curDir, nodir: true })
results.forEach((result) => curFiles.add(result))
}
for (const file of curFiles) {
const fileKey = path.basename(file)
const absPath = path.join(curDir, file)
try {
const fileInfo = await fs.stat(absPath)
groupStats[fileKey] = fileInfo.size
groupStats[`${fileKey} gzip`] = await gzipSize.file(absPath)
} catch (err) {
logger.error('Failed to get file stats', err)
}
}
stats[name] = groupStats
}
for (const fileGroup of runConfig.filesToTrack) {
const { name } = fileGroup
orderedStats[name] = stats[name]
}
if (stats[benchTitle]) {
orderedStats[benchTitle] = stats[benchTitle]
}
return orderedStats
}
const path = require('path')
const fs = require('fs-extra')
// getDirSize recursively gets size of all files in a directory
async function getDirSize(dir, ctx = { size: 0 }) {
let subDirs = await fs.readdir(dir)
subDirs = subDirs.map((d) => path.join(dir, d))
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)
}
ctx.size += fileStat.size
})
)
return ctx.size
}
module.exports = getDirSize
const path = require('path')
const fs = require('fs-extra')
const getPort = require('get-port')
const glob = require('../util/glob')
const exec = require('../util/exec')
const logger = require('../util/logger')
const getDirSize = require('./get-dir-size')
const collectStats = require('./collect-stats')
const collectDiffs = require('./collect-diffs')
const { statsAppDir, diffRepoDir, yarnEnvValues } = require('../constants')
async function runConfigs(
configs = [],
{ statsConfig, relativeStatsAppDir, mainRepoPkgPaths, diffRepoPkgPaths },
diffing = false
) {
const results = []
for (const config of configs) {
logger(`Running config: ${config.title}${diffing ? ' (diff)' : ''}`)
let mainRepoStats
let diffRepoStats
let diffs
for (const pkgPaths of [mainRepoPkgPaths, diffRepoPkgPaths]) {
let curStats = {
General: {
buildDuration: null,
buildDurationCached: null,
nodeModulesSize: null,
},
}
// if stats-config is in root of project we're analyzing
// the whole project so copy from each repo
const curStatsAppPath = path.join(diffRepoDir, relativeStatsAppDir)
// clean statsAppDir
await fs.remove(statsAppDir)
await fs.copy(curStatsAppPath, statsAppDir)
logger(`Copying ${curStatsAppPath} ${statsAppDir}`)
// apply config files
for (const configFile of config.configFiles || []) {
const filePath = path.join(statsAppDir, configFile.path)
await fs.writeFile(filePath, configFile.content, 'utf8')
}
// links local builds of the packages and installs dependencies
await linkPkgs(statsAppDir, pkgPaths)
if (!diffing) {
curStats.General.nodeModulesSize = await getDirSize(
path.join(statsAppDir, 'node_modules')
)
}
const buildStart = Date.now()
console.log(
await exec(
`cd ${statsAppDir} && ${statsConfig.appBuildCommand}`,
false,
{
env: yarnEnvValues,
}
)
)
curStats.General.buildDuration = Date.now() - buildStart
// apply renames to get deterministic output names
for (const rename of config.renames) {
const results = await glob(rename.srcGlob, { cwd: statsAppDir })
for (const result of results) {
let dest = rename.removeHash
? result.replace(/(\.|-)[0-9a-f]{16}(\.|-)/g, '$1HASH$2')
: rename.dest
if (result === dest) continue
await fs.move(
path.join(statsAppDir, result),
path.join(statsAppDir, dest)
)
}
}
const collectedStats = await collectStats(config, statsConfig)
for (const key of Object.keys(collectedStats)) {
curStats[key] = Object.assign({}, curStats[key], collectedStats[key])
}
const applyRenames = (renames, stats) => {
if (renames) {
for (const rename of renames) {
let { cur, prev } = rename
cur = path.basename(cur)
prev = path.basename(prev)
Object.keys(stats).forEach((group) => {
if (stats[group][cur]) {
stats[group][prev] = stats[group][cur]
stats[group][prev + ' gzip'] = stats[group][cur + ' gzip']
delete stats[group][cur]
delete stats[group][cur + ' gzip']
}
})
}
}
}
if (mainRepoStats) {
diffRepoStats = curStats
if (!diffing && config.diff !== false) {
for (const groupKey of Object.keys(curStats)) {
if (groupKey === 'General') continue
let changeDetected = config.diff === 'always'
const curDiffs = await collectDiffs(config.filesToTrack)
changeDetected = changeDetected || Object.keys(curDiffs).length > 0
applyRenames(curDiffs._renames, diffRepoStats)
delete curDiffs._renames
if (changeDetected) {
logger('Detected change, running diff')
diffs = await runConfigs(
[
{
...config,
configFiles: config.diffConfigFiles,
},
],
{
statsConfig,
mainRepoPkgPaths,
diffRepoPkgPaths,
relativeStatsAppDir,
},
true
)
delete diffs._renames
break
}
}
}
if (diffing) {
// copy new files and get diff results
return collectDiffs(config.filesToTrack)
}
} else {
// set up diffing folder and copy initial files
await collectDiffs(config.filesToTrack, true)
/* eslint-disable-next-line */
mainRepoStats = curStats
}
const secondBuildStart = Date.now()
console.log(
await exec(
`cd ${statsAppDir} && ${statsConfig.appBuildCommand}`,
false,
{
env: yarnEnvValues,
}
)
)
curStats.General.buildDurationCached = Date.now() - secondBuildStart
}
logger(`Finished running: ${config.title}`)
results.push({
title: config.title,
mainRepoStats,
diffRepoStats,
diffs,
})
}
return results
}
async function linkPkgs(pkgDir = '', pkgPaths) {
await fs.remove(path.join(pkgDir, 'node_modules'))
const pkgJsonPath = path.join(pkgDir, 'package.json')
const pkgData = require(pkgJsonPath)
if (!pkgData.dependencies && !pkgData.devDependencies) return
for (const pkg of pkgPaths.keys()) {
const pkgPath = pkgPaths.get(pkg)
if (pkgData.dependencies && pkgData.dependencies[pkg]) {
pkgData.dependencies[pkg] = pkgPath
} else if (pkgData.devDependencies && pkgData.devDependencies[pkg]) {
pkgData.devDependencies[pkg] = pkgPath
}
}
await fs.writeFile(pkgJsonPath, JSON.stringify(pkgData, null, 2), 'utf8')
await fs.remove(yarnEnvValues.YARN_CACHE_FOLDER)
await exec(
`cd ${pkgDir} && pnpm install --strict-peer-dependencies=false`,
false,
{
env: yarnEnvValues,
}
)
}
module.exports = runConfigs
const logger = require('./logger')
const { promisify } = require('util')
const { exec: execOrig, spawn: spawnOrig } = require('child_process')
const execP = promisify(execOrig)
const env = {
...process.env,
GITHUB_TOKEN: '',
PR_STATS_COMMENT_TOKEN: '',
}
function exec(command, noLog = false, opts = {}) {
if (!noLog) logger(`exec: ${command}`)
return execP(command, {
timeout: 180 * 1000,
...opts,
env: { ...env, ...opts.env },
})
}
exec.spawn = function spawn(command = '', opts = {}) {
logger(`spawn: ${command}`)
const child = spawnOrig('/bin/bash', ['-c', command], {
...opts,
env: {
...env,
...opts.env,
},
stdio: opts.stdio || 'inherit',
})
child.on('exit', (code, signal) => {
logger(`spawn exit (${code}, ${signal}): ${command}`)
})
return child
}
module.exports = exec
const globOrig = require('glob')
const { promisify } = require('util')
module.exports = promisify(globOrig)
function logger(...args) {
console.log(...args)
}
logger.json = (obj) => {
logger('\n', JSON.stringify(obj, null, 2), '\n')
}
logger.error = (...args) => {
console.error(...args)
}
logger.warn = (...args) => {
console.warn(...args)
}
module.exports = logger
# https://github.com/github/issue-labeler#basic-examples
# Should match the list "Which area(s) of Next.js are affected?" in:
# https://github.com/vercel/next.js/blob/canary/.github/ISSUE_TEMPLATE/1.bug_report.yml
'area: app': 'App directory (appDir: true)'
'area: create-next-app': 'CLI (create-next-app)'
'area: data fetching': 'Data fetching (gS(S)P, getInitialProps)'
'area: Edge': 'Middleware / Edge (API routes, runtime)'
'area: ESLint': 'ESLint (eslint-config-next)'
'area: export': 'Static HTML Export (next export)'
'area: Font Optimization': 'Font optimization (@next/font)'
'area: I18n': 'Internationalzation (i18n)'
'area: Jest': 'Jest (next/jest)'
'area: MDX': 'MDX (@next/mdx)'
'area: Metadata': 'Metadata (metadata, generateMetadata, next/head, head.js)'
'area: next/dynamic': 'Dynamic imports (next/dynamic)'
'area: next/image': 'Image optmization (next/image, next/legacy/image)'
'area: next/script': 'Script optimizatzion (next/script)'
'area: package manager': 'Package manager (npm, pnpm, Yarn)'
'area: Routing': 'Routing (next/router, next/navigation, next/link)'
'area: standalone mode': 'Standalone mode (output: "standalone")'
'area: SWC Minify': 'SWC minifier (swcMinify: true)'
'area: SWC transforms': 'SWC transpilation'
'area: Turbopack': 'Turbopack (--turbo)'
'area: TypeScript': 'TypeScript'
# Less used/old/redundant labels
# area: AMP
# area: API routes
# area: Application Code
# area: Codemods
# area: Compiler Performance
# area: Compiler
# area: Concurrent Features
# area: Debugger
# area: Developer Experience
# area: Ecosystem
# area: experimental
# area: Middleware
# area: Reliability
# area: Repository Maintenance
# area: Server Components
# area: Static Generation
# area: styled-jsx
# area: Tracing
# area: URL Imports
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm lint-staged
save-exact = true
tag-version-prefix=""
strict-peer-dependencies = false
auto-install-peers = true
lockfile = true
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This document has been moved to [nextjs.org/docs/upgrading](https://nextjs.org/docs/upgrading). It's also available in this repository on [/docs/upgrading.md](/docs/upgrading.md).
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment