@mgamil/mapx 0.2.4
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/LICENSE +194 -0
- package/README.md +488 -0
- package/VERSION +1 -0
- package/dist/agents/generator.d.ts +74 -0
- package/dist/agents/generator.js +375 -0
- package/dist/agents/templates.d.ts +29 -0
- package/dist/agents/templates.js +459 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.js +1835 -0
- package/dist/core/cluster-engine.d.ts +32 -0
- package/dist/core/cluster-engine.js +314 -0
- package/dist/core/config.d.ts +29 -0
- package/dist/core/config.js +178 -0
- package/dist/core/context-builder.d.ts +61 -0
- package/dist/core/context-builder.js +252 -0
- package/dist/core/flow-tracer.d.ts +63 -0
- package/dist/core/flow-tracer.js +366 -0
- package/dist/core/git-tracker.d.ts +20 -0
- package/dist/core/git-tracker.js +159 -0
- package/dist/core/graph.d.ts +42 -0
- package/dist/core/graph.js +186 -0
- package/dist/core/metrics.d.ts +24 -0
- package/dist/core/metrics.js +87 -0
- package/dist/core/scanner.d.ts +53 -0
- package/dist/core/scanner.js +949 -0
- package/dist/core/store-bun.d.ts +13 -0
- package/dist/core/store-bun.js +34 -0
- package/dist/core/store-interface.d.ts +15 -0
- package/dist/core/store-interface.js +7 -0
- package/dist/core/store-node.d.ts +13 -0
- package/dist/core/store-node.js +35 -0
- package/dist/core/store.d.ts +132 -0
- package/dist/core/store.js +614 -0
- package/dist/core/workspace-manager.d.ts +9 -0
- package/dist/core/workspace-manager.js +64 -0
- package/dist/exporters/dot-exporter.d.ts +16 -0
- package/dist/exporters/dot-exporter.js +179 -0
- package/dist/exporters/graph-exporter.d.ts +14 -0
- package/dist/exporters/graph-exporter.js +85 -0
- package/dist/exporters/index.d.ts +9 -0
- package/dist/exporters/index.js +12 -0
- package/dist/exporters/llm-exporter.d.ts +18 -0
- package/dist/exporters/llm-exporter.js +224 -0
- package/dist/exporters/svg-exporter.d.ts +19 -0
- package/dist/exporters/svg-exporter.js +319 -0
- package/dist/exporters/toon-exporter.d.ts +16 -0
- package/dist/exporters/toon-exporter.js +246 -0
- package/dist/frameworks/detectors/aspnet.d.ts +11 -0
- package/dist/frameworks/detectors/aspnet.js +52 -0
- package/dist/frameworks/detectors/django.d.ts +14 -0
- package/dist/frameworks/detectors/django.js +135 -0
- package/dist/frameworks/detectors/drupal.d.ts +13 -0
- package/dist/frameworks/detectors/drupal.js +94 -0
- package/dist/frameworks/detectors/express.d.ts +12 -0
- package/dist/frameworks/detectors/express.js +234 -0
- package/dist/frameworks/detectors/fastapi.d.ts +12 -0
- package/dist/frameworks/detectors/fastapi.js +203 -0
- package/dist/frameworks/detectors/flask.d.ts +12 -0
- package/dist/frameworks/detectors/flask.js +244 -0
- package/dist/frameworks/detectors/go.d.ts +11 -0
- package/dist/frameworks/detectors/go.js +75 -0
- package/dist/frameworks/detectors/laravel.d.ts +11 -0
- package/dist/frameworks/detectors/laravel.js +462 -0
- package/dist/frameworks/detectors/nestjs.d.ts +12 -0
- package/dist/frameworks/detectors/nestjs.js +155 -0
- package/dist/frameworks/detectors/nextjs.d.ts +11 -0
- package/dist/frameworks/detectors/nextjs.js +118 -0
- package/dist/frameworks/detectors/rails.d.ts +12 -0
- package/dist/frameworks/detectors/rails.js +76 -0
- package/dist/frameworks/detectors/react-router.d.ts +11 -0
- package/dist/frameworks/detectors/react-router.js +115 -0
- package/dist/frameworks/detectors/rust.d.ts +11 -0
- package/dist/frameworks/detectors/rust.js +59 -0
- package/dist/frameworks/detectors/spring.d.ts +11 -0
- package/dist/frameworks/detectors/spring.js +56 -0
- package/dist/frameworks/detectors/sveltekit.d.ts +11 -0
- package/dist/frameworks/detectors/sveltekit.js +154 -0
- package/dist/frameworks/detectors/symfony.d.ts +13 -0
- package/dist/frameworks/detectors/symfony.js +175 -0
- package/dist/frameworks/detectors/tanstack-router.d.ts +12 -0
- package/dist/frameworks/detectors/tanstack-router.js +80 -0
- package/dist/frameworks/detectors/vapor.d.ts +11 -0
- package/dist/frameworks/detectors/vapor.js +52 -0
- package/dist/frameworks/detectors/vue-router.d.ts +12 -0
- package/dist/frameworks/detectors/vue-router.js +237 -0
- package/dist/frameworks/detectors/wordpress.d.ts +13 -0
- package/dist/frameworks/detectors/wordpress.js +141 -0
- package/dist/frameworks/detectors/yii.d.ts +11 -0
- package/dist/frameworks/detectors/yii.js +131 -0
- package/dist/frameworks/framework-registry.d.ts +13 -0
- package/dist/frameworks/framework-registry.js +77 -0
- package/dist/frameworks/route-registry.d.ts +26 -0
- package/dist/frameworks/route-registry.js +102 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +30 -0
- package/dist/languages/index.d.ts +2 -0
- package/dist/languages/index.js +7 -0
- package/dist/languages/installer.d.ts +13 -0
- package/dist/languages/installer.js +103 -0
- package/dist/languages/registry.d.ts +19 -0
- package/dist/languages/registry.js +427 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +20 -0
- package/dist/mcp.d.ts +11 -0
- package/dist/mcp.js +1699 -0
- package/dist/parsers/common-methods.d.ts +3 -0
- package/dist/parsers/common-methods.js +33 -0
- package/dist/parsers/fallback-parser.d.ts +10 -0
- package/dist/parsers/fallback-parser.js +18 -0
- package/dist/parsers/generic-wasm-parser.d.ts +23 -0
- package/dist/parsers/generic-wasm-parser.js +168 -0
- package/dist/parsers/ignored-symbols.d.ts +26 -0
- package/dist/parsers/ignored-symbols.js +77 -0
- package/dist/parsers/index.d.ts +9 -0
- package/dist/parsers/index.js +13 -0
- package/dist/parsers/languages/javascript.d.ts +11 -0
- package/dist/parsers/languages/javascript.js +28 -0
- package/dist/parsers/languages/php.d.ts +15 -0
- package/dist/parsers/languages/php.js +648 -0
- package/dist/parsers/languages/typescript.d.ts +10 -0
- package/dist/parsers/languages/typescript.js +9 -0
- package/dist/parsers/languages/vue.d.ts +13 -0
- package/dist/parsers/languages/vue.js +63 -0
- package/dist/parsers/parse-worker.d.ts +2 -0
- package/dist/parsers/parse-worker.js +185 -0
- package/dist/parsers/parser-interface.d.ts +9 -0
- package/dist/parsers/parser-interface.js +0 -0
- package/dist/parsers/parser-registry.d.ts +8 -0
- package/dist/parsers/parser-registry.js +52 -0
- package/dist/parsers/wasm-parser.d.ts +16 -0
- package/dist/parsers/wasm-parser.js +110 -0
- package/dist/types.d.ts +172 -0
- package/dist/types.js +0 -0
- package/dist/ui/index.html +270 -0
- package/dist/ui/main.js +581 -0
- package/dist/ui/main.js.map +7 -0
- package/dist/ui/styles.css +573 -0
- package/dist/ui-events.d.ts +36 -0
- package/dist/ui-events.js +61 -0
- package/dist/ui-server.d.ts +12 -0
- package/dist/ui-server.js +504 -0
- package/package.json +179 -0
- package/queries/bash/references.scm +22 -0
- package/queries/bash/symbols.scm +15 -0
- package/queries/c/references.scm +14 -0
- package/queries/c/symbols.scm +30 -0
- package/queries/c-sharp/references.scm +26 -0
- package/queries/c-sharp/symbols.scm +57 -0
- package/queries/cpp/references.scm +21 -0
- package/queries/cpp/symbols.scm +44 -0
- package/queries/dart/references.scm +33 -0
- package/queries/dart/symbols.scm +38 -0
- package/queries/elixir/references.scm +45 -0
- package/queries/elixir/symbols.scm +41 -0
- package/queries/go/references.scm +22 -0
- package/queries/go/symbols.scm +53 -0
- package/queries/java/references.scm +32 -0
- package/queries/java/symbols.scm +41 -0
- package/queries/javascript/references.scm +14 -0
- package/queries/javascript/symbols.scm +23 -0
- package/queries/kotlin/references.scm +31 -0
- package/queries/kotlin/symbols.scm +24 -0
- package/queries/lua/references.scm +19 -0
- package/queries/lua/symbols.scm +29 -0
- package/queries/pascal/references.scm +29 -0
- package/queries/pascal/symbols.scm +45 -0
- package/queries/php/references.scm +109 -0
- package/queries/php/symbols.scm +33 -0
- package/queries/python/references.scm +50 -0
- package/queries/python/symbols.scm +21 -0
- package/queries/ruby/references.scm +48 -0
- package/queries/ruby/symbols.scm +24 -0
- package/queries/rust/references.scm +31 -0
- package/queries/rust/symbols.scm +35 -0
- package/queries/scala/references.scm +30 -0
- package/queries/scala/symbols.scm +35 -0
- package/queries/svelte/references.scm +20 -0
- package/queries/svelte/symbols.scm +30 -0
- package/queries/swift/references.scm +22 -0
- package/queries/swift/symbols.scm +37 -0
- package/queries/typescript/references.scm +25 -0
- package/queries/typescript/symbols.scm +35 -0
- package/queries/vue/references.scm +20 -0
- package/queries/vue/symbols.scm +28 -0
- package/queries/zig/references.scm +20 -0
- package/queries/zig/symbols.scm +22 -0
- package/wasm/tree-sitter-c.wasm +0 -0
- package/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/wasm/tree-sitter-cpp.wasm +0 -0
- package/wasm/tree-sitter-dart.wasm +0 -0
- package/wasm/tree-sitter-go.wasm +0 -0
- package/wasm/tree-sitter-java.wasm +0 -0
- package/wasm/tree-sitter-javascript.wasm +0 -0
- package/wasm/tree-sitter-kotlin.wasm +0 -0
- package/wasm/tree-sitter-php.wasm +0 -0
- package/wasm/tree-sitter-python.wasm +0 -0
- package/wasm/tree-sitter-ruby.wasm +0 -0
- package/wasm/tree-sitter-rust.wasm +0 -0
- package/wasm/tree-sitter-scala.wasm +0 -0
- package/wasm/tree-sitter-swift.wasm +0 -0
- package/wasm/tree-sitter-tsx.wasm +0 -0
- package/wasm/tree-sitter-typescript.wasm +0 -0
- package/wasm/tree-sitter-vue.wasm +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const COMMON_FRAMEWORK_METHODS = /* @__PURE__ */ new Set([
|
|
2
|
+
// Laravel / PHP
|
|
3
|
+
"save",
|
|
4
|
+
"delete",
|
|
5
|
+
"find",
|
|
6
|
+
"findOrFail",
|
|
7
|
+
"create",
|
|
8
|
+
"update",
|
|
9
|
+
"get",
|
|
10
|
+
"all",
|
|
11
|
+
"toArray",
|
|
12
|
+
"toJson",
|
|
13
|
+
"rules",
|
|
14
|
+
"handle",
|
|
15
|
+
"boot",
|
|
16
|
+
"register",
|
|
17
|
+
// JavaScript / Node
|
|
18
|
+
"on",
|
|
19
|
+
"off",
|
|
20
|
+
"emit",
|
|
21
|
+
"once",
|
|
22
|
+
"then",
|
|
23
|
+
"catch",
|
|
24
|
+
"finally",
|
|
25
|
+
"toString",
|
|
26
|
+
"valueOf",
|
|
27
|
+
"call",
|
|
28
|
+
"apply",
|
|
29
|
+
"bind"
|
|
30
|
+
]);
|
|
31
|
+
export {
|
|
32
|
+
COMMON_FRAMEWORK_METHODS
|
|
33
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LanguageParser } from './parser-interface.js';
|
|
2
|
+
import { ParseResult } from '../types.js';
|
|
3
|
+
|
|
4
|
+
declare class FallbackParser implements LanguageParser {
|
|
5
|
+
readonly languageName = "fallback";
|
|
6
|
+
get supportedExtensions(): string[];
|
|
7
|
+
parse(filePath: string, source: string): Promise<ParseResult>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { FallbackParser };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class FallbackParser {
|
|
2
|
+
languageName = "fallback";
|
|
3
|
+
get supportedExtensions() {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
6
|
+
async parse(filePath, source) {
|
|
7
|
+
const lines = source.split("\n");
|
|
8
|
+
const ext = "." + filePath.split(".").pop()?.toLowerCase();
|
|
9
|
+
return {
|
|
10
|
+
symbols: [],
|
|
11
|
+
references: [],
|
|
12
|
+
errors: []
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
FallbackParser
|
|
18
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LanguageParser } from './parser-interface.js';
|
|
2
|
+
import { ParseResult, SymbolKind, ExtractedReference } from '../types.js';
|
|
3
|
+
import { LanguageDefinition } from '../languages/registry.js';
|
|
4
|
+
|
|
5
|
+
declare class GenericWasmParser implements LanguageParser {
|
|
6
|
+
readonly languageName: string;
|
|
7
|
+
readonly supportedExtensions: string[];
|
|
8
|
+
protected langDef: LanguageDefinition;
|
|
9
|
+
protected language: any;
|
|
10
|
+
protected symbolsQuery: string | null;
|
|
11
|
+
protected referencesQuery: string | null;
|
|
12
|
+
protected loadingPromise: Promise<void> | null;
|
|
13
|
+
constructor(langDef: LanguageDefinition);
|
|
14
|
+
protected ensureLoaded(): Promise<void>;
|
|
15
|
+
parse(filePath: string, source: string, options?: any): Promise<ParseResult>;
|
|
16
|
+
protected isContainerKind(kind: SymbolKind): boolean;
|
|
17
|
+
protected isMemberKind(kind: SymbolKind): boolean;
|
|
18
|
+
protected extractSignature(source: string, node: any, name: string, kind: string, startLine: number): string;
|
|
19
|
+
protected cleanTarget(name: string, refType: string): string;
|
|
20
|
+
protected mapRefType(refType: string): ExtractedReference['referenceType'];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { GenericWasmParser };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { loadLanguage, loadQueryFile, parseWithQueries } from "./wasm-parser.js";
|
|
2
|
+
import { COMMON_FRAMEWORK_METHODS } from "./common-methods.js";
|
|
3
|
+
class GenericWasmParser {
|
|
4
|
+
languageName;
|
|
5
|
+
supportedExtensions;
|
|
6
|
+
langDef;
|
|
7
|
+
language = null;
|
|
8
|
+
symbolsQuery = null;
|
|
9
|
+
referencesQuery = null;
|
|
10
|
+
loadingPromise = null;
|
|
11
|
+
constructor(langDef) {
|
|
12
|
+
this.langDef = langDef;
|
|
13
|
+
this.languageName = langDef.name;
|
|
14
|
+
this.supportedExtensions = langDef.extensions;
|
|
15
|
+
}
|
|
16
|
+
ensureLoaded() {
|
|
17
|
+
if (!this.loadingPromise) {
|
|
18
|
+
this.loadingPromise = (async () => {
|
|
19
|
+
this.language = await loadLanguage(this.langDef);
|
|
20
|
+
this.symbolsQuery = await loadQueryFile(this.langDef.queries.symbols);
|
|
21
|
+
this.referencesQuery = await loadQueryFile(this.langDef.queries.references);
|
|
22
|
+
})();
|
|
23
|
+
}
|
|
24
|
+
return this.loadingPromise;
|
|
25
|
+
}
|
|
26
|
+
async parse(filePath, source, options) {
|
|
27
|
+
await this.ensureLoaded();
|
|
28
|
+
const errors = [];
|
|
29
|
+
const symbols = [];
|
|
30
|
+
const references = [];
|
|
31
|
+
try {
|
|
32
|
+
const { symbols: symCaptures, references: refCaptures, nameByNodeId, scopeByNodeId } = await parseWithQueries(
|
|
33
|
+
source,
|
|
34
|
+
this.language,
|
|
35
|
+
this.symbolsQuery,
|
|
36
|
+
this.referencesQuery
|
|
37
|
+
);
|
|
38
|
+
let currentScope = null;
|
|
39
|
+
for (const [captureName, captures] of symCaptures) {
|
|
40
|
+
if (captureName.startsWith("symbol.kind_")) {
|
|
41
|
+
const baseKind = captureName.replace("symbol.kind_", "");
|
|
42
|
+
for (const capture of captures) {
|
|
43
|
+
let kind = baseKind;
|
|
44
|
+
const name = nameByNodeId.get(capture.node.id) || capture.node.text;
|
|
45
|
+
const startLine = capture.node.startPosition.row + 1;
|
|
46
|
+
const endLine = capture.node.endPosition.row + 1;
|
|
47
|
+
if (this.isContainerKind(kind)) {
|
|
48
|
+
currentScope = name;
|
|
49
|
+
}
|
|
50
|
+
let extractedScope = null;
|
|
51
|
+
if (kind === "function") {
|
|
52
|
+
let curr = capture.node.parent;
|
|
53
|
+
while (curr) {
|
|
54
|
+
if (curr.type === "class_definition" || curr.type === "class_declaration" || curr.type === "struct_specifier" || curr.type === "impl_item" || curr.type === "interface_declaration") {
|
|
55
|
+
kind = "method";
|
|
56
|
+
if (curr.type === "impl_item") {
|
|
57
|
+
const typeChild = curr.childForFieldName ? curr.childForFieldName("type") : null;
|
|
58
|
+
if (typeChild) {
|
|
59
|
+
extractedScope = typeChild.text;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
curr = curr.parent;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const signature = this.extractSignature(source, capture.node, name, kind, startLine);
|
|
68
|
+
const explicitScope = scopeByNodeId.get(capture.node.id) || extractedScope;
|
|
69
|
+
const resolvedScope = explicitScope || (this.isMemberKind(kind) ? currentScope : null);
|
|
70
|
+
if (options?.ignoredSymbols?.has(name)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
symbols.push({
|
|
74
|
+
name,
|
|
75
|
+
kind,
|
|
76
|
+
scope: resolvedScope,
|
|
77
|
+
signature,
|
|
78
|
+
startLine,
|
|
79
|
+
endLine,
|
|
80
|
+
metadata: {}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
for (const [captureName, captures] of refCaptures) {
|
|
86
|
+
if (captureName.startsWith("ref.target_")) {
|
|
87
|
+
const refType = captureName.replace("ref.target_", "");
|
|
88
|
+
for (const capture of captures) {
|
|
89
|
+
const targetText = capture.node.text;
|
|
90
|
+
if (!targetText || typeof targetText !== "string") continue;
|
|
91
|
+
const targetName = this.cleanTarget(targetText, refType);
|
|
92
|
+
if (!targetName || typeof targetName !== "string") continue;
|
|
93
|
+
const startLine = capture.node.startPosition.row + 1;
|
|
94
|
+
const referenceType = this.mapRefType(refType);
|
|
95
|
+
let verifiability = "verified";
|
|
96
|
+
if (referenceType === "call" && COMMON_FRAMEWORK_METHODS.has(targetName)) {
|
|
97
|
+
verifiability = "inferred";
|
|
98
|
+
}
|
|
99
|
+
if (options?.ignoredSymbols?.has(targetName)) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
references.push({
|
|
103
|
+
sourceSymbol: null,
|
|
104
|
+
targetName,
|
|
105
|
+
referenceType,
|
|
106
|
+
startLine,
|
|
107
|
+
verifiability
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
} catch (e) {
|
|
113
|
+
errors.push({ message: e.message, line: 0 });
|
|
114
|
+
}
|
|
115
|
+
return { symbols, references, errors };
|
|
116
|
+
}
|
|
117
|
+
isContainerKind(kind) {
|
|
118
|
+
return kind === "class" || kind === "interface" || kind === "trait" || kind === "enum" || kind === "struct" || kind === "module";
|
|
119
|
+
}
|
|
120
|
+
isMemberKind(kind) {
|
|
121
|
+
return kind === "method" || kind === "property" || kind === "constant" || kind === "field";
|
|
122
|
+
}
|
|
123
|
+
extractSignature(source, node, name, kind, startLine) {
|
|
124
|
+
const lines = source.split("\n");
|
|
125
|
+
const lineIdx = startLine - 1;
|
|
126
|
+
if (lineIdx >= lines.length) return name;
|
|
127
|
+
const line = lines[lineIdx].trim();
|
|
128
|
+
if (kind === "function") {
|
|
129
|
+
const match = line.match(/(?:export\s+)?(?:async\s+)?function\s+\w+[^{]*/);
|
|
130
|
+
if (match) return match[0].trim();
|
|
131
|
+
}
|
|
132
|
+
if (kind === "method") {
|
|
133
|
+
const match = line.match(/(?:abstract\s+)?(?:private|protected|public)?\s*(?:async\s+)?(?:get\s+|set\s+)?\w+\s*\([^)]*\)(\s*:\s*[^{;]+)?/);
|
|
134
|
+
if (match) return match[0].trim();
|
|
135
|
+
}
|
|
136
|
+
if (kind === "class") {
|
|
137
|
+
const match = line.match(/(?:export\s+)?(?:abstract\s+)?class\s+\w+[^{]*/);
|
|
138
|
+
if (match) return match[0].trim();
|
|
139
|
+
}
|
|
140
|
+
if (kind === "interface") {
|
|
141
|
+
const match = line.match(/(?:export\s+)?interface\s+\w+[^{]*/);
|
|
142
|
+
if (match) return match[0].trim();
|
|
143
|
+
}
|
|
144
|
+
if (kind === "enum") {
|
|
145
|
+
const match = line.match(/(?:export\s+)?enum\s+\w+/);
|
|
146
|
+
if (match) return match[0].trim();
|
|
147
|
+
}
|
|
148
|
+
return name;
|
|
149
|
+
}
|
|
150
|
+
cleanTarget(name, refType) {
|
|
151
|
+
if (refType === "import" || refType === "require") return name.replace(/^['"]|['"]$/g, "");
|
|
152
|
+
return name;
|
|
153
|
+
}
|
|
154
|
+
mapRefType(refType) {
|
|
155
|
+
const map = {
|
|
156
|
+
import: "import",
|
|
157
|
+
require: "require",
|
|
158
|
+
extends: "extends",
|
|
159
|
+
implements: "implements",
|
|
160
|
+
call: "call",
|
|
161
|
+
instantiation: "instantiation"
|
|
162
|
+
};
|
|
163
|
+
return map[refType] || "call";
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export {
|
|
167
|
+
GenericWasmParser
|
|
168
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-specific symbol ignore lists.
|
|
3
|
+
*
|
|
4
|
+
* Each key is a framework name (matching FrameworkDetector.name) or a language
|
|
5
|
+
* name (matching LanguageDefinition.name). When a framework or language is
|
|
6
|
+
* active for the project being scanned, parsers can look up the corresponding
|
|
7
|
+
* set and skip those symbols/references to keep the code graph clean.
|
|
8
|
+
*
|
|
9
|
+
* To add support for a new framework or language:
|
|
10
|
+
* 1. Add a new entry to IGNORED_SYMBOLS_BY_FRAMEWORK below.
|
|
11
|
+
* 2. The key should match the detector's `name` field or the language name.
|
|
12
|
+
* 3. The scanner will automatically pick it up — no parser changes needed.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Build a merged ignore set from a list of active framework/language names.
|
|
16
|
+
*
|
|
17
|
+
* This is called once per scan pass and the result is forwarded through
|
|
18
|
+
* parse options so each parser invocation does not need to re-compute it.
|
|
19
|
+
*/
|
|
20
|
+
declare function buildIgnoredSymbols(activeFrameworks: string[]): Set<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Get the registry so callers can inspect or extend it at runtime.
|
|
23
|
+
*/
|
|
24
|
+
declare function getIgnoredSymbolsRegistry(): Record<string, Set<string>>;
|
|
25
|
+
|
|
26
|
+
export { buildIgnoredSymbols, getIgnoredSymbolsRegistry };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const IGNORED_SYMBOLS_BY_FRAMEWORK = {
|
|
2
|
+
// Vue ecosystem — detected via VueRouterDetector (name: 'vue-router')
|
|
3
|
+
"vue-router": /* @__PURE__ */ new Set([
|
|
4
|
+
// Vue Core & Composition API
|
|
5
|
+
"ref",
|
|
6
|
+
"computed",
|
|
7
|
+
"reactive",
|
|
8
|
+
"watch",
|
|
9
|
+
"watchEffect",
|
|
10
|
+
"defineComponent",
|
|
11
|
+
"setup",
|
|
12
|
+
"onMounted",
|
|
13
|
+
"onUnmounted",
|
|
14
|
+
"onBeforeMount",
|
|
15
|
+
"onBeforeUnmount",
|
|
16
|
+
"onUpdated",
|
|
17
|
+
"onBeforeUpdate",
|
|
18
|
+
"provide",
|
|
19
|
+
"inject",
|
|
20
|
+
"nextTick",
|
|
21
|
+
"defineProps",
|
|
22
|
+
"defineEmits",
|
|
23
|
+
"defineExpose",
|
|
24
|
+
"defineModel",
|
|
25
|
+
"defineOptions",
|
|
26
|
+
"withDefaults",
|
|
27
|
+
"toRef",
|
|
28
|
+
"toRefs",
|
|
29
|
+
"unref",
|
|
30
|
+
"isRef",
|
|
31
|
+
"isReactive",
|
|
32
|
+
"isProxy",
|
|
33
|
+
"shallowRef",
|
|
34
|
+
"shallowReactive",
|
|
35
|
+
"readonly",
|
|
36
|
+
"markRaw",
|
|
37
|
+
// Vue Router
|
|
38
|
+
"useRoute",
|
|
39
|
+
"useRouter",
|
|
40
|
+
"createRouter",
|
|
41
|
+
"createWebHistory",
|
|
42
|
+
// Pinia
|
|
43
|
+
"useStore",
|
|
44
|
+
"defineStore",
|
|
45
|
+
"storeToRefs",
|
|
46
|
+
// Vue I18n
|
|
47
|
+
"useI18n",
|
|
48
|
+
"t",
|
|
49
|
+
"te",
|
|
50
|
+
"tm",
|
|
51
|
+
"rt",
|
|
52
|
+
"d",
|
|
53
|
+
"n",
|
|
54
|
+
// Nuxt / VueUse
|
|
55
|
+
"useHead",
|
|
56
|
+
"useMeta",
|
|
57
|
+
"useFetch",
|
|
58
|
+
"useAsyncData"
|
|
59
|
+
])
|
|
60
|
+
};
|
|
61
|
+
function buildIgnoredSymbols(activeFrameworks) {
|
|
62
|
+
const merged = /* @__PURE__ */ new Set();
|
|
63
|
+
for (const name of activeFrameworks) {
|
|
64
|
+
const symbols = IGNORED_SYMBOLS_BY_FRAMEWORK[name];
|
|
65
|
+
if (symbols) {
|
|
66
|
+
for (const s of symbols) merged.add(s);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return merged;
|
|
70
|
+
}
|
|
71
|
+
function getIgnoredSymbolsRegistry() {
|
|
72
|
+
return IGNORED_SYMBOLS_BY_FRAMEWORK;
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
buildIgnoredSymbols,
|
|
76
|
+
getIgnoredSymbolsRegistry
|
|
77
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { LanguageParser } from './parser-interface.js';
|
|
2
|
+
export { clearParserCache, getParserForFile } from './parser-registry.js';
|
|
3
|
+
export { PhpParser } from './languages/php.js';
|
|
4
|
+
export { JavaScriptParser } from './languages/javascript.js';
|
|
5
|
+
export { TypeScriptParser } from './languages/typescript.js';
|
|
6
|
+
export { COMMON_FRAMEWORK_METHODS } from './common-methods.js';
|
|
7
|
+
import '../types.js';
|
|
8
|
+
import '../languages/registry.js';
|
|
9
|
+
import './generic-wasm-parser.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getParserForFile, clearParserCache } from "./parser-registry.js";
|
|
2
|
+
import { PhpParser } from "./languages/php.js";
|
|
3
|
+
import { JavaScriptParser } from "./languages/javascript.js";
|
|
4
|
+
import { TypeScriptParser } from "./languages/typescript.js";
|
|
5
|
+
import { COMMON_FRAMEWORK_METHODS } from "./common-methods.js";
|
|
6
|
+
export {
|
|
7
|
+
COMMON_FRAMEWORK_METHODS,
|
|
8
|
+
JavaScriptParser,
|
|
9
|
+
PhpParser,
|
|
10
|
+
TypeScriptParser,
|
|
11
|
+
clearParserCache,
|
|
12
|
+
getParserForFile
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GenericWasmParser } from '../generic-wasm-parser.js';
|
|
2
|
+
import { LanguageDefinition } from '../../languages/registry.js';
|
|
3
|
+
import '../parser-interface.js';
|
|
4
|
+
import '../../types.js';
|
|
5
|
+
|
|
6
|
+
declare class JavaScriptParser extends GenericWasmParser {
|
|
7
|
+
constructor(langDef: LanguageDefinition);
|
|
8
|
+
protected extractSignature(source: string, node: any, name: string, kind: string, startLine: number): string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { JavaScriptParser };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GenericWasmParser } from "../generic-wasm-parser.js";
|
|
2
|
+
class JavaScriptParser extends GenericWasmParser {
|
|
3
|
+
constructor(langDef) {
|
|
4
|
+
super(langDef);
|
|
5
|
+
}
|
|
6
|
+
extractSignature(source, node, name, kind, startLine) {
|
|
7
|
+
const lines = source.split("\n");
|
|
8
|
+
const lineIdx = startLine - 1;
|
|
9
|
+
if (lineIdx >= lines.length) return name;
|
|
10
|
+
const line = lines[lineIdx].trim();
|
|
11
|
+
if (kind === "function") {
|
|
12
|
+
const match = line.match(/(function\s+\w+|const\s+\w+\s*=\s*(?:async\s+)?\([^)]*\)\s*=>)/);
|
|
13
|
+
if (match) return match[0];
|
|
14
|
+
}
|
|
15
|
+
if (kind === "method") {
|
|
16
|
+
const match = line.match(/(?:async\s+)?(?:get\s+|set\s+)?\w+\s*\([^)]*\)/);
|
|
17
|
+
if (match) return match[0];
|
|
18
|
+
}
|
|
19
|
+
if (kind === "class") {
|
|
20
|
+
const match = line.match(/class\s+\w+(\s+extends\s+\w+)?(\s+implements\s+\w+)?/);
|
|
21
|
+
if (match) return match[0];
|
|
22
|
+
}
|
|
23
|
+
return name;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
JavaScriptParser
|
|
28
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ParseResult, ExtractedReference } from '../../types.js';
|
|
2
|
+
import { LanguageDefinition } from '../../languages/registry.js';
|
|
3
|
+
import { GenericWasmParser } from '../generic-wasm-parser.js';
|
|
4
|
+
import '../parser-interface.js';
|
|
5
|
+
|
|
6
|
+
declare const LARAVEL_FACADE_MAP: Record<string, string>;
|
|
7
|
+
declare class PhpParser extends GenericWasmParser {
|
|
8
|
+
constructor(langDef: LanguageDefinition);
|
|
9
|
+
parse(filePath: string, source: string, options?: any): Promise<ParseResult>;
|
|
10
|
+
protected extractSignature(source: string, node: any, name: string, kind: string, startLine: number): string;
|
|
11
|
+
private cleanTargetName;
|
|
12
|
+
protected mapRefType(refType: string): ExtractedReference['referenceType'];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { LARAVEL_FACADE_MAP, PhpParser };
|