0.2.5 • Published 2 years ago

rollup-plugin-awesome-typescript v0.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Makes development with Rollup and TypeScript awesome!

  • 👁️ Almighty watch mode
    Monitors all contributing files, including type-only imports as well as declaration and configuration files.
  • 🦄 Delightful error messages
    Detailed and beautifully formatted error messages display the erroneous code as well as its surroundings to provide more context on what went wrong.
  • 🏃 Blazing fast rebuilds
    Uses a lightweight wrapper around TypeScript's incremental builder to achieve nearly the same speed as the TypeScript compiler itself would.
  • 🤝 Tight TSConfig integration
    Respects the options set in your TSConfig. This includes using the same filters (include, exclude and files), automatically resolving path aliases and creating declaration files.

npm libera manifesto


Installation

npm i -D rollup-plugin-awesome-typescript typescript tslib

Note: Awesome TypeScript requires you to install both typescript (≥ 4.5.2) and tslib (≥ 2.4.0) separately or provide your own compatible implementations for them (using the plugin options)

Usage

Just import and include the plugin in your Rollup configuraton file and you're good to go.

import { awesomeTypescript } from "rollup-plugin-awesome-typescript";

export default {
  plugins: [
    awesomeTypescript({
      // plugin options go here
    })
  ]
};

Plugin Options

check

Type: boolean
Default: true

Specifies whether to enable type checking.

cwd

Type: string
Default: process.cwd()

Specifies the current working directory.

context

Type: string
Default: directory containing the TSConfig

Specifies the base path used to parse the TSConfig. Relative paths within the TSConfig are resolved with respect to this path.

config

Type: string | false
Default: "tsconfig.json"

Specifies which TSConfig should be used. Can be one of the following:

  • A relative or absolute path
  • A filename to search for in the directory tree, starting from the current working directory
  • false to disable the usage of a TSConfig

compilerOptions

Type: object
Default: ✗

Overrides the TSConfig compiler options.

logLevel

Type: LogLevel
Default: LogLevel.Info

Specifies the log level to which the log output should be restricted. Can be one of the following:

  • LogLevel.Error
  • LogLevel.Warn
  • LogLevel.Info
import { LogLevel } from "rollup-plugin-awesome-typescript";

awesomeTypescript({
  logLevel: LogLevel.Error
});

compiler

Type: object
Default: peer dependency

Overrides the compiler used for transpilation with the specified instance.

awesomeTypescript({
  compiler: require("typescript")
});

helpers

Type: string
Default: peer dependency

Overrides the injected helper library. Must be a relative or absolute path pointing to an ES Module.

awesomeTypescript({
  helpers: require.resolve("tslib")
});

declarations

Type: string | boolean
Default: TSConfig options

Overrides the TSConfig options that determine if and where to store incremental compilation information. Can be one of the following:

  • A directory name, relative or absolute path to enable the output at the specified location
  • true to enable the output using "declarationDir" of the TSConfig as the location
  • false to explicitly disable the output of declaration files

If undefined, the corresponding options in the TSConfig are used as is.

buildInfo

Type: string | boolean
Default: TSConfig options

Overrides the TSConfig options that determine if and where to output declaration files. Can be one of the following:

  • A directory name, relative or absolute path to enable the output at the specified location
  • true to enable the output using "tsBuildInfoFile" in the TSConfig as the
  • location
  • false to explicitly disable the output of declaration files

TSConfig Options

While Awesome TypeScript respects your TSConfig options, some of them must be overridden to work with Rollup, or are ignored because they are managed by Rollup itself.

Forced options:

  • noEmit (false):
    TypeScript must emit code for this plugin to work
  • noResolve (false):
    Not resolving modules may brake compilation
  • noEmitHelpers (false), importHelpers (true):
    The helper library must be included for the final code to work
  • inlineSourceMap (false):
    Inline source maps are not supported by Rollup

Ignored options:

  • out, outFile:
    Bundles are managed by Rollup
0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago