@ts-bridge/cli
Version:
Bridge the gap between ES modules and CommonJS modules with an easy-to-use alternative to `tsc`.
40 lines • 1.6 kB
TypeScript
import type { SourceFile, TransformerFactory, ResolutionMode } from 'typescript';
import type { TransformerOptions } from './transformers.js';
/**
* The type of build to generate.
*
* - `module` - Build as an ES module.
* - `commonjs` - Build as a CommonJS module.
*/
export type BuildType = 'module' | 'commonjs';
/**
* Options for different build types.
*
* @property extension - The file extension for the output files.
* @property declarationExtension - The file extension for the declaration
* files.
* @property compilerOptions - The compiler options to use for the build type.
* This will be merged with the project's `tsconfig.json` file.
* @property getTransformers - Get the transformers to use for the build type.
* @property getShimsTransformers - Get the transformers to use for the build
* when the `@ts-bridge/shims` package is installed.
*/
export type BuildTypeOptions = {
name: string;
extension: string;
declarationExtension: string;
sourceExtension: string;
target: ResolutionMode;
getTransformers: (options: TransformerOptions) => TransformerFactory<SourceFile>[];
getShimsTransformers: (options: TransformerOptions) => TransformerFactory<SourceFile>[];
};
export declare const BUILD_TYPES: Record<BuildType, BuildTypeOptions>;
/**
* Get the options for a build type.
*
* @param type - The build type to get the options for.
* @returns The options for the build type.
* @throws If the build type is unknown.
*/
export declare function getBuildTypeOptions(type: BuildType): BuildTypeOptions;
//# sourceMappingURL=build-type.d.ts.map