@rollup/plugin-typescript

  • Version 12.3.0
  • Published
  • 160 kB
  • 2 dependencies
  • MIT license

Install

npm i @rollup/plugin-typescript
yarn add @rollup/plugin-typescript
pnpm add @rollup/plugin-typescript

Overview

Seamless integration between Rollup and TypeScript.

Index

Functions

function typescript

typescript: (options?: RollupTypescriptOptions) => Plugin;
  • Seamless integration between Rollup and Typescript.

Interfaces

interface FlexibleCompilerOptions

interface FlexibleCompilerOptions extends CompilerOptions {}

    index signature

    [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined | any;

      interface ProgramTransformerFactory

      interface ProgramTransformerFactory<T extends TransformerStage> {}

        property type

        type: 'program';

          method factory

          factory: (
          program: Program,
          getProgram?: () => Program
          ) => StagedTransformerFactory<T>;
          • Factory receives the current Program and may also receive a getter for retrieving the Program at call time. The getter may be provided in all modes. In non-watch it returns the same Program as the first argument. In watch mode: - When recreateTransformersOnRebuild is enabled (plugin option), the getter reflects the latest Program across rebuilds. - When disabled (default, legacy behavior), factories are reused and the getter refers to the initial Program from when the factory was created. The second parameter remains optional for backwards compatibility with existing transformer factories.

          interface RollupTypescriptPluginOptions

          interface RollupTypescriptPluginOptions {}

            property cacheDir

            cacheDir?: string;
            • If using incremental this is the folder where the cached files will be created and kept for Typescript incremental compilation.

            property compilerOptions

            compilerOptions?: PartialCompilerOptions;
            • Pass additional compiler options to the plugin.

            property exclude

            exclude?: FilterPattern;
            • Determine which files are ignored by Typescript

            property filterRoot

            filterRoot?: string | false;

            property include

            include?: FilterPattern;
            • Determine which files are transpiled by Typescript (all .ts and .tsx files by default).

            property noForceEmit

            noForceEmit?: boolean;
            • Override force setting of noEmit and emitDeclarationOnly and use what is defined in tsconfig.json

            property outputToFilesystem

            outputToFilesystem?: boolean;
            • When set to false, force non-cached files to always be emitted in the output directory.output If not set, will default to true with a warning.

            property recreateTransformersOnRebuild

            recreateTransformersOnRebuild?: boolean;
            • Advanced: when true, recreate custom transformer factories on each TypeScript watch rebuild so that program/typeChecker-based factories are rebuilt and getProgram() (when used) reflects the latest Program across rebuilds. Defaults to false (legacy behavior), which reuses factories for the lifetime of the watch session.

            property transformers

            transformers?:
            | CustomTransformerFactories
            | ((program: Program) => CustomTransformers);
            • TypeScript custom transformers

            property tsconfig

            tsconfig?: string | false;
            • When set to false, ignores any options specified in the config file. If set to a string that corresponds to a file path, the specified file will be used as config file.

            property tslib

            tslib?: Promise<string> | string;
            • Overrides the injected TypeScript helpers with a custom version.

            property typescript

            typescript?: typeof _typescript;
            • Overrides TypeScript used for transpilation

            interface TypeCheckerTransformerFactory

            interface TypeCheckerTransformerFactory<T extends TransformerStage> {}

              property type

              type: 'typeChecker';

                method factory

                factory: (typeChecker: TypeChecker) => StagedTransformerFactory<T>;

                  Type Aliases

                  type CustomTransformerFactories

                  type CustomTransformerFactories = {
                  [stage in TransformerStage]?: Array<TransformerFactory<stage>>;
                  };

                    type ElementType

                    type ElementType<T extends Array<any> | undefined> = T extends (infer U)[]
                    ? U
                    : never;

                      type EnumCompilerOptions

                      type EnumCompilerOptions =
                      | 'module'
                      | 'moduleResolution'
                      | 'newLine'
                      | 'jsx'
                      | 'target';
                      • Properties of CompilerOptions that are normally enums

                      type JsonCompilerOptions

                      type JsonCompilerOptions = Omit<FlexibleCompilerOptions, EnumCompilerOptions> &
                      Record<EnumCompilerOptions, string>;
                      • JSON representation of Typescript compiler options

                      type PartialCompilerOptions

                      type PartialCompilerOptions =
                      | Partial<FlexibleCompilerOptions>
                      | Partial<JsonCompilerOptions>;
                      • Compiler options set by the plugin user.

                      type RollupTypescriptOptions

                      type RollupTypescriptOptions = RollupTypescriptPluginOptions &
                      PartialCompilerOptions;

                        type StagedTransformerFactory

                        type StagedTransformerFactory<T extends TransformerStage> = ElementType<
                        CustomTransformers[T]
                        >;

                          type TransformerFactory

                          type TransformerFactory<T extends TransformerStage> =
                          | StagedTransformerFactory<T>
                          | ProgramTransformerFactory<T>
                          | TypeCheckerTransformerFactory<T>;

                            type TransformerStage

                            type TransformerStage = keyof CustomTransformers;

                              Package Files (1)

                              Dependencies (2)

                              Dev Dependencies (7)

                              Peer Dependencies (3)

                              Badge

                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@rollup/plugin-typescript.

                              • Markdown
                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@rollup/plugin-typescript)
                              • HTML
                                <a href="https://www.jsdocs.io/package/@rollup/plugin-typescript"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>