diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index ad059c3630..7de0a3890f 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,6 +1,6 @@ name: "\U0001F41E Bug report" description: Create a report to help us improve Nuxt -labels: ["pending triage", "3.x"] +labels: ["pending triage"] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index ff8f4c2377..3527bf128b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,8 @@ blank_issues_enabled: true contact_links: - - name: 📚 Nuxt 3 Documentation + - name: 📚 Nuxt Documentation url: https://nuxt.com/docs - about: Check the documentation for usage of Nuxt 3 - - name: 📚 Nuxt 2 Documentation - url: https://v2.nuxt.com - about: Check the documentation for usage of Nuxt 2 + about: Check the documentation for usage of Nuxt - name: 💬 Discussions url: https://github.com/nuxt/nuxt/discussions about: Use discussions if you have another issue, an idea for improvement or for asking questions. diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index a5614e9304..b155f19563 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -1,6 +1,6 @@ name: "🚀 Feature request" description: Suggest a feature that will improve Nuxt -labels: ["pending triage", "3.x"] +labels: ["pending triage"] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/z-bug-report-2.yml b/.github/ISSUE_TEMPLATE/z-bug-report-2.yml deleted file mode 100644 index d4124367b2..0000000000 --- a/.github/ISSUE_TEMPLATE/z-bug-report-2.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: "\U0001F41E Bug report (Nuxt 2)" -description: Create a report to help us improve Nuxt -labels: ["pending triage", "2.x"] -body: - - type: markdown - attributes: - value: | - Please carefully read the contribution docs before creating a bug report - 👉 https://nuxt.com/docs/community/reporting-bugs - - Please use a template below to create a minimal reproduction - 👉 https://stackblitz.com/github/nuxt/starter/tree/v2 - 👉 https://codesandbox.io/s/github/nuxt/starter/v2 - - type: textarea - id: bug-env - attributes: - label: Environment - description: You can use `npx envinfo --system --npmPackages '{nuxt,@nuxt/*}' --binaries --browsers` to fill this section - placeholder: Environment - validations: - required: true - - type: textarea - id: reproduction - attributes: - label: Reproduction - description: Please provide a link to a repo that can reproduce the problem you ran into. A [**minimal reproduction**](https://nuxt.com/docs/community/reporting-bugs#create-a-minimal-reproduction) is required unless you are absolutely sure that the issue is obvious and the provided information is enough to understand the problem. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "need reproduction" label. If no reproduction is provided we might close it. - placeholder: Reproduction - validations: - required: true - - type: textarea - id: bug-description - attributes: - label: Describe the bug - description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks! - placeholder: Bug description - validations: - required: true - - type: textarea - id: additonal - attributes: - label: Additional context - description: If applicable, add any other context about the problem here - - type: textarea - id: logs - attributes: - label: Logs - description: | - Optional if provided reproduction. Please try not to insert an image but copy paste the log text. - render: shell-script diff --git a/.github/workflows/autofix-docs.yml b/.github/workflows/autofix-docs.yml index d90a8e2f9e..d2108f3332 100644 --- a/.github/workflows/autofix-docs.yml +++ b/.github/workflows/autofix-docs.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -27,7 +27,10 @@ jobs: - name: Install dependencies run: pnpm install + - name: Build (stub) + run: pnpm dev:prepare + - name: Lint (docs) run: pnpm lint:docs:fix - - uses: autofix-ci/action@ea32e3a12414e6d3183163c3424a7d7a8631ad84 + - uses: autofix-ci/action@2891949f3779a1cafafae1523058501de3d4e944 diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index 03d5a654f3..9fb6301389 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -52,4 +52,4 @@ jobs: - name: Lint (code) run: pnpm lint:fix - - uses: autofix-ci/action@ea32e3a12414e6d3183163c3424a7d7a8631ad84 + - uses: autofix-ci/action@2891949f3779a1cafafae1523058501de3d4e944 diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 83645d7c3e..5eb98fc012 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -31,7 +31,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -46,7 +46,7 @@ jobs: run: pnpm build - name: Run benchmarks - uses: CodSpeedHQ/action@0b631f8998f2389eb5144632b6f9f8fabd33a86e # v2.4.1 + uses: CodSpeedHQ/action@a58b84c0b61569a9cbb7cfb378cc849d65cf1ce5 # v2.4.3 with: run: pnpm vitest bench token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 492a0fb118..78474f90e2 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -4,7 +4,7 @@ on: push: branches: - main - - 2.x + - 3.x permissions: pull-requests: write @@ -16,7 +16,7 @@ concurrency: jobs: update: - if: github.repository_owner == 'nuxt' && !contains(github.event.head_commit.message, 'v3.') + if: github.repository_owner == 'nuxt' && !contains(github.event.head_commit.message, 'v3.') && !contains(github.event.head_commit.message, 'v4.') runs-on: ubuntu-latest steps: @@ -24,7 +24,7 @@ jobs: with: fetch-depth: 0 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml index 14a3db9075..f07aa5b898 100644 --- a/.github/workflows/check-links.yml +++ b/.github/workflows/check-links.yml @@ -7,6 +7,7 @@ on: - "*.md" branches: - main + - 3.x # Remove default permissions of GITHUB_TOKEN for security # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c4c56cfc2..8fc1b6145a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,14 @@ on: - "*.md" branches: - main + - 3.x pull_request: paths-ignore: - "docs/**" - "*.md" branches: - main + - 3.x - "!v[0-9]*" # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml @@ -37,7 +39,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -55,7 +57,7 @@ jobs: run: pnpm build - name: Cache dist - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: retention-days: 3 name: dist @@ -74,7 +76,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -83,19 +85,19 @@ jobs: run: pnpm install - name: Initialize CodeQL - uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 + uses: github/codeql-action/init@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 with: languages: javascript queries: +security-and-quality - name: Restore dist cache - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: dist path: packages - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 + uses: github/codeql-action/analyze@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 with: category: "/language:javascript" @@ -113,7 +115,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -122,7 +124,7 @@ jobs: run: pnpm install - name: Restore dist cache - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: dist path: packages @@ -144,7 +146,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -168,7 +170,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -198,7 +200,6 @@ jobs: builder: ["vite", "webpack"] context: ["async", "default"] manifest: ["manifest-on", "manifest-off"] - version: ["v4", "v3"] payload: ["json", "js"] node: [18] exclude: @@ -220,7 +221,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: ${{ matrix.node }} cache: "pnpm" @@ -232,7 +233,7 @@ jobs: run: pnpm playwright-core install chromium - name: Restore dist cache - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: dist path: packages @@ -244,7 +245,6 @@ jobs: TEST_BUILDER: ${{ matrix.builder }} TEST_MANIFEST: ${{ matrix.manifest }} TEST_CONTEXT: ${{ matrix.context }} - TEST_V4: ${{ matrix.version == 'v4' }} TEST_PAYLOAD: ${{ matrix.payload }} SKIP_BUNDLE_SIZE: ${{ github.event_name != 'push' || matrix.env == 'dev' || matrix.builder == 'webpack' || matrix.context == 'default' || matrix.payload == 'js' || runner.os == 'Windows' }} @@ -254,6 +254,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} build-release: + concurrency: + group: release permissions: id-token: write if: | @@ -274,7 +276,7 @@ jobs: with: fetch-depth: 0 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -283,18 +285,20 @@ jobs: run: pnpm install - name: Restore dist cache - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: dist path: packages - name: Release Edge - run: ./scripts/release-edge.sh + run: ./scripts/release-edge.sh ${{ github.ref == 'refs/heads/main' && 'latest' || '3x' }} env: NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} NPM_CONFIG_PROVENANCE: true release-pr: + concurrency: + group: release permissions: id-token: write pull-requests: write @@ -313,7 +317,7 @@ jobs: with: fetch-depth: 0 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -322,7 +326,7 @@ jobs: run: pnpm install - name: Restore dist cache - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: dist path: packages diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 7d1ac0d64a..2aae50705f 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -19,4 +19,4 @@ jobs: - name: 'Checkout Repository' uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: 'Dependency Review' - uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3 + uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 624cafa244..d63689f9ca 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -9,6 +9,7 @@ on: # autofix workflow will be triggered instead for PRs branches: - main + - 3.x - "!v[0-9]*" # Remove default permissions of GITHUB_TOKEN for security @@ -22,7 +23,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" @@ -30,6 +31,9 @@ jobs: - name: Install dependencies run: pnpm install + - name: Build (stub) + run: pnpm dev:prepare + - name: Lint (docs) run: pnpm lint:docs diff --git a/.github/workflows/introspect.yml b/.github/workflows/introspect.yml index 6b7f4fd586..0820e5407f 100644 --- a/.github/workflows/introspect.yml +++ b/.github/workflows/introspect.yml @@ -6,11 +6,13 @@ on: - ".github/workflows/**" branches: - main + - 3.x pull_request: paths: - ".github/workflows/**" branches: - main + - 3.x - "!v[0-9]*" permissions: diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml index 9d462f9f8c..c173cee01d 100644 --- a/.github/workflows/label-pr.yml +++ b/.github/workflows/label-pr.yml @@ -6,6 +6,7 @@ on: - opened branches: - main + - 3.x jobs: add-pr-labels: diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index 7a45a29223..7850e0f264 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -14,6 +14,8 @@ permissions: jobs: release-pr: if: github.repository == 'nuxt/nuxt' && github.event.issue.pull_request && github.event.comment.body == '/trigger release' + concurrency: + group: release permissions: id-token: write pull-requests: write @@ -29,13 +31,30 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Get PR Info + id: pr + env: + PR_NUMBER: ${{ github.event.issue.number }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + COMMENT_AT: ${{ github.event.comment.created_at }} + run: | + pr="$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${GH_REPO}/pulls/${PR_NUMBER})" + head_sha="$(echo "$pr" | jq -r .head.sha)" + updated_at="$(echo "$pr" | jq -r .updated_at)" + + if [[ $(date -d "$updated_at" +%s) -gt $(date -d "$COMMENT_AT" +%s) ]]; then + exit 1 + fi + + echo "head_sha=$head_sha" >> $GITHUB_OUTPUT - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: - ref: ${{ github.event.issue.pull_request.head.sha }} - fetch-depth: 0 + ref: ${{ steps.pr.outputs.head_sha }} + fetch-depth: 1 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 cache: "pnpm" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 727d0669ea..c597702bfd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,9 @@ permissions: {} jobs: release: - if: github.repository == 'nuxt/nuxt' && startsWith(github.event.head_commit.message, 'v3.') + if: github.repository == 'nuxt/nuxt' && (startsWith(github.event.head_commit.message, 'v3.') || startsWith(github.event.head_commit.message, 'v4.')) + concurrency: + group: release permissions: id-token: write runs-on: ubuntu-latest @@ -21,7 +23,7 @@ jobs: with: fetch-depth: 0 - run: corepack enable - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 registry-url: "https://registry.npmjs.org/" diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index fb0b7dc233..2a89a2a432 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -59,7 +59,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 if: github.repository == 'nuxt/nuxt' && success() with: name: SARIF file @@ -68,7 +68,7 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@23acc5c183826b7a8a97bce3cecc52db901f8251 # v3.25.10 + uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 if: github.repository == 'nuxt/nuxt' && success() with: sarif_file: results.sarif diff --git a/.github/workflows/semantic-pull-requests.yml b/.github/workflows/semantic-pull-requests.yml index 3bf40386bf..927a2b41a7 100644 --- a/.github/workflows/semantic-pull-requests.yml +++ b/.github/workflows/semantic-pull-requests.yml @@ -20,7 +20,7 @@ jobs: name: Semantic pull request steps: - name: Validate PR title - uses: amannn/action-semantic-pull-request@cfb60706e18bc85e8aec535e3c577abe8f70378e # v5.5.2 + uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3 with: scopes: | kit diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000000..fc78d099a7 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @danielroe diff --git a/README.md b/README.md index 9570d902ed..c3eaac4a39 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

