@babel/helper-wrap-function
Advanced tools
Comparing version 8.0.0-alpha.11 to 8.0.0-alpha.12
@@ -1,2 +0,1 @@ | ||
import nameFunction from '@babel/helper-function-name'; | ||
import template from '@babel/template'; | ||
@@ -48,3 +47,3 @@ import * as _t from '@babel/types'; | ||
} | ||
function plainFunction(inPath, callId, noNewArrows, ignoreFunctionLength) { | ||
function plainFunction(inPath, callId, noNewArrows, ignoreFunctionLength, hadName) { | ||
let path = inPath; | ||
@@ -81,3 +80,3 @@ let node; | ||
NAME: functionId || null, | ||
REF: path.scope.generateUidIdentifier(functionId ? functionId.name : "ref"), | ||
REF: path.scope.generateUidIdentifier(hadName ? functionId.name : "ref"), | ||
FUNCTION: built, | ||
@@ -92,13 +91,6 @@ PARAMS: params | ||
let container; | ||
if (functionId) { | ||
if (hadName) { | ||
container = buildNamedExpressionWrapper(wrapperArgs); | ||
} else { | ||
container = buildAnonymousExpressionWrapper(wrapperArgs); | ||
const returnFn = container.callee.body.body[1].argument; | ||
nameFunction({ | ||
node: returnFn, | ||
parent: path.parent, | ||
scope: path.scope | ||
}); | ||
functionId = returnFn.id; | ||
} | ||
@@ -116,3 +108,5 @@ if (functionId || !ignoreFunctionLength && params.length) { | ||
} else { | ||
plainFunction(path, callId, noNewArrows, ignoreFunctionLength); | ||
const hadName = "id" in path.node && !!path.node.id; | ||
path = path.ensureFunctionName(false); | ||
plainFunction(path, callId, noNewArrows, ignoreFunctionLength, hadName); | ||
} | ||
@@ -119,0 +113,0 @@ } |
{ | ||
"name": "@babel/helper-wrap-function", | ||
"version": "8.0.0-alpha.11", | ||
"version": "8.0.0-alpha.12", | ||
"description": "Helper to wrap functions inside a function call.", | ||
@@ -17,6 +17,5 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-function-name": "^8.0.0-alpha.11", | ||
"@babel/template": "^8.0.0-alpha.11", | ||
"@babel/traverse": "^8.0.0-alpha.11", | ||
"@babel/types": "^8.0.0-alpha.11" | ||
"@babel/template": "^8.0.0-alpha.12", | ||
"@babel/traverse": "^8.0.0-alpha.12", | ||
"@babel/types": "^8.0.0-alpha.12" | ||
}, | ||
@@ -23,0 +22,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3
71332
130
- Removed@babel/helper-function-name@8.0.0-alpha.11(transitive)
Updated@babel/types@^8.0.0-alpha.12