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 | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/another.js | @@ -0,0 +1,33 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="another">another page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="router-locale">{router.locale}</p>
+... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/auto-export/index.js | @@ -0,0 +1,21 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="auto-export">auto-export page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="router-locale">{router.local... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/dynamic/[slug].js | @@ -0,0 +1,46 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="dynamic">dynamic page</p>
+ <p id="router-locale">{router.locale}</p>
+ <p id="router-default-locale">{router.defau... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/frank.js | @@ -0,0 +1,57 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="frank">frank page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="router-locale">{router.locale}</p>
+ ... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/gsp/fallback/[slug].js | @@ -0,0 +1,72 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ if (router.isFallback) return 'Loading...'
+
+ return (
+ <>
+ <p id="gsp">gsp page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p ... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/gsp/index.js | @@ -0,0 +1,32 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="gsp">gsp page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="router-locale">{router.locale}</p>
+ <p... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/gsp/no-fallback/[slug].js | @@ -0,0 +1,53 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ if (router.isFallback) return 'Loading...'
+
+ return (
+ <>
+ <p id="gsp">gsp page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p ... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/gssp/[slug].js | @@ -0,0 +1,38 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="gssp">gssp page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="router-locale">{router.locale}</p>
+ ... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/gssp/index.js | @@ -0,0 +1,33 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="gssp">gssp page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="router-locale">{router.locale}</p>
+ ... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/index.js | @@ -0,0 +1,61 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="index">index page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="router-locale">{router.locale}</p>
+ ... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/links.js | @@ -0,0 +1,55 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+ const { nextLocale } = router.query
+
+ return (
+ <>
+ <p id="links">links page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="r... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/locale-false.js | @@ -0,0 +1,54 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+ const { nextLocale } = router.query
+
+ return (
+ <>
+ <p id="links">links page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="r... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/not-found/blocking-fallback/[slug].js | @@ -0,0 +1,53 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="gsp">gsp page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="router-locale">{router.locale}</p>
+ <p... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/not-found/fallback/[slug].js | @@ -0,0 +1,55 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ if (router.isFallback) return 'Loading...'
+
+ return (
+ <>
+ <p id="gsp">gsp page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p ... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/pages/not-found/index.js | @@ -0,0 +1,37 @@
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+
+export default function Page(props) {
+ const router = useRouter()
+
+ return (
+ <>
+ <p id="gsp">gsp page</p>
+ <p id="props">{JSON.stringify(props)}</p>
+ <p id="router-locale">{router.locale}</p>
+ <p... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support-base-path/test/index.test.js | @@ -0,0 +1,211 @@
+import http from 'http'
+import fs from 'fs-extra'
+import { join } from 'path'
+import cheerio from 'cheerio'
+import { runTests, locales } from '../../i18n-support/test/shared'
+import {
+ nextBuild,
+ nextStart,
+ findPort,
+ killApp,
+ getPageFileFromPagesManifest,
+ fetchViaHTTP,
+ File,
... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support/next.config.js | @@ -1,5 +1,6 @@
module.exports = {
// target: 'experimental-serverless-trace',
+ // basePath: '/docs',
i18n: {
// localeDetection: false,
locales: ['nl-NL', 'nl-BE', 'nl', 'fr-BE', 'fr', 'en-US', 'en'], | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support/test/index.test.js | @@ -1,1944 +1,56 @@
-/* eslint-env jest */
-
import http from 'http'
-import url from 'url'
import fs from 'fs-extra'
-import cheerio from 'cheerio'
import { join } from 'path'
-import webdriver from 'next-webdriver'
-import escapeRegex from 'escape-string-regexp'
-import assert from 'assert'
+import cheerio from 'c... | true |
Other | vercel | next.js | 54b70425ab55d3dcd8fb15e08a45d099cfcbde10.json | Ensure i18n with basePath works properly (#19083) | test/integration/i18n-support/test/shared.js | @@ -0,0 +1,2063 @@
+/* eslint-env jest */
+
+import url from 'url'
+import fs from 'fs-extra'
+import cheerio from 'cheerio'
+import { join } from 'path'
+import webdriver from 'next-webdriver'
+import escapeRegex from 'escape-string-regexp'
+import assert from 'assert'
+import {
+ fetchViaHTTP,
+ renderViaHTTP,
+ w... | true |
Other | vercel | next.js | e6a6beb38d71a4b165a40ae211636baf6cfb5c27.json | fix(examples/with-firebase-cloud-messaging): replace deprecated method (#19080) | examples/with-firebase-cloud-messaging/utils/webPush.js | @@ -21,7 +21,7 @@ const firebaseCloudMessaging = {
}
const messaging = firebase.messaging()
- await messaging.requestPermission()
+ await Notification.requestPermission()
const token = await messaging.getToken()
localforage.setItem('fcm_token', token) | false |
Other | vercel | next.js | f226a376b139b7285ee1d1dbc1600f15eb4cf2c1.json | refactor: update example of storybook (#17936)
## Change
- Update package versions
- Replace @storybook/addons, @storybook/addon-actions to @storybook/addon-essentials
- Replace examples of button, the action function is legacy: https://storybook.js.org/docs/react/essentials/actions#advanced--legacy-usage | examples/with-storybook/.storybook/main.js | @@ -1,4 +1,4 @@
module.exports = {
stories: ['../stories/*.stories.@(ts|tsx|js|jsx|mdx)'],
- addons: ['@storybook/addon-actions', '@storybook/addon-links'],
+ addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
} | true |
Other | vercel | next.js | f226a376b139b7285ee1d1dbc1600f15eb4cf2c1.json | refactor: update example of storybook (#17936)
## Change
- Update package versions
- Replace @storybook/addons, @storybook/addon-actions to @storybook/addon-essentials
- Replace examples of button, the action function is legacy: https://storybook.js.org/docs/react/essentials/actions#advanced--legacy-usage | examples/with-storybook/package.json | @@ -16,10 +16,9 @@
},
"license": "MIT",
"devDependencies": {
- "@storybook/addon-actions": "6.0.5",
- "@storybook/addon-links": "6.0.5",
- "@storybook/addons": "6.0.5",
- "@storybook/react": "6.0.5",
+ "@storybook/addon-essentials": "6.0.26",
+ "@storybook/addon-links": "6.0.26",
+ "@story... | true |
Other | vercel | next.js | f226a376b139b7285ee1d1dbc1600f15eb4cf2c1.json | refactor: update example of storybook (#17936)
## Change
- Update package versions
- Replace @storybook/addons, @storybook/addon-actions to @storybook/addon-essentials
- Replace examples of button, the action function is legacy: https://storybook.js.org/docs/react/essentials/actions#advanced--legacy-usage | examples/with-storybook/stories/button.stories.js | @@ -1,17 +1,25 @@
import React from 'react'
-import { action } from '@storybook/addon-actions'
import { Button } from '@storybook/react/demo'
-export default { title: 'Button' }
+export default {
+ title: 'Button',
+ argTypes: { onClick: { action: 'clicked' } },
+}
-export const withText = () => (
- <Button on... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | packages/next/client/index.tsx | @@ -18,11 +18,7 @@ import * as envConfig from '../next-server/lib/runtime-config'
import type { NEXT_DATA } from '../next-server/lib/utils'
import { getURL, loadGetInitialProps, ST } from '../next-server/lib/utils'
import initHeadManager from './head-manager'
-import PageLoader, {
- INITIAL_CSS_LOAD_ERROR,
- loose... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | packages/next/client/page-loader.ts | @@ -1,44 +1,17 @@
import { ComponentType } from 'react'
import type { ClientSsgManifest } from '../build'
-import type { ClientBuildManifest } from '../build/webpack/plugins/build-manifest-plugin'
-import type { MittEmitter } from '../next-server/lib/mitt'
-import mitt from '../next-server/lib/mitt'
import {
addB... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | packages/next/client/request-idle-callback.ts | @@ -0,0 +1,33 @@
+type RequestIdleCallbackHandle = any
+type RequestIdleCallbackOptions = {
+ timeout: number
+}
+type RequestIdleCallbackDeadline = {
+ readonly didTimeout: boolean
+ timeRemaining: () => number
+}
+
+declare global {
+ interface Window {
+ requestIdleCallback: (
+ callback: (deadline: Requ... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | packages/next/client/route-loader.ts | @@ -0,0 +1,340 @@
+import { ComponentType } from 'react'
+import type { ClientBuildManifest } from '../build/webpack/plugins/build-manifest-plugin'
+import getAssetPathFromRoute from '../next-server/lib/router/utils/get-asset-path-from-route'
+import requestIdleCallback from './request-idle-callback'
+
+// 3.8s was arb... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | packages/next/client/use-intersection.tsx | @@ -1,4 +1,5 @@
import { useCallback, useEffect, useRef, useState } from 'react'
+import requestIdleCallback from './request-idle-callback'
type UseIntersectionObserverInit = Pick<IntersectionObserverInit, 'rootMargin'>
type UseIntersection = { disabled?: boolean } & UseIntersectionObserverInit
@@ -37,7 +38,7 @@ e... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | packages/next/next-server/lib/router/router.ts | @@ -8,6 +8,11 @@ import {
removePathTrailingSlash,
} from '../../../client/normalize-trailing-slash'
import { GoodPageCache, StyleSheetTuple } from '../../../client/page-loader'
+import {
+ getClientBuildManifest,
+ isAssetError,
+ markAssetError,
+} from '../../../client/route-loader'
import { denormalizePage... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | test/integration/basic/test/error-recovery.js | @@ -94,6 +94,9 @@ export default (context, renderViaHTTP) => {
aboutPage.replace('</div>', 'div')
+ // Ensure dev server has time to break:
+ await new Promise((resolve) => setTimeout(resolve, 2000))
+
browser = await webdriver(context.appPort, '/hmr/contact')
expect(await... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | test/integration/build-output/test/index.test.js | @@ -94,17 +94,17 @@ describe('Build Output', () => {
expect(parseFloat(indexSize) - 266).toBeLessThanOrEqual(0)
expect(indexSize.endsWith('B')).toBe(true)
- // should be no bigger than 60.8 kb
- expect(parseFloat(indexFirstLoad) - 61.4).toBeLessThanOrEqual(0)
+ // should be no bigger than... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | test/integration/css-client-nav/test/index.test.js | @@ -3,7 +3,6 @@
import cheerio from 'cheerio'
import { remove } from 'fs-extra'
import {
- check,
findPort,
killApp,
nextBuild,
@@ -87,32 +86,6 @@ describe('CSS Module client-side navigation in Production', () => {
)
expect(redColor).toMatchInlineSnapshot(`"rgb(0, 0, 255)"`)
- await ch... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | test/integration/css-fixtures/hydrate-without-deps/pages/client.js | @@ -0,0 +1,17 @@
+import { useEffect, useState } from 'react'
+import css from './index.module.css'
+
+export default function Home() {
+ const [state, setState] = useState('')
+ useEffect(() => {
+ setState('mounted')
+ }, [])
+ return (
+ <main>
+ <h1 id="red-title" className={css.headerRed}>
+ ... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | test/integration/css-fixtures/hydrate-without-deps/pages/index.js | @@ -1,5 +1,6 @@
import { useEffect, useState } from 'react'
import css from './index.module.css'
+import Link from 'next/link'
export default function Home() {
const [state, setState] = useState('')
@@ -12,6 +13,9 @@ export default function Home() {
Black
</h1>
<p>{state}</p>
+ <Link... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | test/integration/css-fixtures/hydrate-without-deps/pages/index.module.css | @@ -3,3 +3,7 @@
composes: colorRed from 'common.module.css';
color: #111;
}
+.headerRed {
+ font-size: 25px;
+ composes: colorRed from 'common.module.css';
+} | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | test/integration/css/test/index.test.js | @@ -1101,13 +1101,6 @@ describe('CSS Support', () => {
)
expect(titleColor).toBe('rgb(255, 0, 0)')
}
- async function checkCssPreloadCount(browser) {
- return Number(
- await browser.eval(
- `Object.keys(window.next.router.pageLoader.cssc).length`
- )
- ... | true |
Other | vercel | next.js | 0d5bf65feb006054a81c173ead5f1347fdd613dd.json | Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.
Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.
Summary of the changes:
- Eagerly evaluate... | test/integration/size-limit/test/index.test.js | @@ -100,7 +100,7 @@ describe('Production response size', () => {
)
// These numbers are without gzip compression!
- const delta = responseSizesBytes - 172 * 1024
+ const delta = responseSizesBytes - 173 * 1024
expect(delta).toBeLessThanOrEqual(1024) // don't increase size more than 1kb
expec... | true |
Other | vercel | next.js | d40d7d65623105bd5f028b1eb1bc5f0fbebfce01.json | fix(next): resolve absolute path to @babel/runtime (#18921)
**What's the problem this PR addresses?**
https://github.com/vercel/next.js/pull/18768 started to ncc `@babel/plugin-transform-runtime` which broke its Yarn PnP support since the version of `resolve` it uses can't be patched by Yarn.
Fixes https://github.co... | packages/next/build/babel/preset.ts | @@ -1,4 +1,6 @@
import { PluginItem } from 'next/dist/compiled/babel/core'
+import { dirname } from 'path'
+
const env = process.env.NODE_ENV
const isProduction = env === 'production'
const isDevelopment = env === 'development'
@@ -168,7 +170,9 @@ module.exports = (
helpers: true,
regenerator:... | true |
Other | vercel | next.js | d40d7d65623105bd5f028b1eb1bc5f0fbebfce01.json | fix(next): resolve absolute path to @babel/runtime (#18921)
**What's the problem this PR addresses?**
https://github.com/vercel/next.js/pull/18768 started to ncc `@babel/plugin-transform-runtime` which broke its Yarn PnP support since the version of `resolve` it uses can't be patched by Yarn.
Fixes https://github.co... | test/unit/next-babel.unit.test.js | @@ -64,8 +64,8 @@ describe('next/babel', () => {
expect(output).toMatch(`__jsx(${react}.Fragment`)
expect(output).toMatch(`__jsx("a",{href:"/"`)
- expect(babel(`const a = ()=><a href="/">home</a>`)).toMatchInlineSnapshot(
- `"\\"use strict\\";var _interopRequireDefault=require(\\"@babel/runt... | true |
Other | vercel | next.js | ae75c6a6402004e7548c3d113074386655b2b20d.json | Update chokidar to latest (#18995)
Updates to the latest version of `chokidar`
x-ref: https://github.com/vercel/next.js/issues/17416 | packages/next/package.json | @@ -74,7 +74,7 @@
"buffer": "5.6.0",
"caniuse-lite": "^1.0.30001113",
"chalk": "2.4.2",
- "chokidar": "3.4.2",
+ "chokidar": "3.4.3",
"crypto-browserify": "3.12.0",
"css-loader": "4.3.0",
"cssnano-simple": "1.2.1", | true |
Other | vercel | next.js | ae75c6a6402004e7548c3d113074386655b2b20d.json | Update chokidar to latest (#18995)
Updates to the latest version of `chokidar`
x-ref: https://github.com/vercel/next.js/issues/17416 | yarn.lock | @@ -4604,18 +4604,18 @@ child-process-promise@^2.1.3:
node-version "^1.0.0"
promise-polyfill "^6.0.1"
-chokidar@3.4.2:
- version "3.4.2"
- resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.2.tgz#38dc8e658dec3809741eb3ef7bb0a47fe424232d"
- integrity sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsb... | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -824,10 +824,15 @@ const nextServerlessLoader: loader.Loader = function () {
} else if (renderOpts.isRedirect && !_nextData) {
const redirect = {
destination: renderOpts.pageData.pageProps.__N_REDIRECT,
- statusCode: renderOpts.pageData.pageProps.__N_REDIRE... | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | packages/next/lib/load-custom-routes.ts | @@ -11,17 +11,20 @@ export type Rewrite = {
basePath?: false
}
-export type Redirect = Rewrite & {
- statusCode?: number
- permanent?: boolean
-}
-
export type Header = {
source: string
basePath?: false
headers: Array<{ key: string; value: string }>
}
+// internal type used for validation (not user... | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | packages/next/next-server/lib/router/router.ts | @@ -815,10 +815,15 @@ export default class Router implements BaseRouter {
// it's not
if (destination.startsWith('/')) {
const parsedHref = parseRelativeUrl(destination)
- this._resolveHref(parsedHref, pages)
+ this._resolveHref(parsedHref, pages, false)
if (p... | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | packages/next/next-server/server/next-server.ts | @@ -1271,8 +1271,14 @@ export default class Server {
const redirect = {
destination: pageData.pageProps.__N_REDIRECT,
statusCode: pageData.pageProps.__N_REDIRECT_STATUS,
+ basePath: pageData.pageProps.__N_REDIRECT_BASE_PATH,
}
const statusCode = getRedirectStatus(redirect)
... | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | packages/next/next-server/server/render.tsx | @@ -53,6 +53,7 @@ import optimizeAmp from './optimize-amp'
import {
allowedStatusCodes,
getRedirectStatus,
+ Redirect,
} from '../../lib/load-custom-routes'
function noRouter() {
@@ -290,18 +291,12 @@ const invalidKeysMsg = (methodName: string, invalidKeys: string[]) => {
)
}
-type Redirect = {
- per... | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | packages/next/types/index.d.ts | @@ -37,6 +37,18 @@ declare module 'react' {
}
}
+export type Redirect =
+ | {
+ statusCode: 301 | 302 | 303 | 307 | 308
+ destination: string
+ basePath?: false
+ }
+ | {
+ permanent: boolean
+ destination: string
+ basePath?: false
+ }
+
/**
* `Page` type, use it as a gui... | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | test/integration/gssp-redirect-base-path/next.config.js | @@ -0,0 +1,3 @@
+module.exports = {
+ basePath: '/docs',
+} | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | test/integration/gssp-redirect-base-path/pages/404.js | @@ -0,0 +1,3 @@
+export default function NotFound() {
+ return <p>oops not found</p>
+} | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | test/integration/gssp-redirect-base-path/pages/another.js | @@ -0,0 +1,3 @@
+export default function Another() {
+ return <p id="another">another Page</p>
+} | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | test/integration/gssp-redirect-base-path/pages/gsp-blog/[post].js | @@ -0,0 +1,76 @@
+import { useRouter } from 'next/router'
+
+export default function Post(props) {
+ const router = useRouter()
+
+ if (typeof window === 'undefined') {
+ if (router.query.post?.startsWith('redir')) {
+ console.log(router)
+ throw new Error('render should not occur for redirect')
+ }
+... | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | test/integration/gssp-redirect-base-path/pages/gssp-blog/[post].js | @@ -0,0 +1,63 @@
+import { useRouter } from 'next/router'
+
+export default function Post(props) {
+ const router = useRouter()
+
+ if (typeof window === 'undefined') {
+ if (router.query.post?.startsWith('redir')) {
+ console.log(router)
+ throw new Error('render should not occur for redirect')
+ }
+... | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | test/integration/gssp-redirect-base-path/pages/index.js | @@ -0,0 +1,7 @@
+export default function Index() {
+ if (typeof window !== 'undefined' && !window.initialHref) {
+ window.initialHref = window.location.href
+ }
+
+ return <p id="index">Index Page</p>
+} | true |
Other | vercel | next.js | 48acc479f3befb70de800392315831ed7defa4d8.json | Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly
Fixes: https://github.com/v... | test/integration/gssp-redirect-base-path/test/index.test.js | @@ -0,0 +1,575 @@
+/* eslint-env jest */
+import http from 'http'
+import url from 'url'
+import fs from 'fs-extra'
+import webdriver from 'next-webdriver'
+import { join } from 'path'
+import {
+ findPort,
+ launchApp,
+ killApp,
+ nextBuild,
+ nextStart,
+ fetchViaHTTP,
+ check,
+ File,
+} from 'next-test-uti... | true |
Other | vercel | next.js | a2bea9b49293c33fd7f2f68baa103aa18c623ebe.json | Add mutation example to with-typescript-graphql (#16742)
Fixes https://github.com/vercel/next.js/issues/16550
Add a graphql mutation operation in this example.
The changes are:
1. Define mutation in schema `type-defs.graphqls`
2. Add mutation to `viewer.graphql ` that compiled to typescript code.
3. Add mutation res... | examples/with-typescript-graphql/lib/resolvers.ts | @@ -1,10 +1,23 @@
-import { QueryResolvers } from './type-defs.graphqls'
+import { QueryResolvers, MutationResolvers } from './type-defs.graphqls'
import { ResolverContext } from './apollo'
+const userProfile = {
+ id: String(1),
+ name: 'John Smith',
+ status: 'cached',
+}
+
const Query: Required<QueryResolvers... | true |
Other | vercel | next.js | a2bea9b49293c33fd7f2f68baa103aa18c623ebe.json | Add mutation example to with-typescript-graphql (#16742)
Fixes https://github.com/vercel/next.js/issues/16550
Add a graphql mutation operation in this example.
The changes are:
1. Define mutation in schema `type-defs.graphqls`
2. Add mutation to `viewer.graphql ` that compiled to typescript code.
3. Add mutation res... | examples/with-typescript-graphql/lib/type-defs.graphqls | @@ -1,3 +1,7 @@
type Query {
viewer: User!
}
+
+type Mutation {
+ updateName(name: String!): User!
+} | true |
Other | vercel | next.js | a2bea9b49293c33fd7f2f68baa103aa18c623ebe.json | Add mutation example to with-typescript-graphql (#16742)
Fixes https://github.com/vercel/next.js/issues/16550
Add a graphql mutation operation in this example.
The changes are:
1. Define mutation in schema `type-defs.graphqls`
2. Add mutation to `viewer.graphql ` that compiled to typescript code.
3. Add mutation res... | examples/with-typescript-graphql/lib/viewer.graphql | @@ -6,3 +6,11 @@ query Viewer {
status
}
}
+
+mutation UpdateName($name: String!) {
+ updateName(name: $name) {
+ id
+ name
+ status
+ }
+} | true |
Other | vercel | next.js | a2bea9b49293c33fd7f2f68baa103aa18c623ebe.json | Add mutation example to with-typescript-graphql (#16742)
Fixes https://github.com/vercel/next.js/issues/16550
Add a graphql mutation operation in this example.
The changes are:
1. Define mutation in schema `type-defs.graphqls`
2. Add mutation to `viewer.graphql ` that compiled to typescript code.
3. Add mutation res... | examples/with-typescript-graphql/pages/index.tsx | @@ -1,17 +1,58 @@
import Link from 'next/link'
-import { useViewerQuery, ViewerDocument } from '../lib/viewer.graphql'
+import { useState } from 'react'
+import {
+ useViewerQuery,
+ useUpdateNameMutation,
+ ViewerDocument,
+} from '../lib/viewer.graphql'
import { initializeApollo } from '../lib/apollo'
const I... | true |
Other | vercel | next.js | a2bea9b49293c33fd7f2f68baa103aa18c623ebe.json | Add mutation example to with-typescript-graphql (#16742)
Fixes https://github.com/vercel/next.js/issues/16550
Add a graphql mutation operation in this example.
The changes are:
1. Define mutation in schema `type-defs.graphqls`
2. Add mutation to `viewer.graphql ` that compiled to typescript code.
3. Add mutation res... | examples/with-typescript-graphql/test/__snapshots__/index.test.tsx.snap | @@ -6,7 +6,7 @@ exports[`Index renders the html we want 1`] = `
Baa
and you're
Healthy
- go to the
+ . Go to the
<a
href="/about"
@@ -17,5 +17,17 @@ exports[`Index renders the html we want 1`] = `
</a>
page.
+ <div>
+ <input
+ onChange={[Function]}
+ placeholder="your... | true |
Other | vercel | next.js | b49717f8dbf530f2fe8a2af8c8c3f7a3ae1209d5.json | Allow scroll prevention on hash change (#31921)
* Allow scroll prevention on hash change
Currently, `scrollToHash` is performed on every hash change, even when this change is caused by `<Link scroll={false} {...props} />`.
This change prevents scrolling in this case and allows users to specify the desired scrollin... | packages/next/client/link.tsx | @@ -96,11 +96,6 @@ function linkClicked(
e.preventDefault()
- // avoid scroll for urls with anchor refs
- if (scroll == null && as.indexOf('#') >= 0) {
- scroll = false
- }
-
// replace state instead of push if prop is present
router[replace ? 'replace' : 'push'](href, as, {
shallow, | true |
Other | vercel | next.js | b49717f8dbf530f2fe8a2af8c8c3f7a3ae1209d5.json | Allow scroll prevention on hash change (#31921)
* Allow scroll prevention on hash change
Currently, `scrollToHash` is performed on every hash change, even when this change is caused by `<Link scroll={false} {...props} />`.
This change prevents scrolling in this case and allows users to specify the desired scrollin... | packages/next/shared/lib/router/router.ts | @@ -1009,7 +1009,7 @@ export default class Router implements BaseRouter {
performance.mark('routeChange')
}
- const { shallow = false } = options
+ const { shallow = false, scroll = true } = options
const routeProps = { shallow }
if (this._inFlightRoute) {
@@ -1045,8 +1045,13 @@ export d... | true |
Other | vercel | next.js | b49717f8dbf530f2fe8a2af8c8c3f7a3ae1209d5.json | Allow scroll prevention on hash change (#31921)
* Allow scroll prevention on hash change
Currently, `scrollToHash` is performed on every hash change, even when this change is caused by `<Link scroll={false} {...props} />`.
This change prevents scrolling in this case and allows users to specify the desired scrollin... | test/integration/client-navigation/pages/nav/hash-changes.js | @@ -27,6 +27,11 @@ const HashChanges = ({ count }) => {
<Link href="#name-item-400">
<a id="scroll-to-name-item-400">Go to name item 400</a>
</Link>
+ <Link href="#name-item-400" scroll={false}>
+ <a id="scroll-to-name-item-400-no-scroll">
+ Go to name item 400 (no scroll)
+ ... | true |
Other | vercel | next.js | b49717f8dbf530f2fe8a2af8c8c3f7a3ae1209d5.json | Allow scroll prevention on hash change (#31921)
* Allow scroll prevention on hash change
Currently, `scrollToHash` is performed on every hash change, even when this change is caused by `<Link scroll={false} {...props} />`.
This change prevents scrolling in this case and allows users to specify the desired scrollin... | test/integration/client-navigation/test/index.test.js | @@ -625,6 +625,17 @@ describe('Client Navigation', () => {
}
})
+ it('should not scroll to hash when scroll={false} is set', async () => {
+ const browser = await webdriver(context.appPort, '/nav/hash-changes')
+ const curScroll = await browser.eval(
+ 'document.documentEle... | true |
Other | vercel | next.js | 5b47639747fd583ccfd83b8f140491707dd14184.json | fix(cna): add default version (#33006) | packages/create-next-app/create-app.ts | @@ -203,6 +203,7 @@ export async function createApp({
*/
const packageJson = {
name: appName,
+ version: '0.1.0',
private: true,
scripts: {
dev: 'next dev', | false |
Other | vercel | next.js | e0c7794208dbac6d84ad6723741f896527630f34.json | Add decoratorMetadata flag if enabled by tsconfig (#32914)
fixes #32913
Adds support for decorator metadata in SWC when enabled through ts/jsconfig.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [... | .eslintignore | @@ -26,6 +26,7 @@ packages/next-env/**/*.d.ts
packages/create-next-app/templates/**
test/integration/eslint/**
test/development/basic/legacy-decorators/**/*
+test/production/emit-decorator-metadata/**/*.js
test-timings.json
packages/next-swc/crates/**
bench/nested-deps/pages/** | true |
Other | vercel | next.js | e0c7794208dbac6d84ad6723741f896527630f34.json | Add decoratorMetadata flag if enabled by tsconfig (#32914)
fixes #32913
Adds support for decorator metadata in SWC when enabled through ts/jsconfig.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [... | packages/next/build/swc/options.js | @@ -21,6 +21,9 @@ export function getBaseSWCOptions({
const enableDecorators = Boolean(
jsConfig?.compilerOptions?.experimentalDecorators
)
+ const emitDecoratorMetadata = Boolean(
+ jsConfig?.compilerOptions?.emitDecoratorMetadata
+ )
return {
jsc: {
...(resolvedBaseUrl && paths
@@ -47,6... | true |
Other | vercel | next.js | e0c7794208dbac6d84ad6723741f896527630f34.json | Add decoratorMetadata flag if enabled by tsconfig (#32914)
fixes #32913
Adds support for decorator metadata in SWC when enabled through ts/jsconfig.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [... | test/production/emit-decorator-metadata/app/jsconfig.json | @@ -0,0 +1,6 @@
+{
+ "compilerOptions": {
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ }
+} | true |
Other | vercel | next.js | e0c7794208dbac6d84ad6723741f896527630f34.json | Add decoratorMetadata flag if enabled by tsconfig (#32914)
fixes #32913
Adds support for decorator metadata in SWC when enabled through ts/jsconfig.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [... | test/production/emit-decorator-metadata/app/pages/api/[[...params]].js | @@ -0,0 +1,14 @@
+import { createHandler, Get, Param } from '@storyofams/next-api-decorators'
+
+class HelloHandler {
+ @Get('/:myParam')
+ // This fails due to library looking for Reflect.getMetadata("design:paramtypes", ...).
+ // Design:paramtypes is never emitted due to missing SWC flag.
+ async get(@Param('myP... | true |
Other | vercel | next.js | e0c7794208dbac6d84ad6723741f896527630f34.json | Add decoratorMetadata flag if enabled by tsconfig (#32914)
fixes #32913
Adds support for decorator metadata in SWC when enabled through ts/jsconfig.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [... | test/production/emit-decorator-metadata/app/pages/index.js | @@ -0,0 +1,26 @@
+import React from 'react'
+import 'reflect-metadata'
+import { container, singleton } from 'tsyringe'
+
+@singleton()
+class HelloService {
+ getHello() {
+ return 'Hello, world!'
+ }
+}
+
+const helloService = container.resolve(HelloService)
+
+export default function Home() {
+ const message =... | true |
Other | vercel | next.js | e0c7794208dbac6d84ad6723741f896527630f34.json | Add decoratorMetadata flag if enabled by tsconfig (#32914)
fixes #32913
Adds support for decorator metadata in SWC when enabled through ts/jsconfig.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [... | test/production/emit-decorator-metadata/index.test.ts | @@ -0,0 +1,47 @@
+import { join } from 'path'
+import webdriver from 'next-webdriver'
+import { createNext, FileRef } from 'e2e-utils'
+import { NextInstance } from 'test/lib/next-modes/base'
+import { BrowserInterface } from 'test/lib/browsers/base'
+import { fetchViaHTTP } from 'next-test-utils'
+
+describe('emitDeco... | true |
Other | vercel | next.js | 0fd2f3ba98c44bb05df61b51a163081eea1644c8.json | Add types to nextConfig in default template (#34029)
Enable editors to suggest properties for the config object. Also let TypeScript check for type errors in the configuration when using TypeScript
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com> | packages/create-next-app/templates/default/next.config.js | @@ -1,3 +1,6 @@
-module.exports = {
+/** @type {import('next').NextConfig} */
+const nextConfig = {
reactStrictMode: true,
}
+
+module.exports = nextConfig | false |
Other | vercel | next.js | 3055a82ede56db62ec42c1abc46e874221fbe01b.json | Add note about dns-prefetch as fallback (#30385)
## 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... | errors/google-font-preconnect.md | @@ -12,6 +12,9 @@ Add `rel="preconnect"` to the Google Font domain `<link>` tag:
<link rel="preconnect" href="https://fonts.gstatic.com" />
```
+Note: a **separate** link with `dns-prefetch` can be used as a fallback for browsers that don't support `preconnect` although this is not required.
+
### Useful Links
... | false |
Other | vercel | next.js | 7286bed4cfe53d9921580002ced57e030e4f98f2.json | Add JSDoc to config options (#32915)
* Add JSDoc to config options
* Add JSDoc for all non-experimental configurations
* Update packages/next/server/config-shared.ts
Co-authored-by: Steven <steven@ceriously.com>
* Add JSDoc for all non-experimental configurations
* Apply suggestions from code review
... | packages/next/server/config-shared.ts | @@ -43,13 +43,123 @@ export interface TypeScriptConfig {
tsconfigPath?: string
}
-export type NextConfig = { [key: string]: any } & {
+export interface WebpackConfigContext {
+ /** Next.js root directory */
+ dir: string
+ /** Indicates if the compilation will be done in development */
+ dev: boolean
+ /** I... | true |
Other | vercel | next.js | 7286bed4cfe53d9921580002ced57e030e4f98f2.json | Add JSDoc to config options (#32915)
* Add JSDoc to config options
* Add JSDoc for all non-experimental configurations
* Update packages/next/server/config-shared.ts
Co-authored-by: Steven <steven@ceriously.com>
* Add JSDoc for all non-experimental configurations
* Apply suggestions from code review
... | packages/next/server/image-config.ts | @@ -10,14 +10,34 @@ export type LoaderValue = typeof VALID_LOADERS[number]
type ImageFormat = 'image/avif' | 'image/webp'
+/**
+ * Image configurations
+ *
+ * @see [Image configuration options](https://nextjs.org/docs/api-reference/next/image#configuration-options)
+ */
export type ImageConfigComplete = {
+ /**... | true |
Other | vercel | next.js | 07d9c92124ca65310005b32962d35b14db41ba4d.json | fix(examples/with-docker): update env comments (#29972)
This fixes the comment about disabling telemetry. For now it doesn't disable telemetry for `next build` if you uncomment it.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `con... | examples/with-docker/Dockerfile | @@ -15,13 +15,21 @@ FROM node:16-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
+
+# Next.js collects completely anonymous telemetry data about general usage.
+# Learn more here: https://nextjs.org/telemetry
+# Uncomment the following line in case you want to disable teleme... | false |
Other | vercel | next.js | 97b5c0ae5ef912bf8d1c76a9a1fed3070ca2983f.json | Fix ambiguous flags in Dockerfile example (#33417)
* Fix ambiguous flags in Dockerfile example
At least with Docker xx this Dockerfile fails to both `adduser` and `addgroup` commands due to ambiguous flags. The error message for example for `addgroup` is:
```
#5 0.292 Option g is ambiguous (gecos, gid, group)
... | examples/with-docker/Dockerfile | @@ -23,8 +23,8 @@ WORKDIR /app
ENV NODE_ENV production
-RUN addgroup -g 1001 -S nodejs
-RUN adduser -S nextjs -u 1001
+RUN addgroup --system --gid 1001 nodejs
+RUN adduser --system --uid 1001 nextjs
# You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app... | false |
Other | vercel | next.js | 8aa3620a169f5c38beaf4a1b158c01bc3b5ba4c6.json | Babel & next-swc: Fix exporting page config with AsExpression (#32702)
fixes #20626
No changes needed in next-swc, see comments from @kdy1 below.
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com> | packages/next/build/babel/plugins/next-page-config.ts | @@ -144,10 +144,13 @@ export default function nextPageConfig({
continue
}
- if (!BabelTypes.isObjectExpression(declaration.init)) {
- const got = declaration.init
- ? declaration.init.type
- : 'undefi... | true |
Other | vercel | next.js | 8aa3620a169f5c38beaf4a1b158c01bc3b5ba4c6.json | Babel & next-swc: Fix exporting page config with AsExpression (#32702)
fixes #20626
No changes needed in next-swc, see comments from @kdy1 below.
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com> | test/production/typescript-basic/app/pages/page-config.tsx | @@ -0,0 +1,17 @@
+import Link from 'next/link'
+import { PageConfig } from 'next'
+
+export const config: PageConfig = {
+ unstable_runtimeJS: false,
+}
+
+export default function Page() {
+ return (
+ <>
+ <p>hello world</p>
+ <Link href="/another">
+ <a>to /another</a>
+ </Link>
+ </>
+ ... | true |
Other | vercel | next.js | 8aa3620a169f5c38beaf4a1b158c01bc3b5ba4c6.json | Babel & next-swc: Fix exporting page config with AsExpression (#32702)
fixes #20626
No changes needed in next-swc, see comments from @kdy1 below.
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com> | test/unit/babel-plugin-next-page-config.test.ts | @@ -0,0 +1,62 @@
+/* eslint-env jest */
+import { transformSync } from '@babel/core'
+
+const babel = (code) =>
+ transformSync(code, {
+ filename: 'page.tsx',
+ presets: ['@babel/preset-typescript'],
+ plugins: [require('next/dist/build/babel/plugins/next-page-config')],
+ babelrc: false,
+ configFile:... | true |
Other | vercel | next.js | 1aeb230839e5f2578936f6595969c7b608aa190b.json | Fix suffix ordering while streaming (#34011)
* Fix suffix ordering
* Don't start reading until after resolving
* More yak shaving | packages/next/server/render.tsx | @@ -1250,7 +1250,8 @@ export async function renderToHTML(
ReactDOMServer,
content,
suffix,
- serverComponentsInlinedTransformStream?.readable ?? null,
+ serverComponentsInlinedTransformStream?.readable ??
+ streamFromArray([]),
gener... | true |
Other | vercel | next.js | 1aeb230839e5f2578936f6595969c7b608aa190b.json | Fix suffix ordering while streaming (#34011)
* Fix suffix ordering
* Don't start reading until after resolving
* More yak shaving | test/integration/react-streaming-and-server-components/test/streaming.js | @@ -104,4 +104,11 @@ export default function (context) {
'count: 1'
)
})
+
+ it('should flush the suffix at the very end', async () => {
+ await fetchViaHTTP(context.appPort, '/').then(async (response) => {
+ const result = await resolveStreamResponse(response)
+ expect(result).toMatch(/<\/... | true |
Other | vercel | next.js | 1821bdea0b9792b062cf76613ebdbd04578904f2.json | Update azure config (#33999)
* Update azure config
* speed up checkout
* update config
* remove checkout path
* undo checkout change | azure-pipelines.yml | @@ -69,11 +69,9 @@ stages:
- stage: Test
dependsOn: Build
jobs:
- - job: test_ie11
+ - job: test_integration
pool:
vmImage: 'windows-2019'
- variables:
- BROWSER_NAME: internet explorer
steps:
- checkout: none
- task: NodeTool@0
@... | true |
Other | vercel | next.js | 1821bdea0b9792b062cf76613ebdbd04578904f2.json | Update azure config (#33999)
* Update azure config
* speed up checkout
* update config
* remove checkout path
* undo checkout change | test/jest-setup-after-env.ts | @@ -1,3 +1,3 @@
// A default max-timeout of 90 seconds is allowed
// per test we should aim to bring this down though
-jest.setTimeout(90 * 1000)
+jest.setTimeout((process.platform === 'win32' ? 180 : 90) * 1000) | true |
Other | vercel | next.js | a65e3612d0a2e16308f3d2a9d962bead435fa587.json | Ensure optional chaining in swc matches babel (#33995)
This ensures we always transpile optional chaining and nullish coalescing with swc the same as we do [with babel](https://github.com/vercel/next.js/blob/4812e229928dc01ae21ee0533685f6813694c136/packages/next/build/babel/preset.ts#L97-L98) since it can cause issues... | packages/next/build/swc/options.js | @@ -117,6 +117,13 @@ export function getJestSWCOptions({
// Targets the current version of Node.js
node: process.versions.node,
},
+ // we always transpile optional chaining and nullish coalescing
+ // since it can cause issues with webpack even if the node target
+ // supports t... | true |
Other | vercel | next.js | a65e3612d0a2e16308f3d2a9d962bead435fa587.json | Ensure optional chaining in swc matches babel (#33995)
This ensures we always transpile optional chaining and nullish coalescing with swc the same as we do [with babel](https://github.com/vercel/next.js/blob/4812e229928dc01ae21ee0533685f6813694c136/packages/next/build/babel/preset.ts#L97-L98) since it can cause issues... | test/integration/production/pages/about.js | @@ -1 +1,5 @@
+import info from '../info.json'
+
+console.log('info:', info?.something?.nested)
+
export default () => <div className="about-page">About Page</div> | true |
Other | vercel | next.js | 4812e229928dc01ae21ee0533685f6813694c136.json | docs: use function for components in general (#33990) | errors/next-script-for-ga.md | @@ -13,7 +13,7 @@ If you are using the [gtag.js](https://developers.google.com/analytics/devguides
```jsx
import Script from 'next/script'
-const Home = () => {
+function Home() {
return (
<div class="container">
<!-- Global site tag (gtag.js) - Google Analytics -->
@@ -44,7 +44,7 @@ If you are using... | true |
Other | vercel | next.js | 4812e229928dc01ae21ee0533685f6813694c136.json | docs: use function for components in general (#33990) | errors/no-sync-scripts.md | @@ -13,7 +13,7 @@ Use the Script component with the right loading strategy to defer loading of the
```jsx
import Script from 'next/script'
-const Home = () => {
+function Home() {
return (
<div class="container">
<Script src="https://third-party-script.js"></Script> | true |
Other | vercel | next.js | 834546a74fe0db9728cd7d85c264bb652209228e.json | Fix typo in new experimental Relay support docs (#33963)
## Documentation / Examples
- [x] Make sure the linting passes by running `yarn lint` | docs/advanced-features/compiler.md | @@ -105,7 +105,7 @@ module.exports = {
relay: {
// This should match relay.config.js
src: './',
- artifactDirectory: './__generated__'
+ artifactDirectory: './__generated__',
language: 'typescript',
},
}, | false |
Other | vercel | next.js | bc223d76e0e1962ba5904b52597c4b3a47184f11.json | Update deployment docs to fix oversized image. (#33934)
We made the images expand to fit the full width of the container, but the deploy button image shouldn't be that large. Also made some slight refactors here to improve on my past documentation changes. | docs/deployment.md | @@ -28,9 +28,9 @@ All JavaScript code inside `.next` has been **compiled** and browser bundles hav
## Managed Next.js with Vercel
-[Vercel](https://vercel.com/) is a frontend cloud platform from the creators of Next.js. It's the fastest way to deploy your managed Next.js application with zero configuration.
+[Verc... | false |
Other | vercel | next.js | 555ba605441152af1afbff44a70f21d082f94819.json | Run tsconfig paths resolver before PnP (#12104) | packages/next/build/webpack-config.ts | @@ -1014,7 +1014,7 @@ export default async function getBaseWebpackConfig(
}
if (jsConfig?.compilerOptions?.paths && resolvedBaseUrl) {
- webpackConfig.resolve?.plugins?.push(
+ webpackConfig.resolve?.plugins?.unshift(
new JsConfigPathsPlugin(jsConfig.compilerOptions.paths, resolvedBaseUrl)
)
... | false |
Other | vercel | next.js | 99eedc4b86b5ab1108bff9734d0fbce93bcd9158.json | Add quotes to static paths in fallback section (#12170) | docs/basic-features/data-fetching.md | @@ -313,7 +313,7 @@ function Post({ post }) {
export async function getStaticPaths() {
return {
// Only `/posts/1` and `/posts/2` are generated at build time
- paths: [{ params: { id: 1 } }, { params: { id: 2 } }],
+ paths: [{ params: { id: '1' } }, { params: { id: '2' } }],
// Enable statically gen... | false |
Other | vercel | next.js | f3e6545bf5e407262a3b1c062a8761c7da1631d6.json | Remove unnecessary export to make usage clearer. (#12167)
The method initializeStore is only being used locally by useStore.
By having this exported I initially thought the consumer would have to call this as setup globally and then call useStore as well for each consuming component.
Downloading the sample I saw i... | examples/with-mobx/store.js | @@ -38,7 +38,7 @@ class Store {
}
}
-export function initializeStore(initialData = null) {
+function initializeStore(initialData = null) {
const _store = store ?? new Store()
// If your page has Next.js data fetching methods that use a Mobx store, it will | false |
Other | vercel | next.js | f42055ccb0fa90e36e1efc15675314acd26d2304.json | Update snapshot in with-jest example (#12157) | examples/with-jest/__tests__/__snapshots__/snapshot.js.snap | @@ -8,7 +8,7 @@ exports[`renders homepage unchanged 1`] = `
<h1
className="title"
>
- Welcome to
+ Welcome to
<a
href="https://nextjs.org"
>
@@ -18,7 +18,7 @@ exports[`renders homepage unchanged 1`] = `
<p
className="description"
>
- Get started b... | false |
Other | vercel | next.js | 0c6ee2c7607402c4d10072e21e13a1bc72038336.json | Add userbase example (#12150)
* add userbase example
* update readme and add now.json with build.env
* update deploy button import path for testing
* update readme
* update readme with canary tree path for deploy button
* remove prepopulated test username + password
* Apply lint-fix
* add deployed... | .github/ISSUE_TEMPLATE/1.Bug_report.md | @@ -1,38 +1,38 @@
----
-name: Bug report
-about: Create a bug report for the Next.js core / examples
----
-
-# Bug report
-
-## Describe the bug
-
-A clear and concise description of what the bug is.
-
-## To Reproduce
-
-Steps to reproduce the behavior, please provide code snippets or a repository:
-
-1... | true |
Other | vercel | next.js | 0c6ee2c7607402c4d10072e21e13a1bc72038336.json | Add userbase example (#12150)
* add userbase example
* update readme and add now.json with build.env
* update deploy button import path for testing
* update readme
* update readme with canary tree path for deploy button
* remove prepopulated test username + password
* Apply lint-fix
* add deployed... | .github/ISSUE_TEMPLATE/2.Feature_request.md | @@ -1,22 +1,22 @@
----
-name: Feature request
-about: Create a feature request for the Next.js core
----
-
-# Feature request
-
-## Is your feature request related to a problem? Please describe.
-
-A clear and concise description of what you want and what your use case is.
-
-## Describe the solution you'd l... | true |
Other | vercel | next.js | 0c6ee2c7607402c4d10072e21e13a1bc72038336.json | Add userbase example (#12150)
* add userbase example
* update readme and add now.json with build.env
* update deploy button import path for testing
* update readme
* update readme with canary tree path for deploy button
* remove prepopulated test username + password
* Apply lint-fix
* add deployed... | examples/with-next-less/README.md | @@ -1,44 +1,44 @@
-# Example App with next-less
-
-This example demonstrates how to use the [next-less plugin](https://github.com/zeit/next-plugins/tree/master/packages/next-less).
-
-It includes patterns for with and without CSS Modules, with PostCSS and with additional webpack configurations on top of the next-le... | true |
Other | vercel | next.js | 0c6ee2c7607402c4d10072e21e13a1bc72038336.json | Add userbase example (#12150)
* add userbase example
* update readme and add now.json with build.env
* update deploy button import path for testing
* update readme
* update readme with canary tree path for deploy button
* remove prepopulated test username + password
* Apply lint-fix
* add deployed... | examples/with-next-less/next.config.js | @@ -1,17 +1,17 @@
-const withLess = require('@zeit/next-less')
-
-/* Without CSS Modules, with PostCSS */
-module.exports = withLess()
-
-/* With CSS Modules */
-// module.exports = withLess({ cssModules: true })
-
-/* With additional configuration on top of CSS Modules */
-/*
-module.exports = withLess({
- ... | true |
Other | vercel | next.js | 0c6ee2c7607402c4d10072e21e13a1bc72038336.json | Add userbase example (#12150)
* add userbase example
* update readme and add now.json with build.env
* update deploy button import path for testing
* update readme
* update readme with canary tree path for deploy button
* remove prepopulated test username + password
* Apply lint-fix
* add deployed... | examples/with-next-less/pages/_document.js | @@ -1,21 +1,21 @@
-/*
-In production the stylesheet is compiled to .next/static/style.css and served from /_next/static/style.css
-
-You have to include it into the page using either next/head or a custom _document.js, as is being done in this file.
-*/
-
-import Document, { Head, Main, NextScript } from 'next/do... | true |
Other | vercel | next.js | 0c6ee2c7607402c4d10072e21e13a1bc72038336.json | Add userbase example (#12150)
* add userbase example
* update readme and add now.json with build.env
* update deploy button import path for testing
* update readme
* update readme with canary tree path for deploy button
* remove prepopulated test username + password
* Apply lint-fix
* add deployed... | examples/with-next-less/pages/index.js | @@ -1,9 +1,9 @@
-// Without CSS Modules
-import '../style.less'
-export default () => <div className="example">Hello Less!</div>
-
-// With CSS Modules
-/*
-import style from '../style.less'
-export default () => <div className={style.example}>Hello Less!</div>
-*/
+// Without CSS Modules
+import '../style.les... | true |
Other | vercel | next.js | 0c6ee2c7607402c4d10072e21e13a1bc72038336.json | Add userbase example (#12150)
* add userbase example
* update readme and add now.json with build.env
* update deploy button import path for testing
* update readme
* update readme with canary tree path for deploy button
* remove prepopulated test username + password
* Apply lint-fix
* add deployed... | examples/with-userbase/.env.example | @@ -0,0 +1 @@
+USERBASE_APP_ID=<place-your-id-here>
\ No newline at end of file | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.