ts-axi 0.1.16 → 0.1.17
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/src/symbols.js +28 -13
- package/package.json +1 -1
package/dist/src/symbols.js
CHANGED
|
@@ -390,6 +390,25 @@ export function collectDeclarations(sf, file) {
|
|
|
390
390
|
!(ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node) || ts.isConstructorDeclaration(node)),
|
|
391
391
|
});
|
|
392
392
|
};
|
|
393
|
+
const classMembers = (cls, exported, qualified) => {
|
|
394
|
+
for (const member of cls.members) {
|
|
395
|
+
if (ts.isSemicolonClassElement(member) || ts.isClassStaticBlockDeclaration(member) || ts.isIndexSignatureDeclaration(member))
|
|
396
|
+
continue;
|
|
397
|
+
const memberName = ts.isConstructorDeclaration(member) ? "constructor" : nameText(member.name, sf);
|
|
398
|
+
if (!memberName)
|
|
399
|
+
continue;
|
|
400
|
+
const nameNode = ts.isConstructorDeclaration(member)
|
|
401
|
+
? member.getChildren(sf).find((c) => c.kind === ts.SyntaxKind.ConstructorKeyword)
|
|
402
|
+
: member.name;
|
|
403
|
+
add(member, nameNode, memberName, exported && !isPrivateMember(member), qualified);
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
/** `module.exports = class X {...}`, `exports.X = class {...}`, `export default class {...}` expression. */
|
|
407
|
+
const exportedClass = (cls, fallback) => {
|
|
408
|
+
const name = cls.name?.text ?? fallback;
|
|
409
|
+
add(cls, cls.name, name, true);
|
|
410
|
+
classMembers(cls, true, name);
|
|
411
|
+
};
|
|
393
412
|
const nested = (raw) => {
|
|
394
413
|
raws.push({ ...raw, qualifiedName: raw.qualifiedName ?? (raw.parentName ? `${raw.parentName}.${raw.name}` : raw.name), hasBody: true });
|
|
395
414
|
};
|
|
@@ -737,7 +756,9 @@ export function collectDeclarations(sf, file) {
|
|
|
737
756
|
return;
|
|
738
757
|
const target = compact(left, sf);
|
|
739
758
|
if (target === "module.exports") {
|
|
740
|
-
if (ts.
|
|
759
|
+
if (ts.isClassExpression(right))
|
|
760
|
+
exportedClass(right, "exports");
|
|
761
|
+
else if (ts.isObjectLiteralExpression(right))
|
|
741
762
|
objectMembers(right, "exports", true);
|
|
742
763
|
else if (asFunction(right))
|
|
743
764
|
returnedMembers(asFunction(right).body, "exports", true);
|
|
@@ -746,6 +767,8 @@ export function collectDeclarations(sf, file) {
|
|
|
746
767
|
return;
|
|
747
768
|
}
|
|
748
769
|
if (target === `exports.${left.name.text}` || target === `module.exports.${left.name.text}`) {
|
|
770
|
+
if (ts.isClassExpression(right))
|
|
771
|
+
return exportedClass(right, left.name.text);
|
|
749
772
|
if (ts.isObjectLiteralExpression(right))
|
|
750
773
|
objectMembers(right, left.name.text, true);
|
|
751
774
|
else
|
|
@@ -829,7 +852,9 @@ export function collectDeclarations(sf, file) {
|
|
|
829
852
|
}
|
|
830
853
|
else if (ts.isExportAssignment(statement)) {
|
|
831
854
|
const value = unwrap(statement.expression);
|
|
832
|
-
if (ts.
|
|
855
|
+
if (ts.isClassExpression(value))
|
|
856
|
+
exportedClass(value, "default");
|
|
857
|
+
else if (ts.isObjectLiteralExpression(value))
|
|
833
858
|
objectMembers(value, "default", true);
|
|
834
859
|
else
|
|
835
860
|
stateArray(statement.expression);
|
|
@@ -876,17 +901,7 @@ export function collectDeclarations(sf, file) {
|
|
|
876
901
|
add(statement, statement.name, name, exported, parent);
|
|
877
902
|
const qualified = parent ? `${parent}.${name}` : name;
|
|
878
903
|
if (ts.isClassDeclaration(statement)) {
|
|
879
|
-
|
|
880
|
-
if (ts.isSemicolonClassElement(member) || ts.isClassStaticBlockDeclaration(member) || ts.isIndexSignatureDeclaration(member))
|
|
881
|
-
continue;
|
|
882
|
-
const memberName = ts.isConstructorDeclaration(member) ? "constructor" : nameText(member.name, sf);
|
|
883
|
-
if (!memberName)
|
|
884
|
-
continue;
|
|
885
|
-
const nameNode = ts.isConstructorDeclaration(member)
|
|
886
|
-
? member.getChildren(sf).find((c) => c.kind === ts.SyntaxKind.ConstructorKeyword)
|
|
887
|
-
: member.name;
|
|
888
|
-
add(member, nameNode, memberName, exported && !isPrivateMember(member), qualified);
|
|
889
|
-
}
|
|
904
|
+
classMembers(statement, exported, qualified);
|
|
890
905
|
}
|
|
891
906
|
else if (ts.isInterfaceDeclaration(statement)) {
|
|
892
907
|
for (const member of statement.members) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-axi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "AXI-compliant TypeScript symbol CLI for agents - definitions, references, callers, file outlines and change impact (blast radius) with token-efficient TOON output",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|