Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9266b0c4c | ||
|
|
a1239e5f5a | ||
|
|
2f279de7d1 | ||
|
|
c70b3586fb |
@@ -41,7 +41,8 @@ File.normaliseOptions = function (opts) {
|
||||
filename: "unknown",
|
||||
modules: "common",
|
||||
runtime: false,
|
||||
code: true
|
||||
code: true,
|
||||
ast: true
|
||||
});
|
||||
|
||||
// normalise windows path separators to unix
|
||||
@@ -186,15 +187,18 @@ File.prototype.generate = function () {
|
||||
var opts = this.opts;
|
||||
var ast = this.ast;
|
||||
|
||||
if (!opts.code) {
|
||||
return {
|
||||
code: "",
|
||||
map: null,
|
||||
ast: ast
|
||||
};
|
||||
}
|
||||
var result = {
|
||||
code: "",
|
||||
map: null,
|
||||
ast: null
|
||||
};
|
||||
|
||||
var result = generate(ast, opts, this.code);
|
||||
if (opts.ast) result.ast = ast;
|
||||
if (!opts.code) return result;
|
||||
|
||||
var _result = generate(ast, opts, this.code);
|
||||
result.code = _result.code;
|
||||
result.map = _result.map;
|
||||
|
||||
if (this.shebang) {
|
||||
// add back shebang
|
||||
@@ -205,8 +209,6 @@ File.prototype.generate = function () {
|
||||
result.code += "\n" + util.sourceMapToComment(result.map);
|
||||
}
|
||||
|
||||
result.ast = result;
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require("./polyfill");
|
||||
|
||||
var sourceMapSupport = require("source-map-support");
|
||||
var roadrunner = require('roadrunner');
|
||||
var util = require("./util");
|
||||
var to5 = require("./index");
|
||||
var fs = require("fs");
|
||||
@@ -90,7 +89,8 @@ var loader = function (m, filename) {
|
||||
whitelist: whitelist,
|
||||
blacklist: blacklist,
|
||||
sourceMap: true,
|
||||
modules: "commonInterop"
|
||||
modules: "commonInterop",
|
||||
ast: false
|
||||
}, transformOpts));
|
||||
|
||||
if (cache) {
|
||||
@@ -129,7 +129,7 @@ module.exports = function (opts) {
|
||||
|
||||
if (opts.extensions) hookExtensions(util.arrayify(opts.extensions));
|
||||
|
||||
if (opts.cache) cache = roadrunner.get('6to5');
|
||||
if (opts.cache) cache = opts.cache;
|
||||
if (opts.cache === false) cache = null;
|
||||
|
||||
_.extend(transformOpts, opts);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "1.14.8",
|
||||
"version": "1.14.10",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://github.com/6to5/6to5",
|
||||
"repository": {
|
||||
@@ -48,7 +48,6 @@
|
||||
"mkdirp": "0.5.0",
|
||||
"private": "0.1.6",
|
||||
"regexpu": "0.3.0",
|
||||
"roadrunner": "^1.0.4",
|
||||
"source-map": "0.1.40",
|
||||
"source-map-support": "0.2.8"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user