@vercel/next 4.2.1 → 4.2.2
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/index.js +2330 -97
- package/dist/mappings.wasm +0 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -9005,6 +9005,2324 @@ var require_lib3 = __commonJS({
|
|
9005
9005
|
}
|
9006
9006
|
});
|
9007
9007
|
|
9008
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64.js
|
9009
|
+
var require_base64 = __commonJS({
|
9010
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64.js"(exports) {
|
9011
|
+
var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
|
9012
|
+
exports.encode = function(number) {
|
9013
|
+
if (0 <= number && number < intToCharMap.length) {
|
9014
|
+
return intToCharMap[number];
|
9015
|
+
}
|
9016
|
+
throw new TypeError("Must be between 0 and 63: " + number);
|
9017
|
+
};
|
9018
|
+
}
|
9019
|
+
});
|
9020
|
+
|
9021
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64-vlq.js
|
9022
|
+
var require_base64_vlq = __commonJS({
|
9023
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64-vlq.js"(exports) {
|
9024
|
+
var base64 = require_base64();
|
9025
|
+
var VLQ_BASE_SHIFT = 5;
|
9026
|
+
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
9027
|
+
var VLQ_BASE_MASK = VLQ_BASE - 1;
|
9028
|
+
var VLQ_CONTINUATION_BIT = VLQ_BASE;
|
9029
|
+
function toVLQSigned(aValue) {
|
9030
|
+
return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
|
9031
|
+
}
|
9032
|
+
exports.encode = function base64VLQ_encode(aValue) {
|
9033
|
+
let encoded = "";
|
9034
|
+
let digit;
|
9035
|
+
let vlq = toVLQSigned(aValue);
|
9036
|
+
do {
|
9037
|
+
digit = vlq & VLQ_BASE_MASK;
|
9038
|
+
vlq >>>= VLQ_BASE_SHIFT;
|
9039
|
+
if (vlq > 0) {
|
9040
|
+
digit |= VLQ_CONTINUATION_BIT;
|
9041
|
+
}
|
9042
|
+
encoded += base64.encode(digit);
|
9043
|
+
} while (vlq > 0);
|
9044
|
+
return encoded;
|
9045
|
+
};
|
9046
|
+
}
|
9047
|
+
});
|
9048
|
+
|
9049
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/util.js
|
9050
|
+
var require_util = __commonJS({
|
9051
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/util.js"(exports) {
|
9052
|
+
function getArg(aArgs, aName, aDefaultValue) {
|
9053
|
+
if (aName in aArgs) {
|
9054
|
+
return aArgs[aName];
|
9055
|
+
} else if (arguments.length === 3) {
|
9056
|
+
return aDefaultValue;
|
9057
|
+
}
|
9058
|
+
throw new Error('"' + aName + '" is a required argument.');
|
9059
|
+
}
|
9060
|
+
exports.getArg = getArg;
|
9061
|
+
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
9062
|
+
var dataUrlRegexp = /^data:.+\,.+$/;
|
9063
|
+
function urlParse(aUrl) {
|
9064
|
+
const match = aUrl.match(urlRegexp);
|
9065
|
+
if (!match) {
|
9066
|
+
return null;
|
9067
|
+
}
|
9068
|
+
return {
|
9069
|
+
scheme: match[1],
|
9070
|
+
auth: match[2],
|
9071
|
+
host: match[3],
|
9072
|
+
port: match[4],
|
9073
|
+
path: match[5]
|
9074
|
+
};
|
9075
|
+
}
|
9076
|
+
exports.urlParse = urlParse;
|
9077
|
+
function urlGenerate(aParsedUrl) {
|
9078
|
+
let url3 = "";
|
9079
|
+
if (aParsedUrl.scheme) {
|
9080
|
+
url3 += aParsedUrl.scheme + ":";
|
9081
|
+
}
|
9082
|
+
url3 += "//";
|
9083
|
+
if (aParsedUrl.auth) {
|
9084
|
+
url3 += aParsedUrl.auth + "@";
|
9085
|
+
}
|
9086
|
+
if (aParsedUrl.host) {
|
9087
|
+
url3 += aParsedUrl.host;
|
9088
|
+
}
|
9089
|
+
if (aParsedUrl.port) {
|
9090
|
+
url3 += ":" + aParsedUrl.port;
|
9091
|
+
}
|
9092
|
+
if (aParsedUrl.path) {
|
9093
|
+
url3 += aParsedUrl.path;
|
9094
|
+
}
|
9095
|
+
return url3;
|
9096
|
+
}
|
9097
|
+
exports.urlGenerate = urlGenerate;
|
9098
|
+
var MAX_CACHED_INPUTS = 32;
|
9099
|
+
function lruMemoize(f) {
|
9100
|
+
const cache = [];
|
9101
|
+
return function(input) {
|
9102
|
+
for (let i = 0; i < cache.length; i++) {
|
9103
|
+
if (cache[i].input === input) {
|
9104
|
+
const temp = cache[0];
|
9105
|
+
cache[0] = cache[i];
|
9106
|
+
cache[i] = temp;
|
9107
|
+
return cache[0].result;
|
9108
|
+
}
|
9109
|
+
}
|
9110
|
+
const result = f(input);
|
9111
|
+
cache.unshift({
|
9112
|
+
input,
|
9113
|
+
result
|
9114
|
+
});
|
9115
|
+
if (cache.length > MAX_CACHED_INPUTS) {
|
9116
|
+
cache.pop();
|
9117
|
+
}
|
9118
|
+
return result;
|
9119
|
+
};
|
9120
|
+
}
|
9121
|
+
var normalize = lruMemoize(function normalize2(aPath) {
|
9122
|
+
let path5 = aPath;
|
9123
|
+
const url3 = urlParse(aPath);
|
9124
|
+
if (url3) {
|
9125
|
+
if (!url3.path) {
|
9126
|
+
return aPath;
|
9127
|
+
}
|
9128
|
+
path5 = url3.path;
|
9129
|
+
}
|
9130
|
+
const isAbsolute = exports.isAbsolute(path5);
|
9131
|
+
const parts = [];
|
9132
|
+
let start = 0;
|
9133
|
+
let i = 0;
|
9134
|
+
while (true) {
|
9135
|
+
start = i;
|
9136
|
+
i = path5.indexOf("/", start);
|
9137
|
+
if (i === -1) {
|
9138
|
+
parts.push(path5.slice(start));
|
9139
|
+
break;
|
9140
|
+
} else {
|
9141
|
+
parts.push(path5.slice(start, i));
|
9142
|
+
while (i < path5.length && path5[i] === "/") {
|
9143
|
+
i++;
|
9144
|
+
}
|
9145
|
+
}
|
9146
|
+
}
|
9147
|
+
let up = 0;
|
9148
|
+
for (i = parts.length - 1; i >= 0; i--) {
|
9149
|
+
const part = parts[i];
|
9150
|
+
if (part === ".") {
|
9151
|
+
parts.splice(i, 1);
|
9152
|
+
} else if (part === "..") {
|
9153
|
+
up++;
|
9154
|
+
} else if (up > 0) {
|
9155
|
+
if (part === "") {
|
9156
|
+
parts.splice(i + 1, up);
|
9157
|
+
up = 0;
|
9158
|
+
} else {
|
9159
|
+
parts.splice(i, 2);
|
9160
|
+
up--;
|
9161
|
+
}
|
9162
|
+
}
|
9163
|
+
}
|
9164
|
+
path5 = parts.join("/");
|
9165
|
+
if (path5 === "") {
|
9166
|
+
path5 = isAbsolute ? "/" : ".";
|
9167
|
+
}
|
9168
|
+
if (url3) {
|
9169
|
+
url3.path = path5;
|
9170
|
+
return urlGenerate(url3);
|
9171
|
+
}
|
9172
|
+
return path5;
|
9173
|
+
});
|
9174
|
+
exports.normalize = normalize;
|
9175
|
+
function join2(aRoot, aPath) {
|
9176
|
+
if (aRoot === "") {
|
9177
|
+
aRoot = ".";
|
9178
|
+
}
|
9179
|
+
if (aPath === "") {
|
9180
|
+
aPath = ".";
|
9181
|
+
}
|
9182
|
+
const aPathUrl = urlParse(aPath);
|
9183
|
+
const aRootUrl = urlParse(aRoot);
|
9184
|
+
if (aRootUrl) {
|
9185
|
+
aRoot = aRootUrl.path || "/";
|
9186
|
+
}
|
9187
|
+
if (aPathUrl && !aPathUrl.scheme) {
|
9188
|
+
if (aRootUrl) {
|
9189
|
+
aPathUrl.scheme = aRootUrl.scheme;
|
9190
|
+
}
|
9191
|
+
return urlGenerate(aPathUrl);
|
9192
|
+
}
|
9193
|
+
if (aPathUrl || aPath.match(dataUrlRegexp)) {
|
9194
|
+
return aPath;
|
9195
|
+
}
|
9196
|
+
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
|
9197
|
+
aRootUrl.host = aPath;
|
9198
|
+
return urlGenerate(aRootUrl);
|
9199
|
+
}
|
9200
|
+
const joined = aPath.charAt(0) === "/" ? aPath : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath);
|
9201
|
+
if (aRootUrl) {
|
9202
|
+
aRootUrl.path = joined;
|
9203
|
+
return urlGenerate(aRootUrl);
|
9204
|
+
}
|
9205
|
+
return joined;
|
9206
|
+
}
|
9207
|
+
exports.join = join2;
|
9208
|
+
exports.isAbsolute = function(aPath) {
|
9209
|
+
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
9210
|
+
};
|
9211
|
+
function relative(aRoot, aPath) {
|
9212
|
+
if (aRoot === "") {
|
9213
|
+
aRoot = ".";
|
9214
|
+
}
|
9215
|
+
aRoot = aRoot.replace(/\/$/, "");
|
9216
|
+
let level = 0;
|
9217
|
+
while (aPath.indexOf(aRoot + "/") !== 0) {
|
9218
|
+
const index = aRoot.lastIndexOf("/");
|
9219
|
+
if (index < 0) {
|
9220
|
+
return aPath;
|
9221
|
+
}
|
9222
|
+
aRoot = aRoot.slice(0, index);
|
9223
|
+
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
|
9224
|
+
return aPath;
|
9225
|
+
}
|
9226
|
+
++level;
|
9227
|
+
}
|
9228
|
+
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
9229
|
+
}
|
9230
|
+
exports.relative = relative;
|
9231
|
+
var supportsNullProto = function() {
|
9232
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
9233
|
+
return !("__proto__" in obj);
|
9234
|
+
}();
|
9235
|
+
function identity(s) {
|
9236
|
+
return s;
|
9237
|
+
}
|
9238
|
+
function toSetString(aStr) {
|
9239
|
+
if (isProtoString(aStr)) {
|
9240
|
+
return "$" + aStr;
|
9241
|
+
}
|
9242
|
+
return aStr;
|
9243
|
+
}
|
9244
|
+
exports.toSetString = supportsNullProto ? identity : toSetString;
|
9245
|
+
function fromSetString(aStr) {
|
9246
|
+
if (isProtoString(aStr)) {
|
9247
|
+
return aStr.slice(1);
|
9248
|
+
}
|
9249
|
+
return aStr;
|
9250
|
+
}
|
9251
|
+
exports.fromSetString = supportsNullProto ? identity : fromSetString;
|
9252
|
+
function isProtoString(s) {
|
9253
|
+
if (!s) {
|
9254
|
+
return false;
|
9255
|
+
}
|
9256
|
+
const length = s.length;
|
9257
|
+
if (length < 9) {
|
9258
|
+
return false;
|
9259
|
+
}
|
9260
|
+
if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
|
9261
|
+
return false;
|
9262
|
+
}
|
9263
|
+
for (let i = length - 10; i >= 0; i--) {
|
9264
|
+
if (s.charCodeAt(i) !== 36) {
|
9265
|
+
return false;
|
9266
|
+
}
|
9267
|
+
}
|
9268
|
+
return true;
|
9269
|
+
}
|
9270
|
+
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
9271
|
+
let cmp = strcmp(mappingA.source, mappingB.source);
|
9272
|
+
if (cmp !== 0) {
|
9273
|
+
return cmp;
|
9274
|
+
}
|
9275
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
9276
|
+
if (cmp !== 0) {
|
9277
|
+
return cmp;
|
9278
|
+
}
|
9279
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
9280
|
+
if (cmp !== 0 || onlyCompareOriginal) {
|
9281
|
+
return cmp;
|
9282
|
+
}
|
9283
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
9284
|
+
if (cmp !== 0) {
|
9285
|
+
return cmp;
|
9286
|
+
}
|
9287
|
+
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
9288
|
+
if (cmp !== 0) {
|
9289
|
+
return cmp;
|
9290
|
+
}
|
9291
|
+
return strcmp(mappingA.name, mappingB.name);
|
9292
|
+
}
|
9293
|
+
exports.compareByOriginalPositions = compareByOriginalPositions;
|
9294
|
+
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
9295
|
+
let cmp = mappingA.generatedLine - mappingB.generatedLine;
|
9296
|
+
if (cmp !== 0) {
|
9297
|
+
return cmp;
|
9298
|
+
}
|
9299
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
9300
|
+
if (cmp !== 0 || onlyCompareGenerated) {
|
9301
|
+
return cmp;
|
9302
|
+
}
|
9303
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
9304
|
+
if (cmp !== 0) {
|
9305
|
+
return cmp;
|
9306
|
+
}
|
9307
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
9308
|
+
if (cmp !== 0) {
|
9309
|
+
return cmp;
|
9310
|
+
}
|
9311
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
9312
|
+
if (cmp !== 0) {
|
9313
|
+
return cmp;
|
9314
|
+
}
|
9315
|
+
return strcmp(mappingA.name, mappingB.name);
|
9316
|
+
}
|
9317
|
+
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
9318
|
+
function strcmp(aStr1, aStr2) {
|
9319
|
+
if (aStr1 === aStr2) {
|
9320
|
+
return 0;
|
9321
|
+
}
|
9322
|
+
if (aStr1 === null) {
|
9323
|
+
return 1;
|
9324
|
+
}
|
9325
|
+
if (aStr2 === null) {
|
9326
|
+
return -1;
|
9327
|
+
}
|
9328
|
+
if (aStr1 > aStr2) {
|
9329
|
+
return 1;
|
9330
|
+
}
|
9331
|
+
return -1;
|
9332
|
+
}
|
9333
|
+
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
9334
|
+
let cmp = mappingA.generatedLine - mappingB.generatedLine;
|
9335
|
+
if (cmp !== 0) {
|
9336
|
+
return cmp;
|
9337
|
+
}
|
9338
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
9339
|
+
if (cmp !== 0) {
|
9340
|
+
return cmp;
|
9341
|
+
}
|
9342
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
9343
|
+
if (cmp !== 0) {
|
9344
|
+
return cmp;
|
9345
|
+
}
|
9346
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
9347
|
+
if (cmp !== 0) {
|
9348
|
+
return cmp;
|
9349
|
+
}
|
9350
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
9351
|
+
if (cmp !== 0) {
|
9352
|
+
return cmp;
|
9353
|
+
}
|
9354
|
+
return strcmp(mappingA.name, mappingB.name);
|
9355
|
+
}
|
9356
|
+
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
9357
|
+
function parseSourceMapInput(str) {
|
9358
|
+
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
|
9359
|
+
}
|
9360
|
+
exports.parseSourceMapInput = parseSourceMapInput;
|
9361
|
+
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
9362
|
+
sourceURL = sourceURL || "";
|
9363
|
+
if (sourceRoot) {
|
9364
|
+
if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") {
|
9365
|
+
sourceRoot += "/";
|
9366
|
+
}
|
9367
|
+
sourceURL = sourceRoot + sourceURL;
|
9368
|
+
}
|
9369
|
+
if (sourceMapURL) {
|
9370
|
+
const parsed = urlParse(sourceMapURL);
|
9371
|
+
if (!parsed) {
|
9372
|
+
throw new Error("sourceMapURL could not be parsed");
|
9373
|
+
}
|
9374
|
+
if (parsed.path) {
|
9375
|
+
const index = parsed.path.lastIndexOf("/");
|
9376
|
+
if (index >= 0) {
|
9377
|
+
parsed.path = parsed.path.substring(0, index + 1);
|
9378
|
+
}
|
9379
|
+
}
|
9380
|
+
sourceURL = join2(urlGenerate(parsed), sourceURL);
|
9381
|
+
}
|
9382
|
+
return normalize(sourceURL);
|
9383
|
+
}
|
9384
|
+
exports.computeSourceURL = computeSourceURL;
|
9385
|
+
}
|
9386
|
+
});
|
9387
|
+
|
9388
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/array-set.js
|
9389
|
+
var require_array_set = __commonJS({
|
9390
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/array-set.js"(exports) {
|
9391
|
+
var ArraySet = class _ArraySet {
|
9392
|
+
constructor() {
|
9393
|
+
this._array = [];
|
9394
|
+
this._set = /* @__PURE__ */ new Map();
|
9395
|
+
}
|
9396
|
+
/**
|
9397
|
+
* Static method for creating ArraySet instances from an existing array.
|
9398
|
+
*/
|
9399
|
+
static fromArray(aArray, aAllowDuplicates) {
|
9400
|
+
const set = new _ArraySet();
|
9401
|
+
for (let i = 0, len = aArray.length; i < len; i++) {
|
9402
|
+
set.add(aArray[i], aAllowDuplicates);
|
9403
|
+
}
|
9404
|
+
return set;
|
9405
|
+
}
|
9406
|
+
/**
|
9407
|
+
* Return how many unique items are in this ArraySet. If duplicates have been
|
9408
|
+
* added, than those do not count towards the size.
|
9409
|
+
*
|
9410
|
+
* @returns Number
|
9411
|
+
*/
|
9412
|
+
size() {
|
9413
|
+
return this._set.size;
|
9414
|
+
}
|
9415
|
+
/**
|
9416
|
+
* Add the given string to this set.
|
9417
|
+
*
|
9418
|
+
* @param String aStr
|
9419
|
+
*/
|
9420
|
+
add(aStr, aAllowDuplicates) {
|
9421
|
+
const isDuplicate = this.has(aStr);
|
9422
|
+
const idx = this._array.length;
|
9423
|
+
if (!isDuplicate || aAllowDuplicates) {
|
9424
|
+
this._array.push(aStr);
|
9425
|
+
}
|
9426
|
+
if (!isDuplicate) {
|
9427
|
+
this._set.set(aStr, idx);
|
9428
|
+
}
|
9429
|
+
}
|
9430
|
+
/**
|
9431
|
+
* Is the given string a member of this set?
|
9432
|
+
*
|
9433
|
+
* @param String aStr
|
9434
|
+
*/
|
9435
|
+
has(aStr) {
|
9436
|
+
return this._set.has(aStr);
|
9437
|
+
}
|
9438
|
+
/**
|
9439
|
+
* What is the index of the given string in the array?
|
9440
|
+
*
|
9441
|
+
* @param String aStr
|
9442
|
+
*/
|
9443
|
+
indexOf(aStr) {
|
9444
|
+
const idx = this._set.get(aStr);
|
9445
|
+
if (idx >= 0) {
|
9446
|
+
return idx;
|
9447
|
+
}
|
9448
|
+
throw new Error('"' + aStr + '" is not in the set.');
|
9449
|
+
}
|
9450
|
+
/**
|
9451
|
+
* What is the element at the given index?
|
9452
|
+
*
|
9453
|
+
* @param Number aIdx
|
9454
|
+
*/
|
9455
|
+
at(aIdx) {
|
9456
|
+
if (aIdx >= 0 && aIdx < this._array.length) {
|
9457
|
+
return this._array[aIdx];
|
9458
|
+
}
|
9459
|
+
throw new Error("No element indexed by " + aIdx);
|
9460
|
+
}
|
9461
|
+
/**
|
9462
|
+
* Returns the array representation of this set (which has the proper indices
|
9463
|
+
* indicated by indexOf). Note that this is a copy of the internal array used
|
9464
|
+
* for storing the members so that no one can mess with internal state.
|
9465
|
+
*/
|
9466
|
+
toArray() {
|
9467
|
+
return this._array.slice();
|
9468
|
+
}
|
9469
|
+
};
|
9470
|
+
exports.ArraySet = ArraySet;
|
9471
|
+
}
|
9472
|
+
});
|
9473
|
+
|
9474
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/mapping-list.js
|
9475
|
+
var require_mapping_list = __commonJS({
|
9476
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/mapping-list.js"(exports) {
|
9477
|
+
var util = require_util();
|
9478
|
+
function generatedPositionAfter(mappingA, mappingB) {
|
9479
|
+
const lineA = mappingA.generatedLine;
|
9480
|
+
const lineB = mappingB.generatedLine;
|
9481
|
+
const columnA = mappingA.generatedColumn;
|
9482
|
+
const columnB = mappingB.generatedColumn;
|
9483
|
+
return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
|
9484
|
+
}
|
9485
|
+
var MappingList = class {
|
9486
|
+
constructor() {
|
9487
|
+
this._array = [];
|
9488
|
+
this._sorted = true;
|
9489
|
+
this._last = { generatedLine: -1, generatedColumn: 0 };
|
9490
|
+
}
|
9491
|
+
/**
|
9492
|
+
* Iterate through internal items. This method takes the same arguments that
|
9493
|
+
* `Array.prototype.forEach` takes.
|
9494
|
+
*
|
9495
|
+
* NOTE: The order of the mappings is NOT guaranteed.
|
9496
|
+
*/
|
9497
|
+
unsortedForEach(aCallback, aThisArg) {
|
9498
|
+
this._array.forEach(aCallback, aThisArg);
|
9499
|
+
}
|
9500
|
+
/**
|
9501
|
+
* Add the given source mapping.
|
9502
|
+
*
|
9503
|
+
* @param Object aMapping
|
9504
|
+
*/
|
9505
|
+
add(aMapping) {
|
9506
|
+
if (generatedPositionAfter(this._last, aMapping)) {
|
9507
|
+
this._last = aMapping;
|
9508
|
+
this._array.push(aMapping);
|
9509
|
+
} else {
|
9510
|
+
this._sorted = false;
|
9511
|
+
this._array.push(aMapping);
|
9512
|
+
}
|
9513
|
+
}
|
9514
|
+
/**
|
9515
|
+
* Returns the flat, sorted array of mappings. The mappings are sorted by
|
9516
|
+
* generated position.
|
9517
|
+
*
|
9518
|
+
* WARNING: This method returns internal data without copying, for
|
9519
|
+
* performance. The return value must NOT be mutated, and should be treated as
|
9520
|
+
* an immutable borrow. If you want to take ownership, you must make your own
|
9521
|
+
* copy.
|
9522
|
+
*/
|
9523
|
+
toArray() {
|
9524
|
+
if (!this._sorted) {
|
9525
|
+
this._array.sort(util.compareByGeneratedPositionsInflated);
|
9526
|
+
this._sorted = true;
|
9527
|
+
}
|
9528
|
+
return this._array;
|
9529
|
+
}
|
9530
|
+
};
|
9531
|
+
exports.MappingList = MappingList;
|
9532
|
+
}
|
9533
|
+
});
|
9534
|
+
|
9535
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-generator.js
|
9536
|
+
var require_source_map_generator = __commonJS({
|
9537
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-generator.js"(exports) {
|
9538
|
+
var base64VLQ = require_base64_vlq();
|
9539
|
+
var util = require_util();
|
9540
|
+
var ArraySet = require_array_set().ArraySet;
|
9541
|
+
var MappingList = require_mapping_list().MappingList;
|
9542
|
+
var SourceMapGenerator2 = class _SourceMapGenerator {
|
9543
|
+
constructor(aArgs) {
|
9544
|
+
if (!aArgs) {
|
9545
|
+
aArgs = {};
|
9546
|
+
}
|
9547
|
+
this._file = util.getArg(aArgs, "file", null);
|
9548
|
+
this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
|
9549
|
+
this._skipValidation = util.getArg(aArgs, "skipValidation", false);
|
9550
|
+
this._sources = new ArraySet();
|
9551
|
+
this._names = new ArraySet();
|
9552
|
+
this._mappings = new MappingList();
|
9553
|
+
this._sourcesContents = null;
|
9554
|
+
}
|
9555
|
+
/**
|
9556
|
+
* Creates a new SourceMapGenerator based on a SourceMapConsumer
|
9557
|
+
*
|
9558
|
+
* @param aSourceMapConsumer The SourceMap.
|
9559
|
+
*/
|
9560
|
+
static fromSourceMap(aSourceMapConsumer) {
|
9561
|
+
const sourceRoot = aSourceMapConsumer.sourceRoot;
|
9562
|
+
const generator = new _SourceMapGenerator({
|
9563
|
+
file: aSourceMapConsumer.file,
|
9564
|
+
sourceRoot
|
9565
|
+
});
|
9566
|
+
aSourceMapConsumer.eachMapping(function(mapping) {
|
9567
|
+
const newMapping = {
|
9568
|
+
generated: {
|
9569
|
+
line: mapping.generatedLine,
|
9570
|
+
column: mapping.generatedColumn
|
9571
|
+
}
|
9572
|
+
};
|
9573
|
+
if (mapping.source != null) {
|
9574
|
+
newMapping.source = mapping.source;
|
9575
|
+
if (sourceRoot != null) {
|
9576
|
+
newMapping.source = util.relative(sourceRoot, newMapping.source);
|
9577
|
+
}
|
9578
|
+
newMapping.original = {
|
9579
|
+
line: mapping.originalLine,
|
9580
|
+
column: mapping.originalColumn
|
9581
|
+
};
|
9582
|
+
if (mapping.name != null) {
|
9583
|
+
newMapping.name = mapping.name;
|
9584
|
+
}
|
9585
|
+
}
|
9586
|
+
generator.addMapping(newMapping);
|
9587
|
+
});
|
9588
|
+
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
9589
|
+
let sourceRelative = sourceFile;
|
9590
|
+
if (sourceRoot !== null) {
|
9591
|
+
sourceRelative = util.relative(sourceRoot, sourceFile);
|
9592
|
+
}
|
9593
|
+
if (!generator._sources.has(sourceRelative)) {
|
9594
|
+
generator._sources.add(sourceRelative);
|
9595
|
+
}
|
9596
|
+
const content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
9597
|
+
if (content != null) {
|
9598
|
+
generator.setSourceContent(sourceFile, content);
|
9599
|
+
}
|
9600
|
+
});
|
9601
|
+
return generator;
|
9602
|
+
}
|
9603
|
+
/**
|
9604
|
+
* Add a single mapping from original source line and column to the generated
|
9605
|
+
* source's line and column for this source map being created. The mapping
|
9606
|
+
* object should have the following properties:
|
9607
|
+
*
|
9608
|
+
* - generated: An object with the generated line and column positions.
|
9609
|
+
* - original: An object with the original line and column positions.
|
9610
|
+
* - source: The original source file (relative to the sourceRoot).
|
9611
|
+
* - name: An optional original token name for this mapping.
|
9612
|
+
*/
|
9613
|
+
addMapping(aArgs) {
|
9614
|
+
const generated = util.getArg(aArgs, "generated");
|
9615
|
+
const original = util.getArg(aArgs, "original", null);
|
9616
|
+
let source = util.getArg(aArgs, "source", null);
|
9617
|
+
let name = util.getArg(aArgs, "name", null);
|
9618
|
+
if (!this._skipValidation) {
|
9619
|
+
this._validateMapping(generated, original, source, name);
|
9620
|
+
}
|
9621
|
+
if (source != null) {
|
9622
|
+
source = String(source);
|
9623
|
+
if (!this._sources.has(source)) {
|
9624
|
+
this._sources.add(source);
|
9625
|
+
}
|
9626
|
+
}
|
9627
|
+
if (name != null) {
|
9628
|
+
name = String(name);
|
9629
|
+
if (!this._names.has(name)) {
|
9630
|
+
this._names.add(name);
|
9631
|
+
}
|
9632
|
+
}
|
9633
|
+
this._mappings.add({
|
9634
|
+
generatedLine: generated.line,
|
9635
|
+
generatedColumn: generated.column,
|
9636
|
+
originalLine: original != null && original.line,
|
9637
|
+
originalColumn: original != null && original.column,
|
9638
|
+
source,
|
9639
|
+
name
|
9640
|
+
});
|
9641
|
+
}
|
9642
|
+
/**
|
9643
|
+
* Set the source content for a source file.
|
9644
|
+
*/
|
9645
|
+
setSourceContent(aSourceFile, aSourceContent) {
|
9646
|
+
let source = aSourceFile;
|
9647
|
+
if (this._sourceRoot != null) {
|
9648
|
+
source = util.relative(this._sourceRoot, source);
|
9649
|
+
}
|
9650
|
+
if (aSourceContent != null) {
|
9651
|
+
if (!this._sourcesContents) {
|
9652
|
+
this._sourcesContents = /* @__PURE__ */ Object.create(null);
|
9653
|
+
}
|
9654
|
+
this._sourcesContents[util.toSetString(source)] = aSourceContent;
|
9655
|
+
} else if (this._sourcesContents) {
|
9656
|
+
delete this._sourcesContents[util.toSetString(source)];
|
9657
|
+
if (Object.keys(this._sourcesContents).length === 0) {
|
9658
|
+
this._sourcesContents = null;
|
9659
|
+
}
|
9660
|
+
}
|
9661
|
+
}
|
9662
|
+
/**
|
9663
|
+
* Applies the mappings of a sub-source-map for a specific source file to the
|
9664
|
+
* source map being generated. Each mapping to the supplied source file is
|
9665
|
+
* rewritten using the supplied source map. Note: The resolution for the
|
9666
|
+
* resulting mappings is the minimium of this map and the supplied map.
|
9667
|
+
*
|
9668
|
+
* @param aSourceMapConsumer The source map to be applied.
|
9669
|
+
* @param aSourceFile Optional. The filename of the source file.
|
9670
|
+
* If omitted, SourceMapConsumer's file property will be used.
|
9671
|
+
* @param aSourceMapPath Optional. The dirname of the path to the source map
|
9672
|
+
* to be applied. If relative, it is relative to the SourceMapConsumer.
|
9673
|
+
* This parameter is needed when the two source maps aren't in the same
|
9674
|
+
* directory, and the source map to be applied contains relative source
|
9675
|
+
* paths. If so, those relative source paths need to be rewritten
|
9676
|
+
* relative to the SourceMapGenerator.
|
9677
|
+
*/
|
9678
|
+
applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
|
9679
|
+
let sourceFile = aSourceFile;
|
9680
|
+
if (aSourceFile == null) {
|
9681
|
+
if (aSourceMapConsumer.file == null) {
|
9682
|
+
throw new Error(
|
9683
|
+
`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`
|
9684
|
+
);
|
9685
|
+
}
|
9686
|
+
sourceFile = aSourceMapConsumer.file;
|
9687
|
+
}
|
9688
|
+
const sourceRoot = this._sourceRoot;
|
9689
|
+
if (sourceRoot != null) {
|
9690
|
+
sourceFile = util.relative(sourceRoot, sourceFile);
|
9691
|
+
}
|
9692
|
+
const newSources = this._mappings.toArray().length > 0 ? new ArraySet() : this._sources;
|
9693
|
+
const newNames = new ArraySet();
|
9694
|
+
this._mappings.unsortedForEach(function(mapping) {
|
9695
|
+
if (mapping.source === sourceFile && mapping.originalLine != null) {
|
9696
|
+
const original = aSourceMapConsumer.originalPositionFor({
|
9697
|
+
line: mapping.originalLine,
|
9698
|
+
column: mapping.originalColumn
|
9699
|
+
});
|
9700
|
+
if (original.source != null) {
|
9701
|
+
mapping.source = original.source;
|
9702
|
+
if (aSourceMapPath != null) {
|
9703
|
+
mapping.source = util.join(aSourceMapPath, mapping.source);
|
9704
|
+
}
|
9705
|
+
if (sourceRoot != null) {
|
9706
|
+
mapping.source = util.relative(sourceRoot, mapping.source);
|
9707
|
+
}
|
9708
|
+
mapping.originalLine = original.line;
|
9709
|
+
mapping.originalColumn = original.column;
|
9710
|
+
if (original.name != null) {
|
9711
|
+
mapping.name = original.name;
|
9712
|
+
}
|
9713
|
+
}
|
9714
|
+
}
|
9715
|
+
const source = mapping.source;
|
9716
|
+
if (source != null && !newSources.has(source)) {
|
9717
|
+
newSources.add(source);
|
9718
|
+
}
|
9719
|
+
const name = mapping.name;
|
9720
|
+
if (name != null && !newNames.has(name)) {
|
9721
|
+
newNames.add(name);
|
9722
|
+
}
|
9723
|
+
}, this);
|
9724
|
+
this._sources = newSources;
|
9725
|
+
this._names = newNames;
|
9726
|
+
aSourceMapConsumer.sources.forEach(function(srcFile) {
|
9727
|
+
const content = aSourceMapConsumer.sourceContentFor(srcFile);
|
9728
|
+
if (content != null) {
|
9729
|
+
if (aSourceMapPath != null) {
|
9730
|
+
srcFile = util.join(aSourceMapPath, srcFile);
|
9731
|
+
}
|
9732
|
+
if (sourceRoot != null) {
|
9733
|
+
srcFile = util.relative(sourceRoot, srcFile);
|
9734
|
+
}
|
9735
|
+
this.setSourceContent(srcFile, content);
|
9736
|
+
}
|
9737
|
+
}, this);
|
9738
|
+
}
|
9739
|
+
/**
|
9740
|
+
* A mapping can have one of the three levels of data:
|
9741
|
+
*
|
9742
|
+
* 1. Just the generated position.
|
9743
|
+
* 2. The Generated position, original position, and original source.
|
9744
|
+
* 3. Generated and original position, original source, as well as a name
|
9745
|
+
* token.
|
9746
|
+
*
|
9747
|
+
* To maintain consistency, we validate that any new mapping being added falls
|
9748
|
+
* in to one of these categories.
|
9749
|
+
*/
|
9750
|
+
_validateMapping(aGenerated, aOriginal, aSource, aName) {
|
9751
|
+
if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
|
9752
|
+
throw new Error(
|
9753
|
+
"original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."
|
9754
|
+
);
|
9755
|
+
}
|
9756
|
+
if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
|
9757
|
+
} else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
|
9758
|
+
} else {
|
9759
|
+
throw new Error("Invalid mapping: " + JSON.stringify({
|
9760
|
+
generated: aGenerated,
|
9761
|
+
source: aSource,
|
9762
|
+
original: aOriginal,
|
9763
|
+
name: aName
|
9764
|
+
}));
|
9765
|
+
}
|
9766
|
+
}
|
9767
|
+
/**
|
9768
|
+
* Serialize the accumulated mappings in to the stream of base 64 VLQs
|
9769
|
+
* specified by the source map format.
|
9770
|
+
*/
|
9771
|
+
_serializeMappings() {
|
9772
|
+
let previousGeneratedColumn = 0;
|
9773
|
+
let previousGeneratedLine = 1;
|
9774
|
+
let previousOriginalColumn = 0;
|
9775
|
+
let previousOriginalLine = 0;
|
9776
|
+
let previousName = 0;
|
9777
|
+
let previousSource = 0;
|
9778
|
+
let result = "";
|
9779
|
+
let next;
|
9780
|
+
let mapping;
|
9781
|
+
let nameIdx;
|
9782
|
+
let sourceIdx;
|
9783
|
+
const mappings = this._mappings.toArray();
|
9784
|
+
for (let i = 0, len = mappings.length; i < len; i++) {
|
9785
|
+
mapping = mappings[i];
|
9786
|
+
next = "";
|
9787
|
+
if (mapping.generatedLine !== previousGeneratedLine) {
|
9788
|
+
previousGeneratedColumn = 0;
|
9789
|
+
while (mapping.generatedLine !== previousGeneratedLine) {
|
9790
|
+
next += ";";
|
9791
|
+
previousGeneratedLine++;
|
9792
|
+
}
|
9793
|
+
} else if (i > 0) {
|
9794
|
+
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
|
9795
|
+
continue;
|
9796
|
+
}
|
9797
|
+
next += ",";
|
9798
|
+
}
|
9799
|
+
next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
|
9800
|
+
previousGeneratedColumn = mapping.generatedColumn;
|
9801
|
+
if (mapping.source != null) {
|
9802
|
+
sourceIdx = this._sources.indexOf(mapping.source);
|
9803
|
+
next += base64VLQ.encode(sourceIdx - previousSource);
|
9804
|
+
previousSource = sourceIdx;
|
9805
|
+
next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
|
9806
|
+
previousOriginalLine = mapping.originalLine - 1;
|
9807
|
+
next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
|
9808
|
+
previousOriginalColumn = mapping.originalColumn;
|
9809
|
+
if (mapping.name != null) {
|
9810
|
+
nameIdx = this._names.indexOf(mapping.name);
|
9811
|
+
next += base64VLQ.encode(nameIdx - previousName);
|
9812
|
+
previousName = nameIdx;
|
9813
|
+
}
|
9814
|
+
}
|
9815
|
+
result += next;
|
9816
|
+
}
|
9817
|
+
return result;
|
9818
|
+
}
|
9819
|
+
_generateSourcesContent(aSources, aSourceRoot) {
|
9820
|
+
return aSources.map(function(source) {
|
9821
|
+
if (!this._sourcesContents) {
|
9822
|
+
return null;
|
9823
|
+
}
|
9824
|
+
if (aSourceRoot != null) {
|
9825
|
+
source = util.relative(aSourceRoot, source);
|
9826
|
+
}
|
9827
|
+
const key = util.toSetString(source);
|
9828
|
+
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
|
9829
|
+
}, this);
|
9830
|
+
}
|
9831
|
+
/**
|
9832
|
+
* Externalize the source map.
|
9833
|
+
*/
|
9834
|
+
toJSON() {
|
9835
|
+
const map = {
|
9836
|
+
version: this._version,
|
9837
|
+
sources: this._sources.toArray(),
|
9838
|
+
names: this._names.toArray(),
|
9839
|
+
mappings: this._serializeMappings()
|
9840
|
+
};
|
9841
|
+
if (this._file != null) {
|
9842
|
+
map.file = this._file;
|
9843
|
+
}
|
9844
|
+
if (this._sourceRoot != null) {
|
9845
|
+
map.sourceRoot = this._sourceRoot;
|
9846
|
+
}
|
9847
|
+
if (this._sourcesContents) {
|
9848
|
+
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
|
9849
|
+
}
|
9850
|
+
return map;
|
9851
|
+
}
|
9852
|
+
/**
|
9853
|
+
* Render the source map being generated to a string.
|
9854
|
+
*/
|
9855
|
+
toString() {
|
9856
|
+
return JSON.stringify(this.toJSON());
|
9857
|
+
}
|
9858
|
+
};
|
9859
|
+
SourceMapGenerator2.prototype._version = 3;
|
9860
|
+
exports.SourceMapGenerator = SourceMapGenerator2;
|
9861
|
+
}
|
9862
|
+
});
|
9863
|
+
|
9864
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/binary-search.js
|
9865
|
+
var require_binary_search = __commonJS({
|
9866
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/binary-search.js"(exports) {
|
9867
|
+
exports.GREATEST_LOWER_BOUND = 1;
|
9868
|
+
exports.LEAST_UPPER_BOUND = 2;
|
9869
|
+
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
|
9870
|
+
const mid = Math.floor((aHigh - aLow) / 2) + aLow;
|
9871
|
+
const cmp = aCompare(aNeedle, aHaystack[mid], true);
|
9872
|
+
if (cmp === 0) {
|
9873
|
+
return mid;
|
9874
|
+
} else if (cmp > 0) {
|
9875
|
+
if (aHigh - mid > 1) {
|
9876
|
+
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
|
9877
|
+
}
|
9878
|
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
9879
|
+
return aHigh < aHaystack.length ? aHigh : -1;
|
9880
|
+
}
|
9881
|
+
return mid;
|
9882
|
+
}
|
9883
|
+
if (mid - aLow > 1) {
|
9884
|
+
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
|
9885
|
+
}
|
9886
|
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
9887
|
+
return mid;
|
9888
|
+
}
|
9889
|
+
return aLow < 0 ? -1 : aLow;
|
9890
|
+
}
|
9891
|
+
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
|
9892
|
+
if (aHaystack.length === 0) {
|
9893
|
+
return -1;
|
9894
|
+
}
|
9895
|
+
let index = recursiveSearch(
|
9896
|
+
-1,
|
9897
|
+
aHaystack.length,
|
9898
|
+
aNeedle,
|
9899
|
+
aHaystack,
|
9900
|
+
aCompare,
|
9901
|
+
aBias || exports.GREATEST_LOWER_BOUND
|
9902
|
+
);
|
9903
|
+
if (index < 0) {
|
9904
|
+
return -1;
|
9905
|
+
}
|
9906
|
+
while (index - 1 >= 0) {
|
9907
|
+
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
|
9908
|
+
break;
|
9909
|
+
}
|
9910
|
+
--index;
|
9911
|
+
}
|
9912
|
+
return index;
|
9913
|
+
};
|
9914
|
+
}
|
9915
|
+
});
|
9916
|
+
|
9917
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/read-wasm.js
|
9918
|
+
var require_read_wasm = __commonJS({
|
9919
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/read-wasm.js"(exports, module2) {
|
9920
|
+
var isBrowserEnvironment = function() {
|
9921
|
+
return typeof window !== "undefined" && this === window;
|
9922
|
+
}.call();
|
9923
|
+
if (isBrowserEnvironment) {
|
9924
|
+
let mappingsWasm = null;
|
9925
|
+
module2.exports = function readWasm() {
|
9926
|
+
if (typeof mappingsWasm === "string") {
|
9927
|
+
return fetch(mappingsWasm).then((response) => response.arrayBuffer());
|
9928
|
+
}
|
9929
|
+
if (mappingsWasm instanceof ArrayBuffer) {
|
9930
|
+
return Promise.resolve(mappingsWasm);
|
9931
|
+
}
|
9932
|
+
throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer");
|
9933
|
+
};
|
9934
|
+
module2.exports.initialize = (input) => mappingsWasm = input;
|
9935
|
+
} else {
|
9936
|
+
const fs5 = require("fs");
|
9937
|
+
const path5 = require("path");
|
9938
|
+
module2.exports = function readWasm() {
|
9939
|
+
return new Promise((resolve, reject) => {
|
9940
|
+
const wasmPath = path5.join(__dirname, "mappings.wasm");
|
9941
|
+
fs5.readFile(wasmPath, null, (error, data) => {
|
9942
|
+
if (error) {
|
9943
|
+
reject(error);
|
9944
|
+
return;
|
9945
|
+
}
|
9946
|
+
resolve(data.buffer);
|
9947
|
+
});
|
9948
|
+
});
|
9949
|
+
};
|
9950
|
+
module2.exports.initialize = (_) => {
|
9951
|
+
console.debug("SourceMapConsumer.initialize is a no-op when running in node.js");
|
9952
|
+
};
|
9953
|
+
}
|
9954
|
+
}
|
9955
|
+
});
|
9956
|
+
|
9957
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/wasm.js
|
9958
|
+
var require_wasm = __commonJS({
|
9959
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/wasm.js"(exports, module2) {
|
9960
|
+
var readWasm = require_read_wasm();
|
9961
|
+
function Mapping() {
|
9962
|
+
this.generatedLine = 0;
|
9963
|
+
this.generatedColumn = 0;
|
9964
|
+
this.lastGeneratedColumn = null;
|
9965
|
+
this.source = null;
|
9966
|
+
this.originalLine = null;
|
9967
|
+
this.originalColumn = null;
|
9968
|
+
this.name = null;
|
9969
|
+
}
|
9970
|
+
var cachedWasm = null;
|
9971
|
+
module2.exports = function wasm() {
|
9972
|
+
if (cachedWasm) {
|
9973
|
+
return cachedWasm;
|
9974
|
+
}
|
9975
|
+
const callbackStack = [];
|
9976
|
+
cachedWasm = readWasm().then((buffer) => {
|
9977
|
+
return WebAssembly.instantiate(buffer, {
|
9978
|
+
env: {
|
9979
|
+
mapping_callback(generatedLine, generatedColumn, hasLastGeneratedColumn, lastGeneratedColumn, hasOriginal, source, originalLine, originalColumn, hasName, name) {
|
9980
|
+
const mapping = new Mapping();
|
9981
|
+
mapping.generatedLine = generatedLine + 1;
|
9982
|
+
mapping.generatedColumn = generatedColumn;
|
9983
|
+
if (hasLastGeneratedColumn) {
|
9984
|
+
mapping.lastGeneratedColumn = lastGeneratedColumn - 1;
|
9985
|
+
}
|
9986
|
+
if (hasOriginal) {
|
9987
|
+
mapping.source = source;
|
9988
|
+
mapping.originalLine = originalLine + 1;
|
9989
|
+
mapping.originalColumn = originalColumn;
|
9990
|
+
if (hasName) {
|
9991
|
+
mapping.name = name;
|
9992
|
+
}
|
9993
|
+
}
|
9994
|
+
callbackStack[callbackStack.length - 1](mapping);
|
9995
|
+
},
|
9996
|
+
start_all_generated_locations_for() {
|
9997
|
+
console.time("all_generated_locations_for");
|
9998
|
+
},
|
9999
|
+
end_all_generated_locations_for() {
|
10000
|
+
console.timeEnd("all_generated_locations_for");
|
10001
|
+
},
|
10002
|
+
start_compute_column_spans() {
|
10003
|
+
console.time("compute_column_spans");
|
10004
|
+
},
|
10005
|
+
end_compute_column_spans() {
|
10006
|
+
console.timeEnd("compute_column_spans");
|
10007
|
+
},
|
10008
|
+
start_generated_location_for() {
|
10009
|
+
console.time("generated_location_for");
|
10010
|
+
},
|
10011
|
+
end_generated_location_for() {
|
10012
|
+
console.timeEnd("generated_location_for");
|
10013
|
+
},
|
10014
|
+
start_original_location_for() {
|
10015
|
+
console.time("original_location_for");
|
10016
|
+
},
|
10017
|
+
end_original_location_for() {
|
10018
|
+
console.timeEnd("original_location_for");
|
10019
|
+
},
|
10020
|
+
start_parse_mappings() {
|
10021
|
+
console.time("parse_mappings");
|
10022
|
+
},
|
10023
|
+
end_parse_mappings() {
|
10024
|
+
console.timeEnd("parse_mappings");
|
10025
|
+
},
|
10026
|
+
start_sort_by_generated_location() {
|
10027
|
+
console.time("sort_by_generated_location");
|
10028
|
+
},
|
10029
|
+
end_sort_by_generated_location() {
|
10030
|
+
console.timeEnd("sort_by_generated_location");
|
10031
|
+
},
|
10032
|
+
start_sort_by_original_location() {
|
10033
|
+
console.time("sort_by_original_location");
|
10034
|
+
},
|
10035
|
+
end_sort_by_original_location() {
|
10036
|
+
console.timeEnd("sort_by_original_location");
|
10037
|
+
}
|
10038
|
+
}
|
10039
|
+
});
|
10040
|
+
}).then((Wasm) => {
|
10041
|
+
return {
|
10042
|
+
exports: Wasm.instance.exports,
|
10043
|
+
withMappingCallback: (mappingCallback, f) => {
|
10044
|
+
callbackStack.push(mappingCallback);
|
10045
|
+
try {
|
10046
|
+
f();
|
10047
|
+
} finally {
|
10048
|
+
callbackStack.pop();
|
10049
|
+
}
|
10050
|
+
}
|
10051
|
+
};
|
10052
|
+
}).then(null, (e) => {
|
10053
|
+
cachedWasm = null;
|
10054
|
+
throw e;
|
10055
|
+
});
|
10056
|
+
return cachedWasm;
|
10057
|
+
};
|
10058
|
+
}
|
10059
|
+
});
|
10060
|
+
|
10061
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-consumer.js
|
10062
|
+
var require_source_map_consumer = __commonJS({
|
10063
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-consumer.js"(exports) {
|
10064
|
+
var util = require_util();
|
10065
|
+
var binarySearch = require_binary_search();
|
10066
|
+
var ArraySet = require_array_set().ArraySet;
|
10067
|
+
var base64VLQ = require_base64_vlq();
|
10068
|
+
var readWasm = require_read_wasm();
|
10069
|
+
var wasm = require_wasm();
|
10070
|
+
var INTERNAL = Symbol("smcInternal");
|
10071
|
+
var SourceMapConsumer2 = class _SourceMapConsumer {
|
10072
|
+
constructor(aSourceMap, aSourceMapURL) {
|
10073
|
+
if (aSourceMap == INTERNAL) {
|
10074
|
+
return Promise.resolve(this);
|
10075
|
+
}
|
10076
|
+
return _factory(aSourceMap, aSourceMapURL);
|
10077
|
+
}
|
10078
|
+
static initialize(opts) {
|
10079
|
+
readWasm.initialize(opts["lib/mappings.wasm"]);
|
10080
|
+
}
|
10081
|
+
static fromSourceMap(aSourceMap, aSourceMapURL) {
|
10082
|
+
return _factoryBSM(aSourceMap, aSourceMapURL);
|
10083
|
+
}
|
10084
|
+
/**
|
10085
|
+
* Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl`
|
10086
|
+
* (see the `SourceMapConsumer` constructor for details. Then, invoke the `async
|
10087
|
+
* function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait
|
10088
|
+
* for `f` to complete, call `destroy` on the consumer, and return `f`'s return
|
10089
|
+
* value.
|
10090
|
+
*
|
10091
|
+
* You must not use the consumer after `f` completes!
|
10092
|
+
*
|
10093
|
+
* By using `with`, you do not have to remember to manually call `destroy` on
|
10094
|
+
* the consumer, since it will be called automatically once `f` completes.
|
10095
|
+
*
|
10096
|
+
* ```js
|
10097
|
+
* const xSquared = await SourceMapConsumer.with(
|
10098
|
+
* myRawSourceMap,
|
10099
|
+
* null,
|
10100
|
+
* async function (consumer) {
|
10101
|
+
* // Use `consumer` inside here and don't worry about remembering
|
10102
|
+
* // to call `destroy`.
|
10103
|
+
*
|
10104
|
+
* const x = await whatever(consumer);
|
10105
|
+
* return x * x;
|
10106
|
+
* }
|
10107
|
+
* );
|
10108
|
+
*
|
10109
|
+
* // You may not use that `consumer` anymore out here; it has
|
10110
|
+
* // been destroyed. But you can use `xSquared`.
|
10111
|
+
* console.log(xSquared);
|
10112
|
+
* ```
|
10113
|
+
*/
|
10114
|
+
static async with(rawSourceMap, sourceMapUrl, f) {
|
10115
|
+
const consumer = await new _SourceMapConsumer(rawSourceMap, sourceMapUrl);
|
10116
|
+
try {
|
10117
|
+
return await f(consumer);
|
10118
|
+
} finally {
|
10119
|
+
consumer.destroy();
|
10120
|
+
}
|
10121
|
+
}
|
10122
|
+
/**
|
10123
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
10124
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
10125
|
+
* `this.__originalMappings` properties).
|
10126
|
+
*/
|
10127
|
+
_parseMappings(aStr, aSourceRoot) {
|
10128
|
+
throw new Error("Subclasses must implement _parseMappings");
|
10129
|
+
}
|
10130
|
+
/**
|
10131
|
+
* Iterate over each mapping between an original source/line/column and a
|
10132
|
+
* generated line/column in this source map.
|
10133
|
+
*
|
10134
|
+
* @param Function aCallback
|
10135
|
+
* The function that is called with each mapping.
|
10136
|
+
* @param Object aContext
|
10137
|
+
* Optional. If specified, this object will be the value of `this` every
|
10138
|
+
* time that `aCallback` is called.
|
10139
|
+
* @param aOrder
|
10140
|
+
* Either `SourceMapConsumer.GENERATED_ORDER` or
|
10141
|
+
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
|
10142
|
+
* iterate over the mappings sorted by the generated file's line/column
|
10143
|
+
* order or the original's source/line/column order, respectively. Defaults to
|
10144
|
+
* `SourceMapConsumer.GENERATED_ORDER`.
|
10145
|
+
*/
|
10146
|
+
eachMapping(aCallback, aContext, aOrder) {
|
10147
|
+
throw new Error("Subclasses must implement eachMapping");
|
10148
|
+
}
|
10149
|
+
/**
|
10150
|
+
* Returns all generated line and column information for the original source,
|
10151
|
+
* line, and column provided. If no column is provided, returns all mappings
|
10152
|
+
* corresponding to a either the line we are searching for or the next
|
10153
|
+
* closest line that has any mappings. Otherwise, returns all mappings
|
10154
|
+
* corresponding to the given line and either the column we are searching for
|
10155
|
+
* or the next closest column that has any offsets.
|
10156
|
+
*
|
10157
|
+
* The only argument is an object with the following properties:
|
10158
|
+
*
|
10159
|
+
* - source: The filename of the original source.
|
10160
|
+
* - line: The line number in the original source. The line number is 1-based.
|
10161
|
+
* - column: Optional. the column number in the original source.
|
10162
|
+
* The column number is 0-based.
|
10163
|
+
*
|
10164
|
+
* and an array of objects is returned, each with the following properties:
|
10165
|
+
*
|
10166
|
+
* - line: The line number in the generated source, or null. The
|
10167
|
+
* line number is 1-based.
|
10168
|
+
* - column: The column number in the generated source, or null.
|
10169
|
+
* The column number is 0-based.
|
10170
|
+
*/
|
10171
|
+
allGeneratedPositionsFor(aArgs) {
|
10172
|
+
throw new Error("Subclasses must implement allGeneratedPositionsFor");
|
10173
|
+
}
|
10174
|
+
destroy() {
|
10175
|
+
throw new Error("Subclasses must implement destroy");
|
10176
|
+
}
|
10177
|
+
};
|
10178
|
+
SourceMapConsumer2.prototype._version = 3;
|
10179
|
+
SourceMapConsumer2.GENERATED_ORDER = 1;
|
10180
|
+
SourceMapConsumer2.ORIGINAL_ORDER = 2;
|
10181
|
+
SourceMapConsumer2.GREATEST_LOWER_BOUND = 1;
|
10182
|
+
SourceMapConsumer2.LEAST_UPPER_BOUND = 2;
|
10183
|
+
exports.SourceMapConsumer = SourceMapConsumer2;
|
10184
|
+
var BasicSourceMapConsumer = class _BasicSourceMapConsumer extends SourceMapConsumer2 {
|
10185
|
+
constructor(aSourceMap, aSourceMapURL) {
|
10186
|
+
return super(INTERNAL).then((that) => {
|
10187
|
+
let sourceMap = aSourceMap;
|
10188
|
+
if (typeof aSourceMap === "string") {
|
10189
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
10190
|
+
}
|
10191
|
+
const version2 = util.getArg(sourceMap, "version");
|
10192
|
+
let sources = util.getArg(sourceMap, "sources");
|
10193
|
+
const names = util.getArg(sourceMap, "names", []);
|
10194
|
+
let sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
|
10195
|
+
const sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
|
10196
|
+
const mappings = util.getArg(sourceMap, "mappings");
|
10197
|
+
const file = util.getArg(sourceMap, "file", null);
|
10198
|
+
if (version2 != that._version) {
|
10199
|
+
throw new Error("Unsupported version: " + version2);
|
10200
|
+
}
|
10201
|
+
if (sourceRoot) {
|
10202
|
+
sourceRoot = util.normalize(sourceRoot);
|
10203
|
+
}
|
10204
|
+
sources = sources.map(String).map(util.normalize).map(function(source) {
|
10205
|
+
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
|
10206
|
+
});
|
10207
|
+
that._names = ArraySet.fromArray(names.map(String), true);
|
10208
|
+
that._sources = ArraySet.fromArray(sources, true);
|
10209
|
+
that._absoluteSources = that._sources.toArray().map(function(s) {
|
10210
|
+
return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
|
10211
|
+
});
|
10212
|
+
that.sourceRoot = sourceRoot;
|
10213
|
+
that.sourcesContent = sourcesContent;
|
10214
|
+
that._mappings = mappings;
|
10215
|
+
that._sourceMapURL = aSourceMapURL;
|
10216
|
+
that.file = file;
|
10217
|
+
that._computedColumnSpans = false;
|
10218
|
+
that._mappingsPtr = 0;
|
10219
|
+
that._wasm = null;
|
10220
|
+
return wasm().then((w) => {
|
10221
|
+
that._wasm = w;
|
10222
|
+
return that;
|
10223
|
+
});
|
10224
|
+
});
|
10225
|
+
}
|
10226
|
+
/**
|
10227
|
+
* Utility function to find the index of a source. Returns -1 if not
|
10228
|
+
* found.
|
10229
|
+
*/
|
10230
|
+
_findSourceIndex(aSource) {
|
10231
|
+
let relativeSource = aSource;
|
10232
|
+
if (this.sourceRoot != null) {
|
10233
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
10234
|
+
}
|
10235
|
+
if (this._sources.has(relativeSource)) {
|
10236
|
+
return this._sources.indexOf(relativeSource);
|
10237
|
+
}
|
10238
|
+
for (let i = 0; i < this._absoluteSources.length; ++i) {
|
10239
|
+
if (this._absoluteSources[i] == aSource) {
|
10240
|
+
return i;
|
10241
|
+
}
|
10242
|
+
}
|
10243
|
+
return -1;
|
10244
|
+
}
|
10245
|
+
/**
|
10246
|
+
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
|
10247
|
+
*
|
10248
|
+
* @param SourceMapGenerator aSourceMap
|
10249
|
+
* The source map that will be consumed.
|
10250
|
+
* @param String aSourceMapURL
|
10251
|
+
* The URL at which the source map can be found (optional)
|
10252
|
+
* @returns BasicSourceMapConsumer
|
10253
|
+
*/
|
10254
|
+
static fromSourceMap(aSourceMap, aSourceMapURL) {
|
10255
|
+
return new _BasicSourceMapConsumer(aSourceMap.toString());
|
10256
|
+
}
|
10257
|
+
get sources() {
|
10258
|
+
return this._absoluteSources.slice();
|
10259
|
+
}
|
10260
|
+
_getMappingsPtr() {
|
10261
|
+
if (this._mappingsPtr === 0) {
|
10262
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
10263
|
+
}
|
10264
|
+
return this._mappingsPtr;
|
10265
|
+
}
|
10266
|
+
/**
|
10267
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
10268
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
10269
|
+
* `this.__originalMappings` properties).
|
10270
|
+
*/
|
10271
|
+
_parseMappings(aStr, aSourceRoot) {
|
10272
|
+
const size = aStr.length;
|
10273
|
+
const mappingsBufPtr = this._wasm.exports.allocate_mappings(size);
|
10274
|
+
const mappingsBuf = new Uint8Array(this._wasm.exports.memory.buffer, mappingsBufPtr, size);
|
10275
|
+
for (let i = 0; i < size; i++) {
|
10276
|
+
mappingsBuf[i] = aStr.charCodeAt(i);
|
10277
|
+
}
|
10278
|
+
const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr);
|
10279
|
+
if (!mappingsPtr) {
|
10280
|
+
const error = this._wasm.exports.get_last_error();
|
10281
|
+
let msg = `Error parsing mappings (code ${error}): `;
|
10282
|
+
switch (error) {
|
10283
|
+
case 1:
|
10284
|
+
msg += "the mappings contained a negative line, column, source index, or name index";
|
10285
|
+
break;
|
10286
|
+
case 2:
|
10287
|
+
msg += "the mappings contained a number larger than 2**32";
|
10288
|
+
break;
|
10289
|
+
case 3:
|
10290
|
+
msg += "reached EOF while in the middle of parsing a VLQ";
|
10291
|
+
break;
|
10292
|
+
case 4:
|
10293
|
+
msg += "invalid base 64 character while parsing a VLQ";
|
10294
|
+
break;
|
10295
|
+
default:
|
10296
|
+
msg += "unknown error code";
|
10297
|
+
break;
|
10298
|
+
}
|
10299
|
+
throw new Error(msg);
|
10300
|
+
}
|
10301
|
+
this._mappingsPtr = mappingsPtr;
|
10302
|
+
}
|
10303
|
+
eachMapping(aCallback, aContext, aOrder) {
|
10304
|
+
const context = aContext || null;
|
10305
|
+
const order = aOrder || SourceMapConsumer2.GENERATED_ORDER;
|
10306
|
+
const sourceRoot = this.sourceRoot;
|
10307
|
+
this._wasm.withMappingCallback(
|
10308
|
+
(mapping) => {
|
10309
|
+
if (mapping.source !== null) {
|
10310
|
+
mapping.source = this._sources.at(mapping.source);
|
10311
|
+
mapping.source = util.computeSourceURL(sourceRoot, mapping.source, this._sourceMapURL);
|
10312
|
+
if (mapping.name !== null) {
|
10313
|
+
mapping.name = this._names.at(mapping.name);
|
10314
|
+
}
|
10315
|
+
}
|
10316
|
+
aCallback.call(context, mapping);
|
10317
|
+
},
|
10318
|
+
() => {
|
10319
|
+
switch (order) {
|
10320
|
+
case SourceMapConsumer2.GENERATED_ORDER:
|
10321
|
+
this._wasm.exports.by_generated_location(this._getMappingsPtr());
|
10322
|
+
break;
|
10323
|
+
case SourceMapConsumer2.ORIGINAL_ORDER:
|
10324
|
+
this._wasm.exports.by_original_location(this._getMappingsPtr());
|
10325
|
+
break;
|
10326
|
+
default:
|
10327
|
+
throw new Error("Unknown order of iteration.");
|
10328
|
+
}
|
10329
|
+
}
|
10330
|
+
);
|
10331
|
+
}
|
10332
|
+
allGeneratedPositionsFor(aArgs) {
|
10333
|
+
let source = util.getArg(aArgs, "source");
|
10334
|
+
const originalLine = util.getArg(aArgs, "line");
|
10335
|
+
const originalColumn = aArgs.column || 0;
|
10336
|
+
source = this._findSourceIndex(source);
|
10337
|
+
if (source < 0) {
|
10338
|
+
return [];
|
10339
|
+
}
|
10340
|
+
if (originalLine < 1) {
|
10341
|
+
throw new Error("Line numbers must be >= 1");
|
10342
|
+
}
|
10343
|
+
if (originalColumn < 0) {
|
10344
|
+
throw new Error("Column numbers must be >= 0");
|
10345
|
+
}
|
10346
|
+
const mappings = [];
|
10347
|
+
this._wasm.withMappingCallback(
|
10348
|
+
(m) => {
|
10349
|
+
let lastColumn = m.lastGeneratedColumn;
|
10350
|
+
if (this._computedColumnSpans && lastColumn === null) {
|
10351
|
+
lastColumn = Infinity;
|
10352
|
+
}
|
10353
|
+
mappings.push({
|
10354
|
+
line: m.generatedLine,
|
10355
|
+
column: m.generatedColumn,
|
10356
|
+
lastColumn
|
10357
|
+
});
|
10358
|
+
},
|
10359
|
+
() => {
|
10360
|
+
this._wasm.exports.all_generated_locations_for(
|
10361
|
+
this._getMappingsPtr(),
|
10362
|
+
source,
|
10363
|
+
originalLine - 1,
|
10364
|
+
"column" in aArgs,
|
10365
|
+
originalColumn
|
10366
|
+
);
|
10367
|
+
}
|
10368
|
+
);
|
10369
|
+
return mappings;
|
10370
|
+
}
|
10371
|
+
destroy() {
|
10372
|
+
if (this._mappingsPtr !== 0) {
|
10373
|
+
this._wasm.exports.free_mappings(this._mappingsPtr);
|
10374
|
+
this._mappingsPtr = 0;
|
10375
|
+
}
|
10376
|
+
}
|
10377
|
+
/**
|
10378
|
+
* Compute the last column for each generated mapping. The last column is
|
10379
|
+
* inclusive.
|
10380
|
+
*/
|
10381
|
+
computeColumnSpans() {
|
10382
|
+
if (this._computedColumnSpans) {
|
10383
|
+
return;
|
10384
|
+
}
|
10385
|
+
this._wasm.exports.compute_column_spans(this._getMappingsPtr());
|
10386
|
+
this._computedColumnSpans = true;
|
10387
|
+
}
|
10388
|
+
/**
|
10389
|
+
* Returns the original source, line, and column information for the generated
|
10390
|
+
* source's line and column positions provided. The only argument is an object
|
10391
|
+
* with the following properties:
|
10392
|
+
*
|
10393
|
+
* - line: The line number in the generated source. The line number
|
10394
|
+
* is 1-based.
|
10395
|
+
* - column: The column number in the generated source. The column
|
10396
|
+
* number is 0-based.
|
10397
|
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
10398
|
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
10399
|
+
* closest element that is smaller than or greater than the one we are
|
10400
|
+
* searching for, respectively, if the exact element cannot be found.
|
10401
|
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
10402
|
+
*
|
10403
|
+
* and an object is returned with the following properties:
|
10404
|
+
*
|
10405
|
+
* - source: The original source file, or null.
|
10406
|
+
* - line: The line number in the original source, or null. The
|
10407
|
+
* line number is 1-based.
|
10408
|
+
* - column: The column number in the original source, or null. The
|
10409
|
+
* column number is 0-based.
|
10410
|
+
* - name: The original identifier, or null.
|
10411
|
+
*/
|
10412
|
+
originalPositionFor(aArgs) {
|
10413
|
+
const needle = {
|
10414
|
+
generatedLine: util.getArg(aArgs, "line"),
|
10415
|
+
generatedColumn: util.getArg(aArgs, "column")
|
10416
|
+
};
|
10417
|
+
if (needle.generatedLine < 1) {
|
10418
|
+
throw new Error("Line numbers must be >= 1");
|
10419
|
+
}
|
10420
|
+
if (needle.generatedColumn < 0) {
|
10421
|
+
throw new Error("Column numbers must be >= 0");
|
10422
|
+
}
|
10423
|
+
let bias = util.getArg(aArgs, "bias", SourceMapConsumer2.GREATEST_LOWER_BOUND);
|
10424
|
+
if (bias == null) {
|
10425
|
+
bias = SourceMapConsumer2.GREATEST_LOWER_BOUND;
|
10426
|
+
}
|
10427
|
+
let mapping;
|
10428
|
+
this._wasm.withMappingCallback((m) => mapping = m, () => {
|
10429
|
+
this._wasm.exports.original_location_for(
|
10430
|
+
this._getMappingsPtr(),
|
10431
|
+
needle.generatedLine - 1,
|
10432
|
+
needle.generatedColumn,
|
10433
|
+
bias
|
10434
|
+
);
|
10435
|
+
});
|
10436
|
+
if (mapping) {
|
10437
|
+
if (mapping.generatedLine === needle.generatedLine) {
|
10438
|
+
let source = util.getArg(mapping, "source", null);
|
10439
|
+
if (source !== null) {
|
10440
|
+
source = this._sources.at(source);
|
10441
|
+
source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
|
10442
|
+
}
|
10443
|
+
let name = util.getArg(mapping, "name", null);
|
10444
|
+
if (name !== null) {
|
10445
|
+
name = this._names.at(name);
|
10446
|
+
}
|
10447
|
+
return {
|
10448
|
+
source,
|
10449
|
+
line: util.getArg(mapping, "originalLine", null),
|
10450
|
+
column: util.getArg(mapping, "originalColumn", null),
|
10451
|
+
name
|
10452
|
+
};
|
10453
|
+
}
|
10454
|
+
}
|
10455
|
+
return {
|
10456
|
+
source: null,
|
10457
|
+
line: null,
|
10458
|
+
column: null,
|
10459
|
+
name: null
|
10460
|
+
};
|
10461
|
+
}
|
10462
|
+
/**
|
10463
|
+
* Return true if we have the source content for every source in the source
|
10464
|
+
* map, false otherwise.
|
10465
|
+
*/
|
10466
|
+
hasContentsOfAllSources() {
|
10467
|
+
if (!this.sourcesContent) {
|
10468
|
+
return false;
|
10469
|
+
}
|
10470
|
+
return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
|
10471
|
+
return sc == null;
|
10472
|
+
});
|
10473
|
+
}
|
10474
|
+
/**
|
10475
|
+
* Returns the original source content. The only argument is the url of the
|
10476
|
+
* original source file. Returns null if no original source content is
|
10477
|
+
* available.
|
10478
|
+
*/
|
10479
|
+
sourceContentFor(aSource, nullOnMissing) {
|
10480
|
+
if (!this.sourcesContent) {
|
10481
|
+
return null;
|
10482
|
+
}
|
10483
|
+
const index = this._findSourceIndex(aSource);
|
10484
|
+
if (index >= 0) {
|
10485
|
+
return this.sourcesContent[index];
|
10486
|
+
}
|
10487
|
+
let relativeSource = aSource;
|
10488
|
+
if (this.sourceRoot != null) {
|
10489
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
10490
|
+
}
|
10491
|
+
let url3;
|
10492
|
+
if (this.sourceRoot != null && (url3 = util.urlParse(this.sourceRoot))) {
|
10493
|
+
const fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
|
10494
|
+
if (url3.scheme == "file" && this._sources.has(fileUriAbsPath)) {
|
10495
|
+
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
|
10496
|
+
}
|
10497
|
+
if ((!url3.path || url3.path == "/") && this._sources.has("/" + relativeSource)) {
|
10498
|
+
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
|
10499
|
+
}
|
10500
|
+
}
|
10501
|
+
if (nullOnMissing) {
|
10502
|
+
return null;
|
10503
|
+
}
|
10504
|
+
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
|
10505
|
+
}
|
10506
|
+
/**
|
10507
|
+
* Returns the generated line and column information for the original source,
|
10508
|
+
* line, and column positions provided. The only argument is an object with
|
10509
|
+
* the following properties:
|
10510
|
+
*
|
10511
|
+
* - source: The filename of the original source.
|
10512
|
+
* - line: The line number in the original source. The line number
|
10513
|
+
* is 1-based.
|
10514
|
+
* - column: The column number in the original source. The column
|
10515
|
+
* number is 0-based.
|
10516
|
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
10517
|
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
10518
|
+
* closest element that is smaller than or greater than the one we are
|
10519
|
+
* searching for, respectively, if the exact element cannot be found.
|
10520
|
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
10521
|
+
*
|
10522
|
+
* and an object is returned with the following properties:
|
10523
|
+
*
|
10524
|
+
* - line: The line number in the generated source, or null. The
|
10525
|
+
* line number is 1-based.
|
10526
|
+
* - column: The column number in the generated source, or null.
|
10527
|
+
* The column number is 0-based.
|
10528
|
+
*/
|
10529
|
+
generatedPositionFor(aArgs) {
|
10530
|
+
let source = util.getArg(aArgs, "source");
|
10531
|
+
source = this._findSourceIndex(source);
|
10532
|
+
if (source < 0) {
|
10533
|
+
return {
|
10534
|
+
line: null,
|
10535
|
+
column: null,
|
10536
|
+
lastColumn: null
|
10537
|
+
};
|
10538
|
+
}
|
10539
|
+
const needle = {
|
10540
|
+
source,
|
10541
|
+
originalLine: util.getArg(aArgs, "line"),
|
10542
|
+
originalColumn: util.getArg(aArgs, "column")
|
10543
|
+
};
|
10544
|
+
if (needle.originalLine < 1) {
|
10545
|
+
throw new Error("Line numbers must be >= 1");
|
10546
|
+
}
|
10547
|
+
if (needle.originalColumn < 0) {
|
10548
|
+
throw new Error("Column numbers must be >= 0");
|
10549
|
+
}
|
10550
|
+
let bias = util.getArg(aArgs, "bias", SourceMapConsumer2.GREATEST_LOWER_BOUND);
|
10551
|
+
if (bias == null) {
|
10552
|
+
bias = SourceMapConsumer2.GREATEST_LOWER_BOUND;
|
10553
|
+
}
|
10554
|
+
let mapping;
|
10555
|
+
this._wasm.withMappingCallback((m) => mapping = m, () => {
|
10556
|
+
this._wasm.exports.generated_location_for(
|
10557
|
+
this._getMappingsPtr(),
|
10558
|
+
needle.source,
|
10559
|
+
needle.originalLine - 1,
|
10560
|
+
needle.originalColumn,
|
10561
|
+
bias
|
10562
|
+
);
|
10563
|
+
});
|
10564
|
+
if (mapping) {
|
10565
|
+
if (mapping.source === needle.source) {
|
10566
|
+
let lastColumn = mapping.lastGeneratedColumn;
|
10567
|
+
if (this._computedColumnSpans && lastColumn === null) {
|
10568
|
+
lastColumn = Infinity;
|
10569
|
+
}
|
10570
|
+
return {
|
10571
|
+
line: util.getArg(mapping, "generatedLine", null),
|
10572
|
+
column: util.getArg(mapping, "generatedColumn", null),
|
10573
|
+
lastColumn
|
10574
|
+
};
|
10575
|
+
}
|
10576
|
+
}
|
10577
|
+
return {
|
10578
|
+
line: null,
|
10579
|
+
column: null,
|
10580
|
+
lastColumn: null
|
10581
|
+
};
|
10582
|
+
}
|
10583
|
+
};
|
10584
|
+
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer2;
|
10585
|
+
exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
|
10586
|
+
var IndexedSourceMapConsumer = class extends SourceMapConsumer2 {
|
10587
|
+
constructor(aSourceMap, aSourceMapURL) {
|
10588
|
+
return super(INTERNAL).then((that) => {
|
10589
|
+
let sourceMap = aSourceMap;
|
10590
|
+
if (typeof aSourceMap === "string") {
|
10591
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
10592
|
+
}
|
10593
|
+
const version2 = util.getArg(sourceMap, "version");
|
10594
|
+
const sections = util.getArg(sourceMap, "sections");
|
10595
|
+
if (version2 != that._version) {
|
10596
|
+
throw new Error("Unsupported version: " + version2);
|
10597
|
+
}
|
10598
|
+
that._sources = new ArraySet();
|
10599
|
+
that._names = new ArraySet();
|
10600
|
+
that.__generatedMappings = null;
|
10601
|
+
that.__originalMappings = null;
|
10602
|
+
that.__generatedMappingsUnsorted = null;
|
10603
|
+
that.__originalMappingsUnsorted = null;
|
10604
|
+
let lastOffset = {
|
10605
|
+
line: -1,
|
10606
|
+
column: 0
|
10607
|
+
};
|
10608
|
+
return Promise.all(sections.map((s) => {
|
10609
|
+
if (s.url) {
|
10610
|
+
throw new Error("Support for url field in sections not implemented.");
|
10611
|
+
}
|
10612
|
+
const offset = util.getArg(s, "offset");
|
10613
|
+
const offsetLine = util.getArg(offset, "line");
|
10614
|
+
const offsetColumn = util.getArg(offset, "column");
|
10615
|
+
if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
|
10616
|
+
throw new Error("Section offsets must be ordered and non-overlapping.");
|
10617
|
+
}
|
10618
|
+
lastOffset = offset;
|
10619
|
+
const cons = new SourceMapConsumer2(util.getArg(s, "map"), aSourceMapURL);
|
10620
|
+
return cons.then((consumer) => {
|
10621
|
+
return {
|
10622
|
+
generatedOffset: {
|
10623
|
+
// The offset fields are 0-based, but we use 1-based indices when
|
10624
|
+
// encoding/decoding from VLQ.
|
10625
|
+
generatedLine: offsetLine + 1,
|
10626
|
+
generatedColumn: offsetColumn + 1
|
10627
|
+
},
|
10628
|
+
consumer
|
10629
|
+
};
|
10630
|
+
});
|
10631
|
+
})).then((s) => {
|
10632
|
+
that._sections = s;
|
10633
|
+
return that;
|
10634
|
+
});
|
10635
|
+
});
|
10636
|
+
}
|
10637
|
+
// `__generatedMappings` and `__originalMappings` are arrays that hold the
|
10638
|
+
// parsed mapping coordinates from the source map's "mappings" attribute. They
|
10639
|
+
// are lazily instantiated, accessed via the `_generatedMappings` and
|
10640
|
+
// `_originalMappings` getters respectively, and we only parse the mappings
|
10641
|
+
// and create these arrays once queried for a source location. We jump through
|
10642
|
+
// these hoops because there can be many thousands of mappings, and parsing
|
10643
|
+
// them is expensive, so we only want to do it if we must.
|
10644
|
+
//
|
10645
|
+
// Each object in the arrays is of the form:
|
10646
|
+
//
|
10647
|
+
// {
|
10648
|
+
// generatedLine: The line number in the generated code,
|
10649
|
+
// generatedColumn: The column number in the generated code,
|
10650
|
+
// source: The path to the original source file that generated this
|
10651
|
+
// chunk of code,
|
10652
|
+
// originalLine: The line number in the original source that
|
10653
|
+
// corresponds to this chunk of generated code,
|
10654
|
+
// originalColumn: The column number in the original source that
|
10655
|
+
// corresponds to this chunk of generated code,
|
10656
|
+
// name: The name of the original symbol which generated this chunk of
|
10657
|
+
// code.
|
10658
|
+
// }
|
10659
|
+
//
|
10660
|
+
// All properties except for `generatedLine` and `generatedColumn` can be
|
10661
|
+
// `null`.
|
10662
|
+
//
|
10663
|
+
// `_generatedMappings` is ordered by the generated positions.
|
10664
|
+
//
|
10665
|
+
// `_originalMappings` is ordered by the original positions.
|
10666
|
+
get _generatedMappings() {
|
10667
|
+
if (!this.__generatedMappings) {
|
10668
|
+
this._sortGeneratedMappings();
|
10669
|
+
}
|
10670
|
+
return this.__generatedMappings;
|
10671
|
+
}
|
10672
|
+
get _originalMappings() {
|
10673
|
+
if (!this.__originalMappings) {
|
10674
|
+
this._sortOriginalMappings();
|
10675
|
+
}
|
10676
|
+
return this.__originalMappings;
|
10677
|
+
}
|
10678
|
+
get _generatedMappingsUnsorted() {
|
10679
|
+
if (!this.__generatedMappingsUnsorted) {
|
10680
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
10681
|
+
}
|
10682
|
+
return this.__generatedMappingsUnsorted;
|
10683
|
+
}
|
10684
|
+
get _originalMappingsUnsorted() {
|
10685
|
+
if (!this.__originalMappingsUnsorted) {
|
10686
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
10687
|
+
}
|
10688
|
+
return this.__originalMappingsUnsorted;
|
10689
|
+
}
|
10690
|
+
_sortGeneratedMappings() {
|
10691
|
+
const mappings = this._generatedMappingsUnsorted;
|
10692
|
+
mappings.sort(util.compareByGeneratedPositionsDeflated);
|
10693
|
+
this.__generatedMappings = mappings;
|
10694
|
+
}
|
10695
|
+
_sortOriginalMappings() {
|
10696
|
+
const mappings = this._originalMappingsUnsorted;
|
10697
|
+
mappings.sort(util.compareByOriginalPositions);
|
10698
|
+
this.__originalMappings = mappings;
|
10699
|
+
}
|
10700
|
+
/**
|
10701
|
+
* The list of original sources.
|
10702
|
+
*/
|
10703
|
+
get sources() {
|
10704
|
+
const sources = [];
|
10705
|
+
for (let i = 0; i < this._sections.length; i++) {
|
10706
|
+
for (let j = 0; j < this._sections[i].consumer.sources.length; j++) {
|
10707
|
+
sources.push(this._sections[i].consumer.sources[j]);
|
10708
|
+
}
|
10709
|
+
}
|
10710
|
+
return sources;
|
10711
|
+
}
|
10712
|
+
/**
|
10713
|
+
* Returns the original source, line, and column information for the generated
|
10714
|
+
* source's line and column positions provided. The only argument is an object
|
10715
|
+
* with the following properties:
|
10716
|
+
*
|
10717
|
+
* - line: The line number in the generated source. The line number
|
10718
|
+
* is 1-based.
|
10719
|
+
* - column: The column number in the generated source. The column
|
10720
|
+
* number is 0-based.
|
10721
|
+
*
|
10722
|
+
* and an object is returned with the following properties:
|
10723
|
+
*
|
10724
|
+
* - source: The original source file, or null.
|
10725
|
+
* - line: The line number in the original source, or null. The
|
10726
|
+
* line number is 1-based.
|
10727
|
+
* - column: The column number in the original source, or null. The
|
10728
|
+
* column number is 0-based.
|
10729
|
+
* - name: The original identifier, or null.
|
10730
|
+
*/
|
10731
|
+
originalPositionFor(aArgs) {
|
10732
|
+
const needle = {
|
10733
|
+
generatedLine: util.getArg(aArgs, "line"),
|
10734
|
+
generatedColumn: util.getArg(aArgs, "column")
|
10735
|
+
};
|
10736
|
+
const sectionIndex = binarySearch.search(
|
10737
|
+
needle,
|
10738
|
+
this._sections,
|
10739
|
+
function(aNeedle, section2) {
|
10740
|
+
const cmp = aNeedle.generatedLine - section2.generatedOffset.generatedLine;
|
10741
|
+
if (cmp) {
|
10742
|
+
return cmp;
|
10743
|
+
}
|
10744
|
+
return aNeedle.generatedColumn - section2.generatedOffset.generatedColumn;
|
10745
|
+
}
|
10746
|
+
);
|
10747
|
+
const section = this._sections[sectionIndex];
|
10748
|
+
if (!section) {
|
10749
|
+
return {
|
10750
|
+
source: null,
|
10751
|
+
line: null,
|
10752
|
+
column: null,
|
10753
|
+
name: null
|
10754
|
+
};
|
10755
|
+
}
|
10756
|
+
return section.consumer.originalPositionFor({
|
10757
|
+
line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
|
10758
|
+
column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
|
10759
|
+
bias: aArgs.bias
|
10760
|
+
});
|
10761
|
+
}
|
10762
|
+
/**
|
10763
|
+
* Return true if we have the source content for every source in the source
|
10764
|
+
* map, false otherwise.
|
10765
|
+
*/
|
10766
|
+
hasContentsOfAllSources() {
|
10767
|
+
return this._sections.every(function(s) {
|
10768
|
+
return s.consumer.hasContentsOfAllSources();
|
10769
|
+
});
|
10770
|
+
}
|
10771
|
+
/**
|
10772
|
+
* Returns the original source content. The only argument is the url of the
|
10773
|
+
* original source file. Returns null if no original source content is
|
10774
|
+
* available.
|
10775
|
+
*/
|
10776
|
+
sourceContentFor(aSource, nullOnMissing) {
|
10777
|
+
for (let i = 0; i < this._sections.length; i++) {
|
10778
|
+
const section = this._sections[i];
|
10779
|
+
const content = section.consumer.sourceContentFor(aSource, true);
|
10780
|
+
if (content) {
|
10781
|
+
return content;
|
10782
|
+
}
|
10783
|
+
}
|
10784
|
+
if (nullOnMissing) {
|
10785
|
+
return null;
|
10786
|
+
}
|
10787
|
+
throw new Error('"' + aSource + '" is not in the SourceMap.');
|
10788
|
+
}
|
10789
|
+
/**
|
10790
|
+
* Returns the generated line and column information for the original source,
|
10791
|
+
* line, and column positions provided. The only argument is an object with
|
10792
|
+
* the following properties:
|
10793
|
+
*
|
10794
|
+
* - source: The filename of the original source.
|
10795
|
+
* - line: The line number in the original source. The line number
|
10796
|
+
* is 1-based.
|
10797
|
+
* - column: The column number in the original source. The column
|
10798
|
+
* number is 0-based.
|
10799
|
+
*
|
10800
|
+
* and an object is returned with the following properties:
|
10801
|
+
*
|
10802
|
+
* - line: The line number in the generated source, or null. The
|
10803
|
+
* line number is 1-based.
|
10804
|
+
* - column: The column number in the generated source, or null.
|
10805
|
+
* The column number is 0-based.
|
10806
|
+
*/
|
10807
|
+
generatedPositionFor(aArgs) {
|
10808
|
+
for (let i = 0; i < this._sections.length; i++) {
|
10809
|
+
const section = this._sections[i];
|
10810
|
+
if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) === -1) {
|
10811
|
+
continue;
|
10812
|
+
}
|
10813
|
+
const generatedPosition = section.consumer.generatedPositionFor(aArgs);
|
10814
|
+
if (generatedPosition) {
|
10815
|
+
const ret = {
|
10816
|
+
line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
|
10817
|
+
column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
|
10818
|
+
};
|
10819
|
+
return ret;
|
10820
|
+
}
|
10821
|
+
}
|
10822
|
+
return {
|
10823
|
+
line: null,
|
10824
|
+
column: null
|
10825
|
+
};
|
10826
|
+
}
|
10827
|
+
/**
|
10828
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
10829
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
10830
|
+
* `this.__originalMappings` properties).
|
10831
|
+
*/
|
10832
|
+
_parseMappings(aStr, aSourceRoot) {
|
10833
|
+
const generatedMappings = this.__generatedMappingsUnsorted = [];
|
10834
|
+
const originalMappings = this.__originalMappingsUnsorted = [];
|
10835
|
+
for (let i = 0; i < this._sections.length; i++) {
|
10836
|
+
const section = this._sections[i];
|
10837
|
+
const sectionMappings = [];
|
10838
|
+
section.consumer.eachMapping((m) => sectionMappings.push(m));
|
10839
|
+
for (let j = 0; j < sectionMappings.length; j++) {
|
10840
|
+
const mapping = sectionMappings[j];
|
10841
|
+
let source = util.computeSourceURL(section.consumer.sourceRoot, null, this._sourceMapURL);
|
10842
|
+
this._sources.add(source);
|
10843
|
+
source = this._sources.indexOf(source);
|
10844
|
+
let name = null;
|
10845
|
+
if (mapping.name) {
|
10846
|
+
this._names.add(mapping.name);
|
10847
|
+
name = this._names.indexOf(mapping.name);
|
10848
|
+
}
|
10849
|
+
const adjustedMapping = {
|
10850
|
+
source,
|
10851
|
+
generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
|
10852
|
+
generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
|
10853
|
+
originalLine: mapping.originalLine,
|
10854
|
+
originalColumn: mapping.originalColumn,
|
10855
|
+
name
|
10856
|
+
};
|
10857
|
+
generatedMappings.push(adjustedMapping);
|
10858
|
+
if (typeof adjustedMapping.originalLine === "number") {
|
10859
|
+
originalMappings.push(adjustedMapping);
|
10860
|
+
}
|
10861
|
+
}
|
10862
|
+
}
|
10863
|
+
}
|
10864
|
+
eachMapping(aCallback, aContext, aOrder) {
|
10865
|
+
const context = aContext || null;
|
10866
|
+
const order = aOrder || SourceMapConsumer2.GENERATED_ORDER;
|
10867
|
+
let mappings;
|
10868
|
+
switch (order) {
|
10869
|
+
case SourceMapConsumer2.GENERATED_ORDER:
|
10870
|
+
mappings = this._generatedMappings;
|
10871
|
+
break;
|
10872
|
+
case SourceMapConsumer2.ORIGINAL_ORDER:
|
10873
|
+
mappings = this._originalMappings;
|
10874
|
+
break;
|
10875
|
+
default:
|
10876
|
+
throw new Error("Unknown order of iteration.");
|
10877
|
+
}
|
10878
|
+
const sourceRoot = this.sourceRoot;
|
10879
|
+
mappings.map(function(mapping) {
|
10880
|
+
let source = null;
|
10881
|
+
if (mapping.source !== null) {
|
10882
|
+
source = this._sources.at(mapping.source);
|
10883
|
+
source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
|
10884
|
+
}
|
10885
|
+
return {
|
10886
|
+
source,
|
10887
|
+
generatedLine: mapping.generatedLine,
|
10888
|
+
generatedColumn: mapping.generatedColumn,
|
10889
|
+
originalLine: mapping.originalLine,
|
10890
|
+
originalColumn: mapping.originalColumn,
|
10891
|
+
name: mapping.name === null ? null : this._names.at(mapping.name)
|
10892
|
+
};
|
10893
|
+
}, this).forEach(aCallback, context);
|
10894
|
+
}
|
10895
|
+
/**
|
10896
|
+
* Find the mapping that best matches the hypothetical "needle" mapping that
|
10897
|
+
* we are searching for in the given "haystack" of mappings.
|
10898
|
+
*/
|
10899
|
+
_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
|
10900
|
+
if (aNeedle[aLineName] <= 0) {
|
10901
|
+
throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]);
|
10902
|
+
}
|
10903
|
+
if (aNeedle[aColumnName] < 0) {
|
10904
|
+
throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]);
|
10905
|
+
}
|
10906
|
+
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
|
10907
|
+
}
|
10908
|
+
allGeneratedPositionsFor(aArgs) {
|
10909
|
+
const line = util.getArg(aArgs, "line");
|
10910
|
+
const needle = {
|
10911
|
+
source: util.getArg(aArgs, "source"),
|
10912
|
+
originalLine: line,
|
10913
|
+
originalColumn: util.getArg(aArgs, "column", 0)
|
10914
|
+
};
|
10915
|
+
needle.source = this._findSourceIndex(needle.source);
|
10916
|
+
if (needle.source < 0) {
|
10917
|
+
return [];
|
10918
|
+
}
|
10919
|
+
if (needle.originalLine < 1) {
|
10920
|
+
throw new Error("Line numbers must be >= 1");
|
10921
|
+
}
|
10922
|
+
if (needle.originalColumn < 0) {
|
10923
|
+
throw new Error("Column numbers must be >= 0");
|
10924
|
+
}
|
10925
|
+
const mappings = [];
|
10926
|
+
let index = this._findMapping(
|
10927
|
+
needle,
|
10928
|
+
this._originalMappings,
|
10929
|
+
"originalLine",
|
10930
|
+
"originalColumn",
|
10931
|
+
util.compareByOriginalPositions,
|
10932
|
+
binarySearch.LEAST_UPPER_BOUND
|
10933
|
+
);
|
10934
|
+
if (index >= 0) {
|
10935
|
+
let mapping = this._originalMappings[index];
|
10936
|
+
if (aArgs.column === void 0) {
|
10937
|
+
const originalLine = mapping.originalLine;
|
10938
|
+
while (mapping && mapping.originalLine === originalLine) {
|
10939
|
+
let lastColumn = mapping.lastGeneratedColumn;
|
10940
|
+
if (this._computedColumnSpans && lastColumn === null) {
|
10941
|
+
lastColumn = Infinity;
|
10942
|
+
}
|
10943
|
+
mappings.push({
|
10944
|
+
line: util.getArg(mapping, "generatedLine", null),
|
10945
|
+
column: util.getArg(mapping, "generatedColumn", null),
|
10946
|
+
lastColumn
|
10947
|
+
});
|
10948
|
+
mapping = this._originalMappings[++index];
|
10949
|
+
}
|
10950
|
+
} else {
|
10951
|
+
const originalColumn = mapping.originalColumn;
|
10952
|
+
while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
|
10953
|
+
let lastColumn = mapping.lastGeneratedColumn;
|
10954
|
+
if (this._computedColumnSpans && lastColumn === null) {
|
10955
|
+
lastColumn = Infinity;
|
10956
|
+
}
|
10957
|
+
mappings.push({
|
10958
|
+
line: util.getArg(mapping, "generatedLine", null),
|
10959
|
+
column: util.getArg(mapping, "generatedColumn", null),
|
10960
|
+
lastColumn
|
10961
|
+
});
|
10962
|
+
mapping = this._originalMappings[++index];
|
10963
|
+
}
|
10964
|
+
}
|
10965
|
+
}
|
10966
|
+
return mappings;
|
10967
|
+
}
|
10968
|
+
destroy() {
|
10969
|
+
for (let i = 0; i < this._sections.length; i++) {
|
10970
|
+
this._sections[i].consumer.destroy();
|
10971
|
+
}
|
10972
|
+
}
|
10973
|
+
};
|
10974
|
+
exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
|
10975
|
+
function _factory(aSourceMap, aSourceMapURL) {
|
10976
|
+
let sourceMap = aSourceMap;
|
10977
|
+
if (typeof aSourceMap === "string") {
|
10978
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
10979
|
+
}
|
10980
|
+
const consumer = sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
|
10981
|
+
return Promise.resolve(consumer);
|
10982
|
+
}
|
10983
|
+
function _factoryBSM(aSourceMap, aSourceMapURL) {
|
10984
|
+
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
|
10985
|
+
}
|
10986
|
+
}
|
10987
|
+
});
|
10988
|
+
|
10989
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-node.js
|
10990
|
+
var require_source_node = __commonJS({
|
10991
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-node.js"(exports) {
|
10992
|
+
var SourceMapGenerator2 = require_source_map_generator().SourceMapGenerator;
|
10993
|
+
var util = require_util();
|
10994
|
+
var REGEX_NEWLINE = /(\r?\n)/;
|
10995
|
+
var NEWLINE_CODE = 10;
|
10996
|
+
var isSourceNode = "$$$isSourceNode$$$";
|
10997
|
+
var SourceNode = class _SourceNode {
|
10998
|
+
constructor(aLine, aColumn, aSource, aChunks, aName) {
|
10999
|
+
this.children = [];
|
11000
|
+
this.sourceContents = {};
|
11001
|
+
this.line = aLine == null ? null : aLine;
|
11002
|
+
this.column = aColumn == null ? null : aColumn;
|
11003
|
+
this.source = aSource == null ? null : aSource;
|
11004
|
+
this.name = aName == null ? null : aName;
|
11005
|
+
this[isSourceNode] = true;
|
11006
|
+
if (aChunks != null)
|
11007
|
+
this.add(aChunks);
|
11008
|
+
}
|
11009
|
+
/**
|
11010
|
+
* Creates a SourceNode from generated code and a SourceMapConsumer.
|
11011
|
+
*
|
11012
|
+
* @param aGeneratedCode The generated code
|
11013
|
+
* @param aSourceMapConsumer The SourceMap for the generated code
|
11014
|
+
* @param aRelativePath Optional. The path that relative sources in the
|
11015
|
+
* SourceMapConsumer should be relative to.
|
11016
|
+
*/
|
11017
|
+
static fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
|
11018
|
+
const node = new _SourceNode();
|
11019
|
+
const remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
|
11020
|
+
let remainingLinesIndex = 0;
|
11021
|
+
const shiftNextLine = function() {
|
11022
|
+
const lineContents = getNextLine();
|
11023
|
+
const newLine = getNextLine() || "";
|
11024
|
+
return lineContents + newLine;
|
11025
|
+
function getNextLine() {
|
11026
|
+
return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
|
11027
|
+
}
|
11028
|
+
};
|
11029
|
+
let lastGeneratedLine = 1, lastGeneratedColumn = 0;
|
11030
|
+
let lastMapping = null;
|
11031
|
+
let nextLine;
|
11032
|
+
aSourceMapConsumer.eachMapping(function(mapping) {
|
11033
|
+
if (lastMapping !== null) {
|
11034
|
+
if (lastGeneratedLine < mapping.generatedLine) {
|
11035
|
+
addMappingWithCode(lastMapping, shiftNextLine());
|
11036
|
+
lastGeneratedLine++;
|
11037
|
+
lastGeneratedColumn = 0;
|
11038
|
+
} else {
|
11039
|
+
nextLine = remainingLines[remainingLinesIndex] || "";
|
11040
|
+
const code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
|
11041
|
+
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
|
11042
|
+
lastGeneratedColumn = mapping.generatedColumn;
|
11043
|
+
addMappingWithCode(lastMapping, code);
|
11044
|
+
lastMapping = mapping;
|
11045
|
+
return;
|
11046
|
+
}
|
11047
|
+
}
|
11048
|
+
while (lastGeneratedLine < mapping.generatedLine) {
|
11049
|
+
node.add(shiftNextLine());
|
11050
|
+
lastGeneratedLine++;
|
11051
|
+
}
|
11052
|
+
if (lastGeneratedColumn < mapping.generatedColumn) {
|
11053
|
+
nextLine = remainingLines[remainingLinesIndex] || "";
|
11054
|
+
node.add(nextLine.substr(0, mapping.generatedColumn));
|
11055
|
+
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
|
11056
|
+
lastGeneratedColumn = mapping.generatedColumn;
|
11057
|
+
}
|
11058
|
+
lastMapping = mapping;
|
11059
|
+
}, this);
|
11060
|
+
if (remainingLinesIndex < remainingLines.length) {
|
11061
|
+
if (lastMapping) {
|
11062
|
+
addMappingWithCode(lastMapping, shiftNextLine());
|
11063
|
+
}
|
11064
|
+
node.add(remainingLines.splice(remainingLinesIndex).join(""));
|
11065
|
+
}
|
11066
|
+
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
11067
|
+
const content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
11068
|
+
if (content != null) {
|
11069
|
+
if (aRelativePath != null) {
|
11070
|
+
sourceFile = util.join(aRelativePath, sourceFile);
|
11071
|
+
}
|
11072
|
+
node.setSourceContent(sourceFile, content);
|
11073
|
+
}
|
11074
|
+
});
|
11075
|
+
return node;
|
11076
|
+
function addMappingWithCode(mapping, code) {
|
11077
|
+
if (mapping === null || mapping.source === void 0) {
|
11078
|
+
node.add(code);
|
11079
|
+
} else {
|
11080
|
+
const source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
|
11081
|
+
node.add(new _SourceNode(
|
11082
|
+
mapping.originalLine,
|
11083
|
+
mapping.originalColumn,
|
11084
|
+
source,
|
11085
|
+
code,
|
11086
|
+
mapping.name
|
11087
|
+
));
|
11088
|
+
}
|
11089
|
+
}
|
11090
|
+
}
|
11091
|
+
/**
|
11092
|
+
* Add a chunk of generated JS to this source node.
|
11093
|
+
*
|
11094
|
+
* @param aChunk A string snippet of generated JS code, another instance of
|
11095
|
+
* SourceNode, or an array where each member is one of those things.
|
11096
|
+
*/
|
11097
|
+
add(aChunk) {
|
11098
|
+
if (Array.isArray(aChunk)) {
|
11099
|
+
aChunk.forEach(function(chunk) {
|
11100
|
+
this.add(chunk);
|
11101
|
+
}, this);
|
11102
|
+
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
11103
|
+
if (aChunk) {
|
11104
|
+
this.children.push(aChunk);
|
11105
|
+
}
|
11106
|
+
} else {
|
11107
|
+
throw new TypeError(
|
11108
|
+
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
11109
|
+
);
|
11110
|
+
}
|
11111
|
+
return this;
|
11112
|
+
}
|
11113
|
+
/**
|
11114
|
+
* Add a chunk of generated JS to the beginning of this source node.
|
11115
|
+
*
|
11116
|
+
* @param aChunk A string snippet of generated JS code, another instance of
|
11117
|
+
* SourceNode, or an array where each member is one of those things.
|
11118
|
+
*/
|
11119
|
+
prepend(aChunk) {
|
11120
|
+
if (Array.isArray(aChunk)) {
|
11121
|
+
for (let i = aChunk.length - 1; i >= 0; i--) {
|
11122
|
+
this.prepend(aChunk[i]);
|
11123
|
+
}
|
11124
|
+
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
11125
|
+
this.children.unshift(aChunk);
|
11126
|
+
} else {
|
11127
|
+
throw new TypeError(
|
11128
|
+
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
11129
|
+
);
|
11130
|
+
}
|
11131
|
+
return this;
|
11132
|
+
}
|
11133
|
+
/**
|
11134
|
+
* Walk over the tree of JS snippets in this node and its children. The
|
11135
|
+
* walking function is called once for each snippet of JS and is passed that
|
11136
|
+
* snippet and the its original associated source's line/column location.
|
11137
|
+
*
|
11138
|
+
* @param aFn The traversal function.
|
11139
|
+
*/
|
11140
|
+
walk(aFn) {
|
11141
|
+
let chunk;
|
11142
|
+
for (let i = 0, len = this.children.length; i < len; i++) {
|
11143
|
+
chunk = this.children[i];
|
11144
|
+
if (chunk[isSourceNode]) {
|
11145
|
+
chunk.walk(aFn);
|
11146
|
+
} else if (chunk !== "") {
|
11147
|
+
aFn(chunk, {
|
11148
|
+
source: this.source,
|
11149
|
+
line: this.line,
|
11150
|
+
column: this.column,
|
11151
|
+
name: this.name
|
11152
|
+
});
|
11153
|
+
}
|
11154
|
+
}
|
11155
|
+
}
|
11156
|
+
/**
|
11157
|
+
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
|
11158
|
+
* each of `this.children`.
|
11159
|
+
*
|
11160
|
+
* @param aSep The separator.
|
11161
|
+
*/
|
11162
|
+
join(aSep) {
|
11163
|
+
let newChildren;
|
11164
|
+
let i;
|
11165
|
+
const len = this.children.length;
|
11166
|
+
if (len > 0) {
|
11167
|
+
newChildren = [];
|
11168
|
+
for (i = 0; i < len - 1; i++) {
|
11169
|
+
newChildren.push(this.children[i]);
|
11170
|
+
newChildren.push(aSep);
|
11171
|
+
}
|
11172
|
+
newChildren.push(this.children[i]);
|
11173
|
+
this.children = newChildren;
|
11174
|
+
}
|
11175
|
+
return this;
|
11176
|
+
}
|
11177
|
+
/**
|
11178
|
+
* Call String.prototype.replace on the very right-most source snippet. Useful
|
11179
|
+
* for trimming whitespace from the end of a source node, etc.
|
11180
|
+
*
|
11181
|
+
* @param aPattern The pattern to replace.
|
11182
|
+
* @param aReplacement The thing to replace the pattern with.
|
11183
|
+
*/
|
11184
|
+
replaceRight(aPattern, aReplacement) {
|
11185
|
+
const lastChild = this.children[this.children.length - 1];
|
11186
|
+
if (lastChild[isSourceNode]) {
|
11187
|
+
lastChild.replaceRight(aPattern, aReplacement);
|
11188
|
+
} else if (typeof lastChild === "string") {
|
11189
|
+
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
|
11190
|
+
} else {
|
11191
|
+
this.children.push("".replace(aPattern, aReplacement));
|
11192
|
+
}
|
11193
|
+
return this;
|
11194
|
+
}
|
11195
|
+
/**
|
11196
|
+
* Set the source content for a source file. This will be added to the SourceMapGenerator
|
11197
|
+
* in the sourcesContent field.
|
11198
|
+
*
|
11199
|
+
* @param aSourceFile The filename of the source file
|
11200
|
+
* @param aSourceContent The content of the source file
|
11201
|
+
*/
|
11202
|
+
setSourceContent(aSourceFile, aSourceContent) {
|
11203
|
+
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
|
11204
|
+
}
|
11205
|
+
/**
|
11206
|
+
* Walk over the tree of SourceNodes. The walking function is called for each
|
11207
|
+
* source file content and is passed the filename and source content.
|
11208
|
+
*
|
11209
|
+
* @param aFn The traversal function.
|
11210
|
+
*/
|
11211
|
+
walkSourceContents(aFn) {
|
11212
|
+
for (let i = 0, len = this.children.length; i < len; i++) {
|
11213
|
+
if (this.children[i][isSourceNode]) {
|
11214
|
+
this.children[i].walkSourceContents(aFn);
|
11215
|
+
}
|
11216
|
+
}
|
11217
|
+
const sources = Object.keys(this.sourceContents);
|
11218
|
+
for (let i = 0, len = sources.length; i < len; i++) {
|
11219
|
+
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
|
11220
|
+
}
|
11221
|
+
}
|
11222
|
+
/**
|
11223
|
+
* Return the string representation of this source node. Walks over the tree
|
11224
|
+
* and concatenates all the various snippets together to one string.
|
11225
|
+
*/
|
11226
|
+
toString() {
|
11227
|
+
let str = "";
|
11228
|
+
this.walk(function(chunk) {
|
11229
|
+
str += chunk;
|
11230
|
+
});
|
11231
|
+
return str;
|
11232
|
+
}
|
11233
|
+
/**
|
11234
|
+
* Returns the string representation of this source node along with a source
|
11235
|
+
* map.
|
11236
|
+
*/
|
11237
|
+
toStringWithSourceMap(aArgs) {
|
11238
|
+
const generated = {
|
11239
|
+
code: "",
|
11240
|
+
line: 1,
|
11241
|
+
column: 0
|
11242
|
+
};
|
11243
|
+
const map = new SourceMapGenerator2(aArgs);
|
11244
|
+
let sourceMappingActive = false;
|
11245
|
+
let lastOriginalSource = null;
|
11246
|
+
let lastOriginalLine = null;
|
11247
|
+
let lastOriginalColumn = null;
|
11248
|
+
let lastOriginalName = null;
|
11249
|
+
this.walk(function(chunk, original) {
|
11250
|
+
generated.code += chunk;
|
11251
|
+
if (original.source !== null && original.line !== null && original.column !== null) {
|
11252
|
+
if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
|
11253
|
+
map.addMapping({
|
11254
|
+
source: original.source,
|
11255
|
+
original: {
|
11256
|
+
line: original.line,
|
11257
|
+
column: original.column
|
11258
|
+
},
|
11259
|
+
generated: {
|
11260
|
+
line: generated.line,
|
11261
|
+
column: generated.column
|
11262
|
+
},
|
11263
|
+
name: original.name
|
11264
|
+
});
|
11265
|
+
}
|
11266
|
+
lastOriginalSource = original.source;
|
11267
|
+
lastOriginalLine = original.line;
|
11268
|
+
lastOriginalColumn = original.column;
|
11269
|
+
lastOriginalName = original.name;
|
11270
|
+
sourceMappingActive = true;
|
11271
|
+
} else if (sourceMappingActive) {
|
11272
|
+
map.addMapping({
|
11273
|
+
generated: {
|
11274
|
+
line: generated.line,
|
11275
|
+
column: generated.column
|
11276
|
+
}
|
11277
|
+
});
|
11278
|
+
lastOriginalSource = null;
|
11279
|
+
sourceMappingActive = false;
|
11280
|
+
}
|
11281
|
+
for (let idx = 0, length = chunk.length; idx < length; idx++) {
|
11282
|
+
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
|
11283
|
+
generated.line++;
|
11284
|
+
generated.column = 0;
|
11285
|
+
if (idx + 1 === length) {
|
11286
|
+
lastOriginalSource = null;
|
11287
|
+
sourceMappingActive = false;
|
11288
|
+
} else if (sourceMappingActive) {
|
11289
|
+
map.addMapping({
|
11290
|
+
source: original.source,
|
11291
|
+
original: {
|
11292
|
+
line: original.line,
|
11293
|
+
column: original.column
|
11294
|
+
},
|
11295
|
+
generated: {
|
11296
|
+
line: generated.line,
|
11297
|
+
column: generated.column
|
11298
|
+
},
|
11299
|
+
name: original.name
|
11300
|
+
});
|
11301
|
+
}
|
11302
|
+
} else {
|
11303
|
+
generated.column++;
|
11304
|
+
}
|
11305
|
+
}
|
11306
|
+
});
|
11307
|
+
this.walkSourceContents(function(sourceFile, sourceContent) {
|
11308
|
+
map.setSourceContent(sourceFile, sourceContent);
|
11309
|
+
});
|
11310
|
+
return { code: generated.code, map };
|
11311
|
+
}
|
11312
|
+
};
|
11313
|
+
exports.SourceNode = SourceNode;
|
11314
|
+
}
|
11315
|
+
});
|
11316
|
+
|
11317
|
+
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/source-map.js
|
11318
|
+
var require_source_map = __commonJS({
|
11319
|
+
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/source-map.js"(exports) {
|
11320
|
+
exports.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
|
11321
|
+
exports.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
|
11322
|
+
exports.SourceNode = require_source_node().SourceNode;
|
11323
|
+
}
|
11324
|
+
});
|
11325
|
+
|
9008
11326
|
// ../../node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js
|
9009
11327
|
var require_safe_buffer = __commonJS({
|
9010
11328
|
"../../node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js"(exports, module2) {
|
@@ -9418,6 +11736,7 @@ var import_fs_extra2 = __toESM(require_lib2());
|
|
9418
11736
|
var import_webpack_sources2 = __toESM(require_lib3());
|
9419
11737
|
|
9420
11738
|
// src/sourcemapped.ts
|
11739
|
+
var import_source_map = __toESM(require_source_map());
|
9421
11740
|
var import_convert_source_map = __toESM(require_convert_source_map());
|
9422
11741
|
var import_fs_extra = __toESM(require_lib2());
|
9423
11742
|
var import_webpack_sources = __toESM(require_lib3());
|
@@ -9442,15 +11761,24 @@ async function fileToSource(content, sourceName, fullFilePath) {
|
|
9442
11761
|
return sourcemap ? new import_webpack_sources.SourceMapSource(cleanContent, sourceName, sourcemap) : new import_webpack_sources.OriginalSource(cleanContent, sourceName);
|
9443
11762
|
}
|
9444
11763
|
async function getSourceMap(content, fullFilePath) {
|
11764
|
+
let map;
|
9445
11765
|
try {
|
9446
11766
|
if (fullFilePath && await import_fs_extra.default.pathExists(`${fullFilePath}.map`)) {
|
9447
11767
|
const mapJson = await import_fs_extra.default.readFile(`${fullFilePath}.map`, "utf8");
|
9448
|
-
|
11768
|
+
map = import_convert_source_map.default.fromJSON(mapJson).toObject();
|
11769
|
+
} else {
|
11770
|
+
map = import_convert_source_map.default.fromComment(content).toObject();
|
9449
11771
|
}
|
9450
|
-
return import_convert_source_map.default.fromComment(content).toObject();
|
9451
11772
|
} catch {
|
9452
11773
|
return null;
|
9453
11774
|
}
|
11775
|
+
if ("sections" in map) {
|
11776
|
+
return flattenSourceMap(map);
|
11777
|
+
}
|
11778
|
+
return map;
|
11779
|
+
}
|
11780
|
+
async function flattenSourceMap(map) {
|
11781
|
+
return new import_source_map.SourceMapGenerator(await new import_source_map.SourceMapConsumer(map)).toJSON();
|
9454
11782
|
}
|
9455
11783
|
function stringifySourceMap(sourceMap) {
|
9456
11784
|
if (!sourceMap)
|
@@ -9765,14 +12093,6 @@ async function getDynamicRoutes({
|
|
9765
12093
|
),
|
9766
12094
|
dest: route.dest?.replace(/($|\?)/, ".rsc$1")
|
9767
12095
|
});
|
9768
|
-
routes2.push({
|
9769
|
-
...route,
|
9770
|
-
src: route.src.replace(
|
9771
|
-
new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
|
9772
|
-
"(?:\\.action)(?:/)?$"
|
9773
|
-
),
|
9774
|
-
dest: route.dest?.replace(/($|\?)/, ".action$1")
|
9775
|
-
});
|
9776
12096
|
routes2.push(route);
|
9777
12097
|
}
|
9778
12098
|
return routes2;
|
@@ -11989,7 +14309,6 @@ var CORRECT_NOT_FOUND_ROUTES_VERSION = "v12.0.1";
|
|
11989
14309
|
var CORRECT_MIDDLEWARE_ORDER_VERSION = "v12.1.7-canary.29";
|
11990
14310
|
var NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = "v12.1.7-canary.33";
|
11991
14311
|
var EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = "v12.2.0";
|
11992
|
-
var ACTION_OUTPUT_SUPPORT_VERSION = "v14.2.2";
|
11993
14312
|
var CORRECTED_MANIFESTS_VERSION = "v12.2.0";
|
11994
14313
|
var PRELOAD_CHUNKS = {
|
11995
14314
|
APP_ROUTER_PAGES: [
|
@@ -12069,10 +14388,6 @@ async function serverBuild({
|
|
12069
14388
|
nextVersion,
|
12070
14389
|
EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION
|
12071
14390
|
);
|
12072
|
-
const hasActionOutputSupport = import_semver3.default.gte(
|
12073
|
-
nextVersion,
|
12074
|
-
ACTION_OUTPUT_SUPPORT_VERSION
|
12075
|
-
);
|
12076
14391
|
const projectDir = requiredServerFilesManifest.relativeAppDir ? import_path4.default.join(baseDir, requiredServerFilesManifest.relativeAppDir) : requiredServerFilesManifest.appDir || entryPath;
|
12077
14392
|
const inversedAppPathManifest = {};
|
12078
14393
|
if (appPathRoutesManifest) {
|
@@ -12613,19 +14928,11 @@ async function serverBuild({
|
|
12613
14928
|
pageExtensions,
|
12614
14929
|
inversedAppPathManifest
|
12615
14930
|
});
|
12616
|
-
const appRouterStreamingPrerenderLambdaGroups = [];
|
12617
14931
|
for (const group of appRouterLambdaGroups) {
|
12618
14932
|
if (!group.isPrerenders || group.isExperimentalPPR) {
|
12619
14933
|
group.isStreaming = true;
|
12620
14934
|
}
|
12621
14935
|
group.isAppRouter = true;
|
12622
|
-
if (hasActionOutputSupport && group.isPrerenders && !group.isStreaming && !group.isExperimentalPPR) {
|
12623
|
-
appRouterStreamingPrerenderLambdaGroups.push({
|
12624
|
-
...group,
|
12625
|
-
isActionPrerender: true,
|
12626
|
-
isStreaming: true
|
12627
|
-
});
|
12628
|
-
}
|
12629
14936
|
}
|
12630
14937
|
for (const group of appRouteHandlersLambdaGroups) {
|
12631
14938
|
if (!group.isPrerenders) {
|
@@ -12673,12 +14980,6 @@ async function serverBuild({
|
|
12673
14980
|
pseudoLayerBytes: group.pseudoLayerBytes,
|
12674
14981
|
uncompressedLayerBytes: group.pseudoLayerUncompressedBytes
|
12675
14982
|
})),
|
12676
|
-
appRouterStreamingPrerenderLambdaGroups: appRouterStreamingPrerenderLambdaGroups.map((group) => ({
|
12677
|
-
pages: group.pages,
|
12678
|
-
isPrerender: group.isPrerenders,
|
12679
|
-
pseudoLayerBytes: group.pseudoLayerBytes,
|
12680
|
-
uncompressedLayerBytes: group.pseudoLayerUncompressedBytes
|
12681
|
-
})),
|
12682
14983
|
appRouteHandlersLambdaGroups: appRouteHandlersLambdaGroups.map(
|
12683
14984
|
(group) => ({
|
12684
14985
|
pages: group.pages,
|
@@ -12696,7 +14997,6 @@ async function serverBuild({
|
|
12696
14997
|
const combinedGroups = [
|
12697
14998
|
...pageLambdaGroups,
|
12698
14999
|
...appRouterLambdaGroups,
|
12699
|
-
...appRouterStreamingPrerenderLambdaGroups,
|
12700
15000
|
...apiLambdaGroups,
|
12701
15001
|
...appRouteHandlersLambdaGroups
|
12702
15002
|
];
|
@@ -12843,9 +15143,6 @@ async function serverBuild({
|
|
12843
15143
|
});
|
12844
15144
|
}
|
12845
15145
|
let outputName = import_path4.default.posix.join(entryDirectory, pageName);
|
12846
|
-
if (group.isActionPrerender) {
|
12847
|
-
outputName = `${outputName}.action`;
|
12848
|
-
}
|
12849
15146
|
if (isPPR) {
|
12850
15147
|
if (!revalidate) {
|
12851
15148
|
throw new Error("Invariant: PPR lambda isn't set");
|
@@ -13385,70 +15682,6 @@ async function serverBuild({
|
|
13385
15682
|
override: true
|
13386
15683
|
}
|
13387
15684
|
] : [],
|
13388
|
-
...hasActionOutputSupport ? [
|
13389
|
-
// Create rewrites for streaming prerenders (.action routes)
|
13390
|
-
// This contains separate rewrites for each possible "has" (action header, or content-type)
|
13391
|
-
// Also includes separate handling for index routes which should match to /index.action.
|
13392
|
-
// This follows the same pattern as the rewrites for .rsc files.
|
13393
|
-
{
|
13394
|
-
src: `^${import_path4.default.posix.join("/", entryDirectory, "/")}`,
|
13395
|
-
dest: import_path4.default.posix.join("/", entryDirectory, "/index.action"),
|
13396
|
-
has: [
|
13397
|
-
{
|
13398
|
-
type: "header",
|
13399
|
-
key: "next-action"
|
13400
|
-
}
|
13401
|
-
],
|
13402
|
-
continue: true,
|
13403
|
-
override: true
|
13404
|
-
},
|
13405
|
-
{
|
13406
|
-
src: `^${import_path4.default.posix.join("/", entryDirectory, "/")}`,
|
13407
|
-
dest: import_path4.default.posix.join("/", entryDirectory, "/index.action"),
|
13408
|
-
has: [
|
13409
|
-
{
|
13410
|
-
type: "header",
|
13411
|
-
key: "content-type",
|
13412
|
-
value: "multipart/form-data;.*"
|
13413
|
-
}
|
13414
|
-
],
|
13415
|
-
continue: true,
|
13416
|
-
override: true
|
13417
|
-
},
|
13418
|
-
{
|
13419
|
-
src: `^${import_path4.default.posix.join(
|
13420
|
-
"/",
|
13421
|
-
entryDirectory,
|
13422
|
-
"/((?!.+\\.action).+?)(?:/)?$"
|
13423
|
-
)}`,
|
13424
|
-
dest: import_path4.default.posix.join("/", entryDirectory, "/$1.action"),
|
13425
|
-
has: [
|
13426
|
-
{
|
13427
|
-
type: "header",
|
13428
|
-
key: "next-action"
|
13429
|
-
}
|
13430
|
-
],
|
13431
|
-
continue: true,
|
13432
|
-
override: true
|
13433
|
-
},
|
13434
|
-
{
|
13435
|
-
src: `^${import_path4.default.posix.join(
|
13436
|
-
"/",
|
13437
|
-
entryDirectory,
|
13438
|
-
"/((?!.+\\.action).+?)(?:/)?$"
|
13439
|
-
)}`,
|
13440
|
-
dest: import_path4.default.posix.join("/", entryDirectory, "/$1.action"),
|
13441
|
-
has: [
|
13442
|
-
{
|
13443
|
-
type: "header",
|
13444
|
-
key: "content-type",
|
13445
|
-
value: "multipart/form-data;.*"
|
13446
|
-
}
|
13447
|
-
],
|
13448
|
-
continue: true,
|
13449
|
-
override: true
|
13450
|
-
}
|
13451
|
-
] : [],
|
13452
15685
|
{
|
13453
15686
|
src: `^${import_path4.default.posix.join("/", entryDirectory, "/")}`,
|
13454
15687
|
has: [
|