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/rollup.d.ts CHANGED
@@ -219,7 +219,7 @@ export interface PluginContextMeta {
219
219
  }
220
220
 
221
221
  export interface ResolvedId extends ModuleOptions {
222
- external: boolean;
222
+ external: boolean | 'absolute';
223
223
  id: string;
224
224
  }
225
225
 
@@ -228,7 +228,7 @@ export interface ResolvedIdMap {
228
228
  }
229
229
 
230
230
  interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
231
- external?: boolean;
231
+ external?: boolean | 'absolute' | 'relative';
232
232
  id: string;
233
233
  }
234
234
 
@@ -528,6 +528,7 @@ export interface InputOptions {
528
528
  /** @deprecated Use the "inlineDynamicImports" output option instead. */
529
529
  inlineDynamicImports?: boolean;
530
530
  input?: InputOption;
531
+ makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
531
532
  /** @deprecated Use the "manualChunks" output option instead. */
532
533
  manualChunks?: ManualChunksOption;
533
534
  moduleContext?: ((id: string) => string | null | undefined) | { [id: string]: string };
@@ -554,6 +555,7 @@ export interface NormalizedInputOptions {
554
555
  /** @deprecated Use the "inlineDynamicImports" output option instead. */
555
556
  inlineDynamicImports: boolean | undefined;
556
557
  input: string[] | { [entryAlias: string]: string };
558
+ makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
557
559
  /** @deprecated Use the "manualChunks" output option instead. */
558
560
  manualChunks: ManualChunksOption | undefined;
559
561
  moduleContext: (id: string) => string;
@@ -727,6 +729,7 @@ export interface RenderedModule {
727
729
  removedExports: string[];
728
730
  renderedExports: string[];
729
731
  renderedLength: number;
732
+ code: string | null;
730
733
  }
731
734
 
732
735
  export interface PreRenderedChunk {
package/dist/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
@@ -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
@@ -72,6 +72,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
72
72
  external: getExternal(config, overrides),
73
73
  inlineDynamicImports: getOption('inlineDynamicImports'),
74
74
  input: getOption('input') || [],
75
+ makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
75
76
  manualChunks: getOption('manualChunks'),
76
77
  moduleContext: getOption('moduleContext'),
77
78
  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
@@ -32,7 +32,7 @@ function _interopNamespaceDefaultOnly(e) {
32
32
 
33
33
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
34
34
 
35
- var version$1 = "2.43.1";
35
+ var version$1 = "2.45.2";
36
36
 
37
37
  function ensureArray(items) {
38
38
  if (Array.isArray(items)) {
@@ -4650,9 +4650,10 @@ function makeLegal(str) {
4650
4650
  }
4651
4651
 
4652
4652
  class ExternalModule {
4653
- constructor(options, id, hasModuleSideEffects, meta) {
4653
+ constructor(options, id, hasModuleSideEffects, meta, renormalizeRenderPath) {
4654
4654
  this.options = options;
4655
4655
  this.id = id;
4656
+ this.renormalizeRenderPath = renormalizeRenderPath;
4656
4657
  this.defaultVariableName = '';
4657
4658
  this.dynamicImporters = [];
4658
4659
  this.importers = [];
@@ -4660,7 +4661,6 @@ class ExternalModule {
4660
4661
  this.namespaceVariableName = '';
4661
4662
  this.reexported = false;
4662
4663
  this.renderPath = undefined;
4663
- this.renormalizeRenderPath = false;
4664
4664
  this.used = false;
4665
4665
  this.variableName = '';
4666
4666
  this.execIndex = Infinity;
@@ -4702,13 +4702,9 @@ class ExternalModule {
4702
4702
  this.renderPath =
4703
4703
  typeof options.paths === 'function' ? options.paths(this.id) : options.paths[this.id];
4704
4704
  if (!this.renderPath) {
4705
- if (!isAbsolute(this.id)) {
4706
- this.renderPath = this.id;
4707
- }
4708
- else {
4709
- this.renderPath = normalize(path.relative(inputBase, this.id));
4710
- this.renormalizeRenderPath = true;
4711
- }
4705
+ this.renderPath = this.renormalizeRenderPath
4706
+ ? normalize(path.relative(inputBase, this.id))
4707
+ : this.id;
4712
4708
  }
4713
4709
  return this.renderPath;
4714
4710
  }
@@ -8379,17 +8375,11 @@ class ObjectExpression extends NodeBase {
8379
8375
  const isWrite = property.kind !== 'get';
8380
8376
  const isRead = property.kind !== 'set';
8381
8377
  let key;
8378
+ let unmatchable = false;
8382
8379
  if (property.computed) {
8383
8380
  const keyValue = property.key.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
8384
- if (keyValue === UnknownValue) {
8385
- if (isRead) {
8386
- this.unmatchablePropertiesRead.push(property);
8387
- }
8388
- else {
8389
- this.unmatchablePropertiesWrite.push(property);
8390
- }
8391
- continue;
8392
- }
8381
+ if (keyValue === UnknownValue)
8382
+ unmatchable = true;
8393
8383
  key = String(keyValue);
8394
8384
  }
8395
8385
  else if (property.key instanceof Identifier) {
@@ -8398,6 +8388,15 @@ class ObjectExpression extends NodeBase {
8398
8388
  else {
8399
8389
  key = String(property.key.value);
8400
8390
  }
8391
+ if (unmatchable || (key === '__proto__' && !property.computed)) {
8392
+ if (isRead) {
8393
+ this.unmatchablePropertiesRead.push(property);
8394
+ }
8395
+ else {
8396
+ this.unmatchablePropertiesWrite.push(property);
8397
+ }
8398
+ continue;
8399
+ }
8401
8400
  const propertyMapProperty = propertyMap[key];
8402
8401
  if (!propertyMapProperty) {
8403
8402
  propertyMap[key] = {
@@ -10933,6 +10932,7 @@ class Chunk {
10933
10932
  this.dependencies = new Set();
10934
10933
  this.dynamicDependencies = new Set();
10935
10934
  this.dynamicEntryModules = [];
10935
+ this.dynamicName = null;
10936
10936
  this.exportNamesByVariable = new Map();
10937
10937
  this.exports = new Set();
10938
10938
  this.exportsByName = Object.create(null);
@@ -11097,7 +11097,7 @@ class Chunk {
11097
11097
  this.facadeModule = module;
11098
11098
  this.facadeChunkByModule.set(module, this);
11099
11099
  this.strictFacade = true;
11100
- this.assignFacadeName({}, module);
11100
+ this.dynamicName = getChunkNameFromModule(module);
11101
11101
  }
11102
11102
  else if (this.facadeModule === module &&
11103
11103
  !this.strictFacade &&
@@ -11279,11 +11279,16 @@ class Chunk {
11279
11279
  }
11280
11280
  }
11281
11281
  const { renderedExports, removedExports } = module.getRenderedExports();
11282
+ const chunk = this;
11282
11283
  renderedModules[module.id] = {
11283
11284
  originalLength: module.originalCode.length,
11284
11285
  removedExports,
11285
11286
  renderedExports,
11286
- renderedLength
11287
+ renderedLength,
11288
+ get code() {
11289
+ var _a, _b;
11290
+ return (_b = (_a = chunk.renderedModuleSources.get(module)) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : null;
11291
+ }
11287
11292
  };
11288
11293
  }
11289
11294
  if (hoistedSource)
@@ -11441,7 +11446,7 @@ class Chunk {
11441
11446
  this.fileName = fileName;
11442
11447
  }
11443
11448
  else {
11444
- this.name = sanitizeFileName(name || facadedModule.chunkName || getAliasName(facadedModule.id));
11449
+ this.name = sanitizeFileName(name || getChunkNameFromModule(facadedModule));
11445
11450
  }
11446
11451
  }
11447
11452
  checkCircularDependencyImport(variable, importingModule) {
@@ -11660,6 +11665,9 @@ class Chunk {
11660
11665
  if (this.manualChunkAlias) {
11661
11666
  return this.manualChunkAlias;
11662
11667
  }
11668
+ if (this.dynamicName) {
11669
+ return this.dynamicName;
11670
+ }
11663
11671
  if (this.fileName) {
11664
11672
  return getAliasName(this.fileName);
11665
11673
  }
@@ -11909,6 +11917,9 @@ class Chunk {
11909
11917
  }
11910
11918
  }
11911
11919
  }
11920
+ function getChunkNameFromModule(module) {
11921
+ return module.chunkName || getAliasName(module.id);
11922
+ }
11912
11923
 
11913
11924
  const concatSep = (out, next) => (next ? `${out}\n${next}` : out);
11914
11925
  const concatDblSep = (out, next) => (next ? `${out}\n\n${next}` : out);
@@ -18335,7 +18346,7 @@ class ModuleLoader {
18335
18346
  external,
18336
18347
  id: resolvedId.id,
18337
18348
  meta: resolvedId.meta || EMPTY_OBJECT,
18338
- moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, external),
18349
+ moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, !!external),
18339
18350
  syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
18340
18351
  };
18341
18352
  }
@@ -18456,10 +18467,11 @@ class ModuleLoader {
18456
18467
  }
18457
18468
  fetchResolvedDependency(source, importer, resolvedId) {
18458
18469
  if (resolvedId.external) {
18459
- if (!this.modulesById.has(resolvedId.id)) {
18460
- this.modulesById.set(resolvedId.id, new ExternalModule(this.options, resolvedId.id, resolvedId.moduleSideEffects, resolvedId.meta));
18470
+ const { external, id, moduleSideEffects, meta } = resolvedId;
18471
+ if (!this.modulesById.has(id)) {
18472
+ this.modulesById.set(id, new ExternalModule(this.options, id, moduleSideEffects, meta, external !== 'absolute' && isAbsolute(id)));
18461
18473
  }
18462
- const externalModule = this.modulesById.get(resolvedId.id);
18474
+ const externalModule = this.modulesById.get(id);
18463
18475
  if (!(externalModule instanceof ExternalModule)) {
18464
18476
  return error(errInternalIdCannotBeExternal(source, importer));
18465
18477
  }
@@ -18478,25 +18490,38 @@ class ModuleLoader {
18478
18490
  }
18479
18491
  }
18480
18492
  getNormalizedResolvedIdWithoutDefaults(resolveIdResult, importer, source) {
18493
+ const { makeAbsoluteExternalsRelative } = this.options;
18481
18494
  if (resolveIdResult) {
18482
18495
  if (typeof resolveIdResult === 'object') {
18496
+ const external = resolveIdResult.external || this.options.external(resolveIdResult.id, importer, true);
18483
18497
  return {
18484
18498
  ...resolveIdResult,
18485
- external: resolveIdResult.external || this.options.external(resolveIdResult.id, importer, true)
18499
+ external: external &&
18500
+ (external === 'relative' ||
18501
+ !isAbsolute(resolveIdResult.id) ||
18502
+ (external === true &&
18503
+ isNotAbsoluteExternal(resolveIdResult.id, source, makeAbsoluteExternalsRelative)) ||
18504
+ 'absolute')
18486
18505
  };
18487
18506
  }
18488
18507
  const external = this.options.external(resolveIdResult, importer, true);
18489
18508
  return {
18490
- external,
18491
- id: external ? normalizeRelativeExternalId(resolveIdResult, importer) : resolveIdResult
18509
+ external: external &&
18510
+ (isNotAbsoluteExternal(resolveIdResult, source, makeAbsoluteExternalsRelative) ||
18511
+ 'absolute'),
18512
+ id: external && makeAbsoluteExternalsRelative
18513
+ ? normalizeRelativeExternalId(resolveIdResult, importer)
18514
+ : resolveIdResult
18492
18515
  };
18493
18516
  }
18494
- const id = normalizeRelativeExternalId(source, importer);
18517
+ const id = makeAbsoluteExternalsRelative
18518
+ ? normalizeRelativeExternalId(source, importer)
18519
+ : source;
18495
18520
  if (resolveIdResult !== false && !this.options.external(id, importer, true)) {
18496
18521
  return null;
18497
18522
  }
18498
18523
  return {
18499
- external: true,
18524
+ external: isNotAbsoluteExternal(id, source, makeAbsoluteExternalsRelative) || 'absolute',
18500
18525
  id
18501
18526
  };
18502
18527
  }
@@ -18534,7 +18559,9 @@ class ModuleLoader {
18534
18559
  ? errEntryCannotBeExternal(unresolvedId)
18535
18560
  : errImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore));
18536
18561
  }
18537
- return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object' ? resolveIdResult : { id: resolveIdResult }), undefined, isEntry);
18562
+ return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object'
18563
+ ? resolveIdResult
18564
+ : { id: resolveIdResult }), undefined, isEntry);
18538
18565
  }
18539
18566
  async resolveDynamicImport(module, specifier, importer) {
18540
18567
  const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
@@ -18582,6 +18609,11 @@ function addChunkNamesToModule(module, { fileName, name }, isUserDefined) {
18582
18609
  }
18583
18610
  }
18584
18611
  }
18612
+ function isNotAbsoluteExternal(id, source, makeAbsoluteExternalsRelative) {
18613
+ return (makeAbsoluteExternalsRelative === true ||
18614
+ (makeAbsoluteExternalsRelative === 'ifRelativeSource' && isRelative(source)) ||
18615
+ !isAbsolute(id));
18616
+ }
18585
18617
 
18586
18618
  function getDeprecatedContextHandler(handler, handlerName, newHandlerName, pluginName, activeDeprecation, options) {
18587
18619
  let deprecationWarningShown = false;
@@ -19627,6 +19659,31 @@ var acornClassFields = function(Parser) {
19627
19659
  }
19628
19660
  };
19629
19661
 
19662
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
19663
+
19664
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
19665
+ function privateMethods(Parser) {
19666
+ const ExtendedParser = acornPrivateClassElements(Parser);
19667
+
19668
+ return class extends ExtendedParser {
19669
+ // Parse private methods
19670
+ parseClassElement(_constructorAllowsSuper) {
19671
+ const oldInClassMemberName = this._inClassMemberName;
19672
+ this._inClassMemberName = true;
19673
+ const result = super.parseClassElement.apply(this, arguments);
19674
+ this._inClassMemberName = oldInClassMemberName;
19675
+ return result
19676
+ }
19677
+
19678
+ parsePropertyName(prop) {
19679
+ const isPrivate = this.options.ecmaVersion >= 8 && this._inClassMemberName && this.type == this.privateIdentifierToken && !prop.static;
19680
+ this._inClassMemberName = false;
19681
+ if (!isPrivate) return super.parsePropertyName(prop)
19682
+ return this.parsePrivateClassElementName(prop)
19683
+ }
19684
+ }
19685
+ }
19686
+
19630
19687
  const privateClassElements = acornPrivateClassElements;
19631
19688
 
19632
19689
  var acornStaticClassFeatures = function(Parser) {
@@ -19712,7 +19769,7 @@ var acornStaticClassFeatures = function(Parser) {
19712
19769
  };
19713
19770
 
19714
19771
  function normalizeInputOptions(config) {
19715
- var _a, _b;
19772
+ var _a, _b, _c;
19716
19773
  // These are options that may trigger special warnings or behaviour later
19717
19774
  // if the user did not select an explicit value
19718
19775
  const unsetOptions = new Set();
@@ -19728,6 +19785,7 @@ function normalizeInputOptions(config) {
19728
19785
  external: getIdMatcher(config.external),
19729
19786
  inlineDynamicImports: getInlineDynamicImports$1(config, onwarn, strictDeprecations),
19730
19787
  input: getInput(config),
19788
+ makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
19731
19789
  manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
19732
19790
  moduleContext: getModuleContext(config, context),
19733
19791
  onwarn,
@@ -19768,6 +19826,7 @@ const getAcorn = (config) => ({
19768
19826
  });
19769
19827
  const getAcornInjectPlugins = (config) => [
19770
19828
  acornClassFields,
19829
+ privateMethods,
19771
19830
  acornStaticClassFeatures,
19772
19831
  ...ensureArray(config.acornInjectPlugins)
19773
19832
  ];
@@ -19855,7 +19914,7 @@ const getTreeshake = (config, warn, strictDeprecations) => {
19855
19914
  return {
19856
19915
  annotations: configTreeshake.annotations !== false,
19857
19916
  moduleSideEffects: getHasModuleSideEffects(configTreeshake.moduleSideEffects, configTreeshake.pureExternalModules, warn),
19858
- propertyReadSideEffects: configTreeshake.propertyReadSideEffects === 'always' && 'always' ||
19917
+ propertyReadSideEffects: (configTreeshake.propertyReadSideEffects === 'always' && 'always') ||
19859
19918
  configTreeshake.propertyReadSideEffects !== false,
19860
19919
  tryCatchDeoptimization: configTreeshake.tryCatchDeoptimization !== false,
19861
19920
  unknownGlobalSideEffects: configTreeshake.unknownGlobalSideEffects !== false
@@ -20227,8 +20286,9 @@ async function getInputOptions(rawInputOptions, watchMode) {
20227
20286
  }
20228
20287
  function applyOptionHook(watchMode) {
20229
20288
  return async (inputOptions, plugin) => {
20230
- if (plugin.options)
20231
- return (plugin.options.call({ meta: { rollupVersion: version$1, watchMode } }, await inputOptions) || inputOptions);
20289
+ if (plugin.options) {
20290
+ return ((await plugin.options.call({ meta: { rollupVersion: version$1, watchMode } }, await inputOptions)) || inputOptions);
20291
+ }
20232
20292
  return inputOptions;
20233
20293
  };
20234
20294
  }
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.43.1",
3
+ "version": "2.45.2",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -74,6 +74,7 @@
74
74
  "acorn": "^8.0.5",
75
75
  "acorn-class-fields": "^1.0.0",
76
76
  "acorn-jsx": "^5.3.1",
77
+ "acorn-private-methods": "^1.0.0",
77
78
  "acorn-static-class-features": "^1.0.0",
78
79
  "acorn-walk": "^8.0.2",
79
80
  "buble": "^0.20.0",
@@ -90,7 +91,7 @@
90
91
  "fixturify": "^2.1.0",
91
92
  "hash.js": "^1.1.7",
92
93
  "husky": "^5.0.9",
93
- "is-reference": "lukastaegert/is-reference#update-class-features",
94
+ "is-reference": "git+https://github.com/lukastaegert/is-reference.git#update-class-features",
94
95
  "lint-staged": "^10.5.4",
95
96
  "locate-character": "^2.0.5",
96
97
  "magic-string": "^0.25.7",