@codeflow-map/core 0.1.0
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/README.md +158 -0
- package/dist/analyzer/extractorUtils.d.ts +50 -0
- package/dist/analyzer/extractorUtils.js +247 -0
- package/dist/analyzer/index.d.ts +9 -0
- package/dist/analyzer/index.js +149 -0
- package/dist/analyzer/languages/go.d.ts +2 -0
- package/dist/analyzer/languages/go.js +232 -0
- package/dist/analyzer/languages/javascript.d.ts +2 -0
- package/dist/analyzer/languages/javascript.js +265 -0
- package/dist/analyzer/languages/jsx.d.ts +2 -0
- package/dist/analyzer/languages/jsx.js +275 -0
- package/dist/analyzer/languages/python.d.ts +2 -0
- package/dist/analyzer/languages/python.js +236 -0
- package/dist/analyzer/languages/tsx.d.ts +2 -0
- package/dist/analyzer/languages/tsx.js +358 -0
- package/dist/analyzer/languages/typescript.d.ts +2 -0
- package/dist/analyzer/languages/typescript.js +351 -0
- package/dist/analyzer/treeSitter.d.ts +4 -0
- package/dist/analyzer/treeSitter.js +62 -0
- package/dist/graph/callGraphBuilder.d.ts +2 -0
- package/dist/graph/callGraphBuilder.js +58 -0
- package/dist/graph/entryPointDetector.d.ts +2 -0
- package/dist/graph/entryPointDetector.js +11 -0
- package/dist/graph/flowPartitioner.d.ts +5 -0
- package/dist/graph/flowPartitioner.js +101 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +22 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.js +13 -0
- package/package.json +48 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface Parameter {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string | null;
|
|
4
|
+
}
|
|
5
|
+
export type SupportedLanguage = 'typescript' | 'javascript' | 'tsx' | 'jsx' | 'python' | 'java' | 'go' | 'rust';
|
|
6
|
+
export declare const FILE_EXTENSION_MAP: Record<string, SupportedLanguage>;
|
|
7
|
+
export type NodeKind = 'function' | 'component' | 'hook' | 'method' | 'class' | 'iife';
|
|
8
|
+
export interface FunctionNode {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
startLine: number;
|
|
13
|
+
endLine: number;
|
|
14
|
+
params: Parameter[];
|
|
15
|
+
returnType: string | null;
|
|
16
|
+
isAsync: boolean;
|
|
17
|
+
isExported: boolean;
|
|
18
|
+
isEntryPoint: boolean;
|
|
19
|
+
language: SupportedLanguage;
|
|
20
|
+
kind?: NodeKind;
|
|
21
|
+
parentFunctionId?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface CallEdge {
|
|
24
|
+
from: string;
|
|
25
|
+
to: string;
|
|
26
|
+
line: number;
|
|
27
|
+
callType?: 'direct' | 'ref' | 'concurrent' | 'goroutine';
|
|
28
|
+
}
|
|
29
|
+
export interface Flow {
|
|
30
|
+
id: string;
|
|
31
|
+
entryPoint: string;
|
|
32
|
+
nodeIds: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface Graph {
|
|
35
|
+
nodes: FunctionNode[];
|
|
36
|
+
edges: CallEdge[];
|
|
37
|
+
flows: Flow[];
|
|
38
|
+
orphans: string[];
|
|
39
|
+
scannedFiles: number;
|
|
40
|
+
durationMs: number;
|
|
41
|
+
}
|
|
42
|
+
export interface RawCall {
|
|
43
|
+
callerFilePath: string;
|
|
44
|
+
calleeName: string;
|
|
45
|
+
line: number;
|
|
46
|
+
callType?: 'direct' | 'ref' | 'concurrent' | 'goroutine';
|
|
47
|
+
isRef?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface LanguageAnalyzer {
|
|
50
|
+
functionQuery: string;
|
|
51
|
+
callQuery: string;
|
|
52
|
+
extractFunction(match: any, filePath: string, languageId: SupportedLanguage): FunctionNode | null;
|
|
53
|
+
extractCall(match: any, filePath: string): RawCall | RawCall[] | null;
|
|
54
|
+
}
|
|
55
|
+
export type NodeDiffStatus = 'added' | 'removed' | 'changed' | 'unchanged';
|
|
56
|
+
export type EdgeDiffStatus = 'added' | 'removed' | 'unchanged';
|
|
57
|
+
export interface DiffGraph extends Graph {
|
|
58
|
+
nodeDiffStatus: Record<string, NodeDiffStatus>;
|
|
59
|
+
edgeDiffStatus: Record<string, EdgeDiffStatus>;
|
|
60
|
+
diffFiles: string[];
|
|
61
|
+
isDiffMode: true;
|
|
62
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FILE_EXTENSION_MAP = void 0;
|
|
4
|
+
exports.FILE_EXTENSION_MAP = {
|
|
5
|
+
'.ts': 'typescript',
|
|
6
|
+
'.tsx': 'tsx',
|
|
7
|
+
'.js': 'javascript',
|
|
8
|
+
'.jsx': 'jsx',
|
|
9
|
+
'.py': 'python',
|
|
10
|
+
'.java': 'java',
|
|
11
|
+
'.go': 'go',
|
|
12
|
+
'.rs': 'rust',
|
|
13
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codeflow-map/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Language-agnostic call-graph analysis engine powered by Tree-sitter. Parses TypeScript, JavaScript, TSX, JSX, Python, and Go source files into a structured call graph with flows.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"flowmap",
|
|
7
|
+
"call-graph",
|
|
8
|
+
"tree-sitter",
|
|
9
|
+
"static-analysis",
|
|
10
|
+
"code-analysis",
|
|
11
|
+
"typescript",
|
|
12
|
+
"javascript",
|
|
13
|
+
"python",
|
|
14
|
+
"go",
|
|
15
|
+
"ast"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "devricky-codes",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/devricky-codes/flowmap-vscode-extension.git",
|
|
22
|
+
"directory": "packages/core"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/devricky-codes/flowmap-vscode-extension#readme",
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist/",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18.0.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "../../node_modules/.bin/tsc",
|
|
39
|
+
"watch": "../../node_modules/.bin/tsc --watch"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"web-tree-sitter": "^0.24.4",
|
|
43
|
+
"minimatch": "^9.0.3"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^20.10.6"
|
|
47
|
+
}
|
|
48
|
+
}
|