nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

feat(kit): export Nuxt major version type

Open HigherOrderLogic opened this issue 2 months ago โ€ข 4 comments

๐Ÿ”— Linked issue

N/A.

๐Ÿ“š Description

Export Nuxt major version type, which can be consumed in downstream, eg: checking for Nuxt major version.

HigherOrderLogic avatar Nov 12 '25 12:11 HigherOrderLogic

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Walkthrough

The PR adds a public type alias `NuxtMajorVersion` with values 2 | 3 | 4 in packages/kit/src/compatibility.ts, updates the signature of `isNuxtMajorVersion` to accept that alias, and re-exports the new type from packages/kit/src/index.ts. No runtime behavior changes were introduced.

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~8 minutes

  • Type extraction and re-export across two files
  • No functional or behavioural modifications

Pre-merge checks and finishing touches

โœ… Passed checks (3 passed)
Check name Status Explanation
Title check โœ… Passed The title clearly summarises the main change: exporting a Nuxt major version type from the kit package.
Description check โœ… Passed The description is related to the changeset, explaining that the PR exports a Nuxt major version type for downstream consumption.
Docstring Coverage โœ… Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
โœจ Finishing touches
  • [ ] ๐Ÿ“ Generate docstrings
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

๐Ÿ“œ Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between bc1ff9018ef5532f77d9299a02f9626f3e3f0876 and a700c010de489a2c31fefc61b8aff74545d69930.

๐Ÿ“’ Files selected for processing (1)
  • packages/kit/src/compatibility.ts (1 hunks)
๐Ÿงฐ Additional context used
๐Ÿ““ Path-based instructions (2)
**/*.{ts,tsx,vue}

๐Ÿ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/kit/src/compatibility.ts
**/*.{ts,tsx,js,jsx,vue}

๐Ÿ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,vue}: Use clear, descriptive variable and function names Add comments only to explain complex logic or non-obvious implementations Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files Remove code that is not used or needed Use error handling patterns consistently

Files:

  • packages/kit/src/compatibility.ts
๐Ÿง  Learnings (2)
๐Ÿ““ Common learnings
Learnt from: TheAlexLichter
Repo: nuxt/nuxt PR: 31812
File: packages/nuxt/src/components/plugins/islands-transform.ts:202-202
Timestamp: 2025-04-18T18:33:41.753Z
Learning: In Nuxt, using `rolldownVersion` (not `rollupVersion`) is intentional when detecting if rolldown-vite is being used, even though TypeScript may show an error because the property isn't in standard type definitions yet.
๐Ÿ“š Learning: 2025-04-18T18:33:41.753Z
Learnt from: TheAlexLichter
Repo: nuxt/nuxt PR: 31812
File: packages/nuxt/src/components/plugins/islands-transform.ts:202-202
Timestamp: 2025-04-18T18:33:41.753Z
Learning: In Nuxt, using `rolldownVersion` (not `rollupVersion`) is intentional when detecting if rolldown-vite is being used, even though TypeScript may show an error because the property isn't in standard type definitions yet.

Applied to files:

  • packages/kit/src/compatibility.ts
๐Ÿงฌ Code graph analysis (1)
packages/kit/src/compatibility.ts (3)
packages/kit/src/index.ts (3)
  • NuxtMajorVersion (26-26)
  • isNuxtMajorVersion (25-25)
  • useNuxt (30-30)
packages/nuxt/src/app/nuxt.ts (1)
  • nuxt (275-275)
packages/kit/src/context.ts (1)
  • useNuxt (30-37)
โฐ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: code
๐Ÿ”‡ Additional comments (2)
packages/kit/src/compatibility.ts (2)

95-96: LGTM! Clean type export.

The NuxtMajorVersion type alias is well-defined and provides a clear, reusable type for downstream consumers to reference Nuxt major versions.


100-100: LGTM! Consistent type usage.

Updating the function signature to use NuxtMajorVersion improves maintainability and provides a single source of truth for major version values. The change is non-breaking and the implementation remains correct.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 12 '25 12:11 coderabbitai[bot]

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@33700
@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@33700
nuxt

npm i https://pkg.pr.new/nuxt@33700
@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@33700
@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@33700
@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@33700
@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@33700

commit: a700c01

pkg-pr-new[bot] avatar Nov 12 '25 12:11 pkg-pr-new[bot]

CodSpeed Performance Report

Merging #33700 will not alter performance

Comparing HigherOrderLogic:main (a700c01) with main (7b83538)[^unexpected-base] [^unexpected-base]: No successful run was found on main (01d459e) during the generation of this report, so 7b83538 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Summary

โœ… 10 untouched

codspeed-hq[bot] avatar Nov 12 '25 12:11 codspeed-hq[bot]