change --source-map-type [type] flag to --source-maps-inline and rename comment sourcemap type to inline

This commit is contained in:
Sebastian McKenzie
2014-10-08 23:59:38 +11:00
parent 77c2f1a8b2
commit b06cd42a0b
4 changed files with 11 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ var to5 = require("../lib/6to5/node");
var fs = require("fs");
var _ = require("lodash");
commander.option("-t, --source-map-type [type]", "Specify a custom sourcemap type such as `comment`");
commander.option("-t, --source-maps-inline", "Append sourceMappingURL comment to bottom of code");
commander.option("-s, --source-maps", "Save source map alongside the compiled code when using --out-file and --out-dir flags");
//commander.option("-w, --watch", "Watch, only works with --out-dir");
@@ -58,10 +58,14 @@ var readdirFilter = function (filename) {
var mainOpts = {
blacklist: commander.blacklist,
whitelist: commander.whitelist,
sourceMap: commander.sourceMapType || commander.sourceMaps,
sourceMap: commander.sourceMaps,
tolerant: commander.tolerant
};
if (commander.sourceMapsInline) {
mainOpts.sourceMap = "inline";
}
var data = [];
var compile = function (filename) {
@@ -81,7 +85,7 @@ if (commander.outDir) {
var up = path.normalize(dest + "/..");
mkdirp.sync(up);
if (commander.sourceMaps && !commander.sourceMapType) {
if (commander.sourceMaps) {
fs.writeFileSync(dest + ".map", data.map.toJSON());
}