rollup 3.10.0 → 3.10.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/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v3.10.0
6
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
5
+ Rollup.js v3.10.1
6
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -16,7 +16,7 @@ import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/pr
16
16
  import { EventEmitter } from 'node:events';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version$1 = "3.10.0";
19
+ var version$1 = "3.10.1";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -9039,7 +9039,7 @@ class MemberExpression extends NodeBase {
9039
9039
  this.bound = true;
9040
9040
  const path = getPathIfNotComputed(this);
9041
9041
  const baseVariable = path && this.scope.findVariable(path[0].key);
9042
- if (baseVariable && baseVariable.isNamespace) {
9042
+ if (baseVariable?.isNamespace) {
9043
9043
  const resolvedVariable = resolveNamespaceVariables(baseVariable, path.slice(1), this.context);
9044
9044
  if (!resolvedVariable) {
9045
9045
  super.bind();
@@ -9174,6 +9174,13 @@ class MemberExpression extends NodeBase {
9174
9174
  this.propertyKey = getResolvablePropertyKey(this);
9175
9175
  this.accessInteraction = { thisArg: this.object, type: INTERACTION_ACCESSED };
9176
9176
  }
9177
+ isSkippedAsOptional(origin) {
9178
+ return (!this.variable &&
9179
+ !this.isUndefined &&
9180
+ (this.object.isSkippedAsOptional?.(origin) ||
9181
+ (this.optional &&
9182
+ this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null)));
9183
+ }
9177
9184
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
9178
9185
  if (this.variable || this.isUndefined) {
9179
9186
  const { snippets: { getPropertyAccess } } = options;
@@ -9278,9 +9285,12 @@ function resolveNamespaceVariables(baseVariable, path, astContext) {
9278
9285
  const exportName = path[0].key;
9279
9286
  const variable = baseVariable.context.traceExport(exportName);
9280
9287
  if (!variable) {
9281
- const fileName = baseVariable.context.fileName;
9282
- astContext.warn(errorMissingExport(exportName, astContext.module.id, fileName), path[0].pos);
9283
- return 'undefined';
9288
+ if (path.length === 1) {
9289
+ const fileName = baseVariable.context.fileName;
9290
+ astContext.warn(errorMissingExport(exportName, astContext.module.id, fileName), path[0].pos);
9291
+ return 'undefined';
9292
+ }
9293
+ return null;
9284
9294
  }
9285
9295
  return resolveNamespaceVariables(variable, path.slice(1), astContext);
9286
9296
  }
@@ -9422,6 +9432,11 @@ class CallExpression extends CallExpressionBase {
9422
9432
  }
9423
9433
  this.callee.includeCallArguments(context, this.arguments);
9424
9434
  }
9435
+ isSkippedAsOptional(origin) {
9436
+ return (this.callee.isSkippedAsOptional?.(origin) ||
9437
+ (this.optional &&
9438
+ this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null));
9439
+ }
9425
9440
  render(code, options, { renderedSurroundingElement } = BLANK) {
9426
9441
  this.callee.render(code, options, {
9427
9442
  isCalleeOfRenderedParent: true,
@@ -9481,34 +9496,19 @@ class CatchClause extends NodeBase {
9481
9496
  }
9482
9497
  }
9483
9498
 
9484
- const unset$1 = Symbol('unset');
9485
9499
  class ChainExpression extends NodeBase {
9486
- constructor() {
9487
- super(...arguments);
9488
- this.objectValue = unset$1;
9489
- }
9490
- deoptimizeCache() {
9491
- this.objectValue = UnknownValue;
9492
- }
9493
- getLiteralValueAtPath() {
9494
- if (this.getObjectValue() == null)
9500
+ // deoptimizations are not relevant as we are not caching values
9501
+ deoptimizeCache() { }
9502
+ getLiteralValueAtPath(path, recursionTracker, origin) {
9503
+ if (this.expression.isSkippedAsOptional(origin))
9495
9504
  return undefined;
9496
- return UnknownValue;
9505
+ return this.expression.getLiteralValueAtPath(path, recursionTracker, origin);
9497
9506
  }
9498
9507
  hasEffects(context) {
9499
- if (this.getObjectValue() == null)
9508
+ if (this.expression.isSkippedAsOptional(this))
9500
9509
  return false;
9501
9510
  return this.expression.hasEffects(context);
9502
9511
  }
9503
- getObjectValue() {
9504
- if (this.objectValue === unset$1) {
9505
- let object = this.expression.type === 'CallExpression' ? this.expression.callee : this.expression.object;
9506
- if (object.type === 'MemberExpression')
9507
- object = object.object;
9508
- this.objectValue = object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
9509
- }
9510
- return this.objectValue;
9511
- }
9512
9512
  }
9513
9513
 
9514
9514
  class ClassBodyScope extends ChildScope {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
31
31
 
32
32
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
33
33
 
34
- var version$1 = "3.10.0";
34
+ var version$1 = "3.10.1";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -9555,7 +9555,7 @@ class MemberExpression extends NodeBase {
9555
9555
  this.bound = true;
9556
9556
  const path = getPathIfNotComputed(this);
9557
9557
  const baseVariable = path && this.scope.findVariable(path[0].key);
9558
- if (baseVariable && baseVariable.isNamespace) {
9558
+ if (baseVariable?.isNamespace) {
9559
9559
  const resolvedVariable = resolveNamespaceVariables(baseVariable, path.slice(1), this.context);
9560
9560
  if (!resolvedVariable) {
9561
9561
  super.bind();
@@ -9690,6 +9690,13 @@ class MemberExpression extends NodeBase {
9690
9690
  this.propertyKey = getResolvablePropertyKey(this);
9691
9691
  this.accessInteraction = { thisArg: this.object, type: INTERACTION_ACCESSED };
9692
9692
  }
9693
+ isSkippedAsOptional(origin) {
9694
+ return (!this.variable &&
9695
+ !this.isUndefined &&
9696
+ (this.object.isSkippedAsOptional?.(origin) ||
9697
+ (this.optional &&
9698
+ this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null)));
9699
+ }
9693
9700
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
9694
9701
  if (this.variable || this.isUndefined) {
9695
9702
  const { snippets: { getPropertyAccess } } = options;
@@ -9794,9 +9801,12 @@ function resolveNamespaceVariables(baseVariable, path, astContext) {
9794
9801
  const exportName = path[0].key;
9795
9802
  const variable = baseVariable.context.traceExport(exportName);
9796
9803
  if (!variable) {
9797
- const fileName = baseVariable.context.fileName;
9798
- astContext.warn(errorMissingExport(exportName, astContext.module.id, fileName), path[0].pos);
9799
- return 'undefined';
9804
+ if (path.length === 1) {
9805
+ const fileName = baseVariable.context.fileName;
9806
+ astContext.warn(errorMissingExport(exportName, astContext.module.id, fileName), path[0].pos);
9807
+ return 'undefined';
9808
+ }
9809
+ return null;
9800
9810
  }
9801
9811
  return resolveNamespaceVariables(variable, path.slice(1), astContext);
9802
9812
  }
@@ -9938,6 +9948,11 @@ class CallExpression extends CallExpressionBase {
9938
9948
  }
9939
9949
  this.callee.includeCallArguments(context, this.arguments);
9940
9950
  }
9951
+ isSkippedAsOptional(origin) {
9952
+ return (this.callee.isSkippedAsOptional?.(origin) ||
9953
+ (this.optional &&
9954
+ this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null));
9955
+ }
9941
9956
  render(code, options, { renderedSurroundingElement } = BLANK) {
9942
9957
  this.callee.render(code, options, {
9943
9958
  isCalleeOfRenderedParent: true,
@@ -9997,34 +10012,19 @@ class CatchClause extends NodeBase {
9997
10012
  }
9998
10013
  }
9999
10014
 
10000
- const unset$1 = Symbol('unset');
10001
10015
  class ChainExpression extends NodeBase {
10002
- constructor() {
10003
- super(...arguments);
10004
- this.objectValue = unset$1;
10005
- }
10006
- deoptimizeCache() {
10007
- this.objectValue = UnknownValue;
10008
- }
10009
- getLiteralValueAtPath() {
10010
- if (this.getObjectValue() == null)
10016
+ // deoptimizations are not relevant as we are not caching values
10017
+ deoptimizeCache() { }
10018
+ getLiteralValueAtPath(path, recursionTracker, origin) {
10019
+ if (this.expression.isSkippedAsOptional(origin))
10011
10020
  return undefined;
10012
- return UnknownValue;
10021
+ return this.expression.getLiteralValueAtPath(path, recursionTracker, origin);
10013
10022
  }
10014
10023
  hasEffects(context) {
10015
- if (this.getObjectValue() == null)
10024
+ if (this.expression.isSkippedAsOptional(this))
10016
10025
  return false;
10017
10026
  return this.expression.hasEffects(context);
10018
10027
  }
10019
- getObjectValue() {
10020
- if (this.objectValue === unset$1) {
10021
- let object = this.expression.type === 'CallExpression' ? this.expression.callee : this.expression.object;
10022
- if (object.type === 'MemberExpression')
10023
- object = object.object;
10024
- this.objectValue = object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
10025
- }
10026
- return this.objectValue;
10027
- }
10028
10028
  }
10029
10029
 
10030
10030
  class ClassBodyScope extends ChildScope {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
3
+ Rollup.js v3.10.1
4
+ Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",