@lowgular/code-graph 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +10 -0
- package/code-graph-v2/code.graph.js +37 -0
- package/code-graph-v2/config-from-query.js +131 -0
- package/code-graph-v2/extractors/extractor.js +27 -0
- package/code-graph-v2/extractors/index.js +1 -0
- package/code-graph-v2/graph-builder/code-graph.builder.js +49 -0
- package/code-graph-v2/graph-builder/index.js +1 -0
- package/code-graph-v2/graph-builder/node.processor.js +22 -0
- package/{libs/cli/code-graph/src/lib/v2 → code-graph-v2}/graph-builder/relationship.processor.js +11 -35
- package/code-graph-v2/graph-builder/type.processor.js +21 -0
- package/code-graph-v2/index.js +4 -0
- package/code-graph-v2/tools/build-code-graph.tool.js +19 -0
- package/code-graph-v2/utils.js +34 -0
- package/codegular/index.js +5 -0
- package/codegular/node.js +71 -0
- package/codegular/program.js +100 -0
- package/{libs/core/codegular/src/lib → codegular}/string.js +6 -53
- package/{libs/core/codegular/src/lib → codegular}/type-checker.js +3 -40
- package/codegular/type.js +356 -0
- package/{libs/core/codegular/src/lib → codegular}/utils.js +50 -62
- package/cypher/index.js +1 -0
- package/{libs/cli/cypher/src → cypher}/lib/executor/condition-evaluator.js +2 -25
- package/cypher/lib/executor/executor.js +60 -0
- package/cypher/lib/executor/graph.js +0 -0
- package/{libs/cli/cypher/src → cypher}/lib/executor/match-engine.js +4 -27
- package/{libs/cli/cypher/src → cypher}/lib/executor/pattern-matcher.js +2 -25
- package/{libs/cli/cypher/src → cypher}/lib/executor/relationship-navigator.js +2 -25
- package/{libs/cli/cypher/src → cypher}/lib/executor/result-formatter.js +37 -31
- package/{libs/cli/cypher/src → cypher}/lib/executor/traverse-engine.js +4 -27
- package/cypher/lib/executor/utils.js +14 -0
- package/cypher/lib/graph.stub.js +38 -0
- package/cypher/lib/index.js +32 -0
- package/{libs/cli/cypher/src → cypher}/lib/lexer.js +4 -26
- package/{libs/cli/cypher/src → cypher}/lib/parser.js +119 -135
- package/{libs/cli/cypher/src → cypher}/lib/validator/query-validator.js +12 -32
- package/{libs/cli/cypher/src → cypher}/lib/validator/supported-features.config.js +2 -30
- package/{libs/cli/cypher/src → cypher}/lib/validator/unsupported-features.config.js +8 -34
- package/cypher-cli.js +41 -0
- package/infra/code-graph.js +147 -0
- package/main.js +0 -43
- package/package.json +25 -7
- package/resources-cli.js +75 -0
- package/run-cli.js +43 -0
- package/apps/code-graph/src/main.js +0 -50
- package/libs/cli/code-graph/src/index.js +0 -39
- package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +0 -72
- package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +0 -68
- package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +0 -147
- package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +0 -55
- package/libs/cli/code-graph/src/lib/class-declarations/index.js +0 -27
- package/libs/cli/code-graph/src/lib/code.graph.factory.js +0 -63
- package/libs/cli/code-graph/src/lib/code.graph.js +0 -62
- package/libs/cli/code-graph/src/lib/core/core.js +0 -58
- package/libs/cli/code-graph/src/lib/core.js +0 -85
- package/libs/cli/code-graph/src/lib/decorators/index.js +0 -36
- package/libs/cli/code-graph/src/lib/docs/index.js +0 -21
- package/libs/cli/code-graph/src/lib/docs/specs.js +0 -36
- package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +0 -28
- package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +0 -53
- package/libs/cli/code-graph/src/lib/method-declarations/index.js +0 -23
- package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +0 -106
- package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +0 -56
- package/libs/cli/code-graph/src/lib/parameters/index.js +0 -42
- package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +0 -139
- package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +0 -104
- package/libs/cli/code-graph/src/lib/property-declarations/index.js +0 -25
- package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +0 -74
- package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +0 -43
- package/libs/cli/code-graph/src/lib/tools/index.js +0 -34
- package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +0 -64
- package/libs/cli/code-graph/src/lib/types/index.js +0 -99
- package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +0 -345
- package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +0 -52
- package/libs/cli/code-graph/src/lib/v2/extractors/index.js +0 -23
- package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +0 -76
- package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +0 -21
- package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +0 -48
- package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +0 -45
- package/libs/cli/code-graph/src/lib/v2/index.js +0 -37
- package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +0 -220
- package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +0 -42
- package/libs/cli/cypher/src/index.js +0 -25
- package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +0 -277
- package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +0 -69
- package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +0 -105
- package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +0 -70
- package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +0 -99
- package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +0 -125
- package/libs/cli/cypher/src/lib/docs/features/index.js +0 -51
- package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +0 -50
- package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +0 -106
- package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +0 -105
- package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +0 -143
- package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +0 -152
- package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +0 -48
- package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +0 -65
- package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +0 -82
- package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +0 -136
- package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +0 -187
- package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +0 -302
- package/libs/cli/cypher/src/lib/docs/prompts.js +0 -36
- package/libs/cli/cypher/src/lib/docs/specs.js +0 -181
- package/libs/cli/cypher/src/lib/executor/executor.js +0 -83
- package/libs/cli/cypher/src/lib/executor/graph.js +0 -15
- package/libs/cli/cypher/src/lib/executor/utils.js +0 -37
- package/libs/cli/cypher/src/lib/graph.stub.js +0 -63
- package/libs/cli/cypher/src/lib/index.js +0 -74
- package/libs/cli/shared/src/index.js +0 -53
- package/libs/cli/shared/src/lib/admin-token.js +0 -121
- package/libs/cli/shared/src/lib/config.js +0 -49
- package/libs/cli/shared/src/lib/consts.js +0 -57
- package/libs/cli/shared/src/lib/core.js +0 -46
- package/libs/cli/shared/src/lib/infrastructure/cli.js +0 -47
- package/libs/cli/shared/src/lib/infrastructure/config.js +0 -47
- package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +0 -51
- package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +0 -96
- package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +0 -41
- package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +0 -64
- package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +0 -120
- package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +0 -15
- package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +0 -72
- package/libs/cli/shared/src/lib/infrastructure/git.js +0 -147
- package/libs/cli/shared/src/lib/infrastructure/http.js +0 -257
- package/libs/cli/shared/src/lib/infrastructure/markdown.js +0 -95
- package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +0 -88
- package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +0 -25
- package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +0 -154
- package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +0 -210
- package/libs/cli/shared/src/lib/infrastructure/workspace.js +0 -297
- package/libs/cli/shared/src/lib/infrastructure/yaml.js +0 -237
- package/libs/cli/shared/src/lib/lowgular.config.js +0 -120
- package/libs/cli/shared/src/lib/token.js +0 -135
- package/libs/cli/shared/src/lib/utils/solution.util.js +0 -35
- package/libs/cli/shared/src/lib/utils/utils.js +0 -89
- package/libs/cli/typescript/src/index.js +0 -21
- package/libs/cli/typescript/src/lib/base/index.js +0 -23
- package/libs/cli/typescript/src/lib/base/nameable.js +0 -34
- package/libs/cli/typescript/src/lib/base/nodeable.js +0 -36
- package/libs/cli/typescript/src/lib/class.implementation.js +0 -52
- package/libs/cli/typescript/src/lib/core/declaration.registry.js +0 -107
- package/libs/cli/typescript/src/lib/core/design-pattern.js +0 -55
- package/libs/cli/typescript/src/lib/core/index.js +0 -35
- package/libs/cli/typescript/src/lib/core/navigable-declaration.js +0 -69
- package/libs/cli/typescript/src/lib/core/program-context.js +0 -71
- package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +0 -40
- package/libs/cli/typescript/src/lib/core/type.js +0 -374
- package/libs/cli/typescript/src/lib/declaration.abstraction.js +0 -90
- package/libs/cli/typescript/src/lib/decorator.implementation.js +0 -35
- package/libs/cli/typescript/src/lib/enum.implementation.js +0 -35
- package/libs/cli/typescript/src/lib/function-declaration.implementation.js +0 -35
- package/libs/cli/typescript/src/lib/index.js +0 -57
- package/libs/cli/typescript/src/lib/interface.implementation.js +0 -51
- package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +0 -90
- package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +0 -44
- package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +0 -46
- package/libs/cli/typescript/src/lib/members/method.util.js +0 -32
- package/libs/cli/typescript/src/lib/members/parameter.implementation.js +0 -38
- package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +0 -64
- package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +0 -34
- package/libs/cli/typescript/src/lib/members/property.util.js +0 -61
- package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +0 -42
- package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +0 -114
- package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +0 -188
- package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +0 -35
- package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +0 -51
- package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +0 -49
- package/libs/cli/typescript/src/lib/members/statements/utils.js +0 -51
- package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +0 -258
- package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +0 -15
- package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +0 -228
- package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +0 -126
- package/libs/cli/typescript/src/lib/plugins/stubs.js +0 -66
- package/libs/cli/typescript/src/lib/type-alias.implementation.js +0 -72
- package/libs/cli/typescript/src/lib/utils.js +0 -39
- package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +0 -35
- package/libs/core/codegular/src/index.js +0 -21
- package/libs/core/codegular/src/lib/index.js +0 -29
- package/libs/core/codegular/src/lib/node.js +0 -112
- package/libs/core/codegular/src/lib/program.js +0 -92
|
@@ -1,51 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 string_exports = {};
|
|
29
|
-
__export(string_exports, {
|
|
30
|
-
getEndCharacter: () => getEndCharacter,
|
|
31
|
-
getEndLine: () => getEndLine,
|
|
32
|
-
getFilePath: () => getFilePath,
|
|
33
|
-
getInitializerText: () => getInitializerText,
|
|
34
|
-
getNameAndRange: () => getNameAndRange,
|
|
35
|
-
getNameByIdentifier: () => getNameByIdentifier,
|
|
36
|
-
getNameOrThrow: () => getNameOrThrow,
|
|
37
|
-
getPropertyType: () => getPropertyType,
|
|
38
|
-
getRange: () => getRange,
|
|
39
|
-
getStartCharacter: () => getStartCharacter,
|
|
40
|
-
getStartLine: () => getStartLine,
|
|
41
|
-
getText: () => getText,
|
|
42
|
-
getTextOrThrow: () => getTextOrThrow,
|
|
43
|
-
rangeDistance: () => rangeDistance,
|
|
44
|
-
throwUndefined: () => throwUndefined
|
|
45
|
-
});
|
|
46
|
-
module.exports = __toCommonJS(string_exports);
|
|
47
|
-
var ts = __toESM(require("typescript"));
|
|
48
|
-
var import_utils = require("./utils.js");
|
|
1
|
+
import * as ts from "typescript";
|
|
2
|
+
import { findChildrenByKind } from "./utils.js";
|
|
49
3
|
const { SyntaxKind } = ts;
|
|
50
4
|
const throwUndefined = (val, message) => {
|
|
51
5
|
if (val === void 0) {
|
|
@@ -59,7 +13,7 @@ const getNameByIdentifier = (n) => {
|
|
|
59
13
|
if (n.kind === SyntaxKind.Identifier) {
|
|
60
14
|
return getText(n);
|
|
61
15
|
}
|
|
62
|
-
const [nameNode] =
|
|
16
|
+
const [nameNode] = findChildrenByKind(n, SyntaxKind.Identifier);
|
|
63
17
|
return nameNode ? getText(nameNode) : void 0;
|
|
64
18
|
};
|
|
65
19
|
const getInitializerText = (node) => {
|
|
@@ -138,7 +92,7 @@ function rangeDistance(outer, inner) {
|
|
|
138
92
|
return startDistance + endDistance;
|
|
139
93
|
}
|
|
140
94
|
const getNameAndRange = (n) => {
|
|
141
|
-
const [nameNode] =
|
|
95
|
+
const [nameNode] = findChildrenByKind(n, SyntaxKind.Identifier);
|
|
142
96
|
if (!nameNode) {
|
|
143
97
|
return void 0;
|
|
144
98
|
}
|
|
@@ -148,8 +102,7 @@ const getNameAndRange = (n) => {
|
|
|
148
102
|
};
|
|
149
103
|
};
|
|
150
104
|
const getNameOrThrow = (n) => throwUndefined(getNameByIdentifier(n), `Could not get name`);
|
|
151
|
-
|
|
152
|
-
0 && (module.exports = {
|
|
105
|
+
export {
|
|
153
106
|
getEndCharacter,
|
|
154
107
|
getEndLine,
|
|
155
108
|
getFilePath,
|
|
@@ -165,4 +118,4 @@ const getNameOrThrow = (n) => throwUndefined(getNameByIdentifier(n), `Could not
|
|
|
165
118
|
getTextOrThrow,
|
|
166
119
|
rangeDistance,
|
|
167
120
|
throwUndefined
|
|
168
|
-
}
|
|
121
|
+
};
|
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
|
|
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_checker_exports = {};
|
|
29
|
-
__export(type_checker_exports, {
|
|
30
|
-
getDeclarationFromType: () => getDeclarationFromType,
|
|
31
|
-
getDeclarationFromTypeLocation: () => getDeclarationFromTypeLocation,
|
|
32
|
-
getDeclarationFromTypeReference: () => getDeclarationFromTypeReference,
|
|
33
|
-
getDeclarationFromValueSymbol: () => getDeclarationFromValueSymbol,
|
|
34
|
-
getDeclarations: () => getDeclarations
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(type_checker_exports);
|
|
37
|
-
var ts = __toESM(require("typescript"));
|
|
1
|
+
import * as ts from "typescript";
|
|
38
2
|
const getDeclarationFromSymbol = (symbol, context) => {
|
|
39
3
|
let aliasedSymbol = symbol;
|
|
40
4
|
try {
|
|
@@ -160,11 +124,10 @@ const getDeclarations = (node, typeChecker) => {
|
|
|
160
124
|
}
|
|
161
125
|
return declarations;
|
|
162
126
|
};
|
|
163
|
-
|
|
164
|
-
0 && (module.exports = {
|
|
127
|
+
export {
|
|
165
128
|
getDeclarationFromType,
|
|
166
129
|
getDeclarationFromTypeLocation,
|
|
167
130
|
getDeclarationFromTypeReference,
|
|
168
131
|
getDeclarationFromValueSymbol,
|
|
169
132
|
getDeclarations
|
|
170
|
-
}
|
|
133
|
+
};
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import * as ts from "typescript";
|
|
2
|
+
import { getDeclarationFromType } from "./type-checker";
|
|
3
|
+
var TypeInfoAbstraction = /* @__PURE__ */ ((TypeInfoAbstraction2) => {
|
|
4
|
+
TypeInfoAbstraction2["VOID"] = "VoidType";
|
|
5
|
+
TypeInfoAbstraction2["NULLISH"] = "NullishType";
|
|
6
|
+
TypeInfoAbstraction2["PRIMITIVE"] = "PrimitiveType";
|
|
7
|
+
TypeInfoAbstraction2["OBJECT"] = "ObjectType";
|
|
8
|
+
TypeInfoAbstraction2["FUNCTION"] = "FunctionType";
|
|
9
|
+
TypeInfoAbstraction2["DECLARATION"] = "DeclarationType";
|
|
10
|
+
TypeInfoAbstraction2["UNKNOWN"] = "unknown";
|
|
11
|
+
return TypeInfoAbstraction2;
|
|
12
|
+
})(TypeInfoAbstraction || {});
|
|
13
|
+
const resolveFromType = (type, typeChecker) => {
|
|
14
|
+
if (type.flags & ts.TypeFlags.Void) {
|
|
15
|
+
return {
|
|
16
|
+
abstraction: "VoidType" /* VOID */,
|
|
17
|
+
declaration: void 0
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (type.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) {
|
|
21
|
+
return {
|
|
22
|
+
abstraction: "NullishType" /* NULLISH */,
|
|
23
|
+
declaration: void 0
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
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)) {
|
|
27
|
+
return {
|
|
28
|
+
abstraction: "PrimitiveType" /* PRIMITIVE */,
|
|
29
|
+
declaration: void 0
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const declaration = getDeclarationFromType(type, {
|
|
33
|
+
typeChecker
|
|
34
|
+
});
|
|
35
|
+
if (declaration) {
|
|
36
|
+
if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isEnumDeclaration(declaration) || ts.isVariableDeclaration(declaration) || ts.isFunctionDeclaration(declaration)) {
|
|
37
|
+
return {
|
|
38
|
+
abstraction: "DeclarationType" /* DECLARATION */,
|
|
39
|
+
declaration
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (type.getCallSignatures().length > 0) {
|
|
44
|
+
return {
|
|
45
|
+
abstraction: "FunctionType" /* FUNCTION */,
|
|
46
|
+
declaration: void 0
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (type.flags & ts.TypeFlags.Object) {
|
|
50
|
+
return {
|
|
51
|
+
abstraction: "ObjectType" /* OBJECT */,
|
|
52
|
+
declaration: void 0
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
abstraction: "unknown" /* UNKNOWN */,
|
|
57
|
+
declaration: void 0
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
class TypeResolutionTracker {
|
|
61
|
+
constructor() {
|
|
62
|
+
// Cache for resolved types - maps ts.Type to TypeInfoImpl
|
|
63
|
+
this._typeCache = /* @__PURE__ */ new WeakMap();
|
|
64
|
+
// Cache for resolved types from nodes - maps ts.Node to TypeInfoImpl
|
|
65
|
+
this._nodeCache = /* @__PURE__ */ new WeakMap();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Gets the cached TypeInfoImpl for a type, or undefined if not cached.
|
|
69
|
+
*/
|
|
70
|
+
get(type) {
|
|
71
|
+
return this._typeCache.get(type);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Caches a TypeInfoImpl for a type.
|
|
75
|
+
*/
|
|
76
|
+
set(type, value) {
|
|
77
|
+
this._typeCache.set(type, value);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Gets the cached TypeInfoImpl for a node, or undefined if not cached.
|
|
81
|
+
*/
|
|
82
|
+
getFromNode(node) {
|
|
83
|
+
return this._nodeCache.get(node);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Caches a TypeInfoImpl for a node.
|
|
87
|
+
*/
|
|
88
|
+
setFromNode(node, value) {
|
|
89
|
+
this._nodeCache.set(node, value);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const cacheDecorator = (cb, node, typeResolutionTracker) => {
|
|
93
|
+
const cached = typeResolutionTracker.getFromNode(node);
|
|
94
|
+
if (cached !== void 0) {
|
|
95
|
+
return cached;
|
|
96
|
+
}
|
|
97
|
+
const result = cb(node);
|
|
98
|
+
if (result) {
|
|
99
|
+
typeResolutionTracker.setFromNode(node, result);
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
};
|
|
103
|
+
const getType = (node, typeChecker, typeResolutionTracker) => {
|
|
104
|
+
const context = {
|
|
105
|
+
typeChecker,
|
|
106
|
+
typeResolutionTracker
|
|
107
|
+
};
|
|
108
|
+
const typeImpl = cacheDecorator(
|
|
109
|
+
(node2) => {
|
|
110
|
+
try {
|
|
111
|
+
if (ts.isMethodDeclaration(node2)) {
|
|
112
|
+
return fromMethodReturnType(node2, context);
|
|
113
|
+
}
|
|
114
|
+
if (ts.isPropertyDeclaration(node2)) {
|
|
115
|
+
if (node2.type) {
|
|
116
|
+
return fromTsNode(node2.type, context);
|
|
117
|
+
}
|
|
118
|
+
if (node2.initializer) {
|
|
119
|
+
return fromPropertyInitializer(node2.initializer, context);
|
|
120
|
+
}
|
|
121
|
+
return void 0;
|
|
122
|
+
}
|
|
123
|
+
if (ts.isTypeNode(node2)) {
|
|
124
|
+
return fromExplicitTypeAnnotation(node2, context);
|
|
125
|
+
}
|
|
126
|
+
if (ts.isExpression(node2)) {
|
|
127
|
+
return fromPropertyInitializer(node2, context);
|
|
128
|
+
}
|
|
129
|
+
const type = context.typeChecker.getTypeAtLocation(node2);
|
|
130
|
+
if (!type) {
|
|
131
|
+
return void 0;
|
|
132
|
+
}
|
|
133
|
+
return fromInferredType(type, context);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.error("error", error);
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
node,
|
|
140
|
+
typeResolutionTracker
|
|
141
|
+
);
|
|
142
|
+
if (!typeImpl) {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
console.log("typeImpl", typeImpl.type.symbol?.name);
|
|
146
|
+
return [typeImpl.type];
|
|
147
|
+
};
|
|
148
|
+
function fromTsNode(node, context) {
|
|
149
|
+
return cacheDecorator(
|
|
150
|
+
(node2) => {
|
|
151
|
+
try {
|
|
152
|
+
if (ts.isMethodDeclaration(node2)) {
|
|
153
|
+
return fromMethodReturnType(node2, context);
|
|
154
|
+
}
|
|
155
|
+
if (ts.isPropertyDeclaration(node2)) {
|
|
156
|
+
if (node2.type) {
|
|
157
|
+
return fromTsNode(node2.type, context);
|
|
158
|
+
}
|
|
159
|
+
if (node2.initializer) {
|
|
160
|
+
return fromPropertyInitializer(node2.initializer, context);
|
|
161
|
+
}
|
|
162
|
+
return void 0;
|
|
163
|
+
}
|
|
164
|
+
if (ts.isTypeNode(node2)) {
|
|
165
|
+
return fromExplicitTypeAnnotation(node2, context);
|
|
166
|
+
}
|
|
167
|
+
if (ts.isExpression(node2)) {
|
|
168
|
+
return fromPropertyInitializer(node2, context);
|
|
169
|
+
}
|
|
170
|
+
const type = context.typeChecker.getTypeAtLocation(node2);
|
|
171
|
+
if (!type) {
|
|
172
|
+
return void 0;
|
|
173
|
+
}
|
|
174
|
+
return fromInferredType(type, context);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.error("error", error);
|
|
177
|
+
return void 0;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
node,
|
|
181
|
+
context.typeResolutionTracker
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
function fromMethodReturnType(methodNode, context) {
|
|
185
|
+
try {
|
|
186
|
+
const cached = context.typeResolutionTracker.getFromNode(methodNode);
|
|
187
|
+
if (cached !== void 0) {
|
|
188
|
+
return cached;
|
|
189
|
+
}
|
|
190
|
+
if (methodNode.type) {
|
|
191
|
+
const result = fromExplicitTypeAnnotation(methodNode.type, context);
|
|
192
|
+
if (result) {
|
|
193
|
+
context.typeResolutionTracker.setFromNode(methodNode, result);
|
|
194
|
+
}
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
const methodType = context.typeChecker.getTypeAtLocation(methodNode);
|
|
198
|
+
const signatures = methodType.getCallSignatures();
|
|
199
|
+
if (signatures.length > 0) {
|
|
200
|
+
const returnType = signatures[signatures.length - 1].getReturnType();
|
|
201
|
+
if (returnType.symbol) {
|
|
202
|
+
const result2 = fromTypeWithSymbol(returnType, context);
|
|
203
|
+
if (result2) {
|
|
204
|
+
context.typeResolutionTracker.setFromNode(methodNode, result2);
|
|
205
|
+
}
|
|
206
|
+
return result2;
|
|
207
|
+
}
|
|
208
|
+
const result = fromInferredType(returnType, context);
|
|
209
|
+
if (result) {
|
|
210
|
+
context.typeResolutionTracker.setFromNode(methodNode, result);
|
|
211
|
+
}
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
214
|
+
return void 0;
|
|
215
|
+
} catch (error) {
|
|
216
|
+
return void 0;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function fromPropertyInitializer(initializer, context) {
|
|
220
|
+
try {
|
|
221
|
+
const cached = context.typeResolutionTracker.getFromNode(
|
|
222
|
+
initializer
|
|
223
|
+
);
|
|
224
|
+
if (cached !== void 0) {
|
|
225
|
+
return cached;
|
|
226
|
+
}
|
|
227
|
+
if (ts.isIdentifier(initializer)) {
|
|
228
|
+
const symbol = context.typeChecker.getSymbolAtLocation(initializer);
|
|
229
|
+
if (symbol) {
|
|
230
|
+
const declarations = symbol.getDeclarations();
|
|
231
|
+
const varDecl = declarations?.find((d) => ts.isVariableDeclaration(d));
|
|
232
|
+
if (varDecl) {
|
|
233
|
+
const varType = varDecl.initializer ? context.typeChecker.getTypeAtLocation(varDecl.initializer) : context.typeChecker.getTypeAtLocation(varDecl);
|
|
234
|
+
if (varType) {
|
|
235
|
+
const result2 = fromInferredType(varType, context);
|
|
236
|
+
if (result2) {
|
|
237
|
+
context.typeResolutionTracker.setFromNode(initializer, result2);
|
|
238
|
+
}
|
|
239
|
+
return result2;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const type = context.typeChecker.getTypeAtLocation(initializer);
|
|
245
|
+
if (!type) {
|
|
246
|
+
return void 0;
|
|
247
|
+
}
|
|
248
|
+
const result = fromInferredType(type, context);
|
|
249
|
+
if (result) {
|
|
250
|
+
context.typeResolutionTracker.setFromNode(initializer, result);
|
|
251
|
+
}
|
|
252
|
+
return result;
|
|
253
|
+
} catch (error) {
|
|
254
|
+
return void 0;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function fromTypeWithSymbol(type, context) {
|
|
258
|
+
try {
|
|
259
|
+
const cached = context.typeResolutionTracker.get(type);
|
|
260
|
+
if (cached !== void 0) {
|
|
261
|
+
return cached;
|
|
262
|
+
}
|
|
263
|
+
const baseType = type.target || type;
|
|
264
|
+
const typeSymbol = baseType.symbol;
|
|
265
|
+
if (typeSymbol) {
|
|
266
|
+
const declarations = typeSymbol.getDeclarations();
|
|
267
|
+
const declaration = declarations && declarations.length > 0 ? declarations[declarations.length - 1] : typeSymbol.valueDeclaration;
|
|
268
|
+
if (declaration) {
|
|
269
|
+
if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isEnumDeclaration(declaration) || ts.isVariableDeclaration(declaration) || ts.isFunctionDeclaration(declaration)) {
|
|
270
|
+
return new TypeImplementation(
|
|
271
|
+
type,
|
|
272
|
+
// TypeInfoAbstraction.DECLARATION,
|
|
273
|
+
declaration,
|
|
274
|
+
void 0,
|
|
275
|
+
context
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return void 0;
|
|
281
|
+
} catch (error) {
|
|
282
|
+
return void 0;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function fromInferredType(type, context) {
|
|
286
|
+
try {
|
|
287
|
+
const cached = context.typeResolutionTracker.get(type);
|
|
288
|
+
if (cached !== void 0) {
|
|
289
|
+
return cached;
|
|
290
|
+
}
|
|
291
|
+
const resolved = resolveFromType(type, context.typeChecker);
|
|
292
|
+
const typeArgs = type.typeArguments;
|
|
293
|
+
const typeArguments = typeArgs ? typeArgs.map((arg) => fromInferredType(arg, context)).filter((arg) => arg !== void 0) : void 0;
|
|
294
|
+
const result = new TypeImplementation(
|
|
295
|
+
type,
|
|
296
|
+
// resolved.abstraction,
|
|
297
|
+
resolved.declaration,
|
|
298
|
+
typeArguments,
|
|
299
|
+
context
|
|
300
|
+
);
|
|
301
|
+
context.typeResolutionTracker.set(type, result);
|
|
302
|
+
return result;
|
|
303
|
+
} catch (error) {
|
|
304
|
+
return void 0;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function fromExplicitTypeAnnotation(typeNode, context) {
|
|
308
|
+
try {
|
|
309
|
+
if (ts.isTypeReferenceNode(typeNode)) {
|
|
310
|
+
const declaration = void 0;
|
|
311
|
+
if (declaration) {
|
|
312
|
+
if (ts.isTypeAliasDeclaration(declaration) || ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isEnumDeclaration(declaration) || ts.isVariableDeclaration(declaration) || ts.isFunctionDeclaration(declaration)) {
|
|
313
|
+
const underlyingType = context.typeChecker.getTypeAtLocation(typeNode);
|
|
314
|
+
const typeArgs = underlyingType && underlyingType.typeArguments;
|
|
315
|
+
const typeArguments = typeArgs ? typeArgs.map((arg) => fromInferredType(arg, context)).filter((arg) => arg !== void 0) : void 0;
|
|
316
|
+
return new TypeImplementation(
|
|
317
|
+
underlyingType,
|
|
318
|
+
// TypeInfoAbstraction.DECLARATION,
|
|
319
|
+
declaration,
|
|
320
|
+
typeArguments,
|
|
321
|
+
context
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const type = context.typeChecker.getTypeAtLocation(typeNode);
|
|
327
|
+
if (!type) {
|
|
328
|
+
return void 0;
|
|
329
|
+
}
|
|
330
|
+
return fromInferredType(type, context);
|
|
331
|
+
} catch (error) {
|
|
332
|
+
return void 0;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
class TypeImplementation {
|
|
336
|
+
// public readonly typeArgumentAbstraction: TypeInfoAbstraction | undefined;
|
|
337
|
+
constructor(type, declaration, typeArguments, context) {
|
|
338
|
+
this.type = type;
|
|
339
|
+
this.baseTypes = [];
|
|
340
|
+
this.name = context.typeChecker.typeToString(type);
|
|
341
|
+
const baseTypes = type.getBaseTypes();
|
|
342
|
+
if (baseTypes) {
|
|
343
|
+
this.baseTypes = baseTypes.map((baseType) => {
|
|
344
|
+
return fromInferredType(baseType, context);
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
this.kind = "Type";
|
|
348
|
+
this.typeArguments = typeArguments;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
export {
|
|
352
|
+
TypeInfoAbstraction,
|
|
353
|
+
TypeResolutionTracker,
|
|
354
|
+
cacheDecorator,
|
|
355
|
+
getType
|
|
356
|
+
};
|
|
@@ -1,65 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 utils_exports = {};
|
|
29
|
-
__export(utils_exports, {
|
|
30
|
-
consoleAllChildren: () => consoleAllChildren,
|
|
31
|
-
escapeValue: () => escapeValue,
|
|
32
|
-
findChildByIndex: () => findChildByIndex,
|
|
33
|
-
findChildByName: () => findChildByName,
|
|
34
|
-
findChildrenByKind: () => findChildrenByKind,
|
|
35
|
-
findChildrenByKinds: () => findChildrenByKinds,
|
|
36
|
-
findChildrenByName: () => findChildrenByName,
|
|
37
|
-
findFirstChildByKind: () => findFirstChildByKind,
|
|
38
|
-
findFirstChildByKinds: () => findFirstChildByKinds,
|
|
39
|
-
findTypeDeclarationByName: () => findTypeDeclarationByName,
|
|
40
|
-
getAllExpressions: () => getAllExpressions,
|
|
41
|
-
getAncestorByKind: () => getAncestorByKind,
|
|
42
|
-
getAncestorsBy: () => getAncestorsBy,
|
|
43
|
-
getAncestorsByKind: () => getAncestorsByKind,
|
|
44
|
-
getComments: () => getComments,
|
|
45
|
-
getDescendantByName: () => getDescendantByName,
|
|
46
|
-
getDescendantsBy: () => getDescendantsBy,
|
|
47
|
-
getDescendantsByKind: () => getDescendantsByKind,
|
|
48
|
-
getDescendantsByKinds: () => getDescendantsByKinds,
|
|
49
|
-
getSolutionSourceFiles: () => getSolutionSourceFiles,
|
|
50
|
-
parseArrayLiteralExpression: () => parseArrayLiteralExpression,
|
|
51
|
-
parseObjectLiteralExpression: () => parseObjectLiteralExpression,
|
|
52
|
-
peelCallTarget: () => peelCallTarget,
|
|
53
|
-
readSourceFiles: () => readSourceFiles
|
|
54
|
-
});
|
|
55
|
-
module.exports = __toCommonJS(utils_exports);
|
|
56
|
-
var ts = __toESM(require("typescript"));
|
|
57
|
-
var import_string = require("./string");
|
|
58
|
-
const path = require("path");
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import * as ts from "typescript";
|
|
3
|
+
import { getNameByIdentifier } from "./string.js";
|
|
59
4
|
const { forEachChild, SyntaxKind } = ts;
|
|
60
5
|
function escapeValue(value) {
|
|
61
6
|
return value.replace(/^['"`]+/i, "").replace(/['"`]+$/i, "");
|
|
62
7
|
}
|
|
8
|
+
const parseObjectLiteralString = (objectLiteralString) => {
|
|
9
|
+
const result = {};
|
|
10
|
+
if (!objectLiteralString || typeof objectLiteralString !== "string") {
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
const code = `const _ = ${objectLiteralString}`;
|
|
14
|
+
const sourceFile = ts.createSourceFile(
|
|
15
|
+
"temp.ts",
|
|
16
|
+
code,
|
|
17
|
+
ts.ScriptTarget.Latest,
|
|
18
|
+
true
|
|
19
|
+
);
|
|
20
|
+
const findObjectLiteral = (node) => {
|
|
21
|
+
if (ts.isObjectLiteralExpression(node)) {
|
|
22
|
+
return node;
|
|
23
|
+
}
|
|
24
|
+
return ts.forEachChild(node, findObjectLiteral);
|
|
25
|
+
};
|
|
26
|
+
const objectLiteral = findObjectLiteral(sourceFile);
|
|
27
|
+
if (!objectLiteral) {
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
for (const property of objectLiteral.properties) {
|
|
31
|
+
if (ts.isPropertyAssignment(property)) {
|
|
32
|
+
let key;
|
|
33
|
+
if (ts.isIdentifier(property.name)) {
|
|
34
|
+
key = property.name.text;
|
|
35
|
+
} else if (ts.isStringLiteral(property.name)) {
|
|
36
|
+
key = property.name.text;
|
|
37
|
+
} else if (ts.isComputedPropertyName(property.name)) {
|
|
38
|
+
key = property.name.getText(sourceFile);
|
|
39
|
+
} else {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const value = property.initializer.getText(sourceFile);
|
|
43
|
+
result[key] = value;
|
|
44
|
+
} else if (ts.isShorthandPropertyAssignment(property)) {
|
|
45
|
+
const key = property.name.text;
|
|
46
|
+
result[key] = key;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
63
51
|
function findFirstChildByKind(node, kind) {
|
|
64
52
|
let element;
|
|
65
53
|
forEachChild(node, (child) => {
|
|
@@ -168,7 +156,7 @@ function getDescendantsByKinds(node, kinds) {
|
|
|
168
156
|
function getDescendantByName(node, name) {
|
|
169
157
|
return getDescendantsBy(
|
|
170
158
|
node,
|
|
171
|
-
(node2) =>
|
|
159
|
+
(node2) => getNameByIdentifier(node2) === name
|
|
172
160
|
);
|
|
173
161
|
}
|
|
174
162
|
function findFirstChildByKinds(node, kinds) {
|
|
@@ -318,8 +306,7 @@ function readSourceFiles(tsConfigPath) {
|
|
|
318
306
|
);
|
|
319
307
|
return { sourceFiles: getSolutionSourceFiles(program), program };
|
|
320
308
|
}
|
|
321
|
-
|
|
322
|
-
0 && (module.exports = {
|
|
309
|
+
export {
|
|
323
310
|
consoleAllChildren,
|
|
324
311
|
escapeValue,
|
|
325
312
|
findChildByIndex,
|
|
@@ -342,6 +329,7 @@ function readSourceFiles(tsConfigPath) {
|
|
|
342
329
|
getSolutionSourceFiles,
|
|
343
330
|
parseArrayLiteralExpression,
|
|
344
331
|
parseObjectLiteralExpression,
|
|
332
|
+
parseObjectLiteralString,
|
|
345
333
|
peelCallTarget,
|
|
346
334
|
readSourceFiles
|
|
347
|
-
}
|
|
335
|
+
};
|
package/cypher/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./lib/index.js";
|
|
@@ -1,25 +1,3 @@
|
|
|
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 condition_evaluator_exports = {};
|
|
19
|
-
__export(condition_evaluator_exports, {
|
|
20
|
-
ConditionEvaluator: () => ConditionEvaluator
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(condition_evaluator_exports);
|
|
23
1
|
class ConditionEvaluator {
|
|
24
2
|
// @TODO: apply where at match level
|
|
25
3
|
/**
|
|
@@ -152,7 +130,6 @@ class ConditionEvaluator {
|
|
|
152
130
|
}
|
|
153
131
|
}
|
|
154
132
|
}
|
|
155
|
-
|
|
156
|
-
0 && (module.exports = {
|
|
133
|
+
export {
|
|
157
134
|
ConditionEvaluator
|
|
158
|
-
}
|
|
135
|
+
};
|