This repository was archived by the owner on Sep 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathindex.ts
41 lines (36 loc) · 2.1 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import * as ts from 'typescript';
import { compile } from './compiler';
import { reactJSMakePropsAndStateInterfaceTransformFactoryFactory } from './transforms/react-js-make-props-and-state-transform';
import { reactRemovePropTypesAssignmentTransformFactoryFactory } from './transforms/react-remove-prop-types-assignment-transform';
import { reactMovePropTypesToClassTransformFactoryFactory } from './transforms/react-move-prop-types-to-class-transform';
import { collapseIntersectionInterfacesTransformFactoryFactory } from './transforms/collapse-intersection-interfaces-transform';
import { reactRemoveStaticPropTypesMemberTransformFactoryFactory } from './transforms/react-remove-static-prop-types-member-transform';
import { reactStatelessFunctionMakePropsTransformFactoryFactory } from './transforms/react-stateless-function-make-props-transform';
import { reactRemovePropTypesImportTransformFactoryFactory } from './transforms/react-remove-prop-types-import';
export {
reactMovePropTypesToClassTransformFactoryFactory,
reactJSMakePropsAndStateInterfaceTransformFactoryFactory,
reactStatelessFunctionMakePropsTransformFactoryFactory,
collapseIntersectionInterfacesTransformFactoryFactory,
reactRemovePropTypesAssignmentTransformFactoryFactory,
reactRemoveStaticPropTypesMemberTransformFactoryFactory,
reactRemovePropTypesImportTransformFactoryFactory,
compile,
};
export const allTransforms = [
reactMovePropTypesToClassTransformFactoryFactory,
reactJSMakePropsAndStateInterfaceTransformFactoryFactory,
reactStatelessFunctionMakePropsTransformFactoryFactory,
collapseIntersectionInterfacesTransformFactoryFactory,
reactRemovePropTypesAssignmentTransformFactoryFactory,
reactRemoveStaticPropTypesMemberTransformFactoryFactory,
reactRemovePropTypesImportTransformFactoryFactory,
];
export type TransformFactoryFactory = (typeChecker: ts.TypeChecker) => ts.TransformerFactory<ts.SourceFile>;
/**
* Run React JavaScript to TypeScript transform for file at `filePath`
* @param filePath
*/
export function run(filePath: string): string {
return compile(filePath, allTransforms);
}