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