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 | 49c99cc3236657109e473f4f8502d2806860dba2.json | Fix host segment replacing for custom routes (#29090)
This fixes segments inside of the host of the destination failing to parse with url.parse due to the unexpected colon by escaping the colon for segments and then unescaping them after we have parsed the URL.
## Bug
- [x] Related issues linked using `fixes #number... | test/integration/custom-routes/test/index.test.js | @@ -1028,6 +1028,30 @@ const runTests = (isDev = false) => {
})
})
+ it('should match has host redirect and insert in destination correctly', async () => {
+ const res1 = await fetchViaHTTP(appPort, '/has-redirect-6', undefined, {
+ redirect: 'manual',
+ })
+ expect(res1.status).toBe(404)
+
+ ... | true |
Other | vercel | next.js | 07fe406bd5c25e69f3c62dabf200c8488f97d7d2.json | Add crossOrigin type to the NextConfig (#29033) | packages/next/server/config-shared.ts | @@ -109,6 +109,7 @@ export type NextConfig = { [key: string]: any } & {
webpack5?: false
strictPostcssConfiguration?: boolean
}
+ crossOrigin?: string
experimental?: {
swcMinify?: boolean
swcLoader?: boolean | false |
Other | vercel | next.js | 41484f62ccaf47a4c9ecd38c17007f697b24be41.json | Throw error if res is accessed after gSSP returns (#29010)
* Throw error if res is accessed after gSSP returns
Currently it's possible to access the `ServerResponse` through `context.res`
in `getServerSideProps()`. If one was to store that response and mutate
its headers or status code after gSSP returns (e.g. du... | errors/gssp-no-mutating-res | @@ -0,0 +1,18 @@
+# Must not access ServerResponse after getServerSideProps() resolves
+
+#### Why This Error Occurred
+
+`getServerSideProps()` surfaces a `ServerResponse` object through the `res` property of its `context` arg. This object is not intended to be accessed or changed after `getServerSideProps()` resolves... | true |
Other | vercel | next.js | 41484f62ccaf47a4c9ecd38c17007f697b24be41.json | Throw error if res is accessed after gSSP returns (#29010)
* Throw error if res is accessed after gSSP returns
Currently it's possible to access the `ServerResponse` through `context.res`
in `getServerSideProps()`. If one was to store that response and mutate
its headers or status code after gSSP returns (e.g. du... | errors/manifest.json | @@ -139,6 +139,10 @@
"title": "gssp-mixed-not-found-redirect",
"path": "/errors/gssp-mixed-not-found-redirect.md"
},
+ {
+ "title": "gssp-no-mutating-res",
+ "path": "/errors/gssp-no-mutating-res.md"
+ },
{ "title": "head-build-id", "path": "/error... | true |
Other | vercel | next.js | 41484f62ccaf47a4c9ecd38c17007f697b24be41.json | Throw error if res is accessed after gSSP returns (#29010)
* Throw error if res is accessed after gSSP returns
Currently it's possible to access the `ServerResponse` through `context.res`
in `getServerSideProps()`. If one was to store that response and mutate
its headers or status code after gSSP returns (e.g. du... | packages/next/server/render.tsx | @@ -742,12 +742,28 @@ export async function renderToHTML(
if (getServerSideProps && !isFallback) {
let data: UnwrapPromise<ReturnType<GetServerSideProps>>
+ let canAccessRes = true
+ let resOrProxy = res
+ if (process.env.NODE_ENV !== 'production') {
+ resOrProxy = new Proxy<ServerResponse>(res,... | true |
Other | vercel | next.js | 41484f62ccaf47a4c9ecd38c17007f697b24be41.json | Throw error if res is accessed after gSSP returns (#29010)
* Throw error if res is accessed after gSSP returns
Currently it's possible to access the `ServerResponse` through `context.res`
in `getServerSideProps()`. If one was to store that response and mutate
its headers or status code after gSSP returns (e.g. du... | test/integration/getserversideprops/pages/promise/mutate-res-props.js | @@ -0,0 +1,20 @@
+export async function getServerSideProps(context) {
+ return {
+ props: (async function () {
+ // Mimic some async work, like getting data from an API
+ await new Promise((resolve) => setTimeout(resolve))
+ context.res.setHeader('test-header', 'this is a test header')
+ return ... | true |
Other | vercel | next.js | 41484f62ccaf47a4c9ecd38c17007f697b24be41.json | Throw error if res is accessed after gSSP returns (#29010)
* Throw error if res is accessed after gSSP returns
Currently it's possible to access the `ServerResponse` through `context.res`
in `getServerSideProps()`. If one was to store that response and mutate
its headers or status code after gSSP returns (e.g. du... | test/integration/getserversideprops/pages/promise/mutate-res.js | @@ -0,0 +1,22 @@
+let mutatedRes
+
+export async function getServerSideProps(context) {
+ mutatedRes = context.res
+ return {
+ props: (async function () {
+ return {
+ text: 'res',
+ }
+ })(),
+ }
+}
+
+export default ({ text }) => {
+ mutatedRes.setHeader('test-header', 'this is a test head... | true |
Other | vercel | next.js | 41484f62ccaf47a4c9ecd38c17007f697b24be41.json | Throw error if res is accessed after gSSP returns (#29010)
* Throw error if res is accessed after gSSP returns
Currently it's possible to access the `ServerResponse` through `context.res`
in `getServerSideProps()`. If one was to store that response and mutate
its headers or status code after gSSP returns (e.g. du... | test/integration/getserversideprops/test/index.test.js | @@ -141,6 +141,20 @@ const expectedManifestRoutes = () => [
),
page: '/promise',
},
+ {
+ dataRouteRegex: normalizeRegEx(
+ `^\\/_next\\/data\\/${escapeRegex(buildId)}\\/promise\\/mutate-res.json$`
+ ),
+ page: '/promise/mutate-res',
+ },
+ {
+ dataRouteRegex: normalizeRegEx(
+ `^\... | true |
Other | vercel | next.js | 16c3e6f613bfd4051a3bc6aed736fa145394cc0a.json | Fix minor typo in index.test.js (#29065)
Fix minor typo:
suits -> suites | test/integration/app-document/test/index.test.js | @@ -9,7 +9,7 @@ import {
killApp,
} from 'next-test-utils'
-// test suits
+// test suites
import rendering from './rendering'
import client from './client'
import csp from './csp' | false |
Other | vercel | next.js | 0a6ae5c3c299c63af808cc332b204f7e714c3e09.json | Remove extra macOS test workflow (#29064)
This is a follow-up to https://github.com/vercel/next.js/pull/29060 removing the `test_macos` workflow since it is redundant to run these tests in macOS as it should be very unlikely the tests fail in the mac environment but pass in the ubuntu environment. It also seems the sn... | .github/workflows/test_macos.yml | @@ -1,26 +0,0 @@
-on:
- push:
- branches: [canary]
- paths-ignore:
- - 'bench/**'
- - 'docs/**'
- - 'errors/**'
- - 'examples/**'
-
-name: Test macOS
-
-jobs:
- testMacOS:
- name: macOS (Basic, Production, Acceptance)
- runs-on: macos-latest
- env:
- NEXT_TELEMETRY_DISABLED: 1
... | false |
Other | vercel | next.js | 93bac0f2b710a0a5ea3d2aafb9d53e80d68df37d.json | Fix minor typo in no-img-element.md (#29027)
Fix minor typo:
image optimization -> Image Optimization | errors/no-img-element.md | @@ -2,7 +2,7 @@
### Why This Error Occurred
-An HTML `<img>` element was used to display an image. For better performance and automatic image optimization, use Next.js' built-in image component instead.
+An HTML `<img>` element was used to display an image. For better performance and automatic Image Optimization, ... | false |
Other | vercel | next.js | 0d0f34ba182010a881eb8ca9323f469dd3c938f7.json | Pass code as buffer to swc minify (#29009)
This should fix this: https://github.com/vercel/next.js/pull/28883/checks?check_run_id=3560578176#step:4:353
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
... | packages/next/build/swc/index.js | @@ -68,11 +68,11 @@ function toBuffer(t) {
}
export async function minify(src, opts) {
- return bindings.minify(src, toBuffer(opts ?? {}))
+ return bindings.minify(toBuffer(src), toBuffer(opts ?? {}))
}
export function minifySync(src, opts) {
- return bindings.minifySync(src, toBuffer(opts ?? {}))
+ return ... | false |
Other | vercel | next.js | c27e3a41dcf9590fb1c9ba9b9e16517cf4cb49b4.json | Update gSSP type to support props as a promise (#28999)
In a previous PR, `getServerSideProps` was altered to support returning
`props` as a promise. This change updates the TS types to permit promises
as well, so you can write type `GetServerSideProps<Props>` instead of
`GetServerSideProps<Promise<Props>>`. e.g.:
``... | packages/next/types/index.d.ts | @@ -160,7 +160,7 @@ export type GetServerSidePropsContext<
}
export type GetServerSidePropsResult<P> =
- | { props: P }
+ | { props: P | Promise<P> }
| { redirect: Redirect }
| { notFound: true }
| true |
Other | vercel | next.js | c27e3a41dcf9590fb1c9ba9b9e16517cf4cb49b4.json | Update gSSP type to support props as a promise (#28999)
In a previous PR, `getServerSideProps` was altered to support returning
`props` as a promise. This change updates the TS types to permit promises
as well, so you can write type `GetServerSideProps<Props>` instead of
`GetServerSideProps<Promise<Props>>`. e.g.:
``... | test/integration/typescript/pages/ssr/promise.tsx | @@ -0,0 +1,19 @@
+import { GetServerSideProps } from 'next'
+
+type Props = {
+ data: string
+}
+
+export const getServerSideProps: GetServerSideProps<Props> = async (
+ context
+) => {
+ return {
+ props: (async function () {
+ return { data: 'some data' }
+ })(),
+ }
+}
+
+export default function Page(... | true |
Other | vercel | next.js | 429f63dd76817f4a275a0caa73d3a0c90497c617.json | Fix Typo in "with-eslint" Example docs (#28601)
Earlier it was:
```bash
npx create-next-app --example with-eslint with-eslint
# or
yarn create next-app --example with-eslint with-eslint
```
It was confusing for me,
as i couldn't identify which one is *example-name* and which one is *folder-name* (for *with-eslint*)... | examples/with-eslint/README.md | @@ -21,9 +21,9 @@ Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the exa... | false |
Other | vercel | next.js | f71d3f2c091bc7828f120baf025c51d2f633b47b.json | Trim large test output to not exceed limit (#28881)
This ensures we trim test output that will exceed the amount that can be shown in GitHub actions so that we can still see which tests failed instead of un-helpful test logs. | run-tests.js | @@ -236,7 +236,24 @@ async function main() {
children.delete(child)
if (code) {
if (isFinalRun) {
- outputChunks.forEach((chunk) => process.stdout.write(chunk))
+ // limit out to last 64kb so that we don't
+ // run out of log room in CI
+ let trim... | false |
Other | vercel | next.js | 53c4daa55709564319a41d5b51fd99667b2cca70.json | Remove unused profiler (#28844) | packages/next/build/profiler/profiler.js | @@ -1,147 +0,0 @@
-import fs from 'fs'
-import path from 'path'
-
-let maybeInspector
-try {
- maybeInspector = require('inspector')
-} catch (e) {
- console.log('Unable to CPU profile in < node 8.0')
-}
-
-class Profiler {
- constructor(inspector) {
- this.session = undefined
- this.inspector = inspector
- }... | false |
Other | vercel | next.js | b02df3f487ba6fbd9ba9bcd823c77a7b5391fc73.json | improve splitChunks config for webpack 5 (#21208) | packages/next/build/webpack-config.ts | @@ -434,17 +434,11 @@ export default async function getBaseWebpackConfig(
cacheGroups: {
default: false,
vendors: false,
- // In webpack 5 vendors was renamed to defaultVendors
- defaultVendors: false,
},
},
prodGranular: {
chunks: 'all',
cacheGroups... | true |
Other | vercel | next.js | b02df3f487ba6fbd9ba9bcd823c77a7b5391fc73.json | improve splitChunks config for webpack 5 (#21208) | test/.stats-app/stats-config.js | @@ -135,5 +135,39 @@ module.exports = {
},
],
},
+ {
+ title: 'Webpack 5 Mode',
+ diff: 'onOutputChange',
+ renames,
+ configFiles: [
+ {
+ path: 'next.config.js',
+ content: `
+ module.exports = {
+ generateBuildId: () => 'BUI... | true |
Other | vercel | next.js | cf916f99061b3e72604bc4937a86a9c6b6274f35.json | Add useCreateIndex to mongoose connection options (#21145)
To prevent `DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.` | examples/with-mongodb-mongoose/utils/dbConnect.js | @@ -11,6 +11,7 @@ async function dbConnect() {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
+ useCreateIndex: true,
})
}
| false |
Other | vercel | next.js | 358d57dbae4408d687f9e1465933e0669197fdec.json | Fix tests for React 16 + Webpack 4/5 (#21146) | .github/workflows/build_test_deploy.yml | @@ -174,10 +174,7 @@ jobs:
- run: yarn install --check-files
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
- - run: yarn list webpack
- if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
-
- - run: xvfb-run node run-tests.js test/integration/{link-ref,pr... | false |
Other | vercel | next.js | e1184fb0607363f710f40de02130e95b6c58b563.json | Fix image cache for vector and animated images (#20480)
Fixes: https://github.com/vercel/next.js/issues/19100
> According to https://nextjs.org/docs/basic-features/image-optimization#caching Next.js populates a cache dir when using the new <Image /> component. This is not the case when using SVG files. This results in... | packages/next/next-server/server/image-optimizer.ts | @@ -218,17 +218,19 @@ export async function imageOptimizer(
}
}
+ const expireAt = maxAge * 1000 + now
+
if (upstreamType) {
const vector = VECTOR_TYPES.includes(upstreamType)
const animate =
ANIMATABLE_TYPES.includes(upstreamType) && isAnimated(upstreamBuffer)
if (vector || animate)... | true |
Other | vercel | next.js | e1184fb0607363f710f40de02130e95b6c58b563.json | Fix image cache for vector and animated images (#20480)
Fixes: https://github.com/vercel/next.js/issues/19100
> According to https://nextjs.org/docs/basic-features/image-optimization#caching Next.js populates a cache dir when using the new <Image /> component. This is not the case when using SVG files. This results in... | test/integration/image-optimizer/test/index.test.js | @@ -380,6 +380,44 @@ function runTests({ w, isDev, domains }) {
expect(json2).toStrictEqual(json1)
})
+ it('should use cached image file when parameters are the same for svg', async () => {
+ await fs.remove(imagesDir)
+
+ const query = { url: '/test.svg', w, q: 80 }
+ const opts = { headers: { acce... | true |
Other | vercel | next.js | 334ce64cd7419e3be53ff1b60f886e40060da8e9.json | Add missing word to Data Fetching docs (#21018)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | docs/basic-features/data-fetching.md | @@ -32,7 +32,7 @@ In the [Pages documentation](/docs/basic-features/pages.md), we’ve explained t
We’ll talk about the three unique Next.js functions you can use to fetch data for pre-rendering:
- [`getStaticProps`](#getstaticprops-static-generation) (Static Generation): Fetch data at **build time**.
-- [`getStaticP... | false |
Other | vercel | next.js | a6ff7bd66101f63bf641a1f4b0a59a070aa4d172.json | Update a link (#20999)
Update link from https://swr.now.sh to https://swr.vercel.app | docs/basic-features/data-fetching.md | @@ -791,7 +791,7 @@ This approach works well for user dashboard pages, for example. Because a dashbo
### SWR
-The team behind Next.js has created a React hook for data fetching called [**SWR**](https://swr.now.sh/). We highly recommend it if you’re fetching data on the client side. It handles caching, revalidation... | false |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | packages/next/build/webpack-config.ts | @@ -1208,6 +1208,7 @@ export default async function getBaseWebpackConfig(
assetPrefix: config.assetPrefix || '',
sassOptions: config.sassOptions,
productionBrowserSourceMaps: config.productionBrowserSourceMaps,
+ future: config.future,
})
let originalDevtool = webpackConfig.devtool
@@ -1330,7 ... | true |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | packages/next/build/webpack/config/blocks/css/index.ts | @@ -78,10 +78,7 @@ export const css = curry(async function css(
const postCssPlugins = await getPostCssPlugins(
ctx.rootDirectory,
ctx.isProduction,
- // TODO: In the future, we should stop supporting old CSS setups and
- // unconditionally inject ours. When that happens, we should remove this
- /... | true |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | packages/next/build/webpack/config/index.ts | @@ -1,4 +1,5 @@
import webpack from 'webpack'
+import { NextConfig } from '../../../next-server/server/config'
import { base } from './blocks/base'
import { css } from './blocks/css'
import { ConfigurationContext, pipe } from './utils'
@@ -13,6 +14,7 @@ export async function build(
assetPrefix,
sassOption... | true |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | packages/next/build/webpack/config/utils.ts | @@ -1,4 +1,5 @@
import webpack from 'webpack'
+import { NextConfig } from '../../../next-server/server/config'
export type ConfigurationContext = {
rootDirectory: string
@@ -14,6 +15,8 @@ export type ConfigurationContext = {
sassOptions: any
productionBrowserSourceMaps: boolean
+
+ future: NextConfig['f... | true |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | packages/next/next-server/server/config.ts | @@ -31,6 +31,11 @@ export type NextConfig = { [key: string]: any } & {
redirects?: () => Promise<Redirect[]>
trailingSlash?: boolean
+
+ future: {
+ strictPostcssConfiguration: boolean
+ excludeDefaultMomentLocales: boolean
+ }
}
const defaultConfig: NextConfig = {
@@ -83,6 +88,7 @@ const defaultCon... | true |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | test/integration/css-customization/test/index.test.js | @@ -108,6 +108,39 @@ describe('Legacy Next-CSS Customization', () => {
})
})
+describe('Custom CSS Customization via Webpack', () => {
+ const appDir = join(fixturesDir, 'custom-configuration-webpack')
+
+ beforeAll(async () => {
+ await remove(join(appDir, '.next'))
+ })
+
+ it('should compile successfull... | true |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | test/integration/css-fixtures/custom-configuration-webpack/next.config.js | @@ -0,0 +1,36 @@
+module.exports = {
+ onDemandEntries: {
+ maxInactiveAge: 1000 * 60 * 60,
+ },
+ webpack(config) {
+ modifyLoaderConfig(
+ config.module.rules,
+ [/(?<!\.module)\.css$/, /\.module\.css$/],
+ (rule) => {
+ if (!Array.isArray(rule.use)) return
+ rule.use.forEach((u)... | true |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | test/integration/css-fixtures/custom-configuration-webpack/pages/_app.js | @@ -0,0 +1,12 @@
+import React from 'react'
+import App from 'next/app'
+import '../styles/global.css'
+
+class MyApp extends App {
+ render() {
+ const { Component, pageProps } = this.props
+ return <Component {...pageProps} />
+ }
+}
+
+export default MyApp | true |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | test/integration/css-fixtures/custom-configuration-webpack/pages/index.js | @@ -0,0 +1,3 @@
+export default function Home() {
+ return <div />
+} | true |
Other | vercel | next.js | d0e28549af11064dfc09cacb346635f1ced06fb1.json | feat(css): add strictPostcssConfiguration flag (#20914)
This pull request adds `future.strictPostcssConfiguration`, allowing users to opt-into the more strict PostCSS configuration loading.
This stricter PostCSS configuration loading ensures that CSS can be cached across builds. | test/integration/css-fixtures/custom-configuration-webpack/styles/global.css | @@ -0,0 +1,11 @@
+/* this should pass through untransformed */
+@media (480px <= width < 768px) {
+ ::placeholder {
+ color: green;
+ }
+}
+
+/* this should be transformed to width/height */
+.video {
+ -xyz-max-size: 400px 300px;
+} | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/build/plugins/collect-plugins.ts | @@ -1,7 +1,6 @@
import findUp from 'next/dist/compiled/find-up'
import { promises } from 'fs'
import path from 'path'
-import resolve from 'next/dist/compiled/resolve/index.js'
import { execOnce } from '../../next-server/lib/utils'
const { version } = require('next/package.json')
@@ -213,10 +212,7 @@ async funct... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/build/webpack-config.ts | @@ -18,7 +18,6 @@ import {
import { fileExists } from '../lib/file-exists'
import { getPackageVersion } from '../lib/get-package-version'
import { Rewrite } from '../lib/load-custom-routes'
-import { resolveRequest } from '../lib/resolve-request'
import { getTypeScriptConfiguration } from '../lib/typescript/getType... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/build/webpack/config/blocks/css/plugins.ts | @@ -1,6 +1,5 @@
import chalk from 'chalk'
import { findConfig } from '../../../../../lib/find-config'
-import { resolveRequest } from '../../../../../lib/resolve-request'
import browserslist from 'browserslist'
type CssPluginCollection_Array = (string | [string, boolean | object])[]
@@ -57,7 +56,7 @@ async functi... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/compiled/resolve/LICENSE | @@ -1,18 +0,0 @@
-This software is released under the MIT license:
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, m... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/compiled/resolve/index.js | @@ -1 +0,0 @@
-module.exports=(()=>{var e={731:e=>{"use strict";var r=process.platform==="win32";var n=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var t=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;var i={};function win32SplitPath(e){var r=n.exec(e),i=(r[1]||"")+(r[2]||""),a=... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/compiled/resolve/package.json | @@ -1 +0,0 @@
-{"name":"resolve","main":"index.js","author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT"} | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/lib/get-package-version.ts | @@ -2,7 +2,6 @@ import { promises as fs } from 'fs'
import findUp from 'next/dist/compiled/find-up'
import JSON5 from 'next/dist/compiled/json5'
import * as path from 'path'
-import { resolveRequest } from './resolve-request'
type PackageJsonDependencies = {
dependencies: Record<string, string>
@@ -52,7 +51,9 ... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/lib/resolve-request.ts | @@ -1,18 +0,0 @@
-import resolve from 'next/dist/compiled/resolve/index.js'
-import path from 'path'
-
-export function resolveRequest(req: string, issuer: string): string {
- // The `resolve` package is prebuilt through ncc, which prevents
- // PnP from being able to inject itself into it. To circumvent
- // this, ... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/lib/typescript/hasNecessaryDependencies.ts | @@ -2,7 +2,6 @@ import chalk from 'chalk'
import path from 'path'
import { fileExists } from '../file-exists'
import { getOxfordCommaList } from '../oxford-comma-list'
-import { resolveRequest } from '../resolve-request'
import { FatalTypeScriptError } from './FatalTypeScriptError'
const requiredPackages = [
@@ ... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/package.json | @@ -172,7 +172,6 @@
"@types/react": "16.9.17",
"@types/react-dom": "16.9.4",
"@types/react-is": "16.7.1",
- "@types/resolve": "0.0.8",
"@types/semver": "7.3.1",
"@types/send": "0.14.4",
"@types/sharp": "0.26.0",
@@ -220,7 +219,6 @@
"postcss-preset-env": "6.7.0",
"postcss-scss"... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/taskfile.js | @@ -404,16 +404,6 @@ export async function ncc_recast(task, opts) {
.target('compiled/recast')
}
// eslint-disable-next-line camelcase
-// NB: Used by other dependencies, but Vercel version is a duplicate
-// version so can be inlined anyway (although may change in future)
-externals['resolve'] = 'next/dist/comp... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | packages/next/types/misc.d.ts | @@ -145,10 +145,6 @@ declare module 'next/dist/compiled/recast' {
import m from 'recast'
export = m
}
-declare module 'next/dist/compiled/resolve/index.js' {
- import m from 'resolve'
- export = m
-}
declare module 'next/dist/compiled/send' {
import m from 'send'
export = m | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | test-pnp.sh | @@ -1,7 +1,10 @@
declare -a testCases=(
"with-typescript"
"with-next-sass"
+ # Tests @next/mdx
"with-mdx"
+ # Tests babel config
+ "with-styled-components"
)
set -e
@@ -25,6 +28,7 @@ do
touch yarn.lock
yarn set version berry
yarn config set pnpFallbackMode none
+ yarn config set enableGlobalC... | true |
Other | vercel | next.js | 1c75bf789b49f32075e4820d2c5f0fd43fe75bb9.json | perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**
- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older n... | yarn.lock | @@ -2944,12 +2944,6 @@
"@types/prop-types" "*"
csstype "^2.2.0"
-"@types/resolve@0.0.8":
- version "0.0.8"
- resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194"
- dependencies:
- "@types/node" "*"
-
"@types/resolve@1.17.1":
version "1... | true |
Other | vercel | next.js | 920c22157ce54ef006c972bdb1abe8ff910cecac.json | Use archive link for electron-next in the examples (#20879)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl> | examples/with-electron-typescript/README.md | @@ -10,8 +10,6 @@ This example show how you can use Next.js inside an Electron application to avoi
For development it's going to run a HTTP server and let Next.js handle routing. In production it use `next export` to pre-generate HTML static files and use them in your app instead of running an HTTP server.
-**You ... | false |
Other | vercel | next.js | 4d282f929f4475299aba0b496ba99b6398fc9b1a.json | Add note on destructuring to Env Variables docs (#20869)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Tim Neutkens <timneutkens@me.com> | docs/basic-features/environment-variables.md | @@ -46,6 +46,11 @@ export async function getStaticProps() {
}
```
+> **Note**: In order to keep server-only secrets safe, Next.js replaces `process.env.*` with the correct values
+> at build time. This means that `process.env` is not a standard JavaScript object, so you’re not able to
+> use [object destructuring](... | false |
Other | vercel | next.js | 5e701daab9ed4fe0cfd7ae8aeacd7e3d9f314a04.json | Update license year for all packages
Fixes #20887 | license.md | @@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2020 Vercel, Inc.
+Copyright (c) 2021 Vercel, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal | true |
Other | vercel | next.js | 5e701daab9ed4fe0cfd7ae8aeacd7e3d9f314a04.json | Update license year for all packages
Fixes #20887 | packages/next-codemod/license.md | @@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2020 Vercel, Inc.
+Copyright (c) 2021 Vercel, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal | true |
Other | vercel | next.js | 5e701daab9ed4fe0cfd7ae8aeacd7e3d9f314a04.json | Update license year for all packages
Fixes #20887 | packages/next-mdx/license.md | @@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2020 Vercel, Inc.
+Copyright (c) 2021 Vercel, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal | true |
Other | vercel | next.js | 5e701daab9ed4fe0cfd7ae8aeacd7e3d9f314a04.json | Update license year for all packages
Fixes #20887 | packages/next/license.md | @@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2020 Vercel, Inc.
+Copyright (c) 2021 Vercel, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal | true |
Other | vercel | next.js | d9f1cf007ff55f2fc441bee505600aa504108006.json | Fix error in example (#20934) | examples/blog-starter-typescript/package.json | @@ -24,6 +24,8 @@
"@types/node": "^14.0.1",
"@types/react": "^16.9.35",
"@types/react-dom": "^16.9.8",
+ "autoprefixer": "^10.2.1",
+ "postcss": "^8.2.4",
"postcss-preset-env": "^6.7.0",
"tailwindcss": "^2.0.2"
}, | true |
Other | vercel | next.js | d9f1cf007ff55f2fc441bee505600aa504108006.json | Fix error in example (#20934) | examples/blog-starter/package.json | @@ -17,10 +17,10 @@
"remark-html": "13.0.1"
},
"devDependencies": {
- "autoprefixer": "10.0.4",
- "postcss": "8.1.10",
+ "autoprefixer": "^10.2.1",
+ "postcss": "^8.2.4",
"postcss-preset-env": "^6.7.0",
- "tailwindcss": "2.0.1"
+ "tailwindcss": "^2.0.2"
},
"license": "MIT"
} | true |
Other | vercel | next.js | bb05e42698a9ea74560ef20b51e2266eb85ba382.json | Fix typo in error markdown (#20825) | errors/gssp-component-member.md | @@ -1,4 +1,4 @@
-# getStaticProps/getServerProps can not be attached to the page component
+# getStaticProps/getServerSideProps can not be attached to the page component
#### Why This Error Occurred
| false |
Other | vercel | next.js | b580bea2502eb60822753e542e4864d5caab4fcb.json | tests: add `isReady` field test for TS (#20821) | test/integration/typescript/pages/hello.tsx | @@ -19,6 +19,7 @@ export default function HelloPage(): JSX.Element {
const router = useRouter()
console.log(process.browser)
console.log(router.pathname)
+ console.log(router.isReady)
return (
<div>
<p>One trillion dollars: {1_000_000_000_000}</p> | false |
Other | vercel | next.js | 817cffdcbe6149b78d52a43d6d28da3b0e4ab3dd.json | Use vercel.app for blog starter URL (#20820)
Rename https://next-blog-starter.now.sh to https://next-blog-starter.vercel.app (@lfades renamed the domain name) | docs/basic-features/data-fetching.md | @@ -10,7 +10,7 @@ description: 'Next.js has 2 pre-rendering modes: Static Generation and Server-si
<summary><b>Examples</b></summary>
<ul>
<li><a href="https://github.com/vercel/next.js/tree/canary/examples/cms-wordpress">WordPress Example</a> (<a href="https://next-blog-wordpress.now.sh">Demo</a>)</li>
- ... | true |
Other | vercel | next.js | 817cffdcbe6149b78d52a43d6d28da3b0e4ab3dd.json | Use vercel.app for blog starter URL (#20820)
Rename https://next-blog-starter.now.sh to https://next-blog-starter.vercel.app (@lfades renamed the domain name) | docs/basic-features/pages.md | @@ -49,7 +49,7 @@ You can also use **Client-side Rendering** along with Static Generation or Serve
<summary><b>Examples</b></summary>
<ul>
<li><a href="https://github.com/vercel/next.js/tree/canary/examples/cms-wordpress">WordPress Example</a> (<a href="https://next-blog-wordpress.now.sh">Demo</a>)</li>
- ... | true |
Other | vercel | next.js | 817cffdcbe6149b78d52a43d6d28da3b0e4ab3dd.json | Use vercel.app for blog starter URL (#20820)
Rename https://next-blog-starter.now.sh to https://next-blog-starter.vercel.app (@lfades renamed the domain name) | examples/blog-starter/README.md | @@ -8,7 +8,7 @@ To create the blog posts we use [`remark`](https://github.com/remarkjs/remark) a
## Demo
-[https://next-blog-starter.now.sh/](https://next-blog-starter.now.sh/)
+[https://next-blog-starter.vercel.app/](https://next-blog-starter.vercel.app/)
## Deploy your own
| true |
Other | vercel | next.js | 2473280f41cd355b46e089f2f1116e2d075a4a16.json | Fix reloading Client Component require.cache (#38633)
@delbaoliveira caught an issue where if you edit a client component multiple times it would cause a hydration error when reloading. Root cause of this was that the `require.cache` entry for `.__sc_client__` did not get removed, which this PR fixes.
## Bug
- [ ]... | packages/next/build/webpack/plugins/nextjs-require-cache-hot-reloader.ts | @@ -3,7 +3,6 @@ import { clearModuleContext } from '../../../server/web/sandbox'
import { realpathSync } from 'fs'
import path from 'path'
import isError from '../../../lib/is-error'
-import { NEXT_CLIENT_SSR_ENTRY_SUFFIX } from '../../../shared/lib/constants'
type Compiler = webpack5.Compiler
type WebpackPlugin... | false |
Other | vercel | next.js | 102cef0f7b4c7108ea000b57d5e47ea68034529d.json | refactor(next/telemetry): use basename for the absolute plugin path (#38473)
Minor changes to SWC plugin telemetry payload. SWC's plugin can be either resolvable npm pkg, or absolute path. If it's an absolute path, try to grab actual plugin name only as we do not need any paths.
## Bug
- [ ] Related issues linked ... | packages/next/telemetry/events/swc-plugins.ts | @@ -1,4 +1,6 @@
import findUp from 'next/dist/compiled/find-up'
+import path from 'path'
+import { fileExists } from '../../lib/file-exists'
import type { NextConfig } from '../../server/config-shared'
const EVENT_SWC_PLUGIN_PRESENT = 'NEXT_SWC_PLUGIN_DETECTED'
@@ -26,22 +28,23 @@ export async function eventSwcPlu... | false |
Other | vercel | next.js | 53bc5b3dd326d70da5b8b3d5cd48355b649ffe75.json | Fix `next/jest` when testing `next/future/image` (#38569)
- Fixes #38383
- Similar to a previous fix in #26502 | packages/next/client/future/image.tsx | @@ -301,7 +301,7 @@ export default function Image({
blurDataURL,
...all
}: ImageProps) {
- if (!experimentalFuture) {
+ if (!experimentalFuture && process.env.NODE_ENV !== 'test') {
throw new Error(
`The "next/future/image" component is experimental and may be subject to breaking changes. To enable... | false |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | errors/invalid-next-config.md | @@ -0,0 +1,24 @@
+# Invalid next.config.js
+
+#### Why This Error Occurred
+
+In your `next.config.js` file you passed invalid options that either are the incorrect type or an unknown field.
+
+#### Possible Ways to Fix It
+
+Fixing the listed config errors will remove this warning. You can also leverage the `NextConfi... | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | errors/manifest.json | @@ -711,6 +711,10 @@
{
"title": "node-module-in-edge-runtime",
"path": "/errors/node-module-in-edge-runtime.md"
+ },
+ {
+ "title": "invalid-next-config",
+ "path": "/errors/invalid-next-config.md"
}
]
} | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | packages/next/index.d.ts | @@ -1,4 +1,5 @@
/// <reference types="./types/global" />
+/// <reference path="./dist/styled-jsx-types/global.d.ts" />
/// <reference path="./amp.d.ts" />
/// <reference path="./app.d.ts" />
/// <reference path="./config.d.ts" />
@@ -11,7 +12,6 @@
/// <reference path="./router.d.ts" />
/// <reference path="./scri... | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | packages/next/package.json | @@ -50,6 +50,7 @@
"index.d.ts",
"types/index.d.ts",
"types/global.d.ts",
+ "types/compiled.d.ts",
"image-types/global.d.ts"
],
"bin": {
@@ -168,6 +169,7 @@
"@vercel/ncc": "0.33.4",
"@vercel/nft": "0.20.0",
"acorn": "8.5.0",
+ "ajv": "8.11.0",
"amphtml-validator": "1.0... | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | packages/next/server/config-schema.ts | @@ -0,0 +1,609 @@
+import { NextConfig } from './config'
+import type { JSONSchemaType } from 'ajv'
+import { VALID_LOADERS } from '../shared/lib/image-config'
+
+const configSchema = {
+ type: 'object',
+ additionalProperties: false,
+ properties: {
+ amp: {
+ additionalProperties: false,
+ properties:... | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | packages/next/server/config-shared.ts | @@ -566,3 +566,13 @@ export function isServerRuntime(value?: string): value is ServerRuntime {
value === undefined || value === 'nodejs' || value === 'experimental-edge'
)
}
+
+export function validateConfig(userConfig: NextConfig): {
+ errors?: Array<any> | null
+} {
+ const configValidator = require('next/... | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | packages/next/server/config.ts | @@ -12,6 +12,7 @@ import {
normalizeConfig,
ExperimentalConfig,
NextConfigComplete,
+ validateConfig,
} from './config-shared'
import { loadWebpackHook } from './config-utils'
import {
@@ -44,23 +45,6 @@ const experimentalWarning = execOnce(
}
)
-const missingExperimentalWarning = execOnce(
- (confi... | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | packages/next/taskfile.js | @@ -176,6 +176,47 @@ export async function ncc_node_fetch(task, opts) {
.target('compiled/node-fetch')
}
+// eslint-disable-next-line camelcase
+export async function compile_config_schema(task, opts) {
+ const { configSchema } = require('./dist/server/config-schema')
+ // eslint-disable-next-line
+ const Aj... | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | pnpm-lock.yaml | @@ -468,6 +468,7 @@ importers:
'@vercel/ncc': 0.33.4
'@vercel/nft': 0.20.0
acorn: 8.5.0
+ ajv: 8.11.0
amphtml-validator: 1.0.35
arg: 4.1.0
assert: 2.0.0
@@ -660,6 +661,7 @@ importers:
'@vercel/ncc': 0.33.4
'@vercel/nft': 0.20.0
acorn: 8.5.0
+ ajv:... | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | test/integration/config-experimental-warning/test/index.test.js | @@ -113,50 +113,4 @@ describe('Config Experimental Warning', () => {
'You have enabled experimental feature (newNextLinkBehavior) in next.config.mjs.'
)
})
-
- it('should show warning with next.config.js from object with non-exist experimental', async () => {
- configFile.write(`
- const config ... | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | test/integration/config-validation/pages/index.js | @@ -0,0 +1,3 @@
+export default function Page() {
+ return <p>index page</p>
+} | true |
Other | vercel | next.js | 62f3f87891f71c4ef6d057880d760f318b131191.json | Add next.config.js validation with ajv (#38498)
* Add next.config.js validation with ajv
* update manifest
* update lib type
* remove old tests
* update to pre-build validation code
* ensure validate output is ncced
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>... | test/integration/config-validation/test/index.test.ts | @@ -0,0 +1,62 @@
+import path from 'path'
+import { nextBuild } from 'next-test-utils'
+import fs from 'fs-extra'
+
+const nextConfigPath = path.join(__dirname, '../next.config.js')
+
+describe('next.config.js validation', () => {
+ it.each([
+ {
+ name: 'invalid config types',
+ configContent: `
+ ... | true |
Other | vercel | next.js | 7cb92a6e95e3536791def6fc3a89a4688a734539.json | Add heuristic for optimistic push (#38599)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | packages/next/client/components/reducer.ts | @@ -149,6 +149,43 @@ const fillCacheWithDataProperty = (
)
}
+const canOptimisticallyRender = (
+ segments: string[],
+ flightRouterState: FlightRouterState
+): boolean => {
+ const segment = segments[0]
+ const isLastSegment = segments.length === 1
+
+ const [existingSegment, existingParallelRoutes, , , loa... | true |
Other | vercel | next.js | 7cb92a6e95e3536791def6fc3a89a4688a734539.json | Add heuristic for optimistic push (#38599)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | packages/next/server/app-render.tsx | @@ -264,7 +264,8 @@ export type FlightRouterState = [
segment: Segment,
parallelRoutes: { [parallelRouterKey: string]: FlightRouterState },
url?: string,
- refresh?: 'refetch'
+ refresh?: 'refetch',
+ loading?: 'loading'
]
export type FlightSegmentPath =
@@ -508,7 +509,9 @@ export async function renderT... | true |
Other | vercel | next.js | 1e2b30dd5163acaf746bb7e3574f2072a3459698.json | Pass server context to Flight render (#38582)
Ensures you can use server context when navigating.
## 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. Ma... | .vscode/launch.json | @@ -10,7 +10,7 @@
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "yarn",
- "runtimeArgs": ["run", "debug", "dev", "test/e2e/app-dir/app"],
+ "runtimeArgs": ["run", "debug-react-exp", "dev", "test/e2e/app-dir/app"],
"skipFiles": ["<node_internals>/**"],
... | true |
Other | vercel | next.js | 1e2b30dd5163acaf746bb7e3574f2072a3459698.json | Pass server context to Flight render (#38582)
Ensures you can use server context when navigating.
## 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. Ma... | package.json | @@ -43,6 +43,7 @@
"next-no-sourcemaps": "node --trace-deprecation packages/next/dist/bin/next",
"clean-trace-jaeger": "rm -rf test/integration/basic/.next && TRACE_TARGET=JAEGER node --trace-deprecation --enable-source-maps packages/next/dist/bin/next build test/integration/basic",
"debug": "node --inspe... | true |
Other | vercel | next.js | 1e2b30dd5163acaf746bb7e3574f2072a3459698.json | Pass server context to Flight render (#38582)
Ensures you can use server context when navigating.
## 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. Ma... | packages/next/server/app-render.tsx | @@ -812,7 +812,9 @@ export async function renderToHTML(
]
return new RenderResult(
- renderToReadableStream(flightData, serverComponentManifest)
+ renderToReadableStream(flightData, serverComponentManifest, {
+ context: serverContexts,
+ })
.pipeThrough(createPrefixStream(cssF... | true |
Other | vercel | next.js | 27a9e8736c61c053b02b5c7eddf98166f75190a8.json | Fix flaky rsc test (#38573)
x-ref: https://github.com/vercel/next.js/runs/7306197700?check_suite_focus=true#step:9:835 | test/e2e/app-dir/rsc-basic.test.ts | @@ -363,7 +363,9 @@ describe('app dir - react server components', () => {
)
// Should end up with "next_streaming_data".
- const browser = await webdriver(next.url, '/partial-hydration')
+ const browser = await webdriver(next.url, '/partial-hydration', {
+ waitHydration: false,
+ })
const... | false |
Other | vercel | next.js | b251e552c6e6f76e11f8288242f4ea6a4d2daffc.json | Handle dev fouc for layout styling (#38557)
* Handle dev fouc for layout styling
* refactor
* fix renderOpts.dev
* dedupe css loading
* keep css module id in dev | packages/next/client/app-index.tsx | @@ -75,6 +75,7 @@ const getCacheKey = () => {
}
const encoder = new TextEncoder()
+const loadedCss: Set<string> = new Set()
let initialServerDataBuffer: string[] | undefined = undefined
let initialServerDataWriter: ReadableStreamDefaultController | undefined =
@@ -146,76 +147,103 @@ function createResponseCache... | true |
Other | vercel | next.js | b251e552c6e6f76e11f8288242f4ea6a4d2daffc.json | Handle dev fouc for layout styling (#38557)
* Handle dev fouc for layout styling
* refactor
* fix renderOpts.dev
* dedupe css loading
* keep css module id in dev | packages/next/client/app-next-dev.js | @@ -1,4 +1,5 @@
import { hydrate, version } from './app-index'
+import { displayContent } from './dev/fouc'
// TODO-APP: implement FOUC guard
@@ -9,6 +10,6 @@ window.next = {
appDir: true,
}
-hydrate()
+hydrate({ onFlightCssLoaded: displayContent })
// TODO-APP: build indicator | true |
Other | vercel | next.js | b251e552c6e6f76e11f8288242f4ea6a4d2daffc.json | Handle dev fouc for layout styling (#38557)
* Handle dev fouc for layout styling
* refactor
* fix renderOpts.dev
* dedupe css loading
* keep css module id in dev | packages/next/client/components/app-router.client.tsx | @@ -49,26 +49,26 @@ function fetchFlight(url: URL, flightRouterStateData: string): ReadableStream {
let buffer = ''
const loadCssFromFlight = new TransformStream({
transform(chunk, controller) {
+ const process = (buf: string) => {
+ if (buf) {
+ if (buf.startsWith('CSS:')) {
+ ... | true |
Other | vercel | next.js | b251e552c6e6f76e11f8288242f4ea6a4d2daffc.json | Handle dev fouc for layout styling (#38557)
* Handle dev fouc for layout styling
* refactor
* fix renderOpts.dev
* dedupe css loading
* keep css module id in dev | packages/next/server/app-render.tsx | @@ -148,13 +148,11 @@ function useFlightResponse(
writer.close()
} else {
const responsePartial = decodeText(value)
- writer.write(
- encodeText(
- `<script>(self.__next_s=self.__next_s||[]).push(${htmlEscapeJsonString(
- JSON.stringify([1, ... | true |
Other | vercel | next.js | b251e552c6e6f76e11f8288242f4ea6a4d2daffc.json | Handle dev fouc for layout styling (#38557)
* Handle dev fouc for layout styling
* refactor
* fix renderOpts.dev
* dedupe css loading
* keep css module id in dev | packages/next/server/node-web-streams-helper.ts | @@ -136,6 +136,33 @@ export function createFlushEffectStream(
})
}
+export function createDevScriptTransformStream(): TransformStream<
+ Uint8Array,
+ Uint8Array
+> {
+ let injected = false
+ const foucTags = `<style data-next-hide-fouc>body{display:none}</style>
+ <noscript data-next-hide-fouc>
+ <style>... | true |
Other | vercel | next.js | 08e69cfdbb9faa7144f959518aa31e5ab864a019.json | chore: extend example contribution guidelines (#38511)
Trying to create more consistency in our examples.
## 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 ... | contributing.md | @@ -265,13 +265,17 @@ Below are the steps to add a new link:
When you add an example to the [examples](examples) directory, please follow these guidelines to ensure high quality examples:
-- TypeScript should be leveraged for new examples (no need for separate JavaScript and TypeScript examples)
+- TypeScript shou... | false |
Other | vercel | next.js | 1c1fbeb4decf31ff8fd6ea274758eb36c25d5af1.json | Add note about standalone + runtimeConfig caveat (#38532)
## Documentation / Examples
- [x] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
x-ref: https://github.... | docs/advanced-features/output-file-tracing.md | @@ -34,6 +34,8 @@ This will create a folder at `.next/standalone` which can then be deployed on it
Additionally, a minimal `server.js` file is also output which can be used instead of `next start`. This minimal server does not copy the `public` or `.next/static` folders by default as these should ideally be handled ... | false |
Other | vercel | next.js | 9222ca9f3f225469f9d1840cbfe7af365664b829.json | Add dev/start timing to PR stats (#38525)
* Add dev/start timing to PR stats
* get port for dev
* add dep
* update field names | .github/actions/next-stats-action/src/run/collect-stats.js | @@ -35,6 +35,7 @@ module.exports = async function collectStats(
(hasPagesToFetch || hasPagesToBench)
) {
const port = await getPort()
+ const startTime = Date.now()
const child = spawn(statsConfig.appStartCommand, {
cwd: curDir,
env: {
@@ -44,14 +45,36 @@ module.exports = async functi... | true |
Other | vercel | next.js | 9222ca9f3f225469f9d1840cbfe7af365664b829.json | Add dev/start timing to PR stats (#38525)
* Add dev/start timing to PR stats
* get port for dev
* add dep
* update field names | .github/actions/next-stats-action/src/run/index.js | @@ -1,5 +1,6 @@
const path = require('path')
const fs = require('fs-extra')
+const getPort = require('get-port')
const glob = require('../util/glob')
const exec = require('../util/exec')
const logger = require('../util/logger')
@@ -78,9 +79,9 @@ async function runConfigs(
}
const collectedStats = a... | true |
Other | vercel | next.js | 9222ca9f3f225469f9d1840cbfe7af365664b829.json | Add dev/start timing to PR stats (#38525)
* Add dev/start timing to PR stats
* get port for dev
* add dep
* update field names | test/.stats-app/stats-config.js | @@ -68,6 +68,7 @@ module.exports = {
commentReleaseHeading: 'Stats from current release',
appBuildCommand: 'NEXT_TELEMETRY_DISABLED=1 yarn next build',
appStartCommand: 'NEXT_TELEMETRY_DISABLED=1 yarn next start --port $PORT',
+ appDevCommand: 'NEXT_TELEMETRY_DISABLED=1 yarn next --port $PORT',
mainRepo: '... | true |
Other | vercel | next.js | 0797b1a6c872781667595168c753efd119515564.json | skip rsc tests for react 17 e2e (#38524)
Fix flaky rsc test in react 17 e2e tests
x-ref: https://github.com/vercel/next.js/runs/7285946966?check_suite_focus=true | test/e2e/app-dir/rsc-basic.test.ts | @@ -50,12 +50,12 @@ describe('app dir - react server components', () => {
afterAll(() => next.destroy())
const { isNextDeploy, isNextDev } = global as any
- if (isNextDeploy) {
- it('should skip tests for next-deploy', () => {})
+ const isReact17 = process.env.NEXT_TEST_REACT_VERSION === '^17'
+ if (isNex... | false |
Other | vercel | next.js | a622c26d23694a99034f0c523de384e54510c763.json | Add docs condition for all azure steps (#38519) | azure-pipelines.yml | @@ -57,7 +57,10 @@ stages:
condition: eq(variables['isDocsOnly'], 'No')
- script: pnpm config set store-dir $(PNPM_CACHE_FOLDER)
+ condition: eq(variables['isDocsOnly'], 'No')
+
- script: pnpm store path
+ condition: eq(variables['isDocsOnly'], 'No')
... | false |
Other | vercel | next.js | 409d37615ba1941b2d6e7ab429fde6ef5529d549.json | Enable css import in rsc server side (#38418)
* Enable css in server components
* inject server css into flight
* refactor and fix test
* fix lint
* resolve css from module deps
* fix dev & prod inconsistentce, collect client css
* simplify
* dedupe duplicated css chunks
* remove ssr link inje... | packages/next/build/webpack/config/blocks/css/index.ts | @@ -360,7 +360,11 @@ export const css = curry(async function css(
sideEffects: true,
test: regexCssGlobal,
issuer: {
- and: [ctx.rootDirectory, /\.(js|mjs|jsx|ts|tsx)$/],
+ or: [
+ { and: [ctx.rootDirectory, /\.(js|mjs|jsx|ts|ts... | true |
Other | vercel | next.js | 409d37615ba1941b2d6e7ab429fde6ef5529d549.json | Enable css import in rsc server side (#38418)
* Enable css in server components
* inject server css into flight
* refactor and fix test
* fix lint
* resolve css from module deps
* fix dev & prod inconsistentce, collect client css
* simplify
* dedupe duplicated css chunks
* remove ssr link inje... | packages/next/build/webpack/loaders/next-flight-client-entry-loader.ts | @@ -6,13 +6,15 @@ export default async function transformSource(this: any): Promise<string> {
modules = modules ? [modules] : []
}
- return (
- modules
- .map(
- (request: string) => `import(/* webpackMode: "eager" */ '${request}')`
- )
- .join(';') +
+ const requests = modules as s... | true |
Other | vercel | next.js | 409d37615ba1941b2d6e7ab429fde6ef5529d549.json | Enable css import in rsc server side (#38418)
* Enable css in server components
* inject server css into flight
* refactor and fix test
* fix lint
* resolve css from module deps
* fix dev & prod inconsistentce, collect client css
* simplify
* dedupe duplicated css chunks
* remove ssr link inje... | packages/next/build/webpack/plugins/client-entry-plugin.ts | @@ -22,6 +22,7 @@ type Options = {
const PLUGIN_NAME = 'ClientEntryPlugin'
export const injectedClientEntries = new Map()
+const regexCssGlobal = /(?<!\.module)\.css$/
export class ClientEntryPlugin {
dev: boolean = false
@@ -77,11 +78,15 @@ export class ClientEntryPlugin {
const module = compilati... | true |
Other | vercel | next.js | 409d37615ba1941b2d6e7ab429fde6ef5529d549.json | Enable css import in rsc server side (#38418)
* Enable css in server components
* inject server css into flight
* refactor and fix test
* fix lint
* resolve css from module deps
* fix dev & prod inconsistentce, collect client css
* simplify
* dedupe duplicated css chunks
* remove ssr link inje... | packages/next/build/webpack/plugins/flight-manifest-plugin.ts | @@ -9,7 +9,6 @@ import { webpack, sources } from 'next/dist/compiled/webpack/webpack'
import { FLIGHT_MANIFEST } from '../../../shared/lib/constants'
import { clientComponentRegex } from '../loaders/utils'
import { relative } from 'path'
-import { getEntrypointFiles } from './build-manifest-plugin'
import type { we... | true |
Other | vercel | next.js | 409d37615ba1941b2d6e7ab429fde6ef5529d549.json | Enable css import in rsc server side (#38418)
* Enable css in server components
* inject server css into flight
* refactor and fix test
* fix lint
* resolve css from module deps
* fix dev & prod inconsistentce, collect client css
* simplify
* dedupe duplicated css chunks
* remove ssr link inje... | packages/next/client/app-index.tsx | @@ -30,8 +30,7 @@ __webpack_require__.u = (chunkId: any) => {
self.__next_require__ = __webpack_require__
// eslint-disable-next-line no-undef
-// @ts-expect-error TODO: fix type
-self.__next_chunk_load__ = (chunk) => {
+;(self as any).__next_chunk_load__ = (chunk: string) => {
if (chunk.endsWith('.css')) {
... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.