gitnexus 1.6.2-rc.18 → 1.6.2-rc.19
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/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 +27 -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/languages/c-cpp.js +4 -3
- package/dist/core/ingestion/languages/csharp.js +3 -2
- package/dist/core/ingestion/languages/dart.js +3 -2
- package/dist/core/ingestion/languages/go.js +3 -2
- package/dist/core/ingestion/languages/java.js +3 -2
- package/dist/core/ingestion/languages/kotlin.js +3 -2
- package/dist/core/ingestion/languages/php.js +3 -2
- package/dist/core/ingestion/languages/python.js +3 -2
- package/dist/core/ingestion/languages/ruby.js +3 -2
- package/dist/core/ingestion/languages/rust.js +3 -2
- package/dist/core/ingestion/languages/swift.js +3 -2
- package/dist/core/ingestion/languages/typescript.js +4 -3
- package/dist/core/ingestion/languages/vue.js +3 -2
- package/package.json +1 -1
- 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,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C / C++ import resolution configs.
|
|
3
|
+
* Both use standard resolution for #include directives.
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig } from '../types.js';
|
|
6
|
+
export declare const cImportConfig: ImportResolutionConfig;
|
|
7
|
+
export declare const cppImportConfig: ImportResolutionConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C / C++ import resolution configs.
|
|
3
|
+
* Both use standard resolution for #include directives.
|
|
4
|
+
*/
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
import { createStandardStrategy } from '../standard.js';
|
|
7
|
+
export const cImportConfig = {
|
|
8
|
+
language: SupportedLanguages.C,
|
|
9
|
+
strategies: [createStandardStrategy(SupportedLanguages.C)],
|
|
10
|
+
};
|
|
11
|
+
export const cppImportConfig = {
|
|
12
|
+
language: SupportedLanguages.CPlusPlus,
|
|
13
|
+
strategies: [createStandardStrategy(SupportedLanguages.CPlusPlus)],
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C# import resolution config.
|
|
3
|
+
* Namespace-based strategy via .csproj configs, then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
|
6
|
+
/** C# namespace-based resolution strategy via .csproj configs. */
|
|
7
|
+
export declare const csharpNamespaceStrategy: ImportResolverStrategy;
|
|
8
|
+
export declare const csharpImportConfig: ImportResolutionConfig;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C# import resolution config.
|
|
3
|
+
* Namespace-based strategy via .csproj configs, then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
import { createStandardStrategy } from '../standard.js';
|
|
7
|
+
import { resolveCSharpImportInternal, resolveCSharpNamespaceDir } from '../csharp.js';
|
|
8
|
+
/** C# namespace-based resolution strategy via .csproj configs. */
|
|
9
|
+
export const csharpNamespaceStrategy = (rawImportPath, _filePath, ctx) => {
|
|
10
|
+
const csharpConfigs = ctx.configs.csharpConfigs;
|
|
11
|
+
if (csharpConfigs.length > 0) {
|
|
12
|
+
const resolvedFiles = resolveCSharpImportInternal(rawImportPath, csharpConfigs, ctx.normalizedFileList, ctx.allFileList, ctx.index);
|
|
13
|
+
if (resolvedFiles.length > 1) {
|
|
14
|
+
const dirSuffix = resolveCSharpNamespaceDir(rawImportPath, csharpConfigs);
|
|
15
|
+
if (dirSuffix) {
|
|
16
|
+
return { kind: 'package', files: resolvedFiles, dirSuffix };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (resolvedFiles.length > 0)
|
|
20
|
+
return { kind: 'files', files: resolvedFiles };
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
export const csharpImportConfig = {
|
|
25
|
+
language: SupportedLanguages.CSharp,
|
|
26
|
+
strategies: [csharpNamespaceStrategy, createStandardStrategy(SupportedLanguages.CSharp)],
|
|
27
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dart import resolution config.
|
|
3
|
+
* SDK/package strategy first, then relative import strategy (with ./ prepending).
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Dart SDK and package: import strategy.
|
|
8
|
+
* Absorbs dart: SDK imports and external packages (returns empty result to stop chain).
|
|
9
|
+
* Returns null for relative imports to let the next strategy handle them.
|
|
10
|
+
*/
|
|
11
|
+
export declare const dartPackageStrategy: ImportResolverStrategy;
|
|
12
|
+
/**
|
|
13
|
+
* Dart relative import strategy — prepends "./" for bare relative paths,
|
|
14
|
+
* then delegates to standard resolution.
|
|
15
|
+
*/
|
|
16
|
+
export declare const dartRelativeStrategy: ImportResolverStrategy;
|
|
17
|
+
export declare const dartImportConfig: ImportResolutionConfig;
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dart import resolution.
|
|
3
|
-
*
|
|
4
|
-
* SDK imports (dart:*) and external packages are skipped.
|
|
2
|
+
* Dart import resolution config.
|
|
3
|
+
* SDK/package strategy first, then relative import strategy (with ./ prepending).
|
|
5
4
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
import { resolveStandard } from '../standard.js';
|
|
7
|
+
/**
|
|
8
|
+
* Dart SDK and package: import strategy.
|
|
9
|
+
* Absorbs dart: SDK imports and external packages (returns empty result to stop chain).
|
|
10
|
+
* Returns null for relative imports to let the next strategy handle them.
|
|
11
|
+
*/
|
|
12
|
+
export const dartPackageStrategy = (rawImportPath, _filePath, ctx) => {
|
|
9
13
|
// Strip surrounding quotes from configurable_uri capture
|
|
10
14
|
const stripped = rawImportPath.replace(/^['"]|['"]$/g, '');
|
|
11
15
|
// Skip dart: SDK imports (dart:async, dart:io, etc.)
|
|
12
16
|
if (stripped.startsWith('dart:'))
|
|
13
|
-
return
|
|
17
|
+
return { kind: 'files', files: [] };
|
|
14
18
|
// Local package: imports → resolve to lib/<path>
|
|
15
19
|
if (stripped.startsWith('package:')) {
|
|
16
20
|
const slashIdx = stripped.indexOf('/');
|
|
17
21
|
if (slashIdx === -1)
|
|
18
|
-
return
|
|
22
|
+
return { kind: 'files', files: [] };
|
|
19
23
|
const relPath = stripped.slice(slashIdx + 1);
|
|
20
24
|
const candidates = [`lib/${relPath}`, relPath];
|
|
21
25
|
const files = [];
|
|
@@ -31,14 +35,20 @@ export function resolveDartImport(rawImportPath, filePath, ctx) {
|
|
|
31
35
|
}
|
|
32
36
|
if (files.length > 0)
|
|
33
37
|
return { kind: 'files', files };
|
|
34
|
-
return
|
|
38
|
+
return { kind: 'files', files: [] }; // external package
|
|
35
39
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Dart relative import strategy — prepends "./" for bare relative paths,
|
|
44
|
+
* then delegates to standard resolution.
|
|
45
|
+
*/
|
|
46
|
+
export const dartRelativeStrategy = (rawImportPath, filePath, ctx) => {
|
|
47
|
+
const stripped = rawImportPath.replace(/^['"]|['"]$/g, '');
|
|
42
48
|
const relPath = stripped.startsWith('.') ? stripped : './' + stripped;
|
|
43
49
|
return resolveStandard(relPath, filePath, ctx, SupportedLanguages.Dart);
|
|
44
|
-
}
|
|
50
|
+
};
|
|
51
|
+
export const dartImportConfig = {
|
|
52
|
+
language: SupportedLanguages.Dart,
|
|
53
|
+
strategies: [dartPackageStrategy, dartRelativeStrategy],
|
|
54
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go import resolution config.
|
|
3
|
+
* Go-specific package strategy (go.mod), then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
|
6
|
+
/** Go-specific package resolution strategy — resolves go.mod-based package imports. */
|
|
7
|
+
export declare const goPackageStrategy: ImportResolverStrategy;
|
|
8
|
+
export declare const goImportConfig: ImportResolutionConfig;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go import resolution config.
|
|
3
|
+
* Go-specific package strategy (go.mod), then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
import { createStandardStrategy } from '../standard.js';
|
|
7
|
+
import { resolveGoPackageDir, resolveGoPackage } from '../go.js';
|
|
8
|
+
/** Go-specific package resolution strategy — resolves go.mod-based package imports. */
|
|
9
|
+
export const goPackageStrategy = (rawImportPath, _filePath, ctx) => {
|
|
10
|
+
const goModule = ctx.configs.goModule;
|
|
11
|
+
if (goModule && rawImportPath.startsWith(goModule.modulePath)) {
|
|
12
|
+
const pkgSuffix = resolveGoPackageDir(rawImportPath, goModule);
|
|
13
|
+
if (pkgSuffix) {
|
|
14
|
+
const pkgFiles = resolveGoPackage(rawImportPath, goModule, ctx.normalizedFileList, ctx.allFileList);
|
|
15
|
+
if (pkgFiles.length > 0) {
|
|
16
|
+
return { kind: 'package', files: pkgFiles, dirSuffix: pkgSuffix };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Fall through if no files found (package might be external)
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
export const goImportConfig = {
|
|
24
|
+
language: SupportedLanguages.Go,
|
|
25
|
+
strategies: [goPackageStrategy, createStandardStrategy(SupportedLanguages.Go)],
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java / Kotlin import resolution configs.
|
|
3
|
+
* JVM-specific wildcard/member strategy, then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
|
6
|
+
/** Java JVM resolution strategy — wildcard and member import resolution. */
|
|
7
|
+
export declare const javaJvmStrategy: ImportResolverStrategy;
|
|
8
|
+
/**
|
|
9
|
+
* Kotlin JVM resolution strategy — wildcard/member with Java-interop + top-level function imports.
|
|
10
|
+
*/
|
|
11
|
+
export declare const kotlinJvmStrategy: ImportResolverStrategy;
|
|
12
|
+
export declare const javaImportConfig: ImportResolutionConfig;
|
|
13
|
+
export declare const kotlinImportConfig: ImportResolutionConfig;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java / Kotlin import resolution configs.
|
|
3
|
+
* JVM-specific wildcard/member strategy, then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
import { createStandardStrategy } from '../standard.js';
|
|
7
|
+
import { resolveJvmWildcard, resolveJvmMemberImport, KOTLIN_EXTENSIONS } from '../jvm.js';
|
|
8
|
+
/** Java JVM resolution strategy — wildcard and member import resolution. */
|
|
9
|
+
export const javaJvmStrategy = (rawImportPath, _filePath, ctx) => {
|
|
10
|
+
if (rawImportPath.endsWith('.*')) {
|
|
11
|
+
const matchedFiles = resolveJvmWildcard(rawImportPath, ctx.normalizedFileList, ctx.allFileList, ['.java'], ctx.index);
|
|
12
|
+
if (matchedFiles.length > 0)
|
|
13
|
+
return { kind: 'files', files: matchedFiles };
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const memberResolved = resolveJvmMemberImport(rawImportPath, ctx.normalizedFileList, ctx.allFileList, ['.java'], ctx.index);
|
|
17
|
+
if (memberResolved)
|
|
18
|
+
return { kind: 'files', files: [memberResolved] };
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Kotlin JVM resolution strategy — wildcard/member with Java-interop + top-level function imports.
|
|
24
|
+
*/
|
|
25
|
+
export const kotlinJvmStrategy = (rawImportPath, _filePath, ctx) => {
|
|
26
|
+
if (rawImportPath.endsWith('.*')) {
|
|
27
|
+
const matchedFiles = resolveJvmWildcard(rawImportPath, ctx.normalizedFileList, ctx.allFileList, KOTLIN_EXTENSIONS, ctx.index);
|
|
28
|
+
if (matchedFiles.length === 0) {
|
|
29
|
+
const javaMatches = resolveJvmWildcard(rawImportPath, ctx.normalizedFileList, ctx.allFileList, ['.java'], ctx.index);
|
|
30
|
+
if (javaMatches.length > 0)
|
|
31
|
+
return { kind: 'files', files: javaMatches };
|
|
32
|
+
}
|
|
33
|
+
if (matchedFiles.length > 0)
|
|
34
|
+
return { kind: 'files', files: matchedFiles };
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
let memberResolved = resolveJvmMemberImport(rawImportPath, ctx.normalizedFileList, ctx.allFileList, KOTLIN_EXTENSIONS, ctx.index);
|
|
38
|
+
if (!memberResolved) {
|
|
39
|
+
memberResolved = resolveJvmMemberImport(rawImportPath, ctx.normalizedFileList, ctx.allFileList, ['.java'], ctx.index);
|
|
40
|
+
}
|
|
41
|
+
if (memberResolved)
|
|
42
|
+
return { kind: 'files', files: [memberResolved] };
|
|
43
|
+
// Kotlin: top-level function imports (e.g. import models.getUser) have only 2 segments,
|
|
44
|
+
// which resolveJvmMemberImport skips (requires >=3). Fall back to package-directory scan
|
|
45
|
+
// for lowercase last segments (function/property imports). Uppercase last segments
|
|
46
|
+
// (class imports like models.User) fall through to standard suffix resolution.
|
|
47
|
+
const segments = rawImportPath.split('.');
|
|
48
|
+
const lastSeg = segments[segments.length - 1];
|
|
49
|
+
if (segments.length >= 2 && lastSeg[0] && lastSeg[0] === lastSeg[0].toLowerCase()) {
|
|
50
|
+
const pkgWildcard = segments.slice(0, -1).join('.') + '.*';
|
|
51
|
+
let dirFiles = resolveJvmWildcard(pkgWildcard, ctx.normalizedFileList, ctx.allFileList, KOTLIN_EXTENSIONS, ctx.index);
|
|
52
|
+
if (dirFiles.length === 0) {
|
|
53
|
+
dirFiles = resolveJvmWildcard(pkgWildcard, ctx.normalizedFileList, ctx.allFileList, ['.java'], ctx.index);
|
|
54
|
+
}
|
|
55
|
+
if (dirFiles.length > 0)
|
|
56
|
+
return { kind: 'files', files: dirFiles };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
61
|
+
export const javaImportConfig = {
|
|
62
|
+
language: SupportedLanguages.Java,
|
|
63
|
+
strategies: [javaJvmStrategy, createStandardStrategy(SupportedLanguages.Java)],
|
|
64
|
+
};
|
|
65
|
+
export const kotlinImportConfig = {
|
|
66
|
+
language: SupportedLanguages.Kotlin,
|
|
67
|
+
strategies: [kotlinJvmStrategy, createStandardStrategy(SupportedLanguages.Kotlin)],
|
|
68
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PHP import resolution config.
|
|
3
|
+
* PSR-4 strategy via composer.json — no standard fallback (PSR-4 includes its own suffix matching).
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
|
6
|
+
/** PHP PSR-4 resolution strategy via composer.json autoload mappings. */
|
|
7
|
+
export declare const phpPsr4Strategy: ImportResolverStrategy;
|
|
8
|
+
export declare const phpImportConfig: ImportResolutionConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PHP import resolution config.
|
|
3
|
+
* PSR-4 strategy via composer.json — no standard fallback (PSR-4 includes its own suffix matching).
|
|
4
|
+
*/
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
import { resolvePhpImportInternal } from '../php.js';
|
|
7
|
+
/** PHP PSR-4 resolution strategy via composer.json autoload mappings. */
|
|
8
|
+
export const phpPsr4Strategy = (rawImportPath, _filePath, ctx) => {
|
|
9
|
+
const resolved = resolvePhpImportInternal(rawImportPath, ctx.configs.composerConfig, ctx.allFilePaths, ctx.normalizedFileList, ctx.allFileList, ctx.index);
|
|
10
|
+
return resolved ? { kind: 'files', files: [resolved] } : null;
|
|
11
|
+
};
|
|
12
|
+
export const phpImportConfig = {
|
|
13
|
+
language: SupportedLanguages.PHP,
|
|
14
|
+
strategies: [phpPsr4Strategy],
|
|
15
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python import resolution config.
|
|
3
|
+
* PEP 328 relative + proximity-based strategy, then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Python import resolution strategy — PEP 328 relative + proximity-based bare imports.
|
|
8
|
+
* Returns null to continue chain for non-relative imports.
|
|
9
|
+
* Absorbs unresolved relative imports (returns empty result to stop the chain).
|
|
10
|
+
*/
|
|
11
|
+
export declare const pythonImportStrategy: ImportResolverStrategy;
|
|
12
|
+
export declare const pythonImportConfig: ImportResolutionConfig;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python import resolution config.
|
|
3
|
+
* PEP 328 relative + proximity-based strategy, then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
import { createStandardStrategy } from '../standard.js';
|
|
7
|
+
import { resolvePythonImportInternal } from '../python.js';
|
|
8
|
+
/**
|
|
9
|
+
* Python import resolution strategy — PEP 328 relative + proximity-based bare imports.
|
|
10
|
+
* Returns null to continue chain for non-relative imports.
|
|
11
|
+
* Absorbs unresolved relative imports (returns empty result to stop the chain).
|
|
12
|
+
*/
|
|
13
|
+
export const pythonImportStrategy = (rawImportPath, filePath, ctx) => {
|
|
14
|
+
const resolved = resolvePythonImportInternal(filePath, rawImportPath, ctx.allFilePaths);
|
|
15
|
+
if (resolved) {
|
|
16
|
+
ctx.resolveCache.set(`${filePath}::${rawImportPath}`, resolved);
|
|
17
|
+
return { kind: 'files', files: [resolved] };
|
|
18
|
+
}
|
|
19
|
+
// PEP 328: unresolved relative imports should not fall through to suffix matching
|
|
20
|
+
if (rawImportPath.startsWith('.'))
|
|
21
|
+
return { kind: 'files', files: [] };
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
export const pythonImportConfig = {
|
|
25
|
+
language: SupportedLanguages.Python,
|
|
26
|
+
strategies: [pythonImportStrategy, createStandardStrategy(SupportedLanguages.Python)],
|
|
27
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ruby import resolution config.
|
|
3
|
+
* Require/require_relative suffix matching — no standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
|
6
|
+
/** Ruby require/require_relative resolution strategy. */
|
|
7
|
+
export declare const rubyRequireStrategy: ImportResolverStrategy;
|
|
8
|
+
export declare const rubyImportConfig: ImportResolutionConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ruby import resolution config.
|
|
3
|
+
* Require/require_relative suffix matching — no standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
import { suffixResolve } from '../utils.js';
|
|
7
|
+
/** Ruby require/require_relative resolution strategy. */
|
|
8
|
+
export const rubyRequireStrategy = (rawImportPath, _filePath, ctx) => {
|
|
9
|
+
const pathParts = rawImportPath.replace(/^\.\//, '').split('/').filter(Boolean);
|
|
10
|
+
const resolved = suffixResolve(pathParts, ctx.normalizedFileList, ctx.allFileList, ctx.index);
|
|
11
|
+
return resolved ? { kind: 'files', files: [resolved] } : null;
|
|
12
|
+
};
|
|
13
|
+
export const rubyImportConfig = {
|
|
14
|
+
language: SupportedLanguages.Ruby,
|
|
15
|
+
strategies: [rubyRequireStrategy],
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rust import resolution config.
|
|
3
|
+
* Rust module strategy (grouped imports, crate/super/self paths), then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
|
6
|
+
/** Rust module resolution strategy — handles grouped imports and crate/super/self paths. */
|
|
7
|
+
export declare const rustModuleStrategy: ImportResolverStrategy;
|
|
8
|
+
export declare const rustImportConfig: ImportResolutionConfig;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rust import resolution config.
|
|
3
|
+
* Rust module strategy (grouped imports, crate/super/self paths), then standard fallback.
|
|
4
|
+
*/
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
import { createStandardStrategy } from '../standard.js';
|
|
7
|
+
import { resolveRustImportInternal } from '../rust.js';
|
|
8
|
+
/** Rust module resolution strategy — handles grouped imports and crate/super/self paths. */
|
|
9
|
+
export const rustModuleStrategy = (rawImportPath, filePath, ctx) => {
|
|
10
|
+
// Top-level grouped: use {crate::a, crate::b}
|
|
11
|
+
if (rawImportPath.startsWith('{') && rawImportPath.endsWith('}')) {
|
|
12
|
+
const inner = rawImportPath.slice(1, -1);
|
|
13
|
+
const parts = inner
|
|
14
|
+
.split(',')
|
|
15
|
+
.map((p) => p.trim())
|
|
16
|
+
.filter(Boolean);
|
|
17
|
+
const resolved = [];
|
|
18
|
+
for (const part of parts) {
|
|
19
|
+
const r = resolveRustImportInternal(filePath, part, ctx.allFilePaths);
|
|
20
|
+
if (r)
|
|
21
|
+
resolved.push(r);
|
|
22
|
+
}
|
|
23
|
+
return resolved.length > 0 ? { kind: 'files', files: resolved } : null;
|
|
24
|
+
}
|
|
25
|
+
// Scoped grouped: use crate::models::{User, Repo}
|
|
26
|
+
const braceIdx = rawImportPath.indexOf('::{');
|
|
27
|
+
if (braceIdx !== -1 && rawImportPath.endsWith('}')) {
|
|
28
|
+
const pathPrefix = rawImportPath.substring(0, braceIdx);
|
|
29
|
+
const braceContent = rawImportPath.substring(braceIdx + 3, rawImportPath.length - 1);
|
|
30
|
+
const items = braceContent
|
|
31
|
+
.split(',')
|
|
32
|
+
.map((s) => s.trim())
|
|
33
|
+
.filter(Boolean);
|
|
34
|
+
const resolved = [];
|
|
35
|
+
for (const item of items) {
|
|
36
|
+
// Handle `use crate::models::{User, Repo as R}` — strip alias for resolution
|
|
37
|
+
const itemName = item.includes(' as ') ? item.split(' as ')[0].trim() : item;
|
|
38
|
+
const r = resolveRustImportInternal(filePath, `${pathPrefix}::${itemName}`, ctx.allFilePaths);
|
|
39
|
+
if (r)
|
|
40
|
+
resolved.push(r);
|
|
41
|
+
}
|
|
42
|
+
if (resolved.length > 0)
|
|
43
|
+
return { kind: 'files', files: resolved };
|
|
44
|
+
// Fallback: resolve the prefix path itself (e.g. crate::models -> models.rs)
|
|
45
|
+
const prefixResult = resolveRustImportInternal(filePath, pathPrefix, ctx.allFilePaths);
|
|
46
|
+
if (prefixResult)
|
|
47
|
+
return { kind: 'files', files: [prefixResult] };
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
};
|
|
51
|
+
export const rustImportConfig = {
|
|
52
|
+
language: SupportedLanguages.Rust,
|
|
53
|
+
strategies: [rustModuleStrategy, createStandardStrategy(SupportedLanguages.Rust)],
|
|
54
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swift import resolution config.
|
|
3
|
+
* Package.swift target map strategy — no standard fallback (unresolved = external framework).
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
|
6
|
+
/** Swift Package.swift target map resolution strategy. */
|
|
7
|
+
export declare const swiftPackageStrategy: ImportResolverStrategy;
|
|
8
|
+
export declare const swiftImportConfig: ImportResolutionConfig;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Swift
|
|
3
|
-
*
|
|
2
|
+
* Swift import resolution config.
|
|
3
|
+
* Package.swift target map strategy — no standard fallback (unresolved = external framework).
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
6
|
+
/** Swift Package.swift target map resolution strategy. */
|
|
7
|
+
export const swiftPackageStrategy = (rawImportPath, _filePath, ctx) => {
|
|
7
8
|
const swiftPackageConfig = ctx.configs.swiftPackageConfig;
|
|
8
9
|
if (swiftPackageConfig) {
|
|
9
10
|
const targetDir = swiftPackageConfig.targets.get(rawImportPath);
|
|
@@ -21,4 +22,8 @@ export function resolveSwiftImport(rawImportPath, _filePath, ctx) {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
return null; // External framework (Foundation, UIKit, etc.)
|
|
24
|
-
}
|
|
25
|
+
};
|
|
26
|
+
export const swiftImportConfig = {
|
|
27
|
+
language: SupportedLanguages.Swift,
|
|
28
|
+
strategies: [swiftPackageStrategy],
|
|
29
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript / JavaScript / Vue import resolution configs.
|
|
3
|
+
* All use standard resolution — TS/JS with tsconfig path aliases,
|
|
4
|
+
* Vue delegates to TypeScript's resolver.
|
|
5
|
+
*/
|
|
6
|
+
import type { ImportResolutionConfig } from '../types.js';
|
|
7
|
+
export declare const typescriptImportConfig: ImportResolutionConfig;
|
|
8
|
+
export declare const javascriptImportConfig: ImportResolutionConfig;
|
|
9
|
+
export declare const vueImportConfig: ImportResolutionConfig;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript / JavaScript / Vue import resolution configs.
|
|
3
|
+
* All use standard resolution — TS/JS with tsconfig path aliases,
|
|
4
|
+
* Vue delegates to TypeScript's resolver.
|
|
5
|
+
*/
|
|
6
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
7
|
+
import { createStandardStrategy } from '../standard.js';
|
|
8
|
+
export const typescriptImportConfig = {
|
|
9
|
+
language: SupportedLanguages.TypeScript,
|
|
10
|
+
strategies: [createStandardStrategy(SupportedLanguages.TypeScript)],
|
|
11
|
+
};
|
|
12
|
+
export const javascriptImportConfig = {
|
|
13
|
+
language: SupportedLanguages.JavaScript,
|
|
14
|
+
strategies: [createStandardStrategy(SupportedLanguages.JavaScript)],
|
|
15
|
+
};
|
|
16
|
+
// Vue SFCs are preprocessed into TypeScript upstream of import resolution,
|
|
17
|
+
// so the resolver intentionally runs as TypeScript. `language: Vue` here is
|
|
18
|
+
// documentation-only metadata (see `ImportResolutionConfig.language` JSDoc
|
|
19
|
+
// and ARCHITECTURE.md §Vue); it is not consumed by `createImportResolver`.
|
|
20
|
+
export const vueImportConfig = {
|
|
21
|
+
language: SupportedLanguages.Vue,
|
|
22
|
+
strategies: [createStandardStrategy(SupportedLanguages.TypeScript)],
|
|
23
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* C# namespace import resolution.
|
|
3
|
-
*
|
|
2
|
+
* C# namespace import resolution — internal helpers.
|
|
3
|
+
*
|
|
4
|
+
* Strategy lives in configs/csharp.ts.
|
|
5
|
+
* This file contains shared helpers for namespace-based resolution.
|
|
4
6
|
*/
|
|
5
7
|
import type { SuffixIndex } from './utils.js';
|
|
6
|
-
import type { ImportResult, ResolveCtx } from './types.js';
|
|
7
8
|
import type { CSharpProjectConfig } from '../language-config.js';
|
|
8
9
|
/**
|
|
9
10
|
* Resolve a C# using-directive import path to matching .cs files (low-level helper).
|
|
@@ -15,5 +16,3 @@ export declare function resolveCSharpImportInternal(importPath: string, csharpCo
|
|
|
15
16
|
* Returns a suffix like "/ProjectDir/Models/" or null if no config matches.
|
|
16
17
|
*/
|
|
17
18
|
export declare function resolveCSharpNamespaceDir(importPath: string, csharpConfigs: CSharpProjectConfig[]): string | null;
|
|
18
|
-
/** C#: namespace-based resolution via .csproj configs, with suffix-match fallback. */
|
|
19
|
-
export declare function resolveCSharpImport(rawImportPath: string, filePath: string, ctx: ResolveCtx): ImportResult;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* C# namespace import resolution.
|
|
3
|
-
*
|
|
2
|
+
* C# namespace import resolution — internal helpers.
|
|
3
|
+
*
|
|
4
|
+
* Strategy lives in configs/csharp.ts.
|
|
5
|
+
* This file contains shared helpers for namespace-based resolution.
|
|
4
6
|
*/
|
|
5
7
|
import { suffixResolve } from './utils.js';
|
|
6
|
-
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
7
|
-
import { resolveStandard } from './standard.js';
|
|
8
8
|
/**
|
|
9
9
|
* Resolve a C# using-directive import path to matching .cs files (low-level helper).
|
|
10
10
|
* Tries single-file match first, then directory match for namespace imports.
|
|
@@ -113,19 +113,3 @@ export function resolveCSharpNamespaceDir(importPath, csharpConfigs) {
|
|
|
113
113
|
}
|
|
114
114
|
return null;
|
|
115
115
|
}
|
|
116
|
-
/** C#: namespace-based resolution via .csproj configs, with suffix-match fallback. */
|
|
117
|
-
export function resolveCSharpImport(rawImportPath, filePath, ctx) {
|
|
118
|
-
const csharpConfigs = ctx.configs.csharpConfigs;
|
|
119
|
-
if (csharpConfigs.length > 0) {
|
|
120
|
-
const resolvedFiles = resolveCSharpImportInternal(rawImportPath, csharpConfigs, ctx.normalizedFileList, ctx.allFileList, ctx.index);
|
|
121
|
-
if (resolvedFiles.length > 1) {
|
|
122
|
-
const dirSuffix = resolveCSharpNamespaceDir(rawImportPath, csharpConfigs);
|
|
123
|
-
if (dirSuffix) {
|
|
124
|
-
return { kind: 'package', files: resolvedFiles, dirSuffix };
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (resolvedFiles.length > 0)
|
|
128
|
-
return { kind: 'files', files: resolvedFiles };
|
|
129
|
-
}
|
|
130
|
-
return resolveStandard(rawImportPath, filePath, ctx, SupportedLanguages.CSharp);
|
|
131
|
-
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Go package import resolution.
|
|
3
|
-
*
|
|
2
|
+
* Go package import resolution — internal helpers.
|
|
3
|
+
*
|
|
4
|
+
* Strategy lives in configs/go.ts.
|
|
5
|
+
* This file contains the shared helpers used by the strategy.
|
|
4
6
|
*/
|
|
5
|
-
import type { ImportResult, ResolveCtx } from './types.js';
|
|
6
7
|
import type { GoModuleConfig } from '../language-config.js';
|
|
7
8
|
/**
|
|
8
9
|
* Extract the package directory suffix from a Go import path.
|
|
@@ -14,5 +15,3 @@ export declare function resolveGoPackageDir(importPath: string, goModule: GoModu
|
|
|
14
15
|
* Returns an array of file paths.
|
|
15
16
|
*/
|
|
16
17
|
export declare function resolveGoPackage(importPath: string, goModule: GoModuleConfig, normalizedFileList: string[], allFileList: string[]): string[];
|
|
17
|
-
/** Go: package-level imports via go.mod module path. */
|
|
18
|
-
export declare function resolveGoImport(rawImportPath: string, filePath: string, ctx: ResolveCtx): ImportResult;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Go package import resolution.
|
|
3
|
-
*
|
|
2
|
+
* Go package import resolution — internal helpers.
|
|
3
|
+
*
|
|
4
|
+
* Strategy lives in configs/go.ts.
|
|
5
|
+
* This file contains the shared helpers used by the strategy.
|
|
4
6
|
*/
|
|
5
|
-
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
6
|
-
import { resolveStandard } from './standard.js';
|
|
7
7
|
/**
|
|
8
8
|
* Extract the package directory suffix from a Go import path.
|
|
9
9
|
* Returns the suffix string (e.g., "/internal/auth/") or null if invalid.
|
|
@@ -44,18 +44,3 @@ export function resolveGoPackage(importPath, goModule, normalizedFileList, allFi
|
|
|
44
44
|
}
|
|
45
45
|
return matches;
|
|
46
46
|
}
|
|
47
|
-
/** Go: package-level imports via go.mod module path. */
|
|
48
|
-
export function resolveGoImport(rawImportPath, filePath, ctx) {
|
|
49
|
-
const goModule = ctx.configs.goModule;
|
|
50
|
-
if (goModule && rawImportPath.startsWith(goModule.modulePath)) {
|
|
51
|
-
const pkgSuffix = resolveGoPackageDir(rawImportPath, goModule);
|
|
52
|
-
if (pkgSuffix) {
|
|
53
|
-
const pkgFiles = resolveGoPackage(rawImportPath, goModule, ctx.normalizedFileList, ctx.allFileList);
|
|
54
|
-
if (pkgFiles.length > 0) {
|
|
55
|
-
return { kind: 'package', files: pkgFiles, dirSuffix: pkgSuffix };
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// Fall through if no files found (package might be external)
|
|
59
|
-
}
|
|
60
|
-
return resolveStandard(rawImportPath, filePath, ctx, SupportedLanguages.Go);
|
|
61
|
-
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* JVM import resolution (Java + Kotlin).
|
|
3
|
-
*
|
|
2
|
+
* JVM import resolution — internal helpers (Java + Kotlin).
|
|
3
|
+
*
|
|
4
|
+
* Strategies live in configs/jvm.ts.
|
|
5
|
+
* This file contains shared helpers for wildcard/member resolution
|
|
6
|
+
* and the Kotlin wildcard preprocessor.
|
|
4
7
|
*/
|
|
5
8
|
import type { SuffixIndex } from './utils.js';
|
|
6
9
|
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
|
7
|
-
import type { ImportResult, ResolveCtx } from './types.js';
|
|
8
10
|
/** Kotlin file extensions for JVM resolver reuse */
|
|
9
11
|
export declare const KOTLIN_EXTENSIONS: readonly string[];
|
|
10
12
|
/**
|
|
@@ -23,10 +25,3 @@ export declare function resolveJvmWildcard(importPath: string, normalizedFileLis
|
|
|
23
25
|
* Kotlin: "com.example.Constants.VALUE" -> resolve "com.example.Constants"
|
|
24
26
|
*/
|
|
25
27
|
export declare function resolveJvmMemberImport(importPath: string, normalizedFileList: string[], allFileList: string[], extensions: readonly string[], index?: SuffixIndex): string | null;
|
|
26
|
-
/** Java: JVM wildcard -> member import -> standard fallthrough */
|
|
27
|
-
export declare function resolveJavaImport(rawImportPath: string, filePath: string, ctx: ResolveCtx): ImportResult;
|
|
28
|
-
/**
|
|
29
|
-
* Kotlin: JVM wildcard/member with Java-interop fallback -> top-level function imports -> standard.
|
|
30
|
-
* Kotlin can import from .kt/.kts files OR from .java files (Java interop).
|
|
31
|
-
*/
|
|
32
|
-
export declare function resolveKotlinImport(rawImportPath: string, filePath: string, ctx: ResolveCtx): ImportResult;
|