@babel/plugin-proposal-partial-application
Advanced tools
Comparing version 7.21.4-esm.3 to 7.21.4-esm.4
@@ -1,14 +0,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
var _pluginSyntaxPartialApplication = require("@babel/plugin-syntax-partial-application"); | ||
var _core = require("@babel/core"); | ||
var _default = (0, _helperPluginUtils.declare)(api => { | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import syntaxPartialApplication from "@babel/plugin-syntax-partial-application"; | ||
import { types as t } from "@babel/core"; | ||
export default declare(api => { | ||
api.assertVersion(7); | ||
function hasArgumentPlaceholder(node) { | ||
return node.arguments.some(arg => _core.types.isArgumentPlaceholder(arg)); | ||
return node.arguments.some(arg => t.isArgumentPlaceholder(arg)); | ||
} | ||
@@ -21,3 +15,3 @@ function unwrapArguments({ | ||
const node = args[i]; | ||
if (!_core.types.isArgumentPlaceholder(node) && !_core.types.isImmutable(node)) { | ||
if (!t.isArgumentPlaceholder(node) && !t.isImmutable(node)) { | ||
const id = scope.generateUidIdentifierBasedOnNode(node, "param"); | ||
@@ -27,8 +21,8 @@ scope.push({ | ||
}); | ||
if (_core.types.isSpreadElement(node)) { | ||
init.push(_core.types.assignmentExpression("=", _core.types.cloneNode(id), _core.types.arrayExpression([_core.types.spreadElement(node.argument)]))); | ||
node.argument = _core.types.cloneNode(id); | ||
if (t.isSpreadElement(node)) { | ||
init.push(t.assignmentExpression("=", t.cloneNode(id), t.arrayExpression([t.spreadElement(node.argument)]))); | ||
node.argument = t.cloneNode(id); | ||
} else { | ||
init.push(_core.types.assignmentExpression("=", _core.types.cloneNode(id), node)); | ||
args[i] = _core.types.cloneNode(id); | ||
init.push(t.assignmentExpression("=", t.cloneNode(id), node)); | ||
args[i] = t.cloneNode(id); | ||
} | ||
@@ -43,6 +37,6 @@ } | ||
node.arguments.forEach(arg => { | ||
if (_core.types.isArgumentPlaceholder(arg)) { | ||
if (t.isArgumentPlaceholder(arg)) { | ||
const id = scope.generateUid("_argPlaceholder"); | ||
placeholders.push(_core.types.identifier(id)); | ||
newArgs.push(_core.types.identifier(id)); | ||
placeholders.push(t.identifier(id)); | ||
newArgs.push(t.identifier(id)); | ||
} else { | ||
@@ -56,3 +50,3 @@ newArgs.push(arg); | ||
name: "proposal-partial-application", | ||
inherits: _pluginSyntaxPartialApplication.default, | ||
inherits: syntaxPartialApplication, | ||
visitor: { | ||
@@ -83,7 +77,7 @@ CallExpression(path) { | ||
}); | ||
sequenceParts.push(_core.types.assignmentExpression("=", _core.types.cloneNode(receiverLVal), receiver), _core.types.assignmentExpression("=", _core.types.cloneNode(functionLVal), _core.types.memberExpression(_core.types.cloneNode(receiverLVal), property)), ...argsInitializers, _core.types.functionExpression(_core.types.isIdentifier(property) ? _core.types.cloneNode(property) : path.scope.generateUidIdentifierBasedOnNode(property), placeholdersParams, _core.types.blockStatement([_core.types.returnStatement(_core.types.callExpression(_core.types.memberExpression(_core.types.cloneNode(functionLVal), _core.types.identifier("call")), [_core.types.cloneNode(receiverLVal), ...args]))], []), false, false)); | ||
sequenceParts.push(t.assignmentExpression("=", t.cloneNode(receiverLVal), receiver), t.assignmentExpression("=", t.cloneNode(functionLVal), t.memberExpression(t.cloneNode(receiverLVal), property)), ...argsInitializers, t.functionExpression(t.isIdentifier(property) ? t.cloneNode(property) : path.scope.generateUidIdentifierBasedOnNode(property), placeholdersParams, t.blockStatement([t.returnStatement(t.callExpression(t.memberExpression(t.cloneNode(functionLVal), t.identifier("call")), [t.cloneNode(receiverLVal), ...args]))], []), false, false)); | ||
} else { | ||
sequenceParts.push(_core.types.assignmentExpression("=", _core.types.cloneNode(functionLVal), node.callee), ...argsInitializers, _core.types.functionExpression(_core.types.isIdentifier(node.callee) ? _core.types.cloneNode(node.callee) : path.scope.generateUidIdentifierBasedOnNode(node.callee), placeholdersParams, _core.types.blockStatement([_core.types.returnStatement(_core.types.callExpression(_core.types.cloneNode(functionLVal), args))], []), false, false)); | ||
sequenceParts.push(t.assignmentExpression("=", t.cloneNode(functionLVal), node.callee), ...argsInitializers, t.functionExpression(t.isIdentifier(node.callee) ? t.cloneNode(node.callee) : path.scope.generateUidIdentifierBasedOnNode(node.callee), placeholdersParams, t.blockStatement([t.returnStatement(t.callExpression(t.cloneNode(functionLVal), args))], []), false, false)); | ||
} | ||
path.replaceWith(_core.types.sequenceExpression(sequenceParts)); | ||
path.replaceWith(t.sequenceExpression(sequenceParts)); | ||
} | ||
@@ -93,4 +87,3 @@ } | ||
}); | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@babel/plugin-proposal-partial-application", | ||
"version": "7.21.4-esm.3", | ||
"version": "7.21.4-esm.4", | ||
"description": "Introduces a new ? token in an argument list which allows for partially applying an argument list to a call expression", | ||
@@ -20,4 +20,4 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "7.21.4-esm.3", | ||
"@babel/plugin-syntax-partial-application": "7.21.4-esm.3" | ||
"@babel/helper-plugin-utils": "7.21.4-esm.4", | ||
"@babel/plugin-syntax-partial-application": "7.21.4-esm.4" | ||
}, | ||
@@ -28,4 +28,4 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "7.21.4-esm.3", | ||
"@babel/helper-plugin-test-runner": "7.21.4-esm.3" | ||
"@babel/core": "7.21.4-esm.4", | ||
"@babel/helper-plugin-test-runner": "7.21.4-esm.4" | ||
}, | ||
@@ -32,0 +32,0 @@ "engines": { |
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
6
16588
85
+ Added@babel/helper-plugin-utils@7.21.4-esm.4(transitive)
+ Added@babel/plugin-syntax-partial-application@7.21.4-esm.4(transitive)
- Removed@babel/helper-plugin-utils@7.21.4-esm.3(transitive)
- Removed@babel/plugin-syntax-partial-application@7.21.4-esm.3(transitive)
Updated@babel/plugin-syntax-partial-application@7.21.4-esm.4