Comparing version 1.8.0 to 1.8.1
module.exports = File; | ||
var SHEBANG_REGEX = /^\#\!.*/; | ||
var transform = require("./transform"); | ||
@@ -35,8 +37,19 @@ var util = require("./util"); | ||
File.prototype.parseShebang = function (code) { | ||
var shebangMatch = code.match(SHEBANG_REGEX); | ||
if (shebangMatch) { | ||
this.shebang = shebangMatch[0]; | ||
// remove shebang | ||
code = code.replace(SHEBANG_REGEX, ""); | ||
} | ||
return code; | ||
}; | ||
File.prototype.parse = function (code) { | ||
// remove shebang | ||
code = code.replace(/^\#\!.*/, ""); | ||
var self = this; | ||
code = this.parseShebang(code); | ||
return util.parse(this.opts, code, function (tree) { | ||
@@ -59,2 +72,6 @@ return self.transform(tree); | ||
if (this.shebang) { | ||
result.code = this.shebang + result.code; | ||
} | ||
if (opts.sourceMap === "inline") { | ||
@@ -61,0 +78,0 @@ result.code += "\n" + util.sourceMapToComment(result.map); |
{ | ||
"name": "6to5", | ||
"description": "Turn ES6 code into readable vanilla ES5 with source maps", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/sebmck/6to5", |
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
712909
1498