Extended version of bundle-collapser, providing support for custom collapsing and presets.
For all original information regarding this package, visit bundle-collapser homepage.
CLI usage is not available for now.
npm install bundle-collapser-extended --save
API is the same as in original package, except it adds additional option of providing custom collapsing and presets.
opts.custom
takes array of replacement objects, with properties:
replacement
: replacement for found node, where%s
is used as placeholder for replacement module IDvalue
: original module IDcheck
: provides argumentnode
which is currently traversed node. It should return boolean to indicate that this is the node you want to replace.
opts.preset
takes array of strings or replacement objects. If defined as string, it will look inside lib/preset
directory for predefined preset. Preset should return object in same format as replacement object for opts.custom
.
If it’s not defined as string, it will use replacement object in the same format as opts.custom
.
MIT, original package by substack, modifications by Ivan Nikolić