rollup 2.43.1 → 2.45.2

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.43.1
4
- Sun, 28 Mar 2021 06:06:20 GMT - commit e1dd08a171be22b6cd1f6cf863dbd1282ed25a6f
3
+ Rollup.js v2.45.2
4
+ Tue, 13 Apr 2021 04:32:03 GMT - commit e9bedf202e4754caaa32d566c9eef0147e1ef3b9
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.43.1
4
- Sun, 28 Mar 2021 06:06:20 GMT - commit e1dd08a171be22b6cd1f6cf863dbd1282ed25a6f
3
+ Rollup.js v2.45.2
4
+ Tue, 13 Apr 2021 04:32:03 GMT - commit e9bedf202e4754caaa32d566c9eef0147e1ef3b9
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -14,7 +14,7 @@ import * as fs from 'fs';
14
14
  import { lstatSync, realpathSync, readdirSync } from 'fs';
15
15
  import { EventEmitter } from 'events';
16
16
 
17
- var version$1 = "2.43.1";
17
+ var version$1 = "2.45.2";
18
18
 
19
19
  var charToInteger = {};
20
20
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -4542,9 +4542,10 @@ function normalize(path) {
4542
4542
  }
4543
4543
 
4544
4544
  class ExternalModule {
4545
- constructor(options, id, hasModuleSideEffects, meta) {
4545
+ constructor(options, id, hasModuleSideEffects, meta, renormalizeRenderPath) {
4546
4546
  this.options = options;
4547
4547
  this.id = id;
4548
+ this.renormalizeRenderPath = renormalizeRenderPath;
4548
4549
  this.defaultVariableName = '';
4549
4550
  this.dynamicImporters = [];
4550
4551
  this.importers = [];
@@ -4552,7 +4553,6 @@ class ExternalModule {
4552
4553
  this.namespaceVariableName = '';
4553
4554
  this.reexported = false;
4554
4555
  this.renderPath = undefined;
4555
- this.renormalizeRenderPath = false;
4556
4556
  this.used = false;
4557
4557
  this.variableName = '';
4558
4558
  this.execIndex = Infinity;
@@ -4594,13 +4594,9 @@ class ExternalModule {
4594
4594
  this.renderPath =
4595
4595
  typeof options.paths === 'function' ? options.paths(this.id) : options.paths[this.id];
4596
4596
  if (!this.renderPath) {
4597
- if (!isAbsolute(this.id)) {
4598
- this.renderPath = this.id;
4599
- }
4600
- else {
4601
- this.renderPath = normalize(relative$1(inputBase, this.id));
4602
- this.renormalizeRenderPath = true;
4603
- }
4597
+ this.renderPath = this.renormalizeRenderPath
4598
+ ? normalize(relative$1(inputBase, this.id))
4599
+ : this.id;
4604
4600
  }
4605
4601
  return this.renderPath;
4606
4602
  }
@@ -8296,17 +8292,11 @@ class ObjectExpression extends NodeBase {
8296
8292
  const isWrite = property.kind !== 'get';
8297
8293
  const isRead = property.kind !== 'set';
8298
8294
  let key;
8295
+ let unmatchable = false;
8299
8296
  if (property.computed) {
8300
8297
  const keyValue = property.key.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
8301
- if (keyValue === UnknownValue) {
8302
- if (isRead) {
8303
- this.unmatchablePropertiesRead.push(property);
8304
- }
8305
- else {
8306
- this.unmatchablePropertiesWrite.push(property);
8307
- }
8308
- continue;
8309
- }
8298
+ if (keyValue === UnknownValue)
8299
+ unmatchable = true;
8310
8300
  key = String(keyValue);
8311
8301
  }
8312
8302
  else if (property.key instanceof Identifier) {
@@ -8315,6 +8305,15 @@ class ObjectExpression extends NodeBase {
8315
8305
  else {
8316
8306
  key = String(property.key.value);
8317
8307
  }
8308
+ if (unmatchable || (key === '__proto__' && !property.computed)) {
8309
+ if (isRead) {
8310
+ this.unmatchablePropertiesRead.push(property);
8311
+ }
8312
+ else {
8313
+ this.unmatchablePropertiesWrite.push(property);
8314
+ }
8315
+ continue;
8316
+ }
8318
8317
  const propertyMapProperty = propertyMap[key];
8319
8318
  if (!propertyMapProperty) {
8320
8319
  propertyMap[key] = {
@@ -10850,6 +10849,7 @@ class Chunk {
10850
10849
  this.dependencies = new Set();
10851
10850
  this.dynamicDependencies = new Set();
10852
10851
  this.dynamicEntryModules = [];
10852
+ this.dynamicName = null;
10853
10853
  this.exportNamesByVariable = new Map();
10854
10854
  this.exports = new Set();
10855
10855
  this.exportsByName = Object.create(null);
@@ -11014,7 +11014,7 @@ class Chunk {
11014
11014
  this.facadeModule = module;
11015
11015
  this.facadeChunkByModule.set(module, this);
11016
11016
  this.strictFacade = true;
11017
- this.assignFacadeName({}, module);
11017
+ this.dynamicName = getChunkNameFromModule(module);
11018
11018
  }
11019
11019
  else if (this.facadeModule === module &&
11020
11020
  !this.strictFacade &&
@@ -11196,11 +11196,16 @@ class Chunk {
11196
11196
  }
11197
11197
  }
11198
11198
  const { renderedExports, removedExports } = module.getRenderedExports();
11199
+ const chunk = this;
11199
11200
  renderedModules[module.id] = {
11200
11201
  originalLength: module.originalCode.length,
11201
11202
  removedExports,
11202
11203
  renderedExports,
11203
- renderedLength
11204
+ renderedLength,
11205
+ get code() {
11206
+ var _a, _b;
11207
+ return (_b = (_a = chunk.renderedModuleSources.get(module)) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : null;
11208
+ }
11204
11209
  };
11205
11210
  }
11206
11211
  if (hoistedSource)
@@ -11358,7 +11363,7 @@ class Chunk {
11358
11363
  this.fileName = fileName;
11359
11364
  }
11360
11365
  else {
11361
- this.name = sanitizeFileName(name || facadedModule.chunkName || getAliasName(facadedModule.id));
11366
+ this.name = sanitizeFileName(name || getChunkNameFromModule(facadedModule));
11362
11367
  }
11363
11368
  }
11364
11369
  checkCircularDependencyImport(variable, importingModule) {
@@ -11577,6 +11582,9 @@ class Chunk {
11577
11582
  if (this.manualChunkAlias) {
11578
11583
  return this.manualChunkAlias;
11579
11584
  }
11585
+ if (this.dynamicName) {
11586
+ return this.dynamicName;
11587
+ }
11580
11588
  if (this.fileName) {
11581
11589
  return getAliasName(this.fileName);
11582
11590
  }
@@ -11826,6 +11834,9 @@ class Chunk {
11826
11834
  }
11827
11835
  }
11828
11836
  }
11837
+ function getChunkNameFromModule(module) {
11838
+ return module.chunkName || getAliasName(module.id);
11839
+ }
11829
11840
 
11830
11841
  const concatSep = (out, next) => (next ? `${out}\n${next}` : out);
11831
11842
  const concatDblSep = (out, next) => (next ? `${out}\n\n${next}` : out);
@@ -18252,7 +18263,7 @@ class ModuleLoader {
18252
18263
  external,
18253
18264
  id: resolvedId.id,
18254
18265
  meta: resolvedId.meta || EMPTY_OBJECT,
18255
- moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, external),
18266
+ moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, !!external),
18256
18267
  syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
18257
18268
  };
18258
18269
  }
@@ -18373,10 +18384,11 @@ class ModuleLoader {
18373
18384
  }
18374
18385
  fetchResolvedDependency(source, importer, resolvedId) {
18375
18386
  if (resolvedId.external) {
18376
- if (!this.modulesById.has(resolvedId.id)) {
18377
- this.modulesById.set(resolvedId.id, new ExternalModule(this.options, resolvedId.id, resolvedId.moduleSideEffects, resolvedId.meta));
18387
+ const { external, id, moduleSideEffects, meta } = resolvedId;
18388
+ if (!this.modulesById.has(id)) {
18389
+ this.modulesById.set(id, new ExternalModule(this.options, id, moduleSideEffects, meta, external !== 'absolute' && isAbsolute(id)));
18378
18390
  }
18379
- const externalModule = this.modulesById.get(resolvedId.id);
18391
+ const externalModule = this.modulesById.get(id);
18380
18392
  if (!(externalModule instanceof ExternalModule)) {
18381
18393
  return error(errInternalIdCannotBeExternal(source, importer));
18382
18394
  }
@@ -18395,25 +18407,38 @@ class ModuleLoader {
18395
18407
  }
18396
18408
  }
18397
18409
  getNormalizedResolvedIdWithoutDefaults(resolveIdResult, importer, source) {
18410
+ const { makeAbsoluteExternalsRelative } = this.options;
18398
18411
  if (resolveIdResult) {
18399
18412
  if (typeof resolveIdResult === 'object') {
18413
+ const external = resolveIdResult.external || this.options.external(resolveIdResult.id, importer, true);
18400
18414
  return {
18401
18415
  ...resolveIdResult,
18402
- external: resolveIdResult.external || this.options.external(resolveIdResult.id, importer, true)
18416
+ external: external &&
18417
+ (external === 'relative' ||
18418
+ !isAbsolute(resolveIdResult.id) ||
18419
+ (external === true &&
18420
+ isNotAbsoluteExternal(resolveIdResult.id, source, makeAbsoluteExternalsRelative)) ||
18421
+ 'absolute')
18403
18422
  };
18404
18423
  }
18405
18424
  const external = this.options.external(resolveIdResult, importer, true);
18406
18425
  return {
18407
- external,
18408
- id: external ? normalizeRelativeExternalId(resolveIdResult, importer) : resolveIdResult
18426
+ external: external &&
18427
+ (isNotAbsoluteExternal(resolveIdResult, source, makeAbsoluteExternalsRelative) ||
18428
+ 'absolute'),
18429
+ id: external && makeAbsoluteExternalsRelative
18430
+ ? normalizeRelativeExternalId(resolveIdResult, importer)
18431
+ : resolveIdResult
18409
18432
  };
18410
18433
  }
18411
- const id = normalizeRelativeExternalId(source, importer);
18434
+ const id = makeAbsoluteExternalsRelative
18435
+ ? normalizeRelativeExternalId(source, importer)
18436
+ : source;
18412
18437
  if (resolveIdResult !== false && !this.options.external(id, importer, true)) {
18413
18438
  return null;
18414
18439
  }
18415
18440
  return {
18416
- external: true,
18441
+ external: isNotAbsoluteExternal(id, source, makeAbsoluteExternalsRelative) || 'absolute',
18417
18442
  id
18418
18443
  };
18419
18444
  }
@@ -18451,7 +18476,9 @@ class ModuleLoader {
18451
18476
  ? errEntryCannotBeExternal(unresolvedId)
18452
18477
  : errImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore));
18453
18478
  }
18454
- return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object' ? resolveIdResult : { id: resolveIdResult }), undefined, isEntry);
18479
+ return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object'
18480
+ ? resolveIdResult
18481
+ : { id: resolveIdResult }), undefined, isEntry);
18455
18482
  }
18456
18483
  async resolveDynamicImport(module, specifier, importer) {
18457
18484
  const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
@@ -18499,6 +18526,11 @@ function addChunkNamesToModule(module, { fileName, name }, isUserDefined) {
18499
18526
  }
18500
18527
  }
18501
18528
  }
18529
+ function isNotAbsoluteExternal(id, source, makeAbsoluteExternalsRelative) {
18530
+ return (makeAbsoluteExternalsRelative === true ||
18531
+ (makeAbsoluteExternalsRelative === 'ifRelativeSource' && isRelative(source)) ||
18532
+ !isAbsolute(id));
18533
+ }
18502
18534
 
18503
18535
  function getDeprecatedContextHandler(handler, handlerName, newHandlerName, pluginName, activeDeprecation, options) {
18504
18536
  let deprecationWarningShown = false;
@@ -19569,6 +19601,31 @@ var acornClassFields = function(Parser) {
19569
19601
  }
19570
19602
  };
19571
19603
 
19604
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
19605
+
19606
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
19607
+ function privateMethods(Parser) {
19608
+ const ExtendedParser = acornPrivateClassElements(Parser);
19609
+
19610
+ return class extends ExtendedParser {
19611
+ // Parse private methods
19612
+ parseClassElement(_constructorAllowsSuper) {
19613
+ const oldInClassMemberName = this._inClassMemberName;
19614
+ this._inClassMemberName = true;
19615
+ const result = super.parseClassElement.apply(this, arguments);
19616
+ this._inClassMemberName = oldInClassMemberName;
19617
+ return result
19618
+ }
19619
+
19620
+ parsePropertyName(prop) {
19621
+ const isPrivate = this.options.ecmaVersion >= 8 && this._inClassMemberName && this.type == this.privateIdentifierToken && !prop.static;
19622
+ this._inClassMemberName = false;
19623
+ if (!isPrivate) return super.parsePropertyName(prop)
19624
+ return this.parsePrivateClassElementName(prop)
19625
+ }
19626
+ }
19627
+ }
19628
+
19572
19629
  const privateClassElements = acornPrivateClassElements;
19573
19630
 
19574
19631
  var acornStaticClassFeatures = function(Parser) {
@@ -19670,7 +19727,7 @@ function warnUnknownOptions(passedOptions, validOptions, optionType, warn, ignor
19670
19727
  }
19671
19728
 
19672
19729
  function normalizeInputOptions(config) {
19673
- var _a, _b;
19730
+ var _a, _b, _c;
19674
19731
  // These are options that may trigger special warnings or behaviour later
19675
19732
  // if the user did not select an explicit value
19676
19733
  const unsetOptions = new Set();
@@ -19686,6 +19743,7 @@ function normalizeInputOptions(config) {
19686
19743
  external: getIdMatcher(config.external),
19687
19744
  inlineDynamicImports: getInlineDynamicImports$1(config, onwarn, strictDeprecations),
19688
19745
  input: getInput(config),
19746
+ makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
19689
19747
  manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
19690
19748
  moduleContext: getModuleContext(config, context),
19691
19749
  onwarn,
@@ -19726,6 +19784,7 @@ const getAcorn = (config) => ({
19726
19784
  });
19727
19785
  const getAcornInjectPlugins = (config) => [
19728
19786
  acornClassFields,
19787
+ privateMethods,
19729
19788
  acornStaticClassFeatures,
19730
19789
  ...ensureArray(config.acornInjectPlugins)
19731
19790
  ];
@@ -19813,7 +19872,7 @@ const getTreeshake = (config, warn, strictDeprecations) => {
19813
19872
  return {
19814
19873
  annotations: configTreeshake.annotations !== false,
19815
19874
  moduleSideEffects: getHasModuleSideEffects(configTreeshake.moduleSideEffects, configTreeshake.pureExternalModules, warn),
19816
- propertyReadSideEffects: configTreeshake.propertyReadSideEffects === 'always' && 'always' ||
19875
+ propertyReadSideEffects: (configTreeshake.propertyReadSideEffects === 'always' && 'always') ||
19817
19876
  configTreeshake.propertyReadSideEffects !== false,
19818
19877
  tryCatchDeoptimization: configTreeshake.tryCatchDeoptimization !== false,
19819
19878
  unknownGlobalSideEffects: configTreeshake.unknownGlobalSideEffects !== false
@@ -20185,8 +20244,9 @@ async function getInputOptions(rawInputOptions, watchMode) {
20185
20244
  }
20186
20245
  function applyOptionHook(watchMode) {
20187
20246
  return async (inputOptions, plugin) => {
20188
- if (plugin.options)
20189
- return (plugin.options.call({ meta: { rollupVersion: version$1, watchMode } }, await inputOptions) || inputOptions);
20247
+ if (plugin.options) {
20248
+ return ((await plugin.options.call({ meta: { rollupVersion: version$1, watchMode } }, await inputOptions)) || inputOptions);
20249
+ }
20190
20250
  return inputOptions;
20191
20251
  };
20192
20252
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.43.1
4
- Sun, 28 Mar 2021 06:06:20 GMT - commit e1dd08a171be22b6cd1f6cf863dbd1282ed25a6f
3
+ Rollup.js v2.45.2
4
+ Tue, 13 Apr 2021 04:32:03 GMT - commit e9bedf202e4754caaa32d566c9eef0147e1ef3b9
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -4049,6 +4049,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
4049
4049
  external: getExternal(config, overrides),
4050
4050
  inlineDynamicImports: getOption('inlineDynamicImports'),
4051
4051
  input: getOption('input') || [],
4052
+ makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
4052
4053
  manualChunks: getOption('manualChunks'),
4053
4054
  moduleContext: getOption('moduleContext'),
4054
4055
  onwarn: getOnWarn(config, defaultOnWarnHandler),
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.43.1
4
- Sun, 28 Mar 2021 06:06:20 GMT - commit e1dd08a171be22b6cd1f6cf863dbd1282ed25a6f
3
+ Rollup.js v2.45.2
4
+ Tue, 13 Apr 2021 04:32:03 GMT - commit e9bedf202e4754caaa32d566c9eef0147e1ef3b9
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup