Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
inData.push(data || '');
try {
var o = JSON.parse(inData.join(''));
/*
o.source
o.options
o.file
o.originalFile
*/
traceur.options = o.options;
traceur.options.sourceMaps = true;
traceur.options.modules = 'parse';
var reporter = new traceur.util.ErrorReporter();
reporter.reportMessageInternal = function(location, kind, format, args) {
process.stdout.write(JSON.stringify({ err: kind + '\n' + o.file + location }));
process.exit(0);
}
var parser = new traceur.syntax.Parser(reporter, new traceur.syntax.SourceFile(o.file, o.source));
var tree = parser.parseModule();
var project = new traceur.semantics.symbols.Project(o.file);
var transformer = new traceur.codegeneration.ProgramTransformer(reporter, project);
tree = transformer.transform(tree);
// generate source
var sourceMapGenerator = new traceur.outputgeneration.SourceMapGenerator({ file: o.originalFile });
var opt = { sourceMapGenerator: sourceMapGenerator };
var traceur = require('traceur');
// this hack is needed because the traceur developers have made the
// command line compiler modules private. without this we won't get
// the automatic dependency resolution done by parsing the modules
// 'import' statements.
try {
var modPath = path.resolve('node_modules/grunt-traceur-build/node_modules/traceur/src/node/inline-module');
} catch (e) {
var modPath = path.resolve('node_modules/traceur/src/node/inline-module');
}
var inlineAndCompileSync = require(modPath).inlineAndCompileSync;
var TreeWriter = traceur.outputgeneration.TreeWriter;
var SourceMapGenerator = traceur.outputgeneration.SourceMapGenerator;
var TestErrorReporter = traceur.util.TestErrorReporter;
var Project = traceur.semantics.symbols.Project;
var SourceFile = traceur.syntax.SourceFile;
var NAME = 'traceur_build';
var DESC =
'Compiles ECMAScript 6 (harmony) files, optionally merging and ' +
'generating source maps.';
function generateIncludeFile(files) {
var rv = [];
files.forEach(function(f) {
rv.push('module ' + traceur.generateNameForUrl(f) + ' from "' + f + '"');
});
return rv.join('\n');
}
initialize: function(config) {
this.config = config;
this.processors = [];
this.options = new Traceur.util.CommandOptions();
},