
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
browserify-deoptimizer
Advanced tools
Transforms browserify bundles into a collection of single files
Sometimes you work in browsers without //@ sourceURL
or source maps. But you like using Browserify, since it's
truly amazing. How will you ever debug things? With all your modules squished into one file, it's a disaster.
Enter the Browserify Deoptimizer, which will handily “de-optimize” your Browserify bundles by turning them into individual files, including files for each module you author.
You use the Browserify Deoptimizer by first creating a Browserify bundle, programmatically. Then, instead of creating a
big string with bundle.bundle()
, you just deoptimize it!
var browserify = require("browserify");
var deoptimize = require("browserify-deoptimizer");
var bundle = browserify();
bundle.alias("jquery", "jquery-browserify");
bundle.addEntry("start.js");
var baseDirectory = process.cwd(); // module IDs will be determined relative to this
var deoptimized = deoptimize(bundle, baseDirectory);
Your deoptimized
variable will then look something like this:
{
"browserify-prelude.js": 'var require = function (file, …',
"node_modules/jquery-browserify/package.json": 'require.define("/node_modules/…',
"node_modules/jquery-browserify/index.js": 'require.define("/node_modules/…',
"browserify-aliases.js": 'require.alias("jquery-browseri…',
"start.js": 'require.define("/start.js",fun…',
"browserify-entry.js": 'require("/start.js");'
}
You can then use these module IDs to write out the wrapped files to the filesystem, and the appropriate <script>
tags
to your index.html
.
Since Browserify does some magic, we can't just create a single file for each of your modules. We need some magic files too. These are:
browserify-prelude.js
: contains the definition of require
and process
, as well as any prepends with
bundle.prepend
. This will be the first file in the map.browserify-aliases.js
: Contains any calls to Browserify's require.alias
to set up module aliases. This is inserted
into the map after the entries for the aliased files themselves (e.g. after jquery-browserify's files). If there are
no aliases, this file will not exist.browserify-entry.js
: Contains calls to require
for all entry files in the bundle. If there are no entry files,
this file will not exist.This package owes its name to r.js, the RequireJS optimizer, which turns multiple AMD modules into a single bundled file. Since this package does the opposite, I thought it'd be clever to name it a deoptimizer.
FAQs
Transforms browserify bundles into a collection of single files
The npm package browserify-deoptimizer receives a total of 1 weekly downloads. As such, browserify-deoptimizer popularity was classified as not popular.
We found that browserify-deoptimizer 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.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.