rollup 0.48.2 → 0.49.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/bin/rollup +394 -25
- package/dist/rollup.browser.js +2523 -2835
- package/dist/rollup.es.js +2728 -3048
- package/dist/rollup.js +2728 -3048
- package/package.json +8 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# rollup changelog
|
|
2
2
|
|
|
3
|
+
## 0.49.3
|
|
4
|
+
|
|
5
|
+
* Respect `watch` options ([#1596](https://github.com/rollup/rollup/issues/1596))
|
|
6
|
+
* Fix treeshaking regressions ([#1604](https://github.com/rollup/rollup/pull/1604))
|
|
7
|
+
* Allow `-o` to work with `output.format` ([#1606](https://github.com/rollup/rollup/pull/1606))
|
|
8
|
+
|
|
9
|
+
## 0.49.2
|
|
10
|
+
|
|
11
|
+
* Fix treeshaking regressions ([#1591](https://github.com/rollup/rollup/pull/1591))
|
|
12
|
+
|
|
13
|
+
## 0.49.1
|
|
14
|
+
|
|
15
|
+
* Fix treeshaking regressions ([#1586](https://github.com/rollup/rollup/pull/1586))
|
|
16
|
+
|
|
17
|
+
## 0.49.0
|
|
18
|
+
|
|
19
|
+
* Completely update the treeshaking algorithm ([#1582](https://github.com/rollup/rollup/pull/1582))
|
|
20
|
+
* Only flip screen buffer if appropriate ([#1574](https://github.com/rollup/rollup/pull/1574))
|
|
21
|
+
* Guard against two instances creating the same dir ([#1576](https://github.com/rollup/rollup/pull/1576))
|
|
22
|
+
|
|
3
23
|
## 0.48.2
|
|
4
24
|
|
|
5
25
|
* Paths is an output option ([#1569](https://github.com/rollup/rollup/pull/1569))
|
|
@@ -45,7 +65,7 @@
|
|
|
45
65
|
## 0.46.3
|
|
46
66
|
|
|
47
67
|
* init for/for-of loop section head with correct scopes ([#1538](https://github.com/rollup/rollup/issues/1538), [#1539](https://github.com/rollup/rollup/issues/1539))
|
|
48
|
-
* Fix namespace imports and re-exports in `es`
|
|
68
|
+
* Fix namespace imports and re-exports in `es` output ([#1511](https://github.com/rollup/rollup/issues/1511))
|
|
49
69
|
* Deshadow indirectly imported namespaces ([#1488](https://github.com/rollup/rollup/issues/1488), [#1505](https://github.com/rollup/rollup/issues/1505))
|
|
50
70
|
|
|
51
71
|
## 0.46.2
|
package/bin/rollup
CHANGED
|
@@ -10,6 +10,8 @@ var path__default = _interopDefault(path);
|
|
|
10
10
|
var module$1 = _interopDefault(require('module'));
|
|
11
11
|
var os = _interopDefault(require('os'));
|
|
12
12
|
var rollup = require('../dist/rollup.js');
|
|
13
|
+
var assert = _interopDefault(require('assert'));
|
|
14
|
+
var events = _interopDefault(require('events'));
|
|
13
15
|
|
|
14
16
|
var index$1 = function (args, opts) {
|
|
15
17
|
if (!opts) { opts = {}; }
|
|
@@ -248,7 +250,7 @@ function isNumber (x) {
|
|
|
248
250
|
|
|
249
251
|
var help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-v, --version Show version number\n-h, --help Show this help message\n-c, --config Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-w, --watch Watch files in bundle and rebuild on changes\n-i, --input Input (alternative to <entry file>)\n-o, --output.file <output> Output (if absent, prints to stdout)\n-f, --output.format [es] Type of output (amd, cjs, es, iife, umd)\n-e, --external Comma-separate list of module IDs to exclude\n-g, --globals Comma-separate list of `module ID:Global` pairs\n Any module IDs defined here are added to external\n-n, --name Name for UMD export\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n--amd.id ID for AMD module (default is anonymous)\n--amd.define Function to use in place of `define`\n--no-strict Don't emit a `\"use strict\";` in the generated modules.\n--no-indent Don't indent result\n--environment <values> Settings passed to config file (see example)\n--no-conflict Generate a noConflict method for UMD globals\n--silent Don't print warnings\n--intro Content to insert at top of bundle (inside wrapper)\n--outro Content to insert at end of bundle (inside wrapper)\n--banner Content to insert at top of bundle (outside wrapper)\n--footer Content to insert at end of bundle (outside wrapper)\n--interop Include interop block (true by default)\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --output=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://github.com/rollup/rollup/wiki\n";
|
|
250
252
|
|
|
251
|
-
var version = "0.
|
|
253
|
+
var version = "0.49.3";
|
|
252
254
|
|
|
253
255
|
var modules = {};
|
|
254
256
|
|
|
@@ -2242,7 +2244,8 @@ function mergeOptions ( config, command ) {
|
|
|
2242
2244
|
context: config.context,
|
|
2243
2245
|
moduleContext: config.moduleContext,
|
|
2244
2246
|
plugins: config.plugins,
|
|
2245
|
-
onwarn: config.onwarn
|
|
2247
|
+
onwarn: config.onwarn,
|
|
2248
|
+
watch: config.watch
|
|
2246
2249
|
};
|
|
2247
2250
|
|
|
2248
2251
|
// legacy, to ensure e.g. commonjs plugin still works
|
|
@@ -2298,14 +2301,21 @@ function mergeOptions ( config, command ) {
|
|
|
2298
2301
|
paths: getOption('paths')
|
|
2299
2302
|
};
|
|
2300
2303
|
|
|
2301
|
-
|
|
2302
|
-
|
|
2304
|
+
let mergedOutputOptions;
|
|
2305
|
+
if (Array.isArray(config.output)) {
|
|
2306
|
+
mergedOutputOptions = config.output.map((output) => Object.assign({}, output, command.output));
|
|
2307
|
+
} else if (config.output && command.output) {
|
|
2308
|
+
mergedOutputOptions = [Object.assign({}, config.output, command.output)];
|
|
2309
|
+
} else {
|
|
2310
|
+
mergedOutputOptions = (command.output || config.output) ?
|
|
2303
2311
|
ensureArray(command.output || config.output) :
|
|
2304
2312
|
[{
|
|
2305
2313
|
file: command.output ? command.output.file : null,
|
|
2306
2314
|
format: command.output ? command.output.format : null
|
|
2307
|
-
}]
|
|
2308
|
-
|
|
2315
|
+
}];
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
const outputOptions = mergedOutputOptions.map(output => {
|
|
2309
2319
|
return Object.assign({}, baseOutputOptions, output);
|
|
2310
2320
|
});
|
|
2311
2321
|
|
|
@@ -3278,17 +3288,369 @@ function build$1 ( inputOptions, outputOptions, warnings, silent ) {
|
|
|
3278
3288
|
.catch( handleError );
|
|
3279
3289
|
}
|
|
3280
3290
|
|
|
3291
|
+
var signals$1 = createCommonjsModule(function (module) {
|
|
3292
|
+
// This is not the set of all possible signals.
|
|
3293
|
+
//
|
|
3294
|
+
// It IS, however, the set of all signals that trigger
|
|
3295
|
+
// an exit on either Linux or BSD systems. Linux is a
|
|
3296
|
+
// superset of the signal names supported on BSD, and
|
|
3297
|
+
// the unknown signals just fail to register, so we can
|
|
3298
|
+
// catch that easily enough.
|
|
3299
|
+
//
|
|
3300
|
+
// Don't bother with SIGKILL. It's uncatchable, which
|
|
3301
|
+
// means that we can't fire any callbacks anyway.
|
|
3302
|
+
//
|
|
3303
|
+
// If a user does happen to register a handler on a non-
|
|
3304
|
+
// fatal signal like SIGWINCH or something, and then
|
|
3305
|
+
// exit, it'll end up firing `process.emit('exit')`, so
|
|
3306
|
+
// the handler will be fired anyway.
|
|
3307
|
+
//
|
|
3308
|
+
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
3309
|
+
// artificially, inherently leave the process in a
|
|
3310
|
+
// state from which it is not safe to try and enter JS
|
|
3311
|
+
// listeners.
|
|
3312
|
+
module.exports = [
|
|
3313
|
+
'SIGABRT',
|
|
3314
|
+
'SIGALRM',
|
|
3315
|
+
'SIGHUP',
|
|
3316
|
+
'SIGINT',
|
|
3317
|
+
'SIGTERM'
|
|
3318
|
+
];
|
|
3319
|
+
|
|
3320
|
+
if (process.platform !== 'win32') {
|
|
3321
|
+
module.exports.push(
|
|
3322
|
+
'SIGVTALRM',
|
|
3323
|
+
'SIGXCPU',
|
|
3324
|
+
'SIGXFSZ',
|
|
3325
|
+
'SIGUSR2',
|
|
3326
|
+
'SIGTRAP',
|
|
3327
|
+
'SIGSYS',
|
|
3328
|
+
'SIGQUIT',
|
|
3329
|
+
'SIGIOT'
|
|
3330
|
+
// should detect profiler and enable/disable accordingly.
|
|
3331
|
+
// see #21
|
|
3332
|
+
// 'SIGPROF'
|
|
3333
|
+
);
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
if (process.platform === 'linux') {
|
|
3337
|
+
module.exports.push(
|
|
3338
|
+
'SIGIO',
|
|
3339
|
+
'SIGPOLL',
|
|
3340
|
+
'SIGPWR',
|
|
3341
|
+
'SIGSTKFLT',
|
|
3342
|
+
'SIGUNUSED'
|
|
3343
|
+
);
|
|
3344
|
+
}
|
|
3345
|
+
});
|
|
3346
|
+
|
|
3347
|
+
// Note: since nyc uses this module to output coverage, any lines
|
|
3348
|
+
// that are in the direct sync flow of nyc's outputCoverage are
|
|
3349
|
+
// ignored, since we can never get coverage for them.
|
|
3350
|
+
|
|
3351
|
+
var signals = signals$1;
|
|
3352
|
+
|
|
3353
|
+
var EE = events;
|
|
3354
|
+
/* istanbul ignore if */
|
|
3355
|
+
if (typeof EE !== 'function') {
|
|
3356
|
+
EE = EE.EventEmitter;
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
var emitter;
|
|
3360
|
+
if (process.__signal_exit_emitter__) {
|
|
3361
|
+
emitter = process.__signal_exit_emitter__;
|
|
3362
|
+
} else {
|
|
3363
|
+
emitter = process.__signal_exit_emitter__ = new EE();
|
|
3364
|
+
emitter.count = 0;
|
|
3365
|
+
emitter.emitted = {};
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
// Because this emitter is a global, we have to check to see if a
|
|
3369
|
+
// previous version of this library failed to enable infinite listeners.
|
|
3370
|
+
// I know what you're about to say. But literally everything about
|
|
3371
|
+
// signal-exit is a compromise with evil. Get used to it.
|
|
3372
|
+
if (!emitter.infinite) {
|
|
3373
|
+
emitter.setMaxListeners(Infinity);
|
|
3374
|
+
emitter.infinite = true;
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
var index$22 = function (cb, opts) {
|
|
3378
|
+
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
|
|
3379
|
+
|
|
3380
|
+
if (loaded === false) {
|
|
3381
|
+
load();
|
|
3382
|
+
}
|
|
3383
|
+
|
|
3384
|
+
var ev = 'exit';
|
|
3385
|
+
if (opts && opts.alwaysLast) {
|
|
3386
|
+
ev = 'afterexit';
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
var remove = function () {
|
|
3390
|
+
emitter.removeListener(ev, cb);
|
|
3391
|
+
if (emitter.listeners('exit').length === 0 &&
|
|
3392
|
+
emitter.listeners('afterexit').length === 0) {
|
|
3393
|
+
unload();
|
|
3394
|
+
}
|
|
3395
|
+
};
|
|
3396
|
+
emitter.on(ev, cb);
|
|
3397
|
+
|
|
3398
|
+
return remove
|
|
3399
|
+
};
|
|
3400
|
+
|
|
3401
|
+
var unload_1 = unload;
|
|
3402
|
+
function unload () {
|
|
3403
|
+
if (!loaded) {
|
|
3404
|
+
return
|
|
3405
|
+
}
|
|
3406
|
+
loaded = false;
|
|
3407
|
+
|
|
3408
|
+
signals.forEach(function (sig) {
|
|
3409
|
+
try {
|
|
3410
|
+
process.removeListener(sig, sigListeners[sig]);
|
|
3411
|
+
} catch (er) {}
|
|
3412
|
+
});
|
|
3413
|
+
process.emit = originalProcessEmit;
|
|
3414
|
+
process.reallyExit = originalProcessReallyExit;
|
|
3415
|
+
emitter.count -= 1;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
function emit (event, code, signal) {
|
|
3419
|
+
if (emitter.emitted[event]) {
|
|
3420
|
+
return
|
|
3421
|
+
}
|
|
3422
|
+
emitter.emitted[event] = true;
|
|
3423
|
+
emitter.emit(event, code, signal);
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
// { <signal>: <listener fn>, ... }
|
|
3427
|
+
var sigListeners = {};
|
|
3428
|
+
signals.forEach(function (sig) {
|
|
3429
|
+
sigListeners[sig] = function listener () {
|
|
3430
|
+
// If there are no other listeners, an exit is coming!
|
|
3431
|
+
// Simplest way: remove us and then re-send the signal.
|
|
3432
|
+
// We know that this will kill the process, so we can
|
|
3433
|
+
// safely emit now.
|
|
3434
|
+
var listeners = process.listeners(sig);
|
|
3435
|
+
if (listeners.length === emitter.count) {
|
|
3436
|
+
unload();
|
|
3437
|
+
emit('exit', null, sig);
|
|
3438
|
+
/* istanbul ignore next */
|
|
3439
|
+
emit('afterexit', null, sig);
|
|
3440
|
+
/* istanbul ignore next */
|
|
3441
|
+
process.kill(process.pid, sig);
|
|
3442
|
+
}
|
|
3443
|
+
};
|
|
3444
|
+
});
|
|
3445
|
+
|
|
3446
|
+
var signals_1 = function () {
|
|
3447
|
+
return signals
|
|
3448
|
+
};
|
|
3449
|
+
|
|
3450
|
+
var load_1 = load;
|
|
3451
|
+
|
|
3452
|
+
var loaded = false;
|
|
3453
|
+
|
|
3454
|
+
function load () {
|
|
3455
|
+
if (loaded) {
|
|
3456
|
+
return
|
|
3457
|
+
}
|
|
3458
|
+
loaded = true;
|
|
3459
|
+
|
|
3460
|
+
// This is the number of onSignalExit's that are in play.
|
|
3461
|
+
// It's important so that we can count the correct number of
|
|
3462
|
+
// listeners on signals, and don't wait for the other one to
|
|
3463
|
+
// handle it instead of us.
|
|
3464
|
+
emitter.count += 1;
|
|
3465
|
+
|
|
3466
|
+
signals = signals.filter(function (sig) {
|
|
3467
|
+
try {
|
|
3468
|
+
process.on(sig, sigListeners[sig]);
|
|
3469
|
+
return true
|
|
3470
|
+
} catch (er) {
|
|
3471
|
+
return false
|
|
3472
|
+
}
|
|
3473
|
+
});
|
|
3474
|
+
|
|
3475
|
+
process.emit = processEmit;
|
|
3476
|
+
process.reallyExit = processReallyExit;
|
|
3477
|
+
}
|
|
3478
|
+
|
|
3479
|
+
var originalProcessReallyExit = process.reallyExit;
|
|
3480
|
+
function processReallyExit (code) {
|
|
3481
|
+
process.exitCode = code || 0;
|
|
3482
|
+
emit('exit', process.exitCode, null);
|
|
3483
|
+
/* istanbul ignore next */
|
|
3484
|
+
emit('afterexit', process.exitCode, null);
|
|
3485
|
+
/* istanbul ignore next */
|
|
3486
|
+
originalProcessReallyExit.call(process, process.exitCode);
|
|
3487
|
+
}
|
|
3488
|
+
|
|
3489
|
+
var originalProcessEmit = process.emit;
|
|
3490
|
+
function processEmit (ev, arg) {
|
|
3491
|
+
if (ev === 'exit') {
|
|
3492
|
+
if (arg !== undefined) {
|
|
3493
|
+
process.exitCode = arg;
|
|
3494
|
+
}
|
|
3495
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
3496
|
+
emit('exit', process.exitCode, null);
|
|
3497
|
+
/* istanbul ignore next */
|
|
3498
|
+
emit('afterexit', process.exitCode, null);
|
|
3499
|
+
return ret
|
|
3500
|
+
} else {
|
|
3501
|
+
return originalProcessEmit.apply(this, arguments)
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
|
|
3505
|
+
index$22.unload = unload_1;
|
|
3506
|
+
index$22.signals = signals_1;
|
|
3507
|
+
index$22.load = load_1;
|
|
3508
|
+
|
|
3509
|
+
var index$23 = createCommonjsModule(function (module) {
|
|
3510
|
+
'use strict';
|
|
3511
|
+
const x = module.exports;
|
|
3512
|
+
const ESC = '\u001B[';
|
|
3513
|
+
const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
|
|
3514
|
+
|
|
3515
|
+
x.cursorTo = function (x, y) {
|
|
3516
|
+
if (arguments.length === 0) {
|
|
3517
|
+
return ESC + 'H';
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
if (arguments.length === 1) {
|
|
3521
|
+
return ESC + (x + 1) + 'G';
|
|
3522
|
+
}
|
|
3523
|
+
|
|
3524
|
+
return ESC + (y + 1) + ';' + (x + 1) + 'H';
|
|
3525
|
+
};
|
|
3526
|
+
|
|
3527
|
+
x.cursorMove = (x, y) => {
|
|
3528
|
+
let ret = '';
|
|
3529
|
+
|
|
3530
|
+
if (x < 0) {
|
|
3531
|
+
ret += ESC + (-x) + 'D';
|
|
3532
|
+
} else if (x > 0) {
|
|
3533
|
+
ret += ESC + x + 'C';
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
if (y < 0) {
|
|
3537
|
+
ret += ESC + (-y) + 'A';
|
|
3538
|
+
} else if (y > 0) {
|
|
3539
|
+
ret += ESC + y + 'B';
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
return ret;
|
|
3543
|
+
};
|
|
3544
|
+
|
|
3545
|
+
x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A';
|
|
3546
|
+
x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B';
|
|
3547
|
+
x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C';
|
|
3548
|
+
x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D';
|
|
3549
|
+
|
|
3550
|
+
x.cursorLeft = ESC + 'G';
|
|
3551
|
+
x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's');
|
|
3552
|
+
x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u');
|
|
3553
|
+
x.cursorGetPosition = ESC + '6n';
|
|
3554
|
+
x.cursorNextLine = ESC + 'E';
|
|
3555
|
+
x.cursorPrevLine = ESC + 'F';
|
|
3556
|
+
x.cursorHide = ESC + '?25l';
|
|
3557
|
+
x.cursorShow = ESC + '?25h';
|
|
3558
|
+
|
|
3559
|
+
x.eraseLines = count => {
|
|
3560
|
+
let clear = '';
|
|
3561
|
+
|
|
3562
|
+
for (let i = 0; i < count; i++) {
|
|
3563
|
+
clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : '');
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
if (count) {
|
|
3567
|
+
clear += x.cursorLeft;
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3570
|
+
return clear;
|
|
3571
|
+
};
|
|
3572
|
+
|
|
3573
|
+
x.eraseEndLine = ESC + 'K';
|
|
3574
|
+
x.eraseStartLine = ESC + '1K';
|
|
3575
|
+
x.eraseLine = ESC + '2K';
|
|
3576
|
+
x.eraseDown = ESC + 'J';
|
|
3577
|
+
x.eraseUp = ESC + '1J';
|
|
3578
|
+
x.eraseScreen = ESC + '2J';
|
|
3579
|
+
x.scrollUp = ESC + 'S';
|
|
3580
|
+
x.scrollDown = ESC + 'T';
|
|
3581
|
+
|
|
3582
|
+
x.clearScreen = '\u001Bc';
|
|
3583
|
+
x.beep = '\u0007';
|
|
3584
|
+
|
|
3585
|
+
x.image = (buf, opts) => {
|
|
3586
|
+
opts = opts || {};
|
|
3587
|
+
|
|
3588
|
+
let ret = '\u001B]1337;File=inline=1';
|
|
3589
|
+
|
|
3590
|
+
if (opts.width) {
|
|
3591
|
+
ret += `;width=${opts.width}`;
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3594
|
+
if (opts.height) {
|
|
3595
|
+
ret += `;height=${opts.height}`;
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3598
|
+
if (opts.preserveAspectRatio === false) {
|
|
3599
|
+
ret += ';preserveAspectRatio=0';
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
return ret + ':' + buf.toString('base64') + '\u0007';
|
|
3603
|
+
};
|
|
3604
|
+
|
|
3605
|
+
x.iTerm = {};
|
|
3606
|
+
|
|
3607
|
+
x.iTerm.setCwd = cwd => '\u001B]50;CurrentDir=' + (cwd || process.cwd()) + '\u0007';
|
|
3608
|
+
});
|
|
3609
|
+
|
|
3610
|
+
const SHOW_ALTERNATE_SCREEN = '\u001B[?1049h';
|
|
3611
|
+
const HIDE_ALTERNATE_SCREEN = '\u001B[?1049l';
|
|
3612
|
+
|
|
3613
|
+
function alternateScreen ( enabled ) {
|
|
3614
|
+
if (!enabled) {
|
|
3615
|
+
let needAnnounce = true;
|
|
3616
|
+
return {
|
|
3617
|
+
open() {},
|
|
3618
|
+
close() {},
|
|
3619
|
+
reset( heading ) {
|
|
3620
|
+
if ( needAnnounce ) {
|
|
3621
|
+
stderr( heading );
|
|
3622
|
+
needAnnounce = false;
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
};
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
return {
|
|
3629
|
+
open() {
|
|
3630
|
+
process.stderr.write(SHOW_ALTERNATE_SCREEN);
|
|
3631
|
+
},
|
|
3632
|
+
close() {
|
|
3633
|
+
process.stderr.write(HIDE_ALTERNATE_SCREEN);
|
|
3634
|
+
},
|
|
3635
|
+
reset( heading ) {
|
|
3636
|
+
stderr( `${index$23.eraseScreen}${index$23.cursorTo(0, 0)}${heading}` );
|
|
3637
|
+
}
|
|
3638
|
+
};
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3281
3641
|
function watch$1(configFile, configs, command, silent) {
|
|
3282
|
-
process.stderr.
|
|
3642
|
+
const isTTY = Boolean(process.stderr.isTTY);
|
|
3643
|
+
|
|
3644
|
+
const screen = alternateScreen(isTTY);
|
|
3645
|
+
screen.open();
|
|
3283
3646
|
|
|
3284
3647
|
const warnings = batchWarnings();
|
|
3285
3648
|
|
|
3286
3649
|
let watcher;
|
|
3287
3650
|
let configWatcher;
|
|
3288
|
-
let closed = false;
|
|
3289
3651
|
|
|
3290
3652
|
function start(configs) {
|
|
3291
|
-
|
|
3653
|
+
screen.reset( index$3.underline( `rollup v${rollup.VERSION}` ) );
|
|
3292
3654
|
|
|
3293
3655
|
configs = configs.map(options => {
|
|
3294
3656
|
const merged = mergeOptions(options, command);
|
|
@@ -3318,7 +3680,7 @@ function watch$1(configFile, configs, command, silent) {
|
|
|
3318
3680
|
watcher.on('event', event => {
|
|
3319
3681
|
switch (event.code) {
|
|
3320
3682
|
case 'FATAL':
|
|
3321
|
-
|
|
3683
|
+
screen.close();
|
|
3322
3684
|
handleError(event.error, true);
|
|
3323
3685
|
process.exit(1);
|
|
3324
3686
|
break;
|
|
@@ -3329,11 +3691,11 @@ function watch$1(configFile, configs, command, silent) {
|
|
|
3329
3691
|
break;
|
|
3330
3692
|
|
|
3331
3693
|
case 'START':
|
|
3332
|
-
|
|
3694
|
+
screen.reset( index$3.underline( `rollup v${rollup.VERSION}` ) );
|
|
3333
3695
|
break;
|
|
3334
3696
|
|
|
3335
3697
|
case 'BUNDLE_START':
|
|
3336
|
-
if ( !silent ) { stderr( index$3.cyan(
|
|
3698
|
+
if ( !silent ) { stderr( index$3.cyan( `bundles ${index$3.bold( event.input )} → ${index$3.bold( event.output.map( relativeId ).join( ', ' ) )}...` ) ); }
|
|
3337
3699
|
break;
|
|
3338
3700
|
|
|
3339
3701
|
case 'BUNDLE_END':
|
|
@@ -3342,24 +3704,31 @@ function watch$1(configFile, configs, command, silent) {
|
|
|
3342
3704
|
break;
|
|
3343
3705
|
|
|
3344
3706
|
case 'END':
|
|
3345
|
-
if ( !silent ) { stderr( `\nwaiting for changes...` ); }
|
|
3707
|
+
if ( !silent && isTTY ) { stderr( `\nwaiting for changes...` ); }
|
|
3346
3708
|
}
|
|
3347
3709
|
});
|
|
3348
3710
|
}
|
|
3349
3711
|
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
closed = true;
|
|
3354
|
-
watcher.close();
|
|
3712
|
+
// catch ctrl+c, kill, and uncaught errors
|
|
3713
|
+
const removeOnExit = index$22(close);
|
|
3714
|
+
process.on('uncaughtException', close);
|
|
3355
3715
|
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3716
|
+
// only listen to stdin if it is a pipe
|
|
3717
|
+
if (!process.stdin.isTTY) {
|
|
3718
|
+
process.stdin.on('end', close); // in case we ever support stdin!
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
function close() {
|
|
3722
|
+
removeOnExit();
|
|
3723
|
+
process.removeListener('uncaughtException', close);
|
|
3724
|
+
// removing a non-existent listener is a no-op
|
|
3725
|
+
process.stdin.removeListener('end', close);
|
|
3726
|
+
|
|
3727
|
+
screen.close();
|
|
3728
|
+
watcher.close();
|
|
3729
|
+
|
|
3730
|
+
if (configWatcher) { configWatcher.close(); }
|
|
3731
|
+
}
|
|
3363
3732
|
|
|
3364
3733
|
start(configs);
|
|
3365
3734
|
|