jeanmachuca / fjb

fast javascript bundler :package:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fast Javascript Bundler

What?

It is what it says it is.
However, this bundler aims to be a monolithic does-it-all type of bundler; with zero configuration needed. (however, optional configuration will be supported)

Philosophy

  1. A bundler should not need excessive attention.
  2. A bundler should not get in the way of a developers workflow.
  3. A bundler should be fast.
  4. A bundler should not be written in Javascript / Node.
  5. Commonly used features among JS developers should be supported out of the box.
  6. The output of the bundler should work everywhere. (to an extent which is possible of course)

More About the Philosophy

Output formats

Most bundlers allows you to select an output format of the code, such as:

"CommonJS", "AMD", "System", "UMD", "ES6", "ES2015" or "ESNext"

FJB does not implement this concept.
Instead, FJB adapts the code automatically through static analysis.
FJB aims to generate code that works everywhere (when possible).
A bundler should be smart enough so that the developer can focus on other things. 🧠

How does one use it?

fjb index.js

Features

  • Being fast
  • ES6 module imports / exports
  • Aliased imports
  • Wildcard imports
  • JSX support
  • Importing JSON
  • Importing CSS
  • Removing dead code (Tree shaking)
  • Supports package.json
  • Importing anything, even when it's not exported, no matter how deeply nested it is

Planned Features

  • Plugin support
  • TypeScript support
  • Lazy imports
  • Better formatted output. (kind of ugly right now)

Example

Below is an example of some code that is 100% supported.
(Without any plugins or configuration)

For more examples, have a look at:

Benchmarks πŸš€

To see benchmarks, have a look at benchmarks.md πŸ”₯

Installing

Dependencies

To build fjb you will need the following:

  1. A C compiler (I would suggest gcc)
  2. Git

Steps to Install πŸ”§

Compiling it

  1. Clone down the repository
  2. Run:
./build.sh

This step will generate a fjb.out executable file.
You can start using this right away. 🎩

Installing globally

To continue and install fjb globally: Run:

make install

Also make sure you add $HOME/.local/bin to your PATH.
https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path

Questions and Answers ❓

How fast is it?

Have a look at benchmarks.md πŸ”₯

How serious is this?

Not sure, it's just a hobby project at this point.

Why are you making this?

Frustration, frustration with existing tools.
The existing alternatives are not fast enough, and gets in the way a bit more than they should.

Is it mature enough to use it with React?

At some point, I want this project to get there.
But right now, it lacks some features.
For example, fjb currently supports JSX; but react-jsx is not implemented
right now.

Should I use it?

I will not encourage anyone to use it, but feel free to do it.

Does it work on Linux?

Yes

Does it work on Windows?

Probably not, but feel free to make a pull-request with the required changes for it to work.

Does it work on MacOS?

Probably. I haven't tried it, but I would definitely think so.

Can I contribute?

Yes you can. Simply fork it and start making pull-requests.

How do I create a plugin for it?

It's not possible at this point.
This is a feature I plan to implement.
If you want some other behaviour right now, simply just change the source code.

In which way to you plan to implement plugins?

I'm thinking about shared library files, such as .so, .a, .dll ... etc.

Will you add support for writing plugins in Javascript?

No. I don't think Javascript belongs in a bundler.
The reason why most bundlers today are slow, is because they are written in Javascript.

What if I find a bug?

If you find a bug, please report it here: https://github.com/sebbekarlsson/fjb/issues

When will TypeScript support be added?

The process of implementing this will come soon,
it's important that we have a stable foundation first.

What license is FJB under?

GPL-3.0, LICENSE.md

I'm having problems installing FJB

Feel free to create an issue here, and I'll be able to help you.

Can I become a collaborator?

I would prefer if you make pull-requests through forking at first.
Once I've seen that you've made valuable contributions, you might be able to be added as a collaborator.

About

fast javascript bundler :package:

License:GNU General Public License v3.0


Languages

Language:C 92.9%Language:JavaScript 2.7%Language:Python 1.5%Language:C++ 1.0%Language:Makefile 1.0%Language:Shell 0.5%Language:HTML 0.5%Language:CSS 0.1%