@datadog/esbuild-plugin 2.3.1 → 2.3.2

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.
@@ -20,7 +20,6 @@ import require$$0$2 from 'constants';
20
20
  import require$$5 from 'assert';
21
21
  import { performance as performance$1 } from 'perf_hooks';
22
22
  import * as querystring from 'querystring';
23
- import sources2 from 'webpack-sources';
24
23
  import process2 from 'process';
25
24
  import esbuild from 'esbuild';
26
25
 
@@ -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 PREPARATION_PLUGIN_NAME = "datadog-injection-preparation-plugin";
2275
2274
  const PLUGIN_NAME$4 = "datadog-injection-plugin";
@@ -20497,7 +20496,7 @@ const getPlugins$2 = (opts, context) => {
20497
20496
  ];
20498
20497
  };
20499
20498
 
20500
- var lib$1 = {exports: {}};
20499
+ var lib$2 = {exports: {}};
20501
20500
 
20502
20501
  var fs$i = {};
20503
20502
 
@@ -23436,9 +23435,9 @@ var output = {
23436
23435
  get () { return fs.promises }
23437
23436
  });
23438
23437
  }
23439
- } (lib$1));
23438
+ } (lib$2));
23440
23439
 
23441
- var libExports = lib$1.exports;
23440
+ var libExports = lib$2.exports;
23442
23441
 
23443
23442
  const CONFIG_KEY = "telemetry";
23444
23443
  const PLUGIN_NAME = `datadog-telemetry-plugin`;
@@ -30705,6 +30704,3486 @@ Parser.acorn = {
30705
30704
  nonASCIIwhitespace: nonASCIIwhitespace
30706
30705
  };
30707
30706
 
30707
+ var lib$1 = {};
30708
+
30709
+ /*
30710
+ MIT License http://www.opensource.org/licenses/mit-license.php
30711
+ Author Tobias Koppers @sokra
30712
+ */
30713
+
30714
+ var Source_1;
30715
+ var hasRequiredSource;
30716
+
30717
+ function requireSource () {
30718
+ if (hasRequiredSource) return Source_1;
30719
+ hasRequiredSource = 1;
30720
+
30721
+ class Source {
30722
+ source() {
30723
+ throw new Error("Abstract");
30724
+ }
30725
+
30726
+ buffer() {
30727
+ const source = this.source();
30728
+ if (Buffer.isBuffer(source)) return source;
30729
+ return Buffer.from(source, "utf-8");
30730
+ }
30731
+
30732
+ size() {
30733
+ return this.buffer().length;
30734
+ }
30735
+
30736
+ map(options) {
30737
+ return null;
30738
+ }
30739
+
30740
+ sourceAndMap(options) {
30741
+ return {
30742
+ source: this.source(),
30743
+ map: this.map(options)
30744
+ };
30745
+ }
30746
+
30747
+ updateHash(hash) {
30748
+ throw new Error("Abstract");
30749
+ }
30750
+ }
30751
+
30752
+ Source_1 = Source;
30753
+ return Source_1;
30754
+ }
30755
+
30756
+ /*
30757
+ MIT License http://www.opensource.org/licenses/mit-license.php
30758
+ Author Tobias Koppers @sokra
30759
+ */
30760
+
30761
+ var getGeneratedSourceInfo_1;
30762
+ var hasRequiredGetGeneratedSourceInfo;
30763
+
30764
+ function requireGetGeneratedSourceInfo () {
30765
+ if (hasRequiredGetGeneratedSourceInfo) return getGeneratedSourceInfo_1;
30766
+ hasRequiredGetGeneratedSourceInfo = 1;
30767
+
30768
+ const CHAR_CODE_NEW_LINE = "\n".charCodeAt(0);
30769
+
30770
+ const getGeneratedSourceInfo = source => {
30771
+ if (source === undefined) {
30772
+ return {};
30773
+ }
30774
+ const lastLineStart = source.lastIndexOf("\n");
30775
+ if (lastLineStart === -1) {
30776
+ return {
30777
+ generatedLine: 1,
30778
+ generatedColumn: source.length,
30779
+ source
30780
+ };
30781
+ }
30782
+ let generatedLine = 2;
30783
+ for (let i = 0; i < lastLineStart; i++) {
30784
+ if (source.charCodeAt(i) === CHAR_CODE_NEW_LINE) generatedLine++;
30785
+ }
30786
+ return {
30787
+ generatedLine,
30788
+ generatedColumn: source.length - lastLineStart - 1,
30789
+ source
30790
+ };
30791
+ };
30792
+
30793
+ getGeneratedSourceInfo_1 = getGeneratedSourceInfo;
30794
+ return getGeneratedSourceInfo_1;
30795
+ }
30796
+
30797
+ var splitIntoLines_1;
30798
+ var hasRequiredSplitIntoLines;
30799
+
30800
+ function requireSplitIntoLines () {
30801
+ if (hasRequiredSplitIntoLines) return splitIntoLines_1;
30802
+ hasRequiredSplitIntoLines = 1;
30803
+ const splitIntoLines = str => {
30804
+ const results = [];
30805
+ const len = str.length;
30806
+ let i = 0;
30807
+ for (; i < len; ) {
30808
+ const cc = str.charCodeAt(i);
30809
+ // 10 is "\n".charCodeAt(0)
30810
+ if (cc === 10) {
30811
+ results.push("\n");
30812
+ i++;
30813
+ } else {
30814
+ let j = i + 1;
30815
+ // 10 is "\n".charCodeAt(0)
30816
+ while (j < len && str.charCodeAt(j) !== 10) j++;
30817
+ results.push(str.slice(i, j + 1));
30818
+ i = j + 1;
30819
+ }
30820
+ }
30821
+ return results;
30822
+ };
30823
+ splitIntoLines_1 = splitIntoLines;
30824
+ return splitIntoLines_1;
30825
+ }
30826
+
30827
+ /*
30828
+ MIT License http://www.opensource.org/licenses/mit-license.php
30829
+ Author Tobias Koppers @sokra
30830
+ */
30831
+
30832
+ var streamChunksOfRawSource_1;
30833
+ var hasRequiredStreamChunksOfRawSource;
30834
+
30835
+ function requireStreamChunksOfRawSource () {
30836
+ if (hasRequiredStreamChunksOfRawSource) return streamChunksOfRawSource_1;
30837
+ hasRequiredStreamChunksOfRawSource = 1;
30838
+
30839
+ const getGeneratedSourceInfo = requireGetGeneratedSourceInfo();
30840
+ const splitIntoLines = requireSplitIntoLines();
30841
+
30842
+ const streamChunksOfRawSource = (source, onChunk, onSource, onName) => {
30843
+ let line = 1;
30844
+ const matches = splitIntoLines(source);
30845
+ let match;
30846
+ for (match of matches) {
30847
+ onChunk(match, line, 0, -1, -1, -1, -1);
30848
+ line++;
30849
+ }
30850
+ return matches.length === 0 || match.endsWith("\n")
30851
+ ? {
30852
+ generatedLine: matches.length + 1,
30853
+ generatedColumn: 0
30854
+ }
30855
+ : {
30856
+ generatedLine: matches.length,
30857
+ generatedColumn: match.length
30858
+ };
30859
+ };
30860
+
30861
+ streamChunksOfRawSource_1 = (source, onChunk, onSource, onName, finalSource) => {
30862
+ return finalSource
30863
+ ? getGeneratedSourceInfo(source)
30864
+ : streamChunksOfRawSource(source, onChunk);
30865
+ };
30866
+ return streamChunksOfRawSource_1;
30867
+ }
30868
+
30869
+ /*
30870
+ MIT License http://www.opensource.org/licenses/mit-license.php
30871
+ Author Tobias Koppers @sokra
30872
+ */
30873
+
30874
+ var RawSource_1;
30875
+ var hasRequiredRawSource;
30876
+
30877
+ function requireRawSource () {
30878
+ if (hasRequiredRawSource) return RawSource_1;
30879
+ hasRequiredRawSource = 1;
30880
+
30881
+ const streamChunksOfRawSource = requireStreamChunksOfRawSource();
30882
+ const Source = requireSource();
30883
+
30884
+ class RawSource extends Source {
30885
+ constructor(value, convertToString = false) {
30886
+ super();
30887
+ const isBuffer = Buffer.isBuffer(value);
30888
+ if (!isBuffer && typeof value !== "string") {
30889
+ throw new TypeError("argument 'value' must be either string of Buffer");
30890
+ }
30891
+ this._valueIsBuffer = !convertToString && isBuffer;
30892
+ this._value = convertToString && isBuffer ? undefined : value;
30893
+ this._valueAsBuffer = isBuffer ? value : undefined;
30894
+ this._valueAsString = isBuffer ? undefined : value;
30895
+ }
30896
+
30897
+ isBuffer() {
30898
+ return this._valueIsBuffer;
30899
+ }
30900
+
30901
+ source() {
30902
+ if (this._value === undefined) {
30903
+ this._value = this._valueAsBuffer.toString("utf-8");
30904
+ }
30905
+ return this._value;
30906
+ }
30907
+
30908
+ buffer() {
30909
+ if (this._valueAsBuffer === undefined) {
30910
+ this._valueAsBuffer = Buffer.from(this._value, "utf-8");
30911
+ }
30912
+ return this._valueAsBuffer;
30913
+ }
30914
+
30915
+ map(options) {
30916
+ return null;
30917
+ }
30918
+
30919
+ /**
30920
+ * @param {object} options options
30921
+ * @param {function(string, number, number, number, number, number, number): void} onChunk called for each chunk of code
30922
+ * @param {function(number, string, string)} onSource called for each source
30923
+ * @param {function(number, string)} onName called for each name
30924
+ * @returns {void}
30925
+ */
30926
+ streamChunks(options, onChunk, onSource, onName) {
30927
+ if (this._value === undefined) {
30928
+ this._value = Buffer.from(this._valueAsBuffer, "utf-8");
30929
+ }
30930
+ if (this._valueAsString === undefined) {
30931
+ this._valueAsString =
30932
+ typeof this._value === "string"
30933
+ ? this._value
30934
+ : this._value.toString("utf-8");
30935
+ }
30936
+ return streamChunksOfRawSource(
30937
+ this._valueAsString,
30938
+ onChunk,
30939
+ onSource,
30940
+ onName,
30941
+ !!(options && options.finalSource)
30942
+ );
30943
+ }
30944
+
30945
+ updateHash(hash) {
30946
+ if (this._valueAsBuffer === undefined) {
30947
+ this._valueAsBuffer = Buffer.from(this._value, "utf-8");
30948
+ }
30949
+ hash.update("RawSource");
30950
+ hash.update(this._valueAsBuffer);
30951
+ }
30952
+ }
30953
+
30954
+ RawSource_1 = RawSource;
30955
+ return RawSource_1;
30956
+ }
30957
+
30958
+ var getFromStreamChunks = {};
30959
+
30960
+ /*
30961
+ MIT License http://www.opensource.org/licenses/mit-license.php
30962
+ Author Tobias Koppers @sokra
30963
+ */
30964
+
30965
+ var createMappingsSerializer_1;
30966
+ var hasRequiredCreateMappingsSerializer;
30967
+
30968
+ function requireCreateMappingsSerializer () {
30969
+ if (hasRequiredCreateMappingsSerializer) return createMappingsSerializer_1;
30970
+ hasRequiredCreateMappingsSerializer = 1;
30971
+
30972
+ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(
30973
+ ""
30974
+ );
30975
+
30976
+ const CONTINUATION_BIT = 0x20;
30977
+
30978
+ const createMappingsSerializer = options => {
30979
+ const linesOnly = options && options.columns === false;
30980
+ return linesOnly
30981
+ ? createLinesOnlyMappingsSerializer()
30982
+ : createFullMappingsSerializer();
30983
+ };
30984
+
30985
+ const createFullMappingsSerializer = () => {
30986
+ let currentLine = 1;
30987
+ let currentColumn = 0;
30988
+ let currentSourceIndex = 0;
30989
+ let currentOriginalLine = 1;
30990
+ let currentOriginalColumn = 0;
30991
+ let currentNameIndex = 0;
30992
+ let activeMapping = false;
30993
+ let activeName = false;
30994
+ let initial = true;
30995
+ return (
30996
+ generatedLine,
30997
+ generatedColumn,
30998
+ sourceIndex,
30999
+ originalLine,
31000
+ originalColumn,
31001
+ nameIndex
31002
+ ) => {
31003
+ if (activeMapping && currentLine === generatedLine) {
31004
+ // A mapping is still active
31005
+ if (
31006
+ sourceIndex === currentSourceIndex &&
31007
+ originalLine === currentOriginalLine &&
31008
+ originalColumn === currentOriginalColumn &&
31009
+ !activeName &&
31010
+ nameIndex < 0
31011
+ ) {
31012
+ // avoid repeating the same original mapping
31013
+ return "";
31014
+ }
31015
+ } else {
31016
+ // No mapping is active
31017
+ if (sourceIndex < 0) {
31018
+ // avoid writing unneccessary generated mappings
31019
+ return "";
31020
+ }
31021
+ }
31022
+
31023
+ let str;
31024
+ if (currentLine < generatedLine) {
31025
+ str = ";".repeat(generatedLine - currentLine);
31026
+ currentLine = generatedLine;
31027
+ currentColumn = 0;
31028
+ initial = false;
31029
+ } else if (initial) {
31030
+ str = "";
31031
+ initial = false;
31032
+ } else {
31033
+ str = ",";
31034
+ }
31035
+
31036
+ const writeValue = value => {
31037
+ const sign = (value >>> 31) & 1;
31038
+ const mask = value >> 31;
31039
+ const absValue = (value + mask) ^ mask;
31040
+ let data = (absValue << 1) | sign;
31041
+ for (;;) {
31042
+ const sextet = data & 0x1f;
31043
+ data >>= 5;
31044
+ if (data === 0) {
31045
+ str += ALPHABET[sextet];
31046
+ break;
31047
+ } else {
31048
+ str += ALPHABET[sextet | CONTINUATION_BIT];
31049
+ }
31050
+ }
31051
+ };
31052
+ writeValue(generatedColumn - currentColumn);
31053
+ currentColumn = generatedColumn;
31054
+ if (sourceIndex >= 0) {
31055
+ activeMapping = true;
31056
+ if (sourceIndex === currentSourceIndex) {
31057
+ str += "A";
31058
+ } else {
31059
+ writeValue(sourceIndex - currentSourceIndex);
31060
+ currentSourceIndex = sourceIndex;
31061
+ }
31062
+ writeValue(originalLine - currentOriginalLine);
31063
+ currentOriginalLine = originalLine;
31064
+ if (originalColumn === currentOriginalColumn) {
31065
+ str += "A";
31066
+ } else {
31067
+ writeValue(originalColumn - currentOriginalColumn);
31068
+ currentOriginalColumn = originalColumn;
31069
+ }
31070
+ if (nameIndex >= 0) {
31071
+ writeValue(nameIndex - currentNameIndex);
31072
+ currentNameIndex = nameIndex;
31073
+ activeName = true;
31074
+ } else {
31075
+ activeName = false;
31076
+ }
31077
+ } else {
31078
+ activeMapping = false;
31079
+ }
31080
+ return str;
31081
+ };
31082
+ };
31083
+
31084
+ const createLinesOnlyMappingsSerializer = () => {
31085
+ let lastWrittenLine = 0;
31086
+ let currentLine = 1;
31087
+ let currentSourceIndex = 0;
31088
+ let currentOriginalLine = 1;
31089
+ return (
31090
+ generatedLine,
31091
+ _generatedColumn,
31092
+ sourceIndex,
31093
+ originalLine,
31094
+ _originalColumn,
31095
+ _nameIndex
31096
+ ) => {
31097
+ if (sourceIndex < 0) {
31098
+ // avoid writing generated mappings at all
31099
+ return "";
31100
+ }
31101
+ if (lastWrittenLine === generatedLine) {
31102
+ // avoid writing multiple original mappings per line
31103
+ return "";
31104
+ }
31105
+ let str;
31106
+ const writeValue = value => {
31107
+ const sign = (value >>> 31) & 1;
31108
+ const mask = value >> 31;
31109
+ const absValue = (value + mask) ^ mask;
31110
+ let data = (absValue << 1) | sign;
31111
+ for (;;) {
31112
+ const sextet = data & 0x1f;
31113
+ data >>= 5;
31114
+ if (data === 0) {
31115
+ str += ALPHABET[sextet];
31116
+ break;
31117
+ } else {
31118
+ str += ALPHABET[sextet | CONTINUATION_BIT];
31119
+ }
31120
+ }
31121
+ };
31122
+ lastWrittenLine = generatedLine;
31123
+ if (generatedLine === currentLine + 1) {
31124
+ currentLine = generatedLine;
31125
+ if (sourceIndex === currentSourceIndex) {
31126
+ currentSourceIndex = sourceIndex;
31127
+ if (originalLine === currentOriginalLine + 1) {
31128
+ currentOriginalLine = originalLine;
31129
+ return ";AACA";
31130
+ } else {
31131
+ str = ";AA";
31132
+ writeValue(originalLine - currentOriginalLine);
31133
+ currentOriginalLine = originalLine;
31134
+ return str + "A";
31135
+ }
31136
+ } else {
31137
+ str = ";A";
31138
+ writeValue(sourceIndex - currentSourceIndex);
31139
+ currentSourceIndex = sourceIndex;
31140
+ writeValue(originalLine - currentOriginalLine);
31141
+ currentOriginalLine = originalLine;
31142
+ return str + "A";
31143
+ }
31144
+ } else {
31145
+ str = ";".repeat(generatedLine - currentLine);
31146
+ currentLine = generatedLine;
31147
+ if (sourceIndex === currentSourceIndex) {
31148
+ currentSourceIndex = sourceIndex;
31149
+ if (originalLine === currentOriginalLine + 1) {
31150
+ currentOriginalLine = originalLine;
31151
+ return str + "AACA";
31152
+ } else {
31153
+ str += "AA";
31154
+ writeValue(originalLine - currentOriginalLine);
31155
+ currentOriginalLine = originalLine;
31156
+ return str + "A";
31157
+ }
31158
+ } else {
31159
+ str += "A";
31160
+ writeValue(sourceIndex - currentSourceIndex);
31161
+ currentSourceIndex = sourceIndex;
31162
+ writeValue(originalLine - currentOriginalLine);
31163
+ currentOriginalLine = originalLine;
31164
+ return str + "A";
31165
+ }
31166
+ }
31167
+ };
31168
+ };
31169
+
31170
+ createMappingsSerializer_1 = createMappingsSerializer;
31171
+ return createMappingsSerializer_1;
31172
+ }
31173
+
31174
+ /*
31175
+ MIT License http://www.opensource.org/licenses/mit-license.php
31176
+ Author Tobias Koppers @sokra
31177
+ */
31178
+
31179
+ var hasRequiredGetFromStreamChunks;
31180
+
31181
+ function requireGetFromStreamChunks () {
31182
+ if (hasRequiredGetFromStreamChunks) return getFromStreamChunks;
31183
+ hasRequiredGetFromStreamChunks = 1;
31184
+
31185
+ const createMappingsSerializer = requireCreateMappingsSerializer();
31186
+
31187
+ getFromStreamChunks.getSourceAndMap = (inputSource, options) => {
31188
+ let code = "";
31189
+ let mappings = "";
31190
+ let sources = [];
31191
+ let sourcesContent = [];
31192
+ let names = [];
31193
+ const addMapping = createMappingsSerializer(options);
31194
+ const { source } = inputSource.streamChunks(
31195
+ Object.assign({}, options, { finalSource: true }),
31196
+ (
31197
+ chunk,
31198
+ generatedLine,
31199
+ generatedColumn,
31200
+ sourceIndex,
31201
+ originalLine,
31202
+ originalColumn,
31203
+ nameIndex
31204
+ ) => {
31205
+ if (chunk !== undefined) code += chunk;
31206
+ mappings += addMapping(
31207
+ generatedLine,
31208
+ generatedColumn,
31209
+ sourceIndex,
31210
+ originalLine,
31211
+ originalColumn,
31212
+ nameIndex
31213
+ );
31214
+ },
31215
+ (sourceIndex, source, sourceContent) => {
31216
+ while (sources.length < sourceIndex) {
31217
+ sources.push(null);
31218
+ }
31219
+ sources[sourceIndex] = source;
31220
+ if (sourceContent !== undefined) {
31221
+ while (sourcesContent.length < sourceIndex) {
31222
+ sourcesContent.push(null);
31223
+ }
31224
+ sourcesContent[sourceIndex] = sourceContent;
31225
+ }
31226
+ },
31227
+ (nameIndex, name) => {
31228
+ while (names.length < nameIndex) {
31229
+ names.push(null);
31230
+ }
31231
+ names[nameIndex] = name;
31232
+ }
31233
+ );
31234
+ return {
31235
+ source: source !== undefined ? source : code,
31236
+ map:
31237
+ mappings.length > 0
31238
+ ? {
31239
+ version: 3,
31240
+ file: "x",
31241
+ mappings,
31242
+ sources,
31243
+ sourcesContent:
31244
+ sourcesContent.length > 0 ? sourcesContent : undefined,
31245
+ names
31246
+ }
31247
+ : null
31248
+ };
31249
+ };
31250
+
31251
+ getFromStreamChunks.getMap = (source, options) => {
31252
+ let mappings = "";
31253
+ let sources = [];
31254
+ let sourcesContent = [];
31255
+ let names = [];
31256
+ const addMapping = createMappingsSerializer(options);
31257
+ source.streamChunks(
31258
+ Object.assign({}, options, { source: false, finalSource: true }),
31259
+ (
31260
+ chunk,
31261
+ generatedLine,
31262
+ generatedColumn,
31263
+ sourceIndex,
31264
+ originalLine,
31265
+ originalColumn,
31266
+ nameIndex
31267
+ ) => {
31268
+ mappings += addMapping(
31269
+ generatedLine,
31270
+ generatedColumn,
31271
+ sourceIndex,
31272
+ originalLine,
31273
+ originalColumn,
31274
+ nameIndex
31275
+ );
31276
+ },
31277
+ (sourceIndex, source, sourceContent) => {
31278
+ while (sources.length < sourceIndex) {
31279
+ sources.push(null);
31280
+ }
31281
+ sources[sourceIndex] = source;
31282
+ if (sourceContent !== undefined) {
31283
+ while (sourcesContent.length < sourceIndex) {
31284
+ sourcesContent.push(null);
31285
+ }
31286
+ sourcesContent[sourceIndex] = sourceContent;
31287
+ }
31288
+ },
31289
+ (nameIndex, name) => {
31290
+ while (names.length < nameIndex) {
31291
+ names.push(null);
31292
+ }
31293
+ names[nameIndex] = name;
31294
+ }
31295
+ );
31296
+ return mappings.length > 0
31297
+ ? {
31298
+ version: 3,
31299
+ file: "x",
31300
+ mappings,
31301
+ sources,
31302
+ sourcesContent: sourcesContent.length > 0 ? sourcesContent : undefined,
31303
+ names
31304
+ }
31305
+ : null;
31306
+ };
31307
+ return getFromStreamChunks;
31308
+ }
31309
+
31310
+ var splitIntoPotentialTokens_1;
31311
+ var hasRequiredSplitIntoPotentialTokens;
31312
+
31313
+ function requireSplitIntoPotentialTokens () {
31314
+ if (hasRequiredSplitIntoPotentialTokens) return splitIntoPotentialTokens_1;
31315
+ hasRequiredSplitIntoPotentialTokens = 1;
31316
+ // \n = 10
31317
+ // ; = 59
31318
+ // { = 123
31319
+ // } = 125
31320
+ // <space> = 32
31321
+ // \r = 13
31322
+ // \t = 9
31323
+
31324
+ const splitIntoPotentialTokens = str => {
31325
+ const len = str.length;
31326
+ if (len === 0) return null;
31327
+ const results = [];
31328
+ let i = 0;
31329
+ for (; i < len; ) {
31330
+ const s = i;
31331
+ block: {
31332
+ let cc = str.charCodeAt(i);
31333
+ while (cc !== 10 && cc !== 59 && cc !== 123 && cc !== 125) {
31334
+ if (++i >= len) break block;
31335
+ cc = str.charCodeAt(i);
31336
+ }
31337
+ while (
31338
+ cc === 59 ||
31339
+ cc === 32 ||
31340
+ cc === 123 ||
31341
+ cc === 125 ||
31342
+ cc === 13 ||
31343
+ cc === 9
31344
+ ) {
31345
+ if (++i >= len) break block;
31346
+ cc = str.charCodeAt(i);
31347
+ }
31348
+ if (cc === 10) {
31349
+ i++;
31350
+ }
31351
+ }
31352
+ results.push(str.slice(s, i));
31353
+ }
31354
+ return results;
31355
+ };
31356
+ splitIntoPotentialTokens_1 = splitIntoPotentialTokens;
31357
+ return splitIntoPotentialTokens_1;
31358
+ }
31359
+
31360
+ /*
31361
+ MIT License http://www.opensource.org/licenses/mit-license.php
31362
+ Author Tobias Koppers @sokra
31363
+ */
31364
+
31365
+ var OriginalSource_1;
31366
+ var hasRequiredOriginalSource;
31367
+
31368
+ function requireOriginalSource () {
31369
+ if (hasRequiredOriginalSource) return OriginalSource_1;
31370
+ hasRequiredOriginalSource = 1;
31371
+
31372
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
31373
+ const splitIntoLines = requireSplitIntoLines();
31374
+ const getGeneratedSourceInfo = requireGetGeneratedSourceInfo();
31375
+ const Source = requireSource();
31376
+ const splitIntoPotentialTokens = requireSplitIntoPotentialTokens();
31377
+
31378
+ class OriginalSource extends Source {
31379
+ constructor(value, name) {
31380
+ super();
31381
+ const isBuffer = Buffer.isBuffer(value);
31382
+ this._value = isBuffer ? undefined : value;
31383
+ this._valueAsBuffer = isBuffer ? value : undefined;
31384
+ this._name = name;
31385
+ }
31386
+
31387
+ getName() {
31388
+ return this._name;
31389
+ }
31390
+
31391
+ source() {
31392
+ if (this._value === undefined) {
31393
+ this._value = this._valueAsBuffer.toString("utf-8");
31394
+ }
31395
+ return this._value;
31396
+ }
31397
+
31398
+ buffer() {
31399
+ if (this._valueAsBuffer === undefined) {
31400
+ this._valueAsBuffer = Buffer.from(this._value, "utf-8");
31401
+ }
31402
+ return this._valueAsBuffer;
31403
+ }
31404
+
31405
+ map(options) {
31406
+ return getMap(this, options);
31407
+ }
31408
+
31409
+ sourceAndMap(options) {
31410
+ return getSourceAndMap(this, options);
31411
+ }
31412
+
31413
+ /**
31414
+ * @param {object} options options
31415
+ * @param {function(string, number, number, number, number, number, number): void} onChunk called for each chunk of code
31416
+ * @param {function(number, string, string)} onSource called for each source
31417
+ * @param {function(number, string)} onName called for each name
31418
+ * @returns {void}
31419
+ */
31420
+ streamChunks(options, onChunk, onSource, onName) {
31421
+ if (this._value === undefined) {
31422
+ this._value = this._valueAsBuffer.toString("utf-8");
31423
+ }
31424
+ onSource(0, this._name, this._value);
31425
+ const finalSource = !!(options && options.finalSource);
31426
+ if (!options || options.columns !== false) {
31427
+ // With column info we need to read all lines and split them
31428
+ const matches = splitIntoPotentialTokens(this._value);
31429
+ let line = 1;
31430
+ let column = 0;
31431
+ if (matches !== null) {
31432
+ for (const match of matches) {
31433
+ const isEndOfLine = match.endsWith("\n");
31434
+ if (isEndOfLine && match.length === 1) {
31435
+ if (!finalSource) onChunk(match, line, column, -1, -1, -1, -1);
31436
+ } else {
31437
+ const chunk = finalSource ? undefined : match;
31438
+ onChunk(chunk, line, column, 0, line, column, -1);
31439
+ }
31440
+ if (isEndOfLine) {
31441
+ line++;
31442
+ column = 0;
31443
+ } else {
31444
+ column += match.length;
31445
+ }
31446
+ }
31447
+ }
31448
+ return {
31449
+ generatedLine: line,
31450
+ generatedColumn: column,
31451
+ source: finalSource ? this._value : undefined
31452
+ };
31453
+ } else if (finalSource) {
31454
+ // Without column info and with final source we only
31455
+ // need meta info to generate mapping
31456
+ const result = getGeneratedSourceInfo(this._value);
31457
+ const { generatedLine, generatedColumn } = result;
31458
+ if (generatedColumn === 0) {
31459
+ for (let line = 1; line < generatedLine; line++)
31460
+ onChunk(undefined, line, 0, 0, line, 0, -1);
31461
+ } else {
31462
+ for (let line = 1; line <= generatedLine; line++)
31463
+ onChunk(undefined, line, 0, 0, line, 0, -1);
31464
+ }
31465
+ return result;
31466
+ } else {
31467
+ // Without column info, but also without final source
31468
+ // we need to split source by lines
31469
+ let line = 1;
31470
+ const matches = splitIntoLines(this._value);
31471
+ let match;
31472
+ for (match of matches) {
31473
+ onChunk(finalSource ? undefined : match, line, 0, 0, line, 0, -1);
31474
+ line++;
31475
+ }
31476
+ return matches.length === 0 || match.endsWith("\n")
31477
+ ? {
31478
+ generatedLine: matches.length + 1,
31479
+ generatedColumn: 0,
31480
+ source: finalSource ? this._value : undefined
31481
+ }
31482
+ : {
31483
+ generatedLine: matches.length,
31484
+ generatedColumn: match.length,
31485
+ source: finalSource ? this._value : undefined
31486
+ };
31487
+ }
31488
+ }
31489
+
31490
+ updateHash(hash) {
31491
+ if (this._valueAsBuffer === undefined) {
31492
+ this._valueAsBuffer = Buffer.from(this._value, "utf-8");
31493
+ }
31494
+ hash.update("OriginalSource");
31495
+ hash.update(this._valueAsBuffer);
31496
+ hash.update(this._name || "");
31497
+ }
31498
+ }
31499
+
31500
+ OriginalSource_1 = OriginalSource;
31501
+ return OriginalSource_1;
31502
+ }
31503
+
31504
+ /*
31505
+ MIT License http://www.opensource.org/licenses/mit-license.php
31506
+ Author Tobias Koppers @sokra
31507
+ */
31508
+
31509
+ var getSource_1;
31510
+ var hasRequiredGetSource;
31511
+
31512
+ function requireGetSource () {
31513
+ if (hasRequiredGetSource) return getSource_1;
31514
+ hasRequiredGetSource = 1;
31515
+
31516
+ const getSource = (sourceMap, index) => {
31517
+ if (index < 0) return null;
31518
+ const { sourceRoot, sources } = sourceMap;
31519
+ const source = sources[index];
31520
+ if (!sourceRoot) return source;
31521
+ if (sourceRoot.endsWith("/")) return sourceRoot + source;
31522
+ return sourceRoot + "/" + source;
31523
+ };
31524
+
31525
+ getSource_1 = getSource;
31526
+ return getSource_1;
31527
+ }
31528
+
31529
+ /*
31530
+ MIT License http://www.opensource.org/licenses/mit-license.php
31531
+ Author Tobias Koppers @sokra
31532
+ */
31533
+
31534
+ var readMappings_1;
31535
+ var hasRequiredReadMappings;
31536
+
31537
+ function requireReadMappings () {
31538
+ if (hasRequiredReadMappings) return readMappings_1;
31539
+ hasRequiredReadMappings = 1;
31540
+
31541
+ const ALPHABET =
31542
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
31543
+
31544
+ const CONTINUATION_BIT = 0x20;
31545
+ const END_SEGMENT_BIT = 0x40;
31546
+ const NEXT_LINE = END_SEGMENT_BIT | 0x01;
31547
+ const INVALID = END_SEGMENT_BIT | 0x02;
31548
+ const DATA_MASK = 0x1f;
31549
+
31550
+ const ccToValue = new Uint8Array("z".charCodeAt(0) + 1);
31551
+ {
31552
+ ccToValue.fill(INVALID);
31553
+ for (let i = 0; i < ALPHABET.length; i++) {
31554
+ ccToValue[ALPHABET.charCodeAt(i)] = i;
31555
+ }
31556
+ ccToValue[",".charCodeAt(0)] = END_SEGMENT_BIT;
31557
+ ccToValue[";".charCodeAt(0)] = NEXT_LINE;
31558
+ }
31559
+ const ccMax = ccToValue.length - 1;
31560
+
31561
+ /**
31562
+ * @param {string} mappings the mappings string
31563
+ * @param {function(number, number, number, number, number, number): void} onMapping called for each mapping
31564
+ * @returns {void}
31565
+ */
31566
+ const readMappings = (mappings, onMapping) => {
31567
+ // generatedColumn, [sourceIndex, originalLine, orignalColumn, [nameIndex]]
31568
+ const currentData = new Uint32Array([0, 0, 1, 0, 0]);
31569
+ let currentDataPos = 0;
31570
+ // currentValue will include a sign bit at bit 0
31571
+ let currentValue = 0;
31572
+ let currentValuePos = 0;
31573
+ let generatedLine = 1;
31574
+ let generatedColumn = -1;
31575
+ for (let i = 0; i < mappings.length; i++) {
31576
+ const cc = mappings.charCodeAt(i);
31577
+ if (cc > ccMax) continue;
31578
+ const value = ccToValue[cc];
31579
+ if ((value & END_SEGMENT_BIT) !== 0) {
31580
+ // End current segment
31581
+ if (currentData[0] > generatedColumn) {
31582
+ if (currentDataPos === 1) {
31583
+ onMapping(generatedLine, currentData[0], -1, -1, -1, -1);
31584
+ } else if (currentDataPos === 4) {
31585
+ onMapping(
31586
+ generatedLine,
31587
+ currentData[0],
31588
+ currentData[1],
31589
+ currentData[2],
31590
+ currentData[3],
31591
+ -1
31592
+ );
31593
+ } else if (currentDataPos === 5) {
31594
+ onMapping(
31595
+ generatedLine,
31596
+ currentData[0],
31597
+ currentData[1],
31598
+ currentData[2],
31599
+ currentData[3],
31600
+ currentData[4]
31601
+ );
31602
+ }
31603
+ generatedColumn = currentData[0];
31604
+ }
31605
+ currentDataPos = 0;
31606
+ if (value === NEXT_LINE) {
31607
+ // Start new line
31608
+ generatedLine++;
31609
+ currentData[0] = 0;
31610
+ generatedColumn = -1;
31611
+ }
31612
+ } else if ((value & CONTINUATION_BIT) === 0) {
31613
+ // last sextet
31614
+ currentValue |= value << currentValuePos;
31615
+ const finalValue =
31616
+ currentValue & 1 ? -(currentValue >> 1) : currentValue >> 1;
31617
+ currentData[currentDataPos++] += finalValue;
31618
+ currentValuePos = 0;
31619
+ currentValue = 0;
31620
+ } else {
31621
+ currentValue |= (value & DATA_MASK) << currentValuePos;
31622
+ currentValuePos += 5;
31623
+ }
31624
+ }
31625
+ // End current segment
31626
+ if (currentDataPos === 1) {
31627
+ onMapping(generatedLine, currentData[0], -1, -1, -1, -1);
31628
+ } else if (currentDataPos === 4) {
31629
+ onMapping(
31630
+ generatedLine,
31631
+ currentData[0],
31632
+ currentData[1],
31633
+ currentData[2],
31634
+ currentData[3],
31635
+ -1
31636
+ );
31637
+ } else if (currentDataPos === 5) {
31638
+ onMapping(
31639
+ generatedLine,
31640
+ currentData[0],
31641
+ currentData[1],
31642
+ currentData[2],
31643
+ currentData[3],
31644
+ currentData[4]
31645
+ );
31646
+ }
31647
+ };
31648
+
31649
+ readMappings_1 = readMappings;
31650
+ return readMappings_1;
31651
+ }
31652
+
31653
+ /*
31654
+ MIT License http://www.opensource.org/licenses/mit-license.php
31655
+ Author Tobias Koppers @sokra
31656
+ */
31657
+
31658
+ var streamChunksOfSourceMap;
31659
+ var hasRequiredStreamChunksOfSourceMap;
31660
+
31661
+ function requireStreamChunksOfSourceMap () {
31662
+ if (hasRequiredStreamChunksOfSourceMap) return streamChunksOfSourceMap;
31663
+ hasRequiredStreamChunksOfSourceMap = 1;
31664
+
31665
+ const getGeneratedSourceInfo = requireGetGeneratedSourceInfo();
31666
+ const getSource = requireGetSource();
31667
+ const readMappings = requireReadMappings();
31668
+ const splitIntoLines = requireSplitIntoLines();
31669
+
31670
+ const streamChunksOfSourceMapFull = (
31671
+ source,
31672
+ sourceMap,
31673
+ onChunk,
31674
+ onSource,
31675
+ onName
31676
+ ) => {
31677
+ const lines = splitIntoLines(source);
31678
+ if (lines.length === 0) {
31679
+ return {
31680
+ generatedLine: 1,
31681
+ generatedColumn: 0
31682
+ };
31683
+ }
31684
+ const { sources, sourcesContent, names, mappings } = sourceMap;
31685
+ for (let i = 0; i < sources.length; i++) {
31686
+ onSource(
31687
+ i,
31688
+ getSource(sourceMap, i),
31689
+ (sourcesContent && sourcesContent[i]) || undefined
31690
+ );
31691
+ }
31692
+ if (names) {
31693
+ for (let i = 0; i < names.length; i++) {
31694
+ onName(i, names[i]);
31695
+ }
31696
+ }
31697
+
31698
+ const lastLine = lines[lines.length - 1];
31699
+ const lastNewLine = lastLine.endsWith("\n");
31700
+ const finalLine = lastNewLine ? lines.length + 1 : lines.length;
31701
+ const finalColumn = lastNewLine ? 0 : lastLine.length;
31702
+
31703
+ let currentGeneratedLine = 1;
31704
+ let currentGeneratedColumn = 0;
31705
+
31706
+ let mappingActive = false;
31707
+ let activeMappingSourceIndex = -1;
31708
+ let activeMappingOriginalLine = -1;
31709
+ let activeMappingOriginalColumn = -1;
31710
+ let activeMappingNameIndex = -1;
31711
+
31712
+ const onMapping = (
31713
+ generatedLine,
31714
+ generatedColumn,
31715
+ sourceIndex,
31716
+ originalLine,
31717
+ originalColumn,
31718
+ nameIndex
31719
+ ) => {
31720
+ if (mappingActive && currentGeneratedLine <= lines.length) {
31721
+ let chunk;
31722
+ const mappingLine = currentGeneratedLine;
31723
+ const mappingColumn = currentGeneratedColumn;
31724
+ const line = lines[currentGeneratedLine - 1];
31725
+ if (generatedLine !== currentGeneratedLine) {
31726
+ chunk = line.slice(currentGeneratedColumn);
31727
+ currentGeneratedLine++;
31728
+ currentGeneratedColumn = 0;
31729
+ } else {
31730
+ chunk = line.slice(currentGeneratedColumn, generatedColumn);
31731
+ currentGeneratedColumn = generatedColumn;
31732
+ }
31733
+ if (chunk) {
31734
+ onChunk(
31735
+ chunk,
31736
+ mappingLine,
31737
+ mappingColumn,
31738
+ activeMappingSourceIndex,
31739
+ activeMappingOriginalLine,
31740
+ activeMappingOriginalColumn,
31741
+ activeMappingNameIndex
31742
+ );
31743
+ }
31744
+ mappingActive = false;
31745
+ }
31746
+ if (generatedLine > currentGeneratedLine && currentGeneratedColumn > 0) {
31747
+ if (currentGeneratedLine <= lines.length) {
31748
+ const chunk = lines[currentGeneratedLine - 1].slice(
31749
+ currentGeneratedColumn
31750
+ );
31751
+ onChunk(
31752
+ chunk,
31753
+ currentGeneratedLine,
31754
+ currentGeneratedColumn,
31755
+ -1,
31756
+ -1,
31757
+ -1,
31758
+ -1
31759
+ );
31760
+ }
31761
+ currentGeneratedLine++;
31762
+ currentGeneratedColumn = 0;
31763
+ }
31764
+ while (generatedLine > currentGeneratedLine) {
31765
+ if (currentGeneratedLine <= lines.length) {
31766
+ onChunk(
31767
+ lines[currentGeneratedLine - 1],
31768
+ currentGeneratedLine,
31769
+ 0,
31770
+ -1,
31771
+ -1,
31772
+ -1,
31773
+ -1
31774
+ );
31775
+ }
31776
+ currentGeneratedLine++;
31777
+ }
31778
+ if (generatedColumn > currentGeneratedColumn) {
31779
+ if (currentGeneratedLine <= lines.length) {
31780
+ const chunk = lines[currentGeneratedLine - 1].slice(
31781
+ currentGeneratedColumn,
31782
+ generatedColumn
31783
+ );
31784
+ onChunk(
31785
+ chunk,
31786
+ currentGeneratedLine,
31787
+ currentGeneratedColumn,
31788
+ -1,
31789
+ -1,
31790
+ -1,
31791
+ -1
31792
+ );
31793
+ }
31794
+ currentGeneratedColumn = generatedColumn;
31795
+ }
31796
+ if (
31797
+ sourceIndex >= 0 &&
31798
+ (generatedLine < finalLine ||
31799
+ (generatedLine === finalLine && generatedColumn < finalColumn))
31800
+ ) {
31801
+ mappingActive = true;
31802
+ activeMappingSourceIndex = sourceIndex;
31803
+ activeMappingOriginalLine = originalLine;
31804
+ activeMappingOriginalColumn = originalColumn;
31805
+ activeMappingNameIndex = nameIndex;
31806
+ }
31807
+ };
31808
+ readMappings(mappings, onMapping);
31809
+ onMapping(finalLine, finalColumn, -1, -1, -1, -1);
31810
+ return {
31811
+ generatedLine: finalLine,
31812
+ generatedColumn: finalColumn
31813
+ };
31814
+ };
31815
+
31816
+ const streamChunksOfSourceMapLinesFull = (
31817
+ source,
31818
+ sourceMap,
31819
+ onChunk,
31820
+ onSource,
31821
+ _onName
31822
+ ) => {
31823
+ const lines = splitIntoLines(source);
31824
+ if (lines.length === 0) {
31825
+ return {
31826
+ generatedLine: 1,
31827
+ generatedColumn: 0
31828
+ };
31829
+ }
31830
+ const { sources, sourcesContent, mappings } = sourceMap;
31831
+ for (let i = 0; i < sources.length; i++) {
31832
+ onSource(
31833
+ i,
31834
+ getSource(sourceMap, i),
31835
+ (sourcesContent && sourcesContent[i]) || undefined
31836
+ );
31837
+ }
31838
+
31839
+ let currentGeneratedLine = 1;
31840
+
31841
+ const onMapping = (
31842
+ generatedLine,
31843
+ _generatedColumn,
31844
+ sourceIndex,
31845
+ originalLine,
31846
+ originalColumn,
31847
+ _nameIndex
31848
+ ) => {
31849
+ if (
31850
+ sourceIndex < 0 ||
31851
+ generatedLine < currentGeneratedLine ||
31852
+ generatedLine > lines.length
31853
+ ) {
31854
+ return;
31855
+ }
31856
+ while (generatedLine > currentGeneratedLine) {
31857
+ if (currentGeneratedLine <= lines.length) {
31858
+ onChunk(
31859
+ lines[currentGeneratedLine - 1],
31860
+ currentGeneratedLine,
31861
+ 0,
31862
+ -1,
31863
+ -1,
31864
+ -1,
31865
+ -1
31866
+ );
31867
+ }
31868
+ currentGeneratedLine++;
31869
+ }
31870
+ if (generatedLine <= lines.length) {
31871
+ onChunk(
31872
+ lines[generatedLine - 1],
31873
+ generatedLine,
31874
+ 0,
31875
+ sourceIndex,
31876
+ originalLine,
31877
+ originalColumn,
31878
+ -1
31879
+ );
31880
+ currentGeneratedLine++;
31881
+ }
31882
+ };
31883
+ readMappings(mappings, onMapping);
31884
+ for (; currentGeneratedLine <= lines.length; currentGeneratedLine++) {
31885
+ onChunk(
31886
+ lines[currentGeneratedLine - 1],
31887
+ currentGeneratedLine,
31888
+ 0,
31889
+ -1,
31890
+ -1,
31891
+ -1,
31892
+ -1
31893
+ );
31894
+ }
31895
+
31896
+ const lastLine = lines[lines.length - 1];
31897
+ const lastNewLine = lastLine.endsWith("\n");
31898
+
31899
+ const finalLine = lastNewLine ? lines.length + 1 : lines.length;
31900
+ const finalColumn = lastNewLine ? 0 : lastLine.length;
31901
+
31902
+ return {
31903
+ generatedLine: finalLine,
31904
+ generatedColumn: finalColumn
31905
+ };
31906
+ };
31907
+
31908
+ const streamChunksOfSourceMapFinal = (
31909
+ source,
31910
+ sourceMap,
31911
+ onChunk,
31912
+ onSource,
31913
+ onName
31914
+ ) => {
31915
+ const result = getGeneratedSourceInfo(source);
31916
+ const { generatedLine: finalLine, generatedColumn: finalColumn } = result;
31917
+
31918
+ if (finalLine === 1 && finalColumn === 0) return result;
31919
+ const { sources, sourcesContent, names, mappings } = sourceMap;
31920
+ for (let i = 0; i < sources.length; i++) {
31921
+ onSource(
31922
+ i,
31923
+ getSource(sourceMap, i),
31924
+ (sourcesContent && sourcesContent[i]) || undefined
31925
+ );
31926
+ }
31927
+ if (names) {
31928
+ for (let i = 0; i < names.length; i++) {
31929
+ onName(i, names[i]);
31930
+ }
31931
+ }
31932
+
31933
+ let mappingActiveLine = 0;
31934
+
31935
+ const onMapping = (
31936
+ generatedLine,
31937
+ generatedColumn,
31938
+ sourceIndex,
31939
+ originalLine,
31940
+ originalColumn,
31941
+ nameIndex
31942
+ ) => {
31943
+ if (
31944
+ generatedLine >= finalLine &&
31945
+ (generatedColumn >= finalColumn || generatedLine > finalLine)
31946
+ ) {
31947
+ return;
31948
+ }
31949
+ if (sourceIndex >= 0) {
31950
+ onChunk(
31951
+ undefined,
31952
+ generatedLine,
31953
+ generatedColumn,
31954
+ sourceIndex,
31955
+ originalLine,
31956
+ originalColumn,
31957
+ nameIndex
31958
+ );
31959
+ mappingActiveLine = generatedLine;
31960
+ } else if (mappingActiveLine === generatedLine) {
31961
+ onChunk(undefined, generatedLine, generatedColumn, -1, -1, -1, -1);
31962
+ mappingActiveLine = 0;
31963
+ }
31964
+ };
31965
+ readMappings(mappings, onMapping);
31966
+ return result;
31967
+ };
31968
+
31969
+ const streamChunksOfSourceMapLinesFinal = (
31970
+ source,
31971
+ sourceMap,
31972
+ onChunk,
31973
+ onSource,
31974
+ _onName
31975
+ ) => {
31976
+ const result = getGeneratedSourceInfo(source);
31977
+ const { generatedLine, generatedColumn } = result;
31978
+ if (generatedLine === 1 && generatedColumn === 0) {
31979
+ return {
31980
+ generatedLine: 1,
31981
+ generatedColumn: 0
31982
+ };
31983
+ }
31984
+
31985
+ const { sources, sourcesContent, mappings } = sourceMap;
31986
+ for (let i = 0; i < sources.length; i++) {
31987
+ onSource(
31988
+ i,
31989
+ getSource(sourceMap, i),
31990
+ (sourcesContent && sourcesContent[i]) || undefined
31991
+ );
31992
+ }
31993
+
31994
+ const finalLine = generatedColumn === 0 ? generatedLine - 1 : generatedLine;
31995
+
31996
+ let currentGeneratedLine = 1;
31997
+
31998
+ const onMapping = (
31999
+ generatedLine,
32000
+ _generatedColumn,
32001
+ sourceIndex,
32002
+ originalLine,
32003
+ originalColumn,
32004
+ _nameIndex
32005
+ ) => {
32006
+ if (
32007
+ sourceIndex >= 0 &&
32008
+ currentGeneratedLine <= generatedLine &&
32009
+ generatedLine <= finalLine
32010
+ ) {
32011
+ onChunk(
32012
+ undefined,
32013
+ generatedLine,
32014
+ 0,
32015
+ sourceIndex,
32016
+ originalLine,
32017
+ originalColumn,
32018
+ -1
32019
+ );
32020
+ currentGeneratedLine = generatedLine + 1;
32021
+ }
32022
+ };
32023
+ readMappings(mappings, onMapping);
32024
+ return result;
32025
+ };
32026
+
32027
+ streamChunksOfSourceMap = (
32028
+ source,
32029
+ sourceMap,
32030
+ onChunk,
32031
+ onSource,
32032
+ onName,
32033
+ finalSource,
32034
+ columns
32035
+ ) => {
32036
+ if (columns) {
32037
+ return finalSource
32038
+ ? streamChunksOfSourceMapFinal(
32039
+ source,
32040
+ sourceMap,
32041
+ onChunk,
32042
+ onSource,
32043
+ onName
32044
+ )
32045
+ : streamChunksOfSourceMapFull(
32046
+ source,
32047
+ sourceMap,
32048
+ onChunk,
32049
+ onSource,
32050
+ onName
32051
+ );
32052
+ } else {
32053
+ return finalSource
32054
+ ? streamChunksOfSourceMapLinesFinal(
32055
+ source,
32056
+ sourceMap,
32057
+ onChunk,
32058
+ onSource)
32059
+ : streamChunksOfSourceMapLinesFull(
32060
+ source,
32061
+ sourceMap,
32062
+ onChunk,
32063
+ onSource);
32064
+ }
32065
+ };
32066
+ return streamChunksOfSourceMap;
32067
+ }
32068
+
32069
+ /*
32070
+ MIT License http://www.opensource.org/licenses/mit-license.php
32071
+ Author Tobias Koppers @sokra
32072
+ */
32073
+
32074
+ var streamChunksOfCombinedSourceMap_1;
32075
+ var hasRequiredStreamChunksOfCombinedSourceMap;
32076
+
32077
+ function requireStreamChunksOfCombinedSourceMap () {
32078
+ if (hasRequiredStreamChunksOfCombinedSourceMap) return streamChunksOfCombinedSourceMap_1;
32079
+ hasRequiredStreamChunksOfCombinedSourceMap = 1;
32080
+
32081
+ const streamChunksOfSourceMap = requireStreamChunksOfSourceMap();
32082
+ const splitIntoLines = requireSplitIntoLines();
32083
+
32084
+ const streamChunksOfCombinedSourceMap = (
32085
+ source,
32086
+ sourceMap,
32087
+ innerSourceName,
32088
+ innerSource,
32089
+ innerSourceMap,
32090
+ removeInnerSource,
32091
+ onChunk,
32092
+ onSource,
32093
+ onName,
32094
+ finalSource,
32095
+ columns
32096
+ ) => {
32097
+ let sourceMapping = new Map();
32098
+ let nameMapping = new Map();
32099
+ const sourceIndexMapping = [];
32100
+ const nameIndexMapping = [];
32101
+ const nameIndexValueMapping = [];
32102
+ let innerSourceIndex = -2;
32103
+ const innerSourceIndexMapping = [];
32104
+ const innerSourceIndexValueMapping = [];
32105
+ const innerSourceContents = [];
32106
+ const innerSourceContentLines = [];
32107
+ const innerNameIndexMapping = [];
32108
+ const innerNameIndexValueMapping = [];
32109
+ const innerSourceMapLineData = [];
32110
+ const findInnerMapping = (line, column) => {
32111
+ if (line > innerSourceMapLineData.length) return -1;
32112
+ const { mappingsData } = innerSourceMapLineData[line - 1];
32113
+ let l = 0;
32114
+ let r = mappingsData.length / 5;
32115
+ while (l < r) {
32116
+ let m = (l + r) >> 1;
32117
+ if (mappingsData[m * 5] <= column) {
32118
+ l = m + 1;
32119
+ } else {
32120
+ r = m;
32121
+ }
32122
+ }
32123
+ if (l === 0) return -1;
32124
+ return l - 1;
32125
+ };
32126
+ return streamChunksOfSourceMap(
32127
+ source,
32128
+ sourceMap,
32129
+ (
32130
+ chunk,
32131
+ generatedLine,
32132
+ generatedColumn,
32133
+ sourceIndex,
32134
+ originalLine,
32135
+ originalColumn,
32136
+ nameIndex
32137
+ ) => {
32138
+ // Check if this is a mapping to the inner source
32139
+ if (sourceIndex === innerSourceIndex) {
32140
+ // Check if there is a mapping in the inner source
32141
+ const idx = findInnerMapping(originalLine, originalColumn);
32142
+ if (idx !== -1) {
32143
+ const { chunks, mappingsData } = innerSourceMapLineData[
32144
+ originalLine - 1
32145
+ ];
32146
+ const mi = idx * 5;
32147
+ const innerSourceIndex = mappingsData[mi + 1];
32148
+ const innerOriginalLine = mappingsData[mi + 2];
32149
+ let innerOriginalColumn = mappingsData[mi + 3];
32150
+ let innerNameIndex = mappingsData[mi + 4];
32151
+ if (innerSourceIndex >= 0) {
32152
+ // Check for an identity mapping
32153
+ // where we are allowed to adjust the original column
32154
+ const innerChunk = chunks[idx];
32155
+ const innerGeneratedColumn = mappingsData[mi];
32156
+ const locationInChunk = originalColumn - innerGeneratedColumn;
32157
+ if (locationInChunk > 0) {
32158
+ let originalSourceLines =
32159
+ innerSourceIndex < innerSourceContentLines.length
32160
+ ? innerSourceContentLines[innerSourceIndex]
32161
+ : null;
32162
+ if (originalSourceLines === undefined) {
32163
+ const originalSource = innerSourceContents[innerSourceIndex];
32164
+ originalSourceLines = originalSource
32165
+ ? splitIntoLines(originalSource)
32166
+ : null;
32167
+ innerSourceContentLines[innerSourceIndex] = originalSourceLines;
32168
+ }
32169
+ if (originalSourceLines !== null) {
32170
+ const originalChunk =
32171
+ innerOriginalLine <= originalSourceLines.length
32172
+ ? originalSourceLines[innerOriginalLine - 1].slice(
32173
+ innerOriginalColumn,
32174
+ innerOriginalColumn + locationInChunk
32175
+ )
32176
+ : "";
32177
+ if (innerChunk.slice(0, locationInChunk) === originalChunk) {
32178
+ innerOriginalColumn += locationInChunk;
32179
+ innerNameIndex = -1;
32180
+ }
32181
+ }
32182
+ }
32183
+
32184
+ // We have a inner mapping to original source
32185
+
32186
+ // emit source when needed and compute global source index
32187
+ let sourceIndex =
32188
+ innerSourceIndex < innerSourceIndexMapping.length
32189
+ ? innerSourceIndexMapping[innerSourceIndex]
32190
+ : -2;
32191
+ if (sourceIndex === -2) {
32192
+ const [source, sourceContent] =
32193
+ innerSourceIndex < innerSourceIndexValueMapping.length
32194
+ ? innerSourceIndexValueMapping[innerSourceIndex]
32195
+ : [null, undefined];
32196
+ let globalIndex = sourceMapping.get(source);
32197
+ if (globalIndex === undefined) {
32198
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
32199
+ onSource(globalIndex, source, sourceContent);
32200
+ }
32201
+ sourceIndex = globalIndex;
32202
+ innerSourceIndexMapping[innerSourceIndex] = sourceIndex;
32203
+ }
32204
+
32205
+ // emit name when needed and compute global name index
32206
+ let finalNameIndex = -1;
32207
+ if (innerNameIndex >= 0) {
32208
+ // when we have a inner name
32209
+ finalNameIndex =
32210
+ innerNameIndex < innerNameIndexMapping.length
32211
+ ? innerNameIndexMapping[innerNameIndex]
32212
+ : -2;
32213
+ if (finalNameIndex === -2) {
32214
+ const name =
32215
+ innerNameIndex < innerNameIndexValueMapping.length
32216
+ ? innerNameIndexValueMapping[innerNameIndex]
32217
+ : undefined;
32218
+ if (name) {
32219
+ let globalIndex = nameMapping.get(name);
32220
+ if (globalIndex === undefined) {
32221
+ nameMapping.set(name, (globalIndex = nameMapping.size));
32222
+ onName(globalIndex, name);
32223
+ }
32224
+ finalNameIndex = globalIndex;
32225
+ } else {
32226
+ finalNameIndex = -1;
32227
+ }
32228
+ innerNameIndexMapping[innerNameIndex] = finalNameIndex;
32229
+ }
32230
+ } else if (nameIndex >= 0) {
32231
+ // when we don't have an inner name,
32232
+ // but we have an outer name
32233
+ // it can be used when inner original code equals to the name
32234
+ let originalSourceLines =
32235
+ innerSourceContentLines[innerSourceIndex];
32236
+ if (originalSourceLines === undefined) {
32237
+ const originalSource = innerSourceContents[innerSourceIndex];
32238
+ originalSourceLines = originalSource
32239
+ ? splitIntoLines(originalSource)
32240
+ : null;
32241
+ innerSourceContentLines[innerSourceIndex] = originalSourceLines;
32242
+ }
32243
+ if (originalSourceLines !== null) {
32244
+ const name = nameIndexValueMapping[nameIndex];
32245
+ const originalName =
32246
+ innerOriginalLine <= originalSourceLines.length
32247
+ ? originalSourceLines[innerOriginalLine - 1].slice(
32248
+ innerOriginalColumn,
32249
+ innerOriginalColumn + name.length
32250
+ )
32251
+ : "";
32252
+ if (name === originalName) {
32253
+ finalNameIndex =
32254
+ nameIndex < nameIndexMapping.length
32255
+ ? nameIndexMapping[nameIndex]
32256
+ : -2;
32257
+ if (finalNameIndex === -2) {
32258
+ const name = nameIndexValueMapping[nameIndex];
32259
+ if (name) {
32260
+ let globalIndex = nameMapping.get(name);
32261
+ if (globalIndex === undefined) {
32262
+ nameMapping.set(name, (globalIndex = nameMapping.size));
32263
+ onName(globalIndex, name);
32264
+ }
32265
+ finalNameIndex = globalIndex;
32266
+ } else {
32267
+ finalNameIndex = -1;
32268
+ }
32269
+ nameIndexMapping[nameIndex] = finalNameIndex;
32270
+ }
32271
+ }
32272
+ }
32273
+ }
32274
+ onChunk(
32275
+ chunk,
32276
+ generatedLine,
32277
+ generatedColumn,
32278
+ sourceIndex,
32279
+ innerOriginalLine,
32280
+ innerOriginalColumn,
32281
+ finalNameIndex
32282
+ );
32283
+ return;
32284
+ }
32285
+ }
32286
+
32287
+ // We have a mapping to the inner source, but no inner mapping
32288
+ if (removeInnerSource) {
32289
+ onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1);
32290
+ return;
32291
+ } else {
32292
+ if (sourceIndexMapping[sourceIndex] === -2) {
32293
+ let globalIndex = sourceMapping.get(innerSourceName);
32294
+ if (globalIndex === undefined) {
32295
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
32296
+ onSource(globalIndex, innerSourceName, innerSource);
32297
+ }
32298
+ sourceIndexMapping[sourceIndex] = globalIndex;
32299
+ }
32300
+ }
32301
+ }
32302
+
32303
+ const finalSourceIndex =
32304
+ sourceIndex < 0 || sourceIndex >= sourceIndexMapping.length
32305
+ ? -1
32306
+ : sourceIndexMapping[sourceIndex];
32307
+ if (finalSourceIndex < 0) {
32308
+ // no source, so we make it a generated chunk
32309
+ onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1);
32310
+ } else {
32311
+ // Pass through the chunk with mapping
32312
+ let finalNameIndex = -1;
32313
+ if (nameIndex >= 0 && nameIndex < nameIndexMapping.length) {
32314
+ finalNameIndex = nameIndexMapping[nameIndex];
32315
+ if (finalNameIndex === -2) {
32316
+ const name = nameIndexValueMapping[nameIndex];
32317
+ let globalIndex = nameMapping.get(name);
32318
+ if (globalIndex === undefined) {
32319
+ nameMapping.set(name, (globalIndex = nameMapping.size));
32320
+ onName(globalIndex, name);
32321
+ }
32322
+ finalNameIndex = globalIndex;
32323
+ nameIndexMapping[nameIndex] = finalNameIndex;
32324
+ }
32325
+ }
32326
+ onChunk(
32327
+ chunk,
32328
+ generatedLine,
32329
+ generatedColumn,
32330
+ finalSourceIndex,
32331
+ originalLine,
32332
+ originalColumn,
32333
+ finalNameIndex
32334
+ );
32335
+ }
32336
+ },
32337
+ (i, source, sourceContent) => {
32338
+ if (source === innerSourceName) {
32339
+ innerSourceIndex = i;
32340
+ if (innerSource !== undefined) sourceContent = innerSource;
32341
+ else innerSource = sourceContent;
32342
+ sourceIndexMapping[i] = -2;
32343
+ streamChunksOfSourceMap(
32344
+ sourceContent,
32345
+ innerSourceMap,
32346
+ (
32347
+ chunk,
32348
+ generatedLine,
32349
+ generatedColumn,
32350
+ sourceIndex,
32351
+ originalLine,
32352
+ originalColumn,
32353
+ nameIndex
32354
+ ) => {
32355
+ while (innerSourceMapLineData.length < generatedLine) {
32356
+ innerSourceMapLineData.push({
32357
+ mappingsData: [],
32358
+ chunks: []
32359
+ });
32360
+ }
32361
+ const data = innerSourceMapLineData[generatedLine - 1];
32362
+ data.mappingsData.push(
32363
+ generatedColumn,
32364
+ sourceIndex,
32365
+ originalLine,
32366
+ originalColumn,
32367
+ nameIndex
32368
+ );
32369
+ data.chunks.push(chunk);
32370
+ },
32371
+ (i, source, sourceContent) => {
32372
+ innerSourceContents[i] = sourceContent;
32373
+ innerSourceContentLines[i] = undefined;
32374
+ innerSourceIndexMapping[i] = -2;
32375
+ innerSourceIndexValueMapping[i] = [source, sourceContent];
32376
+ },
32377
+ (i, name) => {
32378
+ innerNameIndexMapping[i] = -2;
32379
+ innerNameIndexValueMapping[i] = name;
32380
+ },
32381
+ false,
32382
+ columns
32383
+ );
32384
+ } else {
32385
+ let globalIndex = sourceMapping.get(source);
32386
+ if (globalIndex === undefined) {
32387
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
32388
+ onSource(globalIndex, source, sourceContent);
32389
+ }
32390
+ sourceIndexMapping[i] = globalIndex;
32391
+ }
32392
+ },
32393
+ (i, name) => {
32394
+ nameIndexMapping[i] = -2;
32395
+ nameIndexValueMapping[i] = name;
32396
+ },
32397
+ finalSource,
32398
+ columns
32399
+ );
32400
+ };
32401
+
32402
+ streamChunksOfCombinedSourceMap_1 = streamChunksOfCombinedSourceMap;
32403
+ return streamChunksOfCombinedSourceMap_1;
32404
+ }
32405
+
32406
+ /*
32407
+ MIT License http://www.opensource.org/licenses/mit-license.php
32408
+ Author Tobias Koppers @sokra
32409
+ */
32410
+
32411
+ var SourceMapSource_1;
32412
+ var hasRequiredSourceMapSource;
32413
+
32414
+ function requireSourceMapSource () {
32415
+ if (hasRequiredSourceMapSource) return SourceMapSource_1;
32416
+ hasRequiredSourceMapSource = 1;
32417
+
32418
+ const Source = requireSource();
32419
+ const streamChunksOfSourceMap = requireStreamChunksOfSourceMap();
32420
+ const streamChunksOfCombinedSourceMap = requireStreamChunksOfCombinedSourceMap();
32421
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
32422
+
32423
+ class SourceMapSource extends Source {
32424
+ constructor(
32425
+ value,
32426
+ name,
32427
+ sourceMap,
32428
+ originalSource,
32429
+ innerSourceMap,
32430
+ removeOriginalSource
32431
+ ) {
32432
+ super();
32433
+ const valueIsBuffer = Buffer.isBuffer(value);
32434
+ this._valueAsString = valueIsBuffer ? undefined : value;
32435
+ this._valueAsBuffer = valueIsBuffer ? value : undefined;
32436
+
32437
+ this._name = name;
32438
+
32439
+ this._hasSourceMap = !!sourceMap;
32440
+ const sourceMapIsBuffer = Buffer.isBuffer(sourceMap);
32441
+ const sourceMapIsString = typeof sourceMap === "string";
32442
+ this._sourceMapAsObject =
32443
+ sourceMapIsBuffer || sourceMapIsString ? undefined : sourceMap;
32444
+ this._sourceMapAsString = sourceMapIsString ? sourceMap : undefined;
32445
+ this._sourceMapAsBuffer = sourceMapIsBuffer ? sourceMap : undefined;
32446
+
32447
+ this._hasOriginalSource = !!originalSource;
32448
+ const originalSourceIsBuffer = Buffer.isBuffer(originalSource);
32449
+ this._originalSourceAsString = originalSourceIsBuffer
32450
+ ? undefined
32451
+ : originalSource;
32452
+ this._originalSourceAsBuffer = originalSourceIsBuffer
32453
+ ? originalSource
32454
+ : undefined;
32455
+
32456
+ this._hasInnerSourceMap = !!innerSourceMap;
32457
+ const innerSourceMapIsBuffer = Buffer.isBuffer(innerSourceMap);
32458
+ const innerSourceMapIsString = typeof innerSourceMap === "string";
32459
+ this._innerSourceMapAsObject =
32460
+ innerSourceMapIsBuffer || innerSourceMapIsString
32461
+ ? undefined
32462
+ : innerSourceMap;
32463
+ this._innerSourceMapAsString = innerSourceMapIsString
32464
+ ? innerSourceMap
32465
+ : undefined;
32466
+ this._innerSourceMapAsBuffer = innerSourceMapIsBuffer
32467
+ ? innerSourceMap
32468
+ : undefined;
32469
+
32470
+ this._removeOriginalSource = removeOriginalSource;
32471
+ }
32472
+
32473
+ _ensureValueBuffer() {
32474
+ if (this._valueAsBuffer === undefined) {
32475
+ this._valueAsBuffer = Buffer.from(this._valueAsString, "utf-8");
32476
+ }
32477
+ }
32478
+
32479
+ _ensureValueString() {
32480
+ if (this._valueAsString === undefined) {
32481
+ this._valueAsString = this._valueAsBuffer.toString("utf-8");
32482
+ }
32483
+ }
32484
+
32485
+ _ensureOriginalSourceBuffer() {
32486
+ if (this._originalSourceAsBuffer === undefined && this._hasOriginalSource) {
32487
+ this._originalSourceAsBuffer = Buffer.from(
32488
+ this._originalSourceAsString,
32489
+ "utf-8"
32490
+ );
32491
+ }
32492
+ }
32493
+
32494
+ _ensureOriginalSourceString() {
32495
+ if (this._originalSourceAsString === undefined && this._hasOriginalSource) {
32496
+ this._originalSourceAsString = this._originalSourceAsBuffer.toString(
32497
+ "utf-8"
32498
+ );
32499
+ }
32500
+ }
32501
+
32502
+ _ensureInnerSourceMapObject() {
32503
+ if (this._innerSourceMapAsObject === undefined && this._hasInnerSourceMap) {
32504
+ this._ensureInnerSourceMapString();
32505
+ this._innerSourceMapAsObject = JSON.parse(this._innerSourceMapAsString);
32506
+ }
32507
+ }
32508
+
32509
+ _ensureInnerSourceMapBuffer() {
32510
+ if (this._innerSourceMapAsBuffer === undefined && this._hasInnerSourceMap) {
32511
+ this._ensureInnerSourceMapString();
32512
+ this._innerSourceMapAsBuffer = Buffer.from(
32513
+ this._innerSourceMapAsString,
32514
+ "utf-8"
32515
+ );
32516
+ }
32517
+ }
32518
+
32519
+ _ensureInnerSourceMapString() {
32520
+ if (this._innerSourceMapAsString === undefined && this._hasInnerSourceMap) {
32521
+ if (this._innerSourceMapAsBuffer !== undefined) {
32522
+ this._innerSourceMapAsString = this._innerSourceMapAsBuffer.toString(
32523
+ "utf-8"
32524
+ );
32525
+ } else {
32526
+ this._innerSourceMapAsString = JSON.stringify(
32527
+ this._innerSourceMapAsObject
32528
+ );
32529
+ }
32530
+ }
32531
+ }
32532
+
32533
+ _ensureSourceMapObject() {
32534
+ if (this._sourceMapAsObject === undefined) {
32535
+ this._ensureSourceMapString();
32536
+ this._sourceMapAsObject = JSON.parse(this._sourceMapAsString);
32537
+ }
32538
+ }
32539
+
32540
+ _ensureSourceMapBuffer() {
32541
+ if (this._sourceMapAsBuffer === undefined) {
32542
+ this._ensureSourceMapString();
32543
+ this._sourceMapAsBuffer = Buffer.from(this._sourceMapAsString, "utf-8");
32544
+ }
32545
+ }
32546
+
32547
+ _ensureSourceMapString() {
32548
+ if (this._sourceMapAsString === undefined) {
32549
+ if (this._sourceMapAsBuffer !== undefined) {
32550
+ this._sourceMapAsString = this._sourceMapAsBuffer.toString("utf-8");
32551
+ } else {
32552
+ this._sourceMapAsString = JSON.stringify(this._sourceMapAsObject);
32553
+ }
32554
+ }
32555
+ }
32556
+
32557
+ getArgsAsBuffers() {
32558
+ this._ensureValueBuffer();
32559
+ this._ensureSourceMapBuffer();
32560
+ this._ensureOriginalSourceBuffer();
32561
+ this._ensureInnerSourceMapBuffer();
32562
+ return [
32563
+ this._valueAsBuffer,
32564
+ this._name,
32565
+ this._sourceMapAsBuffer,
32566
+ this._originalSourceAsBuffer,
32567
+ this._innerSourceMapAsBuffer,
32568
+ this._removeOriginalSource
32569
+ ];
32570
+ }
32571
+
32572
+ buffer() {
32573
+ this._ensureValueBuffer();
32574
+ return this._valueAsBuffer;
32575
+ }
32576
+
32577
+ source() {
32578
+ this._ensureValueString();
32579
+ return this._valueAsString;
32580
+ }
32581
+
32582
+ map(options) {
32583
+ if (!this._hasInnerSourceMap) {
32584
+ this._ensureSourceMapObject();
32585
+ return this._sourceMapAsObject;
32586
+ }
32587
+ return getMap(this, options);
32588
+ }
32589
+
32590
+ sourceAndMap(options) {
32591
+ if (!this._hasInnerSourceMap) {
32592
+ this._ensureValueString();
32593
+ this._ensureSourceMapObject();
32594
+ return {
32595
+ source: this._valueAsString,
32596
+ map: this._sourceMapAsObject
32597
+ };
32598
+ }
32599
+ return getSourceAndMap(this, options);
32600
+ }
32601
+
32602
+ streamChunks(options, onChunk, onSource, onName) {
32603
+ this._ensureValueString();
32604
+ this._ensureSourceMapObject();
32605
+ this._ensureOriginalSourceString();
32606
+ if (this._hasInnerSourceMap) {
32607
+ this._ensureInnerSourceMapObject();
32608
+ return streamChunksOfCombinedSourceMap(
32609
+ this._valueAsString,
32610
+ this._sourceMapAsObject,
32611
+ this._name,
32612
+ this._originalSourceAsString,
32613
+ this._innerSourceMapAsObject,
32614
+ this._removeOriginalSource,
32615
+ onChunk,
32616
+ onSource,
32617
+ onName,
32618
+ !!(options && options.finalSource),
32619
+ !!(options && options.columns !== false)
32620
+ );
32621
+ } else {
32622
+ return streamChunksOfSourceMap(
32623
+ this._valueAsString,
32624
+ this._sourceMapAsObject,
32625
+ onChunk,
32626
+ onSource,
32627
+ onName,
32628
+ !!(options && options.finalSource),
32629
+ !!(options && options.columns !== false)
32630
+ );
32631
+ }
32632
+ }
32633
+
32634
+ updateHash(hash) {
32635
+ this._ensureValueBuffer();
32636
+ this._ensureSourceMapBuffer();
32637
+ this._ensureOriginalSourceBuffer();
32638
+ this._ensureInnerSourceMapBuffer();
32639
+
32640
+ hash.update("SourceMapSource");
32641
+
32642
+ hash.update(this._valueAsBuffer);
32643
+
32644
+ hash.update(this._sourceMapAsBuffer);
32645
+
32646
+ if (this._hasOriginalSource) {
32647
+ hash.update(this._originalSourceAsBuffer);
32648
+ }
32649
+
32650
+ if (this._hasInnerSourceMap) {
32651
+ hash.update(this._innerSourceMapAsBuffer);
32652
+ }
32653
+
32654
+ hash.update(this._removeOriginalSource ? "true" : "false");
32655
+ }
32656
+ }
32657
+
32658
+ SourceMapSource_1 = SourceMapSource;
32659
+ return SourceMapSource_1;
32660
+ }
32661
+
32662
+ /*
32663
+ MIT License http://www.opensource.org/licenses/mit-license.php
32664
+ Author Tobias Koppers @sokra
32665
+ */
32666
+
32667
+ var streamChunks;
32668
+ var hasRequiredStreamChunks;
32669
+
32670
+ function requireStreamChunks () {
32671
+ if (hasRequiredStreamChunks) return streamChunks;
32672
+ hasRequiredStreamChunks = 1;
32673
+
32674
+ const streamChunksOfRawSource = requireStreamChunksOfRawSource();
32675
+ const streamChunksOfSourceMap = requireStreamChunksOfSourceMap();
32676
+
32677
+ streamChunks = (source, options, onChunk, onSource, onName) => {
32678
+ if (typeof source.streamChunks === "function") {
32679
+ return source.streamChunks(options, onChunk, onSource, onName);
32680
+ } else {
32681
+ const sourceAndMap = source.sourceAndMap(options);
32682
+ if (sourceAndMap.map) {
32683
+ return streamChunksOfSourceMap(
32684
+ sourceAndMap.source,
32685
+ sourceAndMap.map,
32686
+ onChunk,
32687
+ onSource,
32688
+ onName,
32689
+ !!(options && options.finalSource),
32690
+ !!(options && options.columns !== false)
32691
+ );
32692
+ } else {
32693
+ return streamChunksOfRawSource(
32694
+ sourceAndMap.source,
32695
+ onChunk,
32696
+ onSource,
32697
+ onName,
32698
+ !!(options && options.finalSource)
32699
+ );
32700
+ }
32701
+ }
32702
+ };
32703
+ return streamChunks;
32704
+ }
32705
+
32706
+ /*
32707
+ MIT License http://www.opensource.org/licenses/mit-license.php
32708
+ Author Tobias Koppers @sokra
32709
+ */
32710
+
32711
+ var streamAndGetSourceAndMap_1;
32712
+ var hasRequiredStreamAndGetSourceAndMap;
32713
+
32714
+ function requireStreamAndGetSourceAndMap () {
32715
+ if (hasRequiredStreamAndGetSourceAndMap) return streamAndGetSourceAndMap_1;
32716
+ hasRequiredStreamAndGetSourceAndMap = 1;
32717
+
32718
+ const createMappingsSerializer = requireCreateMappingsSerializer();
32719
+ const streamChunks = requireStreamChunks();
32720
+
32721
+ const streamAndGetSourceAndMap = (
32722
+ inputSource,
32723
+ options,
32724
+ onChunk,
32725
+ onSource,
32726
+ onName
32727
+ ) => {
32728
+ let code = "";
32729
+ let mappings = "";
32730
+ let sources = [];
32731
+ let sourcesContent = [];
32732
+ let names = [];
32733
+ const addMapping = createMappingsSerializer(
32734
+ Object.assign({}, options, { columns: true })
32735
+ );
32736
+ const finalSource = !!(options && options.finalSource);
32737
+ const { generatedLine, generatedColumn, source } = streamChunks(
32738
+ inputSource,
32739
+ options,
32740
+ (
32741
+ chunk,
32742
+ generatedLine,
32743
+ generatedColumn,
32744
+ sourceIndex,
32745
+ originalLine,
32746
+ originalColumn,
32747
+ nameIndex
32748
+ ) => {
32749
+ if (chunk !== undefined) code += chunk;
32750
+ mappings += addMapping(
32751
+ generatedLine,
32752
+ generatedColumn,
32753
+ sourceIndex,
32754
+ originalLine,
32755
+ originalColumn,
32756
+ nameIndex
32757
+ );
32758
+ return onChunk(
32759
+ finalSource ? undefined : chunk,
32760
+ generatedLine,
32761
+ generatedColumn,
32762
+ sourceIndex,
32763
+ originalLine,
32764
+ originalColumn,
32765
+ nameIndex
32766
+ );
32767
+ },
32768
+ (sourceIndex, source, sourceContent) => {
32769
+ while (sources.length < sourceIndex) {
32770
+ sources.push(null);
32771
+ }
32772
+ sources[sourceIndex] = source;
32773
+ if (sourceContent !== undefined) {
32774
+ while (sourcesContent.length < sourceIndex) {
32775
+ sourcesContent.push(null);
32776
+ }
32777
+ sourcesContent[sourceIndex] = sourceContent;
32778
+ }
32779
+ return onSource(sourceIndex, source, sourceContent);
32780
+ },
32781
+ (nameIndex, name) => {
32782
+ while (names.length < nameIndex) {
32783
+ names.push(null);
32784
+ }
32785
+ names[nameIndex] = name;
32786
+ return onName(nameIndex, name);
32787
+ }
32788
+ );
32789
+ const resultSource = source !== undefined ? source : code;
32790
+ return {
32791
+ result: {
32792
+ generatedLine,
32793
+ generatedColumn,
32794
+ source: finalSource ? resultSource : undefined
32795
+ },
32796
+ source: resultSource,
32797
+ map:
32798
+ mappings.length > 0
32799
+ ? {
32800
+ version: 3,
32801
+ file: "x",
32802
+ mappings,
32803
+ sources,
32804
+ sourcesContent:
32805
+ sourcesContent.length > 0 ? sourcesContent : undefined,
32806
+ names
32807
+ }
32808
+ : null
32809
+ };
32810
+ };
32811
+
32812
+ streamAndGetSourceAndMap_1 = streamAndGetSourceAndMap;
32813
+ return streamAndGetSourceAndMap_1;
32814
+ }
32815
+
32816
+ /*
32817
+ MIT License http://www.opensource.org/licenses/mit-license.php
32818
+ Author Tobias Koppers @sokra
32819
+ */
32820
+
32821
+ var CachedSource_1;
32822
+ var hasRequiredCachedSource;
32823
+
32824
+ function requireCachedSource () {
32825
+ if (hasRequiredCachedSource) return CachedSource_1;
32826
+ hasRequiredCachedSource = 1;
32827
+
32828
+ const Source = requireSource();
32829
+ const streamChunksOfSourceMap = requireStreamChunksOfSourceMap();
32830
+ const streamChunksOfRawSource = requireStreamChunksOfRawSource();
32831
+ const streamAndGetSourceAndMap = requireStreamAndGetSourceAndMap();
32832
+
32833
+ const mapToBufferedMap = map => {
32834
+ if (typeof map !== "object" || !map) return map;
32835
+ const bufferedMap = Object.assign({}, map);
32836
+ if (map.mappings) {
32837
+ bufferedMap.mappings = Buffer.from(map.mappings, "utf-8");
32838
+ }
32839
+ if (map.sourcesContent) {
32840
+ bufferedMap.sourcesContent = map.sourcesContent.map(
32841
+ str => str && Buffer.from(str, "utf-8")
32842
+ );
32843
+ }
32844
+ return bufferedMap;
32845
+ };
32846
+
32847
+ const bufferedMapToMap = bufferedMap => {
32848
+ if (typeof bufferedMap !== "object" || !bufferedMap) return bufferedMap;
32849
+ const map = Object.assign({}, bufferedMap);
32850
+ if (bufferedMap.mappings) {
32851
+ map.mappings = bufferedMap.mappings.toString("utf-8");
32852
+ }
32853
+ if (bufferedMap.sourcesContent) {
32854
+ map.sourcesContent = bufferedMap.sourcesContent.map(
32855
+ buffer => buffer && buffer.toString("utf-8")
32856
+ );
32857
+ }
32858
+ return map;
32859
+ };
32860
+
32861
+ class CachedSource extends Source {
32862
+ constructor(source, cachedData) {
32863
+ super();
32864
+ this._source = source;
32865
+ this._cachedSourceType = cachedData ? cachedData.source : undefined;
32866
+ this._cachedSource = undefined;
32867
+ this._cachedBuffer = cachedData ? cachedData.buffer : undefined;
32868
+ this._cachedSize = cachedData ? cachedData.size : undefined;
32869
+ this._cachedMaps = cachedData ? cachedData.maps : new Map();
32870
+ this._cachedHashUpdate = cachedData ? cachedData.hash : undefined;
32871
+ }
32872
+
32873
+ getCachedData() {
32874
+ const bufferedMaps = new Map();
32875
+ for (const pair of this._cachedMaps) {
32876
+ let cacheEntry = pair[1];
32877
+ if (cacheEntry.bufferedMap === undefined) {
32878
+ cacheEntry.bufferedMap = mapToBufferedMap(
32879
+ this._getMapFromCacheEntry(cacheEntry)
32880
+ );
32881
+ }
32882
+ bufferedMaps.set(pair[0], {
32883
+ map: undefined,
32884
+ bufferedMap: cacheEntry.bufferedMap
32885
+ });
32886
+ }
32887
+ // We don't want to cache strings
32888
+ // So if we have a caches sources
32889
+ // create a buffer from it and only store
32890
+ // if it was a Buffer or string
32891
+ if (this._cachedSource) {
32892
+ this.buffer();
32893
+ }
32894
+ return {
32895
+ buffer: this._cachedBuffer,
32896
+ source:
32897
+ this._cachedSourceType !== undefined
32898
+ ? this._cachedSourceType
32899
+ : typeof this._cachedSource === "string"
32900
+ ? true
32901
+ : Buffer.isBuffer(this._cachedSource)
32902
+ ? false
32903
+ : undefined,
32904
+ size: this._cachedSize,
32905
+ maps: bufferedMaps,
32906
+ hash: this._cachedHashUpdate
32907
+ };
32908
+ }
32909
+
32910
+ originalLazy() {
32911
+ return this._source;
32912
+ }
32913
+
32914
+ original() {
32915
+ if (typeof this._source === "function") this._source = this._source();
32916
+ return this._source;
32917
+ }
32918
+
32919
+ source() {
32920
+ const source = this._getCachedSource();
32921
+ if (source !== undefined) return source;
32922
+ return (this._cachedSource = this.original().source());
32923
+ }
32924
+
32925
+ _getMapFromCacheEntry(cacheEntry) {
32926
+ if (cacheEntry.map !== undefined) {
32927
+ return cacheEntry.map;
32928
+ } else if (cacheEntry.bufferedMap !== undefined) {
32929
+ return (cacheEntry.map = bufferedMapToMap(cacheEntry.bufferedMap));
32930
+ }
32931
+ }
32932
+
32933
+ _getCachedSource() {
32934
+ if (this._cachedSource !== undefined) return this._cachedSource;
32935
+ if (this._cachedBuffer && this._cachedSourceType !== undefined) {
32936
+ return (this._cachedSource = this._cachedSourceType
32937
+ ? this._cachedBuffer.toString("utf-8")
32938
+ : this._cachedBuffer);
32939
+ }
32940
+ }
32941
+
32942
+ buffer() {
32943
+ if (this._cachedBuffer !== undefined) return this._cachedBuffer;
32944
+ if (this._cachedSource !== undefined) {
32945
+ if (Buffer.isBuffer(this._cachedSource)) {
32946
+ return (this._cachedBuffer = this._cachedSource);
32947
+ }
32948
+ return (this._cachedBuffer = Buffer.from(this._cachedSource, "utf-8"));
32949
+ }
32950
+ if (typeof this.original().buffer === "function") {
32951
+ return (this._cachedBuffer = this.original().buffer());
32952
+ }
32953
+ const bufferOrString = this.source();
32954
+ if (Buffer.isBuffer(bufferOrString)) {
32955
+ return (this._cachedBuffer = bufferOrString);
32956
+ }
32957
+ return (this._cachedBuffer = Buffer.from(bufferOrString, "utf-8"));
32958
+ }
32959
+
32960
+ size() {
32961
+ if (this._cachedSize !== undefined) return this._cachedSize;
32962
+ if (this._cachedBuffer !== undefined) {
32963
+ return (this._cachedSize = this._cachedBuffer.length);
32964
+ }
32965
+ const source = this._getCachedSource();
32966
+ if (source !== undefined) {
32967
+ return (this._cachedSize = Buffer.byteLength(source));
32968
+ }
32969
+ return (this._cachedSize = this.original().size());
32970
+ }
32971
+
32972
+ sourceAndMap(options) {
32973
+ const key = options ? JSON.stringify(options) : "{}";
32974
+ const cacheEntry = this._cachedMaps.get(key);
32975
+ // Look for a cached map
32976
+ if (cacheEntry !== undefined) {
32977
+ // We have a cached map in some representation
32978
+ const map = this._getMapFromCacheEntry(cacheEntry);
32979
+ // Either get the cached source or compute it
32980
+ return { source: this.source(), map };
32981
+ }
32982
+ // Look for a cached source
32983
+ let source = this._getCachedSource();
32984
+ // Compute the map
32985
+ let map;
32986
+ if (source !== undefined) {
32987
+ map = this.original().map(options);
32988
+ } else {
32989
+ // Compute the source and map together.
32990
+ const sourceAndMap = this.original().sourceAndMap(options);
32991
+ source = sourceAndMap.source;
32992
+ map = sourceAndMap.map;
32993
+ this._cachedSource = source;
32994
+ }
32995
+ this._cachedMaps.set(key, {
32996
+ map,
32997
+ bufferedMap: undefined
32998
+ });
32999
+ return { source, map };
33000
+ }
33001
+
33002
+ streamChunks(options, onChunk, onSource, onName) {
33003
+ const key = options ? JSON.stringify(options) : "{}";
33004
+ if (
33005
+ this._cachedMaps.has(key) &&
33006
+ (this._cachedBuffer !== undefined || this._cachedSource !== undefined)
33007
+ ) {
33008
+ const { source, map } = this.sourceAndMap(options);
33009
+ if (map) {
33010
+ return streamChunksOfSourceMap(
33011
+ source,
33012
+ map,
33013
+ onChunk,
33014
+ onSource,
33015
+ onName,
33016
+ !!(options && options.finalSource),
33017
+ true
33018
+ );
33019
+ } else {
33020
+ return streamChunksOfRawSource(
33021
+ source,
33022
+ onChunk,
33023
+ onSource,
33024
+ onName,
33025
+ !!(options && options.finalSource)
33026
+ );
33027
+ }
33028
+ }
33029
+ const { result, source, map } = streamAndGetSourceAndMap(
33030
+ this.original(),
33031
+ options,
33032
+ onChunk,
33033
+ onSource,
33034
+ onName
33035
+ );
33036
+ this._cachedSource = source;
33037
+ this._cachedMaps.set(key, {
33038
+ map,
33039
+ bufferedMap: undefined
33040
+ });
33041
+ return result;
33042
+ }
33043
+
33044
+ map(options) {
33045
+ const key = options ? JSON.stringify(options) : "{}";
33046
+ const cacheEntry = this._cachedMaps.get(key);
33047
+ if (cacheEntry !== undefined) {
33048
+ return this._getMapFromCacheEntry(cacheEntry);
33049
+ }
33050
+ const map = this.original().map(options);
33051
+ this._cachedMaps.set(key, {
33052
+ map,
33053
+ bufferedMap: undefined
33054
+ });
33055
+ return map;
33056
+ }
33057
+
33058
+ updateHash(hash) {
33059
+ if (this._cachedHashUpdate !== undefined) {
33060
+ for (const item of this._cachedHashUpdate) hash.update(item);
33061
+ return;
33062
+ }
33063
+ const update = [];
33064
+ let currentString = undefined;
33065
+ const tracker = {
33066
+ update: item => {
33067
+ if (typeof item === "string" && item.length < 10240) {
33068
+ if (currentString === undefined) {
33069
+ currentString = item;
33070
+ } else {
33071
+ currentString += item;
33072
+ if (currentString.length > 102400) {
33073
+ update.push(Buffer.from(currentString));
33074
+ currentString = undefined;
33075
+ }
33076
+ }
33077
+ } else {
33078
+ if (currentString !== undefined) {
33079
+ update.push(Buffer.from(currentString));
33080
+ currentString = undefined;
33081
+ }
33082
+ update.push(item);
33083
+ }
33084
+ }
33085
+ };
33086
+ this.original().updateHash(tracker);
33087
+ if (currentString !== undefined) {
33088
+ update.push(Buffer.from(currentString));
33089
+ }
33090
+ for (const item of update) hash.update(item);
33091
+ this._cachedHashUpdate = update;
33092
+ }
33093
+ }
33094
+
33095
+ CachedSource_1 = CachedSource;
33096
+ return CachedSource_1;
33097
+ }
33098
+
33099
+ /*
33100
+ MIT License http://www.opensource.org/licenses/mit-license.php
33101
+ Author Tobias Koppers @sokra
33102
+ */
33103
+
33104
+ var ConcatSource_1;
33105
+ var hasRequiredConcatSource;
33106
+
33107
+ function requireConcatSource () {
33108
+ if (hasRequiredConcatSource) return ConcatSource_1;
33109
+ hasRequiredConcatSource = 1;
33110
+
33111
+ const Source = requireSource();
33112
+ const RawSource = requireRawSource();
33113
+ const streamChunks = requireStreamChunks();
33114
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
33115
+
33116
+ const stringsAsRawSources = new WeakSet();
33117
+
33118
+ class ConcatSource extends Source {
33119
+ constructor() {
33120
+ super();
33121
+ this._children = [];
33122
+ for (let i = 0; i < arguments.length; i++) {
33123
+ const item = arguments[i];
33124
+ if (item instanceof ConcatSource) {
33125
+ for (const child of item._children) {
33126
+ this._children.push(child);
33127
+ }
33128
+ } else {
33129
+ this._children.push(item);
33130
+ }
33131
+ }
33132
+ this._isOptimized = arguments.length === 0;
33133
+ }
33134
+
33135
+ getChildren() {
33136
+ if (!this._isOptimized) this._optimize();
33137
+ return this._children;
33138
+ }
33139
+
33140
+ add(item) {
33141
+ if (item instanceof ConcatSource) {
33142
+ for (const child of item._children) {
33143
+ this._children.push(child);
33144
+ }
33145
+ } else {
33146
+ this._children.push(item);
33147
+ }
33148
+ this._isOptimized = false;
33149
+ }
33150
+
33151
+ addAllSkipOptimizing(items) {
33152
+ for (const item of items) {
33153
+ this._children.push(item);
33154
+ }
33155
+ }
33156
+
33157
+ buffer() {
33158
+ if (!this._isOptimized) this._optimize();
33159
+ const buffers = [];
33160
+ for (const child of this._children) {
33161
+ if (typeof child.buffer === "function") {
33162
+ buffers.push(child.buffer());
33163
+ } else {
33164
+ const bufferOrString = child.source();
33165
+ if (Buffer.isBuffer(bufferOrString)) {
33166
+ buffers.push(bufferOrString);
33167
+ } else {
33168
+ // This will not happen
33169
+ buffers.push(Buffer.from(bufferOrString, "utf-8"));
33170
+ }
33171
+ }
33172
+ }
33173
+ return Buffer.concat(buffers);
33174
+ }
33175
+
33176
+ source() {
33177
+ if (!this._isOptimized) this._optimize();
33178
+ let source = "";
33179
+ for (const child of this._children) {
33180
+ source += child.source();
33181
+ }
33182
+ return source;
33183
+ }
33184
+
33185
+ size() {
33186
+ if (!this._isOptimized) this._optimize();
33187
+ let size = 0;
33188
+ for (const child of this._children) {
33189
+ size += child.size();
33190
+ }
33191
+ return size;
33192
+ }
33193
+
33194
+ map(options) {
33195
+ return getMap(this, options);
33196
+ }
33197
+
33198
+ sourceAndMap(options) {
33199
+ return getSourceAndMap(this, options);
33200
+ }
33201
+
33202
+ streamChunks(options, onChunk, onSource, onName) {
33203
+ if (!this._isOptimized) this._optimize();
33204
+ if (this._children.length === 1)
33205
+ return this._children[0].streamChunks(options, onChunk, onSource, onName);
33206
+ let currentLineOffset = 0;
33207
+ let currentColumnOffset = 0;
33208
+ let sourceMapping = new Map();
33209
+ let nameMapping = new Map();
33210
+ const finalSource = !!(options && options.finalSource);
33211
+ let code = "";
33212
+ let needToCloseMapping = false;
33213
+ for (const item of this._children) {
33214
+ const sourceIndexMapping = [];
33215
+ const nameIndexMapping = [];
33216
+ let lastMappingLine = 0;
33217
+ const { generatedLine, generatedColumn, source } = streamChunks(
33218
+ item,
33219
+ options,
33220
+ // eslint-disable-next-line no-loop-func
33221
+ (
33222
+ chunk,
33223
+ generatedLine,
33224
+ generatedColumn,
33225
+ sourceIndex,
33226
+ originalLine,
33227
+ originalColumn,
33228
+ nameIndex
33229
+ ) => {
33230
+ const line = generatedLine + currentLineOffset;
33231
+ const column =
33232
+ generatedLine === 1
33233
+ ? generatedColumn + currentColumnOffset
33234
+ : generatedColumn;
33235
+ if (needToCloseMapping) {
33236
+ if (generatedLine !== 1 || generatedColumn !== 0) {
33237
+ onChunk(
33238
+ undefined,
33239
+ currentLineOffset + 1,
33240
+ currentColumnOffset,
33241
+ -1,
33242
+ -1,
33243
+ -1,
33244
+ -1
33245
+ );
33246
+ }
33247
+ needToCloseMapping = false;
33248
+ }
33249
+ const resultSourceIndex =
33250
+ sourceIndex < 0 || sourceIndex >= sourceIndexMapping.length
33251
+ ? -1
33252
+ : sourceIndexMapping[sourceIndex];
33253
+ const resultNameIndex =
33254
+ nameIndex < 0 || nameIndex >= nameIndexMapping.length
33255
+ ? -1
33256
+ : nameIndexMapping[nameIndex];
33257
+ lastMappingLine = resultSourceIndex < 0 ? 0 : generatedLine;
33258
+ if (finalSource) {
33259
+ if (chunk !== undefined) code += chunk;
33260
+ if (resultSourceIndex >= 0) {
33261
+ onChunk(
33262
+ undefined,
33263
+ line,
33264
+ column,
33265
+ resultSourceIndex,
33266
+ originalLine,
33267
+ originalColumn,
33268
+ resultNameIndex
33269
+ );
33270
+ }
33271
+ } else {
33272
+ if (resultSourceIndex < 0) {
33273
+ onChunk(chunk, line, column, -1, -1, -1, -1);
33274
+ } else {
33275
+ onChunk(
33276
+ chunk,
33277
+ line,
33278
+ column,
33279
+ resultSourceIndex,
33280
+ originalLine,
33281
+ originalColumn,
33282
+ resultNameIndex
33283
+ );
33284
+ }
33285
+ }
33286
+ },
33287
+ (i, source, sourceContent) => {
33288
+ let globalIndex = sourceMapping.get(source);
33289
+ if (globalIndex === undefined) {
33290
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
33291
+ onSource(globalIndex, source, sourceContent);
33292
+ }
33293
+ sourceIndexMapping[i] = globalIndex;
33294
+ },
33295
+ (i, name) => {
33296
+ let globalIndex = nameMapping.get(name);
33297
+ if (globalIndex === undefined) {
33298
+ nameMapping.set(name, (globalIndex = nameMapping.size));
33299
+ onName(globalIndex, name);
33300
+ }
33301
+ nameIndexMapping[i] = globalIndex;
33302
+ }
33303
+ );
33304
+ if (source !== undefined) code += source;
33305
+ if (needToCloseMapping) {
33306
+ if (generatedLine !== 1 || generatedColumn !== 0) {
33307
+ onChunk(
33308
+ undefined,
33309
+ currentLineOffset + 1,
33310
+ currentColumnOffset,
33311
+ -1,
33312
+ -1,
33313
+ -1,
33314
+ -1
33315
+ );
33316
+ needToCloseMapping = false;
33317
+ }
33318
+ }
33319
+ if (generatedLine > 1) {
33320
+ currentColumnOffset = generatedColumn;
33321
+ } else {
33322
+ currentColumnOffset += generatedColumn;
33323
+ }
33324
+ needToCloseMapping =
33325
+ needToCloseMapping ||
33326
+ (finalSource && lastMappingLine === generatedLine);
33327
+ currentLineOffset += generatedLine - 1;
33328
+ }
33329
+ return {
33330
+ generatedLine: currentLineOffset + 1,
33331
+ generatedColumn: currentColumnOffset,
33332
+ source: finalSource ? code : undefined
33333
+ };
33334
+ }
33335
+
33336
+ updateHash(hash) {
33337
+ if (!this._isOptimized) this._optimize();
33338
+ hash.update("ConcatSource");
33339
+ for (const item of this._children) {
33340
+ item.updateHash(hash);
33341
+ }
33342
+ }
33343
+
33344
+ _optimize() {
33345
+ const newChildren = [];
33346
+ let currentString = undefined;
33347
+ let currentRawSources = undefined;
33348
+ const addStringToRawSources = string => {
33349
+ if (currentRawSources === undefined) {
33350
+ currentRawSources = string;
33351
+ } else if (Array.isArray(currentRawSources)) {
33352
+ currentRawSources.push(string);
33353
+ } else {
33354
+ currentRawSources = [
33355
+ typeof currentRawSources === "string"
33356
+ ? currentRawSources
33357
+ : currentRawSources.source(),
33358
+ string
33359
+ ];
33360
+ }
33361
+ };
33362
+ const addSourceToRawSources = source => {
33363
+ if (currentRawSources === undefined) {
33364
+ currentRawSources = source;
33365
+ } else if (Array.isArray(currentRawSources)) {
33366
+ currentRawSources.push(source.source());
33367
+ } else {
33368
+ currentRawSources = [
33369
+ typeof currentRawSources === "string"
33370
+ ? currentRawSources
33371
+ : currentRawSources.source(),
33372
+ source.source()
33373
+ ];
33374
+ }
33375
+ };
33376
+ const mergeRawSources = () => {
33377
+ if (Array.isArray(currentRawSources)) {
33378
+ const rawSource = new RawSource(currentRawSources.join(""));
33379
+ stringsAsRawSources.add(rawSource);
33380
+ newChildren.push(rawSource);
33381
+ } else if (typeof currentRawSources === "string") {
33382
+ const rawSource = new RawSource(currentRawSources);
33383
+ stringsAsRawSources.add(rawSource);
33384
+ newChildren.push(rawSource);
33385
+ } else {
33386
+ newChildren.push(currentRawSources);
33387
+ }
33388
+ };
33389
+ for (const child of this._children) {
33390
+ if (typeof child === "string") {
33391
+ if (currentString === undefined) {
33392
+ currentString = child;
33393
+ } else {
33394
+ currentString += child;
33395
+ }
33396
+ } else {
33397
+ if (currentString !== undefined) {
33398
+ addStringToRawSources(currentString);
33399
+ currentString = undefined;
33400
+ }
33401
+ if (stringsAsRawSources.has(child)) {
33402
+ addSourceToRawSources(child);
33403
+ } else {
33404
+ if (currentRawSources !== undefined) {
33405
+ mergeRawSources();
33406
+ currentRawSources = undefined;
33407
+ }
33408
+ newChildren.push(child);
33409
+ }
33410
+ }
33411
+ }
33412
+ if (currentString !== undefined) {
33413
+ addStringToRawSources(currentString);
33414
+ }
33415
+ if (currentRawSources !== undefined) {
33416
+ mergeRawSources();
33417
+ }
33418
+ this._children = newChildren;
33419
+ this._isOptimized = true;
33420
+ }
33421
+ }
33422
+
33423
+ ConcatSource_1 = ConcatSource;
33424
+ return ConcatSource_1;
33425
+ }
33426
+
33427
+ /*
33428
+ MIT License http://www.opensource.org/licenses/mit-license.php
33429
+ Author Tobias Koppers @sokra
33430
+ */
33431
+
33432
+ var ReplaceSource_1;
33433
+ var hasRequiredReplaceSource;
33434
+
33435
+ function requireReplaceSource () {
33436
+ if (hasRequiredReplaceSource) return ReplaceSource_1;
33437
+ hasRequiredReplaceSource = 1;
33438
+
33439
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
33440
+ const streamChunks = requireStreamChunks();
33441
+ const Source = requireSource();
33442
+ const splitIntoLines = requireSplitIntoLines();
33443
+
33444
+ // since v8 7.0, Array.prototype.sort is stable
33445
+ const hasStableSort =
33446
+ typeof process === "object" &&
33447
+ process.versions &&
33448
+ typeof process.versions.v8 === "string" &&
33449
+ !/^[0-6]\./.test(process.versions.v8);
33450
+
33451
+ // This is larger than max string length
33452
+ const MAX_SOURCE_POSITION = 0x20000000;
33453
+
33454
+ class Replacement {
33455
+ constructor(start, end, content, name) {
33456
+ this.start = start;
33457
+ this.end = end;
33458
+ this.content = content;
33459
+ this.name = name;
33460
+ if (!hasStableSort) {
33461
+ this.index = -1;
33462
+ }
33463
+ }
33464
+ }
33465
+
33466
+ class ReplaceSource extends Source {
33467
+ constructor(source, name) {
33468
+ super();
33469
+ this._source = source;
33470
+ this._name = name;
33471
+ /** @type {Replacement[]} */
33472
+ this._replacements = [];
33473
+ this._isSorted = true;
33474
+ }
33475
+
33476
+ getName() {
33477
+ return this._name;
33478
+ }
33479
+
33480
+ getReplacements() {
33481
+ this._sortReplacements();
33482
+ return this._replacements;
33483
+ }
33484
+
33485
+ replace(start, end, newValue, name) {
33486
+ if (typeof newValue !== "string")
33487
+ throw new Error(
33488
+ "insertion must be a string, but is a " + typeof newValue
33489
+ );
33490
+ this._replacements.push(new Replacement(start, end, newValue, name));
33491
+ this._isSorted = false;
33492
+ }
33493
+
33494
+ insert(pos, newValue, name) {
33495
+ if (typeof newValue !== "string")
33496
+ throw new Error(
33497
+ "insertion must be a string, but is a " +
33498
+ typeof newValue +
33499
+ ": " +
33500
+ newValue
33501
+ );
33502
+ this._replacements.push(new Replacement(pos, pos - 1, newValue, name));
33503
+ this._isSorted = false;
33504
+ }
33505
+
33506
+ source() {
33507
+ if (this._replacements.length === 0) {
33508
+ return this._source.source();
33509
+ }
33510
+ let current = this._source.source();
33511
+ let pos = 0;
33512
+ const result = [];
33513
+
33514
+ this._sortReplacements();
33515
+ for (const replacement of this._replacements) {
33516
+ const start = Math.floor(replacement.start);
33517
+ const end = Math.floor(replacement.end + 1);
33518
+ if (pos < start) {
33519
+ const offset = start - pos;
33520
+ result.push(current.slice(0, offset));
33521
+ current = current.slice(offset);
33522
+ pos = start;
33523
+ }
33524
+ result.push(replacement.content);
33525
+ if (pos < end) {
33526
+ const offset = end - pos;
33527
+ current = current.slice(offset);
33528
+ pos = end;
33529
+ }
33530
+ }
33531
+ result.push(current);
33532
+ return result.join("");
33533
+ }
33534
+
33535
+ map(options) {
33536
+ if (this._replacements.length === 0) {
33537
+ return this._source.map(options);
33538
+ }
33539
+ return getMap(this, options);
33540
+ }
33541
+
33542
+ sourceAndMap(options) {
33543
+ if (this._replacements.length === 0) {
33544
+ return this._source.sourceAndMap(options);
33545
+ }
33546
+ return getSourceAndMap(this, options);
33547
+ }
33548
+
33549
+ original() {
33550
+ return this._source;
33551
+ }
33552
+
33553
+ _sortReplacements() {
33554
+ if (this._isSorted) return;
33555
+ if (hasStableSort) {
33556
+ this._replacements.sort(function (a, b) {
33557
+ const diff1 = a.start - b.start;
33558
+ if (diff1 !== 0) return diff1;
33559
+ const diff2 = a.end - b.end;
33560
+ if (diff2 !== 0) return diff2;
33561
+ return 0;
33562
+ });
33563
+ } else {
33564
+ this._replacements.forEach((repl, i) => (repl.index = i));
33565
+ this._replacements.sort(function (a, b) {
33566
+ const diff1 = a.start - b.start;
33567
+ if (diff1 !== 0) return diff1;
33568
+ const diff2 = a.end - b.end;
33569
+ if (diff2 !== 0) return diff2;
33570
+ return a.index - b.index;
33571
+ });
33572
+ }
33573
+ this._isSorted = true;
33574
+ }
33575
+
33576
+ streamChunks(options, onChunk, onSource, onName) {
33577
+ this._sortReplacements();
33578
+ const repls = this._replacements;
33579
+ let pos = 0;
33580
+ let i = 0;
33581
+ let replacmentEnd = -1;
33582
+ let nextReplacement =
33583
+ i < repls.length ? Math.floor(repls[i].start) : MAX_SOURCE_POSITION;
33584
+ let generatedLineOffset = 0;
33585
+ let generatedColumnOffset = 0;
33586
+ let generatedColumnOffsetLine = 0;
33587
+ const sourceContents = [];
33588
+ const nameMapping = new Map();
33589
+ const nameIndexMapping = [];
33590
+ const checkOriginalContent = (sourceIndex, line, column, expectedChunk) => {
33591
+ let content =
33592
+ sourceIndex < sourceContents.length
33593
+ ? sourceContents[sourceIndex]
33594
+ : undefined;
33595
+ if (content === undefined) return false;
33596
+ if (typeof content === "string") {
33597
+ content = splitIntoLines(content);
33598
+ sourceContents[sourceIndex] = content;
33599
+ }
33600
+ const contentLine = line <= content.length ? content[line - 1] : null;
33601
+ if (contentLine === null) return false;
33602
+ return (
33603
+ contentLine.slice(column, column + expectedChunk.length) ===
33604
+ expectedChunk
33605
+ );
33606
+ };
33607
+ let { generatedLine, generatedColumn } = streamChunks(
33608
+ this._source,
33609
+ Object.assign({}, options, { finalSource: false }),
33610
+ (
33611
+ chunk,
33612
+ generatedLine,
33613
+ generatedColumn,
33614
+ sourceIndex,
33615
+ originalLine,
33616
+ originalColumn,
33617
+ nameIndex
33618
+ ) => {
33619
+ let chunkPos = 0;
33620
+ let endPos = pos + chunk.length;
33621
+
33622
+ // Skip over when it has been replaced
33623
+ if (replacmentEnd > pos) {
33624
+ // Skip over the whole chunk
33625
+ if (replacmentEnd >= endPos) {
33626
+ const line = generatedLine + generatedLineOffset;
33627
+ if (chunk.endsWith("\n")) {
33628
+ generatedLineOffset--;
33629
+ if (generatedColumnOffsetLine === line) {
33630
+ // undo exiting corrections form the current line
33631
+ generatedColumnOffset += generatedColumn;
33632
+ }
33633
+ } else if (generatedColumnOffsetLine === line) {
33634
+ generatedColumnOffset -= chunk.length;
33635
+ } else {
33636
+ generatedColumnOffset = -chunk.length;
33637
+ generatedColumnOffsetLine = line;
33638
+ }
33639
+ pos = endPos;
33640
+ return;
33641
+ }
33642
+
33643
+ // Partially skip over chunk
33644
+ chunkPos = replacmentEnd - pos;
33645
+ if (
33646
+ checkOriginalContent(
33647
+ sourceIndex,
33648
+ originalLine,
33649
+ originalColumn,
33650
+ chunk.slice(0, chunkPos)
33651
+ )
33652
+ ) {
33653
+ originalColumn += chunkPos;
33654
+ }
33655
+ pos += chunkPos;
33656
+ const line = generatedLine + generatedLineOffset;
33657
+ if (generatedColumnOffsetLine === line) {
33658
+ generatedColumnOffset -= chunkPos;
33659
+ } else {
33660
+ generatedColumnOffset = -chunkPos;
33661
+ generatedColumnOffsetLine = line;
33662
+ }
33663
+ generatedColumn += chunkPos;
33664
+ }
33665
+
33666
+ // Is a replacement in the chunk?
33667
+ if (nextReplacement < endPos) {
33668
+ do {
33669
+ let line = generatedLine + generatedLineOffset;
33670
+ if (nextReplacement > pos) {
33671
+ // Emit chunk until replacement
33672
+ const offset = nextReplacement - pos;
33673
+ const chunkSlice = chunk.slice(chunkPos, chunkPos + offset);
33674
+ onChunk(
33675
+ chunkSlice,
33676
+ line,
33677
+ generatedColumn +
33678
+ (line === generatedColumnOffsetLine
33679
+ ? generatedColumnOffset
33680
+ : 0),
33681
+ sourceIndex,
33682
+ originalLine,
33683
+ originalColumn,
33684
+ nameIndex < 0 || nameIndex >= nameIndexMapping.length
33685
+ ? -1
33686
+ : nameIndexMapping[nameIndex]
33687
+ );
33688
+ generatedColumn += offset;
33689
+ chunkPos += offset;
33690
+ pos = nextReplacement;
33691
+ if (
33692
+ checkOriginalContent(
33693
+ sourceIndex,
33694
+ originalLine,
33695
+ originalColumn,
33696
+ chunkSlice
33697
+ )
33698
+ ) {
33699
+ originalColumn += chunkSlice.length;
33700
+ }
33701
+ }
33702
+
33703
+ // Insert replacement content splitted into chunks by lines
33704
+ const { content, name } = repls[i];
33705
+ let matches = splitIntoLines(content);
33706
+ let replacementNameIndex = nameIndex;
33707
+ if (sourceIndex >= 0 && name) {
33708
+ let globalIndex = nameMapping.get(name);
33709
+ if (globalIndex === undefined) {
33710
+ globalIndex = nameMapping.size;
33711
+ nameMapping.set(name, globalIndex);
33712
+ onName(globalIndex, name);
33713
+ }
33714
+ replacementNameIndex = globalIndex;
33715
+ }
33716
+ for (let m = 0; m < matches.length; m++) {
33717
+ const contentLine = matches[m];
33718
+ onChunk(
33719
+ contentLine,
33720
+ line,
33721
+ generatedColumn +
33722
+ (line === generatedColumnOffsetLine
33723
+ ? generatedColumnOffset
33724
+ : 0),
33725
+ sourceIndex,
33726
+ originalLine,
33727
+ originalColumn,
33728
+ replacementNameIndex
33729
+ );
33730
+
33731
+ // Only the first chunk has name assigned
33732
+ replacementNameIndex = -1;
33733
+
33734
+ if (m === matches.length - 1 && !contentLine.endsWith("\n")) {
33735
+ if (generatedColumnOffsetLine === line) {
33736
+ generatedColumnOffset += contentLine.length;
33737
+ } else {
33738
+ generatedColumnOffset = contentLine.length;
33739
+ generatedColumnOffsetLine = line;
33740
+ }
33741
+ } else {
33742
+ generatedLineOffset++;
33743
+ line++;
33744
+ generatedColumnOffset = -generatedColumn;
33745
+ generatedColumnOffsetLine = line;
33746
+ }
33747
+ }
33748
+
33749
+ // Remove replaced content by settings this variable
33750
+ replacmentEnd = Math.max(
33751
+ replacmentEnd,
33752
+ Math.floor(repls[i].end + 1)
33753
+ );
33754
+
33755
+ // Move to next replacment
33756
+ i++;
33757
+ nextReplacement =
33758
+ i < repls.length
33759
+ ? Math.floor(repls[i].start)
33760
+ : MAX_SOURCE_POSITION;
33761
+
33762
+ // Skip over when it has been replaced
33763
+ const offset = chunk.length - endPos + replacmentEnd - chunkPos;
33764
+ if (offset > 0) {
33765
+ // Skip over whole chunk
33766
+ if (replacmentEnd >= endPos) {
33767
+ let line = generatedLine + generatedLineOffset;
33768
+ if (chunk.endsWith("\n")) {
33769
+ generatedLineOffset--;
33770
+ if (generatedColumnOffsetLine === line) {
33771
+ // undo exiting corrections form the current line
33772
+ generatedColumnOffset += generatedColumn;
33773
+ }
33774
+ } else if (generatedColumnOffsetLine === line) {
33775
+ generatedColumnOffset -= chunk.length - chunkPos;
33776
+ } else {
33777
+ generatedColumnOffset = chunkPos - chunk.length;
33778
+ generatedColumnOffsetLine = line;
33779
+ }
33780
+ pos = endPos;
33781
+ return;
33782
+ }
33783
+
33784
+ // Partially skip over chunk
33785
+ const line = generatedLine + generatedLineOffset;
33786
+ if (
33787
+ checkOriginalContent(
33788
+ sourceIndex,
33789
+ originalLine,
33790
+ originalColumn,
33791
+ chunk.slice(chunkPos, chunkPos + offset)
33792
+ )
33793
+ ) {
33794
+ originalColumn += offset;
33795
+ }
33796
+ chunkPos += offset;
33797
+ pos += offset;
33798
+ if (generatedColumnOffsetLine === line) {
33799
+ generatedColumnOffset -= offset;
33800
+ } else {
33801
+ generatedColumnOffset = -offset;
33802
+ generatedColumnOffsetLine = line;
33803
+ }
33804
+ generatedColumn += offset;
33805
+ }
33806
+ } while (nextReplacement < endPos);
33807
+ }
33808
+
33809
+ // Emit remaining chunk
33810
+ if (chunkPos < chunk.length) {
33811
+ const chunkSlice = chunkPos === 0 ? chunk : chunk.slice(chunkPos);
33812
+ const line = generatedLine + generatedLineOffset;
33813
+ onChunk(
33814
+ chunkSlice,
33815
+ line,
33816
+ generatedColumn +
33817
+ (line === generatedColumnOffsetLine ? generatedColumnOffset : 0),
33818
+ sourceIndex,
33819
+ originalLine,
33820
+ originalColumn,
33821
+ nameIndex < 0 ? -1 : nameIndexMapping[nameIndex]
33822
+ );
33823
+ }
33824
+ pos = endPos;
33825
+ },
33826
+ (sourceIndex, source, sourceContent) => {
33827
+ while (sourceContents.length < sourceIndex)
33828
+ sourceContents.push(undefined);
33829
+ sourceContents[sourceIndex] = sourceContent;
33830
+ onSource(sourceIndex, source, sourceContent);
33831
+ },
33832
+ (nameIndex, name) => {
33833
+ let globalIndex = nameMapping.get(name);
33834
+ if (globalIndex === undefined) {
33835
+ globalIndex = nameMapping.size;
33836
+ nameMapping.set(name, globalIndex);
33837
+ onName(globalIndex, name);
33838
+ }
33839
+ nameIndexMapping[nameIndex] = globalIndex;
33840
+ }
33841
+ );
33842
+
33843
+ // Handle remaining replacements
33844
+ let remainer = "";
33845
+ for (; i < repls.length; i++) {
33846
+ remainer += repls[i].content;
33847
+ }
33848
+
33849
+ // Insert remaining replacements content splitted into chunks by lines
33850
+ let line = generatedLine + generatedLineOffset;
33851
+ let matches = splitIntoLines(remainer);
33852
+ for (let m = 0; m < matches.length; m++) {
33853
+ const contentLine = matches[m];
33854
+ onChunk(
33855
+ contentLine,
33856
+ line,
33857
+ generatedColumn +
33858
+ (line === generatedColumnOffsetLine ? generatedColumnOffset : 0),
33859
+ -1,
33860
+ -1,
33861
+ -1,
33862
+ -1
33863
+ );
33864
+
33865
+ if (m === matches.length - 1 && !contentLine.endsWith("\n")) {
33866
+ if (generatedColumnOffsetLine === line) {
33867
+ generatedColumnOffset += contentLine.length;
33868
+ } else {
33869
+ generatedColumnOffset = contentLine.length;
33870
+ generatedColumnOffsetLine = line;
33871
+ }
33872
+ } else {
33873
+ generatedLineOffset++;
33874
+ line++;
33875
+ generatedColumnOffset = -generatedColumn;
33876
+ generatedColumnOffsetLine = line;
33877
+ }
33878
+ }
33879
+
33880
+ return {
33881
+ generatedLine: line,
33882
+ generatedColumn:
33883
+ generatedColumn +
33884
+ (line === generatedColumnOffsetLine ? generatedColumnOffset : 0)
33885
+ };
33886
+ }
33887
+
33888
+ updateHash(hash) {
33889
+ this._sortReplacements();
33890
+ hash.update("ReplaceSource");
33891
+ this._source.updateHash(hash);
33892
+ hash.update(this._name || "");
33893
+ for (const repl of this._replacements) {
33894
+ hash.update(`${repl.start}${repl.end}${repl.content}${repl.name}`);
33895
+ }
33896
+ }
33897
+ }
33898
+
33899
+ ReplaceSource_1 = ReplaceSource;
33900
+ return ReplaceSource_1;
33901
+ }
33902
+
33903
+ /*
33904
+ MIT License http://www.opensource.org/licenses/mit-license.php
33905
+ Author Tobias Koppers @sokra
33906
+ */
33907
+
33908
+ var PrefixSource_1;
33909
+ var hasRequiredPrefixSource;
33910
+
33911
+ function requirePrefixSource () {
33912
+ if (hasRequiredPrefixSource) return PrefixSource_1;
33913
+ hasRequiredPrefixSource = 1;
33914
+
33915
+ const Source = requireSource();
33916
+ const RawSource = requireRawSource();
33917
+ const streamChunks = requireStreamChunks();
33918
+ const { getMap, getSourceAndMap } = requireGetFromStreamChunks();
33919
+
33920
+ const REPLACE_REGEX = /\n(?=.|\s)/g;
33921
+
33922
+ class PrefixSource extends Source {
33923
+ constructor(prefix, source) {
33924
+ super();
33925
+ this._source =
33926
+ typeof source === "string" || Buffer.isBuffer(source)
33927
+ ? new RawSource(source, true)
33928
+ : source;
33929
+ this._prefix = prefix;
33930
+ }
33931
+
33932
+ getPrefix() {
33933
+ return this._prefix;
33934
+ }
33935
+
33936
+ original() {
33937
+ return this._source;
33938
+ }
33939
+
33940
+ source() {
33941
+ const node = this._source.source();
33942
+ const prefix = this._prefix;
33943
+ return prefix + node.replace(REPLACE_REGEX, "\n" + prefix);
33944
+ }
33945
+
33946
+ // TODO efficient buffer() implementation
33947
+
33948
+ map(options) {
33949
+ return getMap(this, options);
33950
+ }
33951
+
33952
+ sourceAndMap(options) {
33953
+ return getSourceAndMap(this, options);
33954
+ }
33955
+
33956
+ streamChunks(options, onChunk, onSource, onName) {
33957
+ const prefix = this._prefix;
33958
+ const prefixOffset = prefix.length;
33959
+ const linesOnly = !!(options && options.columns === false);
33960
+ const { generatedLine, generatedColumn, source } = streamChunks(
33961
+ this._source,
33962
+ options,
33963
+ (
33964
+ chunk,
33965
+ generatedLine,
33966
+ generatedColumn,
33967
+ sourceIndex,
33968
+ originalLine,
33969
+ originalColumn,
33970
+ nameIndex
33971
+ ) => {
33972
+ if (generatedColumn !== 0) {
33973
+ // In the middle of the line, we just adject the column
33974
+ generatedColumn += prefixOffset;
33975
+ } else if (chunk !== undefined) {
33976
+ // At the start of the line, when we have source content
33977
+ // add the prefix as generated mapping
33978
+ // (in lines only mode we just add it to the original mapping
33979
+ // for performance reasons)
33980
+ if (linesOnly || sourceIndex < 0) {
33981
+ chunk = prefix + chunk;
33982
+ } else if (prefixOffset > 0) {
33983
+ onChunk(prefix, generatedLine, generatedColumn, -1, -1, -1, -1);
33984
+ generatedColumn += prefixOffset;
33985
+ }
33986
+ } else if (!linesOnly) {
33987
+ // Without source content, we only need to adject the column info
33988
+ // expect in lines only mode where prefix is added to original mapping
33989
+ generatedColumn += prefixOffset;
33990
+ }
33991
+ onChunk(
33992
+ chunk,
33993
+ generatedLine,
33994
+ generatedColumn,
33995
+ sourceIndex,
33996
+ originalLine,
33997
+ originalColumn,
33998
+ nameIndex
33999
+ );
34000
+ },
34001
+ onSource,
34002
+ onName
34003
+ );
34004
+ return {
34005
+ generatedLine,
34006
+ generatedColumn:
34007
+ generatedColumn === 0 ? 0 : prefixOffset + generatedColumn,
34008
+ source:
34009
+ source !== undefined
34010
+ ? prefix + source.replace(REPLACE_REGEX, "\n" + prefix)
34011
+ : undefined
34012
+ };
34013
+ }
34014
+
34015
+ updateHash(hash) {
34016
+ hash.update("PrefixSource");
34017
+ this._source.updateHash(hash);
34018
+ hash.update(this._prefix);
34019
+ }
34020
+ }
34021
+
34022
+ PrefixSource_1 = PrefixSource;
34023
+ return PrefixSource_1;
34024
+ }
34025
+
34026
+ /*
34027
+ MIT License http://www.opensource.org/licenses/mit-license.php
34028
+ Author Tobias Koppers @sokra
34029
+ */
34030
+
34031
+ var SizeOnlySource_1;
34032
+ var hasRequiredSizeOnlySource;
34033
+
34034
+ function requireSizeOnlySource () {
34035
+ if (hasRequiredSizeOnlySource) return SizeOnlySource_1;
34036
+ hasRequiredSizeOnlySource = 1;
34037
+
34038
+ const Source = requireSource();
34039
+
34040
+ class SizeOnlySource extends Source {
34041
+ constructor(size) {
34042
+ super();
34043
+ this._size = size;
34044
+ }
34045
+
34046
+ _error() {
34047
+ return new Error(
34048
+ "Content and Map of this Source is not available (only size() is supported)"
34049
+ );
34050
+ }
34051
+
34052
+ size() {
34053
+ return this._size;
34054
+ }
34055
+
34056
+ source() {
34057
+ throw this._error();
34058
+ }
34059
+
34060
+ buffer() {
34061
+ throw this._error();
34062
+ }
34063
+
34064
+ map(options) {
34065
+ throw this._error();
34066
+ }
34067
+
34068
+ updateHash() {
34069
+ throw this._error();
34070
+ }
34071
+ }
34072
+
34073
+ SizeOnlySource_1 = SizeOnlySource;
34074
+ return SizeOnlySource_1;
34075
+ }
34076
+
34077
+ /*
34078
+ MIT License http://www.opensource.org/licenses/mit-license.php
34079
+ Author Tobias Koppers @sokra
34080
+ */
34081
+
34082
+ var CompatSource_1;
34083
+ var hasRequiredCompatSource;
34084
+
34085
+ function requireCompatSource () {
34086
+ if (hasRequiredCompatSource) return CompatSource_1;
34087
+ hasRequiredCompatSource = 1;
34088
+
34089
+ const Source = requireSource();
34090
+
34091
+ class CompatSource extends Source {
34092
+ static from(sourceLike) {
34093
+ return sourceLike instanceof Source
34094
+ ? sourceLike
34095
+ : new CompatSource(sourceLike);
34096
+ }
34097
+
34098
+ constructor(sourceLike) {
34099
+ super();
34100
+ this._sourceLike = sourceLike;
34101
+ }
34102
+
34103
+ source() {
34104
+ return this._sourceLike.source();
34105
+ }
34106
+
34107
+ buffer() {
34108
+ if (typeof this._sourceLike.buffer === "function") {
34109
+ return this._sourceLike.buffer();
34110
+ }
34111
+ return super.buffer();
34112
+ }
34113
+
34114
+ size() {
34115
+ if (typeof this._sourceLike.size === "function") {
34116
+ return this._sourceLike.size();
34117
+ }
34118
+ return super.size();
34119
+ }
34120
+
34121
+ map(options) {
34122
+ if (typeof this._sourceLike.map === "function") {
34123
+ return this._sourceLike.map(options);
34124
+ }
34125
+ return super.map(options);
34126
+ }
34127
+
34128
+ sourceAndMap(options) {
34129
+ if (typeof this._sourceLike.sourceAndMap === "function") {
34130
+ return this._sourceLike.sourceAndMap(options);
34131
+ }
34132
+ return super.sourceAndMap(options);
34133
+ }
34134
+
34135
+ updateHash(hash) {
34136
+ if (typeof this._sourceLike.updateHash === "function") {
34137
+ return this._sourceLike.updateHash(hash);
34138
+ }
34139
+ if (typeof this._sourceLike.map === "function") {
34140
+ throw new Error(
34141
+ "A Source-like object with a 'map' method must also provide an 'updateHash' method"
34142
+ );
34143
+ }
34144
+ hash.update(this.buffer());
34145
+ }
34146
+ }
34147
+
34148
+ CompatSource_1 = CompatSource;
34149
+ return CompatSource_1;
34150
+ }
34151
+
34152
+ /*
34153
+ MIT License http://www.opensource.org/licenses/mit-license.php
34154
+ Author Tobias Koppers @sokra
34155
+ */
34156
+
34157
+ (function (exports) {
34158
+ const defineExport = (name, fn) => {
34159
+ let value;
34160
+ Object.defineProperty(exports, name, {
34161
+ get: () => {
34162
+ if (fn !== undefined) {
34163
+ value = fn();
34164
+ fn = undefined;
34165
+ }
34166
+ return value;
34167
+ },
34168
+ configurable: true
34169
+ });
34170
+ };
34171
+
34172
+ defineExport("Source", () => requireSource());
34173
+
34174
+ defineExport("RawSource", () => requireRawSource());
34175
+ defineExport("OriginalSource", () => requireOriginalSource());
34176
+ defineExport("SourceMapSource", () => requireSourceMapSource());
34177
+ defineExport("CachedSource", () => requireCachedSource());
34178
+ defineExport("ConcatSource", () => requireConcatSource());
34179
+ defineExport("ReplaceSource", () => requireReplaceSource());
34180
+ defineExport("PrefixSource", () => requirePrefixSource());
34181
+ defineExport("SizeOnlySource", () => requireSizeOnlySource());
34182
+ defineExport("CompatSource", () => requireCompatSource());
34183
+ } (lib$1));
34184
+
34185
+ var sources2 = /*@__PURE__*/getDefaultExportFromCjs(lib$1);
34186
+
30708
34187
  var virtualStats = {};
30709
34188
 
30710
34189
  var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
@@ -32940,7 +36419,7 @@ const buildPluginFactory = ({
32940
36419
 
32941
36420
  var name = "@datadog/esbuild-plugin";
32942
36421
  var packageManager = "yarn@4.0.2";
32943
- var version$1 = "2.3.1";
36422
+ var version$1 = "2.3.2";
32944
36423
  var license = "MIT";
32945
36424
  var author = "Datadog";
32946
36425
  var description = "Datadog ESBuild Plugin";