@vercel/build-utils 8.4.1 → 8.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/fs/run-user-scripts.d.ts +0 -6
- package/dist/fs/run-user-scripts.js +18 -32
- package/dist/index.js +2071 -441
- package/dist/prerender.d.ts +4 -2
- package/dist/prerender.js +22 -1
- package/dist/types.d.ts +11 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -85,9 +85,9 @@ var require_isarray = __commonJS({
|
|
85
85
|
}
|
86
86
|
});
|
87
87
|
|
88
|
-
// ../../node_modules/.pnpm/readable-stream@2.3.
|
88
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/stream.js
|
89
89
|
var require_stream = __commonJS({
|
90
|
-
"../../node_modules/.pnpm/readable-stream@2.3.
|
90
|
+
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/stream.js"(exports2, module2) {
|
91
91
|
module2.exports = require("stream");
|
92
92
|
}
|
93
93
|
});
|
@@ -266,9 +266,9 @@ var require_inherits = __commonJS({
|
|
266
266
|
}
|
267
267
|
});
|
268
268
|
|
269
|
-
// ../../node_modules/.pnpm/readable-stream@2.3.
|
269
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/BufferList.js
|
270
270
|
var require_BufferList = __commonJS({
|
271
|
-
"../../node_modules/.pnpm/readable-stream@2.3.
|
271
|
+
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/BufferList.js"(exports2, module2) {
|
272
272
|
"use strict";
|
273
273
|
function _classCallCheck(instance, Constructor) {
|
274
274
|
if (!(instance instanceof Constructor)) {
|
@@ -331,8 +331,6 @@ var require_BufferList = __commonJS({
|
|
331
331
|
BufferList.prototype.concat = function concat(n) {
|
332
332
|
if (this.length === 0)
|
333
333
|
return Buffer2.alloc(0);
|
334
|
-
if (this.length === 1)
|
335
|
-
return this.head.data;
|
336
334
|
var ret = Buffer2.allocUnsafe(n >>> 0);
|
337
335
|
var p = this.head;
|
338
336
|
var i = 0;
|
@@ -354,9 +352,9 @@ var require_BufferList = __commonJS({
|
|
354
352
|
}
|
355
353
|
});
|
356
354
|
|
357
|
-
// ../../node_modules/.pnpm/readable-stream@2.3.
|
355
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/destroy.js
|
358
356
|
var require_destroy = __commonJS({
|
359
|
-
"../../node_modules/.pnpm/readable-stream@2.3.
|
357
|
+
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
|
360
358
|
"use strict";
|
361
359
|
var pna = require_process_nextick_args();
|
362
360
|
function destroy(err, cb) {
|
@@ -366,8 +364,13 @@ var require_destroy = __commonJS({
|
|
366
364
|
if (readableDestroyed || writableDestroyed) {
|
367
365
|
if (cb) {
|
368
366
|
cb(err);
|
369
|
-
} else if (err
|
370
|
-
|
367
|
+
} else if (err) {
|
368
|
+
if (!this._writableState) {
|
369
|
+
pna.nextTick(emitErrorNT, this, err);
|
370
|
+
} else if (!this._writableState.errorEmitted) {
|
371
|
+
this._writableState.errorEmitted = true;
|
372
|
+
pna.nextTick(emitErrorNT, this, err);
|
373
|
+
}
|
371
374
|
}
|
372
375
|
return this;
|
373
376
|
}
|
@@ -379,9 +382,11 @@ var require_destroy = __commonJS({
|
|
379
382
|
}
|
380
383
|
this._destroy(err || null, function(err2) {
|
381
384
|
if (!cb && err2) {
|
382
|
-
|
383
|
-
|
385
|
+
if (!_this._writableState) {
|
386
|
+
pna.nextTick(emitErrorNT, _this, err2);
|
387
|
+
} else if (!_this._writableState.errorEmitted) {
|
384
388
|
_this._writableState.errorEmitted = true;
|
389
|
+
pna.nextTick(emitErrorNT, _this, err2);
|
385
390
|
}
|
386
391
|
} else if (cb) {
|
387
392
|
cb(err2);
|
@@ -400,12 +405,14 @@ var require_destroy = __commonJS({
|
|
400
405
|
this._writableState.destroyed = false;
|
401
406
|
this._writableState.ended = false;
|
402
407
|
this._writableState.ending = false;
|
408
|
+
this._writableState.finalCalled = false;
|
409
|
+
this._writableState.prefinished = false;
|
403
410
|
this._writableState.finished = false;
|
404
411
|
this._writableState.errorEmitted = false;
|
405
412
|
}
|
406
413
|
}
|
407
|
-
function emitErrorNT(
|
408
|
-
|
414
|
+
function emitErrorNT(self2, err) {
|
415
|
+
self2.emit("error", err);
|
409
416
|
}
|
410
417
|
module2.exports = {
|
411
418
|
destroy,
|
@@ -421,9 +428,9 @@ var require_node = __commonJS({
|
|
421
428
|
}
|
422
429
|
});
|
423
430
|
|
424
|
-
// ../../node_modules/.pnpm/readable-stream@2.3.
|
431
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_writable.js
|
425
432
|
var require_stream_writable = __commonJS({
|
426
|
-
"../../node_modules/.pnpm/readable-stream@2.3.
|
433
|
+
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_writable.js"(exports2, module2) {
|
427
434
|
"use strict";
|
428
435
|
var pna = require_process_nextick_args();
|
429
436
|
module2.exports = Writable;
|
@@ -445,7 +452,7 @@ var require_stream_writable = __commonJS({
|
|
445
452
|
};
|
446
453
|
var Stream = require_stream();
|
447
454
|
var Buffer2 = require_safe_buffer().Buffer;
|
448
|
-
var OurUint8Array = global.Uint8Array || function() {
|
455
|
+
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
449
456
|
};
|
450
457
|
function _uint8ArrayToBuffer(chunk) {
|
451
458
|
return Buffer2.from(chunk);
|
@@ -612,7 +619,7 @@ var require_stream_writable = __commonJS({
|
|
612
619
|
var state = this._writableState;
|
613
620
|
if (state.corked) {
|
614
621
|
state.corked--;
|
615
|
-
if (!state.writing && !state.corked && !state.
|
622
|
+
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest)
|
616
623
|
clearBuffer(this, state);
|
617
624
|
}
|
618
625
|
};
|
@@ -803,7 +810,7 @@ var require_stream_writable = __commonJS({
|
|
803
810
|
state.corked = 1;
|
804
811
|
this.uncork();
|
805
812
|
}
|
806
|
-
if (!state.ending
|
813
|
+
if (!state.ending)
|
807
814
|
endWritable(this, state, cb);
|
808
815
|
};
|
809
816
|
function needFinish(state) {
|
@@ -864,11 +871,7 @@ var require_stream_writable = __commonJS({
|
|
864
871
|
cb(err);
|
865
872
|
entry = entry.next;
|
866
873
|
}
|
867
|
-
|
868
|
-
state.corkedRequestsFree.next = corkReq;
|
869
|
-
} else {
|
870
|
-
state.corkedRequestsFree = corkReq;
|
871
|
-
}
|
874
|
+
state.corkedRequestsFree.next = corkReq;
|
872
875
|
}
|
873
876
|
Object.defineProperty(Writable.prototype, "destroyed", {
|
874
877
|
get: function() {
|
@@ -893,9 +896,9 @@ var require_stream_writable = __commonJS({
|
|
893
896
|
}
|
894
897
|
});
|
895
898
|
|
896
|
-
// ../../node_modules/.pnpm/readable-stream@2.3.
|
899
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_duplex.js
|
897
900
|
var require_stream_duplex = __commonJS({
|
898
|
-
"../../node_modules/.pnpm/readable-stream@2.3.
|
901
|
+
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_duplex.js"(exports2, module2) {
|
899
902
|
"use strict";
|
900
903
|
var pna = require_process_nextick_args();
|
901
904
|
var objectKeys = Object.keys || function(obj) {
|
@@ -950,8 +953,8 @@ var require_stream_duplex = __commonJS({
|
|
950
953
|
return;
|
951
954
|
pna.nextTick(onEndNT, this);
|
952
955
|
}
|
953
|
-
function onEndNT(
|
954
|
-
|
956
|
+
function onEndNT(self2) {
|
957
|
+
self2.end();
|
955
958
|
}
|
956
959
|
Object.defineProperty(Duplex.prototype, "destroyed", {
|
957
960
|
get: function() {
|
@@ -1102,14 +1105,14 @@ var require_string_decoder = __commonJS({
|
|
1102
1105
|
return 4;
|
1103
1106
|
return byte >> 6 === 2 ? -1 : -2;
|
1104
1107
|
}
|
1105
|
-
function utf8CheckIncomplete(
|
1108
|
+
function utf8CheckIncomplete(self2, buf, i) {
|
1106
1109
|
var j = buf.length - 1;
|
1107
1110
|
if (j < i)
|
1108
1111
|
return 0;
|
1109
1112
|
var nb = utf8CheckByte(buf[j]);
|
1110
1113
|
if (nb >= 0) {
|
1111
1114
|
if (nb > 0)
|
1112
|
-
|
1115
|
+
self2.lastNeed = nb - 1;
|
1113
1116
|
return nb;
|
1114
1117
|
}
|
1115
1118
|
if (--j < i || nb === -2)
|
@@ -1117,7 +1120,7 @@ var require_string_decoder = __commonJS({
|
|
1117
1120
|
nb = utf8CheckByte(buf[j]);
|
1118
1121
|
if (nb >= 0) {
|
1119
1122
|
if (nb > 0)
|
1120
|
-
|
1123
|
+
self2.lastNeed = nb - 2;
|
1121
1124
|
return nb;
|
1122
1125
|
}
|
1123
1126
|
if (--j < i || nb === -2)
|
@@ -1128,25 +1131,25 @@ var require_string_decoder = __commonJS({
|
|
1128
1131
|
if (nb === 2)
|
1129
1132
|
nb = 0;
|
1130
1133
|
else
|
1131
|
-
|
1134
|
+
self2.lastNeed = nb - 3;
|
1132
1135
|
}
|
1133
1136
|
return nb;
|
1134
1137
|
}
|
1135
1138
|
return 0;
|
1136
1139
|
}
|
1137
|
-
function utf8CheckExtraBytes(
|
1140
|
+
function utf8CheckExtraBytes(self2, buf, p) {
|
1138
1141
|
if ((buf[0] & 192) !== 128) {
|
1139
|
-
|
1142
|
+
self2.lastNeed = 0;
|
1140
1143
|
return "\uFFFD";
|
1141
1144
|
}
|
1142
|
-
if (
|
1145
|
+
if (self2.lastNeed > 1 && buf.length > 1) {
|
1143
1146
|
if ((buf[1] & 192) !== 128) {
|
1144
|
-
|
1147
|
+
self2.lastNeed = 1;
|
1145
1148
|
return "\uFFFD";
|
1146
1149
|
}
|
1147
|
-
if (
|
1150
|
+
if (self2.lastNeed > 2 && buf.length > 2) {
|
1148
1151
|
if ((buf[2] & 192) !== 128) {
|
1149
|
-
|
1152
|
+
self2.lastNeed = 2;
|
1150
1153
|
return "\uFFFD";
|
1151
1154
|
}
|
1152
1155
|
}
|
@@ -1236,9 +1239,9 @@ var require_string_decoder = __commonJS({
|
|
1236
1239
|
}
|
1237
1240
|
});
|
1238
1241
|
|
1239
|
-
// ../../node_modules/.pnpm/readable-stream@2.3.
|
1242
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_readable.js
|
1240
1243
|
var require_stream_readable = __commonJS({
|
1241
|
-
"../../node_modules/.pnpm/readable-stream@2.3.
|
1244
|
+
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_readable.js"(exports2, module2) {
|
1242
1245
|
"use strict";
|
1243
1246
|
var pna = require_process_nextick_args();
|
1244
1247
|
module2.exports = Readable;
|
@@ -1251,7 +1254,7 @@ var require_stream_readable = __commonJS({
|
|
1251
1254
|
};
|
1252
1255
|
var Stream = require_stream();
|
1253
1256
|
var Buffer2 = require_safe_buffer().Buffer;
|
1254
|
-
var OurUint8Array = global.Uint8Array || function() {
|
1257
|
+
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
1255
1258
|
};
|
1256
1259
|
function _uint8ArrayToBuffer(chunk) {
|
1257
1260
|
return Buffer2.from(chunk);
|
@@ -1666,8 +1669,8 @@ var require_stream_readable = __commonJS({
|
|
1666
1669
|
var ret = dest.write(chunk);
|
1667
1670
|
if (false === ret && !increasedAwaitDrain) {
|
1668
1671
|
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
1669
|
-
debug2("false write response, pause",
|
1670
|
-
|
1672
|
+
debug2("false write response, pause", state.awaitDrain);
|
1673
|
+
state.awaitDrain++;
|
1671
1674
|
increasedAwaitDrain = true;
|
1672
1675
|
}
|
1673
1676
|
src.pause();
|
@@ -1739,7 +1742,7 @@ var require_stream_readable = __commonJS({
|
|
1739
1742
|
state.pipesCount = 0;
|
1740
1743
|
state.flowing = false;
|
1741
1744
|
for (var i = 0; i < len; i++) {
|
1742
|
-
dests[i].emit("unpipe", this,
|
1745
|
+
dests[i].emit("unpipe", this, { hasUnpiped: false });
|
1743
1746
|
}
|
1744
1747
|
return this;
|
1745
1748
|
}
|
@@ -1773,9 +1776,9 @@ var require_stream_readable = __commonJS({
|
|
1773
1776
|
return res;
|
1774
1777
|
};
|
1775
1778
|
Readable.prototype.addListener = Readable.prototype.on;
|
1776
|
-
function nReadingNextTick(
|
1779
|
+
function nReadingNextTick(self2) {
|
1777
1780
|
debug2("readable nexttick read 0");
|
1778
|
-
|
1781
|
+
self2.read(0);
|
1779
1782
|
}
|
1780
1783
|
Readable.prototype.resume = function() {
|
1781
1784
|
var state = this._readableState;
|
@@ -1994,9 +1997,9 @@ var require_stream_readable = __commonJS({
|
|
1994
1997
|
}
|
1995
1998
|
});
|
1996
1999
|
|
1997
|
-
// ../../node_modules/.pnpm/readable-stream@2.3.
|
2000
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_transform.js
|
1998
2001
|
var require_stream_transform = __commonJS({
|
1999
|
-
"../../node_modules/.pnpm/readable-stream@2.3.
|
2002
|
+
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_transform.js"(exports2, module2) {
|
2000
2003
|
"use strict";
|
2001
2004
|
module2.exports = Transform;
|
2002
2005
|
var Duplex = require_stream_duplex();
|
@@ -2101,9 +2104,9 @@ var require_stream_transform = __commonJS({
|
|
2101
2104
|
}
|
2102
2105
|
});
|
2103
2106
|
|
2104
|
-
// ../../node_modules/.pnpm/readable-stream@2.3.
|
2107
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_passthrough.js
|
2105
2108
|
var require_stream_passthrough = __commonJS({
|
2106
|
-
"../../node_modules/.pnpm/readable-stream@2.3.
|
2109
|
+
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_passthrough.js"(exports2, module2) {
|
2107
2110
|
"use strict";
|
2108
2111
|
module2.exports = PassThrough;
|
2109
2112
|
var Transform = require_stream_transform();
|
@@ -2121,9 +2124,9 @@ var require_stream_passthrough = __commonJS({
|
|
2121
2124
|
}
|
2122
2125
|
});
|
2123
2126
|
|
2124
|
-
// ../../node_modules/.pnpm/readable-stream@2.3.
|
2127
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/readable.js
|
2125
2128
|
var require_readable = __commonJS({
|
2126
|
-
"../../node_modules/.pnpm/readable-stream@2.3.
|
2129
|
+
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/readable.js"(exports2, module2) {
|
2127
2130
|
var Stream = require("stream");
|
2128
2131
|
if (process.env.READABLE_STREAM === "disable" && Stream) {
|
2129
2132
|
module2.exports = Stream;
|
@@ -2190,18 +2193,18 @@ var require_from2 = __commonJS({
|
|
2190
2193
|
this._callback = check;
|
2191
2194
|
this.destroyed = false;
|
2192
2195
|
Readable.call(this, override || opts);
|
2193
|
-
var
|
2196
|
+
var self2 = this;
|
2194
2197
|
var hwm = this._readableState.highWaterMark;
|
2195
2198
|
function check(err, data) {
|
2196
|
-
if (
|
2199
|
+
if (self2.destroyed)
|
2197
2200
|
return;
|
2198
2201
|
if (err)
|
2199
|
-
return
|
2202
|
+
return self2.destroy(err);
|
2200
2203
|
if (data === null)
|
2201
|
-
return
|
2202
|
-
|
2203
|
-
if (
|
2204
|
-
|
2204
|
+
return self2.push(null);
|
2205
|
+
self2._reading = false;
|
2206
|
+
if (self2.push(data))
|
2207
|
+
self2._read(hwm);
|
2205
2208
|
}
|
2206
2209
|
}
|
2207
2210
|
Class.prototype._from = read || noop;
|
@@ -2215,11 +2218,11 @@ var require_from2 = __commonJS({
|
|
2215
2218
|
if (this.destroyed)
|
2216
2219
|
return;
|
2217
2220
|
this.destroyed = true;
|
2218
|
-
var
|
2221
|
+
var self2 = this;
|
2219
2222
|
process.nextTick(function() {
|
2220
2223
|
if (err)
|
2221
|
-
|
2222
|
-
|
2224
|
+
self2.emit("error", err);
|
2225
|
+
self2.emit("close");
|
2223
2226
|
});
|
2224
2227
|
};
|
2225
2228
|
return Class;
|
@@ -2700,7 +2703,7 @@ var require_legacy_streams = __commonJS({
|
|
2700
2703
|
if (!(this instanceof ReadStream))
|
2701
2704
|
return new ReadStream(path7, options);
|
2702
2705
|
Stream.call(this);
|
2703
|
-
var
|
2706
|
+
var self2 = this;
|
2704
2707
|
this.path = path7;
|
2705
2708
|
this.fd = null;
|
2706
2709
|
this.readable = true;
|
@@ -2732,19 +2735,19 @@ var require_legacy_streams = __commonJS({
|
|
2732
2735
|
}
|
2733
2736
|
if (this.fd !== null) {
|
2734
2737
|
process.nextTick(function() {
|
2735
|
-
|
2738
|
+
self2._read();
|
2736
2739
|
});
|
2737
2740
|
return;
|
2738
2741
|
}
|
2739
2742
|
fs5.open(this.path, this.flags, this.mode, function(err, fd) {
|
2740
2743
|
if (err) {
|
2741
|
-
|
2742
|
-
|
2744
|
+
self2.emit("error", err);
|
2745
|
+
self2.readable = false;
|
2743
2746
|
return;
|
2744
2747
|
}
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
+
self2.fd = fd;
|
2749
|
+
self2.emit("open", fd);
|
2750
|
+
self2._read();
|
2748
2751
|
});
|
2749
2752
|
}
|
2750
2753
|
function WriteStream(path7, options) {
|
@@ -4835,132 +4838,1752 @@ var require_move_sync = __commonJS({
|
|
4835
4838
|
copySync(src, dest, opts);
|
4836
4839
|
return removeSync(src);
|
4837
4840
|
}
|
4838
|
-
module2.exports = moveSync;
|
4839
|
-
}
|
4840
|
-
});
|
4841
|
-
|
4842
|
-
// ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move-sync/index.js
|
4843
|
-
var require_move_sync2 = __commonJS({
|
4844
|
-
"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move-sync/index.js"(exports2, module2) {
|
4845
|
-
"use strict";
|
4846
|
-
module2.exports = {
|
4847
|
-
moveSync: require_move_sync()
|
4848
|
-
};
|
4841
|
+
module2.exports = moveSync;
|
4842
|
+
}
|
4843
|
+
});
|
4844
|
+
|
4845
|
+
// ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move-sync/index.js
|
4846
|
+
var require_move_sync2 = __commonJS({
|
4847
|
+
"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move-sync/index.js"(exports2, module2) {
|
4848
|
+
"use strict";
|
4849
|
+
module2.exports = {
|
4850
|
+
moveSync: require_move_sync()
|
4851
|
+
};
|
4852
|
+
}
|
4853
|
+
});
|
4854
|
+
|
4855
|
+
// ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/move.js
|
4856
|
+
var require_move = __commonJS({
|
4857
|
+
"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
|
4858
|
+
"use strict";
|
4859
|
+
var fs5 = require_graceful_fs();
|
4860
|
+
var path7 = require("path");
|
4861
|
+
var copy = require_copy2().copy;
|
4862
|
+
var remove2 = require_remove().remove;
|
4863
|
+
var mkdirp3 = require_mkdirs().mkdirp;
|
4864
|
+
var pathExists = require_path_exists().pathExists;
|
4865
|
+
var stat = require_stat();
|
4866
|
+
function move(src, dest, opts, cb) {
|
4867
|
+
if (typeof opts === "function") {
|
4868
|
+
cb = opts;
|
4869
|
+
opts = {};
|
4870
|
+
}
|
4871
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
4872
|
+
stat.checkPaths(src, dest, "move", opts, (err, stats) => {
|
4873
|
+
if (err)
|
4874
|
+
return cb(err);
|
4875
|
+
const { srcStat, isChangingCase = false } = stats;
|
4876
|
+
stat.checkParentPaths(src, srcStat, dest, "move", (err2) => {
|
4877
|
+
if (err2)
|
4878
|
+
return cb(err2);
|
4879
|
+
if (isParentRoot(dest))
|
4880
|
+
return doRename(src, dest, overwrite, isChangingCase, cb);
|
4881
|
+
mkdirp3(path7.dirname(dest), (err3) => {
|
4882
|
+
if (err3)
|
4883
|
+
return cb(err3);
|
4884
|
+
return doRename(src, dest, overwrite, isChangingCase, cb);
|
4885
|
+
});
|
4886
|
+
});
|
4887
|
+
});
|
4888
|
+
}
|
4889
|
+
function isParentRoot(dest) {
|
4890
|
+
const parent = path7.dirname(dest);
|
4891
|
+
const parsedPath = path7.parse(parent);
|
4892
|
+
return parsedPath.root === parent;
|
4893
|
+
}
|
4894
|
+
function doRename(src, dest, overwrite, isChangingCase, cb) {
|
4895
|
+
if (isChangingCase)
|
4896
|
+
return rename2(src, dest, overwrite, cb);
|
4897
|
+
if (overwrite) {
|
4898
|
+
return remove2(dest, (err) => {
|
4899
|
+
if (err)
|
4900
|
+
return cb(err);
|
4901
|
+
return rename2(src, dest, overwrite, cb);
|
4902
|
+
});
|
4903
|
+
}
|
4904
|
+
pathExists(dest, (err, destExists) => {
|
4905
|
+
if (err)
|
4906
|
+
return cb(err);
|
4907
|
+
if (destExists)
|
4908
|
+
return cb(new Error("dest already exists."));
|
4909
|
+
return rename2(src, dest, overwrite, cb);
|
4910
|
+
});
|
4911
|
+
}
|
4912
|
+
function rename2(src, dest, overwrite, cb) {
|
4913
|
+
fs5.rename(src, dest, (err) => {
|
4914
|
+
if (!err)
|
4915
|
+
return cb();
|
4916
|
+
if (err.code !== "EXDEV")
|
4917
|
+
return cb(err);
|
4918
|
+
return moveAcrossDevice(src, dest, overwrite, cb);
|
4919
|
+
});
|
4920
|
+
}
|
4921
|
+
function moveAcrossDevice(src, dest, overwrite, cb) {
|
4922
|
+
const opts = {
|
4923
|
+
overwrite,
|
4924
|
+
errorOnExist: true
|
4925
|
+
};
|
4926
|
+
copy(src, dest, opts, (err) => {
|
4927
|
+
if (err)
|
4928
|
+
return cb(err);
|
4929
|
+
return remove2(src, cb);
|
4930
|
+
});
|
4931
|
+
}
|
4932
|
+
module2.exports = move;
|
4933
|
+
}
|
4934
|
+
});
|
4935
|
+
|
4936
|
+
// ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/index.js
|
4937
|
+
var require_move2 = __commonJS({
|
4938
|
+
"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/index.js"(exports2, module2) {
|
4939
|
+
"use strict";
|
4940
|
+
var u = require_universalify().fromCallback;
|
4941
|
+
module2.exports = {
|
4942
|
+
move: u(require_move())
|
4943
|
+
};
|
4944
|
+
}
|
4945
|
+
});
|
4946
|
+
|
4947
|
+
// ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/index.js
|
4948
|
+
var require_lib = __commonJS({
|
4949
|
+
"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/index.js"(exports2, module2) {
|
4950
|
+
"use strict";
|
4951
|
+
module2.exports = {
|
4952
|
+
// Export promiseified graceful-fs:
|
4953
|
+
...require_fs(),
|
4954
|
+
// Export extra methods:
|
4955
|
+
...require_copy_sync2(),
|
4956
|
+
...require_copy2(),
|
4957
|
+
...require_empty(),
|
4958
|
+
...require_ensure(),
|
4959
|
+
...require_json(),
|
4960
|
+
...require_mkdirs(),
|
4961
|
+
...require_move_sync2(),
|
4962
|
+
...require_move2(),
|
4963
|
+
...require_output(),
|
4964
|
+
...require_path_exists(),
|
4965
|
+
...require_remove()
|
4966
|
+
};
|
4967
|
+
}
|
4968
|
+
});
|
4969
|
+
|
4970
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/internal/streams/stream.js
|
4971
|
+
var require_stream2 = __commonJS({
|
4972
|
+
"../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/internal/streams/stream.js"(exports2, module2) {
|
4973
|
+
module2.exports = require("stream");
|
4974
|
+
}
|
4975
|
+
});
|
4976
|
+
|
4977
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/internal/streams/BufferList.js
|
4978
|
+
var require_BufferList2 = __commonJS({
|
4979
|
+
"../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/internal/streams/BufferList.js"(exports2, module2) {
|
4980
|
+
"use strict";
|
4981
|
+
function _classCallCheck(instance, Constructor) {
|
4982
|
+
if (!(instance instanceof Constructor)) {
|
4983
|
+
throw new TypeError("Cannot call a class as a function");
|
4984
|
+
}
|
4985
|
+
}
|
4986
|
+
var Buffer2 = require_safe_buffer().Buffer;
|
4987
|
+
var util = require("util");
|
4988
|
+
function copyBuffer(src, target, offset) {
|
4989
|
+
src.copy(target, offset);
|
4990
|
+
}
|
4991
|
+
module2.exports = function() {
|
4992
|
+
function BufferList() {
|
4993
|
+
_classCallCheck(this, BufferList);
|
4994
|
+
this.head = null;
|
4995
|
+
this.tail = null;
|
4996
|
+
this.length = 0;
|
4997
|
+
}
|
4998
|
+
BufferList.prototype.push = function push(v) {
|
4999
|
+
var entry = { data: v, next: null };
|
5000
|
+
if (this.length > 0)
|
5001
|
+
this.tail.next = entry;
|
5002
|
+
else
|
5003
|
+
this.head = entry;
|
5004
|
+
this.tail = entry;
|
5005
|
+
++this.length;
|
5006
|
+
};
|
5007
|
+
BufferList.prototype.unshift = function unshift(v) {
|
5008
|
+
var entry = { data: v, next: this.head };
|
5009
|
+
if (this.length === 0)
|
5010
|
+
this.tail = entry;
|
5011
|
+
this.head = entry;
|
5012
|
+
++this.length;
|
5013
|
+
};
|
5014
|
+
BufferList.prototype.shift = function shift() {
|
5015
|
+
if (this.length === 0)
|
5016
|
+
return;
|
5017
|
+
var ret = this.head.data;
|
5018
|
+
if (this.length === 1)
|
5019
|
+
this.head = this.tail = null;
|
5020
|
+
else
|
5021
|
+
this.head = this.head.next;
|
5022
|
+
--this.length;
|
5023
|
+
return ret;
|
5024
|
+
};
|
5025
|
+
BufferList.prototype.clear = function clear() {
|
5026
|
+
this.head = this.tail = null;
|
5027
|
+
this.length = 0;
|
5028
|
+
};
|
5029
|
+
BufferList.prototype.join = function join3(s) {
|
5030
|
+
if (this.length === 0)
|
5031
|
+
return "";
|
5032
|
+
var p = this.head;
|
5033
|
+
var ret = "" + p.data;
|
5034
|
+
while (p = p.next) {
|
5035
|
+
ret += s + p.data;
|
5036
|
+
}
|
5037
|
+
return ret;
|
5038
|
+
};
|
5039
|
+
BufferList.prototype.concat = function concat(n) {
|
5040
|
+
if (this.length === 0)
|
5041
|
+
return Buffer2.alloc(0);
|
5042
|
+
if (this.length === 1)
|
5043
|
+
return this.head.data;
|
5044
|
+
var ret = Buffer2.allocUnsafe(n >>> 0);
|
5045
|
+
var p = this.head;
|
5046
|
+
var i = 0;
|
5047
|
+
while (p) {
|
5048
|
+
copyBuffer(p.data, ret, i);
|
5049
|
+
i += p.data.length;
|
5050
|
+
p = p.next;
|
5051
|
+
}
|
5052
|
+
return ret;
|
5053
|
+
};
|
5054
|
+
return BufferList;
|
5055
|
+
}();
|
5056
|
+
if (util && util.inspect && util.inspect.custom) {
|
5057
|
+
module2.exports.prototype[util.inspect.custom] = function() {
|
5058
|
+
var obj = util.inspect({ length: this.length });
|
5059
|
+
return this.constructor.name + " " + obj;
|
5060
|
+
};
|
5061
|
+
}
|
5062
|
+
}
|
5063
|
+
});
|
5064
|
+
|
5065
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/internal/streams/destroy.js
|
5066
|
+
var require_destroy2 = __commonJS({
|
5067
|
+
"../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
|
5068
|
+
"use strict";
|
5069
|
+
var pna = require_process_nextick_args();
|
5070
|
+
function destroy(err, cb) {
|
5071
|
+
var _this = this;
|
5072
|
+
var readableDestroyed = this._readableState && this._readableState.destroyed;
|
5073
|
+
var writableDestroyed = this._writableState && this._writableState.destroyed;
|
5074
|
+
if (readableDestroyed || writableDestroyed) {
|
5075
|
+
if (cb) {
|
5076
|
+
cb(err);
|
5077
|
+
} else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
|
5078
|
+
pna.nextTick(emitErrorNT, this, err);
|
5079
|
+
}
|
5080
|
+
return this;
|
5081
|
+
}
|
5082
|
+
if (this._readableState) {
|
5083
|
+
this._readableState.destroyed = true;
|
5084
|
+
}
|
5085
|
+
if (this._writableState) {
|
5086
|
+
this._writableState.destroyed = true;
|
5087
|
+
}
|
5088
|
+
this._destroy(err || null, function(err2) {
|
5089
|
+
if (!cb && err2) {
|
5090
|
+
pna.nextTick(emitErrorNT, _this, err2);
|
5091
|
+
if (_this._writableState) {
|
5092
|
+
_this._writableState.errorEmitted = true;
|
5093
|
+
}
|
5094
|
+
} else if (cb) {
|
5095
|
+
cb(err2);
|
5096
|
+
}
|
5097
|
+
});
|
5098
|
+
return this;
|
5099
|
+
}
|
5100
|
+
function undestroy() {
|
5101
|
+
if (this._readableState) {
|
5102
|
+
this._readableState.destroyed = false;
|
5103
|
+
this._readableState.reading = false;
|
5104
|
+
this._readableState.ended = false;
|
5105
|
+
this._readableState.endEmitted = false;
|
5106
|
+
}
|
5107
|
+
if (this._writableState) {
|
5108
|
+
this._writableState.destroyed = false;
|
5109
|
+
this._writableState.ended = false;
|
5110
|
+
this._writableState.ending = false;
|
5111
|
+
this._writableState.finished = false;
|
5112
|
+
this._writableState.errorEmitted = false;
|
5113
|
+
}
|
5114
|
+
}
|
5115
|
+
function emitErrorNT(self2, err) {
|
5116
|
+
self2.emit("error", err);
|
5117
|
+
}
|
5118
|
+
module2.exports = {
|
5119
|
+
destroy,
|
5120
|
+
undestroy
|
5121
|
+
};
|
5122
|
+
}
|
5123
|
+
});
|
5124
|
+
|
5125
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_writable.js
|
5126
|
+
var require_stream_writable2 = __commonJS({
|
5127
|
+
"../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_writable.js"(exports2, module2) {
|
5128
|
+
"use strict";
|
5129
|
+
var pna = require_process_nextick_args();
|
5130
|
+
module2.exports = Writable;
|
5131
|
+
function CorkedRequest(state) {
|
5132
|
+
var _this = this;
|
5133
|
+
this.next = null;
|
5134
|
+
this.entry = null;
|
5135
|
+
this.finish = function() {
|
5136
|
+
onCorkedFinish(_this, state);
|
5137
|
+
};
|
5138
|
+
}
|
5139
|
+
var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
|
5140
|
+
var Duplex;
|
5141
|
+
Writable.WritableState = WritableState;
|
5142
|
+
var util = Object.create(require_util());
|
5143
|
+
util.inherits = require_inherits();
|
5144
|
+
var internalUtil = {
|
5145
|
+
deprecate: require_node()
|
5146
|
+
};
|
5147
|
+
var Stream = require_stream2();
|
5148
|
+
var Buffer2 = require_safe_buffer().Buffer;
|
5149
|
+
var OurUint8Array = global.Uint8Array || function() {
|
5150
|
+
};
|
5151
|
+
function _uint8ArrayToBuffer(chunk) {
|
5152
|
+
return Buffer2.from(chunk);
|
5153
|
+
}
|
5154
|
+
function _isUint8Array(obj) {
|
5155
|
+
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
|
5156
|
+
}
|
5157
|
+
var destroyImpl = require_destroy2();
|
5158
|
+
util.inherits(Writable, Stream);
|
5159
|
+
function nop() {
|
5160
|
+
}
|
5161
|
+
function WritableState(options, stream) {
|
5162
|
+
Duplex = Duplex || require_stream_duplex2();
|
5163
|
+
options = options || {};
|
5164
|
+
var isDuplex = stream instanceof Duplex;
|
5165
|
+
this.objectMode = !!options.objectMode;
|
5166
|
+
if (isDuplex)
|
5167
|
+
this.objectMode = this.objectMode || !!options.writableObjectMode;
|
5168
|
+
var hwm = options.highWaterMark;
|
5169
|
+
var writableHwm = options.writableHighWaterMark;
|
5170
|
+
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
5171
|
+
if (hwm || hwm === 0)
|
5172
|
+
this.highWaterMark = hwm;
|
5173
|
+
else if (isDuplex && (writableHwm || writableHwm === 0))
|
5174
|
+
this.highWaterMark = writableHwm;
|
5175
|
+
else
|
5176
|
+
this.highWaterMark = defaultHwm;
|
5177
|
+
this.highWaterMark = Math.floor(this.highWaterMark);
|
5178
|
+
this.finalCalled = false;
|
5179
|
+
this.needDrain = false;
|
5180
|
+
this.ending = false;
|
5181
|
+
this.ended = false;
|
5182
|
+
this.finished = false;
|
5183
|
+
this.destroyed = false;
|
5184
|
+
var noDecode = options.decodeStrings === false;
|
5185
|
+
this.decodeStrings = !noDecode;
|
5186
|
+
this.defaultEncoding = options.defaultEncoding || "utf8";
|
5187
|
+
this.length = 0;
|
5188
|
+
this.writing = false;
|
5189
|
+
this.corked = 0;
|
5190
|
+
this.sync = true;
|
5191
|
+
this.bufferProcessing = false;
|
5192
|
+
this.onwrite = function(er) {
|
5193
|
+
onwrite(stream, er);
|
5194
|
+
};
|
5195
|
+
this.writecb = null;
|
5196
|
+
this.writelen = 0;
|
5197
|
+
this.bufferedRequest = null;
|
5198
|
+
this.lastBufferedRequest = null;
|
5199
|
+
this.pendingcb = 0;
|
5200
|
+
this.prefinished = false;
|
5201
|
+
this.errorEmitted = false;
|
5202
|
+
this.bufferedRequestCount = 0;
|
5203
|
+
this.corkedRequestsFree = new CorkedRequest(this);
|
5204
|
+
}
|
5205
|
+
WritableState.prototype.getBuffer = function getBuffer() {
|
5206
|
+
var current = this.bufferedRequest;
|
5207
|
+
var out = [];
|
5208
|
+
while (current) {
|
5209
|
+
out.push(current);
|
5210
|
+
current = current.next;
|
5211
|
+
}
|
5212
|
+
return out;
|
5213
|
+
};
|
5214
|
+
(function() {
|
5215
|
+
try {
|
5216
|
+
Object.defineProperty(WritableState.prototype, "buffer", {
|
5217
|
+
get: internalUtil.deprecate(function() {
|
5218
|
+
return this.getBuffer();
|
5219
|
+
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
|
5220
|
+
});
|
5221
|
+
} catch (_) {
|
5222
|
+
}
|
5223
|
+
})();
|
5224
|
+
var realHasInstance;
|
5225
|
+
if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
|
5226
|
+
realHasInstance = Function.prototype[Symbol.hasInstance];
|
5227
|
+
Object.defineProperty(Writable, Symbol.hasInstance, {
|
5228
|
+
value: function(object) {
|
5229
|
+
if (realHasInstance.call(this, object))
|
5230
|
+
return true;
|
5231
|
+
if (this !== Writable)
|
5232
|
+
return false;
|
5233
|
+
return object && object._writableState instanceof WritableState;
|
5234
|
+
}
|
5235
|
+
});
|
5236
|
+
} else {
|
5237
|
+
realHasInstance = function(object) {
|
5238
|
+
return object instanceof this;
|
5239
|
+
};
|
5240
|
+
}
|
5241
|
+
function Writable(options) {
|
5242
|
+
Duplex = Duplex || require_stream_duplex2();
|
5243
|
+
if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
|
5244
|
+
return new Writable(options);
|
5245
|
+
}
|
5246
|
+
this._writableState = new WritableState(options, this);
|
5247
|
+
this.writable = true;
|
5248
|
+
if (options) {
|
5249
|
+
if (typeof options.write === "function")
|
5250
|
+
this._write = options.write;
|
5251
|
+
if (typeof options.writev === "function")
|
5252
|
+
this._writev = options.writev;
|
5253
|
+
if (typeof options.destroy === "function")
|
5254
|
+
this._destroy = options.destroy;
|
5255
|
+
if (typeof options.final === "function")
|
5256
|
+
this._final = options.final;
|
5257
|
+
}
|
5258
|
+
Stream.call(this);
|
5259
|
+
}
|
5260
|
+
Writable.prototype.pipe = function() {
|
5261
|
+
this.emit("error", new Error("Cannot pipe, not readable"));
|
5262
|
+
};
|
5263
|
+
function writeAfterEnd(stream, cb) {
|
5264
|
+
var er = new Error("write after end");
|
5265
|
+
stream.emit("error", er);
|
5266
|
+
pna.nextTick(cb, er);
|
5267
|
+
}
|
5268
|
+
function validChunk(stream, state, chunk, cb) {
|
5269
|
+
var valid = true;
|
5270
|
+
var er = false;
|
5271
|
+
if (chunk === null) {
|
5272
|
+
er = new TypeError("May not write null values to stream");
|
5273
|
+
} else if (typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
|
5274
|
+
er = new TypeError("Invalid non-string/buffer chunk");
|
5275
|
+
}
|
5276
|
+
if (er) {
|
5277
|
+
stream.emit("error", er);
|
5278
|
+
pna.nextTick(cb, er);
|
5279
|
+
valid = false;
|
5280
|
+
}
|
5281
|
+
return valid;
|
5282
|
+
}
|
5283
|
+
Writable.prototype.write = function(chunk, encoding, cb) {
|
5284
|
+
var state = this._writableState;
|
5285
|
+
var ret = false;
|
5286
|
+
var isBuf = !state.objectMode && _isUint8Array(chunk);
|
5287
|
+
if (isBuf && !Buffer2.isBuffer(chunk)) {
|
5288
|
+
chunk = _uint8ArrayToBuffer(chunk);
|
5289
|
+
}
|
5290
|
+
if (typeof encoding === "function") {
|
5291
|
+
cb = encoding;
|
5292
|
+
encoding = null;
|
5293
|
+
}
|
5294
|
+
if (isBuf)
|
5295
|
+
encoding = "buffer";
|
5296
|
+
else if (!encoding)
|
5297
|
+
encoding = state.defaultEncoding;
|
5298
|
+
if (typeof cb !== "function")
|
5299
|
+
cb = nop;
|
5300
|
+
if (state.ended)
|
5301
|
+
writeAfterEnd(this, cb);
|
5302
|
+
else if (isBuf || validChunk(this, state, chunk, cb)) {
|
5303
|
+
state.pendingcb++;
|
5304
|
+
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
5305
|
+
}
|
5306
|
+
return ret;
|
5307
|
+
};
|
5308
|
+
Writable.prototype.cork = function() {
|
5309
|
+
var state = this._writableState;
|
5310
|
+
state.corked++;
|
5311
|
+
};
|
5312
|
+
Writable.prototype.uncork = function() {
|
5313
|
+
var state = this._writableState;
|
5314
|
+
if (state.corked) {
|
5315
|
+
state.corked--;
|
5316
|
+
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest)
|
5317
|
+
clearBuffer(this, state);
|
5318
|
+
}
|
5319
|
+
};
|
5320
|
+
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
5321
|
+
if (typeof encoding === "string")
|
5322
|
+
encoding = encoding.toLowerCase();
|
5323
|
+
if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))
|
5324
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
5325
|
+
this._writableState.defaultEncoding = encoding;
|
5326
|
+
return this;
|
5327
|
+
};
|
5328
|
+
function decodeChunk(state, chunk, encoding) {
|
5329
|
+
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
|
5330
|
+
chunk = Buffer2.from(chunk, encoding);
|
5331
|
+
}
|
5332
|
+
return chunk;
|
5333
|
+
}
|
5334
|
+
Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
|
5335
|
+
// making it explicit this property is not enumerable
|
5336
|
+
// because otherwise some prototype manipulation in
|
5337
|
+
// userland will fail
|
5338
|
+
enumerable: false,
|
5339
|
+
get: function() {
|
5340
|
+
return this._writableState.highWaterMark;
|
5341
|
+
}
|
5342
|
+
});
|
5343
|
+
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
5344
|
+
if (!isBuf) {
|
5345
|
+
var newChunk = decodeChunk(state, chunk, encoding);
|
5346
|
+
if (chunk !== newChunk) {
|
5347
|
+
isBuf = true;
|
5348
|
+
encoding = "buffer";
|
5349
|
+
chunk = newChunk;
|
5350
|
+
}
|
5351
|
+
}
|
5352
|
+
var len = state.objectMode ? 1 : chunk.length;
|
5353
|
+
state.length += len;
|
5354
|
+
var ret = state.length < state.highWaterMark;
|
5355
|
+
if (!ret)
|
5356
|
+
state.needDrain = true;
|
5357
|
+
if (state.writing || state.corked) {
|
5358
|
+
var last = state.lastBufferedRequest;
|
5359
|
+
state.lastBufferedRequest = {
|
5360
|
+
chunk,
|
5361
|
+
encoding,
|
5362
|
+
isBuf,
|
5363
|
+
callback: cb,
|
5364
|
+
next: null
|
5365
|
+
};
|
5366
|
+
if (last) {
|
5367
|
+
last.next = state.lastBufferedRequest;
|
5368
|
+
} else {
|
5369
|
+
state.bufferedRequest = state.lastBufferedRequest;
|
5370
|
+
}
|
5371
|
+
state.bufferedRequestCount += 1;
|
5372
|
+
} else {
|
5373
|
+
doWrite(stream, state, false, len, chunk, encoding, cb);
|
5374
|
+
}
|
5375
|
+
return ret;
|
5376
|
+
}
|
5377
|
+
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
5378
|
+
state.writelen = len;
|
5379
|
+
state.writecb = cb;
|
5380
|
+
state.writing = true;
|
5381
|
+
state.sync = true;
|
5382
|
+
if (writev)
|
5383
|
+
stream._writev(chunk, state.onwrite);
|
5384
|
+
else
|
5385
|
+
stream._write(chunk, encoding, state.onwrite);
|
5386
|
+
state.sync = false;
|
5387
|
+
}
|
5388
|
+
function onwriteError(stream, state, sync, er, cb) {
|
5389
|
+
--state.pendingcb;
|
5390
|
+
if (sync) {
|
5391
|
+
pna.nextTick(cb, er);
|
5392
|
+
pna.nextTick(finishMaybe, stream, state);
|
5393
|
+
stream._writableState.errorEmitted = true;
|
5394
|
+
stream.emit("error", er);
|
5395
|
+
} else {
|
5396
|
+
cb(er);
|
5397
|
+
stream._writableState.errorEmitted = true;
|
5398
|
+
stream.emit("error", er);
|
5399
|
+
finishMaybe(stream, state);
|
5400
|
+
}
|
5401
|
+
}
|
5402
|
+
function onwriteStateUpdate(state) {
|
5403
|
+
state.writing = false;
|
5404
|
+
state.writecb = null;
|
5405
|
+
state.length -= state.writelen;
|
5406
|
+
state.writelen = 0;
|
5407
|
+
}
|
5408
|
+
function onwrite(stream, er) {
|
5409
|
+
var state = stream._writableState;
|
5410
|
+
var sync = state.sync;
|
5411
|
+
var cb = state.writecb;
|
5412
|
+
onwriteStateUpdate(state);
|
5413
|
+
if (er)
|
5414
|
+
onwriteError(stream, state, sync, er, cb);
|
5415
|
+
else {
|
5416
|
+
var finished = needFinish(state);
|
5417
|
+
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
5418
|
+
clearBuffer(stream, state);
|
5419
|
+
}
|
5420
|
+
if (sync) {
|
5421
|
+
asyncWrite(afterWrite, stream, state, finished, cb);
|
5422
|
+
} else {
|
5423
|
+
afterWrite(stream, state, finished, cb);
|
5424
|
+
}
|
5425
|
+
}
|
5426
|
+
}
|
5427
|
+
function afterWrite(stream, state, finished, cb) {
|
5428
|
+
if (!finished)
|
5429
|
+
onwriteDrain(stream, state);
|
5430
|
+
state.pendingcb--;
|
5431
|
+
cb();
|
5432
|
+
finishMaybe(stream, state);
|
5433
|
+
}
|
5434
|
+
function onwriteDrain(stream, state) {
|
5435
|
+
if (state.length === 0 && state.needDrain) {
|
5436
|
+
state.needDrain = false;
|
5437
|
+
stream.emit("drain");
|
5438
|
+
}
|
5439
|
+
}
|
5440
|
+
function clearBuffer(stream, state) {
|
5441
|
+
state.bufferProcessing = true;
|
5442
|
+
var entry = state.bufferedRequest;
|
5443
|
+
if (stream._writev && entry && entry.next) {
|
5444
|
+
var l = state.bufferedRequestCount;
|
5445
|
+
var buffer = new Array(l);
|
5446
|
+
var holder = state.corkedRequestsFree;
|
5447
|
+
holder.entry = entry;
|
5448
|
+
var count = 0;
|
5449
|
+
var allBuffers = true;
|
5450
|
+
while (entry) {
|
5451
|
+
buffer[count] = entry;
|
5452
|
+
if (!entry.isBuf)
|
5453
|
+
allBuffers = false;
|
5454
|
+
entry = entry.next;
|
5455
|
+
count += 1;
|
5456
|
+
}
|
5457
|
+
buffer.allBuffers = allBuffers;
|
5458
|
+
doWrite(stream, state, true, state.length, buffer, "", holder.finish);
|
5459
|
+
state.pendingcb++;
|
5460
|
+
state.lastBufferedRequest = null;
|
5461
|
+
if (holder.next) {
|
5462
|
+
state.corkedRequestsFree = holder.next;
|
5463
|
+
holder.next = null;
|
5464
|
+
} else {
|
5465
|
+
state.corkedRequestsFree = new CorkedRequest(state);
|
5466
|
+
}
|
5467
|
+
state.bufferedRequestCount = 0;
|
5468
|
+
} else {
|
5469
|
+
while (entry) {
|
5470
|
+
var chunk = entry.chunk;
|
5471
|
+
var encoding = entry.encoding;
|
5472
|
+
var cb = entry.callback;
|
5473
|
+
var len = state.objectMode ? 1 : chunk.length;
|
5474
|
+
doWrite(stream, state, false, len, chunk, encoding, cb);
|
5475
|
+
entry = entry.next;
|
5476
|
+
state.bufferedRequestCount--;
|
5477
|
+
if (state.writing) {
|
5478
|
+
break;
|
5479
|
+
}
|
5480
|
+
}
|
5481
|
+
if (entry === null)
|
5482
|
+
state.lastBufferedRequest = null;
|
5483
|
+
}
|
5484
|
+
state.bufferedRequest = entry;
|
5485
|
+
state.bufferProcessing = false;
|
5486
|
+
}
|
5487
|
+
Writable.prototype._write = function(chunk, encoding, cb) {
|
5488
|
+
cb(new Error("_write() is not implemented"));
|
5489
|
+
};
|
5490
|
+
Writable.prototype._writev = null;
|
5491
|
+
Writable.prototype.end = function(chunk, encoding, cb) {
|
5492
|
+
var state = this._writableState;
|
5493
|
+
if (typeof chunk === "function") {
|
5494
|
+
cb = chunk;
|
5495
|
+
chunk = null;
|
5496
|
+
encoding = null;
|
5497
|
+
} else if (typeof encoding === "function") {
|
5498
|
+
cb = encoding;
|
5499
|
+
encoding = null;
|
5500
|
+
}
|
5501
|
+
if (chunk !== null && chunk !== void 0)
|
5502
|
+
this.write(chunk, encoding);
|
5503
|
+
if (state.corked) {
|
5504
|
+
state.corked = 1;
|
5505
|
+
this.uncork();
|
5506
|
+
}
|
5507
|
+
if (!state.ending && !state.finished)
|
5508
|
+
endWritable(this, state, cb);
|
5509
|
+
};
|
5510
|
+
function needFinish(state) {
|
5511
|
+
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
5512
|
+
}
|
5513
|
+
function callFinal(stream, state) {
|
5514
|
+
stream._final(function(err) {
|
5515
|
+
state.pendingcb--;
|
5516
|
+
if (err) {
|
5517
|
+
stream.emit("error", err);
|
5518
|
+
}
|
5519
|
+
state.prefinished = true;
|
5520
|
+
stream.emit("prefinish");
|
5521
|
+
finishMaybe(stream, state);
|
5522
|
+
});
|
5523
|
+
}
|
5524
|
+
function prefinish(stream, state) {
|
5525
|
+
if (!state.prefinished && !state.finalCalled) {
|
5526
|
+
if (typeof stream._final === "function") {
|
5527
|
+
state.pendingcb++;
|
5528
|
+
state.finalCalled = true;
|
5529
|
+
pna.nextTick(callFinal, stream, state);
|
5530
|
+
} else {
|
5531
|
+
state.prefinished = true;
|
5532
|
+
stream.emit("prefinish");
|
5533
|
+
}
|
5534
|
+
}
|
5535
|
+
}
|
5536
|
+
function finishMaybe(stream, state) {
|
5537
|
+
var need = needFinish(state);
|
5538
|
+
if (need) {
|
5539
|
+
prefinish(stream, state);
|
5540
|
+
if (state.pendingcb === 0) {
|
5541
|
+
state.finished = true;
|
5542
|
+
stream.emit("finish");
|
5543
|
+
}
|
5544
|
+
}
|
5545
|
+
return need;
|
5546
|
+
}
|
5547
|
+
function endWritable(stream, state, cb) {
|
5548
|
+
state.ending = true;
|
5549
|
+
finishMaybe(stream, state);
|
5550
|
+
if (cb) {
|
5551
|
+
if (state.finished)
|
5552
|
+
pna.nextTick(cb);
|
5553
|
+
else
|
5554
|
+
stream.once("finish", cb);
|
5555
|
+
}
|
5556
|
+
state.ended = true;
|
5557
|
+
stream.writable = false;
|
5558
|
+
}
|
5559
|
+
function onCorkedFinish(corkReq, state, err) {
|
5560
|
+
var entry = corkReq.entry;
|
5561
|
+
corkReq.entry = null;
|
5562
|
+
while (entry) {
|
5563
|
+
var cb = entry.callback;
|
5564
|
+
state.pendingcb--;
|
5565
|
+
cb(err);
|
5566
|
+
entry = entry.next;
|
5567
|
+
}
|
5568
|
+
if (state.corkedRequestsFree) {
|
5569
|
+
state.corkedRequestsFree.next = corkReq;
|
5570
|
+
} else {
|
5571
|
+
state.corkedRequestsFree = corkReq;
|
5572
|
+
}
|
5573
|
+
}
|
5574
|
+
Object.defineProperty(Writable.prototype, "destroyed", {
|
5575
|
+
get: function() {
|
5576
|
+
if (this._writableState === void 0) {
|
5577
|
+
return false;
|
5578
|
+
}
|
5579
|
+
return this._writableState.destroyed;
|
5580
|
+
},
|
5581
|
+
set: function(value) {
|
5582
|
+
if (!this._writableState) {
|
5583
|
+
return;
|
5584
|
+
}
|
5585
|
+
this._writableState.destroyed = value;
|
5586
|
+
}
|
5587
|
+
});
|
5588
|
+
Writable.prototype.destroy = destroyImpl.destroy;
|
5589
|
+
Writable.prototype._undestroy = destroyImpl.undestroy;
|
5590
|
+
Writable.prototype._destroy = function(err, cb) {
|
5591
|
+
this.end();
|
5592
|
+
cb(err);
|
5593
|
+
};
|
5594
|
+
}
|
5595
|
+
});
|
5596
|
+
|
5597
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_duplex.js
|
5598
|
+
var require_stream_duplex2 = __commonJS({
|
5599
|
+
"../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_duplex.js"(exports2, module2) {
|
5600
|
+
"use strict";
|
5601
|
+
var pna = require_process_nextick_args();
|
5602
|
+
var objectKeys = Object.keys || function(obj) {
|
5603
|
+
var keys2 = [];
|
5604
|
+
for (var key in obj) {
|
5605
|
+
keys2.push(key);
|
5606
|
+
}
|
5607
|
+
return keys2;
|
5608
|
+
};
|
5609
|
+
module2.exports = Duplex;
|
5610
|
+
var util = Object.create(require_util());
|
5611
|
+
util.inherits = require_inherits();
|
5612
|
+
var Readable = require_stream_readable2();
|
5613
|
+
var Writable = require_stream_writable2();
|
5614
|
+
util.inherits(Duplex, Readable);
|
5615
|
+
{
|
5616
|
+
keys = objectKeys(Writable.prototype);
|
5617
|
+
for (v = 0; v < keys.length; v++) {
|
5618
|
+
method = keys[v];
|
5619
|
+
if (!Duplex.prototype[method])
|
5620
|
+
Duplex.prototype[method] = Writable.prototype[method];
|
5621
|
+
}
|
5622
|
+
}
|
5623
|
+
var keys;
|
5624
|
+
var method;
|
5625
|
+
var v;
|
5626
|
+
function Duplex(options) {
|
5627
|
+
if (!(this instanceof Duplex))
|
5628
|
+
return new Duplex(options);
|
5629
|
+
Readable.call(this, options);
|
5630
|
+
Writable.call(this, options);
|
5631
|
+
if (options && options.readable === false)
|
5632
|
+
this.readable = false;
|
5633
|
+
if (options && options.writable === false)
|
5634
|
+
this.writable = false;
|
5635
|
+
this.allowHalfOpen = true;
|
5636
|
+
if (options && options.allowHalfOpen === false)
|
5637
|
+
this.allowHalfOpen = false;
|
5638
|
+
this.once("end", onend);
|
5639
|
+
}
|
5640
|
+
Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
|
5641
|
+
// making it explicit this property is not enumerable
|
5642
|
+
// because otherwise some prototype manipulation in
|
5643
|
+
// userland will fail
|
5644
|
+
enumerable: false,
|
5645
|
+
get: function() {
|
5646
|
+
return this._writableState.highWaterMark;
|
5647
|
+
}
|
5648
|
+
});
|
5649
|
+
function onend() {
|
5650
|
+
if (this.allowHalfOpen || this._writableState.ended)
|
5651
|
+
return;
|
5652
|
+
pna.nextTick(onEndNT, this);
|
5653
|
+
}
|
5654
|
+
function onEndNT(self2) {
|
5655
|
+
self2.end();
|
5656
|
+
}
|
5657
|
+
Object.defineProperty(Duplex.prototype, "destroyed", {
|
5658
|
+
get: function() {
|
5659
|
+
if (this._readableState === void 0 || this._writableState === void 0) {
|
5660
|
+
return false;
|
5661
|
+
}
|
5662
|
+
return this._readableState.destroyed && this._writableState.destroyed;
|
5663
|
+
},
|
5664
|
+
set: function(value) {
|
5665
|
+
if (this._readableState === void 0 || this._writableState === void 0) {
|
5666
|
+
return;
|
5667
|
+
}
|
5668
|
+
this._readableState.destroyed = value;
|
5669
|
+
this._writableState.destroyed = value;
|
5670
|
+
}
|
5671
|
+
});
|
5672
|
+
Duplex.prototype._destroy = function(err, cb) {
|
5673
|
+
this.push(null);
|
5674
|
+
this.end();
|
5675
|
+
pna.nextTick(cb, err);
|
5676
|
+
};
|
5677
|
+
}
|
5678
|
+
});
|
5679
|
+
|
5680
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_readable.js
|
5681
|
+
var require_stream_readable2 = __commonJS({
|
5682
|
+
"../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_readable.js"(exports2, module2) {
|
5683
|
+
"use strict";
|
5684
|
+
var pna = require_process_nextick_args();
|
5685
|
+
module2.exports = Readable;
|
5686
|
+
var isArray = require_isarray();
|
5687
|
+
var Duplex;
|
5688
|
+
Readable.ReadableState = ReadableState;
|
5689
|
+
var EE = require("events").EventEmitter;
|
5690
|
+
var EElistenerCount = function(emitter, type) {
|
5691
|
+
return emitter.listeners(type).length;
|
5692
|
+
};
|
5693
|
+
var Stream = require_stream2();
|
5694
|
+
var Buffer2 = require_safe_buffer().Buffer;
|
5695
|
+
var OurUint8Array = global.Uint8Array || function() {
|
5696
|
+
};
|
5697
|
+
function _uint8ArrayToBuffer(chunk) {
|
5698
|
+
return Buffer2.from(chunk);
|
5699
|
+
}
|
5700
|
+
function _isUint8Array(obj) {
|
5701
|
+
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
|
5702
|
+
}
|
5703
|
+
var util = Object.create(require_util());
|
5704
|
+
util.inherits = require_inherits();
|
5705
|
+
var debugUtil = require("util");
|
5706
|
+
var debug2 = void 0;
|
5707
|
+
if (debugUtil && debugUtil.debuglog) {
|
5708
|
+
debug2 = debugUtil.debuglog("stream");
|
5709
|
+
} else {
|
5710
|
+
debug2 = function() {
|
5711
|
+
};
|
5712
|
+
}
|
5713
|
+
var BufferList = require_BufferList2();
|
5714
|
+
var destroyImpl = require_destroy2();
|
5715
|
+
var StringDecoder;
|
5716
|
+
util.inherits(Readable, Stream);
|
5717
|
+
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
|
5718
|
+
function prependListener(emitter, event, fn) {
|
5719
|
+
if (typeof emitter.prependListener === "function")
|
5720
|
+
return emitter.prependListener(event, fn);
|
5721
|
+
if (!emitter._events || !emitter._events[event])
|
5722
|
+
emitter.on(event, fn);
|
5723
|
+
else if (isArray(emitter._events[event]))
|
5724
|
+
emitter._events[event].unshift(fn);
|
5725
|
+
else
|
5726
|
+
emitter._events[event] = [fn, emitter._events[event]];
|
5727
|
+
}
|
5728
|
+
function ReadableState(options, stream) {
|
5729
|
+
Duplex = Duplex || require_stream_duplex2();
|
5730
|
+
options = options || {};
|
5731
|
+
var isDuplex = stream instanceof Duplex;
|
5732
|
+
this.objectMode = !!options.objectMode;
|
5733
|
+
if (isDuplex)
|
5734
|
+
this.objectMode = this.objectMode || !!options.readableObjectMode;
|
5735
|
+
var hwm = options.highWaterMark;
|
5736
|
+
var readableHwm = options.readableHighWaterMark;
|
5737
|
+
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
5738
|
+
if (hwm || hwm === 0)
|
5739
|
+
this.highWaterMark = hwm;
|
5740
|
+
else if (isDuplex && (readableHwm || readableHwm === 0))
|
5741
|
+
this.highWaterMark = readableHwm;
|
5742
|
+
else
|
5743
|
+
this.highWaterMark = defaultHwm;
|
5744
|
+
this.highWaterMark = Math.floor(this.highWaterMark);
|
5745
|
+
this.buffer = new BufferList();
|
5746
|
+
this.length = 0;
|
5747
|
+
this.pipes = null;
|
5748
|
+
this.pipesCount = 0;
|
5749
|
+
this.flowing = null;
|
5750
|
+
this.ended = false;
|
5751
|
+
this.endEmitted = false;
|
5752
|
+
this.reading = false;
|
5753
|
+
this.sync = true;
|
5754
|
+
this.needReadable = false;
|
5755
|
+
this.emittedReadable = false;
|
5756
|
+
this.readableListening = false;
|
5757
|
+
this.resumeScheduled = false;
|
5758
|
+
this.destroyed = false;
|
5759
|
+
this.defaultEncoding = options.defaultEncoding || "utf8";
|
5760
|
+
this.awaitDrain = 0;
|
5761
|
+
this.readingMore = false;
|
5762
|
+
this.decoder = null;
|
5763
|
+
this.encoding = null;
|
5764
|
+
if (options.encoding) {
|
5765
|
+
if (!StringDecoder)
|
5766
|
+
StringDecoder = require_string_decoder().StringDecoder;
|
5767
|
+
this.decoder = new StringDecoder(options.encoding);
|
5768
|
+
this.encoding = options.encoding;
|
5769
|
+
}
|
5770
|
+
}
|
5771
|
+
function Readable(options) {
|
5772
|
+
Duplex = Duplex || require_stream_duplex2();
|
5773
|
+
if (!(this instanceof Readable))
|
5774
|
+
return new Readable(options);
|
5775
|
+
this._readableState = new ReadableState(options, this);
|
5776
|
+
this.readable = true;
|
5777
|
+
if (options) {
|
5778
|
+
if (typeof options.read === "function")
|
5779
|
+
this._read = options.read;
|
5780
|
+
if (typeof options.destroy === "function")
|
5781
|
+
this._destroy = options.destroy;
|
5782
|
+
}
|
5783
|
+
Stream.call(this);
|
5784
|
+
}
|
5785
|
+
Object.defineProperty(Readable.prototype, "destroyed", {
|
5786
|
+
get: function() {
|
5787
|
+
if (this._readableState === void 0) {
|
5788
|
+
return false;
|
5789
|
+
}
|
5790
|
+
return this._readableState.destroyed;
|
5791
|
+
},
|
5792
|
+
set: function(value) {
|
5793
|
+
if (!this._readableState) {
|
5794
|
+
return;
|
5795
|
+
}
|
5796
|
+
this._readableState.destroyed = value;
|
5797
|
+
}
|
5798
|
+
});
|
5799
|
+
Readable.prototype.destroy = destroyImpl.destroy;
|
5800
|
+
Readable.prototype._undestroy = destroyImpl.undestroy;
|
5801
|
+
Readable.prototype._destroy = function(err, cb) {
|
5802
|
+
this.push(null);
|
5803
|
+
cb(err);
|
5804
|
+
};
|
5805
|
+
Readable.prototype.push = function(chunk, encoding) {
|
5806
|
+
var state = this._readableState;
|
5807
|
+
var skipChunkCheck;
|
5808
|
+
if (!state.objectMode) {
|
5809
|
+
if (typeof chunk === "string") {
|
5810
|
+
encoding = encoding || state.defaultEncoding;
|
5811
|
+
if (encoding !== state.encoding) {
|
5812
|
+
chunk = Buffer2.from(chunk, encoding);
|
5813
|
+
encoding = "";
|
5814
|
+
}
|
5815
|
+
skipChunkCheck = true;
|
5816
|
+
}
|
5817
|
+
} else {
|
5818
|
+
skipChunkCheck = true;
|
5819
|
+
}
|
5820
|
+
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
5821
|
+
};
|
5822
|
+
Readable.prototype.unshift = function(chunk) {
|
5823
|
+
return readableAddChunk(this, chunk, null, true, false);
|
5824
|
+
};
|
5825
|
+
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
5826
|
+
var state = stream._readableState;
|
5827
|
+
if (chunk === null) {
|
5828
|
+
state.reading = false;
|
5829
|
+
onEofChunk(stream, state);
|
5830
|
+
} else {
|
5831
|
+
var er;
|
5832
|
+
if (!skipChunkCheck)
|
5833
|
+
er = chunkInvalid(state, chunk);
|
5834
|
+
if (er) {
|
5835
|
+
stream.emit("error", er);
|
5836
|
+
} else if (state.objectMode || chunk && chunk.length > 0) {
|
5837
|
+
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
|
5838
|
+
chunk = _uint8ArrayToBuffer(chunk);
|
5839
|
+
}
|
5840
|
+
if (addToFront) {
|
5841
|
+
if (state.endEmitted)
|
5842
|
+
stream.emit("error", new Error("stream.unshift() after end event"));
|
5843
|
+
else
|
5844
|
+
addChunk(stream, state, chunk, true);
|
5845
|
+
} else if (state.ended) {
|
5846
|
+
stream.emit("error", new Error("stream.push() after EOF"));
|
5847
|
+
} else {
|
5848
|
+
state.reading = false;
|
5849
|
+
if (state.decoder && !encoding) {
|
5850
|
+
chunk = state.decoder.write(chunk);
|
5851
|
+
if (state.objectMode || chunk.length !== 0)
|
5852
|
+
addChunk(stream, state, chunk, false);
|
5853
|
+
else
|
5854
|
+
maybeReadMore(stream, state);
|
5855
|
+
} else {
|
5856
|
+
addChunk(stream, state, chunk, false);
|
5857
|
+
}
|
5858
|
+
}
|
5859
|
+
} else if (!addToFront) {
|
5860
|
+
state.reading = false;
|
5861
|
+
}
|
5862
|
+
}
|
5863
|
+
return needMoreData(state);
|
5864
|
+
}
|
5865
|
+
function addChunk(stream, state, chunk, addToFront) {
|
5866
|
+
if (state.flowing && state.length === 0 && !state.sync) {
|
5867
|
+
stream.emit("data", chunk);
|
5868
|
+
stream.read(0);
|
5869
|
+
} else {
|
5870
|
+
state.length += state.objectMode ? 1 : chunk.length;
|
5871
|
+
if (addToFront)
|
5872
|
+
state.buffer.unshift(chunk);
|
5873
|
+
else
|
5874
|
+
state.buffer.push(chunk);
|
5875
|
+
if (state.needReadable)
|
5876
|
+
emitReadable(stream);
|
5877
|
+
}
|
5878
|
+
maybeReadMore(stream, state);
|
5879
|
+
}
|
5880
|
+
function chunkInvalid(state, chunk) {
|
5881
|
+
var er;
|
5882
|
+
if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
|
5883
|
+
er = new TypeError("Invalid non-string/buffer chunk");
|
5884
|
+
}
|
5885
|
+
return er;
|
5886
|
+
}
|
5887
|
+
function needMoreData(state) {
|
5888
|
+
return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
|
5889
|
+
}
|
5890
|
+
Readable.prototype.isPaused = function() {
|
5891
|
+
return this._readableState.flowing === false;
|
5892
|
+
};
|
5893
|
+
Readable.prototype.setEncoding = function(enc) {
|
5894
|
+
if (!StringDecoder)
|
5895
|
+
StringDecoder = require_string_decoder().StringDecoder;
|
5896
|
+
this._readableState.decoder = new StringDecoder(enc);
|
5897
|
+
this._readableState.encoding = enc;
|
5898
|
+
return this;
|
5899
|
+
};
|
5900
|
+
var MAX_HWM = 8388608;
|
5901
|
+
function computeNewHighWaterMark(n) {
|
5902
|
+
if (n >= MAX_HWM) {
|
5903
|
+
n = MAX_HWM;
|
5904
|
+
} else {
|
5905
|
+
n--;
|
5906
|
+
n |= n >>> 1;
|
5907
|
+
n |= n >>> 2;
|
5908
|
+
n |= n >>> 4;
|
5909
|
+
n |= n >>> 8;
|
5910
|
+
n |= n >>> 16;
|
5911
|
+
n++;
|
5912
|
+
}
|
5913
|
+
return n;
|
5914
|
+
}
|
5915
|
+
function howMuchToRead(n, state) {
|
5916
|
+
if (n <= 0 || state.length === 0 && state.ended)
|
5917
|
+
return 0;
|
5918
|
+
if (state.objectMode)
|
5919
|
+
return 1;
|
5920
|
+
if (n !== n) {
|
5921
|
+
if (state.flowing && state.length)
|
5922
|
+
return state.buffer.head.data.length;
|
5923
|
+
else
|
5924
|
+
return state.length;
|
5925
|
+
}
|
5926
|
+
if (n > state.highWaterMark)
|
5927
|
+
state.highWaterMark = computeNewHighWaterMark(n);
|
5928
|
+
if (n <= state.length)
|
5929
|
+
return n;
|
5930
|
+
if (!state.ended) {
|
5931
|
+
state.needReadable = true;
|
5932
|
+
return 0;
|
5933
|
+
}
|
5934
|
+
return state.length;
|
5935
|
+
}
|
5936
|
+
Readable.prototype.read = function(n) {
|
5937
|
+
debug2("read", n);
|
5938
|
+
n = parseInt(n, 10);
|
5939
|
+
var state = this._readableState;
|
5940
|
+
var nOrig = n;
|
5941
|
+
if (n !== 0)
|
5942
|
+
state.emittedReadable = false;
|
5943
|
+
if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
|
5944
|
+
debug2("read: emitReadable", state.length, state.ended);
|
5945
|
+
if (state.length === 0 && state.ended)
|
5946
|
+
endReadable(this);
|
5947
|
+
else
|
5948
|
+
emitReadable(this);
|
5949
|
+
return null;
|
5950
|
+
}
|
5951
|
+
n = howMuchToRead(n, state);
|
5952
|
+
if (n === 0 && state.ended) {
|
5953
|
+
if (state.length === 0)
|
5954
|
+
endReadable(this);
|
5955
|
+
return null;
|
5956
|
+
}
|
5957
|
+
var doRead = state.needReadable;
|
5958
|
+
debug2("need readable", doRead);
|
5959
|
+
if (state.length === 0 || state.length - n < state.highWaterMark) {
|
5960
|
+
doRead = true;
|
5961
|
+
debug2("length less than watermark", doRead);
|
5962
|
+
}
|
5963
|
+
if (state.ended || state.reading) {
|
5964
|
+
doRead = false;
|
5965
|
+
debug2("reading or ended", doRead);
|
5966
|
+
} else if (doRead) {
|
5967
|
+
debug2("do read");
|
5968
|
+
state.reading = true;
|
5969
|
+
state.sync = true;
|
5970
|
+
if (state.length === 0)
|
5971
|
+
state.needReadable = true;
|
5972
|
+
this._read(state.highWaterMark);
|
5973
|
+
state.sync = false;
|
5974
|
+
if (!state.reading)
|
5975
|
+
n = howMuchToRead(nOrig, state);
|
5976
|
+
}
|
5977
|
+
var ret;
|
5978
|
+
if (n > 0)
|
5979
|
+
ret = fromList(n, state);
|
5980
|
+
else
|
5981
|
+
ret = null;
|
5982
|
+
if (ret === null) {
|
5983
|
+
state.needReadable = true;
|
5984
|
+
n = 0;
|
5985
|
+
} else {
|
5986
|
+
state.length -= n;
|
5987
|
+
}
|
5988
|
+
if (state.length === 0) {
|
5989
|
+
if (!state.ended)
|
5990
|
+
state.needReadable = true;
|
5991
|
+
if (nOrig !== n && state.ended)
|
5992
|
+
endReadable(this);
|
5993
|
+
}
|
5994
|
+
if (ret !== null)
|
5995
|
+
this.emit("data", ret);
|
5996
|
+
return ret;
|
5997
|
+
};
|
5998
|
+
function onEofChunk(stream, state) {
|
5999
|
+
if (state.ended)
|
6000
|
+
return;
|
6001
|
+
if (state.decoder) {
|
6002
|
+
var chunk = state.decoder.end();
|
6003
|
+
if (chunk && chunk.length) {
|
6004
|
+
state.buffer.push(chunk);
|
6005
|
+
state.length += state.objectMode ? 1 : chunk.length;
|
6006
|
+
}
|
6007
|
+
}
|
6008
|
+
state.ended = true;
|
6009
|
+
emitReadable(stream);
|
6010
|
+
}
|
6011
|
+
function emitReadable(stream) {
|
6012
|
+
var state = stream._readableState;
|
6013
|
+
state.needReadable = false;
|
6014
|
+
if (!state.emittedReadable) {
|
6015
|
+
debug2("emitReadable", state.flowing);
|
6016
|
+
state.emittedReadable = true;
|
6017
|
+
if (state.sync)
|
6018
|
+
pna.nextTick(emitReadable_, stream);
|
6019
|
+
else
|
6020
|
+
emitReadable_(stream);
|
6021
|
+
}
|
6022
|
+
}
|
6023
|
+
function emitReadable_(stream) {
|
6024
|
+
debug2("emit readable");
|
6025
|
+
stream.emit("readable");
|
6026
|
+
flow(stream);
|
6027
|
+
}
|
6028
|
+
function maybeReadMore(stream, state) {
|
6029
|
+
if (!state.readingMore) {
|
6030
|
+
state.readingMore = true;
|
6031
|
+
pna.nextTick(maybeReadMore_, stream, state);
|
6032
|
+
}
|
6033
|
+
}
|
6034
|
+
function maybeReadMore_(stream, state) {
|
6035
|
+
var len = state.length;
|
6036
|
+
while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
|
6037
|
+
debug2("maybeReadMore read 0");
|
6038
|
+
stream.read(0);
|
6039
|
+
if (len === state.length)
|
6040
|
+
break;
|
6041
|
+
else
|
6042
|
+
len = state.length;
|
6043
|
+
}
|
6044
|
+
state.readingMore = false;
|
6045
|
+
}
|
6046
|
+
Readable.prototype._read = function(n) {
|
6047
|
+
this.emit("error", new Error("_read() is not implemented"));
|
6048
|
+
};
|
6049
|
+
Readable.prototype.pipe = function(dest, pipeOpts) {
|
6050
|
+
var src = this;
|
6051
|
+
var state = this._readableState;
|
6052
|
+
switch (state.pipesCount) {
|
6053
|
+
case 0:
|
6054
|
+
state.pipes = dest;
|
6055
|
+
break;
|
6056
|
+
case 1:
|
6057
|
+
state.pipes = [state.pipes, dest];
|
6058
|
+
break;
|
6059
|
+
default:
|
6060
|
+
state.pipes.push(dest);
|
6061
|
+
break;
|
6062
|
+
}
|
6063
|
+
state.pipesCount += 1;
|
6064
|
+
debug2("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
|
6065
|
+
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
6066
|
+
var endFn = doEnd ? onend : unpipe;
|
6067
|
+
if (state.endEmitted)
|
6068
|
+
pna.nextTick(endFn);
|
6069
|
+
else
|
6070
|
+
src.once("end", endFn);
|
6071
|
+
dest.on("unpipe", onunpipe);
|
6072
|
+
function onunpipe(readable, unpipeInfo) {
|
6073
|
+
debug2("onunpipe");
|
6074
|
+
if (readable === src) {
|
6075
|
+
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
6076
|
+
unpipeInfo.hasUnpiped = true;
|
6077
|
+
cleanup();
|
6078
|
+
}
|
6079
|
+
}
|
6080
|
+
}
|
6081
|
+
function onend() {
|
6082
|
+
debug2("onend");
|
6083
|
+
dest.end();
|
6084
|
+
}
|
6085
|
+
var ondrain = pipeOnDrain(src);
|
6086
|
+
dest.on("drain", ondrain);
|
6087
|
+
var cleanedUp = false;
|
6088
|
+
function cleanup() {
|
6089
|
+
debug2("cleanup");
|
6090
|
+
dest.removeListener("close", onclose);
|
6091
|
+
dest.removeListener("finish", onfinish);
|
6092
|
+
dest.removeListener("drain", ondrain);
|
6093
|
+
dest.removeListener("error", onerror);
|
6094
|
+
dest.removeListener("unpipe", onunpipe);
|
6095
|
+
src.removeListener("end", onend);
|
6096
|
+
src.removeListener("end", unpipe);
|
6097
|
+
src.removeListener("data", ondata);
|
6098
|
+
cleanedUp = true;
|
6099
|
+
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))
|
6100
|
+
ondrain();
|
6101
|
+
}
|
6102
|
+
var increasedAwaitDrain = false;
|
6103
|
+
src.on("data", ondata);
|
6104
|
+
function ondata(chunk) {
|
6105
|
+
debug2("ondata");
|
6106
|
+
increasedAwaitDrain = false;
|
6107
|
+
var ret = dest.write(chunk);
|
6108
|
+
if (false === ret && !increasedAwaitDrain) {
|
6109
|
+
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
6110
|
+
debug2("false write response, pause", src._readableState.awaitDrain);
|
6111
|
+
src._readableState.awaitDrain++;
|
6112
|
+
increasedAwaitDrain = true;
|
6113
|
+
}
|
6114
|
+
src.pause();
|
6115
|
+
}
|
6116
|
+
}
|
6117
|
+
function onerror(er) {
|
6118
|
+
debug2("onerror", er);
|
6119
|
+
unpipe();
|
6120
|
+
dest.removeListener("error", onerror);
|
6121
|
+
if (EElistenerCount(dest, "error") === 0)
|
6122
|
+
dest.emit("error", er);
|
6123
|
+
}
|
6124
|
+
prependListener(dest, "error", onerror);
|
6125
|
+
function onclose() {
|
6126
|
+
dest.removeListener("finish", onfinish);
|
6127
|
+
unpipe();
|
6128
|
+
}
|
6129
|
+
dest.once("close", onclose);
|
6130
|
+
function onfinish() {
|
6131
|
+
debug2("onfinish");
|
6132
|
+
dest.removeListener("close", onclose);
|
6133
|
+
unpipe();
|
6134
|
+
}
|
6135
|
+
dest.once("finish", onfinish);
|
6136
|
+
function unpipe() {
|
6137
|
+
debug2("unpipe");
|
6138
|
+
src.unpipe(dest);
|
6139
|
+
}
|
6140
|
+
dest.emit("pipe", src);
|
6141
|
+
if (!state.flowing) {
|
6142
|
+
debug2("pipe resume");
|
6143
|
+
src.resume();
|
6144
|
+
}
|
6145
|
+
return dest;
|
6146
|
+
};
|
6147
|
+
function pipeOnDrain(src) {
|
6148
|
+
return function() {
|
6149
|
+
var state = src._readableState;
|
6150
|
+
debug2("pipeOnDrain", state.awaitDrain);
|
6151
|
+
if (state.awaitDrain)
|
6152
|
+
state.awaitDrain--;
|
6153
|
+
if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
|
6154
|
+
state.flowing = true;
|
6155
|
+
flow(src);
|
6156
|
+
}
|
6157
|
+
};
|
6158
|
+
}
|
6159
|
+
Readable.prototype.unpipe = function(dest) {
|
6160
|
+
var state = this._readableState;
|
6161
|
+
var unpipeInfo = { hasUnpiped: false };
|
6162
|
+
if (state.pipesCount === 0)
|
6163
|
+
return this;
|
6164
|
+
if (state.pipesCount === 1) {
|
6165
|
+
if (dest && dest !== state.pipes)
|
6166
|
+
return this;
|
6167
|
+
if (!dest)
|
6168
|
+
dest = state.pipes;
|
6169
|
+
state.pipes = null;
|
6170
|
+
state.pipesCount = 0;
|
6171
|
+
state.flowing = false;
|
6172
|
+
if (dest)
|
6173
|
+
dest.emit("unpipe", this, unpipeInfo);
|
6174
|
+
return this;
|
6175
|
+
}
|
6176
|
+
if (!dest) {
|
6177
|
+
var dests = state.pipes;
|
6178
|
+
var len = state.pipesCount;
|
6179
|
+
state.pipes = null;
|
6180
|
+
state.pipesCount = 0;
|
6181
|
+
state.flowing = false;
|
6182
|
+
for (var i = 0; i < len; i++) {
|
6183
|
+
dests[i].emit("unpipe", this, unpipeInfo);
|
6184
|
+
}
|
6185
|
+
return this;
|
6186
|
+
}
|
6187
|
+
var index = indexOf(state.pipes, dest);
|
6188
|
+
if (index === -1)
|
6189
|
+
return this;
|
6190
|
+
state.pipes.splice(index, 1);
|
6191
|
+
state.pipesCount -= 1;
|
6192
|
+
if (state.pipesCount === 1)
|
6193
|
+
state.pipes = state.pipes[0];
|
6194
|
+
dest.emit("unpipe", this, unpipeInfo);
|
6195
|
+
return this;
|
6196
|
+
};
|
6197
|
+
Readable.prototype.on = function(ev, fn) {
|
6198
|
+
var res = Stream.prototype.on.call(this, ev, fn);
|
6199
|
+
if (ev === "data") {
|
6200
|
+
if (this._readableState.flowing !== false)
|
6201
|
+
this.resume();
|
6202
|
+
} else if (ev === "readable") {
|
6203
|
+
var state = this._readableState;
|
6204
|
+
if (!state.endEmitted && !state.readableListening) {
|
6205
|
+
state.readableListening = state.needReadable = true;
|
6206
|
+
state.emittedReadable = false;
|
6207
|
+
if (!state.reading) {
|
6208
|
+
pna.nextTick(nReadingNextTick, this);
|
6209
|
+
} else if (state.length) {
|
6210
|
+
emitReadable(this);
|
6211
|
+
}
|
6212
|
+
}
|
6213
|
+
}
|
6214
|
+
return res;
|
6215
|
+
};
|
6216
|
+
Readable.prototype.addListener = Readable.prototype.on;
|
6217
|
+
function nReadingNextTick(self2) {
|
6218
|
+
debug2("readable nexttick read 0");
|
6219
|
+
self2.read(0);
|
6220
|
+
}
|
6221
|
+
Readable.prototype.resume = function() {
|
6222
|
+
var state = this._readableState;
|
6223
|
+
if (!state.flowing) {
|
6224
|
+
debug2("resume");
|
6225
|
+
state.flowing = true;
|
6226
|
+
resume(this, state);
|
6227
|
+
}
|
6228
|
+
return this;
|
6229
|
+
};
|
6230
|
+
function resume(stream, state) {
|
6231
|
+
if (!state.resumeScheduled) {
|
6232
|
+
state.resumeScheduled = true;
|
6233
|
+
pna.nextTick(resume_, stream, state);
|
6234
|
+
}
|
6235
|
+
}
|
6236
|
+
function resume_(stream, state) {
|
6237
|
+
if (!state.reading) {
|
6238
|
+
debug2("resume read 0");
|
6239
|
+
stream.read(0);
|
6240
|
+
}
|
6241
|
+
state.resumeScheduled = false;
|
6242
|
+
state.awaitDrain = 0;
|
6243
|
+
stream.emit("resume");
|
6244
|
+
flow(stream);
|
6245
|
+
if (state.flowing && !state.reading)
|
6246
|
+
stream.read(0);
|
6247
|
+
}
|
6248
|
+
Readable.prototype.pause = function() {
|
6249
|
+
debug2("call pause flowing=%j", this._readableState.flowing);
|
6250
|
+
if (false !== this._readableState.flowing) {
|
6251
|
+
debug2("pause");
|
6252
|
+
this._readableState.flowing = false;
|
6253
|
+
this.emit("pause");
|
6254
|
+
}
|
6255
|
+
return this;
|
6256
|
+
};
|
6257
|
+
function flow(stream) {
|
6258
|
+
var state = stream._readableState;
|
6259
|
+
debug2("flow", state.flowing);
|
6260
|
+
while (state.flowing && stream.read() !== null) {
|
6261
|
+
}
|
6262
|
+
}
|
6263
|
+
Readable.prototype.wrap = function(stream) {
|
6264
|
+
var _this = this;
|
6265
|
+
var state = this._readableState;
|
6266
|
+
var paused = false;
|
6267
|
+
stream.on("end", function() {
|
6268
|
+
debug2("wrapped end");
|
6269
|
+
if (state.decoder && !state.ended) {
|
6270
|
+
var chunk = state.decoder.end();
|
6271
|
+
if (chunk && chunk.length)
|
6272
|
+
_this.push(chunk);
|
6273
|
+
}
|
6274
|
+
_this.push(null);
|
6275
|
+
});
|
6276
|
+
stream.on("data", function(chunk) {
|
6277
|
+
debug2("wrapped data");
|
6278
|
+
if (state.decoder)
|
6279
|
+
chunk = state.decoder.write(chunk);
|
6280
|
+
if (state.objectMode && (chunk === null || chunk === void 0))
|
6281
|
+
return;
|
6282
|
+
else if (!state.objectMode && (!chunk || !chunk.length))
|
6283
|
+
return;
|
6284
|
+
var ret = _this.push(chunk);
|
6285
|
+
if (!ret) {
|
6286
|
+
paused = true;
|
6287
|
+
stream.pause();
|
6288
|
+
}
|
6289
|
+
});
|
6290
|
+
for (var i in stream) {
|
6291
|
+
if (this[i] === void 0 && typeof stream[i] === "function") {
|
6292
|
+
this[i] = function(method) {
|
6293
|
+
return function() {
|
6294
|
+
return stream[method].apply(stream, arguments);
|
6295
|
+
};
|
6296
|
+
}(i);
|
6297
|
+
}
|
6298
|
+
}
|
6299
|
+
for (var n = 0; n < kProxyEvents.length; n++) {
|
6300
|
+
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
|
6301
|
+
}
|
6302
|
+
this._read = function(n2) {
|
6303
|
+
debug2("wrapped _read", n2);
|
6304
|
+
if (paused) {
|
6305
|
+
paused = false;
|
6306
|
+
stream.resume();
|
6307
|
+
}
|
6308
|
+
};
|
6309
|
+
return this;
|
6310
|
+
};
|
6311
|
+
Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
|
6312
|
+
// making it explicit this property is not enumerable
|
6313
|
+
// because otherwise some prototype manipulation in
|
6314
|
+
// userland will fail
|
6315
|
+
enumerable: false,
|
6316
|
+
get: function() {
|
6317
|
+
return this._readableState.highWaterMark;
|
6318
|
+
}
|
6319
|
+
});
|
6320
|
+
Readable._fromList = fromList;
|
6321
|
+
function fromList(n, state) {
|
6322
|
+
if (state.length === 0)
|
6323
|
+
return null;
|
6324
|
+
var ret;
|
6325
|
+
if (state.objectMode)
|
6326
|
+
ret = state.buffer.shift();
|
6327
|
+
else if (!n || n >= state.length) {
|
6328
|
+
if (state.decoder)
|
6329
|
+
ret = state.buffer.join("");
|
6330
|
+
else if (state.buffer.length === 1)
|
6331
|
+
ret = state.buffer.head.data;
|
6332
|
+
else
|
6333
|
+
ret = state.buffer.concat(state.length);
|
6334
|
+
state.buffer.clear();
|
6335
|
+
} else {
|
6336
|
+
ret = fromListPartial(n, state.buffer, state.decoder);
|
6337
|
+
}
|
6338
|
+
return ret;
|
6339
|
+
}
|
6340
|
+
function fromListPartial(n, list, hasStrings) {
|
6341
|
+
var ret;
|
6342
|
+
if (n < list.head.data.length) {
|
6343
|
+
ret = list.head.data.slice(0, n);
|
6344
|
+
list.head.data = list.head.data.slice(n);
|
6345
|
+
} else if (n === list.head.data.length) {
|
6346
|
+
ret = list.shift();
|
6347
|
+
} else {
|
6348
|
+
ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
|
6349
|
+
}
|
6350
|
+
return ret;
|
6351
|
+
}
|
6352
|
+
function copyFromBufferString(n, list) {
|
6353
|
+
var p = list.head;
|
6354
|
+
var c = 1;
|
6355
|
+
var ret = p.data;
|
6356
|
+
n -= ret.length;
|
6357
|
+
while (p = p.next) {
|
6358
|
+
var str = p.data;
|
6359
|
+
var nb = n > str.length ? str.length : n;
|
6360
|
+
if (nb === str.length)
|
6361
|
+
ret += str;
|
6362
|
+
else
|
6363
|
+
ret += str.slice(0, n);
|
6364
|
+
n -= nb;
|
6365
|
+
if (n === 0) {
|
6366
|
+
if (nb === str.length) {
|
6367
|
+
++c;
|
6368
|
+
if (p.next)
|
6369
|
+
list.head = p.next;
|
6370
|
+
else
|
6371
|
+
list.head = list.tail = null;
|
6372
|
+
} else {
|
6373
|
+
list.head = p;
|
6374
|
+
p.data = str.slice(nb);
|
6375
|
+
}
|
6376
|
+
break;
|
6377
|
+
}
|
6378
|
+
++c;
|
6379
|
+
}
|
6380
|
+
list.length -= c;
|
6381
|
+
return ret;
|
6382
|
+
}
|
6383
|
+
function copyFromBuffer(n, list) {
|
6384
|
+
var ret = Buffer2.allocUnsafe(n);
|
6385
|
+
var p = list.head;
|
6386
|
+
var c = 1;
|
6387
|
+
p.data.copy(ret);
|
6388
|
+
n -= p.data.length;
|
6389
|
+
while (p = p.next) {
|
6390
|
+
var buf = p.data;
|
6391
|
+
var nb = n > buf.length ? buf.length : n;
|
6392
|
+
buf.copy(ret, ret.length - n, 0, nb);
|
6393
|
+
n -= nb;
|
6394
|
+
if (n === 0) {
|
6395
|
+
if (nb === buf.length) {
|
6396
|
+
++c;
|
6397
|
+
if (p.next)
|
6398
|
+
list.head = p.next;
|
6399
|
+
else
|
6400
|
+
list.head = list.tail = null;
|
6401
|
+
} else {
|
6402
|
+
list.head = p;
|
6403
|
+
p.data = buf.slice(nb);
|
6404
|
+
}
|
6405
|
+
break;
|
6406
|
+
}
|
6407
|
+
++c;
|
6408
|
+
}
|
6409
|
+
list.length -= c;
|
6410
|
+
return ret;
|
6411
|
+
}
|
6412
|
+
function endReadable(stream) {
|
6413
|
+
var state = stream._readableState;
|
6414
|
+
if (state.length > 0)
|
6415
|
+
throw new Error('"endReadable()" called on non-empty stream');
|
6416
|
+
if (!state.endEmitted) {
|
6417
|
+
state.ended = true;
|
6418
|
+
pna.nextTick(endReadableNT, state, stream);
|
6419
|
+
}
|
6420
|
+
}
|
6421
|
+
function endReadableNT(state, stream) {
|
6422
|
+
if (!state.endEmitted && state.length === 0) {
|
6423
|
+
state.endEmitted = true;
|
6424
|
+
stream.readable = false;
|
6425
|
+
stream.emit("end");
|
6426
|
+
}
|
6427
|
+
}
|
6428
|
+
function indexOf(xs, x) {
|
6429
|
+
for (var i = 0, l = xs.length; i < l; i++) {
|
6430
|
+
if (xs[i] === x)
|
6431
|
+
return i;
|
6432
|
+
}
|
6433
|
+
return -1;
|
6434
|
+
}
|
4849
6435
|
}
|
4850
6436
|
});
|
4851
6437
|
|
4852
|
-
// ../../node_modules/.pnpm/
|
4853
|
-
var
|
4854
|
-
"../../node_modules/.pnpm/
|
6438
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_transform.js
|
6439
|
+
var require_stream_transform2 = __commonJS({
|
6440
|
+
"../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_transform.js"(exports2, module2) {
|
4855
6441
|
"use strict";
|
4856
|
-
|
4857
|
-
var
|
4858
|
-
var
|
4859
|
-
|
4860
|
-
|
4861
|
-
|
4862
|
-
|
4863
|
-
|
4864
|
-
|
4865
|
-
|
4866
|
-
|
6442
|
+
module2.exports = Transform;
|
6443
|
+
var Duplex = require_stream_duplex2();
|
6444
|
+
var util = Object.create(require_util());
|
6445
|
+
util.inherits = require_inherits();
|
6446
|
+
util.inherits(Transform, Duplex);
|
6447
|
+
function afterTransform(er, data) {
|
6448
|
+
var ts = this._transformState;
|
6449
|
+
ts.transforming = false;
|
6450
|
+
var cb = ts.writecb;
|
6451
|
+
if (!cb) {
|
6452
|
+
return this.emit("error", new Error("write callback called multiple times"));
|
6453
|
+
}
|
6454
|
+
ts.writechunk = null;
|
6455
|
+
ts.writecb = null;
|
6456
|
+
if (data != null)
|
6457
|
+
this.push(data);
|
6458
|
+
cb(er);
|
6459
|
+
var rs = this._readableState;
|
6460
|
+
rs.reading = false;
|
6461
|
+
if (rs.needReadable || rs.length < rs.highWaterMark) {
|
6462
|
+
this._read(rs.highWaterMark);
|
4867
6463
|
}
|
4868
|
-
const overwrite = opts.overwrite || opts.clobber || false;
|
4869
|
-
stat.checkPaths(src, dest, "move", opts, (err, stats) => {
|
4870
|
-
if (err)
|
4871
|
-
return cb(err);
|
4872
|
-
const { srcStat, isChangingCase = false } = stats;
|
4873
|
-
stat.checkParentPaths(src, srcStat, dest, "move", (err2) => {
|
4874
|
-
if (err2)
|
4875
|
-
return cb(err2);
|
4876
|
-
if (isParentRoot(dest))
|
4877
|
-
return doRename(src, dest, overwrite, isChangingCase, cb);
|
4878
|
-
mkdirp3(path7.dirname(dest), (err3) => {
|
4879
|
-
if (err3)
|
4880
|
-
return cb(err3);
|
4881
|
-
return doRename(src, dest, overwrite, isChangingCase, cb);
|
4882
|
-
});
|
4883
|
-
});
|
4884
|
-
});
|
4885
6464
|
}
|
4886
|
-
function
|
4887
|
-
|
4888
|
-
|
4889
|
-
|
6465
|
+
function Transform(options) {
|
6466
|
+
if (!(this instanceof Transform))
|
6467
|
+
return new Transform(options);
|
6468
|
+
Duplex.call(this, options);
|
6469
|
+
this._transformState = {
|
6470
|
+
afterTransform: afterTransform.bind(this),
|
6471
|
+
needTransform: false,
|
6472
|
+
transforming: false,
|
6473
|
+
writecb: null,
|
6474
|
+
writechunk: null,
|
6475
|
+
writeencoding: null
|
6476
|
+
};
|
6477
|
+
this._readableState.needReadable = true;
|
6478
|
+
this._readableState.sync = false;
|
6479
|
+
if (options) {
|
6480
|
+
if (typeof options.transform === "function")
|
6481
|
+
this._transform = options.transform;
|
6482
|
+
if (typeof options.flush === "function")
|
6483
|
+
this._flush = options.flush;
|
6484
|
+
}
|
6485
|
+
this.on("prefinish", prefinish);
|
4890
6486
|
}
|
4891
|
-
function
|
4892
|
-
|
4893
|
-
|
4894
|
-
|
4895
|
-
|
4896
|
-
if (err)
|
4897
|
-
return cb(err);
|
4898
|
-
return rename2(src, dest, overwrite, cb);
|
6487
|
+
function prefinish() {
|
6488
|
+
var _this = this;
|
6489
|
+
if (typeof this._flush === "function") {
|
6490
|
+
this._flush(function(er, data) {
|
6491
|
+
done(_this, er, data);
|
4899
6492
|
});
|
6493
|
+
} else {
|
6494
|
+
done(this, null, null);
|
4900
6495
|
}
|
4901
|
-
pathExists(dest, (err, destExists) => {
|
4902
|
-
if (err)
|
4903
|
-
return cb(err);
|
4904
|
-
if (destExists)
|
4905
|
-
return cb(new Error("dest already exists."));
|
4906
|
-
return rename2(src, dest, overwrite, cb);
|
4907
|
-
});
|
4908
|
-
}
|
4909
|
-
function rename2(src, dest, overwrite, cb) {
|
4910
|
-
fs5.rename(src, dest, (err) => {
|
4911
|
-
if (!err)
|
4912
|
-
return cb();
|
4913
|
-
if (err.code !== "EXDEV")
|
4914
|
-
return cb(err);
|
4915
|
-
return moveAcrossDevice(src, dest, overwrite, cb);
|
4916
|
-
});
|
4917
6496
|
}
|
4918
|
-
function
|
4919
|
-
|
4920
|
-
|
4921
|
-
|
4922
|
-
|
4923
|
-
|
4924
|
-
|
4925
|
-
|
4926
|
-
|
6497
|
+
Transform.prototype.push = function(chunk, encoding) {
|
6498
|
+
this._transformState.needTransform = false;
|
6499
|
+
return Duplex.prototype.push.call(this, chunk, encoding);
|
6500
|
+
};
|
6501
|
+
Transform.prototype._transform = function(chunk, encoding, cb) {
|
6502
|
+
throw new Error("_transform() is not implemented");
|
6503
|
+
};
|
6504
|
+
Transform.prototype._write = function(chunk, encoding, cb) {
|
6505
|
+
var ts = this._transformState;
|
6506
|
+
ts.writecb = cb;
|
6507
|
+
ts.writechunk = chunk;
|
6508
|
+
ts.writeencoding = encoding;
|
6509
|
+
if (!ts.transforming) {
|
6510
|
+
var rs = this._readableState;
|
6511
|
+
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
|
6512
|
+
this._read(rs.highWaterMark);
|
6513
|
+
}
|
6514
|
+
};
|
6515
|
+
Transform.prototype._read = function(n) {
|
6516
|
+
var ts = this._transformState;
|
6517
|
+
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
6518
|
+
ts.transforming = true;
|
6519
|
+
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
6520
|
+
} else {
|
6521
|
+
ts.needTransform = true;
|
6522
|
+
}
|
6523
|
+
};
|
6524
|
+
Transform.prototype._destroy = function(err, cb) {
|
6525
|
+
var _this2 = this;
|
6526
|
+
Duplex.prototype._destroy.call(this, err, function(err2) {
|
6527
|
+
cb(err2);
|
6528
|
+
_this2.emit("close");
|
4927
6529
|
});
|
6530
|
+
};
|
6531
|
+
function done(stream, er, data) {
|
6532
|
+
if (er)
|
6533
|
+
return stream.emit("error", er);
|
6534
|
+
if (data != null)
|
6535
|
+
stream.push(data);
|
6536
|
+
if (stream._writableState.length)
|
6537
|
+
throw new Error("Calling transform done when ws.length != 0");
|
6538
|
+
if (stream._transformState.transforming)
|
6539
|
+
throw new Error("Calling transform done when still transforming");
|
6540
|
+
return stream.push(null);
|
4928
6541
|
}
|
4929
|
-
module2.exports = move;
|
4930
6542
|
}
|
4931
6543
|
});
|
4932
6544
|
|
4933
|
-
// ../../node_modules/.pnpm/
|
4934
|
-
var
|
4935
|
-
"../../node_modules/.pnpm/
|
6545
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_passthrough.js
|
6546
|
+
var require_stream_passthrough2 = __commonJS({
|
6547
|
+
"../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/lib/_stream_passthrough.js"(exports2, module2) {
|
4936
6548
|
"use strict";
|
4937
|
-
|
4938
|
-
|
4939
|
-
|
6549
|
+
module2.exports = PassThrough;
|
6550
|
+
var Transform = require_stream_transform2();
|
6551
|
+
var util = Object.create(require_util());
|
6552
|
+
util.inherits = require_inherits();
|
6553
|
+
util.inherits(PassThrough, Transform);
|
6554
|
+
function PassThrough(options) {
|
6555
|
+
if (!(this instanceof PassThrough))
|
6556
|
+
return new PassThrough(options);
|
6557
|
+
Transform.call(this, options);
|
6558
|
+
}
|
6559
|
+
PassThrough.prototype._transform = function(chunk, encoding, cb) {
|
6560
|
+
cb(null, chunk);
|
4940
6561
|
};
|
4941
6562
|
}
|
4942
6563
|
});
|
4943
6564
|
|
4944
|
-
// ../../node_modules/.pnpm/
|
4945
|
-
var
|
4946
|
-
"../../node_modules/.pnpm/
|
4947
|
-
|
4948
|
-
|
4949
|
-
|
4950
|
-
|
4951
|
-
|
4952
|
-
|
4953
|
-
|
4954
|
-
|
4955
|
-
|
4956
|
-
|
4957
|
-
|
4958
|
-
|
4959
|
-
|
4960
|
-
|
4961
|
-
|
4962
|
-
|
4963
|
-
|
6565
|
+
// ../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/readable.js
|
6566
|
+
var require_readable2 = __commonJS({
|
6567
|
+
"../../node_modules/.pnpm/readable-stream@2.3.7/node_modules/readable-stream/readable.js"(exports2, module2) {
|
6568
|
+
var Stream = require("stream");
|
6569
|
+
if (process.env.READABLE_STREAM === "disable" && Stream) {
|
6570
|
+
module2.exports = Stream;
|
6571
|
+
exports2 = module2.exports = Stream.Readable;
|
6572
|
+
exports2.Readable = Stream.Readable;
|
6573
|
+
exports2.Writable = Stream.Writable;
|
6574
|
+
exports2.Duplex = Stream.Duplex;
|
6575
|
+
exports2.Transform = Stream.Transform;
|
6576
|
+
exports2.PassThrough = Stream.PassThrough;
|
6577
|
+
exports2.Stream = Stream;
|
6578
|
+
} else {
|
6579
|
+
exports2 = module2.exports = require_stream_readable2();
|
6580
|
+
exports2.Stream = Stream || exports2;
|
6581
|
+
exports2.Readable = exports2;
|
6582
|
+
exports2.Writable = require_stream_writable2();
|
6583
|
+
exports2.Duplex = require_stream_duplex2();
|
6584
|
+
exports2.Transform = require_stream_transform2();
|
6585
|
+
exports2.PassThrough = require_stream_passthrough2();
|
6586
|
+
}
|
4964
6587
|
}
|
4965
6588
|
});
|
4966
6589
|
|
@@ -4969,28 +6592,28 @@ var require_multistream = __commonJS({
|
|
4969
6592
|
"../../node_modules/.pnpm/multistream@2.1.1/node_modules/multistream/index.js"(exports2, module2) {
|
4970
6593
|
module2.exports = MultiStream;
|
4971
6594
|
var inherits = require_inherits();
|
4972
|
-
var stream =
|
6595
|
+
var stream = require_readable2();
|
4973
6596
|
inherits(MultiStream, stream.Readable);
|
4974
6597
|
function MultiStream(streams, opts) {
|
4975
|
-
var
|
4976
|
-
if (!(
|
6598
|
+
var self2 = this;
|
6599
|
+
if (!(self2 instanceof MultiStream))
|
4977
6600
|
return new MultiStream(streams, opts);
|
4978
|
-
stream.Readable.call(
|
4979
|
-
|
4980
|
-
|
4981
|
-
|
4982
|
-
|
4983
|
-
|
6601
|
+
stream.Readable.call(self2, opts);
|
6602
|
+
self2.destroyed = false;
|
6603
|
+
self2._drained = false;
|
6604
|
+
self2._forwarding = false;
|
6605
|
+
self2._current = null;
|
6606
|
+
self2._toStreams2 = opts && opts.objectMode ? toStreams2Obj : toStreams2Buf;
|
4984
6607
|
if (typeof streams === "function") {
|
4985
|
-
|
6608
|
+
self2._queue = streams;
|
4986
6609
|
} else {
|
4987
|
-
|
4988
|
-
|
6610
|
+
self2._queue = streams.map(self2._toStreams2);
|
6611
|
+
self2._queue.forEach(function(stream2) {
|
4989
6612
|
if (typeof stream2 !== "function")
|
4990
|
-
|
6613
|
+
self2._attachErrorListener(stream2);
|
4991
6614
|
});
|
4992
6615
|
}
|
4993
|
-
|
6616
|
+
self2._next();
|
4994
6617
|
}
|
4995
6618
|
MultiStream.obj = function(streams) {
|
4996
6619
|
return new MultiStream(streams, { objectMode: true, highWaterMark: 16 });
|
@@ -5026,61 +6649,61 @@ var require_multistream = __commonJS({
|
|
5026
6649
|
this.emit("close");
|
5027
6650
|
};
|
5028
6651
|
MultiStream.prototype._next = function() {
|
5029
|
-
var
|
5030
|
-
|
5031
|
-
if (typeof
|
5032
|
-
|
6652
|
+
var self2 = this;
|
6653
|
+
self2._current = null;
|
6654
|
+
if (typeof self2._queue === "function") {
|
6655
|
+
self2._queue(function(err, stream3) {
|
5033
6656
|
if (err)
|
5034
|
-
return
|
5035
|
-
stream3 =
|
5036
|
-
|
5037
|
-
|
6657
|
+
return self2.destroy(err);
|
6658
|
+
stream3 = self2._toStreams2(stream3);
|
6659
|
+
self2._attachErrorListener(stream3);
|
6660
|
+
self2._gotNextStream(stream3);
|
5038
6661
|
});
|
5039
6662
|
} else {
|
5040
|
-
var stream2 =
|
6663
|
+
var stream2 = self2._queue.shift();
|
5041
6664
|
if (typeof stream2 === "function") {
|
5042
|
-
stream2 =
|
5043
|
-
|
6665
|
+
stream2 = self2._toStreams2(stream2());
|
6666
|
+
self2._attachErrorListener(stream2);
|
5044
6667
|
}
|
5045
|
-
|
6668
|
+
self2._gotNextStream(stream2);
|
5046
6669
|
}
|
5047
6670
|
};
|
5048
6671
|
MultiStream.prototype._gotNextStream = function(stream2) {
|
5049
|
-
var
|
6672
|
+
var self2 = this;
|
5050
6673
|
if (!stream2) {
|
5051
|
-
|
5052
|
-
|
6674
|
+
self2.push(null);
|
6675
|
+
self2.destroy();
|
5053
6676
|
return;
|
5054
6677
|
}
|
5055
|
-
|
5056
|
-
|
6678
|
+
self2._current = stream2;
|
6679
|
+
self2._forward();
|
5057
6680
|
stream2.on("readable", onReadable);
|
5058
6681
|
stream2.once("end", onEnd);
|
5059
6682
|
stream2.once("close", onClose);
|
5060
6683
|
function onReadable() {
|
5061
|
-
|
6684
|
+
self2._forward();
|
5062
6685
|
}
|
5063
6686
|
function onClose() {
|
5064
6687
|
if (!stream2._readableState.ended) {
|
5065
|
-
|
6688
|
+
self2.destroy();
|
5066
6689
|
}
|
5067
6690
|
}
|
5068
6691
|
function onEnd() {
|
5069
|
-
|
6692
|
+
self2._current = null;
|
5070
6693
|
stream2.removeListener("readable", onReadable);
|
5071
6694
|
stream2.removeListener("end", onEnd);
|
5072
6695
|
stream2.removeListener("close", onClose);
|
5073
|
-
|
6696
|
+
self2._next();
|
5074
6697
|
}
|
5075
6698
|
};
|
5076
6699
|
MultiStream.prototype._attachErrorListener = function(stream2) {
|
5077
|
-
var
|
6700
|
+
var self2 = this;
|
5078
6701
|
if (!stream2)
|
5079
6702
|
return;
|
5080
6703
|
stream2.once("error", onError);
|
5081
6704
|
function onError(err) {
|
5082
6705
|
stream2.removeListener("error", onError);
|
5083
|
-
|
6706
|
+
self2.destroy(err);
|
5084
6707
|
}
|
5085
6708
|
};
|
5086
6709
|
function toStreams2Obj(s) {
|
@@ -8432,18 +10055,18 @@ var require_retry_operation = __commonJS({
|
|
8432
10055
|
return false;
|
8433
10056
|
}
|
8434
10057
|
}
|
8435
|
-
var
|
10058
|
+
var self2 = this;
|
8436
10059
|
var timer = setTimeout(function() {
|
8437
|
-
|
8438
|
-
if (
|
8439
|
-
|
8440
|
-
|
8441
|
-
},
|
8442
|
-
if (
|
8443
|
-
|
10060
|
+
self2._attempts++;
|
10061
|
+
if (self2._operationTimeoutCb) {
|
10062
|
+
self2._timeout = setTimeout(function() {
|
10063
|
+
self2._operationTimeoutCb(self2._attempts);
|
10064
|
+
}, self2._operationTimeout);
|
10065
|
+
if (self2._options.unref) {
|
10066
|
+
self2._timeout.unref();
|
8444
10067
|
}
|
8445
10068
|
}
|
8446
|
-
|
10069
|
+
self2._fn(self2._attempts);
|
8447
10070
|
}, timeout);
|
8448
10071
|
if (this._options.unref) {
|
8449
10072
|
timer.unref();
|
@@ -8460,11 +10083,11 @@ var require_retry_operation = __commonJS({
|
|
8460
10083
|
this._operationTimeoutCb = timeoutOps.cb;
|
8461
10084
|
}
|
8462
10085
|
}
|
8463
|
-
var
|
10086
|
+
var self2 = this;
|
8464
10087
|
if (this._operationTimeoutCb) {
|
8465
10088
|
this._timeout = setTimeout(function() {
|
8466
|
-
|
8467
|
-
},
|
10089
|
+
self2._operationTimeoutCb();
|
10090
|
+
}, self2._operationTimeout);
|
8468
10091
|
}
|
8469
10092
|
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
8470
10093
|
this._fn(this._attempts);
|
@@ -8970,17 +10593,17 @@ var require_yazl = __commonJS({
|
|
8970
10593
|
this.forceZip64Eocd = false;
|
8971
10594
|
}
|
8972
10595
|
ZipFile2.prototype.addFile = function(realPath, metadataPath, options) {
|
8973
|
-
var
|
10596
|
+
var self2 = this;
|
8974
10597
|
metadataPath = validateMetadataPath(metadataPath, false);
|
8975
10598
|
if (options == null)
|
8976
10599
|
options = {};
|
8977
10600
|
var entry = new Entry(metadataPath, false, options);
|
8978
|
-
|
10601
|
+
self2.entries.push(entry);
|
8979
10602
|
fs5.stat(realPath, function(err, stats) {
|
8980
10603
|
if (err)
|
8981
|
-
return
|
10604
|
+
return self2.emit("error", err);
|
8982
10605
|
if (!stats.isFile())
|
8983
|
-
return
|
10606
|
+
return self2.emit("error", new Error("not a file: " + realPath));
|
8984
10607
|
entry.uncompressedSize = stats.size;
|
8985
10608
|
if (options.mtime == null)
|
8986
10609
|
entry.setLastModDate(stats.mtime);
|
@@ -8990,28 +10613,28 @@ var require_yazl = __commonJS({
|
|
8990
10613
|
var readStream = fs5.createReadStream(realPath);
|
8991
10614
|
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
8992
10615
|
readStream.on("error", function(err2) {
|
8993
|
-
|
10616
|
+
self2.emit("error", err2);
|
8994
10617
|
});
|
8995
|
-
pumpFileDataReadStream(
|
10618
|
+
pumpFileDataReadStream(self2, entry, readStream);
|
8996
10619
|
});
|
8997
|
-
pumpEntries(
|
10620
|
+
pumpEntries(self2);
|
8998
10621
|
});
|
8999
10622
|
};
|
9000
10623
|
ZipFile2.prototype.addReadStream = function(readStream, metadataPath, options) {
|
9001
|
-
var
|
10624
|
+
var self2 = this;
|
9002
10625
|
metadataPath = validateMetadataPath(metadataPath, false);
|
9003
10626
|
if (options == null)
|
9004
10627
|
options = {};
|
9005
10628
|
var entry = new Entry(metadataPath, false, options);
|
9006
|
-
|
10629
|
+
self2.entries.push(entry);
|
9007
10630
|
entry.setFileDataPumpFunction(function() {
|
9008
10631
|
entry.state = Entry.FILE_DATA_IN_PROGRESS;
|
9009
|
-
pumpFileDataReadStream(
|
10632
|
+
pumpFileDataReadStream(self2, entry, readStream);
|
9010
10633
|
});
|
9011
|
-
pumpEntries(
|
10634
|
+
pumpEntries(self2);
|
9012
10635
|
};
|
9013
10636
|
ZipFile2.prototype.addBuffer = function(buffer, metadataPath, options) {
|
9014
|
-
var
|
10637
|
+
var self2 = this;
|
9015
10638
|
metadataPath = validateMetadataPath(metadataPath, false);
|
9016
10639
|
if (buffer.length > 1073741823)
|
9017
10640
|
throw new Error("buffer too large: " + buffer.length + " > 1073741823");
|
@@ -9023,7 +10646,7 @@ var require_yazl = __commonJS({
|
|
9023
10646
|
entry.uncompressedSize = buffer.length;
|
9024
10647
|
entry.crc32 = crc32.unsigned(buffer);
|
9025
10648
|
entry.crcAndFileSizeKnown = true;
|
9026
|
-
|
10649
|
+
self2.entries.push(entry);
|
9027
10650
|
if (!entry.compress) {
|
9028
10651
|
setCompressedBuffer(buffer);
|
9029
10652
|
} else {
|
@@ -9034,18 +10657,18 @@ var require_yazl = __commonJS({
|
|
9034
10657
|
function setCompressedBuffer(compressedBuffer) {
|
9035
10658
|
entry.compressedSize = compressedBuffer.length;
|
9036
10659
|
entry.setFileDataPumpFunction(function() {
|
9037
|
-
writeToOutputStream(
|
9038
|
-
writeToOutputStream(
|
10660
|
+
writeToOutputStream(self2, compressedBuffer);
|
10661
|
+
writeToOutputStream(self2, entry.getDataDescriptor());
|
9039
10662
|
entry.state = Entry.FILE_DATA_DONE;
|
9040
10663
|
setImmediate(function() {
|
9041
|
-
pumpEntries(
|
10664
|
+
pumpEntries(self2);
|
9042
10665
|
});
|
9043
10666
|
});
|
9044
|
-
pumpEntries(
|
10667
|
+
pumpEntries(self2);
|
9045
10668
|
}
|
9046
10669
|
};
|
9047
10670
|
ZipFile2.prototype.addEmptyDirectory = function(metadataPath, options) {
|
9048
|
-
var
|
10671
|
+
var self2 = this;
|
9049
10672
|
metadataPath = validateMetadataPath(metadataPath, true);
|
9050
10673
|
if (options == null)
|
9051
10674
|
options = {};
|
@@ -9054,13 +10677,13 @@ var require_yazl = __commonJS({
|
|
9054
10677
|
if (options.compress != null)
|
9055
10678
|
throw new Error("options.compress not allowed");
|
9056
10679
|
var entry = new Entry(metadataPath, true, options);
|
9057
|
-
|
10680
|
+
self2.entries.push(entry);
|
9058
10681
|
entry.setFileDataPumpFunction(function() {
|
9059
|
-
writeToOutputStream(
|
10682
|
+
writeToOutputStream(self2, entry.getDataDescriptor());
|
9060
10683
|
entry.state = Entry.FILE_DATA_DONE;
|
9061
|
-
pumpEntries(
|
10684
|
+
pumpEntries(self2);
|
9062
10685
|
});
|
9063
|
-
pumpEntries(
|
10686
|
+
pumpEntries(self2);
|
9064
10687
|
};
|
9065
10688
|
var eocdrSignatureBuffer = bufferFrom([80, 75, 5, 6]);
|
9066
10689
|
ZipFile2.prototype.end = function(options, finalSizeCallback) {
|
@@ -9090,45 +10713,45 @@ var require_yazl = __commonJS({
|
|
9090
10713
|
}
|
9091
10714
|
pumpEntries(this);
|
9092
10715
|
};
|
9093
|
-
function writeToOutputStream(
|
9094
|
-
|
9095
|
-
|
10716
|
+
function writeToOutputStream(self2, buffer) {
|
10717
|
+
self2.outputStream.write(buffer);
|
10718
|
+
self2.outputStreamCursor += buffer.length;
|
9096
10719
|
}
|
9097
|
-
function pumpFileDataReadStream(
|
10720
|
+
function pumpFileDataReadStream(self2, entry, readStream) {
|
9098
10721
|
var crc32Watcher = new Crc32Watcher();
|
9099
10722
|
var uncompressedSizeCounter = new ByteCounter();
|
9100
10723
|
var compressor = entry.compress ? new zlib.DeflateRaw() : new PassThrough();
|
9101
10724
|
var compressedSizeCounter = new ByteCounter();
|
9102
|
-
readStream.pipe(crc32Watcher).pipe(uncompressedSizeCounter).pipe(compressor).pipe(compressedSizeCounter).pipe(
|
10725
|
+
readStream.pipe(crc32Watcher).pipe(uncompressedSizeCounter).pipe(compressor).pipe(compressedSizeCounter).pipe(self2.outputStream, { end: false });
|
9103
10726
|
compressedSizeCounter.on("end", function() {
|
9104
10727
|
entry.crc32 = crc32Watcher.crc32;
|
9105
10728
|
if (entry.uncompressedSize == null) {
|
9106
10729
|
entry.uncompressedSize = uncompressedSizeCounter.byteCount;
|
9107
10730
|
} else {
|
9108
10731
|
if (entry.uncompressedSize !== uncompressedSizeCounter.byteCount)
|
9109
|
-
return
|
10732
|
+
return self2.emit("error", new Error("file data stream has unexpected number of bytes"));
|
9110
10733
|
}
|
9111
10734
|
entry.compressedSize = compressedSizeCounter.byteCount;
|
9112
|
-
|
9113
|
-
writeToOutputStream(
|
10735
|
+
self2.outputStreamCursor += entry.compressedSize;
|
10736
|
+
writeToOutputStream(self2, entry.getDataDescriptor());
|
9114
10737
|
entry.state = Entry.FILE_DATA_DONE;
|
9115
|
-
pumpEntries(
|
10738
|
+
pumpEntries(self2);
|
9116
10739
|
});
|
9117
10740
|
}
|
9118
|
-
function pumpEntries(
|
9119
|
-
if (
|
10741
|
+
function pumpEntries(self2) {
|
10742
|
+
if (self2.allDone)
|
9120
10743
|
return;
|
9121
|
-
if (
|
9122
|
-
var finalSize = calculateFinalSize(
|
10744
|
+
if (self2.ended && self2.finalSizeCallback != null) {
|
10745
|
+
var finalSize = calculateFinalSize(self2);
|
9123
10746
|
if (finalSize != null) {
|
9124
|
-
|
9125
|
-
|
10747
|
+
self2.finalSizeCallback(finalSize);
|
10748
|
+
self2.finalSizeCallback = null;
|
9126
10749
|
}
|
9127
10750
|
}
|
9128
10751
|
var entry = getFirstNotDoneEntry();
|
9129
10752
|
function getFirstNotDoneEntry() {
|
9130
|
-
for (var i = 0; i <
|
9131
|
-
var entry2 =
|
10753
|
+
for (var i = 0; i < self2.entries.length; i++) {
|
10754
|
+
var entry2 = self2.entries[i];
|
9132
10755
|
if (entry2.state < Entry.FILE_DATA_DONE)
|
9133
10756
|
return entry2;
|
9134
10757
|
}
|
@@ -9139,28 +10762,28 @@ var require_yazl = __commonJS({
|
|
9139
10762
|
return;
|
9140
10763
|
if (entry.state === Entry.FILE_DATA_IN_PROGRESS)
|
9141
10764
|
return;
|
9142
|
-
entry.relativeOffsetOfLocalHeader =
|
10765
|
+
entry.relativeOffsetOfLocalHeader = self2.outputStreamCursor;
|
9143
10766
|
var localFileHeader = entry.getLocalFileHeader();
|
9144
|
-
writeToOutputStream(
|
10767
|
+
writeToOutputStream(self2, localFileHeader);
|
9145
10768
|
entry.doFileDataPump();
|
9146
10769
|
} else {
|
9147
|
-
if (
|
9148
|
-
|
9149
|
-
|
10770
|
+
if (self2.ended) {
|
10771
|
+
self2.offsetOfStartOfCentralDirectory = self2.outputStreamCursor;
|
10772
|
+
self2.entries.forEach(function(entry2) {
|
9150
10773
|
var centralDirectoryRecord = entry2.getCentralDirectoryRecord();
|
9151
|
-
writeToOutputStream(
|
10774
|
+
writeToOutputStream(self2, centralDirectoryRecord);
|
9152
10775
|
});
|
9153
|
-
writeToOutputStream(
|
9154
|
-
|
9155
|
-
|
10776
|
+
writeToOutputStream(self2, getEndOfCentralDirectoryRecord(self2));
|
10777
|
+
self2.outputStream.end();
|
10778
|
+
self2.allDone = true;
|
9156
10779
|
}
|
9157
10780
|
}
|
9158
10781
|
}
|
9159
|
-
function calculateFinalSize(
|
10782
|
+
function calculateFinalSize(self2) {
|
9160
10783
|
var pretendOutputCursor = 0;
|
9161
10784
|
var centralDirectorySize = 0;
|
9162
|
-
for (var i = 0; i <
|
9163
|
-
var entry =
|
10785
|
+
for (var i = 0; i < self2.entries.length; i++) {
|
10786
|
+
var entry = self2.entries[i];
|
9164
10787
|
if (entry.compress)
|
9165
10788
|
return -1;
|
9166
10789
|
if (entry.state >= Entry.READY_TO_PUMP_FILE_DATA) {
|
@@ -9187,30 +10810,30 @@ var require_yazl = __commonJS({
|
|
9187
10810
|
}
|
9188
10811
|
}
|
9189
10812
|
var endOfCentralDirectorySize = 0;
|
9190
|
-
if (
|
10813
|
+
if (self2.forceZip64Eocd || self2.entries.length >= 65535 || centralDirectorySize >= 65535 || pretendOutputCursor >= 4294967295) {
|
9191
10814
|
endOfCentralDirectorySize += ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE;
|
9192
10815
|
}
|
9193
|
-
endOfCentralDirectorySize += END_OF_CENTRAL_DIRECTORY_RECORD_SIZE +
|
10816
|
+
endOfCentralDirectorySize += END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self2.comment.length;
|
9194
10817
|
return pretendOutputCursor + centralDirectorySize + endOfCentralDirectorySize;
|
9195
10818
|
}
|
9196
10819
|
var ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 56;
|
9197
10820
|
var ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE = 20;
|
9198
10821
|
var END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 22;
|
9199
|
-
function getEndOfCentralDirectoryRecord(
|
10822
|
+
function getEndOfCentralDirectoryRecord(self2, actuallyJustTellMeHowLongItWouldBe) {
|
9200
10823
|
var needZip64Format = false;
|
9201
|
-
var normalEntriesLength =
|
9202
|
-
if (
|
10824
|
+
var normalEntriesLength = self2.entries.length;
|
10825
|
+
if (self2.forceZip64Eocd || self2.entries.length >= 65535) {
|
9203
10826
|
normalEntriesLength = 65535;
|
9204
10827
|
needZip64Format = true;
|
9205
10828
|
}
|
9206
|
-
var sizeOfCentralDirectory =
|
10829
|
+
var sizeOfCentralDirectory = self2.outputStreamCursor - self2.offsetOfStartOfCentralDirectory;
|
9207
10830
|
var normalSizeOfCentralDirectory = sizeOfCentralDirectory;
|
9208
|
-
if (
|
10831
|
+
if (self2.forceZip64Eocd || sizeOfCentralDirectory >= 4294967295) {
|
9209
10832
|
normalSizeOfCentralDirectory = 4294967295;
|
9210
10833
|
needZip64Format = true;
|
9211
10834
|
}
|
9212
|
-
var normalOffsetOfStartOfCentralDirectory =
|
9213
|
-
if (
|
10835
|
+
var normalOffsetOfStartOfCentralDirectory = self2.offsetOfStartOfCentralDirectory;
|
10836
|
+
if (self2.forceZip64Eocd || self2.offsetOfStartOfCentralDirectory >= 4294967295) {
|
9214
10837
|
normalOffsetOfStartOfCentralDirectory = 4294967295;
|
9215
10838
|
needZip64Format = true;
|
9216
10839
|
}
|
@@ -9221,7 +10844,7 @@ var require_yazl = __commonJS({
|
|
9221
10844
|
return END_OF_CENTRAL_DIRECTORY_RECORD_SIZE;
|
9222
10845
|
}
|
9223
10846
|
}
|
9224
|
-
var eocdrBuffer = bufferAlloc(END_OF_CENTRAL_DIRECTORY_RECORD_SIZE +
|
10847
|
+
var eocdrBuffer = bufferAlloc(END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self2.comment.length);
|
9225
10848
|
eocdrBuffer.writeUInt32LE(101010256, 0);
|
9226
10849
|
eocdrBuffer.writeUInt16LE(0, 4);
|
9227
10850
|
eocdrBuffer.writeUInt16LE(0, 6);
|
@@ -9229,8 +10852,8 @@ var require_yazl = __commonJS({
|
|
9229
10852
|
eocdrBuffer.writeUInt16LE(normalEntriesLength, 10);
|
9230
10853
|
eocdrBuffer.writeUInt32LE(normalSizeOfCentralDirectory, 12);
|
9231
10854
|
eocdrBuffer.writeUInt32LE(normalOffsetOfStartOfCentralDirectory, 16);
|
9232
|
-
eocdrBuffer.writeUInt16LE(
|
9233
|
-
|
10855
|
+
eocdrBuffer.writeUInt16LE(self2.comment.length, 20);
|
10856
|
+
self2.comment.copy(eocdrBuffer, 22);
|
9234
10857
|
if (!needZip64Format)
|
9235
10858
|
return eocdrBuffer;
|
9236
10859
|
var zip64EocdrBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE);
|
@@ -9240,14 +10863,14 @@ var require_yazl = __commonJS({
|
|
9240
10863
|
zip64EocdrBuffer.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT_ZIP64, 14);
|
9241
10864
|
zip64EocdrBuffer.writeUInt32LE(0, 16);
|
9242
10865
|
zip64EocdrBuffer.writeUInt32LE(0, 20);
|
9243
|
-
writeUInt64LE(zip64EocdrBuffer,
|
9244
|
-
writeUInt64LE(zip64EocdrBuffer,
|
10866
|
+
writeUInt64LE(zip64EocdrBuffer, self2.entries.length, 24);
|
10867
|
+
writeUInt64LE(zip64EocdrBuffer, self2.entries.length, 32);
|
9245
10868
|
writeUInt64LE(zip64EocdrBuffer, sizeOfCentralDirectory, 40);
|
9246
|
-
writeUInt64LE(zip64EocdrBuffer,
|
10869
|
+
writeUInt64LE(zip64EocdrBuffer, self2.offsetOfStartOfCentralDirectory, 48);
|
9247
10870
|
var zip64EocdlBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE);
|
9248
10871
|
zip64EocdlBuffer.writeUInt32LE(117853008, 0);
|
9249
10872
|
zip64EocdlBuffer.writeUInt32LE(0, 4);
|
9250
|
-
writeUInt64LE(zip64EocdlBuffer,
|
10873
|
+
writeUInt64LE(zip64EocdlBuffer, self2.outputStreamCursor, 8);
|
9251
10874
|
zip64EocdlBuffer.writeUInt32LE(1, 16);
|
9252
10875
|
return Buffer.concat([
|
9253
10876
|
zip64EocdrBuffer,
|
@@ -10017,7 +11640,7 @@ var require_minimatch = __commonJS({
|
|
10017
11640
|
var reClassStart = -1;
|
10018
11641
|
var classStart = -1;
|
10019
11642
|
var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
10020
|
-
var
|
11643
|
+
var self2 = this;
|
10021
11644
|
function clearStateChar() {
|
10022
11645
|
if (stateChar) {
|
10023
11646
|
switch (stateChar) {
|
@@ -10033,7 +11656,7 @@ var require_minimatch = __commonJS({
|
|
10033
11656
|
re += "\\" + stateChar;
|
10034
11657
|
break;
|
10035
11658
|
}
|
10036
|
-
|
11659
|
+
self2.debug("clearStateChar %j %j", stateChar, re);
|
10037
11660
|
stateChar = false;
|
10038
11661
|
}
|
10039
11662
|
}
|
@@ -10065,7 +11688,7 @@ var require_minimatch = __commonJS({
|
|
10065
11688
|
re += c;
|
10066
11689
|
continue;
|
10067
11690
|
}
|
10068
|
-
|
11691
|
+
self2.debug("call clearStateChar %j", stateChar);
|
10069
11692
|
clearStateChar();
|
10070
11693
|
stateChar = c;
|
10071
11694
|
if (options.noext)
|
@@ -11552,12 +13175,12 @@ var require_common = __commonJS({
|
|
11552
13175
|
function alphasort(a, b) {
|
11553
13176
|
return a.localeCompare(b, "en");
|
11554
13177
|
}
|
11555
|
-
function setupIgnores(
|
11556
|
-
|
11557
|
-
if (!Array.isArray(
|
11558
|
-
|
11559
|
-
if (
|
11560
|
-
|
13178
|
+
function setupIgnores(self2, options) {
|
13179
|
+
self2.ignore = options.ignore || [];
|
13180
|
+
if (!Array.isArray(self2.ignore))
|
13181
|
+
self2.ignore = [self2.ignore];
|
13182
|
+
if (self2.ignore.length) {
|
13183
|
+
self2.ignore = self2.ignore.map(ignoreMap);
|
11561
13184
|
}
|
11562
13185
|
}
|
11563
13186
|
function ignoreMap(pattern) {
|
@@ -11571,7 +13194,7 @@ var require_common = __commonJS({
|
|
11571
13194
|
gmatcher
|
11572
13195
|
};
|
11573
13196
|
}
|
11574
|
-
function setopts(
|
13197
|
+
function setopts(self2, pattern, options) {
|
11575
13198
|
if (!options)
|
11576
13199
|
options = {};
|
11577
13200
|
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
@@ -11580,62 +13203,62 @@ var require_common = __commonJS({
|
|
11580
13203
|
}
|
11581
13204
|
pattern = "**/" + pattern;
|
11582
13205
|
}
|
11583
|
-
|
11584
|
-
|
11585
|
-
|
11586
|
-
|
11587
|
-
|
11588
|
-
|
11589
|
-
|
11590
|
-
|
11591
|
-
|
11592
|
-
if (
|
11593
|
-
|
11594
|
-
|
11595
|
-
|
11596
|
-
|
11597
|
-
|
11598
|
-
|
11599
|
-
|
11600
|
-
|
11601
|
-
|
11602
|
-
|
11603
|
-
|
11604
|
-
|
11605
|
-
|
11606
|
-
|
11607
|
-
setupIgnores(
|
11608
|
-
|
13206
|
+
self2.silent = !!options.silent;
|
13207
|
+
self2.pattern = pattern;
|
13208
|
+
self2.strict = options.strict !== false;
|
13209
|
+
self2.realpath = !!options.realpath;
|
13210
|
+
self2.realpathCache = options.realpathCache || /* @__PURE__ */ Object.create(null);
|
13211
|
+
self2.follow = !!options.follow;
|
13212
|
+
self2.dot = !!options.dot;
|
13213
|
+
self2.mark = !!options.mark;
|
13214
|
+
self2.nodir = !!options.nodir;
|
13215
|
+
if (self2.nodir)
|
13216
|
+
self2.mark = true;
|
13217
|
+
self2.sync = !!options.sync;
|
13218
|
+
self2.nounique = !!options.nounique;
|
13219
|
+
self2.nonull = !!options.nonull;
|
13220
|
+
self2.nosort = !!options.nosort;
|
13221
|
+
self2.nocase = !!options.nocase;
|
13222
|
+
self2.stat = !!options.stat;
|
13223
|
+
self2.noprocess = !!options.noprocess;
|
13224
|
+
self2.absolute = !!options.absolute;
|
13225
|
+
self2.fs = options.fs || fs5;
|
13226
|
+
self2.maxLength = options.maxLength || Infinity;
|
13227
|
+
self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
|
13228
|
+
self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
|
13229
|
+
self2.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
|
13230
|
+
setupIgnores(self2, options);
|
13231
|
+
self2.changedCwd = false;
|
11609
13232
|
var cwd = process.cwd();
|
11610
13233
|
if (!ownProp(options, "cwd"))
|
11611
|
-
|
13234
|
+
self2.cwd = path7.resolve(cwd);
|
11612
13235
|
else {
|
11613
|
-
|
11614
|
-
|
13236
|
+
self2.cwd = path7.resolve(options.cwd);
|
13237
|
+
self2.changedCwd = self2.cwd !== cwd;
|
11615
13238
|
}
|
11616
|
-
|
11617
|
-
|
11618
|
-
|
11619
|
-
|
13239
|
+
self2.root = options.root || path7.resolve(self2.cwd, "/");
|
13240
|
+
self2.root = path7.resolve(self2.root);
|
13241
|
+
self2.cwdAbs = isAbsolute(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
|
13242
|
+
self2.nomount = !!options.nomount;
|
11620
13243
|
if (process.platform === "win32") {
|
11621
|
-
|
11622
|
-
|
11623
|
-
|
13244
|
+
self2.root = self2.root.replace(/\\/g, "/");
|
13245
|
+
self2.cwd = self2.cwd.replace(/\\/g, "/");
|
13246
|
+
self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/");
|
11624
13247
|
}
|
11625
13248
|
options.nonegate = true;
|
11626
13249
|
options.nocomment = true;
|
11627
13250
|
options.allowWindowsEscape = true;
|
11628
|
-
|
11629
|
-
|
13251
|
+
self2.minimatch = new Minimatch(pattern, options);
|
13252
|
+
self2.options = self2.minimatch.options;
|
11630
13253
|
}
|
11631
|
-
function finish(
|
11632
|
-
var nou =
|
13254
|
+
function finish(self2) {
|
13255
|
+
var nou = self2.nounique;
|
11633
13256
|
var all = nou ? [] : /* @__PURE__ */ Object.create(null);
|
11634
|
-
for (var i = 0, l =
|
11635
|
-
var matches =
|
13257
|
+
for (var i = 0, l = self2.matches.length; i < l; i++) {
|
13258
|
+
var matches = self2.matches[i];
|
11636
13259
|
if (!matches || Object.keys(matches).length === 0) {
|
11637
|
-
if (
|
11638
|
-
var literal =
|
13260
|
+
if (self2.nonull) {
|
13261
|
+
var literal = self2.minimatch.globSet[i];
|
11639
13262
|
if (nou)
|
11640
13263
|
all.push(literal);
|
11641
13264
|
else
|
@@ -11653,31 +13276,31 @@ var require_common = __commonJS({
|
|
11653
13276
|
}
|
11654
13277
|
if (!nou)
|
11655
13278
|
all = Object.keys(all);
|
11656
|
-
if (!
|
13279
|
+
if (!self2.nosort)
|
11657
13280
|
all = all.sort(alphasort);
|
11658
|
-
if (
|
13281
|
+
if (self2.mark) {
|
11659
13282
|
for (var i = 0; i < all.length; i++) {
|
11660
|
-
all[i] =
|
13283
|
+
all[i] = self2._mark(all[i]);
|
11661
13284
|
}
|
11662
|
-
if (
|
13285
|
+
if (self2.nodir) {
|
11663
13286
|
all = all.filter(function(e) {
|
11664
13287
|
var notDir = !/\/$/.test(e);
|
11665
|
-
var c =
|
13288
|
+
var c = self2.cache[e] || self2.cache[makeAbs(self2, e)];
|
11666
13289
|
if (notDir && c)
|
11667
13290
|
notDir = c !== "DIR" && !Array.isArray(c);
|
11668
13291
|
return notDir;
|
11669
13292
|
});
|
11670
13293
|
}
|
11671
13294
|
}
|
11672
|
-
if (
|
13295
|
+
if (self2.ignore.length)
|
11673
13296
|
all = all.filter(function(m2) {
|
11674
|
-
return !isIgnored(
|
13297
|
+
return !isIgnored(self2, m2);
|
11675
13298
|
});
|
11676
|
-
|
13299
|
+
self2.found = all;
|
11677
13300
|
}
|
11678
|
-
function mark(
|
11679
|
-
var abs = makeAbs(
|
11680
|
-
var c =
|
13301
|
+
function mark(self2, p) {
|
13302
|
+
var abs = makeAbs(self2, p);
|
13303
|
+
var c = self2.cache[abs];
|
11681
13304
|
var m = p;
|
11682
13305
|
if (c) {
|
11683
13306
|
var isDir = c === "DIR" || Array.isArray(c);
|
@@ -11687,21 +13310,21 @@ var require_common = __commonJS({
|
|
11687
13310
|
else if (!isDir && slash)
|
11688
13311
|
m = m.slice(0, -1);
|
11689
13312
|
if (m !== p) {
|
11690
|
-
var mabs = makeAbs(
|
11691
|
-
|
11692
|
-
|
13313
|
+
var mabs = makeAbs(self2, m);
|
13314
|
+
self2.statCache[mabs] = self2.statCache[abs];
|
13315
|
+
self2.cache[mabs] = self2.cache[abs];
|
11693
13316
|
}
|
11694
13317
|
}
|
11695
13318
|
return m;
|
11696
13319
|
}
|
11697
|
-
function makeAbs(
|
13320
|
+
function makeAbs(self2, f) {
|
11698
13321
|
var abs = f;
|
11699
13322
|
if (f.charAt(0) === "/") {
|
11700
|
-
abs = path7.join(
|
13323
|
+
abs = path7.join(self2.root, f);
|
11701
13324
|
} else if (isAbsolute(f) || f === "") {
|
11702
13325
|
abs = f;
|
11703
|
-
} else if (
|
11704
|
-
abs = path7.resolve(
|
13326
|
+
} else if (self2.changedCwd) {
|
13327
|
+
abs = path7.resolve(self2.cwd, f);
|
11705
13328
|
} else {
|
11706
13329
|
abs = path7.resolve(f);
|
11707
13330
|
}
|
@@ -11709,17 +13332,17 @@ var require_common = __commonJS({
|
|
11709
13332
|
abs = abs.replace(/\\/g, "/");
|
11710
13333
|
return abs;
|
11711
13334
|
}
|
11712
|
-
function isIgnored(
|
11713
|
-
if (!
|
13335
|
+
function isIgnored(self2, path8) {
|
13336
|
+
if (!self2.ignore.length)
|
11714
13337
|
return false;
|
11715
|
-
return
|
13338
|
+
return self2.ignore.some(function(item) {
|
11716
13339
|
return item.matcher.match(path8) || !!(item.gmatcher && item.gmatcher.match(path8));
|
11717
13340
|
});
|
11718
13341
|
}
|
11719
|
-
function childrenIgnored(
|
11720
|
-
if (!
|
13342
|
+
function childrenIgnored(self2, path8) {
|
13343
|
+
if (!self2.ignore.length)
|
11721
13344
|
return false;
|
11722
|
-
return
|
13345
|
+
return self2.ignore.some(function(item) {
|
11723
13346
|
return !!(item.gmatcher && item.gmatcher.match(path8));
|
11724
13347
|
});
|
11725
13348
|
}
|
@@ -11769,17 +13392,17 @@ var require_sync = __commonJS({
|
|
11769
13392
|
GlobSync.prototype._finish = function() {
|
11770
13393
|
assert7.ok(this instanceof GlobSync);
|
11771
13394
|
if (this.realpath) {
|
11772
|
-
var
|
13395
|
+
var self2 = this;
|
11773
13396
|
this.matches.forEach(function(matchset, index) {
|
11774
|
-
var set =
|
13397
|
+
var set = self2.matches[index] = /* @__PURE__ */ Object.create(null);
|
11775
13398
|
for (var p in matchset) {
|
11776
13399
|
try {
|
11777
|
-
p =
|
11778
|
-
var real = rp.realpathSync(p,
|
13400
|
+
p = self2._makeAbs(p);
|
13401
|
+
var real = rp.realpathSync(p, self2.realpathCache);
|
11779
13402
|
set[real] = true;
|
11780
13403
|
} catch (er) {
|
11781
13404
|
if (er.syscall === "stat")
|
11782
|
-
set[
|
13405
|
+
set[self2._makeAbs(p)] = true;
|
11783
13406
|
else
|
11784
13407
|
throw er;
|
11785
13408
|
}
|
@@ -12212,7 +13835,7 @@ var require_glob = __commonJS({
|
|
12212
13835
|
cb(null, matches);
|
12213
13836
|
});
|
12214
13837
|
}
|
12215
|
-
var
|
13838
|
+
var self2 = this;
|
12216
13839
|
this._processing = 0;
|
12217
13840
|
this._emitQueue = [];
|
12218
13841
|
this._processQueue = [];
|
@@ -12227,14 +13850,14 @@ var require_glob = __commonJS({
|
|
12227
13850
|
}
|
12228
13851
|
sync = false;
|
12229
13852
|
function done() {
|
12230
|
-
--
|
12231
|
-
if (
|
13853
|
+
--self2._processing;
|
13854
|
+
if (self2._processing <= 0) {
|
12232
13855
|
if (sync) {
|
12233
13856
|
process.nextTick(function() {
|
12234
|
-
|
13857
|
+
self2._finish();
|
12235
13858
|
});
|
12236
13859
|
} else {
|
12237
|
-
|
13860
|
+
self2._finish();
|
12238
13861
|
}
|
12239
13862
|
}
|
12240
13863
|
}
|
@@ -12255,12 +13878,12 @@ var require_glob = __commonJS({
|
|
12255
13878
|
var n = this.matches.length;
|
12256
13879
|
if (n === 0)
|
12257
13880
|
return this._finish();
|
12258
|
-
var
|
13881
|
+
var self2 = this;
|
12259
13882
|
for (var i = 0; i < this.matches.length; i++)
|
12260
13883
|
this._realpathSet(i, next);
|
12261
13884
|
function next() {
|
12262
13885
|
if (--n === 0)
|
12263
|
-
|
13886
|
+
self2._finish();
|
12264
13887
|
}
|
12265
13888
|
};
|
12266
13889
|
Glob.prototype._realpathSet = function(index, cb) {
|
@@ -12268,22 +13891,22 @@ var require_glob = __commonJS({
|
|
12268
13891
|
if (!matchset)
|
12269
13892
|
return cb();
|
12270
13893
|
var found = Object.keys(matchset);
|
12271
|
-
var
|
13894
|
+
var self2 = this;
|
12272
13895
|
var n = found.length;
|
12273
13896
|
if (n === 0)
|
12274
13897
|
return cb();
|
12275
13898
|
var set = this.matches[index] = /* @__PURE__ */ Object.create(null);
|
12276
13899
|
found.forEach(function(p, i) {
|
12277
|
-
p =
|
12278
|
-
rp.realpath(p,
|
13900
|
+
p = self2._makeAbs(p);
|
13901
|
+
rp.realpath(p, self2.realpathCache, function(er, real) {
|
12279
13902
|
if (!er)
|
12280
13903
|
set[real] = true;
|
12281
13904
|
else if (er.syscall === "stat")
|
12282
13905
|
set[p] = true;
|
12283
13906
|
else
|
12284
|
-
|
13907
|
+
self2.emit("error", er);
|
12285
13908
|
if (--n === 0) {
|
12286
|
-
|
13909
|
+
self2.matches[index] = set;
|
12287
13910
|
cb();
|
12288
13911
|
}
|
12289
13912
|
});
|
@@ -12376,9 +13999,9 @@ var require_glob = __commonJS({
|
|
12376
13999
|
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
|
12377
14000
|
};
|
12378
14001
|
Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
12379
|
-
var
|
14002
|
+
var self2 = this;
|
12380
14003
|
this._readdir(abs, inGlobStar, function(er, entries) {
|
12381
|
-
return
|
14004
|
+
return self2._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
12382
14005
|
});
|
12383
14006
|
};
|
12384
14007
|
Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
@@ -12470,20 +14093,20 @@ var require_glob = __commonJS({
|
|
12470
14093
|
if (this.follow)
|
12471
14094
|
return this._readdir(abs, false, cb);
|
12472
14095
|
var lstatkey = "lstat\0" + abs;
|
12473
|
-
var
|
14096
|
+
var self2 = this;
|
12474
14097
|
var lstatcb = inflight(lstatkey, lstatcb_);
|
12475
14098
|
if (lstatcb)
|
12476
|
-
|
14099
|
+
self2.fs.lstat(abs, lstatcb);
|
12477
14100
|
function lstatcb_(er, lstat2) {
|
12478
14101
|
if (er && er.code === "ENOENT")
|
12479
14102
|
return cb();
|
12480
14103
|
var isSym = lstat2 && lstat2.isSymbolicLink();
|
12481
|
-
|
14104
|
+
self2.symlinks[abs] = isSym;
|
12482
14105
|
if (!isSym && lstat2 && !lstat2.isDirectory()) {
|
12483
|
-
|
14106
|
+
self2.cache[abs] = "FILE";
|
12484
14107
|
cb();
|
12485
14108
|
} else
|
12486
|
-
|
14109
|
+
self2._readdir(abs, false, cb);
|
12487
14110
|
}
|
12488
14111
|
};
|
12489
14112
|
Glob.prototype._readdir = function(abs, inGlobStar, cb) {
|
@@ -12501,15 +14124,15 @@ var require_glob = __commonJS({
|
|
12501
14124
|
if (Array.isArray(c))
|
12502
14125
|
return cb(null, c);
|
12503
14126
|
}
|
12504
|
-
var
|
12505
|
-
|
14127
|
+
var self2 = this;
|
14128
|
+
self2.fs.readdir(abs, readdirCb(this, abs, cb));
|
12506
14129
|
};
|
12507
|
-
function readdirCb(
|
14130
|
+
function readdirCb(self2, abs, cb) {
|
12508
14131
|
return function(er, entries) {
|
12509
14132
|
if (er)
|
12510
|
-
|
14133
|
+
self2._readdirError(abs, er, cb);
|
12511
14134
|
else
|
12512
|
-
|
14135
|
+
self2._readdirEntries(abs, entries, cb);
|
12513
14136
|
};
|
12514
14137
|
}
|
12515
14138
|
Glob.prototype._readdirEntries = function(abs, entries, cb) {
|
@@ -12563,9 +14186,9 @@ var require_glob = __commonJS({
|
|
12563
14186
|
return cb();
|
12564
14187
|
};
|
12565
14188
|
Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
12566
|
-
var
|
14189
|
+
var self2 = this;
|
12567
14190
|
this._readdir(abs, inGlobStar, function(er, entries) {
|
12568
|
-
|
14191
|
+
self2._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
12569
14192
|
});
|
12570
14193
|
};
|
12571
14194
|
Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
@@ -12591,9 +14214,9 @@ var require_glob = __commonJS({
|
|
12591
14214
|
cb();
|
12592
14215
|
};
|
12593
14216
|
Glob.prototype._processSimple = function(prefix, index, cb) {
|
12594
|
-
var
|
14217
|
+
var self2 = this;
|
12595
14218
|
this._stat(prefix, function(er, exists) {
|
12596
|
-
|
14219
|
+
self2._processSimple2(prefix, index, er, exists, cb);
|
12597
14220
|
});
|
12598
14221
|
};
|
12599
14222
|
Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) {
|
@@ -12643,20 +14266,20 @@ var require_glob = __commonJS({
|
|
12643
14266
|
return cb(null, type, stat);
|
12644
14267
|
}
|
12645
14268
|
}
|
12646
|
-
var
|
14269
|
+
var self2 = this;
|
12647
14270
|
var statcb = inflight("stat\0" + abs, lstatcb_);
|
12648
14271
|
if (statcb)
|
12649
|
-
|
14272
|
+
self2.fs.lstat(abs, statcb);
|
12650
14273
|
function lstatcb_(er, lstat2) {
|
12651
14274
|
if (lstat2 && lstat2.isSymbolicLink()) {
|
12652
|
-
return
|
14275
|
+
return self2.fs.stat(abs, function(er2, stat2) {
|
12653
14276
|
if (er2)
|
12654
|
-
|
14277
|
+
self2._stat2(f, abs, null, lstat2, cb);
|
12655
14278
|
else
|
12656
|
-
|
14279
|
+
self2._stat2(f, abs, er2, stat2, cb);
|
12657
14280
|
});
|
12658
14281
|
} else {
|
12659
|
-
|
14282
|
+
self2._stat2(f, abs, er, lstat2, cb);
|
12660
14283
|
}
|
12661
14284
|
}
|
12662
14285
|
};
|
@@ -21400,7 +23023,8 @@ var Prerender = class {
|
|
21400
23023
|
passQuery,
|
21401
23024
|
sourcePath,
|
21402
23025
|
experimentalBypassFor,
|
21403
|
-
experimentalStreamingLambdaPath
|
23026
|
+
experimentalStreamingLambdaPath,
|
23027
|
+
chain
|
21404
23028
|
}) {
|
21405
23029
|
this.type = "Prerender";
|
21406
23030
|
this.expiration = expiration;
|
@@ -21492,6 +23116,26 @@ var Prerender = class {
|
|
21492
23116
|
}
|
21493
23117
|
this.experimentalStreamingLambdaPath = experimentalStreamingLambdaPath;
|
21494
23118
|
}
|
23119
|
+
if (chain !== void 0) {
|
23120
|
+
if (typeof chain !== "object") {
|
23121
|
+
throw new Error(
|
23122
|
+
"The `chain` argument for `Prerender` must be an object."
|
23123
|
+
);
|
23124
|
+
}
|
23125
|
+
if (!chain.headers || typeof chain.headers !== "object" || Object.entries(chain.headers).some(
|
23126
|
+
([key, value]) => typeof key !== "string" || typeof value !== "string"
|
23127
|
+
)) {
|
23128
|
+
throw new Error(
|
23129
|
+
`The \`chain.headers\` argument for \`Prerender\` must be an object with string key/values`
|
23130
|
+
);
|
23131
|
+
}
|
23132
|
+
if (!chain.outputPath || typeof chain.outputPath !== "string") {
|
23133
|
+
throw new Error(
|
23134
|
+
"The `chain.outputPath` argument for `Prerender` must be a string."
|
23135
|
+
);
|
23136
|
+
}
|
23137
|
+
this.chain = chain;
|
23138
|
+
}
|
21495
23139
|
}
|
21496
23140
|
};
|
21497
23141
|
|
@@ -21940,10 +23584,7 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
21940
23584
|
filename: "package.json"
|
21941
23585
|
});
|
21942
23586
|
const packageJson = readPackageJson && pkgJsonPath ? JSON.parse(await import_fs_extra7.default.readFile(pkgJsonPath, "utf8")) : void 0;
|
21943
|
-
const {
|
21944
|
-
paths: [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath],
|
21945
|
-
packageJsonPackageManager
|
21946
|
-
} = await walkParentDirsMulti({
|
23587
|
+
const [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath] = await walkParentDirsMulti({
|
21947
23588
|
base,
|
21948
23589
|
start: destPath,
|
21949
23590
|
filenames: [
|
@@ -21982,21 +23623,19 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
21982
23623
|
lockfilePath = bunLockPath;
|
21983
23624
|
lockfileVersion = 0;
|
21984
23625
|
} else {
|
21985
|
-
cliType = detectPackageManagerNameWithoutLockfile(
|
21986
|
-
packageJsonPackageManager
|
21987
|
-
);
|
23626
|
+
cliType = packageJson ? detectPackageManagerNameWithoutLockfile(packageJson) : "npm";
|
21988
23627
|
}
|
21989
23628
|
const packageJsonPath = pkgJsonPath || void 0;
|
21990
23629
|
return {
|
21991
23630
|
cliType,
|
21992
23631
|
packageJson,
|
21993
|
-
packageJsonPackageManager,
|
21994
23632
|
lockfilePath,
|
21995
23633
|
lockfileVersion,
|
21996
23634
|
packageJsonPath
|
21997
23635
|
};
|
21998
23636
|
}
|
21999
|
-
function detectPackageManagerNameWithoutLockfile(
|
23637
|
+
function detectPackageManagerNameWithoutLockfile(packageJson) {
|
23638
|
+
const packageJsonPackageManager = packageJson.packageManager;
|
22000
23639
|
if (usingCorepack(process.env, packageJsonPackageManager)) {
|
22001
23640
|
const corepackPackageManager = validateVersionSpecifier(
|
22002
23641
|
packageJsonPackageManager
|
@@ -22041,26 +23680,17 @@ async function walkParentDirsMulti({
|
|
22041
23680
|
start,
|
22042
23681
|
filenames
|
22043
23682
|
}) {
|
22044
|
-
let packageManager;
|
22045
23683
|
for (const dir of traverseUpDirectories({ start, base })) {
|
22046
23684
|
const fullPaths = filenames.map((f) => import_path5.default.join(dir, f));
|
22047
23685
|
const existResults = await Promise.all(
|
22048
23686
|
fullPaths.map((f) => import_fs_extra7.default.pathExists(f))
|
22049
23687
|
);
|
22050
23688
|
const foundOneOrMore = existResults.some((b) => b);
|
22051
|
-
const packageJsonPath = import_path5.default.join(dir, "package.json");
|
22052
|
-
const packageJson = await import_fs_extra7.default.readJSON(packageJsonPath).catch(() => null);
|
22053
|
-
if (packageJson?.packageManager) {
|
22054
|
-
packageManager = packageJson.packageManager;
|
22055
|
-
}
|
22056
23689
|
if (foundOneOrMore) {
|
22057
|
-
return
|
22058
|
-
paths: fullPaths.map((f, i) => existResults[i] ? f : void 0),
|
22059
|
-
packageJsonPackageManager: packageManager
|
22060
|
-
};
|
23690
|
+
return fullPaths.map((f, i) => existResults[i] ? f : void 0);
|
22061
23691
|
}
|
22062
23692
|
}
|
22063
|
-
return
|
23693
|
+
return [];
|
22064
23694
|
}
|
22065
23695
|
function isSet(v) {
|
22066
23696
|
return v?.constructor?.name === "Set";
|
@@ -22073,13 +23703,7 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
22073
23703
|
(0, import_assert6.default)(import_path5.default.isAbsolute(destPath));
|
22074
23704
|
try {
|
22075
23705
|
await runNpmInstallSema.acquire();
|
22076
|
-
const {
|
22077
|
-
cliType,
|
22078
|
-
packageJsonPath,
|
22079
|
-
lockfileVersion,
|
22080
|
-
packageJsonPackageManager,
|
22081
|
-
packageJson
|
22082
|
-
} = await scanParentDirs(destPath);
|
23706
|
+
const { cliType, packageJsonPath, packageJson, lockfileVersion } = await scanParentDirs(destPath, true);
|
22083
23707
|
if (!packageJsonPath) {
|
22084
23708
|
debug(
|
22085
23709
|
`Skipping dependency installation because no package.json was found for ${destPath}`
|
@@ -22108,7 +23732,7 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
22108
23732
|
opts.env = getEnvForPackageManager({
|
22109
23733
|
cliType,
|
22110
23734
|
lockfileVersion,
|
22111
|
-
packageJsonPackageManager,
|
23735
|
+
packageJsonPackageManager: packageJson?.packageManager,
|
22112
23736
|
nodeVersion,
|
22113
23737
|
env,
|
22114
23738
|
packageJsonEngines: packageJson?.engines
|
@@ -22447,11 +24071,14 @@ async function runCustomInstallCommand({
|
|
22447
24071
|
spawnOpts
|
22448
24072
|
}) {
|
22449
24073
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
22450
|
-
const { cliType, lockfileVersion,
|
24074
|
+
const { cliType, lockfileVersion, packageJson } = await scanParentDirs(
|
24075
|
+
destPath,
|
24076
|
+
true
|
24077
|
+
);
|
22451
24078
|
const env = getEnvForPackageManager({
|
22452
24079
|
cliType,
|
22453
24080
|
lockfileVersion,
|
22454
|
-
packageJsonPackageManager,
|
24081
|
+
packageJsonPackageManager: packageJson?.packageManager,
|
22455
24082
|
nodeVersion,
|
22456
24083
|
env: spawnOpts?.env || {},
|
22457
24084
|
packageJsonEngines: packageJson?.engines
|
@@ -22465,7 +24092,10 @@ async function runCustomInstallCommand({
|
|
22465
24092
|
}
|
22466
24093
|
async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
22467
24094
|
(0, import_assert6.default)(import_path5.default.isAbsolute(destPath));
|
22468
|
-
const { packageJson, cliType, lockfileVersion
|
24095
|
+
const { packageJson, cliType, lockfileVersion } = await scanParentDirs(
|
24096
|
+
destPath,
|
24097
|
+
true
|
24098
|
+
);
|
22469
24099
|
const scriptName = getScriptName(
|
22470
24100
|
packageJson,
|
22471
24101
|
typeof scriptNames === "string" ? [scriptNames] : scriptNames
|
@@ -22480,7 +24110,7 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
|
22480
24110
|
env: getEnvForPackageManager({
|
22481
24111
|
cliType,
|
22482
24112
|
lockfileVersion,
|
22483
|
-
packageJsonPackageManager,
|
24113
|
+
packageJsonPackageManager: packageJson?.packageManager,
|
22484
24114
|
nodeVersion: void 0,
|
22485
24115
|
env: cloneEnv(process.env, spawnOpts?.env),
|
22486
24116
|
packageJsonEngines: packageJson?.engines
|