mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
29 lines
724 B
JavaScript
Executable File
29 lines
724 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
// -*- mode: js -*-
|
|
"use strict";
|
|
|
|
var transform = require('../main').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.'
|
|
).option(
|
|
'--strip-types',
|
|
'Strips out type annotations.'
|
|
).option(
|
|
'--source-map-inline',
|
|
'Embed inline sourcemap in transformed source'
|
|
).process(function(id, source) {
|
|
// This is where JSX, ES6, etc. desugaring happens.
|
|
var options = {
|
|
harmony: this.options.harmony,
|
|
sourceMap: this.options.sourceMapInline,
|
|
stripTypes: this.options.stripTypes
|
|
};
|
|
return transform(source, options);
|
|
});
|