@delta-comic/plugin 0.3.4 → 0.3.5
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/index.css +2 -2
- package/dist/index.js +222 -644
- package/dist/index.js.map +1 -1
- package/dist/lib/driver/init/index.d.ts +1 -1
- package/dist/pack.tgz +0 -0
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -6,11 +6,35 @@ import { PromiseContent as F, SourcedKeyMap as I, uni as L } from "@delta-comic/
|
|
|
6
6
|
import { SharedFunction as R } from "@delta-comic/core";
|
|
7
7
|
import { DcAwait as z, DcPopup as B, createDialog as V, createDownloadMessage as H, createForm as U } from "@delta-comic/ui";
|
|
8
8
|
import W from "axios";
|
|
9
|
-
var G = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), K =
|
|
9
|
+
var G = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), K = ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
10
10
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
11
11
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
12
|
-
})
|
|
13
|
-
|
|
12
|
+
}), q = class {
|
|
13
|
+
capacity;
|
|
14
|
+
available;
|
|
15
|
+
deferredTasks = [];
|
|
16
|
+
constructor(e) {
|
|
17
|
+
this.capacity = e, this.available = e;
|
|
18
|
+
}
|
|
19
|
+
async acquire() {
|
|
20
|
+
if (this.available > 0) {
|
|
21
|
+
this.available--;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
return new Promise((e) => {
|
|
25
|
+
this.deferredTasks.push(e);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
release() {
|
|
29
|
+
let e = this.deferredTasks.shift();
|
|
30
|
+
if (e != null) {
|
|
31
|
+
e();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.available < this.capacity && this.available++;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
function ee(e, t = 1) {
|
|
14
38
|
let n = [], r = Math.floor(t), i = (e, t) => {
|
|
15
39
|
for (let a = 0; a < e.length; a++) {
|
|
16
40
|
let o = e[a];
|
|
@@ -19,7 +43,7 @@ function q(e, t = 1) {
|
|
|
19
43
|
};
|
|
20
44
|
return i(e, 0), n;
|
|
21
45
|
}
|
|
22
|
-
function
|
|
46
|
+
function te(e, t) {
|
|
23
47
|
let n = e.slice(), r = [], i = 0;
|
|
24
48
|
for (let a = 0; a < e.length; a++) {
|
|
25
49
|
if (t(e[a], a, n)) {
|
|
@@ -34,53 +58,29 @@ function ee(e, t) {
|
|
|
34
58
|
}
|
|
35
59
|
return e.length = i, r;
|
|
36
60
|
}
|
|
37
|
-
function
|
|
61
|
+
function ne(e) {
|
|
38
62
|
return typeof e == "symbol" || e instanceof Symbol;
|
|
39
63
|
}
|
|
40
|
-
function
|
|
64
|
+
function re(e) {
|
|
41
65
|
return ArrayBuffer.isView(e) && !(e instanceof DataView);
|
|
42
66
|
}
|
|
43
|
-
function
|
|
67
|
+
function ie(e) {
|
|
44
68
|
return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
|
|
45
69
|
}
|
|
46
|
-
function
|
|
70
|
+
function ae(e, t) {
|
|
47
71
|
return e === t || Number.isNaN(e) && Number.isNaN(t);
|
|
48
72
|
}
|
|
49
|
-
function
|
|
73
|
+
function oe(e) {
|
|
50
74
|
return Number.isSafeInteger(e) && e >= 0;
|
|
51
75
|
}
|
|
52
|
-
function
|
|
76
|
+
function se(e) {
|
|
53
77
|
return typeof e == "string";
|
|
54
78
|
}
|
|
55
|
-
function
|
|
79
|
+
function ce(e) {
|
|
56
80
|
return e === void 0;
|
|
57
81
|
}
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
available;
|
|
61
|
-
deferredTasks = [];
|
|
62
|
-
constructor(e) {
|
|
63
|
-
this.capacity = e, this.available = e;
|
|
64
|
-
}
|
|
65
|
-
async acquire() {
|
|
66
|
-
if (this.available > 0) {
|
|
67
|
-
this.available--;
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
return new Promise((e) => {
|
|
71
|
-
this.deferredTasks.push(e);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
release() {
|
|
75
|
-
let e = this.deferredTasks.shift();
|
|
76
|
-
if (e != null) {
|
|
77
|
-
e();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.available < this.capacity && this.available++;
|
|
81
|
-
}
|
|
82
|
-
}, le = class {
|
|
83
|
-
semaphore = new ce(1);
|
|
82
|
+
var le = class {
|
|
83
|
+
semaphore = new q(1);
|
|
84
84
|
get isLocked() {
|
|
85
85
|
return this.semaphore.available === 0;
|
|
86
86
|
}
|
|
@@ -92,7 +92,7 @@ var ce = class {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
function ue(e) {
|
|
95
|
-
return e != null && typeof e != "function" &&
|
|
95
|
+
return e != null && typeof e != "function" && oe(e.length);
|
|
96
96
|
}
|
|
97
97
|
function de(e) {
|
|
98
98
|
return typeof e == "string" || typeof e == "symbol" ? e : Object.is(e?.valueOf?.(), -0) ? "-0" : String(e);
|
|
@@ -129,10 +129,10 @@ function ge(e, t = 2 ** 53 - 1) {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
function _e(e) {
|
|
132
|
-
return typeof e == "object" && !!e &&
|
|
132
|
+
return typeof e == "object" && !!e && ie(e) === "[object Arguments]";
|
|
133
133
|
}
|
|
134
134
|
function ve(e, t, n) {
|
|
135
|
-
return me(n) && (typeof t == "number" && ue(n) && ge(t) && t < n.length || typeof t == "string" && t in n) ?
|
|
135
|
+
return me(n) && (typeof t == "number" && ue(n) && ge(t) && t < n.length || typeof t == "string" && t in n) ? ae(n[t], e) : !1;
|
|
136
136
|
}
|
|
137
137
|
function ye(e) {
|
|
138
138
|
return typeof e == "symbol" ? 1 : e === null ? 2 : e === void 0 ? 3 : e === e ? 0 : 4;
|
|
@@ -149,7 +149,7 @@ var be = (e, t, n) => {
|
|
|
149
149
|
return 0;
|
|
150
150
|
}, xe = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Se = /^\w*$/;
|
|
151
151
|
function Ce(e, t) {
|
|
152
|
-
return Array.isArray(e) ? !1 : typeof e == "number" || typeof e == "boolean" || e == null ||
|
|
152
|
+
return Array.isArray(e) ? !1 : typeof e == "number" || typeof e == "boolean" || e == null || ne(e) ? !0 : typeof e == "string" && (Se.test(e) || !xe.test(e)) || t != null && Object.hasOwn(t, e);
|
|
153
153
|
}
|
|
154
154
|
function we(e, t, n, r) {
|
|
155
155
|
if (e == null) return [];
|
|
@@ -175,14 +175,14 @@ function we(e, t, n, r) {
|
|
|
175
175
|
}
|
|
176
176
|
function Te(e, ...t) {
|
|
177
177
|
let n = t.length;
|
|
178
|
-
return n > 1 && ve(e, t[0], t[1]) ? t = [] : n > 2 && ve(t[0], t[1], t[2]) && (t = [t[0]]), we(e,
|
|
178
|
+
return n > 1 && ve(e, t[0], t[1]) ? t = [] : n > 2 && ve(t[0], t[1], t[2]) && (t = [t[0]]), we(e, ee(t), ["asc"]);
|
|
179
179
|
}
|
|
180
180
|
function Ee(e) {
|
|
181
181
|
let t = e?.constructor;
|
|
182
182
|
return e === (typeof t == "function" ? t.prototype : Object.prototype);
|
|
183
183
|
}
|
|
184
184
|
function De(e) {
|
|
185
|
-
return
|
|
185
|
+
return re(e);
|
|
186
186
|
}
|
|
187
187
|
function Oe(e) {
|
|
188
188
|
if (!ue(e)) return {};
|
|
@@ -208,7 +208,7 @@ function Ae(e) {
|
|
|
208
208
|
}
|
|
209
209
|
function je(e) {
|
|
210
210
|
return {
|
|
211
|
-
all: e ||=
|
|
211
|
+
all: e ||= new Map(),
|
|
212
212
|
on: function(t, n) {
|
|
213
213
|
var r = e.get(t);
|
|
214
214
|
r ? r.push(n) : e.set(t, [n]);
|
|
@@ -238,13 +238,13 @@ const Me = je(), Ne = async (e) => {
|
|
|
238
238
|
},
|
|
239
239
|
author: e.author ?? "",
|
|
240
240
|
description: e.description,
|
|
241
|
-
require: (e.require ?
|
|
241
|
+
require: (e.require ? se(e.require) ? [e.require] : e.require : []).map((e) => {
|
|
242
242
|
let [t, ...n] = e.split(":");
|
|
243
243
|
if (t.startsWith("dc|")) return {
|
|
244
244
|
id: t.replace(/^dc\|/, ""),
|
|
245
245
|
download: n.join(":")
|
|
246
246
|
};
|
|
247
|
-
}).filter((e) => !
|
|
247
|
+
}).filter((e) => !ce(e)),
|
|
248
248
|
version: {
|
|
249
249
|
plugin: e.version.split("/")[0],
|
|
250
250
|
supportCore: (() => {
|
|
@@ -253,27 +253,19 @@ const Me = je(), Ne = async (e) => {
|
|
|
253
253
|
})()
|
|
254
254
|
}
|
|
255
255
|
});
|
|
256
|
-
var Fe =
|
|
256
|
+
var Fe = new WeakMap(), Ie = (...e) => {
|
|
257
257
|
let t = e[0], n = p()?.proxy ?? m();
|
|
258
258
|
if (n == null && !g()) throw Error("injectLocal must be called in setup");
|
|
259
259
|
return n && Fe.has(n) && t in Fe.get(n) ? Fe.get(n)[t] : _(...e);
|
|
260
260
|
}, Le = typeof window < "u" && typeof document < "u";
|
|
261
261
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
262
262
|
var Re = Object.prototype.toString, ze = (e) => Re.call(e) === "[object Object]", Be = () => {};
|
|
263
|
-
/**
|
|
264
|
-
* Get a px value for SSR use, do not rely on this method outside of SSR as REM unit is assumed at 16px, which might not be the case on the client
|
|
265
|
-
*/
|
|
266
263
|
function Ve(e) {
|
|
267
264
|
return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
|
|
268
265
|
}
|
|
269
266
|
function He(e) {
|
|
270
267
|
return Array.isArray(e) ? e : [e];
|
|
271
268
|
}
|
|
272
|
-
/**
|
|
273
|
-
* Shorthand for watching value with {immediate: true}
|
|
274
|
-
*
|
|
275
|
-
* @see https://vueuse.org/watchImmediate
|
|
276
|
-
*/
|
|
277
269
|
function Ue(e, t, n) {
|
|
278
270
|
return j(e, t, {
|
|
279
271
|
...n,
|
|
@@ -307,11 +299,6 @@ function We(e, t, n) {
|
|
|
307
299
|
}
|
|
308
300
|
var Ge = Le ? window : void 0;
|
|
309
301
|
Le && window.document, Le && window.navigator, Le && window.location;
|
|
310
|
-
/**
|
|
311
|
-
* Get the dom element of a ref of element or Vue component instance
|
|
312
|
-
*
|
|
313
|
-
* @param elRef
|
|
314
|
-
*/
|
|
315
302
|
function Ke(e) {
|
|
316
303
|
let t = k(e);
|
|
317
304
|
return t?.$el ?? t;
|
|
@@ -334,39 +321,23 @@ function qe(...e) {
|
|
|
334
321
|
});
|
|
335
322
|
}, { flush: "post" });
|
|
336
323
|
}
|
|
337
|
-
/**
|
|
338
|
-
* Mounted state in ref.
|
|
339
|
-
*
|
|
340
|
-
* @see https://vueuse.org/useMounted
|
|
341
|
-
*
|
|
342
|
-
* @__NO_SIDE_EFFECTS__
|
|
343
|
-
*/
|
|
344
324
|
function Je() {
|
|
345
325
|
let e = O(!1), t = p();
|
|
346
326
|
return t && x(() => {
|
|
347
327
|
e.value = !0;
|
|
348
328
|
}, t), e;
|
|
349
329
|
}
|
|
350
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
351
330
|
function Ye(e) {
|
|
352
331
|
let t = Je();
|
|
353
332
|
return s(() => (t.value, !!e()));
|
|
354
333
|
}
|
|
355
334
|
var Xe = Symbol("vueuse-ssr-width");
|
|
356
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
357
335
|
function Ze() {
|
|
358
336
|
let e = g() ? Ie(Xe, null) : null;
|
|
359
337
|
return typeof e == "number" ? e : void 0;
|
|
360
338
|
}
|
|
361
|
-
/**
|
|
362
|
-
* Reactive Media Query.
|
|
363
|
-
*
|
|
364
|
-
* @see https://vueuse.org/useMediaQuery
|
|
365
|
-
* @param query
|
|
366
|
-
* @param options
|
|
367
|
-
*/
|
|
368
339
|
function Qe(e, t = {}) {
|
|
369
|
-
let { window: n = Ge, ssrWidth: r =
|
|
340
|
+
let { window: n = Ge, ssrWidth: r = Ze() } = t, i = Ye(() => n && "matchMedia" in n && typeof n.matchMedia == "function"), a = O(typeof r == "number"), o = O(), c = O(!1);
|
|
370
341
|
return M(() => {
|
|
371
342
|
if (a.value) {
|
|
372
343
|
a.value = !i.value, c.value = k(e).split(",").some((e) => {
|
|
@@ -380,14 +351,6 @@ function Qe(e, t = {}) {
|
|
|
380
351
|
c.value = e.matches;
|
|
381
352
|
}, { passive: !0 }), s(() => c.value);
|
|
382
353
|
}
|
|
383
|
-
/**
|
|
384
|
-
* Reactive dark theme preference.
|
|
385
|
-
*
|
|
386
|
-
* @see https://vueuse.org/usePreferredDark
|
|
387
|
-
* @param [options]
|
|
388
|
-
*
|
|
389
|
-
* @__NO_SIDE_EFFECTS__
|
|
390
|
-
*/
|
|
391
354
|
function $e(e) {
|
|
392
355
|
return Qe("(prefers-color-scheme: dark)", e);
|
|
393
356
|
}
|
|
@@ -440,7 +403,7 @@ const tt = a(new et("core", {
|
|
|
440
403
|
placeholder: "仅用于解除api访问限制"
|
|
441
404
|
}
|
|
442
405
|
}, "核心"), "core/plugin/config"), nt = P("config", (e) => {
|
|
443
|
-
let t = D(
|
|
406
|
+
let t = D(new Map()), n = e.action((e) => {
|
|
444
407
|
let n = t.get(e.key);
|
|
445
408
|
if (!n) throw Error(`not found config by plugin "${e.pluginName}"`);
|
|
446
409
|
return n.value;
|
|
@@ -466,45 +429,45 @@ const tt = a(new et("core", {
|
|
|
466
429
|
});
|
|
467
430
|
}, "resignerConfig")
|
|
468
431
|
};
|
|
469
|
-
}), rt = (e) => Symbol.for(`expose:${e}`), it = (e) => at.get(e), at =
|
|
432
|
+
}), rt = (e) => Symbol.for(`expose:${e}`), it = (e) => at.get(e), at = new Map(), J = a(new class {
|
|
470
433
|
share = D(I.create());
|
|
471
434
|
shareToken = D(I.create());
|
|
472
435
|
userActions = D(I.create());
|
|
473
436
|
subscribes = D(I.create());
|
|
474
437
|
globalNodes = D([]);
|
|
475
|
-
tabbar = D(
|
|
438
|
+
tabbar = D(new Map());
|
|
476
439
|
addTabbar(e, ...t) {
|
|
477
440
|
let n = this.tabbar.get(e) ?? [];
|
|
478
441
|
this.tabbar.set(e, n.concat(t));
|
|
479
442
|
}
|
|
480
|
-
categories = D(
|
|
443
|
+
categories = D(new Map());
|
|
481
444
|
addCategories(e, ...t) {
|
|
482
445
|
let n = this.categories.get(e) ?? [];
|
|
483
446
|
this.categories.set(e, n.concat(t));
|
|
484
447
|
}
|
|
485
|
-
barcode = D(
|
|
448
|
+
barcode = D(new Map());
|
|
486
449
|
addBarcode(e, ...t) {
|
|
487
450
|
let n = this.barcode.get(e) ?? [];
|
|
488
451
|
this.barcode.set(e, n.concat(t));
|
|
489
452
|
}
|
|
490
|
-
levelboard = D(
|
|
453
|
+
levelboard = D(new Map());
|
|
491
454
|
addLevelboard(e, ...t) {
|
|
492
455
|
let n = this.levelboard.get(e) ?? [];
|
|
493
456
|
this.levelboard.set(e, n.concat(t));
|
|
494
457
|
}
|
|
495
|
-
topButton = D(
|
|
458
|
+
topButton = D(new Map());
|
|
496
459
|
addTopButton(e, ...t) {
|
|
497
460
|
let n = this.topButton.get(e) ?? [];
|
|
498
461
|
this.topButton.set(e, n.concat(t));
|
|
499
462
|
}
|
|
500
|
-
mainLists = D(
|
|
463
|
+
mainLists = D(new Map());
|
|
501
464
|
addMainList(e, ...t) {
|
|
502
465
|
let n = this.mainLists.get(e) ?? [];
|
|
503
466
|
this.mainLists.set(e, n.concat(t));
|
|
504
467
|
}
|
|
505
|
-
envExtends = D(
|
|
468
|
+
envExtends = D(new Set());
|
|
506
469
|
}(), "core/global");
|
|
507
|
-
var ot =
|
|
470
|
+
var ot = G(((e, t) => {
|
|
508
471
|
var n = (function() {
|
|
509
472
|
var e = String.fromCharCode, t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$", r = {};
|
|
510
473
|
function i(e, t) {
|
|
@@ -662,7 +625,7 @@ var ot = (/* @__PURE__ */ G(((e, t) => {
|
|
|
662
625
|
}) : t !== void 0 && t != null ? t.exports = n : typeof angular < "u" && angular != null && angular.module("LZString", []).factory("LZString", function() {
|
|
663
626
|
return n;
|
|
664
627
|
});
|
|
665
|
-
}))
|
|
628
|
+
}))();
|
|
666
629
|
const st = () => d("svg", {
|
|
667
630
|
xmlns: "http://www.w3.org/2000/svg",
|
|
668
631
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -688,7 +651,7 @@ const st = () => d("svg", {
|
|
|
688
651
|
d: "M938 458.8l-29.6-312.6c-1.5-16.2-14.4-29-30.6-30.6L565.2 86h-.4c-3.2 0-5.7 1-7.6 2.9L88.9 557.2a9.96 9.96 0 0 0 0 14.1l363.8 363.8c1.9 1.9 4.4 2.9 7.1 2.9s5.2-1 7.1-2.9l468.3-468.3c2-2.1 3-5 2.8-8zM459.7 834.7L189.3 564.3L589 164.6L836 188l23.4 247l-399.7 399.7zM680 256c-48.5 0-88 39.5-88 88s39.5 88 88 88s88-39.5 88-88s-39.5-88-88-88zm0 120c-17.7 0-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32z",
|
|
689
652
|
fill: "currentColor"
|
|
690
653
|
}, null)]), lt = a(P("plugin", (e) => {
|
|
691
|
-
let t = D(
|
|
654
|
+
let t = D(new Map()), n = C({}), i = We(async () => Object.fromEntries((await r.value.selectFrom("plugin").select(["pluginName", "displayName"]).execute()).map((e) => [e.pluginName, e.displayName])), {}), a = s(() => Array.from(t.values()).filter((e) => e.search?.methods).map((e) => [e.name, Object.entries(e.search?.methods ?? {})]));
|
|
692
655
|
return {
|
|
693
656
|
$getPluginDisplayName: e.action((e) => i.value[e] || e, "getPluginDisplayName"),
|
|
694
657
|
plugins: t,
|
|
@@ -771,20 +734,6 @@ const st = () => d("svg", {
|
|
|
771
734
|
}
|
|
772
735
|
}), Y = "core";
|
|
773
736
|
a(rt(Y), "core/plugin/coreFlag");
|
|
774
|
-
/******************************************************************************
|
|
775
|
-
Copyright (c) Microsoft Corporation.
|
|
776
|
-
|
|
777
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
778
|
-
purpose with or without fee is hereby granted.
|
|
779
|
-
|
|
780
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
781
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
782
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
783
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
784
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
785
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
786
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
787
|
-
***************************************************************************** */
|
|
788
737
|
function dt(e, t, n, r) {
|
|
789
738
|
if (n === "a" && !r) throw TypeError("Private accessor was defined without a getter");
|
|
790
739
|
if (typeof t == "function" ? e !== t || !r : !t.has(e)) throw TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -797,79 +746,12 @@ function ft(e, t, n, r, i) {
|
|
|
797
746
|
return r === "a" ? i.call(e, n) : i ? i.value = n : t.set(e, n), n;
|
|
798
747
|
}
|
|
799
748
|
var pt;
|
|
800
|
-
/**
|
|
801
|
-
* Sends a message to the backend.
|
|
802
|
-
* @example
|
|
803
|
-
* ```typescript
|
|
804
|
-
* import { invoke } from '@tauri-apps/api/core';
|
|
805
|
-
* await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });
|
|
806
|
-
* ```
|
|
807
|
-
*
|
|
808
|
-
* @param cmd The command name.
|
|
809
|
-
* @param args The optional arguments to pass to the command.
|
|
810
|
-
* @param options The request options.
|
|
811
|
-
* @return A promise resolving or rejecting to the backend response.
|
|
812
|
-
*
|
|
813
|
-
* @since 1.0.0
|
|
814
|
-
*/
|
|
815
749
|
async function X(e, t = {}, n) {
|
|
816
750
|
return window.__TAURI_INTERNALS__.invoke(e, t, n);
|
|
817
751
|
}
|
|
818
|
-
/**
|
|
819
|
-
* Convert a device file path to an URL that can be loaded by the webview.
|
|
820
|
-
* Note that `asset:` and `http://asset.localhost` must be added to [`app.security.csp`](https://v2.tauri.app/reference/config/#csp-1) in `tauri.conf.json`.
|
|
821
|
-
* Example CSP value: `"csp": "default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost"` to use the asset protocol on image sources.
|
|
822
|
-
*
|
|
823
|
-
* Additionally, `"enable" : "true"` must be added to [`app.security.assetProtocol`](https://v2.tauri.app/reference/config/#assetprotocolconfig)
|
|
824
|
-
* in `tauri.conf.json` and its access scope must be defined on the `scope` array on the same `assetProtocol` object.
|
|
825
|
-
*
|
|
826
|
-
* @param filePath The file path.
|
|
827
|
-
* @param protocol The protocol to use. Defaults to `asset`. You only need to set this when using a custom protocol.
|
|
828
|
-
* @example
|
|
829
|
-
* ```typescript
|
|
830
|
-
* import { appDataDir, join } from '@tauri-apps/api/path';
|
|
831
|
-
* import { convertFileSrc } from '@tauri-apps/api/core';
|
|
832
|
-
* const appDataDirPath = await appDataDir();
|
|
833
|
-
* const filePath = await join(appDataDirPath, 'assets/video.mp4');
|
|
834
|
-
* const assetUrl = convertFileSrc(filePath);
|
|
835
|
-
*
|
|
836
|
-
* const video = document.getElementById('my-video');
|
|
837
|
-
* const source = document.createElement('source');
|
|
838
|
-
* source.type = 'video/mp4';
|
|
839
|
-
* source.src = assetUrl;
|
|
840
|
-
* video.appendChild(source);
|
|
841
|
-
* video.load();
|
|
842
|
-
* ```
|
|
843
|
-
*
|
|
844
|
-
* @return the URL that can be used as source on the webview.
|
|
845
|
-
*
|
|
846
|
-
* @since 1.0.0
|
|
847
|
-
*/
|
|
848
752
|
function mt(e, t = "asset") {
|
|
849
753
|
return window.__TAURI_INTERNALS__.convertFileSrc(e, t);
|
|
850
754
|
}
|
|
851
|
-
/**
|
|
852
|
-
* A rust-backed resource stored through `tauri::Manager::resources_table` API.
|
|
853
|
-
*
|
|
854
|
-
* The resource lives in the main process and does not exist
|
|
855
|
-
* in the Javascript world, and thus will not be cleaned up automatically
|
|
856
|
-
* except on application exit. If you want to clean it up early, call {@linkcode Resource.close}
|
|
857
|
-
*
|
|
858
|
-
* @example
|
|
859
|
-
* ```typescript
|
|
860
|
-
* import { Resource, invoke } from '@tauri-apps/api/core';
|
|
861
|
-
* export class DatabaseHandle extends Resource {
|
|
862
|
-
* static async open(path: string): Promise<DatabaseHandle> {
|
|
863
|
-
* const rid: number = await invoke('open_db', { path });
|
|
864
|
-
* return new DatabaseHandle(rid);
|
|
865
|
-
* }
|
|
866
|
-
*
|
|
867
|
-
* async execute(sql: string): Promise<void> {
|
|
868
|
-
* await invoke('execute_sql', { rid: this.rid, sql });
|
|
869
|
-
* }
|
|
870
|
-
* }
|
|
871
|
-
* ```
|
|
872
|
-
*/
|
|
873
755
|
var ht = class {
|
|
874
756
|
get rid() {
|
|
875
757
|
return dt(this, pt, "f");
|
|
@@ -877,58 +759,18 @@ var ht = class {
|
|
|
877
759
|
constructor(e) {
|
|
878
760
|
pt.set(this, void 0), ft(this, pt, e, "f");
|
|
879
761
|
}
|
|
880
|
-
/**
|
|
881
|
-
* Destroys and cleans up this resource from memory.
|
|
882
|
-
* **You should not call any method on this object anymore and should drop any reference to it.**
|
|
883
|
-
*/
|
|
884
762
|
async close() {
|
|
885
763
|
return X("plugin:resources|close", { rid: this.rid });
|
|
886
764
|
}
|
|
887
765
|
};
|
|
888
|
-
pt =
|
|
889
|
-
/**
|
|
890
|
-
* The path module provides utilities for working with file and directory paths.
|
|
891
|
-
*
|
|
892
|
-
* This package is also accessible with `window.__TAURI__.path` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`.
|
|
893
|
-
*
|
|
894
|
-
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
|
|
895
|
-
* @module
|
|
896
|
-
*/
|
|
897
|
-
/**
|
|
898
|
-
* @since 2.0.0
|
|
899
|
-
*/
|
|
766
|
+
pt = new WeakMap();
|
|
900
767
|
var gt;
|
|
901
768
|
(function(e) {
|
|
902
|
-
/**
|
|
903
|
-
* @see {@link templateDir} for more information.
|
|
904
|
-
*/
|
|
905
769
|
e[e.Audio = 1] = "Audio", e[e.Cache = 2] = "Cache", e[e.Config = 3] = "Config", e[e.Data = 4] = "Data", e[e.LocalData = 5] = "LocalData", e[e.Document = 6] = "Document", e[e.Download = 7] = "Download", e[e.Picture = 8] = "Picture", e[e.Public = 9] = "Public", e[e.Video = 10] = "Video", e[e.Resource = 11] = "Resource", e[e.Temp = 12] = "Temp", e[e.AppConfig = 13] = "AppConfig", e[e.AppData = 14] = "AppData", e[e.AppLocalData = 15] = "AppLocalData", e[e.AppCache = 16] = "AppCache", e[e.AppLog = 17] = "AppLog", e[e.Desktop = 18] = "Desktop", e[e.Executable = 19] = "Executable", e[e.Font = 20] = "Font", e[e.Home = 21] = "Home", e[e.Runtime = 22] = "Runtime", e[e.Template = 23] = "Template";
|
|
906
770
|
})(gt ||= {});
|
|
907
|
-
/**
|
|
908
|
-
* Returns the path to the suggested directory for your app's local data files.
|
|
909
|
-
* Resolves to `${localDataDir}/${bundleIdentifier}`, where `bundleIdentifier` is the [`identifier`](https://v2.tauri.app/reference/config/#identifier) value configured in `tauri.conf.json`.
|
|
910
|
-
* @example
|
|
911
|
-
* ```typescript
|
|
912
|
-
* import { appLocalDataDir } from '@tauri-apps/api/path';
|
|
913
|
-
* const appLocalDataDirPath = await appLocalDataDir();
|
|
914
|
-
* ```
|
|
915
|
-
*
|
|
916
|
-
* @since 1.2.0
|
|
917
|
-
*/
|
|
918
771
|
async function _t() {
|
|
919
772
|
return X("plugin:path|resolve_directory", { directory: gt.AppLocalData });
|
|
920
773
|
}
|
|
921
|
-
/**
|
|
922
|
-
* Joins all given `path` segments together using the platform-specific separator as a delimiter, then normalizes the resulting path.
|
|
923
|
-
* @example
|
|
924
|
-
* ```typescript
|
|
925
|
-
* import { join, appDataDir } from '@tauri-apps/api/path';
|
|
926
|
-
* const appDataDirPath = await appDataDir();
|
|
927
|
-
* const path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');
|
|
928
|
-
* ```
|
|
929
|
-
*
|
|
930
|
-
* @since 1.0.0
|
|
931
|
-
*/
|
|
932
774
|
async function Z(...e) {
|
|
933
775
|
return X("plugin:path|join", { paths: e });
|
|
934
776
|
}
|
|
@@ -1133,7 +975,6 @@ function Pt(e) {
|
|
|
1133
975
|
blocks: e.blocks
|
|
1134
976
|
};
|
|
1135
977
|
}
|
|
1136
|
-
/** Converts a big-endian eight byte array to number */
|
|
1137
978
|
function Ft(e) {
|
|
1138
979
|
let t = new Uint8ClampedArray(e), n = t.byteLength, r = 0;
|
|
1139
980
|
for (let e = 0; e < n; e++) {
|
|
@@ -1142,43 +983,7 @@ function Ft(e) {
|
|
|
1142
983
|
}
|
|
1143
984
|
return r;
|
|
1144
985
|
}
|
|
1145
|
-
/**
|
|
1146
|
-
* The Tauri abstraction for reading and writing files.
|
|
1147
|
-
*
|
|
1148
|
-
* @since 2.0.0
|
|
1149
|
-
*/
|
|
1150
986
|
var It = class extends ht {
|
|
1151
|
-
/**
|
|
1152
|
-
* Reads up to `p.byteLength` bytes into `p`. It resolves to the number of
|
|
1153
|
-
* bytes read (`0` < `n` <= `p.byteLength`) and rejects if any error
|
|
1154
|
-
* encountered. Even if `read()` resolves to `n` < `p.byteLength`, it may
|
|
1155
|
-
* use all of `p` as scratch space during the call. If some data is
|
|
1156
|
-
* available but not `p.byteLength` bytes, `read()` conventionally resolves
|
|
1157
|
-
* to what is available instead of waiting for more.
|
|
1158
|
-
*
|
|
1159
|
-
* When `read()` encounters end-of-file condition, it resolves to EOF
|
|
1160
|
-
* (`null`).
|
|
1161
|
-
*
|
|
1162
|
-
* When `read()` encounters an error, it rejects with an error.
|
|
1163
|
-
*
|
|
1164
|
-
* Callers should always process the `n` > `0` bytes returned before
|
|
1165
|
-
* considering the EOF (`null`). Doing so correctly handles I/O errors that
|
|
1166
|
-
* happen after reading some bytes and also both of the allowed EOF
|
|
1167
|
-
* behaviors.
|
|
1168
|
-
*
|
|
1169
|
-
* @example
|
|
1170
|
-
* ```typescript
|
|
1171
|
-
* import { open, BaseDirectory } from "@tauri-apps/plugin-fs"
|
|
1172
|
-
* // if "$APPCONFIG/foo/bar.txt" contains the text "hello world":
|
|
1173
|
-
* const file = await open("foo/bar.txt", { baseDir: BaseDirectory.AppConfig });
|
|
1174
|
-
* const buf = new Uint8Array(100);
|
|
1175
|
-
* const numberOfBytesRead = await file.read(buf); // 11 bytes
|
|
1176
|
-
* const text = new TextDecoder().decode(buf); // "hello world"
|
|
1177
|
-
* await file.close();
|
|
1178
|
-
* ```
|
|
1179
|
-
*
|
|
1180
|
-
* @since 2.0.0
|
|
1181
|
-
*/
|
|
1182
987
|
async read(e) {
|
|
1183
988
|
if (e.byteLength === 0) return 0;
|
|
1184
989
|
let t = await X("plugin:fs|read", {
|
|
@@ -1187,38 +992,6 @@ var It = class extends ht {
|
|
|
1187
992
|
}), n = Ft(t.slice(-8)), r = t instanceof ArrayBuffer ? new Uint8Array(t) : t;
|
|
1188
993
|
return e.set(r.slice(0, r.length - 8)), n === 0 ? null : n;
|
|
1189
994
|
}
|
|
1190
|
-
/**
|
|
1191
|
-
* Seek sets the offset for the next `read()` or `write()` to offset,
|
|
1192
|
-
* interpreted according to `whence`: `Start` means relative to the
|
|
1193
|
-
* start of the file, `Current` means relative to the current offset,
|
|
1194
|
-
* and `End` means relative to the end. Seek resolves to the new offset
|
|
1195
|
-
* relative to the start of the file.
|
|
1196
|
-
*
|
|
1197
|
-
* Seeking to an offset before the start of the file is an error. Seeking to
|
|
1198
|
-
* any positive offset is legal, but the behavior of subsequent I/O
|
|
1199
|
-
* operations on the underlying object is implementation-dependent.
|
|
1200
|
-
* It returns the number of cursor position.
|
|
1201
|
-
*
|
|
1202
|
-
* @example
|
|
1203
|
-
* ```typescript
|
|
1204
|
-
* import { open, SeekMode, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1205
|
-
*
|
|
1206
|
-
* // Given hello.txt pointing to file with "Hello world", which is 11 bytes long:
|
|
1207
|
-
* const file = await open('hello.txt', { read: true, write: true, truncate: true, create: true, baseDir: BaseDirectory.AppLocalData });
|
|
1208
|
-
* await file.write(new TextEncoder().encode("Hello world"));
|
|
1209
|
-
*
|
|
1210
|
-
* // Seek 6 bytes from the start of the file
|
|
1211
|
-
* console.log(await file.seek(6, SeekMode.Start)); // "6"
|
|
1212
|
-
* // Seek 2 more bytes from the current position
|
|
1213
|
-
* console.log(await file.seek(2, SeekMode.Current)); // "8"
|
|
1214
|
-
* // Seek backwards 2 bytes from the end of the file
|
|
1215
|
-
* console.log(await file.seek(-2, SeekMode.End)); // "9" (e.g. 11-2)
|
|
1216
|
-
*
|
|
1217
|
-
* await file.close();
|
|
1218
|
-
* ```
|
|
1219
|
-
*
|
|
1220
|
-
* @since 2.0.0
|
|
1221
|
-
*/
|
|
1222
995
|
async seek(e, t) {
|
|
1223
996
|
return await X("plugin:fs|seek", {
|
|
1224
997
|
rid: this.rid,
|
|
@@ -1226,73 +999,15 @@ var It = class extends ht {
|
|
|
1226
999
|
whence: t
|
|
1227
1000
|
});
|
|
1228
1001
|
}
|
|
1229
|
-
/**
|
|
1230
|
-
* Returns a {@linkcode FileInfo } for this file.
|
|
1231
|
-
*
|
|
1232
|
-
* @example
|
|
1233
|
-
* ```typescript
|
|
1234
|
-
* import { open, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1235
|
-
* const file = await open("file.txt", { read: true, baseDir: BaseDirectory.AppLocalData });
|
|
1236
|
-
* const fileInfo = await file.stat();
|
|
1237
|
-
* console.log(fileInfo.isFile); // true
|
|
1238
|
-
* await file.close();
|
|
1239
|
-
* ```
|
|
1240
|
-
*
|
|
1241
|
-
* @since 2.0.0
|
|
1242
|
-
*/
|
|
1243
1002
|
async stat() {
|
|
1244
1003
|
return Pt(await X("plugin:fs|fstat", { rid: this.rid }));
|
|
1245
1004
|
}
|
|
1246
|
-
/**
|
|
1247
|
-
* Truncates or extends this file, to reach the specified `len`.
|
|
1248
|
-
* If `len` is not specified then the entire file contents are truncated.
|
|
1249
|
-
*
|
|
1250
|
-
* @example
|
|
1251
|
-
* ```typescript
|
|
1252
|
-
* import { open, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1253
|
-
*
|
|
1254
|
-
* // truncate the entire file
|
|
1255
|
-
* const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.AppLocalData });
|
|
1256
|
-
* await file.truncate();
|
|
1257
|
-
*
|
|
1258
|
-
* // truncate part of the file
|
|
1259
|
-
* const file = await open("my_file.txt", { read: true, write: true, create: true, baseDir: BaseDirectory.AppLocalData });
|
|
1260
|
-
* await file.write(new TextEncoder().encode("Hello World"));
|
|
1261
|
-
* await file.truncate(7);
|
|
1262
|
-
* const data = new Uint8Array(32);
|
|
1263
|
-
* await file.read(data);
|
|
1264
|
-
* console.log(new TextDecoder().decode(data)); // Hello W
|
|
1265
|
-
* await file.close();
|
|
1266
|
-
* ```
|
|
1267
|
-
*
|
|
1268
|
-
* @since 2.0.0
|
|
1269
|
-
*/
|
|
1270
1005
|
async truncate(e) {
|
|
1271
1006
|
await X("plugin:fs|ftruncate", {
|
|
1272
1007
|
rid: this.rid,
|
|
1273
1008
|
len: e
|
|
1274
1009
|
});
|
|
1275
1010
|
}
|
|
1276
|
-
/**
|
|
1277
|
-
* Writes `data.byteLength` bytes from `data` to the underlying data stream. It
|
|
1278
|
-
* resolves to the number of bytes written from `data` (`0` <= `n` <=
|
|
1279
|
-
* `data.byteLength`) or reject with the error encountered that caused the
|
|
1280
|
-
* write to stop early. `write()` must reject with a non-null error if
|
|
1281
|
-
* would resolve to `n` < `data.byteLength`. `write()` must not modify the
|
|
1282
|
-
* slice data, even temporarily.
|
|
1283
|
-
*
|
|
1284
|
-
* @example
|
|
1285
|
-
* ```typescript
|
|
1286
|
-
* import { open, write, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1287
|
-
* const encoder = new TextEncoder();
|
|
1288
|
-
* const data = encoder.encode("Hello world");
|
|
1289
|
-
* const file = await open("bar.txt", { write: true, baseDir: BaseDirectory.AppLocalData });
|
|
1290
|
-
* const bytesWritten = await file.write(data); // 11
|
|
1291
|
-
* await file.close();
|
|
1292
|
-
* ```
|
|
1293
|
-
*
|
|
1294
|
-
* @since 2.0.0
|
|
1295
|
-
*/
|
|
1296
1011
|
async write(e) {
|
|
1297
1012
|
return await X("plugin:fs|write", {
|
|
1298
1013
|
rid: this.rid,
|
|
@@ -1300,22 +1015,6 @@ var It = class extends ht {
|
|
|
1300
1015
|
});
|
|
1301
1016
|
}
|
|
1302
1017
|
};
|
|
1303
|
-
/**
|
|
1304
|
-
* Open a file and resolve to an instance of {@linkcode FileHandle}. The
|
|
1305
|
-
* file does not need to previously exist if using the `create` or `createNew`
|
|
1306
|
-
* open options. It is the callers responsibility to close the file when finished
|
|
1307
|
-
* with it.
|
|
1308
|
-
*
|
|
1309
|
-
* @example
|
|
1310
|
-
* ```typescript
|
|
1311
|
-
* import { open, BaseDirectory } from "@tauri-apps/plugin-fs"
|
|
1312
|
-
* const file = await open("foo/bar.txt", { read: true, write: true, baseDir: BaseDirectory.AppLocalData });
|
|
1313
|
-
* // Do work with file
|
|
1314
|
-
* await file.close();
|
|
1315
|
-
* ```
|
|
1316
|
-
*
|
|
1317
|
-
* @since 2.0.0
|
|
1318
|
-
*/
|
|
1319
1018
|
async function Lt(e, t) {
|
|
1320
1019
|
if (e instanceof URL && e.protocol !== "file:") throw TypeError("Must be a file URL.");
|
|
1321
1020
|
return new It(await X("plugin:fs|open", {
|
|
@@ -1323,16 +1022,6 @@ async function Lt(e, t) {
|
|
|
1323
1022
|
options: t
|
|
1324
1023
|
}));
|
|
1325
1024
|
}
|
|
1326
|
-
/**
|
|
1327
|
-
* Creates a new directory with the specified path.
|
|
1328
|
-
* @example
|
|
1329
|
-
* ```typescript
|
|
1330
|
-
* import { mkdir, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1331
|
-
* await mkdir('users', { baseDir: BaseDirectory.AppLocalData });
|
|
1332
|
-
* ```
|
|
1333
|
-
*
|
|
1334
|
-
* @since 2.0.0
|
|
1335
|
-
*/
|
|
1336
1025
|
async function Rt(e, t) {
|
|
1337
1026
|
if (e instanceof URL && e.protocol !== "file:") throw TypeError("Must be a file URL.");
|
|
1338
1027
|
await X("plugin:fs|mkdir", {
|
|
@@ -1340,28 +1029,6 @@ async function Rt(e, t) {
|
|
|
1340
1029
|
options: t
|
|
1341
1030
|
});
|
|
1342
1031
|
}
|
|
1343
|
-
/**
|
|
1344
|
-
* Reads the directory given by path and returns an array of `DirEntry`.
|
|
1345
|
-
* @example
|
|
1346
|
-
* ```typescript
|
|
1347
|
-
* import { readDir, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1348
|
-
* import { join } from '@tauri-apps/api/path';
|
|
1349
|
-
* const dir = "users"
|
|
1350
|
-
* const entries = await readDir('users', { baseDir: BaseDirectory.AppLocalData });
|
|
1351
|
-
* processEntriesRecursively(dir, entries);
|
|
1352
|
-
* async function processEntriesRecursively(parent, entries) {
|
|
1353
|
-
* for (const entry of entries) {
|
|
1354
|
-
* console.log(`Entry: ${entry.name}`);
|
|
1355
|
-
* if (entry.isDirectory) {
|
|
1356
|
-
* const dir = await join(parent, entry.name);
|
|
1357
|
-
* processEntriesRecursively(dir, await readDir(dir, { baseDir: BaseDirectory.AppLocalData }))
|
|
1358
|
-
* }
|
|
1359
|
-
* }
|
|
1360
|
-
* }
|
|
1361
|
-
* ```
|
|
1362
|
-
*
|
|
1363
|
-
* @since 2.0.0
|
|
1364
|
-
*/
|
|
1365
1032
|
async function zt(e, t) {
|
|
1366
1033
|
if (e instanceof URL && e.protocol !== "file:") throw TypeError("Must be a file URL.");
|
|
1367
1034
|
return await X("plugin:fs|read_dir", {
|
|
@@ -1369,17 +1036,6 @@ async function zt(e, t) {
|
|
|
1369
1036
|
options: t
|
|
1370
1037
|
});
|
|
1371
1038
|
}
|
|
1372
|
-
/**
|
|
1373
|
-
* Reads and resolves to the entire contents of a file as an array of bytes.
|
|
1374
|
-
* TextDecoder can be used to transform the bytes to string if required.
|
|
1375
|
-
* @example
|
|
1376
|
-
* ```typescript
|
|
1377
|
-
* import { readFile, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1378
|
-
* const contents = await readFile('avatar.png', { baseDir: BaseDirectory.Resource });
|
|
1379
|
-
* ```
|
|
1380
|
-
*
|
|
1381
|
-
* @since 2.0.0
|
|
1382
|
-
*/
|
|
1383
1039
|
async function Bt(e, t) {
|
|
1384
1040
|
if (e instanceof URL && e.protocol !== "file:") throw TypeError("Must be a file URL.");
|
|
1385
1041
|
let n = await X("plugin:fs|read_file", {
|
|
@@ -1388,16 +1044,6 @@ async function Bt(e, t) {
|
|
|
1388
1044
|
});
|
|
1389
1045
|
return n instanceof ArrayBuffer ? new Uint8Array(n) : Uint8Array.from(n);
|
|
1390
1046
|
}
|
|
1391
|
-
/**
|
|
1392
|
-
* Reads and returns the entire contents of a file as UTF-8 string.
|
|
1393
|
-
* @example
|
|
1394
|
-
* ```typescript
|
|
1395
|
-
* import { readTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1396
|
-
* const contents = await readTextFile('app.conf', { baseDir: BaseDirectory.AppConfig });
|
|
1397
|
-
* ```
|
|
1398
|
-
*
|
|
1399
|
-
* @since 2.0.0
|
|
1400
|
-
*/
|
|
1401
1047
|
async function Vt(e, t) {
|
|
1402
1048
|
if (e instanceof URL && e.protocol !== "file:") throw TypeError("Must be a file URL.");
|
|
1403
1049
|
let n = await X("plugin:fs|read_text_file", {
|
|
@@ -1406,18 +1052,6 @@ async function Vt(e, t) {
|
|
|
1406
1052
|
}), r = n instanceof ArrayBuffer ? n : Uint8Array.from(n);
|
|
1407
1053
|
return new TextDecoder().decode(r);
|
|
1408
1054
|
}
|
|
1409
|
-
/**
|
|
1410
|
-
* Removes the named file or directory.
|
|
1411
|
-
* If the directory is not empty and the `recursive` option isn't set to true, the promise will be rejected.
|
|
1412
|
-
* @example
|
|
1413
|
-
* ```typescript
|
|
1414
|
-
* import { remove, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1415
|
-
* await remove('users/file.txt', { baseDir: BaseDirectory.AppLocalData });
|
|
1416
|
-
* await remove('users', { baseDir: BaseDirectory.AppLocalData });
|
|
1417
|
-
* ```
|
|
1418
|
-
*
|
|
1419
|
-
* @since 2.0.0
|
|
1420
|
-
*/
|
|
1421
1055
|
async function Ht(e, t) {
|
|
1422
1056
|
if (e instanceof URL && e.protocol !== "file:") throw TypeError("Must be a file URL.");
|
|
1423
1057
|
await X("plugin:fs|remove", {
|
|
@@ -1425,19 +1059,6 @@ async function Ht(e, t) {
|
|
|
1425
1059
|
options: t
|
|
1426
1060
|
});
|
|
1427
1061
|
}
|
|
1428
|
-
/**
|
|
1429
|
-
* Write `data` to the given `path`, by default creating a new file if needed, else overwriting.
|
|
1430
|
-
* @example
|
|
1431
|
-
* ```typescript
|
|
1432
|
-
* import { writeFile, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1433
|
-
*
|
|
1434
|
-
* let encoder = new TextEncoder();
|
|
1435
|
-
* let data = encoder.encode("Hello World");
|
|
1436
|
-
* await writeFile('file.txt', data, { baseDir: BaseDirectory.AppLocalData });
|
|
1437
|
-
* ```
|
|
1438
|
-
*
|
|
1439
|
-
* @since 2.0.0
|
|
1440
|
-
*/
|
|
1441
1062
|
async function Ut(e, t, n) {
|
|
1442
1063
|
if (e instanceof URL && e.protocol !== "file:") throw TypeError("Must be a file URL.");
|
|
1443
1064
|
if (t instanceof ReadableStream) {
|
|
@@ -1461,17 +1082,6 @@ async function Ut(e, t, n) {
|
|
|
1461
1082
|
options: JSON.stringify(n)
|
|
1462
1083
|
} });
|
|
1463
1084
|
}
|
|
1464
|
-
/**
|
|
1465
|
-
* Writes UTF-8 string `data` to the given `path`, by default creating a new file if needed, else overwriting.
|
|
1466
|
-
@example
|
|
1467
|
-
* ```typescript
|
|
1468
|
-
* import { writeTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
1469
|
-
*
|
|
1470
|
-
* await writeTextFile('file.txt', "Hello world", { baseDir: BaseDirectory.AppLocalData });
|
|
1471
|
-
* ```
|
|
1472
|
-
*
|
|
1473
|
-
* @since 2.0.0
|
|
1474
|
-
*/
|
|
1475
1085
|
async function Wt(e, t, n) {
|
|
1476
1086
|
if (e instanceof URL && e.protocol !== "file:") throw TypeError("Must be a file URL.");
|
|
1477
1087
|
await X("plugin:fs|write_text_file", new TextEncoder().encode(t), { headers: {
|
|
@@ -1650,7 +1260,7 @@ function bn(e) {
|
|
|
1650
1260
|
}
|
|
1651
1261
|
function xn(e, t, n, r) {
|
|
1652
1262
|
var i = e[n], a = [];
|
|
1653
|
-
if (yn(i) && i !== "") if (typeof i == "string" || typeof i == "number" || typeof i == "boolean") i = i.toString(), r && r !== "*" && (i = i.substring(0, parseInt(r, 10))), a.push(vn(t, i, bn(t) ? n : ""));
|
|
1263
|
+
if (yn(i) && i !== "") if (typeof i == "string" || typeof i == "number" || typeof i == "bigint" || typeof i == "boolean") i = i.toString(), r && r !== "*" && (i = i.substring(0, parseInt(r, 10))), a.push(vn(t, i, bn(t) ? n : ""));
|
|
1654
1264
|
else if (r === "*") Array.isArray(i) ? i.filter(yn).forEach(function(e) {
|
|
1655
1265
|
a.push(vn(t, e, bn(t) ? n : ""));
|
|
1656
1266
|
}) : Object.keys(i).forEach(function(e) {
|
|
@@ -1722,35 +1332,14 @@ function En(e, t) {
|
|
|
1722
1332
|
parse: wn
|
|
1723
1333
|
});
|
|
1724
1334
|
}
|
|
1725
|
-
var Dn = En(null, an), On =
|
|
1335
|
+
var Dn = En(null, an), On = G(((e, t) => {
|
|
1726
1336
|
var n = function() {};
|
|
1727
1337
|
n.prototype = Object.create(null);
|
|
1728
|
-
/**
|
|
1729
|
-
* RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
|
|
1730
|
-
*
|
|
1731
|
-
* parameter = token "=" ( token / quoted-string )
|
|
1732
|
-
* token = 1*tchar
|
|
1733
|
-
* tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
|
|
1734
|
-
* / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
|
|
1735
|
-
* / DIGIT / ALPHA
|
|
1736
|
-
* ; any VCHAR, except delimiters
|
|
1737
|
-
* quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
|
|
1738
|
-
* qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
|
|
1739
|
-
* obs-text = %x80-FF
|
|
1740
|
-
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
1741
|
-
*/
|
|
1742
1338
|
var r = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu, i = /\\([\v\u0020-\u00ff])/gu, a = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u, o = {
|
|
1743
1339
|
type: "",
|
|
1744
1340
|
parameters: new n()
|
|
1745
1341
|
};
|
|
1746
1342
|
Object.freeze(o.parameters), Object.freeze(o);
|
|
1747
|
-
/**
|
|
1748
|
-
* Parse media type to object.
|
|
1749
|
-
*
|
|
1750
|
-
* @param {string|object} header
|
|
1751
|
-
* @return {Object}
|
|
1752
|
-
* @public
|
|
1753
|
-
*/
|
|
1754
1343
|
function s(e) {
|
|
1755
1344
|
if (typeof e != "string") throw TypeError("argument header is required and must be a string");
|
|
1756
1345
|
let t = e.indexOf(";"), o = t === -1 ? e.trim() : e.slice(0, t).trim();
|
|
@@ -1788,39 +1377,37 @@ var Dn = En(null, an), On = (/* @__PURE__ */ G(((e, t) => {
|
|
|
1788
1377
|
parse: s,
|
|
1789
1378
|
safeParse: c
|
|
1790
1379
|
}, t.exports.parse = s, t.exports.safeParse = c, t.exports.defaultContentType = o;
|
|
1791
|
-
}))
|
|
1380
|
+
}))(), kn = /^-?\d+$/, An = /^-?\d+n+$/, jn = JSON.stringify, Mn = JSON.parse, Nn = /^-?\d+n$/, Pn = /([\[:])?"(-?\d+)n"($|([\\n]|\s)*(\s|[\\n])*[,\}\]])/g, Fn = /([\[:])?("-?\d+n+)n("$|"([\\n]|\s)*(\s|[\\n])*[,\}\]])/g, In = (e, t, n) => "rawJSON" in JSON ? jn(e, (e, n) => typeof n == "bigint" ? JSON.rawJSON(n.toString()) : typeof t == "function" ? t(e, n) : (Array.isArray(t) && t.includes(e), n), n) : e ? jn(e, (e, n) => typeof n == "string" && n.match(An) || typeof n == "bigint" ? n.toString() + "n" : typeof t == "function" ? t(e, n) : (Array.isArray(t) && t.includes(e), n), n).replace(Pn, "$1$2$3").replace(Fn, "$1$2$3") : jn(e, t, n), Ln = () => JSON.parse("1", (e, t, n) => !!n && n.source === "1"), Rn = (e, t, n, r) => typeof t == "string" && t.match(Nn) ? BigInt(t.slice(0, -1)) : typeof t == "string" && t.match(An) ? t.slice(0, -1) : typeof r == "function" ? r(e, t, n) : t, zn = (e, t) => JSON.parse(e, (e, n, r) => {
|
|
1381
|
+
let i = typeof n == "number" && (n > 2 ** 53 - 1 || n < -(2 ** 53 - 1)), a = r && kn.test(r.source);
|
|
1382
|
+
return i && a ? BigInt(r.source) : typeof t == "function" ? t(e, n, r) : n;
|
|
1383
|
+
}), Bn = (2 ** 53 - 1).toString(), Vn = Bn.length, Hn = /"(?:\\.|[^"])*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g, Un = /^"-?\d+n+"$/, Wn = (e, t) => e ? Ln() ? zn(e, t) : Mn(e.replace(Hn, (e, t, n, r) => {
|
|
1384
|
+
let i = e[0] === "\"";
|
|
1385
|
+
if (i && e.match(Un)) return e.substring(0, e.length - 1) + "n\"";
|
|
1386
|
+
let a = n || r, o = t && (t.length < Vn || t.length === Vn && t <= Bn);
|
|
1387
|
+
return i || a || o ? e : "\"" + e + "n\"";
|
|
1388
|
+
}), (e, n, r) => Rn(e, n, r, t)) : Mn(e, t), Gn = class extends Error {
|
|
1792
1389
|
name;
|
|
1793
|
-
/**
|
|
1794
|
-
* http status code
|
|
1795
|
-
*/
|
|
1796
1390
|
status;
|
|
1797
|
-
/**
|
|
1798
|
-
* Request options that lead to the error.
|
|
1799
|
-
*/
|
|
1800
1391
|
request;
|
|
1801
|
-
/**
|
|
1802
|
-
* Response object if a response was received
|
|
1803
|
-
*/
|
|
1804
1392
|
response;
|
|
1805
1393
|
constructor(e, t, n) {
|
|
1806
|
-
/* v8 ignore else -- @preserve -- Bug with vitest coverage where it sees an else branch that doesn't exist */
|
|
1807
1394
|
super(e, { cause: n.cause }), this.name = "HttpError", this.status = Number.parseInt(t), Number.isNaN(this.status) && (this.status = 0), "response" in n && (this.response = n.response);
|
|
1808
1395
|
let r = Object.assign({}, n.request);
|
|
1809
1396
|
n.request.headers.authorization && (r.headers = Object.assign({}, n.request.headers, { authorization: n.request.headers.authorization.replace(/(?<! ) .*$/, " [REDACTED]") })), r.url = r.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"), this.request = r;
|
|
1810
1397
|
}
|
|
1811
|
-
},
|
|
1812
|
-
function
|
|
1398
|
+
}, Kn = "10.0.8", qn = { headers: { "user-agent": `octokit-request.js/${Kn} ${qt()}` } };
|
|
1399
|
+
function Jn(e) {
|
|
1813
1400
|
if (typeof e != "object" || !e || Object.prototype.toString.call(e) !== "[object Object]") return !1;
|
|
1814
1401
|
let t = Object.getPrototypeOf(e);
|
|
1815
1402
|
if (t === null) return !0;
|
|
1816
1403
|
let n = Object.prototype.hasOwnProperty.call(t, "constructor") && t.constructor;
|
|
1817
1404
|
return typeof n == "function" && n instanceof n && Function.prototype.call(n) === Function.prototype.call(e);
|
|
1818
1405
|
}
|
|
1819
|
-
var
|
|
1820
|
-
async function
|
|
1406
|
+
var Yn = () => "";
|
|
1407
|
+
async function Xn(e) {
|
|
1821
1408
|
let t = e.request?.fetch || globalThis.fetch;
|
|
1822
1409
|
if (!t) throw Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");
|
|
1823
|
-
let n = e.request?.log || console, r = e.request?.parseSuccessResponseBody !== !1, i =
|
|
1410
|
+
let n = e.request?.log || console, r = e.request?.parseSuccessResponseBody !== !1, i = Jn(e.body) || Array.isArray(e.body) ? In(e.body) : e.body, a = Object.fromEntries(Object.entries(e.headers).map(([e, t]) => [e, String(t)])), o;
|
|
1824
1411
|
try {
|
|
1825
1412
|
o = await t(e.url, {
|
|
1826
1413
|
method: e.method,
|
|
@@ -1836,7 +1423,7 @@ async function Pn(e) {
|
|
|
1836
1423
|
if (t.name === "AbortError") throw t.status = 500, t;
|
|
1837
1424
|
n = t.message, t.name === "TypeError" && "cause" in t && (t.cause instanceof Error ? n = t.cause.message : typeof t.cause == "string" && (n = t.cause));
|
|
1838
1425
|
}
|
|
1839
|
-
let r = new
|
|
1426
|
+
let r = new Gn(n, 500, { request: e });
|
|
1840
1427
|
throw r.cause = t, r;
|
|
1841
1428
|
}
|
|
1842
1429
|
let s = o.status, c = o.url, l = {};
|
|
@@ -1854,42 +1441,39 @@ async function Pn(e) {
|
|
|
1854
1441
|
if (s === 204 || s === 205) return u;
|
|
1855
1442
|
if (e.method === "HEAD") {
|
|
1856
1443
|
if (s < 400) return u;
|
|
1857
|
-
throw new
|
|
1444
|
+
throw new Gn(o.statusText, s, {
|
|
1858
1445
|
response: u,
|
|
1859
1446
|
request: e
|
|
1860
1447
|
});
|
|
1861
1448
|
}
|
|
1862
|
-
if (s === 304) throw u.data = await
|
|
1449
|
+
if (s === 304) throw u.data = await Zn(o), new Gn("Not modified", s, {
|
|
1863
1450
|
response: u,
|
|
1864
1451
|
request: e
|
|
1865
1452
|
});
|
|
1866
|
-
if (s >= 400) throw u.data = await
|
|
1453
|
+
if (s >= 400) throw u.data = await Zn(o), new Gn($n(u.data), s, {
|
|
1867
1454
|
response: u,
|
|
1868
1455
|
request: e
|
|
1869
1456
|
});
|
|
1870
|
-
return u.data = r ? await
|
|
1457
|
+
return u.data = r ? await Zn(o) : o.body, u;
|
|
1871
1458
|
}
|
|
1872
|
-
async function
|
|
1459
|
+
async function Zn(e) {
|
|
1873
1460
|
let t = e.headers.get("content-type");
|
|
1874
|
-
if (!t) return e.text().catch(
|
|
1461
|
+
if (!t) return e.text().catch(Yn);
|
|
1875
1462
|
let n = (0, On.safeParse)(t);
|
|
1876
|
-
if (
|
|
1463
|
+
if (Qn(n)) {
|
|
1877
1464
|
let t = "";
|
|
1878
1465
|
try {
|
|
1879
|
-
return t = await e.text(),
|
|
1466
|
+
return t = await e.text(), Wn(t);
|
|
1880
1467
|
} catch {
|
|
1881
1468
|
return t;
|
|
1882
1469
|
}
|
|
1883
|
-
} else if (n.type.startsWith("text/") || n.parameters.charset?.toLowerCase() === "utf-8") return e.text().catch(
|
|
1884
|
-
else return e.arrayBuffer().catch(
|
|
1885
|
-
/* v8 ignore next -- @preserve */
|
|
1886
|
-
() => /* @__PURE__ */ new ArrayBuffer(0)
|
|
1887
|
-
);
|
|
1470
|
+
} else if (n.type.startsWith("text/") || n.parameters.charset?.toLowerCase() === "utf-8") return e.text().catch(Yn);
|
|
1471
|
+
else return e.arrayBuffer().catch(() => new ArrayBuffer(0));
|
|
1888
1472
|
}
|
|
1889
|
-
function
|
|
1473
|
+
function Qn(e) {
|
|
1890
1474
|
return e.type === "application/json" || e.type === "application/scim+json";
|
|
1891
1475
|
}
|
|
1892
|
-
function
|
|
1476
|
+
function $n(e) {
|
|
1893
1477
|
if (typeof e == "string") return e;
|
|
1894
1478
|
if (e instanceof ArrayBuffer) return "Unknown error";
|
|
1895
1479
|
if ("message" in e) {
|
|
@@ -1898,33 +1482,33 @@ function Ln(e) {
|
|
|
1898
1482
|
}
|
|
1899
1483
|
return `Unknown error: ${JSON.stringify(e)}`;
|
|
1900
1484
|
}
|
|
1901
|
-
function
|
|
1485
|
+
function er(e, t) {
|
|
1902
1486
|
let n = e.defaults(t);
|
|
1903
1487
|
return Object.assign(function(e, t) {
|
|
1904
1488
|
let r = n.merge(e, t);
|
|
1905
|
-
if (!r.request || !r.request.hook) return
|
|
1906
|
-
let i = (e, t) =>
|
|
1489
|
+
if (!r.request || !r.request.hook) return Xn(n.parse(r));
|
|
1490
|
+
let i = (e, t) => Xn(n.parse(n.merge(e, t)));
|
|
1907
1491
|
return Object.assign(i, {
|
|
1908
1492
|
endpoint: n,
|
|
1909
|
-
defaults:
|
|
1493
|
+
defaults: er.bind(null, n)
|
|
1910
1494
|
}), r.request.hook(i, r);
|
|
1911
1495
|
}, {
|
|
1912
1496
|
endpoint: n,
|
|
1913
|
-
defaults:
|
|
1497
|
+
defaults: er.bind(null, n)
|
|
1914
1498
|
});
|
|
1915
1499
|
}
|
|
1916
|
-
var
|
|
1917
|
-
function
|
|
1500
|
+
var tr = er(Dn, qn), nr = "0.0.0-development";
|
|
1501
|
+
function rr(e) {
|
|
1918
1502
|
return "Request failed due to following response errors:\n" + e.errors.map((e) => ` - ${e.message}`).join("\n");
|
|
1919
1503
|
}
|
|
1920
|
-
var
|
|
1504
|
+
var ir = class extends Error {
|
|
1921
1505
|
constructor(e, t, n) {
|
|
1922
|
-
super(
|
|
1506
|
+
super(rr(n)), this.request = e, this.headers = t, this.response = n, this.errors = n.errors, this.data = n.data, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
1923
1507
|
}
|
|
1924
1508
|
name = "GraphqlResponseError";
|
|
1925
1509
|
errors;
|
|
1926
1510
|
data;
|
|
1927
|
-
},
|
|
1511
|
+
}, ar = [
|
|
1928
1512
|
"method",
|
|
1929
1513
|
"baseUrl",
|
|
1930
1514
|
"url",
|
|
@@ -1933,70 +1517,70 @@ var Hn = class extends Error {
|
|
|
1933
1517
|
"query",
|
|
1934
1518
|
"mediaType",
|
|
1935
1519
|
"operationName"
|
|
1936
|
-
],
|
|
1520
|
+
], or = [
|
|
1937
1521
|
"query",
|
|
1938
1522
|
"method",
|
|
1939
1523
|
"url"
|
|
1940
|
-
],
|
|
1941
|
-
function
|
|
1524
|
+
], sr = /\/api\/v3\/?$/;
|
|
1525
|
+
function cr(e, t, n) {
|
|
1942
1526
|
if (n) {
|
|
1943
|
-
if (typeof t == "string" && "query" in n) return Promise.reject(
|
|
1944
|
-
for (let e in n) if (
|
|
1527
|
+
if (typeof t == "string" && "query" in n) return Promise.reject(Error("[@octokit/graphql] \"query\" cannot be used as variable name"));
|
|
1528
|
+
for (let e in n) if (or.includes(e)) return Promise.reject(Error(`[@octokit/graphql] "${e}" cannot be used as variable name`));
|
|
1945
1529
|
}
|
|
1946
|
-
let r = typeof t == "string" ? Object.assign({ query: t }, n) : t, i = Object.keys(r).reduce((e, t) =>
|
|
1947
|
-
return
|
|
1530
|
+
let r = typeof t == "string" ? Object.assign({ query: t }, n) : t, i = Object.keys(r).reduce((e, t) => ar.includes(t) ? (e[t] = r[t], e) : (e.variables ||= {}, e.variables[t] = r[t], e), {}), a = r.baseUrl || e.endpoint.DEFAULTS.baseUrl;
|
|
1531
|
+
return sr.test(a) && (i.url = a.replace(sr, "/api/graphql")), e(i).then((e) => {
|
|
1948
1532
|
if (e.data.errors) {
|
|
1949
1533
|
let t = {};
|
|
1950
1534
|
for (let n of Object.keys(e.headers)) t[n] = e.headers[n];
|
|
1951
|
-
throw new
|
|
1535
|
+
throw new ir(i, t, e.data);
|
|
1952
1536
|
}
|
|
1953
1537
|
return e.data.data;
|
|
1954
1538
|
});
|
|
1955
1539
|
}
|
|
1956
|
-
function
|
|
1540
|
+
function lr(e, t) {
|
|
1957
1541
|
let n = e.defaults(t);
|
|
1958
|
-
return Object.assign((e, t) =>
|
|
1959
|
-
defaults:
|
|
1542
|
+
return Object.assign((e, t) => cr(n, e, t), {
|
|
1543
|
+
defaults: lr.bind(null, n),
|
|
1960
1544
|
endpoint: n.endpoint
|
|
1961
1545
|
});
|
|
1962
1546
|
}
|
|
1963
|
-
|
|
1964
|
-
headers: { "user-agent": `octokit-graphql.js/${
|
|
1547
|
+
lr(tr, {
|
|
1548
|
+
headers: { "user-agent": `octokit-graphql.js/${nr} ${qt()}` },
|
|
1965
1549
|
method: "POST",
|
|
1966
1550
|
url: "/graphql"
|
|
1967
1551
|
});
|
|
1968
|
-
function
|
|
1969
|
-
return
|
|
1552
|
+
function ur(e) {
|
|
1553
|
+
return lr(e, {
|
|
1970
1554
|
method: "POST",
|
|
1971
1555
|
url: "/graphql"
|
|
1972
1556
|
});
|
|
1973
1557
|
}
|
|
1974
|
-
var
|
|
1975
|
-
async function
|
|
1976
|
-
let t =
|
|
1558
|
+
var dr = "(?:[a-zA-Z0-9_-]+)", fr = "\\.", pr = RegExp(`^${dr}${fr}${dr}${fr}${dr}$`), mr = pr.test.bind(pr);
|
|
1559
|
+
async function hr(e) {
|
|
1560
|
+
let t = mr(e), n = e.startsWith("v1.") || e.startsWith("ghs_"), r = e.startsWith("ghu_");
|
|
1977
1561
|
return {
|
|
1978
1562
|
type: "token",
|
|
1979
1563
|
token: e,
|
|
1980
1564
|
tokenType: t ? "app" : n ? "installation" : r ? "user-to-server" : "oauth"
|
|
1981
1565
|
};
|
|
1982
1566
|
}
|
|
1983
|
-
function
|
|
1567
|
+
function gr(e) {
|
|
1984
1568
|
return e.split(/\./).length === 3 ? `bearer ${e}` : `token ${e}`;
|
|
1985
1569
|
}
|
|
1986
|
-
async function
|
|
1570
|
+
async function _r(e, t, n, r) {
|
|
1987
1571
|
let i = t.endpoint.merge(n, r);
|
|
1988
|
-
return i.headers.authorization =
|
|
1572
|
+
return i.headers.authorization = gr(e), t(i);
|
|
1989
1573
|
}
|
|
1990
|
-
var
|
|
1574
|
+
var vr = function(e) {
|
|
1991
1575
|
if (!e) throw Error("[@octokit/auth-token] No token passed to createTokenAuth");
|
|
1992
1576
|
if (typeof e != "string") throw Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string");
|
|
1993
|
-
return e = e.replace(/^(token|bearer) +/i, ""), Object.assign(
|
|
1994
|
-
},
|
|
1995
|
-
function
|
|
1996
|
-
return typeof e.debug != "function" && (e.debug =
|
|
1577
|
+
return e = e.replace(/^(token|bearer) +/i, ""), Object.assign(hr.bind(null, e), { hook: _r.bind(null, e) });
|
|
1578
|
+
}, yr = "7.0.6", br = () => {}, xr = console.warn.bind(console), Sr = console.error.bind(console);
|
|
1579
|
+
function Cr(e = {}) {
|
|
1580
|
+
return typeof e.debug != "function" && (e.debug = br), typeof e.info != "function" && (e.info = br), typeof e.warn != "function" && (e.warn = xr), typeof e.error != "function" && (e.error = Sr), e;
|
|
1997
1581
|
}
|
|
1998
|
-
var
|
|
1999
|
-
static VERSION =
|
|
1582
|
+
var wr = `octokit-core.js/${yr} ${qt()}`, Tr = class {
|
|
1583
|
+
static VERSION = yr;
|
|
2000
1584
|
static defaults(e) {
|
|
2001
1585
|
return class extends this {
|
|
2002
1586
|
constructor(...t) {
|
|
@@ -2010,12 +1594,6 @@ var cr = `octokit-core.js/${rr} ${qt()}`, lr = class {
|
|
|
2010
1594
|
};
|
|
2011
1595
|
}
|
|
2012
1596
|
static plugins = [];
|
|
2013
|
-
/**
|
|
2014
|
-
* Attach a plugin (or many) to your Octokit instance.
|
|
2015
|
-
*
|
|
2016
|
-
* @example
|
|
2017
|
-
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
|
|
2018
|
-
*/
|
|
2019
1597
|
static plugin(...e) {
|
|
2020
1598
|
let t = this.plugins;
|
|
2021
1599
|
return class extends this {
|
|
@@ -2024,7 +1602,7 @@ var cr = `octokit-core.js/${rr} ${qt()}`, lr = class {
|
|
|
2024
1602
|
}
|
|
2025
1603
|
constructor(e = {}) {
|
|
2026
1604
|
let t = new nn.Collection(), n = {
|
|
2027
|
-
baseUrl:
|
|
1605
|
+
baseUrl: tr.endpoint.DEFAULTS.baseUrl,
|
|
2028
1606
|
headers: {},
|
|
2029
1607
|
request: Object.assign({}, e.request, { hook: t.bind(null, "request") }),
|
|
2030
1608
|
mediaType: {
|
|
@@ -2032,7 +1610,7 @@ var cr = `octokit-core.js/${rr} ${qt()}`, lr = class {
|
|
|
2032
1610
|
format: ""
|
|
2033
1611
|
}
|
|
2034
1612
|
};
|
|
2035
|
-
if (n.headers["user-agent"] = e.userAgent ? `${e.userAgent} ${
|
|
1613
|
+
if (n.headers["user-agent"] = e.userAgent ? `${e.userAgent} ${wr}` : wr, e.baseUrl && (n.baseUrl = e.baseUrl), e.previews && (n.mediaType.previews = e.previews), e.timeZone && (n.headers["time-zone"] = e.timeZone), this.request = tr.defaults(n), this.graphql = ur(this.request).defaults(n), this.log = Cr(e.log), this.hook = t, e.authStrategy) {
|
|
2036
1614
|
let { authStrategy: n, ...r } = e, i = n(Object.assign({
|
|
2037
1615
|
request: this.request,
|
|
2038
1616
|
log: this.log,
|
|
@@ -2042,7 +1620,7 @@ var cr = `octokit-core.js/${rr} ${qt()}`, lr = class {
|
|
|
2042
1620
|
t.wrap("request", i.hook), this.auth = i;
|
|
2043
1621
|
} else if (!e.auth) this.auth = async () => ({ type: "unauthenticated" });
|
|
2044
1622
|
else {
|
|
2045
|
-
let n =
|
|
1623
|
+
let n = vr(e.auth);
|
|
2046
1624
|
t.wrap("request", n.hook), this.auth = n;
|
|
2047
1625
|
}
|
|
2048
1626
|
let r = this.constructor;
|
|
@@ -2053,8 +1631,8 @@ var cr = `octokit-core.js/${rr} ${qt()}`, lr = class {
|
|
|
2053
1631
|
log;
|
|
2054
1632
|
hook;
|
|
2055
1633
|
auth;
|
|
2056
|
-
},
|
|
2057
|
-
function
|
|
1634
|
+
}, Er = "6.0.0";
|
|
1635
|
+
function Dr(e) {
|
|
2058
1636
|
e.hook.wrap("request", (t, n) => {
|
|
2059
1637
|
e.log.debug("request", n);
|
|
2060
1638
|
let r = Date.now(), i = e.request.endpoint.parse(n), a = i.url.replace(n.baseUrl, "");
|
|
@@ -2067,9 +1645,9 @@ function dr(e) {
|
|
|
2067
1645
|
});
|
|
2068
1646
|
});
|
|
2069
1647
|
}
|
|
2070
|
-
|
|
2071
|
-
var
|
|
2072
|
-
function
|
|
1648
|
+
Dr.VERSION = Er;
|
|
1649
|
+
var Or = "0.0.0-development";
|
|
1650
|
+
function kr(e) {
|
|
2073
1651
|
if (!e.data) return {
|
|
2074
1652
|
...e,
|
|
2075
1653
|
data: []
|
|
@@ -2080,12 +1658,12 @@ function pr(e) {
|
|
|
2080
1658
|
let a = Object.keys(e.data)[0];
|
|
2081
1659
|
return e.data = e.data[a], t !== void 0 && (e.data.incomplete_results = t), n !== void 0 && (e.data.repository_selection = n), e.data.total_count = r, e.data.total_commits = i, e;
|
|
2082
1660
|
}
|
|
2083
|
-
function
|
|
1661
|
+
function Ar(e, t, n) {
|
|
2084
1662
|
let r = typeof t == "function" ? t.endpoint(n) : e.request.endpoint(t, n), i = typeof t == "function" ? t : e.request, a = r.method, o = r.headers, s = r.url;
|
|
2085
1663
|
return { [Symbol.asyncIterator]: () => ({ async next() {
|
|
2086
1664
|
if (!s) return { done: !0 };
|
|
2087
1665
|
try {
|
|
2088
|
-
let e =
|
|
1666
|
+
let e = kr(await i({
|
|
2089
1667
|
method: a,
|
|
2090
1668
|
url: s,
|
|
2091
1669
|
headers: o
|
|
@@ -2105,25 +1683,25 @@ function mr(e, t, n) {
|
|
|
2105
1683
|
}
|
|
2106
1684
|
} }) };
|
|
2107
1685
|
}
|
|
2108
|
-
function
|
|
2109
|
-
return typeof n == "function" && (r = n, n = void 0),
|
|
1686
|
+
function jr(e, t, n, r) {
|
|
1687
|
+
return typeof n == "function" && (r = n, n = void 0), Mr(e, [], Ar(e, t, n)[Symbol.asyncIterator](), r);
|
|
2110
1688
|
}
|
|
2111
|
-
function
|
|
1689
|
+
function Mr(e, t, n, r) {
|
|
2112
1690
|
return n.next().then((i) => {
|
|
2113
1691
|
if (i.done) return t;
|
|
2114
1692
|
let a = !1;
|
|
2115
1693
|
function o() {
|
|
2116
1694
|
a = !0;
|
|
2117
1695
|
}
|
|
2118
|
-
return t = t.concat(r ? r(i.value, o) : i.value.data), a ? t :
|
|
1696
|
+
return t = t.concat(r ? r(i.value, o) : i.value.data), a ? t : Mr(e, t, n, r);
|
|
2119
1697
|
});
|
|
2120
1698
|
}
|
|
2121
|
-
Object.assign(
|
|
2122
|
-
function
|
|
2123
|
-
return { paginate: Object.assign(
|
|
1699
|
+
Object.assign(jr, { iterator: Ar });
|
|
1700
|
+
function Nr(e) {
|
|
1701
|
+
return { paginate: Object.assign(jr.bind(null, e), { iterator: Ar.bind(null, e) }) };
|
|
2124
1702
|
}
|
|
2125
|
-
|
|
2126
|
-
var
|
|
1703
|
+
Nr.VERSION = Or;
|
|
1704
|
+
var Pr = "17.0.0", Fr = {
|
|
2127
1705
|
actions: {
|
|
2128
1706
|
addCustomLabelsToSelfHostedRunnerForOrg: ["POST /orgs/{org}/actions/runners/{runner_id}/labels"],
|
|
2129
1707
|
addCustomLabelsToSelfHostedRunnerForRepo: ["POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"],
|
|
@@ -3414,20 +2992,20 @@ var vr = "17.0.0", yr = {
|
|
|
3414
2992
|
unfollow: ["DELETE /user/following/{username}"],
|
|
3415
2993
|
updateAuthenticated: ["PATCH /user"]
|
|
3416
2994
|
}
|
|
3417
|
-
}, $ =
|
|
3418
|
-
for (let [e, t] of Object.entries(
|
|
2995
|
+
}, $ = new Map();
|
|
2996
|
+
for (let [e, t] of Object.entries(Fr)) for (let [n, r] of Object.entries(t)) {
|
|
3419
2997
|
let [t, i, a] = r, [o, s] = t.split(/ /), c = Object.assign({
|
|
3420
2998
|
method: o,
|
|
3421
2999
|
url: s
|
|
3422
3000
|
}, i);
|
|
3423
|
-
$.has(e) || $.set(e,
|
|
3001
|
+
$.has(e) || $.set(e, new Map()), $.get(e).set(n, {
|
|
3424
3002
|
scope: e,
|
|
3425
3003
|
methodName: n,
|
|
3426
3004
|
endpointDefaults: c,
|
|
3427
3005
|
decorations: a
|
|
3428
3006
|
});
|
|
3429
3007
|
}
|
|
3430
|
-
var
|
|
3008
|
+
var Ir = {
|
|
3431
3009
|
has({ scope: e }, t) {
|
|
3432
3010
|
return $.get(e).has(t);
|
|
3433
3011
|
},
|
|
@@ -3456,19 +3034,19 @@ var br = {
|
|
|
3456
3034
|
let i = $.get(t).get(r);
|
|
3457
3035
|
if (!i) return;
|
|
3458
3036
|
let { endpointDefaults: a, decorations: o } = i;
|
|
3459
|
-
return o ? n[r] =
|
|
3037
|
+
return o ? n[r] = Rr(e, t, r, a, o) : n[r] = e.request.defaults(a), n[r];
|
|
3460
3038
|
}
|
|
3461
3039
|
};
|
|
3462
|
-
function
|
|
3040
|
+
function Lr(e) {
|
|
3463
3041
|
let t = {};
|
|
3464
3042
|
for (let n of $.keys()) t[n] = new Proxy({
|
|
3465
3043
|
octokit: e,
|
|
3466
3044
|
scope: n,
|
|
3467
3045
|
cache: {}
|
|
3468
|
-
},
|
|
3046
|
+
}, Ir);
|
|
3469
3047
|
return t;
|
|
3470
3048
|
}
|
|
3471
|
-
function
|
|
3049
|
+
function Rr(e, t, n, r, i) {
|
|
3472
3050
|
let a = e.request.defaults(r);
|
|
3473
3051
|
function o(...r) {
|
|
3474
3052
|
let o = a.endpoint.merge(...r);
|
|
@@ -3489,19 +3067,19 @@ function Sr(e, t, n, r, i) {
|
|
|
3489
3067
|
}
|
|
3490
3068
|
return Object.assign(o, a);
|
|
3491
3069
|
}
|
|
3492
|
-
function
|
|
3493
|
-
return { rest:
|
|
3070
|
+
function zr(e) {
|
|
3071
|
+
return { rest: Lr(e) };
|
|
3494
3072
|
}
|
|
3495
|
-
|
|
3496
|
-
function
|
|
3497
|
-
let t =
|
|
3073
|
+
zr.VERSION = Pr;
|
|
3074
|
+
function Br(e) {
|
|
3075
|
+
let t = Lr(e);
|
|
3498
3076
|
return {
|
|
3499
3077
|
...t,
|
|
3500
3078
|
rest: t
|
|
3501
3079
|
};
|
|
3502
3080
|
}
|
|
3503
|
-
|
|
3504
|
-
var
|
|
3081
|
+
Br.VERSION = Pr;
|
|
3082
|
+
var Vr = Tr.plugin(Dr, Br, Nr).defaults({ userAgent: "octokit-rest.js/22.0.1" }), Hr = new class extends bt {
|
|
3505
3083
|
description = {
|
|
3506
3084
|
title: "通过Github安装插件",
|
|
3507
3085
|
description: "输入形如: \"gh:owner/repo\"的内容"
|
|
@@ -3514,7 +3092,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3514
3092
|
console.error("fail to get github token", e);
|
|
3515
3093
|
var t = "";
|
|
3516
3094
|
}
|
|
3517
|
-
let n = new
|
|
3095
|
+
let n = new Vr({ auth: Ae(t) ? void 0 : t }), [r, i] = e.replace(/^gh:/, "").split("/"), { data: a } = await n.rest.repos.getLatestRelease({
|
|
3518
3096
|
owner: r,
|
|
3519
3097
|
repo: i
|
|
3520
3098
|
}), o = a.assets[0];
|
|
@@ -3534,14 +3112,14 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3534
3112
|
isMatched(e) {
|
|
3535
3113
|
return e.startsWith("gh:") && e.split("/").length === 2;
|
|
3536
3114
|
}
|
|
3537
|
-
}(),
|
|
3115
|
+
}(), Ur = "https://raw.githubusercontent.com/delta-comic/awesome-plugins/refs/heads/main/pages", Wr = new class extends bt {
|
|
3538
3116
|
description = {
|
|
3539
3117
|
title: "快速安装插件",
|
|
3540
3118
|
description: "输入形如: \"ap:jmcomic\"的内容"
|
|
3541
3119
|
};
|
|
3542
3120
|
name = "awesome";
|
|
3543
3121
|
async installer(e) {
|
|
3544
|
-
let t = e.replace(/^ap:/, ""), { data: n } = await W.get(`${
|
|
3122
|
+
let t = e.replace(/^ap:/, ""), { data: n } = await W.get(`${Ur}/${t}.json`, { responseType: "json" });
|
|
3545
3123
|
return n.download;
|
|
3546
3124
|
}
|
|
3547
3125
|
async install(e) {
|
|
@@ -3553,7 +3131,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3553
3131
|
isMatched(e) {
|
|
3554
3132
|
return /^ap:[A-Za-z0-9\-\_]+$/.test(e);
|
|
3555
3133
|
}
|
|
3556
|
-
}(),
|
|
3134
|
+
}(), Gr = G(((e) => {
|
|
3557
3135
|
function t(e) {
|
|
3558
3136
|
return e === void 0;
|
|
3559
3137
|
}
|
|
@@ -3567,10 +3145,10 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3567
3145
|
}, {});
|
|
3568
3146
|
}
|
|
3569
3147
|
e.parse = n;
|
|
3570
|
-
}))
|
|
3148
|
+
}))(), Kr = new class extends xt {
|
|
3571
3149
|
name = "userscript";
|
|
3572
3150
|
async installDownload(e) {
|
|
3573
|
-
let t = await e.text(), n = Pe((0,
|
|
3151
|
+
let t = await e.text(), n = Pe((0, Gr.parse)(t)), r = await yt(n.name.id);
|
|
3574
3152
|
return await Rt(r, { recursive: !0 }), await Wt(await Z(r, "us.js"), t, { create: !0 }), n;
|
|
3575
3153
|
}
|
|
3576
3154
|
canInstall(e) {
|
|
@@ -3584,7 +3162,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3584
3162
|
throw URL.revokeObjectURL(i), e;
|
|
3585
3163
|
}), a.async = !0, a.src = i, document.body.appendChild(a);
|
|
3586
3164
|
}
|
|
3587
|
-
}(),
|
|
3165
|
+
}(), qr = G(((e, t) => {
|
|
3588
3166
|
(function(n) {
|
|
3589
3167
|
typeof e == "object" && t !== void 0 ? t.exports = n() : typeof define == "function" && define.amd ? define([], n) : (typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : this).JSZip = n();
|
|
3590
3168
|
})(function() {
|
|
@@ -3595,7 +3173,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3595
3173
|
var c = typeof K == "function" && K;
|
|
3596
3174
|
if (!s && c) return c(o, !0);
|
|
3597
3175
|
if (a) return a(o, !0);
|
|
3598
|
-
var l =
|
|
3176
|
+
var l = Error("Cannot find module '" + o + "'");
|
|
3599
3177
|
throw l.code = "MODULE_NOT_FOUND", l;
|
|
3600
3178
|
}
|
|
3601
3179
|
var u = n[o] = { exports: {} };
|
|
@@ -3896,7 +3474,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3896
3474
|
r.on("error", function(e) {
|
|
3897
3475
|
n(e);
|
|
3898
3476
|
}).on("end", function() {
|
|
3899
|
-
r.streamInfo.crc32 === e.decompressed.crc32 ? t() : n(
|
|
3477
|
+
r.streamInfo.crc32 === e.decompressed.crc32 ? t() : n(Error("Corrupted zip : CRC32 mismatch"));
|
|
3900
3478
|
}).resume();
|
|
3901
3479
|
});
|
|
3902
3480
|
}
|
|
@@ -3908,7 +3486,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3908
3486
|
optimizedBinaryString: !1,
|
|
3909
3487
|
createFolders: !1,
|
|
3910
3488
|
decodeFileName: a.utf8decode
|
|
3911
|
-
}), c.isNode && c.isStream(e) ? i.Promise.reject(
|
|
3489
|
+
}), c.isNode && c.isStream(e) ? i.Promise.reject(Error("JSZip can't accept a stream when loading a zip file.")) : r.prepareContent("the loaded zip file", e, !0, t.optimizedBinaryString, t.base64).then(function(e) {
|
|
3912
3490
|
var n = new o(t);
|
|
3913
3491
|
return n.load(e), n;
|
|
3914
3492
|
}).then(function(e) {
|
|
@@ -4010,7 +3588,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
4010
3588
|
15: [function(e, t, n) {
|
|
4011
3589
|
function r(e, t, n) {
|
|
4012
3590
|
var r, i = a.getTypeOf(t), s = a.extend(n || {}, c);
|
|
4013
|
-
s.date = s.date ||
|
|
3591
|
+
s.date = s.date || new Date(), s.compression !== null && (s.compression = s.compression.toUpperCase()), typeof s.unixPermissions == "string" && (s.unixPermissions = parseInt(s.unixPermissions, 8)), s.unixPermissions && 16384 & s.unixPermissions && (s.dir = !0), s.dosPermissions && 16 & s.dosPermissions && (s.dir = !0), s.dir && (e = h(e)), s.createFolders && (r = m(e)) && g.call(this, r, !0);
|
|
4014
3592
|
var d = i === "string" && !1 === s.binary && !1 === s.base64;
|
|
4015
3593
|
n && n.binary !== void 0 || (s.binary = !d), (t instanceof l && t.uncompressedSize === 0 || s.dir || !t || t.length === 0) && (s.base64 = !1, s.binary = !0, t = "", s.compression = "STORE", i = "string");
|
|
4016
3594
|
var _ = null;
|
|
@@ -4496,7 +4074,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
4496
4074
|
30: [function(e, t, n) {
|
|
4497
4075
|
if (n.base64 = !0, n.array = !0, n.string = !0, n.arraybuffer = typeof ArrayBuffer < "u" && typeof Uint8Array < "u", n.nodebuffer = typeof Buffer < "u", n.uint8array = typeof Uint8Array < "u", typeof ArrayBuffer > "u") n.blob = !1;
|
|
4498
4076
|
else {
|
|
4499
|
-
var r =
|
|
4077
|
+
var r = new ArrayBuffer(0);
|
|
4500
4078
|
try {
|
|
4501
4079
|
n.blob = new Blob([r], { type: "application/zip" }).size === 0;
|
|
4502
4080
|
} catch {
|
|
@@ -4746,7 +4324,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
4746
4324
|
var u = n.getTypeOf(t);
|
|
4747
4325
|
return u ? (u === "arraybuffer" ? t = n.transformTo("uint8array", t) : u === "string" && (l ? t = i.decode(t) : a && !0 !== s && (t = function(e) {
|
|
4748
4326
|
return c(e, r.uint8array ? new Uint8Array(e.length) : Array(e.length));
|
|
4749
|
-
}(t))), t) : o.Promise.reject(
|
|
4327
|
+
}(t))), t) : o.Promise.reject(Error("Can't read the data of '" + e + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
|
|
4750
4328
|
});
|
|
4751
4329
|
};
|
|
4752
4330
|
}, {
|
|
@@ -4802,7 +4380,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
4802
4380
|
},
|
|
4803
4381
|
readEndOfCentral: function() {
|
|
4804
4382
|
var e = this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);
|
|
4805
|
-
if (e < 0) throw this.isSignature(0, a.LOCAL_FILE_HEADER) ?
|
|
4383
|
+
if (e < 0) throw this.isSignature(0, a.LOCAL_FILE_HEADER) ? Error("Corrupted zip: can't find end of central directory") : Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");
|
|
4806
4384
|
this.reader.setIndex(e);
|
|
4807
4385
|
var t = e;
|
|
4808
4386
|
if (this.checkSignature(a.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) {
|
|
@@ -5031,7 +4609,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
5031
4609
|
} catch (t) {
|
|
5032
4610
|
return a.reject(e, t);
|
|
5033
4611
|
}
|
|
5034
|
-
r === e ? a.reject(e,
|
|
4612
|
+
r === e ? a.reject(e, TypeError("Cannot resolve promise with itself")) : a.resolve(e, r);
|
|
5035
4613
|
});
|
|
5036
4614
|
}
|
|
5037
4615
|
function f(e) {
|
|
@@ -5109,7 +4687,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
5109
4687
|
return a.reject(t, e);
|
|
5110
4688
|
}, l.all = function(e) {
|
|
5111
4689
|
var t = this;
|
|
5112
|
-
if (Object.prototype.toString.call(e) !== "[object Array]") return this.reject(
|
|
4690
|
+
if (Object.prototype.toString.call(e) !== "[object Array]") return this.reject(TypeError("must be an array"));
|
|
5113
4691
|
var n = e.length, r = !1;
|
|
5114
4692
|
if (!n) return this.resolve([]);
|
|
5115
4693
|
for (var o = Array(n), s = 0, c = -1, l = new this(i); ++c < n;) u(e[c], c);
|
|
@@ -5123,7 +4701,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
5123
4701
|
}
|
|
5124
4702
|
}, l.race = function(e) {
|
|
5125
4703
|
var t = this;
|
|
5126
|
-
if (Object.prototype.toString.call(e) !== "[object Array]") return this.reject(
|
|
4704
|
+
if (Object.prototype.toString.call(e) !== "[object Array]") return this.reject(TypeError("must be an array"));
|
|
5127
4705
|
var n = e.length, r = !1;
|
|
5128
4706
|
if (!n) return this.resolve([]);
|
|
5129
4707
|
for (var o = -1, s = new this(i); ++o < n;) c = e[o], t.resolve(c).then(function(e) {
|
|
@@ -6612,13 +6190,13 @@ while (r === s[++i] && r === s[++i] && r === s[++i] && r === s[++i] && r === s[+
|
|
|
6612
6190
|
}, {}]
|
|
6613
6191
|
}, {}, [10])(10);
|
|
6614
6192
|
});
|
|
6615
|
-
}))
|
|
6193
|
+
}))(), Jr = new class extends xt {
|
|
6616
6194
|
name = "zip";
|
|
6617
6195
|
async installDownload(e) {
|
|
6618
6196
|
console.log("[loader zip] begin:", e);
|
|
6619
6197
|
let t = await yt("__temp__");
|
|
6620
6198
|
await Rt(t, { recursive: !0 }), await Ut(await Z(t, "temp.zip"), new Uint8Array(await e.arrayBuffer())), console.log("[loader zip] temp:", t);
|
|
6621
|
-
let n = await (0,
|
|
6199
|
+
let n = await (0, qr.loadAsync)(e);
|
|
6622
6200
|
console.log(n.files);
|
|
6623
6201
|
let r = JSON.parse(await n.file("manifest.json")?.async("string") ?? "{}"), i = await yt(r.name.id);
|
|
6624
6202
|
try {
|
|
@@ -6660,15 +6238,15 @@ while (r === s[++i] && r === s[++i] && r === s[++i] && r === s[++i] && r === s[+
|
|
|
6660
6238
|
throw e;
|
|
6661
6239
|
}), a.rel = "stylesheet", a.href = decodeURIComponent(mt(await Z(t, i), "local")), document.head.appendChild(a);
|
|
6662
6240
|
}
|
|
6663
|
-
}(),
|
|
6241
|
+
}(), Yr = Object.assign({
|
|
6664
6242
|
"./booter/0_configSetter.ts": St,
|
|
6665
6243
|
"./booter/10_apiTest.ts": Et,
|
|
6666
6244
|
"./booter/20_resourceTest.ts": Dt,
|
|
6667
6245
|
"./booter/30_boot.ts": Ot,
|
|
6668
6246
|
"./booter/40_auth.ts": At,
|
|
6669
6247
|
"./booter/50_otherProcess.ts": jt
|
|
6670
|
-
}),
|
|
6671
|
-
const
|
|
6248
|
+
}), Xr = Te(Object.entries(Yr), ([e]) => Number(e.match(/[\d\.]+(?=_)/)?.[0])).map((e) => e[1]);
|
|
6249
|
+
const Zr = async (e) => {
|
|
6672
6250
|
let { plugins: t, pluginSteps: n } = lt();
|
|
6673
6251
|
t.set(e.name, y(e)), n[e.name] = {
|
|
6674
6252
|
steps: [],
|
|
@@ -6679,13 +6257,13 @@ const Fr = async (e) => {
|
|
|
6679
6257
|
};
|
|
6680
6258
|
try {
|
|
6681
6259
|
let t = {};
|
|
6682
|
-
for (let r of
|
|
6260
|
+
for (let r of Xr) {
|
|
6683
6261
|
let i = n[e.name].steps.length;
|
|
6684
6262
|
n[e.name].steps[i] = {
|
|
6685
6263
|
name: r.name,
|
|
6686
6264
|
description: ""
|
|
6687
6265
|
}, n[e.name].now.stepsIndex = i, n[e.name].now.status = "process", await r.call(e, (t) => {
|
|
6688
|
-
|
|
6266
|
+
se(t) ? n[e.name].steps[i].description = t : (t.description && (n[e.name].steps[i].description = t.description), t.name && (n[e.name].steps[i].name = t.name));
|
|
6689
6267
|
}, t);
|
|
6690
6268
|
}
|
|
6691
6269
|
n[e.name].now.stepsIndex++;
|
|
@@ -6694,33 +6272,33 @@ const Fr = async (e) => {
|
|
|
6694
6272
|
}
|
|
6695
6273
|
console.log(`[plugin usePluginStore.$loadPlugin] plugin "${e.name}" load done`);
|
|
6696
6274
|
};
|
|
6697
|
-
var
|
|
6275
|
+
var Qr = Object.assign({
|
|
6698
6276
|
"./installer/10_normalUrl.ts": Mt,
|
|
6699
6277
|
"./installer/20_local.ts": Gt,
|
|
6700
6278
|
"./installer/30_dev.ts": Kt,
|
|
6701
|
-
"./installer/40_github.ts":
|
|
6702
|
-
"./installer/9999_awesome.ts":
|
|
6703
|
-
}),
|
|
6704
|
-
const
|
|
6279
|
+
"./installer/40_github.ts": Hr,
|
|
6280
|
+
"./installer/9999_awesome.ts": Wr
|
|
6281
|
+
}), $r = Te(Object.entries(Qr), ([e]) => Number(e.match(/[\d\.]+(?=_)/)?.[0])).map((e) => e[1]).reverse();
|
|
6282
|
+
const ei = () => i(Y, "pluginInstallSourceOverrides", []), ti = (e, t, n) => e.createLoading("依赖安装/检查", async (e) => {
|
|
6705
6283
|
e.retryable = !0;
|
|
6706
|
-
let i = 0, a = n ?? new Set((await r.value.selectFrom("plugin").select("pluginName").execute()).map((e) => e.pluginName)), o =
|
|
6707
|
-
for (let { id: n, download: r } of t.require) a.has(n) || !r || (console.log(`从 ${t.name.id} 发现未安装依赖: ${n} ->`, r), e.description = `安装: ${n}`, await
|
|
6284
|
+
let i = 0, a = n ?? new Set((await r.value.selectFrom("plugin").select("pluginName").execute()).map((e) => e.pluginName)), o = ei();
|
|
6285
|
+
for (let { id: n, download: r } of t.require) a.has(n) || !r || (console.log(`从 ${t.name.id} 发现未安装依赖: ${n} ->`, r), e.description = `安装: ${n}`, await ni(o.value.find((e) => e.id == n && e.enabled)?.install ?? r), i++);
|
|
6708
6286
|
e.description = `安装完成,共${i}个`;
|
|
6709
|
-
}),
|
|
6287
|
+
}), ni = (e, t) => H(`下载插件-${e}`, async (n) => {
|
|
6710
6288
|
let [i, a] = await n.createLoading("下载", async (t) => {
|
|
6711
6289
|
t.retryable = !0;
|
|
6712
6290
|
let n = e;
|
|
6713
6291
|
for (;;) {
|
|
6714
|
-
let e =
|
|
6292
|
+
let e = $r.filter((e) => e.isMatched(n)).at(0);
|
|
6715
6293
|
if (!e) throw Error("没有符合的下载器:" + n);
|
|
6716
6294
|
t.description = e.name;
|
|
6717
6295
|
let r = await e.install(n);
|
|
6718
|
-
if (
|
|
6296
|
+
if (se(r)) n = r;
|
|
6719
6297
|
else return [r, e];
|
|
6720
6298
|
}
|
|
6721
6299
|
}), o = await n.createLoading("安装插件", async (t) => {
|
|
6722
6300
|
t.retryable = !0;
|
|
6723
|
-
let n =
|
|
6301
|
+
let n = oi.filter((e) => e.canInstall(i)).at(-1);
|
|
6724
6302
|
if (!n) throw Error("没有符合的安装器:" + e);
|
|
6725
6303
|
t.description = n.name;
|
|
6726
6304
|
let o = await n.installDownload(i);
|
|
@@ -6734,11 +6312,11 @@ const Rr = () => i(Y, "pluginInstallSourceOverrides", []), zr = (e, t, n) => e.c
|
|
|
6734
6312
|
pluginName: o.name.id
|
|
6735
6313
|
}).execute(), o;
|
|
6736
6314
|
});
|
|
6737
|
-
console.log(`安装插件成功: ${o.name.id} ->`, o), await
|
|
6738
|
-
}),
|
|
6315
|
+
console.log(`安装插件成功: ${o.name.id} ->`, o), await ti(n, o, t);
|
|
6316
|
+
}), ri = (e, t) => H(`安装插件-${e.name}`, async (n) => {
|
|
6739
6317
|
let i = await n.createLoading("安装插件", async (t) => {
|
|
6740
6318
|
t.retryable = !0;
|
|
6741
|
-
let n =
|
|
6319
|
+
let n = oi.filter((t) => t.canInstall(e)).at(-1);
|
|
6742
6320
|
if (!n) throw Error("没有符合的安装器");
|
|
6743
6321
|
t.description = n.name;
|
|
6744
6322
|
let i = await n.installDownload(e);
|
|
@@ -6752,37 +6330,37 @@ const Rr = () => i(Y, "pluginInstallSourceOverrides", []), zr = (e, t, n) => e.c
|
|
|
6752
6330
|
pluginName: i.name.id
|
|
6753
6331
|
}).execute(), i;
|
|
6754
6332
|
});
|
|
6755
|
-
console.log(`安装插件成功: ${i.name.id} ->`, i), await
|
|
6756
|
-
}),
|
|
6333
|
+
console.log(`安装插件成功: ${i.name.id} ->`, i), await ti(n, i, t);
|
|
6334
|
+
}), ii = async (e, t) => H(`更新插件-${e.pluginName}`, async (n) => {
|
|
6757
6335
|
let i = await n.createLoading("更新", async (t) => {
|
|
6758
6336
|
t.retryable = !0;
|
|
6759
6337
|
let n = e.installerName;
|
|
6760
6338
|
for (;;) {
|
|
6761
|
-
let r =
|
|
6339
|
+
let r = $r.find((e) => e.name == n);
|
|
6762
6340
|
if (!r) throw Error("没有符合的下载器");
|
|
6763
6341
|
t.description = r.name;
|
|
6764
6342
|
let i = await r.update(e);
|
|
6765
|
-
if (
|
|
6343
|
+
if (se(i)) n = i;
|
|
6766
6344
|
else return i;
|
|
6767
6345
|
}
|
|
6768
6346
|
}), a = await n.createLoading("安装插件", async (t) => {
|
|
6769
6347
|
t.retryable = !0;
|
|
6770
|
-
let n =
|
|
6348
|
+
let n = oi.find((t) => t.name == e.loaderName);
|
|
6771
6349
|
if (!n) throw Error("没有符合的安装器");
|
|
6772
6350
|
return await n.installDownload(i);
|
|
6773
6351
|
});
|
|
6774
6352
|
await r.value.replaceInto("plugin").values({
|
|
6775
6353
|
...e,
|
|
6776
6354
|
meta: JSON.stringify(a)
|
|
6777
|
-
}).execute(), await
|
|
6355
|
+
}).execute(), await ti(n, a, t);
|
|
6778
6356
|
});
|
|
6779
|
-
var
|
|
6780
|
-
"./loader/1_userscript.ts":
|
|
6781
|
-
"./loader/2_zip.ts":
|
|
6782
|
-
}),
|
|
6783
|
-
const
|
|
6357
|
+
var ai = Object.assign({
|
|
6358
|
+
"./loader/1_userscript.ts": Kr,
|
|
6359
|
+
"./loader/2_zip.ts": Jr
|
|
6360
|
+
}), oi = Te(Object.entries(ai), ([e]) => Number(e.match(/[\d\.]+(?=_)/)?.[0])).map((e) => e[1]), si = {}, ci = (e) => si[e] ??= new le();
|
|
6361
|
+
const li = async (e) => {
|
|
6784
6362
|
console.log(`[plugin bootPlugin] booting name "${e.pluginName}"`);
|
|
6785
|
-
let t =
|
|
6363
|
+
let t = ci(e.pluginName), n = lt();
|
|
6786
6364
|
n.pluginSteps[e.pluginName] = {
|
|
6787
6365
|
now: {
|
|
6788
6366
|
status: "wait",
|
|
@@ -6794,7 +6372,7 @@ const qr = async (e) => {
|
|
|
6794
6372
|
}]
|
|
6795
6373
|
};
|
|
6796
6374
|
try {
|
|
6797
|
-
await t.acquire(), await
|
|
6375
|
+
await t.acquire(), await oi.find((t) => t.name == e.loaderName).load(e), await t.acquire();
|
|
6798
6376
|
} catch (t) {
|
|
6799
6377
|
throw n.pluginSteps[e.pluginName].now.status = "error", n.pluginSteps[e.pluginName].now.error = t, t;
|
|
6800
6378
|
}
|
|
@@ -6802,23 +6380,23 @@ const qr = async (e) => {
|
|
|
6802
6380
|
};
|
|
6803
6381
|
Me.on("definedPlugin", async (e) => {
|
|
6804
6382
|
console.log("[plugin addPlugin] new plugin defined", e.name, e);
|
|
6805
|
-
let t =
|
|
6806
|
-
await
|
|
6807
|
-
}), window.$api.loaders =
|
|
6808
|
-
const
|
|
6383
|
+
let t = ci(e.name);
|
|
6384
|
+
await Zr(e), console.log("[plugin addPlugin] done", e.name), t.release();
|
|
6385
|
+
}), window.$api.loaders = oi, window.$api.installers = $r;
|
|
6386
|
+
const ui = F.fromAsyncFunction(async () => {
|
|
6809
6387
|
await ut();
|
|
6810
6388
|
let e = new Set([Y]), n = await t.getByEnabled(!0), r = [];
|
|
6811
6389
|
for (;;) {
|
|
6812
6390
|
let t = n.filter((t) => t.meta.require.every((t) => e.has(t.id)));
|
|
6813
|
-
r.push(t),
|
|
6391
|
+
r.push(t), te(n, (e) => t.includes(e));
|
|
6814
6392
|
for (let { pluginName: n } of t) e.add(n);
|
|
6815
6393
|
if (Ae(t)) break;
|
|
6816
6394
|
}
|
|
6817
6395
|
if (!Ae(n)) throw Error(`插件循环引用: ${n.map((e) => e.pluginName).join(", ")}`);
|
|
6818
|
-
for (let e of r) await Promise.all(e.map((e) =>
|
|
6396
|
+
for (let e of r) await Promise.all(e.map((e) => li(e)));
|
|
6819
6397
|
console.log("[plugin bootPlugin] all load done");
|
|
6820
6398
|
});
|
|
6821
|
-
var
|
|
6399
|
+
var di = f({
|
|
6822
6400
|
__name: "Inject",
|
|
6823
6401
|
props: {
|
|
6824
6402
|
key: {},
|
|
@@ -6844,13 +6422,13 @@ var Yr = /* @__PURE__ */ f({
|
|
|
6844
6422
|
}, 1032, ["promise"]))), 256));
|
|
6845
6423
|
}
|
|
6846
6424
|
});
|
|
6847
|
-
const
|
|
6425
|
+
const fi = (e, t, n) => {
|
|
6848
6426
|
J.envExtends.add({
|
|
6849
6427
|
key: e,
|
|
6850
6428
|
component: t,
|
|
6851
6429
|
condition: n ?? (() => !0)
|
|
6852
6430
|
});
|
|
6853
6431
|
};
|
|
6854
|
-
export { et as ConfigPointer, J as Global,
|
|
6432
|
+
export { et as ConfigPointer, J as Global, di as Inject, fi as addInjection, tt as appConfig, Zr as bootPlugin, rt as declareDepType, Pe as decodePluginMeta, Ne as definePlugin, ti as installDepends, ri as installFilePlugin, ni as installPlugin, ui as loadAllPlugins, li as loadPlugin, Me as pluginEmitter, at as pluginExposes, $r as pluginInstallers, oi as pluginLoaders, it as require, ii as updatePlugin, nt as useConfig, ei as usePluginConfig, lt as usePluginStore };
|
|
6855
6433
|
|
|
6856
6434
|
//# sourceMappingURL=index.js.map
|