change --source-map-type [type] flag to --source-maps-inline and rename comment sourcemap type to inline
This commit is contained in:
parent
77c2f1a8b2
commit
b06cd42a0b
@ -85,7 +85,7 @@ source map to `script-compiled.js.map`.
|
||||
Compile the file `script.js` and output it to `script-compiled.js` with a source
|
||||
map embedded in a comment at the bottom.
|
||||
|
||||
$ 6to5 script.js --source-maps-comment --out-file script-compiled.js
|
||||
$ 6to5 script.js --source-maps-inline --out-file script-compiled.js
|
||||
|
||||
Compile the entire `src` directory and output it to the `lib` directory.
|
||||
|
||||
@ -133,7 +133,7 @@ to5.transformFile("filename.js", options, function (err, result) {
|
||||
whitelist: [],
|
||||
|
||||
// If truthy, adds a `map` property to returned output.
|
||||
// If set to "comment", the sourceMappingURL directive is added at the bottom
|
||||
// If set to "inline", a comment with a sourceMappingURL directive is added to the bottom
|
||||
sourceMap: false,
|
||||
|
||||
// Filename for use in errors etc.
|
||||
|
||||
10
bin/6to5
10
bin/6to5
@ -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());
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ transform._run = function (code, tree, opts) {
|
||||
var result = util.generate(tree, genOpts);
|
||||
|
||||
if (opts.sourceMap) {
|
||||
if (opts.sourceMap === "comment") {
|
||||
if (opts.sourceMap === "inline") {
|
||||
result.code += "\n" + util.sourceMapToComment(result.map);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into vanilla ES5 with source maps and no runtime",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://github.com/sebmck/6to5",
|
||||
"repository": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user