Skip to content

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

Draft
fengmk2 wants to merge 7 commits into
codex/vite-8.4-betafrom
codex/tsdown-native-design
Draft

fengmk2 wants to merge 7 commits into
codex/vite-8.4-betafrom
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:
ℹ Generating declarations with bundled tsrs v7.1.0-beta.tsrs4 (experimental) because `typescript` is not installed
ℹ Build start
ℹ Emit types with tsrs

Projects without typescript get tsrs declarations with pnpm hoist: false and with pnpm's default hoisting. The new command_pack_dts_tsrs and command_pack_dts_tsrs_hoisted cases record both layouts.

The RFC covers the design, the tsrs version coupling, release gates, upstream requests, and the upgrade items that stay open after #3511.

Stacked on #3511, which upgrades to tsdown 0.23.7 and the declaration plugin 0.30.2. The plugin 0.28.8 on main does not know the tsrs generator. Merge #3511 first.

🤖 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 46de882)

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://e7f35fb1-viteplus-dev.voidzero-docs.workers.dev 46de882 2026-11-25T16:47:02.930Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://9a1dc198-viteplus-dev.voidzero-docs.workers.dev afa29d4 2026-11-25T08:01:38.874Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://0347c319-viteplus-dev.voidzero-docs.workers.dev c9bfbf0 2026-11-25T07:40:40.523Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://f0ea8ca6-viteplus-dev.voidzero-docs.workers.dev 568d670 2026-11-25T07:09:42.995Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://c865c9eb-viteplus-dev.voidzero-docs.workers.dev a5ec321 2026-11-25T06:16:16.961Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://37f815e0-viteplus-dev.voidzero-docs.workers.dev b6e30c4 2026-11-23T13:54:01.551Z Visit the dashboard ↗
  • 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 ↗

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 2 times, most recently from ed9befd to 1fab03e Compare November 19, 2026 12:14
@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

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Staging deployment successful!

Preview: https://viteplus-staging.void.app/
Commit: 46de882

@fengmk2
fengmk2 force-pushed the codex/tsdown-native-design branch from f33f818 to b6e30c4 Compare November 23, 2026 13:53
@fengmk2
fengmk2 changed the base branch from main to codex/vite-8.4-beta November 23, 2026 13:53
@fengmk2
fengmk2 force-pushed the codex/tsdown-native-design branch from b6e30c4 to a5ec321 Compare November 25, 2026 06:15
@fengmk2
fengmk2 added this pull request to stack #3574 November 25, 2026 06:15
@fengmk2
fengmk2 force-pushed the codex/tsdown-native-design branch 2 times, most recently from 568d670 to c9bfbf0 Compare November 25, 2026 07:39
@fengmk2
fengmk2 force-pushed the codex/tsdown-native-design branch 2 times, most recently from afa29d4 to 2aa3343 Compare November 25, 2026 16:35
fengmk2 and others added 6 commits November 26, 2026 00:45
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>
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>
#3511 performs the tsdown 0.23.7, declaration plugin 0.30.2,
Rolldown 1.3.3, and Vite 8.4 beta upgrade. Record what it handles
(native-preview, tsgo.path, the TypeScript 7.1 peer range, yuku) and
the upgrade items that stay open (dts.entry, deprecated top-level
options, yuku on musl). Note that tsrs4 also passes the probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add packed-CLI snapshot cases for a project without typescript, with
pnpm hoist:false and with default hoisting. Both select the bundled
tsrs, and the experimental tsrs notice does not fail --fail-on-warn.

Print the tsrs version with a v prefix, like other tool banners, so
snapshot redaction masks it and tsrs updates do not churn the cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rebased base adopts the Cloudflare Oxlint preset (#3562). Type the
selection with the resolved tsdown dts options instead of unknown
records, parse tsconfig files through the shared JSON helpers, and drop
the type assertions in pack-bin and the tests.

Track only the current `extends` path when reading
isolatedDeclarations, so a base that two `extends` entries share is
not reported as a cycle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fengmk2
fengmk2 force-pushed the codex/tsdown-native-design branch from 2aa3343 to 46de882 Compare November 25, 2026 16:46

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