rollup 4.19.0 → 4.19.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
@@ -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.1
5
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1";
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,9 @@ class MemberExpression extends NodeBase {
8861
8890
  }
8862
8891
  return UnknownValue;
8863
8892
  }
8893
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
8894
+ return getChainElementLiteralValueAtPath(this, this.object, path, recursionTracker, origin);
8895
+ }
8864
8896
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
8865
8897
  if (this.variable) {
8866
8898
  return this.variable.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin);
@@ -8881,6 +8913,23 @@ class MemberExpression extends NodeBase {
8881
8913
  this.object.hasEffects(context) ||
8882
8914
  this.hasAccessEffect(context));
8883
8915
  }
8916
+ hasEffectsAsChainElement(context) {
8917
+ if (this.variable || this.isUndefined)
8918
+ return this.hasEffects(context);
8919
+ const objectHasEffects = 'hasEffectsAsChainElement' in this.object
8920
+ ? this.object.hasEffectsAsChainElement(context)
8921
+ : this.object.hasEffects(context);
8922
+ if (objectHasEffects === IS_SKIPPED_CHAIN)
8923
+ return IS_SKIPPED_CHAIN;
8924
+ if (this.optional &&
8925
+ this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
8926
+ return objectHasEffects || IS_SKIPPED_CHAIN;
8927
+ }
8928
+ // We only apply deoptimizations lazily once we know we are not skipping
8929
+ if (!this.deoptimized)
8930
+ this.applyDeoptimizations();
8931
+ return this.property.hasEffects(context) || this.hasAccessEffect(context);
8932
+ }
8884
8933
  hasEffectsAsAssignmentTarget(context, checkAccess) {
8885
8934
  if (checkAccess && !this.deoptimized)
8886
8935
  this.applyDeoptimizations();
@@ -8931,13 +8980,6 @@ class MemberExpression extends NodeBase {
8931
8980
  this.propertyKey = getResolvablePropertyKey(this);
8932
8981
  this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED };
8933
8982
  }
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
8983
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
8942
8984
  if (this.variable || this.isUndefined) {
8943
8985
  const { snippets: { getPropertyAccess } } = options;
@@ -9177,6 +9219,9 @@ class CallExpression extends CallExpressionBase {
9177
9219
  withNew: false
9178
9220
  };
9179
9221
  }
