@gapi/gcli 1.8.208 → 1.8.210
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/README.md +8 -0
- package/build.js +1 -0
- package/package.json +1 -1
- package/release/index.js +15 -2333
package/release/index.js
CHANGED
|
@@ -29982,7 +29982,7 @@ var require_buffer_list = __commonJS({
|
|
|
29982
29982
|
}
|
|
29983
29983
|
}, {
|
|
29984
29984
|
key: "join",
|
|
29985
|
-
value: function
|
|
29985
|
+
value: function join(s2) {
|
|
29986
29986
|
if (this.length === 0) return "";
|
|
29987
29987
|
var p = this.head;
|
|
29988
29988
|
var ret = "" + p.data;
|
|
@@ -33000,7 +33000,7 @@ var require_buffer_list2 = __commonJS({
|
|
|
33000
33000
|
}
|
|
33001
33001
|
}, {
|
|
33002
33002
|
key: "join",
|
|
33003
|
-
value: function
|
|
33003
|
+
value: function join(s2) {
|
|
33004
33004
|
if (this.length === 0) return "";
|
|
33005
33005
|
var p = this.head;
|
|
33006
33006
|
var ret = "" + p.data;
|
|
@@ -37447,7 +37447,7 @@ var require_util = __commonJS({
|
|
|
37447
37447
|
return path2;
|
|
37448
37448
|
}
|
|
37449
37449
|
exports2.normalize = normalize;
|
|
37450
|
-
function
|
|
37450
|
+
function join(aRoot, aPath) {
|
|
37451
37451
|
if (aRoot === "") {
|
|
37452
37452
|
aRoot = ".";
|
|
37453
37453
|
}
|
|
@@ -37479,7 +37479,7 @@ var require_util = __commonJS({
|
|
|
37479
37479
|
}
|
|
37480
37480
|
return joined;
|
|
37481
37481
|
}
|
|
37482
|
-
exports2.join =
|
|
37482
|
+
exports2.join = join;
|
|
37483
37483
|
exports2.isAbsolute = function(aPath) {
|
|
37484
37484
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
37485
37485
|
};
|
|
@@ -37652,7 +37652,7 @@ var require_util = __commonJS({
|
|
|
37652
37652
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
37653
37653
|
}
|
|
37654
37654
|
}
|
|
37655
|
-
sourceURL =
|
|
37655
|
+
sourceURL = join(urlGenerate(parsed), sourceURL);
|
|
37656
37656
|
}
|
|
37657
37657
|
return normalize(sourceURL);
|
|
37658
37658
|
}
|
|
@@ -252149,7 +252149,7 @@ ${file2}:${line}:${column}: ERROR: ${pluginText}${e2.text}`;
|
|
|
252149
252149
|
const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
|
|
252150
252150
|
return path2.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path2.basename(subpath)}`);
|
|
252151
252151
|
}
|
|
252152
|
-
function
|
|
252152
|
+
function generateBinPath() {
|
|
252153
252153
|
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
|
252154
252154
|
if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
|
|
252155
252155
|
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
|
@@ -252287,7 +252287,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
252287
252287
|
if (false) {
|
|
252288
252288
|
return ["node", [path22.join(__dirname, "..", "bin", "esbuild")]];
|
|
252289
252289
|
} else {
|
|
252290
|
-
const { binPath, isWASM } =
|
|
252290
|
+
const { binPath, isWASM } = generateBinPath();
|
|
252291
252291
|
if (isWASM) {
|
|
252292
252292
|
return ["node", [binPath]];
|
|
252293
252293
|
} else {
|
|
@@ -255326,2322 +255326,6 @@ var init_load_spec = __esm({
|
|
|
255326
255326
|
}
|
|
255327
255327
|
});
|
|
255328
255328
|
|
|
255329
|
-
// ../../node_modules/esbuild-wasm/lib/main.js
|
|
255330
|
-
var require_main2 = __commonJS({
|
|
255331
|
-
"../../node_modules/esbuild-wasm/lib/main.js"(exports2, module2) {
|
|
255332
|
-
"use strict";
|
|
255333
|
-
var __defProp2 = Object.defineProperty;
|
|
255334
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
255335
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
255336
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
255337
|
-
var __export2 = (target, all) => {
|
|
255338
|
-
for (var name2 in all)
|
|
255339
|
-
__defProp2(target, name2, { get: all[name2], enumerable: true });
|
|
255340
|
-
};
|
|
255341
|
-
var __copyProps2 = (to, from12, except, desc) => {
|
|
255342
|
-
if (from12 && typeof from12 === "object" || typeof from12 === "function") {
|
|
255343
|
-
for (let key of __getOwnPropNames2(from12))
|
|
255344
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
255345
|
-
__defProp2(to, key, { get: () => from12[key], enumerable: !(desc = __getOwnPropDesc2(from12, key)) || desc.enumerable });
|
|
255346
|
-
}
|
|
255347
|
-
return to;
|
|
255348
|
-
};
|
|
255349
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
255350
|
-
var node_exports = {};
|
|
255351
|
-
__export2(node_exports, {
|
|
255352
|
-
analyzeMetafile: () => analyzeMetafile,
|
|
255353
|
-
analyzeMetafileSync: () => analyzeMetafileSync,
|
|
255354
|
-
build: () => build,
|
|
255355
|
-
buildSync: () => buildSync,
|
|
255356
|
-
context: () => context,
|
|
255357
|
-
default: () => node_default,
|
|
255358
|
-
formatMessages: () => formatMessages,
|
|
255359
|
-
formatMessagesSync: () => formatMessagesSync,
|
|
255360
|
-
initialize: () => initialize,
|
|
255361
|
-
stop: () => stop,
|
|
255362
|
-
transform: () => transform2,
|
|
255363
|
-
transformSync: () => transformSync,
|
|
255364
|
-
version: () => version2
|
|
255365
|
-
});
|
|
255366
|
-
module2.exports = __toCommonJS2(node_exports);
|
|
255367
|
-
function encodePacket(packet) {
|
|
255368
|
-
let visit = (value) => {
|
|
255369
|
-
if (value === null) {
|
|
255370
|
-
bb.write8(0);
|
|
255371
|
-
} else if (typeof value === "boolean") {
|
|
255372
|
-
bb.write8(1);
|
|
255373
|
-
bb.write8(+value);
|
|
255374
|
-
} else if (typeof value === "number") {
|
|
255375
|
-
bb.write8(2);
|
|
255376
|
-
bb.write32(value | 0);
|
|
255377
|
-
} else if (typeof value === "string") {
|
|
255378
|
-
bb.write8(3);
|
|
255379
|
-
bb.write(encodeUTF8(value));
|
|
255380
|
-
} else if (value instanceof Uint8Array) {
|
|
255381
|
-
bb.write8(4);
|
|
255382
|
-
bb.write(value);
|
|
255383
|
-
} else if (value instanceof Array) {
|
|
255384
|
-
bb.write8(5);
|
|
255385
|
-
bb.write32(value.length);
|
|
255386
|
-
for (let item of value) {
|
|
255387
|
-
visit(item);
|
|
255388
|
-
}
|
|
255389
|
-
} else {
|
|
255390
|
-
let keys = Object.keys(value);
|
|
255391
|
-
bb.write8(6);
|
|
255392
|
-
bb.write32(keys.length);
|
|
255393
|
-
for (let key of keys) {
|
|
255394
|
-
bb.write(encodeUTF8(key));
|
|
255395
|
-
visit(value[key]);
|
|
255396
|
-
}
|
|
255397
|
-
}
|
|
255398
|
-
};
|
|
255399
|
-
let bb = new ByteBuffer();
|
|
255400
|
-
bb.write32(0);
|
|
255401
|
-
bb.write32(packet.id << 1 | +!packet.isRequest);
|
|
255402
|
-
visit(packet.value);
|
|
255403
|
-
writeUInt32LE(bb.buf, bb.len - 4, 0);
|
|
255404
|
-
return bb.buf.subarray(0, bb.len);
|
|
255405
|
-
}
|
|
255406
|
-
function decodePacket(bytes) {
|
|
255407
|
-
let visit = () => {
|
|
255408
|
-
switch (bb.read8()) {
|
|
255409
|
-
case 0:
|
|
255410
|
-
return null;
|
|
255411
|
-
case 1:
|
|
255412
|
-
return !!bb.read8();
|
|
255413
|
-
case 2:
|
|
255414
|
-
return bb.read32();
|
|
255415
|
-
case 3:
|
|
255416
|
-
return decodeUTF8(bb.read());
|
|
255417
|
-
case 4:
|
|
255418
|
-
return bb.read();
|
|
255419
|
-
case 5: {
|
|
255420
|
-
let count = bb.read32();
|
|
255421
|
-
let value2 = [];
|
|
255422
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
255423
|
-
value2.push(visit());
|
|
255424
|
-
}
|
|
255425
|
-
return value2;
|
|
255426
|
-
}
|
|
255427
|
-
case 6: {
|
|
255428
|
-
let count = bb.read32();
|
|
255429
|
-
let value2 = {};
|
|
255430
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
255431
|
-
value2[decodeUTF8(bb.read())] = visit();
|
|
255432
|
-
}
|
|
255433
|
-
return value2;
|
|
255434
|
-
}
|
|
255435
|
-
default:
|
|
255436
|
-
throw new Error("Invalid packet");
|
|
255437
|
-
}
|
|
255438
|
-
};
|
|
255439
|
-
let bb = new ByteBuffer(bytes);
|
|
255440
|
-
let id = bb.read32();
|
|
255441
|
-
let isRequest2 = (id & 1) === 0;
|
|
255442
|
-
id >>>= 1;
|
|
255443
|
-
let value = visit();
|
|
255444
|
-
if (bb.ptr !== bytes.length) {
|
|
255445
|
-
throw new Error("Invalid packet");
|
|
255446
|
-
}
|
|
255447
|
-
return { id, isRequest: isRequest2, value };
|
|
255448
|
-
}
|
|
255449
|
-
var ByteBuffer = class {
|
|
255450
|
-
constructor(buf = new Uint8Array(1024)) {
|
|
255451
|
-
this.buf = buf;
|
|
255452
|
-
this.len = 0;
|
|
255453
|
-
this.ptr = 0;
|
|
255454
|
-
}
|
|
255455
|
-
_write(delta) {
|
|
255456
|
-
if (this.len + delta > this.buf.length) {
|
|
255457
|
-
let clone3 = new Uint8Array((this.len + delta) * 2);
|
|
255458
|
-
clone3.set(this.buf);
|
|
255459
|
-
this.buf = clone3;
|
|
255460
|
-
}
|
|
255461
|
-
this.len += delta;
|
|
255462
|
-
return this.len - delta;
|
|
255463
|
-
}
|
|
255464
|
-
write8(value) {
|
|
255465
|
-
let offset = this._write(1);
|
|
255466
|
-
this.buf[offset] = value;
|
|
255467
|
-
}
|
|
255468
|
-
write32(value) {
|
|
255469
|
-
let offset = this._write(4);
|
|
255470
|
-
writeUInt32LE(this.buf, value, offset);
|
|
255471
|
-
}
|
|
255472
|
-
write(bytes) {
|
|
255473
|
-
let offset = this._write(4 + bytes.length);
|
|
255474
|
-
writeUInt32LE(this.buf, bytes.length, offset);
|
|
255475
|
-
this.buf.set(bytes, offset + 4);
|
|
255476
|
-
}
|
|
255477
|
-
_read(delta) {
|
|
255478
|
-
if (this.ptr + delta > this.buf.length) {
|
|
255479
|
-
throw new Error("Invalid packet");
|
|
255480
|
-
}
|
|
255481
|
-
this.ptr += delta;
|
|
255482
|
-
return this.ptr - delta;
|
|
255483
|
-
}
|
|
255484
|
-
read8() {
|
|
255485
|
-
return this.buf[this._read(1)];
|
|
255486
|
-
}
|
|
255487
|
-
read32() {
|
|
255488
|
-
return readUInt32LE(this.buf, this._read(4));
|
|
255489
|
-
}
|
|
255490
|
-
read() {
|
|
255491
|
-
let length = this.read32();
|
|
255492
|
-
let bytes = new Uint8Array(length);
|
|
255493
|
-
let ptr = this._read(bytes.length);
|
|
255494
|
-
bytes.set(this.buf.subarray(ptr, ptr + length));
|
|
255495
|
-
return bytes;
|
|
255496
|
-
}
|
|
255497
|
-
};
|
|
255498
|
-
var encodeUTF8;
|
|
255499
|
-
var decodeUTF8;
|
|
255500
|
-
var encodeInvariant;
|
|
255501
|
-
if (typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined") {
|
|
255502
|
-
let encoder = new TextEncoder();
|
|
255503
|
-
let decoder = new TextDecoder();
|
|
255504
|
-
encodeUTF8 = (text) => encoder.encode(text);
|
|
255505
|
-
decodeUTF8 = (bytes) => decoder.decode(bytes);
|
|
255506
|
-
encodeInvariant = 'new TextEncoder().encode("")';
|
|
255507
|
-
} else if (typeof Buffer !== "undefined") {
|
|
255508
|
-
encodeUTF8 = (text) => Buffer.from(text);
|
|
255509
|
-
decodeUTF8 = (bytes) => {
|
|
255510
|
-
let { buffer, byteOffset, byteLength } = bytes;
|
|
255511
|
-
return Buffer.from(buffer, byteOffset, byteLength).toString();
|
|
255512
|
-
};
|
|
255513
|
-
encodeInvariant = 'Buffer.from("")';
|
|
255514
|
-
} else {
|
|
255515
|
-
throw new Error("No UTF-8 codec found");
|
|
255516
|
-
}
|
|
255517
|
-
if (!(encodeUTF8("") instanceof Uint8Array))
|
|
255518
|
-
throw new Error(`Invariant violation: "${encodeInvariant} instanceof Uint8Array" is incorrectly false
|
|
255519
|
-
|
|
255520
|
-
This indicates that your JavaScript environment is broken. You cannot use
|
|
255521
|
-
esbuild in this environment because esbuild relies on this invariant. This
|
|
255522
|
-
is not a problem with esbuild. You need to fix your environment instead.
|
|
255523
|
-
`);
|
|
255524
|
-
function readUInt32LE(buffer, offset) {
|
|
255525
|
-
return (buffer[offset++] | buffer[offset++] << 8 | buffer[offset++] << 16 | buffer[offset++] << 24) >>> 0;
|
|
255526
|
-
}
|
|
255527
|
-
function writeUInt32LE(buffer, value, offset) {
|
|
255528
|
-
buffer[offset++] = value;
|
|
255529
|
-
buffer[offset++] = value >> 8;
|
|
255530
|
-
buffer[offset++] = value >> 16;
|
|
255531
|
-
buffer[offset++] = value >> 24;
|
|
255532
|
-
}
|
|
255533
|
-
var fromCharCode = String.fromCharCode;
|
|
255534
|
-
function throwSyntaxError(bytes, index, message) {
|
|
255535
|
-
const c = bytes[index];
|
|
255536
|
-
let line = 1;
|
|
255537
|
-
let column = 0;
|
|
255538
|
-
for (let i2 = 0; i2 < index; i2++) {
|
|
255539
|
-
if (bytes[i2] === 10) {
|
|
255540
|
-
line++;
|
|
255541
|
-
column = 0;
|
|
255542
|
-
} else {
|
|
255543
|
-
column++;
|
|
255544
|
-
}
|
|
255545
|
-
}
|
|
255546
|
-
throw new SyntaxError(
|
|
255547
|
-
message ? message : index === bytes.length ? "Unexpected end of input while parsing JSON" : c >= 32 && c <= 126 ? `Unexpected character ${fromCharCode(c)} in JSON at position ${index} (line ${line}, column ${column})` : `Unexpected byte 0x${c.toString(16)} in JSON at position ${index} (line ${line}, column ${column})`
|
|
255548
|
-
);
|
|
255549
|
-
}
|
|
255550
|
-
function JSON_parse(bytes) {
|
|
255551
|
-
if (!(bytes instanceof Uint8Array)) {
|
|
255552
|
-
throw new Error(`JSON input must be a Uint8Array`);
|
|
255553
|
-
}
|
|
255554
|
-
const propertyStack = [];
|
|
255555
|
-
const objectStack = [];
|
|
255556
|
-
const stateStack = [];
|
|
255557
|
-
const length = bytes.length;
|
|
255558
|
-
let property = null;
|
|
255559
|
-
let state = 0;
|
|
255560
|
-
let object3;
|
|
255561
|
-
let i2 = 0;
|
|
255562
|
-
while (i2 < length) {
|
|
255563
|
-
let c = bytes[i2++];
|
|
255564
|
-
if (c <= 32) {
|
|
255565
|
-
continue;
|
|
255566
|
-
}
|
|
255567
|
-
let value;
|
|
255568
|
-
if (state === 2 && property === null && c !== 34 && c !== 125) {
|
|
255569
|
-
throwSyntaxError(bytes, --i2);
|
|
255570
|
-
}
|
|
255571
|
-
switch (c) {
|
|
255572
|
-
// True
|
|
255573
|
-
case 116: {
|
|
255574
|
-
if (bytes[i2++] !== 114 || bytes[i2++] !== 117 || bytes[i2++] !== 101) {
|
|
255575
|
-
throwSyntaxError(bytes, --i2);
|
|
255576
|
-
}
|
|
255577
|
-
value = true;
|
|
255578
|
-
break;
|
|
255579
|
-
}
|
|
255580
|
-
// False
|
|
255581
|
-
case 102: {
|
|
255582
|
-
if (bytes[i2++] !== 97 || bytes[i2++] !== 108 || bytes[i2++] !== 115 || bytes[i2++] !== 101) {
|
|
255583
|
-
throwSyntaxError(bytes, --i2);
|
|
255584
|
-
}
|
|
255585
|
-
value = false;
|
|
255586
|
-
break;
|
|
255587
|
-
}
|
|
255588
|
-
// Null
|
|
255589
|
-
case 110: {
|
|
255590
|
-
if (bytes[i2++] !== 117 || bytes[i2++] !== 108 || bytes[i2++] !== 108) {
|
|
255591
|
-
throwSyntaxError(bytes, --i2);
|
|
255592
|
-
}
|
|
255593
|
-
value = null;
|
|
255594
|
-
break;
|
|
255595
|
-
}
|
|
255596
|
-
// Number begin
|
|
255597
|
-
case 45:
|
|
255598
|
-
case 46:
|
|
255599
|
-
case 48:
|
|
255600
|
-
case 49:
|
|
255601
|
-
case 50:
|
|
255602
|
-
case 51:
|
|
255603
|
-
case 52:
|
|
255604
|
-
case 53:
|
|
255605
|
-
case 54:
|
|
255606
|
-
case 55:
|
|
255607
|
-
case 56:
|
|
255608
|
-
case 57: {
|
|
255609
|
-
let index = i2;
|
|
255610
|
-
value = fromCharCode(c);
|
|
255611
|
-
c = bytes[i2];
|
|
255612
|
-
while (true) {
|
|
255613
|
-
switch (c) {
|
|
255614
|
-
case 43:
|
|
255615
|
-
case 45:
|
|
255616
|
-
case 46:
|
|
255617
|
-
case 48:
|
|
255618
|
-
case 49:
|
|
255619
|
-
case 50:
|
|
255620
|
-
case 51:
|
|
255621
|
-
case 52:
|
|
255622
|
-
case 53:
|
|
255623
|
-
case 54:
|
|
255624
|
-
case 55:
|
|
255625
|
-
case 56:
|
|
255626
|
-
case 57:
|
|
255627
|
-
case 101:
|
|
255628
|
-
case 69: {
|
|
255629
|
-
value += fromCharCode(c);
|
|
255630
|
-
c = bytes[++i2];
|
|
255631
|
-
continue;
|
|
255632
|
-
}
|
|
255633
|
-
}
|
|
255634
|
-
break;
|
|
255635
|
-
}
|
|
255636
|
-
value = +value;
|
|
255637
|
-
if (isNaN(value)) {
|
|
255638
|
-
throwSyntaxError(bytes, --index, "Invalid number");
|
|
255639
|
-
}
|
|
255640
|
-
break;
|
|
255641
|
-
}
|
|
255642
|
-
// String begin
|
|
255643
|
-
case 34: {
|
|
255644
|
-
value = "";
|
|
255645
|
-
while (true) {
|
|
255646
|
-
if (i2 >= length) {
|
|
255647
|
-
throwSyntaxError(bytes, length);
|
|
255648
|
-
}
|
|
255649
|
-
c = bytes[i2++];
|
|
255650
|
-
if (c === 34) {
|
|
255651
|
-
break;
|
|
255652
|
-
} else if (c === 92) {
|
|
255653
|
-
switch (bytes[i2++]) {
|
|
255654
|
-
// Normal escape sequence
|
|
255655
|
-
case 34:
|
|
255656
|
-
value += '"';
|
|
255657
|
-
break;
|
|
255658
|
-
case 47:
|
|
255659
|
-
value += "/";
|
|
255660
|
-
break;
|
|
255661
|
-
case 92:
|
|
255662
|
-
value += "\\";
|
|
255663
|
-
break;
|
|
255664
|
-
case 98:
|
|
255665
|
-
value += "\b";
|
|
255666
|
-
break;
|
|
255667
|
-
case 102:
|
|
255668
|
-
value += "\f";
|
|
255669
|
-
break;
|
|
255670
|
-
case 110:
|
|
255671
|
-
value += "\n";
|
|
255672
|
-
break;
|
|
255673
|
-
case 114:
|
|
255674
|
-
value += "\r";
|
|
255675
|
-
break;
|
|
255676
|
-
case 116:
|
|
255677
|
-
value += " ";
|
|
255678
|
-
break;
|
|
255679
|
-
// Unicode escape sequence
|
|
255680
|
-
case 117: {
|
|
255681
|
-
let code = 0;
|
|
255682
|
-
for (let j = 0; j < 4; j++) {
|
|
255683
|
-
c = bytes[i2++];
|
|
255684
|
-
code <<= 4;
|
|
255685
|
-
if (c >= 48 && c <= 57) code |= c - 48;
|
|
255686
|
-
else if (c >= 97 && c <= 102) code |= c + (10 - 97);
|
|
255687
|
-
else if (c >= 65 && c <= 70) code |= c + (10 - 65);
|
|
255688
|
-
else throwSyntaxError(bytes, --i2);
|
|
255689
|
-
}
|
|
255690
|
-
value += fromCharCode(code);
|
|
255691
|
-
break;
|
|
255692
|
-
}
|
|
255693
|
-
// Invalid escape sequence
|
|
255694
|
-
default:
|
|
255695
|
-
throwSyntaxError(bytes, --i2);
|
|
255696
|
-
break;
|
|
255697
|
-
}
|
|
255698
|
-
} else if (c <= 127) {
|
|
255699
|
-
value += fromCharCode(c);
|
|
255700
|
-
} else if ((c & 224) === 192) {
|
|
255701
|
-
value += fromCharCode((c & 31) << 6 | bytes[i2++] & 63);
|
|
255702
|
-
} else if ((c & 240) === 224) {
|
|
255703
|
-
value += fromCharCode((c & 15) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63);
|
|
255704
|
-
} else if ((c & 248) == 240) {
|
|
255705
|
-
let codePoint = (c & 7) << 18 | (bytes[i2++] & 63) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63;
|
|
255706
|
-
if (codePoint > 65535) {
|
|
255707
|
-
codePoint -= 65536;
|
|
255708
|
-
value += fromCharCode(codePoint >> 10 & 1023 | 55296);
|
|
255709
|
-
codePoint = 56320 | codePoint & 1023;
|
|
255710
|
-
}
|
|
255711
|
-
value += fromCharCode(codePoint);
|
|
255712
|
-
}
|
|
255713
|
-
}
|
|
255714
|
-
value[0];
|
|
255715
|
-
break;
|
|
255716
|
-
}
|
|
255717
|
-
// Array begin
|
|
255718
|
-
case 91: {
|
|
255719
|
-
value = [];
|
|
255720
|
-
propertyStack.push(property);
|
|
255721
|
-
objectStack.push(object3);
|
|
255722
|
-
stateStack.push(state);
|
|
255723
|
-
property = null;
|
|
255724
|
-
object3 = value;
|
|
255725
|
-
state = 1;
|
|
255726
|
-
continue;
|
|
255727
|
-
}
|
|
255728
|
-
// Object begin
|
|
255729
|
-
case 123: {
|
|
255730
|
-
value = {};
|
|
255731
|
-
propertyStack.push(property);
|
|
255732
|
-
objectStack.push(object3);
|
|
255733
|
-
stateStack.push(state);
|
|
255734
|
-
property = null;
|
|
255735
|
-
object3 = value;
|
|
255736
|
-
state = 2;
|
|
255737
|
-
continue;
|
|
255738
|
-
}
|
|
255739
|
-
// Array end
|
|
255740
|
-
case 93: {
|
|
255741
|
-
if (state !== 1) {
|
|
255742
|
-
throwSyntaxError(bytes, --i2);
|
|
255743
|
-
}
|
|
255744
|
-
value = object3;
|
|
255745
|
-
property = propertyStack.pop();
|
|
255746
|
-
object3 = objectStack.pop();
|
|
255747
|
-
state = stateStack.pop();
|
|
255748
|
-
break;
|
|
255749
|
-
}
|
|
255750
|
-
// Object end
|
|
255751
|
-
case 125: {
|
|
255752
|
-
if (state !== 2) {
|
|
255753
|
-
throwSyntaxError(bytes, --i2);
|
|
255754
|
-
}
|
|
255755
|
-
value = object3;
|
|
255756
|
-
property = propertyStack.pop();
|
|
255757
|
-
object3 = objectStack.pop();
|
|
255758
|
-
state = stateStack.pop();
|
|
255759
|
-
break;
|
|
255760
|
-
}
|
|
255761
|
-
default: {
|
|
255762
|
-
throwSyntaxError(bytes, --i2);
|
|
255763
|
-
}
|
|
255764
|
-
}
|
|
255765
|
-
c = bytes[i2];
|
|
255766
|
-
while (c <= 32) {
|
|
255767
|
-
c = bytes[++i2];
|
|
255768
|
-
}
|
|
255769
|
-
switch (state) {
|
|
255770
|
-
case 0: {
|
|
255771
|
-
if (i2 === length) {
|
|
255772
|
-
return value;
|
|
255773
|
-
}
|
|
255774
|
-
break;
|
|
255775
|
-
}
|
|
255776
|
-
case 1: {
|
|
255777
|
-
object3.push(value);
|
|
255778
|
-
if (c === 44) {
|
|
255779
|
-
i2++;
|
|
255780
|
-
continue;
|
|
255781
|
-
}
|
|
255782
|
-
if (c === 93) {
|
|
255783
|
-
continue;
|
|
255784
|
-
}
|
|
255785
|
-
break;
|
|
255786
|
-
}
|
|
255787
|
-
case 2: {
|
|
255788
|
-
if (property === null) {
|
|
255789
|
-
property = value;
|
|
255790
|
-
if (c === 58) {
|
|
255791
|
-
i2++;
|
|
255792
|
-
continue;
|
|
255793
|
-
}
|
|
255794
|
-
} else {
|
|
255795
|
-
object3[property] = value;
|
|
255796
|
-
property = null;
|
|
255797
|
-
if (c === 44) {
|
|
255798
|
-
i2++;
|
|
255799
|
-
continue;
|
|
255800
|
-
}
|
|
255801
|
-
if (c === 125) {
|
|
255802
|
-
continue;
|
|
255803
|
-
}
|
|
255804
|
-
}
|
|
255805
|
-
break;
|
|
255806
|
-
}
|
|
255807
|
-
}
|
|
255808
|
-
break;
|
|
255809
|
-
}
|
|
255810
|
-
throwSyntaxError(bytes, i2);
|
|
255811
|
-
}
|
|
255812
|
-
var quote = JSON.stringify;
|
|
255813
|
-
var buildLogLevelDefault = "warning";
|
|
255814
|
-
var transformLogLevelDefault = "silent";
|
|
255815
|
-
function validateAndJoinStringArray(values, what) {
|
|
255816
|
-
const toJoin = [];
|
|
255817
|
-
for (const value of values) {
|
|
255818
|
-
validateStringValue(value, what);
|
|
255819
|
-
if (value.indexOf(",") >= 0) throw new Error(`Invalid ${what}: ${value}`);
|
|
255820
|
-
toJoin.push(value);
|
|
255821
|
-
}
|
|
255822
|
-
return toJoin.join(",");
|
|
255823
|
-
}
|
|
255824
|
-
var canBeAnything = () => null;
|
|
255825
|
-
var mustBeBoolean = (value) => typeof value === "boolean" ? null : "a boolean";
|
|
255826
|
-
var mustBeString = (value) => typeof value === "string" ? null : "a string";
|
|
255827
|
-
var mustBeRegExp = (value) => value instanceof RegExp ? null : "a RegExp object";
|
|
255828
|
-
var mustBeInteger = (value) => typeof value === "number" && value === (value | 0) ? null : "an integer";
|
|
255829
|
-
var mustBeValidPortNumber = (value) => typeof value === "number" && value === (value | 0) && value >= 0 && value <= 65535 ? null : "a valid port number";
|
|
255830
|
-
var mustBeFunction = (value) => typeof value === "function" ? null : "a function";
|
|
255831
|
-
var mustBeArray = (value) => Array.isArray(value) ? null : "an array";
|
|
255832
|
-
var mustBeArrayOfStrings = (value) => Array.isArray(value) && value.every((x2) => typeof x2 === "string") ? null : "an array of strings";
|
|
255833
|
-
var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object";
|
|
255834
|
-
var mustBeEntryPoints = (value) => typeof value === "object" && value !== null ? null : "an array or an object";
|
|
255835
|
-
var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module";
|
|
255836
|
-
var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null";
|
|
255837
|
-
var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean";
|
|
255838
|
-
var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object";
|
|
255839
|
-
var mustBeStringOrArrayOfStrings = (value) => typeof value === "string" || Array.isArray(value) && value.every((x2) => typeof x2 === "string") ? null : "a string or an array of strings";
|
|
255840
|
-
var mustBeStringOrUint8Array = (value) => typeof value === "string" || value instanceof Uint8Array ? null : "a string or a Uint8Array";
|
|
255841
|
-
var mustBeStringOrURL = (value) => typeof value === "string" || value instanceof URL ? null : "a string or a URL";
|
|
255842
|
-
function getFlag(object3, keys, key, mustBeFn) {
|
|
255843
|
-
let value = object3[key];
|
|
255844
|
-
keys[key + ""] = true;
|
|
255845
|
-
if (value === void 0) return void 0;
|
|
255846
|
-
let mustBe = mustBeFn(value);
|
|
255847
|
-
if (mustBe !== null) throw new Error(`${quote(key)} must be ${mustBe}`);
|
|
255848
|
-
return value;
|
|
255849
|
-
}
|
|
255850
|
-
function checkForInvalidFlags(object3, keys, where) {
|
|
255851
|
-
for (let key in object3) {
|
|
255852
|
-
if (!(key in keys)) {
|
|
255853
|
-
throw new Error(`Invalid option ${where}: ${quote(key)}`);
|
|
255854
|
-
}
|
|
255855
|
-
}
|
|
255856
|
-
}
|
|
255857
|
-
function validateInitializeOptions(options) {
|
|
255858
|
-
let keys = /* @__PURE__ */ Object.create(null);
|
|
255859
|
-
let wasmURL = getFlag(options, keys, "wasmURL", mustBeStringOrURL);
|
|
255860
|
-
let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule);
|
|
255861
|
-
let worker = getFlag(options, keys, "worker", mustBeBoolean);
|
|
255862
|
-
checkForInvalidFlags(options, keys, "in initialize() call");
|
|
255863
|
-
return {
|
|
255864
|
-
wasmURL,
|
|
255865
|
-
wasmModule,
|
|
255866
|
-
worker
|
|
255867
|
-
};
|
|
255868
|
-
}
|
|
255869
|
-
function validateMangleCache(mangleCache) {
|
|
255870
|
-
let validated;
|
|
255871
|
-
if (mangleCache !== void 0) {
|
|
255872
|
-
validated = /* @__PURE__ */ Object.create(null);
|
|
255873
|
-
for (let key in mangleCache) {
|
|
255874
|
-
let value = mangleCache[key];
|
|
255875
|
-
if (typeof value === "string" || value === false) {
|
|
255876
|
-
validated[key] = value;
|
|
255877
|
-
} else {
|
|
255878
|
-
throw new Error(`Expected ${quote(key)} in mangle cache to map to either a string or false`);
|
|
255879
|
-
}
|
|
255880
|
-
}
|
|
255881
|
-
}
|
|
255882
|
-
return validated;
|
|
255883
|
-
}
|
|
255884
|
-
function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) {
|
|
255885
|
-
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
255886
|
-
let logLevel = getFlag(options, keys, "logLevel", mustBeString);
|
|
255887
|
-
let logLimit = getFlag(options, keys, "logLimit", mustBeInteger);
|
|
255888
|
-
if (color !== void 0) flags.push(`--color=${color}`);
|
|
255889
|
-
else if (isTTY2) flags.push(`--color=true`);
|
|
255890
|
-
flags.push(`--log-level=${logLevel || logLevelDefault}`);
|
|
255891
|
-
flags.push(`--log-limit=${logLimit || 0}`);
|
|
255892
|
-
}
|
|
255893
|
-
function validateStringValue(value, what, key) {
|
|
255894
|
-
if (typeof value !== "string") {
|
|
255895
|
-
throw new Error(`Expected value for ${what}${key !== void 0 ? " " + quote(key) : ""} to be a string, got ${typeof value} instead`);
|
|
255896
|
-
}
|
|
255897
|
-
return value;
|
|
255898
|
-
}
|
|
255899
|
-
function pushCommonFlags(flags, options, keys) {
|
|
255900
|
-
let legalComments = getFlag(options, keys, "legalComments", mustBeString);
|
|
255901
|
-
let sourceRoot = getFlag(options, keys, "sourceRoot", mustBeString);
|
|
255902
|
-
let sourcesContent = getFlag(options, keys, "sourcesContent", mustBeBoolean);
|
|
255903
|
-
let target = getFlag(options, keys, "target", mustBeStringOrArrayOfStrings);
|
|
255904
|
-
let format = getFlag(options, keys, "format", mustBeString);
|
|
255905
|
-
let globalName = getFlag(options, keys, "globalName", mustBeString);
|
|
255906
|
-
let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp);
|
|
255907
|
-
let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp);
|
|
255908
|
-
let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean);
|
|
255909
|
-
let minify = getFlag(options, keys, "minify", mustBeBoolean);
|
|
255910
|
-
let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean);
|
|
255911
|
-
let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean);
|
|
255912
|
-
let minifyIdentifiers = getFlag(options, keys, "minifyIdentifiers", mustBeBoolean);
|
|
255913
|
-
let lineLimit = getFlag(options, keys, "lineLimit", mustBeInteger);
|
|
255914
|
-
let drop = getFlag(options, keys, "drop", mustBeArrayOfStrings);
|
|
255915
|
-
let dropLabels = getFlag(options, keys, "dropLabels", mustBeArrayOfStrings);
|
|
255916
|
-
let charset = getFlag(options, keys, "charset", mustBeString);
|
|
255917
|
-
let treeShaking = getFlag(options, keys, "treeShaking", mustBeBoolean);
|
|
255918
|
-
let ignoreAnnotations = getFlag(options, keys, "ignoreAnnotations", mustBeBoolean);
|
|
255919
|
-
let jsx = getFlag(options, keys, "jsx", mustBeString);
|
|
255920
|
-
let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString);
|
|
255921
|
-
let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
|
|
255922
|
-
let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString);
|
|
255923
|
-
let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean);
|
|
255924
|
-
let jsxSideEffects = getFlag(options, keys, "jsxSideEffects", mustBeBoolean);
|
|
255925
|
-
let define2 = getFlag(options, keys, "define", mustBeObject);
|
|
255926
|
-
let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
|
|
255927
|
-
let supported = getFlag(options, keys, "supported", mustBeObject);
|
|
255928
|
-
let pure = getFlag(options, keys, "pure", mustBeArrayOfStrings);
|
|
255929
|
-
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
|
255930
|
-
let platform = getFlag(options, keys, "platform", mustBeString);
|
|
255931
|
-
let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject);
|
|
255932
|
-
let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings);
|
|
255933
|
-
if (legalComments) flags.push(`--legal-comments=${legalComments}`);
|
|
255934
|
-
if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`);
|
|
255935
|
-
if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`);
|
|
255936
|
-
if (target) flags.push(`--target=${validateAndJoinStringArray(Array.isArray(target) ? target : [target], "target")}`);
|
|
255937
|
-
if (format) flags.push(`--format=${format}`);
|
|
255938
|
-
if (globalName) flags.push(`--global-name=${globalName}`);
|
|
255939
|
-
if (platform) flags.push(`--platform=${platform}`);
|
|
255940
|
-
if (tsconfigRaw) flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`);
|
|
255941
|
-
if (minify) flags.push("--minify");
|
|
255942
|
-
if (minifySyntax) flags.push("--minify-syntax");
|
|
255943
|
-
if (minifyWhitespace) flags.push("--minify-whitespace");
|
|
255944
|
-
if (minifyIdentifiers) flags.push("--minify-identifiers");
|
|
255945
|
-
if (lineLimit) flags.push(`--line-limit=${lineLimit}`);
|
|
255946
|
-
if (charset) flags.push(`--charset=${charset}`);
|
|
255947
|
-
if (treeShaking !== void 0) flags.push(`--tree-shaking=${treeShaking}`);
|
|
255948
|
-
if (ignoreAnnotations) flags.push(`--ignore-annotations`);
|
|
255949
|
-
if (drop) for (let what of drop) flags.push(`--drop:${validateStringValue(what, "drop")}`);
|
|
255950
|
-
if (dropLabels) flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`);
|
|
255951
|
-
if (absPaths) flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`);
|
|
255952
|
-
if (mangleProps) flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`);
|
|
255953
|
-
if (reserveProps) flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`);
|
|
255954
|
-
if (mangleQuoted !== void 0) flags.push(`--mangle-quoted=${mangleQuoted}`);
|
|
255955
|
-
if (jsx) flags.push(`--jsx=${jsx}`);
|
|
255956
|
-
if (jsxFactory) flags.push(`--jsx-factory=${jsxFactory}`);
|
|
255957
|
-
if (jsxFragment) flags.push(`--jsx-fragment=${jsxFragment}`);
|
|
255958
|
-
if (jsxImportSource) flags.push(`--jsx-import-source=${jsxImportSource}`);
|
|
255959
|
-
if (jsxDev) flags.push(`--jsx-dev`);
|
|
255960
|
-
if (jsxSideEffects) flags.push(`--jsx-side-effects`);
|
|
255961
|
-
if (define2) {
|
|
255962
|
-
for (let key in define2) {
|
|
255963
|
-
if (key.indexOf("=") >= 0) throw new Error(`Invalid define: ${key}`);
|
|
255964
|
-
flags.push(`--define:${key}=${validateStringValue(define2[key], "define", key)}`);
|
|
255965
|
-
}
|
|
255966
|
-
}
|
|
255967
|
-
if (logOverride) {
|
|
255968
|
-
for (let key in logOverride) {
|
|
255969
|
-
if (key.indexOf("=") >= 0) throw new Error(`Invalid log override: ${key}`);
|
|
255970
|
-
flags.push(`--log-override:${key}=${validateStringValue(logOverride[key], "log override", key)}`);
|
|
255971
|
-
}
|
|
255972
|
-
}
|
|
255973
|
-
if (supported) {
|
|
255974
|
-
for (let key in supported) {
|
|
255975
|
-
if (key.indexOf("=") >= 0) throw new Error(`Invalid supported: ${key}`);
|
|
255976
|
-
const value = supported[key];
|
|
255977
|
-
if (typeof value !== "boolean") throw new Error(`Expected value for supported ${quote(key)} to be a boolean, got ${typeof value} instead`);
|
|
255978
|
-
flags.push(`--supported:${key}=${value}`);
|
|
255979
|
-
}
|
|
255980
|
-
}
|
|
255981
|
-
if (pure) for (let fn of pure) flags.push(`--pure:${validateStringValue(fn, "pure")}`);
|
|
255982
|
-
if (keepNames) flags.push(`--keep-names`);
|
|
255983
|
-
}
|
|
255984
|
-
function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeDefault) {
|
|
255985
|
-
var _a22;
|
|
255986
|
-
let flags = [];
|
|
255987
|
-
let entries = [];
|
|
255988
|
-
let keys = /* @__PURE__ */ Object.create(null);
|
|
255989
|
-
let stdinContents = null;
|
|
255990
|
-
let stdinResolveDir = null;
|
|
255991
|
-
pushLogFlags(flags, options, keys, isTTY2, logLevelDefault);
|
|
255992
|
-
pushCommonFlags(flags, options, keys);
|
|
255993
|
-
let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean);
|
|
255994
|
-
let bundle = getFlag(options, keys, "bundle", mustBeBoolean);
|
|
255995
|
-
let splitting = getFlag(options, keys, "splitting", mustBeBoolean);
|
|
255996
|
-
let preserveSymlinks = getFlag(options, keys, "preserveSymlinks", mustBeBoolean);
|
|
255997
|
-
let metafile = getFlag(options, keys, "metafile", mustBeBoolean);
|
|
255998
|
-
let outfile = getFlag(options, keys, "outfile", mustBeString);
|
|
255999
|
-
let outdir = getFlag(options, keys, "outdir", mustBeString);
|
|
256000
|
-
let outbase = getFlag(options, keys, "outbase", mustBeString);
|
|
256001
|
-
let tsconfig = getFlag(options, keys, "tsconfig", mustBeString);
|
|
256002
|
-
let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArrayOfStrings);
|
|
256003
|
-
let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArrayOfStrings);
|
|
256004
|
-
let mainFields = getFlag(options, keys, "mainFields", mustBeArrayOfStrings);
|
|
256005
|
-
let conditions = getFlag(options, keys, "conditions", mustBeArrayOfStrings);
|
|
256006
|
-
let external = getFlag(options, keys, "external", mustBeArrayOfStrings);
|
|
256007
|
-
let packages = getFlag(options, keys, "packages", mustBeString);
|
|
256008
|
-
let alias = getFlag(options, keys, "alias", mustBeObject);
|
|
256009
|
-
let loader2 = getFlag(options, keys, "loader", mustBeObject);
|
|
256010
|
-
let outExtension = getFlag(options, keys, "outExtension", mustBeObject);
|
|
256011
|
-
let publicPath = getFlag(options, keys, "publicPath", mustBeString);
|
|
256012
|
-
let entryNames = getFlag(options, keys, "entryNames", mustBeString);
|
|
256013
|
-
let chunkNames = getFlag(options, keys, "chunkNames", mustBeString);
|
|
256014
|
-
let assetNames = getFlag(options, keys, "assetNames", mustBeString);
|
|
256015
|
-
let inject = getFlag(options, keys, "inject", mustBeArrayOfStrings);
|
|
256016
|
-
let banner = getFlag(options, keys, "banner", mustBeObject);
|
|
256017
|
-
let footer = getFlag(options, keys, "footer", mustBeObject);
|
|
256018
|
-
let entryPoints = getFlag(options, keys, "entryPoints", mustBeEntryPoints);
|
|
256019
|
-
let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString);
|
|
256020
|
-
let stdin = getFlag(options, keys, "stdin", mustBeObject);
|
|
256021
|
-
let write = (_a22 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a22 : writeDefault;
|
|
256022
|
-
let allowOverwrite = getFlag(options, keys, "allowOverwrite", mustBeBoolean);
|
|
256023
|
-
let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject);
|
|
256024
|
-
keys.plugins = true;
|
|
256025
|
-
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
|
256026
|
-
if (sourcemap) flags.push(`--sourcemap${sourcemap === true ? "" : `=${sourcemap}`}`);
|
|
256027
|
-
if (bundle) flags.push("--bundle");
|
|
256028
|
-
if (allowOverwrite) flags.push("--allow-overwrite");
|
|
256029
|
-
if (splitting) flags.push("--splitting");
|
|
256030
|
-
if (preserveSymlinks) flags.push("--preserve-symlinks");
|
|
256031
|
-
if (metafile) flags.push(`--metafile`);
|
|
256032
|
-
if (outfile) flags.push(`--outfile=${outfile}`);
|
|
256033
|
-
if (outdir) flags.push(`--outdir=${outdir}`);
|
|
256034
|
-
if (outbase) flags.push(`--outbase=${outbase}`);
|
|
256035
|
-
if (tsconfig) flags.push(`--tsconfig=${tsconfig}`);
|
|
256036
|
-
if (packages) flags.push(`--packages=${packages}`);
|
|
256037
|
-
if (resolveExtensions) flags.push(`--resolve-extensions=${validateAndJoinStringArray(resolveExtensions, "resolve extension")}`);
|
|
256038
|
-
if (publicPath) flags.push(`--public-path=${publicPath}`);
|
|
256039
|
-
if (entryNames) flags.push(`--entry-names=${entryNames}`);
|
|
256040
|
-
if (chunkNames) flags.push(`--chunk-names=${chunkNames}`);
|
|
256041
|
-
if (assetNames) flags.push(`--asset-names=${assetNames}`);
|
|
256042
|
-
if (mainFields) flags.push(`--main-fields=${validateAndJoinStringArray(mainFields, "main field")}`);
|
|
256043
|
-
if (conditions) flags.push(`--conditions=${validateAndJoinStringArray(conditions, "condition")}`);
|
|
256044
|
-
if (external) for (let name2 of external) flags.push(`--external:${validateStringValue(name2, "external")}`);
|
|
256045
|
-
if (alias) {
|
|
256046
|
-
for (let old in alias) {
|
|
256047
|
-
if (old.indexOf("=") >= 0) throw new Error(`Invalid package name in alias: ${old}`);
|
|
256048
|
-
flags.push(`--alias:${old}=${validateStringValue(alias[old], "alias", old)}`);
|
|
256049
|
-
}
|
|
256050
|
-
}
|
|
256051
|
-
if (banner) {
|
|
256052
|
-
for (let type2 in banner) {
|
|
256053
|
-
if (type2.indexOf("=") >= 0) throw new Error(`Invalid banner file type: ${type2}`);
|
|
256054
|
-
flags.push(`--banner:${type2}=${validateStringValue(banner[type2], "banner", type2)}`);
|
|
256055
|
-
}
|
|
256056
|
-
}
|
|
256057
|
-
if (footer) {
|
|
256058
|
-
for (let type2 in footer) {
|
|
256059
|
-
if (type2.indexOf("=") >= 0) throw new Error(`Invalid footer file type: ${type2}`);
|
|
256060
|
-
flags.push(`--footer:${type2}=${validateStringValue(footer[type2], "footer", type2)}`);
|
|
256061
|
-
}
|
|
256062
|
-
}
|
|
256063
|
-
if (inject) for (let path3 of inject) flags.push(`--inject:${validateStringValue(path3, "inject")}`);
|
|
256064
|
-
if (loader2) {
|
|
256065
|
-
for (let ext in loader2) {
|
|
256066
|
-
if (ext.indexOf("=") >= 0) throw new Error(`Invalid loader extension: ${ext}`);
|
|
256067
|
-
flags.push(`--loader:${ext}=${validateStringValue(loader2[ext], "loader", ext)}`);
|
|
256068
|
-
}
|
|
256069
|
-
}
|
|
256070
|
-
if (outExtension) {
|
|
256071
|
-
for (let ext in outExtension) {
|
|
256072
|
-
if (ext.indexOf("=") >= 0) throw new Error(`Invalid out extension: ${ext}`);
|
|
256073
|
-
flags.push(`--out-extension:${ext}=${validateStringValue(outExtension[ext], "out extension", ext)}`);
|
|
256074
|
-
}
|
|
256075
|
-
}
|
|
256076
|
-
if (entryPoints) {
|
|
256077
|
-
if (Array.isArray(entryPoints)) {
|
|
256078
|
-
for (let i2 = 0, n = entryPoints.length; i2 < n; i2++) {
|
|
256079
|
-
let entryPoint = entryPoints[i2];
|
|
256080
|
-
if (typeof entryPoint === "object" && entryPoint !== null) {
|
|
256081
|
-
let entryPointKeys = /* @__PURE__ */ Object.create(null);
|
|
256082
|
-
let input = getFlag(entryPoint, entryPointKeys, "in", mustBeString);
|
|
256083
|
-
let output = getFlag(entryPoint, entryPointKeys, "out", mustBeString);
|
|
256084
|
-
checkForInvalidFlags(entryPoint, entryPointKeys, "in entry point at index " + i2);
|
|
256085
|
-
if (input === void 0) throw new Error('Missing property "in" for entry point at index ' + i2);
|
|
256086
|
-
if (output === void 0) throw new Error('Missing property "out" for entry point at index ' + i2);
|
|
256087
|
-
entries.push([output, input]);
|
|
256088
|
-
} else {
|
|
256089
|
-
entries.push(["", validateStringValue(entryPoint, "entry point at index " + i2)]);
|
|
256090
|
-
}
|
|
256091
|
-
}
|
|
256092
|
-
} else {
|
|
256093
|
-
for (let key in entryPoints) {
|
|
256094
|
-
entries.push([key, validateStringValue(entryPoints[key], "entry point", key)]);
|
|
256095
|
-
}
|
|
256096
|
-
}
|
|
256097
|
-
}
|
|
256098
|
-
if (stdin) {
|
|
256099
|
-
let stdinKeys = /* @__PURE__ */ Object.create(null);
|
|
256100
|
-
let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
|
|
256101
|
-
let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
|
|
256102
|
-
let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
|
|
256103
|
-
let loader22 = getFlag(stdin, stdinKeys, "loader", mustBeString);
|
|
256104
|
-
checkForInvalidFlags(stdin, stdinKeys, 'in "stdin" object');
|
|
256105
|
-
if (sourcefile) flags.push(`--sourcefile=${sourcefile}`);
|
|
256106
|
-
if (loader22) flags.push(`--loader=${loader22}`);
|
|
256107
|
-
if (resolveDir) stdinResolveDir = resolveDir;
|
|
256108
|
-
if (typeof contents === "string") stdinContents = encodeUTF8(contents);
|
|
256109
|
-
else if (contents instanceof Uint8Array) stdinContents = contents;
|
|
256110
|
-
}
|
|
256111
|
-
let nodePaths = [];
|
|
256112
|
-
if (nodePathsInput) {
|
|
256113
|
-
for (let value of nodePathsInput) {
|
|
256114
|
-
value += "";
|
|
256115
|
-
nodePaths.push(value);
|
|
256116
|
-
}
|
|
256117
|
-
}
|
|
256118
|
-
return {
|
|
256119
|
-
entries,
|
|
256120
|
-
flags,
|
|
256121
|
-
write,
|
|
256122
|
-
stdinContents,
|
|
256123
|
-
stdinResolveDir,
|
|
256124
|
-
absWorkingDir,
|
|
256125
|
-
nodePaths,
|
|
256126
|
-
mangleCache: validateMangleCache(mangleCache)
|
|
256127
|
-
};
|
|
256128
|
-
}
|
|
256129
|
-
function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) {
|
|
256130
|
-
let flags = [];
|
|
256131
|
-
let keys = /* @__PURE__ */ Object.create(null);
|
|
256132
|
-
pushLogFlags(flags, options, keys, isTTY2, logLevelDefault);
|
|
256133
|
-
pushCommonFlags(flags, options, keys);
|
|
256134
|
-
let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean);
|
|
256135
|
-
let sourcefile = getFlag(options, keys, "sourcefile", mustBeString);
|
|
256136
|
-
let loader2 = getFlag(options, keys, "loader", mustBeString);
|
|
256137
|
-
let banner = getFlag(options, keys, "banner", mustBeString);
|
|
256138
|
-
let footer = getFlag(options, keys, "footer", mustBeString);
|
|
256139
|
-
let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject);
|
|
256140
|
-
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
|
256141
|
-
if (sourcemap) flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`);
|
|
256142
|
-
if (sourcefile) flags.push(`--sourcefile=${sourcefile}`);
|
|
256143
|
-
if (loader2) flags.push(`--loader=${loader2}`);
|
|
256144
|
-
if (banner) flags.push(`--banner=${banner}`);
|
|
256145
|
-
if (footer) flags.push(`--footer=${footer}`);
|
|
256146
|
-
return {
|
|
256147
|
-
flags,
|
|
256148
|
-
mangleCache: validateMangleCache(mangleCache)
|
|
256149
|
-
};
|
|
256150
|
-
}
|
|
256151
|
-
function createChannel(streamIn) {
|
|
256152
|
-
const requestCallbacksByKey = {};
|
|
256153
|
-
const closeData = { didClose: false, reason: "" };
|
|
256154
|
-
let responseCallbacks = {};
|
|
256155
|
-
let nextRequestID = 0;
|
|
256156
|
-
let nextBuildKey = 0;
|
|
256157
|
-
let stdout = new Uint8Array(16 * 1024);
|
|
256158
|
-
let stdoutUsed = 0;
|
|
256159
|
-
let readFromStdout = (chunk) => {
|
|
256160
|
-
let limit = stdoutUsed + chunk.length;
|
|
256161
|
-
if (limit > stdout.length) {
|
|
256162
|
-
let swap = new Uint8Array(limit * 2);
|
|
256163
|
-
swap.set(stdout);
|
|
256164
|
-
stdout = swap;
|
|
256165
|
-
}
|
|
256166
|
-
stdout.set(chunk, stdoutUsed);
|
|
256167
|
-
stdoutUsed += chunk.length;
|
|
256168
|
-
let offset = 0;
|
|
256169
|
-
while (offset + 4 <= stdoutUsed) {
|
|
256170
|
-
let length = readUInt32LE(stdout, offset);
|
|
256171
|
-
if (offset + 4 + length > stdoutUsed) {
|
|
256172
|
-
break;
|
|
256173
|
-
}
|
|
256174
|
-
offset += 4;
|
|
256175
|
-
handleIncomingPacket(stdout.subarray(offset, offset + length));
|
|
256176
|
-
offset += length;
|
|
256177
|
-
}
|
|
256178
|
-
if (offset > 0) {
|
|
256179
|
-
stdout.copyWithin(0, offset, stdoutUsed);
|
|
256180
|
-
stdoutUsed -= offset;
|
|
256181
|
-
}
|
|
256182
|
-
};
|
|
256183
|
-
let afterClose = (error48) => {
|
|
256184
|
-
closeData.didClose = true;
|
|
256185
|
-
if (error48) closeData.reason = ": " + (error48.message || error48);
|
|
256186
|
-
const text = "The service was stopped" + closeData.reason;
|
|
256187
|
-
for (let id in responseCallbacks) {
|
|
256188
|
-
responseCallbacks[id](text, null);
|
|
256189
|
-
}
|
|
256190
|
-
responseCallbacks = {};
|
|
256191
|
-
};
|
|
256192
|
-
let sendRequest = (refs, value, callback) => {
|
|
256193
|
-
if (closeData.didClose) return callback("The service is no longer running" + closeData.reason, null);
|
|
256194
|
-
let id = nextRequestID++;
|
|
256195
|
-
responseCallbacks[id] = (error48, response) => {
|
|
256196
|
-
try {
|
|
256197
|
-
callback(error48, response);
|
|
256198
|
-
} finally {
|
|
256199
|
-
if (refs) refs.unref();
|
|
256200
|
-
}
|
|
256201
|
-
};
|
|
256202
|
-
if (refs) refs.ref();
|
|
256203
|
-
streamIn.writeToStdin(encodePacket({ id, isRequest: true, value }));
|
|
256204
|
-
};
|
|
256205
|
-
let sendResponse = (id, value) => {
|
|
256206
|
-
if (closeData.didClose) throw new Error("The service is no longer running" + closeData.reason);
|
|
256207
|
-
streamIn.writeToStdin(encodePacket({ id, isRequest: false, value }));
|
|
256208
|
-
};
|
|
256209
|
-
let handleRequest = async (id, request) => {
|
|
256210
|
-
try {
|
|
256211
|
-
if (request.command === "ping") {
|
|
256212
|
-
sendResponse(id, {});
|
|
256213
|
-
return;
|
|
256214
|
-
}
|
|
256215
|
-
if (typeof request.key === "number") {
|
|
256216
|
-
const requestCallbacks = requestCallbacksByKey[request.key];
|
|
256217
|
-
if (!requestCallbacks) {
|
|
256218
|
-
return;
|
|
256219
|
-
}
|
|
256220
|
-
const callback = requestCallbacks[request.command];
|
|
256221
|
-
if (callback) {
|
|
256222
|
-
await callback(id, request);
|
|
256223
|
-
return;
|
|
256224
|
-
}
|
|
256225
|
-
}
|
|
256226
|
-
throw new Error(`Invalid command: ` + request.command);
|
|
256227
|
-
} catch (e2) {
|
|
256228
|
-
const errors = [extractErrorMessageV8(e2, streamIn, null, void 0, "")];
|
|
256229
|
-
try {
|
|
256230
|
-
sendResponse(id, { errors });
|
|
256231
|
-
} catch {
|
|
256232
|
-
}
|
|
256233
|
-
}
|
|
256234
|
-
};
|
|
256235
|
-
let isFirstPacket = true;
|
|
256236
|
-
let handleIncomingPacket = (bytes) => {
|
|
256237
|
-
if (isFirstPacket) {
|
|
256238
|
-
isFirstPacket = false;
|
|
256239
|
-
let binaryVersion = String.fromCharCode(...bytes);
|
|
256240
|
-
if (binaryVersion !== "0.27.4") {
|
|
256241
|
-
throw new Error(`Cannot start service: Host version "${"0.27.4"}" does not match binary version ${quote(binaryVersion)}`);
|
|
256242
|
-
}
|
|
256243
|
-
return;
|
|
256244
|
-
}
|
|
256245
|
-
let packet = decodePacket(bytes);
|
|
256246
|
-
if (packet.isRequest) {
|
|
256247
|
-
handleRequest(packet.id, packet.value);
|
|
256248
|
-
} else {
|
|
256249
|
-
let callback = responseCallbacks[packet.id];
|
|
256250
|
-
delete responseCallbacks[packet.id];
|
|
256251
|
-
if (packet.value.error) callback(packet.value.error, {});
|
|
256252
|
-
else callback(null, packet.value);
|
|
256253
|
-
}
|
|
256254
|
-
};
|
|
256255
|
-
let buildOrContext = ({ callName, refs, options, isTTY: isTTY2, defaultWD: defaultWD2, callback }) => {
|
|
256256
|
-
let refCount = 0;
|
|
256257
|
-
const buildKey = nextBuildKey++;
|
|
256258
|
-
const requestCallbacks = {};
|
|
256259
|
-
const buildRefs = {
|
|
256260
|
-
ref() {
|
|
256261
|
-
if (++refCount === 1) {
|
|
256262
|
-
if (refs) refs.ref();
|
|
256263
|
-
}
|
|
256264
|
-
},
|
|
256265
|
-
unref() {
|
|
256266
|
-
if (--refCount === 0) {
|
|
256267
|
-
delete requestCallbacksByKey[buildKey];
|
|
256268
|
-
if (refs) refs.unref();
|
|
256269
|
-
}
|
|
256270
|
-
}
|
|
256271
|
-
};
|
|
256272
|
-
requestCallbacksByKey[buildKey] = requestCallbacks;
|
|
256273
|
-
buildRefs.ref();
|
|
256274
|
-
buildOrContextImpl(
|
|
256275
|
-
callName,
|
|
256276
|
-
buildKey,
|
|
256277
|
-
sendRequest,
|
|
256278
|
-
sendResponse,
|
|
256279
|
-
buildRefs,
|
|
256280
|
-
streamIn,
|
|
256281
|
-
requestCallbacks,
|
|
256282
|
-
options,
|
|
256283
|
-
isTTY2,
|
|
256284
|
-
defaultWD2,
|
|
256285
|
-
(err, res) => {
|
|
256286
|
-
try {
|
|
256287
|
-
callback(err, res);
|
|
256288
|
-
} finally {
|
|
256289
|
-
buildRefs.unref();
|
|
256290
|
-
}
|
|
256291
|
-
}
|
|
256292
|
-
);
|
|
256293
|
-
};
|
|
256294
|
-
let transform22 = ({ callName, refs, input, options, isTTY: isTTY2, fs: fs3, callback }) => {
|
|
256295
|
-
const details = createObjectStash();
|
|
256296
|
-
let start2 = (inputPath) => {
|
|
256297
|
-
try {
|
|
256298
|
-
if (typeof input !== "string" && !(input instanceof Uint8Array))
|
|
256299
|
-
throw new Error('The input to "transform" must be a string or a Uint8Array');
|
|
256300
|
-
let {
|
|
256301
|
-
flags,
|
|
256302
|
-
mangleCache
|
|
256303
|
-
} = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault);
|
|
256304
|
-
let request = {
|
|
256305
|
-
command: "transform",
|
|
256306
|
-
flags,
|
|
256307
|
-
inputFS: inputPath !== null,
|
|
256308
|
-
input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
|
|
256309
|
-
};
|
|
256310
|
-
if (mangleCache) request.mangleCache = mangleCache;
|
|
256311
|
-
sendRequest(refs, request, (error48, response) => {
|
|
256312
|
-
if (error48) return callback(new Error(error48), null);
|
|
256313
|
-
let errors = replaceDetailsInMessages(response.errors, details);
|
|
256314
|
-
let warnings = replaceDetailsInMessages(response.warnings, details);
|
|
256315
|
-
let outstanding = 1;
|
|
256316
|
-
let next = () => {
|
|
256317
|
-
if (--outstanding === 0) {
|
|
256318
|
-
let result = {
|
|
256319
|
-
warnings,
|
|
256320
|
-
code: response.code,
|
|
256321
|
-
map: response.map,
|
|
256322
|
-
mangleCache: void 0,
|
|
256323
|
-
legalComments: void 0
|
|
256324
|
-
};
|
|
256325
|
-
if ("legalComments" in response) result.legalComments = response == null ? void 0 : response.legalComments;
|
|
256326
|
-
if (response.mangleCache) result.mangleCache = response == null ? void 0 : response.mangleCache;
|
|
256327
|
-
callback(null, result);
|
|
256328
|
-
}
|
|
256329
|
-
};
|
|
256330
|
-
if (errors.length > 0) return callback(failureErrorWithLog("Transform failed", errors, warnings), null);
|
|
256331
|
-
if (response.codeFS) {
|
|
256332
|
-
outstanding++;
|
|
256333
|
-
fs3.readFile(response.code, (err, contents) => {
|
|
256334
|
-
if (err !== null) {
|
|
256335
|
-
callback(err, null);
|
|
256336
|
-
} else {
|
|
256337
|
-
response.code = contents;
|
|
256338
|
-
next();
|
|
256339
|
-
}
|
|
256340
|
-
});
|
|
256341
|
-
}
|
|
256342
|
-
if (response.mapFS) {
|
|
256343
|
-
outstanding++;
|
|
256344
|
-
fs3.readFile(response.map, (err, contents) => {
|
|
256345
|
-
if (err !== null) {
|
|
256346
|
-
callback(err, null);
|
|
256347
|
-
} else {
|
|
256348
|
-
response.map = contents;
|
|
256349
|
-
next();
|
|
256350
|
-
}
|
|
256351
|
-
});
|
|
256352
|
-
}
|
|
256353
|
-
next();
|
|
256354
|
-
});
|
|
256355
|
-
} catch (e2) {
|
|
256356
|
-
let flags = [];
|
|
256357
|
-
try {
|
|
256358
|
-
pushLogFlags(flags, options, {}, isTTY2, transformLogLevelDefault);
|
|
256359
|
-
} catch {
|
|
256360
|
-
}
|
|
256361
|
-
const error48 = extractErrorMessageV8(e2, streamIn, details, void 0, "");
|
|
256362
|
-
sendRequest(refs, { command: "error", flags, error: error48 }, () => {
|
|
256363
|
-
error48.detail = details.load(error48.detail);
|
|
256364
|
-
callback(failureErrorWithLog("Transform failed", [error48], []), null);
|
|
256365
|
-
});
|
|
256366
|
-
}
|
|
256367
|
-
};
|
|
256368
|
-
if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
|
|
256369
|
-
let next = start2;
|
|
256370
|
-
start2 = () => fs3.writeFile(input, next);
|
|
256371
|
-
}
|
|
256372
|
-
start2(null);
|
|
256373
|
-
};
|
|
256374
|
-
let formatMessages2 = ({ callName, refs, messages, options, callback }) => {
|
|
256375
|
-
if (!options) throw new Error(`Missing second argument in ${callName}() call`);
|
|
256376
|
-
let keys = {};
|
|
256377
|
-
let kind = getFlag(options, keys, "kind", mustBeString);
|
|
256378
|
-
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
256379
|
-
let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger);
|
|
256380
|
-
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
|
256381
|
-
if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`);
|
|
256382
|
-
if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
|
|
256383
|
-
let request = {
|
|
256384
|
-
command: "format-msgs",
|
|
256385
|
-
messages: sanitizeMessages(messages, "messages", null, "", terminalWidth),
|
|
256386
|
-
isWarning: kind === "warning"
|
|
256387
|
-
};
|
|
256388
|
-
if (color !== void 0) request.color = color;
|
|
256389
|
-
if (terminalWidth !== void 0) request.terminalWidth = terminalWidth;
|
|
256390
|
-
sendRequest(refs, request, (error48, response) => {
|
|
256391
|
-
if (error48) return callback(new Error(error48), null);
|
|
256392
|
-
callback(null, response.messages);
|
|
256393
|
-
});
|
|
256394
|
-
};
|
|
256395
|
-
let analyzeMetafile2 = ({ callName, refs, metafile, options, callback }) => {
|
|
256396
|
-
if (options === void 0) options = {};
|
|
256397
|
-
let keys = {};
|
|
256398
|
-
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
256399
|
-
let verbose = getFlag(options, keys, "verbose", mustBeBoolean);
|
|
256400
|
-
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
|
256401
|
-
let request = {
|
|
256402
|
-
command: "analyze-metafile",
|
|
256403
|
-
metafile
|
|
256404
|
-
};
|
|
256405
|
-
if (color !== void 0) request.color = color;
|
|
256406
|
-
if (verbose !== void 0) request.verbose = verbose;
|
|
256407
|
-
sendRequest(refs, request, (error48, response) => {
|
|
256408
|
-
if (error48) return callback(new Error(error48), null);
|
|
256409
|
-
callback(null, response.result);
|
|
256410
|
-
});
|
|
256411
|
-
};
|
|
256412
|
-
return {
|
|
256413
|
-
readFromStdout,
|
|
256414
|
-
afterClose,
|
|
256415
|
-
service: {
|
|
256416
|
-
buildOrContext,
|
|
256417
|
-
transform: transform22,
|
|
256418
|
-
formatMessages: formatMessages2,
|
|
256419
|
-
analyzeMetafile: analyzeMetafile2
|
|
256420
|
-
}
|
|
256421
|
-
};
|
|
256422
|
-
}
|
|
256423
|
-
function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, options, isTTY2, defaultWD2, callback) {
|
|
256424
|
-
const details = createObjectStash();
|
|
256425
|
-
const isContext = callName === "context";
|
|
256426
|
-
const handleError = (e2, pluginName) => {
|
|
256427
|
-
const flags = [];
|
|
256428
|
-
try {
|
|
256429
|
-
pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault);
|
|
256430
|
-
} catch {
|
|
256431
|
-
}
|
|
256432
|
-
const message = extractErrorMessageV8(e2, streamIn, details, void 0, pluginName);
|
|
256433
|
-
sendRequest(refs, { command: "error", flags, error: message }, () => {
|
|
256434
|
-
message.detail = details.load(message.detail);
|
|
256435
|
-
callback(failureErrorWithLog(isContext ? "Context failed" : "Build failed", [message], []), null);
|
|
256436
|
-
});
|
|
256437
|
-
};
|
|
256438
|
-
let plugins;
|
|
256439
|
-
if (typeof options === "object") {
|
|
256440
|
-
const value = options.plugins;
|
|
256441
|
-
if (value !== void 0) {
|
|
256442
|
-
if (!Array.isArray(value)) return handleError(new Error(`"plugins" must be an array`), "");
|
|
256443
|
-
plugins = value;
|
|
256444
|
-
}
|
|
256445
|
-
}
|
|
256446
|
-
if (plugins && plugins.length > 0) {
|
|
256447
|
-
if (streamIn.isSync) return handleError(new Error("Cannot use plugins in synchronous API calls"), "");
|
|
256448
|
-
handlePlugins(
|
|
256449
|
-
buildKey,
|
|
256450
|
-
sendRequest,
|
|
256451
|
-
sendResponse,
|
|
256452
|
-
refs,
|
|
256453
|
-
streamIn,
|
|
256454
|
-
requestCallbacks,
|
|
256455
|
-
options,
|
|
256456
|
-
plugins,
|
|
256457
|
-
details
|
|
256458
|
-
).then(
|
|
256459
|
-
(result) => {
|
|
256460
|
-
if (!result.ok) return handleError(result.error, result.pluginName);
|
|
256461
|
-
try {
|
|
256462
|
-
buildOrContextContinue(result.requestPlugins, result.runOnEndCallbacks, result.scheduleOnDisposeCallbacks);
|
|
256463
|
-
} catch (e2) {
|
|
256464
|
-
handleError(e2, "");
|
|
256465
|
-
}
|
|
256466
|
-
},
|
|
256467
|
-
(e2) => handleError(e2, "")
|
|
256468
|
-
);
|
|
256469
|
-
return;
|
|
256470
|
-
}
|
|
256471
|
-
try {
|
|
256472
|
-
buildOrContextContinue(null, (result, done) => done([], []), () => {
|
|
256473
|
-
});
|
|
256474
|
-
} catch (e2) {
|
|
256475
|
-
handleError(e2, "");
|
|
256476
|
-
}
|
|
256477
|
-
function buildOrContextContinue(requestPlugins, runOnEndCallbacks, scheduleOnDisposeCallbacks) {
|
|
256478
|
-
const writeDefault = streamIn.hasFS;
|
|
256479
|
-
const {
|
|
256480
|
-
entries,
|
|
256481
|
-
flags,
|
|
256482
|
-
write,
|
|
256483
|
-
stdinContents,
|
|
256484
|
-
stdinResolveDir,
|
|
256485
|
-
absWorkingDir,
|
|
256486
|
-
nodePaths,
|
|
256487
|
-
mangleCache
|
|
256488
|
-
} = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault);
|
|
256489
|
-
if (write && !streamIn.hasFS) throw new Error(`The "write" option is unavailable in this environment`);
|
|
256490
|
-
const request = {
|
|
256491
|
-
command: "build",
|
|
256492
|
-
key: buildKey,
|
|
256493
|
-
entries,
|
|
256494
|
-
flags,
|
|
256495
|
-
write,
|
|
256496
|
-
stdinContents,
|
|
256497
|
-
stdinResolveDir,
|
|
256498
|
-
absWorkingDir: absWorkingDir || defaultWD2,
|
|
256499
|
-
nodePaths,
|
|
256500
|
-
context: isContext
|
|
256501
|
-
};
|
|
256502
|
-
if (requestPlugins) request.plugins = requestPlugins;
|
|
256503
|
-
if (mangleCache) request.mangleCache = mangleCache;
|
|
256504
|
-
const buildResponseToResult = (response, callback2) => {
|
|
256505
|
-
const result = {
|
|
256506
|
-
errors: replaceDetailsInMessages(response.errors, details),
|
|
256507
|
-
warnings: replaceDetailsInMessages(response.warnings, details),
|
|
256508
|
-
outputFiles: void 0,
|
|
256509
|
-
metafile: void 0,
|
|
256510
|
-
mangleCache: void 0
|
|
256511
|
-
};
|
|
256512
|
-
const originalErrors = result.errors.slice();
|
|
256513
|
-
const originalWarnings = result.warnings.slice();
|
|
256514
|
-
if (response.outputFiles) result.outputFiles = response.outputFiles.map(convertOutputFiles);
|
|
256515
|
-
if (response.metafile) result.metafile = parseJSON(response.metafile);
|
|
256516
|
-
if (response.mangleCache) result.mangleCache = response.mangleCache;
|
|
256517
|
-
if (response.writeToStdout !== void 0) console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, ""));
|
|
256518
|
-
runOnEndCallbacks(result, (onEndErrors, onEndWarnings) => {
|
|
256519
|
-
if (originalErrors.length > 0 || onEndErrors.length > 0) {
|
|
256520
|
-
const error48 = failureErrorWithLog("Build failed", originalErrors.concat(onEndErrors), originalWarnings.concat(onEndWarnings));
|
|
256521
|
-
return callback2(error48, null, onEndErrors, onEndWarnings);
|
|
256522
|
-
}
|
|
256523
|
-
callback2(null, result, onEndErrors, onEndWarnings);
|
|
256524
|
-
});
|
|
256525
|
-
};
|
|
256526
|
-
let latestResultPromise;
|
|
256527
|
-
let provideLatestResult;
|
|
256528
|
-
if (isContext)
|
|
256529
|
-
requestCallbacks["on-end"] = (id, request2) => new Promise((resolve) => {
|
|
256530
|
-
buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => {
|
|
256531
|
-
const response = {
|
|
256532
|
-
errors: onEndErrors,
|
|
256533
|
-
warnings: onEndWarnings
|
|
256534
|
-
};
|
|
256535
|
-
if (provideLatestResult) provideLatestResult(err, result);
|
|
256536
|
-
latestResultPromise = void 0;
|
|
256537
|
-
provideLatestResult = void 0;
|
|
256538
|
-
sendResponse(id, response);
|
|
256539
|
-
resolve();
|
|
256540
|
-
});
|
|
256541
|
-
});
|
|
256542
|
-
sendRequest(refs, request, (error48, response) => {
|
|
256543
|
-
if (error48) return callback(new Error(error48), null);
|
|
256544
|
-
if (!isContext) {
|
|
256545
|
-
return buildResponseToResult(response, (err, res) => {
|
|
256546
|
-
scheduleOnDisposeCallbacks();
|
|
256547
|
-
return callback(err, res);
|
|
256548
|
-
});
|
|
256549
|
-
}
|
|
256550
|
-
if (response.errors.length > 0) {
|
|
256551
|
-
return callback(failureErrorWithLog("Context failed", response.errors, response.warnings), null);
|
|
256552
|
-
}
|
|
256553
|
-
let didDispose = false;
|
|
256554
|
-
const result = {
|
|
256555
|
-
rebuild: () => {
|
|
256556
|
-
if (!latestResultPromise) latestResultPromise = new Promise((resolve, reject) => {
|
|
256557
|
-
let settlePromise;
|
|
256558
|
-
provideLatestResult = (err, result2) => {
|
|
256559
|
-
if (!settlePromise) settlePromise = () => err ? reject(err) : resolve(result2);
|
|
256560
|
-
};
|
|
256561
|
-
const triggerAnotherBuild = () => {
|
|
256562
|
-
const request2 = {
|
|
256563
|
-
command: "rebuild",
|
|
256564
|
-
key: buildKey
|
|
256565
|
-
};
|
|
256566
|
-
sendRequest(refs, request2, (error210, response2) => {
|
|
256567
|
-
if (error210) {
|
|
256568
|
-
reject(new Error(error210));
|
|
256569
|
-
} else if (settlePromise) {
|
|
256570
|
-
settlePromise();
|
|
256571
|
-
} else {
|
|
256572
|
-
triggerAnotherBuild();
|
|
256573
|
-
}
|
|
256574
|
-
});
|
|
256575
|
-
};
|
|
256576
|
-
triggerAnotherBuild();
|
|
256577
|
-
});
|
|
256578
|
-
return latestResultPromise;
|
|
256579
|
-
},
|
|
256580
|
-
watch: (options2 = {}) => new Promise((resolve, reject) => {
|
|
256581
|
-
if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
|
|
256582
|
-
const keys = {};
|
|
256583
|
-
const delay = getFlag(options2, keys, "delay", mustBeInteger);
|
|
256584
|
-
checkForInvalidFlags(options2, keys, `in watch() call`);
|
|
256585
|
-
const request2 = {
|
|
256586
|
-
command: "watch",
|
|
256587
|
-
key: buildKey
|
|
256588
|
-
};
|
|
256589
|
-
if (delay) request2.delay = delay;
|
|
256590
|
-
sendRequest(refs, request2, (error210) => {
|
|
256591
|
-
if (error210) reject(new Error(error210));
|
|
256592
|
-
else resolve(void 0);
|
|
256593
|
-
});
|
|
256594
|
-
}),
|
|
256595
|
-
serve: (options2 = {}) => new Promise((resolve, reject) => {
|
|
256596
|
-
if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`);
|
|
256597
|
-
const keys = {};
|
|
256598
|
-
const port = getFlag(options2, keys, "port", mustBeValidPortNumber);
|
|
256599
|
-
const host = getFlag(options2, keys, "host", mustBeString);
|
|
256600
|
-
const servedir = getFlag(options2, keys, "servedir", mustBeString);
|
|
256601
|
-
const keyfile = getFlag(options2, keys, "keyfile", mustBeString);
|
|
256602
|
-
const certfile = getFlag(options2, keys, "certfile", mustBeString);
|
|
256603
|
-
const fallback = getFlag(options2, keys, "fallback", mustBeString);
|
|
256604
|
-
const cors = getFlag(options2, keys, "cors", mustBeObject);
|
|
256605
|
-
const onRequest = getFlag(options2, keys, "onRequest", mustBeFunction);
|
|
256606
|
-
checkForInvalidFlags(options2, keys, `in serve() call`);
|
|
256607
|
-
const request2 = {
|
|
256608
|
-
command: "serve",
|
|
256609
|
-
key: buildKey,
|
|
256610
|
-
onRequest: !!onRequest
|
|
256611
|
-
};
|
|
256612
|
-
if (port !== void 0) request2.port = port;
|
|
256613
|
-
if (host !== void 0) request2.host = host;
|
|
256614
|
-
if (servedir !== void 0) request2.servedir = servedir;
|
|
256615
|
-
if (keyfile !== void 0) request2.keyfile = keyfile;
|
|
256616
|
-
if (certfile !== void 0) request2.certfile = certfile;
|
|
256617
|
-
if (fallback !== void 0) request2.fallback = fallback;
|
|
256618
|
-
if (cors) {
|
|
256619
|
-
const corsKeys = {};
|
|
256620
|
-
const origin = getFlag(cors, corsKeys, "origin", mustBeStringOrArrayOfStrings);
|
|
256621
|
-
checkForInvalidFlags(cors, corsKeys, `on "cors" object`);
|
|
256622
|
-
if (Array.isArray(origin)) request2.corsOrigin = origin;
|
|
256623
|
-
else if (origin !== void 0) request2.corsOrigin = [origin];
|
|
256624
|
-
}
|
|
256625
|
-
sendRequest(refs, request2, (error210, response2) => {
|
|
256626
|
-
if (error210) return reject(new Error(error210));
|
|
256627
|
-
if (onRequest) {
|
|
256628
|
-
requestCallbacks["serve-request"] = (id, request3) => {
|
|
256629
|
-
onRequest(request3.args);
|
|
256630
|
-
sendResponse(id, {});
|
|
256631
|
-
};
|
|
256632
|
-
}
|
|
256633
|
-
resolve(response2);
|
|
256634
|
-
});
|
|
256635
|
-
}),
|
|
256636
|
-
cancel: () => new Promise((resolve) => {
|
|
256637
|
-
if (didDispose) return resolve();
|
|
256638
|
-
const request2 = {
|
|
256639
|
-
command: "cancel",
|
|
256640
|
-
key: buildKey
|
|
256641
|
-
};
|
|
256642
|
-
sendRequest(refs, request2, () => {
|
|
256643
|
-
resolve();
|
|
256644
|
-
});
|
|
256645
|
-
}),
|
|
256646
|
-
dispose: () => new Promise((resolve) => {
|
|
256647
|
-
if (didDispose) return resolve();
|
|
256648
|
-
didDispose = true;
|
|
256649
|
-
const request2 = {
|
|
256650
|
-
command: "dispose",
|
|
256651
|
-
key: buildKey
|
|
256652
|
-
};
|
|
256653
|
-
sendRequest(refs, request2, () => {
|
|
256654
|
-
resolve();
|
|
256655
|
-
scheduleOnDisposeCallbacks();
|
|
256656
|
-
refs.unref();
|
|
256657
|
-
});
|
|
256658
|
-
})
|
|
256659
|
-
};
|
|
256660
|
-
refs.ref();
|
|
256661
|
-
callback(null, result);
|
|
256662
|
-
});
|
|
256663
|
-
}
|
|
256664
|
-
}
|
|
256665
|
-
var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, initialOptions, plugins, details) => {
|
|
256666
|
-
let onStartCallbacks = [];
|
|
256667
|
-
let onEndCallbacks = [];
|
|
256668
|
-
let onResolveCallbacks = {};
|
|
256669
|
-
let onLoadCallbacks = {};
|
|
256670
|
-
let onDisposeCallbacks = [];
|
|
256671
|
-
let nextCallbackID = 0;
|
|
256672
|
-
let i2 = 0;
|
|
256673
|
-
let requestPlugins = [];
|
|
256674
|
-
let isSetupDone = false;
|
|
256675
|
-
plugins = [...plugins];
|
|
256676
|
-
for (let item of plugins) {
|
|
256677
|
-
let keys = {};
|
|
256678
|
-
if (typeof item !== "object") throw new Error(`Plugin at index ${i2} must be an object`);
|
|
256679
|
-
const name2 = getFlag(item, keys, "name", mustBeString);
|
|
256680
|
-
if (typeof name2 !== "string" || name2 === "") throw new Error(`Plugin at index ${i2} is missing a name`);
|
|
256681
|
-
try {
|
|
256682
|
-
let setup = getFlag(item, keys, "setup", mustBeFunction);
|
|
256683
|
-
if (typeof setup !== "function") throw new Error(`Plugin is missing a setup function`);
|
|
256684
|
-
checkForInvalidFlags(item, keys, `on plugin ${quote(name2)}`);
|
|
256685
|
-
let plugin = {
|
|
256686
|
-
name: name2,
|
|
256687
|
-
onStart: false,
|
|
256688
|
-
onEnd: false,
|
|
256689
|
-
onResolve: [],
|
|
256690
|
-
onLoad: []
|
|
256691
|
-
};
|
|
256692
|
-
i2++;
|
|
256693
|
-
let resolve = (path3, options = {}) => {
|
|
256694
|
-
if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed');
|
|
256695
|
-
if (typeof path3 !== "string") throw new Error(`The path to resolve must be a string`);
|
|
256696
|
-
let keys2 = /* @__PURE__ */ Object.create(null);
|
|
256697
|
-
let pluginName = getFlag(options, keys2, "pluginName", mustBeString);
|
|
256698
|
-
let importer = getFlag(options, keys2, "importer", mustBeString);
|
|
256699
|
-
let namespace = getFlag(options, keys2, "namespace", mustBeString);
|
|
256700
|
-
let resolveDir = getFlag(options, keys2, "resolveDir", mustBeString);
|
|
256701
|
-
let kind = getFlag(options, keys2, "kind", mustBeString);
|
|
256702
|
-
let pluginData = getFlag(options, keys2, "pluginData", canBeAnything);
|
|
256703
|
-
let importAttributes = getFlag(options, keys2, "with", mustBeObject);
|
|
256704
|
-
checkForInvalidFlags(options, keys2, "in resolve() call");
|
|
256705
|
-
return new Promise((resolve2, reject) => {
|
|
256706
|
-
const request = {
|
|
256707
|
-
command: "resolve",
|
|
256708
|
-
path: path3,
|
|
256709
|
-
key: buildKey,
|
|
256710
|
-
pluginName: name2
|
|
256711
|
-
};
|
|
256712
|
-
if (pluginName != null) request.pluginName = pluginName;
|
|
256713
|
-
if (importer != null) request.importer = importer;
|
|
256714
|
-
if (namespace != null) request.namespace = namespace;
|
|
256715
|
-
if (resolveDir != null) request.resolveDir = resolveDir;
|
|
256716
|
-
if (kind != null) request.kind = kind;
|
|
256717
|
-
else throw new Error(`Must specify "kind" when calling "resolve"`);
|
|
256718
|
-
if (pluginData != null) request.pluginData = details.store(pluginData);
|
|
256719
|
-
if (importAttributes != null) request.with = sanitizeStringMap(importAttributes, "with");
|
|
256720
|
-
sendRequest(refs, request, (error48, response) => {
|
|
256721
|
-
if (error48 !== null) reject(new Error(error48));
|
|
256722
|
-
else resolve2({
|
|
256723
|
-
errors: replaceDetailsInMessages(response.errors, details),
|
|
256724
|
-
warnings: replaceDetailsInMessages(response.warnings, details),
|
|
256725
|
-
path: response.path,
|
|
256726
|
-
external: response.external,
|
|
256727
|
-
sideEffects: response.sideEffects,
|
|
256728
|
-
namespace: response.namespace,
|
|
256729
|
-
suffix: response.suffix,
|
|
256730
|
-
pluginData: details.load(response.pluginData)
|
|
256731
|
-
});
|
|
256732
|
-
});
|
|
256733
|
-
});
|
|
256734
|
-
};
|
|
256735
|
-
let promise2 = setup({
|
|
256736
|
-
initialOptions,
|
|
256737
|
-
resolve,
|
|
256738
|
-
onStart(callback) {
|
|
256739
|
-
let registeredText = `This error came from the "onStart" callback registered here:`;
|
|
256740
|
-
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart");
|
|
256741
|
-
onStartCallbacks.push({ name: name2, callback, note: registeredNote });
|
|
256742
|
-
plugin.onStart = true;
|
|
256743
|
-
},
|
|
256744
|
-
onEnd(callback) {
|
|
256745
|
-
let registeredText = `This error came from the "onEnd" callback registered here:`;
|
|
256746
|
-
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd");
|
|
256747
|
-
onEndCallbacks.push({ name: name2, callback, note: registeredNote });
|
|
256748
|
-
plugin.onEnd = true;
|
|
256749
|
-
},
|
|
256750
|
-
onResolve(options, callback) {
|
|
256751
|
-
let registeredText = `This error came from the "onResolve" callback registered here:`;
|
|
256752
|
-
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onResolve");
|
|
256753
|
-
let keys2 = {};
|
|
256754
|
-
let filter3 = getFlag(options, keys2, "filter", mustBeRegExp);
|
|
256755
|
-
let namespace = getFlag(options, keys2, "namespace", mustBeString);
|
|
256756
|
-
checkForInvalidFlags(options, keys2, `in onResolve() call for plugin ${quote(name2)}`);
|
|
256757
|
-
if (filter3 == null) throw new Error(`onResolve() call is missing a filter`);
|
|
256758
|
-
let id = nextCallbackID++;
|
|
256759
|
-
onResolveCallbacks[id] = { name: name2, callback, note: registeredNote };
|
|
256760
|
-
plugin.onResolve.push({ id, filter: jsRegExpToGoRegExp(filter3), namespace: namespace || "" });
|
|
256761
|
-
},
|
|
256762
|
-
onLoad(options, callback) {
|
|
256763
|
-
let registeredText = `This error came from the "onLoad" callback registered here:`;
|
|
256764
|
-
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onLoad");
|
|
256765
|
-
let keys2 = {};
|
|
256766
|
-
let filter3 = getFlag(options, keys2, "filter", mustBeRegExp);
|
|
256767
|
-
let namespace = getFlag(options, keys2, "namespace", mustBeString);
|
|
256768
|
-
checkForInvalidFlags(options, keys2, `in onLoad() call for plugin ${quote(name2)}`);
|
|
256769
|
-
if (filter3 == null) throw new Error(`onLoad() call is missing a filter`);
|
|
256770
|
-
let id = nextCallbackID++;
|
|
256771
|
-
onLoadCallbacks[id] = { name: name2, callback, note: registeredNote };
|
|
256772
|
-
plugin.onLoad.push({ id, filter: jsRegExpToGoRegExp(filter3), namespace: namespace || "" });
|
|
256773
|
-
},
|
|
256774
|
-
onDispose(callback) {
|
|
256775
|
-
onDisposeCallbacks.push(callback);
|
|
256776
|
-
},
|
|
256777
|
-
esbuild: streamIn.esbuild
|
|
256778
|
-
});
|
|
256779
|
-
if (promise2) await promise2;
|
|
256780
|
-
requestPlugins.push(plugin);
|
|
256781
|
-
} catch (e2) {
|
|
256782
|
-
return { ok: false, error: e2, pluginName: name2 };
|
|
256783
|
-
}
|
|
256784
|
-
}
|
|
256785
|
-
requestCallbacks["on-start"] = async (id, request) => {
|
|
256786
|
-
details.clear();
|
|
256787
|
-
let response = { errors: [], warnings: [] };
|
|
256788
|
-
await Promise.all(onStartCallbacks.map(async ({ name: name2, callback, note }) => {
|
|
256789
|
-
try {
|
|
256790
|
-
let result = await callback();
|
|
256791
|
-
if (result != null) {
|
|
256792
|
-
if (typeof result !== "object") throw new Error(`Expected onStart() callback in plugin ${quote(name2)} to return an object`);
|
|
256793
|
-
let keys = {};
|
|
256794
|
-
let errors = getFlag(result, keys, "errors", mustBeArray);
|
|
256795
|
-
let warnings = getFlag(result, keys, "warnings", mustBeArray);
|
|
256796
|
-
checkForInvalidFlags(result, keys, `from onStart() callback in plugin ${quote(name2)}`);
|
|
256797
|
-
if (errors != null) response.errors.push(...sanitizeMessages(errors, "errors", details, name2, void 0));
|
|
256798
|
-
if (warnings != null) response.warnings.push(...sanitizeMessages(warnings, "warnings", details, name2, void 0));
|
|
256799
|
-
}
|
|
256800
|
-
} catch (e2) {
|
|
256801
|
-
response.errors.push(extractErrorMessageV8(e2, streamIn, details, note && note(), name2));
|
|
256802
|
-
}
|
|
256803
|
-
}));
|
|
256804
|
-
sendResponse(id, response);
|
|
256805
|
-
};
|
|
256806
|
-
requestCallbacks["on-resolve"] = async (id, request) => {
|
|
256807
|
-
let response = {}, name2 = "", callback, note;
|
|
256808
|
-
for (let id2 of request.ids) {
|
|
256809
|
-
try {
|
|
256810
|
-
({ name: name2, callback, note } = onResolveCallbacks[id2]);
|
|
256811
|
-
let result = await callback({
|
|
256812
|
-
path: request.path,
|
|
256813
|
-
importer: request.importer,
|
|
256814
|
-
namespace: request.namespace,
|
|
256815
|
-
resolveDir: request.resolveDir,
|
|
256816
|
-
kind: request.kind,
|
|
256817
|
-
pluginData: details.load(request.pluginData),
|
|
256818
|
-
with: request.with
|
|
256819
|
-
});
|
|
256820
|
-
if (result != null) {
|
|
256821
|
-
if (typeof result !== "object") throw new Error(`Expected onResolve() callback in plugin ${quote(name2)} to return an object`);
|
|
256822
|
-
let keys = {};
|
|
256823
|
-
let pluginName = getFlag(result, keys, "pluginName", mustBeString);
|
|
256824
|
-
let path3 = getFlag(result, keys, "path", mustBeString);
|
|
256825
|
-
let namespace = getFlag(result, keys, "namespace", mustBeString);
|
|
256826
|
-
let suffix = getFlag(result, keys, "suffix", mustBeString);
|
|
256827
|
-
let external = getFlag(result, keys, "external", mustBeBoolean);
|
|
256828
|
-
let sideEffects = getFlag(result, keys, "sideEffects", mustBeBoolean);
|
|
256829
|
-
let pluginData = getFlag(result, keys, "pluginData", canBeAnything);
|
|
256830
|
-
let errors = getFlag(result, keys, "errors", mustBeArray);
|
|
256831
|
-
let warnings = getFlag(result, keys, "warnings", mustBeArray);
|
|
256832
|
-
let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings);
|
|
256833
|
-
let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings);
|
|
256834
|
-
checkForInvalidFlags(result, keys, `from onResolve() callback in plugin ${quote(name2)}`);
|
|
256835
|
-
response.id = id2;
|
|
256836
|
-
if (pluginName != null) response.pluginName = pluginName;
|
|
256837
|
-
if (path3 != null) response.path = path3;
|
|
256838
|
-
if (namespace != null) response.namespace = namespace;
|
|
256839
|
-
if (suffix != null) response.suffix = suffix;
|
|
256840
|
-
if (external != null) response.external = external;
|
|
256841
|
-
if (sideEffects != null) response.sideEffects = sideEffects;
|
|
256842
|
-
if (pluginData != null) response.pluginData = details.store(pluginData);
|
|
256843
|
-
if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name2, void 0);
|
|
256844
|
-
if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name2, void 0);
|
|
256845
|
-
if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
|
|
256846
|
-
if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs");
|
|
256847
|
-
break;
|
|
256848
|
-
}
|
|
256849
|
-
} catch (e2) {
|
|
256850
|
-
response = { id: id2, errors: [extractErrorMessageV8(e2, streamIn, details, note && note(), name2)] };
|
|
256851
|
-
break;
|
|
256852
|
-
}
|
|
256853
|
-
}
|
|
256854
|
-
sendResponse(id, response);
|
|
256855
|
-
};
|
|
256856
|
-
requestCallbacks["on-load"] = async (id, request) => {
|
|
256857
|
-
let response = {}, name2 = "", callback, note;
|
|
256858
|
-
for (let id2 of request.ids) {
|
|
256859
|
-
try {
|
|
256860
|
-
({ name: name2, callback, note } = onLoadCallbacks[id2]);
|
|
256861
|
-
let result = await callback({
|
|
256862
|
-
path: request.path,
|
|
256863
|
-
namespace: request.namespace,
|
|
256864
|
-
suffix: request.suffix,
|
|
256865
|
-
pluginData: details.load(request.pluginData),
|
|
256866
|
-
with: request.with
|
|
256867
|
-
});
|
|
256868
|
-
if (result != null) {
|
|
256869
|
-
if (typeof result !== "object") throw new Error(`Expected onLoad() callback in plugin ${quote(name2)} to return an object`);
|
|
256870
|
-
let keys = {};
|
|
256871
|
-
let pluginName = getFlag(result, keys, "pluginName", mustBeString);
|
|
256872
|
-
let contents = getFlag(result, keys, "contents", mustBeStringOrUint8Array);
|
|
256873
|
-
let resolveDir = getFlag(result, keys, "resolveDir", mustBeString);
|
|
256874
|
-
let pluginData = getFlag(result, keys, "pluginData", canBeAnything);
|
|
256875
|
-
let loader2 = getFlag(result, keys, "loader", mustBeString);
|
|
256876
|
-
let errors = getFlag(result, keys, "errors", mustBeArray);
|
|
256877
|
-
let warnings = getFlag(result, keys, "warnings", mustBeArray);
|
|
256878
|
-
let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings);
|
|
256879
|
-
let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings);
|
|
256880
|
-
checkForInvalidFlags(result, keys, `from onLoad() callback in plugin ${quote(name2)}`);
|
|
256881
|
-
response.id = id2;
|
|
256882
|
-
if (pluginName != null) response.pluginName = pluginName;
|
|
256883
|
-
if (contents instanceof Uint8Array) response.contents = contents;
|
|
256884
|
-
else if (contents != null) response.contents = encodeUTF8(contents);
|
|
256885
|
-
if (resolveDir != null) response.resolveDir = resolveDir;
|
|
256886
|
-
if (pluginData != null) response.pluginData = details.store(pluginData);
|
|
256887
|
-
if (loader2 != null) response.loader = loader2;
|
|
256888
|
-
if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name2, void 0);
|
|
256889
|
-
if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name2, void 0);
|
|
256890
|
-
if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
|
|
256891
|
-
if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs");
|
|
256892
|
-
break;
|
|
256893
|
-
}
|
|
256894
|
-
} catch (e2) {
|
|
256895
|
-
response = { id: id2, errors: [extractErrorMessageV8(e2, streamIn, details, note && note(), name2)] };
|
|
256896
|
-
break;
|
|
256897
|
-
}
|
|
256898
|
-
}
|
|
256899
|
-
sendResponse(id, response);
|
|
256900
|
-
};
|
|
256901
|
-
let runOnEndCallbacks = (result, done) => done([], []);
|
|
256902
|
-
if (onEndCallbacks.length > 0) {
|
|
256903
|
-
runOnEndCallbacks = (result, done) => {
|
|
256904
|
-
(async () => {
|
|
256905
|
-
const onEndErrors = [];
|
|
256906
|
-
const onEndWarnings = [];
|
|
256907
|
-
for (const { name: name2, callback, note } of onEndCallbacks) {
|
|
256908
|
-
let newErrors;
|
|
256909
|
-
let newWarnings;
|
|
256910
|
-
try {
|
|
256911
|
-
const value = await callback(result);
|
|
256912
|
-
if (value != null) {
|
|
256913
|
-
if (typeof value !== "object") throw new Error(`Expected onEnd() callback in plugin ${quote(name2)} to return an object`);
|
|
256914
|
-
let keys = {};
|
|
256915
|
-
let errors = getFlag(value, keys, "errors", mustBeArray);
|
|
256916
|
-
let warnings = getFlag(value, keys, "warnings", mustBeArray);
|
|
256917
|
-
checkForInvalidFlags(value, keys, `from onEnd() callback in plugin ${quote(name2)}`);
|
|
256918
|
-
if (errors != null) newErrors = sanitizeMessages(errors, "errors", details, name2, void 0);
|
|
256919
|
-
if (warnings != null) newWarnings = sanitizeMessages(warnings, "warnings", details, name2, void 0);
|
|
256920
|
-
}
|
|
256921
|
-
} catch (e2) {
|
|
256922
|
-
newErrors = [extractErrorMessageV8(e2, streamIn, details, note && note(), name2)];
|
|
256923
|
-
}
|
|
256924
|
-
if (newErrors) {
|
|
256925
|
-
onEndErrors.push(...newErrors);
|
|
256926
|
-
try {
|
|
256927
|
-
result.errors.push(...newErrors);
|
|
256928
|
-
} catch {
|
|
256929
|
-
}
|
|
256930
|
-
}
|
|
256931
|
-
if (newWarnings) {
|
|
256932
|
-
onEndWarnings.push(...newWarnings);
|
|
256933
|
-
try {
|
|
256934
|
-
result.warnings.push(...newWarnings);
|
|
256935
|
-
} catch {
|
|
256936
|
-
}
|
|
256937
|
-
}
|
|
256938
|
-
}
|
|
256939
|
-
done(onEndErrors, onEndWarnings);
|
|
256940
|
-
})();
|
|
256941
|
-
};
|
|
256942
|
-
}
|
|
256943
|
-
let scheduleOnDisposeCallbacks = () => {
|
|
256944
|
-
for (const cb of onDisposeCallbacks) {
|
|
256945
|
-
setTimeout(() => cb(), 0);
|
|
256946
|
-
}
|
|
256947
|
-
};
|
|
256948
|
-
isSetupDone = true;
|
|
256949
|
-
return {
|
|
256950
|
-
ok: true,
|
|
256951
|
-
requestPlugins,
|
|
256952
|
-
runOnEndCallbacks,
|
|
256953
|
-
scheduleOnDisposeCallbacks
|
|
256954
|
-
};
|
|
256955
|
-
};
|
|
256956
|
-
function createObjectStash() {
|
|
256957
|
-
const map21 = /* @__PURE__ */ new Map();
|
|
256958
|
-
let nextID = 0;
|
|
256959
|
-
return {
|
|
256960
|
-
clear() {
|
|
256961
|
-
map21.clear();
|
|
256962
|
-
},
|
|
256963
|
-
load(id) {
|
|
256964
|
-
return map21.get(id);
|
|
256965
|
-
},
|
|
256966
|
-
store(value) {
|
|
256967
|
-
if (value === void 0) return -1;
|
|
256968
|
-
const id = nextID++;
|
|
256969
|
-
map21.set(id, value);
|
|
256970
|
-
return id;
|
|
256971
|
-
}
|
|
256972
|
-
};
|
|
256973
|
-
}
|
|
256974
|
-
function extractCallerV8(e2, streamIn, ident) {
|
|
256975
|
-
let note;
|
|
256976
|
-
let tried = false;
|
|
256977
|
-
return () => {
|
|
256978
|
-
if (tried) return note;
|
|
256979
|
-
tried = true;
|
|
256980
|
-
try {
|
|
256981
|
-
let lines = (e2.stack + "").split("\n");
|
|
256982
|
-
lines.splice(1, 1);
|
|
256983
|
-
let location = parseStackLinesV8(streamIn, lines, ident);
|
|
256984
|
-
if (location) {
|
|
256985
|
-
note = { text: e2.message, location };
|
|
256986
|
-
return note;
|
|
256987
|
-
}
|
|
256988
|
-
} catch {
|
|
256989
|
-
}
|
|
256990
|
-
};
|
|
256991
|
-
}
|
|
256992
|
-
function extractErrorMessageV8(e2, streamIn, stash, note, pluginName) {
|
|
256993
|
-
let text = "Internal error";
|
|
256994
|
-
let location = null;
|
|
256995
|
-
try {
|
|
256996
|
-
text = (e2 && e2.message || e2) + "";
|
|
256997
|
-
} catch {
|
|
256998
|
-
}
|
|
256999
|
-
try {
|
|
257000
|
-
location = parseStackLinesV8(streamIn, (e2.stack + "").split("\n"), "");
|
|
257001
|
-
} catch {
|
|
257002
|
-
}
|
|
257003
|
-
return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e2) : -1 };
|
|
257004
|
-
}
|
|
257005
|
-
function parseStackLinesV8(streamIn, lines, ident) {
|
|
257006
|
-
let at = " at ";
|
|
257007
|
-
if (streamIn.readFileSync && !lines[0].startsWith(at) && lines[1].startsWith(at)) {
|
|
257008
|
-
for (let i2 = 1; i2 < lines.length; i2++) {
|
|
257009
|
-
let line = lines[i2];
|
|
257010
|
-
if (!line.startsWith(at)) continue;
|
|
257011
|
-
line = line.slice(at.length);
|
|
257012
|
-
while (true) {
|
|
257013
|
-
let match = /^(?:new |async )?\S+ \((.*)\)$/.exec(line);
|
|
257014
|
-
if (match) {
|
|
257015
|
-
line = match[1];
|
|
257016
|
-
continue;
|
|
257017
|
-
}
|
|
257018
|
-
match = /^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(line);
|
|
257019
|
-
if (match) {
|
|
257020
|
-
line = match[1];
|
|
257021
|
-
continue;
|
|
257022
|
-
}
|
|
257023
|
-
match = /^(\S+):(\d+):(\d+)$/.exec(line);
|
|
257024
|
-
if (match) {
|
|
257025
|
-
let contents;
|
|
257026
|
-
try {
|
|
257027
|
-
contents = streamIn.readFileSync(match[1], "utf8");
|
|
257028
|
-
} catch {
|
|
257029
|
-
break;
|
|
257030
|
-
}
|
|
257031
|
-
let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match[2] - 1] || "";
|
|
257032
|
-
let column = +match[3] - 1;
|
|
257033
|
-
let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0;
|
|
257034
|
-
return {
|
|
257035
|
-
file: match[1],
|
|
257036
|
-
namespace: "file",
|
|
257037
|
-
line: +match[2],
|
|
257038
|
-
column: encodeUTF8(lineText.slice(0, column)).length,
|
|
257039
|
-
length: encodeUTF8(lineText.slice(column, column + length)).length,
|
|
257040
|
-
lineText: lineText + "\n" + lines.slice(1).join("\n"),
|
|
257041
|
-
suggestion: ""
|
|
257042
|
-
};
|
|
257043
|
-
}
|
|
257044
|
-
break;
|
|
257045
|
-
}
|
|
257046
|
-
}
|
|
257047
|
-
}
|
|
257048
|
-
return null;
|
|
257049
|
-
}
|
|
257050
|
-
function failureErrorWithLog(text, errors, warnings) {
|
|
257051
|
-
let limit = 5;
|
|
257052
|
-
text += errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e2, i2) => {
|
|
257053
|
-
if (i2 === limit) return "\n...";
|
|
257054
|
-
if (!e2.location) return `
|
|
257055
|
-
error: ${e2.text}`;
|
|
257056
|
-
let { file: file2, line, column } = e2.location;
|
|
257057
|
-
let pluginText = e2.pluginName ? `[plugin: ${e2.pluginName}] ` : "";
|
|
257058
|
-
return `
|
|
257059
|
-
${file2}:${line}:${column}: ERROR: ${pluginText}${e2.text}`;
|
|
257060
|
-
}).join("");
|
|
257061
|
-
let error48 = new Error(text);
|
|
257062
|
-
for (const [key, value] of [["errors", errors], ["warnings", warnings]]) {
|
|
257063
|
-
Object.defineProperty(error48, key, {
|
|
257064
|
-
configurable: true,
|
|
257065
|
-
enumerable: true,
|
|
257066
|
-
get: () => value,
|
|
257067
|
-
set: (value2) => Object.defineProperty(error48, key, {
|
|
257068
|
-
configurable: true,
|
|
257069
|
-
enumerable: true,
|
|
257070
|
-
value: value2
|
|
257071
|
-
})
|
|
257072
|
-
});
|
|
257073
|
-
}
|
|
257074
|
-
return error48;
|
|
257075
|
-
}
|
|
257076
|
-
function replaceDetailsInMessages(messages, stash) {
|
|
257077
|
-
for (const message of messages) {
|
|
257078
|
-
message.detail = stash.load(message.detail);
|
|
257079
|
-
}
|
|
257080
|
-
return messages;
|
|
257081
|
-
}
|
|
257082
|
-
function sanitizeLocation(location, where, terminalWidth) {
|
|
257083
|
-
if (location == null) return null;
|
|
257084
|
-
let keys = {};
|
|
257085
|
-
let file2 = getFlag(location, keys, "file", mustBeString);
|
|
257086
|
-
let namespace = getFlag(location, keys, "namespace", mustBeString);
|
|
257087
|
-
let line = getFlag(location, keys, "line", mustBeInteger);
|
|
257088
|
-
let column = getFlag(location, keys, "column", mustBeInteger);
|
|
257089
|
-
let length = getFlag(location, keys, "length", mustBeInteger);
|
|
257090
|
-
let lineText = getFlag(location, keys, "lineText", mustBeString);
|
|
257091
|
-
let suggestion = getFlag(location, keys, "suggestion", mustBeString);
|
|
257092
|
-
checkForInvalidFlags(location, keys, where);
|
|
257093
|
-
if (lineText) {
|
|
257094
|
-
const relevantASCII = lineText.slice(
|
|
257095
|
-
0,
|
|
257096
|
-
(column && column > 0 ? column : 0) + (length && length > 0 ? length : 0) + (terminalWidth && terminalWidth > 0 ? terminalWidth : 80)
|
|
257097
|
-
);
|
|
257098
|
-
if (!/[\x7F-\uFFFF]/.test(relevantASCII) && !/\n/.test(lineText)) {
|
|
257099
|
-
lineText = relevantASCII;
|
|
257100
|
-
}
|
|
257101
|
-
}
|
|
257102
|
-
return {
|
|
257103
|
-
file: file2 || "",
|
|
257104
|
-
namespace: namespace || "",
|
|
257105
|
-
line: line || 0,
|
|
257106
|
-
column: column || 0,
|
|
257107
|
-
length: length || 0,
|
|
257108
|
-
lineText: lineText || "",
|
|
257109
|
-
suggestion: suggestion || ""
|
|
257110
|
-
};
|
|
257111
|
-
}
|
|
257112
|
-
function sanitizeMessages(messages, property, stash, fallbackPluginName, terminalWidth) {
|
|
257113
|
-
let messagesClone = [];
|
|
257114
|
-
let index = 0;
|
|
257115
|
-
for (const message of messages) {
|
|
257116
|
-
let keys = {};
|
|
257117
|
-
let id = getFlag(message, keys, "id", mustBeString);
|
|
257118
|
-
let pluginName = getFlag(message, keys, "pluginName", mustBeString);
|
|
257119
|
-
let text = getFlag(message, keys, "text", mustBeString);
|
|
257120
|
-
let location = getFlag(message, keys, "location", mustBeObjectOrNull);
|
|
257121
|
-
let notes = getFlag(message, keys, "notes", mustBeArray);
|
|
257122
|
-
let detail = getFlag(message, keys, "detail", canBeAnything);
|
|
257123
|
-
let where = `in element ${index} of "${property}"`;
|
|
257124
|
-
checkForInvalidFlags(message, keys, where);
|
|
257125
|
-
let notesClone = [];
|
|
257126
|
-
if (notes) {
|
|
257127
|
-
for (const note of notes) {
|
|
257128
|
-
let noteKeys = {};
|
|
257129
|
-
let noteText = getFlag(note, noteKeys, "text", mustBeString);
|
|
257130
|
-
let noteLocation = getFlag(note, noteKeys, "location", mustBeObjectOrNull);
|
|
257131
|
-
checkForInvalidFlags(note, noteKeys, where);
|
|
257132
|
-
notesClone.push({
|
|
257133
|
-
text: noteText || "",
|
|
257134
|
-
location: sanitizeLocation(noteLocation, where, terminalWidth)
|
|
257135
|
-
});
|
|
257136
|
-
}
|
|
257137
|
-
}
|
|
257138
|
-
messagesClone.push({
|
|
257139
|
-
id: id || "",
|
|
257140
|
-
pluginName: pluginName || fallbackPluginName,
|
|
257141
|
-
text: text || "",
|
|
257142
|
-
location: sanitizeLocation(location, where, terminalWidth),
|
|
257143
|
-
notes: notesClone,
|
|
257144
|
-
detail: stash ? stash.store(detail) : -1
|
|
257145
|
-
});
|
|
257146
|
-
index++;
|
|
257147
|
-
}
|
|
257148
|
-
return messagesClone;
|
|
257149
|
-
}
|
|
257150
|
-
function sanitizeStringArray(values, property) {
|
|
257151
|
-
const result = [];
|
|
257152
|
-
for (const value of values) {
|
|
257153
|
-
if (typeof value !== "string") throw new Error(`${quote(property)} must be an array of strings`);
|
|
257154
|
-
result.push(value);
|
|
257155
|
-
}
|
|
257156
|
-
return result;
|
|
257157
|
-
}
|
|
257158
|
-
function sanitizeStringMap(map21, property) {
|
|
257159
|
-
const result = /* @__PURE__ */ Object.create(null);
|
|
257160
|
-
for (const key in map21) {
|
|
257161
|
-
const value = map21[key];
|
|
257162
|
-
if (typeof value !== "string") throw new Error(`key ${quote(key)} in object ${quote(property)} must be a string`);
|
|
257163
|
-
result[key] = value;
|
|
257164
|
-
}
|
|
257165
|
-
return result;
|
|
257166
|
-
}
|
|
257167
|
-
function convertOutputFiles({ path: path3, contents, hash: hash2 }) {
|
|
257168
|
-
let text = null;
|
|
257169
|
-
return {
|
|
257170
|
-
path: path3,
|
|
257171
|
-
contents,
|
|
257172
|
-
hash: hash2,
|
|
257173
|
-
get text() {
|
|
257174
|
-
const binary2 = this.contents;
|
|
257175
|
-
if (text === null || binary2 !== contents) {
|
|
257176
|
-
contents = binary2;
|
|
257177
|
-
text = decodeUTF8(binary2);
|
|
257178
|
-
}
|
|
257179
|
-
return text;
|
|
257180
|
-
}
|
|
257181
|
-
};
|
|
257182
|
-
}
|
|
257183
|
-
function jsRegExpToGoRegExp(regexp) {
|
|
257184
|
-
let result = regexp.source;
|
|
257185
|
-
if (regexp.flags) result = `(?${regexp.flags})${result}`;
|
|
257186
|
-
return result;
|
|
257187
|
-
}
|
|
257188
|
-
function parseJSON(bytes) {
|
|
257189
|
-
let text;
|
|
257190
|
-
try {
|
|
257191
|
-
text = decodeUTF8(bytes);
|
|
257192
|
-
} catch {
|
|
257193
|
-
return JSON_parse(bytes);
|
|
257194
|
-
}
|
|
257195
|
-
return JSON.parse(text);
|
|
257196
|
-
}
|
|
257197
|
-
var fs2 = require("fs");
|
|
257198
|
-
var os2 = require("os");
|
|
257199
|
-
var path2 = require("path");
|
|
257200
|
-
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
|
257201
|
-
var child_process = require("child_process");
|
|
257202
|
-
var crypto2 = require("crypto");
|
|
257203
|
-
var path22 = require("path");
|
|
257204
|
-
var fs22 = require("fs");
|
|
257205
|
-
var os22 = require("os");
|
|
257206
|
-
var tty = require("tty");
|
|
257207
|
-
var worker_threads;
|
|
257208
|
-
if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
257209
|
-
try {
|
|
257210
|
-
worker_threads = require("worker_threads");
|
|
257211
|
-
} catch {
|
|
257212
|
-
}
|
|
257213
|
-
let [major, minor] = process.versions.node.split(".");
|
|
257214
|
-
if (
|
|
257215
|
-
// <v12.17.0 does not work
|
|
257216
|
-
+major < 12 || +major === 12 && +minor < 17 || +major === 13 && +minor < 13
|
|
257217
|
-
) {
|
|
257218
|
-
worker_threads = void 0;
|
|
257219
|
-
}
|
|
257220
|
-
}
|
|
257221
|
-
var _a2;
|
|
257222
|
-
var isInternalWorkerThread = ((_a2 = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a2.esbuildVersion) === "0.27.4";
|
|
257223
|
-
var esbuildCommandAndArgs = () => {
|
|
257224
|
-
if ((!ESBUILD_BINARY_PATH || true) && (path22.basename(__filename) !== "main.js" || path22.basename(__dirname) !== "lib")) {
|
|
257225
|
-
throw new Error(
|
|
257226
|
-
`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
|
|
257227
|
-
|
|
257228
|
-
More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`
|
|
257229
|
-
);
|
|
257230
|
-
}
|
|
257231
|
-
if (true) {
|
|
257232
|
-
return ["node", [path22.join(__dirname, "..", "bin", "esbuild")]];
|
|
257233
|
-
} else {
|
|
257234
|
-
const { binPath, isWASM } = generateBinPath();
|
|
257235
|
-
if (isWASM) {
|
|
257236
|
-
return ["node", [binPath]];
|
|
257237
|
-
} else {
|
|
257238
|
-
return [binPath, []];
|
|
257239
|
-
}
|
|
257240
|
-
}
|
|
257241
|
-
};
|
|
257242
|
-
var isTTY = () => tty.isatty(2);
|
|
257243
|
-
var fsSync = {
|
|
257244
|
-
readFile(tempFile, callback) {
|
|
257245
|
-
try {
|
|
257246
|
-
let contents = fs22.readFileSync(tempFile, "utf8");
|
|
257247
|
-
try {
|
|
257248
|
-
fs22.unlinkSync(tempFile);
|
|
257249
|
-
} catch {
|
|
257250
|
-
}
|
|
257251
|
-
callback(null, contents);
|
|
257252
|
-
} catch (err) {
|
|
257253
|
-
callback(err, null);
|
|
257254
|
-
}
|
|
257255
|
-
},
|
|
257256
|
-
writeFile(contents, callback) {
|
|
257257
|
-
try {
|
|
257258
|
-
let tempFile = randomFileName();
|
|
257259
|
-
fs22.writeFileSync(tempFile, contents);
|
|
257260
|
-
callback(tempFile);
|
|
257261
|
-
} catch {
|
|
257262
|
-
callback(null);
|
|
257263
|
-
}
|
|
257264
|
-
}
|
|
257265
|
-
};
|
|
257266
|
-
var fsAsync = {
|
|
257267
|
-
readFile(tempFile, callback) {
|
|
257268
|
-
try {
|
|
257269
|
-
fs22.readFile(tempFile, "utf8", (err, contents) => {
|
|
257270
|
-
try {
|
|
257271
|
-
fs22.unlink(tempFile, () => callback(err, contents));
|
|
257272
|
-
} catch {
|
|
257273
|
-
callback(err, contents);
|
|
257274
|
-
}
|
|
257275
|
-
});
|
|
257276
|
-
} catch (err) {
|
|
257277
|
-
callback(err, null);
|
|
257278
|
-
}
|
|
257279
|
-
},
|
|
257280
|
-
writeFile(contents, callback) {
|
|
257281
|
-
try {
|
|
257282
|
-
let tempFile = randomFileName();
|
|
257283
|
-
fs22.writeFile(tempFile, contents, (err) => err !== null ? callback(null) : callback(tempFile));
|
|
257284
|
-
} catch {
|
|
257285
|
-
callback(null);
|
|
257286
|
-
}
|
|
257287
|
-
}
|
|
257288
|
-
};
|
|
257289
|
-
var version2 = "0.27.4";
|
|
257290
|
-
var build = (options) => ensureServiceIsRunning().build(options);
|
|
257291
|
-
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
|
257292
|
-
var transform2 = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
257293
|
-
var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options);
|
|
257294
|
-
var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options);
|
|
257295
|
-
var buildSync = (options) => {
|
|
257296
|
-
if (worker_threads && !isInternalWorkerThread) {
|
|
257297
|
-
if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
|
|
257298
|
-
return workerThreadService.buildSync(options);
|
|
257299
|
-
}
|
|
257300
|
-
let result;
|
|
257301
|
-
runServiceSync((service) => service.buildOrContext({
|
|
257302
|
-
callName: "buildSync",
|
|
257303
|
-
refs: null,
|
|
257304
|
-
options,
|
|
257305
|
-
isTTY: isTTY(),
|
|
257306
|
-
defaultWD,
|
|
257307
|
-
callback: (err, res) => {
|
|
257308
|
-
if (err) throw err;
|
|
257309
|
-
result = res;
|
|
257310
|
-
}
|
|
257311
|
-
}));
|
|
257312
|
-
return result;
|
|
257313
|
-
};
|
|
257314
|
-
var transformSync = (input, options) => {
|
|
257315
|
-
if (worker_threads && !isInternalWorkerThread) {
|
|
257316
|
-
if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
|
|
257317
|
-
return workerThreadService.transformSync(input, options);
|
|
257318
|
-
}
|
|
257319
|
-
let result;
|
|
257320
|
-
runServiceSync((service) => service.transform({
|
|
257321
|
-
callName: "transformSync",
|
|
257322
|
-
refs: null,
|
|
257323
|
-
input,
|
|
257324
|
-
options: options || {},
|
|
257325
|
-
isTTY: isTTY(),
|
|
257326
|
-
fs: fsSync,
|
|
257327
|
-
callback: (err, res) => {
|
|
257328
|
-
if (err) throw err;
|
|
257329
|
-
result = res;
|
|
257330
|
-
}
|
|
257331
|
-
}));
|
|
257332
|
-
return result;
|
|
257333
|
-
};
|
|
257334
|
-
var formatMessagesSync = (messages, options) => {
|
|
257335
|
-
if (worker_threads && !isInternalWorkerThread) {
|
|
257336
|
-
if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
|
|
257337
|
-
return workerThreadService.formatMessagesSync(messages, options);
|
|
257338
|
-
}
|
|
257339
|
-
let result;
|
|
257340
|
-
runServiceSync((service) => service.formatMessages({
|
|
257341
|
-
callName: "formatMessagesSync",
|
|
257342
|
-
refs: null,
|
|
257343
|
-
messages,
|
|
257344
|
-
options,
|
|
257345
|
-
callback: (err, res) => {
|
|
257346
|
-
if (err) throw err;
|
|
257347
|
-
result = res;
|
|
257348
|
-
}
|
|
257349
|
-
}));
|
|
257350
|
-
return result;
|
|
257351
|
-
};
|
|
257352
|
-
var analyzeMetafileSync = (metafile, options) => {
|
|
257353
|
-
if (worker_threads && !isInternalWorkerThread) {
|
|
257354
|
-
if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads);
|
|
257355
|
-
return workerThreadService.analyzeMetafileSync(metafile, options);
|
|
257356
|
-
}
|
|
257357
|
-
let result;
|
|
257358
|
-
runServiceSync((service) => service.analyzeMetafile({
|
|
257359
|
-
callName: "analyzeMetafileSync",
|
|
257360
|
-
refs: null,
|
|
257361
|
-
metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
|
|
257362
|
-
options,
|
|
257363
|
-
callback: (err, res) => {
|
|
257364
|
-
if (err) throw err;
|
|
257365
|
-
result = res;
|
|
257366
|
-
}
|
|
257367
|
-
}));
|
|
257368
|
-
return result;
|
|
257369
|
-
};
|
|
257370
|
-
var stop = () => {
|
|
257371
|
-
if (stopService) stopService();
|
|
257372
|
-
if (workerThreadService) workerThreadService.stop();
|
|
257373
|
-
return Promise.resolve();
|
|
257374
|
-
};
|
|
257375
|
-
var initializeWasCalled = false;
|
|
257376
|
-
var initialize = (options) => {
|
|
257377
|
-
options = validateInitializeOptions(options || {});
|
|
257378
|
-
if (options.wasmURL) throw new Error(`The "wasmURL" option only works in the browser`);
|
|
257379
|
-
if (options.wasmModule) throw new Error(`The "wasmModule" option only works in the browser`);
|
|
257380
|
-
if (options.worker) throw new Error(`The "worker" option only works in the browser`);
|
|
257381
|
-
if (initializeWasCalled) throw new Error('Cannot call "initialize" more than once');
|
|
257382
|
-
ensureServiceIsRunning();
|
|
257383
|
-
initializeWasCalled = true;
|
|
257384
|
-
return Promise.resolve();
|
|
257385
|
-
};
|
|
257386
|
-
var defaultWD = process.cwd();
|
|
257387
|
-
var longLivedService;
|
|
257388
|
-
var stopService;
|
|
257389
|
-
var ensureServiceIsRunning = () => {
|
|
257390
|
-
if (longLivedService) return longLivedService;
|
|
257391
|
-
let [command, args] = esbuildCommandAndArgs();
|
|
257392
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.27.4"}`, "--ping"), {
|
|
257393
|
-
windowsHide: true,
|
|
257394
|
-
stdio: ["pipe", "pipe", "inherit"],
|
|
257395
|
-
cwd: defaultWD
|
|
257396
|
-
});
|
|
257397
|
-
let { readFromStdout, afterClose, service } = createChannel({
|
|
257398
|
-
writeToStdin(bytes) {
|
|
257399
|
-
child.stdin.write(bytes, (err) => {
|
|
257400
|
-
if (err) afterClose(err);
|
|
257401
|
-
});
|
|
257402
|
-
},
|
|
257403
|
-
readFileSync: fs22.readFileSync,
|
|
257404
|
-
isSync: false,
|
|
257405
|
-
hasFS: true,
|
|
257406
|
-
esbuild: node_exports
|
|
257407
|
-
});
|
|
257408
|
-
child.stdin.on("error", afterClose);
|
|
257409
|
-
child.on("error", afterClose);
|
|
257410
|
-
const stdin = child.stdin;
|
|
257411
|
-
const stdout = child.stdout;
|
|
257412
|
-
stdout.on("data", readFromStdout);
|
|
257413
|
-
stdout.on("end", afterClose);
|
|
257414
|
-
stopService = () => {
|
|
257415
|
-
stdin.destroy();
|
|
257416
|
-
stdout.destroy();
|
|
257417
|
-
child.kill();
|
|
257418
|
-
initializeWasCalled = false;
|
|
257419
|
-
longLivedService = void 0;
|
|
257420
|
-
stopService = void 0;
|
|
257421
|
-
};
|
|
257422
|
-
let refCount = 0;
|
|
257423
|
-
child.unref();
|
|
257424
|
-
if (stdin.unref) {
|
|
257425
|
-
stdin.unref();
|
|
257426
|
-
}
|
|
257427
|
-
if (stdout.unref) {
|
|
257428
|
-
stdout.unref();
|
|
257429
|
-
}
|
|
257430
|
-
const refs = {
|
|
257431
|
-
ref() {
|
|
257432
|
-
if (++refCount === 1) child.ref();
|
|
257433
|
-
},
|
|
257434
|
-
unref() {
|
|
257435
|
-
if (--refCount === 0) child.unref();
|
|
257436
|
-
}
|
|
257437
|
-
};
|
|
257438
|
-
longLivedService = {
|
|
257439
|
-
build: (options) => new Promise((resolve, reject) => {
|
|
257440
|
-
service.buildOrContext({
|
|
257441
|
-
callName: "build",
|
|
257442
|
-
refs,
|
|
257443
|
-
options,
|
|
257444
|
-
isTTY: isTTY(),
|
|
257445
|
-
defaultWD,
|
|
257446
|
-
callback: (err, res) => err ? reject(err) : resolve(res)
|
|
257447
|
-
});
|
|
257448
|
-
}),
|
|
257449
|
-
context: (options) => new Promise((resolve, reject) => service.buildOrContext({
|
|
257450
|
-
callName: "context",
|
|
257451
|
-
refs,
|
|
257452
|
-
options,
|
|
257453
|
-
isTTY: isTTY(),
|
|
257454
|
-
defaultWD,
|
|
257455
|
-
callback: (err, res) => err ? reject(err) : resolve(res)
|
|
257456
|
-
})),
|
|
257457
|
-
transform: (input, options) => new Promise((resolve, reject) => service.transform({
|
|
257458
|
-
callName: "transform",
|
|
257459
|
-
refs,
|
|
257460
|
-
input,
|
|
257461
|
-
options: options || {},
|
|
257462
|
-
isTTY: isTTY(),
|
|
257463
|
-
fs: fsAsync,
|
|
257464
|
-
callback: (err, res) => err ? reject(err) : resolve(res)
|
|
257465
|
-
})),
|
|
257466
|
-
formatMessages: (messages, options) => new Promise((resolve, reject) => service.formatMessages({
|
|
257467
|
-
callName: "formatMessages",
|
|
257468
|
-
refs,
|
|
257469
|
-
messages,
|
|
257470
|
-
options,
|
|
257471
|
-
callback: (err, res) => err ? reject(err) : resolve(res)
|
|
257472
|
-
})),
|
|
257473
|
-
analyzeMetafile: (metafile, options) => new Promise((resolve, reject) => service.analyzeMetafile({
|
|
257474
|
-
callName: "analyzeMetafile",
|
|
257475
|
-
refs,
|
|
257476
|
-
metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
|
|
257477
|
-
options,
|
|
257478
|
-
callback: (err, res) => err ? reject(err) : resolve(res)
|
|
257479
|
-
}))
|
|
257480
|
-
};
|
|
257481
|
-
return longLivedService;
|
|
257482
|
-
};
|
|
257483
|
-
var runServiceSync = (callback) => {
|
|
257484
|
-
let [command, args] = esbuildCommandAndArgs();
|
|
257485
|
-
let stdin = new Uint8Array();
|
|
257486
|
-
let { readFromStdout, afterClose, service } = createChannel({
|
|
257487
|
-
writeToStdin(bytes) {
|
|
257488
|
-
if (stdin.length !== 0) throw new Error("Must run at most one command");
|
|
257489
|
-
stdin = bytes;
|
|
257490
|
-
},
|
|
257491
|
-
isSync: true,
|
|
257492
|
-
hasFS: true,
|
|
257493
|
-
esbuild: node_exports
|
|
257494
|
-
});
|
|
257495
|
-
callback(service);
|
|
257496
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.27.4"}`), {
|
|
257497
|
-
cwd: defaultWD,
|
|
257498
|
-
windowsHide: true,
|
|
257499
|
-
input: stdin,
|
|
257500
|
-
// We don't know how large the output could be. If it's too large, the
|
|
257501
|
-
// command will fail with ENOBUFS. Reserve 16mb for now since that feels
|
|
257502
|
-
// like it should be enough. Also allow overriding this with an environment
|
|
257503
|
-
// variable.
|
|
257504
|
-
maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
|
|
257505
|
-
});
|
|
257506
|
-
readFromStdout(stdout);
|
|
257507
|
-
afterClose(null);
|
|
257508
|
-
};
|
|
257509
|
-
var randomFileName = () => {
|
|
257510
|
-
return path22.join(os22.tmpdir(), `esbuild-${crypto2.randomBytes(32).toString("hex")}`);
|
|
257511
|
-
};
|
|
257512
|
-
var workerThreadService = null;
|
|
257513
|
-
var startWorkerThreadService = (worker_threads2) => {
|
|
257514
|
-
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
|
257515
|
-
let worker = new worker_threads2.Worker(__filename, {
|
|
257516
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.27.4" },
|
|
257517
|
-
transferList: [workerPort],
|
|
257518
|
-
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
|
257519
|
-
//
|
|
257520
|
-
// Take care when launching worker threads from preload scripts (scripts loaded
|
|
257521
|
-
// and run using the `-r` command line flag). Unless the `execArgv` option is
|
|
257522
|
-
// explicitly set, new Worker threads automatically inherit the command line flags
|
|
257523
|
-
// from the running process and will preload the same preload scripts as the main
|
|
257524
|
-
// thread. If the preload script unconditionally launches a worker thread, every
|
|
257525
|
-
// thread spawned will spawn another until the application crashes.
|
|
257526
|
-
//
|
|
257527
|
-
execArgv: []
|
|
257528
|
-
});
|
|
257529
|
-
let nextID = 0;
|
|
257530
|
-
let fakeBuildError = (text) => {
|
|
257531
|
-
let error48 = new Error(`Build failed with 1 error:
|
|
257532
|
-
error: ${text}`);
|
|
257533
|
-
let errors = [{ id: "", pluginName: "", text, location: null, notes: [], detail: void 0 }];
|
|
257534
|
-
error48.errors = errors;
|
|
257535
|
-
error48.warnings = [];
|
|
257536
|
-
return error48;
|
|
257537
|
-
};
|
|
257538
|
-
let validateBuildSyncOptions = (options) => {
|
|
257539
|
-
if (!options) return;
|
|
257540
|
-
let plugins = options.plugins;
|
|
257541
|
-
if (plugins && plugins.length > 0) throw fakeBuildError(`Cannot use plugins in synchronous API calls`);
|
|
257542
|
-
};
|
|
257543
|
-
let applyProperties = (object3, properties) => {
|
|
257544
|
-
for (let key in properties) {
|
|
257545
|
-
object3[key] = properties[key];
|
|
257546
|
-
}
|
|
257547
|
-
};
|
|
257548
|
-
let runCallSync = (command, args) => {
|
|
257549
|
-
let id = nextID++;
|
|
257550
|
-
let sharedBuffer = new SharedArrayBuffer(8);
|
|
257551
|
-
let sharedBufferView = new Int32Array(sharedBuffer);
|
|
257552
|
-
let msg = { sharedBuffer, id, command, args };
|
|
257553
|
-
worker.postMessage(msg);
|
|
257554
|
-
let status = Atomics.wait(sharedBufferView, 0, 0);
|
|
257555
|
-
if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status);
|
|
257556
|
-
let { message: { id: id2, resolve, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort);
|
|
257557
|
-
if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`);
|
|
257558
|
-
if (reject) {
|
|
257559
|
-
applyProperties(reject, properties);
|
|
257560
|
-
throw reject;
|
|
257561
|
-
}
|
|
257562
|
-
return resolve;
|
|
257563
|
-
};
|
|
257564
|
-
worker.unref();
|
|
257565
|
-
return {
|
|
257566
|
-
buildSync(options) {
|
|
257567
|
-
validateBuildSyncOptions(options);
|
|
257568
|
-
return runCallSync("build", [options]);
|
|
257569
|
-
},
|
|
257570
|
-
transformSync(input, options) {
|
|
257571
|
-
return runCallSync("transform", [input, options]);
|
|
257572
|
-
},
|
|
257573
|
-
formatMessagesSync(messages, options) {
|
|
257574
|
-
return runCallSync("formatMessages", [messages, options]);
|
|
257575
|
-
},
|
|
257576
|
-
analyzeMetafileSync(metafile, options) {
|
|
257577
|
-
return runCallSync("analyzeMetafile", [metafile, options]);
|
|
257578
|
-
},
|
|
257579
|
-
stop() {
|
|
257580
|
-
worker.terminate();
|
|
257581
|
-
workerThreadService = null;
|
|
257582
|
-
}
|
|
257583
|
-
};
|
|
257584
|
-
};
|
|
257585
|
-
var startSyncServiceWorker = () => {
|
|
257586
|
-
let workerPort = worker_threads.workerData.workerPort;
|
|
257587
|
-
let parentPort = worker_threads.parentPort;
|
|
257588
|
-
let extractProperties = (object3) => {
|
|
257589
|
-
let properties = {};
|
|
257590
|
-
if (object3 && typeof object3 === "object") {
|
|
257591
|
-
for (let key in object3) {
|
|
257592
|
-
properties[key] = object3[key];
|
|
257593
|
-
}
|
|
257594
|
-
}
|
|
257595
|
-
return properties;
|
|
257596
|
-
};
|
|
257597
|
-
try {
|
|
257598
|
-
let service = ensureServiceIsRunning();
|
|
257599
|
-
defaultWD = worker_threads.workerData.defaultWD;
|
|
257600
|
-
parentPort.on("message", (msg) => {
|
|
257601
|
-
(async () => {
|
|
257602
|
-
let { sharedBuffer, id, command, args } = msg;
|
|
257603
|
-
let sharedBufferView = new Int32Array(sharedBuffer);
|
|
257604
|
-
try {
|
|
257605
|
-
switch (command) {
|
|
257606
|
-
case "build":
|
|
257607
|
-
workerPort.postMessage({ id, resolve: await service.build(args[0]) });
|
|
257608
|
-
break;
|
|
257609
|
-
case "transform":
|
|
257610
|
-
workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) });
|
|
257611
|
-
break;
|
|
257612
|
-
case "formatMessages":
|
|
257613
|
-
workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) });
|
|
257614
|
-
break;
|
|
257615
|
-
case "analyzeMetafile":
|
|
257616
|
-
workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) });
|
|
257617
|
-
break;
|
|
257618
|
-
default:
|
|
257619
|
-
throw new Error(`Invalid command: ${command}`);
|
|
257620
|
-
}
|
|
257621
|
-
} catch (reject) {
|
|
257622
|
-
workerPort.postMessage({ id, reject, properties: extractProperties(reject) });
|
|
257623
|
-
}
|
|
257624
|
-
Atomics.add(sharedBufferView, 0, 1);
|
|
257625
|
-
Atomics.notify(sharedBufferView, 0, Infinity);
|
|
257626
|
-
})();
|
|
257627
|
-
});
|
|
257628
|
-
} catch (reject) {
|
|
257629
|
-
parentPort.on("message", (msg) => {
|
|
257630
|
-
let { sharedBuffer, id } = msg;
|
|
257631
|
-
let sharedBufferView = new Int32Array(sharedBuffer);
|
|
257632
|
-
workerPort.postMessage({ id, reject, properties: extractProperties(reject) });
|
|
257633
|
-
Atomics.add(sharedBufferView, 0, 1);
|
|
257634
|
-
Atomics.notify(sharedBufferView, 0, Infinity);
|
|
257635
|
-
});
|
|
257636
|
-
}
|
|
257637
|
-
};
|
|
257638
|
-
if (isInternalWorkerThread) {
|
|
257639
|
-
startSyncServiceWorker();
|
|
257640
|
-
}
|
|
257641
|
-
var node_default = node_exports;
|
|
257642
|
-
}
|
|
257643
|
-
});
|
|
257644
|
-
|
|
257645
255329
|
// src/commands/build/build.ts
|
|
257646
255330
|
var build_exports = {};
|
|
257647
255331
|
__export(build_exports, {
|
|
@@ -257649,22 +255333,20 @@ __export(build_exports, {
|
|
|
257649
255333
|
});
|
|
257650
255334
|
async function getEsbuild() {
|
|
257651
255335
|
if (!!process.versions.webcontainer) {
|
|
257652
|
-
const esbuildWasm = await
|
|
255336
|
+
const esbuildWasm = await import("esbuild-wasm");
|
|
257653
255337
|
await esbuildWasm.initialize({
|
|
257654
|
-
worker: false
|
|
257655
|
-
wasmURL: (0, import_path.join)(__dirname, "esbuild.wasm")
|
|
255338
|
+
worker: false
|
|
257656
255339
|
});
|
|
257657
255340
|
return esbuildWasm;
|
|
257658
255341
|
} else {
|
|
257659
255342
|
return import_esbuild.default;
|
|
257660
255343
|
}
|
|
257661
255344
|
}
|
|
257662
|
-
var import_esbuild_decorators, import_esbuild,
|
|
255345
|
+
var import_esbuild_decorators, import_esbuild, import_rxjs6, import_operators5, build_default;
|
|
257663
255346
|
var init_build = __esm({
|
|
257664
255347
|
"src/commands/build/build.ts"() {
|
|
257665
255348
|
import_esbuild_decorators = __toESM(require_src());
|
|
257666
255349
|
import_esbuild = __toESM(require_main());
|
|
257667
|
-
import_path = require("path");
|
|
257668
255350
|
import_rxjs6 = __toESM(require_cjs());
|
|
257669
255351
|
import_operators5 = __toESM(require_operators());
|
|
257670
255352
|
init_log();
|
|
@@ -272082,7 +269764,7 @@ var require_BufferList2 = __commonJS({
|
|
|
272082
269764
|
this.head = this.tail = null;
|
|
272083
269765
|
this.length = 0;
|
|
272084
269766
|
};
|
|
272085
|
-
BufferList.prototype.join = function
|
|
269767
|
+
BufferList.prototype.join = function join(s2) {
|
|
272086
269768
|
if (this.length === 0) return "";
|
|
272087
269769
|
var p = this.head;
|
|
272088
269770
|
var ret = "" + p.data;
|
|
@@ -276882,7 +274564,7 @@ var require_buffer_list3 = __commonJS({
|
|
|
276882
274564
|
}
|
|
276883
274565
|
}, {
|
|
276884
274566
|
key: "join",
|
|
276885
|
-
value: function
|
|
274567
|
+
value: function join(s2) {
|
|
276886
274568
|
if (this.length === 0) return "";
|
|
276887
274569
|
var p = this.head;
|
|
276888
274570
|
var ret = "" + p.data;
|
|
@@ -280224,7 +277906,7 @@ var require_buffer_list4 = __commonJS({
|
|
|
280224
277906
|
}
|
|
280225
277907
|
}, {
|
|
280226
277908
|
key: "join",
|
|
280227
|
-
value: function
|
|
277909
|
+
value: function join(s2) {
|
|
280228
277910
|
if (this.length === 0) return "";
|
|
280229
277911
|
var p = this.head;
|
|
280230
277912
|
var ret = "" + p.data;
|
|
@@ -282996,7 +280678,7 @@ var require_buffer_list5 = __commonJS({
|
|
|
282996
280678
|
}
|
|
282997
280679
|
}, {
|
|
282998
280680
|
key: "join",
|
|
282999
|
-
value: function
|
|
280681
|
+
value: function join(s2) {
|
|
283000
280682
|
if (this.length === 0) return "";
|
|
283001
280683
|
var p = this.head;
|
|
283002
280684
|
var ret = "" + p.data;
|
|
@@ -286233,7 +283915,7 @@ var require_buffer_list6 = __commonJS({
|
|
|
286233
283915
|
}
|
|
286234
283916
|
}, {
|
|
286235
283917
|
key: "join",
|
|
286236
|
-
value: function
|
|
283918
|
+
value: function join(s2) {
|
|
286237
283919
|
if (this.length === 0) return "";
|
|
286238
283920
|
var p = this.head;
|
|
286239
283921
|
var ret = "" + p.data;
|