@voidzero-dev/vite-plus-test 0.1.2 → 0.1.4

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.
@@ -9,23 +9,6 @@ for (let i = 0; i < chars.length; i++) {
9
9
  intToChar[i] = c;
10
10
  charToInt[c] = i;
11
11
  }
12
- function decodeInteger(reader, relative) {
13
- let value = 0;
14
- let shift = 0;
15
- let integer = 0;
16
- do {
17
- const c = reader.next();
18
- integer = charToInt[c];
19
- value |= (integer & 31) << shift;
20
- shift += 5;
21
- } while (integer & 32);
22
- const shouldNegate = value & 1;
23
- value >>>= 1;
24
- if (shouldNegate) {
25
- value = -2147483648 | -value;
26
- }
27
- return relative + value;
28
- }
29
12
  function encodeInteger(builder, num, relative) {
30
13
  let delta = num - relative;
31
14
  delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
@@ -37,19 +20,12 @@ function encodeInteger(builder, num, relative) {
37
20
  } while (delta > 0);
38
21
  return num;
39
22
  }
40
- function hasMoreVlq(reader, max) {
41
- if (reader.pos >= max) return false;
42
- return reader.peek() !== comma;
43
- }
44
23
  var bufLength = 1024 * 16;
45
24
  var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
46
- const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
47
- return out.toString();
25
+ return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
48
26
  } } : { decode(buf) {
49
27
  let out = "";
50
- for (let i = 0; i < buf.length; i++) {
51
- out += String.fromCharCode(buf[i]);
52
- }
28
+ for (let i = 0; i < buf.length; i++) out += String.fromCharCode(buf[i]);
53
29
  return out;
54
30
  } };
55
31
  var StringWriter = class {
@@ -71,77 +47,6 @@ var StringWriter = class {
71
47
  return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
72
48
  }
73
49
  };
