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 | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/components/Navbar.js | @@ -0,0 +1,80 @@
+import Link from 'next/link'
+import { useUser } from '../lib/hooks'
+
+export default function Navbar() {
+ const [user, { mutate }] = useUser()
+
+ async function handleLogout() {
+ await fetch('/api/logout')
+ mutate({ user: null })
+ }
+
+ return (
+ <header>
+ <nav>
+ <ul... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/lib/db.js | @@ -0,0 +1,32 @@
+export function getAllUsers(req) {
+ // For demo purpose only. You are not likely to have to return all users.
+ return req.session.users
+}
+
+export function createUser(req, user) {
+ // Here you should insert the user into the database
+ // await db.createUser(user)
+ req.session.users.push(us... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/lib/hooks.jsx | @@ -0,0 +1,11 @@
+import useSWR from 'swr'
+
+export const fetcher = url => fetch(url).then(r => r.json())
+
+export function useUser() {
+ const { data, mutate } = useSWR('/api/user', fetcher)
+ // if data is not defined, the query has not completed
+ const loading = !data
+ const user = data?.user
+ return [user... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/lib/passport.js | @@ -0,0 +1,33 @@
+import passport from 'passport'
+import LocalStrategy from 'passport-local'
+import { findUserByUsername } from './db'
+
+passport.serializeUser(function(user, done) {
+ // serialize the username into session
+ done(null, user.username)
+})
+
+passport.deserializeUser(function(req, id, done) {
+ //... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/lib/session.js | @@ -0,0 +1,32 @@
+import { parse, serialize } from 'cookie'
+import Iron from '@hapi/iron'
+
+export default function session({ name, secret, cookie: cookieOpts }) {
+ return async (req, res, next) => {
+ const cookie = req.headers?.cookie ? parse(req.headers.cookie) : null
+ let unsealed
+ if (cookie?.[name]... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/middleware/auth.js | @@ -0,0 +1,28 @@
+import nextConnect from 'next-connect'
+import passport from '../lib/passport'
+import session from '../lib/session'
+
+const auth = nextConnect()
+ .use(
+ session({
+ name: 'sess',
+ secret: 'some_not_random_password_that_is_at_least_32_characters', // This should be kept securely, pre... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/package.json | @@ -0,0 +1,20 @@
+{
+ "name": "with-passport-and-next-connect",
+ "scripts": {
+ "dev": "next",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "@hapi/iron": "6.0.0",
+ "cookie": "0.4.0",
+ "next": "latest",
+ "next-connect": "^0.6.1",
+ "passport": "^0.4.1",
+ ... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/pages/_app.js | @@ -0,0 +1,15 @@
+import Navbar from '../components/Navbar'
+import '../styles.css'
+
+export default function MyApp({ Component, pageProps }) {
+ return (
+ <>
+ <Navbar />
+ <main>
+ <div className="container">
+ <Component {...pageProps} />
+ </div>
+ </main>
+ </>
+ )
+... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/pages/api/login.js | @@ -0,0 +1,11 @@
+import nextConnect from 'next-connect'
+import auth from '../../middleware/auth'
+import passport from '../../lib/passport'
+
+const handler = nextConnect()
+
+handler.use(auth).post(passport.authenticate('local'), (req, res) => {
+ res.json({ user: req.user })
+})
+
+export default handler | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/pages/api/logout.js | @@ -0,0 +1,11 @@
+import nextConnect from 'next-connect'
+import auth from '../../middleware/auth'
+
+const handler = nextConnect()
+
+handler.use(auth).get((req, res) => {
+ req.logOut()
+ res.status(204).end()
+})
+
+export default handler | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/pages/api/user.js | @@ -0,0 +1,36 @@
+import nextConnect from 'next-connect'
+import auth from '../../middleware/auth'
+import { deleteUser, updateUserByUsername } from '../../lib/db'
+
+const handler = nextConnect()
+
+handler
+ .use(auth)
+ .get((req, res) => {
+ // You do not generally want to return the whole user object
+ // ... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/pages/api/users.js | @@ -0,0 +1,38 @@
+import nextConnect from 'next-connect'
+import auth from '../../middleware/auth'
+import { getAllUsers, createUser, findUserByUsername } from '../../lib/db'
+
+const handler = nextConnect()
+
+handler
+ .use(auth)
+ .get((req, res) => {
+ // For demo purpose only. You will never have an endpoint ... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/pages/index.js | @@ -0,0 +1,65 @@
+import { useUser, fetcher } from '../lib/hooks'
+import useSWR from 'swr'
+
+function UserList() {
+ const { data: { users } = {} } = useSWR('/api/users', fetcher)
+ return (
+ <>
+ <h2>All users</h2>
+ {!!users?.length && (
+ <ul>
+ {users.map(user => (
+ <li... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/pages/login.js | @@ -0,0 +1,61 @@
+import { useState, useEffect } from 'react'
+import Router from 'next/router'
+import Link from 'next/link'
+import { useUser } from '../lib/hooks'
+
+export default function LoginPage() {
+ const [user, { mutate }] = useUser()
+ const [errorMsg, setErrorMsg] = useState('')
+
+ async function onSub... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/pages/profile.js | @@ -0,0 +1,89 @@
+import { useEffect, useRef } from 'react'
+import Router from 'next/router'
+import { useUser } from '../lib/hooks'
+
+function ProfileEdit() {
+ const [user, { mutate }] = useUser()
+ const nameRef = useRef()
+
+ useEffect(() => {
+ if (!user) return
+ nameRef.current.value = user.name
+ },... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/pages/signup.js | @@ -0,0 +1,76 @@
+import { useState, useEffect } from 'react'
+import Router from 'next/router'
+import Link from 'next/link'
+import { useUser } from '../lib/hooks'
+
+export default function SignupPage() {
+ const [user, { mutate }] = useUser()
+ const [errorMsg, setErrorMsg] = useState('')
+
+ async function onSu... | true |
Other | vercel | next.js | ee372f472ffcb07dd1b7c19f0c707f0260f55d4e.json | feat(example): add CRUD example with next-connect and passport (#11359)
* Add with-next-connect example
* Update README
* Fix code and lint
* Fix typo
* Run prettier
* Include username
* Rename example
* Match with-passport styling
* Add comments in code
* Run prettier
* Rewrite example
... | examples/with-passport-and-next-connect/styles.css | @@ -0,0 +1,65 @@
+*,
+*::before,
+*::after {
+ box-sizing: border-box;
+}
+body {
+ margin: 0;
+ color: #333;
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
+ 'Helvetica Neue', Arial, Noto Sans, sans-serif, 'Apple Color Emoji',
+ 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
... | true |
Other | vercel | next.js | 0ccce7271d7a70dbaf453c2b192a8bd0e64513b1.json | Update sentry example (#11701)
* Fix the with-sentry-simple example configuration code
This fixes the following issues:
- https://github.com/zeit/next.js/issues/8873
- https://github.com/zeit/next.js/issues/11642
* Update the README with the info about uploading to sentry configurations
* Fix the typo in SE... | examples/with-sentry-simple/README.md | @@ -49,16 +49,16 @@ This is a simple example showing how to use [Sentry](https://sentry.io) to catch
- `_error.js` is rendered by Next.js while handling certain types of exceptions for you. It is overridden so those exceptions can be passed along to Sentry
- `next.config.js` enables source maps in production for Sent... | true |
Other | vercel | next.js | 0ccce7271d7a70dbaf453c2b192a8bd0e64513b1.json | Update sentry example (#11701)
* Fix the with-sentry-simple example configuration code
This fixes the following issues:
- https://github.com/zeit/next.js/issues/8873
- https://github.com/zeit/next.js/issues/11642
* Update the README with the info about uploading to sentry configurations
* Fix the typo in SE... | examples/with-sentry-simple/next.config.js | @@ -1,5 +1,11 @@
+// Use the hidden-source-map option when you don't want the source maps to be
+// publicly available on the servers, only to the error reporting
const withSourceMaps = require('@zeit/next-source-maps')()
+// Use the SentryWebpack plugin to upload the source maps during build step
+const SentryWebpa... | true |
Other | vercel | next.js | 0ccce7271d7a70dbaf453c2b192a8bd0e64513b1.json | Update sentry example (#11701)
* Fix the with-sentry-simple example configuration code
This fixes the following issues:
- https://github.com/zeit/next.js/issues/8873
- https://github.com/zeit/next.js/issues/11642
* Update the README with the info about uploading to sentry configurations
* Fix the typo in SE... | examples/with-sentry-simple/package.json | @@ -10,11 +10,10 @@
"dependencies": {
"@sentry/browser": "^5.1.0",
"@sentry/node": "^5.6.2",
+ "@sentry/webpack-plugin": "^1.10.0",
+ "@zeit/next-source-maps": "0.0.4-canary.1",
"next": "latest",
"react": "^16.8.6",
"react-dom": "^16.8.6"
- },
- "devDependencies": {
- "@zeit/next-... | true |
Other | vercel | next.js | 0ccce7271d7a70dbaf453c2b192a8bd0e64513b1.json | Update sentry example (#11701)
* Fix the with-sentry-simple example configuration code
This fixes the following issues:
- https://github.com/zeit/next.js/issues/8873
- https://github.com/zeit/next.js/issues/11642
* Update the README with the info about uploading to sentry configurations
* Fix the typo in SE... | examples/with-sentry-simple/pages/_app.js | @@ -3,8 +3,8 @@ import App from 'next/app'
import * as Sentry from '@sentry/node'
Sentry.init({
- // Replace with your project's Sentry DSN
- dsn: 'https://00000000000000000000000000000000@sentry.io/1111111',
+ enabled: process.env.NODE_ENV === 'production',
+ dsn: process.env.SENTRY_DSN,
})
class MyApp ext... | true |
Other | vercel | next.js | e686545c0d7e726b3a4c65d277dab54e73576272.json | Update @types in create-next-app (#11815)
* remove self made types
* add types
Co-authored-by: matamatanot <matamatanot@gmail.com> | packages/create-next-app/@types/promisepipe.d.ts | @@ -1 +0,0 @@
-declare module 'promisepipe' | true |
Other | vercel | next.js | e686545c0d7e726b3a4c65d277dab54e73576272.json | Update @types in create-next-app (#11815)
* remove self made types
* add types
Co-authored-by: matamatanot <matamatanot@gmail.com> | packages/create-next-app/@types/rimraf.d.ts | @@ -1,50 +0,0 @@
-// Type definitions for rimraf 2.0
-// Project: https://github.com/isaacs/rimraf
-// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
-// e-cloud <https://github.com/e-cloud>
-// Ruben Schmidmeister <https://github.com/bash>
-// Oga... | true |
Other | vercel | next.js | e686545c0d7e726b3a4c65d277dab54e73576272.json | Update @types in create-next-app (#11815)
* remove self made types
* add types
Co-authored-by: matamatanot <matamatanot@gmail.com> | packages/create-next-app/@types/validate-npm-package-name.d.ts | @@ -1,12 +0,0 @@
-declare module 'validate-npm-package-name' {
- function validate(
- projectName: string
- ): {
- validForNewPackages: boolean
- validForOldPackages: boolean
- errors?: string[] | null
- warnings?: string[] | null
- }
-
- export default validate
-} | true |
Other | vercel | next.js | e686545c0d7e726b3a4c65d277dab54e73576272.json | Update @types in create-next-app (#11815)
* remove self made types
* add types
Co-authored-by: matamatanot <matamatanot@gmail.com> | packages/create-next-app/package.json | @@ -29,7 +29,9 @@
"devDependencies": {
"@types/node": "^12.6.8",
"@types/prompts": "2.0.1",
+ "@types/rimraf": "3.0.0",
"@types/tar": "4.0.3",
+ "@types/validate-npm-package-name": "3.0.0",
"@zeit/ncc": "^0.20.4",
"chalk": "2.4.2",
"commander": "2.20.0", | true |
Other | vercel | next.js | e686545c0d7e726b3a4c65d277dab54e73576272.json | Update @types in create-next-app (#11815)
* remove self made types
* add types
Co-authored-by: matamatanot <matamatanot@gmail.com> | yarn.lock | @@ -2603,7 +2603,7 @@
resolved "https://registry.yarnpkg.com/@types/fresh/-/fresh-0.5.0.tgz#4d09231027d69c4369cfb01a9af5ef083d0d285f"
integrity sha512-eGPzuyc6wZM3sSHJdF7NM2jW6B/xsB014Rqg/iDa6xY02mlfy1w/TE2sYhR8vbHxkzJOXiGo6NuIk3xk35vsgQ==
-"@types/glob@^7.1.1":
+"@types/glob@*", "@types/glob@^7.1.1":
versio... | true |
Other | vercel | next.js | dcb0a656f5742f3f04b5b714153c6e83b6c62e70.json | Add gip identifiers to NEXT_DATA (#11835)
* Add gip identifiers to NEXT_DATA
* Update test a bit | packages/next/next-server/lib/utils.ts | @@ -82,6 +82,8 @@ export type NEXT_DATA = {
gsp?: boolean
gssp?: boolean
customServer?: boolean
+ gip?: boolean
+ appGip?: boolean
}
/** | true |
Other | vercel | next.js | dcb0a656f5742f3f04b5b714153c6e83b6c62e70.json | Add gip identifiers to NEXT_DATA (#11835)
* Add gip identifiers to NEXT_DATA
* Update test a bit | packages/next/next-server/server/render.tsx | @@ -195,6 +195,8 @@ function renderDocument(
gsp,
gssp,
customServer,
+ gip,
+ appGip,
}: RenderOpts & {
props: any
docProps: DocumentInitialProps
@@ -218,6 +220,8 @@ function renderDocument(
gsp?: boolean
gssp?: boolean
customServer?: boolean
+ gip?: boolean
+ app... | true |
Other | vercel | next.js | dcb0a656f5742f3f04b5b714153c6e83b6c62e70.json | Add gip identifiers to NEXT_DATA (#11835)
* Add gip identifiers to NEXT_DATA
* Update test a bit | test/integration/gip-identifier/pages/index.js | @@ -0,0 +1 @@
+export default () => 'hi' | true |
Other | vercel | next.js | dcb0a656f5742f3f04b5b714153c6e83b6c62e70.json | Add gip identifiers to NEXT_DATA (#11835)
* Add gip identifiers to NEXT_DATA
* Update test a bit | test/integration/gip-identifier/test/index.test.js | @@ -0,0 +1,98 @@
+/* eslint-env jest */
+/* global jasmine */
+import cheerio from 'cheerio'
+import fs from 'fs-extra'
+import {
+ findPort,
+ killApp,
+ launchApp,
+ nextBuild,
+ nextStart,
+ renderViaHTTP,
+} from 'next-test-utils'
+import { join } from 'path'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * ... | true |
Other | vercel | next.js | cbcb10b92266f9dfcfede8e5e4b4e8a89a733f51.json | Add displayName property to React Context objects (#11829)
https://reactjs.org/docs/context.html#contextdisplayname
Use the .displayName property to show distinct component names in React
DevTools. For example, “DocumentContext.Provider” instead of just
“Context.Provider”. | packages/next/next-server/lib/amp-context.ts | @@ -1,3 +1,7 @@
import * as React from 'react'
export const AmpStateContext: React.Context<any> = React.createContext({})
+
+if (process.env.NODE_ENV !== 'production') {
+ AmpStateContext.displayName = 'AmpStateContext'
+} | true |
Other | vercel | next.js | cbcb10b92266f9dfcfede8e5e4b4e8a89a733f51.json | Add displayName property to React Context objects (#11829)
https://reactjs.org/docs/context.html#contextdisplayname
Use the .displayName property to show distinct component names in React
DevTools. For example, “DocumentContext.Provider” instead of just
“Context.Provider”. | packages/next/next-server/lib/document-context.ts | @@ -7,3 +7,7 @@ type DocumentContext = {
}
export const DocumentContext = React.createContext<DocumentContext>(null as any)
+
+if (process.env.NODE_ENV !== 'production') {
+ DocumentContext.displayName = 'DocumentContext'
+} | true |
Other | vercel | next.js | cbcb10b92266f9dfcfede8e5e4b4e8a89a733f51.json | Add displayName property to React Context objects (#11829)
https://reactjs.org/docs/context.html#contextdisplayname
Use the .displayName property to show distinct component names in React
DevTools. For example, “DocumentContext.Provider” instead of just
“Context.Provider”. | packages/next/next-server/lib/head-manager-context.ts | @@ -1,3 +1,7 @@
import * as React from 'react'
export const HeadManagerContext: React.Context<any> = React.createContext(null)
+
+if (process.env.NODE_ENV !== 'production') {
+ HeadManagerContext.displayName = 'HeadManagerContext'
+} | true |
Other | vercel | next.js | cbcb10b92266f9dfcfede8e5e4b4e8a89a733f51.json | Add displayName property to React Context objects (#11829)
https://reactjs.org/docs/context.html#contextdisplayname
Use the .displayName property to show distinct component names in React
DevTools. For example, “DocumentContext.Provider” instead of just
“Context.Provider”. | packages/next/next-server/lib/loadable-context.ts | @@ -3,3 +3,7 @@ import * as React from 'react'
type CaptureFn = (moduleName: string) => void
export const LoadableContext = React.createContext<CaptureFn | null>(null)
+
+if (process.env.NODE_ENV !== 'production') {
+ LoadableContext.displayName = 'LoadableContext'
+} | true |
Other | vercel | next.js | cbcb10b92266f9dfcfede8e5e4b4e8a89a733f51.json | Add displayName property to React Context objects (#11829)
https://reactjs.org/docs/context.html#contextdisplayname
Use the .displayName property to show distinct component names in React
DevTools. For example, “DocumentContext.Provider” instead of just
“Context.Provider”. | packages/next/next-server/lib/request-context.ts | @@ -1,3 +1,7 @@
import * as React from 'react'
export const RequestContext: React.Context<any> = React.createContext(null)
+
+if (process.env.NODE_ENV !== 'production') {
+ RequestContext.displayName = 'RequestContext'
+} | true |
Other | vercel | next.js | cbcb10b92266f9dfcfede8e5e4b4e8a89a733f51.json | Add displayName property to React Context objects (#11829)
https://reactjs.org/docs/context.html#contextdisplayname
Use the .displayName property to show distinct component names in React
DevTools. For example, “DocumentContext.Provider” instead of just
“Context.Provider”. | packages/next/next-server/lib/router-context.ts | @@ -2,3 +2,7 @@ import * as React from 'react'
import { NextRouter } from './router/router'
export const RouterContext = React.createContext<NextRouter>(null as any)
+
+if (process.env.NODE_ENV !== 'production') {
+ RouterContext.displayName = 'RouterContext'
+} | true |
Other | vercel | next.js | ab4ba0418cb3c4538a2599cee23e2213cb8059f4.json | Replace brackets in CSS classes for dynamic routes (#11795) | packages/next/build/webpack/config/blocks/css/loaders/getCssModuleLocalIdent.ts | @@ -29,17 +29,22 @@ export function getCssModuleLocalIdent(
)
// Have webpack interpolate the `[folder]` or `[name]` to its real value.
- return loaderUtils
- .interpolateName(
- context,
- fileNameOrFolder + '_' + exportName + '__' + hash,
- options
- )
- .replace(
- // Webpack na... | true |
Other | vercel | next.js | ab4ba0418cb3c4538a2599cee23e2213cb8059f4.json | Replace brackets in CSS classes for dynamic routes (#11795) | test/integration/css-fixtures/dynamic-route-module/pages/[post]/index.js | @@ -0,0 +1,7 @@
+import styles from './index.module.css'
+
+export default () => (
+ <div className={styles.home} id="my-div">
+ hello world
+ </div>
+) | true |
Other | vercel | next.js | ab4ba0418cb3c4538a2599cee23e2213cb8059f4.json | Replace brackets in CSS classes for dynamic routes (#11795) | test/integration/css-fixtures/dynamic-route-module/pages/[post]/index.module.css | @@ -0,0 +1,3 @@
+.home {
+ background: #f00;
+} | true |
Other | vercel | next.js | ab4ba0418cb3c4538a2599cee23e2213cb8059f4.json | Replace brackets in CSS classes for dynamic routes (#11795) | test/integration/css-modules/test/index.test.js | @@ -449,3 +449,52 @@ describe('CSS Module Composes Usage (External)', () => {
)
})
})
+
+describe('Dynamic Route CSS Module Usage', () => {
+ // This is a very bad feature. Do not use it.
+ const appDir = join(fixturesDir, 'dynamic-route-module')
+
+ let stdout
+ let code
+ let app
+ let appPort
+
+ bef... | true |
Other | vercel | next.js | ab4ba0418cb3c4538a2599cee23e2213cb8059f4.json | Replace brackets in CSS classes for dynamic routes (#11795) | test/integration/scss-fixtures/dynamic-route-module/pages/[post]/index.js | @@ -0,0 +1,7 @@
+import styles from './index.module.scss'
+
+export default () => (
+ <div className={styles.home} id="my-div">
+ hello world
+ </div>
+) | true |
Other | vercel | next.js | ab4ba0418cb3c4538a2599cee23e2213cb8059f4.json | Replace brackets in CSS classes for dynamic routes (#11795) | test/integration/scss-fixtures/dynamic-route-module/pages/[post]/index.module.scss | @@ -0,0 +1,3 @@
+.home {
+ background: #f00;
+} | true |
Other | vercel | next.js | ab4ba0418cb3c4538a2599cee23e2213cb8059f4.json | Replace brackets in CSS classes for dynamic routes (#11795) | test/integration/scss-modules/test/index.test.js | @@ -448,3 +448,52 @@ describe('CSS Module Composes Usage (External)', () => {
)
})
})
+
+describe('Dynamic Route CSS Module Usage', () => {
+ // This is a very bad feature. Do not use it.
+ const appDir = join(fixturesDir, 'dynamic-route-module')
+
+ let stdout
+ let code
+ let app
+ let appPort
+
+ bef... | true |
Other | vercel | next.js | 7d6fbe7fd62a3d1f7a918b40f6c9c777ca8730af.json | Add Node.js version to Bug template (#11781) | .github/ISSUE_TEMPLATE/1.Bug_report.md | @@ -31,6 +31,7 @@ If applicable, add screenshots to help explain your problem.
- OS: [e.g. macOS, Windows]
- Browser (if applies) [e.g. chrome, safari]
- Version of Next.js: [e.g. 6.0.2]
+- Version of Node.js: [e.g. 10.10.0]
## Additional context
| false |
Other | vercel | next.js | 28e1be83df3453b2a14d6ecc9b3bcd89733c50d5.json | Remove duplicate content (#11750) | examples/with-iron-session/README.md | @@ -6,18 +6,6 @@ It uses current best practices for authentication in the Next.js ecosystem.
**Features:**
-- [Static Generation](https://nextjs.org/docs/basic-features/pages#static-generation-recommended) (SG), recommended example
-- [Server-side Rendering](https://nextjs.org/docs/basic-features/pages#server-side... | false |
Other | vercel | next.js | 480fb5652a8f836a87b5f814eb67076570f70c63.json | Add @lfades to CODEOWNERS | .github/CODEOWNERS | @@ -1,8 +1,8 @@
# Learn how to add code owners here:
# https://help.github.com/en/articles/about-code-owners
-/packages/ @timneutkens @Timer @dav-is @ijjk
+/packages/ @timneutkens @Timer @dav-is @ijjk @lfades
/examples/ @kheruc @lfades
-/test/ @timneu... | false |
Other | vercel | next.js | 907dd27a885dc22eddce6c6cede96a8feeff26a3.json | Make main.js override work correctly (#6781) | packages/next/build/webpack-config.ts | @@ -327,18 +327,16 @@ export default function getBaseWebpackConfig (dir: string, {dev = false, isServe
const originalEntry: any = webpackConfig.entry
if (typeof originalEntry !== 'undefined') {
webpackConfig.entry = async () => {
- const entry = typeof originalEntry === 'function' ? await originalEntry(... | false |
Other | vercel | next.js | cf7f707ff9260b7412b625806909f5cad81b78dc.json | Remove PropTypes from _error and next/dynamic (#6763)
* Remove proptypes
* Remove loadable capture in favor of React.createContext
* Add loadable context file
* Make sure we use the context value instead | packages/next-server/lib/loadable-capture.tsx | @@ -1,52 +0,0 @@
-/**
-@copyright (c) 2017-present James Kyle <me@thejameskyle.com>
- MIT License
- Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitat... | true |
Other | vercel | next.js | cf7f707ff9260b7412b625806909f5cad81b78dc.json | Remove PropTypes from _error and next/dynamic (#6763)
* Remove proptypes
* Remove loadable capture in favor of React.createContext
* Add loadable context file
* Make sure we use the context value instead | packages/next-server/lib/loadable-context.ts | @@ -0,0 +1,6 @@
+import * as React from 'react'
+
+type CaptureFn = (moduleName: string) => void
+
+// @ts-ignore for some reason the React types don't like this, but it's correct.
+export const LoadableContext: React.Context<CaptureFn | null> = React.createContext(null) | true |
Other | vercel | next.js | cf7f707ff9260b7412b625806909f5cad81b78dc.json | Remove PropTypes from _error and next/dynamic (#6763)
* Remove proptypes
* Remove loadable capture in favor of React.createContext
* Add loadable context file
* Make sure we use the context value instead | packages/next-server/lib/loadable.js | @@ -22,7 +22,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
// Modified to be compatible with webpack 4 / Next.js
import React from 'react'
-import PropTypes from 'prop-types'
+import { LoadableContext } from './loadable-context'
const ALL_INITIALIZERS = []
const READY_INITIALIZERS = []
@@ ... | true |
Other | vercel | next.js | cf7f707ff9260b7412b625806909f5cad81b78dc.json | Remove PropTypes from _error and next/dynamic (#6763)
* Remove proptypes
* Remove loadable capture in favor of React.createContext
* Add loadable context file
* Make sure we use the context value instead | packages/next-server/server/render.tsx | @@ -8,7 +8,7 @@ import mitt, {MittEmitter} from '../lib/mitt';
import { loadGetInitialProps, isResSent } from '../lib/utils'
import Head, { defaultHead } from '../lib/head'
import Loadable from '../lib/loadable'
-import LoadableCapture from '../lib/loadable-capture'
+import {LoadableContext} from '../lib/loadable-co... | true |
Other | vercel | next.js | cf7f707ff9260b7412b625806909f5cad81b78dc.json | Remove PropTypes from _error and next/dynamic (#6763)
* Remove proptypes
* Remove loadable capture in favor of React.createContext
* Add loadable context file
* Make sure we use the context value instead | packages/next/pages/_error.js | @@ -1,5 +1,4 @@
import React from 'react'
-import PropTypes from 'prop-types'
import Head from 'next-server/head'
const statusCodes = {
@@ -45,12 +44,6 @@ export default class Error extends React.Component {
}
}
-if (process.env.NODE_ENV !== 'production') {
- Error.propTypes = {
- statusCode: PropTypes.n... | true |
Other | vercel | next.js | 5a48272af004239fec5b765ccde336a73a888545.json | Fix amphtml href with nested amp page (#6741)
* Add more export tests for AMP
* Make sure ampPath is correct when nested
* Remove console.log | packages/next/export/index.js | @@ -66,7 +66,7 @@ export default async function (dir, options, configuration) {
} else {
const ampPath = tryAmp(defaultPathMap, path)
if (ampPath !== path) {
- defaultPathMap[path].query = { hasAmp: true, ampPath }
+ defaultPathMap[path].query = { hasAmp: true, ampPath: ampPath.replace(... | true |
Other | vercel | next.js | 5a48272af004239fec5b765ccde336a73a888545.json | Fix amphtml href with nested amp page (#6741)
* Add more export tests for AMP
* Make sure ampPath is correct when nested
* Remove console.log | test/integration/export-default-map/test/index.test.js | @@ -2,13 +2,15 @@
/* global jasmine */
import fs from 'fs'
import { join } from 'path'
+import cheerio from 'cheerio'
import { promisify } from 'util'
import {
nextBuild,
nextExport
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
+const readFile = promisify(fs.readFile)
const a... | true |
Other | vercel | next.js | 20e4a5049e5b1f04107df0389946849f28fc657b.json | Add more export tests for AMP (#6740)
* Add more export tests for AMP
* Remove console.log
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
* remove extra line
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com> | packages/next/export/index.js | @@ -6,6 +6,7 @@ import { resolve, join } from 'path'
import { existsSync, readFileSync } from 'fs'
import loadConfig from 'next-server/next-config'
import { tryAmp } from 'next-server/dist/server/require'
+import { cleanAmpPath } from 'next-server/dist/server/utils'
import { PHASE_EXPORT, SERVER_DIRECTORY, PAGES_MA... | true |
Other | vercel | next.js | 20e4a5049e5b1f04107df0389946849f28fc657b.json | Add more export tests for AMP (#6740)
* Add more export tests for AMP
* Remove console.log
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
* remove extra line
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com> | packages/next/export/worker.js | @@ -47,6 +47,9 @@ process.on(
path = cleanAmpPath(path)
}
+ // replace /docs/index.amp with /docs.amp
+ path = path.replace(/(?<!^)\/index\.amp$/, '.amp')
+
let htmlFilename = `${path}${sep}index.html`
const pageExt = extname(page)
const pathExt = extname(p... | true |
Other | vercel | next.js | 20e4a5049e5b1f04107df0389946849f28fc657b.json | Add more export tests for AMP (#6740)
* Add more export tests for AMP
* Remove console.log
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
* remove extra line
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com> | test/integration/export-default-map/pages/docs/index.amp.js | @@ -1,3 +1 @@
-export default () => (
- <p>I'm an AMP page</p>
-)
+export { default } from './index' | true |
Other | vercel | next.js | 20e4a5049e5b1f04107df0389946849f28fc657b.json | Add more export tests for AMP (#6740)
* Add more export tests for AMP
* Remove console.log
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
* remove extra line
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com> | test/integration/export-default-map/pages/docs/index.js | @@ -0,0 +1,5 @@
+import { useAmp } from 'next/amp'
+
+export default () => (
+ <p>I'm an {useAmp() ? 'AMP' : 'normal'} page</p>
+) | true |
Other | vercel | next.js | 20e4a5049e5b1f04107df0389946849f28fc657b.json | Add more export tests for AMP (#6740)
* Add more export tests for AMP
* Remove console.log
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
* remove extra line
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com> | test/integration/export-default-map/pages/info.js | @@ -0,0 +1,5 @@
+import { useAmp } from 'next/amp'
+
+export default () => (
+ <p>I'm an {useAmp() ? 'AMP' : 'normal'} page</p>
+) | true |
Other | vercel | next.js | 20e4a5049e5b1f04107df0389946849f28fc657b.json | Add more export tests for AMP (#6740)
* Add more export tests for AMP
* Remove console.log
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
* remove extra line
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com> | test/integration/export-default-map/pages/info/index.amp.js | @@ -0,0 +1 @@
+export { default } from '../info' | true |
Other | vercel | next.js | 20e4a5049e5b1f04107df0389946849f28fc657b.json | Add more export tests for AMP (#6740)
* Add more export tests for AMP
* Remove console.log
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
* remove extra line
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com> | test/integration/export-default-map/pages/just-amp/index.amp.js | @@ -0,0 +1,3 @@
+export default () => (
+ <p>I am an AMP only page</p>
+) | true |
Other | vercel | next.js | 20e4a5049e5b1f04107df0389946849f28fc657b.json | Add more export tests for AMP (#6740)
* Add more export tests for AMP
* Remove console.log
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
* remove extra line
Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com> | test/integration/export-default-map/test/index.test.js | @@ -34,4 +34,16 @@ describe('Export with default map', () => {
await expect(access(join(outdir, 'some/index.html'))).resolves.toBe(undefined)
await expect(access(join(outdir, 'some.amp/index.html'))).resolves.toBe(undefined)
})
+
+ it('should export nested hybrid amp page correctly', async () => {
+ ex... | true |
Other | vercel | next.js | 130aa3fd18ff20eefb9c1b8c8c29f7a1f0900820.json | Remove unused parameters (#6735)
These two were unused :+1: | packages/next/client/page-loader.js | @@ -156,9 +156,9 @@ export default class PageLoader {
}
if (document.readyState === 'complete') {
- return this.loadPage(route).catch((e) => {})
+ return this.loadPage(route).catch(() => {})
} else {
- return new Promise((resolve, reject) => {
+ return new Promise((resolve) => {
... | false |
Other | vercel | next.js | 18af71c0111002b81f4d990eb1a5811c7d1ab4cb.json | Add support for amp to export (#6725)
* Add support for amp to export
* Anchor canonical replace
* Disable profiling test for now
* Centralize amp utils to next-server/server/utils
* re-enable profiling test | packages/next-server/server/render.tsx | @@ -115,6 +115,7 @@ type RenderOpts = {
err?: Error | null
nextExport?: boolean
dev?: boolean
+ ampPath?: string
amphtml?: boolean
hasAmp?: boolean
buildManifest: BuildManifest
@@ -140,6 +141,7 @@ function renderDocument(
dynamicImportsIds,
err,
dev,
+ ampPath,
amphtml,
ha... | true |
Other | vercel | next.js | 18af71c0111002b81f4d990eb1a5811c7d1ab4cb.json | Add support for amp to export (#6725)
* Add support for amp to export
* Anchor canonical replace
* Disable profiling test for now
* Centralize amp utils to next-server/server/utils
* re-enable profiling test | packages/next-server/server/require.ts | @@ -1,4 +1,5 @@
import {join} from 'path'
+import { isAmpFile } from './utils'
import {PAGES_MANIFEST, SERVER_DIRECTORY} from 'next-server/constants'
import { normalizePagePath } from './normalize-page-path'
@@ -53,13 +54,12 @@ export function getPagePath(page: string, distDir: string, opts: PagePathOptions
exp... | true |
Other | vercel | next.js | 18af71c0111002b81f4d990eb1a5811c7d1ab4cb.json | Add support for amp to export (#6725)
* Add support for amp to export
* Anchor canonical replace
* Disable profiling test for now
* Centralize amp utils to next-server/server/utils
* re-enable profiling test | packages/next-server/server/utils.ts | @@ -18,3 +18,21 @@ export function isInternalUrl(url: string): boolean {
export function isBlockedPage(pathname: string): boolean {
return (BLOCKED_PAGES.indexOf(pathname) !== -1)
}
+
+export function cleanAmpPath(pathname: string): string {
+ return (pathname || '')
+ .replace(/\.amp$/, '')
+ .replace(/\in... | true |
Other | vercel | next.js | 18af71c0111002b81f4d990eb1a5811c7d1ab4cb.json | Add support for amp to export (#6725)
* Add support for amp to export
* Anchor canonical replace
* Disable profiling test for now
* Centralize amp utils to next-server/server/utils
* re-enable profiling test | packages/next/export/index.js | @@ -5,6 +5,7 @@ import mkdirpModule from 'mkdirp'
import { resolve, join } from 'path'
import { existsSync, readFileSync } from 'fs'
import loadConfig from 'next-server/next-config'
+import { tryAmp } from 'next-server/dist/server/require'
import { PHASE_EXPORT, SERVER_DIRECTORY, PAGES_MANIFEST, CONFIG_FILE, BUILD_... | true |
Other | vercel | next.js | 18af71c0111002b81f4d990eb1a5811c7d1ab4cb.json | Add support for amp to export (#6725)
* Add support for amp to export
* Anchor canonical replace
* Disable profiling test for now
* Centralize amp utils to next-server/server/utils
* re-enable profiling test | packages/next/export/worker.js | @@ -1,5 +1,6 @@
import mkdirpModule from 'mkdirp'
import { promisify } from 'util'
+import { cleanAmpPath } from 'next/dist/server/lib/utils'
import { extname, join, dirname, sep } from 'path'
import { renderToHTML } from 'next-server/dist/server/render'
import { writeFile } from 'fs'
@@ -30,13 +31,22 @@ process.o... | true |
Other | vercel | next.js | 18af71c0111002b81f4d990eb1a5811c7d1ab4cb.json | Add support for amp to export (#6725)
* Add support for amp to export
* Anchor canonical replace
* Disable profiling test for now
* Centralize amp utils to next-server/server/utils
* re-enable profiling test | packages/next/pages/_document.js | @@ -1,6 +1,7 @@
/* eslint-disable */
import React, { Component } from 'react'
import PropTypes from 'prop-types'
+import { cleanAmpPath } from 'next-server/dist/server/utils'
import { htmlEscapeJsonString } from '../server/htmlescape'
import flush from 'styled-jsx/server'
import {
@@ -151,6 +152,7 @@ export class... | true |
Other | vercel | next.js | e906e4bd77c5538ad16f02966c5d3849c8f1a0e7.json | Adjust CircleCI flow (#6728)
* Format circleci config
* Tweak configuration into multiple steps
* Persist whole repo to workspace
* Attach workspace for tests
* Run tests in parallelism x4
* Test circleci parallelism
* parallel x6 times
* Save test timing
* Use env var instead
* run in ci mo... | .circleci/config.yml | @@ -12,20 +12,48 @@ jobs:
- run:
name: Linting
command: yarn lint
+ - persist_to_workspace:
+ root: ~/repo
+ paths: ['.']
+ test:
+ parallelism: 6
+ docker:
+ - image: circleci/node:8-browsers
+ working_directory: ~/repo
+ steps:
+ - attach_work... | true |
Other | vercel | next.js | e906e4bd77c5538ad16f02966c5d3849c8f1a0e7.json | Adjust CircleCI flow (#6728)
* Format circleci config
* Tweak configuration into multiple steps
* Persist whole repo to workspace
* Attach workspace for tests
* Run tests in parallelism x4
* Test circleci parallelism
* parallel x6 times
* Save test timing
* Use env var instead
* run in ci mo... | package.json | @@ -8,7 +8,7 @@
"lerna": "lerna",
"dev": "lerna run build --stream --parallel",
"testonly": "jest",
- "testall": "yarn check && yarn run testonly -- --coverage --forceExit --runInBand --reporters=default --reporters=jest-junit",
+ "testall": "yarn check && yarn run testonly -- --ci --coverage --rep... | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/components/hello-context.js | @@ -1,15 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-
-export default class extends React.Component {
- static contextTypes = {
- data: PropTypes.object
- }
-
- render () {
- const { data } = this.context
- return (
- <div>{data.title}</div>
- )
- }
-} | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/components/hello1.js | @@ -1,3 +0,0 @@
-export default () => (
- <p>Hello World 1</p>
-) | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/components/hello2.js | @@ -1,3 +0,0 @@
-export default () => (
- <p>Hello World 2</p>
-) | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/components/welcome.js | @@ -1,19 +0,0 @@
-import React from 'react'
-
-export default class Welcome extends React.Component {
- state = { name: null }
-
- componentDidMount () {
- const { name } = this.props
- this.setState({ name })
- }
-
- render () {
- const { name } = this.state
- if (!name) return null
-
- return (
- ... | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/another.js | @@ -1,8 +0,0 @@
-import Link from 'next/link'
-
-export default () => (
- <div>
- <Link href='/'><a>Index Page</a></Link>
- <p>Another</p>
- </div>
-) | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/counter.js | @@ -1,33 +0,0 @@
-import Link from 'next/link'
-import { Component } from 'react'
-import Router from 'next/router'
-
-let counter = 0
-
-export default class extends Component {
- increase () {
- counter++
- this.forceUpdate()
- }
-
- visitQueryStringPage () {
- const href = { pathname: '/nav/querystring',... | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/dynamic/bundle.js | @@ -1,64 +0,0 @@
-import React from 'react'
-import dynamic from 'next/dynamic'
-import Router from 'next/router'
-import PropTypes from 'prop-types'
-
-const HelloBundle = dynamic({
- modules: () => {
- const components = {
- HelloContext: import('../../components/hello-context'),
- Hello1: import('../..... | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/dynamic/index.js | @@ -1,7 +0,0 @@
-import Link from 'next/link'
-
-export default () => (
- <div>
- <Link href='/dynamic/no-chunk'><a>No Chunk</a></Link>
- </div>
-) | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/dynamic/no-chunk.js | @@ -1,11 +0,0 @@
-import dynamic from 'next/dynamic'
-import Welcome from '../../components/welcome'
-
-const Welcome2 = dynamic(import('../../components/welcome'))
-
-export default () => (
- <div>
- <Welcome name='normal' />
- <Welcome2 name='dynamic' />
- </div>
-) | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/dynamic/no-ssr-custom-loading.js | @@ -1,8 +0,0 @@
-import dynamic from 'next/dynamic'
-
-const Hello = dynamic(import('../../components/hello1'), {
- ssr: false,
- loading: () => (<p>LOADING</p>)
-})
-
-export default Hello | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/dynamic/no-ssr.js | @@ -1,5 +0,0 @@
-import dynamic from 'next/dynamic'
-
-const Hello = dynamic(import('../../components/hello1'), { ssr: false })
-
-export default Hello | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/dynamic/ssr-true.js | @@ -1,5 +0,0 @@
-import dynamic from 'next/dynamic'
-
-const Hello = dynamic(import('../../components/hello1'), { ssr: true })
-
-export default Hello | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/dynamic/ssr.js | @@ -1,5 +0,0 @@
-import dynamic from 'next/dynamic'
-
-const Hello = dynamic(import('../../components/hello1'))
-
-export default Hello | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/error-in-browser-render-status-code.js | @@ -1,13 +0,0 @@
-import React from 'react'
-export default class ErrorInRenderPage extends React.Component {
- render () {
- if (typeof window !== 'undefined') {
- const error = new Error('An Expected error occurred')
- // This will be extracted by getInitialProps in the _error page,
- // which will... | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/error-in-browser-render.js | @@ -1,9 +0,0 @@
-import React from 'react'
-export default class ErrorInRenderPage extends React.Component {
- render () {
- if (typeof window !== 'undefined') {
- throw new Error('An Expected error occured')
- }
- return <div />
- }
-} | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/error-in-ssr-render.js | @@ -1,6 +0,0 @@
-import React from 'react'
-export default class ErrorInRenderPage extends React.Component {
- render () {
- throw new Error('An Expected error occured')
- }
-} | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/finish-response.js | @@ -1,11 +0,0 @@
-import React, { Component } from 'react'
-
-export default class extends Component {
- static getInitialProps ({ res }) {
- res.end('hi')
- }
-
- render () {
- return <div>hi</div>
- }
-} | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/prefetch.js | @@ -1,28 +0,0 @@
-import Link from 'next/link'
-
-export default () => {
- return <div>
- <ul>
- <li>
- <Link href='/' prefetch>
- <a>index</a>
- </Link>
- </li>
- <li>
- <Link href='/process-env' prefetch>
- <a>process env</a>
- </Link>
- </li>
- ... | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/pages/process-env.js | @@ -1,12 +0,0 @@
-
-if (process.browser) {
- global.__THIS_SHOULD_ONLY_BE_DEFINED_IN_BROWSER_CONTEXT__ = true
-}
-
-if (!process.browser) {
- global.__THIS_SHOULD_ONLY_BE_DEFINED_IN_SERVER_CONTEXT__ = true
-}
-
-export default () => (
- <div id='node-env'>{process.env.NODE_ENV}</div>
-) | true |
Other | vercel | next.js | f9e76a23545247d1bca29c77592e99b72faa2e16.json | Shrink the size of profiling test (#6723) | test/integration/profiling/test/index.test.js | @@ -1,42 +1,24 @@
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
-import {
- nextServer,
- nextBuild,
- startApp,
- stopApp,
- renderViaHTTP
-} from 'next-test-utils'
+import { nextBuild } from 'next-test-utils'
import fs from 'fs'
const appDir = join(__dirname, '../')
-let appPort
-le... | true |
Other | vercel | next.js | b41c85e32ad8f23bf1cd10918d8ef472e2ceaaf0.json | Remove headManager property as it’s unused (#6700)
This was leftover from before we moved to `HeadManagerContext`
Also removes `emitterProp` as it's unused in the Next.js codebase too. | packages/next/client/index.js | @@ -161,7 +161,7 @@ function renderReactElement (reactEl, domEl) {
}
}
-async function doRender ({ App, Component, props, err, emitter: emitterProp = emitter }) {
+async function doRender ({ App, Component, props, err }) {
// Usual getInitialProps fetching is handled in next/router
// this is for when Error... | false |
Other | vercel | next.js | 2d6a73cb66bec40105fec31d1117dd97ae3fe909.json | Remove conflicting <head> tags in amp mode (#6693) | errors/conflicting-amp-tag.md | @@ -0,0 +1,9 @@
+# Conflicting AMP Tag
+
+#### Why This Error Occurred
+
+In AMP mode Next.js adds certain necessary tags automatically to comply with the AMP standard. You added a tag using `next/head` that conflicts with one of these automatically added tags.
+
+#### Possible Ways to Fix It
+
+Remove the tag mention... | true |
Other | vercel | next.js | 2d6a73cb66bec40105fec31d1117dd97ae3fe909.json | Remove conflicting <head> tags in amp mode (#6693) | packages/next/pages/_document.js | @@ -148,7 +148,6 @@ export class Head extends Component {
render() {
const {
ampEnabled,
- head,
styles,
amphtml,
assetPrefix,
@@ -157,6 +156,7 @@ export class Head extends Component {
const { _devOnlyInvalidateCacheQueryString } = this.context
const { page, buildId } ... | true |
Other | vercel | next.js | 2d6a73cb66bec40105fec31d1117dd97ae3fe909.json | Remove conflicting <head> tags in amp mode (#6693) | test/integration/amphtml/pages/conflicting-tag.js | @@ -0,0 +1,10 @@
+import Head from 'next/head'
+
+export default () => (
+ <amp-layout className='abc' layout='responsive' width='1' height='1'>
+ <Head>
+ <meta name='viewport' content='something :p' />
+ </Head>
+ <span>Hello World</span>
+ </amp-layout>
+) | true |
Other | vercel | next.js | 2d6a73cb66bec40105fec31d1117dd97ae3fe909.json | Remove conflicting <head> tags in amp mode (#6693) | test/integration/amphtml/test/index.test.js | @@ -144,6 +144,15 @@ describe('AMP Usage', () => {
.attr('href')
).toBe('/use-amp-hook')
})
+
+ it('should remove conflicting amp tags', async () => {
+ const html = await renderViaHTTP(appPort, '/conflicting-tag?amp=1')
+ const $ = cheerio.load(html)
+ await validateAMP(html)
+... | true |
Other | vercel | next.js | 11a161f2964fd1a25d07ff1deda4f2a3efa465bd.json | Add possible explanation for webpack resolve error (#6682)
When overriding `config.resolve.alias` incorrectly webpack will throw an error because private-next-pages is not defined. This adds a more descriptive error explaining the error better.
Fixes: #6681 | errors/config-resolve-alias.md | @@ -0,0 +1,22 @@
+# Invalid webpack resolve alias
+
+#### Why This Error Occurred
+
+When overriding `config.resolve.alias` incorrectly in `next.config.js` webpack will throw an error because private-next-pages is not defined.
+
+#### Possible Ways to Fix It
+
+This is not a bug in Next.js, it's related to the user ad... | true |
Other | vercel | next.js | 11a161f2964fd1a25d07ff1deda4f2a3efa465bd.json | Add possible explanation for webpack resolve error (#6682)
When overriding `config.resolve.alias` incorrectly webpack will throw an error because private-next-pages is not defined. This adds a more descriptive error explaining the error better.
Fixes: #6681 | packages/next/build/index.ts | @@ -105,10 +105,15 @@ export default async function build(dir: string, conf = null): Promise<void> {
if (result.errors.length > 1) {
result.errors.length = 1
}
+ const error = result.errors.join('\n\n')
console.error(chalk.red('Failed to compile.\n'))
- console.error(result.errors.join('\n... | true |
Other | vercel | next.js | 11a161f2964fd1a25d07ff1deda4f2a3efa465bd.json | Add possible explanation for webpack resolve error (#6682)
When overriding `config.resolve.alias` incorrectly webpack will throw an error because private-next-pages is not defined. This adds a more descriptive error explaining the error better.
Fixes: #6681 | test/integration/config-resolve-alias/next.config.js | @@ -0,0 +1,6 @@
+module.exports = {
+ webpack (config) {
+ config.resolve.alias = {}
+ return config
+ }
+} | true |
Other | vercel | next.js | 11a161f2964fd1a25d07ff1deda4f2a3efa465bd.json | Add possible explanation for webpack resolve error (#6682)
When overriding `config.resolve.alias` incorrectly webpack will throw an error because private-next-pages is not defined. This adds a more descriptive error explaining the error better.
Fixes: #6681 | test/integration/config-resolve-alias/pages/index.js | @@ -0,0 +1,5 @@
+export default function Index (props) {
+ return (
+ <div>Index</div>
+ )
+} | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.