Comparing version 0.0.78 to 0.0.79
{ | ||
"name": "traceur", | ||
"version": "0.0.78", | ||
"version": "0.0.79", | ||
"description": "ES6 to ES5 compiler", | ||
@@ -43,4 +43,3 @@ "keywords": [ | ||
"commander": "2.x", | ||
"glob": "4.x", | ||
"regexpu": "0.3.0", | ||
"glob": "4.3", | ||
"rsvp": "^3.0.13", | ||
@@ -57,5 +56,6 @@ "semver": "2.x", | ||
"node-uuid": "1.x", | ||
"regexpu": "0.3.0", | ||
"requirejs": "2.x", | ||
"semver": "2.x", | ||
"traceur": "0.0.76", | ||
"traceur": "0.0.78", | ||
"promises-aplus-tests": "2.x" | ||
@@ -62,0 +62,0 @@ }, |
@@ -18,2 +18,3 @@ // Copyright 2013 Traceur Authors. | ||
var path = require('path'); | ||
var glob = require('glob'); | ||
var commandLine; | ||
@@ -132,19 +133,66 @@ var cmdName = path.basename(process.argv[1]); | ||
var dir = commandLine.dir; | ||
function compileAll(out, sources, options) { | ||
var isSingleFileCompile = /\.js$/.test(out); | ||
if (!isSingleFileCompile) { | ||
traceurAPI.forEachRecursiveModuleCompile(out, sources, options); | ||
} else { | ||
traceurAPI.recursiveModuleCompileToSingleFile(out, sources, options).then(function() { | ||
process.exit(0); | ||
}).catch(function(err) { | ||
var errors = err.errors || [err]; | ||
errors.forEach(function(err) { | ||
console.error(err.stack || err); | ||
}); | ||
process.exit(1); | ||
}); | ||
} | ||
} | ||
function globSources(sourcesToGlob, cb) { | ||
var processedCount = 0; | ||
var globbedSources = []; | ||
sourcesToGlob.forEach(function(item) { | ||
glob(item.name, {}, function(err, matches) { | ||
if (err) | ||
throw new Error('While scanning ' + item.name + ': ' + err); | ||
for (var i = matches.length - 1; i >= 0; i--) { | ||
var globbedSource = { | ||
name: matches[i], | ||
type: item.type, | ||
format: item.format | ||
}; | ||
globbedSources.push(globbedSource); | ||
} | ||
processedCount++; | ||
if (processedCount === sourcesToGlob.length) { | ||
cb(null, globbedSources); | ||
} | ||
}); | ||
}); | ||
} | ||
if (!shouldExit) { | ||
if (out) { | ||
var isSingleFileCompile = /\.js$/.test(out); | ||
if (isSingleFileCompile) { | ||
traceurAPI.recursiveModuleCompileToSingleFile(out, rootSources, | ||
commandOptions).then(function() { | ||
var sourcesToGlob = []; | ||
var processedSources = []; | ||
for (var i = 0; i < rootSources.length; i++) { | ||
if (glob.hasMagic(rootSources[i].name)) { | ||
sourcesToGlob.push(rootSources[i]); | ||
} else { | ||
processedSources.push(rootSources[i]); | ||
} | ||
} | ||
if (!sourcesToGlob.length) { | ||
compileAll(out, processedSources, commandOptions); | ||
} else { | ||
globSources(sourcesToGlob, function(err, globbedSources) { | ||
processedSources.push.apply(processedSources, globbedSources); | ||
if (processedSources.length) { | ||
compileAll(out, processedSources, commandOptions); | ||
} else { | ||
process.exit(0); | ||
}).catch(function(err) { | ||
var errors = err.errors || [err]; | ||
errors.forEach(function(err) { | ||
console.error(err.stack || err); | ||
}); | ||
process.exit(1); | ||
}); | ||
} else { | ||
traceurAPI.forEachRecursiveModuleCompile(out, rootSources, | ||
commandOptions); | ||
} | ||
}); | ||
} | ||
@@ -151,0 +199,0 @@ } else if (dir) { |
@@ -28,5 +28,9 @@ // Copyright 2012 Traceur Authors. | ||
function revertCwd() { | ||
process.chdir(cwd); | ||
} | ||
function recursiveModuleCompileToSingleFile(outputFile, includes, options) { | ||
return new Promise(function (resolve, reject) { | ||
return new Promise(function(resolve, reject) { | ||
var resolvedOutputFile = path.resolve(outputFile); | ||
@@ -54,5 +58,8 @@ var outputDir = path.dirname(resolvedOutputFile); | ||
compiler.writeTreeToFile(tree, resolvedOutputFile); | ||
process.chdir(cwd); | ||
revertCwd(); | ||
resolve(); | ||
}, reject); | ||
}, function() { | ||
revertCwd(); | ||
reject.apply(null, arguments); | ||
}); | ||
}); | ||
@@ -59,0 +66,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1235303
5
32673
12
11
+ Addedglob@4.3.5(transitive)
- Removedregexpu@0.3.0
- Removedast-types@0.5.7(transitive)
- Removedcls@0.1.5(transitive)
- Removeddepd@1.0.1(transitive)
- Removedesprima-fb@7001.1.0-dev-harmony-fb(transitive)
- Removedglob@4.5.3(transitive)
- Removedjsesc@0.5.0(transitive)
- Removedprivate@0.1.8(transitive)
- Removedrecast@0.8.8(transitive)
- Removedregenerate@1.4.2(transitive)
- Removedregexpu@0.3.0(transitive)
- Removedregjsgen@0.2.0(transitive)
- Removedregjsparser@0.1.5(transitive)
Updatedglob@4.3