Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vercel/next.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v14.2.8
Choose a base ref
...
head repository: vercel/next.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v14.2.9
Choose a head ref
  • 11 commits
  • 57 files changed
  • 5 contributors

Commits on Sep 6, 2024

  1. Revert "Fix esm property def in flight loader (#66990)" (#69749)

    This reverts commit 9bb06c5.
    
    This was a sort breaking change that could effect using `next/dynamic`
    in server component, when the imported one is client component. Ideally
    you shouldn't directly return it due to the property access restriction
    for client reference. We've already provided related codemod for v15 but
    this might be a bit surprise for users upgrading to the new patch.
    
    Reverted as it's not necessarily part of ESM externals fixes.
    
    Fixes #69720
    huozhi authored Sep 6, 2024
    Copy the full SHA
    a882e6e View commit details
  2. test: both wrapped and unwrapped dynamic() (#69780)

    We should be testing both usage patterns, i.e. returning a component
    wrapped in a `{ default: ... }` and just a bare component.
    
    Note that the behavior here will partially change in 15, so this test is
    just so that we can avoid regressing in 14.x.
    lubieowoce authored Sep 6, 2024
    Copy the full SHA
    86547db View commit details
  3. Disable experimental.optimizeServer by default (#69788)

    huozhi committed Sep 6, 2024
    Copy the full SHA
    bf48448 View commit details
  4. Fix middleware fallback: false case (#69799)

    This ensures we properly set the request meta during our middleware
    invoke so that the `NoFallbackError` bubbling is handled properly.
    Without these fields set we bubble the error unexpectedly causing an
    unexpected 500 instead of a 404.
    
    x-ref: #66987
    Closes: #69428
    ijjk committed Sep 6, 2024
    Copy the full SHA
    e50ad14 View commit details
  5. Fix status code for /_not-found route (#64058) (#69808)

    huozhi authored Sep 6, 2024
    Copy the full SHA
    196dab6 View commit details

Commits on Sep 9, 2024

  1. Fix metadata prop merging (#69807)

    ### What
    
    Fixes metadata merging issue on 14.2. There's a bug with React  on 14.2 as it bit outdated: while generating rsc payload, if we use fragment to wrap the metadata and noindex component, it will miss all the data. It works well with separating them as an array.
    It also requires #64058 to be applied as well so the output not-found page will having correct status 404, and then we can generate noindex metatag based on correct status
    
    Fixes #69778
    huozhi authored Sep 9, 2024
    Copy the full SHA
    747d365 View commit details
  2. unpin CNA tests from 14.2.3

    this reverts the change from 564b620
    lubieowoce committed Sep 9, 2024
    Copy the full SHA
    9a72ad6 View commit details
  3. Copy the full SHA
    3756801 View commit details
  4. create-next-app: fix font file corruption when using import alias (#6…

    …9806)
    
    There's code that uses `glob` to find all template files and replaces
    the default import alias with whatever is specified during CNA. This
    does so without excluding fonts, and so we're unintentionally corrupting
    these `woff` files.
    
    This wasn't a problem in previous versions because we didn't use
    `localFont` in the default template, just `Inter`. The files were
    technically still being corrupted it just never manifested unless you
    went to actually use them.
    
    This is a quick fix to introduce minimal changes but ideally in a
    follow-up we should figure out a better solution for replacing aliases,
    ie by using an allowlist rather than an exclude list.
    
    h/t to @lubieowoce for the thorough test cases
    
    Fixes #69748
    
    ---------
    
    Co-authored-by: Janka Uryga <lolzatu2@gmail.com>
    ztanner and lubieowoce committed Sep 9, 2024
    Copy the full SHA
    4bd3849 View commit details
  5. test: lock ts type check (#69889)

    huozhi committed Sep 9, 2024
    Copy the full SHA
    7998745 View commit details
  6. v14.2.9

    vercel-release-bot committed Sep 9, 2024
    Copy the full SHA
    6fa8982 View commit details
Showing with 497 additions and 83 deletions.
  1. +1 −1 lerna.json
  2. +1 −1 packages/create-next-app/package.json
  3. +10 −1 packages/create-next-app/templates/index.ts
  4. +2 −2 packages/eslint-config-next/package.json
  5. +1 −1 packages/eslint-plugin-next/package.json
  6. +1 −1 packages/font/package.json
  7. +1 −1 packages/next-bundle-analyzer/package.json
  8. +1 −1 packages/next-codemod/package.json
  9. +1 −1 packages/next-env/package.json
  10. +1 −1 packages/next-mdx/package.json
  11. +1 −1 packages/next-plugin-storybook/package.json
  12. +1 −1 packages/next-polyfill-module/package.json
  13. +1 −1 packages/next-polyfill-nomodule/package.json
  14. +1 −1 packages/next-swc/package.json
  15. +6 −6 packages/next/package.json
  16. +3 −10 packages/next/src/build/webpack-config.ts
  17. +7 −20 packages/next/src/build/webpack/loaders/next-flight-loader/index.ts
  18. +6 −8 packages/next/src/server/app-render/app-render.tsx
  19. +1 −1 packages/next/src/server/app-render/create-component-tree.tsx
  20. +1 −1 packages/next/src/server/config-shared.ts
  21. +3 −0 packages/next/src/server/lib/router-utils/resolve-routes.ts
  22. +1 −1 packages/next/src/shared/lib/lazy-dynamic/loadable.tsx
  23. +1 −1 packages/react-refresh-utils/package.json
  24. +2 −2 packages/third-parties/package.json
  25. +7 −7 pnpm-lock.yaml
  26. +6 −4 test/e2e/app-dir/app-routes-client-component/app-routes-client-component.test.ts
  27. +5 −0 test/e2e/app-dir/dynamic/app/dynamic/named-export-unwrapped/client.js
  28. +11 −0 test/e2e/app-dir/dynamic/app/dynamic/named-export-unwrapped/page.js
  29. +5 −0 test/e2e/app-dir/dynamic/dynamic.test.ts
  30. +13 −0 test/e2e/app-dir/metadata-navigation/app/(cart)/product/layout.tsx
  31. +3 −0 test/e2e/app-dir/metadata-navigation/app/(cart)/product/page.tsx
  32. +7 −0 test/e2e/app-dir/metadata-navigation/app/@header/layout.tsx
  33. +12 −0 test/e2e/app-dir/metadata-navigation/app/@header/page.tsx
  34. +7 −0 test/e2e/app-dir/metadata-navigation/app/@header/product/layout.tsx
  35. +12 −0 test/e2e/app-dir/metadata-navigation/app/@header/product/page.tsx
  36. +23 −0 test/e2e/app-dir/metadata-navigation/app/layout.tsx
  37. +7 −0 test/e2e/app-dir/metadata-navigation/app/page.tsx
  38. +30 −0 test/e2e/app-dir/metadata-navigation/metadata-navigation.test.ts
  39. +53 −0 test/e2e/middleware-general/app/pages/ssg-fallback-false/[slug].js
  40. +9 −0 test/e2e/middleware-general/test/index.test.ts
  41. +1 −1 test/integration/create-next-app/lib/utils.ts
  42. +1 −1 test/integration/create-next-app/prompts.test.ts
  43. +1 −1 test/integration/create-next-app/templates/app.test.ts
  44. +77 −0 test/integration/create-next-app/templates/matrix.test.ts
  45. +1 −1 test/integration/create-next-app/templates/pages.test.ts
  46. +1 −1 test/integration/create-next-app/utils.ts
  47. +3 −1 test/lib/next-modes/base.ts
  48. +1 −0 test/production/app-dir/actions-tree-shaking/_testing/utils.ts
  49. +24 −0 test/production/app-dir/actions-tree-shaking/shared-module-actions/tsconfig.json
  50. +7 −0 test/production/app-dir/actions-tree-shaking/use-effect-actions/app/layout.js
  51. +11 −0 test/production/app-dir/actions-tree-shaking/use-effect-actions/app/mixed/actions.ts
  52. +9 −0 test/production/app-dir/actions-tree-shaking/use-effect-actions/app/mixed/my-component.tsx
  53. +23 −0 test/production/app-dir/actions-tree-shaking/use-effect-actions/app/mixed/page.tsx
  54. +24 −0 test/production/app-dir/actions-tree-shaking/use-effect-actions/tsconfig.json
  55. +3 −0 test/production/app-dir/actions-tree-shaking/use-effect-actions/use-effect-actions-edge.test.ts
  56. +25 −0 test/production/app-dir/actions-tree-shaking/use-effect-actions/use-effect-actions.test.ts
  57. +20 −1 test/turbopack-build-tests-manifest.json
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "14.2.8"
"version": "14.2.9"
}
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.8",
"version": "14.2.9",
"keywords": [
"react",
"next",
11 changes: 10 additions & 1 deletion packages/create-next-app/templates/index.ts
Original file line number Diff line number Diff line change
@@ -97,7 +97,16 @@ export const installTemplate = async ({
stats: false,
// We don't want to modify compiler options in [ts/js]config.json
// and none of the files in the .git folder
ignore: ["tsconfig.json", "jsconfig.json", ".git/**/*"],
// TODO: Refactor this to be an allowlist, rather than a denylist,
// to avoid corrupting files that weren't intended to be replaced

ignore: [
"tsconfig.json",
"jsconfig.json",
".git/**/*",
"**/fonts/**",
"**/favicon.ico",
],
});
const writeSema = new Sema(8, { capacity: files.length });
await Promise.all(
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.8",
"version": "14.2.9",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
@@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
"dependencies": {
"@next/eslint-plugin-next": "14.2.8",
"@next/eslint-plugin-next": "14.2.9",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0",
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.8",
"version": "14.2.9",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"license": "MIT",
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.8",
"version": "14.2.9",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
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.8",
"version": "14.2.9",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
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.8",
"version": "14.2.9",
"license": "MIT",
"repository": {
"type": "git",
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.8",
"version": "14.2.9",
"keywords": [
"react",
"next",
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.8",
"version": "14.2.9",
"main": "index.js",
"license": "MIT",
"repository": {
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.8",
"version": "14.2.9",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
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.8",
"version": "14.2.9",
"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",
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.8",
"version": "14.2.9",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
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.8",
"version": "14.2.9",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
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.8",
"version": "14.2.9",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
@@ -92,7 +92,7 @@
]
},
"dependencies": {
"@next/env": "14.2.8",
"@next/env": "14.2.9",
"@swc/helpers": "0.5.5",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001579",
@@ -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.8",
"@next/polyfill-nomodule": "14.2.8",
"@next/react-refresh-utils": "14.2.8",
"@next/swc": "14.2.8",
"@next/polyfill-module": "14.2.9",
"@next/polyfill-nomodule": "14.2.9",
"@next/react-refresh-utils": "14.2.9",
"@next/swc": "14.2.9",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.41.2",
"@taskr/clear": "1.1.0",
13 changes: 3 additions & 10 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
@@ -483,13 +483,6 @@ export default async function getBaseWebpackConfig(
babel: useSWCLoader ? swcDefaultLoader : babelLoader!,
}

const nextFlightLoader = {
loader: 'next-flight-loader',
options: {
isEdgeServer,
},
}

const appServerLayerLoaders = hasAppDir
? [
// When using Babel, we will have to add the SWC loader
@@ -502,7 +495,6 @@ export default async function getBaseWebpackConfig(
: []

const instrumentLayerLoaders = [
nextFlightLoader,
// When using Babel, we will have to add the SWC loader
// as an additional pass to handle RSC correctly.
// This will cause some performance overhead but
@@ -512,7 +504,6 @@ export default async function getBaseWebpackConfig(
].filter(Boolean)

const middlewareLayerLoaders = [
nextFlightLoader,
// When using Babel, we will have to use SWC to do the optimization
// for middleware to tree shake the unused default optimized imports like "next/server".
// This will cause some performance overhead but
@@ -1358,7 +1349,9 @@ export default async function getBaseWebpackConfig(
isEdgeServer,
}),
},
use: nextFlightLoader,
use: {
loader: 'next-flight-loader',
},
},
]
: []),
Original file line number Diff line number Diff line change
@@ -54,9 +54,6 @@ export default function transformSource(
throw new Error('Expected source to have been transformed to a string.')
}

const options = this.getOptions()
const { isEdgeServer } = options

// Assign the RSC meta information to buildInfo.
// Exclude next internal files which are not marked as client files
const buildInfo = getModuleBuildInfo(this._module)
@@ -100,31 +97,21 @@ export default function transformSource(
return
}

// `proxy` is the module proxy that we treat the module as a client boundary.
// For ESM, we access the property of the module proxy directly for each export.
// This is bit hacky that treating using a CJS like module proxy for ESM's exports,
// but this will avoid creating nested proxies for each export. It will be improved in the future.

// Explanation for: await createProxy(...)
// We need to await the module proxy creation because it can be async module for SSR layer
// due to having async dependencies.
// We only apply `the await` for Node.js as only Edge doesn't have external dependencies.
let esmSource = `\
import { createProxy } from "${MODULE_PROXY_PATH}"
const proxy = ${
isEdgeServer ? '' : 'await'
} createProxy(String.raw\`${resourceKey}\`)
`
let cnt = 0
for (const ref of clientRefs) {
if (ref === '') {
esmSource += `exports[''] = proxy['']\n`
esmSource += `\nexports[''] = createProxy(String.raw\`${resourceKey}#\`);`
} else if (ref === 'default') {
esmSource += `export default proxy.default;\n`
esmSource += `\
export default createProxy(String.raw\`${resourceKey}#default\`);
`
} else {
esmSource += `const e${cnt} = proxy["${ref}"];\n`
esmSource += `export { e${cnt++} as ${ref} };\n`
esmSource += `
const e${cnt} = createProxy(String.raw\`${resourceKey}#${ref}\`);
export { e${cnt++} as ${ref} };`
}
}

14 changes: 6 additions & 8 deletions packages/next/src/server/app-render/app-render.tsx
Original file line number Diff line number Diff line change
@@ -319,13 +319,11 @@ async function generateFlight(
flightRouterState,
isFirst: true,
// For flight, render metadata inside leaf page
rscPayloadHead: (
<>
<NonIndex ctx={ctx} />
{/* Adding requestId as react key to make metadata remount for each render */}
<MetadataTree key={requestId} />
</>
),
// NOTE: in 14.2, fragment doesn't work well with React, using array instead
rscPayloadHead: [
<MetadataTree key={requestId} />,
<NonIndex key="noindex" ctx={ctx} />,
],
injectedCSS: new Set(),
injectedJS: new Set(),
injectedFontPreloadTags: new Set(),
@@ -531,12 +529,12 @@ async function ReactServerError({

const head = (
<>
<NonIndex ctx={ctx} />
{/* Adding requestId as react key to make metadata remount for each render */}
<MetadataTree key={requestId} />
{process.env.NODE_ENV === 'development' && (
<meta name="next-error" content="not-found" />
)}
<NonIndex ctx={ctx} />
</>
)

Original file line number Diff line number Diff line change
@@ -260,7 +260,7 @@ async function createComponentTreeInternal({
}

const LayoutOrPage: React.ComponentType<any> | undefined = layoutOrPageMod
? interopDefault(layoutOrPageMod)
? await interopDefault(layoutOrPageMod)
: undefined

/**
2 changes: 1 addition & 1 deletion packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
@@ -939,7 +939,7 @@ export const defaultConfig: NextConfig = {
: false,
webpackBuildWorker: undefined,
missingSuspenseWithCSRBailout: true,
optimizeServerReact: true,
optimizeServerReact: false,
useEarlyImport: false,
staleTimes: {
dynamic: 30,
3 changes: 3 additions & 0 deletions packages/next/src/server/lib/router-utils/resolve-routes.ts
Original file line number Diff line number Diff line change
@@ -471,6 +471,9 @@ export function getResolveRoutes(
throw new Error(`Failed to initialize render server "middleware"`)
}

addRequestMeta(req, 'invokePath', '')
addRequestMeta(req, 'invokeOutput', '')
addRequestMeta(req, 'invokeQuery', {})
addRequestMeta(req, 'middlewareInvoke', true)
debug('invoking middleware', req.url, req.headers)

2 changes: 1 addition & 1 deletion packages/next/src/shared/lib/lazy-dynamic/loadable.tsx
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ function convertModule<P>(
// Cases:
// mod: { default: Component }
// mod: Component
// mod: { default: proxy(Component) }
// mod: { $$typeof, default: proxy(Component) }
// mod: proxy(Component)
const hasDefault = mod && 'default' in mod
return {
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.8",
"version": "14.2.9",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
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.8",
"version": "14.2.9",
"repository": {
"url": "vercel/next.js",
"directory": "packages/third-parties"
@@ -26,7 +26,7 @@
"third-party-capital": "1.0.20"
},
"devDependencies": {
"next": "14.2.8",
"next": "14.2.9",
"outdent": "0.8.0",
"prettier": "2.5.1"
},
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.

Loading