Skip to content

fix: run vue and dts declarations on the builder's typescript - #868

Merged
danielroe merged 1 commit into
mainfrom
ts-fix
Nov 29, 2026
Merged

danielroe merged 1 commit into
mainfrom
ts-fix

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

when a module resolves typescript to TypeScript 7 (for example when it comes in from a peer) and has @typescript/typescript6 installed, the declaration build crashes instead of using it:

TypeError: ts.parseConfigFileTextToJson is not a function

this adopts nuxt-contrib/vue-sfc-transformer#376 to pass a typescript to emitVueDeclarations

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedvue-sfc-transformer@​0.3.5 ⏵ 0.3.699100100 +193 +1100

View full report

@pkg-pr-new

pkg-pr-new Bot commented Nov 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nuxt/module-builder/@nuxt/module-builder@868

commit: ea3b74d

@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Declaration generation now uses the TypeScript API selected by loadTypescript() for Vue files and declaration-worker imports. The worker resolves TypeScript subpaths from the selected installation and uses its version in the cache key. Documentation and tests cover TypeScript selection, TypeScript 7 fixture scenarios, peer resolution, and a missing-package error.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: Minimal · up to ea3b7 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the vue and dts declaration builds now run on the builder's TypeScript instance instead of a resolved module copy. The changeset matches this. The src/tsdown/dts.ts wo…
Description check Passed The description is related to the changeset. It explains the failure, where a module resolves typescript to TypeScript 7 and the declaration build crashes with TypeError: ts.parseConfigFileTextToJson …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the vue and dts declaration builds now run on the builder's TypeScript instance instead of a resolved module copy. The changeset matches this. The src/tsdown/dts.ts worker redirects typescript imports to the instance from loadTypescript(), src/transpile/vue.ts passes that instance to emitVueDeclarations, and the test file covers the TypeScript 7 peer case. The title follows the conventional 'fix:' form and is specific enough for a teammate to scan.

Full details: Description check

Explanation

The description is related to the changeset. It explains the failure, where a module resolves typescript to TypeScript 7 and the declaration build crashes with TypeError: ts.parseConfigFileTextToJson is not a function. It also states the fix, which passes a TypeScript instance to emitVueDeclarations and matches the src/transpile/vue.ts change. The linked issue section is an unfilled template placeholder, but that does not make the description off-topic.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/diagnostics.ts

Parsing error: Unexpected token {

src/transpile/typescript.ts

Parsing error: Unexpected token interface

src/transpile/vue.ts

Parsing error: Unexpected token {

  • 2 others

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 894b2354-ad49-4d1d-a833-fe48606eaec9
Commits

Reviewing files that changed from the base of the PR and between be7b1fc and ea3b74d.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 8

  • docs/4.configuration.md
  • package.json
  • pnpm-workspace.yaml
  • src/diagnostics.ts
  • src/transpile/typescript.ts
  • src/transpile/vue.ts
  • src/tsdown/dts.ts
  • test/engines.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@danielroe
danielroe added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit 3ac7e7f Nov 29, 2026
14 checks passed
@danielroe
danielroe deleted the ts-fix branch November 29, 2026 18:53
This was referenced Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant