@babel/helper-remap-async-to-generator
Advanced tools
Comparing version 7.0.0-beta.42 to 7.0.0-beta.43
"use strict"; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = _default; | ||
var _helperWrapFunction = _interopRequireDefault(require("@babel/helper-wrap-function")); | ||
function _helperWrapFunction() { | ||
const data = _interopRequireDefault(require("@babel/helper-wrap-function")); | ||
var _helperAnnotateAsPure = _interopRequireDefault(require("@babel/helper-annotate-as-pure")); | ||
_helperWrapFunction = function () { | ||
return data; | ||
}; | ||
var t = _interopRequireWildcard(require("@babel/types")); | ||
return data; | ||
} | ||
function _helperAnnotateAsPure() { | ||
const data = _interopRequireDefault(require("@babel/helper-annotate-as-pure")); | ||
_helperAnnotateAsPure = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function t() { | ||
const data = _interopRequireWildcard(require("@babel/types")); | ||
t = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
@@ -16,10 +42,12 @@ | ||
var awaitVisitor = { | ||
Function: function Function(path) { | ||
const awaitVisitor = { | ||
Function(path) { | ||
path.skip(); | ||
}, | ||
AwaitExpression: function AwaitExpression(path, _ref) { | ||
var wrapAwait = _ref.wrapAwait; | ||
var argument = path.get("argument"); | ||
AwaitExpression(path, { | ||
wrapAwait | ||
}) { | ||
const argument = path.get("argument"); | ||
if (path.parentPath.isYieldExpression()) { | ||
@@ -30,4 +58,5 @@ path.replaceWith(argument.node); | ||
path.replaceWith(t.yieldExpression(wrapAwait ? t.callExpression(t.cloneNode(wrapAwait), [argument.node]) : argument.node)); | ||
path.replaceWith(t().yieldExpression(wrapAwait ? t().callExpression(t().cloneNode(wrapAwait), [argument.node]) : argument.node)); | ||
} | ||
}; | ||
@@ -39,10 +68,10 @@ | ||
}); | ||
var isIIFE = checkIsIIFE(path); | ||
const isIIFE = checkIsIIFE(path); | ||
path.node.async = false; | ||
path.node.generator = true; | ||
(0, _helperWrapFunction.default)(path, t.cloneNode(helpers.wrapAsync)); | ||
var isProperty = path.isObjectMethod() || path.isClassMethod() || path.parentPath.isObjectProperty() || path.parentPath.isClassProperty(); | ||
(0, _helperWrapFunction().default)(path, t().cloneNode(helpers.wrapAsync)); | ||
const isProperty = path.isObjectMethod() || path.isClassMethod() || path.parentPath.isObjectProperty() || path.parentPath.isClassProperty(); | ||
if (!isProperty && !isIIFE && path.isExpression()) { | ||
(0, _helperAnnotateAsPure.default)(path); | ||
(0, _helperAnnotateAsPure().default)(path); | ||
} | ||
@@ -57,9 +86,13 @@ | ||
var parentPath = path.parentPath; | ||
const { | ||
parentPath | ||
} = path; | ||
if (parentPath.isMemberExpression() && t.isIdentifier(parentPath.node.property, { | ||
if (parentPath.isMemberExpression() && t().isIdentifier(parentPath.node.property, { | ||
name: "bind" | ||
})) { | ||
var bindCall = parentPath.parentPath; | ||
return bindCall.isCallExpression() && bindCall.node.arguments.length === 1 && t.isThisExpression(bindCall.node.arguments[0]) && bindCall.parentPath.isCallExpression({ | ||
const { | ||
parentPath: bindCall | ||
} = parentPath; | ||
return bindCall.isCallExpression() && bindCall.node.arguments.length === 1 && t().isThisExpression(bindCall.node.arguments[0]) && bindCall.parentPath.isCallExpression({ | ||
callee: bindCall.node | ||
@@ -66,0 +99,0 @@ }); |
{ | ||
"name": "@babel/helper-remap-async-to-generator", | ||
"version": "7.0.0-beta.42", | ||
"version": "7.0.0-beta.43", | ||
"description": "Helper function to remap async functions to generators", | ||
@@ -9,8 +9,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator", | ||
"dependencies": { | ||
"@babel/helper-annotate-as-pure": "7.0.0-beta.42", | ||
"@babel/helper-wrap-function": "7.0.0-beta.42", | ||
"@babel/template": "7.0.0-beta.42", | ||
"@babel/traverse": "7.0.0-beta.42", | ||
"@babel/types": "7.0.0-beta.42" | ||
"@babel/helper-annotate-as-pure": "7.0.0-beta.43", | ||
"@babel/helper-wrap-function": "7.0.0-beta.43", | ||
"@babel/template": "7.0.0-beta.43", | ||
"@babel/traverse": "7.0.0-beta.43", | ||
"@babel/types": "7.0.0-beta.43" | ||
} | ||
} |
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
3373
77
+ Added@babel/code-frame@7.0.0-beta.43(transitive)
+ Added@babel/generator@7.0.0-beta.43(transitive)
+ Added@babel/helper-annotate-as-pure@7.0.0-beta.43(transitive)
+ Added@babel/helper-function-name@7.0.0-beta.43(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-beta.43(transitive)
+ Added@babel/helper-split-export-declaration@7.0.0-beta.43(transitive)
+ Added@babel/helper-wrap-function@7.0.0-beta.43(transitive)
+ Added@babel/highlight@7.0.0-beta.43(transitive)
+ Added@babel/template@7.0.0-beta.43(transitive)
+ Added@babel/traverse@7.0.0-beta.43(transitive)
+ Added@babel/types@7.0.0-beta.43(transitive)
+ Addedbabylon@7.0.0-beta.43(transitive)
- Removed@babel/code-frame@7.0.0-beta.42(transitive)
- Removed@babel/generator@7.0.0-beta.42(transitive)
- Removed@babel/helper-annotate-as-pure@7.0.0-beta.42(transitive)
- Removed@babel/helper-function-name@7.0.0-beta.42(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-beta.42(transitive)
- Removed@babel/helper-split-export-declaration@7.0.0-beta.42(transitive)
- Removed@babel/helper-wrap-function@7.0.0-beta.42(transitive)
- Removed@babel/highlight@7.0.0-beta.42(transitive)
- Removed@babel/template@7.0.0-beta.42(transitive)
- Removed@babel/traverse@7.0.0-beta.42(transitive)
- Removed@babel/types@7.0.0-beta.42(transitive)
- Removedbabylon@7.0.0-beta.42(transitive)
Updated@babel/types@7.0.0-beta.43