@rollup/wasm-node 4.18.1 → 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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.18.1
4
- Mon, 08 Jul 2024 15:24:39 GMT - commit 21f9a4949358b60801c948cd4777d7a39d9e6de0
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.18.1";
19
+ var version = "4.19.1";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -28,6 +28,42 @@ for (let i = 0; i < chars$1.length; i++) {
28
28
  intToChar[i] = c;
29
29
  charToInt[c] = i;
30
30
  }
31
+ function decodeInteger(reader, relative) {
32
+ let value = 0;
33
+ let shift = 0;
34
+ let integer = 0;
35
+ do {
36
+ const c = reader.next();
37
+ integer = charToInt[c];
38
+ value |= (integer & 31) << shift;
39
+ shift += 5;
40
+ } while (integer & 32);
41
+ const shouldNegate = value & 1;
42
+ value >>>= 1;
43
+ if (shouldNegate) {
44
+ value = -0x80000000 | -value;
45
+ }
46
+ return relative + value;
47
+ }
48
+ function encodeInteger(builder, num, relative) {
49
+ let delta = num - relative;
50
+ delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
51
+ do {
52
+ let clamped = delta & 0b011111;
53
+ delta >>>= 5;
54
+ if (delta > 0)
55
+ clamped |= 0b100000;
56
+ builder.write(intToChar[clamped]);
57
+ } while (delta > 0);
58
+ return num;
59
+ }
60
+ function hasMoreVlq(reader, max) {
61
+ if (reader.pos >= max)
62
+ return false;
63
+ return reader.peek() !== comma;
64
+ }
65
+
66
+ const bufLength = 1024 * 16;
31
67
  // Provide a fallback for older environments.
32
68
  const td = typeof TextDecoder !== 'undefined'
33
69
  ? /* #__PURE__ */ new TextDecoder()
@@ -47,74 +83,89 @@ const td = typeof TextDecoder !== 'undefined'
47
83
  return out;
48
84
  },
49
85
  };
