rollup 4.63.2 → 4.63.3
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 +3 -3
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +270 -88
- package/dist/es/shared/parseAst.js +4 -2
- package/dist/es/shared/watch.js +29 -19
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +4 -2
- package/dist/shared/rollup.js +270 -88
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +29 -19
- package/package.json +26 -26
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.63.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.63.3
|
|
4
|
+
Mon, 14 Sep 2026 12:44:36 GMT - commit 250deca2945f8817350564f7d52bab0f79175d1b
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -27,7 +27,7 @@ function _mergeNamespaces(n, m) {
|
|
|
27
27
|
return Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' });
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var version = "4.63.
|
|
30
|
+
var version = "4.63.3";
|
|
31
31
|
const pkg = {
|
|
32
32
|
version: version};
|
|
33
33
|
|
|
@@ -125,6 +125,21 @@ var StringReader = class {
|
|
|
125
125
|
return idx === -1 ? buffer.length : idx;
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
+
function encodeRangeMappings(decoded) {
|
|
129
|
+
if (decoded.length === 0) return "";
|
|
130
|
+
const writer = new StringWriter();
|
|
131
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
132
|
+
const indices = decoded[i];
|
|
133
|
+
if (i > 0) writer.write(semicolon);
|
|
134
|
+
let index = 0;
|
|
135
|
+
for (let j = 0; j < indices.length; j++) {
|
|
136
|
+
const offset = indices[j];
|
|
137
|
+
encodeInteger(writer, offset - index);
|
|
138
|
+
index = offset;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return writer.flush();
|
|
142
|
+
}
|
|
128
143
|
|
|
129
144
|
// src/sourcemap-codec.ts
|
|
130
145
|
function decode(mappings) {
|
|
@@ -319,8 +334,10 @@ var Chunk$1 = class Chunk {
|
|
|
319
334
|
if (this.outro.length) return true;
|
|
320
335
|
const trimmed = this.content.replace(rx, "");
|
|
321
336
|
if (trimmed.length) {
|
|
322
|
-
if (trimmed !== this.content)
|
|
323
|
-
|
|
337
|
+
if (trimmed !== this.content) {
|
|
338
|
+
if (this.edited) this.edit(trimmed, this.storeName, true);
|
|
339
|
+
else this.split(this.start + trimmed.length).edit("", void 0, true);
|
|
340
|
+
}
|
|
324
341
|
return true;
|
|
325
342
|
} else {
|
|
326
343
|
this.edit("", void 0, true);
|
|
@@ -333,10 +350,12 @@ var Chunk$1 = class Chunk {
|
|
|
333
350
|
if (this.intro.length) return true;
|
|
334
351
|
const trimmed = this.content.replace(rx, "");
|
|
335
352
|
if (trimmed.length) {
|
|
336
|
-
if (trimmed !== this.content)
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
353
|
+
if (trimmed !== this.content) {
|
|
354
|
+
if (this.edited) this.edit(trimmed, this.storeName, true);
|
|
355
|
+
else {
|
|
356
|
+
this.split(this.end - trimmed.length);
|
|
357
|
+
this.edit("", void 0, true);
|
|
358
|
+
}
|
|
340
359
|
}
|
|
341
360
|
return true;
|
|
342
361
|
} else {
|
|
@@ -363,12 +382,14 @@ var MagicStringError = class extends Error {
|
|
|
363
382
|
//#endregion
|
|
364
383
|
//#region src/SourceMap.ts
|
|
365
384
|
function getBtoa() {
|
|
385
|
+
/* v8 ignore next -- environment fallback, unreachable when `btoa` is present */
|
|
366
386
|
if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
367
387
|
const buffer = globalThis["Buffer"];
|
|
368
388
|
if (buffer) return (str) => buffer.from(str, "utf-8").toString("base64");
|
|
369
389
|
return () => {
|
|
370
390
|
throw new MagicStringError("unsupported environment: `btoa` or `Buffer` is required");
|
|
371
391
|
};
|
|
392
|
+
/* v8 ignore stop */
|
|
372
393
|
}
|
|
373
394
|
const btoa = /* #__PURE__ */ getBtoa();
|
|
374
395
|
var SourceMap = class {
|
|
@@ -381,6 +402,14 @@ var SourceMap = class {
|
|
|
381
402
|
this.mappings = encode(properties.mappings);
|
|
382
403
|
if (typeof properties.x_google_ignoreList !== "undefined") this.x_google_ignoreList = properties.x_google_ignoreList;
|
|
383
404
|
if (typeof properties.debugId !== "undefined") this.debugId = properties.debugId;
|
|
405
|
+
if (typeof properties.rangeMappings !== "undefined") {
|
|
406
|
+
let shouldOutputRangeMapping = false;
|
|
407
|
+
for (const line of properties.rangeMappings) if (line.length !== 0) {
|
|
408
|
+
shouldOutputRangeMapping = true;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
if (shouldOutputRangeMapping) this.rangeMappings = encodeRangeMappings(properties.rangeMappings);
|
|
412
|
+
}
|
|
384
413
|
}
|
|
385
414
|
/**
|
|
386
415
|
* Returns the equivalent of `JSON.stringify(map)`
|
|
@@ -399,12 +428,8 @@ var SourceMap = class {
|
|
|
399
428
|
//#endregion
|
|
400
429
|
//#region src/utils/getLocator.ts
|
|
401
430
|
function getLocator(source) {
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
for (let i = 0, pos = 0; i < originalLines.length; i++) {
|
|
405
|
-
lineOffsets.push(pos);
|
|
406
|
-
pos += originalLines[i].length + 1;
|
|
407
|
-
}
|
|
431
|
+
const lineOffsets = [0];
|
|
432
|
+
for (let i = source.indexOf("\n"); i !== -1; i = source.indexOf("\n", i + 1)) lineOffsets.push(i + 1);
|
|
408
433
|
return function locate(index) {
|
|
409
434
|
let i = 0;
|
|
410
435
|
let j = lineOffsets.length;
|
|
@@ -458,7 +483,10 @@ function isObject(thing) {
|
|
|
458
483
|
}
|
|
459
484
|
//#endregion
|
|
460
485
|
//#region src/utils/Mappings.ts
|
|
461
|
-
const
|
|
486
|
+
const NEWLINE_CHAR$1 = 10;
|
|
487
|
+
function isWordCode(code) {
|
|
488
|
+
return code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57 || code === 95;
|
|
489
|
+
}
|
|
462
490
|
var Mappings = class {
|
|
463
491
|
constructor(hires) {
|
|
464
492
|
this.hires = hires;
|
|
@@ -466,9 +494,12 @@ var Mappings = class {
|
|
|
466
494
|
this.generatedCodeColumn = 0;
|
|
467
495
|
this.raw = [];
|
|
468
496
|
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
497
|
+
this.rawRangeMappings = [];
|
|
498
|
+
this.rawRangeMappingsIndices = this.rawRangeMappings[this.generatedCodeLine] = [];
|
|
469
499
|
this.pending = null;
|
|
470
500
|
}
|
|
471
501
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
502
|
+
/* v8 ignore else -- `pending` is never assigned a truthy value */
|
|
472
503
|
if (content.length) {
|
|
473
504
|
const contentLengthMinusOne = content.length - 1;
|
|
474
505
|
let contentLineEnd = content.indexOf("\n", 0);
|
|
@@ -484,6 +515,7 @@ var Mappings = class {
|
|
|
484
515
|
this.rawSegments.push(segment);
|
|
485
516
|
this.generatedCodeLine += 1;
|
|
486
517
|
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
518
|
+
this.rawRangeMappings[this.generatedCodeLine] = this.rawRangeMappingsIndices = [];
|
|
487
519
|
this.generatedCodeColumn = 0;
|
|
488
520
|
previousContentLineEnd = contentLineEnd;
|
|
489
521
|
contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
|
|
@@ -504,56 +536,128 @@ var Mappings = class {
|
|
|
504
536
|
this.pending = null;
|
|
505
537
|
}
|
|
506
538
|
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
507
|
-
|
|
508
|
-
let
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
539
|
+
const end = chunk.end;
|
|
540
|
+
let i = chunk.start;
|
|
541
|
+
if (this.hires) {
|
|
542
|
+
const boundary = this.hires === "boundary";
|
|
543
|
+
const experimentalRange = this.hires === "experimental-range";
|
|
544
|
+
let charInHiresBoundary = false;
|
|
545
|
+
while (i < end) {
|
|
546
|
+
if (experimentalRange && i + 1 >= end) this.rawSegments.push([
|
|
547
|
+
this.generatedCodeColumn,
|
|
548
|
+
sourceIndex,
|
|
549
|
+
loc.line,
|
|
550
|
+
loc.column
|
|
551
|
+
]);
|
|
552
|
+
const code = original.charCodeAt(i);
|
|
553
|
+
if (code === NEWLINE_CHAR$1) {
|
|
554
|
+
loc.line += 1;
|
|
555
|
+
loc.column = 0;
|
|
556
|
+
this.generatedCodeLine += 1;
|
|
557
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
558
|
+
this.rawRangeMappings[this.generatedCodeLine] = this.rawRangeMappingsIndices = [];
|
|
559
|
+
this.generatedCodeColumn = 0;
|
|
560
|
+
charInHiresBoundary = false;
|
|
561
|
+
} else {
|
|
562
|
+
if (boundary) {
|
|
563
|
+
if (isWordCode(code)) {
|
|
564
|
+
if (!charInHiresBoundary) {
|
|
565
|
+
this.rawSegments.push([
|
|
566
|
+
this.generatedCodeColumn,
|
|
567
|
+
sourceIndex,
|
|
568
|
+
loc.line,
|
|
569
|
+
loc.column
|
|
570
|
+
]);
|
|
571
|
+
charInHiresBoundary = true;
|
|
572
|
+
}
|
|
573
|
+
} else {
|
|
574
|
+
this.rawSegments.push([
|
|
575
|
+
this.generatedCodeColumn,
|
|
576
|
+
sourceIndex,
|
|
577
|
+
loc.line,
|
|
578
|
+
loc.column
|
|
579
|
+
]);
|
|
580
|
+
charInHiresBoundary = false;
|
|
581
|
+
}
|
|
582
|
+
} else if (experimentalRange) {
|
|
583
|
+
if (i === chunk.start) {
|
|
584
|
+
this.rawRangeMappingsIndices.push(this.rawSegments.length);
|
|
585
|
+
this.rawSegments.push([
|
|
586
|
+
this.generatedCodeColumn,
|
|
587
|
+
sourceIndex,
|
|
588
|
+
loc.line,
|
|
589
|
+
loc.column
|
|
590
|
+
]);
|
|
591
|
+
}
|
|
592
|
+
} else this.rawSegments.push([
|
|
593
|
+
this.generatedCodeColumn,
|
|
594
|
+
sourceIndex,
|
|
595
|
+
loc.line,
|
|
596
|
+
loc.column
|
|
597
|
+
]);
|
|
598
|
+
loc.column += 1;
|
|
599
|
+
this.generatedCodeColumn += 1;
|
|
600
|
+
}
|
|
601
|
+
i += 1;
|
|
602
|
+
}
|
|
603
|
+
} else {
|
|
604
|
+
const bits = sourcemapLocations.bits;
|
|
605
|
+
while (i < end) {
|
|
606
|
+
let newline = original.indexOf("\n", i);
|
|
607
|
+
if (newline === -1 || newline > end) newline = end;
|
|
608
|
+
if (newline > i) {
|
|
609
|
+
this.rawSegments.push([
|
|
522
610
|
this.generatedCodeColumn,
|
|
523
611
|
sourceIndex,
|
|
524
612
|
loc.line,
|
|
525
613
|
loc.column
|
|
526
|
-
];
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
614
|
+
]);
|
|
615
|
+
for (let w = i + 1 >> 5, last = newline - 1 >> 5; w <= last; w++) {
|
|
616
|
+
let word = bits[w];
|
|
617
|
+
if (!word) continue;
|
|
618
|
+
const base = w << 5;
|
|
619
|
+
while (word) {
|
|
620
|
+
const lowest = word & -word;
|
|
621
|
+
const index = base + 31 - Math.clz32(lowest);
|
|
622
|
+
if (index > i && index < newline) {
|
|
623
|
+
const offset = index - i;
|
|
624
|
+
this.rawSegments.push([
|
|
625
|
+
this.generatedCodeColumn + offset,
|
|
626
|
+
sourceIndex,
|
|
627
|
+
loc.line,
|
|
628
|
+
loc.column + offset
|
|
629
|
+
]);
|
|
630
|
+
}
|
|
631
|
+
word ^= lowest;
|
|
531
632
|
}
|
|
532
|
-
} else {
|
|
533
|
-
this.rawSegments.push(segment);
|
|
534
|
-
charInHiresBoundary = false;
|
|
535
633
|
}
|
|
536
|
-
|
|
634
|
+
loc.column += newline - i;
|
|
635
|
+
this.generatedCodeColumn += newline - i;
|
|
537
636
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
637
|
+
if (newline === end) break;
|
|
638
|
+
loc.line += 1;
|
|
639
|
+
loc.column = 0;
|
|
640
|
+
this.generatedCodeLine += 1;
|
|
641
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
642
|
+
this.rawRangeMappings[this.generatedCodeLine] = this.rawRangeMappingsIndices = [];
|
|
643
|
+
this.generatedCodeColumn = 0;
|
|
644
|
+
i = newline + 1;
|
|
541
645
|
}
|
|
542
|
-
originalCharIndex += 1;
|
|
543
646
|
}
|
|
544
647
|
this.pending = null;
|
|
545
648
|
}
|
|
546
649
|
advance(str) {
|
|
547
650
|
if (!str) return;
|
|
548
|
-
const
|
|
549
|
-
if (
|
|
550
|
-
for (let i =
|
|
651
|
+
const lastNewline = str.lastIndexOf("\n");
|
|
652
|
+
if (lastNewline !== -1) {
|
|
653
|
+
for (let i = str.indexOf("\n"); i !== -1; i = str.indexOf("\n", i + 1)) {
|
|
551
654
|
this.generatedCodeLine++;
|
|
552
655
|
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
656
|
+
this.rawRangeMappings[this.generatedCodeLine] = this.rawRangeMappingsIndices = [];
|
|
553
657
|
}
|
|
554
658
|
this.generatedCodeColumn = 0;
|
|
555
659
|
}
|
|
556
|
-
this.generatedCodeColumn +=
|
|
660
|
+
this.generatedCodeColumn += str.length - lastNewline - 1;
|
|
557
661
|
}
|
|
558
662
|
};
|
|
559
663
|
//#endregion
|
|
@@ -566,6 +670,63 @@ const warned = {
|
|
|
566
670
|
insertRight: false,
|
|
567
671
|
storeName: false
|
|
568
672
|
};
|
|
673
|
+
/**
|
|
674
|
+
* Expands the `$` substitution patterns that `String.prototype.replace` accepts
|
|
675
|
+
* in a string replacement.
|
|
676
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter
|
|
677
|
+
*
|
|
678
|
+
* `captures` holds the capture groups in order, so `captures[0]` is `$1`.
|
|
679
|
+
* `namedCaptures` is `undefined` when the pattern has no named groups, and
|
|
680
|
+
* `$<name>` is then literal text - which is also the case for a string search
|
|
681
|
+
* value, where there are no groups of either kind.
|
|
682
|
+
*/
|
|
683
|
+
function expandReplacement(replacement, matched, position, str, captures, namedCaptures) {
|
|
684
|
+
if (!replacement.includes("$")) return replacement;
|
|
685
|
+
let result = "";
|
|
686
|
+
let index = 0;
|
|
687
|
+
while (index < replacement.length) {
|
|
688
|
+
const dollar = replacement.indexOf("$", index);
|
|
689
|
+
if (dollar === -1) {
|
|
690
|
+
result += replacement.slice(index);
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
result += replacement.slice(index, dollar);
|
|
694
|
+
const char = replacement[dollar + 1];
|
|
695
|
+
let expansion = "$";
|
|
696
|
+
let consumed = 1;
|
|
697
|
+
if (char === "$") consumed = 2;
|
|
698
|
+
else if (char === "&") {
|
|
699
|
+
expansion = matched;
|
|
700
|
+
consumed = 2;
|
|
701
|
+
} else if (char === "`") {
|
|
702
|
+
expansion = str.slice(0, position);
|
|
703
|
+
consumed = 2;
|
|
704
|
+
} else if (char === "'") {
|
|
705
|
+
expansion = str.slice(position + matched.length);
|
|
706
|
+
consumed = 2;
|
|
707
|
+
} else if (char === "<" && namedCaptures !== void 0) {
|
|
708
|
+
const close = replacement.indexOf(">", dollar + 2);
|
|
709
|
+
if (close !== -1) {
|
|
710
|
+
expansion = namedCaptures[replacement.slice(dollar + 2, close)] ?? "";
|
|
711
|
+
consumed = close + 1 - dollar;
|
|
712
|
+
}
|
|
713
|
+
} else if (char >= "0" && char <= "9") {
|
|
714
|
+
const second = replacement[dollar + 2];
|
|
715
|
+
const double = second >= "0" && second <= "9" ? Number(char + second) : NaN;
|
|
716
|
+
const single = Number(char);
|
|
717
|
+
if (double >= 1 && double <= captures.length) {
|
|
718
|
+
expansion = captures[double - 1] ?? "";
|
|
719
|
+
consumed = 3;
|
|
720
|
+
} else if (single >= 1 && single <= captures.length) {
|
|
721
|
+
expansion = captures[single - 1] ?? "";
|
|
722
|
+
consumed = 2;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
result += expansion;
|
|
726
|
+
index = dollar + consumed;
|
|
727
|
+
}
|
|
728
|
+
return result;
|
|
729
|
+
}
|
|
569
730
|
var MagicString = class MagicString {
|
|
570
731
|
constructor(string, options = {}) {
|
|
571
732
|
const chunk = new Chunk$1(0, string.length, string);
|
|
@@ -735,7 +896,8 @@ var MagicString = class MagicString {
|
|
|
735
896
|
sourcesContent: options.includeContent ? [this.original] : void 0,
|
|
736
897
|
names,
|
|
737
898
|
mappings: mappings.raw,
|
|
738
|
-
x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
|
|
899
|
+
x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0,
|
|
900
|
+
rangeMappings: mappings.rawRangeMappings
|
|
739
901
|
};
|
|
740
902
|
}
|
|
741
903
|
/**
|
|
@@ -775,17 +937,18 @@ var MagicString = class MagicString {
|
|
|
775
937
|
for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;
|
|
776
938
|
});
|
|
777
939
|
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
778
|
-
const
|
|
779
|
-
if (
|
|
780
|
-
|
|
781
|
-
|
|
940
|
+
const indentPiece = (str) => {
|
|
941
|
+
if (str === "") return str;
|
|
942
|
+
const indented = str.replace(pattern, (match, offset) => offset > 0 || shouldIndentNextCharacter ? `${resolvedIndentStr}${match}` : match);
|
|
943
|
+
shouldIndentNextCharacter = str[str.length - 1] === "\n";
|
|
944
|
+
return indented;
|
|
782
945
|
};
|
|
783
|
-
this.intro = this.intro
|
|
946
|
+
this.intro = indentPiece(this.intro);
|
|
784
947
|
let charIndex = 0;
|
|
785
948
|
let chunk = this.firstChunk;
|
|
786
949
|
const indentAt = (index) => {
|
|
787
950
|
shouldIndentNextCharacter = false;
|
|
788
|
-
if (index === chunk.start) chunk.
|
|
951
|
+
if (index === chunk.start) chunk.appendRight(resolvedIndentStr);
|
|
789
952
|
else {
|
|
790
953
|
this._splitChunk(chunk, index);
|
|
791
954
|
chunk = chunk.next;
|
|
@@ -794,11 +957,9 @@ var MagicString = class MagicString {
|
|
|
794
957
|
};
|
|
795
958
|
while (chunk) {
|
|
796
959
|
const end = chunk.end;
|
|
960
|
+
if (!isExcluded[chunk.start]) chunk.intro = indentPiece(chunk.intro);
|
|
797
961
|
if (chunk.edited) {
|
|
798
|
-
if (!isExcluded[charIndex])
|
|
799
|
-
chunk.content = chunk.content.replace(pattern, replacer);
|
|
800
|
-
if (chunk.content.length) shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
|
|
801
|
-
}
|
|
962
|
+
if (!isExcluded[charIndex]) chunk.content = indentPiece(chunk.content);
|
|
802
963
|
} else if (options.exclude) {
|
|
803
964
|
charIndex = chunk.start;
|
|
804
965
|
while (charIndex < end) {
|
|
@@ -828,10 +989,11 @@ var MagicString = class MagicString {
|
|
|
828
989
|
charIndex += 1;
|
|
829
990
|
}
|
|
830
991
|
}
|
|
992
|
+
if (!isExcluded[chunk.end - 1]) chunk.outro = indentPiece(chunk.outro);
|
|
831
993
|
charIndex = chunk.end;
|
|
832
994
|
chunk = chunk.next;
|
|
833
995
|
}
|
|
834
|
-
this.outro = this.outro
|
|
996
|
+
this.outro = indentPiece(this.outro);
|
|
835
997
|
return this;
|
|
836
998
|
}
|
|
837
999
|
/** @internal */
|
|
@@ -954,6 +1116,7 @@ var MagicString = class MagicString {
|
|
|
954
1116
|
}
|
|
955
1117
|
const first = this.byStart.get(start);
|
|
956
1118
|
const last = this.byEnd.get(end);
|
|
1119
|
+
/* v8 ignore else -- unreachable: a valid start/end always yields a `first` chunk */
|
|
957
1120
|
if (first) {
|
|
958
1121
|
let chunk = first;
|
|
959
1122
|
while (chunk !== last) {
|
|
@@ -1171,11 +1334,13 @@ var MagicString = class MagicString {
|
|
|
1171
1334
|
* Returns true if the resulting source is empty (disregarding white space).
|
|
1172
1335
|
*/
|
|
1173
1336
|
isEmpty() {
|
|
1337
|
+
if (this.intro.length && this.intro.trim()) return false;
|
|
1174
1338
|
let chunk = this.firstChunk;
|
|
1175
1339
|
while (chunk) {
|
|
1176
1340
|
if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim()) return false;
|
|
1177
1341
|
chunk = chunk.next;
|
|
1178
1342
|
}
|
|
1343
|
+
if (this.outro.length && this.outro.trim()) return false;
|
|
1179
1344
|
return true;
|
|
1180
1345
|
}
|
|
1181
1346
|
length() {
|
|
@@ -1274,15 +1439,11 @@ var MagicString = class MagicString {
|
|
|
1274
1439
|
/** @internal */
|
|
1275
1440
|
_replaceRegexp(searchValue, replacement) {
|
|
1276
1441
|
function getReplacement(match, str) {
|
|
1277
|
-
if (typeof replacement === "string") return replacement.
|
|
1278
|
-
|
|
1279
|
-
if (i === "&") return match[0];
|
|
1280
|
-
if (+i < match.length) return match[+i];
|
|
1281
|
-
return `$${i}`;
|
|
1282
|
-
});
|
|
1283
|
-
else return replacement(match[0], ...match.slice(1), match.index, str, match.groups);
|
|
1442
|
+
if (typeof replacement === "string") return expandReplacement(replacement, match[0], match.index, str, match.slice(1), match.groups);
|
|
1443
|
+
else return match.groups === void 0 ? replacement(match[0], ...match.slice(1), match.index, str) : replacement(match[0], ...match.slice(1), match.index, str, match.groups);
|
|
1284
1444
|
}
|
|
1285
1445
|
const replaceMatch = (match) => {
|
|
1446
|
+
/* v8 ignore next 2 -- `match.index` is always defined for matches from `matchAll` */
|
|
1286
1447
|
if (match.index == null) return;
|
|
1287
1448
|
const replacement = getReplacement(match, this.original);
|
|
1288
1449
|
if (replacement === match[0]) return;
|
|
@@ -1304,8 +1465,11 @@ var MagicString = class MagicString {
|
|
|
1304
1465
|
const index = original.indexOf(string);
|
|
1305
1466
|
if (index !== -1) {
|
|
1306
1467
|
if (typeof replacement === "function") replacement = replacement(string, index, original);
|
|
1307
|
-
|
|
1308
|
-
|
|
1468
|
+
else replacement = expandReplacement(replacement, string, index, original, [], void 0);
|
|
1469
|
+
if (string !== replacement) {
|
|
1470
|
+
if (string.length === 0) this.appendRight(index, replacement);
|
|
1471
|
+
else this.overwrite(index, index + string.length, replacement);
|
|
1472
|
+
}
|
|
1309
1473
|
}
|
|
1310
1474
|
return this;
|
|
1311
1475
|
}
|
|
@@ -1322,14 +1486,14 @@ var MagicString = class MagicString {
|
|
|
1322
1486
|
const stringLength = string.length;
|
|
1323
1487
|
if (stringLength === 0) {
|
|
1324
1488
|
for (let index = 0; index <= original.length; index += 1) {
|
|
1325
|
-
const _replacement = typeof replacement === "function" ? replacement("", index, original) : replacement;
|
|
1489
|
+
const _replacement = typeof replacement === "function" ? replacement("", index, original) : expandReplacement(replacement, "", index, original, [], void 0);
|
|
1326
1490
|
if (_replacement !== "") this.appendRight(index, _replacement);
|
|
1327
1491
|
}
|
|
1328
1492
|
return this;
|
|
1329
1493
|
}
|
|
1330
1494
|
for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
|
|
1331
1495
|
const previous = original.slice(index, index + stringLength);
|
|
1332
|
-
const _replacement = typeof replacement === "function" ? replacement(previous, index, original) : replacement;
|
|
1496
|
+
const _replacement = typeof replacement === "function" ? replacement(previous, index, original) : expandReplacement(replacement, previous, index, original, [], void 0);
|
|
1333
1497
|
if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
|
|
1334
1498
|
}
|
|
1335
1499
|
return this;
|
|
@@ -1380,15 +1544,17 @@ var Bundle$1 = class Bundle {
|
|
|
1380
1544
|
if (!hasOwnProp.call(source, option)) source[option] = source.content[option];
|
|
1381
1545
|
});
|
|
1382
1546
|
if (source.separator === void 0) source.separator = this.separator;
|
|
1383
|
-
if (source.filename)
|
|
1384
|
-
this.uniqueSourceIndexByFilename
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1547
|
+
if (source.filename) {
|
|
1548
|
+
if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {
|
|
1549
|
+
this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;
|
|
1550
|
+
this.uniqueSources.push({
|
|
1551
|
+
filename: source.filename,
|
|
1552
|
+
content: source.content.original
|
|
1553
|
+
});
|
|
1554
|
+
} else {
|
|
1555
|
+
const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];
|
|
1556
|
+
if (source.content.original !== uniqueSource.content) throw new MagicStringError(`duplicate filename "${source.filename}" with different content, use unique filenames`);
|
|
1557
|
+
}
|
|
1392
1558
|
}
|
|
1393
1559
|
this.sources.push(source);
|
|
1394
1560
|
return this;
|
|
@@ -1427,7 +1593,9 @@ var Bundle$1 = class Bundle {
|
|
|
1427
1593
|
const mappings = new Mappings(options.hires);
|
|
1428
1594
|
if (this.intro) mappings.advance(this.intro);
|
|
1429
1595
|
this.sources.forEach((source, i) => {
|
|
1430
|
-
if (i > 0)
|
|
1596
|
+
if (i > 0)
|
|
1597
|
+
/* v8 ignore next -- addSource always normalizes source.separator */
|
|
1598
|
+
mappings.advance(source.separator !== void 0 ? source.separator : this.separator);
|
|
1431
1599
|
const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;
|
|
1432
1600
|
const magicString = source.content;
|
|
1433
1601
|
const locate = getLocator(magicString.original);
|
|
@@ -1435,9 +1603,10 @@ var Bundle$1 = class Bundle {
|
|
|
1435
1603
|
magicString.firstChunk.eachNext((chunk) => {
|
|
1436
1604
|
const loc = locate(chunk.start);
|
|
1437
1605
|
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
1438
|
-
if (source.filename)
|
|
1439
|
-
|
|
1440
|
-
|
|
1606
|
+
if (source.filename) {
|
|
1607
|
+
if (chunk.edited) mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
|
|
1608
|
+
else mappings.addUneditedChunk(sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations);
|
|
1609
|
+
} else mappings.advance(chunk.content);
|
|
1441
1610
|
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
1442
1611
|
});
|
|
1443
1612
|
if (magicString.outro) mappings.advance(magicString.outro);
|
|
@@ -1452,11 +1621,12 @@ var Bundle$1 = class Bundle {
|
|
|
1452
1621
|
return options.file ? getRelativePath(options.file, source.filename) : source.filename;
|
|
1453
1622
|
}),
|
|
1454
1623
|
sourcesContent: this.uniqueSources.map((source) => {
|
|
1455
|
-
return options.includeContent ? source.content : null;
|
|
1624
|
+
return (typeof options.includeContent === "function" ? options.includeContent(source) : options.includeContent) ? source.content : null;
|
|
1456
1625
|
}),
|
|
1457
1626
|
names,
|
|
1458
1627
|
mappings: mappings.raw,
|
|
1459
|
-
x_google_ignoreList
|
|
1628
|
+
x_google_ignoreList,
|
|
1629
|
+
rangeMappings: mappings.rawRangeMappings
|
|
1460
1630
|
};
|
|
1461
1631
|
}
|
|
1462
1632
|
generateMap(options) {
|
|
@@ -1479,6 +1649,7 @@ var Bundle$1 = class Bundle {
|
|
|
1479
1649
|
if (indentStr === "") return this;
|
|
1480
1650
|
let trailingNewline = !this.intro || this.intro.slice(-1) === "\n";
|
|
1481
1651
|
this.sources.forEach((source, i) => {
|
|
1652
|
+
/* v8 ignore next -- addSource always normalizes source.separator */
|
|
1482
1653
|
const separator = source.separator !== void 0 ? source.separator : this.separator;
|
|
1483
1654
|
const indentStart = trailingNewline || i > 0 && /\r?\n$/.test(separator);
|
|
1484
1655
|
source.content.indent(indentStr, {
|
|
@@ -1498,6 +1669,7 @@ var Bundle$1 = class Bundle {
|
|
|
1498
1669
|
}
|
|
1499
1670
|
toString() {
|
|
1500
1671
|
const body = this.sources.map((source, i) => {
|
|
1672
|
+
/* v8 ignore next -- addSource always normalizes source.separator */
|
|
1501
1673
|
const separator = source.separator !== void 0 ? source.separator : this.separator;
|
|
1502
1674
|
return (i > 0 ? separator : "") + source.content.toString();
|
|
1503
1675
|
}).join("");
|
|
@@ -1506,6 +1678,7 @@ var Bundle$1 = class Bundle {
|
|
|
1506
1678
|
isEmpty() {
|
|
1507
1679
|
if (this.intro.length && this.intro.trim()) return false;
|
|
1508
1680
|
if (this.sources.some((source, i) => {
|
|
1681
|
+
/* v8 ignore next -- addSource always normalizes source.separator */
|
|
1509
1682
|
const separator = source.separator !== void 0 ? source.separator : this.separator;
|
|
1510
1683
|
return i > 0 && separator.trim() !== "" || !source.content.isEmpty();
|
|
1511
1684
|
})) return false;
|
|
@@ -1513,8 +1686,9 @@ var Bundle$1 = class Bundle {
|
|
|
1513
1686
|
}
|
|
1514
1687
|
length() {
|
|
1515
1688
|
return this.sources.reduce((length, source, i) => {
|
|
1689
|
+
/* v8 ignore next -- addSource always normalizes source.separator */
|
|
1516
1690
|
const separator = source.separator !== void 0 ? source.separator : this.separator;
|
|
1517
|
-
return length + (i > 0 ? separator.length : 0) + source.content.
|
|
1691
|
+
return length + (i > 0 ? separator.length : 0) + source.content.toString().length;
|
|
1518
1692
|
}, this.intro.length);
|
|
1519
1693
|
}
|
|
1520
1694
|
trimLines() {
|
|
@@ -1597,6 +1771,14 @@ function findLastWhiteSpaceReverse(code, start, end) {
|
|
|
1597
1771
|
}
|
|
1598
1772
|
}
|
|
1599
1773
|
}
|
|
1774
|
+
// A CRLF pair is one line break and must be removed as one. Removing only the
|
|
1775
|
+
// LF leaves the CR, which is still a line terminator, so ASI fires anyway and
|
|
1776
|
+
// the operand after a `return` or `throw` becomes dead code.
|
|
1777
|
+
function getLineBreakStart(code, lineBreakPos) {
|
|
1778
|
+
return lineBreakPos > 0 && code.charCodeAt(lineBreakPos - 1) === 13 /*"\r"*/
|
|
1779
|
+
? lineBreakPos - 1
|
|
1780
|
+
: lineBreakPos;
|
|
1781
|
+
}
|
|
1600
1782
|
// This assumes "code" only contains white-space and comments
|
|
1601
1783
|
// Returns position of line-comment if applicable
|
|
1602
1784
|
function findFirstLineBreakOutsideComment(code) {
|
|
@@ -1605,7 +1787,7 @@ function findFirstLineBreakOutsideComment(code) {
|
|
|
1605
1787
|
while (true) {
|
|
1606
1788
|
start = code.indexOf('/', start);
|
|
1607
1789
|
if (start === -1 || start > lineBreakPos)
|
|
1608
|
-
return [lineBreakPos, lineBreakPos + 1];
|
|
1790
|
+
return [getLineBreakStart(code, lineBreakPos), lineBreakPos + 1];
|
|
1609
1791
|
// With our assumption, '/' always starts a comment. Determine comment type:
|
|
1610
1792
|
charCodeAfterSlash = code.charCodeAt(start + 1);
|
|
1611
1793
|
if (charCodeAfterSlash === 47 /*"/"*/)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.63.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.63.3
|
|
4
|
+
Mon, 14 Sep 2026 12:44:36 GMT - commit 250deca2945f8817350564f7d52bab0f79175d1b
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
import { parse, parseAsync } from '../../native.js';
|
|
11
11
|
import { resolve, dirname, basename, extname } from 'node:path';
|
|
12
12
|
|
|
13
|
+
// Replaces node:path in the browser build. Keep the behavior consistent with
|
|
14
|
+
// the Node build so that both builds handle paths the same way.
|
|
13
15
|
const ANY_SLASH_REGEX = /[/\\]/;
|
|
14
16
|
function relative(from, to) {
|
|
15
17
|
const fromParts = from.split(ANY_SLASH_REGEX).filter(Boolean);
|