All Projects → nathan → Pax

nathan / Pax

The fastest JavaScript bundler in the galaxy.

Programming Languages

javascript
184084 projects - #8 most used programming language
rust
11053 projects
es6
455 projects
ecmascript
72 projects

Projects that are alternatives of or similar to Pax

Browserify
browser-side require() the node.js way
Stars: ✭ 13,929 (+430.43%)
Mutual labels:  bundler, commonjs, modules, browser
Phaser Node Kit
Rapid Game Development with PhaserJS and Node for Modern Browsers
Stars: ✭ 39 (-98.51%)
Mutual labels:  build-tool, bundler, modules
nanobundle
Yet another build tool for libraries, powered by esbuild
Stars: ✭ 45 (-98.29%)
Mutual labels:  bundler, commonjs, build-tool
Parcel
The zero configuration build tool for the web. 📦🚀
Stars: ✭ 39,670 (+1410.66%)
Mutual labels:  build-tool, commonjs, modules
Trunk
Build, bundle & ship your Rust WASM application to the web.
Stars: ✭ 378 (-85.61%)
Mutual labels:  build-tool, bundler
Pundle
👾 peaceful bundles - js bundler, built from the ground up for speed and extensibility
Stars: ✭ 354 (-86.52%)
Mutual labels:  build-tool, bundler
Packem
📦⚡ A precompiled JavaScript module bundler
Stars: ✭ 586 (-77.68%)
Mutual labels:  build-tool, bundler
Html Modules Toolkit
Transforming HTML standards of the future into JavaScript standards of the past
Stars: ✭ 45 (-98.29%)
Mutual labels:  build-tool, modules
Neuron.js
A Full Feature CommonJS Module Manager, Dependency Graph Handler and Loader for Browsers
Stars: ✭ 66 (-97.49%)
Mutual labels:  bundler, commonjs
Steal
Gets JavaScript
Stars: ✭ 1,353 (-48.48%)
Mutual labels:  build-tool, commonjs
Node Blockly
Blockly for Node.js and Browser via CommonJS module
Stars: ✭ 117 (-95.54%)
Mutual labels:  commonjs, browser
rolldown
Modern bundler built on Rollup with couple more features, such as multiple entry points, presets, better configuration experience and more.
Stars: ✭ 17 (-99.35%)
Mutual labels:  bundler, modules
the-super-tiny-web-module-resolver
simple js bundler written in 100 lines of code.
Stars: ✭ 25 (-99.05%)
Mutual labels:  bundler, commonjs
Detective
Find all calls to require() no matter how deeply nested using a proper walk of the AST
Stars: ✭ 387 (-85.26%)
Mutual labels:  commonjs, modules
Cjstoesm
A tool that can transform CommonJS to ESM
Stars: ✭ 109 (-95.85%)
Mutual labels:  commonjs, modules
Instapack
All-in-one TypeScript and Sass compiler for web applications! 📦 🚀
Stars: ✭ 131 (-95.01%)
Mutual labels:  build-tool, bundler
Webpack
A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.
Stars: ✭ 60,034 (+2186.14%)
Mutual labels:  build-tool, commonjs
Velcro
A set of tools and libraries for stitching together modules and code in highly dynamic browser environments
Stars: ✭ 159 (-93.95%)
Mutual labels:  bundler, browser
Minipack
📦 A simplified example of a modern module bundler written in JavaScript
Stars: ✭ 2,625 (-0.04%)
Mutual labels:  commonjs, modules
Svg2pdf.js
A javascript-only SVG to PDF conversion utility that runs in the browser. Brought to you by yWorks - the diagramming experts
Stars: ✭ 231 (-91.2%)
Mutual labels:  browser

Pax

The fastest JavaScript bundler in the galaxy. Fully supports ECMAScript module syntax (import/export) in addition to CommonJS require(<string>).

Why do I need it?

Because your bundler is too slow.

You know the feeling. You make that tweak, hit ⌘S ⌘Tab ⌘R, and… nothing changes. You get the old version. You beat the bundler. You wait a few seconds, hit ⌘R again, and your changes finally show up. But it’s too late—you’ve lost momentum. It’s the wrong shade of pink. You spelled “menu” with a z. The bug still happens sometimes.

Rinse. Repeat. Ten cycles later, things are looking good. It’s time to git commit. But you spent more time waiting than working. And it’s your bundler’s fault.

