unplugin-https-reverse-proxy 1.0.0-beta.14 → 1.0.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nuxt.cjs CHANGED
@@ -1,30 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __commonJS = (cb, mod) => function __require() {
26
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
27
- };
28
8
  var __export = (target, all) => {
29
9
  for (var name in all)
30
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -47,1619 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
47
27
  ));
48
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
49
29
 
50
- // node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
51
- var require_polyfills = __commonJS({
52
- "node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
53
- "use strict";
54
- var constants = require("constants");
55
- var origCwd = process.cwd;
56
- var cwd2 = null;
57
- var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
58
- process.cwd = function() {
59
- if (!cwd2)
60
- cwd2 = origCwd.call(process);
61
- return cwd2;
62
- };
63
- try {
64
- process.cwd();
65
- } catch (er) {
66
- }
67
- if (typeof process.chdir === "function") {
68
- chdir = process.chdir;
69
- process.chdir = function(d) {
70
- cwd2 = null;
71
- chdir.call(process, d);
72
- };
73
- if (Object.setPrototypeOf)
74
- Object.setPrototypeOf(process.chdir, chdir);
75
- }
76
- var chdir;
77
- module2.exports = patch;
78
- function patch(fs) {
79
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
80
- patchLchmod(fs);
81
- }
82
- if (!fs.lutimes) {
83
- patchLutimes(fs);
84
- }
85
- fs.chown = chownFix(fs.chown);
86
- fs.fchown = chownFix(fs.fchown);
87
- fs.lchown = chownFix(fs.lchown);
88
- fs.chmod = chmodFix(fs.chmod);
89
- fs.fchmod = chmodFix(fs.fchmod);
90
- fs.lchmod = chmodFix(fs.lchmod);
91
- fs.chownSync = chownFixSync(fs.chownSync);
92
- fs.fchownSync = chownFixSync(fs.fchownSync);
93
- fs.lchownSync = chownFixSync(fs.lchownSync);
94
- fs.chmodSync = chmodFixSync(fs.chmodSync);
95
- fs.fchmodSync = chmodFixSync(fs.fchmodSync);
96
- fs.lchmodSync = chmodFixSync(fs.lchmodSync);
97
- fs.stat = statFix(fs.stat);
98
- fs.fstat = statFix(fs.fstat);
99
- fs.lstat = statFix(fs.lstat);
100
- fs.statSync = statFixSync(fs.statSync);
101
- fs.fstatSync = statFixSync(fs.fstatSync);
102
- fs.lstatSync = statFixSync(fs.lstatSync);
103
- if (fs.chmod && !fs.lchmod) {
104
- fs.lchmod = function(path2, mode, cb) {
105
- if (cb)
106
- process.nextTick(cb);
107
- };
108
- fs.lchmodSync = function() {
109
- };
110
- }
111
- if (fs.chown && !fs.lchown) {
112
- fs.lchown = function(path2, uid, gid, cb) {
113
- if (cb)
114
- process.nextTick(cb);
115
- };
116
- fs.lchownSync = function() {
117
- };
118
- }
119
- if (platform2 === "win32") {
120
- fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
121
- function rename(from, to, cb) {
122
- var start = Date.now();
123
- var backoff = 0;
124
- fs$rename(from, to, function CB(er) {
125
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
126
- setTimeout(function() {
127
- fs.stat(to, function(stater, st) {
128
- if (stater && stater.code === "ENOENT")
129
- fs$rename(from, to, CB);
130
- else
131
- cb(er);
132
- });
133
- }, backoff);
134
- if (backoff < 100)
135
- backoff += 10;
136
- return;
137
- }
138
- if (cb)
139
- cb(er);
140
- });
141
- }
142
- if (Object.setPrototypeOf)
143
- Object.setPrototypeOf(rename, fs$rename);
144
- return rename;
145
- }(fs.rename);
146
- }
147
- fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
148
- function read(fd, buffer, offset, length, position, callback_) {
149
- var callback;
150
- if (callback_ && typeof callback_ === "function") {
151
- var eagCounter = 0;
152
- callback = function(er, _, __) {
153
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
154
- eagCounter++;
155
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
156
- }
157
- callback_.apply(this, arguments);
158
- };
159
- }
160
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
161
- }
162
- if (Object.setPrototypeOf)
163
- Object.setPrototypeOf(read, fs$read);
164
- return read;
165
- }(fs.read);
166
- fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) {
167
- return function(fd, buffer, offset, length, position) {
168
- var eagCounter = 0;
169
- while (true) {
170
- try {
171
- return fs$readSync.call(fs, fd, buffer, offset, length, position);
172
- } catch (er) {
173
- if (er.code === "EAGAIN" && eagCounter < 10) {
174
- eagCounter++;
175
- continue;
176
- }
177
- throw er;
178
- }
179
- }
180
- };
181
- }(fs.readSync);
182
- function patchLchmod(fs2) {
183
- fs2.lchmod = function(path2, mode, callback) {
184
- fs2.open(
185
- path2,
186
- constants.O_WRONLY | constants.O_SYMLINK,
187
- mode,
188
- function(err, fd) {
189
- if (err) {
190
- if (callback)
191
- callback(err);
192
- return;
193
- }
194
- fs2.fchmod(fd, mode, function(err2) {
195
- fs2.close(fd, function(err22) {
196
- if (callback)
197
- callback(err2 || err22);
198
- });
199
- });
200
- }
201
- );
202
- };
203
- fs2.lchmodSync = function(path2, mode) {
204
- var fd = fs2.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode);
205
- var threw = true;
206
- var ret;
207
- try {
208
- ret = fs2.fchmodSync(fd, mode);
209
- threw = false;
210
- } finally {
211
- if (threw) {
212
- try {
213
- fs2.closeSync(fd);
214
- } catch (er) {
215
- }
216
- } else {
217
- fs2.closeSync(fd);
218
- }
219
- }
220
- return ret;
221
- };
222
- }
223
- function patchLutimes(fs2) {
224
- if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
225
- fs2.lutimes = function(path2, at, mt, cb) {
226
- fs2.open(path2, constants.O_SYMLINK, function(er, fd) {
227
- if (er) {
228
- if (cb)
229
- cb(er);
230
- return;
231
- }
232
- fs2.futimes(fd, at, mt, function(er2) {
233
- fs2.close(fd, function(er22) {
234
- if (cb)
235
- cb(er2 || er22);
236
- });
237
- });
238
- });
239
- };
240
- fs2.lutimesSync = function(path2, at, mt) {
241
- var fd = fs2.openSync(path2, constants.O_SYMLINK);
242
- var ret;
243
- var threw = true;
244
- try {
245
- ret = fs2.futimesSync(fd, at, mt);
246
- threw = false;
247
- } finally {
248
- if (threw) {
249
- try {
250
- fs2.closeSync(fd);
251
- } catch (er) {
252
- }
253
- } else {
254
- fs2.closeSync(fd);
255
- }
256
- }
257
- return ret;
258
- };
259
- } else if (fs2.futimes) {
260
- fs2.lutimes = function(_a, _b, _c, cb) {
261
- if (cb)
262
- process.nextTick(cb);
263
- };
264
- fs2.lutimesSync = function() {
265
- };
266
- }
267
- }
268
- function chmodFix(orig) {
269
- if (!orig)
270
- return orig;
271
- return function(target, mode, cb) {
272
- return orig.call(fs, target, mode, function(er) {
273
- if (chownErOk(er))
274
- er = null;
275
- if (cb)
276
- cb.apply(this, arguments);
277
- });
278
- };
279
- }
280
- function chmodFixSync(orig) {
281
- if (!orig)
282
- return orig;
283
- return function(target, mode) {
284
- try {
285
- return orig.call(fs, target, mode);
286
- } catch (er) {
287
- if (!chownErOk(er))
288
- throw er;
289
- }
290
- };
291
- }
292
- function chownFix(orig) {
293
- if (!orig)
294
- return orig;
295
- return function(target, uid, gid, cb) {
296
- return orig.call(fs, target, uid, gid, function(er) {
297
- if (chownErOk(er))
298
- er = null;
299
- if (cb)
300
- cb.apply(this, arguments);
301
- });
302
- };
303
- }
304
- function chownFixSync(orig) {
305
- if (!orig)
306
- return orig;
307
- return function(target, uid, gid) {
308
- try {
309
- return orig.call(fs, target, uid, gid);
310
- } catch (er) {
311
- if (!chownErOk(er))
312
- throw er;
313
- }
314
- };
315
- }
316
- function statFix(orig) {
317
- if (!orig)
318
- return orig;
319
- return function(target, options, cb) {
320
- if (typeof options === "function") {
321
- cb = options;
322
- options = null;
323
- }
324
- function callback(er, stats) {
325
- if (stats) {
326
- if (stats.uid < 0)
327
- stats.uid += 4294967296;
328
- if (stats.gid < 0)
329
- stats.gid += 4294967296;
330
- }
331
- if (cb)
332
- cb.apply(this, arguments);
333
- }
334
- return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
335
- };
336
- }
337
- function statFixSync(orig) {
338
- if (!orig)
339
- return orig;
340
- return function(target, options) {
341
- var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
342
- if (stats) {
343
- if (stats.uid < 0)
344
- stats.uid += 4294967296;
345
- if (stats.gid < 0)
346
- stats.gid += 4294967296;
347
- }
348
- return stats;
349
- };
350
- }
351
- function chownErOk(er) {
352
- if (!er)
353
- return true;
354
- if (er.code === "ENOSYS")
355
- return true;
356
- var nonroot = !process.getuid || process.getuid() !== 0;
357
- if (nonroot) {
358
- if (er.code === "EINVAL" || er.code === "EPERM")
359
- return true;
360
- }
361
- return false;
362
- }
363
- }
364
- }
365
- });
366
-
367
- // node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
368
- var require_legacy_streams = __commonJS({
369
- "node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
370
- "use strict";
371
- var Stream = require("stream").Stream;
372
- module2.exports = legacy;
373
- function legacy(fs) {
374
- return {
375
- ReadStream,
376
- WriteStream
377
- };
378
- function ReadStream(path2, options) {
379
- if (!(this instanceof ReadStream))
380
- return new ReadStream(path2, options);
381
- Stream.call(this);
382
- var self = this;
383
- this.path = path2;
384
- this.fd = null;
385
- this.readable = true;
386
- this.paused = false;
387
- this.flags = "r";
388
- this.mode = 438;
389
- this.bufferSize = 64 * 1024;
390
- options = options || {};
391
- var keys = Object.keys(options);
392
- for (var index = 0, length = keys.length; index < length; index++) {
393
- var key = keys[index];
394
- this[key] = options[key];
395
- }
396
- if (this.encoding)
397
- this.setEncoding(this.encoding);
398
- if (this.start !== void 0) {
399
- if ("number" !== typeof this.start) {
400
- throw TypeError("start must be a Number");
401
- }
402
- if (this.end === void 0) {
403
- this.end = Infinity;
404
- } else if ("number" !== typeof this.end) {
405
- throw TypeError("end must be a Number");
406
- }
407
- if (this.start > this.end) {
408
- throw new Error("start must be <= end");
409
- }
410
- this.pos = this.start;
411
- }
412
- if (this.fd !== null) {
413
- process.nextTick(function() {
414
- self._read();
415
- });
416
- return;
417
- }
418
- fs.open(this.path, this.flags, this.mode, function(err, fd) {
419
- if (err) {
420
- self.emit("error", err);
421
- self.readable = false;
422
- return;
423
- }
424
- self.fd = fd;
425
- self.emit("open", fd);
426
- self._read();
427
- });
428
- }
429
- function WriteStream(path2, options) {
430
- if (!(this instanceof WriteStream))
431
- return new WriteStream(path2, options);
432
- Stream.call(this);
433
- this.path = path2;
434
- this.fd = null;
435
- this.writable = true;
436
- this.flags = "w";
437
- this.encoding = "binary";
438
- this.mode = 438;
439
- this.bytesWritten = 0;
440
- options = options || {};
441
- var keys = Object.keys(options);
442
- for (var index = 0, length = keys.length; index < length; index++) {
443
- var key = keys[index];
444
- this[key] = options[key];
445
- }
446
- if (this.start !== void 0) {
447
- if ("number" !== typeof this.start) {
448
- throw TypeError("start must be a Number");
449
- }
450
- if (this.start < 0) {
451
- throw new Error("start must be >= zero");
452
- }
453
- this.pos = this.start;
454
- }
455
- this.busy = false;
456
- this._queue = [];
457
- if (this.fd === null) {
458
- this._open = fs.open;
459
- this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
460
- this.flush();
461
- }
462
- }
463
- }
464
- }
465
- });
466
-
467
- // node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
468
- var require_clone = __commonJS({
469
- "node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports2, module2) {
470
- "use strict";
471
- module2.exports = clone;
472
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
473
- return obj.__proto__;
474
- };
475
- function clone(obj) {
476
- if (obj === null || typeof obj !== "object")
477
- return obj;
478
- if (obj instanceof Object)
479
- var copy = { __proto__: getPrototypeOf(obj) };
480
- else
481
- var copy = /* @__PURE__ */ Object.create(null);
482
- Object.getOwnPropertyNames(obj).forEach(function(key) {
483
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
484
- });
485
- return copy;
486
- }
487
- }
488
- });
489
-
490
- // node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
491
- var require_graceful_fs = __commonJS({
492
- "node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
493
- "use strict";
494
- var fs = require("fs");
495
- var polyfills = require_polyfills();
496
- var legacy = require_legacy_streams();
497
- var clone = require_clone();
498
- var util = require("util");
499
- var gracefulQueue;
500
- var previousSymbol;
501
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
502
- gracefulQueue = Symbol.for("graceful-fs.queue");
503
- previousSymbol = Symbol.for("graceful-fs.previous");
504
- } else {
505
- gracefulQueue = "___graceful-fs.queue";
506
- previousSymbol = "___graceful-fs.previous";
507
- }
508
- function noop() {
509
- }
510
- function publishQueue(context, queue2) {
511
- Object.defineProperty(context, gracefulQueue, {
512
- get: function() {
513
- return queue2;
514
- }
515
- });
516
- }
517
- var debug = noop;
518
- if (util.debuglog)
519
- debug = util.debuglog("gfs4");
520
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
521
- debug = function() {
522
- var m = util.format.apply(util, arguments);
523
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
524
- console.error(m);
525
- };
526
- if (!fs[gracefulQueue]) {
527
- queue = global[gracefulQueue] || [];
528
- publishQueue(fs, queue);
529
- fs.close = function(fs$close) {
530
- function close(fd, cb) {
531
- return fs$close.call(fs, fd, function(err) {
532
- if (!err) {
533
- resetQueue();
534
- }
535
- if (typeof cb === "function")
536
- cb.apply(this, arguments);
537
- });
538
- }
539
- Object.defineProperty(close, previousSymbol, {
540
- value: fs$close
541
- });
542
- return close;
543
- }(fs.close);
544
- fs.closeSync = function(fs$closeSync) {
545
- function closeSync(fd) {
546
- fs$closeSync.apply(fs, arguments);
547
- resetQueue();
548
- }
549
- Object.defineProperty(closeSync, previousSymbol, {
550
- value: fs$closeSync
551
- });
552
- return closeSync;
553
- }(fs.closeSync);
554
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
555
- process.on("exit", function() {
556
- debug(fs[gracefulQueue]);
557
- require("assert").equal(fs[gracefulQueue].length, 0);
558
- });
559
- }
560
- }
561
- var queue;
562
- if (!global[gracefulQueue]) {
563
- publishQueue(global, fs[gracefulQueue]);
564
- }
565
- module2.exports = patch(clone(fs));
566
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
567
- module2.exports = patch(fs);
568
- fs.__patched = true;
569
- }
570
- function patch(fs2) {
571
- polyfills(fs2);
572
- fs2.gracefulify = patch;
573
- fs2.createReadStream = createReadStream;
574
- fs2.createWriteStream = createWriteStream2;
575
- var fs$readFile = fs2.readFile;
576
- fs2.readFile = readFile2;
577
- function readFile2(path2, options, cb) {
578
- if (typeof options === "function")
579
- cb = options, options = null;
580
- return go$readFile(path2, options, cb);
581
- function go$readFile(path3, options2, cb2, startTime) {
582
- return fs$readFile(path3, options2, function(err) {
583
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
584
- enqueue([go$readFile, [path3, options2, cb2], err, startTime || Date.now(), Date.now()]);
585
- else {
586
- if (typeof cb2 === "function")
587
- cb2.apply(this, arguments);
588
- }
589
- });
590
- }
591
- }
592
- var fs$writeFile = fs2.writeFile;
593
- fs2.writeFile = writeFile2;
594
- function writeFile2(path2, data, options, cb) {
595
- if (typeof options === "function")
596
- cb = options, options = null;
597
- return go$writeFile(path2, data, options, cb);
598
- function go$writeFile(path3, data2, options2, cb2, startTime) {
599
- return fs$writeFile(path3, data2, options2, function(err) {
600
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
601
- enqueue([go$writeFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
602
- else {
603
- if (typeof cb2 === "function")
604
- cb2.apply(this, arguments);
605
- }
606
- });
607
- }
608
- }
609
- var fs$appendFile = fs2.appendFile;
610
- if (fs$appendFile)
611
- fs2.appendFile = appendFile;
612
- function appendFile(path2, data, options, cb) {
613
- if (typeof options === "function")
614
- cb = options, options = null;
615
- return go$appendFile(path2, data, options, cb);
616
- function go$appendFile(path3, data2, options2, cb2, startTime) {
617
- return fs$appendFile(path3, data2, options2, function(err) {
618
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
619
- enqueue([go$appendFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
620
- else {
621
- if (typeof cb2 === "function")
622
- cb2.apply(this, arguments);
623
- }
624
- });
625
- }
626
- }
627
- var fs$copyFile = fs2.copyFile;
628
- if (fs$copyFile)
629
- fs2.copyFile = copyFile;
630
- function copyFile(src, dest, flags, cb) {
631
- if (typeof flags === "function") {
632
- cb = flags;
633
- flags = 0;
634
- }
635
- return go$copyFile(src, dest, flags, cb);
636
- function go$copyFile(src2, dest2, flags2, cb2, startTime) {
637
- return fs$copyFile(src2, dest2, flags2, function(err) {
638
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
639
- enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
640
- else {
641
- if (typeof cb2 === "function")
642
- cb2.apply(this, arguments);
643
- }
644
- });
645
- }
646
- }
647
- var fs$readdir = fs2.readdir;
648
- fs2.readdir = readdir2;
649
- var noReaddirOptionVersions = /^v[0-5]\./;
650
- function readdir2(path2, options, cb) {
651
- if (typeof options === "function")
652
- cb = options, options = null;
653
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path3, options2, cb2, startTime) {
654
- return fs$readdir(path3, fs$readdirCallback(
655
- path3,
656
- options2,
657
- cb2,
658
- startTime
659
- ));
660
- } : function go$readdir2(path3, options2, cb2, startTime) {
661
- return fs$readdir(path3, options2, fs$readdirCallback(
662
- path3,
663
- options2,
664
- cb2,
665
- startTime
666
- ));
667
- };
668
- return go$readdir(path2, options, cb);
669
- function fs$readdirCallback(path3, options2, cb2, startTime) {
670
- return function(err, files) {
671
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
672
- enqueue([
673
- go$readdir,
674
- [path3, options2, cb2],
675
- err,
676
- startTime || Date.now(),
677
- Date.now()
678
- ]);
679
- else {
680
- if (files && files.sort)
681
- files.sort();
682
- if (typeof cb2 === "function")
683
- cb2.call(this, err, files);
684
- }
685
- };
686
- }
687
- }
688
- if (process.version.substr(0, 4) === "v0.8") {
689
- var legStreams = legacy(fs2);
690
- ReadStream = legStreams.ReadStream;
691
- WriteStream = legStreams.WriteStream;
692
- }
693
- var fs$ReadStream = fs2.ReadStream;
694
- if (fs$ReadStream) {
695
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
696
- ReadStream.prototype.open = ReadStream$open;
697
- }
698
- var fs$WriteStream = fs2.WriteStream;
699
- if (fs$WriteStream) {
700
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
701
- WriteStream.prototype.open = WriteStream$open;
702
- }
703
- Object.defineProperty(fs2, "ReadStream", {
704
- get: function() {
705
- return ReadStream;
706
- },
707
- set: function(val) {
708
- ReadStream = val;
709
- },
710
- enumerable: true,
711
- configurable: true
712
- });
713
- Object.defineProperty(fs2, "WriteStream", {
714
- get: function() {
715
- return WriteStream;
716
- },
717
- set: function(val) {
718
- WriteStream = val;
719
- },
720
- enumerable: true,
721
- configurable: true
722
- });
723
- var FileReadStream = ReadStream;
724
- Object.defineProperty(fs2, "FileReadStream", {
725
- get: function() {
726
- return FileReadStream;
727
- },
728
- set: function(val) {
729
- FileReadStream = val;
730
- },
731
- enumerable: true,
732
- configurable: true
733
- });
734
- var FileWriteStream = WriteStream;
735
- Object.defineProperty(fs2, "FileWriteStream", {
736
- get: function() {
737
- return FileWriteStream;
738
- },
739
- set: function(val) {
740
- FileWriteStream = val;
741
- },
742
- enumerable: true,
743
- configurable: true
744
- });
745
- function ReadStream(path2, options) {
746
- if (this instanceof ReadStream)
747
- return fs$ReadStream.apply(this, arguments), this;
748
- else
749
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
750
- }
751
- function ReadStream$open() {
752
- var that = this;
753
- open(that.path, that.flags, that.mode, function(err, fd) {
754
- if (err) {
755
- if (that.autoClose)
756
- that.destroy();
757
- that.emit("error", err);
758
- } else {
759
- that.fd = fd;
760
- that.emit("open", fd);
761
- that.read();
762
- }
763
- });
764
- }
765
- function WriteStream(path2, options) {
766
- if (this instanceof WriteStream)
767
- return fs$WriteStream.apply(this, arguments), this;
768
- else
769
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
770
- }
771
- function WriteStream$open() {
772
- var that = this;
773
- open(that.path, that.flags, that.mode, function(err, fd) {
774
- if (err) {
775
- that.destroy();
776
- that.emit("error", err);
777
- } else {
778
- that.fd = fd;
779
- that.emit("open", fd);
780
- }
781
- });
782
- }
783
- function createReadStream(path2, options) {
784
- return new fs2.ReadStream(path2, options);
785
- }
786
- function createWriteStream2(path2, options) {
787
- return new fs2.WriteStream(path2, options);
788
- }
789
- var fs$open = fs2.open;
790
- fs2.open = open;
791
- function open(path2, flags, mode, cb) {
792
- if (typeof mode === "function")
793
- cb = mode, mode = null;
794
- return go$open(path2, flags, mode, cb);
795
- function go$open(path3, flags2, mode2, cb2, startTime) {
796
- return fs$open(path3, flags2, mode2, function(err, fd) {
797
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
798
- enqueue([go$open, [path3, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
799
- else {
800
- if (typeof cb2 === "function")
801
- cb2.apply(this, arguments);
802
- }
803
- });
804
- }
805
- }
806
- return fs2;
807
- }
808
- function enqueue(elem) {
809
- debug("ENQUEUE", elem[0].name, elem[1]);
810
- fs[gracefulQueue].push(elem);
811
- retry();
812
- }
813
- var retryTimer;
814
- function resetQueue() {
815
- var now = Date.now();
816
- for (var i = 0; i < fs[gracefulQueue].length; ++i) {
817
- if (fs[gracefulQueue][i].length > 2) {
818
- fs[gracefulQueue][i][3] = now;
819
- fs[gracefulQueue][i][4] = now;
820
- }
821
- }
822
- retry();
823
- }
824
- function retry() {
825
- clearTimeout(retryTimer);
826
- retryTimer = void 0;
827
- if (fs[gracefulQueue].length === 0)
828
- return;
829
- var elem = fs[gracefulQueue].shift();
830
- var fn = elem[0];
831
- var args = elem[1];
832
- var err = elem[2];
833
- var startTime = elem[3];
834
- var lastTime = elem[4];
835
- if (startTime === void 0) {
836
- debug("RETRY", fn.name, args);
837
- fn.apply(null, args);
838
- } else if (Date.now() - startTime >= 6e4) {
839
- debug("TIMEOUT", fn.name, args);
840
- var cb = args.pop();
841
- if (typeof cb === "function")
842
- cb.call(null, err);
843
- } else {
844
- var sinceAttempt = Date.now() - lastTime;
845
- var sinceStart = Math.max(lastTime - startTime, 1);
846
- var desiredDelay = Math.min(sinceStart * 1.2, 100);
847
- if (sinceAttempt >= desiredDelay) {
848
- debug("RETRY", fn.name, args);
849
- fn.apply(null, args.concat([startTime]));
850
- } else {
851
- fs[gracefulQueue].push(elem);
852
- }
853
- }
854
- if (retryTimer === void 0) {
855
- retryTimer = setTimeout(retry, 0);
856
- }
857
- }
858
- }
859
- });
860
-
861
- // node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry_operation.js
862
- var require_retry_operation = __commonJS({
863
- "node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
864
- "use strict";
865
- function RetryOperation(timeouts, options) {
866
- if (typeof options === "boolean") {
867
- options = { forever: options };
868
- }
869
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
870
- this._timeouts = timeouts;
871
- this._options = options || {};
872
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
873
- this._fn = null;
874
- this._errors = [];
875
- this._attempts = 1;
876
- this._operationTimeout = null;
877
- this._operationTimeoutCb = null;
878
- this._timeout = null;
879
- this._operationStart = null;
880
- if (this._options.forever) {
881
- this._cachedTimeouts = this._timeouts.slice(0);
882
- }
883
- }
884
- module2.exports = RetryOperation;
885
- RetryOperation.prototype.reset = function() {
886
- this._attempts = 1;
887
- this._timeouts = this._originalTimeouts;
888
- };
889
- RetryOperation.prototype.stop = function() {
890
- if (this._timeout) {
891
- clearTimeout(this._timeout);
892
- }
893
- this._timeouts = [];
894
- this._cachedTimeouts = null;
895
- };
896
- RetryOperation.prototype.retry = function(err) {
897
- if (this._timeout) {
898
- clearTimeout(this._timeout);
899
- }
900
- if (!err) {
901
- return false;
902
- }
903
- var currentTime = (/* @__PURE__ */ new Date()).getTime();
904
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
905
- this._errors.unshift(new Error("RetryOperation timeout occurred"));
906
- return false;
907
- }
908
- this._errors.push(err);
909
- var timeout = this._timeouts.shift();
910
- if (timeout === void 0) {
911
- if (this._cachedTimeouts) {
912
- this._errors.splice(this._errors.length - 1, this._errors.length);
913
- this._timeouts = this._cachedTimeouts.slice(0);
914
- timeout = this._timeouts.shift();
915
- } else {
916
- return false;
917
- }
918
- }
919
- var self = this;
920
- var timer = setTimeout(function() {
921
- self._attempts++;
922
- if (self._operationTimeoutCb) {
923
- self._timeout = setTimeout(function() {
924
- self._operationTimeoutCb(self._attempts);
925
- }, self._operationTimeout);
926
- if (self._options.unref) {
927
- self._timeout.unref();
928
- }
929
- }
930
- self._fn(self._attempts);
931
- }, timeout);
932
- if (this._options.unref) {
933
- timer.unref();
934
- }
935
- return true;
936
- };
937
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
938
- this._fn = fn;
939
- if (timeoutOps) {
940
- if (timeoutOps.timeout) {
941
- this._operationTimeout = timeoutOps.timeout;
942
- }
943
- if (timeoutOps.cb) {
944
- this._operationTimeoutCb = timeoutOps.cb;
945
- }
946
- }
947
- var self = this;
948
- if (this._operationTimeoutCb) {
949
- this._timeout = setTimeout(function() {
950
- self._operationTimeoutCb();
951
- }, self._operationTimeout);
952
- }
953
- this._operationStart = (/* @__PURE__ */ new Date()).getTime();
954
- this._fn(this._attempts);
955
- };
956
- RetryOperation.prototype.try = function(fn) {
957
- console.log("Using RetryOperation.try() is deprecated");
958
- this.attempt(fn);
959
- };
960
- RetryOperation.prototype.start = function(fn) {
961
- console.log("Using RetryOperation.start() is deprecated");
962
- this.attempt(fn);
963
- };
964
- RetryOperation.prototype.start = RetryOperation.prototype.try;
965
- RetryOperation.prototype.errors = function() {
966
- return this._errors;
967
- };
968
- RetryOperation.prototype.attempts = function() {
969
- return this._attempts;
970
- };
971
- RetryOperation.prototype.mainError = function() {
972
- if (this._errors.length === 0) {
973
- return null;
974
- }
975
- var counts = {};
976
- var mainError = null;
977
- var mainErrorCount = 0;
978
- for (var i = 0; i < this._errors.length; i++) {
979
- var error = this._errors[i];
980
- var message = error.message;
981
- var count = (counts[message] || 0) + 1;
982
- counts[message] = count;
983
- if (count >= mainErrorCount) {
984
- mainError = error;
985
- mainErrorCount = count;
986
- }
987
- }
988
- return mainError;
989
- };
990
- }
991
- });
992
-
993
- // node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry.js
994
- var require_retry = __commonJS({
995
- "node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry.js"(exports2) {
996
- "use strict";
997
- var RetryOperation = require_retry_operation();
998
- exports2.operation = function(options) {
999
- var timeouts = exports2.timeouts(options);
1000
- return new RetryOperation(timeouts, {
1001
- forever: options && options.forever,
1002
- unref: options && options.unref,
1003
- maxRetryTime: options && options.maxRetryTime
1004
- });
1005
- };
1006
- exports2.timeouts = function(options) {
1007
- if (options instanceof Array) {
1008
- return [].concat(options);
1009
- }
1010
- var opts = {
1011
- retries: 10,
1012
- factor: 2,
1013
- minTimeout: 1 * 1e3,
1014
- maxTimeout: Infinity,
1015
- randomize: false
1016
- };
1017
- for (var key in options) {
1018
- opts[key] = options[key];
1019
- }
1020
- if (opts.minTimeout > opts.maxTimeout) {
1021
- throw new Error("minTimeout is greater than maxTimeout");
1022
- }
1023
- var timeouts = [];
1024
- for (var i = 0; i < opts.retries; i++) {
1025
- timeouts.push(this.createTimeout(i, opts));
1026
- }
1027
- if (options && options.forever && !timeouts.length) {
1028
- timeouts.push(this.createTimeout(i, opts));
1029
- }
1030
- timeouts.sort(function(a, b) {
1031
- return a - b;
1032
- });
1033
- return timeouts;
1034
- };
1035
- exports2.createTimeout = function(attempt, opts) {
1036
- var random = opts.randomize ? Math.random() + 1 : 1;
1037
- var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
1038
- timeout = Math.min(timeout, opts.maxTimeout);
1039
- return timeout;
1040
- };
1041
- exports2.wrap = function(obj, options, methods) {
1042
- if (options instanceof Array) {
1043
- methods = options;
1044
- options = null;
1045
- }
1046
- if (!methods) {
1047
- methods = [];
1048
- for (var key in obj) {
1049
- if (typeof obj[key] === "function") {
1050
- methods.push(key);
1051
- }
1052
- }
1053
- }
1054
- for (var i = 0; i < methods.length; i++) {
1055
- var method = methods[i];
1056
- var original = obj[method];
1057
- obj[method] = function retryWrapper(original2) {
1058
- var op = exports2.operation(options);
1059
- var args = Array.prototype.slice.call(arguments, 1);
1060
- var callback = args.pop();
1061
- args.push(function(err) {
1062
- if (op.retry(err)) {
1063
- return;
1064
- }
1065
- if (err) {
1066
- arguments[0] = op.mainError();
1067
- }
1068
- callback.apply(this, arguments);
1069
- });
1070
- op.attempt(function() {
1071
- original2.apply(obj, args);
1072
- });
1073
- }.bind(obj, original);
1074
- obj[method].options = options;
1075
- }
1076
- };
1077
- }
1078
- });
1079
-
1080
- // node_modules/.pnpm/retry@0.12.0/node_modules/retry/index.js
1081
- var require_retry2 = __commonJS({
1082
- "node_modules/.pnpm/retry@0.12.0/node_modules/retry/index.js"(exports2, module2) {
1083
- "use strict";
1084
- module2.exports = require_retry();
1085
- }
1086
- });
1087
-
1088
- // node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
1089
- var require_signals = __commonJS({
1090
- "node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports2, module2) {
1091
- "use strict";
1092
- module2.exports = [
1093
- "SIGABRT",
1094
- "SIGALRM",
1095
- "SIGHUP",
1096
- "SIGINT",
1097
- "SIGTERM"
1098
- ];
1099
- if (process.platform !== "win32") {
1100
- module2.exports.push(
1101
- "SIGVTALRM",
1102
- "SIGXCPU",
1103
- "SIGXFSZ",
1104
- "SIGUSR2",
1105
- "SIGTRAP",
1106
- "SIGSYS",
1107
- "SIGQUIT",
1108
- "SIGIOT"
1109
- // should detect profiler and enable/disable accordingly.
1110
- // see #21
1111
- // 'SIGPROF'
1112
- );
1113
- }
1114
- if (process.platform === "linux") {
1115
- module2.exports.push(
1116
- "SIGIO",
1117
- "SIGPOLL",
1118
- "SIGPWR",
1119
- "SIGSTKFLT",
1120
- "SIGUNUSED"
1121
- );
1122
- }
1123
- }
1124
- });
1125
-
1126
- // node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
1127
- var require_signal_exit = __commonJS({
1128
- "node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports2, module2) {
1129
- "use strict";
1130
- var process8 = global.process;
1131
- var processOk = function(process9) {
1132
- return process9 && typeof process9 === "object" && typeof process9.removeListener === "function" && typeof process9.emit === "function" && typeof process9.reallyExit === "function" && typeof process9.listeners === "function" && typeof process9.kill === "function" && typeof process9.pid === "number" && typeof process9.on === "function";
1133
- };
1134
- if (!processOk(process8)) {
1135
- module2.exports = function() {
1136
- return function() {
1137
- };
1138
- };
1139
- } else {
1140
- assert = require("assert");
1141
- signals = require_signals();
1142
- isWin = /^win/i.test(process8.platform);
1143
- EE = require("events");
1144
- if (typeof EE !== "function") {
1145
- EE = EE.EventEmitter;
1146
- }
1147
- if (process8.__signal_exit_emitter__) {
1148
- emitter = process8.__signal_exit_emitter__;
1149
- } else {
1150
- emitter = process8.__signal_exit_emitter__ = new EE();
1151
- emitter.count = 0;
1152
- emitter.emitted = {};
1153
- }
1154
- if (!emitter.infinite) {
1155
- emitter.setMaxListeners(Infinity);
1156
- emitter.infinite = true;
1157
- }
1158
- module2.exports = function(cb, opts) {
1159
- if (!processOk(global.process)) {
1160
- return function() {
1161
- };
1162
- }
1163
- assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
1164
- if (loaded === false) {
1165
- load();
1166
- }
1167
- var ev = "exit";
1168
- if (opts && opts.alwaysLast) {
1169
- ev = "afterexit";
1170
- }
1171
- var remove = function() {
1172
- emitter.removeListener(ev, cb);
1173
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
1174
- unload();
1175
- }
1176
- };
1177
- emitter.on(ev, cb);
1178
- return remove;
1179
- };
1180
- unload = function unload2() {
1181
- if (!loaded || !processOk(global.process)) {
1182
- return;
1183
- }
1184
- loaded = false;
1185
- signals.forEach(function(sig) {
1186
- try {
1187
- process8.removeListener(sig, sigListeners[sig]);
1188
- } catch (er) {
1189
- }
1190
- });
1191
- process8.emit = originalProcessEmit;
1192
- process8.reallyExit = originalProcessReallyExit;
1193
- emitter.count -= 1;
1194
- };
1195
- module2.exports.unload = unload;
1196
- emit = function emit2(event, code, signal) {
1197
- if (emitter.emitted[event]) {
1198
- return;
1199
- }
1200
- emitter.emitted[event] = true;
1201
- emitter.emit(event, code, signal);
1202
- };
1203
- sigListeners = {};
1204
- signals.forEach(function(sig) {
1205
- sigListeners[sig] = function listener() {
1206
- if (!processOk(global.process)) {
1207
- return;
1208
- }
1209
- var listeners = process8.listeners(sig);
1210
- if (listeners.length === emitter.count) {
1211
- unload();
1212
- emit("exit", null, sig);
1213
- emit("afterexit", null, sig);
1214
- if (isWin && sig === "SIGHUP") {
1215
- sig = "SIGINT";
1216
- }
1217
- process8.kill(process8.pid, sig);
1218
- }
1219
- };
1220
- });
1221
- module2.exports.signals = function() {
1222
- return signals;
1223
- };
1224
- loaded = false;
1225
- load = function load2() {
1226
- if (loaded || !processOk(global.process)) {
1227
- return;
1228
- }
1229
- loaded = true;
1230
- emitter.count += 1;
1231
- signals = signals.filter(function(sig) {
1232
- try {
1233
- process8.on(sig, sigListeners[sig]);
1234
- return true;
1235
- } catch (er) {
1236
- return false;
1237
- }
1238
- });
1239
- process8.emit = processEmit;
1240
- process8.reallyExit = processReallyExit;
1241
- };
1242
- module2.exports.load = load;
1243
- originalProcessReallyExit = process8.reallyExit;
1244
- processReallyExit = function processReallyExit2(code) {
1245
- if (!processOk(global.process)) {
1246
- return;
1247
- }
1248
- process8.exitCode = code || /* istanbul ignore next */
1249
- 0;
1250
- emit("exit", process8.exitCode, null);
1251
- emit("afterexit", process8.exitCode, null);
1252
- originalProcessReallyExit.call(process8, process8.exitCode);
1253
- };
1254
- originalProcessEmit = process8.emit;
1255
- processEmit = function processEmit2(ev, arg) {
1256
- if (ev === "exit" && processOk(global.process)) {
1257
- if (arg !== void 0) {
1258
- process8.exitCode = arg;
1259
- }
1260
- var ret = originalProcessEmit.apply(this, arguments);
1261
- emit("exit", process8.exitCode, null);
1262
- emit("afterexit", process8.exitCode, null);
1263
- return ret;
1264
- } else {
1265
- return originalProcessEmit.apply(this, arguments);
1266
- }
1267
- };
1268
- }
1269
- var assert;
1270
- var signals;
1271
- var isWin;
1272
- var EE;
1273
- var emitter;
1274
- var unload;
1275
- var emit;
1276
- var sigListeners;
1277
- var loaded;
1278
- var load;
1279
- var originalProcessReallyExit;
1280
- var processReallyExit;
1281
- var originalProcessEmit;
1282
- var processEmit;
1283
- }
1284
- });
1285
-
1286
- // node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js
1287
- var require_mtime_precision = __commonJS({
1288
- "node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js"(exports2, module2) {
1289
- "use strict";
1290
- var cacheSymbol = Symbol();
1291
- function probe(file, fs, callback) {
1292
- const cachedPrecision = fs[cacheSymbol];
1293
- if (cachedPrecision) {
1294
- return fs.stat(file, (err, stat2) => {
1295
- if (err) {
1296
- return callback(err);
1297
- }
1298
- callback(null, stat2.mtime, cachedPrecision);
1299
- });
1300
- }
1301
- const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
1302
- fs.utimes(file, mtime, mtime, (err) => {
1303
- if (err) {
1304
- return callback(err);
1305
- }
1306
- fs.stat(file, (err2, stat2) => {
1307
- if (err2) {
1308
- return callback(err2);
1309
- }
1310
- const precision = stat2.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1311
- Object.defineProperty(fs, cacheSymbol, { value: precision });
1312
- callback(null, stat2.mtime, precision);
1313
- });
1314
- });
1315
- }
1316
- function getMtime(precision) {
1317
- let now = Date.now();
1318
- if (precision === "s") {
1319
- now = Math.ceil(now / 1e3) * 1e3;
1320
- }
1321
- return new Date(now);
1322
- }
1323
- module2.exports.probe = probe;
1324
- module2.exports.getMtime = getMtime;
1325
- }
1326
- });
1327
-
1328
- // node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js
1329
- var require_lockfile = __commonJS({
1330
- "node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) {
1331
- "use strict";
1332
- var path2 = require("path");
1333
- var fs = require_graceful_fs();
1334
- var retry = require_retry2();
1335
- var onExit = require_signal_exit();
1336
- var mtimePrecision = require_mtime_precision();
1337
- var locks = {};
1338
- function getLockFile(file, options) {
1339
- return options.lockfilePath || `${file}.lock`;
1340
- }
1341
- function resolveCanonicalPath(file, options, callback) {
1342
- if (!options.realpath) {
1343
- return callback(null, path2.resolve(file));
1344
- }
1345
- options.fs.realpath(file, callback);
1346
- }
1347
- function acquireLock(file, options, callback) {
1348
- const lockfilePath = getLockFile(file, options);
1349
- options.fs.mkdir(lockfilePath, (err) => {
1350
- if (!err) {
1351
- return mtimePrecision.probe(lockfilePath, options.fs, (err2, mtime, mtimePrecision2) => {
1352
- if (err2) {
1353
- options.fs.rmdir(lockfilePath, () => {
1354
- });
1355
- return callback(err2);
1356
- }
1357
- callback(null, mtime, mtimePrecision2);
1358
- });
1359
- }
1360
- if (err.code !== "EEXIST") {
1361
- return callback(err);
1362
- }
1363
- if (options.stale <= 0) {
1364
- return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
1365
- }
1366
- options.fs.stat(lockfilePath, (err2, stat2) => {
1367
- if (err2) {
1368
- if (err2.code === "ENOENT") {
1369
- return acquireLock(file, __spreadProps(__spreadValues({}, options), { stale: 0 }), callback);
1370
- }
1371
- return callback(err2);
1372
- }
1373
- if (!isLockStale(stat2, options)) {
1374
- return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
1375
- }
1376
- removeLock(file, options, (err3) => {
1377
- if (err3) {
1378
- return callback(err3);
1379
- }
1380
- acquireLock(file, __spreadProps(__spreadValues({}, options), { stale: 0 }), callback);
1381
- });
1382
- });
1383
- });
1384
- }
1385
- function isLockStale(stat2, options) {
1386
- return stat2.mtime.getTime() < Date.now() - options.stale;
1387
- }
1388
- function removeLock(file, options, callback) {
1389
- options.fs.rmdir(getLockFile(file, options), (err) => {
1390
- if (err && err.code !== "ENOENT") {
1391
- return callback(err);
1392
- }
1393
- callback();
1394
- });
1395
- }
1396
- function updateLock(file, options) {
1397
- const lock2 = locks[file];
1398
- if (lock2.updateTimeout) {
1399
- return;
1400
- }
1401
- lock2.updateDelay = lock2.updateDelay || options.update;
1402
- lock2.updateTimeout = setTimeout(() => {
1403
- lock2.updateTimeout = null;
1404
- options.fs.stat(lock2.lockfilePath, (err, stat2) => {
1405
- const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
1406
- if (err) {
1407
- if (err.code === "ENOENT" || isOverThreshold) {
1408
- return setLockAsCompromised(file, lock2, Object.assign(err, { code: "ECOMPROMISED" }));
1409
- }
1410
- lock2.updateDelay = 1e3;
1411
- return updateLock(file, options);
1412
- }
1413
- const isMtimeOurs = lock2.mtime.getTime() === stat2.mtime.getTime();
1414
- if (!isMtimeOurs) {
1415
- return setLockAsCompromised(
1416
- file,
1417
- lock2,
1418
- Object.assign(
1419
- new Error("Unable to update lock within the stale threshold"),
1420
- { code: "ECOMPROMISED" }
1421
- )
1422
- );
1423
- }
1424
- const mtime = mtimePrecision.getMtime(lock2.mtimePrecision);
1425
- options.fs.utimes(lock2.lockfilePath, mtime, mtime, (err2) => {
1426
- const isOverThreshold2 = lock2.lastUpdate + options.stale < Date.now();
1427
- if (lock2.released) {
1428
- return;
1429
- }
1430
- if (err2) {
1431
- if (err2.code === "ENOENT" || isOverThreshold2) {
1432
- return setLockAsCompromised(file, lock2, Object.assign(err2, { code: "ECOMPROMISED" }));
1433
- }
1434
- lock2.updateDelay = 1e3;
1435
- return updateLock(file, options);
1436
- }
1437
- lock2.mtime = mtime;
1438
- lock2.lastUpdate = Date.now();
1439
- lock2.updateDelay = null;
1440
- updateLock(file, options);
1441
- });
1442
- });
1443
- }, lock2.updateDelay);
1444
- if (lock2.updateTimeout.unref) {
1445
- lock2.updateTimeout.unref();
1446
- }
1447
- }
1448
- function setLockAsCompromised(file, lock2, err) {
1449
- lock2.released = true;
1450
- if (lock2.updateTimeout) {
1451
- clearTimeout(lock2.updateTimeout);
1452
- }
1453
- if (locks[file] === lock2) {
1454
- delete locks[file];
1455
- }
1456
- lock2.options.onCompromised(err);
1457
- }
1458
- function lock(file, options, callback) {
1459
- options = __spreadValues({
1460
- stale: 1e4,
1461
- update: null,
1462
- realpath: true,
1463
- retries: 0,
1464
- fs,
1465
- onCompromised: (err) => {
1466
- throw err;
1467
- }
1468
- }, options);
1469
- options.retries = options.retries || 0;
1470
- options.retries = typeof options.retries === "number" ? { retries: options.retries } : options.retries;
1471
- options.stale = Math.max(options.stale || 0, 2e3);
1472
- options.update = options.update == null ? options.stale / 2 : options.update || 0;
1473
- options.update = Math.max(Math.min(options.update, options.stale / 2), 1e3);
1474
- resolveCanonicalPath(file, options, (err, file2) => {
1475
- if (err) {
1476
- return callback(err);
1477
- }
1478
- const operation = retry.operation(options.retries);
1479
- operation.attempt(() => {
1480
- acquireLock(file2, options, (err2, mtime, mtimePrecision2) => {
1481
- if (operation.retry(err2)) {
1482
- return;
1483
- }
1484
- if (err2) {
1485
- return callback(operation.mainError());
1486
- }
1487
- const lock2 = locks[file2] = {
1488
- lockfilePath: getLockFile(file2, options),
1489
- mtime,
1490
- mtimePrecision: mtimePrecision2,
1491
- options,
1492
- lastUpdate: Date.now()
1493
- };
1494
- updateLock(file2, options);
1495
- callback(null, (releasedCallback) => {
1496
- if (lock2.released) {
1497
- return releasedCallback && releasedCallback(Object.assign(new Error("Lock is already released"), { code: "ERELEASED" }));
1498
- }
1499
- unlock(file2, __spreadProps(__spreadValues({}, options), { realpath: false }), releasedCallback);
1500
- });
1501
- });
1502
- });
1503
- });
1504
- }
1505
- function unlock(file, options, callback) {
1506
- options = __spreadValues({
1507
- fs,
1508
- realpath: true
1509
- }, options);
1510
- resolveCanonicalPath(file, options, (err, file2) => {
1511
- if (err) {
1512
- return callback(err);
1513
- }
1514
- const lock2 = locks[file2];
1515
- if (!lock2) {
1516
- return callback(Object.assign(new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
1517
- }
1518
- lock2.updateTimeout && clearTimeout(lock2.updateTimeout);
1519
- lock2.released = true;
1520
- delete locks[file2];
1521
- removeLock(file2, options, callback);
1522
- });
1523
- }
1524
- function check(file, options, callback) {
1525
- options = __spreadValues({
1526
- stale: 1e4,
1527
- realpath: true,
1528
- fs
1529
- }, options);
1530
- options.stale = Math.max(options.stale || 0, 2e3);
1531
- resolveCanonicalPath(file, options, (err, file2) => {
1532
- if (err) {
1533
- return callback(err);
1534
- }
1535
- options.fs.stat(getLockFile(file2, options), (err2, stat2) => {
1536
- if (err2) {
1537
- return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
1538
- }
1539
- return callback(null, !isLockStale(stat2, options));
1540
- });
1541
- });
1542
- }
1543
- function getLocks() {
1544
- return locks;
1545
- }
1546
- onExit(() => {
1547
- for (const file in locks) {
1548
- const options = locks[file].options;
1549
- try {
1550
- options.fs.rmdirSync(getLockFile(file, options));
1551
- } catch (e) {
1552
- }
1553
- }
1554
- });
1555
- module2.exports.lock = lock;
1556
- module2.exports.unlock = unlock;
1557
- module2.exports.check = check;
1558
- module2.exports.getLocks = getLocks;
1559
- }
1560
- });
1561
-
1562
- // node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js
1563
- var require_adapter = __commonJS({
1564
- "node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js"(exports2, module2) {
1565
- "use strict";
1566
- var fs = require_graceful_fs();
1567
- function createSyncFs(fs2) {
1568
- const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
1569
- const newFs = __spreadValues({}, fs2);
1570
- methods.forEach((method) => {
1571
- newFs[method] = (...args) => {
1572
- const callback = args.pop();
1573
- let ret;
1574
- try {
1575
- ret = fs2[`${method}Sync`](...args);
1576
- } catch (err) {
1577
- return callback(err);
1578
- }
1579
- callback(null, ret);
1580
- };
1581
- });
1582
- return newFs;
1583
- }
1584
- function toPromise(method) {
1585
- return (...args) => new Promise((resolve, reject) => {
1586
- args.push((err, result) => {
1587
- if (err) {
1588
- reject(err);
1589
- } else {
1590
- resolve(result);
1591
- }
1592
- });
1593
- method(...args);
1594
- });
1595
- }
1596
- function toSync(method) {
1597
- return (...args) => {
1598
- let err;
1599
- let result;
1600
- args.push((_err, _result) => {
1601
- err = _err;
1602
- result = _result;
1603
- });
1604
- method(...args);
1605
- if (err) {
1606
- throw err;
1607
- }
1608
- return result;
1609
- };
1610
- }
1611
- function toSyncOptions(options) {
1612
- options = __spreadValues({}, options);
1613
- options.fs = createSyncFs(options.fs || fs);
1614
- if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
1615
- throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
1616
- }
1617
- return options;
1618
- }
1619
- module2.exports = {
1620
- toPromise,
1621
- toSync,
1622
- toSyncOptions
1623
- };
1624
- }
1625
- });
1626
-
1627
- // node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/index.js
1628
- var require_proper_lockfile = __commonJS({
1629
- "node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/index.js"(exports2, module2) {
1630
- "use strict";
1631
- var lockfile = require_lockfile();
1632
- var { toPromise, toSync, toSyncOptions } = require_adapter();
1633
- async function lock(file, options) {
1634
- const release = await toPromise(lockfile.lock)(file, options);
1635
- return toPromise(release);
1636
- }
1637
- function lockSync(file, options) {
1638
- const release = toSync(lockfile.lock)(file, toSyncOptions(options));
1639
- return toSync(release);
1640
- }
1641
- function unlock(file, options) {
1642
- return toPromise(lockfile.unlock)(file, options);
1643
- }
1644
- function unlockSync(file, options) {
1645
- return toSync(lockfile.unlock)(file, toSyncOptions(options));
1646
- }
1647
- function check(file, options) {
1648
- return toPromise(lockfile.check)(file, options);
1649
- }
1650
- function checkSync(file, options) {
1651
- return toSync(lockfile.check)(file, toSyncOptions(options));
1652
- }
1653
- module2.exports = lock;
1654
- module2.exports.lock = lock;
1655
- module2.exports.unlock = unlock;
1656
- module2.exports.lockSync = lockSync;
1657
- module2.exports.unlockSync = unlockSync;
1658
- module2.exports.check = check;
1659
- module2.exports.checkSync = checkSync;
1660
- }
1661
- });
1662
-
1663
30
  // src/nuxt.ts
1664
31
  var nuxt_exports = {};
1665
32
  __export(nuxt_exports, {
@@ -1701,7 +68,7 @@ function isAdmin() {
1701
68
  try {
1702
69
  (0, import_node_child_process.execSync)("net session", { stdio: "ignore" });
1703
70
  return true;
1704
- } catch (e) {
71
+ } catch {
1705
72
  return false;
1706
73
  }
1707
74
  } else {
@@ -1724,6 +91,7 @@ var import_got_cjs = require("got-cjs");
1724
91
  var import_http_proxy_agent = require("http-proxy-agent");
1725
92
  var import_https_proxy_agent = require("https-proxy-agent");
1726
93
  var import_kill_port = __toESM(require("kill-port"), 1);
94
+ var lockfile = __toESM(require("proper-lockfile"), 1);
1727
95
 
1728
96
  // src/host/index.ts
1729
97
  var import_node_process2 = __toESM(require("process"), 1);
@@ -2027,18 +395,18 @@ var CaddyInstant = class {
2027
395
  await this.getCaddyfile();
2028
396
  this.inited = true;
2029
397
  });
2030
- this.lockfile = require_proper_lockfile();
2031
398
  this.locked = this.checkLock();
2032
399
  }
2033
400
  checkLock() {
2034
401
  if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
2035
402
  (0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
2036
- return this.lockfile.checkSync(caddyLockFilePath);
403
+ return lockfile.checkSync(caddyLockFilePath);
2037
404
  }
2038
405
  async getCaddyfile() {
2039
406
  if (!(0, import_node_fs2.existsSync)(caddyFilePath))
2040
407
  await this.initCaddyfile();
2041
408
  this.caddyfile = await (0, import_promises2.readFile)(caddyFilePath, "utf-8");
409
+ return this.caddyfile;
2042
410
  }
2043
411
  async initCaddyfile() {
2044
412
  const contet = `
@@ -2093,7 +461,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
2093
461
  if (!(0, import_node_fs2.existsSync)(caddyLockFilePath))
2094
462
  (0, import_node_fs2.writeFileSync)(caddyLockFilePath, "");
2095
463
  if (!this.locked) {
2096
- if (https && await tryPort(443))
464
+ if (await tryPort(443))
2097
465
  await (0, import_kill_port.default)(443, "tcp");
2098
466
  if ((import_node_process4.default.platform === "win32" || !https) && await tryPort(80))
2099
467
  await (0, import_kill_port.default)(80, "tcp");
@@ -2103,14 +471,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
2103
471
  import_node_process4.default.on("SIGINT", async () => {
2104
472
  if (!restore || this.stoped)
2105
473
  return;
2106
- if (!this.locked) {
2107
- try {
2108
- await this.lockfile.unlock(caddyLockFilePath);
2109
- await (0, import_promises2.unlink)(caddyFilePath);
2110
- await (0, import_promises2.unlink)(caddyLockFilePath);
2111
- } catch (e) {
2112
- }
2113
- }
474
+ await this.baseCleanup();
2114
475
  try {
2115
476
  if (await removeHost(source.split(":")[0], target.split(":")[0]))
2116
477
  consola.success("Restore host success.\n");
@@ -2143,14 +504,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
2143
504
  chmodRecursive(webpackCacheDir, 511);
2144
505
  if (!restore || this.stoped)
2145
506
  return originalExit(code);
2146
- if (!this.locked) {
2147
- try {
2148
- await this.lockfile.unlock(caddyLockFilePath);
2149
- await (0, import_promises2.unlink)(caddyFilePath);
2150
- await (0, import_promises2.unlink)(caddyLockFilePath);
2151
- } catch (e) {
2152
- }
2153
- }
507
+ await this.baseCleanup();
2154
508
  try {
2155
509
  if (await removeHost(source.split(":")[0], target.split(":")[0]))
2156
510
  consola.success("Restore host success.\n");
@@ -2169,7 +523,7 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
2169
523
  };
2170
524
  if (!this.locked) {
2171
525
  const child = import_node_process4.default.platform !== "win32" ? (0, import_node_child_process3.spawn)("sudo", ["-E", caddyPath, "run", "--config", caddyFilePath, "--watch"]) : (0, import_node_child_process3.spawn)(caddyPath, ["run", "--config", caddyFilePath, "--watch"]);
2172
- this.lockfile.lockSync(caddyLockFilePath);
526
+ lockfile.lockSync(caddyLockFilePath);
2173
527
  child.on("error", (err) => {
2174
528
  return reject(err);
2175
529
  });
@@ -2200,6 +554,16 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
2200
554
  }
2201
555
  });
2202
556
  }
557
+ async baseCleanup() {
558
+ if (!this.locked) {
559
+ try {
560
+ await lockfile.unlock(caddyLockFilePath);
561
+ await (0, import_promises2.unlink)(caddyFilePath);
562
+ await (0, import_promises2.unlink)(caddyLockFilePath);
563
+ } catch (e) {
564
+ }
565
+ }
566
+ }
2203
567
  };
2204
568
 
2205
569
  // src/index.ts
@@ -2210,9 +574,10 @@ var vitePrintUrls = once((options, source, target, base = "/", _printUrls) => {
2210
574
  if (caddy)
2211
575
  return;
2212
576
  caddy = new CaddyInstant();
2213
- caddy.run(source, target, __spreadValues({
2214
- base
2215
- }, options)).then(() => {
577
+ caddy.run(source, target, {
578
+ base,
579
+ ...options
580
+ }).then(() => {
2216
581
  const colorUrl = (url) => import_picocolors.default.green(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
2217
582
  consola.success(` ${import_picocolors.default.green("\u279C")} ${import_picocolors.default.bold("run caddy reverse proxy success")}: ${colorUrl(`${options.https ? "https" : "http"}://${target}${base}`)}`);
2218
583
  }).catch((e) => {