Socket
Socket
Sign inDemoInstall

@babel/plugin-proposal-function-bind

Package Overview
Dependencies
Maintainers
6
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-proposal-function-bind - npm Package Compare versions

Comparing version 7.0.0-beta.42 to 7.0.0-beta.43

81

lib/index.js
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
var _pluginSyntaxFunctionBind = _interopRequireDefault(require("@babel/plugin-syntax-function-bind"));
_helperPluginUtils = function () {
return data;
};
var _core = require("@babel/core");
return data;
}
function _pluginSyntaxFunctionBind() {
const data = _interopRequireDefault(require("@babel/plugin-syntax-function-bind"));
_pluginSyntaxFunctionBind = function () {
return data;
};
return data;
}
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils.declare)(function (api) {
var _default = (0, _helperPluginUtils().declare)(api => {
api.assertVersion(7);
function getTempId(scope) {
var id = scope.path.getData("functionBind");
let id = scope.path.getData("functionBind");
if (id) return id;

@@ -25,3 +51,3 @@ id = scope.generateDeclaredUidIdentifier("context");

function getStaticContext(bind, scope) {
var object = bind.object || bind.callee.object;
const object = bind.object || bind.callee.object;
return scope.isStatic(object) && object;

@@ -31,10 +57,10 @@ }

function inferBindContext(bind, scope) {
var staticContext = getStaticContext(bind, scope);
if (staticContext) return _core.types.cloneNode(staticContext);
var tempId = getTempId(scope);
const staticContext = getStaticContext(bind, scope);
if (staticContext) return _core().types.cloneNode(staticContext);
const tempId = getTempId(scope);
if (bind.object) {
bind.callee = _core.types.sequenceExpression([_core.types.assignmentExpression("=", tempId, bind.object), bind.callee]);
bind.callee = _core().types.sequenceExpression([_core().types.assignmentExpression("=", tempId, bind.object), bind.callee]);
} else {
bind.callee.object = _core.types.assignmentExpression("=", tempId, bind.callee.object);
bind.callee.object = _core().types.assignmentExpression("=", tempId, bind.callee.object);
}

@@ -46,19 +72,24 @@

return {
inherits: _pluginSyntaxFunctionBind.default,
inherits: _pluginSyntaxFunctionBind().default,
visitor: {
CallExpression: function CallExpression(_ref) {
var node = _ref.node,
scope = _ref.scope;
var bind = node.callee;
if (!_core.types.isBindExpression(bind)) return;
var context = inferBindContext(bind, scope);
node.callee = _core.types.memberExpression(bind.callee, _core.types.identifier("call"));
CallExpression({
node,
scope
}) {
const bind = node.callee;
if (!_core().types.isBindExpression(bind)) return;
const context = inferBindContext(bind, scope);
node.callee = _core().types.memberExpression(bind.callee, _core().types.identifier("call"));
node.arguments.unshift(context);
},
BindExpression: function BindExpression(path) {
var node = path.node,
scope = path.scope;
var context = inferBindContext(node, scope);
path.replaceWith(_core.types.callExpression(_core.types.memberExpression(node.callee, _core.types.identifier("bind")), [context]));
BindExpression(path) {
const {
node,
scope
} = path;
const context = inferBindContext(node, scope);
path.replaceWith(_core().types.callExpression(_core().types.memberExpression(node.callee, _core().types.identifier("bind")), [context]));
}
}

@@ -65,0 +96,0 @@ };

{
"name": "@babel/plugin-proposal-function-bind",
"version": "7.0.0-beta.42",
"version": "7.0.0-beta.43",
"description": "Compile function bind operator to ES5",

@@ -12,12 +12,12 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-function-bind",

"dependencies": {
"@babel/helper-plugin-utils": "7.0.0-beta.42",
"@babel/plugin-syntax-function-bind": "7.0.0-beta.42"
"@babel/helper-plugin-utils": "7.0.0-beta.43",
"@babel/plugin-syntax-function-bind": "7.0.0-beta.43"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.42"
"@babel/core": "7.0.0-beta.43"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.42",
"@babel/helper-plugin-test-runner": "7.0.0-beta.42"
"@babel/core": "7.0.0-beta.43",
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
}
}
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