Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
babel-plugin-paths
Advanced tools
Babel plugin that returns an object containing paths like __dirname and __filename as static values
Babel macro that allows you to "import" the location of the source-file.
The supported paths you can import:
name | example |
---|---|
npmRoot | /Users/you/project |
gitRoot | /Users/you/project |
wd | /Users/you/project |
fileAbsolute | /Users/you/project/src/input.js |
file | input.js |
extention | .js |
filename | input |
baseAbsolute | /Users/you/project/src/ |
base | /src/ |
The default import is equal to base
.
Source file input.js
:
import base, { filename } from 'babel-plugin-module-paths/paths.macro';
console.log(base, filename);
alert(filename, base);
function usePathsForSomething() {
return [filename, base];
};
Output:
console.log("/src/", "input");
alert("input", "/src/");
function usePathsForSomething() {
return ["input", "/src/"];
};
Install:
yarn add babel-plugin-module-paths
If you don't have babel-macros already you must also install that:
yarn add babel-plugin-macros
Ensure you have babel-plugin-macros
in your babel config (.babelrc
).
{
"plugins": ["macros"]
}
FAQs
Babel plugin that returns an object containing paths like __dirname and __filename as static values
The npm package babel-plugin-paths receives a total of 1 weekly downloads. As such, babel-plugin-paths popularity was classified as not popular.
We found that babel-plugin-paths 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.