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
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/dynamic-routing/pages/middleware/[slug]/_middleware.js
@@ -0,0 +1,5 @@ +import { NextResponse } from 'next/server' + +export function middleware() { + return NextResponse.next() +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/dynamic-routing/test/index.test.js
@@ -1100,6 +1100,8 @@ function runTests({ dev, serverless }) { ) for (const route of manifest.dynamicRoutes) { + if (route.isMiddleware) continue + route.regex = normalizeRegEx(route.regex) // ensure regexes are valid @@ -1116,7 +1118,7 @@ function runTests({ dev, serverless }...
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/next.config.js
@@ -0,0 +1,6 @@ +module.exports = { + i18n: { + locales: ['en', 'fr', 'nl'], + defaultLocale: 'en', + }, +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/[slug]/[id]/_middleware.js
@@ -0,0 +1,7 @@ +import { NextResponse } from 'next/server' + +export function middleware() { + const response = NextResponse.next() + response.headers.set('x-slug-id-path', 'true') + return response +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/[slug]/[id]/index.js
@@ -0,0 +1,3 @@ +export default function Index() { + return <p className="title">Dynamic route</p> +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/[slug]/_middleware.js
@@ -0,0 +1,7 @@ +import { NextResponse } from 'next/server' + +export function middleware(req) { + const response = NextResponse.next() + response.headers.set('x-slug-path', 'true') + return response +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/[slug]/index.js
@@ -0,0 +1,3 @@ +export default function Index() { + return <p className="title">Dynamic route</p> +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/[slug]/static.js
@@ -0,0 +1,3 @@ +export default function Index() { + return <p className="title">Nested Static route</p> +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/_middleware.js
@@ -0,0 +1,19 @@ +import { NextResponse } from 'next/server' + +export async function middleware(request) { + const response = NextResponse.next() + response.headers.set('req-url-basepath', request.nextUrl.basePath) + response.headers.set('req-url-pathname', request.nextUrl.pathname) + response.headers.set( + 'r...
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/api/_middleware.js
@@ -0,0 +1,7 @@ +import { NextResponse } from 'next/server' + +export function middleware() { + const response = NextResponse.next() + response.headers.set('x-api-path', 'true') + return response +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/api/index.js
@@ -0,0 +1,3 @@ +export default function handler(req, res) { + res.status(200).json({ route: '/api' }) +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/catch-all/[...rest].js
@@ -0,0 +1,3 @@ +export default function CatchAll() { + return <p className="title">Catch All route</p> +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/catch-all/_middleware.js
@@ -0,0 +1,7 @@ +import { NextResponse } from 'next/server' + +export function middleware() { + const response = NextResponse.next() + response.headers.set('x-catch-all-path', 'true') + return response +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/dir/_middleware.js
@@ -0,0 +1,7 @@ +import { NextResponse } from 'next/server' + +export function middleware() { + const response = NextResponse.next() + response.headers.set('x-dir-path', 'true') + return response +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/dir/index.js
@@ -0,0 +1,3 @@ +export default function Dir() { + return <p className="title">Dir route</p> +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/index.js
@@ -0,0 +1,3 @@ +export default function Home() { + return <p className="title">Home Page</p> +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/optional-catch-all/[[...rest]].js
@@ -0,0 +1,3 @@ +export default function OptionalCatchAll() { + return <p className="title">Optional Catch All route</p> +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/optional-catch-all/_middleware.js
@@ -0,0 +1,7 @@ +import { NextResponse } from 'next/server' + +export function middleware() { + const response = NextResponse.next() + response.headers.set('x-optional-catch-all-path', 'true') + return response +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/pages/static.js
@@ -0,0 +1,3 @@ +export default function Index() { + return <p className="title">Static route</p> +}
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/public/robots.txt
@@ -0,0 +1,7 @@ +User-agent: Googlebot +Disallow: /nogooglebot/ + +User-agent: * +Allow: / + +Sitemap: http://www.example.com/sitemap.xml
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/integration/middleware/dynamic-route/test/index.test.js
@@ -0,0 +1,307 @@ +/* eslint-env jest */ + +import { join } from 'path' +import { + fetchViaHTTP, + findPort, + killApp, + launchApp, + nextBuild, + nextStart, +} from 'next-test-utils' + +jest.setTimeout(1000 * 60 * 2) +const context = {} +context.appDir = join(__dirname, '../') + +describe('Middleware dynamic t...
true
Other
vercel
next.js
53d1b00c7fd71f26c3b4ae1f987855d35b7fca04.json
fix the dynamic routing of middleware (#32601) * fix the dynamic routing of middleware * add middleware to dynamicRoutes of routes-manifest * remove unused import * fix middleware routing with static paths * update manifest version test * prevent to match with api route using regex * use iterator ins...
test/unit/page-route-sorter.test.ts
@@ -66,6 +66,88 @@ describe('getSortedRoutes', () => { `) }) + it('correctly sorts with middleware', () => { + expect( + getSortedRoutes([ + '/posts', + '/[root-slug]', + '/[root-slug]/_middleware', + '/', + '/_middleware', + '/posts/[id]', + '/blog/[i...
true
Other
vercel
next.js
3d5a9bf5e7a44286254c8a5fd9f674537ba41d4f.json
Fix next info test during stable release (#35668)
test/integration/cli/test/index.test.js
@@ -491,7 +491,12 @@ describe('CLI Usage', () => { stdout: true, stderr: true, }) - expect(info.stderr || '').toBe('') + + // when a stable release is done the non-latest canary + // warning will show so skip this check for the stable release + if (pkg.version.includes('-can...
false
Other
vercel
next.js
c11716703bfa3cca7d53d345486ab6588e9159f5.json
Fix typo in German translation (#22291) Fixes a small typo in the with-rosetta-i18n example.
examples/with-i18n-rosetta/locales/de.json
@@ -2,7 +2,7 @@ "intro": { "welcome": "Willkommen, {{username}}!", "text": "Ich hoffe, du findest das nützlich.", - "description": "Das Beispiel zeigt, wie man die Sprache für SSG und SSG optimierte Seiten wechselt." + "description": "Das Beispiel zeigt, wie man die Sprache für SSG und SSR optimierte...
false
Other
vercel
next.js
5c24670227b36c079e26d6af3e85297dce5e2212.json
Add Zipkin trace capturing with output to JSON. (#22106) @timneutkens this adds a trace capturing script alongside the other tracing sundry. This will be utilized by the performance automation. Additionally, its nice to have an option other than running the ZipKin JAR to get at the raw data.
bench/capture-trace.js
@@ -0,0 +1,66 @@ +const http = require('http') +const fs = require('fs') + +const PORT = 9411 +const HOST = '0.0.0.0' + +const traces = [] + +const onReady = () => console.log(`Listening on http://${HOST}:${PORT}`) +const onRequest = async (req, res) => { + if ( + req.method !== 'POST' || + req.url !== '/api/v2/...
false
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
package.json
@@ -50,6 +50,7 @@ "@opentelemetry/plugin-http": "0.14.0", "@opentelemetry/plugin-https": "0.14.0", "@opentelemetry/tracing": "0.14.0", + "@testing-library/react": "11.2.5", "@types/cheerio": "0.22.16", "@types/fs-extra": "8.1.0", "@types/http-proxy": "1.17.3",
true
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
packages/next/client/experimental-script.tsx
@@ -2,7 +2,7 @@ import React, { useEffect, useContext } from 'react' import { ScriptHTMLAttributes } from 'react' import { HeadManagerContext } from '../next-server/lib/head-manager-context' import { DOMAttributeNames } from './head-manager' -import requestIdleCallback from './request-idle-callback' +import { reques...
true
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
packages/next/client/request-idle-callback.ts
@@ -13,10 +13,11 @@ declare global { callback: (deadline: RequestIdleCallbackDeadline) => void, opts?: RequestIdleCallbackOptions ) => RequestIdleCallbackHandle + cancelIdleCallback: (id: RequestIdleCallbackHandle) => void } } -const requestIdleCallback = +export const requestIdleCallback = ...
true
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
packages/next/client/route-loader.ts
@@ -1,7 +1,7 @@ import { ComponentType } from 'react' import { ClientBuildManifest } from '../build/webpack/plugins/build-manifest-plugin' import getAssetPathFromRoute from '../next-server/lib/router/utils/get-asset-path-from-route' -import requestIdleCallback from './request-idle-callback' +import { requestIdleCall...
true
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
packages/next/client/use-intersection.tsx
@@ -1,5 +1,8 @@ import { useCallback, useEffect, useRef, useState } from 'react' -import requestIdleCallback from './request-idle-callback' +import { + requestIdleCallback, + cancelIdleCallback, +} from './request-idle-callback' type UseIntersectionObserverInit = Pick<IntersectionObserverInit, 'rootMargin'> type...
true
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
packages/next/compiled/strip-ansi/index.js
@@ -1 +1 @@ -module.exports=(()=>{"use strict";var e={301:(e,r,t)=>{const _=t(979);e.exports=(e=>typeof e==="string"?e.replace(_(),""):e)},979:e=>{e.exports=(({onlyFirst:e=false}={})=>{const r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[...
true
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
test/integration/build-output/test/index.test.js
@@ -94,14 +94,14 @@ describe('Build Output', () => { expect(parseFloat(indexSize) - 266).toBeLessThanOrEqual(0) expect(indexSize.endsWith('B')).toBe(true) - // should be no bigger than 63.8 kb - expect(parseFloat(indexFirstLoad)).toBeCloseTo(63.8, 1) + // should be no bigger than 63.9 kb ...
true
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
test/integration/size-limit/test/index.test.js
@@ -81,6 +81,6 @@ describe('Production response size', () => { const delta = responseSizesBytes / 1024 // Expected difference: < 0.5 - expect(delta).toBeCloseTo(284.1, 0) + expect(delta).toBeCloseTo(284.7, 0) }) })
true
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
test/unit/link-warnings.test.js
@@ -0,0 +1,33 @@ +/** + * @jest-environment jsdom + */ +import { act, render } from '@testing-library/react' +import Link from 'next/link' + +describe('<Link/>', () => { + let spy + beforeAll(() => { + spy = jest.spyOn(console, 'error').mockImplementation(() => {}) + }) + + it('test link with unmount', () => { +...
true
Other
vercel
next.js
5f41abda9ac71923584446a60dafa5601aa3bfe1.json
fix(link): cancel idle callback on unmount (#22072) Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
yarn.lock
@@ -958,6 +958,14 @@ pirates "^4.0.0" source-map-support "^0.5.16" +"@babel/runtime-corejs3@^7.10.2": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.12.13.tgz#53d09813b7c20d616caf258e9325550ff701c039" + integrity sha512-8fSpqYRETHATtNitsCXq8QQbKJP3...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/.env.local.example
@@ -1,3 +1,4 @@ NEXT_PUBLIC_SANITY_PROJECT_ID= +NEXT_PUBLIC_SANITY_DATASET= SANITY_API_TOKEN= -SANITY_PREVIEW_SECRET= \ No newline at end of file +SANITY_PREVIEW_SECRET=
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/README.md
@@ -70,13 +70,15 @@ cp .env.local.example .env.local Then set each variable on `.env.local`: - `NEXT_PUBLIC_SANITY_PROJECT_ID` should be the `projectId` value from the `sanity.json` file created in step 2. +- `NEXT_PUBLIC_SANITY_DATASET` should be the `dataset` value from the `sanity.json` file created in step 2 - ...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/components/avatar.js
@@ -1,7 +1,13 @@ +import { urlForImage } from '../lib/sanity' + export default function Avatar({ name, picture }) { return ( <div className="flex items-center"> - <img src={picture} className="w-12 h-12 rounded-full mr-4" alt={name} /> + <img + src={urlForImage(picture).height(96).width(96).fi...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/components/cover-image.js
@@ -1,18 +1,20 @@ import cn from 'classnames' import Link from 'next/link' -import { imageBuilder } from '../lib/sanity' +import { urlForImage } from '../lib/sanity' -export default function CoverImage({ title, url, slug }) { - const image = ( +export default function CoverImage({ title, slug, image: source }) { +...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/components/hero-post.js
@@ -14,7 +14,7 @@ export default function HeroPost({ return ( <section> <div className="mb-8 md:mb-16"> - <CoverImage slug={slug} title={title} url={coverImage} /> + <CoverImage slug={slug} title={title} image={coverImage} /> </div> <div className="md:grid md:grid-cols-2 md:co...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/components/meta.js
@@ -36,7 +36,7 @@ export default function Meta() { name="description" content={`A statically generated blog example using Next.js and ${CMS_NAME}.`} /> - <meta property="og:image" content={HOME_OG_IMAGE_URL} /> + <meta property="og:image" content={HOME_OG_IMAGE_URL} key="ogImage" /> ...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/components/post-header.js
@@ -11,7 +11,7 @@ export default function PostHeader({ title, coverImage, date, author }) { <Avatar name={author.name} picture={author.picture} /> </div> <div className="mb-8 md:mb-16 sm:mx-0"> - <CoverImage title={title} url={coverImage} /> + <CoverImage title={title} image={coverI...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/components/post-preview.js
@@ -14,7 +14,7 @@ export default function PostPreview({ return ( <div> <div className="mb-5"> - <CoverImage slug={slug} title={title} url={coverImage} /> + <CoverImage slug={slug} title={title} image={coverImage} /> </div> <h3 className="text-3xl mb-3 leading-snug"> <...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/lib/api.js
@@ -1,72 +0,0 @@ -import client, { previewClient } from './sanity' - -const getUniquePosts = (posts) => { - const slugs = new Set() - return posts.filter((post) => { - if (slugs.has(post.slug)) { - return false - } else { - slugs.add(post.slug) - return true - } - }) -} - -const postFields = ...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/lib/config.js
@@ -0,0 +1,9 @@ +export const sanityConfig = { + // Find your project ID and dataset in `sanity.json` in your studio project + dataset: process.env.NEXT_PUBLIC_SANITY_DATASET || 'production', + projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID, + useCdn: process.env.NODE_ENV === 'production', + // useCdn == tru...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/lib/queries.js
@@ -0,0 +1,37 @@ +const postFields = ` + _id, + name, + title, + date, + excerpt, + coverImage, + "slug": slug.current, + "author": author->{name, picture}, +` + +export const indexQuery = ` +*[_type == "post"] | order(date desc, _updatedAt desc) { + ${postFields} +}` + +export const postQuery = ` +{ + "post"...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/lib/sanity.js
@@ -1,24 +1,14 @@ -import sanityClient from '@sanity/client' -import sanityImage from '@sanity/image-url' +import { + createImageUrlBuilder, + createPreviewSubscriptionHook, +} from 'next-sanity' +import { sanityConfig } from './config' -const options = { - // Find your project ID and dataset in `sanity.json` in y...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/lib/sanity.server.js
@@ -0,0 +1,32 @@ +/** + * Server-side Sanity utilities. By having these in a separate file from the + * utilities we use on the client side, we are able to tree-shake (remove) + * code that is not used on the client side. + */ +import { createClient } from 'next-sanity' +import { sanityConfig } from './config' + +expor...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/package.json
@@ -8,10 +8,9 @@ }, "dependencies": { "@sanity/block-content-to-react": "2.0.7", - "@sanity/client": "1.149.2", - "@sanity/image-url": "0.140.17", "classnames": "2.2.6", "date-fns": "2.10.0", + "next-sanity": "0.1.5", "next": "latest", "react": "^16.13.0", "react-dom": "^16....
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/pages/api/preview.js
@@ -1,4 +1,5 @@ -import { getPreviewPostBySlug } from '../../lib/api' +import { postBySlugQuery } from '../../lib/queries' +import { previewClient } from '../../lib/sanity.server' export default async function preview(req, res) { // Check the secret and next parameters @@ -10,8 +11,10 @@ export default async func...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/pages/index.js
@@ -1,11 +1,12 @@ +import Head from 'next/head' import Container from '../components/container' import MoreStories from '../components/more-stories' import HeroPost from '../components/hero-post' import Intro from '../components/intro' import Layout from '../components/layout' -import { getAllPostsForHome } from '...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/pages/posts/[slug].js
@@ -1,3 +1,4 @@ +import Head from 'next/head' import { useRouter } from 'next/router' import ErrorPage from 'next/error' import Container from '../../components/container' @@ -7,16 +8,28 @@ import Header from '../../components/header' import PostHeader from '../../components/post-header' import SectionSeparator fr...
true
Other
vercel
next.js
394bbf62070963a922dbecd00cb0c22317ed8a35.json
Improve sanity.io example (#18227)
examples/cms-sanity/schemas/schema.js
@@ -12,24 +12,6 @@ export default createSchema({ // to the ones provided by any plugins that are installed types: schemaTypes.concat([ /* Your types here! */ - { - name: 'author', - type: 'document', - title: 'Author', - fields: [ - { - name: 'name', - title: '...
true
Other
vercel
next.js
984a78d545c94f06189af45c65504acbc3287493.json
Update React version in Tailwind example (#21906) This PR updates the React packages version in the example with Tailwind. Thus solving the new version notice when starting the project in dev. Notice screenshot: 📸 ![image](https://user-images.githubusercontent.com/25041169/107084102-5bc0f780-67d5-11eb-82bb-b9ea2682...
examples/with-tailwindcss/package.json
@@ -9,8 +9,8 @@ }, "dependencies": { "next": "latest", - "react": "^16.13.1", - "react-dom": "^16.13.1", + "react": "^17.0.1", + "react-dom": "^17.0.1", "autoprefixer": "^10.0.4", "postcss": "^8.1.10", "tailwindcss": "^2.0.2"
false
Other
vercel
next.js
ee184a11d8ef5f60f1be0551f3d64fca596fdaba.json
Add example for headers and link in the docs (#21821)
docs/api-reference/next.config.js/headers.md
@@ -6,6 +6,13 @@ description: Add custom HTTP headers to your Next.js app. > This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out. +<details open> + <summary><b>Examples</b></summary> + <ul> + <li>...
true
Other
vercel
next.js
ee184a11d8ef5f60f1be0551f3d64fca596fdaba.json
Add example for headers and link in the docs (#21821)
examples/headers/.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
ee184a11d8ef5f60f1be0551f3d64fca596fdaba.json
Add example for headers and link in the docs (#21821)
examples/headers/README.md
@@ -0,0 +1,23 @@ +# Headers Example + +This example shows how to use [headers in Next.js](https://nextjs.org/docs/api-reference/next.config.js/headers) to add custom HTTP headers into your Next.js app. + +The index page ([`pages/index.js`](pages/index.js)) has a list of links to pages with custom headers set up in [`ne...
true
Other
vercel
next.js
ee184a11d8ef5f60f1be0551f3d64fca596fdaba.json
Add example for headers and link in the docs (#21821)
examples/headers/next.config.js
@@ -0,0 +1,24 @@ +module.exports = { + async headers() { + return [ + { + source: '/about', + headers: [ + { + key: 'X-About-Custom-Header', + value: 'about_header_value', + }, + ], + }, + { + source: '/news/:id', + headers: [...
true
Other
vercel
next.js
ee184a11d8ef5f60f1be0551f3d64fca596fdaba.json
Add example for headers and link in the docs (#21821)
examples/headers/package.json
@@ -0,0 +1,15 @@ +{ + "name": "headers", + "version": "1.0.0", + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start" + }, + "dependencies": { + "next": "latest", + "react": "^16.13.1", + "react-dom": "^16.13.1" + }, + "license": "MIT" +}
true
Other
vercel
next.js
ee184a11d8ef5f60f1be0551f3d64fca596fdaba.json
Add example for headers and link in the docs (#21821)
examples/headers/pages/about.js
@@ -0,0 +1,27 @@ +import Link from 'next/link' +import styles from '../styles.module.css' + +const Code = (p) => <code className={styles.inlineCode} {...p} /> + +export default function About() { + return ( + <div className={styles.container}> + <div className={styles.card}> + <h1>Path: /about</h1> + ...
true
Other
vercel
next.js
ee184a11d8ef5f60f1be0551f3d64fca596fdaba.json
Add example for headers and link in the docs (#21821)
examples/headers/pages/index.js
@@ -0,0 +1,40 @@ +import styles from '../styles.module.css' + +const Code = (p) => <code className={styles.inlineCode} {...p} /> + +const Index = () => ( + <div className={styles.container}> + <div className={styles.card}> + <h1>Headers with Next.js</h1> + <hr className={styles.hr} /> + <p> + ...
true
Other
vercel
next.js
ee184a11d8ef5f60f1be0551f3d64fca596fdaba.json
Add example for headers and link in the docs (#21821)
examples/headers/pages/news/[...slug].js
@@ -0,0 +1,31 @@ +import { useRouter } from 'next/router' +import Link from 'next/link' +import styles from '../../styles.module.css' + +const Code = (p) => <code className={styles.inlineCode} {...p} /> + +const News = ({ props }) => { + const { asPath } = useRouter() + + return ( + <div className={styles.containe...
true
Other
vercel
next.js
ee184a11d8ef5f60f1be0551f3d64fca596fdaba.json
Add example for headers and link in the docs (#21821)
examples/headers/styles.module.css
@@ -0,0 +1,51 @@ +.container { + padding: 4rem 1rem; + font-family: -apple-system, BlinkMacSystemFont, sans-serif; +} + +.container p { + margin: 1.5rem 0; +} + +.card { + max-width: 50rem; + box-shadow: -10px 10px 80px rgba(0, 0, 0, 0.12); + border: 1px solid #eee; + border-radius: 8px; + padding: 2rem; + mar...
true
Other
vercel
next.js
9a3a0da319f566caba7fcfa225ab9214e92c935b.json
Fix docs for sample query parameters (#21879)
docs/routing/dynamic-routes.md
@@ -45,7 +45,7 @@ Similarly, the route `/post/abc?foo=bar` will have the following `query` object: However, route parameters will override query parameters with the same name. For example, the route `/post/abc?pid=123` will have the following `query` object: ```json -{ "pid": "abc" } +{ "pid": "123" } ``` Multi...
false
Other
vercel
next.js
6d80e6e5f3a86c6ebb609acf497018fae49e5db2.json
Add version for stats (#21823) Adds versioning for the stats output
packages/next/build/webpack/plugins/build-stats-plugin.ts
@@ -6,6 +6,8 @@ import { spans } from './profiling-plugin' import { webpack } from 'next/dist/compiled/webpack/webpack' import { tracer, traceAsyncFn } from '../../tracer' +const STATS_VERSION = 0 + // This plugin creates a stats.json for a build when enabled export default class BuildStatsPlugin { private dis...
true
Other
vercel
next.js
6d80e6e5f3a86c6ebb609acf497018fae49e5db2.json
Add version for stats (#21823) Adds versioning for the stats output
test/integration/build-stats/test/index.test.js
@@ -14,7 +14,10 @@ describe('Build Stats', () => { await nextBuild(appDir) expect(await fs.pathExists(statsPath)).toBe(true) - const statsData = await fs.readFile(statsPath, 'utf8') - JSON.parse(statsData) + const statsString = await fs.readFile(statsPath, 'utf8') + const statsData = JSON.parse(...
true
Other
vercel
next.js
55365268264ca1e40733248ede4da9d3c91ccb16.json
Remove dotenv from Relay example. (#21814) Address one of the bullet points from https://github.com/vercel/next.js/issues/15225 to remove unused dependencies on `dotenv` now that it's supported by default in Next.js.
examples/with-reason-relay/.env
@@ -1 +1 @@ -RELAY_ENDPOINT=https://nextjs-graphql-with-prisma-relay.vercel.app/api +NEXT_PUBLIC_RELAY_ENDPOINT=https://nextjs-graphql-with-prisma-relay.vercel.app/api
true
Other
vercel
next.js
55365268264ca1e40733248ede4da9d3c91ccb16.json
Remove dotenv from Relay example. (#21814) Address one of the bullet points from https://github.com/vercel/next.js/issues/15225 to remove unused dependencies on `dotenv` now that it's supported by default in Next.js.
examples/with-reason-relay/next.config.js
@@ -1,21 +0,0 @@ -require('dotenv').config() -const path = require('path') -const Dotenv = require('dotenv-webpack') - -module.exports = { - webpack: (config) => { - config.plugins = config.plugins || [] - - config.plugins = [ - ...config.plugins, - - // Read the .env file - new Dotenv({ - ...
true
Other
vercel
next.js
55365268264ca1e40733248ede4da9d3c91ccb16.json
Remove dotenv from Relay example. (#21814) Address one of the bullet points from https://github.com/vercel/next.js/issues/15225 to remove unused dependencies on `dotenv` now that it's supported by default in Next.js.
examples/with-reason-relay/package.json
@@ -16,8 +16,6 @@ "@zeit/next-css": "1.0.1", "bs-fetch": "0.5.2", "bs-platform": "7.2.2", - "dotenv": "^8.2.0", - "dotenv-webpack": "^1.7.0", "graphql": "15.0.0", "isomorphic-unfetch": "^3.0.0", "next": "latest",
true
Other
vercel
next.js
55365268264ca1e40733248ede4da9d3c91ccb16.json
Remove dotenv from Relay example. (#21814) Address one of the bullet points from https://github.com/vercel/next.js/issues/15225 to remove unused dependencies on `dotenv` now that it's supported by default in Next.js.
examples/with-reason-relay/src/RelayEnv.re
@@ -11,7 +11,7 @@ exception Graphql_error(string); */ let fetchQuery: ReasonRelay.Network.fetchFunctionPromise = (operation, variables, _cacheConfig) => { - let uri: string = [%raw "process.env.RELAY_ENDPOINT"]; + let uri: string = [%raw "process.env.NEXT_PUBLIC_RELAY_ENDPOINT"]; fetchWithInit( ...
true
Other
vercel
next.js
a6c1f9cfe777be516016523a764aa5ba50bb274c.json
Add webpack type to ncc bundle (#21785) This adds a simple typing definition to the Webpack ncc output. Fixes https://github.com/vercel/next.js/issues/21390.
packages/next/bundles/webpack/packages/webpack.d.ts
@@ -0,0 +1,4 @@ +export namespace webpack { + export type Compiler = any + export type Plugin = any +}
true
Other
vercel
next.js
a6c1f9cfe777be516016523a764aa5ba50bb274c.json
Add webpack type to ncc bundle (#21785) This adds a simple typing definition to the Webpack ncc output. Fixes https://github.com/vercel/next.js/issues/21390.
packages/next/compiled/webpack/webpack.d.ts
@@ -0,0 +1,4 @@ +export namespace webpack { + export type Compiler = any + export type Plugin = any +}
true
Other
vercel
next.js
a6c1f9cfe777be516016523a764aa5ba50bb274c.json
Add webpack type to ncc bundle (#21785) This adds a simple typing definition to the Webpack ncc output. Fixes https://github.com/vercel/next.js/issues/21390.
packages/next/types/index.d.ts
@@ -23,9 +23,6 @@ import { // @ts-ignore This path is generated at build time and conflicts otherwise import next from '../dist/server/next' -declare module 'next/dist/compiled/loader-utils' -declare module 'next/dist/compiled/webpack/webpack' - // Extend the React types with missing properties declare module 're...
true
Other
vercel
next.js
e750f4378c25872b704197ee9161bee7eebb415c.json
fix: send url to gtm.pageview (#21747) `gtm.pageview` was called without sending an actual URL, while it is required here: https://github.com/vercel/next.js/blob/36aeca8f041a81ae01cae3c55e5c187a038e4166/examples/with-google-tag-manager/lib/gtm.js#L3-L6
examples/with-google-tag-manager/components/GoogleTagManager.js
@@ -2,17 +2,13 @@ import { useEffect } from 'react' import { useRouter } from 'next/router' import * as gtm from '../lib/gtm' -const handleRouteChange = () => { - gtm.pageview() -} - const GoogleTagManager = ({ children }) => { const router = useRouter() useEffect(() => { - router.events.on('routeChang...
false
Other
vercel
next.js
4cadb68dfe9b43672b8a2358a0ccfa67baba0621.json
Return a number from sort compare function (#21763) Changed the return values of the compare function from string values to numbers
examples/blog-starter/lib/api.js
@@ -38,6 +38,6 @@ export function getAllPosts(fields = []) { const posts = slugs .map((slug) => getPostBySlug(slug, fields)) // sort posts by date in descending order - .sort((post1, post2) => (post1.date > post2.date ? '-1' : '1')) + .sort((post1, post2) => (post1.date > post2.date ? -1 : 1)) ret...
false
Other
vercel
next.js
d5a4dec04251d593f03321467d467495931564b1.json
fix: add declarations for compiled webpack and loader (#21741) This should resolve the typing issues described in https://github.com/vercel/next.js/issues/21390 from the webpack inlining, by declaring `next/dist/compiled/webpack` in the main typing file as a source.
packages/next/types/index.d.ts
@@ -23,6 +23,9 @@ import { // @ts-ignore This path is generated at build time and conflicts otherwise import next from '../dist/server/next' +declare module 'next/dist/compiled/loader-utils' +declare module 'next/dist/compiled/webpack/webpack' + // Extend the React types with missing properties declare module 're...
false
Other
vercel
next.js
232209b51330414f8dc002eb533e90ba2ac00cc9.json
Remove note about Yarn 2 support. (#21665) My addition of the Yarn 2 caveat was more nuanced than I thought. Apologies. @merceyz has been adding extensive e2e tests for Yarn 2 support. We plan to support Yarn 2 compat. Reverts https://github.com/vercel/next.js/pull/21657.
docs/getting-started.md
@@ -41,8 +41,6 @@ npm install next react react-dom yarn add next react react-dom ``` -> **Note**: [Yarn 2](https://yarnpkg.com/getting-started/install) is supported as best-effort within Next.js. For best results, use NPM or Yarn 1. - Open `package.json` and add the following `scripts`: ```json
false
Other
vercel
next.js
843252b8211f14ba9c2aa422f3feed728a827836.json
Add note about Yarn 2 support. (#21657) As we saw some confusion with users trying out Yarn 2 and hitting roadblocks in their app. Yarn 2 is supported on a best-effort basis.
docs/getting-started.md
@@ -41,6 +41,8 @@ npm install next react react-dom yarn add next react react-dom ``` +> **Note**: [Yarn 2](https://yarnpkg.com/getting-started/install) is supported as best-effort within Next.js. For best results, use NPM or Yarn 1. + Open `package.json` and add the following `scripts`: ```json
false
Other
vercel
next.js
dbfd594e8c20325a37ae21929139cde648a6094f.json
Add SWC plugins to version history in docs. (#38039)
docs/advanced-features/compiler.md
@@ -9,6 +9,7 @@ description: Learn about the Next.js Compiler, written in Rust, which transforms | Version | Changes | | --------- | ----------------------------------------------------------...
false
Other
vercel
next.js
6781a5255964a837458b97331133ebe656726e00.json
Fix invalid warning for existing experimental flag (#38027)
packages/next/server/config-shared.ts
@@ -510,6 +510,7 @@ export const defaultConfig: NextConfig = { swcMinify: false, output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined, experimental: { + manualClientBasePath: false, // TODO: change default in next major release (current v12.1.5) legacyBrowsers: true, brows...
true
Other
vercel
next.js
6781a5255964a837458b97331133ebe656726e00.json
Fix invalid warning for existing experimental flag (#38027)
test/e2e/manual-client-base-path/index.test.ts
@@ -5,7 +5,7 @@ import { join } from 'path' import http from 'http' import webdriver from 'next-webdriver' import assert from 'assert' -import { check, waitFor } from 'next-test-utils' +import { check, renderViaHTTP, waitFor } from 'next-test-utils' describe('manual-client-base-path', () => { if ((global as an...
true
Other
vercel
next.js
8302a3ff7c0075fd57d39bcb841abea6e153ba1b.json
Move `rimraf` from root packages using it (#37996) In a previous PR (#37278), the dependencies for benchmarks were moved to a subdirectory. This ensures the same is done for other packages using `rimraf` which means we can remove it from the root package.json
package.json
@@ -179,7 +179,6 @@ "release": "6.3.1", "request-promise-core": "1.1.2", "resolve-from": "5.0.0", - "rimraf": "2.6.3", "seedrandom": "3.0.5", "selenium-webdriver": "4.0.0-beta.4", "semver": "7.3.7",
true
Other
vercel
next.js
8302a3ff7c0075fd57d39bcb841abea6e153ba1b.json
Move `rimraf` from root packages using it (#37996) In a previous PR (#37278), the dependencies for benchmarks were moved to a subdirectory. This ensures the same is done for other packages using `rimraf` which means we can remove it from the root package.json
packages/create-next-app/package.json
@@ -43,7 +43,7 @@ "cross-spawn": "6.0.5", "got": "10.7.0", "prompts": "2.1.0", - "rimraf": "3.0.0", + "rimraf": "3.0.2", "tar": "4.4.10", "update-check": "1.5.4", "validate-npm-package-name": "3.0.0"
true
Other
vercel
next.js
8302a3ff7c0075fd57d39bcb841abea6e153ba1b.json
Move `rimraf` from root packages using it (#37996) In a previous PR (#37278), the dependencies for benchmarks were moved to a subdirectory. This ensures the same is done for other packages using `rimraf` which means we can remove it from the root package.json
packages/next-env/package.json
@@ -32,6 +32,7 @@ "devDependencies": { "@vercel/ncc": "0.33.4", "dotenv": "10.0.0", - "dotenv-expand": "8.0.1" + "dotenv-expand": "8.0.1", + "rimraf": "3.0.2" } }
true
Other
vercel
next.js
8302a3ff7c0075fd57d39bcb841abea6e153ba1b.json
Move `rimraf` from root packages using it (#37996) In a previous PR (#37278), the dependencies for benchmarks were moved to a subdirectory. This ensures the same is done for other packages using `rimraf` which means we can remove it from the root package.json
pnpm-lock.yaml
@@ -144,7 +144,6 @@ importers: release: 6.3.1 request-promise-core: 1.1.2 resolve-from: 5.0.0 - rimraf: 2.6.3 seedrandom: 3.0.5 selenium-webdriver: 4.0.0-beta.4 semver: 7.3.7 @@ -294,7 +293,6 @@ importers: release: 6.3.1 request-promise-core: 1.1.2_request@2....
true
Other
vercel
next.js
5646e43f8347db00a94f5deb103ec45a9a50236f.json
Fix typo for rewrites to rewrite. (#38000)
docs/api-reference/next/server.md
@@ -173,7 +173,7 @@ export function middleware(request: NextRequest) { const { device } = userAgent(request) const viewport = device.type === 'mobile' ? 'mobile' : 'desktop' url.searchParams.set('viewport', viewport) - return NextResponse.rewrites(url) + return NextResponse.rewrite(url) } ```
true
Other
vercel
next.js
5646e43f8347db00a94f5deb103ec45a9a50236f.json
Fix typo for rewrites to rewrite. (#38000)
errors/middleware-upgrade-guide.md
@@ -251,7 +251,7 @@ export function middleware(request: NextRequest) { const url = request.nextUrl const viewport = request.ua.device.type === 'mobile' ? 'mobile' : 'desktop' url.searchParams.set('viewport', viewport) - return NextResponse.rewrites(url) + return NextResponse.rewrite(url) } ``` @@ -266,7 ...
true
Other
vercel
next.js
5646e43f8347db00a94f5deb103ec45a9a50236f.json
Fix typo for rewrites to rewrite. (#38000)
errors/middleware-user-agent.md
@@ -12,7 +12,7 @@ export function middleware(request: NextRequest) { const url = request.nextUrl const viewport = request.ua.device.type === 'mobile' ? 'mobile' : 'desktop' url.searchParams.set('viewport', viewport) - return NextResponse.rewrites(url) + return NextResponse.rewrite(url) } ``` @@ -29,6 +29...
true
Other
vercel
next.js
9cac00dbfbd969d3b5fbe5e1953c1300cd40a5bd.json
Update flakey prefetch test (#37997)
test/production/prerender-prefetch/index.test.ts
@@ -163,14 +163,13 @@ describe('Prerender prefetch', () => { }) // now trigger cache update and navigate again - await browser.elementByCss('#to-blog-first').moveTo() - await check( - () => - requests.some((url) => url.includes('/blog/first.json')) - ? 'success' - : reque...
false
Other
vercel
next.js
f8732d9cd7667129236ecdf7d40f6fd11d69465e.json
Fix flaky `onLoad()` test for `next/image/future` (#37993) This PR fixes flaky `onLoad()` test for `next/image/future`. The test must modify the `src` after hydration to make sure it always works as expected. This is because `next/image/future` uses native lazy loading and sometimes the event fires before hydration ...
docs/api-reference/next/future/image.md
@@ -133,6 +133,14 @@ The callback function will be called with one argument, an object with the follo - [`naturalWidth`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/naturalWidth) - [`naturalHeight`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/naturalHeight) +### onLoad + ...
true
Other
vercel
next.js
f8732d9cd7667129236ecdf7d40f6fd11d69465e.json
Fix flaky `onLoad()` test for `next/image/future` (#37993) This PR fixes flaky `onLoad()` test for `next/image/future`. The test must modify the `src` after hydration to make sure it always works as expected. This is because `next/image/future` uses native lazy loading and sometimes the event fires before hydration ...
test/integration/image-future/default/pages/on-load.js
@@ -2,84 +2,70 @@ import { useState } from 'react' import Image from 'next/future/image' const Page = () => { - // Hoisted state to count each image load callback - const [idToCount, setIdToCount] = useState({}) const [clicked, setClicked] = useState(false) + const red = + 'data:image/png;base64,iVBORw0K...
true
Other
vercel
next.js
f8732d9cd7667129236ecdf7d40f6fd11d69465e.json
Fix flaky `onLoad()` test for `next/image/future` (#37993) This PR fixes flaky `onLoad()` test for `next/image/future`. The test must modify the `src` after hydration to make sure it always works as expected. This is because `next/image/future` uses native lazy loading and sometimes the event fires before hydration ...
test/integration/image-future/default/test/index.test.js
@@ -313,48 +313,31 @@ function runTests(mode) { it('should callback native onLoad in most cases', async () => { let browser = await webdriver(appPort, '/on-load') - for (let i = 1; i < 6; i++) { - await browser.eval( - `document.getElementById("img${i}").scrollIntoView({behavior: "smooth"})` - ...
true
Other
vercel
next.js
a590c4e7f3f515f15a577b4f2c5f57f09eddc3c0.json
docs: return response in code example (#37985) * Update middleware-upgrade-guide.md * lint-fix Co-authored-by: JJ Kasper <jj@jjsweb.site>
errors/middleware-upgrade-guide.md
@@ -218,6 +218,8 @@ export function middleware() { // clear all cookies means mark all of them as expired response.cookies.clear() + + return response } ```
false
Other
vercel
next.js
bee7b31549c5f8ee2410d4969e601578675c2d0c.json
chore: use Node 16 for issue validator action (#37982)
.github/actions/issue-validator/action.yml
@@ -2,5 +2,5 @@ name: Issue validator description: 'Validates bug reports on the Next.js repository' author: 'Vercel' runs: - using: 'node18' + using: 'node16' main: 'index.js'
false
Other
vercel
next.js
f15fb7c65a7353276183065841714bb0099f1104.json
feat(cli): support examples without `package.json` (#37910) Previously our CLI assumed that when using an `--example` flag, the example contains a `package.json` file. There are examples though, like `with-docker-compose` which does not have one. In that case, we can simply clone the directory and show a success messa...
packages/create-next-app/create-app.ts
@@ -9,7 +9,7 @@ import { downloadAndExtractExample, downloadAndExtractRepo, getRepoInfo, - hasExample, + existsInRepo, hasRepo, RepoInfo, } from './helpers/examples' @@ -83,7 +83,7 @@ export async function createApp({ process.exit(1) } } else if (example !== '__internal-testing-re...
true
Other
vercel
next.js
f15fb7c65a7353276183065841714bb0099f1104.json
feat(cli): support examples without `package.json` (#37910) Previously our CLI assumed that when using an `--example` flag, the example contains a `package.json` file. There are examples though, like `with-docker-compose` which does not have one. In that case, we can simply clone the directory and show a success messa...
packages/create-next-app/helpers/examples.ts
@@ -60,12 +60,17 @@ export function hasRepo({ return isUrlOk(contentsUrl + packagePath + `?ref=${branch}`) } -export function hasExample(name: string): Promise<boolean> { - return isUrlOk( - `https://api.github.com/repos/vercel/next.js/contents/examples/${encodeURIComponent( - name - )}/package.json` ...
true
Other
vercel
next.js
f15fb7c65a7353276183065841714bb0099f1104.json
feat(cli): support examples without `package.json` (#37910) Previously our CLI assumed that when using an `--example` flag, the example contains a `package.json` file. There are examples though, like `with-docker-compose` which does not have one. In that case, we can simply clone the directory and show a success messa...
test/integration/create-next-app/index.test.ts
@@ -99,6 +99,24 @@ describe('create next app', () => { }) }) + it('valid example without package.json', async () => { + await usingTempDir(async (cwd) => { + const projectName = 'valid-example-without-package-json' + const res = await run([projectName, '--example', 'with-docker-compose'], { + ...
true
Other
vercel
next.js
b04cdc9f2f21912d1235c83544318d14bcb9739f.json
Fix next/head in _app in RSC pages (#37928) * fix next/head in _app with rsc * revert change Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
packages/next/build/webpack-config.ts
@@ -1280,6 +1280,11 @@ export default async function getBaseWebpackConfig( loader: 'next-flight-client-loader', }, }, + // _app should be treated as a client component as well as all its dependencies. + { + test: new...
true
Other
vercel
next.js
b04cdc9f2f21912d1235c83544318d14bcb9739f.json
Fix next/head in _app in RSC pages (#37928) * fix next/head in _app with rsc * revert change Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
test/integration/react-streaming-and-server-components/test/css.js
@@ -9,6 +9,7 @@ export default function (context) { ) expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`) }) + it('should include global styles with `serverComponents: true`', async () => { const browser = await webdriver(context.appPort, '/global-styles-rsc') const currentColor = a...
true
Other
vercel
next.js
b04cdc9f2f21912d1235c83544318d14bcb9739f.json
Fix next/head in _app in RSC pages (#37928) * fix next/head in _app with rsc * revert change Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
test/integration/react-streaming-and-server-components/test/index.test.js
@@ -24,11 +24,17 @@ import streaming from './streaming' import basic from './basic' import { getNodeBuiltinModuleNotSupportedInEdgeRuntimeMessage } from 'next/dist/build/utils' -const appWithGlobalCss = ` +const appWithGlobalCssAndHead = ` import '../styles.css' +import Head from 'next/head' function App({ Comp...
true