@prisma/internals 6.5.0-integration-fix-improve-global-omit-api-performance-2.1 → 6.5.0-integration-feat-prisma-config-without-new-package.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{chunk-NXIWDQBF.js → chunk-3ERIN7PH.js} +5 -5
  2. package/dist/{chunk-DS5HCKHK.js → chunk-5YHJX6R5.js} +7 -7
  3. package/dist/{chunk-6AKXEE3K.js → chunk-7O5FFHIL.js} +39 -39
  4. package/dist/{chunk-5BZGQIRH.js → chunk-B2T7C2JL.js} +8 -8
  5. package/dist/{chunk-YQSLYHBD.js → chunk-B54ROTBW.js} +7 -7
  6. package/dist/{chunk-QIVUAERL.js → chunk-GXDYIY4M.js} +1653 -1762
  7. package/dist/{chunk-55RMSBQJ.js → chunk-IZ57EPVG.js} +776 -5
  8. package/dist/{chunk-PSRK3GOS.js → chunk-JX5PFYOK.js} +39 -39
  9. package/dist/{chunk-G4BGJ6IP.js → chunk-KTBNIQ7N.js} +5 -5
  10. package/dist/{chunk-NHZG6MK7.js → chunk-L53223TR.js} +5 -5
  11. package/dist/{chunk-2U63YW74.js → chunk-M7VRN7HH.js} +8 -8
  12. package/dist/{chunk-ANCBOVIA.js → chunk-MVKD2LHS.js} +5 -5
  13. package/dist/{chunk-5XRQ7ONW.js → chunk-NJQWZ447.js} +5 -5
  14. package/dist/{chunk-56FTTMLX.js → chunk-NSE42XEI.js} +5 -5
  15. package/dist/{chunk-J53VD5LH.js → chunk-NVEWQYAH.js} +8 -8
  16. package/dist/{chunk-HNZLVWYH.js → chunk-OXS2BTCM.js} +5 -5
  17. package/dist/{chunk-HL5OYK7A.js → chunk-PVYHFQQG.js} +8 -8
  18. package/dist/{chunk-WQXRNCPP.js → chunk-R3D6TBV3.js} +5 -5
  19. package/dist/{chunk-TD2E3EDZ.js → chunk-RSAJ2QNB.js} +7 -7
  20. package/dist/{chunk-OYLZC5OV.js → chunk-TATYN3T2.js} +7 -7
  21. package/dist/{chunk-YSTRHGMU.js → chunk-TTPEDDRA.js} +5 -5
  22. package/dist/{chunk-K2RINR4Y.js → chunk-XHDNML25.js} +8 -8
  23. package/dist/{chunk-IWJ2BUYF.js → chunk-XLGODPZH.js} +5 -5
  24. package/dist/{chunk-36ZP4IMY.js → chunk-XWDLLYWX.js} +5 -5
  25. package/dist/{chunk-LK7U6TVK.js → chunk-ZDVVJKE3.js} +5 -5
  26. package/dist/{chunk-IYFPIGGM.js → chunk-ZLVVUJ3P.js} +8 -8
  27. package/dist/{chunk-4AIOCFJV.js → chunk-ZYIJBRFI.js} +6 -6
  28. package/dist/cli/checkUnsupportedDataProxy.js +19 -20
  29. package/dist/cli/getSchema.js +23 -24
  30. package/dist/cli/hashes.js +19 -20
  31. package/dist/engine-commands/errorHelpers.js +4 -4
  32. package/dist/engine-commands/formatSchema.js +18 -19
  33. package/dist/engine-commands/getConfig.js +10 -10
  34. package/dist/engine-commands/getDmmf.js +7 -7
  35. package/dist/engine-commands/getEngineVersion.js +5 -6
  36. package/dist/engine-commands/getEnginesMetaInfo.js +7 -8
  37. package/dist/engine-commands/index.js +29 -30
  38. package/dist/engine-commands/lintSchema.js +8 -8
  39. package/dist/engine-commands/mergeSchemas.js +7 -7
  40. package/dist/engine-commands/validate.js +7 -7
  41. package/dist/get-generators/generatorResolvers/generatorResolvers.js +18 -19
  42. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +18 -19
  43. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +19 -20
  44. package/dist/get-generators/getGenerators.js +21 -22
  45. package/dist/get-generators/utils/getBinaryPathsByVersion.js +3 -4
  46. package/dist/getPackedPackage.js +2 -3
  47. package/dist/index.js +56 -57
  48. package/dist/resolveBinary.js +7 -8
  49. package/dist/schemaEngineCommands.js +8 -9
  50. package/dist/sendPanic.js +18 -19
  51. package/dist/utils/getEnvPaths.js +18 -19
  52. package/dist/utils/getVersionFromPackageJson.js +3 -3
  53. package/dist/utils/handlePanic.js +18 -19
  54. package/dist/utils/loadEnvFile.js +18 -19
  55. package/dist/wasm.js +4 -4
  56. package/package.json +11 -11
  57. package/dist/chunk-H4J2FN2W.js +0 -796
