rollup 2.71.1 → 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.
package/dist/rollup.d.ts CHANGED
@@ -864,6 +864,8 @@ export interface ChokidarOptions {
864
864
  usePolling?: boolean;
865
865
  }
866
866
 
867
+ export type RollupWatchHooks = 'onError' | 'onStart' | 'onBundleStart' | 'onBundleEnd' | 'onEnd';
868
+
867
869
  export interface WatcherOptions {
868
870
  buildDelay?: number;
869
871
  chokidar?: ChokidarOptions;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.71.1
4
- Sat, 30 Apr 2022 13:35:44 GMT - commit f44a3a38b357c2ba80a99aca36cfd30dcfb84476
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.71.1
4
- Sat, 30 Apr 2022 13:35:44 GMT - commit f44a3a38b357c2ba80a99aca36cfd30dcfb84476
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.71.1
4
- Sat, 30 Apr 2022 13:35:44 GMT - commit f44a3a38b357c2ba80a99aca36cfd30dcfb84476
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.71.1
4
- Sat, 30 Apr 2022 13:35:44 GMT - commit f44a3a38b357c2ba80a99aca36cfd30dcfb84476
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.71.1
4
- Sat, 30 Apr 2022 13:35:44 GMT - commit f44a3a38b357c2ba80a99aca36cfd30dcfb84476
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
 
@@ -27,7 +27,7 @@ function _interopNamespaceDefault(e) {
27
27
  return n;
28
28
  }
29
29
 
30
- var version$1 = "2.71.1";
30
+ var version$1 = "2.72.0";
31
31
 
32
32
  function ensureArray$1(items) {
33
33
  if (Array.isArray(items)) {
@@ -6312,7 +6312,7 @@ class LocalVariable extends Variable {
6312
6312
  if (this.isReassigned)
6313
6313
  return true;
6314
6314
  return (this.init &&
6315
- !context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
6315
+ !context.assigned.trackEntityAtPathAndGetIfTracked(path, this) &&
6316
6316
  this.init.hasEffectsWhenAssignedAtPath(path, context));
6317
6317
  }
6318
6318
  hasEffectsWhenCalledAtPath(path, callOptions, context) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.71.1
4
- Sat, 30 Apr 2022 13:35:44 GMT - commit f44a3a38b357c2ba80a99aca36cfd30dcfb84476
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
 
@@ -19,6 +19,7 @@ const rollup = require('./rollup.js');
19
19
  const require$$0 = require('assert');
20
20
  const require$$0$1 = require('events');
21
21
  const loadConfigFile = require('./loadConfigFile.js');
22
+ const child_process = require('child_process');
22
23
  require('util');
23
24
  require('stream');
24
25
  require('path');
@@ -357,6 +358,33 @@ function getResetScreen(configs, allowClearScreen) {
357
358
  };
358
359
  }
359
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
+
360
388
  async function watch(command) {
361
389
  process$2.env.ROLLUP_WATCH = 'true';
362
390
  const isTTY = process$2.stderr.isTTY;
@@ -365,6 +393,7 @@ async function watch(command) {
365
393
  let configWatcher;
366
394
  let resetScreen;
367
395
  const configFile = command.config ? await cli.getConfigPath(command.config) : null;
396
+ const runWatchHook = createWatchHooks(command);
368
397
  signalExit.exports(close);
369
398
  process$2.on('uncaughtException', close);
370
399
  if (!process$2.stdin.isTTY) {
@@ -421,6 +450,7 @@ async function watch(command) {
421
450
  case 'ERROR':
422
451
  warnings.flush();
423
452
  loadConfigFile.handleError(event.error, true);
453
+ runWatchHook('onError');
424
454
  break;
425
455
  case 'START':
426
456
  if (!silent) {
@@ -429,6 +459,7 @@ async function watch(command) {
429
459
  }
430
460
  resetScreen(loadConfigFile.underline(`rollup v${rollup.version}`));
431
461
  }
462
+ runWatchHook('onStart');
432
463
  break;
433
464
  case 'BUNDLE_START':
434
465
  if (!silent) {
@@ -440,16 +471,19 @@ async function watch(command) {
440
471
  }
441
472
  loadConfigFile.stderr(loadConfigFile.cyan(`bundles ${loadConfigFile.bold(input)} → ${loadConfigFile.bold(event.output.map(rollup.relativeId).join(', '))}...`));
442
473
  }
474
+ runWatchHook('onBundleStart');
443
475
  break;
444
476
  case 'BUNDLE_END':
445
477
  warnings.flush();
446
478
  if (!silent)
447
479
  loadConfigFile.stderr(loadConfigFile.green(`created ${loadConfigFile.bold(event.output.map(rollup.relativeId).join(', '))} in ${loadConfigFile.bold(cli.ms(event.duration))}`));
480
+ runWatchHook('onBundleEnd');
448
481
  if (event.result && event.result.getTimings) {
449
482
  cli.printTimings(event.result.getTimings());
450
483
  }
451
484
  break;
452
485
  case 'END':
486
+ runWatchHook('onEnd');
453
487
  if (!silent && isTTY) {
454
488
  loadConfigFile.stderr(`\n[${dateTime()}] waiting for changes...`);
455
489
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.71.1
4
- Sat, 30 Apr 2022 13:35:44 GMT - commit f44a3a38b357c2ba80a99aca36cfd30dcfb84476
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.71.1",
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",