@datadog/esbuild-plugin 2.3.1-dev-2 → 2.3.1-dev-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.
@@ -7,7 +7,7 @@ import { lstat, readdir as readdir$1, readlink, realpath } from 'node:fs/promise
7
7
  import { EventEmitter as EventEmitter$1 } from 'node:events';
8
8
  import Stream$1 from 'node:stream';
9
9
  import { StringDecoder } from 'node:string_decoder';
10
- import require$$1, { resolve as resolve$1, isAbsolute, normalize as normalize$1, extname, basename, dirname } from 'path';
10
+ import require$$1, { resolve as resolve$1, extname, isAbsolute, normalize as normalize$1 } from 'path';
11
11
  import require$$0$1 from 'tty';
12
12
  import require$$1$1 from 'util';
13
13
  import { spawn } from 'child_process';
@@ -22,7 +22,6 @@ import { request } from 'https';
22
22
  import { performance as performance$1 } from 'perf_hooks';
23
23
  import * as querystring from 'querystring';
24
24
  import process2 from 'process';
25
- import { createRequire } from 'module';
26
25
 
27
26
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
28
27
 
@@ -2267,9 +2266,9 @@ function retry$1(fn, opts) {
2267
2266
  return new Promise(run);
2268
2267
  }
2269
2268
 
2270
- var lib$2 = retry$1;
2269
+ var lib$3 = retry$1;
2271
2270
 
2272
- var retry$2 = /*@__PURE__*/getDefaultExportFromCjs(lib$2);
2271
+ var retry$2 = /*@__PURE__*/getDefaultExportFromCjs(lib$3);
2273
2272
 
2274
2273
  const formatDuration = (duration) => {
2275
2274
  const days = Math.floor(duration / 1e3 / 60 / 60 / 24);
@@ -20533,7 +20532,7 @@ const getPlugins$2 = (opts, context) => {
20533
20532
  ];
20534
20533
  };
20535
20534
 
20536
- var lib$1 = {exports: {}};
20535
+ var lib$2 = {exports: {}};
20537
20536
 
20538
20537
  var fs$i = {};
20539
20538
 
@@ -23472,9 +23471,9 @@ var output = {
23472
23471
  get () { return fs.promises }
23473
23472
  });
23474
23473
  }
23475
- } (lib$1));
23474
+ } (lib$2));
23476
23475
 
23477
- var libExports = lib$1.exports;
23476
+ var libExports = lib$2.exports;
23478
23477
 
23479
23478
  const CONFIG_KEY = "telemetry";
23480
23479
  const PLUGIN_NAME = `datadog-telemetry-plugin`;
@@ -25476,7 +25475,7 @@ var pp$9 = Parser.prototype;
25476
25475
 
25477
25476
  // ## Parser utilities
25478
25477
 
25479
- var literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
25478
+ var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
25480
25479
  pp$9.strictDirective = function(start) {
25481
25480
  if (this.options.ecmaVersion < 5) { return false }
25482
25481
  for (;;) {
@@ -25662,7 +25661,7 @@ pp$8.isLet = function(context) {
25662
25661
  // Statement) is allowed here. If context is not empty then only a Statement
25663
25662
  // is allowed. However, `let [` is an explicit negative lookahead for
25664
25663
  // ExpressionStatement, so special-case it first.
25665
- if (nextCh === 91 || nextCh === 92) { return true } // '[', '\'
25664
+ if (nextCh === 91 || nextCh === 92) { return true } // '[', '/'
25666
25665
  if (context) { return false }
25667
25666
 
25668
25667
  if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral
@@ -25855,19 +25854,13 @@ pp$8.parseForStatement = function(node) {
25855
25854
  return this.parseFor(node, init$1)
25856
25855
  }
25857
25856
  var startsWithLet = this.isContextual("let"), isForOf = false;
25858
- var containsEsc = this.containsEsc;
25859
25857
  var refDestructuringErrors = new DestructuringErrors;
25860
- var initPos = this.start;
25861
- var init = awaitAt > -1
25862
- ? this.parseExprSubscripts(refDestructuringErrors, "await")
25863
- : this.parseExpression(true, refDestructuringErrors);
25858
+ var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
25864
25859
  if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
25865
- if (awaitAt > -1) { // implies `ecmaVersion >= 9` (see declaration of awaitAt)
25866
- if (this.type === types$1._in) { this.unexpected(awaitAt); }
25867
- node.await = true;
25868
- } else if (isForOf && this.options.ecmaVersion >= 8) {
25869
- if (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async") { this.unexpected(); }
25870
- else if (this.options.ecmaVersion >= 9) { node.await = false; }
25860
+ if (this.options.ecmaVersion >= 9) {
25861
+ if (this.type === types$1._in) {
25862
+ if (awaitAt > -1) { this.unexpected(awaitAt); }
25863
+ } else { node.await = awaitAt > -1; }
25871
25864
  }
25872
25865
  if (startsWithLet && isForOf) { this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); }
25873
25866
  this.toAssignable(init, false, refDestructuringErrors);
@@ -27480,7 +27473,8 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
27480
27473
  node.argument = this.parseMaybeUnary(null, true, update, forInit);
27481
27474
  this.checkExpressionErrors(refDestructuringErrors, true);
27482
27475
  if (update) { this.checkLValSimple(node.argument); }
27483
- else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument))
27476
+ else if (this.strict && node.operator === "delete" &&
27477
+ node.argument.type === "Identifier")
27484
27478
  { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
27485
27479
  else if (node.operator === "delete" && isPrivateFieldAccess(node.argument))
27486
27480
  { this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
@@ -27515,18 +27509,10 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
27515
27509
  }
27516
27510
  };
27517
27511
 
27518
- function isLocalVariableAccess(node) {
27519
- return (
27520
- node.type === "Identifier" ||
27521
- node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression)
27522
- )
27523
- }
27524
-
27525
27512
  function isPrivateFieldAccess(node) {
27526
27513
  return (
27527
27514
  node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
27528
- node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) ||
27529
- node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression)
27515
+ node.type === "ChainExpression" && isPrivateFieldAccess(node.expression)
27530
27516
  )
27531
27517
  }
27532
27518
 
@@ -27953,7 +27939,7 @@ pp$5.parseTemplateElement = function(ref) {
27953
27939
  this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
27954
27940
  }
27955
27941
  elem.value = {
27956
- raw: this.value.replace(/\r\n?/g, "\n"),
27942
+ raw: this.value,
27957
27943
  cooked: null
27958
27944
  };
27959
27945
  } else {
@@ -28628,30 +28614,6 @@ for (var i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) {
28628
28614
 
28629
28615
  var pp$1 = Parser.prototype;
28630
28616
 
28631
- // Track disjunction structure to determine whether a duplicate
28632
- // capture group name is allowed because it is in a separate branch.
28633
- var BranchID = function BranchID(parent, base) {
28634
- // Parent disjunction branch
28635
- this.parent = parent;
28636
- // Identifies this set of sibling branches
28637
- this.base = base || this;
28638
- };
28639
-
28640
- BranchID.prototype.separatedFrom = function separatedFrom (alt) {
28641
- // A branch is separate from another branch if they or any of
28642
- // their parents are siblings in a given disjunction
28643
- for (var self = this; self; self = self.parent) {
28644
- for (var other = alt; other; other = other.parent) {
28645
- if (self.base === other.base && self !== other) { return true }
28646
- }
28647
- }
28648
- return false
28649
- };
28650
-
28651
- BranchID.prototype.sibling = function sibling () {
28652
- return new BranchID(this.parent, this.base)
28653
- };
28654
-
28655
28617
  var RegExpValidationState = function RegExpValidationState(parser) {
28656
28618
  this.parser = parser;
28657
28619
  this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
@@ -28668,9 +28630,8 @@ var RegExpValidationState = function RegExpValidationState(parser) {
28668
28630
  this.lastAssertionIsQuantifiable = false;
28669
28631
  this.numCapturingParens = 0;
28670
28632
  this.maxBackReference = 0;
28671
- this.groupNames = Object.create(null);
28633
+ this.groupNames = [];
28672
28634
  this.backReferenceNames = [];
28673
- this.branchID = null;
28674
28635
  };
28675
28636
 
28676
28637
  RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
@@ -28802,11 +28763,6 @@ pp$1.validateRegExpFlags = function(state) {
28802
28763
  }
28803
28764
  };
28804
28765
 
28805
- function hasProp(obj) {
28806
- for (var _ in obj) { return true }
28807
- return false
28808
- }
28809
-
28810
28766
  /**
28811
28767
  * Validate the pattern part of a given RegExpLiteral.
28812
28768
  *
@@ -28821,7 +28777,7 @@ pp$1.validateRegExpPattern = function(state) {
28821
28777
  // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*
28822
28778
  // exception if _P_ did not conform to the grammar, if any elements of _P_
28823
28779
  // were not matched by the parse, or if any Early Error conditions exist.
28824
- if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) {
28780
+ if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
28825
28781
  state.switchN = true;
28826
28782
  this.regexp_pattern(state);
28827
28783
  }
@@ -28835,9 +28791,8 @@ pp$1.regexp_pattern = function(state) {
28835
28791
  state.lastAssertionIsQuantifiable = false;
28836
28792
  state.numCapturingParens = 0;
28837
28793
  state.maxBackReference = 0;
28838
- state.groupNames = Object.create(null);
28794
+ state.groupNames.length = 0;
28839
28795
  state.backReferenceNames.length = 0;
28840
- state.branchID = null;
28841
28796
 
28842
28797
  this.regexp_disjunction(state);
28843
28798
 
@@ -28856,7 +28811,7 @@ pp$1.regexp_pattern = function(state) {
28856
28811
  for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
28857
28812
  var name = list[i];
28858
28813
 
28859
- if (!state.groupNames[name]) {
28814
+ if (state.groupNames.indexOf(name) === -1) {
28860
28815
  state.raise("Invalid named capture referenced");
28861
28816
  }
28862
28817
  }
@@ -28864,14 +28819,10 @@ pp$1.regexp_pattern = function(state) {
28864
28819
 
28865
28820
  // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
28866
28821
  pp$1.regexp_disjunction = function(state) {
28867
- var trackDisjunction = this.options.ecmaVersion >= 16;
28868
- if (trackDisjunction) { state.branchID = new BranchID(state.branchID, null); }
28869
28822
  this.regexp_alternative(state);
28870
28823
  while (state.eat(0x7C /* | */)) {
28871
- if (trackDisjunction) { state.branchID = state.branchID.sibling(); }
28872
28824
  this.regexp_alternative(state);
28873
28825
  }
28874
- if (trackDisjunction) { state.branchID = state.branchID.parent; }
28875
28826
 
28876
28827
  // Make the same message as V8.
28877
28828
  if (this.regexp_eatQuantifier(state, true)) {
@@ -28884,7 +28835,8 @@ pp$1.regexp_disjunction = function(state) {
28884
28835
 
28885
28836
  // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
28886
28837
  pp$1.regexp_alternative = function(state) {
28887
- while (state.pos < state.source.length && this.regexp_eatTerm(state)) {}
28838
+ while (state.pos < state.source.length && this.regexp_eatTerm(state))
28839
+ { }
28888
28840
  };
28889
28841
 
28890
28842
  // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
@@ -29122,26 +29074,14 @@ pp$1.regexp_eatExtendedPatternCharacter = function(state) {
29122
29074
  // `?` GroupName
29123
29075
  pp$1.regexp_groupSpecifier = function(state) {
29124
29076
  if (state.eat(0x3F /* ? */)) {
29125
- if (!this.regexp_eatGroupName(state)) { state.raise("Invalid group"); }
29126
- var trackDisjunction = this.options.ecmaVersion >= 16;
29127
- var known = state.groupNames[state.lastStringValue];
29128
- if (known) {
29129
- if (trackDisjunction) {
29130
- for (var i = 0, list = known; i < list.length; i += 1) {
29131
- var altID = list[i];
29132
-
29133
- if (!altID.separatedFrom(state.branchID))
29134
- { state.raise("Duplicate capture group name"); }
29135
- }
29136
- } else {
29077
+ if (this.regexp_eatGroupName(state)) {
29078
+ if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
29137
29079
  state.raise("Duplicate capture group name");
29138
29080
  }
29081
+ state.groupNames.push(state.lastStringValue);
29082
+ return
29139
29083
  }
29140
- if (trackDisjunction) {
29141
- (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
29142
- } else {
29143
- state.groupNames[state.lastStringValue] = true;
29144
- }
29084
+ state.raise("Invalid group");
29145
29085
  }
29146
29086
  };
29147
29087
 
@@ -30646,18 +30586,15 @@ pp.readInvalidTemplateToken = function() {
30646
30586
  break
30647
30587
 
30648
30588
  case "$":
30649
- if (this.input[this.pos + 1] !== "{") { break }
30650
- // fall through
30589
+ if (this.input[this.pos + 1] !== "{") {
30590
+ break
30591
+ }
30592
+
30593
+ // falls through
30651
30594
  case "`":
30652
30595
  return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
30653
30596
 
30654
- case "\r":
30655
- if (this.input[this.pos + 1] === "\n") { ++this.pos; }
30656
- // fall through
30657
- case "\n": case "\u2028": case "\u2029":
30658
- ++this.curLine;
30659
- this.lineStart = this.pos + 1;
30660
- break
30597
+ // no default
30661
30598
  }
30662
30599
  }
30663
30600
  this.raise(this.start, "Unterminated template");
@@ -30720,7 +30657,6 @@ pp.readEscapedChar = function(inTemplate) {
30720
30657
  if (isNewLine(ch)) {
30721
30658
  // Unicode new line characters after \ get removed from output in both
30722
30659
  // template literals and strings
30723
- if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }
30724
30660
  return ""
30725
30661
  }
30726
30662
  return String.fromCharCode(ch)
@@ -30799,7 +30735,7 @@ pp.readWord = function() {
30799
30735
  // [walk]: util/walk.js
30800
30736
 
30801
30737
 
30802
- var version$2 = "8.12.1";
30738
+ var version$2 = "8.11.3";
30803
30739
 
30804
30740
  Parser.acorn = {
30805
30741
  Parser: Parser,
@@ -30823,6 +30759,3486 @@ Parser.acorn = {
30823
30759
  nonASCIIwhitespace: nonASCIIwhitespace
30824
30760
  };
30825
30761
 
30762
+ var lib$1 = {};
30763
+
30764
+ /*
30765
+ MIT License http://www.opensource.org/licenses/mit-license.php
30766
+ Author Tobias Koppers @sokra
30767
+ */
30768
+
30769
+ var Source_1;
30770
+ var hasRequiredSource;
30771
+
30772
+ function requireSource () {
30773
+ if (hasRequiredSource) return Source_1;
30774
+ hasRequiredSource = 1;
30775
+
30776
+ class Source {
30777
+ source() {
30778
+ throw new Error("Abstract");
30779
+ }
30780
+
30781
+ buffer() {
30782
+ const source = this.source();
30783
+ if (Buffer.isBuffer(source)) return source;
30784
+ return Buffer.from(source, "utf-8");
30785
+ }
30786
+
30787
+ size() {
30788
+ return this.buffer().length;
30789
+ }
30790
+
30791
+ map(options) {
30792
+ return null;
30793
+ }
30794
+
30795
+ sourceAndMap(options) {
30796
+ return {
30797
+ source: this.source(),
30798
+ map: this.map(options)
30799
+ };
30800
+ }
30801
+
30802
+ updateHash(hash) {
30803
+ throw new Error("Abstract");
30804
+ }
30805
+ }
30806
+
30807
+ Source_1 = Source;
30808
+ return Source_1;
30809
+ }
30810
+
30811
+ /*
30812
+ MIT License http://www.opensource.org/licenses/mit-license.php
30813
+ Author Tobias Koppers @sokra
30814
+ */
30815
+
30816
+ var getGeneratedSourceInfo_1;
30817
+ var hasRequiredGetGeneratedSourceInfo;
30818
+
30819
+ function requireGetGeneratedSourceInfo () {
30820
+ if (hasRequiredGetGeneratedSourceInfo) return getGeneratedSourceInfo_1;
30821
+ hasRequiredGetGeneratedSourceInfo = 1;
30822
+
30823
+ const CHAR_CODE_NEW_LINE = "\n".charCodeAt(0);
30824
+
30825
+ const getGeneratedSourceInfo = source => {
30826
+ if (source === undefined) {
30827
+ return {};
30828
+ }
30829
+ const lastLineStart = source.lastIndexOf("\n");
30830
+ if (lastLineStart === -1) {
30831
+ return {
30832
+ generatedLine: 1,
30833
+ generatedColumn: source.length,
30834
+ source
30835
+ };
30836
+ }
30837
+ let generatedLine = 2;
30838
+ for (let i = 0; i < lastLineStart; i++) {
30839
+ if (source.charCodeAt(i) === CHAR_CODE_NEW_LINE) generatedLine++;
30840
+ }
30841
+ return {
30842
+ generatedLine,
30843
+ generatedColumn: source.length - lastLineStart - 1,
30844
+ source
30845
+ };
30846
+ };
30847
+
30848
+ getGeneratedSourceInfo_1 = getGeneratedSourceInfo;
30849
+ return getGeneratedSourceInfo_1;
30850
+ }
30851
+
30852
+ var splitIntoLines_1;
30853
+ var hasRequiredSplitIntoLines;
30854
+
30855
+ function requireSplitIntoLines () {
30856
+ if (hasRequiredSplitIntoLines) return splitIntoLines_1;
30857
+ hasRequiredSplitIntoLines = 1;
30858
+ const splitIntoLines = str => {
30859
+ const results = [];
30860
+ const len = str.length;
30861
+ let i = 0;
30862
+ for (; i < len; ) {
30863
+ const cc = str.charCodeAt(i);
30864
+ // 10 is "\n".charCodeAt(0)
30865
+ if (cc === 10) {
30866
+ results.push("\n");
30867
+ i++;
30868
+ } else {
30869
+ let j = i + 1;
30870
+ // 10 is "\n".charCodeAt(0)
30871
+ while (j < len && str.charCodeAt(j) !== 10) j++;
30872
+ results.push(str.slice(i, j + 1));
30873
+ i = j + 1;
30874
+ }
30875
+ }
30876
+ return results;
30877
+ };
30878
+ splitIntoLines_1 = splitIntoLines;
30879
+ return splitIntoLines_1;
30880
+ }
30881
+
30882
+ /*
30883
+ MIT License http://www.opensource.org/licenses/mit-license.php
30884
+ Author Tobias Koppers @sokra
30885
+ */
30886
+
30887
+ var streamChunksOfRawSource_1;
30888
+ var hasRequiredStreamChunksOfRawSource;
30889
+
30890
+ function requireStreamChunksOfRawSource () {
30891
+ if (hasRequiredStreamChunksOfRawSource) return streamChunksOfRawSource_1;
30892
+ hasRequiredStreamChunksOfRawSource = 1;
30893
+
30894
+ const getGeneratedSourceInfo = requireGetGeneratedSourceInfo();
30895
+ const splitIntoLines = requireSplitIntoLines();
30896
+
30897
+ const streamChunksOfRawSource = (source, onChunk, onSource, onName) => {
30898
+ let line = 1;
30899
+ const matches = splitIntoLines(source);
30900
+ let match;
30901
+ for (match of matches) {
30902
+ onChunk(match, line, 0, -1, -1, -1, -1);
30903
+ line++;
30904
+ }
30905
+ return matches.length === 0 || match.endsWith("\n")
30906
+ ? {
30907
+ generatedLine: matches.length + 1,
30908
+ generatedColumn: 0
30909
+ }
30910
+ : {
30911
+ generatedLine: matches.length,
30912
+ generatedColumn: match.length
30913
+ };
30914
+ };
30915
+
30916
+ streamChunksOfRawSource_1 = (source, onChunk, onSource, onName, finalSource) => {
30917
+ return finalSource
30918
+ ? getGeneratedSourceInfo(source)
30919
+ : streamChunksOfRawSource(source, onChunk);
30920
+ };
30921
+ return streamChunksOfRawSource_1;
30922
+ }
30923
+
30924
+ /*
30925
+ MIT License http://www.opensource.org/licenses/mit-license.php
30926
+ Author Tobias Koppers @sokra
30927
+ */
30928
+
30929
+ var RawSource_1;
30930
+ var hasRequiredRawSource;
30931
+
30932
+ function requireRawSource () {
30933
+ if (hasRequiredRawSource) return RawSource_1;
30934
+ hasRequiredRawSource = 1;
30935
+
30936
+ const streamChunksOfRawSource = requireStreamChunksOfRawSource();
30937
+ const Source = requireSource();
30938
+
30939
+ class RawSource extends Source {
30940
+ constructor(value, convertToString = false) {
30941
+ super();
30942
+ const isBuffer = Buffer.isBuffer(value);
30943
+ if (!isBuffer && typeof value !== "string") {
30944
+ throw new TypeError("argument 'value' must be either string of Buffer");
30945
+ }
30946
+ this._valueIsBuffer = !convertToString && isBuffer;
30947
+ this._value = convertToString && isBuffer ? undefined : value;
30948
+ this._valueAsBuffer = isBuffer ? value : undefined;
30949
+ this._valueAsString = isBuffer ? undefined : value;
30950
+ }
30951
+
30952
+ isBuffer() {
30953
+ return this._valueIsBuffer;
30954
+ }
30955
+
30956
+ source() {
30957
+ if (this._value === undefined) {
30958
+ this._value = this._valueAsBuffer.toString("utf-8");
30959
+ }
30960
+ return this._value;
30961
+ }
30962
+
30963
+ buffer() {
30964
+ if (this._valueAsBuffer === undefined) {
30965
+ this._valueAsBuffer = Buffer.from(this._value, "utf-8");
30966
+ }
30967
+ return this._valueAsBuffer;
30968
+ }
30969
+
30970
+ map(options) {
30971
+ return null;
30972
+ }
30973
+
30974
+ /**
30975
+ * @param {object} options options
30976
+ * @param {function(string, number, number, number, number, number, number): void} onChunk called for each chunk of code
30977
+ * @param {function(number, string, string)} onSource called for each source
30978
+ * @param {function(number, string)} onName called for each name
30979
+ * @returns {void}
30980
+ */
30981
+ streamChunks(options, onChunk, onSource, onName) {
30982
+ if (this._value === undefined) {
30983
+ this._value = Buffer.from(this._valueAsBuffer, "utf-8");
30984
+ }
30985
+ if (this._valueAsString === undefined) {
30986
+ this._valueAsString =
30987
+ typeof this._value === "string"
30988
+ ? this._value
30989
+ : this._value.toString("utf-8");
30990
+ }
30991
+ return streamChunksOfRawSource(
30992
+ this._valueAsString,
30993
+ onChunk,
30994
+ onSource,
30995
+ onName,
30996
+ !!(options && options.finalSource)
30997
+ );
30998
+ }
30999
+
31000
+ updateHash(hash) {
31001
+ if (this._valueAsBuffer === undefined) {
31002
+ this._valueAsBuffer = Buffer.from(this._value, "utf-8");
31003
+ }
31004
+ hash.update("RawSource");
31005
+ hash.update(this._valueAsBuffer);
31006
+ }
31007
+ }
31008
+
31009
+ RawSource_1 = RawSource;
31010
+ return RawSource_1;
31011
+ }
31012
+
31013
+ var getFromStreamChunks = {};
31014
+
31015
+ /*
31016
+ MIT License http://www.opensource.org/licenses/mit-license.php
31017
+ Author Tobias Koppers @sokra
31018
+ */
31019
+
31020
+ var createMappingsSerializer_1;
31021
+ var hasRequiredCreateMappingsSerializer;
31022
+
31023
+ function requireCreateMappingsSerializer () {
31024
+ if (hasRequiredCreateMappingsSerializer) return createMappingsSerializer_1;
31025
+ hasRequiredCreateMappingsSerializer = 1;
31026
+
31027
+ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(
31028
+ ""
31029
+ );
31030
+
31031
+ const CONTINUATION_BIT = 0x20;
31032
+
31033
+ const createMappingsSerializer = options => {
31034
+ const linesOnly = options && options.columns === false;
31035
+ return linesOnly
31036
+ ? createLinesOnlyMappingsSerializer()
31037
+ : createFullMappingsSerializer();
31038
+ };
31039
+
31040
+ const createFullMappingsSerializer = () => {
31041
+ let currentLine = 1;
31042
+ let currentColumn = 0;
31043
+ let currentSourceIndex = 0;
31044
+ let currentOriginalLine = 1;
31045
+ let currentOriginalColumn = 0;
31046
+ let currentNameIndex = 0;
31047
+ let activeMapping = false;
31048
+ let activeName = false;
31049
+ let initial = true;
31050
+ return (
31051
+ generatedLine,
31052
+ generatedColumn,
31053
+ sourceIndex,
31054
+ originalLine,
31055
+ originalColumn,
31056
+ nameIndex
31057
+ ) => {
31058
+ if (activeMapping && currentLine === generatedLine) {
31059
+ // A mapping is still active
31060
+ if (
31061
+ sourceIndex === currentSourceIndex &&
31062
+ originalLine === currentOriginalLine &&
31063
+ originalColumn === currentOriginalColumn &&
31064
+ !activeName &&
31065
+ nameIndex < 0
31066
+ ) {
31067
+ // avoid repeating the same original mapping
31068
+ return "";
31069
+ }
31070
+ } else {
31071
+ // No mapping is active
31072
+ if (sourceIndex < 0) {
31073
+ // avoid writing unneccessary generated mappings
31074
+ return "";
31075
+ }
31076
+ }
31077
+
31078
+ let str;
31079
+ if (currentLine < generatedLine) {
31080
+ str = ";".repeat(generatedLine - currentLine);
31081
+ currentLine = generatedLine;
31082
+ currentColumn = 0;
31083
+ initial = false;
31084
+ } else if (initial) {
31085
+ str = "";
31086
+ initial = false;
31087
+ } else {
31088
+ str = ",";
31089
+ }
31090
+
31091
+ const writeValue = value => {
31092
+ const sign = (value >>> 31) & 1;
31093
+ const mask = value >> 31;
31094
+ const absValue = (value + mask) ^ mask;
31095
+ let data = (absValue << 1) | sign;
31096
+ for (;;) {
31097
+ const sextet = data & 0x1f;
31098
+ data >>= 5;
31099
+ if (data === 0) {
31100
+ str += ALPHABET[sextet];
31101
+ break;
31102
+ } else {
31103
+ str += ALPHABET[sextet | CONTINUATION_BIT];
31104
+ }
31105
+ }
31106
+ };
31107
+ writeValue(generatedColumn - currentColumn);
31108
+ currentColumn = generatedColumn;
31109
+ if (sourceIndex >= 0) {
31110
+ activeMapping = true;
31111
+ if (sourceIndex === currentSourceIndex) {
31112
+ str += "A";
31113
+ } else {
31114
+ writeValue(sourceIndex - currentSourceIndex);
31115
+ currentSourceIndex = sourceIndex;
31116
+ }
31117
+ writeValue(originalLine - currentOriginalLine);
31118
+ currentOriginalLine = originalLine;
31119
+ if (originalColumn === currentOriginalColumn) {
31120
+ str += "A";
31121
+ } else {
31122
+ writeValue(originalColumn - currentOriginalColumn);
31123
+ currentOriginalColumn = originalColumn;
31124
+ }
31125
+ if (nameIndex >= 0) {
31126
+ writeValue(nameIndex - currentNameIndex);
31127
+ currentNameIndex = nameIndex;
31128
+ activeName = true;
31129
+ } else {
31130
+ activeName = false;
31131
+ }
31132
+ } else {
31133
+ activeMapping = false;
31134
+ }
31135
+ return str;
31136
+ };
31137
+ };
31138
+
31139
+ const createLinesOnlyMappingsSerializer = () => {
31140
+ let lastWrittenLine = 0;
31141
+ let currentLine = 1;
31142
+ let currentSourceIndex = 0;
31143
+ let currentOriginalLine = 1;
31144
+ return (
31145
+ generatedLine,
31146
+ _generatedColumn,
31147
+ sourceIndex,
31148
+ originalLine,
31149
+ _originalColumn,
31150
+ _nameIndex
31151
+ ) => {
31152
+ if (sourceIndex < 0) {
31153
+ // avoid writing generated mappings at all
31154
+ return "";
31155
+ }
31156
+ if (lastWrittenLine === generatedLine) {
31157
+ // avoid writing multiple original mappings per line
31158
+ return "";
31159
+ }
31160
+ let str;
31161
+ const writeValue = value => {
31162
+ const sign = (value >>> 31) & 1;
31163
+ const mask = value >> 31;
31164
+ const absValue = (value + mask) ^ mask;
31165
+ let data = (absValue << 1) | sign;
31166
+ for (;;) {
31167
+ const sextet = data & 0x1f;
31168
+ data >>= 5;
31169
+ if (data === 0) {
31170
+ str += ALPHABET[sextet];
31171
+ break;
31172
+ } else {
31173
+ str += ALPHABET[sextet | CONTINUATION_BIT];
31174
+ }
31175
+ }
31176
+ };
31177
+ lastWrittenLine = generatedLine;
31178
+ if (generatedLine === currentLine + 1) {
31179
+ currentLine = generatedLine;
31180
+ if (sourceIndex === currentSourceIndex) {
31181
+ currentSourceIndex = sourceIndex;
31182
+ if (originalLine === currentOriginalLine + 1) {
31183
+ currentOriginalLine = originalLine;
31184
+ return ";AACA";
31185
+ } else {
31186
+ str = ";AA";
31187
+ writeValue(originalLine - currentOriginalLine);
31188
+ currentOriginalLine = originalLine;
31189
+ return str + "A";
31190
+ }
31191
+ } else {
31192
+ str = ";A";
31193
+ writeValue(sourceIndex - currentSourceIndex);
31194
+ currentSourceIndex = sourceIndex;
31195
+ writeValue(originalLine - currentOriginalLine);
31196
+ currentOriginalLine = originalLine;
31197
+ return str + "A";
31198
+ }
31199
+ } else {
31200
+ str = ";".repeat(generatedLine - currentLine);
31201
+ currentLine = generatedLine;
31202
+ if (sourceIndex === currentSourceIndex) {
31203
+ currentSourceIndex = sourceIndex;
31204
+ if (originalLine === currentOriginalLine + 1) {
31205
+ currentOriginalLine = originalLine;
31206
+ return str + "AACA";
31207
+ } else {
31208
+ str += "AA";
31209
+ writeValue(originalLine - currentOriginalLine);
31210
+ currentOriginalLine = originalLine;
31211
+ return str + "A";
31212
+ }
31213
+ } else {
31214
+ str += "A";
31215
+ writeValue(sourceIndex - currentSourceIndex);
31216
+ currentSourceIndex = sourceIndex;
31217
+ writeValue(originalLine - currentOriginalLine);
31218
+ currentOriginalLine = originalLine;
31219
+ return str + "A";
31220
+ }
31221
+ }
31222
+ };
31223
+ };
31224
+
31225
+ createMappingsSerializer_1 = createMappingsSerializer;
31226
+ return createMappingsSerializer_1;
31227
+ }
31228
+
31229
+ /*
31230
+ MIT License http://www.opensource.org/licenses/mit-license.php
31231
+ Author Tobias Koppers @sokra
31232
+ */
31233
+
31234
+ var hasRequiredGetFromStreamChunks;
31235
+
31236
+ function requireGetFromStreamChunks () {
31237
+ if (hasRequiredGetFromStreamChunks) return getFromStreamChunks;
31238
+ hasRequiredGetFromStreamChunks = 1;
31239
+
31240
+ const createMappingsSerializer = requireCreateMappingsSerializer();
31241
+
31242
+ getFromStreamChunks.getSourceAndMap = (inputSource, options) => {
31243
+ let code = "";
31244
+ let mappings = "";
31245
+ let sources = [];
31246
+ let sourcesContent = [];
31247
+ let names = [];
31248
+ const addMapping = createMappingsSerializer(options);
31249
+ const { source } = inputSource.streamChunks(
31250
+ Object.assign({}, options, { finalSource: true }),
31251
+ (
31252
+ chunk,
31253
+ generatedLine,
31254
+ generatedColumn,
31255
+ sourceIndex,
31256
+ originalLine,
31257
+ originalColumn,
31258
+ nameIndex
31259
+ ) => {
31260
+ if (chunk !== undefined) code += chunk;
31261
+ mappings += addMapping(
31262
+ generatedLine,
31263
+ generatedColumn,
31264
+ sourceIndex,
31265
+ originalLine,
31266
+ originalColumn,
31267
+ nameIndex
31268
+ );
31269
+ },
31270
+ (sourceIndex, source, sourceContent) => {
31271
+ while (sources.length < sourceIndex) {
31272
+ sources.push(null);
31273
+ }
31274
+ sources[sourceIndex] = source;
31275
+ if (sourceContent !== undefined) {
31276
+ while (sourcesContent.length < sourceIndex) {
31277
+ sourcesContent.push(null);
31278
+ }
31279
+ sourcesContent[sourceIndex] = sourceContent;
31280
+ }
31281
+ },
31282
+ (nameIndex, name) => {
31283
+ while (names.length < nameIndex) {
31284
+ names.push(null);
31285
+ }
31286
+ names[nameIndex] = name;
31287
+ }
31288
+ );
31289
+ return {
31290
+ source: source !== undefined ? source : code,
31291
+ map:
31292
+ mappings.length > 0
31293
+ ? {
31294
+ version: 3,
31295
+ file: "x",
31296
+ mappings,
31297
+ sources,
31298
+ sourcesContent:
31299
+ sourcesContent.length > 0 ? sourcesContent : undefined,
31300
+ names
31301
+ }
31302
+ : null
31303
+ };
31304
+ };
31305
+
31306
+ getFromStreamChunks.getMap = (source, options) => {
31307
+ let mappings = "";
31308
+ let sources = [];
31309
+ let sourcesContent = [];
31310
+ let names = [];
31311
+ const addMapping = createMappingsSerializer(options);
31312
+ source.streamChunks(
31313
+ Object.assign({}, options, { source: false, finalSource: true }),
31314
+ (
31315
+ chunk,
31316
+ generatedLine,
31317
+ generatedColumn,
31318
+ sourceIndex,
31319
+ originalLine,
31320
+ originalColumn,
31321
+ nameIndex
31322
+ ) => {
31323
+ mappings += addMapping(
31324
+ generatedLine,
31325
+ generatedColumn,
31326
+ sourceIndex,
31327
+ originalLine,
31328
+ originalColumn,
31329
+ nameIndex
31330
+ );
31331
+ },
31332
+ (sourceIndex, source, sourceContent) => {
31333
+ while (sources.length < sourceIndex) {
31334
+ sources.push(null);
31335
+ }
31336
+ sources[sourceIndex] = source;
31337
+ if (sourceContent !== undefined) {
31338
+ while (sourcesContent.length < sourceIndex) {
31339
+ sourcesContent.push(null);
31340
+ }
31341
+ sourcesContent[sourceIndex] = sourceContent;
31342
+ }
31343
+ },
31344
+ (nameIndex, name) => {
31345
+ while (names.length < nameIndex) {
31346
+ names.push(null);
31347
+ }
31348
+ names[nameIndex] = name;
31349
+ }
31350
+ );
31351
+ return mappings.length > 0
31352
+ ? {
31353
+ version: 3,
31354
+ file: "x",
31355
+ mappings,
31356
+ sources,
31357
+ sourcesContent: sourcesContent.length > 0 ? sourcesContent : undefined,
31358
+ names
31359
+ }
31360
+ : null;
31361
+ };
31362
+ return getFromStreamChunks;
31363
+ }
31364
+
31365
+ var splitIntoPotentialTokens_1;
31366
+ var hasRequiredSplitIntoPotentialTokens;
31367
+
31368
+ function requireSplitIntoPotentialTokens () {
31369
+ if (hasRequiredSplitIntoPotentialTokens) return splitIntoPotentialTokens_1;
31370
+ hasRequiredSplitIntoPotentialTokens = 1;
31371
+ // \n = 10
31372
+ // ; = 59
31373
+ // { = 123
31374
+ // } = 125
31375
+ // <space> = 32
31376
+ // \r = 13
31377
+ // \t = 9
31378
+
31379
+ const splitIntoPotentialTokens = str => {
31380
+ const len = str.length;
31381
+ if (len === 0) return null;
31382
+ const results = [];
31383
+ let i = 0;
31384
+ for (; i < len; ) {
31385
+ const s = i;
31386
+ block: {
31387
+ let cc = str.charCodeAt(i);
31388
+ while (cc !== 10 && cc !== 59 && cc !== 123 && cc !== 125) {
31389
+ if (++i >= len) break block;
31390
+ cc = str.charCodeAt(i);
31391
+ }
31392
+ while (
31393
+ cc === 59 ||
31394
+ cc === 32 ||
31395
+ cc === 123 ||
31396
+ cc === 125 ||
31397
+ cc === 13 ||
31398
+ cc === 9
31399
+ ) {
31400
+ if (++i >= len) break block;
31401
+ cc = str.charCodeAt(i);
31402
+ }
31403
+ if (cc === 10) {
31404
+ i++;
31405
+ }
31406
+ }
31407
+ results.push(str.slice(s, i));
31408
+ }
31409
+ return results;
31410
+ };
31411
+ splitIntoPotentialTokens_1 = splitIntoPotentialTokens;
31412
+ return splitIntoPotentialTokens_1;
31413
+ }
31414
+
31415
+ /*
31416
+ MIT License http://www.opensource.org/licenses/mit-license.php
31417
+ Author Tobias Koppers @sokra
31418
+ */
31419
+
31420
+ var OriginalSource_1;
31421
+ var hasRequiredOriginalSource;
31422
+
31423
+ function requireOriginalSource () {
31424
+ if (hasRequiredOriginalSource) return OriginalSource_1;
31425
+ hasRequiredOriginalSource = 1;
31426
+
31427
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
31428
+ const splitIntoLines = requireSplitIntoLines();
31429
+ const getGeneratedSourceInfo = requireGetGeneratedSourceInfo();
31430
+ const Source = requireSource();
31431
+ const splitIntoPotentialTokens = requireSplitIntoPotentialTokens();
31432
+
31433
+ class OriginalSource extends Source {
31434
+ constructor(value, name) {
31435
+ super();
31436
+ const isBuffer = Buffer.isBuffer(value);
31437
+ this._value = isBuffer ? undefined : value;
31438
+ this._valueAsBuffer = isBuffer ? value : undefined;
31439
+ this._name = name;
31440
+ }
31441
+
31442
+ getName() {
31443
+ return this._name;
31444
+ }
31445
+
31446
+ source() {
31447
+ if (this._value === undefined) {
31448
+ this._value = this._valueAsBuffer.toString("utf-8");
31449
+ }
31450
+ return this._value;
31451
+ }
31452
+
31453
+ buffer() {
31454
+ if (this._valueAsBuffer === undefined) {
31455
+ this._valueAsBuffer = Buffer.from(this._value, "utf-8");
31456
+ }
31457
+ return this._valueAsBuffer;
31458
+ }
31459
+
31460
+ map(options) {
31461
+ return getMap(this, options);
31462
+ }
31463
+
31464
+ sourceAndMap(options) {
31465
+ return getSourceAndMap(this, options);
31466
+ }
31467
+
31468
+ /**
31469
+ * @param {object} options options
31470
+ * @param {function(string, number, number, number, number, number, number): void} onChunk called for each chunk of code
31471
+ * @param {function(number, string, string)} onSource called for each source
31472
+ * @param {function(number, string)} onName called for each name
31473
+ * @returns {void}
31474
+ */
31475
+ streamChunks(options, onChunk, onSource, onName) {
31476
+ if (this._value === undefined) {
31477
+ this._value = this._valueAsBuffer.toString("utf-8");
31478
+ }
31479
+ onSource(0, this._name, this._value);
31480
+ const finalSource = !!(options && options.finalSource);
31481
+ if (!options || options.columns !== false) {
31482
+ // With column info we need to read all lines and split them
31483
+ const matches = splitIntoPotentialTokens(this._value);
31484
+ let line = 1;
31485
+ let column = 0;
31486
+ if (matches !== null) {
31487
+ for (const match of matches) {
31488
+ const isEndOfLine = match.endsWith("\n");
31489
+ if (isEndOfLine && match.length === 1) {
31490
+ if (!finalSource) onChunk(match, line, column, -1, -1, -1, -1);
31491
+ } else {
31492
+ const chunk = finalSource ? undefined : match;
31493
+ onChunk(chunk, line, column, 0, line, column, -1);
31494
+ }
31495
+ if (isEndOfLine) {
31496
+ line++;
31497
+ column = 0;
31498
+ } else {
31499
+ column += match.length;
31500
+ }
31501
+ }
31502
+ }
31503
+ return {
31504
+ generatedLine: line,
31505
+ generatedColumn: column,
31506
+ source: finalSource ? this._value : undefined
31507
+ };
31508
+ } else if (finalSource) {
31509
+ // Without column info and with final source we only
31510
+ // need meta info to generate mapping
31511
+ const result = getGeneratedSourceInfo(this._value);
31512
+ const { generatedLine, generatedColumn } = result;
31513
+ if (generatedColumn === 0) {
31514
+ for (let line = 1; line < generatedLine; line++)
31515
+ onChunk(undefined, line, 0, 0, line, 0, -1);
31516
+ } else {
31517
+ for (let line = 1; line <= generatedLine; line++)
31518
+ onChunk(undefined, line, 0, 0, line, 0, -1);
31519
+ }
31520
+ return result;
31521
+ } else {
31522
+ // Without column info, but also without final source
31523
+ // we need to split source by lines
31524
+ let line = 1;
31525
+ const matches = splitIntoLines(this._value);
31526
+ let match;
31527
+ for (match of matches) {
31528
+ onChunk(finalSource ? undefined : match, line, 0, 0, line, 0, -1);
31529
+ line++;
31530
+ }
31531
+ return matches.length === 0 || match.endsWith("\n")
31532
+ ? {
31533
+ generatedLine: matches.length + 1,
31534
+ generatedColumn: 0,
31535
+ source: finalSource ? this._value : undefined
31536
+ }
31537
+ : {
31538
+ generatedLine: matches.length,
31539
+ generatedColumn: match.length,
31540
+ source: finalSource ? this._value : undefined
31541
+ };
31542
+ }
31543
+ }
31544
+
31545
+ updateHash(hash) {
31546
+ if (this._valueAsBuffer === undefined) {
31547
+ this._valueAsBuffer = Buffer.from(this._value, "utf-8");
31548
+ }
31549
+ hash.update("OriginalSource");
31550
+ hash.update(this._valueAsBuffer);
31551
+ hash.update(this._name || "");
31552
+ }
31553
+ }
31554
+
31555
+ OriginalSource_1 = OriginalSource;
31556
+ return OriginalSource_1;
31557
+ }
31558
+
31559
+ /*
31560
+ MIT License http://www.opensource.org/licenses/mit-license.php
31561
+ Author Tobias Koppers @sokra
31562
+ */
31563
+
31564
+ var getSource_1;
31565
+ var hasRequiredGetSource;
31566
+
31567
+ function requireGetSource () {
31568
+ if (hasRequiredGetSource) return getSource_1;
31569
+ hasRequiredGetSource = 1;
31570
+
31571
+ const getSource = (sourceMap, index) => {
31572
+ if (index < 0) return null;
31573
+ const { sourceRoot, sources } = sourceMap;
31574
+ const source = sources[index];
31575
+ if (!sourceRoot) return source;
31576
+ if (sourceRoot.endsWith("/")) return sourceRoot + source;
31577
+ return sourceRoot + "/" + source;
31578
+ };
31579
+
31580
+ getSource_1 = getSource;
31581
+ return getSource_1;
31582
+ }
31583
+
31584
+ /*
31585
+ MIT License http://www.opensource.org/licenses/mit-license.php
31586
+ Author Tobias Koppers @sokra
31587
+ */
31588
+
31589
+ var readMappings_1;
31590
+ var hasRequiredReadMappings;
31591
+
31592
+ function requireReadMappings () {
31593
+ if (hasRequiredReadMappings) return readMappings_1;
31594
+ hasRequiredReadMappings = 1;
31595
+
31596
+ const ALPHABET =
31597
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
31598
+
31599
+ const CONTINUATION_BIT = 0x20;
31600
+ const END_SEGMENT_BIT = 0x40;
31601
+ const NEXT_LINE = END_SEGMENT_BIT | 0x01;
31602
+ const INVALID = END_SEGMENT_BIT | 0x02;
31603
+ const DATA_MASK = 0x1f;
31604
+
31605
+ const ccToValue = new Uint8Array("z".charCodeAt(0) + 1);
31606
+ {
31607
+ ccToValue.fill(INVALID);
31608
+ for (let i = 0; i < ALPHABET.length; i++) {
31609
+ ccToValue[ALPHABET.charCodeAt(i)] = i;
31610
+ }
31611
+ ccToValue[",".charCodeAt(0)] = END_SEGMENT_BIT;
31612
+ ccToValue[";".charCodeAt(0)] = NEXT_LINE;
31613
+ }
31614
+ const ccMax = ccToValue.length - 1;
31615
+
31616
+ /**
31617
+ * @param {string} mappings the mappings string
31618
+ * @param {function(number, number, number, number, number, number): void} onMapping called for each mapping
31619
+ * @returns {void}
31620
+ */
31621
+ const readMappings = (mappings, onMapping) => {
31622
+ // generatedColumn, [sourceIndex, originalLine, orignalColumn, [nameIndex]]
31623
+ const currentData = new Uint32Array([0, 0, 1, 0, 0]);
31624
+ let currentDataPos = 0;
31625
+ // currentValue will include a sign bit at bit 0
31626
+ let currentValue = 0;
31627
+ let currentValuePos = 0;
31628
+ let generatedLine = 1;
31629
+ let generatedColumn = -1;
31630
+ for (let i = 0; i < mappings.length; i++) {
31631
+ const cc = mappings.charCodeAt(i);
31632
+ if (cc > ccMax) continue;
31633
+ const value = ccToValue[cc];
31634
+ if ((value & END_SEGMENT_BIT) !== 0) {
31635
+ // End current segment
31636
+ if (currentData[0] > generatedColumn) {
31637
+ if (currentDataPos === 1) {
31638
+ onMapping(generatedLine, currentData[0], -1, -1, -1, -1);
31639
+ } else if (currentDataPos === 4) {
31640
+ onMapping(
31641
+ generatedLine,
31642
+ currentData[0],
31643
+ currentData[1],
31644
+ currentData[2],
31645
+ currentData[3],
31646
+ -1
31647
+ );
31648
+ } else if (currentDataPos === 5) {
31649
+ onMapping(
31650
+ generatedLine,
31651
+ currentData[0],
31652
+ currentData[1],
31653
+ currentData[2],
31654
+ currentData[3],
31655
+ currentData[4]
31656
+ );
31657
+ }
31658
+ generatedColumn = currentData[0];
31659
+ }
31660
+ currentDataPos = 0;
31661
+ if (value === NEXT_LINE) {
31662
+ // Start new line
31663
+ generatedLine++;
31664
+ currentData[0] = 0;
31665
+ generatedColumn = -1;
31666
+ }
31667
+ } else if ((value & CONTINUATION_BIT) === 0) {
31668
+ // last sextet
31669
+ currentValue |= value << currentValuePos;
31670
+ const finalValue =
31671
+ currentValue & 1 ? -(currentValue >> 1) : currentValue >> 1;
31672
+ currentData[currentDataPos++] += finalValue;
31673
+ currentValuePos = 0;
31674
+ currentValue = 0;
31675
+ } else {
31676
+ currentValue |= (value & DATA_MASK) << currentValuePos;
31677
+ currentValuePos += 5;
31678
+ }
31679
+ }
31680
+ // End current segment
31681
+ if (currentDataPos === 1) {
31682
+ onMapping(generatedLine, currentData[0], -1, -1, -1, -1);
31683
+ } else if (currentDataPos === 4) {
31684
+ onMapping(
31685
+ generatedLine,
31686
+ currentData[0],
31687
+ currentData[1],
31688
+ currentData[2],
31689
+ currentData[3],
31690
+ -1
31691
+ );
31692
+ } else if (currentDataPos === 5) {
31693
+ onMapping(
31694
+ generatedLine,
31695
+ currentData[0],
31696
+ currentData[1],
31697
+ currentData[2],
31698
+ currentData[3],
31699
+ currentData[4]
31700
+ );
31701
+ }
31702
+ };
31703
+
31704
+ readMappings_1 = readMappings;
31705
+ return readMappings_1;
31706
+ }
31707
+
31708
+ /*
31709
+ MIT License http://www.opensource.org/licenses/mit-license.php
31710
+ Author Tobias Koppers @sokra
31711
+ */
31712
+
31713
+ var streamChunksOfSourceMap;
31714
+ var hasRequiredStreamChunksOfSourceMap;
31715
+
31716
+ function requireStreamChunksOfSourceMap () {
31717
+ if (hasRequiredStreamChunksOfSourceMap) return streamChunksOfSourceMap;
31718
+ hasRequiredStreamChunksOfSourceMap = 1;
31719
+
31720
+ const getGeneratedSourceInfo = requireGetGeneratedSourceInfo();
31721
+ const getSource = requireGetSource();
31722
+ const readMappings = requireReadMappings();
31723
+ const splitIntoLines = requireSplitIntoLines();
31724
+
31725
+ const streamChunksOfSourceMapFull = (
31726
+ source,
31727
+ sourceMap,
31728
+ onChunk,
31729
+ onSource,
31730
+ onName
31731
+ ) => {
31732
+ const lines = splitIntoLines(source);
31733
+ if (lines.length === 0) {
31734
+ return {
31735
+ generatedLine: 1,
31736
+ generatedColumn: 0
31737
+ };
31738
+ }
31739
+ const { sources, sourcesContent, names, mappings } = sourceMap;
31740
+ for (let i = 0; i < sources.length; i++) {
31741
+ onSource(
31742
+ i,
31743
+ getSource(sourceMap, i),
31744
+ (sourcesContent && sourcesContent[i]) || undefined
31745
+ );
31746
+ }
31747
+ if (names) {
31748
+ for (let i = 0; i < names.length; i++) {
31749
+ onName(i, names[i]);
31750
+ }
31751
+ }
31752
+
31753
+ const lastLine = lines[lines.length - 1];
31754
+ const lastNewLine = lastLine.endsWith("\n");
31755
+ const finalLine = lastNewLine ? lines.length + 1 : lines.length;
31756
+ const finalColumn = lastNewLine ? 0 : lastLine.length;
31757
+
31758
+ let currentGeneratedLine = 1;
31759
+ let currentGeneratedColumn = 0;
31760
+
31761
+ let mappingActive = false;
31762
+ let activeMappingSourceIndex = -1;
31763
+ let activeMappingOriginalLine = -1;
31764
+ let activeMappingOriginalColumn = -1;
31765
+ let activeMappingNameIndex = -1;
31766
+
31767
+ const onMapping = (
31768
+ generatedLine,
31769
+ generatedColumn,
31770
+ sourceIndex,
31771
+ originalLine,
31772
+ originalColumn,
31773
+ nameIndex
31774
+ ) => {
31775
+ if (mappingActive && currentGeneratedLine <= lines.length) {
31776
+ let chunk;
31777
+ const mappingLine = currentGeneratedLine;
31778
+ const mappingColumn = currentGeneratedColumn;
31779
+ const line = lines[currentGeneratedLine - 1];
31780
+ if (generatedLine !== currentGeneratedLine) {
31781
+ chunk = line.slice(currentGeneratedColumn);
31782
+ currentGeneratedLine++;
31783
+ currentGeneratedColumn = 0;
31784
+ } else {
31785
+ chunk = line.slice(currentGeneratedColumn, generatedColumn);
31786
+ currentGeneratedColumn = generatedColumn;
31787
+ }
31788
+ if (chunk) {
31789
+ onChunk(
31790
+ chunk,
31791
+ mappingLine,
31792
+ mappingColumn,
31793
+ activeMappingSourceIndex,
31794
+ activeMappingOriginalLine,
31795
+ activeMappingOriginalColumn,
31796
+ activeMappingNameIndex
31797
+ );
31798
+ }
31799
+ mappingActive = false;
31800
+ }
31801
+ if (generatedLine > currentGeneratedLine && currentGeneratedColumn > 0) {
31802
+ if (currentGeneratedLine <= lines.length) {
31803
+ const chunk = lines[currentGeneratedLine - 1].slice(
31804
+ currentGeneratedColumn
31805
+ );
31806
+ onChunk(
31807
+ chunk,
31808
+ currentGeneratedLine,
31809
+ currentGeneratedColumn,
31810
+ -1,
31811
+ -1,
31812
+ -1,
31813
+ -1
31814
+ );
31815
+ }
31816
+ currentGeneratedLine++;
31817
+ currentGeneratedColumn = 0;
31818
+ }
31819
+ while (generatedLine > currentGeneratedLine) {
31820
+ if (currentGeneratedLine <= lines.length) {
31821
+ onChunk(
31822
+ lines[currentGeneratedLine - 1],
31823
+ currentGeneratedLine,
31824
+ 0,
31825
+ -1,
31826
+ -1,
31827
+ -1,
31828
+ -1
31829
+ );
31830
+ }
31831
+ currentGeneratedLine++;
31832
+ }
31833
+ if (generatedColumn > currentGeneratedColumn) {
31834
+ if (currentGeneratedLine <= lines.length) {
31835
+ const chunk = lines[currentGeneratedLine - 1].slice(
31836
+ currentGeneratedColumn,
31837
+ generatedColumn
31838
+ );
31839
+ onChunk(
31840
+ chunk,
31841
+ currentGeneratedLine,
31842
+ currentGeneratedColumn,
31843
+ -1,
31844
+ -1,
31845
+ -1,
31846
+ -1
31847
+ );
31848
+ }
31849
+ currentGeneratedColumn = generatedColumn;
31850
+ }
31851
+ if (
31852
+ sourceIndex >= 0 &&
31853
+ (generatedLine < finalLine ||
31854
+ (generatedLine === finalLine && generatedColumn < finalColumn))
31855
+ ) {
31856
+ mappingActive = true;
31857
+ activeMappingSourceIndex = sourceIndex;
31858
+ activeMappingOriginalLine = originalLine;
31859
+ activeMappingOriginalColumn = originalColumn;
31860
+ activeMappingNameIndex = nameIndex;
31861
+ }
31862
+ };
31863
+ readMappings(mappings, onMapping);
31864
+ onMapping(finalLine, finalColumn, -1, -1, -1, -1);
31865
+ return {
31866
+ generatedLine: finalLine,
31867
+ generatedColumn: finalColumn
31868
+ };
31869
+ };
31870
+
31871
+ const streamChunksOfSourceMapLinesFull = (
31872
+ source,
31873
+ sourceMap,
31874
+ onChunk,
31875
+ onSource,
31876
+ _onName
31877
+ ) => {
31878
+ const lines = splitIntoLines(source);
31879
+ if (lines.length === 0) {
31880
+ return {
31881
+ generatedLine: 1,
31882
+ generatedColumn: 0
31883
+ };
31884
+ }
31885
+ const { sources, sourcesContent, mappings } = sourceMap;
31886
+ for (let i = 0; i < sources.length; i++) {
31887
+ onSource(
31888
+ i,
31889
+ getSource(sourceMap, i),
31890
+ (sourcesContent && sourcesContent[i]) || undefined
31891
+ );
31892
+ }
31893
+
31894
+ let currentGeneratedLine = 1;
31895
+
31896
+ const onMapping = (
31897
+ generatedLine,
31898
+ _generatedColumn,
31899
+ sourceIndex,
31900
+ originalLine,
31901
+ originalColumn,
31902
+ _nameIndex
31903
+ ) => {
31904
+ if (
31905
+ sourceIndex < 0 ||
31906
+ generatedLine < currentGeneratedLine ||
31907
+ generatedLine > lines.length
31908
+ ) {
31909
+ return;
31910
+ }
31911
+ while (generatedLine > currentGeneratedLine) {
31912
+ if (currentGeneratedLine <= lines.length) {
31913
+ onChunk(
31914
+ lines[currentGeneratedLine - 1],
31915
+ currentGeneratedLine,
31916
+ 0,
31917
+ -1,
31918
+ -1,
31919
+ -1,
31920
+ -1
31921
+ );
31922
+ }
31923
+ currentGeneratedLine++;
31924
+ }
31925
+ if (generatedLine <= lines.length) {
31926
+ onChunk(
31927
+ lines[generatedLine - 1],
31928
+ generatedLine,
31929
+ 0,
31930
+ sourceIndex,
31931
+ originalLine,
31932
+ originalColumn,
31933
+ -1
31934
+ );
31935
+ currentGeneratedLine++;
31936
+ }
31937
+ };
31938
+ readMappings(mappings, onMapping);
31939
+ for (; currentGeneratedLine <= lines.length; currentGeneratedLine++) {
31940
+ onChunk(
31941
+ lines[currentGeneratedLine - 1],
31942
+ currentGeneratedLine,
31943
+ 0,
31944
+ -1,
31945
+ -1,
31946
+ -1,
31947
+ -1
31948
+ );
31949
+ }
31950
+
31951
+ const lastLine = lines[lines.length - 1];
31952
+ const lastNewLine = lastLine.endsWith("\n");
31953
+
31954
+ const finalLine = lastNewLine ? lines.length + 1 : lines.length;
31955
+ const finalColumn = lastNewLine ? 0 : lastLine.length;
31956
+
31957
+ return {
31958
+ generatedLine: finalLine,
31959
+ generatedColumn: finalColumn
31960
+ };
31961
+ };
31962
+
31963
+ const streamChunksOfSourceMapFinal = (
31964
+ source,
31965
+ sourceMap,
31966
+ onChunk,
31967
+ onSource,
31968
+ onName
31969
+ ) => {
31970
+ const result = getGeneratedSourceInfo(source);
31971
+ const { generatedLine: finalLine, generatedColumn: finalColumn } = result;
31972
+
31973
+ if (finalLine === 1 && finalColumn === 0) return result;
31974
+ const { sources, sourcesContent, names, mappings } = sourceMap;
31975
+ for (let i = 0; i < sources.length; i++) {
31976
+ onSource(
31977
+ i,
31978
+ getSource(sourceMap, i),
31979
+ (sourcesContent && sourcesContent[i]) || undefined
31980
+ );
31981
+ }
31982
+ if (names) {
31983
+ for (let i = 0; i < names.length; i++) {
31984
+ onName(i, names[i]);
31985
+ }
31986
+ }
31987
+
31988
+ let mappingActiveLine = 0;
31989
+
31990
+ const onMapping = (
31991
+ generatedLine,
31992
+ generatedColumn,
31993
+ sourceIndex,
31994
+ originalLine,
31995
+ originalColumn,
31996
+ nameIndex
31997
+ ) => {
31998
+ if (
31999
+ generatedLine >= finalLine &&
32000
+ (generatedColumn >= finalColumn || generatedLine > finalLine)
32001
+ ) {
32002
+ return;
32003
+ }
32004
+ if (sourceIndex >= 0) {
32005
+ onChunk(
32006
+ undefined,
32007
+ generatedLine,
32008
+ generatedColumn,
32009
+ sourceIndex,
32010
+ originalLine,
32011
+ originalColumn,
32012
+ nameIndex
32013
+ );
32014
+ mappingActiveLine = generatedLine;
32015
+ } else if (mappingActiveLine === generatedLine) {
32016
+ onChunk(undefined, generatedLine, generatedColumn, -1, -1, -1, -1);
32017
+ mappingActiveLine = 0;
32018
+ }
32019
+ };
32020
+ readMappings(mappings, onMapping);
32021
+ return result;
32022
+ };
32023
+
32024
+ const streamChunksOfSourceMapLinesFinal = (
32025
+ source,
32026
+ sourceMap,
32027
+ onChunk,
32028
+ onSource,
32029
+ _onName
32030
+ ) => {
32031
+ const result = getGeneratedSourceInfo(source);
32032
+ const { generatedLine, generatedColumn } = result;
32033
+ if (generatedLine === 1 && generatedColumn === 0) {
32034
+ return {
32035
+ generatedLine: 1,
32036
+ generatedColumn: 0
32037
+ };
32038
+ }
32039
+
32040
+ const { sources, sourcesContent, mappings } = sourceMap;
32041
+ for (let i = 0; i < sources.length; i++) {
32042
+ onSource(
32043
+ i,
32044
+ getSource(sourceMap, i),
32045
+ (sourcesContent && sourcesContent[i]) || undefined
32046
+ );
32047
+ }
32048
+
32049
+ const finalLine = generatedColumn === 0 ? generatedLine - 1 : generatedLine;
32050
+
32051
+ let currentGeneratedLine = 1;
32052
+
32053
+ const onMapping = (
32054
+ generatedLine,
32055
+ _generatedColumn,
32056
+ sourceIndex,
32057
+ originalLine,
32058
+ originalColumn,
32059
+ _nameIndex
32060
+ ) => {
32061
+ if (
32062
+ sourceIndex >= 0 &&
32063
+ currentGeneratedLine <= generatedLine &&
32064
+ generatedLine <= finalLine
32065
+ ) {
32066
+ onChunk(
32067
+ undefined,
32068
+ generatedLine,
32069
+ 0,
32070
+ sourceIndex,
32071
+ originalLine,
32072
+ originalColumn,
32073
+ -1
32074
+ );
32075
+ currentGeneratedLine = generatedLine + 1;
32076
+ }
32077
+ };
32078
+ readMappings(mappings, onMapping);
32079
+ return result;
32080
+ };
32081
+
32082
+ streamChunksOfSourceMap = (
32083
+ source,
32084
+ sourceMap,
32085
+ onChunk,
32086
+ onSource,
32087
+ onName,
32088
+ finalSource,
32089
+ columns
32090
+ ) => {
32091
+ if (columns) {
32092
+ return finalSource
32093
+ ? streamChunksOfSourceMapFinal(
32094
+ source,
32095
+ sourceMap,
32096
+ onChunk,
32097
+ onSource,
32098
+ onName
32099
+ )
32100
+ : streamChunksOfSourceMapFull(
32101
+ source,
32102
+ sourceMap,
32103
+ onChunk,
32104
+ onSource,
32105
+ onName
32106
+ );
32107
+ } else {
32108
+ return finalSource
32109
+ ? streamChunksOfSourceMapLinesFinal(
32110
+ source,
32111
+ sourceMap,
32112
+ onChunk,
32113
+ onSource)
32114
+ : streamChunksOfSourceMapLinesFull(
32115
+ source,
32116
+ sourceMap,
32117
+ onChunk,
32118
+ onSource);
32119
+ }
32120
+ };
32121
+ return streamChunksOfSourceMap;
32122
+ }
32123
+
32124
+ /*
32125
+ MIT License http://www.opensource.org/licenses/mit-license.php
32126
+ Author Tobias Koppers @sokra
32127
+ */
32128
+
32129
+ var streamChunksOfCombinedSourceMap_1;
32130
+ var hasRequiredStreamChunksOfCombinedSourceMap;
32131
+
32132
+ function requireStreamChunksOfCombinedSourceMap () {
32133
+ if (hasRequiredStreamChunksOfCombinedSourceMap) return streamChunksOfCombinedSourceMap_1;
32134
+ hasRequiredStreamChunksOfCombinedSourceMap = 1;
32135
+
32136
+ const streamChunksOfSourceMap = requireStreamChunksOfSourceMap();
32137
+ const splitIntoLines = requireSplitIntoLines();
32138
+
32139
+ const streamChunksOfCombinedSourceMap = (
32140
+ source,
32141
+ sourceMap,
32142
+ innerSourceName,
32143
+ innerSource,
32144
+ innerSourceMap,
32145
+ removeInnerSource,
32146
+ onChunk,
32147
+ onSource,
32148
+ onName,
32149
+ finalSource,
32150
+ columns
32151
+ ) => {
32152
+ let sourceMapping = new Map();
32153
+ let nameMapping = new Map();
32154
+ const sourceIndexMapping = [];
32155
+ const nameIndexMapping = [];
32156
+ const nameIndexValueMapping = [];
32157
+ let innerSourceIndex = -2;
32158
+ const innerSourceIndexMapping = [];
32159
+ const innerSourceIndexValueMapping = [];
32160
+ const innerSourceContents = [];
32161
+ const innerSourceContentLines = [];
32162
+ const innerNameIndexMapping = [];
32163
+ const innerNameIndexValueMapping = [];
32164
+ const innerSourceMapLineData = [];
32165
+ const findInnerMapping = (line, column) => {
32166
+ if (line > innerSourceMapLineData.length) return -1;
32167
+ const { mappingsData } = innerSourceMapLineData[line - 1];
32168
+ let l = 0;
32169
+ let r = mappingsData.length / 5;
32170
+ while (l < r) {
32171
+ let m = (l + r) >> 1;
32172
+ if (mappingsData[m * 5] <= column) {
32173
+ l = m + 1;
32174
+ } else {
32175
+ r = m;
32176
+ }
32177
+ }
32178
+ if (l === 0) return -1;
32179
+ return l - 1;
32180
+ };
32181
+ return streamChunksOfSourceMap(
32182
+ source,
32183
+ sourceMap,
32184
+ (
32185
+ chunk,
32186
+ generatedLine,
32187
+ generatedColumn,
32188
+ sourceIndex,
32189
+ originalLine,
32190
+ originalColumn,
32191
+ nameIndex
32192
+ ) => {
32193
+ // Check if this is a mapping to the inner source
32194
+ if (sourceIndex === innerSourceIndex) {
32195
+ // Check if there is a mapping in the inner source
32196
+ const idx = findInnerMapping(originalLine, originalColumn);
32197
+ if (idx !== -1) {
32198
+ const { chunks, mappingsData } = innerSourceMapLineData[
32199
+ originalLine - 1
32200
+ ];
32201
+ const mi = idx * 5;
32202
+ const innerSourceIndex = mappingsData[mi + 1];
32203
+ const innerOriginalLine = mappingsData[mi + 2];
32204
+ let innerOriginalColumn = mappingsData[mi + 3];
32205
+ let innerNameIndex = mappingsData[mi + 4];
32206
+ if (innerSourceIndex >= 0) {
32207
+ // Check for an identity mapping
32208
+ // where we are allowed to adjust the original column
32209
+ const innerChunk = chunks[idx];
32210
+ const innerGeneratedColumn = mappingsData[mi];
32211
+ const locationInChunk = originalColumn - innerGeneratedColumn;
32212
+ if (locationInChunk > 0) {
32213
+ let originalSourceLines =
32214
+ innerSourceIndex < innerSourceContentLines.length
32215
+ ? innerSourceContentLines[innerSourceIndex]
32216
+ : null;
32217
+ if (originalSourceLines === undefined) {
32218
+ const originalSource = innerSourceContents[innerSourceIndex];
32219
+ originalSourceLines = originalSource
32220
+ ? splitIntoLines(originalSource)
32221
+ : null;
32222
+ innerSourceContentLines[innerSourceIndex] = originalSourceLines;
32223
+ }
32224
+ if (originalSourceLines !== null) {
32225
+ const originalChunk =
32226
+ innerOriginalLine <= originalSourceLines.length
32227
+ ? originalSourceLines[innerOriginalLine - 1].slice(
32228
+ innerOriginalColumn,
32229
+ innerOriginalColumn + locationInChunk
32230
+ )
32231
+ : "";
32232
+ if (innerChunk.slice(0, locationInChunk) === originalChunk) {
32233
+ innerOriginalColumn += locationInChunk;
32234
+ innerNameIndex = -1;
32235
+ }
32236
+ }
32237
+ }
32238
+
32239
+ // We have a inner mapping to original source
32240
+
32241
+ // emit source when needed and compute global source index
32242
+ let sourceIndex =
32243
+ innerSourceIndex < innerSourceIndexMapping.length
32244
+ ? innerSourceIndexMapping[innerSourceIndex]
32245
+ : -2;
32246
+ if (sourceIndex === -2) {
32247
+ const [source, sourceContent] =
32248
+ innerSourceIndex < innerSourceIndexValueMapping.length
32249
+ ? innerSourceIndexValueMapping[innerSourceIndex]
32250
+ : [null, undefined];
32251
+ let globalIndex = sourceMapping.get(source);
32252
+ if (globalIndex === undefined) {
32253
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
32254
+ onSource(globalIndex, source, sourceContent);
32255
+ }
32256
+ sourceIndex = globalIndex;
32257
+ innerSourceIndexMapping[innerSourceIndex] = sourceIndex;
32258
+ }
32259
+
32260
+ // emit name when needed and compute global name index
32261
+ let finalNameIndex = -1;
32262
+ if (innerNameIndex >= 0) {
32263
+ // when we have a inner name
32264
+ finalNameIndex =
32265
+ innerNameIndex < innerNameIndexMapping.length
32266
+ ? innerNameIndexMapping[innerNameIndex]
32267
+ : -2;
32268
+ if (finalNameIndex === -2) {
32269
+ const name =
32270
+ innerNameIndex < innerNameIndexValueMapping.length
32271
+ ? innerNameIndexValueMapping[innerNameIndex]
32272
+ : undefined;
32273
+ if (name) {
32274
+ let globalIndex = nameMapping.get(name);
32275
+ if (globalIndex === undefined) {
32276
+ nameMapping.set(name, (globalIndex = nameMapping.size));
32277
+ onName(globalIndex, name);
32278
+ }
32279
+ finalNameIndex = globalIndex;
32280
+ } else {
32281
+ finalNameIndex = -1;
32282
+ }
32283
+ innerNameIndexMapping[innerNameIndex] = finalNameIndex;
32284
+ }
32285
+ } else if (nameIndex >= 0) {
32286
+ // when we don't have an inner name,
32287
+ // but we have an outer name
32288
+ // it can be used when inner original code equals to the name
32289
+ let originalSourceLines =
32290
+ innerSourceContentLines[innerSourceIndex];
32291
+ if (originalSourceLines === undefined) {
32292
+ const originalSource = innerSourceContents[innerSourceIndex];
32293
+ originalSourceLines = originalSource
32294
+ ? splitIntoLines(originalSource)
32295
+ : null;
32296
+ innerSourceContentLines[innerSourceIndex] = originalSourceLines;
32297
+ }
32298
+ if (originalSourceLines !== null) {
32299
+ const name = nameIndexValueMapping[nameIndex];
32300
+ const originalName =
32301
+ innerOriginalLine <= originalSourceLines.length
32302
+ ? originalSourceLines[innerOriginalLine - 1].slice(
32303
+ innerOriginalColumn,
32304
+ innerOriginalColumn + name.length
32305
+ )
32306
+ : "";
32307
+ if (name === originalName) {
32308
+ finalNameIndex =
32309
+ nameIndex < nameIndexMapping.length
32310
+ ? nameIndexMapping[nameIndex]
32311
+ : -2;
32312
+ if (finalNameIndex === -2) {
32313
+ const name = nameIndexValueMapping[nameIndex];
32314
+ if (name) {
32315
+ let globalIndex = nameMapping.get(name);
32316
+ if (globalIndex === undefined) {
32317
+ nameMapping.set(name, (globalIndex = nameMapping.size));
32318
+ onName(globalIndex, name);
32319
+ }
32320
+ finalNameIndex = globalIndex;
32321
+ } else {
32322
+ finalNameIndex = -1;
32323
+ }
32324
+ nameIndexMapping[nameIndex] = finalNameIndex;
32325
+ }
32326
+ }
32327
+ }
32328
+ }
32329
+ onChunk(
32330
+ chunk,
32331
+ generatedLine,
32332
+ generatedColumn,
32333
+ sourceIndex,
32334
+ innerOriginalLine,
32335
+ innerOriginalColumn,
32336
+ finalNameIndex
32337
+ );
32338
+ return;
32339
+ }
32340
+ }
32341
+
32342
+ // We have a mapping to the inner source, but no inner mapping
32343
+ if (removeInnerSource) {
32344
+ onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1);
32345
+ return;
32346
+ } else {
32347
+ if (sourceIndexMapping[sourceIndex] === -2) {
32348
+ let globalIndex = sourceMapping.get(innerSourceName);
32349
+ if (globalIndex === undefined) {
32350
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
32351
+ onSource(globalIndex, innerSourceName, innerSource);
32352
+ }
32353
+ sourceIndexMapping[sourceIndex] = globalIndex;
32354
+ }
32355
+ }
32356
+ }
32357
+
32358
+ const finalSourceIndex =
32359
+ sourceIndex < 0 || sourceIndex >= sourceIndexMapping.length
32360
+ ? -1
32361
+ : sourceIndexMapping[sourceIndex];
32362
+ if (finalSourceIndex < 0) {
32363
+ // no source, so we make it a generated chunk
32364
+ onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1);
32365
+ } else {
32366
+ // Pass through the chunk with mapping
32367
+ let finalNameIndex = -1;
32368
+ if (nameIndex >= 0 && nameIndex < nameIndexMapping.length) {
32369
+ finalNameIndex = nameIndexMapping[nameIndex];
32370
+ if (finalNameIndex === -2) {
32371
+ const name = nameIndexValueMapping[nameIndex];
32372
+ let globalIndex = nameMapping.get(name);
32373
+ if (globalIndex === undefined) {
32374
+ nameMapping.set(name, (globalIndex = nameMapping.size));
32375
+ onName(globalIndex, name);
32376
+ }
32377
+ finalNameIndex = globalIndex;
32378
+ nameIndexMapping[nameIndex] = finalNameIndex;
32379
+ }
32380
+ }
32381
+ onChunk(
32382
+ chunk,
32383
+ generatedLine,
32384
+ generatedColumn,
32385
+ finalSourceIndex,
32386
+ originalLine,
32387
+ originalColumn,
32388
+ finalNameIndex
32389
+ );
32390
+ }
32391
+ },
32392
+ (i, source, sourceContent) => {
32393
+ if (source === innerSourceName) {
32394
+ innerSourceIndex = i;
32395
+ if (innerSource !== undefined) sourceContent = innerSource;
32396
+ else innerSource = sourceContent;
32397
+ sourceIndexMapping[i] = -2;
32398
+ streamChunksOfSourceMap(
32399
+ sourceContent,
32400
+ innerSourceMap,
32401
+ (
32402
+ chunk,
32403
+ generatedLine,
32404
+ generatedColumn,
32405
+ sourceIndex,
32406
+ originalLine,
32407
+ originalColumn,
32408
+ nameIndex
32409
+ ) => {
32410
+ while (innerSourceMapLineData.length < generatedLine) {
32411
+ innerSourceMapLineData.push({
32412
+ mappingsData: [],
32413
+ chunks: []
32414
+ });
32415
+ }
32416
+ const data = innerSourceMapLineData[generatedLine - 1];
32417
+ data.mappingsData.push(
32418
+ generatedColumn,
32419
+ sourceIndex,
32420
+ originalLine,
32421
+ originalColumn,
32422
+ nameIndex
32423
+ );
32424
+ data.chunks.push(chunk);
32425
+ },
32426
+ (i, source, sourceContent) => {
32427
+ innerSourceContents[i] = sourceContent;
32428
+ innerSourceContentLines[i] = undefined;
32429
+ innerSourceIndexMapping[i] = -2;
32430
+ innerSourceIndexValueMapping[i] = [source, sourceContent];
32431
+ },
32432
+ (i, name) => {
32433
+ innerNameIndexMapping[i] = -2;
32434
+ innerNameIndexValueMapping[i] = name;
32435
+ },
32436
+ false,
32437
+ columns
32438
+ );
32439
+ } else {
32440
+ let globalIndex = sourceMapping.get(source);
32441
+ if (globalIndex === undefined) {
32442
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
32443
+ onSource(globalIndex, source, sourceContent);
32444
+ }
32445
+ sourceIndexMapping[i] = globalIndex;
32446
+ }
32447
+ },
32448
+ (i, name) => {
32449
+ nameIndexMapping[i] = -2;
32450
+ nameIndexValueMapping[i] = name;
32451
+ },
32452
+ finalSource,
32453
+ columns
32454
+ );
32455
+ };
32456
+
32457
+ streamChunksOfCombinedSourceMap_1 = streamChunksOfCombinedSourceMap;
32458
+ return streamChunksOfCombinedSourceMap_1;
32459
+ }
32460
+
32461
+ /*
32462
+ MIT License http://www.opensource.org/licenses/mit-license.php
32463
+ Author Tobias Koppers @sokra
32464
+ */
32465
+
32466
+ var SourceMapSource_1;
32467
+ var hasRequiredSourceMapSource;
32468
+
32469
+ function requireSourceMapSource () {
32470
+ if (hasRequiredSourceMapSource) return SourceMapSource_1;
32471
+ hasRequiredSourceMapSource = 1;
32472
+
32473
+ const Source = requireSource();
32474
+ const streamChunksOfSourceMap = requireStreamChunksOfSourceMap();
32475
+ const streamChunksOfCombinedSourceMap = requireStreamChunksOfCombinedSourceMap();
32476
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
32477
+
32478
+ class SourceMapSource extends Source {
32479
+ constructor(
32480
+ value,
32481
+ name,
32482
+ sourceMap,
32483
+ originalSource,
32484
+ innerSourceMap,
32485
+ removeOriginalSource
32486
+ ) {
32487
+ super();
32488
+ const valueIsBuffer = Buffer.isBuffer(value);
32489
+ this._valueAsString = valueIsBuffer ? undefined : value;
32490
+ this._valueAsBuffer = valueIsBuffer ? value : undefined;
32491
+
32492
+ this._name = name;
32493
+
32494
+ this._hasSourceMap = !!sourceMap;
32495
+ const sourceMapIsBuffer = Buffer.isBuffer(sourceMap);
32496
+ const sourceMapIsString = typeof sourceMap === "string";
32497
+ this._sourceMapAsObject =
32498
+ sourceMapIsBuffer || sourceMapIsString ? undefined : sourceMap;
32499
+ this._sourceMapAsString = sourceMapIsString ? sourceMap : undefined;
32500
+ this._sourceMapAsBuffer = sourceMapIsBuffer ? sourceMap : undefined;
32501
+
32502
+ this._hasOriginalSource = !!originalSource;
32503
+ const originalSourceIsBuffer = Buffer.isBuffer(originalSource);
32504
+ this._originalSourceAsString = originalSourceIsBuffer
32505
+ ? undefined
32506
+ : originalSource;
32507
+ this._originalSourceAsBuffer = originalSourceIsBuffer
32508
+ ? originalSource
32509
+ : undefined;
32510
+
32511
+ this._hasInnerSourceMap = !!innerSourceMap;
32512
+ const innerSourceMapIsBuffer = Buffer.isBuffer(innerSourceMap);
32513
+ const innerSourceMapIsString = typeof innerSourceMap === "string";
32514
+ this._innerSourceMapAsObject =
32515
+ innerSourceMapIsBuffer || innerSourceMapIsString
32516
+ ? undefined
32517
+ : innerSourceMap;
32518
+ this._innerSourceMapAsString = innerSourceMapIsString
32519
+ ? innerSourceMap
32520
+ : undefined;
32521
+ this._innerSourceMapAsBuffer = innerSourceMapIsBuffer
32522
+ ? innerSourceMap
32523
+ : undefined;
32524
+
32525
+ this._removeOriginalSource = removeOriginalSource;
32526
+ }
32527
+
32528
+ _ensureValueBuffer() {
32529
+ if (this._valueAsBuffer === undefined) {
32530
+ this._valueAsBuffer = Buffer.from(this._valueAsString, "utf-8");
32531
+ }
32532
+ }
32533
+
32534
+ _ensureValueString() {
32535
+ if (this._valueAsString === undefined) {
32536
+ this._valueAsString = this._valueAsBuffer.toString("utf-8");
32537
+ }
32538
+ }
32539
+
32540
+ _ensureOriginalSourceBuffer() {
32541
+ if (this._originalSourceAsBuffer === undefined && this._hasOriginalSource) {
32542
+ this._originalSourceAsBuffer = Buffer.from(
32543
+ this._originalSourceAsString,
32544
+ "utf-8"
32545
+ );
32546
+ }
32547
+ }
32548
+
32549
+ _ensureOriginalSourceString() {
32550
+ if (this._originalSourceAsString === undefined && this._hasOriginalSource) {
32551
+ this._originalSourceAsString = this._originalSourceAsBuffer.toString(
32552
+ "utf-8"
32553
+ );
32554
+ }
32555
+ }
32556
+
32557
+ _ensureInnerSourceMapObject() {
32558
+ if (this._innerSourceMapAsObject === undefined && this._hasInnerSourceMap) {
32559
+ this._ensureInnerSourceMapString();
32560
+ this._innerSourceMapAsObject = JSON.parse(this._innerSourceMapAsString);
32561
+ }
32562
+ }
32563
+
32564
+ _ensureInnerSourceMapBuffer() {
32565
+ if (this._innerSourceMapAsBuffer === undefined && this._hasInnerSourceMap) {
32566
+ this._ensureInnerSourceMapString();
32567
+ this._innerSourceMapAsBuffer = Buffer.from(
32568
+ this._innerSourceMapAsString,
32569
+ "utf-8"
32570
+ );
32571
+ }
32572
+ }
32573
+
32574
+ _ensureInnerSourceMapString() {
32575
+ if (this._innerSourceMapAsString === undefined && this._hasInnerSourceMap) {
32576
+ if (this._innerSourceMapAsBuffer !== undefined) {
32577
+ this._innerSourceMapAsString = this._innerSourceMapAsBuffer.toString(
32578
+ "utf-8"
32579
+ );
32580
+ } else {
32581
+ this._innerSourceMapAsString = JSON.stringify(
32582
+ this._innerSourceMapAsObject
32583
+ );
32584
+ }
32585
+ }
32586
+ }
32587
+
32588
+ _ensureSourceMapObject() {
32589
+ if (this._sourceMapAsObject === undefined) {
32590
+ this._ensureSourceMapString();
32591
+ this._sourceMapAsObject = JSON.parse(this._sourceMapAsString);
32592
+ }
32593
+ }
32594
+
32595
+ _ensureSourceMapBuffer() {
32596
+ if (this._sourceMapAsBuffer === undefined) {
32597
+ this._ensureSourceMapString();
32598
+ this._sourceMapAsBuffer = Buffer.from(this._sourceMapAsString, "utf-8");
32599
+ }
32600
+ }
32601
+
32602
+ _ensureSourceMapString() {
32603
+ if (this._sourceMapAsString === undefined) {
32604
+ if (this._sourceMapAsBuffer !== undefined) {
32605
+ this._sourceMapAsString = this._sourceMapAsBuffer.toString("utf-8");
32606
+ } else {
32607
+ this._sourceMapAsString = JSON.stringify(this._sourceMapAsObject);
32608
+ }
32609
+ }
32610
+ }
32611
+
32612
+ getArgsAsBuffers() {
32613
+ this._ensureValueBuffer();
32614
+ this._ensureSourceMapBuffer();
32615
+ this._ensureOriginalSourceBuffer();
32616
+ this._ensureInnerSourceMapBuffer();
32617
+ return [
32618
+ this._valueAsBuffer,
32619
+ this._name,
32620
+ this._sourceMapAsBuffer,
32621
+ this._originalSourceAsBuffer,
32622
+ this._innerSourceMapAsBuffer,
32623
+ this._removeOriginalSource
32624
+ ];
32625
+ }
32626
+
32627
+ buffer() {
32628
+ this._ensureValueBuffer();
32629
+ return this._valueAsBuffer;
32630
+ }
32631
+
32632
+ source() {
32633
+ this._ensureValueString();
32634
+ return this._valueAsString;
32635
+ }
32636
+
32637
+ map(options) {
32638
+ if (!this._hasInnerSourceMap) {
32639
+ this._ensureSourceMapObject();
32640
+ return this._sourceMapAsObject;
32641
+ }
32642
+ return getMap(this, options);
32643
+ }
32644
+
32645
+ sourceAndMap(options) {
32646
+ if (!this._hasInnerSourceMap) {
32647
+ this._ensureValueString();
32648
+ this._ensureSourceMapObject();
32649
+ return {
32650
+ source: this._valueAsString,
32651
+ map: this._sourceMapAsObject
32652
+ };
32653
+ }
32654
+ return getSourceAndMap(this, options);
32655
+ }
32656
+
32657
+ streamChunks(options, onChunk, onSource, onName) {
32658
+ this._ensureValueString();
32659
+ this._ensureSourceMapObject();
32660
+ this._ensureOriginalSourceString();
32661
+ if (this._hasInnerSourceMap) {
32662
+ this._ensureInnerSourceMapObject();
32663
+ return streamChunksOfCombinedSourceMap(
32664
+ this._valueAsString,
32665
+ this._sourceMapAsObject,
32666
+ this._name,
32667
+ this._originalSourceAsString,
32668
+ this._innerSourceMapAsObject,
32669
+ this._removeOriginalSource,
32670
+ onChunk,
32671
+ onSource,
32672
+ onName,
32673
+ !!(options && options.finalSource),
32674
+ !!(options && options.columns !== false)
32675
+ );
32676
+ } else {
32677
+ return streamChunksOfSourceMap(
32678
+ this._valueAsString,
32679
+ this._sourceMapAsObject,
32680
+ onChunk,
32681
+ onSource,
32682
+ onName,
32683
+ !!(options && options.finalSource),
32684
+ !!(options && options.columns !== false)
32685
+ );
32686
+ }
32687
+ }
32688
+
32689
+ updateHash(hash) {
32690
+ this._ensureValueBuffer();
32691
+ this._ensureSourceMapBuffer();
32692
+ this._ensureOriginalSourceBuffer();
32693
+ this._ensureInnerSourceMapBuffer();
32694
+
32695
+ hash.update("SourceMapSource");
32696
+
32697
+ hash.update(this._valueAsBuffer);
32698
+
32699
+ hash.update(this._sourceMapAsBuffer);
32700
+
32701
+ if (this._hasOriginalSource) {
32702
+ hash.update(this._originalSourceAsBuffer);
32703
+ }
32704
+
32705
+ if (this._hasInnerSourceMap) {
32706
+ hash.update(this._innerSourceMapAsBuffer);
32707
+ }
32708
+
32709
+ hash.update(this._removeOriginalSource ? "true" : "false");
32710
+ }
32711
+ }
32712
+
32713
+ SourceMapSource_1 = SourceMapSource;
32714
+ return SourceMapSource_1;
32715
+ }
32716
+
32717
+ /*
32718
+ MIT License http://www.opensource.org/licenses/mit-license.php
32719
+ Author Tobias Koppers @sokra
32720
+ */
32721
+
32722
+ var streamChunks;
32723
+ var hasRequiredStreamChunks;
32724
+
32725
+ function requireStreamChunks () {
32726
+ if (hasRequiredStreamChunks) return streamChunks;
32727
+ hasRequiredStreamChunks = 1;
32728
+
32729
+ const streamChunksOfRawSource = requireStreamChunksOfRawSource();
32730
+ const streamChunksOfSourceMap = requireStreamChunksOfSourceMap();
32731
+
32732
+ streamChunks = (source, options, onChunk, onSource, onName) => {
32733
+ if (typeof source.streamChunks === "function") {
32734
+ return source.streamChunks(options, onChunk, onSource, onName);
32735
+ } else {
32736
+ const sourceAndMap = source.sourceAndMap(options);
32737
+ if (sourceAndMap.map) {
32738
+ return streamChunksOfSourceMap(
32739
+ sourceAndMap.source,
32740
+ sourceAndMap.map,
32741
+ onChunk,
32742
+ onSource,
32743
+ onName,
32744
+ !!(options && options.finalSource),
32745
+ !!(options && options.columns !== false)
32746
+ );
32747
+ } else {
32748
+ return streamChunksOfRawSource(
32749
+ sourceAndMap.source,
32750
+ onChunk,
32751
+ onSource,
32752
+ onName,
32753
+ !!(options && options.finalSource)
32754
+ );
32755
+ }
32756
+ }
32757
+ };
32758
+ return streamChunks;
32759
+ }
32760
+
32761
+ /*
32762
+ MIT License http://www.opensource.org/licenses/mit-license.php
32763
+ Author Tobias Koppers @sokra
32764
+ */
32765
+
32766
+ var streamAndGetSourceAndMap_1;
32767
+ var hasRequiredStreamAndGetSourceAndMap;
32768
+
32769
+ function requireStreamAndGetSourceAndMap () {
32770
+ if (hasRequiredStreamAndGetSourceAndMap) return streamAndGetSourceAndMap_1;
32771
+ hasRequiredStreamAndGetSourceAndMap = 1;
32772
+
32773
+ const createMappingsSerializer = requireCreateMappingsSerializer();
32774
+ const streamChunks = requireStreamChunks();
32775
+
32776
+ const streamAndGetSourceAndMap = (
32777
+ inputSource,
32778
+ options,
32779
+ onChunk,
32780
+ onSource,
32781
+ onName
32782
+ ) => {
32783
+ let code = "";
32784
+ let mappings = "";
32785
+ let sources = [];
32786
+ let sourcesContent = [];
32787
+ let names = [];
32788
+ const addMapping = createMappingsSerializer(
32789
+ Object.assign({}, options, { columns: true })
32790
+ );
32791
+ const finalSource = !!(options && options.finalSource);
32792
+ const { generatedLine, generatedColumn, source } = streamChunks(
32793
+ inputSource,
32794
+ options,
32795
+ (
32796
+ chunk,
32797
+ generatedLine,
32798
+ generatedColumn,
32799
+ sourceIndex,
32800
+ originalLine,
32801
+ originalColumn,
32802
+ nameIndex
32803
+ ) => {
32804
+ if (chunk !== undefined) code += chunk;
32805
+ mappings += addMapping(
32806
+ generatedLine,
32807
+ generatedColumn,
32808
+ sourceIndex,
32809
+ originalLine,
32810
+ originalColumn,
32811
+ nameIndex
32812
+ );
32813
+ return onChunk(
32814
+ finalSource ? undefined : chunk,
32815
+ generatedLine,
32816
+ generatedColumn,
32817
+ sourceIndex,
32818
+ originalLine,
32819
+ originalColumn,
32820
+ nameIndex
32821
+ );
32822
+ },
32823
+ (sourceIndex, source, sourceContent) => {
32824
+ while (sources.length < sourceIndex) {
32825
+ sources.push(null);
32826
+ }
32827
+ sources[sourceIndex] = source;
32828
+ if (sourceContent !== undefined) {
32829
+ while (sourcesContent.length < sourceIndex) {
32830
+ sourcesContent.push(null);
32831
+ }
32832
+ sourcesContent[sourceIndex] = sourceContent;
32833
+ }
32834
+ return onSource(sourceIndex, source, sourceContent);
32835
+ },
32836
+ (nameIndex, name) => {
32837
+ while (names.length < nameIndex) {
32838
+ names.push(null);
32839
+ }
32840
+ names[nameIndex] = name;
32841
+ return onName(nameIndex, name);
32842
+ }
32843
+ );
32844
+ const resultSource = source !== undefined ? source : code;
32845
+ return {
32846
+ result: {
32847
+ generatedLine,
32848
+ generatedColumn,
32849
+ source: finalSource ? resultSource : undefined
32850
+ },
32851
+ source: resultSource,
32852
+ map:
32853
+ mappings.length > 0
32854
+ ? {
32855
+ version: 3,
32856
+ file: "x",
32857
+ mappings,
32858
+ sources,
32859
+ sourcesContent:
32860
+ sourcesContent.length > 0 ? sourcesContent : undefined,
32861
+ names
32862
+ }
32863
+ : null
32864
+ };
32865
+ };
32866
+
32867
+ streamAndGetSourceAndMap_1 = streamAndGetSourceAndMap;
32868
+ return streamAndGetSourceAndMap_1;
32869
+ }
32870
+
32871
+ /*
32872
+ MIT License http://www.opensource.org/licenses/mit-license.php
32873
+ Author Tobias Koppers @sokra
32874
+ */
32875
+
32876
+ var CachedSource_1;
32877
+ var hasRequiredCachedSource;
32878
+
32879
+ function requireCachedSource () {
32880
+ if (hasRequiredCachedSource) return CachedSource_1;
32881
+ hasRequiredCachedSource = 1;
32882
+
32883
+ const Source = requireSource();
32884
+ const streamChunksOfSourceMap = requireStreamChunksOfSourceMap();
32885
+ const streamChunksOfRawSource = requireStreamChunksOfRawSource();
32886
+ const streamAndGetSourceAndMap = requireStreamAndGetSourceAndMap();
32887
+
32888
+ const mapToBufferedMap = map => {
32889
+ if (typeof map !== "object" || !map) return map;
32890
+ const bufferedMap = Object.assign({}, map);
32891
+ if (map.mappings) {
32892
+ bufferedMap.mappings = Buffer.from(map.mappings, "utf-8");
32893
+ }
32894
+ if (map.sourcesContent) {
32895
+ bufferedMap.sourcesContent = map.sourcesContent.map(
32896
+ str => str && Buffer.from(str, "utf-8")
32897
+ );
32898
+ }
32899
+ return bufferedMap;
32900
+ };
32901
+
32902
+ const bufferedMapToMap = bufferedMap => {
32903
+ if (typeof bufferedMap !== "object" || !bufferedMap) return bufferedMap;
32904
+ const map = Object.assign({}, bufferedMap);
32905
+ if (bufferedMap.mappings) {
32906
+ map.mappings = bufferedMap.mappings.toString("utf-8");
32907
+ }
32908
+ if (bufferedMap.sourcesContent) {
32909
+ map.sourcesContent = bufferedMap.sourcesContent.map(
32910
+ buffer => buffer && buffer.toString("utf-8")
32911
+ );
32912
+ }
32913
+ return map;
32914
+ };
32915
+
32916
+ class CachedSource extends Source {
32917
+ constructor(source, cachedData) {
32918
+ super();
32919
+ this._source = source;
32920
+ this._cachedSourceType = cachedData ? cachedData.source : undefined;
32921
+ this._cachedSource = undefined;
32922
+ this._cachedBuffer = cachedData ? cachedData.buffer : undefined;
32923
+ this._cachedSize = cachedData ? cachedData.size : undefined;
32924
+ this._cachedMaps = cachedData ? cachedData.maps : new Map();
32925
+ this._cachedHashUpdate = cachedData ? cachedData.hash : undefined;
32926
+ }
32927
+
32928
+ getCachedData() {
32929
+ const bufferedMaps = new Map();
32930
+ for (const pair of this._cachedMaps) {
32931
+ let cacheEntry = pair[1];
32932
+ if (cacheEntry.bufferedMap === undefined) {
32933
+ cacheEntry.bufferedMap = mapToBufferedMap(
32934
+ this._getMapFromCacheEntry(cacheEntry)
32935
+ );
32936
+ }
32937
+ bufferedMaps.set(pair[0], {
32938
+ map: undefined,
32939
+ bufferedMap: cacheEntry.bufferedMap
32940
+ });
32941
+ }
32942
+ // We don't want to cache strings
32943
+ // So if we have a caches sources
32944
+ // create a buffer from it and only store
32945
+ // if it was a Buffer or string
32946
+ if (this._cachedSource) {
32947
+ this.buffer();
32948
+ }
32949
+ return {
32950
+ buffer: this._cachedBuffer,
32951
+ source:
32952
+ this._cachedSourceType !== undefined
32953
+ ? this._cachedSourceType
32954
+ : typeof this._cachedSource === "string"
32955
+ ? true
32956
+ : Buffer.isBuffer(this._cachedSource)
32957
+ ? false
32958
+ : undefined,
32959
+ size: this._cachedSize,
32960
+ maps: bufferedMaps,
32961
+ hash: this._cachedHashUpdate
32962
+ };
32963
+ }
32964
+
32965
+ originalLazy() {
32966
+ return this._source;
32967
+ }
32968
+
32969
+ original() {
32970
+ if (typeof this._source === "function") this._source = this._source();
32971
+ return this._source;
32972
+ }
32973
+
32974
+ source() {
32975
+ const source = this._getCachedSource();
32976
+ if (source !== undefined) return source;
32977
+ return (this._cachedSource = this.original().source());
32978
+ }
32979
+
32980
+ _getMapFromCacheEntry(cacheEntry) {
32981
+ if (cacheEntry.map !== undefined) {
32982
+ return cacheEntry.map;
32983
+ } else if (cacheEntry.bufferedMap !== undefined) {
32984
+ return (cacheEntry.map = bufferedMapToMap(cacheEntry.bufferedMap));
32985
+ }
32986
+ }
32987
+
32988
+ _getCachedSource() {
32989
+ if (this._cachedSource !== undefined) return this._cachedSource;
32990
+ if (this._cachedBuffer && this._cachedSourceType !== undefined) {
32991
+ return (this._cachedSource = this._cachedSourceType
32992
+ ? this._cachedBuffer.toString("utf-8")
32993
+ : this._cachedBuffer);
32994
+ }
32995
+ }
32996
+
32997
+ buffer() {
32998
+ if (this._cachedBuffer !== undefined) return this._cachedBuffer;
32999
+ if (this._cachedSource !== undefined) {
33000
+ if (Buffer.isBuffer(this._cachedSource)) {
33001
+ return (this._cachedBuffer = this._cachedSource);
33002
+ }
33003
+ return (this._cachedBuffer = Buffer.from(this._cachedSource, "utf-8"));
33004
+ }
33005
+ if (typeof this.original().buffer === "function") {
33006
+ return (this._cachedBuffer = this.original().buffer());
33007
+ }
33008
+ const bufferOrString = this.source();
33009
+ if (Buffer.isBuffer(bufferOrString)) {
33010
+ return (this._cachedBuffer = bufferOrString);
33011
+ }
33012
+ return (this._cachedBuffer = Buffer.from(bufferOrString, "utf-8"));
33013
+ }
33014
+
33015
+ size() {
33016
+ if (this._cachedSize !== undefined) return this._cachedSize;
33017
+ if (this._cachedBuffer !== undefined) {
33018
+ return (this._cachedSize = this._cachedBuffer.length);
33019
+ }
33020
+ const source = this._getCachedSource();
33021
+ if (source !== undefined) {
33022
+ return (this._cachedSize = Buffer.byteLength(source));
33023
+ }
33024
+ return (this._cachedSize = this.original().size());
33025
+ }
33026
+
33027
+ sourceAndMap(options) {
33028
+ const key = options ? JSON.stringify(options) : "{}";
33029
+ const cacheEntry = this._cachedMaps.get(key);
33030
+ // Look for a cached map
33031
+ if (cacheEntry !== undefined) {
33032
+ // We have a cached map in some representation
33033
+ const map = this._getMapFromCacheEntry(cacheEntry);
33034
+ // Either get the cached source or compute it
33035
+ return { source: this.source(), map };
33036
+ }
33037
+ // Look for a cached source
33038
+ let source = this._getCachedSource();
33039
+ // Compute the map
33040
+ let map;
33041
+ if (source !== undefined) {
33042
+ map = this.original().map(options);
33043
+ } else {
33044
+ // Compute the source and map together.
33045
+ const sourceAndMap = this.original().sourceAndMap(options);
33046
+ source = sourceAndMap.source;
33047
+ map = sourceAndMap.map;
33048
+ this._cachedSource = source;
33049
+ }
33050
+ this._cachedMaps.set(key, {
33051
+ map,
33052
+ bufferedMap: undefined
33053
+ });
33054
+ return { source, map };
33055
+ }
33056
+
33057
+ streamChunks(options, onChunk, onSource, onName) {
33058
+ const key = options ? JSON.stringify(options) : "{}";
33059
+ if (
33060
+ this._cachedMaps.has(key) &&
33061
+ (this._cachedBuffer !== undefined || this._cachedSource !== undefined)
33062
+ ) {
33063
+ const { source, map } = this.sourceAndMap(options);
33064
+ if (map) {
33065
+ return streamChunksOfSourceMap(
33066
+ source,
33067
+ map,
33068
+ onChunk,
33069
+ onSource,
33070
+ onName,
33071
+ !!(options && options.finalSource),
33072
+ true
33073
+ );
33074
+ } else {
33075
+ return streamChunksOfRawSource(
33076
+ source,
33077
+ onChunk,
33078
+ onSource,
33079
+ onName,
33080
+ !!(options && options.finalSource)
33081
+ );
33082
+ }
33083
+ }
33084
+ const { result, source, map } = streamAndGetSourceAndMap(
33085
+ this.original(),
33086
+ options,
33087
+ onChunk,
33088
+ onSource,
33089
+ onName
33090
+ );
33091
+ this._cachedSource = source;
33092
+ this._cachedMaps.set(key, {
33093
+ map,
33094
+ bufferedMap: undefined
33095
+ });
33096
+ return result;
33097
+ }
33098
+
33099
+ map(options) {
33100
+ const key = options ? JSON.stringify(options) : "{}";
33101
+ const cacheEntry = this._cachedMaps.get(key);
33102
+ if (cacheEntry !== undefined) {
33103
+ return this._getMapFromCacheEntry(cacheEntry);
33104
+ }
33105
+ const map = this.original().map(options);
33106
+ this._cachedMaps.set(key, {
33107
+ map,
33108
+ bufferedMap: undefined
33109
+ });
33110
+ return map;
33111
+ }
33112
+
33113
+ updateHash(hash) {
33114
+ if (this._cachedHashUpdate !== undefined) {
33115
+ for (const item of this._cachedHashUpdate) hash.update(item);
33116
+ return;
33117
+ }
33118
+ const update = [];
33119
+ let currentString = undefined;
33120
+ const tracker = {
33121
+ update: item => {
33122
+ if (typeof item === "string" && item.length < 10240) {
33123
+ if (currentString === undefined) {
33124
+ currentString = item;
33125
+ } else {
33126
+ currentString += item;
33127
+ if (currentString.length > 102400) {
33128
+ update.push(Buffer.from(currentString));
33129
+ currentString = undefined;
33130
+ }
33131
+ }
33132
+ } else {
33133
+ if (currentString !== undefined) {
33134
+ update.push(Buffer.from(currentString));
33135
+ currentString = undefined;
33136
+ }
33137
+ update.push(item);
33138
+ }
33139
+ }
33140
+ };
33141
+ this.original().updateHash(tracker);
33142
+ if (currentString !== undefined) {
33143
+ update.push(Buffer.from(currentString));
33144
+ }
33145
+ for (const item of update) hash.update(item);
33146
+ this._cachedHashUpdate = update;
33147
+ }
33148
+ }
33149
+
33150
+ CachedSource_1 = CachedSource;
33151
+ return CachedSource_1;
33152
+ }
33153
+
33154
+ /*
33155
+ MIT License http://www.opensource.org/licenses/mit-license.php
33156
+ Author Tobias Koppers @sokra
33157
+ */
33158
+
33159
+ var ConcatSource_1;
33160
+ var hasRequiredConcatSource;
33161
+
33162
+ function requireConcatSource () {
33163
+ if (hasRequiredConcatSource) return ConcatSource_1;
33164
+ hasRequiredConcatSource = 1;
33165
+
33166
+ const Source = requireSource();
33167
+ const RawSource = requireRawSource();
33168
+ const streamChunks = requireStreamChunks();
33169
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
33170
+
33171
+ const stringsAsRawSources = new WeakSet();
33172
+
33173
+ class ConcatSource extends Source {
33174
+ constructor() {
33175
+ super();
33176
+ this._children = [];
33177
+ for (let i = 0; i < arguments.length; i++) {
33178
+ const item = arguments[i];
33179
+ if (item instanceof ConcatSource) {
33180
+ for (const child of item._children) {
33181
+ this._children.push(child);
33182
+ }
33183
+ } else {
33184
+ this._children.push(item);
33185
+ }
33186
+ }
33187
+ this._isOptimized = arguments.length === 0;
33188
+ }
33189
+
33190
+ getChildren() {
33191
+ if (!this._isOptimized) this._optimize();
33192
+ return this._children;
33193
+ }
33194
+
33195
+ add(item) {
33196
+ if (item instanceof ConcatSource) {
33197
+ for (const child of item._children) {
33198
+ this._children.push(child);
33199
+ }
33200
+ } else {
33201
+ this._children.push(item);
33202
+ }
33203
+ this._isOptimized = false;
33204
+ }
33205
+
33206
+ addAllSkipOptimizing(items) {
33207
+ for (const item of items) {
33208
+ this._children.push(item);
33209
+ }
33210
+ }
33211
+
33212
+ buffer() {
33213
+ if (!this._isOptimized) this._optimize();
33214
+ const buffers = [];
33215
+ for (const child of this._children) {
33216
+ if (typeof child.buffer === "function") {
33217
+ buffers.push(child.buffer());
33218
+ } else {
33219
+ const bufferOrString = child.source();
33220
+ if (Buffer.isBuffer(bufferOrString)) {
33221
+ buffers.push(bufferOrString);
33222
+ } else {
33223
+ // This will not happen
33224
+ buffers.push(Buffer.from(bufferOrString, "utf-8"));
33225
+ }
33226
+ }
33227
+ }
33228
+ return Buffer.concat(buffers);
33229
+ }
33230
+
33231
+ source() {
33232
+ if (!this._isOptimized) this._optimize();
33233
+ let source = "";
33234
+ for (const child of this._children) {
33235
+ source += child.source();
33236
+ }
33237
+ return source;
33238
+ }
33239
+
33240
+ size() {
33241
+ if (!this._isOptimized) this._optimize();
33242
+ let size = 0;
33243
+ for (const child of this._children) {
33244
+ size += child.size();
33245
+ }
33246
+ return size;
33247
+ }
33248
+
33249
+ map(options) {
33250
+ return getMap(this, options);
33251
+ }
33252
+
33253
+ sourceAndMap(options) {
33254
+ return getSourceAndMap(this, options);
33255
+ }
33256
+
33257
+ streamChunks(options, onChunk, onSource, onName) {
33258
+ if (!this._isOptimized) this._optimize();
33259
+ if (this._children.length === 1)
33260
+ return this._children[0].streamChunks(options, onChunk, onSource, onName);
33261
+ let currentLineOffset = 0;
33262
+ let currentColumnOffset = 0;
33263
+ let sourceMapping = new Map();
33264
+ let nameMapping = new Map();
33265
+ const finalSource = !!(options && options.finalSource);
33266
+ let code = "";
33267
+ let needToCloseMapping = false;
33268
+ for (const item of this._children) {
33269
+ const sourceIndexMapping = [];
33270
+ const nameIndexMapping = [];
33271
+ let lastMappingLine = 0;
33272
+ const { generatedLine, generatedColumn, source } = streamChunks(
33273
+ item,
33274
+ options,
33275
+ // eslint-disable-next-line no-loop-func
33276
+ (
33277
+ chunk,
33278
+ generatedLine,
33279
+ generatedColumn,
33280
+ sourceIndex,
33281
+ originalLine,
33282
+ originalColumn,
33283
+ nameIndex
33284
+ ) => {
33285
+ const line = generatedLine + currentLineOffset;
33286
+ const column =
33287
+ generatedLine === 1
33288
+ ? generatedColumn + currentColumnOffset
33289
+ : generatedColumn;
33290
+ if (needToCloseMapping) {
33291
+ if (generatedLine !== 1 || generatedColumn !== 0) {
33292
+ onChunk(
33293
+ undefined,
33294
+ currentLineOffset + 1,
33295
+ currentColumnOffset,
33296
+ -1,
33297
+ -1,
33298
+ -1,
33299
+ -1
33300
+ );
33301
+ }
33302
+ needToCloseMapping = false;
33303
+ }
33304
+ const resultSourceIndex =
33305
+ sourceIndex < 0 || sourceIndex >= sourceIndexMapping.length
33306
+ ? -1
33307
+ : sourceIndexMapping[sourceIndex];
33308
+ const resultNameIndex =
33309
+ nameIndex < 0 || nameIndex >= nameIndexMapping.length
33310
+ ? -1
33311
+ : nameIndexMapping[nameIndex];
33312
+ lastMappingLine = resultSourceIndex < 0 ? 0 : generatedLine;
33313
+ if (finalSource) {
33314
+ if (chunk !== undefined) code += chunk;
33315
+ if (resultSourceIndex >= 0) {
33316
+ onChunk(
33317
+ undefined,
33318
+ line,
33319
+ column,
33320
+ resultSourceIndex,
33321
+ originalLine,
33322
+ originalColumn,
33323
+ resultNameIndex
33324
+ );
33325
+ }
33326
+ } else {
33327
+ if (resultSourceIndex < 0) {
33328
+ onChunk(chunk, line, column, -1, -1, -1, -1);
33329
+ } else {
33330
+ onChunk(
33331
+ chunk,
33332
+ line,
33333
+ column,
33334
+ resultSourceIndex,
33335
+ originalLine,
33336
+ originalColumn,
33337
+ resultNameIndex
33338
+ );
33339
+ }
33340
+ }
33341
+ },
33342
+ (i, source, sourceContent) => {
33343
+ let globalIndex = sourceMapping.get(source);
33344
+ if (globalIndex === undefined) {
33345
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
33346
+ onSource(globalIndex, source, sourceContent);
33347
+ }
33348
+ sourceIndexMapping[i] = globalIndex;
33349
+ },
33350
+ (i, name) => {
33351
+ let globalIndex = nameMapping.get(name);
33352
+ if (globalIndex === undefined) {
33353
+ nameMapping.set(name, (globalIndex = nameMapping.size));
33354
+ onName(globalIndex, name);
33355
+ }
33356
+ nameIndexMapping[i] = globalIndex;
33357
+ }
33358
+ );
33359
+ if (source !== undefined) code += source;
33360
+ if (needToCloseMapping) {
33361
+ if (generatedLine !== 1 || generatedColumn !== 0) {
33362
+ onChunk(
33363
+ undefined,
33364
+ currentLineOffset + 1,
33365
+ currentColumnOffset,
33366
+ -1,
33367
+ -1,
33368
+ -1,
33369
+ -1
33370
+ );
33371
+ needToCloseMapping = false;
33372
+ }
33373
+ }
33374
+ if (generatedLine > 1) {
33375
+ currentColumnOffset = generatedColumn;
33376
+ } else {
33377
+ currentColumnOffset += generatedColumn;
33378
+ }
33379
+ needToCloseMapping =
33380
+ needToCloseMapping ||
33381
+ (finalSource && lastMappingLine === generatedLine);
33382
+ currentLineOffset += generatedLine - 1;
33383
+ }
33384
+ return {
33385
+ generatedLine: currentLineOffset + 1,
33386
+ generatedColumn: currentColumnOffset,
33387
+ source: finalSource ? code : undefined
33388
+ };
33389
+ }
33390
+
33391
+ updateHash(hash) {
33392
+ if (!this._isOptimized) this._optimize();
33393
+ hash.update("ConcatSource");
33394
+ for (const item of this._children) {
33395
+ item.updateHash(hash);
33396
+ }
33397
+ }
33398
+
33399
+ _optimize() {
33400
+ const newChildren = [];
33401
+ let currentString = undefined;
33402
+ let currentRawSources = undefined;
33403
+ const addStringToRawSources = string => {
33404
+ if (currentRawSources === undefined) {
33405
+ currentRawSources = string;
33406
+ } else if (Array.isArray(currentRawSources)) {
33407
+ currentRawSources.push(string);
33408
+ } else {
33409
+ currentRawSources = [
33410
+ typeof currentRawSources === "string"
33411
+ ? currentRawSources
33412
+ : currentRawSources.source(),
33413
+ string
33414
+ ];
33415
+ }
33416
+ };
33417
+ const addSourceToRawSources = source => {
33418
+ if (currentRawSources === undefined) {
33419
+ currentRawSources = source;
33420
+ } else if (Array.isArray(currentRawSources)) {
33421
+ currentRawSources.push(source.source());
33422
+ } else {
33423
+ currentRawSources = [
33424
+ typeof currentRawSources === "string"
33425
+ ? currentRawSources
33426
+ : currentRawSources.source(),
33427
+ source.source()
33428
+ ];
33429
+ }
33430
+ };
33431
+ const mergeRawSources = () => {
33432
+ if (Array.isArray(currentRawSources)) {
33433
+ const rawSource = new RawSource(currentRawSources.join(""));
33434
+ stringsAsRawSources.add(rawSource);
33435
+ newChildren.push(rawSource);
33436
+ } else if (typeof currentRawSources === "string") {
33437
+ const rawSource = new RawSource(currentRawSources);
33438
+ stringsAsRawSources.add(rawSource);
33439
+ newChildren.push(rawSource);
33440
+ } else {
33441
+ newChildren.push(currentRawSources);
33442
+ }
33443
+ };
33444
+ for (const child of this._children) {
33445
+ if (typeof child === "string") {
33446
+ if (currentString === undefined) {
33447
+ currentString = child;
33448
+ } else {
33449
+ currentString += child;
33450
+ }
33451
+ } else {
33452
+ if (currentString !== undefined) {
33453
+ addStringToRawSources(currentString);
33454
+ currentString = undefined;
33455
+ }
33456
+ if (stringsAsRawSources.has(child)) {
33457
+ addSourceToRawSources(child);
33458
+ } else {
33459
+ if (currentRawSources !== undefined) {
33460
+ mergeRawSources();
33461
+ currentRawSources = undefined;
33462
+ }
33463
+ newChildren.push(child);
33464
+ }
33465
+ }
33466
+ }
33467
+ if (currentString !== undefined) {
33468
+ addStringToRawSources(currentString);
33469
+ }
33470
+ if (currentRawSources !== undefined) {
33471
+ mergeRawSources();
33472
+ }
33473
+ this._children = newChildren;
33474
+ this._isOptimized = true;
33475
+ }
33476
+ }
33477
+
33478
+ ConcatSource_1 = ConcatSource;
33479
+ return ConcatSource_1;
33480
+ }
33481
+
33482
+ /*
33483
+ MIT License http://www.opensource.org/licenses/mit-license.php
33484
+ Author Tobias Koppers @sokra
33485
+ */
33486
+
33487
+ var ReplaceSource_1;
33488
+ var hasRequiredReplaceSource;
33489
+
33490
+ function requireReplaceSource () {
33491
+ if (hasRequiredReplaceSource) return ReplaceSource_1;
33492
+ hasRequiredReplaceSource = 1;
33493
+
33494
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
33495
+ const streamChunks = requireStreamChunks();
33496
+ const Source = requireSource();
33497
+ const splitIntoLines = requireSplitIntoLines();
33498
+
33499
+ // since v8 7.0, Array.prototype.sort is stable
33500
+ const hasStableSort =
33501
+ typeof process === "object" &&
33502
+ process.versions &&
33503
+ typeof process.versions.v8 === "string" &&
33504
+ !/^[0-6]\./.test(process.versions.v8);
33505
+
33506
+ // This is larger than max string length
33507
+ const MAX_SOURCE_POSITION = 0x20000000;
33508
+
33509
+ class Replacement {
33510
+ constructor(start, end, content, name) {
33511
+ this.start = start;
33512
+ this.end = end;
33513
+ this.content = content;
33514
+ this.name = name;
33515
+ if (!hasStableSort) {
33516
+ this.index = -1;
33517
+ }
33518
+ }
33519
+ }
33520
+
33521
+ class ReplaceSource extends Source {
33522
+ constructor(source, name) {
33523
+ super();
33524
+ this._source = source;
33525
+ this._name = name;
33526
+ /** @type {Replacement[]} */
33527
+ this._replacements = [];
33528
+ this._isSorted = true;
33529
+ }
33530
+
33531
+ getName() {
33532
+ return this._name;
33533
+ }
33534
+
33535
+ getReplacements() {
33536
+ this._sortReplacements();
33537
+ return this._replacements;
33538
+ }
33539
+
33540
+ replace(start, end, newValue, name) {
33541
+ if (typeof newValue !== "string")
33542
+ throw new Error(
33543
+ "insertion must be a string, but is a " + typeof newValue
33544
+ );
33545
+ this._replacements.push(new Replacement(start, end, newValue, name));
33546
+ this._isSorted = false;
33547
+ }
33548
+
33549
+ insert(pos, newValue, name) {
33550
+ if (typeof newValue !== "string")
33551
+ throw new Error(
33552
+ "insertion must be a string, but is a " +
33553
+ typeof newValue +
33554
+ ": " +
33555
+ newValue
33556
+ );
33557
+ this._replacements.push(new Replacement(pos, pos - 1, newValue, name));
33558
+ this._isSorted = false;
33559
+ }
33560
+
33561
+ source() {
33562
+ if (this._replacements.length === 0) {
33563
+ return this._source.source();
33564
+ }
33565
+ let current = this._source.source();
33566
+ let pos = 0;
33567
+ const result = [];
33568
+
33569
+ this._sortReplacements();
33570
+ for (const replacement of this._replacements) {
33571
+ const start = Math.floor(replacement.start);
33572
+ const end = Math.floor(replacement.end + 1);
33573
+ if (pos < start) {
33574
+ const offset = start - pos;
33575
+ result.push(current.slice(0, offset));
33576
+ current = current.slice(offset);
33577
+ pos = start;
33578
+ }
33579
+ result.push(replacement.content);
33580
+ if (pos < end) {
33581
+ const offset = end - pos;
33582
+ current = current.slice(offset);
33583
+ pos = end;
33584
+ }
33585
+ }
33586
+ result.push(current);
33587
+ return result.join("");
33588
+ }
33589
+
33590
+ map(options) {
33591
+ if (this._replacements.length === 0) {
33592
+ return this._source.map(options);
33593
+ }
33594
+ return getMap(this, options);
33595
+ }
33596
+
33597
+ sourceAndMap(options) {
33598
+ if (this._replacements.length === 0) {
33599
+ return this._source.sourceAndMap(options);
33600
+ }
33601
+ return getSourceAndMap(this, options);
33602
+ }
33603
+
33604
+ original() {
33605
+ return this._source;
33606
+ }
33607
+
33608
+ _sortReplacements() {
33609
+ if (this._isSorted) return;
33610
+ if (hasStableSort) {
33611
+ this._replacements.sort(function (a, b) {
33612
+ const diff1 = a.start - b.start;
33613
+ if (diff1 !== 0) return diff1;
33614
+ const diff2 = a.end - b.end;
33615
+ if (diff2 !== 0) return diff2;
33616
+ return 0;
33617
+ });
33618
+ } else {
33619
+ this._replacements.forEach((repl, i) => (repl.index = i));
33620
+ this._replacements.sort(function (a, b) {
33621
+ const diff1 = a.start - b.start;
33622
+ if (diff1 !== 0) return diff1;
33623
+ const diff2 = a.end - b.end;
33624
+ if (diff2 !== 0) return diff2;
33625
+ return a.index - b.index;
33626
+ });
33627
+ }
33628
+ this._isSorted = true;
33629
+ }
33630
+
33631
+ streamChunks(options, onChunk, onSource, onName) {
33632
+ this._sortReplacements();
33633
+ const repls = this._replacements;
33634
+ let pos = 0;
33635
+ let i = 0;
33636
+ let replacmentEnd = -1;
33637
+ let nextReplacement =
33638
+ i < repls.length ? Math.floor(repls[i].start) : MAX_SOURCE_POSITION;
33639
+ let generatedLineOffset = 0;
33640
+ let generatedColumnOffset = 0;
33641
+ let generatedColumnOffsetLine = 0;
33642
+ const sourceContents = [];
33643
+ const nameMapping = new Map();
33644
+ const nameIndexMapping = [];
33645
+ const checkOriginalContent = (sourceIndex, line, column, expectedChunk) => {
33646
+ let content =
33647
+ sourceIndex < sourceContents.length
33648
+ ? sourceContents[sourceIndex]
33649
+ : undefined;
33650
+ if (content === undefined) return false;
33651
+ if (typeof content === "string") {
33652
+ content = splitIntoLines(content);
33653
+ sourceContents[sourceIndex] = content;
33654
+ }
33655
+ const contentLine = line <= content.length ? content[line - 1] : null;
33656
+ if (contentLine === null) return false;
33657
+ return (
33658
+ contentLine.slice(column, column + expectedChunk.length) ===
33659
+ expectedChunk
33660
+ );
33661
+ };
33662
+ let { generatedLine, generatedColumn } = streamChunks(
33663
+ this._source,
33664
+ Object.assign({}, options, { finalSource: false }),
33665
+ (
33666
+ chunk,
33667
+ generatedLine,
33668
+ generatedColumn,
33669
+ sourceIndex,
33670
+ originalLine,
33671
+ originalColumn,
33672
+ nameIndex
33673
+ ) => {
33674
+ let chunkPos = 0;
33675
+ let endPos = pos + chunk.length;
33676
+
33677
+ // Skip over when it has been replaced
33678
+ if (replacmentEnd > pos) {
33679
+ // Skip over the whole chunk
33680
+ if (replacmentEnd >= endPos) {
33681
+ const line = generatedLine + generatedLineOffset;
33682
+ if (chunk.endsWith("\n")) {
33683
+ generatedLineOffset--;
33684
+ if (generatedColumnOffsetLine === line) {
33685
+ // undo exiting corrections form the current line
33686
+ generatedColumnOffset += generatedColumn;
33687
+ }
33688
+ } else if (generatedColumnOffsetLine === line) {
33689
+ generatedColumnOffset -= chunk.length;
33690
+ } else {
33691
+ generatedColumnOffset = -chunk.length;
33692
+ generatedColumnOffsetLine = line;
33693
+ }
33694
+ pos = endPos;
33695
+ return;
33696
+ }
33697
+
33698
+ // Partially skip over chunk
33699
+ chunkPos = replacmentEnd - pos;
33700
+ if (
33701
+ checkOriginalContent(
33702
+ sourceIndex,
33703
+ originalLine,
33704
+ originalColumn,
33705
+ chunk.slice(0, chunkPos)
33706
+ )
33707
+ ) {
33708
+ originalColumn += chunkPos;
33709
+ }
33710
+ pos += chunkPos;
33711
+ const line = generatedLine + generatedLineOffset;
33712
+ if (generatedColumnOffsetLine === line) {
33713
+ generatedColumnOffset -= chunkPos;
33714
+ } else {
33715
+ generatedColumnOffset = -chunkPos;
33716
+ generatedColumnOffsetLine = line;
33717
+ }
33718
+ generatedColumn += chunkPos;
33719
+ }
33720
+
33721
+ // Is a replacement in the chunk?
33722
+ if (nextReplacement < endPos) {
33723
+ do {
33724
+ let line = generatedLine + generatedLineOffset;
33725
+ if (nextReplacement > pos) {
33726
+ // Emit chunk until replacement
33727
+ const offset = nextReplacement - pos;
33728
+ const chunkSlice = chunk.slice(chunkPos, chunkPos + offset);
33729
+ onChunk(
33730
+ chunkSlice,
33731
+ line,
33732
+ generatedColumn +
33733
+ (line === generatedColumnOffsetLine
33734
+ ? generatedColumnOffset
33735
+ : 0),
33736
+ sourceIndex,
33737
+ originalLine,
33738
+ originalColumn,
33739
+ nameIndex < 0 || nameIndex >= nameIndexMapping.length
33740
+ ? -1
33741
+ : nameIndexMapping[nameIndex]
33742
+ );
33743
+ generatedColumn += offset;
33744
+ chunkPos += offset;
33745
+ pos = nextReplacement;
33746
+ if (
33747
+ checkOriginalContent(
33748
+ sourceIndex,
33749
+ originalLine,
33750
+ originalColumn,
33751
+ chunkSlice
33752
+ )
33753
+ ) {
33754
+ originalColumn += chunkSlice.length;
33755
+ }
33756
+ }
33757
+
33758
+ // Insert replacement content splitted into chunks by lines
33759
+ const { content, name } = repls[i];
33760
+ let matches = splitIntoLines(content);
33761
+ let replacementNameIndex = nameIndex;
33762
+ if (sourceIndex >= 0 && name) {
33763
+ let globalIndex = nameMapping.get(name);
33764
+ if (globalIndex === undefined) {
33765
+ globalIndex = nameMapping.size;
33766
+ nameMapping.set(name, globalIndex);
33767
+ onName(globalIndex, name);
33768
+ }
33769
+ replacementNameIndex = globalIndex;
33770
+ }
33771
+ for (let m = 0; m < matches.length; m++) {
33772
+ const contentLine = matches[m];
33773
+ onChunk(
33774
+ contentLine,
33775
+ line,
33776
+ generatedColumn +
33777
+ (line === generatedColumnOffsetLine
33778
+ ? generatedColumnOffset
33779
+ : 0),
33780
+ sourceIndex,
33781
+ originalLine,
33782
+ originalColumn,
33783
+ replacementNameIndex
33784
+ );
33785
+
33786
+ // Only the first chunk has name assigned
33787
+ replacementNameIndex = -1;
33788
+
33789
+ if (m === matches.length - 1 && !contentLine.endsWith("\n")) {
33790
+ if (generatedColumnOffsetLine === line) {
33791
+ generatedColumnOffset += contentLine.length;
33792
+ } else {
33793
+ generatedColumnOffset = contentLine.length;
33794
+ generatedColumnOffsetLine = line;
33795
+ }
33796
+ } else {
33797
+ generatedLineOffset++;
33798
+ line++;
33799
+ generatedColumnOffset = -generatedColumn;
33800
+ generatedColumnOffsetLine = line;
33801
+ }
33802
+ }
33803
+
33804
+ // Remove replaced content by settings this variable
33805
+ replacmentEnd = Math.max(
33806
+ replacmentEnd,
33807
+ Math.floor(repls[i].end + 1)
33808
+ );
33809
+
33810
+ // Move to next replacment
33811
+ i++;
33812
+ nextReplacement =
33813
+ i < repls.length
33814
+ ? Math.floor(repls[i].start)
33815
+ : MAX_SOURCE_POSITION;
33816
+
33817
+ // Skip over when it has been replaced
33818
+ const offset = chunk.length - endPos + replacmentEnd - chunkPos;
33819
+ if (offset > 0) {
33820
+ // Skip over whole chunk
33821
+ if (replacmentEnd >= endPos) {
33822
+ let line = generatedLine + generatedLineOffset;
33823
+ if (chunk.endsWith("\n")) {
33824
+ generatedLineOffset--;
33825
+ if (generatedColumnOffsetLine === line) {
33826
+ // undo exiting corrections form the current line
33827
+ generatedColumnOffset += generatedColumn;
33828
+ }
33829
+ } else if (generatedColumnOffsetLine === line) {
33830
+ generatedColumnOffset -= chunk.length - chunkPos;
33831
+ } else {
33832
+ generatedColumnOffset = chunkPos - chunk.length;
33833
+ generatedColumnOffsetLine = line;
33834
+ }
33835
+ pos = endPos;
33836
+ return;
33837
+ }
33838
+
33839
+ // Partially skip over chunk
33840
+ const line = generatedLine + generatedLineOffset;
33841
+ if (
33842
+ checkOriginalContent(
33843
+ sourceIndex,
33844
+ originalLine,
33845
+ originalColumn,
33846
+ chunk.slice(chunkPos, chunkPos + offset)
33847
+ )
33848
+ ) {
33849
+ originalColumn += offset;
33850
+ }
33851
+ chunkPos += offset;
33852
+ pos += offset;
33853
+ if (generatedColumnOffsetLine === line) {
33854
+ generatedColumnOffset -= offset;
33855
+ } else {
33856
+ generatedColumnOffset = -offset;
33857
+ generatedColumnOffsetLine = line;
33858
+ }
33859
+ generatedColumn += offset;
33860
+ }
33861
+ } while (nextReplacement < endPos);
33862
+ }
33863
+
33864
+ // Emit remaining chunk
33865
+ if (chunkPos < chunk.length) {
33866
+ const chunkSlice = chunkPos === 0 ? chunk : chunk.slice(chunkPos);
33867
+ const line = generatedLine + generatedLineOffset;
33868
+ onChunk(
33869
+ chunkSlice,
33870
+ line,
33871
+ generatedColumn +
33872
+ (line === generatedColumnOffsetLine ? generatedColumnOffset : 0),
33873
+ sourceIndex,
33874
+ originalLine,
33875
+ originalColumn,
33876
+ nameIndex < 0 ? -1 : nameIndexMapping[nameIndex]
33877
+ );
33878
+ }
33879
+ pos = endPos;
33880
+ },
33881
+ (sourceIndex, source, sourceContent) => {
33882
+ while (sourceContents.length < sourceIndex)
33883
+ sourceContents.push(undefined);
33884
+ sourceContents[sourceIndex] = sourceContent;
33885
+ onSource(sourceIndex, source, sourceContent);
33886
+ },
33887
+ (nameIndex, name) => {
33888
+ let globalIndex = nameMapping.get(name);
33889
+ if (globalIndex === undefined) {
33890
+ globalIndex = nameMapping.size;
33891
+ nameMapping.set(name, globalIndex);
33892
+ onName(globalIndex, name);
33893
+ }
33894
+ nameIndexMapping[nameIndex] = globalIndex;
33895
+ }
33896
+ );
33897
+
33898
+ // Handle remaining replacements
33899
+ let remainer = "";
33900
+ for (; i < repls.length; i++) {
33901
+ remainer += repls[i].content;
33902
+ }
33903
+
33904
+ // Insert remaining replacements content splitted into chunks by lines
33905
+ let line = generatedLine + generatedLineOffset;
33906
+ let matches = splitIntoLines(remainer);
33907
+ for (let m = 0; m < matches.length; m++) {
33908
+ const contentLine = matches[m];
33909
+ onChunk(
33910
+ contentLine,
33911
+ line,
33912
+ generatedColumn +
33913
+ (line === generatedColumnOffsetLine ? generatedColumnOffset : 0),
33914
+ -1,
33915
+ -1,
33916
+ -1,
33917
+ -1
33918
+ );
33919
+
33920
+ if (m === matches.length - 1 && !contentLine.endsWith("\n")) {
33921
+ if (generatedColumnOffsetLine === line) {
33922
+ generatedColumnOffset += contentLine.length;
33923
+ } else {
33924
+ generatedColumnOffset = contentLine.length;
33925
+ generatedColumnOffsetLine = line;
33926
+ }
33927
+ } else {
33928
+ generatedLineOffset++;
33929
+ line++;
33930
+ generatedColumnOffset = -generatedColumn;
33931
+ generatedColumnOffsetLine = line;
33932
+ }
33933
+ }
33934
+
33935
+ return {
33936
+ generatedLine: line,
33937
+ generatedColumn:
33938
+ generatedColumn +
33939
+ (line === generatedColumnOffsetLine ? generatedColumnOffset : 0)
33940
+ };
33941
+ }
33942
+
33943
+ updateHash(hash) {
33944
+ this._sortReplacements();
33945
+ hash.update("ReplaceSource");
33946
+ this._source.updateHash(hash);
33947
+ hash.update(this._name || "");
33948
+ for (const repl of this._replacements) {
33949
+ hash.update(`${repl.start}${repl.end}${repl.content}${repl.name}`);
33950
+ }
33951
+ }
33952
+ }
33953
+
33954
+ ReplaceSource_1 = ReplaceSource;
33955
+ return ReplaceSource_1;
33956
+ }
33957
+
33958
+ /*
33959
+ MIT License http://www.opensource.org/licenses/mit-license.php
33960
+ Author Tobias Koppers @sokra
33961
+ */
33962
+
33963
+ var PrefixSource_1;
33964
+ var hasRequiredPrefixSource;
33965
+
33966
+ function requirePrefixSource () {
33967
+ if (hasRequiredPrefixSource) return PrefixSource_1;
33968
+ hasRequiredPrefixSource = 1;
33969
+
33970
+ const Source = requireSource();
33971
+ const RawSource = requireRawSource();
33972
+ const streamChunks = requireStreamChunks();
33973
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
33974
+
33975
+ const REPLACE_REGEX = /\n(?=.|\s)/g;
33976
+
33977
+ class PrefixSource extends Source {
33978
+ constructor(prefix, source) {
33979
+ super();
33980
+ this._source =
33981
+ typeof source === "string" || Buffer.isBuffer(source)
33982
+ ? new RawSource(source, true)
33983
+ : source;
33984
+ this._prefix = prefix;
33985
+ }
33986
+
33987
+ getPrefix() {
33988
+ return this._prefix;
33989
+ }
33990
+
33991
+ original() {
33992
+ return this._source;
33993
+ }
33994
+
33995
+ source() {
33996
+ const node = this._source.source();
33997
+ const prefix = this._prefix;
33998
+ return prefix + node.replace(REPLACE_REGEX, "\n" + prefix);
33999
+ }
34000
+
34001
+ // TODO efficient buffer() implementation
34002
+
34003
+ map(options) {
34004
+ return getMap(this, options);
34005
+ }
34006
+
34007
+ sourceAndMap(options) {
34008
+ return getSourceAndMap(this, options);
34009
+ }
34010
+
34011
+ streamChunks(options, onChunk, onSource, onName) {
34012
+ const prefix = this._prefix;
34013
+ const prefixOffset = prefix.length;
34014
+ const linesOnly = !!(options && options.columns === false);
34015
+ const { generatedLine, generatedColumn, source } = streamChunks(
34016
+ this._source,
34017
+ options,
34018
+ (
34019
+ chunk,
34020
+ generatedLine,
34021
+ generatedColumn,
34022
+ sourceIndex,
34023
+ originalLine,
34024
+ originalColumn,
34025
+ nameIndex
34026
+ ) => {
34027
+ if (generatedColumn !== 0) {
34028
+ // In the middle of the line, we just adject the column
34029
+ generatedColumn += prefixOffset;
34030
+ } else if (chunk !== undefined) {
34031
+ // At the start of the line, when we have source content
34032
+ // add the prefix as generated mapping
34033
+ // (in lines only mode we just add it to the original mapping
34034
+ // for performance reasons)
34035
+ if (linesOnly || sourceIndex < 0) {
34036
+ chunk = prefix + chunk;
34037
+ } else if (prefixOffset > 0) {
34038
+ onChunk(prefix, generatedLine, generatedColumn, -1, -1, -1, -1);
34039
+ generatedColumn += prefixOffset;
34040
+ }
34041
+ } else if (!linesOnly) {
34042
+ // Without source content, we only need to adject the column info
34043
+ // expect in lines only mode where prefix is added to original mapping
34044
+ generatedColumn += prefixOffset;
34045
+ }
34046
+ onChunk(
34047
+ chunk,
34048
+ generatedLine,
34049
+ generatedColumn,
34050
+ sourceIndex,
34051
+ originalLine,
34052
+ originalColumn,
34053
+ nameIndex
34054
+ );
34055
+ },
34056
+ onSource,
34057
+ onName
34058
+ );
34059
+ return {
34060
+ generatedLine,
34061
+ generatedColumn:
34062
+ generatedColumn === 0 ? 0 : prefixOffset + generatedColumn,
34063
+ source:
34064
+ source !== undefined
34065
+ ? prefix + source.replace(REPLACE_REGEX, "\n" + prefix)
34066
+ : undefined
34067
+ };
34068
+ }
34069
+
34070
+ updateHash(hash) {
34071
+ hash.update("PrefixSource");
34072
+ this._source.updateHash(hash);
34073
+ hash.update(this._prefix);
34074
+ }
34075
+ }
34076
+
34077
+ PrefixSource_1 = PrefixSource;
34078
+ return PrefixSource_1;
34079
+ }
34080
+
34081
+ /*
34082
+ MIT License http://www.opensource.org/licenses/mit-license.php
34083
+ Author Tobias Koppers @sokra
34084
+ */
34085
+
34086
+ var SizeOnlySource_1;
34087
+ var hasRequiredSizeOnlySource;
34088
+
34089
+ function requireSizeOnlySource () {
34090
+ if (hasRequiredSizeOnlySource) return SizeOnlySource_1;
34091
+ hasRequiredSizeOnlySource = 1;
34092
+
34093
+ const Source = requireSource();
34094
+
34095
+ class SizeOnlySource extends Source {
34096
+ constructor(size) {
34097
+ super();
34098
+ this._size = size;
34099
+ }
34100
+
34101
+ _error() {
34102
+ return new Error(
34103
+ "Content and Map of this Source is not available (only size() is supported)"
34104
+ );
34105
+ }
34106
+
34107
+ size() {
34108
+ return this._size;
34109
+ }
34110
+
34111
+ source() {
34112
+ throw this._error();
34113
+ }
34114
+
34115
+ buffer() {
34116
+ throw this._error();
34117
+ }
34118
+
34119
+ map(options) {
34120
+ throw this._error();
34121
+ }
34122
+
34123
+ updateHash() {
34124
+ throw this._error();
34125
+ }
34126
+ }
34127
+
34128
+ SizeOnlySource_1 = SizeOnlySource;
34129
+ return SizeOnlySource_1;
34130
+ }
34131
+
34132
+ /*
34133
+ MIT License http://www.opensource.org/licenses/mit-license.php
34134
+ Author Tobias Koppers @sokra
34135
+ */
34136
+
34137
+ var CompatSource_1;
34138
+ var hasRequiredCompatSource;
34139
+
34140
+ function requireCompatSource () {
34141
+ if (hasRequiredCompatSource) return CompatSource_1;
34142
+ hasRequiredCompatSource = 1;
34143
+
34144
+ const Source = requireSource();
34145
+
34146
+ class CompatSource extends Source {
34147
+ static from(sourceLike) {
34148
+ return sourceLike instanceof Source
34149
+ ? sourceLike
34150
+ : new CompatSource(sourceLike);
34151
+ }
34152
+
34153
+ constructor(sourceLike) {
34154
+ super();
34155
+ this._sourceLike = sourceLike;
34156
+ }
34157
+
34158
+ source() {
34159
+ return this._sourceLike.source();
34160
+ }
34161
+
34162
+ buffer() {
34163
+ if (typeof this._sourceLike.buffer === "function") {
34164
+ return this._sourceLike.buffer();
34165
+ }
34166
+ return super.buffer();
34167
+ }
34168
+
34169
+ size() {
34170
+ if (typeof this._sourceLike.size === "function") {
34171
+ return this._sourceLike.size();
34172
+ }
34173
+ return super.size();
34174
+ }
34175
+
34176
+ map(options) {
34177
+ if (typeof this._sourceLike.map === "function") {
34178
+ return this._sourceLike.map(options);
34179
+ }
34180
+ return super.map(options);
34181
+ }
34182
+
34183
+ sourceAndMap(options) {
34184
+ if (typeof this._sourceLike.sourceAndMap === "function") {
34185
+ return this._sourceLike.sourceAndMap(options);
34186
+ }
34187
+ return super.sourceAndMap(options);
34188
+ }
34189
+
34190
+ updateHash(hash) {
34191
+ if (typeof this._sourceLike.updateHash === "function") {
34192
+ return this._sourceLike.updateHash(hash);
34193
+ }
34194
+ if (typeof this._sourceLike.map === "function") {
34195
+ throw new Error(
34196
+ "A Source-like object with a 'map' method must also provide an 'updateHash' method"
34197
+ );
34198
+ }
34199
+ hash.update(this.buffer());
34200
+ }
34201
+ }
34202
+
34203
+ CompatSource_1 = CompatSource;
34204
+ return CompatSource_1;
34205
+ }
34206
+
34207
+ /*
34208
+ MIT License http://www.opensource.org/licenses/mit-license.php
34209
+ Author Tobias Koppers @sokra
34210
+ */
34211
+
34212
+ (function (exports) {
34213
+ const defineExport = (name, fn) => {
34214
+ let value;
34215
+ Object.defineProperty(exports, name, {
34216
+ get: () => {
34217
+ if (fn !== undefined) {
34218
+ value = fn();
34219
+ fn = undefined;
34220
+ }
34221
+ return value;
34222
+ },
34223
+ configurable: true
34224
+ });
34225
+ };
34226
+
34227
+ defineExport("Source", () => requireSource());
34228
+
34229
+ defineExport("RawSource", () => requireRawSource());
34230
+ defineExport("OriginalSource", () => requireOriginalSource());
34231
+ defineExport("SourceMapSource", () => requireSourceMapSource());
34232
+ defineExport("CachedSource", () => requireCachedSource());
34233
+ defineExport("ConcatSource", () => requireConcatSource());
34234
+ defineExport("ReplaceSource", () => requireReplaceSource());
34235
+ defineExport("PrefixSource", () => requirePrefixSource());
34236
+ defineExport("SizeOnlySource", () => requireSizeOnlySource());
34237
+ defineExport("CompatSource", () => requireCompatSource());
34238
+ } (lib$1));
34239
+
34240
+ var sources2 = /*@__PURE__*/getDefaultExportFromCjs(lib$1);
34241
+
30826
34242
  var virtualStats = {};
30827
34243
 
30828
34244
  var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
@@ -30959,11 +34375,6 @@ function getReadDirBackend(fileSystem) {
30959
34375
  throw new Error("Couldn't find a readDirStorage from Webpack Internals");
30960
34376
  }
30961
34377
  }
30962
- function getRealpathBackend(fileSystem) {
30963
- if (fileSystem._realpathBackend) {
30964
- return fileSystem._realpathBackend;
30965
- }
30966
- }
30967
34378
  class VirtualModulesPlugin {
30968
34379
  constructor(modules) {
30969
34380
  this._compiler = null;
@@ -31066,7 +34477,6 @@ class VirtualModulesPlugin {
31066
34477
  const statStorage = getStatStorage(finalInputFileSystem);
31067
34478
  const fileStorage = getFileStorage(finalInputFileSystem);
31068
34479
  const readDirStorage = getReadDirBackend(finalInputFileSystem);
31069
- const realPathStorage = getRealpathBackend(finalInputFileSystem);
31070
34480
  finalInputFileSystem._virtualFiles = finalInputFileSystem._virtualFiles || {};
31071
34481
  finalInputFileSystem._virtualFiles[file] = { stats: stats, contents: contents };
31072
34482
  setData(statStorage, file, createWebpackData(stats));
@@ -31098,9 +34508,6 @@ class VirtualModulesPlugin {
31098
34508
  birthtime: time,
31099
34509
  });
31100
34510
  setData(readDirStorage, dir, createWebpackData([]));
31101
- if (realPathStorage) {
31102
- setData(realPathStorage, dir, createWebpackData(dir));
31103
- }
31104
34511
  setData(statStorage, dir, createWebpackData(dirStats));
31105
34512
  }
31106
34513
  let dirData = getData(getReadDirBackend(finalInputFileSystem), dir);
@@ -31161,12 +34568,12 @@ var lib = VirtualModulesPlugin;
31161
34568
 
31162
34569
  var VirtualModulesPlugin$1 = /*@__PURE__*/getDefaultExportFromCjs(lib);
31163
34570
 
31164
- // node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_typescript@5.5.4/node_modules/tsup/assets/esm_shims.js
34571
+ // node_modules/.pnpm/tsup@8.0.2_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
31165
34572
  var getFilename = () => fileURLToPath$1(import.meta.url);
31166
34573
  var getDirname = () => require$$1.dirname(getFilename());
31167
34574
  var __dirname = /* @__PURE__ */ getDirname();
31168
34575
 
31169
- // node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
34576
+ // node_modules/.pnpm/@jridgewell+sourcemap-codec@1.4.15/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
31170
34577
  var comma = ",".charCodeAt(0);
31171
34578
  var semicolon = ";".charCodeAt(0);
31172
34579
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -31177,41 +34584,6 @@ for (let i = 0; i < chars.length; i++) {
31177
34584
  intToChar[i] = c;
31178
34585
  charToInt[c] = i;
31179
34586
  }
31180
- function decodeInteger(reader, relative) {
31181
- let value = 0;
31182
- let shift = 0;
31183
- let integer = 0;
31184
- do {
31185
- const c = reader.next();
31186
- integer = charToInt[c];
31187
- value |= (integer & 31) << shift;
31188
- shift += 5;
31189
- } while (integer & 32);
31190
- const shouldNegate = value & 1;
31191
- value >>>= 1;
31192
- if (shouldNegate) {
31193
- value = -2147483648 | -value;
31194
- }
31195
- return relative + value;
31196
- }
31197
- function encodeInteger(builder, num, relative) {
31198
- let delta = num - relative;
31199
- delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
31200
- do {
31201
- let clamped = delta & 31;
31202
- delta >>>= 5;
31203
- if (delta > 0)
31204
- clamped |= 32;
31205
- builder.write(intToChar[clamped]);
31206
- } while (delta > 0);
31207
- return num;
31208
- }
31209
- function hasMoreVlq(reader, max) {
31210
- if (reader.pos >= max)
31211
- return false;
31212
- return reader.peek() !== comma;
31213
- }
31214
- var bufLength = 1024 * 16;
31215
34587
  var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
31216
34588
  decode(buf) {
31217
34589
  const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
@@ -31226,86 +34598,72 @@ var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder()
31226
34598
  return out;
31227
34599
  }
31228
34600
  };
31229
- var StringWriter = class {
31230
- constructor() {
31231
- this.pos = 0;
31232
- this.out = "";
31233
- this.buffer = new Uint8Array(bufLength);
31234
- }
31235
- write(v) {
31236
- const { buffer } = this;
31237
- buffer[this.pos++] = v;
31238
- if (this.pos === bufLength) {
31239
- this.out += td.decode(buffer);
31240
- this.pos = 0;
31241
- }
31242
- }
31243
- flush() {
31244
- const { buffer, out, pos } = this;
31245
- return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
31246
- }
31247
- };
31248
- var StringReader = class {
31249
- constructor(buffer) {
31250
- this.pos = 0;
31251
- this.buffer = buffer;
31252
- }
31253
- next() {
31254
- return this.buffer.charCodeAt(this.pos++);
31255
- }
31256
- peek() {
31257
- return this.buffer.charCodeAt(this.pos);
31258
- }
31259
- indexOf(char) {
31260
- const { buffer, pos } = this;
31261
- const idx = buffer.indexOf(char, pos);
31262
- return idx === -1 ? buffer.length : idx;
31263
- }
31264
- };
31265
34601
  function decode(mappings) {
31266
- const { length } = mappings;
31267
- const reader = new StringReader(mappings);
34602
+ const state = new Int32Array(5);
31268
34603
  const decoded = [];
31269
- let genColumn = 0;
31270
- let sourcesIndex = 0;
31271
- let sourceLine = 0;
31272
- let sourceColumn = 0;
31273
- let namesIndex = 0;
34604
+ let index = 0;
31274
34605
  do {
31275
- const semi = reader.indexOf(";");
34606
+ const semi = indexOf(mappings, index);
31276
34607
  const line = [];
31277
34608
  let sorted = true;
31278
34609
  let lastCol = 0;
31279
- genColumn = 0;
31280
- while (reader.pos < semi) {
34610
+ state[0] = 0;
34611
+ for (let i = index; i < semi; i++) {
31281
34612
  let seg;
31282
- genColumn = decodeInteger(reader, genColumn);
31283
- if (genColumn < lastCol)
34613
+ i = decodeInteger(mappings, i, state, 0);
34614
+ const col = state[0];
34615
+ if (col < lastCol)
31284
34616
  sorted = false;
31285
- lastCol = genColumn;
31286
- if (hasMoreVlq(reader, semi)) {
31287
- sourcesIndex = decodeInteger(reader, sourcesIndex);
31288
- sourceLine = decodeInteger(reader, sourceLine);
31289
- sourceColumn = decodeInteger(reader, sourceColumn);
31290
- if (hasMoreVlq(reader, semi)) {
31291
- namesIndex = decodeInteger(reader, namesIndex);
31292
- seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
34617
+ lastCol = col;
34618
+ if (hasMoreVlq(mappings, i, semi)) {
34619
+ i = decodeInteger(mappings, i, state, 1);
34620
+ i = decodeInteger(mappings, i, state, 2);
34621
+ i = decodeInteger(mappings, i, state, 3);
34622
+ if (hasMoreVlq(mappings, i, semi)) {
34623
+ i = decodeInteger(mappings, i, state, 4);
34624
+ seg = [col, state[1], state[2], state[3], state[4]];
31293
34625
  } else {
31294
- seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
34626
+ seg = [col, state[1], state[2], state[3]];
31295
34627
  }
31296
34628
  } else {
31297
- seg = [genColumn];
34629
+ seg = [col];
31298
34630
  }
31299
34631
  line.push(seg);
31300
- reader.pos++;
31301
34632
  }
31302
34633
  if (!sorted)
31303
34634
  sort(line);
31304
34635
  decoded.push(line);
31305
- reader.pos = semi + 1;
31306
- } while (reader.pos <= length);
34636
+ index = semi + 1;
34637
+ } while (index <= mappings.length);
31307
34638
  return decoded;
31308
34639
  }
34640
+ function indexOf(mappings, index) {
34641
+ const idx = mappings.indexOf(";", index);
34642
+ return idx === -1 ? mappings.length : idx;
34643
+ }
34644
+ function decodeInteger(mappings, pos, state, j) {
34645
+ let value = 0;
34646
+ let shift = 0;
34647
+ let integer = 0;
34648
+ do {
34649
+ const c = mappings.charCodeAt(pos++);
34650
+ integer = charToInt[c];
34651
+ value |= (integer & 31) << shift;
34652
+ shift += 5;
34653
+ } while (integer & 32);
34654
+ const shouldNegate = value & 1;
34655
+ value >>>= 1;
34656
+ if (shouldNegate) {
34657
+ value = -2147483648 | -value;
34658
+ }
34659
+ state[j] += value;
34660
+ return pos;
34661
+ }
34662
+ function hasMoreVlq(mappings, i, length) {
34663
+ if (i >= length)
34664
+ return false;
34665
+ return mappings.charCodeAt(i) !== comma;
34666
+ }
31309
34667
  function sort(line) {
31310
34668
  line.sort(sortComparator);
31311
34669
  }
@@ -31313,34 +34671,60 @@ function sortComparator(a, b) {
31313
34671
  return a[0] - b[0];
31314
34672
  }
31315
34673
  function encode(decoded) {
31316
- const writer = new StringWriter();
31317
- let sourcesIndex = 0;
31318
- let sourceLine = 0;
31319
- let sourceColumn = 0;
31320
- let namesIndex = 0;
34674
+ const state = new Int32Array(5);
34675
+ const bufLength = 1024 * 16;
34676
+ const subLength = bufLength - 36;
34677
+ const buf = new Uint8Array(bufLength);
34678
+ const sub = buf.subarray(0, subLength);
34679
+ let pos = 0;
34680
+ let out = "";
31321
34681
  for (let i = 0; i < decoded.length; i++) {
31322
34682
  const line = decoded[i];
31323
- if (i > 0)
31324
- writer.write(semicolon);
34683
+ if (i > 0) {
34684
+ if (pos === bufLength) {
34685
+ out += td.decode(buf);
34686
+ pos = 0;
34687
+ }
34688
+ buf[pos++] = semicolon;
34689
+ }
31325
34690
  if (line.length === 0)
31326
34691
  continue;
31327
- let genColumn = 0;
34692
+ state[0] = 0;
31328
34693
  for (let j = 0; j < line.length; j++) {
31329
34694
  const segment = line[j];
34695
+ if (pos > subLength) {
34696
+ out += td.decode(sub);
34697
+ buf.copyWithin(0, subLength, pos);
34698
+ pos -= subLength;
34699
+ }
31330
34700
  if (j > 0)
31331
- writer.write(comma);
31332
- genColumn = encodeInteger(writer, segment[0], genColumn);
34701
+ buf[pos++] = comma;
34702
+ pos = encodeInteger(buf, pos, state, segment, 0);
31333
34703
  if (segment.length === 1)
31334
34704
  continue;
31335
- sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
31336
- sourceLine = encodeInteger(writer, segment[2], sourceLine);
31337
- sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
34705
+ pos = encodeInteger(buf, pos, state, segment, 1);
34706
+ pos = encodeInteger(buf, pos, state, segment, 2);
34707
+ pos = encodeInteger(buf, pos, state, segment, 3);
31338
34708
  if (segment.length === 4)
31339
34709
  continue;
31340
- namesIndex = encodeInteger(writer, segment[4], namesIndex);
34710
+ pos = encodeInteger(buf, pos, state, segment, 4);
31341
34711
  }
31342
34712
  }
31343
- return writer.flush();
34713
+ return out + td.decode(buf.subarray(0, pos));
34714
+ }
34715
+ function encodeInteger(buf, pos, state, segment, j) {
34716
+ const next = segment[j];
34717
+ let num = next - state[j];
34718
+ state[j] = next;
34719
+ num = num < 0 ? -num << 1 | 1 : num << 1;
34720
+ do {
34721
+ let clamped = num & 31;
34722
+ num >>>= 5;
34723
+ if (num > 0)
34724
+ clamped |= 32;
34725
+ buf[pos++] = intToChar[clamped];
34726
+ } while (num > 0);
34727
+ return pos;
31344
34728
  }
31345
34729
 
31346
34730
  // node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
@@ -31610,16 +34994,16 @@ var TraceMap = class {
31610
34994
  if (!isString2 && map._decodedMemo)
31611
34995
  return map;
31612
34996
  const parsed = isString2 ? JSON.parse(map) : map;
31613
- const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
34997
+ const { version, file, names, sourceRoot, sources: sources3, sourcesContent } = parsed;
31614
34998
  this.version = version;
31615
34999
  this.file = file;
31616
35000
  this.names = names || [];
31617
35001
  this.sourceRoot = sourceRoot;
31618
- this.sources = sources;
35002
+ this.sources = sources3;
31619
35003
  this.sourcesContent = sourcesContent;
31620
35004
  this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
31621
35005
  const from = resolve2(sourceRoot || "", stripFilename(mapUrl));
31622
- this.resolvedSources = sources.map((s) => resolve2(s || "", from));
35006
+ this.resolvedSources = sources3.map((s) => resolve2(s || "", from));
31623
35007
  const { mappings } = parsed;
31624
35008
  if (typeof mappings === "string") {
31625
35009
  this._encoded = mappings;
@@ -31718,13 +35102,13 @@ var maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn
31718
35102
  return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name);
31719
35103
  };
31720
35104
  function setSourceContent(map, source, content) {
31721
- const { _sources: sources, _sourcesContent: sourcesContent } = cast3(map);
31722
- const index = put(sources, source);
35105
+ const { _sources: sources3, _sourcesContent: sourcesContent } = cast3(map);
35106
+ const index = put(sources3, source);
31723
35107
  sourcesContent[index] = content;
31724
35108
  }
31725
35109
  function setIgnore(map, source, ignore = true) {
31726
- const { _sources: sources, _sourcesContent: sourcesContent, _ignoreList: ignoreList } = cast3(map);
31727
- const index = put(sources, source);
35110
+ const { _sources: sources3, _sourcesContent: sourcesContent, _ignoreList: ignoreList } = cast3(map);
35111
+ const index = put(sources3, source);
31728
35112
  if (index === sourcesContent.length)
31729
35113
  sourcesContent[index] = null;
31730
35114
  if (ignore)
@@ -31733,14 +35117,14 @@ function setIgnore(map, source, ignore = true) {
31733
35117
  remove(ignoreList, index);
31734
35118
  }
31735
35119
  function toDecodedMap(map) {
31736
- const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, _ignoreList: ignoreList } = cast3(map);
35120
+ const { _mappings: mappings, _sources: sources3, _sourcesContent: sourcesContent, _names: names, _ignoreList: ignoreList } = cast3(map);
31737
35121
  removeEmptyFinalLines(mappings);
31738
35122
  return {
31739
35123
  version: 3,
31740
35124
  file: map.file || void 0,
31741
35125
  names: names.array,
31742
35126
  sourceRoot: map.sourceRoot || void 0,
31743
- sources: sources.array,
35127
+ sources: sources3.array,
31744
35128
  sourcesContent,
31745
35129
  mappings,
31746
35130
  ignoreList: ignoreList.array
@@ -31751,7 +35135,7 @@ function toEncodedMap(map) {
31751
35135
  return Object.assign(Object.assign({}, decoded), { mappings: encode(decoded.mappings) });
31752
35136
  }
31753
35137
  function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
31754
- const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names } = cast3(map);
35138
+ const { _mappings: mappings, _sources: sources3, _sourcesContent: sourcesContent, _names: names } = cast3(map);
31755
35139
  const line = getLine(mappings, genLine);
31756
35140
  const index = getColumnIndex(line, genColumn);
31757
35141
  if (!source) {
@@ -31759,7 +35143,7 @@ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLin
31759
35143
  return;
31760
35144
  return insert(line, index, [genColumn]);
31761
35145
  }
31762
- const sourcesIndex = put(sources, source);
35146
+ const sourcesIndex = put(sources3, source);
31763
35147
  const namesIndex = name ? put(names, name) : NO_NAME;
31764
35148
  if (sourcesIndex === sourcesContent.length)
31765
35149
  sourcesContent[sourcesIndex] = null;
@@ -31820,17 +35204,17 @@ var EMPTY_SOURCES = [];
31820
35204
  function SegmentObject(source, line, column, name, content, ignore) {
31821
35205
  return { source, line, column, name, content, ignore };
31822
35206
  }
31823
- function Source(map, sources, source, content, ignore) {
35207
+ function Source(map, sources3, source, content, ignore) {
31824
35208
  return {
31825
35209
  map,
31826
- sources,
35210
+ sources: sources3,
31827
35211
  source,
31828
35212
  content,
31829
35213
  ignore
31830
35214
  };
31831
35215
  }
31832
- function MapSource(map, sources) {
31833
- return Source(map, sources, "", null, false);
35216
+ function MapSource(map, sources3) {
35217
+ return Source(map, sources3, "", null, false);
31834
35218
  }
31835
35219
  function OriginalSource(source, content, ignore) {
31836
35220
  return Source(null, EMPTY_SOURCES, source, content, ignore);
@@ -31995,7 +35379,7 @@ function unwrapLoader(loader, code, id) {
31995
35379
  return loader;
31996
35380
  }
31997
35381
  function fixSourceMap(map) {
31998
- if (!Object.prototype.hasOwnProperty.call(map, "toString")) {
35382
+ if (!("toString" in map)) {
31999
35383
  Object.defineProperty(map, "toString", {
32000
35384
  enumerable: false,
32001
35385
  value: function toString() {
@@ -32003,7 +35387,7 @@ function fixSourceMap(map) {
32003
35387
  }
32004
35388
  });
32005
35389
  }
32006
- if (!Object.prototype.hasOwnProperty.call(map, "toUrl")) {
35390
+ if (!("toUrl" in map)) {
32007
35391
  Object.defineProperty(map, "toUrl", {
32008
35392
  enumerable: false,
32009
35393
  value: function toUrl() {
@@ -32021,9 +35405,8 @@ var nullSourceMap = {
32021
35405
  };
32022
35406
  function combineSourcemaps(filename, sourcemapList) {
32023
35407
  sourcemapList = sourcemapList.filter((m) => m.sources);
32024
- if (sourcemapList.length === 0 || sourcemapList.every((m) => m.sources.length === 0)) {
35408
+ if (sourcemapList.length === 0 || sourcemapList.every((m) => m.sources.length === 0))
32025
35409
  return { ...nullSourceMap };
32026
- }
32027
35410
  let map;
32028
35411
  let mapIndex = 1;
32029
35412
  const useArrayInterface = sourcemapList.slice(0, -1).find((m) => m.sources.length !== 1) === void 0;
@@ -32045,9 +35428,8 @@ function combineSourcemaps(filename, sourcemapList) {
32045
35428
  delete map.file;
32046
35429
  return map;
32047
35430
  }
32048
- function createBuildContext(build2) {
35431
+ function createBuildContext(initialOptions) {
32049
35432
  const watchFiles = [];
32050
- const { initialOptions } = build2;
32051
35433
  return {
32052
35434
  parse(code, opts = {}) {
32053
35435
  return Parser.parse(code, {
@@ -32072,9 +35454,6 @@ function createBuildContext(build2) {
32072
35454
  },
32073
35455
  getWatchFiles() {
32074
35456
  return watchFiles;
32075
- },
32076
- getNativeBuildContext() {
32077
- return { framework: "esbuild", build: build2 };
32078
35457
  }
32079
35458
  };
32080
35459
  }
@@ -32083,12 +35462,28 @@ function createPluginContext(context) {
32083
35462
  const warnings = [];
32084
35463
  const pluginContext = {
32085
35464
  error(message) {
32086
- errors.push(normalizeMessage(message));
35465
+ errors.push(normalizeMessage2(message));
32087
35466
  },
32088
35467
  warn(message) {
32089
- warnings.push(normalizeMessage(message));
35468
+ warnings.push(normalizeMessage2(message));
32090
35469
  }
32091
35470
  };
35471
+ function normalizeMessage2(message) {
35472
+ if (typeof message === "string")
35473
+ message = { message };
35474
+ return {
35475
+ id: message.id,
35476
+ pluginName: message.plugin,
35477
+ text: message.message,
35478
+ location: message.loc ? {
35479
+ file: message.loc.file,
35480
+ line: message.loc.line,
35481
+ column: message.loc.column
35482
+ } : null,
35483
+ detail: message.meta,
35484
+ notes: []
35485
+ };
35486
+ }
32092
35487
  const mixedContext = {
32093
35488
  ...context,
32094
35489
  ...pluginContext,
@@ -32102,22 +35497,6 @@ function createPluginContext(context) {
32102
35497
  mixedContext
32103
35498
  };
32104
35499
  }
32105
- function normalizeMessage(message) {
32106
- if (typeof message === "string")
32107
- message = { message };
32108
- return {
32109
- id: message.id,
32110
- pluginName: message.plugin,
32111
- text: message.message,
32112
- location: message.loc ? {
32113
- file: message.loc.file,
32114
- line: message.loc.line,
32115
- column: message.loc.column
32116
- } : null,
32117
- detail: message.meta,
32118
- notes: []
32119
- };
32120
- }
32121
35500
  function processCodeWithSourceMap(map, code) {
32122
35501
  if (map) {
32123
35502
  if (!map.sourcesContent || map.sourcesContent.length === 0)
@@ -32203,14 +35582,17 @@ function getEsbuildPlugin(factory) {
32203
35582
  }
32204
35583
  function buildSetup(meta) {
32205
35584
  return (plugin) => {
32206
- return (_build) => {
32207
- var _a, _b, _c, _d, _e;
32208
- const build2 = meta.build = _build;
32209
- const context = createBuildContext(build2);
35585
+ var _a;
35586
+ if ((_a = plugin.esbuild) == null ? void 0 : _a.setup)
35587
+ return plugin.esbuild.setup;
35588
+ return (build2) => {
35589
+ var _a2, _b, _c, _d;
35590
+ meta.build = build2;
32210
35591
  const { onStart, onEnd, onResolve, onLoad, onTransform, initialOptions } = build2;
32211
- const onResolveFilter = ((_a = plugin.esbuild) == null ? void 0 : _a.onResolveFilter) ?? /.*/;
35592
+ const onResolveFilter = ((_a2 = plugin.esbuild) == null ? void 0 : _a2.onResolveFilter) ?? /.*/;
32212
35593
  const onLoadFilter = ((_b = plugin.esbuild) == null ? void 0 : _b.onLoadFilter) ?? /.*/;
32213
35594
  const loader = ((_c = plugin.esbuild) == null ? void 0 : _c.loader) ?? guessLoader;
35595
+ const context = createBuildContext(initialOptions);
32214
35596
  if ((_d = plugin.esbuild) == null ? void 0 : _d.config)
32215
35597
  plugin.esbuild.config.call(context, initialOptions);
32216
35598
  if (plugin.buildStart)
@@ -32225,8 +35607,8 @@ function buildSetup(meta) {
32225
35607
  }
32226
35608
  if (plugin.resolveId) {
32227
35609
  onResolve({ filter: onResolveFilter }, async (args) => {
32228
- var _a2;
32229
- if ((_a2 = initialOptions.external) == null ? void 0 : _a2.includes(args.path)) {
35610
+ var _a3;
35611
+ if ((_a3 = initialOptions.external) == null ? void 0 : _a3.includes(args.path)) {
32230
35612
  return void 0;
32231
35613
  }
32232
35614
  const { errors, warnings, mixedContext } = createPluginContext(context);
@@ -32331,8 +35713,6 @@ function buildSetup(meta) {
32331
35713
  }
32332
35714
  });
32333
35715
  }
32334
- if ((_e = plugin.esbuild) == null ? void 0 : _e.setup)
32335
- return plugin.esbuild.setup(meta.build);
32336
35716
  };
32337
35717
  };
32338
35718
  }
@@ -32362,9 +35742,6 @@ function createFarmContext(context, currentResolveId) {
32362
35742
  },
32363
35743
  getWatchFiles() {
32364
35744
  return context.getWatchFiles();
32365
- },
32366
- getNativeBuildContext() {
32367
- return { framework: "farm", context };
32368
35745
  }
32369
35746
  };
32370
35747
  }
@@ -32553,9 +35930,8 @@ function toFarmPlugin(plugin, options) {
32553
35930
  async executor(params, context) {
32554
35931
  if (params.query.length)
32555
35932
  transformQuery(params);
32556
- if (plugin.transformInclude && !plugin.transformInclude(params.resolvedPath)) {
35933
+ if (plugin.transformInclude && !plugin.transformInclude(params.resolvedPath))
32557
35934
  return null;
32558
- }
32559
35935
  const loader = params.moduleType ?? guessIdLoader(params.resolvedPath);
32560
35936
  const shouldTransformInclude = plugin.transformInclude && plugin.transformInclude(params.resolvedPath);
32561
35937
  const farmContext = createFarmContext(context, params.resolvedPath);
@@ -32660,22 +36036,8 @@ function getRolldownPlugin(factory) {
32660
36036
  return plugins.length === 1 ? plugins[0] : plugins;
32661
36037
  };
32662
36038
  }
32663
- function createBuildContext2(compiler, compilation, loaderContext) {
36039
+ function createBuildContext2(compilation) {
32664
36040
  return {
32665
- getNativeBuildContext() {
32666
- return {
32667
- framework: "rspack",
32668
- compiler,
32669
- compilation,
32670
- loaderContext
32671
- };
32672
- },
32673
- addWatchFile(file) {
32674
- compilation.fileDependencies.add(resolve$1(process.cwd(), file));
32675
- },
32676
- getWatchFiles() {
32677
- return Array.from(compilation.fileDependencies);
32678
- },
32679
36041
  parse(code, opts = {}) {
32680
36042
  return Parser.parse(code, {
32681
36043
  sourceType: "module",
@@ -32684,59 +36046,25 @@ function createBuildContext2(compiler, compilation, loaderContext) {
32684
36046
  ...opts
32685
36047
  });
32686
36048
  },
36049
+ addWatchFile() {
36050
+ },
32687
36051
  emitFile(emittedFile) {
32688
36052
  const outFileName = emittedFile.fileName || emittedFile.name;
32689
36053
  if (emittedFile.source && outFileName) {
32690
- const { sources } = compilation.compiler.webpack;
32691
36054
  compilation.emitAsset(
32692
36055
  outFileName,
32693
- new sources.RawSource(
36056
+ new sources2.RawSource(
36057
+ // @ts-expect-error types mismatch
32694
36058
  typeof emittedFile.source === "string" ? emittedFile.source : Buffer$1.from(emittedFile.source)
32695
36059
  )
32696
36060
  );
32697
36061
  }
36062
+ },
36063
+ getWatchFiles() {
36064
+ return [];
32698
36065
  }
32699
36066
  };
32700
36067
  }
32701
- function normalizeMessage2(error) {
32702
- const err = new Error(typeof error === "string" ? error : error.message);
32703
- if (typeof error === "object") {
32704
- err.stack = error.stack;
32705
- err.cause = error.meta;
32706
- }
32707
- return err;
32708
- }
32709
- function encodeVirtualModuleId(id, plugin) {
32710
- return resolve$1(plugin.__virtualModulePrefix, encodeURIComponent(id));
32711
- }
32712
- function decodeVirtualModuleId(encoded, _plugin) {
32713
- return decodeURIComponent(basename(encoded));
32714
- }
32715
- function isVirtualModuleId(encoded, plugin) {
32716
- return dirname(encoded) === plugin.__virtualModulePrefix;
32717
- }
32718
- var FakeVirtualModulesPlugin = class {
32719
- constructor(plugin) {
32720
- this.plugin = plugin;
32721
- }
32722
- name = "FakeVirtualModulesPlugin";
32723
- apply(compiler) {
32724
- const dir = this.plugin.__virtualModulePrefix;
32725
- if (!fs$j.existsSync(dir)) {
32726
- fs$j.mkdirSync(dir, { recursive: true });
32727
- }
32728
- compiler.hooks.shutdown.tap(this.name, () => {
32729
- if (fs$j.existsSync(dir)) {
32730
- fs$j.rmdirSync(dir, { recursive: true });
32731
- }
32732
- });
32733
- }
32734
- async writeModule(file) {
32735
- const path6 = encodeVirtualModuleId(file, this.plugin);
32736
- await fs$j.promises.writeFile(path6, "");
32737
- return path6;
32738
- }
32739
- };
32740
36068
 
32741
36069
  // src/rspack/index.ts
32742
36070
  var TRANSFORM_LOADER = resolve$1(
@@ -32751,7 +36079,7 @@ function getRspackPlugin(factory) {
32751
36079
  return (userOptions) => {
32752
36080
  return {
32753
36081
  apply(compiler) {
32754
- const VIRTUAL_MODULE_PREFIX = resolve$1(compiler.options.context ?? process.cwd(), "node_modules/.virtual");
36082
+ const VIRTUAL_MODULE_PREFIX = resolve$1(compiler.options.context ?? process.cwd(), "_virtual_");
32755
36083
  const injected = compiler.$unpluginContext || {};
32756
36084
  compiler.$unpluginContext = injected;
32757
36085
  const meta = {
@@ -32778,66 +36106,18 @@ function getRspackPlugin(factory) {
32778
36106
  });
32779
36107
  });
32780
36108
  const externalModules = /* @__PURE__ */ new Set();
32781
- if (plugin.resolveId) {
32782
- const vfs = new FakeVirtualModulesPlugin(plugin);
32783
- vfs.apply(compiler);
32784
- plugin.__vfsModules = /* @__PURE__ */ new Set();
32785
- compiler.hooks.compilation.tap(plugin.name, (compilation, { normalModuleFactory }) => {
32786
- normalModuleFactory.hooks.resolve.tapPromise(plugin.name, async (resolveData) => {
32787
- const id = normalizeAbsolutePath(resolveData.request);
32788
- const requestContext = resolveData.contextInfo;
32789
- const importer = requestContext.issuer !== "" ? requestContext.issuer : void 0;
32790
- const isEntry = requestContext.issuer === "";
32791
- const context = createBuildContext2(compiler, compilation);
32792
- let error;
32793
- const pluginContext = {
32794
- error(msg) {
32795
- if (error == null)
32796
- error = normalizeMessage2(msg);
32797
- else
32798
- console.error(`unplugin/rspack: multiple errors returned from resolveId hook: ${msg}`);
32799
- },
32800
- warn(msg) {
32801
- console.warn(`unplugin/rspack: warning from resolveId hook: ${msg}`);
32802
- }
32803
- };
32804
- const resolveIdResult = await plugin.resolveId.call({ ...context, ...pluginContext }, id, importer, { isEntry });
32805
- if (error != null)
32806
- throw error;
32807
- if (resolveIdResult == null)
32808
- return;
32809
- let resolved = typeof resolveIdResult === "string" ? resolveIdResult : resolveIdResult.id;
32810
- const isExternal = typeof resolveIdResult === "string" ? false : resolveIdResult.external === true;
32811
- if (isExternal)
32812
- externalModules.add(resolved);
32813
- if (!fs$j.existsSync(resolved)) {
32814
- if (!plugin.__vfsModules.has(resolved)) {
32815
- plugin.__vfsModules.add(resolved);
32816
- await vfs.writeModule(resolved);
32817
- }
32818
- resolved = encodeVirtualModuleId(resolved, plugin);
32819
- }
32820
- resolveData.request = resolved;
32821
- });
32822
- });
32823
- }
32824
36109
  if (plugin.load) {
32825
36110
  compiler.options.module.rules.unshift({
32826
36111
  enforce: plugin.enforce,
32827
36112
  include(id) {
32828
- if (isVirtualModuleId(id, plugin))
32829
- id = decodeVirtualModuleId(id);
32830
- if (plugin.loadInclude && !plugin.loadInclude(id))
32831
- return false;
32832
- return !externalModules.has(id);
36113
+ return shouldLoad(id, plugin, externalModules);
32833
36114
  },
32834
36115
  use: [{
32835
36116
  loader: LOAD_LOADER,
32836
36117
  options: {
32837
36118
  unpluginName: plugin.name
32838
36119
  }
32839
- }],
32840
- type: "javascript/auto"
36120
+ }]
32841
36121
  });
32842
36122
  }
32843
36123
  if (plugin.transform) {
@@ -32850,30 +36130,15 @@ function getRspackPlugin(factory) {
32850
36130
  }
32851
36131
  if (plugin.rspack)
32852
36132
  plugin.rspack(compiler);
32853
- if (plugin.watchChange || plugin.buildStart) {
36133
+ if (plugin.buildStart) {
32854
36134
  compiler.hooks.make.tapPromise(plugin.name, async (compilation) => {
32855
- const context = createBuildContext2(compiler, compilation);
32856
- if (plugin.watchChange && (compiler.modifiedFiles || compiler.removedFiles)) {
32857
- const promises = [];
32858
- if (compiler.modifiedFiles) {
32859
- compiler.modifiedFiles.forEach(
32860
- (file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "update" })))
32861
- );
32862
- }
32863
- if (compiler.removedFiles) {
32864
- compiler.removedFiles.forEach(
32865
- (file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "delete" })))
32866
- );
32867
- }
32868
- await Promise.all(promises);
32869
- }
32870
- if (plugin.buildStart)
32871
- return await plugin.buildStart.call(context);
36135
+ const context = createBuildContext2(compilation);
36136
+ return plugin.buildStart.call(context);
32872
36137
  });
32873
36138
  }
32874
36139
  if (plugin.buildEnd) {
32875
36140
  compiler.hooks.emit.tapPromise(plugin.name, async (compilation) => {
32876
- await plugin.buildEnd.call(createBuildContext2(compiler, compilation));
36141
+ await plugin.buildEnd.call(createBuildContext2(compilation));
32877
36142
  });
32878
36143
  }
32879
36144
  if (plugin.writeBundle) {
@@ -32913,9 +36178,7 @@ function contextOptionsFromCompilation(compilation) {
32913
36178
  }
32914
36179
  };
32915
36180
  }
32916
- function createBuildContext3(options, compiler, compilation, loaderContext) {
32917
- const require2 = createRequire(import.meta.url);
32918
- const sources = require2("webpack-sources");
36181
+ function createBuildContext3(options, compilation) {
32919
36182
  return {
32920
36183
  parse(code, opts = {}) {
32921
36184
  return Parser.parse(code, {
@@ -32935,7 +36198,7 @@ function createBuildContext3(options, compiler, compilation, loaderContext) {
32935
36198
  throw new Error("unplugin/webpack: emitFile outside supported hooks (buildStart, buildEnd, load, transform, watchChange)");
32936
36199
  compilation.emitAsset(
32937
36200
  outFileName,
32938
- sources ? new sources.RawSource(
36201
+ sources2 ? new sources2.RawSource(
32939
36202
  // @ts-expect-error types mismatch
32940
36203
  typeof emittedFile.source === "string" ? emittedFile.source : Buffer$1.from(emittedFile.source)
32941
36204
  ) : {
@@ -32947,13 +36210,10 @@ function createBuildContext3(options, compiler, compilation, loaderContext) {
32947
36210
  },
32948
36211
  getWatchFiles() {
32949
36212
  return options.getWatchFiles();
32950
- },
32951
- getNativeBuildContext() {
32952
- return { framework: "webpack", compiler, compilation, loaderContext };
32953
36213
  }
32954
36214
  };
32955
36215
  }
32956
- function normalizeMessage3(error) {
36216
+ function normalizeMessage(error) {
32957
36217
  const err = new Error(typeof error === "string" ? error : error.message);
32958
36218
  if (typeof error === "object") {
32959
36219
  err.stack = error.stack;
@@ -33030,12 +36290,12 @@ function getWebpackPlugin(factory) {
33030
36290
  getWatchFiles() {
33031
36291
  return Array.from(fileDependencies);
33032
36292
  }
33033
- }, compiler);
36293
+ });
33034
36294
  let error;
33035
36295
  const pluginContext = {
33036
36296
  error(msg) {
33037
36297
  if (error == null)
33038
- error = normalizeMessage3(msg);
36298
+ error = normalizeMessage(msg);
33039
36299
  else
33040
36300
  console.error(`unplugin/webpack: multiple errors returned from resolveId hook: ${msg}`);
33041
36301
  },
@@ -33084,8 +36344,7 @@ function getWebpackPlugin(factory) {
33084
36344
  options: {
33085
36345
  unpluginName: plugin.name
33086
36346
  }
33087
- }],
33088
- type: "javascript/auto"
36347
+ }]
33089
36348
  });
33090
36349
  }
33091
36350
  if (plugin.transform) {
@@ -33100,7 +36359,7 @@ function getWebpackPlugin(factory) {
33100
36359
  plugin.webpack(compiler);
33101
36360
  if (plugin.watchChange || plugin.buildStart) {
33102
36361
  compiler.hooks.make.tapPromise(plugin.name, async (compilation) => {
33103
- const context = createBuildContext3(contextOptionsFromCompilation(compilation), compiler, compilation);
36362
+ const context = createBuildContext3(contextOptionsFromCompilation(compilation), compilation);
33104
36363
  if (plugin.watchChange && (compiler.modifiedFiles || compiler.removedFiles)) {
33105
36364
  const promises = [];
33106
36365
  if (compiler.modifiedFiles) {
@@ -33121,7 +36380,7 @@ function getWebpackPlugin(factory) {
33121
36380
  }
33122
36381
  if (plugin.buildEnd) {
33123
36382
  compiler.hooks.emit.tapPromise(plugin.name, async (compilation) => {
33124
- await plugin.buildEnd.call(createBuildContext3(contextOptionsFromCompilation(compilation), compiler, compilation));
36383
+ await plugin.buildEnd.call(createBuildContext3(contextOptionsFromCompilation(compilation), compilation));
33125
36384
  });
33126
36385
  }
33127
36386
  if (plugin.writeBundle) {
@@ -33154,6 +36413,7 @@ function createUnplugin(factory) {
33154
36413
  get webpack() {
33155
36414
  return getWebpackPlugin(factory);
33156
36415
  },
36416
+ /** @experimental do not use it in production */
33157
36417
  get rspack() {
33158
36418
  return getRspackPlugin(factory);
33159
36419
  },
@@ -33209,7 +36469,7 @@ const buildPluginFactory = ({
33209
36469
 
33210
36470
  var name = "@datadog/esbuild-plugin";
33211
36471
  var packageManager = "yarn@4.0.2";
33212
- var version$1 = "2.3.1-dev-2";
36472
+ var version$1 = "2.3.1-dev-3";
33213
36473
  var license = "MIT";
33214
36474
  var author = "Datadog";
33215
36475
  var description = "Datadog ESBuild Plugin";