rollup 4.19.0 → 4.19.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/bin/rollup CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
3
  @license
4
- Rollup.js v4.19.0
5
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
4
+ Rollup.js v4.19.2
5
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
6
6
 
7
7
  https://github.com/rollup/rollup
8
8
 
@@ -1307,6 +1307,9 @@ function prettyMilliseconds(milliseconds, options) {
1307
1307
 
1308
1308
  options = {...options};
1309
1309
 
1310
+ const sign = milliseconds < 0 ? '-' : '';
1311
+ milliseconds = milliseconds < 0 ? -milliseconds : milliseconds; // Cannot use `Math.abs()` because of BigInt support.
1312
+
1310
1313
  if (options.colonNotation) {
1311
1314
  options.compact = false;
1312
1315
  options.formatSubMilliseconds = false;
@@ -1336,7 +1339,7 @@ function prettyMilliseconds(milliseconds, options) {
1336
1339
  return;
1337
1340
  }
1338
1341
 
1339
- valueString = valueString ?? String(value);
1342
+ valueString ??= String(value);
1340
1343
  if (options.colonNotation) {
1341
1344
  const wholeDigits = valueString.includes('.') ? valueString.split('.')[0].length : valueString.length;
1342
1345
  const minLength = result.length > 0 ? 2 : 1;
@@ -1415,7 +1418,7 @@ function prettyMilliseconds(milliseconds, options) {
1415
1418
  }
1416
1419
 
1417
1420
  if (result.length === 0) {
1418
- return '0' + (options.verbose ? ' milliseconds' : 'ms');
1421
+ return sign + '0' + (options.verbose ? ' milliseconds' : 'ms');
1419
1422
  }
1420
1423
 
1421
1424
  const separator = options.colonNotation ? ':' : ' ';
@@ -1423,7 +1426,7 @@ function prettyMilliseconds(milliseconds, options) {
1423
1426
  result = result.slice(0, Math.max(options.unitCount, 1));
1424
1427
  }
1425
1428
 
1426
- return result.join(separator);
1429
+ return sign + result.join(separator);
1427
1430
  }
1428
1431
 
1429
1432
  const BYTE_UNITS = [
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -16,7 +16,7 @@ import { performance } from 'node:perf_hooks';
16
16
  import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version = "4.19.0";
19
+ var version = "4.19.2";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -4763,6 +4763,7 @@ const childNodeKeys = {
4763
4763
  };
4764
4764
 
4765
4765
  const INCLUDE_PARAMETERS = 'variables';
4766
+ const IS_SKIPPED_CHAIN = Symbol('IS_SKIPPED_CHAIN');
4766
4767
  class NodeBase extends ExpressionEntity {
4767
4768
  /**
4768
4769
  * Nodes can apply custom deoptimizations once they become part of the
@@ -7668,6 +7669,20 @@ function findNonWhiteSpace(code, index) {
7668
7669
  const result = NON_WHITESPACE.exec(code);
7669
7670
  return result.index;
7670
7671
  }
7672
+ const WHITESPACE = /\s/;
7673
+ function findLastWhiteSpaceReverse(code, start, end) {
7674
+ while (true) {
7675
+ if (start >= end) {
7676
+ return end;
7677
+ }
7678
+ if (WHITESPACE.test(code[end - 1])) {
7679
+ end--;
7680
+ }
7681
+ else {
7682
+ return end;
7683
+ }
7684
+ }
7685
+ }
7671
7686
  // This assumes "code" only contains white-space and comments
7672
7687
  // Returns position of line-comment if applicable
7673
7688
  function findFirstLineBreakOutsideComment(code) {
@@ -8718,6 +8733,20 @@ class Literal extends NodeBase {
8718
8733
  }
8719
8734
  }
8720
8735
 
8736
+ function getChainElementLiteralValueAtPath(element, object, path, recursionTracker, origin) {
8737
+ if ('getLiteralValueAtPathAsChainElement' in object) {
8738
+ const calleeValue = object.getLiteralValueAtPathAsChainElement(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin);
8739
+ if (calleeValue === IS_SKIPPED_CHAIN || (element.optional && calleeValue == null)) {
8740
+ return IS_SKIPPED_CHAIN;
8741
+ }
8742
+ }
8743
+ else if (element.optional &&
8744
+ object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null) {
8745
+ return IS_SKIPPED_CHAIN;
8746
+ }
8747
+ return element.getLiteralValueAtPath(path, recursionTracker, origin);
8748
+ }
8749
+
8721
8750
  // To avoid infinite recursions
8722
8751
  const MAX_PATH_DEPTH = 7;
8723
8752
  function getResolvablePropertyKey(memberExpression) {
@@ -8861,6 +8890,15 @@ class MemberExpression extends NodeBase {
8861
8890
  }
8862
8891
  return UnknownValue;
8863
8892
  }
8893
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
8894
+ if (this.variable) {
8895
+ return this.variable.getLiteralValueAtPath(path, recursionTracker, origin);
8896
+ }
8897
+ if (this.isUndefined) {
8898
+ return undefined;
8899
+ }
8900
+ return getChainElementLiteralValueAtPath(this, this.object, path, recursionTracker, origin);
8901
+ }
8864
8902
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
8865
8903
  if (this.variable) {
8866
8904
  return this.variable.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin);
@@ -8881,6 +8919,23 @@ class MemberExpression extends NodeBase {
8881
8919
  this.object.hasEffects(context) ||
8882
8920
  this.hasAccessEffect(context));
8883
8921
  }
8922
+ hasEffectsAsChainElement(context) {
8923
+ if (this.variable || this.isUndefined)
8924
+ return this.hasEffects(context);
8925
+ const objectHasEffects = 'hasEffectsAsChainElement' in this.object
8926
+ ? this.object.hasEffectsAsChainElement(context)
8927
+ : this.object.hasEffects(context);
8928
+ if (objectHasEffects === IS_SKIPPED_CHAIN)
8929
+ return IS_SKIPPED_CHAIN;
8930
+ if (this.optional &&
8931
+ this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
8932
+ return objectHasEffects || IS_SKIPPED_CHAIN;
8933
+ }
8934
+ // We only apply deoptimizations lazily once we know we are not skipping
8935
+ if (!this.deoptimized)
8936
+ this.applyDeoptimizations();
8937
+ return this.property.hasEffects(context) || this.hasAccessEffect(context);
8938
+ }
8884
8939
  hasEffectsAsAssignmentTarget(context, checkAccess) {
8885
8940
  if (checkAccess && !this.deoptimized)
8886
8941
  this.applyDeoptimizations();
@@ -8931,13 +8986,6 @@ class MemberExpression extends NodeBase {
8931
8986
  this.propertyKey = getResolvablePropertyKey(this);
8932
8987
  this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED };
8933
8988
  }
8934
- isSkippedAsOptional(origin) {
8935
- return (!this.variable &&
8936
- !this.isUndefined &&
8937
- (this.object.isSkippedAsOptional?.(origin) ||
8938
- (this.optional &&
8939
- this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null)));
8940
- }
8941
8989
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
8942
8990
  if (this.variable || this.isUndefined) {
8943
8991
  const { snippets: { getPropertyAccess } } = options;
@@ -9177,6 +9225,9 @@ class CallExpression extends CallExpressionBase {
9177
9225
  withNew: false
9178
9226
  };
9179
9227
  }
9228
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
9229
+ return getChainElementLiteralValueAtPath(this, this.callee, path, recursionTracker, origin);
9230
+ }
9180
9231
  hasEffects(context) {
9181
9232
  if (!this.deoptimized)
9182
9233
  this.applyDeoptimizations();
@@ -9190,6 +9241,26 @@ class CallExpression extends CallExpressionBase {
9190
9241
  return (this.callee.hasEffects(context) ||
9191
9242
  this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
9192
9243
  }
9244
+ hasEffectsAsChainElement(context) {
9245
+ const calleeHasEffects = 'hasEffectsAsChainElement' in this.callee
9246
+ ? this.callee.hasEffectsAsChainElement(context)
9247
+ : this.callee.hasEffects(context);
9248
+ if (calleeHasEffects === IS_SKIPPED_CHAIN)
9249
+ return IS_SKIPPED_CHAIN;
9250
+ if (this.optional &&
9251
+ this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
9252
+ return (!this.annotationPure && calleeHasEffects) || IS_SKIPPED_CHAIN;
9253
+ }
9254
+ // We only apply deoptimizations lazily once we know we are not skipping
9255
+ if (!this.deoptimized)
9256
+ this.applyDeoptimizations();
9257
+ for (const argument of this.arguments) {
9258
+ if (argument.hasEffects(context))
9259
+ return true;
9260
+ }
9261
+ return (!this.annotationPure &&
9262
+ this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
9263
+ }
9193
9264
  include(context, includeChildrenRecursively) {
9194
9265
  if (!this.deoptimized)
9195
9266
  this.applyDeoptimizations();
@@ -9214,11 +9285,6 @@ class CallExpression extends CallExpressionBase {
9214
9285
  this.annotationPure = this.annotations.some(comment => comment.type === 'pure');
9215
9286
  }
9216
9287
  }
9217
- isSkippedAsOptional(origin) {
9218
- return (this.callee.isSkippedAsOptional?.(origin) ||
9219
- (this.optional &&
9220
- this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null));
9221
- }
9222
9288
  render(code, options, { renderedSurroundingElement } = BLANK) {
9223
9289
  this.callee.render(code, options, {
9224
9290
  isCalleeOfRenderedParent: true,
@@ -9261,18 +9327,16 @@ class ChainExpression extends NodeBase {
9261
9327
  // deoptimizations are not relevant as we are not caching values
9262
9328
  deoptimizeCache() { }
9263
9329
  getLiteralValueAtPath(path, recursionTracker, origin) {
9264
- if (this.expression.isSkippedAsOptional(origin))
9265
- return undefined;
9266
- return this.expression.getLiteralValueAtPath(path, recursionTracker, origin);
9330
+ const literalValue = this.expression.getLiteralValueAtPathAsChainElement(path, recursionTracker, origin);
9331
+ return literalValue === IS_SKIPPED_CHAIN ? undefined : literalValue;
9267
9332
  }
9268
9333
  hasEffects(context) {
9269
- if (this.expression.isSkippedAsOptional(this))
9270
- return false;
9271
- return this.expression.hasEffects(context);
9334
+ return this.expression.hasEffectsAsChainElement(context) === true;
9272
9335
  }
9273
9336
  removeAnnotations(code) {
9274
9337
  this.expression.removeAnnotations(code);
9275
9338
  }
9339
+ applyDeoptimizations() { }
9276
9340
  }
9277
9341
 
9278
9342
  class ClassBodyScope extends ChildScope {
@@ -11091,8 +11155,8 @@ class LogicalExpression extends NodeBase {
11091
11155
  }
11092
11156
  render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
11093
11157
  if (!this.left.included || !this.right.included) {
11158
+ const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
11094
11159
  if (this.right.included) {
11095
- const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
11096
11160
  const removePos = findNonWhiteSpace(code.original, operatorPos + 2);
11097
11161
  code.remove(this.start, removePos);
11098
11162
  if (preventASI) {
@@ -11101,7 +11165,7 @@ class LogicalExpression extends NodeBase {
11101
11165
  this.left.removeAnnotations(code);
11102
11166
  }
11103
11167
  else {
11104
- code.remove(this.left.end, this.end);
11168
+ code.remove(findLastWhiteSpaceReverse(code.original, this.left.end, operatorPos), this.end);
11105
11169
  }
11106
11170
  this.getUsedBranch().render(code, options, {
11107
11171
  isCalleeOfRenderedParent,
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/parseAst.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
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 v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
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 = "4.19.0";
34
+ var version = "4.19.2";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -6219,6 +6219,7 @@ const childNodeKeys = {
6219
6219
  };
6220
6220
 
6221
6221
  const INCLUDE_PARAMETERS = 'variables';
6222
+ const IS_SKIPPED_CHAIN = Symbol('IS_SKIPPED_CHAIN');
6222
6223
  class NodeBase extends ExpressionEntity {
6223
6224
  /**
6224
6225
  * Nodes can apply custom deoptimizations once they become part of the
@@ -9110,6 +9111,20 @@ function findNonWhiteSpace(code, index) {
9110
9111
  const result = NON_WHITESPACE.exec(code);
9111
9112
  return result.index;
9112
9113
  }
9114
+ const WHITESPACE = /\s/;
9115
+ function findLastWhiteSpaceReverse(code, start, end) {
9116
+ while (true) {
9117
+ if (start >= end) {
9118
+ return end;
9119
+ }
9120
+ if (WHITESPACE.test(code[end - 1])) {
9121
+ end--;
9122
+ }
9123
+ else {
9124
+ return end;
9125
+ }
9126
+ }
9127
+ }
9113
9128
  // This assumes "code" only contains white-space and comments
9114
9129
  // Returns position of line-comment if applicable
9115
9130
  function findFirstLineBreakOutsideComment(code) {
@@ -10160,6 +10175,20 @@ class Literal extends NodeBase {
10160
10175
  }
10161
10176
  }
10162
10177
 
10178
+ function getChainElementLiteralValueAtPath(element, object, path, recursionTracker, origin) {
10179
+ if ('getLiteralValueAtPathAsChainElement' in object) {
10180
+ const calleeValue = object.getLiteralValueAtPathAsChainElement(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin);
10181
+ if (calleeValue === IS_SKIPPED_CHAIN || (element.optional && calleeValue == null)) {
10182
+ return IS_SKIPPED_CHAIN;
10183
+ }
10184
+ }
10185
+ else if (element.optional &&
10186
+ object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null) {
10187
+ return IS_SKIPPED_CHAIN;
10188
+ }
10189
+ return element.getLiteralValueAtPath(path, recursionTracker, origin);
10190
+ }
10191
+
10163
10192
  // To avoid infinite recursions
10164
10193
  const MAX_PATH_DEPTH = 7;
10165
10194
  function getResolvablePropertyKey(memberExpression) {
@@ -10303,6 +10332,15 @@ class MemberExpression extends NodeBase {
10303
10332
  }
10304
10333
  return UnknownValue;
10305
10334
  }
10335
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
10336
+ if (this.variable) {
10337
+ return this.variable.getLiteralValueAtPath(path, recursionTracker, origin);
10338
+ }
10339
+ if (this.isUndefined) {
10340
+ return undefined;
10341
+ }
10342
+ return getChainElementLiteralValueAtPath(this, this.object, path, recursionTracker, origin);
10343
+ }
10306
10344
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
10307
10345
  if (this.variable) {
10308
10346
  return this.variable.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin);
@@ -10323,6 +10361,23 @@ class MemberExpression extends NodeBase {
10323
10361
  this.object.hasEffects(context) ||
10324
10362
  this.hasAccessEffect(context));
10325
10363
  }
10364
+ hasEffectsAsChainElement(context) {
10365
+ if (this.variable || this.isUndefined)
10366
+ return this.hasEffects(context);
10367
+ const objectHasEffects = 'hasEffectsAsChainElement' in this.object
10368
+ ? this.object.hasEffectsAsChainElement(context)
10369
+ : this.object.hasEffects(context);
10370
+ if (objectHasEffects === IS_SKIPPED_CHAIN)
10371
+ return IS_SKIPPED_CHAIN;
10372
+ if (this.optional &&
10373
+ this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
10374
+ return objectHasEffects || IS_SKIPPED_CHAIN;
10375
+ }
10376
+ // We only apply deoptimizations lazily once we know we are not skipping
10377
+ if (!this.deoptimized)
10378
+ this.applyDeoptimizations();
10379
+ return this.property.hasEffects(context) || this.hasAccessEffect(context);
10380
+ }
10326
10381
  hasEffectsAsAssignmentTarget(context, checkAccess) {
10327
10382
  if (checkAccess && !this.deoptimized)
10328
10383
  this.applyDeoptimizations();
@@ -10373,13 +10428,6 @@ class MemberExpression extends NodeBase {
10373
10428
  this.propertyKey = getResolvablePropertyKey(this);
10374
10429
  this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED };
10375
10430
  }
10376
- isSkippedAsOptional(origin) {
10377
- return (!this.variable &&
10378
- !this.isUndefined &&
10379
- (this.object.isSkippedAsOptional?.(origin) ||
10380
- (this.optional &&
10381
- this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null)));
10382
- }
10383
10431
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = parseAst_js.BLANK) {
10384
10432
  if (this.variable || this.isUndefined) {
10385
10433
  const { snippets: { getPropertyAccess } } = options;
@@ -10619,6 +10667,9 @@ class CallExpression extends CallExpressionBase {
10619
10667
  withNew: false
10620
10668
  };
10621
10669
  }
10670
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
10671
+ return getChainElementLiteralValueAtPath(this, this.callee, path, recursionTracker, origin);
10672
+ }
10622
10673
  hasEffects(context) {
10623
10674
  if (!this.deoptimized)
10624
10675
  this.applyDeoptimizations();
@@ -10632,6 +10683,26 @@ class CallExpression extends CallExpressionBase {
10632
10683
  return (this.callee.hasEffects(context) ||
10633
10684
  this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
10634
10685
  }
10686
+ hasEffectsAsChainElement(context) {
10687
+ const calleeHasEffects = 'hasEffectsAsChainElement' in this.callee
10688
+ ? this.callee.hasEffectsAsChainElement(context)
10689
+ : this.callee.hasEffects(context);
10690
+ if (calleeHasEffects === IS_SKIPPED_CHAIN)
10691
+ return IS_SKIPPED_CHAIN;
10692
+ if (this.optional &&
10693
+ this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
10694
+ return (!this.annotationPure && calleeHasEffects) || IS_SKIPPED_CHAIN;
10695
+ }
10696
+ // We only apply deoptimizations lazily once we know we are not skipping
10697
+ if (!this.deoptimized)
10698
+ this.applyDeoptimizations();
10699
+ for (const argument of this.arguments) {
10700
+ if (argument.hasEffects(context))
10701
+ return true;
10702
+ }
10703
+ return (!this.annotationPure &&
10704
+ this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
10705
+ }
10635
10706
  include(context, includeChildrenRecursively) {
10636
10707
  if (!this.deoptimized)
10637
10708
  this.applyDeoptimizations();
@@ -10656,11 +10727,6 @@ class CallExpression extends CallExpressionBase {
10656
10727
  this.annotationPure = this.annotations.some(comment => comment.type === 'pure');
10657
10728
  }
10658
10729
  }
10659
- isSkippedAsOptional(origin) {
10660
- return (this.callee.isSkippedAsOptional?.(origin) ||
10661
- (this.optional &&
10662
- this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null));
10663
- }
10664
10730
  render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
10665
10731
  this.callee.render(code, options, {
10666
10732
  isCalleeOfRenderedParent: true,
@@ -10703,18 +10769,16 @@ class ChainExpression extends NodeBase {
10703
10769
  // deoptimizations are not relevant as we are not caching values
10704
10770
  deoptimizeCache() { }
10705
10771
  getLiteralValueAtPath(path, recursionTracker, origin) {
10706
- if (this.expression.isSkippedAsOptional(origin))
10707
- return undefined;
10708
- return this.expression.getLiteralValueAtPath(path, recursionTracker, origin);
10772
+ const literalValue = this.expression.getLiteralValueAtPathAsChainElement(path, recursionTracker, origin);
10773
+ return literalValue === IS_SKIPPED_CHAIN ? undefined : literalValue;
10709
10774
  }
10710
10775
  hasEffects(context) {
10711
- if (this.expression.isSkippedAsOptional(this))
10712
- return false;
10713
- return this.expression.hasEffects(context);
10776
+ return this.expression.hasEffectsAsChainElement(context) === true;
10714
10777
  }
10715
10778
  removeAnnotations(code) {
10716
10779
  this.expression.removeAnnotations(code);
10717
10780
  }
10781
+ applyDeoptimizations() { }
10718
10782
  }
10719
10783
 
10720
10784
  class ClassBodyScope extends ChildScope {
@@ -12533,8 +12597,8 @@ class LogicalExpression extends NodeBase {
12533
12597
  }
12534
12598
  render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = parseAst_js.BLANK) {
12535
12599
  if (!this.left.included || !this.right.included) {
12600
+ const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
12536
12601
  if (this.right.included) {
12537
- const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
12538
12602
  const removePos = findNonWhiteSpace(code.original, operatorPos + 2);
12539
12603
  code.remove(this.start, removePos);
12540
12604
  if (preventASI) {
@@ -12543,7 +12607,7 @@ class LogicalExpression extends NodeBase {
12543
12607
  this.left.removeAnnotations(code);
12544
12608
  }
12545
12609
  else {
12546
- code.remove(this.left.end, this.end);
12610
+ code.remove(findLastWhiteSpaceReverse(code.original, this.left.end, operatorPos), this.end);
12547
12611
  }
12548
12612
  this.getUsedBranch().render(code, options, {
12549
12613
  isCalleeOfRenderedParent,
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.19.0
4
- Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
3
+ Rollup.js v4.19.2
4
+ Thu, 01 Aug 2024 08:32:23 GMT - commit 39955e55dbc12ec379a21efcf8fc21e55ec6ce3a
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": "4.19.0",
3
+ "version": "4.19.2",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -107,22 +107,22 @@
107
107
  "homepage": "https://rollupjs.org/",
108
108
  "optionalDependencies": {
109
109
  "fsevents": "~2.3.2",
110
- "@rollup/rollup-darwin-arm64": "4.19.0",
111
- "@rollup/rollup-android-arm64": "4.19.0",
112
- "@rollup/rollup-win32-arm64-msvc": "4.19.0",
113
- "@rollup/rollup-linux-arm64-gnu": "4.19.0",
114
- "@rollup/rollup-linux-arm64-musl": "4.19.0",
115
- "@rollup/rollup-android-arm-eabi": "4.19.0",
116
- "@rollup/rollup-linux-arm-gnueabihf": "4.19.0",
117
- "@rollup/rollup-linux-arm-musleabihf": "4.19.0",
118
- "@rollup/rollup-win32-ia32-msvc": "4.19.0",
119
- "@rollup/rollup-linux-riscv64-gnu": "4.19.0",
120
- "@rollup/rollup-linux-powerpc64le-gnu": "4.19.0",
121
- "@rollup/rollup-linux-s390x-gnu": "4.19.0",
122
- "@rollup/rollup-darwin-x64": "4.19.0",
123
- "@rollup/rollup-win32-x64-msvc": "4.19.0",
124
- "@rollup/rollup-linux-x64-gnu": "4.19.0",
125
- "@rollup/rollup-linux-x64-musl": "4.19.0"
110
+ "@rollup/rollup-darwin-arm64": "4.19.2",
111
+ "@rollup/rollup-android-arm64": "4.19.2",
112
+ "@rollup/rollup-win32-arm64-msvc": "4.19.2",
113
+ "@rollup/rollup-linux-arm64-gnu": "4.19.2",
114
+ "@rollup/rollup-linux-arm64-musl": "4.19.2",
115
+ "@rollup/rollup-android-arm-eabi": "4.19.2",
116
+ "@rollup/rollup-linux-arm-gnueabihf": "4.19.2",
117
+ "@rollup/rollup-linux-arm-musleabihf": "4.19.2",
118
+ "@rollup/rollup-win32-ia32-msvc": "4.19.2",
119
+ "@rollup/rollup-linux-riscv64-gnu": "4.19.2",
120
+ "@rollup/rollup-linux-powerpc64le-gnu": "4.19.2",
121
+ "@rollup/rollup-linux-s390x-gnu": "4.19.2",
122
+ "@rollup/rollup-darwin-x64": "4.19.2",
123
+ "@rollup/rollup-win32-x64-msvc": "4.19.2",
124
+ "@rollup/rollup-linux-x64-gnu": "4.19.2",
125
+ "@rollup/rollup-linux-x64-musl": "4.19.2"
126
126
  },
127
127
  "dependencies": {
128
128
  "@types/estree": "1.0.5"
@@ -137,7 +137,7 @@
137
137
  "@codemirror/language": "^6.10.2",
138
138
  "@codemirror/search": "^6.5.6",
139
139
  "@codemirror/state": "^6.4.1",
140
- "@codemirror/view": "^6.28.4",
140
+ "@codemirror/view": "^6.28.6",
141
141
  "@jridgewell/sourcemap-codec": "^1.5.0",
142
142
  "@mermaid-js/mermaid-cli": "^10.9.1",
143
143
  "@napi-rs/cli": "^2.18.4",
@@ -150,15 +150,15 @@
150
150
  "@rollup/plugin-terser": "^0.4.4",
151
151
  "@rollup/plugin-typescript": "^11.1.6",
152
152
  "@rollup/pluginutils": "^5.1.0",
153
- "@shikijs/vitepress-twoslash": "^1.10.3",
154
- "@types/eslint": "^8.56.10",
153
+ "@shikijs/vitepress-twoslash": "^1.11.0",
154
+ "@types/eslint": "^8.56.11",
155
155
  "@types/inquirer": "^9.0.7",
156
156
  "@types/mocha": "^10.0.7",
157
157
  "@types/node": "~18.18.14",
158
158
  "@types/semver": "^7.5.8",
159
159
  "@types/yargs-parser": "^21.0.3",
160
- "@typescript-eslint/eslint-plugin": "^7.16.1",
161
- "@typescript-eslint/parser": "^7.16.1",
160
+ "@typescript-eslint/eslint-plugin": "^7.17.0",
161
+ "@typescript-eslint/parser": "^7.17.0",
162
162
  "@vue/eslint-config-prettier": "^9.0.0",
163
163
  "@vue/eslint-config-typescript": "^13.0.0",
164
164
  "acorn": "^8.12.1",
@@ -176,20 +176,20 @@
176
176
  "eslint": "^8.57.0",
177
177
  "eslint-config-prettier": "^9.1.0",
178
178
  "eslint-plugin-import": "^2.29.1",
179
- "eslint-plugin-prettier": "^5.1.3",
179
+ "eslint-plugin-prettier": "^5.2.1",
180
180
  "eslint-plugin-unicorn": "^54.0.0",
181
181
  "eslint-plugin-vue": "^9.27.0",
182
182
  "fixturify": "^3.0.0",
183
183
  "flru": "^1.0.2",
184
184
  "fs-extra": "^11.2.0",
185
185
  "github-api": "^3.4.0",
186
- "husky": "^9.0.11",
187
- "inquirer": "^10.0.1",
186
+ "husky": "^9.1.1",
187
+ "inquirer": "^10.1.2",
188
188
  "is-reference": "^3.0.2",
189
189
  "lint-staged": "^15.2.7",
190
190
  "locate-character": "^3.0.0",
191
191
  "magic-string": "^0.30.10",
192
- "mocha": "^10.6.0",
192
+ "mocha": "^10.7.0",
193
193
  "nodemon": "^3.1.4",
194
194
  "npm-audit-resolver": "^3.0.0-RC.0",
195
195
  "nyc": "^17.0.0",
@@ -197,28 +197,28 @@
197
197
  "prettier": "^3.3.3",
198
198
  "pretty-bytes": "^6.1.1",
199
199
  "pretty-ms": "^9.0.0",
200
- "requirejs": "^2.3.6",
201
- "rollup": "^4.18.1",
200
+ "requirejs": "^2.3.7",
201
+ "rollup": "^4.19.0",
202
202
  "rollup-plugin-license": "^3.5.2",
203
203
  "rollup-plugin-string": "^3.0.0",
204
- "semver": "^7.6.2",
204
+ "semver": "^7.6.3",
205
205
  "shx": "^0.3.4",
206
206
  "signal-exit": "^4.1.0",
207
207
  "source-map": "^0.7.4",
208
208
  "source-map-support": "^0.5.21",
209
209
  "systemjs": "^6.15.1",
210
- "terser": "^5.31.2",
210
+ "terser": "^5.31.3",
211
211
  "tslib": "^2.6.3",
212
- "typescript": "^5.5.3",
212
+ "typescript": "^5.5.4",
213
213
  "vite": "^5.3.4",
214
214
  "vitepress": "^1.3.1",
215
- "vue": "^3.4.31",
215
+ "vue": "^3.4.33",
216
216
  "wasm-pack": "^0.13.0",
217
217
  "yargs-parser": "^21.1.1"
218
218
  },
219
219
  "overrides": {
220
220
  "axios": "^1.7.2",
221
- "semver": "^7.6.2",
221
+ "semver": "^7.6.3",
222
222
  "ws": "^8.18.0"
223
223
  },
224
224
  "overrides_comments": {