Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@babel/helper-replace-supers
Advanced tools
@babel/helper-replace-supers is a Babel helper module that assists in handling super method calls and super property accesses in JavaScript classes. It is particularly useful when transforming ES6+ code to ES5, ensuring that the semantics of super calls are preserved correctly.
Super Method Call Replacement
This feature allows you to replace super method calls within a class method. The `replaceSuper` function is used to handle the transformation, ensuring that the correct object and super references are maintained.
const { replaceSuper } = require('@babel/helper-replace-supers');
function replaceSuperMethodCall(path, state) {
replaceSuper(path, state, {
getObjectRef() {
return path.node.object;
},
getSuperRef() {
return path.node.super;
},
file: state.file
});
}
Super Property Access Replacement
This feature allows you to replace super property accesses within a class. Similar to method call replacement, the `replaceSuper` function ensures that property accesses are correctly transformed.
const { replaceSuper } = require('@babel/helper-replace-supers');
function replaceSuperPropertyAccess(path, state) {
replaceSuper(path, state, {
getObjectRef() {
return path.node.object;
},
getSuperRef() {
return path.node.super;
},
file: state.file
});
}
This plugin is part of the Babel preset for transforming ES2015 (ES6) classes to ES5. It handles super method calls and property accesses, ensuring compatibility with older JavaScript environments.
Helper function to replace supers
See our website @babel/helper-replace-supers for more information.
Using npm:
npm install --save @babel/helper-replace-supers
or using yarn:
yarn add @babel/helper-replace-supers
v7.25.9 (2024-10-22)
babel-parser
, babel-template
, babel-types
syntacticPlaceholders
mode (@liuxingbaoyu)babel-helper-compilation-targets
, babel-preset-env
ClassAccessorProperty
to prevent the no-undef
rule (@victorenator)babel-parser
, babel-types
VISITOR_KEYS
etc. faster to access (@liuxingbaoyu)FAQs
Helper function to replace supers
The npm package @babel/helper-replace-supers receives a total of 29,119,878 weekly downloads. As such, @babel/helper-replace-supers popularity was classified as popular.
We found that @babel/helper-replace-supers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.