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