@lowgular/code-graph 0.0.1 → 0.1.2

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.
Files changed (155) hide show
  1. package/bin/cli.js +2463 -0
  2. package/lib.js +2430 -0
  3. package/package.json +26 -7
  4. package/apps/code-graph/src/main.js +0 -50
  5. package/libs/cli/code-graph/src/index.js +0 -39
  6. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +0 -72
  7. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +0 -68
  8. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +0 -147
  9. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +0 -55
  10. package/libs/cli/code-graph/src/lib/class-declarations/index.js +0 -27
  11. package/libs/cli/code-graph/src/lib/code.graph.factory.js +0 -63
  12. package/libs/cli/code-graph/src/lib/code.graph.js +0 -62
  13. package/libs/cli/code-graph/src/lib/core/core.js +0 -58
  14. package/libs/cli/code-graph/src/lib/core.js +0 -85
  15. package/libs/cli/code-graph/src/lib/decorators/index.js +0 -36
  16. package/libs/cli/code-graph/src/lib/docs/index.js +0 -21
  17. package/libs/cli/code-graph/src/lib/docs/specs.js +0 -36
  18. package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +0 -28
  19. package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +0 -53
  20. package/libs/cli/code-graph/src/lib/method-declarations/index.js +0 -23
  21. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +0 -106
  22. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +0 -56
  23. package/libs/cli/code-graph/src/lib/parameters/index.js +0 -42
  24. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +0 -139
  25. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +0 -104
  26. package/libs/cli/code-graph/src/lib/property-declarations/index.js +0 -25
  27. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +0 -74
  28. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +0 -43
  29. package/libs/cli/code-graph/src/lib/tools/index.js +0 -34
  30. package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +0 -64
  31. package/libs/cli/code-graph/src/lib/types/index.js +0 -99
  32. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +0 -345
  33. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +0 -52
  34. package/libs/cli/code-graph/src/lib/v2/extractors/index.js +0 -23
  35. package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +0 -76
  36. package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +0 -21
  37. package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +0 -48
  38. package/libs/cli/code-graph/src/lib/v2/graph-builder/relationship.processor.js +0 -79
  39. package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +0 -45
  40. package/libs/cli/code-graph/src/lib/v2/index.js +0 -37
  41. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +0 -220
  42. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +0 -42
  43. package/libs/cli/cypher/src/index.js +0 -25
  44. package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +0 -277
  45. package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +0 -69
  46. package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +0 -105
  47. package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +0 -70
  48. package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +0 -99
  49. package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +0 -125
  50. package/libs/cli/cypher/src/lib/docs/features/index.js +0 -51
  51. package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +0 -50
  52. package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +0 -106
  53. package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +0 -105
  54. package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +0 -143
  55. package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +0 -152
  56. package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +0 -48
  57. package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +0 -65
  58. package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +0 -82
  59. package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +0 -136
  60. package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +0 -187
  61. package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +0 -302
  62. package/libs/cli/cypher/src/lib/docs/prompts.js +0 -36
  63. package/libs/cli/cypher/src/lib/docs/specs.js +0 -181
  64. package/libs/cli/cypher/src/lib/executor/condition-evaluator.js +0 -158
  65. package/libs/cli/cypher/src/lib/executor/executor.js +0 -83
  66. package/libs/cli/cypher/src/lib/executor/graph.js +0 -15
  67. package/libs/cli/cypher/src/lib/executor/match-engine.js +0 -153
  68. package/libs/cli/cypher/src/lib/executor/pattern-matcher.js +0 -109
  69. package/libs/cli/cypher/src/lib/executor/relationship-navigator.js +0 -64
  70. package/libs/cli/cypher/src/lib/executor/result-formatter.js +0 -143
  71. package/libs/cli/cypher/src/lib/executor/traverse-engine.js +0 -164
  72. package/libs/cli/cypher/src/lib/executor/utils.js +0 -37
  73. package/libs/cli/cypher/src/lib/graph.stub.js +0 -63
  74. package/libs/cli/cypher/src/lib/index.js +0 -74
  75. package/libs/cli/cypher/src/lib/lexer.js +0 -398
  76. package/libs/cli/cypher/src/lib/parser.js +0 -602
  77. package/libs/cli/cypher/src/lib/validator/query-validator.js +0 -95
  78. package/libs/cli/cypher/src/lib/validator/supported-features.config.js +0 -111
  79. package/libs/cli/cypher/src/lib/validator/unsupported-features.config.js +0 -150
  80. package/libs/cli/shared/src/index.js +0 -53
  81. package/libs/cli/shared/src/lib/admin-token.js +0 -121
  82. package/libs/cli/shared/src/lib/config.js +0 -49
  83. package/libs/cli/shared/src/lib/consts.js +0 -57
  84. package/libs/cli/shared/src/lib/core.js +0 -46
  85. package/libs/cli/shared/src/lib/infrastructure/cli.js +0 -47
  86. package/libs/cli/shared/src/lib/infrastructure/config.js +0 -47
  87. package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +0 -51
  88. package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +0 -96
  89. package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +0 -41
  90. package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +0 -64
  91. package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +0 -120
  92. package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +0 -15
  93. package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +0 -72
  94. package/libs/cli/shared/src/lib/infrastructure/git.js +0 -147
  95. package/libs/cli/shared/src/lib/infrastructure/http.js +0 -257
  96. package/libs/cli/shared/src/lib/infrastructure/markdown.js +0 -95
  97. package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +0 -88
  98. package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +0 -25
  99. package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +0 -154
  100. package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +0 -210
  101. package/libs/cli/shared/src/lib/infrastructure/workspace.js +0 -297
  102. package/libs/cli/shared/src/lib/infrastructure/yaml.js +0 -237
  103. package/libs/cli/shared/src/lib/lowgular.config.js +0 -120
  104. package/libs/cli/shared/src/lib/token.js +0 -135
  105. package/libs/cli/shared/src/lib/utils/solution.util.js +0 -35
  106. package/libs/cli/shared/src/lib/utils/utils.js +0 -89
  107. package/libs/cli/typescript/src/index.js +0 -21
  108. package/libs/cli/typescript/src/lib/base/index.js +0 -23
  109. package/libs/cli/typescript/src/lib/base/nameable.js +0 -34
  110. package/libs/cli/typescript/src/lib/base/nodeable.js +0 -36
  111. package/libs/cli/typescript/src/lib/class.implementation.js +0 -52
  112. package/libs/cli/typescript/src/lib/core/declaration.registry.js +0 -107
  113. package/libs/cli/typescript/src/lib/core/design-pattern.js +0 -55
  114. package/libs/cli/typescript/src/lib/core/index.js +0 -35
  115. package/libs/cli/typescript/src/lib/core/navigable-declaration.js +0 -69
  116. package/libs/cli/typescript/src/lib/core/program-context.js +0 -71
  117. package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +0 -40
  118. package/libs/cli/typescript/src/lib/core/type.js +0 -374
  119. package/libs/cli/typescript/src/lib/declaration.abstraction.js +0 -90
  120. package/libs/cli/typescript/src/lib/decorator.implementation.js +0 -35
  121. package/libs/cli/typescript/src/lib/enum.implementation.js +0 -35
  122. package/libs/cli/typescript/src/lib/function-declaration.implementation.js +0 -35
  123. package/libs/cli/typescript/src/lib/index.js +0 -57
  124. package/libs/cli/typescript/src/lib/interface.implementation.js +0 -51
  125. package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +0 -90
  126. package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +0 -44
  127. package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +0 -46
  128. package/libs/cli/typescript/src/lib/members/method.util.js +0 -32
  129. package/libs/cli/typescript/src/lib/members/parameter.implementation.js +0 -38
  130. package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +0 -64
  131. package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +0 -34
  132. package/libs/cli/typescript/src/lib/members/property.util.js +0 -61
  133. package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +0 -42
  134. package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +0 -114
  135. package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +0 -188
  136. package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +0 -35
  137. package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +0 -51
  138. package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +0 -49
  139. package/libs/cli/typescript/src/lib/members/statements/utils.js +0 -51
  140. package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +0 -258
  141. package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +0 -15
  142. package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +0 -228
  143. package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +0 -126
  144. package/libs/cli/typescript/src/lib/plugins/stubs.js +0 -66
  145. package/libs/cli/typescript/src/lib/type-alias.implementation.js +0 -72
  146. package/libs/cli/typescript/src/lib/utils.js +0 -39
  147. package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +0 -35
  148. package/libs/core/codegular/src/index.js +0 -21
  149. package/libs/core/codegular/src/lib/index.js +0 -29
  150. package/libs/core/codegular/src/lib/node.js +0 -112
  151. package/libs/core/codegular/src/lib/program.js +0 -92
  152. package/libs/core/codegular/src/lib/string.js +0 -168
  153. package/libs/core/codegular/src/lib/type-checker.js +0 -170
  154. package/libs/core/codegular/src/lib/utils.js +0 -347
  155. package/main.js +0 -43
@@ -1,374 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var type_exports = {};
29
- __export(type_exports, {
30
- TypeImplementation: () => TypeImplementation,
31
- TypeInfoAbstraction: () => TypeInfoAbstraction,
32
- getType: () => getType
33
- });
34
- module.exports = __toCommonJS(type_exports);
35
- var import_codegular = require("@core/codegular");
36
- var ts = __toESM(require("typescript"));
37
- var import_declaration = require("../declaration.abstraction");
38
- var import_navigable_declaration = require("./navigable-declaration");
39
- var import_program_context = require("./program-context");
40
- var TypeInfoAbstraction = /* @__PURE__ */ ((TypeInfoAbstraction2) => {
41
- TypeInfoAbstraction2["VOID"] = "VoidType";
42
- TypeInfoAbstraction2["NULLISH"] = "NullishType";
43
- TypeInfoAbstraction2["PRIMITIVE"] = "PrimitiveType";
44
- TypeInfoAbstraction2["OBJECT"] = "ObjectType";
45
- TypeInfoAbstraction2["FUNCTION"] = "FunctionType";
46
- TypeInfoAbstraction2["DECLARATION"] = "DeclarationType";
47
- TypeInfoAbstraction2["UNKNOWN"] = "unknown";
48
- return TypeInfoAbstraction2;
49
- })(TypeInfoAbstraction || {});
50
- const resolveFromType = (type, typeChecker) => {
51
- if (type.flags & ts.TypeFlags.Void) {
52
- return {
53
- abstraction: "VoidType" /* VOID */,
54
- declaration: void 0
55
- };
56
- }
57
- if (type.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) {
58
- return {
59
- abstraction: "NullishType" /* NULLISH */,
60
- declaration: void 0
61
- };
62
- }
63
- if (type.flags & (ts.TypeFlags.String | ts.TypeFlags.Number | ts.TypeFlags.Boolean | ts.TypeFlags.BigInt | ts.TypeFlags.ESSymbol | ts.TypeFlags.UniqueESSymbol | ts.TypeFlags.StringLiteral | ts.TypeFlags.NumberLiteral | ts.TypeFlags.BooleanLiteral | ts.TypeFlags.BigIntLiteral)) {
64
- return {
65
- abstraction: "PrimitiveType" /* PRIMITIVE */,
66
- declaration: void 0
67
- };
68
- }
69
- const declaration = (0, import_codegular.getDeclarationFromType)(type, {
70
- typeChecker
71
- });
72
- if (declaration) {
73
- if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isEnumDeclaration(declaration) || ts.isVariableDeclaration(declaration) || ts.isFunctionDeclaration(declaration)) {
74
- return {
75
- abstraction: "DeclarationType" /* DECLARATION */,
76
- declaration
77
- };
78
- }
79
- }
80
- if (type.getCallSignatures().length > 0) {
81
- return {
82
- abstraction: "FunctionType" /* FUNCTION */,
83
- declaration: void 0
84
- };
85
- }
86
- if (type.flags & ts.TypeFlags.Object) {
87
- return {
88
- abstraction: "ObjectType" /* OBJECT */,
89
- declaration: void 0
90
- };
91
- }
92
- return {
93
- abstraction: "unknown" /* UNKNOWN */,
94
- declaration: void 0
95
- };
96
- };
97
- const getType = (node, typeChecker, typeResolutionTracker) => {
98
- const typeImpl = TypeImplementation.fromTsNode(node, {
99
- typeChecker,
100
- typeResolutionTracker
101
- });
102
- if (!typeImpl) {
103
- return [];
104
- }
105
- console.log("typeImpl", typeImpl.type.symbol?.name);
106
- return [typeImpl.type];
107
- };
108
- class TypeImplementation {
109
- constructor(type, declaration, typeArguments, context) {
110
- this.type = type;
111
- this.baseTypes = [];
112
- this.name = context.typeChecker.typeToString(type);
113
- const baseTypes = type.getBaseTypes();
114
- if (baseTypes) {
115
- this.baseTypes = baseTypes.map((baseType) => {
116
- return TypeImplementation.fromInferredType(baseType, context);
117
- });
118
- }
119
- this.kind = "Type";
120
- if (declaration) {
121
- if (ts.isClassDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isTypeAliasDeclaration(declaration)) {
122
- this.declaration = (0, import_declaration.makeDeclarationInterface)(
123
- declaration,
124
- context
125
- );
126
- } else {
127
- this.declaration = (0, import_navigable_declaration.makeNavigableDeclaration)(declaration, context);
128
- }
129
- } else {
130
- this.declaration = void 0;
131
- }
132
- this.typeArguments = typeArguments;
133
- }
134
- // public readonly typeArgumentAbstraction: TypeInfoAbstraction | undefined;
135
- /**
136
- * Creates TypeInfo from any TypeScript node
137
- * Intelligently routes to appropriate specialized logic based on node type
138
- */
139
- static fromTsNode(node, context) {
140
- return (0, import_program_context.cacheDecorator)(
141
- (node2) => {
142
- try {
143
- if (ts.isMethodDeclaration(node2)) {
144
- return TypeImplementation.fromMethodReturnType(node2, context);
145
- }
146
- if (ts.isPropertyDeclaration(node2)) {
147
- if (node2.type) {
148
- return TypeImplementation.fromTsNode(node2.type, context);
149
- }
150
- if (node2.initializer) {
151
- return TypeImplementation.fromPropertyInitializer(
152
- node2.initializer,
153
- context
154
- );
155
- }
156
- return void 0;
157
- }
158
- if (ts.isTypeNode(node2)) {
159
- return TypeImplementation.fromExplicitTypeAnnotation(
160
- node2,
161
- context
162
- );
163
- }
164
- if (ts.isExpression(node2)) {
165
- return TypeImplementation.fromPropertyInitializer(node2, context);
166
- }
167
- const type = context.typeChecker.getTypeAtLocation(node2);
168
- if (!type) {
169
- return void 0;
170
- }
171
- return TypeImplementation.fromInferredType(type, context);
172
- } catch (error) {
173
- console.error("error", error);
174
- return void 0;
175
- }
176
- },
177
- node,
178
- context.typeResolutionTracker
179
- );
180
- }
181
- /**
182
- * Creates TypeInfo from a type when we know it has a symbol pointing to a declaration
183
- * This is optimized for cases like `return this;` where the type symbol points directly to a class
184
- * Avoids recursion by using the registry and not creating full implementations immediately
185
- */
186
- static fromTypeWithSymbol(type, context) {
187
- try {
188
- const cached = context.typeResolutionTracker.get(type);
189
- if (cached !== void 0) {
190
- return cached;
191
- }
192
- const baseType = type.target || type;
193
- const typeSymbol = baseType.symbol;
194
- if (typeSymbol) {
195
- const declarations = typeSymbol.getDeclarations();
196
- const declaration = declarations && declarations.length > 0 ? declarations[declarations.length - 1] : typeSymbol.valueDeclaration;
197
- if (declaration) {
198
- if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isEnumDeclaration(declaration) || ts.isVariableDeclaration(declaration) || ts.isFunctionDeclaration(declaration)) {
199
- return new TypeImplementation(
200
- type,
201
- // TypeInfoAbstraction.DECLARATION,
202
- declaration,
203
- void 0,
204
- context
205
- );
206
- }
207
- }
208
- }
209
- return void 0;
210
- } catch (error) {
211
- return void 0;
212
- }
213
- }
214
- static fromInferredType(type, context) {
215
- try {
216
- const cached = context.typeResolutionTracker.get(type);
217
- if (cached !== void 0) {
218
- return cached;
219
- }
220
- const resolved = resolveFromType(type, context.typeChecker);
221
- const typeArgs = type.typeArguments;
222
- const typeArguments = typeArgs ? typeArgs.map((arg) => TypeImplementation.fromInferredType(arg, context)).filter((arg) => arg !== void 0) : void 0;
223
- const result = new TypeImplementation(
224
- type,
225
- // resolved.abstraction,
226
- resolved.declaration,
227
- typeArguments,
228
- context
229
- );
230
- context.typeResolutionTracker.set(type, result);
231
- return result;
232
- } catch (error) {
233
- return void 0;
234
- }
235
- }
236
- /**
237
- * Creates TypeInfo from a property initializer expression
238
- * Handles identifier references (variable lookups) and direct expressions
239
- */
240
- static fromPropertyInitializer(initializer, context) {
241
- try {
242
- const cached = context.typeResolutionTracker.getFromNode(
243
- initializer
244
- );
245
- if (cached !== void 0) {
246
- return cached;
247
- }
248
- if (ts.isIdentifier(initializer)) {
249
- const symbol = context.typeChecker.getSymbolAtLocation(initializer);
250
- if (symbol) {
251
- const declarations = symbol.getDeclarations();
252
- const varDecl = declarations?.find(
253
- (d) => ts.isVariableDeclaration(d)
254
- );
255
- if (varDecl) {
256
- const varType = varDecl.initializer ? context.typeChecker.getTypeAtLocation(varDecl.initializer) : context.typeChecker.getTypeAtLocation(varDecl);
257
- if (varType) {
258
- const result2 = TypeImplementation.fromInferredType(
259
- varType,
260
- context
261
- );
262
- if (result2) {
263
- context.typeResolutionTracker.setFromNode(initializer, result2);
264
- }
265
- return result2;
266
- }
267
- }
268
- }
269
- }
270
- const type = context.typeChecker.getTypeAtLocation(initializer);
271
- if (!type) {
272
- return void 0;
273
- }
274
- const result = TypeImplementation.fromInferredType(type, context);
275
- if (result) {
276
- context.typeResolutionTracker.setFromNode(initializer, result);
277
- }
278
- return result;
279
- } catch (error) {
280
- return void 0;
281
- }
282
- }
283
- /**
284
- * Creates TypeInfo from a method's return type
285
- * Handles explicit return type annotations and inferred return types via call signatures
286
- */
287
- static fromMethodReturnType(methodNode, context) {
288
- try {
289
- const cached = context.typeResolutionTracker.getFromNode(
290
- methodNode
291
- );
292
- if (cached !== void 0) {
293
- return cached;
294
- }
295
- if (methodNode.type) {
296
- const result = TypeImplementation.fromExplicitTypeAnnotation(
297
- methodNode.type,
298
- context
299
- );
300
- if (result) {
301
- context.typeResolutionTracker.setFromNode(methodNode, result);
302
- }
303
- return result;
304
- }
305
- const methodType = context.typeChecker.getTypeAtLocation(methodNode);
306
- const signatures = methodType.getCallSignatures();
307
- if (signatures.length > 0) {
308
- const returnType = signatures[signatures.length - 1].getReturnType();
309
- if (returnType.symbol) {
310
- const result2 = TypeImplementation.fromTypeWithSymbol(
311
- returnType,
312
- context
313
- );
314
- if (result2) {
315
- context.typeResolutionTracker.setFromNode(methodNode, result2);
316
- }
317
- return result2;
318
- }
319
- const result = TypeImplementation.fromInferredType(returnType, context);
320
- if (result) {
321
- context.typeResolutionTracker.setFromNode(methodNode, result);
322
- }
323
- return result;
324
- }
325
- return void 0;
326
- } catch (error) {
327
- return void 0;
328
- }
329
- }
330
- /**
331
- * Convenience method: Creates TypeInfo from a TypeNode (explicit type annotation)
332
- * Converts TypeNode to ts.Type internally
333
- * For TypeReference nodes (like `NameType`), we check the symbol directly
334
- * to detect type aliases before resolving to the underlying type
335
- */
336
- static fromExplicitTypeAnnotation(typeNode, context) {
337
- try {
338
- if (ts.isTypeReferenceNode(typeNode)) {
339
- const declaration = (0, import_codegular.getDeclarationFromTypeReference)(typeNode, {
340
- typeChecker: context.typeChecker
341
- });
342
- if (declaration) {
343
- if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isEnumDeclaration(declaration) || ts.isVariableDeclaration(declaration) || ts.isFunctionDeclaration(declaration)) {
344
- const underlyingType = context.typeChecker.getTypeAtLocation(typeNode);
345
- const typeArgs = underlyingType && underlyingType.typeArguments;
346
- const typeArguments = typeArgs ? typeArgs.map(
347
- (arg) => TypeImplementation.fromInferredType(arg, context)
348
- ).filter((arg) => arg !== void 0) : void 0;
349
- return new TypeImplementation(
350
- underlyingType,
351
- // TypeInfoAbstraction.DECLARATION,
352
- declaration,
353
- typeArguments,
354
- context
355
- );
356
- }
357
- }
358
- }
359
- const type = context.typeChecker.getTypeAtLocation(typeNode);
360
- if (!type) {
361
- return void 0;
362
- }
363
- return TypeImplementation.fromInferredType(type, context);
364
- } catch (error) {
365
- return void 0;
366
- }
367
- }
368
- }
369
- // Annotate the CommonJS export names for ESM import in node:
370
- 0 && (module.exports = {
371
- TypeImplementation,
372
- TypeInfoAbstraction,
373
- getType
374
- });
@@ -1,90 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var declaration_abstraction_exports = {};
29
- __export(declaration_abstraction_exports, {
30
- DeclarationAbstraction: () => DeclarationAbstraction,
31
- makeDeclarationInterface: () => makeDeclarationInterface,
32
- resolveDeclarationAbstraction: () => resolveDeclarationAbstraction
33
- });
34
- module.exports = __toCommonJS(declaration_abstraction_exports);
35
- var ts = __toESM(require("typescript"));
36
- var import_class = require("./class.implementation");
37
- var import_core = require("./core");
38
- var import_interface = require("./interface.implementation");
39
- var import_type_alias = require("./type-alias.implementation");
40
- const makeDeclarationInterface = (declaration, context) => {
41
- const sourceFile = declaration.getSourceFile();
42
- const fileName = sourceFile.fileName;
43
- const isLibFile = fileName.includes("typescript/lib/lib.") || /lib\.[\w]+\.d\.ts$/.test(fileName);
44
- if (isLibFile) {
45
- }
46
- const kind = declaration.kind;
47
- switch (kind) {
48
- case ts.SyntaxKind.ClassDeclaration:
49
- return new import_class.ClassImplementation(
50
- declaration,
51
- context
52
- );
53
- case ts.SyntaxKind.InterfaceDeclaration:
54
- return new import_interface.InterfaceImplementation(
55
- declaration,
56
- context
57
- );
58
- case ts.SyntaxKind.TypeAliasDeclaration:
59
- return new import_type_alias.TypeAliasImplementation(
60
- declaration,
61
- context
62
- );
63
- }
64
- throw new Error(
65
- `Node is not a structured declaration: ` + (0, import_core.getSyntaxKindName)(kind)
66
- );
67
- };
68
- var DeclarationAbstraction = /* @__PURE__ */ ((DeclarationAbstraction2) => {
69
- DeclarationAbstraction2["DATA_STRUCTURE"] = "DataStructure";
70
- DeclarationAbstraction2["UNKNOWN"] = "unknown";
71
- return DeclarationAbstraction2;
72
- })(DeclarationAbstraction || {});
73
- const resolveDeclarationAbstraction = (declaration) => {
74
- const properties = declaration.properties;
75
- const methods = declaration.methods;
76
- if (properties.length === 0) {
77
- return "unknown" /* UNKNOWN */;
78
- }
79
- const hasCommands = true;
80
- if (hasCommands) {
81
- return "unknown" /* UNKNOWN */;
82
- }
83
- return "DataStructure" /* DATA_STRUCTURE */;
84
- };
85
- // Annotate the CommonJS export names for ESM import in node:
86
- 0 && (module.exports = {
87
- DeclarationAbstraction,
88
- makeDeclarationInterface,
89
- resolveDeclarationAbstraction
90
- });
@@ -1,35 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var decorator_implementation_exports = {};
19
- __export(decorator_implementation_exports, {
20
- DecoratorImplementation: () => DecoratorImplementation
21
- });
22
- module.exports = __toCommonJS(decorator_implementation_exports);
23
- var import_codegular = require("@core/codegular");
24
- var import_base = require("./base");
25
- class DecoratorImplementation extends import_base.NodableImpl {
26
- // readonly type: DecoratorImplementationType;
27
- constructor(node) {
28
- super(node);
29
- this.name = (0, import_codegular.getDecoratorName)(node);
30
- }
31
- }
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- DecoratorImplementation
35
- });
@@ -1,35 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var enum_implementation_exports = {};
19
- __export(enum_implementation_exports, {
20
- EnumImplementation: () => EnumImplementation
21
- });
22
- module.exports = __toCommonJS(enum_implementation_exports);
23
- var import_core = require("./core");
24
- var import_declaration = require("./declaration.abstraction");
25
- class EnumImplementation extends import_core.NameableImpl {
26
- constructor(node, context) {
27
- super(node);
28
- this.context = context;
29
- this.abstraction = import_declaration.DeclarationAbstraction.DATA_STRUCTURE;
30
- }
31
- }
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- EnumImplementation
35
- });
@@ -1,35 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var function_declaration_implementation_exports = {};
19
- __export(function_declaration_implementation_exports, {
20
- FunctionDeclarationImplementation: () => FunctionDeclarationImplementation
21
- });
22
- module.exports = __toCommonJS(function_declaration_implementation_exports);
23
- var import_core = require("./core");
24
- var import_declaration = require("./declaration.abstraction");
25
- class FunctionDeclarationImplementation extends import_core.NameableImpl {
26
- constructor(node, context) {
27
- super(node);
28
- this.context = context;
29
- this.abstraction = import_declaration.DeclarationAbstraction.UNKNOWN;
30
- }
31
- }
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- FunctionDeclarationImplementation
35
- });
@@ -1,57 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var lib_exports = {};
16
- module.exports = __toCommonJS(lib_exports);
17
- __reExport(lib_exports, require("../../../code-graph/src/lib/code.graph"), module.exports);
18
- __reExport(lib_exports, require("./class.implementation"), module.exports);
19
- __reExport(lib_exports, require("./core"), module.exports);
20
- __reExport(lib_exports, require("./core/navigable-declaration"), module.exports);
21
- __reExport(lib_exports, require("./declaration.abstraction"), module.exports);
22
- __reExport(lib_exports, require("./decorator.implementation"), module.exports);
23
- __reExport(lib_exports, require("./enum.implementation"), module.exports);
24
- __reExport(lib_exports, require("./function-declaration.implementation"), module.exports);
25
- __reExport(lib_exports, require("./interface.implementation"), module.exports);
26
- __reExport(lib_exports, require("./members/method-declaration.implementation"), module.exports);
27
- __reExport(lib_exports, require("./members/method-signature.implementation"), module.exports);
28
- __reExport(lib_exports, require("./members/method.util"), module.exports);
29
- __reExport(lib_exports, require("./members/parameter.implementation"), module.exports);
30
- __reExport(lib_exports, require("./members/property-declaration.implementation"), module.exports);
31
- __reExport(lib_exports, require("./members/property-signature.implementation"), module.exports);
32
- __reExport(lib_exports, require("./members/statements/expressions/call-expression.implementation"), module.exports);
33
- __reExport(lib_exports, require("./members/statements/statement.implementation"), module.exports);
34
- __reExport(lib_exports, require("./type-alias.implementation"), module.exports);
35
- __reExport(lib_exports, require("./variable-declaration.implementation"), module.exports);
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- ...require("../../../code-graph/src/lib/code.graph"),
39
- ...require("./class.implementation"),
40
- ...require("./core"),
41
- ...require("./core/navigable-declaration"),
42
- ...require("./declaration.abstraction"),
43
- ...require("./decorator.implementation"),
44
- ...require("./enum.implementation"),
45
- ...require("./function-declaration.implementation"),
46
- ...require("./interface.implementation"),
47
- ...require("./members/method-declaration.implementation"),
48
- ...require("./members/method-signature.implementation"),
49
- ...require("./members/method.util"),
50
- ...require("./members/parameter.implementation"),
51
- ...require("./members/property-declaration.implementation"),
52
- ...require("./members/property-signature.implementation"),
53
- ...require("./members/statements/expressions/call-expression.implementation"),
54
- ...require("./members/statements/statement.implementation"),
55
- ...require("./type-alias.implementation"),
56
- ...require("./variable-declaration.implementation")
57
- });
@@ -1,51 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var interface_implementation_exports = {};
19
- __export(interface_implementation_exports, {
20
- InterfaceImplementation: () => InterfaceImplementation
21
- });
22
- module.exports = __toCommonJS(interface_implementation_exports);
23
- var import_codegular = require("@core/codegular");
24
- var import_typescript = require("typescript");
25
- var import_core = require("./core");
26
- var import_declaration = require("./declaration.abstraction");
27
- var import_method_signature = require("./members/method-signature.implementation");
28
- var import_property_signature = require("./members/property-signature.implementation");
29
- class InterfaceImplementation extends import_core.NameableImpl {
30
- constructor(node, context) {
31
- super(node);
32
- this.context = context;
33
- this.properties = (0, import_codegular.findChildrenByKind)(
34
- node,
35
- import_typescript.SyntaxKind.PropertySignature
36
- ).map(
37
- (p) => new import_property_signature.PropertySignatureImplementation(
38
- p,
39
- this.context
40
- )
41
- );
42
- this.methods = (0, import_codegular.findChildrenByKind)(node, import_typescript.SyntaxKind.MethodSignature).map(
43
- (m) => new import_method_signature.MethodSignatureImplementation(m, this.context)
44
- );
45
- this.abstraction = (0, import_declaration.resolveDeclarationAbstraction)(this);
46
- }
47
- }
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- InterfaceImplementation
51
- });