74
- var StringReader = class {
75
- constructor(buffer) {
76
- this.pos = 0;
77
- this.buffer = buffer;
78
- }
79
- next() {
80
- return this.buffer.charCodeAt(this.pos++);
81
- }
82
- peek() {
83
- return this.buffer.charCodeAt(this.pos);
84
- }
85
- indexOf(char) {
86
- const { buffer, pos } = this;
87
- const idx = buffer.indexOf(char, pos);
88
- return idx === -1 ? buffer.length : idx;
89
- }
90
- };
91
- var EMPTY = [];
92
- function decodeOriginalScopes(input) {
93
- const { length } = input;
94
- const reader = new StringReader(input);
95
- const scopes = [];
96
- const stack = [];
97
- let line = 0;
98
- for (; reader.pos < length; reader.pos++) {
99
- line = decodeInteger(reader, line);
100
- const column = decodeInteger(reader, 0);
101
- if (!hasMoreVlq(reader, length)) {
102
- const last = stack.pop();
103
- last[2] = line;
104
- last[3] = column;
105
- continue;
106
- }
107
- const kind = decodeInteger(reader, 0);
108
- const fields = decodeInteger(reader, 0);
109
- const hasName = fields & 1;
110
- const scope = hasName ? [
111
- line,
112
- column,
113
- 0,
114
- 0,
115
- kind,
116
- decodeInteger(reader, 0)
117
- ] : [
118
- line,
119
- column,
120
- 0,
121
- 0,
122
- kind
123
- ];
124
- let vars = EMPTY;
125
- if (hasMoreVlq(reader, length)) {
126
- vars = [];
127
- do {
128
- const varsIndex = decodeInteger(reader, 0);
129
- vars.push(varsIndex);
130
- } while (hasMoreVlq(reader, length));
131
- }
132
- scope.vars = vars;
133
- scopes.push(scope);
134
- stack.push(scope);
135
- }
136
- return scopes;
137
- }
138
- function encodeOriginalScopes(scopes) {
139
- const writer = new StringWriter();
140
- for (let i = 0; i < scopes.length;) {
141
- i = _encodeOriginalScopes(scopes, i, writer, [0]);
142
- }
143
- return writer.flush();
144
- }
145
50
  function _encodeOriginalScopes(scopes, index, writer, state) {
146
51
  const scope = scopes[index];
147
52
  const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
@@ -149,18 +54,12 @@ function _encodeOriginalScopes(scopes, index, writer, state) {
149
54
  state[0] = encodeInteger(writer, startLine, state[0]);
150
55
  encodeInteger(writer, startColumn, 0);
151
56
  encodeInteger(writer, kind, 0);
152
- const fields = scope.length === 6 ? 1 : 0;
153
- encodeInteger(writer, fields, 0);
57
+ encodeInteger(writer, scope.length === 6 ? 1 : 0, 0);
154
58
  if (scope.length === 6) encodeInteger(writer, scope[5], 0);
155
- for (const v of vars) {
156
- encodeInteger(writer, v, 0);
157
- }
59
+ for (const v of vars) encodeInteger(writer, v, 0);
158
60
  for (index++; index < scopes.length;) {
159
- const next = scopes[index];
160
- const { 0: l, 1: c } = next;
161
- if (l > endLine || l === endLine && c >= endColumn) {
162
- break;
163
- }
61
+ const { 0: l, 1: c } = scopes[index];
62
+ if (l > endLine || l === endLine && c >= endColumn) break;
164
63
  index = _encodeOriginalScopes(scopes, index, writer, state);
165
64
  }
166
65
  writer.write(comma);
@@ -168,123 +67,6 @@ function _encodeOriginalScopes(scopes, index, writer, state) {
168
67
  encodeInteger(writer, endColumn, 0);
169
68
  return index;
170
69
  }
171
- function decodeGeneratedRanges(input) {
172
- const { length } = input;
173
- const reader = new StringReader(input);
174
- const ranges = [];
175
- const stack = [];
176
- let genLine = 0;
177
- let definitionSourcesIndex = 0;
178
- let definitionScopeIndex = 0;
179
- let callsiteSourcesIndex = 0;
180
- let callsiteLine = 0;
181
- let callsiteColumn = 0;
182
- let bindingLine = 0;
183
- let bindingColumn = 0;
184
- do {
185
- const semi = reader.indexOf(";");
186
- let genColumn = 0;
187
- for (; reader.pos < semi; reader.pos++) {
188
- genColumn = decodeInteger(reader, genColumn);
189
- if (!hasMoreVlq(reader, semi)) {
190
- const last = stack.pop();
191
- last[2] = genLine;
192
- last[3] = genColumn;
193
- continue;
194
- }
195
- const fields = decodeInteger(reader, 0);
196
- const hasDefinition = fields & 1;
197
- const hasCallsite = fields & 2;
198
- const hasScope = fields & 4;
199
- let callsite = null;
200
- let bindings = EMPTY;
201
- let range;
202
- if (hasDefinition) {
203
- const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
204
- definitionScopeIndex = decodeInteger(reader, definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0);
205
- definitionSourcesIndex = defSourcesIndex;
206
- range = [
207
- genLine,
208
- genColumn,
209
- 0,
210
- 0,
211
- defSourcesIndex,
212
- definitionScopeIndex
213
- ];
214
- } else {
215
- range = [
216
- genLine,
217
- genColumn,
218
- 0,
219
- 0
220
- ];
221
- }
222
- range.isScope = !!hasScope;
223
- if (hasCallsite) {
224
- const prevCsi = callsiteSourcesIndex;
225
- const prevLine = callsiteLine;
226
- callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
227
- const sameSource = prevCsi === callsiteSourcesIndex;
228
- callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
229
- callsiteColumn = decodeInteger(reader, sameSource && prevLine === callsiteLine ? callsiteColumn : 0);
230
- callsite = [
231
- callsiteSourcesIndex,
232
- callsiteLine,
233
- callsiteColumn
234
- ];
235
- }
236
- range.callsite = callsite;
237
- if (hasMoreVlq(reader, semi)) {
238
- bindings = [];
239
- do {
240
- bindingLine = genLine;
241
- bindingColumn = genColumn;
242
- const expressionsCount = decodeInteger(reader, 0);
243
- let expressionRanges;
244
- if (expressionsCount < -1) {
245
- expressionRanges = [[decodeInteger(reader, 0)]];
246
- for (let i = -1; i > expressionsCount; i--) {
247
- const prevBl = bindingLine;
248
- bindingLine = decodeInteger(reader, bindingLine);
249
- bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
250
- const expression = decodeInteger(reader, 0);
251
- expressionRanges.push([
252
- expression,
253
- bindingLine,
254
- bindingColumn
255
- ]);
256
- }
257
- } else {
258
- expressionRanges = [[expressionsCount]];
259
- }
260
- bindings.push(expressionRanges);
261
- } while (hasMoreVlq(reader, semi));
262
- }
263
- range.bindings = bindings;
264
- ranges.push(range);
265
- stack.push(range);
266
- }
267
- genLine++;
268
- reader.pos = semi + 1;
269
- } while (reader.pos < length);
270
- return ranges;
271
- }
272
- function encodeGeneratedRanges(ranges) {
273
- if (ranges.length === 0) return "";
274
- const writer = new StringWriter();
275
- for (let i = 0; i < ranges.length;) {
276
- i = _encodeGeneratedRanges(ranges, i, writer, [
277
- 0,
278
- 0,
279
- 0,
280
- 0,
281
- 0,
282
- 0,
283
- 0
284
- ]);
285
- }
286
- return writer.flush();
287
- }
288
70
  function _encodeGeneratedRanges(ranges, index, writer, state) {
289
71
  const range = ranges[index];
290
72
  const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, isScope, callsite, bindings } = range;
@@ -292,17 +74,12 @@ function _encodeGeneratedRanges(ranges, index, writer, state) {
292
74
  catchupLine(writer, state[0], startLine);
293
75
  state[0] = startLine;
294
76
  state[1] = 0;
295
- } else if (index > 0) {
296
- writer.write(comma);
297
- }
77
+ } else if (index > 0) writer.write(comma);
298
78
  state[1] = encodeInteger(writer, range[1], state[1]);
299
- const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);
300
- encodeInteger(writer, fields, 0);
79
+ encodeInteger(writer, (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0), 0);
301
80
  if (range.length === 6) {
302
81
  const { 4: sourcesIndex, 5: scopesIndex } = range;
303
- if (sourcesIndex !== state[2]) {
304
- state[3] = 0;
305
- }
82
+ if (sourcesIndex !== state[2]) state[3] = 0;
306
83
  state[2] = encodeInteger(writer, sourcesIndex, state[2]);
307
84
  state[3] = encodeInteger(writer, scopesIndex, state[3]);
308
85
  }
@@ -311,109 +88,41 @@ function _encodeGeneratedRanges(ranges, index, writer, state) {
311
88
  if (sourcesIndex !== state[4]) {
312
89
  state[5] = 0;
313
90
  state[6] = 0;
314
- } else if (callLine !== state[5]) {
315
- state[6] = 0;
316
- }
91
+ } else if (callLine !== state[5]) state[6] = 0;
317
92
  state[4] = encodeInteger(writer, sourcesIndex, state[4]);
318
93
  state[5] = encodeInteger(writer, callLine, state[5]);
319
94
  state[6] = encodeInteger(writer, callColumn, state[6]);
320
95
  }
