Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
babel-plugin-transform-require-extensions
Advanced tools
A Babel plugin that transforms specified require path file extensions.
A Babel plugin that transforms specified require
path file extensions.
This is useful for building dual ESM/CJS packages. File names with extensions are mandatory in ESM import
specifiers in .mjs
files. After transpiling this to CJS in .js
files, the hardcoded .mjs
extensions in the require
paths must be transformed to .js
. Alternatively, sometimes it’s safe to remove the extensions as Node.js in CJS mode can automatically resolve .js
file extensions.
To install from npm run:
npm install babel-plugin-transform-require-extensions --save-dev
Configure Babel to use the plugin:
{ "plugins": ["transform-require-extensions"] }
This plugin must run after any ESM to CJS transpilation occurs.
By default .mjs
extensions are transformed to .js
. The extensions
option can be used to specify extension replacements. For example, to remove .mjs
extensions:
{
"plugins": [
[
"transform-require-extensions",
{
"extensions": {
".mjs": ""
}
}
]
]
}
2.0.1
hard-rejection
dev dependency to ensure unhandled rejections in tests exit the process with an error.test:prettier
script.semi
to the default, true
.assert
imports.FAQs
A Babel plugin that transforms specified require path file extensions.
The npm package babel-plugin-transform-require-extensions receives a total of 5 weekly downloads. As such, babel-plugin-transform-require-extensions popularity was classified as not popular.
We found that babel-plugin-transform-require-extensions 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.