npm:
npm install vantage-es6-contextified-repl
yarn:
yarn add vantage-es6-contextified-repl
import Vantage from 'vantage'
import repl from 'vantage-es6-contextified-repl'
import chalk from 'chalk'
import figlet from 'figlet'
new Vantage()
.use(repl, {
delimiter: chalk.red('repl:'),
description: 'Server REPL with access to app and db objects !',
banner: 'Have fun !',
context: { infos, app, db },
formatter: 'highlight'
})
.banner(figlet.textSync('MAIN SERVER'))
.delimiter(chalk.green('main-server~$'))
.listen(8080)
.show()
mode
- the command to type to enter in REPL mode, default torepl
.description
- the mode description displayed in help menu, default toEnters REPL mode.
.banner
- the welcome message displayed when entrering in REPL mode, default to:Entering REPL Mode. To exit, type 'exit'
.delimiter
- the additional delimiter of the mode, default torepl:
.timeout
- the maximum amout of time to eval the code, default to15000
.context
- the REPL context, accessible from evalued code, default to{}
.compiler
- the code transformation functon, setnull
or a functon using signaturefunction(code:string)
and that returns astring
, the default function uses Babel.formatter
- the output transformation functon, sethighlight
,none
or a functon using signaturefunction(input:string)
and that returns astring
, default tohighlight
.
TODO: Multiline input support
TODO: Make an option to use a custom or predefined theme for
highlight
formatter
Name |
---|
Victor Rebiard--Crépin |
MIT © Victor Rebiard--Crépin