Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-closure-elimination

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-closure-elimination - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

11

lib/index.js

@@ -48,2 +48,7 @@ 'use strict';

function _ref8(_ref7) {
var path = _ref7.path;
return !path.isProgram() || path.node.sourceType === 'module';
}
function _getAllParentScopes(scope) {

@@ -88,3 +93,3 @@ var scopes = [];

var bestParentScope = getHighestCompatibleHoistedScope(path);
if (bestParentScope !== path.scope.parent) {
if (bestParentScope) {
var attachPath = _getAttachmentPositio(bestParentScope.path, path);

@@ -121,3 +126,5 @@ moveToNewPosition(path, attachPath);

}
return parentScopes.pop();
return parentScopes.filter(_ref8).filter(function (scope) {
return scope !== path.scope.parent;
}).pop();
}function moveToNewPosition(path, attachPath) {

@@ -124,0 +131,0 @@ var node = path.node,

2

package.json
{
"name": "babel-plugin-closure-elimination",
"version": "1.1.5",
"version": "1.1.6",
"description": "Removes closures from your JavaScript in the name of performance.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -10,3 +10,3 @@ import 'babel-polyfill';

export default function build(babel:Object):Object {
export default function build(babel: Object): Object {
const {types: t} = babel;

@@ -27,3 +27,3 @@

const bestParentScope = getHighestCompatibleHoistedScope(path);
if (bestParentScope !== path.scope.parent) {
if (bestParentScope) {
const attachPath = getAttachmentPosition(bestParentScope.path, path);

@@ -45,3 +45,3 @@ moveToNewPosition(path, attachPath);

enter(path) {
if(path.node.name === 'eval' && path.parentPath.type === 'CallExpression') {
if (path.node.name === 'eval' && path.parentPath.type === 'CallExpression') {
path.getAncestry()

@@ -73,3 +73,6 @@ .filter(path=>path.isFunction())

}
return parentScopes.pop();
return parentScopes
.filter(({path}) => !path.isProgram() || path.node.sourceType === 'module')
.filter(scope => scope !== path.scope.parent)
.pop();
}

@@ -126,3 +129,3 @@

*/
function normalizeFunctionBody(node:Object):Object {
function normalizeFunctionBody(node: Object): Object {
if (node.type !== 'BlockStatement') {

@@ -129,0 +132,0 @@ return t.blockStatement([

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc