This repository has been archived by the owner on Dec 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
52 lines (34 loc) · 1.46 KB
/
index.js
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
42
43
44
45
46
47
48
49
50
51
52
'use strict';
import { build, nodes } from 'nodes';
import deshorthandify from './transform/shorthands';
import arrowify from './transform/arrow-functions';
import comprehendify from './transform/comprehensions';
import forofify from './transform/for-of';
import patternify from './transform/patterns';
import defaultify from './transform/default-params';
import classify from './transform/classes';
import restify from './transform/rest-param';
import spreadify from './transform/spread';
import templateify from './transform/template-literals';
import letify from './transform/let-declarations';
import modulize from './transform/modules';
import computify from './transform/computed-properties';
// todo: do not lose loc on replaceChild.
export function transform(tree) {
var program = build(tree);
deshorthandify(program); // remove shorthand properties
arrowify(program); // transform arrow functions
comprehendify(program); // transform comprehensions
forofify(program); // transform for of
patternify(program); // transform patterns
modulize(program); // transform modules
defaultify(program); // transform default parameters
classify(program); // transform classes
computify(program); // transform computed properties
restify(program); // transform rest parameter
spreadify(program); // transform spread
templateify(program); // transform string templates
letify(program); // transform let
return program.toJSON();
}
export default transform;