UNPKG

1.01 kBTypeScriptView Raw
1import type * as ts from 'typescript';
2import type { Service } from '../index';
3/**
4 * Third-party transpilers are implemented as a CommonJS module with a
5 * named export "create"
6 *
7 * @category Transpiler
8 */
9export interface TranspilerModule {
10 create: TranspilerFactory;
11}
12/**
13 * Called by ts-node to create a custom transpiler.
14 *
15 * @category Transpiler
16 */
17export declare type TranspilerFactory = (options: CreateTranspilerOptions) => Transpiler;
18/** @category Transpiler */
19export interface CreateTranspilerOptions {
20 service: Pick<Service, Extract<'config' | 'options' | 'projectLocalResolveHelper', keyof Service>>;
21}
22/** @category Transpiler */
23export interface Transpiler {
24 transpile(input: string, options: TranspileOptions): TranspileOutput;
25}
26/** @category Transpiler */
27export interface TranspileOptions {
28 fileName: string;
29}
30/** @category Transpiler */
31export interface TranspileOutput {
32 outputText: string;
33 diagnostics?: ts.Diagnostic[];
34 sourceMapText?: string;
35}