@putout/engine-runner
Advanced tools
Comparing version 9.2.0 to 9.2.1
{ | ||
"name": "@putout/engine-runner", | ||
"version": "9.2.0", | ||
"version": "9.2.1", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -5,0 +5,0 @@ "description": "run putout plugins", |
# @putout/engine-runner [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] | ||
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/engine-runner.svg?style=flat&longCache=true | ||
[NPMURL]: https://npmjs.org/package/@putout/engine-runner"npm" | ||
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/engine-runner.svg?style=flat&longCache=true | ||
[NPMURL]: https://npmjs.org/package/@putout/engine-runner"npm" | ||
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/engine-runner | ||
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/engine-runner | ||
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/engine-runner | ||
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/engine-runner | ||
Run putout plugins. | ||
@@ -28,5 +27,5 @@ | ||
module.exports.replace = () => { | ||
module.exports.replace = () => ({ | ||
'const a = 1': 'const b = 1', | ||
}; | ||
}); | ||
@@ -40,6 +39,6 @@ // optional | ||
module.exports.match = () => ({ | ||
'const __a = 1': ({__a}) { | ||
'const __a = 1': ({__a}) => { | ||
return true; | ||
} | ||
}) | ||
}, | ||
}); | ||
@@ -57,5 +56,5 @@ // optional | ||
module.exports.replace = () => { | ||
module.exports.replace = () => ({ | ||
'debugger': '', | ||
}; | ||
}); | ||
``` | ||
@@ -68,5 +67,5 @@ | ||
module.exports.replace = () => { | ||
module.exports.replace = () => ({ | ||
'var __a = 1': 'const __a = 1', | ||
}; | ||
}); | ||
``` | ||
@@ -79,5 +78,5 @@ | ||
module.exports.replace = () => { | ||
module.exports.replace = () => ({ | ||
'const __a = __b': 'const __b = __a', | ||
}; | ||
}); | ||
``` | ||
@@ -94,3 +93,3 @@ | ||
module.exports.replace = () => { | ||
module.exports.replace = () => ({ | ||
'for (const __a of __b) __c': ({__a, __b, __c}, path) => { | ||
@@ -100,3 +99,3 @@ // remove node | ||
}, | ||
}; | ||
}); | ||
``` | ||
@@ -109,3 +108,3 @@ | ||
module.exports.replace = () => { | ||
module.exports.replace = () => ({ | ||
'for (const __a of __array) __c': ({__a, __array, __c}, path) => { | ||
@@ -116,3 +115,3 @@ // update __array elements count | ||
}, | ||
}; | ||
}); | ||
``` | ||
@@ -125,3 +124,3 @@ | ||
module.exports.replace = () => { | ||
module.exports.replace = () => ({ | ||
'for (const __a of __array) __c': ({__a, __array, __c}, path) => { | ||
@@ -131,3 +130,3 @@ // update the whole node using template string | ||
}, | ||
}; | ||
}); | ||
``` | ||
@@ -183,4 +182,4 @@ | ||
push(path); | ||
} | ||
} | ||
}, | ||
}; | ||
}; | ||
@@ -201,11 +200,11 @@ ``` | ||
Program: { | ||
exit: { | ||
exit() { | ||
console.log(listStore()); | ||
// returns | ||
['x', 'x', 'x'] | ||
['x', 'x', 'x']; | ||
// for code | ||
'debugger; debugger; debugger' | ||
} | ||
} | ||
} | ||
'debugger; debugger; debugger'; | ||
}, | ||
}, | ||
}; | ||
}; | ||
@@ -229,15 +228,17 @@ ``` | ||
Program: { | ||
exit: { | ||
store() | ||
exit() { | ||
store(); | ||
// returns | ||
['world'] | ||
['world']; | ||
store.entries(); | ||
// [['hello', 'world']] | ||
// returns | ||
[['hello', 'world']]; | ||
store('hello'); | ||
// 'world' | ||
} | ||
} | ||
} | ||
// returns | ||
'world'; | ||
}, | ||
}, | ||
}; | ||
}; | ||
@@ -262,4 +263,4 @@ ``` | ||
push(path); | ||
} | ||
} | ||
}, | ||
}); | ||
}; | ||
@@ -278,6 +279,7 @@ ``` | ||
options: {}, // optional | ||
plugin: | ||
plugin: { | ||
include: () => ['debugger'], | ||
fix: (path) => path.remove(), | ||
report: () => `debugger should not be used`, | ||
}, | ||
}]; | ||
@@ -290,3 +292,3 @@ | ||
fix: true, // default | ||
fixCount: 1 // default | ||
fixCount: 1, // default | ||
plugins, | ||
@@ -311,2 +313,1 @@ parser: 'babel', // default | ||
MIT | ||
26596
296