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