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 | 91900d117283fd29b616fdb3f5ce79b110ba70c4.json | Update "url deprecated" error docs with note re: React Dev Tools (#4652)
Fixes #4284
Made change as discussed in #4284 | errors/url-deprecated.md | @@ -6,6 +6,8 @@ In versions prior to 6.x the `url` property got magically injected into every `P
The reason this is going away is that we want to make things very predictable and explicit. Having a magical url property coming out of nowhere doesn't aid that goal.
+*Note:* In some cases using React Dev Tools may tr... | false |
Other | vercel | next.js | 6cba9fa511e997fd86779cd6c276846d77dec4fc.json | Remove the React 15 support comment (#4648)
Next.js supports React 15 / React-like alternatives that don’t have the `rehydrate` method (preact) again since Next.js 5+. It’s still not recommended to use React 15. But there’s no need to mention that here as this is the initial installation and we instruct the user to in... | readme.md | @@ -88,9 +88,6 @@ Install it:
npm install --save next react react-dom
```
-> Next.js only supports [React 16](https://reactjs.org/blog/2017/09/26/react-v16.0.html).<br/>
-> We had to drop React 15 support due to the way React 16 works and how we use it.
-
and add a script to your package.json like this:
```json | false |
Other | vercel | next.js | 6d47d036112b256e0e97998acb5b048f41c67b4c.json | with-styled-components: Move babel plugin to dev dependency (#4602) | examples/with-styled-components/package.json | @@ -7,11 +7,13 @@
"start": "next start"
},
"dependencies": {
- "babel-plugin-styled-components": "^1.1.5",
"next": "latest",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"styled-components": "^2.1.0"
},
+ "devDependencies": {
+ "babel-plugin-styled-components": "^1.1.5"
+ },
... | false |
Other | vercel | next.js | 83b5c138100e7bb7fdf19d23b38a52d60a384427.json | Use this.dir to join the resolved path | server/index.js | @@ -35,7 +35,7 @@ export default class Server {
this.http = null
const phase = dev ? PHASE_DEVELOPMENT_SERVER : PHASE_PRODUCTION_SERVER
this.nextConfig = loadConfig(phase, this.dir, conf)
- this.distDir = join(dir, this.nextConfig.distDir)
+ this.distDir = join(this.dir, this.nextConfig.distDir)
... | false |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | client/next.js | @@ -7,13 +7,13 @@ import DefaultApp from '../lib/app'
import evalScript from '../lib/eval-script'
const {
- __NEXT_DATA__: { app, component, props, classNames }
+ __NEXT_DATA__: { app, component, props, classNames, err }
} = window
const App = app ? evalScript(app).default : DefaultApp
const Component = eval... | true |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | lib/router.js | @@ -123,7 +123,10 @@ export default class Router {
const xhr = loadComponent(componentUrl, (err, data) => {
if (err) return reject(err)
- resolve({ ...data, ctx: { xhr } })
+ resolve({
+ Component: data.Component,
+ ctx: { xhr, err: data.err }
+ })
... | true |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | package.json | @@ -40,8 +40,8 @@
"react": "15.3.2",
"react-dom": "15.3.2",
"react-hot-loader": "3.0.0-beta.6",
- "resolve": "1.1.7",
"send": "0.14.1",
+ "strip-ansi": "3.0.1",
"url": "0.11.0",
"webpack": "1.13.2",
"webpack-dev-server": "1.16.2", | true |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | pages/_error-debug.js | @@ -0,0 +1,68 @@
+import React from 'react'
+import stripAnsi from 'strip-ansi'
+import Head from 'next/head'
+import { css, StyleSheet } from 'next/css'
+
+export default class ErrorDebug extends React.Component {
+ static getInitialProps ({ err }) {
+ const { message, module } = err
+ return { message, path: m... | true |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | server/build/loaders/hot-self-accept-loader.js | @@ -8,8 +8,8 @@ module.exports = function (content) {
return content + `
if (module.hot) {
module.hot.accept()
- if ('idle' !== module.hot.status()) {
- const Component = module.exports.default || module.exports
+ if (module.hot.status() !== 'idle') {
+ var Component = module.expo... | true |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | server/build/webpack.js | @@ -14,10 +14,16 @@ export default async function createCompiler (dir, { hotReload = false } = {}) {
entry[join('bundles', p)] = defaultEntries.concat(['./' + p])
}
+ const nextPagesDir = resolve(__dirname, '..', '..', 'pages')
+
const errorEntry = join('bundles', 'pages', '_error.js')
- const defaultErr... | true |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | server/hot-reloader.js | @@ -1,3 +1,4 @@
+import { join } from 'path'
import WebpackDevServer from 'webpack-dev-server'
import webpack from './build/webpack'
import read from './read'
@@ -6,11 +7,13 @@ export default class HotReloader {
constructor (dir) {
this.dir = dir
this.server = null
+ this.stats = null
+ this.compi... | true |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | server/index.js | @@ -1,9 +1,11 @@
import http from 'http'
-import { resolve } from 'path'
+import { resolve, join } from 'path'
+import { parse } from 'url'
import send from 'send'
import Router from './router'
-import { render, renderJSON } from './render'
+import { render, renderJSON, errorToJSON } from './render'
import HotReloa... | true |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | server/render.js | @@ -41,7 +41,8 @@ export async function render (url, ctx = {}, {
data: {
component,
props,
- classNames: css.renderedClassNames
+ classNames: css.renderedClassNames,
+ err: ctx.err ? errorToJSON(ctx.err) : null
},
hotReload: false,
dev,
@@ -57,6 +58,19 @@ export async fu... | true |
Other | vercel | next.js | 2e2db37ccb8e5addf50e24cabdec940f90cb3077.json | add error page for debug | server/resolve.js | @@ -1,14 +1,46 @@
-import _resolve from 'resolve'
+import { join, sep } from 'path'
+import fs from 'mz/fs'
-export default function resolve (id, opts) {
- return new Promise((resolve, reject) => {
- _resolve(id, opts, (err, path) => {
- if (err) {
- err.code = 'ENOENT'
- return reject(err)
- ... | true |
Other | vercel | next.js | 400b75658beb6083bd8cfdb30adc75de35b4fc43.json | write files even on error | server/build/webpack.js | @@ -27,7 +27,10 @@ export default async function createCompiler (dir, { hotReload = false } = {}) {
compress: { warnings: false },
sourceMap: false
}),
- new WriteFilePlugin({ log: false })
+ new WriteFilePlugin({
+ exitOnErrors: false,
+ log: false
+ })
]
const babelRuntim... | false |
Other | vercel | next.js | c697618e1141e40bcd61fb82e38490a274664c62.json | server/read: remove unused argument | server/read.js | @@ -6,7 +6,7 @@ import resolve from './resolve'
* and read and cache the file content
*/
-async function read (path, opts = {}) {
+async function read (path) {
const f = await resolve(path)
if (cache.hasOwnProperty(f)) {
return cache[f] | false |
Other | vercel | next.js | 577e2c27a76712de0ef585d3965d53a6731a9fb3.json | use webpack for transpiling too | server/build/bundle.js | @@ -1,53 +0,0 @@
-import { resolve, dirname, basename } from 'path'
-import webpack from 'webpack'
-
-export default function bundle (src, dst) {
- const compiler = webpack({
- entry: src,
- output: {
- path: dirname(dst),
- filename: basename(dst),
- libraryTarget: 'commonjs2'
- },
- extern... | true |
Other | vercel | next.js | 577e2c27a76712de0ef585d3965d53a6731a9fb3.json | use webpack for transpiling too | server/build/index.js | @@ -1,26 +1,21 @@
-import { resolve } from 'path'
-import glob from 'glob-promise'
-import transpile from './transpile'
-import bundle from './bundle'
+import webpack from './webpack'
export default async function build (dir) {
- const dstDir = resolve(dir, '.next')
- const templateDir = resolve(__dirname, '..', '... | true |
Other | vercel | next.js | 577e2c27a76712de0ef585d3965d53a6731a9fb3.json | use webpack for transpiling too | server/build/transpile.js | @@ -1,51 +0,0 @@
-import { dirname } from 'path'
-import fs from 'mz/fs'
-import mkdirp from 'mkdirp-then';
-import { transformFile } from 'babel-core'
-import preset2015 from 'babel-preset-es2015'
-import presetReact from 'babel-preset-react'
-import transformAsyncToGenerator from 'babel-plugin-transform-async-to-gene... | true |
Other | vercel | next.js | 89089f5546555d41fcc37c2640aa1edbcdf5e7ee.json | add some basic examples | examples/basic-css/pages/index.js | @@ -0,0 +1,21 @@
+import React from 'react'
+import { css, StyleSheet } from 'next/css'
+
+export default () => (
+ <div className={css(styles.main)}>
+ <p>Hello World</p>
+ </div>
+)
+
+const styles = StyleSheet.create({
+ main: {
+ font: '15px Helvetica, Arial, sans-serif',
+ background: '#eee',
+ padd... | true |
Other | vercel | next.js | 89089f5546555d41fcc37c2640aa1edbcdf5e7ee.json | add some basic examples | examples/head-elements/pages/index.js | @@ -0,0 +1,14 @@
+import React from 'react'
+import Head from 'next/head'
+
+export default () => (
+ <div>
+ <Head>
+ <title>This page has a title 🤔</title>
+ <meta charSet="utf-8" />
+ <meta name="viewport" content="initial-scale=1.0, width=device-width" />
+ </Head>
+
+ <h1>This page has a ... | true |
Other | vercel | next.js | 89089f5546555d41fcc37c2640aa1edbcdf5e7ee.json | add some basic examples | examples/hello-world/pages/about.js | @@ -0,0 +1,4 @@
+import React from 'react'
+export default () => (
+ <div>About us</div>
+) | true |
Other | vercel | next.js | 89089f5546555d41fcc37c2640aa1edbcdf5e7ee.json | add some basic examples | examples/hello-world/pages/index.js | @@ -0,0 +1,5 @@
+import React from 'react'
+import Link from 'next/link'
+export default () => (
+ <div>Hello World. <Link href="/about">About</Link></div>
+) | true |
Other | vercel | next.js | 89089f5546555d41fcc37c2640aa1edbcdf5e7ee.json | add some basic examples | examples/nested-components/components/paragraph.js | @@ -0,0 +1,13 @@
+import React from 'react'
+import { css, StyleSheet } from 'next/css'
+
+export default ({ children }) => (
+ <p className={css(styles.main)}>{children}</p>
+)
+
+const styles = StyleSheet.create({
+ main: {
+ font: '13px Helvetica, Arial',
+ margin: '10px 0'
+ }
+}) | true |
Other | vercel | next.js | 89089f5546555d41fcc37c2640aa1edbcdf5e7ee.json | add some basic examples | examples/nested-components/components/post.js | @@ -0,0 +1,23 @@
+import React from 'react'
+import { css, StyleSheet } from 'next/css'
+
+export default ({ title, children }) => (
+ <div className={css(styles.main)}>
+ <h1 className={css(styles.title)}>{ title }</h1>
+ { children }
+ </div>
+)
+
+const styles = StyleSheet.create({
+ main: {
+ font: '15p... | true |
Other | vercel | next.js | 89089f5546555d41fcc37c2640aa1edbcdf5e7ee.json | add some basic examples | examples/nested-components/pages/index.js | @@ -0,0 +1,48 @@
+import React from 'react'
+import P from '../components/paragraph'
+import Post from '../components/post'
+import { css, StyleSheet } from 'next/css'
+
+export default () => (
+ <div className={css(styles.main)}>
+ <Post title="My first blog post">
+ <P>Hello there</P>
+ <P>This is an ex... | true |
Other | vercel | next.js | 3032ade283f4a2819ba5a125f70db818f7b5867e.json | write assets to disk | bin/next-dev | @@ -3,7 +3,6 @@
import { resolve } from 'path'
import parseArgs from 'minimist'
import Server from '../server'
-import build from '../server/build'
import HotReloader from '../server/hot-reloader'
import webpack from '../server/build/webpack'
@@ -20,9 +19,8 @@ const argv = parseArgs(process.argv.slice(2), {
c... | true |
Other | vercel | next.js | 3032ade283f4a2819ba5a125f70db818f7b5867e.json | write assets to disk | package.json | @@ -43,7 +43,8 @@
"send": "0.14.1",
"url": "0.11.0",
"webpack": "1.13.2",
- "webpack-dev-server": "1.16.2"
+ "webpack-dev-server": "1.16.2",
+ "write-file-webpack-plugin": "3.3.0"
},
"devDependencies": {
"babel-plugin-transform-remove-strict-mode": "0.0.2", | true |
Other | vercel | next.js | 3032ade283f4a2819ba5a125f70db818f7b5867e.json | write assets to disk | server/build/webpack.js | @@ -1,6 +1,7 @@
import { resolve, join } from 'path'
import webpack from 'webpack'
import glob from 'glob-promise'
+import WriteFilePlugin from 'write-file-webpack-plugin'
export default async function createCompiler(dir, { hotReload = false } = {}) {
dir = resolve(dir)
@@ -20,6 +21,16 @@ export default async ... | true |
Other | vercel | next.js | 3032ade283f4a2819ba5a125f70db818f7b5867e.json | write assets to disk | server/hot-reloader.js | @@ -1,4 +1,5 @@
import WebpackDevServer from 'webpack-dev-server'
+import read from './read'
export default class HotReloader {
constructor (compiler) {
@@ -8,6 +9,17 @@ export default class HotReloader {
noInfo: true,
clientLogLevel: 'warning'
})
+
+ compiler.plugin('after-emit', (compilat... | true |
Other | vercel | next.js | 3032ade283f4a2819ba5a125f70db818f7b5867e.json | write assets to disk | server/index.js | @@ -3,7 +3,6 @@ import { resolve } from 'path'
import send from 'send'
import Router from './router'
import { render, renderJSON } from './render'
-import HotReloader from './hot-reloader'
export default class Server {
constructor ({ dir = '.', dev = false, hotReloader }) {
@@ -63,38 +62,36 @@ export default c... | true |
Other | vercel | next.js | 3032ade283f4a2819ba5a125f70db818f7b5867e.json | write assets to disk | server/read.js | @@ -1,42 +1,23 @@
import fs from 'mz/fs'
import resolve from './resolve'
-const cache = {}
-
/**
* resolve a file like `require.resolve`,
* and read and cache the file content
*/
-async function read (path, { mfs }) {
- const f = await (mfs ? resolveFromMFS(path, mfs) : resolve(path))
- if (mfs) {
- r... | true |
Other | vercel | next.js | 3032ade283f4a2819ba5a125f70db818f7b5867e.json | write assets to disk | server/render.js | @@ -2,8 +2,7 @@ import { relative, resolve } from 'path'
import { parse } from 'url'
import { createElement } from 'react'
import { renderToString, renderToStaticMarkup } from 'react-dom/server'
-import fs from 'mz/fs'
-import requireResolve from './resolve'
+import requireModule from './require'
import read from '... | true |
Other | vercel | next.js | 3032ade283f4a2819ba5a125f70db818f7b5867e.json | write assets to disk | server/require.js | @@ -0,0 +1,6 @@
+import resolve from './resolve'
+
+export default async function requireModule (path) {
+ const f = await resolve(path)
+ return require(f)
+} | true |
Other | vercel | next.js | facd19b5a755f35fe2e0d9d2fce66a0219a4d28f.json | add a css test | lib/document.js | @@ -30,7 +30,7 @@ export function Head (props, context) {
.map((h, i) => React.cloneElement(h, { key: '_next' + i }))
return <head>
{h}
- <style data-aphrodite dangerouslySetInnerHTML={{ __html: css.content }} />
+ <style data-aphrodite="" dangerouslySetInnerHTML={{ __html: css.content }} />
</head>... | true |
Other | vercel | next.js | facd19b5a755f35fe2e0d9d2fce66a0219a4d28f.json | add a css test | test/fixtures/basic/pages/css.js | @@ -0,0 +1,8 @@
+import React from 'react'
+import { StyleSheet, css } from 'next/css'
+
+export default () => <div className={css(styles.red)}>This is red</div>
+
+const styles = StyleSheet.create({
+ red: { color: 'red' }
+}) | true |
Other | vercel | next.js | facd19b5a755f35fe2e0d9d2fce66a0219a4d28f.json | add a css test | test/index.js | @@ -9,10 +9,15 @@ test.before(() => build(dir))
test(async (t) => {
const html = await render('/stateless')
- console.log(html)
t.true(html.includes('<h1>My component!</h1>'))
})
+test(async (t) => {
+ const html = await render('/css')
+ t.true(html.includes('<style data-aphrodite="">.red_im3wl1{color:re... | true |
Other | vercel | next.js | 3647ed14acd7b2bf99d31ed57caf88770f10ffa8.json | add a test | .gitignore | @@ -1,3 +1,4 @@
*.log
node_modules
dist
+.next | true |
Other | vercel | next.js | 3647ed14acd7b2bf99d31ed57caf88770f10ffa8.json | add a test | test/fixtures/basic/pages/stateless.js | @@ -0,0 +1,3 @@
+import React from 'react'
+
+export default () => <h1>My component!</h1> | true |
Other | vercel | next.js | 3647ed14acd7b2bf99d31ed57caf88770f10ffa8.json | add a test | test/index.js | @@ -0,0 +1,18 @@
+import test from 'ava'
+import { resolve } from 'path'
+import build from '../server/build'
+import { render as _render } from '../server/render'
+
+const dir = resolve(__dirname, 'fixtures', 'basic')
+
+test.before(() => build(dir))
+
+test(async (t) => {
+ const html = await render('/stateless')
+ ... | true |
Other | vercel | next.js | 3e721b6878bcaad7a68256ac9643305bff478fcf.json | apply css on server rendering | client/next.js | @@ -1,12 +1,13 @@
import { createElement } from 'react'
import { render } from 'react-dom'
import HeadManager from './head-manager'
+import { StyleSheet } from '../lib/css'
import Router from '../lib/router'
import DefaultApp from '../lib/app'
import evalScript from '../lib/eval-script'
const {
- __NEXT_DATA_... | true |
Other | vercel | next.js | 3e721b6878bcaad7a68256ac9643305bff478fcf.json | apply css on server rendering | lib/document.js | @@ -30,7 +30,7 @@ export function Head (props, context) {
.map((h, i) => React.cloneElement(h, { key: '_next' + i }))
return <head>
{h}
- <style data-aphrodite>{css.content}</style>
+ <style data-aphrodite dangerouslySetInnerHTML={{ __html: css.content }} />
</head>
}
@@ -40,7 +40,7 @@ export fun... | true |
Other | vercel | next.js | 3e721b6878bcaad7a68256ac9643305bff478fcf.json | apply css on server rendering | server/render.js | @@ -34,7 +34,11 @@ export async function render (path, ctx, { dir = process.cwd(), dev = false } =
html,
head,
css,
- data: { component, props },
+ data: {
+ component,
+ props,
+ classNames: css.renderedClassNames
+ },
hotReload: false,
dev
}) | true |
Other | vercel | next.js | 6718b0534760904cc334f871bea05b0e0920d36a.json | add _error.js, fix error handlings | bin/next-dev | @@ -3,7 +3,7 @@
import { resolve } from 'path'
import parseArgs from 'minimist'
import Server from '../server'
-import build from '../server/build/index'
+import build from '../server/build'
const argv = parseArgs(process.argv.slice(2), {
alias: { | true |
Other | vercel | next.js | 6718b0534760904cc334f871bea05b0e0920d36a.json | add _error.js, fix error handlings | client/next.js | @@ -1,9 +1,9 @@
import { createElement } from 'react'
import { render } from 'react-dom'
-import evalScript from './eval-script'
import HeadManager from './head-manager'
import Router from '../lib/router'
import DefaultApp from '../lib/app'
+import evalScript from '../lib/eval-script'
const {
__NEXT_DATA__: ... | true |
Other | vercel | next.js | 6718b0534760904cc334f871bea05b0e0920d36a.json | add _error.js, fix error handlings | lib/pages/_error.js | @@ -0,0 +1,64 @@
+import React from 'react'
+import { css, StyleSheet } from 'next/css'
+
+export default class Error extends React.Component {
+ static getInitialProps ({ res, xhr }) {
+ const statusCode = res ? res.statusCode : xhr.status
+ return { statusCode }
+ }
+
+ render () {
+ const { statusCode } ... | true |
Other | vercel | next.js | 6718b0534760904cc334f871bea05b0e0920d36a.json | add _error.js, fix error handlings | lib/router.js | @@ -33,7 +33,7 @@ export default class Router {
const data = await this.fetchComponent(route)
let props
if (route !== this.route) {
- props = await this.getInitialProps(data.Component)
+ props = await this.getInitialProps(data.Component, data.ctx)
}
this.route = route
... | true |
Other | vercel | next.js | 6718b0534760904cc334f871bea05b0e0920d36a.json | add _error.js, fix error handlings | server/build/index.js | @@ -5,6 +5,14 @@ import bundle from './bundle'
export default async function build (dir) {
const dstDir = resolve(dir, '.next')
+ const templateDir = resolve(__dirname, '..', '..', 'lib', 'pages')
+
+ // create `.next/pages/_error.js`
+ // which may be overwriten by the user sciprt, `pages/_error.js`
+ const ... | true |
Other | vercel | next.js | 6718b0534760904cc334f871bea05b0e0920d36a.json | add _error.js, fix error handlings | server/index.js | @@ -11,8 +11,11 @@ export default class Server {
this.router = new Router()
this.http = http.createServer((req, res) => {
- this.run(req, res).catch((err) => {
- this.renderError(req, res, err)
+ this.run(req, res)
+ .catch((err) => {
+ console.error(err)
+ res.status(500... | true |
Other | vercel | next.js | 6718b0534760904cc334f871bea05b0e0920d36a.json | add _error.js, fix error handlings | server/render.js | @@ -10,23 +10,19 @@ import Head from '../lib/head'
import App from '../lib/app'
import { StyleSheetServer } from '../lib/css'
-export async function render (path, req, res, { dir = process.cwd(), dev = false } = {}) {
+export async function render (path, ctx, { dir = process.cwd(), dev = false } = {}) {
const p ... | true |
Other | vercel | next.js | 5a14a7249b52fbbcb47db5ba7a366aabd3fd3a29.json | serve static dir | server/index.js | @@ -19,8 +19,13 @@ export default class Server {
async start (port) {
this.router.get('/_next/:path+', async (req, res, params) => {
- const path = (params.path || []).join('/')
- await this.serveStatic(req, res, path)
+ const p = resolve(__dirname, '../client', (params.path || []).join('/'))
+... | false |
Other | vercel | next.js | cb11c7cbc62632b96565dd7965ca509c5bcf5f8a.json | add Link component | client/eval-script.js | @@ -1,11 +1,13 @@
import React from 'react'
import ReactDOM from 'react-dom'
import App from '../lib/app'
+import Link from '../lib/link'
const modules = new Map([
['react', React],
['react-dom', ReactDOM],
- ['next/app', App]
+ ['next/app', App],
+ ['next/link', Link]
])
/** | true |
Other | vercel | next.js | cb11c7cbc62632b96565dd7965ca509c5bcf5f8a.json | add Link component | lib/link.js | @@ -0,0 +1,71 @@
+import React, { Component, PropTypes, Children } from 'react'
+
+export default class Link extends Component {
+ static contextTypes = {
+ router: PropTypes.object
+ }
+
+ constructor (props) {
+ super(props)
+ this.linkClicked = this.linkClicked.bind(this)
+ }
+
+ linkClicked (e) {
+ ... | true |
Other | vercel | next.js | cb11c7cbc62632b96565dd7965ca509c5bcf5f8a.json | add Link component | server/build.js | @@ -26,7 +26,8 @@ export function transpile (path) {
moduleAlias,
[
{ src: `npm:${babelRuntimePath}`, expose: 'babel-runtime' },
- { src: `npm:${require.resolve('react')}`, expose: 'react' }
+ { src: `npm:${require.resolve('react')}`, expose: 'react' },
+ ... | true |
Other | vercel | next.js | 2d8959d99cf3b55145006f42d9bced2780fb6aa2.json | client/router: create uid instead of displayName | client/next.js | @@ -13,6 +13,6 @@ const Component = evalScript(component).default
const router = new Router({ Component, props })
const container = document.getElementById('__next')
-const appProps = { Component, props, router: {} }
+const appProps = { Component, props, router }
render(createElement(App, { ...appProps }), conta... | true |
Other | vercel | next.js | 2d8959d99cf3b55145006f42d9bced2780fb6aa2.json | client/router: create uid instead of displayName | client/router.js | @@ -6,21 +6,18 @@ export default class Router {
constructor (initialData) {
this.subscriptions = []
- const { Component } = initialData
- const { pathname } = location
- const route = toRoute(pathname)
+ const id = createUid()
+ const route = toRoute(location.pathname)
this.currentRoute ... | true |
Other | vercel | next.js | ca565fc6e462dae779c4d1a4012706cb22939c24.json | Adjust flying shuttle minify (#6980)
* Disable Terser plugin when using flying shuttle
* Add a new minify loader
* Downgrade terser
* Turn on minify loader
* Only compress source / mangle output | packages/next/build/webpack-config.ts | @@ -8,7 +8,7 @@ import BuildManifestPlugin from './webpack/plugins/build-manifest-plugin'
import ChunkNamesPlugin from './webpack/plugins/chunk-names-plugin'
import { ReactLoadablePlugin } from './webpack/plugins/react-loadable-plugin'
import { SERVER_DIRECTORY, REACT_LOADABLE_MANIFEST, CHUNK_GRAPH_MANIFEST, CLIENT_... | true |
Other | vercel | next.js | ca565fc6e462dae779c4d1a4012706cb22939c24.json | Adjust flying shuttle minify (#6980)
* Disable Terser plugin when using flying shuttle
* Add a new minify loader
* Downgrade terser
* Turn on minify loader
* Only compress source / mangle output | packages/next/build/webpack/loaders/next-minify-loader.ts | @@ -0,0 +1,23 @@
+import loaderUtils from 'loader-utils'
+import { loader } from 'webpack'
+import minify from '../plugins/terser-webpack-plugin/src/minify'
+
+const nextMiniferLoader: loader.Loader = function(source) {
+ this.cacheable()
+
+ const options = loaderUtils.getOptions(this) || {}
+ const { error, code }... | true |
Other | vercel | next.js | ca565fc6e462dae779c4d1a4012706cb22939c24.json | Adjust flying shuttle minify (#6980)
* Disable Terser plugin when using flying shuttle
* Add a new minify loader
* Downgrade terser
* Turn on minify loader
* Only compress source / mangle output | packages/next/build/webpack/plugins/terser-webpack-plugin/src/TaskRunner.js | @@ -5,6 +5,7 @@ import workerFarm from 'worker-farm';
import { writeFile, readFile } from 'fs';
import findCacheDir from 'find-cache-dir';
import serialize from 'serialize-javascript';
+import Sema from 'async-sema';
const worker = require.resolve('./worker');
const writeFileP = promisify(writeFile)
@@ -16,6 +17... | true |
Other | vercel | next.js | f04bd8bf336f5b380dd5766c6c8ee9f7a9551fbe.json | Fix getSpecifiedPages on Windows (#6977)
weren't using the right separator | packages/next/build/index.ts | @@ -111,7 +111,7 @@ export async function getSpecifiedPages(
resolvedPagePaths
.filter(p => p.ignore)
- .forEach(p => pageSet.delete(p.pathname))
+ .forEach(p => pageSet.delete(p.pathname.replace('/', path.sep)))
pagePaths = [...pageSet]
} else { | false |
Other | vercel | next.js | c59218c4d88e2a42c161b209dad3aad9960fc6ab.json | Remove use of `Promise.finally` in polyfill (#6975)
* Remove use of Promise.finally
* Move line for clarity | packages/next/client/event-source-polyfill.js | @@ -432,8 +432,12 @@ FetchTransport.prototype.open = function (xhr, onStartCallback, onProgressCallba
}
readNextChunk()
})
- })['finally'](function () {
+ }).then(function(result) {
onFinishCallback()
+ return result
+ })['catch'](function(error) {
+ onFinishCallback()
+ return Promi... | false |
Other | vercel | next.js | f89bd8237bf1bac8fa0e38e758a06d3a223fe318.json | Replace imurmurhash with string-hash (#6964)
Closes #6939 | packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js | @@ -1,7 +1,7 @@
/* eslint-disable
no-param-reassign
*/
-import murmur from 'imurmurhash';
+import stringHash from 'string-hash'
import { SourceMapConsumer } from 'source-map';
import { SourceMapSource, RawSource } from 'webpack-sources';
import RequestShortener from 'webpack/lib/RequestShortener';
@@ -176,7 +17... | true |
Other | vercel | next.js | f89bd8237bf1bac8fa0e38e758a06d3a223fe318.json | Replace imurmurhash with string-hash (#6964)
Closes #6939 | packages/next/package.json | @@ -64,7 +64,6 @@
"find-cache-dir": "2.0.0",
"find-up": "2.1.0",
"fresh": "0.5.2",
- "imurmurhash": "0.1.4",
"launch-editor": "2.2.1",
"loader-utils": "1.1.0",
"mkdirp": "0.5.1", | true |
Other | vercel | next.js | f89bd8237bf1bac8fa0e38e758a06d3a223fe318.json | Replace imurmurhash with string-hash (#6964)
Closes #6939 | yarn.lock | @@ -6450,7 +6450,7 @@ import-local@^1.0.0:
pkg-dir "^2.0.0"
resolve-cwd "^2.0.0"
-imurmurhash@0.1.4, imurmurhash@^0.1.4:
+imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoo... | true |
Other | vercel | next.js | b586dbf5ef08fe8b8951760f460d042ebb72a47a.json | Upgrade Async to Promises (#6958) | packages/next/package.json | @@ -57,7 +57,7 @@
"babel-loader": "8.0.2",
"babel-plugin-dynamic-import-node": "2.2.0",
"babel-plugin-react-require": "3.0.0",
- "babel-plugin-transform-async-to-promises": "0.8.7",
+ "babel-plugin-transform-async-to-promises": "0.8.9",
"babel-plugin-transform-react-remove-prop-types": "0.4.15... | true |
Other | vercel | next.js | b586dbf5ef08fe8b8951760f460d042ebb72a47a.json | Upgrade Async to Promises (#6958) | yarn.lock | @@ -2613,10 +2613,10 @@ babel-plugin-syntax-object-rest-spread@^6.13.0:
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
integrity sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=
-babel-plugin-transform-... | true |
Other | vercel | next.js | 35bbe30912c339d43039576c81979aef394e011c.json | Optimize resolve configuration (#6954)
* Resolve Next.js loaders first
Next.js loaders should be resolved first, then node_modules. There is no need for NEXT_PROJECT_ROOT_NODE_MODULES anymore since all our loaders are internal
* Move wasm to end of array
Since wasm isn’t the main target for Next.js it makes n... | packages/next/build/webpack-config.ts | @@ -47,7 +47,7 @@ export default function getBaseWebpackConfig (dir: string, {dev = false, debug =
const resolveConfig = {
// Disable .mjs for node_modules bundling
- extensions: isServer ? ['.wasm', '.js', '.mjs', '.jsx', '.json'] : ['.wasm', '.mjs', '.js', '.jsx', '.json'],
+ extensions: isServer ? ['... | false |
Other | vercel | next.js | da02f570544840d6aed9c36b7229a10762e2cc16.json | use var as libraryTarget (#6945)
By using `var` we opt-out of the LibraryTemplatePlugin. Considering we have our own loader for registering pages this makes sense. | packages/next/build/webpack-config.ts | @@ -209,7 +209,7 @@ export default function getBaseWebpackConfig (dir: string, {dev = false, debug =
}
return '[name]'
},
- libraryTarget: isServer ? 'commonjs2' : 'jsonp',
+ libraryTarget: isServer ? 'commonjs2' : 'var',
hotUpdateChunkFilename: 'static/webpack/[id].[hash].hot-... | false |
Other | vercel | next.js | 444be1cba6c9e5381fd84c36249fef1591a1c2b8.json | Fix nesting level of client page scripts (#6925) | packages/next/build/webpack/plugins/chunk-graph-plugin.ts | @@ -163,7 +163,7 @@ export class ChunkGraphPlugin implements Plugin {
const getLambdaChunk = (name: string) =>
name.includes(this.buildId)
? name
- .replace(new RegExp(`${this.buildId}[\\/\\\\]`), '')
+ .replace(new RegExp(`${this.buildId}[\\/\\\\]`), 'client/')
... | true |
Other | vercel | next.js | 444be1cba6c9e5381fd84c36249fef1591a1c2b8.json | Fix nesting level of client page scripts (#6925) | packages/next/build/webpack/plugins/serverless-plugin.ts | @@ -94,7 +94,7 @@ export class ServerlessPlugin {
for (const name of assetNames) {
compilation.assets[
name
- .replace(new RegExp(`${this.buildId}[\\/\\\\]`), '')
+ .replace(new RegExp(`${this.buildId}[\\/\\\\]`), 'client/')
.replace(/[.]js$/, `.... | true |
Other | vercel | next.js | 444be1cba6c9e5381fd84c36249fef1591a1c2b8.json | Fix nesting level of client page scripts (#6925) | packages/next/pages/_document.js | @@ -258,7 +258,7 @@ export class Head extends Component {
href={
assetPrefix +
(dynamicBuildId
- ? `/_next/static/pages${getPageFile(page, buildId)}`
+ ? `/_next/static/client/pages${getPageFile(page, buildId)}`
... | true |
Other | vercel | next.js | c56e96291826ed0aac153352bd069f684fa1c542.json | Add lambda version of shared chunks (#6924)
* Add lambda version of shared chunks
* Fix test on Windows | packages/next/build/webpack/plugins/chunk-graph-plugin.ts | @@ -160,19 +160,21 @@ export class ChunkGraphPlugin implements Plugin {
}
})
+ const getLambdaChunk = (name: string) =>
+ name.includes(this.buildId)
+ ? name
+ .replace(new RegExp(`${this.buildId}[\\/\\\\]`), '')
+ .replace(/[.]js$/, `.${this.buildId}.js... | true |
Other | vercel | next.js | c56e96291826ed0aac153352bd069f684fa1c542.json | Add lambda version of shared chunks (#6924)
* Add lambda version of shared chunks
* Fix test on Windows | test/unit/select-pages/select-pages.test.js | @@ -1,5 +1,8 @@
/* eslint-env jest */
-import { getSpecifiedPages } from 'next/dist/build'
+import { getSpecifiedPages as _getSpecifiedPages } from 'next/dist/build'
+
+const getSpecifiedPages = async (...args) =>
+ (await _getSpecifiedPages(...args)).map(pg => pg.replace(/\\+/g, '/'))
describe('getSpecifiedPages'... | true |
Other | vercel | next.js | e89c22a3d381387c902088481a070a1bbfe901d9.json | Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode
* Always include reserved pages in build
* Add tests for ignore pages | packages/next/build/index.ts | @@ -52,6 +52,73 @@ function getPossibleFiles(pageExtensions: string[], pages: string[]) {
return flatten<string>(res)
}
+export async function getSpecifiedPages(
+ dir: string,
+ pages: string[],
+ pageExtensions: string[]
+) {
+ const pagesDir = path.join(dir, 'pages')
+
+ const reservedPages = ['/_app', '/... | true |
Other | vercel | next.js | e89c22a3d381387c902088481a070a1bbfe901d9.json | Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode
* Always include reserved pages in build
* Add tests for ignore pages | test/unit/select-pages/__snapshots__/select-pages.test.js.snap | @@ -0,0 +1,79 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`getSpecifiedPages should filter pages 1`] = `
+Array [
+ "/_app.js",
+ "/_document.js",
+]
+`;
+
+exports[`getSpecifiedPages should filter pages 2`] = `
+Array [
+ "/_app.js",
+ "/_document.js",
+ "/b.jsx",
+ "/c.mdx",
+]
+`;
+
+exports[`get... | true |
Other | vercel | next.js | e89c22a3d381387c902088481a070a1bbfe901d9.json | Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode
* Always include reserved pages in build
* Add tests for ignore pages | test/unit/select-pages/pages/_app.js | @@ -0,0 +1 @@
+// intentionally empty | true |
Other | vercel | next.js | e89c22a3d381387c902088481a070a1bbfe901d9.json | Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode
* Always include reserved pages in build
* Add tests for ignore pages | test/unit/select-pages/pages/_document.js | @@ -0,0 +1 @@
+// intentionally empty | true |
Other | vercel | next.js | e89c22a3d381387c902088481a070a1bbfe901d9.json | Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode
* Always include reserved pages in build
* Add tests for ignore pages | test/unit/select-pages/pages/a.js | @@ -0,0 +1 @@
+// intentionally empty | true |
Other | vercel | next.js | e89c22a3d381387c902088481a070a1bbfe901d9.json | Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode
* Always include reserved pages in build
* Add tests for ignore pages | test/unit/select-pages/pages/b.jsx | @@ -0,0 +1 @@
+// intentionally empty | true |
Other | vercel | next.js | e89c22a3d381387c902088481a070a1bbfe901d9.json | Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode
* Always include reserved pages in build
* Add tests for ignore pages | test/unit/select-pages/pages/c.mdx | @@ -0,0 +1 @@
+# intentionally empty | true |
Other | vercel | next.js | e89c22a3d381387c902088481a070a1bbfe901d9.json | Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode
* Always include reserved pages in build
* Add tests for ignore pages | test/unit/select-pages/select-pages.test.js | @@ -0,0 +1,63 @@
+/* eslint-env jest */
+import { getSpecifiedPages } from 'next/dist/build'
+
+describe('getSpecifiedPages', () => {
+ it('should only choose selected', async () => {
+ expect(await getSpecifiedPages(__dirname, ['a'], ['js'])).toMatchSnapshot()
+
+ let err
+ try {
+ await getSpecifiedPag... | true |
Other | vercel | next.js | bbfc0f8207ccc5a3b6a090dc08892234bd9569fd.json | Add more chunk graph data (#6911)
* Fix nested position
* Drop front commit
* Emit new page chunks key with all involved files for a page | packages/next/build/webpack-config.ts | @@ -277,7 +277,7 @@ export default function getBaseWebpackConfig (dir: string, {dev = false, debug =
!isServer && new ReactLoadablePlugin({
filename: REACT_LOADABLE_MANIFEST
}),
- !isServer && __selectivePageBuilding && new ChunkGraphPlugin(path.resolve(dir), { filename: CHUNK_GRAPH_MANIFEST... | true |
Other | vercel | next.js | bbfc0f8207ccc5a3b6a090dc08892234bd9569fd.json | Add more chunk graph data (#6911)
* Fix nested position
* Drop front commit
* Emit new page chunks key with all involved files for a page | packages/next/build/webpack/plugins/chunk-graph-plugin.ts | @@ -47,10 +47,16 @@ function getFiles(dir: string, modules: any[]): string[] {
}
export class ChunkGraphPlugin implements Plugin {
+ private buildId: string
private dir: string
private filename: string
- constructor(dir: string, { filename }: { filename?: string } = {}) {
+ constructor(
+ buildId: str... | true |
Other | vercel | next.js | ac8b15a43e9620b84e85c8039868d5da4a17abb8.json | Add useRequest hook and RequestContext (#6910)
* Add useRequest hook and RequestContext
* Add useRequest hook and RequestContext
* Fix merge conflict duplicate import | packages/next-server/lib/request-context.ts | @@ -0,0 +1,3 @@
+import * as React from 'react'
+
+export const RequestContext: React.Context<any> = React.createContext(null) | true |
Other | vercel | next.js | ac8b15a43e9620b84e85c8039868d5da4a17abb8.json | Add useRequest hook and RequestContext (#6910)
* Add useRequest hook and RequestContext
* Add useRequest hook and RequestContext
* Fix merge conflict duplicate import | packages/next-server/server/render.tsx | @@ -9,9 +9,10 @@ import { loadGetInitialProps, isResSent } from '../lib/utils'
import Head, { defaultHead } from '../lib/head'
import Loadable from '../lib/loadable'
import { DataManagerContext } from '../lib/data-manager-context'
+import { RequestContext } from '../lib/request-context'
import {LoadableContext} fro... | true |
Other | vercel | next.js | ac8b15a43e9620b84e85c8039868d5da4a17abb8.json | Add useRequest hook and RequestContext (#6910)
* Add useRequest hook and RequestContext
* Add useRequest hook and RequestContext
* Fix merge conflict duplicate import | packages/next/client/router.js | @@ -2,6 +2,7 @@
import React from 'react'
import _Router from 'next-server/dist/lib/router/router'
import { RouterContext } from 'next-server/dist/lib/router-context'
+import { RequestContext } from 'next-server/dist/lib/request-context'
const SingletonRouter = {
router: null, // holds the actual router instan... | true |
Other | vercel | next.js | bc4e58f0793911db906d6d5385e8a854a74807e0.json | Add query for debugging amp data (#6909)
This adds a query for debugging AMP bind init data | packages/next-server/server/next-server.ts | @@ -272,7 +272,7 @@ export default class Server {
const html = await this.renderToHTML(req, res, pathname, query, {
amphtml: query.amp && this.nextConfig.experimental.amp,
- dataOnly: req.headers && (req.headers.accept || '').indexOf('application/amp.bind+json') !== -1,
+ dataOnly: this.renderOp... | false |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | errors/head-build-id.md | @@ -0,0 +1,10 @@
+# Failed to load `BUILD_ID` from Server
+
+#### Why This Error Occurred
+
+The deployment was generated incorrectly or the server was overloaded at the time of the request.
+
+#### Possible Ways to Fix It
+
+Please make sure you are using the latest version of the `@now/next` builder in your `now.json... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next-server/lib/constants.js | @@ -26,3 +26,4 @@ export const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `${CLIENT_STATIC_FILES_RUNTIM
export const IS_BUNDLED_PAGE_REGEX = /^static[/\\][^/\\]+[/\\]pages.*\.js$/
// matches static/<buildid>/pages/:page*.js
export const ROUTE_NAME_REGEX = /^static[/\\][^/\\]+[/\\]pages[/\\](.*)\.js$/
+export const HEAD_B... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next-server/server/render.tsx | @@ -116,6 +116,7 @@ type RenderOpts = {
ampBindInitData: boolean
staticMarkup: boolean
buildId: string
+ dynamicBuildId?: boolean
runtimeConfig?: { [key: string]: any }
assetPrefix?: string
err?: Error | null
@@ -143,6 +144,7 @@ function renderDocument(
pathname,
query,
buildId,
+ d... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/build/entries.ts | @@ -32,7 +32,7 @@ type Entrypoints = {
server: WebpackEntrypoints
}
-export function createEntrypoints(pages: PagesMapping, target: 'server'|'serverless', buildId: string, config: any): Entrypoints {
+export function createEntrypoints(pages: PagesMapping, target: 'server'|'serverless', buildId: string, dynamicBui... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/build/index.ts | @@ -84,8 +84,10 @@ export default async function build(
? [process.env.__NEXT_BUILDER_EXPERIMENTAL_PAGE]
: []
+ const __selectivePageBuilding = pages ? Boolean(pages.length) : false
+
let pagePaths
- if (pages && pages.length) {
+ if (__selectivePageBuilding) {
if (config.target !== 'serverle... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/build/webpack-config.ts | @@ -326,7 +326,7 @@ export default function getBaseWebpackConfig (dir: string, {dev = false, debug =
return /next-server[\\/]dist[\\/]/.test(context) || /next[\\/]dist[\\/]/.test(context)
}
}),
- target === 'serverless' && isServer && new ServerlessPlugin(buildId),
+ target === 'ser... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -14,6 +14,7 @@ export type ServerlessLoaderQuery = {
ampEnabled: boolean | string,
ampBindInitData: boolean | string,
generateEtags: string
+ dynamicBuildId?: string | boolean
}
const nextServerlessLoader: loader.Loader = function () {
@@ -27,7 +28,8 @@ const nextServerlessLoader: loader.Loader = funct... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/build/webpack/plugins/serverless-plugin.ts | @@ -53,32 +53,52 @@ function interceptFileWrites(
export class ServerlessPlugin {
private buildId: string
+ private isServer: boolean
- constructor(buildId: string) {
+ constructor(buildId: string, { isServer = false } = {}) {
this.buildId = buildId
+ this.isServer = isServer
}
apply(compiler... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/build/write-build-id.ts | @@ -1,11 +1,16 @@
import fs from 'fs'
import {promisify} from 'util'
import {join} from 'path'
-import {BUILD_ID_FILE} from 'next-server/constants'
+import {BUILD_ID_FILE, HEAD_BUILD_ID_FILE} from 'next-server/constants'
const writeFile = promisify(fs.writeFile)
-export async function writeBuildId (distDir: str... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/client/index.js | @@ -31,6 +31,7 @@ const {
page,
query,
buildId,
+ dynamicBuildId,
assetPrefix,
runtimeConfig,
dynamicIds
@@ -99,6 +100,10 @@ export default async ({
await Loadable.preloadReady(dynamicIds || [])
+ if (dynamicBuildId === true) {
+ pageLoader.onDynamicBuildId()
+ }
+
router = createRoute... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/client/page-loader.js | @@ -1,5 +1,6 @@
/* global document */
import mitt from 'next-server/dist/lib/mitt'
+import unfetch from 'unfetch'
// smaller version of https://gist.github.com/igrigorik/a02f2359f3bc50ca7a9c
function supportsPreload (list) {
@@ -24,6 +25,7 @@ export default class PageLoader {
this.prefetchCache = new Set()
... | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/package.json | @@ -116,7 +116,7 @@
"@types/webpack-sources": "0.1.5",
"@zeit/ncc": "0.15.2",
"arg": "4.1.0",
- "nanoid": "1.2.1",
+ "nanoid": "2.0.1",
"resolve": "1.5.0",
"taskr": "1.1.0",
"text-table": "0.2.0", | true |
Other | vercel | next.js | 19c635175ba7556a222bd46f9a68bfb3beeeb7cd.json | Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages
* Add code VSCode deleted
* Add dynamicBuildId option to __NEXT_DATA__
* Reduce amount of diff
* Make getPageFile code easier to read
* Minimize diff
* minimize diff
* Fix default value for dynamicBuildId
* Fi... | packages/next/pages/_document.js | @@ -157,7 +157,7 @@ export class Head extends Component {
__NEXT_DATA__,
} = this.context._documentProps
const { _devOnlyInvalidateCacheQueryString } = this.context
- const { page, buildId } = __NEXT_DATA__
+ const { page, buildId, dynamicBuildId } = __NEXT_DATA__
const isDirtyAmp = amphtml ... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.