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