rollup 2.70.2 → 2.72.0

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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.70.2
4
- Fri, 15 Apr 2022 05:14:21 GMT - commit 030c56fd6b186a0ddfd57d143ad703f34fd2c17a
3
+ Rollup.js v2.72.0
4
+ Thu, 05 May 2022 04:32:50 GMT - commit 19aef1315cf45b04c74c37a290cbef8072ddfa6b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -18,10 +18,11 @@ const cli = require('../bin/rollup');
18
18
  const rollup = require('./rollup.js');
19
19
  const require$$0 = require('assert');
20
20
  const require$$0$1 = require('events');
21
- const loadConfigFile_js = require('./loadConfigFile.js');
22
- require('path');
21
+ const loadConfigFile = require('./loadConfigFile.js');
22
+ const child_process = require('child_process');
23
23
  require('util');
24
24
  require('stream');
25
+ require('path');
25
26
  require('os');
26
27
  require('./mergeOptions.js');
27
28
  require('perf_hooks');
@@ -71,61 +72,68 @@ var signalExit = {exports: {}};
71
72
 
72
73
  var signals$1 = {exports: {}};
73
74
 
74
- (function (module) {
75
- // This is not the set of all possible signals.
76
- //
77
- // It IS, however, the set of all signals that trigger
78
- // an exit on either Linux or BSD systems. Linux is a
79
- // superset of the signal names supported on BSD, and
80
- // the unknown signals just fail to register, so we can
81
- // catch that easily enough.
82
- //
83
- // Don't bother with SIGKILL. It's uncatchable, which
84
- // means that we can't fire any callbacks anyway.
85
- //
86
- // If a user does happen to register a handler on a non-
87
- // fatal signal like SIGWINCH or something, and then
88
- // exit, it'll end up firing `process.emit('exit')`, so
89
- // the handler will be fired anyway.
90
- //
91
- // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
92
- // artificially, inherently leave the process in a
93
- // state from which it is not safe to try and enter JS
94
- // listeners.
95
- module.exports = [
96
- 'SIGABRT',
97
- 'SIGALRM',
98
- 'SIGHUP',
99
- 'SIGINT',
100
- 'SIGTERM'
101
- ];
102
-
103
- if (process.platform !== 'win32') {
104
- module.exports.push(
105
- 'SIGVTALRM',
106
- 'SIGXCPU',
107
- 'SIGXFSZ',
108
- 'SIGUSR2',
109
- 'SIGTRAP',
110
- 'SIGSYS',
111
- 'SIGQUIT',
112
- 'SIGIOT'
113
- // should detect profiler and enable/disable accordingly.
114
- // see #21
115
- // 'SIGPROF'
116
- );
117
- }
118
-
119
- if (process.platform === 'linux') {
120
- module.exports.push(
121
- 'SIGIO',
122
- 'SIGPOLL',
123
- 'SIGPWR',
124
- 'SIGSTKFLT',
125
- 'SIGUNUSED'
126
- );
75
+ var hasRequiredSignals;
76
+
77
+ function requireSignals () {
78
+ if (hasRequiredSignals) return signals$1.exports;
79
+ hasRequiredSignals = 1;
80
+ (function (module) {
81
+ // This is not the set of all possible signals.
82
+ //
83
+ // It IS, however, the set of all signals that trigger
84
+ // an exit on either Linux or BSD systems. Linux is a
85
+ // superset of the signal names supported on BSD, and
86
+ // the unknown signals just fail to register, so we can
87
+ // catch that easily enough.
88
+ //
89
+ // Don't bother with SIGKILL. It's uncatchable, which
90
+ // means that we can't fire any callbacks anyway.
91
+ //
92
+ // If a user does happen to register a handler on a non-
93
+ // fatal signal like SIGWINCH or something, and then
94
+ // exit, it'll end up firing `process.emit('exit')`, so
95
+ // the handler will be fired anyway.
96
+ //
97
+ // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
98
+ // artificially, inherently leave the process in a
99
+ // state from which it is not safe to try and enter JS
100
+ // listeners.
101
+ module.exports = [
102
+ 'SIGABRT',
103
+ 'SIGALRM',
104
+ 'SIGHUP',
105
+ 'SIGINT',
106
+ 'SIGTERM'
107
+ ];
108
+
109
+ if (process.platform !== 'win32') {
110
+ module.exports.push(
111
+ 'SIGVTALRM',
112
+ 'SIGXCPU',
113
+ 'SIGXFSZ',
114
+ 'SIGUSR2',
115
+ 'SIGTRAP',
116
+ 'SIGSYS',
117
+ 'SIGQUIT',
118
+ 'SIGIOT'
119
+ // should detect profiler and enable/disable accordingly.
120
+ // see #21
121
+ // 'SIGPROF'
122
+ );
123
+ }
124
+
125
+ if (process.platform === 'linux') {
126
+ module.exports.push(
127
+ 'SIGIO',
128
+ 'SIGPOLL',
129
+ 'SIGPWR',
130
+ 'SIGSTKFLT',
131
+ 'SIGUNUSED'
132
+ );
133
+ }
134
+ } (signals$1));
135
+ return signals$1.exports;
127
136
  }
128
- }(signals$1));
129
137
 
130
138
  // Note: since nyc uses this module to output coverage, any lines
131
139
  // that are in the direct sync flow of nyc's outputCoverage are
@@ -153,7 +161,7 @@ if (!processOk(process$1)) {
153
161
  };
154
162
  } else {
155
163
  var assert = require$$0;
156
- var signals = signals$1.exports;
164
+ var signals = requireSignals();
157
165
  var isWin = /^win/i.test(process$1.platform);
158
166
 
159
167
  var EE = require$$0$1;
@@ -330,8 +338,6 @@ if (!processOk(process$1)) {
330
338
  };
331
339
  }
