@tsbb/babel
Version:
TSBB is a zero-config CLI that helps you develop, test, and publish modern TypeScript project.
66 lines (65 loc) • 2.32 kB
TypeScript
import { type TransformOptions } from '@babel/core';
export * from './utils.js';
export interface BabelCompileOptions {
watch?: boolean;
/**
* The specified entry file, for example:
* @example
* ```js
* entry = [ 'src/index.jsx', 'src/sum.js' ]
* ```
*
* Command example:
*
* ```bash
* $ tsbb build src/*.{jsx,js} --useBabel
* $ tsbb build src/index.jsx --useBabel
* ```
*/
entry?: string[];
/**
* Use this parameter to compile code with `Babel` in a `TypeScript` project,
* where `TS` is only used for type output and not for code compilation without `TS`.
*/
useBabel?: boolean;
/**
* Output "esm" directory.
* @platform `babel`
* @default `esm`
*/
esm?: false | string;
/**
* Output "cjs" directory.
* When outputting types in conjunction with TypeScript, use the outDir configuration in tsconfig.json as the priority.
* If this configuration exists, the --cjs configuration will be invalid.
* @platform `babel`
* @default `lib`
*/
cjs?: false | string;
/**
* The current active environment used during configuration loading.
* This value is used as the key when resolving ["env"](https://babeljs.io/docs/en/options#env) configs,
* and is also available inside configuration functions, plugins, and presets, via the [api.env()](https://babeljs.io/docs/en/config-files#apienv) function.
* > __Only allowed in Babel's programmatic options__
*/
envName?: string;
/**
* @platform `babel`
* @default `false`
*/
useVue?: boolean;
/**
* If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"`
* then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!**
*
* @platform `babel`
* @default `false`
*/
sourceMaps?: TransformOptions['sourceMaps'];
/**
* Exit the compile as soon as the compile fails(default: true).
* @default `true`
*/
bail?: boolean;
}
export default function compile(fileName: string, options?: BabelCompileOptions): Promise<void>;