Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
process.stdin.on('end', function(data) {
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
process.stdin.on('end', function(data) {
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 });
.then(function() {
if (!options.transpile)
return;
var traceur = require('traceur');
traceur.options.sourceMaps = true;
traceur.options.modules = 'instantiate';
try {
var compiler = new traceur.Compiler({
moduleName: '',
modules: 'instantiate'
});
source = compiler.compile(source, relFile, path.basename(relFile.replace(/\.js$/, '.src.js')));
sourceMap = compiler.getSourceMap();
}
catch(e) {
// an error in one compiled file doesn't stop all compilation
if (!e.stack)
compileErrors += + '\n';
else
.then(function() {
if (!options.transpile)
return;
var traceur = require('traceur');
traceur.options.sourceMaps = true;
traceur.options.modules = 'instantiate';
try {
var compiler = new traceur.Compiler({
moduleName: '',
modules: 'instantiate'
});
source = compiler.compile(source, relFile, path.basename(relFile.replace(/\.js$/, '.src.js')));
sourceMap = compiler.getSourceMap();
}
catch(e) {
// an error in one compiled file doesn't stop all compilation
if (!e.stack)
compileErrors += + '\n';
process.stdin.on('end', function(data) {
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);
generators: true,
modules: true,
blockBinding: false,
privateNameSyntax: false,
privateNames: false,
cascadeExpression: false,
trapMemberLookup: false,
deferredFunctions: false,
propertyOptionalComma: false,
types: false
});
traceur.options.reset();
for (var k in options) {
if (k in traceur.options) traceur.options[k] = options[k];
}
this.files.forEach(function(f) {
if (/\.js$/.test(f.orig.dest)) {
buildToFile(grunt, options, f);
} else {
buildToDirectory(grunt, options, f);
}
});
});
};
restParameters: true,
spread: true,
generatorComprehension: true,
generators: true,
modules: true,
blockBinding: false,
privateNameSyntax: false,
privateNames: false,
cascadeExpression: false,
trapMemberLookup: false,
deferredFunctions: false,
propertyOptionalComma: false,
types: false
});
traceur.options.reset();
for (var k in options) {
if (k in traceur.options) traceur.options[k] = options[k];
}
this.files.forEach(function(f) {
if (/\.js$/.test(f.orig.dest)) {
buildToFile(grunt, options, f);
} else {
buildToDirectory(grunt, options, f);
}
});
});
};
].forEach(function (k) { traceur.options[k] = true; });
}();