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 | 0bfdf0e0d1bfa760ac375a5908fb110024e09a97.json | Fix react root env missing in NextServer (#37562)
* Fix react root env missing in NextServer
* switch to useId instead of using process.env var
* add production test
* extend timeout
* fix test
* fix lint
* use version to detect if enable react root | test/production/react-18-streaming-ssr/custom-server/server.js | @@ -0,0 +1,44 @@
+const NextServer = require('next/dist/server/next-server').default
+const defaultNextConfig =
+ require('next/dist/server/config-shared').defaultConfig
+const http = require('http')
+
+process.on('SIGTERM', () => process.exit(0))
+process.on('SIGINT', () => process.exit(0))
+
+let handler
+
+const se... | true |
Other | vercel | next.js | 0bfdf0e0d1bfa760ac375a5908fb110024e09a97.json | Fix react root env missing in NextServer (#37562)
* Fix react root env missing in NextServer
* switch to useId instead of using process.env var
* add production test
* extend timeout
* fix test
* fix lint
* use version to detect if enable react root | test/production/react-18-streaming-ssr/index.test.ts | @@ -1,8 +1,20 @@
-import { createNext } from 'e2e-utils'
+import { join } from 'path'
+import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
-import { fetchViaHTTP, renderViaHTTP } from 'next-test-utils'
-
-describe('react 18 streaming SSR in minimal mode', () => {
+im... | true |
Other | vercel | next.js | 0bfdf0e0d1bfa760ac375a5908fb110024e09a97.json | Fix react root env missing in NextServer (#37562)
* Fix react root env missing in NextServer
* switch to useId instead of using process.env var
* add production test
* extend timeout
* fix test
* fix lint
* use version to detect if enable react root | test/production/react-18-streaming-ssr/streaming-ssr/next.config.js | @@ -0,0 +1,6 @@
+module.exports = {
+ trailingSlash: true,
+ experimental: {
+ runtime: 'edge',
+ },
+} | true |
Other | vercel | next.js | 0bfdf0e0d1bfa760ac375a5908fb110024e09a97.json | Fix react root env missing in NextServer (#37562)
* Fix react root env missing in NextServer
* switch to useId instead of using process.env var
* add production test
* extend timeout
* fix test
* fix lint
* use version to detect if enable react root | test/production/react-18-streaming-ssr/streaming-ssr/pages/hello.js | @@ -0,0 +1,14 @@
+import Link from 'next/link'
+
+export default function Page() {
+ return (
+ <div>
+ <p>hello nextjs</p>
+ <Link href="/">
+ <a>home</a>
+ </Link>
+ </div>
+ )
+}
+
+export const config = { runtime: 'edge' } | true |
Other | vercel | next.js | 0bfdf0e0d1bfa760ac375a5908fb110024e09a97.json | Fix react root env missing in NextServer (#37562)
* Fix react root env missing in NextServer
* switch to useId instead of using process.env var
* add production test
* extend timeout
* fix test
* fix lint
* use version to detect if enable react root | test/production/react-18-streaming-ssr/streaming-ssr/pages/index.js | @@ -0,0 +1,14 @@
+export default function Page() {
+ return (
+ <div>
+ <style jsx>{`
+ p {
+ color: blue;
+ }
+ `}</style>
+ <p>index</p>
+ </div>
+ )
+}
+
+export const config = { runtime: 'edge' } | true |
Other | vercel | next.js | 0bfdf0e0d1bfa760ac375a5908fb110024e09a97.json | Fix react root env missing in NextServer (#37562)
* Fix react root env missing in NextServer
* switch to useId instead of using process.env var
* add production test
* extend timeout
* fix test
* fix lint
* use version to detect if enable react root | test/production/react-18-streaming-ssr/streaming-ssr/pages/multi-byte.js | @@ -0,0 +1,9 @@
+export default function Page() {
+ return (
+ <div>
+ <p>{'マルチバイト'.repeat(28)}</p>
+ </div>
+ )
+}
+
+export const config = { runtime: 'edge' } | true |
Other | vercel | next.js | 748c8e8002987a68396858f4b5ca3eda9bd6d0d2.json | Update deployment documentation. (#37571)
This PR adds new information to the Next.js deployment documentation to highlight examples or guides for deploying Next.js to a handful of services. This builds on the existing documentation around the Next.js Build API (from `next build`) and options for self-hosting with Nod... | docs/deployment.md | @@ -90,6 +90,40 @@ If you need to use different Environment Variables across multiple environments,
If you’d like to do a static HTML export of your Next.js app, follow the directions on our [Static HTML Export documentation](/docs/advanced-features/static-html-export.md).
+## Other Services
+
+The following servi... | false |
Other | vercel | next.js | 40778597a5145dc6ec74d690c0d615e7533720f5.json | chore: remove unused safari nomodule fix (#37541)
`safariNomoduleFix` was first introduced back in the year 2019 (#7704) as a part of the `modern` experimental feature. The experiment is ended and the feature is removed a year later in #19275. However, the unused `safariNomoduleFix` is never removed, until now. | packages/next/pages/_document.tsx | @@ -925,10 +925,6 @@ export class NextScript extends Component<OriginProps> {
context!: React.ContextType<typeof HtmlContext>
- // Source: https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc
- static safariNomoduleFix =
- '!function(){var e=document,t=e.createElement("script");if(!("noModule"in... | false |
Other | vercel | next.js | e7d3b37d52dfa5bc81cd14287c101e77e0ff7871.json | chore: remove unused variable (#37538)
I noticed this line was not used in the standalone server:

## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have h... | packages/next/build/utils.ts | @@ -1245,7 +1245,6 @@ server.listen(currentPort, (err) => {
console.error("Failed to start server", err)
process.exit(1)
}
- const addr = server.address()
const nextServer = new NextServer({
hostname: 'localhost',
port: currentPort, | false |
Other | vercel | next.js | 42f838e15632f0289a3da359d95000e6a833e7b5.json | Add check for duplicate locales (#37485)
## Bug
- [X] Related issues linked using `fixes #37483`
- [ ] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
Duplicate locales will lead to an obscure error message at build time, here I caught them earlier.
Using a Set sounded the te... | packages/next/server/config.ts | @@ -638,6 +638,26 @@ function assignDefaults(userConfig: { [key: string]: any }) {
)
}
+ const normalizedLocales = new Set()
+ const duplicateLocales = new Set()
+
+ i18n.locales.forEach((locale) => {
+ const localeLower = locale.toLowerCase()
+ if (normalizedLocales.has(localeLower)) {... | true |
Other | vercel | next.js | 42f838e15632f0289a3da359d95000e6a833e7b5.json | Add check for duplicate locales (#37485)
## Bug
- [X] Related issues linked using `fixes #37483`
- [ ] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
Duplicate locales will lead to an obscure error message at build time, here I caught them earlier.
Using a Set sounded the te... | test/integration/i18n-support/test/index.test.js | @@ -583,4 +583,25 @@ describe('i18n Support', () => {
'Both fr.example.com and french.example.com configured the defaultLocale fr but only one can'
)
})
+
+ it('should show proper error for duplicate locales', async () => {
+ nextConfig.write(`
+ module.exports = {
+ i18n: {
+ lo... | true |
Other | vercel | next.js | 3026fa586446beee1b116b5b6b5e20c2b857e870.json | Update flakey preview test (#37518) | test/integration/prerender-preview/pages/index.js | @@ -34,7 +34,7 @@ export default function ({ hasProps, preview, previewData, random }) {
>
Reload static props
</button>
- <p id="router">{JSON.stringify(router)}</p>
+ <p id="router">{JSON.stringify({ isPreview: router.isPreview })}</p>
</>
)
} | false |
Other | vercel | next.js | 1fcf21c7e7e9b3d56cde823e51325fe59140b116.json | test: upgrade playwright-chromium from 1.14.1 to 1.22.2 (#37436)
* test: upgrade playwright-chromium from 1.14.1 to 1.22.2
This is a prereq for #36490 because the Events Timing API
used to measure Interaction to Next Paint (INP, experiemental web vital)
is only available in Chromium >= v98.
* update test
Co... | .github/workflows/build_test_deploy.yml | @@ -266,7 +266,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native
- - run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps
+ - run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange != ... | true |
Other | vercel | next.js | 1fcf21c7e7e9b3d56cde823e51325fe59140b116.json | test: upgrade playwright-chromium from 1.14.1 to 1.22.2 (#37436)
* test: upgrade playwright-chromium from 1.14.1 to 1.22.2
This is a prereq for #36490 because the Events Timing API
used to measure Interaction to Next Paint (INP, experiemental web vital)
is only available in Chromium >= v98.
* update test
Co... | .github/workflows/test_react_experimental.yml | @@ -44,6 +44,6 @@ jobs:
path: ./*
key: ${{ github.sha }}-react-experimental
- - run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps
+ - run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
- run: node run-tests.js --timings -g ${{ matrix.... | true |
Other | vercel | next.js | 1fcf21c7e7e9b3d56cde823e51325fe59140b116.json | test: upgrade playwright-chromium from 1.14.1 to 1.22.2 (#37436)
* test: upgrade playwright-chromium from 1.14.1 to 1.22.2
This is a prereq for #36490 because the Events Timing API
used to measure Interaction to Next Paint (INP, experiemental web vital)
is only available in Chromium >= v98.
* update test
Co... | .github/workflows/test_react_next.yml | @@ -44,6 +44,6 @@ jobs:
path: ./*
key: ${{ github.sha }}-react-next
- - run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps
+ - run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
- run: node run-tests.js --timings -g ${{ matrix.group }}... | true |
Other | vercel | next.js | 1fcf21c7e7e9b3d56cde823e51325fe59140b116.json | test: upgrade playwright-chromium from 1.14.1 to 1.22.2 (#37436)
* test: upgrade playwright-chromium from 1.14.1 to 1.22.2
This is a prereq for #36490 because the Events Timing API
used to measure Interaction to Next Paint (INP, experiemental web vital)
is only available in Chromium >= v98.
* update test
Co... | package.json | @@ -156,7 +156,7 @@
"npm-run-all": "4.1.5",
"nprogress": "0.2.0",
"pixrem": "5.0.0",
- "playwright-chromium": "1.14.1",
+ "playwright-chromium": "1.22.2",
"plop": "3.0.5",
"postcss-nested": "4.2.1",
"postcss-pseudoelements": "5.0.0", | true |
Other | vercel | next.js | 1fcf21c7e7e9b3d56cde823e51325fe59140b116.json | test: upgrade playwright-chromium from 1.14.1 to 1.22.2 (#37436)
* test: upgrade playwright-chromium from 1.14.1 to 1.22.2
This is a prereq for #36490 because the Events Timing API
used to measure Interaction to Next Paint (INP, experiemental web vital)
is only available in Chromium >= v98.
* update test
Co... | pnpm-lock.yaml | @@ -121,7 +121,7 @@ importers:
npm-run-all: 4.1.5
nprogress: 0.2.0
pixrem: 5.0.0
- playwright-chromium: 1.14.1
+ playwright-chromium: 1.22.2
plop: 3.0.5
postcss-nested: 4.2.1
postcss-pseudoelements: 5.0.0
@@ -270,7 +270,7 @@ importers:
npm-run-all: 4.1.5
... | true |
Other | vercel | next.js | 1fcf21c7e7e9b3d56cde823e51325fe59140b116.json | test: upgrade playwright-chromium from 1.14.1 to 1.22.2 (#37436)
* test: upgrade playwright-chromium from 1.14.1 to 1.22.2
This is a prereq for #36490 because the Events Timing API
used to measure Interaction to Next Paint (INP, experiemental web vital)
is only available in Chromium >= v98.
* update test
Co... | test/integration/i18n-support-base-path/pages/index.js | @@ -1,8 +1,18 @@
import Link from 'next/link'
import { useRouter } from 'next/router'
+import { useEffect } from 'react'
+import { useState } from 'react'
export default function Page(props) {
const router = useRouter()
+ const parsedAs = new URL(router.asPath, 'http://n')
+ const [asPath, setAsPath] = useSta... | true |
Other | vercel | next.js | 1fcf21c7e7e9b3d56cde823e51325fe59140b116.json | test: upgrade playwright-chromium from 1.14.1 to 1.22.2 (#37436)
* test: upgrade playwright-chromium from 1.14.1 to 1.22.2
This is a prereq for #36490 because the Events Timing API
used to measure Interaction to Next Paint (INP, experiemental web vital)
is only available in Chromium >= v98.
* update test
Co... | test/integration/i18n-support/pages/index.js | @@ -1,8 +1,18 @@
import Link from 'next/link'
import { useRouter } from 'next/router'
+import { useEffect } from 'react'
+import { useState } from 'react'
export default function Page(props) {
const router = useRouter()
+ const parsedAs = new URL(router.asPath, 'http://n')
+ const [asPath, setAsPath] = useSta... | true |
Other | vercel | next.js | f7ac942e6ae990d6fedaae487f00ed777ef65f02.json | Add note about NEXT_DATA hydration (#37480)
Missing documentation around `NEXT_DATA` hydration when using `getServerSideProps()`. This PR warn users that the result of `getServerSideProps()/getStaticProps` is also available on the client-side due to React Hydration so they should not use any sensitive information in t... | docs/api-reference/data-fetching/get-initial-props.md | @@ -68,6 +68,8 @@ For the initial page load, `getInitialProps` will run on the server only. `getIn
- `getInitialProps` can **not** be used in children components, only in the default export of every page
- If you are using server-side only modules inside `getInitialProps`, make sure to [import them properly](https://... | true |
Other | vercel | next.js | f7ac942e6ae990d6fedaae487f00ed777ef65f02.json | Add note about NEXT_DATA hydration (#37480)
Missing documentation around `NEXT_DATA` hydration when using `getServerSideProps()`. This PR warn users that the result of `getServerSideProps()/getStaticProps` is also available on the client-side due to React Hydration so they should not use any sensitive information in t... | docs/basic-features/data-fetching/get-server-side-props.md | @@ -14,6 +14,8 @@ export async function getServerSideProps(context) {
}
```
+> Note that irrespective of rendering type, any `props` will be passed to the page component and can be viewed on the client-side in the initial HTML. This is to allow the page to be [hydrated](https://reactjs.org/docs/react-dom.html#hydra... | true |
Other | vercel | next.js | f7ac942e6ae990d6fedaae487f00ed777ef65f02.json | Add note about NEXT_DATA hydration (#37480)
Missing documentation around `NEXT_DATA` hydration when using `getServerSideProps()`. This PR warn users that the result of `getServerSideProps()/getStaticProps` is also available on the client-side due to React Hydration so they should not use any sensitive information in t... | docs/basic-features/data-fetching/get-static-props.md | @@ -14,6 +14,8 @@ export async function getStaticProps(context) {
}
```
+> Note that irrespective of rendering type, any `props` will be passed to the page component and can be viewed on the client-side in the initial HTML. This is to allow the page to be [hydrated](https://reactjs.org/docs/react-dom.html#hydrate) ... | true |
Other | vercel | next.js | b3000594b2cc325eda33aee84d179447aaace050.json | Fix invalid middleware regexp in manifest (#37492) | packages/next/build/webpack/plugins/middleware-plugin.ts | @@ -394,7 +394,7 @@ function getCreateAssets(params: {
const { namedRegex } = getNamedMiddlewareRegex(page, {
catchAll: !metadata.edgeSSR,
})
- const regexp = metadata?.edgeMiddleware?.matcherRegexp ?? namedRegex
+ const regexp = metadata?.edgeMiddleware?.matcherRegexp || namedRegex
... | true |
Other | vercel | next.js | b3000594b2cc325eda33aee84d179447aaace050.json | Fix invalid middleware regexp in manifest (#37492) | packages/next/server/next-server.ts | @@ -1431,6 +1431,12 @@ function getMiddlewareMatcher(
return stored
}
+ if (typeof info.regexp !== 'string' || !info.regexp) {
+ throw new Error(
+ `Invariant: invalid regexp for middleware ${JSON.stringify(info)}`
+ )
+ }
+
const matcher = getRouteMatcher({ re: new RegExp(info.regexp), groups... | true |
Other | vercel | next.js | b3000594b2cc325eda33aee84d179447aaace050.json | Fix invalid middleware regexp in manifest (#37492) | test/integration/middleware-general/test/index.test.js | @@ -113,6 +113,22 @@ describe('Middleware Runtime', () => {
})
})
+ it('should have valid middleware field in manifest', async () => {
+ const manifest = await fs.readJSON(
+ join(context.appDir, '.next/server/middleware-manifest.json')
+ )
+ expect(manifest.middleware).toEqual({
... | true |
Other | vercel | next.js | 863db9b0e2a7b038348202c040f90f050fd12855.json | keep method when cloning Request, fixes #36522 (#36539)
keep method when cloning Request
Co-authored-by: JJ Kasper <jj@jjsweb.site> | packages/next/server/web/spec-compliant/request.ts | @@ -16,7 +16,9 @@ class BaseRequest extends Body implements Request {
}
constructor(input: BaseRequest | string, init: RequestInit = {}) {
- const method = init.method?.toUpperCase() ?? 'GET'
+ const method =
+ init.method?.toUpperCase() ??
+ (input instanceof BaseRequest ? input.method?.toUpper... | true |
Other | vercel | next.js | 863db9b0e2a7b038348202c040f90f050fd12855.json | keep method when cloning Request, fixes #36522 (#36539)
keep method when cloning Request
Co-authored-by: JJ Kasper <jj@jjsweb.site> | test/unit/web-runtime/request.test.ts | @@ -45,3 +45,14 @@ it('Request.referrer can be customized', async () => {
const request = new Request('https://vercel.com', { referrer: 'client' })
expect(request.referrer).toBe('client')
})
+
+it('Request copies over method', async () => {
+ const request = new Request('https://vercel.com', {
+ method: 'POS... | true |
Other | vercel | next.js | 3bd42b4d0bc3e967894f9bcf715d1c062f9a1c19.json | docs: Add pageExtensions usage note in API Routes (#35918)
In order to turn the API Routes docs more clear about the file extensions when using `pageExtensions`.
I know that it was already explained [here](https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions).
But just think about the DX: If ... | docs/api-routes/introduction.md | @@ -27,6 +27,8 @@ export default function handler(req, res) {
}
```
+> **Note**: API Routes will be affected by [`pageExtensions` configuration](/docs/api-reference/next.config.js/custom-page-extensions.md) in `next.config.js`.
+
For an API route to work, you need to export a function as default (a.k.a **request h... | false |
Other | vercel | next.js | afbc511d3ff21f4a34a11207d04fe41d8887a455.json | fix: place the charset meta tag at the top of the head (#36561)
Fixes: #36432
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature request or RFC. Make sure the featur... | packages/next/shared/lib/head.tsx | @@ -134,7 +134,7 @@ function reduceComponents(
)
.reduce(onlyReactElement, [])
.reverse()
- .concat(defaultHead(props.inAmpMode))
+ .concat(defaultHead(props.inAmpMode).reverse())
.filter(unique())
.reverse()
.map((c: React.ReactElement<any>, i: number) => { | true |
Other | vercel | next.js | afbc511d3ff21f4a34a11207d04fe41d8887a455.json | fix: place the charset meta tag at the top of the head (#36561)
Fixes: #36432
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature request or RFC. Make sure the featur... | test/e2e/next-head/index.test.ts | @@ -22,6 +22,19 @@ describe('should set-up next', () => {
})
afterAll(() => next.destroy())
+ it(`should place charset element at the top of <head>`, async () => {
+ const browser = await webdriver(next.url, '/')
+
+ const html = await browser.eval(() => {
+ const head = document.querySelector('head... | true |
Other | vercel | next.js | 87826ee186fc65c0b3b4288791f4b575158371c9.json | fix(#33081): handle relative path correctly (#36823)
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
Fixes #36823
Closes #33084
The issue is caused by the `isLocalURL` function only checks if a URL starts with `... | packages/next/shared/lib/router/router.ts | @@ -30,6 +30,7 @@ import {
NextPageContext,
ST,
NEXT_DATA,
+ isAbsoluteUrl,
} from '../utils'
import { isDynamicRoute } from './utils/is-dynamic'
import { parseRelativeUrl } from './utils/parse-relative-url'
@@ -231,8 +232,7 @@ export function delBasePath(path: string): string {
*/
export function isLoc... | true |
Other | vercel | next.js | 87826ee186fc65c0b3b4288791f4b575158371c9.json | fix(#33081): handle relative path correctly (#36823)
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
Fixes #36823
Closes #33084
The issue is caused by the `isLocalURL` function only checks if a URL starts with `... | packages/next/shared/lib/router/utils/parse-relative-url.ts | @@ -11,7 +11,13 @@ export function parseRelativeUrl(url: string, base?: string) {
const globalBase = new URL(
typeof window === 'undefined' ? 'http://n' : getLocationOrigin()
)
- const resolvedBase = base ? new URL(base, globalBase) : globalBase
+
+ const resolvedBase = base
+ ? new URL(base, globalBase... | true |
Other | vercel | next.js | 87826ee186fc65c0b3b4288791f4b575158371c9.json | fix(#33081): handle relative path correctly (#36823)
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
Fixes #36823
Closes #33084
The issue is caused by the `isLocalURL` function only checks if a URL starts with `... | packages/next/shared/lib/utils.ts | @@ -290,6 +290,11 @@ export function execOnce<T extends (...args: any[]) => ReturnType<T>>(
}) as T
}
+// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
+// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
+const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/
+export const isAbsoluteUrl =... | true |
Other | vercel | next.js | 87826ee186fc65c0b3b4288791f4b575158371c9.json | fix(#33081): handle relative path correctly (#36823)
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
Fixes #36823
Closes #33084
The issue is caused by the `isLocalURL` function only checks if a URL starts with `... | test/integration/client-navigation/pages/nav/relative-1.js | @@ -0,0 +1,12 @@
+import Link from 'next/link'
+
+export default function Relative1() {
+ return (
+ <div id="relative-1">
+ On relative 1
+ <Link href="./relative-2">
+ <a>To relative 2</a>
+ </Link>
+ </div>
+ )
+} | true |
Other | vercel | next.js | 87826ee186fc65c0b3b4288791f4b575158371c9.json | fix(#33081): handle relative path correctly (#36823)
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
Fixes #36823
Closes #33084
The issue is caused by the `isLocalURL` function only checks if a URL starts with `... | test/integration/client-navigation/pages/nav/relative-2.js | @@ -0,0 +1,18 @@
+import { useRouter } from 'next/router'
+
+export default function Relative2() {
+ const router = useRouter()
+ return (
+ <div id="relative-2">
+ On relative 2
+ <button
+ onClick={(e) => {
+ e.preventDefault()
+ router.push('./relative')
+ }}
+ >
+... | true |
Other | vercel | next.js | 87826ee186fc65c0b3b4288791f4b575158371c9.json | fix(#33081): handle relative path correctly (#36823)
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
Fixes #36823
Closes #33084
The issue is caused by the `isLocalURL` function only checks if a URL starts with `... | test/integration/client-navigation/pages/nav/relative/index.js | @@ -0,0 +1,12 @@
+import Link from 'next/link'
+
+export default function Relative() {
+ return (
+ <div id="relative">
+ On relative index
+ <Link href="./relative-1" id="relative-1-link">
+ To relative 1
+ </Link>
+ </div>
+ )
+} | true |
Other | vercel | next.js | 87826ee186fc65c0b3b4288791f4b575158371c9.json | fix(#33081): handle relative path correctly (#36823)
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
Fixes #36823
Closes #33084
The issue is caused by the `isLocalURL` function only checks if a URL starts with `... | test/integration/client-navigation/test/index.test.js | @@ -1714,6 +1714,30 @@ describe('Client Navigation', () => {
expect(value).toBe(false)
})
+ it('should navigate to paths relative to the current page', async () => {
+ const browser = await webdriver(context.appPort, '/nav/relative')
+ await browser.waitForElementByCss('body', 500)
+ let page
+
+ ... | true |
Other | vercel | next.js | 87826ee186fc65c0b3b4288791f4b575158371c9.json | fix(#33081): handle relative path correctly (#36823)
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
Fixes #36823
Closes #33084
The issue is caused by the `isLocalURL` function only checks if a URL starts with `... | test/unit/parse-relative-url.test.ts | @@ -42,6 +42,24 @@ describe('parseRelativeUrl', () => {
check(
'http://example.com:3210/someA/pathB?fooC=barD#hashE',
'./someF/pathG?fooH=barI#hashJ',
+ {
+ pathname: '/someA/someF/pathG',
+ search: '?fooH=barI',
+ hash: '#hashJ',
+ }
+ )
+ check(
+ 'http://e... | true |
Other | vercel | next.js | 29b3cdf93f483b0081512bd3a21ff7e0bd72f2ca.json | Remove invalid attrs for head html element (#36457)
Co-authored-by: JJ Kasper <jj@jjsweb.site> | packages/next/pages/_document.tsx | @@ -32,6 +32,13 @@ type DocumentFiles = {
allFiles: readonly string[]
}
+type HeadHTMLProps = React.DetailedHTMLProps<
+ React.HTMLAttributes<HTMLHeadElement>,
+ HTMLHeadElement
+>
+
+type HeadProps = OriginProps & HeadHTMLProps
+
function getDocumentFiles(
buildManifest: BuildManifest,
pathname: string,... | true |
Other | vercel | next.js | 29b3cdf93f483b0081512bd3a21ff7e0bd72f2ca.json | Remove invalid attrs for head html element (#36457)
Co-authored-by: JJ Kasper <jj@jjsweb.site> | test/integration/amphtml/pages/_document.js | @@ -15,7 +15,7 @@ class MyDocument extends Document {
render() {
return (
<Html>
- <Head />
+ <Head nonce="test-nonce" />
<body>
<Main />
<AmpTst /> | true |
Other | vercel | next.js | 5b893663fdb3658de4e8ce2bb5966fbfe4e905ef.json | Include router.asPath caveats in docs (#36876)
initial commit
Co-authored-by: JJ Kasper <jj@jjsweb.site> | docs/advanced-features/automatic-static-optimization.md | @@ -46,3 +46,4 @@ And if you add `getServerSideProps` to the page, it will then be JavaScript, lik
- If you have a [custom `App`](/docs/advanced-features/custom-app.md) with `getInitialProps` then this optimization will be turned off in pages without [Static Generation](/docs/basic-features/data-fetching/get-static-... | true |
Other | vercel | next.js | 5b893663fdb3658de4e8ce2bb5966fbfe4e905ef.json | Include router.asPath caveats in docs (#36876)
initial commit
Co-authored-by: JJ Kasper <jj@jjsweb.site> | docs/api-reference/next/router.md | @@ -53,6 +53,8 @@ The following is the definition of the `router` object returned by both [`useRou
- `isReady`: `boolean` - Whether the router fields are updated client-side and ready for use. Should only be used inside of `useEffect` methods and not for conditionally rendering on the server. See related docs for use ... | true |
Other | vercel | next.js | 4fa54ede8326374c867c29ffb6d05452eca1b07a.json | typo: Change yarn into pnpm (#37092)
## 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 implementat... | docs/api-reference/create-next-app.md | @@ -31,8 +31,10 @@ pnpm create next-app -- --ts
- **--ts, --typescript** - Initialize as a TypeScript project.
- **-e, --example [name]|[github-url]** - An example to bootstrap the app with. You can use an example name from the [Next.js repo](https://github.com/vercel/next.js/tree/canary/examples) or a GitHub URL. Th... | false |
Other | vercel | next.js | 2411d368d3f631e26582e3603f54d1cafa91edd4.json | Enable E2E deploy tests on publish (#37019)
* Enable E2E deploy tests on publish
* update e2e tests
* add job name | .github/workflows/build_test_deploy.yml | @@ -908,6 +908,47 @@ jobs:
- run: ./scripts/publish-native.js $GITHUB_REF
- run: ./scripts/publish-release.sh
+ testDeployE2E:
+ name: E2E (deploy)
+ runs-on: ubuntu-latest
+ needs: [publishRelease]
+ env:
+ NEXT_TELEMETRY_DISABLED: 1
+ NEXT_TEST_JOB: 1
+ VERCEL_TEST_TOKEN: $... | true |
Other | vercel | next.js | 2411d368d3f631e26582e3603f54d1cafa91edd4.json | Enable E2E deploy tests on publish (#37019)
* Enable E2E deploy tests on publish
* update e2e tests
* add job name | scripts/reset-vercel-project.mjs | @@ -1,7 +1,7 @@
import fetch from 'node-fetch'
export const TEST_PROJECT_NAME = 'vtest314-e2e-tests'
-export const TEST_TEAM_NAME = 'vtest314-next-e2e-tests'
+export const TEST_TEAM_NAME = process.env.VERCEL_TEST_TEAM
export const TEST_TOKEN = process.env.VERCEL_TEST_TOKEN
async function resetProject() { | true |
Other | vercel | next.js | 2411d368d3f631e26582e3603f54d1cafa91edd4.json | Enable E2E deploy tests on publish (#37019)
* Enable E2E deploy tests on publish
* update e2e tests
* add job name | test/e2e/i18n-api-support/index.test.ts | @@ -54,18 +54,21 @@ describe('i18n API support', () => {
expect(await res.text()).toBe('blog/[slug]')
})
- it('should fallback rewrite non-matching API request', async () => {
- const paths = [
- '/fr/api/hello',
- '/en/api/blog/first',
- '/en/api/non-existent',
- '/api/non-existent',
... | true |
Other | vercel | next.js | 2411d368d3f631e26582e3603f54d1cafa91edd4.json | Enable E2E deploy tests on publish (#37019)
* Enable E2E deploy tests on publish
* update e2e tests
* add job name | test/e2e/manual-client-base-path/index.test.ts | @@ -8,6 +8,11 @@ import assert from 'assert'
import { check, waitFor } from 'next-test-utils'
describe('manual-client-base-path', () => {
+ if ((global as any).isNextDeploy) {
+ it('should skip deploy', () => {})
+ return
+ }
+
let next: NextInstance
let server: http.Server
let appPort: string | true |
Other | vercel | next.js | 2411d368d3f631e26582e3603f54d1cafa91edd4.json | Enable E2E deploy tests on publish (#37019)
* Enable E2E deploy tests on publish
* update e2e tests
* add job name | test/e2e/views-dir/index.test.ts | @@ -6,6 +6,11 @@ import cheerio from 'cheerio'
import webdriver from 'next-webdriver'
describe('views dir', () => {
+ if ((global as any).isNextDeploy) {
+ it('should skip next deploy for now', () => {})
+ return
+ }
+
if (process.env.NEXT_TEST_REACT_VERSION === '^17') {
it('should skip for react v1... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | docs/advanced-features/react-18/server-components.md | @@ -94,15 +94,7 @@ export default function Document() {
### `next/app`
-If you're using `_app.js`, the usage is the same as [Custom App](/docs/advanced-features/custom-app).
-If you're using `_app.server.js` as a server component, see the example below where it only receives the `children` prop as React elements. ... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/build/entries.ts | @@ -28,26 +28,20 @@ import {
import { __ApiPreviewProps } from '../server/api-utils'
import { isTargetLikeServerless } from '../server/utils'
import { warn } from './output/log'
+import { isServerComponentPage } from './utils'
import { getPageStaticInfo } from './analysis/get-page-static-info'
-import { isServerCom... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/build/utils.ts | @@ -141,12 +141,6 @@ export async function printTreeView(
]
const hasCustomApp = await findPageFile(pagesDir, '/_app', pageExtensions)
- const hasCustomAppServer = await findPageFile(
- pagesDir,
- '/_app.server',
- pageExtensions
- )
-
pageInfos.set('/404', {
...(pageInfos.get('/404') || pag... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/build/webpack-config.ts | @@ -606,19 +606,12 @@ export default async function getBaseWebpackConfig(
if (dev) {
customAppAliases[`${PAGES_DIR_ALIAS}/_app`] = [
- ...rawPageExtensions.reduce((prev, ext) => {
+ ...config.pageExtensions.reduce((prev, ext) => {
prev.push(path.join(pagesDir, `_app.${ext}`))
retur... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/build/webpack/loaders/next-middleware-ssr-loader/index.ts | @@ -4,7 +4,6 @@ import { stringifyRequest } from '../../stringify-request'
export type MiddlewareSSRLoaderQuery = {
absolute500Path: string
absoluteAppPath: string
- absoluteAppServerPath: string
absoluteDocumentPath: string
absoluteErrorPath: string
absolutePagePath: string
@@ -22,7 +21,6 @@ export de... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/build/webpack/loaders/next-middleware-ssr-loader/render.ts | @@ -27,7 +27,6 @@ export function getRender({
serverComponentManifest,
config,
buildId,
- appServerMod,
}: {
dev: boolean
page: string
@@ -49,8 +48,6 @@ export function getRender({
reactLoadableManifest,
Document,
App: appMod.default as AppType,
- AppMod: appMod,
- AppServerMod: ap... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/build/webpack/loaders/next-serverless-loader/index.ts | @@ -18,7 +18,6 @@ export type ServerlessLoaderQuery = {
distDir: string
absolutePagePath: string
absoluteAppPath: string
- absoluteAppServerPath: string
absoluteDocumentPath: string
absoluteErrorPath: string
absolute404Path: string | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/build/webpack/loaders/next-serverless-loader/page-handler.ts | @@ -65,7 +65,7 @@ export function getPageHandler(ctx: ServerlessHandlerCtx) {
_params?: any
) {
let Component
- let AppMod
+ let App
let config
let Document
let Error
@@ -78,7 +78,7 @@ export function getPageHandler(ctx: ServerlessHandlerCtx) {
getServerSideProps,
getStat... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/build/webpack/plugins/flight-manifest-plugin.ts | @@ -96,8 +96,6 @@ export class FlightManifestPlugin {
// For each SC server compilation entry, we need to create its corresponding
// client component entry.
for (const [name, entry] of compilation.entries.entries()) {
- if (name === 'pages/_app.server') continue
-
// Check if the page entry ... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/build/webpack/plugins/pages-manifest-plugin.ts | @@ -60,7 +60,7 @@ export default class PagesManifestPlugin implements webpack.Plugin {
file.endsWith('.js')
)
- // Skip _app.server entry which is empty
+ // Skip entries which are empty
if (!files.length) {
continue
} | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/client/index.tsx | @@ -86,7 +86,6 @@ let webpackHMR: any
let CachedApp: AppComponent, onPerfEntry: (metric: any) => void
let CachedComponent: React.ComponentType
-let isRSCPage: boolean
class Container extends React.Component<{
fn: (err: Error, info?: any) => void
@@ -331,7 +330,6 @@ export async function hydrate(opts?: { befor... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/export/index.ts | @@ -237,12 +237,7 @@ export default async function exportApp(
continue
}
- if (
- page === '/_document' ||
- page === '/_app.server' ||
- page === '/_app' ||
- page === '/_error'
- ) {
+ if (page === '/_document' || page === '/_app' || page === '/_error') {
... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/pages/_app.server.tsx | @@ -1,3 +0,0 @@
-export default function AppServer({ children }: { children: React.ReactNode }) {
- return children
-} | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/server/load-components.ts | @@ -40,8 +40,6 @@ export type LoadComponentsReturnType = {
getStaticPaths?: GetStaticPaths
getServerSideProps?: GetServerSideProps
ComponentMod: any
- AppMod: any
- AppServerMod: any
isViewPath?: boolean
}
@@ -60,9 +58,6 @@ export async function loadDefaultErrorComponents(distDir: string) {
buildM... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/server/render.tsx | @@ -79,7 +79,6 @@ import {
continueFromInitialStream,
} from './node-web-streams-helper'
import { ImageConfigContext } from '../shared/lib/image-config-context'
-import { interopDefault } from '../lib/interop-default'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import { urlQueryToSearchParams } from '.... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | packages/next/taskfile.js | @@ -1858,13 +1858,6 @@ export async function pages_app(task, opts) {
.target('dist/pages')
}
-export async function pages_app_server(task, opts) {
- await task
- .source('pages/_app.server.tsx')
- .swc('client', { dev: opts.dev, keepImportAssertions: true })
- .target('dist/pages')
-}
-
export async ... | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | test/integration/react-streaming-and-server-components/switchable-runtime/pages/_app.js | @@ -1,6 +1,6 @@
export default function App({ Component, pageProps }) {
return (
- <div className="app-client-root">
+ <div className="app-client-root" data-title={Component.title || ''}>
<Component {...pageProps} />
</div>
) | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | test/integration/react-streaming-and-server-components/switchable-runtime/pages/_app.server.js | @@ -1,8 +0,0 @@
-export default function AppServer({ children }) {
- return (
- <div className="app-server-root" data-title={children.type.title || ''}>
- <style>{`.app-server-root { border: 2px solid blue; }`}</style>
- {children}
- </div>
- )
-} | true |
Other | vercel | next.js | d25e246b501aa58edd62c04b390fccacba99835b.json | Keep custom app as non server component (#37044)
We added custom _app as server component support in #33149, but we found it's pretty confusing on usage like support it both server component pages and regular pages at the same time for having similar layout purpose.
When using the _app.server and _app at the same time... | test/integration/react-streaming-and-server-components/test/switchable-runtime.test.js | @@ -28,43 +28,26 @@ function getOccurrence(text, matcher) {
function flight(context) {
describe('flight response', () => {
- it('should contain _app.server in flight response (node)', async () => {
+ it('should not contain _app.js in flight response (node)', async () => {
const html = await renderVia... | true |
Other | vercel | next.js | 760750d8516c5627bb0bd5c2f1618552dbd0388e.json | Add note clarifying pnpm args handling (#37049)
## Documentation / Examples
- [x] Make sure the linting passes by running `yarn lint`
x-ref: https://github.com/vercel/next.js/pull/37045
x-ref: https://github.com/vercel/next.js/pull/37032
x-ref: https://github.com/vercel/next.js/pull/36602
x-ref: https://github.com/v... | docs/getting-started.md | @@ -35,7 +35,7 @@ If you want to start with a TypeScript project you can use the `--typescript` fl
npx create-next-app@latest --typescript
# or
yarn create next-app --typescript
-# or
+# or (the extra '--' is expected and tells pnpm to pass the args down)
pnpm create next-app -- --typescript
```
| false |
Other | vercel | next.js | f3c31137e1c3c485c159a01f2241cf357ff98e2c.json | Fix interopDefault on jest object-proxy (#37002)
This fixes the interop default from https://github.com/vercel/next.js/pull/36877 on the jest `object-proxy` as it currently causes the below error when running tests in our `with-jest` example:
```sh
TypeError: 'get' on proxy: property '__esModule' is a read-only a... | packages/next/taskfile-swc.js | @@ -117,7 +117,7 @@ module.exports = function (task) {
if (output.map) {
if (interopClientDefaultExport) {
output.code += `
-if (typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) {
+if ((typeof exports.default === 'function' || (typeof... | true |
Other | vercel | next.js | f3c31137e1c3c485c159a01f2241cf357ff98e2c.json | Fix interopDefault on jest object-proxy (#37002)
This fixes the interop default from https://github.com/vercel/next.js/pull/36877 on the jest `object-proxy` as it currently causes the below error when running tests in our `with-jest` example:
```sh
TypeError: 'get' on proxy: property '__esModule' is a read-only a... | test/production/jest/index.test.ts | @@ -21,10 +21,12 @@ describe('next/jest', () => {
return <h1>Hello Dynamic</h1>;
}
`,
+ 'styles/index.module.css': '.home { color: orange }',
'pages/index.js': `
import dynamic from "next/dynamic";
import Image from "next/image";
import i... | true |
Other | vercel | next.js | 31a538d68ba92298d2b1964c7ac1bb779f908e6e.json | Update @types/node-fetch to latest (#36953)
Currently, if you try the following code while developing with Next.js inside Middleware:
```ts
const url = new URL(MY_URL)
const res = await fetch(url)
```
The app will work as expected, and so will the dom types for TS 4.5+. However when running `next build` or `tsc` typ... | packages/next/package.json | @@ -147,7 +147,7 @@
"@types/lodash.curry": "4.1.6",
"@types/lru-cache": "5.1.0",
"@types/micromatch": "4.0.2",
- "@types/node-fetch": "2.3.4",
+ "@types/node-fetch": "2.6.1",
"@types/path-to-regexp": "1.7.0",
"@types/react": "16.9.17",
"@types/react-dom": "16.9.4", | true |
Other | vercel | next.js | 31a538d68ba92298d2b1964c7ac1bb779f908e6e.json | Update @types/node-fetch to latest (#36953)
Currently, if you try the following code while developing with Next.js inside Middleware:
```ts
const url = new URL(MY_URL)
const res = await fetch(url)
```
The app will work as expected, and so will the dom types for TS 4.5+. However when running `next build` or `tsc` typ... | yarn.lock | @@ -5216,11 +5216,13 @@
dependencies:
"@types/node" "*"
-"@types/node-fetch@2.3.4":
- version "2.3.4"
- resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.3.4.tgz#a46fc4fe9f94b491bf551b6bb7f0f493b9bacd1a"
+"@types/node-fetch@2.6.1":
+ version "2.6.1"
+ resolved "https://registry.yarnp... | true |
Other | vercel | next.js | 7b83c19da50d0eaa942424a2fa5492e05cde488c.json | Support graceful shutdowns (#36909)
## 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... | docs/deployment.md | @@ -98,6 +98,29 @@ Next.js will automatically load the latest version of your application in the ba
**Note:** If a new page (with an old version) has already been prefetched by `next/link`, Next.js will use the old version. Navigating to a page that has _not_ been prefetched (and is not cached at the CDN level) will... | true |
Other | vercel | next.js | 7b83c19da50d0eaa942424a2fa5492e05cde488c.json | Support graceful shutdowns (#36909)
## 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... | packages/next/bin/next.ts | @@ -129,8 +129,11 @@ if (process.versions.pnp === '3') {
}
// Make sure commands gracefully respect termination signals (e.g. from Docker)
-process.on('SIGTERM', () => process.exit(0))
-process.on('SIGINT', () => process.exit(0))
+// Allow the graceful termination to be manually configurable
+if (!process.env.NEXT_... | true |
Other | vercel | next.js | b11d4411e04ec5db3194192355977ca14982700b.json | Add additional layer for server components case (#36921)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | packages/next/build/entries.ts | @@ -313,7 +313,10 @@ export function getViewsEntry(opts: {
viewsDir: string
pageExtensions: string[]
}) {
- return `next-view-loader?${stringify(opts)}!`
+ return {
+ import: `next-view-loader?${stringify(opts)}!`,
+ layer: 'sc_server',
+ }
}
export function getServerlessEntry(opts: { | true |
Other | vercel | next.js | b11d4411e04ec5db3194192355977ca14982700b.json | Add additional layer for server components case (#36921)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | packages/next/build/webpack/loaders/next-view-loader.ts | @@ -119,6 +119,8 @@ const nextViewLoader: webpack.LoaderDefinitionFunction<{
export const components = {
${componentsCode.join(',\n')}
};
+
+ export const __next_view_webpack_require__ = __webpack_require__
`
return result
} | true |
Other | vercel | next.js | b11d4411e04ec5db3194192355977ca14982700b.json | Add additional layer for server components case (#36921)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | packages/next/server/load-components.ts | @@ -137,7 +137,8 @@ export async function loadComponents(
await requirePage(
normalizePagePath(pathname) + '.__sc_client__',
distDir,
- serverless
+ serverless,
+ rootEnabled
)
} catch (_) {
// This page might not be a server component page, so there is n... | true |
Other | vercel | next.js | b11d4411e04ec5db3194192355977ca14982700b.json | Add additional layer for server components case (#36921)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | packages/next/server/view-render.tsx | @@ -165,10 +165,11 @@ function createServerComponentRenderer(
) {
// We need to expose the `__webpack_require__` API globally for
// react-server-dom-webpack. This is a hack until we find a better way.
- if (ComponentMod.__next_rsc__) {
+ if (ComponentMod.__next_view_webpack_require__ || ComponentMod.__next_rs... | true |
Other | vercel | next.js | b11d4411e04ec5db3194192355977ca14982700b.json | Add additional layer for server components case (#36921)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | test/e2e/views-dir/index.test.ts | @@ -226,37 +226,47 @@ describe('views dir', () => {
expect(html).toContain('hello from root/shared-component-route')
})
- // TODO: implement
- it.skip('should serve client component', async () => {
- const html = await renderViaHTTP(next.url, '/client-component-route')
- expect(html).toCon... | true |
Other | vercel | next.js | 7edeca13d1b67cabafd50b575410b6a1bb43b518.json | Use SWC for middleware (#30209) | packages/next/build/webpack-config.ts | @@ -309,8 +309,9 @@ export default async function getBaseWebpackConfig(
)
loggedSwcDisabled = true
}
- const defaultLoaders = {
- babel: useSWCLoader
+
+ const getBabelOrSwcLoader = (isMiddleware: boolean) => {
+ return useSWCLoader
? {
loader: 'next-swc-loader',
option... | false |
Other | vercel | next.js | 79c25a4a87a9fc7de851a0516a17feeb3439a127.json | Upgrade styled-jsx for react 18 improvement (#30179)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | packages/next/package.json | @@ -104,7 +104,7 @@
"stream-browserify": "3.0.0",
"stream-http": "3.1.1",
"string_decoder": "1.3.0",
- "styled-jsx": "5.0.0-beta.2",
+ "styled-jsx": "5.0.0-beta.3",
"timers-browserify": "2.0.12",
"tty-browserify": "0.0.1",
"use-subscription": "1.5.1", | true |
Other | vercel | next.js | 79c25a4a87a9fc7de851a0516a17feeb3439a127.json | Upgrade styled-jsx for react 18 improvement (#30179)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | yarn.lock | @@ -18270,10 +18270,10 @@ styled-jsx-plugin-postcss@3.0.2:
postcss "^7.0.2"
postcss-load-plugins "^2.3.0"
-styled-jsx@5.0.0-beta.2:
- version "5.0.0-beta.2"
- resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.0.0-beta.2.tgz#a4696a0979b0efbea572cf9149e83bbd3085e600"
- integrity sha512-yDVSN... | true |
Other | vercel | next.js | 243175f049166e59f4c24534209f15d16161f24e.json | Add middlewareCount info to build optimized (#30185)
This adds info on number of `_middleware` routes being used.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature re... | packages/next/build/index.ts | @@ -1662,6 +1662,8 @@ export default async function build(
rewritesWithHasCount: combinedRewrites.filter((r: any) => !!r.has)
.length,
redirectsWithHasCount: redirects.filter((r: any) => !!r.has).length,
+ middlewareCount: pageKeys.filter((page) => MIDDLEWARE_ROUTE.test(page))
+ ... | true |
Other | vercel | next.js | 243175f049166e59f4c24534209f15d16161f24e.json | Add middlewareCount info to build optimized (#30185)
This adds info on number of `_middleware` routes being used.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature re... | packages/next/telemetry/events/build.ts | @@ -95,6 +95,7 @@ type EventBuildOptimized = {
headersWithHasCount: number
rewritesWithHasCount: number
redirectsWithHasCount: number
+ middlewareCount: number
}
export function eventBuildOptimize( | true |
Other | vercel | next.js | 243175f049166e59f4c24534209f15d16161f24e.json | Add middlewareCount info to build optimized (#30185)
This adds info on number of `_middleware` routes being used.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature re... | test/integration/telemetry/test/index.test.js | @@ -450,6 +450,7 @@ describe('Telemetry CLI', () => {
expect(event1).toMatch(/"headersCount": 1/)
expect(event1).toMatch(/"rewritesCount": 2/)
expect(event1).toMatch(/"redirectsCount": 1/)
+ expect(event1).toMatch(/"middlewareCount": 0/)
})
it('detects i18n and image configs for session start'... | true |
Other | vercel | next.js | 0f453c06e2fc1adac9ee0668cea2584b5ab7f91f.json | improve CI stability (#30171) | test/development/basic/hmr.test.ts | @@ -329,7 +329,7 @@ describe('basic HMR', () => {
expect(next.cliOutput.slice(start)).toContain(
'compiling /hmr/new-page...'
)
- expect(next.cliOutput.slice(start)).toContain('compiling /_error...')
+ expect(next.cliOutput).toContain('compiling /_error...')
} catch (er... | false |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | errors/beta-middleware.md | @@ -0,0 +1,13 @@
+# Beta Middleware Used
+
+#### Why This Error Occurred
+
+The middleware feature of Next.js is still in beta so this warning is shown to express that the feature is not yet covered by semver and can experience changes at any point.
+
+#### Possible Ways to Fix It
+
+No fix necessary.
+
+### Useful Lin... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | errors/manifest.json | @@ -4,6 +4,10 @@
"title": "Messages",
"heading": true,
"routes": [
+ {
+ "title": "beta-middleware",
+ "path": "/errors/beta-middleware.md"
+ },
{
"title": "custom-document-image-import",
"path": "/errors/custom-document-image-import.md... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/build/entries.ts | @@ -121,7 +121,7 @@ export function createEntrypoints(
const isLikeServerless = isTargetLikeServerless(target)
- if (page.match(MIDDLEWARE_ROUTE) && config.experimental.middleware) {
+ if (page.match(MIDDLEWARE_ROUTE)) {
const loaderOpts: MiddlewareLoaderOptions = {
absolutePagePath: page... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/build/index.ts | @@ -285,13 +285,6 @@ export default async function build(
)
const pageKeys = Object.keys(mappedPages)
const hasMiddleware = pageKeys.some((page) => MIDDLEWARE_ROUTE.test(page))
-
- if (hasMiddleware && !config.experimental.middleware) {
- console.warn(
- `Warning: detected _middleware pa... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/build/webpack-config.ts | @@ -946,7 +946,6 @@ export default async function getBaseWebpackConfig(
parallel: config.experimental.cpus,
swcMinify: config.experimental.swcMinify,
terserOptions,
- middlewareEnabled: config.experimental.middleware,
}).apply(compiler)
},
/... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js | @@ -49,20 +49,13 @@ function buildError(error, file) {
export class TerserPlugin {
constructor(options = {}) {
- const {
- cacheDir,
- terserOptions = {},
- parallel,
- swcMinify,
- middlewareEnabled,
- } = options
+ const { cacheDir, terserOptions = {}, parallel, swcMinify } = o... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/client/page-loader.ts | @@ -85,31 +85,27 @@ export default class PageLoader {
}
getMiddlewareList(): Promise<string[]> {
- if (process.env.__NEXT_HAS_MIDDLEWARE) {
- if (process.env.NODE_ENV === 'production') {
- return getMiddlewareManifest()
+ if (process.env.NODE_ENV === 'production') {
+ return getMiddleware... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/client/route-loader.ts | @@ -232,32 +232,27 @@ export function getClientBuildManifest(): Promise<ClientBuildManifest> {
markAssetError(new Error('Failed to load client build manifest'))
)
}
-let _getMiddlewareManifest = () => Promise.resolve([])
-if (process.env.__NEXT_HAS_MIDDLEWARE) {
- _getMiddlewareManifest = async () => {
- ... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/server/config-shared.ts | @@ -119,7 +119,6 @@ export type NextConfig = { [key: string]: any } & {
staticPageGenerationTimeout?: number
crossOrigin?: false | 'anonymous' | 'use-credentials'
experimental?: {
- middleware?: boolean
swcMinify?: boolean
swcLoader?: boolean
cpus?: number
@@ -204,7 +203,6 @@ export const def... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/server/dev/next-dev-server.ts | @@ -265,12 +265,10 @@ export default class DevServer extends Server {
routedPages.push(pageName)
}
- if (this.nextConfig.experimental.middleware) {
- this.middleware = getSortedRoutes(routedMiddleware).map((page) => ({
- match: getRouteMatcher(getMiddlewareRegex(page)),
... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/server/next-server.ts | @@ -281,7 +281,7 @@ export default class Server {
if (!dev) {
this.pagesManifest = require(pagesManifestPath)
- if (!this.minimalMode && this.nextConfig.experimental.middleware) {
+ if (!this.minimalMode) {
this.middlewareManifest = require(middlewareManifestPath)
}
}
@@ -56... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | packages/next/shared/lib/router/router.ts | @@ -35,13 +35,7 @@ import { searchParamsToUrlQuery } from './utils/querystring'
import resolveRewrites from './utils/resolve-rewrites'
import { getRouteMatcher } from './utils/route-matcher'
import { getRouteRegex } from './utils/route-regex'
-
-let getMiddlewareRegex: typeof import('./utils/get-middleware-regex').g... | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | test/integration/middleware-base-path/next.config.js | @@ -1,6 +1,3 @@
module.exports = {
basePath: '/root',
- experimental: {
- middleware: true,
- },
} | true |
Other | vercel | next.js | 67681fe097793a464e5e3184f6eefc38dbe24f2f.json | Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead. | test/integration/middleware-core/next.config.js | @@ -3,7 +3,4 @@ module.exports = {
locales: ['en', 'fr', 'nl'],
defaultLocale: 'en',
},
- experimental: {
- middleware: true,
- },
} | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.