Skip to content

Commit

Permalink
Merge branch 'canary' into refactor-remove-next-font
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Sep 12, 2023
2 parents 6b7e606 + e6ec464 commit 8805e78
Show file tree
Hide file tree
Showing 58 changed files with 410 additions and 206 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Next.js includes a [short list of popular packages](https://github.com/vercel/ne
- `firebase-admin`
- `jest`
- `jsdom`
- `libsql`
- `lodash`
- `mdx-bundler`
- `mongodb`
Expand Down
27 changes: 27 additions & 0 deletions errors/reserved-port.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Reserved Port
---

## Why This Error Occurred

Server was started on a reserved port. For example, `4045` is reserved for the Network Paging Protocol (npp).

```
next start -p 4045
```

or

```
next dev --port 4045
```

Starting the server on a reserved port will result in an error.

## Possible Ways to Fix It

Change the provided port to ensure it's not listed in the [Port Blocking](https://fetch.spec.whatwg.org/#port-blocking) section of WHATWG's fetch spec.

## Useful Links

- https://fetch.spec.whatwg.org/#port-blocking
2 changes: 1 addition & 1 deletion examples/cms-buttercms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"next": "^12.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sharp": "^0.29.3",
"sharp": "^0.32.5",
"tiny-slider": "^2.9.4",
"typescript": "^3.3.1"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/cms-prepr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"dependencies": {
"classnames": "2.3.1",
"date-fns": "2.28.0",
"date-fns": "2.30.0",
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "13.4.20-canary.24"
"version": "13.4.20-canary.26"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
"dependencies": {
"@next/eslint-plugin-next": "13.4.20-canary.24",
"@next/eslint-plugin-next": "13.4.20-canary.26",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0",
"eslint-import-resolver-node": "^0.3.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"description": "ESLint plugin for NextJS.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async function runOperation(renderData: RenderData) {
const query = parse(renderData.rawQuery)
const renderOpt: Omit<
RenderOpts,
'App' | 'Document' | 'Component' | 'pathname'
'App' | 'Document' | 'Component' | 'page'
> & {
params: ParsedUrlQuery
} = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const MIME_TEXT_HTML_UTF8 = 'text/html; charset=utf-8'
async function render(request: NextRequest, event: NextFetchEvent) {
const renderOpt: Omit<
RenderOpts,
'App' | 'Document' | 'Component' | 'pathname'
'App' | 'Document' | 'Component' | 'page'
> & { params: ParsedUrlQuery } = {
// TODO(WEB-1195) params
params: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default function startHandler({
default: comp,
...namespace,
},
pathname: renderData.path,
page: renderData.path,
buildId: 'development',

/* RenderOptsPartial */
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-core/src/next_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub struct NextConfig {
pub transpile_packages: Option<Vec<String>>,
pub modularize_imports: Option<IndexMap<String, ModularizeImportPackageConfig>>,
sass_options: Option<serde_json::Value>,
trailing_slash: bool,

// Partially supported
pub compiler: Option<CompilerConfig>,
Expand Down Expand Up @@ -119,7 +120,6 @@ pub struct NextConfig {
static_page_generation_timeout: f64,
swc_minify: Option<bool>,
target: Option<String>,
trailing_slash: bool,
typescript: TypeScriptConfig,
use_file_system_public_routes: bool,
webpack: Option<serde_json::Value>,
Expand Down Expand Up @@ -413,7 +413,7 @@ pub struct ExperimentalConfig {
pub swc_plugins: Option<Vec<(String, serde_json::Value)>>,

// unsupported
adjust_font_fallbacks: Option<bool>,
optimize_package_imports: Option<Vec<String>>,
adjust_font_fallbacks_with_size_adjust: Option<bool>,
allow_middleware_response_body: Option<bool>,
amp: Option<serde_json::Value>,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "13.4.20-canary.24",
"version": "13.4.20-canary.26",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -90,7 +90,7 @@
]
},
"dependencies": {
"@next/env": "13.4.20-canary.24",
"@next/env": "13.4.20-canary.26",
"@swc/helpers": "0.5.1",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
Expand Down Expand Up @@ -145,11 +145,11 @@
"@mswjs/interceptors": "0.23.0",
"@napi-rs/cli": "2.16.2",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.4.20-canary.24",
"@next/polyfill-nomodule": "13.4.20-canary.24",
"@next/react-dev-overlay": "13.4.20-canary.24",
"@next/react-refresh-utils": "13.4.20-canary.24",
"@next/swc": "13.4.20-canary.24",
"@next/polyfill-module": "13.4.20-canary.26",
"@next/polyfill-nomodule": "13.4.20-canary.26",
"@next/react-dev-overlay": "13.4.20-canary.26",
"@next/react-refresh-utils": "13.4.20-canary.26",
"@next/swc": "13.4.20-canary.26",
"@opentelemetry/api": "1.4.1",
"@playwright/test": "^1.35.1",
"@segment/ajv-human-errors": "2.1.2",
Expand Down
20 changes: 19 additions & 1 deletion packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,10 @@ export default async function build(
distDir,
'cache/next-server.js.nft.json'
)
const minimalCachedTracePath = path.join(
distDir,
'cache/next-minimal-server.js.nft.json'
)

if (
lockFiles.length > 0 &&
Expand Down Expand Up @@ -2072,9 +2076,19 @@ export default async function build(
const existingTrace = JSON.parse(
await fs.readFile(cachedTracePath, 'utf8')
)
const existingMinimalTrace = JSON.parse(
await fs.readFile(minimalCachedTracePath, 'utf8')
)

if (existingTrace.cacheKey === cacheKey) {
if (
existingTrace.cacheKey === cacheKey &&
existingMinimalTrace.cacheKey === cacheKey
) {
await fs.copyFile(cachedTracePath, nextServerTraceOutput)
await fs.copyFile(
minimalCachedTracePath,
nextMinimalTraceOutput
)
return
}
} catch {}
Expand Down Expand Up @@ -2301,9 +2315,13 @@ export default async function build(
])

await fs.unlink(cachedTracePath).catch(() => {})
await fs.unlink(minimalCachedTracePath).catch(() => {})
await fs
.copyFile(nextServerTraceOutput, cachedTracePath)
.catch(() => {})
await fs
.copyFile(nextMinimalTraceOutput, minimalCachedTracePath)
.catch(() => {})
})
}

Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ export async function isPageStatic({
} else {
componentsResult = await loadComponents({
distDir,
pathname: originalAppPath || page,
page: originalAppPath || page,
isAppPath: pageType === 'app',
})
}
Expand Down Expand Up @@ -1701,7 +1701,7 @@ export async function hasCustomGetInitialProps(

const components = await loadComponents({
distDir,
pathname: page,
page: page,
isAppPath: false,
})
let mod = components.ComponentMod
Expand All @@ -1725,7 +1725,7 @@ export async function getDefinedNamedExports(
)
const components = await loadComponents({
distDir,
pathname: page,
page: page,
isAppPath: false,
})

Expand Down
13 changes: 5 additions & 8 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ export default async function getBaseWebpackConfig(
* This is used to ensure that files used across the rendering runtime(s) and the user code are one and the same. The logic in this function
* will rewrite the require to the correct bundle location depending on the layer at which the file is being used.
*/
const isLocalCallback = (localRes: string) => {
const resolveNextExternal = (localRes: string) => {
const isSharedRuntime = sharedRuntimePattern.test(localRes)
const isExternal = externalPattern.test(localRes)

Expand Down Expand Up @@ -1514,8 +1514,7 @@ export default async function getBaseWebpackConfig(
return `module ${request}`
}

// Other Next.js internals need to be transpiled.
return
return resolveNextExternal(request)
}

// Early return if the request needs to be bundled, such as in the client layer.
Expand All @@ -1535,9 +1534,7 @@ export default async function getBaseWebpackConfig(
const fullRequest = isRelative
? path.join(context, request).replace(/\\/g, '/')
: request
const resolveNextExternal = isLocalCallback(fullRequest)

return resolveNextExternal
return resolveNextExternal(fullRequest)
}

// TODO-APP: Let's avoid this resolve call as much as possible, and eventually get rid of it.
Expand All @@ -1549,7 +1546,7 @@ export default async function getBaseWebpackConfig(
isEsmRequested,
hasAppDir,
getResolve,
isLocal ? isLocalCallback : undefined
isLocal ? resolveNextExternal : undefined
)

if ('localRes' in resolveResult) {
Expand Down Expand Up @@ -1610,7 +1607,7 @@ export default async function getBaseWebpackConfig(
hasAppDir,
isEsmRequested,
getResolve,
isLocal ? isLocalCallback : undefined
isLocal ? resolveNextExternal : undefined
)
if (pkgRes.res) {
resolvedExternalPackageDirs.set(pkg, path.dirname(pkgRes.res))
Expand Down
Loading

0 comments on commit 8805e78

Please sign in to comment.