Experimental DSL for module definitions.
$ npm i def-module -S
def() we are creating definition containers.
const def = ;const $ = ;
def()— self-contained context
def('module')— named module definition on global context
def('module', context)— module is defined into the given context
def(parent, 'module')— module inherits all definitions from given parent
Shared containers can be achieved by passing the same context.
Any container, once declared, can be extended through definitions.
The declared functionality is later composed when creating new objects.
const base = $Base;// beep 42
new() method is very powerful, e.g.
We can define modules with inherited functionality also.
Instances are composed from multiple definitions at once, prototypes are always merged and constructors are called in order.
// note that `new` is supportedconst o = ;// beep -42// boop -42
We don't need to call
super() since there is no parent instances.
Module definitions can be nested through using key paths.
const home = ;