@feng0531/dsh-code-review 0.24.0 → 0.24.1
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/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/context-relations.mjs +13 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -4,6 +4,19 @@ import { inferImportRelations } from './import-relations.mjs';
|
|
|
4
4
|
// Context entries are already sent with every primary. These annotations add
|
|
5
5
|
// explanations only, never reads, group members, or reviewed coverage.
|
|
6
6
|
export function inferContextRelations(input, file) {
|
|
7
|
+
if (input.history) {
|
|
8
|
+
const relations=[];
|
|
9
|
+
for (const side of ['old','new']) {
|
|
10
|
+
const contexts=(input.context ?? []).filter(c=>side==='new'||typeof c.oldText==='string').map(c=>({...c,text:side==='old'?c.oldText:c.text}));
|
|
11
|
+
const text=side==='old'?file.left.text:file.right.text;
|
|
12
|
+
// Infer each version independently: never bind an old import to target definitions.
|
|
13
|
+
const one={...file,left:{...file.left,text:''},right:{...file.right,text}};
|
|
14
|
+
const version=side==='old'?input.history.base:input.history.target;
|
|
15
|
+
const scoped={...input,history:undefined,context:contexts};
|
|
16
|
+
relations.push(...inferContextRelations(scoped,one).filter(e=>e.side!=='old').map(e=>({...e,side:e.fromPath===file.path?side:side==='old'?'context-old':'context',contextVersion:version,contextSide:side})));
|
|
17
|
+
}
|
|
18
|
+
return relations.slice(0,2000);
|
|
19
|
+
}
|
|
7
20
|
const paths = new Set(input.files.map(f => f.path));
|
|
8
21
|
const contexts = (input.context ?? []).filter(c => !paths.has(c.path));
|
|
9
22
|
const primary = { ...file, id: 'primary' };
|