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 | 7b975d21562490788079a5161238d9652e2d4031.json | examples: Add an example for the next-css plugin (#3739)
- with css modules
- with additional webpack config
- with post css
- without css modules
Fix #3699 | examples/with-next-css/pages/index.js | @@ -0,0 +1,13 @@
+
+/* Without CSS Modules, maybe with PostCSS */
+
+import '../style.css'
+
+export default () => <div className='example'>O Hai world!</div>
+
+/* With CSS Modules */
+/*
+import css from "../style.css"
+
+export default () => <div className={css.example}>Hello World, I am being styled using CSS Modul... | true |
Other | vercel | next.js | 7b975d21562490788079a5161238d9652e2d4031.json | examples: Add an example for the next-css plugin (#3739)
- with css modules
- with additional webpack config
- with post css
- without css modules
Fix #3699 | examples/with-next-css/style.css | @@ -0,0 +1,16 @@
+.example {
+ font-size: 50px;
+ color: papayawhip;
+}
+
+/* Post-CSS */
+/*
+:root {
+ --some-color: red;
+}
+
+.example {
+ color: var(--some-color);
+}
+
+*/ | true |
Other | vercel | next.js | a7741341cb805ff256583ee91a170daf0f47acd0.json | Fix links for next css (#3820) | readme.md | @@ -169,9 +169,9 @@ To use more sophisticated CSS-in-JS solutions, you typically have to implement s
To support importing `.css` `.scss` or `.less` files you can use these modules, which configure sensible defaults for server rendered applications.
-- 
* fix copy pasta issue
* remove console.log derp
* resolve merge conflicts | examples/active-class-name/components/Link.js | @@ -8,7 +8,6 @@ const ActiveLink = ({ router, children, ...props }) => {
let className = child.props.className || null
if (router.pathname === props.href && props.activeClassName) {
className = `${className !== null ? className : ''} ${props.activeClassName}`.trim()
- console.log(className)
}
dele... | false |
Other | vercel | next.js | 64379ee34234273c45df6d7512d8e78450bc8e29.json | Get config from one location (#3801)
* Remove obsolete clean.js
* Remove unused root-module-relative-path
* Single source of configuration
* Fix next export | server/build/clean.js | @@ -1,8 +0,0 @@
-import { resolve } from 'path'
-import del from 'del'
-import getConfig from '../config'
-
-export default function clean (dir) {
- const dist = getConfig(dir).distDir
- return del(resolve(dir, dist), { force: true })
-} | true |
Other | vercel | next.js | 64379ee34234273c45df6d7512d8e78450bc8e29.json | Get config from one location (#3801)
* Remove obsolete clean.js
* Remove unused root-module-relative-path
* Single source of configuration
* Fix next export | server/build/root-module-relative-path.js | @@ -1,26 +0,0 @@
-// Next.js needs to use module.resolve to generate paths to modules it includes,
-// but those paths need to be relative to something so that they're portable
-// across directories and machines.
-//
-// This function returns paths relative to the top-level 'node_modules'
-// directory found in the pa... | true |
Other | vercel | next.js | 64379ee34234273c45df6d7512d8e78450bc8e29.json | Get config from one location (#3801)
* Remove obsolete clean.js
* Remove unused root-module-relative-path
* Single source of configuration
* Fix next export | server/export.js | @@ -85,6 +85,7 @@ export default async function (dir, options, configuration) {
// Start the rendering process
const renderOpts = {
dir,
+ dist: config.distDir,
buildStats,
buildId,
nextExport: true, | true |
Other | vercel | next.js | 64379ee34234273c45df6d7512d8e78450bc8e29.json | Get config from one location (#3801)
* Remove obsolete clean.js
* Remove unused root-module-relative-path
* Single source of configuration
* Fix next export | server/hot-reloader.js | @@ -1,19 +1,18 @@
import { join, relative, sep } from 'path'
import WebpackDevMiddleware from 'webpack-dev-middleware'
import WebpackHotMiddleware from 'webpack-hot-middleware'
+import del from 'del'
import onDemandEntryHandler from './on-demand-entry-handler'
import webpack from 'webpack'
import getBaseWebpackCo... | true |
Other | vercel | next.js | 64379ee34234273c45df6d7512d8e78450bc8e29.json | Get config from one location (#3801)
* Remove obsolete clean.js
* Remove unused root-module-relative-path
* Single source of configuration
* Fix next export | server/index.js | @@ -32,11 +32,12 @@ export default class Server {
this.dev = dev
this.quiet = quiet
this.router = new Router()
- this.hotReloader = dev ? this.getHotReloader(this.dir, { quiet, conf }) : null
this.http = null
this.config = getConfig(this.dir, conf)
this.dist = this.config.distDir
+ ... | true |
Other | vercel | next.js | 64379ee34234273c45df6d7512d8e78450bc8e29.json | Get config from one location (#3801)
* Remove obsolete clean.js
* Remove unused root-module-relative-path
* Single source of configuration
* Fix next export | server/render.js | @@ -5,7 +5,6 @@ import send from 'send'
import generateETag from 'etag'
import fresh from 'fresh'
import requirePage from './require'
-import getConfig from './config'
import { Router } from '../lib/router'
import { loadGetInitialProps, isResSent } from '../lib/utils'
import { getAvailableChunks } from './utils'
... | true |
Other | vercel | next.js | 6de3ff9d78108dc439cb49bbc22c8cf1bbcd8a5b.json | Remove redux comment (#3792)
Apollo client 2.0 is no longer implemented with redux | examples/with-apollo/README.md | @@ -47,5 +47,3 @@ In this simple example, we integrate Apollo seamlessly with Next by wrapping our
On initial page load, while on the server and inside `getInitialProps`, we invoke the Apollo method, [`getDataFromTree`](http://dev.apollodata.com/react/server-side-rendering.html#getDataFromTree). This method returns a... | false |
Other | vercel | next.js | fc3b3a4101338b5713fb900acb80bbabe597039c.json | Implement proper error handling (#3749)
* Render error on the client without fetching additional scripts.
* Fix test cases.
* Remove unused '_document' page in ensurePage logic
* Remove console.error when page is not found | client/index.js | @@ -21,6 +21,7 @@ const {
__NEXT_DATA__: {
props,
err,
+ page,
pathname,
query,
buildId,
@@ -76,7 +77,7 @@ export default async ({ ErrorDebugComponent: passedDebugComponent, stripAnsi: pa
ErrorComponent = await pageLoader.loadPage('/_error')
try {
- Component = await pageLoader... | true |
Other | vercel | next.js | fc3b3a4101338b5713fb900acb80bbabe597039c.json | Implement proper error handling (#3749)
* Render error on the client without fetching additional scripts.
* Fix test cases.
* Remove unused '_document' page in ensurePage logic
* Remove console.error when page is not found | server/document.js | @@ -89,7 +89,7 @@ export class Head extends Component {
return <head {...this.props}>
{(head || []).map((h, i) => React.cloneElement(h, { key: h.key || i }))}
- {page !== '_error' && <link rel='preload' href={`${assetPrefix}/_next/${buildId}/page${pagePathname}`} as='script' />}
+ {page !== '/_e... | true |
Other | vercel | next.js | fc3b3a4101338b5713fb900acb80bbabe597039c.json | Implement proper error handling (#3749)
* Render error on the client without fetching additional scripts.
* Fix test cases.
* Remove unused '_document' page in ensurePage logic
* Remove console.error when page is not found | server/render.js | @@ -30,7 +30,7 @@ export async function renderError (err, req, res, pathname, query, opts) {
}
export function renderErrorToHTML (err, req, res, pathname, query, opts = {}) {
- return doRender(req, res, pathname, query, { ...opts, err, page: '_error' })
+ return doRender(req, res, pathname, query, { ...opts, err,... | true |
Other | vercel | next.js | fc3b3a4101338b5713fb900acb80bbabe597039c.json | Implement proper error handling (#3749)
* Render error on the client without fetching additional scripts.
* Fix test cases.
* Remove unused '_document' page in ensurePage logic
* Remove console.error when page is not found | server/require.js | @@ -58,7 +58,6 @@ export default function requirePage (page, {dir, dist}) {
try {
return require(pagePath)
} catch (err) {
- console.error(err)
throw pageNotFoundError(page)
}
} | true |
Other | vercel | next.js | fc3b3a4101338b5713fb900acb80bbabe597039c.json | Implement proper error handling (#3749)
* Render error on the client without fetching additional scripts.
* Fix test cases.
* Remove unused '_document' page in ensurePage logic
* Remove console.error when page is not found | test/integration/basic/test/client-navigation.js | @@ -370,16 +370,8 @@ export default (context, render) => {
browser.close()
})
- it('should work with dir/index page ', async () => {
- const browser = await webdriver(context.appPort, '/nested-cdm/index')
- const text = await browser.elementByCss('p').text()
-
- expect(text).... | true |
Other | vercel | next.js | fc3b3a4101338b5713fb900acb80bbabe597039c.json | Implement proper error handling (#3749)
* Render error on the client without fetching additional scripts.
* Fix test cases.
* Remove unused '_document' page in ensurePage logic
* Remove console.error when page is not found | test/integration/basic/test/rendering.js | @@ -106,19 +106,27 @@ export default function ({ app }, suiteName, render, fetch) {
expect($('.as-path-content').text()).toBe('/nav/as-path?aa=10')
})
- test('error 404', async () => {
- const $ = await get$('/non-existent')
- expect($('h1').text()).toBe('404')
- expect($('h2').text()).t... | true |
Other | vercel | next.js | 68f7e20477160dcf8cf58869f4ce77a74a57abc7.json | Add example to #recipes (#3789) | readme.md | @@ -1268,6 +1268,7 @@ For the production deployment, you can use the [path alias](https://zeit.co/docs
- [Setting up 301 redirects](https://www.raygesualdo.com/posts/301-redirects-with-nextjs/)
- [Dealing with SSR and server only modules](https://arunoda.me/blog/ssr-and-server-only-modules)
+- [Building with React-... | false |
Other | vercel | next.js | 5daf3830db87b2d751a2e07715665d096788300b.json | fix: add missing dependency to package.json (#3753)
webpack-sources is used in code but not declared in package.json
ref https://github.com/pnpm/pnpm/issues/891 | package.json | @@ -105,6 +105,7 @@
"webpack": "3.10.0",
"webpack-dev-middleware": "1.12.0",
"webpack-hot-middleware": "2.21.0",
+ "webpack-sources": "1.1.0",
"write-file-webpack-plugin": "4.2.0",
"xss-filters": "1.2.7"
}, | true |
Other | vercel | next.js | 5daf3830db87b2d751a2e07715665d096788300b.json | fix: add missing dependency to package.json (#3753)
webpack-sources is used in code but not declared in package.json
ref https://github.com/pnpm/pnpm/issues/891 | yarn.lock | @@ -6882,7 +6882,7 @@ webpack-hot-middleware@2.21.0:
querystring "^0.2.0"
strip-ansi "^3.0.0"
-webpack-sources@^1.0.1, webpack-sources@^1.1.0:
+webpack-sources@1.1.0, webpack-sources@^1.0.1, webpack-sources@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-source... | true |
Other | vercel | next.js | 856700d576a6c8c8de5de29009aca28d4ae8f8f2.json | Register the right path | server/document.js | @@ -195,7 +195,7 @@ export class NextScript extends Component {
}
${page === '_error' && `
- __NEXT_REGISTER_PAGE('/index', function() {
+ __NEXT_REGISTER_PAGE('${pathname}', function() {
var error = new Error('Page does not exist: ${htmlescape(pathname)}')
... | false |
Other | vercel | next.js | efe9afb2be3059f97ac06b8fe105d8d9e30368a5.json | Remove aliasing of react and react-dom (#3731)
* Remove aliasing of react and react-dom
We need that functionality, but React does it automatically.
So, we don't need to do that.
This also fixes #3711 otherwise we need to add a few more aliases.
* Revert "Remove aliasing of react and react-dom"
This reverts c... | server/build/webpack.js | @@ -149,10 +149,15 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer
],
alias: {
next: nextDir,
- // This bypasses React's check for production mode. Since we know it is in production this way.
- // This allows us to exclude React from being uglified... | false |
Other | vercel | next.js | 929041133cc05d958ddb5ab60ea82c5d8af324ad.json | resolve react-dom/server (#688) | server/build/babel/preset.js | @@ -20,6 +20,7 @@ module.exports = {
'babel-runtime': babelRuntimePath,
react: require.resolve('react'),
'react-dom': require.resolve('react-dom'),
+ 'react-dom/server': require.resolve('react-dom/server'),
'next/link': require.resolve('../../../lib/link'),
... | false |
Other | vercel | next.js | c6842629baea2f92d28a02b62e2a4f090be5eaa2.json | chore(package): update react-dom to version 15.4.2 (#682) | package.json | @@ -67,7 +67,7 @@
"mz": "2.6.0",
"path-match": "1.2.4",
"react": "15.4.2",
- "react-dom": "15.4.1",
+ "react-dom": "15.4.2",
"react-hot-loader": "3.0.0-beta.6",
"send": "0.14.1",
"source-map-support": "0.4.8", | false |
Other | vercel | next.js | 9cf109a4566f166ca721a734ef8350f402f50ec4.json | chore(package): update react to version 15.4.2 (#683) | package.json | @@ -66,7 +66,7 @@
"mkdirp-then": "1.2.0",
"mz": "2.6.0",
"path-match": "1.2.4",
- "react": "15.4.1",
+ "react": "15.4.2",
"react-dom": "15.4.1",
"react-hot-loader": "3.0.0-beta.6",
"send": "0.14.1", | false |
Other | vercel | next.js | 8df7f0da57cff349e63bf4fe939a53b2de35ef1d.json | fix HMR (#680) | client/next-dev.js | @@ -1,4 +1,3 @@
-import 'react-hot-loader/patch'
import patch from './patch-react'
// apply patch first
@@ -7,5 +6,7 @@ patch((err) => {
next.renderError(err)
})
+require('react-hot-loader/patch')
+
const next = require('./next')
window.next = next | false |
Other | vercel | next.js | b8373b847dcf5d88ccfce27c7504331d63a9f6a5.json | fix HMR for dynamic entries (#652) | server/build/plugins/watch-pages-plugin.js | @@ -53,7 +53,7 @@ export default class WatchPagesPlugin {
if (compiler.hasEntry(name)) return
- const entries = [hotMiddlewareClientPath, f]
+ const entries = [hotMiddlewareClientPath, f + '?entry']
compiler.addEntry(entries, name)
})
@@ -66,7 +66,7 @@ export default class W... | false |
Other | vercel | next.js | 8570d19af69e5ecfc4f0d4e8b2af937efbc860b7.json | Handle errors of React lifecycle methods (#661)
* handle errors of lifecycle methods
* handle errors of render method | client/next-dev.js | @@ -1,4 +1,11 @@
import 'react-hot-loader/patch'
-import * as next from './next'
+import patch from './patch-react'
+// apply patch first
+patch((err) => {
+ console.error(err)
+ next.renderError(err)
+})
+
+const next = require('./next')
window.next = next | true |
Other | vercel | next.js | 8570d19af69e5ecfc4f0d4e8b2af937efbc860b7.json | Handle errors of React lifecycle methods (#661)
* handle errors of lifecycle methods
* handle errors of render method | client/next.js | @@ -1,5 +1,5 @@
import { createElement } from 'react'
-import { render } from 'react-dom'
+import ReactDOM from 'react-dom'
import HeadManager from './head-manager'
import { rehydrate } from '../lib/css'
import { createRouter } from '../lib/router'
@@ -29,7 +29,31 @@ export const router = createRouter(pathname, que... | true |
Other | vercel | next.js | 8570d19af69e5ecfc4f0d4e8b2af937efbc860b7.json | Handle errors of React lifecycle methods (#661)
* handle errors of lifecycle methods
* handle errors of render method | client/patch-react.js | @@ -0,0 +1,62 @@
+// monkeypatch React for fixing https://github.com/facebook/react/issues/2461
+// based on https://gist.github.com/Aldredcz/4d63b0a9049b00f54439f8780be7f0d8
+
+import React from 'react'
+
+let patched = false
+
+export default (handleError = () => {}) => {
+ if (patched) {
+ throw new Error('React... | true |
Other | vercel | next.js | 8570d19af69e5ecfc4f0d4e8b2af937efbc860b7.json | Handle errors of React lifecycle methods (#661)
* handle errors of lifecycle methods
* handle errors of render method | lib/app.js | @@ -19,7 +19,7 @@ export default class App extends Component {
try {
this.setState(state)
} catch (err) {
- console.error(err)
+ this.handleError(err)
}
}
@@ -37,7 +37,7 @@ export default class App extends Component {
try {
this.setState(state)
} catch (err) {... | true |
Other | vercel | next.js | b78ab40c9c3926d6cd994ad45ab199941ad4ebb3.json | chore(package): update gulp-jest to version 1.0.0 (#653) | package.json | @@ -89,7 +89,7 @@
"gulp-babel": "6.1.2",
"gulp-benchmark": "1.1.1",
"gulp-cached": "1.1.1",
- "gulp-jest": "^0.6.0",
+ "gulp-jest": "^1.0.0",
"gulp-notify": "2.2.0",
"husky": "0.12.0",
"jest": "^18.0.0", | false |
Other | vercel | next.js | 6d6ef1ca9fc4f0fb0dc400619232f51b53df9901.json | Remove the use of fs.access (#625) | server/render.js | @@ -1,7 +1,6 @@
import { join } from 'path'
import { createElement } from 'react'
import { renderToString, renderToStaticMarkup } from 'react-dom/server'
-import fs from 'mz/fs'
import send from 'send'
import accepts from 'accepts'
import requireModule from './require'
@@ -150,16 +149,11 @@ export async function ... | false |
Other | vercel | next.js | 01a17738dba5447039100b0ff6f944d24d9d234b.json | Reset prefetchCache when reloading a route. (#617)
* Reset prefetchCache when reloading a route.
* Prefetch again when there's a HMR reload.
* Make .send() to return a promise. | lib/prefetch.js | @@ -24,14 +24,21 @@ class Messenger {
this._resetCache()
}
- send (payload, cb) {
- if (this.serviceWorkerState === 'REGISTERED') {
- this._send(payload, cb)
- } else {
- this.serviceWorkerReadyCallbacks.push(() => {
- this._send(payload, cb)
- })
- }
+ send (payload) {
+ r... | true |
Other | vercel | next.js | 01a17738dba5447039100b0ff6f944d24d9d234b.json | Reset prefetchCache when reloading a route. (#617)
* Reset prefetchCache when reloading a route.
* Prefetch again when there's a HMR reload.
* Make .send() to return a promise. | lib/router/router.js | @@ -2,6 +2,7 @@ import { parse, format } from 'url'
import evalScript from '../eval-script'
import shallowEquals from '../shallow-equals'
import { EventEmitter } from 'events'
+import { reloadIfPrefetched } from '../prefetch'
export default class Router extends EventEmitter {
constructor (pathname, query, { Co... | true |
Other | vercel | next.js | 856978918eb51cff43edcba264eb4403cf4b029b.json | Add cxs example. (#613)
* add cxs example
* fix example location | README.md | @@ -95,7 +95,7 @@ export default () => (
<p><details>
<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></ul>
+ <ul><li><a href="./exampl... | true |
Other | vercel | next.js | 856978918eb51cff43edcba264eb4403cf4b029b.json | Add cxs example. (#613)
* add cxs example
* fix example location | examples/with-cxs/README.md | @@ -0,0 +1,30 @@
+
+# Example app with cxs
+
+## How to use
+
+Download the example (or clone the repo)[https://github.com/zeit/next.js.git]:
+
+```bash
+curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-cxs
+cd with-cxs
+```
+
+Install it and run:
+
+```bash
+... | true |
Other | vercel | next.js | 856978918eb51cff43edcba264eb4403cf4b029b.json | Add cxs example. (#613)
* add cxs example
* fix example location | examples/with-cxs/package.json | @@ -0,0 +1,15 @@
+{
+ "name": "with-cxs",
+ "version": "1.0.0",
+ "scripts": {
+ "dev": "next",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "cxs": "^3.0.0",
+ "next": "^2.0.0-beta"
+ },
+ "author": "",
+ "license": "ISC"
+} | true |
Other | vercel | next.js | 856978918eb51cff43edcba264eb4403cf4b029b.json | Add cxs example. (#613)
* add cxs example
* fix example location | examples/with-cxs/pages/_document.js | @@ -0,0 +1,25 @@
+import Document, { Head, Main, NextScript } from 'next/document'
+import cxs from 'cxs'
+
+export default class MyDocument extends Document {
+ static async getInitialProps ({ renderPage }) {
+ const page = renderPage()
+ let style = cxs.getCss()
+ return { ...page, style }
+ }
+
+ render ... | true |
Other | vercel | next.js | 856978918eb51cff43edcba264eb4403cf4b029b.json | Add cxs example. (#613)
* add cxs example
* fix example location | examples/with-cxs/pages/index.js | @@ -0,0 +1,28 @@
+import React from 'react'
+import cxs from 'cxs'
+
+export default () => (
+ <div className={cx.root}>
+ <h1 className={cx.title}>My page</h1>
+ </div>
+)
+
+const cx = {
+ root: cxs({
+ width: 80,
+ height: 60,
+ background: 'white',
+ ':hover': {
+ background: 'black'
+ }
+... | true |
Other | vercel | next.js | ef06aeee450d57e1b05a37df4e73e0aeca8b1469.json | display error informations to top left (#615) | pages/_error-debug.js | @@ -29,13 +29,9 @@ export default class ErrorDebug extends React.Component {
`}</style>
<style jsx>{`
.errorDebug {
- height: 100vh;
+ height: 100%;
padding: 16px;
box-sizing: border-box;
- display: flex;
- flex-direction: column;
- ... | false |
Other | vercel | next.js | 897c60b4fd7e7f2204a8ba176754a868ea58d064.json | Fix error routes (#595)
* fix router error handlings
* respond with JSON when error occurs on JSON routes | lib/router/router.js | @@ -50,16 +50,19 @@ export default class Router extends EventEmitter {
error
} = await this.getRouteInfo(route, pathname, query)
- if (error) {
+ if (error && error.cancelled) {
this.emit('routeChangeError', error, as)
- // We don't need to throw here since the error is already logged by... | true |
Other | vercel | next.js | 897c60b4fd7e7f2204a8ba176754a868ea58d064.json | Fix error routes (#595)
* fix router error handlings
* respond with JSON when error occurs on JSON routes | server/index.js | @@ -213,6 +213,30 @@ export default class Server {
return renderErrorJSON(err, req, res, this.renderOpts)
}
+ async serveStaticWithGzip (req, res, path) {
+ this._serveStatic(req, res, () => {
+ return serveStaticWithGzip(req, res, path)
+ })
+ }
+
+ serveStatic (req, res, path) {
+ this._ser... | true |
Other | vercel | next.js | 897c60b4fd7e7f2204a8ba176754a868ea58d064.json | Fix error routes (#595)
* fix router error handlings
* respond with JSON when error occurs on JSON routes | server/render.js | @@ -169,15 +169,7 @@ export async function serveStaticWithGzip (req, res, path) {
export function serveStatic (req, res, path) {
return new Promise((resolve, reject) => {
send(req, path)
- .on('error', (err) => {
- if (err.code === 'ENOENT') {
- res.statusCode = 404
- res.end('Not Found')... | true |
Other | vercel | next.js | 08548551977c03986fd1bec975abecd8b8c56cb0.json | Fix meta and styles on error page (#600)
* set meta tag for mobile on error page
* make error page center | pages/_error-debug.js | @@ -1,4 +1,5 @@
import React from 'react'
+import Head from 'next/head'
import ansiHTML from 'ansi-html'
export default class ErrorDebug extends React.Component {
@@ -11,6 +12,9 @@ export default class ErrorDebug extends React.Component {
const { name, message, stack, path } = this.props
return <div cl... | true |
Other | vercel | next.js | 08548551977c03986fd1bec975abecd8b8c56cb0.json | Fix meta and styles on error page (#600)
* set meta tag for mobile on error page
* make error page center | pages/_error.js | @@ -1,4 +1,5 @@
import React from 'react'
+import Head from 'next/head'
export default class Error extends React.Component {
static getInitialProps ({ res, xhr }) {
@@ -13,24 +14,29 @@ export default class Error extends React.Component {
: (statusCode ? 'Internal Server Error' : 'An unexpected error has o... | true |
Other | vercel | next.js | 64aa4454ace64c2982f53374334834c9f47bb491.json | examples: fix SSR of styled-components | examples/with-styled-components/pages/_document.js | @@ -3,7 +3,6 @@ import styleSheet from 'styled-components/lib/models/StyleSheet'
export default class MyDocument extends Document {
static async getInitialProps ({ renderPage }) {
- styleSheet.flush()
const page = renderPage()
const style = styleSheet.rules().map(rule => rule.cssText).join('\n')
... | false |
Other | vercel | next.js | 8d543bd1485a65d7a2cb6c96ad04ff201249cae7.json | remove the monkeypatch of watchpack (#580) | server/build/plugins/watch-remove-event-plugin.js | @@ -23,77 +23,10 @@ export default class WatchRemoveEventPlugin {
}, callbackUndelayed)
const watchpack = watchFileSystem.watcher
- watchpack.fileWatchers.forEach((w) => {
- w.on('remove', this.onRemove.bind(this, watchpack, w.path))
+ watchpack.on('remove', (file) => {
+ this.re... | false |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | server/build/gzip.js | @@ -1,14 +1,29 @@
import fs from 'fs'
import path from 'path'
import zlib from 'zlib'
+import glob from 'glob-promise'
export default async function gzipAssets (dir) {
const nextDir = path.resolve(dir, '.next')
- await Promise.all([
- gzip(path.resolve(nextDir, 'commons.js')),
- gzip(path.resolve(next... | true |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | server/build/plugins/json-pages-plugin.js | @@ -0,0 +1,24 @@
+export default class JsonPagesPlugin {
+ apply (compiler) {
+ compiler.plugin('after-compile', (compilation, callback) => {
+ const pages = Object
+ .keys(compilation.assets)
+ .filter((filename) => /^bundles\/pages.*\.js$/.test(filename))
+
+ pages.forEach((pageName) => {
... | true |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | server/build/webpack.js | @@ -10,6 +10,7 @@ import WatchPagesPlugin from './plugins/watch-pages-plugin'
import WatchRemoveEventPlugin from './plugins/watch-remove-event-plugin'
import DynamicEntryPlugin from './plugins/dynamic-entry-plugin'
import DetachPlugin from './plugins/detach-plugin'
+import JsonPagesPlugin from './plugins/json-pages-... | true |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | server/hot-reloader.js | @@ -4,7 +4,7 @@ import webpackHotMiddleware from 'webpack-hot-middleware'
import isWindowsBash from 'is-windows-bash'
import webpack from './build/webpack'
import clean from './build/clean'
-import read from './read'
+import readPage from './read-page'
export default class HotReloader {
constructor (dir, { qui... | true |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | server/index.js | @@ -1,15 +1,14 @@
import { resolve, join } from 'path'
import { parse } from 'url'
import http from 'http'
-import fs from 'mz/fs'
-import send from 'send'
-import accepts from 'accepts'
import {
renderToHTML,
renderErrorToHTML,
renderJSON,
renderErrorJSON,
- sendHTML
+ sendHTML,
+ serveStatic,
+ se... | true |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | server/read-page.js | @@ -0,0 +1,25 @@
+import fs from 'mz/fs'
+import resolve from './resolve'
+
+/**
+ * resolve a JSON page like `require.resolve`,
+ * and read and cache the file content
+ */
+
+async function readPage (path) {
+ const f = await resolve(path)
+ if (cache.hasOwnProperty(f)) {
+ return cache[f]
+ }
+
+ const source... | true |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | server/read.js | @@ -1,23 +0,0 @@
-import fs from 'mz/fs'
-import resolve from './resolve'
-
-/**
- * resolve a file like `require.resolve`,
- * and read and cache the file content
- */
-
-async function read (path) {
- const f = await resolve(path)
- if (cache.hasOwnProperty(f)) {
- return cache[f]
- }
-
- const data = fs.readF... | true |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | server/render.js | @@ -1,8 +1,11 @@
import { join } from 'path'
import { createElement } from 'react'
import { renderToString, renderToStaticMarkup } from 'react-dom/server'
+import fs from 'mz/fs'
+import send from 'send'
+import accepts from 'accepts'
import requireModule from './require'
-import read from './read'
+import readPage... | true |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | server/resolve.js | @@ -26,11 +26,20 @@ function getPaths (id) {
const i = sep === '/' ? id : id.replace(/\//g, sep)
if (i.slice(-3) === '.js') return [i]
- if (i[i.length - 1] === sep) return [i + 'index.js']
+ if (i.slice(-5) === '.json') return [i]
+
+ if (i[i.length - 1] === sep) {
+ return [
+ i + 'index.json',
+ ... | true |
Other | vercel | next.js | 165924b71b290388fbbacbc2a74cba80e1058133.json | Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.
* Make Json pages even if there's an error.
* Implement much better page serving.
* Use JsonPagesPlugin in the production mode as well.
* Add gzip support for JSON pages.
* Use glob-promise instead of recursive-read... | yarn.lock | @@ -1,7 +1,5 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
-
-
abab@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d"
@@ -196,20 +194,14 @@ async-each@^1.0.0:
version "1.0.1"
resolved "ht... | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | README.md | @@ -182,13 +182,15 @@ For the initial page load, `getInitialProps` will execute on the server only. `g
### Routing
+#### With `<Link>`
+
<p><details>
<summary><b>Examples</b></summary>
- <ul><li><a href="./examples/using-routing">Basic routing</a></li></ul>
+ <ul>
+ <li><a href="./examples/hello-world">He... | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | examples/with-loading/README.md | @@ -0,0 +1,35 @@
+# Example app with page loading indicator
+
+## How to use
+
+Download the example (or clone the repo)[https://github.com/zeit/next.js.git]:
+
+```bash
+curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-loading
+cd with-loading
+```
+
+Install... | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | examples/with-loading/components/Header.js | @@ -0,0 +1,30 @@
+import React from 'react'
+import Head from 'next/head'
+import Link from 'next/link'
+import NProgress from 'nprogress'
+import Router from 'next/router'
+
+Router.onRouteChangeStart = (url) => {
+ console.log(`Loading: ${url}`)
+ NProgress.start()
+}
+Router.onRouteChangeComplete = () => NProgress... | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | examples/with-loading/package.json | @@ -0,0 +1,17 @@
+{
+ "name": "with-loading",
+ "version": "1.0.0",
+ "description": "This example features:",
+ "main": "index.js",
+ "scripts": {
+ "dev": "next",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "next": "^2.0.0-beta",
+ "nprogress": "^0.2.0"
+ },
+ "... | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | examples/with-loading/pages/about.js | @@ -0,0 +1,20 @@
+import React, { Component } from 'react'
+import Header from '../components/Header'
+
+export default class About extends Component {
+ // Add some delay
+ static getInitialProps () {
+ return new Promise((resolve) => {
+ setTimeout(resolve, 500)
+ })
+ }
+
+ render () {
+ return (
+... | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | examples/with-loading/pages/forever.js | @@ -0,0 +1,20 @@
+import React, { Component } from 'react'
+import Header from '../components/Header'
+
+export default class Forever extends Component {
+ // Add some delay
+ static getInitialProps () {
+ return new Promise((resolve) => {
+ setTimeout(resolve, 3000)
+ })
+ }
+
+ render () {
+ return ... | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | examples/with-loading/pages/index.js | @@ -0,0 +1,9 @@
+import React from 'react'
+import Header from '../components/Header'
+
+export default () => (
+ <div>
+ <Header />
+ <p>Hello Next!</p>
+ </div>
+) | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | examples/with-loading/static/nprogress.css | @@ -0,0 +1,73 @@
+/* Make clicks pass-through */
+#nprogress {
+ pointer-events: none;
+}
+
+#nprogress .bar {
+ background: #29d;
+
+ position: fixed;
+ z-index: 1031;
+ top: 0;
+ left: 0;
+
+ width: 100%;
+ height: 2px;
+}
+
+/* Fancy blur effect */
+#nprogress .peg {
+ display: block;
+ position: absolute;... | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | lib/router/index.js | @@ -1,13 +1,20 @@
import _Router from './router'
-// holds the actual router instance
-let router = null
-
-const SingletonRouter = {}
+const SingletonRouter = {
+ router: null, // holds the actual router instance
+ readyCallbacks: [],
+ ready (cb) {
+ if (this.router) return cb()
+ if (typeof window !== 'u... | true |
Other | vercel | next.js | c890dc3573b6ca6a8f19d651bc1af97a29d91eb0.json | Implement Router Events (#511)
* Move route loading logic to a common place.
* Add router events.
* Add EventEmitter's core API methods.
* Add example app for loading events and docs.
* Fix some typos.
* Get rid of Router.ready()
* Remove events package.
It's already shipping with webpack.
* Hand... | lib/router/router.js | @@ -1,9 +1,11 @@
import { parse, format } from 'url'
import evalScript from '../eval-script'
import shallowEquals from '../shallow-equals'
+import { EventEmitter } from 'events'
-export default class Router {
+export default class Router extends EventEmitter {
constructor (pathname, query, { Component, ErrorCom... | true |
Other | vercel | next.js | 6d8079a261e67e117e428408fb17c2ea57d27b9a.json | chore(package): update glamor to version 2.20.20 (#578) | package.json | @@ -53,7 +53,7 @@
"cross-spawn": "5.0.1",
"del": "2.2.2",
"friendly-errors-webpack-plugin": "1.1.2",
- "glamor": "2.20.19",
+ "glamor": "2.20.20",
"glob-promise": "3.1.0",
"htmlescape": "1.1.1",
"is-windows-bash": "1.0.3", | false |
Other | vercel | next.js | f7ee50323daa65b4d14a3398507b56b3a032674a.json | use Promise to update head (#574) | client/head-manager.js | @@ -10,14 +10,14 @@ const DOMAttributeNames = {
export default class HeadManager {
constructor () {
- this.requestId = null
+ this.updatePromise = null
}
updateHead (head) {
- // perform batch update
- window.cancelAnimationFrame(this.requestId)
- this.requestId = window.requestAnimationFra... | false |
Other | vercel | next.js | 84fc6781bbb02ec7be69282189c5bfd3f1f0ef42.json | chore(package): update glamor to version 2.20.19 (#567) | package.json | @@ -53,7 +53,7 @@
"cross-spawn": "5.0.1",
"del": "2.2.2",
"friendly-errors-webpack-plugin": "1.1.2",
- "glamor": "2.20.18",
+ "glamor": "2.20.19",
"glob-promise": "3.1.0",
"htmlescape": "1.1.1",
"is-windows-bash": "1.0.3", | false |
Other | vercel | next.js | 369bc873f8e41ac29ec844bb4dee532cb086daa5.json | examples/nested-components: use an apostrophe rather than a prime (#566)
This is just my OCD, but this file is much easier on the eyes when apostrophes are used rather than primes. It's also proper, as the [prime](https://en.wikipedia.org/wiki/Prime_(symbol)) is used in mathematics, not written English. | examples/nested-components/pages/index.js | @@ -19,7 +19,7 @@ export default () => (
<hr />
<Post title='The final blog post'>
- <P>C'est fin</P>
+ <P>C’est fin</P>
</Post>
<style jsx>{` | false |
Other | vercel | next.js | a8a97b07c7990c14e80f5f7d40e38c367b67a22b.json | Provide a way to copy files in exportPathMap (#5089)
Related #4659
Adds the possibility for users to copy files inside of `exportPathMap`. This allows for adding `robots.txt` `sitemap.xml` etc. another use case is for https://github.com/hanford/next-offline, currently it's manually reading the buildId in `exportPa... | README.md | @@ -1479,7 +1479,7 @@ next build
next export
```
-By default `next export` doesn't require any configuration. It will generate a default `exportPathMap` containing the routes to pages inside the `pages` directory.
+By default `next export` doesn't require any configuration. It will generate a default `exportPathMa... | true |
Other | vercel | next.js | a8a97b07c7990c14e80f5f7d40e38c367b67a22b.json | Provide a way to copy files in exportPathMap (#5089)
Related #4659
Adds the possibility for users to copy files inside of `exportPathMap`. This allows for adding `robots.txt` `sitemap.xml` etc. another use case is for https://github.com/hanford/next-offline, currently it's manually reading the buildId in `exportPa... | export/index.js | @@ -10,6 +10,11 @@ import { setAssetPrefix } from '../lib/asset'
import * as envConfig from '../lib/runtime-config'
export default async function (dir, options, configuration) {
+ function log (message) {
+ if (options.silent) return
+ console.log(message)
+ }
+
dir = resolve(dir)
const nextConfig = c... | true |
Other | vercel | next.js | a8a97b07c7990c14e80f5f7d40e38c367b67a22b.json | Provide a way to copy files in exportPathMap (#5089)
Related #4659
Adds the possibility for users to copy files inside of `exportPathMap`. This allows for adding `robots.txt` `sitemap.xml` etc. another use case is for https://github.com/hanford/next-offline, currently it's manually reading the buildId in `exportPa... | server/index.js | @@ -155,7 +155,7 @@ export default class Server {
// So that the user doesn't have to define a custom server reading the exportPathMap
if (this.dev && this.nextConfig.exportPathMap) {
console.log('Defining routes from exportPathMap')
- const exportPathMap = await this.nextConfig.exportPath... | true |
Other | vercel | next.js | b39b44ac23ce1b8d87d776b7c42fde44079a194d.json | Remove obsolete route (#5092)
This route is no longer needed | server/index.js | @@ -184,11 +184,6 @@ export default class Server {
// (but it should support as many as params, seperated by '/')
// Othewise this will lead to a pretty simple DOS attack.
// See more: https://github.com/zeit/next.js/issues/2617
- routes['/_next/:path*'] = async (req, res, params) => {
- ... | false |
Other | vercel | next.js | 1cdc25ff79d127ec2b4b042da1d59d3f4b1dbd7a.json | Use terser for minification (#5083)
Fixes #5021 | build/webpack.js | @@ -19,6 +19,7 @@ import ChunkNamesPlugin from './webpack/plugins/chunk-names-plugin'
import { ReactLoadablePlugin } from './webpack/plugins/react-loadable-plugin'
import {SERVER_DIRECTORY, NEXT_PROJECT_ROOT, NEXT_PROJECT_ROOT_NODE_MODULES, NEXT_PROJECT_ROOT_DIST, DEFAULT_PAGES_DIR, REACT_LOADABLE_MANIFEST, CLIENT_ST... | true |
Other | vercel | next.js | 1cdc25ff79d127ec2b4b042da1d59d3f4b1dbd7a.json | Use terser for minification (#5083)
Fixes #5021 | flow-typed/npm/terser-webpack-plugin_vx.x.x.js | @@ -0,0 +1,60 @@
+// flow-typed signature: 7f0a5671a6d757d5e9f880e207a37572
+// flow-typed version: <<STUB>>/terser-webpack-plugin_v1.0.2/flow_v0.73.0
+
+/**
+ * This is an autogenerated libdef stub for:
+ *
+ * 'terser-webpack-plugin'
+ *
+ * Fill this stub out by replacing all the `any` types.
+ *
+ * Once filled o... | true |
Other | vercel | next.js | 1cdc25ff79d127ec2b4b042da1d59d3f4b1dbd7a.json | Use terser for minification (#5083)
Fixes #5021 | package.json | @@ -106,6 +106,7 @@
"source-map": "0.5.7",
"strip-ansi": "3.0.1",
"styled-jsx": "3.0.3-canary.0",
+ "terser-webpack-plugin": "1.0.2",
"unfetch": "3.0.0",
"url": "0.11.0",
"webpack": "4.17.1", | true |
Other | vercel | next.js | 2eeebacb4c99c5f1e4a22a721a7c8a3dc9538e60.json | Keep chunks filenames in production mode (#5029)
* Keep chunks filenames in production mode
* Add test for new `[name]` behavior
* Rename static/dll to static/development/dll | build/webpack.js | @@ -181,7 +181,7 @@ export default async function getBaseWebpackConfig (dir: string, {dev = false, i
hotUpdateChunkFilename: 'static/webpack/[id].[hash].hot-update.js',
hotUpdateMainFilename: 'static/webpack/[hash].hot-update.json',
// This saves chunks with the name given via `import()`
- chu... | true |
Other | vercel | next.js | 2eeebacb4c99c5f1e4a22a721a7c8a3dc9538e60.json | Keep chunks filenames in production mode (#5029)
* Keep chunks filenames in production mode
* Add test for new `[name]` behavior
* Rename static/dll to static/development/dll | build/webpack/plugins/build-manifest-plugin.js | @@ -15,7 +15,7 @@ export default class BuildManifestPlugin {
for (const filePath of Object.keys(compilation.assets)) {
const path = filePath.replace(/\\/g, '/')
- if (/^static\/dll\//.test(path)) {
+ if (/^static\/development\/dll\//.test(path)) {
assetMap.devFiles.push(path)
... | true |
Other | vercel | next.js | 2eeebacb4c99c5f1e4a22a721a7c8a3dc9538e60.json | Keep chunks filenames in production mode (#5029)
* Keep chunks filenames in production mode
* Add test for new `[name]` behavior
* Rename static/dll to static/development/dll | test/integration/basic/components/hello-chunkfilename.js | @@ -0,0 +1 @@
+export default () => <div>test chunkfilename</div> | true |
Other | vercel | next.js | 2eeebacb4c99c5f1e4a22a721a7c8a3dc9538e60.json | Keep chunks filenames in production mode (#5029)
* Keep chunks filenames in production mode
* Add test for new `[name]` behavior
* Rename static/dll to static/development/dll | test/integration/basic/pages/dynamic/chunkfilename.js | @@ -0,0 +1,5 @@
+import dynamic from 'next/dynamic'
+
+const Hello = dynamic(import(/* webpackChunkName: 'hello-world' */'../../components/hello-chunkfilename'))
+
+export default Hello | true |
Other | vercel | next.js | 2eeebacb4c99c5f1e4a22a721a7c8a3dc9538e60.json | Keep chunks filenames in production mode (#5029)
* Keep chunks filenames in production mode
* Add test for new `[name]` behavior
* Rename static/dll to static/development/dll | test/integration/basic/test/dynamic.js | @@ -63,6 +63,26 @@ export default (context, render) => {
})
})
+ describe('custom chunkfilename', () => {
+ it('should render the correct filename', async () => {
+ const $ = await get$('/dynamic/chunkfilename')
+ expect($('body').text()).toMatch(/test chunkfilename/)
+ expect... | true |
Other | vercel | next.js | 6c1389b69e83794fc96c405126c9366d99c09055.json | Add mention of canary vs stable (#5074) | README.md | @@ -12,6 +12,10 @@ Next.js is a minimalistic framework for server-rendered React applications.
---
+**The below readme is the documentation for the `canary` (prerelease) branch. To view the documentation for the latest stable Next.js version visit [nextjs.org/docs](https://nextjs.org/docs)**
+
+---
+
<!-- START d... | false |
Other | vercel | next.js | a0aaa933dec41da0cbb5c0f33e3f6e66df629d5d.json | Apply sideEffect at DidMount on the client side (#5068)
Fixes #5038
The problem with `constructor` is that it doesn't have `context` yet when being called. It's also considered unsafe to add a side-effect on constructor except when server-rendering | lib/side-effect.js | @@ -58,10 +58,15 @@ export default function withSideEffect (reduceComponentsToState, handleStateChan
constructor (props) {
super(props)
+ if (!SideEffect.canUseDOM) {
+ mountedInstances.add(this)
+ emitChange(this)
+ }
+ }
+ componentDidMount () {
mou... | true |
Other | vercel | next.js | a0aaa933dec41da0cbb5c0f33e3f6e66df629d5d.json | Apply sideEffect at DidMount on the client side (#5068)
Fixes #5038
The problem with `constructor` is that it doesn't have `context` yet when being called. It's also considered unsafe to add a side-effect on constructor except when server-rendering | test/integration/basic/pages/dynamic/head.js | @@ -0,0 +1,24 @@
+import dynamic from 'next/dynamic'
+import Head from 'next/head'
+
+const Test = dynamic({
+ loader: async () => {
+ // component
+ return () => {
+ return <div className='dynamic-style'>
+ <Head>
+ <style dangerouslySetInnerHTML={{ __html: `
+ .dynamic-style {
+... | true |
Other | vercel | next.js | a0aaa933dec41da0cbb5c0f33e3f6e66df629d5d.json | Apply sideEffect at DidMount on the client side (#5068)
Fixes #5038
The problem with `constructor` is that it doesn't have `context` yet when being called. It's also considered unsafe to add a side-effect on constructor except when server-rendering | test/integration/basic/test/dynamic.js | @@ -27,6 +27,22 @@ export default (context, render) => {
}
}
})
+
+ it('should render the component Head content', async () => {
+ let browser
+ try {
+ browser = await webdriver(context.appPort, '/dynamic/head')
+ await check(() => browser.elementByCss('b... | true |
Other | vercel | next.js | 33067a58621e1c937bbf2fd11d1b9f7fc3bab212.json | Fix inconsistency in dynamic tests (#5071) | test/integration/basic/test/dynamic.js | @@ -136,11 +136,5 @@ export default (context, render) => {
browser.close()
})
})
-
- // describe('with browser', () => {
-
- // describe('with bundle', () => {
-
- // })
})
} | true |
Other | vercel | next.js | 33067a58621e1c937bbf2fd11d1b9f7fc3bab212.json | Fix inconsistency in dynamic tests (#5071) | test/integration/production/test/dynamic.js | @@ -0,0 +1,141 @@
+/* global describe, it, expect */
+import webdriver from 'next-webdriver'
+import cheerio from 'cheerio'
+import { waitFor, check } from 'next-test-utils'
+
+// These tests are similar to ../../basic/test/dynamic.js
+export default (context, render) => {
+ async function get$ (path, query) {
+ co... | true |
Other | vercel | next.js | 33067a58621e1c937bbf2fd11d1b9f7fc3bab212.json | Fix inconsistency in dynamic tests (#5071) | test/integration/production/test/index.test.js | @@ -13,7 +13,7 @@ import {
} from 'next-test-utils'
import webdriver from 'next-webdriver'
import fetch from 'node-fetch'
-import dynamicImportTests from '../../basic/test/dynamic'
+import dynamicImportTests from './dynamic'
import security from './security'
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'n... | true |
Other | vercel | next.js | 33067a58621e1c937bbf2fd11d1b9f7fc3bab212.json | Fix inconsistency in dynamic tests (#5071) | test/lib/next-test-utils.js | @@ -152,12 +152,18 @@ export async function startStaticServer (dir) {
export async function check (contentFn, regex) {
let found = false
- setTimeout(() => {
+ setTimeout(async () => {
if (found) {
return
}
- console.error('TIMED OUT CHECK: ', regex)
- throw new Error('TIMED OUT')
+ le... | true |
Other | vercel | next.js | b30a8b2e7c57537f4148c872d1da5395336372ef.json | WIP: Fix devtoolModuleFilenames for react-error-overlay (#5055)
## Issue
Currently react-error-overlays launch-editor functionality doesn’t work because the module paths are in the wrong format.
## Todo
- [x] Keep source-maps enabled
## Related
https://github.com/zeit/next.js/pull/4979 | client/dev-error-overlay/hot-dev-client.js | @@ -55,9 +55,11 @@ let customHmrEventHandler
export default function connect (options) {
// Open stack traces in an editor.
ErrorOverlay.setEditorHandler(function editorHandler ({ fileName, lineNumber, colNumber }) {
+ // Resolve invalid paths coming from react-error-overlay
+ const resolvedFilename = file... | false |
Other | vercel | next.js | fbd933bd2264b63c9035935f8f37d9edabde28f4.json | Fix 404 export (#5061) | server/export.js | @@ -33,7 +33,7 @@ export default async function (dir, options, configuration) {
}
if (page === '/_error') {
- defaultPathMap['404'] = { page }
+ defaultPathMap['/404'] = { page }
continue
}
| false |
Other | vercel | next.js | e1c544cd758d4410b0cd4c2548dc597bb5bda9f1.json | Fix loading... issue (#5058)
This fixes intermittent `loading...` on some requests which surfaced on zeit.co when upgrading | build/babel/plugins/react-loadable-plugin.js | @@ -1,13 +1,34 @@
+/**
+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 | e1c544cd758d4410b0cd4c2548dc597bb5bda9f1.json | Fix loading... issue (#5058)
This fixes intermittent `loading...` on some requests which surfaced on zeit.co when upgrading | build/webpack/plugins/react-loadable-plugin.js | @@ -1,6 +1,27 @@
+/**
+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 limitati... | true |
Other | vercel | next.js | e1c544cd758d4410b0cd4c2548dc597bb5bda9f1.json | Fix loading... issue (#5058)
This fixes intermittent `loading...` on some requests which surfaced on zeit.co when upgrading | client/dev-error-overlay/format-webpack-messages.js | @@ -1,11 +1,31 @@
+/**
+MIT License
+
+Copyright (c) 2013-present, Facebook, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+... | true |
Other | vercel | next.js | e1c544cd758d4410b0cd4c2548dc597bb5bda9f1.json | Fix loading... issue (#5058)
This fixes intermittent `loading...` on some requests which surfaced on zeit.co when upgrading | client/dev-error-overlay/hot-dev-client.js | @@ -1,4 +1,27 @@
/* eslint-disable camelcase */
+/**
+MIT License
+
+Copyright (c) 2013-present, Facebook, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including ... | true |
Other | vercel | next.js | e1c544cd758d4410b0cd4c2548dc597bb5bda9f1.json | Fix loading... issue (#5058)
This fixes intermittent `loading...` on some requests which surfaced on zeit.co when upgrading | client/index.js | @@ -8,7 +8,7 @@ import PageLoader from '../lib/page-loader'
import * as asset from '../lib/asset'
import * as envConfig from '../lib/runtime-config'
import ErrorBoundary from './error-boundary'
-import Loadable from 'react-loadable'
+import Loadable from '../lib/loadable'
// Polyfill Promise globally
// This is ... | true |
Other | vercel | next.js | e1c544cd758d4410b0cd4c2548dc597bb5bda9f1.json | Fix loading... issue (#5058)
This fixes intermittent `loading...` on some requests which surfaced on zeit.co when upgrading | flow-typed/npm/react-loadable_vx.x.x.js | @@ -1,60 +0,0 @@
-// flow-typed signature: 5c815d97bc322b44aa30656fc2619bb0
-// flow-typed version: <<STUB>>/react-loadable_v5.x/flow_v0.73.0
-
-/**
- * This is an autogenerated libdef stub for:
- *
- * 'react-loadable'
- *
- * Fill this stub out by replacing all the `any` types.
- *
- * Once filled out, we encourage... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.