@sepalang/padoc

ASAP compile the ECMAScript

Usage no npm install needed!

<script type="module">
  import sepalangPadoc from 'https://cdn.skypack.dev/@sepalang/padoc';
</script>

README

npm version CircleCI Codacy Badge Greenkeeper badge

PADOC

It is a tool for extracting compilation and distribution source with a simple command library written in es6.

Install

npm i @sepalang/padoc

Usage

ES6 each module compile

padoc src dist -m umd

# long
padoc src dist --module umd

It will be start recursive compile

Compiling to a single chunk

padoc --pack src/index.js dist/onefile.js -m umd
padoc --pack src/index.js dist/onefile.js -m iife -n iQuery

# long
padoc --pack src/index.js dist/onefile.js --module umd
padoc --pack src/index.js dist/onefile.js --module iife --name iQuery

no compile single chunk

padoc --pack src/index.js dist/onefile.js -m es

It will be other files with dependencies will be stored in a single file. (By import or require)

Support sourcemaps

padoc src dist -s
padoc --pack src/index.js dist/index.js -s

# long
padoc src dist --sourcemaps
padoc --pack src/index.js dist/index.js --sourcemaps

multiple chunk

padoc --pack 'src/foo.js src/bar.js' dist/dirname -m es
padoc --pack 'src/globfile-*.js' dist/dirname -m es

Execute ES6 file

padoc --exec index.js

Execute and REPL

Can access variables exports to a running file. Restrictions on babel-node may occur.

padoc --exec index.js -i

# long
padoc --exec index.js --interactive

Default plugins

Object rest spread

link

let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
let n = { x, y, ...z };

Do expression

link

let a = do {
  if(x > 10) {
    'big';
  } else {
    'small';
  }
};

Numeric separator

link

let budget = 1_000_000_000_000;

Async generators

link

async function* agf() {
  await 1;
}