@teambit/semantics.entities.semantic-schema 0.0.110 → 0.0.112
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/dist/schema-diff-members.js +45 -26
- package/dist/schema-diff-members.js.map +1 -1
- package/dist/schema-diff.d.ts +5 -0
- package/dist/schema-diff.js +21 -4
- package/dist/schema-diff.js.map +1 -1
- package/dist/schema-node.js +5 -2
- package/dist/schema-node.js.map +1 -1
- package/dist/schemas/function-like.d.ts +11 -0
- package/dist/schemas/function-like.js +22 -2
- package/dist/schemas/function-like.js.map +1 -1
- package/package.json +2 -2
- package/schema-diff-members.ts +40 -23
- package/schema-diff.ts +26 -4
- package/schema-node.ts +5 -2
- package/schemas/function-like.ts +22 -2
|
@@ -34,7 +34,9 @@ function classifyMemberChange(base, compare) {
|
|
|
34
34
|
doc: undefined
|
|
35
35
|
};
|
|
36
36
|
if ((0, _schemaDiff().deepEqualNoLocation)(baseStripped, compareStripped)) return 'member-documentation-changed';
|
|
37
|
-
|
|
37
|
+
// require both signatures present: a null on one side is missing extraction data, not a real
|
|
38
|
+
// signature change — fall through to the internal (patch) classification rather than flag breaking.
|
|
39
|
+
if (base.signature && compare.signature && base.signature !== compare.signature) return 'member-signature-changed';
|
|
38
40
|
return 'member-definition-changed';
|
|
39
41
|
}
|
|
40
42
|
function diffAddedMembers(compareMemberMap, baseMemberMap) {
|
|
@@ -93,10 +95,14 @@ function diffModifiedMembers(baseMemberMap, compareMemberMap, baseNode, compareN
|
|
|
93
95
|
const bNode = baseNode.members?.find(n => n.name === name);
|
|
94
96
|
const cNode = compareNode.members?.find(n => n.name === name);
|
|
95
97
|
if (bNode && cNode) {
|
|
98
|
+
// carry the member signature so member-level facts (notably doc-only changes) can show the
|
|
99
|
+
// declaration as context in the UI — the doc sits on top of the signature it documents.
|
|
100
|
+
const signature = compareMember.signature || baseMember.signature;
|
|
96
101
|
for (const d of bNode.diff(cNode)) {
|
|
97
102
|
facts.push({
|
|
98
103
|
...d,
|
|
99
|
-
description: `${kind} '${name}': ${d.description}
|
|
104
|
+
description: `${kind} '${name}': ${d.description}`,
|
|
105
|
+
signature
|
|
100
106
|
});
|
|
101
107
|
}
|
|
102
108
|
continue;
|
|
@@ -118,47 +124,60 @@ function diffModifiedMembers(baseMemberMap, compareMemberMap, baseNode, compareN
|
|
|
118
124
|
}
|
|
119
125
|
function diffStructural(baseObj, compareObj) {
|
|
120
126
|
const facts = [];
|
|
127
|
+
|
|
128
|
+
// NOTE on the `from !== to` guards below: `deepEqualNoLocation` compares the raw nodes, which can
|
|
129
|
+
// carry non-semantic differences between two builds (resolved-type internals, doc, ordering of
|
|
130
|
+
// equivalent representations). Those make the deep compare report a change even when the rendered
|
|
131
|
+
// type the consumer actually sees is identical — e.g. `extends React.Component<P, S>` on both
|
|
132
|
+
// sides getting flagged MAJOR. So a structural change is only real once its human-comparable
|
|
133
|
+
// string representation differs; otherwise it's a false positive and we drop it.
|
|
121
134
|
if (!(0, _schemaDiff().deepEqualNoLocation)(baseObj.typeParams, compareObj.typeParams)) {
|
|
122
135
|
const from = (baseObj.typeParams || []).join(', ');
|
|
123
136
|
const to = (compareObj.typeParams || []).join(', ');
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
if (from !== to) {
|
|
138
|
+
facts.push({
|
|
139
|
+
changeKind: 'type-parameters-changed',
|
|
140
|
+
description: `type parameters changed: <${from || 'none'}> → <${to || 'none'}>`,
|
|
141
|
+
context: {
|
|
142
|
+
from,
|
|
143
|
+
to
|
|
144
|
+
},
|
|
128
145
|
from,
|
|
129
146
|
to
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
to
|
|
133
|
-
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
134
149
|
}
|
|
135
150
|
if (!(0, _schemaDiff().deepEqualNoLocation)(baseObj.extendsNodes, compareObj.extendsNodes)) {
|
|
136
151
|
const from = (baseObj.extendsNodes || []).map(n => n.name || (0, _schemaDiff().typeStr)(n)).join(', ') || 'none';
|
|
137
152
|
const to = (compareObj.extendsNodes || []).map(n => n.name || (0, _schemaDiff().typeStr)(n)).join(', ') || 'none';
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
153
|
+
if (from !== to) {
|
|
154
|
+
facts.push({
|
|
155
|
+
changeKind: 'extends-changed',
|
|
156
|
+
description: `extends changed: ${from} → ${to}`,
|
|
157
|
+
context: {
|
|
158
|
+
from,
|
|
159
|
+
to
|
|
160
|
+
},
|
|
142
161
|
from,
|
|
143
162
|
to
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
to
|
|
147
|
-
});
|
|
163
|
+
});
|
|
164
|
+
}
|
|
148
165
|
}
|
|
149
166
|
if ((baseObj.implementNodes || compareObj.implementNodes) && !(0, _schemaDiff().deepEqualNoLocation)(baseObj.implementNodes, compareObj.implementNodes)) {
|
|
150
167
|
const from = (baseObj.implementNodes || []).map(n => n.name || (0, _schemaDiff().typeStr)(n)).join(', ') || 'none';
|
|
151
168
|
const to = (compareObj.implementNodes || []).map(n => n.name || (0, _schemaDiff().typeStr)(n)).join(', ') || 'none';
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
169
|
+
if (from !== to) {
|
|
170
|
+
facts.push({
|
|
171
|
+
changeKind: 'implements-changed',
|
|
172
|
+
description: `implements changed: ${from} → ${to}`,
|
|
173
|
+
context: {
|
|
174
|
+
from,
|
|
175
|
+
to
|
|
176
|
+
},
|
|
156
177
|
from,
|
|
157
178
|
to
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
to
|
|
161
|
-
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
162
181
|
}
|
|
163
182
|
return facts;
|
|
164
183
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_schemaDiff","data","require","MEMBER_CHANGE_LABELS","memberKey","m","name","signature","toMemberMap","members","Map","map","classifyMemberChange","base","compare","baseStripped","location","undefined","doc","compareStripped","deepEqualNoLocation","diffAddedMembers","compareMemberMap","baseMemberMap","facts","member","has","kind","schemaDisplayName","__schema","push","changeKind","description","isOptional","context","memberName","memberKind","to","diffRemovedMembers","isPublic","modifiers","includes","from","diffModifiedMembers","baseNode","compareNode","baseMember","compareMember","get","bNode","find","n","cNode","d","diff","diffStructural","baseObj","compareObj","typeParams","join","extendsNodes","typeStr","implementNodes","diffMembers","diffDoc"],"sources":["schema-diff-members.ts"],"sourcesContent":["import type { SchemaNode } from './schema-node';\nimport type { SchemaChangeFact } from './schema-diff';\nimport { deepEqualNoLocation, diffDoc, schemaDisplayName, typeStr } from './schema-diff';\n\ntype MemberMap = Map<string, Record<string, any>>;\n\nconst MEMBER_CHANGE_LABELS: Record<string, string> = {\n 'member-documentation-changed': 'documentation changed',\n 'member-signature-changed': 'signature changed',\n 'member-definition-changed': 'internal definition changed',\n};\n\nfunction memberKey(m: Record<string, any>): string {\n return m.name || m.signature || '';\n}\n\nfunction toMemberMap(members: Record<string, any>[]): MemberMap {\n return new Map(members.map((m) => [memberKey(m), m]));\n}\n\nfunction classifyMemberChange(base: Record<string, any>, compare: Record<string, any>): string {\n const baseStripped = { ...base, location: undefined, doc: undefined };\n const compareStripped = { ...compare, location: undefined, doc: undefined };\n if (deepEqualNoLocation(baseStripped, compareStripped)) return 'member-documentation-changed';\n if (base.signature !== compare.signature) return 'member-signature-changed';\n return 'member-definition-changed';\n}\n\nfunction diffAddedMembers(compareMemberMap: MemberMap, baseMemberMap: MemberMap): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n for (const [name, member] of compareMemberMap) {\n if (baseMemberMap.has(name)) continue;\n const kind = schemaDisplayName(member.__schema || '', true);\n facts.push({\n changeKind: 'member-added',\n description: `${kind} '${name}' added${member.isOptional ? ' (optional)' : ''}: ${member.signature || name}`,\n context: {\n memberName: name,\n memberKind: kind,\n isOptional: !!member.isOptional,\n signature: member.signature || name,\n },\n to: member.signature || name,\n });\n }\n return facts;\n}\n\nfunction diffRemovedMembers(baseMemberMap: MemberMap, compareMemberMap: MemberMap): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n for (const [name, member] of baseMemberMap) {\n if (compareMemberMap.has(name)) continue;\n const kind = schemaDisplayName(member.__schema || '', true);\n const isPublic = !(member.modifiers || []).includes('private');\n facts.push({\n changeKind: 'member-removed',\n description: `${kind} '${name}' removed${isPublic ? ' — consumers using it will break' : ' (was private)'}`,\n context: { memberName: name, memberKind: kind, isPublic, signature: member.signature || name },\n from: member.signature || name,\n });\n }\n return facts;\n}\n\nfunction diffModifiedMembers(\n baseMemberMap: MemberMap,\n compareMemberMap: MemberMap,\n baseNode: SchemaNode,\n compareNode: SchemaNode\n): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n for (const [name, baseMember] of baseMemberMap) {\n const compareMember = compareMemberMap.get(name);\n if (!compareMember) continue;\n if (deepEqualNoLocation({ ...baseMember, location: undefined }, { ...compareMember, location: undefined }))\n continue;\n\n const kind = schemaDisplayName(baseMember.__schema || '', true);\n\n if (baseMember.__schema === 'FunctionLikeSchema' && compareMember.__schema === 'FunctionLikeSchema') {\n const bNode = ((baseNode as any).members as SchemaNode[])?.find((n: any) => n.name === name);\n const cNode = ((compareNode as any).members as SchemaNode[])?.find((n: any) => n.name === name);\n if (bNode && cNode) {\n for (const d of bNode.diff(cNode)) {\n facts.push({ ...d, description: `${kind} '${name}': ${d.description}` });\n }\n continue;\n }\n }\n\n const changeKind = classifyMemberChange(baseMember, compareMember);\n facts.push({\n changeKind,\n description: `${kind} '${name}' ${MEMBER_CHANGE_LABELS[changeKind]}`,\n context: { memberName: name, memberKind: kind },\n from: baseMember.signature || name,\n to: compareMember.signature || name,\n });\n }\n return facts;\n}\n\nfunction diffStructural(baseObj: Record<string, any>, compareObj: Record<string, any>): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n\n if (!deepEqualNoLocation(baseObj.typeParams, compareObj.typeParams)) {\n const from = (baseObj.typeParams || []).join(', ');\n const to = (compareObj.typeParams || []).join(', ');\n facts.push({\n changeKind: 'type-parameters-changed',\n description: `type parameters changed: <${from || 'none'}> → <${to || 'none'}>`,\n context: { from, to },\n from,\n to,\n });\n }\n\n if (!deepEqualNoLocation(baseObj.extendsNodes, compareObj.extendsNodes)) {\n const from = (baseObj.extendsNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';\n const to = (compareObj.extendsNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';\n facts.push({\n changeKind: 'extends-changed',\n description: `extends changed: ${from} → ${to}`,\n context: { from, to },\n from,\n to,\n });\n }\n\n if (\n (baseObj.implementNodes || compareObj.implementNodes) &&\n !deepEqualNoLocation(baseObj.implementNodes, compareObj.implementNodes)\n ) {\n const from = (baseObj.implementNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';\n const to = (compareObj.implementNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';\n facts.push({\n changeKind: 'implements-changed',\n description: `implements changed: ${from} → ${to}`,\n context: { from, to },\n from,\n to,\n });\n }\n\n return facts;\n}\n\nexport function diffMembers(\n baseObj: Record<string, any>,\n compareObj: Record<string, any>,\n baseNode: SchemaNode,\n compareNode: SchemaNode\n): SchemaChangeFact[] {\n const baseMemberMap = toMemberMap(baseObj.members || []);\n const compareMemberMap = toMemberMap(compareObj.members || []);\n\n return [\n ...diffAddedMembers(compareMemberMap, baseMemberMap),\n ...diffRemovedMembers(baseMemberMap, compareMemberMap),\n ...diffModifiedMembers(baseMemberMap, compareMemberMap, baseNode, compareNode),\n ...diffStructural(baseObj, compareObj),\n ...diffDoc(baseObj.doc, compareObj.doc),\n ];\n}\n"],"mappings":";;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,MAAME,oBAA4C,GAAG;EACnD,8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F,CAAC,CAAC;EACJ;EAEA,OAAOb,KAAK;AACd;AAEO,SAASuC,WAAWA,CACzBP,OAA4B,EAC5BC,UAA+B,EAC/Bb,QAAoB,EACpBC,WAAuB,EACH;EACpB,MAAMtB,aAAa,GAAGf,WAAW,CAACgD,OAAO,CAAC/C,OAAO,IAAI,EAAE,CAAC;EACxD,MAAMa,gBAAgB,GAAGd,WAAW,CAACiD,UAAU,CAAChD,OAAO,IAAI,EAAE,CAAC;EAE9D,OAAO,CACL,GAAGY,gBAAgB,CAACC,gBAAgB,EAAEC,aAAa,CAAC,EACpD,GAAGe,kBAAkB,CAACf,aAAa,EAAED,gBAAgB,CAAC,EACtD,GAAGqB,mBAAmB,CAACpB,aAAa,EAAED,gBAAgB,EAAEsB,QAAQ,EAAEC,WAAW,CAAC,EAC9E,GAAGU,cAAc,CAACC,OAAO,EAAEC,UAAU,CAAC,EACtC,GAAG,IAAAO,qBAAO,EAACR,OAAO,CAACtC,GAAG,EAAEuC,UAAU,CAACvC,GAAG,CAAC,CACxC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_schemaDiff","data","require","MEMBER_CHANGE_LABELS","memberKey","m","name","signature","toMemberMap","members","Map","map","classifyMemberChange","base","compare","baseStripped","location","undefined","doc","compareStripped","deepEqualNoLocation","diffAddedMembers","compareMemberMap","baseMemberMap","facts","member","has","kind","schemaDisplayName","__schema","push","changeKind","description","isOptional","context","memberName","memberKind","to","diffRemovedMembers","isPublic","modifiers","includes","from","diffModifiedMembers","baseNode","compareNode","baseMember","compareMember","get","bNode","find","n","cNode","d","diff","diffStructural","baseObj","compareObj","typeParams","join","extendsNodes","typeStr","implementNodes","diffMembers","diffDoc"],"sources":["schema-diff-members.ts"],"sourcesContent":["import type { SchemaNode } from './schema-node';\nimport type { SchemaChangeFact } from './schema-diff';\nimport { deepEqualNoLocation, diffDoc, schemaDisplayName, typeStr } from './schema-diff';\n\ntype MemberMap = Map<string, Record<string, any>>;\n\nconst MEMBER_CHANGE_LABELS: Record<string, string> = {\n 'member-documentation-changed': 'documentation changed',\n 'member-signature-changed': 'signature changed',\n 'member-definition-changed': 'internal definition changed',\n};\n\nfunction memberKey(m: Record<string, any>): string {\n return m.name || m.signature || '';\n}\n\nfunction toMemberMap(members: Record<string, any>[]): MemberMap {\n return new Map(members.map((m) => [memberKey(m), m]));\n}\n\nfunction classifyMemberChange(base: Record<string, any>, compare: Record<string, any>): string {\n const baseStripped = { ...base, location: undefined, doc: undefined };\n const compareStripped = { ...compare, location: undefined, doc: undefined };\n if (deepEqualNoLocation(baseStripped, compareStripped)) return 'member-documentation-changed';\n // require both signatures present: a null on one side is missing extraction data, not a real\n // signature change — fall through to the internal (patch) classification rather than flag breaking.\n if (base.signature && compare.signature && base.signature !== compare.signature) return 'member-signature-changed';\n return 'member-definition-changed';\n}\n\nfunction diffAddedMembers(compareMemberMap: MemberMap, baseMemberMap: MemberMap): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n for (const [name, member] of compareMemberMap) {\n if (baseMemberMap.has(name)) continue;\n const kind = schemaDisplayName(member.__schema || '', true);\n facts.push({\n changeKind: 'member-added',\n description: `${kind} '${name}' added${member.isOptional ? ' (optional)' : ''}: ${member.signature || name}`,\n context: {\n memberName: name,\n memberKind: kind,\n isOptional: !!member.isOptional,\n signature: member.signature || name,\n },\n to: member.signature || name,\n });\n }\n return facts;\n}\n\nfunction diffRemovedMembers(baseMemberMap: MemberMap, compareMemberMap: MemberMap): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n for (const [name, member] of baseMemberMap) {\n if (compareMemberMap.has(name)) continue;\n const kind = schemaDisplayName(member.__schema || '', true);\n const isPublic = !(member.modifiers || []).includes('private');\n facts.push({\n changeKind: 'member-removed',\n description: `${kind} '${name}' removed${isPublic ? ' — consumers using it will break' : ' (was private)'}`,\n context: { memberName: name, memberKind: kind, isPublic, signature: member.signature || name },\n from: member.signature || name,\n });\n }\n return facts;\n}\n\nfunction diffModifiedMembers(\n baseMemberMap: MemberMap,\n compareMemberMap: MemberMap,\n baseNode: SchemaNode,\n compareNode: SchemaNode\n): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n for (const [name, baseMember] of baseMemberMap) {\n const compareMember = compareMemberMap.get(name);\n if (!compareMember) continue;\n if (deepEqualNoLocation({ ...baseMember, location: undefined }, { ...compareMember, location: undefined }))\n continue;\n\n const kind = schemaDisplayName(baseMember.__schema || '', true);\n\n if (baseMember.__schema === 'FunctionLikeSchema' && compareMember.__schema === 'FunctionLikeSchema') {\n const bNode = ((baseNode as any).members as SchemaNode[])?.find((n: any) => n.name === name);\n const cNode = ((compareNode as any).members as SchemaNode[])?.find((n: any) => n.name === name);\n if (bNode && cNode) {\n // carry the member signature so member-level facts (notably doc-only changes) can show the\n // declaration as context in the UI — the doc sits on top of the signature it documents.\n const signature = compareMember.signature || baseMember.signature;\n for (const d of bNode.diff(cNode)) {\n facts.push({ ...d, description: `${kind} '${name}': ${d.description}`, signature });\n }\n continue;\n }\n }\n\n const changeKind = classifyMemberChange(baseMember, compareMember);\n facts.push({\n changeKind,\n description: `${kind} '${name}' ${MEMBER_CHANGE_LABELS[changeKind]}`,\n context: { memberName: name, memberKind: kind },\n from: baseMember.signature || name,\n to: compareMember.signature || name,\n });\n }\n return facts;\n}\n\nfunction diffStructural(baseObj: Record<string, any>, compareObj: Record<string, any>): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n\n // NOTE on the `from !== to` guards below: `deepEqualNoLocation` compares the raw nodes, which can\n // carry non-semantic differences between two builds (resolved-type internals, doc, ordering of\n // equivalent representations). Those make the deep compare report a change even when the rendered\n // type the consumer actually sees is identical — e.g. `extends React.Component<P, S>` on both\n // sides getting flagged MAJOR. So a structural change is only real once its human-comparable\n // string representation differs; otherwise it's a false positive and we drop it.\n if (!deepEqualNoLocation(baseObj.typeParams, compareObj.typeParams)) {\n const from = (baseObj.typeParams || []).join(', ');\n const to = (compareObj.typeParams || []).join(', ');\n if (from !== to) {\n facts.push({\n changeKind: 'type-parameters-changed',\n description: `type parameters changed: <${from || 'none'}> → <${to || 'none'}>`,\n context: { from, to },\n from,\n to,\n });\n }\n }\n\n if (!deepEqualNoLocation(baseObj.extendsNodes, compareObj.extendsNodes)) {\n const from = (baseObj.extendsNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';\n const to = (compareObj.extendsNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';\n if (from !== to) {\n facts.push({\n changeKind: 'extends-changed',\n description: `extends changed: ${from} → ${to}`,\n context: { from, to },\n from,\n to,\n });\n }\n }\n\n if (\n (baseObj.implementNodes || compareObj.implementNodes) &&\n !deepEqualNoLocation(baseObj.implementNodes, compareObj.implementNodes)\n ) {\n const from = (baseObj.implementNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';\n const to = (compareObj.implementNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';\n if (from !== to) {\n facts.push({\n changeKind: 'implements-changed',\n description: `implements changed: ${from} → ${to}`,\n context: { from, to },\n from,\n to,\n });\n }\n }\n\n return facts;\n}\n\nexport function diffMembers(\n baseObj: Record<string, any>,\n compareObj: Record<string, any>,\n baseNode: SchemaNode,\n compareNode: SchemaNode\n): SchemaChangeFact[] {\n const baseMemberMap = toMemberMap(baseObj.members || []);\n const compareMemberMap = toMemberMap(compareObj.members || []);\n\n return [\n ...diffAddedMembers(compareMemberMap, baseMemberMap),\n ...diffRemovedMembers(baseMemberMap, compareMemberMap),\n ...diffModifiedMembers(baseMemberMap, compareMemberMap, baseNode, compareNode),\n ...diffStructural(baseObj, compareObj),\n ...diffDoc(baseObj.doc, compareObj.doc),\n ];\n}\n"],"mappings":";;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,MAAME,oBAA4C,GAAG;EACnD,8BAA8B,EAA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D,qBAAO,EAACV,CAAC,CAAC,CAAC,CAACQ,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM;IACvG,IAAIjB,IAAI,KAAKL,EAAE,EAAE;MACfb,KAAK,CAACM,IAAI,CAAC;QACTC,UAAU,EAAE,oBAAoB;QAChCC,WAAW,EAAE,uBAAuBU,IAAI,MAAML,EAAE,EAAE;QAClDH,OAAO,EAAE;UAAEQ,IAAI;UAAEL;QAAG,CAAC;QACrBK,IAAI;QACJL;MACF,CAAC,CAAC;IACJ;EACF;EAEA,OAAOb,KAAK;AACd;AAEO,SAASuC,WAAWA,CACzBP,OAA4B,EAC5BC,UAA+B,EAC/Bb,QAAoB,EACpBC,WAAuB,EACH;EACpB,MAAMtB,aAAa,GAAGf,WAAW,CAACgD,OAAO,CAAC/C,OAAO,IAAI,EAAE,CAAC;EACxD,MAAMa,gBAAgB,GAAGd,WAAW,CAACiD,UAAU,CAAChD,OAAO,IAAI,EAAE,CAAC;EAE9D,OAAO,CACL,GAAGY,gBAAgB,CAACC,gBAAgB,EAAEC,aAAa,CAAC,EACpD,GAAGe,kBAAkB,CAACf,aAAa,EAAED,gBAAgB,CAAC,EACtD,GAAGqB,mBAAmB,CAACpB,aAAa,EAAED,gBAAgB,EAAEsB,QAAQ,EAAEC,WAAW,CAAC,EAC9E,GAAGU,cAAc,CAACC,OAAO,EAAEC,UAAU,CAAC,EACtC,GAAG,IAAAO,qBAAO,EAACR,OAAO,CAACtC,GAAG,EAAEuC,UAAU,CAACvC,GAAG,CAAC,CACxC;AACH","ignoreList":[]}
|
package/dist/schema-diff.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export type SchemaChangeFact = {
|
|
|
5
5
|
context: Record<string, any>;
|
|
6
6
|
from?: string;
|
|
7
7
|
to?: string;
|
|
8
|
+
/**
|
|
9
|
+
* the owning member's signature, carried on member-level facts (e.g. a doc-only change) so the UI
|
|
10
|
+
* can show the declaration as context — "what member is this doc/change on" — next to the diff.
|
|
11
|
+
*/
|
|
12
|
+
signature?: string;
|
|
8
13
|
};
|
|
9
14
|
export declare function schemaDisplayName(rawSchemaType: string, singular?: boolean): string;
|
|
10
15
|
export declare function typeStr(node: Record<string, any> | undefined): string;
|
package/dist/schema-diff.js
CHANGED
|
@@ -102,6 +102,23 @@ function deepEqualNoLocation(a, b) {
|
|
|
102
102
|
}
|
|
103
103
|
return false;
|
|
104
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* the full human-readable doc text: the description plus every JSDoc tag (`@see …`, `@deprecated …`,
|
|
108
|
+
* etc.) on its own line. The diff must show the whole comment — surfacing only `doc.comment` drops
|
|
109
|
+
* the tags, so a "documentation removed" reads as a trimmed fragment of what was actually there.
|
|
110
|
+
*/
|
|
111
|
+
function fullDocText(doc) {
|
|
112
|
+
if (!doc) return undefined;
|
|
113
|
+
const parts = [];
|
|
114
|
+
if (doc.comment) parts.push(doc.comment);
|
|
115
|
+
for (const tag of doc.tags || []) {
|
|
116
|
+
const tagName = tag.tagName || tag.name;
|
|
117
|
+
if (!tagName) continue;
|
|
118
|
+
parts.push(`@${tagName}${tag.comment ? ` ${tag.comment}` : ''}`);
|
|
119
|
+
}
|
|
120
|
+
return parts.join('\n') || doc.raw || undefined;
|
|
121
|
+
}
|
|
105
122
|
function diffDoc(baseDoc, compareDoc) {
|
|
106
123
|
if (deepEqualNoLocation(baseDoc, compareDoc)) return [];
|
|
107
124
|
if (!baseDoc && compareDoc) {
|
|
@@ -109,7 +126,7 @@ function diffDoc(baseDoc, compareDoc) {
|
|
|
109
126
|
changeKind: 'documentation-added',
|
|
110
127
|
description: 'documentation added',
|
|
111
128
|
context: {},
|
|
112
|
-
to: compareDoc
|
|
129
|
+
to: fullDocText(compareDoc) || '(doc added)'
|
|
113
130
|
}];
|
|
114
131
|
}
|
|
115
132
|
if (baseDoc && !compareDoc) {
|
|
@@ -117,7 +134,7 @@ function diffDoc(baseDoc, compareDoc) {
|
|
|
117
134
|
changeKind: 'documentation-removed',
|
|
118
135
|
description: 'documentation removed',
|
|
119
136
|
context: {},
|
|
120
|
-
from: baseDoc
|
|
137
|
+
from: fullDocText(baseDoc) || '(doc removed)'
|
|
121
138
|
}];
|
|
122
139
|
}
|
|
123
140
|
const changes = [];
|
|
@@ -130,8 +147,8 @@ function diffDoc(baseDoc, compareDoc) {
|
|
|
130
147
|
changeKind: 'documentation-changed',
|
|
131
148
|
description: `documentation ${changes.join(' and ')} changed`,
|
|
132
149
|
context: {},
|
|
133
|
-
from: baseDoc
|
|
134
|
-
to: compareDoc
|
|
150
|
+
from: fullDocText(baseDoc),
|
|
151
|
+
to: fullDocText(compareDoc)
|
|
135
152
|
}];
|
|
136
153
|
}
|
|
137
154
|
|
package/dist/schema-diff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SCHEMA_DISPLAY_NAMES","FunctionLikeSchema","ClassSchema","InterfaceSchema","TypeSchema","EnumSchema","VariableLikeSchema","ModuleSchema","ReactSchema","TypeRefSchema","TypeUnionSchema","TypeIntersectionSchema","TypeLiteralSchema","TypeArraySchema","TupleTypeSchema","ParameterSchema","ExportSchema","DecoratorSchema","ConstructorSchema","GetAccessorSchema","SetAccessorSchema","IndexSignatureSchema","KeywordTypeSchema","LiteralTypeSchema","InferenceTypeSchema","schemaDisplayName","rawSchemaType","singular","name","pluralize","cleaned","replace","trim","word","endsWith","test","slice","TYPE_RENDERERS","n","types","map","t","typeStr","join","type","members","value","undefined","String","base","typeArgs","length","a","m","signature","filter","Boolean","ParenthesizedTypeSchema","node","renderer","__schema","typeStrFallback","typesAreSemanticallyEqual","compare","baseArgs","compareArgs","every","i","deepEqualNoLocation","b","Array","isArray","item","keysA","Object","keys","k","keysB","key","diffDoc","baseDoc","compareDoc","changeKind","description","context","to","comment","from","changes","push","baseTags","tags","tagName","sort","compareTags"],"sources":["schema-diff.ts"],"sourcesContent":["export type SchemaChangeFact = {\n changeKind: string;\n description: string;\n /** Structured metadata for the impact assessor to reason about. */\n context: Record<string, any>;\n from?: string;\n to?: string;\n};\n\nconst SCHEMA_DISPLAY_NAMES: Record<string, string> = {\n FunctionLikeSchema: 'Function',\n ClassSchema: 'Class',\n InterfaceSchema: 'Interface',\n TypeSchema: 'Type Alias',\n EnumSchema: 'Enum',\n VariableLikeSchema: 'Variable',\n ModuleSchema: 'Namespace',\n ReactSchema: 'React Component',\n TypeRefSchema: 'Type Reference',\n TypeUnionSchema: 'Union Type',\n TypeIntersectionSchema: 'Intersection Type',\n TypeLiteralSchema: 'Type Literal',\n TypeArraySchema: 'Array Type',\n TupleTypeSchema: 'Tuple Type',\n ParameterSchema: 'Parameter',\n ExportSchema: 'Export',\n DecoratorSchema: 'Decorator',\n ConstructorSchema: 'Constructor',\n GetAccessorSchema: 'Getter',\n SetAccessorSchema: 'Setter',\n IndexSignatureSchema: 'Index Signature',\n KeywordTypeSchema: 'Keyword Type',\n LiteralTypeSchema: 'Literal Type',\n InferenceTypeSchema: 'Inferred Type',\n};\n\nexport function schemaDisplayName(rawSchemaType: string, singular = true): string {\n const name = SCHEMA_DISPLAY_NAMES[rawSchemaType];\n if (name) return singular ? name : pluralize(name);\n const cleaned = rawSchemaType\n .replace(/Schema$/, '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n return singular ? cleaned : pluralize(cleaned);\n}\n\nfunction pluralize(word: string): string {\n if (word.endsWith('s') || word.endsWith('x') || word.endsWith('z')) return `${word}es`;\n if (word.endsWith('y') && !/[aeiou]y$/i.test(word)) return `${word.slice(0, -1)}ies`;\n return `${word}s`;\n}\n\ntype TypeRenderer = (node: Record<string, any>) => string;\n\nconst TYPE_RENDERERS: Record<string, TypeRenderer> = {\n TypeUnionSchema: (n) => (n.types || []).map((t: any) => typeStr(t)).join(' | ') || 'unknown',\n TypeIntersectionSchema: (n) => (n.types || []).map((t: any) => typeStr(t)).join(' & ') || 'unknown',\n TypeArraySchema: (n) => `${typeStr(n.type)}[]`,\n TupleTypeSchema: (n) => `[${(n.members || []).map((t: any) => typeStr(t)).join(', ')}]`,\n InferenceTypeSchema: (n) => n.type || n.name || 'inferred',\n KeywordTypeSchema: (n) => n.name || 'keyword',\n LiteralTypeSchema: (n) => (n.value !== undefined ? String(n.value) : n.name || 'literal'),\n TypeRefSchema: (n) => {\n const base = n.name || 'Ref';\n return n.typeArgs?.length ? `${base}<${n.typeArgs.map((a: any) => typeStr(a)).join(', ')}>` : base;\n },\n TypeLiteralSchema: (n) => {\n const members = (n.members || []).map((m: any) => m.signature || m.name || '').filter(Boolean);\n return members.length <= 3 ? `{ ${members.join('; ')} }` : `{ ${members.slice(0, 3).join('; ')}; ... }`;\n },\n ParenthesizedTypeSchema: (n) => `(${typeStr(n.type)})`,\n};\n\nexport function typeStr(node: Record<string, any> | undefined): string {\n if (!node) return 'unknown';\n const renderer = TYPE_RENDERERS[node.__schema];\n if (renderer) return renderer(node);\n return node.signature || node.name || typeStrFallback(node);\n}\n\nfunction typeStrFallback(node: Record<string, any>): string {\n if (node.type && typeof node.type === 'string') return node.type;\n if (node.type && typeof node.type === 'object') return typeStr(node.type);\n return schemaDisplayName(node.__schema || 'unknown', true);\n}\n\nexport function typesAreSemanticallyEqual(\n base: Record<string, any> | undefined,\n compare: Record<string, any> | undefined\n): boolean {\n if (!base && !compare) return true;\n if (!base || !compare) return false;\n\n if (base.__schema === 'TypeRefSchema' && compare.__schema === 'TypeRefSchema') {\n if (base.name !== compare.name) return false;\n const baseArgs = base.typeArgs || [];\n const compareArgs = compare.typeArgs || [];\n if (baseArgs.length !== compareArgs.length) return false;\n return baseArgs.every((a: any, i: number) => typesAreSemanticallyEqual(a, compareArgs[i]));\n }\n\n return deepEqualNoLocation(base, compare);\n}\n\nexport function deepEqualNoLocation(a: any, b: any): boolean {\n if (a === b) return true;\n if (a == null || b == null) return false;\n if (typeof a !== typeof b) return false;\n\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false;\n return a.every((item, i) => deepEqualNoLocation(item, b[i]));\n }\n\n if (typeof a === 'object') {\n const keysA = Object.keys(a).filter((k) => k !== 'location');\n const keysB = Object.keys(b).filter((k) => k !== 'location');\n if (keysA.length !== keysB.length) return false;\n return keysA.every((key) => deepEqualNoLocation(a[key], b[key]));\n }\n\n return false;\n}\n\nexport function diffDoc(\n baseDoc: Record<string, any> | undefined,\n compareDoc: Record<string, any> | undefined\n): SchemaChangeFact[] {\n if (deepEqualNoLocation(baseDoc, compareDoc)) return [];\n\n if (!baseDoc && compareDoc) {\n return [\n {\n changeKind: 'documentation-added',\n description: 'documentation added',\n context: {},\n to: compareDoc.comment || '(doc added)',\n },\n ];\n }\n if (baseDoc && !compareDoc) {\n return [\n {\n changeKind: 'documentation-removed',\n description: 'documentation removed',\n context: {},\n from: baseDoc.comment || '(doc removed)',\n },\n ];\n }\n\n const changes: string[] = [];\n if (baseDoc?.comment !== compareDoc?.comment) changes.push('description');\n const baseTags = (baseDoc?.tags || []).map((t: any) => t.tagName || t.name).sort();\n const compareTags = (compareDoc?.tags || []).map((t: any) => t.tagName || t.name).sort();\n if (!deepEqualNoLocation(baseTags, compareTags)) changes.push('tags');\n if (changes.length === 0) changes.push('content');\n\n return [\n {\n changeKind: 'documentation-changed',\n description: `documentation ${changes.join(' and ')} changed`,\n context: {},\n from: baseDoc?.comment,\n to: compareDoc?.comment,\n },\n ];\n}\n"],"mappings":";;;;;;;;;;AASA,MAAMA,oBAA4C,GAAG;EACnDC,kBAAkB,EAAE,UAAU;EAC9BC,WAAW,EAAE,OAAO;EACpBC,eAAe,EAAE,WAAW;EAC5BC,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE,MAAM;EAClBC,kBAAkB,EAAE,UAAU;EAC9BC,YAAY,EAAE,WAAW;EACzBC,WAAW,EAAE,iBAAiB;EAC9BC,aAAa,EAAE,gBAAgB;EAC/BC,eAAe,EAAE,YAAY;EAC7BC,sBAAsB,EAAE,mBAAmB;EAC3CC,iBAAiB,EAAE,cAAc;EACjCC,eAAe,EAAE,YAAY;EAC7BC,eAAe,EAAE,Y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AQ,GAAG,CAACV,OAAO,EAAEW,IAAI,IAAI,EAAE,EAAEnD,GAAG,CAAEC,CAAM,IAAKA,CAAC,CAACmD,OAAO,IAAInD,CAAC,CAACb,IAAI,CAAC,CAACiE,IAAI,CAAC,CAAC;EAClF,MAAMC,WAAW,GAAG,CAACb,UAAU,EAAEU,IAAI,IAAI,EAAE,EAAEnD,GAAG,CAAEC,CAAM,IAAKA,CAAC,CAACmD,OAAO,IAAInD,CAAC,CAACb,IAAI,CAAC,CAACiE,IAAI,CAAC,CAAC;EACxF,IAAI,CAACzB,mBAAmB,CAACsB,QAAQ,EAAEI,WAAW,CAAC,EAAEN,OAAO,CAACC,IAAI,CAAC,MAAM,CAAC;EACrE,IAAID,OAAO,CAACrC,MAAM,KAAK,CAAC,EAAEqC,OAAO,CAACC,IAAI,CAAC,SAAS,CAAC;EAEjD,OAAO,CACL;IACEP,UAAU,EAAE,uBAAuB;IACnCC,WAAW,EAAE,iBAAiBK,OAAO,CAAC7C,IAAI,CAAC,OAAO,CAAC,UAAU;IAC7DyC,OAAO,EAAE,CAAC,CAAC;IACXG,IAAI,EAAEP,OAAO,EAAEM,OAAO;IACtBD,EAAE,EAAEJ,UAAU,EAAEK;EAClB,CAAC,CACF;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["SCHEMA_DISPLAY_NAMES","FunctionLikeSchema","ClassSchema","InterfaceSchema","TypeSchema","EnumSchema","VariableLikeSchema","ModuleSchema","ReactSchema","TypeRefSchema","TypeUnionSchema","TypeIntersectionSchema","TypeLiteralSchema","TypeArraySchema","TupleTypeSchema","ParameterSchema","ExportSchema","DecoratorSchema","ConstructorSchema","GetAccessorSchema","SetAccessorSchema","IndexSignatureSchema","KeywordTypeSchema","LiteralTypeSchema","InferenceTypeSchema","schemaDisplayName","rawSchemaType","singular","name","pluralize","cleaned","replace","trim","word","endsWith","test","slice","TYPE_RENDERERS","n","types","map","t","typeStr","join","type","members","value","undefined","String","base","typeArgs","length","a","m","signature","filter","Boolean","ParenthesizedTypeSchema","node","renderer","__schema","typeStrFallback","typesAreSemanticallyEqual","compare","baseArgs","compareArgs","every","i","deepEqualNoLocation","b","Array","isArray","item","keysA","Object","keys","k","keysB","key","fullDocText","doc","parts","comment","push","tag","tags","tagName","raw","diffDoc","baseDoc","compareDoc","changeKind","description","context","to","from","changes","baseTags","sort","compareTags"],"sources":["schema-diff.ts"],"sourcesContent":["export type SchemaChangeFact = {\n changeKind: string;\n description: string;\n /** Structured metadata for the impact assessor to reason about. */\n context: Record<string, any>;\n from?: string;\n to?: string;\n /**\n * the owning member's signature, carried on member-level facts (e.g. a doc-only change) so the UI\n * can show the declaration as context — \"what member is this doc/change on\" — next to the diff.\n */\n signature?: string;\n};\n\nconst SCHEMA_DISPLAY_NAMES: Record<string, string> = {\n FunctionLikeSchema: 'Function',\n ClassSchema: 'Class',\n InterfaceSchema: 'Interface',\n TypeSchema: 'Type Alias',\n EnumSchema: 'Enum',\n VariableLikeSchema: 'Variable',\n ModuleSchema: 'Namespace',\n ReactSchema: 'React Component',\n TypeRefSchema: 'Type Reference',\n TypeUnionSchema: 'Union Type',\n TypeIntersectionSchema: 'Intersection Type',\n TypeLiteralSchema: 'Type Literal',\n TypeArraySchema: 'Array Type',\n TupleTypeSchema: 'Tuple Type',\n ParameterSchema: 'Parameter',\n ExportSchema: 'Export',\n DecoratorSchema: 'Decorator',\n ConstructorSchema: 'Constructor',\n GetAccessorSchema: 'Getter',\n SetAccessorSchema: 'Setter',\n IndexSignatureSchema: 'Index Signature',\n KeywordTypeSchema: 'Keyword Type',\n LiteralTypeSchema: 'Literal Type',\n InferenceTypeSchema: 'Inferred Type',\n};\n\nexport function schemaDisplayName(rawSchemaType: string, singular = true): string {\n const name = SCHEMA_DISPLAY_NAMES[rawSchemaType];\n if (name) return singular ? name : pluralize(name);\n const cleaned = rawSchemaType\n .replace(/Schema$/, '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n return singular ? cleaned : pluralize(cleaned);\n}\n\nfunction pluralize(word: string): string {\n if (word.endsWith('s') || word.endsWith('x') || word.endsWith('z')) return `${word}es`;\n if (word.endsWith('y') && !/[aeiou]y$/i.test(word)) return `${word.slice(0, -1)}ies`;\n return `${word}s`;\n}\n\ntype TypeRenderer = (node: Record<string, any>) => string;\n\nconst TYPE_RENDERERS: Record<string, TypeRenderer> = {\n TypeUnionSchema: (n) => (n.types || []).map((t: any) => typeStr(t)).join(' | ') || 'unknown',\n TypeIntersectionSchema: (n) => (n.types || []).map((t: any) => typeStr(t)).join(' & ') || 'unknown',\n TypeArraySchema: (n) => `${typeStr(n.type)}[]`,\n TupleTypeSchema: (n) => `[${(n.members || []).map((t: any) => typeStr(t)).join(', ')}]`,\n InferenceTypeSchema: (n) => n.type || n.name || 'inferred',\n KeywordTypeSchema: (n) => n.name || 'keyword',\n LiteralTypeSchema: (n) => (n.value !== undefined ? String(n.value) : n.name || 'literal'),\n TypeRefSchema: (n) => {\n const base = n.name || 'Ref';\n return n.typeArgs?.length ? `${base}<${n.typeArgs.map((a: any) => typeStr(a)).join(', ')}>` : base;\n },\n TypeLiteralSchema: (n) => {\n const members = (n.members || []).map((m: any) => m.signature || m.name || '').filter(Boolean);\n return members.length <= 3 ? `{ ${members.join('; ')} }` : `{ ${members.slice(0, 3).join('; ')}; ... }`;\n },\n ParenthesizedTypeSchema: (n) => `(${typeStr(n.type)})`,\n};\n\nexport function typeStr(node: Record<string, any> | undefined): string {\n if (!node) return 'unknown';\n const renderer = TYPE_RENDERERS[node.__schema];\n if (renderer) return renderer(node);\n return node.signature || node.name || typeStrFallback(node);\n}\n\nfunction typeStrFallback(node: Record<string, any>): string {\n if (node.type && typeof node.type === 'string') return node.type;\n if (node.type && typeof node.type === 'object') return typeStr(node.type);\n return schemaDisplayName(node.__schema || 'unknown', true);\n}\n\nexport function typesAreSemanticallyEqual(\n base: Record<string, any> | undefined,\n compare: Record<string, any> | undefined\n): boolean {\n if (!base && !compare) return true;\n if (!base || !compare) return false;\n\n if (base.__schema === 'TypeRefSchema' && compare.__schema === 'TypeRefSchema') {\n if (base.name !== compare.name) return false;\n const baseArgs = base.typeArgs || [];\n const compareArgs = compare.typeArgs || [];\n if (baseArgs.length !== compareArgs.length) return false;\n return baseArgs.every((a: any, i: number) => typesAreSemanticallyEqual(a, compareArgs[i]));\n }\n\n return deepEqualNoLocation(base, compare);\n}\n\nexport function deepEqualNoLocation(a: any, b: any): boolean {\n if (a === b) return true;\n if (a == null || b == null) return false;\n if (typeof a !== typeof b) return false;\n\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false;\n return a.every((item, i) => deepEqualNoLocation(item, b[i]));\n }\n\n if (typeof a === 'object') {\n const keysA = Object.keys(a).filter((k) => k !== 'location');\n const keysB = Object.keys(b).filter((k) => k !== 'location');\n if (keysA.length !== keysB.length) return false;\n return keysA.every((key) => deepEqualNoLocation(a[key], b[key]));\n }\n\n return false;\n}\n\n/**\n * the full human-readable doc text: the description plus every JSDoc tag (`@see …`, `@deprecated …`,\n * etc.) on its own line. The diff must show the whole comment — surfacing only `doc.comment` drops\n * the tags, so a \"documentation removed\" reads as a trimmed fragment of what was actually there.\n */\nfunction fullDocText(doc: Record<string, any> | undefined): string | undefined {\n if (!doc) return undefined;\n const parts: string[] = [];\n if (doc.comment) parts.push(doc.comment);\n for (const tag of doc.tags || []) {\n const tagName = tag.tagName || tag.name;\n if (!tagName) continue;\n parts.push(`@${tagName}${tag.comment ? ` ${tag.comment}` : ''}`);\n }\n return parts.join('\\n') || doc.raw || undefined;\n}\n\nexport function diffDoc(\n baseDoc: Record<string, any> | undefined,\n compareDoc: Record<string, any> | undefined\n): SchemaChangeFact[] {\n if (deepEqualNoLocation(baseDoc, compareDoc)) return [];\n\n if (!baseDoc && compareDoc) {\n return [\n {\n changeKind: 'documentation-added',\n description: 'documentation added',\n context: {},\n to: fullDocText(compareDoc) || '(doc added)',\n },\n ];\n }\n if (baseDoc && !compareDoc) {\n return [\n {\n changeKind: 'documentation-removed',\n description: 'documentation removed',\n context: {},\n from: fullDocText(baseDoc) || '(doc removed)',\n },\n ];\n }\n\n const changes: string[] = [];\n if (baseDoc?.comment !== compareDoc?.comment) changes.push('description');\n const baseTags = (baseDoc?.tags || []).map((t: any) => t.tagName || t.name).sort();\n const compareTags = (compareDoc?.tags || []).map((t: any) => t.tagName || t.name).sort();\n if (!deepEqualNoLocation(baseTags, compareTags)) changes.push('tags');\n if (changes.length === 0) changes.push('content');\n\n return [\n {\n changeKind: 'documentation-changed',\n description: `documentation ${changes.join(' and ')} changed`,\n context: {},\n from: fullDocText(baseDoc),\n to: fullDocText(compareDoc),\n },\n ];\n}\n"],"mappings":";;;;;;;;;;AAcA,MAAMA,oBAA4C,GAAG;EACnDC,kBAAkB,EAAE,UAAU;EAC9BC,WAAW,EAAE,OAAO;EACpBC,eAAe,EAAE,WAAW;EAC5BC,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE,MAAM;EAClBC,kBAAkB,EAAE,UAAU;EAC9BC,YAAY,EAAE,WAAW;EACzBC,WAAW,EAAE,iBAAiB;EAC9BC,aAAa,EAAE,gBAAgB;EAC/BC,eAAe,EAAE,YAAY;EAC7BC,sBAAsB,EAAE,mBAAmB;EAC3CC,iBAAiB,EAAE,cAAc;EACjCC,eAAe,EAAE,YAAY;EAC7BC,eAAe,EAAE,YAAY;EAC7BC,eAAe,EAAE,WAAW;EAC5BC,YAAY,EAAE,QAAQ;EACtBC,eAAe,EAAE,WAAW;EAC5BC,iBAAiB,EAAE,aAAa;EAChCC,iBAAiB,EAAE,QAAQ;EAC3BC,iBAAiB,EAAE,QAAQ;EAC3BC,oBAAoB,EAAE,iBAAiB;EACvCC,iBAAiB,EAAE,cAAc;EACjCC,iBAAiB,EAAE,cAAc;EACjCC,mBAAmB,EAAE;AACvB,CAAC;AAEM,SAASC,iBAAiBA,CAACC,aAAqB,EAAEC,QAAQ,GAAG,IAAI,EAAU;EAChF,MAAMC,IAAI,GAAG5B,oBAAoB,CAAC0B,aAAa,C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AAC,CAAC;MACXE,IAAI,EAAEhB,WAAW,CAACU,OAAO,CAAC,IAAI;IAChC,CAAC,CACF;EACH;EAEA,MAAMO,OAAiB,GAAG,EAAE;EAC5B,IAAIP,OAAO,EAAEP,OAAO,KAAKQ,UAAU,EAAER,OAAO,EAAEc,OAAO,CAACb,IAAI,CAAC,aAAa,CAAC;EACzE,MAAMc,QAAQ,GAAG,CAACR,OAAO,EAAEJ,IAAI,IAAI,EAAE,EAAE7C,GAAG,CAAEC,CAAM,IAAKA,CAAC,CAAC6C,OAAO,IAAI7C,CAAC,CAACb,IAAI,CAAC,CAACsE,IAAI,CAAC,CAAC;EAClF,MAAMC,WAAW,GAAG,CAACT,UAAU,EAAEL,IAAI,IAAI,EAAE,EAAE7C,GAAG,CAAEC,CAAM,IAAKA,CAAC,CAAC6C,OAAO,IAAI7C,CAAC,CAACb,IAAI,CAAC,CAACsE,IAAI,CAAC,CAAC;EACxF,IAAI,CAAC9B,mBAAmB,CAAC6B,QAAQ,EAAEE,WAAW,CAAC,EAAEH,OAAO,CAACb,IAAI,CAAC,MAAM,CAAC;EACrE,IAAIa,OAAO,CAAC7C,MAAM,KAAK,CAAC,EAAE6C,OAAO,CAACb,IAAI,CAAC,SAAS,CAAC;EAEjD,OAAO,CACL;IACEQ,UAAU,EAAE,uBAAuB;IACnCC,WAAW,EAAE,iBAAiBI,OAAO,CAACrD,IAAI,CAAC,OAAO,CAAC,UAAU;IAC7DkD,OAAO,EAAE,CAAC,CAAC;IACXE,IAAI,EAAEhB,WAAW,CAACU,OAAO,CAAC;IAC1BK,EAAE,EAAEf,WAAW,CAACW,UAAU;EAC5B,CAAC,CACF;AACH","ignoreList":[]}
|
package/dist/schema-node.js
CHANGED
|
@@ -95,8 +95,11 @@ class SchemaNode {
|
|
|
95
95
|
};
|
|
96
96
|
if ((0, _schemaDiff().deepEqualNoLocation)(baseNoDoc, compareNoDoc)) return facts;
|
|
97
97
|
|
|
98
|
-
// Signature changed
|
|
99
|
-
|
|
98
|
+
// Signature changed — only when BOTH sides actually have a signature. A null/empty signature on
|
|
99
|
+
// one side means the extractor produced no signature there (e.g. an incompletely-built compare
|
|
100
|
+
// snapshot), not that the API changed; comparing a real signature against `undefined` would
|
|
101
|
+
// otherwise report a bogus breaking "signature changed" (a major source of false breaking flags).
|
|
102
|
+
if (baseObj.signature && compareObj.signature && baseObj.signature !== compareObj.signature) {
|
|
100
103
|
facts.push({
|
|
101
104
|
changeKind: 'signature-changed',
|
|
102
105
|
description: 'signature changed',
|
package/dist/schema-node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","data","require","_pluralize","_interopRequireDefault","_schemaDiff","e","__esModule","default","SchemaNode","__schema","constructor","name","displaySchemaName","pluralize","replace","trim","fromObject","obj","Error","toObject","pickBy","location","doc","undefined","signature","v","getNodes","getAllNodesRecursively","visitedNodes","Set","has","add","nodes","flatMap","node","findNode","predicate","child","foundNode","diff","other","facts","baseObj","compareObj","push","diffDoc","baseNoDoc","compareNoDoc","deepEqualNoLocation","changeKind","description","context","fromSignature","toSignature","from","to","exports"],"sources":["schema-node.ts"],"sourcesContent":["import { pickBy } from 'lodash';\nimport pluralize from 'pluralize';\nimport type { DocSchema } from './schemas';\nimport type { SchemaChangeFact } from './schema-diff';\nimport { deepEqualNoLocation, diffDoc } from './schema-diff';\n\nexport interface ISchemaNode {\n __schema: string;\n name?: string;\n displaySchemaName: string;\n location: SchemaLocation;\n doc?: DocSchema;\n signature?: string;\n toObject(): Record<string, any>;\n toString(options?: { color?: boolean }): string;\n toFullSignature(options?: { showDocs?: boolean }): string;\n getNodes(): SchemaNode[];\n findNode(predicate: (node: SchemaNode) => boolean, visitedNodes?: Set<SchemaNode>): SchemaNode | undefined;\n getAllNodesRecursively(visitedNodes?: Set<SchemaNode>): SchemaNode[];\n diff(other: SchemaNode): SchemaChangeFact[];\n}\n\n/**\n * a convenient abstract class for all schema to extend.\n * the reason for having it as an abstract class and not an interface, for now, is mostly for the `__schema` prop.\n * this way it won't need to be implemented in each one of the subclasses.\n */\nexport abstract class SchemaNode implements ISchemaNode {\n readonly __schema = this.constructor.name;\n readonly displaySchemaName = pluralize(\n this.constructor.name\n .replace(/Schema$/, '')\n .replace(/([A-Z])/g, ' $1')\n .trim()\n );\n\n abstract readonly location: SchemaLocation;\n readonly doc?: DocSchema;\n readonly signature?: string;\n readonly name?: string;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static fromObject(obj: Record<string, any>): SchemaNode {\n throw new Error(`Method 'fromObject' not implemented in subclass.`);\n }\n\n toObject(): Record<string, any> {\n return pickBy(\n {\n __schema: this.__schema,\n location: this.location,\n doc: this.doc ? this.doc.toObject() : undefined,\n signature: this.signature,\n name: this.name,\n },\n (v) => v !== undefined\n );\n }\n\n abstract toString(options?: { color?: boolean }): string;\n abstract toFullSignature(options?: { showDocs?: boolean }): string;\n\n getNodes(): SchemaNode[] {\n return [this];\n }\n\n getAllNodesRecursively(visitedNodes = new Set<SchemaNode>()): SchemaNode[] {\n if (visitedNodes.has(this)) {\n return [];\n }\n\n visitedNodes.add(this);\n\n const nodes = this.getNodes();\n return [this, ...nodes.flatMap((node) => node.getAllNodesRecursively(visitedNodes))];\n }\n\n findNode(predicate: (node: SchemaNode) => boolean, visitedNodes = new Set<SchemaNode>()): SchemaNode | undefined {\n if (predicate(this)) return this;\n if (visitedNodes.has(this)) return undefined;\n\n visitedNodes.add(this);\n\n for (const child of this.getNodes()) {\n const foundNode = child.findNode(predicate, visitedNodes);\n if (foundNode) return foundNode;\n }\n\n return undefined;\n }\n\n /**\n * Compute neutral change facts between this node and another node of the same type.\n * Subclasses should override with type-specific comparison logic.\n * Returns facts without impact judgment — impact is assessed separately.\n */\n diff(other: SchemaNode): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n const baseObj = this.toObject();\n const compareObj = other.toObject();\n\n // Doc changes\n facts.push(...diffDoc(baseObj.doc, compareObj.doc));\n\n // If only doc changed, we're done\n const baseNoDoc = { ...baseObj, doc: undefined, location: undefined };\n const compareNoDoc = { ...compareObj, doc: undefined, location: undefined };\n if (deepEqualNoLocation(baseNoDoc, compareNoDoc)) return facts;\n\n // Signature changed\n if (baseObj.signature !== compareObj.signature) {\n facts.push({\n changeKind: 'signature-changed',\n description: 'signature changed',\n context: { fromSignature: baseObj.signature, toSignature: compareObj.signature },\n from: baseObj.signature,\n to: compareObj.signature,\n });\n }\n\n return facts;\n }\n}\n\nexport type SchemaLocation = {\n /**\n * file-path relative to the component root-dir. normalized to Linux.\n */\n filePath: string;\n line: number;\n character: number;\n};\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6D,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAkB7D;AACA;AACA;AACA;AACA;AACO,MAAeG,UAAU,CAAwB;EAC7CC,QAAQ,GAAG,IAAI,CAACC,WAAW,CAACC,IAAI;EAChCC,iBAAiB,GAAG,IAAAC,oBAAS,EACpC,IAAI,CAACH,WAAW,CAACC,IAAI,CAClBG,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CACtBA,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAC1BC,IAAI,CAAC,CACV,CAAC;EAMD;EACA,OAAOC,UAAUA,CAACC,GAAwB,EAAc;I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AS,EAAER,YAAY,CAAC;MACzD,IAAIU,SAAS,EAAE,OAAOA,SAAS;IACjC;IAEA,OAAOf,SAAS;EAClB;;EAEA;AACF;AACA;AACA;AACA;EACEgB,IAAIA,CAACC,KAAiB,EAAsB;IAC1C,MAAMC,KAAyB,GAAG,EAAE;IACpC,MAAMC,OAAO,GAAG,IAAI,CAACvB,QAAQ,CAAC,CAAC;IAC/B,MAAMwB,UAAU,GAAGH,KAAK,CAACrB,QAAQ,CAAC,CAAC;;IAEnC;IACAsB,KAAK,CAACG,IAAI,CAAC,GAAG,IAAAC,qBAAO,EAACH,OAAO,CAACpB,GAAG,EAAEqB,UAAU,CAACrB,GAAG,CAAC,CAAC;;IAEnD;IACA,MAAMwB,SAAS,GAAG;MAAE,GAAGJ,OAAO;MAAEpB,GAAG,EAAEC,SAAS;MAAEF,QAAQ,EAAEE;IAAU,CAAC;IACrE,MAAMwB,YAAY,GAAG;MAAE,GAAGJ,UAAU;MAAErB,GAAG,EAAEC,SAAS;MAAEF,QAAQ,EAAEE;IAAU,CAAC;IAC3E,IAAI,IAAAyB,iCAAmB,EAACF,SAAS,EAAEC,YAAY,CAAC,EAAE,OAAON,KAAK;;IAE9D;IACA,IAAIC,OAAO,CAAClB,SAAS,KAAKmB,UAAU,CAACnB,SAAS,EAAE;
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","_pluralize","_interopRequireDefault","_schemaDiff","e","__esModule","default","SchemaNode","__schema","constructor","name","displaySchemaName","pluralize","replace","trim","fromObject","obj","Error","toObject","pickBy","location","doc","undefined","signature","v","getNodes","getAllNodesRecursively","visitedNodes","Set","has","add","nodes","flatMap","node","findNode","predicate","child","foundNode","diff","other","facts","baseObj","compareObj","push","diffDoc","baseNoDoc","compareNoDoc","deepEqualNoLocation","changeKind","description","context","fromSignature","toSignature","from","to","exports"],"sources":["schema-node.ts"],"sourcesContent":["import { pickBy } from 'lodash';\nimport pluralize from 'pluralize';\nimport type { DocSchema } from './schemas';\nimport type { SchemaChangeFact } from './schema-diff';\nimport { deepEqualNoLocation, diffDoc } from './schema-diff';\n\nexport interface ISchemaNode {\n __schema: string;\n name?: string;\n displaySchemaName: string;\n location: SchemaLocation;\n doc?: DocSchema;\n signature?: string;\n toObject(): Record<string, any>;\n toString(options?: { color?: boolean }): string;\n toFullSignature(options?: { showDocs?: boolean }): string;\n getNodes(): SchemaNode[];\n findNode(predicate: (node: SchemaNode) => boolean, visitedNodes?: Set<SchemaNode>): SchemaNode | undefined;\n getAllNodesRecursively(visitedNodes?: Set<SchemaNode>): SchemaNode[];\n diff(other: SchemaNode): SchemaChangeFact[];\n}\n\n/**\n * a convenient abstract class for all schema to extend.\n * the reason for having it as an abstract class and not an interface, for now, is mostly for the `__schema` prop.\n * this way it won't need to be implemented in each one of the subclasses.\n */\nexport abstract class SchemaNode implements ISchemaNode {\n readonly __schema = this.constructor.name;\n readonly displaySchemaName = pluralize(\n this.constructor.name\n .replace(/Schema$/, '')\n .replace(/([A-Z])/g, ' $1')\n .trim()\n );\n\n abstract readonly location: SchemaLocation;\n readonly doc?: DocSchema;\n readonly signature?: string;\n readonly name?: string;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static fromObject(obj: Record<string, any>): SchemaNode {\n throw new Error(`Method 'fromObject' not implemented in subclass.`);\n }\n\n toObject(): Record<string, any> {\n return pickBy(\n {\n __schema: this.__schema,\n location: this.location,\n doc: this.doc ? this.doc.toObject() : undefined,\n signature: this.signature,\n name: this.name,\n },\n (v) => v !== undefined\n );\n }\n\n abstract toString(options?: { color?: boolean }): string;\n abstract toFullSignature(options?: { showDocs?: boolean }): string;\n\n getNodes(): SchemaNode[] {\n return [this];\n }\n\n getAllNodesRecursively(visitedNodes = new Set<SchemaNode>()): SchemaNode[] {\n if (visitedNodes.has(this)) {\n return [];\n }\n\n visitedNodes.add(this);\n\n const nodes = this.getNodes();\n return [this, ...nodes.flatMap((node) => node.getAllNodesRecursively(visitedNodes))];\n }\n\n findNode(predicate: (node: SchemaNode) => boolean, visitedNodes = new Set<SchemaNode>()): SchemaNode | undefined {\n if (predicate(this)) return this;\n if (visitedNodes.has(this)) return undefined;\n\n visitedNodes.add(this);\n\n for (const child of this.getNodes()) {\n const foundNode = child.findNode(predicate, visitedNodes);\n if (foundNode) return foundNode;\n }\n\n return undefined;\n }\n\n /**\n * Compute neutral change facts between this node and another node of the same type.\n * Subclasses should override with type-specific comparison logic.\n * Returns facts without impact judgment — impact is assessed separately.\n */\n diff(other: SchemaNode): SchemaChangeFact[] {\n const facts: SchemaChangeFact[] = [];\n const baseObj = this.toObject();\n const compareObj = other.toObject();\n\n // Doc changes\n facts.push(...diffDoc(baseObj.doc, compareObj.doc));\n\n // If only doc changed, we're done\n const baseNoDoc = { ...baseObj, doc: undefined, location: undefined };\n const compareNoDoc = { ...compareObj, doc: undefined, location: undefined };\n if (deepEqualNoLocation(baseNoDoc, compareNoDoc)) return facts;\n\n // Signature changed — only when BOTH sides actually have a signature. A null/empty signature on\n // one side means the extractor produced no signature there (e.g. an incompletely-built compare\n // snapshot), not that the API changed; comparing a real signature against `undefined` would\n // otherwise report a bogus breaking \"signature changed\" (a major source of false breaking flags).\n if (baseObj.signature && compareObj.signature && baseObj.signature !== compareObj.signature) {\n facts.push({\n changeKind: 'signature-changed',\n description: 'signature changed',\n context: { fromSignature: baseObj.signature, toSignature: compareObj.signature },\n from: baseObj.signature,\n to: compareObj.signature,\n });\n }\n\n return facts;\n }\n}\n\nexport type SchemaLocation = {\n /**\n * file-path relative to the component root-dir. normalized to Linux.\n */\n filePath: string;\n line: number;\n character: number;\n};\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA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,QAAQ,EAAEE;IAAU,CAAC;IAC3E,IAAI,IAAAyB,iCAAmB,EAACF,SAAS,EAAEC,YAAY,CAAC,EAAE,OAAON,KAAK;;IAE9D;IACA;IACA;IACA;IACA,IAAIC,OAAO,CAAClB,SAAS,IAAImB,UAAU,CAACnB,SAAS,IAAIkB,OAAO,CAAClB,SAAS,KAAKmB,UAAU,CAACnB,SAAS,EAAE;MAC3FiB,KAAK,CAACG,IAAI,CAAC;QACTK,UAAU,EAAE,mBAAmB;QAC/BC,WAAW,EAAE,mBAAmB;QAChCC,OAAO,EAAE;UAAEC,aAAa,EAAEV,OAAO,CAAClB,SAAS;UAAE6B,WAAW,EAAEV,UAAU,CAACnB;QAAU,CAAC;QAChF8B,IAAI,EAAEZ,OAAO,CAAClB,SAAS;QACvB+B,EAAE,EAAEZ,UAAU,CAACnB;MACjB,CAAC,CAAC;IACJ;IAEA,OAAOiB,KAAK;EACd;AACF;AAACe,OAAA,CAAAhD,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -63,6 +63,17 @@ export declare class FunctionLikeSchema extends SchemaNode {
|
|
|
63
63
|
typeParams: string[] | undefined;
|
|
64
64
|
decorators: Record<string, any>[] | undefined;
|
|
65
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* display string for a function's return type in diffs. Normally the returnType node's rendering —
|
|
68
|
+
* but schemas extracted while type inference was degraded (e.g. unresolved React types) can carry
|
|
69
|
+
* a bogus SELF-referential returnType: a `TypeRefSchema` named after the function itself, while
|
|
70
|
+
* the checker-generated `signature` string holds the real inferred text (`…): any`). Such
|
|
71
|
+
* artifacts are already persisted for built versions and can't be re-extracted, so when the node
|
|
72
|
+
* renders to the function's own name but the signature's return annotation disagrees, the
|
|
73
|
+
* signature wins. (A legitimately self-typed function — e.g. one merged with a same-named
|
|
74
|
+
* interface — agrees with its signature and is unaffected.)
|
|
75
|
+
*/
|
|
76
|
+
private static returnTypeDisplay;
|
|
66
77
|
static fromObject(obj: Record<string, any>): FunctionLikeSchema;
|
|
67
78
|
diff(other: SchemaNode): SchemaChangeFact[];
|
|
68
79
|
private static diffModifiers;
|
|
@@ -141,6 +141,26 @@ class FunctionLikeSchema extends _schemaNode().SchemaNode {
|
|
|
141
141
|
decorators: this.decorators?.map(decorator => decorator.toObject())
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* display string for a function's return type in diffs. Normally the returnType node's rendering —
|
|
147
|
+
* but schemas extracted while type inference was degraded (e.g. unresolved React types) can carry
|
|
148
|
+
* a bogus SELF-referential returnType: a `TypeRefSchema` named after the function itself, while
|
|
149
|
+
* the checker-generated `signature` string holds the real inferred text (`…): any`). Such
|
|
150
|
+
* artifacts are already persisted for built versions and can't be re-extracted, so when the node
|
|
151
|
+
* renders to the function's own name but the signature's return annotation disagrees, the
|
|
152
|
+
* signature wins. (A legitimately self-typed function — e.g. one merged with a same-named
|
|
153
|
+
* interface — agrees with its signature and is unaffected.)
|
|
154
|
+
*/
|
|
155
|
+
static returnTypeDisplay(obj) {
|
|
156
|
+
const nodeStr = (0, _schemaDiff().typeStr)(obj.returnType);
|
|
157
|
+
if (nodeStr !== obj.name) return nodeStr;
|
|
158
|
+
const signature = obj.signature;
|
|
159
|
+
const idx = signature ? signature.lastIndexOf('): ') : -1;
|
|
160
|
+
if (idx === -1 || !signature) return nodeStr;
|
|
161
|
+
const fromSignature = signature.slice(idx + 3).trim();
|
|
162
|
+
return fromSignature && fromSignature !== nodeStr ? fromSignature : nodeStr;
|
|
163
|
+
}
|
|
144
164
|
static fromObject(obj) {
|
|
145
165
|
return new FunctionLikeSchema(obj.location, obj.name, obj.params.map(param => _parameter().ParameterSchema.fromObject(param)), _schemaRegistry().SchemaRegistry.fromObject(obj.returnType), obj.signature, obj.modifiers, obj.doc ? _docs().DocSchema.fromObject(obj.doc) : undefined, obj.typeParams, obj.decorators?.map(decorator => _schemaRegistry().SchemaRegistry.fromObject(decorator)));
|
|
146
166
|
}
|
|
@@ -151,8 +171,8 @@ class FunctionLikeSchema extends _schemaNode().SchemaNode {
|
|
|
151
171
|
const compareObj = other.toObject();
|
|
152
172
|
FunctionLikeSchema.diffParams(baseObj.params || [], compareObj.params || [], facts);
|
|
153
173
|
if (!(0, _schemaDiff().typesAreSemanticallyEqual)(baseObj.returnType, compareObj.returnType)) {
|
|
154
|
-
const fromType =
|
|
155
|
-
const toType =
|
|
174
|
+
const fromType = FunctionLikeSchema.returnTypeDisplay(baseObj);
|
|
175
|
+
const toType = FunctionLikeSchema.returnTypeDisplay(compareObj);
|
|
156
176
|
facts.push({
|
|
157
177
|
changeKind: 'return-type-changed',
|
|
158
178
|
description: `return type changed: ${fromType} → ${toType}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_schemaNode","_schemaDiff","_parameter","_docs","_tag","_schemaRegistry","e","__esModule","default","FunctionLikeSchema","SchemaNode","displaySchemaName","constructor","location","name","params","returnType","signature","modifiers","doc","typeParams","decorators","createSignature","getNodes","toString","options","bold","color","chalk","text","paramsStr","map","param","join","typeParamsStr","decoratorsStr","decorator","modifiersToString","toFullSignature","result","showDocs","modifiersStr","paramStr","isSpread","isOptional","type","defaultValue","undefined","isDeprecated","Boolean","hasTag","TagName","deprecated","isPrivate","find","m","private","generateSignature","toObject","fromObject","obj","ParameterSchema","SchemaRegistry","DocSchema","diff","other","facts","baseObj","compareObj","diffParams","typesAreSemanticallyEqual","fromType","typeStr","toType","push","changeKind","description","context","position","from","to","deepEqualNoLocation","diffModifiers","diffDoc","baseMods","compareMods","base","filter","compare","added","includes","removed","parts","length","accessNarrowed","baseParams","compareParams","p","slice","isOpt","paramName","hasDefault","paramType","minLen","Math","min","i","diffOverlappingParam","bp","cp","index","objectBindingNodes","diffDestructuredParam","nameEqual","typeEqual","fromName","toName","diffParamOptionality","diffParamDefault","previousDefault","String","newDefault","baseBindings","compareBindings","baseMap","Map","b","compareMap","has","propertyName","bb","cb","get","diffBindingDefault","parentIsOptional","modifiersToPrint","modifier","exports"],"sources":["function-like.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { SchemaLocation } from '../schema-node';\nimport { SchemaNode } from '../schema-node';\nimport type { SchemaChangeFact } from '../schema-diff';\nimport { typesAreSemanticallyEqual, typeStr, deepEqualNoLocation, diffDoc } from '../schema-diff';\nimport { ParameterSchema } from './parameter';\nimport { DocSchema } from './docs';\nimport { TagName } from './docs/tag';\nimport { SchemaRegistry } from '../schema-registry';\n\nexport type Modifier =\n | 'static'\n | 'public'\n | 'private'\n | 'protected'\n | 'readonly'\n | 'abstract'\n | 'async'\n | 'override'\n | 'export';\n\n/**\n * function-like can be a function, method, arrow-function, variable-function, etc.\n */\nexport class FunctionLikeSchema extends SchemaNode {\n readonly returnType: SchemaNode;\n readonly params: ParameterSchema[];\n readonly doc?: DocSchema;\n readonly signature?: string | undefined;\n readonly displaySchemaName = 'Functions';\n\n constructor(\n readonly location: SchemaLocation,\n readonly name: string,\n params: ParameterSchema[],\n returnType: SchemaNode,\n signature: string,\n readonly modifiers: Modifier[] = [],\n doc?: DocSchema,\n readonly typeParams?: string[],\n readonly decorators?: SchemaNode[]\n ) {\n super();\n this.params = params;\n this.returnType = returnType;\n this.doc = doc;\n this.signature = signature || FunctionLikeSchema.createSignature(this.name, this.params, this.returnType);\n }\n\n getNodes() {\n return [...this.params, this.returnType, ...(this.decorators || [])];\n }\n\n toString(options?: { color?: boolean }) {\n const bold = options?.color ? chalk.bold : (text: string) => text;\n const paramsStr = this.params.map((param) => param.toString()).join(', ');\n const typeParamsStr = this.typeParams ? `<${this.typeParams.join(', ')}>` : '';\n const decoratorsStr = this.decorators?.map((decorator) => decorator.toString(options)).join('\\n');\n return `${this.decorators ? `${decoratorsStr}\\n` : ''}${this.modifiersToString()}${typeParamsStr}${bold(\n this.name\n )}(${paramsStr}): ${this.returnType.toString(options)}`;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n let result = '';\n if (options?.showDocs && this.doc) {\n result += `${this.doc.toFullSignature()}\\n`;\n }\n const decoratorsStr = this.decorators?.map((decorator) => decorator.toString()).join('\\n');\n if (decoratorsStr) {\n result += `${decoratorsStr}\\n`;\n }\n const modifiersStr = this.modifiersToString();\n const typeParamsStr = this.typeParams ? `<${this.typeParams.join(', ')}>` : '';\n const paramsStr = this.params\n .map((param) => {\n let paramStr = '';\n if (param.isSpread) {\n paramStr += '...';\n }\n paramStr += param.name;\n if (param.isOptional) {\n paramStr += '?';\n }\n paramStr += `: ${param.type.toString()}`;\n if (param.defaultValue !== undefined) {\n paramStr += ` = ${param.defaultValue}`;\n }\n return paramStr;\n })\n .join(', ');\n result += `${modifiersStr}${this.name}${typeParamsStr}(${paramsStr}): ${this.returnType.toString()}`;\n return result;\n }\n\n isDeprecated(): boolean {\n return Boolean(this.doc?.hasTag(TagName.deprecated));\n }\n\n isPrivate(): boolean {\n return Boolean(this.modifiers.find((m) => m === 'private') || this.doc?.hasTag(TagName.private));\n }\n\n generateSignature(): string {\n return FunctionLikeSchema.createSignature(this.name, this.params, this.returnType, this.decorators);\n }\n\n static createSignature(\n name: string,\n params: ParameterSchema[],\n returnType: SchemaNode,\n decorators?: SchemaNode[]\n ): string {\n const paramsStr = params\n .map((param) => {\n let type = param.type.toString();\n if (param.isSpread) type = `...${type}`;\n return `${param.name}${param.isOptional ? '?' : ''}: ${type}`;\n })\n .join(', ');\n const decoratorsStr = decorators?.map((decorator) => decorator.toString()).join('\\n');\n return `${decorators ? `${decoratorsStr}\\n` : ''}${name}(${paramsStr}): ${returnType.toString()}`;\n }\n\n toObject() {\n return {\n ...super.toObject(),\n name: this.name,\n params: this.params.map((param) => param.toObject()),\n returnType: this.returnType.toObject(),\n signature: this.signature,\n modifiers: this.modifiers,\n doc: this.doc?.toObject(),\n typeParams: this.typeParams,\n decorators: this.decorators?.map((decorator) => decorator.toObject()),\n };\n }\n\n static fromObject(obj: Record<string, any>) {\n return new FunctionLikeSchema(\n obj.location,\n obj.name,\n obj.params.map((param: Record<string, any>) => ParameterSchema.fromObject(param)),\n SchemaRegistry.fromObject(obj.returnType),\n obj.signature,\n obj.modifiers,\n obj.doc ? DocSchema.fromObject(obj.doc) : undefined,\n obj.typeParams,\n obj.decorators?.map((decorator) => SchemaRegistry.fromObject(decorator))\n );\n }\n\n diff(other: SchemaNode): SchemaChangeFact[] {\n if (!(other instanceof FunctionLikeSchema)) return super.diff(other);\n const facts: SchemaChangeFact[] = [];\n const baseObj = this.toObject();\n const compareObj = other.toObject();\n\n FunctionLikeSchema.diffParams(baseObj.params || [], compareObj.params || [], facts);\n\n if (!typesAreSemanticallyEqual(baseObj.returnType, compareObj.returnType)) {\n const fromType = typeStr(baseObj.returnType);\n const toType = typeStr(compareObj.returnType);\n facts.push({\n changeKind: 'return-type-changed',\n description: `return type changed: ${fromType} → ${toType}`,\n context: { fromType, toType, position: 'return-type' },\n from: fromType,\n to: toType,\n });\n }\n\n if (!deepEqualNoLocation(baseObj.typeParams, compareObj.typeParams)) {\n facts.push({\n changeKind: 'type-parameters-changed',\n description: `type parameters changed: <${(baseObj.typeParams || []).join(', ') || 'none'}> → <${(compareObj.typeParams || []).join(', ') || 'none'}>`,\n context: { from: (baseObj.typeParams || []).join(', '), to: (compareObj.typeParams || []).join(', ') },\n from: (baseObj.typeParams || []).join(', '),\n to: (compareObj.typeParams || []).join(', '),\n });\n }\n\n FunctionLikeSchema.diffModifiers(this.modifiers || [], other.modifiers || [], facts);\n facts.push(...diffDoc(baseObj.doc, compareObj.doc));\n return facts;\n }\n\n private static diffModifiers(baseMods: string[], compareMods: string[], facts: SchemaChangeFact[]): void {\n const base = baseMods.filter((m) => m !== 'export');\n const compare = compareMods.filter((m) => m !== 'export');\n if (deepEqualNoLocation(base, compare)) return;\n\n const added = compare.filter((m) => !base.includes(m));\n const removed = base.filter((m) => !compare.includes(m));\n const parts: string[] = [];\n if (added.length) parts.push(`added: ${added.join(', ')}`);\n if (removed.length) parts.push(`removed: ${removed.join(', ')}`);\n const accessNarrowed = removed.includes('public') || added.includes('private') || added.includes('protected');\n\n facts.push({\n changeKind: accessNarrowed ? 'access-narrowed' : 'modifiers-changed',\n description: `modifiers changed (${parts.join('; ')})`,\n context: { added, removed, accessNarrowed },\n from: base.join(', ') || 'none',\n to: compare.join(', ') || 'none',\n });\n }\n\n private static diffParams(\n baseParams: Record<string, any>[],\n compareParams: Record<string, any>[],\n facts: SchemaChangeFact[]\n ): void {\n for (const p of compareParams.slice(baseParams.length)) {\n const isOpt = p.isOptional || p.defaultValue !== undefined;\n facts.push({\n changeKind: 'parameter-added',\n description: `parameter '${p.name}: ${typeStr(p.type)}' added${isOpt ? ' (optional)' : ' (required)'}`,\n context: {\n paramName: p.name,\n isOptional: !!p.isOptional,\n hasDefault: p.defaultValue !== undefined,\n paramType: typeStr(p.type),\n },\n to: `${p.name}${p.isOptional ? '?' : ''}: ${typeStr(p.type)}`,\n });\n }\n\n for (const p of baseParams.slice(compareParams.length)) {\n facts.push({\n changeKind: 'parameter-removed',\n description: `parameter '${p.name}: ${typeStr(p.type)}' removed`,\n context: { paramName: p.name, isOptional: !!p.isOptional, paramType: typeStr(p.type) },\n from: `${p.name}${p.isOptional ? '?' : ''}: ${typeStr(p.type)}`,\n });\n }\n\n const minLen = Math.min(baseParams.length, compareParams.length);\n for (let i = 0; i < minLen; i++) {\n FunctionLikeSchema.diffOverlappingParam(baseParams[i], compareParams[i], i, facts);\n }\n }\n\n private static diffOverlappingParam(\n bp: Record<string, any>,\n cp: Record<string, any>,\n index: number,\n facts: SchemaChangeFact[]\n ): void {\n if (bp.objectBindingNodes || cp.objectBindingNodes) {\n FunctionLikeSchema.diffDestructuredParam(bp, cp, facts);\n if (!typesAreSemanticallyEqual(bp.type, cp.type)) {\n const paramName = cp.name || bp.name;\n facts.push({\n changeKind: 'parameter-type-changed',\n description: `parameter at position ${index} type changed: ${typeStr(bp.type)} → ${typeStr(cp.type)}`,\n context: { paramName, fromType: typeStr(bp.type), toType: typeStr(cp.type), position: 'parameter' },\n from: typeStr(bp.type),\n to: typeStr(cp.type),\n });\n }\n return;\n }\n\n const nameEqual = bp.name === cp.name;\n const typeEqual = typesAreSemanticallyEqual(bp.type, cp.type);\n if (nameEqual && typeEqual && bp.isOptional === cp.isOptional && bp.defaultValue === cp.defaultValue) return;\n\n const paramName = cp.name || bp.name;\n if (!nameEqual) {\n facts.push({\n changeKind: 'parameter-renamed',\n description: `parameter at position ${index} renamed: '${bp.name}' → '${cp.name}'`,\n context: { fromName: bp.name, toName: cp.name, position: index },\n from: bp.name,\n to: cp.name,\n });\n }\n if (!typeEqual) {\n facts.push({\n changeKind: 'parameter-type-changed',\n description: `parameter '${paramName}' type changed: ${typeStr(bp.type)} → ${typeStr(cp.type)}`,\n context: { paramName, fromType: typeStr(bp.type), toType: typeStr(cp.type), position: 'parameter' },\n from: typeStr(bp.type),\n to: typeStr(cp.type),\n });\n }\n FunctionLikeSchema.diffParamOptionality(bp, cp, paramName, facts);\n FunctionLikeSchema.diffParamDefault(bp, cp, paramName, facts);\n }\n\n private static diffParamOptionality(\n bp: Record<string, any>,\n cp: Record<string, any>,\n paramName: string,\n facts: SchemaChangeFact[]\n ): void {\n if (bp.isOptional && !cp.isOptional) {\n facts.push({\n changeKind: 'became-required',\n description: `parameter '${paramName}' became required (was optional)`,\n context: { paramName, position: 'parameter' },\n from: 'optional',\n to: 'required',\n });\n } else if (!bp.isOptional && cp.isOptional) {\n facts.push({\n changeKind: 'became-optional',\n description: `parameter '${paramName}' became optional (was required)`,\n context: { paramName, position: 'parameter' },\n from: 'required',\n to: 'optional',\n });\n }\n }\n\n private static diffParamDefault(\n bp: Record<string, any>,\n cp: Record<string, any>,\n paramName: string,\n facts: SchemaChangeFact[]\n ): void {\n if (bp.defaultValue === cp.defaultValue) return;\n if (bp.defaultValue !== undefined && cp.defaultValue === undefined) {\n facts.push({\n changeKind: 'parameter-default-removed',\n description: `parameter '${paramName}' default value removed (was: ${bp.defaultValue})`,\n context: { paramName, isOptional: !!bp.isOptional, previousDefault: String(bp.defaultValue) },\n from: String(bp.defaultValue),\n });\n } else if (bp.defaultValue === undefined && cp.defaultValue !== undefined) {\n facts.push({\n changeKind: 'parameter-default-added',\n description: `parameter '${paramName}' default value added: ${cp.defaultValue}`,\n context: { paramName, newDefault: String(cp.defaultValue) },\n to: String(cp.defaultValue),\n });\n } else {\n facts.push({\n changeKind: 'parameter-default-changed',\n description: `parameter '${paramName}' default value changed: ${bp.defaultValue} → ${cp.defaultValue}`,\n context: { paramName, previousDefault: String(bp.defaultValue), newDefault: String(cp.defaultValue) },\n from: String(bp.defaultValue),\n to: String(cp.defaultValue),\n });\n }\n }\n\n private static diffDestructuredParam(\n base: Record<string, any>,\n compare: Record<string, any>,\n facts: SchemaChangeFact[]\n ): void {\n const baseBindings: Record<string, any>[] = base.objectBindingNodes || [];\n const compareBindings: Record<string, any>[] = compare.objectBindingNodes || [];\n const baseMap = new Map(baseBindings.map((b) => [b.name || '', b]));\n const compareMap = new Map(compareBindings.map((b) => [b.name || '', b]));\n\n for (const [name] of compareMap) {\n if (!baseMap.has(name)) {\n facts.push({\n changeKind: 'destructured-property-added',\n description: `destructured property '${name}' added`,\n context: { propertyName: name },\n to: name,\n });\n }\n }\n for (const [name] of baseMap) {\n if (!compareMap.has(name)) {\n facts.push({\n changeKind: 'destructured-property-removed',\n description: `destructured property '${name}' removed`,\n context: { propertyName: name },\n from: name,\n });\n }\n }\n for (const [name, bb] of baseMap) {\n const cb = compareMap.get(name);\n if (!cb) continue;\n FunctionLikeSchema.diffBindingDefault(name, bb, cb, !!base.isOptional, facts);\n if (bb.type && cb.type && !typesAreSemanticallyEqual(bb.type, cb.type)) {\n facts.push({\n changeKind: 'destructured-property-type-changed',\n description: `destructured property '${name}' type changed: ${typeStr(bb.type)} → ${typeStr(cb.type)}`,\n context: { propertyName: name, fromType: typeStr(bb.type), toType: typeStr(cb.type), position: 'parameter' },\n from: typeStr(bb.type),\n to: typeStr(cb.type),\n });\n }\n }\n }\n\n private static diffBindingDefault(\n name: string,\n bb: Record<string, any>,\n cb: Record<string, any>,\n parentIsOptional: boolean,\n facts: SchemaChangeFact[]\n ): void {\n if (bb.defaultValue === cb.defaultValue) return;\n if (bb.defaultValue !== undefined && cb.defaultValue === undefined) {\n facts.push({\n changeKind: 'destructured-property-default-removed',\n description: `destructured property '${name}' default value removed (was: ${bb.defaultValue})`,\n context: { propertyName: name, isOptional: parentIsOptional, previousDefault: String(bb.defaultValue) },\n from: String(bb.defaultValue),\n });\n } else if (bb.defaultValue === undefined && cb.defaultValue !== undefined) {\n facts.push({\n changeKind: 'destructured-property-default-added',\n description: `destructured property '${name}' default value added: ${cb.defaultValue}`,\n context: { propertyName: name, newDefault: String(cb.defaultValue) },\n to: String(cb.defaultValue),\n });\n } else {\n facts.push({\n changeKind: 'destructured-property-default-changed',\n description: `destructured property '${name}' default value changed: ${bb.defaultValue} → ${cb.defaultValue}`,\n context: { propertyName: name, previousDefault: String(bb.defaultValue), newDefault: String(cb.defaultValue) },\n from: String(bb.defaultValue),\n to: String(cb.defaultValue),\n });\n }\n }\n\n private modifiersToString() {\n const modifiersToPrint = this.modifiers.filter((modifier) => modifier !== 'export');\n return modifiersToPrint.length ? `${modifiersToPrint.join(' ')} ` : '';\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,G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AACU,EAAE,CAACpF,YAAY,CAAC;QAC7BkC,EAAE,EAAEwC,MAAM,CAACW,EAAE,CAACrF,YAAY;MAC5B,CAAC,CAAC;IACJ;EACF;EAEQT,iBAAiBA,CAAA,EAAG;IAC1B,MAAMkG,gBAAgB,GAAG,IAAI,CAACrH,SAAS,CAACqE,MAAM,CAAEiD,QAAQ,IAAKA,QAAQ,KAAK,QAAQ,CAAC;IACnF,OAAOD,gBAAgB,CAAC1C,MAAM,GAAG,GAAG0C,gBAAgB,CAACtG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE;EACxE;AACF;AAACwG,OAAA,CAAAhI,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_schemaNode","_schemaDiff","_parameter","_docs","_tag","_schemaRegistry","e","__esModule","default","FunctionLikeSchema","SchemaNode","displaySchemaName","constructor","location","name","params","returnType","signature","modifiers","doc","typeParams","decorators","createSignature","getNodes","toString","options","bold","color","chalk","text","paramsStr","map","param","join","typeParamsStr","decoratorsStr","decorator","modifiersToString","toFullSignature","result","showDocs","modifiersStr","paramStr","isSpread","isOptional","type","defaultValue","undefined","isDeprecated","Boolean","hasTag","TagName","deprecated","isPrivate","find","m","private","generateSignature","toObject","returnTypeDisplay","obj","nodeStr","typeStr","idx","lastIndexOf","fromSignature","slice","trim","fromObject","ParameterSchema","SchemaRegistry","DocSchema","diff","other","facts","baseObj","compareObj","diffParams","typesAreSemanticallyEqual","fromType","toType","push","changeKind","description","context","position","from","to","deepEqualNoLocation","diffModifiers","diffDoc","baseMods","compareMods","base","filter","compare","added","includes","removed","parts","length","accessNarrowed","baseParams","compareParams","p","isOpt","paramName","hasDefault","paramType","minLen","Math","min","i","diffOverlappingParam","bp","cp","index","objectBindingNodes","diffDestructuredParam","nameEqual","typeEqual","fromName","toName","diffParamOptionality","diffParamDefault","previousDefault","String","newDefault","baseBindings","compareBindings","baseMap","Map","b","compareMap","has","propertyName","bb","cb","get","diffBindingDefault","parentIsOptional","modifiersToPrint","modifier","exports"],"sources":["function-like.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { SchemaLocation } from '../schema-node';\nimport { SchemaNode } from '../schema-node';\nimport type { SchemaChangeFact } from '../schema-diff';\nimport { typesAreSemanticallyEqual, typeStr, deepEqualNoLocation, diffDoc } from '../schema-diff';\nimport { ParameterSchema } from './parameter';\nimport { DocSchema } from './docs';\nimport { TagName } from './docs/tag';\nimport { SchemaRegistry } from '../schema-registry';\n\nexport type Modifier =\n | 'static'\n | 'public'\n | 'private'\n | 'protected'\n | 'readonly'\n | 'abstract'\n | 'async'\n | 'override'\n | 'export';\n\n/**\n * function-like can be a function, method, arrow-function, variable-function, etc.\n */\nexport class FunctionLikeSchema extends SchemaNode {\n readonly returnType: SchemaNode;\n readonly params: ParameterSchema[];\n readonly doc?: DocSchema;\n readonly signature?: string | undefined;\n readonly displaySchemaName = 'Functions';\n\n constructor(\n readonly location: SchemaLocation,\n readonly name: string,\n params: ParameterSchema[],\n returnType: SchemaNode,\n signature: string,\n readonly modifiers: Modifier[] = [],\n doc?: DocSchema,\n readonly typeParams?: string[],\n readonly decorators?: SchemaNode[]\n ) {\n super();\n this.params = params;\n this.returnType = returnType;\n this.doc = doc;\n this.signature = signature || FunctionLikeSchema.createSignature(this.name, this.params, this.returnType);\n }\n\n getNodes() {\n return [...this.params, this.returnType, ...(this.decorators || [])];\n }\n\n toString(options?: { color?: boolean }) {\n const bold = options?.color ? chalk.bold : (text: string) => text;\n const paramsStr = this.params.map((param) => param.toString()).join(', ');\n const typeParamsStr = this.typeParams ? `<${this.typeParams.join(', ')}>` : '';\n const decoratorsStr = this.decorators?.map((decorator) => decorator.toString(options)).join('\\n');\n return `${this.decorators ? `${decoratorsStr}\\n` : ''}${this.modifiersToString()}${typeParamsStr}${bold(\n this.name\n )}(${paramsStr}): ${this.returnType.toString(options)}`;\n }\n\n toFullSignature(options?: { showDocs?: boolean }): string {\n let result = '';\n if (options?.showDocs && this.doc) {\n result += `${this.doc.toFullSignature()}\\n`;\n }\n const decoratorsStr = this.decorators?.map((decorator) => decorator.toString()).join('\\n');\n if (decoratorsStr) {\n result += `${decoratorsStr}\\n`;\n }\n const modifiersStr = this.modifiersToString();\n const typeParamsStr = this.typeParams ? `<${this.typeParams.join(', ')}>` : '';\n const paramsStr = this.params\n .map((param) => {\n let paramStr = '';\n if (param.isSpread) {\n paramStr += '...';\n }\n paramStr += param.name;\n if (param.isOptional) {\n paramStr += '?';\n }\n paramStr += `: ${param.type.toString()}`;\n if (param.defaultValue !== undefined) {\n paramStr += ` = ${param.defaultValue}`;\n }\n return paramStr;\n })\n .join(', ');\n result += `${modifiersStr}${this.name}${typeParamsStr}(${paramsStr}): ${this.returnType.toString()}`;\n return result;\n }\n\n isDeprecated(): boolean {\n return Boolean(this.doc?.hasTag(TagName.deprecated));\n }\n\n isPrivate(): boolean {\n return Boolean(this.modifiers.find((m) => m === 'private') || this.doc?.hasTag(TagName.private));\n }\n\n generateSignature(): string {\n return FunctionLikeSchema.createSignature(this.name, this.params, this.returnType, this.decorators);\n }\n\n static createSignature(\n name: string,\n params: ParameterSchema[],\n returnType: SchemaNode,\n decorators?: SchemaNode[]\n ): string {\n const paramsStr = params\n .map((param) => {\n let type = param.type.toString();\n if (param.isSpread) type = `...${type}`;\n return `${param.name}${param.isOptional ? '?' : ''}: ${type}`;\n })\n .join(', ');\n const decoratorsStr = decorators?.map((decorator) => decorator.toString()).join('\\n');\n return `${decorators ? `${decoratorsStr}\\n` : ''}${name}(${paramsStr}): ${returnType.toString()}`;\n }\n\n toObject() {\n return {\n ...super.toObject(),\n name: this.name,\n params: this.params.map((param) => param.toObject()),\n returnType: this.returnType.toObject(),\n signature: this.signature,\n modifiers: this.modifiers,\n doc: this.doc?.toObject(),\n typeParams: this.typeParams,\n decorators: this.decorators?.map((decorator) => decorator.toObject()),\n };\n }\n\n /**\n * display string for a function's return type in diffs. Normally the returnType node's rendering —\n * but schemas extracted while type inference was degraded (e.g. unresolved React types) can carry\n * a bogus SELF-referential returnType: a `TypeRefSchema` named after the function itself, while\n * the checker-generated `signature` string holds the real inferred text (`…): any`). Such\n * artifacts are already persisted for built versions and can't be re-extracted, so when the node\n * renders to the function's own name but the signature's return annotation disagrees, the\n * signature wins. (A legitimately self-typed function — e.g. one merged with a same-named\n * interface — agrees with its signature and is unaffected.)\n */\n private static returnTypeDisplay(obj: Record<string, any>): string {\n const nodeStr = typeStr(obj.returnType);\n if (nodeStr !== obj.name) return nodeStr;\n const signature: string | undefined = obj.signature;\n const idx = signature ? signature.lastIndexOf('): ') : -1;\n if (idx === -1 || !signature) return nodeStr;\n const fromSignature = signature.slice(idx + 3).trim();\n return fromSignature && fromSignature !== nodeStr ? fromSignature : nodeStr;\n }\n\n static fromObject(obj: Record<string, any>) {\n return new FunctionLikeSchema(\n obj.location,\n obj.name,\n obj.params.map((param: Record<string, any>) => ParameterSchema.fromObject(param)),\n SchemaRegistry.fromObject(obj.returnType),\n obj.signature,\n obj.modifiers,\n obj.doc ? DocSchema.fromObject(obj.doc) : undefined,\n obj.typeParams,\n obj.decorators?.map((decorator) => SchemaRegistry.fromObject(decorator))\n );\n }\n\n diff(other: SchemaNode): SchemaChangeFact[] {\n if (!(other instanceof FunctionLikeSchema)) return super.diff(other);\n const facts: SchemaChangeFact[] = [];\n const baseObj = this.toObject();\n const compareObj = other.toObject();\n\n FunctionLikeSchema.diffParams(baseObj.params || [], compareObj.params || [], facts);\n\n if (!typesAreSemanticallyEqual(baseObj.returnType, compareObj.returnType)) {\n const fromType = FunctionLikeSchema.returnTypeDisplay(baseObj);\n const toType = FunctionLikeSchema.returnTypeDisplay(compareObj);\n facts.push({\n changeKind: 'return-type-changed',\n description: `return type changed: ${fromType} → ${toType}`,\n context: { fromType, toType, position: 'return-type' },\n from: fromType,\n to: toType,\n });\n }\n\n if (!deepEqualNoLocation(baseObj.typeParams, compareObj.typeParams)) {\n facts.push({\n changeKind: 'type-parameters-changed',\n description: `type parameters changed: <${(baseObj.typeParams || []).join(', ') || 'none'}> → <${(compareObj.typeParams || []).join(', ') || 'none'}>`,\n context: { from: (baseObj.typeParams || []).join(', '), to: (compareObj.typeParams || []).join(', ') },\n from: (baseObj.typeParams || []).join(', '),\n to: (compareObj.typeParams || []).join(', '),\n });\n }\n\n FunctionLikeSchema.diffModifiers(this.modifiers || [], other.modifiers || [], facts);\n facts.push(...diffDoc(baseObj.doc, compareObj.doc));\n return facts;\n }\n\n private static diffModifiers(baseMods: string[], compareMods: string[], facts: SchemaChangeFact[]): void {\n const base = baseMods.filter((m) => m !== 'export');\n const compare = compareMods.filter((m) => m !== 'export');\n if (deepEqualNoLocation(base, compare)) return;\n\n const added = compare.filter((m) => !base.includes(m));\n const removed = base.filter((m) => !compare.includes(m));\n const parts: string[] = [];\n if (added.length) parts.push(`added: ${added.join(', ')}`);\n if (removed.length) parts.push(`removed: ${removed.join(', ')}`);\n const accessNarrowed = removed.includes('public') || added.includes('private') || added.includes('protected');\n\n facts.push({\n changeKind: accessNarrowed ? 'access-narrowed' : 'modifiers-changed',\n description: `modifiers changed (${parts.join('; ')})`,\n context: { added, removed, accessNarrowed },\n from: base.join(', ') || 'none',\n to: compare.join(', ') || 'none',\n });\n }\n\n private static diffParams(\n baseParams: Record<string, any>[],\n compareParams: Record<string, any>[],\n facts: SchemaChangeFact[]\n ): void {\n for (const p of compareParams.slice(baseParams.length)) {\n const isOpt = p.isOptional || p.defaultValue !== undefined;\n facts.push({\n changeKind: 'parameter-added',\n description: `parameter '${p.name}: ${typeStr(p.type)}' added${isOpt ? ' (optional)' : ' (required)'}`,\n context: {\n paramName: p.name,\n isOptional: !!p.isOptional,\n hasDefault: p.defaultValue !== undefined,\n paramType: typeStr(p.type),\n },\n to: `${p.name}${p.isOptional ? '?' : ''}: ${typeStr(p.type)}`,\n });\n }\n\n for (const p of baseParams.slice(compareParams.length)) {\n facts.push({\n changeKind: 'parameter-removed',\n description: `parameter '${p.name}: ${typeStr(p.type)}' removed`,\n context: { paramName: p.name, isOptional: !!p.isOptional, paramType: typeStr(p.type) },\n from: `${p.name}${p.isOptional ? '?' : ''}: ${typeStr(p.type)}`,\n });\n }\n\n const minLen = Math.min(baseParams.length, compareParams.length);\n for (let i = 0; i < minLen; i++) {\n FunctionLikeSchema.diffOverlappingParam(baseParams[i], compareParams[i], i, facts);\n }\n }\n\n private static diffOverlappingParam(\n bp: Record<string, any>,\n cp: Record<string, any>,\n index: number,\n facts: SchemaChangeFact[]\n ): void {\n if (bp.objectBindingNodes || cp.objectBindingNodes) {\n FunctionLikeSchema.diffDestructuredParam(bp, cp, facts);\n if (!typesAreSemanticallyEqual(bp.type, cp.type)) {\n const paramName = cp.name || bp.name;\n facts.push({\n changeKind: 'parameter-type-changed',\n description: `parameter at position ${index} type changed: ${typeStr(bp.type)} → ${typeStr(cp.type)}`,\n context: { paramName, fromType: typeStr(bp.type), toType: typeStr(cp.type), position: 'parameter' },\n from: typeStr(bp.type),\n to: typeStr(cp.type),\n });\n }\n return;\n }\n\n const nameEqual = bp.name === cp.name;\n const typeEqual = typesAreSemanticallyEqual(bp.type, cp.type);\n if (nameEqual && typeEqual && bp.isOptional === cp.isOptional && bp.defaultValue === cp.defaultValue) return;\n\n const paramName = cp.name || bp.name;\n if (!nameEqual) {\n facts.push({\n changeKind: 'parameter-renamed',\n description: `parameter at position ${index} renamed: '${bp.name}' → '${cp.name}'`,\n context: { fromName: bp.name, toName: cp.name, position: index },\n from: bp.name,\n to: cp.name,\n });\n }\n if (!typeEqual) {\n facts.push({\n changeKind: 'parameter-type-changed',\n description: `parameter '${paramName}' type changed: ${typeStr(bp.type)} → ${typeStr(cp.type)}`,\n context: { paramName, fromType: typeStr(bp.type), toType: typeStr(cp.type), position: 'parameter' },\n from: typeStr(bp.type),\n to: typeStr(cp.type),\n });\n }\n FunctionLikeSchema.diffParamOptionality(bp, cp, paramName, facts);\n FunctionLikeSchema.diffParamDefault(bp, cp, paramName, facts);\n }\n\n private static diffParamOptionality(\n bp: Record<string, any>,\n cp: Record<string, any>,\n paramName: string,\n facts: SchemaChangeFact[]\n ): void {\n if (bp.isOptional && !cp.isOptional) {\n facts.push({\n changeKind: 'became-required',\n description: `parameter '${paramName}' became required (was optional)`,\n context: { paramName, position: 'parameter' },\n from: 'optional',\n to: 'required',\n });\n } else if (!bp.isOptional && cp.isOptional) {\n facts.push({\n changeKind: 'became-optional',\n description: `parameter '${paramName}' became optional (was required)`,\n context: { paramName, position: 'parameter' },\n from: 'required',\n to: 'optional',\n });\n }\n }\n\n private static diffParamDefault(\n bp: Record<string, any>,\n cp: Record<string, any>,\n paramName: string,\n facts: SchemaChangeFact[]\n ): void {\n if (bp.defaultValue === cp.defaultValue) return;\n if (bp.defaultValue !== undefined && cp.defaultValue === undefined) {\n facts.push({\n changeKind: 'parameter-default-removed',\n description: `parameter '${paramName}' default value removed (was: ${bp.defaultValue})`,\n context: { paramName, isOptional: !!bp.isOptional, previousDefault: String(bp.defaultValue) },\n from: String(bp.defaultValue),\n });\n } else if (bp.defaultValue === undefined && cp.defaultValue !== undefined) {\n facts.push({\n changeKind: 'parameter-default-added',\n description: `parameter '${paramName}' default value added: ${cp.defaultValue}`,\n context: { paramName, newDefault: String(cp.defaultValue) },\n to: String(cp.defaultValue),\n });\n } else {\n facts.push({\n changeKind: 'parameter-default-changed',\n description: `parameter '${paramName}' default value changed: ${bp.defaultValue} → ${cp.defaultValue}`,\n context: { paramName, previousDefault: String(bp.defaultValue), newDefault: String(cp.defaultValue) },\n from: String(bp.defaultValue),\n to: String(cp.defaultValue),\n });\n }\n }\n\n private static diffDestructuredParam(\n base: Record<string, any>,\n compare: Record<string, any>,\n facts: SchemaChangeFact[]\n ): void {\n const baseBindings: Record<string, any>[] = base.objectBindingNodes || [];\n const compareBindings: Record<string, any>[] = compare.objectBindingNodes || [];\n const baseMap = new Map(baseBindings.map((b) => [b.name || '', b]));\n const compareMap = new Map(compareBindings.map((b) => [b.name || '', b]));\n\n for (const [name] of compareMap) {\n if (!baseMap.has(name)) {\n facts.push({\n changeKind: 'destructured-property-added',\n description: `destructured property '${name}' added`,\n context: { propertyName: name },\n to: name,\n });\n }\n }\n for (const [name] of baseMap) {\n if (!compareMap.has(name)) {\n facts.push({\n changeKind: 'destructured-property-removed',\n description: `destructured property '${name}' removed`,\n context: { propertyName: name },\n from: name,\n });\n }\n }\n for (const [name, bb] of baseMap) {\n const cb = compareMap.get(name);\n if (!cb) continue;\n FunctionLikeSchema.diffBindingDefault(name, bb, cb, !!base.isOptional, facts);\n if (bb.type && cb.type && !typesAreSemanticallyEqual(bb.type, cb.type)) {\n facts.push({\n changeKind: 'destructured-property-type-changed',\n description: `destructured property '${name}' type changed: ${typeStr(bb.type)} → ${typeStr(cb.type)}`,\n context: { propertyName: name, fromType: typeStr(bb.type), toType: typeStr(cb.type), position: 'parameter' },\n from: typeStr(bb.type),\n to: typeStr(cb.type),\n });\n }\n }\n }\n\n private static diffBindingDefault(\n name: string,\n bb: Record<string, any>,\n cb: Record<string, any>,\n parentIsOptional: boolean,\n facts: SchemaChangeFact[]\n ): void {\n if (bb.defaultValue === cb.defaultValue) return;\n if (bb.defaultValue !== undefined && cb.defaultValue === undefined) {\n facts.push({\n changeKind: 'destructured-property-default-removed',\n description: `destructured property '${name}' default value removed (was: ${bb.defaultValue})`,\n context: { propertyName: name, isOptional: parentIsOptional, previousDefault: String(bb.defaultValue) },\n from: String(bb.defaultValue),\n });\n } else if (bb.defaultValue === undefined && cb.defaultValue !== undefined) {\n facts.push({\n changeKind: 'destructured-property-default-added',\n description: `destructured property '${name}' default value added: ${cb.defaultValue}`,\n context: { propertyName: name, newDefault: String(cb.defaultValue) },\n to: String(cb.defaultValue),\n });\n } else {\n facts.push({\n changeKind: 'destructured-property-default-changed',\n description: `destructured property '${name}' default value changed: ${bb.defaultValue} → ${cb.defaultValue}`,\n context: { propertyName: name, previousDefault: String(bb.defaultValue), newDefault: String(cb.defaultValue) },\n from: String(bb.defaultValue),\n to: String(cb.defaultValue),\n });\n }\n }\n\n private modifiersToString() {\n const modifiersToPrint = this.modifiers.filter((modifier) => modifier !== 'export');\n return modifiersToPrint.length ? `${modifiersToPrint.join(' ')} ` : '';\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,KAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,IAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,gBAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,eAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoD,SAAAC,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAapD;AACA;AACA;AACO,MAAMG,kBAAkB,SAASC,wBAAU,CAAC;EAKxCC,iB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,EAAE,CAAC1F,YAAY,CAAC;QAC7ByC,EAAE,EAAEuC,MAAM,CAACW,EAAE,CAAC3F,YAAY;MAC5B,CAAC,CAAC;IACJ;EACF;EAEQT,iBAAiBA,CAAA,EAAG;IAC1B,MAAMwG,gBAAgB,GAAG,IAAI,CAAC3H,SAAS,CAAC4E,MAAM,CAAEgD,QAAQ,IAAKA,QAAQ,KAAK,QAAQ,CAAC;IACnF,OAAOD,gBAAgB,CAACzC,MAAM,GAAG,GAAGyC,gBAAgB,CAAC5G,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE;EACxE;AACF;AAAC8G,OAAA,CAAAtI,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/semantics.entities.semantic-schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.112",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/semantics/entities/semantic-schema",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.semantics",
|
|
8
8
|
"name": "entities/semantic-schema",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.112"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
package/schema-diff-members.ts
CHANGED
|
@@ -22,7 +22,9 @@ function classifyMemberChange(base: Record<string, any>, compare: Record<string,
|
|
|
22
22
|
const baseStripped = { ...base, location: undefined, doc: undefined };
|
|
23
23
|
const compareStripped = { ...compare, location: undefined, doc: undefined };
|
|
24
24
|
if (deepEqualNoLocation(baseStripped, compareStripped)) return 'member-documentation-changed';
|
|
25
|
-
|
|
25
|
+
// require both signatures present: a null on one side is missing extraction data, not a real
|
|
26
|
+
// signature change — fall through to the internal (patch) classification rather than flag breaking.
|
|
27
|
+
if (base.signature && compare.signature && base.signature !== compare.signature) return 'member-signature-changed';
|
|
26
28
|
return 'member-definition-changed';
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -81,8 +83,11 @@ function diffModifiedMembers(
|
|
|
81
83
|
const bNode = ((baseNode as any).members as SchemaNode[])?.find((n: any) => n.name === name);
|
|
82
84
|
const cNode = ((compareNode as any).members as SchemaNode[])?.find((n: any) => n.name === name);
|
|
83
85
|
if (bNode && cNode) {
|
|
86
|
+
// carry the member signature so member-level facts (notably doc-only changes) can show the
|
|
87
|
+
// declaration as context in the UI — the doc sits on top of the signature it documents.
|
|
88
|
+
const signature = compareMember.signature || baseMember.signature;
|
|
84
89
|
for (const d of bNode.diff(cNode)) {
|
|
85
|
-
facts.push({ ...d, description: `${kind} '${name}': ${d.description}
|
|
90
|
+
facts.push({ ...d, description: `${kind} '${name}': ${d.description}`, signature });
|
|
86
91
|
}
|
|
87
92
|
continue;
|
|
88
93
|
}
|
|
@@ -103,28 +108,38 @@ function diffModifiedMembers(
|
|
|
103
108
|
function diffStructural(baseObj: Record<string, any>, compareObj: Record<string, any>): SchemaChangeFact[] {
|
|
104
109
|
const facts: SchemaChangeFact[] = [];
|
|
105
110
|
|
|
111
|
+
// NOTE on the `from !== to` guards below: `deepEqualNoLocation` compares the raw nodes, which can
|
|
112
|
+
// carry non-semantic differences between two builds (resolved-type internals, doc, ordering of
|
|
113
|
+
// equivalent representations). Those make the deep compare report a change even when the rendered
|
|
114
|
+
// type the consumer actually sees is identical — e.g. `extends React.Component<P, S>` on both
|
|
115
|
+
// sides getting flagged MAJOR. So a structural change is only real once its human-comparable
|
|
116
|
+
// string representation differs; otherwise it's a false positive and we drop it.
|
|
106
117
|
if (!deepEqualNoLocation(baseObj.typeParams, compareObj.typeParams)) {
|
|
107
118
|
const from = (baseObj.typeParams || []).join(', ');
|
|
108
119
|
const to = (compareObj.typeParams || []).join(', ');
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
if (from !== to) {
|
|
121
|
+
facts.push({
|
|
122
|
+
changeKind: 'type-parameters-changed',
|
|
123
|
+
description: `type parameters changed: <${from || 'none'}> → <${to || 'none'}>`,
|
|
124
|
+
context: { from, to },
|
|
125
|
+
from,
|
|
126
|
+
to,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
116
129
|
}
|
|
117
130
|
|
|
118
131
|
if (!deepEqualNoLocation(baseObj.extendsNodes, compareObj.extendsNodes)) {
|
|
119
132
|
const from = (baseObj.extendsNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';
|
|
120
133
|
const to = (compareObj.extendsNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
if (from !== to) {
|
|
135
|
+
facts.push({
|
|
136
|
+
changeKind: 'extends-changed',
|
|
137
|
+
description: `extends changed: ${from} → ${to}`,
|
|
138
|
+
context: { from, to },
|
|
139
|
+
from,
|
|
140
|
+
to,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
128
143
|
}
|
|
129
144
|
|
|
130
145
|
if (
|
|
@@ -133,13 +148,15 @@ function diffStructural(baseObj: Record<string, any>, compareObj: Record<string,
|
|
|
133
148
|
) {
|
|
134
149
|
const from = (baseObj.implementNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';
|
|
135
150
|
const to = (compareObj.implementNodes || []).map((n: any) => n.name || typeStr(n)).join(', ') || 'none';
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
151
|
+
if (from !== to) {
|
|
152
|
+
facts.push({
|
|
153
|
+
changeKind: 'implements-changed',
|
|
154
|
+
description: `implements changed: ${from} → ${to}`,
|
|
155
|
+
context: { from, to },
|
|
156
|
+
from,
|
|
157
|
+
to,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
143
160
|
}
|
|
144
161
|
|
|
145
162
|
return facts;
|
package/schema-diff.ts
CHANGED
|
@@ -5,6 +5,11 @@ export type SchemaChangeFact = {
|
|
|
5
5
|
context: Record<string, any>;
|
|
6
6
|
from?: string;
|
|
7
7
|
to?: string;
|
|
8
|
+
/**
|
|
9
|
+
* the owning member's signature, carried on member-level facts (e.g. a doc-only change) so the UI
|
|
10
|
+
* can show the declaration as context — "what member is this doc/change on" — next to the diff.
|
|
11
|
+
*/
|
|
12
|
+
signature?: string;
|
|
8
13
|
};
|
|
9
14
|
|
|
10
15
|
const SCHEMA_DISPLAY_NAMES: Record<string, string> = {
|
|
@@ -122,6 +127,23 @@ export function deepEqualNoLocation(a: any, b: any): boolean {
|
|
|
122
127
|
return false;
|
|
123
128
|
}
|
|
124
129
|
|
|
130
|
+
/**
|
|
131
|
+
* the full human-readable doc text: the description plus every JSDoc tag (`@see …`, `@deprecated …`,
|
|
132
|
+
* etc.) on its own line. The diff must show the whole comment — surfacing only `doc.comment` drops
|
|
133
|
+
* the tags, so a "documentation removed" reads as a trimmed fragment of what was actually there.
|
|
134
|
+
*/
|
|
135
|
+
function fullDocText(doc: Record<string, any> | undefined): string | undefined {
|
|
136
|
+
if (!doc) return undefined;
|
|
137
|
+
const parts: string[] = [];
|
|
138
|
+
if (doc.comment) parts.push(doc.comment);
|
|
139
|
+
for (const tag of doc.tags || []) {
|
|
140
|
+
const tagName = tag.tagName || tag.name;
|
|
141
|
+
if (!tagName) continue;
|
|
142
|
+
parts.push(`@${tagName}${tag.comment ? ` ${tag.comment}` : ''}`);
|
|
143
|
+
}
|
|
144
|
+
return parts.join('\n') || doc.raw || undefined;
|
|
145
|
+
}
|
|
146
|
+
|
|
125
147
|
export function diffDoc(
|
|
126
148
|
baseDoc: Record<string, any> | undefined,
|
|
127
149
|
compareDoc: Record<string, any> | undefined
|
|
@@ -134,7 +156,7 @@ export function diffDoc(
|
|
|
134
156
|
changeKind: 'documentation-added',
|
|
135
157
|
description: 'documentation added',
|
|
136
158
|
context: {},
|
|
137
|
-
to: compareDoc
|
|
159
|
+
to: fullDocText(compareDoc) || '(doc added)',
|
|
138
160
|
},
|
|
139
161
|
];
|
|
140
162
|
}
|
|
@@ -144,7 +166,7 @@ export function diffDoc(
|
|
|
144
166
|
changeKind: 'documentation-removed',
|
|
145
167
|
description: 'documentation removed',
|
|
146
168
|
context: {},
|
|
147
|
-
from: baseDoc
|
|
169
|
+
from: fullDocText(baseDoc) || '(doc removed)',
|
|
148
170
|
},
|
|
149
171
|
];
|
|
150
172
|
}
|
|
@@ -161,8 +183,8 @@ export function diffDoc(
|
|
|
161
183
|
changeKind: 'documentation-changed',
|
|
162
184
|
description: `documentation ${changes.join(' and ')} changed`,
|
|
163
185
|
context: {},
|
|
164
|
-
from: baseDoc
|
|
165
|
-
to: compareDoc
|
|
186
|
+
from: fullDocText(baseDoc),
|
|
187
|
+
to: fullDocText(compareDoc),
|
|
166
188
|
},
|
|
167
189
|
];
|
|
168
190
|
}
|
package/schema-node.ts
CHANGED
|
@@ -106,8 +106,11 @@ export abstract class SchemaNode implements ISchemaNode {
|
|
|
106
106
|
const compareNoDoc = { ...compareObj, doc: undefined, location: undefined };
|
|
107
107
|
if (deepEqualNoLocation(baseNoDoc, compareNoDoc)) return facts;
|
|
108
108
|
|
|
109
|
-
// Signature changed
|
|
110
|
-
|
|
109
|
+
// Signature changed — only when BOTH sides actually have a signature. A null/empty signature on
|
|
110
|
+
// one side means the extractor produced no signature there (e.g. an incompletely-built compare
|
|
111
|
+
// snapshot), not that the API changed; comparing a real signature against `undefined` would
|
|
112
|
+
// otherwise report a bogus breaking "signature changed" (a major source of false breaking flags).
|
|
113
|
+
if (baseObj.signature && compareObj.signature && baseObj.signature !== compareObj.signature) {
|
|
111
114
|
facts.push({
|
|
112
115
|
changeKind: 'signature-changed',
|
|
113
116
|
description: 'signature changed',
|
package/schemas/function-like.ts
CHANGED
|
@@ -136,6 +136,26 @@ export class FunctionLikeSchema extends SchemaNode {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* display string for a function's return type in diffs. Normally the returnType node's rendering —
|
|
141
|
+
* but schemas extracted while type inference was degraded (e.g. unresolved React types) can carry
|
|
142
|
+
* a bogus SELF-referential returnType: a `TypeRefSchema` named after the function itself, while
|
|
143
|
+
* the checker-generated `signature` string holds the real inferred text (`…): any`). Such
|
|
144
|
+
* artifacts are already persisted for built versions and can't be re-extracted, so when the node
|
|
145
|
+
* renders to the function's own name but the signature's return annotation disagrees, the
|
|
146
|
+
* signature wins. (A legitimately self-typed function — e.g. one merged with a same-named
|
|
147
|
+
* interface — agrees with its signature and is unaffected.)
|
|
148
|
+
*/
|
|
149
|
+
private static returnTypeDisplay(obj: Record<string, any>): string {
|
|
150
|
+
const nodeStr = typeStr(obj.returnType);
|
|
151
|
+
if (nodeStr !== obj.name) return nodeStr;
|
|
152
|
+
const signature: string | undefined = obj.signature;
|
|
153
|
+
const idx = signature ? signature.lastIndexOf('): ') : -1;
|
|
154
|
+
if (idx === -1 || !signature) return nodeStr;
|
|
155
|
+
const fromSignature = signature.slice(idx + 3).trim();
|
|
156
|
+
return fromSignature && fromSignature !== nodeStr ? fromSignature : nodeStr;
|
|
157
|
+
}
|
|
158
|
+
|
|
139
159
|
static fromObject(obj: Record<string, any>) {
|
|
140
160
|
return new FunctionLikeSchema(
|
|
141
161
|
obj.location,
|
|
@@ -159,8 +179,8 @@ export class FunctionLikeSchema extends SchemaNode {
|
|
|
159
179
|
FunctionLikeSchema.diffParams(baseObj.params || [], compareObj.params || [], facts);
|
|
160
180
|
|
|
161
181
|
if (!typesAreSemanticallyEqual(baseObj.returnType, compareObj.returnType)) {
|
|
162
|
-
const fromType =
|
|
163
|
-
const toType =
|
|
182
|
+
const fromType = FunctionLikeSchema.returnTypeDisplay(baseObj);
|
|
183
|
+
const toType = FunctionLikeSchema.returnTypeDisplay(compareObj);
|
|
164
184
|
facts.push({
|
|
165
185
|
changeKind: 'return-type-changed',
|
|
166
186
|
description: `return type changed: ${fromType} → ${toType}`,
|