build: 重建 dist(插件 priority 生效 + 静态连接池类型 + 常量注释修正)
This commit is contained in:
Vendored
+20
-8
@@ -16623,9 +16623,22 @@ class MetonaSqlark {
|
||||
// 初始化执行器和事务管理器
|
||||
this.executor = new QueryExecutor(this.engine, this.maxRowsPerQuery);
|
||||
this.transactionManager = new TransactionManager(this.engine);
|
||||
// 注册插件
|
||||
// 注册插件。
|
||||
//
|
||||
// v0.8.0:**先按 priority 降序排序再注册** —— 在这之前 PluginManager.register
|
||||
// 虽然会把插件插到正确的位置,但 `install()` 是在 register 里**立即**调用的,
|
||||
// 因此 install 与钩子的实际执行顺序仍等于 config 数组顺序
|
||||
//(实测:priority 为 low/high/mid 的插件,钩子按 low→high→mid 触发,
|
||||
// 只有 getPlugins() 才是 high,mid,low)。而 README/CONTRIBUTING 一直宣称
|
||||
// "priority 越大越先执行" —— 文档与实现不符。
|
||||
// 这里选择**让实现符合文档**(priority 是用户可见的配置项,静默无效比没有更糟)。
|
||||
// 用稳定排序:同优先级保持 config 数组中的相对顺序。
|
||||
if (this.config.plugins) {
|
||||
for (const plugin of this.config.plugins) {
|
||||
const ordered = this.config.plugins
|
||||
.map((plugin, index) => ({ plugin, index }))
|
||||
.sort((a, b) => (b.plugin.priority ?? 0) - (a.plugin.priority ?? 0) || a.index - b.index)
|
||||
.map((entry) => entry.plugin);
|
||||
for (const plugin of ordered) {
|
||||
this.pluginManager.register(plugin, this);
|
||||
}
|
||||
}
|
||||
@@ -17331,12 +17344,11 @@ class ConnectionManager {
|
||||
// 全局单例
|
||||
// ---------------------------------------------------------------------------
|
||||
const manager = new ConnectionManager();
|
||||
// 挂载到 MetonaSqlark 静态方法(通过 any 绕过 TS 类型检查)
|
||||
const M = MetonaSqlark;
|
||||
M.connect = (config) => manager.connect(config);
|
||||
M.disconnect = (dbName) => manager.release(dbName);
|
||||
M.disconnectAll = () => manager.closeAll();
|
||||
M.getActiveConnections = () => manager.getActiveConnections();
|
||||
// 挂载到 MetonaSqlark 静态方法(v0.8.0:类型已在类上声明,无需 any 断言)
|
||||
MetonaSqlark.connect = (config) => manager.connect(config);
|
||||
MetonaSqlark.disconnect = (dbName) => manager.release(dbName);
|
||||
MetonaSqlark.disconnectAll = () => manager.closeAll();
|
||||
MetonaSqlark.getActiveConnections = () => manager.getActiveConnections();
|
||||
|
||||
/**
|
||||
* migrateFromIndexedDB — 旧 IndexedDB 数据迁移到自研 KV 引擎
|
||||
|
||||
Reference in New Issue
Block a user