Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
bundle-collapser
Advanced tools
convert bundle paths to IDs to save bytes in browserify bundles
The easiest way to use bundle-collapser is from the plugin:
$ browserify -p bundle-collapser/plugin main.js
Instead of the usual output which would have the original require('./foo.js')
style calls in it, the output just has require(2)
style paths, which minifies
more compactly:
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
module.exports = function (n) { return n * 5 }
},{}],2:[function(require,module,exports){
var bar = require(1);
module.exports = function (n) { return bar(n+1) }
},{}],3:[function(require,module,exports){
var foo = require(2);
var bar = require(1);
console.log(foo(5) * bar(2));
},{}]},{},[3]);
You can use bundle-collapser from the api too:
var collapse = require('bundle-collapser');
var fs = require('fs');
var src = fs.readFileSync(__dirname + '/bundle.js', 'utf8');
collapse(src).pipe(process.stdout);
There is also a command-line program included in this distribution:
usage: bundle-collapser {FILE | -} {OPTIONS}
Collapse a browser-pack/browserify bundle from STDIN or a FILE.
OPTIONS:
-h --help Show this message.
var collapse = require('bundle-collapser')
Return a readable stream
of output from
browser-pack with the input source
string src
converted to have its require()
calls collapsed down to the
dependency targets in the "deps" fields from the unpacking.
With npm, to get the library do:
npm install bundle-collapser
and to get the command-line program do:
npm install -g bundle-collapser
MIT
FAQs
convert bundle paths to IDS to save bytes in browserify bundles
The npm package bundle-collapser receives a total of 24,763 weekly downloads. As such, bundle-collapser popularity was classified as popular.
We found that bundle-collapser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 41 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.