Skip to content

@rollup/plugin-typescript Support accessing the latest Program in transformers when using watch mode #1892

@zhaohappy

Description

@zhaohappy
  • Rollup Plugin Name: @rollup/plugin-typescript
  • Rollup Plugin Version: 12.1.4

Feature Use Case

When using @rollup/plugin-typescript with custom TypeScript transformers in watch mode, there is no way for the transformer to access the latest ts.Program after an incremental rebuild currently.

This leads to issues in incremental builds where the transformer needs to query symbols, types from the current TypeChecker.

Feature Proposal

It is possible to add a second parameter getProgram to the factory function to get the latest Program.

interface ProgramTransformerFactory<T extends TransformerStage> {
  type: 'program';

  factory(program: Program, getProgram?: () => Program): StagedTransformerFactory<T>;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions