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