- 插件包改为 .xuqm.zip 事务制品,manifest/bundle/资源/SHA-256 统一校验 - 原生层拆分为桥接编排、插件包暂存、底层存储三个单一职责类 - 状态查询改为纯读取,不再误触发安装;新增 NATIVE_BASELINE_INCOMPATIBLE 拒绝 - SemVer 解析拆分为独立原生类并补原生测试 - XWebView 收口唯一内核,错误态统一中文层与重试 - common 增加请求头/运行时契约收口与 http 测试
30 行
902 B
TypeScript
30 行
902 B
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import {
|
|
definePlugin,
|
|
getDefinedPluginIds,
|
|
getPluginDefinition,
|
|
removePluginDefinition,
|
|
} from '../src/PluginRegistry'
|
|
|
|
test('plugin definition is visible through the process-wide registry', () => {
|
|
const definition = { moduleId: 'registry-test', activate() {} }
|
|
definePlugin(definition)
|
|
|
|
assert.equal(getPluginDefinition('registry-test'), definition)
|
|
assert.ok(getDefinedPluginIds().includes('registry-test'))
|
|
|
|
removePluginDefinition('registry-test')
|
|
assert.equal(getPluginDefinition('registry-test'), undefined)
|
|
})
|
|
|
|
test('rejects two different definitions for the same module', () => {
|
|
definePlugin({ moduleId: 'duplicate-test', activate() {} })
|
|
assert.throws(
|
|
() => definePlugin({ moduleId: 'duplicate-test', activate() {} }),
|
|
/already defined/,
|
|
)
|
|
removePluginDefinition('duplicate-test')
|
|
})
|