
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
rollup-plugin-node-globals
Advanced tools
Plugin to insert node globals including so code that works with browserify should work even if it uses process or buffers. This is based on rollup-plugin-inject .
__dirname
__filename
Plus process.nextTick
and process.browser
are optimized to only pull in
themselves and __dirname
and __filename
point to the file on disk
There are a few options to control output
process
- pass false
to disable process polyfillingglobal
- pass false
to disable global polyfillingbuffer
- pass false
to disable Buffer polyfillingdirname
- pass false
to disable __dirname
polyfillingfilename
- pass false
to disable __filename
polyfillingbaseDir
which is used for resolving __dirname
and __filename
.var foo;
if (process.browser) {
foo = 'bar';
} else {
foo = 'baz';
}
turns into
import {browser} from 'path/to/process';
var foo;
if (browser) {
foo = 'bar';
} else {
foo = 'baz';
}
but with rollup that ends up being
var browser = true;
var foo;
if (browser) {
foo = 'bar';
} else {
foo = 'baz';
}
or
var timeout;
if (global.setImmediate) {
timeout = global.setImmediate;
} else {
timeout = global.setTimeout;
}
export default timeout;
turns into
import {_global} from 'path/to/global.js';
var timeout;
if (_global.setImmediate) {
timeout = _global.setImmediate;
} else {
timeout = _global.setTimeout;
}
export default timeout;
which rollup turns into
var _global = typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {}
var timeout;
if (_global.setImmediate) {
timeout = _global.setImmediate;
} else {
timeout = _global.setTimeout;
}
var timeout$1 = timeout;
export default timeout$1;
With that top piece only showing up once no matter how many times global was used.
FAQs
insert the same globals browserify does
The npm package rollup-plugin-node-globals receives a total of 38,669 weekly downloads. As such, rollup-plugin-node-globals popularity was classified as popular.
We found that rollup-plugin-node-globals 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.