86
+ class StringWriter {
87
+ constructor() {
88
+ this.pos = 0;
89
+ this.out = '';
90
+ this.buffer = new Uint8Array(bufLength);
91
+ }
92
+ write(v) {
93
+ const { buffer } = this;
94
+ buffer[this.pos++] = v;
95
+ if (this.pos === bufLength) {
96
+ this.out += td.decode(buffer);
97
+ this.pos = 0;
98
+ }
99
+ }
100
+ flush() {
101
+ const { buffer, out, pos } = this;
102
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
103
+ }
104
+ }
105
+ class StringReader {
106
+ constructor(buffer) {
107
+ this.pos = 0;
108
+ this.buffer = buffer;
109
+ }
110
+ next() {
111
+ return this.buffer.charCodeAt(this.pos++);
112
+ }
113
+ peek() {
114
+ return this.buffer.charCodeAt(this.pos);
115
+ }
116
+ indexOf(char) {
117
+ const { buffer, pos } = this;
118
+ const idx = buffer.indexOf(char, pos);
119
+ return idx === -1 ? buffer.length : idx;
120
+ }
121
+ }
122
+
50
123
  function decode(mappings) {
51
- const state = new Int32Array(5);
124
+ const { length } = mappings;
125
+ const reader = new StringReader(mappings);
52
126
  const decoded = [];
53
- let index = 0;
127
+ let genColumn = 0;
128
+ let sourcesIndex = 0;
129
+ let sourceLine = 0;
130
+ let sourceColumn = 0;
131
+ let namesIndex = 0;
54
132
  do {
55
- const semi = indexOf(mappings, index);
133
+ const semi = reader.indexOf(';');
56
134
  const line = [];
57
135
  let sorted = true;
58
136
  let lastCol = 0;
59
- state[0] = 0;
60
- for (let i = index; i < semi; i++) {
137
+ genColumn = 0;
138
+ while (reader.pos < semi) {
61
139
  let seg;
62
- i = decodeInteger(mappings, i, state, 0); // genColumn
63
- const col = state[0];
64
- if (col < lastCol)
140
+ genColumn = decodeInteger(reader, genColumn);
141
+ if (genColumn < lastCol)
65
142
  sorted = false;
66
- lastCol = col;
67
- if (hasMoreVlq(mappings, i, semi)) {
68
- i = decodeInteger(mappings, i, state, 1); // sourcesIndex
69
- i = decodeInteger(mappings, i, state, 2); // sourceLine
70
- i = decodeInteger(mappings, i, state, 3); // sourceColumn
71
- if (hasMoreVlq(mappings, i, semi)) {
72
- i = decodeInteger(mappings, i, state, 4); // namesIndex
73
- seg = [col, state[1], state[2], state[3], state[4]];
143
+ lastCol = genColumn;
144
+ if (hasMoreVlq(reader, semi)) {
145
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
146
+ sourceLine = decodeInteger(reader, sourceLine);
147
+ sourceColumn = decodeInteger(reader, sourceColumn);
148
+ if (hasMoreVlq(reader, semi)) {
149
+ namesIndex = decodeInteger(reader, namesIndex);
150
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
74
151
  }
75
152
  else {
76
- seg = [col, state[1], state[2], state[3]];
153
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
77
154
  }
78
155
  }
79
156
  else {
80
- seg = [col];
157
+ seg = [genColumn];
81
158
  }
82
159
  line.push(seg);
160
+ reader.pos++;
83
161
  }
84
162
  if (!sorted)
85
163
  sort(line);
86
164
  decoded.push(line);
87
- index = semi + 1;
88
- } while (index <= mappings.length);
165
+ reader.pos = semi + 1;
166
+ } while (reader.pos <= length);
89
167
  return decoded;
90
168
  }
91
- function indexOf(mappings, index) {
92
- const idx = mappings.indexOf(';', index);
93
- return idx === -1 ? mappings.length : idx;
94
- }
95
- function decodeInteger(mappings, pos, state, j) {
96
- let value = 0;
97
- let shift = 0;
98
- let integer = 0;
99
- do {
100
- const c = mappings.charCodeAt(pos++);
101
- integer = charToInt[c];
102
- value |= (integer & 31) << shift;
103
- shift += 5;
104
- } while (integer & 32);
105
- const shouldNegate = value & 1;
106
- value >>>= 1;
107
- if (shouldNegate) {
108
- value = -0x80000000 | -value;
109
- }
110
- state[j] += value;
111
- return pos;
112
- }
113
- function hasMoreVlq(mappings, i, length) {
114
- if (i >= length)
115
- return false;
116
- return mappings.charCodeAt(i) !== comma;
117
- }
118
169
  function sort(line) {
119
170
  line.sort(sortComparator);
120
171
  }
@@ -122,62 +173,34 @@ function sortComparator(a, b) {
122
173
  return a[0] - b[0];
123
174
  }
124
175
  function encode(decoded) {
125
- const state = new Int32Array(5);
126
- const bufLength = 1024 * 16;
127
- const subLength = bufLength - 36;
128
- const buf = new Uint8Array(bufLength);
129
- const sub = buf.subarray(0, subLength);
130
- let pos = 0;
131
- let out = '';
176
+ const writer = new StringWriter();
177
+ let sourcesIndex = 0;
178
+ let sourceLine = 0;
179
+ let sourceColumn = 0;
180
+ let namesIndex = 0;
132
181
  for (let i = 0; i < decoded.length; i++) {
133
182
  const line = decoded[i];
134
- if (i > 0) {
135
- if (pos === bufLength) {
136
- out += td.decode(buf);
137
- pos = 0;
138
- }
139
- buf[pos++] = semicolon;
140
- }
183
+ if (i > 0)
184
+ writer.write(semicolon);
141
185
  if (line.length === 0)
142
186
  continue;
143
- state[0] = 0;
187
+ let genColumn = 0;
144
188
  for (let j = 0; j < line.length; j++) {
145
189
  const segment = line[j];
146
- // We can push up to 5 ints, each int can take at most 7 chars, and we
147
- // may push a comma.
148
- if (pos > subLength) {
149
- out += td.decode(sub);
150
- buf.copyWithin(0, subLength, pos);
151
- pos -= subLength;
152
- }
153
190
  if (j > 0)
154
- buf[pos++] = comma;
155
- pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
191
+ writer.write(comma);
192
+ genColumn = encodeInteger(writer, segment[0], genColumn);
156
193
  if (segment.length === 1)
157
194
  continue;
158
- pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
159
- pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
160
- pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
195
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
196
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
197
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
161
198
  if (segment.length === 4)
162
199
  continue;
163
- pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
200
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
164
201
  }
165
202
  }
166
- return out + td.decode(buf.subarray(0, pos));
167
- }
168
- function encodeInteger(buf, pos, state, segment, j) {
169
- const next = segment[j];
170
- let num = next - state[j];
171
- state[j] = next;
172
- num = num < 0 ? (-num << 1) | 1 : num << 1;
173
- do {
174
- let clamped = num & 0b011111;
175
- num >>>= 5;
176
- if (num > 0)
177
- clamped |= 0b100000;
178
- buf[pos++] = intToChar[clamped];
179
- } while (num > 0);
180
- return pos;
203
+ return writer.flush();
181
204
  }
182
205
 
183
206
  class BitSet {
@@ -4676,11 +4699,12 @@ const childNodeKeys = {
4676
4699
  CatchClause: ['param', 'body'],
4677
4700
  ChainExpression: ['expression'],
4678
4701
  ClassBody: ['body'],
4679
- ClassDeclaration: ['id', 'superClass', 'body'],
4680
- ClassExpression: ['id', 'superClass', 'body'],
4702
+ ClassDeclaration: ['decorators', 'id', 'superClass', 'body'],
4703
+ ClassExpression: ['decorators', 'id', 'superClass', 'body'],
4681
4704
  ConditionalExpression: ['test', 'consequent', 'alternate'],
4682
4705
  ContinueStatement: ['label'],
4683
4706
  DebuggerStatement: [],
4707
+ Decorator: ['expression'],
4684
4708
  DoWhileStatement: ['body', 'test'],
4685
4709
  EmptyStatement: [],
4686
4710
  ExportAllDeclaration: ['exported', 'source', 'attributes'],
@@ -4706,7 +4730,7 @@ const childNodeKeys = {
4706
4730
  LogicalExpression: ['left', 'right'],
4707
4731
  MemberExpression: ['object', 'property'],
4708
4732
  MetaProperty: ['meta', 'property'],
4709
- MethodDefinition: ['key', 'value'],
4733
+ MethodDefinition: ['decorators', 'key', 'value'],
4710
4734
  NewExpression: ['callee', 'arguments'],
4711
4735
  ObjectExpression: ['properties'],
4712
4736
  ObjectPattern: ['properties'],
@@ -4715,7 +4739,7 @@ const childNodeKeys = {
4715
4739
  PrivateIdentifier: [],
4716
4740
  Program: ['body'],
4717
4741
  Property: ['key', 'value'],
4718
- PropertyDefinition: ['key', 'value'],
4742
+ PropertyDefinition: ['decorators', 'key', 'value'],
4719
4743
  RestElement: ['argument'],
4720
4744
  ReturnStatement: ['argument'],
4721
4745
  SequenceExpression: ['expressions'],
@@ -4739,6 +4763,7 @@ const childNodeKeys = {
4739
4763
  };
4740
4764
 
4741
4765
  const INCLUDE_PARAMETERS = 'variables';
4766
+ const IS_SKIPPED_CHAIN = Symbol('IS_SKIPPED_CHAIN');
4742
4767
  class NodeBase extends ExpressionEntity {
4743
4768
  /**
4744
4769
  * Nodes can apply custom deoptimizations once they become part of the
@@ -7644,6 +7669,20 @@ function findNonWhiteSpace(code, index) {
7644
7669
  const result = NON_WHITESPACE.exec(code);
7645
7670
  return result.index;
7646
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
+ }
7647
7686
  // This assumes "code" only contains white-space and comments
7648
7687
  // Returns position of line-comment if applicable
7649
7688
  function findFirstLineBreakOutsideComment(code) {
@@ -8694,6 +8733,20 @@ class Literal extends NodeBase {
8694
8733
  }
8695
8734
  }
8696
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
+
8697
8750
  // To avoid infinite recursions
8698
8751
  const MAX_PATH_DEPTH = 7;
8699
8752
  function getResolvablePropertyKey(memberExpression) {
@@ -8837,6 +8890,9 @@ class MemberExpression extends NodeBase {
8837
8890
  }
8838
8891
  return UnknownValue;
8839
8892
  }
8893
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
8894
+ return getChainElementLiteralValueAtPath(this, this.object, path, recursionTracker, origin);
8895
+ }
8840
8896
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
8841
8897
  if (this.variable) {
8842
8898
  return this.variable.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin);
@@ -8857,6 +8913,23 @@ class MemberExpression extends NodeBase {
8857
8913
  this.object.hasEffects(context) ||
8858
8914
  this.hasAccessEffect(context));
8859
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
+ }
8860
8933
  hasEffectsAsAssignmentTarget(context, checkAccess) {
8861
8934
  if (checkAccess && !this.deoptimized)
8862
8935
  this.applyDeoptimizations();
@@ -8907,13 +8980,6 @@ class MemberExpression extends NodeBase {
8907
8980
  this.propertyKey = getResolvablePropertyKey(this);
8908
8981
  this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED };
8909
8982
  }
8910
- isSkippedAsOptional(origin) {
8911
- return (!this.variable &&
8912
- !this.isUndefined &&
8913
- (this.object.isSkippedAsOptional?.(origin) ||
8914
- (this.optional &&
8915
- this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null)));
8916
- }
8917
8983
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
8918
8984
  if (this.variable || this.isUndefined) {
8919
8985
  const { snippets: { getPropertyAccess } } = options;
@@ -9153,6 +9219,9 @@ class CallExpression extends CallExpressionBase {
9153
9219
  withNew: false
9154
9220
  };
9155
9221
  }
9222
+ getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
9223
+ return getChainElementLiteralValueAtPath(this, this.callee, path, recursionTracker, origin);
9224
+ }
9156
9225
  hasEffects(context) {
9157
9226
  if (!this.deoptimized)
9158
9227
  this.applyDeoptimizations();
@@ -9166,6 +9235,26 @@ class CallExpression extends CallExpressionBase {
9166
9235
  return (this.callee.hasEffects(context) ||
9167
9236
  this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
9168
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
+ }
9169
9258
  include(context, includeChildrenRecursively) {
9170
9259
  if (!this.deoptimized)
9171
9260
  this.applyDeoptimizations();
@@ -9190,11 +9279,6 @@ class CallExpression extends CallExpressionBase {
9190
9279
  this.annotationPure = this.annotations.some(comment => comment.type === 'pure');
9191
9280
  }
9192
9281
  }
9193
- isSkippedAsOptional(origin) {
9194
- return (this.callee.isSkippedAsOptional?.(origin) ||
9195
- (this.optional &&
9196
- this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null));
9197
- }
9198
9282
  render(code, options, { renderedSurroundingElement } = BLANK) {
9199
9283
  this.callee.render(code, options, {
9200
9284
  isCalleeOfRenderedParent: true,
@@ -9237,18 +9321,16 @@ class ChainExpression extends NodeBase {
9237
9321
  // deoptimizations are not relevant as we are not caching values
9238
9322
  deoptimizeCache() { }
9239
9323
  getLiteralValueAtPath(path, recursionTracker, origin) {
9240
- if (this.expression.isSkippedAsOptional(origin))
9241
- return undefined;
9242
- return this.expression.getLiteralValueAtPath(path, recursionTracker, origin);
9324
+ const literalValue = this.expression.getLiteralValueAtPathAsChainElement(path, recursionTracker, origin);
9325
+ return literalValue === IS_SKIPPED_CHAIN ? undefined : literalValue;
9243
9326
  }
9244
9327
  hasEffects(context) {
9245
- if (this.expression.isSkippedAsOptional(this))
9246
- return false;
9247
- return this.expression.hasEffects(context);
9328
+ return this.expression.hasEffectsAsChainElement(context) === true;
9248
9329
  }
9249
9330
  removeAnnotations(code) {
9250
9331
  this.expression.removeAnnotations(code);
9251
9332
  }
9333
+ applyDeoptimizations() { }
9252
9334
  }
9253
9335
 
9254
9336
  class ClassBodyScope extends ChildScope {
@@ -9285,6 +9367,15 @@ class ClassBody extends NodeBase {
9285
9367
  applyDeoptimizations() { }
9286
9368
  }
9287
9369
 
9370
+ function checkEffectForNodes(nodes, context) {
9371
+ for (const node of nodes) {
9372
+ if (node.hasEffects(context)) {
9373
+ return true;
9374
+ }
9375
+ }
9376
+ return false;
9377
+ }
9378
+
9288
9379
  class MethodBase extends NodeBase {
9289
9380
  constructor() {
9290
9381
  super(...arguments);
@@ -9362,6 +9453,9 @@ class MethodBase extends NodeBase {
9362
9453
  }
9363
9454
 
9364
9455
  class MethodDefinition extends MethodBase {
9456
+ hasEffects(context) {
9457
+ return super.hasEffects(context) || checkEffectForNodes(this.decorators, context);
9458
+ }
9365
9459
  applyDeoptimizations() { }
9366
9460
  }
9367
9461
 
@@ -9448,7 +9542,7 @@ class ClassNode extends NodeBase {
9448
9542
  this.applyDeoptimizations();
9449
9543
  const initEffect = this.superClass?.hasEffects(context) || this.body.hasEffects(context);
9450
9544
  this.id?.markDeclarationReached();
9451
- return initEffect || super.hasEffects(context);
9545
+ return initEffect || super.hasEffects(context) || checkEffectForNodes(this.decorators, context);
9452
9546
  }
9453
9547
  hasEffectsOnInteractionAtPath(path, interaction, context) {
9454
9548
  return interaction.type === INTERACTION_CALLED && path.length === 0
@@ -9465,6 +9559,8 @@ class ClassNode extends NodeBase {
9465
9559
  this.included = true;
9466
9560
  this.superClass?.include(context, includeChildrenRecursively);
9467
9561
  this.body.include(context, includeChildrenRecursively);
9562
+ for (const decorator of this.decorators)
9563
+ decorator.include(context, includeChildrenRecursively);
9468
9564
  if (this.id) {
9469
9565
  this.id.markDeclarationReached();
9470
9566
  this.id.include();
@@ -9558,6 +9654,7 @@ class ClassDeclaration extends ClassNode {
9558
9654
  }
9559
9655
  const renderedVariable = variable.getName(getPropertyAccess);
9560
9656
  if (renderedVariable !== name) {
9657
+ this.decorators.map(decorator => decorator.render(code, options));
9561
9658
  this.superClass?.render(code, options);
9562
9659
  this.body.render(code, {
9563
9660
  ...options,
@@ -9793,6 +9890,13 @@ class DebuggerStatement extends NodeBase {
9793
9890
  }
9794
9891
  }
9795
9892
 
9893
+ class Decorator extends NodeBase {
9894
+ hasEffects(context) {
9895
+ return (this.expression.hasEffects(context) ||
9896
+ this.expression.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context));
9897
+ }
9898
+ }
9899
+
9796
9900
  function hasLoopBodyEffects(context, body) {
9797
9901
  const { brokenFlow, hasBreak, hasContinue, ignore } = context;
9798
9902
  const { breaks, continues } = ignore;
@@ -11055,7 +11159,7 @@ class LogicalExpression extends NodeBase {
11055
11159
  this.left.removeAnnotations(code);
11056
11160
  }
11057
11161
  else {
11058
- code.remove(operatorPos, this.end);
11162
+ code.remove(findLastWhiteSpaceReverse(code.original, this.left.end, operatorPos), this.end);
11059
11163
  }
11060
11164
  this.getUsedBranch().render(code, options, {
11061
11165
  isCalleeOfRenderedParent,
@@ -11515,7 +11619,9 @@ class PropertyDefinition extends NodeBase {
11515
11619
  : UNKNOWN_RETURN_EXPRESSION;
11516
11620
  }
11517
11621
  hasEffects(context) {
11518
- return this.key.hasEffects(context) || (this.static && !!this.value?.hasEffects(context));
11622
+ return (this.key.hasEffects(context) ||
11623
+ (this.static && !!this.value?.hasEffects(context)) ||
11624
+ checkEffectForNodes(this.decorators, context));
11519
11625
  }
11520
11626
  hasEffectsOnInteractionAtPath(path, interaction, context) {
11521
11627
  return !this.value || this.value.hasEffectsOnInteractionAtPath(path, interaction, context);
@@ -12425,6 +12531,7 @@ const nodeTypeStrings = [
12425
12531
  'ConditionalExpression',
12426
12532
  'ContinueStatement',
12427
12533
  'DebuggerStatement',
12534
+ 'Decorator',
12428
12535
  'ExpressionStatement',
12429
12536
  'DoWhileStatement',
12430
12537
  'EmptyStatement',
@@ -12506,6 +12613,7 @@ const nodeConstructors$1 = [
12506
12613
  ConditionalExpression,
12507
12614
  ContinueStatement,
12508
12615
  DebuggerStatement,
12616
+ Decorator,
12509
12617
  ExpressionStatement,
12510
12618
  DoWhileStatement,
12511
12619
  EmptyStatement,
@@ -12657,22 +12765,24 @@ const bufferParsers = [
12657
12765
  },
12658
12766
  function classDeclaration(node, position, buffer) {
12659
12767
  const { scope } = node;
12660
- const idPosition = buffer[position];
12768
+ node.decorators = convertNodeList(node, scope, buffer[position], buffer);
12769
+ const idPosition = buffer[position + 1];
12661
12770
  node.id =
12662
12771
  idPosition === 0 ? null : convertNode(node, scope.parent, idPosition, buffer);
12663
- const superClassPosition = buffer[position + 1];
12772
+ const superClassPosition = buffer[position + 2];
12664
12773
  node.superClass =
12665
12774
  superClassPosition === 0 ? null : convertNode(node, scope, superClassPosition, buffer);
12666
- node.body = convertNode(node, scope, buffer[position + 2], buffer);
12775
+ node.body = convertNode(node, scope, buffer[position + 3], buffer);
12667
12776
  },
12668
12777
  function classExpression(node, position, buffer) {
12669
12778
  const { scope } = node;
12670
- const idPosition = buffer[position];
12779
+ node.decorators = convertNodeList(node, scope, buffer[position], buffer);
12780
+ const idPosition = buffer[position + 1];
12671
12781
  node.id = idPosition === 0 ? null : convertNode(node, scope, idPosition, buffer);
12672
- const superClassPosition = buffer[position + 1];
12782
+ const superClassPosition = buffer[position + 2];
12673
12783
  node.superClass =
12674
12784
  superClassPosition === 0 ? null : convertNode(node, scope, superClassPosition, buffer);
12675
- node.body = convertNode(node, scope, buffer[position + 2], buffer);
12785
+ node.body = convertNode(node, scope, buffer[position + 3], buffer);
12676
12786
  },
12677
12787
  function conditionalExpression(node, position, buffer) {
12678
12788
  const { scope } = node;
@@ -12686,6 +12796,10 @@ const bufferParsers = [
12686
12796
  node.label = labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer);
12687
12797
  },
12688
12798
  function debuggerStatement() { },
12799
+ function decorator(node, position, buffer) {
12800
+ const { scope } = node;
12801
+ node.expression = convertNode(node, scope, buffer[position], buffer);
12802
+ },
12689
12803
  function directive(node, position, buffer) {
12690
12804
  const { scope } = node;
12691
12805
  node.directive = buffer.convertString(buffer[position]);
@@ -12886,9 +13000,10 @@ const bufferParsers = [
12886
13000
  const flags = buffer[position];
12887
13001
  node.static = (flags & 1) === 1;
12888
13002
  node.computed = (flags & 2) === 2;
12889
- node.key = convertNode(node, scope, buffer[position + 1], buffer);
12890
- node.value = convertNode(node, scope, buffer[position + 2], buffer);
12891
- node.kind = FIXED_STRINGS[buffer[position + 3]];
13003
+ node.decorators = convertNodeList(node, scope, buffer[position + 1], buffer);
13004
+ node.key = convertNode(node, scope, buffer[position + 2], buffer);
13005
+ node.value = convertNode(node, scope, buffer[position + 3], buffer);
13006
+ node.kind = FIXED_STRINGS[buffer[position + 4]];
12892
13007
  },
12893
13008
  function newExpression(node, position, buffer) {
12894
13009
  const { scope } = node;
@@ -12928,8 +13043,9 @@ const bufferParsers = [
12928
13043
  const flags = buffer[position];
12929
13044
  node.static = (flags & 1) === 1;
12930
13045
  node.computed = (flags & 2) === 2;
12931
- node.key = convertNode(node, scope, buffer[position + 1], buffer);
12932
- const valuePosition = buffer[position + 2];
13046
+ node.decorators = convertNodeList(node, scope, buffer[position + 1], buffer);
13047
+ node.key = convertNode(node, scope, buffer[position + 2], buffer);
13048
+ const valuePosition = buffer[position + 3];
12933
13049
  node.value = valuePosition === 0 ? null : convertNode(node, scope, valuePosition, buffer);
12934
13050
  },
12935
13051
  function restElement(node, position, buffer) {
@@ -13093,6 +13209,7 @@ const nodeConstructors = {
13093
13209
  ConditionalExpression,
13094
13210
  ContinueStatement,
13095
13211
  DebuggerStatement,
13212
+ Decorator,
13096
13213
  DoWhileStatement,
13097
13214
  EmptyStatement,
13098
13215
  ExportAllDeclaration,
@@ -14632,8 +14749,11 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
14632
14749
  return `${n}${n}${mechanism}${getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings, getPropertyAccess)};`;
14633
14750
  }
14634
14751
  let exportBlock = '';
14635
- for (const { defaultVariableName, importPath, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
14636
- if (reexports && namedExportsMode) {
14752
+ if (namedExportsMode) {
14753
+ for (const { defaultVariableName, importPath, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
14754
+ if (!reexports) {
14755
+ continue;
14756
+ }
14637
14757
  for (const specifier of reexports) {
14638
14758
  if (specifier.reexported !== '*') {
14639
14759
  const importName = getReexportedImportName(name, specifier.imported, depNamedExportsMode, isChunk, defaultVariableName, namespaceVariableName, interop, importPath, externalLiveBindings, getPropertyAccess);
@@ -14677,8 +14797,11 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
14677
14797
  : `${lhs}${_}=${_}${rhs};`;
14678
14798
  }
14679
14799
  }
14680
- for (const { name, reexports } of dependencies) {
14681
- if (reexports && namedExportsMode) {
14800
+ if (namedExportsMode) {
14801
+ for (const { name, reexports } of dependencies) {
14802
+ if (!reexports) {
14803
+ continue;
14804
+ }
14682
14805
  for (const specifier of reexports) {
14683
14806
  if (specifier.reexported === '*') {
14684
14807
  if (exportBlock)
@@ -18257,7 +18380,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
18257
18380
 
18258
18381
  function flru (max) {
18259
18382
  var num, curr, prev;
18260
- var limit = max ;
18383
+ var limit = max;
18261
18384
 
18262
18385
  function keep(key, value) {
18263
18386
  if (++num > limit) {
@@ -20497,7 +20620,7 @@ const getIndent = (config, compact) => {
20497
20620
  return '';
20498
20621
  }
20499
20622
  const configIndent = config.indent;
20500
- return configIndent === false ? '' : configIndent ?? true;
20623
+ return configIndent === false ? '' : (configIndent ?? true);
20501
20624
  };
20502
20625
  const ALLOWED_INTEROP_TYPES = new Set([
20503
20626
  'compat',