rollup 2.52.0 → 2.52.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.52.0
4
- Wed, 16 Jun 2021 05:23:55 GMT - commit c4f9d13bd284a6b483b1a087917ed3f0bc93cd18
3
+ Rollup.js v2.52.1
4
+ Thu, 17 Jun 2021 05:22:05 GMT - commit bef5fe8a573648f73c258ce9adf1a7ff3ffb129d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.0
4
- Wed, 16 Jun 2021 05:23:55 GMT - commit c4f9d13bd284a6b483b1a087917ed3f0bc93cd18
3
+ Rollup.js v2.52.1
4
+ Thu, 17 Jun 2021 05:22:05 GMT - commit bef5fe8a573648f73c258ce9adf1a7ff3ffb129d
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.52.0";
17
+ var version$1 = "2.52.1";
18
18
 
19
19
  var charToInteger = {};
20
20
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -4279,9 +4279,10 @@ const INTEGER_REG_EXP = /^\d+$/;
4279
4279
  class ObjectEntity extends ExpressionEntity {
4280
4280
  // If a PropertyMap is used, this will be taken as propertiesAndGettersByKey
4281
4281
  // and we assume there are no setters or getters
4282
- constructor(properties, prototypeExpression) {
4282
+ constructor(properties, prototypeExpression, immutable = false) {
4283
4283
  super();
4284
4284
  this.prototypeExpression = prototypeExpression;
4285
+ this.immutable = immutable;
4285
4286
  this.allProperties = [];
4286
4287
  this.deoptimizedPaths = Object.create(null);
4287
4288
  this.expressionsToBeDeoptimizedByKey = Object.create(null);
@@ -4337,7 +4338,7 @@ class ObjectEntity extends ExpressionEntity {
4337
4338
  }
4338
4339
  deoptimizePath(path) {
4339
4340
  var _a;
4340
- if (this.hasUnknownDeoptimizedProperty)
4341
+ if (this.hasUnknownDeoptimizedProperty || this.immutable)
4341
4342
  return;
4342
4343
  const key = path[0];
4343
4344
  if (path.length === 1) {
@@ -4369,9 +4370,6 @@ class ObjectEntity extends ExpressionEntity {
4369
4370
  }
4370
4371
  deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
4371
4372
  var _a;
4372
- if (path.length === 0) {
4373
- return;
4374
- }
4375
4373
  const [key, ...subPath] = path;
4376
4374
  if (this.hasUnknownDeoptimizedProperty ||
4377
4375
  // single paths that are deoptimized will not become getters or setters
@@ -4398,7 +4396,9 @@ class ObjectEntity extends ExpressionEntity {
4398
4396
  property.deoptimizeThisOnEventAtPath(event, subPath, thisParameter, recursionTracker);
4399
4397
  }
4400
4398
  }
4401
- this.thisParametersToBeDeoptimized.add(thisParameter);
4399
+ if (!this.immutable) {
4400
+ this.thisParametersToBeDeoptimized.add(thisParameter);
4401
+ }
4402
4402
  return;
4403
4403
  }
4404
4404
  for (const property of relevantUnmatchableProperties) {
@@ -4422,7 +4422,9 @@ class ObjectEntity extends ExpressionEntity {
4422
4422
  property.deoptimizeThisOnEventAtPath(event, subPath, thisParameter, recursionTracker);
4423
4423
  }
4424
4424
  }
4425
- this.thisParametersToBeDeoptimized.add(thisParameter);
4425
+ if (!this.immutable) {
4426
+ this.thisParametersToBeDeoptimized.add(thisParameter);
4427
+ }
4426
4428
  (_a = this.prototypeExpression) === null || _a === void 0 ? void 0 : _a.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
4427
4429
  }
4428
4430
  getLiteralValueAtPath(path, recursionTracker, origin) {
@@ -4485,8 +4487,9 @@ class ObjectEntity extends ExpressionEntity {
4485
4487
  return false;
4486
4488
  }
4487
4489
  for (const getter of this.unmatchableGetters) {
4488
- if (getter.hasEffectsWhenAccessedAtPath(subPath, context))
4490
+ if (getter.hasEffectsWhenAccessedAtPath(subPath, context)) {
4489
4491
  return true;
4492
+ }
4490
4493
  }
4491
4494
  }
4492
4495
  else {
@@ -4519,6 +4522,7 @@ class ObjectEntity extends ExpressionEntity {
4519
4522
  }
4520
4523
  if (this.hasUnknownDeoptimizedProperty)
4521
4524
  return true;
4525
+ // We do not need to test for unknown properties as in that case, hasUnknownDeoptimizedProperty is true
4522
4526
  if (typeof key === 'string') {
4523
4527
  if (this.propertiesAndSettersByKey[key]) {
4524
4528
  const setters = this.settersByKey[key];
@@ -4531,15 +4535,8 @@ class ObjectEntity extends ExpressionEntity {
4531
4535
  return false;
4532
4536
  }
4533
4537
  for (const property of this.unmatchableSetters) {
4534
- if (property.hasEffectsWhenAssignedAtPath(subPath, context))
4538
+ if (property.hasEffectsWhenAssignedAtPath(subPath, context)) {
4535
4539
  return true;
4536
- }
4537
- }
4538
- else {
4539
- for (const setters of Object.values(this.settersByKey).concat([this.unmatchableSetters])) {
4540
- for (const setter of setters) {
4541
- if (setter.hasEffectsWhenAssignedAtPath(subPath, context))
4542
- return true;
4543
4540
  }
4544
4541
  }
4545
4542
  }
@@ -4598,11 +4595,6 @@ class ObjectEntity extends ExpressionEntity {
4598
4595
  }
4599
4596
  if (!propertiesAndGettersByKey[key]) {
4600
4597
  propertiesAndGettersByKey[key] = [property, ...unmatchablePropertiesAndGetters];
4601
- if (INTEGER_REG_EXP.test(key)) {
4602
- for (const integerProperty of unknownIntegerProps) {
4603
- propertiesAndGettersByKey[key].push(integerProperty);
4604
- }
4605
- }
4606
4598
  }
4607
4599
  }
4608
4600
  }
@@ -4653,7 +4645,7 @@ class ObjectEntity extends ExpressionEntity {
4653
4645
  return UNKNOWN_EXPRESSION;
4654
4646
  }
4655
4647
  const expression = this.getMemberExpression(key);
4656
- if (expression !== UNKNOWN_EXPRESSION) {
4648
+ if (!(expression === UNKNOWN_EXPRESSION || this.immutable)) {
4657
4649
  const expressionsToBeDeoptimized = (this.expressionsToBeDeoptimizedByKey[key] =
4658
4650
  this.expressionsToBeDeoptimizedByKey[key] || []);
4659
4651
  expressionsToBeDeoptimized.push(origin);
@@ -4786,7 +4778,7 @@ const OBJECT_PROTOTYPE = new ObjectEntity({
4786
4778
  toLocaleString: METHOD_RETURNS_STRING,
4787
4779
  toString: METHOD_RETURNS_STRING,
4788
4780
  valueOf: METHOD_RETURNS_UNKNOWN
4789
- }, null);
4781
+ }, null, true);
4790
4782
 
4791
4783
  class ClassNode extends NodeBase {
4792
4784
  constructor() {
@@ -5765,7 +5757,7 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
5765
5757
  splice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
5766
5758
  unshift: METHOD_MUTATES_SELF_RETURNS_NUMBER,
5767
5759
  values: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN
5768
- }, OBJECT_PROTOTYPE);
5760
+ }, OBJECT_PROTOTYPE, true);
5769
5761
 
5770
5762
  class ArrayExpression extends NodeBase {
5771
5763
  constructor() {
@@ -5800,10 +5792,14 @@ class ArrayExpression extends NodeBase {
5800
5792
  const properties = [
5801
5793
  { key: 'length', kind: 'init', property: UNKNOWN_LITERAL_NUMBER }
5802
5794
  ];
5795
+ let hasSpread = false;
5803
5796
  for (let index = 0; index < this.elements.length; index++) {
5804
5797
  const element = this.elements[index];
5805
- if (element instanceof SpreadElement) {
5806
- properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
5798
+ if (element instanceof SpreadElement || hasSpread) {
5799
+ if (element) {
5800
+ hasSpread = true;
5801
+ properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
5802
+ }
5807
5803
  }
5808
5804
  else if (!element) {
5809
5805
  properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.0
4
- Wed, 16 Jun 2021 05:23:55 GMT - commit c4f9d13bd284a6b483b1a087917ed3f0bc93cd18
3
+ Rollup.js v2.52.1
4
+ Thu, 17 Jun 2021 05:22:05 GMT - commit bef5fe8a573648f73c258ce9adf1a7ff3ffb129d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.0
4
- Wed, 16 Jun 2021 05:23:55 GMT - commit c4f9d13bd284a6b483b1a087917ed3f0bc93cd18
3
+ Rollup.js v2.52.1
4
+ Thu, 17 Jun 2021 05:22:05 GMT - commit bef5fe8a573648f73c258ce9adf1a7ff3ffb129d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup