@babel/helper-wrap-function
Advanced tools
Comparing version 7.24.7 to 7.25.0
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.default = wrapFunction; | ||
var _helperFunctionName = require("@babel/helper-function-name"); | ||
var _template = require("@babel/template"); | ||
@@ -54,3 +53,3 @@ var _t = require("@babel/types"); | ||
} | ||
function plainFunction(inPath, callId, noNewArrows, ignoreFunctionLength) { | ||
function plainFunction(inPath, callId, noNewArrows, ignoreFunctionLength, hadName) { | ||
let path = inPath; | ||
@@ -88,3 +87,3 @@ let node; | ||
NAME: functionId || null, | ||
REF: path.scope.generateUidIdentifier(functionId ? functionId.name : "ref"), | ||
REF: path.scope.generateUidIdentifier(hadName ? functionId.name : "ref"), | ||
FUNCTION: built, | ||
@@ -99,13 +98,6 @@ PARAMS: params | ||
let container; | ||
if (functionId) { | ||
if (hadName) { | ||
container = buildNamedExpressionWrapper(wrapperArgs); | ||
} else { | ||
container = buildAnonymousExpressionWrapper(wrapperArgs); | ||
const returnFn = container.callee.body.body[1].argument; | ||
(0, _helperFunctionName.default)({ | ||
node: returnFn, | ||
parent: path.parent, | ||
scope: path.scope | ||
}); | ||
functionId = returnFn.id; | ||
} | ||
@@ -123,3 +115,9 @@ if (functionId || !ignoreFunctionLength && params.length) { | ||
} else { | ||
plainFunction(path, callId, noNewArrows, ignoreFunctionLength); | ||
const hadName = "id" in path.node && !!path.node.id; | ||
{ | ||
var _path, _path$ensureFunctionN; | ||
(_path$ensureFunctionN = (_path = path).ensureFunctionName) != null ? _path$ensureFunctionN : _path.ensureFunctionName = require("@babel/traverse").NodePath.prototype.ensureFunctionName; | ||
} | ||
path = path.ensureFunctionName(false); | ||
plainFunction(path, callId, noNewArrows, ignoreFunctionLength, hadName); | ||
} | ||
@@ -126,0 +124,0 @@ } |
{ | ||
"name": "@babel/helper-wrap-function", | ||
"version": "7.24.7", | ||
"version": "7.25.0", | ||
"description": "Helper to wrap functions inside a function call.", | ||
@@ -17,6 +17,5 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-function-name": "^7.24.7", | ||
"@babel/template": "^7.24.7", | ||
"@babel/traverse": "^7.24.7", | ||
"@babel/types": "^7.24.7" | ||
"@babel/template": "^7.25.0", | ||
"@babel/traverse": "^7.25.0", | ||
"@babel/types": "^7.25.0" | ||
}, | ||
@@ -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
71273
135
- Removed@babel/helper-function-name@^7.24.7
- Removed@babel/helper-function-name@7.24.7(transitive)
Updated@babel/template@^7.25.0
Updated@babel/traverse@^7.25.0
Updated@babel/types@^7.25.0