Gathering detailed insights and metrics for require-swapper
Gathering detailed insights and metrics for require-swapper
Gathering detailed insights and metrics for require-swapper
Gathering detailed insights and metrics for require-swapper
Browserify transform to swap CommonJS require call to custom function call
npm install require-swapper
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
29 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Sep 08, 2018
Latest Version
0.1.7
Package Id
require-swapper@0.1.7
Unpacked Size
5.08 kB
Size
2.09 kB
File Count
4
NPM Version
5.10.0
Node Version
6.14.4
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
5
Browserify v2 transform to swap CommonJS require call to custom function call
1npm install require-swapper browserify
Require-swapper swaps all CommonJS require()
function calls in your code to specified custom function, or for certain module which matches given target module list.
Suppose you have following index.js and swapping require function to myrequire()
for module aaa
,
1var aaa = require('aaa') 2 , bbb = require('./dir1/bbb') 3 , ccc = require('./dir2/ccc') 4 5module.exports = function() { 6 aaa(bbb, ccc); 7}
It will output the folowing content to downstream.
1var aaa = myrequire('aaa') 2 , bbb = require('./dir1/bbb') 3 , ccc = require('./dir2/ccc') 4 5module.exports = function() { 6 aaa(bbb, ccc); 7}
As the loading function for module aaa
become swapped, browserify worker will not resolve and bundle the module aaa
statically.
It is anticipated that your custom loader function myrequire
would resolve it.
Combining browserify CLI, you can use it like following:
1browserify index.js -t [ require-swapper --fn 'myrequire' --module 'aaa' ] > bundle.js
options.fn
Specify your custom function name to swap require()
call.
options.modules
A target module list or glob pattern to swap require()
. If the option is not specified, all require()
call will be replaced.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/29 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
21 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More