Skip to content

feat(nuxt): make file names clickable πŸ–±οΈ - #35898

Merged
danielroe merged 1 commit into
mainfrom
feat/clickable-paths
Jul 30, 2026
Merged

danielroe merged 1 commit into
mainfrom
feat/clickable-paths

Conversation

@danielroe

Copy link
Copy Markdown
Member

πŸ”— Linked issue

πŸ“š Description

this uses clickable-path to add links to open files in an editor. (files are printed using nuxt aliases which means they often wouldn't have opened previously.

example:

CleanShot 2026-07-30 at 09 21 22@2x

we also now track line/column in the page meta plugin so we can't link directly to the line responsible for the warning...

@github-actions github-actions Bot added 5.x ✨ enhancement New feature or improvement to existing functionality labels Jul 30, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@35898

@nuxt/nitro-server

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

nuxt

npm i https://pkg.pr.new/nuxt@35898

@nuxt/rspack-builder

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

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@35898

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit: 90fd212

@coderabbitai

This comment has been minimized.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/nuxt/test/utils.test.ts (1)

85-93: πŸ“ Maintainability & Code Quality | πŸ”΅ Trivial | ⚑ Quick win

Cover the Nuxt alias formatter.

Both cases pass null, so the nuxt ? formatter : undefined branch is untested. Add a minimal Nuxt options fixture asserting an absolute file is displayed as ~/... (including the optional position).

πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nuxt/test/utils.test.ts` around lines 85 - 93, Add a minimal Nuxt
options fixture in the linkToAlias tests and pass it to linkToAlias so the nuxt
formatter branch is exercised. Assert that an absolute file path is rendered
with the ~/ prefix, including the expected line and column when a position is
provided.
πŸ€– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/nuxt/src/components/scan.ts`:
- Line 9: Update the NUXT_B3008 diagnostic path handling to use linkToAlias for
both scannedPath and expectedPath instead of resolveToAlias, matching the
clickable-path conversion already applied to NUXT_B3009, NUXT_B3010, and
NUXT_B3011.

---

Nitpick comments:
In `@packages/nuxt/test/utils.test.ts`:
- Around line 85-93: Add a minimal Nuxt options fixture in the linkToAlias tests
and pass it to linkToAlias so the nuxt formatter branch is exercised. Assert
that an absolute file path is rendered with the ~/ prefix, including the
expected line and column when a position is provided.
πŸͺ„ Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e3924158-a6c7-405f-9f68-535c96b967c8

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between b4586ef and 933d703.

β›” Files ignored due to path filters (3)
  • packages/nuxt/package.json is excluded by !**/package.json
  • packages/vite/package.json is excluded by !**/package.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
πŸ“’ Files selected for processing (23)
  • packages/nuxt/src/compiler/module.ts
  • packages/nuxt/src/compiler/plugins/keyed-function-factories.ts
  • packages/nuxt/src/components/module.ts
  • packages/nuxt/src/components/plugins/islands-transform.ts
  • packages/nuxt/src/components/plugins/lazy-hydration-transform.ts
  • packages/nuxt/src/components/plugins/loader.ts
  • packages/nuxt/src/components/scan.ts
  • packages/nuxt/src/core/app.ts
  • packages/nuxt/src/core/external-config-files.ts
  • packages/nuxt/src/core/nuxt.ts
  • packages/nuxt/src/core/perf.ts
  • packages/nuxt/src/core/plugins/plugin-metadata.ts
  • packages/nuxt/src/core/schema.ts
  • packages/nuxt/src/head/plugins/unhead-imports.ts
  • packages/nuxt/src/imports/module.ts
  • packages/nuxt/src/pages/module.ts
  • packages/nuxt/src/pages/plugins/page-meta.ts
  • packages/nuxt/src/pages/utils.ts
  • packages/nuxt/src/utils.ts
  • packages/nuxt/test/page-metadata.test.ts
  • packages/nuxt/test/utils.test.ts
  • packages/vite/src/plugins/optimize-deps-hint.ts
  • pnpm-workspace.yaml


import { QUOTE_RE, resolveComponentNameSegments } from '../core/utils/index.ts'
import { resolveToAlias } from '../utils.ts'
import { linkToAlias, resolveToAlias } from '../utils.ts'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟑 Minor | ⚑ Quick win

Also link the NUXT_B3008 paths.

The new conversion covers NUXT_B3009, NUXT_B3010, and NUXT_B3011, but NUXT_B3008 still builds scannedPath and expectedPath with resolveToAlias at Lines 51–53. That warning will continue to emit plain paths instead of clickable ones.

Proposed fix
-            const original = resolveToAlias(dir.path, nuxt)
-            const corrected = resolveToAlias(join(dirname(dir.path), sibling), nuxt)
+            const original = linkToAlias(dir.path, nuxt)
+            const corrected = linkToAlias(join(dirname(dir.path), sibling), nuxt)

This follows the PR objective that component diagnostics should render clickable file paths.

πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nuxt/src/components/scan.ts` at line 9, Update the NUXT_B3008
diagnostic path handling to use linkToAlias for both scannedPath and
expectedPath instead of resolveToAlias, matching the clickable-path conversion
already applied to NUXT_B3009, NUXT_B3010, and NUXT_B3011.

@codspeed

codspeed Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

βœ… 21 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing feat/clickable-paths (90fd212) with main (5ac03b5)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@danielroe
danielroe added this pull request to the merge queue Jul 30, 2026
@danielroe
danielroe removed this pull request from the merge queue due to a manual request Jul 30, 2026
@danielroe
danielroe added this pull request to the merge queue Jul 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Jul 30, 2026
@danielroe
danielroe force-pushed the feat/clickable-paths branch from 933d703 to 90fd212 Compare July 30, 2026 11:16
@danielroe
danielroe enabled auto-merge July 30, 2026 11:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/nuxt/src/pages/module.ts (1)

785-795: 🎯 Functional Correctness | 🟠 Major | ⚑ Quick win

Propagate parent aliases when evaluating child pages.

markPages checks a page’s aliases, but line 794 recurses into children using only the canonical path. If a parent page also has an alias, Vue Router will render the child under that aliased path too, and markPages does not evaluate the child against that route. This can mark an aliased scripted child as _noScripts and strip its client chunk incorrectly; recurse against every resolved parent prefix, including canonical and aliased paths, and add a regression test with differing noScripts rules for the canonical and aliased child routes.

πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nuxt/src/pages/module.ts` around lines 785 - 795, Update markPages
so child pages are recursively evaluated under every resolved parent prefix: the
canonical path and each resolved alias, rather than only path. Combine the
recursive results with the current page’s noScripts status so a scripted child
under any parent route prevents incorrect _noScripts marking, and add a
regression test covering differing noScripts rules for canonical and aliased
child routes.
packages/nuxt/src/pages/utils.ts (1)

551-565: 🎯 Functional Correctness | 🟠 Major | πŸ—οΈ Heavy lift

Keep page-meta imports server-only for _noScripts routes.

This guard only prevents component loading. metaRoute still references metaImportName (Lines 583-589), so Line 651 adds the page’s ?macro=true module to the client route table. That module can retain imports and declarations required for dynamic metadata, allowing page code to execute client-side despite noScripts. Omit or server-guard macro metadata imports for these routes too.

πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nuxt/src/pages/utils.ts` around lines 551 - 565, The `_noScripts`
guard currently limits only component loading while page-meta macro imports
still enter the client route table. Update the metadata import handling around
`metaRoute` and `metaImportName` so `?macro=true` imports are omitted or
server-guarded whenever `page._noScripts` is true, while preserving normal
metadata behavior for other routes.
πŸ€– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/nuxt/src/pages/module.ts`:
- Around line 785-795: Update markPages so child pages are recursively evaluated
under every resolved parent prefix: the canonical path and each resolved alias,
rather than only path. Combine the recursive results with the current page’s
noScripts status so a scripted child under any parent route prevents incorrect
_noScripts marking, and add a regression test covering differing noScripts rules
for canonical and aliased child routes.

In `@packages/nuxt/src/pages/utils.ts`:
- Around line 551-565: The `_noScripts` guard currently limits only component
loading while page-meta macro imports still enter the client route table. Update
the metadata import handling around `metaRoute` and `metaImportName` so
`?macro=true` imports are omitted or server-guarded whenever `page._noScripts`
is true, while preserving normal metadata behavior for other routes.

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 91bf008f-d7a8-4a58-bd90-a7f48d36a3c6

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 933d703 and 90fd212.

β›” Files ignored due to path filters (3)
  • packages/nuxt/package.json is excluded by !**/package.json
  • packages/vite/package.json is excluded by !**/package.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
πŸ“’ Files selected for processing (23)
  • packages/nuxt/src/compiler/module.ts
  • packages/nuxt/src/compiler/plugins/keyed-function-factories.ts
  • packages/nuxt/src/components/module.ts
  • packages/nuxt/src/components/plugins/islands-transform.ts
  • packages/nuxt/src/components/plugins/lazy-hydration-transform.ts
  • packages/nuxt/src/components/plugins/loader.ts
  • packages/nuxt/src/components/scan.ts
  • packages/nuxt/src/core/app.ts
  • packages/nuxt/src/core/external-config-files.ts
  • packages/nuxt/src/core/nuxt.ts
  • packages/nuxt/src/core/perf.ts
  • packages/nuxt/src/core/plugins/plugin-metadata.ts
  • packages/nuxt/src/core/schema.ts
  • packages/nuxt/src/head/plugins/unhead-imports.ts
  • packages/nuxt/src/imports/module.ts
  • packages/nuxt/src/pages/module.ts
  • packages/nuxt/src/pages/plugins/page-meta.ts
  • packages/nuxt/src/pages/utils.ts
  • packages/nuxt/src/utils.ts
  • packages/nuxt/test/page-metadata.test.ts
  • packages/nuxt/test/utils.test.ts
  • packages/vite/src/plugins/optimize-deps-hint.ts
  • pnpm-workspace.yaml
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/nuxt/src/compiler/plugins/keyed-function-factories.ts
  • packages/nuxt/src/components/scan.ts
  • packages/nuxt/src/head/plugins/unhead-imports.ts
  • packages/nuxt/src/core/app.ts
  • packages/nuxt/src/core/perf.ts
  • packages/nuxt/src/components/plugins/loader.ts
  • packages/nuxt/src/core/nuxt.ts

@danielroe
danielroe added this pull request to the merge queue Jul 30, 2026
Merged via the queue into main with commit 3d12b78 Jul 30, 2026
34 checks passed
@danielroe
danielroe deleted the feat/clickable-paths branch July 30, 2026 12:51
@github-actions github-actions Bot mentioned this pull request Jul 30, 2026
2 of 5 tasks
@github-actions github-actions Bot mentioned this pull request Aug 12, 2026
@github-actions github-actions Bot mentioned this pull request Aug 12, 2026
@github-actions github-actions Bot mentioned this pull request Aug 28, 2026
@github-actions github-actions Bot mentioned this pull request Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.x ✨ enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant