rollup 2.34.2 → 2.36.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.
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.34.2
4
- Sun, 06 Dec 2020 05:40:46 GMT - commit 92a2dfa8f18350373aa2329dec45e56bd076909d
3
+ Rollup.js v2.36.1
4
+ Wed, 06 Jan 2021 14:06:54 GMT - commit d6600638c61b5eb7f389681d5fa4af9a1b95823e
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.34.2
4
- Sun, 06 Dec 2020 05:40:46 GMT - commit 92a2dfa8f18350373aa2329dec45e56bd076909d
3
+ Rollup.js v2.36.1
4
+ Wed, 06 Jan 2021 14:06:54 GMT - commit d6600638c61b5eb7f389681d5fa4af9a1b95823e
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -13,7 +13,7 @@ import { createHash as createHash$1 } from 'crypto';
13
13
  import { writeFile as writeFile$1, readdirSync, mkdirSync, readFile as readFile$1, lstatSync, realpathSync } from 'fs';
14
14
  import { EventEmitter } from 'events';
15
15
 
16
- var version = "2.34.2";
16
+ var version = "2.36.1";
17
17
 
18
18
  var charToInteger = {};
19
19
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -5226,6 +5226,7 @@ function augmentCodeLocation(props, pos, source, id) {
5226
5226
  }
5227
5227
  var Errors;
5228
5228
  (function (Errors) {
5229
+ Errors["ALREADY_CLOSED"] = "ALREADY_CLOSED";
5229
5230
  Errors["ASSET_NOT_FINALISED"] = "ASSET_NOT_FINALISED";
5230
5231
  Errors["ASSET_NOT_FOUND"] = "ASSET_NOT_FOUND";
5231
5232
  Errors["ASSET_SOURCE_ALREADY_SET"] = "ASSET_SOURCE_ALREADY_SET";
@@ -5234,8 +5235,9 @@ var Errors;
5234
5235
  Errors["CANNOT_EMIT_FROM_OPTIONS_HOOK"] = "CANNOT_EMIT_FROM_OPTIONS_HOOK";
5235
5236
  Errors["CHUNK_NOT_GENERATED"] = "CHUNK_NOT_GENERATED";
5236
5237
  Errors["DEPRECATED_FEATURE"] = "DEPRECATED_FEATURE";
5237
- Errors["FILE_NOT_FOUND"] = "FILE_NOT_FOUND";
5238
+ Errors["EXTERNAL_SYNTHETIC_EXPORTS"] = "EXTERNAL_SYNTHETIC_EXPORTS";
5238
5239
  Errors["FILE_NAME_CONFLICT"] = "FILE_NAME_CONFLICT";
5240
+ Errors["FILE_NOT_FOUND"] = "FILE_NOT_FOUND";
5239
5241
  Errors["INPUT_HOOK_IN_OUTPUT_PLUGIN"] = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
5240
5242
  Errors["INVALID_CHUNK"] = "INVALID_CHUNK";
5241
5243
  Errors["INVALID_EXPORT_OPTION"] = "INVALID_EXPORT_OPTION";
@@ -5249,12 +5251,11 @@ var Errors;
5249
5251
  Errors["NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE"] = "NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE";
5250
5252
  Errors["PLUGIN_ERROR"] = "PLUGIN_ERROR";
5251
5253
  Errors["PREFER_NAMED_EXPORTS"] = "PREFER_NAMED_EXPORTS";
5254
+ Errors["SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT"] = "SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT";
5252
5255
  Errors["UNEXPECTED_NAMED_IMPORT"] = "UNEXPECTED_NAMED_IMPORT";
5253
5256
  Errors["UNRESOLVED_ENTRY"] = "UNRESOLVED_ENTRY";
5254
5257
  Errors["UNRESOLVED_IMPORT"] = "UNRESOLVED_IMPORT";
5255
5258
  Errors["VALIDATION_ERROR"] = "VALIDATION_ERROR";
5256
- Errors["EXTERNAL_SYNTHETIC_EXPORTS"] = "EXTERNAL_SYNTHETIC_EXPORTS";
5257
- Errors["SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT"] = "SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT";
5258
5259
  })(Errors || (Errors = {}));
5259
5260
  function errAssetNotFinalisedForFileName(name) {
5260
5261
  return {
@@ -5477,6 +5478,12 @@ function errFailedValidation(message) {
5477
5478
  message
5478
5479
  };
5479
5480
  }
5481
+ function errAlreadyClosed() {
5482
+ return {
5483
+ code: Errors.ALREADY_CLOSED,
5484
+ message: 'Bundle is already closed, no more calls to "generate" or "write" are allowed.'
5485
+ };
5486
+ }
5480
5487
  function warnDeprecation(deprecation, activeDeprecation, options) {
5481
5488
  warnDeprecationWithOptions(deprecation, activeDeprecation, options.onwarn, options.strictDeprecations);
5482
5489
  }
@@ -6138,12 +6145,28 @@ class AssignmentExpression extends NodeBase {
6138
6145
  if (!this.deoptimized)
6139
6146
  this.applyDeoptimizations();
6140
6147
  this.included = true;
6141
- this.left.include(context, includeChildrenRecursively);
6148
+ let hasEffectsContext;
6149
+ if (includeChildrenRecursively ||
6150
+ this.operator !== '=' ||
6151
+ this.left.included ||
6152
+ ((hasEffectsContext = createHasEffectsContext()),
6153
+ this.left.hasEffects(hasEffectsContext) ||
6154
+ this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, hasEffectsContext))) {
6155
+ this.left.include(context, includeChildrenRecursively);
6156
+ }
6142
6157
  this.right.include(context, includeChildrenRecursively);
6143
6158
  }
6144
- render(code, options) {
6145
- this.left.render(code, options);
6146
- this.right.render(code, options);
6159
+ render(code, options, { renderedParentType } = BLANK) {
6160
+ if (this.left.included) {
6161
+ this.left.render(code, options);
6162
+ this.right.render(code, options);
6163
+ }
6164
+ else {
6165
+ this.right.render(code, options, {
6166
+ renderedParentType: renderedParentType || this.parent.type
6167
+ });
6168
+ code.remove(this.start, this.right.start);
6169
+ }
6147
6170
  if (options.format === 'system') {
6148
6171
  const exportNames = this.left.variable && options.exportNamesByVariable.get(this.left.variable);
6149
6172
  if (this.left.type === 'Identifier' && exportNames) {
@@ -18546,6 +18569,7 @@ function getPluginContexts(pluginCache, graph, options, fileEmitter) {
18546
18569
  const inputHookNames = {
18547
18570
  buildEnd: 1,
18548
18571
  buildStart: 1,
18572
+ closeBundle: 1,
18549
18573
  closeWatcher: 1,
18550
18574
  load: 1,
18551
18575
  moduleParsed: 1,
@@ -19914,17 +19938,29 @@ async function rollupInternal(rawInputOptions, watcher) {
19914
19938
  err.watchFiles = watchFiles;
19915
19939
  }
19916
19940
  await graph.pluginDriver.hookParallel('buildEnd', [err]);
19941
+ await graph.pluginDriver.hookParallel('closeBundle', []);
19917
19942
  throw err;
19918
19943
  }
19919
19944
  await graph.pluginDriver.hookParallel('buildEnd', []);
19920
19945
  timeEnd('BUILD', 1);
19921
19946
  const result = {
19922
19947
  cache: useCache ? graph.getCache() : undefined,
19948
+ closed: false,
19949
+ async close() {
19950
+ if (result.closed)
19951
+ return;
19952
+ result.closed = true;
19953
+ await graph.pluginDriver.hookParallel('closeBundle', []);
19954
+ },
19923
19955
  async generate(rawOutputOptions) {
19956
+ if (result.closed)
19957
+ return error(errAlreadyClosed());
19924
19958
  return handleGenerateWrite(false, inputOptions, unsetInputOptions, rawOutputOptions, graph);
19925
19959
  },
19926
19960
  watchFiles: Object.keys(graph.watchFiles),
19927
19961
  async write(rawOutputOptions) {
19962
+ if (result.closed)
19963
+ return error(errAlreadyClosed());
19928
19964
  return handleGenerateWrite(true, inputOptions, unsetInputOptions, rawOutputOptions, graph);
19929
19965
  }
19930
19966
  };
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.34.2
4
- Sun, 06 Dec 2020 05:40:46 GMT - commit 92a2dfa8f18350373aa2329dec45e56bd076909d
3
+ Rollup.js v2.36.1
4
+ Wed, 06 Jan 2021 14:06:54 GMT - commit d6600638c61b5eb7f389681d5fa4af9a1b95823e
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -7203,22 +7203,13 @@ class Watcher {
7203
7203
  this.emitter.emit('event', {
7204
7204
  code: 'START'
7205
7205
  });
7206
- try {
7207
- for (const task of this.tasks) {
7208
- await task.run();
7209
- }
7210
- this.running = false;
7211
- this.emitter.emit('event', {
7212
- code: 'END'
7213
- });
7214
- }
7215
- catch (error) {
7216
- this.running = false;
7217
- this.emitter.emit('event', {
7218
- code: 'ERROR',
7219
- error
7220
- });
7206
+ for (const task of this.tasks) {
7207
+ await task.run();
7221
7208
  }
7209
+ this.running = false;
7210
+ this.emitter.emit('event', {
7211
+ code: 'END'
7212
+ });
7222
7213
  if (this.rerun) {
7223
7214
  this.rerun = false;
7224
7215
  this.invalidate();
@@ -7279,8 +7270,9 @@ class Task {
7279
7270
  input: this.options.input,
7280
7271
  output: this.outputFiles
7281
7272
  });
7273
+ let result = null;
7282
7274
  try {
7283
- const result = await rollupInternal(options, this.watcher.emitter);
7275
+ result = await rollupInternal(options, this.watcher.emitter);
7284
7276
  if (this.closed) {
7285
7277
  return;
7286
7278
  }
@@ -7295,18 +7287,21 @@ class Task {
7295
7287
  });
7296
7288
  }
7297
7289
  catch (error) {
7298
- if (this.closed) {
7299
- return;
7300
- }
7301
- if (Array.isArray(error.watchFiles)) {
7302
- for (const id of error.watchFiles) {
7303
- this.watchFile(id);
7290
+ if (!this.closed) {
7291
+ if (Array.isArray(error.watchFiles)) {
7292
+ for (const id of error.watchFiles) {
7293
+ this.watchFile(id);
7294
+ }
7295
+ }
7296
+ if (error.id) {
7297
+ this.cache.modules = this.cache.modules.filter(module => module.id !== error.id);
7304
7298
  }
7305
7299
  }
7306
- if (error.id) {
7307
- this.cache.modules = this.cache.modules.filter(module => module.id !== error.id);
7308
- }
7309
- throw error;
7300
+ this.watcher.emitter.emit('event', {
7301
+ code: 'ERROR',
7302
+ error,
7303
+ result
7304
+ });
7310
7305
  }
7311
7306
  }
7312
7307
  updateWatchedFiles(result) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.34.2
4
- Sun, 06 Dec 2020 05:40:46 GMT - commit 92a2dfa8f18350373aa2329dec45e56bd076909d
3
+ Rollup.js v2.36.1
4
+ Wed, 06 Jan 2021 14:06:54 GMT - commit d6600638c61b5eb7f389681d5fa4af9a1b95823e
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup