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 | cb8da5778ecedf638da477eb0ea91bcae8b74077.json | Replace `withCoalescedInvoke` with `ResponseCache` (#26997)
By itself, `withCoalescedInvoke` with a separate `this.incrementalCache.set(...)` isn't really suitable for streaming responses. Since streaming is asynchronous, updating the cache separately introduces a gap where another origin request for the same resource... | test/integration/root-optional-revalidate/test/index.test.js | @@ -20,21 +20,21 @@ const nextConfig = new File(join(appDir, 'next.config.js'))
let app
let appPort
-const getProps = async (path, expected) => {
+const getProps = async (path) => {
const html = await renderViaHTTP(appPort, path)
const $ = cheerio.load(html)
return JSON.parse($('#props').text())
}
cons... | true |
Other | vercel | next.js | 849a79fbc2cdc346be8e5df1a6c3e5107598b514.json | Prevent timeout when loading routes in development (#25749)
* Prevent timeout when loading routes in development
The new route loader (https://github.com/vercel/next.js/pull/19006) will timeout
loading routes after 3.8s (MS_MAX_IDLE_DELAY), but this can easily happen when
running dev on a large app.
Fixes http... | packages/next/client/route-loader.ts | @@ -149,6 +149,39 @@ function appendScript(
})
}
+// We wait for pages to be built in dev before we start the route transition
+// timeout to prevent an un-necessary hard navigation in development.
+let devBuildPromise: Promise<void> | undefined
+let devBuildResolve: (() => void) | undefined
+
+if (process.env.NO... | false |
Other | vercel | next.js | 655eb5cb5b7e01591c16bc2d3fcba9d5740a5d67.json | Fix tailwind error with Redis example. (#27042) | examples/with-redis/postcss.config.js | @@ -1,6 +1,6 @@
module.exports = {
plugins: {
- '@tailwindcss/jit': {},
+ tailwindcss: {},
autoprefixer: {},
},
} | true |
Other | vercel | next.js | 655eb5cb5b7e01591c16bc2d3fcba9d5740a5d67.json | Fix tailwind error with Redis example. (#27042) | examples/with-redis/tailwind.config.js | @@ -1,4 +1,5 @@
module.exports = {
+ mode: 'jit',
purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
darkMode: false, // or 'media' or 'class'
theme: { | true |
Other | vercel | next.js | 1bcc923439f495a1717421e06af7e64c6003072c.json | Bind sendBeacon to navigator (#26601)
Also ensures that even if the navigator.sendBeacon fails the fetch fallback is used.
Fixes #23856. This is likely, as no reproduction was provided it was not possible to verify if it actually fixes the issue.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Inte... | packages/next/client/performance-relayer.ts | @@ -47,13 +47,26 @@ function onReport(metric: Metric): void {
type: 'application/x-www-form-urlencoded',
})
const vitalsUrl = 'https://vitals.vercel-insights.com/v1/vitals'
- ;(navigator.sendBeacon && navigator.sendBeacon(vitalsUrl, blob)) ||
+ // Navigator has to be bound to ensure it does not e... | false |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/dynamic-routing/pages/[name]/[comment].js | @@ -6,7 +6,7 @@ const $comment = ({ gipQuery }) => {
return (
<>
- <p>
+ <p id="asdf">
I am {query.comment} on {query.name}
</p>
<span>gip {gipQuery && gipQuery.name}</span> | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/dynamic-routing/pages/[name]/comments.js | @@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
const Page = () => {
const router = useRouter()
const { query } = router
- return <p>Show comments for {query.name} here</p>
+ return <p id="asdf">Show comments for {query.name} here</p>
}
Page.getInitialProps = () => ({}) | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/dynamic-routing/pages/[name]/index.js | @@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
const Page = () => {
const router = useRouter()
const { query } = router
- return <p>This is {query.name}</p>
+ return <p id="asdf">This is {query.name}</p>
}
Page.getInitialProps = () => ({}) | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/dynamic-routing/pages/blog/[name]/comment/[id].js | @@ -6,7 +6,7 @@ const Page = () => {
return (
<>
- <p>
+ <p id="asdf">
Blog post {name} comment {id || '(all)'}
</p>
</> | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/dynamic-routing/pages/on-mount/[post].js | @@ -5,7 +5,7 @@ export default () => {
const { query } = router
return (
<>
- <p>onmpost: {query.post || 'pending'}</p>
+ <p id="asdf">onmpost: {query.post || 'pending'}</p>
{Array.from({ length: 500 }, (x, i) => i + 1).map((i) => {
return (
<div key={`item-${i}`} id={`it... | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/dynamic-routing/test/index.test.js | @@ -87,9 +87,9 @@ function runTests(dev) {
try {
browser = await webdriver(appPort, '/')
await browser.elementByCss('#view-post-1').click()
- await browser.waitForElementByCss('p')
+ await browser.waitForElementByCss('#asdf')
- const text = await browser.elementByCss('p').text()
+ ... | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/invalid-href/pages/[post].js | @@ -1 +1,3 @@
-export default () => 'hi from post'
+export default function Page() {
+ return 'hi from post'
+} | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/invalid-href/pages/dynamic-route-mismatch-manual.js | @@ -1,7 +1,9 @@
import Link from 'next/link'
-export default () => (
- <Link href="/[post]?post=post-1" as="/blog/post-1">
- <a>Click me</a>
- </Link>
-)
+export default function Page() {
+ return (
+ <Link href="/[post]?post=post-1" as="/blog/post-1">
+ <a id="click-me">Click me</a>
+ </Link>
+ )
... | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/invalid-href/pages/dynamic-route-mismatch.js | @@ -1,7 +1,9 @@
import Link from 'next/link'
-export default () => (
- <Link href="/[post]" as="/blog/post-1">
- <a>Click me</a>
- </Link>
-)
+export default function Page() {
+ return (
+ <Link href="/[post]" as="/blog/post-1">
+ <a id="click-me">Click me</a>
+ </Link>
+ )
+} | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/invalid-href/pages/first.js | @@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
const invalidLink = 'mailto:idk@idk.com'
-export default () => {
+export default function Page() {
const { query, ...router } = useRouter()
const { method } = query
| true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/invalid-href/pages/index.js | @@ -1,2 +1,4 @@
// page used for loading and installing error catcher
-export default () => <p>Hi 👋</p>
+export default function Page() {
+ return <p>Hi 👋</p>
+} | true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/invalid-href/pages/second.js | @@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
const invalidLink = 'https://google.com/another'
-export default () => {
+export default function Page() {
const { query, ...router } = useRouter()
const { method } = query
| true |
Other | vercel | next.js | b12389598b20852367074f7cde94b6fce52995e3.json | Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co> | test/integration/invalid-href/test/index.test.js | @@ -9,90 +9,92 @@ import {
nextBuild,
nextStart,
waitFor,
+ check,
} from 'next-test-utils'
import webdriver from 'next-webdriver'
import { join } from 'path'
-jest.setTimeout(1000 * 60 * 5)
+jest.setTimeout(1000 * 60 * 2)
+
let app
let appPort
const appDir = join(__dirname, '..')
const firstErrorR... | true |
Other | vercel | next.js | dfee55221c6a85398b41db0ca9f5cae9d078c945.json | Update Fast Refresh full reload warning (#15062)
We've added a Babel warning for unnamed default exports, and this PR addresses the remaining points in #13024.
Fixes #13024 | packages/next/client/dev/error-overlay/hot-dev-client.js | @@ -269,11 +269,11 @@ function tryApplyUpdates(onHotUpdateSuccess) {
if (err) {
console.warn(
'[Fast Refresh] performing full reload\n\n' +
- "Fast Refresh will perform a full reload when you edit a file that's imported by modules outside of the React tree.\n" +
- 'You m... | false |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | packages/next/client/link.tsx | @@ -1,37 +1,23 @@
declare const __NEXT_DATA__: any
import React, { Children } from 'react'
-import { parse, resolve, UrlObject } from 'url'
+import { UrlObject } from 'url'
import { PrefetchOptions, NextRouter } from '../next-server/lib/router/router'
-import {
- execOnce,
- formatWithValidation,
- getLocationO... | true |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | packages/next/client/normalize-trailing-slash.ts | @@ -1,9 +1,16 @@
import { UrlObject } from 'url'
+/**
+ * Removes the trailing slash of a path if there is one. Preserves the root path `/`.
+ */
export function removePathTrailingSlash(path: string): string {
return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path
}
+/**
+ * Normalizes the trail... | true |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | packages/next/client/page-loader.js | @@ -1,8 +1,9 @@
-import { parse } from 'url'
import mitt from '../next-server/lib/mitt'
import { isDynamicRoute } from './../next-server/lib/router/utils/is-dynamic'
import { getRouteMatcher } from './../next-server/lib/router/utils/route-matcher'
import { getRouteRegex } from './../next-server/lib/router/utils/rou... | true |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | packages/next/next-server/lib/router/router.ts | @@ -2,7 +2,7 @@
// tslint:disable:no-console
import { ParsedUrlQuery } from 'querystring'
import { ComponentType } from 'react'
-import { parse, UrlObject } from 'url'
+import { UrlObject } from 'url'
import mitt, { MittEmitter } from '../mitt'
import {
AppContextType,
@@ -15,6 +15,8 @@ import {
import { isDyn... | true |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | packages/next/next-server/lib/router/utils/format-url.ts | @@ -0,0 +1,73 @@
+// Format function modified from nodejs
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// 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... | true |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | packages/next/next-server/lib/router/utils/parse-relative-url.ts | @@ -0,0 +1,24 @@
+const DUMMY_BASE = new URL('http://n')
+
+/**
+ * Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
+ * (e.g. `./hello`) then at least base must be.
+ * Absolute urls are rejected.
+ */
+export function parseRelativeUrl(url: string, base?: string) {
+ const resolvedB... | true |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | packages/next/next-server/lib/router/utils/search-params-to-url-query.ts | @@ -0,0 +1,17 @@
+import { ParsedUrlQuery } from 'querystring'
+
+export function searchParamsToUrlQuery(
+ searchParams: URLSearchParams
+): ParsedUrlQuery {
+ const query: ParsedUrlQuery = {}
+ Array.from(searchParams.entries()).forEach(([key, value]) => {
+ if (typeof query[key] === 'undefined') {
+ query... | true |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | packages/next/next-server/lib/utils.ts | @@ -1,7 +1,8 @@
import { IncomingMessage, ServerResponse } from 'http'
import { ParsedUrlQuery } from 'querystring'
import { ComponentType } from 'react'
-import { format, URLFormatOptions, UrlObject } from 'url'
+import { UrlObject } from 'url'
+import { formatUrl } from './router/utils/format-url'
import { Manife... | true |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | test/integration/build-output/test/index.test.js | @@ -94,26 +94,31 @@ describe('Build Output', () => {
expect(parseFloat(indexSize) - 265).toBeLessThanOrEqual(0)
expect(indexSize.endsWith('B')).toBe(true)
- // should be no bigger than 62 kb
- expect(parseFloat(indexFirstLoad) - 61).toBeLessThanOrEqual(0)
+ // should be no bigger than 60 ... | true |
Other | vercel | next.js | 3369d67bd1bc495462c587ec12c346c3172b0359.json | Replace node.js url module with WHATWG URL (#14827)
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off ab... | test/integration/size-limit/test/index.test.js | @@ -80,7 +80,7 @@ describe('Production response size', () => {
)
// These numbers are without gzip compression!
- const delta = responseSizesBytes - 264 * 1024
+ const delta = responseSizesBytes - 261 * 1024
expect(delta).toBeLessThanOrEqual(1024) // don't increase size more than 1kb
expect(... | true |
Other | vercel | next.js | 272080c9c019106e3cfd3d4c99d4ede1b931eb9e.json | Avoid aggressive state loop (#15068)
/cc @cristianbote | packages/next/client/link.tsx | @@ -218,7 +218,7 @@ function Link(props: React.PropsWithChildren<LinkProps>) {
ref?: any
} = {
ref: (el: any) => {
- setChildElm(el)
+ if (el) setChildElm(el)
if (child && typeof child === 'object' && child.ref) {
if (typeof child.ref === 'function') child.ref(el) | false |
Other | vercel | next.js | 9b711883cfebfce0997cd9fe188a33cd433e9981.json | Update docs about type checking (#15103)
Related to #14997 | docs/basic-features/typescript.md | @@ -43,7 +43,7 @@ You're now ready to start converting files from `.js` to `.tsx` and leveraging t
> Next.js `strict` mode is turned off by default. When you feel comfortable with TypeScript, it's recommended to turn it on in your `tsconfig.json`.
-By default, Next.js reports TypeScript errors during development f... | false |
Other | vercel | next.js | f4f6fea71f761f4069dc5ae3dcbf0c725cb8aad3.json | CNA: replace make-dir with core recursive mkdir (#15006)
Fix #14902
I created a separated helper that wraps `fs.promises.mkdir` and sets `recursive` option to `true` by default.
I'm not sure if this is the right approach (maybe it should just call `fs.promises.mkdir` from `create-app.ts`?), any thoughts? | packages/create-next-app/create-app.ts | @@ -3,7 +3,6 @@ import retry from 'async-retry'
import chalk from 'chalk'
import cpy from 'cpy'
import fs from 'fs'
-import makeDir from 'make-dir'
import os from 'os'
import path from 'path'
import {
@@ -14,6 +13,7 @@ import {
hasRepo,
RepoInfo,
} from './helpers/examples'
+import { makeDir } from './help... | true |
Other | vercel | next.js | f4f6fea71f761f4069dc5ae3dcbf0c725cb8aad3.json | CNA: replace make-dir with core recursive mkdir (#15006)
Fix #14902
I created a separated helper that wraps `fs.promises.mkdir` and sets `recursive` option to `true` by default.
I'm not sure if this is the right approach (maybe it should just call `fs.promises.mkdir` from `create-app.ts`?), any thoughts? | packages/create-next-app/helpers/make-dir.ts | @@ -0,0 +1,8 @@
+import fs from 'fs'
+
+export function makeDir(
+ root: string,
+ options = { recursive: true }
+): Promise<void> {
+ return fs.promises.mkdir(root, options)
+} | true |
Other | vercel | next.js | f4f6fea71f761f4069dc5ae3dcbf0c725cb8aad3.json | CNA: replace make-dir with core recursive mkdir (#15006)
Fix #14902
I created a separated helper that wraps `fs.promises.mkdir` and sets `recursive` option to `true` by default.
I'm not sure if this is the right approach (maybe it should just call `fs.promises.mkdir` from `create-app.ts`?), any thoughts? | packages/create-next-app/package.json | @@ -40,7 +40,6 @@
"cpy": "7.3.0",
"cross-spawn": "6.0.5",
"got": "10.7.0",
- "make-dir": "3.0.0",
"prompts": "2.1.0",
"rimraf": "3.0.0",
"tar": "4.4.10", | true |
Other | vercel | next.js | f4f6fea71f761f4069dc5ae3dcbf0c725cb8aad3.json | CNA: replace make-dir with core recursive mkdir (#15006)
Fix #14902
I created a separated helper that wraps `fs.promises.mkdir` and sets `recursive` option to `true` by default.
I'm not sure if this is the right approach (maybe it should just call `fs.promises.mkdir` from `create-app.ts`?), any thoughts? | yarn.lock | @@ -10153,12 +10153,6 @@ magic-string@^0.25.2, magic-string@^0.25.3:
dependencies:
sourcemap-codec "^1.4.4"
-make-dir@3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.0.0.tgz#1b5f39f6b9270ed33f9f054c5c0f84304989f801"
- dependencies:
- semver "^6.0.0"
-
make-dir@^1... | true |
Other | vercel | next.js | 525fc360ae46e6c5ad8e9ba4b1473a58393b1cb9.json | Exclude node_modules in watchOptions (#15020) | packages/next/build/webpack-config.ts | @@ -711,7 +711,7 @@ export default async function getBaseWebpackConfig(
}
},
watchOptions: {
- ignored: ['.git/**', 'node_modules/**', '.git/**'],
+ ignored: ['**/.git', '**/node_modules'],
},
output: {
path: outputPath, | false |
Other | vercel | next.js | 887d4360432c4a75b59c9f71e6af6c49cb0dcfc6.json | Use HEAD req for isUrlOk check (#14994)
Co-authored-by: Cristian Dominguez <cristiand391@users.noreply.github.com> | packages/create-next-app/helpers/examples.ts | @@ -14,7 +14,7 @@ export type RepoInfo = {
}
export async function isUrlOk(url: string): Promise<boolean> {
- const res = await got(url).catch((e) => e)
+ const res = await got.head(url).catch((e) => e)
return res.statusCode === 200
}
| false |
Other | vercel | next.js | ab4a90b0d987379e2b30d63e6d01c099eeecd568.json | Add filename to error in webpack 5 (#14977)
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com> | packages/next/build/entries.ts | @@ -1,5 +1,5 @@
import chalk from 'next/dist/compiled/chalk'
-import { join } from 'path'
+import { posix, join } from 'path'
import { stringify } from 'querystring'
import { API_ROUTE, DOT_NEXT_ALIAS, PAGES_DIR_ALIAS } from '../lib/constants'
import { __ApiPreviewProps } from '../next-server/server/api-utils'
@@ -... | true |
Other | vercel | next.js | ab4a90b0d987379e2b30d63e6d01c099eeecd568.json | Add filename to error in webpack 5 (#14977)
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com> | packages/next/build/webpack-config.ts | @@ -234,14 +234,16 @@ export default async function getBaseWebpackConfig(
// Backwards compatibility
'main.js': [],
[CLIENT_STATIC_FILES_RUNTIME_MAIN]:
- `.${path.sep}` +
- path.relative(
- dir,
- path.join(
- NEXT_PROJECT_ROOT_DIST_CLIENT,... | true |
Other | vercel | next.js | ab4a90b0d987379e2b30d63e6d01c099eeecd568.json | Add filename to error in webpack 5 (#14977)
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com> | packages/next/client/dev/error-overlay/format-webpack-messages.js | @@ -34,7 +34,7 @@ function isLikelyASyntaxError(message) {
function formatMessage(message) {
// TODO: Replace this once webpack 5 is stable
if (typeof message === 'object' && message.message) {
- message = message.message
+ message = (message.file ? message.file + '\n' : '') + message.message
}
let l... | true |
Other | vercel | next.js | ab4a90b0d987379e2b30d63e6d01c099eeecd568.json | Add filename to error in webpack 5 (#14977)
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com> | packages/next/server/hot-reloader.ts | @@ -2,7 +2,7 @@ import { getOverlayMiddleware } from '@next/react-dev-overlay/lib/middleware'
import { NextHandleFunction } from 'connect'
import { IncomingMessage, ServerResponse } from 'http'
import { WebpackHotMiddleware } from './hot-middleware'
-import { join, normalize, relative as relativePath, sep } from 'pa... | true |
Other | vercel | next.js | ab4a90b0d987379e2b30d63e6d01c099eeecd568.json | Add filename to error in webpack 5 (#14977)
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com> | packages/next/server/on-demand-entry-handler.ts | @@ -167,8 +167,8 @@ export default function onDemandEntryHandler(
pageUrl = pageUrl === '' ? '/' : pageUrl
const bundleFile = normalizePagePath(pageUrl)
- const serverBundlePath = join('pages', bundleFile)
- const clientBundlePath = join('static', 'pages', bundleFile)
+ const serverBundle... | true |
Other | vercel | next.js | ab4a90b0d987379e2b30d63e6d01c099eeecd568.json | Add filename to error in webpack 5 (#14977)
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com> | yarn.lock | @@ -3476,7 +3476,7 @@ anymatch@^2.0.0:
micromatch "^3.1.4"
normalize-path "^2.1.1"
-anymatch@^3.0.3:
+anymatch@^3.0.3, anymatch@~3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142"
dependencies:
@@ -3603,6 +3603,7 @@ ... | true |
Other | vercel | next.js | 61e899f42b8f1be23af2e0f244a1d11130db92d0.json | Fix bug in profiling test (#14921) | test/integration/profiling/test/index.test.js | @@ -4,18 +4,23 @@ import { join } from 'path'
import { nextBuild } from 'next-test-utils'
import fs from 'fs'
const appDir = join(__dirname, '../')
+const profileEventsPath = join(appDir, '.next', 'profile-events.json')
jest.setTimeout(1000 * 60 * 5)
describe('Profiling Usage', () => {
beforeAll(async () => {... | false |
Other | vercel | next.js | 5247807da0a53379997cc514cd8c93b53ae005f7.json | Add Prisma.io Examples List (#14917) | examples/with-prisma/README.md | @@ -0,0 +1,5 @@
+Prisma.io maintains it's own Next.Js examples
+
+- [Javascript](https://github.com/prisma/prisma-examples/tree/master/javascript/rest-nextjs)
+- [Typescript](https://github.com/prisma/prisma-examples/tree/master/typescript/rest-nextjs)
+- [Typescript-GraphQL](https://github.com/prisma/prisma-examples/t... | false |
Other | vercel | next.js | 3623d444c1838db89e713fa6a354c8aa0e91d610.json | Fix basepath browser back/forward issue (#14861)
Discovered while working on https://github.com/vercel/next.js/pull/14848
when asPath is the same but href is different it should use `replaceState` instead of `pushState`, so that browser back/forward behavior is preserved. Currently it's comparing a path that includes... | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -172,7 +172,7 @@ const nextServerlessLoader: loader.Loader = function () {
const handleBasePath = basePath
? `
// always strip the basePath if configured since it is required
- req.url = req.url.replace(new RegExp('^${basePath}'), '')
+ req.url = req.url.replace(new RegExp('^${basePath}'), '') || ... | true |
Other | vercel | next.js | 3623d444c1838db89e713fa6a354c8aa0e91d610.json | Fix basepath browser back/forward issue (#14861)
Discovered while working on https://github.com/vercel/next.js/pull/14848
when asPath is the same but href is different it should use `replaceState` instead of `pushState`, so that browser back/forward behavior is preserved. Currently it's comparing a path that includes... | packages/next/next-server/lib/router/router.ts | @@ -465,18 +465,19 @@ export default class Router implements BaseRouter {
return resolve(false)
}
+ const cleanedAs = delBasePath(as)
+
// If asked to change the current URL we should reload the current page
// (not location.reload() but reload getInitialProps and other Next.js stuf... | true |
Other | vercel | next.js | 3623d444c1838db89e713fa6a354c8aa0e91d610.json | Fix basepath browser back/forward issue (#14861)
Discovered while working on https://github.com/vercel/next.js/pull/14848
when asPath is the same but href is different it should use `replaceState` instead of `pushState`, so that browser back/forward behavior is preserved. Currently it's comparing a path that includes... | test/integration/basepath/pages/hello.js | @@ -58,5 +58,8 @@ export default () => (
>
click me for error
</div>
+ <Link href="/something-else" as="/hello">
+ <a id="something-else-link">to something else</a>
+ </Link>
</>
) | true |
Other | vercel | next.js | 3623d444c1838db89e713fa6a354c8aa0e91d610.json | Fix basepath browser back/forward issue (#14861)
Discovered while working on https://github.com/vercel/next.js/pull/14848
when asPath is the same but href is different it should use `replaceState` instead of `pushState`, so that browser back/forward behavior is preserved. Currently it's comparing a path that includes... | test/integration/basepath/pages/index.js | @@ -1,4 +1,5 @@
import { useRouter } from 'next/router'
+import Link from 'next/link'
export const getStaticProps = () => {
return {
@@ -13,10 +14,14 @@ export default function Index({ hello, nested }) {
const { query, pathname } = useRouter()
return (
<>
+ <h1 id="index-page">index page</h1>
... | true |
Other | vercel | next.js | 3623d444c1838db89e713fa6a354c8aa0e91d610.json | Fix basepath browser back/forward issue (#14861)
Discovered while working on https://github.com/vercel/next.js/pull/14848
when asPath is the same but href is different it should use `replaceState` instead of `pushState`, so that browser back/forward behavior is preserved. Currently it's comparing a path that includes... | test/integration/basepath/pages/something-else.js | @@ -0,0 +1,3 @@
+export default function Page() {
+ return <h1 id="something-else-page">something else</h1>
+} | true |
Other | vercel | next.js | 3623d444c1838db89e713fa6a354c8aa0e91d610.json | Fix basepath browser back/forward issue (#14861)
Discovered while working on https://github.com/vercel/next.js/pull/14848
when asPath is the same but href is different it should use `replaceState` instead of `pushState`, so that browser back/forward behavior is preserved. Currently it's comparing a path that includes... | test/integration/basepath/test/index.test.js | @@ -390,6 +390,22 @@ const runTests = (context, dev = false) => {
await browser.close()
}
})
+
+ it('should correctly replace state when same asPath but different url', async () => {
+ const browser = await webdriver(context.appPort, '/docs')
+ try {
+ await browser.elementByCss('#hello-link'... | true |
Other | vercel | next.js | 33234ca1f1db41def6ea78d0fc220b40c4d3f785.json | Attach previewData to API Route request (#13373)
Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: Tim Neutkens <timneutkens@me.com> | packages/next/next-server/lib/utils.ts | @@ -199,6 +199,12 @@ export interface NextApiRequest extends IncomingMessage {
body: any
env: Env
+
+ preview?: boolean
+ /**
+ * Preview data set on the request, if any
+ * */
+ previewData?: any
}
/** | true |
Other | vercel | next.js | 33234ca1f1db41def6ea78d0fc220b40c4d3f785.json | Attach previewData to API Route request (#13373)
Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: Tim Neutkens <timneutkens@me.com> | packages/next/next-server/server/api-utils.ts | @@ -46,7 +46,16 @@ export async function apiResolver(
setLazyProp({ req: apiReq }, 'cookies', getCookieParser(req))
// Parsing query string
setLazyProp({ req: apiReq, params }, 'query', getQueryParser(req))
- // // Parsing of body
+ // Parsing preview data
+ setLazyProp({ req: apiReq }, 'preview... | true |
Other | vercel | next.js | 33234ca1f1db41def6ea78d0fc220b40c4d3f785.json | Attach previewData to API Route request (#13373)
Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: Tim Neutkens <timneutkens@me.com> | test/integration/prerender-preview/pages/api/read.js | @@ -0,0 +1,7 @@
+export default (req, res) => {
+ const { preview, previewData } = req
+ res.json({
+ preview,
+ previewData,
+ })
+} | true |
Other | vercel | next.js | 33234ca1f1db41def6ea78d0fc220b40c4d3f785.json | Attach previewData to API Route request (#13373)
Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: Tim Neutkens <timneutkens@me.com> | test/integration/prerender-preview/test/index.test.js | @@ -182,6 +182,27 @@ function runTests(startServer = nextStart) {
expect(cookies[1]).not.toHaveProperty('Max-Age')
})
+ it('should pass undefined to API routes when not in preview', async () => {
+ const res = await fetchViaHTTP(appPort, `/api/read`)
+ const json = await res.json()
+
+ expect(json).... | true |
Other | vercel | next.js | 6fe1260b5f8c4aaa9f0811e8a3aaa5b3798037fd.json | Add basePath documentation (#14882)
Fixes #14453 | docs/api-reference/next.config.js/basepath.md | @@ -0,0 +1,43 @@
+---
+description: Learn more about setting a base path in Next.js
+---
+
+# Base Path
+
+To deploy a Next.js application under a sub-path of a domain you can use the `basePath` option.
+
+`basePath` allows you to set a path prefix for the application. For example `/docs` instead of `/` (the default).
... | true |
Other | vercel | next.js | 6fe1260b5f8c4aaa9f0811e8a3aaa5b3798037fd.json | Add basePath documentation (#14882)
Fixes #14453 | docs/manifest.json | @@ -227,6 +227,10 @@
"title": "Environment Variables",
"path": "/docs/api-reference/next.config.js/environment-variables.md"
},
+ {
+ "title": "Base Path",
+ "path": "/docs/api-reference/next.config.js/basepath.md"
+ },
... | true |
Other | vercel | next.js | 55bfafc8a7d65c16c16c6e0c94bc9d7f500d0ba7.json | Add webpack peerdependency to react-dev-overlay (#14842) | packages/react-dev-overlay/package.json | @@ -28,6 +28,7 @@
"strip-ansi": "6.0.0"
},
"peerDependencies": {
+ "webpack": "^4|^5",
"react": "^16.9.0",
"react-dom": "^16.9.0"
} | true |
Other | vercel | next.js | 55bfafc8a7d65c16c16c6e0c94bc9d7f500d0ba7.json | Add webpack peerdependency to react-dev-overlay (#14842) | packages/react-refresh-utils/package.json | @@ -20,7 +20,7 @@
},
"peerDependencies": {
"react-refresh": "0.8.3",
- "webpack": "^4"
+ "webpack": "^4|^5"
},
"devDependencies": {
"react-refresh": "0.8.3" | true |
Other | vercel | next.js | cdc4ee3615846c10ebffadcb507cf714944f30b9.json | Ensure browserslist extends works properly (#33890)
* Ensure browserslist extends works properly
* add comment | packages/next/compiled/browserslist/index.js | @@ -1 +1 @@
-(()=>{var e={446:e=>{function BrowserslistError(e){this.name="BrowserslistError";this.message=e;this.browserslist=true;if(Error.captureStackTrace){Error.captureStackTrace(this,BrowserslistError)}}BrowserslistError.prototype=Error.prototype;e.exports=BrowserslistError},567:(e,s,r)=>{var n=r(945);var t=r(768... | true |
Other | vercel | next.js | cdc4ee3615846c10ebffadcb507cf714944f30b9.json | Ensure browserslist extends works properly (#33890)
* Ensure browserslist extends works properly
* add comment | packages/next/taskfile.js | @@ -310,10 +310,26 @@ export async function ncc_chalk(task, opts) {
// eslint-disable-next-line camelcase
externals['browserslist'] = 'next/dist/compiled/browserslist'
export async function ncc_browserslist(task, opts) {
+ const browserslistModule = require.resolve('browserslist')
+ const nodeFile = join(dirname(b... | true |
Other | vercel | next.js | cdc4ee3615846c10ebffadcb507cf714944f30b9.json | Ensure browserslist extends works properly (#33890)
* Ensure browserslist extends works properly
* add comment | test/e2e/browserslist-extends/index.test.ts | @@ -0,0 +1,38 @@
+import { createNext } from 'e2e-utils'
+import { NextInstance } from 'test/lib/next-modes/base'
+import { renderViaHTTP } from 'next-test-utils'
+
+describe('browserslist-extends', () => {
+ let next: NextInstance
+
+ beforeAll(async () => {
+ next = await createNext({
+ files: {
+ 'p... | true |
Other | vercel | next.js | 6dfe02d22fda61158e30bcd2943946bcc12ef9b5.json | Optimize offline condition judgment (#33238)
* perf: optimize offline condition judgment
* lint-fix
Co-authored-by: JJ Kasper <jj@jjsweb.site> | packages/create-next-app/helpers/install.ts | @@ -69,16 +69,13 @@ export function install(
* install`.
*/
args = ['install']
- if (useYarn) {
- if (!isOnline) {
- console.log(chalk.yellow('You appear to be offline.'))
+ if (!isOnline) {
+ console.log(chalk.yellow('You appear to be offline.'))
+ if (use... | true |
Other | vercel | next.js | 6dfe02d22fda61158e30bcd2943946bcc12ef9b5.json | Optimize offline condition judgment (#33238)
* perf: optimize offline condition judgment
* lint-fix
Co-authored-by: JJ Kasper <jj@jjsweb.site> | packages/next-codemod/lib/install.ts | @@ -69,16 +69,13 @@ export function install(
* install`.
*/
args = ['install']
- if (useYarn) {
- if (!isOnline) {
- console.log(chalk.yellow('You appear to be offline.'))
+ if (!isOnline) {
+ console.log(chalk.yellow('You appear to be offline.'))
+ if (use... | true |
Other | vercel | next.js | 6dfe02d22fda61158e30bcd2943946bcc12ef9b5.json | Optimize offline condition judgment (#33238)
* perf: optimize offline condition judgment
* lint-fix
Co-authored-by: JJ Kasper <jj@jjsweb.site> | packages/next/lib/helpers/install.ts | @@ -69,16 +69,13 @@ export function install(
* install`.
*/
args = ['install']
- if (useYarn) {
- if (!isOnline) {
- console.log(chalk.yellow('You appear to be offline.'))
+ if (!isOnline) {
+ console.log(chalk.yellow('You appear to be offline.'))
+ if (use... | true |
Other | vercel | next.js | 0fa95da53f859a8a484c55b02b5244e951e0ad9e.json | Encapsulate routing and initial hydration (#33875)
* Encapsulate initial rendering
* Run dev code before rendering
* Fix call
* Try reverting last change, fixing call | packages/next/client/dev/fouc.js | @@ -1,17 +0,0 @@
-// This function is used to remove Next.js' no-FOUC styles workaround for using
-// `style-loader` in development. It must be called before hydration, or else
-// rendering won't have the correct computed values in effects.
-export function displayContent(callback) {
- ;(window.requestAnimationFrame ... | true |
Other | vercel | next.js | 0fa95da53f859a8a484c55b02b5244e951e0ad9e.json | Encapsulate routing and initial hydration (#33875)
* Encapsulate initial rendering
* Run dev code before rendering
* Fix call
* Try reverting last change, fixing call | packages/next/client/dev/fouc.ts | @@ -0,0 +1,18 @@
+// This function is used to remove Next.js' no-FOUC styles workaround for using
+// `style-loader` in development. It must be called before hydration, or else
+// rendering won't have the correct computed values in effects.
+export function displayContent(): Promise<void> {
+ return new Promise((reso... | true |
Other | vercel | next.js | 0fa95da53f859a8a484c55b02b5244e951e0ad9e.json | Encapsulate routing and initial hydration (#33875)
* Encapsulate initial rendering
* Run dev code before rendering
* Fix call
* Try reverting last change, fixing call | packages/next/client/index.tsx | @@ -271,7 +271,9 @@ class Container extends React.Component<{
export const emitter: MittEmitter<string> = mitt()
let CachedComponent: React.ComponentType
-export async function initNext(opts: { webpackHMR?: any } = {}) {
+export async function initNext(
+ opts: { webpackHMR?: any; beforeRender?: () => Promise<void... | true |
Other | vercel | next.js | 0fa95da53f859a8a484c55b02b5244e951e0ad9e.json | Encapsulate routing and initial hydration (#33875)
* Encapsulate initial rendering
* Run dev code before rendering
* Fix call
* Try reverting last change, fixing call | packages/next/client/next-dev.js | @@ -47,8 +47,8 @@ window.next = {
render,
renderError,
}
-initNext({ webpackHMR })
- .then(({ renderCtx }) => {
+initNext({ webpackHMR, beforeRender: displayContent })
+ .then(() => {
initOnDemandEntries()
let buildIndicatorHandler = () => {}
@@ -104,11 +104,6 @@ initNext({ webpackHMR })
b... | true |
Other | vercel | next.js | e0095faf23797d537a2ce9cbc57235cf9306931c.json | fix(next/image): render valid html according to W3C (#33825)
## Bug
- [x] Fixes #33809
- [x] Related to #33218
- [x] Integration tests added: Usage of [html-validator](https://www.npmjs.com/package/html-validator) to validate the HTML.
- [x] Errors have helpful link attached, see `contributing.md` (N/A) | package.json | @@ -56,6 +56,7 @@
"@testing-library/react": "11.2.5",
"@types/cheerio": "0.22.16",
"@types/fs-extra": "8.1.0",
+ "@types/html-validator": "5.0.2",
"@types/http-proxy": "1.17.3",
"@types/jest": "24.0.13",
"@types/node": "13.11.0",
@@ -112,6 +113,7 @@
"get-port": "5.1.1",
"glob"... | true |
Other | vercel | next.js | e0095faf23797d537a2ce9cbc57235cf9306931c.json | fix(next/image): render valid html according to W3C (#33825)
## Bug
- [x] Fixes #33809
- [x] Related to #33218
- [x] Integration tests added: Usage of [html-validator](https://www.npmjs.com/package/html-validator) to validate the HTML.
- [x] Errors have helpful link attached, see `contributing.md` (N/A) | packages/next/client/image.tsx | @@ -605,8 +605,7 @@ export default function Image({
wrapperStyle.maxWidth = '100%'
hasSizer = true
sizerStyle.maxWidth = '100%'
- // url encoded svg is a little bit shorten than base64 encoding
- sizerSvgUrl = `data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 version=%271.... | true |
Other | vercel | next.js | e0095faf23797d537a2ce9cbc57235cf9306931c.json | fix(next/image): render valid html according to W3C (#33825)
## Bug
- [x] Fixes #33809
- [x] Related to #33218
- [x] Integration tests added: Usage of [html-validator](https://www.npmjs.com/package/html-validator) to validate the HTML.
- [x] Errors have helpful link attached, see `contributing.md` (N/A) | test/integration/image-component/default/pages/_document.js | @@ -0,0 +1,13 @@
+import { Html, Head, Main, NextScript } from 'next/document'
+
+export default function Document() {
+ return (
+ <Html lang="en">
+ <Head />
+ <body>
+ <Main />
+ <NextScript />
+ </body>
+ </Html>
+ )
+} | true |
Other | vercel | next.js | e0095faf23797d537a2ce9cbc57235cf9306931c.json | fix(next/image): render valid html according to W3C (#33825)
## Bug
- [x] Fixes #33809
- [x] Related to #33218
- [x] Integration tests added: Usage of [html-validator](https://www.npmjs.com/package/html-validator) to validate the HTML.
- [x] Errors have helpful link attached, see `contributing.md` (N/A) | test/integration/image-component/default/pages/valid-html-w3c.js | @@ -0,0 +1,20 @@
+import Head from 'next/head'
+import Image from 'next/image'
+
+const Page = () => {
+ return (
+ <div>
+ <Head>
+ <title>Title</title>
+ <meta name="description" content="Description..." />
+ <link rel="icon" type="image/jpeg" href="/test.jpg" />
+ </Head>
+
+ ... | true |
Other | vercel | next.js | e0095faf23797d537a2ce9cbc57235cf9306931c.json | fix(next/image): render valid html according to W3C (#33825)
## Bug
- [x] Fixes #33809
- [x] Related to #33218
- [x] Integration tests added: Usage of [html-validator](https://www.npmjs.com/package/html-validator) to validate the HTML.
- [x] Errors have helpful link attached, see `contributing.md` (N/A) | test/integration/image-component/default/test/index.test.js | @@ -1,6 +1,7 @@
/* eslint-env jest */
import cheerio from 'cheerio'
+import validateHTML from 'html-validator'
import {
check,
findPort,
@@ -1039,6 +1040,26 @@ function runTests(mode) {
}
}
})
+
+ it('should be valid W3C HTML', async () => {
+ let browser
+ try {
+ browser = await ... | true |
Other | vercel | next.js | e0095faf23797d537a2ce9cbc57235cf9306931c.json | fix(next/image): render valid html according to W3C (#33825)
## Bug
- [x] Fixes #33809
- [x] Related to #33218
- [x] Integration tests added: Usage of [html-validator](https://www.npmjs.com/package/html-validator) to validate the HTML.
- [x] Errors have helpful link attached, see `contributing.md` (N/A) | yarn.lock | @@ -2487,6 +2487,21 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
+"@eslint/eslintrc@^0.4.3":
+ version "0.4.3"
+ resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c"
+ integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzce... | true |
Other | vercel | next.js | 4f5975ffc49967f49acb7ea595b75723aa1356df.json | Doc: fix broken link to api routes doc (#33836)
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for ... | examples/api-routes-graphql/README.md | @@ -1,6 +1,6 @@
# API routes with GraphQL server
-Next.js ships with [API routes](https://github.com/vercel/next.js#api-routes), which provide an easy solution to build your own `API`. This example shows their usage alongside [apollo-server-micro](https://github.com/apollographql/apollo-server/tree/main/packages/apo... | false |
Other | vercel | next.js | 66af3cee556945f29cdf5178430d3827282cda66.json | Improve tests for streaming and server components (#33740)
Reorganizes the existing tests as they're getting longer.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature ... | test/integration/react-streaming-and-server-components/test/index.test.js | @@ -1,6 +1,5 @@
/* eslint-env jest */
-import cheerio from 'cheerio'
import { join } from 'path'
import fs from 'fs-extra'
import webdriver from 'next-webdriver'
@@ -14,10 +13,11 @@ import {
nextBuild as _nextBuild,
nextStart as _nextStart,
renderViaHTTP,
- check,
} from 'next-test-utils'
import css... | true |
Other | vercel | next.js | 66af3cee556945f29cdf5178430d3827282cda66.json | Improve tests for streaming and server components (#33740)
Reorganizes the existing tests as they're getting longer.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature ... | test/integration/react-streaming-and-server-components/test/rsc.js | @@ -0,0 +1,75 @@
+/* eslint-env jest */
+import webdriver from 'next-webdriver'
+import cheerio from 'cheerio'
+import { renderViaHTTP, check } from 'next-test-utils'
+
+export default function (context) {
+ it('should render server components correctly', async () => {
+ const homeHTML = await renderViaHTTP(context... | true |
Other | vercel | next.js | 66af3cee556945f29cdf5178430d3827282cda66.json | Improve tests for streaming and server components (#33740)
Reorganizes the existing tests as they're getting longer.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature ... | test/integration/react-streaming-and-server-components/test/streaming.js | @@ -0,0 +1,107 @@
+/* eslint-env jest */
+import webdriver from 'next-webdriver'
+import { fetchViaHTTP } from 'next-test-utils'
+
+async function resolveStreamResponse(response, onData) {
+ let result = ''
+ onData = onData || (() => {})
+ await new Promise((resolve) => {
+ response.body.on('data', (chunk) => {
... | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | packages/next-swc/crates/napi/src/lib.rs | @@ -44,7 +44,7 @@ mod bundle;
mod minify;
mod transform;
mod util;
-
+mod parse;
static COMPILER: Lazy<Arc<Compiler>> = Lazy::new(|| {
let cm = Arc::new(SourceMap::new(FilePathMapping::empty()));
@@ -68,6 +68,8 @@ fn init(mut exports: JsObject) -> napi::Result<()> {
exports.create_named_method("minify... | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | packages/next-swc/crates/napi/src/parse.rs | @@ -0,0 +1,70 @@
+use crate::util::{deserialize_json, CtxtExt, MapErr};
+use anyhow::Context as _;
+use napi::{CallContext, Either, Env, JsObject, JsString, JsUndefined, Task};
+use std::sync::Arc;
+use swc::{config::ParseOptions, try_with_handler};
+use swc_common::{FileName, FilePathMapping, SourceMap};
+
+pub struct... | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | packages/next/build/swc/index.js | @@ -72,6 +72,9 @@ async function loadWasm() {
minify(src, options) {
return Promise.resolve(bindings.minifySync(src.toString(), options))
},
+ parse(src, options) {
+ return Promise.resolve(bindings.parse(src.toString(), options))
+ },
}
return wasmBindi... | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | packages/next/build/swc/options.js | @@ -5,7 +5,7 @@ const regeneratorRuntimePath = require.resolve(
'next/dist/compiled/regenerator-runtime'
)
-function getBaseSWCOptions({
+export function getBaseSWCOptions({
filename,
jest,
development,
@@ -45,9 +45,9 @@ function getBaseSWCOptions({
pragma: 'React.createElement',
pr... | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | packages/next/build/webpack/loaders/next-flight-client-loader.ts | @@ -5,29 +5,16 @@
* LICENSE file in the root directory of this source tree.
*/
-import * as acorn from 'next/dist/compiled/acorn'
-
-type ResolveContext = {
- conditions: Array<string>
- parentURL: string | void
-}
-
-type ResolveFunction = (
- specifier: string,
- context: ResolveContext,
- resolve: Resolve... | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | packages/next/build/webpack/loaders/next-flight-server-loader.ts | @@ -1,4 +1,8 @@
-import * as acorn from 'next/dist/compiled/acorn'
+// TODO: add ts support for next-swc api
+// @ts-ignore
+import { parse } from '../../swc'
+// @ts-ignore
+import { getBaseSWCOptions } from '../../swc/options'
import { getRawPageExtensions } from '../../utils'
function isClientComponent(importSou... | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | test/integration/react-streaming-and-server-components/app/components/client-exports-all.client.js | @@ -0,0 +1 @@
+export * from './client-exports' | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | test/integration/react-streaming-and-server-components/app/components/client-exports-all.js | @@ -0,0 +1,20 @@
+export * from './client-exports'
+
+// TODO: add exports all test case in pages
+/**
+
+import * as all from '../components/client-exports-all'
+import * as allClient from '../components/client-exports-all.client'
+
+export default function Page() {
+ const { a, b, c, d, e } = all
+ const { a: ac, b... | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | test/integration/react-streaming-and-server-components/app/components/client-exports.js | @@ -0,0 +1,10 @@
+const a = 'a'
+const b = 'b'
+const _c = 'c'
+const _d = 'd'
+const _e = 'e'
+const _eArr = [_e]
+
+export const c = _c
+export { a, b }
+export { _d as d, _eArr as e } | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | test/integration/react-streaming-and-server-components/app/pages/client-exports-all.server.js | @@ -0,0 +1,25 @@
+import * as all from '../components/client-exports-all'
+import * as allClient from '../components/client-exports-all.client'
+
+export default function Page() {
+ const { a, b, c, d, e } = all
+ const { a: ac, b: bc, c: cc, d: dc, e: ec } = allClient
+ return (
+ <div>
+ <div id="server">
... | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | test/integration/react-streaming-and-server-components/app/pages/client-exports.server.js | @@ -0,0 +1,13 @@
+import { a, b, c, d, e } from '../components/client-exports'
+
+export default function Page() {
+ return (
+ <div>
+ {a}
+ {b}
+ {c}
+ {d}
+ {e[0]}
+ </div>
+ )
+} | true |
Other | vercel | next.js | 3bda6e66b64707702c9501fdb87b991386b4b977.json | Use swc parse for flight server and client loaders (#33713)
* Add `parse` method for next-swc
* Use shared next-swc to parse rsc components AST
* Remove the invalid case of parsing `ExportAllDecalaration` (we didn't support it well before, so I deleted. need to support later)
Co-authored-by: Donny/강동윤 <29931815+kdy1... | test/integration/react-streaming-and-server-components/test/index.test.js | @@ -400,6 +400,19 @@ async function runBasicTests(context, env) {
expect(imageTag.attr('src')).toContain('data:image')
})
+ it('should handle multiple named exports correctly', async () => {
+ const clientExportsHTML = await renderViaHTTP(
+ context.appPort,
+ '/client-exports'
+ )
+ const... | true |
Other | vercel | next.js | 7e95e300633467dd9f3e99d0e3269c7b5b28c271.json | fix: allow certain variable names in development (#33638)
Fixes #24570
A few variable names (listed https://github.com/vercel/next.js/issues/24570#issuecomment-828721019) were causing problems when using `next dev`.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors ... | packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts | @@ -17,67 +17,70 @@ declare const module: {
// This function gets unwrapped into global scope, which is why we don't invert
// if-blocks. Also, you cannot use `return`.
export default function () {
- // Legacy CSS implementations will `eval` browser code in a Node.js context
- // to extract CSS. For backwards comp... | true |
Other | vercel | next.js | 7e95e300633467dd9f3e99d0e3269c7b5b28c271.json | fix: allow certain variable names in development (#33638)
Fixes #24570
A few variable names (listed https://github.com/vercel/next.js/issues/24570#issuecomment-828721019) were causing problems when using `next dev`.
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors ... | test/development/acceptance/ReactRefreshModule.test.ts | @@ -0,0 +1,44 @@
+import { createNext } from 'e2e-utils'
+import { NextInstance } from 'test/lib/next-modes/base'
+import { sandbox } from './helpers'
+
+describe('ReactRefreshModule', () => {
+ let next: NextInstance
+
+ beforeAll(async () => {
+ next = await createNext({
+ files: {},
+ skipStart: true,... | true |
Other | vercel | next.js | 311f66ead6658d8b12021dcab5f55b97c956fcde.json | fix syntax error in `lock.yml` | .github/workflows/lock.yml | @@ -18,7 +18,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v3
- github-token: ${{ secrets.LOCK_TOKEN }}
- issue-inactive-days: 30
- issue-comment: 'This issue has been automatically locked due to no recent activity. If you are running into a similar issue, p... | false |
Other | vercel | next.js | 4916aa1ef82ae24a2d66a0a8ad107c1d21031fc6.json | fix: use github action instead of bot (#33718)
* fix: use github action instead of bot
* add personal access tokens to avoid rate limiting
* Update .github/workflows/lock.yml
Co-authored-by: Steven <steven@ceriously.com>
* add cron comments
Co-authored-by: Steven <steven@ceriously.com> | .github/lock.yml | @@ -1,6 +0,0 @@
-# Configuration for lock-threads - https://github.com/dessant/lock-threads
-
-# Number of days of inactivity before a closed issue or pull request is locked
-daysUntilLock: 30
-# Comment to post before locking. Set to `false` to disable
-lockComment: 'This issue has been automatically locked due to no ... | true |
Other | vercel | next.js | 4916aa1ef82ae24a2d66a0a8ad107c1d21031fc6.json | fix: use github action instead of bot (#33718)
* fix: use github action instead of bot
* add personal access tokens to avoid rate limiting
* Update .github/workflows/lock.yml
Co-authored-by: Steven <steven@ceriously.com>
* add cron comments
Co-authored-by: Steven <steven@ceriously.com> | .github/workflows/lock.yml | @@ -0,0 +1,24 @@
+name: 'Lock Threads'
+
+on:
+ schedule:
+ # This runs every hour: https://crontab.guru/every-1-hour
+ - cron: '0 * * * *'
+ workflow_dispatch:
+
+permissions:
+ issues: write
+ pull-requests: write
+
+concurrency:
+ group: lock
+
+jobs:
+ action:
+ runs-on: ubuntu-latest
+ steps:
+ ... | true |
Other | vercel | next.js | 4916aa1ef82ae24a2d66a0a8ad107c1d21031fc6.json | fix: use github action instead of bot (#33718)
* fix: use github action instead of bot
* add personal access tokens to avoid rate limiting
* Update .github/workflows/lock.yml
Co-authored-by: Steven <steven@ceriously.com>
* add cron comments
Co-authored-by: Steven <steven@ceriously.com> | .github/workflows/stale.yml | @@ -2,6 +2,7 @@ name: 'Stale issue handler'
on:
workflow_dispatch:
schedule:
+ # This runs every day 20 minutes before midnight: https://crontab.guru/#40_23_*_*_*
- cron: '40 23 * * *'
jobs:
@@ -12,10 +13,12 @@ jobs:
id: stale
name: 'Close stale issues with no reproduction'
... | true |
Other | vercel | next.js | a0275f27508d5d726d8afb9ef472068b66f3484c.json | Update Time to First Byte (TTFB) link (#33715)
The initial link was showing 404 not found
## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
## Feature
- [ ] Implements an existing feature request or RFC. Make sure... | docs/basic-features/data-fetching/get-server-side-props.md | @@ -33,7 +33,7 @@ The [`getServerSideProps` API reference](/docs/api-reference/data-fetching/get-s
## When should I use getServerSideProps
-You should use `getServerSideProps` only if you need to pre-render a page whose data must be fetched at request time. [Time to First Byte (TTFB)](/learn/seo/web-performance) w... | false |
Other | vercel | next.js | c385d1b8c446b60c60ffe3fbdf4818b3e760e1c0.json | REMOVE: duplicate key in docs/testing.md (#33681)
There is a duplicate key, `testEnvironment` in one of the examples that are located in docs/testing.md.
In my humble opinion, It is not good to have an error in examples.
My suggestion is we have only one key and it is up to developers what options they have for the `t... | docs/testing.md | @@ -341,7 +341,6 @@ module.exports = {
'/node_modules/',
'^.+\\.module\\.(css|sass|scss)$',
],
- testEnvironment: 'jest-environment-jsdom',
}
```
| false |
Other | vercel | next.js | 76673fd880859103c20d9dc880da971e16b9294f.json | Update graphql-hooks with memcache (#14364)
Today the https://github.com/nearform/graphql-hooks/commit/cd4178b53ed20d220fa0e01ba498af6b86bfca35 of graphl-hooks and graphl-hooks-memcache has been released, which fixes the problem with Safari. | examples/with-graphql-hooks/package.json | @@ -8,8 +8,8 @@
},
"license": "ISC",
"dependencies": {
- "graphql-hooks": "^4.4.4",
- "graphql-hooks-memcache": "1.3.1 || ^1.3.3",
+ "graphql-hooks": "^4.5.0",
+ "graphql-hooks-memcache": "^1.3.3",
"next": "latest",
"prop-types": "^15.7.2",
"react": "^16.8.2", | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.