rollup 2.8.0 → 2.9.1

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.8.0
4
- Wed, 06 May 2020 05:15:09 GMT - commit 35b0f782f0de661628e48240cbaed4f0178472f3
3
+ Rollup.js v2.9.1
4
+ Mon, 11 May 2020 05:23:48 GMT - commit 1436473192ef975ee515ede6ab90dbf832cdfab1
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -6986,15 +6986,19 @@ class FileWatcher {
6986
6986
  }
6987
6987
  }
6988
6988
 
6989
- const DELAY = 200;
6990
6989
  class Watcher {
6991
6990
  constructor(configs, emitter) {
6991
+ this.buildDelay = 0;
6992
6992
  this.buildTimeout = null;
6993
6993
  this.invalidatedIds = new Set();
6994
6994
  this.rerun = false;
6995
6995
  this.emitter = emitter;
6996
6996
  emitter.close = this.close.bind(this);
6997
- this.tasks = ensureArray$1(configs).map((config) => new Task(this, config));
6997
+ const configArray = ensureArray$1(configs);
6998
+ this.tasks = configArray.map(config => new Task(this, config));
6999
+ this.buildDelay = configArray.reduce((buildDelay, { watch }) => watch && typeof watch.buildDelay === 'number'
7000
+ ? Math.max(buildDelay, watch.buildDelay)
7001
+ : buildDelay, this.buildDelay);
6998
7002
  this.running = true;
6999
7003
  process.nextTick(() => this.run());
7000
7004
  }
@@ -7027,12 +7031,12 @@ class Watcher {
7027
7031
  this.invalidatedIds.clear();
7028
7032
  this.emit('restart');
7029
7033
  this.run();
7030
- }, DELAY);
7034
+ }, this.buildDelay);
7031
7035
  }
7032
7036
  async run() {
7033
7037
  this.running = true;
7034
7038
  this.emit('event', {
7035
- code: 'START',
7039
+ code: 'START'
7036
7040
  });
7037
7041
  try {
7038
7042
  for (const task of this.tasks) {
@@ -7040,14 +7044,14 @@ class Watcher {
7040
7044
  }
7041
7045
  this.running = false;
7042
7046
  this.emit('event', {
7043
- code: 'END',
7047
+ code: 'END'
7044
7048
  });
7045
7049
  }
7046
7050
  catch (error) {
7047
7051
  this.running = false;
7048
7052
  this.emit('event', {
7049
7053
  code: 'ERROR',
7050
- error,
7054
+ error
7051
7055
  });
7052
7056
  }
7053
7057
  if (this.rerun) {
@@ -7067,7 +7071,7 @@ class Task {
7067
7071
  this.skipWrite = config.watch && !!config.watch.skipWrite;
7068
7072
  this.options = mergeOptions(config);
7069
7073
  this.outputs = this.options.output;
7070
- this.outputFiles = this.outputs.map((output) => {
7074
+ this.outputFiles = this.outputs.map(output => {
7071
7075
  if (output.file || output.dir)
7072
7076
  return resolve(output.file || output.dir);
7073
7077
  return undefined;
@@ -7077,7 +7081,7 @@ class Task {
7077
7081
  this.fileWatcher = new FileWatcher(this, {
7078
7082
  ...watchOptions.chokidar,
7079
7083
  disableGlobbing: true,
7080
- ignoreInitial: true,
7084
+ ignoreInitial: true
7081
7085
  });
7082
7086
  }
7083
7087
  close() {
@@ -7102,13 +7106,13 @@ class Task {
7102
7106
  this.invalidated = false;
7103
7107
  const options = {
7104
7108
  ...this.options,
7105
- cache: this.cache,
7109
+ cache: this.cache
7106
7110
  };
7107
7111
  const start = Date.now();
7108
7112
  this.watcher.emit('event', {
7109
7113
  code: 'BUNDLE_START',
7110
7114
  input: this.options.input,
7111
- output: this.outputFiles,
7115
+ output: this.outputFiles
7112
7116
  });
7113
7117
  try {
7114
7118
  const result = await rollupInternal(options, this.watcher.emitter);
@@ -7116,13 +7120,13 @@ class Task {
7116
7120
  return;
7117
7121
  }
7118
7122
  this.updateWatchedFiles(result);
7119
- this.skipWrite || (await Promise.all(this.outputs.map((output) => result.write(output))));
7123
+ this.skipWrite || (await Promise.all(this.outputs.map(output => result.write(output))));
7120
7124
  this.watcher.emit('event', {
7121
7125
  code: 'BUNDLE_END',
7122
7126
  duration: Date.now() - start,
7123
7127
  input: this.options.input,
7124
7128
  output: this.outputFiles,
7125
- result,
7129
+ result
7126
7130
  });
7127
7131
  }
7128
7132
  catch (error) {
@@ -7135,7 +7139,7 @@ class Task {
7135
7139
  }
7136
7140
  }
7137
7141
  if (error.id) {
7138
- this.cache.modules = this.cache.modules.filter((module) => module.id !== error.id);
7142
+ this.cache.modules = this.cache.modules.filter(module => module.id !== error.id);
7139
7143
  }
7140
7144
  throw error;
7141
7145
  }
@@ -7163,7 +7167,7 @@ class Task {
7163
7167
  if (!this.filter(id))
7164
7168
  return;
7165
7169
  this.watched.add(id);
7166
- if (this.outputFiles.some((file) => file === id)) {
7170
+ if (this.outputFiles.some(file => file === id)) {
7167
7171
  throw new Error('Cannot import the generated bundle');
7168
7172
  }
7169
7173
  // this is necessary to ensure that any 'renamed' files
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.8.0
4
- Wed, 06 May 2020 05:15:09 GMT - commit 35b0f782f0de661628e48240cbaed4f0178472f3
3
+ Rollup.js v2.9.1
4
+ Mon, 11 May 2020 05:23:48 GMT - commit 1436473192ef975ee515ede6ab90dbf832cdfab1
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup