fix: remove tree-sitter-go to resolve peer dependency conflict

- tree-sitter-go@0.23.4 peer depends on tree-sitter@^0.21.1
- Conflicts with tree-sitter@0.22.4 used by tree-sitter-python
- Go AST already falls back to generic export/deps extraction
- Add .npmrc with legacy-peer-deps=true as safety net
- npm install --omit=dev now works cleanly
This commit is contained in:
2026-06-10 16:04:33 +02:00
parent dbde651a2a
commit 6f13c66dae
4 changed files with 28 additions and 32 deletions
+1
View File
@@ -0,0 +1 @@
legacy-peer-deps=true
-20
View File
@@ -14,7 +14,6 @@
"p-limit": "^7.3.0", "p-limit": "^7.3.0",
"picocolors": "^1.1.1", "picocolors": "^1.1.1",
"tree-sitter": "^0.22.4", "tree-sitter": "^0.22.4",
"tree-sitter-go": "^0.23.4",
"tree-sitter-python": "^0.23.6", "tree-sitter-python": "^0.23.6",
"tree-sitter-typescript": "^0.23.2" "tree-sitter-typescript": "^0.23.2"
}, },
@@ -3355,25 +3354,6 @@
"node-gyp-build": "^4.8.4" "node-gyp-build": "^4.8.4"
} }
}, },
"node_modules/tree-sitter-go": {
"version": "0.23.4",
"resolved": "https://registry.npmjs.org/tree-sitter-go/-/tree-sitter-go-0.23.4.tgz",
"integrity": "sha512-iQaHEs4yMa/hMo/ZCGqLfG61F0miinULU1fFh+GZreCRtKylFLtvn798ocCZjO2r/ungNZgAY1s1hPFyAwkc7w==",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"node-addon-api": "^8.2.1",
"node-gyp-build": "^4.8.2"
},
"peerDependencies": {
"tree-sitter": "^0.21.1"
},
"peerDependenciesMeta": {
"tree-sitter": {
"optional": true
}
}
},
"node_modules/tree-sitter-javascript": { "node_modules/tree-sitter-javascript": {
"version": "0.23.1", "version": "0.23.1",
"resolved": "https://registry.npmjs.org/tree-sitter-javascript/-/tree-sitter-javascript-0.23.1.tgz", "resolved": "https://registry.npmjs.org/tree-sitter-javascript/-/tree-sitter-javascript-0.23.1.tgz",
-1
View File
@@ -46,7 +46,6 @@
"p-limit": "^7.3.0", "p-limit": "^7.3.0",
"picocolors": "^1.1.1", "picocolors": "^1.1.1",
"tree-sitter": "^0.22.4", "tree-sitter": "^0.22.4",
"tree-sitter-go": "^0.23.4",
"tree-sitter-python": "^0.23.6", "tree-sitter-python": "^0.23.6",
"tree-sitter-typescript": "^0.23.2" "tree-sitter-typescript": "^0.23.2"
} }
+27 -11
View File
@@ -162,7 +162,12 @@ function extractPythonData(tree: Tree, source: string): ASTFileData {
} }
visit(tree.rootNode); visit(tree.rootNode);
return { exports: [...new Set(exports)], deps: [...new Set(deps)], classes, functions }; return {
exports: [...new Set(exports)],
deps: [...new Set(deps)],
classes,
functions,
};
} }
function extractPythonMethod( function extractPythonMethod(
@@ -214,12 +219,13 @@ function extractPythonMethod(
function dedupeCallChains(calls: string[]): string[] { function dedupeCallChains(calls: string[]): string[] {
const unique = [...new Set(calls)]; const unique = [...new Set(calls)];
// Remove shorter calls that are prefixes of longer ones // Remove shorter calls that are prefixes of longer ones
return unique.filter((call) => return unique.filter(
!unique.some( (call) =>
(other) => !unique.some(
other !== call && (other) =>
(other.startsWith(`${call}.`) || other.startsWith(`${call}(`)), other !== call &&
), (other.startsWith(`${call}.`) || other.startsWith(`${call}(`)),
),
); );
} }
@@ -245,7 +251,8 @@ function extractPythonCallsAndRaises(
} }
for (let i = 0; i < node.childCount; i++) { for (let i = 0; i < node.childCount; i++) {
const child = node.child(i); const child = node.child(i);
if (child && node.type !== "raise_statement") extractPythonCallsAndRaises(child, calls, raises); if (child && node.type !== "raise_statement")
extractPythonCallsAndRaises(child, calls, raises);
} }
} }
@@ -334,7 +341,10 @@ function extractTypeScriptData(tree: Tree, source: string): ASTFileData {
const nameNode = findIdentifier(declaration); const nameNode = findIdentifier(declaration);
if (nameNode) { if (nameNode) {
exports.push(nameNode.text); exports.push(nameNode.text);
if (declaration.type === "function_declaration" || declaration.type === "function") { if (
declaration.type === "function_declaration" ||
declaration.type === "function"
) {
const method = extractTSMethod(declaration, source); const method = extractTSMethod(declaration, source);
if (method) functions.push(method); if (method) functions.push(method);
} }
@@ -349,7 +359,12 @@ function extractTypeScriptData(tree: Tree, source: string): ASTFileData {
} }
visit(tree.rootNode); visit(tree.rootNode);
return { exports: [...new Set(exports)], deps: [...new Set(deps)], classes, functions }; return {
exports: [...new Set(exports)],
deps: [...new Set(deps)],
classes,
functions,
};
} }
function extractTSMethod(node: SyntaxNode, _source: string): MethodData | null { function extractTSMethod(node: SyntaxNode, _source: string): MethodData | null {
@@ -431,7 +446,8 @@ function extractTSCallsAndThrows(
} }
for (let i = 0; i < node.childCount; i++) { for (let i = 0; i < node.childCount; i++) {
const child = node.child(i); const child = node.child(i);
if (child && node.type !== "throw_statement") extractTSCallsAndThrows(child, calls, raises); if (child && node.type !== "throw_statement")
extractTSCallsAndThrows(child, calls, raises);
} }
} }