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