Skip to content

fix: rolldown support - stop importing from rollup in the published types#218

Open
birkskyum wants to merge 3 commits into
btd:masterfrom
birkskyum:dual-rollup-rolldown-compat
Open

fix: rolldown support - stop importing from rollup in the published types#218
birkskyum wants to merge 3 commits into
btd:masterfrom
birkskyum:dual-rollup-rolldown-compat

Conversation

@birkskyum
Copy link
Copy Markdown

@birkskyum birkskyum commented May 1, 2026

closes #219

Fix

Replaces hard imports of Plugin, OutputOptions, OutputChunk, and GetModuleInfo from "rollup" in plugin/{index,sourcemap,data}.ts with structural stubs in a new plugin/rollup-types.ts. The stubs are subsets of both rollup's and rolldown's types, so visualizer()'s return value still drops cleanly into either bundler's plugins array.

generateBundle is typed => void | Promise<void> (rollup's signature; also accepted by rolldown's stricter => void). Internal types (OutputBundle, NormalizedOutputOptions) keep their import type from "rollup" since they don't leak into the emitted .d.ts.

Test plan

Scenario Before After
rolldown only, no rollup ❌ TS2307 tsc --noEmit exits 0
rollup only, no rolldown ✅ exits 0 ✅ exits 0 (no regression)
both installed ✅ exits 0 ✅ exits 0
npm test ✅ unchanged ✅ 125/125 pass
npm run lint ✅ unchanged ✅ clean
grep 'from "rollup"' dist/ ❌ hits in .d.ts ✅ none

@birkskyum birkskyum marked this pull request as draft May 1, 2026 17:35
@birkskyum birkskyum changed the title fix: dual rollup and rolldown compat fix: stop hard-importing from rollup in the published types May 1, 2026
@birkskyum birkskyum changed the title fix: stop hard-importing from rollup in the published types fix(rolldown compat):stop hard-importing from rollup in the published types May 1, 2026
@birkskyum birkskyum changed the title fix(rolldown compat):stop hard-importing from rollup in the published types fix: support for rolldown - stop importing from rollup in the published types May 1, 2026
@birkskyum birkskyum changed the title fix: support for rolldown - stop importing from rollup in the published types fix: rolldown support - stop importing from rollup in the published types May 1, 2026
@birkskyum birkskyum marked this pull request as ready for review May 1, 2026 17:47
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.

Published types hard-import from rollup despite rollup being declared as an optional peer dependency

1 participant