332
340
 
333
- const onExit = signalExit.exports;
334
-
335
341
  const CLEAR_SCREEN = '\u001Bc';
336
342
  function getResetScreen(configs, allowClearScreen) {
337
343
  let clearScreen = allowClearScreen;
@@ -341,17 +347,44 @@ function getResetScreen(configs, allowClearScreen) {
341
347
  }
342
348
  }
343
349
  if (clearScreen) {
344
- return (heading) => loadConfigFile_js.stderr(CLEAR_SCREEN + heading);
350
+ return (heading) => loadConfigFile.stderr(CLEAR_SCREEN + heading);
345
351
  }
346
352
  let firstRun = true;
347
353
  return (heading) => {
348
354
  if (firstRun) {
349
- loadConfigFile_js.stderr(heading);
355
+ loadConfigFile.stderr(heading);
350
356
  firstRun = false;
351
357
  }
352
358
  };
353
359
  }
354
360
 
361
+ function extractWatchHooks(command) {
362
+ if (!Array.isArray(command.watch))
363
+ return {};
364
+ return command.watch
365
+ .filter(value => typeof value === 'object')
366
+ .reduce((acc, keyValueOption) => ({ ...acc, ...keyValueOption }), {});
367
+ }
368
+ function createWatchHooks(command) {
369
+ const watchHooks = extractWatchHooks(command);
370
+ return function (hook) {
371
+ if (watchHooks[hook]) {
372
+ const cmd = watchHooks[hook];
373
+ if (!command.silent) {
374
+ loadConfigFile.stderr(loadConfigFile.cyan(`watch.${hook} ${loadConfigFile.bold(`$ ${cmd}`)}`));
375
+ }
376
+ try {
377
+ // !! important - use stderr for all writes from execSync
378
+ const stdio = [process.stdin, process.stderr, process.stderr];
379
+ child_process.execSync(cmd, { stdio: command.silent ? 'ignore' : stdio });
380
+ }
381
+ catch (e) {
382
+ loadConfigFile.stderr(e.message);
383
+ }
384
+ }
385
+ };
386
+ }
387
+
355
388
  async function watch(command) {
356
389
  process$2.env.ROLLUP_WATCH = 'true';
357
390
  const isTTY = process$2.stderr.isTTY;
@@ -360,7 +393,8 @@ async function watch(command) {
360
393
  let configWatcher;
361
394
  let resetScreen;
362
395
  const configFile = command.config ? await cli.getConfigPath(command.config) : null;
363
- onExit(close);
396
+ const runWatchHook = createWatchHooks(command);
397
+ signalExit.exports(close);
364
398
  process$2.on('uncaughtException', close);
365
399
  if (!process$2.stdin.isTTY) {
366
400
  process$2.stdin.on('end', close);
@@ -380,10 +414,10 @@ async function watch(command) {
380
414
  configFileRevision++;
381
415
  const currentConfigFileRevision = configFileRevision;
382
416
  if (configFileData) {
383
- loadConfigFile_js.stderr(`\nReloading updated config...`);
417
+ loadConfigFile.stderr(`\nReloading updated config...`);
384
418
  }
385
419
  configFileData = newConfigFileData;
386
- const { options, warnings } = await loadConfigFile_js.loadAndParseConfigFile(configFile, command);
420
+ const { options, warnings } = await loadConfigFile.loadAndParseConfigFile(configFile, command);
387
421
  if (currentConfigFileRevision !== configFileRevision) {
388
422
  return;
389
423
  }
@@ -393,7 +427,7 @@ async function watch(command) {
393
427
  start(options, warnings);
394
428
  }
395
429
  catch (err) {
396
- loadConfigFile_js.handleError(err, true);
430
+ loadConfigFile.handleError(err, true);
397
431
  }
398
432
  }
399
433
  }
@@ -409,21 +443,23 @@ async function watch(command) {
409
443
  watcher = rollup.watch(configs);
410
444
  }
411
445
  catch (err) {
412
- return loadConfigFile_js.handleError(err);
446
+ return loadConfigFile.handleError(err);
413
447
  }
414
448
  watcher.on('event', event => {
415
449
  switch (event.code) {
416
450
  case 'ERROR':
417
451
  warnings.flush();
418
- loadConfigFile_js.handleError(event.error, true);
452
+ loadConfigFile.handleError(event.error, true);
453
+ runWatchHook('onError');
419
454
  break;
420
455
  case 'START':
421
456
  if (!silent) {
422
457
  if (!resetScreen) {
423
458
  resetScreen = getResetScreen(configs, isTTY);
424
459
  }
425
- resetScreen(loadConfigFile_js.underline(`rollup v${rollup.version}`));
460
+ resetScreen(loadConfigFile.underline(`rollup v${rollup.version}`));
426
461
  }
462
+ runWatchHook('onStart');
427
463
  break;
428
464
  case 'BUNDLE_START':
429
465
  if (!silent) {
@@ -433,24 +469,27 @@ async function watch(command) {
433
469
  ? input.join(', ')
434
470
  : Object.values(input).join(', ');
435
471
  }
436
- loadConfigFile_js.stderr(loadConfigFile_js.cyan(`bundles ${loadConfigFile_js.bold(input)} → ${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))}...`));
472
+ loadConfigFile.stderr(loadConfigFile.cyan(`bundles ${loadConfigFile.bold(input)} → ${loadConfigFile.bold(event.output.map(rollup.relativeId).join(', '))}...`));
437
473
  }
474
+ runWatchHook('onBundleStart');
438
475
  break;
439
476
  case 'BUNDLE_END':
440
477
  warnings.flush();
441
478
  if (!silent)
442
- loadConfigFile_js.stderr(loadConfigFile_js.green(`created ${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))} in ${loadConfigFile_js.bold(cli.ms(event.duration))}`));
479
+ loadConfigFile.stderr(loadConfigFile.green(`created ${loadConfigFile.bold(event.output.map(rollup.relativeId).join(', '))} in ${loadConfigFile.bold(cli.ms(event.duration))}`));
480
+ runWatchHook('onBundleEnd');
443
481
  if (event.result && event.result.getTimings) {
444
482
  cli.printTimings(event.result.getTimings());
445
483
  }
446
484
  break;
447
485
  case 'END':
486
+ runWatchHook('onEnd');
448
487
  if (!silent && isTTY) {
449
- loadConfigFile_js.stderr(`\n[${dateTime()}] waiting for changes...`);
488
+ loadConfigFile.stderr(`\n[${dateTime()}] waiting for changes...`);
450
489
  }
451
490
  }
452
491
  if ('result' in event && event.result) {
453
- event.result.close().catch(error => loadConfigFile_js.handleError(error, true));
492
+ event.result.close().catch(error => loadConfigFile.handleError(error, true));
454
493
  }
455
494
  });
456
495
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.70.2
4
- Fri, 15 Apr 2022 05:14:21 GMT - commit 030c56fd6b186a0ddfd57d143ad703f34fd2c17a
3
+ Rollup.js v2.72.0
4
+ Thu, 05 May 2022 04:32:50 GMT - commit 19aef1315cf45b04c74c37a290cbef8072ddfa6b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.70.2",
3
+ "version": "2.72.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -59,9 +59,9 @@
59
59
  "devDependencies": {
60
60
  "@rollup/plugin-alias": "^3.1.9",
61
61
  "@rollup/plugin-buble": "^0.21.3",
62
- "@rollup/plugin-commonjs": "^21.0.3",
62
+ "@rollup/plugin-commonjs": "^22.0.0",
63
63
  "@rollup/plugin-json": "^4.1.0",
64
- "@rollup/plugin-node-resolve": "^13.2.0",
64
+ "@rollup/plugin-node-resolve": "^13.2.1",
65
65
  "@rollup/plugin-replace": "^4.0.0",
66
66
  "@rollup/plugin-typescript": "^8.3.2",
67
67
  "@rollup/pluginutils": "^4.2.1",
@@ -69,25 +69,25 @@
69
69
  "@types/node": "^10.17.60",
70
70
  "@types/signal-exit": "^3.0.1",
71
71
  "@types/yargs-parser": "^20.2.2",
72
- "@typescript-eslint/eslint-plugin": "^5.19.0",
73
- "@typescript-eslint/parser": "^5.19.0",
74
- "acorn": "^8.7.0",
72
+ "@typescript-eslint/eslint-plugin": "^5.21.0",
73
+ "@typescript-eslint/parser": "^5.21.0",
74
+ "acorn": "^8.7.1",
75
75
  "acorn-jsx": "^5.3.2",
76
76
  "acorn-walk": "^8.2.0",
77
77
  "buble": "^0.20.0",
78
78
  "chokidar": "^3.5.3",
79
79
  "colorette": "^2.0.16",
80
- "core-js": "^3.22.0",
80
+ "core-js": "^3.22.3",
81
81
  "date-time": "^4.0.0",
82
- "es5-shim": "^4.6.5",
82
+ "es5-shim": "^4.6.6",
83
83
  "es6-shim": "^0.35.6",
84
- "eslint": "^8.13.0",
84
+ "eslint": "^8.14.0",
85
85
  "eslint-config-prettier": "^8.5.0",
86
86
  "eslint-plugin-import": "^2.26.0",
87
87
  "eslint-plugin-prettier": "^4.0.0",
88
88
  "execa": "^5.1.1",
89
89
  "fixturify": "^2.1.1",
90
- "fs-extra": "^10.0.1",
90
+ "fs-extra": "^10.1.0",
91
91
  "hash.js": "^1.1.7",
92
92
  "husky": "^7.0.4",
93
93
  "is-reference": "^3.0.0",
@@ -100,7 +100,7 @@
100
100
  "pretty-bytes": "^5.6.0",
101
101
  "pretty-ms": "^7.0.1",
102
102
  "requirejs": "^2.3.6",
103
- "rollup": "^2.70.1",
103
+ "rollup": "^2.70.2",
104
104
  "rollup-plugin-license": "^2.7.0",
105
105
  "rollup-plugin-string": "^3.0.0",
106
106
  "rollup-plugin-terser": "^7.0.2",
@@ -111,9 +111,9 @@
111
111
  "source-map-support": "^0.5.21",
112
112
  "sourcemap-codec": "^1.4.8",
113
113
  "systemjs": "^6.12.1",
114
- "terser": "^5.12.1",
115
- "tslib": "^2.3.1",
116
- "typescript": "^4.6.3",
114
+ "terser": "^5.13.0",
115
+ "tslib": "^2.4.0",
116
+ "typescript": "^4.6.4",
117
117
  "weak-napi": "^2.0.2",
118
118
  "yargs-parser": "^20.2.9"
119
119
  },
@@ -136,6 +136,8 @@
136
136
  },
137
137
  "default": "./dist/es/rollup.browser.js"
138
138
  },
139
+ "./loadConfigFile": "./dist/loadConfigFile.js",
140
+ "./dist/loadConfigFile": "./dist/loadConfigFile.js",
139
141
  "./dist/*": "./dist/*"
140
142
  }
141
143
  }