@fern-api/fern-api-dev 3.64.2 → 3.64.4-1-g68ccf13a82f
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/cli.cjs +1082 -29
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1273516,11 +1273516,11 @@ var require_yauzl = __commonJS({
|
|
|
1273516
1273516
|
var fileNameLength = buffer.readUInt16LE(26);
|
|
1273517
1273517
|
var extraFieldLength = buffer.readUInt16LE(28);
|
|
1273518
1273518
|
var localFileHeaderEnd = entry.relativeOffsetOfLocalHeader + buffer.length + fileNameLength + extraFieldLength;
|
|
1273519
|
-
var
|
|
1273519
|
+
var decompress3;
|
|
1273520
1273520
|
if (entry.compressionMethod === 0) {
|
|
1273521
|
-
|
|
1273521
|
+
decompress3 = false;
|
|
1273522
1273522
|
} else if (entry.compressionMethod === 8) {
|
|
1273523
|
-
|
|
1273523
|
+
decompress3 = options2.decompress != null ? options2.decompress : true;
|
|
1273524
1273524
|
} else {
|
|
1273525
1273525
|
return callback(new Error("unsupported compression method: " + entry.compressionMethod));
|
|
1273526
1273526
|
}
|
|
@@ -1273536,7 +1273536,7 @@ var require_yauzl = __commonJS({
|
|
|
1273536
1273536
|
end: fileDataStart + relativeEnd
|
|
1273537
1273537
|
});
|
|
1273538
1273538
|
var endpointStream = readStream2;
|
|
1273539
|
-
if (
|
|
1273539
|
+
if (decompress3) {
|
|
1273540
1273540
|
var destroyed = false;
|
|
1273541
1273541
|
var inflateFilter = zlib4.createInflateRaw();
|
|
1273542
1273542
|
readStream2.on("error", function(err2) {
|
|
@@ -1273769,7 +1273769,7 @@ var require_decompress_unzip = __commonJS({
|
|
|
1273769
1273769
|
var fileType = require_file_type3();
|
|
1273770
1273770
|
var getStream = require_get_stream2();
|
|
1273771
1273771
|
var pify = require_pify();
|
|
1273772
|
-
var
|
|
1273772
|
+
var yauzl2 = require_yauzl();
|
|
1273773
1273773
|
var getType3 = (entry, mode) => {
|
|
1273774
1273774
|
const IFMT2 = 61440;
|
|
1273775
1273775
|
const IFDIR2 = 16384;
|
|
@@ -1273826,7 +1273826,7 @@ var require_decompress_unzip = __commonJS({
|
|
|
1273826
1273826
|
if (!fileType(buf) || fileType(buf).ext !== "zip") {
|
|
1273827
1273827
|
return Promise.resolve([]);
|
|
1273828
1273828
|
}
|
|
1273829
|
-
return pify(
|
|
1273829
|
+
return pify(yauzl2.fromBuffer)(buf, { lazyEntries: true }).then(extractFile2);
|
|
1273830
1273830
|
};
|
|
1273831
1273831
|
}
|
|
1273832
1273832
|
});
|
|
@@ -1274252,6 +1274252,1019 @@ var require_supports_hyperlinks = __commonJS({
|
|
|
1274252
1274252
|
}
|
|
1274253
1274253
|
});
|
|
1274254
1274254
|
|
|
1274255
|
+
// ../../../node_modules/.pnpm/yauzl@3.2.0/node_modules/yauzl/fd-slicer.js
|
|
1274256
|
+
var require_fd_slicer2 = __commonJS({
|
|
1274257
|
+
"../../../node_modules/.pnpm/yauzl@3.2.0/node_modules/yauzl/fd-slicer.js"(exports2) {
|
|
1274258
|
+
"use strict";
|
|
1274259
|
+
var fs33 = require("fs");
|
|
1274260
|
+
var util4 = require("util");
|
|
1274261
|
+
var stream5 = require("stream");
|
|
1274262
|
+
var Readable6 = stream5.Readable;
|
|
1274263
|
+
var Writable2 = stream5.Writable;
|
|
1274264
|
+
var PassThrough5 = stream5.PassThrough;
|
|
1274265
|
+
var Pend = require_pend();
|
|
1274266
|
+
var EventEmitter8 = require("events").EventEmitter;
|
|
1274267
|
+
exports2.createFromBuffer = createFromBuffer;
|
|
1274268
|
+
exports2.createFromFd = createFromFd;
|
|
1274269
|
+
exports2.BufferSlicer = BufferSlicer;
|
|
1274270
|
+
exports2.FdSlicer = FdSlicer;
|
|
1274271
|
+
util4.inherits(FdSlicer, EventEmitter8);
|
|
1274272
|
+
function FdSlicer(fd, options2) {
|
|
1274273
|
+
options2 = options2 || {};
|
|
1274274
|
+
EventEmitter8.call(this);
|
|
1274275
|
+
this.fd = fd;
|
|
1274276
|
+
this.pend = new Pend();
|
|
1274277
|
+
this.pend.max = 1;
|
|
1274278
|
+
this.refCount = 0;
|
|
1274279
|
+
this.autoClose = !!options2.autoClose;
|
|
1274280
|
+
}
|
|
1274281
|
+
FdSlicer.prototype.read = function(buffer, offset2, length, position4, callback) {
|
|
1274282
|
+
var self2 = this;
|
|
1274283
|
+
self2.pend.go(function(cb2) {
|
|
1274284
|
+
fs33.read(self2.fd, buffer, offset2, length, position4, function(err, bytesRead, buffer2) {
|
|
1274285
|
+
cb2();
|
|
1274286
|
+
callback(err, bytesRead, buffer2);
|
|
1274287
|
+
});
|
|
1274288
|
+
});
|
|
1274289
|
+
};
|
|
1274290
|
+
FdSlicer.prototype.write = function(buffer, offset2, length, position4, callback) {
|
|
1274291
|
+
var self2 = this;
|
|
1274292
|
+
self2.pend.go(function(cb2) {
|
|
1274293
|
+
fs33.write(self2.fd, buffer, offset2, length, position4, function(err, written, buffer2) {
|
|
1274294
|
+
cb2();
|
|
1274295
|
+
callback(err, written, buffer2);
|
|
1274296
|
+
});
|
|
1274297
|
+
});
|
|
1274298
|
+
};
|
|
1274299
|
+
FdSlicer.prototype.createReadStream = function(options2) {
|
|
1274300
|
+
return new ReadStream2(this, options2);
|
|
1274301
|
+
};
|
|
1274302
|
+
FdSlicer.prototype.createWriteStream = function(options2) {
|
|
1274303
|
+
return new WriteStream2(this, options2);
|
|
1274304
|
+
};
|
|
1274305
|
+
FdSlicer.prototype.ref = function() {
|
|
1274306
|
+
this.refCount += 1;
|
|
1274307
|
+
};
|
|
1274308
|
+
FdSlicer.prototype.unref = function() {
|
|
1274309
|
+
var self2 = this;
|
|
1274310
|
+
self2.refCount -= 1;
|
|
1274311
|
+
if (self2.refCount > 0) return;
|
|
1274312
|
+
if (self2.refCount < 0) throw new Error("invalid unref");
|
|
1274313
|
+
if (self2.autoClose) {
|
|
1274314
|
+
fs33.close(self2.fd, onCloseDone);
|
|
1274315
|
+
}
|
|
1274316
|
+
function onCloseDone(err) {
|
|
1274317
|
+
if (err) {
|
|
1274318
|
+
self2.emit("error", err);
|
|
1274319
|
+
} else {
|
|
1274320
|
+
self2.emit("close");
|
|
1274321
|
+
}
|
|
1274322
|
+
}
|
|
1274323
|
+
};
|
|
1274324
|
+
util4.inherits(ReadStream2, Readable6);
|
|
1274325
|
+
function ReadStream2(context2, options2) {
|
|
1274326
|
+
options2 = options2 || {};
|
|
1274327
|
+
Readable6.call(this, options2);
|
|
1274328
|
+
this.context = context2;
|
|
1274329
|
+
this.context.ref();
|
|
1274330
|
+
this.start = options2.start || 0;
|
|
1274331
|
+
this.endOffset = options2.end;
|
|
1274332
|
+
this.pos = this.start;
|
|
1274333
|
+
this.destroyed = false;
|
|
1274334
|
+
}
|
|
1274335
|
+
ReadStream2.prototype._read = function(n6) {
|
|
1274336
|
+
var self2 = this;
|
|
1274337
|
+
if (self2.destroyed) return;
|
|
1274338
|
+
var toRead = Math.min(self2._readableState.highWaterMark, n6);
|
|
1274339
|
+
if (self2.endOffset != null) {
|
|
1274340
|
+
toRead = Math.min(toRead, self2.endOffset - self2.pos);
|
|
1274341
|
+
}
|
|
1274342
|
+
if (toRead <= 0) {
|
|
1274343
|
+
self2.destroyed = true;
|
|
1274344
|
+
self2.push(null);
|
|
1274345
|
+
self2.context.unref();
|
|
1274346
|
+
return;
|
|
1274347
|
+
}
|
|
1274348
|
+
self2.context.pend.go(function(cb2) {
|
|
1274349
|
+
if (self2.destroyed) return cb2();
|
|
1274350
|
+
var buffer = Buffer.allocUnsafe(toRead);
|
|
1274351
|
+
fs33.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
|
|
1274352
|
+
if (err) {
|
|
1274353
|
+
self2.destroy(err);
|
|
1274354
|
+
} else if (bytesRead === 0) {
|
|
1274355
|
+
self2.destroyed = true;
|
|
1274356
|
+
self2.push(null);
|
|
1274357
|
+
self2.context.unref();
|
|
1274358
|
+
} else {
|
|
1274359
|
+
self2.pos += bytesRead;
|
|
1274360
|
+
self2.push(buffer.slice(0, bytesRead));
|
|
1274361
|
+
}
|
|
1274362
|
+
cb2();
|
|
1274363
|
+
});
|
|
1274364
|
+
});
|
|
1274365
|
+
};
|
|
1274366
|
+
ReadStream2.prototype.destroy = function(err) {
|
|
1274367
|
+
if (this.destroyed) return;
|
|
1274368
|
+
err = err || new Error("stream destroyed");
|
|
1274369
|
+
this.destroyed = true;
|
|
1274370
|
+
this.emit("error", err);
|
|
1274371
|
+
this.context.unref();
|
|
1274372
|
+
};
|
|
1274373
|
+
util4.inherits(WriteStream2, Writable2);
|
|
1274374
|
+
function WriteStream2(context2, options2) {
|
|
1274375
|
+
options2 = options2 || {};
|
|
1274376
|
+
Writable2.call(this, options2);
|
|
1274377
|
+
this.context = context2;
|
|
1274378
|
+
this.context.ref();
|
|
1274379
|
+
this.start = options2.start || 0;
|
|
1274380
|
+
this.endOffset = options2.end == null ? Infinity : +options2.end;
|
|
1274381
|
+
this.bytesWritten = 0;
|
|
1274382
|
+
this.pos = this.start;
|
|
1274383
|
+
this.destroyed = false;
|
|
1274384
|
+
this.on("finish", this.destroy.bind(this));
|
|
1274385
|
+
}
|
|
1274386
|
+
WriteStream2.prototype._write = function(buffer, encoding, callback) {
|
|
1274387
|
+
var self2 = this;
|
|
1274388
|
+
if (self2.destroyed) return;
|
|
1274389
|
+
if (self2.pos + buffer.length > self2.endOffset) {
|
|
1274390
|
+
var err = new Error("maximum file length exceeded");
|
|
1274391
|
+
err.code = "ETOOBIG";
|
|
1274392
|
+
self2.destroy();
|
|
1274393
|
+
callback(err);
|
|
1274394
|
+
return;
|
|
1274395
|
+
}
|
|
1274396
|
+
self2.context.pend.go(function(cb2) {
|
|
1274397
|
+
if (self2.destroyed) return cb2();
|
|
1274398
|
+
fs33.write(self2.context.fd, buffer, 0, buffer.length, self2.pos, function(err2, bytes) {
|
|
1274399
|
+
if (err2) {
|
|
1274400
|
+
self2.destroy();
|
|
1274401
|
+
cb2();
|
|
1274402
|
+
callback(err2);
|
|
1274403
|
+
} else {
|
|
1274404
|
+
self2.bytesWritten += bytes;
|
|
1274405
|
+
self2.pos += bytes;
|
|
1274406
|
+
self2.emit("progress");
|
|
1274407
|
+
cb2();
|
|
1274408
|
+
callback();
|
|
1274409
|
+
}
|
|
1274410
|
+
});
|
|
1274411
|
+
});
|
|
1274412
|
+
};
|
|
1274413
|
+
WriteStream2.prototype.destroy = function() {
|
|
1274414
|
+
if (this.destroyed) return;
|
|
1274415
|
+
this.destroyed = true;
|
|
1274416
|
+
this.context.unref();
|
|
1274417
|
+
};
|
|
1274418
|
+
util4.inherits(BufferSlicer, EventEmitter8);
|
|
1274419
|
+
function BufferSlicer(buffer, options2) {
|
|
1274420
|
+
EventEmitter8.call(this);
|
|
1274421
|
+
options2 = options2 || {};
|
|
1274422
|
+
this.refCount = 0;
|
|
1274423
|
+
this.buffer = buffer;
|
|
1274424
|
+
this.maxChunkSize = options2.maxChunkSize || Number.MAX_SAFE_INTEGER;
|
|
1274425
|
+
}
|
|
1274426
|
+
BufferSlicer.prototype.read = function(buffer, offset2, length, position4, callback) {
|
|
1274427
|
+
if (!(0 <= offset2 && offset2 <= buffer.length)) throw new RangeError("offset outside buffer: 0 <= " + offset2 + " <= " + buffer.length);
|
|
1274428
|
+
if (position4 < 0) throw new RangeError("position is negative: " + position4);
|
|
1274429
|
+
if (offset2 + length > buffer.length) {
|
|
1274430
|
+
length = buffer.length - offset2;
|
|
1274431
|
+
}
|
|
1274432
|
+
if (position4 + length > this.buffer.length) {
|
|
1274433
|
+
length = this.buffer.length - position4;
|
|
1274434
|
+
}
|
|
1274435
|
+
if (length <= 0) {
|
|
1274436
|
+
setImmediate(function() {
|
|
1274437
|
+
callback(null, 0);
|
|
1274438
|
+
});
|
|
1274439
|
+
return;
|
|
1274440
|
+
}
|
|
1274441
|
+
this.buffer.copy(buffer, offset2, position4, position4 + length);
|
|
1274442
|
+
setImmediate(function() {
|
|
1274443
|
+
callback(null, length);
|
|
1274444
|
+
});
|
|
1274445
|
+
};
|
|
1274446
|
+
BufferSlicer.prototype.write = function(buffer, offset2, length, position4, callback) {
|
|
1274447
|
+
buffer.copy(this.buffer, position4, offset2, offset2 + length);
|
|
1274448
|
+
setImmediate(function() {
|
|
1274449
|
+
callback(null, length, buffer);
|
|
1274450
|
+
});
|
|
1274451
|
+
};
|
|
1274452
|
+
BufferSlicer.prototype.createReadStream = function(options2) {
|
|
1274453
|
+
options2 = options2 || {};
|
|
1274454
|
+
var readStream2 = new PassThrough5(options2);
|
|
1274455
|
+
readStream2.destroyed = false;
|
|
1274456
|
+
readStream2.start = options2.start || 0;
|
|
1274457
|
+
readStream2.endOffset = options2.end;
|
|
1274458
|
+
readStream2.pos = readStream2.endOffset || this.buffer.length;
|
|
1274459
|
+
var entireSlice = this.buffer.slice(readStream2.start, readStream2.pos);
|
|
1274460
|
+
var offset2 = 0;
|
|
1274461
|
+
while (true) {
|
|
1274462
|
+
var nextOffset = offset2 + this.maxChunkSize;
|
|
1274463
|
+
if (nextOffset >= entireSlice.length) {
|
|
1274464
|
+
if (offset2 < entireSlice.length) {
|
|
1274465
|
+
readStream2.write(entireSlice.slice(offset2, entireSlice.length));
|
|
1274466
|
+
}
|
|
1274467
|
+
break;
|
|
1274468
|
+
}
|
|
1274469
|
+
readStream2.write(entireSlice.slice(offset2, nextOffset));
|
|
1274470
|
+
offset2 = nextOffset;
|
|
1274471
|
+
}
|
|
1274472
|
+
readStream2.end();
|
|
1274473
|
+
readStream2.destroy = function() {
|
|
1274474
|
+
readStream2.destroyed = true;
|
|
1274475
|
+
};
|
|
1274476
|
+
return readStream2;
|
|
1274477
|
+
};
|
|
1274478
|
+
BufferSlicer.prototype.createWriteStream = function(options2) {
|
|
1274479
|
+
var bufferSlicer = this;
|
|
1274480
|
+
options2 = options2 || {};
|
|
1274481
|
+
var writeStream = new Writable2(options2);
|
|
1274482
|
+
writeStream.start = options2.start || 0;
|
|
1274483
|
+
writeStream.endOffset = options2.end == null ? this.buffer.length : +options2.end;
|
|
1274484
|
+
writeStream.bytesWritten = 0;
|
|
1274485
|
+
writeStream.pos = writeStream.start;
|
|
1274486
|
+
writeStream.destroyed = false;
|
|
1274487
|
+
writeStream._write = function(buffer, encoding, callback) {
|
|
1274488
|
+
if (writeStream.destroyed) return;
|
|
1274489
|
+
var end = writeStream.pos + buffer.length;
|
|
1274490
|
+
if (end > writeStream.endOffset) {
|
|
1274491
|
+
var err = new Error("maximum file length exceeded");
|
|
1274492
|
+
err.code = "ETOOBIG";
|
|
1274493
|
+
writeStream.destroyed = true;
|
|
1274494
|
+
callback(err);
|
|
1274495
|
+
return;
|
|
1274496
|
+
}
|
|
1274497
|
+
buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length);
|
|
1274498
|
+
writeStream.bytesWritten += buffer.length;
|
|
1274499
|
+
writeStream.pos = end;
|
|
1274500
|
+
writeStream.emit("progress");
|
|
1274501
|
+
callback();
|
|
1274502
|
+
};
|
|
1274503
|
+
writeStream.destroy = function() {
|
|
1274504
|
+
writeStream.destroyed = true;
|
|
1274505
|
+
};
|
|
1274506
|
+
return writeStream;
|
|
1274507
|
+
};
|
|
1274508
|
+
BufferSlicer.prototype.ref = function() {
|
|
1274509
|
+
this.refCount += 1;
|
|
1274510
|
+
};
|
|
1274511
|
+
BufferSlicer.prototype.unref = function() {
|
|
1274512
|
+
this.refCount -= 1;
|
|
1274513
|
+
if (this.refCount < 0) {
|
|
1274514
|
+
throw new Error("invalid unref");
|
|
1274515
|
+
}
|
|
1274516
|
+
};
|
|
1274517
|
+
function createFromBuffer(buffer, options2) {
|
|
1274518
|
+
return new BufferSlicer(buffer, options2);
|
|
1274519
|
+
}
|
|
1274520
|
+
function createFromFd(fd, options2) {
|
|
1274521
|
+
return new FdSlicer(fd, options2);
|
|
1274522
|
+
}
|
|
1274523
|
+
}
|
|
1274524
|
+
});
|
|
1274525
|
+
|
|
1274526
|
+
// ../../../node_modules/.pnpm/yauzl@3.2.0/node_modules/yauzl/index.js
|
|
1274527
|
+
var require_yauzl2 = __commonJS({
|
|
1274528
|
+
"../../../node_modules/.pnpm/yauzl@3.2.0/node_modules/yauzl/index.js"(exports2) {
|
|
1274529
|
+
"use strict";
|
|
1274530
|
+
var fs33 = require("fs");
|
|
1274531
|
+
var zlib4 = require("zlib");
|
|
1274532
|
+
var fd_slicer = require_fd_slicer2();
|
|
1274533
|
+
var crc32 = require_buffer_crc32();
|
|
1274534
|
+
var util4 = require("util");
|
|
1274535
|
+
var EventEmitter8 = require("events").EventEmitter;
|
|
1274536
|
+
var Transform = require("stream").Transform;
|
|
1274537
|
+
var PassThrough5 = require("stream").PassThrough;
|
|
1274538
|
+
var Writable2 = require("stream").Writable;
|
|
1274539
|
+
exports2.open = open5;
|
|
1274540
|
+
exports2.fromFd = fromFd;
|
|
1274541
|
+
exports2.fromBuffer = fromBuffer2;
|
|
1274542
|
+
exports2.fromRandomAccessReader = fromRandomAccessReader;
|
|
1274543
|
+
exports2.dosDateTimeToDate = dosDateTimeToDate;
|
|
1274544
|
+
exports2.getFileNameLowLevel = getFileNameLowLevel;
|
|
1274545
|
+
exports2.validateFileName = validateFileName;
|
|
1274546
|
+
exports2.parseExtraFields = parseExtraFields;
|
|
1274547
|
+
exports2.ZipFile = ZipFile;
|
|
1274548
|
+
exports2.Entry = Entry;
|
|
1274549
|
+
exports2.LocalFileHeader = LocalFileHeader;
|
|
1274550
|
+
exports2.RandomAccessReader = RandomAccessReader;
|
|
1274551
|
+
function open5(path86, options2, callback) {
|
|
1274552
|
+
if (typeof options2 === "function") {
|
|
1274553
|
+
callback = options2;
|
|
1274554
|
+
options2 = null;
|
|
1274555
|
+
}
|
|
1274556
|
+
if (options2 == null) options2 = {};
|
|
1274557
|
+
if (options2.autoClose == null) options2.autoClose = true;
|
|
1274558
|
+
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
1274559
|
+
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
1274560
|
+
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
1274561
|
+
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
1274562
|
+
if (callback == null) callback = defaultCallback;
|
|
1274563
|
+
fs33.open(path86, "r", function(err, fd) {
|
|
1274564
|
+
if (err) return callback(err);
|
|
1274565
|
+
fromFd(fd, options2, function(err2, zipfile) {
|
|
1274566
|
+
if (err2) fs33.close(fd, defaultCallback);
|
|
1274567
|
+
callback(err2, zipfile);
|
|
1274568
|
+
});
|
|
1274569
|
+
});
|
|
1274570
|
+
}
|
|
1274571
|
+
function fromFd(fd, options2, callback) {
|
|
1274572
|
+
if (typeof options2 === "function") {
|
|
1274573
|
+
callback = options2;
|
|
1274574
|
+
options2 = null;
|
|
1274575
|
+
}
|
|
1274576
|
+
if (options2 == null) options2 = {};
|
|
1274577
|
+
if (options2.autoClose == null) options2.autoClose = false;
|
|
1274578
|
+
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
1274579
|
+
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
1274580
|
+
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
1274581
|
+
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
1274582
|
+
if (callback == null) callback = defaultCallback;
|
|
1274583
|
+
fs33.fstat(fd, function(err, stats) {
|
|
1274584
|
+
if (err) return callback(err);
|
|
1274585
|
+
var reader = fd_slicer.createFromFd(fd, { autoClose: true });
|
|
1274586
|
+
fromRandomAccessReader(reader, stats.size, options2, callback);
|
|
1274587
|
+
});
|
|
1274588
|
+
}
|
|
1274589
|
+
function fromBuffer2(buffer, options2, callback) {
|
|
1274590
|
+
if (typeof options2 === "function") {
|
|
1274591
|
+
callback = options2;
|
|
1274592
|
+
options2 = null;
|
|
1274593
|
+
}
|
|
1274594
|
+
if (options2 == null) options2 = {};
|
|
1274595
|
+
options2.autoClose = false;
|
|
1274596
|
+
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
1274597
|
+
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
1274598
|
+
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
1274599
|
+
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
1274600
|
+
var reader = fd_slicer.createFromBuffer(buffer, { maxChunkSize: 65536 });
|
|
1274601
|
+
fromRandomAccessReader(reader, buffer.length, options2, callback);
|
|
1274602
|
+
}
|
|
1274603
|
+
function fromRandomAccessReader(reader, totalSize, options2, callback) {
|
|
1274604
|
+
if (typeof options2 === "function") {
|
|
1274605
|
+
callback = options2;
|
|
1274606
|
+
options2 = null;
|
|
1274607
|
+
}
|
|
1274608
|
+
if (options2 == null) options2 = {};
|
|
1274609
|
+
if (options2.autoClose == null) options2.autoClose = true;
|
|
1274610
|
+
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
1274611
|
+
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
1274612
|
+
var decodeStrings = !!options2.decodeStrings;
|
|
1274613
|
+
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
1274614
|
+
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
1274615
|
+
if (callback == null) callback = defaultCallback;
|
|
1274616
|
+
if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number");
|
|
1274617
|
+
if (totalSize > Number.MAX_SAFE_INTEGER) {
|
|
1274618
|
+
throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
|
|
1274619
|
+
}
|
|
1274620
|
+
reader.ref();
|
|
1274621
|
+
var eocdrWithoutCommentSize = 22;
|
|
1274622
|
+
var zip64EocdlSize = 20;
|
|
1274623
|
+
var maxCommentSize = 65535;
|
|
1274624
|
+
var bufferSize = Math.min(zip64EocdlSize + eocdrWithoutCommentSize + maxCommentSize, totalSize);
|
|
1274625
|
+
var buffer = newBuffer(bufferSize);
|
|
1274626
|
+
var bufferReadStart = totalSize - buffer.length;
|
|
1274627
|
+
readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) {
|
|
1274628
|
+
if (err) return callback(err);
|
|
1274629
|
+
for (var i11 = bufferSize - eocdrWithoutCommentSize; i11 >= 0; i11 -= 1) {
|
|
1274630
|
+
if (buffer.readUInt32LE(i11) !== 101010256) continue;
|
|
1274631
|
+
var eocdrBuffer = buffer.subarray(i11);
|
|
1274632
|
+
var diskNumber = eocdrBuffer.readUInt16LE(4);
|
|
1274633
|
+
var entryCount = eocdrBuffer.readUInt16LE(10);
|
|
1274634
|
+
var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
|
|
1274635
|
+
var commentLength = eocdrBuffer.readUInt16LE(20);
|
|
1274636
|
+
var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
|
|
1274637
|
+
if (commentLength !== expectedCommentLength) {
|
|
1274638
|
+
return callback(new Error("Invalid comment length. Expected: " + expectedCommentLength + ". Found: " + commentLength + ". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK\u263A\u263B` in the comment?"));
|
|
1274639
|
+
}
|
|
1274640
|
+
var comment6 = decodeStrings ? decodeBuffer(eocdrBuffer.subarray(22), false) : eocdrBuffer.subarray(22);
|
|
1274641
|
+
if (i11 - zip64EocdlSize >= 0 && buffer.readUInt32LE(i11 - zip64EocdlSize) === 117853008) {
|
|
1274642
|
+
var zip64EocdlBuffer = buffer.subarray(i11 - zip64EocdlSize, i11 - zip64EocdlSize + zip64EocdlSize);
|
|
1274643
|
+
var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
|
|
1274644
|
+
var zip64EocdrBuffer = newBuffer(56);
|
|
1274645
|
+
return readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err2) {
|
|
1274646
|
+
if (err2) return callback(err2);
|
|
1274647
|
+
if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
|
|
1274648
|
+
return callback(new Error("invalid zip64 end of central directory record signature"));
|
|
1274649
|
+
}
|
|
1274650
|
+
diskNumber = zip64EocdrBuffer.readUInt32LE(16);
|
|
1274651
|
+
if (diskNumber !== 0) {
|
|
1274652
|
+
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
|
|
1274653
|
+
}
|
|
1274654
|
+
entryCount = readUInt64LE(zip64EocdrBuffer, 32);
|
|
1274655
|
+
centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
|
|
1274656
|
+
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment6, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
|
|
1274657
|
+
});
|
|
1274658
|
+
}
|
|
1274659
|
+
if (diskNumber !== 0) {
|
|
1274660
|
+
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
|
|
1274661
|
+
}
|
|
1274662
|
+
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment6, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
|
|
1274663
|
+
}
|
|
1274664
|
+
callback(new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."));
|
|
1274665
|
+
});
|
|
1274666
|
+
}
|
|
1274667
|
+
util4.inherits(ZipFile, EventEmitter8);
|
|
1274668
|
+
function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment6, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
|
|
1274669
|
+
var self2 = this;
|
|
1274670
|
+
EventEmitter8.call(self2);
|
|
1274671
|
+
self2.reader = reader;
|
|
1274672
|
+
self2.reader.on("error", function(err) {
|
|
1274673
|
+
emitError(self2, err);
|
|
1274674
|
+
});
|
|
1274675
|
+
self2.reader.once("close", function() {
|
|
1274676
|
+
self2.emit("close");
|
|
1274677
|
+
});
|
|
1274678
|
+
self2.readEntryCursor = centralDirectoryOffset;
|
|
1274679
|
+
self2.fileSize = fileSize;
|
|
1274680
|
+
self2.entryCount = entryCount;
|
|
1274681
|
+
self2.comment = comment6;
|
|
1274682
|
+
self2.entriesRead = 0;
|
|
1274683
|
+
self2.autoClose = !!autoClose;
|
|
1274684
|
+
self2.lazyEntries = !!lazyEntries;
|
|
1274685
|
+
self2.decodeStrings = !!decodeStrings;
|
|
1274686
|
+
self2.validateEntrySizes = !!validateEntrySizes;
|
|
1274687
|
+
self2.strictFileNames = !!strictFileNames;
|
|
1274688
|
+
self2.isOpen = true;
|
|
1274689
|
+
self2.emittedError = false;
|
|
1274690
|
+
if (!self2.lazyEntries) self2._readEntry();
|
|
1274691
|
+
}
|
|
1274692
|
+
ZipFile.prototype.close = function() {
|
|
1274693
|
+
if (!this.isOpen) return;
|
|
1274694
|
+
this.isOpen = false;
|
|
1274695
|
+
this.reader.unref();
|
|
1274696
|
+
};
|
|
1274697
|
+
function emitErrorAndAutoClose(self2, err) {
|
|
1274698
|
+
if (self2.autoClose) self2.close();
|
|
1274699
|
+
emitError(self2, err);
|
|
1274700
|
+
}
|
|
1274701
|
+
function emitError(self2, err) {
|
|
1274702
|
+
if (self2.emittedError) return;
|
|
1274703
|
+
self2.emittedError = true;
|
|
1274704
|
+
self2.emit("error", err);
|
|
1274705
|
+
}
|
|
1274706
|
+
ZipFile.prototype.readEntry = function() {
|
|
1274707
|
+
if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true");
|
|
1274708
|
+
this._readEntry();
|
|
1274709
|
+
};
|
|
1274710
|
+
ZipFile.prototype._readEntry = function() {
|
|
1274711
|
+
var self2 = this;
|
|
1274712
|
+
if (self2.entryCount === self2.entriesRead) {
|
|
1274713
|
+
setImmediate(function() {
|
|
1274714
|
+
if (self2.autoClose) self2.close();
|
|
1274715
|
+
if (self2.emittedError) return;
|
|
1274716
|
+
self2.emit("end");
|
|
1274717
|
+
});
|
|
1274718
|
+
return;
|
|
1274719
|
+
}
|
|
1274720
|
+
if (self2.emittedError) return;
|
|
1274721
|
+
var buffer = newBuffer(46);
|
|
1274722
|
+
readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, self2.readEntryCursor, function(err) {
|
|
1274723
|
+
if (err) return emitErrorAndAutoClose(self2, err);
|
|
1274724
|
+
if (self2.emittedError) return;
|
|
1274725
|
+
var entry = new Entry();
|
|
1274726
|
+
var signature = buffer.readUInt32LE(0);
|
|
1274727
|
+
if (signature !== 33639248) return emitErrorAndAutoClose(self2, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
|
|
1274728
|
+
entry.versionMadeBy = buffer.readUInt16LE(4);
|
|
1274729
|
+
entry.versionNeededToExtract = buffer.readUInt16LE(6);
|
|
1274730
|
+
entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
|
|
1274731
|
+
entry.compressionMethod = buffer.readUInt16LE(10);
|
|
1274732
|
+
entry.lastModFileTime = buffer.readUInt16LE(12);
|
|
1274733
|
+
entry.lastModFileDate = buffer.readUInt16LE(14);
|
|
1274734
|
+
entry.crc32 = buffer.readUInt32LE(16);
|
|
1274735
|
+
entry.compressedSize = buffer.readUInt32LE(20);
|
|
1274736
|
+
entry.uncompressedSize = buffer.readUInt32LE(24);
|
|
1274737
|
+
entry.fileNameLength = buffer.readUInt16LE(28);
|
|
1274738
|
+
entry.extraFieldLength = buffer.readUInt16LE(30);
|
|
1274739
|
+
entry.fileCommentLength = buffer.readUInt16LE(32);
|
|
1274740
|
+
entry.internalFileAttributes = buffer.readUInt16LE(36);
|
|
1274741
|
+
entry.externalFileAttributes = buffer.readUInt32LE(38);
|
|
1274742
|
+
entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
|
|
1274743
|
+
if (entry.generalPurposeBitFlag & 64) return emitErrorAndAutoClose(self2, new Error("strong encryption is not supported"));
|
|
1274744
|
+
self2.readEntryCursor += 46;
|
|
1274745
|
+
buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
|
|
1274746
|
+
readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, self2.readEntryCursor, function(err2) {
|
|
1274747
|
+
if (err2) return emitErrorAndAutoClose(self2, err2);
|
|
1274748
|
+
if (self2.emittedError) return;
|
|
1274749
|
+
entry.fileNameRaw = buffer.subarray(0, entry.fileNameLength);
|
|
1274750
|
+
var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
|
|
1274751
|
+
entry.extraFieldRaw = buffer.subarray(entry.fileNameLength, fileCommentStart);
|
|
1274752
|
+
entry.fileCommentRaw = buffer.subarray(fileCommentStart, fileCommentStart + entry.fileCommentLength);
|
|
1274753
|
+
try {
|
|
1274754
|
+
entry.extraFields = parseExtraFields(entry.extraFieldRaw);
|
|
1274755
|
+
} catch (err3) {
|
|
1274756
|
+
return emitErrorAndAutoClose(self2, err3);
|
|
1274757
|
+
}
|
|
1274758
|
+
if (self2.decodeStrings) {
|
|
1274759
|
+
var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
|
|
1274760
|
+
entry.fileComment = decodeBuffer(entry.fileCommentRaw, isUtf8);
|
|
1274761
|
+
entry.fileName = getFileNameLowLevel(entry.generalPurposeBitFlag, entry.fileNameRaw, entry.extraFields, self2.strictFileNames);
|
|
1274762
|
+
var errorMessage = validateFileName(entry.fileName);
|
|
1274763
|
+
if (errorMessage != null) return emitErrorAndAutoClose(self2, new Error(errorMessage));
|
|
1274764
|
+
} else {
|
|
1274765
|
+
entry.fileComment = entry.fileCommentRaw;
|
|
1274766
|
+
entry.fileName = entry.fileNameRaw;
|
|
1274767
|
+
}
|
|
1274768
|
+
entry.comment = entry.fileComment;
|
|
1274769
|
+
self2.readEntryCursor += buffer.length;
|
|
1274770
|
+
self2.entriesRead += 1;
|
|
1274771
|
+
for (var i11 = 0; i11 < entry.extraFields.length; i11++) {
|
|
1274772
|
+
var extraField = entry.extraFields[i11];
|
|
1274773
|
+
if (extraField.id !== 1) continue;
|
|
1274774
|
+
var zip64EiefBuffer = extraField.data;
|
|
1274775
|
+
var index3 = 0;
|
|
1274776
|
+
if (entry.uncompressedSize === 4294967295) {
|
|
1274777
|
+
if (index3 + 8 > zip64EiefBuffer.length) {
|
|
1274778
|
+
return emitErrorAndAutoClose(self2, new Error("zip64 extended information extra field does not include uncompressed size"));
|
|
1274779
|
+
}
|
|
1274780
|
+
entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index3);
|
|
1274781
|
+
index3 += 8;
|
|
1274782
|
+
}
|
|
1274783
|
+
if (entry.compressedSize === 4294967295) {
|
|
1274784
|
+
if (index3 + 8 > zip64EiefBuffer.length) {
|
|
1274785
|
+
return emitErrorAndAutoClose(self2, new Error("zip64 extended information extra field does not include compressed size"));
|
|
1274786
|
+
}
|
|
1274787
|
+
entry.compressedSize = readUInt64LE(zip64EiefBuffer, index3);
|
|
1274788
|
+
index3 += 8;
|
|
1274789
|
+
}
|
|
1274790
|
+
if (entry.relativeOffsetOfLocalHeader === 4294967295) {
|
|
1274791
|
+
if (index3 + 8 > zip64EiefBuffer.length) {
|
|
1274792
|
+
return emitErrorAndAutoClose(self2, new Error("zip64 extended information extra field does not include relative header offset"));
|
|
1274793
|
+
}
|
|
1274794
|
+
entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index3);
|
|
1274795
|
+
index3 += 8;
|
|
1274796
|
+
}
|
|
1274797
|
+
break;
|
|
1274798
|
+
}
|
|
1274799
|
+
if (self2.validateEntrySizes && entry.compressionMethod === 0) {
|
|
1274800
|
+
var expectedCompressedSize = entry.uncompressedSize;
|
|
1274801
|
+
if (entry.isEncrypted()) {
|
|
1274802
|
+
expectedCompressedSize += 12;
|
|
1274803
|
+
}
|
|
1274804
|
+
if (entry.compressedSize !== expectedCompressedSize) {
|
|
1274805
|
+
var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
|
|
1274806
|
+
return emitErrorAndAutoClose(self2, new Error(msg));
|
|
1274807
|
+
}
|
|
1274808
|
+
}
|
|
1274809
|
+
self2.emit("entry", entry);
|
|
1274810
|
+
if (!self2.lazyEntries) self2._readEntry();
|
|
1274811
|
+
});
|
|
1274812
|
+
});
|
|
1274813
|
+
};
|
|
1274814
|
+
ZipFile.prototype.openReadStream = function(entry, options2, callback) {
|
|
1274815
|
+
var self2 = this;
|
|
1274816
|
+
var relativeStart = 0;
|
|
1274817
|
+
var relativeEnd = entry.compressedSize;
|
|
1274818
|
+
if (callback == null) {
|
|
1274819
|
+
callback = options2;
|
|
1274820
|
+
options2 = null;
|
|
1274821
|
+
}
|
|
1274822
|
+
if (options2 == null) {
|
|
1274823
|
+
options2 = {};
|
|
1274824
|
+
} else {
|
|
1274825
|
+
if (options2.decrypt != null) {
|
|
1274826
|
+
if (!entry.isEncrypted()) {
|
|
1274827
|
+
throw new Error("options.decrypt can only be specified for encrypted entries");
|
|
1274828
|
+
}
|
|
1274829
|
+
if (options2.decrypt !== false) throw new Error("invalid options.decrypt value: " + options2.decrypt);
|
|
1274830
|
+
if (entry.isCompressed()) {
|
|
1274831
|
+
if (options2.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false");
|
|
1274832
|
+
}
|
|
1274833
|
+
}
|
|
1274834
|
+
if (options2.decompress != null) {
|
|
1274835
|
+
if (!entry.isCompressed()) {
|
|
1274836
|
+
throw new Error("options.decompress can only be specified for compressed entries");
|
|
1274837
|
+
}
|
|
1274838
|
+
if (!(options2.decompress === false || options2.decompress === true)) {
|
|
1274839
|
+
throw new Error("invalid options.decompress value: " + options2.decompress);
|
|
1274840
|
+
}
|
|
1274841
|
+
}
|
|
1274842
|
+
if (options2.start != null || options2.end != null) {
|
|
1274843
|
+
if (entry.isCompressed() && options2.decompress !== false) {
|
|
1274844
|
+
throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
|
|
1274845
|
+
}
|
|
1274846
|
+
if (entry.isEncrypted() && options2.decrypt !== false) {
|
|
1274847
|
+
throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
|
|
1274848
|
+
}
|
|
1274849
|
+
}
|
|
1274850
|
+
if (options2.start != null) {
|
|
1274851
|
+
relativeStart = options2.start;
|
|
1274852
|
+
if (relativeStart < 0) throw new Error("options.start < 0");
|
|
1274853
|
+
if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize");
|
|
1274854
|
+
}
|
|
1274855
|
+
if (options2.end != null) {
|
|
1274856
|
+
relativeEnd = options2.end;
|
|
1274857
|
+
if (relativeEnd < 0) throw new Error("options.end < 0");
|
|
1274858
|
+
if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize");
|
|
1274859
|
+
if (relativeEnd < relativeStart) throw new Error("options.end < options.start");
|
|
1274860
|
+
}
|
|
1274861
|
+
}
|
|
1274862
|
+
if (!self2.isOpen) return callback(new Error("closed"));
|
|
1274863
|
+
if (entry.isEncrypted()) {
|
|
1274864
|
+
if (options2.decrypt !== false) return callback(new Error("entry is encrypted, and options.decrypt !== false"));
|
|
1274865
|
+
}
|
|
1274866
|
+
var decompress3;
|
|
1274867
|
+
if (entry.compressionMethod === 0) {
|
|
1274868
|
+
decompress3 = false;
|
|
1274869
|
+
} else if (entry.compressionMethod === 8) {
|
|
1274870
|
+
decompress3 = options2.decompress != null ? options2.decompress : true;
|
|
1274871
|
+
} else {
|
|
1274872
|
+
return callback(new Error("unsupported compression method: " + entry.compressionMethod));
|
|
1274873
|
+
}
|
|
1274874
|
+
self2.readLocalFileHeader(entry, { minimal: true }, function(err, localFileHeader) {
|
|
1274875
|
+
if (err) return callback(err);
|
|
1274876
|
+
self2.openReadStreamLowLevel(
|
|
1274877
|
+
localFileHeader.fileDataStart,
|
|
1274878
|
+
entry.compressedSize,
|
|
1274879
|
+
relativeStart,
|
|
1274880
|
+
relativeEnd,
|
|
1274881
|
+
decompress3,
|
|
1274882
|
+
entry.uncompressedSize,
|
|
1274883
|
+
callback
|
|
1274884
|
+
);
|
|
1274885
|
+
});
|
|
1274886
|
+
};
|
|
1274887
|
+
ZipFile.prototype.openReadStreamLowLevel = function(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress3, uncompressedSize, callback) {
|
|
1274888
|
+
var self2 = this;
|
|
1274889
|
+
var fileDataEnd = fileDataStart + compressedSize;
|
|
1274890
|
+
var readStream2 = self2.reader.createReadStream({
|
|
1274891
|
+
start: fileDataStart + relativeStart,
|
|
1274892
|
+
end: fileDataStart + relativeEnd
|
|
1274893
|
+
});
|
|
1274894
|
+
var endpointStream = readStream2;
|
|
1274895
|
+
if (decompress3) {
|
|
1274896
|
+
var destroyed = false;
|
|
1274897
|
+
var inflateFilter = zlib4.createInflateRaw();
|
|
1274898
|
+
readStream2.on("error", function(err) {
|
|
1274899
|
+
setImmediate(function() {
|
|
1274900
|
+
if (!destroyed) inflateFilter.emit("error", err);
|
|
1274901
|
+
});
|
|
1274902
|
+
});
|
|
1274903
|
+
readStream2.pipe(inflateFilter);
|
|
1274904
|
+
if (self2.validateEntrySizes) {
|
|
1274905
|
+
endpointStream = new AssertByteCountStream(uncompressedSize);
|
|
1274906
|
+
inflateFilter.on("error", function(err) {
|
|
1274907
|
+
setImmediate(function() {
|
|
1274908
|
+
if (!destroyed) endpointStream.emit("error", err);
|
|
1274909
|
+
});
|
|
1274910
|
+
});
|
|
1274911
|
+
inflateFilter.pipe(endpointStream);
|
|
1274912
|
+
} else {
|
|
1274913
|
+
endpointStream = inflateFilter;
|
|
1274914
|
+
}
|
|
1274915
|
+
installDestroyFn(endpointStream, function() {
|
|
1274916
|
+
destroyed = true;
|
|
1274917
|
+
if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream);
|
|
1274918
|
+
readStream2.unpipe(inflateFilter);
|
|
1274919
|
+
readStream2.destroy();
|
|
1274920
|
+
});
|
|
1274921
|
+
}
|
|
1274922
|
+
callback(null, endpointStream);
|
|
1274923
|
+
};
|
|
1274924
|
+
ZipFile.prototype.readLocalFileHeader = function(entry, options2, callback) {
|
|
1274925
|
+
var self2 = this;
|
|
1274926
|
+
if (callback == null) {
|
|
1274927
|
+
callback = options2;
|
|
1274928
|
+
options2 = null;
|
|
1274929
|
+
}
|
|
1274930
|
+
if (options2 == null) options2 = {};
|
|
1274931
|
+
self2.reader.ref();
|
|
1274932
|
+
var buffer = newBuffer(30);
|
|
1274933
|
+
readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
|
|
1274934
|
+
try {
|
|
1274935
|
+
if (err) return callback(err);
|
|
1274936
|
+
var signature = buffer.readUInt32LE(0);
|
|
1274937
|
+
if (signature !== 67324752) {
|
|
1274938
|
+
return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
|
|
1274939
|
+
}
|
|
1274940
|
+
var fileNameLength = buffer.readUInt16LE(26);
|
|
1274941
|
+
var extraFieldLength = buffer.readUInt16LE(28);
|
|
1274942
|
+
var fileDataStart = entry.relativeOffsetOfLocalHeader + 30 + fileNameLength + extraFieldLength;
|
|
1274943
|
+
if (fileDataStart + entry.compressedSize > self2.fileSize) {
|
|
1274944
|
+
return callback(new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self2.fileSize));
|
|
1274945
|
+
}
|
|
1274946
|
+
if (options2.minimal) {
|
|
1274947
|
+
return callback(null, { fileDataStart });
|
|
1274948
|
+
}
|
|
1274949
|
+
var localFileHeader = new LocalFileHeader();
|
|
1274950
|
+
localFileHeader.fileDataStart = fileDataStart;
|
|
1274951
|
+
localFileHeader.versionNeededToExtract = buffer.readUInt16LE(4);
|
|
1274952
|
+
localFileHeader.generalPurposeBitFlag = buffer.readUInt16LE(6);
|
|
1274953
|
+
localFileHeader.compressionMethod = buffer.readUInt16LE(8);
|
|
1274954
|
+
localFileHeader.lastModFileTime = buffer.readUInt16LE(10);
|
|
1274955
|
+
localFileHeader.lastModFileDate = buffer.readUInt16LE(12);
|
|
1274956
|
+
localFileHeader.crc32 = buffer.readUInt32LE(14);
|
|
1274957
|
+
localFileHeader.compressedSize = buffer.readUInt32LE(18);
|
|
1274958
|
+
localFileHeader.uncompressedSize = buffer.readUInt32LE(22);
|
|
1274959
|
+
localFileHeader.fileNameLength = fileNameLength;
|
|
1274960
|
+
localFileHeader.extraFieldLength = extraFieldLength;
|
|
1274961
|
+
buffer = newBuffer(fileNameLength + extraFieldLength);
|
|
1274962
|
+
self2.reader.ref();
|
|
1274963
|
+
readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader + 30, function(err2) {
|
|
1274964
|
+
try {
|
|
1274965
|
+
if (err2) return callback(err2);
|
|
1274966
|
+
localFileHeader.fileName = buffer.subarray(0, fileNameLength);
|
|
1274967
|
+
localFileHeader.extraField = buffer.subarray(fileNameLength);
|
|
1274968
|
+
return callback(null, localFileHeader);
|
|
1274969
|
+
} finally {
|
|
1274970
|
+
self2.reader.unref();
|
|
1274971
|
+
}
|
|
1274972
|
+
});
|
|
1274973
|
+
} finally {
|
|
1274974
|
+
self2.reader.unref();
|
|
1274975
|
+
}
|
|
1274976
|
+
});
|
|
1274977
|
+
};
|
|
1274978
|
+
function Entry() {
|
|
1274979
|
+
}
|
|
1274980
|
+
Entry.prototype.getLastModDate = function(options2) {
|
|
1274981
|
+
if (options2 == null) options2 = {};
|
|
1274982
|
+
if (!options2.forceDosFormat) {
|
|
1274983
|
+
for (var i11 = 0; i11 < this.extraFields.length; i11++) {
|
|
1274984
|
+
var extraField = this.extraFields[i11];
|
|
1274985
|
+
if (extraField.id === 21589) {
|
|
1274986
|
+
var data2 = extraField.data;
|
|
1274987
|
+
if (data2.length < 5) continue;
|
|
1274988
|
+
var flags2 = data2[0];
|
|
1274989
|
+
var HAS_MTIME = 1;
|
|
1274990
|
+
if (!(flags2 & HAS_MTIME)) continue;
|
|
1274991
|
+
var posixTimestamp = data2.readInt32LE(1);
|
|
1274992
|
+
return new Date(posixTimestamp * 1e3);
|
|
1274993
|
+
} else if (extraField.id === 10) {
|
|
1274994
|
+
var data2 = extraField.data;
|
|
1274995
|
+
var cursor = 4;
|
|
1274996
|
+
while (cursor < data2.length + 4) {
|
|
1274997
|
+
var tag2 = data2.readUInt16LE(cursor);
|
|
1274998
|
+
cursor += 2;
|
|
1274999
|
+
var size2 = data2.readUInt16LE(cursor);
|
|
1275000
|
+
cursor += 2;
|
|
1275001
|
+
if (tag2 !== 1) {
|
|
1275002
|
+
cursor += size2;
|
|
1275003
|
+
continue;
|
|
1275004
|
+
}
|
|
1275005
|
+
if (size2 < 8 || cursor + size2 > data2.length) break;
|
|
1275006
|
+
var hundredNanoSecondsSince1601 = 4294967296 * data2.readInt32LE(cursor + 4) + data2.readUInt32LE(cursor);
|
|
1275007
|
+
var millisecondsSince1970 = hundredNanoSecondsSince1601 / 1e4 - 116444736e5;
|
|
1275008
|
+
return new Date(millisecondsSince1970);
|
|
1275009
|
+
}
|
|
1275010
|
+
}
|
|
1275011
|
+
}
|
|
1275012
|
+
}
|
|
1275013
|
+
return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime, options2.timezone);
|
|
1275014
|
+
};
|
|
1275015
|
+
Entry.prototype.isEncrypted = function() {
|
|
1275016
|
+
return (this.generalPurposeBitFlag & 1) !== 0;
|
|
1275017
|
+
};
|
|
1275018
|
+
Entry.prototype.isCompressed = function() {
|
|
1275019
|
+
return this.compressionMethod === 8;
|
|
1275020
|
+
};
|
|
1275021
|
+
function LocalFileHeader() {
|
|
1275022
|
+
}
|
|
1275023
|
+
function dosDateTimeToDate(date12, time3, timezone) {
|
|
1275024
|
+
var day = date12 & 31;
|
|
1275025
|
+
var month = (date12 >> 5 & 15) - 1;
|
|
1275026
|
+
var year = (date12 >> 9 & 127) + 1980;
|
|
1275027
|
+
var millisecond = 0;
|
|
1275028
|
+
var second = (time3 & 31) * 2;
|
|
1275029
|
+
var minute = time3 >> 5 & 63;
|
|
1275030
|
+
var hour = time3 >> 11 & 31;
|
|
1275031
|
+
if (timezone == null || timezone === "local") {
|
|
1275032
|
+
return new Date(year, month, day, hour, minute, second, millisecond);
|
|
1275033
|
+
} else if (timezone === "UTC") {
|
|
1275034
|
+
return new Date(Date.UTC(year, month, day, hour, minute, second, millisecond));
|
|
1275035
|
+
} else {
|
|
1275036
|
+
throw new Error("unrecognized options.timezone: " + options.timezone);
|
|
1275037
|
+
}
|
|
1275038
|
+
}
|
|
1275039
|
+
function getFileNameLowLevel(generalPurposeBitFlag, fileNameBuffer, extraFields, strictFileNames) {
|
|
1275040
|
+
var fileName = null;
|
|
1275041
|
+
for (var i11 = 0; i11 < extraFields.length; i11++) {
|
|
1275042
|
+
var extraField = extraFields[i11];
|
|
1275043
|
+
if (extraField.id === 28789) {
|
|
1275044
|
+
if (extraField.data.length < 6) {
|
|
1275045
|
+
continue;
|
|
1275046
|
+
}
|
|
1275047
|
+
if (extraField.data.readUInt8(0) !== 1) {
|
|
1275048
|
+
continue;
|
|
1275049
|
+
}
|
|
1275050
|
+
var oldNameCrc32 = extraField.data.readUInt32LE(1);
|
|
1275051
|
+
if (crc32.unsigned(fileNameBuffer) !== oldNameCrc32) {
|
|
1275052
|
+
continue;
|
|
1275053
|
+
}
|
|
1275054
|
+
fileName = decodeBuffer(extraField.data.subarray(5), true);
|
|
1275055
|
+
break;
|
|
1275056
|
+
}
|
|
1275057
|
+
}
|
|
1275058
|
+
if (fileName == null) {
|
|
1275059
|
+
var isUtf8 = (generalPurposeBitFlag & 2048) !== 0;
|
|
1275060
|
+
fileName = decodeBuffer(fileNameBuffer, isUtf8);
|
|
1275061
|
+
}
|
|
1275062
|
+
if (!strictFileNames) {
|
|
1275063
|
+
fileName = fileName.replace(/\\/g, "/");
|
|
1275064
|
+
}
|
|
1275065
|
+
return fileName;
|
|
1275066
|
+
}
|
|
1275067
|
+
function validateFileName(fileName) {
|
|
1275068
|
+
if (fileName.indexOf("\\") !== -1) {
|
|
1275069
|
+
return "invalid characters in fileName: " + fileName;
|
|
1275070
|
+
}
|
|
1275071
|
+
if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
|
|
1275072
|
+
return "absolute path: " + fileName;
|
|
1275073
|
+
}
|
|
1275074
|
+
if (fileName.split("/").indexOf("..") !== -1) {
|
|
1275075
|
+
return "invalid relative path: " + fileName;
|
|
1275076
|
+
}
|
|
1275077
|
+
return null;
|
|
1275078
|
+
}
|
|
1275079
|
+
function parseExtraFields(extraFieldBuffer) {
|
|
1275080
|
+
var extraFields = [];
|
|
1275081
|
+
var i11 = 0;
|
|
1275082
|
+
while (i11 < extraFieldBuffer.length - 3) {
|
|
1275083
|
+
var headerId = extraFieldBuffer.readUInt16LE(i11 + 0);
|
|
1275084
|
+
var dataSize = extraFieldBuffer.readUInt16LE(i11 + 2);
|
|
1275085
|
+
var dataStart = i11 + 4;
|
|
1275086
|
+
var dataEnd = dataStart + dataSize;
|
|
1275087
|
+
if (dataEnd > extraFieldBuffer.length) throw new Error("extra field length exceeds extra field buffer size");
|
|
1275088
|
+
var dataBuffer = extraFieldBuffer.subarray(dataStart, dataEnd);
|
|
1275089
|
+
extraFields.push({
|
|
1275090
|
+
id: headerId,
|
|
1275091
|
+
data: dataBuffer
|
|
1275092
|
+
});
|
|
1275093
|
+
i11 = dataEnd;
|
|
1275094
|
+
}
|
|
1275095
|
+
return extraFields;
|
|
1275096
|
+
}
|
|
1275097
|
+
function readAndAssertNoEof(reader, buffer, offset2, length, position4, callback) {
|
|
1275098
|
+
if (length === 0) {
|
|
1275099
|
+
return setImmediate(function() {
|
|
1275100
|
+
callback(null, newBuffer(0));
|
|
1275101
|
+
});
|
|
1275102
|
+
}
|
|
1275103
|
+
reader.read(buffer, offset2, length, position4, function(err, bytesRead) {
|
|
1275104
|
+
if (err) return callback(err);
|
|
1275105
|
+
if (bytesRead < length) {
|
|
1275106
|
+
return callback(new Error("unexpected EOF"));
|
|
1275107
|
+
}
|
|
1275108
|
+
callback();
|
|
1275109
|
+
});
|
|
1275110
|
+
}
|
|
1275111
|
+
util4.inherits(AssertByteCountStream, Transform);
|
|
1275112
|
+
function AssertByteCountStream(byteCount) {
|
|
1275113
|
+
Transform.call(this);
|
|
1275114
|
+
this.actualByteCount = 0;
|
|
1275115
|
+
this.expectedByteCount = byteCount;
|
|
1275116
|
+
}
|
|
1275117
|
+
AssertByteCountStream.prototype._transform = function(chunk2, encoding, cb2) {
|
|
1275118
|
+
this.actualByteCount += chunk2.length;
|
|
1275119
|
+
if (this.actualByteCount > this.expectedByteCount) {
|
|
1275120
|
+
var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
|
|
1275121
|
+
return cb2(new Error(msg));
|
|
1275122
|
+
}
|
|
1275123
|
+
cb2(null, chunk2);
|
|
1275124
|
+
};
|
|
1275125
|
+
AssertByteCountStream.prototype._flush = function(cb2) {
|
|
1275126
|
+
if (this.actualByteCount < this.expectedByteCount) {
|
|
1275127
|
+
var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
|
|
1275128
|
+
return cb2(new Error(msg));
|
|
1275129
|
+
}
|
|
1275130
|
+
cb2();
|
|
1275131
|
+
};
|
|
1275132
|
+
util4.inherits(RandomAccessReader, EventEmitter8);
|
|
1275133
|
+
function RandomAccessReader() {
|
|
1275134
|
+
EventEmitter8.call(this);
|
|
1275135
|
+
this.refCount = 0;
|
|
1275136
|
+
}
|
|
1275137
|
+
RandomAccessReader.prototype.ref = function() {
|
|
1275138
|
+
this.refCount += 1;
|
|
1275139
|
+
};
|
|
1275140
|
+
RandomAccessReader.prototype.unref = function() {
|
|
1275141
|
+
var self2 = this;
|
|
1275142
|
+
self2.refCount -= 1;
|
|
1275143
|
+
if (self2.refCount > 0) return;
|
|
1275144
|
+
if (self2.refCount < 0) throw new Error("invalid unref");
|
|
1275145
|
+
self2.close(onCloseDone);
|
|
1275146
|
+
function onCloseDone(err) {
|
|
1275147
|
+
if (err) return self2.emit("error", err);
|
|
1275148
|
+
self2.emit("close");
|
|
1275149
|
+
}
|
|
1275150
|
+
};
|
|
1275151
|
+
RandomAccessReader.prototype.createReadStream = function(options2) {
|
|
1275152
|
+
if (options2 == null) options2 = {};
|
|
1275153
|
+
var start2 = options2.start;
|
|
1275154
|
+
var end = options2.end;
|
|
1275155
|
+
if (start2 === end) {
|
|
1275156
|
+
var emptyStream = new PassThrough5();
|
|
1275157
|
+
setImmediate(function() {
|
|
1275158
|
+
emptyStream.end();
|
|
1275159
|
+
});
|
|
1275160
|
+
return emptyStream;
|
|
1275161
|
+
}
|
|
1275162
|
+
var stream5 = this._readStreamForRange(start2, end);
|
|
1275163
|
+
var destroyed = false;
|
|
1275164
|
+
var refUnrefFilter = new RefUnrefFilter(this);
|
|
1275165
|
+
stream5.on("error", function(err) {
|
|
1275166
|
+
setImmediate(function() {
|
|
1275167
|
+
if (!destroyed) refUnrefFilter.emit("error", err);
|
|
1275168
|
+
});
|
|
1275169
|
+
});
|
|
1275170
|
+
installDestroyFn(refUnrefFilter, function() {
|
|
1275171
|
+
stream5.unpipe(refUnrefFilter);
|
|
1275172
|
+
refUnrefFilter.unref();
|
|
1275173
|
+
stream5.destroy();
|
|
1275174
|
+
});
|
|
1275175
|
+
var byteCounter = new AssertByteCountStream(end - start2);
|
|
1275176
|
+
refUnrefFilter.on("error", function(err) {
|
|
1275177
|
+
setImmediate(function() {
|
|
1275178
|
+
if (!destroyed) byteCounter.emit("error", err);
|
|
1275179
|
+
});
|
|
1275180
|
+
});
|
|
1275181
|
+
installDestroyFn(byteCounter, function() {
|
|
1275182
|
+
destroyed = true;
|
|
1275183
|
+
refUnrefFilter.unpipe(byteCounter);
|
|
1275184
|
+
refUnrefFilter.destroy();
|
|
1275185
|
+
});
|
|
1275186
|
+
return stream5.pipe(refUnrefFilter).pipe(byteCounter);
|
|
1275187
|
+
};
|
|
1275188
|
+
RandomAccessReader.prototype._readStreamForRange = function(start2, end) {
|
|
1275189
|
+
throw new Error("not implemented");
|
|
1275190
|
+
};
|
|
1275191
|
+
RandomAccessReader.prototype.read = function(buffer, offset2, length, position4, callback) {
|
|
1275192
|
+
var readStream2 = this.createReadStream({ start: position4, end: position4 + length });
|
|
1275193
|
+
var writeStream = new Writable2();
|
|
1275194
|
+
var written = 0;
|
|
1275195
|
+
writeStream._write = function(chunk2, encoding, cb2) {
|
|
1275196
|
+
chunk2.copy(buffer, offset2 + written, 0, chunk2.length);
|
|
1275197
|
+
written += chunk2.length;
|
|
1275198
|
+
cb2();
|
|
1275199
|
+
};
|
|
1275200
|
+
writeStream.on("finish", callback);
|
|
1275201
|
+
readStream2.on("error", function(error49) {
|
|
1275202
|
+
callback(error49);
|
|
1275203
|
+
});
|
|
1275204
|
+
readStream2.pipe(writeStream);
|
|
1275205
|
+
};
|
|
1275206
|
+
RandomAccessReader.prototype.close = function(callback) {
|
|
1275207
|
+
setImmediate(callback);
|
|
1275208
|
+
};
|
|
1275209
|
+
util4.inherits(RefUnrefFilter, PassThrough5);
|
|
1275210
|
+
function RefUnrefFilter(context2) {
|
|
1275211
|
+
PassThrough5.call(this);
|
|
1275212
|
+
this.context = context2;
|
|
1275213
|
+
this.context.ref();
|
|
1275214
|
+
this.unreffedYet = false;
|
|
1275215
|
+
}
|
|
1275216
|
+
RefUnrefFilter.prototype._flush = function(cb2) {
|
|
1275217
|
+
this.unref();
|
|
1275218
|
+
cb2();
|
|
1275219
|
+
};
|
|
1275220
|
+
RefUnrefFilter.prototype.unref = function(cb2) {
|
|
1275221
|
+
if (this.unreffedYet) return;
|
|
1275222
|
+
this.unreffedYet = true;
|
|
1275223
|
+
this.context.unref();
|
|
1275224
|
+
};
|
|
1275225
|
+
var cp437 = "\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";
|
|
1275226
|
+
function decodeBuffer(buffer, isUtf8) {
|
|
1275227
|
+
if (isUtf8) {
|
|
1275228
|
+
return buffer.toString("utf8");
|
|
1275229
|
+
} else {
|
|
1275230
|
+
var result = "";
|
|
1275231
|
+
for (var i11 = 0; i11 < buffer.length; i11++) {
|
|
1275232
|
+
result += cp437[buffer[i11]];
|
|
1275233
|
+
}
|
|
1275234
|
+
return result;
|
|
1275235
|
+
}
|
|
1275236
|
+
}
|
|
1275237
|
+
function readUInt64LE(buffer, offset2) {
|
|
1275238
|
+
var lower32 = buffer.readUInt32LE(offset2);
|
|
1275239
|
+
var upper32 = buffer.readUInt32LE(offset2 + 4);
|
|
1275240
|
+
return upper32 * 4294967296 + lower32;
|
|
1275241
|
+
}
|
|
1275242
|
+
var newBuffer;
|
|
1275243
|
+
if (typeof Buffer.allocUnsafe === "function") {
|
|
1275244
|
+
newBuffer = function(len) {
|
|
1275245
|
+
return Buffer.allocUnsafe(len);
|
|
1275246
|
+
};
|
|
1275247
|
+
} else {
|
|
1275248
|
+
newBuffer = function(len) {
|
|
1275249
|
+
return new Buffer(len);
|
|
1275250
|
+
};
|
|
1275251
|
+
}
|
|
1275252
|
+
function installDestroyFn(stream5, fn4) {
|
|
1275253
|
+
if (typeof stream5.destroy === "function") {
|
|
1275254
|
+
stream5._destroy = function(err, cb2) {
|
|
1275255
|
+
fn4();
|
|
1275256
|
+
if (cb2 != null) cb2(err);
|
|
1275257
|
+
};
|
|
1275258
|
+
} else {
|
|
1275259
|
+
stream5.destroy = fn4;
|
|
1275260
|
+
}
|
|
1275261
|
+
}
|
|
1275262
|
+
function defaultCallback(err) {
|
|
1275263
|
+
if (err) throw err;
|
|
1275264
|
+
}
|
|
1275265
|
+
}
|
|
1275266
|
+
});
|
|
1275267
|
+
|
|
1274255
1275268
|
// ../../../node_modules/.pnpm/acorn-jsx@5.3.2_acorn@8.15.0/node_modules/acorn-jsx/xhtml.js
|
|
1274256
1275269
|
var require_xhtml = __commonJS({
|
|
1274257
1275270
|
"../../../node_modules/.pnpm/acorn-jsx@5.3.2_acorn@8.15.0/node_modules/acorn-jsx/xhtml.js"(exports2, module4) {
|
|
@@ -1347190,8 +1348203,8 @@ var require_extract_zip = __commonJS({
|
|
|
1347190
1348203
|
var path86 = require("path");
|
|
1347191
1348204
|
var { promisify: promisify4 } = require("util");
|
|
1347192
1348205
|
var stream5 = require("stream");
|
|
1347193
|
-
var
|
|
1347194
|
-
var openZip = promisify4(
|
|
1348206
|
+
var yauzl2 = require_yauzl();
|
|
1348207
|
+
var openZip = promisify4(yauzl2.open);
|
|
1347195
1348208
|
var pipeline5 = promisify4(stream5.pipeline);
|
|
1347196
1348209
|
var Extractor = class {
|
|
1347197
1348210
|
constructor(zipPath, opts) {
|
|
@@ -1426227,7 +1427240,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1426227
1427240
|
properties: {
|
|
1426228
1427241
|
...event,
|
|
1426229
1427242
|
...event.properties,
|
|
1426230
|
-
version: "3.64.
|
|
1427243
|
+
version: "3.64.4-1-g68ccf13a82f",
|
|
1426231
1427244
|
usingAccessToken: true
|
|
1426232
1427245
|
}
|
|
1426233
1427246
|
});
|
|
@@ -1426326,7 +1427339,7 @@ var UserPosthogManager = class {
|
|
|
1426326
1427339
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1426327
1427340
|
event: "CLI",
|
|
1426328
1427341
|
properties: {
|
|
1426329
|
-
version: "3.64.
|
|
1427342
|
+
version: "3.64.4-1-g68ccf13a82f",
|
|
1426330
1427343
|
...event,
|
|
1426331
1427344
|
...event.properties,
|
|
1426332
1427345
|
usingAccessToken: false,
|
|
@@ -1552603,7 +1553616,6 @@ var ExampleConverter = class _ExampleConverter extends AbstractConverter {
|
|
|
1552603
1553616
|
});
|
|
1552604
1553617
|
return exampleConverter.convert();
|
|
1552605
1553618
|
});
|
|
1552606
|
-
const isValid3 = resultsByKey.every((entry) => entry.result.isValid) && allOfResults.every((result) => result.isValid);
|
|
1552607
1553619
|
const usedProvidedExample = this.example !== void 0 && (resultsByKey.some(({ result }) => result.usedProvidedExample) || allOfResults.some((result) => result.usedProvidedExample));
|
|
1552608
1553620
|
let example = Object.fromEntries(resultsByKey.map(({ key: key2, result }) => [key2, result.validExample]).filter(([_15, value]) => value !== void 0));
|
|
1552609
1553621
|
for (const result of allOfResults) {
|
|
@@ -1552637,27 +1553649,38 @@ var ExampleConverter = class _ExampleConverter extends AbstractConverter {
|
|
|
1552637
1553649
|
}
|
|
1552638
1553650
|
});
|
|
1552639
1553651
|
});
|
|
1552640
|
-
} else {
|
|
1553652
|
+
} else if (resolvedSchema.additionalProperties === true || resolvedSchema.additionalProperties === void 0) {
|
|
1552641
1553653
|
additionalPropertyKeys.forEach((key2) => {
|
|
1552642
|
-
const breadcrumbPath = [...this.breadcrumbs, key2].join(".");
|
|
1552643
|
-
const warningError = {
|
|
1552644
|
-
message: `Additional property ${key2} is not allowed`,
|
|
1552645
|
-
path: [...this.breadcrumbs, key2]
|
|
1552646
|
-
};
|
|
1552647
1553654
|
additionalPropertiesResults.push({
|
|
1552648
1553655
|
key: key2,
|
|
1552649
1553656
|
result: {
|
|
1552650
1553657
|
isValid: true,
|
|
1552651
|
-
// Keep as valid since additional properties are allowed
|
|
1552652
1553658
|
coerced: false,
|
|
1552653
1553659
|
usedProvidedExample: true,
|
|
1552654
|
-
validExample:
|
|
1552655
|
-
|
|
1552656
|
-
errors: [warningError]
|
|
1552657
|
-
// Include as warning error
|
|
1553660
|
+
validExample: exampleObj[key2],
|
|
1553661
|
+
errors: []
|
|
1552658
1553662
|
}
|
|
1552659
1553663
|
});
|
|
1552660
1553664
|
});
|
|
1553665
|
+
} else {
|
|
1553666
|
+
const additionalPropsSchema = resolvedSchema.additionalProperties;
|
|
1553667
|
+
additionalPropertyKeys.forEach((key2) => {
|
|
1553668
|
+
const exampleConverter = new _ExampleConverter({
|
|
1553669
|
+
breadcrumbs: [...this.breadcrumbs, key2],
|
|
1553670
|
+
context: this.context,
|
|
1553671
|
+
schema: additionalPropsSchema,
|
|
1553672
|
+
example: exampleObj[key2],
|
|
1553673
|
+
depth: this.depth + 1,
|
|
1553674
|
+
generateOptionalProperties: this.generateOptionalProperties,
|
|
1553675
|
+
exampleGenerationStrategy: this.exampleGenerationStrategy,
|
|
1553676
|
+
seenRefs: this.getMaybeUpdatedSeenRefs()
|
|
1553677
|
+
});
|
|
1553678
|
+
const result = exampleConverter.convert();
|
|
1553679
|
+
additionalPropertiesResults.push({
|
|
1553680
|
+
key: key2,
|
|
1553681
|
+
result
|
|
1553682
|
+
});
|
|
1553683
|
+
});
|
|
1552661
1553684
|
}
|
|
1552662
1553685
|
}
|
|
1552663
1553686
|
for (const { key: key2, result } of additionalPropertiesResults) {
|
|
@@ -1552665,6 +1553688,7 @@ var ExampleConverter = class _ExampleConverter extends AbstractConverter {
|
|
|
1552665
1553688
|
example[key2] = result.validExample;
|
|
1552666
1553689
|
}
|
|
1552667
1553690
|
}
|
|
1553691
|
+
const isValid3 = resultsByKey.every((entry) => entry.result.isValid) && allOfResults.every((result) => result.isValid) && additionalPropertiesResults.every(({ result }) => result.isValid);
|
|
1552668
1553692
|
if (Object.keys(example).length === 0) {
|
|
1552669
1553693
|
const firstValidNonObject = allOfResults.find((result) => result.validExample !== void 0 && (typeof result.validExample !== "object" || result.validExample === null));
|
|
1552670
1553694
|
if (firstValidNonObject) {
|
|
@@ -1628012,7 +1629036,6 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context2 })
|
|
|
1628012
1629036
|
}
|
|
1628013
1629037
|
|
|
1628014
1629038
|
// ../generation/remote-generation/remote-workspace-runner/lib/RemoteTaskHandler.js
|
|
1628015
|
-
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
1628016
1629039
|
var import_fs20 = require("fs");
|
|
1628017
1629040
|
var import_promises65 = require("fs/promises");
|
|
1628018
1629041
|
var import_path48 = __toESM(require("path"), 1);
|
|
@@ -1628035,6 +1629058,7 @@ terminalLink.stderr.isSupported = import_supports_hyperlinks.default.stderr;
|
|
|
1628035
1629058
|
|
|
1628036
1629059
|
// ../generation/remote-generation/remote-workspace-runner/lib/RemoteTaskHandler.js
|
|
1628037
1629060
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
1629061
|
+
var import_yauzl = __toESM(require_yauzl2(), 1);
|
|
1628038
1629062
|
var RemoteTaskHandler = class {
|
|
1628039
1629063
|
context;
|
|
1628040
1629064
|
generatorInvocation;
|
|
@@ -1628187,7 +1629211,7 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
1628187
1629211
|
await (0, import_promises66.pipeline)(request6.data, (0, import_fs20.createWriteStream)(outputZipPath));
|
|
1628188
1629212
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
1628189
1629213
|
await (0, import_promises65.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
1628190
|
-
await (
|
|
1629214
|
+
await extractZipToDirectory(outputZipPath, absolutePathToLocalOutput);
|
|
1628191
1629215
|
}
|
|
1628192
1629216
|
async function forceRemoveDirectory(dirPath) {
|
|
1628193
1629217
|
if (!await doesPathExist(dirPath)) {
|
|
@@ -1628285,7 +1629309,36 @@ async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath
|
|
|
1628285
1629309
|
const tmpDir = await import_tmp_promise11.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
1628286
1629310
|
const outputZipPath = import_path48.default.join(tmpDir.path, "output.zip");
|
|
1628287
1629311
|
await (0, import_promises66.pipeline)(request6.data, (0, import_fs20.createWriteStream)(outputZipPath));
|
|
1628288
|
-
await (
|
|
1629312
|
+
await extractZipToDirectory(outputZipPath, outputPath);
|
|
1629313
|
+
}
|
|
1629314
|
+
async function extractZipToDirectory(zipPath, outputDir) {
|
|
1629315
|
+
return new Promise((resolve10, reject) => {
|
|
1629316
|
+
import_yauzl.default.open(zipPath, { lazyEntries: true }, (err, zipFile) => {
|
|
1629317
|
+
if (err || !zipFile) {
|
|
1629318
|
+
reject(err ?? new Error("Failed to open zip file"));
|
|
1629319
|
+
return;
|
|
1629320
|
+
}
|
|
1629321
|
+
zipFile.on("error", reject);
|
|
1629322
|
+
zipFile.on("end", resolve10);
|
|
1629323
|
+
zipFile.on("entry", (entry) => {
|
|
1629324
|
+
const outputPath = import_path48.default.join(outputDir, entry.fileName);
|
|
1629325
|
+
if (entry.fileName.endsWith("/")) {
|
|
1629326
|
+
(0, import_promises65.mkdir)(outputPath, { recursive: true }).then(() => zipFile.readEntry()).catch(reject);
|
|
1629327
|
+
return;
|
|
1629328
|
+
}
|
|
1629329
|
+
(0, import_promises65.mkdir)(import_path48.default.dirname(outputPath), { recursive: true }).then(() => {
|
|
1629330
|
+
zipFile.openReadStream(entry, (streamErr, readStream2) => {
|
|
1629331
|
+
if (streamErr || !readStream2) {
|
|
1629332
|
+
reject(streamErr ?? new Error("Failed to open read stream"));
|
|
1629333
|
+
return;
|
|
1629334
|
+
}
|
|
1629335
|
+
readStream2.pipe((0, import_fs20.createWriteStream)(outputPath)).on("finish", () => zipFile.readEntry()).on("error", reject);
|
|
1629336
|
+
});
|
|
1629337
|
+
}).catch(reject);
|
|
1629338
|
+
});
|
|
1629339
|
+
zipFile.readEntry();
|
|
1629340
|
+
});
|
|
1629341
|
+
});
|
|
1628289
1629342
|
}
|
|
1628290
1629343
|
|
|
1628291
1629344
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
@@ -1712562,7 +1713615,7 @@ var CliContext = class {
|
|
|
1712562
1713615
|
if (false) {
|
|
1712563
1713616
|
this.logger.error("CLI_VERSION is not defined");
|
|
1712564
1713617
|
}
|
|
1712565
|
-
return "3.64.
|
|
1713618
|
+
return "3.64.4-1-g68ccf13a82f";
|
|
1712566
1713619
|
}
|
|
1712567
1713620
|
getCliName() {
|
|
1712568
1713621
|
if (false) {
|
|
@@ -1715676,7 +1716729,7 @@ var import_path56 = __toESM(require("path"), 1);
|
|
|
1715676
1716729
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
1715677
1716730
|
var LOGS_FOLDER_NAME = "logs";
|
|
1715678
1716731
|
function getCliSource() {
|
|
1715679
|
-
const version7 = "3.64.
|
|
1716732
|
+
const version7 = "3.64.4-1-g68ccf13a82f";
|
|
1715680
1716733
|
return `cli@${version7}`;
|
|
1715681
1716734
|
}
|
|
1715682
1716735
|
var DebugLogger = class {
|
|
@@ -1715850,7 +1716903,7 @@ var DebugLogger = class {
|
|
|
1715850
1716903
|
|
|
1715851
1716904
|
// ../docs-preview/lib/downloadLocalDocsBundle.js
|
|
1715852
1716905
|
var import_cli_progress = __toESM(require_cli_progress(), 1);
|
|
1715853
|
-
var
|
|
1716906
|
+
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
1715854
1716907
|
var import_promises98 = require("fs/promises");
|
|
1715855
1716908
|
var import_os9 = require("os");
|
|
1715856
1716909
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
@@ -1716035,7 +1717088,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1716035
1717088
|
}, 50);
|
|
1716036
1717089
|
}
|
|
1716037
1717090
|
try {
|
|
1716038
|
-
await (0,
|
|
1717091
|
+
await (0, import_decompress2.default)(outputZipPath, absolutePathToBundleFolder, {
|
|
1716039
1717092
|
filter: (file4) => !(PLATFORM_IS_WINDOWS && file4.type === "symlink")
|
|
1716040
1717093
|
});
|
|
1716041
1717094
|
} finally {
|
package/package.json
CHANGED