
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
babel-plugin-pkg
Advanced tools
Resolves _PKG_VERSION to version from package.json - also works with any other field!
Resolves _PKG_VERSION to version from package.json - also works with any other field!
This plugin attempts to dynamically replace expressions starting with process.env.REPLACE_PKG_
.
npm install --save-dev babel-plugin-pkg@^2.1.0
yarn add --dev babel-plugin-pkg@^2.1.0
(if configured properly)
npm install --save-dev @jaid/babel-plugin-pkg@^2.1.0
Reference fields from your package.json
in your source files.
package.json
{
"name": "readable-ms",
"version": "1.2.3"
}
src/index.js
console.log(`This is ${process.env.REPLACE_PKG_NAME} v${process.env.REPLACE_PKG_VERSION}`)
This will be transpiled to:
dist/index.js
console.log("This is readable-ms v1.2.3")
Add to your Babel configuration.
.babelrc.js
module.exports = {
plugins: [
"pkg"
]
}
Default | Info | |
---|---|---|
cwd | (determined by Babel) | The directory which the search for the package.json file begins in. |
nameFallback | true | If true and package.json does not contain a "name" field, the folder name that contains the chosen package.json file will be used as replacement. |
prefix | REPLACE_PKG_ | Only members of process.env starting with this string will be replaced. |
Setting up:
git clone git@github.com:jaid/babel-plugin-pkg.git
cd babel-plugin-pkg
npm install
Testing:
npm run test:dev
Testing in production environment:
npm run test
MIT License
Copyright © 2020, Jaid <jaid.jsx@gmail.com> (https://github.com/jaid)
FAQs
Resolves _PKG_VERSION to version from package.json - also works with any other field!
The npm package babel-plugin-pkg receives a total of 11 weekly downloads. As such, babel-plugin-pkg popularity was classified as not popular.
We found that babel-plugin-pkg 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.