Based on Babel 6+ ecosystem. Some names: rollpack, rolldown, lowup, stayup
transpiles to Node >= 4
Smart Plugins API
built on @node-minibase and @node-base ecosystem.
'use strict'
/**
* Tree-shaking bundler for modern
* javascript development.
*/
import Frog from 'frog'
const app = new Frog({})
/**
* Smart plugins concept.
* Only the first one is called immeidately.
* The other nested are lazy called if it needs.
*
* Before calling the plugins stack we will already
* collected all the things for the given string
* from the Babylon/Babel AST
*/
app.use(function (frog) {
// this === frog === app
// called once immediately, useful to extend the tool.
// If it returns a function, it will be called
// in later point of time with different context and argument
return function ({ filepath }) {
const imp = this
// this !== frog !== app
// this === imp
// this.filepath === imp.filepath === filepath
// this is equal to that object passed as first argument
//
// That context has `filepath` property, which will be
// defined path in import string.
//
// Called once on each import.
// If it returns a function, it will be called with object
// context containing the `code/source` of that filepath.
return function ({ source }) {
const file = this // why not Vinyl file?
// this !== frog !== app !== imp
// this === file
// this.source === file.source === source
}
}
})
app.parse('// some es5 or es6 code, but with ES6 Modules!')
Smart Plugins API