ReadonlyapiThe Public API - the plugin's toolbox. Contains all high-level helpers for analysis and transformation.
This is THE critical design decision: Plugins don't implement low-level logic. They consume the API.
ReadonlyconfigPlugin-specific configuration. Allows users to customize plugin behavior.
ReadonlyfileFile path for convenience (derived from sourceFile).
Optional ReadonlyoptionsTransform-specific options.
OptionalautoSave?: booleanWhether to auto-save changes after transformation. Default: true
OptionaldryRun?: booleanWhether to perform a dry-run (no actual changes). Default: false
Optionalformat?: booleanWhether to format code after transformation. Default: true
ReadonlyprojectThe ts-morph Project instance. Provides access to the entire codebase for cross-file analysis.
ReadonlysourceThe source file being operated on. This is the primary entry point for all plugin operations.
ReadonlytypeType discriminator for type safety.
Context for transformation operations. Passed to TransformRule.transform() methods.
Transform contexts allow WRITE operations. Plugins can modify the sourceFile through ts-morph APIs.