node package manager


JavaScript import/export compiler


Compiler allows you to use import/export directives and then compile the code to native JavaScript. It is very lightweight with low complexity.

If you have objects World.animals, World.Animal
And want to create new object like World.animals.Dog you write

namespace World.animals;
import World.Animal;
export Dog = function () {};
Dog.prototype = Object.create( Animal.prototype );

instead of crappy long code like

World.animals.Dog = function () {};
World.animals.Dog.prototype = Object.create( World.animals.Animal );

If you want to create global variable like World (window.World) you create like

namespace Global;
export World = {};

Execute in your cmd [in the folder of compiler util]
node build.js --include ../example/in/include.json --out ../example/out/build.js

Or use compiler.cmd as in the example.