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 | 719116ac81da79db427937698f27d50d7fc7301d.json | Allow export const in font loader (#40836)
Allow `export const font = Font()` syntax
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature request or RFC. Make sure the ... | test/e2e/next-font/with-font-declarations-file/fonts.js | @@ -11,11 +11,11 @@ const openSans = Open_Sans()
const sourceCodePro = Source_Code_Pro({ display: 'swap', preload: false })
const abel = Abel({ variant: '400', display: 'optional', preload: false })
-const inter = Inter({ display: 'block', preload: true })
-const roboto = Roboto({ variant: '400' })
+export const in... | true |
Other | vercel | next.js | 33e09dffb2d477bf147046a04811c3453748f9b9.json | webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements
Fixes #23130
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
## Feature
- [ ] Implements an existing feature request or RFC. Mak... | packages/next/build/webpack-config.ts | @@ -1,7 +1,7 @@
import ReactRefreshWebpackPlugin from '@next/react-refresh-utils/ReactRefreshWebpackPlugin'
import chalk from 'chalk'
import crypto from 'crypto'
-import { readFileSync, realpathSync } from 'fs'
+import { readFileSync } from 'fs'
import { codeFrameColumns } from 'next/dist/compiled/babel/code-frame'... | true |
Other | vercel | next.js | 33e09dffb2d477bf147046a04811c3453748f9b9.json | webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements
Fixes #23130
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
## Feature
- [ ] Implements an existing feature request or RFC. Mak... | test/integration/externals/next.config.js | @@ -0,0 +1,13 @@
+module.exports = {
+ webpack(config) {
+ config.resolve.alias = {
+ ...config.resolve.alias,
+ 'preact/compat': 'react',
+ }
+
+ return config
+ },
+ future: {
+ webpack5: true,
+ },
+} | true |
Other | vercel | next.js | 33e09dffb2d477bf147046a04811c3453748f9b9.json | webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements
Fixes #23130
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
## Feature
- [ ] Implements an existing feature request or RFC. Mak... | test/integration/externals/node_modules/esm-package/correct.js | @@ -0,0 +1 @@
+module.exports = 'World' | true |
Other | vercel | next.js | 33e09dffb2d477bf147046a04811c3453748f9b9.json | webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements
Fixes #23130
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
## Feature
- [ ] Implements an existing feature request or RFC. Mak... | test/integration/externals/node_modules/esm-package/package.json | @@ -0,0 +1,9 @@
+{
+ "name": "esm-package",
+ "exports": {
+ "./entry": {
+ "import": "./wrong.mjs",
+ "require": "./correct.js"
+ }
+ }
+} | true |
Other | vercel | next.js | 33e09dffb2d477bf147046a04811c3453748f9b9.json | webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements
Fixes #23130
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
## Feature
- [ ] Implements an existing feature request or RFC. Mak... | test/integration/externals/node_modules/esm-package/wrong.mjs | @@ -0,0 +1,3 @@
+if(typeof window === "undefined")
+ throw new Error("This shouldn't be used on server-side")
+export default "World"; | true |
Other | vercel | next.js | 33e09dffb2d477bf147046a04811c3453748f9b9.json | webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements
Fixes #23130
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
## Feature
- [ ] Implements an existing feature request or RFC. Mak... | test/integration/externals/pages/ssg.js | @@ -0,0 +1,12 @@
+import React from 'preact/compat'
+import World from 'esm-package/entry'
+
+export async function getStaticProps() {
+ return {
+ props: {},
+ }
+}
+
+export default function Index(props) {
+ return <div>Hello {World}</div>
+} | true |
Other | vercel | next.js | 33e09dffb2d477bf147046a04811c3453748f9b9.json | webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements
Fixes #23130
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
## Feature
- [ ] Implements an existing feature request or RFC. Mak... | test/integration/externals/pages/ssr.js | @@ -0,0 +1,10 @@
+import React from 'preact/compat'
+import World from 'esm-package/entry'
+
+export function getServerSideProps() {
+ return {}
+}
+
+export default function Index(props) {
+ return <div>Hello {World}</div>
+} | true |
Other | vercel | next.js | 33e09dffb2d477bf147046a04811c3453748f9b9.json | webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements
Fixes #23130
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
## Feature
- [ ] Implements an existing feature request or RFC. Mak... | test/integration/externals/pages/static.js | @@ -0,0 +1,6 @@
+import React from 'preact/compat'
+import World from 'esm-package/entry'
+
+export default function Index(props) {
+ return <div>Hello {World}</div>
+} | true |
Other | vercel | next.js | 33e09dffb2d477bf147046a04811c3453748f9b9.json | webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements
Fixes #23130
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
## Feature
- [ ] Implements an existing feature request or RFC. Mak... | test/integration/externals/test/index.test.js | @@ -0,0 +1,41 @@
+/* eslint-env jest */
+
+import fs from 'fs-extra'
+import { join } from 'path'
+import {
+ nextBuild,
+ findPort,
+ nextStart,
+ killApp,
+ renderViaHTTP,
+} from 'next-test-utils'
+
+jest.setTimeout(1000 * 60 * 2)
+const appDir = join(__dirname, '../')
+let appPort
+let app
+
+describe('Valid r... | true |
Other | vercel | next.js | f6c60946a300cf0b29977ae027b0c0cc056d8602.json | Clarify rewrites and other docs cleanup. (#24890)
Based on user feedback, this clarifies the difference between rewrites and redirects, as well as follows the new pattern for showing version history with a collapsible table. | docs/api-reference/next.config.js/basepath.md | @@ -4,7 +4,14 @@ description: Learn more about setting a base path in Next.js
# Base Path
-> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
+<details>
+ <summary><b>Version History</b></summary>... | true |
Other | vercel | next.js | f6c60946a300cf0b29977ae027b0c0cc056d8602.json | Clarify rewrites and other docs cleanup. (#24890)
Based on user feedback, this clarifies the difference between rewrites and redirects, as well as follows the new pattern for showing version history with a collapsible table. | docs/api-reference/next.config.js/headers.md | @@ -4,8 +4,6 @@ description: Add custom HTTP headers to your Next.js app.
# Headers
-> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
-
<details open>
<summary><b>Examples</b></summary>
<u... | true |
Other | vercel | next.js | f6c60946a300cf0b29977ae027b0c0cc056d8602.json | Clarify rewrites and other docs cleanup. (#24890)
Based on user feedback, this clarifies the difference between rewrites and redirects, as well as follows the new pattern for showing version history with a collapsible table. | docs/api-reference/next.config.js/redirects.md | @@ -4,8 +4,6 @@ description: Add redirects to your Next.js app.
# Redirects
-> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
-
<details open>
<summary><b>Examples</b></summary>
<ul>
@@ -1... | true |
Other | vercel | next.js | f6c60946a300cf0b29977ae027b0c0cc056d8602.json | Clarify rewrites and other docs cleanup. (#24890)
Based on user feedback, this clarifies the difference between rewrites and redirects, as well as follows the new pattern for showing version history with a collapsible table. | docs/api-reference/next.config.js/rewrites.md | @@ -4,8 +4,6 @@ description: Add rewrites to your Next.js app.
# Rewrites
-> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
-
<details open>
<summary><b>Examples</b></summary>
<ul>
@@ -16,... | true |
Other | vercel | next.js | f6c60946a300cf0b29977ae027b0c0cc056d8602.json | Clarify rewrites and other docs cleanup. (#24890)
Based on user feedback, this clarifies the difference between rewrites and redirects, as well as follows the new pattern for showing version history with a collapsible table. | docs/api-reference/next.config.js/trailing-slash.md | @@ -4,7 +4,14 @@ description: Configure Next.js pages to resolve with or without a trailing slash
# Trailing Slash
-> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
+<details>
+ <summary><b>Vers... | true |
Other | vercel | next.js | f6c60946a300cf0b29977ae027b0c0cc056d8602.json | Clarify rewrites and other docs cleanup. (#24890)
Based on user feedback, this clarifies the difference between rewrites and redirects, as well as follows the new pattern for showing version history with a collapsible table. | docs/basic-features/data-fetching.md | @@ -222,20 +222,27 @@ export default Blog
### Incremental Static Regeneration
-> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5#stable-incremental-static-regeneration) and up. If you’re using older versions of Next.js, please upgrade before trying Incremental Static Regeneration.
-
... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/.env.local.example | @@ -1,25 +0,0 @@
-NEXT_PUBLIC_SENTRY_DSN=
-
-# Only required to upload sourcemaps
-# SENTRY_ORG=
-# SENTRY_PROJECT=
-# SENTRY_AUTH_TOKEN=
-#
-# Only required if sentry for organization
-# Ex: https://sentry.ORG.com/
-# SENTRY_URL=
-#
-# For sourcemaps to work with server-side exceptions, the file path of the
-# uploade... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/README.md | @@ -1,18 +1,20 @@
# Sentry
-This is an example showing how to use [Sentry](https://sentry.io) to catch & report errors on both client + server side.
+This is an example showing how to use [Sentry](https://sentry.io) to catch & report errors on both client + server side, using the [official Sentry SDK for Next.js](ht... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/next.config.js | @@ -1,78 +1,24 @@
-// Use the SentryWebpack plugin to upload the source maps during build step
-const SentryWebpackPlugin = require('@sentry/webpack-plugin')
-const {
- NEXT_PUBLIC_SENTRY_DSN: SENTRY_DSN,
- SENTRY_ORG,
- SENTRY_PROJECT,
- SENTRY_AUTH_TOKEN,
- NODE_ENV,
- VERCEL_GIT_COMMIT_SHA,
-} = process.env
+/... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/package.json | @@ -8,10 +8,7 @@
"start": "next start"
},
"dependencies": {
- "@sentry/browser": "^5.21.3",
- "@sentry/integrations": "^5.21.3",
- "@sentry/node": "^5.21.3",
- "@sentry/webpack-plugin": "^1.12.1",
+ "@sentry/nextjs": "^6.3.5",
"next": "latest",
"react": "^16.8.6",
"react-dom": "... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/pages/_app.js | @@ -1,7 +1,3 @@
-import { init } from '../utils/sentry'
-
-init()
-
export default function App({ Component, pageProps, err }) {
// Workaround for https://github.com/vercel/next.js/issues/8592
return <Component {...pageProps} err={err} /> | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/pages/_error.js | @@ -1,5 +1,6 @@
import NextErrorComponent from 'next/error'
-import * as Sentry from '@sentry/node'
+
+import * as Sentry from '@sentry/nextjs'
const MyError = ({ statusCode, hasGetInitialPropsRun, err }) => {
if (!hasGetInitialPropsRun && err) { | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/pages/api/test1.js | @@ -1,10 +1,10 @@
-import { init } from '../../utils/sentry'
-
-init()
+import { withSentry } from '@sentry/nextjs'
const doAsyncWork = () => Promise.reject(new Error('API Test 1'))
doAsyncWork()
-export default async function handler(req, res) {
+async function handler(req, res) {
res.status(200).json({ name:... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/pages/api/test2.js | @@ -1,13 +1,13 @@
-import { init } from '../../utils/sentry'
-
-init()
+import { withSentry } from '@sentry/nextjs'
function work() {
throw new Error('API Test 2')
}
work()
-export default async function handler(req, res) {
+async function handler(req, res) {
res.status(200).json({ name: 'John Doe' })
}... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/pages/api/test3.js | @@ -1,13 +1,13 @@
-import { init } from '../../utils/sentry'
-
-init()
+import { withSentry } from '@sentry/nextjs'
function work() {
throw new Error('API Test 3')
}
-export default async function handler(req, res) {
+async function handler(req, res) {
work()
res.status(200).json({ name: 'John Doe' })
... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/pages/api/test4.js | @@ -1,10 +1,6 @@
-import * as Sentry from '@sentry/node'
+import * as Sentry from '@sentry/nextjs'
-import { init } from '../../utils/sentry'
-
-init()
-
-export default async function handler(req, res) {
+async function handler(req, res) {
try {
throw new Error('API Test 4')
} catch (error) {
@@ -16,3 +12... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/pages/ssr/test4.js | @@ -1,4 +1,4 @@
-import * as Sentry from '@sentry/node'
+import * as Sentry from '@sentry/nextjs'
const Test4 = () => <h1>SSR Test 4</h1>
| true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/sentry.client.config.js | @@ -0,0 +1,14 @@
+// This file configures the intialization of Sentry on the browser.
+// The config you add here will be used whenever a page is visited.
+// https://docs.sentry.io/platforms/javascript/guides/nextjs/
+
+import * as Sentry from '@sentry/nextjs'
+
+const SENTRY_DSN = process.env.SENTRY_DSN || process.en... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/sentry.properties | @@ -0,0 +1,5 @@
+defaults.url=# your base url
+defaults.org=# your org
+defaults.project=# your project
+auth.token=# your auth token
+cli.executable=# [optional] path to the cli executable | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/sentry.server.config.js | @@ -0,0 +1,14 @@
+// This file configures the initialization of Sentry on the server.
+// The config you add here will be used whenever the server handles a request.
+// https://docs.sentry.io/platforms/javascript/guides/nextjs/
+
+import * as Sentry from '@sentry/nextjs'
+
+const SENTRY_DSN = process.env.SENTRY_DSN ||... | true |
Other | vercel | next.js | 4bc87e479ccb32f36a3f8ee7114362370434533a.json | Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK. | examples/with-sentry/utils/sentry.js | @@ -1,35 +0,0 @@
-import * as Sentry from '@sentry/node'
-import { RewriteFrames } from '@sentry/integrations'
-
-export const init = () => {
- if (process.env.NEXT_PUBLIC_SENTRY_DSN) {
- const integrations = []
- if (
- process.env.NEXT_IS_SERVER === 'true' &&
- process.env.NEXT_PUBLIC_SENTRY_SERVER_R... | true |
Other | vercel | next.js | 81cc1c5852ff814d5d2fa675b6480469fef3ca3d.json | Remove old docs sections (#24853)
Co-authored-by: Lee Robinson <me@leerob.io> | docs/api-reference/next.config.js/custom-webpack-config.md | @@ -15,7 +15,6 @@ Before continuing to add custom webpack configuration to your application make s
Some commonly asked for features are available as plugins:
-- [@zeit/next-less](https://github.com/vercel/next-plugins/tree/master/packages/next-less)
- [@next/mdx](https://github.com/vercel/next.js/tree/canary/pack... | true |
Other | vercel | next.js | 81cc1c5852ff814d5d2fa675b6480469fef3ca3d.json | Remove old docs sections (#24853)
Co-authored-by: Lee Robinson <me@leerob.io> | docs/basic-features/built-in-css-support.md | @@ -181,19 +181,6 @@ module.exports = {
}
```
-## Less and Stylus Support
-
-To support importing `.less` or `.styl` files you can use the following plugins:
-
-- [@zeit/next-less](https://github.com/vercel/next-plugins/tree/master/packages/next-less)
-- [@zeit/next-stylus](https://github.com/vercel/next-plugins/tr... | true |
Other | vercel | next.js | 73e1fb4da4f8db524a572b5391dff65735c7560b.json | Add version note for `has` property (#24836)
The guides for `next.config.js` never specify that the `has: { }` syntax is only available for v10.1, and not for v10.0. Add a note that indicates these features are only available in the latest version.
## Documentation / Examples
- [x] Make sure the linting passes | docs/api-reference/next.config.js/headers.md | @@ -13,6 +13,15 @@ description: Add custom HTTP headers to your Next.js app.
</ul>
</details>
+<details>
+ <summary><b>Version History</b></summary>
+
+| Version | Changes |
+| --------- | ------------ |
+| `v10.2.0` | `has` added. |
+
+</details>
+
Headers allow you to set custom HTTP headers for an inc... | true |
Other | vercel | next.js | 73e1fb4da4f8db524a572b5391dff65735c7560b.json | Add version note for `has` property (#24836)
The guides for `next.config.js` never specify that the `has: { }` syntax is only available for v10.1, and not for v10.0. Add a note that indicates these features are only available in the latest version.
## Documentation / Examples
- [x] Make sure the linting passes | docs/api-reference/next.config.js/redirects.md | @@ -13,6 +13,15 @@ description: Add redirects to your Next.js app.
</ul>
</details>
+<details>
+ <summary><b>Version History</b></summary>
+
+| Version | Changes |
+| --------- | ------------ |
+| `v10.2.0` | `has` added. |
+
+</details>
+
Redirects allow you to redirect an incoming request path to a dif... | true |
Other | vercel | next.js | 73e1fb4da4f8db524a572b5391dff65735c7560b.json | Add version note for `has` property (#24836)
The guides for `next.config.js` never specify that the `has: { }` syntax is only available for v10.1, and not for v10.0. Add a note that indicates these features are only available in the latest version.
## Documentation / Examples
- [x] Make sure the linting passes | docs/api-reference/next.config.js/rewrites.md | @@ -13,6 +13,15 @@ description: Add rewrites to your Next.js app.
</ul>
</details>
+<details>
+ <summary><b>Version History</b></summary>
+
+| Version | Changes |
+| --------- | ------------ |
+| `v10.2.0` | `has` added. |
+
+</details>
+
Rewrites allow you to map an incoming request path to a different ... | true |
Other | vercel | next.js | 2251658c352274d160c732ba24c9e06d211b74c8.json | docs(next/router): Update router.push api (#24833)
Documentation page: https://nextjs.org/docs/api-reference/next/router#routerpush
Add `locale` as supported options in `route.push()` (#17898) | docs/api-reference/next/router.md | @@ -74,6 +74,7 @@ router.push(url, as, options)
- `options` - Optional object with the following configuration options:
- `scroll` - Optional boolean, controls scrolling to the top of the page after navigation. Defaults to `true`
- [`shallow`](/docs/routing/shallow-routing.md): Update the path of the current pag... | false |
Other | vercel | next.js | 192d42bcacf20e8b501b9c3e7d325c852f6796ee.json | docs(response-helpers): Update res.json definition (#24782) | docs/api-routes/response-helpers.md | @@ -23,7 +23,7 @@ export default function handler(req, res) {
The included helpers are:
- `res.status(code)` - A function to set the status code. `code` must be a valid [HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
-- `res.json(json)` - Sends a JSON response. `json` must be a valid JSO... | false |
Other | vercel | next.js | 83395c92ecb71c2876f72eeda3a325f538540687.json | fix memory leak in require.cache (#24282)
Previously only the top-level page would be cleared from the require cache, with this change it also clears `module.parent` and `modules.children`. | packages/next/build/webpack/plugins/nextjs-require-cache-hot-reloader.ts | @@ -3,14 +3,33 @@ import { isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import { realpathSync } from 'fs'
import path from 'path'
+const originModules = [
+ require.resolve('../../../next-server/server/require'),
+ require.resolve('../../../next-server/server/load-components'),
+]
+
function deleteCach... | false |
Other | vercel | next.js | 01c15c5150306a6d4f8c33b2b9f7464b6d7450dd.json | Remove un-used lib files (#24625) | .eslintignore | @@ -16,5 +16,4 @@ packages/next-codemod/**/*.js
packages/next-codemod/**/*.d.ts
packages/next-env/**/*.d.ts
test/integration/async-modules/**
-test-timings.json
-packages/next/lib/regexr/**/*
\ No newline at end of file
+test-timings.json
\ No newline at end of file | true |
Other | vercel | next.js | 01c15c5150306a6d4f8c33b2b9f7464b6d7450dd.json | Remove un-used lib files (#24625) | packages/next/lib/regexr/expression-lexer.js | @@ -1,951 +0,0 @@
-/*
-RegExr: Learn, Build, & Test RegEx
-Copyright (C) 2017 gskinner.com, inc.
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your optio... | true |
Other | vercel | next.js | 01c15c5150306a6d4f8c33b2b9f7464b6d7450dd.json | Remove un-used lib files (#24625) | packages/next/lib/regexr/profile/core.js | @@ -1,420 +0,0 @@
-/*
-RegExr: Learn, Build, & Test RegEx
-Copyright (C) 2017 gskinner.com, inc.
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your opt... | true |
Other | vercel | next.js | 01c15c5150306a6d4f8c33b2b9f7464b6d7450dd.json | Remove un-used lib files (#24625) | packages/next/lib/regexr/profile/index.js | @@ -1,15 +0,0 @@
-function merge(p1, p2) {
- // merges p1 into p2, essentially just a simple deep copy without array support.
- for (let n in p1) {
- if (p2[n] === false) {
- continue
- } else if (typeof p1[n] === 'object') {
- p2[n] = merge(p1[n], p2[n] || {})
- } else if (p2[n] === undefined) {
-... | true |
Other | vercel | next.js | 01c15c5150306a6d4f8c33b2b9f7464b6d7450dd.json | Remove un-used lib files (#24625) | packages/next/lib/regexr/profile/javascript.js | @@ -1,160 +0,0 @@
-/*
-RegExr: Learn, Build, & Test RegEx
-Copyright (C) 2017 gskinner.com, inc.
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your opt... | true |
Other | vercel | next.js | 89d2c4e19829fad49fc25ccca2f2d3a94b77da01.json | Fix Image compatibility issue when using `sizes` (#24569)
When using `sizes`, [`matchAll`](https://caniuse.com/mdn-javascript_builtins_string_matchall) isn't supported by older browsers like IE and Safari 12. This PR changes it to `exec`.
There're already tests of `sizes` with multiple `vw` values covered.
Fixes #23... | packages/next/client/image.tsx | @@ -94,9 +94,11 @@ function getWidths(
): { widths: number[]; kind: 'w' | 'x' } {
if (sizes && (layout === 'fill' || layout === 'responsive')) {
// Find all the "vw" percent sizes used in the sizes prop
- const percentSizes = [...sizes.matchAll(/(^|\s)(1?\d?\d)vw/g)].map((m) =>
- parseInt(m[2])
- )
... | false |
Other | vercel | next.js | a35dedb7d3c5c7e0912c9e41bdebd9f971d6739c.json | Remove unnecessary optimizeFonts key from type (#24563)
https://github.com/vercel/next.js/pull/21676 moved `fontOptimization` out of the experimental key of `NextConfig` to the top level, so it should be removed from the type
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
## ... | packages/next/next-server/server/config-shared.ts | @@ -44,7 +44,6 @@ export type NextConfig = { [key: string]: any } & {
reactMode?: 'legacy' | 'concurrent' | 'blocking'
workerThreads?: boolean
pageEnv?: boolean
- optimizeFonts?: boolean
optimizeImages?: boolean
optimizeCss?: boolean
scrollRestoration?: boolean | false |
Other | vercel | next.js | 972137444031b3b7940aaa518f82c19675b21780.json | Add documentation on Font Optimization. (#24572) | docs/basic-features/font-optimization.md | @@ -0,0 +1,88 @@
+---
+description: Next.js supports built-in web font optimization to inline font CSS. Learn more here.
+---
+
+# Font Optimization
+
+Since version **10.2**, Next.js has built-in web font optimization.
+
+By default, Next.js will automatically inline font CSS at build time, eliminating an extra round ... | true |
Other | vercel | next.js | 972137444031b3b7940aaa518f82c19675b21780.json | Add documentation on Font Optimization. (#24572) | docs/manifest.json | @@ -25,6 +25,10 @@
"title": "Image Optimization",
"path": "/docs/basic-features/image-optimization.md"
},
+ {
+ "title": "Font Optimization",
+ "path": "/docs/basic-features/font-optimization.md"
+ },
{
... | true |
Other | vercel | next.js | f3d518385c812cd5cd744ff6f01e3d778fc6058d.json | Remove experimental note for has routes (#24529)
This removes the warnings/notes for the `has` custom-routes feature being experimental
## Documentation / Examples
- [x] Make sure the linting passes | docs/api-reference/next.config.js/headers.md | @@ -173,8 +173,6 @@ module.exports = {
## Header, Cookie, and Query Matching
-Note: this feature is still experimental and not covered by semver and is to be used at your own risk until it is made stable.
-
To only apply a header when either header, cookie, or query values also match the `has` field can be used. ... | true |
Other | vercel | next.js | f3d518385c812cd5cd744ff6f01e3d778fc6058d.json | Remove experimental note for has routes (#24529)
This removes the warnings/notes for the `has` custom-routes feature being experimental
## Documentation / Examples
- [x] Make sure the linting passes | docs/api-reference/next.config.js/redirects.md | @@ -117,8 +117,6 @@ module.exports = {
## Header, Cookie, and Query Matching
-Note: this feature is still experimental and not covered by semver and is to be used at your own risk until it is made stable.
-
To only match a redirect when header, cookie, or query values also match the `has` field can be used. Both ... | true |
Other | vercel | next.js | f3d518385c812cd5cd744ff6f01e3d778fc6058d.json | Remove experimental note for has routes (#24529)
This removes the warnings/notes for the `has` custom-routes feature being experimental
## Documentation / Examples
- [x] Make sure the linting passes | docs/api-reference/next.config.js/rewrites.md | @@ -197,8 +197,6 @@ module.exports = {
## Header, Cookie, and Query Matching
-Note: this feature is still experimental and not covered by semver and is to be used at your own risk until it is made stable.
-
To only match a rewrite when header, cookie, or query values also match the `has` field can be used. Both t... | true |
Other | vercel | next.js | f3d518385c812cd5cd744ff6f01e3d778fc6058d.json | Remove experimental note for has routes (#24529)
This removes the warnings/notes for the `has` custom-routes feature being experimental
## Documentation / Examples
- [x] Make sure the linting passes | packages/next/lib/load-custom-routes.ts | @@ -6,8 +6,6 @@ import {
PERMANENT_REDIRECT_STATUS,
TEMPORARY_REDIRECT_STATUS,
} from '../next-server/lib/constants'
-import { execOnce } from '../next-server/lib/utils'
-import * as Log from '../build/output/log'
// @ts-ignore
import Lexer from 'next/dist/compiled/regexr-lexer/lexer'
// @ts-ignore
@@ -163,12... | true |
Other | vercel | next.js | f3d518385c812cd5cd744ff6f01e3d778fc6058d.json | Remove experimental note for has routes (#24529)
This removes the warnings/notes for the `has` custom-routes feature being experimental
## Documentation / Examples
- [x] Make sure the linting passes | test/integration/custom-routes/test/index.test.js | @@ -1783,8 +1783,8 @@ describe('Custom routes', () => {
)
})
- it('should show warning for experimental has usage', async () => {
- expect(stderr).toContain(
+ it('should not show warning for experimental has usage', async () => {
+ expect(stderr).not.toContain(
"'has' route field... | true |
Other | vercel | next.js | 29402f3c68b641f2a40622b16e7954dff5195625.json | Replace experimental `reactMode` with `reactRoot` (#24280)
* Remove reactMode config
* Add config + warning
* Tweak wording on warning
* Tweak wording on warning
* Don't default reactRoot for 10.x
* yak shaving
* Add warning when using old reactMode | .github/workflows/test_react_experimental.yml | @@ -29,9 +29,9 @@ jobs:
# needs: build
env:
NEXT_TELEMETRY_DISABLED: 1
- NEXT_PRIVATE_REACT_MODE: concurrent
HEADLESS: true
NEXT_PRIVATE_SKIP_SIZE_TESTS: true
+ NEXT_PRIVATE_REACT_ROOT: 1
strategy:
fail-fast: false
matrix: | true |
Other | vercel | next.js | 29402f3c68b641f2a40622b16e7954dff5195625.json | Replace experimental `reactMode` with `reactRoot` (#24280)
* Remove reactMode config
* Add config + warning
* Tweak wording on warning
* Tweak wording on warning
* Don't default reactRoot for 10.x
* yak shaving
* Add warning when using old reactMode | packages/next/build/webpack-config.ts | @@ -1048,8 +1048,8 @@ export default async function getBaseWebpackConfig(
'process.env.__NEXT_STRICT_MODE': JSON.stringify(
config.reactStrictMode
),
- 'process.env.__NEXT_REACT_MODE': JSON.stringify(
- config.experimental.reactMode
+ 'process.env.__NEXT_REACT_ROOT': ... | true |
Other | vercel | next.js | 29402f3c68b641f2a40622b16e7954dff5195625.json | Replace experimental `reactMode` with `reactRoot` (#24280)
* Remove reactMode config
* Add config + warning
* Tweak wording on warning
* Tweak wording on warning
* Don't default reactRoot for 10.x
* yak shaving
* Add warning when using old reactMode | packages/next/client/index.tsx | @@ -494,7 +494,8 @@ export function renderError(renderErrorProps: RenderErrorProps): Promise<any> {
}
let reactRoot: any = null
-let shouldUseHydrate: boolean = typeof ReactDOM.hydrate === 'function'
+let shouldHydrate: boolean = typeof ReactDOM.hydrate === 'function'
+
function renderReactElement(
domEl: HTMLE... | true |
Other | vercel | next.js | 29402f3c68b641f2a40622b16e7954dff5195625.json | Replace experimental `reactMode` with `reactRoot` (#24280)
* Remove reactMode config
* Add config + warning
* Tweak wording on warning
* Tweak wording on warning
* Don't default reactRoot for 10.x
* yak shaving
* Add warning when using old reactMode | packages/next/next-server/server/config-shared.ts | @@ -60,6 +60,7 @@ export type NextConfig = { [key: string]: any } & {
skipValidation?: boolean
}
turboMode: boolean
+ reactRoot: boolean
}
}
@@ -104,7 +105,6 @@ export const defaultConfig: NextConfig = {
plugins: false,
profiling: false,
sprFlushToDisk: true,
- reactMode: (pr... | true |
Other | vercel | next.js | 29402f3c68b641f2a40622b16e7954dff5195625.json | Replace experimental `reactMode` with `reactRoot` (#24280)
* Remove reactMode config
* Add config + warning
* Tweak wording on warning
* Tweak wording on warning
* Don't default reactRoot for 10.x
* yak shaving
* Add warning when using old reactMode | packages/next/next-server/server/config.ts | @@ -13,7 +13,6 @@ import { loadEnvConfig } from '@next/env'
export { DomainLocales, NextConfig, normalizeConfig } from './config-shared'
const targets = ['server', 'serverless', 'experimental-serverless-trace']
-const reactModes = ['legacy', 'blocking', 'concurrent']
const experimentalWarning = execOnce(() => {
... | true |
Other | vercel | next.js | cce82cd7bcbf9c9fa61df4a808ac862aaace2b39.json | Fix side effects in router-is-ready tests (#24360)
Fixes the [failing react@experimental tests](https://github.com/vercel/next.js/actions/workflows/test_react_experimental.yml). | test/integration/router-is-ready/pages/auto-export/[slug].js | @@ -1,13 +1,17 @@
import { useRouter } from 'next/router'
+import { useLayoutEffect } from 'react'
export default function Page(props) {
const router = useRouter()
if (typeof window !== 'undefined') {
- if (!window.isReadyValues) {
- window.isReadyValues = []
- }
- window.isReadyValues.push(ro... | true |
Other | vercel | next.js | cce82cd7bcbf9c9fa61df4a808ac862aaace2b39.json | Fix side effects in router-is-ready tests (#24360)
Fixes the [failing react@experimental tests](https://github.com/vercel/next.js/actions/workflows/test_react_experimental.yml). | test/integration/router-is-ready/pages/auto-export/index.js | @@ -1,13 +1,17 @@
import { useRouter } from 'next/router'
+import { useLayoutEffect } from 'react'
export default function Page(props) {
const router = useRouter()
if (typeof window !== 'undefined') {
- if (!window.isReadyValues) {
- window.isReadyValues = []
- }
- window.isReadyValues.push(ro... | true |
Other | vercel | next.js | cce82cd7bcbf9c9fa61df4a808ac862aaace2b39.json | Fix side effects in router-is-ready tests (#24360)
Fixes the [failing react@experimental tests](https://github.com/vercel/next.js/actions/workflows/test_react_experimental.yml). | test/integration/router-is-ready/pages/gip.js | @@ -1,13 +1,17 @@
import { useRouter } from 'next/router'
+import { useLayoutEffect } from 'react'
export default function Page(props) {
const router = useRouter()
if (typeof window !== 'undefined') {
- if (!window.isReadyValues) {
- window.isReadyValues = []
- }
- window.isReadyValues.push(ro... | true |
Other | vercel | next.js | cce82cd7bcbf9c9fa61df4a808ac862aaace2b39.json | Fix side effects in router-is-ready tests (#24360)
Fixes the [failing react@experimental tests](https://github.com/vercel/next.js/actions/workflows/test_react_experimental.yml). | test/integration/router-is-ready/pages/gsp.js | @@ -1,13 +1,17 @@
import { useRouter } from 'next/router'
+import { useLayoutEffect } from 'react'
export default function Page(props) {
const router = useRouter()
if (typeof window !== 'undefined') {
- if (!window.isReadyValues) {
- window.isReadyValues = []
- }
- window.isReadyValues.push(ro... | true |
Other | vercel | next.js | cce82cd7bcbf9c9fa61df4a808ac862aaace2b39.json | Fix side effects in router-is-ready tests (#24360)
Fixes the [failing react@experimental tests](https://github.com/vercel/next.js/actions/workflows/test_react_experimental.yml). | test/integration/router-is-ready/pages/gssp.js | @@ -1,13 +1,17 @@
import { useRouter } from 'next/router'
+import { useLayoutEffect } from 'react'
export default function Page(props) {
const router = useRouter()
if (typeof window !== 'undefined') {
- if (!window.isReadyValues) {
- window.isReadyValues = []
- }
- window.isReadyValues.push(ro... | true |
Other | vercel | next.js | 3bf0fcf35db9e4b03b1fe99486bdb3e65e86c295.json | fix typo in example section of dynamic-import.md (#37834)
change "in page's the" to "in the page's" | docs/advanced-features/dynamic-import.md | @@ -17,7 +17,7 @@ Next.js supports lazy loading external libraries with `import()` and React compo
## Example
-By using `next/dynamic`, the header component will not be included in page's the initial JavaScript bundle. The page will render the Suspense `fallback` first, followed by the `Header` component when the ... | false |
Other | vercel | next.js | d6fb8337ba0a6a74821803b6188d4f741bbc0147.json | feat: add correct type to with-styled-coponents (#37816)
There's a missing type in with-styled-coponents example's _document.tsx file
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements a... | examples/with-styled-components/pages/_document.tsx | @@ -1,8 +1,8 @@
-import Document from 'next/document'
+import Document, { DocumentContext } from 'next/document'
import { ServerStyleSheet } from 'styled-components'
export default class MyDocument extends Document {
- static async getInitialProps(ctx) {
+ static async getInitialProps(ctx: DocumentContext) {
... | false |
Other | vercel | next.js | c480726da2ed8385a792e2155fa09282436bfa3c.json | Update 4MB API Routes warning error guide. (#37779)
We added documentation for this, but didn't post it back to the error guide, which is linked when you'd hit this limit.
https://github.com/vercel/next.js/pull/34700 | errors/api-routes-response-size-limit.md | @@ -2,12 +2,27 @@
#### Why This Error Occurred
-API Routes are meant to respond quickly and are not intended to support responding with large amounts of data. The maximum size of responses is 4 MB.
+API Routes are meant to respond quickly and are not intended to support responding with large amounts of data. The m... | false |
Other | vercel | next.js | 37de4f989acd1a4214248c1489c696bfee980afa.json | Remove previous query param deleting warning (#37740) | packages/next/server/next-server.ts | @@ -1378,12 +1378,6 @@ export default class NextNodeServer extends BaseServer {
const parsedDestination = parseUrl(rewritePath)
const newUrl = parsedDestination.pathname
- // TODO: remove after next minor version current `v12.0.9`
- this.warnIfQueryParametersWereDeleted(
- ... | true |
Other | vercel | next.js | 37de4f989acd1a4214248c1489c696bfee980afa.json | Remove previous query param deleting warning (#37740) | test/e2e/middleware-rewrites/test/index.test.ts | @@ -169,19 +169,6 @@ describe('Middleware Rewrite', () => {
}, 'success')
})
- if (!(global as any).isNextDeploy) {
- // runtime logs aren't currently available for deploy test
- it(`warns about a query param deleted`, async () => {
- await fetchViaHTTP(next.url, `/clear-query-params`,... | true |
Other | vercel | next.js | a4abc1e77dd05ae2ac172858e4b9fb82af5294f3.json | Expose test timings token for e2e tests (#37756)
* Expose test timings token for e2e tests
* update flake | .github/workflows/build_test_deploy.yml | @@ -344,6 +344,7 @@ jobs:
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
+ TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
strategy:
fail-fast: false
matrix:
@@ -401,6 +402,7 @@ jobs:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
NEXT_TEST_REACT_VERS... | true |
Other | vercel | next.js | a4abc1e77dd05ae2ac172858e4b9fb82af5294f3.json | Expose test timings token for e2e tests (#37756)
* Expose test timings token for e2e tests
* update flake | run-tests.js | @@ -287,20 +287,13 @@ async function main() {
if (isFinalRun && hideOutput) {
// limit out to last 64kb so that we don't
// run out of log room in CI
- let trimmedOutputSize = 0
- const trimmedOutputLimit = 64 * 1024
const trimmedOutput = []
... | true |
Other | vercel | next.js | a4abc1e77dd05ae2ac172858e4b9fb82af5294f3.json | Expose test timings token for e2e tests (#37756)
* Expose test timings token for e2e tests
* update flake | test/e2e/next-script/index.test.ts | @@ -243,12 +243,14 @@ describe('experimental.nextScriptWorkers: true with required Partytown dependenc
try {
browser = await webdriver(next.url, '/')
- const predefinedWorkerScripts = await browser.eval(
- `document.querySelectorAll('script[type="text/partytown"]').length`
- )
- expe... | true |
Other | vercel | next.js | eb55af1cfefd30fd86735df769231bfbc90990a9.json | Add upgrade guide for Middleware. (#37382)
* Middleware upgrade guide
* Add a bit more
* Apply suggestions from code review
Co-authored-by: Rich Haines <hello@richardhaines.dev>
Co-authored-by: Edward Thomson <ethomson@github.com>
Co-authored-by: Dominik Ferber <dominik.ferber@gmail.com>
* Apply suggesti... | errors/middleware-upgrade-guide.md | @@ -0,0 +1,356 @@
+# Middleware Upgrade Guide
+
+As we work on improving Middleware for General Availability (GA), we've made some changes to the Middleware APIs (and how you define Middleware in your application) based on your feedback.
+
+This upgrade guide will help you understand the changes and how to migrate your... | false |
Other | vercel | next.js | 7193effcc09f9347f51bd73fac6860c30e4c6acc.json | Fix shallow routing with rewrites/middleware (#37716)
Shallow route changes did not work for rewritten pages when Middleware
was used, and made hard refreshes, although it was possible with static rewrites.
This happened because the router has a manifest of the static rewrites,
allowing static rewrites to map the rou... | packages/next/shared/lib/router/router.ts | @@ -1361,7 +1361,8 @@ export default class Router implements BaseRouter {
}
// shallow routing is only allowed for same page URL changes.
- const isValidShallowRoute = options.shallow && nextState.route === route
+ const isValidShallowRoute =
+ options.shallow && nextState.route === (ro... | true |
Other | vercel | next.js | 7193effcc09f9347f51bd73fac6860c30e4c6acc.json | Fix shallow routing with rewrites/middleware (#37716)
Shallow route changes did not work for rewritten pages when Middleware
was used, and made hard refreshes, although it was possible with static rewrites.
This happened because the router has a manifest of the static rewrites,
allowing static rewrites to map the rou... | test/e2e/middleware-general/app/middleware.js | @@ -41,6 +41,11 @@ export async function middleware(request) {
return NextResponse.next()
}
+ if (url.pathname === '/sha') {
+ url.pathname = '/shallow'
+ return NextResponse.rewrite(url)
+ }
+
if (url.pathname.startsWith('/fetch-user-agent-default')) {
try {
const apiRoute = new URL(ur... | true |
Other | vercel | next.js | 7193effcc09f9347f51bd73fac6860c30e4c6acc.json | Fix shallow routing with rewrites/middleware (#37716)
Shallow route changes did not work for rewritten pages when Middleware
was used, and made hard refreshes, although it was possible with static rewrites.
This happened because the router has a manifest of the static rewrites,
allowing static rewrites to map the rou... | test/e2e/middleware-general/app/next.config.js | @@ -22,6 +22,10 @@ module.exports = {
source: '/rewrite-2',
destination: '/about/a',
},
+ {
+ source: '/sha',
+ destination: '/shallow',
+ },
{
source: '/rewrite-3',
destination: '/blog/middleware-rewrite', | true |
Other | vercel | next.js | 7193effcc09f9347f51bd73fac6860c30e4c6acc.json | Fix shallow routing with rewrites/middleware (#37716)
Shallow route changes did not work for rewritten pages when Middleware
was used, and made hard refreshes, although it was possible with static rewrites.
This happened because the router has a manifest of the static rewrites,
allowing static rewrites to map the rou... | test/e2e/middleware-general/app/pages/shallow.js | @@ -0,0 +1,43 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Shallow({ message }) {
+ const { pathname, query } = useRouter()
+ return (
+ <div>
+ <ul>
+ <li id="message-contents">{message}</li>
+ <li>
+ <Link href="/sha?hello=world"... | true |
Other | vercel | next.js | 7193effcc09f9347f51bd73fac6860c30e4c6acc.json | Fix shallow routing with rewrites/middleware (#37716)
Shallow route changes did not work for rewritten pages when Middleware
was used, and made hard refreshes, although it was possible with static rewrites.
This happened because the router has a manifest of the static rewrites,
allowing static rewrites to map the rou... | test/e2e/middleware-general/test/index.test.ts | @@ -476,6 +476,34 @@ describe('Middleware Runtime', () => {
await browser.waitForElementByCss('.refreshed')
expect(await browser.eval('window.__SAME_PAGE')).toBeUndefined()
})
+
+ it('allows shallow linking with middleware', async () => {
+ const browser = await webdriver(next.url, '/sha')
+ const g... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/next/client/index.tsx | @@ -349,7 +349,7 @@ export async function hydrate(opts?: { beforeRender?: () => Promise<void> }) {
if (process.env.NODE_ENV === 'development') {
const {
- getNodeError,
+ getServerError,
} = require('next/dist/compiled/@next/react-dev-overlay/dist/client')
// Server-side runtime errors nee... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/next/server/dev/hot-reloader.ts | @@ -907,6 +907,7 @@ export default class HotReloader {
rootDirectory: this.dir,
stats: () => this.clientStats,
serverStats: () => this.serverStats,
+ edgeServerStats: () => this.edgeServerStats,
}),
]
} | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/next/server/dev/next-dev-server.ts | @@ -1,6 +1,5 @@
import type { __ApiPreviewProps } from '../api-utils'
import type { CustomRoutes } from '../../lib/load-custom-routes'
-import type { FetchEventResult } from '../web/types'
import type { FindComponentsResult } from '../next-server'
import type { LoadComponentsReturnType } from '../load-components'
... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/next/server/next-server.ts | @@ -1135,7 +1135,7 @@ export default class NextNodeServer extends BaseServer {
parsedUrl: ParsedUrl
parsed: UrlWithParsedQuery
onWarning?: (warning: Error) => void
- }): Promise<FetchEventResult | null> {
+ }) {
middlewareBetaWarning()
const normalizedPathname = removeTrailingSlash(params.par... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/next/server/render.tsx | @@ -1672,18 +1672,27 @@ export async function renderToHTML(
}
function errorToJSON(err: Error) {
+ let source: 'server' | 'edge-server' = 'server'
+
+ if (process.env.NEXT_RUNTIME !== 'edge') {
+ source =
+ require('next/dist/compiled/@next/react-dev-overlay/dist/middleware').getErrorSource(
+ err
... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/next/server/web/sandbox/context.ts | @@ -1,5 +1,6 @@
import type { Primitives } from 'next/dist/compiled/@edge-runtime/primitives'
import type { WasmBinding } from '../../../build/webpack/loaders/get-module-build-info'
+import { getServerError } from 'next/dist/compiled/@next/react-dev-overlay/dist/middleware'
import { EDGE_UNSUPPORTED_NODE_APIS } from... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/next/server/web/sandbox/sandbox.ts | @@ -1,16 +1,21 @@
-import type { WasmBinding } from '../../../build/webpack/loaders/get-module-build-info'
import type { RequestData, FetchEventResult } from '../types'
+import type { WasmBinding } from '../../../build/webpack/loaders/get-module-build-info'
+import { getServerError } from 'next/dist/compiled/@next/rea... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/next/shared/lib/utils.ts | @@ -92,7 +92,7 @@ export type NEXT_DATA = {
autoExport?: boolean
isFallback?: boolean
dynamicIds?: (string | number)[]
- err?: Error & { statusCode?: number }
+ err?: Error & { statusCode?: number; source?: 'server' | 'edge-server' }
gsp?: boolean
gssp?: boolean
customServer?: boolean | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/react-dev-overlay/src/client.ts | @@ -94,7 +94,7 @@ function onRefresh() {
}
export { getErrorByType } from './internal/helpers/getErrorByType'
-export { getNodeError } from './internal/helpers/nodeStackFrames'
+export { getServerError } from './internal/helpers/nodeStackFrames'
export { default as ReactDevOverlay } from './internal/ReactDevOverla... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/react-dev-overlay/src/internal/container/Errors.tsx | @@ -15,7 +15,7 @@ import { LeftRightDialogHeader } from '../components/LeftRightDialogHeader'
import { Overlay } from '../components/Overlay'
import { Toast } from '../components/Toast'
import { getErrorByType, ReadyRuntimeError } from '../helpers/getErrorByType'
-import { isNodeError } from '../helpers/nodeStackFra... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/react-dev-overlay/src/internal/helpers/getErrorByType.ts | @@ -1,6 +1,6 @@
import { TYPE_UNHANDLED_ERROR, TYPE_UNHANDLED_REJECTION } from '../bus'
import { SupportedErrorEvent } from '../container/Errors'
-import { isNodeError } from './nodeStackFrames'
+import { getErrorSource } from './nodeStackFrames'
import { getOriginalStackFrames, OriginalStackFrame } from './stack-fr... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/react-dev-overlay/src/internal/helpers/nodeStackFrames.ts | @@ -19,13 +19,16 @@ export function getFilesystemFrame(frame: StackFrame): StackFrame {
return f
}
-const symbolNodeError = Symbol('NextjsNodeError')
+const symbolError = Symbol('NextjsError')
-export function isNodeError(error: Error): boolean {
- return symbolNodeError in error
+export function getErrorSourc... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/react-dev-overlay/src/internal/helpers/stack-frame.ts | @@ -31,21 +31,20 @@ export type OriginalStackFrame =
}
export function getOriginalStackFrames(
- isServerSide: boolean,
- frames: StackFrame[]
+ frames: StackFrame[],
+ type: 'server' | 'edge-server' | null
) {
- return Promise.all(
- frames.map((frame) => getOriginalStackFrame(isServerSide, frame))
- ... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | packages/react-dev-overlay/src/middleware.ts | @@ -15,12 +15,15 @@ import type webpack from 'webpack'
import { getRawSourceMap } from './internal/helpers/getRawSourceMap'
import { launchEditor } from './internal/helpers/launchEditor'
+export { getErrorSource } from './internal/helpers/nodeStackFrames'
+export { getServerError } from './internal/helpers/nodeStac... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | test/integration/middleware-dev-errors/lib/unhandled.js | @@ -0,0 +1,3 @@
+setTimeout(() => {
+ throw new Error('This file asynchronously fails while loading')
+}, 10) | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | test/integration/middleware-dev-errors/lib/unparseable.js | @@ -0,0 +1 @@
+throw new Error('This file synchronously fails while loading') | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | test/integration/middleware-dev-errors/middleware.js | @@ -0,0 +1 @@
+// this will be populated by each test | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | test/integration/middleware-dev-errors/pages/index.js | @@ -0,0 +1,3 @@
+export default function Home() {
+ return <div id="page-title">A page</div>
+} | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | test/integration/middleware-dev-errors/test/index.test.js | @@ -0,0 +1,244 @@
+import {
+ fetchViaHTTP,
+ File,
+ findPort,
+ getRedboxSource,
+ hasRedbox,
+ killApp,
+ launchApp,
+} from 'next-test-utils'
+import { join } from 'path'
+import stripAnsi from 'strip-ansi'
+import webdriver from 'next-webdriver'
+
+const context = {
+ appDir: join(__dirname, '../'),
+ bui... | true |
Other | vercel | next.js | de7b316446e352d34bb31af870f69fe27c818b9d.json | Improve Middleware errors (#37695)
* Improve stack traces in dev mode
* Refactor `react-dev-overlay` to support the Edge Compiler
* Serialize errors including the compiler `source`
* Adopt the new `react-dev-overlay` displaying it for middleware errors
* Improve tests
* fix rsc cases
* update test
... | test/integration/middleware-with-node.js-apis/test/index.test.ts | @@ -2,6 +2,7 @@
import { remove } from 'fs-extra'
import {
+ check,
fetchViaHTTP,
findPort,
killApp,
@@ -51,6 +52,7 @@ describe('Middleware using Node.js API', () => {
output = ''
appPort = await findPort()
app = await launchApp(appDir, appPort, {
+ env: { __NEXT_TEST_WITH_DEVT... | true |
Other | vercel | next.js | 0dda1b9f6c0d3fa0894cb790f96980b52aba3002.json | fix(ts): expose `DynamicOptionsLoadingProps` type (#37700)
Fixes #37683
## 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... | packages/next/shared/lib/dynamic.tsx | @@ -16,18 +16,16 @@ export type LoadableGeneratedOptions = {
modules?(): LoaderMap
}
+export type DynamicOptionsLoadingProps = {
+ error?: Error | null
+ isLoading?: boolean
+ pastDelay?: boolean
+ retry?: () => void
+ timedOut?: boolean
+}
+
export type DynamicOptions<P = {}> = LoadableGeneratedOptions & {... | false |
Other | vercel | next.js | 5c6c3851006a2fd43a8ec9518c1be7f723bbf2e3.json | Use relative path for example (#33565)
The paths starting with slashes in the ESLint config examples are absolute, which are almost never the correct configuration for a project. Using a relative path is a much more common configuration, and leads to much less debugging why these examples don't work.
## Bug
- [ ] ... | docs/basic-features/eslint.md | @@ -114,13 +114,13 @@ If you're using `eslint-plugin-next` in a project where Next.js isn't installed
"extends": "next",
"settings": {
"next": {
- "rootDir": "/packages/my-app/"
+ "rootDir": "packages/my-app/"
}
}
}
```
-`rootDir` can be a path (relative or absolute), a glob (i.e. `"/pa... | true |
Other | vercel | next.js | 5c6c3851006a2fd43a8ec9518c1be7f723bbf2e3.json | Use relative path for example (#33565)
The paths starting with slashes in the ESLint config examples are absolute, which are almost never the correct configuration for a project. Using a relative path is a much more common configuration, and leads to much less debugging why these examples don't work.
## Bug
- [ ] ... | errors/no-html-link-for-pages.md | @@ -53,7 +53,7 @@ In some cases, you may also need to configure this rule directly by providing a
```json
{
"rules": {
- "@next/next/no-html-link-for-pages": ["error", "/my-app/pages/"]
+ "@next/next/no-html-link-for-pages": ["error", "packages/my-app/pages/"]
}
}
``` | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.