@codeflow-map/core 0.1.2 → 0.1.3

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Language-agnostic call-graph engine powered by [Tree-sitter](https://tree-sitter.github.io/tree-sitter/). Feed it source files, get back a structured graph of every function, every call relationship, and every execution flow — deterministic, fully local, no LLM, no cloud.
4
4
 
5
- Used by the [CallSight VS Code extension](https://github.com/devricky-codes/callsight-vscode-extension) to render interactive call-flow diagrams for any codebase.
5
+ Used by the [CallSight VS Code extension](https://github.com/devricky-codes/callsight-vscode) to render interactive call-flow diagrams for any codebase.
6
6
 
7
7
  ---
8
8
 
@@ -58,13 +58,22 @@ const ANALYZERS = {
58
58
  go: go_1.goAnalyzer,
59
59
  rust: null
60
60
  };
61
+ // Reuse a single Parser instance across all parseFile / parseFileContent calls
62
+ // to avoid exhausting OS file-handle limits (EMFILE) when scanning large codebases.
63
+ let sharedParser = null;
64
+ function getSharedParser() {
65
+ if (!sharedParser) {
66
+ sharedParser = new web_tree_sitter_1.default();
67
+ }
68
+ return sharedParser;
69
+ }
61
70
  async function parseFile(filePath, absolutePath, wasmDirectory, languageId) {
62
71
  const analyzer = ANALYZERS[languageId];
63
72
  if (!analyzer)
64
73
  return { functions: [], calls: [] };
65
74
  const content = await fs.readFile(absolutePath, 'utf8');
66
75
  const treeSitterLang = await (0, treeSitter_1.loadLanguage)(languageId, wasmDirectory);
67
- const parser = new web_tree_sitter_1.default();
76
+ const parser = getSharedParser();
68
77
  parser.setLanguage(treeSitterLang);
69
78
  const tree = parser.parse(content);
70
79
  let functionQuery = null;
@@ -99,8 +108,7 @@ async function parseFile(filePath, absolutePath, wasmDirectory, languageId) {
99
108
  callQuery.delete();
100
109
  if (tree)
101
110
  tree.delete();
102
- if (parser)
103
- parser.delete();
111
+ // Parser is shared — do NOT delete it here
104
112
  }
105
113
  }
106
114
  async function parseFileContent(filePath, content, wasmDirectory, languageId) {
@@ -108,7 +116,7 @@ async function parseFileContent(filePath, content, wasmDirectory, languageId) {
108
116
  if (!analyzer)
109
117
  return { functions: [], calls: [] };
110
118
  const treeSitterLang = await (0, treeSitter_1.loadLanguage)(languageId, wasmDirectory);
111
- const parser = new web_tree_sitter_1.default();
119
+ const parser = getSharedParser();
112
120
  parser.setLanguage(treeSitterLang);
113
121
  const tree = parser.parse(content);
114
122
  let functionQuery = null;
@@ -143,7 +151,6 @@ async function parseFileContent(filePath, content, wasmDirectory, languageId) {
143
151
  callQuery.delete();
144
152
  if (tree)
145
153
  tree.delete();
146
- if (parser)
147
- parser.delete();
154
+ // Parser is shared — do NOT delete it here
148
155
  }
149
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeflow-map/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
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
5
  "keywords": [
6
6
  "callsight",
@@ -18,10 +18,10 @@
18
18
  "author": "devricky-codes",
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "https://github.com/devricky-codes/callsight-vscode-extension.git",
21
+ "url": "https://github.com/devricky-codes/callsight-vscode.git",
22
22
  "directory": "packages/core"
23
23
  },
24
- "homepage": "https://github.com/devricky-codes/callsight-vscode-extension#readme",
24
+ "homepage": "https://github.com/devricky-codes/callsight-vscode#readme",
25
25
  "main": "dist/index.js",
26
26
  "types": "dist/index.d.ts",
27
27
  "files": [