@vercel/build-utils 8.8.0 → 9.0.0
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 +16 -8
- package/dist/fs/run-user-scripts.js +37 -27
- package/dist/index.js +201 -1790
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -2342,9 +2342,9 @@ var require_into_stream = __commonJS({
|
|
2342
2342
|
}
|
2343
2343
|
});
|
2344
2344
|
|
2345
|
-
// ../../node_modules/.pnpm/universalify@2.0.
|
2345
|
+
// ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
|
2346
2346
|
var require_universalify = __commonJS({
|
2347
|
-
"../../node_modules/.pnpm/universalify@2.0.
|
2347
|
+
"../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports2) {
|
2348
2348
|
"use strict";
|
2349
2349
|
exports2.fromCallback = function(fn) {
|
2350
2350
|
return Object.defineProperty(function(...args) {
|
@@ -2352,11 +2352,8 @@ var require_universalify = __commonJS({
|
|
2352
2352
|
fn.apply(this, args);
|
2353
2353
|
else {
|
2354
2354
|
return new Promise((resolve, reject) => {
|
2355
|
-
|
2356
|
-
|
2357
|
-
...args,
|
2358
|
-
(err, res) => err != null ? reject(err) : resolve(res)
|
2359
|
-
);
|
2355
|
+
args.push((err, res) => err != null ? reject(err) : resolve(res));
|
2356
|
+
fn.apply(this, args);
|
2360
2357
|
});
|
2361
2358
|
}
|
2362
2359
|
}, "name", { value: fn.name });
|
@@ -2366,8 +2363,10 @@ var require_universalify = __commonJS({
|
|
2366
2363
|
const cb = args[args.length - 1];
|
2367
2364
|
if (typeof cb !== "function")
|
2368
2365
|
return fn.apply(this, args);
|
2369
|
-
else
|
2370
|
-
|
2366
|
+
else {
|
2367
|
+
args.pop();
|
2368
|
+
fn.apply(this, args).then((r) => cb(null, r), cb);
|
2369
|
+
}
|
2371
2370
|
}, "name", { value: fn.name });
|
2372
2371
|
};
|
2373
2372
|
}
|
@@ -4830,1760 +4829,140 @@ var require_move_sync = __commonJS({
|
|
4830
4829
|
return moveAcrossDevice(src, dest, overwrite);
|
4831
4830
|
}
|
4832
4831
|
}
|
4833
|
-
function moveAcrossDevice(src, dest, overwrite) {
|
4834
|
-
const opts = {
|
4835
|
-
overwrite,
|
4836
|
-
errorOnExist: true
|
4837
|
-
};
|
4838
|
-
copySync(src, dest, opts);
|
4839
|
-
return removeSync(src);
|
4840
|
-
}
|
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;
|
4832
|
+
function moveAcrossDevice(src, dest, overwrite) {
|
4833
|
+
const opts = {
|
4834
|
+
overwrite,
|
4835
|
+
errorOnExist: true
|
4836
|
+
};
|
4837
|
+
copySync(src, dest, opts);
|
4838
|
+
return removeSync(src);
|
6434
4839
|
}
|
4840
|
+
module2.exports = moveSync;
|
6435
4841
|
}
|
6436
4842
|
});
|
6437
4843
|
|
6438
|
-
// ../../node_modules/.pnpm/
|
6439
|
-
var
|
6440
|
-
"../../node_modules/.pnpm/
|
4844
|
+
// ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move-sync/index.js
|
4845
|
+
var require_move_sync2 = __commonJS({
|
4846
|
+
"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move-sync/index.js"(exports2, module2) {
|
6441
4847
|
"use strict";
|
6442
|
-
module2.exports =
|
6443
|
-
|
6444
|
-
|
6445
|
-
|
6446
|
-
|
6447
|
-
|
6448
|
-
|
6449
|
-
|
6450
|
-
|
6451
|
-
|
6452
|
-
|
6453
|
-
|
6454
|
-
|
6455
|
-
|
6456
|
-
|
6457
|
-
|
6458
|
-
|
6459
|
-
|
6460
|
-
|
6461
|
-
|
6462
|
-
|
4848
|
+
module2.exports = {
|
4849
|
+
moveSync: require_move_sync()
|
4850
|
+
};
|
4851
|
+
}
|
4852
|
+
});
|
4853
|
+
|
4854
|
+
// ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/move.js
|
4855
|
+
var require_move = __commonJS({
|
4856
|
+
"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
|
4857
|
+
"use strict";
|
4858
|
+
var fs5 = require_graceful_fs();
|
4859
|
+
var path7 = require("path");
|
4860
|
+
var copy = require_copy2().copy;
|
4861
|
+
var remove2 = require_remove().remove;
|
4862
|
+
var mkdirp3 = require_mkdirs().mkdirp;
|
4863
|
+
var pathExists = require_path_exists().pathExists;
|
4864
|
+
var stat = require_stat();
|
4865
|
+
function move(src, dest, opts, cb) {
|
4866
|
+
if (typeof opts === "function") {
|
4867
|
+
cb = opts;
|
4868
|
+
opts = {};
|
6463
4869
|
}
|
4870
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
4871
|
+
stat.checkPaths(src, dest, "move", opts, (err, stats) => {
|
4872
|
+
if (err)
|
4873
|
+
return cb(err);
|
4874
|
+
const { srcStat, isChangingCase = false } = stats;
|
4875
|
+
stat.checkParentPaths(src, srcStat, dest, "move", (err2) => {
|
4876
|
+
if (err2)
|
4877
|
+
return cb(err2);
|
4878
|
+
if (isParentRoot(dest))
|
4879
|
+
return doRename(src, dest, overwrite, isChangingCase, cb);
|
4880
|
+
mkdirp3(path7.dirname(dest), (err3) => {
|
4881
|
+
if (err3)
|
4882
|
+
return cb(err3);
|
4883
|
+
return doRename(src, dest, overwrite, isChangingCase, cb);
|
4884
|
+
});
|
4885
|
+
});
|
4886
|
+
});
|
6464
4887
|
}
|
6465
|
-
function
|
6466
|
-
|
6467
|
-
|
6468
|
-
|
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);
|
4888
|
+
function isParentRoot(dest) {
|
4889
|
+
const parent = path7.dirname(dest);
|
4890
|
+
const parsedPath = path7.parse(parent);
|
4891
|
+
return parsedPath.root === parent;
|
6486
4892
|
}
|
6487
|
-
function
|
6488
|
-
|
6489
|
-
|
6490
|
-
|
6491
|
-
|
4893
|
+
function doRename(src, dest, overwrite, isChangingCase, cb) {
|
4894
|
+
if (isChangingCase)
|
4895
|
+
return rename2(src, dest, overwrite, cb);
|
4896
|
+
if (overwrite) {
|
4897
|
+
return remove2(dest, (err) => {
|
4898
|
+
if (err)
|
4899
|
+
return cb(err);
|
4900
|
+
return rename2(src, dest, overwrite, cb);
|
6492
4901
|
});
|
6493
|
-
} else {
|
6494
|
-
done(this, null, null);
|
6495
4902
|
}
|
4903
|
+
pathExists(dest, (err, destExists) => {
|
4904
|
+
if (err)
|
4905
|
+
return cb(err);
|
4906
|
+
if (destExists)
|
4907
|
+
return cb(new Error("dest already exists."));
|
4908
|
+
return rename2(src, dest, overwrite, cb);
|
4909
|
+
});
|
6496
4910
|
}
|
6497
|
-
|
6498
|
-
|
6499
|
-
|
6500
|
-
|
6501
|
-
|
6502
|
-
|
6503
|
-
|
6504
|
-
|
6505
|
-
|
6506
|
-
|
6507
|
-
|
6508
|
-
|
6509
|
-
|
6510
|
-
|
6511
|
-
|
6512
|
-
|
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");
|
4911
|
+
function rename2(src, dest, overwrite, cb) {
|
4912
|
+
fs5.rename(src, dest, (err) => {
|
4913
|
+
if (!err)
|
4914
|
+
return cb();
|
4915
|
+
if (err.code !== "EXDEV")
|
4916
|
+
return cb(err);
|
4917
|
+
return moveAcrossDevice(src, dest, overwrite, cb);
|
4918
|
+
});
|
4919
|
+
}
|
4920
|
+
function moveAcrossDevice(src, dest, overwrite, cb) {
|
4921
|
+
const opts = {
|
4922
|
+
overwrite,
|
4923
|
+
errorOnExist: true
|
4924
|
+
};
|
4925
|
+
copy(src, dest, opts, (err) => {
|
4926
|
+
if (err)
|
4927
|
+
return cb(err);
|
4928
|
+
return remove2(src, cb);
|
6529
4929
|
});
|
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);
|
6541
4930
|
}
|
4931
|
+
module2.exports = move;
|
6542
4932
|
}
|
6543
4933
|
});
|
6544
4934
|
|
6545
|
-
// ../../node_modules/.pnpm/
|
6546
|
-
var
|
6547
|
-
"../../node_modules/.pnpm/
|
4935
|
+
// ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/index.js
|
4936
|
+
var require_move2 = __commonJS({
|
4937
|
+
"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/index.js"(exports2, module2) {
|
6548
4938
|
"use strict";
|
6549
|
-
|
6550
|
-
|
6551
|
-
|
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);
|
4939
|
+
var u = require_universalify().fromCallback;
|
4940
|
+
module2.exports = {
|
4941
|
+
move: u(require_move())
|
6561
4942
|
};
|
6562
4943
|
}
|
6563
4944
|
});
|
6564
4945
|
|
6565
|
-
// ../../node_modules/.pnpm/
|
6566
|
-
var
|
6567
|
-
"../../node_modules/.pnpm/
|
6568
|
-
|
6569
|
-
|
6570
|
-
|
6571
|
-
|
6572
|
-
|
6573
|
-
|
6574
|
-
|
6575
|
-
|
6576
|
-
|
6577
|
-
|
6578
|
-
|
6579
|
-
|
6580
|
-
|
6581
|
-
|
6582
|
-
|
6583
|
-
|
6584
|
-
|
6585
|
-
exports2.PassThrough = require_stream_passthrough2();
|
6586
|
-
}
|
4946
|
+
// ../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/index.js
|
4947
|
+
var require_lib = __commonJS({
|
4948
|
+
"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/index.js"(exports2, module2) {
|
4949
|
+
"use strict";
|
4950
|
+
module2.exports = {
|
4951
|
+
// Export promiseified graceful-fs:
|
4952
|
+
...require_fs(),
|
4953
|
+
// Export extra methods:
|
4954
|
+
...require_copy_sync2(),
|
4955
|
+
...require_copy2(),
|
4956
|
+
...require_empty(),
|
4957
|
+
...require_ensure(),
|
4958
|
+
...require_json(),
|
4959
|
+
...require_mkdirs(),
|
4960
|
+
...require_move_sync2(),
|
4961
|
+
...require_move2(),
|
4962
|
+
...require_output(),
|
4963
|
+
...require_path_exists(),
|
4964
|
+
...require_remove()
|
4965
|
+
};
|
6587
4966
|
}
|
6588
4967
|
});
|
6589
4968
|
|
@@ -6592,7 +4971,7 @@ var require_multistream = __commonJS({
|
|
6592
4971
|
"../../node_modules/.pnpm/multistream@2.1.1/node_modules/multistream/index.js"(exports2, module2) {
|
6593
4972
|
module2.exports = MultiStream;
|
6594
4973
|
var inherits = require_inherits();
|
6595
|
-
var stream =
|
4974
|
+
var stream = require_readable();
|
6596
4975
|
inherits(MultiStream, stream.Readable);
|
6597
4976
|
function MultiStream(streams, opts) {
|
6598
4977
|
var self2 = this;
|
@@ -12446,9 +10825,9 @@ var require_fs2 = __commonJS({
|
|
12446
10825
|
}
|
12447
10826
|
});
|
12448
10827
|
|
12449
|
-
// ../../node_modules/.pnpm/minimatch@5.1.
|
10828
|
+
// ../../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js
|
12450
10829
|
var require_path = __commonJS({
|
12451
|
-
"../../node_modules/.pnpm/minimatch@5.1.
|
10830
|
+
"../../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js"(exports2, module2) {
|
12452
10831
|
var isWindows = typeof process === "object" && process && process.platform === "win32";
|
12453
10832
|
module2.exports = isWindows ? { sep: "\\" } : { sep: "/" };
|
12454
10833
|
}
|
@@ -12605,9 +10984,9 @@ var require_brace_expansion2 = __commonJS({
|
|
12605
10984
|
}
|
12606
10985
|
});
|
12607
10986
|
|
12608
|
-
// ../../node_modules/.pnpm/minimatch@5.1.
|
10987
|
+
// ../../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js
|
12609
10988
|
var require_minimatch2 = __commonJS({
|
12610
|
-
"../../node_modules/.pnpm/minimatch@5.1.
|
10989
|
+
"../../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js"(exports2, module2) {
|
12611
10990
|
var minimatch2 = module2.exports = (p, pattern, options = {}) => {
|
12612
10991
|
assertValidPattern(pattern);
|
12613
10992
|
if (!options.nocomment && pattern.charAt(0) === "#") {
|
@@ -12843,7 +11222,7 @@ var require_minimatch2 = __commonJS({
|
|
12843
11222
|
if (pattern === "")
|
12844
11223
|
return "";
|
12845
11224
|
let re = "";
|
12846
|
-
let hasMagic =
|
11225
|
+
let hasMagic = false;
|
12847
11226
|
let escaping = false;
|
12848
11227
|
const patternListStack = [];
|
12849
11228
|
const negativeLists = [];
|
@@ -12854,7 +11233,10 @@ var require_minimatch2 = __commonJS({
|
|
12854
11233
|
let cs;
|
12855
11234
|
let pl;
|
12856
11235
|
let sp;
|
12857
|
-
|
11236
|
+
let dotTravAllowed = pattern.charAt(0) === ".";
|
11237
|
+
let dotFileAllowed = options.dot || dotTravAllowed;
|
11238
|
+
const patternStart = () => dotTravAllowed ? "" : dotFileAllowed ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
11239
|
+
const subPatternStart = (p) => p.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
12858
11240
|
const clearStateChar = () => {
|
12859
11241
|
if (stateChar) {
|
12860
11242
|
switch (stateChar) {
|
@@ -12918,7 +11300,7 @@ var require_minimatch2 = __commonJS({
|
|
12918
11300
|
if (options.noext)
|
12919
11301
|
clearStateChar();
|
12920
11302
|
continue;
|
12921
|
-
case "(":
|
11303
|
+
case "(": {
|
12922
11304
|
if (inClass) {
|
12923
11305
|
re += "(";
|
12924
11306
|
continue;
|
@@ -12927,39 +11309,54 @@ var require_minimatch2 = __commonJS({
|
|
12927
11309
|
re += "\\(";
|
12928
11310
|
continue;
|
12929
11311
|
}
|
12930
|
-
|
11312
|
+
const plEntry = {
|
12931
11313
|
type: stateChar,
|
12932
11314
|
start: i - 1,
|
12933
11315
|
reStart: re.length,
|
12934
11316
|
open: plTypes[stateChar].open,
|
12935
11317
|
close: plTypes[stateChar].close
|
12936
|
-
}
|
12937
|
-
|
11318
|
+
};
|
11319
|
+
this.debug(this.pattern, " ", plEntry);
|
11320
|
+
patternListStack.push(plEntry);
|
11321
|
+
re += plEntry.open;
|
11322
|
+
if (plEntry.start === 0 && plEntry.type !== "!") {
|
11323
|
+
dotTravAllowed = true;
|
11324
|
+
re += subPatternStart(pattern.slice(i + 1));
|
11325
|
+
}
|
12938
11326
|
this.debug("plType %j %j", stateChar, re);
|
12939
11327
|
stateChar = false;
|
12940
11328
|
continue;
|
12941
|
-
|
12942
|
-
|
11329
|
+
}
|
11330
|
+
case ")": {
|
11331
|
+
const plEntry = patternListStack[patternListStack.length - 1];
|
11332
|
+
if (inClass || !plEntry) {
|
12943
11333
|
re += "\\)";
|
12944
11334
|
continue;
|
12945
11335
|
}
|
11336
|
+
patternListStack.pop();
|
12946
11337
|
clearStateChar();
|
12947
11338
|
hasMagic = true;
|
12948
|
-
pl =
|
11339
|
+
pl = plEntry;
|
12949
11340
|
re += pl.close;
|
12950
11341
|
if (pl.type === "!") {
|
12951
|
-
negativeLists.push(pl);
|
11342
|
+
negativeLists.push(Object.assign(pl, { reEnd: re.length }));
|
12952
11343
|
}
|
12953
|
-
pl.reEnd = re.length;
|
12954
11344
|
continue;
|
12955
|
-
|
12956
|
-
|
11345
|
+
}
|
11346
|
+
case "|": {
|
11347
|
+
const plEntry = patternListStack[patternListStack.length - 1];
|
11348
|
+
if (inClass || !plEntry) {
|
12957
11349
|
re += "\\|";
|
12958
11350
|
continue;
|
12959
11351
|
}
|
12960
11352
|
clearStateChar();
|
12961
11353
|
re += "|";
|
11354
|
+
if (plEntry.start === 0 && plEntry.type !== "!") {
|
11355
|
+
dotTravAllowed = true;
|
11356
|
+
re += subPatternStart(pattern.slice(i + 1));
|
11357
|
+
}
|
12962
11358
|
continue;
|
11359
|
+
}
|
12963
11360
|
case "[":
|
12964
11361
|
clearStateChar();
|
12965
11362
|
if (inClass) {
|
@@ -13027,24 +11424,28 @@ var require_minimatch2 = __commonJS({
|
|
13027
11424
|
const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
|
13028
11425
|
let nlAfter = re.slice(nl.reEnd);
|
13029
11426
|
const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
|
13030
|
-
const
|
11427
|
+
const closeParensBefore = nlBefore.split(")").length;
|
11428
|
+
const openParensBefore = nlBefore.split("(").length - closeParensBefore;
|
13031
11429
|
let cleanAfter = nlAfter;
|
13032
11430
|
for (let i = 0; i < openParensBefore; i++) {
|
13033
11431
|
cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
|
13034
11432
|
}
|
13035
11433
|
nlAfter = cleanAfter;
|
13036
|
-
const dollar = nlAfter === "" && isSub !== SUBPARSE ? "
|
11434
|
+
const dollar = nlAfter === "" && isSub !== SUBPARSE ? "(?:$|\\/)" : "";
|
13037
11435
|
re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
|
13038
11436
|
}
|
13039
11437
|
if (re !== "" && hasMagic) {
|
13040
11438
|
re = "(?=.)" + re;
|
13041
11439
|
}
|
13042
11440
|
if (addPatternStart) {
|
13043
|
-
re = patternStart + re;
|
11441
|
+
re = patternStart() + re;
|
13044
11442
|
}
|
13045
11443
|
if (isSub === SUBPARSE) {
|
13046
11444
|
return [re, hasMagic];
|
13047
11445
|
}
|
11446
|
+
if (options.nocase && !hasMagic) {
|
11447
|
+
hasMagic = pattern.toUpperCase() !== pattern.toLowerCase();
|
11448
|
+
}
|
13048
11449
|
if (!hasMagic) {
|
13049
11450
|
return globUnescape(pattern);
|
13050
11451
|
}
|
@@ -24839,7 +23240,6 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
24839
23240
|
if (bunLock && hasYarnLock) {
|
24840
23241
|
cliType = "bun";
|
24841
23242
|
lockfilePath = bunLockPath;
|
24842
|
-
lockfileVersion = bunLockTextPath ? 1 : 0;
|
24843
23243
|
} else if (hasYarnLock) {
|
24844
23244
|
cliType = "yarn";
|
24845
23245
|
lockfilePath = yarnLockPath;
|
@@ -24854,7 +23254,6 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
24854
23254
|
} else if (bunLock) {
|
24855
23255
|
cliType = "bun";
|
24856
23256
|
lockfilePath = bunLockPath;
|
24857
|
-
lockfileVersion = bunLockTextPath ? 1 : 0;
|
24858
23257
|
} else {
|
24859
23258
|
cliType = detectPackageManagerNameWithoutLockfile(
|
24860
23259
|
packageJsonPackageManager,
|
@@ -24869,7 +23268,8 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
24869
23268
|
lockfilePath,
|
24870
23269
|
lockfileVersion,
|
24871
23270
|
packageJsonPath,
|
24872
|
-
turboSupportsCorepackHome
|
23271
|
+
turboSupportsCorepackHome,
|
23272
|
+
detectedLockfile: lockfilePath ? import_path5.default.basename(lockfilePath) : void 0
|
24873
23273
|
};
|
24874
23274
|
}
|
24875
23275
|
async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
|
@@ -24995,7 +23395,8 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
24995
23395
|
packageJson,
|
24996
23396
|
lockfileVersion,
|
24997
23397
|
packageJsonPackageManager,
|
24998
|
-
turboSupportsCorepackHome
|
23398
|
+
turboSupportsCorepackHome,
|
23399
|
+
detectedLockfile
|
24999
23400
|
} = await scanParentDirs(destPath, true);
|
25000
23401
|
if (!packageJsonPath) {
|
25001
23402
|
debug(
|
@@ -25029,7 +23430,8 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
25029
23430
|
nodeVersion,
|
25030
23431
|
env,
|
25031
23432
|
packageJsonEngines: packageJson?.engines,
|
25032
|
-
turboSupportsCorepackHome
|
23433
|
+
turboSupportsCorepackHome,
|
23434
|
+
detectedLockfile
|
25033
23435
|
});
|
25034
23436
|
let commandArgs;
|
25035
23437
|
const isPotentiallyBrokenNpm = cliType === "npm" && (nodeVersion?.major === 16 || opts.env.PATH?.includes("/node16/bin-npm7")) && !args.includes("--legacy-peer-deps") && spawnOpts?.env?.ENABLE_EXPERIMENTAL_COREPACK !== "1";
|
@@ -25083,24 +23485,22 @@ function getEnvForPackageManager({
|
|
25083
23485
|
nodeVersion,
|
25084
23486
|
env,
|
25085
23487
|
packageJsonEngines,
|
25086
|
-
turboSupportsCorepackHome
|
23488
|
+
turboSupportsCorepackHome,
|
23489
|
+
detectedLockfile
|
25087
23490
|
}) {
|
25088
23491
|
const corepackEnabled = usingCorepack(
|
25089
23492
|
env,
|
25090
23493
|
packageJsonPackageManager,
|
25091
23494
|
turboSupportsCorepackHome
|
25092
23495
|
);
|
25093
|
-
const {
|
25094
|
-
detectedLockfile,
|
25095
|
-
detectedPackageManager,
|
25096
|
-
path: newPath
|
25097
|
-
} = getPathOverrideForPackageManager({
|
23496
|
+
const { detectedPackageManager, path: newPath } = getPathOverrideForPackageManager({
|
25098
23497
|
cliType,
|
25099
23498
|
lockfileVersion,
|
25100
23499
|
corepackPackageManager: packageJsonPackageManager,
|
25101
23500
|
nodeVersion,
|
25102
23501
|
corepackEnabled,
|
25103
|
-
packageJsonEngines
|
23502
|
+
packageJsonEngines,
|
23503
|
+
detectedLockfile
|
25104
23504
|
});
|
25105
23505
|
if (corepackEnabled) {
|
25106
23506
|
debug(
|
@@ -25184,9 +23584,14 @@ function getPathOverrideForPackageManager({
|
|
25184
23584
|
lockfileVersion,
|
25185
23585
|
corepackPackageManager,
|
25186
23586
|
corepackEnabled = true,
|
25187
|
-
packageJsonEngines
|
23587
|
+
packageJsonEngines,
|
23588
|
+
detectedLockfile
|
25188
23589
|
}) {
|
25189
|
-
const detectedPackageManger = detectPackageManager(
|
23590
|
+
const detectedPackageManger = detectPackageManager(
|
23591
|
+
cliType,
|
23592
|
+
lockfileVersion,
|
23593
|
+
detectedLockfile
|
23594
|
+
);
|
25190
23595
|
if (!corepackPackageManager || !corepackEnabled) {
|
25191
23596
|
if (cliType === "pnpm" && packageJsonEngines?.pnpm) {
|
25192
23597
|
checkEnginesPnpmAgainstDetected(
|
@@ -25277,7 +23682,7 @@ function validateVersionSpecifier(version) {
|
|
25277
23682
|
packageVersion
|
25278
23683
|
};
|
25279
23684
|
}
|
25280
|
-
function detectPackageManager(cliType, lockfileVersion) {
|
23685
|
+
function detectPackageManager(cliType, lockfileVersion, detectedLockfile) {
|
25281
23686
|
switch (cliType) {
|
25282
23687
|
case "npm":
|
25283
23688
|
return void 0;
|
@@ -25286,21 +23691,21 @@ function detectPackageManager(cliType, lockfileVersion) {
|
|
25286
23691
|
case "pnpm 7":
|
25287
23692
|
return {
|
25288
23693
|
path: "/pnpm7/node_modules/.bin",
|
25289
|
-
detectedLockfile
|
23694
|
+
detectedLockfile,
|
25290
23695
|
detectedPackageManager: "pnpm@7.x",
|
25291
23696
|
pnpmVersionRange: "7.x"
|
25292
23697
|
};
|
25293
23698
|
case "pnpm 8":
|
25294
23699
|
return {
|
25295
23700
|
path: "/pnpm8/node_modules/.bin",
|
25296
|
-
detectedLockfile
|
23701
|
+
detectedLockfile,
|
25297
23702
|
detectedPackageManager: "pnpm@8.x",
|
25298
23703
|
pnpmVersionRange: "8.x"
|
25299
23704
|
};
|
25300
23705
|
case "pnpm 9":
|
25301
23706
|
return {
|
25302
23707
|
path: "/pnpm9/node_modules/.bin",
|
25303
|
-
detectedLockfile
|
23708
|
+
detectedLockfile,
|
25304
23709
|
detectedPackageManager: "pnpm@9.x",
|
25305
23710
|
pnpmVersionRange: "9.x"
|
25306
23711
|
};
|
@@ -25308,7 +23713,7 @@ function detectPackageManager(cliType, lockfileVersion) {
|
|
25308
23713
|
return {
|
25309
23714
|
// undefined because pnpm@6 is the current default in the build container
|
25310
23715
|
path: void 0,
|
25311
|
-
detectedLockfile
|
23716
|
+
detectedLockfile,
|
25312
23717
|
detectedPackageManager: "pnpm@6.x",
|
25313
23718
|
pnpmVersionRange: "6.x"
|
25314
23719
|
};
|
@@ -25318,13 +23723,13 @@ function detectPackageManager(cliType, lockfileVersion) {
|
|
25318
23723
|
case "bun":
|
25319
23724
|
return {
|
25320
23725
|
path: "/bun1",
|
25321
|
-
detectedLockfile
|
23726
|
+
detectedLockfile,
|
25322
23727
|
detectedPackageManager: "bun@1.x"
|
25323
23728
|
};
|
25324
23729
|
case "yarn":
|
25325
23730
|
return {
|
25326
23731
|
path: void 0,
|
25327
|
-
detectedLockfile
|
23732
|
+
detectedLockfile,
|
25328
23733
|
detectedPackageManager: "yarn"
|
25329
23734
|
};
|
25330
23735
|
}
|
@@ -25333,14 +23738,16 @@ function getPathForPackageManager({
|
|
25333
23738
|
cliType,
|
25334
23739
|
lockfileVersion,
|
25335
23740
|
nodeVersion,
|
25336
|
-
env
|
23741
|
+
env,
|
23742
|
+
detectedLockfile
|
25337
23743
|
}) {
|
25338
23744
|
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === "1";
|
25339
23745
|
let overrides = getPathOverrideForPackageManager({
|
25340
23746
|
cliType,
|
25341
23747
|
lockfileVersion,
|
25342
23748
|
corepackPackageManager: void 0,
|
25343
|
-
nodeVersion
|
23749
|
+
nodeVersion,
|
23750
|
+
detectedLockfile
|
25344
23751
|
});
|
25345
23752
|
if (corepackEnabled) {
|
25346
23753
|
overrides = NO_OVERRIDE;
|
@@ -25375,7 +23782,8 @@ async function runCustomInstallCommand({
|
|
25375
23782
|
lockfileVersion,
|
25376
23783
|
packageJson,
|
25377
23784
|
packageJsonPackageManager,
|
25378
|
-
turboSupportsCorepackHome
|
23785
|
+
turboSupportsCorepackHome,
|
23786
|
+
detectedLockfile
|
25379
23787
|
} = await scanParentDirs(destPath, true);
|
25380
23788
|
const env = getEnvForPackageManager({
|
25381
23789
|
cliType,
|
@@ -25384,7 +23792,8 @@ async function runCustomInstallCommand({
|
|
25384
23792
|
nodeVersion,
|
25385
23793
|
env: spawnOpts?.env || {},
|
25386
23794
|
packageJsonEngines: packageJson?.engines,
|
25387
|
-
turboSupportsCorepackHome
|
23795
|
+
turboSupportsCorepackHome,
|
23796
|
+
detectedLockfile
|
25388
23797
|
});
|
25389
23798
|
debug(`Running with $PATH:`, env?.PATH || "");
|
25390
23799
|
await execCommand(installCommand, {
|
@@ -25400,7 +23809,8 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
|
25400
23809
|
cliType,
|
25401
23810
|
lockfileVersion,
|
25402
23811
|
packageJsonPackageManager,
|
25403
|
-
turboSupportsCorepackHome
|
23812
|
+
turboSupportsCorepackHome,
|
23813
|
+
detectedLockfile
|
25404
23814
|
} = await scanParentDirs(destPath, true);
|
25405
23815
|
const scriptName = getScriptName(
|
25406
23816
|
packageJson,
|
@@ -25420,7 +23830,8 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
|
25420
23830
|
nodeVersion: void 0,
|
25421
23831
|
env: cloneEnv(process.env, spawnOpts?.env),
|
25422
23832
|
packageJsonEngines: packageJson?.engines,
|
25423
|
-
turboSupportsCorepackHome
|
23833
|
+
turboSupportsCorepackHome,
|
23834
|
+
detectedLockfile
|
25424
23835
|
})
|
25425
23836
|
};
|
25426
23837
|
if (cliType === "npm") {
|