9222
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
9223
+ return getChainElementLiteralValueAtPath(this, this.callee, path, recursionTracker, origin);
9224
+ }
9180
9225
  hasEffects(context) {
9181
9226
  if (!this.deoptimized)
9182
9227
  this.applyDeoptimizations();
@@ -9190,6 +9235,26 @@ class CallExpression extends CallExpressionBase {
9190
9235
  return (this.callee.hasEffects(context) ||
9191
9236
  this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
9192
9237
  }
9238
+ hasEffectsAsChainElement(context) {
9239
+ const calleeHasEffects = 'hasEffectsAsChainElement' in this.callee
9240
+ ? this.callee.hasEffectsAsChainElement(context)
9241
+ : this.callee.hasEffects(context);
9242
+ if (calleeHasEffects === IS_SKIPPED_CHAIN)
9243
+ return IS_SKIPPED_CHAIN;
9244
+ if (this.optional &&
9245
+ this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
9246
+ return (!this.annotationPure && calleeHasEffects) || IS_SKIPPED_CHAIN;
9247
+ }
9248
+ // We only apply deoptimizations lazily once we know we are not skipping
9249
+ if (!this.deoptimized)
9250
+ this.applyDeoptimizations();
9251
+ for (const argument of this.arguments) {
9252
+ if (argument.hasEffects(context))
9253
+ return true;
9254
+ }
9255
+ return (!this.annotationPure &&
9256
+ this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
9257
+ }
9193
9258
  include(context, includeChildrenRecursively) {
9194
9259
  if (!this.deoptimized)
9195
9260
  this.applyDeoptimizations();
@@ -9214,11 +9279,6 @@ class CallExpression extends CallExpressionBase {
9214
9279
  this.annotationPure = this.annotations.some(comment => comment.type === 'pure');
9215
9280
  }
9216
9281
  }
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
9282
  render(code, options, { renderedSurroundingElement } = BLANK) {
9223
9283
  this.callee.render(code, options, {
9224
9284
  isCalleeOfRenderedParent: true,
@@ -9261,18 +9321,16 @@ class ChainExpression extends NodeBase {
9261
9321
  // deoptimizations are not relevant as we are not caching values
9262
9322
  deoptimizeCache() { }
9263
9323
  getLiteralValueAtPath(path, recursionTracker, origin) {
9264
- if (this.expression.isSkippedAsOptional(origin))
9265
- return undefined;
9266
- return this.expression.getLiteralValueAtPath(path, recursionTracker, origin);
9324
+ const literalValue = this.expression.getLiteralValueAtPathAsChainElement(path, recursionTracker, origin);
9325
+ return literalValue === IS_SKIPPED_CHAIN ? undefined : literalValue;
9267
9326
  }
9268
9327
  hasEffects(context) {
9269
- if (this.expression.isSkippedAsOptional(this))
9270
- return false;
9271
- return this.expression.hasEffects(context);
9328
+ return this.expression.hasEffectsAsChainElement(context) === true;
9272
9329
  }
9273
9330
  removeAnnotations(code) {
9274
9331
  this.expression.removeAnnotations(code);
9275
9332
  }
9333
+ applyDeoptimizations() { }
9276
9334
  }
9277
9335
 
9278
9336
  class ClassBodyScope extends ChildScope {
@@ -11091,8 +11149,8 @@ class LogicalExpression extends NodeBase {
11091
11149
  }
11092
11150
  render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
11093
11151
  if (!this.left.included || !this.right.included) {
11152
+ const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
11094
11153
  if (this.right.included) {
11095
- const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
11096
11154
  const removePos = findNonWhiteSpace(code.original, operatorPos + 2);
11097
11155
  code.remove(this.start, removePos);
11098
11156
  if (preventASI) {
@@ -11101,7 +11159,7 @@ class LogicalExpression extends NodeBase {
11101
11159
  this.left.removeAnnotations(code);
11102
11160
  }
11103
11161
  else {
11104
- code.remove(this.left.end, this.end);
11162
+ code.remove(findLastWhiteSpaceReverse(code.original, this.left.end, operatorPos), this.end);
11105
11163
  }
11106
11164
  this.getUsedBranch().render(code, options, {
11107
11165
  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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1";
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,9 @@ class MemberExpression extends NodeBase {
10303
10332
  }
10304
10333
  return UnknownValue;
10305
10334
  }
10335
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
10336
+ return getChainElementLiteralValueAtPath(this, this.object, path, recursionTracker, origin);
10337
+ }
10306
10338
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
10307
10339
  if (this.variable) {
10308
10340
  return this.variable.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin);
@@ -10323,6 +10355,23 @@ class MemberExpression extends NodeBase {
10323
10355
  this.object.hasEffects(context) ||
10324
10356
  this.hasAccessEffect(context));
10325
10357
  }
10358
+ hasEffectsAsChainElement(context) {
10359
+ if (this.variable || this.isUndefined)
10360
+ return this.hasEffects(context);
10361
+ const objectHasEffects = 'hasEffectsAsChainElement' in this.object
10362
+ ? this.object.hasEffectsAsChainElement(context)
10363
+ : this.object.hasEffects(context);
10364
+ if (objectHasEffects === IS_SKIPPED_CHAIN)
10365
+ return IS_SKIPPED_CHAIN;
10366
+ if (this.optional &&
10367
+ this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
10368
+ return objectHasEffects || IS_SKIPPED_CHAIN;
10369
+ }
10370
+ // We only apply deoptimizations lazily once we know we are not skipping
10371
+ if (!this.deoptimized)
10372
+ this.applyDeoptimizations();
10373
+ return this.property.hasEffects(context) || this.hasAccessEffect(context);
10374
+ }
10326
10375
  hasEffectsAsAssignmentTarget(context, checkAccess) {
10327
10376
  if (checkAccess && !this.deoptimized)
10328
10377
  this.applyDeoptimizations();
@@ -10373,13 +10422,6 @@ class MemberExpression extends NodeBase {
10373
10422
  this.propertyKey = getResolvablePropertyKey(this);
10374
10423
  this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED };
10375
10424
  }
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
10425
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = parseAst_js.BLANK) {
10384
10426
  if (this.variable || this.isUndefined) {
10385
10427
  const { snippets: { getPropertyAccess } } = options;
@@ -10619,6 +10661,9 @@ class CallExpression extends CallExpressionBase {
10619
10661
  withNew: false
10620
10662
  };
10621
10663
  }
10664
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
10665
+ return getChainElementLiteralValueAtPath(this, this.callee, path, recursionTracker, origin);
10666
+ }
10622
10667
  hasEffects(context) {
10623
10668
  if (!this.deoptimized)
10624
10669
  this.applyDeoptimizations();
@@ -10632,6 +10677,26 @@ class CallExpression extends CallExpressionBase {
10632
10677
  return (this.callee.hasEffects(context) ||
10633
10678
  this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
10634
10679
  }
10680
+ hasEffectsAsChainElement(context) {
10681
+ const calleeHasEffects = 'hasEffectsAsChainElement' in this.callee
10682
+ ? this.callee.hasEffectsAsChainElement(context)
10683
+ : this.callee.hasEffects(context);
10684
+ if (calleeHasEffects === IS_SKIPPED_CHAIN)
10685
+ return IS_SKIPPED_CHAIN;
10686
+ if (this.optional &&
10687
+ this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
10688
+ return (!this.annotationPure && calleeHasEffects) || IS_SKIPPED_CHAIN;
10689
+ }
10690
+ // We only apply deoptimizations lazily once we know we are not skipping
10691
+ if (!this.deoptimized)
10692
+ this.applyDeoptimizations();
10693
+ for (const argument of this.arguments) {
10694
+ if (argument.hasEffects(context))
10695
+ return true;
10696
+ }
10697
+ return (!this.annotationPure &&
10698
+ this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
10699
+ }
10635
10700
  include(context, includeChildrenRecursively) {
10636
10701
  if (!this.deoptimized)
10637
10702
  this.applyDeoptimizations();
@@ -10656,11 +10721,6 @@ class CallExpression extends CallExpressionBase {
10656
10721
  this.annotationPure = this.annotations.some(comment => comment.type === 'pure');
10657
10722
  }
10658
10723
  }
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
10724
  render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
10665
10725
  this.callee.render(code, options, {
10666
10726
  isCalleeOfRenderedParent: true,
@@ -10703,18 +10763,16 @@ class ChainExpression extends NodeBase {
10703
10763
  // deoptimizations are not relevant as we are not caching values
10704
10764
  deoptimizeCache() { }
10705
10765
  getLiteralValueAtPath(path, recursionTracker, origin) {
10706
- if (this.expression.isSkippedAsOptional(origin))
10707
- return undefined;
10708
- return this.expression.getLiteralValueAtPath(path, recursionTracker, origin);
10766
+ const literalValue = this.expression.getLiteralValueAtPathAsChainElement(path, recursionTracker, origin);
10767
+ return literalValue === IS_SKIPPED_CHAIN ? undefined : literalValue;
10709
10768
  }
10710
10769
  hasEffects(context) {
10711
- if (this.expression.isSkippedAsOptional(this))
10712
- return false;
10713
- return this.expression.hasEffects(context);
10770
+ return this.expression.hasEffectsAsChainElement(context) === true;
10714
10771
  }
10715
10772
  removeAnnotations(code) {
10716
10773
  this.expression.removeAnnotations(code);
10717
10774
  }
10775
+ applyDeoptimizations() { }
10718
10776
  }
10719
10777
 
10720
10778
  class ClassBodyScope extends ChildScope {
@@ -12533,8 +12591,8 @@ class LogicalExpression extends NodeBase {
12533
12591
  }
12534
12592
  render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = parseAst_js.BLANK) {
12535
12593
  if (!this.left.included || !this.right.included) {
12594
+ const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
12536
12595
  if (this.right.included) {
12537
- const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
12538
12596
  const removePos = findNonWhiteSpace(code.original, operatorPos + 2);
12539
12597
  code.remove(this.start, removePos);
12540
12598
  if (preventASI) {
@@ -12543,7 +12601,7 @@ class LogicalExpression extends NodeBase {
12543
12601
  this.left.removeAnnotations(code);
12544
12602
  }
12545
12603
  else {
12546
- code.remove(this.left.end, this.end);
12604
+ code.remove(findLastWhiteSpaceReverse(code.original, this.left.end, operatorPos), this.end);
12547
12605
  }
12548
12606
  this.getUsedBranch().render(code, options, {
12549
12607
  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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1
4
+ Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
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.1",
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.1",
111
+ "@rollup/rollup-android-arm64": "4.19.1",
112
+ "@rollup/rollup-win32-arm64-msvc": "4.19.1",
113
+ "@rollup/rollup-linux-arm64-gnu": "4.19.1",
114
+ "@rollup/rollup-linux-arm64-musl": "4.19.1",
115
+ "@rollup/rollup-android-arm-eabi": "4.19.1",
116
+ "@rollup/rollup-linux-arm-gnueabihf": "4.19.1",
117
+ "@rollup/rollup-linux-arm-musleabihf": "4.19.1",
118
+ "@rollup/rollup-win32-ia32-msvc": "4.19.1",
119
+ "@rollup/rollup-linux-riscv64-gnu": "4.19.1",
120
+ "@rollup/rollup-linux-powerpc64le-gnu": "4.19.1",
121
+ "@rollup/rollup-linux-s390x-gnu": "4.19.1",
122
+ "@rollup/rollup-darwin-x64": "4.19.1",
123
+ "@rollup/rollup-win32-x64-msvc": "4.19.1",
124
+ "@rollup/rollup-linux-x64-gnu": "4.19.1",
125
+ "@rollup/rollup-linux-x64-musl": "4.19.1"
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": {