Socket
Socket
Sign inDemoInstall

@babel/plugin-proposal-pipeline-operator

Package Overview
Dependencies
Maintainers
4
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-proposal-pipeline-operator - npm Package Compare versions

Comparing version 7.16.7 to 7.17.6

46

lib/hackVisitor.js

@@ -10,5 +10,17 @@ "use strict";

const topicReferenceReplacementVisitor = {
TopicReference(path) {
path.replaceWith(_core.types.cloneNode(this.topicVariable));
const topicReferenceVisitor = {
exit(path, state) {
if (path.isTopicReference()) {
state.topicReferences.push(path);
} else {
if (state.topicReferences.length === 0 && !state.sideEffectsBeforeFirstTopicReference && !path.isPure()) {
state.sideEffectsBeforeFirstTopicReference = true;
}
}
},
"ClassBody|Function"(_, state) {
if (state.topicReferences.length === 0) {
state.sideEffectsBeforeFirstTopicReference = true;
}
}

@@ -29,16 +41,26 @@

const topicVariable = scope.generateUidIdentifierBasedOnNode(node);
const pipeBodyPath = path.get("right");
scope.push({
id: topicVariable
});
if (pipeBodyPath.node.type === "TopicReference") {
pipeBodyPath.replaceWith(_core.types.cloneNode(topicVariable));
} else {
pipeBodyPath.traverse(topicReferenceReplacementVisitor, {
topicVariable
});
path.replaceWith(node.left);
return;
}
const visitorState = {
topicReferences: [],
sideEffectsBeforeFirstTopicReference: pipeBodyPath.isFunction()
};
pipeBodyPath.traverse(topicReferenceVisitor, visitorState);
if (visitorState.topicReferences.length === 1 && (!visitorState.sideEffectsBeforeFirstTopicReference || path.scope.isPure(node.left, true))) {
visitorState.topicReferences[0].replaceWith(node.left);
path.replaceWith(node.right);
return;
}
const topicVariable = scope.generateUidIdentifierBasedOnNode(node);
scope.push({
id: topicVariable
});
visitorState.topicReferences.forEach(path => path.replaceWith(_core.types.cloneNode(topicVariable)));
path.replaceWith(_core.types.sequenceExpression([_core.types.assignmentExpression("=", _core.types.cloneNode(topicVariable), node.left), node.right]));

@@ -45,0 +67,0 @@ }

{
"name": "@babel/plugin-proposal-pipeline-operator",
"version": "7.16.7",
"version": "7.17.6",
"description": "Transform pipeline operator into call expressions",

@@ -21,3 +21,3 @@ "repository": {

"@babel/helper-plugin-utils": "^7.16.7",
"@babel/plugin-syntax-pipeline-operator": "^7.16.7"
"@babel/plugin-syntax-pipeline-operator": "^7.17.0"
},

@@ -28,3 +28,3 @@ "peerDependencies": {

"devDependencies": {
"@babel/core": "^7.16.7",
"@babel/core": "^7.17.5",
"@babel/helper-plugin-test-runner": "^7.16.7"

@@ -31,0 +31,0 @@ },

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