Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/plugin-proposal-partial-application

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-proposal-partial-application - npm Package Compare versions

Comparing version 7.21.4-esm to 7.21.4-esm.1

43

lib/index.js

@@ -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",
"version": "7.21.4-esm.1",
"description": "Introduces a new ? token in an argument list which allows for partially applying an argument list to a call expression",

@@ -20,11 +20,11 @@ "repository": {

"dependencies": {
"@babel/helper-plugin-utils": "^7.21.4-esm",
"@babel/plugin-syntax-partial-application": "^7.21.4-esm"
"@babel/helper-plugin-utils": "^7.21.4-esm.1",
"@babel/plugin-syntax-partial-application": "^7.21.4-esm.1"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0 || 7.21.4-esm"
"@babel/core": "^7.0.0-0 || 7.21.4-esm.1"
},
"devDependencies": {
"@babel/core": "^7.21.4-esm",
"@babel/helper-plugin-test-runner": "^7.21.4-esm"
"@babel/core": "^7.21.4-esm.1",
"@babel/helper-plugin-test-runner": "^7.21.4-esm.1"
},

@@ -35,3 +35,3 @@ "engines": {

"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
"type": "module"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc