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.4 to 7.22.5

43

lib/index.js

@@ -1,8 +0,14 @@

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 => {
"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 => {
api.assertVersion(7);
function hasArgumentPlaceholder(node) {
return node.arguments.some(arg => t.isArgumentPlaceholder(arg));
return node.arguments.some(arg => _core.types.isArgumentPlaceholder(arg));
}

@@ -15,3 +21,3 @@ function unwrapArguments({

const node = args[i];
if (!t.isArgumentPlaceholder(node) && !t.isImmutable(node)) {
if (!_core.types.isArgumentPlaceholder(node) && !_core.types.isImmutable(node)) {
const id = scope.generateUidIdentifierBasedOnNode(node, "param");

@@ -21,8 +27,8 @@ scope.push({

});
if (t.isSpreadElement(node)) {
init.push(t.assignmentExpression("=", t.cloneNode(id), t.arrayExpression([t.spreadElement(node.argument)])));
node.argument = t.cloneNode(id);
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);
} else {
init.push(t.assignmentExpression("=", t.cloneNode(id), node));
args[i] = t.cloneNode(id);
init.push(_core.types.assignmentExpression("=", _core.types.cloneNode(id), node));
args[i] = _core.types.cloneNode(id);
}

@@ -37,6 +43,6 @@ }

node.arguments.forEach(arg => {
if (t.isArgumentPlaceholder(arg)) {
if (_core.types.isArgumentPlaceholder(arg)) {
const id = scope.generateUid("_argPlaceholder");
placeholders.push(t.identifier(id));
newArgs.push(t.identifier(id));
placeholders.push(_core.types.identifier(id));
newArgs.push(_core.types.identifier(id));
} else {

@@ -50,3 +56,3 @@ newArgs.push(arg);

name: "proposal-partial-application",
inherits: syntaxPartialApplication,
inherits: _pluginSyntaxPartialApplication.default,
visitor: {

@@ -77,7 +83,7 @@ CallExpression(path) {

});
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));
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));
} else {
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));
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));
}
path.replaceWith(t.sequenceExpression(sequenceParts));
path.replaceWith(_core.types.sequenceExpression(sequenceParts));
}

@@ -87,3 +93,4 @@ }

});
exports.default = _default;
//# sourceMappingURL=index.js.map
{
"name": "@babel/plugin-proposal-partial-application",
"version": "7.21.4-esm.4",
"version": "7.22.5",
"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.4",
"@babel/plugin-syntax-partial-application": "7.21.4-esm.4"
"@babel/helper-plugin-utils": "^7.22.5",
"@babel/plugin-syntax-partial-application": "^7.22.5"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0 || ^7.21.4-esm.2"
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "7.21.4-esm.4",
"@babel/helper-plugin-test-runner": "7.21.4-esm.4"
"@babel/core": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.22.5"
},

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

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

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