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