language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
vercel
next.js
c47f3d84c4065b87d7ea7a0e1bbfe0f4f14dc08e.json
Unify installation scripts for example apps (#19808)
examples/with-stitches/README.md
@@ -13,9 +13,9 @@ Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu Execute [Create Next App](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the examp...
true
Other
vercel
next.js
c47f3d84c4065b87d7ea7a0e1bbfe0f4f14dc08e.json
Unify installation scripts for example apps (#19808)
examples/with-typescript-styled-components/README.md
@@ -13,9 +13,9 @@ Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the exa...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/.env.local.example
@@ -1,9 +0,0 @@ -# Update these with your Firebase app's values. -FIREBASE_CLIENT_EMAIL=my-example-app-email@example.com -NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=MyExampleAppAPIKey123 -NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=my-example-app.firebaseapp.com -NEXT_PUBLIC_FIREBASE_DATABASE_URL=https://my-example-app.firebaseio.com -N...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/README.md
@@ -1,38 +1,3 @@ -# Example: Firebase authentication with a serverless API +# With Firebase Authentication -This example includes Firebase authentication and serverless [API routes](https://nextjs.org/docs/api-routes/introduction). - -## How to use - -Execute [`create-next-app`](https://github.com/vercel/next.js/tree...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/components/FirebaseAuth.js
@@ -1,42 +0,0 @@ -import StyledFirebaseAuth from 'react-firebaseui/StyledFirebaseAuth' -import firebase from 'firebase/app' -import 'firebase/auth' -import initFirebase from '../utils/auth/initFirebase' -import { setUserCookie } from '../utils/auth/userCookies' -import { mapUserData } from '../utils/auth/mapUserData' -...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/package.json
@@ -1,20 +0,0 @@ -{ - "name": "with-firebase-authentication", - "version": "1.0.0", - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start" - }, - "dependencies": { - "firebase": "^7.15.5", - "firebase-admin": "^8.12.1", - "js-cookie": "2.2.1", - "next": "latest", ...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/pages/api/getFood.js
@@ -1,17 +0,0 @@ -import { verifyIdToken } from '../../utils/auth/firebaseAdmin' -const favoriteFoods = ['pizza', 'burger', 'chips', 'tortilla'] - -const getFood = async (req, res) => { - const token = req.headers.token - - try { - await verifyIdToken(token) - return res.status(200).json({ - food: favorite...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/pages/auth.js
@@ -1,14 +0,0 @@ -import FirebaseAuth from '../components/FirebaseAuth' - -const Auth = () => { - return ( - <div> - <p>Sign in</p> - <div> - <FirebaseAuth /> - </div> - </div> - ) -} - -export default Auth
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/pages/example.js
@@ -1,17 +0,0 @@ -import Link from 'next/link' - -const Example = (props) => { - return ( - <div> - <p> - This page is static because it does not fetch any data or include the - authed user info. - </p> - <Link href={'/'}> - <a>Home</a> - </Link> - </div> - ) -} - -expor...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/pages/index.js
@@ -1,63 +0,0 @@ -import useSWR from 'swr' -import Link from 'next/link' -import { useUser } from '../utils/auth/useUser' - -const fetcher = (url, token) => - fetch(url, { - method: 'GET', - headers: new Headers({ 'Content-Type': 'application/json', token }), - credentials: 'same-origin', - }).then((res) => ...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/utils/auth/firebaseAdmin.js
@@ -1,24 +0,0 @@ -import * as admin from 'firebase-admin' - -export const verifyIdToken = (token) => { - const firebasePrivateKey = process.env.FIREBASE_PRIVATE_KEY - - if (!admin.apps.length) { - admin.initializeApp({ - credential: admin.credential.cert({ - projectId: process.env.NEXT_PUBLIC_FIREBASE_...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/utils/auth/initFirebase.js
@@ -1,15 +0,0 @@ -import firebase from 'firebase/app' -import 'firebase/auth' - -const config = { - apiKey: process.env.NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY, - authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN, - databaseURL: process.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL, - projectId: process.env.NEXT_PUBLIC_...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/utils/auth/mapUserData.js
@@ -1,9 +0,0 @@ -export const mapUserData = async (user) => { - const { uid, email } = user - const token = await user.getIdToken(true) - return { - id: uid, - email, - token, - } -}
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/utils/auth/useUser.js
@@ -1,65 +0,0 @@ -import { useEffect, useState } from 'react' -import { useRouter } from 'next/router' -import firebase from 'firebase/app' -import 'firebase/auth' -import initFirebase from '../auth/initFirebase' -import { - removeUserCookie, - setUserCookie, - getUserFromCookie, -} from './userCookies' -import { ma...
true
Other
vercel
next.js
450e7130b082d8982f3e46c0e3e4dd7fad2d8048.json
Add example: Firebase authentication + SSR (#15202) Co-authored-by: Luis Alvarez D. <luis@vercel.com>
examples/with-firebase-authentication/utils/auth/userCookies.js
@@ -1,19 +0,0 @@ -import cookies from 'js-cookie' - -export const getUserFromCookie = () => { - const cookie = cookies.get('auth') - if (!cookie) { - return - } - return JSON.parse(cookie) -} - -export const setUserCookie = (user) => { - cookies.set('auth', user, { - // firebase id tokens expire in one hour ...
true
Other
vercel
next.js
a5b0094677b8f10e3104cb55c6a21da308ec6534.json
Fix shallow routing scroll (#21437) This ensures that Next.js will not scroll to the top of the page in shallow routing. Fixes: https://github.com/vercel/next.js/issues/21386 Fixes: https://github.com/vercel/next.js/issues/21366
packages/next/next-server/lib/router/router.ts
@@ -1093,13 +1093,16 @@ export default class Router implements BaseRouter { !(routeInfo.Component as any).getInitialProps } + // shallow routing is only allowed for same page URL changes. + const isValidShallowRoute = options.shallow && this.route === route await this.set( ...
true
Other
vercel
next.js
a5b0094677b8f10e3104cb55c6a21da308ec6534.json
Fix shallow routing scroll (#21437) This ensures that Next.js will not scroll to the top of the page in shallow routing. Fixes: https://github.com/vercel/next.js/issues/21386 Fixes: https://github.com/vercel/next.js/issues/21366
test/integration/client-navigation/pages/nav/shallow-routing.js
@@ -27,6 +27,17 @@ export default class extends Component { Router.push(href, href, { shallow: true }) } + increaseNonShallow() { + const counter = this.getCurrentCounter() + const href = `/nav/shallow-routing?counter=${counter + 1}` + Router.push(href, href, {}) + } + + gotoNavShallow() { + co...
true
Other
vercel
next.js
a5b0094677b8f10e3104cb55c6a21da308ec6534.json
Fix shallow routing scroll (#21437) This ensures that Next.js will not scroll to the top of the page in shallow routing. Fixes: https://github.com/vercel/next.js/issues/21386 Fixes: https://github.com/vercel/next.js/issues/21366
test/integration/client-navigation/test/index.test.js
@@ -854,6 +854,41 @@ describe('Client Navigation', () => { await browser.close() }) + + it('should keep the scroll position on shallow routing', async () => { + const browser = await webdriver(context.appPort, '/nav/shallow-routing') + await browser.eval(() => + document.querySelector(...
true
Other
vercel
next.js
ded6e24b3d2d6cb81444d6ed0db17b1299fb727a.json
Use autoprefixer instead of postcss-preset-env (#21215) I realized while looking over this that the `autoprefixer` plugin isn't being used by postcss because it's not included in the `postcss.config.js`. Additionally, since `postcss-preset-env` doesn't support PostCSS 8 yet, and it includes PostCSS 7 as a dependency, ...
examples/blog-starter-typescript/package.json
@@ -26,7 +26,6 @@ "@types/react-dom": "^16.9.8", "autoprefixer": "^10.2.1", "postcss": "^8.2.4", - "postcss-preset-env": "^6.7.0", "tailwindcss": "^2.0.2" }, "license": "MIT"
true
Other
vercel
next.js
ded6e24b3d2d6cb81444d6ed0db17b1299fb727a.json
Use autoprefixer instead of postcss-preset-env (#21215) I realized while looking over this that the `autoprefixer` plugin isn't being used by postcss because it's not included in the `postcss.config.js`. Additionally, since `postcss-preset-env` doesn't support PostCSS 8 yet, and it includes PostCSS 7 as a dependency, ...
examples/blog-starter-typescript/postcss.config.js
@@ -1,3 +1,3 @@ module.exports = { - plugins: ['tailwindcss', 'postcss-preset-env'], + plugins: ['tailwindcss', 'autoprefixer'], }
true
Other
vercel
next.js
ded6e24b3d2d6cb81444d6ed0db17b1299fb727a.json
Use autoprefixer instead of postcss-preset-env (#21215) I realized while looking over this that the `autoprefixer` plugin isn't being used by postcss because it's not included in the `postcss.config.js`. Additionally, since `postcss-preset-env` doesn't support PostCSS 8 yet, and it includes PostCSS 7 as a dependency, ...
examples/blog-starter/package.json
@@ -19,7 +19,6 @@ "devDependencies": { "autoprefixer": "^10.2.1", "postcss": "^8.2.4", - "postcss-preset-env": "^6.7.0", "tailwindcss": "^2.0.2" }, "license": "MIT"
true
Other
vercel
next.js
ded6e24b3d2d6cb81444d6ed0db17b1299fb727a.json
Use autoprefixer instead of postcss-preset-env (#21215) I realized while looking over this that the `autoprefixer` plugin isn't being used by postcss because it's not included in the `postcss.config.js`. Additionally, since `postcss-preset-env` doesn't support PostCSS 8 yet, and it includes PostCSS 7 as a dependency, ...
examples/blog-starter/postcss.config.js
@@ -1,3 +1,3 @@ module.exports = { - plugins: ['tailwindcss', 'postcss-preset-env'], + plugins: ['tailwindcss', 'autoprefixer'], }
true
Other
vercel
next.js
5b70802f619a7d5aa111a06850a51078a6ec5a60.json
Preserve asPath while resolving rewrites (#21410) * Preserve asPath while resolving rewrites * remove un-needed alias * Add new alias * Add return type for resolve rewrites
packages/next/build/webpack-config.ts
@@ -213,7 +213,7 @@ export default async function getBaseWebpackConfig( let plugins: PluginMetaData[] = [] let babelPresetPlugins: { dir: string; config: any }[] = [] - const hasRewrites = rewrites.length > 0 || dev + const hasRewrites = rewrites.length > 0 if (config.experimental.plugins) { plugins...
true
Other
vercel
next.js
5b70802f619a7d5aa111a06850a51078a6ec5a60.json
Preserve asPath while resolving rewrites (#21410) * Preserve asPath while resolving rewrites * remove un-needed alias * Add new alias * Add return type for resolve rewrites
packages/next/next-server/lib/router/router.ts
@@ -932,39 +932,23 @@ export default class Router implements BaseRouter { let resolvedAs = as if (process.env.__NEXT_HAS_REWRITES && as.startsWith('/')) { - resolvedAs = resolveRewrites( - addBasePath( - addLocale(delBasePath(parseRelativeUrl(as).pathname), this.locale) - ), + ...
true
Other
vercel
next.js
5b70802f619a7d5aa111a06850a51078a6ec5a60.json
Preserve asPath while resolving rewrites (#21410) * Preserve asPath while resolving rewrites * remove un-needed alias * Add new alias * Add return type for resolve rewrites
packages/next/next-server/lib/router/utils/resolve-rewrites-noop.ts
@@ -0,0 +1 @@ +export default function resolveRewrites() {}
true
Other
vercel
next.js
5b70802f619a7d5aa111a06850a51078a6ec5a60.json
Preserve asPath while resolving rewrites (#21410) * Preserve asPath while resolving rewrites * remove un-needed alias * Add new alias * Add return type for resolve rewrites
packages/next/next-server/lib/router/utils/resolve-rewrites.ts
@@ -4,6 +4,8 @@ import prepareDestination from './prepare-destination' import { Rewrite } from '../../../../lib/load-custom-routes' import { removePathTrailingSlash } from '../../../../client/normalize-trailing-slash' import { normalizeLocalePath } from '../../i18n/normalize-locale-path' +import { parseRelativeUrl }...
true
Other
vercel
next.js
5b70802f619a7d5aa111a06850a51078a6ec5a60.json
Preserve asPath while resolving rewrites (#21410) * Preserve asPath while resolving rewrites * remove un-needed alias * Add new alias * Add return type for resolve rewrites
test/integration/custom-routes-i18n/test/index.test.js
@@ -94,7 +94,13 @@ const runTests = () => { await browser.elementByCss('#to-about').click() await check(async () => { - const data = JSON.parse(await browser.elementByCss('#data').text()) + const data = JSON.parse( + cheerio + .load(await browser.eval('document.document...
true
Other
vercel
next.js
5b70802f619a7d5aa111a06850a51078a6ec5a60.json
Preserve asPath while resolving rewrites (#21410) * Preserve asPath while resolving rewrites * remove un-needed alias * Add new alias * Add return type for resolve rewrites
test/integration/production/test/index.test.js
@@ -10,6 +10,7 @@ import { stopApp, waitFor, getPageFileFromPagesManifest, + check, } from 'next-test-utils' import webdriver from 'next-webdriver' import { @@ -860,6 +861,27 @@ describe('Production Usage', () => { expect(missing).toBe(false) }) + it('should preserve query when hard navigating f...
true
Other
vercel
next.js
02aa7b28da4a31fe51dff2ab25d7751c576a7d47.json
ci: stabilize Window CI (#21344) This skips a test suite that always flakes on Windows due to `http-proxy` <> Windows interop issues.
test/integration/ssg-data-404/test/index.test.js
@@ -48,6 +48,11 @@ const runTests = () => { } describe('SSG data 404', () => { + if (process.platform === 'win32') { + it('should skip this suite on Windows', () => {}) + return + } + describe('dev mode', () => { beforeAll(async () => { appPort = await findPort()
false
Other
vercel
next.js
5d98874e8fbfde9188090c1b93eeb62cc141f397.json
Add guide "Migrating from Create React App" (#21212)
docs/manifest.json
@@ -213,6 +213,14 @@ { "title": "Migrating from Gatsby", "path": "/docs/migrating/from-gatsby.md" + }, + { + "title": "Migrating from Create React App", + "path": "/docs/migrating/from-create-react-app.md" + }, + ...
true
Other
vercel
next.js
5d98874e8fbfde9188090c1b93eeb62cc141f397.json
Add guide "Migrating from Create React App" (#21212)
docs/migrating/from-create-react-app.md
@@ -0,0 +1,238 @@ +--- +description: Learn how to transition an existing Create React App project to Next.js. +--- + +# Migrating from Create React App + +This guide will help you understand how to transition from an existing non-ejected Create React App project to Next.js. Migrating to Next.js will allow you to: + +- ...
true
Other
vercel
next.js
c7e2a1df6a698a129869c7f1e8b53e9da2b0d02c.json
Use SWC for Next.js core client files (#27196) Replaces Babel with SWC for Next.js core client-side files. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request ...
packages/next/client/request-idle-callback.ts
@@ -18,7 +18,9 @@ declare global { } export const requestIdleCallback = - (typeof self !== 'undefined' && self.requestIdleCallback) || + (typeof self !== 'undefined' && + self.requestIdleCallback && + self.requestIdleCallback.bind(window)) || function ( cb: (deadline: RequestIdleCallbackDeadline) =>...
true
Other
vercel
next.js
c7e2a1df6a698a129869c7f1e8b53e9da2b0d02c.json
Use SWC for Next.js core client files (#27196) Replaces Babel with SWC for Next.js core client-side files. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request ...
packages/next/client/router.ts
@@ -141,7 +141,7 @@ export function useRouter(): NextRouter { // Create a router and assign it as the singleton instance. // This is used in client side when we are initilizing the app. // This should **not** be used inside the server. -export const createRouter = (...args: RouterArgs): Router => { +export function ...
true
Other
vercel
next.js
c7e2a1df6a698a129869c7f1e8b53e9da2b0d02c.json
Use SWC for Next.js core client files (#27196) Replaces Babel with SWC for Next.js core client-side files. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request ...
packages/next/package.json
@@ -59,7 +59,6 @@ "taskr": { "requires": [ "./taskfile-ncc.js", - "./taskfile-babel.js", "./taskfile-swc.js" ] }, @@ -100,7 +99,6 @@ "pnp-webpack-plugin": "1.6.4", "postcss": "8.2.15", "process": "0.11.10", - "prop-types": "15.7.2", "querystring-es3": "0.2.1", ...
true
Other
vercel
next.js
c7e2a1df6a698a129869c7f1e8b53e9da2b0d02c.json
Use SWC for Next.js core client files (#27196) Replaces Babel with SWC for Next.js core client-side files. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request ...
packages/next/pages/_document.tsx
@@ -1,4 +1,3 @@ -import PropTypes from 'prop-types' import React, { Component, ReactElement, ReactNode, useContext } from 'react' import flush from 'styled-jsx/server' import { @@ -234,11 +233,6 @@ export class Head extends Component< > { static contextType = DocumentComponentContext - static propTypes = { - ...
true
Other
vercel
next.js
c7e2a1df6a698a129869c7f1e8b53e9da2b0d02c.json
Use SWC for Next.js core client files (#27196) Replaces Babel with SWC for Next.js core client-side files. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request ...
packages/next/taskfile-babel.js
@@ -1,152 +0,0 @@ -// taskr babel plugin with Babel 7 support -// https://github.com/lukeed/taskr/pull/305 - -const path = require('path') - -// eslint-disable-next-line import/no-extraneous-dependencies -const transform = require('@babel/core').transform - -const babelClientPresetEnvOptions = { - modules: 'commonjs',...
true
Other
vercel
next.js
c7e2a1df6a698a129869c7f1e8b53e9da2b0d02c.json
Use SWC for Next.js core client files (#27196) Replaces Babel with SWC for Next.js core client-side files. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request ...
packages/next/taskfile-swc.js
@@ -16,10 +16,34 @@ module.exports = function (task) { // Don't compile .d.ts if (file.base.endsWith('.d.ts')) return - const options = { - filename: path.join(file.dir, file.base), - sourceMaps: true, + const isClient = serverOrClient === 'client' + const swcClientOptions = { + mo...
true
Other
vercel
next.js
c7e2a1df6a698a129869c7f1e8b53e9da2b0d02c.json
Use SWC for Next.js core client files (#27196) Replaces Babel with SWC for Next.js core client-side files. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request ...
packages/next/taskfile.js
@@ -861,7 +861,7 @@ export async function nextbuild(task, opts) { export async function client(task, opts) { await task .source(opts.src || 'client/**/*.+(js|ts|tsx)') - .babel('client', { dev: opts.dev }) + .swc('client', { dev: opts.dev }) .target('dist/client') notify('Compiled client files') ...
true
Other
vercel
next.js
c7e2a1df6a698a129869c7f1e8b53e9da2b0d02c.json
Use SWC for Next.js core client files (#27196) Replaces Babel with SWC for Next.js core client-side files. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request ...
test/integration/build-output/test/index.test.js
@@ -127,7 +127,7 @@ describe('Build Output', () => { expect(indexFirstLoad.endsWith('kB')).toBe(true) // expect(parseFloat(err404Size)).toBeCloseTo(gz ? 3.17 : 8.51, 1) - expect(err404Size.endsWith('kB')).toBe(true) + expect(err404Size.endsWith('B')).toBe(true) // ...
true
Other
vercel
next.js
c7e2a1df6a698a129869c7f1e8b53e9da2b0d02c.json
Use SWC for Next.js core client files (#27196) Replaces Babel with SWC for Next.js core client-side files. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request ...
yarn.lock
@@ -5589,7 +5589,7 @@ babel-jest@^27.0.0-next.8: graceful-fs "^4.2.4" slash "^3.0.0" -babel-plugin-dynamic-import-node@2.3.3, babel-plugin-dynamic-import-node@^2.3.3: +babel-plugin-dynamic-import-node@^2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/bab...
true
Other
vercel
next.js
97a140f7339d8dc99539f89d3a888de8f007390c.json
fix(critical CSS): use the assetPrefix in the critters config (#27506) This PR fixes #25927 bug which prevents to use `assetPrefix` config with the experimental critical CSS feature. Fixes: #25927 ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link...
packages/next/server/render.tsx
@@ -1146,7 +1146,7 @@ export async function renderToHTML( ssrMode: true, reduceInlineStyles: false, path: renderOpts.distDir, - publicPath: '/_next/', + publicPath: `${renderOpts.assetPrefix}/_next/`, preload: 'media', fonts: false, ...renderOpts.optimizeCss,
false
Other
vercel
next.js
57501fa7452f7d52aca29b2046f6d9e06ae2ba2e.json
Fix typo in placeholder-blur-data-url error docs (#27510) ✨
errors/placeholder-blur-data-url.md
@@ -4,7 +4,7 @@ You are attempting use the `next/image` component with `placeholder=blur` property but no `blurDataURL` property. -The `blurDataURL` might be missing because your using a string for `src` instead of a static import. +The `blurDataURL` might be missing because you're using a string for `src` instead...
false
Other
vercel
next.js
c88898be120bf598958438b9bc07cc6fe6c4636a.json
Clarify error message in isSerializableProps (#22856) I recently received the "Props must be returned as a plain object" error when I accidentally dropped an array directly inside `props`. This is a trivial error to fix once you know what you did, but I spent good 30 minutes looking in all the wrong places. I hope tha...
packages/next/lib/is-serializable-props.ts
@@ -1,7 +1,11 @@ const regexpPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/ +function getObjectClassLabel(value: any): string { + return Object.prototype.toString.call(value) +} + function isPlainObject(value: any): boolean { - if (Object.prototype.toString.call(value) !== '[object Object]') { + if (getObjectCla...
true
Other
vercel
next.js
c88898be120bf598958438b9bc07cc6fe6c4636a.json
Clarify error message in isSerializableProps (#22856) I recently received the "Props must be returned as a plain object" error when I accidentally dropped an array directly inside `props`. This is a trivial error to fix once you know what you did, but I spent good 30 minutes looking in all the wrong places. I hope tha...
test/unit/is-serializable-props.unit.test.js
@@ -5,15 +5,35 @@ describe('isSerializableProps', () => { it('handles null and undefined props', () => { expect(() => isSerializableProps('/', 'test', null)) .toThrowErrorMatchingInlineSnapshot(` -"Error serializing props returned from \`test\` in \\"/\\". -Reason: Props must be returned as a plain objec...
true
Other
vercel
next.js
9cbc4aacd50d0e79be7b8178eec9219457514da9.json
Add locale switcher to i18n-routing example (#27444) * add locale switcher to dynamic GSP page in i18n-routing example * Apply suggestions from code review Co-authored-by: JJ Kasper <jj@jjsweb.site> * Add switcher to other pages as well Co-authored-by: JJ Kasper <jj@jjsweb.site>
examples/i18n-routing/components/locale-switcher.js
@@ -0,0 +1,26 @@ +import Link from 'next/link' +import { useRouter } from 'next/router' + +export default function LocaleSwitcher() { + const router = useRouter() + const { locales, locale: activeLocale } = router + const otherLocales = locales.filter((locale) => locale !== activeLocale) + + return ( + <div> + ...
true
Other
vercel
next.js
9cbc4aacd50d0e79be7b8178eec9219457514da9.json
Add locale switcher to i18n-routing example (#27444) * add locale switcher to dynamic GSP page in i18n-routing example * Apply suggestions from code review Co-authored-by: JJ Kasper <jj@jjsweb.site> * Add switcher to other pages as well Co-authored-by: JJ Kasper <jj@jjsweb.site>
examples/i18n-routing/pages/gsp/[slug].js
@@ -1,5 +1,6 @@ import Link from 'next/link' import { useRouter } from 'next/router' +import LocaleSwitcher from '../../components/locale-switcher' export default function GspPage(props) { const router = useRouter() @@ -17,6 +18,8 @@ export default function GspPage(props) { <p>Default locale: {defaultLoc...
true
Other
vercel
next.js
9cbc4aacd50d0e79be7b8178eec9219457514da9.json
Add locale switcher to i18n-routing example (#27444) * add locale switcher to dynamic GSP page in i18n-routing example * Apply suggestions from code review Co-authored-by: JJ Kasper <jj@jjsweb.site> * Add switcher to other pages as well Co-authored-by: JJ Kasper <jj@jjsweb.site>
examples/i18n-routing/pages/gsp/index.js
@@ -1,5 +1,6 @@ import Link from 'next/link' import { useRouter } from 'next/router' +import LocaleSwitcher from '../../components/locale-switcher' export default function GspPage(props) { const router = useRouter() @@ -12,6 +13,8 @@ export default function GspPage(props) { <p>Default locale: {defaultLoc...
true
Other
vercel
next.js
9cbc4aacd50d0e79be7b8178eec9219457514da9.json
Add locale switcher to i18n-routing example (#27444) * add locale switcher to dynamic GSP page in i18n-routing example * Apply suggestions from code review Co-authored-by: JJ Kasper <jj@jjsweb.site> * Add switcher to other pages as well Co-authored-by: JJ Kasper <jj@jjsweb.site>
examples/i18n-routing/pages/gssp.js
@@ -1,5 +1,6 @@ import Link from 'next/link' import { useRouter } from 'next/router' +import LocaleSwitcher from '../components/locale-switcher' export default function GsspPage(props) { const router = useRouter() @@ -12,6 +13,8 @@ export default function GsspPage(props) { <p>Default locale: {defaultLoca...
true
Other
vercel
next.js
9cbc4aacd50d0e79be7b8178eec9219457514da9.json
Add locale switcher to i18n-routing example (#27444) * add locale switcher to dynamic GSP page in i18n-routing example * Apply suggestions from code review Co-authored-by: JJ Kasper <jj@jjsweb.site> * Add switcher to other pages as well Co-authored-by: JJ Kasper <jj@jjsweb.site>
examples/i18n-routing/pages/index.js
@@ -1,5 +1,6 @@ import Link from 'next/link' import { useRouter } from 'next/router' +import LocaleSwitcher from '../components/locale-switcher' export default function IndexPage(props) { const router = useRouter() @@ -12,6 +13,8 @@ export default function IndexPage(props) { <p>Default locale: {defaultLo...
true
Other
vercel
next.js
4e74db2d559313ce6f96eadd3387871268e2dd53.json
Add `lazyBoundary` prop to Image component (#27258) This PR adds `lazyBoundary` prop on Image Component. This feature is to load the images earlier. I'm not good at English. So, I couldn't explain enough in the documentation what `lazyBoundary` is. Feature request: https://github.com/vercel/next.js/discussions/24552 ...
docs/api-reference/next/image.md
@@ -16,6 +16,7 @@ description: Enable Image Optimization with the built-in Image component. | Version | Changes | | --------- | ------------------------------------------------------------------------------------------------...
true
Other
vercel
next.js
4e74db2d559313ce6f96eadd3387871268e2dd53.json
Add `lazyBoundary` prop to Image component (#27258) This PR adds `lazyBoundary` prop on Image Component. This feature is to load the images earlier. I'm not good at English. So, I couldn't explain enough in the documentation what `lazyBoundary` is. Feature request: https://github.com/vercel/next.js/discussions/24552 ...
packages/next/client/image.tsx
@@ -97,6 +97,7 @@ export type ImageProps = Omit< quality?: number | string priority?: boolean loading?: LoadingValue + lazyBoundary?: string placeholder?: PlaceholderValue blurDataURL?: string unoptimized?: boolean @@ -285,6 +286,7 @@ export default function Image({ unoptimized = false, priorit...
true
Other
vercel
next.js
4e74db2d559313ce6f96eadd3387871268e2dd53.json
Add `lazyBoundary` prop to Image component (#27258) This PR adds `lazyBoundary` prop on Image Component. This feature is to load the images earlier. I'm not good at English. So, I couldn't explain enough in the documentation what `lazyBoundary` is. Feature request: https://github.com/vercel/next.js/discussions/24552 ...
test/integration/image-component/basic/pages/lazy.js
@@ -46,6 +46,14 @@ const Lazy = () => { height={400} width={1900} ></Image> + <div style={{ height: '2000px' }}></div> + <Image + id="lazy-boundary" + src="lazy6.jpg" + height={400} + width={800} + lazyBoundary="0px 0px 500px 0px" + ></Image> ...
true
Other
vercel
next.js
4e74db2d559313ce6f96eadd3387871268e2dd53.json
Add `lazyBoundary` prop to Image component (#27258) This PR adds `lazyBoundary` prop on Image Component. This feature is to load the images earlier. I'm not good at English. So, I couldn't explain enough in the documentation what `lazyBoundary` is. Feature request: https://github.com/vercel/next.js/discussions/24552 ...
test/integration/image-component/basic/test/index.test.js
@@ -205,6 +205,32 @@ function lazyLoadingTests() { await browser.elementById('eager-loading').getAttribute('srcset') ).toBeTruthy() }) + + it('should load the sixth image, which has lazyBoundary property after scrolling down', async () => { + expect(await browser.elementById('lazy-boundary').getAttri...
true
Other
vercel
next.js
1d347ba5dc4c863991d374cda29efef6f82db80a.json
Fix typo in error message (#27438) Fixes typo mentioned in https://github.com/vercel/next.js/pull/27346#discussion_r675477904
errors/manifest.json
@@ -428,7 +428,7 @@ "path": "/errors/page-data-collection-timeout.md" }, { - "titlle": "sharp-missing-in-production", + "title": "sharp-missing-in-production", "path": "/errors/sharp-missing-in-production.md" } ]
true
Other
vercel
next.js
1d347ba5dc4c863991d374cda29efef6f82db80a.json
Fix typo in error message (#27438) Fixes typo mentioned in https://github.com/vercel/next.js/pull/27346#discussion_r675477904
packages/next/server/image-optimizer.ts
@@ -367,7 +367,7 @@ export async function imageOptimizer( if (shouldShowSharpWarning) { console.warn( chalk.yellow.bold('Warning: ') + - `For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js ...
true
Other
vercel
next.js
888c7002d66645aaeaa8882a519d55fa34f111e5.json
Fix external redirect with i18n domains (#27415) This corrects a case when redirecting with i18n locale domains configured the locale domain would be prefixed on external redirects un-necessarily. Fixes: https://github.com/vercel/next.js/issues/27405 ## Bug - [x] Related issues linked using `fixes #number` - [x] I...
packages/next/lib/load-custom-routes.ts
@@ -514,21 +514,23 @@ function processRoutes<T>( const destBasePath = srcBasePath && !isExternal ? srcBasePath : '' if (config.i18n && r.locale !== false) { - defaultLocales.forEach((item) => { - let destination - - if (r.destination) { - destination = item.base - ? `$...
true
Other
vercel
next.js
888c7002d66645aaeaa8882a519d55fa34f111e5.json
Fix external redirect with i18n domains (#27415) This corrects a case when redirecting with i18n locale domains configured the locale domain would be prefixed on external redirects un-necessarily. Fixes: https://github.com/vercel/next.js/issues/27405 ## Bug - [x] Related issues linked using `fixes #number` - [x] I...
test/integration/i18n-support-base-path/next.config.js
@@ -55,6 +55,11 @@ module.exports = { destination: '/', permanent: false, }, + { + source: '/redirect-5', + destination: 'https://jobs.example.com', + permanent: false, + }, ] }, async rewrites() {
true
Other
vercel
next.js
888c7002d66645aaeaa8882a519d55fa34f111e5.json
Fix external redirect with i18n domains (#27415) This corrects a case when redirecting with i18n locale domains configured the locale domain would be prefixed on external redirects un-necessarily. Fixes: https://github.com/vercel/next.js/issues/27405 ## Bug - [x] Related issues linked using `fixes #number` - [x] I...
test/integration/i18n-support/next.config.js
@@ -56,6 +56,11 @@ module.exports = { destination: '/', permanent: false, }, + { + source: '/redirect-5', + destination: 'https://jobs.example.com', + permanent: false, + }, ] }, async rewrites() {
true
Other
vercel
next.js
888c7002d66645aaeaa8882a519d55fa34f111e5.json
Fix external redirect with i18n domains (#27415) This corrects a case when redirecting with i18n locale domains configured the locale domain would be prefixed on external redirects un-necessarily. Fixes: https://github.com/vercel/next.js/issues/27405 ## Bug - [x] Related issues linked using `fixes #number` - [x] I...
test/integration/i18n-support/test/shared.js
@@ -37,6 +37,47 @@ async function addDefaultLocaleCookie(browser) { } export function runTests(ctx) { + it('should redirect external domain correctly', async () => { + const res = await fetchViaHTTP( + ctx.appPort, + `${ctx.basePath || ''}/do/redirect-5`, + undefined, + { + headers: {...
true
Other
vercel
next.js
14fb7df7f14b30b58a37b0bbb2a2ee8b669c52cb.json
Clarify automatic updates in deployment. (#27418) Slightly more clear 😄
docs/deployment.md
@@ -56,7 +56,7 @@ When you deploy your Next.js application, you want to see the latest version wit Next.js will automatically load the latest version of your application in the background when routing. For client-side navigation, `next/link` will temporarily function as a normal `<a>` tag. -If a new page (with an ...
false
Other
vercel
next.js
52ae69ac33a50ce1051b7d3ef0e74bc49d5e3972.json
Rename spr config to ISR (#27379)
packages/next/server/config-shared.ts
@@ -79,7 +79,7 @@ export type NextConfig = { [key: string]: any } & { cpus?: number plugins?: boolean profiling?: boolean - sprFlushToDisk?: boolean + isrFlushToDisk?: boolean reactMode?: 'legacy' | 'concurrent' | 'blocking' workerThreads?: boolean pageEnv?: boolean @@ -152,7 +152,7 ...
true
Other
vercel
next.js
52ae69ac33a50ce1051b7d3ef0e74bc49d5e3972.json
Rename spr config to ISR (#27379)
packages/next/server/next-server.ts
@@ -277,7 +277,7 @@ export default class Server { ), locales: this.nextConfig.i18n?.locales, max: this.nextConfig.experimental.isrMemoryCacheSize, - flushToDisk: !minimalMode && this.nextConfig.experimental.sprFlushToDisk, + flushToDisk: !minimalMode && this.nextConfig.experimental.isrFlu...
true
Other
vercel
next.js
dbfce34ead5125ed9b0b952d50f7b0e1ae43154e.json
Add configuration for ISR Memory Cache Size (#21535) (#27337) This allows the user to adjust the LRU cache size according to the application need: - optimize the cache size based on average page HTML & JSON size - disable the memory cache by setting the size to 0 The hard-coded default of 50MB has been moved from th...
packages/next/server/config-shared.ts
@@ -101,6 +101,7 @@ export type NextConfig = { [key: string]: any } & { esmExternals?: boolean | 'loose' staticPageGenerationTimeout?: number pageDataCollectionTimeout?: number + isrMemoryCacheSize?: number } } @@ -166,6 +167,8 @@ export const defaultConfig: NextConfig = { esmExternals: fal...
true
Other
vercel
next.js
dbfce34ead5125ed9b0b952d50f7b0e1ae43154e.json
Add configuration for ISR Memory Cache Size (#21535) (#27337) This allows the user to adjust the LRU cache size according to the application need: - optimize the cache size based on average page HTML & JSON size - disable the memory cache by setting the size to 0 The hard-coded default of 50MB has been moved from th...
packages/next/server/incremental-cache.ts
@@ -39,7 +39,7 @@ export class IncrementalCache { } prerenderManifest: PrerenderManifest - cache: LRUCache<string, IncrementalCacheEntry> + cache?: LRUCache<string, IncrementalCacheEntry> locales?: string[] constructor({ @@ -85,15 +85,16 @@ export class IncrementalCache { max = parseInt(process...
true
Other
vercel
next.js
dbfce34ead5125ed9b0b952d50f7b0e1ae43154e.json
Add configuration for ISR Memory Cache Size (#21535) (#27337) This allows the user to adjust the LRU cache size according to the application need: - optimize the cache size based on average page HTML & JSON size - disable the memory cache by setting the size to 0 The hard-coded default of 50MB has been moved from th...
packages/next/server/next-server.ts
@@ -276,6 +276,7 @@ export default class Server { 'pages' ), locales: this.nextConfig.i18n?.locales, + max: this.nextConfig.experimental.isrMemoryCacheSize, flushToDisk: !minimalMode && this.nextConfig.experimental.sprFlushToDisk, }) this.responseCache = new ResponseCache(th...
true
Other
vercel
next.js
bdcb8b0a716601fe366beab9ecdc90eb3df2b7ea.json
Allow enabling worker threads on dev server (#23027) Co-authored-by: JJ Kasper <jj@jjsweb.site>
packages/next/server/dev/next-dev-server.ts
@@ -121,6 +121,7 @@ export default class DevServer extends Server { { maxRetries: 1, numWorkers: this.nextConfig.experimental.cpus, + enableWorkerThreads: this.nextConfig.experimental.workerThreads, forkOptions: { env: { ...process.env,
false
Other
vercel
next.js
527cb97b56cf5be39a5076c4811cb1c91f8824d4.json
Support multiple pages directories for linting (#25565) Monorepos may contain multiple NextJS apps, but linting occurs at top-level so all directories must be declared. Declaring multiple directories via an Array allows loading all to generate a full list of potential URLs. Updated schema and tests. Also optimized s...
packages/eslint-plugin-next/lib/rules/no-html-link-for-pages.js
@@ -1,7 +1,7 @@ const path = require('path') const fs = require('fs') const { - getUrlFromPagesDirectory, + getUrlFromPagesDirectories, normalizeURL, execOnce, } = require('../utils/url') @@ -13,6 +13,10 @@ const pagesDirWarning = execOnce((pagesDirs) => { ) }) +// Cache for fs.existsSync lookup. +// ...
true
Other
vercel
next.js
527cb97b56cf5be39a5076c4811cb1c91f8824d4.json
Support multiple pages directories for linting (#25565) Monorepos may contain multiple NextJS apps, but linting occurs at top-level so all directories must be declared. Declaring multiple directories via an Array allows loading all to generate a full list of potential URLs. Updated schema and tests. Also optimized s...
packages/eslint-plugin-next/lib/utils/url.js
@@ -1,43 +1,64 @@ const fs = require('fs') const path = require('path') +// Cache for fs.lstatSync lookup. +// Prevent multiple blocking IO requests that have already been calculated. +const fsLstatSyncCache = {} +const fsLstatSync = (source) => { + fsLstatSyncCache[source] = fsLstatSyncCache[source] || fs.lstatSy...
true
Other
vercel
next.js
527cb97b56cf5be39a5076c4811cb1c91f8824d4.json
Support multiple pages directories for linting (#25565) Monorepos may contain multiple NextJS apps, but linting occurs at top-level so all directories must be declared. Declaring multiple directories via an Array allows loading all to generate a full list of potential URLs. Updated schema and tests. Also optimized s...
test/eslint-plugin-next/no-html-link-for-pages.unit.test.js
@@ -18,6 +18,18 @@ const linterConfig = { }, }, } +const linterConfigWithMultipleDirectories = { + ...linterConfig, + rules: { + 'no-html-link-for-pages': [ + 2, + [ + path.join(__dirname, 'custom-pages'), + path.join(__dirname, 'custom-pages/list'), + ], + ], + }, +} l...
true
Other
vercel
next.js
09baca03ad4cfba9706e5ed0f8ee5118c0040d24.json
docs: add note for Image responsive layout (#25915) With the default Next.js template project, the .main and .container divs have `display: flex` style rule. However, as commented in [this issue](https://github.com/vercel/next.js/issues/18489#issuecomment-857146988), if may not display properly an <Image /> placed as ...
docs/api-reference/next/image.md
@@ -100,6 +100,7 @@ but maintain the original dimensions for larger viewports. When `responsive`, the image will scale the dimensions down for smaller viewports and scale up for larger viewports. +Note: the responsive layout may not work correctly if the parent element uses a display value other than `block` such a...
false
Other
vercel
next.js
b4be678e35e2683f670fc17438434ce6b923468a.json
Remove duplicate type for StaticImageData (#27931) Follow up to #27916 This interface was defined twice so I removed the private one and kept the global/public one. https://github.com/vercel/next.js/blob/eb871d30915d668dd9ba897d4d04ced207ce2e6d/packages/next/image-types/global.d.ts#L4-L9 https://github.com/vercel/...
packages/next/client/image.tsx
@@ -57,13 +57,6 @@ type OnLoadingComplete = (result: { type ImgElementStyle = NonNullable<JSX.IntrinsicElements['img']['style']> -interface StaticImageData { - src: string - height: number - width: number - blurDataURL?: string -} - interface StaticRequire { default: StaticImageData }
false
Other
vercel
next.js
9d3e895124fcadfef57dc253d887bce4aa604ae9.json
Upgrade styled-jsx to v4 (#27890) Upgrade styled-jsx to v4 for supporting concurrent mode in react 18 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RF...
packages/next/package.json
@@ -106,7 +106,7 @@ "stream-browserify": "3.0.0", "stream-http": "3.1.1", "string_decoder": "1.3.0", - "styled-jsx": "3.4.7", + "styled-jsx": "4.0.0", "timers-browserify": "2.0.12", "tty-browserify": "0.0.1", "use-subscription": "1.5.1",
true
Other
vercel
next.js
9d3e895124fcadfef57dc253d887bce4aa604ae9.json
Upgrade styled-jsx to v4 (#27890) Upgrade styled-jsx to v4 for supporting concurrent mode in react 18 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RF...
yarn.lock
@@ -551,6 +551,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz#d0f0e277c512e0c938277faa85a3968c9a44c0e8" integrity sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg== +"@babel/helper-validator-id...
true
Other
vercel
next.js
b60c943750ff63b086f6adaf20daac3aa6e23573.json
Remove extraneous fs.stat calls (#27779) ## Performance improvement - [x] Performance improvement Uses `fs.readdir`'s `withFileTypes` option, added in NodeJS version 10, to simultaneously read the target directories files and their stats, removing the need to call `fs.stat` on each of the files individually. Simi...
packages/next/lib/recursive-copy.ts
@@ -1,5 +1,5 @@ import path from 'path' -import { promises, constants } from 'fs' +import { promises, constants, Dirent, Stats } from 'fs' import { Sema } from 'next/dist/compiled/async-sema' const COPYFILE_EXCL = constants.COPYFILE_EXCL @@ -23,13 +23,28 @@ export async function recursiveCopy( const sema = ne...
true
Other
vercel
next.js
b60c943750ff63b086f6adaf20daac3aa6e23573.json
Remove extraneous fs.stat calls (#27779) ## Performance improvement - [x] Performance improvement Uses `fs.readdir`'s `withFileTypes` option, added in NodeJS version 10, to simultaneously read the target directories files and their stats, removing the need to call `fs.stat` on each of the files individually. Simi...
packages/next/lib/recursive-delete.ts
@@ -1,4 +1,4 @@ -import { promises } from 'fs' +import { Dirent, promises } from 'fs' import { join } from 'path' import { promisify } from 'util' @@ -41,7 +41,7 @@ export async function recursiveDelete( ): Promise<void> { let result try { - result = await promises.readdir(dir) + result = await promise...
true
Other
vercel
next.js
b60c943750ff63b086f6adaf20daac3aa6e23573.json
Remove extraneous fs.stat calls (#27779) ## Performance improvement - [x] Performance improvement Uses `fs.readdir`'s `withFileTypes` option, added in NodeJS version 10, to simultaneously read the target directories files and their stats, removing the need to call `fs.stat` on each of the files individually. Simi...
packages/next/lib/recursive-readdir.ts
@@ -23,7 +23,15 @@ export async function recursiveReadDir( const absolutePath = join(dir, part.name) if (ignore && ignore.test(part.name)) return - if (part.isDirectory()) { + // readdir does not follow symbolic links + // if part is a symbolic link, follow it using stat + let isDire...
true
Other
vercel
next.js
04bbea2cbe2e1f365c00bb95ef0b6f855f10ccdf.json
Add sourceFileName for SWC compiled core files Fixes the vscode debugger breakpoints. Thanks @kdy1 for implementing the `sourceFileName` option in SWC.
packages/next/taskfile-swc.js
@@ -74,9 +74,14 @@ module.exports = function (task) { const swcOptions = isClient ? swcClientOptions : swcServerOptions + const filePath = path.join(file.dir, file.base) + const fullFilePath = path.join(__dirname, filePath) + const distFilePath = path.dirname(path.join(__dirname, 'dist', filePath)) + ...
false
Other
vercel
next.js
b24cd1eaba4a8b3e6c23010a560f25032868c408.json
Use @vercel/fetch for run-tests requests (#27815) * Use @vercel/fetch for run-tests requests * update precompileld
package.json
@@ -57,6 +57,7 @@ "@types/string-hash": "1.1.1", "@typescript-eslint/eslint-plugin": "4.22.0", "@typescript-eslint/parser": "4.22.0", + "@vercel/fetch": "6.1.1", "@zeit/next-css": "1.0.2-canary.2", "@zeit/next-sass": "1.0.2-canary.2", "@zeit/next-typescript": "1.1.2-canary.0",
true
Other
vercel
next.js
b24cd1eaba4a8b3e6c23010a560f25032868c408.json
Use @vercel/fetch for run-tests requests (#27815) * Use @vercel/fetch for run-tests requests * update precompileld
packages/next/compiled/async-retry/index.js
@@ -1 +1 @@ -module.exports=(()=>{var t={454:(t,r,e)=>{t.exports=e(839)},839:(t,r,e)=>{var i=e(730);r.operation=function(t){var e=r.timeouts(t);return new i(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};r.timeouts=function(t){if(t instanceof Array){return[].concat(t)}var r={retries:10,facto...
true
Other
vercel
next.js
b24cd1eaba4a8b3e6c23010a560f25032868c408.json
Use @vercel/fetch for run-tests requests (#27815) * Use @vercel/fetch for run-tests requests * update precompileld
run-tests.js
@@ -1,7 +1,9 @@ const path = require('path') const _glob = require('glob') const fs = require('fs').promises -const fetch = require('node-fetch') +const nodeFetch = require('node-fetch') +const vercelFetch = require('@vercel/fetch') +const fetch = vercelFetch(nodeFetch) const { promisify } = require('util') const ...
true
Other
vercel
next.js
b24cd1eaba4a8b3e6c23010a560f25032868c408.json
Use @vercel/fetch for run-tests requests (#27815) * Use @vercel/fetch for run-tests requests * update precompileld
yarn.lock
@@ -4000,6 +4000,11 @@ resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.1.tgz#78b5433344e2f92e8b306c06a5622c50c245bf6b" integrity sha512-S6oPal772qJZHoRZLFc/XoZW2gFvwXusYUmXPXkgxJLuEk2vOt7jc4Yo6z/vtI0EBkbPBVrJJ0B+prLIKiWqHg== +"@types/async-retry@1.2.1": + version "1.2.1" + resolved "...
true
Other
vercel
next.js
c6a08f51b1ea0f0debdc7dbf1aa4192b3d67009d.json
fix wrong link in readme (#27802) ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation...
examples/with-stripe-typescript/README.md
@@ -50,7 +50,7 @@ Once you have access to [the environment variables you'll need](#required-config - Checkout payment result page that uses [SWR](https://github.com/vercel/swr) hooks to fetch the CheckoutSession status from the API route: [pages/result.tsx](pages/result.tsx). - Stripe Elements - Custom Amount ...
false
Other
vercel
next.js
88a904a3811a4f5ddcb6efbcabc7e7a61c74d58a.json
Remove codeowners from examples (#27798) This PR will reduce noisy notifications
.github/CODEOWNERS
@@ -3,4 +3,4 @@ * @timneutkens @ijjk @shuding @styfle @huozhi @padmaia /docs/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @lfades -/examples/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @lfades +/examples/ @timneutkens @ijjk @shuding @leerob @lfades
false
Other
vercel
next.js
2061d6c4fe02c2f9ac7c9f92eb190308626ba308.json
Fix html validation for Image component sizer (#27767) According to [MDN](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-hidden_attribute#deciding_between_aria-hiddentrue_rolepresentation_and_rolenone): - `aria-hidden="true"` will remove the entire element from the acc...
packages/next/client/image.tsx
@@ -588,7 +588,6 @@ export default function Image({ }} alt="" aria-hidden={true} - role="presentation" src={`data:image/svg+xml;base64,${toBase64(sizerSvg)}`} /> ) : null}
false
Other
vercel
next.js
d368f76b4dff84a2db46ee50a09ae29003f11b30.json
Add a note about the existence of 'next/script' (#27725) For users looking at the api reference for 'next/head' it might be a good idea to let them know that there is the 'next/script' component. Using 'next/script' has a lot of advantages over adding a script tag with 'next/head' ## Documentation / Examples - [x] M...
docs/api-reference/next/head.md
@@ -61,3 +61,5 @@ In this case only the second `<meta property="og:title" />` is rendered. `meta` `title`, `meta` or any other elements (e.g. `script`) need to be contained as **direct** children of the `Head` element, or wrapped into maximum one level of `<React.Fragment>` or arrays—otherwise the tags won't be cor...
false
Other
vercel
next.js
2cf58be2285d206f63e3d9f2f1e43f45e58e12db.json
Add missing await for API request (#27676) `getAllPostsWithSlug` was missing an `await` on `fetchAPI`, resulting in `data?.allPosts` always returning `undefined`. This meant SSG wasn't aware of the paths it needed to generate.
examples/cms-datocms/lib/api.js
@@ -58,7 +58,7 @@ export async function getPreviewPostBySlug(slug) { } export async function getAllPostsWithSlug() { - const data = fetchAPI(` + const data = await fetchAPI(` { allPosts { slug
false
Other
vercel
next.js
c0bb1bc82cc1fb93a932af26e2e280d75f3fe096.json
Fix incorrect example in headers and rewrites docs (#27652) x-ref: https://github.com/vercel/next.js/issues/22660#issuecomment-890400273 ## Documentation / Examples - [x] Make sure the linting passes
docs/api-reference/next.config.js/headers.md
@@ -166,13 +166,17 @@ The following characters `(`, `)`, `{`, `}`, `:`, `*`, `+`, `?` are used for reg ```js module.exports = { - async redirects() { + async headers() { return [ { // this will match `/english(default)/something` being requested source: '/english\\(default\\)/:slug',...
true
Other
vercel
next.js
c0bb1bc82cc1fb93a932af26e2e280d75f3fe096.json
Fix incorrect example in headers and rewrites docs (#27652) x-ref: https://github.com/vercel/next.js/issues/22660#issuecomment-890400273 ## Documentation / Examples - [x] Make sure the linting passes
docs/api-reference/next.config.js/rewrites.md
@@ -203,13 +203,12 @@ The following characters `(`, `)`, `{`, `}`, `:`, `*`, `+`, `?` are used for reg ```js module.exports = { - async redirects() { + async rewrites() { return [ { // this will match `/english(default)/something` being requested source: '/english\\(default\\)/:slug'...
true
Other
vercel
next.js
c6cec752c7b123ed9feb87cb6757965e45739b57.json
Fix partial one off global selectors (#29128)
packages/next/build/swc/src/styled_jsx/transform_css.rs
@@ -1,4 +1,5 @@ use easy_error::{bail, Error}; +use std::panic; use swc_common::{source_map::Pos, BytePos, Span, SyntaxContext, DUMMY_SP}; use swc_css::ast::*; use swc_css::parser::{parse_str, parse_tokens, parser::ParserConfig}; @@ -102,17 +103,32 @@ impl VisitMut for Namespacer { fn visit_mut_complex_selector(...
true
Other
vercel
next.js
c6cec752c7b123ed9feb87cb6757965e45739b57.json
Fix partial one off global selectors (#29128)
packages/next/build/swc/tests/fixture/styled-jsx/one-off-global-selectors/input.js
@@ -0,0 +1,10 @@ +export default () => ( + <div> + <p>test</p> + <style jsx>{` + .container :global(> *) { + color: red; + } + `}</style> + </div> +) \ No newline at end of file
true
Other
vercel
next.js
c6cec752c7b123ed9feb87cb6757965e45739b57.json
Fix partial one off global selectors (#29128)
packages/next/build/swc/tests/fixture/styled-jsx/one-off-global-selectors/output.js
@@ -0,0 +1,6 @@ +import _JSXStyle from "styled-jsx/style"; +export default (()=><div className={"jsx-c7c3a8e231c9215a"}> + <p className={"jsx-c7c3a8e231c9215a"}>test</p> + <_JSXStyle id={"c7c3a8e231c9215a"}>{".container.jsx-c7c3a8e231c9215a >* {color:red}"}</_JSXStyle> + </div> +); \ No newline at end of file
true
Other
vercel
next.js
e3133984685ee7c6712b23ef04a9495551e06c6a.json
Update trace ignores for next import (#29119)
packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts
@@ -13,6 +13,8 @@ const PLUGIN_NAME = 'TraceEntryPointsPlugin' const TRACE_IGNORES = [ '**/*/node_modules/react/**/*.development.js', '**/*/node_modules/react-dom/**/*.development.js', + '**/*/next/dist/server/next.js', + '**/*/next/dist/bin/next', ] function getModuleFromDependency(
true
Other
vercel
next.js
e3133984685ee7c6712b23ef04a9495551e06c6a.json
Update trace ignores for next import (#29119)
test/integration/production/test/index.test.js
@@ -110,6 +110,17 @@ describe('Production Usage', () => { ], notTests: [/node_modules\/react\/cjs\/react\.development\.js/], }, + { + page: '/next-import', + tests: [ + /webpack-runtime\.js/, + /chunks\/.*?\.js/, + /node_modules\/r...
true
Other
vercel
next.js
e3133984685ee7c6712b23ef04a9495551e06c6a.json
Update trace ignores for next import (#29119)
yarn.lock
@@ -6417,7 +6417,7 @@ browserify-zlib@0.2.0, browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" -browserslist@4.16.6, browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.14.7, browserslist@^4.15.0, browserslist@^4.16.6, browserslist@^4.3.6, browserslist@^4.6.4, browserslist@^4.8.3: +browserslist@4.16....
true
Other
vercel
next.js
85b83998566f5170cf8400c8e67839dc643d5987.json
Remove log from failing to parse source map (#29118) This removes the log when we fail to parse the source maps in the `wellknown-errors-plugin` since this log isn't really actionable by users and clutters the error output. x-ref: https://github.com/vercel/next.js/issues/27783#issuecomment-915654054
packages/next/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.ts
@@ -118,7 +118,6 @@ export async function getNotFoundError( message ) } catch (err) { - console.log('Failed to parse source map:', err) // Don't fail on failure to resolve sourcemaps return input }
false
Other
vercel
next.js
73408211aad98dfe21824bd84bdb6a3b09749307.json
Remove inert font tag in font optimization (#28869) * Remove inert font tag in font optimization * Fix lint * Remove inert font tag during font optimization * Fix lint * Fix lint * Fix lint Co-authored-by: JJ Kasper <jj@jjsweb.site>
packages/next/client/head-manager.ts
@@ -104,14 +104,20 @@ export default function initHeadManager(): { // If the font tag is loaded only on client navigation // it won't be inlined. In this case revert to the original behavior h.type === 'link' && - h.props['data-optimized-fonts'] && - !documen...
true
Other
vercel
next.js
73408211aad98dfe21824bd84bdb6a3b09749307.json
Remove inert font tag in font optimization (#28869) * Remove inert font tag in font optimization * Fix lint * Remove inert font tag during font optimization * Fix lint * Fix lint * Fix lint Co-authored-by: JJ Kasper <jj@jjsweb.site>
packages/next/shared/lib/post-process.ts
@@ -46,6 +46,7 @@ async function processHTML( } const root: HTMLElement = parse(html) let document = html + // Calls the middleware, with some instrumentation and logging async function callMiddleWare(middleware: PostProcessMiddleware) { // let timer = Date.now() @@ -135,6 +136,15 @@ class FontOptim...
true
Other
vercel
next.js
73408211aad98dfe21824bd84bdb6a3b09749307.json
Remove inert font tag in font optimization (#28869) * Remove inert font tag in font optimization * Fix lint * Remove inert font tag during font optimization * Fix lint * Fix lint * Fix lint Co-authored-by: JJ Kasper <jj@jjsweb.site>
test/integration/font-optimization/test/index.test.js
@@ -94,12 +94,11 @@ describe('Font Optimization', () => { const link = $( `link[rel="stylesheet"][data-href="${staticHeadFont}"]` ) - const nonce = link.attr('nonce') + const style = $(`style[data-href="${staticHeadFont}"]`) const styleNonce = style.attr...
true
Other
vercel
next.js
49c99cc3236657109e473f4f8502d2806860dba2.json
Fix host segment replacing for custom routes (#29090) This fixes segments inside of the host of the destination failing to parse with url.parse due to the unexpected colon by escaping the colon for segments and then unescaping them after we have parsed the URL. ## Bug - [x] Related issues linked using `fixes #number...
packages/next/shared/lib/router/utils/prepare-destination.ts
@@ -125,6 +125,11 @@ export function compileNonPath(value: string, params: Params): string { .substr(1) } +const escapeSegment = (str: string, segmentName: string) => + str.replace(new RegExp(`:${segmentName}`, 'g'), `__ESC_COLON_${segmentName}`) + +const unescapeSegments = (str: string) => str.replace(/__ESC_...
true
Other
vercel
next.js
49c99cc3236657109e473f4f8502d2806860dba2.json
Fix host segment replacing for custom routes (#29090) This fixes segments inside of the host of the destination failing to parse with url.parse due to the unexpected colon by escaping the colon for segments and then unescaping them after we have parsed the URL. ## Bug - [x] Related issues linked using `fixes #number...
test/integration/custom-routes/next.config.js
@@ -389,6 +389,17 @@ module.exports = { destination: '/somewhere', permanent: false, }, + { + source: '/has-redirect-6', + has: [ + { + type: 'host', + value: '(?<subdomain>.*)-test.example.com', + }, + ], + destination: '...
true