New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@putout/engine-runner

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/engine-runner - npm Package Compare versions

Comparing version 6.9.2 to 6.10.0

lib/list-store.js

37

lib/merge-visitors.js

@@ -9,2 +9,3 @@ 'use strict';

const maybeArray = require('./maybe-array');
const listStore = require('./list-store');

@@ -32,13 +33,23 @@ const shouldSkip = (a) => !a.parent;

for (const {rule, plugin, msg, options} of pluginsToMerge) {
const {push, pull} = getStore(plugin, {
fix,
rule,
shebang,
msg,
});
const {
push,
pull,
store,
} = getStore(
plugin,
{
fix,
rule,
shebang,
msg,
},
);
pushed[rule] = pull;
pushed[rule] = () => {
return pull();
};
const visitor = plugin.traverse({
push,
store,
generate,

@@ -57,2 +68,3 @@ options,

options,
store,
}));

@@ -74,3 +86,4 @@ }

function getStore(plugin, {fix, rule, shebang, msg}) {
let value = [];
const store = listStore();
const placesStore = listStore();

@@ -81,3 +94,3 @@ const push = (path) => {

value.push({
placesStore ({
message,

@@ -95,5 +108,4 @@ position,

const pull = () => {
const a = value;
value = [];
return a;
store.clear();
return placesStore.clear();
};

@@ -104,4 +116,5 @@

pull,
store,
};
}
{
"name": "@putout/engine-runner",
"version": "6.9.2",
"version": "6.10.0",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

@@ -53,3 +53,3 @@ "description": "run putout plugins",

"coveralls": "^3.0.0",
"eslint": "^7.0.0-rc.0",
"eslint": "^7.0.0",
"eslint-plugin-node": "^11.0.0",

@@ -56,0 +56,0 @@ "eslint-plugin-putout": "^5.0.1",

@@ -134,2 +134,29 @@ # putout-engine-runner [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]

#### Store
To keep things during traverse in a safe way `store` can be used.
```
module.exports.traverse = ({push, store}) => {
return {
'debugger'(path) {
store('x');
push(path);
},
Program: {
exit: {
console.log(store());
// returns
['x', 'x', 'x']
// for code
'debugger; debugger; debugger'
}
}
}
};
```
`store` is prefered way of keeping array elements, because of caching of `putout`, `traverse` init function called only once, and any other way
of handling variables will most likely will lead to bugs.
### Finder

@@ -136,0 +163,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