@stupidloud/codegraph 0.8.1 → 0.9.9
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 +319 -152
- package/dist/bin/codegraph.d.ts +4 -0
- package/dist/bin/codegraph.d.ts.map +1 -1
- package/dist/bin/codegraph.js +354 -90
- package/dist/bin/codegraph.js.map +1 -1
- package/dist/bin/node-version-check.d.ts +17 -0
- package/dist/bin/node-version-check.d.ts.map +1 -1
- package/dist/bin/node-version-check.js +37 -0
- package/dist/bin/node-version-check.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -11
- package/dist/config.js.map +1 -1
- package/dist/context/formatter.d.ts.map +1 -1
- package/dist/context/formatter.js +25 -6
- package/dist/context/formatter.js.map +1 -1
- package/dist/context/index.d.ts +22 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +257 -6
- package/dist/context/index.js.map +1 -1
- package/dist/context/markers.d.ts +19 -0
- package/dist/context/markers.d.ts.map +1 -0
- package/dist/context/markers.js +22 -0
- package/dist/context/markers.js.map +1 -0
- package/dist/db/index.d.ts +30 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +75 -25
- package/dist/db/index.js.map +1 -1
- package/dist/db/queries.d.ts +104 -0
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +328 -31
- package/dist/db/queries.js.map +1 -1
- package/dist/db/sqlite-adapter.d.ts +24 -23
- package/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/dist/db/sqlite-adapter.js +54 -174
- package/dist/db/sqlite-adapter.js.map +1 -1
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +6 -20
- package/dist/directory.js.map +1 -1
- package/dist/extraction/generated-detection.d.ts +30 -0
- package/dist/extraction/generated-detection.d.ts.map +1 -0
- package/dist/extraction/generated-detection.js +80 -0
- package/dist/extraction/generated-detection.js.map +1 -0
- package/dist/extraction/grammars.d.ts +23 -1
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/grammars.js +107 -3
- package/dist/extraction/grammars.js.map +1 -1
- package/dist/extraction/index.d.ts +22 -14
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +272 -183
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +45 -0
- package/dist/extraction/languages/c-cpp.js.map +1 -1
- package/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/dist/extraction/languages/csharp.js +2 -1
- package/dist/extraction/languages/csharp.js.map +1 -1
- package/dist/extraction/languages/go.d.ts.map +1 -1
- package/dist/extraction/languages/go.js +18 -2
- package/dist/extraction/languages/go.js.map +1 -1
- package/dist/extraction/languages/index.d.ts.map +1 -1
- package/dist/extraction/languages/index.js +6 -0
- package/dist/extraction/languages/index.js.map +1 -1
- package/dist/extraction/languages/java.d.ts.map +1 -1
- package/dist/extraction/languages/java.js +6 -0
- package/dist/extraction/languages/java.js.map +1 -1
- package/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/dist/extraction/languages/kotlin.js +6 -0
- package/dist/extraction/languages/kotlin.js.map +1 -1
- package/dist/extraction/languages/lua.d.ts +3 -0
- package/dist/extraction/languages/lua.d.ts.map +1 -0
- package/dist/extraction/languages/lua.js +150 -0
- package/dist/extraction/languages/lua.js.map +1 -0
- package/dist/extraction/languages/luau.d.ts +3 -0
- package/dist/extraction/languages/luau.d.ts.map +1 -0
- package/dist/extraction/languages/luau.js +37 -0
- package/dist/extraction/languages/luau.js.map +1 -0
- package/dist/extraction/languages/objc.d.ts +3 -0
- package/dist/extraction/languages/objc.d.ts.map +1 -0
- package/dist/extraction/languages/objc.js +133 -0
- package/dist/extraction/languages/objc.js.map +1 -0
- package/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/dist/extraction/mybatis-extractor.js +198 -0
- package/dist/extraction/mybatis-extractor.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +14 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +84 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +715 -16
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/vue-extractor.d.ts +15 -0
- package/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/dist/extraction/vue-extractor.js +88 -0
- package/dist/extraction/vue-extractor.js.map +1 -1
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
- package/dist/extraction/wasm-runtime-flags.js +106 -0
- package/dist/extraction/wasm-runtime-flags.js.map +1 -0
- package/dist/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +76 -38
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +77 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +133 -19
- package/dist/index.js.map +1 -1
- package/dist/installer/config-writer.d.ts +7 -8
- package/dist/installer/config-writer.d.ts.map +1 -1
- package/dist/installer/config-writer.js +7 -27
- package/dist/installer/config-writer.js.map +1 -1
- package/dist/installer/index.d.ts +51 -16
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +120 -29
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/instructions-template.d.ts +11 -21
- package/dist/installer/instructions-template.d.ts.map +1 -1
- package/dist/installer/instructions-template.js +12 -56
- package/dist/installer/instructions-template.js.map +1 -1
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/installer/targets/antigravity.js +308 -0
- package/dist/installer/targets/antigravity.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +26 -1
- package/dist/installer/targets/claude.d.ts.map +1 -1
- package/dist/installer/targets/claude.js +118 -40
- package/dist/installer/targets/claude.js.map +1 -1
- package/dist/installer/targets/codex.d.ts.map +1 -1
- package/dist/installer/targets/codex.js +15 -13
- package/dist/installer/targets/codex.js.map +1 -1
- package/dist/installer/targets/cursor.d.ts.map +1 -1
- package/dist/installer/targets/cursor.js +61 -36
- package/dist/installer/targets/cursor.js.map +1 -1
- package/dist/installer/targets/gemini.d.ts +26 -0
- package/dist/installer/targets/gemini.d.ts.map +1 -0
- package/dist/installer/targets/gemini.js +167 -0
- package/dist/installer/targets/gemini.js.map +1 -0
- package/dist/installer/targets/hermes.d.ts +18 -0
- package/dist/installer/targets/hermes.d.ts.map +1 -0
- package/dist/installer/targets/hermes.js +359 -0
- package/dist/installer/targets/hermes.js.map +1 -0
- package/dist/installer/targets/kiro.d.ts +27 -0
- package/dist/installer/targets/kiro.d.ts.map +1 -0
- package/dist/installer/targets/kiro.js +178 -0
- package/dist/installer/targets/kiro.js.map +1 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -1
- package/dist/installer/targets/opencode.js +15 -13
- package/dist/installer/targets/opencode.js.map +1 -1
- package/dist/installer/targets/registry.d.ts.map +1 -1
- package/dist/installer/targets/registry.js +8 -0
- package/dist/installer/targets/registry.js.map +1 -1
- package/dist/installer/targets/shared.d.ts.map +1 -1
- package/dist/installer/targets/shared.js +3 -2
- package/dist/installer/targets/shared.js.map +1 -1
- package/dist/installer/targets/types.d.ts +1 -16
- package/dist/installer/targets/types.d.ts.map +1 -1
- package/dist/mcp/daemon-paths.d.ts +46 -0
- package/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/dist/mcp/daemon-paths.js +125 -0
- package/dist/mcp/daemon-paths.js.map +1 -0
- package/dist/mcp/daemon.d.ts +161 -0
- package/dist/mcp/daemon.d.ts.map +1 -0
- package/dist/mcp/daemon.js +403 -0
- package/dist/mcp/daemon.js.map +1 -0
- package/dist/mcp/engine.d.ts +105 -0
- package/dist/mcp/engine.d.ts.map +1 -0
- package/dist/mcp/engine.js +270 -0
- package/dist/mcp/engine.js.map +1 -0
- package/dist/mcp/index.d.ts +70 -52
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +355 -331
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/proxy.d.ts +81 -0
- package/dist/mcp/proxy.d.ts.map +1 -0
- package/dist/mcp/proxy.js +510 -0
- package/dist/mcp/proxy.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +1 -1
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +21 -21
- package/dist/mcp/session.d.ts +77 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +294 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/tools.d.ts +171 -15
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +1714 -298
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/transport.d.ts +111 -29
- package/dist/mcp/transport.d.ts.map +1 -1
- package/dist/mcp/transport.js +181 -71
- package/dist/mcp/transport.js.map +1 -1
- package/dist/mcp/version.d.ts +19 -0
- package/dist/mcp/version.d.ts.map +1 -0
- package/dist/mcp/version.js +71 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +10 -0
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/resolution/callback-synthesizer.js +1300 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -0
- package/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/dist/resolution/frameworks/csharp.js +36 -8
- package/dist/resolution/frameworks/csharp.js.map +1 -1
- package/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
- package/dist/resolution/frameworks/drupal.js +367 -0
- package/dist/resolution/frameworks/drupal.js.map +1 -0
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/dist/resolution/frameworks/expo-modules.js +143 -0
- package/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/dist/resolution/frameworks/express.js +102 -19
- package/dist/resolution/frameworks/express.js.map +1 -1
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/dist/resolution/frameworks/fabric.js +354 -0
- package/dist/resolution/frameworks/fabric.js.map +1 -0
- package/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/dist/resolution/frameworks/go.js +6 -3
- package/dist/resolution/frameworks/go.js.map +1 -1
- package/dist/resolution/frameworks/index.d.ts +6 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/dist/resolution/frameworks/index.js +29 -1
- package/dist/resolution/frameworks/index.js.map +1 -1
- package/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/dist/resolution/frameworks/java.js +339 -12
- package/dist/resolution/frameworks/java.js.map +1 -1
- package/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/dist/resolution/frameworks/laravel.js +17 -8
- package/dist/resolution/frameworks/laravel.js.map +1 -1
- package/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/dist/resolution/frameworks/nestjs.js +324 -0
- package/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/dist/resolution/frameworks/play.js +111 -0
- package/dist/resolution/frameworks/play.js.map +1 -0
- package/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/dist/resolution/frameworks/python.js +134 -16
- package/dist/resolution/frameworks/python.js.map +1 -1
- package/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/dist/resolution/frameworks/react-native.js +360 -0
- package/dist/resolution/frameworks/react-native.js.map +1 -0
- package/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/dist/resolution/frameworks/react.js +96 -3
- package/dist/resolution/frameworks/react.js.map +1 -1
- package/dist/resolution/frameworks/ruby.d.ts.map +1 -1
- package/dist/resolution/frameworks/ruby.js +106 -2
- package/dist/resolution/frameworks/ruby.js.map +1 -1
- package/dist/resolution/frameworks/rust.d.ts.map +1 -1
- package/dist/resolution/frameworks/rust.js +102 -5
- package/dist/resolution/frameworks/rust.js.map +1 -1
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift-objc.js +252 -0
- package/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/dist/resolution/frameworks/swift.js +30 -6
- package/dist/resolution/frameworks/swift.js.map +1 -1
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/go-module.d.ts.map +1 -0
- package/dist/resolution/go-module.js +78 -0
- package/dist/resolution/go-module.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +28 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -1
- package/dist/resolution/import-resolver.js +617 -5
- package/dist/resolution/import-resolver.js.map +1 -1
- package/dist/resolution/index.d.ts +11 -0
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +196 -10
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/lru-cache.d.ts.map +1 -0
- package/dist/resolution/lru-cache.js +62 -0
- package/dist/resolution/lru-cache.js.map +1 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +212 -0
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/dist/resolution/swift-objc-bridge.js +256 -0
- package/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/dist/resolution/types.d.ts +44 -0
- package/dist/resolution/types.d.ts.map +1 -1
- package/dist/resolution/workspace-packages.d.ts +48 -0
- package/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/dist/resolution/workspace-packages.js +208 -0
- package/dist/resolution/workspace-packages.js.map +1 -0
- package/dist/search/query-utils.d.ts +18 -0
- package/dist/search/query-utils.d.ts.map +1 -1
- package/dist/search/query-utils.js +30 -0
- package/dist/search/query-utils.js.map +1 -1
- package/dist/sync/git-hooks.d.ts.map +1 -1
- package/dist/sync/git-hooks.js +2 -0
- package/dist/sync/git-hooks.js.map +1 -1
- package/dist/sync/index.d.ts +3 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/watcher.d.ts +214 -12
- package/dist/sync/watcher.d.ts.map +1 -1
- package/dist/sync/watcher.js +467 -55
- package/dist/sync/watcher.js.map +1 -1
- package/dist/sync/worktree.d.ts +54 -0
- package/dist/sync/worktree.d.ts.map +1 -0
- package/dist/sync/worktree.js +137 -0
- package/dist/sync/worktree.js.map +1 -0
- package/dist/types.d.ts +9 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/scripts/add-lang/bench.sh +60 -0
- package/scripts/add-lang/check-grammar.mjs +75 -0
- package/scripts/add-lang/dump-ast.mjs +103 -0
- package/scripts/add-lang/verify-extraction.mjs +70 -0
- package/scripts/agent-eval/arms-F.sh +21 -0
- package/scripts/agent-eval/arms-matrix.sh +37 -0
- package/scripts/agent-eval/bench-readme.sh +28 -0
- package/scripts/agent-eval/bench-why-repo.sh +22 -0
- package/scripts/agent-eval/block-read-hook.sh +19 -0
- package/scripts/agent-eval/hook-settings.json +15 -0
- package/scripts/agent-eval/itrun.sh +24 -11
- package/scripts/agent-eval/parse-arms.mjs +116 -0
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
- package/scripts/agent-eval/probe-context.mjs +21 -0
- package/scripts/agent-eval/probe-explore.mjs +40 -0
- package/scripts/agent-eval/probe-node.mjs +20 -0
- package/scripts/agent-eval/probe-sweep.mjs +119 -0
- package/scripts/agent-eval/probe-trace.mjs +20 -0
- package/scripts/agent-eval/run-arms.sh +56 -0
- package/scripts/agent-eval/seq-matrix.mjs +137 -0
- package/scripts/build-bundle.sh +118 -0
- package/scripts/npm-sdk.js +75 -0
- package/scripts/npm-shim.js +246 -0
- package/scripts/pack-npm.sh +119 -0
- package/scripts/prepare-release.mjs +270 -0
- package/scripts/patch-tree-sitter-dart.js +0 -112
- package/scripts/release.sh +0 -68
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.luaExtractor = void 0;
|
|
4
|
+
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
5
|
+
// Node names follow the vendored ABI-15 grammar (@tree-sitter-grammars/
|
|
6
|
+
// tree-sitter-lua), NOT the older tree-sitter-wasms build — see grammars.ts.
|
|
7
|
+
/** First descendant of a given type (breadth-first), or null. */
|
|
8
|
+
function findDescendant(node, type) {
|
|
9
|
+
const queue = [...node.namedChildren];
|
|
10
|
+
while (queue.length) {
|
|
11
|
+
const n = queue.shift();
|
|
12
|
+
if (n.type === type)
|
|
13
|
+
return n;
|
|
14
|
+
queue.push(...n.namedChildren);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* If `callNode` is a `require(...)` call, return the module name; otherwise null.
|
|
20
|
+
* Lua/Luau have no import statement — modules are loaded by calling the global
|
|
21
|
+
* `require`. Handles both:
|
|
22
|
+
* - string requires: `require("net.http")` / `require "net.http"` → "net.http"
|
|
23
|
+
* - Roblox/Luau path requires: `require(script.Parent.Signal)` → "Signal"
|
|
24
|
+
* (the dominant idiom in Roblox code, where the argument is an instance path
|
|
25
|
+
* rather than a string — use the trailing field as the module name).
|
|
26
|
+
*/
|
|
27
|
+
function requireModule(callNode, source) {
|
|
28
|
+
// function_call > name: <callee>, arguments: arguments
|
|
29
|
+
const name = (0, tree_sitter_helpers_1.getChildByField)(callNode, 'name');
|
|
30
|
+
// A dotted/colon callee (e.g. `socket.connect`) is dot/method_index_expression,
|
|
31
|
+
// never a bare `require`.
|
|
32
|
+
if (!name || name.type !== 'identifier')
|
|
33
|
+
return null;
|
|
34
|
+
if ((0, tree_sitter_helpers_1.getNodeText)(name, source) !== 'require')
|
|
35
|
+
return null;
|
|
36
|
+
const args = (0, tree_sitter_helpers_1.getChildByField)(callNode, 'arguments');
|
|
37
|
+
if (!args)
|
|
38
|
+
return null;
|
|
39
|
+
// String require — `string > content: string_content` gives the bare name.
|
|
40
|
+
const content = findDescendant(args, 'string_content');
|
|
41
|
+
if (content)
|
|
42
|
+
return (0, tree_sitter_helpers_1.getNodeText)(content, source).trim() || null;
|
|
43
|
+
const str = findDescendant(args, 'string');
|
|
44
|
+
if (str) {
|
|
45
|
+
const mod = (0, tree_sitter_helpers_1.getNodeText)(str, source)
|
|
46
|
+
.trim()
|
|
47
|
+
.replace(/^\[\[/, '')
|
|
48
|
+
.replace(/\]\]$/, '')
|
|
49
|
+
.replace(/^["']/, '')
|
|
50
|
+
.replace(/["']$/, '');
|
|
51
|
+
if (mod)
|
|
52
|
+
return mod;
|
|
53
|
+
}
|
|
54
|
+
// Roblox/Luau instance-path require: `require(script.Parent.Signal)` → "Signal".
|
|
55
|
+
const idx = findDescendant(args, 'dot_index_expression') ?? findDescendant(args, 'method_index_expression');
|
|
56
|
+
if (idx) {
|
|
57
|
+
const field = (0, tree_sitter_helpers_1.getChildByField)(idx, 'field') ?? (0, tree_sitter_helpers_1.getChildByField)(idx, 'method');
|
|
58
|
+
if (field)
|
|
59
|
+
return (0, tree_sitter_helpers_1.getNodeText)(field, source).trim() || null;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
exports.luaExtractor = {
|
|
64
|
+
// function_declaration covers global (`function f`), table (`function t.f`),
|
|
65
|
+
// method (`function t:m`), and local (`local function f`) forms — the form is
|
|
66
|
+
// distinguished by the `name:` child (identifier / dot_index_expression /
|
|
67
|
+
// method_index_expression) and a `local` token, not by separate node types.
|
|
68
|
+
// Anonymous `function() ... end` (function_definition) has no name and is
|
|
69
|
+
// captured via its enclosing variable instead.
|
|
70
|
+
functionTypes: ['function_declaration'],
|
|
71
|
+
classTypes: [], // Lua has no classes/structs/interfaces/enums — tables are used for everything
|
|
72
|
+
methodTypes: [],
|
|
73
|
+
interfaceTypes: [],
|
|
74
|
+
structTypes: [],
|
|
75
|
+
enumTypes: [],
|
|
76
|
+
typeAliasTypes: [],
|
|
77
|
+
importTypes: [], // `require` is a function_call — handled in visitNode below
|
|
78
|
+
callTypes: ['function_call'],
|
|
79
|
+
variableTypes: ['variable_declaration'], // see the `lua` branch in extractVariable
|
|
80
|
+
nameField: 'name',
|
|
81
|
+
bodyField: 'body',
|
|
82
|
+
paramsField: 'parameters',
|
|
83
|
+
getSignature: (node, source) => {
|
|
84
|
+
const params = (0, tree_sitter_helpers_1.getChildByField)(node, 'parameters');
|
|
85
|
+
return params ? (0, tree_sitter_helpers_1.getNodeText)(params, source) : undefined;
|
|
86
|
+
},
|
|
87
|
+
// `function t.f()` / `function t:m()` are methods on table `t`: return the
|
|
88
|
+
// table as the receiver so they extract as methods with a `t::f` qualified
|
|
89
|
+
// name. Plain `function f()` / `local function f()` have no receiver and stay
|
|
90
|
+
// functions. (For `a.b.c`, the receiver is the nested `a.b`.)
|
|
91
|
+
getReceiverType: (node, source) => {
|
|
92
|
+
const name = (0, tree_sitter_helpers_1.getChildByField)(node, 'name');
|
|
93
|
+
if (name && (name.type === 'dot_index_expression' || name.type === 'method_index_expression')) {
|
|
94
|
+
const table = (0, tree_sitter_helpers_1.getChildByField)(name, 'table');
|
|
95
|
+
if (table)
|
|
96
|
+
return (0, tree_sitter_helpers_1.getNodeText)(table, source);
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
},
|
|
100
|
+
// Emit import nodes for `require(...)`. The local-declaration form is handled
|
|
101
|
+
// explicitly because the variable branch skips the initializer subtree; bare
|
|
102
|
+
// and global `require` calls are caught when the walker reaches the
|
|
103
|
+
// function_call node.
|
|
104
|
+
visitNode: (node, ctx) => {
|
|
105
|
+
const source = ctx.source;
|
|
106
|
+
const emit = (callNode) => {
|
|
107
|
+
const mod = requireModule(callNode, source);
|
|
108
|
+
if (!mod)
|
|
109
|
+
return;
|
|
110
|
+
const imp = ctx.createNode('import', mod, callNode, {
|
|
111
|
+
signature: (0, tree_sitter_helpers_1.getNodeText)(callNode, source).trim().slice(0, 100),
|
|
112
|
+
});
|
|
113
|
+
if (imp && ctx.nodeStack.length > 0) {
|
|
114
|
+
const parentId = ctx.nodeStack[ctx.nodeStack.length - 1];
|
|
115
|
+
if (parentId) {
|
|
116
|
+
ctx.addUnresolvedReference({
|
|
117
|
+
fromNodeId: parentId,
|
|
118
|
+
referenceName: mod,
|
|
119
|
+
referenceKind: 'imports',
|
|
120
|
+
line: callNode.startPosition.row + 1,
|
|
121
|
+
column: callNode.startPosition.column,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
// Bare / global `require("x")` — claim it so it isn't double-counted as a call.
|
|
127
|
+
if (node.type === 'function_call') {
|
|
128
|
+
if (requireModule(node, source)) {
|
|
129
|
+
emit(node);
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
// `local x = require("x")` — variable_declaration wraps an assignment_statement
|
|
135
|
+
// whose initializer subtree the variable branch will skip, so dig it out here.
|
|
136
|
+
if (node.type === 'variable_declaration') {
|
|
137
|
+
const assign = node.namedChildren.find((c) => c.type === 'assignment_statement');
|
|
138
|
+
const exprList = assign?.namedChildren.find((c) => c.type === 'expression_list');
|
|
139
|
+
if (exprList) {
|
|
140
|
+
for (const val of exprList.namedChildren) {
|
|
141
|
+
if (val.type === 'function_call')
|
|
142
|
+
emit(val);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=lua.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lua.js","sourceRoot":"","sources":["../../../src/extraction/languages/lua.ts"],"names":[],"mappings":";;;AACA,gEAAsE;AAGtE,wEAAwE;AACxE,6EAA6E;AAE7E,iEAAiE;AACjE,SAAS,cAAc,CAAC,IAAgB,EAAE,IAAY;IACpD,MAAM,KAAK,GAAiB,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,EAAG,CAAC;QACzB,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,CAAC,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,aAAa,CAAC,QAAoB,EAAE,MAAc;IACzD,uDAAuD;IACvD,MAAM,IAAI,GAAG,IAAA,qCAAe,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC/C,gFAAgF;IAChF,0BAA0B;IAC1B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,IAAI,CAAC;IACrD,IAAI,IAAA,iCAAW,EAAC,IAAI,EAAE,MAAM,CAAC,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAEzD,MAAM,IAAI,GAAG,IAAA,qCAAe,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACpD,IAAI,CAAC,IAAI;Q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BAAsB,EAAE,CAAC;YACzC,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,sBAAsB,CAAC,CAAC;YACjF,MAAM,QAAQ,GAAG,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAC;YACjF,IAAI,QAAQ,EAAE,CAAC;gBACb,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;oBACzC,IAAI,GAAG,CAAC,IAAI,KAAK,eAAe;wBAAE,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC9C,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"luau.d.ts","sourceRoot":"","sources":["../../../src/extraction/languages/luau.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAc9D,eAAO,MAAM,aAAa,EAAE,iBAoB3B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.luauExtractor = void 0;
|
|
4
|
+
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
5
|
+
const lua_1 = require("./lua");
|
|
6
|
+
// Luau (https://luau.org) is a gradually-typed superset of Lua. The
|
|
7
|
+
// tree-sitter-luau grammar reuses the same node names as the vendored Lua
|
|
8
|
+
// grammar (function_declaration, variable_declaration, function_call,
|
|
9
|
+
// dot/method_index_expression, …), so the Luau extractor extends the Lua one
|
|
10
|
+
// and adds the type-system pieces Luau introduces:
|
|
11
|
+
// - `type X = ...` / `export type X = ...` → type_definition (type_alias)
|
|
12
|
+
// - typed parameters and return types → richer signatures
|
|
13
|
+
//
|
|
14
|
+
// require detection, receiver-splitting (t.f / t:m → methods), and local
|
|
15
|
+
// variable extraction are inherited unchanged from luaExtractor. The shared
|
|
16
|
+
// `extractVariable` core branch is gated on `lua` || `luau`.
|
|
17
|
+
exports.luauExtractor = {
|
|
18
|
+
...lua_1.luaExtractor,
|
|
19
|
+
// `type X = ...` and `export type X = ...`
|
|
20
|
+
typeAliasTypes: ['type_definition'],
|
|
21
|
+
// Only Luau `export type` is exported; the keyword leads the node.
|
|
22
|
+
isExported: (node, source) => source.slice(node.startIndex, node.startIndex + 7) === 'export ',
|
|
23
|
+
// Params + Luau return type (the named child after `parameters`, before the body).
|
|
24
|
+
getSignature: (node, source) => {
|
|
25
|
+
const params = (0, tree_sitter_helpers_1.getChildByField)(node, 'parameters');
|
|
26
|
+
if (!params)
|
|
27
|
+
return undefined;
|
|
28
|
+
let sig = (0, tree_sitter_helpers_1.getNodeText)(params, source);
|
|
29
|
+
const kids = node.namedChildren;
|
|
30
|
+
const idx = kids.findIndex((c) => c.startIndex === params.startIndex);
|
|
31
|
+
const ret = idx >= 0 ? kids[idx + 1] : null;
|
|
32
|
+
if (ret && ret.type !== 'block')
|
|
33
|
+
sig += `: ${(0, tree_sitter_helpers_1.getNodeText)(ret, source)}`;
|
|
34
|
+
return sig;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=luau.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"luau.js","sourceRoot":"","sources":["../../../src/extraction/languages/luau.ts"],"names":[],"mappings":";;;AAAA,gEAAsE;AAEtE,+BAAqC;AAErC,oEAAoE;AACpE,0EAA0E;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,mDAAmD;AACnD,6EAA6E;AAC7E,mEAAmE;AACnE,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,6DAA6D;AAChD,QAAA,aAAa,G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|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.objcExtractor = void 0;
|
|
4
|
+
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
5
|
+
function findCompoundStatement(node) {
|
|
6
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
7
|
+
const child = node.namedChild(i);
|
|
8
|
+
if (child?.type === 'compound_statement') {
|
|
9
|
+
return child;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
/** Build ObjC selector: `greet`, `doThing:`, or `doThing:with:`. */
|
|
15
|
+
function extractObjcMethodName(node, source) {
|
|
16
|
+
if (node.type !== 'method_definition' && node.type !== 'method_declaration') {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const identifiers = node.namedChildren.filter((c) => c.type === 'identifier');
|
|
20
|
+
if (identifiers.length === 0)
|
|
21
|
+
return undefined;
|
|
22
|
+
const hasParameters = node.namedChildren.some((c) => c.type === 'method_parameter');
|
|
23
|
+
const firstIdentifier = identifiers[0];
|
|
24
|
+
if (!firstIdentifier)
|
|
25
|
+
return undefined;
|
|
26
|
+
if (!hasParameters) {
|
|
27
|
+
return (0, tree_sitter_helpers_1.getNodeText)(firstIdentifier, source);
|
|
28
|
+
}
|
|
29
|
+
return identifiers.map((id) => `${(0, tree_sitter_helpers_1.getNodeText)(id, source)}:`).join('');
|
|
30
|
+
}
|
|
31
|
+
function extractObjcPropertyName(node, source) {
|
|
32
|
+
if (node.type !== 'property_declaration')
|
|
33
|
+
return null;
|
|
34
|
+
const structDecl = node.namedChildren.find((c) => c.type === 'struct_declaration');
|
|
35
|
+
if (!structDecl)
|
|
36
|
+
return null;
|
|
37
|
+
const structDeclarator = structDecl.namedChildren.find((c) => c.type === 'struct_declarator');
|
|
38
|
+
if (!structDeclarator)
|
|
39
|
+
return null;
|
|
40
|
+
let current = structDeclarator;
|
|
41
|
+
while (current) {
|
|
42
|
+
const inner = (0, tree_sitter_helpers_1.getChildByField)(current, 'declarator') ||
|
|
43
|
+
current.namedChildren.find((c) => c.type === 'identifier' || c.type === 'pointer_declarator');
|
|
44
|
+
if (!inner)
|
|
45
|
+
break;
|
|
46
|
+
if (inner.type === 'identifier') {
|
|
47
|
+
return (0, tree_sitter_helpers_1.getNodeText)(inner, source);
|
|
48
|
+
}
|
|
49
|
+
current = inner;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
exports.objcExtractor = {
|
|
54
|
+
functionTypes: ['function_definition'],
|
|
55
|
+
// Only @interface emits a class node; @implementation reuses it via visitNode.
|
|
56
|
+
classTypes: ['class_interface'],
|
|
57
|
+
methodTypes: ['method_definition'],
|
|
58
|
+
interfaceTypes: ['protocol_declaration'],
|
|
59
|
+
interfaceKind: 'protocol',
|
|
60
|
+
structTypes: ['struct_specifier'],
|
|
61
|
+
enumTypes: ['enum_specifier'],
|
|
62
|
+
enumMemberTypes: ['enumerator'],
|
|
63
|
+
typeAliasTypes: ['type_definition'],
|
|
64
|
+
importTypes: ['preproc_include'],
|
|
65
|
+
callTypes: ['call_expression', 'message_expression'],
|
|
66
|
+
variableTypes: ['declaration'],
|
|
67
|
+
propertyTypes: ['property_declaration'],
|
|
68
|
+
nameField: 'declarator',
|
|
69
|
+
bodyField: 'body',
|
|
70
|
+
paramsField: 'parameters',
|
|
71
|
+
resolveName: extractObjcMethodName,
|
|
72
|
+
extractPropertyName: extractObjcPropertyName,
|
|
73
|
+
resolveBody: (node, bodyField) => {
|
|
74
|
+
const fromField = (0, tree_sitter_helpers_1.getChildByField)(node, bodyField);
|
|
75
|
+
if (fromField) {
|
|
76
|
+
return fromField;
|
|
77
|
+
}
|
|
78
|
+
return findCompoundStatement(node);
|
|
79
|
+
},
|
|
80
|
+
resolveTypeAliasKind: (node, _source) => {
|
|
81
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
82
|
+
const child = node.namedChild(i);
|
|
83
|
+
if (!child)
|
|
84
|
+
continue;
|
|
85
|
+
if (child.type === 'enum_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
|
|
86
|
+
return 'enum';
|
|
87
|
+
if (child.type === 'struct_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
|
|
88
|
+
return 'struct';
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
},
|
|
92
|
+
isStatic: (node) => /^\s*\+/.test(node.text),
|
|
93
|
+
visitNode: (node, ctx) => {
|
|
94
|
+
if (node.type !== 'class_implementation')
|
|
95
|
+
return false;
|
|
96
|
+
const classNameNode = node.namedChildren.find((c) => c.type === 'identifier');
|
|
97
|
+
if (!classNameNode)
|
|
98
|
+
return true;
|
|
99
|
+
const className = (0, tree_sitter_helpers_1.getNodeText)(classNameNode, ctx.source);
|
|
100
|
+
const classNode = ctx.nodes.find((n) => n.name === className && n.filePath === ctx.filePath && n.kind === 'class') ?? ctx.createNode('class', className, node, {});
|
|
101
|
+
if (!classNode)
|
|
102
|
+
return true;
|
|
103
|
+
ctx.pushScope(classNode.id);
|
|
104
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
105
|
+
const child = node.namedChild(i);
|
|
106
|
+
if (child?.type === 'implementation_definition') {
|
|
107
|
+
for (let j = 0; j < child.namedChildCount; j++) {
|
|
108
|
+
const implChild = child.namedChild(j);
|
|
109
|
+
if (implChild)
|
|
110
|
+
ctx.visitNode(implChild);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
ctx.popScope();
|
|
115
|
+
return true;
|
|
116
|
+
},
|
|
117
|
+
extractImport: (node, source) => {
|
|
118
|
+
const importText = source.substring(node.startIndex, node.endIndex).trim();
|
|
119
|
+
const systemLib = node.namedChildren.find((c) => c.type === 'system_lib_string');
|
|
120
|
+
if (systemLib) {
|
|
121
|
+
return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(systemLib, source).replace(/^<|>$/g, ''), signature: importText };
|
|
122
|
+
}
|
|
123
|
+
const stringLiteral = node.namedChildren.find((c) => c.type === 'string_literal');
|
|
124
|
+
if (stringLiteral) {
|
|
125
|
+
const stringContent = stringLiteral.namedChildren.find((c) => c.type === 'string_content');
|
|
126
|
+
if (stringContent) {
|
|
127
|
+
return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(stringContent, source), signature: importText };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=objc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objc.js","sourceRoot":"","sources":["../../../src/extraction/languages/objc.ts"],"names":[],"mappings":";;;AACA,gEAAsE;AAGtE,SAAS,qBAAqB,CAAC,IAAgB;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,KAAK,EAAE,IAAI,KAAK,oBAAoB,EAAE,CAAC;YACzC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,oEAAoE;AACpE,SAAS,qBAAqB,CAAC,IAAgB,EAAE,MAAc;IAC7D,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAmB,IAAI,IAAI,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;QAC5E,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;IAC9E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC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EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;QACrG,CAAC;QACD,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAgB,CAAC,CAAC;QAC9F,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAgB,CAAC,CAAC;YACvG,IAAI,aAAa,EAAE,CAAC;gBAClB,OAAO,EAAE,UAAU,EAAE,IAAA,iCAAW,EAAC,aAAa,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;YACnF,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ExtractionResult } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* MyBatisExtractor — parses MyBatis mapper XML files.
|
|
4
|
+
*
|
|
5
|
+
* MyBatis splits a DAO interface across two files: a Java interface (parsed by
|
|
6
|
+
* tree-sitter) declares the method, and an XML mapper file holds the SQL keyed
|
|
7
|
+
* by `<namespace>` (the fully-qualified Java type name) and `id` (the method
|
|
8
|
+
* name). Without the XML side in the graph, `trace(Controller, ...DAO.method)`
|
|
9
|
+
* dead-ends at the interface method — the SQL it actually runs is invisible,
|
|
10
|
+
* and "what does this query touch" / "where is this column written" can't be
|
|
11
|
+
* answered.
|
|
12
|
+
*
|
|
13
|
+
* This extractor emits one method-shaped node per `<select|insert|update|
|
|
14
|
+
* delete>` and per `<sql>` fragment, qualified as `<namespace>::<id>` so the
|
|
15
|
+
* MyBatis framework synthesizer (`src/resolution/frameworks/mybatis.ts`) can
|
|
16
|
+
* link the matching Java method → XML statement by suffix-matching qualified
|
|
17
|
+
* names. `<include refid="...">` inside a statement yields an unresolved
|
|
18
|
+
* reference to the SQL fragment, also keyed by `<namespace>::<refid>`.
|
|
19
|
+
*
|
|
20
|
+
* Non-mapper XML (Maven `pom.xml`, Spring beans XML, `web.xml`, log4j config,
|
|
21
|
+
* etc.) is detected by the absence of a `<mapper namespace="...">` root and
|
|
22
|
+
* returns just a file node — we still need the file row so the watcher can
|
|
23
|
+
* track it, but we emit no symbols.
|
|
24
|
+
*/
|
|
25
|
+
export declare class MyBatisExtractor {
|
|
26
|
+
private filePath;
|
|
27
|
+
private source;
|
|
28
|
+
private nodes;
|
|
29
|
+
private edges;
|
|
30
|
+
private unresolvedReferences;
|
|
31
|
+
private errors;
|
|
32
|
+
private lineStarts;
|
|
33
|
+
constructor(filePath: string, source: string);
|
|
34
|
+
extract(): ExtractionResult;
|
|
35
|
+
private createFileNode;
|
|
36
|
+
/**
|
|
37
|
+
* Find the `<mapper namespace="X">` opening tag. Returns the namespace and
|
|
38
|
+
* the byte offsets of the body (between the opening and closing tag) so
|
|
39
|
+
* statement extraction can be scoped to mapper contents.
|
|
40
|
+
*/
|
|
41
|
+
private findMapperRoot;
|
|
42
|
+
private extractMapper;
|
|
43
|
+
private buildSignature;
|
|
44
|
+
private previewSql;
|
|
45
|
+
private computeLineStarts;
|
|
46
|
+
private getLineNumber;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=mybatis-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mybatis-extractor.d.ts","sourceRoot":"","sources":["../../src/extraction/mybatis-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,gBAAgB,EAA6B,MAAM,UAAU,CAAC;AAG9F;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,UAAU,CAAgB;gBAEtB,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAM5C,OAAO,IAAI,gBAAgB;IA2B3B,OAAO,CAAC,cAAc;IAoBtB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,aAAa;IA2DrB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,aAAa;CAWtB"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MyBatisExtractor = void 0;
|
|
4
|
+
const tree_sitter_helpers_1 = require("./tree-sitter-helpers");
|
|
5
|
+
/**
|
|
6
|
+
* MyBatisExtractor — parses MyBatis mapper XML files.
|
|
7
|
+
*
|
|
8
|
+
* MyBatis splits a DAO interface across two files: a Java interface (parsed by
|
|
9
|
+
* tree-sitter) declares the method, and an XML mapper file holds the SQL keyed
|
|
10
|
+
* by `<namespace>` (the fully-qualified Java type name) and `id` (the method
|
|
11
|
+
* name). Without the XML side in the graph, `trace(Controller, ...DAO.method)`
|
|
12
|
+
* dead-ends at the interface method — the SQL it actually runs is invisible,
|
|
13
|
+
* and "what does this query touch" / "where is this column written" can't be
|
|
14
|
+
* answered.
|
|
15
|
+
*
|
|
16
|
+
* This extractor emits one method-shaped node per `<select|insert|update|
|
|
17
|
+
* delete>` and per `<sql>` fragment, qualified as `<namespace>::<id>` so the
|
|
18
|
+
* MyBatis framework synthesizer (`src/resolution/frameworks/mybatis.ts`) can
|
|
19
|
+
* link the matching Java method → XML statement by suffix-matching qualified
|
|
20
|
+
* names. `<include refid="...">` inside a statement yields an unresolved
|
|
21
|
+
* reference to the SQL fragment, also keyed by `<namespace>::<refid>`.
|
|
22
|
+
*
|
|
23
|
+
* Non-mapper XML (Maven `pom.xml`, Spring beans XML, `web.xml`, log4j config,
|
|
24
|
+
* etc.) is detected by the absence of a `<mapper namespace="...">` root and
|
|
25
|
+
* returns just a file node — we still need the file row so the watcher can
|
|
26
|
+
* track it, but we emit no symbols.
|
|
27
|
+
*/
|
|
28
|
+
class MyBatisExtractor {
|
|
29
|
+
filePath;
|
|
30
|
+
source;
|
|
31
|
+
nodes = [];
|
|
32
|
+
edges = [];
|
|
33
|
+
unresolvedReferences = [];
|
|
34
|
+
errors = [];
|
|
35
|
+
lineStarts = [];
|
|
36
|
+
constructor(filePath, source) {
|
|
37
|
+
this.filePath = filePath;
|
|
38
|
+
this.source = source;
|
|
39
|
+
this.computeLineStarts();
|
|
40
|
+
}
|
|
41
|
+
extract() {
|
|
42
|
+
const startTime = Date.now();
|
|
43
|
+
const fileNode = this.createFileNode();
|
|
44
|
+
try {
|
|
45
|
+
const mapperMatch = this.findMapperRoot();
|
|
46
|
+
if (mapperMatch) {
|
|
47
|
+
this.extractMapper(fileNode.id, mapperMatch.namespace, mapperMatch.bodyStart, mapperMatch.bodyEnd);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
this.errors.push({
|
|
52
|
+
message: `MyBatis extraction error: ${error instanceof Error ? error.message : String(error)}`,
|
|
53
|
+
severity: 'error',
|
|
54
|
+
code: 'parse_error',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
nodes: this.nodes,
|
|
59
|
+
edges: this.edges,
|
|
60
|
+
unresolvedReferences: this.unresolvedReferences,
|
|
61
|
+
errors: this.errors,
|
|
62
|
+
durationMs: Date.now() - startTime,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
createFileNode() {
|
|
66
|
+
const lines = this.source.split('\n');
|
|
67
|
+
const id = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'file', this.filePath, 1);
|
|
68
|
+
const node = {
|
|
69
|
+
id,
|
|
70
|
+
kind: 'file',
|
|
71
|
+
name: this.filePath.split('/').pop() || this.filePath,
|
|
72
|
+
qualifiedName: this.filePath,
|
|
73
|
+
filePath: this.filePath,
|
|
74
|
+
language: 'xml',
|
|
75
|
+
startLine: 1,
|
|
76
|
+
endLine: lines.length || 1,
|
|
77
|
+
startColumn: 0,
|
|
78
|
+
endColumn: lines[lines.length - 1]?.length ?? 0,
|
|
79
|
+
updatedAt: Date.now(),
|
|
80
|
+
};
|
|
81
|
+
this.nodes.push(node);
|
|
82
|
+
return node;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Find the `<mapper namespace="X">` opening tag. Returns the namespace and
|
|
86
|
+
* the byte offsets of the body (between the opening and closing tag) so
|
|
87
|
+
* statement extraction can be scoped to mapper contents.
|
|
88
|
+
*/
|
|
89
|
+
findMapperRoot() {
|
|
90
|
+
const open = /<mapper\b([^>]*)>/.exec(this.source);
|
|
91
|
+
if (!open)
|
|
92
|
+
return null;
|
|
93
|
+
const attrs = open[1] ?? '';
|
|
94
|
+
const nsMatch = /\bnamespace\s*=\s*"([^"]+)"/.exec(attrs);
|
|
95
|
+
if (!nsMatch)
|
|
96
|
+
return null;
|
|
97
|
+
const bodyStart = open.index + open[0].length;
|
|
98
|
+
const closeIdx = this.source.indexOf('</mapper>', bodyStart);
|
|
99
|
+
const bodyEnd = closeIdx >= 0 ? closeIdx : this.source.length;
|
|
100
|
+
return { namespace: nsMatch[1], bodyStart, bodyEnd };
|
|
101
|
+
}
|
|
102
|
+
extractMapper(fileNodeId, namespace, bodyStart, bodyEnd) {
|
|
103
|
+
const body = this.source.slice(bodyStart, bodyEnd);
|
|
104
|
+
// Match each top-level statement-shaped element. The body may have nested
|
|
105
|
+
// tags (`<if>`, `<foreach>`, `<include>`), so we scan with a regex that
|
|
106
|
+
// pairs an opening tag to its matching close — the simple form below works
|
|
107
|
+
// because MyBatis statement elements are not themselves nested.
|
|
108
|
+
const stmtRegex = /<(select|insert|update|delete|sql)\b([^>]*)>([\s\S]*?)<\/\1>/g;
|
|
109
|
+
let m;
|
|
110
|
+
while ((m = stmtRegex.exec(body)) !== null) {
|
|
111
|
+
const elemType = m[1];
|
|
112
|
+
const attrs = m[2] ?? '';
|
|
113
|
+
const elemBody = m[3] ?? '';
|
|
114
|
+
const idMatch = /\bid\s*=\s*"([^"]+)"/.exec(attrs);
|
|
115
|
+
if (!idMatch)
|
|
116
|
+
continue;
|
|
117
|
+
const id = idMatch[1];
|
|
118
|
+
const absoluteIndex = bodyStart + m.index;
|
|
119
|
+
const startLine = this.getLineNumber(absoluteIndex);
|
|
120
|
+
const endLine = this.getLineNumber(absoluteIndex + m[0].length);
|
|
121
|
+
const qualified = `${namespace}::${id}`;
|
|
122
|
+
const isSqlFragment = elemType === 'sql';
|
|
123
|
+
const nodeId = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'method', qualified, startLine);
|
|
124
|
+
const node = {
|
|
125
|
+
id: nodeId,
|
|
126
|
+
kind: 'method',
|
|
127
|
+
name: id,
|
|
128
|
+
qualifiedName: qualified,
|
|
129
|
+
filePath: this.filePath,
|
|
130
|
+
language: 'xml',
|
|
131
|
+
signature: this.buildSignature(elemType, attrs, isSqlFragment),
|
|
132
|
+
startLine,
|
|
133
|
+
endLine,
|
|
134
|
+
startColumn: 0,
|
|
135
|
+
endColumn: 0,
|
|
136
|
+
docstring: this.previewSql(elemBody),
|
|
137
|
+
updatedAt: Date.now(),
|
|
138
|
+
};
|
|
139
|
+
this.nodes.push(node);
|
|
140
|
+
this.edges.push({ source: fileNodeId, target: nodeId, kind: 'contains' });
|
|
141
|
+
// <include refid="X"/> → reference to the SQL fragment in this mapper
|
|
142
|
+
// (or in another mapper, when the refid is qualified — `ns.X`).
|
|
143
|
+
const includeRegex = /<include\b[^>]*\brefid\s*=\s*"([^"]+)"/g;
|
|
144
|
+
let inc;
|
|
145
|
+
while ((inc = includeRegex.exec(elemBody)) !== null) {
|
|
146
|
+
const refid = inc[1];
|
|
147
|
+
const refQualified = refid.includes('.') ? refid.replace(/\./g, '::') : `${namespace}::${refid}`;
|
|
148
|
+
const includeOffset = absoluteIndex + (m[0].length - m[3].length - `</${elemType}>`.length) + inc.index;
|
|
149
|
+
const line = this.getLineNumber(includeOffset);
|
|
150
|
+
this.unresolvedReferences.push({
|
|
151
|
+
fromNodeId: nodeId,
|
|
152
|
+
referenceName: refQualified,
|
|
153
|
+
referenceKind: 'references',
|
|
154
|
+
line,
|
|
155
|
+
column: 0,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
buildSignature(elemType, attrs, isSqlFragment) {
|
|
161
|
+
if (isSqlFragment)
|
|
162
|
+
return '<sql>';
|
|
163
|
+
const verb = elemType.toUpperCase();
|
|
164
|
+
const result = /\bresultType\s*=\s*"([^"]+)"/.exec(attrs)?.[1];
|
|
165
|
+
const param = /\bparameterType\s*=\s*"([^"]+)"/.exec(attrs)?.[1];
|
|
166
|
+
const parts = [verb];
|
|
167
|
+
if (param)
|
|
168
|
+
parts.push(`param=${param}`);
|
|
169
|
+
if (result)
|
|
170
|
+
parts.push(`result=${result}`);
|
|
171
|
+
return parts.join(' ');
|
|
172
|
+
}
|
|
173
|
+
previewSql(body) {
|
|
174
|
+
return body.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim().slice(0, 200);
|
|
175
|
+
}
|
|
176
|
+
computeLineStarts() {
|
|
177
|
+
this.lineStarts = [0];
|
|
178
|
+
for (let i = 0; i < this.source.length; i++) {
|
|
179
|
+
if (this.source.charCodeAt(i) === 10)
|
|
180
|
+
this.lineStarts.push(i + 1);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
getLineNumber(offset) {
|
|
184
|
+
// Binary search
|
|
185
|
+
let lo = 0;
|
|
186
|
+
let hi = this.lineStarts.length - 1;
|
|
187
|
+
while (lo < hi) {
|
|
188
|
+
const mid = (lo + hi + 1) >>> 1;
|
|
189
|
+
if (this.lineStarts[mid] <= offset)
|
|
190
|
+
lo = mid;
|
|
191
|
+
else
|
|
192
|
+
hi = mid - 1;
|
|
193
|
+
}
|
|
194
|
+
return lo + 1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
exports.MyBatisExtractor = MyBatisExtractor;
|
|
198
|
+
//# sourceMappingURL=mybatis-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mybatis-extractor.js","sourceRoot":"","sources":["../../src/extraction/mybatis-extractor.ts"],"names":[],"mappings":";;;AACA,+DAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,gBAAgB;IACnB,QAAQ,CAAS;IACjB,MAAM,CAAS;IACf,KAAK,GAAW,EAAE,CAAC;IACnB,KAAK,GAAW,EAAE,CAAC;IACnB,oBAAoB,GAA0B,EAAE,CAAC;IACjD,MAAM,GAAsB,EAAE,CAAC;IAC/B,UAAU,GAAa,EAAE,CAAC;IAElC,YAAY,QAAgB,EAAE,MAAc;QAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAEvC,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,IAAI,WAAW,EAAE,CAAC;gBAChB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YACrG,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;gBACf,OAAO,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