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 | 9a50e926e3b767eb4775ab31ec370ba6caebfa3a.json | Add document middleware (#7209)
* Add document middleware
* Update tests
* Apply suggestions from code review
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co> | test/integration/document-middleware/pages/index.js | @@ -0,0 +1,3 @@
+export default () => (
+ <p>Hi there 👋</p>
+) | true |
Other | vercel | next.js | 9a50e926e3b767eb4775ab31ec370ba6caebfa3a.json | Add document middleware (#7209)
* Add document middleware
* Update tests
* Apply suggestions from code review
Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co> | test/integration/document-middleware/test/index.test.js | @@ -0,0 +1,46 @@
+/* eslint-env jest */
+/* global jasmine */
+import { join } from 'path'
+import {
+ renderViaHTTP,
+ fetchViaHTTP,
+ findPort,
+ launchApp,
+ killApp
+} from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
+
+let app
+let appPort
+
+describe('Document middleware', () => {
+... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next-server/lib/constants.ts | @@ -7,6 +7,7 @@ export const BUILD_MANIFEST = 'build-manifest.json'
export const REACT_LOADABLE_MANIFEST = 'react-loadable-manifest.json'
export const CHUNK_GRAPH_MANIFEST = 'compilation-modules.json'
export const SERVER_DIRECTORY = 'server'
+export const SERVERLESS_DIRECTORY = 'serverless'
export const CONFIG_FILE... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next-server/server/config.ts | @@ -27,6 +27,7 @@ const defaultConfig: {[key: string]: any} = {
(Number(process.env.CIRCLE_NODE_TOTAL) ||
(os.cpus() || { length: 1 }).length) - 1,
),
+ autoExport: false,
ampBindInitData: false,
exportTrailingSlash: true,
terserLoader: false, | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next-server/server/load-components.ts | @@ -1,4 +1,4 @@
-import {BUILD_MANIFEST, CLIENT_STATIC_FILES_PATH, REACT_LOADABLE_MANIFEST, SERVER_DIRECTORY} from '../lib/constants';
+import {BUILD_MANIFEST, CLIENT_STATIC_FILES_PATH, REACT_LOADABLE_MANIFEST, SERVER_DIRECTORY, SERVERLESS_DIRECTORY} from '../lib/constants';
import { join } from 'path';
import { re... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next-server/server/next-server.ts | @@ -72,14 +72,8 @@ export default class Server {
publicRuntimeConfig,
assetPrefix,
generateEtags,
- target,
} = this.nextConfig
- if (process.env.NODE_ENV === 'production' && target !== 'server')
- throw new Error(
- 'Cannot start server when target is not server. https:/... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next-server/server/render.tsx | @@ -252,6 +252,16 @@ export async function renderToHTML(
`The default export is not a React Component in page: "/_document"`,
)
}
+
+ const isStaticPage = typeof (Component as any).getInitialProps !== 'function'
+ const defaultAppGetInitialProps = App.getInitialProps === (App as any).origGetI... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next-server/server/require.ts | @@ -1,15 +1,19 @@
+import fs from 'fs'
import {join} from 'path'
-import {PAGES_MANIFEST, SERVER_DIRECTORY} from '../lib/constants'
+import {promisify} from 'util'
+import {PAGES_MANIFEST, SERVER_DIRECTORY, SERVERLESS_DIRECTORY} from '../lib/constants'
import { normalizePagePath } from './normalize-page-path'
+cons... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next/build/flying-shuttle.ts | @@ -9,6 +9,7 @@ import { promisify } from 'util'
import { recursiveDelete } from '../lib/recursive-delete'
import * as Log from './output/log'
+import { PageInfo } from './utils';
const FILE_BUILD_ID = 'HEAD_BUILD_ID'
const FILE_UPDATED_AT = 'UPDATED_AT'
@@ -220,6 +221,29 @@ export class FlyingShuttle {
re... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next/build/index.ts | @@ -1,12 +1,16 @@
import chalk from 'chalk'
import {
+ SERVER_DIRECTORY,
+ SERVERLESS_DIRECTORY,
+ PAGES_MANIFEST,
CHUNK_GRAPH_MANIFEST,
PHASE_PRODUCTION_BUILD,
} from 'next-server/constants'
import loadConfig from 'next-server/next-config'
import nanoid from 'next/dist/compiled/nanoid/index.js'
import p... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next/build/utils.ts | @@ -14,6 +14,7 @@ import { getPageChunks } from './webpack/plugins/chunk-graph-plugin'
const fsStat = promisify(fs.stat)
const fsExists = promisify(fs.exists)
const fsReadFile = promisify(fs.readFile)
+const nextEnvConfig = require('next-server/config')
export function collectPages(
directory: string,
@@ -29,6... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next/build/webpack-config.ts | @@ -501,7 +501,7 @@ export default async function getBaseWebpackConfig(
target === 'serverless' &&
(isServer || selectivePageBuilding) &&
new ServerlessPlugin(buildId, { isServer }),
- target !== 'serverless' && isServer && new PagesManifestPlugin(),
+ isServer && new PagesManifestPlu... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next/build/webpack/loaders/next-serverless-loader.ts | @@ -41,7 +41,9 @@ const nextServerlessLoader: loader.Loader = function () {
import Error from '${absoluteErrorPath}';
import App from '${absoluteAppPath}';
import Component from '${absolutePagePath}';
- async function renderReqToHTML(req, res) {
+ export default Component
+ export const _app = A... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next/build/webpack/plugins/pages-manifest-plugin.ts | @@ -1,18 +1,26 @@
import {Compiler, Plugin} from 'webpack'
import { RawSource } from 'webpack-sources'
-import { PAGES_MANIFEST, ROUTE_NAME_REGEX } from 'next-server/constants'
+import { PAGES_MANIFEST, ROUTE_NAME_REGEX, SERVERLESS_ROUTE_NAME_REGEX } from 'next-server/constants'
// This plugin creates a pages-mani... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next/export/index.js | @@ -26,7 +26,7 @@ export default async function (dir, options, configuration) {
const distDir = join(dir, nextConfig.distDir)
const subFolders = nextConfig.experimental.exportTrailingSlash
- if (nextConfig.target !== 'server') throw new Error('Cannot export when target is not server. https://err.sh/zeit/next.j... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next/export/worker.js | @@ -27,7 +27,8 @@ process.on(
renderOpts,
serverRuntimeConfig,
concurrency,
- subFolders
+ subFolders,
+ serverless
}) => {
const sema = new Sema(concurrency, { capacity: exportPaths.length })
try {
@@ -40,8 +41,23 @@ process.on(
delete query.ampPath
delete query.a... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | packages/next/pages/_app.tsx | @@ -9,15 +9,17 @@ export type AppContext = AppContextType<Router>
export type AppProps<P = {}> = AppPropsType<Router, P>
+async function appGetInitialProps({ Component, ctx }: AppContext): Promise<AppInitialProps> {
+ const pageProps = await loadGetInitialProps(Component, ctx)
+ return { pageProps }
+}
+
export... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/amp-export-validation/next.config.js | @@ -1,6 +1,3 @@
module.exports = {
// exportPathMap
- experimental: {
- amp: true
- }
} | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/amphtml/next.config.js | @@ -4,6 +4,6 @@ module.exports = {
maxInactiveAge: 1000 * 60 * 60
},
experimental: {
- amp: true
+ autoExport: true
}
} | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/amphtml/test/index.test.js | @@ -66,7 +66,7 @@ describe('AMP Usage', () => {
() => accessSync(join(appDir, '.next/static', buildId, 'pages', pg + '.js'))
).toThrow()
expect(
- () => accessSync(join(appDir, '.next/server/static', buildId, 'pages', pg + '.js'))
+ () => accessSync(join(appDir, '.next/ser... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/client-navigation/next.config.js | @@ -2,5 +2,8 @@ module.exports = {
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60
+ },
+ experimental: {
+ autoExport: true
}
} | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/client-navigation/pages/url-prop.js | @@ -1,7 +1,11 @@
-export default ({ url }) => {
+const Page = ({ url }) => {
return <div>
<p id='pathname'>{url.pathname}</p>
<p id='query'>{Object.keys(url.query).length}</p>
<p id='aspath'>{url.asPath}</p>
</div>
}
+
+Page.getInitialProps = () => ({})
+
+export default Page | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/export-default-map/next.config.js | @@ -1,5 +1,5 @@
module.exports = {
experimental: {
- amp: true
+ autoExport: true
}
} | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/export-subfolders/next.config.js | @@ -1,5 +1,6 @@
module.exports = {
experimental: {
- exportTrailingSlash: false
+ exportTrailingSlash: false,
+ autoExport: true
}
} | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/export/next.config.js | @@ -10,7 +10,8 @@ module.exports = (phase) => {
bar: 'bar'
},
experimental: {
- // exportTrailingSlash: false
+ // exportTrailingSlash: false,
+ autoExport: true
},
exportPathMap: function () {
return { | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/export/test/index.test.js | @@ -53,7 +53,7 @@ describe('Static Export', () => {
await nextBuild(appDir)
await nextExport(appDir, { outdir })
- nextConfig.replace(`// exportTrailingSlash: false`, `exportTrailingSlash: false`)
+ nextConfig.replace(`// exportTrailingSlash: false,`, `exportTrailingSlash: false,`)
await nextBuil... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/production/next.config.js | @@ -2,5 +2,8 @@ module.exports = {
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60
+ },
+ experimental: {
+ autoExport: true
}
} | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/production/pages/error-in-ssr-render.js | @@ -1,5 +1,9 @@
import React from 'react'
export default class ErrorInRenderPage extends React.Component {
+ static async getInitialProps () {
+ return {}
+ }
+
render () {
throw new Error('An Expected error occured')
} | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/production/pages/process-env.js | @@ -7,6 +7,10 @@ if (!process.browser) {
global.__THIS_SHOULD_ONLY_BE_DEFINED_IN_SERVER_CONTEXT__ = true
}
-export default () => (
+const ProcessEnv = () => (
<div id='node-env'>{process.env.NODE_ENV}</div>
)
+
+ProcessEnv.getInitialProps = () => ({})
+
+export default ProcessEnv | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/production/pages/query.js | @@ -8,4 +8,6 @@ const Page = ({ router: { query } }) => (
</>
)
+Page.getInitialProps = () => ({})
+
export default withRouter(Page) | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/production/test/index.test.js | @@ -1,7 +1,7 @@
/* eslint-env jest */
/* global jasmine, browserName */
import webdriver from 'next-webdriver'
-import { readFileSync } from 'fs'
+import { readFileSync, existsSync } from 'fs'
import { join } from 'path'
import {
nextServer,
@@ -18,6 +18,7 @@ import security from './security'
import { BUILD_MA... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/serverless/next.config.js | @@ -5,7 +5,6 @@ module.exports = {
maxInactiveAge: 1000 * 60 * 60
},
experimental: {
- amp: true
- },
- lambdas: true
+ autoExport: true
+ }
} | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/serverless/pages/_app.js | @@ -1,26 +0,0 @@
-import React from 'react'
-import App, { Container } from 'next/app'
-
-class MyApp extends App {
- static async getInitialProps ({ Component, ctx }) {
- let pageProps = {}
-
- if (Component.getInitialProps) {
- pageProps = await Component.getInitialProps(ctx)
- }
-
- return { pagePr... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/serverless/run-server.js | @@ -1,2 +0,0 @@
-const start = require('./server')
-start(3000).then(() => console.log('http://localhost:3000')) | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/serverless/server.js | @@ -1,41 +0,0 @@
-const express = require('express')
-const http = require('http')
-const path = require('path')
-
-module.exports = function start (port = 0) {
- return new Promise((resolve, reject) => {
- const app = express()
- const nextStaticDir = path.join(__dirname, '.next', 'static')
- app.use('/_next... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/serverless/test/index.test.js | @@ -1,42 +1,36 @@
/* eslint-env jest */
-/* global jasmine, test */
+/* global jasmine */
import webdriver from 'next-webdriver'
import { join } from 'path'
import { existsSync } from 'fs'
import {
+ killApp,
+ findPort,
nextBuild,
- stopApp,
+ nextStart,
renderViaHTTP
} from 'next-test-utils'
-import s... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/ssr-ctx/pages/index.js | @@ -2,7 +2,7 @@ import React from 'react'
const Idk = React.createContext(null)
-export default () => {
+const Page = () => {
return (
<div>
<Idk.Provider value='hello world'>
@@ -15,3 +15,5 @@ export default () => {
</div>
)
}
+
+export default Page | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/integration/ssr-ctx/test/index.test.js | @@ -4,7 +4,8 @@ import { join } from 'path'
import {
killApp,
findPort,
- runNextCommand,
+ nextStart,
+ nextBuild,
renderViaHTTP
} from 'next-test-utils'
@@ -16,28 +17,14 @@ let app
describe('Production Usage', () => {
beforeAll(async () => {
- await runNextCommand(['build', appDir])
+ awai... | true |
Other | vercel | next.js | cdd54afb0d205097f42bbe80debc6931e105b16f.json | Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps
* Add support for exporting serverless to static
and serving the html files during next start
* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests
* Upda... | test/lib/next-test-utils.js | @@ -160,6 +160,10 @@ export function nextExport (dir, { outdir }) {
return runNextCommand(['export', dir, '--outdir', outdir])
}
+export function nextStart (dir, port) {
+ return runNextCommandDev(['start', '-p', port, dir])
+}
+
// Kill a launched app
export async function killApp (instance) {
await new Pr... | true |
Other | vercel | next.js | e6fb48cee84bef4860979339bacd4f086c3ea7a3.json | Fix string type on router.query (#7387) | packages/next-server/lib/router/router.ts | @@ -5,6 +5,7 @@ import { parse } from 'url';
import mitt, {MittEmitter} from '../mitt';
import { formatWithValidation, getURL, loadGetInitialProps, NextPageContext, AppContextType } from '../utils';
import {rewriteUrlForNextExport} from './rewrite-url-for-export'
+import { ParsedUrlQuery } from 'querystring';
fun... | true |
Other | vercel | next.js | e6fb48cee84bef4860979339bacd4f086c3ea7a3.json | Fix string type on router.query (#7387) | packages/next-server/server/render.tsx | @@ -31,12 +31,12 @@ function noRouter() {
class ServerRouter implements BaseRouter {
route: string
pathname: string
- query: string
+ query: ParsedUrlQuery
asPath: string
// TODO: Remove in the next major version, as this would mean the user is adding event listeners in server-side `render` method
sta... | true |
Other | vercel | next.js | 931cd3d305b9fd7882d3e66797fac591f16124ea.json | Reduce the maximum number of shuttles | packages/next/build/flying-shuttle.ts | @@ -13,7 +13,7 @@ import * as Log from './output/log'
const FILE_BUILD_ID = 'HEAD_BUILD_ID'
const FILE_UPDATED_AT = 'UPDATED_AT'
const DIR_FILES_NAME = 'files'
-const MAX_SHUTTLES = 4
+const MAX_SHUTTLES = 3
const mkdirp = promisify(mkdirpModule)
const fsExists = promisify(fs.exists) | false |
Other | vercel | next.js | 17f6fa96bd631f27acbfc747e0bd446b65deb751.json | Fix broken link (#7378) | packages/next-server/server/render.tsx | @@ -295,7 +295,7 @@ export async function renderToHTML(
if (dev && (props.router || props.Component)) {
throw new Error(
- `'router' and 'Component' can not be returned in getInitialProps from _app.js https://err.sh/zeit/next.js/cant-override-next-props.md`,
+ `'router' and 'Component' can n... | true |
Other | vercel | next.js | 17f6fa96bd631f27acbfc747e0bd446b65deb751.json | Fix broken link (#7378) | test/integration/no-override-next-props/test/index.test.js | @@ -22,6 +22,6 @@ describe('Dynamic require', () => {
it('should show error when a Next prop is returned in _app.getInitialProps', async () => {
const html = await renderViaHTTP(appPort, '/')
- expect(html).toMatch(/https:\/\/err\.sh\/zeit\/next\.js\/cant-override-next-props\.md/)
+ expect(html).toMatch... | true |
Other | vercel | next.js | 1cf804826f4ba5a8038dffac6a11ae349443d227.json | Show helpful warning when @types/react isn't found (#7345)
* Show helpful warning when @types/react isn't found
* Apply suggestions from code review
Co-Authored-By: Resi Respati <resir014@gmail.com>
* Update warning for yarn
* Check earlier so we can log one install command for TypeScript deps | packages/next/lib/verifyTypeScriptSetup.ts | @@ -36,7 +36,7 @@ async function verifyNoTypeScript(dir: string) {
console.warn(
chalk.yellow(
`We detected TypeScript in your project (${chalk.bold(
- `${typescriptFiles[0]}`,
+ `.${typescriptFiles[0]}`,
)}) and created a ${chalk.bold('tsconfig.json')} file for you.`,
... | false |
Other | vercel | next.js | 577cc7b6afb144c7bfe0755fb78edb9c6ae45e70.json | Fix error overlay dismiss after fixing build error (#7335)
* Make sure to dismiss type error after being fixed
* Update test | packages/next/client/dev-error-overlay/hot-dev-client.js | @@ -266,6 +266,7 @@ async function tryApplyUpdates (onHotUpdateSuccess) {
}
if (!isUpdateAvailable() || !canApplyUpdates()) {
+ ErrorOverlay.dismissBuildError()
return
}
| true |
Other | vercel | next.js | 577cc7b6afb144c7bfe0755fb78edb9c6ae45e70.json | Fix error overlay dismiss after fixing build error (#7335)
* Make sure to dismiss type error after being fixed
* Update test | test/integration/typescript/pages/type-error-recover.tsx | @@ -0,0 +1 @@
+export default () => <p>Hello world</p> | true |
Other | vercel | next.js | 577cc7b6afb144c7bfe0755fb78edb9c6ae45e70.json | Fix error overlay dismiss after fixing build error (#7335)
* Make sure to dismiss type error after being fixed
* Update test | test/integration/typescript/test/hmr.js | @@ -2,7 +2,7 @@
import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path'
-import { check, getBrowserBodyText } from 'next-test-utils'
+import { check, getBrowserBodyText, getReactErrorOverlayContent } from 'next-test-utils'
export default (context, render... | true |
Other | vercel | next.js | 577cc7b6afb144c7bfe0755fb78edb9c6ae45e70.json | Fix error overlay dismiss after fixing build error (#7335)
* Make sure to dismiss type error after being fixed
* Update test | test/integration/typescript/test/index.test.js | @@ -12,7 +12,8 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
describe('TypeScript Features', () => {
beforeAll(async () => {
context.appPort = await findPort()
- context.server = await launchApp(join(__dirname, '../'), context.appPort)
+ context.appDir = join(__dirname, '../')
+ context.server =... | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next-server/package.json | @@ -24,10 +24,12 @@
]
},
"dependencies": {
+ "@babel/runtime-corejs2": "^7.1.2",
"ansi-html": "0.0.7",
"etag": "1.8.1",
"find-up": "3.0.0",
"fresh": "0.5.2",
+ "hoist-non-react-statics": "^3.0.1",
"htmlescape": "1.1.1",
"http-errors": "1.6.2",
"path-to-regexp": "2.1.0... | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/app.js | @@ -1 +1 @@
-module.exports = require('./dist/lib/app')
+module.exports = require('./dist/pages/_app') | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/build/webpack.js | @@ -32,14 +32,20 @@ function externalsConfig (dir, isServer) {
return externals
}
+ const notExternalModules = ['next/app', 'next/document', 'next/error']
+
externals.push((context, request, callback) => {
- resolve(request, { basedir: dir, preserveSymlinks: true }, (err, res) => {
+ if (notExternal... | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/document.js | @@ -1 +1 @@
-module.exports = require('./dist/server/document')
+module.exports = require('./dist/pages/_document') | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/error.js | @@ -1 +1 @@
-module.exports = require('./dist/lib/error')
+module.exports = require('./dist/pages/_error') | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/lib/app.js | @@ -1,116 +0,0 @@
-import React, { Component } from 'react'
-import PropTypes from 'prop-types'
-import { execOnce, loadGetInitialProps } from 'next-server/dist/lib/utils'
-import { makePublicRouterInstance } from 'next-server/router'
-
-export default class App extends Component {
- static childContextTypes = {
- ... | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/lib/error.js | @@ -1,79 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import HTTPStatus from 'http-status'
-import Head from 'next-server/head'
-
-export default class Error extends React.Component {
- static getInitialProps ({ res, err }) {
- const statusCode = res ? res.statusCode : (err ? err.statusCo... | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/pages/_app.js | @@ -1 +1,116 @@
-module.exports = require('next/app')
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+import { execOnce, loadGetInitialProps } from 'next-server/dist/lib/utils'
+import { makePublicRouterInstance } from 'next-server/router'
+
+export default class App extends Component {
+... | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/pages/_document.js | @@ -1 +1,218 @@
-module.exports = require('next/document')
+/* eslint-disable */
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+import htmlescape from 'htmlescape'
+import flush from 'styled-jsx/server'
+
+const Fragment = React.Fragment || function Fragment ({ children }) {
+ return <d... | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/pages/_error.js | @@ -1 +1,79 @@
-module.exports = require('next/error')
+import React from 'react'
+import PropTypes from 'prop-types'
+import HTTPStatus from 'http-status'
+import Head from 'next-server/head'
+
+export default class Error extends React.Component {
+ static getInitialProps ({ res, err }) {
+ const statusCode = res ... | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/server/document.js | @@ -1,218 +0,0 @@
-/* eslint-disable */
-import React, { Component } from 'react'
-import PropTypes from 'prop-types'
-import htmlescape from 'htmlescape'
-import flush from 'styled-jsx/server'
-
-const Fragment = React.Fragment || function Fragment ({ children }) {
- return <div>{children}</div>
-}
-
-export default ... | true |
Other | vercel | next.js | 785377d3c306b5c89c566f59a846b7829e627654.json | Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies | packages/next/taskfile.js | @@ -1,7 +1,7 @@
const notifier = require('node-notifier')
export async function compile (task) {
- await task.parallel(['bin', 'server', 'nextbuild', 'nextbuildstatic', 'lib', 'client'])
+ await task.parallel(['bin', 'server', 'nextbuild', 'nextbuildstatic', 'pages', 'lib', 'client'])
}
export async function ... | true |
Other | vercel | next.js | de6d394d7365d2651614ac3517d51a91c63e3f1c.json | Use correct server path since main was changed | packages/next-server/index.js | @@ -1,4 +1,5 @@
+// This file is used for when users run `require('next-server')`
const Server = require('./dist/server/next-server').default
-module.exports = function (opts) {
- return new Server(opts)
+module.exports = function (options) {
+ return new Server(options)
} | true |
Other | vercel | next.js | de6d394d7365d2651614ac3517d51a91c63e3f1c.json | Use correct server path since main was changed | packages/next/server/next-dev-server.js | @@ -1,4 +1,4 @@
-import Server from 'next-server'
+import Server from 'next-server/dist/server/next-server'
import { join } from 'path'
import HotReloader from './hot-reloader'
import {route} from 'next-server/dist/server/router' | true |
Other | vercel | next.js | de6d394d7365d2651614ac3517d51a91c63e3f1c.json | Use correct server path since main was changed | packages/next/server/next.js | @@ -1,5 +1,10 @@
// This file is used for when users run `require('next')`
-module.exports = (opts) => {
- const Server = opts.dev ? require('./next-dev-server').default : require('next-server').default
- return new Server(opts)
+module.exports = (options) => {
+ if (options.dev) {
+ const Server = require('./ne... | true |
Other | vercel | next.js | 8db40b644f5ccfc5a6f673bae3566994377e19d5.json | Add npmClient for publish command | lerna.json | @@ -6,6 +6,7 @@
],
"command": {
"publish": {
+ "npmClient": "npm",
"allowBranch": "canary",
"registry": "https://registry.npmjs.org/"
} | false |
Other | vercel | next.js | 57c61cde3a8f3b63ed465a0393a11b564c0153e6.json | Use yarn to correctly pass through arguments | .circleci/config.yml | @@ -22,7 +22,7 @@ jobs:
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
# - run:
# name: Publishing to Stable Channel
- # command: npm run lerna publish from-git --yes
+ # command: yarn run lerna publish from-git --yes
publish-canary:
dock... | false |
Other | vercel | next.js | 2e01b3d34ad4a1931d717fbc15d97620aa887d0d.json | Add files key to next-server | packages/next-server/package.json | @@ -2,6 +2,17 @@
"name": "next-server",
"version": "7.0.2-canary.0",
"main": "./dist/server/next-server.js",
+ "files": [
+ "dist",
+ "asset.js",
+ "config.js",
+ "constants.js",
+ "dynamic.js",
+ "head.js",
+ "link.js",
+ "router.js",
+ "next-config.js"
+ ],
"scripts": {
"... | false |
Other | vercel | next.js | be5dbe3cfd8b4f96422c97fc192d436aab241d9e.json | Persist dist directory under packages | .circleci/config.yml | @@ -12,7 +12,7 @@ jobs:
- persist_to_workspace:
root: .
paths:
- - dist
+ - packages/*/dist
publish-stable:
docker:
- image: circleci/node:9.10.0 | false |
Other | vercel | next.js | b91d4975aa1c3591d6625ee70d120c440cd9fdbb.json | Add circleci publish | .circleci/config.yml | @@ -9,3 +9,56 @@ jobs:
- run: yarn install
- run: yarn bootstrap
- run: yarn test
+ - persist_to_workspace:
+ root: .
+ paths:
+ - dist
+ publish-stable:
+ docker:
+ - image: circleci/node:9.10.0
+ working_directory: ~/repo
+ steps:
+ - checkout... | false |
Other | vercel | next.js | 841eafc55e2ecec8b5e74bc29eda8daf9efbad88.json | Remove deploy from travis | .travis.yml | @@ -21,17 +21,5 @@
"rm -rf node_modules/.cache"
],
before_script: ["npm run bootstrap"],
- after_script: ["npm run coveralls"],
- deploy: {
- provider: "npm",
- email: "leo@zeit.co",
- tag: "canary",
- api_key: {
- secure: "MJfpcAJC1IvPL01NiGRLYAAgb7TZz5K0ukM1n+E+QcoF9+L1gn4WcP056ECchuohEF... | false |
Other | vercel | next.js | e994159e383765431780ca83eed8ab0618962c9b.json | Remove version prefix | .npmrc | @@ -1 +1,2 @@
save-exact = true
+tag-version-prefix="" | false |
Other | vercel | next.js | b9461824ec097fc2b269aca95d30d21e97167a87.json | Remove unused prefetch.js (#5344) | packages/next/package.json | @@ -20,7 +20,6 @@
"error.js",
"head.js",
"link.js",
- "prefetch.js",
"router.js"
],
"bin": { | true |
Other | vercel | next.js | b9461824ec097fc2b269aca95d30d21e97167a87.json | Remove unused prefetch.js (#5344) | packages/next/prefetch.js | @@ -1 +0,0 @@
-module.exports = require('./dist/lib/prefetch') | true |
Other | vercel | next.js | 8fb6f7d5b62113c4ee23b827f3f6f8e3d0c1b6a6.json | Use new import syntax in readme examples | README.md | @@ -916,7 +916,7 @@ Here are a few ways to use dynamic imports.
```jsx
import dynamic from 'next/dynamic'
-const DynamicComponent = dynamic(import('../components/hello'))
+const DynamicComponent = dynamic(() => import('../components/hello'))
export default () => (
<div>
@@ -932,7 +932,7 @@ export default () =... | false |
Other | vercel | next.js | 2f618581cfc0e75ff918a5618074b04660f8cd81.json | Remove disabled plugin | build/webpack.js | @@ -20,7 +20,6 @@ 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_STATIC_FILES_RUNTIME_WEBPACK, CLIENT_STATIC_FILES_RUNTIME_MAIN} from '.... | true |
Other | vercel | next.js | 2f618581cfc0e75ff918a5618074b04660f8cd81.json | Remove disabled plugin | package.json | @@ -70,7 +70,6 @@
"@babel/runtime": "7.0.0",
"@babel/runtime-corejs2": "7.0.0",
"@babel/template": "7.0.0",
- "@zeit/hard-source-webpack-plugin": "0.13.0",
"ansi-html": "0.0.7",
"autodll-webpack-plugin": "0.4.2",
"babel-core": "7.0.0-bridge.0", | true |
Other | vercel | next.js | 7f39aef9123130acd171897ba0ef83a8b94387d2.json | Remove obsolete check in dev-server (#5320)
Remove `if(this.hotReloader)` as it's always guaranteed to be there.
https://github.com/zeit/next.js/pull/5317#discussion_r221233064 | server/next-dev-server.js | @@ -21,23 +21,17 @@ export default class DevServer extends Server {
async prepare () {
await super.prepare()
- if (this.hotReloader) {
- await this.hotReloader.start()
- }
+ await this.hotReloader.start()
}
async close () {
- if (this.hotReloader) {
- await this.hotReloader.stop(... | false |
Other | vercel | next.js | 5c9c7b877bf60adaf17754a6d66fe646c9661cad.json | Add language switch to with-react-i18next example (#5306) | examples/with-react-i18next/components/LanguageSwitch.js | @@ -0,0 +1,22 @@
+import React from 'react'
+import Link from 'next/link'
+import { withRouter } from 'next/router'
+
+import i18n from '../i18n'
+
+const LanguageSwitch = ({ router }) => (
+ <ul>
+ <li>
+ <Link href={`${router.pathname}`}>
+ <a onClick={() => i18n.changeLanguage('en')}>en</a>
+ </... | true |
Other | vercel | next.js | 5c9c7b877bf60adaf17754a6d66fe646c9661cad.json | Add language switch to with-react-i18next example (#5306) | examples/with-react-i18next/package.json | @@ -12,14 +12,14 @@
"license": "MIT",
"dependencies": {
"express": "4.16.3",
- "i18next": "11.3.6",
- "i18next-browser-languagedetector": "2.2.0",
- "i18next-express-middleware": "1.2.0",
- "i18next-node-fs-backend": "1.2.1",
+ "i18next": "11.9.0",
+ "i18next-browser-languagedetector": "2.2... | true |
Other | vercel | next.js | 5c9c7b877bf60adaf17754a6d66fe646c9661cad.json | Add language switch to with-react-i18next example (#5306) | examples/with-react-i18next/pages/_app.js | @@ -2,6 +2,7 @@ import React from 'react'
import App, { Container } from 'next/app'
import { I18n as I18nR, I18nextProvider } from 'react-i18next'
import initialI18nInstance from '../i18n'
+import LanguageSwitch from '../components/LanguageSwitch'
export default class MyApp extends App {
render () {
@@ -19,6 +... | true |
Other | vercel | next.js | 6e4f0d8e700d95ac792f409a4a8c66ea4e74751e.json | Use getBrowserBodyText for HMR test (#5290) | test/integration/basic/test/hmr.js | @@ -2,7 +2,7 @@
import webdriver from 'next-webdriver'
import { readFileSync, writeFileSync, renameSync, existsSync } from 'fs'
import { join } from 'path'
-import { waitFor, check } from 'next-test-utils'
+import { waitFor, check, getBrowserBodyText } from 'next-test-utils'
import cheerio from 'cheerio'
export ... | true |
Other | vercel | next.js | 6e4f0d8e700d95ac792f409a4a8c66ea4e74751e.json | Use getBrowserBodyText for HMR test (#5290) | test/integration/export/test/browser.js | @@ -1,6 +1,6 @@
/* global describe, it, expect */
import webdriver from 'next-webdriver'
-import { check } from 'next-test-utils'
+import { check, getBrowserBodyText } from 'next-test-utils'
export default function (context) {
describe('Render via browser', () => {
@@ -147,23 +147,21 @@ export default function ... | true |
Other | vercel | next.js | 6e4f0d8e700d95ac792f409a4a8c66ea4e74751e.json | Use getBrowserBodyText for HMR test (#5290) | test/integration/export/test/dev.js | @@ -1,6 +1,6 @@
/* global describe, it, expect */
import webdriver from 'next-webdriver'
-import { renderViaHTTP } from 'next-test-utils'
+import { renderViaHTTP, getBrowserBodyText, check } from 'next-test-utils'
import cheerio from 'cheerio'
const loadJSONInPage = pageContent => {
@@ -12,11 +12,8 @@ export defa... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | build/babel/plugins/react-loadable-plugin.js | @@ -139,6 +139,14 @@ export default function ({ types: t, template }) {
])
)
)
+
+ // Turns `dynamic(import('something'))` into `dynamic(() => import('something'))` for backwards compat.
+ // This is the replicate the behavior in versions below Next.js 7 where we... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | build/webpack.js | @@ -20,7 +20,7 @@ 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_STATIC_FILES_RUNTIME_WEBPACK, CLIENT_STATIC_FILES_RUNTIME_MAIN} from '.... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | client/index.js | @@ -28,7 +28,8 @@ const {
query,
buildId,
assetPrefix,
- runtimeConfig
+ runtimeConfig,
+ dynamicIds
},
location
} = window
@@ -90,7 +91,7 @@ export default async ({
initialErr = error
}
- await Loadable.preloadReady()
+ await Loadable.preloadReady(dynamicIds || [])
route... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | lib/dynamic.js | @@ -71,8 +71,14 @@ export default function dynamic (dynamicOptions: any, options: NextDynamicOption
}
// Support for direct import(), eg: dynamic(import('../hello-world'))
+ // Note that this is only kept for the edge case where someone is passing in a promise as first argument
+ // The react-loadable babel p... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | lib/loadable.js | @@ -25,7 +25,8 @@ import React from 'react'
import PropTypes from 'prop-types'
const ALL_INITIALIZERS = []
-const READY_INITIALIZERS = []
+const READY_INITIALIZERS = new Map()
+let initialized = false
function load (loader) {
let promise = loader()
@@ -129,12 +130,19 @@ function createLoadableComponent (loadF... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | package.json | @@ -71,6 +71,7 @@
"@babel/runtime": "7.0.0",
"@babel/runtime-corejs2": "7.0.0",
"@babel/template": "7.0.0",
+ "@zeit/hard-source-webpack-plugin": "0.13.0",
"ansi-html": "0.0.7",
"autodll-webpack-plugin": "0.4.2",
"babel-core": "7.0.0-bridge.0",
@@ -86,7 +87,6 @@
"fresh": "0.5.2",
... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | server/render.js | @@ -157,7 +157,8 @@ async function doRender (req, res, pathname, query, {
await Loadable.preloadAll() // Make sure all dynamic imports are loaded
const docProps = await loadGetInitialProps(Document, { ...ctx, renderPage })
- const dynamicImports = getDynamicImportBundles(reactLoadableManifest, reactLoadableMod... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | test/integration/basic/components/hello3.js | @@ -0,0 +1,3 @@
+export default () => (
+ <p>Hello World 1</p>
+) | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | test/integration/basic/components/hello4.js | @@ -0,0 +1,3 @@
+export default () => (
+ <p>Hello World 2</p>
+) | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | test/integration/basic/pages/dynamic/function.js | @@ -0,0 +1,5 @@
+import dynamic from 'next/dynamic'
+
+const Hello = dynamic(() => import('../../components/hello1'))
+
+export default Hello | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | test/integration/basic/pages/dynamic/multiple-modules.js | @@ -0,0 +1,17 @@
+/* eslint-disable */
+import dynamic from 'next/dynamic'
+
+const Hello = dynamic(import(/* webpackChunkName: 'hello1' */ '../../components/hello3'))
+const Hello2 = dynamic(import(/* webpackChunkName: 'hello2' */ '../../components/hello4'))
+
+export default () => {
+ return <div>
+ <Hello />
+ <He... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | test/integration/basic/pages/dynamic/ssr.js | @@ -1,4 +1,3 @@
-
import dynamic from 'next/dynamic'
const Hello = dynamic(import('../../components/hello1')) | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | test/integration/basic/test/dynamic.js | @@ -15,6 +15,11 @@ export default (context, render) => {
expect($('body').text()).toMatch(/Hello World 1/)
})
+ it('should render dynamic import components using a function as first parameter', async () => {
+ const $ = await get$('/dynamic/function')
+ expect($('body').text()).toMa... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | test/integration/basic/test/error-recovery.js | @@ -45,7 +45,7 @@ export default (context, render) => {
aboutPage.replace('</div>', 'div')
- await waitFor(3000)
+ await waitFor(10000)
expect(await getReactErrorOverlayContent(browser)).toMatch(/Unterminated JSX contents/)
@@ -75,11 +75,11 @@ export default (context, render) => ... | true |
Other | vercel | next.js | 42736c061ad0e5610522de2517c928b2b8af0ed4.json | Introduce dynamic(() => import()) (#5249)
* Add failing tests
* Upgrade wd module
* Pass dynamic import webpack ids to the client side
* Pass through webpack ids to initalializer and only use those
* Compile dynamic(import()) to dynamic(() => import())
* Default dynamicIds
* Use forked hard-source-pl... | test/integration/production/test/index.test.js | @@ -73,8 +73,7 @@ describe('Production Usage', () => {
resources.push(`${url}static/${buildId}/pages/index.js`)
// test dynamic chunk
- const file = Object.keys(reactLoadableManifest).find((i) => i.indexOf('components/hello1') !== -1)
- resources.push(url + reactLoadableManifest[file][0].publi... | true |
Other | vercel | next.js | 7ebcc5bec9d0da258311a12634e16b3479f13b44.json | Eliminate context code based on process.browser (#5159)
* Allow deadCodeElemination when using process.browser
* Add process.browser test | build/webpack.js | @@ -274,6 +274,10 @@ export default async function getBaseWebpackConfig (dir: string, {dev = false, i
// required not to cache removed files
useHashIndex: false
}),
+ // Removes server/client code by minifier
+ new webpack.DefinePlugin({
+ 'process.browser': JSON.stringify(!isS... | true |
Other | vercel | next.js | 7ebcc5bec9d0da258311a12634e16b3479f13b44.json | Eliminate context code based on process.browser (#5159)
* Allow deadCodeElemination when using process.browser
* Add process.browser test | test/integration/production/pages/process-env.js | @@ -1,3 +1,12 @@
+
+if (process.browser) {
+ global.__THIS_SHOULD_ONLY_BE_DEFINED_IN_BROWSER_CONTEXT__ = true
+}
+
+if (!process.browser) {
+ global.__THIS_SHOULD_ONLY_BE_DEFINED_IN_SERVER_CONTEXT__ = true
+}
+
export default () => (
<div id='node-env'>{process.env.NODE_ENV}</div>
) | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.