@apps-in-toss/cli 0.0.24 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +22 -1454
- package/dist/index.js +20 -1452
- package/package.json +5 -6
package/dist/index.cjs
CHANGED
|
@@ -51,13 +51,13 @@ var require_ms = __commonJS({
|
|
|
51
51
|
var d = h * 24;
|
|
52
52
|
var w = d * 7;
|
|
53
53
|
var y = d * 365.25;
|
|
54
|
-
module2.exports = function(val,
|
|
55
|
-
|
|
54
|
+
module2.exports = function(val, options) {
|
|
55
|
+
options = options || {};
|
|
56
56
|
var type = typeof val;
|
|
57
57
|
if (type === "string" && val.length > 0) {
|
|
58
58
|
return parse(val);
|
|
59
59
|
} else if (type === "number" && isFinite(val)) {
|
|
60
|
-
return
|
|
60
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
61
61
|
}
|
|
62
62
|
throw new Error(
|
|
63
63
|
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
@@ -772,1387 +772,6 @@ var require_picocolors = __commonJS({
|
|
|
772
772
|
}
|
|
773
773
|
});
|
|
774
774
|
|
|
775
|
-
// ../../.yarn/cache/pend-npm-1.2.0-dddaab3bf3-8a87e63f7a.zip/node_modules/pend/index.js
|
|
776
|
-
var require_pend = __commonJS({
|
|
777
|
-
"../../.yarn/cache/pend-npm-1.2.0-dddaab3bf3-8a87e63f7a.zip/node_modules/pend/index.js"(exports2, module2) {
|
|
778
|
-
"use strict";
|
|
779
|
-
init_cjs_shims();
|
|
780
|
-
module2.exports = Pend;
|
|
781
|
-
function Pend() {
|
|
782
|
-
this.pending = 0;
|
|
783
|
-
this.max = Infinity;
|
|
784
|
-
this.listeners = [];
|
|
785
|
-
this.waiting = [];
|
|
786
|
-
this.error = null;
|
|
787
|
-
}
|
|
788
|
-
Pend.prototype.go = function(fn) {
|
|
789
|
-
if (this.pending < this.max) {
|
|
790
|
-
pendGo(this, fn);
|
|
791
|
-
} else {
|
|
792
|
-
this.waiting.push(fn);
|
|
793
|
-
}
|
|
794
|
-
};
|
|
795
|
-
Pend.prototype.wait = function(cb) {
|
|
796
|
-
if (this.pending === 0) {
|
|
797
|
-
cb(this.error);
|
|
798
|
-
} else {
|
|
799
|
-
this.listeners.push(cb);
|
|
800
|
-
}
|
|
801
|
-
};
|
|
802
|
-
Pend.prototype.hold = function() {
|
|
803
|
-
return pendHold(this);
|
|
804
|
-
};
|
|
805
|
-
function pendHold(self) {
|
|
806
|
-
self.pending += 1;
|
|
807
|
-
var called = false;
|
|
808
|
-
return onCb;
|
|
809
|
-
function onCb(err) {
|
|
810
|
-
if (called) throw new Error("callback called twice");
|
|
811
|
-
called = true;
|
|
812
|
-
self.error = self.error || err;
|
|
813
|
-
self.pending -= 1;
|
|
814
|
-
if (self.waiting.length > 0 && self.pending < self.max) {
|
|
815
|
-
pendGo(self, self.waiting.shift());
|
|
816
|
-
} else if (self.pending === 0) {
|
|
817
|
-
var listeners = self.listeners;
|
|
818
|
-
self.listeners = [];
|
|
819
|
-
listeners.forEach(cbListener);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
function cbListener(listener) {
|
|
823
|
-
listener(self.error);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
function pendGo(self, fn) {
|
|
827
|
-
fn(pendHold(self));
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
});
|
|
831
|
-
|
|
832
|
-
// ../../.yarn/cache/yauzl-npm-3.2.0-b1af038bc6-7b40b3dc46.zip/node_modules/yauzl/fd-slicer.js
|
|
833
|
-
var require_fd_slicer = __commonJS({
|
|
834
|
-
"../../.yarn/cache/yauzl-npm-3.2.0-b1af038bc6-7b40b3dc46.zip/node_modules/yauzl/fd-slicer.js"(exports2) {
|
|
835
|
-
"use strict";
|
|
836
|
-
init_cjs_shims();
|
|
837
|
-
var fs5 = require("fs");
|
|
838
|
-
var util = require("util");
|
|
839
|
-
var stream = require("stream");
|
|
840
|
-
var Readable = stream.Readable;
|
|
841
|
-
var Writable = stream.Writable;
|
|
842
|
-
var PassThrough = stream.PassThrough;
|
|
843
|
-
var Pend = require_pend();
|
|
844
|
-
var EventEmitter = require("events").EventEmitter;
|
|
845
|
-
exports2.createFromBuffer = createFromBuffer;
|
|
846
|
-
exports2.createFromFd = createFromFd;
|
|
847
|
-
exports2.BufferSlicer = BufferSlicer;
|
|
848
|
-
exports2.FdSlicer = FdSlicer;
|
|
849
|
-
util.inherits(FdSlicer, EventEmitter);
|
|
850
|
-
function FdSlicer(fd, options2) {
|
|
851
|
-
options2 = options2 || {};
|
|
852
|
-
EventEmitter.call(this);
|
|
853
|
-
this.fd = fd;
|
|
854
|
-
this.pend = new Pend();
|
|
855
|
-
this.pend.max = 1;
|
|
856
|
-
this.refCount = 0;
|
|
857
|
-
this.autoClose = !!options2.autoClose;
|
|
858
|
-
}
|
|
859
|
-
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
860
|
-
var self = this;
|
|
861
|
-
self.pend.go(function(cb) {
|
|
862
|
-
fs5.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
|
|
863
|
-
cb();
|
|
864
|
-
callback(err, bytesRead, buffer2);
|
|
865
|
-
});
|
|
866
|
-
});
|
|
867
|
-
};
|
|
868
|
-
FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
869
|
-
var self = this;
|
|
870
|
-
self.pend.go(function(cb) {
|
|
871
|
-
fs5.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
|
|
872
|
-
cb();
|
|
873
|
-
callback(err, written, buffer2);
|
|
874
|
-
});
|
|
875
|
-
});
|
|
876
|
-
};
|
|
877
|
-
FdSlicer.prototype.createReadStream = function(options2) {
|
|
878
|
-
return new ReadStream(this, options2);
|
|
879
|
-
};
|
|
880
|
-
FdSlicer.prototype.createWriteStream = function(options2) {
|
|
881
|
-
return new WriteStream(this, options2);
|
|
882
|
-
};
|
|
883
|
-
FdSlicer.prototype.ref = function() {
|
|
884
|
-
this.refCount += 1;
|
|
885
|
-
};
|
|
886
|
-
FdSlicer.prototype.unref = function() {
|
|
887
|
-
var self = this;
|
|
888
|
-
self.refCount -= 1;
|
|
889
|
-
if (self.refCount > 0) return;
|
|
890
|
-
if (self.refCount < 0) throw new Error("invalid unref");
|
|
891
|
-
if (self.autoClose) {
|
|
892
|
-
fs5.close(self.fd, onCloseDone);
|
|
893
|
-
}
|
|
894
|
-
function onCloseDone(err) {
|
|
895
|
-
if (err) {
|
|
896
|
-
self.emit("error", err);
|
|
897
|
-
} else {
|
|
898
|
-
self.emit("close");
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
};
|
|
902
|
-
util.inherits(ReadStream, Readable);
|
|
903
|
-
function ReadStream(context, options2) {
|
|
904
|
-
options2 = options2 || {};
|
|
905
|
-
Readable.call(this, options2);
|
|
906
|
-
this.context = context;
|
|
907
|
-
this.context.ref();
|
|
908
|
-
this.start = options2.start || 0;
|
|
909
|
-
this.endOffset = options2.end;
|
|
910
|
-
this.pos = this.start;
|
|
911
|
-
this.destroyed = false;
|
|
912
|
-
}
|
|
913
|
-
ReadStream.prototype._read = function(n) {
|
|
914
|
-
var self = this;
|
|
915
|
-
if (self.destroyed) return;
|
|
916
|
-
var toRead = Math.min(self._readableState.highWaterMark, n);
|
|
917
|
-
if (self.endOffset != null) {
|
|
918
|
-
toRead = Math.min(toRead, self.endOffset - self.pos);
|
|
919
|
-
}
|
|
920
|
-
if (toRead <= 0) {
|
|
921
|
-
self.destroyed = true;
|
|
922
|
-
self.push(null);
|
|
923
|
-
self.context.unref();
|
|
924
|
-
return;
|
|
925
|
-
}
|
|
926
|
-
self.context.pend.go(function(cb) {
|
|
927
|
-
if (self.destroyed) return cb();
|
|
928
|
-
var buffer = Buffer.allocUnsafe(toRead);
|
|
929
|
-
fs5.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
|
|
930
|
-
if (err) {
|
|
931
|
-
self.destroy(err);
|
|
932
|
-
} else if (bytesRead === 0) {
|
|
933
|
-
self.destroyed = true;
|
|
934
|
-
self.push(null);
|
|
935
|
-
self.context.unref();
|
|
936
|
-
} else {
|
|
937
|
-
self.pos += bytesRead;
|
|
938
|
-
self.push(buffer.slice(0, bytesRead));
|
|
939
|
-
}
|
|
940
|
-
cb();
|
|
941
|
-
});
|
|
942
|
-
});
|
|
943
|
-
};
|
|
944
|
-
ReadStream.prototype.destroy = function(err) {
|
|
945
|
-
if (this.destroyed) return;
|
|
946
|
-
err = err || new Error("stream destroyed");
|
|
947
|
-
this.destroyed = true;
|
|
948
|
-
this.emit("error", err);
|
|
949
|
-
this.context.unref();
|
|
950
|
-
};
|
|
951
|
-
util.inherits(WriteStream, Writable);
|
|
952
|
-
function WriteStream(context, options2) {
|
|
953
|
-
options2 = options2 || {};
|
|
954
|
-
Writable.call(this, options2);
|
|
955
|
-
this.context = context;
|
|
956
|
-
this.context.ref();
|
|
957
|
-
this.start = options2.start || 0;
|
|
958
|
-
this.endOffset = options2.end == null ? Infinity : +options2.end;
|
|
959
|
-
this.bytesWritten = 0;
|
|
960
|
-
this.pos = this.start;
|
|
961
|
-
this.destroyed = false;
|
|
962
|
-
this.on("finish", this.destroy.bind(this));
|
|
963
|
-
}
|
|
964
|
-
WriteStream.prototype._write = function(buffer, encoding, callback) {
|
|
965
|
-
var self = this;
|
|
966
|
-
if (self.destroyed) return;
|
|
967
|
-
if (self.pos + buffer.length > self.endOffset) {
|
|
968
|
-
var err = new Error("maximum file length exceeded");
|
|
969
|
-
err.code = "ETOOBIG";
|
|
970
|
-
self.destroy();
|
|
971
|
-
callback(err);
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
|
-
self.context.pend.go(function(cb) {
|
|
975
|
-
if (self.destroyed) return cb();
|
|
976
|
-
fs5.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
|
|
977
|
-
if (err2) {
|
|
978
|
-
self.destroy();
|
|
979
|
-
cb();
|
|
980
|
-
callback(err2);
|
|
981
|
-
} else {
|
|
982
|
-
self.bytesWritten += bytes;
|
|
983
|
-
self.pos += bytes;
|
|
984
|
-
self.emit("progress");
|
|
985
|
-
cb();
|
|
986
|
-
callback();
|
|
987
|
-
}
|
|
988
|
-
});
|
|
989
|
-
});
|
|
990
|
-
};
|
|
991
|
-
WriteStream.prototype.destroy = function() {
|
|
992
|
-
if (this.destroyed) return;
|
|
993
|
-
this.destroyed = true;
|
|
994
|
-
this.context.unref();
|
|
995
|
-
};
|
|
996
|
-
util.inherits(BufferSlicer, EventEmitter);
|
|
997
|
-
function BufferSlicer(buffer, options2) {
|
|
998
|
-
EventEmitter.call(this);
|
|
999
|
-
options2 = options2 || {};
|
|
1000
|
-
this.refCount = 0;
|
|
1001
|
-
this.buffer = buffer;
|
|
1002
|
-
this.maxChunkSize = options2.maxChunkSize || Number.MAX_SAFE_INTEGER;
|
|
1003
|
-
}
|
|
1004
|
-
BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
1005
|
-
if (!(0 <= offset && offset <= buffer.length)) throw new RangeError("offset outside buffer: 0 <= " + offset + " <= " + buffer.length);
|
|
1006
|
-
if (position < 0) throw new RangeError("position is negative: " + position);
|
|
1007
|
-
if (offset + length > buffer.length) {
|
|
1008
|
-
length = buffer.length - offset;
|
|
1009
|
-
}
|
|
1010
|
-
if (position + length > this.buffer.length) {
|
|
1011
|
-
length = this.buffer.length - position;
|
|
1012
|
-
}
|
|
1013
|
-
if (length <= 0) {
|
|
1014
|
-
setImmediate(function() {
|
|
1015
|
-
callback(null, 0);
|
|
1016
|
-
});
|
|
1017
|
-
return;
|
|
1018
|
-
}
|
|
1019
|
-
this.buffer.copy(buffer, offset, position, position + length);
|
|
1020
|
-
setImmediate(function() {
|
|
1021
|
-
callback(null, length);
|
|
1022
|
-
});
|
|
1023
|
-
};
|
|
1024
|
-
BufferSlicer.prototype.write = function(buffer, offset, length, position, callback) {
|
|
1025
|
-
buffer.copy(this.buffer, position, offset, offset + length);
|
|
1026
|
-
setImmediate(function() {
|
|
1027
|
-
callback(null, length, buffer);
|
|
1028
|
-
});
|
|
1029
|
-
};
|
|
1030
|
-
BufferSlicer.prototype.createReadStream = function(options2) {
|
|
1031
|
-
options2 = options2 || {};
|
|
1032
|
-
var readStream = new PassThrough(options2);
|
|
1033
|
-
readStream.destroyed = false;
|
|
1034
|
-
readStream.start = options2.start || 0;
|
|
1035
|
-
readStream.endOffset = options2.end;
|
|
1036
|
-
readStream.pos = readStream.endOffset || this.buffer.length;
|
|
1037
|
-
var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
|
|
1038
|
-
var offset = 0;
|
|
1039
|
-
while (true) {
|
|
1040
|
-
var nextOffset = offset + this.maxChunkSize;
|
|
1041
|
-
if (nextOffset >= entireSlice.length) {
|
|
1042
|
-
if (offset < entireSlice.length) {
|
|
1043
|
-
readStream.write(entireSlice.slice(offset, entireSlice.length));
|
|
1044
|
-
}
|
|
1045
|
-
break;
|
|
1046
|
-
}
|
|
1047
|
-
readStream.write(entireSlice.slice(offset, nextOffset));
|
|
1048
|
-
offset = nextOffset;
|
|
1049
|
-
}
|
|
1050
|
-
readStream.end();
|
|
1051
|
-
readStream.destroy = function() {
|
|
1052
|
-
readStream.destroyed = true;
|
|
1053
|
-
};
|
|
1054
|
-
return readStream;
|
|
1055
|
-
};
|
|
1056
|
-
BufferSlicer.prototype.createWriteStream = function(options2) {
|
|
1057
|
-
var bufferSlicer = this;
|
|
1058
|
-
options2 = options2 || {};
|
|
1059
|
-
var writeStream = new Writable(options2);
|
|
1060
|
-
writeStream.start = options2.start || 0;
|
|
1061
|
-
writeStream.endOffset = options2.end == null ? this.buffer.length : +options2.end;
|
|
1062
|
-
writeStream.bytesWritten = 0;
|
|
1063
|
-
writeStream.pos = writeStream.start;
|
|
1064
|
-
writeStream.destroyed = false;
|
|
1065
|
-
writeStream._write = function(buffer, encoding, callback) {
|
|
1066
|
-
if (writeStream.destroyed) return;
|
|
1067
|
-
var end = writeStream.pos + buffer.length;
|
|
1068
|
-
if (end > writeStream.endOffset) {
|
|
1069
|
-
var err = new Error("maximum file length exceeded");
|
|
1070
|
-
err.code = "ETOOBIG";
|
|
1071
|
-
writeStream.destroyed = true;
|
|
1072
|
-
callback(err);
|
|
1073
|
-
return;
|
|
1074
|
-
}
|
|
1075
|
-
buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length);
|
|
1076
|
-
writeStream.bytesWritten += buffer.length;
|
|
1077
|
-
writeStream.pos = end;
|
|
1078
|
-
writeStream.emit("progress");
|
|
1079
|
-
callback();
|
|
1080
|
-
};
|
|
1081
|
-
writeStream.destroy = function() {
|
|
1082
|
-
writeStream.destroyed = true;
|
|
1083
|
-
};
|
|
1084
|
-
return writeStream;
|
|
1085
|
-
};
|
|
1086
|
-
BufferSlicer.prototype.ref = function() {
|
|
1087
|
-
this.refCount += 1;
|
|
1088
|
-
};
|
|
1089
|
-
BufferSlicer.prototype.unref = function() {
|
|
1090
|
-
this.refCount -= 1;
|
|
1091
|
-
if (this.refCount < 0) {
|
|
1092
|
-
throw new Error("invalid unref");
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
function createFromBuffer(buffer, options2) {
|
|
1096
|
-
return new BufferSlicer(buffer, options2);
|
|
1097
|
-
}
|
|
1098
|
-
function createFromFd(fd, options2) {
|
|
1099
|
-
return new FdSlicer(fd, options2);
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
});
|
|
1103
|
-
|
|
1104
|
-
// ../../.yarn/cache/buffer-crc32-npm-0.2.13-e25ddc91f5-cb0a8ddf5c.zip/node_modules/buffer-crc32/index.js
|
|
1105
|
-
var require_buffer_crc32 = __commonJS({
|
|
1106
|
-
"../../.yarn/cache/buffer-crc32-npm-0.2.13-e25ddc91f5-cb0a8ddf5c.zip/node_modules/buffer-crc32/index.js"(exports2, module2) {
|
|
1107
|
-
"use strict";
|
|
1108
|
-
init_cjs_shims();
|
|
1109
|
-
var Buffer2 = require("buffer").Buffer;
|
|
1110
|
-
var CRC_TABLE = [
|
|
1111
|
-
0,
|
|
1112
|
-
1996959894,
|
|
1113
|
-
3993919788,
|
|
1114
|
-
2567524794,
|
|
1115
|
-
124634137,
|
|
1116
|
-
1886057615,
|
|
1117
|
-
3915621685,
|
|
1118
|
-
2657392035,
|
|
1119
|
-
249268274,
|
|
1120
|
-
2044508324,
|
|
1121
|
-
3772115230,
|
|
1122
|
-
2547177864,
|
|
1123
|
-
162941995,
|
|
1124
|
-
2125561021,
|
|
1125
|
-
3887607047,
|
|
1126
|
-
2428444049,
|
|
1127
|
-
498536548,
|
|
1128
|
-
1789927666,
|
|
1129
|
-
4089016648,
|
|
1130
|
-
2227061214,
|
|
1131
|
-
450548861,
|
|
1132
|
-
1843258603,
|
|
1133
|
-
4107580753,
|
|
1134
|
-
2211677639,
|
|
1135
|
-
325883990,
|
|
1136
|
-
1684777152,
|
|
1137
|
-
4251122042,
|
|
1138
|
-
2321926636,
|
|
1139
|
-
335633487,
|
|
1140
|
-
1661365465,
|
|
1141
|
-
4195302755,
|
|
1142
|
-
2366115317,
|
|
1143
|
-
997073096,
|
|
1144
|
-
1281953886,
|
|
1145
|
-
3579855332,
|
|
1146
|
-
2724688242,
|
|
1147
|
-
1006888145,
|
|
1148
|
-
1258607687,
|
|
1149
|
-
3524101629,
|
|
1150
|
-
2768942443,
|
|
1151
|
-
901097722,
|
|
1152
|
-
1119000684,
|
|
1153
|
-
3686517206,
|
|
1154
|
-
2898065728,
|
|
1155
|
-
853044451,
|
|
1156
|
-
1172266101,
|
|
1157
|
-
3705015759,
|
|
1158
|
-
2882616665,
|
|
1159
|
-
651767980,
|
|
1160
|
-
1373503546,
|
|
1161
|
-
3369554304,
|
|
1162
|
-
3218104598,
|
|
1163
|
-
565507253,
|
|
1164
|
-
1454621731,
|
|
1165
|
-
3485111705,
|
|
1166
|
-
3099436303,
|
|
1167
|
-
671266974,
|
|
1168
|
-
1594198024,
|
|
1169
|
-
3322730930,
|
|
1170
|
-
2970347812,
|
|
1171
|
-
795835527,
|
|
1172
|
-
1483230225,
|
|
1173
|
-
3244367275,
|
|
1174
|
-
3060149565,
|
|
1175
|
-
1994146192,
|
|
1176
|
-
31158534,
|
|
1177
|
-
2563907772,
|
|
1178
|
-
4023717930,
|
|
1179
|
-
1907459465,
|
|
1180
|
-
112637215,
|
|
1181
|
-
2680153253,
|
|
1182
|
-
3904427059,
|
|
1183
|
-
2013776290,
|
|
1184
|
-
251722036,
|
|
1185
|
-
2517215374,
|
|
1186
|
-
3775830040,
|
|
1187
|
-
2137656763,
|
|
1188
|
-
141376813,
|
|
1189
|
-
2439277719,
|
|
1190
|
-
3865271297,
|
|
1191
|
-
1802195444,
|
|
1192
|
-
476864866,
|
|
1193
|
-
2238001368,
|
|
1194
|
-
4066508878,
|
|
1195
|
-
1812370925,
|
|
1196
|
-
453092731,
|
|
1197
|
-
2181625025,
|
|
1198
|
-
4111451223,
|
|
1199
|
-
1706088902,
|
|
1200
|
-
314042704,
|
|
1201
|
-
2344532202,
|
|
1202
|
-
4240017532,
|
|
1203
|
-
1658658271,
|
|
1204
|
-
366619977,
|
|
1205
|
-
2362670323,
|
|
1206
|
-
4224994405,
|
|
1207
|
-
1303535960,
|
|
1208
|
-
984961486,
|
|
1209
|
-
2747007092,
|
|
1210
|
-
3569037538,
|
|
1211
|
-
1256170817,
|
|
1212
|
-
1037604311,
|
|
1213
|
-
2765210733,
|
|
1214
|
-
3554079995,
|
|
1215
|
-
1131014506,
|
|
1216
|
-
879679996,
|
|
1217
|
-
2909243462,
|
|
1218
|
-
3663771856,
|
|
1219
|
-
1141124467,
|
|
1220
|
-
855842277,
|
|
1221
|
-
2852801631,
|
|
1222
|
-
3708648649,
|
|
1223
|
-
1342533948,
|
|
1224
|
-
654459306,
|
|
1225
|
-
3188396048,
|
|
1226
|
-
3373015174,
|
|
1227
|
-
1466479909,
|
|
1228
|
-
544179635,
|
|
1229
|
-
3110523913,
|
|
1230
|
-
3462522015,
|
|
1231
|
-
1591671054,
|
|
1232
|
-
702138776,
|
|
1233
|
-
2966460450,
|
|
1234
|
-
3352799412,
|
|
1235
|
-
1504918807,
|
|
1236
|
-
783551873,
|
|
1237
|
-
3082640443,
|
|
1238
|
-
3233442989,
|
|
1239
|
-
3988292384,
|
|
1240
|
-
2596254646,
|
|
1241
|
-
62317068,
|
|
1242
|
-
1957810842,
|
|
1243
|
-
3939845945,
|
|
1244
|
-
2647816111,
|
|
1245
|
-
81470997,
|
|
1246
|
-
1943803523,
|
|
1247
|
-
3814918930,
|
|
1248
|
-
2489596804,
|
|
1249
|
-
225274430,
|
|
1250
|
-
2053790376,
|
|
1251
|
-
3826175755,
|
|
1252
|
-
2466906013,
|
|
1253
|
-
167816743,
|
|
1254
|
-
2097651377,
|
|
1255
|
-
4027552580,
|
|
1256
|
-
2265490386,
|
|
1257
|
-
503444072,
|
|
1258
|
-
1762050814,
|
|
1259
|
-
4150417245,
|
|
1260
|
-
2154129355,
|
|
1261
|
-
426522225,
|
|
1262
|
-
1852507879,
|
|
1263
|
-
4275313526,
|
|
1264
|
-
2312317920,
|
|
1265
|
-
282753626,
|
|
1266
|
-
1742555852,
|
|
1267
|
-
4189708143,
|
|
1268
|
-
2394877945,
|
|
1269
|
-
397917763,
|
|
1270
|
-
1622183637,
|
|
1271
|
-
3604390888,
|
|
1272
|
-
2714866558,
|
|
1273
|
-
953729732,
|
|
1274
|
-
1340076626,
|
|
1275
|
-
3518719985,
|
|
1276
|
-
2797360999,
|
|
1277
|
-
1068828381,
|
|
1278
|
-
1219638859,
|
|
1279
|
-
3624741850,
|
|
1280
|
-
2936675148,
|
|
1281
|
-
906185462,
|
|
1282
|
-
1090812512,
|
|
1283
|
-
3747672003,
|
|
1284
|
-
2825379669,
|
|
1285
|
-
829329135,
|
|
1286
|
-
1181335161,
|
|
1287
|
-
3412177804,
|
|
1288
|
-
3160834842,
|
|
1289
|
-
628085408,
|
|
1290
|
-
1382605366,
|
|
1291
|
-
3423369109,
|
|
1292
|
-
3138078467,
|
|
1293
|
-
570562233,
|
|
1294
|
-
1426400815,
|
|
1295
|
-
3317316542,
|
|
1296
|
-
2998733608,
|
|
1297
|
-
733239954,
|
|
1298
|
-
1555261956,
|
|
1299
|
-
3268935591,
|
|
1300
|
-
3050360625,
|
|
1301
|
-
752459403,
|
|
1302
|
-
1541320221,
|
|
1303
|
-
2607071920,
|
|
1304
|
-
3965973030,
|
|
1305
|
-
1969922972,
|
|
1306
|
-
40735498,
|
|
1307
|
-
2617837225,
|
|
1308
|
-
3943577151,
|
|
1309
|
-
1913087877,
|
|
1310
|
-
83908371,
|
|
1311
|
-
2512341634,
|
|
1312
|
-
3803740692,
|
|
1313
|
-
2075208622,
|
|
1314
|
-
213261112,
|
|
1315
|
-
2463272603,
|
|
1316
|
-
3855990285,
|
|
1317
|
-
2094854071,
|
|
1318
|
-
198958881,
|
|
1319
|
-
2262029012,
|
|
1320
|
-
4057260610,
|
|
1321
|
-
1759359992,
|
|
1322
|
-
534414190,
|
|
1323
|
-
2176718541,
|
|
1324
|
-
4139329115,
|
|
1325
|
-
1873836001,
|
|
1326
|
-
414664567,
|
|
1327
|
-
2282248934,
|
|
1328
|
-
4279200368,
|
|
1329
|
-
1711684554,
|
|
1330
|
-
285281116,
|
|
1331
|
-
2405801727,
|
|
1332
|
-
4167216745,
|
|
1333
|
-
1634467795,
|
|
1334
|
-
376229701,
|
|
1335
|
-
2685067896,
|
|
1336
|
-
3608007406,
|
|
1337
|
-
1308918612,
|
|
1338
|
-
956543938,
|
|
1339
|
-
2808555105,
|
|
1340
|
-
3495958263,
|
|
1341
|
-
1231636301,
|
|
1342
|
-
1047427035,
|
|
1343
|
-
2932959818,
|
|
1344
|
-
3654703836,
|
|
1345
|
-
1088359270,
|
|
1346
|
-
936918e3,
|
|
1347
|
-
2847714899,
|
|
1348
|
-
3736837829,
|
|
1349
|
-
1202900863,
|
|
1350
|
-
817233897,
|
|
1351
|
-
3183342108,
|
|
1352
|
-
3401237130,
|
|
1353
|
-
1404277552,
|
|
1354
|
-
615818150,
|
|
1355
|
-
3134207493,
|
|
1356
|
-
3453421203,
|
|
1357
|
-
1423857449,
|
|
1358
|
-
601450431,
|
|
1359
|
-
3009837614,
|
|
1360
|
-
3294710456,
|
|
1361
|
-
1567103746,
|
|
1362
|
-
711928724,
|
|
1363
|
-
3020668471,
|
|
1364
|
-
3272380065,
|
|
1365
|
-
1510334235,
|
|
1366
|
-
755167117
|
|
1367
|
-
];
|
|
1368
|
-
if (typeof Int32Array !== "undefined") {
|
|
1369
|
-
CRC_TABLE = new Int32Array(CRC_TABLE);
|
|
1370
|
-
}
|
|
1371
|
-
function ensureBuffer(input) {
|
|
1372
|
-
if (Buffer2.isBuffer(input)) {
|
|
1373
|
-
return input;
|
|
1374
|
-
}
|
|
1375
|
-
var hasNewBufferAPI = typeof Buffer2.alloc === "function" && typeof Buffer2.from === "function";
|
|
1376
|
-
if (typeof input === "number") {
|
|
1377
|
-
return hasNewBufferAPI ? Buffer2.alloc(input) : new Buffer2(input);
|
|
1378
|
-
} else if (typeof input === "string") {
|
|
1379
|
-
return hasNewBufferAPI ? Buffer2.from(input) : new Buffer2(input);
|
|
1380
|
-
} else {
|
|
1381
|
-
throw new Error("input must be buffer, number, or string, received " + typeof input);
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
function bufferizeInt(num) {
|
|
1385
|
-
var tmp = ensureBuffer(4);
|
|
1386
|
-
tmp.writeInt32BE(num, 0);
|
|
1387
|
-
return tmp;
|
|
1388
|
-
}
|
|
1389
|
-
function _crc32(buf, previous) {
|
|
1390
|
-
buf = ensureBuffer(buf);
|
|
1391
|
-
if (Buffer2.isBuffer(previous)) {
|
|
1392
|
-
previous = previous.readUInt32BE(0);
|
|
1393
|
-
}
|
|
1394
|
-
var crc = ~~previous ^ -1;
|
|
1395
|
-
for (var n = 0; n < buf.length; n++) {
|
|
1396
|
-
crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
|
|
1397
|
-
}
|
|
1398
|
-
return crc ^ -1;
|
|
1399
|
-
}
|
|
1400
|
-
function crc32() {
|
|
1401
|
-
return bufferizeInt(_crc32.apply(null, arguments));
|
|
1402
|
-
}
|
|
1403
|
-
crc32.signed = function() {
|
|
1404
|
-
return _crc32.apply(null, arguments);
|
|
1405
|
-
};
|
|
1406
|
-
crc32.unsigned = function() {
|
|
1407
|
-
return _crc32.apply(null, arguments) >>> 0;
|
|
1408
|
-
};
|
|
1409
|
-
module2.exports = crc32;
|
|
1410
|
-
}
|
|
1411
|
-
});
|
|
1412
|
-
|
|
1413
|
-
// ../../.yarn/cache/yauzl-npm-3.2.0-b1af038bc6-7b40b3dc46.zip/node_modules/yauzl/index.js
|
|
1414
|
-
var require_yauzl = __commonJS({
|
|
1415
|
-
"../../.yarn/cache/yauzl-npm-3.2.0-b1af038bc6-7b40b3dc46.zip/node_modules/yauzl/index.js"(exports2) {
|
|
1416
|
-
"use strict";
|
|
1417
|
-
init_cjs_shims();
|
|
1418
|
-
var fs5 = require("fs");
|
|
1419
|
-
var zlib = require("zlib");
|
|
1420
|
-
var fd_slicer = require_fd_slicer();
|
|
1421
|
-
var crc32 = require_buffer_crc32();
|
|
1422
|
-
var util = require("util");
|
|
1423
|
-
var EventEmitter = require("events").EventEmitter;
|
|
1424
|
-
var Transform = require("stream").Transform;
|
|
1425
|
-
var PassThrough = require("stream").PassThrough;
|
|
1426
|
-
var Writable = require("stream").Writable;
|
|
1427
|
-
exports2.open = open;
|
|
1428
|
-
exports2.fromFd = fromFd;
|
|
1429
|
-
exports2.fromBuffer = fromBuffer;
|
|
1430
|
-
exports2.fromRandomAccessReader = fromRandomAccessReader;
|
|
1431
|
-
exports2.dosDateTimeToDate = dosDateTimeToDate;
|
|
1432
|
-
exports2.getFileNameLowLevel = getFileNameLowLevel;
|
|
1433
|
-
exports2.validateFileName = validateFileName;
|
|
1434
|
-
exports2.parseExtraFields = parseExtraFields;
|
|
1435
|
-
exports2.ZipFile = ZipFile;
|
|
1436
|
-
exports2.Entry = Entry;
|
|
1437
|
-
exports2.LocalFileHeader = LocalFileHeader;
|
|
1438
|
-
exports2.RandomAccessReader = RandomAccessReader;
|
|
1439
|
-
function open(path4, options2, callback) {
|
|
1440
|
-
if (typeof options2 === "function") {
|
|
1441
|
-
callback = options2;
|
|
1442
|
-
options2 = null;
|
|
1443
|
-
}
|
|
1444
|
-
if (options2 == null) options2 = {};
|
|
1445
|
-
if (options2.autoClose == null) options2.autoClose = true;
|
|
1446
|
-
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
1447
|
-
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
1448
|
-
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
1449
|
-
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
1450
|
-
if (callback == null) callback = defaultCallback;
|
|
1451
|
-
fs5.open(path4, "r", function(err, fd) {
|
|
1452
|
-
if (err) return callback(err);
|
|
1453
|
-
fromFd(fd, options2, function(err2, zipfile) {
|
|
1454
|
-
if (err2) fs5.close(fd, defaultCallback);
|
|
1455
|
-
callback(err2, zipfile);
|
|
1456
|
-
});
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1459
|
-
function fromFd(fd, options2, callback) {
|
|
1460
|
-
if (typeof options2 === "function") {
|
|
1461
|
-
callback = options2;
|
|
1462
|
-
options2 = null;
|
|
1463
|
-
}
|
|
1464
|
-
if (options2 == null) options2 = {};
|
|
1465
|
-
if (options2.autoClose == null) options2.autoClose = false;
|
|
1466
|
-
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
1467
|
-
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
1468
|
-
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
1469
|
-
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
1470
|
-
if (callback == null) callback = defaultCallback;
|
|
1471
|
-
fs5.fstat(fd, function(err, stats) {
|
|
1472
|
-
if (err) return callback(err);
|
|
1473
|
-
var reader = fd_slicer.createFromFd(fd, { autoClose: true });
|
|
1474
|
-
fromRandomAccessReader(reader, stats.size, options2, callback);
|
|
1475
|
-
});
|
|
1476
|
-
}
|
|
1477
|
-
function fromBuffer(buffer, options2, callback) {
|
|
1478
|
-
if (typeof options2 === "function") {
|
|
1479
|
-
callback = options2;
|
|
1480
|
-
options2 = null;
|
|
1481
|
-
}
|
|
1482
|
-
if (options2 == null) options2 = {};
|
|
1483
|
-
options2.autoClose = false;
|
|
1484
|
-
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
1485
|
-
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
1486
|
-
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
1487
|
-
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
1488
|
-
var reader = fd_slicer.createFromBuffer(buffer, { maxChunkSize: 65536 });
|
|
1489
|
-
fromRandomAccessReader(reader, buffer.length, options2, callback);
|
|
1490
|
-
}
|
|
1491
|
-
function fromRandomAccessReader(reader, totalSize, options2, callback) {
|
|
1492
|
-
if (typeof options2 === "function") {
|
|
1493
|
-
callback = options2;
|
|
1494
|
-
options2 = null;
|
|
1495
|
-
}
|
|
1496
|
-
if (options2 == null) options2 = {};
|
|
1497
|
-
if (options2.autoClose == null) options2.autoClose = true;
|
|
1498
|
-
if (options2.lazyEntries == null) options2.lazyEntries = false;
|
|
1499
|
-
if (options2.decodeStrings == null) options2.decodeStrings = true;
|
|
1500
|
-
var decodeStrings = !!options2.decodeStrings;
|
|
1501
|
-
if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
|
|
1502
|
-
if (options2.strictFileNames == null) options2.strictFileNames = false;
|
|
1503
|
-
if (callback == null) callback = defaultCallback;
|
|
1504
|
-
if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number");
|
|
1505
|
-
if (totalSize > Number.MAX_SAFE_INTEGER) {
|
|
1506
|
-
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.");
|
|
1507
|
-
}
|
|
1508
|
-
reader.ref();
|
|
1509
|
-
var eocdrWithoutCommentSize = 22;
|
|
1510
|
-
var zip64EocdlSize = 20;
|
|
1511
|
-
var maxCommentSize = 65535;
|
|
1512
|
-
var bufferSize = Math.min(zip64EocdlSize + eocdrWithoutCommentSize + maxCommentSize, totalSize);
|
|
1513
|
-
var buffer = newBuffer(bufferSize);
|
|
1514
|
-
var bufferReadStart = totalSize - buffer.length;
|
|
1515
|
-
readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) {
|
|
1516
|
-
if (err) return callback(err);
|
|
1517
|
-
for (var i = bufferSize - eocdrWithoutCommentSize; i >= 0; i -= 1) {
|
|
1518
|
-
if (buffer.readUInt32LE(i) !== 101010256) continue;
|
|
1519
|
-
var eocdrBuffer = buffer.subarray(i);
|
|
1520
|
-
var diskNumber = eocdrBuffer.readUInt16LE(4);
|
|
1521
|
-
var entryCount = eocdrBuffer.readUInt16LE(10);
|
|
1522
|
-
var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
|
|
1523
|
-
var commentLength = eocdrBuffer.readUInt16LE(20);
|
|
1524
|
-
var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
|
|
1525
|
-
if (commentLength !== expectedCommentLength) {
|
|
1526
|
-
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?"));
|
|
1527
|
-
}
|
|
1528
|
-
var comment = decodeStrings ? decodeBuffer(eocdrBuffer.subarray(22), false) : eocdrBuffer.subarray(22);
|
|
1529
|
-
if (i - zip64EocdlSize >= 0 && buffer.readUInt32LE(i - zip64EocdlSize) === 117853008) {
|
|
1530
|
-
var zip64EocdlBuffer = buffer.subarray(i - zip64EocdlSize, i - zip64EocdlSize + zip64EocdlSize);
|
|
1531
|
-
var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
|
|
1532
|
-
var zip64EocdrBuffer = newBuffer(56);
|
|
1533
|
-
return readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err2) {
|
|
1534
|
-
if (err2) return callback(err2);
|
|
1535
|
-
if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
|
|
1536
|
-
return callback(new Error("invalid zip64 end of central directory record signature"));
|
|
1537
|
-
}
|
|
1538
|
-
diskNumber = zip64EocdrBuffer.readUInt32LE(16);
|
|
1539
|
-
if (diskNumber !== 0) {
|
|
1540
|
-
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
|
|
1541
|
-
}
|
|
1542
|
-
entryCount = readUInt64LE(zip64EocdrBuffer, 32);
|
|
1543
|
-
centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
|
|
1544
|
-
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
|
|
1545
|
-
});
|
|
1546
|
-
}
|
|
1547
|
-
if (diskNumber !== 0) {
|
|
1548
|
-
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
|
|
1549
|
-
}
|
|
1550
|
-
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
|
|
1551
|
-
}
|
|
1552
|
-
callback(new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."));
|
|
1553
|
-
});
|
|
1554
|
-
}
|
|
1555
|
-
util.inherits(ZipFile, EventEmitter);
|
|
1556
|
-
function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
|
|
1557
|
-
var self = this;
|
|
1558
|
-
EventEmitter.call(self);
|
|
1559
|
-
self.reader = reader;
|
|
1560
|
-
self.reader.on("error", function(err) {
|
|
1561
|
-
emitError(self, err);
|
|
1562
|
-
});
|
|
1563
|
-
self.reader.once("close", function() {
|
|
1564
|
-
self.emit("close");
|
|
1565
|
-
});
|
|
1566
|
-
self.readEntryCursor = centralDirectoryOffset;
|
|
1567
|
-
self.fileSize = fileSize;
|
|
1568
|
-
self.entryCount = entryCount;
|
|
1569
|
-
self.comment = comment;
|
|
1570
|
-
self.entriesRead = 0;
|
|
1571
|
-
self.autoClose = !!autoClose;
|
|
1572
|
-
self.lazyEntries = !!lazyEntries;
|
|
1573
|
-
self.decodeStrings = !!decodeStrings;
|
|
1574
|
-
self.validateEntrySizes = !!validateEntrySizes;
|
|
1575
|
-
self.strictFileNames = !!strictFileNames;
|
|
1576
|
-
self.isOpen = true;
|
|
1577
|
-
self.emittedError = false;
|
|
1578
|
-
if (!self.lazyEntries) self._readEntry();
|
|
1579
|
-
}
|
|
1580
|
-
ZipFile.prototype.close = function() {
|
|
1581
|
-
if (!this.isOpen) return;
|
|
1582
|
-
this.isOpen = false;
|
|
1583
|
-
this.reader.unref();
|
|
1584
|
-
};
|
|
1585
|
-
function emitErrorAndAutoClose(self, err) {
|
|
1586
|
-
if (self.autoClose) self.close();
|
|
1587
|
-
emitError(self, err);
|
|
1588
|
-
}
|
|
1589
|
-
function emitError(self, err) {
|
|
1590
|
-
if (self.emittedError) return;
|
|
1591
|
-
self.emittedError = true;
|
|
1592
|
-
self.emit("error", err);
|
|
1593
|
-
}
|
|
1594
|
-
ZipFile.prototype.readEntry = function() {
|
|
1595
|
-
if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true");
|
|
1596
|
-
this._readEntry();
|
|
1597
|
-
};
|
|
1598
|
-
ZipFile.prototype._readEntry = function() {
|
|
1599
|
-
var self = this;
|
|
1600
|
-
if (self.entryCount === self.entriesRead) {
|
|
1601
|
-
setImmediate(function() {
|
|
1602
|
-
if (self.autoClose) self.close();
|
|
1603
|
-
if (self.emittedError) return;
|
|
1604
|
-
self.emit("end");
|
|
1605
|
-
});
|
|
1606
|
-
return;
|
|
1607
|
-
}
|
|
1608
|
-
if (self.emittedError) return;
|
|
1609
|
-
var buffer = newBuffer(46);
|
|
1610
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
|
|
1611
|
-
if (err) return emitErrorAndAutoClose(self, err);
|
|
1612
|
-
if (self.emittedError) return;
|
|
1613
|
-
var entry = new Entry();
|
|
1614
|
-
var signature = buffer.readUInt32LE(0);
|
|
1615
|
-
if (signature !== 33639248) return emitErrorAndAutoClose(self, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
|
|
1616
|
-
entry.versionMadeBy = buffer.readUInt16LE(4);
|
|
1617
|
-
entry.versionNeededToExtract = buffer.readUInt16LE(6);
|
|
1618
|
-
entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
|
|
1619
|
-
entry.compressionMethod = buffer.readUInt16LE(10);
|
|
1620
|
-
entry.lastModFileTime = buffer.readUInt16LE(12);
|
|
1621
|
-
entry.lastModFileDate = buffer.readUInt16LE(14);
|
|
1622
|
-
entry.crc32 = buffer.readUInt32LE(16);
|
|
1623
|
-
entry.compressedSize = buffer.readUInt32LE(20);
|
|
1624
|
-
entry.uncompressedSize = buffer.readUInt32LE(24);
|
|
1625
|
-
entry.fileNameLength = buffer.readUInt16LE(28);
|
|
1626
|
-
entry.extraFieldLength = buffer.readUInt16LE(30);
|
|
1627
|
-
entry.fileCommentLength = buffer.readUInt16LE(32);
|
|
1628
|
-
entry.internalFileAttributes = buffer.readUInt16LE(36);
|
|
1629
|
-
entry.externalFileAttributes = buffer.readUInt32LE(38);
|
|
1630
|
-
entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
|
|
1631
|
-
if (entry.generalPurposeBitFlag & 64) return emitErrorAndAutoClose(self, new Error("strong encryption is not supported"));
|
|
1632
|
-
self.readEntryCursor += 46;
|
|
1633
|
-
buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
|
|
1634
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err2) {
|
|
1635
|
-
if (err2) return emitErrorAndAutoClose(self, err2);
|
|
1636
|
-
if (self.emittedError) return;
|
|
1637
|
-
entry.fileNameRaw = buffer.subarray(0, entry.fileNameLength);
|
|
1638
|
-
var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
|
|
1639
|
-
entry.extraFieldRaw = buffer.subarray(entry.fileNameLength, fileCommentStart);
|
|
1640
|
-
entry.fileCommentRaw = buffer.subarray(fileCommentStart, fileCommentStart + entry.fileCommentLength);
|
|
1641
|
-
try {
|
|
1642
|
-
entry.extraFields = parseExtraFields(entry.extraFieldRaw);
|
|
1643
|
-
} catch (err3) {
|
|
1644
|
-
return emitErrorAndAutoClose(self, err3);
|
|
1645
|
-
}
|
|
1646
|
-
if (self.decodeStrings) {
|
|
1647
|
-
var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
|
|
1648
|
-
entry.fileComment = decodeBuffer(entry.fileCommentRaw, isUtf8);
|
|
1649
|
-
entry.fileName = getFileNameLowLevel(entry.generalPurposeBitFlag, entry.fileNameRaw, entry.extraFields, self.strictFileNames);
|
|
1650
|
-
var errorMessage = validateFileName(entry.fileName);
|
|
1651
|
-
if (errorMessage != null) return emitErrorAndAutoClose(self, new Error(errorMessage));
|
|
1652
|
-
} else {
|
|
1653
|
-
entry.fileComment = entry.fileCommentRaw;
|
|
1654
|
-
entry.fileName = entry.fileNameRaw;
|
|
1655
|
-
}
|
|
1656
|
-
entry.comment = entry.fileComment;
|
|
1657
|
-
self.readEntryCursor += buffer.length;
|
|
1658
|
-
self.entriesRead += 1;
|
|
1659
|
-
for (var i = 0; i < entry.extraFields.length; i++) {
|
|
1660
|
-
var extraField = entry.extraFields[i];
|
|
1661
|
-
if (extraField.id !== 1) continue;
|
|
1662
|
-
var zip64EiefBuffer = extraField.data;
|
|
1663
|
-
var index = 0;
|
|
1664
|
-
if (entry.uncompressedSize === 4294967295) {
|
|
1665
|
-
if (index + 8 > zip64EiefBuffer.length) {
|
|
1666
|
-
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include uncompressed size"));
|
|
1667
|
-
}
|
|
1668
|
-
entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
|
|
1669
|
-
index += 8;
|
|
1670
|
-
}
|
|
1671
|
-
if (entry.compressedSize === 4294967295) {
|
|
1672
|
-
if (index + 8 > zip64EiefBuffer.length) {
|
|
1673
|
-
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include compressed size"));
|
|
1674
|
-
}
|
|
1675
|
-
entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
|
|
1676
|
-
index += 8;
|
|
1677
|
-
}
|
|
1678
|
-
if (entry.relativeOffsetOfLocalHeader === 4294967295) {
|
|
1679
|
-
if (index + 8 > zip64EiefBuffer.length) {
|
|
1680
|
-
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include relative header offset"));
|
|
1681
|
-
}
|
|
1682
|
-
entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
|
|
1683
|
-
index += 8;
|
|
1684
|
-
}
|
|
1685
|
-
break;
|
|
1686
|
-
}
|
|
1687
|
-
if (self.validateEntrySizes && entry.compressionMethod === 0) {
|
|
1688
|
-
var expectedCompressedSize = entry.uncompressedSize;
|
|
1689
|
-
if (entry.isEncrypted()) {
|
|
1690
|
-
expectedCompressedSize += 12;
|
|
1691
|
-
}
|
|
1692
|
-
if (entry.compressedSize !== expectedCompressedSize) {
|
|
1693
|
-
var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
|
|
1694
|
-
return emitErrorAndAutoClose(self, new Error(msg));
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
self.emit("entry", entry);
|
|
1698
|
-
if (!self.lazyEntries) self._readEntry();
|
|
1699
|
-
});
|
|
1700
|
-
});
|
|
1701
|
-
};
|
|
1702
|
-
ZipFile.prototype.openReadStream = function(entry, options2, callback) {
|
|
1703
|
-
var self = this;
|
|
1704
|
-
var relativeStart = 0;
|
|
1705
|
-
var relativeEnd = entry.compressedSize;
|
|
1706
|
-
if (callback == null) {
|
|
1707
|
-
callback = options2;
|
|
1708
|
-
options2 = null;
|
|
1709
|
-
}
|
|
1710
|
-
if (options2 == null) {
|
|
1711
|
-
options2 = {};
|
|
1712
|
-
} else {
|
|
1713
|
-
if (options2.decrypt != null) {
|
|
1714
|
-
if (!entry.isEncrypted()) {
|
|
1715
|
-
throw new Error("options.decrypt can only be specified for encrypted entries");
|
|
1716
|
-
}
|
|
1717
|
-
if (options2.decrypt !== false) throw new Error("invalid options.decrypt value: " + options2.decrypt);
|
|
1718
|
-
if (entry.isCompressed()) {
|
|
1719
|
-
if (options2.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false");
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
if (options2.decompress != null) {
|
|
1723
|
-
if (!entry.isCompressed()) {
|
|
1724
|
-
throw new Error("options.decompress can only be specified for compressed entries");
|
|
1725
|
-
}
|
|
1726
|
-
if (!(options2.decompress === false || options2.decompress === true)) {
|
|
1727
|
-
throw new Error("invalid options.decompress value: " + options2.decompress);
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
if (options2.start != null || options2.end != null) {
|
|
1731
|
-
if (entry.isCompressed() && options2.decompress !== false) {
|
|
1732
|
-
throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
|
|
1733
|
-
}
|
|
1734
|
-
if (entry.isEncrypted() && options2.decrypt !== false) {
|
|
1735
|
-
throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
if (options2.start != null) {
|
|
1739
|
-
relativeStart = options2.start;
|
|
1740
|
-
if (relativeStart < 0) throw new Error("options.start < 0");
|
|
1741
|
-
if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize");
|
|
1742
|
-
}
|
|
1743
|
-
if (options2.end != null) {
|
|
1744
|
-
relativeEnd = options2.end;
|
|
1745
|
-
if (relativeEnd < 0) throw new Error("options.end < 0");
|
|
1746
|
-
if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize");
|
|
1747
|
-
if (relativeEnd < relativeStart) throw new Error("options.end < options.start");
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
if (!self.isOpen) return callback(new Error("closed"));
|
|
1751
|
-
if (entry.isEncrypted()) {
|
|
1752
|
-
if (options2.decrypt !== false) return callback(new Error("entry is encrypted, and options.decrypt !== false"));
|
|
1753
|
-
}
|
|
1754
|
-
var decompress;
|
|
1755
|
-
if (entry.compressionMethod === 0) {
|
|
1756
|
-
decompress = false;
|
|
1757
|
-
} else if (entry.compressionMethod === 8) {
|
|
1758
|
-
decompress = options2.decompress != null ? options2.decompress : true;
|
|
1759
|
-
} else {
|
|
1760
|
-
return callback(new Error("unsupported compression method: " + entry.compressionMethod));
|
|
1761
|
-
}
|
|
1762
|
-
self.readLocalFileHeader(entry, { minimal: true }, function(err, localFileHeader) {
|
|
1763
|
-
if (err) return callback(err);
|
|
1764
|
-
self.openReadStreamLowLevel(
|
|
1765
|
-
localFileHeader.fileDataStart,
|
|
1766
|
-
entry.compressedSize,
|
|
1767
|
-
relativeStart,
|
|
1768
|
-
relativeEnd,
|
|
1769
|
-
decompress,
|
|
1770
|
-
entry.uncompressedSize,
|
|
1771
|
-
callback
|
|
1772
|
-
);
|
|
1773
|
-
});
|
|
1774
|
-
};
|
|
1775
|
-
ZipFile.prototype.openReadStreamLowLevel = function(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize, callback) {
|
|
1776
|
-
var self = this;
|
|
1777
|
-
var fileDataEnd = fileDataStart + compressedSize;
|
|
1778
|
-
var readStream = self.reader.createReadStream({
|
|
1779
|
-
start: fileDataStart + relativeStart,
|
|
1780
|
-
end: fileDataStart + relativeEnd
|
|
1781
|
-
});
|
|
1782
|
-
var endpointStream = readStream;
|
|
1783
|
-
if (decompress) {
|
|
1784
|
-
var destroyed = false;
|
|
1785
|
-
var inflateFilter = zlib.createInflateRaw();
|
|
1786
|
-
readStream.on("error", function(err) {
|
|
1787
|
-
setImmediate(function() {
|
|
1788
|
-
if (!destroyed) inflateFilter.emit("error", err);
|
|
1789
|
-
});
|
|
1790
|
-
});
|
|
1791
|
-
readStream.pipe(inflateFilter);
|
|
1792
|
-
if (self.validateEntrySizes) {
|
|
1793
|
-
endpointStream = new AssertByteCountStream(uncompressedSize);
|
|
1794
|
-
inflateFilter.on("error", function(err) {
|
|
1795
|
-
setImmediate(function() {
|
|
1796
|
-
if (!destroyed) endpointStream.emit("error", err);
|
|
1797
|
-
});
|
|
1798
|
-
});
|
|
1799
|
-
inflateFilter.pipe(endpointStream);
|
|
1800
|
-
} else {
|
|
1801
|
-
endpointStream = inflateFilter;
|
|
1802
|
-
}
|
|
1803
|
-
installDestroyFn(endpointStream, function() {
|
|
1804
|
-
destroyed = true;
|
|
1805
|
-
if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream);
|
|
1806
|
-
readStream.unpipe(inflateFilter);
|
|
1807
|
-
readStream.destroy();
|
|
1808
|
-
});
|
|
1809
|
-
}
|
|
1810
|
-
callback(null, endpointStream);
|
|
1811
|
-
};
|
|
1812
|
-
ZipFile.prototype.readLocalFileHeader = function(entry, options2, callback) {
|
|
1813
|
-
var self = this;
|
|
1814
|
-
if (callback == null) {
|
|
1815
|
-
callback = options2;
|
|
1816
|
-
options2 = null;
|
|
1817
|
-
}
|
|
1818
|
-
if (options2 == null) options2 = {};
|
|
1819
|
-
self.reader.ref();
|
|
1820
|
-
var buffer = newBuffer(30);
|
|
1821
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
|
|
1822
|
-
try {
|
|
1823
|
-
if (err) return callback(err);
|
|
1824
|
-
var signature = buffer.readUInt32LE(0);
|
|
1825
|
-
if (signature !== 67324752) {
|
|
1826
|
-
return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
|
|
1827
|
-
}
|
|
1828
|
-
var fileNameLength = buffer.readUInt16LE(26);
|
|
1829
|
-
var extraFieldLength = buffer.readUInt16LE(28);
|
|
1830
|
-
var fileDataStart = entry.relativeOffsetOfLocalHeader + 30 + fileNameLength + extraFieldLength;
|
|
1831
|
-
if (fileDataStart + entry.compressedSize > self.fileSize) {
|
|
1832
|
-
return callback(new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize));
|
|
1833
|
-
}
|
|
1834
|
-
if (options2.minimal) {
|
|
1835
|
-
return callback(null, { fileDataStart });
|
|
1836
|
-
}
|
|
1837
|
-
var localFileHeader = new LocalFileHeader();
|
|
1838
|
-
localFileHeader.fileDataStart = fileDataStart;
|
|
1839
|
-
localFileHeader.versionNeededToExtract = buffer.readUInt16LE(4);
|
|
1840
|
-
localFileHeader.generalPurposeBitFlag = buffer.readUInt16LE(6);
|
|
1841
|
-
localFileHeader.compressionMethod = buffer.readUInt16LE(8);
|
|
1842
|
-
localFileHeader.lastModFileTime = buffer.readUInt16LE(10);
|
|
1843
|
-
localFileHeader.lastModFileDate = buffer.readUInt16LE(12);
|
|
1844
|
-
localFileHeader.crc32 = buffer.readUInt32LE(14);
|
|
1845
|
-
localFileHeader.compressedSize = buffer.readUInt32LE(18);
|
|
1846
|
-
localFileHeader.uncompressedSize = buffer.readUInt32LE(22);
|
|
1847
|
-
localFileHeader.fileNameLength = fileNameLength;
|
|
1848
|
-
localFileHeader.extraFieldLength = extraFieldLength;
|
|
1849
|
-
buffer = newBuffer(fileNameLength + extraFieldLength);
|
|
1850
|
-
self.reader.ref();
|
|
1851
|
-
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader + 30, function(err2) {
|
|
1852
|
-
try {
|
|
1853
|
-
if (err2) return callback(err2);
|
|
1854
|
-
localFileHeader.fileName = buffer.subarray(0, fileNameLength);
|
|
1855
|
-
localFileHeader.extraField = buffer.subarray(fileNameLength);
|
|
1856
|
-
return callback(null, localFileHeader);
|
|
1857
|
-
} finally {
|
|
1858
|
-
self.reader.unref();
|
|
1859
|
-
}
|
|
1860
|
-
});
|
|
1861
|
-
} finally {
|
|
1862
|
-
self.reader.unref();
|
|
1863
|
-
}
|
|
1864
|
-
});
|
|
1865
|
-
};
|
|
1866
|
-
function Entry() {
|
|
1867
|
-
}
|
|
1868
|
-
Entry.prototype.getLastModDate = function(options2) {
|
|
1869
|
-
if (options2 == null) options2 = {};
|
|
1870
|
-
if (!options2.forceDosFormat) {
|
|
1871
|
-
for (var i = 0; i < this.extraFields.length; i++) {
|
|
1872
|
-
var extraField = this.extraFields[i];
|
|
1873
|
-
if (extraField.id === 21589) {
|
|
1874
|
-
var data = extraField.data;
|
|
1875
|
-
if (data.length < 5) continue;
|
|
1876
|
-
var flags = data[0];
|
|
1877
|
-
var HAS_MTIME = 1;
|
|
1878
|
-
if (!(flags & HAS_MTIME)) continue;
|
|
1879
|
-
var posixTimestamp = data.readInt32LE(1);
|
|
1880
|
-
return new Date(posixTimestamp * 1e3);
|
|
1881
|
-
} else if (extraField.id === 10) {
|
|
1882
|
-
var data = extraField.data;
|
|
1883
|
-
var cursor = 4;
|
|
1884
|
-
while (cursor < data.length + 4) {
|
|
1885
|
-
var tag = data.readUInt16LE(cursor);
|
|
1886
|
-
cursor += 2;
|
|
1887
|
-
var size = data.readUInt16LE(cursor);
|
|
1888
|
-
cursor += 2;
|
|
1889
|
-
if (tag !== 1) {
|
|
1890
|
-
cursor += size;
|
|
1891
|
-
continue;
|
|
1892
|
-
}
|
|
1893
|
-
if (size < 8 || cursor + size > data.length) break;
|
|
1894
|
-
var hundredNanoSecondsSince1601 = 4294967296 * data.readInt32LE(cursor + 4) + data.readUInt32LE(cursor);
|
|
1895
|
-
var millisecondsSince1970 = hundredNanoSecondsSince1601 / 1e4 - 116444736e5;
|
|
1896
|
-
return new Date(millisecondsSince1970);
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime, options2.timezone);
|
|
1902
|
-
};
|
|
1903
|
-
Entry.prototype.isEncrypted = function() {
|
|
1904
|
-
return (this.generalPurposeBitFlag & 1) !== 0;
|
|
1905
|
-
};
|
|
1906
|
-
Entry.prototype.isCompressed = function() {
|
|
1907
|
-
return this.compressionMethod === 8;
|
|
1908
|
-
};
|
|
1909
|
-
function LocalFileHeader() {
|
|
1910
|
-
}
|
|
1911
|
-
function dosDateTimeToDate(date, time, timezone) {
|
|
1912
|
-
var day = date & 31;
|
|
1913
|
-
var month = (date >> 5 & 15) - 1;
|
|
1914
|
-
var year = (date >> 9 & 127) + 1980;
|
|
1915
|
-
var millisecond = 0;
|
|
1916
|
-
var second = (time & 31) * 2;
|
|
1917
|
-
var minute = time >> 5 & 63;
|
|
1918
|
-
var hour = time >> 11 & 31;
|
|
1919
|
-
if (timezone == null || timezone === "local") {
|
|
1920
|
-
return new Date(year, month, day, hour, minute, second, millisecond);
|
|
1921
|
-
} else if (timezone === "UTC") {
|
|
1922
|
-
return new Date(Date.UTC(year, month, day, hour, minute, second, millisecond));
|
|
1923
|
-
} else {
|
|
1924
|
-
throw new Error("unrecognized options.timezone: " + options.timezone);
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
function getFileNameLowLevel(generalPurposeBitFlag, fileNameBuffer, extraFields, strictFileNames) {
|
|
1928
|
-
var fileName = null;
|
|
1929
|
-
for (var i = 0; i < extraFields.length; i++) {
|
|
1930
|
-
var extraField = extraFields[i];
|
|
1931
|
-
if (extraField.id === 28789) {
|
|
1932
|
-
if (extraField.data.length < 6) {
|
|
1933
|
-
continue;
|
|
1934
|
-
}
|
|
1935
|
-
if (extraField.data.readUInt8(0) !== 1) {
|
|
1936
|
-
continue;
|
|
1937
|
-
}
|
|
1938
|
-
var oldNameCrc32 = extraField.data.readUInt32LE(1);
|
|
1939
|
-
if (crc32.unsigned(fileNameBuffer) !== oldNameCrc32) {
|
|
1940
|
-
continue;
|
|
1941
|
-
}
|
|
1942
|
-
fileName = decodeBuffer(extraField.data.subarray(5), true);
|
|
1943
|
-
break;
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
if (fileName == null) {
|
|
1947
|
-
var isUtf8 = (generalPurposeBitFlag & 2048) !== 0;
|
|
1948
|
-
fileName = decodeBuffer(fileNameBuffer, isUtf8);
|
|
1949
|
-
}
|
|
1950
|
-
if (!strictFileNames) {
|
|
1951
|
-
fileName = fileName.replace(/\\/g, "/");
|
|
1952
|
-
}
|
|
1953
|
-
return fileName;
|
|
1954
|
-
}
|
|
1955
|
-
function validateFileName(fileName) {
|
|
1956
|
-
if (fileName.indexOf("\\") !== -1) {
|
|
1957
|
-
return "invalid characters in fileName: " + fileName;
|
|
1958
|
-
}
|
|
1959
|
-
if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
|
|
1960
|
-
return "absolute path: " + fileName;
|
|
1961
|
-
}
|
|
1962
|
-
if (fileName.split("/").indexOf("..") !== -1) {
|
|
1963
|
-
return "invalid relative path: " + fileName;
|
|
1964
|
-
}
|
|
1965
|
-
return null;
|
|
1966
|
-
}
|
|
1967
|
-
function parseExtraFields(extraFieldBuffer) {
|
|
1968
|
-
var extraFields = [];
|
|
1969
|
-
var i = 0;
|
|
1970
|
-
while (i < extraFieldBuffer.length - 3) {
|
|
1971
|
-
var headerId = extraFieldBuffer.readUInt16LE(i + 0);
|
|
1972
|
-
var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
|
|
1973
|
-
var dataStart = i + 4;
|
|
1974
|
-
var dataEnd = dataStart + dataSize;
|
|
1975
|
-
if (dataEnd > extraFieldBuffer.length) throw new Error("extra field length exceeds extra field buffer size");
|
|
1976
|
-
var dataBuffer = extraFieldBuffer.subarray(dataStart, dataEnd);
|
|
1977
|
-
extraFields.push({
|
|
1978
|
-
id: headerId,
|
|
1979
|
-
data: dataBuffer
|
|
1980
|
-
});
|
|
1981
|
-
i = dataEnd;
|
|
1982
|
-
}
|
|
1983
|
-
return extraFields;
|
|
1984
|
-
}
|
|
1985
|
-
function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
|
|
1986
|
-
if (length === 0) {
|
|
1987
|
-
return setImmediate(function() {
|
|
1988
|
-
callback(null, newBuffer(0));
|
|
1989
|
-
});
|
|
1990
|
-
}
|
|
1991
|
-
reader.read(buffer, offset, length, position, function(err, bytesRead) {
|
|
1992
|
-
if (err) return callback(err);
|
|
1993
|
-
if (bytesRead < length) {
|
|
1994
|
-
return callback(new Error("unexpected EOF"));
|
|
1995
|
-
}
|
|
1996
|
-
callback();
|
|
1997
|
-
});
|
|
1998
|
-
}
|
|
1999
|
-
util.inherits(AssertByteCountStream, Transform);
|
|
2000
|
-
function AssertByteCountStream(byteCount) {
|
|
2001
|
-
Transform.call(this);
|
|
2002
|
-
this.actualByteCount = 0;
|
|
2003
|
-
this.expectedByteCount = byteCount;
|
|
2004
|
-
}
|
|
2005
|
-
AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
|
|
2006
|
-
this.actualByteCount += chunk.length;
|
|
2007
|
-
if (this.actualByteCount > this.expectedByteCount) {
|
|
2008
|
-
var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
|
|
2009
|
-
return cb(new Error(msg));
|
|
2010
|
-
}
|
|
2011
|
-
cb(null, chunk);
|
|
2012
|
-
};
|
|
2013
|
-
AssertByteCountStream.prototype._flush = function(cb) {
|
|
2014
|
-
if (this.actualByteCount < this.expectedByteCount) {
|
|
2015
|
-
var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
|
|
2016
|
-
return cb(new Error(msg));
|
|
2017
|
-
}
|
|
2018
|
-
cb();
|
|
2019
|
-
};
|
|
2020
|
-
util.inherits(RandomAccessReader, EventEmitter);
|
|
2021
|
-
function RandomAccessReader() {
|
|
2022
|
-
EventEmitter.call(this);
|
|
2023
|
-
this.refCount = 0;
|
|
2024
|
-
}
|
|
2025
|
-
RandomAccessReader.prototype.ref = function() {
|
|
2026
|
-
this.refCount += 1;
|
|
2027
|
-
};
|
|
2028
|
-
RandomAccessReader.prototype.unref = function() {
|
|
2029
|
-
var self = this;
|
|
2030
|
-
self.refCount -= 1;
|
|
2031
|
-
if (self.refCount > 0) return;
|
|
2032
|
-
if (self.refCount < 0) throw new Error("invalid unref");
|
|
2033
|
-
self.close(onCloseDone);
|
|
2034
|
-
function onCloseDone(err) {
|
|
2035
|
-
if (err) return self.emit("error", err);
|
|
2036
|
-
self.emit("close");
|
|
2037
|
-
}
|
|
2038
|
-
};
|
|
2039
|
-
RandomAccessReader.prototype.createReadStream = function(options2) {
|
|
2040
|
-
if (options2 == null) options2 = {};
|
|
2041
|
-
var start = options2.start;
|
|
2042
|
-
var end = options2.end;
|
|
2043
|
-
if (start === end) {
|
|
2044
|
-
var emptyStream = new PassThrough();
|
|
2045
|
-
setImmediate(function() {
|
|
2046
|
-
emptyStream.end();
|
|
2047
|
-
});
|
|
2048
|
-
return emptyStream;
|
|
2049
|
-
}
|
|
2050
|
-
var stream = this._readStreamForRange(start, end);
|
|
2051
|
-
var destroyed = false;
|
|
2052
|
-
var refUnrefFilter = new RefUnrefFilter(this);
|
|
2053
|
-
stream.on("error", function(err) {
|
|
2054
|
-
setImmediate(function() {
|
|
2055
|
-
if (!destroyed) refUnrefFilter.emit("error", err);
|
|
2056
|
-
});
|
|
2057
|
-
});
|
|
2058
|
-
installDestroyFn(refUnrefFilter, function() {
|
|
2059
|
-
stream.unpipe(refUnrefFilter);
|
|
2060
|
-
refUnrefFilter.unref();
|
|
2061
|
-
stream.destroy();
|
|
2062
|
-
});
|
|
2063
|
-
var byteCounter = new AssertByteCountStream(end - start);
|
|
2064
|
-
refUnrefFilter.on("error", function(err) {
|
|
2065
|
-
setImmediate(function() {
|
|
2066
|
-
if (!destroyed) byteCounter.emit("error", err);
|
|
2067
|
-
});
|
|
2068
|
-
});
|
|
2069
|
-
installDestroyFn(byteCounter, function() {
|
|
2070
|
-
destroyed = true;
|
|
2071
|
-
refUnrefFilter.unpipe(byteCounter);
|
|
2072
|
-
refUnrefFilter.destroy();
|
|
2073
|
-
});
|
|
2074
|
-
return stream.pipe(refUnrefFilter).pipe(byteCounter);
|
|
2075
|
-
};
|
|
2076
|
-
RandomAccessReader.prototype._readStreamForRange = function(start, end) {
|
|
2077
|
-
throw new Error("not implemented");
|
|
2078
|
-
};
|
|
2079
|
-
RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
|
|
2080
|
-
var readStream = this.createReadStream({ start: position, end: position + length });
|
|
2081
|
-
var writeStream = new Writable();
|
|
2082
|
-
var written = 0;
|
|
2083
|
-
writeStream._write = function(chunk, encoding, cb) {
|
|
2084
|
-
chunk.copy(buffer, offset + written, 0, chunk.length);
|
|
2085
|
-
written += chunk.length;
|
|
2086
|
-
cb();
|
|
2087
|
-
};
|
|
2088
|
-
writeStream.on("finish", callback);
|
|
2089
|
-
readStream.on("error", function(error) {
|
|
2090
|
-
callback(error);
|
|
2091
|
-
});
|
|
2092
|
-
readStream.pipe(writeStream);
|
|
2093
|
-
};
|
|
2094
|
-
RandomAccessReader.prototype.close = function(callback) {
|
|
2095
|
-
setImmediate(callback);
|
|
2096
|
-
};
|
|
2097
|
-
util.inherits(RefUnrefFilter, PassThrough);
|
|
2098
|
-
function RefUnrefFilter(context) {
|
|
2099
|
-
PassThrough.call(this);
|
|
2100
|
-
this.context = context;
|
|
2101
|
-
this.context.ref();
|
|
2102
|
-
this.unreffedYet = false;
|
|
2103
|
-
}
|
|
2104
|
-
RefUnrefFilter.prototype._flush = function(cb) {
|
|
2105
|
-
this.unref();
|
|
2106
|
-
cb();
|
|
2107
|
-
};
|
|
2108
|
-
RefUnrefFilter.prototype.unref = function(cb) {
|
|
2109
|
-
if (this.unreffedYet) return;
|
|
2110
|
-
this.unreffedYet = true;
|
|
2111
|
-
this.context.unref();
|
|
2112
|
-
};
|
|
2113
|
-
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";
|
|
2114
|
-
function decodeBuffer(buffer, isUtf8) {
|
|
2115
|
-
if (isUtf8) {
|
|
2116
|
-
return buffer.toString("utf8");
|
|
2117
|
-
} else {
|
|
2118
|
-
var result = "";
|
|
2119
|
-
for (var i = 0; i < buffer.length; i++) {
|
|
2120
|
-
result += cp437[buffer[i]];
|
|
2121
|
-
}
|
|
2122
|
-
return result;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
function readUInt64LE(buffer, offset) {
|
|
2126
|
-
var lower32 = buffer.readUInt32LE(offset);
|
|
2127
|
-
var upper32 = buffer.readUInt32LE(offset + 4);
|
|
2128
|
-
return upper32 * 4294967296 + lower32;
|
|
2129
|
-
}
|
|
2130
|
-
var newBuffer;
|
|
2131
|
-
if (typeof Buffer.allocUnsafe === "function") {
|
|
2132
|
-
newBuffer = function(len) {
|
|
2133
|
-
return Buffer.allocUnsafe(len);
|
|
2134
|
-
};
|
|
2135
|
-
} else {
|
|
2136
|
-
newBuffer = function(len) {
|
|
2137
|
-
return new Buffer(len);
|
|
2138
|
-
};
|
|
2139
|
-
}
|
|
2140
|
-
function installDestroyFn(stream, fn) {
|
|
2141
|
-
if (typeof stream.destroy === "function") {
|
|
2142
|
-
stream._destroy = function(err, cb) {
|
|
2143
|
-
fn();
|
|
2144
|
-
if (cb != null) cb(err);
|
|
2145
|
-
};
|
|
2146
|
-
} else {
|
|
2147
|
-
stream.destroy = fn;
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
function defaultCallback(err) {
|
|
2151
|
-
if (err) throw err;
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
});
|
|
2155
|
-
|
|
2156
775
|
// src/index.ts
|
|
2157
776
|
var src_exports = {};
|
|
2158
777
|
__export(src_exports, {
|
|
@@ -2165,9 +784,10 @@ var import_clipanion3 = require("clipanion");
|
|
|
2165
784
|
// src/DeployCommand.ts
|
|
2166
785
|
init_cjs_shims();
|
|
2167
786
|
var import_assert = __toESM(require("assert"), 1);
|
|
2168
|
-
var
|
|
2169
|
-
var
|
|
787
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
788
|
+
var import_path = __toESM(require("path"), 1);
|
|
2170
789
|
var p = __toESM(require("@clack/prompts"), 1);
|
|
790
|
+
var import_utils = require("@react-native-bedrock/utils");
|
|
2171
791
|
var import_clipanion = require("clipanion");
|
|
2172
792
|
var import_debug2 = __toESM(require_src(), 1);
|
|
2173
793
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -2177,62 +797,9 @@ init_cjs_shims();
|
|
|
2177
797
|
var APP_MANIFEST_NAME = "app.json";
|
|
2178
798
|
var DEFAULT_API_BASE_URL = "https://apps-in-toss.toss.im/console";
|
|
2179
799
|
|
|
2180
|
-
// src/utils/getPackageRoot.ts
|
|
2181
|
-
init_cjs_shims();
|
|
2182
|
-
var import_fs = __toESM(require("fs"), 1);
|
|
2183
|
-
var import_path = __toESM(require("path"), 1);
|
|
2184
|
-
function getPackageRoot() {
|
|
2185
|
-
let cwd = process.cwd();
|
|
2186
|
-
const root = import_path.default.parse(cwd).root;
|
|
2187
|
-
while (cwd !== root) {
|
|
2188
|
-
if (import_fs.default.existsSync(import_path.default.join(cwd, "package.json"))) {
|
|
2189
|
-
return cwd;
|
|
2190
|
-
}
|
|
2191
|
-
cwd = import_path.default.dirname(cwd);
|
|
2192
|
-
}
|
|
2193
|
-
return cwd;
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
|
-
// src/utils/readZipContent.ts
|
|
2197
|
-
init_cjs_shims();
|
|
2198
|
-
var import_yauzl = __toESM(require_yauzl(), 1);
|
|
2199
|
-
function readZipContent(zipPath, fileName) {
|
|
2200
|
-
return new Promise((resolve, reject) => {
|
|
2201
|
-
import_yauzl.default.open(zipPath, { lazyEntries: true }, (error, zipFile) => {
|
|
2202
|
-
if (error) {
|
|
2203
|
-
reject(error);
|
|
2204
|
-
return;
|
|
2205
|
-
}
|
|
2206
|
-
zipFile.on("entry", (entry) => {
|
|
2207
|
-
if (entry.fileName === fileName) {
|
|
2208
|
-
zipFile.openReadStream(entry, (error2, readStream) => {
|
|
2209
|
-
if (error2) {
|
|
2210
|
-
throw error2;
|
|
2211
|
-
}
|
|
2212
|
-
let fileData = "";
|
|
2213
|
-
readStream.on("data", (chunk) => fileData += chunk.toString("utf8")).on("end", () => {
|
|
2214
|
-
zipFile.close();
|
|
2215
|
-
resolve(fileData);
|
|
2216
|
-
});
|
|
2217
|
-
});
|
|
2218
|
-
} else {
|
|
2219
|
-
zipFile.readEntry();
|
|
2220
|
-
}
|
|
2221
|
-
}).on("end", () => {
|
|
2222
|
-
zipFile.close();
|
|
2223
|
-
reject(new Error(`'${fileName}' not found in zip file`));
|
|
2224
|
-
}).on("error", (error2) => {
|
|
2225
|
-
zipFile.close();
|
|
2226
|
-
reject(error2);
|
|
2227
|
-
});
|
|
2228
|
-
zipFile.readEntry();
|
|
2229
|
-
});
|
|
2230
|
-
});
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
800
|
// src/utils/upload.ts
|
|
2234
801
|
init_cjs_shims();
|
|
2235
|
-
var
|
|
802
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
2236
803
|
var import_debug = __toESM(require_src(), 1);
|
|
2237
804
|
var debug = (0, import_debug.default)("cli:deploy");
|
|
2238
805
|
async function uploadArtifact(config) {
|
|
@@ -2246,7 +813,7 @@ async function uploadArtifact(config) {
|
|
|
2246
813
|
"Content-Type": "application/octet-stream",
|
|
2247
814
|
"X-Ait-Console-Api-Key": config.apiKey
|
|
2248
815
|
},
|
|
2249
|
-
body:
|
|
816
|
+
body: import_fs.default.createReadStream(config.artifactPath),
|
|
2250
817
|
duplex: "half"
|
|
2251
818
|
}
|
|
2252
819
|
);
|
|
@@ -2292,13 +859,13 @@ var DeployCommand = class extends import_clipanion.Command {
|
|
|
2292
859
|
return;
|
|
2293
860
|
}
|
|
2294
861
|
try {
|
|
2295
|
-
const packageRoot = getPackageRoot();
|
|
2296
|
-
const artifactFile =
|
|
862
|
+
const packageRoot = (0, import_utils.getPackageRoot)();
|
|
863
|
+
const artifactFile = import_fs2.default.readdirSync(packageRoot).find((file) => file.endsWith(".ait"));
|
|
2297
864
|
if (!artifactFile) {
|
|
2298
865
|
throw new Error("\uBC30\uD3EC\uD560 .ait \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
2299
866
|
}
|
|
2300
|
-
const resolvedArtifactPath =
|
|
2301
|
-
const { appName, deploymentId } = await readZipContent(resolvedArtifactPath, APP_MANIFEST_NAME).then((rawAppManifest) => {
|
|
867
|
+
const resolvedArtifactPath = import_path.default.resolve(packageRoot, artifactFile);
|
|
868
|
+
const { appName, deploymentId } = await (0, import_utils.readZipContent)(resolvedArtifactPath, APP_MANIFEST_NAME).then((rawAppManifest) => {
|
|
2302
869
|
const appManifest = JSON.parse(rawAppManifest);
|
|
2303
870
|
const appName2 = appManifest.appName;
|
|
2304
871
|
const deploymentId2 = appManifest._metadata.deploymentId;
|
|
@@ -2339,9 +906,10 @@ var DeployCommand = class extends import_clipanion.Command {
|
|
|
2339
906
|
|
|
2340
907
|
// src/InitCommand.ts
|
|
2341
908
|
init_cjs_shims();
|
|
2342
|
-
var
|
|
2343
|
-
var
|
|
909
|
+
var import_fs3 = __toESM(require("fs"), 1);
|
|
910
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
2344
911
|
var p2 = __toESM(require("@clack/prompts"), 1);
|
|
912
|
+
var import_utils2 = require("@react-native-bedrock/utils");
|
|
2345
913
|
var import_clipanion2 = require("clipanion");
|
|
2346
914
|
|
|
2347
915
|
// ../../.yarn/cache/es-toolkit-npm-1.32.0-019fc7c155-56ba965570.zip/node_modules/es-toolkit/dist/index.mjs
|
|
@@ -2440,7 +1008,7 @@ function transformTemplate(templateString, values) {
|
|
|
2440
1008
|
|
|
2441
1009
|
// src/InitCommand.ts
|
|
2442
1010
|
async function templateWebFramework({ appName, cwd, skipInput }) {
|
|
2443
|
-
const packageJson = await
|
|
1011
|
+
const packageJson = await import_fs3.default.promises.readFile(import_path2.default.join(cwd, "package.json"), {
|
|
2444
1012
|
encoding: "utf-8"
|
|
2445
1013
|
});
|
|
2446
1014
|
const scripts = JSON.parse(packageJson);
|
|
@@ -2451,11 +1019,11 @@ async function templateWebFramework({ appName, cwd, skipInput }) {
|
|
|
2451
1019
|
scripts.scripts.dev = "bedrock dev";
|
|
2452
1020
|
scripts.scripts.build = "bedrock build";
|
|
2453
1021
|
scripts.scripts.deploy = "ait deploy";
|
|
2454
|
-
await
|
|
1022
|
+
await import_fs3.default.promises.writeFile(import_path2.default.join(cwd, "package.json"), JSON.stringify(scripts, null, 2), {
|
|
2455
1023
|
encoding: "utf-8"
|
|
2456
1024
|
});
|
|
2457
1025
|
p2.log.step(".gitignore \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
|
|
2458
|
-
await
|
|
1026
|
+
await import_fs3.default.promises.appendFile(import_path2.default.join(cwd, ".gitignore"), "\n.bedrock\n");
|
|
2459
1027
|
const placeholder = {
|
|
2460
1028
|
dev: originalScripts.dev === "bedrock dev" ? "" : originalScripts.dev,
|
|
2461
1029
|
build: originalScripts.build === "bedrock build" ? "" : originalScripts.build
|
|
@@ -2495,7 +1063,7 @@ async function templateWebFramework({ appName, cwd, skipInput }) {
|
|
|
2495
1063
|
webDevCommand: scriptInputs.dev === "bedrock dev" ? "" : scriptInputs.dev,
|
|
2496
1064
|
webBuildCommand: scriptInputs.build === "bedrock build" ? "" : scriptInputs.build
|
|
2497
1065
|
});
|
|
2498
|
-
await
|
|
1066
|
+
await import_fs3.default.promises.writeFile(import_path2.default.join(cwd, "bedrock.config.ts"), config, {
|
|
2499
1067
|
encoding: "utf-8"
|
|
2500
1068
|
});
|
|
2501
1069
|
}
|
|
@@ -2504,11 +1072,11 @@ async function templateReactNative({ appName, cwd }) {
|
|
|
2504
1072
|
const config = transformTemplate(REACT_NATIVE_FRAMEWORK_CONFIG_TEMPLATE, {
|
|
2505
1073
|
appName
|
|
2506
1074
|
});
|
|
2507
|
-
await
|
|
1075
|
+
await import_fs3.default.promises.writeFile(import_path2.default.join(cwd, "bedrock.config.ts"), config, {
|
|
2508
1076
|
encoding: "utf-8"
|
|
2509
1077
|
});
|
|
2510
1078
|
p2.log.step("src/_app.tsx \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
|
|
2511
|
-
await
|
|
1079
|
+
await import_fs3.default.promises.writeFile(import_path2.default.join(cwd, "src", "_app.tsx"), APP_TEMPLATE, {
|
|
2512
1080
|
encoding: "utf-8"
|
|
2513
1081
|
});
|
|
2514
1082
|
}
|
|
@@ -2539,7 +1107,7 @@ var InitCommand = class extends import_clipanion2.Command {
|
|
|
2539
1107
|
if (p2.isCancel(template)) {
|
|
2540
1108
|
process.exit(0);
|
|
2541
1109
|
}
|
|
2542
|
-
const cwd = getPackageRoot();
|
|
1110
|
+
const cwd = (0, import_utils2.getPackageRoot)();
|
|
2543
1111
|
p2.intro("\u{1F680} \uC571 \uCD08\uAE30\uD654\uB97C \uC2DC\uC791\uD569\uB2C8\uB2E4");
|
|
2544
1112
|
const appName = await ensureSelect({
|
|
2545
1113
|
value: this.appName,
|