Socket
Socket
Sign inDemoInstall

6to5

Package Overview
Dependencies
86
Maintainers
1
Versions
257
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.3.3 to 3.3.4

lib/6to5/optimisation/index.js

3

lib/6to5/generation/index.js

@@ -182,3 +182,3 @@ "use strict";

if (opts.before) opts.before();
this.map.mark(node, "start");
this.map.mark(node);

@@ -193,3 +193,2 @@ this[node.type](node, this.buildPrint(node), parent);

this.map.mark(node, "end");
if (opts.after) opts.after();

@@ -196,0 +195,0 @@

@@ -33,3 +33,3 @@ "use strict";

SourceMap.prototype.mark = function (node, type) {
SourceMap.prototype.mark = function (node) {
var loc = node.loc;

@@ -50,6 +50,4 @@ if (!loc) return; // no location info

var original = loc[type];
var original = loc.start;
if (generated.line === original.line && generated.column === original.column) return; // nothing to map
map.addMapping({

@@ -56,0 +54,0 @@ source: this.opts.sourceFileName,

@@ -37,6 +37,4 @@ "use strict";

var onlyRegex;
var whitelist = [];
var exts = {};
var maps = {};
var old = require.extensions[".js"];

@@ -47,7 +45,3 @@ var mtime = function (filename) {

var loader = function (m, filename) {
if ((ignoreRegex && ignoreRegex.test(filename)) || (onlyRegex && !onlyRegex.test(filename))) {
return old.apply(this, arguments);
}
var compile = function (filename) {
var result;

@@ -62,7 +56,8 @@

result = result || to5.transformFileSync(filename, extend({
whitelist: whitelist,
sourceMap: true,
ast: false
}, transformOpts));
if (!result) {
result = to5.transformFileSync(filename, extend({
sourceMap: true,
ast: false
}, transformOpts));
}

@@ -76,5 +71,41 @@ if (cache) {

m._compile(result.code, filename);
return result.code;
};
var shouldIgnore = function (filename) {
return (ignoreRegex && ignoreRegex.test(filename)) || (onlyRegex && !onlyRegex.test(filename));
};
var istanbulLoader = function (m, filename, old) {
// we need to monkey patch fs.readFileSync so we can hook into
// what istanbul gets, it's extremely dirty but it's the only way
var _readFileSync = fs.readFileSync;
fs.readFileSync = function () {
fs.readFileSync = _readFileSync;
return compile(filename);
};
old(m, filename);
};
var normalLoader = function (m, filename) {
m._compile(compile(filename), filename);
};
var registerExtension = function (ext) {
var old = require.extensions[ext];
var loader = normalLoader;
if (process.env.running_under_istanbul) loader = istanbulLoader; // jshint ignore:line
require.extensions[ext] = function (m, filename) {
if (shouldIgnore(filename)) {
old(m, filename);
} else {
loader(m, filename, old);
}
};
};
var hookExtensions = function (_exts) {

@@ -89,3 +120,3 @@ each(exts, function (old, ext) {

exts[ext] = require.extensions[ext];
require.extensions[ext] = loader;
registerExtension(ext);
});

@@ -92,0 +123,0 @@ };

@@ -15,3 +15,2 @@ module.exports = {

react: require("./other/react"),
"optimisation.react": require("./optimisation/react"),

@@ -18,0 +17,0 @@ _modules: require("./internal/modules"),

{
"name": "6to5",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "3.3.3",
"version": "3.3.4",
"author": "Sebastian McKenzie <sebmck@gmail.com>",

@@ -6,0 +6,0 @@ "homepage": "https://6to5.org/",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc