@luckylillia-dev/luckylillia 9.0.6 → 9.0.8
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/chunks/{coreUpdate-CEtHqh6r.js → coreUpdate-BGaXPfpB.js} +56 -11
- package/chunks/coreUpdate-BGaXPfpB.js.map +1 -0
- package/llbot-core.js +180 -23
- package/llbot-core.js.map +1 -1
- package/llbot-manager.js +1 -1
- package/package.json +1 -1
- package/webui/assets/{index-DdKHZet8.js → index-B6B_a6s8.js} +3 -3
- package/webui/index.html +1 -1
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +16 -0
- package/chunks/coreUpdate-CEtHqh6r.js.map +0 -1
package/llbot-core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as isManaged, $t as globalVars_exports, A as removeScannedPackage, At as normalizePlatformId, B as parseSpec, C as parsePluginDependencies, Ct as upgradeConfig, D as sdkIncompatibility, Dt as acceptsScope, E as scanPluginRoots, Et as normalizeUi, F as Registry, Ft as require_dist, G as installHostLifecycle, Gt as getPluginDirs, H as lockInstance, I as RegistryError, It as configPaths, Jt as isPluginHmr, Kt as isDevMode, L as isExactVersion, Lt as configPaths_exports, M as require_semver, Mt as deepMerge, N as IntegrityError, Nt as mergeNewProperties, O as sdkRangeOf, Ot as normalizeScope, P as Registries, Pt as JsonFile, Qt as TEMP_DIR, R as isPackageName, Rt as currentInstance, S as normalizeService, St as templateSection, T as resolveMain, Tt as newEntryId, V as pickVersion, Wt as environment_exports, X as GATEWAY_SECRET_HEADER, Xt as LOG_DIR, Y as GATEWAY_SECRET_ENV, Yt as DATA_DIR, _ as SDK_PACKAGE, _t as withCurrentNames, at as HtmlEscapedCallbackPhase, b as manifest_exports, bt as DEPRECATED_KEYS, c as marketSettings, ct as migrateExtractedPlugins, d as DEFAULT_GITHUB_MIRRORS, dt as migrateToInstances, en as __commonJSMin, et as isManagerMessage, f as githubAssetUrl, ft as migrateWebuiToken, g as PLUGIN_CATEGORIES, gt as renamed_exports, h as readTarStream, ht as currentPackageName, it as Hono, j as scannedPackagePath, jt as platform_exports, k as cleanupRemovedPackages, kt as normalizePlatform, l as registriesOf, lt as migrateNTQQMessaging, m as extractPackage, mt as RENAMED_PACKAGES, nn as __require, nt as version$10, ot as resolveCallback, p as isGitHubMirror, pt as renameNativeQQSettings, qt as isDockerEnvironment, r as coreUpdate_exports, rn as __toESM, rt as version_exports, s as MarketSchema, st as liftBuiltinSettings, tn as __exportAll, tt as protocol_exports, u as Catalog, ut as migrateRenamedPackages, v as isImagePath, vt as ADAPTER_ENTRIES, w as readPluginPackage, wt as PluginStore, x as matchesPluginVersion, xt as templateConfig, y as isInside, yt as ADAPTER_KEYS, z as matches, zt as instance_exports } from "./chunks/coreUpdate-BGaXPfpB.js";
|
|
2
2
|
import { p as compareVersions } from "./chunks/restart-TVy8kurW.js";
|
|
3
3
|
import { t as __vitePreload } from "./chunks/preload-helper-DxWiKyOd.js";
|
|
4
4
|
import * as nodeModule from "node:module";
|
|
@@ -2000,7 +2000,7 @@ var ArchiveError = class extends Error {
|
|
|
2000
2000
|
}
|
|
2001
2001
|
};
|
|
2002
2002
|
/** Stream into an isolated temporary directory; the caller removes it on failure or after installation. */
|
|
2003
|
-
async function readLocalPackage(archive, filename, directory) {
|
|
2003
|
+
async function readLocalPackage(archive, filename, directory, limits) {
|
|
2004
2004
|
if (!(await stat$1(archive)).size) throw new ArchiveError("插件压缩包不能为空");
|
|
2005
2005
|
const zip = /\.zip$/i.test(filename);
|
|
2006
2006
|
if (!zip && !/\.(tgz|tar\.gz)$/i.test(filename)) throw new ArchiveError("请选择 ZIP 或 npm 格式的 .tgz / .tar.gz 插件包");
|
|
@@ -2008,7 +2008,10 @@ async function readLocalPackage(archive, filename, directory) {
|
|
|
2008
2008
|
await mkdir(directory, { recursive: true });
|
|
2009
2009
|
const paths = /* @__PURE__ */ new Map();
|
|
2010
2010
|
const entries = zip ? readZip(archive) : readNpmTar(archive);
|
|
2011
|
+
let expanded = 0;
|
|
2012
|
+
let count = 0;
|
|
2011
2013
|
for await (const entry of entries) {
|
|
2014
|
+
if (limits && ++count > limits.maxEntries) throw new ArchiveError("插件压缩包文件数超过限制");
|
|
2012
2015
|
const relative = packagePath(entry.path, entry.type, !zip);
|
|
2013
2016
|
if (!relative) continue;
|
|
2014
2017
|
const key = relative.toLowerCase();
|
|
@@ -2036,7 +2039,14 @@ async function readLocalPackage(archive, filename, directory) {
|
|
|
2036
2039
|
if (entry.type === "directory") await mkdir(target, { recursive: true });
|
|
2037
2040
|
else {
|
|
2038
2041
|
await mkdir(path.dirname(target), { recursive: true });
|
|
2039
|
-
|
|
2042
|
+
async function* bounded() {
|
|
2043
|
+
for await (const chunk of entry.data) {
|
|
2044
|
+
expanded += chunk.length;
|
|
2045
|
+
if (limits && expanded > limits.maxBytes) throw new ArchiveError("插件解压大小超过限制");
|
|
2046
|
+
yield chunk;
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
await pipeline(bounded(), createWriteStream(target, { flags: "wx" }));
|
|
2040
2050
|
}
|
|
2041
2051
|
}
|
|
2042
2052
|
const json = paths.get("package.json");
|
|
@@ -2151,6 +2161,8 @@ function parseManifest(data) {
|
|
|
2151
2161
|
if (value === void 0) continue;
|
|
2152
2162
|
if (!object(value) || Object.entries(value).some(([name, spec]) => typeof spec !== "string" || field !== "scripts" && !isPackageName(name))) throw new ArchiveError(`package.json 的 ${field} 必须是名称到字符串的对象`);
|
|
2153
2163
|
}
|
|
2164
|
+
const peers = manifest.peerDependenciesMeta;
|
|
2165
|
+
if (peers !== void 0 && (!object(peers) || Object.entries(peers).some(([name, meta]) => !isPackageName(name) || !object(meta) || meta.optional !== void 0 && typeof meta.optional !== "boolean"))) throw new ArchiveError("package.json 的 peerDependenciesMeta 必须是包名到元数据的对象,optional 必须是布尔值");
|
|
2154
2166
|
for (const field of ["bundleDependencies", "bundledDependencies"]) {
|
|
2155
2167
|
const value = manifest[field];
|
|
2156
2168
|
if (value !== void 0 && typeof value !== "boolean" && (!Array.isArray(value) || !value.every(isPackageName))) throw new ArchiveError(`package.json 的 ${field} 必须是布尔值或包名数组`);
|
|
@@ -2881,7 +2893,7 @@ var Installer = class Installer {
|
|
|
2881
2893
|
if (totalNodes > 1) emitDownload(`下载并解压依赖 ${completed}/${totalNodes}`);
|
|
2882
2894
|
return;
|
|
2883
2895
|
}
|
|
2884
|
-
const tarball = await this.registry.tarball(node.source.manifest, void 0, (loaded, total) => {
|
|
2896
|
+
const tarball = node.source.tarball ?? await this.registry.tarball(node.source.manifest, void 0, (loaded, total) => {
|
|
2885
2897
|
if (totalNodes === 1) {
|
|
2886
2898
|
if (total && total > 0) {
|
|
2887
2899
|
const ratio = Math.min(1, loaded / total);
|
|
@@ -3080,10 +3092,14 @@ function busy(error, name) {
|
|
|
3080
3092
|
}
|
|
3081
3093
|
function dependenciesOf(manifest) {
|
|
3082
3094
|
const bundle = manifest.bundleDependencies ?? manifest.bundledDependencies;
|
|
3083
|
-
|
|
3084
|
-
const bundled = new Set(Array.isArray(bundle) ? bundle : []);
|
|
3095
|
+
const bundled = new Set(bundle === true ? [...Object.keys(manifest.dependencies ?? {}), ...Object.keys(manifest.optionalDependencies ?? {})] : Array.isArray(bundle) ? bundle : []);
|
|
3085
3096
|
const deps = /* @__PURE__ */ new Map();
|
|
3086
3097
|
const plugins = new Set(Object.keys(manifest.llbot?.dependencies ?? {}));
|
|
3098
|
+
for (const [alias, spec] of Object.entries(manifest.peerDependencies ?? {})) if (manifest.peerDependenciesMeta?.[alias]?.optional !== true) deps.set(alias, {
|
|
3099
|
+
alias,
|
|
3100
|
+
spec,
|
|
3101
|
+
optional: false
|
|
3102
|
+
});
|
|
3087
3103
|
for (const [alias, spec] of Object.entries(manifest.dependencies ?? {})) deps.set(alias, {
|
|
3088
3104
|
alias,
|
|
3089
3105
|
spec,
|
|
@@ -3100,6 +3116,7 @@ function lookup(node, alias) {
|
|
|
3100
3116
|
for (let current = node; current; current = current.parent) {
|
|
3101
3117
|
const found = current.children.get(alias);
|
|
3102
3118
|
if (found) return found;
|
|
3119
|
+
if (current.alias === alias) return current;
|
|
3103
3120
|
}
|
|
3104
3121
|
}
|
|
3105
3122
|
function depthOf(node) {
|
|
@@ -6698,6 +6715,123 @@ async function withLocalUpload(request, root, install) {
|
|
|
6698
6715
|
//#region src/plugin/internal/tool/market/origin.ts
|
|
6699
6716
|
var matchesOrigin = (builtin, origin) => origin === "all" || (origin === "builtin" ? builtin : !builtin);
|
|
6700
6717
|
//#endregion
|
|
6718
|
+
//#region src/plugin/internal/tool/market/github.ts
|
|
6719
|
+
var MAX_DOWNLOAD = 268435456;
|
|
6720
|
+
var canFallbackToGitHub = (error) => error instanceof RegistryError && !(error instanceof IntegrityError) && (error.status === void 0 || [
|
|
6721
|
+
404,
|
|
6722
|
+
408,
|
|
6723
|
+
429
|
|
6724
|
+
].includes(error.status) || error.status >= 500);
|
|
6725
|
+
/** Resolve the actual archive before dependency planning, even when npm metadata exists but its file is unavailable. */
|
|
6726
|
+
var GitHubPackages = class {
|
|
6727
|
+
pending = /* @__PURE__ */ new Map();
|
|
6728
|
+
cache;
|
|
6729
|
+
downloader;
|
|
6730
|
+
mirrors;
|
|
6731
|
+
constructor(mirrors = DEFAULT_GITHUB_MIRRORS, fetch = (url, init) => globalThis.fetch(url, init)) {
|
|
6732
|
+
if (!mirrors.every(isGitHubMirror)) throw new Error("GitHub 镜像必须是无凭据、查询参数和片段的 HTTPS 前缀");
|
|
6733
|
+
this.mirrors = [...new Set(mirrors.map((url) => url.replace(/\/+$/, "") + "/"))];
|
|
6734
|
+
this.downloader = new Registry("https://github.com", async (url, init) => {
|
|
6735
|
+
const controller = new AbortController();
|
|
6736
|
+
const timer = setTimeout(() => controller.abort(/* @__PURE__ */ new Error("GitHub 下载连接超时")), 15e3);
|
|
6737
|
+
try {
|
|
6738
|
+
return await fetch(url, {
|
|
6739
|
+
...init,
|
|
6740
|
+
credentials: "omit",
|
|
6741
|
+
headers: { Accept: "application/octet-stream" },
|
|
6742
|
+
signal: init?.signal ? AbortSignal.any([init.signal, controller.signal]) : controller.signal
|
|
6743
|
+
});
|
|
6744
|
+
} finally {
|
|
6745
|
+
clearTimeout(timer);
|
|
6746
|
+
}
|
|
6747
|
+
});
|
|
6748
|
+
}
|
|
6749
|
+
resolve(entry, registry, npm) {
|
|
6750
|
+
const key = JSON.stringify([
|
|
6751
|
+
entry.name,
|
|
6752
|
+
entry.version,
|
|
6753
|
+
entry.repository,
|
|
6754
|
+
entry.github,
|
|
6755
|
+
npm?.dist
|
|
6756
|
+
]);
|
|
6757
|
+
if (this.cache?.key === key && this.cache.expires > Date.now()) return Promise.resolve(this.cache.source);
|
|
6758
|
+
const pending = this.pending.get(key);
|
|
6759
|
+
if (pending) return pending;
|
|
6760
|
+
const result = this.read(entry, registry, npm).then((source) => {
|
|
6761
|
+
if (source.directory === void 0 && source.tarball && source.tarball.length <= 33554432) this.cache = {
|
|
6762
|
+
key,
|
|
6763
|
+
expires: Date.now() + 6e4,
|
|
6764
|
+
source
|
|
6765
|
+
};
|
|
6766
|
+
return source;
|
|
6767
|
+
}).finally(() => this.pending.delete(key));
|
|
6768
|
+
this.pending.set(key, result);
|
|
6769
|
+
return result;
|
|
6770
|
+
}
|
|
6771
|
+
async read(entry, registry, npm) {
|
|
6772
|
+
const errors = [];
|
|
6773
|
+
if (npm) try {
|
|
6774
|
+
const data = await registry.tarball(npm, MAX_DOWNLOAD);
|
|
6775
|
+
return await this.inspect(entry, npm, data);
|
|
6776
|
+
} catch (error) {
|
|
6777
|
+
if (!canFallbackToGitHub(error)) throw error;
|
|
6778
|
+
errors.push(error.message);
|
|
6779
|
+
}
|
|
6780
|
+
if (!entry.github) throw new RegistryError("缺少 GitHub 安装来源");
|
|
6781
|
+
const official = githubAssetUrl(entry.repository, entry.github);
|
|
6782
|
+
const version = {
|
|
6783
|
+
name: entry.name,
|
|
6784
|
+
version: entry.version,
|
|
6785
|
+
dist: {
|
|
6786
|
+
tarball: official,
|
|
6787
|
+
integrity: entry.github.integrity
|
|
6788
|
+
}
|
|
6789
|
+
};
|
|
6790
|
+
for (const url of [...this.mirrors.map((prefix) => prefix + official), official]) {
|
|
6791
|
+
let data;
|
|
6792
|
+
try {
|
|
6793
|
+
data = await this.downloader.tarball({
|
|
6794
|
+
...version,
|
|
6795
|
+
dist: {
|
|
6796
|
+
...version.dist,
|
|
6797
|
+
tarball: url
|
|
6798
|
+
}
|
|
6799
|
+
}, MAX_DOWNLOAD);
|
|
6800
|
+
} catch (error) {
|
|
6801
|
+
if (!canFallbackToGitHub(error)) throw error;
|
|
6802
|
+
errors.push(error.message);
|
|
6803
|
+
continue;
|
|
6804
|
+
}
|
|
6805
|
+
return this.inspect(entry, version, data);
|
|
6806
|
+
}
|
|
6807
|
+
throw new RegistryError(`${entry.name}@${entry.version}: npm 和 GitHub 下载均不可用:${errors.join("; ")}`);
|
|
6808
|
+
}
|
|
6809
|
+
async inspect(entry, version, data) {
|
|
6810
|
+
const directory = await mkdtemp(path.join(tmpdir(), "luckylillia-github-"));
|
|
6811
|
+
try {
|
|
6812
|
+
const archive = path.join(directory, "plugin.tgz");
|
|
6813
|
+
await writeFile(archive, data);
|
|
6814
|
+
const source = await readLocalPackage(archive, "plugin.tgz", path.join(directory, "package"), {
|
|
6815
|
+
maxBytes: 1073741824,
|
|
6816
|
+
maxEntries: 1e5
|
|
6817
|
+
});
|
|
6818
|
+
if (source.manifest.name !== entry.name || source.manifest.version !== entry.version) throw new IntegrityError(`安装包内的包名或版本与市场目录不一致:${entry.name}@${entry.version}`);
|
|
6819
|
+
return {
|
|
6820
|
+
manifest: {
|
|
6821
|
+
...source.manifest,
|
|
6822
|
+
dist: version.dist
|
|
6823
|
+
},
|
|
6824
|
+
tarball: data
|
|
6825
|
+
};
|
|
6826
|
+
} finally {
|
|
6827
|
+
await rm(directory, {
|
|
6828
|
+
recursive: true,
|
|
6829
|
+
force: true
|
|
6830
|
+
});
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6833
|
+
};
|
|
6834
|
+
//#endregion
|
|
6701
6835
|
//#region src/plugin/internal/tool/market/index.ts
|
|
6702
6836
|
var market_exports = /* @__PURE__ */ __exportAll({
|
|
6703
6837
|
Config: () => Config$4,
|
|
@@ -6716,6 +6850,8 @@ var MarketError = class extends Error {
|
|
|
6716
6850
|
this.status = status;
|
|
6717
6851
|
}
|
|
6718
6852
|
};
|
|
6853
|
+
/** An update hint must not download a GitHub archive just to inspect its dependency manifest. */
|
|
6854
|
+
var DeferredGitHubUpdateCheck = class extends Error {};
|
|
6719
6855
|
var PAGE_SIZE = 20;
|
|
6720
6856
|
/** Use the same declared title and locale preference as the plugin card. */
|
|
6721
6857
|
function entryTitle(entry) {
|
|
@@ -6726,6 +6862,7 @@ var Market = class {
|
|
|
6726
6862
|
ctx;
|
|
6727
6863
|
registry;
|
|
6728
6864
|
catalog;
|
|
6865
|
+
github;
|
|
6729
6866
|
installer;
|
|
6730
6867
|
queue = Promise.resolve();
|
|
6731
6868
|
serialPending = 0;
|
|
@@ -6734,10 +6871,11 @@ var Market = class {
|
|
|
6734
6871
|
lastProgressEmit = 0;
|
|
6735
6872
|
progressTimer;
|
|
6736
6873
|
/** `root`: the plugin directory it installs into, as a real path */
|
|
6737
|
-
constructor(ctx, registry, root, catalog = new Catalog(registry)) {
|
|
6874
|
+
constructor(ctx, registry, root, catalog = new Catalog(registry), github = new GitHubPackages()) {
|
|
6738
6875
|
this.ctx = ctx;
|
|
6739
6876
|
this.registry = registry;
|
|
6740
6877
|
this.catalog = catalog;
|
|
6878
|
+
this.github = github;
|
|
6741
6879
|
this.installer = new Installer(registry, root, new Set(SHARED_SPECIFIERS));
|
|
6742
6880
|
}
|
|
6743
6881
|
progress() {
|
|
@@ -6845,21 +6983,27 @@ var Market = class {
|
|
|
6845
6983
|
return;
|
|
6846
6984
|
}
|
|
6847
6985
|
info.latest = entry.version;
|
|
6848
|
-
|
|
6849
|
-
|
|
6986
|
+
if (entry.github) {
|
|
6987
|
+
if (newer(entry.version, pkg.version)) info.update = entry.version;
|
|
6988
|
+
return;
|
|
6989
|
+
}
|
|
6990
|
+
const document = packument(pkg.name);
|
|
6991
|
+
const source = await this.catalogSource(entry, document);
|
|
6992
|
+
const deprecated = await document.then((value) => value.versions[pkg.version]?.deprecated, () => void 0);
|
|
6850
6993
|
if (deprecated) info.deprecated = deprecated;
|
|
6851
|
-
const approved =
|
|
6994
|
+
const approved = source.manifest;
|
|
6852
6995
|
const problem = this.builtin(pkg.name) && !newer(entry.version, pkg.version) ? void 0 : this.incompatibility(approved);
|
|
6853
6996
|
if (problem) info.blocked = problem;
|
|
6854
6997
|
else {
|
|
6855
|
-
const main = this.planned(
|
|
6998
|
+
const main = this.planned(source, pkg.name);
|
|
6856
6999
|
if (newer(entry.version, pkg.version)) {
|
|
6857
|
-
await this.planPlugins(main, catalog, packument);
|
|
7000
|
+
await this.planPlugins(main, catalog, packument, void 0, true);
|
|
6858
7001
|
info.update = entry.version;
|
|
6859
7002
|
}
|
|
6860
7003
|
}
|
|
6861
7004
|
} catch (e) {
|
|
6862
|
-
if (e instanceof
|
|
7005
|
+
if (e instanceof DeferredGitHubUpdateCheck && info.latest && newer(info.latest, pkg.version)) info.update = info.latest;
|
|
7006
|
+
else if (e instanceof MarketError || e instanceof RegistryError && e.status === 404) info.blocked = e.message;
|
|
6863
7007
|
else info.error = e.message;
|
|
6864
7008
|
}
|
|
6865
7009
|
}));
|
|
@@ -6923,12 +7067,13 @@ var Market = class {
|
|
|
6923
7067
|
const catalog = await this.catalog.load();
|
|
6924
7068
|
const entry = this.assertListed(catalog, name);
|
|
6925
7069
|
if (version !== void 0 && version !== entry.version) throw new MarketError(`${name}@${version} is not the catalog version ${entry.version}; refresh the plugin market`, 409);
|
|
6926
|
-
const
|
|
7070
|
+
const source = await this.catalogSource(entry);
|
|
7071
|
+
const chosen = source.manifest;
|
|
6927
7072
|
const builtin = this.builtin(name);
|
|
6928
7073
|
if (builtin && !newer(chosen.version, builtin.version)) throw new MarketError(`${name}@${chosen.version} is not newer than installed version ${builtin.version}`, 409);
|
|
6929
7074
|
const problem = this.incompatibility(chosen);
|
|
6930
7075
|
if (problem) throw new MarketError(`${name}@${entry.version} cannot run on this bot: ${problem}`, 409);
|
|
6931
|
-
const plan = await this.planPlugins(this.planned(
|
|
7076
|
+
const plan = await this.planPlugins(this.planned(source, name), catalog);
|
|
6932
7077
|
return this.installPlan(plan, onProgress);
|
|
6933
7078
|
}
|
|
6934
7079
|
/** Explicit startup requests use npm directly. Existing packages are never updated by this operation. */
|
|
@@ -7028,13 +7173,23 @@ var Market = class {
|
|
|
7028
7173
|
if (!entry) throw new MarketError(`${name} is not found in the plugin market list; it cannot be installed`, 404);
|
|
7029
7174
|
return entry;
|
|
7030
7175
|
}
|
|
7031
|
-
async
|
|
7176
|
+
async catalogSource(entry, initial) {
|
|
7032
7177
|
const pinned = (document) => Object.hasOwn(document.versions ?? {}, entry.version);
|
|
7033
|
-
|
|
7178
|
+
let document;
|
|
7179
|
+
try {
|
|
7180
|
+
document = await initial;
|
|
7181
|
+
if (!document || !pinned(document)) document = await this.registry.packument(entry.name, true, pinned, "install");
|
|
7182
|
+
} catch (error) {
|
|
7183
|
+
if (!entry.github || !canFallbackToGitHub(error)) throw error;
|
|
7184
|
+
return this.github.resolve(entry, this.registry);
|
|
7185
|
+
}
|
|
7034
7186
|
const version = pinned(document) ? document.versions[entry.version] : void 0;
|
|
7035
|
-
if (!version)
|
|
7187
|
+
if (!version) {
|
|
7188
|
+
if (entry.github) return this.github.resolve(entry, this.registry);
|
|
7189
|
+
throw new MarketError(`${entry.name}: catalog version ${entry.version} is unavailable from the npm registry`, 404);
|
|
7190
|
+
}
|
|
7036
7191
|
if (document.name !== entry.name || version.name !== entry.name || version.version !== entry.version) throw new MarketError(`the registry returned a different package or version for ${entry.name}@${entry.version}`);
|
|
7037
|
-
return version;
|
|
7192
|
+
return entry.github ? this.github.resolve(entry, this.registry, version) : { manifest: version };
|
|
7038
7193
|
}
|
|
7039
7194
|
planned(source, name) {
|
|
7040
7195
|
const version = source.manifest;
|
|
@@ -7052,7 +7207,7 @@ var Market = class {
|
|
|
7052
7207
|
}
|
|
7053
7208
|
}
|
|
7054
7209
|
/** Resolve the complete plugin graph before writing anything. npm library dependencies stay with Installer. */
|
|
7055
|
-
async planPlugins(main, catalog, packument = (name) => this.registry.packument(name, true, void 0, "install"), requestedVersion) {
|
|
7210
|
+
async planPlugins(main, catalog, packument = (name) => this.registry.packument(name, true, void 0, "install"), requestedVersion, checkingUpdates = false) {
|
|
7056
7211
|
const installed = new Map(this.installedPackages().map((pkg) => [pkg.name, pkg]));
|
|
7057
7212
|
const installedRequirements = /* @__PURE__ */ new Map();
|
|
7058
7213
|
for (const pkg of installed.values()) {
|
|
@@ -7113,13 +7268,15 @@ var Market = class {
|
|
|
7113
7268
|
conflict = `${parent} needs ${name}@${ranges.join(" and ")}, but the market catalog only lists ${entry.version}`;
|
|
7114
7269
|
return;
|
|
7115
7270
|
}
|
|
7116
|
-
|
|
7271
|
+
if (checkingUpdates && entry.github) throw new DeferredGitHubUpdateCheck();
|
|
7272
|
+
const source = await this.catalogSource(entry, packument(name));
|
|
7273
|
+
const candidate = source.manifest;
|
|
7117
7274
|
const problem = this.incompatibility(candidate);
|
|
7118
7275
|
if (problem) {
|
|
7119
7276
|
conflict = `${parent} needs ${name}, but its catalog version cannot run on this bot: ${problem}`;
|
|
7120
7277
|
return;
|
|
7121
7278
|
}
|
|
7122
|
-
const item = this.planned(
|
|
7279
|
+
const item = this.planned(source, name);
|
|
7123
7280
|
return resolve([...rest, ...requirementsOf(item)], new Map(selected).set(name, item));
|
|
7124
7281
|
};
|
|
7125
7282
|
const selected = await resolve(requirementsOf(main), /* @__PURE__ */ new Map([[main.name, main]]));
|
|
@@ -7264,7 +7421,7 @@ function apply$5(ctx, config) {
|
|
|
7264
7421
|
root = realpathSync(root);
|
|
7265
7422
|
} catch {}
|
|
7266
7423
|
const registry = new Registries(registriesOf(config), (url, init) => ctx.http.fetch(url, init));
|
|
7267
|
-
const market = new Market(ctx, registry, root, new Catalog(registry, config.catalog));
|
|
7424
|
+
const market = new Market(ctx, registry, root, new Catalog(registry, config.catalog), new GitHubPackages(config.githubMirrors, (url, init) => ctx.http.fetch(url, init)));
|
|
7268
7425
|
market.cleanup().catch((e) => ctx.logger("market").warn(e));
|
|
7269
7426
|
ctx.inject(["webuiServer"], (ctx) => {
|
|
7270
7427
|
ctx.webuiServer.route("/api/market", new Hono().route("/api/market", createMarketRoutes(ctx, market)));
|