Skip to content

Commit

Permalink
Merge branch '14-2-1' into ijjk/backport-third-parties-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Nov 13, 2024
2 parents dbc1d64 + 91cbf9d commit f133aac
Show file tree
Hide file tree
Showing 59 changed files with 277 additions and 105 deletions.
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": "14.2.16"
"version": "14.2.17"
}
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": "14.2.16",
"version": "14.2.17",
"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": "14.2.16",
"version": "14.2.17",
"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": "14.2.16",
"@next/eslint-plugin-next": "14.2.17",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
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": "14.2.16",
"version": "14.2.17",
"description": "ESLint plugin for Next.js.",
"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": "14.2.16",
"version": "14.2.17",
"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": "14.2.16",
"version": "14.2.17",
"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": "14.2.16",
"version": "14.2.17",
"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": "14.2.16",
"version": "14.2.17",
"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": "14.2.16",
"version": "14.2.17",
"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": "14.2.16",
"version": "14.2.17",
"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": "14.2.16",
"version": "14.2.17",
"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": "14.2.16",
"version": "14.2.17",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
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": "14.2.16",
"version": "14.2.17",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
12 changes: 6 additions & 6 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "14.2.16",
"version": "14.2.17",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -92,7 +92,7 @@
]
},
"dependencies": {
"@next/env": "14.2.16",
"@next/env": "14.2.17",
"@swc/helpers": "0.5.5",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001579",
Expand Down Expand Up @@ -149,10 +149,10 @@
"@jest/types": "29.5.0",
"@mswjs/interceptors": "0.23.0",
"@napi-rs/triples": "1.2.0",
"@next/polyfill-module": "14.2.16",
"@next/polyfill-nomodule": "14.2.16",
"@next/react-refresh-utils": "14.2.16",
"@next/swc": "14.2.16",
"@next/polyfill-module": "14.2.17",
"@next/polyfill-nomodule": "14.2.17",
"@next/react-refresh-utils": "14.2.17",
"@next/swc": "14.2.17",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.41.2",
"@taskr/clear": "1.1.0",
Expand Down
20 changes: 8 additions & 12 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,6 @@ export default async function getBaseWebpackConfig(
'next-metadata-route-loader',
'modularize-import-loader',
'next-barrel-loader',
'next-server-binary-loader',
'next-error-browser-binary-loader',
].reduce((alias, loader) => {
// using multiple aliases to replace `resolveLoader.modules`
Expand Down Expand Up @@ -1278,17 +1277,14 @@ export default async function getBaseWebpackConfig(
or: WEBPACK_LAYERS.GROUP.nonClientServerTarget,
},
},
{
test: /[\\/].*?\.node$/,
loader: isNodeServer
? 'next-server-binary-loader'
: 'next-error-browser-binary-loader',
// On server side bundling, only apply to app router, do not apply to pages router;
// On client side or edge runtime bundling, always error.
...(isNodeServer && {
issuerLayer: isWebpackAppLayer,
}),
},
...(isNodeServer
? []
: [
{
test: /[\\/].*?\.node$/,
loader: 'next-error-browser-binary-loader',
},
]),
...(hasAppDir
? [
{
Expand Down

This file was deleted.

7 changes: 4 additions & 3 deletions packages/next/src/lib/metadata/metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ export function createMetadataComponents({
resolve(undefined)
} else {
error = resolvedError
// If the error triggers in initial metadata resolving, re-resolve with proper error type.
// They'll be saved for flight data, when hydrates, it will replaces the SSR'd metadata with this.
// for not-found error: resolve not-found metadata
// If a not-found error is triggered during metadata resolution, we want to capture the metadata
// for the not-found route instead of whatever triggered the error. For all error types, we resolve an
// error, which will cause the outlet to throw it so it'll be handled by an error boundary
// (either an actual error, or an internal error that renders UI such as the NotFoundBoundary).
if (!errorType && isNotFoundError(resolvedError)) {
const [notFoundMetadataError, notFoundMetadata, notFoundViewport] =
await resolveMetadata({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ async function createComponentTreeInternal({
injectedJS: injectedJSWithCurrentLayout,
injectedFontPreloadTags: injectedFontPreloadTagsWithCurrentLayout,
asNotFound,
metadataOutlet,
metadataOutlet: isChildrenRouteKey ? metadataOutlet : undefined,
ctx,
missingSlots,
})
Expand Down
10 changes: 7 additions & 3 deletions packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1733,9 +1733,11 @@ export default abstract class Server<ServerOptions extends Options = Options> {
if (pathname === UNDERSCORE_NOT_FOUND_ROUTE) {
pathname = '/404'
}
const is404Page = pathname === '/404'

const is500Page = pathname === '/500'
const isErrorPathname = pathname === '/_error'
const is404Page =
pathname === '/404' || (isErrorPathname && res.statusCode === 404)
const is500Page =
pathname === '/500' || (isErrorPathname && res.statusCode === 500)
const isAppPath = components.isAppPath === true

const hasServerProps = !!components.getServerSideProps
Expand Down Expand Up @@ -2671,6 +2673,8 @@ export default abstract class Server<ServerOptions extends Options = Options> {
const notFoundRevalidate = getRequestMeta(req, 'notFoundRevalidate')
revalidate =
typeof notFoundRevalidate === 'undefined' ? 0 : notFoundRevalidate
} else if (is500Page) {
revalidate = 0
}

// If the cache entry has a revalidate value that's a number, use it.
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "14.2.16",
"version": "14.2.17",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/third-parties/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/third-parties",
"version": "14.2.16",
"version": "14.2.17",
"repository": {
"url": "vercel/next.js",
"directory": "packages/third-parties"
Expand All @@ -26,7 +26,7 @@
"third-party-capital": "1.0.20"
},
"devDependencies": {
"next": "14.2.16",
"next": "14.2.17",
"outdent": "0.8.0",
"prettier": "2.5.1"
},
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions scripts/publish-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const cwd = process.cwd()
`${path.join(nativePackagesDir, platform)}`,
`--access`,
`public`,
...(version.includes('canary') ? ['--tag', 'canary'] : []),
...(version.includes('canary')
? ['--tag', 'canary']
: ['--tag', 'next-14']),
],
{ stdio: 'inherit' }
)
Expand Down Expand Up @@ -107,7 +109,9 @@ const cwd = process.cwd()
`${path.join(wasmDir, `pkg-${wasmTarget}`)}`,
'--access',
'public',
...(version.includes('canary') ? ['--tag', 'canary'] : []),
...(version.includes('canary')
? ['--tag', 'canary']
: ['--tag', 'next-14']),
],
{ stdio: 'inherit' }
)
Expand Down
2 changes: 1 addition & 1 deletion scripts/publish-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const cwd = process.cwd()
'--access',
'public',
'--ignore-scripts',
...(isCanary ? ['--tag', 'canary'] : []),
...(isCanary ? ['--tag', 'canary'] : ['--tag', 'next-14']),
],
{ stdio: 'pipe' }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@ import {
getRedboxDescription,
getRedboxSource,
} from 'next-test-utils'
;(process.env.TURBOPACK ? describe.skip : describe)(
'externalize-node-binary-browser-error',
() => {
const { next } = nextTestSetup({
files: __dirname,
})

it('should error when import node binary on browser side', async () => {
const browser = await next.browser('/')
await hasRedbox(browser)
const redbox = {
description: await getRedboxDescription(browser),
source: await getRedboxSource(browser),
}
// FIXME: er-enable when we have a better implementation of node binary resolving
describe.skip('externalize-node-binary-browser-error', () => {
const { next } = nextTestSetup({
files: __dirname,
})

expect(redbox.description).toBe('Failed to compile')
expect(redbox.source).toMatchInlineSnapshot(`
it('should error when import node binary on browser side', async () => {
const browser = await next.browser('/')
await hasRedbox(browser)
const redbox = {
description: await getRedboxDescription(browser),
source: await getRedboxSource(browser),
}

expect(redbox.description).toBe('Failed to compile')
expect(redbox.source).toMatchInlineSnapshot(`
"./node_modules/foo-browser-import-binary/binary.node
Error: Node.js binary module ./node_modules/foo-browser-import-binary/binary.node is not supported in the browser. Please only use the module on server side"
`)
})
}
)
})
})
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { nextTestSetup } from 'e2e-utils'

describe('externalize-node-binary', () => {
// FIXME: er-enable when we have a better implementation of node binary resolving
describe.skip('externalize-node-binary', () => {
const { next } = nextTestSetup({
files: __dirname,
})
Expand Down
Loading

0 comments on commit f133aac

Please sign in to comment.