From b4ade0a3cdec4513f4b03732723683fecda172a4 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Sat, 26 Jan 2019 02:01:16 +0100 Subject: [PATCH] Revert "Move phases back to next/constants (#6104)" This reverts commit 9112f63ebaa3a79e1506e105f4232d177343d2ca. --- packages/next-server/lib/constants.js | 4 ++++ packages/next-server/server/next-server.ts | 4 ++-- packages/next/build/babel/plugins/next-to-next-server.ts | 3 +++ packages/next/build/index.ts | 2 +- packages/next/export/index.js | 3 +-- packages/next/lib/constants.js | 5 ----- packages/next/server/next-dev-server.js | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/next-server/lib/constants.js b/packages/next-server/lib/constants.js index 7644dd76..a4c5c7e2 100644 --- a/packages/next-server/lib/constants.js +++ b/packages/next-server/lib/constants.js @@ -1,3 +1,7 @@ +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' diff --git a/packages/next-server/server/next-server.ts b/packages/next-server/server/next-server.ts index d42aaf1a..2953ff32 100644 --- a/packages/next-server/server/next-server.ts +++ b/packages/next-server/server/next-server.ts @@ -10,7 +10,7 @@ import {serveStatic} from './serve-static' import Router, {route, Route} from './router' import { isInternalUrl, isBlockedPage } from './utils' import loadConfig from 'next-server/next-config' -import {BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH, CLIENT_STATIC_FILES_RUNTIME} from 'next-server/constants' +import {PHASE_PRODUCTION_SERVER, BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH, CLIENT_STATIC_FILES_RUNTIME} from 'next-server/constants' import * as envConfig from '../lib/runtime-config' import {loadComponents} from './load-components' @@ -74,7 +74,7 @@ export default class Server { } private currentPhase(): string { - return 'phase-production-server' + return PHASE_PRODUCTION_SERVER } private logError(...args: any): void { diff --git a/packages/next/build/babel/plugins/next-to-next-server.ts b/packages/next/build/babel/plugins/next-to-next-server.ts index e01faef7..d2583856 100644 --- a/packages/next/build/babel/plugins/next-to-next-server.ts +++ b/packages/next/build/babel/plugins/next-to-next-server.ts @@ -10,6 +10,9 @@ export default function NextToNextServer (): PluginObj { if (source === 'next/dynamic') { path.node.source.value = 'next-server/dynamic' } + if (source === 'next/constants') { + path.node.source.value = 'next-server/constants' + } if (source === 'next/config') { path.node.source.value = 'next-server/config' } diff --git a/packages/next/build/index.ts b/packages/next/build/index.ts index 018f8a05..136dac85 100644 --- a/packages/next/build/index.ts +++ b/packages/next/build/index.ts @@ -1,7 +1,7 @@ import { join } from 'path' import nanoid from 'nanoid' import loadConfig from 'next-server/next-config' -import { PHASE_PRODUCTION_BUILD } from '../lib/constants' +import { PHASE_PRODUCTION_BUILD } from 'next-server/constants' import getBaseWebpackConfig from './webpack-config' import {generateBuildId} from './generate-build-id' import {writeBuildId} from './write-build-id' diff --git a/packages/next/export/index.js b/packages/next/export/index.js index 8ed1d2dd..abcb0024 100644 --- a/packages/next/export/index.js +++ b/packages/next/export/index.js @@ -6,8 +6,7 @@ import mkdirp from 'mkdirp-then' import { resolve, join } from 'path' import { existsSync, readFileSync } from 'fs' import loadConfig from 'next-server/next-config' -import { PHASE_EXPORT } from '../lib/constants' -import { SERVER_DIRECTORY, PAGES_MANIFEST, CONFIG_FILE, BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH } from 'next-server/constants' +import { PHASE_EXPORT, SERVER_DIRECTORY, PAGES_MANIFEST, CONFIG_FILE, BUILD_ID_FILE, CLIENT_STATIC_FILES_PATH } from 'next-server/constants' import * as envConfig from 'next-server/config' import createProgress from 'tty-aware-progress' diff --git a/packages/next/lib/constants.js b/packages/next/lib/constants.js index 1296f7f9..14f074da 100644 --- a/packages/next/lib/constants.js +++ b/packages/next/lib/constants.js @@ -10,8 +10,3 @@ export const NEXT_PROJECT_ROOT_DIST_SERVER = join(NEXT_PROJECT_ROOT_DIST, 'serve // we have to use a private alias export const PAGES_DIR_ALIAS = 'private-next-pages' export const DOT_NEXT_ALIAS = 'private-dot-next' - -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' diff --git a/packages/next/server/next-dev-server.js b/packages/next/server/next-dev-server.js index 011488d9..8a4b630a 100644 --- a/packages/next/server/next-dev-server.js +++ b/packages/next/server/next-dev-server.js @@ -2,7 +2,7 @@ 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' -import {PHASE_DEVELOPMENT_SERVER} from '../lib/constants' +import {PHASE_DEVELOPMENT_SERVER} from 'next-server/constants' import ErrorDebug from './error-debug' export default class DevServer extends Server {