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:
Generated
-20
@@ -14,7 +14,6 @@
|
||||
"p-limit": "^7.3.0",
|
||||
"picocolors": "^1.1.1",
|
||||
"tree-sitter": "^0.22.4",
|
||||
"tree-sitter-go": "^0.23.4",
|
||||
"tree-sitter-python": "^0.23.6",
|
||||
"tree-sitter-typescript": "^0.23.2"
|
||||
},
|
||||
@@ -3355,25 +3354,6 @@
|
||||
"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": {
|
||||
"version": "0.23.1",
|
||||
"resolved": "https://registry.npmjs.org/tree-sitter-javascript/-/tree-sitter-javascript-0.23.1.tgz",
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
"p-limit": "^7.3.0",
|
||||
"picocolors": "^1.1.1",
|
||||
"tree-sitter": "^0.22.4",
|
||||
"tree-sitter-go": "^0.23.4",
|
||||
"tree-sitter-python": "^0.23.6",
|
||||
"tree-sitter-typescript": "^0.23.2"
|
||||
}
|
||||
|
||||
+22
-6
@@ -162,7 +162,12 @@ function extractPythonData(tree: Tree, source: string): ASTFileData {
|
||||
}
|
||||
|
||||
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(
|
||||
@@ -214,7 +219,8 @@ function extractPythonMethod(
|
||||
function dedupeCallChains(calls: string[]): string[] {
|
||||
const unique = [...new Set(calls)];
|
||||
// Remove shorter calls that are prefixes of longer ones
|
||||
return unique.filter((call) =>
|
||||
return unique.filter(
|
||||
(call) =>
|
||||
!unique.some(
|
||||
(other) =>
|
||||
other !== call &&
|
||||
@@ -245,7 +251,8 @@ function extractPythonCallsAndRaises(
|
||||
}
|
||||
for (let i = 0; i < node.childCount; 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);
|
||||
if (nameNode) {
|
||||
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);
|
||||
if (method) functions.push(method);
|
||||
}
|
||||
@@ -349,7 +359,12 @@ function extractTypeScriptData(tree: Tree, source: string): ASTFileData {
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -431,7 +446,8 @@ function extractTSCallsAndThrows(
|
||||
}
|
||||
for (let i = 0; i < node.childCount; 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user