![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
factor-bundle
Advanced tools
factor browser-pack bundles into a common bundle and entry-specific bundles
x.js:
var z = require('./z.js');
var w = require('./w.js');
console.log(z(5) * w(2));
y.js:
var z = require('./z.js');
console.log(z(2) + 111);
z.js:
module.exports = function (n) { return n * 111 }
w.js:
module.exports = function (n) { return n * 50 }
now pipe some module-deps json into
factor-bundle
:
$ module-deps x.js y.js | factor-bundle \
x.js -o bundle/x.js \
y.js -o bundle/y.js \
> bundle/common.js
or factor out an existing bundle already compiled by browserify:
$ browserify x.js y.js > bundle.js
$ browser-unpack < bundle.js | factor-bundle \
x.js -o bundle/x.js \
y.js -o bundle/y.js \
> bundle/common.js
and now you can have 2 pages, each with a different combination of script tags
but with all the common modules factored out into a common.js
to avoid
transferring the same code multiple times:
<script src="/bundle/common.js"></script>
<script src="/bundle/x.js"></script>
<script src="/bundle/common.js"></script>
<script src="/bundle/y.js"></script>
to verify this works from node you can do:
$ cat bundle/common.js bundle/x.js | node
55500
$ cat bundle/common.js bundle/y.js | node
333
usage: factor-bundle [ x.js -o bundle/x.js ... ] > bundle/common.js
Read `module-deps` json output from stdin, factoring each entry file out into
the corresponding output file (-o).
If there is a trailing unpaired `-o`, that file will be used for the common
bundle output. Otherwise, the final bundle is written to stdout.
var factor = require('factor-bundle')
Return a transform stream tr
that factors the array of entry path strings
files
out into bundle files. The input format that fr
expects is described
in the module-deps package.
The output format for fr
and each of the fr
sub-streams given by each
'stream'
event is also in the
module-deps format.
The files held in common among > opts.threshold
(default: 1) bundles will be
output on the fr
stream itself. The entry-specific bundles are diverted into
each 'stream'
event's output.
Each entry file emits a 'stream'
event containing all of the entry-specific
rows that are only used by that entry file (when opts.threshold === 1
, the
default).
The entry file name is available as stream.file
.
With npm do:
npm install factor-bundle
MIT
FAQs
factor browser-pack bundles into common shared bundles
The npm package factor-bundle receives a total of 3,916 weekly downloads. As such, factor-bundle popularity was classified as popular.
We found that factor-bundle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.