321
- if (bindings) {
322
- for (const binding of bindings) {
323
- if (binding.length > 1) encodeInteger(writer, -binding.length, 0);
324
- const expression = binding[0][0];
325
- encodeInteger(writer, expression, 0);
326
- let bindingStartLine = startLine;
327
- let bindingStartColumn = startColumn;
328
- for (let i = 1; i < binding.length; i++) {
329
- const expRange = binding[i];
330
- bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
331
- bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
332
- encodeInteger(writer, expRange[0], 0);
333
- }
96
+ if (bindings) for (const binding of bindings) {
97
+ if (binding.length > 1) encodeInteger(writer, -binding.length, 0);
98
+ const expression = binding[0][0];
99
+ encodeInteger(writer, expression, 0);
100
+ let bindingStartLine = startLine;
101
+ let bindingStartColumn = startColumn;
102
+ for (let i = 1; i < binding.length; i++) {
103
+ const expRange = binding[i];
104
+ bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
105
+ bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
106
+ encodeInteger(writer, expRange[0], 0);
334
107
  }
335
108
  }
336
109
  for (index++; index < ranges.length;) {
337
- const next = ranges[index];
338
- const { 0: l, 1: c } = next;
339
- if (l > endLine || l === endLine && c >= endColumn) {
340
- break;
341
- }
110
+ const { 0: l, 1: c } = ranges[index];
111
+ if (l > endLine || l === endLine && c >= endColumn) break;
342
112
  index = _encodeGeneratedRanges(ranges, index, writer, state);
343
113
  }
344
114
  if (state[0] < endLine) {
345
115
  catchupLine(writer, state[0], endLine);
346
116
  state[0] = endLine;
347
117
  state[1] = 0;
348
- } else {
349
- writer.write(comma);
350
- }
118
+ } else writer.write(comma);
351
119
  state[1] = encodeInteger(writer, endColumn, state[1]);
352
120
  return index;
353
121
  }
354
122
  function catchupLine(writer, lastLine, line) {
355
- do {
123
+ do
356
124
  writer.write(semicolon);
357
- } while (++lastLine < line);
358
- }
359
- function decode(mappings) {
360
- const { length } = mappings;
361
- const reader = new StringReader(mappings);
362
- const decoded = [];
363
- let genColumn = 0;
364
- let sourcesIndex = 0;
365
- let sourceLine = 0;
366
- let sourceColumn = 0;
367
- let namesIndex = 0;
368
- do {
369
- const semi = reader.indexOf(";");
370
- const line = [];
371
- let sorted = true;
372
- let lastCol = 0;
373
- genColumn = 0;
374
- while (reader.pos < semi) {
375
- let seg;
376
- genColumn = decodeInteger(reader, genColumn);
377
- if (genColumn < lastCol) sorted = false;
378
- lastCol = genColumn;
379
- if (hasMoreVlq(reader, semi)) {
380
- sourcesIndex = decodeInteger(reader, sourcesIndex);
381
- sourceLine = decodeInteger(reader, sourceLine);
382
- sourceColumn = decodeInteger(reader, sourceColumn);
383
- if (hasMoreVlq(reader, semi)) {
384
- namesIndex = decodeInteger(reader, namesIndex);
385
- seg = [
386
- genColumn,
387
- sourcesIndex,
388
- sourceLine,
389
- sourceColumn,
390
- namesIndex
391
- ];
392
- } else {
393
- seg = [
394
- genColumn,
395
- sourcesIndex,
396
- sourceLine,
397
- sourceColumn
398
- ];
399
- }
400
- } else {
401
- seg = [genColumn];
402
- }
403
- line.push(seg);
404
- reader.pos++;
405
- }
406
- if (!sorted) sort(line);
407
- decoded.push(line);
408
- reader.pos = semi + 1;
409
- } while (reader.pos <= length);
410
- return decoded;
411
- }
412
- function sort(line) {
413
- line.sort(sortComparator);
414
- }
415
- function sortComparator(a, b) {
416
- return a[0] - b[0];
125
+ while (++lastLine < line);
417
126
  }
418
127
  function encode(decoded) {
419
128
  const writer = new StringWriter();
@@ -440,7 +149,6 @@ function encode(decoded) {
440
149
  }
441
150
  return writer.flush();
442
151
  }
443
-
444
152
  //#endregion
445
153
  //#region ../../node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs
446
154
  var BitSet = class BitSet {
@@ -464,10 +172,8 @@ var Chunk = class Chunk {
464
172
  this.content = content;
465
173
  this.storeName = false;
466
174
  this.edited = false;
467
- {
468
- this.previous = null;
469
- this.next = null;
470
- }
175
+ this.previous = null;
176
+ this.next = null;
471
177
  }
472
178
  appendLeft(content) {
473
179
  this.outro += content;
@@ -538,9 +244,7 @@ var Chunk = class Chunk {
538
244
  if (this.edited) {
539
245
  newChunk.edit("", false);
540
246
  this.content = "";
541
- } else {
542
- this.content = originalBefore;
543
- }
247
+ } else this.content = originalBefore;
544
248
  newChunk.next = this.next;
545
249
  if (newChunk.next) newChunk.next.previous = newChunk;
546
250
  newChunk.previous = this;
@@ -556,14 +260,12 @@ var Chunk = class Chunk {
556
260
  const trimmed = this.content.replace(rx, "");
557
261
  if (trimmed.length) {
558
262
  if (trimmed !== this.content) {
559
- this.split(this.start + trimmed.length).edit("", undefined, true);
560
- if (this.edited) {
561
- this.edit(trimmed, this.storeName, true);
562
- }
263
+ this.split(this.start + trimmed.length).edit("", void 0, true);
264
+ if (this.edited) this.edit(trimmed, this.storeName, true);
563
265
  }
564
266
  return true;
565
267
  } else {
566
- this.edit("", undefined, true);
268
+ this.edit("", void 0, true);
567
269
  this.intro = this.intro.replace(rx, "");
568
270
  if (this.intro.length) return true;
569
271
  }
@@ -575,29 +277,23 @@ var Chunk = class Chunk {
575
277
  if (trimmed.length) {
576
278
  if (trimmed !== this.content) {
577
279
  const newChunk = this.split(this.end - trimmed.length);
578
- if (this.edited) {
579
- newChunk.edit(trimmed, this.storeName, true);
580
- }
581
- this.edit("", undefined, true);
280
+ if (this.edited) newChunk.edit(trimmed, this.storeName, true);
281
+ this.edit("", void 0, true);
582
282
  }
583
283
  return true;
584
284
  } else {
585
- this.edit("", undefined, true);
285
+ this.edit("", void 0, true);
586
286
  this.outro = this.outro.replace(rx, "");
587
287
  if (this.outro.length) return true;
588
288
  }
589
289
  }
590
290
  };
591
291
  function getBtoa() {
592
- if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") {
593
- return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
594
- } else if (typeof Buffer === "function") {
595
- return (str) => Buffer.from(str, "utf-8").toString("base64");
596
- } else {
597
- return () => {
598
- throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
599
- };
600
- }
292
+ if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
293
+ else if (typeof Buffer === "function") return (str) => Buffer.from(str, "utf-8").toString("base64");
294
+ else return () => {
295
+ throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
296
+ };
601
297
  }
602
298
  const btoa = /* @__PURE__ */ getBtoa();
603
299
  var SourceMap = class {
@@ -608,12 +304,8 @@ var SourceMap = class {
608
304
  this.sourcesContent = properties.sourcesContent;
609
305
  this.names = properties.names;
610
306
  this.mappings = encode(properties.mappings);
611
- if (typeof properties.x_google_ignoreList !== "undefined") {
612
- this.x_google_ignoreList = properties.x_google_ignoreList;
613
- }
614
- if (typeof properties.debugId !== "undefined") {
615
- this.debugId = properties.debugId;
616
- }
307
+ if (typeof properties.x_google_ignoreList !== "undefined") this.x_google_ignoreList = properties.x_google_ignoreList;
308
+ if (typeof properties.debugId !== "undefined") this.debugId = properties.debugId;
617
309
  }
618
310
  toString() {
619
311
  return JSON.stringify(this);
@@ -626,12 +318,8 @@ function guessIndent(code) {
626
318
  const lines = code.split("\n");
627
319
  const tabbed = lines.filter((line) => /^\t+/.test(line));
628
320
  const spaced = lines.filter((line) => /^ {2,}/.test(line));
629
- if (tabbed.length === 0 && spaced.length === 0) {
630
- return null;
631
- }
632
- if (tabbed.length >= spaced.length) {
633
- return " ";
634
- }
321
+ if (tabbed.length === 0 && spaced.length === 0) return null;
322
+ if (tabbed.length >= spaced.length) return " ";
635
323
  const min = spaced.reduce((previous, current) => {
636
324
  const numSpaces = /^ +/.exec(current)[0].length;
637
325
  return Math.min(numSpaces, previous);
@@ -668,17 +356,13 @@ function getLocator(source) {
668
356
  let j = lineOffsets.length;
669
357
  while (i < j) {
670
358
  const m = i + j >> 1;
671
- if (index < lineOffsets[m]) {
672
- j = m;
673
- } else {
674
- i = m + 1;
675
- }
359
+ if (index < lineOffsets[m]) j = m;
360
+ else i = m + 1;
676
361
  }
677
362
  const line = i - 1;
678
- const column = index - lineOffsets[line];
679
363
  return {
680
364
  line,
681
- column
365
+ column: index - lineOffsets[line]
682
366
  };
683
367
  };
684
368
  }
@@ -704,9 +388,7 @@ var Mappings = class {
704
388
  loc.line,
705
389
  loc.column
706
390
  ];
707
- if (nameIndex >= 0) {
708
- segment.push(nameIndex);
709
- }
391
+ if (nameIndex >= 0) segment.push(nameIndex);
710
392
  this.rawSegments.push(segment);
711
393
  this.generatedCodeLine += 1;
712
394
  this.raw[this.generatedCodeLine] = this.rawSegments = [];
@@ -720,9 +402,7 @@ var Mappings = class {
720
402
  loc.line,
721
403
  loc.column
722
404
  ];
723
- if (nameIndex >= 0) {
724
- segment.push(nameIndex);
725
- }
405
+ if (nameIndex >= 0) segment.push(nameIndex);
726
406
  this.rawSegments.push(segment);
727
407
  this.advance(content.slice(previousContentLineEnd + 1));
728
408
  } else if (this.pending) {
@@ -752,19 +432,16 @@ var Mappings = class {
752
432
  loc.line,
753
433
  loc.column
754
434
  ];
755
- if (this.hires === "boundary") {
756
- if (wordRegex.test(original[originalCharIndex])) {
757
- if (!charInHiresBoundary) {
758
- this.rawSegments.push(segment);
759
- charInHiresBoundary = true;
760
- }
761
- } else {
435
+ if (this.hires === "boundary") if (wordRegex.test(original[originalCharIndex])) {
436
+ if (!charInHiresBoundary) {
762
437
  this.rawSegments.push(segment);
763
- charInHiresBoundary = false;
438
+ charInHiresBoundary = true;
764
439
  }
765
440
  } else {
766
441
  this.rawSegments.push(segment);
442
+ charInHiresBoundary = false;
767
443
  }
444
+ else this.rawSegments.push(segment);
768
445
  }
769
446
  loc.column += 1;
770
447
  this.generatedCodeColumn += 1;
@@ -847,7 +524,7 @@ var MagicString = class MagicString {
847
524
  },
848
525
  indentStr: {
849
526
  writable: true,
850
- value: undefined
527
+ value: void 0
851
528
  },
852
529
  ignoreList: {
853
530
  writable: true,
@@ -874,11 +551,8 @@ var MagicString = class MagicString {
874
551
  if (typeof content !== "string") throw new TypeError("inserted content must be a string");
875
552
  this._split(index);
876
553
  const chunk = this.byEnd[index];
877
- if (chunk) {
878
- chunk.appendLeft(content);
879
- } else {
880
- this.intro += content;
881
- }
554
+ if (chunk) chunk.appendLeft(content);
555
+ else this.intro += content;
882
556
  return this;
883
557
  }
884
558
  appendRight(index, content) {
@@ -886,11 +560,8 @@ var MagicString = class MagicString {
886
560
  if (typeof content !== "string") throw new TypeError("inserted content must be a string");
887
561
  this._split(index);
888
562
  const chunk = this.byStart[index];
889
- if (chunk) {
890
- chunk.appendRight(content);
891
- } else {
892
- this.outro += content;
893
- }
563
+ if (chunk) chunk.appendRight(content);
564
+ else this.outro += content;
894
565
  return this;
895
566
  }
896
567
  clone() {
@@ -913,9 +584,7 @@ var MagicString = class MagicString {
913
584
  originalChunk = nextOriginalChunk;
914
585
  }
915
586
  cloned.lastChunk = clonedChunk;
916
- if (this.indentExclusionRanges) {
917
- cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
918
- }
587
+ if (this.indentExclusionRanges) cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
919
588
  cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
920
589
  cloned.intro = this.intro;
921
590
  cloned.outro = this.outro;
@@ -927,38 +596,29 @@ var MagicString = class MagicString {
927
596
  const names = Object.keys(this.storedNames);
928
597
  const mappings = new Mappings(options.hires);
929
598
  const locate = getLocator(this.original);
930
- if (this.intro) {
931
- mappings.advance(this.intro);
932
- }
599
+ if (this.intro) mappings.advance(this.intro);
933
600
  this.firstChunk.eachNext((chunk) => {
934
601
  const loc = locate(chunk.start);
935
602
  if (chunk.intro.length) mappings.advance(chunk.intro);
936
- if (chunk.edited) {
937
- mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
938
- } else {
939
- mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
940
- }
603
+ if (chunk.edited) mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
604
+ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
941
605
  if (chunk.outro.length) mappings.advance(chunk.outro);
942
606
  });
943
- if (this.outro) {
944
- mappings.advance(this.outro);
945
- }
607
+ if (this.outro) mappings.advance(this.outro);
946
608
  return {
947
- file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
609
+ file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
948
610
  sources: [options.source ? getRelativePath(options.file || "", options.source) : options.file || ""],
949
- sourcesContent: options.includeContent ? [this.original] : undefined,
611
+ sourcesContent: options.includeContent ? [this.original] : void 0,
950
612
  names,
951
613
  mappings: mappings.raw,
952
- x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
614
+ x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
953
615
  };
954
616
  }
955
617
  generateMap(options) {
956
618
  return new SourceMap(this.generateDecodedMap(options));
957
619
  }
958
620
  _ensureindentStr() {
959
- if (this.indentStr === undefined) {
960
- this.indentStr = guessIndent(this.original);
961
- }
621
+ if (this.indentStr === void 0) this.indentStr = guessIndent(this.original);
962
622
  }
963
623
  _getRawIndentString() {
964
624
  this._ensureindentStr();
@@ -972,23 +632,18 @@ var MagicString = class MagicString {
972
632
  const pattern = /^[^\r\n]/gm;
973
633
  if (isObject(indentStr)) {
974
634
  options = indentStr;
975
- indentStr = undefined;
635
+ indentStr = void 0;
976
636
  }
977
- if (indentStr === undefined) {
637
+ if (indentStr === void 0) {
978
638
  this._ensureindentStr();
979
639
  indentStr = this.indentStr || " ";
980
640
  }
981
641
  if (indentStr === "") return this;
982
642
  options = options || {};
983
643
  const isExcluded = {};
984
- if (options.exclude) {
985
- const exclusions = typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude;
986
- exclusions.forEach((exclusion) => {
987
- for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
988
- isExcluded[i] = true;
989
- }
990
- });
991
- }
644
+ if (options.exclude) (typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude).forEach((exclusion) => {
645
+ for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;
646
+ });
992
647
  let shouldIndentNextCharacter = options.indentStart !== false;
993
648
  const replacer = (match) => {
994
649
  if (shouldIndentNextCharacter) return `${indentStr}${match}`;
@@ -1003,22 +658,18 @@ var MagicString = class MagicString {
1003
658
  if (chunk.edited) {
1004
659
  if (!isExcluded[charIndex]) {
1005
660
  chunk.content = chunk.content.replace(pattern, replacer);
1006
- if (chunk.content.length) {
1007
- shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
1008
- }
661
+ if (chunk.content.length) shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
1009
662
  }
1010
663
  } else {
1011
664
  charIndex = chunk.start;
1012
665
  while (charIndex < end) {
1013
666
  if (!isExcluded[charIndex]) {
1014
667
  const char = this.original[charIndex];
1015
- if (char === "\n") {
1016
- shouldIndentNextCharacter = true;
1017
- } else if (char !== "\r" && shouldIndentNextCharacter) {
668
+ if (char === "\n") shouldIndentNextCharacter = true;
669
+ else if (char !== "\r" && shouldIndentNextCharacter) {
1018
670
  shouldIndentNextCharacter = false;
1019
- if (charIndex === chunk.start) {
1020
- chunk.prependRight(indentStr);
1021
- } else {
671
+ if (charIndex === chunk.start) chunk.prependRight(indentStr);
672
+ else {
1022
673
  this._splitChunk(chunk, charIndex);
1023
674
  chunk = chunk.next;
1024
675
  chunk.prependRight(indentStr);
@@ -1107,8 +758,8 @@ var MagicString = class MagicString {
1107
758
  }
1108
759
  options = { storeName: true };
1109
760
  }
1110
- const storeName = options !== undefined ? options.storeName : false;
1111
- const overwrite = options !== undefined ? options.overwrite : false;
761
+ const storeName = options !== void 0 ? options.storeName : false;
762
+ const overwrite = options !== void 0 ? options.overwrite : false;
1112
763
  if (storeName) {
1113
764
  const original = this.original.slice(start, end);
1114
765
  Object.defineProperty(this.storedNames, original, {
@@ -1122,9 +773,7 @@ var MagicString = class MagicString {
1122
773
  if (first) {
1123
774
  let chunk = first;
1124
775
  while (chunk !== last) {
1125
- if (chunk.next !== this.byStart[chunk.end]) {
1126
- throw new Error("Cannot overwrite across a split point");
1127
- }
776
+ if (chunk.next !== this.byStart[chunk.end]) throw new Error("Cannot overwrite across a split point");
1128
777
  chunk = chunk.next;
1129
778
  chunk.edit("", false);
1130
779
  }
@@ -1146,11 +795,8 @@ var MagicString = class MagicString {
1146
795
  if (typeof content !== "string") throw new TypeError("inserted content must be a string");
1147
796
  this._split(index);
1148
797
  const chunk = this.byEnd[index];
1149
- if (chunk) {
1150
- chunk.prependLeft(content);
1151
- } else {
1152
- this.intro = content + this.intro;
1153
- }
798
+ if (chunk) chunk.prependLeft(content);
799
+ else this.intro = content + this.intro;
1154
800
  return this;
1155
801
  }
1156
802
  prependRight(index, content) {
@@ -1158,11 +804,8 @@ var MagicString = class MagicString {
1158
804
  if (typeof content !== "string") throw new TypeError("inserted content must be a string");
1159
805
  this._split(index);
1160
806
  const chunk = this.byStart[index];
1161
- if (chunk) {
1162
- chunk.prependRight(content);
1163
- } else {
1164
- this.outro = content + this.outro;
1165
- }
807
+ if (chunk) chunk.prependRight(content);
808
+ else this.outro = content + this.outro;
1166
809
  return this;
1167
810
  }
1168
811
  remove(start, end) {
@@ -1252,28 +895,20 @@ var MagicString = class MagicString {
1252
895
  let result = "";
1253
896
  let chunk = this.firstChunk;
1254
897
  while (chunk && (chunk.start > start || chunk.end <= start)) {
1255
- if (chunk.start < end && chunk.end >= end) {
1256
- return result;
1257
- }
898
+ if (chunk.start < end && chunk.end >= end) return result;
1258
899
  chunk = chunk.next;
1259
900
  }
1260
901
  if (chunk && chunk.edited && chunk.start !== start) throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
1261
902
  const startChunk = chunk;
1262
903
  while (chunk) {
1263
- if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
1264
- result += chunk.intro;
1265
- }
904
+ if (chunk.intro && (startChunk !== chunk || chunk.start === start)) result += chunk.intro;
1266
905
  const containsEnd = chunk.start < end && chunk.end >= end;
1267
906
  if (containsEnd && chunk.edited && chunk.end !== end) throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
1268
907
  const sliceStart = startChunk === chunk ? start - chunk.start : 0;
1269
908
  const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
1270
909
  result += chunk.content.slice(sliceStart, sliceEnd);
1271
- if (chunk.outro && (!containsEnd || chunk.end === end)) {
1272
- result += chunk.outro;
1273
- }
1274
- if (containsEnd) {
1275
- break;
1276
- }
910
+ if (chunk.outro && (!containsEnd || chunk.end === end)) result += chunk.outro;
911
+ if (containsEnd) break;
1277
912
  chunk = chunk.next;
1278
913
  }
1279
914
  return result;
@@ -1320,17 +955,17 @@ var MagicString = class MagicString {
1320
955
  }
1321
956
  isEmpty() {
1322
957
  let chunk = this.firstChunk;
1323
- do {
958
+ do
1324
959
  if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim()) return false;
1325
- } while (chunk = chunk.next);
960
+ while (chunk = chunk.next);
1326
961
  return true;
1327
962
  }
1328
963
  length() {
1329
964
  let chunk = this.firstChunk;
1330
965
  let length = 0;
1331
- do {
966
+ do
1332
967
  length += chunk.intro.length + chunk.content.length + chunk.outro.length;
1333
- } while (chunk = chunk.next);
968
+ while (chunk = chunk.next);
1334
969
  return length;
1335
970
  }
1336
971
  trimLines() {
@@ -1348,9 +983,7 @@ var MagicString = class MagicString {
1348
983
  const end = chunk.end;
1349
984
  const aborted = chunk.trimEnd(rx);
1350
985
  if (chunk.end !== end) {
1351
- if (this.lastChunk === chunk) {
1352
- this.lastChunk = chunk.next;
1353
- }
986
+ if (this.lastChunk === chunk) this.lastChunk = chunk.next;
1354
987
  this.byEnd[chunk.end] = chunk;
1355
988
  this.byStart[chunk.next.start] = chunk.next;
1356
989
  this.byEnd[chunk.next.end] = chunk.next;
@@ -1392,43 +1025,31 @@ var MagicString = class MagicString {
1392
1025
  }
1393
1026
  _replaceRegexp(searchValue, replacement) {
1394
1027
  function getReplacement(match, str) {
1395
- if (typeof replacement === "string") {
1396
- return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
1397
- if (i === "$") return "$";
1398
- if (i === "&") return match[0];
1399
- const num = +i;
1400
- if (num < match.length) return match[+i];
1401
- return `$${i}`;
1402
- });
1403
- } else {
1404
- return replacement(...match, match.index, str, match.groups);
1405
- }
1028
+ if (typeof replacement === "string") return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
1029
+ if (i === "$") return "$";
1030
+ if (i === "&") return match[0];
1031
+ if (+i < match.length) return match[+i];
1032
+ return `$${i}`;
1033
+ });
1034
+ else return replacement(...match, match.index, str, match.groups);
1406
1035
  }
1407
1036
  function matchAll(re, str) {
1408
1037
  let match;
1409
1038
  const matches = [];
1410
- while (match = re.exec(str)) {
1411
- matches.push(match);
1412
- }
1039
+ while (match = re.exec(str)) matches.push(match);
1413
1040
  return matches;
1414
1041
  }
1415
- if (searchValue.global) {
1416
- const matches = matchAll(searchValue, this.original);
1417
- matches.forEach((match) => {
1418
- if (match.index != null) {
1419
- const replacement = getReplacement(match, this.original);
1420
- if (replacement !== match[0]) {
1421
- this.overwrite(match.index, match.index + match[0].length, replacement);
1422
- }
1423
- }
1424
- });
1425
- } else {
1042
+ if (searchValue.global) matchAll(searchValue, this.original).forEach((match) => {
1043
+ if (match.index != null) {
1044
+ const replacement = getReplacement(match, this.original);
1045
+ if (replacement !== match[0]) this.overwrite(match.index, match.index + match[0].length, replacement);
1046
+ }
1047
+ });
1048
+ else {
1426
1049
  const match = this.original.match(searchValue);
1427
1050
  if (match && match.index != null) {
1428
1051
  const replacement = getReplacement(match, this.original);
1429
- if (replacement !== match[0]) {
1430
- this.overwrite(match.index, match.index + match[0].length, replacement);
1431
- }
1052
+ if (replacement !== match[0]) this.overwrite(match.index, match.index + match[0].length, replacement);
1432
1053
  }
1433
1054
  }
1434
1055
  return this;
@@ -1437,19 +1058,13 @@ var MagicString = class MagicString {
1437
1058
  const { original } = this;
1438
1059
  const index = original.indexOf(string);
1439
1060
  if (index !== -1) {
1440
- if (typeof replacement === "function") {
1441
- replacement = replacement(string, index, original);
1442
- }
1443
- if (string !== replacement) {
1444
- this.overwrite(index, index + string.length, replacement);
1445
- }
1061
+ if (typeof replacement === "function") replacement = replacement(string, index, original);
1062
+ if (string !== replacement) this.overwrite(index, index + string.length, replacement);
1446
1063
  }
1447
1064
  return this;
1448
1065
  }
1449
1066
  replace(searchValue, replacement) {
1450
- if (typeof searchValue === "string") {
1451
- return this._replaceString(searchValue, replacement);
1452
- }
1067
+ if (typeof searchValue === "string") return this._replaceString(searchValue, replacement);
1453
1068
  return this._replaceRegexp(searchValue, replacement);
1454
1069
  }
1455
1070
  _replaceAllString(string, replacement) {
@@ -1458,20 +1073,14 @@ var MagicString = class MagicString {
1458
1073
  for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
1459
1074
  const previous = original.slice(index, index + stringLength);
1460
1075
  let _replacement = replacement;
1461
- if (typeof replacement === "function") {
1462
- _replacement = replacement(previous, index, original);
1463
- }
1076
+ if (typeof replacement === "function") _replacement = replacement(previous, index, original);
1464
1077
  if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
1465
1078
  }
1466
1079
  return this;
1467
1080
  }
1468
1081
  replaceAll(searchValue, replacement) {
1469
- if (typeof searchValue === "string") {
1470
- return this._replaceAllString(searchValue, replacement);
1471
- }
1472
- if (!searchValue.global) {
1473
- throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
1474
- }
1082
+ if (typeof searchValue === "string") return this._replaceAllString(searchValue, replacement);
1083
+ if (!searchValue.global) throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
1475
1084
  return this._replaceRegexp(searchValue, replacement);
1476
1085
  }
1477
1086
  };
@@ -1479,22 +1088,18 @@ const hasOwnProp = Object.prototype.hasOwnProperty;
1479
1088
  var Bundle = class Bundle {
1480
1089
  constructor(options = {}) {
1481
1090
  this.intro = options.intro || "";
1482
- this.separator = options.separator !== undefined ? options.separator : "\n";
1091
+ this.separator = options.separator !== void 0 ? options.separator : "\n";
1483
1092
  this.sources = [];
1484
1093
  this.uniqueSources = [];
1485
1094
  this.uniqueSourceIndexByFilename = {};
1486
1095
  }
1487
1096
  addSource(source) {
1488
- if (source instanceof MagicString) {
1489
- return this.addSource({
1490
- content: source,
1491
- filename: source.filename,
1492
- separator: this.separator
1493
- });
1494
- }
1495
- if (!isObject(source) || !source.content) {
1496
- throw new Error("bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`");
1497
- }
1097
+ if (source instanceof MagicString) return this.addSource({
1098
+ content: source,
1099
+ filename: source.filename,
1100
+ separator: this.separator
1101
+ });
1102
+ if (!isObject(source) || !source.content) throw new Error("bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`");
1498
1103
  [
1499
1104
  "filename",
1500
1105
  "ignoreList",
@@ -1503,22 +1108,16 @@ var Bundle = class Bundle {
1503
1108
  ].forEach((option) => {
1504
1109
  if (!hasOwnProp.call(source, option)) source[option] = source.content[option];
1505
1110
  });
1506
- if (source.separator === undefined) {
1507
- source.separator = this.separator;
1508
- }
1509
- if (source.filename) {
1510
- if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {
1511
- this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;
1512
- this.uniqueSources.push({
1513
- filename: source.filename,
1514
- content: source.content.original
1515
- });
1516
- } else {
1517
- const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];
1518
- if (source.content.original !== uniqueSource.content) {
1519
- throw new Error(`Illegal source: same filename (${source.filename}), different contents`);
1520
- }
1521
- }
1111
+ if (source.separator === void 0) source.separator = this.separator;
1112
+ if (source.filename) if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {
1113
+ this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;
1114
+ this.uniqueSources.push({
1115
+ filename: source.filename,
1116
+ content: source.content.original
1117
+ });
1118
+ } else {
1119
+ const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];
1120
+ if (source.content.original !== uniqueSource.content) throw new Error(`Illegal source: same filename (${source.filename}), different contents`);
1522
1121
  }
1523
1122
  this.sources.push(source);
1524
1123
  return this;
@@ -1546,52 +1145,36 @@ var Bundle = class Bundle {
1546
1145
  }
1547
1146
  generateDecodedMap(options = {}) {
1548
1147
  const names = [];
1549
- let x_google_ignoreList = undefined;
1148
+ let x_google_ignoreList = void 0;
1550
1149
  this.sources.forEach((source) => {
1551
1150
  Object.keys(source.content.storedNames).forEach((name) => {
1552
1151
  if (!~names.indexOf(name)) names.push(name);
1553
1152
  });
1554
1153
  });
1555
1154
  const mappings = new Mappings(options.hires);
1556
- if (this.intro) {
1557
- mappings.advance(this.intro);
1558
- }
1155
+ if (this.intro) mappings.advance(this.intro);
1559
1156
  this.sources.forEach((source, i) => {
1560
- if (i > 0) {
1561
- mappings.advance(this.separator);
1562
- }
1157
+ if (i > 0) mappings.advance(this.separator);
1563
1158
  const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;
1564
1159
  const magicString = source.content;
1565
1160
  const locate = getLocator(magicString.original);
1566
- if (magicString.intro) {
1567
- mappings.advance(magicString.intro);
1568
- }
1161
+ if (magicString.intro) mappings.advance(magicString.intro);
1569
1162
  magicString.firstChunk.eachNext((chunk) => {
1570
1163
  const loc = locate(chunk.start);
1571
1164
  if (chunk.intro.length) mappings.advance(chunk.intro);
1572
- if (source.filename) {
1573
- if (chunk.edited) {
1574
- mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
1575
- } else {
1576
- mappings.addUneditedChunk(sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations);
1577
- }
1578
- } else {
1579
- mappings.advance(chunk.content);
1580
- }
1165
+ if (source.filename) if (chunk.edited) mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
1166
+ else mappings.addUneditedChunk(sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations);
1167
+ else mappings.advance(chunk.content);
1581
1168
  if (chunk.outro.length) mappings.advance(chunk.outro);
1582
1169
  });
1583
- if (magicString.outro) {
1584
- mappings.advance(magicString.outro);
1585
- }
1170
+ if (magicString.outro) mappings.advance(magicString.outro);
1586
1171
  if (source.ignoreList && sourceIndex !== -1) {
1587
- if (x_google_ignoreList === undefined) {
1588
- x_google_ignoreList = [];
1589
- }
1172
+ if (x_google_ignoreList === void 0) x_google_ignoreList = [];
1590
1173
  x_google_ignoreList.push(sourceIndex);
1591
1174
  }
1592
1175
  });
1593
1176
  return {
1594
- file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
1177
+ file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
1595
1178
  sources: this.uniqueSources.map((source) => {
1596
1179
  return options.file ? getRelativePath(options.file, source.filename) : source.filename;
1597
1180
  }),
@@ -1619,13 +1202,11 @@ var Bundle = class Bundle {
1619
1202
  })[0] || " ";
1620
1203
  }
1621
1204
  indent(indentStr) {
1622
- if (!arguments.length) {
1623
- indentStr = this.getIndentString();
1624
- }
1205
+ if (!arguments.length) indentStr = this.getIndentString();
1625
1206
  if (indentStr === "") return this;
1626
1207
  let trailingNewline = !this.intro || this.intro.slice(-1) === "\n";
1627
1208
  this.sources.forEach((source, i) => {
1628
- const separator = source.separator !== undefined ? source.separator : this.separator;
1209
+ const separator = source.separator !== void 0 ? source.separator : this.separator;
1629
1210
  const indentStart = trailingNewline || i > 0 && /\r?\n$/.test(separator);
1630
1211
  source.content.indent(indentStr, {
1631
1212
  exclude: source.indentExclusionRanges,
@@ -1633,11 +1214,9 @@ var Bundle = class Bundle {
1633
1214
  });
1634
1215
  trailingNewline = source.content.lastChar() === "\n";
1635
1216
  });
1636
- if (this.intro) {
1637
- this.intro = indentStr + this.intro.replace(/^[^\n]/gm, (match, index) => {
1638
- return index > 0 ? indentStr + match : match;
1639
- });
1640
- }
1217
+ if (this.intro) this.intro = indentStr + this.intro.replace(/^[^\n]/gm, (match, index) => {
1218
+ return index > 0 ? indentStr + match : match;
1219
+ });
1641
1220
  return this;
1642
1221
  }
1643
1222
  prepend(str) {
@@ -1646,9 +1225,8 @@ var Bundle = class Bundle {
1646
1225
  }
1647
1226
  toString() {
1648
1227
  const body = this.sources.map((source, i) => {
1649
- const separator = source.separator !== undefined ? source.separator : this.separator;
1650
- const str = (i > 0 ? separator : "") + source.content.toString();
1651
- return str;
1228
+ const separator = source.separator !== void 0 ? source.separator : this.separator;
1229
+ return (i > 0 ? separator : "") + source.content.toString();
1652
1230
  }).join("");
1653
1231
  return this.intro + body;
1654
1232
  }
@@ -1674,9 +1252,7 @@ var Bundle = class Bundle {
1674
1252
  let i = 0;
1675
1253
  do {
1676
1254
  source = this.sources[i++];
1677
- if (!source) {
1678
- break;
1679
- }
1255
+ if (!source) break;
1680
1256
  } while (!source.content.trimStartAborted(charType));
1681
1257
  }
1682
1258
  return this;
@@ -1695,6 +1271,5 @@ var Bundle = class Bundle {
1695
1271
  return this;
1696
1272
  }
1697
1273
  };
1698
-
1699
1274
  //#endregion
1700
- export { Bundle, SourceMap, MagicString as default };
1275
+ export { Bundle, SourceMap, MagicString as default };