@delta-comic/plugin 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -3534,7 +3534,29 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3534
3534
|
isMatched(e) {
|
|
3535
3535
|
return e.startsWith("gh:") && e.split("/").length === 2;
|
|
3536
3536
|
}
|
|
3537
|
-
}(), Dr =
|
|
3537
|
+
}(), Dr = "https://raw.githubusercontent.com/delta-comic/awesome-plugins/refs/heads/main/pages/", Or = new class extends bt {
|
|
3538
|
+
description = {
|
|
3539
|
+
title: "快速安装插件",
|
|
3540
|
+
description: "输入形如: \"ap:jmcomic\"的内容"
|
|
3541
|
+
};
|
|
3542
|
+
name = "awesome";
|
|
3543
|
+
async installer(e) {
|
|
3544
|
+
let t = e.replace(/^ap:/, ""), { data: n } = await W.get(`${t}.json`, {
|
|
3545
|
+
baseURL: Dr,
|
|
3546
|
+
responseType: "json"
|
|
3547
|
+
});
|
|
3548
|
+
return n.download;
|
|
3549
|
+
}
|
|
3550
|
+
async install(e) {
|
|
3551
|
+
return await this.installer(e);
|
|
3552
|
+
}
|
|
3553
|
+
async update(e) {
|
|
3554
|
+
return await this.installer(e.installInput);
|
|
3555
|
+
}
|
|
3556
|
+
isMatched(e) {
|
|
3557
|
+
return /^ap:[A-Za-z0-9\-\_]+$/.test(e);
|
|
3558
|
+
}
|
|
3559
|
+
}(), kr = (/* @__PURE__ */ G(((e) => {
|
|
3538
3560
|
function t(e) {
|
|
3539
3561
|
return e === void 0;
|
|
3540
3562
|
}
|
|
@@ -3548,10 +3570,10 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3548
3570
|
}, {});
|
|
3549
3571
|
}
|
|
3550
3572
|
e.parse = n;
|
|
3551
|
-
})))(),
|
|
3573
|
+
})))(), Ar = new class extends xt {
|
|
3552
3574
|
name = "userscript";
|
|
3553
3575
|
async installDownload(e) {
|
|
3554
|
-
let t = await e.text(), n = Pe((0,
|
|
3576
|
+
let t = await e.text(), n = Pe((0, kr.parse)(t)), r = await yt(n.name.id);
|
|
3555
3577
|
return await Rt(r, { recursive: !0 }), await Wt(await Z(r, "us.js"), t, { create: !0 }), n;
|
|
3556
3578
|
}
|
|
3557
3579
|
canInstall(e) {
|
|
@@ -3565,7 +3587,7 @@ var Tr = lr.plugin(dr, wr, _r).defaults({ userAgent: "octokit-rest.js/22.0.1" })
|
|
|
3565
3587
|
throw URL.revokeObjectURL(i), e;
|
|
3566
3588
|
}), a.async = !0, a.src = i, document.body.appendChild(a);
|
|
3567
3589
|
}
|
|
3568
|
-
}(),
|
|
3590
|
+
}(), jr = (/* @__PURE__ */ G(((e, t) => {
|
|
3569
3591
|
(function(n) {
|
|
3570
3592
|
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();
|
|
3571
3593
|
})(function() {
|
|
@@ -6593,13 +6615,13 @@ while (r === s[++i] && r === s[++i] && r === s[++i] && r === s[++i] && r === s[+
|
|
|
6593
6615
|
}, {}]
|
|
6594
6616
|
}, {}, [10])(10);
|
|
6595
6617
|
});
|
|
6596
|
-
})))(),
|
|
6618
|
+
})))(), Mr = new class extends xt {
|
|
6597
6619
|
name = "zip";
|
|
6598
6620
|
async installDownload(e) {
|
|
6599
6621
|
console.log("[loader zip] begin:", e);
|
|
6600
6622
|
let t = await yt("__temp__");
|
|
6601
6623
|
await Rt(t, { recursive: !0 }), await Ut(await Z(t, "temp.zip"), new Uint8Array(await e.arrayBuffer())), console.log("[loader zip] temp:", t);
|
|
6602
|
-
let n = await (0,
|
|
6624
|
+
let n = await (0, jr.loadAsync)(e);
|
|
6603
6625
|
console.log(n.files);
|
|
6604
6626
|
let r = JSON.parse(await n.file("manifest.json")?.async("string") ?? "{}"), i = await yt(r.name.id);
|
|
6605
6627
|
try {
|
|
@@ -6641,15 +6663,15 @@ while (r === s[++i] && r === s[++i] && r === s[++i] && r === s[++i] && r === s[+
|
|
|
6641
6663
|
throw e;
|
|
6642
6664
|
}), a.rel = "stylesheet", a.href = decodeURIComponent(mt(await Z(t, i), "local")), document.head.appendChild(a);
|
|
6643
6665
|
}
|
|
6644
|
-
}(),
|
|
6666
|
+
}(), Nr = /* @__PURE__ */ Object.assign({
|
|
6645
6667
|
"./booter/0_configSetter.ts": St,
|
|
6646
6668
|
"./booter/10_apiTest.ts": Et,
|
|
6647
6669
|
"./booter/20_resourceTest.ts": Dt,
|
|
6648
6670
|
"./booter/30_boot.ts": Ot,
|
|
6649
6671
|
"./booter/40_auth.ts": At,
|
|
6650
6672
|
"./booter/50_otherProcess.ts": jt
|
|
6651
|
-
}),
|
|
6652
|
-
const
|
|
6673
|
+
}), Pr = Te(Object.entries(Nr), ([e]) => Number(e.match(/[\d\.]+(?=_)/)?.[0])).map((e) => e[1]);
|
|
6674
|
+
const Fr = async (e) => {
|
|
6653
6675
|
let { plugins: t, pluginSteps: n } = lt();
|
|
6654
6676
|
t.set(e.name, y(e)), n[e.name] = {
|
|
6655
6677
|
steps: [],
|
|
@@ -6660,7 +6682,7 @@ const Nr = async (e) => {
|
|
|
6660
6682
|
};
|
|
6661
6683
|
try {
|
|
6662
6684
|
let t = {};
|
|
6663
|
-
for (let r of
|
|
6685
|
+
for (let r of Pr) {
|
|
6664
6686
|
let i = n[e.name].steps.length;
|
|
6665
6687
|
n[e.name].steps[i] = {
|
|
6666
6688
|
name: r.name,
|
|
@@ -6675,26 +6697,33 @@ const Nr = async (e) => {
|
|
|
6675
6697
|
}
|
|
6676
6698
|
console.log(`[plugin usePluginStore.$loadPlugin] plugin "${e.name}" load done`);
|
|
6677
6699
|
};
|
|
6678
|
-
var
|
|
6700
|
+
var Ir = /* @__PURE__ */ Object.assign({
|
|
6679
6701
|
"./installer/10_normalUrl.ts": Mt,
|
|
6680
6702
|
"./installer/20_local.ts": Gt,
|
|
6681
6703
|
"./installer/30_dev.ts": Kt,
|
|
6682
|
-
"./installer/40_github.ts": Er
|
|
6683
|
-
|
|
6684
|
-
|
|
6704
|
+
"./installer/40_github.ts": Er,
|
|
6705
|
+
"./installer/9999_awesome.ts": Or
|
|
6706
|
+
}), Lr = Te(Object.entries(Ir), ([e]) => Number(e.match(/[\d\.]+(?=_)/)?.[0])).map((e) => e[1]).reverse();
|
|
6707
|
+
const Rr = () => i(Y, "pluginInstallSourceOverrides", []), zr = (e, t, n) => e.createLoading("依赖安装/检查", async (e) => {
|
|
6685
6708
|
e.retryable = !0;
|
|
6686
|
-
let i = 0, a = n ?? new Set((await r.value.selectFrom("plugin").select("pluginName").execute()).map((e) => e.pluginName)), o =
|
|
6687
|
-
for (let { id: n, download: r } of t.require) a.has(n) || !r || (console.log(`从 ${t.name.id} 发现未安装依赖: ${n} ->`, r), e.description = `安装: ${n}`, await
|
|
6709
|
+
let i = 0, a = n ?? new Set((await r.value.selectFrom("plugin").select("pluginName").execute()).map((e) => e.pluginName)), o = Rr();
|
|
6710
|
+
for (let { id: n, download: r } of t.require) a.has(n) || !r || (console.log(`从 ${t.name.id} 发现未安装依赖: ${n} ->`, r), e.description = `安装: ${n}`, await Br(o.value.find((e) => e.id == n && e.enabled)?.install ?? r), i++);
|
|
6688
6711
|
e.description = `安装完成,共${i}个`;
|
|
6689
|
-
}),
|
|
6712
|
+
}), Br = (e, t) => H(`下载插件-${e}`, async (n) => {
|
|
6690
6713
|
let [i, a] = await n.createLoading("下载", async (t) => {
|
|
6691
6714
|
t.retryable = !0;
|
|
6692
|
-
let n =
|
|
6715
|
+
let n = Lr.filter((t) => t.isMatched(e)).at(0);
|
|
6693
6716
|
if (!n) throw Error("没有符合的下载器:" + e);
|
|
6694
|
-
|
|
6717
|
+
t.description = n.name;
|
|
6718
|
+
let r = e;
|
|
6719
|
+
for (;;) {
|
|
6720
|
+
let e = await n.install(r);
|
|
6721
|
+
if (oe(e)) r = e;
|
|
6722
|
+
else return [e, n];
|
|
6723
|
+
}
|
|
6695
6724
|
}), o = await n.createLoading("安装插件", async (t) => {
|
|
6696
6725
|
t.retryable = !0;
|
|
6697
|
-
let n =
|
|
6726
|
+
let n = Wr.filter((e) => e.canInstall(i)).at(-1);
|
|
6698
6727
|
if (!n) throw Error("没有符合的安装器:" + e);
|
|
6699
6728
|
t.description = n.name;
|
|
6700
6729
|
let o = await n.installDownload(i);
|
|
@@ -6708,11 +6737,11 @@ const Ir = () => i(Y, "pluginInstallSourceOverrides", []), Lr = (e, t, n) => e.c
|
|
|
6708
6737
|
pluginName: o.name.id
|
|
6709
6738
|
}).execute(), o;
|
|
6710
6739
|
});
|
|
6711
|
-
console.log(`安装插件成功: ${o.name.id} ->`, o), await
|
|
6712
|
-
}),
|
|
6740
|
+
console.log(`安装插件成功: ${o.name.id} ->`, o), await zr(n, o, t);
|
|
6741
|
+
}), Vr = (e, t) => H(`安装插件-${e.name}`, async (n) => {
|
|
6713
6742
|
let i = await n.createLoading("安装插件", async (t) => {
|
|
6714
6743
|
t.retryable = !0;
|
|
6715
|
-
let n =
|
|
6744
|
+
let n = Wr.filter((t) => t.canInstall(e)).at(-1);
|
|
6716
6745
|
if (!n) throw Error("没有符合的安装器");
|
|
6717
6746
|
t.description = n.name;
|
|
6718
6747
|
let i = await n.installDownload(e);
|
|
@@ -6726,31 +6755,37 @@ const Ir = () => i(Y, "pluginInstallSourceOverrides", []), Lr = (e, t, n) => e.c
|
|
|
6726
6755
|
pluginName: i.name.id
|
|
6727
6756
|
}).execute(), i;
|
|
6728
6757
|
});
|
|
6729
|
-
console.log(`安装插件成功: ${i.name.id} ->`, i), await
|
|
6730
|
-
}),
|
|
6758
|
+
console.log(`安装插件成功: ${i.name.id} ->`, i), await zr(n, i, t);
|
|
6759
|
+
}), Hr = async (e, t) => H(`更新插件-${e.pluginName}`, async (n) => {
|
|
6731
6760
|
let i = await n.createLoading("更新", async (t) => {
|
|
6732
6761
|
t.retryable = !0;
|
|
6733
|
-
let n =
|
|
6734
|
-
|
|
6735
|
-
|
|
6762
|
+
let n = e.installerName;
|
|
6763
|
+
for (;;) {
|
|
6764
|
+
let r = Lr.find((e) => e.name == n);
|
|
6765
|
+
if (!r) throw Error("没有符合的下载器");
|
|
6766
|
+
t.description = r.name;
|
|
6767
|
+
let i = await r.update(e);
|
|
6768
|
+
if (oe(i)) n = i;
|
|
6769
|
+
else return i;
|
|
6770
|
+
}
|
|
6736
6771
|
}), a = await n.createLoading("安装插件", async (t) => {
|
|
6737
6772
|
t.retryable = !0;
|
|
6738
|
-
let n =
|
|
6773
|
+
let n = Wr.find((t) => t.name == e.loaderName);
|
|
6739
6774
|
if (!n) throw Error("没有符合的安装器");
|
|
6740
6775
|
return await n.installDownload(i);
|
|
6741
6776
|
});
|
|
6742
6777
|
await r.value.replaceInto("plugin").values({
|
|
6743
6778
|
...e,
|
|
6744
6779
|
meta: JSON.stringify(a)
|
|
6745
|
-
}).execute(), await
|
|
6780
|
+
}).execute(), await zr(n, a, t);
|
|
6746
6781
|
});
|
|
6747
|
-
var
|
|
6748
|
-
"./loader/1_userscript.ts":
|
|
6749
|
-
"./loader/2_zip.ts":
|
|
6750
|
-
}),
|
|
6751
|
-
const
|
|
6782
|
+
var Ur = /* @__PURE__ */ Object.assign({
|
|
6783
|
+
"./loader/1_userscript.ts": Ar,
|
|
6784
|
+
"./loader/2_zip.ts": Mr
|
|
6785
|
+
}), Wr = Te(Object.entries(Ur), ([e]) => Number(e.match(/[\d\.]+(?=_)/)?.[0])).map((e) => e[1]), Gr = {}, Kr = (e) => Gr[e] ??= new le();
|
|
6786
|
+
const qr = async (e) => {
|
|
6752
6787
|
console.log(`[plugin bootPlugin] booting name "${e.pluginName}"`);
|
|
6753
|
-
let t =
|
|
6788
|
+
let t = Kr(e.pluginName), n = lt();
|
|
6754
6789
|
n.pluginSteps[e.pluginName] = {
|
|
6755
6790
|
now: {
|
|
6756
6791
|
status: "wait",
|
|
@@ -6762,7 +6797,7 @@ const Gr = async (e) => {
|
|
|
6762
6797
|
}]
|
|
6763
6798
|
};
|
|
6764
6799
|
try {
|
|
6765
|
-
await t.acquire(), await
|
|
6800
|
+
await t.acquire(), await Wr.find((t) => t.name == e.loaderName).load(e), await t.acquire();
|
|
6766
6801
|
} catch (t) {
|
|
6767
6802
|
throw n.pluginSteps[e.pluginName].now.status = "error", n.pluginSteps[e.pluginName].now.error = t, t;
|
|
6768
6803
|
}
|
|
@@ -6770,10 +6805,10 @@ const Gr = async (e) => {
|
|
|
6770
6805
|
};
|
|
6771
6806
|
Me.on("definedPlugin", async (e) => {
|
|
6772
6807
|
console.log("[plugin addPlugin] new plugin defined", e.name, e);
|
|
6773
|
-
let t =
|
|
6774
|
-
await
|
|
6775
|
-
}), window.$api.loaders =
|
|
6776
|
-
const
|
|
6808
|
+
let t = Kr(e.name);
|
|
6809
|
+
await Fr(e), console.log("[plugin addPlugin] done", e.name), t.release();
|
|
6810
|
+
}), window.$api.loaders = Wr, window.$api.installers = Lr;
|
|
6811
|
+
const Jr = F.fromAsyncFunction(async () => {
|
|
6777
6812
|
await ut();
|
|
6778
6813
|
let e = new Set([Y]), n = await t.getByEnabled(!0), r = [];
|
|
6779
6814
|
for (;;) {
|
|
@@ -6783,10 +6818,10 @@ const Kr = F.fromAsyncFunction(async () => {
|
|
|
6783
6818
|
if (Ae(t)) break;
|
|
6784
6819
|
}
|
|
6785
6820
|
if (!Ae(n)) throw Error(`插件循环引用: ${n.map((e) => e.pluginName).join(", ")}`);
|
|
6786
|
-
for (let e of r) await Promise.all(e.map((e) =>
|
|
6821
|
+
for (let e of r) await Promise.all(e.map((e) => qr(e)));
|
|
6787
6822
|
console.log("[plugin bootPlugin] all load done");
|
|
6788
6823
|
});
|
|
6789
|
-
var
|
|
6824
|
+
var Yr = /* @__PURE__ */ f({
|
|
6790
6825
|
__name: "Inject",
|
|
6791
6826
|
props: {
|
|
6792
6827
|
key: {},
|
|
@@ -6812,13 +6847,13 @@ var qr = /* @__PURE__ */ f({
|
|
|
6812
6847
|
}, 1032, ["promise"]))), 256));
|
|
6813
6848
|
}
|
|
6814
6849
|
});
|
|
6815
|
-
const
|
|
6850
|
+
const Xr = (e, t, n) => {
|
|
6816
6851
|
J.envExtends.add({
|
|
6817
6852
|
key: e,
|
|
6818
6853
|
component: t,
|
|
6819
6854
|
condition: n ?? (() => !0)
|
|
6820
6855
|
});
|
|
6821
6856
|
};
|
|
6822
|
-
export { et as ConfigPointer, J as Global,
|
|
6857
|
+
export { et as ConfigPointer, J as Global, Yr as Inject, Xr as addInjection, tt as appConfig, Fr as bootPlugin, rt as declareDepType, Pe as decodePluginMeta, Ne as definePlugin, zr as installDepends, Vr as installFilePlugin, Br as installPlugin, Jr as loadAllPlugins, qr as loadPlugin, Me as pluginEmitter, at as pluginExposes, Lr as pluginInstallers, Wr as pluginLoaders, it as require, Hr as updatePlugin, nt as useConfig, Rr as usePluginConfig, lt as usePluginStore };
|
|
6823
6858
|
|
|
6824
6859
|
//# sourceMappingURL=index.js.map
|