Pax is a bundler. But you’ll never beat it. Why?

  • It’s parallelized. It makes the most of your cores.
  • It’s minimal. It isn’t bogged down by features you don’t need.
  • It knows exactly enough about JavaScript to handle dependency resolution. It doesn’t even bother parsing most of your source code.

Don’t waste time waiting for your bundler to do its thing. Use Pax while you’re developing, and iterate to your heart’s content. Use your super-cool, magical, slow-as-molasses bundler for releases, when you don’t care how long it takes to run.

How do I get it?

> cargo install pax

If you don’t have cargo, install it with https://rustup.rs.

How do I use it?

// index.js:
const itt = require('itt')
const math = require('./math')
console.log(itt.range(10).map(math.square).join(' '))

// math.js:
exports.square = x => x * x
> px index.js bundle.js

Slap on a <script src=bundle.js>, and you’re ready to go. Pass -w to rebuild whenever you change a file.

> px -w index.js bundle.js
 ready bundle.js in 1 ms
update bundle.js in 1 ms
...

Does it do source maps?

Of course!

# bundle.js and bundle.js.map
> px index.js bundle.js

# bundle.js with inline map
> px --map-inline index.js bundle.js

# bundle.js with no source map
> px index.js >bundle.js
# or
> px --no-map index.js bundle.js

Modules?

That’s technically not a question. But yes.

// index.mjs
import itt from 'itt'
import { square, cube } from './math'

console.log(itt.range(10).map(square).join(' '))
console.log(itt.range(10).map(cube).join(' '))

// math.mjs
export const square = x => x * x, cube = x => x * x * x
> px -e index.mjs bundle.js

If you need your modules to be in .js files for some reason, use -E (--es-syntax-everywhere) instead of -e (--es-syntax).

What are the options?

> px --help
pax v0.4.0

Usage:
    px [options] <input> [output]
    px [-h | --help]

Options:
    -i, --input <input>
        Use <input> as the main module.

    -o, --output <output>
        Write bundle to <output> and source map to <output>.map.
        Default: '-' for stdout.

    -m, --map <map>
        Output source map to <map>.

    -I, --map-inline
        Output source map inline as data: URI.

    -M, --no-map
        Suppress source map output when it would normally be implied.

    -w, --watch
        Watch for changes to <input> and its dependencies.

    -W, --quiet-watch
        Don't emit a bell character for errors that occur while watching.
        Implies --watch.

    -e, --es-syntax
        Support .mjs files with ECMAScript module syntax:

            import itt from 'itt'
            export const greeting = 'Hello, world!'

        Instead of CommonJS require syntax:

            const itt = require('itt')
            exports.greeting = 'Hello, world!'

        .mjs (ESM) files can import .js (CJS) files, in which case the
        namespace object has a single `default` binding which reflects the
        value of `module.exports`. CJS files can require ESM files, in which
        case the resultant object is the namespace object.

    -E, --es-syntax-everywhere
        Implies --es-syntax. Allow ECMAScript module syntax in .js files.
        CJS-style `require()` calls are also allowed.

    -x, --external <module1,module2,...>
        Don't resolve or include modules named <module1>, <module2>, etc.;
        leave them as require('<module>') references in the bundle. Specifying
        a path instead of a module name does nothing.

    --external-core
        Ignore references to node.js core modules like 'events' and leave them
        as require('<module>') references in the bundle.

    -h, --help
        Print this message.

    -v, --version
        Print version information.

Is it fast?

Umm…

Yes.

> time browserify index.js >browserify.js
real    0m0.225s
user    0m0.197s
sys     0m0.031s
> time node fuse-box.js
real    0m0.373s
user    0m0.324s
sys     0m0.051s
> time px index.js >bundle.js
real    0m0.010s
user    0m0.005s
sys     0m0.006s

# on a larger project
> time browserify src/main.js >browserify.js
real    0m2.385s
user    0m2.459s
sys     0m0.416s
> time px src/main.js >bundle.js
real    0m0.037s
user    0m0.071s
sys     0m0.019s

# want source maps?
> time browserify -d src/main.js -o bundle.js
real    0m3.142s
user    0m3.060s
sys     0m0.483s
> time px src/main.js bundle.js
real    0m0.046s
user    0m0.077s
sys     0m0.026s

# realtime!
> px -w examples/simple bundle.js
 ready bundle.js in 2 ms
update bundle.js in 2 ms
update bundle.js in 2 ms
update bundle.js in 1 ms
update bundle.js in 2 ms
update bundle.js in 1 ms
update bundle.js in 3 ms
^C
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].