Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
babel-plugin-transform-preprocessor
Advanced tools
Simple identifier replacements for Babel, supporting function name (__funcname
) as well as any custom mapping, such as would usually be handled by a preprocessor in other languages. This is particularly useful if you have a profiling build that wants additional instrumentation.
Example (__funcname and custom replace)
Configuration (.babelrc or otherwise):
{
"plugins": [
["transform-preprocessor", {
"replace": {
"trace()": "if (_enabled) logTrace(__funcname)",
}
}]
]
}
Input:
function test1() {
console.log(__funcname);
}
function test2() {
trace();
}
Output:
function test1() {
console.log("test1");
}
function test2() {
if (_enabled) logTrace("test2");
}
Options
{
replace: {
'source': 'dest', // simple replacement applied to Identifiers, replaces with specified code
'source()': 'dest()', // simple replacement applied to a CallExpressions, replaces with specified code
'source': (path) => {}, // calls replacement function, maybe just write a Babel plugin instead?
'source()': '', // replace a CallExpression with nothing
'__funcname': null, // disable a default replacement (__funcname will remain in output source)
}
}
Default options
{
replace: {
'__funcname': replacerFuncName, // see lib/transform-preprocessor.js
}
}
Future work
F(A, B)
=> f(A + 1, B, c)
const WIDTH = __define(10)
, or leave this kind of optimization to the minifiers?FAQs
Simple identifier replacements for Babel
The npm package babel-plugin-transform-preprocessor receives a total of 0 weekly downloads. As such, babel-plugin-transform-preprocessor popularity was classified as not popular.
We found that babel-plugin-transform-preprocessor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.