mirror of
https://github.com/developit/microbundle.git
synced 2026-01-25 14:06:50 +00:00
add the option to emit build events when running microbundle programmatically
This commit is contained in:
parent
99746d8280
commit
f08a7237f9
@ -99,6 +99,7 @@ export default async function microbundle(options) {
|
||||
}
|
||||
|
||||
if (options.watch) {
|
||||
const emitEvents = options.emit;
|
||||
return new Promise( (resolve, reject) => {
|
||||
process.stdout.write(chalk.blue(`Watching source, compiling to ${relative(cwd, dirname(options.output))}:\n`));
|
||||
steps.map( options => {
|
||||
@ -109,6 +110,9 @@ export default async function microbundle(options) {
|
||||
if (e.code==='ERROR' || e.code==='FATAL') {
|
||||
return reject(e);
|
||||
}
|
||||
if (emitEvents) {
|
||||
process.emit('event', e);
|
||||
}
|
||||
if (e.code==='END') {
|
||||
getSizeInfo(options._code, options.outputOptions.file).then( text => {
|
||||
process.stdout.write(`Wrote ${text.trim()}\n`);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user