UNPKG

1.1 kBTypeScriptView Raw
1import * as log4js from "log4js";
2import * as ts from "typescript";
3import { Configuration } from "../shared/configuration";
4export interface TransformResult {
5 dirty?: boolean;
6 transpile?: boolean;
7 transformedScript?: boolean;
8}
9export interface TransformCallback {
10 (error: Error, dirty: boolean, transpile?: boolean): void;
11 (error: Error, result: TransformResult): void;
12}
13export interface TransformContextJs {
14 ast: acorn.Node;
15}
16export interface TransformContextTs {
17 version: string;
18 ast: ts.SourceFile;
19 transpiled: string;
20}
21export interface TransformContext {
22 config: Configuration;
23 js?: TransformContextJs;
24 filename: string;
25 module: string;
26 source: string;
27 ts?: TransformContextTs;
28}
29export interface TransformInitializeLogOptions {
30 appenders: {
31 [name: string]: log4js.Appender;
32 };
33 level: string;
34}
35export type TransformInitialize = (log: TransformInitializeLogOptions) => void;
36export interface Transform {
37 (context: TransformContext, callback: TransformCallback): void;
38 initialize?: TransformInitialize;
39}