license fileoverview import * as ts from 'typescript' ; export interface PluginCompilerHost extends ts . CompilerHost { /**
     * Absolute file paths which should be included in the initial ts.Program.
     * In vanilla tsc, these are the ts.ParsedCommandLine#fileNames
     */ inputFiles : ReadonlyArray < string > ; } /**
 * This API is simpler than LanguageService plugins.
 * It's used for plugins that only target the command-line and never run in an
 * editor context.
 *
 * One instance of the TscPlugin will be created for each execution of the compiler, so it is
 * safe for these plugins to hold state that's local to one execution.
 *
 * The methods on the plugin will be called in the order shown below:
 * - wrapHost to intercept CompilerHost methods and contribute inputFiles to the program
 * - setupCompilation to capture the ts.Program
 * - createTransformers once it's time to emit
 */ export interface EmitPlugin { param inputFiles param compilerHost wrapHost ? ( compilerHost , inputFiles , options ) : PluginCompilerHost ; setupCompilation ( program , oldProgram ? ) : { ignoreForDiagnostics : Set < ts . SourceFile > ; ignoreForEmit : Set < ts . SourceFile > ; } ; getNextProgram ? ( ) : ts . Program ; /**
     * Allow plugins to contribute additional TypeScript CustomTransformers.
     * These can modify the TS AST, JS AST, or .d.ts output AST.
     */ createTransformers ( ) : ts . CustomTransformers ; } /**
 * The proxy design pattern, allowing us to customize behavior of the delegate
 * object.
 * This creates a property-by-property copy of the object, so it can be mutated
 * without affecting other users of the original object.
 * See https://en.wikipedia.org/wiki/Proxy_pattern
 */ export function createProxy < T > ( delegate ) { const proxy = Object . create ( null ) ; for ( const k of Object . keys ( delegate ) ) { proxy [ k ] = function ( ) { return ( delegate as any ) [ k ] . apply ( delegate , arguments ) ; } ; } return proxy ; } /**
 * A plugin that contributes additional diagnostics during compilation.
 *
 * This is a more limited API than Plugin, which can overwrite any features of
 * the Program. A DiagnosticPlugin can't affect the output, and can only reject
 * otherwise valid programs.
 *
 * This means that disabling a DiagnosticPlugin is always safe. It will not
 * break any downstream projects, either at build time or in production.
 *
 * It also lets us instrument the plugin to track performance, and tag the
 * diagnostics it emits with the plugin name.
 */ export interface DiagnosticPlugin { /**
     * A brief descriptive name for the plugin.
     *
     * Should not include 'ts', 'typescript', or 'plugin'.
     */ readonly name : string ; /**
     * Return diagnostics for the given file.
     *
     * Should only include new diagnostics that your plugin is contributing.
     * Should not include diagnostics from program.
     */ getDiagnostics ( sourceFile ) : ReadonlyArray < Readonly < ts . Diagnostic > > ; }