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 | 8287ed233d715cea9d52ea5fa44df297e448a875.json | Replace dotenv example (#13770)
This removes the `with-dotenv` example in favor of a README that directs users to the docs. | examples/with-dotenv/README.md | @@ -1,49 +1,6 @@
-# With Dotenv example
+# `dotenv` Example
-This example shows how to inline env vars.
+Next.js automatically supports Environment Variable loading as of Next.js 9.4.
+You can [read more about it in the blog post](https://nextjs.org/blog/next-9-4#new-environment-variables-support).
-## Deploy your ... | true |
Other | vercel | next.js | 8287ed233d715cea9d52ea5fa44df297e448a875.json | Replace dotenv example (#13770)
This removes the `with-dotenv` example in favor of a README that directs users to the docs. | examples/with-dotenv/next.config.js | @@ -1,7 +0,0 @@
-require('dotenv').config()
-module.exports = {
- env: {
- // Reference a variable that was defined in the .env file and make it available at Build Time
- TEST_VAR: process.env.TEST_VAR,
- },
-} | true |
Other | vercel | next.js | 8287ed233d715cea9d52ea5fa44df297e448a875.json | Replace dotenv example (#13770)
This removes the `with-dotenv` example in favor of a README that directs users to the docs. | examples/with-dotenv/package.json | @@ -1,16 +0,0 @@
-{
- "name": "with-dotenv",
- "version": "1.0.0",
- "scripts": {
- "dev": "next",
- "build": "next build",
- "start": "next start"
- },
- "dependencies": {
- "dotenv": "^8.2.0",
- "next": "latest",
- "react": "^16.7.0",
- "react-dom": "^16.7.0"
- },
- "license": "ISC"
-} | true |
Other | vercel | next.js | 8287ed233d715cea9d52ea5fa44df297e448a875.json | Replace dotenv example (#13770)
This removes the `with-dotenv` example in favor of a README that directs users to the docs. | examples/with-dotenv/pages/index.js | @@ -1,3 +0,0 @@
-export default function Home() {
- return <div>{process.env.TEST_VAR}</div>
-} | true |
Other | vercel | next.js | 7f58a2e49f7c4cc0c23e6c814eac2c9ce3ee7bd7.json | Add cookies and headers for request using in RSC (#31623)
* Passdown the request with richer information
* test: access request header as prop from gSSP | packages/next/build/webpack/loaders/next-middleware-ssr-loader/render.ts | @@ -2,6 +2,11 @@ import { NextRequest } from '../../../../server/web/spec-extension/request'
import { renderToHTML } from '../../../../server/web/render'
import RenderResult from '../../../../server/render-result'
+const createHeaders = (args?: any) => ({
+ ...args,
+ 'x-middleware-ssr': '1',
+})
+
export functi... | true |
Other | vercel | next.js | 7f58a2e49f7c4cc0c23e6c814eac2c9ce3ee7bd7.json | Add cookies and headers for request using in RSC (#31623)
* Passdown the request with richer information
* test: access request header as prop from gSSP | packages/next/client/index.tsx | @@ -688,13 +688,14 @@ if (process.env.__NEXT_RSC) {
}
RSCComponent = (props: any) => {
- const { asPath: cacheKey } = useRouter() as any
+ const cacheKey = useRouter().asPath
+ const { __flight_serialized__, __flight_fresh__ } = props
return (
<React.Suspense fallback={null}>
<RSCW... | true |
Other | vercel | next.js | 7f58a2e49f7c4cc0c23e6c814eac2c9ce3ee7bd7.json | Add cookies and headers for request using in RSC (#31623)
* Passdown the request with richer information
* test: access request header as prop from gSSP | packages/next/server/render.tsx | @@ -1002,7 +1002,7 @@ export async function renderToHTML(
if (renderServerComponentData) {
const stream: ReadableStream = renderToReadableStream(
- <OriginalComponent {...props} />,
+ <OriginalComponent {...props.pageProps} />,
serverComponentManifest
)
const reader = stream.getRead... | true |
Other | vercel | next.js | 7f58a2e49f7c4cc0c23e6c814eac2c9ce3ee7bd7.json | Add cookies and headers for request using in RSC (#31623)
* Passdown the request with richer information
* test: access request header as prop from gSSP | test/integration/react-streaming-and-server-components/app/pages/index.server.js | @@ -1,15 +1,29 @@
import Foo from '../components/foo.client'
const envVar = process.env.ENV_VAR_TEST
+const headerKey = 'x-next-test-client'
-export default function Index() {
+export default function Index({ header, router }) {
return (
<div>
- <h1>{`thisistheindexpage.server`}</h1>
- <div>{env... | true |
Other | vercel | next.js | 7f58a2e49f7c4cc0c23e6c814eac2c9ce3ee7bd7.json | Add cookies and headers for request using in RSC (#31623)
* Passdown the request with richer information
* test: access request header as prop from gSSP | test/integration/react-streaming-and-server-components/test/index.test.js | @@ -216,7 +216,11 @@ runSuite('document', 'prod', documentSuite)
async function runBasicTests(context, env) {
const isDev = env === 'dev'
it('should render the correct html', async () => {
- const homeHTML = await renderViaHTTP(context.appPort, '/')
+ const homeHTML = await renderViaHTTP(context.appPort, '... | true |
Other | vercel | next.js | d9712626036f7615677da89f2b51258d6a33e994.json | add test case (#31691)
fixes #30567 | test/integration/scss-fixtures/external-url/pages/_app.js | @@ -0,0 +1,12 @@
+import React from 'react'
+import App from 'next/app'
+import '../styles/global.scss'
+
+class MyApp extends App {
+ render() {
+ const { Component, pageProps } = this.props
+ return <Component {...pageProps} />
+ }
+}
+
+export default MyApp | true |
Other | vercel | next.js | d9712626036f7615677da89f2b51258d6a33e994.json | add test case (#31691)
fixes #30567 | test/integration/scss-fixtures/external-url/pages/index.js | @@ -0,0 +1,3 @@
+export default function Home() {
+ return <div className="red-text">This text should be red.</div>
+} | true |
Other | vercel | next.js | d9712626036f7615677da89f2b51258d6a33e994.json | add test case (#31691)
fixes #30567 | test/integration/scss-fixtures/external-url/styles/global.scss | @@ -0,0 +1,9 @@
+$var: red;
+.red-text {
+ color: $var;
+ font-family: 'Poppins';
+ font-style: normal;
+ font-weight: 400;
+}
+
+@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400&display=swap'); | true |
Other | vercel | next.js | d9712626036f7615677da89f2b51258d6a33e994.json | add test case (#31691)
fixes #30567 | test/integration/scss/test/index.test.js | @@ -780,6 +780,35 @@ describe('SCSS Support', () => {
})
})
+ describe('External imports', () => {
+ const appDir = join(fixturesDir, 'external-url')
+
+ beforeAll(async () => {
+ await remove(join(appDir, '.next'))
+ })
+
+ it('should compile successfully', async () => {
+ const { code... | true |
Other | vercel | next.js | c2e73ead7f6b309d6f568ebbb776145790809b0e.json | Enable require for swc_bundler (#31663)
## 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 implemen... | packages/next-swc/crates/napi/src/bundle/mod.rs | @@ -74,7 +74,7 @@ impl Task for BundleTask {
},
make_resolver(),
swc_bundler::Config {
- require: false,
+ require: true,
disable_inliner: false,
external_modules: builtins,
... | false |
Other | vercel | next.js | e212167fb9506919ffcc4ccb17cb8f3acb32d3c2.json | Fix musl build | .github/workflows/build_test_deploy.yml | @@ -907,7 +907,7 @@ jobs:
- name: 'Build'
if: ${{ steps.binary-cache.outputs.cache-hit != 'true' }}
run: |
- docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd)/packages/next:/build -w /build builder sh -c "npm i -g @napi-rs/cli@1.2.1 &... | false |
Other | vercel | next.js | f9d05fb1ecee4380566e4de29d8191b7eddd5c55.json | Fix labels for release sections | release.js | @@ -1,8 +1,8 @@
// section -> label
const sectionLabelMap = {
'Core Changes': 'type: next',
- 'Documentation Changes': 'type: documentation',
- 'Example Changes': 'type: example',
+ 'Documentation Changes': 'area: documentation',
+ 'Example Changes': 'area: examples',
}
const fallbackSection = 'Misc Change... | false |
Other | vercel | next.js | b69f3b79c5f9b9d10085b428c1942f1ff6b1324e.json | Fix prettier linting | docs/advanced-features/compiler.md | @@ -50,7 +50,7 @@ If you have feedback about `swcMinify`, please share it on the [feedback discuss
We're working to port `babel-plugin-styled-components` to the Next.js Compiler.
-First, update to the latest version of Next.js: `npm install next@latest`. Then, update your `next.config.js` file:
+First, update to ... | false |
Other | vercel | next.js | f52211bad39c2a29a7caba40bfeb89b600524b41.json | fix(middleware): consider localhost variations (#31603)
Since `localhost` is actually an alias for `127.0.0.1` that points to loopback, we should take that into consideration at `NextURL` when we handle local URLs.
The implementation is based on [is-localhost-url](https://github.com/Kikobeats/is-localhost-url); I add... | packages/next/server/web/next-url.ts | @@ -20,6 +20,9 @@ interface Options {
trailingSlash?: boolean
}
+const REGEX_LOCALHOST_HOSTNAME =
+ /(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|::1)/
+
export class NextURL extends URL {
private _basePath: string
private _locale?: {
@@ -33,11 +36,12 @@ export class NextURL exten... | true |
Other | vercel | next.js | f52211bad39c2a29a7caba40bfeb89b600524b41.json | fix(middleware): consider localhost variations (#31603)
Since `localhost` is actually an alias for `127.0.0.1` that points to loopback, we should take that into consideration at `NextURL` when we handle local URLs.
The implementation is based on [is-localhost-url](https://github.com/Kikobeats/is-localhost-url); I add... | test/unit/web-runtime/next-url.test.ts | @@ -119,3 +119,15 @@ it('parses and formats the default locale', () => {
expect(url.locale).toEqual('fr')
expect(url.toString()).toEqual('/root/fr/bar')
})
+
+it('consider 127.0.0.1 and variations as localhost', () => {
+ const httpUrl = new NextURL('http://localhost:3000/hello')
+ expect(new NextURL('http://1... | true |
Other | vercel | next.js | dab7b406185c3e571da71f393da274532cf19e0b.json | Add types for geo lat and long (#31624)
Fixes #31620
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md` | packages/next/server/web/spec-extension/request.ts | @@ -1,5 +1,6 @@
import type { I18NConfig } from '../../config-shared'
import type { IResult } from 'next/dist/compiled/ua-parser-js'
+import type { RequestData } from '../types'
import { NextURL } from '../next-url'
import { isBot } from '../../utils'
import { toNodeHeaders } from '../utils'
@@ -11,7 +12,7 @@ expo... | true |
Other | vercel | next.js | dab7b406185c3e571da71f393da274532cf19e0b.json | Add types for geo lat and long (#31624)
Fixes #31620
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md` | packages/next/server/web/types.ts | @@ -9,6 +9,8 @@ export interface RequestData {
city?: string
country?: string
region?: string
+ latitude?: string
+ longitude?: string
}
headers: NodeHeaders
ip?: string | true |
Other | vercel | next.js | ab712ef310df7926350b03e3fe4532a1d2d42747.json | Move root div to an app wrapper (#31596)
Extracted from #31223.
We need to move the root `<div id="__next">` wrapper to be rendered as part of the page content, rather than the`Document`, so that flush effects (like styles) are flushed before (or after) the div, rather than inside, where they would cause hydration mi... | packages/next/pages/_document.tsx | @@ -766,13 +766,10 @@ export function Main({
}: {
children?: (content: JSX.Element) => JSX.Element
}) {
- const { inAmpMode, docComponentsRendered, useMainContent } =
- useContext(HtmlContext)
+ const { docComponentsRendered, useMainContent } = useContext(HtmlContext)
const content = useMainContent(childre... | true |
Other | vercel | next.js | ab712ef310df7926350b03e3fe4532a1d2d42747.json | Move root div to an app wrapper (#31596)
Extracted from #31223.
We need to move the root `<div id="__next">` wrapper to be rendered as part of the page content, rather than the`Document`, so that flush effects (like styles) are flushed before (or after) the div, rather than inside, where they would cause hydration mi... | packages/next/server/render.tsx | @@ -1041,14 +1041,18 @@ export async function renderToHTML(
}
}
+ const Body = ({ children }: { children: JSX.Element }) => {
+ return inAmpMode ? children : <div id="__next">{children}</div>
+ }
+
const appWrappers: Array<(content: JSX.Element) => JSX.Element> = []
const getWrappedApp = (app: JSX.... | true |
Other | vercel | next.js | 1d9007307fe335fcf9d40401e6b402267917a044.json | Fix accessing router before ready for HMR ping (#31588)
* Fix accessing router before ready for HMR ping
* update test name
* lint-fix | packages/next/client/dev/amp-dev.js | @@ -94,4 +94,5 @@ connectHMR({
path: '/_next/webpack-hmr',
})
displayContent()
-initOnDemandEntries()
+
+initOnDemandEntries(data.page) | true |
Other | vercel | next.js | 1d9007307fe335fcf9d40401e6b402267917a044.json | Fix accessing router before ready for HMR ping (#31588)
* Fix accessing router before ready for HMR ping
* update test name
* lint-fix | packages/next/client/dev/on-demand-entries-client.js | @@ -1,10 +1,20 @@
import Router from 'next/router'
import { addMessageListener, sendMessage } from './error-overlay/websocket'
-export default async () => {
- setInterval(() => {
- sendMessage(JSON.stringify({ event: 'ping', page: Router.pathname }))
- }, 2500)
+export default async (page) => {
+ if (page) {
... | true |
Other | vercel | next.js | 1d9007307fe335fcf9d40401e6b402267917a044.json | Fix accessing router before ready for HMR ping (#31588)
* Fix accessing router before ready for HMR ping
* update test name
* lint-fix | test/.eslintrc.json | @@ -1,16 +0,0 @@
-{
- "extends": ["next"],
- "rules": {
- "import/no-anonymous-default-export": "off",
- "react/display-name": "off",
- "@next/next/no-img-element": "off",
- "jsx-a11y/alt-text": "off",
- "@next/next/no-css-tags": "off",
- "@next/next/no-page-custom-font": "off",
- "@next/next/no-... | true |
Other | vercel | next.js | 1d9007307fe335fcf9d40401e6b402267917a044.json | Fix accessing router before ready for HMR ping (#31588)
* Fix accessing router before ready for HMR ping
* update test name
* lint-fix | test/integration/dynamic-routing/test/index.test.js | @@ -28,6 +28,35 @@ const appDir = join(__dirname, '../')
const buildIdPath = join(appDir, '.next/BUILD_ID')
function runTests(dev) {
+ if (dev) {
+ it('should not have error after pinging WebSocket', async () => {
+ const browser = await webdriver(appPort, '/')
+ await browser.eval(`(function() {
+ ... | true |
Other | vercel | next.js | 1d9007307fe335fcf9d40401e6b402267917a044.json | Fix accessing router before ready for HMR ping (#31588)
* Fix accessing router before ready for HMR ping
* update test name
* lint-fix | test/lib/browsers/base.ts | @@ -78,6 +78,9 @@ export class BrowserInterface {
async log(): Promise<any[]> {
return []
}
+ async websocketFrames(): Promise<any[]> {
+ return []
+ }
async url(): Promise<string> {
return ''
} | true |
Other | vercel | next.js | 1d9007307fe335fcf9d40401e6b402267917a044.json | Fix accessing router before ready for HMR ping (#31588)
* Fix accessing router before ready for HMR ping
* update test name
* lint-fix | test/lib/browsers/playwright.ts | @@ -15,6 +15,7 @@ let page: Page
let browser: Browser
let context: BrowserContext
let pageLogs: Array<{ source: string; message: string }> = []
+let websocketFrames: Array<{ payload: string | Buffer }> = []
const tracePlaywright = process.env.TRACE_PLAYWRIGHT
@@ -71,6 +72,7 @@ class Playwright extends BrowserIn... | true |
Other | vercel | next.js | 5a3d558c9fdadd65d8ec17af1a4548beb25cde82.json | Fix HMR for middleware #30791 (#31548)
Fixes #30791
The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full... | packages/next/build/webpack-config.ts | @@ -957,6 +957,11 @@ export default async function getBaseWebpackConfig(
},
}
+ const nonUserCondition = {
+ include: /node_modules/,
+ exclude: babelIncludeRegexes,
+ }
+
let webpackConfig: webpack.Configuration = {
parallelism: Number(process.env.NEXT_WEBPACK_PARALLELISM) || undefined,
... | true |
Other | vercel | next.js | 5a3d558c9fdadd65d8ec17af1a4548beb25cde82.json | Fix HMR for middleware #30791 (#31548)
Fixes #30791
The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full... | test/integration/middleware/hmr/pages/_middleware.js | @@ -0,0 +1,9 @@
+import { NextResponse } from 'next/server'
+
+export function middleware() {
+ return NextResponse.next(null, {
+ headers: {
+ 'x-test-header': 'just a header',
+ },
+ })
+} | true |
Other | vercel | next.js | 5a3d558c9fdadd65d8ec17af1a4548beb25cde82.json | Fix HMR for middleware #30791 (#31548)
Fixes #30791
The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full... | test/integration/middleware/hmr/pages/about/_middleware.js | @@ -0,0 +1,5 @@
+import { NextResponse } from 'next/server'
+
+export function middleware() {
+ return NextResponse.rewrite('/about/a')
+} | true |
Other | vercel | next.js | 5a3d558c9fdadd65d8ec17af1a4548beb25cde82.json | Fix HMR for middleware #30791 (#31548)
Fixes #30791
The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full... | test/integration/middleware/hmr/pages/about/a.js | @@ -0,0 +1,7 @@
+export default function AboutA() {
+ return (
+ <div>
+ <h1>AboutA</h1>
+ </div>
+ )
+} | true |
Other | vercel | next.js | 5a3d558c9fdadd65d8ec17af1a4548beb25cde82.json | Fix HMR for middleware #30791 (#31548)
Fixes #30791
The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full... | test/integration/middleware/hmr/pages/about/b.js | @@ -0,0 +1,7 @@
+export default function AboutB() {
+ return (
+ <div>
+ <h1>AboutB</h1>
+ </div>
+ )
+} | true |
Other | vercel | next.js | 5a3d558c9fdadd65d8ec17af1a4548beb25cde82.json | Fix HMR for middleware #30791 (#31548)
Fixes #30791
The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full... | test/integration/middleware/hmr/pages/index.js | @@ -0,0 +1,7 @@
+export default function Home() {
+ return (
+ <div>
+ <h1>Home</h1>
+ </div>
+ )
+} | true |
Other | vercel | next.js | 5a3d558c9fdadd65d8ec17af1a4548beb25cde82.json | Fix HMR for middleware #30791 (#31548)
Fixes #30791
The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full... | test/integration/middleware/hmr/test/index.test.js | @@ -0,0 +1,70 @@
+/* eslint-env jest */
+
+import { join } from 'path'
+import fs from 'fs'
+import webdriver from 'next-webdriver'
+import {
+ fetchViaHTTP,
+ findPort,
+ killApp,
+ launchApp,
+ waitFor,
+} from 'next-test-utils'
+
+jest.setTimeout(1000 * 60 * 2)
+const context = {}
+context.appDir = join(__dirna... | true |
Other | vercel | next.js | 7b22bb559b2d91375bf44b2b3964c9b833c16c5e.json | Replace old static path by public | typo (#31573)
An issue in the path of the public directory
## Documentation / Examples
- [ ] Make sure the linting passes by running `yarn lint` | examples/with-firebase-cloud-messaging/README.md | @@ -14,7 +14,7 @@ yarn create next-app --example with-firebase-cloud-messaging with-firebase-cloud
## Set your send id
-set your `messagingSenderId` in `static/firebase-messaging-sw.js` and `utils/webPush.js`
+set your `messagingSenderId` in `public/firebase-messaging-sw.js` and `utils/webPush.js`
Deploy it to ... | false |
Other | vercel | next.js | 36d3198e3967ae048fa4029b3877c8b8fe7b3520.json | Fix unhandled rejection on route change in dev (#31554)
This ensures we properly catch the rejection on route change failure in development so the dev overlay doesn't flash with the unhandled rejection. A test case isn't able to be added for this specific scenario as the unhandled rejection is fired right before the p... | packages/next/client/route-loader.ts | @@ -376,34 +376,30 @@ export function createRouteLoader(assetPrefix: string): RouteLoader {
},
loadRoute(route: string, prefetch?: boolean) {
return withFuture<RouteLoaderEntry>(route, routes, () => {
- const routeFilesPromise = getFilesForRoute(assetPrefix, route)
- .then(({ scripts, c... | false |
Other | vercel | next.js | 0cf7061859c1a00979247a552423a1812f8e1081.json | Make missing `Document` components an error (#31505)
* Make missing document components an error
* Fix broken tests | packages/next/server/render.tsx | @@ -1298,27 +1298,25 @@ export async function renderToHTML(
documentHTML = ReactDOMServer.renderToStaticMarkup(document)
}
- if (process.env.NODE_ENV !== 'production') {
- const nonRenderedComponents = []
- const expectedDocComponents = ['Main', 'Head', 'NextScript', 'Html']
+ const nonRenderedCompone... | true |
Other | vercel | next.js | 0cf7061859c1a00979247a552423a1812f8e1081.json | Make missing `Document` components an error (#31505)
* Make missing document components an error
* Fix broken tests | test/integration/font-optimization/fixtures/with-google/pages/_document.js | @@ -1,6 +1,6 @@
import * as React from 'react'
/// @ts-ignore
-import Document, { Main, NextScript, Head } from 'next/document'
+import Document, { Main, NextScript, Head, Html } from 'next/document'
export default class MyDocument extends Document {
constructor(props) {
super(props)
@@ -12,7 +12,7 @@ export... | true |
Other | vercel | next.js | 0cf7061859c1a00979247a552423a1812f8e1081.json | Make missing `Document` components an error (#31505)
* Make missing document components an error
* Fix broken tests | test/integration/font-optimization/fixtures/with-typekit/pages/_document.js | @@ -1,6 +1,6 @@
import * as React from 'react'
/// @ts-ignore
-import Document, { Main, NextScript, Head } from 'next/document'
+import Document, { Main, NextScript, Head, Html } from 'next/document'
export default class MyDocument extends Document {
constructor(props) {
@@ -13,15 +13,15 @@ export default class... | true |
Other | vercel | next.js | 0cf7061859c1a00979247a552423a1812f8e1081.json | Make missing `Document` components an error (#31505)
* Make missing document components an error
* Fix broken tests | test/integration/script-loader/pages/_document.js | @@ -1,6 +1,6 @@
import * as React from 'react'
/// @ts-ignore
-import Document, { Main, NextScript, Head } from 'next/document'
+import Document, { Main, NextScript, Head, Html } from 'next/document'
export default class MyDocument extends Document {
constructor(props) {
@@ -13,7 +13,7 @@ export default class M... | true |
Other | vercel | next.js | af6e9e2d87145209a6b0c572123bc963071ae4a2.json | Add middleware examples to custom page extensions (#31545)
## Documentation / Examples
- [x] Make sure the linting passes by running `yarn lint` | docs/api-reference/next.config.js/custom-page-extensions.md | @@ -16,7 +16,7 @@ module.exports = {
> **Note**: The default value of `pageExtensions` is [`['tsx', 'ts', 'jsx', 'js']`](https://github.com/vercel/next.js/blob/f1dbc9260d48c7995f6c52f8fbcc65f08e627992/packages/next/server/config-shared.ts#L161).
-> **Note**: configuring `pageExtensions` also affects `_document.js`... | false |
Other | vercel | next.js | d87dc2b5a0b3fdbc0f6806a47be72bad59564bd0.json | Add detection for `Google-PageRenderer` bot (#31521)
- Fixes https://github.com/vercel/next.js/discussions/31482 | packages/next/server/utils.ts | @@ -16,7 +16,7 @@ export function cleanAmpPath(pathname: string): string {
}
export function isBot(userAgent: string): boolean {
- return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|q... | true |
Other | vercel | next.js | d87dc2b5a0b3fdbc0f6806a47be72bad59564bd0.json | Add detection for `Google-PageRenderer` bot (#31521)
- Fixes https://github.com/vercel/next.js/discussions/31482 | test/integration/react-18/test/index.test.js | @@ -185,6 +185,21 @@ describe('Concurrent mode', () => {
)
expect(res.headers.get('etag')).toBeDefined()
})
+
+ it('should not stream to google pagerender bot', async () => {
+ const res = await fetchViaHTTP(
+ context.appPort,
+ '/ssr',
+ {},
+ {
+ header... | true |
Other | vercel | next.js | b79591cdaf78e4bdebaa714d55e745419ad5d079.json | simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used. | bench/nested-deps/bench.mjs | @@ -110,7 +110,7 @@ function runNextCommandDev(argv, opts = {}) {
function handleStdout(data) {
const message = data.toString()
const bootupMarkers = {
- dev: /compiled successfully/i,
+ dev: /compiled .*successfully/i,
start: /started server/i,
}
if ( | true |
Other | vercel | next.js | b79591cdaf78e4bdebaa714d55e745419ad5d079.json | simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used. | packages/next/build/output/index.ts | @@ -139,12 +139,8 @@ buildStore.subscribe((state) => {
loading: false,
typeChecking: false,
partial:
- clientWasLoading && !serverWasLoading && !serverWebWasLoading
- ? 'client'
- : serverWasLoading && !clientWasLoading && !serverWebWasLoading
- ? 'server'
- : serverWebWa... | true |
Other | vercel | next.js | b79591cdaf78e4bdebaa714d55e745419ad5d079.json | simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used. | packages/next/build/output/store.ts | @@ -15,7 +15,7 @@ export type OutputState =
| {
loading: false
typeChecking: boolean
- partial: 'client' | 'server' | 'serverWeb' | undefined
+ partial: 'client and server' | undefined
modules: number
errors: string[] | null
warnings: strin... | true |
Other | vercel | next.js | b79591cdaf78e4bdebaa714d55e745419ad5d079.json | simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used. | packages/next/server/dev/on-demand-entry-handler.ts | @@ -259,13 +259,9 @@ export default function onDemandEntryHandler(
if (entriesChanged) {
reportTrigger(
- isApiRoute
- ? `${normalizedPage} (server only)`
- : isMiddleware
- ? `${normalizedPage} (middleware only)`
- : clientOnly
- ? `${no... | true |
Other | vercel | next.js | b79591cdaf78e4bdebaa714d55e745419ad5d079.json | simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used. | test/development/basic/hmr.test.ts | @@ -57,9 +57,11 @@ describe('basic HMR', () => {
expect(next.cliOutput.slice(start)).toContain('compiling...')
expect(next.cliOutput.slice(start)).toContain(
- 'compiling /hmr/contact...'
+ 'compiling /hmr/contact (client and server)...'
+ )
+ expect(next.... | true |
Other | vercel | next.js | b79591cdaf78e4bdebaa714d55e745419ad5d079.json | simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used. | test/integration/amphtml/test/index.test.js | @@ -519,7 +519,7 @@ describe('AMP Usage', () => {
})
it('should not contain missing files warning', async () => {
- expect(output).toContain('compiled successfully')
+ expect(output).toContain('compiled client and server successfully')
expect(output).toContain('compiling /only-amp')
... | true |
Other | vercel | next.js | b79591cdaf78e4bdebaa714d55e745419ad5d079.json | simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used. | test/integration/nullish-config/test/index.test.js | @@ -1,7 +1,7 @@
/* eslint-env jest */
import fs from 'fs-extra'
import { join } from 'path'
-import { launchApp, findPort, nextBuild } from 'next-test-utils'
+import { launchApp, findPort, nextBuild, killApp } from 'next-test-utils'
const appDir = join(__dirname, '..')
const nextConfig = join(appDir, 'next.confi... | true |
Other | vercel | next.js | b79591cdaf78e4bdebaa714d55e745419ad5d079.json | simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used. | test/lib/next-test-utils.js | @@ -240,7 +240,7 @@ export function runNextCommandDev(argv, stdOut, opts = {}) {
function handleStdout(data) {
const message = data.toString()
const bootupMarkers = {
- dev: /compiled successfully/i,
+ dev: /compiled .*successfully/i,
start: /started server/i,
}
i... | true |
Other | vercel | next.js | 47aad2fafd00bef23039445ca7353c10e4e31433.json | Add docs for the Rust Compiler (SWC). (#31467)
This clearly lists what transforms are supported, which are currently experimental, and what is still unsupported with a place to leave feedback and your existing Babel setup. | docs/advanced-features/rust-compiler.md | @@ -0,0 +1,139 @@
+---
+description: Learn about the Rust Compiler, built with SWC, which transforms and minifies your Next.js application.
+---
+
+# Rust Compiler
+
+<details open>
+ <summary><b>Version History</b></summary>
+
+| Version | Changes |
+| --------- ... | true |
Other | vercel | next.js | 47aad2fafd00bef23039445ca7353c10e4e31433.json | Add docs for the Rust Compiler (SWC). (#31467)
This clearly lists what transforms are supported, which are currently experimental, and what is still unsupported with a place to leave feedback and your existing Babel setup. | docs/manifest.json | @@ -128,6 +128,10 @@
{
"title": "Advanced Features",
"routes": [
+ {
+ "title": "Rust Compiler",
+ "path": "/docs/advanced-features/rust-compiler.md"
+ },
{
"title": "Preview Mode",
"path": "/docs/a... | true |
Other | vercel | next.js | 9a73db703f672f6fb995deb37411b5aee6bb9f4b.json | Fix: Build time error for with-mysql example #19635 (#19636) | examples/with-mysql/pages/api/get-entry.ts | @@ -7,7 +7,7 @@ const handler: NextApiHandler = async (req, res) => {
if (!id) {
return res.status(400).json({ message: '`id` required' })
}
- if (typeof parseInt(id) !== 'number') {
+ if (typeof parseInt(id.toString()) !== 'number') {
return res.status(400).json({ message: '`id` must be a... | false |
Other | vercel | next.js | 1a3adaa5d93730ad9d5fbffbf368d1526007fc3e.json | Fix mini typo in with-cookie-auth-fauna-example (#20808)
Fix mini typo | examples/with-cookie-auth-fauna/pages/api/signup.js | @@ -1,7 +1,7 @@
import { query as q } from 'faunadb'
import { serverClient, serializeFaunaCookie } from '../../utils/fauna-auth'
-export default async function signuo(req, res) {
+export default async function signup(req, res) {
const { email, password } = await req.body
try { | false |
Other | vercel | next.js | 9afc0f58c4f3120a8e04b03d48973433f335324a.json | Add docs for custom image loaders. (#20788)
Docs for https://github.com/vercel/next.js/pull/20216/. | docs/api-reference/next/image.md | @@ -16,6 +16,7 @@ description: Enable Image Optimization with the built-in Image component.
| Version | Changes |
| --------- | ------------------------ |
+| `v10.0.5` | `loader` prop added. |
| `v10.0.1` | `layout` prop added. |
| `v10.0.0` | `next/image` introduced. |
@@ -111,6 +112... | true |
Other | vercel | next.js | 9afc0f58c4f3120a8e04b03d48973433f335324a.json | Add docs for custom image loaders. (#20788)
Docs for https://github.com/vercel/next.js/pull/20216/. | docs/basic-features/image-optimization.md | @@ -82,14 +82,16 @@ module.exports = {
}
```
-The following Image Optimization cloud providers are supported:
+The following Image Optimization cloud providers are included:
- [Vercel](https://vercel.com): Works automatically when you deploy on Vercel, no configuration necessary. [Learn more](https://vercel.com/... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/experimental-script.tsx | @@ -16,7 +16,7 @@ interface Props extends ScriptHTMLAttributes<HTMLScriptElement> {
preload?: boolean
}
-const loadScript = (props: Props) => {
+const loadScript = (props: Props): void => {
const {
src = '',
onLoad = () => {},
@@ -83,7 +83,7 @@ const loadScript = (props: Props) => {
document.body.... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/head-manager.ts | @@ -40,7 +40,7 @@ function reactElementToDOM({ type, props }: JSX.Element): HTMLElement {
return el
}
-function updateElements(type: string, components: JSX.Element[]) {
+function updateElements(type: string, components: JSX.Element[]): void {
const headEl = document.getElementsByTagName('head')[0]
const he... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/link.tsx | @@ -62,7 +62,7 @@ function prefetch(
prefetched[href + '%' + as + (curLocale ? '%' + curLocale : '')] = true
}
-function isModifiedEvent(event: React.MouseEvent) {
+function isModifiedEvent(event: React.MouseEvent): boolean {
const { target } = event.currentTarget as HTMLAnchorElement
return (
(target ... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/page-loader.ts | @@ -13,7 +13,7 @@ import createRouteLoader, {
RouteLoader,
} from './route-loader'
-function normalizeRoute(route: string) {
+function normalizeRoute(route: string): string {
if (route[0] !== '/') {
throw new Error(`Route name should start with a "/", got "${route}"`)
}
@@ -83,13 +83,14 @@ export defau... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/performance-relayer.ts | @@ -12,7 +12,7 @@ const initialHref = location.href
let isRegistered = false
let userReportHandler: ReportHandler | undefined
-function onReport(metric: Metric) {
+function onReport(metric: Metric): void {
if (userReportHandler) {
userReportHandler(metric)
}
@@ -57,7 +57,7 @@ function onReport(metric: Me... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/request-idle-callback.ts | @@ -18,7 +18,9 @@ declare global {
const requestIdleCallback =
(typeof self !== 'undefined' && self.requestIdleCallback) ||
- function (cb: (deadline: RequestIdleCallbackDeadline) => void) {
+ function (
+ cb: (deadline: RequestIdleCallbackDeadline) => void
+ ): NodeJS.Timeout {
let start = Date.now()
... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/route-loader.ts | @@ -55,7 +55,7 @@ function withFuture<T>(
return Promise.resolve(entry)
}
let resolver: (entrypoint: T) => void
- const prom = new Promise<T>((resolve) => {
+ const prom: Promise<T> = new Promise<T>((resolve) => {
resolver = resolve
})
map.set(key, (entry = { resolve: resolver!, future: prom }))... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/router.ts | @@ -66,7 +66,7 @@ Object.defineProperty(singletonRouter, 'events', {
},
})
-urlPropertyFields.forEach((field) => {
+urlPropertyFields.forEach((field: string) => {
// Here we need to use Object.defineProperty because, we need to return
// the property assigned to the actual router
// The value might get c... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/use-intersection.tsx | @@ -4,14 +4,19 @@ import requestIdleCallback from './request-idle-callback'
type UseIntersectionObserverInit = Pick<IntersectionObserverInit, 'rootMargin'>
type UseIntersection = { disabled?: boolean } & UseIntersectionObserverInit
type ObserveCallback = (isVisible: boolean) => void
+type Observer = {
+ id: string
... | true |
Other | vercel | next.js | 575fcf3fcf09c277a8d33df7dd5395cda6f18fde.json | refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7) | packages/next/client/with-router.tsx | @@ -17,7 +17,7 @@ export default function withRouter<
>(
ComposedComponent: NextComponentType<C, any, P>
): React.ComponentType<ExcludeRouterProps<P>> {
- function WithRouterWrapper(props: any) {
+ function WithRouterWrapper(props: any): JSX.Element {
return <ComposedComponent router={useRouter()} {...props... | true |
Other | vercel | next.js | 873bf5dd7603f9b25ec988b17dc41cdf8fdbead4.json | Remove an undefined parameter (#20762)
`getLoginSession` takes only one argument | examples/with-magic/pages/api/logout.js | @@ -4,7 +4,7 @@ import { getLoginSession } from '../../lib/auth'
export default async function logout(req, res) {
try {
- const session = await getLoginSession(req, false)
+ const session = await getLoginSession(req)
if (session) {
await magic.users.logoutByIssuer(session.issuer) | false |
Other | vercel | next.js | 73a2bd6a4be16e06ceb8e098489c36dec5296bb4.json | Add pr section to azure config (#20758)
Adds the `pr` section from https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#pr-triggers to filter paths that don't require test runs on PRs. | azure-pipelines.yml | @@ -6,10 +6,10 @@ trigger:
include:
- '*'
exclude:
- - bench/*
- - docs/*
- - errors/*
- - examples/*
+ - bench
+ - docs
+ - errors
+ - examples
# Do not run Azure on `canary`, `master`, or release tags. This unnecessarily
# increases the backlog, and the c... | false |
Other | vercel | next.js | 5678d24f56e84efe8f110ae58608aa4230e3b765.json | Add new example for rate limiting API routes. (#19509)
Adds an example using `lru-cache` to implement a simple rate limiter for API routes ([Serverless Functions](https://vercel.com/docs/serverless-functions/introduction)).
**Demo: https://nextjs-rate-limit.vercel.app/** | examples/api-routes-rate-limit/.gitignore | @@ -0,0 +1,34 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# next.js
+/.next/
+/out/
+
+# production
+/build
+
+# misc
+.DS_Store
+*.pem
+
+# debug
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+... | true |
Other | vercel | next.js | 5678d24f56e84efe8f110ae58608aa4230e3b765.json | Add new example for rate limiting API routes. (#19509)
Adds an example using `lru-cache` to implement a simple rate limiter for API routes ([Serverless Functions](https://vercel.com/docs/serverless-functions/introduction)).
**Demo: https://nextjs-rate-limit.vercel.app/** | examples/api-routes-rate-limit/README.md | @@ -0,0 +1,35 @@
+# API Routes Rate Limiting Example
+
+This example uses `lru-cache` to implement a simple rate limiter for API routes ([Serverless Functions](https://vercel.com/docs/serverless-functions/introduction)).
+
+**Demo: https://nextjs-rate-limit.vercel.app/**
+
+```bash
+curl http://localhost:3000/api/user ... | true |
Other | vercel | next.js | 5678d24f56e84efe8f110ae58608aa4230e3b765.json | Add new example for rate limiting API routes. (#19509)
Adds an example using `lru-cache` to implement a simple rate limiter for API routes ([Serverless Functions](https://vercel.com/docs/serverless-functions/introduction)).
**Demo: https://nextjs-rate-limit.vercel.app/** | examples/api-routes-rate-limit/package.json | @@ -0,0 +1,17 @@
+{
+ "name": "nextjs-rate-limit",
+ "version": "0.0.0",
+ "private": true,
+ "scripts": {
+ "dev": "next dev",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "lru-cache": "^6.0.0",
+ "next": "10.0.3",
+ "react": "17.0.1",
+ "react-dom": "17.0.1",
... | true |
Other | vercel | next.js | 5678d24f56e84efe8f110ae58608aa4230e3b765.json | Add new example for rate limiting API routes. (#19509)
Adds an example using `lru-cache` to implement a simple rate limiter for API routes ([Serverless Functions](https://vercel.com/docs/serverless-functions/introduction)).
**Demo: https://nextjs-rate-limit.vercel.app/** | examples/api-routes-rate-limit/pages/api/user.js | @@ -0,0 +1,16 @@
+import * as uuid from 'uuid'
+import rateLimit from '../../utils/rate-limit'
+
+const limiter = rateLimit({
+ interval: 60 * 1000, // 60 seconds
+ uniqueTokenPerInterval: 500, // Max 500 users per second
+})
+
+export default async function handler(req, res) {
+ try {
+ await limiter.check(res, ... | true |
Other | vercel | next.js | 5678d24f56e84efe8f110ae58608aa4230e3b765.json | Add new example for rate limiting API routes. (#19509)
Adds an example using `lru-cache` to implement a simple rate limiter for API routes ([Serverless Functions](https://vercel.com/docs/serverless-functions/introduction)).
**Demo: https://nextjs-rate-limit.vercel.app/** | examples/api-routes-rate-limit/pages/index.js | @@ -0,0 +1,52 @@
+import { useState } from 'react'
+import styles from '../styles.module.css'
+
+export default function Index() {
+ const [response, setResponse] = useState()
+
+ const makeRequest = async () => {
+ const res = await fetch('/api/user')
+
+ setResponse({
+ status: res.status,
+ body: a... | true |
Other | vercel | next.js | 5678d24f56e84efe8f110ae58608aa4230e3b765.json | Add new example for rate limiting API routes. (#19509)
Adds an example using `lru-cache` to implement a simple rate limiter for API routes ([Serverless Functions](https://vercel.com/docs/serverless-functions/introduction)).
**Demo: https://nextjs-rate-limit.vercel.app/** | examples/api-routes-rate-limit/styles.module.css | @@ -0,0 +1,67 @@
+.container {
+ padding: 4rem 1rem;
+ max-width: 50rem;
+ margin: 0 auto;
+ font-family: -apple-system, BlinkMacSystemFont, sans-serif;
+ text-rendering: optimizeLegibility;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.container h1 {
+ font-weight: 800;
+}... | true |
Other | vercel | next.js | 5678d24f56e84efe8f110ae58608aa4230e3b765.json | Add new example for rate limiting API routes. (#19509)
Adds an example using `lru-cache` to implement a simple rate limiter for API routes ([Serverless Functions](https://vercel.com/docs/serverless-functions/introduction)).
**Demo: https://nextjs-rate-limit.vercel.app/** | examples/api-routes-rate-limit/utils/rate-limit.js | @@ -0,0 +1,31 @@
+const LRU = require('lru-cache')
+
+const rateLimit = (options) => {
+ const tokenCache = new LRU({
+ max: parseInt(options.uniqueTokenPerInterval || 500, 10),
+ maxAge: parseInt(options.interval || 60000, 10),
+ })
+
+ return {
+ check: (res, limit, token) =>
+ new Promise((resolve, ... | true |
Other | vercel | next.js | 0d98f370aaa6873e40d301b73948b48d58219ce1.json | Clarify ctx.query type on getServerSideProps (#20327)
Closes https://github.com/vercel/next.js/issues/19481
The current text implies `query` is a string. IMO it would be better if it clarified that `query` is an object containing the query string's keys and values
Edit:
Relevant docs url: https://nextjs.org/docs/bas... | docs/basic-features/data-fetching.md | @@ -633,7 +633,7 @@ The `context` parameter is an object containing the following keys:
- `params`: If this page uses a dynamic route, `params` contains the route parameters. If the page name is `[id].js` , then `params` will look like `{ id: ... }`. To learn more, take a look at the [Dynamic Routing documentation](/d... | false |
Other | vercel | next.js | 104b8d47320160e1c39512ef1f79f9c41b1add8b.json | fix(next-mdx): resolve webpack loader (#17983)
**What's the problem this PR addresses?**
`@next/mdx` adds the webpack loader `@mdx-js/loader` without resolving it to an absolute path
Depends on https://github.com/vercel/next.js/pull/17606
**How did you fix it?**
`require.resolve` the webpack loader before adding i... | examples/with-mdx/package.json | @@ -8,6 +8,7 @@
},
"dependencies": {
"@mdx-js/loader": "^1.5.1",
+ "@mdx-js/react": "^1.6.18",
"@next/mdx": "^9.1.1",
"next": "latest",
"react": "^16.8.6", | true |
Other | vercel | next.js | 104b8d47320160e1c39512ef1f79f9c41b1add8b.json | fix(next-mdx): resolve webpack loader (#17983)
**What's the problem this PR addresses?**
`@next/mdx` adds the webpack loader `@mdx-js/loader` without resolving it to an absolute path
Depends on https://github.com/vercel/next.js/pull/17606
**How did you fix it?**
`require.resolve` the webpack loader before adding i... | packages/next-mdx/index.js | @@ -8,7 +8,7 @@ module.exports = (pluginOptions = {}) => (nextConfig = {}) => {
use: [
options.defaultLoaders.babel,
{
- loader: '@mdx-js/loader',
+ loader: require.resolve('@mdx-js/loader'),
options: pluginOptions.options,
},
], | true |
Other | vercel | next.js | 104b8d47320160e1c39512ef1f79f9c41b1add8b.json | fix(next-mdx): resolve webpack loader (#17983)
**What's the problem this PR addresses?**
`@next/mdx` adds the webpack loader `@mdx-js/loader` without resolving it to an absolute path
Depends on https://github.com/vercel/next.js/pull/17606
**How did you fix it?**
`require.resolve` the webpack loader before adding i... | packages/next-mdx/package.json | @@ -8,6 +8,7 @@
"directory": "packages/next-mdx"
},
"peerDependencies": {
- "@mdx-js/loader": ">=0.15.0"
+ "@mdx-js/loader": ">=0.15.0",
+ "@mdx-js/react": "*"
}
} | true |
Other | vercel | next.js | 104b8d47320160e1c39512ef1f79f9c41b1add8b.json | fix(next-mdx): resolve webpack loader (#17983)
**What's the problem this PR addresses?**
`@next/mdx` adds the webpack loader `@mdx-js/loader` without resolving it to an absolute path
Depends on https://github.com/vercel/next.js/pull/17606
**How did you fix it?**
`require.resolve` the webpack loader before adding i... | test-pnp.sh | @@ -1,6 +1,7 @@
declare -a testCases=(
"with-typescript"
"with-next-sass"
+ "with-mdx"
)
set -e | true |
Other | vercel | next.js | e848a9e504585819a076ed9b6712d4f9aef84952.json | fix(next): add missing peer dependencies for sass support (#17606) | .github/workflows/build_test_deploy.yml | @@ -115,20 +115,13 @@ jobs:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--unhandled-rejections=strict'
+ YARN_COMPRESSION_LEVEL: '0'
steps:
- uses: actions/checkout@v2
- run: yarn install --frozen-lockfile --check-files
- - run: |
- mkdir -p ./e2e-tests/next-pnp... | true |
Other | vercel | next.js | e848a9e504585819a076ed9b6712d4f9aef84952.json | fix(next): add missing peer dependencies for sass support (#17606) | packages/next/package.json | @@ -107,12 +107,26 @@
"webpack": "4.44.1",
"webpack-sources": "1.4.3"
},
+ "optionalDependencies": {
+ "sharp": "0.26.3"
+ },
"peerDependencies": {
"react": "^16.6.0 || ^17",
- "react-dom": "^16.6.0 || ^17"
+ "react-dom": "^16.6.0 || ^17",
+ "node-sass": "^4.0.0",
+ "sass": "^1.3.0... | true |
Other | vercel | next.js | e848a9e504585819a076ed9b6712d4f9aef84952.json | fix(next): add missing peer dependencies for sass support (#17606) | test-pnp.sh | @@ -0,0 +1,30 @@
+declare -a testCases=(
+ "with-typescript"
+ "with-next-sass"
+)
+
+set -e
+
+# Speeds up testing locally
+export CI=1
+
+rm -rf ./e2e-tests
+
+initialDir=$(pwd)
+
+for testCase in "${testCases[@]}"
+do
+ cd $initialDir
+
+ echo "--- Testing $testCase ---"
+ mkdir -p "./e2e-tests/$testCase"
+ cp... | true |
Other | vercel | next.js | 74166ea7e802f5b5fd1d74a5a3f097bcda11ea59.json | Remove outdated documentation (#20714)
Fixes #20487 | docs/api-reference/next.config.js/build-target.md | @@ -1,47 +0,0 @@
----
-description: Learn more about the build targets used by Next.js, which decide the way your application is built and run.
----
-
-# Build Target
-
-Next.js supports various build targets, each changing the way your application is built and run. We'll explain each of the targets below.
-
-## `serve... | true |
Other | vercel | next.js | 74166ea7e802f5b5fd1d74a5a3f097bcda11ea59.json | Remove outdated documentation (#20714)
Fixes #20487 | docs/api-reference/next.config.js/compression.md | @@ -4,7 +4,7 @@ description: Next.js provides gzip compression to compress rendered content and
# Compression
-Next.js provides [**gzip**](https://tools.ietf.org/html/rfc6713#section-3) compression to compress rendered content and static files. Compression only works with the [`server` target](/docs/api-reference/... | true |
Other | vercel | next.js | 74166ea7e802f5b5fd1d74a5a3f097bcda11ea59.json | Remove outdated documentation (#20714)
Fixes #20487 | docs/manifest.json | @@ -292,10 +292,6 @@
"title": "CDN Support with Asset Prefix",
"path": "/docs/api-reference/next.config.js/cdn-support-with-asset-prefix.md"
},
- {
- "title": "Build Target",
- "path": "/docs/api-reference/next.config.js/build-target.md"
- ... | true |
Other | vercel | next.js | 8795369a2d35a2746b881e3b8be0afaf3efad444.json | chore(client-image): add return types (#20686) | packages/next/client/image.tsx | @@ -109,7 +109,7 @@ type CallLoaderProps = {
quality?: number
}
-function callLoader(loaderProps: CallLoaderProps) {
+function callLoader(loaderProps: CallLoaderProps): string {
const load = loaders.get(configLoader)
if (load) {
return load({ root: configPath, ...loaderProps })
@@ -446,7 +446,7 @@ expo... | false |
Other | vercel | next.js | 58ea3bb47966ba7ae0f12a9267b54f79a5b4c9fc.json | fix(next/babel): read env from caller, not process (#20679)
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`).
This is tested by the two updated unit tests (which removed a workaround for this bug, and one now properly enables dev transforms)... | packages/next/build/babel/preset.ts | @@ -1,9 +1,8 @@
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'
-const isTest = env === 'test'
+
+const isLoadIntentTest = process.env.NODE_ENV === 'test'... | true |
Other | vercel | next.js | 58ea3bb47966ba7ae0f12a9267b54f79a5b4c9fc.json | fix(next/babel): read env from caller, not process (#20679)
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`).
This is tested by the two updated unit tests (which removed a workaround for this bug, and one now properly enables dev transforms)... | packages/next/build/webpack-config.ts | @@ -395,8 +395,6 @@ export default async function getBaseWebpackConfig(
: [require('pnp-webpack-plugin')],
}
- const webpackMode = dev ? 'development' : 'production'
-
const terserOptions: any = {
parse: {
ecma: 8,
@@ -947,7 +945,10 @@ export default async function getBaseWebpackConfig(
... | true |
Other | vercel | next.js | 58ea3bb47966ba7ae0f12a9267b54f79a5b4c9fc.json | fix(next/babel): read env from caller, not process (#20679)
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`).
This is tested by the two updated unit tests (which removed a workaround for this bug, and one now properly enables dev transforms)... | test/unit/next-babel-loader.unit.test.js | @@ -1,11 +1,4 @@
/* eslint-env jest */
-
-// avoid generating __source annotations in JSX during testing:
-const NODE_ENV = process.env.NODE_ENV
-process.env.NODE_ENV = 'production'
-require('next/dist/build/babel/preset')
-process.env.NODE_ENV = NODE_ENV
-
function interopRequireDefault(mod) {
return mod.default ... | true |
Other | vercel | next.js | 58ea3bb47966ba7ae0f12a9267b54f79a5b4c9fc.json | fix(next/babel): read env from caller, not process (#20679)
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`).
This is tested by the two updated unit tests (which removed a workaround for this bug, and one now properly enables dev transforms)... | test/unit/next-babel.unit.test.js | @@ -3,23 +3,18 @@ import { transform } from '@babel/core'
const trim = (s) => s.join('\n').trim().replace(/^\s+/gm, '')
-// avoid generating __source annotations in JSX during testing:
-const NODE_ENV = process.env.NODE_ENV
-process.env.NODE_ENV = 'production'
-const preset = require('next/dist/build/babel/preset'... | true |
Other | vercel | next.js | 984ac96dc63bc4556f4f4f9e00b225577a8fb005.json | chore: remove old traces of `next/data` experiment (#20678)
This PR removes some left over traces of the `next/data` experiment, as it has been superseded by RSC. | packages/next/build/babel/plugins/next-data.ts | @@ -1,65 +0,0 @@
-import {
- NodePath,
- PluginObj,
- types as BabelTypes,
-} from 'next/dist/compiled/babel/core'
-
-export default function ({
- types: t,
-}: {
- types: typeof BabelTypes
-}): PluginObj<any> {
- return {
- visitor: {
- ImportDeclaration(path: NodePath<BabelTypes.ImportDeclaration>, stat... | true |
Other | vercel | next.js | 984ac96dc63bc4556f4f4f9e00b225577a8fb005.json | chore: remove old traces of `next/data` experiment (#20678)
This PR removes some left over traces of the `next/data` experiment, as it has been superseded by RSC. | packages/next/build/webpack-config.ts | @@ -842,7 +842,6 @@ export default async function getBaseWebpackConfig(
'error-loader',
'next-babel-loader',
'next-client-pages-loader',
- 'next-data-loader',
'next-serverless-loader',
'noop-loader',
'next-plugin-loader', | true |
Other | vercel | next.js | 984ac96dc63bc4556f4f4f9e00b225577a8fb005.json | chore: remove old traces of `next/data` experiment (#20678)
This PR removes some left over traces of the `next/data` experiment, as it has been superseded by RSC. | packages/next/build/webpack/loaders/next-babel-loader.js | @@ -1,7 +1,6 @@
-import babelLoader from './babel-loader/src/index'
-import hash from 'next/dist/compiled/string-hash'
-import { basename, join } from 'path'
+import { join } from 'path'
import * as Log from '../../output/log'
+import babelLoader from './babel-loader/src/index'
// increment 'o' to invalidate cache
... | true |
Other | vercel | next.js | 984ac96dc63bc4556f4f4f9e00b225577a8fb005.json | chore: remove old traces of `next/data` experiment (#20678)
This PR removes some left over traces of the `next/data` experiment, as it has been superseded by RSC. | packages/next/build/webpack/loaders/next-data-loader.ts | @@ -1,15 +0,0 @@
-import { loader } from 'webpack'
-import hash from 'next/dist/compiled/string-hash'
-import { basename } from 'path'
-const nextDataLoader: loader.Loader = function () {
- const filename = this.resourcePath
- return `
- import {createHook} from 'next/data'
-
- export default createHook(undefined, ... | true |
Other | vercel | next.js | 7f5bc717120829580e5bb01788ec3dc4e220d71d.json | Update flakey relay analytics test (#39877)
Implements `check` on relay analytics test as the timing can be indeterminate.
Fixes: https://github.com/vercel/next.js/runs/7979410199?check_suite_focus=true#step:9:230 | test/integration/relay-analytics/test/index.test.js | @@ -117,9 +117,15 @@ function runTest() {
)
// INP metric is only reported on pagehide or visibilitychange event, so refresh the page
await browser.refresh()
- const INP = parseInt(await browser.eval('localStorage.getItem("INP")'), 10)
- // We introduced a delay of 100ms, so INP duration should be ... | false |
Other | vercel | next.js | 8dfab19d6ede702925340e048649450176d349c9.json | fix(#39807): ignore width/height from webpack with "fill" (#39849)
Fixes #39807.
When statically importing an image, the `width` and `height` will always be provided alongside the `src` by the Webpack. `next/image` will ignore `width` and `height` come from Webpack when `layout === 'fill'`, while `next/future/image... | packages/next/client/future/image.tsx | @@ -591,8 +591,11 @@ export default function Image({
blurDataURL = blurDataURL || staticImageData.blurDataURL
staticSrc = staticImageData.src
- height = height || staticImageData.height
- width = width || staticImageData.width
+ // Ignore width and height (come from the bundler) when "fill" is used... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.