fix(modeler): T1.1 评审收口——bpmn-moddle 显式devDep+$attrs断言+类型声明
评审 I-1 / M-1 / TS7016 收口(承接 8fdfe68): - I-1 幻影依赖:devDependencies 显式声明 bpmn-moddle ^8.1.0(npm dedupe 到与 bpmn-js 同一份 8.1.0),保真测试不再依赖传递提升、与 Modeler 运行时同版本。 - M-1 断言意图纠偏:fidelity.test.ts 原注释「未声明时 .get() 返 undefined」实证有误—— moddle .get() 对未声明属性会回落 $attrs 返原值(已实证:flowable:assignee 未声明时 .get() 返 "X")。改注释 + 增 `expect($attrs?.['activiti:candidateUsers']).toBeUndefined()` 直接断言值未落 lax $attrs(=真 typed 化,声明属性确不在 $attrs)。 - TS7016:新增 src/modeler/moddle/bpmn-moddle.d.ts(最小 ambient 声明)消编辑器诊断。 验证:npx vitest run src/modeler 12/12 绿;npx tsc -b 干净(exit 0)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1
package-lock.json
generated
1
package-lock.json
generated
@@ -31,6 +31,7 @@
|
|||||||
"amis-formula": "^6.13.0",
|
"amis-formula": "^6.13.0",
|
||||||
"amis-theme-editor-helper": "^6.12.0-ab.1",
|
"amis-theme-editor-helper": "^6.12.0-ab.1",
|
||||||
"amis-ui": "^6.13.0",
|
"amis-ui": "^6.13.0",
|
||||||
|
"bpmn-moddle": "^8.1.0",
|
||||||
"i18n-runtime": "^1.0.13",
|
"i18n-runtime": "^1.0.13",
|
||||||
"jsdom": "^29.1.1",
|
"jsdom": "^29.1.1",
|
||||||
"typescript": "5.6.3",
|
"typescript": "5.6.3",
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
"amis-formula": "^6.13.0",
|
"amis-formula": "^6.13.0",
|
||||||
"amis-theme-editor-helper": "^6.12.0-ab.1",
|
"amis-theme-editor-helper": "^6.12.0-ab.1",
|
||||||
"amis-ui": "^6.13.0",
|
"amis-ui": "^6.13.0",
|
||||||
|
"bpmn-moddle": "^8.1.0",
|
||||||
"i18n-runtime": "^1.0.13",
|
"i18n-runtime": "^1.0.13",
|
||||||
"jsdom": "^29.1.1",
|
"jsdom": "^29.1.1",
|
||||||
"typescript": "5.6.3",
|
"typescript": "5.6.3",
|
||||||
|
|||||||
3
src/modeler/moddle/bpmn-moddle.d.ts
vendored
Normal file
3
src/modeler/moddle/bpmn-moddle.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// bpmn-moddle 8.x 无自带类型声明(TS7016)。最小 ambient 声明消编辑器诊断;
|
||||||
|
// 运行时行为以 fidelity.test.ts 的 round-trip 断言为准。
|
||||||
|
declare module 'bpmn-moddle';
|
||||||
@@ -63,8 +63,11 @@ describe('activiti round-trip 零丢失(合成 fixture 覆盖全扩展面)',
|
|||||||
it('candidateUsers 被识别为 typed 属性且逐字保留(全角【】+ 尾空格 + JSON 原样)', async () => {
|
it('candidateUsers 被识别为 typed 属性且逐字保留(全角【】+ 尾空格 + JSON 原样)', async () => {
|
||||||
const { rootElement } = await newActiviti().fromXML(SYNTHETIC_BPMN);
|
const { rootElement } = await newActiviti().fromXML(SYNTHETIC_BPMN);
|
||||||
const receive = findById(rootElement, 't_receive');
|
const receive = findById(rootElement, 't_receive');
|
||||||
// 若描述符未声明 candidateUsers,值会落进 $attrs 而 .get() 返 undefined —— 该断言同时守住 typed 化。
|
// 逐字保真:解析值 byte-exact 等于原文。
|
||||||
expect(receive.get('activiti:candidateUsers')).toBe(EXPECTED_CANDIDATE_USERS);
|
expect(receive.get('activiti:candidateUsers')).toBe(EXPECTED_CANDIDATE_USERS);
|
||||||
|
// typed 化的直接证据:值走声明属性、未回落 lax $attrs。
|
||||||
|
// (moddle .get() 对未声明属性也会回落 $attrs 返原值,故单看 .get() 不足以证明 typed 化。)
|
||||||
|
expect(receive.$attrs?.['activiti:candidateUsers']).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('多实例 collection/elementVariable/completionCondition 解析为结构化模型', async () => {
|
it('多实例 collection/elementVariable/completionCondition 解析为结构化模型', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user