gitnexus 1.6.2-rc.2 → 1.6.2-rc.21
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/dist/_shared/lbug/schema-constants.d.ts +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.js +1 -0
- package/dist/_shared/lbug/schema-constants.js.map +1 -1
- package/dist/cli/analyze.js +3 -0
- package/dist/core/embeddings/ast-utils.d.ts +22 -0
- package/dist/core/embeddings/ast-utils.js +105 -0
- package/dist/core/embeddings/character-chunk.d.ts +12 -0
- package/dist/core/embeddings/character-chunk.js +43 -0
- package/dist/core/embeddings/chunker.d.ts +14 -0
- package/dist/core/embeddings/chunker.js +234 -0
- package/dist/core/embeddings/embedder.js +5 -0
- package/dist/core/embeddings/embedding-pipeline.d.ts +29 -24
- package/dist/core/embeddings/embedding-pipeline.js +244 -125
- package/dist/core/embeddings/line-index.d.ts +7 -0
- package/dist/core/embeddings/line-index.js +42 -0
- package/dist/core/embeddings/server-mapping.d.ts +15 -0
- package/dist/core/embeddings/server-mapping.js +33 -0
- package/dist/core/embeddings/structural-extractor.d.ts +15 -0
- package/dist/core/embeddings/structural-extractor.js +58 -0
- package/dist/core/embeddings/text-generator.d.ts +20 -13
- package/dist/core/embeddings/text-generator.js +151 -119
- package/dist/core/embeddings/types.d.ts +81 -3
- package/dist/core/embeddings/types.js +105 -3
- package/dist/core/group/extractors/http-patterns/node.js +130 -0
- package/dist/core/group/extractors/manifest-extractor.js +20 -5
- package/dist/core/group/sync.js +49 -1
- package/dist/core/ingestion/call-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/call-extractors/configs/c-cpp.js +8 -0
- package/dist/core/ingestion/call-extractors/configs/csharp.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/csharp.js +6 -0
- package/dist/core/ingestion/call-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/dart.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/go.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/call-extractors/configs/jvm.js +51 -0
- package/dist/core/ingestion/call-extractors/configs/php.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/php.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/python.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/ruby.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/rust.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/swift.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/ingestion/call-extractors/configs/typescript-javascript.js +8 -0
- package/dist/core/ingestion/call-extractors/generic.d.ts +5 -0
- package/dist/core/ingestion/call-extractors/generic.js +59 -0
- package/dist/core/ingestion/call-processor.d.ts +1 -3
- package/dist/core/ingestion/call-processor.js +49 -47
- package/dist/core/ingestion/call-types.d.ts +60 -0
- package/dist/core/ingestion/call-types.js +2 -0
- package/dist/core/ingestion/class-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/class-extractors/configs/c-cpp.js +11 -0
- package/dist/core/ingestion/class-extractors/configs/csharp.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/csharp.js +21 -0
- package/dist/core/ingestion/class-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/dart.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/go.js +20 -0
- package/dist/core/ingestion/class-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/class-extractors/configs/jvm.js +35 -0
- package/dist/core/ingestion/class-extractors/configs/php.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/php.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/python.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/ruby.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/rust.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/swift.js +18 -0
- package/dist/core/ingestion/class-extractors/configs/typescript-javascript.d.ts +4 -0
- package/dist/core/ingestion/class-extractors/configs/typescript-javascript.js +28 -0
- package/dist/core/ingestion/field-types.d.ts +1 -1
- package/dist/core/ingestion/import-resolvers/configs/c-cpp.d.ts +7 -0
- package/dist/core/ingestion/import-resolvers/configs/c-cpp.js +14 -0
- package/dist/core/ingestion/import-resolvers/configs/csharp.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/csharp.js +27 -0
- package/dist/core/ingestion/import-resolvers/configs/dart.d.ts +17 -0
- package/dist/core/ingestion/import-resolvers/{dart.js → configs/dart.js} +26 -16
- package/dist/core/ingestion/import-resolvers/configs/go.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/go.js +26 -0
- package/dist/core/ingestion/import-resolvers/configs/jvm.d.ts +13 -0
- package/dist/core/ingestion/import-resolvers/configs/jvm.js +68 -0
- package/dist/core/ingestion/import-resolvers/configs/php.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/php.js +15 -0
- package/dist/core/ingestion/import-resolvers/configs/python.d.ts +12 -0
- package/dist/core/ingestion/import-resolvers/configs/python.js +41 -0
- package/dist/core/ingestion/import-resolvers/configs/ruby.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/ruby.js +16 -0
- package/dist/core/ingestion/import-resolvers/configs/rust.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/rust.js +54 -0
- package/dist/core/ingestion/import-resolvers/configs/swift.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/{swift.js → configs/swift.js} +10 -5
- package/dist/core/ingestion/import-resolvers/configs/typescript-javascript.d.ts +9 -0
- package/dist/core/ingestion/import-resolvers/configs/typescript-javascript.js +23 -0
- package/dist/core/ingestion/import-resolvers/csharp.d.ts +4 -5
- package/dist/core/ingestion/import-resolvers/csharp.js +4 -20
- package/dist/core/ingestion/import-resolvers/go.d.ts +4 -5
- package/dist/core/ingestion/import-resolvers/go.js +4 -19
- package/dist/core/ingestion/import-resolvers/jvm.d.ts +5 -10
- package/dist/core/ingestion/import-resolvers/jvm.js +5 -58
- package/dist/core/ingestion/import-resolvers/php.d.ts +4 -5
- package/dist/core/ingestion/import-resolvers/php.js +4 -7
- package/dist/core/ingestion/import-resolvers/python.d.ts +3 -6
- package/dist/core/ingestion/import-resolvers/python.js +3 -18
- package/dist/core/ingestion/import-resolvers/resolver-factory.d.ts +24 -0
- package/dist/core/ingestion/import-resolvers/resolver-factory.js +33 -0
- package/dist/core/ingestion/import-resolvers/ruby.d.ts +4 -5
- package/dist/core/ingestion/import-resolvers/ruby.js +4 -7
- package/dist/core/ingestion/import-resolvers/rust.d.ts +4 -5
- package/dist/core/ingestion/import-resolvers/rust.js +4 -47
- package/dist/core/ingestion/import-resolvers/standard.d.ts +3 -9
- package/dist/core/ingestion/import-resolvers/standard.js +7 -8
- package/dist/core/ingestion/import-resolvers/types.d.ts +24 -0
- package/dist/core/ingestion/language-provider.d.ts +12 -0
- package/dist/core/ingestion/languages/c-cpp.js +15 -12
- package/dist/core/ingestion/languages/csharp.js +11 -21
- package/dist/core/ingestion/languages/dart.js +11 -7
- package/dist/core/ingestion/languages/go.js +11 -20
- package/dist/core/ingestion/languages/java.js +11 -18
- package/dist/core/ingestion/languages/kotlin.js +11 -13
- package/dist/core/ingestion/languages/php.js +11 -7
- package/dist/core/ingestion/languages/python.js +11 -7
- package/dist/core/ingestion/languages/ruby.js +11 -7
- package/dist/core/ingestion/languages/rust.js +11 -7
- package/dist/core/ingestion/languages/swift.js +11 -18
- package/dist/core/ingestion/languages/typescript.js +15 -23
- package/dist/core/ingestion/languages/vue.js +11 -17
- package/dist/core/ingestion/model/index.d.ts +2 -2
- package/dist/core/ingestion/model/index.js +1 -1
- package/dist/core/ingestion/model/resolve.d.ts +3 -0
- package/dist/core/ingestion/model/resolve.js +6 -2
- package/dist/core/ingestion/parsing-processor.d.ts +1 -2
- package/dist/core/ingestion/tree-sitter-queries.d.ts +11 -11
- package/dist/core/ingestion/tree-sitter-queries.js +81 -0
- package/dist/core/ingestion/type-env.d.ts +1 -1
- package/dist/core/ingestion/utils/ast-helpers.d.ts +1 -1
- package/dist/core/ingestion/utils/ast-helpers.js +3 -0
- package/dist/core/ingestion/variable-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/variable-extractors/configs/c-cpp.js +81 -0
- package/dist/core/ingestion/variable-extractors/configs/csharp.d.ts +9 -0
- package/dist/core/ingestion/variable-extractors/configs/csharp.js +63 -0
- package/dist/core/ingestion/variable-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/dart.js +94 -0
- package/dist/core/ingestion/variable-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/go.js +83 -0
- package/dist/core/ingestion/variable-extractors/configs/jvm.d.ts +18 -0
- package/dist/core/ingestion/variable-extractors/configs/jvm.js +115 -0
- package/dist/core/ingestion/variable-extractors/configs/php.d.ts +14 -0
- package/dist/core/ingestion/variable-extractors/configs/php.js +58 -0
- package/dist/core/ingestion/variable-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/python.js +101 -0
- package/dist/core/ingestion/variable-extractors/configs/ruby.d.ts +11 -0
- package/dist/core/ingestion/variable-extractors/configs/ruby.js +52 -0
- package/dist/core/ingestion/variable-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/rust.js +76 -0
- package/dist/core/ingestion/variable-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/swift.js +88 -0
- package/dist/core/ingestion/variable-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/ingestion/variable-extractors/configs/typescript-javascript.js +83 -0
- package/dist/core/ingestion/variable-extractors/generic.d.ts +5 -0
- package/dist/core/ingestion/variable-extractors/generic.js +80 -0
- package/dist/core/ingestion/variable-types.d.ts +82 -0
- package/dist/core/ingestion/variable-types.js +2 -0
- package/dist/core/ingestion/workers/parse-worker.js +196 -166
- package/dist/core/ingestion/workers/worker-pool.js +3 -0
- package/dist/core/lbug/csv-generator.js +1 -0
- package/dist/core/lbug/lbug-adapter.d.ts +13 -4
- package/dist/core/lbug/lbug-adapter.js +166 -81
- package/dist/core/lbug/schema.d.ts +9 -1
- package/dist/core/lbug/schema.js +19 -2
- package/dist/core/run-analyze.js +17 -4
- package/dist/core/tree-sitter/parser-loader.d.ts +3 -0
- package/dist/core/tree-sitter/parser-loader.js +17 -8
- package/dist/mcp/core/embedder.js +5 -0
- package/dist/mcp/local/local-backend.js +29 -19
- package/dist/server/api.js +10 -21
- package/package.json +5 -3
- package/scripts/build-tree-sitter-proto.cjs +82 -0
- package/vendor/node_modules/node-addon-api/node_addon_api.Makefile +6 -0
- package/vendor/node_modules/node-addon-api/node_addon_api.target.mk +104 -0
- package/vendor/node_modules/node-addon-api/node_addon_api_except.target.mk +108 -0
- package/vendor/node_modules/node-addon-api/node_addon_api_except_all.target.mk +104 -0
- package/vendor/node_modules/node-addon-api/node_addon_api_maybe.target.mk +104 -0
- package/vendor/tree-sitter-proto/package.json +1 -7
- package/dist/core/ingestion/call-sites/extract-language-call-site.d.ts +0 -10
- package/dist/core/ingestion/call-sites/extract-language-call-site.js +0 -22
- package/dist/core/ingestion/call-sites/java.d.ts +0 -9
- package/dist/core/ingestion/call-sites/java.js +0 -30
- package/dist/core/ingestion/import-resolvers/dart.d.ts +0 -7
- package/dist/core/ingestion/import-resolvers/swift.d.ts +0 -7
- package/dist/core/ingestion/import-resolvers/vue.d.ts +0 -8
- package/dist/core/ingestion/import-resolvers/vue.js +0 -9
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import resolver factory — creates a composable import resolver from
|
|
3
|
+
* an ordered list of strategies.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the method-extractors/generic.ts and call-extractors/generic.ts
|
|
6
|
+
* pattern: declare a config per language, produce a runtime resolver via factory.
|
|
7
|
+
*
|
|
8
|
+
* Each strategy is tried in order. The first non-null result wins.
|
|
9
|
+
* A result with an empty `files` array is treated as "handled but unresolved"
|
|
10
|
+
* (stops the chain without producing import edges).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Create an ImportResolverFn from a declarative config.
|
|
14
|
+
*
|
|
15
|
+
* Chains strategies in declaration order — first non-null result wins.
|
|
16
|
+
* Returns null only if every strategy returns null.
|
|
17
|
+
*
|
|
18
|
+
* Error behaviour: if a strategy throws, the error propagates immediately
|
|
19
|
+
* and remaining strategies are not tried. Strategies are expected to be
|
|
20
|
+
* pure data transforms that never throw; any unexpected exception indicates
|
|
21
|
+
* a bug in the strategy implementation.
|
|
22
|
+
*/
|
|
23
|
+
export function createImportResolver(config) {
|
|
24
|
+
const { strategies } = config;
|
|
25
|
+
return (rawImportPath, filePath, ctx) => {
|
|
26
|
+
for (const strategy of strategies) {
|
|
27
|
+
const result = strategy(rawImportPath, filePath, ctx);
|
|
28
|
+
if (result)
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ruby require/require_relative import resolution.
|
|
3
|
-
*
|
|
2
|
+
* Ruby require/require_relative import resolution — internal helpers.
|
|
3
|
+
*
|
|
4
|
+
* Strategy lives in configs/ruby.ts.
|
|
5
|
+
* This file only contains the low-level helper used by the strategy.
|
|
4
6
|
*/
|
|
5
7
|
import type { SuffixIndex } from './utils.js';
|
|
6
|
-
import type { ImportResult, ResolveCtx } from './types.js';
|
|
7
8
|
/**
|
|
8
9
|
* Resolve a Ruby require/require_relative path to a matching .rb file (low-level helper).
|
|
9
10
|
*
|
|
@@ -11,5 +12,3 @@ import type { ImportResult, ResolveCtx } from './types.js';
|
|
|
11
12
|
* require paths use suffix matching (gem-style paths like 'json', 'net/http').
|
|
12
13
|
*/
|
|
13
14
|
export declare function resolveRubyImportInternal(importPath: string, normalizedFileList: string[], allFileList: string[], index?: SuffixIndex): string | null;
|
|
14
|
-
/** Ruby: require / require_relative. */
|
|
15
|
-
export declare function resolveRubyImport(rawImportPath: string, _filePath: string, ctx: ResolveCtx): ImportResult;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ruby require/require_relative import resolution.
|
|
3
|
-
*
|
|
2
|
+
* Ruby require/require_relative import resolution — internal helpers.
|
|
3
|
+
*
|
|
4
|
+
* Strategy lives in configs/ruby.ts.
|
|
5
|
+
* This file only contains the low-level helper used by the strategy.
|
|
4
6
|
*/
|
|
5
7
|
import { suffixResolve } from './utils.js';
|
|
6
8
|
/**
|
|
@@ -13,8 +15,3 @@ export function resolveRubyImportInternal(importPath, normalizedFileList, allFil
|
|
|
13
15
|
const pathParts = importPath.replace(/^\.\//, '').split('/').filter(Boolean);
|
|
14
16
|
return suffixResolve(pathParts, normalizedFileList, allFileList, index);
|
|
15
17
|
}
|
|
16
|
-
/** Ruby: require / require_relative. */
|
|
17
|
-
export function resolveRubyImport(rawImportPath, _filePath, ctx) {
|
|
18
|
-
const resolved = resolveRubyImportInternal(rawImportPath, ctx.normalizedFileList, ctx.allFileList, ctx.index);
|
|
19
|
-
return resolved ? { kind: 'files', files: [resolved] } : null;
|
|
20
|
-
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rust module import resolution.
|
|
3
|
-
*
|
|
2
|
+
* Rust module import resolution — internal helpers.
|
|
3
|
+
*
|
|
4
|
+
* Strategy lives in configs/rust.ts.
|
|
5
|
+
* This file contains shared helpers used by the strategy and standard.ts.
|
|
4
6
|
*/
|
|
5
|
-
import type { ImportResult, ResolveCtx } from './types.js';
|
|
6
7
|
/**
|
|
7
8
|
* Resolve Rust use-path to a file (low-level helper).
|
|
8
9
|
* Handles crate::, super::, self:: prefixes and :: path separators.
|
|
@@ -14,5 +15,3 @@ export declare function resolveRustImportInternal(currentFile: string, importPat
|
|
|
14
15
|
* (last segment might be a symbol name, not a module).
|
|
15
16
|
*/
|
|
16
17
|
export declare function tryRustModulePath(modulePath: string, allFiles: Set<string>): string | null;
|
|
17
|
-
/** Rust: expand grouped imports: use {crate::a, crate::b} and use crate::models::{User, Repo}. */
|
|
18
|
-
export declare function resolveRustImport(rawImportPath: string, filePath: string, ctx: ResolveCtx): ImportResult;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rust module import resolution.
|
|
3
|
-
*
|
|
2
|
+
* Rust module import resolution — internal helpers.
|
|
3
|
+
*
|
|
4
|
+
* Strategy lives in configs/rust.ts.
|
|
5
|
+
* This file contains shared helpers used by the strategy and standard.ts.
|
|
4
6
|
*/
|
|
5
|
-
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
6
|
-
import { resolveStandard } from './standard.js';
|
|
7
7
|
/**
|
|
8
8
|
* Resolve Rust use-path to a file (low-level helper).
|
|
9
9
|
* Handles crate::, super::, self:: prefixes and :: path separators.
|
|
@@ -73,46 +73,3 @@ export function tryRustModulePath(modulePath, allFiles) {
|
|
|
73
73
|
}
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
-
/** Rust: expand grouped imports: use {crate::a, crate::b} and use crate::models::{User, Repo}. */
|
|
77
|
-
export function resolveRustImport(rawImportPath, filePath, ctx) {
|
|
78
|
-
// Top-level grouped: use {crate::a, crate::b}
|
|
79
|
-
if (rawImportPath.startsWith('{') && rawImportPath.endsWith('}')) {
|
|
80
|
-
const inner = rawImportPath.slice(1, -1);
|
|
81
|
-
const parts = inner
|
|
82
|
-
.split(',')
|
|
83
|
-
.map((p) => p.trim())
|
|
84
|
-
.filter(Boolean);
|
|
85
|
-
const resolved = [];
|
|
86
|
-
for (const part of parts) {
|
|
87
|
-
const r = resolveRustImportInternal(filePath, part, ctx.allFilePaths);
|
|
88
|
-
if (r)
|
|
89
|
-
resolved.push(r);
|
|
90
|
-
}
|
|
91
|
-
return resolved.length > 0 ? { kind: 'files', files: resolved } : null;
|
|
92
|
-
}
|
|
93
|
-
// Scoped grouped: use crate::models::{User, Repo}
|
|
94
|
-
const braceIdx = rawImportPath.indexOf('::{');
|
|
95
|
-
if (braceIdx !== -1 && rawImportPath.endsWith('}')) {
|
|
96
|
-
const pathPrefix = rawImportPath.substring(0, braceIdx);
|
|
97
|
-
const braceContent = rawImportPath.substring(braceIdx + 3, rawImportPath.length - 1);
|
|
98
|
-
const items = braceContent
|
|
99
|
-
.split(',')
|
|
100
|
-
.map((s) => s.trim())
|
|
101
|
-
.filter(Boolean);
|
|
102
|
-
const resolved = [];
|
|
103
|
-
for (const item of items) {
|
|
104
|
-
// Handle `use crate::models::{User, Repo as R}` — strip alias for resolution
|
|
105
|
-
const itemName = item.includes(' as ') ? item.split(' as ')[0].trim() : item;
|
|
106
|
-
const r = resolveRustImportInternal(filePath, `${pathPrefix}::${itemName}`, ctx.allFilePaths);
|
|
107
|
-
if (r)
|
|
108
|
-
resolved.push(r);
|
|
109
|
-
}
|
|
110
|
-
if (resolved.length > 0)
|
|
111
|
-
return { kind: 'files', files: resolved };
|
|
112
|
-
// Fallback: resolve the prefix path itself (e.g. crate::models -> models.rs)
|
|
113
|
-
const prefixResult = resolveRustImportInternal(filePath, pathPrefix, ctx.allFilePaths);
|
|
114
|
-
if (prefixResult)
|
|
115
|
-
return { kind: 'files', files: [prefixResult] };
|
|
116
|
-
}
|
|
117
|
-
return resolveStandard(rawImportPath, filePath, ctx, SupportedLanguages.Rust);
|
|
118
|
-
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { SuffixIndex } from './utils.js';
|
|
7
7
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
8
|
-
import type { ImportResult,
|
|
8
|
+
import type { ImportResult, ImportResolverStrategy, ResolveCtx } from './types.js';
|
|
9
9
|
import type { TsconfigPaths } from '../language-config.js';
|
|
10
10
|
/** Max entries in the resolve cache. Beyond this, entries are evicted.
|
|
11
11
|
* 100K entries ≈ 15MB — covers the most common import patterns. */
|
|
@@ -26,11 +26,5 @@ export declare const resolveImportPath: (currentFile: string, importPath: string
|
|
|
26
26
|
* Handles relative imports, tsconfig path aliases, and suffix matching.
|
|
27
27
|
*/
|
|
28
28
|
export declare function resolveStandard(rawImportPath: string, filePath: string, ctx: ResolveCtx, language: SupportedLanguages): ImportResult;
|
|
29
|
-
/**
|
|
30
|
-
export declare
|
|
31
|
-
/** TypeScript: standard single-file resolution. */
|
|
32
|
-
export declare const resolveTypescriptImport: ImportResolverFn;
|
|
33
|
-
/** C: standard single-file resolution for #include directives. */
|
|
34
|
-
export declare const resolveCImport: ImportResolverFn;
|
|
35
|
-
/** C++: standard single-file resolution for #include directives. */
|
|
36
|
-
export declare const resolveCppImport: ImportResolverFn;
|
|
29
|
+
/** Create a reusable standard-resolution strategy for a given language. */
|
|
30
|
+
export declare function createStandardStrategy(language: SupportedLanguages): ImportResolverStrategy;
|
|
@@ -133,11 +133,10 @@ export function resolveStandard(rawImportPath, filePath, ctx, language) {
|
|
|
133
133
|
const resolvedPath = resolveImportPath(filePath, rawImportPath, ctx.allFilePaths, ctx.allFileList, ctx.normalizedFileList, ctx.resolveCache, language, ctx.configs.tsconfigPaths, ctx.index);
|
|
134
134
|
return resolvedPath ? { kind: 'files', files: [resolvedPath] } : null;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
export const resolveCppImport = (raw, fp, ctx) => resolveStandard(raw, fp, ctx, SupportedLanguages.CPlusPlus);
|
|
136
|
+
// ============================================================================
|
|
137
|
+
// Strategy factory — composable hook for ImportResolutionConfig
|
|
138
|
+
// ============================================================================
|
|
139
|
+
/** Create a reusable standard-resolution strategy for a given language. */
|
|
140
|
+
export function createStandardStrategy(language) {
|
|
141
|
+
return (raw, fp, ctx) => resolveStandard(raw, fp, ctx, language);
|
|
142
|
+
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { TsconfigPaths, GoModuleConfig, CSharpProjectConfig, ComposerConfig } from '../language-config.js';
|
|
7
7
|
import type { SwiftPackageConfig } from '../language-config.js';
|
|
8
8
|
import type { SuffixIndex } from './utils.js';
|
|
9
|
+
import type { SupportedLanguages } from '../../../_shared/index.js';
|
|
9
10
|
/**
|
|
10
11
|
* Result of resolving an import via language-specific dispatch.
|
|
11
12
|
* - 'files': resolved to one or more files -> add to ImportMap
|
|
@@ -42,3 +43,26 @@ export interface ResolveCtx extends ImportResolutionContext {
|
|
|
42
43
|
}
|
|
43
44
|
/** Per-language import resolver -- function alias matching ExportChecker/CallRouter pattern. */
|
|
44
45
|
export type ImportResolverFn = (rawImportPath: string, filePath: string, resolveCtx: ResolveCtx) => ImportResult;
|
|
46
|
+
/**
|
|
47
|
+
* A single import resolution strategy — one step in a composable chain.
|
|
48
|
+
* Same signature as ImportResolverFn. Returns null to let the next strategy
|
|
49
|
+
* in the chain try; returns a result (even with empty files) to stop the chain.
|
|
50
|
+
*/
|
|
51
|
+
export type ImportResolverStrategy = ImportResolverFn;
|
|
52
|
+
/**
|
|
53
|
+
* Declarative config for composable import resolution — mirrors the
|
|
54
|
+
* MethodExtractionConfig / CallExtractionConfig pattern.
|
|
55
|
+
*
|
|
56
|
+
* Each language declares an ordered list of strategies to try.
|
|
57
|
+
* The factory (`createImportResolver`) chains them: first non-null result wins.
|
|
58
|
+
*/
|
|
59
|
+
export interface ImportResolutionConfig {
|
|
60
|
+
/**
|
|
61
|
+
* Documentation-only metadata identifying which language this config serves.
|
|
62
|
+
* **Not used by `createImportResolver`** — the factory only iterates `strategies`.
|
|
63
|
+
* Useful for logging, debugging, and compile-time exhaustiveness checks when
|
|
64
|
+
* mapping `SupportedLanguages → ImportResolutionConfig` in language providers.
|
|
65
|
+
*/
|
|
66
|
+
readonly language: SupportedLanguages;
|
|
67
|
+
readonly strategies: readonly ImportResolverStrategy[];
|
|
68
|
+
}
|
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
import type { SupportedLanguages, MroStrategy } from '../../_shared/index.js';
|
|
12
12
|
import type { LanguageTypeConfig } from './type-extractors/types.js';
|
|
13
13
|
import type { CallRouter } from './call-routing.js';
|
|
14
|
+
import type { CallExtractor } from './call-types.js';
|
|
14
15
|
import type { ClassExtractor } from './class-types.js';
|
|
15
16
|
import type { ExportChecker } from './export-detection.js';
|
|
16
17
|
import type { FieldExtractor } from './field-extractor.js';
|
|
17
18
|
import type { MethodExtractor } from './method-types.js';
|
|
19
|
+
import type { VariableExtractor } from './variable-types.js';
|
|
18
20
|
import type { ImportResolverFn } from './import-resolvers/types.js';
|
|
19
21
|
import type { NamedBindingExtractorFn } from './named-bindings/types.js';
|
|
20
22
|
import type { SyntaxNode } from './utils/ast-helpers.js';
|
|
@@ -119,6 +121,12 @@ interface LanguageProviderConfig {
|
|
|
119
121
|
/** MRO strategy for multiple inheritance resolution.
|
|
120
122
|
* Default: 'first-wins'. */
|
|
121
123
|
readonly mroStrategy?: MroStrategy;
|
|
124
|
+
/** Call extractor for extracting call site information (calledName, callForm,
|
|
125
|
+
* receiverName, argCount, mixed chains) from @call / @call.name captures.
|
|
126
|
+
* Produced by createCallExtractor() with a per-language CallExtractionConfig.
|
|
127
|
+
* Default: undefined — if unset, no calls are extracted for this language.
|
|
128
|
+
* All tree-sitter providers MUST supply this. */
|
|
129
|
+
readonly callExtractor?: CallExtractor;
|
|
122
130
|
/** Field extractor for extracting field/property definitions from class/struct
|
|
123
131
|
* declarations. Produces FieldInfo[] with name, type, visibility, static,
|
|
124
132
|
* readonly metadata. Default: undefined (no field extraction). */
|
|
@@ -127,6 +135,10 @@ interface LanguageProviderConfig {
|
|
|
127
135
|
* declarations. Produces MethodInfo[] with name, parameters, visibility, isAbstract,
|
|
128
136
|
* isFinal, annotations metadata. Default: undefined (no method extraction). */
|
|
129
137
|
readonly methodExtractor?: MethodExtractor;
|
|
138
|
+
/** Variable extractor for extracting metadata from module/file-scoped variable,
|
|
139
|
+
* constant, and static declarations. Produces VariableInfo with type, visibility,
|
|
140
|
+
* isConst, isStatic, isMutable metadata. Default: undefined (no variable extraction). */
|
|
141
|
+
readonly variableExtractor?: VariableExtractor;
|
|
130
142
|
/** Class/type extractor for deriving canonical qualified names for class-like symbols.
|
|
131
143
|
* Uses the same provider-driven strategy pattern as method/field extraction so
|
|
132
144
|
* namespace/package/module rules stay language-specific. */
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
11
11
|
import { createClassExtractor } from '../class-extractors/generic.js';
|
|
12
|
+
import { cClassConfig, cppClassConfig } from '../class-extractors/configs/c-cpp.js';
|
|
12
13
|
import { defineLanguage } from '../language-provider.js';
|
|
13
14
|
import { typeConfig as cCppConfig } from '../type-extractors/c-cpp.js';
|
|
14
15
|
import { cCppExportChecker } from '../export-detection.js';
|
|
15
|
-
import {
|
|
16
|
+
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
|
17
|
+
import { cImportConfig, cppImportConfig } from '../import-resolvers/configs/c-cpp.js';
|
|
16
18
|
import { C_QUERIES, CPP_QUERIES } from '../tree-sitter-queries.js';
|
|
17
19
|
/**
|
|
18
20
|
* Node types for standard function declarations that need C/C++ declarator handling.
|
|
@@ -29,6 +31,10 @@ import { createFieldExtractor } from '../field-extractors/generic.js';
|
|
|
29
31
|
import { cConfig as cFieldConfig, cppConfig as cppFieldConfig, } from '../field-extractors/configs/c-cpp.js';
|
|
30
32
|
import { createMethodExtractor } from '../method-extractors/generic.js';
|
|
31
33
|
import { cMethodConfig, cppMethodConfig } from '../method-extractors/configs/c-cpp.js';
|
|
34
|
+
import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
35
|
+
import { cVariableConfig, cppVariableConfig } from '../variable-extractors/configs/c-cpp.js';
|
|
36
|
+
import { createCallExtractor } from '../call-extractors/generic.js';
|
|
37
|
+
import { cCallConfig, cppCallConfig } from '../call-extractors/configs/c-cpp.js';
|
|
32
38
|
const C_BUILT_INS = new Set([
|
|
33
39
|
'printf',
|
|
34
40
|
'fprintf',
|
|
@@ -135,15 +141,8 @@ const C_BUILT_INS = new Set([
|
|
|
135
141
|
'get',
|
|
136
142
|
'put',
|
|
137
143
|
]);
|
|
138
|
-
const cClassExtractor = createClassExtractor(
|
|
139
|
-
|
|
140
|
-
typeDeclarationNodes: ['struct_specifier', 'enum_specifier'],
|
|
141
|
-
});
|
|
142
|
-
const cppClassExtractor = createClassExtractor({
|
|
143
|
-
language: SupportedLanguages.CPlusPlus,
|
|
144
|
-
typeDeclarationNodes: ['class_specifier', 'struct_specifier', 'enum_specifier'],
|
|
145
|
-
ancestorScopeNodeTypes: ['namespace_definition', 'class_specifier', 'struct_specifier'],
|
|
146
|
-
});
|
|
144
|
+
const cClassExtractor = createClassExtractor(cClassConfig);
|
|
145
|
+
const cppClassExtractor = createClassExtractor(cppClassConfig);
|
|
147
146
|
/**
|
|
148
147
|
* C/C++ function name extraction — unwraps pointer_declarator / reference_declarator /
|
|
149
148
|
* function_declarator / qualified_identifier chains to find the actual function name.
|
|
@@ -292,13 +291,15 @@ export const cProvider = defineLanguage({
|
|
|
292
291
|
treeSitterQueries: C_QUERIES,
|
|
293
292
|
typeConfig: cCppConfig,
|
|
294
293
|
exportChecker: cCppExportChecker,
|
|
295
|
-
importResolver:
|
|
294
|
+
importResolver: createImportResolver(cImportConfig),
|
|
296
295
|
importSemantics: 'wildcard-transitive',
|
|
296
|
+
callExtractor: createCallExtractor(cCallConfig),
|
|
297
297
|
fieldExtractor: createFieldExtractor(cFieldConfig),
|
|
298
298
|
methodExtractor: createMethodExtractor({
|
|
299
299
|
...cMethodConfig,
|
|
300
300
|
extractFunctionName: cCppExtractFunctionName,
|
|
301
301
|
}),
|
|
302
|
+
variableExtractor: createVariableExtractor(cVariableConfig),
|
|
302
303
|
classExtractor: cClassExtractor,
|
|
303
304
|
labelOverride: cppLabelOverride,
|
|
304
305
|
builtInNames: C_BUILT_INS,
|
|
@@ -309,14 +310,16 @@ export const cppProvider = defineLanguage({
|
|
|
309
310
|
treeSitterQueries: CPP_QUERIES,
|
|
310
311
|
typeConfig: cCppConfig,
|
|
311
312
|
exportChecker: cCppExportChecker,
|
|
312
|
-
importResolver:
|
|
313
|
+
importResolver: createImportResolver(cppImportConfig),
|
|
313
314
|
importSemantics: 'wildcard-transitive',
|
|
314
315
|
mroStrategy: 'leftmost-base',
|
|
316
|
+
callExtractor: createCallExtractor(cppCallConfig),
|
|
315
317
|
fieldExtractor: createFieldExtractor(cppFieldConfig),
|
|
316
318
|
methodExtractor: createMethodExtractor({
|
|
317
319
|
...cppMethodConfig,
|
|
318
320
|
extractFunctionName: cCppExtractFunctionName,
|
|
319
321
|
}),
|
|
322
|
+
variableExtractor: createVariableExtractor(cppVariableConfig),
|
|
320
323
|
classExtractor: cppClassExtractor,
|
|
321
324
|
labelOverride: cppLabelOverride,
|
|
322
325
|
builtInNames: C_BUILT_INS,
|
|
@@ -7,16 +7,22 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
9
9
|
import { createClassExtractor } from '../class-extractors/generic.js';
|
|
10
|
+
import { csharpClassConfig } from '../class-extractors/configs/csharp.js';
|
|
10
11
|
import { defineLanguage } from '../language-provider.js';
|
|
11
12
|
import { typeConfig as csharpConfig } from '../type-extractors/csharp.js';
|
|
12
13
|
import { csharpExportChecker } from '../export-detection.js';
|
|
13
|
-
import {
|
|
14
|
+
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
|
15
|
+
import { csharpImportConfig } from '../import-resolvers/configs/csharp.js';
|
|
14
16
|
import { extractCSharpNamedBindings } from '../named-bindings/csharp.js';
|
|
15
17
|
import { CSHARP_QUERIES } from '../tree-sitter-queries.js';
|
|
18
|
+
import { createCallExtractor } from '../call-extractors/generic.js';
|
|
19
|
+
import { csharpCallConfig } from '../call-extractors/configs/csharp.js';
|
|
16
20
|
import { createFieldExtractor } from '../field-extractors/generic.js';
|
|
17
21
|
import { csharpConfig as csharpFieldConfig } from '../field-extractors/configs/csharp.js';
|
|
18
22
|
import { createMethodExtractor } from '../method-extractors/generic.js';
|
|
19
23
|
import { csharpMethodConfig } from '../method-extractors/configs/csharp.js';
|
|
24
|
+
import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
25
|
+
import { csharpVariableConfig } from '../variable-extractors/configs/csharp.js';
|
|
20
26
|
const BUILT_INS = new Set([
|
|
21
27
|
'Console',
|
|
22
28
|
'WriteLine',
|
|
@@ -117,30 +123,14 @@ export const csharpProvider = defineLanguage({
|
|
|
117
123
|
treeSitterQueries: CSHARP_QUERIES,
|
|
118
124
|
typeConfig: csharpConfig,
|
|
119
125
|
exportChecker: csharpExportChecker,
|
|
120
|
-
importResolver:
|
|
126
|
+
importResolver: createImportResolver(csharpImportConfig),
|
|
121
127
|
namedBindingExtractor: extractCSharpNamedBindings,
|
|
122
128
|
interfaceNamePattern: /^I[A-Z]/,
|
|
123
129
|
mroStrategy: 'implements-split',
|
|
130
|
+
callExtractor: createCallExtractor(csharpCallConfig),
|
|
124
131
|
fieldExtractor: createFieldExtractor(csharpFieldConfig),
|
|
125
132
|
methodExtractor: createMethodExtractor(csharpMethodConfig),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
typeDeclarationNodes: [
|
|
129
|
-
'class_declaration',
|
|
130
|
-
'interface_declaration',
|
|
131
|
-
'struct_declaration',
|
|
132
|
-
'enum_declaration',
|
|
133
|
-
'record_declaration',
|
|
134
|
-
],
|
|
135
|
-
fileScopeNodeTypes: ['file_scoped_namespace_declaration'],
|
|
136
|
-
ancestorScopeNodeTypes: [
|
|
137
|
-
'namespace_declaration',
|
|
138
|
-
'class_declaration',
|
|
139
|
-
'interface_declaration',
|
|
140
|
-
'struct_declaration',
|
|
141
|
-
'enum_declaration',
|
|
142
|
-
'record_declaration',
|
|
143
|
-
],
|
|
144
|
-
}),
|
|
133
|
+
variableExtractor: createVariableExtractor(csharpVariableConfig),
|
|
134
|
+
classExtractor: createClassExtractor(csharpClassConfig),
|
|
145
135
|
builtInNames: BUILT_INS,
|
|
146
136
|
});
|
|
@@ -12,15 +12,21 @@
|
|
|
12
12
|
import { FUNCTION_NODE_TYPES } from '../utils/ast-helpers.js';
|
|
13
13
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
14
14
|
import { createClassExtractor } from '../class-extractors/generic.js';
|
|
15
|
+
import { dartClassConfig } from '../class-extractors/configs/dart.js';
|
|
15
16
|
import { defineLanguage } from '../language-provider.js';
|
|
16
17
|
import { typeConfig as dartConfig } from '../type-extractors/dart.js';
|
|
17
18
|
import { dartExportChecker } from '../export-detection.js';
|
|
18
|
-
import {
|
|
19
|
+
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
|
20
|
+
import { dartImportConfig } from '../import-resolvers/configs/dart.js';
|
|
19
21
|
import { DART_QUERIES } from '../tree-sitter-queries.js';
|
|
20
22
|
import { createFieldExtractor } from '../field-extractors/generic.js';
|
|
21
23
|
import { dartConfig as dartFieldConfig } from '../field-extractors/configs/dart.js';
|
|
22
24
|
import { createMethodExtractor } from '../method-extractors/generic.js';
|
|
23
25
|
import { dartMethodConfig } from '../method-extractors/configs/dart.js';
|
|
26
|
+
import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
27
|
+
import { dartVariableConfig } from '../variable-extractors/configs/dart.js';
|
|
28
|
+
import { createCallExtractor } from '../call-extractors/generic.js';
|
|
29
|
+
import { dartCallConfig } from '../call-extractors/configs/dart.js';
|
|
24
30
|
/**
|
|
25
31
|
* Resolve the enclosing function from a `function_body` node by looking at its
|
|
26
32
|
* previous sibling. In Dart's tree-sitter grammar, function_signature and
|
|
@@ -82,15 +88,13 @@ export const dartProvider = defineLanguage({
|
|
|
82
88
|
treeSitterQueries: DART_QUERIES,
|
|
83
89
|
typeConfig: dartConfig,
|
|
84
90
|
exportChecker: dartExportChecker,
|
|
85
|
-
importResolver:
|
|
91
|
+
importResolver: createImportResolver(dartImportConfig),
|
|
86
92
|
importSemantics: 'wildcard-leaf',
|
|
93
|
+
callExtractor: createCallExtractor(dartCallConfig),
|
|
87
94
|
fieldExtractor: createFieldExtractor(dartFieldConfig),
|
|
88
95
|
methodExtractor: createMethodExtractor(dartMethodConfig),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
typeDeclarationNodes: ['class_definition', 'extension_declaration', 'enum_declaration'],
|
|
92
|
-
ancestorScopeNodeTypes: ['class_definition', 'extension_declaration', 'enum_declaration'],
|
|
93
|
-
}),
|
|
96
|
+
variableExtractor: createVariableExtractor(dartVariableConfig),
|
|
97
|
+
classExtractor: createClassExtractor(dartClassConfig),
|
|
94
98
|
enclosingFunctionFinder: dartEnclosingFunctionFinder,
|
|
95
99
|
builtInNames: BUILT_INS,
|
|
96
100
|
});
|
|
@@ -10,41 +10,32 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
12
12
|
import { createClassExtractor } from '../class-extractors/generic.js';
|
|
13
|
+
import { goClassConfig } from '../class-extractors/configs/go.js';
|
|
13
14
|
import { defineLanguage } from '../language-provider.js';
|
|
14
15
|
import { typeConfig as goConfig } from '../type-extractors/go.js';
|
|
15
16
|
import { goExportChecker } from '../export-detection.js';
|
|
16
|
-
import {
|
|
17
|
+
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
|
18
|
+
import { goImportConfig } from '../import-resolvers/configs/go.js';
|
|
17
19
|
import { GO_QUERIES } from '../tree-sitter-queries.js';
|
|
18
20
|
import { createFieldExtractor } from '../field-extractors/generic.js';
|
|
19
21
|
import { goConfig as goFieldConfig } from '../field-extractors/configs/go.js';
|
|
20
22
|
import { createMethodExtractor } from '../method-extractors/generic.js';
|
|
21
23
|
import { goMethodConfig } from '../method-extractors/configs/go.js';
|
|
24
|
+
import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
25
|
+
import { goVariableConfig } from '../variable-extractors/configs/go.js';
|
|
26
|
+
import { createCallExtractor } from '../call-extractors/generic.js';
|
|
27
|
+
import { goCallConfig } from '../call-extractors/configs/go.js';
|
|
22
28
|
export const goProvider = defineLanguage({
|
|
23
29
|
id: SupportedLanguages.Go,
|
|
24
30
|
extensions: ['.go'],
|
|
25
31
|
treeSitterQueries: GO_QUERIES,
|
|
26
32
|
typeConfig: goConfig,
|
|
27
33
|
exportChecker: goExportChecker,
|
|
28
|
-
importResolver:
|
|
34
|
+
importResolver: createImportResolver(goImportConfig),
|
|
29
35
|
importSemantics: 'wildcard-leaf',
|
|
36
|
+
callExtractor: createCallExtractor(goCallConfig),
|
|
30
37
|
fieldExtractor: createFieldExtractor(goFieldConfig),
|
|
31
38
|
methodExtractor: createMethodExtractor(goMethodConfig),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
typeDeclarationNodes: ['type_declaration'],
|
|
35
|
-
fileScopeNodeTypes: ['package_clause'],
|
|
36
|
-
extractName(node) {
|
|
37
|
-
const typeSpec = node.namedChildren.find((child) => child.type === 'type_spec');
|
|
38
|
-
return typeSpec?.childForFieldName('name')?.text;
|
|
39
|
-
},
|
|
40
|
-
extractType(node) {
|
|
41
|
-
const typeSpec = node.namedChildren.find((child) => child.type === 'type_spec');
|
|
42
|
-
const typeNode = typeSpec?.childForFieldName('type');
|
|
43
|
-
if (typeNode?.type === 'struct_type')
|
|
44
|
-
return 'Struct';
|
|
45
|
-
if (typeNode?.type === 'interface_type')
|
|
46
|
-
return 'Interface';
|
|
47
|
-
return undefined;
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
39
|
+
variableExtractor: createVariableExtractor(goVariableConfig),
|
|
40
|
+
classExtractor: createClassExtractor(goClassConfig),
|
|
50
41
|
});
|
|
@@ -8,42 +8,35 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
10
10
|
import { createClassExtractor } from '../class-extractors/generic.js';
|
|
11
|
+
import { javaClassConfig } from '../class-extractors/configs/jvm.js';
|
|
11
12
|
import { defineLanguage } from '../language-provider.js';
|
|
12
13
|
import { javaTypeConfig } from '../type-extractors/jvm.js';
|
|
13
14
|
import { javaExportChecker } from '../export-detection.js';
|
|
14
|
-
import {
|
|
15
|
+
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
|
16
|
+
import { javaImportConfig } from '../import-resolvers/configs/jvm.js';
|
|
15
17
|
import { extractJavaNamedBindings } from '../named-bindings/java.js';
|
|
16
18
|
import { JAVA_QUERIES } from '../tree-sitter-queries.js';
|
|
19
|
+
import { createCallExtractor } from '../call-extractors/generic.js';
|
|
20
|
+
import { javaCallConfig } from '../call-extractors/configs/jvm.js';
|
|
17
21
|
import { createFieldExtractor } from '../field-extractors/generic.js';
|
|
18
22
|
import { javaConfig } from '../field-extractors/configs/jvm.js';
|
|
19
23
|
import { createMethodExtractor } from '../method-extractors/generic.js';
|
|
20
24
|
import { javaMethodConfig } from '../method-extractors/configs/jvm.js';
|
|
25
|
+
import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
26
|
+
import { javaVariableConfig } from '../variable-extractors/configs/jvm.js';
|
|
21
27
|
export const javaProvider = defineLanguage({
|
|
22
28
|
id: SupportedLanguages.Java,
|
|
23
29
|
extensions: ['.java'],
|
|
24
30
|
treeSitterQueries: JAVA_QUERIES,
|
|
25
31
|
typeConfig: javaTypeConfig,
|
|
26
32
|
exportChecker: javaExportChecker,
|
|
27
|
-
importResolver:
|
|
33
|
+
importResolver: createImportResolver(javaImportConfig),
|
|
28
34
|
namedBindingExtractor: extractJavaNamedBindings,
|
|
29
35
|
interfaceNamePattern: /^I[A-Z]/,
|
|
30
36
|
mroStrategy: 'implements-split',
|
|
37
|
+
callExtractor: createCallExtractor(javaCallConfig),
|
|
31
38
|
fieldExtractor: createFieldExtractor(javaConfig),
|
|
32
39
|
methodExtractor: createMethodExtractor(javaMethodConfig),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
typeDeclarationNodes: [
|
|
36
|
-
'class_declaration',
|
|
37
|
-
'interface_declaration',
|
|
38
|
-
'enum_declaration',
|
|
39
|
-
'record_declaration',
|
|
40
|
-
],
|
|
41
|
-
fileScopeNodeTypes: ['package_declaration'],
|
|
42
|
-
ancestorScopeNodeTypes: [
|
|
43
|
-
'class_declaration',
|
|
44
|
-
'interface_declaration',
|
|
45
|
-
'enum_declaration',
|
|
46
|
-
'record_declaration',
|
|
47
|
-
],
|
|
48
|
-
}),
|
|
40
|
+
variableExtractor: createVariableExtractor(javaVariableConfig),
|
|
41
|
+
classExtractor: createClassExtractor(javaClassConfig),
|
|
49
42
|
});
|
|
@@ -8,17 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
10
10
|
import { createClassExtractor } from '../class-extractors/generic.js';
|
|
11
|
+
import { kotlinClassConfig } from '../class-extractors/configs/jvm.js';
|
|
11
12
|
import { defineLanguage } from '../language-provider.js';
|
|
12
13
|
import { kotlinTypeConfig } from '../type-extractors/jvm.js';
|
|
13
14
|
import { kotlinExportChecker } from '../export-detection.js';
|
|
14
|
-
import {
|
|
15
|
+
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
|
16
|
+
import { kotlinImportConfig } from '../import-resolvers/configs/jvm.js';
|
|
15
17
|
import { extractKotlinNamedBindings } from '../named-bindings/kotlin.js';
|
|
16
18
|
import { appendKotlinWildcard } from '../import-resolvers/jvm.js';
|
|
17
19
|
import { KOTLIN_QUERIES } from '../tree-sitter-queries.js';
|
|
20
|
+
import { createCallExtractor } from '../call-extractors/generic.js';
|
|
21
|
+
import { kotlinCallConfig } from '../call-extractors/configs/jvm.js';
|
|
18
22
|
import { createFieldExtractor } from '../field-extractors/generic.js';
|
|
19
23
|
import { kotlinConfig } from '../field-extractors/configs/jvm.js';
|
|
20
24
|
import { createMethodExtractor } from '../method-extractors/generic.js';
|
|
21
25
|
import { kotlinMethodConfig } from '../method-extractors/configs/jvm.js';
|
|
26
|
+
import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
27
|
+
import { kotlinVariableConfig } from '../variable-extractors/configs/jvm.js';
|
|
22
28
|
/** Check if a Kotlin function_declaration capture is inside a class_body (i.e., a method).
|
|
23
29
|
* Kotlin grammar uses function_declaration for both top-level functions and class methods.
|
|
24
30
|
* Returns true when the captured definition node has a class_body ancestor. */
|
|
@@ -95,23 +101,15 @@ export const kotlinProvider = defineLanguage({
|
|
|
95
101
|
treeSitterQueries: KOTLIN_QUERIES,
|
|
96
102
|
typeConfig: kotlinTypeConfig,
|
|
97
103
|
exportChecker: kotlinExportChecker,
|
|
98
|
-
importResolver:
|
|
104
|
+
importResolver: createImportResolver(kotlinImportConfig),
|
|
99
105
|
namedBindingExtractor: extractKotlinNamedBindings,
|
|
100
106
|
importPathPreprocessor: appendKotlinWildcard,
|
|
101
107
|
mroStrategy: 'implements-split',
|
|
108
|
+
callExtractor: createCallExtractor(kotlinCallConfig),
|
|
102
109
|
fieldExtractor: createFieldExtractor(kotlinConfig),
|
|
103
110
|
methodExtractor: createMethodExtractor(kotlinMethodConfig),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
typeDeclarationNodes: ['class_declaration', 'object_declaration', 'companion_object'],
|
|
107
|
-
fileScopeNodeTypes: ['package_header'],
|
|
108
|
-
ancestorScopeNodeTypes: ['class_declaration', 'object_declaration', 'companion_object'],
|
|
109
|
-
extractType(node) {
|
|
110
|
-
if (node.type !== 'class_declaration')
|
|
111
|
-
return undefined;
|
|
112
|
-
return node.children.some((child) => child?.text === 'interface') ? 'Interface' : 'Class';
|
|
113
|
-
},
|
|
114
|
-
}),
|
|
111
|
+
variableExtractor: createVariableExtractor(kotlinVariableConfig),
|
|
112
|
+
classExtractor: createClassExtractor(kotlinClassConfig),
|
|
115
113
|
builtInNames: BUILT_INS,
|
|
116
114
|
labelOverride: (functionNode, defaultLabel) => {
|
|
117
115
|
if (defaultLabel !== 'Function')
|