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 | 8e2097997e75d8867a9111c861b624e35e14f811.json | Remove getInitialProps from the faunadb example (#9427)
* Remove the global fetch
* Update API methods
* Remove getInitialProps from the page
* Add client side fetching | examples/with-graphql-faunadb/lib/useFetch.js | @@ -0,0 +1,23 @@
+import { useState, useEffect } from 'react'
+
+export default function useFetch(url, options) {
+ const [data, setData] = useState(null)
+ const [error, setError] = useState(null)
+
+ useEffect(() => {
+ const fetchData = async () => {
+ try {
+ const res = await fetch(url, options)
... | true |
Other | vercel | next.js | 8e2097997e75d8867a9111c861b624e35e14f811.json | Remove getInitialProps from the faunadb example (#9427)
* Remove the global fetch
* Update API methods
* Remove getInitialProps from the page
* Add client side fetching | examples/with-graphql-faunadb/package.json | @@ -9,9 +9,7 @@
},
"dependencies": {
"next": "latest",
- "node-fetch": "2.6.0",
"react": "^16.10.2",
- "react-dom": "^16.10.2",
- "unfetch": "4.1.0"
+ "react-dom": "^16.10.2"
}
} | true |
Other | vercel | next.js | 8e2097997e75d8867a9111c861b624e35e14f811.json | Remove getInitialProps from the faunadb example (#9427)
* Remove the global fetch
* Update API methods
* Remove getInitialProps from the page
* Add client side fetching | examples/with-graphql-faunadb/pages/index.js | @@ -1,5 +1,4 @@
import Head from 'next/head'
-import { getGuestbookEntries } from '../graphql/api'
import Footer from '../components/Footer'
import Hero from '../components/Hero'
@@ -22,7 +21,7 @@ const Guestbook = props => {
}
`}</style>
<div>
- <Hero initialEntries={props.initialEnt... | true |
Other | vercel | next.js | 8e2097997e75d8867a9111c861b624e35e14f811.json | Remove getInitialProps from the faunadb example (#9427)
* Remove the global fetch
* Update API methods
* Remove getInitialProps from the page
* Add client side fetching | examples/with-graphql-faunadb/styles/hero.js | @@ -1,5 +1,15 @@
import css from 'styled-jsx/css'
+export const heroContainer = css.resolve`
+ div {
+ width: 100%;
+ min-height: 100vh;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ }
+`
+
export const hero = css.resolve`
div {
width: 70%; | true |
Other | vercel | next.js | 2f16a860f29bce4ca1bb0fbdec1c5436970775e6.json | Adjust Client Nav Test (#9422)
This adjusts a test added in #8960 to render the correct page. | test/integration/client-navigation/test/rendering.js | @@ -83,7 +83,7 @@ export default function(render, fetch) {
})
test('header helper dedupes tags with the same key as the default', async () => {
- const html = await render('/head')
+ const html = await render('/head-duplicate-default-keys')
expect(html).toContain('<meta charSet="iso-8859-5"... | false |
Other | vercel | next.js | f3b376fae56b5f81861372442849eddf6bfcbdc8.json | Upgrade TypeScript version (#9417) | package.json | @@ -82,7 +82,7 @@
"shell-quote": "1.7.2",
"taskr": "1.1.0",
"tree-kill": "1.2.1",
- "typescript": "3.5.1",
+ "typescript": "3.7.2",
"wait-port": "0.2.2",
"wd": "1.11.3",
"webpack-bundle-analyzer": "3.3.2" | true |
Other | vercel | next.js | f3b376fae56b5f81861372442849eddf6bfcbdc8.json | Upgrade TypeScript version (#9417) | yarn.lock | @@ -14645,6 +14645,11 @@ typescript@3.5.1:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.1.tgz#ba72a6a600b2158139c5dd8850f700e231464202"
integrity sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw==
+typescript@3.7.2:
+ version "3.7.2"
+ resolve... | true |
Other | vercel | next.js | 8dd8fb8f2ad524f4693d6bf13921304bf5ee5ea1.json | Add test for internal url handling in render (#9396) | test/integration/custom-server/server.js | @@ -32,6 +32,10 @@ app.prepare().then(() => {
return app.render(req, res, '/dashboard/index')
}
+ if (/static\/hello\.text/.test(req.url)) {
+ return app.render(req, res, '/static/hello.text')
+ }
+
handleNextRequests(req, res)
})
| true |
Other | vercel | next.js | 8dd8fb8f2ad524f4693d6bf13921304bf5ee5ea1.json | Add test for internal url handling in render (#9396) | test/integration/custom-server/static/hello.txt | @@ -0,0 +1 @@
+hello world
\ No newline at end of file | true |
Other | vercel | next.js | 8dd8fb8f2ad524f4693d6bf13921304bf5ee5ea1.json | Add test for internal url handling in render (#9396) | test/integration/custom-server/test/index.test.js | @@ -45,6 +45,11 @@ describe('Custom Server', () => {
beforeAll(() => startServer())
afterAll(() => killApp(server))
+ it('should serve internal file from render', async () => {
+ const data = await renderViaHTTP(appPort, '/static/hello.txt')
+ expect(data).toMatch(/hello world/)
+ })
+
... | true |
Other | vercel | next.js | 4c2c45338a583b12c055750c57ae66710eaae384.json | amp-first example: fix broken inline script (#9389)
* amp-first example: fix broken inline script
* Apply lint-fix | examples/amp-first/pages/index.js | @@ -177,12 +177,11 @@ const Home = props => (
id="hello-world"
layout="fixed-height"
height="64"
- script={() => {
- const btn = document.querySelector('button')
+ script="
+ const btn = document.querySelector('button');
... | false |
Other | vercel | next.js | 154d78461ce2598d6e12343b452b45071a323d11.json | Replace historyId with initial page tracking (#9380)
* Replace historyId with initial page tracking
* Apply suggestions from code review
* Update packages/next/next-server/lib/router/router.ts
* Apply suggestions from code review | packages/next/next-server/lib/router/router.ts | @@ -71,7 +71,7 @@ export default class Router implements BaseRouter {
_bps: BeforePopStateCallback | undefined
events: MittEmitter
_wrapApp: (App: ComponentType) => any
- historyId: number
+ isSsr: boolean
static events: MittEmitter = mitt()
@@ -127,8 +127,9 @@ export default class Router implements B... | true |
Other | vercel | next.js | 154d78461ce2598d6e12343b452b45071a323d11.json | Replace historyId with initial page tracking (#9380)
* Replace historyId with initial page tracking
* Apply suggestions from code review
* Update packages/next/next-server/lib/router/router.ts
* Apply suggestions from code review | test/integration/client-navigation/test/index.test.js | @@ -74,6 +74,18 @@ describe('Client Navigation', () => {
await browser.close()
})
+ it('should navigate back after reload', async () => {
+ const browser = await webdriver(context.appPort, '/nav')
+ await browser.elementByCss('#about-link').click()
+ await browser.waitForElementByCss('.n... | true |
Other | vercel | next.js | 988f5d102d1feaed825ff6da4527b37b8b198095.json | Add extra step to contributing steps (#9377) | contributing.md | @@ -3,11 +3,12 @@
Our Commitment to Open Source can be found [here](https://zeit.co/blog/oss)
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device.
-2. Install yarn: `npm i... | false |
Other | vercel | next.js | 00badd4d5869bf6e5d22690c932c7b3ba5dad34d.json | Initialize Git repo on app creation (#9376)
* Initialize Git repo on app creation
This PR initializes a Git repository after Create Next App runs.
We ensure the app was not created in an already-existing Git or Mercurial repo.
Failures of setup (no Git installed) do not fail the application bootstrapping.
Closes #9... | packages/create-next-app/@types/rimraf.d.ts | @@ -0,0 +1,50 @@
+// 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 | 00badd4d5869bf6e5d22690c932c7b3ba5dad34d.json | Initialize Git repo on app creation (#9376)
* Initialize Git repo on app creation
This PR initializes a Git repository after Create Next App runs.
We ensure the app was not created in an already-existing Git or Mercurial repo.
Failures of setup (no Git installed) do not fail the application bootstrapping.
Closes #9... | packages/create-next-app/create-app.ts | @@ -6,6 +6,7 @@ import os from 'os'
import path from 'path'
import { downloadAndExtractExample, hasExample } from './helpers/examples'
+import { tryGitInit } from './helpers/git'
import { install } from './helpers/install'
import { isFolderEmpty } from './helpers/is-folder-empty'
import { getOnline } from './hel... | true |
Other | vercel | next.js | 00badd4d5869bf6e5d22690c932c7b3ba5dad34d.json | Initialize Git repo on app creation (#9376)
* Initialize Git repo on app creation
This PR initializes a Git repository after Create Next App runs.
We ensure the app was not created in an already-existing Git or Mercurial repo.
Failures of setup (no Git installed) do not fail the application bootstrapping.
Closes #9... | packages/create-next-app/helpers/git.ts | @@ -0,0 +1,45 @@
+import { execSync } from 'child_process'
+import path from 'path'
+import rimraf from 'rimraf'
+
+function isInGitRepository() {
+ try {
+ execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' })
+ return true
+ } catch (_) {}
+ return false
+}
+
+function isInMercurialRepository(... | true |
Other | vercel | next.js | 00badd4d5869bf6e5d22690c932c7b3ba5dad34d.json | Initialize Git repo on app creation (#9376)
* Initialize Git repo on app creation
This PR initializes a Git repository after Create Next App runs.
We ensure the app was not created in an already-existing Git or Mercurial repo.
Failures of setup (no Git installed) do not fail the application bootstrapping.
Closes #9... | packages/create-next-app/package.json | @@ -40,7 +40,7 @@
"make-dir": "3.0.0",
"promisepipe": "3.0.0",
"prompts": "2.1.0",
- "rimraf": "2.6.3",
+ "rimraf": "3.0.0",
"tar": "4.4.10",
"typescript": "^3.5.3",
"update-check": "1.5.3", | true |
Other | vercel | next.js | 00badd4d5869bf6e5d22690c932c7b3ba5dad34d.json | Initialize Git repo on app creation (#9376)
* Initialize Git repo on app creation
This PR initializes a Git repository after Create Next App runs.
We ensure the app was not created in an already-existing Git or Mercurial repo.
Failures of setup (no Git installed) do not fail the application bootstrapping.
Closes #9... | test/integration/create-next-app/index.test.js | @@ -76,5 +76,9 @@ describe('create next app', () => {
expect(
fs.existsSync(path.join(cwd, projectName, 'pages/index.js'))
).toBeTruthy()
+ // check we copied default `.gitignore`
+ expect(
+ fs.existsSync(path.join(cwd, projectName, '.gitignore'))
+ ).toBeTruthy()
})
}) | true |
Other | vercel | next.js | 00badd4d5869bf6e5d22690c932c7b3ba5dad34d.json | Initialize Git repo on app creation (#9376)
* Initialize Git repo on app creation
This PR initializes a Git repository after Create Next App runs.
We ensure the app was not created in an already-existing Git or Mercurial repo.
Failures of setup (no Git installed) do not fail the application bootstrapping.
Closes #9... | yarn.lock | @@ -13131,7 +13131,7 @@ rimraf@2, rimraf@2.6.3, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6
dependencies:
glob "^7.1.3"
-rimraf@^3.0.0:
+rimraf@3.0.0, rimraf@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.0.tgz#614176d4b3010b75e5c390eb0ee96f6dc0cebb9b"
... | true |
Other | vercel | next.js | b3dbcbb5bbe6154dc1c16cf97d774be9089912b5.json | Fix typo in API routes documentation. (#9373) | packages/next/README.md | @@ -1116,7 +1116,7 @@ export default withRouter(MyLink)
</ul>
</details>
-API routes provides a straightforward solution to build your **API** with Next.js.
+API routes provide a straightforward solution to build your **API** with Next.js.
Start by creating the `api/` folder inside the `./pages/` folder.
Ever... | false |
Other | vercel | next.js | c39c5d264ee06a5b2470643619b407f2456a0d9a.json | Add error handling for `_error` page (#7608) | packages/next-server/server/next-server.ts | @@ -582,10 +582,25 @@ export default class Server {
query: ParsedUrlQuery = {}
) {
const result = await this.findPageComponents('/_error', query)
- return this.renderToHTMLWithComponents(req, res, '/_error', query, result, {
- ...this.renderOpts,
- err,
- })
+ let html
+ try {
+ ... | true |
Other | vercel | next.js | c39c5d264ee06a5b2470643619b407f2456a0d9a.json | Add error handling for `_error` page (#7608) | test/integration/error-in-error/pages/_error.js | @@ -0,0 +1,21 @@
+import React from 'react'
+
+class Error extends React.Component {
+ static async getInitialProps ({ res, err }) {
+ await Promise.reject(new Error('an error in error'))
+ const statusCode = res ? res.statusCode : err ? err.statusCode : null
+ return { statusCode }
+ }
+
+ render () {
+ ... | true |
Other | vercel | next.js | c39c5d264ee06a5b2470643619b407f2456a0d9a.json | Add error handling for `_error` page (#7608) | test/integration/error-in-error/pages/index.js | @@ -0,0 +1,10 @@
+import Link from 'next/link'
+
+export default () => (
+ <>
+ <h3>Hi 👋</h3>
+ <Link href='/a-non-existing-page'>
+ <a>a lnik to no-where</a>
+ </Link>
+ </>
+) | true |
Other | vercel | next.js | c39c5d264ee06a5b2470643619b407f2456a0d9a.json | Add error handling for `_error` page (#7608) | test/integration/error-in-error/test/index.test.js | @@ -0,0 +1,39 @@
+/* eslint-env jest */
+/* global jasmine */
+import path from 'path'
+import webdriver from 'next-webdriver'
+import {
+ nextBuild,
+ nextStart,
+ findPort,
+ killApp,
+ renderViaHTTP,
+ waitFor
+} from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
+const appDir = path.jo... | true |
Other | vercel | next.js | 3b66fd3be597d5c762e0b7f941ebb506b0f06e89.json | Remove invalid meta type (#7549) | packages/next-server/lib/head.tsx | @@ -54,7 +54,7 @@ function onlyReactElement(
return list.concat(child)
}
-const METATYPES = ['name', 'httpEquiv', 'charSet', 'viewport', 'itemProp']
+const METATYPES = ['name', 'httpEquiv', 'charSet', 'itemProp']
/*
returns a function for filtering head child elements
@@ -84,7 +84,7 @@ function unique() {
... | false |
Other | vercel | next.js | 8e3c5c2be0f1222f82290560f6ffdcd5eab8884e.json | Improve TypeScript package install experience (#7548)
This change will prompt the user about missing packages using the same DX instead of two separate code paths. | examples/with-typescript/next-env.d.ts | @@ -0,0 +1 @@
+/// <reference types="next" /> | true |
Other | vercel | next.js | 8e3c5c2be0f1222f82290560f6ffdcd5eab8884e.json | Improve TypeScript package install experience (#7548)
This change will prompt the user about missing packages using the same DX instead of two separate code paths. | examples/with-typescript/tsconfig.json | @@ -6,7 +6,10 @@
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
- "lib": ["dom", "es2017"],
+ "lib": [
+ "dom",
+ "es2017"
+ ],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
@@ -18,6 +21,11 @@
"strict": true,
... | true |
Other | vercel | next.js | 8e3c5c2be0f1222f82290560f6ffdcd5eab8884e.json | Improve TypeScript package install experience (#7548)
This change will prompt the user about missing packages using the same DX instead of two separate code paths. | packages/next/lib/verifyTypeScriptSetup.ts | @@ -9,15 +9,6 @@ import resolve from 'next/dist/compiled/resolve/index.js'
const exists = promisify(fs.exists)
const writeFile = promisify(fs.writeFile)
-const resolveP = (req: string, opts: any): Promise<string> => {
- return new Promise((_resolve, reject) => {
- resolve(req, opts, (err, res) => {
- if (e... | true |
Other | vercel | next.js | 8e3c5c2be0f1222f82290560f6ffdcd5eab8884e.json | Improve TypeScript package install experience (#7548)
This change will prompt the user about missing packages using the same DX instead of two separate code paths. | packages/next/taskfile.js | @@ -46,7 +46,10 @@ const babelServerOpts = {
}
]
],
- plugins: [['@babel/plugin-proposal-class-properties', { loose: true }]]
+ plugins: [
+ 'babel-plugin-dynamic-import-node',
+ ['@babel/plugin-proposal-class-properties', { loose: true }]
+ ]
}
// eslint-disable-next-line camelcase
@@ -113,... | true |
Other | vercel | next.js | ffba70260845c2ba1acead5c900be2d3a3fd0f8e.json | Create file referencing Next.js types (#7545) | packages/next/lib/verifyTypeScriptSetup.ts | @@ -268,6 +268,15 @@ export async function verifyTypeScriptSetup(dir: string): Promise<void> {
await writeJson(tsConfigPath, appTsConfig)
}
+ // Reference `next` types
+ const appTypeDeclarations = path.join(dir, 'next-env.d.ts')
+ if (!fs.existsSync(appTypeDeclarations)) {
+ fs.writeFileSync(
+ ap... | false |
Other | vercel | next.js | 3d3855093a6e3d76c3aeb5cb385c8f2f6ef3788c.json | Fix sentence in with-context-api example (#7542) | examples/with-context-api/README.md | @@ -41,7 +41,7 @@ now
This example shows how to use react context api in our app.
-It provides an example of using `pages/_app.js` to include include the context api provider and then shows how both the `pages/index.js` and `pages/about.js` can both share the same data using the context api consumer.
+It provides ... | false |
Other | vercel | next.js | af890406221ff7af4310ef1b4ac56e54913db889.json | Add Typescript to next-mdx readme (#7540)
I added a link to the MDX docs because to enable Typescript we do exactly the same. | packages/next-mdx/readme.md | @@ -72,3 +72,7 @@ module.exports = withMDX({
pageExtensions: ['js', 'jsx', 'mdx'],
})
```
+
+## Typescript
+
+Follow [this guide](https://mdxjs.com/advanced/typescript) from the MDX docs. | false |
Other | vercel | next.js | e49f26d64475a35c1d2c3a73eeffda93e95e7483.json | Restore onMouseEnter event (#7531) | packages/next/client/link.tsx | @@ -214,7 +214,10 @@ class Link extends Component<LinkProps> {
ref?: any
} = {
ref: (el: any) => this.handleRef(el),
- onMouseEnter: () => {
+ onMouseEnter: (e: React.MouseEvent) => {
+ if (child.props && typeof child.props.onMouseEnter === 'function') {
+ child.props.onMous... | false |
Other | vercel | next.js | 6c5a573352b1d8348ba525762afe42fde0c7f75f.json | Add types for `<Html>` and `<Head>` element (#7524)
* Clean up _document documentation
* Add types for `<Html>` and `<Head>` element | packages/next/pages/_document.tsx | @@ -88,7 +88,12 @@ export default class Document<P = {}> extends Component<DocumentProps & P> {
}
}
-export class Html extends Component {
+export class Html extends Component<
+ React.DetailedHTMLProps<
+ React.HtmlHTMLAttributes<HTMLHtmlElement>,
+ HTMLHtmlElement
+ >
+> {
static contextTypes = {
... | false |
Other | vercel | next.js | 86d62afaf9b98b58f31d0a027be2452223ee884f.json | Adjust Flying Shuttle message (#7522)
* Adjust Flying Shuttle message
This adjusts the flying shuttle message for when a shuttle is not found or cannot be reused to reduce confusion to the user opting into the feature.
* Tweak message | packages/next/build/flying-shuttle.ts | @@ -200,8 +200,6 @@ export class FlyingShuttle {
if (found) {
Log.info('flying shuttle is docked')
- } else {
- Log.info('could not locate flying shuttle')
}
return found
@@ -298,7 +296,9 @@ export class FlyingShuttle {
const c = pageNames.length - u
Log.info(`found ${c} ... | true |
Other | vercel | next.js | 86d62afaf9b98b58f31d0a027be2452223ee884f.json | Adjust Flying Shuttle message (#7522)
* Adjust Flying Shuttle message
This adjusts the flying shuttle message for when a shuttle is not found or cannot be reused to reduce confusion to the user opting into the feature.
* Tweak message | test/integration/flying-shuttle/test/index.test.js | @@ -29,7 +29,7 @@ describe('Flying Shuttle', () => {
stdout: true
})
const buildText = stripAnsi(stdout)
- expect(buildText).toMatch(/could not locate flying shuttle/)
+ expect(buildText).not.toMatch(/flying shuttle is docked/)
await fs.copy(
path.join(appDir, '.next'),
... | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | bench/package.json | @@ -4,6 +4,11 @@
"build": "next build",
"start": "NODE_ENV=production npm run build && NODE_ENV=production next start",
"bench:stateless": "ab -c1 -n3000 http://0.0.0.0:3000/stateless",
- "bench:stateless-big": "ab -c1 -n500 http://0.0.0.0:3000/stateless-big"
+ "bench:stateless-big": "ab -c1 -n500 ... | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | bench/recursive-copy/run.js | @@ -0,0 +1,63 @@
+const { join } = require('path')
+const fs = require('fs-extra')
+
+const recursiveCopyNpm = require('recursive-copy')
+
+const {
+ recursiveCopy: recursiveCopyCustom
+} = require('next/dist/lib/recursive-copy')
+
+const fixturesDir = join(__dirname, 'fixtures')
+const srcDir = join(fixturesDir, 'src... | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | examples/with-sitemap-and-robots-express-server-typescript/src/server/sitemap.ts | @@ -4,7 +4,7 @@ import { posts } from './posts'
const sitemap = sm.createSitemap({
cacheTime: 600000, // 600 sec - cache purge period
- hostname: 'https://sitemap-robots-typescript.now.sh',
+ hostname: 'https://sitemap-robots-typescript.now.sh'
})
const addSitemap = ({ server }) => {
@@ -13,20 +13,20 @@ con... | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | examples/with-typescript/utils/sample-api.ts | @@ -5,15 +5,15 @@ export const dataArray: User[] = [
{ id: 101, name: 'Alice' },
{ id: 102, name: 'Bob' },
{ id: 103, name: 'Caroline' },
- { id: 104, name: 'Dave' },
+ { id: 104, name: 'Dave' }
]
/**
* Calls a mock API which finds a user by ID from the list above.
*
* Throws an error if not found.... | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | linkfolder | @@ -0,0 +1 @@
+folder1
\ No newline at end of file | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | packages/next/export/index.js | @@ -1,6 +1,6 @@
import { cpus } from 'os'
import { fork } from 'child_process'
-import cp from 'recursive-copy'
+import { recursiveCopy } from '../lib/recursive-copy'
import mkdirpModule from 'mkdirp'
import { resolve, join } from 'path'
import { existsSync, readFileSync } from 'fs'
@@ -73,13 +73,13 @@ export defa... | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | packages/next/lib/recursive-copy.ts | @@ -0,0 +1,58 @@
+import path from 'path'
+import fs from 'fs'
+import { promisify } from 'util'
+import { Sema } from 'async-sema'
+
+const mkdir = promisify(fs.mkdir)
+const stat = promisify(fs.stat)
+const readdir = promisify(fs.readdir)
+const copyFile = promisify(fs.copyFile)
+
+const COPYFILE_EXCL = fs.constants.... | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | packages/next/package.json | @@ -86,7 +86,6 @@
"prop-types-exact": "1.2.0",
"react-error-overlay": "5.1.6",
"react-is": "16.8.6",
- "recursive-copy": "2.0.10",
"serialize-javascript": "1.7.0",
"source-map": "0.6.1",
"string-hash": "1.1.3", | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | test/unit/recursive-copy.test.js | @@ -0,0 +1,51 @@
+/* eslint-env jest */
+import { recursiveCopy } from 'next/dist/lib/recursive-copy'
+import { join } from 'path'
+import fs from 'fs-extra'
+import { readFileSync } from 'fs'
+
+const testDir = join(__dirname, 'recursive-folder-test')
+
+const srcDir = join(testDir, 'src')
+const destDir = join(testDi... | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | test/unit/recursive-delete.test.js | @@ -1,15 +1,15 @@
/* eslint-env jest */
import { recursiveDelete } from 'next/dist/lib/recursive-delete'
import { recursiveReadDir } from 'next/dist/lib/recursive-readdir'
-import cp from 'recursive-copy'
+import { recursiveCopy } from 'next/dist/lib/recursive-copy'
import { join } from 'path'
const resolveDataD... | true |
Other | vercel | next.js | 3b5f18495b390a70435066169edac2b4f16d1ffe.json | Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation
* update yarn.lock
* do not filter out not directories
* do not fail if folder already exists
* replace `\` by `/` when sending pathes to filter
* use fs-extra only in tests
* investigate and test ... | yarn.lock | @@ -4532,19 +4532,6 @@ deglob@^2.1.0:
run-parallel "^1.1.2"
uniq "^1.0.1"
-del@^2.2.0:
- version "2.2.2"
- resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8"
- integrity sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=
- dependencies:
- globby "^5.0.0"
- is-path-... | true |
Other | vercel | next.js | be02b881c559552f01acacf6ab61353a6e699a5f.json | Fix auto export in serverless (#7517)
* Fix nextExport not being set in serverless
* Add test for refreshing query | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -72,6 +72,7 @@ const nextServerlessLoader: loader.Loader = function() {
{
Component,
dataOnly: req.headers && (req.headers.accept || '').indexOf('application/amp.bind+json') !== -1,
+ nextExport: fromExport
},
options,
) | true |
Other | vercel | next.js | be02b881c559552f01acacf6ab61353a6e699a5f.json | Fix auto export in serverless (#7517)
* Fix nextExport not being set in serverless
* Add test for refreshing query | test/integration/auto-export-serverless/next.config.js | @@ -0,0 +1,7 @@
+module.exports = {
+ target: 'serverless',
+ experimental: {
+ autoExport: true,
+ dynamicRouting: true
+ }
+} | true |
Other | vercel | next.js | be02b881c559552f01acacf6ab61353a6e699a5f.json | Fix auto export in serverless (#7517)
* Fix nextExport not being set in serverless
* Add test for refreshing query | test/integration/auto-export-serverless/pages/$post.js | @@ -0,0 +1,7 @@
+import { useRouter } from 'next/router'
+
+export default () => {
+ const { query } = useRouter()
+
+ return <p>post: {query.post}</p>
+} | true |
Other | vercel | next.js | be02b881c559552f01acacf6ab61353a6e699a5f.json | Fix auto export in serverless (#7517)
* Fix nextExport not being set in serverless
* Add test for refreshing query | test/integration/auto-export-serverless/test/index.test.js | @@ -0,0 +1,26 @@
+/* eslint-env jest */
+/* global jasmine */
+import webdriver from 'next-webdriver'
+import path from 'path'
+import { nextBuild, nextStart, findPort, killApp } from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
+const appDir = path.join(__dirname, '..')
+let appPort
+let app
+... | true |
Other | vercel | next.js | 2bb2b57395526ee9df448abe438741f6e78b2975.json | Fix autoExport on windows and add tests (#7514) | packages/next/build/index.ts | @@ -382,7 +382,10 @@ export default async function build(dir: string, conf = null): Promise<void> {
for (const page of staticPages) {
const { serverBundle } = pageInfos.get(page)!
if (!serverDir) {
- serverDir = path.join(serverBundle.split(/\/pages/).shift()!, 'pages')
+ serverDir = pa... | true |
Other | vercel | next.js | 2bb2b57395526ee9df448abe438741f6e78b2975.json | Fix autoExport on windows and add tests (#7514) | test/integration/auto-export-fs/next.config.js | @@ -0,0 +1,7 @@
+module.exports = {
+ target: 'serverless',
+ experimental: {
+ autoExport: true,
+ flyingShuttle: true
+ }
+} | true |
Other | vercel | next.js | 2bb2b57395526ee9df448abe438741f6e78b2975.json | Fix autoExport on windows and add tests (#7514) | test/integration/auto-export-fs/pages/123/hello.js | @@ -0,0 +1 @@
+export default () => <p>hello 123</p> | true |
Other | vercel | next.js | 2bb2b57395526ee9df448abe438741f6e78b2975.json | Fix autoExport on windows and add tests (#7514) | test/integration/auto-export-fs/pages/abc.js | @@ -0,0 +1 @@
+export default () => <p>hello abc</p> | true |
Other | vercel | next.js | 2bb2b57395526ee9df448abe438741f6e78b2975.json | Fix autoExport on windows and add tests (#7514) | test/integration/auto-export-fs/pages/another.js | @@ -0,0 +1 @@
+export default () => <p>hello another</p> | true |
Other | vercel | next.js | 2bb2b57395526ee9df448abe438741f6e78b2975.json | Fix autoExport on windows and add tests (#7514) | test/integration/auto-export-fs/test/index.test.js | @@ -0,0 +1,110 @@
+/* eslint-env jest */
+/* global jasmine */
+import path from 'path'
+import fs from 'fs-extra'
+import {
+ nextBuild,
+ nextStart,
+ findPort,
+ renderViaHTTP,
+ killApp
+} from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
+const appDir = path.join(__dirname, '..')
+let... | true |
Other | vercel | next.js | 93aaacd58d3ca4c8ffa1307fbf61c06ae391c70d.json | Fix serverless dynamic routes (#7505)
* Fix serverDir resolving for autoExporting
* Fix dynamic routes in serverless loader | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -43,7 +43,7 @@ const nextServerlessLoader: loader.Loader = function() {
import {sendHTML} from 'next-server/dist/server/send-html';
${
page.includes('/$')
- ? `import {getRouteMatch} from 'next-server/dist/lib/router/utils';`
+ ? `import {getRouteMatcher, getRouteRegex} from 'next-serv... | false |
Other | vercel | next.js | 725f8c2b64e7b6d19c632b157f6633c2d7d7c696.json | Update ant design examples (#7490)
* Update with-ant-design example to not
need require.extensions hack
* Update other ant-design examples to not
use require.extensions hack | examples/with-ant-design-less/next.config.js | @@ -9,14 +9,32 @@ const themeVariables = lessToJS(
fs.readFileSync(path.resolve(__dirname, './assets/antd-custom.less'), 'utf8')
)
-// fix: prevents error when .less files are required by node
-if (typeof require !== 'undefined') {
- require.extensions['.less'] = file => {}
-}
-
module.exports = withLess({
l... | true |
Other | vercel | next.js | 725f8c2b64e7b6d19c632b157f6633c2d7d7c696.json | Update ant design examples (#7490)
* Update with-ant-design example to not
need require.extensions hack
* Update other ant-design examples to not
use require.extensions hack | examples/with-ant-design-less/package.json | @@ -13,6 +13,7 @@
"less": "3.0.4",
"less-vars-to-js": "1.3.0",
"next": "latest",
+ "null-loader": "2.0.0",
"react": "^16.7.0",
"react-dom": "^16.7.0"
}, | true |
Other | vercel | next.js | 725f8c2b64e7b6d19c632b157f6633c2d7d7c696.json | Update ant design examples (#7490)
* Update with-ant-design example to not
need require.extensions hack
* Update other ant-design examples to not
use require.extensions hack | examples/with-ant-design/next.config.js | @@ -1,9 +1,28 @@
/* eslint-disable */
const withCss = require('@zeit/next-css')
-// fix: prevents error when .css files are required by node
-if (typeof require !== 'undefined') {
- require.extensions['.css'] = file => {}
-}
+module.exports = withCss({
+ webpack: (config, { isServer }) => {
+ if (isServer) {
+... | true |
Other | vercel | next.js | 725f8c2b64e7b6d19c632b157f6633c2d7d7c696.json | Update ant design examples (#7490)
* Update with-ant-design example to not
need require.extensions hack
* Update other ant-design examples to not
use require.extensions hack | examples/with-ant-design/package.json | @@ -11,6 +11,7 @@
"antd": "^3.9.2",
"babel-plugin-import": "^1.9.1",
"next": "latest",
+ "null-loader": "2.0.0",
"react": "^16.7.0",
"react-dom": "^16.7.0"
}, | true |
Other | vercel | next.js | 725f8c2b64e7b6d19c632b157f6633c2d7d7c696.json | Update ant design examples (#7490)
* Update with-ant-design example to not
need require.extensions hack
* Update other ant-design examples to not
use require.extensions hack | examples/with-ant-design/pages/_document.js | @@ -1,18 +0,0 @@
-import Document, { Head, Main, NextScript } from 'next/document'
-
-export default class MyDocument extends Document {
- render () {
- return (
- <html>
- <Head>
- <meta name='viewport' content='width=device-width, initial-scale=1' />
- <meta charSet='utf-8' />
- ... | true |
Other | vercel | next.js | 725f8c2b64e7b6d19c632b157f6633c2d7d7c696.json | Update ant design examples (#7490)
* Update with-ant-design example to not
need require.extensions hack
* Update other ant-design examples to not
use require.extensions hack | examples/with-antd-mobile/next.config.js | @@ -1,9 +1,27 @@
const withCSS = require('@zeit/next-css')
-// fix: prevents error when .css files are required by node
-if (typeof require !== 'undefined') {
- // eslint-disable-next-line
- require.extensions['.css'] = file => {}
-}
+module.exports = withCSS({
+ webpack: (config, { isServer }) => {
+ if (isSe... | true |
Other | vercel | next.js | 725f8c2b64e7b6d19c632b157f6633c2d7d7c696.json | Update ant design examples (#7490)
* Update with-ant-design example to not
need require.extensions hack
* Update other ant-design examples to not
use require.extensions hack | examples/with-antd-mobile/package.json | @@ -6,6 +6,7 @@
"antd-mobile": "2.2.5",
"babel-plugin-import": "^1.2.1",
"next": "latest",
+ "null-loader": "2.0.0",
"react": "^16.7.0",
"react-dom": "^16.7.0"
}, | true |
Other | vercel | next.js | 3245a5737014e74501859dc710b96fd439217c45.json | Remove .includes from _app for ie compatibility (#7482) | packages/next/pages/_app.tsx | @@ -73,7 +73,7 @@ export class Container extends React.Component {
if (__NEXT_DATA__.nextExport) {
const curQuery = '?' + stringifyQs(singletonRouter.query)
const hasDiffQuery = location.search && curQuery !== location.search
- const isDynamic = singletonRouter.pathname.includes('/$')
+ con... | false |
Other | vercel | next.js | f8e9cbba7bfed6ca6554759fe970071be17d1ffc.json | Consolidate import statements | packages/next-server/server/next-server.ts | @@ -14,9 +14,11 @@ import {
PHASE_PRODUCTION_SERVER,
SERVER_DIRECTORY,
} from '../lib/constants'
-import { getRouteMatcher } from '../lib/router/utils/route-matcher'
-import { getRouteRegex } from '../lib/router/utils/route-regex'
-import { getSortedRoutes } from '../lib/router/utils/sorted-routes'
+import {
+ ... | true |
Other | vercel | next.js | f8e9cbba7bfed6ca6554759fe970071be17d1ffc.json | Consolidate import statements | packages/next/server/next-dev-server.js | @@ -9,9 +9,11 @@ import { ampValidation } from '../build/output/index'
import * as Log from '../build/output/log'
import { verifyTypeScriptSetup } from '../lib/verifyTypeScriptSetup'
import Watchpack from 'watchpack'
-import { getRouteMatcher } from 'next-server/dist/lib/router/utils/route-matcher'
-import { getRout... | true |
Other | vercel | next.js | 7f187b46218540cb24cf11997ec7b273084f5250.json | Add new stub file for exports | packages/next-server/lib/router/utils/index.ts | @@ -0,0 +1,3 @@
+export { getRouteMatcher } from './route-matcher'
+export { getRouteRegex } from './route-regex'
+export { getSortedRoutes } from './sorted-routes' | false |
Other | vercel | next.js | 6ca1feaf98b2df0a700327b85609bdcb0fc6c51d.json | Add link to the Glamorous example (#1887) | readme.md | @@ -139,7 +139,7 @@ export default () => (
<summary>
<b>Examples</b>
</summary>
- <ul><li><a href="./examples/with-styled-components">Styled components</a></li><li><a href="./examples/with-styletron">Styletron</a></li><li><a href="./examples/with-glamor">Glamor</a></li><li><a href="./examples/with-cxs">Cx... | false |
Other | vercel | next.js | 3fbccff9368904ef9601a5764e8bb4b82ede2e8b.json | remove elliptic precomputed folder | server/build/webpack.js | @@ -74,6 +74,7 @@ export default async function createCompiler (dir, { dev = false, quiet = false,
}
const plugins = [
+ new webpack.IgnorePlugin(/(precomputed)/, /node_modules.+(elliptic)/),
new webpack.LoaderOptionsPlugin({
options: {
context: dir, | false |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | client/index.js | @@ -29,6 +29,8 @@ const {
location
} = window
+const asPath = getURL()
+
const pageLoader = new PageLoader(buildId, assetPrefix)
window.__NEXT_LOADED_PAGES__.forEach(({ route, fn }) => {
pageLoader.registerPage(route, fn)
@@ -56,7 +58,7 @@ export default async () => {
Component = ErrorComponent
}
-... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | lib/router/index.js | @@ -13,7 +13,7 @@ const SingletonRouter = {
}
// Create public properties and methods of the router in the SingletonRouter
-const propertyFields = ['components', 'pathname', 'route', 'query']
+const propertyFields = ['components', 'pathname', 'route', 'query', 'asPath']
const coreMethodFields = ['push', 'replace',... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | lib/router/router.js | @@ -27,7 +27,7 @@ export default class Router {
this.ErrorComponent = ErrorComponent
this.pathname = pathname
this.query = query
- this.as = as
+ this.asPath = as
this.subscriptions = new Set()
this.componentLoadCancel = null
this.onPopState = this.onPopState.bind(this)
@@ -190,7 +19... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | readme.md | @@ -238,6 +238,7 @@ export default Page
- `pathname` - path section of URL
- `query` - query string section of URL parsed as an object
+- `asPath` - the actual url path
- `req` - HTTP request object (server only)
- `res` - HTTP response object (server only)
- `jsonPageRes` - [Fetch Response](https://developer.mo... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | server/render.js | @@ -54,7 +54,8 @@ async function doRender (req, res, pathname, query, {
])
Component = Component.default || Component
Document = Document.default || Document
- const ctx = { err, req, res, pathname, query }
+ const asPath = req.url
+ const ctx = { err, req, res, pathname, query, asPath }
const props = aw... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | test/integration/basic/pages/nav/as-path-using-router.js | @@ -0,0 +1,22 @@
+import React from 'react'
+import Router from 'next/router'
+
+export default class extends React.Component {
+ constructor (...args) {
+ super(...args)
+ this.state = {}
+ }
+
+ componentDidMount () {
+ const asPath = Router.asPath
+ this.setState({ asPath })
+ }
+
+ render () {
+ ... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | test/integration/basic/pages/nav/as-path.js | @@ -0,0 +1,15 @@
+import React from 'react'
+
+export default class extends React.Component {
+ static getInitialProps ({ asPath, req }) {
+ return { asPath }
+ }
+
+ render () {
+ return (
+ <div className='as-path-content'>
+ {this.props.asPath}
+ </div>
+ )
+ }
+} | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | test/integration/basic/pages/nav/index.js | @@ -35,6 +35,9 @@ export default class extends Component {
<a id='query-string-link' style={linkStyle}>QueryString</a>
</Link>
<Link href='/nav/about' replace><a id='about-replace-link' style={linkStyle}>Replace state</a></Link>
+ <Link href='/nav/as-path' as='/as/path'><a id='as-pat... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | test/integration/basic/test/client-navigation.js | @@ -347,5 +347,44 @@ export default (context, render) => {
browser.close()
})
})
+
+ describe('with asPath', () => {
+ describe('inside getInitialProps', () => {
+ it('should show the correct asPath with a Link with as prop', async () => {
+ const browser = await webdriver(c... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | test/integration/basic/test/index.test.js | @@ -51,6 +51,8 @@ describe('Basic Features', () => {
renderViaHTTP(context.appPort, '/nav/hash-changes'),
renderViaHTTP(context.appPort, '/nav/shallow-routing'),
renderViaHTTP(context.appPort, '/nav/redirect'),
+ renderViaHTTP(context.appPort, '/nav/as-path'),
+ renderViaHTTP(context.appP... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | test/integration/basic/test/rendering.js | @@ -3,8 +3,8 @@
import cheerio from 'cheerio'
export default function ({ app }, suiteName, render) {
- async function get$ (path) {
- const html = await render(path)
+ async function get$ (path, query) {
+ const html = await render(path, query)
return cheerio.load(html)
}
@@ -69,6 +69,11 @@ export... | true |
Other | vercel | next.js | 24f3f143a687ebb365c828a7ee72968a35c23594.json | Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.
* Add test cases.
* Update docs.
* Build as-path pages before they use. | test/lib/next-test-utils.js | @@ -11,7 +11,8 @@ export const nextBuild = build
export const pkg = _pkg
export function renderViaAPI (app, pathname, query = {}) {
- return app.renderToHTML({}, {}, pathname, query)
+ const url = `${pathname}?${qs.stringify(query)}`
+ return app.renderToHTML({ url }, {}, pathname, query)
}
export function r... | true |
Other | vercel | next.js | 87773b98dc08391d023898aea6413d922e80c89b.json | add react production aliases (#1855) | server/build/webpack.js | @@ -298,6 +298,14 @@ export default async function createCompiler (dir, { dev = false, quiet = false,
performance: { hints: false }
}
+ if (!dev) {
+ webpackConfig.resolve.alias = {
+ 'react': require.resolve('react/dist/react.min.js'),
+ 'react-dom': require.resolve('react-dom/dist/react-dom.mi... | false |
Other | vercel | next.js | cb635dd9a55aa1ddbf83170b1364372e45636048.json | use configured distDir where required (#1816) | server/index.js | @@ -131,7 +131,7 @@ export default class Server {
return await renderScriptError(req, res, '/_error', error, customFields, this.renderOpts)
}
- const p = join(this.dir, '.next/bundles/pages/_error.js')
+ const p = join(this.dir, `${this.dist}/bundles/pages/_error.js`)
await ... | true |
Other | vercel | next.js | cb635dd9a55aa1ddbf83170b1364372e45636048.json | use configured distDir where required (#1816) | server/render.js | @@ -109,7 +109,8 @@ async function doRender (req, res, pathname, query, {
export async function renderScript (req, res, page, opts) {
try {
- const path = join(opts.dir, '.next', 'bundles', 'pages', page)
+ const dist = getConfig(opts.dir).distDir
+ const path = join(opts.dir, dist, 'bundles', 'pages', p... | true |
Other | vercel | next.js | fc34484e5e24680c0343065be6a82d3e043cbd37.json | Fix a typo. | lib/dynamic.js | @@ -21,9 +21,9 @@ export default function dynamicComponent (promise, options = {}) {
loadComponent () {
promise.then((AsyncComponent) => {
// Set a readable displayName for the wrapper component
- const ayncCompName = AsyncComponent.displayName || AsyncComponent.name
- if (ayncCompNam... | false |
Other | vercel | next.js | 753113bb9cbd10b9dc49770744e8d85d41788cbb.json | Add some tests for dynamic rendering. | test/integration/basic/components/hello1.js | @@ -0,0 +1,3 @@
+export default () => (
+ <p>Hello World 1</p>
+) | true |
Other | vercel | next.js | 753113bb9cbd10b9dc49770744e8d85d41788cbb.json | Add some tests for dynamic rendering. | test/integration/basic/pages/dynamic/no-ssr-custom-loading.js | @@ -0,0 +1,8 @@
+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 | 753113bb9cbd10b9dc49770744e8d85d41788cbb.json | Add some tests for dynamic rendering. | test/integration/basic/pages/dynamic/no-ssr.js | @@ -0,0 +1,5 @@
+import dynamic from 'next/dynamic'
+
+const Hello = dynamic(import('../../components/hello1'), { ssr: false })
+
+export default Hello | true |
Other | vercel | next.js | 753113bb9cbd10b9dc49770744e8d85d41788cbb.json | Add some tests for dynamic rendering. | test/integration/basic/pages/dynamic/ssr.js | @@ -0,0 +1,5 @@
+import dynamic from 'next/dynamic'
+
+const Hello = dynamic(import('../../components/hello1'))
+
+export default Hello | true |
Other | vercel | next.js | 753113bb9cbd10b9dc49770744e8d85d41788cbb.json | Add some tests for dynamic rendering. | test/integration/basic/test/rendering.js | @@ -74,5 +74,20 @@ export default function ({ app }, suiteName, render) {
expect($('h1').text()).toBe('404')
expect($('h2').text()).toBe('This page could not be found.')
})
+
+ test('render dynmaic import components via SSR', async () => {
+ const $ = await get$('/dynamic/ssr')
+ expect(... | true |
Other | vercel | next.js | 857a1d31381342847846b95b80cd811023af58ad.json | Add some test cases for the same loop promise. | test/unit/same-loop-promise.test.js | @@ -0,0 +1,137 @@
+/* global describe, it, expect */
+
+import { SameLoopPromise } from '../../dist/lib/dynamic'
+
+describe('SameLoopPromise', () => {
+ describe('basic api', () => {
+ it('should support basic promise resolving', (done) => {
+ const promise = new SameLoopPromise((resolve) => {
+ setTim... | false |
Other | vercel | next.js | b52b91a840f585594678d9746087e3bdb1a668f0.json | fix typo in with-material-ui readme (#1797) | examples/with-material-ui/README.md | @@ -21,6 +21,7 @@ Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.
```bash
now
+```
## The idea behind the example
| false |
Other | vercel | next.js | fb0b7534d7ccec36b582e819436bfc7c07062187.json | Update isLocal logic to enforce protocol and port (#1737) | lib/link.js | @@ -129,8 +129,8 @@ export default class Link extends Component {
function isLocal (href) {
const url = parse(href, false, true)
const origin = parse(getLocationOrigin(), false, true)
- return (!url.host || !url.hostname) ||
- (origin.host === url.host || origin.hostname === url.hostname)
+ return !url.host... | false |
Other | vercel | next.js | 4f1ba6ac78253a815c843e863596fd8403be7392.json | Add wallaby.js support (#1742) | wallaby.js | @@ -0,0 +1,31 @@
+module.exports = function (wallaby) {
+ return {
+ files: [
+ 'server/**/*.js',
+ 'client/**/*.js',
+ 'lib/**/*.js',
+ 'dist/**/*.js',
+ 'test/**/*.*',
+ '!test/**/*.test.js'
+ ],
+
+ tests: [
+ 'test/**/*.test.js',
+ '!test/integration/**/*.test.js'
+... | false |
Other | vercel | next.js | 1bb20b1930fb9d849c8e091847664cd1c6b91b40.json | Add socket.io example (#1766)
* Add socket.io example
* [update] stop handling events before unmount
* [update] add deploy to now button
* Fix linting problems
* Fix last missing linting problem | examples/with-socket.io/README.md | @@ -0,0 +1,25 @@
+[](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-socket.io)
+
+# Socket.io example
+
+## How to use
+
+Download the example [or clone the repo](https://github.com/zeit/next.js):
+
+```bash
+curl https://co... | true |
Other | vercel | next.js | 1bb20b1930fb9d849c8e091847664cd1c6b91b40.json | Add socket.io example (#1766)
* Add socket.io example
* [update] stop handling events before unmount
* [update] add deploy to now button
* Fix linting problems
* Fix last missing linting problem | examples/with-socket.io/package.json | @@ -0,0 +1,16 @@
+{
+ "dependencies": {
+ "express": "^4.15.2",
+ "isomorphic-fetch": "^2.2.1",
+ "next": "latest",
+ "react": "^15.5.4",
+ "react-dom": "^15.5.4",
+ "socket.io": "^1.7.3",
+ "socket.io-client": "^1.7.3"
+ },
+ "scripts": {
+ "dev": "node server.js",
+ "build": "next build"... | true |
Other | vercel | next.js | 1bb20b1930fb9d849c8e091847664cd1c6b91b40.json | Add socket.io example (#1766)
* Add socket.io example
* [update] stop handling events before unmount
* [update] add deploy to now button
* Fix linting problems
* Fix last missing linting problem | examples/with-socket.io/pages/index.js | @@ -0,0 +1,88 @@
+import { Component } from 'react'
+import io from 'socket.io-client'
+import fetch from 'isomorphic-fetch'
+
+class HomePage extends Component {
+ // fetch old messages data from the server
+ static async getInitialProps ({ req }) {
+ const response = await fetch('http://localhost:3000/messages')... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.