@sentry/craft 2.26.7 → 2.26.9

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.
Files changed (2) hide show
  1. package/dist/craft +1267 -1687
  2. package/package.json +2 -3
package/dist/craft CHANGED
@@ -14197,8 +14197,8 @@ function makePromiseBuffer(limit = 100) {
14197
14197
  if (!timeout) {
14198
14198
  return drainPromise;
14199
14199
  }
14200
- const promises2 = [drainPromise, new Promise((resolve7) => setTimeout(() => resolve7(false), timeout))];
14201
- return Promise.race(promises2);
14200
+ const promises3 = [drainPromise, new Promise((resolve7) => setTimeout(() => resolve7(false), timeout))];
14201
+ return Promise.race(promises3);
14202
14202
  }
14203
14203
  return {
14204
14204
  get $() {
@@ -21637,12 +21637,12 @@ var require_BatchSpanProcessorBase = __commonJS({
21637
21637
  * */
21638
21638
  _flushAll() {
21639
21639
  return new Promise((resolve7, reject) => {
21640
- const promises2 = [];
21640
+ const promises3 = [];
21641
21641
  const count = Math.ceil(this._finishedSpans.length / this._maxExportBatchSize);
21642
21642
  for (let i5 = 0, j7 = count; i5 < j7; i5++) {
21643
- promises2.push(this._flushOneBatch());
21643
+ promises3.push(this._flushOneBatch());
21644
21644
  }
21645
- Promise.all(promises2).then(() => {
21645
+ Promise.all(promises3).then(() => {
21646
21646
  resolve7();
21647
21647
  }).catch(reject);
21648
21648
  });
@@ -21961,12 +21961,12 @@ var require_MultiSpanProcessor = __commonJS({
21961
21961
  this._spanProcessors = _spanProcessors;
21962
21962
  }
21963
21963
  forceFlush() {
21964
- const promises2 = [];
21964
+ const promises3 = [];
21965
21965
  for (const spanProcessor of this._spanProcessors) {
21966
- promises2.push(spanProcessor.forceFlush());
21966
+ promises3.push(spanProcessor.forceFlush());
21967
21967
  }
21968
21968
  return new Promise((resolve7) => {
21969
- Promise.all(promises2).then(() => {
21969
+ Promise.all(promises3).then(() => {
21970
21970
  resolve7();
21971
21971
  }).catch((error3) => {
21972
21972
  (0, core_1.globalErrorHandler)(error3 || new Error("MultiSpanProcessor: forceFlush failed"));
@@ -21985,12 +21985,12 @@ var require_MultiSpanProcessor = __commonJS({
21985
21985
  }
21986
21986
  }
21987
21987
  shutdown() {
21988
- const promises2 = [];
21988
+ const promises3 = [];
21989
21989
  for (const spanProcessor of this._spanProcessors) {
21990
- promises2.push(spanProcessor.shutdown());
21990
+ promises3.push(spanProcessor.shutdown());
21991
21991
  }
21992
21992
  return new Promise((resolve7, reject) => {
21993
- Promise.all(promises2).then(() => {
21993
+ Promise.all(promises3).then(() => {
21994
21994
  resolve7();
21995
21995
  }, reject);
21996
21996
  });
@@ -22046,7 +22046,7 @@ var require_BasicTracerProvider = __commonJS({
22046
22046
  }
22047
22047
  forceFlush() {
22048
22048
  const timeout = this._config.forceFlushTimeoutMillis;
22049
- const promises2 = this._activeSpanProcessor["_spanProcessors"].map((spanProcessor) => {
22049
+ const promises3 = this._activeSpanProcessor["_spanProcessors"].map((spanProcessor) => {
22050
22050
  return new Promise((resolve7) => {
22051
22051
  let state2;
22052
22052
  const timeoutInterval = setTimeout(() => {
@@ -22067,7 +22067,7 @@ var require_BasicTracerProvider = __commonJS({
22067
22067
  });
22068
22068
  });
22069
22069
  return new Promise((resolve7, reject) => {
22070
- Promise.all(promises2).then((results) => {
22070
+ Promise.all(promises3).then((results) => {
22071
22071
  const errors = results.filter((result) => result !== ForceFlushState.resolved);
22072
22072
  if (errors.length > 0) {
22073
22073
  reject(errors);
@@ -67058,1730 +67058,1134 @@ var init_index_min = __esm({
67058
67058
  }
67059
67059
  });
67060
67060
 
67061
- // node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js
67062
- var require_wrappy = __commonJS({
67063
- "node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js"(exports2, module2) {
67061
+ // node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js
67062
+ var require_node_stream_zip = __commonJS({
67063
+ "node_modules/.pnpm/node-stream-zip@1.15.0/node_modules/node-stream-zip/node_stream_zip.js"(exports2, module2) {
67064
67064
  init_import_meta_url();
67065
- module2.exports = wrappy;
67066
- function wrappy(fn2, cb) {
67067
- if (fn2 && cb) return wrappy(fn2)(cb);
67068
- if (typeof fn2 !== "function")
67069
- throw new TypeError("need wrapper function");
67070
- Object.keys(fn2).forEach(function(k7) {
67071
- wrapper[k7] = fn2[k7];
67072
- });
67073
- return wrapper;
67074
- function wrapper() {
67075
- var args = new Array(arguments.length);
67076
- for (var i5 = 0; i5 < args.length; i5++) {
67077
- args[i5] = arguments[i5];
67078
- }
67079
- var ret = fn2.apply(this, args);
67080
- var cb2 = args[args.length - 1];
67081
- if (typeof ret === "function" && ret !== cb2) {
67082
- Object.keys(cb2).forEach(function(k7) {
67083
- ret[k7] = cb2[k7];
67065
+ var fs15 = require("fs");
67066
+ var util6 = require("util");
67067
+ var path18 = require("path");
67068
+ var events = require("events");
67069
+ var zlib2 = require("zlib");
67070
+ var stream2 = require("stream");
67071
+ var consts = {
67072
+ /* The local file header */
67073
+ LOCHDR: 30,
67074
+ // LOC header size
67075
+ LOCSIG: 67324752,
67076
+ // "PK\003\004"
67077
+ LOCVER: 4,
67078
+ // version needed to extract
67079
+ LOCFLG: 6,
67080
+ // general purpose bit flag
67081
+ LOCHOW: 8,
67082
+ // compression method
67083
+ LOCTIM: 10,
67084
+ // modification time (2 bytes time, 2 bytes date)
67085
+ LOCCRC: 14,
67086
+ // uncompressed file crc-32 value
67087
+ LOCSIZ: 18,
67088
+ // compressed size
67089
+ LOCLEN: 22,
67090
+ // uncompressed size
67091
+ LOCNAM: 26,
67092
+ // filename length
67093
+ LOCEXT: 28,
67094
+ // extra field length
67095
+ /* The Data descriptor */
67096
+ EXTSIG: 134695760,
67097
+ // "PK\007\008"
67098
+ EXTHDR: 16,
67099
+ // EXT header size
67100
+ EXTCRC: 4,
67101
+ // uncompressed file crc-32 value
67102
+ EXTSIZ: 8,
67103
+ // compressed size
67104
+ EXTLEN: 12,
67105
+ // uncompressed size
67106
+ /* The central directory file header */
67107
+ CENHDR: 46,
67108
+ // CEN header size
67109
+ CENSIG: 33639248,
67110
+ // "PK\001\002"
67111
+ CENVEM: 4,
67112
+ // version made by
67113
+ CENVER: 6,
67114
+ // version needed to extract
67115
+ CENFLG: 8,
67116
+ // encrypt, decrypt flags
67117
+ CENHOW: 10,
67118
+ // compression method
67119
+ CENTIM: 12,
67120
+ // modification time (2 bytes time, 2 bytes date)
67121
+ CENCRC: 16,
67122
+ // uncompressed file crc-32 value
67123
+ CENSIZ: 20,
67124
+ // compressed size
67125
+ CENLEN: 24,
67126
+ // uncompressed size
67127
+ CENNAM: 28,
67128
+ // filename length
67129
+ CENEXT: 30,
67130
+ // extra field length
67131
+ CENCOM: 32,
67132
+ // file comment length
67133
+ CENDSK: 34,
67134
+ // volume number start
67135
+ CENATT: 36,
67136
+ // internal file attributes
67137
+ CENATX: 38,
67138
+ // external file attributes (host system dependent)
67139
+ CENOFF: 42,
67140
+ // LOC header offset
67141
+ /* The entries in the end of central directory */
67142
+ ENDHDR: 22,
67143
+ // END header size
67144
+ ENDSIG: 101010256,
67145
+ // "PK\005\006"
67146
+ ENDSIGFIRST: 80,
67147
+ ENDSUB: 8,
67148
+ // number of entries on this disk
67149
+ ENDTOT: 10,
67150
+ // total number of entries
67151
+ ENDSIZ: 12,
67152
+ // central directory size in bytes
67153
+ ENDOFF: 16,
67154
+ // offset of first CEN header
67155
+ ENDCOM: 20,
67156
+ // zip file comment length
67157
+ MAXFILECOMMENT: 65535,
67158
+ /* The entries in the end of ZIP64 central directory locator */
67159
+ ENDL64HDR: 20,
67160
+ // ZIP64 end of central directory locator header size
67161
+ ENDL64SIG: 117853008,
67162
+ // ZIP64 end of central directory locator signature
67163
+ ENDL64SIGFIRST: 80,
67164
+ ENDL64OFS: 8,
67165
+ // ZIP64 end of central directory offset
67166
+ /* The entries in the end of ZIP64 central directory */
67167
+ END64HDR: 56,
67168
+ // ZIP64 end of central directory header size
67169
+ END64SIG: 101075792,
67170
+ // ZIP64 end of central directory signature
67171
+ END64SIGFIRST: 80,
67172
+ END64SUB: 24,
67173
+ // number of entries on this disk
67174
+ END64TOT: 32,
67175
+ // total number of entries
67176
+ END64SIZ: 40,
67177
+ END64OFF: 48,
67178
+ /* Compression methods */
67179
+ STORED: 0,
67180
+ // no compression
67181
+ SHRUNK: 1,
67182
+ // shrunk
67183
+ REDUCED1: 2,
67184
+ // reduced with compression factor 1
67185
+ REDUCED2: 3,
67186
+ // reduced with compression factor 2
67187
+ REDUCED3: 4,
67188
+ // reduced with compression factor 3
67189
+ REDUCED4: 5,
67190
+ // reduced with compression factor 4
67191
+ IMPLODED: 6,
67192
+ // imploded
67193
+ // 7 reserved
67194
+ DEFLATED: 8,
67195
+ // deflated
67196
+ ENHANCED_DEFLATED: 9,
67197
+ // deflate64
67198
+ PKWARE: 10,
67199
+ // PKWare DCL imploded
67200
+ // 11 reserved
67201
+ BZIP2: 12,
67202
+ // compressed using BZIP2
67203
+ // 13 reserved
67204
+ LZMA: 14,
67205
+ // LZMA
67206
+ // 15-17 reserved
67207
+ IBM_TERSE: 18,
67208
+ // compressed using IBM TERSE
67209
+ IBM_LZ77: 19,
67210
+ //IBM LZ77 z
67211
+ /* General purpose bit flag */
67212
+ FLG_ENC: 0,
67213
+ // encrypted file
67214
+ FLG_COMP1: 1,
67215
+ // compression option
67216
+ FLG_COMP2: 2,
67217
+ // compression option
67218
+ FLG_DESC: 4,
67219
+ // data descriptor
67220
+ FLG_ENH: 8,
67221
+ // enhanced deflation
67222
+ FLG_STR: 16,
67223
+ // strong encryption
67224
+ FLG_LNG: 1024,
67225
+ // language encoding
67226
+ FLG_MSK: 4096,
67227
+ // mask header values
67228
+ FLG_ENTRY_ENC: 1,
67229
+ /* 4.5 Extensible data fields */
67230
+ EF_ID: 0,
67231
+ EF_SIZE: 2,
67232
+ /* Header IDs */
67233
+ ID_ZIP64: 1,
67234
+ ID_AVINFO: 7,
67235
+ ID_PFS: 8,
67236
+ ID_OS2: 9,
67237
+ ID_NTFS: 10,
67238
+ ID_OPENVMS: 12,
67239
+ ID_UNIX: 13,
67240
+ ID_FORK: 14,
67241
+ ID_PATCH: 15,
67242
+ ID_X509_PKCS7: 20,
67243
+ ID_X509_CERTID_F: 21,
67244
+ ID_X509_CERTID_C: 22,
67245
+ ID_STRONGENC: 23,
67246
+ ID_RECORD_MGT: 24,
67247
+ ID_X509_PKCS7_RL: 25,
67248
+ ID_IBM1: 101,
67249
+ ID_IBM2: 102,
67250
+ ID_POSZIP: 18064,
67251
+ EF_ZIP64_OR_32: 4294967295,
67252
+ EF_ZIP64_OR_16: 65535
67253
+ };
67254
+ var StreamZip2 = function(config3) {
67255
+ let fd, fileSize, chunkSize, op2, centralDirectory, closed;
67256
+ const ready = false, that = this, entries = config3.storeEntries !== false ? {} : null, fileName = config3.file, textDecoder2 = config3.nameEncoding ? new TextDecoder(config3.nameEncoding) : null;
67257
+ open();
67258
+ function open() {
67259
+ if (config3.fd) {
67260
+ fd = config3.fd;
67261
+ readFile4();
67262
+ } else {
67263
+ fs15.open(fileName, "r", (err, f5) => {
67264
+ if (err) {
67265
+ return that.emit("error", err);
67266
+ }
67267
+ fd = f5;
67268
+ readFile4();
67084
67269
  });
67085
67270
  }
67086
- return ret;
67087
67271
  }
67088
- }
67089
- }
67090
- });
67091
-
67092
- // node_modules/.pnpm/once@1.4.0/node_modules/once/once.js
67093
- var require_once = __commonJS({
67094
- "node_modules/.pnpm/once@1.4.0/node_modules/once/once.js"(exports2, module2) {
67095
- init_import_meta_url();
67096
- var wrappy = require_wrappy();
67097
- module2.exports = wrappy(once);
67098
- module2.exports.strict = wrappy(onceStrict);
67099
- once.proto = once(function() {
67100
- Object.defineProperty(Function.prototype, "once", {
67101
- value: function() {
67102
- return once(this);
67103
- },
67104
- configurable: true
67105
- });
67106
- Object.defineProperty(Function.prototype, "onceStrict", {
67107
- value: function() {
67108
- return onceStrict(this);
67109
- },
67110
- configurable: true
67111
- });
67112
- });
67113
- function once(fn2) {
67114
- var f5 = function() {
67115
- if (f5.called) return f5.value;
67116
- f5.called = true;
67117
- return f5.value = fn2.apply(this, arguments);
67118
- };
67119
- f5.called = false;
67120
- return f5;
67121
- }
67122
- function onceStrict(fn2) {
67123
- var f5 = function() {
67124
- if (f5.called)
67125
- throw new Error(f5.onceError);
67126
- f5.called = true;
67127
- return f5.value = fn2.apply(this, arguments);
67128
- };
67129
- var name = fn2.name || "Function wrapped with `once`";
67130
- f5.onceError = name + " shouldn't be called more than once";
67131
- f5.called = false;
67132
- return f5;
67133
- }
67134
- }
67135
- });
67136
-
67137
- // node_modules/.pnpm/end-of-stream@1.4.5/node_modules/end-of-stream/index.js
67138
- var require_end_of_stream = __commonJS({
67139
- "node_modules/.pnpm/end-of-stream@1.4.5/node_modules/end-of-stream/index.js"(exports2, module2) {
67140
- init_import_meta_url();
67141
- var once = require_once();
67142
- var noop2 = function() {
67143
- };
67144
- var qnt = global.Bare ? queueMicrotask : process.nextTick.bind(process);
67145
- var isRequest = function(stream2) {
67146
- return stream2.setHeader && typeof stream2.abort === "function";
67147
- };
67148
- var isChildProcess = function(stream2) {
67149
- return stream2.stdio && Array.isArray(stream2.stdio) && stream2.stdio.length === 3;
67150
- };
67151
- var eos = function(stream2, opts, callback) {
67152
- if (typeof opts === "function") return eos(stream2, null, opts);
67153
- if (!opts) opts = {};
67154
- callback = once(callback || noop2);
67155
- var ws2 = stream2._writableState;
67156
- var rs2 = stream2._readableState;
67157
- var readable = opts.readable || opts.readable !== false && stream2.readable;
67158
- var writable = opts.writable || opts.writable !== false && stream2.writable;
67159
- var cancelled = false;
67160
- var onlegacyfinish = function() {
67161
- if (!stream2.writable) onfinish();
67162
- };
67163
- var onfinish = function() {
67164
- writable = false;
67165
- if (!readable) callback.call(stream2);
67166
- };
67167
- var onend = function() {
67168
- readable = false;
67169
- if (!writable) callback.call(stream2);
67170
- };
67171
- var onexit = function(exitCode) {
67172
- callback.call(stream2, exitCode ? new Error("exited with error code: " + exitCode) : null);
67173
- };
67174
- var onerror = function(err) {
67175
- callback.call(stream2, err);
67176
- };
67177
- var onclose = function() {
67178
- qnt(onclosenexttick);
67179
- };
67180
- var onclosenexttick = function() {
67181
- if (cancelled) return;
67182
- if (readable && !(rs2 && (rs2.ended && !rs2.destroyed))) return callback.call(stream2, new Error("premature close"));
67183
- if (writable && !(ws2 && (ws2.ended && !ws2.destroyed))) return callback.call(stream2, new Error("premature close"));
67184
- };
67185
- var onrequest = function() {
67186
- stream2.req.on("finish", onfinish);
67187
- };
67188
- if (isRequest(stream2)) {
67189
- stream2.on("complete", onfinish);
67190
- stream2.on("abort", onclose);
67191
- if (stream2.req) onrequest();
67192
- else stream2.on("request", onrequest);
67193
- } else if (writable && !ws2) {
67194
- stream2.on("end", onlegacyfinish);
67195
- stream2.on("close", onlegacyfinish);
67196
- }
67197
- if (isChildProcess(stream2)) stream2.on("exit", onexit);
67198
- stream2.on("end", onend);
67199
- stream2.on("finish", onfinish);
67200
- if (opts.error !== false) stream2.on("error", onerror);
67201
- stream2.on("close", onclose);
67202
- return function() {
67203
- cancelled = true;
67204
- stream2.removeListener("complete", onfinish);
67205
- stream2.removeListener("abort", onclose);
67206
- stream2.removeListener("request", onrequest);
67207
- if (stream2.req) stream2.req.removeListener("finish", onfinish);
67208
- stream2.removeListener("end", onlegacyfinish);
67209
- stream2.removeListener("close", onlegacyfinish);
67210
- stream2.removeListener("finish", onfinish);
67211
- stream2.removeListener("exit", onexit);
67212
- stream2.removeListener("end", onend);
67213
- stream2.removeListener("error", onerror);
67214
- stream2.removeListener("close", onclose);
67215
- };
67216
- };
67217
- module2.exports = eos;
67218
- }
67219
- });
67220
-
67221
- // node_modules/.pnpm/pump@3.0.3/node_modules/pump/index.js
67222
- var require_pump = __commonJS({
67223
- "node_modules/.pnpm/pump@3.0.3/node_modules/pump/index.js"(exports2, module2) {
67224
- init_import_meta_url();
67225
- var once = require_once();
67226
- var eos = require_end_of_stream();
67227
- var fs15;
67228
- try {
67229
- fs15 = require("fs");
67230
- } catch (e4) {
67231
- }
67232
- var noop2 = function() {
67233
- };
67234
- var ancient = typeof process === "undefined" ? false : /^v?\.0/.test(process.version);
67235
- var isFn = function(fn2) {
67236
- return typeof fn2 === "function";
67237
- };
67238
- var isFS = function(stream2) {
67239
- if (!ancient) return false;
67240
- if (!fs15) return false;
67241
- return (stream2 instanceof (fs15.ReadStream || noop2) || stream2 instanceof (fs15.WriteStream || noop2)) && isFn(stream2.close);
67242
- };
67243
- var isRequest = function(stream2) {
67244
- return stream2.setHeader && isFn(stream2.abort);
67245
- };
67246
- var destroyer = function(stream2, reading, writing, callback) {
67247
- callback = once(callback);
67248
- var closed = false;
67249
- stream2.on("close", function() {
67250
- closed = true;
67251
- });
67252
- eos(stream2, { readable: reading, writable: writing }, function(err) {
67253
- if (err) return callback(err);
67254
- closed = true;
67255
- callback();
67256
- });
67257
- var destroyed = false;
67258
- return function(err) {
67259
- if (closed) return;
67260
- if (destroyed) return;
67261
- destroyed = true;
67262
- if (isFS(stream2)) return stream2.close(noop2);
67263
- if (isRequest(stream2)) return stream2.abort();
67264
- if (isFn(stream2.destroy)) return stream2.destroy();
67265
- callback(err || new Error("stream was destroyed"));
67266
- };
67267
- };
67268
- var call = function(fn2) {
67269
- fn2();
67270
- };
67271
- var pipe = function(from, to2) {
67272
- return from.pipe(to2);
67273
- };
67274
- var pump = function() {
67275
- var streams = Array.prototype.slice.call(arguments);
67276
- var callback = isFn(streams[streams.length - 1] || noop2) && streams.pop() || noop2;
67277
- if (Array.isArray(streams[0])) streams = streams[0];
67278
- if (streams.length < 2) throw new Error("pump requires two streams per minimum");
67279
- var error3;
67280
- var destroys = streams.map(function(stream2, i5) {
67281
- var reading = i5 < streams.length - 1;
67282
- var writing = i5 > 0;
67283
- return destroyer(stream2, reading, writing, function(err) {
67284
- if (!error3) error3 = err;
67285
- if (err) destroys.forEach(call);
67286
- if (reading) return;
67287
- destroys.forEach(call);
67288
- callback(error3);
67289
- });
67290
- });
67291
- return streams.reduce(pipe);
67292
- };
67293
- module2.exports = pump;
67294
- }
67295
- });
67296
-
67297
- // node_modules/.pnpm/get-stream@5.2.0/node_modules/get-stream/buffer-stream.js
67298
- var require_buffer_stream = __commonJS({
67299
- "node_modules/.pnpm/get-stream@5.2.0/node_modules/get-stream/buffer-stream.js"(exports2, module2) {
67300
- "use strict";
67301
- init_import_meta_url();
67302
- var { PassThrough: PassThroughStream } = require("stream");
67303
- module2.exports = (options) => {
67304
- options = { ...options };
67305
- const { array } = options;
67306
- let { encoding } = options;
67307
- const isBuffer2 = encoding === "buffer";
67308
- let objectMode = false;
67309
- if (array) {
67310
- objectMode = !(encoding || isBuffer2);
67311
- } else {
67312
- encoding = encoding || "utf8";
67313
- }
67314
- if (isBuffer2) {
67315
- encoding = null;
67316
- }
67317
- const stream2 = new PassThroughStream({ objectMode });
67318
- if (encoding) {
67319
- stream2.setEncoding(encoding);
67320
- }
67321
- let length = 0;
67322
- const chunks = [];
67323
- stream2.on("data", (chunk) => {
67324
- chunks.push(chunk);
67325
- if (objectMode) {
67326
- length = chunks.length;
67327
- } else {
67328
- length += chunk.length;
67272
+ function readFile4() {
67273
+ fs15.fstat(fd, (err, stat) => {
67274
+ if (err) {
67275
+ return that.emit("error", err);
67276
+ }
67277
+ fileSize = stat.size;
67278
+ chunkSize = config3.chunkSize || Math.round(fileSize / 1e3);
67279
+ chunkSize = Math.max(
67280
+ Math.min(chunkSize, Math.min(128 * 1024, fileSize)),
67281
+ Math.min(1024, fileSize)
67282
+ );
67283
+ readCentralDirectory();
67284
+ });
67285
+ }
67286
+ function readUntilFoundCallback(err, bytesRead) {
67287
+ if (err || !bytesRead) {
67288
+ return that.emit("error", err || new Error("Archive read error"));
67289
+ }
67290
+ let pos = op2.lastPos;
67291
+ let bufferPosition = pos - op2.win.position;
67292
+ const buffer = op2.win.buffer;
67293
+ const minPos = op2.minPos;
67294
+ while (--pos >= minPos && --bufferPosition >= 0) {
67295
+ if (buffer.length - bufferPosition >= 4 && buffer[bufferPosition] === op2.firstByte) {
67296
+ if (buffer.readUInt32LE(bufferPosition) === op2.sig) {
67297
+ op2.lastBufferPosition = bufferPosition;
67298
+ op2.lastBytesRead = bytesRead;
67299
+ op2.complete();
67300
+ return;
67301
+ }
67302
+ }
67329
67303
  }
67330
- });
67331
- stream2.getBufferedValue = () => {
67332
- if (array) {
67333
- return chunks;
67304
+ if (pos === minPos) {
67305
+ return that.emit("error", new Error("Bad archive"));
67334
67306
  }
67335
- return isBuffer2 ? Buffer.concat(chunks, length) : chunks.join("");
67336
- };
67337
- stream2.getBufferedLength = () => length;
67338
- return stream2;
67339
- };
67340
- }
67341
- });
67342
-
67343
- // node_modules/.pnpm/get-stream@5.2.0/node_modules/get-stream/index.js
67344
- var require_get_stream = __commonJS({
67345
- "node_modules/.pnpm/get-stream@5.2.0/node_modules/get-stream/index.js"(exports2, module2) {
67346
- "use strict";
67347
- init_import_meta_url();
67348
- var { constants: BufferConstants } = require("buffer");
67349
- var pump = require_pump();
67350
- var bufferStream = require_buffer_stream();
67351
- var MaxBufferError = class extends Error {
67352
- constructor() {
67353
- super("maxBuffer exceeded");
67354
- this.name = "MaxBufferError";
67355
- }
67356
- };
67357
- async function getStream(inputStream, options) {
67358
- if (!inputStream) {
67359
- return Promise.reject(new Error("Expected a stream"));
67307
+ op2.lastPos = pos + 1;
67308
+ op2.chunkSize *= 2;
67309
+ if (pos <= minPos) {
67310
+ return that.emit("error", new Error("Bad archive"));
67311
+ }
67312
+ const expandLength = Math.min(op2.chunkSize, pos - minPos);
67313
+ op2.win.expandLeft(expandLength, readUntilFoundCallback);
67360
67314
  }
67361
- options = {
67362
- maxBuffer: Infinity,
67363
- ...options
67364
- };
67365
- const { maxBuffer } = options;
67366
- let stream2;
67367
- await new Promise((resolve7, reject) => {
67368
- const rejectPromise = (error3) => {
67369
- if (error3 && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
67370
- error3.bufferedData = stream2.getBufferedValue();
67371
- }
67372
- reject(error3);
67315
+ function readCentralDirectory() {
67316
+ const totalReadLength = Math.min(consts.ENDHDR + consts.MAXFILECOMMENT, fileSize);
67317
+ op2 = {
67318
+ win: new FileWindowBuffer(fd),
67319
+ totalReadLength,
67320
+ minPos: fileSize - totalReadLength,
67321
+ lastPos: fileSize,
67322
+ chunkSize: Math.min(1024, chunkSize),
67323
+ firstByte: consts.ENDSIGFIRST,
67324
+ sig: consts.ENDSIG,
67325
+ complete: readCentralDirectoryComplete
67373
67326
  };
67374
- stream2 = pump(inputStream, bufferStream(options), (error3) => {
67375
- if (error3) {
67376
- rejectPromise(error3);
67377
- return;
67327
+ op2.win.read(fileSize - op2.chunkSize, op2.chunkSize, readUntilFoundCallback);
67328
+ }
67329
+ function readCentralDirectoryComplete() {
67330
+ const buffer = op2.win.buffer;
67331
+ const pos = op2.lastBufferPosition;
67332
+ try {
67333
+ centralDirectory = new CentralDirectoryHeader();
67334
+ centralDirectory.read(buffer.slice(pos, pos + consts.ENDHDR));
67335
+ centralDirectory.headerOffset = op2.win.position + pos;
67336
+ if (centralDirectory.commentLength) {
67337
+ that.comment = buffer.slice(
67338
+ pos + consts.ENDHDR,
67339
+ pos + consts.ENDHDR + centralDirectory.commentLength
67340
+ ).toString();
67341
+ } else {
67342
+ that.comment = null;
67378
67343
  }
67379
- resolve7();
67380
- });
67381
- stream2.on("data", () => {
67382
- if (stream2.getBufferedLength() > maxBuffer) {
67383
- rejectPromise(new MaxBufferError());
67344
+ that.entriesCount = centralDirectory.volumeEntries;
67345
+ that.centralDirectory = centralDirectory;
67346
+ if (centralDirectory.volumeEntries === consts.EF_ZIP64_OR_16 && centralDirectory.totalEntries === consts.EF_ZIP64_OR_16 || centralDirectory.size === consts.EF_ZIP64_OR_32 || centralDirectory.offset === consts.EF_ZIP64_OR_32) {
67347
+ readZip64CentralDirectoryLocator();
67348
+ } else {
67349
+ op2 = {};
67350
+ readEntries();
67384
67351
  }
67385
- });
67386
- });
67387
- return stream2.getBufferedValue();
67388
- }
67389
- module2.exports = getStream;
67390
- module2.exports.default = getStream;
67391
- module2.exports.buffer = (stream2, options) => getStream(stream2, { ...options, encoding: "buffer" });
67392
- module2.exports.array = (stream2, options) => getStream(stream2, { ...options, array: true });
67393
- module2.exports.MaxBufferError = MaxBufferError;
67394
- }
67395
- });
67396
-
67397
- // node_modules/.pnpm/pend@1.2.0/node_modules/pend/index.js
67398
- var require_pend = __commonJS({
67399
- "node_modules/.pnpm/pend@1.2.0/node_modules/pend/index.js"(exports2, module2) {
67400
- init_import_meta_url();
67401
- module2.exports = Pend;
67402
- function Pend() {
67403
- this.pending = 0;
67404
- this.max = Infinity;
67405
- this.listeners = [];
67406
- this.waiting = [];
67407
- this.error = null;
67408
- }
67409
- Pend.prototype.go = function(fn2) {
67410
- if (this.pending < this.max) {
67411
- pendGo(this, fn2);
67412
- } else {
67413
- this.waiting.push(fn2);
67414
- }
67415
- };
67416
- Pend.prototype.wait = function(cb) {
67417
- if (this.pending === 0) {
67418
- cb(this.error);
67419
- } else {
67420
- this.listeners.push(cb);
67421
- }
67422
- };
67423
- Pend.prototype.hold = function() {
67424
- return pendHold(this);
67425
- };
67426
- function pendHold(self2) {
67427
- self2.pending += 1;
67428
- var called = false;
67429
- return onCb;
67430
- function onCb(err) {
67431
- if (called) throw new Error("callback called twice");
67432
- called = true;
67433
- self2.error = self2.error || err;
67434
- self2.pending -= 1;
67435
- if (self2.waiting.length > 0 && self2.pending < self2.max) {
67436
- pendGo(self2, self2.waiting.shift());
67437
- } else if (self2.pending === 0) {
67438
- var listeners = self2.listeners;
67439
- self2.listeners = [];
67440
- listeners.forEach(cbListener);
67352
+ } catch (err) {
67353
+ that.emit("error", err);
67441
67354
  }
67442
67355
  }
67443
- function cbListener(listener) {
67444
- listener(self2.error);
67445
- }
67446
- }
67447
- function pendGo(self2, fn2) {
67448
- fn2(pendHold(self2));
67449
- }
67450
- }
67451
- });
67452
-
67453
- // node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js
67454
- var require_fd_slicer = __commonJS({
67455
- "node_modules/.pnpm/fd-slicer@1.1.0/node_modules/fd-slicer/index.js"(exports2) {
67456
- init_import_meta_url();
67457
- var fs15 = require("fs");
67458
- var util6 = require("util");
67459
- var stream2 = require("stream");
67460
- var Readable5 = stream2.Readable;
67461
- var Writable3 = stream2.Writable;
67462
- var PassThrough2 = stream2.PassThrough;
67463
- var Pend = require_pend();
67464
- var EventEmitter5 = require("events").EventEmitter;
67465
- exports2.createFromBuffer = createFromBuffer;
67466
- exports2.createFromFd = createFromFd;
67467
- exports2.BufferSlicer = BufferSlicer;
67468
- exports2.FdSlicer = FdSlicer;
67469
- util6.inherits(FdSlicer, EventEmitter5);
67470
- function FdSlicer(fd, options) {
67471
- options = options || {};
67472
- EventEmitter5.call(this);
67473
- this.fd = fd;
67474
- this.pend = new Pend();
67475
- this.pend.max = 1;
67476
- this.refCount = 0;
67477
- this.autoClose = !!options.autoClose;
67478
- }
67479
- FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
67480
- var self2 = this;
67481
- self2.pend.go(function(cb) {
67482
- fs15.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
67483
- cb();
67484
- callback(err, bytesRead, buffer2);
67485
- });
67486
- });
67487
- };
67488
- FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
67489
- var self2 = this;
67490
- self2.pend.go(function(cb) {
67491
- fs15.write(self2.fd, buffer, offset, length, position, function(err, written, buffer2) {
67492
- cb();
67493
- callback(err, written, buffer2);
67494
- });
67495
- });
67496
- };
67497
- FdSlicer.prototype.createReadStream = function(options) {
67498
- return new ReadStream(this, options);
67499
- };
67500
- FdSlicer.prototype.createWriteStream = function(options) {
67501
- return new WriteStream(this, options);
67502
- };
67503
- FdSlicer.prototype.ref = function() {
67504
- this.refCount += 1;
67505
- };
67506
- FdSlicer.prototype.unref = function() {
67507
- var self2 = this;
67508
- self2.refCount -= 1;
67509
- if (self2.refCount > 0) return;
67510
- if (self2.refCount < 0) throw new Error("invalid unref");
67511
- if (self2.autoClose) {
67512
- fs15.close(self2.fd, onCloseDone);
67513
- }
67514
- function onCloseDone(err) {
67515
- if (err) {
67516
- self2.emit("error", err);
67356
+ function readZip64CentralDirectoryLocator() {
67357
+ const length = consts.ENDL64HDR;
67358
+ if (op2.lastBufferPosition > length) {
67359
+ op2.lastBufferPosition -= length;
67360
+ readZip64CentralDirectoryLocatorComplete();
67517
67361
  } else {
67518
- self2.emit("close");
67362
+ op2 = {
67363
+ win: op2.win,
67364
+ totalReadLength: length,
67365
+ minPos: op2.win.position - length,
67366
+ lastPos: op2.win.position,
67367
+ chunkSize: op2.chunkSize,
67368
+ firstByte: consts.ENDL64SIGFIRST,
67369
+ sig: consts.ENDL64SIG,
67370
+ complete: readZip64CentralDirectoryLocatorComplete
67371
+ };
67372
+ op2.win.read(op2.lastPos - op2.chunkSize, op2.chunkSize, readUntilFoundCallback);
67519
67373
  }
67520
67374
  }
67521
- };
67522
- util6.inherits(ReadStream, Readable5);
67523
- function ReadStream(context2, options) {
67524
- options = options || {};
67525
- Readable5.call(this, options);
67526
- this.context = context2;
67527
- this.context.ref();
67528
- this.start = options.start || 0;
67529
- this.endOffset = options.end;
67530
- this.pos = this.start;
67531
- this.destroyed = false;
67532
- }
67533
- ReadStream.prototype._read = function(n4) {
67534
- var self2 = this;
67535
- if (self2.destroyed) return;
67536
- var toRead = Math.min(self2._readableState.highWaterMark, n4);
67537
- if (self2.endOffset != null) {
67538
- toRead = Math.min(toRead, self2.endOffset - self2.pos);
67539
- }
67540
- if (toRead <= 0) {
67541
- self2.destroyed = true;
67542
- self2.push(null);
67543
- self2.context.unref();
67544
- return;
67545
- }
67546
- self2.context.pend.go(function(cb) {
67547
- if (self2.destroyed) return cb();
67548
- var buffer = new Buffer(toRead);
67549
- fs15.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
67550
- if (err) {
67551
- self2.destroy(err);
67552
- } else if (bytesRead === 0) {
67553
- self2.destroyed = true;
67554
- self2.push(null);
67555
- self2.context.unref();
67556
- } else {
67557
- self2.pos += bytesRead;
67558
- self2.push(buffer.slice(0, bytesRead));
67375
+ function readZip64CentralDirectoryLocatorComplete() {
67376
+ const buffer = op2.win.buffer;
67377
+ const locHeader = new CentralDirectoryLoc64Header();
67378
+ locHeader.read(
67379
+ buffer.slice(op2.lastBufferPosition, op2.lastBufferPosition + consts.ENDL64HDR)
67380
+ );
67381
+ const readLength = fileSize - locHeader.headerOffset;
67382
+ op2 = {
67383
+ win: op2.win,
67384
+ totalReadLength: readLength,
67385
+ minPos: locHeader.headerOffset,
67386
+ lastPos: op2.lastPos,
67387
+ chunkSize: op2.chunkSize,
67388
+ firstByte: consts.END64SIGFIRST,
67389
+ sig: consts.END64SIG,
67390
+ complete: readZip64CentralDirectoryComplete
67391
+ };
67392
+ op2.win.read(fileSize - op2.chunkSize, op2.chunkSize, readUntilFoundCallback);
67393
+ }
67394
+ function readZip64CentralDirectoryComplete() {
67395
+ const buffer = op2.win.buffer;
67396
+ const zip64cd = new CentralDirectoryZip64Header();
67397
+ zip64cd.read(buffer.slice(op2.lastBufferPosition, op2.lastBufferPosition + consts.END64HDR));
67398
+ that.centralDirectory.volumeEntries = zip64cd.volumeEntries;
67399
+ that.centralDirectory.totalEntries = zip64cd.totalEntries;
67400
+ that.centralDirectory.size = zip64cd.size;
67401
+ that.centralDirectory.offset = zip64cd.offset;
67402
+ that.entriesCount = zip64cd.volumeEntries;
67403
+ op2 = {};
67404
+ readEntries();
67405
+ }
67406
+ function readEntries() {
67407
+ op2 = {
67408
+ win: new FileWindowBuffer(fd),
67409
+ pos: centralDirectory.offset,
67410
+ chunkSize,
67411
+ entriesLeft: centralDirectory.volumeEntries
67412
+ };
67413
+ op2.win.read(op2.pos, Math.min(chunkSize, fileSize - op2.pos), readEntriesCallback);
67414
+ }
67415
+ function readEntriesCallback(err, bytesRead) {
67416
+ if (err || !bytesRead) {
67417
+ return that.emit("error", err || new Error("Entries read error"));
67418
+ }
67419
+ let bufferPos = op2.pos - op2.win.position;
67420
+ let entry = op2.entry;
67421
+ const buffer = op2.win.buffer;
67422
+ const bufferLength = buffer.length;
67423
+ try {
67424
+ while (op2.entriesLeft > 0) {
67425
+ if (!entry) {
67426
+ entry = new ZipEntry();
67427
+ entry.readHeader(buffer, bufferPos);
67428
+ entry.headerOffset = op2.win.position + bufferPos;
67429
+ op2.entry = entry;
67430
+ op2.pos += consts.CENHDR;
67431
+ bufferPos += consts.CENHDR;
67432
+ }
67433
+ const entryHeaderSize = entry.fnameLen + entry.extraLen + entry.comLen;
67434
+ const advanceBytes = entryHeaderSize + (op2.entriesLeft > 1 ? consts.CENHDR : 0);
67435
+ if (bufferLength - bufferPos < advanceBytes) {
67436
+ op2.win.moveRight(chunkSize, readEntriesCallback, bufferPos);
67437
+ op2.move = true;
67438
+ return;
67439
+ }
67440
+ entry.read(buffer, bufferPos, textDecoder2);
67441
+ if (!config3.skipEntryNameValidation) {
67442
+ entry.validateName();
67443
+ }
67444
+ if (entries) {
67445
+ entries[entry.name] = entry;
67446
+ }
67447
+ that.emit("entry", entry);
67448
+ op2.entry = entry = null;
67449
+ op2.entriesLeft--;
67450
+ op2.pos += entryHeaderSize;
67451
+ bufferPos += entryHeaderSize;
67559
67452
  }
67560
- cb();
67561
- });
67562
- });
67563
- };
67564
- ReadStream.prototype.destroy = function(err) {
67565
- if (this.destroyed) return;
67566
- err = err || new Error("stream destroyed");
67567
- this.destroyed = true;
67568
- this.emit("error", err);
67569
- this.context.unref();
67570
- };
67571
- util6.inherits(WriteStream, Writable3);
67572
- function WriteStream(context2, options) {
67573
- options = options || {};
67574
- Writable3.call(this, options);
67575
- this.context = context2;
67576
- this.context.ref();
67577
- this.start = options.start || 0;
67578
- this.endOffset = options.end == null ? Infinity : +options.end;
67579
- this.bytesWritten = 0;
67580
- this.pos = this.start;
67581
- this.destroyed = false;
67582
- this.on("finish", this.destroy.bind(this));
67583
- }
67584
- WriteStream.prototype._write = function(buffer, encoding, callback) {
67585
- var self2 = this;
67586
- if (self2.destroyed) return;
67587
- if (self2.pos + buffer.length > self2.endOffset) {
67588
- var err = new Error("maximum file length exceeded");
67589
- err.code = "ETOOBIG";
67590
- self2.destroy();
67591
- callback(err);
67592
- return;
67453
+ that.emit("ready");
67454
+ } catch (err2) {
67455
+ that.emit("error", err2);
67456
+ }
67593
67457
  }
67594
- self2.context.pend.go(function(cb) {
67595
- if (self2.destroyed) return cb();
67596
- fs15.write(self2.context.fd, buffer, 0, buffer.length, self2.pos, function(err2, bytes) {
67597
- if (err2) {
67598
- self2.destroy();
67599
- cb();
67600
- callback(err2);
67601
- } else {
67602
- self2.bytesWritten += bytes;
67603
- self2.pos += bytes;
67604
- self2.emit("progress");
67605
- cb();
67606
- callback();
67607
- }
67608
- });
67609
- });
67610
- };
67611
- WriteStream.prototype.destroy = function() {
67612
- if (this.destroyed) return;
67613
- this.destroyed = true;
67614
- this.context.unref();
67615
- };
67616
- util6.inherits(BufferSlicer, EventEmitter5);
67617
- function BufferSlicer(buffer, options) {
67618
- EventEmitter5.call(this);
67619
- options = options || {};
67620
- this.refCount = 0;
67621
- this.buffer = buffer;
67622
- this.maxChunkSize = options.maxChunkSize || Number.MAX_SAFE_INTEGER;
67623
- }
67624
- BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
67625
- var end = position + length;
67626
- var delta = end - this.buffer.length;
67627
- var written = delta > 0 ? delta : length;
67628
- this.buffer.copy(buffer, offset, position, end);
67629
- setImmediate(function() {
67630
- callback(null, written);
67631
- });
67632
- };
67633
- BufferSlicer.prototype.write = function(buffer, offset, length, position, callback) {
67634
- buffer.copy(this.buffer, position, offset, offset + length);
67635
- setImmediate(function() {
67636
- callback(null, length, buffer);
67637
- });
67638
- };
67639
- BufferSlicer.prototype.createReadStream = function(options) {
67640
- options = options || {};
67641
- var readStream = new PassThrough2(options);
67642
- readStream.destroyed = false;
67643
- readStream.start = options.start || 0;
67644
- readStream.endOffset = options.end;
67645
- readStream.pos = readStream.endOffset || this.buffer.length;
67646
- var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
67647
- var offset = 0;
67648
- while (true) {
67649
- var nextOffset = offset + this.maxChunkSize;
67650
- if (nextOffset >= entireSlice.length) {
67651
- if (offset < entireSlice.length) {
67652
- readStream.write(entireSlice.slice(offset, entireSlice.length));
67653
- }
67654
- break;
67458
+ function checkEntriesExist() {
67459
+ if (!entries) {
67460
+ throw new Error("storeEntries disabled");
67655
67461
  }
67656
- readStream.write(entireSlice.slice(offset, nextOffset));
67657
- offset = nextOffset;
67658
67462
  }
67659
- readStream.end();
67660
- readStream.destroy = function() {
67661
- readStream.destroyed = true;
67463
+ Object.defineProperty(this, "ready", {
67464
+ get() {
67465
+ return ready;
67466
+ }
67467
+ });
67468
+ this.entry = function(name) {
67469
+ checkEntriesExist();
67470
+ return entries[name];
67471
+ };
67472
+ this.entries = function() {
67473
+ checkEntriesExist();
67474
+ return entries;
67475
+ };
67476
+ this.stream = function(entry, callback) {
67477
+ return this.openEntry(
67478
+ entry,
67479
+ (err, entry2) => {
67480
+ if (err) {
67481
+ return callback(err);
67482
+ }
67483
+ const offset = dataOffset(entry2);
67484
+ let entryStream = new EntryDataReaderStream(fd, offset, entry2.compressedSize);
67485
+ if (entry2.method === consts.STORED) {
67486
+ } else if (entry2.method === consts.DEFLATED) {
67487
+ entryStream = entryStream.pipe(zlib2.createInflateRaw());
67488
+ } else {
67489
+ return callback(new Error("Unknown compression method: " + entry2.method));
67490
+ }
67491
+ if (canVerifyCrc(entry2)) {
67492
+ entryStream = entryStream.pipe(
67493
+ new EntryVerifyStream(entryStream, entry2.crc, entry2.size)
67494
+ );
67495
+ }
67496
+ callback(null, entryStream);
67497
+ },
67498
+ false
67499
+ );
67662
67500
  };
67663
- return readStream;
67664
- };
67665
- BufferSlicer.prototype.createWriteStream = function(options) {
67666
- var bufferSlicer = this;
67667
- options = options || {};
67668
- var writeStream = new Writable3(options);
67669
- writeStream.start = options.start || 0;
67670
- writeStream.endOffset = options.end == null ? this.buffer.length : +options.end;
67671
- writeStream.bytesWritten = 0;
67672
- writeStream.pos = writeStream.start;
67673
- writeStream.destroyed = false;
67674
- writeStream._write = function(buffer, encoding, callback) {
67675
- if (writeStream.destroyed) return;
67676
- var end = writeStream.pos + buffer.length;
67677
- if (end > writeStream.endOffset) {
67678
- var err = new Error("maximum file length exceeded");
67679
- err.code = "ETOOBIG";
67680
- writeStream.destroyed = true;
67681
- callback(err);
67682
- return;
67501
+ this.entryDataSync = function(entry) {
67502
+ let err = null;
67503
+ this.openEntry(
67504
+ entry,
67505
+ (e4, en2) => {
67506
+ err = e4;
67507
+ entry = en2;
67508
+ },
67509
+ true
67510
+ );
67511
+ if (err) {
67512
+ throw err;
67683
67513
  }
67684
- buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length);
67685
- writeStream.bytesWritten += buffer.length;
67686
- writeStream.pos = end;
67687
- writeStream.emit("progress");
67688
- callback();
67514
+ let data2 = Buffer.alloc(entry.compressedSize);
67515
+ new FsRead(fd, data2, 0, entry.compressedSize, dataOffset(entry), (e4) => {
67516
+ err = e4;
67517
+ }).read(true);
67518
+ if (err) {
67519
+ throw err;
67520
+ }
67521
+ if (entry.method === consts.STORED) {
67522
+ } else if (entry.method === consts.DEFLATED || entry.method === consts.ENHANCED_DEFLATED) {
67523
+ data2 = zlib2.inflateRawSync(data2);
67524
+ } else {
67525
+ throw new Error("Unknown compression method: " + entry.method);
67526
+ }
67527
+ if (data2.length !== entry.size) {
67528
+ throw new Error("Invalid size");
67529
+ }
67530
+ if (canVerifyCrc(entry)) {
67531
+ const verify = new CrcVerify(entry.crc, entry.size);
67532
+ verify.data(data2);
67533
+ }
67534
+ return data2;
67689
67535
  };
67690
- writeStream.destroy = function() {
67691
- writeStream.destroyed = true;
67536
+ this.openEntry = function(entry, callback, sync2) {
67537
+ if (typeof entry === "string") {
67538
+ checkEntriesExist();
67539
+ entry = entries[entry];
67540
+ if (!entry) {
67541
+ return callback(new Error("Entry not found"));
67542
+ }
67543
+ }
67544
+ if (!entry.isFile) {
67545
+ return callback(new Error("Entry is not file"));
67546
+ }
67547
+ if (!fd) {
67548
+ return callback(new Error("Archive closed"));
67549
+ }
67550
+ const buffer = Buffer.alloc(consts.LOCHDR);
67551
+ new FsRead(fd, buffer, 0, buffer.length, entry.offset, (err) => {
67552
+ if (err) {
67553
+ return callback(err);
67554
+ }
67555
+ let readEx;
67556
+ try {
67557
+ entry.readDataHeader(buffer);
67558
+ if (entry.encrypted) {
67559
+ readEx = new Error("Entry encrypted");
67560
+ }
67561
+ } catch (ex) {
67562
+ readEx = ex;
67563
+ }
67564
+ callback(readEx, entry);
67565
+ }).read(sync2);
67692
67566
  };
67693
- return writeStream;
67694
- };
67695
- BufferSlicer.prototype.ref = function() {
67696
- this.refCount += 1;
67697
- };
67698
- BufferSlicer.prototype.unref = function() {
67699
- this.refCount -= 1;
67700
- if (this.refCount < 0) {
67701
- throw new Error("invalid unref");
67567
+ function dataOffset(entry) {
67568
+ return entry.offset + consts.LOCHDR + entry.fnameLen + entry.extraLen;
67702
67569
  }
67703
- };
67704
- function createFromBuffer(buffer, options) {
67705
- return new BufferSlicer(buffer, options);
67706
- }
67707
- function createFromFd(fd, options) {
67708
- return new FdSlicer(fd, options);
67709
- }
67710
- }
67711
- });
67712
-
67713
- // node_modules/.pnpm/buffer-crc32@0.2.13/node_modules/buffer-crc32/index.js
67714
- var require_buffer_crc32 = __commonJS({
67715
- "node_modules/.pnpm/buffer-crc32@0.2.13/node_modules/buffer-crc32/index.js"(exports2, module2) {
67716
- init_import_meta_url();
67717
- var Buffer2 = require("buffer").Buffer;
67718
- var CRC_TABLE = [
67719
- 0,
67720
- 1996959894,
67721
- 3993919788,
67722
- 2567524794,
67723
- 124634137,
67724
- 1886057615,
67725
- 3915621685,
67726
- 2657392035,
67727
- 249268274,
67728
- 2044508324,
67729
- 3772115230,
67730
- 2547177864,
67731
- 162941995,
67732
- 2125561021,
67733
- 3887607047,
67734
- 2428444049,
67735
- 498536548,
67736
- 1789927666,
67737
- 4089016648,
67738
- 2227061214,
67739
- 450548861,
67740
- 1843258603,
67741
- 4107580753,
67742
- 2211677639,
67743
- 325883990,
67744
- 1684777152,
67745
- 4251122042,
67746
- 2321926636,
67747
- 335633487,
67748
- 1661365465,
67749
- 4195302755,
67750
- 2366115317,
67751
- 997073096,
67752
- 1281953886,
67753
- 3579855332,
67754
- 2724688242,
67755
- 1006888145,
67756
- 1258607687,
67757
- 3524101629,
67758
- 2768942443,
67759
- 901097722,
67760
- 1119000684,
67761
- 3686517206,
67762
- 2898065728,
67763
- 853044451,
67764
- 1172266101,
67765
- 3705015759,
67766
- 2882616665,
67767
- 651767980,
67768
- 1373503546,
67769
- 3369554304,
67770
- 3218104598,
67771
- 565507253,
67772
- 1454621731,
67773
- 3485111705,
67774
- 3099436303,
67775
- 671266974,
67776
- 1594198024,
67777
- 3322730930,
67778
- 2970347812,
67779
- 795835527,
67780
- 1483230225,
67781
- 3244367275,
67782
- 3060149565,
67783
- 1994146192,
67784
- 31158534,
67785
- 2563907772,
67786
- 4023717930,
67787
- 1907459465,
67788
- 112637215,
67789
- 2680153253,
67790
- 3904427059,
67791
- 2013776290,
67792
- 251722036,
67793
- 2517215374,
67794
- 3775830040,
67795
- 2137656763,
67796
- 141376813,
67797
- 2439277719,
67798
- 3865271297,
67799
- 1802195444,
67800
- 476864866,
67801
- 2238001368,
67802
- 4066508878,
67803
- 1812370925,
67804
- 453092731,
67805
- 2181625025,
67806
- 4111451223,
67807
- 1706088902,
67808
- 314042704,
67809
- 2344532202,
67810
- 4240017532,
67811
- 1658658271,
67812
- 366619977,
67813
- 2362670323,
67814
- 4224994405,
67815
- 1303535960,
67816
- 984961486,
67817
- 2747007092,
67818
- 3569037538,
67819
- 1256170817,
67820
- 1037604311,
67821
- 2765210733,
67822
- 3554079995,
67823
- 1131014506,
67824
- 879679996,
67825
- 2909243462,
67826
- 3663771856,
67827
- 1141124467,
67828
- 855842277,
67829
- 2852801631,
67830
- 3708648649,
67831
- 1342533948,
67832
- 654459306,
67833
- 3188396048,
67834
- 3373015174,
67835
- 1466479909,
67836
- 544179635,
67837
- 3110523913,
67838
- 3462522015,
67839
- 1591671054,
67840
- 702138776,
67841
- 2966460450,
67842
- 3352799412,
67843
- 1504918807,
67844
- 783551873,
67845
- 3082640443,
67846
- 3233442989,
67847
- 3988292384,
67848
- 2596254646,
67849
- 62317068,
67850
- 1957810842,
67851
- 3939845945,
67852
- 2647816111,
67853
- 81470997,
67854
- 1943803523,
67855
- 3814918930,
67856
- 2489596804,
67857
- 225274430,
67858
- 2053790376,
67859
- 3826175755,
67860
- 2466906013,
67861
- 167816743,
67862
- 2097651377,
67863
- 4027552580,
67864
- 2265490386,
67865
- 503444072,
67866
- 1762050814,
67867
- 4150417245,
67868
- 2154129355,
67869
- 426522225,
67870
- 1852507879,
67871
- 4275313526,
67872
- 2312317920,
67873
- 282753626,
67874
- 1742555852,
67875
- 4189708143,
67876
- 2394877945,
67877
- 397917763,
67878
- 1622183637,
67879
- 3604390888,
67880
- 2714866558,
67881
- 953729732,
67882
- 1340076626,
67883
- 3518719985,
67884
- 2797360999,
67885
- 1068828381,
67886
- 1219638859,
67887
- 3624741850,
67888
- 2936675148,
67889
- 906185462,
67890
- 1090812512,
67891
- 3747672003,
67892
- 2825379669,
67893
- 829329135,
67894
- 1181335161,
67895
- 3412177804,
67896
- 3160834842,
67897
- 628085408,
67898
- 1382605366,
67899
- 3423369109,
67900
- 3138078467,
67901
- 570562233,
67902
- 1426400815,
67903
- 3317316542,
67904
- 2998733608,
67905
- 733239954,
67906
- 1555261956,
67907
- 3268935591,
67908
- 3050360625,
67909
- 752459403,
67910
- 1541320221,
67911
- 2607071920,
67912
- 3965973030,
67913
- 1969922972,
67914
- 40735498,
67915
- 2617837225,
67916
- 3943577151,
67917
- 1913087877,
67918
- 83908371,
67919
- 2512341634,
67920
- 3803740692,
67921
- 2075208622,
67922
- 213261112,
67923
- 2463272603,
67924
- 3855990285,
67925
- 2094854071,
67926
- 198958881,
67927
- 2262029012,
67928
- 4057260610,
67929
- 1759359992,
67930
- 534414190,
67931
- 2176718541,
67932
- 4139329115,
67933
- 1873836001,
67934
- 414664567,
67935
- 2282248934,
67936
- 4279200368,
67937
- 1711684554,
67938
- 285281116,
67939
- 2405801727,
67940
- 4167216745,
67941
- 1634467795,
67942
- 376229701,
67943
- 2685067896,
67944
- 3608007406,
67945
- 1308918612,
67946
- 956543938,
67947
- 2808555105,
67948
- 3495958263,
67949
- 1231636301,
67950
- 1047427035,
67951
- 2932959818,
67952
- 3654703836,
67953
- 1088359270,
67954
- 936918e3,
67955
- 2847714899,
67956
- 3736837829,
67957
- 1202900863,
67958
- 817233897,
67959
- 3183342108,
67960
- 3401237130,
67961
- 1404277552,
67962
- 615818150,
67963
- 3134207493,
67964
- 3453421203,
67965
- 1423857449,
67966
- 601450431,
67967
- 3009837614,
67968
- 3294710456,
67969
- 1567103746,
67970
- 711928724,
67971
- 3020668471,
67972
- 3272380065,
67973
- 1510334235,
67974
- 755167117
67975
- ];
67976
- if (typeof Int32Array !== "undefined") {
67977
- CRC_TABLE = new Int32Array(CRC_TABLE);
67978
- }
67979
- function ensureBuffer(input) {
67980
- if (Buffer2.isBuffer(input)) {
67981
- return input;
67982
- }
67983
- var hasNewBufferAPI = typeof Buffer2.alloc === "function" && typeof Buffer2.from === "function";
67984
- if (typeof input === "number") {
67985
- return hasNewBufferAPI ? Buffer2.alloc(input) : new Buffer2(input);
67986
- } else if (typeof input === "string") {
67987
- return hasNewBufferAPI ? Buffer2.from(input) : new Buffer2(input);
67988
- } else {
67989
- throw new Error("input must be buffer, number, or string, received " + typeof input);
67990
- }
67991
- }
67992
- function bufferizeInt(num) {
67993
- var tmp2 = ensureBuffer(4);
67994
- tmp2.writeInt32BE(num, 0);
67995
- return tmp2;
67996
- }
67997
- function _crc32(buf, previous) {
67998
- buf = ensureBuffer(buf);
67999
- if (Buffer2.isBuffer(previous)) {
68000
- previous = previous.readUInt32BE(0);
68001
- }
68002
- var crc = ~~previous ^ -1;
68003
- for (var n4 = 0; n4 < buf.length; n4++) {
68004
- crc = CRC_TABLE[(crc ^ buf[n4]) & 255] ^ crc >>> 8;
67570
+ function canVerifyCrc(entry) {
67571
+ return (entry.flags & 8) !== 8;
68005
67572
  }
68006
- return crc ^ -1;
68007
- }
68008
- function crc32() {
68009
- return bufferizeInt(_crc32.apply(null, arguments));
68010
- }
68011
- crc32.signed = function() {
68012
- return _crc32.apply(null, arguments);
68013
- };
68014
- crc32.unsigned = function() {
68015
- return _crc32.apply(null, arguments) >>> 0;
68016
- };
68017
- module2.exports = crc32;
68018
- }
68019
- });
68020
-
68021
- // node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js
68022
- var require_yauzl = __commonJS({
68023
- "node_modules/.pnpm/yauzl@2.10.0/node_modules/yauzl/index.js"(exports2) {
68024
- init_import_meta_url();
68025
- var fs15 = require("fs");
68026
- var zlib2 = require("zlib");
68027
- var fd_slicer = require_fd_slicer();
68028
- var crc32 = require_buffer_crc32();
68029
- var util6 = require("util");
68030
- var EventEmitter5 = require("events").EventEmitter;
68031
- var Transform3 = require("stream").Transform;
68032
- var PassThrough2 = require("stream").PassThrough;
68033
- var Writable3 = require("stream").Writable;
68034
- exports2.open = open;
68035
- exports2.fromFd = fromFd;
68036
- exports2.fromBuffer = fromBuffer;
68037
- exports2.fromRandomAccessReader = fromRandomAccessReader;
68038
- exports2.dosDateTimeToDate = dosDateTimeToDate;
68039
- exports2.validateFileName = validateFileName;
68040
- exports2.ZipFile = ZipFile;
68041
- exports2.Entry = Entry;
68042
- exports2.RandomAccessReader = RandomAccessReader;
68043
- function open(path18, options, callback) {
68044
- if (typeof options === "function") {
68045
- callback = options;
68046
- options = null;
68047
- }
68048
- if (options == null) options = {};
68049
- if (options.autoClose == null) options.autoClose = true;
68050
- if (options.lazyEntries == null) options.lazyEntries = false;
68051
- if (options.decodeStrings == null) options.decodeStrings = true;
68052
- if (options.validateEntrySizes == null) options.validateEntrySizes = true;
68053
- if (options.strictFileNames == null) options.strictFileNames = false;
68054
- if (callback == null) callback = defaultCallback;
68055
- fs15.open(path18, "r", function(err, fd) {
68056
- if (err) return callback(err);
68057
- fromFd(fd, options, function(err2, zipfile) {
68058
- if (err2) fs15.close(fd, defaultCallback);
68059
- callback(err2, zipfile);
68060
- });
68061
- });
68062
- }
68063
- function fromFd(fd, options, callback) {
68064
- if (typeof options === "function") {
68065
- callback = options;
68066
- options = null;
68067
- }
68068
- if (options == null) options = {};
68069
- if (options.autoClose == null) options.autoClose = false;
68070
- if (options.lazyEntries == null) options.lazyEntries = false;
68071
- if (options.decodeStrings == null) options.decodeStrings = true;
68072
- if (options.validateEntrySizes == null) options.validateEntrySizes = true;
68073
- if (options.strictFileNames == null) options.strictFileNames = false;
68074
- if (callback == null) callback = defaultCallback;
68075
- fs15.fstat(fd, function(err, stats) {
68076
- if (err) return callback(err);
68077
- var reader = fd_slicer.createFromFd(fd, { autoClose: true });
68078
- fromRandomAccessReader(reader, stats.size, options, callback);
68079
- });
68080
- }
68081
- function fromBuffer(buffer, options, callback) {
68082
- if (typeof options === "function") {
68083
- callback = options;
68084
- options = null;
68085
- }
68086
- if (options == null) options = {};
68087
- options.autoClose = false;
68088
- if (options.lazyEntries == null) options.lazyEntries = false;
68089
- if (options.decodeStrings == null) options.decodeStrings = true;
68090
- if (options.validateEntrySizes == null) options.validateEntrySizes = true;
68091
- if (options.strictFileNames == null) options.strictFileNames = false;
68092
- var reader = fd_slicer.createFromBuffer(buffer, { maxChunkSize: 65536 });
68093
- fromRandomAccessReader(reader, buffer.length, options, callback);
68094
- }
68095
- function fromRandomAccessReader(reader, totalSize, options, callback) {
68096
- if (typeof options === "function") {
68097
- callback = options;
68098
- options = null;
68099
- }
68100
- if (options == null) options = {};
68101
- if (options.autoClose == null) options.autoClose = true;
68102
- if (options.lazyEntries == null) options.lazyEntries = false;
68103
- if (options.decodeStrings == null) options.decodeStrings = true;
68104
- var decodeStrings = !!options.decodeStrings;
68105
- if (options.validateEntrySizes == null) options.validateEntrySizes = true;
68106
- if (options.strictFileNames == null) options.strictFileNames = false;
68107
- if (callback == null) callback = defaultCallback;
68108
- if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number");
68109
- if (totalSize > Number.MAX_SAFE_INTEGER) {
68110
- 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.");
68111
- }
68112
- reader.ref();
68113
- var eocdrWithoutCommentSize = 22;
68114
- var maxCommentSize = 65535;
68115
- var bufferSize = Math.min(eocdrWithoutCommentSize + maxCommentSize, totalSize);
68116
- var buffer = newBuffer(bufferSize);
68117
- var bufferReadStart = totalSize - buffer.length;
68118
- readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) {
68119
- if (err) return callback(err);
68120
- for (var i5 = bufferSize - eocdrWithoutCommentSize; i5 >= 0; i5 -= 1) {
68121
- if (buffer.readUInt32LE(i5) !== 101010256) continue;
68122
- var eocdrBuffer = buffer.slice(i5);
68123
- var diskNumber = eocdrBuffer.readUInt16LE(4);
68124
- if (diskNumber !== 0) {
68125
- return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
68126
- }
68127
- var entryCount = eocdrBuffer.readUInt16LE(10);
68128
- var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
68129
- var commentLength = eocdrBuffer.readUInt16LE(20);
68130
- var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
68131
- if (commentLength !== expectedCommentLength) {
68132
- return callback(new Error("invalid comment length. expected: " + expectedCommentLength + ". found: " + commentLength));
68133
- }
68134
- var comment = decodeStrings ? decodeBuffer(eocdrBuffer, 22, eocdrBuffer.length, false) : eocdrBuffer.slice(22);
68135
- if (!(entryCount === 65535 || centralDirectoryOffset === 4294967295)) {
68136
- return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
68137
- }
68138
- var zip64EocdlBuffer = newBuffer(20);
68139
- var zip64EocdlOffset = bufferReadStart + i5 - zip64EocdlBuffer.length;
68140
- readAndAssertNoEof(reader, zip64EocdlBuffer, 0, zip64EocdlBuffer.length, zip64EocdlOffset, function(err2) {
68141
- if (err2) return callback(err2);
68142
- if (zip64EocdlBuffer.readUInt32LE(0) !== 117853008) {
68143
- return callback(new Error("invalid zip64 end of central directory locator signature"));
68144
- }
68145
- var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
68146
- var zip64EocdrBuffer = newBuffer(56);
68147
- readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err3) {
68148
- if (err3) return callback(err3);
68149
- if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
68150
- return callback(new Error("invalid zip64 end of central directory record signature"));
67573
+ function extract(entry, outPath, callback) {
67574
+ that.stream(entry, (err, stm) => {
67575
+ if (err) {
67576
+ callback(err);
67577
+ } else {
67578
+ let fsStm, errThrown;
67579
+ stm.on("error", (err2) => {
67580
+ errThrown = err2;
67581
+ if (fsStm) {
67582
+ stm.unpipe(fsStm);
67583
+ fsStm.close(() => {
67584
+ callback(err2);
67585
+ });
68151
67586
  }
68152
- entryCount = readUInt64LE(zip64EocdrBuffer, 32);
68153
- centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
68154
- return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
68155
67587
  });
68156
- });
68157
- return;
68158
- }
68159
- callback(new Error("end of central directory record signature not found"));
68160
- });
68161
- }
68162
- util6.inherits(ZipFile, EventEmitter5);
68163
- function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
68164
- var self2 = this;
68165
- EventEmitter5.call(self2);
68166
- self2.reader = reader;
68167
- self2.reader.on("error", function(err) {
68168
- emitError(self2, err);
68169
- });
68170
- self2.reader.once("close", function() {
68171
- self2.emit("close");
68172
- });
68173
- self2.readEntryCursor = centralDirectoryOffset;
68174
- self2.fileSize = fileSize;
68175
- self2.entryCount = entryCount;
68176
- self2.comment = comment;
68177
- self2.entriesRead = 0;
68178
- self2.autoClose = !!autoClose;
68179
- self2.lazyEntries = !!lazyEntries;
68180
- self2.decodeStrings = !!decodeStrings;
68181
- self2.validateEntrySizes = !!validateEntrySizes;
68182
- self2.strictFileNames = !!strictFileNames;
68183
- self2.isOpen = true;
68184
- self2.emittedError = false;
68185
- if (!self2.lazyEntries) self2._readEntry();
68186
- }
68187
- ZipFile.prototype.close = function() {
68188
- if (!this.isOpen) return;
68189
- this.isOpen = false;
68190
- this.reader.unref();
68191
- };
68192
- function emitErrorAndAutoClose(self2, err) {
68193
- if (self2.autoClose) self2.close();
68194
- emitError(self2, err);
68195
- }
68196
- function emitError(self2, err) {
68197
- if (self2.emittedError) return;
68198
- self2.emittedError = true;
68199
- self2.emit("error", err);
68200
- }
68201
- ZipFile.prototype.readEntry = function() {
68202
- if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true");
68203
- this._readEntry();
68204
- };
68205
- ZipFile.prototype._readEntry = function() {
68206
- var self2 = this;
68207
- if (self2.entryCount === self2.entriesRead) {
68208
- setImmediate(function() {
68209
- if (self2.autoClose) self2.close();
68210
- if (self2.emittedError) return;
68211
- self2.emit("end");
68212
- });
68213
- return;
68214
- }
68215
- if (self2.emittedError) return;
68216
- var buffer = newBuffer(46);
68217
- readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, self2.readEntryCursor, function(err) {
68218
- if (err) return emitErrorAndAutoClose(self2, err);
68219
- if (self2.emittedError) return;
68220
- var entry = new Entry();
68221
- var signature = buffer.readUInt32LE(0);
68222
- if (signature !== 33639248) return emitErrorAndAutoClose(self2, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
68223
- entry.versionMadeBy = buffer.readUInt16LE(4);
68224
- entry.versionNeededToExtract = buffer.readUInt16LE(6);
68225
- entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
68226
- entry.compressionMethod = buffer.readUInt16LE(10);
68227
- entry.lastModFileTime = buffer.readUInt16LE(12);
68228
- entry.lastModFileDate = buffer.readUInt16LE(14);
68229
- entry.crc32 = buffer.readUInt32LE(16);
68230
- entry.compressedSize = buffer.readUInt32LE(20);
68231
- entry.uncompressedSize = buffer.readUInt32LE(24);
68232
- entry.fileNameLength = buffer.readUInt16LE(28);
68233
- entry.extraFieldLength = buffer.readUInt16LE(30);
68234
- entry.fileCommentLength = buffer.readUInt16LE(32);
68235
- entry.internalFileAttributes = buffer.readUInt16LE(36);
68236
- entry.externalFileAttributes = buffer.readUInt32LE(38);
68237
- entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
68238
- if (entry.generalPurposeBitFlag & 64) return emitErrorAndAutoClose(self2, new Error("strong encryption is not supported"));
68239
- self2.readEntryCursor += 46;
68240
- buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
68241
- readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, self2.readEntryCursor, function(err2) {
68242
- if (err2) return emitErrorAndAutoClose(self2, err2);
68243
- if (self2.emittedError) return;
68244
- var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
68245
- entry.fileName = self2.decodeStrings ? decodeBuffer(buffer, 0, entry.fileNameLength, isUtf8) : buffer.slice(0, entry.fileNameLength);
68246
- var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
68247
- var extraFieldBuffer = buffer.slice(entry.fileNameLength, fileCommentStart);
68248
- entry.extraFields = [];
68249
- var i5 = 0;
68250
- while (i5 < extraFieldBuffer.length - 3) {
68251
- var headerId = extraFieldBuffer.readUInt16LE(i5 + 0);
68252
- var dataSize = extraFieldBuffer.readUInt16LE(i5 + 2);
68253
- var dataStart = i5 + 4;
68254
- var dataEnd = dataStart + dataSize;
68255
- if (dataEnd > extraFieldBuffer.length) return emitErrorAndAutoClose(self2, new Error("extra field length exceeds extra field buffer size"));
68256
- var dataBuffer = newBuffer(dataSize);
68257
- extraFieldBuffer.copy(dataBuffer, 0, dataStart, dataEnd);
68258
- entry.extraFields.push({
68259
- id: headerId,
68260
- data: dataBuffer
68261
- });
68262
- i5 = dataEnd;
68263
- }
68264
- entry.fileComment = self2.decodeStrings ? decodeBuffer(buffer, fileCommentStart, fileCommentStart + entry.fileCommentLength, isUtf8) : buffer.slice(fileCommentStart, fileCommentStart + entry.fileCommentLength);
68265
- entry.comment = entry.fileComment;
68266
- self2.readEntryCursor += buffer.length;
68267
- self2.entriesRead += 1;
68268
- if (entry.uncompressedSize === 4294967295 || entry.compressedSize === 4294967295 || entry.relativeOffsetOfLocalHeader === 4294967295) {
68269
- var zip64EiefBuffer = null;
68270
- for (var i5 = 0; i5 < entry.extraFields.length; i5++) {
68271
- var extraField = entry.extraFields[i5];
68272
- if (extraField.id === 1) {
68273
- zip64EiefBuffer = extraField.data;
68274
- break;
68275
- }
68276
- }
68277
- if (zip64EiefBuffer == null) {
68278
- return emitErrorAndAutoClose(self2, new Error("expected zip64 extended information extra field"));
68279
- }
68280
- var index = 0;
68281
- if (entry.uncompressedSize === 4294967295) {
68282
- if (index + 8 > zip64EiefBuffer.length) {
68283
- return emitErrorAndAutoClose(self2, new Error("zip64 extended information extra field does not include uncompressed size"));
68284
- }
68285
- entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
68286
- index += 8;
68287
- }
68288
- if (entry.compressedSize === 4294967295) {
68289
- if (index + 8 > zip64EiefBuffer.length) {
68290
- return emitErrorAndAutoClose(self2, new Error("zip64 extended information extra field does not include compressed size"));
67588
+ fs15.open(outPath, "w", (err2, fdFile) => {
67589
+ if (err2) {
67590
+ return callback(err2);
68291
67591
  }
68292
- entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
68293
- index += 8;
68294
- }
68295
- if (entry.relativeOffsetOfLocalHeader === 4294967295) {
68296
- if (index + 8 > zip64EiefBuffer.length) {
68297
- return emitErrorAndAutoClose(self2, new Error("zip64 extended information extra field does not include relative header offset"));
67592
+ if (errThrown) {
67593
+ fs15.close(fd, () => {
67594
+ callback(errThrown);
67595
+ });
67596
+ return;
68298
67597
  }
68299
- entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
68300
- index += 8;
68301
- }
68302
- }
68303
- if (self2.decodeStrings) {
68304
- for (var i5 = 0; i5 < entry.extraFields.length; i5++) {
68305
- var extraField = entry.extraFields[i5];
68306
- if (extraField.id === 28789) {
68307
- if (extraField.data.length < 6) {
68308
- continue;
68309
- }
68310
- if (extraField.data.readUInt8(0) !== 1) {
68311
- continue;
68312
- }
68313
- var oldNameCrc32 = extraField.data.readUInt32LE(1);
68314
- if (crc32.unsigned(buffer.slice(0, entry.fileNameLength)) !== oldNameCrc32) {
68315
- continue;
67598
+ fsStm = fs15.createWriteStream(outPath, { fd: fdFile });
67599
+ fsStm.on("finish", () => {
67600
+ that.emit("extract", entry, outPath);
67601
+ if (!errThrown) {
67602
+ callback();
68316
67603
  }
68317
- entry.fileName = decodeBuffer(extraField.data, 5, extraField.data.length, true);
68318
- break;
68319
- }
68320
- }
68321
- }
68322
- if (self2.validateEntrySizes && entry.compressionMethod === 0) {
68323
- var expectedCompressedSize = entry.uncompressedSize;
68324
- if (entry.isEncrypted()) {
68325
- expectedCompressedSize += 12;
68326
- }
68327
- if (entry.compressedSize !== expectedCompressedSize) {
68328
- var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
68329
- return emitErrorAndAutoClose(self2, new Error(msg));
68330
- }
68331
- }
68332
- if (self2.decodeStrings) {
68333
- if (!self2.strictFileNames) {
68334
- entry.fileName = entry.fileName.replace(/\\/g, "/");
68335
- }
68336
- var errorMessage = validateFileName(entry.fileName, self2.validateFileNameOptions);
68337
- if (errorMessage != null) return emitErrorAndAutoClose(self2, new Error(errorMessage));
67604
+ });
67605
+ stm.pipe(fsStm);
67606
+ });
68338
67607
  }
68339
- self2.emit("entry", entry);
68340
- if (!self2.lazyEntries) self2._readEntry();
68341
67608
  });
68342
- });
68343
- };
68344
- ZipFile.prototype.openReadStream = function(entry, options, callback) {
68345
- var self2 = this;
68346
- var relativeStart = 0;
68347
- var relativeEnd = entry.compressedSize;
68348
- if (callback == null) {
68349
- callback = options;
68350
- options = {};
68351
- } else {
68352
- if (options.decrypt != null) {
68353
- if (!entry.isEncrypted()) {
68354
- throw new Error("options.decrypt can only be specified for encrypted entries");
68355
- }
68356
- if (options.decrypt !== false) throw new Error("invalid options.decrypt value: " + options.decrypt);
68357
- if (entry.isCompressed()) {
68358
- if (options.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false");
68359
- }
67609
+ }
67610
+ function createDirectories(baseDir, dirs, callback) {
67611
+ if (!dirs.length) {
67612
+ return callback();
68360
67613
  }
68361
- if (options.decompress != null) {
68362
- if (!entry.isCompressed()) {
68363
- throw new Error("options.decompress can only be specified for compressed entries");
68364
- }
68365
- if (!(options.decompress === false || options.decompress === true)) {
68366
- throw new Error("invalid options.decompress value: " + options.decompress);
67614
+ let dir = dirs.shift();
67615
+ dir = path18.join(baseDir, path18.join(...dir));
67616
+ fs15.mkdir(dir, { recursive: true }, (err) => {
67617
+ if (err && err.code !== "EEXIST") {
67618
+ return callback(err);
68367
67619
  }
67620
+ createDirectories(baseDir, dirs, callback);
67621
+ });
67622
+ }
67623
+ function extractFiles(baseDir, baseRelPath, files, callback, extractedCount) {
67624
+ if (!files.length) {
67625
+ return callback(null, extractedCount);
68368
67626
  }
68369
- if (options.start != null || options.end != null) {
68370
- if (entry.isCompressed() && options.decompress !== false) {
68371
- throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
68372
- }
68373
- if (entry.isEncrypted() && options.decrypt !== false) {
68374
- throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
67627
+ const file = files.shift();
67628
+ const targetPath = path18.join(baseDir, file.name.replace(baseRelPath, ""));
67629
+ extract(file, targetPath, (err) => {
67630
+ if (err) {
67631
+ return callback(err, extractedCount);
68375
67632
  }
68376
- }
68377
- if (options.start != null) {
68378
- relativeStart = options.start;
68379
- if (relativeStart < 0) throw new Error("options.start < 0");
68380
- if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize");
68381
- }
68382
- if (options.end != null) {
68383
- relativeEnd = options.end;
68384
- if (relativeEnd < 0) throw new Error("options.end < 0");
68385
- if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize");
68386
- if (relativeEnd < relativeStart) throw new Error("options.end < options.start");
68387
- }
68388
- }
68389
- if (!self2.isOpen) return callback(new Error("closed"));
68390
- if (entry.isEncrypted()) {
68391
- if (options.decrypt !== false) return callback(new Error("entry is encrypted, and options.decrypt !== false"));
67633
+ extractFiles(baseDir, baseRelPath, files, callback, extractedCount + 1);
67634
+ });
68392
67635
  }
68393
- self2.reader.ref();
68394
- var buffer = newBuffer(30);
68395
- readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
68396
- try {
68397
- if (err) return callback(err);
68398
- var signature = buffer.readUInt32LE(0);
68399
- if (signature !== 67324752) {
68400
- return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
68401
- }
68402
- var fileNameLength = buffer.readUInt16LE(26);
68403
- var extraFieldLength = buffer.readUInt16LE(28);
68404
- var localFileHeaderEnd = entry.relativeOffsetOfLocalHeader + buffer.length + fileNameLength + extraFieldLength;
68405
- var decompress;
68406
- if (entry.compressionMethod === 0) {
68407
- decompress = false;
68408
- } else if (entry.compressionMethod === 8) {
68409
- decompress = options.decompress != null ? options.decompress : true;
67636
+ this.extract = function(entry, outPath, callback) {
67637
+ let entryName = entry || "";
67638
+ if (typeof entry === "string") {
67639
+ entry = this.entry(entry);
67640
+ if (entry) {
67641
+ entryName = entry.name;
68410
67642
  } else {
68411
- return callback(new Error("unsupported compression method: " + entry.compressionMethod));
67643
+ if (entryName.length && entryName[entryName.length - 1] !== "/") {
67644
+ entryName += "/";
67645
+ }
68412
67646
  }
68413
- var fileDataStart = localFileHeaderEnd;
68414
- var fileDataEnd = fileDataStart + entry.compressedSize;
68415
- if (entry.compressedSize !== 0) {
68416
- if (fileDataEnd > self2.fileSize) {
68417
- return callback(new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self2.fileSize));
67647
+ }
67648
+ if (!entry || entry.isDirectory) {
67649
+ const files = [], dirs = [], allDirs = {};
67650
+ for (const e4 in entries) {
67651
+ if (Object.prototype.hasOwnProperty.call(entries, e4) && e4.lastIndexOf(entryName, 0) === 0) {
67652
+ let relPath = e4.replace(entryName, "");
67653
+ const childEntry = entries[e4];
67654
+ if (childEntry.isFile) {
67655
+ files.push(childEntry);
67656
+ relPath = path18.dirname(relPath);
67657
+ }
67658
+ if (relPath && !allDirs[relPath] && relPath !== ".") {
67659
+ allDirs[relPath] = true;
67660
+ let parts = relPath.split("/").filter((f5) => {
67661
+ return f5;
67662
+ });
67663
+ if (parts.length) {
67664
+ dirs.push(parts);
67665
+ }
67666
+ while (parts.length > 1) {
67667
+ parts = parts.slice(0, parts.length - 1);
67668
+ const partsPath = parts.join("/");
67669
+ if (allDirs[partsPath] || partsPath === ".") {
67670
+ break;
67671
+ }
67672
+ allDirs[partsPath] = true;
67673
+ dirs.push(parts);
67674
+ }
67675
+ }
68418
67676
  }
68419
67677
  }
68420
- var readStream = self2.reader.createReadStream({
68421
- start: fileDataStart + relativeStart,
68422
- end: fileDataStart + relativeEnd
67678
+ dirs.sort((x6, y5) => {
67679
+ return x6.length - y5.length;
68423
67680
  });
68424
- var endpointStream = readStream;
68425
- if (decompress) {
68426
- var destroyed = false;
68427
- var inflateFilter = zlib2.createInflateRaw();
68428
- readStream.on("error", function(err2) {
68429
- setImmediate(function() {
68430
- if (!destroyed) inflateFilter.emit("error", err2);
68431
- });
67681
+ if (dirs.length) {
67682
+ createDirectories(outPath, dirs, (err) => {
67683
+ if (err) {
67684
+ callback(err);
67685
+ } else {
67686
+ extractFiles(outPath, entryName, files, callback, 0);
67687
+ }
68432
67688
  });
68433
- readStream.pipe(inflateFilter);
68434
- if (self2.validateEntrySizes) {
68435
- endpointStream = new AssertByteCountStream(entry.uncompressedSize);
68436
- inflateFilter.on("error", function(err2) {
68437
- setImmediate(function() {
68438
- if (!destroyed) endpointStream.emit("error", err2);
68439
- });
68440
- });
68441
- inflateFilter.pipe(endpointStream);
67689
+ } else {
67690
+ extractFiles(outPath, entryName, files, callback, 0);
67691
+ }
67692
+ } else {
67693
+ fs15.stat(outPath, (err, stat) => {
67694
+ if (stat && stat.isDirectory()) {
67695
+ extract(entry, path18.join(outPath, path18.basename(entry.name)), callback);
68442
67696
  } else {
68443
- endpointStream = inflateFilter;
67697
+ extract(entry, outPath, callback);
68444
67698
  }
68445
- endpointStream.destroy = function() {
68446
- destroyed = true;
68447
- if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream);
68448
- readStream.unpipe(inflateFilter);
68449
- readStream.destroy();
68450
- };
67699
+ });
67700
+ }
67701
+ };
67702
+ this.close = function(callback) {
67703
+ if (closed || !fd) {
67704
+ closed = true;
67705
+ if (callback) {
67706
+ callback();
68451
67707
  }
68452
- callback(null, endpointStream);
68453
- } finally {
68454
- self2.reader.unref();
67708
+ } else {
67709
+ closed = true;
67710
+ fs15.close(fd, (err) => {
67711
+ fd = null;
67712
+ if (callback) {
67713
+ callback(err);
67714
+ }
67715
+ });
68455
67716
  }
68456
- });
68457
- };
68458
- function Entry() {
68459
- }
68460
- Entry.prototype.getLastModDate = function() {
68461
- return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime);
68462
- };
68463
- Entry.prototype.isEncrypted = function() {
68464
- return (this.generalPurposeBitFlag & 1) !== 0;
67717
+ };
67718
+ const originalEmit = events.EventEmitter.prototype.emit;
67719
+ this.emit = function(...args) {
67720
+ if (!closed) {
67721
+ return originalEmit.call(this, ...args);
67722
+ }
67723
+ };
68465
67724
  };
68466
- Entry.prototype.isCompressed = function() {
68467
- return this.compressionMethod === 8;
67725
+ StreamZip2.setFs = function(customFs) {
67726
+ fs15 = customFs;
68468
67727
  };
68469
- function dosDateTimeToDate(date2, time2) {
68470
- var day = date2 & 31;
68471
- var month = (date2 >> 5 & 15) - 1;
68472
- var year2 = (date2 >> 9 & 127) + 1980;
68473
- var millisecond = 0;
68474
- var second = (time2 & 31) * 2;
68475
- var minute = time2 >> 5 & 63;
68476
- var hour = time2 >> 11 & 31;
68477
- return new Date(year2, month, day, hour, minute, second, millisecond);
68478
- }
68479
- function validateFileName(fileName) {
68480
- if (fileName.indexOf("\\") !== -1) {
68481
- return "invalid characters in fileName: " + fileName;
67728
+ StreamZip2.debugLog = (...args) => {
67729
+ if (StreamZip2.debug) {
67730
+ console.log(...args);
68482
67731
  }
68483
- if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
68484
- return "absolute path: " + fileName;
68485
- }
68486
- if (fileName.split("/").indexOf("..") !== -1) {
68487
- return "invalid relative path: " + fileName;
68488
- }
68489
- return null;
68490
- }
68491
- function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
68492
- if (length === 0) {
68493
- return setImmediate(function() {
68494
- callback(null, newBuffer(0));
67732
+ };
67733
+ util6.inherits(StreamZip2, events.EventEmitter);
67734
+ var propZip = Symbol("zip");
67735
+ StreamZip2.async = class StreamZipAsync extends events.EventEmitter {
67736
+ constructor(config3) {
67737
+ super();
67738
+ const zip = new StreamZip2(config3);
67739
+ zip.on("entry", (entry) => this.emit("entry", entry));
67740
+ zip.on("extract", (entry, outPath) => this.emit("extract", entry, outPath));
67741
+ this[propZip] = new Promise((resolve7, reject) => {
67742
+ zip.on("ready", () => {
67743
+ zip.removeListener("error", reject);
67744
+ resolve7(zip);
67745
+ });
67746
+ zip.on("error", reject);
68495
67747
  });
68496
67748
  }
68497
- reader.read(buffer, offset, length, position, function(err, bytesRead) {
68498
- if (err) return callback(err);
68499
- if (bytesRead < length) {
68500
- return callback(new Error("unexpected EOF"));
68501
- }
68502
- callback();
68503
- });
68504
- }
68505
- util6.inherits(AssertByteCountStream, Transform3);
68506
- function AssertByteCountStream(byteCount) {
68507
- Transform3.call(this);
68508
- this.actualByteCount = 0;
68509
- this.expectedByteCount = byteCount;
68510
- }
68511
- AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
68512
- this.actualByteCount += chunk.length;
68513
- if (this.actualByteCount > this.expectedByteCount) {
68514
- var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
68515
- return cb(new Error(msg));
67749
+ get entriesCount() {
67750
+ return this[propZip].then((zip) => zip.entriesCount);
68516
67751
  }
68517
- cb(null, chunk);
68518
- };
68519
- AssertByteCountStream.prototype._flush = function(cb) {
68520
- if (this.actualByteCount < this.expectedByteCount) {
68521
- var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
68522
- return cb(new Error(msg));
67752
+ get comment() {
67753
+ return this[propZip].then((zip) => zip.comment);
68523
67754
  }
68524
- cb();
68525
- };
68526
- util6.inherits(RandomAccessReader, EventEmitter5);
68527
- function RandomAccessReader() {
68528
- EventEmitter5.call(this);
68529
- this.refCount = 0;
68530
- }
68531
- RandomAccessReader.prototype.ref = function() {
68532
- this.refCount += 1;
68533
- };
68534
- RandomAccessReader.prototype.unref = function() {
68535
- var self2 = this;
68536
- self2.refCount -= 1;
68537
- if (self2.refCount > 0) return;
68538
- if (self2.refCount < 0) throw new Error("invalid unref");
68539
- self2.close(onCloseDone);
68540
- function onCloseDone(err) {
68541
- if (err) return self2.emit("error", err);
68542
- self2.emit("close");
68543
- }
68544
- };
68545
- RandomAccessReader.prototype.createReadStream = function(options) {
68546
- var start = options.start;
68547
- var end = options.end;
68548
- if (start === end) {
68549
- var emptyStream = new PassThrough2();
68550
- setImmediate(function() {
68551
- emptyStream.end();
68552
- });
68553
- return emptyStream;
67755
+ async entry(name) {
67756
+ const zip = await this[propZip];
67757
+ return zip.entry(name);
68554
67758
  }
68555
- var stream2 = this._readStreamForRange(start, end);
68556
- var destroyed = false;
68557
- var refUnrefFilter = new RefUnrefFilter(this);
68558
- stream2.on("error", function(err) {
68559
- setImmediate(function() {
68560
- if (!destroyed) refUnrefFilter.emit("error", err);
68561
- });
68562
- });
68563
- refUnrefFilter.destroy = function() {
68564
- stream2.unpipe(refUnrefFilter);
68565
- refUnrefFilter.unref();
68566
- stream2.destroy();
68567
- };
68568
- var byteCounter = new AssertByteCountStream(end - start);
68569
- refUnrefFilter.on("error", function(err) {
68570
- setImmediate(function() {
68571
- if (!destroyed) byteCounter.emit("error", err);
68572
- });
68573
- });
68574
- byteCounter.destroy = function() {
68575
- destroyed = true;
68576
- refUnrefFilter.unpipe(byteCounter);
68577
- refUnrefFilter.destroy();
68578
- };
68579
- return stream2.pipe(refUnrefFilter).pipe(byteCounter);
68580
- };
68581
- RandomAccessReader.prototype._readStreamForRange = function(start, end) {
68582
- throw new Error("not implemented");
68583
- };
68584
- RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
68585
- var readStream = this.createReadStream({ start: position, end: position + length });
68586
- var writeStream = new Writable3();
68587
- var written = 0;
68588
- writeStream._write = function(chunk, encoding, cb) {
68589
- chunk.copy(buffer, offset + written, 0, chunk.length);
68590
- written += chunk.length;
68591
- cb();
68592
- };
68593
- writeStream.on("finish", callback);
68594
- readStream.on("error", function(error3) {
68595
- callback(error3);
68596
- });
68597
- readStream.pipe(writeStream);
68598
- };
68599
- RandomAccessReader.prototype.close = function(callback) {
68600
- setImmediate(callback);
68601
- };
68602
- util6.inherits(RefUnrefFilter, PassThrough2);
68603
- function RefUnrefFilter(context2) {
68604
- PassThrough2.call(this);
68605
- this.context = context2;
68606
- this.context.ref();
68607
- this.unreffedYet = false;
68608
- }
68609
- RefUnrefFilter.prototype._flush = function(cb) {
68610
- this.unref();
68611
- cb();
68612
- };
68613
- RefUnrefFilter.prototype.unref = function(cb) {
68614
- if (this.unreffedYet) return;
68615
- this.unreffedYet = true;
68616
- this.context.unref();
68617
- };
68618
- 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";
68619
- function decodeBuffer(buffer, start, end, isUtf8) {
68620
- if (isUtf8) {
68621
- return buffer.toString("utf8", start, end);
68622
- } else {
68623
- var result = "";
68624
- for (var i5 = start; i5 < end; i5++) {
68625
- result += cp437[buffer[i5]];
68626
- }
68627
- return result;
67759
+ async entries() {
67760
+ const zip = await this[propZip];
67761
+ return zip.entries();
68628
67762
  }
68629
- }
68630
- function readUInt64LE(buffer, offset) {
68631
- var lower32 = buffer.readUInt32LE(offset);
68632
- var upper32 = buffer.readUInt32LE(offset + 4);
68633
- return upper32 * 4294967296 + lower32;
68634
- }
68635
- var newBuffer;
68636
- if (typeof Buffer.allocUnsafe === "function") {
68637
- newBuffer = function(len) {
68638
- return Buffer.allocUnsafe(len);
68639
- };
68640
- } else {
68641
- newBuffer = function(len) {
68642
- return new Buffer(len);
68643
- };
68644
- }
68645
- function defaultCallback(err) {
68646
- if (err) throw err;
68647
- }
68648
- }
68649
- });
68650
-
68651
- // node_modules/.pnpm/extract-zip@2.0.1/node_modules/extract-zip/index.js
68652
- var require_extract_zip = __commonJS({
68653
- "node_modules/.pnpm/extract-zip@2.0.1/node_modules/extract-zip/index.js"(exports2, module2) {
68654
- init_import_meta_url();
68655
- var debug3 = require_src3()("extract-zip");
68656
- var { createWriteStream: createWriteStream3, promises: fs15 } = require("fs");
68657
- var getStream = require_get_stream();
68658
- var path18 = require("path");
68659
- var { promisify: promisify5 } = require("util");
68660
- var stream2 = require("stream");
68661
- var yauzl = require_yauzl();
68662
- var openZip = promisify5(yauzl.open);
68663
- var pipeline2 = promisify5(stream2.pipeline);
68664
- var Extractor = class {
68665
- constructor(zipPath, opts) {
68666
- this.zipPath = zipPath;
68667
- this.opts = opts;
67763
+ async stream(entry) {
67764
+ const zip = await this[propZip];
67765
+ return new Promise((resolve7, reject) => {
67766
+ zip.stream(entry, (err, stm) => {
67767
+ if (err) {
67768
+ reject(err);
67769
+ } else {
67770
+ resolve7(stm);
67771
+ }
67772
+ });
67773
+ });
68668
67774
  }
68669
- async extract() {
68670
- debug3("opening", this.zipPath, "with opts", this.opts);
68671
- this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
68672
- this.canceled = false;
67775
+ async entryData(entry) {
67776
+ const stm = await this.stream(entry);
68673
67777
  return new Promise((resolve7, reject) => {
68674
- this.zipfile.on("error", (err) => {
68675
- this.canceled = true;
67778
+ const data2 = [];
67779
+ stm.on("data", (chunk) => data2.push(chunk));
67780
+ stm.on("end", () => {
67781
+ resolve7(Buffer.concat(data2));
67782
+ });
67783
+ stm.on("error", (err) => {
67784
+ stm.removeAllListeners("end");
68676
67785
  reject(err);
68677
67786
  });
68678
- this.zipfile.readEntry();
68679
- this.zipfile.on("close", () => {
68680
- if (!this.canceled) {
68681
- debug3("zip extraction complete");
68682
- resolve7();
67787
+ });
67788
+ }
67789
+ async extract(entry, outPath) {
67790
+ const zip = await this[propZip];
67791
+ return new Promise((resolve7, reject) => {
67792
+ zip.extract(entry, outPath, (err, res) => {
67793
+ if (err) {
67794
+ reject(err);
67795
+ } else {
67796
+ resolve7(res);
68683
67797
  }
68684
67798
  });
68685
- this.zipfile.on("entry", async (entry) => {
68686
- if (this.canceled) {
68687
- debug3("skipping entry", entry.fileName, { cancelled: this.canceled });
68688
- return;
68689
- }
68690
- debug3("zipfile entry", entry.fileName);
68691
- if (entry.fileName.startsWith("__MACOSX/")) {
68692
- this.zipfile.readEntry();
68693
- return;
68694
- }
68695
- const destDir = path18.dirname(path18.join(this.opts.dir, entry.fileName));
68696
- try {
68697
- await fs15.mkdir(destDir, { recursive: true });
68698
- const canonicalDestDir = await fs15.realpath(destDir);
68699
- const relativeDestDir = path18.relative(this.opts.dir, canonicalDestDir);
68700
- if (relativeDestDir.split(path18.sep).includes("..")) {
68701
- throw new Error(`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`);
68702
- }
68703
- await this.extractEntry(entry);
68704
- debug3("finished processing", entry.fileName);
68705
- this.zipfile.readEntry();
68706
- } catch (err) {
68707
- this.canceled = true;
68708
- this.zipfile.close();
67799
+ });
67800
+ }
67801
+ async close() {
67802
+ const zip = await this[propZip];
67803
+ return new Promise((resolve7, reject) => {
67804
+ zip.close((err) => {
67805
+ if (err) {
68709
67806
  reject(err);
67807
+ } else {
67808
+ resolve7();
68710
67809
  }
68711
67810
  });
68712
67811
  });
68713
67812
  }
68714
- async extractEntry(entry) {
68715
- if (this.canceled) {
68716
- debug3("skipping entry extraction", entry.fileName, { cancelled: this.canceled });
68717
- return;
67813
+ };
67814
+ var CentralDirectoryHeader = class {
67815
+ read(data2) {
67816
+ if (data2.length !== consts.ENDHDR || data2.readUInt32LE(0) !== consts.ENDSIG) {
67817
+ throw new Error("Invalid central directory");
67818
+ }
67819
+ this.volumeEntries = data2.readUInt16LE(consts.ENDSUB);
67820
+ this.totalEntries = data2.readUInt16LE(consts.ENDTOT);
67821
+ this.size = data2.readUInt32LE(consts.ENDSIZ);
67822
+ this.offset = data2.readUInt32LE(consts.ENDOFF);
67823
+ this.commentLength = data2.readUInt16LE(consts.ENDCOM);
67824
+ }
67825
+ };
67826
+ var CentralDirectoryLoc64Header = class {
67827
+ read(data2) {
67828
+ if (data2.length !== consts.ENDL64HDR || data2.readUInt32LE(0) !== consts.ENDL64SIG) {
67829
+ throw new Error("Invalid zip64 central directory locator");
67830
+ }
67831
+ this.headerOffset = readUInt64LE(data2, consts.ENDSUB);
67832
+ }
67833
+ };
67834
+ var CentralDirectoryZip64Header = class {
67835
+ read(data2) {
67836
+ if (data2.length !== consts.END64HDR || data2.readUInt32LE(0) !== consts.END64SIG) {
67837
+ throw new Error("Invalid central directory");
67838
+ }
67839
+ this.volumeEntries = readUInt64LE(data2, consts.END64SUB);
67840
+ this.totalEntries = readUInt64LE(data2, consts.END64TOT);
67841
+ this.size = readUInt64LE(data2, consts.END64SIZ);
67842
+ this.offset = readUInt64LE(data2, consts.END64OFF);
67843
+ }
67844
+ };
67845
+ var ZipEntry = class {
67846
+ readHeader(data2, offset) {
67847
+ if (data2.length < offset + consts.CENHDR || data2.readUInt32LE(offset) !== consts.CENSIG) {
67848
+ throw new Error("Invalid entry header");
67849
+ }
67850
+ this.verMade = data2.readUInt16LE(offset + consts.CENVEM);
67851
+ this.version = data2.readUInt16LE(offset + consts.CENVER);
67852
+ this.flags = data2.readUInt16LE(offset + consts.CENFLG);
67853
+ this.method = data2.readUInt16LE(offset + consts.CENHOW);
67854
+ const timebytes = data2.readUInt16LE(offset + consts.CENTIM);
67855
+ const datebytes = data2.readUInt16LE(offset + consts.CENTIM + 2);
67856
+ this.time = parseZipTime(timebytes, datebytes);
67857
+ this.crc = data2.readUInt32LE(offset + consts.CENCRC);
67858
+ this.compressedSize = data2.readUInt32LE(offset + consts.CENSIZ);
67859
+ this.size = data2.readUInt32LE(offset + consts.CENLEN);
67860
+ this.fnameLen = data2.readUInt16LE(offset + consts.CENNAM);
67861
+ this.extraLen = data2.readUInt16LE(offset + consts.CENEXT);
67862
+ this.comLen = data2.readUInt16LE(offset + consts.CENCOM);
67863
+ this.diskStart = data2.readUInt16LE(offset + consts.CENDSK);
67864
+ this.inattr = data2.readUInt16LE(offset + consts.CENATT);
67865
+ this.attr = data2.readUInt32LE(offset + consts.CENATX);
67866
+ this.offset = data2.readUInt32LE(offset + consts.CENOFF);
67867
+ }
67868
+ readDataHeader(data2) {
67869
+ if (data2.readUInt32LE(0) !== consts.LOCSIG) {
67870
+ throw new Error("Invalid local header");
67871
+ }
67872
+ this.version = data2.readUInt16LE(consts.LOCVER);
67873
+ this.flags = data2.readUInt16LE(consts.LOCFLG);
67874
+ this.method = data2.readUInt16LE(consts.LOCHOW);
67875
+ const timebytes = data2.readUInt16LE(consts.LOCTIM);
67876
+ const datebytes = data2.readUInt16LE(consts.LOCTIM + 2);
67877
+ this.time = parseZipTime(timebytes, datebytes);
67878
+ this.crc = data2.readUInt32LE(consts.LOCCRC) || this.crc;
67879
+ const compressedSize = data2.readUInt32LE(consts.LOCSIZ);
67880
+ if (compressedSize && compressedSize !== consts.EF_ZIP64_OR_32) {
67881
+ this.compressedSize = compressedSize;
67882
+ }
67883
+ const size = data2.readUInt32LE(consts.LOCLEN);
67884
+ if (size && size !== consts.EF_ZIP64_OR_32) {
67885
+ this.size = size;
67886
+ }
67887
+ this.fnameLen = data2.readUInt16LE(consts.LOCNAM);
67888
+ this.extraLen = data2.readUInt16LE(consts.LOCEXT);
67889
+ }
67890
+ read(data2, offset, textDecoder2) {
67891
+ const nameData = data2.slice(offset, offset += this.fnameLen);
67892
+ this.name = textDecoder2 ? textDecoder2.decode(new Uint8Array(nameData)) : nameData.toString("utf8");
67893
+ const lastChar = data2[offset - 1];
67894
+ this.isDirectory = lastChar === 47 || lastChar === 92;
67895
+ if (this.extraLen) {
67896
+ this.readExtra(data2, offset);
67897
+ offset += this.extraLen;
67898
+ }
67899
+ this.comment = this.comLen ? data2.slice(offset, offset + this.comLen).toString() : null;
67900
+ }
67901
+ validateName() {
67902
+ if (/\\|^\w+:|^\/|(^|\/)\.\.(\/|$)/.test(this.name)) {
67903
+ throw new Error("Malicious entry: " + this.name);
67904
+ }
67905
+ }
67906
+ readExtra(data2, offset) {
67907
+ let signature, size;
67908
+ const maxPos = offset + this.extraLen;
67909
+ while (offset < maxPos) {
67910
+ signature = data2.readUInt16LE(offset);
67911
+ offset += 2;
67912
+ size = data2.readUInt16LE(offset);
67913
+ offset += 2;
67914
+ if (consts.ID_ZIP64 === signature) {
67915
+ this.parseZip64Extra(data2, offset, size);
67916
+ }
67917
+ offset += size;
67918
+ }
67919
+ }
67920
+ parseZip64Extra(data2, offset, length) {
67921
+ if (length >= 8 && this.size === consts.EF_ZIP64_OR_32) {
67922
+ this.size = readUInt64LE(data2, offset);
67923
+ offset += 8;
67924
+ length -= 8;
67925
+ }
67926
+ if (length >= 8 && this.compressedSize === consts.EF_ZIP64_OR_32) {
67927
+ this.compressedSize = readUInt64LE(data2, offset);
67928
+ offset += 8;
67929
+ length -= 8;
67930
+ }
67931
+ if (length >= 8 && this.offset === consts.EF_ZIP64_OR_32) {
67932
+ this.offset = readUInt64LE(data2, offset);
67933
+ offset += 8;
67934
+ length -= 8;
67935
+ }
67936
+ if (length >= 4 && this.diskStart === consts.EF_ZIP64_OR_16) {
67937
+ this.diskStart = data2.readUInt32LE(offset);
67938
+ }
67939
+ }
67940
+ get encrypted() {
67941
+ return (this.flags & consts.FLG_ENTRY_ENC) === consts.FLG_ENTRY_ENC;
67942
+ }
67943
+ get isFile() {
67944
+ return !this.isDirectory;
67945
+ }
67946
+ };
67947
+ var FsRead = class {
67948
+ constructor(fd, buffer, offset, length, position, callback) {
67949
+ this.fd = fd;
67950
+ this.buffer = buffer;
67951
+ this.offset = offset;
67952
+ this.length = length;
67953
+ this.position = position;
67954
+ this.callback = callback;
67955
+ this.bytesRead = 0;
67956
+ this.waiting = false;
67957
+ }
67958
+ read(sync2) {
67959
+ StreamZip2.debugLog("read", this.position, this.bytesRead, this.length, this.offset);
67960
+ this.waiting = true;
67961
+ let err;
67962
+ if (sync2) {
67963
+ let bytesRead = 0;
67964
+ try {
67965
+ bytesRead = fs15.readSync(
67966
+ this.fd,
67967
+ this.buffer,
67968
+ this.offset + this.bytesRead,
67969
+ this.length - this.bytesRead,
67970
+ this.position + this.bytesRead
67971
+ );
67972
+ } catch (e4) {
67973
+ err = e4;
67974
+ }
67975
+ this.readCallback(sync2, err, err ? bytesRead : null);
67976
+ } else {
67977
+ fs15.read(
67978
+ this.fd,
67979
+ this.buffer,
67980
+ this.offset + this.bytesRead,
67981
+ this.length - this.bytesRead,
67982
+ this.position + this.bytesRead,
67983
+ this.readCallback.bind(this, sync2)
67984
+ );
68718
67985
  }
68719
- if (this.opts.onEntry) {
68720
- this.opts.onEntry(entry, this.zipfile);
68721
- }
68722
- const dest = path18.join(this.opts.dir, entry.fileName);
68723
- const mode = entry.externalFileAttributes >> 16 & 65535;
68724
- const IFMT2 = 61440;
68725
- const IFDIR2 = 16384;
68726
- const IFLNK2 = 40960;
68727
- const symlink = (mode & IFMT2) === IFLNK2;
68728
- let isDir = (mode & IFMT2) === IFDIR2;
68729
- if (!isDir && entry.fileName.endsWith("/")) {
68730
- isDir = true;
68731
- }
68732
- const madeBy = entry.versionMadeBy >> 8;
68733
- if (!isDir) isDir = madeBy === 0 && entry.externalFileAttributes === 16;
68734
- debug3("extracting entry", { filename: entry.fileName, isDir, isSymlink: symlink });
68735
- const procMode = this.getExtractedMode(mode, isDir) & 511;
68736
- const destDir = isDir ? dest : path18.dirname(dest);
68737
- const mkdirOptions = { recursive: true };
68738
- if (isDir) {
68739
- mkdirOptions.mode = procMode;
68740
- }
68741
- debug3("mkdir", { dir: destDir, ...mkdirOptions });
68742
- await fs15.mkdir(destDir, mkdirOptions);
68743
- if (isDir) return;
68744
- debug3("opening read stream", dest);
68745
- const readStream = await promisify5(this.zipfile.openReadStream.bind(this.zipfile))(entry);
68746
- if (symlink) {
68747
- const link = await getStream(readStream);
68748
- debug3("creating symlink", link, dest);
68749
- await fs15.symlink(link, dest);
67986
+ }
67987
+ readCallback(sync2, err, bytesRead) {
67988
+ if (typeof bytesRead === "number") {
67989
+ this.bytesRead += bytesRead;
67990
+ }
67991
+ if (err || !bytesRead || this.bytesRead === this.length) {
67992
+ this.waiting = false;
67993
+ return this.callback(err, this.bytesRead);
68750
67994
  } else {
68751
- await pipeline2(readStream, createWriteStream3(dest, { mode: procMode }));
67995
+ this.read(sync2);
68752
67996
  }
68753
67997
  }
68754
- getExtractedMode(entryMode, isDir) {
68755
- let mode = entryMode;
68756
- if (mode === 0) {
68757
- if (isDir) {
68758
- if (this.opts.defaultDirMode) {
68759
- mode = parseInt(this.opts.defaultDirMode, 10);
68760
- }
68761
- if (!mode) {
68762
- mode = 493;
68763
- }
68764
- } else {
68765
- if (this.opts.defaultFileMode) {
68766
- mode = parseInt(this.opts.defaultFileMode, 10);
67998
+ };
67999
+ var FileWindowBuffer = class {
68000
+ constructor(fd) {
68001
+ this.position = 0;
68002
+ this.buffer = Buffer.alloc(0);
68003
+ this.fd = fd;
68004
+ this.fsOp = null;
68005
+ }
68006
+ checkOp() {
68007
+ if (this.fsOp && this.fsOp.waiting) {
68008
+ throw new Error("Operation in progress");
68009
+ }
68010
+ }
68011
+ read(pos, length, callback) {
68012
+ this.checkOp();
68013
+ if (this.buffer.length < length) {
68014
+ this.buffer = Buffer.alloc(length);
68015
+ }
68016
+ this.position = pos;
68017
+ this.fsOp = new FsRead(this.fd, this.buffer, 0, length, this.position, callback).read();
68018
+ }
68019
+ expandLeft(length, callback) {
68020
+ this.checkOp();
68021
+ this.buffer = Buffer.concat([Buffer.alloc(length), this.buffer]);
68022
+ this.position -= length;
68023
+ if (this.position < 0) {
68024
+ this.position = 0;
68025
+ }
68026
+ this.fsOp = new FsRead(this.fd, this.buffer, 0, length, this.position, callback).read();
68027
+ }
68028
+ expandRight(length, callback) {
68029
+ this.checkOp();
68030
+ const offset = this.buffer.length;
68031
+ this.buffer = Buffer.concat([this.buffer, Buffer.alloc(length)]);
68032
+ this.fsOp = new FsRead(
68033
+ this.fd,
68034
+ this.buffer,
68035
+ offset,
68036
+ length,
68037
+ this.position + offset,
68038
+ callback
68039
+ ).read();
68040
+ }
68041
+ moveRight(length, callback, shift) {
68042
+ this.checkOp();
68043
+ if (shift) {
68044
+ this.buffer.copy(this.buffer, 0, shift);
68045
+ } else {
68046
+ shift = 0;
68047
+ }
68048
+ this.position += shift;
68049
+ this.fsOp = new FsRead(
68050
+ this.fd,
68051
+ this.buffer,
68052
+ this.buffer.length - shift,
68053
+ shift,
68054
+ this.position + this.buffer.length - shift,
68055
+ callback
68056
+ ).read();
68057
+ }
68058
+ };
68059
+ var EntryDataReaderStream = class extends stream2.Readable {
68060
+ constructor(fd, offset, length) {
68061
+ super();
68062
+ this.fd = fd;
68063
+ this.offset = offset;
68064
+ this.length = length;
68065
+ this.pos = 0;
68066
+ this.readCallback = this.readCallback.bind(this);
68067
+ }
68068
+ _read(n4) {
68069
+ const buffer = Buffer.alloc(Math.min(n4, this.length - this.pos));
68070
+ if (buffer.length) {
68071
+ fs15.read(this.fd, buffer, 0, buffer.length, this.offset + this.pos, this.readCallback);
68072
+ } else {
68073
+ this.push(null);
68074
+ }
68075
+ }
68076
+ readCallback(err, bytesRead, buffer) {
68077
+ this.pos += bytesRead;
68078
+ if (err) {
68079
+ this.emit("error", err);
68080
+ this.push(null);
68081
+ } else if (!bytesRead) {
68082
+ this.push(null);
68083
+ } else {
68084
+ if (bytesRead !== buffer.length) {
68085
+ buffer = buffer.slice(0, bytesRead);
68086
+ }
68087
+ this.push(buffer);
68088
+ }
68089
+ }
68090
+ };
68091
+ var EntryVerifyStream = class extends stream2.Transform {
68092
+ constructor(baseStm, crc, size) {
68093
+ super();
68094
+ this.verify = new CrcVerify(crc, size);
68095
+ baseStm.on("error", (e4) => {
68096
+ this.emit("error", e4);
68097
+ });
68098
+ }
68099
+ _transform(data2, encoding, callback) {
68100
+ let err;
68101
+ try {
68102
+ this.verify.data(data2);
68103
+ } catch (e4) {
68104
+ err = e4;
68105
+ }
68106
+ callback(err, data2);
68107
+ }
68108
+ };
68109
+ var CrcVerify = class _CrcVerify {
68110
+ constructor(crc, size) {
68111
+ this.crc = crc;
68112
+ this.size = size;
68113
+ this.state = {
68114
+ crc: ~0,
68115
+ size: 0
68116
+ };
68117
+ }
68118
+ data(data2) {
68119
+ const crcTable = _CrcVerify.getCrcTable();
68120
+ let crc = this.state.crc;
68121
+ let off = 0;
68122
+ let len = data2.length;
68123
+ while (--len >= 0) {
68124
+ crc = crcTable[(crc ^ data2[off++]) & 255] ^ crc >>> 8;
68125
+ }
68126
+ this.state.crc = crc;
68127
+ this.state.size += data2.length;
68128
+ if (this.state.size >= this.size) {
68129
+ const buf = Buffer.alloc(4);
68130
+ buf.writeInt32LE(~this.state.crc & 4294967295, 0);
68131
+ crc = buf.readUInt32LE(0);
68132
+ if (crc !== this.crc) {
68133
+ throw new Error("Invalid CRC");
68134
+ }
68135
+ if (this.state.size !== this.size) {
68136
+ throw new Error("Invalid size");
68137
+ }
68138
+ }
68139
+ }
68140
+ static getCrcTable() {
68141
+ let crcTable = _CrcVerify.crcTable;
68142
+ if (!crcTable) {
68143
+ _CrcVerify.crcTable = crcTable = [];
68144
+ const b7 = Buffer.alloc(4);
68145
+ for (let n4 = 0; n4 < 256; n4++) {
68146
+ let c6 = n4;
68147
+ for (let k7 = 8; --k7 >= 0; ) {
68148
+ if ((c6 & 1) !== 0) {
68149
+ c6 = 3988292384 ^ c6 >>> 1;
68150
+ } else {
68151
+ c6 = c6 >>> 1;
68152
+ }
68767
68153
  }
68768
- if (!mode) {
68769
- mode = 420;
68154
+ if (c6 < 0) {
68155
+ b7.writeInt32LE(c6, 0);
68156
+ c6 = b7.readUInt32LE(0);
68770
68157
  }
68158
+ crcTable[n4] = c6;
68771
68159
  }
68772
68160
  }
68773
- return mode;
68161
+ return crcTable;
68774
68162
  }
68775
68163
  };
68776
- module2.exports = async function(zipPath, opts) {
68777
- debug3("creating target directory", opts.dir);
68778
- if (!path18.isAbsolute(opts.dir)) {
68779
- throw new Error("Target directory is expected to be absolute");
68164
+ function parseZipTime(timebytes, datebytes) {
68165
+ const timebits = toBits(timebytes, 16);
68166
+ const datebits = toBits(datebytes, 16);
68167
+ const mt2 = {
68168
+ h: parseInt(timebits.slice(0, 5).join(""), 2),
68169
+ m: parseInt(timebits.slice(5, 11).join(""), 2),
68170
+ s: parseInt(timebits.slice(11, 16).join(""), 2) * 2,
68171
+ Y: parseInt(datebits.slice(0, 7).join(""), 2) + 1980,
68172
+ M: parseInt(datebits.slice(7, 11).join(""), 2),
68173
+ D: parseInt(datebits.slice(11, 16).join(""), 2)
68174
+ };
68175
+ const dt_str = [mt2.Y, mt2.M, mt2.D].join("-") + " " + [mt2.h, mt2.m, mt2.s].join(":") + " GMT+0";
68176
+ return new Date(dt_str).getTime();
68177
+ }
68178
+ function toBits(dec, size) {
68179
+ let b7 = (dec >>> 0).toString(2);
68180
+ while (b7.length < size) {
68181
+ b7 = "0" + b7;
68780
68182
  }
68781
- await fs15.mkdir(opts.dir, { recursive: true });
68782
- opts.dir = await fs15.realpath(opts.dir);
68783
- return new Extractor(zipPath, opts).extract();
68784
- };
68183
+ return b7.split("");
68184
+ }
68185
+ function readUInt64LE(buffer, offset) {
68186
+ return buffer.readUInt32LE(offset + 4) * 4294967296 + buffer.readUInt32LE(offset);
68187
+ }
68188
+ module2.exports = StreamZip2;
68785
68189
  }
68786
68190
  });
68787
68191
 
@@ -69038,7 +68442,13 @@ async function runWithExecutable(config3, args, options = {}, spawnOpts = {}) {
69038
68442
  return spawnProcess(bin, args, options, spawnOpts);
69039
68443
  }
69040
68444
  async function extractZipArchive(filePath, dir) {
69041
- await (0, import_extract_zip.default)(filePath, { dir });
68445
+ await fs3.promises.mkdir(dir, { recursive: true });
68446
+ const zip = new import_node_stream_zip.default.async({ file: filePath });
68447
+ try {
68448
+ await zip.extract(null, dir);
68449
+ } finally {
68450
+ await zip.close();
68451
+ }
69042
68452
  }
69043
68453
  function catchKeyboardInterrupt(maxTimeDiff = 1e3) {
69044
68454
  if (process.env.CRAFT_CATCH_KEYBOARD_INTERRUPT !== "1") {
@@ -69068,7 +68478,7 @@ function catchKeyboardInterrupt(maxTimeDiff = 1e3) {
69068
68478
  }
69069
68479
  });
69070
68480
  }
69071
- var import_child_process2, import_crypto2, fs3, path4, import_split, import_extract_zip, HashAlgorithm, HashOutputFormat;
68481
+ var import_child_process2, import_crypto2, fs3, path4, import_split, import_node_stream_zip, HashAlgorithm, HashOutputFormat;
69072
68482
  var init_system = __esm({
69073
68483
  "src/utils/system.ts"() {
69074
68484
  "use strict";
@@ -69079,7 +68489,7 @@ var init_system = __esm({
69079
68489
  path4 = __toESM(require("path"));
69080
68490
  import_split = __toESM(require_split());
69081
68491
  init_index_min();
69082
- import_extract_zip = __toESM(require_extract_zip());
68492
+ import_node_stream_zip = __toESM(require_node_stream_zip());
69083
68493
  init_logger2();
69084
68494
  init_errors2();
69085
68495
  init_helpers();
@@ -73324,7 +72734,7 @@ var require_light = __commonJS({
73324
72734
  }
73325
72735
  }
73326
72736
  async trigger(name, ...args) {
73327
- var e4, promises2;
72737
+ var e4, promises3;
73328
72738
  try {
73329
72739
  if (name !== "debug") {
73330
72740
  this.trigger("debug", `Event triggered: ${name}`, args);
@@ -73335,7 +72745,7 @@ var require_light = __commonJS({
73335
72745
  this._events[name] = this._events[name].filter(function(listener) {
73336
72746
  return listener.status !== "none";
73337
72747
  });
73338
- promises2 = this._events[name].map(async (listener) => {
72748
+ promises3 = this._events[name].map(async (listener) => {
73339
72749
  var e5, returned;
73340
72750
  if (listener.status === "none") {
73341
72751
  return;
@@ -73358,7 +72768,7 @@ var require_light = __commonJS({
73358
72768
  return null;
73359
72769
  }
73360
72770
  });
73361
- return (await Promise.all(promises2)).find(function(x6) {
72771
+ return (await Promise.all(promises3)).find(function(x6) {
73362
72772
  return x6 != null;
73363
72773
  });
73364
72774
  } catch (error3) {
@@ -90580,7 +89990,7 @@ var require_string_decoder = __commonJS({
90580
89990
  });
90581
89991
 
90582
89992
  // node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js
90583
- var require_end_of_stream2 = __commonJS({
89993
+ var require_end_of_stream = __commonJS({
90584
89994
  "node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports2, module2) {
90585
89995
  "use strict";
90586
89996
  init_import_meta_url();
@@ -90698,7 +90108,7 @@ var require_async_iterator = __commonJS({
90698
90108
  }
90699
90109
  return (hint === "string" ? String : Number)(input);
90700
90110
  }
90701
- var finished = require_end_of_stream2();
90111
+ var finished = require_end_of_stream();
90702
90112
  var kLastResolve = Symbol("lastResolve");
90703
90113
  var kLastReject = Symbol("lastReject");
90704
90114
  var kError = Symbol("error");
@@ -91858,7 +91268,7 @@ var require_pipeline = __commonJS({
91858
91268
  stream2.on("close", function() {
91859
91269
  closed = true;
91860
91270
  });
91861
- if (eos === void 0) eos = require_end_of_stream2();
91271
+ if (eos === void 0) eos = require_end_of_stream();
91862
91272
  eos(stream2, {
91863
91273
  readable: reading,
91864
91274
  writable: writing
@@ -91932,12 +91342,172 @@ var require_readable = __commonJS({
91932
91342
  exports2.Duplex = require_stream_duplex();
91933
91343
  exports2.Transform = require_stream_transform();
91934
91344
  exports2.PassThrough = require_stream_passthrough();
91935
- exports2.finished = require_end_of_stream2();
91345
+ exports2.finished = require_end_of_stream();
91936
91346
  exports2.pipeline = require_pipeline();
91937
91347
  }
91938
91348
  }
91939
91349
  });
91940
91350
 
91351
+ // node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js
91352
+ var require_wrappy = __commonJS({
91353
+ "node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js"(exports2, module2) {
91354
+ init_import_meta_url();
91355
+ module2.exports = wrappy;
91356
+ function wrappy(fn2, cb) {
91357
+ if (fn2 && cb) return wrappy(fn2)(cb);
91358
+ if (typeof fn2 !== "function")
91359
+ throw new TypeError("need wrapper function");
91360
+ Object.keys(fn2).forEach(function(k7) {
91361
+ wrapper[k7] = fn2[k7];
91362
+ });
91363
+ return wrapper;
91364
+ function wrapper() {
91365
+ var args = new Array(arguments.length);
91366
+ for (var i5 = 0; i5 < args.length; i5++) {
91367
+ args[i5] = arguments[i5];
91368
+ }
91369
+ var ret = fn2.apply(this, args);
91370
+ var cb2 = args[args.length - 1];
91371
+ if (typeof ret === "function" && ret !== cb2) {
91372
+ Object.keys(cb2).forEach(function(k7) {
91373
+ ret[k7] = cb2[k7];
91374
+ });
91375
+ }
91376
+ return ret;
91377
+ }
91378
+ }
91379
+ }
91380
+ });
91381
+
91382
+ // node_modules/.pnpm/once@1.4.0/node_modules/once/once.js
91383
+ var require_once = __commonJS({
91384
+ "node_modules/.pnpm/once@1.4.0/node_modules/once/once.js"(exports2, module2) {
91385
+ init_import_meta_url();
91386
+ var wrappy = require_wrappy();
91387
+ module2.exports = wrappy(once);
91388
+ module2.exports.strict = wrappy(onceStrict);
91389
+ once.proto = once(function() {
91390
+ Object.defineProperty(Function.prototype, "once", {
91391
+ value: function() {
91392
+ return once(this);
91393
+ },
91394
+ configurable: true
91395
+ });
91396
+ Object.defineProperty(Function.prototype, "onceStrict", {
91397
+ value: function() {
91398
+ return onceStrict(this);
91399
+ },
91400
+ configurable: true
91401
+ });
91402
+ });
91403
+ function once(fn2) {
91404
+ var f5 = function() {
91405
+ if (f5.called) return f5.value;
91406
+ f5.called = true;
91407
+ return f5.value = fn2.apply(this, arguments);
91408
+ };
91409
+ f5.called = false;
91410
+ return f5;
91411
+ }
91412
+ function onceStrict(fn2) {
91413
+ var f5 = function() {
91414
+ if (f5.called)
91415
+ throw new Error(f5.onceError);
91416
+ f5.called = true;
91417
+ return f5.value = fn2.apply(this, arguments);
91418
+ };
91419
+ var name = fn2.name || "Function wrapped with `once`";
91420
+ f5.onceError = name + " shouldn't be called more than once";
91421
+ f5.called = false;
91422
+ return f5;
91423
+ }
91424
+ }
91425
+ });
91426
+
91427
+ // node_modules/.pnpm/end-of-stream@1.4.5/node_modules/end-of-stream/index.js
91428
+ var require_end_of_stream2 = __commonJS({
91429
+ "node_modules/.pnpm/end-of-stream@1.4.5/node_modules/end-of-stream/index.js"(exports2, module2) {
91430
+ init_import_meta_url();
91431
+ var once = require_once();
91432
+ var noop2 = function() {
91433
+ };
91434
+ var qnt = global.Bare ? queueMicrotask : process.nextTick.bind(process);
91435
+ var isRequest = function(stream2) {
91436
+ return stream2.setHeader && typeof stream2.abort === "function";
91437
+ };
91438
+ var isChildProcess = function(stream2) {
91439
+ return stream2.stdio && Array.isArray(stream2.stdio) && stream2.stdio.length === 3;
91440
+ };
91441
+ var eos = function(stream2, opts, callback) {
91442
+ if (typeof opts === "function") return eos(stream2, null, opts);
91443
+ if (!opts) opts = {};
91444
+ callback = once(callback || noop2);
91445
+ var ws2 = stream2._writableState;
91446
+ var rs2 = stream2._readableState;
91447
+ var readable = opts.readable || opts.readable !== false && stream2.readable;
91448
+ var writable = opts.writable || opts.writable !== false && stream2.writable;
91449
+ var cancelled = false;
91450
+ var onlegacyfinish = function() {
91451
+ if (!stream2.writable) onfinish();
91452
+ };
91453
+ var onfinish = function() {
91454
+ writable = false;
91455
+ if (!readable) callback.call(stream2);
91456
+ };
91457
+ var onend = function() {
91458
+ readable = false;
91459
+ if (!writable) callback.call(stream2);
91460
+ };
91461
+ var onexit = function(exitCode) {
91462
+ callback.call(stream2, exitCode ? new Error("exited with error code: " + exitCode) : null);
91463
+ };
91464
+ var onerror = function(err) {
91465
+ callback.call(stream2, err);
91466
+ };
91467
+ var onclose = function() {
91468
+ qnt(onclosenexttick);
91469
+ };
91470
+ var onclosenexttick = function() {
91471
+ if (cancelled) return;
91472
+ if (readable && !(rs2 && (rs2.ended && !rs2.destroyed))) return callback.call(stream2, new Error("premature close"));
91473
+ if (writable && !(ws2 && (ws2.ended && !ws2.destroyed))) return callback.call(stream2, new Error("premature close"));
91474
+ };
91475
+ var onrequest = function() {
91476
+ stream2.req.on("finish", onfinish);
91477
+ };
91478
+ if (isRequest(stream2)) {
91479
+ stream2.on("complete", onfinish);
91480
+ stream2.on("abort", onclose);
91481
+ if (stream2.req) onrequest();
91482
+ else stream2.on("request", onrequest);
91483
+ } else if (writable && !ws2) {
91484
+ stream2.on("end", onlegacyfinish);
91485
+ stream2.on("close", onlegacyfinish);
91486
+ }
91487
+ if (isChildProcess(stream2)) stream2.on("exit", onexit);
91488
+ stream2.on("end", onend);
91489
+ stream2.on("finish", onfinish);
91490
+ if (opts.error !== false) stream2.on("error", onerror);
91491
+ stream2.on("close", onclose);
91492
+ return function() {
91493
+ cancelled = true;
91494
+ stream2.removeListener("complete", onfinish);
91495
+ stream2.removeListener("abort", onclose);
91496
+ stream2.removeListener("request", onrequest);
91497
+ if (stream2.req) stream2.req.removeListener("finish", onfinish);
91498
+ stream2.removeListener("end", onlegacyfinish);
91499
+ stream2.removeListener("close", onlegacyfinish);
91500
+ stream2.removeListener("finish", onfinish);
91501
+ stream2.removeListener("exit", onexit);
91502
+ stream2.removeListener("end", onend);
91503
+ stream2.removeListener("error", onerror);
91504
+ stream2.removeListener("close", onclose);
91505
+ };
91506
+ };
91507
+ module2.exports = eos;
91508
+ }
91509
+ });
91510
+
91941
91511
  // node_modules/.pnpm/stream-shift@1.0.3/node_modules/stream-shift/index.js
91942
91512
  var require_stream_shift = __commonJS({
91943
91513
  "node_modules/.pnpm/stream-shift@1.0.3/node_modules/stream-shift/index.js"(exports2, module2) {
@@ -91967,7 +91537,7 @@ var require_duplexify = __commonJS({
91967
91537
  "node_modules/.pnpm/duplexify@4.1.3/node_modules/duplexify/index.js"(exports2, module2) {
91968
91538
  init_import_meta_url();
91969
91539
  var stream2 = require_readable();
91970
- var eos = require_end_of_stream();
91540
+ var eos = require_end_of_stream2();
91971
91541
  var inherits = require_inherits();
91972
91542
  var shift = require_stream_shift();
91973
91543
  var SIGNAL_FLUSH = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from([0]) : new Buffer([0]);
@@ -101589,20 +101159,20 @@ var init_bucket = __esm({
101589
101159
  };
101590
101160
  (async () => {
101591
101161
  try {
101592
- let promises2 = [];
101162
+ let promises3 = [];
101593
101163
  const limit = (0, import_p_limit2.default)(MAX_PARALLEL_LIMIT);
101594
101164
  const filesStream = this.getFilesStream(query);
101595
101165
  for await (const curFile of filesStream) {
101596
- if (promises2.length >= MAX_QUEUE_SIZE) {
101597
- await Promise.all(promises2);
101598
- promises2 = [];
101166
+ if (promises3.length >= MAX_QUEUE_SIZE) {
101167
+ await Promise.all(promises3);
101168
+ promises3 = [];
101599
101169
  }
101600
- promises2.push(limit(() => deleteFile(curFile)).catch((e4) => {
101170
+ promises3.push(limit(() => deleteFile(curFile)).catch((e4) => {
101601
101171
  filesStream.destroy();
101602
101172
  throw e4;
101603
101173
  }));
101604
101174
  }
101605
- await Promise.all(promises2);
101175
+ await Promise.all(promises3);
101606
101176
  callback(errors.length > 0 ? errors : null);
101607
101177
  } catch (e4) {
101608
101178
  callback(e4);
@@ -103514,10 +103084,10 @@ var init_bucket = __esm({
103514
103084
  };
103515
103085
  this.getFiles(options).then(([files]) => {
103516
103086
  const limit = (0, import_p_limit2.default)(MAX_PARALLEL_LIMIT);
103517
- const promises2 = files.map((file) => {
103087
+ const promises3 = files.map((file) => {
103518
103088
  return limit(() => processFile(file));
103519
103089
  });
103520
- return Promise.all(promises2);
103090
+ return Promise.all(promises3);
103521
103091
  }).then(() => callback(errors.length > 0 ? errors : null, updatedFiles), (err) => callback(err, updatedFiles));
103522
103092
  }
103523
103093
  getId() {
@@ -124397,14 +123967,14 @@ var init_esm14 = __esm({
124397
123967
  if (er2)
124398
123968
  return results.emit("error", er2);
124399
123969
  if (follow && !didRealpaths) {
124400
- const promises2 = [];
123970
+ const promises3 = [];
124401
123971
  for (const e4 of entries) {
124402
123972
  if (e4.isSymbolicLink()) {
124403
- promises2.push(e4.realpath().then((r5) => r5?.isUnknown() ? r5.lstat() : r5));
123973
+ promises3.push(e4.realpath().then((r5) => r5?.isUnknown() ? r5.lstat() : r5));
124404
123974
  }
124405
123975
  }
124406
- if (promises2.length) {
124407
- Promise.all(promises2).then(() => onReaddir(null, entries, true));
123976
+ if (promises3.length) {
123977
+ Promise.all(promises3).then(() => onReaddir(null, entries, true));
124408
123978
  return;
124409
123979
  }
124410
123980
  }
@@ -127908,7 +127478,12 @@ var init_pypi = __esm({
127908
127478
  };
127909
127479
  }
127910
127480
  async uploadAssets(paths) {
127911
- return spawnProcess(TWINE_BIN, ["upload", ...paths]);
127481
+ const args = ["upload"];
127482
+ if (process.env.TWINE_VERBOSE) {
127483
+ args.push("--verbose");
127484
+ }
127485
+ args.push(...paths);
127486
+ return spawnProcess(TWINE_BIN, args);
127912
127487
  }
127913
127488
  /**
127914
127489
  * Uploads all files to PyPI using Twine
@@ -161671,7 +161246,7 @@ var require_package6 = __commonJS({
161671
161246
  "package.json"(exports2, module2) {
161672
161247
  module2.exports = {
161673
161248
  name: "@sentry/craft",
161674
- version: "2.26.7",
161249
+ version: "2.26.9",
161675
161250
  description: "The universal sentry workflow CLI",
161676
161251
  main: "dist/craft",
161677
161252
  repository: "https://github.com/getsentry/craft",
@@ -161693,7 +161268,6 @@ var require_package6 = __commonJS({
161693
161268
  "@types/async": "^3.0.1",
161694
161269
  "@types/aws4": "^1.5.1",
161695
161270
  "@types/cli-table": "^0.3.0",
161696
- "@types/extract-zip": "^2.0.1",
161697
161271
  "@types/git-url-parse": "^9.0.0",
161698
161272
  "@types/is-ci": "^2.0.0",
161699
161273
  "@types/js-yaml": "^4.0.5",
@@ -161716,7 +161290,7 @@ var require_package6 = __commonJS({
161716
161290
  eslint: "^9.17.0",
161717
161291
  "eslint-config-prettier": "^9.1.0",
161718
161292
  "eslint-formatter-github-annotations": "^0.1.0",
161719
- "extract-zip": "^2.0.1",
161293
+ "node-stream-zip": "^1.15.0",
161720
161294
  "fast-xml-parser": "^5.8.0",
161721
161295
  "git-url-parse": "^16.1.0",
161722
161296
  glob: "^11.0.0",
@@ -161845,7 +161419,7 @@ function getPackage() {
161845
161419
  }
161846
161420
  function getPackageVersion() {
161847
161421
  const { version: version2 } = getPackage();
161848
- const buildInfo = "2d91188a567c27575be26f7f06a4701ecd4d94ce";
161422
+ const buildInfo = "6143e76379c342e247687c4ab5c83d8b900cc273";
161849
161423
  return buildInfo ? `${version2} (${buildInfo})` : version2;
161850
161424
  }
161851
161425
  function semVerToString(s6) {
@@ -171450,6 +171024,12 @@ git-url-parse/lib/index.js:
171450
171024
  * @return {String} token prefix
171451
171025
  *)
171452
171026
 
171027
+ node-stream-zip/node_stream_zip.js:
171028
+ (**
171029
+ * @license node-stream-zip | (c) 2020 Antelle | https://github.com/antelle/node-stream-zip/blob/master/LICENSE
171030
+ * Portions copyright https://github.com/cthackers/adm-zip | https://raw.githubusercontent.com/cthackers/adm-zip/master/LICENSE
171031
+ *)
171032
+
171453
171033
  tmp/lib/tmp.js:
171454
171034
  (*!
171455
171035
  * Tmp