mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
next-server (#5357)
This commit is contained in:
parent
532351ebcf
commit
82d56e063a
1
packages/next-server/asset.js
Normal file
1
packages/next-server/asset.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./dist/lib/asset')
|
17
packages/next-server/babel.config.js
Normal file
17
packages/next-server/babel.config.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
module.exports = {
|
||||||
|
'presets': [
|
||||||
|
'@babel/preset-env',
|
||||||
|
'@babel/preset-react',
|
||||||
|
'@babel/preset-flow'
|
||||||
|
],
|
||||||
|
'plugins': [
|
||||||
|
'@babel/plugin-proposal-object-rest-spread',
|
||||||
|
'@babel/plugin-proposal-class-properties',
|
||||||
|
['@babel/plugin-transform-runtime', {
|
||||||
|
'corejs': 2
|
||||||
|
}],
|
||||||
|
['babel-plugin-transform-define', {
|
||||||
|
'process.env.NEXT_VERSION': require('./package.json').version
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
1
packages/next-server/config.js
Normal file
1
packages/next-server/config.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./dist/lib/runtime-config')
|
1
packages/next-server/constants.js
Normal file
1
packages/next-server/constants.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./dist/lib/constants')
|
1
packages/next-server/dynamic.js
Normal file
1
packages/next-server/dynamic.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./dist/lib/dynamic')
|
1
packages/next-server/head.js
Normal file
1
packages/next-server/head.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./dist/lib/head')
|
27
packages/next-server/lib/constants.js
Normal file
27
packages/next-server/lib/constants.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import {join} from 'path'
|
||||||
|
export const PHASE_EXPORT = 'phase-export'
|
||||||
|
export const PHASE_PRODUCTION_BUILD = 'phase-production-build'
|
||||||
|
export const PHASE_PRODUCTION_SERVER = 'phase-production-server'
|
||||||
|
export const PHASE_DEVELOPMENT_SERVER = 'phase-development-server'
|
||||||
|
export const PAGES_MANIFEST = 'pages-manifest.json'
|
||||||
|
export const BUILD_MANIFEST = 'build-manifest.json'
|
||||||
|
export const REACT_LOADABLE_MANIFEST = 'react-loadable-manifest.json'
|
||||||
|
export const SERVER_DIRECTORY = 'server'
|
||||||
|
export const CONFIG_FILE = 'next.config.js'
|
||||||
|
export const BUILD_ID_FILE = 'BUILD_ID'
|
||||||
|
export const BLOCKED_PAGES = [
|
||||||
|
'/_document',
|
||||||
|
'/_app',
|
||||||
|
'/_error'
|
||||||
|
]
|
||||||
|
export const CLIENT_STATIC_FILES_PATH = 'static'
|
||||||
|
export const CLIENT_STATIC_FILES_RUNTIME = 'runtime'
|
||||||
|
export const CLIENT_STATIC_FILES_RUNTIME_PATH = `${CLIENT_STATIC_FILES_PATH}/${CLIENT_STATIC_FILES_RUNTIME}`
|
||||||
|
// static/runtime/main.js
|
||||||
|
export const CLIENT_STATIC_FILES_RUNTIME_MAIN = `${CLIENT_STATIC_FILES_RUNTIME_PATH}/main.js`
|
||||||
|
// static/runtime/webpack.js
|
||||||
|
export const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `${CLIENT_STATIC_FILES_RUNTIME_PATH}/webpack.js`
|
||||||
|
// matches static/<buildid>/pages/<page>.js
|
||||||
|
export const IS_BUNDLED_PAGE_REGEX = /^static[/\\][^/\\]+[/\\]pages.*\.js$/
|
||||||
|
// matches static/<buildid>/pages/:page*.js
|
||||||
|
export const ROUTE_NAME_REGEX = /^static[/\\][^/\\]+[/\\]pages[/\\](.*)\.js$/
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ansiHTML from 'ansi-html'
|
import ansiHTML from 'ansi-html'
|
||||||
import Head from './head'
|
import Head from 'next-server/head'
|
||||||
|
|
||||||
// This component is rendered through dev-error-overlay on the client side.
|
// This component is rendered through dev-error-overlay on the client side.
|
||||||
// On the server side it's rendered directly
|
// On the server side it's rendered directly
|
|
@ -4,7 +4,7 @@ import { resolve, format, parse } from 'url'
|
||||||
import React, { Component, Children } from 'react'
|
import React, { Component, Children } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import Router, { _rewriteUrlForNextExport } from './router'
|
import Router, { _rewriteUrlForNextExport } from './router'
|
||||||
import { execOnce, getLocationOrigin } from './utils'
|
import {execOnce, getLocationOrigin} from './utils'
|
||||||
|
|
||||||
function isLocal (href) {
|
function isLocal (href) {
|
||||||
const url = parse(href, false, true)
|
const url = parse(href, false, true)
|
|
@ -8,6 +8,17 @@ export function execOnce (fn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getLocationOrigin () {
|
||||||
|
const { protocol, hostname, port } = window.location
|
||||||
|
return `${protocol}//${hostname}${port ? ':' + port : ''}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getURL () {
|
||||||
|
const { href } = window.location
|
||||||
|
const origin = getLocationOrigin()
|
||||||
|
return href.substring(origin.length)
|
||||||
|
}
|
||||||
|
|
||||||
export function getDisplayName (Component) {
|
export function getDisplayName (Component) {
|
||||||
if (typeof Component === 'string') {
|
if (typeof Component === 'string') {
|
||||||
return Component
|
return Component
|
||||||
|
@ -45,14 +56,3 @@ export async function loadGetInitialProps (Component, ctx) {
|
||||||
|
|
||||||
return props
|
return props
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLocationOrigin () {
|
|
||||||
const { protocol, hostname, port } = window.location
|
|
||||||
return `${protocol}//${hostname}${port ? ':' + port : ''}`
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getURL () {
|
|
||||||
const { href } = window.location
|
|
||||||
const origin = getLocationOrigin()
|
|
||||||
return href.substring(origin.length)
|
|
||||||
}
|
|
1
packages/next-server/link.js
Normal file
1
packages/next-server/link.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./dist/lib/link')
|
1
packages/next-server/next-config.js
Normal file
1
packages/next-server/next-config.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./dist/server/config')
|
45
packages/next-server/package.json
Normal file
45
packages/next-server/package.json
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "next-server",
|
||||||
|
"version": "7.0.1",
|
||||||
|
"main": "./dist/server/next-server.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "taskr",
|
||||||
|
"release": "taskr release",
|
||||||
|
"prepublish": "npm run release"
|
||||||
|
},
|
||||||
|
"taskr": {
|
||||||
|
"requires": [
|
||||||
|
"./taskfile-babel.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"find-up": "3.0.0",
|
||||||
|
"http-errors": "1.6.2",
|
||||||
|
"path-to-regexp": "2.1.0",
|
||||||
|
"url": "0.11.0",
|
||||||
|
"ansi-html": "0.0.7",
|
||||||
|
"prop-types": "15.6.2",
|
||||||
|
"send": "0.16.1",
|
||||||
|
"styled-jsx": "3.1.0",
|
||||||
|
"etag": "1.8.1",
|
||||||
|
"fresh": "0.5.2",
|
||||||
|
"htmlescape": "1.1.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.0.0",
|
||||||
|
"react-dom": "^16.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "7.1.2",
|
||||||
|
"@babel/plugin-proposal-class-properties": "7.1.0",
|
||||||
|
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
|
||||||
|
"@babel/plugin-syntax-dynamic-import": "7.0.0",
|
||||||
|
"@babel/plugin-transform-runtime": "7.1.0",
|
||||||
|
"@babel/preset-env": "7.1.0",
|
||||||
|
"@babel/preset-react": "7.0.0",
|
||||||
|
"@babel/runtime": "7.1.2",
|
||||||
|
"@babel/runtime-corejs2": "7.1.2",
|
||||||
|
"@taskr/clear": "1.1.0",
|
||||||
|
"@taskr/watch": "1.1.0"
|
||||||
|
}
|
||||||
|
}
|
1
packages/next-server/router.js
Normal file
1
packages/next-server/router.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./dist/lib/router')
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import findUp from 'find-up'
|
import findUp from 'find-up'
|
||||||
import {CONFIG_FILE} from '../lib/constants'
|
import {CONFIG_FILE} from 'next-server/constants'
|
||||||
|
|
||||||
type WebpackConfig = *
|
type WebpackConfig = *
|
||||||
|
|
|
@ -11,8 +11,8 @@ import {
|
||||||
} from './render'
|
} from './render'
|
||||||
import Router, {route} from './router'
|
import Router, {route} from './router'
|
||||||
import { isInternalUrl } from './utils'
|
import { isInternalUrl } from './utils'
|
||||||
import loadConfig from './config'
|
import loadConfig from 'next-server/next-config'
|
||||||
import {PHASE_PRODUCTION_SERVER, BLOCKED_PAGES, BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH, CLIENT_STATIC_FILES_RUNTIME} from '../lib/constants'
|
import {PHASE_PRODUCTION_SERVER, BLOCKED_PAGES, BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH, CLIENT_STATIC_FILES_RUNTIME} from 'next-server/constants'
|
||||||
import * as asset from '../lib/asset'
|
import * as asset from '../lib/asset'
|
||||||
import * as envConfig from '../lib/runtime-config'
|
import * as envConfig from '../lib/runtime-config'
|
||||||
import { isResSent } from '../lib/utils'
|
import { isResSent } from '../lib/utils'
|
|
@ -11,7 +11,7 @@ import Head, { defaultHead } from '../lib/head'
|
||||||
import ErrorDebug from '../lib/error-debug'
|
import ErrorDebug from '../lib/error-debug'
|
||||||
import Loadable from '../lib/loadable'
|
import Loadable from '../lib/loadable'
|
||||||
import LoadableCapture from '../lib/loadable-capture'
|
import LoadableCapture from '../lib/loadable-capture'
|
||||||
import { BUILD_MANIFEST, REACT_LOADABLE_MANIFEST, SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH } from '../lib/constants'
|
import { BUILD_MANIFEST, REACT_LOADABLE_MANIFEST, SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH } from 'next-server/constants'
|
||||||
|
|
||||||
// Based on https://github.com/jamiebuilds/react-loadable/pull/132
|
// Based on https://github.com/jamiebuilds/react-loadable/pull/132
|
||||||
function getDynamicImportBundles (manifest, moduleIds) {
|
function getDynamicImportBundles (manifest, moduleIds) {
|
|
@ -1,5 +1,5 @@
|
||||||
import {join, posix} from 'path'
|
import {join, posix} from 'path'
|
||||||
import {PAGES_MANIFEST, SERVER_DIRECTORY} from '../lib/constants'
|
import {PAGES_MANIFEST, SERVER_DIRECTORY} from 'next-server/constants'
|
||||||
|
|
||||||
export function pageNotFoundError (page) {
|
export function pageNotFoundError (page) {
|
||||||
const err = new Error(`Cannot find module for page: ${page}`)
|
const err = new Error(`Cannot find module for page: ${page}`)
|
14
packages/next-server/server/utils.js
Normal file
14
packages/next-server/server/utils.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
const internalPrefixes = [
|
||||||
|
/^\/_next\//,
|
||||||
|
/^\/static\//
|
||||||
|
]
|
||||||
|
|
||||||
|
export function isInternalUrl (url) {
|
||||||
|
for (const prefix of internalPrefixes) {
|
||||||
|
if (prefix.test(url)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
65
packages/next-server/taskfile-babel.js
Normal file
65
packages/next-server/taskfile-babel.js
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
// taskr babel plugin with Babel 7 support
|
||||||
|
// https://github.com/lukeed/taskr/pull/305
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const transform = require('@babel/core').transform
|
||||||
|
const flatten = require('flatten')
|
||||||
|
|
||||||
|
const BABEL_REGEX = /(^@babel\/)(preset|plugin)-(.*)/i
|
||||||
|
|
||||||
|
function getBabels () {
|
||||||
|
const pkg = require('./package.json')
|
||||||
|
return flatten(
|
||||||
|
['devDependencies', 'dependencies'].map(s => Object.keys(pkg[s] || {}))
|
||||||
|
).filter(s => BABEL_REGEX.test(s))
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function (task) {
|
||||||
|
let cache
|
||||||
|
|
||||||
|
task.plugin('babel', {}, function * (file, opts) {
|
||||||
|
if (opts.preload) {
|
||||||
|
delete opts.preload
|
||||||
|
// get dependencies
|
||||||
|
cache = cache || getBabels()
|
||||||
|
|
||||||
|
// attach any deps to babel's `opts`
|
||||||
|
cache.forEach(dep => {
|
||||||
|
const segs = BABEL_REGEX.exec(dep)
|
||||||
|
const type = `${segs[2]}s`
|
||||||
|
const name = `@babel/${segs[2]}-${segs[3]}`
|
||||||
|
|
||||||
|
opts[type] = opts[type] || []
|
||||||
|
|
||||||
|
// flatten all (advanced entries are arrays)
|
||||||
|
if (flatten(opts[type]).indexOf(name) === -1) {
|
||||||
|
opts[type] = opts[type].concat(name)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// attach file's name
|
||||||
|
opts.filename = file.base
|
||||||
|
|
||||||
|
const output = transform(file.data, opts)
|
||||||
|
|
||||||
|
if (output.map) {
|
||||||
|
const map = `${file.base}.map`
|
||||||
|
|
||||||
|
// append `sourceMappingURL` to original file
|
||||||
|
if (opts.sourceMaps !== 'both') {
|
||||||
|
output.code += Buffer.from(`\n//# sourceMappingURL=${map}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// add sourcemap to `files` array
|
||||||
|
this._.files.push({
|
||||||
|
base: map,
|
||||||
|
dir: file.dir,
|
||||||
|
data: Buffer.from(JSON.stringify(output.map))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// update file's data
|
||||||
|
file.data = Buffer.from(output.code)
|
||||||
|
})
|
||||||
|
}
|
40
packages/next-server/taskfile.js
Normal file
40
packages/next-server/taskfile.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
const notifier = require('node-notifier')
|
||||||
|
|
||||||
|
export async function bin (task, opts) {
|
||||||
|
await task.source(opts.src || 'bin/*').babel().target('dist/bin', {mode: '0755'})
|
||||||
|
notify('Compiled binaries')
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function lib (task, opts) {
|
||||||
|
await task.source(opts.src || 'lib/**/*.js').babel().target('dist/lib')
|
||||||
|
notify('Compiled lib files')
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function server (task, opts) {
|
||||||
|
await task.source(opts.src || 'server/**/*.js').babel().target('dist/server')
|
||||||
|
notify('Compiled server files')
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function build (task) {
|
||||||
|
await task.parallel(['bin', 'server', 'lib'])
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function (task) {
|
||||||
|
await task.start('build')
|
||||||
|
await task.watch('bin/*', 'bin')
|
||||||
|
await task.watch('server/**/*.js', 'server')
|
||||||
|
await task.watch('lib/**/*.js', 'lib')
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function release (task) {
|
||||||
|
await task.clear('dist').start('build')
|
||||||
|
}
|
||||||
|
|
||||||
|
// notification helper
|
||||||
|
function notify (msg) {
|
||||||
|
return notifier.notify({
|
||||||
|
title: '▲ Next',
|
||||||
|
message: msg,
|
||||||
|
icon: false
|
||||||
|
})
|
||||||
|
}
|
|
@ -1 +1 @@
|
||||||
module.exports = require('./dist/lib/asset')
|
module.exports = require('next-server/asset')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { spawn } from 'cross-spawn'
|
import { spawn } from 'cross-spawn'
|
||||||
import pkg from '../../package.json'
|
import pkg from '../../package.json'
|
||||||
import {CONFIG_FILE} from '../lib/constants'
|
import {CONFIG_FILE} from 'next-server/constants'
|
||||||
|
|
||||||
if (pkg.peerDependencies) {
|
if (pkg.peerDependencies) {
|
||||||
Object.keys(pkg.peerDependencies).forEach(dependency => {
|
Object.keys(pkg.peerDependencies).forEach(dependency => {
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { join } from 'path'
|
||||||
import promisify from '../lib/promisify'
|
import promisify from '../lib/promisify'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import loadConfig from '../server/config'
|
import loadConfig from 'next-server/next-config'
|
||||||
import { PHASE_PRODUCTION_BUILD, BUILD_ID_FILE } from '../lib/constants'
|
import { PHASE_PRODUCTION_BUILD, BUILD_ID_FILE } from 'next-server/constants'
|
||||||
import getBaseWebpackConfig from './webpack'
|
import getBaseWebpackConfig from './webpack'
|
||||||
|
|
||||||
const access = promisify(fs.access)
|
const access = promisify(fs.access)
|
||||||
|
|
|
@ -17,7 +17,8 @@ import PagesManifestPlugin from './webpack/plugins/pages-manifest-plugin'
|
||||||
import BuildManifestPlugin from './webpack/plugins/build-manifest-plugin'
|
import BuildManifestPlugin from './webpack/plugins/build-manifest-plugin'
|
||||||
import ChunkNamesPlugin from './webpack/plugins/chunk-names-plugin'
|
import ChunkNamesPlugin from './webpack/plugins/chunk-names-plugin'
|
||||||
import { ReactLoadablePlugin } from './webpack/plugins/react-loadable-plugin'
|
import { ReactLoadablePlugin } from './webpack/plugins/react-loadable-plugin'
|
||||||
import {SERVER_DIRECTORY, NEXT_PROJECT_ROOT, NEXT_PROJECT_ROOT_NODE_MODULES, NEXT_PROJECT_ROOT_DIST, DEFAULT_PAGES_DIR, REACT_LOADABLE_MANIFEST, CLIENT_STATIC_FILES_RUNTIME_WEBPACK, CLIENT_STATIC_FILES_RUNTIME_MAIN} from '../lib/constants'
|
import {SERVER_DIRECTORY, REACT_LOADABLE_MANIFEST, CLIENT_STATIC_FILES_RUNTIME_WEBPACK, CLIENT_STATIC_FILES_RUNTIME_MAIN} from 'next-server/constants'
|
||||||
|
import {NEXT_PROJECT_ROOT, NEXT_PROJECT_ROOT_NODE_MODULES, NEXT_PROJECT_ROOT_DIST, DEFAULT_PAGES_DIR} from '../lib/constants'
|
||||||
import AutoDllPlugin from 'autodll-webpack-plugin'
|
import AutoDllPlugin from 'autodll-webpack-plugin'
|
||||||
import TerserPlugin from 'terser-webpack-plugin'
|
import TerserPlugin from 'terser-webpack-plugin'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { RawSource } from 'webpack-sources'
|
import { RawSource } from 'webpack-sources'
|
||||||
import {BUILD_MANIFEST, ROUTE_NAME_REGEX, IS_BUNDLED_PAGE_REGEX, CLIENT_STATIC_FILES_RUNTIME_MAIN} from '../../../lib/constants'
|
import {BUILD_MANIFEST, ROUTE_NAME_REGEX, IS_BUNDLED_PAGE_REGEX, CLIENT_STATIC_FILES_RUNTIME_MAIN} from 'next-server/constants'
|
||||||
|
|
||||||
// This plugin creates a build-manifest.json for all assets that are being output
|
// This plugin creates a build-manifest.json for all assets that are being output
|
||||||
// It has a mapping of "entry" filename to real filename. Because the real filename can be hashed in production
|
// It has a mapping of "entry" filename to real filename. Because the real filename can be hashed in production
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import { RawSource } from 'webpack-sources'
|
import { RawSource } from 'webpack-sources'
|
||||||
import { join, relative, dirname } from 'path'
|
import { join, relative, dirname } from 'path'
|
||||||
import {IS_BUNDLED_PAGE_REGEX} from '../../../lib/constants'
|
import {IS_BUNDLED_PAGE_REGEX} from 'next-server/constants'
|
||||||
|
|
||||||
const SSR_MODULE_CACHE_FILENAME = 'ssr-module-cache.js'
|
const SSR_MODULE_CACHE_FILENAME = 'ssr-module-cache.js'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { RawSource } from 'webpack-sources'
|
import { RawSource } from 'webpack-sources'
|
||||||
import {PAGES_MANIFEST, ROUTE_NAME_REGEX} from '../../../lib/constants'
|
import {PAGES_MANIFEST, ROUTE_NAME_REGEX} from 'next-server/constants'
|
||||||
|
|
||||||
// This plugin creates a pages-manifest.json from page entrypoints.
|
// This plugin creates a pages-manifest.json from page entrypoints.
|
||||||
// This is used for mapping paths like `/` to `.next/server/static/<buildid>/pages/index.js` when doing SSR
|
// This is used for mapping paths like `/` to `.next/server/static/<buildid>/pages/index.js` when doing SSR
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { ConcatSource } from 'webpack-sources'
|
||||||
import {
|
import {
|
||||||
IS_BUNDLED_PAGE_REGEX,
|
IS_BUNDLED_PAGE_REGEX,
|
||||||
ROUTE_NAME_REGEX
|
ROUTE_NAME_REGEX
|
||||||
} from '../../../lib/constants'
|
} from 'next-server/constants'
|
||||||
|
|
||||||
export default class PagesPlugin {
|
export default class PagesPlugin {
|
||||||
apply (compiler: any) {
|
apply (compiler: any) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import promisify from '../../../lib/promisify'
|
import promisify from '../../../lib/promisify'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { IS_BUNDLED_PAGE_REGEX } from '../../../lib/constants'
|
import { IS_BUNDLED_PAGE_REGEX } from 'next-server/constants'
|
||||||
|
|
||||||
const unlink = promisify(fs.unlink)
|
const unlink = promisify(fs.unlink)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import promisify from '../../lib/promisify'
|
import promisify from '../../lib/promisify'
|
||||||
import globModule from 'glob'
|
import globModule from 'glob'
|
||||||
import {CLIENT_STATIC_FILES_PATH} from '../../lib/constants'
|
import {CLIENT_STATIC_FILES_PATH} from 'next-server/constants'
|
||||||
|
|
||||||
const glob = promisify(globModule)
|
const glob = promisify(globModule)
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import HeadManager from './head-manager'
|
import HeadManager from './head-manager'
|
||||||
import { createRouter } from '../lib/router'
|
import { createRouter } from 'next-server/dist/lib/router'
|
||||||
import EventEmitter from '../lib/EventEmitter'
|
import EventEmitter from 'next-server/dist/lib/EventEmitter'
|
||||||
import { loadGetInitialProps, getURL } from '../lib/utils'
|
import {loadGetInitialProps, getURL} from 'next-server/dist/lib/utils'
|
||||||
import PageLoader from '../lib/page-loader'
|
import PageLoader from '../lib/page-loader'
|
||||||
import * as asset from '../lib/asset'
|
import * as asset from 'next-server/asset'
|
||||||
import * as envConfig from '../lib/runtime-config'
|
import * as envConfig from 'next-server/config'
|
||||||
import ErrorBoundary from './error-boundary'
|
import ErrorBoundary from './error-boundary'
|
||||||
import Loadable from '../lib/loadable'
|
import Loadable from 'next-server/dist/lib/loadable'
|
||||||
|
|
||||||
// Polyfill Promise globally
|
// Polyfill Promise globally
|
||||||
// This is needed because Webpack's dynamic loading(common chunks) code
|
// This is needed because Webpack's dynamic loading(common chunks) code
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* global location */
|
/* global location */
|
||||||
|
|
||||||
import Router from '../lib/router'
|
import Router from 'next-server/router'
|
||||||
import fetch from 'unfetch'
|
import fetch from 'unfetch'
|
||||||
|
|
||||||
export default ({assetPrefix}) => {
|
export default ({assetPrefix}) => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'event-source-polyfill'
|
import 'event-source-polyfill'
|
||||||
import connect from './dev-error-overlay/hot-dev-client'
|
import connect from './dev-error-overlay/hot-dev-client'
|
||||||
import Router from '../lib/router'
|
import Router from 'next-server/router'
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
reload (route) {
|
reload (route) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
module.exports = require('./dist/lib/runtime-config')
|
module.exports = require('next-server/config')
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
module.exports = require('./dist/lib/constants')
|
module.exports = require('next-server/constants')
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
module.exports = require('./dist/lib/dynamic')
|
module.exports = require('next-server/dynamic')
|
||||||
|
|
|
@ -3,11 +3,11 @@ import cp from 'recursive-copy'
|
||||||
import mkdirp from 'mkdirp-then'
|
import mkdirp from 'mkdirp-then'
|
||||||
import { extname, resolve, join, dirname, sep } from 'path'
|
import { extname, resolve, join, dirname, sep } from 'path'
|
||||||
import { existsSync, readFileSync, writeFileSync } from 'fs'
|
import { existsSync, readFileSync, writeFileSync } from 'fs'
|
||||||
import loadConfig from '../server/config'
|
import loadConfig from 'next-server/next-config'
|
||||||
import {PHASE_EXPORT, SERVER_DIRECTORY, PAGES_MANIFEST, CONFIG_FILE, BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH} from '../lib/constants'
|
import {PHASE_EXPORT, SERVER_DIRECTORY, PAGES_MANIFEST, CONFIG_FILE, BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH} from 'next-server/constants'
|
||||||
import { renderToHTML } from '../server/render'
|
import { renderToHTML } from 'next-server/dist/server/render'
|
||||||
import { setAssetPrefix } from '../lib/asset'
|
import { setAssetPrefix } from 'next-server/asset'
|
||||||
import * as envConfig from '../lib/runtime-config'
|
import * as envConfig from 'next-server/config'
|
||||||
|
|
||||||
export default async function (dir, options, configuration) {
|
export default async function (dir, options, configuration) {
|
||||||
function log (message) {
|
function log (message) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
module.exports = require('./dist/lib/head')
|
module.exports = require('next-server/head')
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { execOnce, loadGetInitialProps } from './utils'
|
import { execOnce, loadGetInitialProps } from 'next-server/dist/lib/utils'
|
||||||
import { makePublicRouterInstance } from './router'
|
import { makePublicRouterInstance } from 'next-server/router'
|
||||||
|
|
||||||
export default class App extends Component {
|
export default class App extends Component {
|
||||||
static childContextTypes = {
|
static childContextTypes = {
|
||||||
|
|
|
@ -1,31 +1,5 @@
|
||||||
import {join} from 'path'
|
import {join} from 'path'
|
||||||
export const PHASE_EXPORT = 'phase-export'
|
|
||||||
export const PHASE_PRODUCTION_BUILD = 'phase-production-build'
|
|
||||||
export const PHASE_PRODUCTION_SERVER = 'phase-production-server'
|
|
||||||
export const PHASE_DEVELOPMENT_SERVER = 'phase-development-server'
|
|
||||||
export const PAGES_MANIFEST = 'pages-manifest.json'
|
|
||||||
export const BUILD_MANIFEST = 'build-manifest.json'
|
|
||||||
export const REACT_LOADABLE_MANIFEST = 'react-loadable-manifest.json'
|
|
||||||
export const SERVER_DIRECTORY = 'server'
|
|
||||||
export const CONFIG_FILE = 'next.config.js'
|
|
||||||
export const BUILD_ID_FILE = 'BUILD_ID'
|
|
||||||
export const BLOCKED_PAGES = [
|
|
||||||
'/_document',
|
|
||||||
'/_app',
|
|
||||||
'/_error'
|
|
||||||
]
|
|
||||||
// matches static/<buildid>/pages/<page>.js
|
|
||||||
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 NEXT_PROJECT_ROOT = join(__dirname, '..', '..')
|
export const NEXT_PROJECT_ROOT = join(__dirname, '..', '..')
|
||||||
export const NEXT_PROJECT_ROOT_DIST = join(NEXT_PROJECT_ROOT, 'dist')
|
export const NEXT_PROJECT_ROOT_DIST = join(NEXT_PROJECT_ROOT, 'dist')
|
||||||
export const NEXT_PROJECT_ROOT_NODE_MODULES = join(NEXT_PROJECT_ROOT, 'node_modules')
|
export const NEXT_PROJECT_ROOT_NODE_MODULES = join(NEXT_PROJECT_ROOT, 'node_modules')
|
||||||
export const DEFAULT_PAGES_DIR = join(NEXT_PROJECT_ROOT_DIST, 'pages')
|
export const DEFAULT_PAGES_DIR = join(NEXT_PROJECT_ROOT_DIST, 'pages')
|
||||||
export const CLIENT_STATIC_FILES_PATH = 'static'
|
|
||||||
export const CLIENT_STATIC_FILES_RUNTIME = 'runtime'
|
|
||||||
export const CLIENT_STATIC_FILES_RUNTIME_PATH = `${CLIENT_STATIC_FILES_PATH}/${CLIENT_STATIC_FILES_RUNTIME}`
|
|
||||||
// static/runtime/main.js
|
|
||||||
export const CLIENT_STATIC_FILES_RUNTIME_MAIN = `${CLIENT_STATIC_FILES_RUNTIME_PATH}/main.js`
|
|
||||||
// static/runtime/webpack.js
|
|
||||||
export const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `${CLIENT_STATIC_FILES_RUNTIME_PATH}/webpack.js`
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import HTTPStatus from 'http-status'
|
import HTTPStatus from 'http-status'
|
||||||
import Head from './head'
|
import Head from 'next-server/head'
|
||||||
|
|
||||||
export default class Error extends React.Component {
|
export default class Error extends React.Component {
|
||||||
static getInitialProps ({ res, err }) {
|
static getInitialProps ({ res, err }) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* global window, document */
|
/* global window, document */
|
||||||
import EventEmitter from './EventEmitter'
|
import EventEmitter from 'next-server/dist/lib/EventEmitter'
|
||||||
|
|
||||||
const webpackModule = module
|
const webpackModule = module
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
module.exports = require('./dist/lib/link')
|
module.exports = require('next-server/link')
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"next-server": "7.0.1",
|
||||||
"@babel/core": "7.1.2",
|
"@babel/core": "7.1.2",
|
||||||
"@babel/plugin-proposal-class-properties": "7.1.0",
|
"@babel/plugin-proposal-class-properties": "7.1.0",
|
||||||
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
|
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
module.exports = require('./dist/lib/router')
|
module.exports = require('next-server/router')
|
||||||
|
|
|
@ -6,14 +6,31 @@ import del from 'del'
|
||||||
import onDemandEntryHandler, {normalizePage} from './on-demand-entry-handler'
|
import onDemandEntryHandler, {normalizePage} from './on-demand-entry-handler'
|
||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import getBaseWebpackConfig from '../build/webpack'
|
import getBaseWebpackConfig from '../build/webpack'
|
||||||
import {
|
import {IS_BUNDLED_PAGE_REGEX, ROUTE_NAME_REGEX, BLOCKED_PAGES, CLIENT_STATIC_FILES_PATH} from 'next-server/constants'
|
||||||
addCorsSupport
|
import {route} from 'next-server/dist/server/router'
|
||||||
} from './utils'
|
import {renderScriptError} from 'next-server/dist/server/render'
|
||||||
import {IS_BUNDLED_PAGE_REGEX, ROUTE_NAME_REGEX, BLOCKED_PAGES, CLIENT_STATIC_FILES_PATH} from '../lib/constants'
|
|
||||||
import pathMatch from './lib/path-match'
|
function addCorsSupport (req, res) {
|
||||||
import {renderScriptError} from './render'
|
if (!req.headers.origin) {
|
||||||
|
return { preflight: false }
|
||||||
|
}
|
||||||
|
|
||||||
|
res.setHeader('Access-Control-Allow-Origin', req.headers.origin)
|
||||||
|
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET')
|
||||||
|
// Based on https://github.com/primus/access-control/blob/4cf1bc0e54b086c91e6aa44fb14966fa5ef7549c/index.js#L158
|
||||||
|
if (req.headers['access-control-request-headers']) {
|
||||||
|
res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers'])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.method === 'OPTIONS') {
|
||||||
|
res.writeHead(200)
|
||||||
|
res.end()
|
||||||
|
return { preflight: true }
|
||||||
|
}
|
||||||
|
|
||||||
|
return { preflight: false }
|
||||||
|
}
|
||||||
|
|
||||||
const route = pathMatch()
|
|
||||||
const matchNextPageBundleRequest = route('/_next/static/:buildId/pages/:path*.js(.map)?')
|
const matchNextPageBundleRequest = route('/_next/static/:buildId/pages/:path*.js(.map)?')
|
||||||
|
|
||||||
// Recursively look up the issuer till it ends up at the root
|
// Recursively look up the issuer till it ends up at the root
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import Server from './next-server'
|
import Server from 'next-server'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import HotReloader from './hot-reloader'
|
import HotReloader from './hot-reloader'
|
||||||
import {route} from './router'
|
import {route} from 'next-server/dist/server/router'
|
||||||
import {PHASE_DEVELOPMENT_SERVER} from '../lib/constants'
|
import {PHASE_DEVELOPMENT_SERVER} from 'next-server/constants'
|
||||||
|
|
||||||
export default class DevServer extends Server {
|
export default class DevServer extends Server {
|
||||||
constructor (options) {
|
constructor (options) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file is used for when users run `require('next')`
|
// This file is used for when users run `require('next')`
|
||||||
module.exports = (opts) => {
|
module.exports = (opts) => {
|
||||||
const Server = opts.dev ? require('./next-dev-server').default : require('./next-server').default
|
const Server = opts.dev ? require('./next-dev-server').default : require('next-server').default
|
||||||
return new Server(opts)
|
return new Server(opts)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import { parse } from 'url'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import promisify from '../lib/promisify'
|
import promisify from '../lib/promisify'
|
||||||
import globModule from 'glob'
|
import globModule from 'glob'
|
||||||
import {normalizePagePath, pageNotFoundError} from './require'
|
import {normalizePagePath, pageNotFoundError} from 'next-server/dist/server/require'
|
||||||
import {createEntry} from '../build/webpack/utils'
|
import {createEntry} from '../build/webpack/utils'
|
||||||
import { ROUTE_NAME_REGEX, IS_BUNDLED_PAGE_REGEX } from '../lib/constants'
|
import { ROUTE_NAME_REGEX, IS_BUNDLED_PAGE_REGEX } from 'next-server/constants'
|
||||||
|
|
||||||
const ADDED = Symbol('added')
|
const ADDED = Symbol('added')
|
||||||
const BUILDING = Symbol('building')
|
const BUILDING = Symbol('building')
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
const internalPrefixes = [
|
|
||||||
/^\/_next\//,
|
|
||||||
/^\/static\//
|
|
||||||
]
|
|
||||||
|
|
||||||
export function isInternalUrl (url) {
|
|
||||||
for (const prefix of internalPrefixes) {
|
|
||||||
if (prefix.test(url)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
export function addCorsSupport (req, res) {
|
|
||||||
if (!req.headers.origin) {
|
|
||||||
return { preflight: false }
|
|
||||||
}
|
|
||||||
|
|
||||||
res.setHeader('Access-Control-Allow-Origin', req.headers.origin)
|
|
||||||
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET')
|
|
||||||
// Based on https://github.com/primus/access-control/blob/4cf1bc0e54b086c91e6aa44fb14966fa5ef7549c/index.js#L158
|
|
||||||
if (req.headers['access-control-request-headers']) {
|
|
||||||
res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers'])
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.method === 'OPTIONS') {
|
|
||||||
res.writeHead(200)
|
|
||||||
res.end()
|
|
||||||
return { preflight: true }
|
|
||||||
}
|
|
||||||
|
|
||||||
return { preflight: false }
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* global describe, test, it, expect */
|
/* global describe, test, it, expect */
|
||||||
|
|
||||||
import cheerio from 'cheerio'
|
import cheerio from 'cheerio'
|
||||||
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next/constants'
|
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next-server/constants'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
export default function ({ app }, suiteName, render, fetch, appPort) {
|
export default function ({ app }, suiteName, render, fetch, appPort) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { existsSync } from 'fs'
|
import { existsSync } from 'fs'
|
||||||
import {BUILD_ID_FILE} from 'next/constants'
|
import {BUILD_ID_FILE} from 'next-server/constants'
|
||||||
import {
|
import {
|
||||||
nextServer,
|
nextServer,
|
||||||
nextBuild,
|
nextBuild,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const {PHASE_DEVELOPMENT_SERVER} = require('next/constants')
|
const {PHASE_DEVELOPMENT_SERVER} = require('next-server/constants')
|
||||||
|
|
||||||
module.exports = (phase) => {
|
module.exports = (phase) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import fetch from 'node-fetch'
|
||||||
import dynamicImportTests from './dynamic'
|
import dynamicImportTests from './dynamic'
|
||||||
import processEnv from './process-env'
|
import processEnv from './process-env'
|
||||||
import security from './security'
|
import security from './security'
|
||||||
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next/constants'
|
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next-server/constants'
|
||||||
|
|
||||||
const appDir = join(__dirname, '../')
|
const appDir = join(__dirname, '../')
|
||||||
let appPort
|
let appPort
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* global describe, it, expect */
|
/* global describe, it, expect */
|
||||||
|
|
||||||
import {join} from 'path'
|
import {join} from 'path'
|
||||||
import loadConfig from 'next/dist/server/config'
|
import loadConfig from 'next-server/next-config'
|
||||||
import {PHASE_DEVELOPMENT_SERVER} from 'next/constants'
|
import {PHASE_DEVELOPMENT_SERVER} from 'next-server/constants'
|
||||||
|
|
||||||
const pathToConfig = join(__dirname, '_resolvedata', 'without-function')
|
const pathToConfig = join(__dirname, '_resolvedata', 'without-function')
|
||||||
const pathToConfigFn = join(__dirname, '_resolvedata', 'with-function')
|
const pathToConfigFn = join(__dirname, '_resolvedata', 'with-function')
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* global describe, it, expect */
|
/* global describe, it, expect */
|
||||||
|
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import {SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH} from 'next/constants'
|
import {SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH} from 'next-server/constants'
|
||||||
import requirePage, {getPagePath, normalizePagePath, pageNotFoundError} from 'next/dist/server/require'
|
import requirePage, {getPagePath, normalizePagePath, pageNotFoundError} from 'next-server/dist/server/require'
|
||||||
|
|
||||||
const sep = '/'
|
const sep = '/'
|
||||||
const distDir = join(__dirname, '_resolvedata')
|
const distDir = join(__dirname, '_resolvedata')
|
||||||
|
|
1
test/node_modules/next
generated
vendored
1
test/node_modules/next
generated
vendored
|
@ -1 +0,0 @@
|
||||||
../../packages/next
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* global describe, it, expect */
|
/* global describe, it, expect */
|
||||||
import EventEmitter from 'next/dist/lib/EventEmitter'
|
import EventEmitter from 'next-server/dist/lib/EventEmitter'
|
||||||
|
|
||||||
describe('EventEmitter', () => {
|
describe('EventEmitter', () => {
|
||||||
describe('With listeners', () => {
|
describe('With listeners', () => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* global describe, it, expect */
|
/* global describe, it, expect */
|
||||||
import { Component } from 'react'
|
import { Component } from 'react'
|
||||||
import { getDisplayName } from 'next/dist/lib/utils'
|
import { getDisplayName } from 'next-server/dist/lib/utils'
|
||||||
|
|
||||||
describe('getDisplayName', () => {
|
describe('getDisplayName', () => {
|
||||||
it('gets the proper display name of a component', () => {
|
it('gets the proper display name of a component', () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* global describe, it, expect */
|
/* global describe, it, expect */
|
||||||
import { loadGetInitialProps } from 'next/dist/lib/utils'
|
import { loadGetInitialProps } from 'next-server/dist/lib/utils'
|
||||||
|
|
||||||
describe('loadGetInitialProps', () => {
|
describe('loadGetInitialProps', () => {
|
||||||
it('should throw if getInitialProps is defined as an instance method', () => {
|
it('should throw if getInitialProps is defined as an instance method', () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* global describe, it, expect */
|
/* global describe, it, expect */
|
||||||
import Router from 'next/dist/lib/router/router'
|
import Router from 'next-server/dist/lib/router/router'
|
||||||
|
|
||||||
class PageLoader {
|
class PageLoader {
|
||||||
constructor (options = {}) {
|
constructor (options = {}) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* global describe, it, expect */
|
/* global describe, it, expect */
|
||||||
|
|
||||||
import shallowEquals from 'next/dist/lib/shallow-equals'
|
import shallowEquals from 'next-server/dist/lib/shallow-equals'
|
||||||
|
|
||||||
describe('Shallow Equals', () => {
|
describe('Shallow Equals', () => {
|
||||||
it('should be true if both objects are the same', () => {
|
it('should be true if both objects are the same', () => {
|
||||||
|
|
Loading…
Reference in a new issue