@@ -1,796 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_H4J2FN2W_exports = {};
20
- __export(chunk_H4J2FN2W_exports, {
21
- require_graceful_fs: () => require_graceful_fs
22
- });
23
- module.exports = __toCommonJS(chunk_H4J2FN2W_exports);
24
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
25
- var require_polyfills = (0, import_chunk_WWAWV7DQ.__commonJS)({
26
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js"(exports, module2) {
27
- "use strict";
28
- var constants = (0, import_chunk_WWAWV7DQ.__require)("constants");
29
- var origCwd = process.cwd;
30
- var cwd = null;
31
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
32
- process.cwd = function() {
33
- if (!cwd)
34
- cwd = origCwd.call(process);
35
- return cwd;
36
- };
37
- try {
38
- process.cwd();
39
- } catch (er) {
40
- }
41
- if (typeof process.chdir === "function") {
42
- chdir = process.chdir;
43
- process.chdir = function(d) {
44
- cwd = null;
45
- chdir.call(process, d);
46
- };
47
- if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
48
- }
49
- var chdir;
50
- module2.exports = patch;
51
- function patch(fs) {
52
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
53
- patchLchmod(fs);
54
- }
55
- if (!fs.lutimes) {
56
- patchLutimes(fs);
57
- }
58
- fs.chown = chownFix(fs.chown);
59
- fs.fchown = chownFix(fs.fchown);
60
- fs.lchown = chownFix(fs.lchown);
61
- fs.chmod = chmodFix(fs.chmod);
62
- fs.fchmod = chmodFix(fs.fchmod);
63
- fs.lchmod = chmodFix(fs.lchmod);
64
- fs.chownSync = chownFixSync(fs.chownSync);
65
- fs.fchownSync = chownFixSync(fs.fchownSync);
66
- fs.lchownSync = chownFixSync(fs.lchownSync);
67
- fs.chmodSync = chmodFixSync(fs.chmodSync);
68
- fs.fchmodSync = chmodFixSync(fs.fchmodSync);
69
- fs.lchmodSync = chmodFixSync(fs.lchmodSync);
70
- fs.stat = statFix(fs.stat);
71
- fs.fstat = statFix(fs.fstat);
72
- fs.lstat = statFix(fs.lstat);
73
- fs.statSync = statFixSync(fs.statSync);
74
- fs.fstatSync = statFixSync(fs.fstatSync);
75
- fs.lstatSync = statFixSync(fs.lstatSync);
76
- if (fs.chmod && !fs.lchmod) {
77
- fs.lchmod = function(path, mode, cb) {
78
- if (cb) process.nextTick(cb);
79
- };
80
- fs.lchmodSync = function() {
81
- };
82
- }
83
- if (fs.chown && !fs.lchown) {
84
- fs.lchown = function(path, uid, gid, cb) {
85
- if (cb) process.nextTick(cb);
86
- };
87
- fs.lchownSync = function() {
88
- };
89
- }
90
- if (platform === "win32") {
91
- fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
92
- function rename(from, to, cb) {
93
- var start = Date.now();
94
- var backoff = 0;
95
- fs$rename(from, to, function CB(er) {
96
- if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
97
- setTimeout(function() {
98
- fs.stat(to, function(stater, st) {
99
- if (stater && stater.code === "ENOENT")
100
- fs$rename(from, to, CB);
101
- else
102
- cb(er);
103
- });
104
- }, backoff);
105
- if (backoff < 100)
106
- backoff += 10;
107
- return;
108
- }
109
- if (cb) cb(er);
110
- });
111
- }
112
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
113
- return rename;
114
- }(fs.rename);
115
- }
116
- fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
117
- function read(fd, buffer, offset, length, position, callback_) {
118
- var callback;
119
- if (callback_ && typeof callback_ === "function") {
120
- var eagCounter = 0;
121
- callback = function(er, _, __) {
122
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
123
- eagCounter++;
124
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
125
- }
126
- callback_.apply(this, arguments);
127
- };
128
- }
129
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
130
- }
131
- if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
132
- return read;
133
- }(fs.read);
134
- fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) {
135
- return function(fd, buffer, offset, length, position) {
136
- var eagCounter = 0;
137
- while (true) {
138
- try {
139
- return fs$readSync.call(fs, fd, buffer, offset, length, position);
140
- } catch (er) {
141
- if (er.code === "EAGAIN" && eagCounter < 10) {
142
- eagCounter++;
143
- continue;
144
- }
145
- throw er;
146
- }
147
- }
148
- };
149
- }(fs.readSync);
150
- function patchLchmod(fs2) {
151
- fs2.lchmod = function(path, mode, callback) {
152
- fs2.open(
153
- path,
154
- constants.O_WRONLY | constants.O_SYMLINK,
155
- mode,
156
- function(err, fd) {
157
- if (err) {
158
- if (callback) callback(err);
159
- return;
160
- }
161
- fs2.fchmod(fd, mode, function(err2) {
162
- fs2.close(fd, function(err22) {
163
- if (callback) callback(err2 || err22);
164
- });
165
- });
166
- }
167
- );
168
- };
169
- fs2.lchmodSync = function(path, mode) {
170
- var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
171
- var threw = true;
172
- var ret;
173
- try {
174
- ret = fs2.fchmodSync(fd, mode);
175
- threw = false;
176
- } finally {
177
- if (threw) {
178
- try {
179
- fs2.closeSync(fd);
180
- } catch (er) {
181
- }
182
- } else {
183
- fs2.closeSync(fd);
184
- }
185
- }
186
- return ret;
187
- };
188
- }
189
- function patchLutimes(fs2) {
190
- if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
191
- fs2.lutimes = function(path, at, mt, cb) {
192
- fs2.open(path, constants.O_SYMLINK, function(er, fd) {
193
- if (er) {
194
- if (cb) cb(er);
195
- return;
196
- }
197
- fs2.futimes(fd, at, mt, function(er2) {
198
- fs2.close(fd, function(er22) {
199
- if (cb) cb(er2 || er22);
200
- });
201
- });
202
- });
203
- };
204
- fs2.lutimesSync = function(path, at, mt) {
205
- var fd = fs2.openSync(path, constants.O_SYMLINK);
206
- var ret;
207
- var threw = true;
208
- try {
209
- ret = fs2.futimesSync(fd, at, mt);
210
- threw = false;
211
- } finally {
212
- if (threw) {
213
- try {
214
- fs2.closeSync(fd);
215
- } catch (er) {
216
- }
217
- } else {
218
- fs2.closeSync(fd);
219
- }
220
- }
221
- return ret;
222
- };
223
- } else if (fs2.futimes) {
224
- fs2.lutimes = function(_a, _b, _c, cb) {
225
- if (cb) process.nextTick(cb);
226
- };
227
- fs2.lutimesSync = function() {
228
- };
229
- }
230
- }
231
- function chmodFix(orig) {
232
- if (!orig) return orig;
233
- return function(target, mode, cb) {
234
- return orig.call(fs, target, mode, function(er) {
235
- if (chownErOk(er)) er = null;
236
- if (cb) cb.apply(this, arguments);
237
- });
238
- };
239
- }
240
- function chmodFixSync(orig) {
241
- if (!orig) return orig;
242
- return function(target, mode) {
243
- try {
244
- return orig.call(fs, target, mode);
245
- } catch (er) {
246
- if (!chownErOk(er)) throw er;
247
- }
248
- };
249
- }
250
- function chownFix(orig) {
251
- if (!orig) return orig;
252
- return function(target, uid, gid, cb) {
253
- return orig.call(fs, target, uid, gid, function(er) {
254
- if (chownErOk(er)) er = null;
255
- if (cb) cb.apply(this, arguments);
256
- });
257
- };
258
- }
259
- function chownFixSync(orig) {
260
- if (!orig) return orig;
261
- return function(target, uid, gid) {
262
- try {
263
- return orig.call(fs, target, uid, gid);
264
- } catch (er) {
265
- if (!chownErOk(er)) throw er;
266
- }
267
- };
268
- }
269
- function statFix(orig) {
270
- if (!orig) return orig;
271
- return function(target, options, cb) {
272
- if (typeof options === "function") {
273
- cb = options;
274
- options = null;
275
- }
276
- function callback(er, stats) {
277
- if (stats) {
278
- if (stats.uid < 0) stats.uid += 4294967296;
279
- if (stats.gid < 0) stats.gid += 4294967296;
280
- }
281
- if (cb) cb.apply(this, arguments);
282
- }
283
- return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
284
- };
285
- }
286
- function statFixSync(orig) {
287
- if (!orig) return orig;
288
- return function(target, options) {
289
- var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
290
- if (stats) {
291
- if (stats.uid < 0) stats.uid += 4294967296;
292
- if (stats.gid < 0) stats.gid += 4294967296;
293
- }
294
- return stats;
295
- };
296
- }
297
- function chownErOk(er) {
298
- if (!er)
299
- return true;
300
- if (er.code === "ENOSYS")
301
- return true;
302
- var nonroot = !process.getuid || process.getuid() !== 0;
303
- if (nonroot) {
304
- if (er.code === "EINVAL" || er.code === "EPERM")
305
- return true;
306
- }
307
- return false;
308
- }
309
- }
310
- }
311
- });
312
- var require_legacy_streams = (0, import_chunk_WWAWV7DQ.__commonJS)({
313
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
314
- "use strict";
315
- var Stream = (0, import_chunk_WWAWV7DQ.__require)("stream").Stream;
316
- module2.exports = legacy;
317
- function legacy(fs) {
318
- return {
319
- ReadStream,
320
- WriteStream
321
- };
322
- function ReadStream(path, options) {
323
- if (!(this instanceof ReadStream)) return new ReadStream(path, options);
324
- Stream.call(this);
325
- var self = this;
326
- this.path = path;
327
- this.fd = null;
328
- this.readable = true;
329
- this.paused = false;
330
- this.flags = "r";
331
- this.mode = 438;
332
- this.bufferSize = 64 * 1024;
333
- options = options || {};
334
- var keys = Object.keys(options);
335
- for (var index = 0, length = keys.length; index < length; index++) {
336
- var key = keys[index];
337
- this[key] = options[key];
338
- }
339
- if (this.encoding) this.setEncoding(this.encoding);
340
- if (this.start !== void 0) {
341
- if ("number" !== typeof this.start) {
342
- throw TypeError("start must be a Number");
343
- }
344
- if (this.end === void 0) {
345
- this.end = Infinity;
346
- } else if ("number" !== typeof this.end) {
347
- throw TypeError("end must be a Number");
348
- }
349
- if (this.start > this.end) {
350
- throw new Error("start must be <= end");
351
- }
352
- this.pos = this.start;
353
- }
354
- if (this.fd !== null) {
355
- process.nextTick(function() {
356
- self._read();
357
- });
358
- return;
359
- }
360
- fs.open(this.path, this.flags, this.mode, function(err, fd) {
361
- if (err) {
362
- self.emit("error", err);
363
- self.readable = false;
364
- return;
365
- }
366
- self.fd = fd;
367
- self.emit("open", fd);
368
- self._read();
369
- });
370
- }
371
- function WriteStream(path, options) {
372
- if (!(this instanceof WriteStream)) return new WriteStream(path, options);
373
- Stream.call(this);
374
- this.path = path;
375
- this.fd = null;
376
- this.writable = true;
377
- this.flags = "w";
378
- this.encoding = "binary";
379
- this.mode = 438;
380
- this.bytesWritten = 0;
381
- options = options || {};
382
- var keys = Object.keys(options);
383
- for (var index = 0, length = keys.length; index < length; index++) {
384
- var key = keys[index];
385
- this[key] = options[key];
386
- }
387
- if (this.start !== void 0) {
388
- if ("number" !== typeof this.start) {
389
- throw TypeError("start must be a Number");
390
- }
391
- if (this.start < 0) {
392
- throw new Error("start must be >= zero");
393
- }
394
- this.pos = this.start;
395
- }
396
- this.busy = false;
397
- this._queue = [];
398
- if (this.fd === null) {
399
- this._open = fs.open;
400
- this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
401
- this.flush();
402
- }
403
- }
404
- }
405
- }
406
- });
407
- var require_clone = (0, import_chunk_WWAWV7DQ.__commonJS)({
408
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js"(exports, module2) {
409
- "use strict";
410
- module2.exports = clone;
411
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
412
- return obj.__proto__;
413
- };
414
- function clone(obj) {
415
- if (obj === null || typeof obj !== "object")
416
- return obj;
417
- if (obj instanceof Object)
418
- var copy = { __proto__: getPrototypeOf(obj) };
419
- else
420
- var copy = /* @__PURE__ */ Object.create(null);
421
- Object.getOwnPropertyNames(obj).forEach(function(key) {
422
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
423
- });
424
- return copy;
425
- }
426
- }
427
- });
428
- var require_graceful_fs = (0, import_chunk_WWAWV7DQ.__commonJS)({
429
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
430
- "use strict";
431
- var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
432
- var polyfills = require_polyfills();
433
- var legacy = require_legacy_streams();
434
- var clone = require_clone();
435
- var util = (0, import_chunk_WWAWV7DQ.__require)("util");
436
- var gracefulQueue;
437
- var previousSymbol;
438
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
439
- gracefulQueue = Symbol.for("graceful-fs.queue");
440
- previousSymbol = Symbol.for("graceful-fs.previous");
441
- } else {
442
- gracefulQueue = "___graceful-fs.queue";
443
- previousSymbol = "___graceful-fs.previous";
444
- }
445
- function noop() {
446
- }
447
- function publishQueue(context, queue2) {
448
- Object.defineProperty(context, gracefulQueue, {
449
- get: function() {
450
- return queue2;
451
- }
452
- });
453
- }
454
- var debug = noop;
455
- if (util.debuglog)
456
- debug = util.debuglog("gfs4");
457
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
458
- debug = function() {
459
- var m = util.format.apply(util, arguments);
460
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
461
- console.error(m);
462
- };
463
- if (!fs[gracefulQueue]) {
464
- queue = global[gracefulQueue] || [];
465
- publishQueue(fs, queue);
466
- fs.close = function(fs$close) {
467
- function close(fd, cb) {
468
- return fs$close.call(fs, fd, function(err) {
469
- if (!err) {
470
- resetQueue();
471
- }
472
- if (typeof cb === "function")
473
- cb.apply(this, arguments);
474
- });
475
- }
476
- Object.defineProperty(close, previousSymbol, {
477
- value: fs$close
478
- });
479
- return close;
480
- }(fs.close);
481
- fs.closeSync = function(fs$closeSync) {
482
- function closeSync(fd) {
483
- fs$closeSync.apply(fs, arguments);
484
- resetQueue();
485
- }
486
- Object.defineProperty(closeSync, previousSymbol, {
487
- value: fs$closeSync
488
- });
489
- return closeSync;
490
- }(fs.closeSync);
491
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
492
- process.on("exit", function() {
493
- debug(fs[gracefulQueue]);
494
- (0, import_chunk_WWAWV7DQ.__require)("assert").equal(fs[gracefulQueue].length, 0);
495
- });
496
- }
497
- }
498
- var queue;
499
- if (!global[gracefulQueue]) {
500
- publishQueue(global, fs[gracefulQueue]);
501
- }
502
- module2.exports = patch(clone(fs));
503
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
504
- module2.exports = patch(fs);
505
- fs.__patched = true;
506
- }
507
- function patch(fs2) {
508
- polyfills(fs2);
509
- fs2.gracefulify = patch;
510
- fs2.createReadStream = createReadStream;
511
- fs2.createWriteStream = createWriteStream;
512
- var fs$readFile = fs2.readFile;
513
- fs2.readFile = readFile;
514
- function readFile(path, options, cb) {
515
- if (typeof options === "function")
516
- cb = options, options = null;
517
- return go$readFile(path, options, cb);
518
- function go$readFile(path2, options2, cb2, startTime) {
519
- return fs$readFile(path2, options2, function(err) {
520
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
521
- enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]);
522
- else {
523
- if (typeof cb2 === "function")
524
- cb2.apply(this, arguments);
525
- }
526
- });
527
- }
528
- }
529
- var fs$writeFile = fs2.writeFile;
530
- fs2.writeFile = writeFile;
531
- function writeFile(path, data, options, cb) {
532
- if (typeof options === "function")
533
- cb = options, options = null;
534
- return go$writeFile(path, data, options, cb);
535
- function go$writeFile(path2, data2, options2, cb2, startTime) {
536
- return fs$writeFile(path2, data2, options2, function(err) {
537
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
538
- enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
539
- else {
540
- if (typeof cb2 === "function")
541
- cb2.apply(this, arguments);
542
- }
543
- });
544
- }
545
- }
546
- var fs$appendFile = fs2.appendFile;
547
- if (fs$appendFile)
548
- fs2.appendFile = appendFile;
549
- function appendFile(path, data, options, cb) {
550
- if (typeof options === "function")
551
- cb = options, options = null;
552
- return go$appendFile(path, data, options, cb);
553
- function go$appendFile(path2, data2, options2, cb2, startTime) {
554
- return fs$appendFile(path2, data2, options2, function(err) {
555
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
556
- enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
557
- else {
558
- if (typeof cb2 === "function")
559
- cb2.apply(this, arguments);
560
- }
561
- });
562
- }
563
- }
564
- var fs$copyFile = fs2.copyFile;
565
- if (fs$copyFile)
566
- fs2.copyFile = copyFile;
567
- function copyFile(src, dest, flags, cb) {
568
- if (typeof flags === "function") {
569
- cb = flags;
570
- flags = 0;
571
- }
572
- return go$copyFile(src, dest, flags, cb);
573
- function go$copyFile(src2, dest2, flags2, cb2, startTime) {
574
- return fs$copyFile(src2, dest2, flags2, function(err) {
575
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
576
- enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
577
- else {
578
- if (typeof cb2 === "function")
579
- cb2.apply(this, arguments);
580
- }
581
- });
582
- }
583
- }
584
- var fs$readdir = fs2.readdir;
585
- fs2.readdir = readdir;
586
- var noReaddirOptionVersions = /^v[0-5]\./;
587
- function readdir(path, options, cb) {
588
- if (typeof options === "function")
589
- cb = options, options = null;
590
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) {
591
- return fs$readdir(path2, fs$readdirCallback(
592
- path2,
593
- options2,
594
- cb2,
595
- startTime
596
- ));
597
- } : function go$readdir2(path2, options2, cb2, startTime) {
598
- return fs$readdir(path2, options2, fs$readdirCallback(
599
- path2,
600
- options2,
601
- cb2,
602
- startTime
603
- ));
604
- };
605
- return go$readdir(path, options, cb);
606
- function fs$readdirCallback(path2, options2, cb2, startTime) {
607
- return function(err, files) {
608
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
609
- enqueue([
610
- go$readdir,
611
- [path2, options2, cb2],
612
- err,
613
- startTime || Date.now(),
614
- Date.now()
615
- ]);
616
- else {
617
- if (files && files.sort)
618
- files.sort();
619
- if (typeof cb2 === "function")
620
- cb2.call(this, err, files);
621
- }
622
- };
623
- }
624
- }
625
- if (process.version.substr(0, 4) === "v0.8") {
626
- var legStreams = legacy(fs2);
627
- ReadStream = legStreams.ReadStream;
628
- WriteStream = legStreams.WriteStream;
629
- }
630
- var fs$ReadStream = fs2.ReadStream;
631
- if (fs$ReadStream) {
632
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
633
- ReadStream.prototype.open = ReadStream$open;
634
- }
635
- var fs$WriteStream = fs2.WriteStream;
636
- if (fs$WriteStream) {
637
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
638
- WriteStream.prototype.open = WriteStream$open;
639
- }
640
- Object.defineProperty(fs2, "ReadStream", {
641
- get: function() {
642
- return ReadStream;
643
- },
644
- set: function(val) {
645
- ReadStream = val;
646
- },
647
- enumerable: true,
648
- configurable: true
649
- });
650
- Object.defineProperty(fs2, "WriteStream", {
651
- get: function() {
652
- return WriteStream;
653
- },
654
- set: function(val) {
655
- WriteStream = val;
656
- },
657
- enumerable: true,
658
- configurable: true
659
- });
660
- var FileReadStream = ReadStream;
661
- Object.defineProperty(fs2, "FileReadStream", {
662
- get: function() {
663
- return FileReadStream;
664
- },
665
- set: function(val) {
666
- FileReadStream = val;
667
- },
668
- enumerable: true,
669
- configurable: true
670
- });
671
- var FileWriteStream = WriteStream;
672
- Object.defineProperty(fs2, "FileWriteStream", {
673
- get: function() {
674
- return FileWriteStream;
675
- },
676
- set: function(val) {
677
- FileWriteStream = val;
678
- },
679
- enumerable: true,
680
- configurable: true
681
- });
682
- function ReadStream(path, options) {
683
- if (this instanceof ReadStream)
684
- return fs$ReadStream.apply(this, arguments), this;
685
- else
686
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
687
- }
688
- function ReadStream$open() {
689
- var that = this;
690
- open(that.path, that.flags, that.mode, function(err, fd) {
691
- if (err) {
692
- if (that.autoClose)
693
- that.destroy();
694
- that.emit("error", err);
695
- } else {
696
- that.fd = fd;
697
- that.emit("open", fd);
698
- that.read();
699
- }
700
- });
701
- }
702
- function WriteStream(path, options) {
703
- if (this instanceof WriteStream)
704
- return fs$WriteStream.apply(this, arguments), this;
705
- else
706
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
707
- }
708
- function WriteStream$open() {
709
- var that = this;
710
- open(that.path, that.flags, that.mode, function(err, fd) {
711
- if (err) {
712
- that.destroy();
713
- that.emit("error", err);
714
- } else {
715
- that.fd = fd;
716
- that.emit("open", fd);
717
- }
718
- });
719
- }
720
- function createReadStream(path, options) {
721
- return new fs2.ReadStream(path, options);
722
- }
723
- function createWriteStream(path, options) {
724
- return new fs2.WriteStream(path, options);
725
- }
726
- var fs$open = fs2.open;
727
- fs2.open = open;
728
- function open(path, flags, mode, cb) {
729
- if (typeof mode === "function")
730
- cb = mode, mode = null;
731
- return go$open(path, flags, mode, cb);
732
- function go$open(path2, flags2, mode2, cb2, startTime) {
733
- return fs$open(path2, flags2, mode2, function(err, fd) {
734
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
735
- enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
736
- else {
737
- if (typeof cb2 === "function")
738
- cb2.apply(this, arguments);
739
- }
740
- });
741
- }
742
- }
743
- return fs2;
744
- }
745
- function enqueue(elem) {
746
- debug("ENQUEUE", elem[0].name, elem[1]);
747
- fs[gracefulQueue].push(elem);
748
- retry();
749
- }
750
- var retryTimer;
751
- function resetQueue() {
752
- var now = Date.now();
753
- for (var i = 0; i < fs[gracefulQueue].length; ++i) {
754
- if (fs[gracefulQueue][i].length > 2) {
755
- fs[gracefulQueue][i][3] = now;
756
- fs[gracefulQueue][i][4] = now;
757
- }
758
- }
759
- retry();
760
- }
761
- function retry() {
762
- clearTimeout(retryTimer);
763
- retryTimer = void 0;
764
- if (fs[gracefulQueue].length === 0)
765
- return;
766
- var elem = fs[gracefulQueue].shift();
767
- var fn = elem[0];
768
- var args = elem[1];
769
- var err = elem[2];
770
- var startTime = elem[3];
771
- var lastTime = elem[4];
772
- if (startTime === void 0) {
773
- debug("RETRY", fn.name, args);
774
- fn.apply(null, args);
775
- } else if (Date.now() - startTime >= 6e4) {
776
- debug("TIMEOUT", fn.name, args);
777
- var cb = args.pop();
778
- if (typeof cb === "function")
779
- cb.call(null, err);
780
- } else {
781
- var sinceAttempt = Date.now() - lastTime;
782
- var sinceStart = Math.max(lastTime - startTime, 1);
783
- var desiredDelay = Math.min(sinceStart * 1.2, 100);
784
- if (sinceAttempt >= desiredDelay) {
785
- debug("RETRY", fn.name, args);
786
- fn.apply(null, args.concat([startTime]));
787
- } else {
788
- fs[gracefulQueue].push(elem);
789
- }
790
- }
791
- if (retryTimer === void 0) {
792
- retryTimer = setTimeout(retry, 0);
793
- }
794
- }
795
- }
796
- });