Skip to content

feat(pack): generate declarations with bundled tsrs without typescript - #3433

Draft
fengmk2 wants to merge 3 commits into
mainfrom
codex/tsdown-native-design
Draft

fengmk2 wants to merge 3 commits into
mainfrom
codex/tsdown-native-design

Conversation

@fengmk2

@fengmk2 fengmk2 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Projects that do not install typescript cannot generate declarations with vp pack today. The build fails with "TypeScript is not installed". Upgrading tsdown alone does not change this, because the declaration plugin never selects tsrs automatically.

With this change, vp pack selects generator: 'tsrs' with the tsrs package that vite-plus already ships for lint, in that case only. All other generator choices stay with upstream, so builds that work today keep their output.

  • The selection runs in the CLI between resolveUserConfig() and buildWithConfigs(), so it also covers declarations that tsdown infers from package.json.
  • It keeps explicit generators, Oxc for isolatedDeclarations (including through extends), Vue and custom languages, and configs without a tsconfig.
  • Without typescript, dts.compilerOptions and dts.tsconfigRaw fail with a diagnostic, because native generators do not apply them to the program.
  • An explicit generator: 'tsrs' also gets the bundled tsrs as dts.tsrs.moduleUrl. Core gets no new dependency.
  • When no generator is set, the plugin's experimental tsrs notice is suppressed, so failOnWarn builds do not fail after a successful emit. One info line names the bundled tsrs version instead.

The RFC covers the design, the tsrs version coupling, release gates, and upstream requests.

Merge order: this PR needs the bundled declaration plugin 0.30 (tsdown 0.23.7, Rolldown 1.3). The current plugin 0.28.8 does not know the tsrs generator. Merge the upgrade first, then add the no-typescript snapshot cases here.

🤖 Generated with Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://codex-tsdown-native-design-viteplus-dev.voidzero-docs.workers.dev (commit f33f818)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://a963eaab-viteplus-dev.voidzero-docs.workers.dev f33f818 2026-11-19T13:12:06.412Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://c71f54de-viteplus-dev.voidzero-docs.workers.dev 1fab03e 2026-11-19T12:15:47.362Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://63e6a7e6-viteplus-dev.voidzero-docs.workers.dev ed9befd 2026-11-18T03:56:39.428Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://39da2467-viteplus-dev.voidzero-docs.workers.dev 73e2953 2026-11-11T09:21:14.726Z Visit the dashboard ↗

@fengmk2
fengmk2 force-pushed the codex/tsrs-lint-bench branch 4 times, most recently from ca179b4 to 6594659 Compare November 16, 2026 15:48
Base automatically changed from codex/tsrs-lint-bench to main November 16, 2026 17:03
@fengmk2
fengmk2 force-pushed the codex/tsdown-native-design branch from 73e2953 to ed9befd Compare November 18, 2026 03:55
fengmk2 and others added 2 commits November 19, 2026 17:22
Select bundled tsrs only where the declaration plugin would fail with
"TypeScript is not installed", and leave every other generator choice
to upstream. Run the selection in the CLI between resolveUserConfig()
and buildWithConfigs(), and pass the CLI's own tsrs as
dts.tsrs.moduleUrl instead of adding a core dependency.

Rebase the baseline on main after #3352, document the tsrs version
coupling and the failOnWarn behavior, and move the tsdown/Rolldown
upgrade and migration rewrites out of scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fengmk2
fengmk2 force-pushed the codex/tsdown-native-design branch from ed9befd to 1fab03e Compare November 19, 2026 12:14
When a `vp pack` build needs declarations and `typescript` does not
resolve from the declaration plugin, select `generator: 'tsrs'` with
the tsrs package that vite-plus ships for lint. Upstream fails with
"TypeScript is not installed" in that case, so builds that work today
keep their generator.

The selection runs after resolveUserConfig(), so it also covers
declarations that tsdown infers from package.json. It keeps explicit
generators, isolated declarations (Oxc), Vue and custom languages, and
configs without a tsconfig. It rejects dts.compilerOptions and
dts.tsconfigRaw without typescript, because native generators ignore
them. An explicit tsrs generator also gets the bundled tsrs moduleUrl.

The plugin's experimental tsrs notice is suppressed when no generator
is set, so failOnWarn builds do not fail after a successful emit. One
info line names the bundled tsrs version instead.

This needs the bundled declaration plugin 0.30 (tsdown 0.23.7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fengmk2 fengmk2 changed the title docs(rfc): design native declarations for vp pack feat(pack): generate declarations with bundled tsrs without typescript Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Staging deployment successful!

Preview: https://viteplus-staging.void.app/
Commit: f33f818

This branch has not been deployed

No deployments
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