Version Downloads - License + License Website Discord

@@ -34,7 +34,7 @@ It provides a number of features that make it easy to build fast, SEO-friendly, - 🏠 [Local Development](#local-development) - ⛰️ [Nuxt 2](#nuxt-2) - 🛟 [Professional Support](#professional-support) -- 🔗 [Follow us](#follow-us) +- 🔗 [Follow Us](#follow-us) - ⚖️ [License](#license) --- @@ -101,18 +101,12 @@ Here are a few ways you can get involved: Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#setup) to contribute to the framework and documentation. -## ⛰️ Nuxt 2 - -You can find the code for Nuxt 2 on the [`2.x` branch](https://github.com/nuxt/nuxt/tree/2.x) and the documentation at [v2.nuxt.com](https://v2.nuxt.com). - -If you expect to be using Nuxt 2 beyond the EOL (End of Life) date (June 30, 2024), and still need a maintained version that can satisfy security and browser compatibility requirements, make sure to check out [HeroDevs’ NES (Never-Ending Support) Nuxt 2](https://www.herodevs.com/support/nuxt-nes?utm_source=nuxt-github&utm_medium=nuxt-readme). - ## 🛟 Professional Support - Technical audit & consulting: [Nuxt Experts](https://nuxt.com/enterprise/support) - Custom development & more: [Nuxt Agencies Partners](https://nuxt.com/enterprise/agencies) -## 🔗 Follow us +## 🔗 Follow Us

Discord  Twitter  GitHub @@ -120,4 +114,4 @@ If you expect to be using Nuxt 2 beyond the EOL (End of Life) date (June 30, 202 ## ⚖️ License -[MIT](./LICENSE) +[MIT](https://github.com/nuxt/nuxt/tree/main/LICENSE) diff --git a/docs/1.getting-started/1.introduction.md b/docs/1.getting-started/1.introduction.md index 47bfdb0bc4..d092c50579 100644 --- a/docs/1.getting-started/1.introduction.md +++ b/docs/1.getting-started/1.introduction.md @@ -76,7 +76,6 @@ Nuxt is composed of different [core packages](https://github.com/nuxt/nuxt/tree/ - Command line interface: [nuxi](https://github.com/nuxt/nuxt/tree/main/packages/nuxi) - Server engine: [nitro](https://github.com/unjs/nitro) - Development kit: [@nuxt/kit](https://github.com/nuxt/nuxt/tree/main/packages/kit) -- Nuxt 2 Bridge: [@nuxt/bridge](https://github.com/nuxt/bridge) We recommend reading each concept to have a full vision of Nuxt capabilities and the scope of each package. diff --git a/docs/1.getting-started/10.deployment.md b/docs/1.getting-started/10.deployment.md index 91a4a71cc0..9043f0035c 100644 --- a/docs/1.getting-started/10.deployment.md +++ b/docs/1.getting-started/10.deployment.md @@ -85,13 +85,13 @@ export default defineNuxtConfig({ ## Hosting Providers -Nuxt 3 can be deployed to several cloud providers with a minimal amount of configuration: +Nuxt can be deployed to several cloud providers with a minimal amount of configuration: :read-more{to="/deploy"} ## Presets -In addition to Node.js servers and static hosting services, a Nuxt 3 project can be deployed with several well-tested presets and minimal amount of configuration. +In addition to Node.js servers and static hosting services, a Nuxt project can be deployed with several well-tested presets and minimal amount of configuration. You can explicitly set the desired preset in the [`nuxt.config.ts`](/docs/guide/directory-structure/nuxt-config) file: @@ -117,10 +117,13 @@ In most cases, Nuxt can work with third-party content that is not generated or c Accordingly, you should make sure that the following options are unchecked / disabled in Cloudflare. Otherwise, unnecessary re-rendering or hydration errors could impact your production application. -1. Speed > Optimization > Auto Minify: Uncheck JavaScript, CSS and HTML -2. Speed > Optimization > Disable "Rocket Loader™" -3. Speed > Optimization > Disable "Mirage" +1. Speed > Optimization > Content Optimization > Auto Minify: Uncheck JavaScript, CSS and HTML +2. Speed > Optimization > Content Optimization > Disable "Rocket Loader™" +3. Speed > Optimization > Image Optimization > Disable "Mirage" 4. Scrape Shield > Disable "Email Address Obfuscation" -5. Scrape Shield > Disable "Server-side Excludes" With these settings, you can be sure that Cloudflare won't inject scripts into your Nuxt application that may cause unwanted side effects. + +::tip +Their location on the Cloudflare dashboard sometimes changes so don't hesitate to look around. +:: diff --git a/docs/1.getting-started/12.upgrade.md b/docs/1.getting-started/12.upgrade.md index 3017305c77..ffeb075ab2 100644 --- a/docs/1.getting-started/12.upgrade.md +++ b/docs/1.getting-started/12.upgrade.md @@ -11,19 +11,41 @@ navigation.icon: i-ph-arrow-circle-up-duotone To upgrade Nuxt to the [latest release](https://github.com/nuxt/nuxt/releases), use the `nuxi upgrade` command. -```bash [Terminal] +::code-group + +```bash [npm] npx nuxi upgrade ``` +```bash [yarn] +yarn dlx nuxi upgrade +``` + +```bash [pnpm] +pnpm dlx nuxi upgrade +``` + +```bash [bun] +bunx nuxi upgrade +``` + +:: + ### Nightly Release Channel To use the latest Nuxt build and test features before their release, read about the [nightly release channel](/docs/guide/going-further/nightly-release-channel) guide. +::alert{type="warning"} +The nightly release channel `latest` tag is currently tracking the Nuxt v4 branch, meaning that it is particularly likely to have breaking changes right now - be careful! + +You can opt in to the 3.x branch nightly releases with `"nuxt": "npm:nuxt-nightly@3x"`. +:: + ## Testing Nuxt 4 Nuxt 4 is planned to be released **on or before June 14** (though obviously this is dependent on having enough time after Nitro's major release to be properly tested in the community, so be aware that this is not an exact date). -Until then, it is possible to test many of Nuxt 4's breaking changes from Nuxt version 3.12 or via the nightly release channel. +Until then, it is possible to test many of Nuxt 4's breaking changes from Nuxt version 3.12+. ::tip{icon="i-ph-video-duotone" to="https://www.youtube.com/watch?v=r4wFKlcJK6c" target="_blank"} Watch a video from Alexander Lichter showing how to opt in to Nuxt 4's breaking changes already. @@ -31,7 +53,7 @@ Watch a video from Alexander Lichter showing how to opt in to Nuxt 4's breaking ### Opting in to Nuxt 4 -First, opt in to the nightly release channel [following these steps](/docs/guide/going-further/nightly-release-channel#opting-in). +First, upgrade Nuxt to the [latest release](https://github.com/nuxt/nuxt/releases). Then you can set your `compatibilityVersion` to match Nuxt 4 behavior: @@ -87,7 +109,8 @@ Nuxt now defaults to a new directory structure, with backwards compatibility (so * the new Nuxt default `srcDir` is `app/` by default, and most things are resolved from there. * `serverDir` now defaults to `/server` rather than `/server` -* `modules` and `public` are resolved relative to `` by default +* `layers/`, `modules/` and `public/` are resolved relative to `` by default +* if using [Nuxt Content v2.13+](https://github.com/nuxt/content/pull/2649), `content/` is resolved relative to `` * a new `dir.app` is added, which is the directory we look for `router.options.ts` and `spa-loading-template.html` - this defaults to `/`

@@ -109,6 +132,8 @@ app/ app.config.ts app.vue router.options.ts +content/ +layers/ modules/ node_modules/ public/ @@ -134,7 +159,7 @@ nuxt.config.ts 1. Create a new directory called `app/`. 1. Move your `assets/`, `components/`, `composables/`, `layouts/`, `middleware/`, `pages/`, `plugins/` and `utils/` folders under it, as well as `app.vue`, `error.vue`, `app.config.ts`. If you have an `app/router-options.ts` or `app/spa-loading-template.html`, these paths remain the same. -1. Make sure your `nuxt.config.ts`, `modules/`, `public/` and `server/` folders remain outside the `app/` folder, in the root of your project. +1. Make sure your `nuxt.config.ts`, `content/`, `layers/`, `modules/`, `public/` and `server/` folders remain outside the `app/` folder, in the root of your project. However, migration is _not required_. If you wish to keep your current folder structure, Nuxt should auto-detect it. (If it does not, please raise an issue.) The one exception is that if you _already_ have a custom `srcDir`. In this case, you should be aware that your `modules/`, `public/` and `server/` folders will be resolved from your `rootDir` rather than from your custom `srcDir`. You can override this by configuring `dir.modules`, `dir.public` and `serverDir` if you need to. @@ -209,6 +234,7 @@ Previously `data` was initialized to `null` but reset in `clearNuxtData` to `und If you encounter any issues you can revert back to the previous behavior with: ```ts twoslash [nuxt.config.ts] +// @errors: 2353 export default defineNuxtConfig({ experimental: { defaults: { @@ -232,6 +258,7 @@ Please report an issue if you are doing this, as we do not plan to keep this as Previously it was possible to pass `dedupe: boolean` to `refresh`. These were aliases of `cancel` (`true`) and `defer` (`false`). ```ts twoslash [app.vue] +// @errors: 2322 const { refresh } = await useAsyncData(async () => ({ message: 'Hello, Nuxt 3!' })) async function refreshData () { @@ -280,6 +307,7 @@ Often users set an appropriately empty value, such as an empty array, to avoid t If you encounter any issues you can revert back to the previous behavior, for now, with: ```ts twoslash [nuxt.config.ts] +// @errors: 2353 export default defineNuxtConfig({ experimental: { resetAsyncDataToUndefined: true, @@ -352,6 +380,25 @@ However, if you are a module author using the `builder:watch` hook and wishing t }) ``` +#### Removal of `window.__NUXT__` object + +##### What Changed + +We are removing the global `window.__NUXT__` object after the app finishes hydration. + +##### Reasons for Change + +This opens the way to multi-app patterns ([#21635](https://github.com/nuxt/nuxt/issues/21635)) and enables us to focus on a single way to access Nuxt app data - `useNuxtApp()`. + +##### Migration Steps + +The data is still available, but can be accessed with `useNuxtApp().payload`: + +```diff +- console.log(window.__NUXT__) ++ console.log(useNuxtApp().payload) +``` + #### Directory index scanning 🚦 **Impact Level**: Medium @@ -448,10 +495,11 @@ const importName = genSafeVariableName Four experimental features are no longer configurable in Nuxt 4: -* `treeshakeClientOnly` will be `true` (default since v3.0) -* `configSchema` will be `true` (default since v3.3) -* `polyfillVueUseHead` will be `false` (default since v3.4) -* `respectNoSSRHeader` will be `false` (default since v3.4) +* `experimental.treeshakeClientOnly` will be `true` (default since v3.0) +* `experimental.configSchema` will be `true` (default since v3.3) +* `experimental.polyfillVueUseHead` will be `false` (default since v3.4) +* `experimental.respectNoSSRHeader` will be `false` (default since v3.4) +* `vite.devBundler` is no longer configurable - it will use `vite-node` by default ##### Reasons for Change @@ -463,11 +511,11 @@ These options have been set to their current values for some time and we do not * `respectNoSSRHeader`is implementable in user-land with [server middleware](https://github.com/nuxt/nuxt/blob/c660b39447f0d5b8790c0826092638d321cd6821/packages/nuxt/src/core/runtime/nitro/no-ssr.ts#L8-L9) -## Nuxt 2 vs Nuxt 3 +## Nuxt 2 vs Nuxt 3+ In the table below, there is a quick comparison between 3 versions of Nuxt: -Feature / Version | Nuxt 2 | Nuxt Bridge | Nuxt 3 +Feature / Version | Nuxt 2 | Nuxt Bridge | Nuxt 3+ -------------------------|-----------------|------------------|--------- Vue | 2 | 2 | 3 Stability | 😊 Stable | 😊 Stable | 😊 Stable @@ -485,9 +533,9 @@ Vite | ⚠️ Partial | 🚧 Partial | ✅ Nuxi CLI | ❌ Old | ✅ nuxi | ✅ nuxi Static sites | ✅ | ✅ | ✅ -## Nuxt 2 to Nuxt 3 +## Nuxt 2 to Nuxt 3+ -The migration guide provides a step-by-step comparison of Nuxt 2 features to Nuxt 3 features and guidance to adapt your current application. +The migration guide provides a step-by-step comparison of Nuxt 2 features to Nuxt 3+ features and guidance to adapt your current application. ::read-more{to="/docs/migration/overview"} Check out the **guide to migrating from Nuxt 2 to Nuxt 3**. @@ -495,7 +543,7 @@ Check out the **guide to migrating from Nuxt 2 to Nuxt 3**. ## Nuxt 2 to Nuxt Bridge -If you prefer to progressively migrate your Nuxt 2 application to Nuxt 3, you can use Nuxt Bridge. Nuxt Bridge is a compatibility layer that allows you to use Nuxt 3 features in Nuxt 2 with an opt-in mechanism. +If you prefer to progressively migrate your Nuxt 2 application to Nuxt 3, you can use Nuxt Bridge. Nuxt Bridge is a compatibility layer that allows you to use Nuxt 3+ features in Nuxt 2 with an opt-in mechanism. ::read-more{to="/docs/bridge/overview"} **Migrate from Nuxt 2 to Nuxt Bridge** diff --git a/docs/1.getting-started/2.installation.md b/docs/1.getting-started/2.installation.md index 1af58ad887..32e8eb7f29 100644 --- a/docs/1.getting-started/2.installation.md +++ b/docs/1.getting-started/2.installation.md @@ -37,10 +37,14 @@ Open a terminal (if you're using [Visual Studio Code](https://code.visualstudio. ::code-group -```bash [npx] +```bash [npm] npx nuxi@latest init ``` +```bash [yarn] +yarn dlx nuxi@latest init +``` + ```bash [pnpm] pnpm dlx nuxi@latest init ``` @@ -96,6 +100,6 @@ Well done! A browser window should automatically open for value`) over computed (`computed(() => value)`). - ::code-group ```vue twoslash [useHead] diff --git a/docs/1.getting-started/5.transitions.md b/docs/1.getting-started/5.transitions.md index 6123b64789..ccabe0ed6d 100644 --- a/docs/1.getting-started/5.transitions.md +++ b/docs/1.getting-started/5.transitions.md @@ -328,7 +328,7 @@ definePageMeta({ }, middleware (to, from) { if (to.meta.pageTransition && typeof to.meta.pageTransition !== 'boolean') - to.meta.pageTransition.name = +to.params.id > +from.params.id ? 'slide-left' : 'slide-right' + to.meta.pageTransition.name = +to.params.id! > +from.params.id! ? 'slide-left' : 'slide-right' } }) @@ -392,7 +392,7 @@ The page now applies the `slide-left` transition when going to the next id and ` ## Transition with NuxtPage -When `` is used in `app.vue`, transition-props can be passed directly as a component props to activate global transition. +When `` is used in `app.vue`, transitions can be configured with the `transition` prop to activate transitions globally. ```vue [app.vue]