Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 53f6e8d

Browse files
authored
Move next-server directory files to server directory (vercel#26756)
* Move next-server directory files to server directory * Update tests * Update paths in other places
1 parent f7413f9 commit 53f6e8d

File tree

89 files changed

+199
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+199
-235
lines changed

docs/api-reference/next.config.js/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = (phase, { defaultConfig }) => {
2626
}
2727
```
2828

29-
`phase` is the current context in which the configuration is loaded. You can see the [available phases](https://github.com/vercel/next.js/blob/canary/packages/next/next-server/lib/constants.ts#L1-L4). Phases can be imported from `next/constants`:
29+
`phase` is the current context in which the configuration is loaded. You can see the [available phases](https://github.com/vercel/next.js/blob/canary/packages/next/shared/lib/constants.ts#L1-L4). Phases can be imported from `next/constants`:
3030

3131
```js
3232
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
@@ -44,7 +44,7 @@ module.exports = (phase, { defaultConfig }) => {
4444
}
4545
```
4646

47-
The commented lines are the place where you can put the configs allowed by `next.config.js`, which are [defined in this file](https://github.com/vercel/next.js/blob/canary/packages/next/next-server/server/config-shared.ts#L68).
47+
The commented lines are the place where you can put the configs allowed by `next.config.js`, which are [defined in this file](https://github.com/vercel/next.js/blob/canary/packages/next/server/config-shared.ts#L68).
4848

4949
However, none of the configs are required, and it's not necessary to understand what each config does. Instead, search for the features you need to enable or modify in this section and they will show you what to do.
5050

docs/basic-features/typescript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ The `next.config.js` file must be a JavaScript file as it does not get parsed by
152152
// @ts-check
153153

154154
/**
155-
* @type {import('next/dist/next-server/server/config').NextConfig}
155+
* @type {import('next').NextConfig}
156156
**/
157157
const nextConfig = {
158158
/* config options here */

packages/next-plugin-storybook/preset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { PHASE_PRODUCTION_BUILD } = require('next/constants')
22
const { findPagesDir } = require('next/dist/lib/find-pages-dir')
3-
const loadConfig = require('next/dist/next-server/server/config').default
3+
const loadConfig = require('next/dist/server/config').default
44
const getWebpackConfig = require('next/dist/build/webpack-config').default
55

66
const CWD = process.cwd()

packages/next/build/entries.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import chalk from 'chalk'
22
import { posix, join } from 'path'
33
import { stringify } from 'querystring'
44
import { API_ROUTE, DOT_NEXT_ALIAS, PAGES_DIR_ALIAS } from '../lib/constants'
5-
import { __ApiPreviewProps } from '../next-server/server/api-utils'
6-
import { isTargetLikeServerless } from '../next-server/server/config'
7-
import { normalizePagePath } from '../next-server/server/normalize-page-path'
5+
import { __ApiPreviewProps } from '../server/api-utils'
6+
import { isTargetLikeServerless } from '../server/config'
7+
import { normalizePagePath } from '../server/normalize-page-path'
88
import { warn } from './output/log'
99
import { ClientPagesLoaderOptions } from './webpack/loaders/next-client-pages-loader'
1010
import { ServerlessLoaderQuery } from './webpack/loaders/next-serverless-loader'
1111
import { LoadedEnvFiles } from '@next/env'
12-
import { NextConfig } from '../next-server/server/config'
12+
import { NextConfig } from '../server/config'
1313

1414
type PagesMapping = {
1515
[page: string]: string

packages/next/build/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ import {
5151
getSortedRoutes,
5252
isDynamicRoute,
5353
} from '../shared/lib/router/utils'
54-
import { __ApiPreviewProps } from '../next-server/server/api-utils'
54+
import { __ApiPreviewProps } from '../server/api-utils'
5555
import loadConfig, {
5656
isTargetLikeServerless,
5757
NextConfig,
58-
} from '../next-server/server/config'
59-
import { BuildManifest } from '../next-server/server/get-page-files'
60-
import '../next-server/server/node-polyfill-fetch'
61-
import { normalizePagePath } from '../next-server/server/normalize-page-path'
62-
import { getPagePath } from '../next-server/server/require'
58+
} from '../server/config'
59+
import { BuildManifest } from '../server/get-page-files'
60+
import '../server/node-polyfill-fetch'
61+
import { normalizePagePath } from '../server/normalize-page-path'
62+
import { getPagePath } from '../server/require'
6363
import * as ciEnvironment from '../telemetry/ci-info'
6464
import {
6565
eventBuildCompleted,

packages/next/build/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '../next-server/server/node-polyfill-fetch'
1+
import '../server/node-polyfill-fetch'
22
import chalk from 'chalk'
33
import getGzipSize from 'next/dist/compiled/gzip-size'
44
import textTable from 'next/dist/compiled/text-table'
@@ -24,13 +24,13 @@ import { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'
2424
import escapePathDelimiters from '../shared/lib/router/utils/escape-path-delimiters'
2525
import { findPageFile } from '../server/lib/find-page-file'
2626
import { GetStaticPaths } from 'next/types'
27-
import { denormalizePagePath } from '../next-server/server/normalize-page-path'
28-
import { BuildManifest } from '../next-server/server/get-page-files'
27+
import { denormalizePagePath } from '../server/normalize-page-path'
28+
import { BuildManifest } from '../server/get-page-files'
2929
import { removePathTrailingSlash } from '../client/normalize-trailing-slash'
3030
import { UnwrapPromise } from '../lib/coalesced-function'
3131
import { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'
3232
import * as Log from './output/log'
33-
import { loadComponents } from '../next-server/server/load-components'
33+
import { loadComponents } from '../server/load-components'
3434
import { trace } from '../telemetry/trace'
3535

3636
const fileGzipStats: { [k: string]: Promise<number> | undefined } = {}

packages/next/build/webpack-config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
SERVER_DIRECTORY,
2828
} from '../shared/lib/constants'
2929
import { execOnce } from '../shared/lib/utils'
30-
import { NextConfig } from '../next-server/server/config'
30+
import { NextConfig } from '../server/config'
3131
import { findPageFile } from '../server/lib/find-page-file'
3232
import { WebpackEntrypoints } from './entries'
3333
import * as Log from './output/log'
@@ -709,10 +709,10 @@ export default async function getBaseWebpackConfig(
709709
}
710710

711711
if (isLocal) {
712-
// Makes sure dist/shared and dist/next-server are not bundled
712+
// Makes sure dist/shared and dist/server are not bundled
713713
// we need to process shared/lib/router/router so that
714714
// the DefinePlugin can inject process.env values
715-
const isNextExternal = /next[/\\]dist[/\\](shared|next-server)[/\\](?!lib[/\\]router[/\\]router)/.test(
715+
const isNextExternal = /next[/\\]dist[/\\](shared|server)[/\\](?!lib[/\\]router[/\\]router)/.test(
716716
res
717717
)
718718

packages/next/build/webpack/config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { webpack } from 'next/dist/compiled/webpack/webpack'
2-
import { NextConfig } from '../../../next-server/server/config'
2+
import { NextConfig } from '../../../server/config'
33
import { base } from './blocks/base'
44
import { css } from './blocks/css'
55
import { ConfigurationContext, pipe } from './utils'

packages/next/build/webpack/config/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { webpack } from 'next/dist/compiled/webpack/webpack'
2-
import { NextConfig } from '../../../next-server/server/config'
2+
import { NextConfig } from '../../../server/config'
33

44
export type ConfigurationContext = {
55
rootDirectory: string

packages/next/build/webpack/loaders/next-image-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import loaderUtils from 'next/dist/compiled/loader-utils'
22
import sizeOf from 'image-size'
3-
import { processBuffer } from '../../../next-server/server/lib/squoosh/main'
3+
import { processBuffer } from '../../../server/lib/squoosh/main'
44

55
const BLUR_IMG_SIZE = 8
66
const BLUR_QUALITY = 70

0 commit comments

Comments
 (0)