Socket
Socket
Sign inDemoInstall

6to5-core

Package Overview
Dependencies
97
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.12.2 to 2.12.3

2

lib/6to5/transformation/transformer.js

@@ -68,3 +68,3 @@ module.exports = Transformer;

return fn(node, parent, file, scope);
return fn.call(this, node, parent, file, scope);
};

@@ -71,0 +71,0 @@ };

@@ -1,4 +0,5 @@

var traverse = require("../../traverse");
var util = require("../../util");
var t = require("../../types");
var propertyMethodAssignment = require("./es6-property-method-assignment");
var traverse = require("../../traverse");
var util = require("../../util");
var t = require("../../types");

@@ -10,2 +11,13 @@ exports.ClassDeclaration = function (node, parent, file, scope) {

exports.ClassExpression = function (node, parent, file, scope) {
if (!node.id) {
if (t.isProperty(parent) && parent.value === node && !parent.computed && t.isIdentifier(parent.key)) {
// var o = { foo: class {} };
node.id = parent.key;
}
if (t.isVariableDeclarator(parent)) {
node.id = parent.id;
}
}
return new Class(node, file, scope, false).run();

@@ -183,11 +195,6 @@ };

var kind = node.kind;
var mutatorMap = this.instanceMutatorMap;
if (node.static) {
this.hasStaticMutators = true;
mutatorMap = this.staticMutatorMap;
} else {
this.hasInstanceMutators = true;
}
if (kind === "") {
propertyMethodAssignment._namedMethod(node, this.file, this.scope);
if (this.isLoose) {

@@ -209,2 +216,10 @@ // use assignments instead of define properties for loose classes

var mutatorMap = this.instanceMutatorMap;
if (node.static) {
this.hasStaticMutators = true;
mutatorMap = this.staticMutatorMap;
} else {
this.hasInstanceMutators = true;
}
util.pushMutatorMap(mutatorMap, methodName, kind, node.computed, node);

@@ -211,0 +226,0 @@ };

@@ -5,9 +5,5 @@ var traverse = require("../../traverse");

exports.Property = function (node, parent, file, scope) {
if (!node.method) return;
node.method = false;
exports._namedMethod = function (node, file, scope) {
var key = t.toComputedKey(node, node.key);
if (!t.isLiteral(key)) return; // we can't set a function id with this
if (!t.isLiteral(key)) return node; // we can't set a function id with this

@@ -50,2 +46,10 @@ var id = t.toIdentifier(key.value);

exports.Property = function (node, parent, file, scope) {
if (!node.method) return;
node.method = false;
exports._namedMethod(node, file, scope);
};
exports.ObjectExpression = function (node) {

@@ -52,0 +56,0 @@ var mutatorMap = {};

@@ -6,5 +6,17 @@ var t = require("../../types");

exports.UnaryExpression = function (node, parent, file) {
this.skip();
if (node.operator === "typeof") {
return t.callExpression(file.addHelper("typeof"), [node.argument]);
var call = t.callExpression(file.addHelper("typeof"), [node.argument]);
if (t.isIdentifier(node.argument)) {
var undefLiteral = t.literal("undefined");
return t.conditionalExpression(
t.binaryExpression("===", t.unaryExpression("typeof", node.argument), undefLiteral),
undefLiteral,
call
);
} else {
return call;
}
}
};

@@ -204,2 +204,6 @@ var esutils = require("esutils");

if (t.isMethodDefinition(parent) && parent.key === node && !parent.computed) {
return false;
}
// we're a catch clause param

@@ -206,0 +210,0 @@ if (t.isCatchClause(parent) && parent.param === node) return false;

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

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

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc