From 9b9360f61fd20ffd48b11d48a9e062c07489afdc Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 16 Apr 2025 02:52:18 +0000
Subject: [PATCH] sync docs@ddca498
---
.../01-getting-started/12-upgrading.mdx | 36 +-
.../migrating/app-router-migration.mdx | 1032 +++++++++++++++++
.../migrating/from-create-react-app.mdx} | 76 +-
.../migrating/from-vite.mdx} | 75 +-
docs/01-app/02-guides/migrating/index.mdx | 4 +
docs/01-app/02-guides/multi-tenant.mdx | 7 +
.../single-page-applications.mdx} | 64 +-
.../upgrading/codemods.mdx} | 62 +-
docs/01-app/02-guides/upgrading/index.mdx | 7 +
.../01-app/02-guides/upgrading/version-14.mdx | 37 +
.../upgrading/version-15.mdx} | 80 +-
.../01-routing/03-layouts-and-templates.mdx | 22 +-
.../01-routing/10-dynamic-routes.mdx | 22 +-
.../01-routing/13-route-handlers.mdx | 26 +-
.../06-optimizing/03-fonts.mdx | 106 +-
.../06-optimizing/04-metadata.mdx | 68 +-
.../06-optimizing/14-local-development.mdx | 55 +-
.../03-environment-variables.mdx | 52 +-
.../08-testing/02-jest.mdx | 128 +-
.../10-deploying/index.mdx | 88 +-
.../11-upgrading/02-canary.mdx | 38 -
.../11-upgrading/04-version-14.mdx | 36 -
.../11-upgrading/05-app-router-migration.mdx | 1032 -----------------
.../11-upgrading/index.mdx | 11 -
.../03-building-your-application/index.mdx | 16 +-
.../05-api-reference/02-components/image.mdx | 174 +--
.../05-api-reference/02-components/link.mdx | 128 +-
.../03-file-conventions/layout.mdx | 78 +-
.../03-file-conventions/page.mdx | 32 +-
.../route-segment-config.mdx | 72 +-
.../03-file-conventions/route.mdx | 18 +-
.../05-api-reference/04-functions/cookies.mdx | 54 +-
.../04-functions/draft-mode.mdx | 50 +-
.../04-functions/generate-viewport.mdx | 24 +-
.../05-api-reference/04-functions/headers.mdx | 36 +-
.../04-functions/use-router.mdx | 44 +-
.../05-config/01-next-config-js/appDir.mdx | 8 +-
.../05-config/01-next-config-js/rewrites.mdx | 93 +-
.../05-config/01-next-config-js/turbopack.mdx | 30 +-
docs/01-app/index.mdx | 93 +-
docs/03-architecture/fast-refresh.mdx | 53 +-
kj-diff.json | 199 +---
next.js | 2 +-
43 files changed, 2113 insertions(+), 2255 deletions(-)
create mode 100644 docs/01-app/02-guides/migrating/app-router-migration.mdx
rename docs/01-app/{03-building-your-application/11-upgrading/06-from-create-react-app.mdx => 02-guides/migrating/from-create-react-app.mdx} (73%)
rename docs/01-app/{03-building-your-application/11-upgrading/07-from-vite.mdx => 02-guides/migrating/from-vite.mdx} (72%)
create mode 100644 docs/01-app/02-guides/migrating/index.mdx
create mode 100644 docs/01-app/02-guides/multi-tenant.mdx
rename docs/01-app/{03-building-your-application/11-upgrading/08-single-page-applications.mdx => 02-guides/single-page-applications.mdx} (77%)
rename docs/01-app/{03-building-your-application/11-upgrading/01-codemods.mdx => 02-guides/upgrading/codemods.mdx} (75%)
create mode 100644 docs/01-app/02-guides/upgrading/index.mdx
create mode 100644 docs/01-app/02-guides/upgrading/version-14.mdx
rename docs/01-app/{03-building-your-application/11-upgrading/03-version-15.mdx => 02-guides/upgrading/version-15.mdx} (64%)
delete mode 100644 docs/01-app/03-building-your-application/11-upgrading/02-canary.mdx
delete mode 100644 docs/01-app/03-building-your-application/11-upgrading/04-version-14.mdx
delete mode 100644 docs/01-app/03-building-your-application/11-upgrading/05-app-router-migration.mdx
delete mode 100644 docs/01-app/03-building-your-application/11-upgrading/index.mdx
diff --git a/docs/01-app/01-getting-started/12-upgrading.mdx b/docs/01-app/01-getting-started/12-upgrading.mdx
index 895ec8d1..ed31e426 100644
--- a/docs/01-app/01-getting-started/12-upgrading.mdx
+++ b/docs/01-app/01-getting-started/12-upgrading.mdx
@@ -1,32 +1,52 @@
---
-title: 'アップグレード'
-description: 'Next.jsアプリケーションを最新バージョンにアップグレードする方法を学びます。'
+title: 'Next.js アプリをアップグレードする方法'
+nav_title: 'アップグレード'
+description: 'Next.js アプリケーションを最新バージョンにアップグレードする方法を学びます。'
related:
title: 'バージョンガイド'
description: '詳細なアップグレード手順については、バージョンガイドをご覧ください。'
links:
- - 'app/building-your-application/upgrading/version-15'
- - 'app/building-your-application/upgrading/version-14'
+ - 'app/guides/upgrading/version-15'
+ - 'app/guides/upgrading/version-14'
---
## 最新バージョン {#latest-version}
-Next.jsを最新バージョンに更新するには、`upgrade` codemodを使用できます:
+Next.js を最新バージョンに更新するには、`upgrade` codemod を使用します:
```bash title="Terminal"
npx @next/codemod@canary upgrade latest
```
-手動でアップグレードしたい場合は、最新のNext.jsとReactのバージョンをインストールしてください:
+手動でアップグレードしたい場合は、最新の Next.js と React のバージョンをインストールしてください:
```bash title="Terminal"
npm i next@latest react@latest react-dom@latest eslint-config-next@latest
```
-## Canaryバージョン {#canary-version}
+## Canary バージョン {#canary-version}
-最新のcanaryに更新するには、まずNext.jsの最新バージョンを使用しており、すべてが期待通りに動作していることを確認してください。その後、次のコマンドを実行します:
+最新の canary に更新するには、まず Next.js の最新バージョンを使用しており、すべてが期待通りに動作していることを確認してください。その後、次のコマンドを実行します:
```bash title="Terminal"
npm i next@canary
```
+
+### Canary で利用可能な機能 {#features-available-in-canary}
+
+現在、canary で利用可能な機能は以下の通りです:
+
+**キャッシング**:
+
+- [`"use cache"`](/docs/app/api-reference/directives/use-cache)
+- [`cacheLife`](/docs/app/api-reference/functions/cacheLife)
+- [`cacheTag`](/docs/app/api-reference/functions/cacheTag)
+- [`dynamicIO`](/docs/app/api-reference/config/next-config-js/dynamicIO)
+
+**認証**:
+
+- [`forbidden`](/docs/app/api-reference/functions/forbidden)
+- [`unauthorized`](/docs/app/api-reference/functions/unauthorized)
+- [`forbidden.js`](/docs/app/api-reference/file-conventions/forbidden)
+- [`unauthorized.js`](/docs/app/api-reference/file-conventions/unauthorized)
+- [`authInterrupts`](/docs/app/api-reference/config/next-config-js/authInterrupts)
diff --git a/docs/01-app/02-guides/migrating/app-router-migration.mdx b/docs/01-app/02-guides/migrating/app-router-migration.mdx
new file mode 100644
index 00000000..2e34eb9d
--- /dev/null
+++ b/docs/01-app/02-guides/migrating/app-router-migration.mdx
@@ -0,0 +1,1032 @@
+---
+title: 'Pages から App Router への移行方法'
+nav_title: 'App Router'
+description: '既存の Next.js アプリケーションを Pages Router から App Router にアップグレードする方法を学びます。'
+---
+
+このガイドでは、以下のことをサポートします:
+
+- [Next.js アプリケーションをバージョン 12 からバージョン 13 に更新する](#nextjs-version)
+- [`pages` ディレクトリと `app` ディレクトリの両方で動作する機能をアップグレードする](#upgrading-new-features)
+- [既存のアプリケーションを `pages` から `app` に段階的に移行する](#migrating-from-pages-to-app)
+
+## アップグレード {#upgrading}
+
+### Node.js バージョン {#node-js-version}
+
+最低限必要な Node.js のバージョンは **v18.17** です。詳細は [Node.js のドキュメント](https://nodejs.org/docs/latest-v18.x/api/)を参照してください。
+
+### Next.js バージョン {#next-js-version}
+
+Next.js バージョン 13 に更新するには、お好みのパッケージマネージャーを使用して次のコマンドを実行してください:
+
+```bash title="Terminal"
+npm install next@latest react@latest react-dom@latest
+```
+
+### ESLint バージョン {#eslint-version}
+
+ESLint を使用している場合、ESLint のバージョンをアップグレードする必要があります:
+
+```bash title="Terminal"
+npm install -D eslint-config-next@latest
+```
+
+> **Good to know**: ESLint の変更を反映させるために、VS Code で ESLint サーバーを再起動する必要があるかもしれません。コマンドパレット(Mac では `cmd+shift+p`、Windows では `ctrl+shift+p`)を開き、`ESLint: Restart ESLint Server` を検索してください。
+
+## 次のステップ {#next-steps}
+
+更新が完了したら、次のセクションを参照して次のステップを確認してください:
+
+- [新機能のアップグレード](#upgrading-new-features):改良された Image コンポーネントや Link コンポーネントなどの新機能にアップグレードするためのガイド。
+- [`pages` から `app` ディレクトリへの移行](#migrating-from-pages-to-app):`pages` から `app` ディレクトリへの段階的な移行をサポートするステップバイステップガイド。
+
+## 新機能のアップグレード {#upgrading-new-features}
+
+Next.js 13 では、新しい機能と規約を備えた新しい [App Router](/docs/app/building-your-application/routing) が導入されました。新しい Router は `app` ディレクトリで利用可能で、`pages` ディレクトリと共存します。
+
+Next.js 13 へのアップグレードは、App Router の使用を必須としません。`pages` を引き続き使用し、両方のディレクトリで動作する新機能(更新された [Image コンポーネント](#image-component)、[Link コンポーネント](#link-component)、[Script コンポーネント](#script-component)、および [Font 最適化](#font-optimization) など)を利用できます。
+
+### `` コンポーネント {#image-component}
+
+Next.js 12 では、一時的なインポート `next/future/image` を使用して Image コンポーネントに新しい改善が導入されました。これらの改善には、クライアントサイドの JavaScript の削減、画像の拡張とスタイル設定の簡素化、アクセシビリティの向上、ネイティブブラウザの遅延読み込みが含まれています。
+
+バージョン 13 では、この新しい動作が `next/image` のデフォルトになりました。
+
+新しい Image コンポーネントへの移行を支援するために、2 つの codemod が用意されています:
+
+- [**`next-image-to-legacy-image` codemod**](/docs/app/guides/upgrading/codemods#next-image-to-legacy-image):`next/image` インポートを `next/legacy/image` に安全かつ自動的にリネームします。既存のコンポーネントは同じ動作を維持します。
+- [**`next-image-experimental` codemod**](/docs/app/guides/upgrading/codemods#next-image-experimental):インラインスタイルを危険に追加し、未使用の props を削除します。これにより、既存のコンポーネントの動作が新しいデフォルトに一致するように変更されます。この codemod を使用するには、最初に `next-image-to-legacy-image` codemod を実行する必要があります。
+
+### `` コンポーネント {#link-component}
+
+[`` コンポーネント](/docs/app/building-your-application/routing/linking-and-navigating#link-component) は、子として `` タグを手動で追加する必要がなくなりました。この動作は [バージョン 12.2](https://nextjs.org/blog/next-12-2) で実験的なオプションとして追加され、現在はデフォルトです。Next.js 13 では、`` は常に `` をレンダリングし、props を基になるタグに転送できるようになりました。
+
+例:
+
+```jsx
+import Link from 'next/link'
+
+// Next.js 12: `` はネストされていないと除外されます
+
+ About
+
+
+// Next.js 13: `` は常に内部で `` をレンダリングします
+
+ About
+
+```
+
+Next.js 13 にリンクをアップグレードするには、[`new-link` codemod](/docs/app/guides/upgrading/codemods#new-link) を使用できます。
+
+### `