@sapphire/docusaurus-plugin-ts2esm2cjs
Version:
Docusaurus Remark plugin for converting TypeScript code to ESM and CJS code
23 lines (18 loc) • 687 B
text/typescript
import { Plugin } from 'unified';
import { Options } from 'prettier';
import { CompilerOptions } from 'typescript';
interface PluginOptions {
sync?: boolean;
prettierOptions?: Options;
typescriptCompilerOptions?: CompilerOptions;
}
/**
* Transforms input TypeScript code to ESM code.
* @param input The TypeScript code to transform
* @param options The plugin options
* @returns The transformed code (ESM)
*/
declare function ts2esm(input: string, options: PluginOptions): string;
declare function esm2cjs(input: string, options: PluginOptions): string;
declare const ts2esm2cjs: Plugin<[PluginOptions?]>;
export { type PluginOptions, esm2cjs, ts2esm, ts2esm2cjs };