@luckylillia-dev/luckylillia 9.0.8 → 9.0.10
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-BGaXPfpB.js → coreUpdate-DjtWFA8I.js} +17 -9
- package/chunks/coreUpdate-DjtWFA8I.js.map +1 -0
- package/llbot-core.js +70 -4
- package/llbot-core.js.map +1 -1
- package/llbot-manager.js +1 -1
- package/package.json +1 -1
- package/webui/assets/index-BrIxD8Tq.js +30 -0
- package/webui/assets/index-C0nKZIHL.css +2 -0
- package/webui/index.html +2 -2
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +16 -0
- package/chunks/coreUpdate-BGaXPfpB.js.map +0 -1
- package/webui/assets/index-B6B_a6s8.js +0 -30
- package/webui/assets/index-_ibiFVAk.css +0 -2
package/llbot-core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-DjtWFA8I.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";
|
|
@@ -754,8 +754,35 @@ function resolvePluginSpecifier(state, specifier, context, nextResolve, moduleTy
|
|
|
754
754
|
url: pinned,
|
|
755
755
|
shortCircuit: true
|
|
756
756
|
};
|
|
757
|
-
const result = nextResolve(specifier, context);
|
|
758
757
|
const parent = context.parentURL;
|
|
758
|
+
const ownerRoot = parent?.startsWith("file:") ? packageRootOf(state.roots, parent) : void 0;
|
|
759
|
+
const owner = ownerRoot && [...state.plugins?.entries() ?? []].find(([, pkg]) => pkg.root === ownerRoot);
|
|
760
|
+
const name = specifier.startsWith("@") ? specifier.split("/").slice(0, 2).join("/") : specifier.split("/")[0];
|
|
761
|
+
const provider = owner && Object.hasOwn(owner[1].dependencies, name) && state.plugins?.get(name);
|
|
762
|
+
if (provider) {
|
|
763
|
+
const metadataUrl = new URL("package.json", provider.root);
|
|
764
|
+
const metadata = JSON.parse(readFileSync(metadataUrl, "utf8"));
|
|
765
|
+
const subpath = specifier.slice(name.length);
|
|
766
|
+
const result = nextResolve(metadata.exports !== void 0 ? metadata.name + subpath : new URL(subpath ? "." + subpath : metadata.main ?? "index.js", provider.root).href, {
|
|
767
|
+
...context,
|
|
768
|
+
parentURL: metadataUrl.href
|
|
769
|
+
});
|
|
770
|
+
if (state.imports) {
|
|
771
|
+
const imports = state.imports.get(owner[0]) ?? /* @__PURE__ */ new Set();
|
|
772
|
+
imports.add(name);
|
|
773
|
+
state.imports.set(owner[0], imports);
|
|
774
|
+
}
|
|
775
|
+
if (result.url.startsWith(provider.root) && !isCommonJS(result.url, moduleType)) {
|
|
776
|
+
const url = new URL(result.url);
|
|
777
|
+
url.searchParams.set("v", String(state.epoch?.(name) ?? 1));
|
|
778
|
+
return {
|
|
779
|
+
...result,
|
|
780
|
+
url: url.href
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
return result;
|
|
784
|
+
}
|
|
785
|
+
const result = nextResolve(specifier, context);
|
|
759
786
|
if (!parent?.startsWith("file:") || !result.url.startsWith("file:")) return result;
|
|
760
787
|
const epoch = new URL(parent).searchParams.get("v");
|
|
761
788
|
if (!epoch) return result;
|
|
@@ -8982,13 +9009,16 @@ var PluginService = class extends Service {
|
|
|
8982
9009
|
packages = /* @__PURE__ */ new Map();
|
|
8983
9010
|
modules = /* @__PURE__ */ new Map();
|
|
8984
9011
|
epochs = /* @__PURE__ */ new Map();
|
|
9012
|
+
moduleEpochs = /* @__PURE__ */ new Map();
|
|
8985
9013
|
runtimes = /* @__PURE__ */ new Map();
|
|
8986
9014
|
fiberIds = /* @__PURE__ */ new WeakMap();
|
|
8987
9015
|
locks = /* @__PURE__ */ new Map();
|
|
8988
9016
|
webuiVersions = /* @__PURE__ */ new Map();
|
|
8989
9017
|
resolver = {
|
|
8990
9018
|
shared: /* @__PURE__ */ new Map(),
|
|
8991
|
-
roots: []
|
|
9019
|
+
roots: [],
|
|
9020
|
+
imports: /* @__PURE__ */ new Map(),
|
|
9021
|
+
epoch: (name) => this.moduleEpochs.get(name) ?? 1
|
|
8992
9022
|
};
|
|
8993
9023
|
resolverInstalled = false;
|
|
8994
9024
|
sdkVersion;
|
|
@@ -9253,6 +9283,7 @@ var PluginService = class extends Service {
|
|
|
9253
9283
|
entries: entries()
|
|
9254
9284
|
};
|
|
9255
9285
|
await this.lock(change.name, () => this.reloadPackage(change.name));
|
|
9286
|
+
await this.reloadImportConsumers(change.name);
|
|
9256
9287
|
const failure = this.list().find((item) => item.name === change.name && !item.disabled && (item.error || item.state === "failed" || item.state === "incompatible"));
|
|
9257
9288
|
if (failure) throw new Error(failure.error ?? "插件启动失败");
|
|
9258
9289
|
await this.reconcilePackageDependencies();
|
|
@@ -9529,7 +9560,9 @@ var PluginService = class extends Service {
|
|
|
9529
9560
|
reason: "module.registerHooks is unavailable (Node < 22.15), changed submodules would not be re-imported"
|
|
9530
9561
|
};
|
|
9531
9562
|
try {
|
|
9532
|
-
|
|
9563
|
+
const result = await this.lock(rt.entry.name, () => this.reloadPackage(rt.entry.name));
|
|
9564
|
+
await this.reloadImportConsumers(rt.entry.name);
|
|
9565
|
+
return result;
|
|
9533
9566
|
} finally {
|
|
9534
9567
|
await this.reconcilePackageDependencies();
|
|
9535
9568
|
}
|
|
@@ -9771,6 +9804,10 @@ var PluginService = class extends Service {
|
|
|
9771
9804
|
return old && shown(old) !== shown(pkg);
|
|
9772
9805
|
});
|
|
9773
9806
|
this.packages = next;
|
|
9807
|
+
this.resolver.plugins = new Map([...next.values()].map((pkg) => [pkg.name, {
|
|
9808
|
+
root: pathToFileURL(pkg.root + path.sep).href,
|
|
9809
|
+
dependencies: pkg.manifest.dependencies ?? {}
|
|
9810
|
+
}]));
|
|
9774
9811
|
this.resolver.roots = [...next.values(), ...this.builtinPackages.list().flatMap((item) => {
|
|
9775
9812
|
const pkg = this.builtinPackages.package(item.entryName);
|
|
9776
9813
|
return pkg ? [pkg] : [];
|
|
@@ -9816,6 +9853,8 @@ var PluginService = class extends Service {
|
|
|
9816
9853
|
if (cached && !fresh) return cached;
|
|
9817
9854
|
const epoch = (this.epochs.get(pkg.name) ?? 0) + 1;
|
|
9818
9855
|
this.epochs.set(pkg.name, epoch);
|
|
9856
|
+
const previousEpoch = this.moduleEpochs.get(pkg.name);
|
|
9857
|
+
this.moduleEpochs.set(pkg.name, epoch);
|
|
9819
9858
|
const loaded = {};
|
|
9820
9859
|
try {
|
|
9821
9860
|
const plugin = unwrapPlugin(await __vitePreload(() => import(`${pathToFileURL(pkg.main).href}?v=${epoch}`), []));
|
|
@@ -9823,6 +9862,8 @@ var PluginService = class extends Service {
|
|
|
9823
9862
|
if (bundlesOwnCordis(plugin)) throw new Error(`the plugin carries its own copy of cordis; build it with cordis and ${SDK_PACKAGE} marked external`);
|
|
9824
9863
|
loaded.plugin = plugin;
|
|
9825
9864
|
} catch (e) {
|
|
9865
|
+
if (previousEpoch === void 0) this.moduleEpochs.delete(pkg.name);
|
|
9866
|
+
else this.moduleEpochs.set(pkg.name, previousEpoch);
|
|
9826
9867
|
loaded.error = errorText(e);
|
|
9827
9868
|
}
|
|
9828
9869
|
if (loaded.plugin || !cached) this.modules.set(pkg.name, loaded);
|
|
@@ -9950,6 +9991,10 @@ var PluginService = class extends Service {
|
|
|
9950
9991
|
const pkg = await readPluginPackage(known.root) ?? known;
|
|
9951
9992
|
pkg.location = known.location;
|
|
9952
9993
|
this.packages.set(name, pkg);
|
|
9994
|
+
this.resolver.plugins?.set(name, {
|
|
9995
|
+
root: pathToFileURL(pkg.root + path.sep).href,
|
|
9996
|
+
dependencies: pkg.manifest.dependencies ?? {}
|
|
9997
|
+
});
|
|
9953
9998
|
this.bumpWebui(name);
|
|
9954
9999
|
const targets = this.entriesOf(name).filter((rt) => !this.isDisabled(rt));
|
|
9955
10000
|
if (this.incompatibility(pkg) || targets.some((rt) => this.packageBlock(rt))) {
|
|
@@ -9978,6 +10023,26 @@ var PluginService = class extends Service {
|
|
|
9978
10023
|
await Promise.all(targets.map((rt) => rt.fiber?.await().catch(() => {})));
|
|
9979
10024
|
return { status: "reloaded" };
|
|
9980
10025
|
}
|
|
10026
|
+
/** Imports capture ES module instances. Refresh consumers after a provider reload, outside its lock. */
|
|
10027
|
+
async reloadImportConsumers(provider) {
|
|
10028
|
+
const graph = this.resolver.imports ?? /* @__PURE__ */ new Map();
|
|
10029
|
+
const affected = /* @__PURE__ */ new Set([provider]);
|
|
10030
|
+
for (const name of affected) for (const [consumer, imports] of graph) if (imports.has(name)) affected.add(consumer);
|
|
10031
|
+
const visited = /* @__PURE__ */ new Set([provider]);
|
|
10032
|
+
const order = [];
|
|
10033
|
+
const visit = (name) => {
|
|
10034
|
+
if (visited.has(name)) return;
|
|
10035
|
+
visited.add(name);
|
|
10036
|
+
for (const dependency of graph.get(name) ?? []) if (affected.has(dependency)) visit(dependency);
|
|
10037
|
+
order.push(name);
|
|
10038
|
+
};
|
|
10039
|
+
for (const name of affected) visit(name);
|
|
10040
|
+
for (const consumer of order) {
|
|
10041
|
+
if (!this.packages.has(consumer)) continue;
|
|
10042
|
+
if (this.entriesOf(consumer).some((rt) => !this.isDisabled(rt))) await this.lock(consumer, () => this.reloadPackage(consumer));
|
|
10043
|
+
else this.modules.delete(consumer);
|
|
10044
|
+
}
|
|
10045
|
+
}
|
|
9981
10046
|
onFiberStatus(fiber) {
|
|
9982
10047
|
this.observeBuiltinFailure(fiber);
|
|
9983
10048
|
const id = this.fiberIds.get(fiber);
|
|
@@ -10230,6 +10295,7 @@ var PluginService = class extends Service {
|
|
|
10230
10295
|
this.ctx.logger.info(`${pkg.name} changed, reloading`);
|
|
10231
10296
|
try {
|
|
10232
10297
|
await this.lock(pkg.name, () => this.reloadPackage(pkg.name));
|
|
10298
|
+
await this.reloadImportConsumers(pkg.name);
|
|
10233
10299
|
} finally {
|
|
10234
10300
|
await this.reconcilePackageDependencies();
|
|
10235
10301
|
}
|