forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsx
More file actions
executable file
·24 lines (22 loc) · 667 Bytes
/
jsx
File metadata and controls
executable file
·24 lines (22 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env node
// -*- mode: js -*-
"use strict";
var visitors = require('../vendor/fbtransform/visitors');
var transform = require('jstransform').transform;
require('commoner').version(
require('../package.json').version
).resolve(function(id) {
return this.readModuleP(id);
}).option(
'--harmony',
'Turns on JS transformations such as ES6 Classes etc.'
).process(function(id, source) {
// This is where JSX, ES6, etc. desugaring happens.
var visitorList;
if (this.options.harmony) {
visitorList = visitors.getAllVisitors();
} else {
visitorList = visitors.transformVisitors.react;
}
return transform(visitorList, source).code;
});