Skip to content

Conversation

@danielroe
Copy link
Member

🔗 Linked issue

resolves #33773

📚 Description

@bolt-new-by-stackblitz
Copy link

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 27, 2025

Open in StackBlitz

@nuxt/kit

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

@nuxt/nitro-server

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

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit: f2b2ffa

@coderabbitai
Copy link

coderabbitai bot commented Nov 27, 2025

Walkthrough

The pull request modifies module installation and template generation logic across two files. In packages/kit/src/module/install.ts, the option collection mechanism during module installation is extended to include sources from meta.name alongside existing moduleToInstall and configKey sources, with options then merged using defu into nuxt.options[configKey]. In packages/nuxt/src/core/templates.ts, the moduleDependencies construction is updated to pass the full module object to the flatMap callback, and the dependency key generation is changed from using importName to using mod.meta.name with importName as a fallback.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Logic flow changes in option collection and merging strategy require careful verification of the defu application and configuration precedence
  • Module dependency key generation change affects how modules are identified in the generated schema; the fallback logic and meta.name availability assumptions need validation
  • Interconnected changes across two distinct systems (installation and templates) that both introduce meta.name as a new data source
  • Verify that all call sites of moduleDependencies handle the new key format correctly and that the fallback to importName is robust

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: fixing type definitions and making moduleDependencies respect module meta names instead of filesystem paths.
Description check ✅ Passed The description links to the relevant issue (#33773) which documents the problem being solved, making it related to the changeset.
Linked Issues check ✅ Passed The code changes directly address issue #33773 by modifying moduleDependencies to use mod.meta.name instead of importName, ensuring type hints reflect the module's declared name rather than filesystem paths.
Out of Scope Changes check ✅ Passed All changes in both files (install.ts and templates.ts) are focused on addressing the linked issue's objective of using module meta names in moduleDependencies typing.
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
  • Commit unit tests in branch fix/dependency-types

📜 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 1ec99e9 and f2b2ffa.

📒 Files selected for processing (2)
  • packages/kit/src/module/install.ts (1 hunks)
  • packages/nuxt/src/core/templates.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/module/install.ts
  • packages/nuxt/src/core/templates.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/module/install.ts
  • packages/nuxt/src/core/templates.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: GalacticHypernova
Repo: nuxt/nuxt PR: 26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.
📚 Learning: 2024-11-05T15:22:54.759Z
Learnt from: GalacticHypernova
Repo: nuxt/nuxt PR: 26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.

Applied to files:

  • packages/kit/src/module/install.ts
  • packages/nuxt/src/core/templates.ts
📚 Learning: 2024-12-12T12:36:34.871Z
Learnt from: huang-julien
Repo: nuxt/nuxt PR: 29366
File: packages/nuxt/src/app/components/nuxt-root.vue:16-19
Timestamp: 2024-12-12T12:36:34.871Z
Learning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:

```js
const IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null
```

instead of wrapping the import in a computed property or importing the component unconditionally.

Applied to files:

  • packages/kit/src/module/install.ts
⏰ 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). (18)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, rspack, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, rspack, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite-env-api, async, manifest-on, json, lts/-1)
  • GitHub Check: release-pkg-pr-new
  • GitHub Check: test-benchmark
  • GitHub Check: typecheck (ubuntu-latest, bundler)
  • GitHub Check: typecheck (windows-latest, bundler)
  • GitHub Check: code
🔇 Additional comments (2)
packages/kit/src/module/install.ts (1)

129-146: LGTM! Option collection now includes meta.name.

The expanded option gathering correctly includes options sourced from meta?.name alongside existing moduleToInstall and configKey sources. This aligns with the PR objective to respect module metadata names in dependency resolution. The optional chaining on line 131 appropriately handles cases where meta?.name might be undefined, and the defu merge order correctly applies overrides, current config, and defaults.

packages/nuxt/src/core/templates.ts (1)

283-285: Optional chaining on mod.meta.name is unnecessary and the current code is correct.

The review comment incorrectly suggests using optional chaining for consistency, but the code already handles this correctly:

  • Line 235-236 includes a runtime guard that filters modules ensuring mod.meta.name exists: if (!m.meta || !m.meta.configKey || !m.meta.name) { continue }
  • Line 284 correctly uses direct access mod.meta.name because the guard guarantees it's defined
  • Line 280 correctly uses optional chaining mod.meta?.rawPath because rawPath is not checked in the guard and remains optional

The comparison to install.ts line 131 is misleading—that code uses meta?.name on a function parameter that could be undefined, whereas line 284 operates on a narrowed type after filtering. These are different contexts. TypeScript should properly narrow the type after the guard clause, making optional chaining redundant and potentially masking the type guarantee.

The current implementation is consistent and correct as written.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Tip

✨ Issue Enrichment is now available for GitHub issues!

CodeRabbit can now help you manage issues more effectively:

  • Duplicate Detection — Identify similar or duplicate issues
  • Related Issues & PRs — Find relevant issues and PR's from your repository
  • Suggested Assignees — Find the best person to work on the issue
  • Implementation Planning — Generate detailed coding plans for engineers and agents
Disable automatic issue enrichment

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

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.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 27, 2025

CodSpeed Performance Report

Merging #33774 will not alter performance

Comparing fix/dependency-types (f2b2ffa) with main (1ec99e9)

Summary

✅ 10 untouched

@danielroe danielroe merged commit cdce631 into main Nov 27, 2025
56 checks passed
@danielroe danielroe deleted the fix/dependency-types branch November 27, 2025 12:59
@github-actions github-actions bot mentioned this pull request Nov 25, 2025
@github-actions github-actions bot mentioned this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

local module name should be typed in moduleDependencies

2 participants