@babel/plugin-proposal-function-bind
Advanced tools
Comparing version 7.0.0-beta.43 to 7.0.0-beta.44
@@ -9,5 +9,5 @@ "use strict"; | ||
function _helperPluginUtils() { | ||
const data = require("@babel/helper-plugin-utils"); | ||
var data = require("@babel/helper-plugin-utils"); | ||
_helperPluginUtils = function () { | ||
_helperPluginUtils = function _helperPluginUtils() { | ||
return data; | ||
@@ -20,5 +20,5 @@ }; | ||
function _pluginSyntaxFunctionBind() { | ||
const data = _interopRequireDefault(require("@babel/plugin-syntax-function-bind")); | ||
var data = _interopRequireDefault(require("@babel/plugin-syntax-function-bind")); | ||
_pluginSyntaxFunctionBind = function () { | ||
_pluginSyntaxFunctionBind = function _pluginSyntaxFunctionBind() { | ||
return data; | ||
@@ -31,5 +31,5 @@ }; | ||
function _core() { | ||
const data = require("@babel/core"); | ||
var data = require("@babel/core"); | ||
_core = function () { | ||
_core = function _core() { | ||
return data; | ||
@@ -43,7 +43,7 @@ }; | ||
var _default = (0, _helperPluginUtils().declare)(api => { | ||
var _default = (0, _helperPluginUtils().declare)(function (api) { | ||
api.assertVersion(7); | ||
function getTempId(scope) { | ||
let id = scope.path.getData("functionBind"); | ||
var id = scope.path.getData("functionBind"); | ||
if (id) return id; | ||
@@ -55,3 +55,3 @@ id = scope.generateDeclaredUidIdentifier("context"); | ||
function getStaticContext(bind, scope) { | ||
const object = bind.object || bind.callee.object; | ||
var object = bind.object || bind.callee.object; | ||
return scope.isStatic(object) && object; | ||
@@ -61,5 +61,5 @@ } | ||
function inferBindContext(bind, scope) { | ||
const staticContext = getStaticContext(bind, scope); | ||
var staticContext = getStaticContext(bind, scope); | ||
if (staticContext) return _core().types.cloneNode(staticContext); | ||
const tempId = getTempId(scope); | ||
var tempId = getTempId(scope); | ||
@@ -78,22 +78,17 @@ if (bind.object) { | ||
visitor: { | ||
CallExpression({ | ||
node, | ||
scope | ||
}) { | ||
const bind = node.callee; | ||
CallExpression: function CallExpression(_ref) { | ||
var node = _ref.node, | ||
scope = _ref.scope; | ||
var bind = node.callee; | ||
if (!_core().types.isBindExpression(bind)) return; | ||
const context = inferBindContext(bind, scope); | ||
var context = inferBindContext(bind, scope); | ||
node.callee = _core().types.memberExpression(bind.callee, _core().types.identifier("call")); | ||
node.arguments.unshift(context); | ||
}, | ||
BindExpression(path) { | ||
const { | ||
node, | ||
scope | ||
} = path; | ||
const context = inferBindContext(node, scope); | ||
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])); | ||
} | ||
} | ||
@@ -100,0 +95,0 @@ }; |
{ | ||
"name": "@babel/plugin-proposal-function-bind", | ||
"version": "7.0.0-beta.43", | ||
"version": "7.0.0-beta.44", | ||
"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.43", | ||
"@babel/plugin-syntax-function-bind": "7.0.0-beta.43" | ||
"@babel/helper-plugin-utils": "7.0.0-beta.44", | ||
"@babel/plugin-syntax-function-bind": "7.0.0-beta.44" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "7.0.0-beta.43" | ||
"@babel/core": "7.0.0-beta.44" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.43", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.43" | ||
"@babel/core": "7.0.0-beta.44", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.44" | ||
} | ||
} |
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
5635
71
+ Added@babel/code-frame@7.0.0-beta.44(transitive)
+ Added@babel/core@7.0.0-beta.44(transitive)
+ Added@babel/generator@7.0.0-beta.44(transitive)
+ Added@babel/helper-function-name@7.0.0-beta.44(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-beta.44(transitive)
+ Added@babel/helper-plugin-utils@7.0.0-beta.44(transitive)
+ Added@babel/helper-split-export-declaration@7.0.0-beta.44(transitive)
+ Added@babel/helpers@7.0.0-beta.44(transitive)
+ Added@babel/highlight@7.0.0-beta.44(transitive)
+ Added@babel/plugin-syntax-function-bind@7.0.0-beta.44(transitive)
+ Added@babel/template@7.0.0-beta.44(transitive)
+ Added@babel/traverse@7.0.0-beta.44(transitive)
+ Added@babel/types@7.0.0-beta.44(transitive)
+ Addedbabylon@7.0.0-beta.44(transitive)
- Removed@babel/code-frame@7.0.0-beta.43(transitive)
- Removed@babel/core@7.0.0-beta.43(transitive)
- Removed@babel/generator@7.0.0-beta.43(transitive)
- Removed@babel/helper-function-name@7.0.0-beta.43(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-beta.43(transitive)
- Removed@babel/helper-plugin-utils@7.0.0-beta.43(transitive)
- Removed@babel/helper-split-export-declaration@7.0.0-beta.43(transitive)
- Removed@babel/helpers@7.0.0-beta.43(transitive)
- Removed@babel/highlight@7.0.0-beta.43(transitive)
- Removed@babel/plugin-syntax-function-bind@7.0.0-beta.43(transitive)
- Removed@babel/template@7.0.0-beta.43(transitive)
- Removed@babel/traverse@7.0.0-beta.43(transitive)
- Removed@babel/types@7.0.0-beta.43(transitive)
- Removedbabylon@7.0.0-beta.43(transitive)