@aroman22/codegraph-vba 1.3.3
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 +855 -0
- package/dist/bin/codegraph.d.ts +26 -0
- package/dist/bin/command-supervision.d.ts +12 -0
- package/dist/bin/fatal-handler.d.ts +20 -0
- package/dist/bin/node-version-check.d.ts +37 -0
- package/dist/bin/uninstall.d.ts +14 -0
- package/dist/context/formatter.d.ts +30 -0
- package/dist/context/index.d.ts +119 -0
- package/dist/context/markers.d.ts +19 -0
- package/dist/db/index.d.ts +122 -0
- package/dist/db/migrations.d.ts +44 -0
- package/dist/db/queries.d.ts +402 -0
- package/dist/db/sqlite-adapter.d.ts +53 -0
- package/dist/directory.d.ts +179 -0
- package/dist/errors.d.ts +136 -0
- package/dist/extraction/astro-extractor.d.ts +79 -0
- package/dist/extraction/dfm-extractor.d.ts +31 -0
- package/dist/extraction/extraction-version.d.ts +25 -0
- package/dist/extraction/function-ref.d.ts +118 -0
- package/dist/extraction/generated-detection.d.ts +30 -0
- package/dist/extraction/grammars.d.ts +128 -0
- package/dist/extraction/index.d.ts +187 -0
- package/dist/extraction/languages/c-cpp.d.ts +12 -0
- package/dist/extraction/languages/csharp.d.ts +25 -0
- package/dist/extraction/languages/dart.d.ts +3 -0
- package/dist/extraction/languages/go.d.ts +3 -0
- package/dist/extraction/languages/index.d.ts +10 -0
- package/dist/extraction/languages/java.d.ts +3 -0
- package/dist/extraction/languages/javascript.d.ts +3 -0
- package/dist/extraction/languages/kotlin.d.ts +3 -0
- package/dist/extraction/languages/lua.d.ts +3 -0
- package/dist/extraction/languages/luau.d.ts +3 -0
- package/dist/extraction/languages/objc.d.ts +3 -0
- package/dist/extraction/languages/pascal.d.ts +3 -0
- package/dist/extraction/languages/php.d.ts +3 -0
- package/dist/extraction/languages/python.d.ts +3 -0
- package/dist/extraction/languages/r.d.ts +3 -0
- package/dist/extraction/languages/ruby.d.ts +3 -0
- package/dist/extraction/languages/rust.d.ts +3 -0
- package/dist/extraction/languages/scala.d.ts +3 -0
- package/dist/extraction/languages/swift.d.ts +3 -0
- package/dist/extraction/languages/typescript.d.ts +16 -0
- package/dist/extraction/liquid-extractor.d.ts +59 -0
- package/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/dist/extraction/parse-pool.d.ts +126 -0
- package/dist/extraction/parse-worker.d.ts +8 -0
- package/dist/extraction/razor-extractor.d.ts +42 -0
- package/dist/extraction/sql-query-extractor.d.ts +25 -0
- package/dist/extraction/svelte-extractor.d.ts +56 -0
- package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/dist/extraction/tree-sitter-types.d.ts +239 -0
- package/dist/extraction/tree-sitter.d.ts +647 -0
- package/dist/extraction/vba-extractor.d.ts +394 -0
- package/dist/extraction/vba-form-extractor.d.ts +89 -0
- package/dist/extraction/vba-preprocess.d.ts +81 -0
- package/dist/extraction/vue-extractor.d.ts +51 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
- package/dist/graph/index.d.ts +8 -0
- package/dist/graph/queries.d.ts +106 -0
- package/dist/graph/traversal.d.ts +127 -0
- package/dist/index.d.ts +563 -0
- package/dist/installer/config-writer.d.ts +28 -0
- package/dist/installer/index.d.ts +100 -0
- package/dist/installer/instructions-template.d.ts +41 -0
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/claude.d.ts +62 -0
- package/dist/installer/targets/codex.d.ts +18 -0
- package/dist/installer/targets/cursor.d.ts +35 -0
- package/dist/installer/targets/gemini.d.ts +26 -0
- package/dist/installer/targets/hermes.d.ts +18 -0
- package/dist/installer/targets/kiro.d.ts +27 -0
- package/dist/installer/targets/opencode.d.ts +38 -0
- package/dist/installer/targets/registry.d.ts +35 -0
- package/dist/installer/targets/shared.d.ts +101 -0
- package/dist/installer/targets/toml.d.ts +52 -0
- package/dist/installer/targets/types.d.ts +108 -0
- package/dist/mcp/daemon-manager.d.ts +42 -0
- package/dist/mcp/daemon-paths.d.ts +73 -0
- package/dist/mcp/daemon-registry.d.ts +47 -0
- package/dist/mcp/daemon.d.ts +258 -0
- package/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/dist/mcp/engine.d.ts +122 -0
- package/dist/mcp/index.d.ts +113 -0
- package/dist/mcp/liveness-watchdog.d.ts +18 -0
- package/dist/mcp/ppid-watchdog.d.ts +62 -0
- package/dist/mcp/proxy.d.ts +87 -0
- package/dist/mcp/query-pool.d.ts +94 -0
- package/dist/mcp/query-worker.d.ts +24 -0
- package/dist/mcp/server-instructions.d.ts +34 -0
- package/dist/mcp/session.d.ts +79 -0
- package/dist/mcp/stdin-teardown.d.ts +27 -0
- package/dist/mcp/tools.d.ts +591 -0
- package/dist/mcp/transport.d.ts +188 -0
- package/dist/mcp/version.d.ts +19 -0
- package/dist/project-config.d.ts +56 -0
- package/dist/reasoning/config.d.ts +45 -0
- package/dist/reasoning/credentials.d.ts +5 -0
- package/dist/reasoning/login.d.ts +21 -0
- package/dist/reasoning/reasoner.d.ts +43 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts +5 -0
- package/dist/resolution/callback-synthesizer.d.ts +15 -0
- package/dist/resolution/frameworks/astro.d.ts +9 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/express.d.ts +8 -0
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/go.d.ts +8 -0
- package/dist/resolution/frameworks/goframe.d.ts +41 -0
- package/dist/resolution/frameworks/index.d.ts +50 -0
- package/dist/resolution/frameworks/java.d.ts +8 -0
- package/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/python.d.ts +10 -0
- package/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/dist/resolution/frameworks/react.d.ts +8 -0
- package/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/dist/resolution/frameworks/rust.d.ts +8 -0
- package/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift.d.ts +10 -0
- package/dist/resolution/frameworks/vue.d.ts +9 -0
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/goframe-synthesizer.d.ts +28 -0
- package/dist/resolution/import-resolver.d.ts +78 -0
- package/dist/resolution/index.d.ts +196 -0
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/name-matcher.d.ts +93 -0
- package/dist/resolution/path-aliases.d.ts +68 -0
- package/dist/resolution/strip-comments.d.ts +27 -0
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/types.d.ts +233 -0
- package/dist/resolution/workspace-packages.d.ts +48 -0
- package/dist/search/query-parser.d.ts +57 -0
- package/dist/search/query-utils.d.ts +87 -0
- package/dist/sync/git-hooks.d.ts +45 -0
- package/dist/sync/index.d.ts +19 -0
- package/dist/sync/watch-policy.d.ts +48 -0
- package/dist/sync/watcher.d.ts +358 -0
- package/dist/sync/worktree.d.ts +54 -0
- package/dist/telemetry/index.d.ts +143 -0
- package/dist/types.d.ts +409 -0
- package/dist/ui/glyphs.d.ts +42 -0
- package/dist/ui/shimmer-progress.d.ts +11 -0
- package/dist/ui/shimmer-worker.d.ts +2 -0
- package/dist/ui/types.d.ts +17 -0
- package/dist/upgrade/index.d.ts +132 -0
- package/dist/utils.d.ts +224 -0
- package/npm-sdk.js +75 -0
- package/npm-shim.js +246 -0
- package/package.json +32 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NestJS Framework Resolver
|
|
3
|
+
*
|
|
4
|
+
* Handles NestJS decorator-based routing across its transport layers:
|
|
5
|
+
* - HTTP: @Controller(prefix) + @Get/@Post/@Put/@Patch/@Delete/@Head/@Options/@All
|
|
6
|
+
* - GraphQL: @Resolver + @Query/@Mutation/@Subscription
|
|
7
|
+
* - Microservices: @MessagePattern / @EventPattern
|
|
8
|
+
* - WebSockets: @WebSocketGateway(namespace) + @SubscribeMessage(event)
|
|
9
|
+
*
|
|
10
|
+
* Like the other framework extractors this is regex-over-source (comment-
|
|
11
|
+
* stripped), not AST traversal. NestJS differs from Spring/ASP.NET in two ways
|
|
12
|
+
* that this resolver has to account for:
|
|
13
|
+
*
|
|
14
|
+
* 1. An HTTP route's path is split across TWO decorators — the class-level
|
|
15
|
+
* `@Controller` prefix and the method-level `@Get`/`@Post` path — and both
|
|
16
|
+
* are frequently empty (`@Controller()`, `@Get()`). We pair each method
|
|
17
|
+
* decorator with its enclosing class and join the two paths.
|
|
18
|
+
*
|
|
19
|
+
* 2. `@Query()` is overloaded: it's a GraphQL *method* decorator (from
|
|
20
|
+
* `@nestjs/graphql`) AND a REST *parameter* decorator (from
|
|
21
|
+
* `@nestjs/common`). We only treat it as GraphQL when it sits inside an
|
|
22
|
+
* `@Resolver` class, which is what disambiguates the two.
|
|
23
|
+
*/
|
|
24
|
+
import { FrameworkResolver } from '../types';
|
|
25
|
+
export declare const nestjsResolver: FrameworkResolver;
|
|
26
|
+
//# sourceMappingURL=nestjs.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Play Framework (Scala/Java) resolver.
|
|
3
|
+
*
|
|
4
|
+
* Play declares HTTP routes in a dedicated `conf/routes` file (and included
|
|
5
|
+
* `conf/*.routes`), Rails-style:
|
|
6
|
+
*
|
|
7
|
+
* GET /computers controllers.Application.list(p: Int ?= 0)
|
|
8
|
+
* POST /computers controllers.Application.save
|
|
9
|
+
* GET /assets/*file controllers.Assets.versioned(path = "/public", file: Asset)
|
|
10
|
+
*
|
|
11
|
+
* The file is extensionless, so the file walk only indexes it because
|
|
12
|
+
* `isPlayRoutesFile` (grammars.ts) opts it in; it's processed through the
|
|
13
|
+
* no-grammar path and this resolver extracts the routes. Each route references
|
|
14
|
+
* its handler as `Controller.method` (the package prefix is dropped), resolved
|
|
15
|
+
* to the action method in the controller class.
|
|
16
|
+
*/
|
|
17
|
+
import { FrameworkResolver } from '../types';
|
|
18
|
+
export declare const playResolver: FrameworkResolver;
|
|
19
|
+
//# sourceMappingURL=play.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python Framework Resolver
|
|
3
|
+
*
|
|
4
|
+
* Handles Django, Flask, and FastAPI patterns.
|
|
5
|
+
*/
|
|
6
|
+
import { FrameworkResolver } from '../types';
|
|
7
|
+
export declare const djangoResolver: FrameworkResolver;
|
|
8
|
+
export declare const flaskResolver: FrameworkResolver;
|
|
9
|
+
export declare const fastapiResolver: FrameworkResolver;
|
|
10
|
+
//# sourceMappingURL=python.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte / SvelteKit Framework Resolver
|
|
3
|
+
*
|
|
4
|
+
* Handles Svelte component references, Svelte 5 runes,
|
|
5
|
+
* store auto-subscriptions, and SvelteKit route/module patterns.
|
|
6
|
+
*/
|
|
7
|
+
import { FrameworkResolver } from '../types';
|
|
8
|
+
export declare const svelteResolver: FrameworkResolver;
|
|
9
|
+
//# sourceMappingURL=svelte.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swift ↔ Objective-C bridge resolver.
|
|
3
|
+
*
|
|
4
|
+
* Closes the cross-language flow gap in mixed iOS codebases. The pure
|
|
5
|
+
* bridging name math lives in `../swift-objc-bridge.ts`; this file wires
|
|
6
|
+
* it into the resolution pipeline.
|
|
7
|
+
*
|
|
8
|
+
* **Two directions to close:**
|
|
9
|
+
*
|
|
10
|
+
* 1. **Swift call → ObjC method** — A Swift caller writes
|
|
11
|
+
* `imageDownloader.download(url:completion:)`. Tree-sitter-swift parses
|
|
12
|
+
* this as a call_expression whose callee identifier is `download`
|
|
13
|
+
* (parameter labels live in the argument list, not the callee). The
|
|
14
|
+
* name-matcher tries to find any node named `download` and fails (no
|
|
15
|
+
* Swift method by that name in this project; the ObjC implementation is
|
|
16
|
+
* `-downloadURL:completion:`). We catch it here: from the bare Swift
|
|
17
|
+
* name `download`, look up ObjC methods whose bridged Swift base name
|
|
18
|
+
* would be `download` (using `swiftBaseNamesForObjcSelector`'s reverse
|
|
19
|
+
* map, precomputed once per session).
|
|
20
|
+
*
|
|
21
|
+
* 2. **ObjC call → Swift method** — An ObjC caller writes
|
|
22
|
+
* `[swiftThing fooWithBar:42]`. Tree-sitter-objc parses this as a
|
|
23
|
+
* message_expression with selector `fooWithBar:` (after the multi-
|
|
24
|
+
* keyword fix in this branch). The name-matcher tries to find a node
|
|
25
|
+
* named `fooWithBar:` — no Swift node has colons in its name, so it
|
|
26
|
+
* fails. We catch it: from the ObjC selector, derive candidate Swift
|
|
27
|
+
* base names (`['fooWithBar', 'foo']`), and look up Swift methods
|
|
28
|
+
* named those.
|
|
29
|
+
*
|
|
30
|
+
* **Provenance:** every edge produced here is recorded as a framework-
|
|
31
|
+
* resolved reference (`resolvedBy: 'framework'`) with `confidence: 0.7`
|
|
32
|
+
* (matches the django ORM dynamic-dispatch precedent — not exact, but
|
|
33
|
+
* deterministic from the bridging rule).
|
|
34
|
+
*/
|
|
35
|
+
import { FrameworkResolver } from '../types';
|
|
36
|
+
export declare const swiftObjcBridgeResolver: FrameworkResolver;
|
|
37
|
+
//# sourceMappingURL=swift-objc.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swift Framework Resolver
|
|
3
|
+
*
|
|
4
|
+
* Handles SwiftUI, UIKit, and Vapor (server-side Swift) patterns.
|
|
5
|
+
*/
|
|
6
|
+
import { FrameworkResolver } from '../types';
|
|
7
|
+
export declare const swiftUIResolver: FrameworkResolver;
|
|
8
|
+
export declare const uikitResolver: FrameworkResolver;
|
|
9
|
+
export declare const vaporResolver: FrameworkResolver;
|
|
10
|
+
//# sourceMappingURL=swift.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue / Nuxt Framework Resolver
|
|
3
|
+
*
|
|
4
|
+
* Handles Vue component references, compiler macros (defineProps, etc.),
|
|
5
|
+
* Nuxt auto-imports, and Nuxt file-based routing patterns.
|
|
6
|
+
*/
|
|
7
|
+
import { FrameworkResolver } from '../types';
|
|
8
|
+
export declare const vueResolver: FrameworkResolver;
|
|
9
|
+
//# sourceMappingURL=vue.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go module path detection.
|
|
3
|
+
*
|
|
4
|
+
* A Go monorepo's cross-package calls (`pkga.FuncX(...)`) only resolve when
|
|
5
|
+
* the resolver knows the project's module path (the `module ...` directive
|
|
6
|
+
* in `go.mod`). Without it, `isExternalImport` treats every in-module import
|
|
7
|
+
* — `github.com/example/myproject/pkga` — as a third-party package, so
|
|
8
|
+
* resolution falls through to name-matching with path proximity and returns
|
|
9
|
+
* a tiny fraction of the real call sites. See issue #388.
|
|
10
|
+
*/
|
|
11
|
+
export interface GoModule {
|
|
12
|
+
/** The module path declared in `go.mod`, e.g. `github.com/example/myproject` */
|
|
13
|
+
modulePath: string;
|
|
14
|
+
/** Absolute path to the directory containing the `go.mod` file. */
|
|
15
|
+
rootDir: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read the `go.mod` file at the project root and extract the module path.
|
|
19
|
+
* Returns `null` if no `go.mod` exists or it has no `module` directive.
|
|
20
|
+
*
|
|
21
|
+
* Limitation: only the project-root `go.mod` is read. Nested `go.mod` files
|
|
22
|
+
* (Go workspaces, monorepos with multiple modules) are not yet resolved —
|
|
23
|
+
* a follow-up if a real repro shows up.
|
|
24
|
+
*/
|
|
25
|
+
export declare function loadGoModule(projectRoot: string): GoModule | null;
|
|
26
|
+
//# sourceMappingURL=go-module.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GoFrame route → controller-method dispatch synthesis (#747).
|
|
3
|
+
*
|
|
4
|
+
* GoFrame binds routes reflectively (`group.Bind(user.NewV1())`), so the route
|
|
5
|
+
* declared in a request type's `g.Meta` tag has no static edge to the method
|
|
6
|
+
* that serves it. The `goframeResolver` extract pass turns each `g.Meta` into a
|
|
7
|
+
* `route` node carrying its request type in the qualifiedName; this whole-graph
|
|
8
|
+
* pass closes the loop by joining each route to its handler.
|
|
9
|
+
*
|
|
10
|
+
* The join key is the REQUEST TYPE, not the method name — GoFrame method names
|
|
11
|
+
* are free (`DeptSearchReq` is served by `List`, `DeptAddReq` by `Add`), so the
|
|
12
|
+
* only reliable link is the request type appearing in the handler's parameter
|
|
13
|
+
* signature:
|
|
14
|
+
*
|
|
15
|
+
* func (c *sysDeptController) Add(ctx context.Context, req *system.DeptAddReq) (…)
|
|
16
|
+
* ^^^^^^^^^^^^^^^^ the join
|
|
17
|
+
*
|
|
18
|
+
* Go method nodes already carry that signature, so no source re-read is needed.
|
|
19
|
+
* Each synthesized edge is `kind:'calls'`, `provenance:'heuristic'`,
|
|
20
|
+
* `metadata.synthesizedBy:'goframe-route'` — a reflective-dispatch bridge, so
|
|
21
|
+
* `codegraph_explore` surfaces it as a dynamic hop rather than a literal call,
|
|
22
|
+
* and the handler's callers list the route that reaches it. A project with no
|
|
23
|
+
* GoFrame routes is a no-op.
|
|
24
|
+
*/
|
|
25
|
+
import type { Edge } from '../types';
|
|
26
|
+
import type { ResolutionContext } from './types';
|
|
27
|
+
export declare function goframeRouteEdges(ctx: ResolutionContext): Edge[];
|
|
28
|
+
//# sourceMappingURL=goframe-synthesizer.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import Resolver
|
|
3
|
+
*
|
|
4
|
+
* Resolves import paths to actual files and symbols.
|
|
5
|
+
*/
|
|
6
|
+
import { Language } from '../types';
|
|
7
|
+
import { UnresolvedRef, ResolvedRef, ResolutionContext, ImportMapping, ReExport } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Resolve an import path to an actual file
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveImportPath(importPath: string, fromFile: string, language: Language, context: ResolutionContext): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Clear the C/C++ include directory cache (call between indexing runs)
|
|
14
|
+
*/
|
|
15
|
+
export declare function clearCppIncludeDirCache(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Discover C/C++ include search directories for a project.
|
|
18
|
+
*
|
|
19
|
+
* Strategy:
|
|
20
|
+
* 1. Look for compile_commands.json (Clang compilation database) in the
|
|
21
|
+
* project root and common build subdirectories. Parse -I and -isystem
|
|
22
|
+
* flags from compiler commands.
|
|
23
|
+
* 2. If no compilation database is found, probe for common convention
|
|
24
|
+
* directories (include/, src/, lib/, api/) and top-level directories
|
|
25
|
+
* containing .h/.hpp files.
|
|
26
|
+
*
|
|
27
|
+
* Returns paths relative to projectRoot.
|
|
28
|
+
*/
|
|
29
|
+
export declare function loadCppIncludeDirs(projectRoot: string): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Is this reference a PHP include/require PATH (vs a namespace `use` symbol)?
|
|
32
|
+
*
|
|
33
|
+
* include/require emit a file path ("lib.php", "inc/db.php", "../x.php"),
|
|
34
|
+
* whereas namespace use is an FQN (App\Foo\Bar) or a bare class symbol
|
|
35
|
+
* (Closure). PHP identifiers contain neither '/' nor '.', so a slash or dot
|
|
36
|
+
* marks a path-shaped include. Such references resolve to files only — never
|
|
37
|
+
* to a same-named symbol — so callers must not fall back to the name-matcher.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isPhpIncludePathRef(ref: UnresolvedRef): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Extract import mappings from a file
|
|
42
|
+
*/
|
|
43
|
+
export declare function extractImportMappings(_filePath: string, content: string, language: Language): ImportMapping[];
|
|
44
|
+
/**
|
|
45
|
+
* Clear the import mapping cache (call between indexing runs)
|
|
46
|
+
*/
|
|
47
|
+
export declare function clearImportMappingCache(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Extract JS/TS re-export declarations from `content`.
|
|
50
|
+
*
|
|
51
|
+
* Recognised forms:
|
|
52
|
+
* export { foo } from './a';
|
|
53
|
+
* export { foo as bar } from './a';
|
|
54
|
+
* export * from './a';
|
|
55
|
+
* export * as ns from './a'; (treated as wildcard for chasing)
|
|
56
|
+
* export { default as Foo } from './a';
|
|
57
|
+
*
|
|
58
|
+
* The walker intentionally stays regex-based — the import-resolver
|
|
59
|
+
* elsewhere in this file already chooses regex over a fresh
|
|
60
|
+
* tree-sitter pass, and this function shares that trade-off. Errors
|
|
61
|
+
* fall through silently; resolution simply skips the broken file.
|
|
62
|
+
*/
|
|
63
|
+
export declare function extractReExports(content: string, language: Language): ReExport[];
|
|
64
|
+
/**
|
|
65
|
+
* Resolve a reference using import mappings
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* JVM (Java / Kotlin) imports use fully-qualified names (`import
|
|
69
|
+
* com.example.foo.Bar`) decoupled from filenames, so the JS/Python
|
|
70
|
+
* style filesystem path lookup misses them whenever the file isn't
|
|
71
|
+
* named after its primary symbol (Kotlin `Utils.kt` exporting `Bar`,
|
|
72
|
+
* top-level fns, extension fns). Resolve them through the
|
|
73
|
+
* `qualifiedName` index instead — populated by the package_header /
|
|
74
|
+
* package_declaration namespace wrappers in the extractor.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveJvmImport(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
77
|
+
export declare function resolveViaImport(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
78
|
+
//# sourceMappingURL=import-resolver.d.ts.map
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference Resolution Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Coordinates all reference resolution strategies.
|
|
5
|
+
*/
|
|
6
|
+
import { UnresolvedReference, Edge } from '../types';
|
|
7
|
+
import { QueryBuilder } from '../db/queries';
|
|
8
|
+
import { UnresolvedRef, ResolvedRef, ResolutionResult } from './types';
|
|
9
|
+
export * from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Reference Resolver
|
|
12
|
+
*
|
|
13
|
+
* Orchestrates reference resolution using multiple strategies.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ReferenceResolver {
|
|
16
|
+
private projectRoot;
|
|
17
|
+
private queries;
|
|
18
|
+
private context;
|
|
19
|
+
private frameworks;
|
|
20
|
+
private deferredChainRefs;
|
|
21
|
+
private deferredThisMemberRefs;
|
|
22
|
+
private razorUsingsCache;
|
|
23
|
+
private nodeCache;
|
|
24
|
+
private fileCache;
|
|
25
|
+
private importMappingCache;
|
|
26
|
+
private reExportCache;
|
|
27
|
+
private nameCache;
|
|
28
|
+
private lowerNameCache;
|
|
29
|
+
private qualifiedNameCache;
|
|
30
|
+
private knownNames;
|
|
31
|
+
private knownFiles;
|
|
32
|
+
private cachesWarmed;
|
|
33
|
+
private projectAliases;
|
|
34
|
+
private goModule;
|
|
35
|
+
private workspacePackages;
|
|
36
|
+
constructor(projectRoot: string, queries: QueryBuilder);
|
|
37
|
+
/**
|
|
38
|
+
* Initialize the resolver (detect frameworks, etc.)
|
|
39
|
+
*/
|
|
40
|
+
initialize(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Run each framework resolver's cross-file finalization pass and persist
|
|
43
|
+
* the returned node updates. Idempotent — safe to call after every indexAll
|
|
44
|
+
* and every incremental sync. Returns the number of nodes updated.
|
|
45
|
+
*
|
|
46
|
+
* Caches are cleared before/after so the post-extract pass sees fresh DB
|
|
47
|
+
* state and downstream queries see the updated names.
|
|
48
|
+
*/
|
|
49
|
+
runPostExtract(): number;
|
|
50
|
+
/**
|
|
51
|
+
* Pre-build lightweight caches for resolution.
|
|
52
|
+
* Node lookups are now handled by indexed SQLite queries instead of
|
|
53
|
+
* loading all nodes into memory (which caused OOM on large codebases).
|
|
54
|
+
* We cache the set of known symbol names for fast pre-filtering.
|
|
55
|
+
*/
|
|
56
|
+
warmCaches(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Clear internal caches
|
|
59
|
+
*/
|
|
60
|
+
clearCaches(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Create the resolution context
|
|
63
|
+
*/
|
|
64
|
+
private createContext;
|
|
65
|
+
/**
|
|
66
|
+
* Resolve all unresolved references
|
|
67
|
+
*/
|
|
68
|
+
resolveAll(unresolvedRefs: UnresolvedReference[], onProgress?: (current: number, total: number) => void): ResolutionResult;
|
|
69
|
+
/**
|
|
70
|
+
* Check if a reference name has any possible match in the codebase.
|
|
71
|
+
* Uses the pre-built knownNames set to skip expensive resolution
|
|
72
|
+
* for names that definitely don't exist as symbols.
|
|
73
|
+
*/
|
|
74
|
+
private hasAnyPossibleMatch;
|
|
75
|
+
/**
|
|
76
|
+
* Does `ref.referenceName` match an import declared in its containing
|
|
77
|
+
* file? Used as a pre-filter escape so re-export chain resolution
|
|
78
|
+
* still gets a chance when the name has no project-wide declaration.
|
|
79
|
+
*/
|
|
80
|
+
private matchesAnyImport;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve a single reference
|
|
83
|
+
*/
|
|
84
|
+
resolveOne(ref: UnresolvedRef): ResolvedRef | null;
|
|
85
|
+
/**
|
|
86
|
+
* Create edges from resolved references
|
|
87
|
+
*/
|
|
88
|
+
createEdges(resolved: ResolvedRef[]): Edge[];
|
|
89
|
+
/**
|
|
90
|
+
* Resolve and persist edges to database
|
|
91
|
+
*/
|
|
92
|
+
resolveAndPersist(unresolvedRefs: UnresolvedReference[], onProgress?: (current: number, total: number) => void): ResolutionResult;
|
|
93
|
+
/**
|
|
94
|
+
* Second resolution pass for chained static-factory / fluent calls whose
|
|
95
|
+
* chained method is defined on a SUPERTYPE the receiver's type conforms to —
|
|
96
|
+
* a protocol-extension / inherited / default-interface method (#750). The
|
|
97
|
+
* first pass can't resolve these because `implements`/`extends` edges aren't
|
|
98
|
+
* built yet; this runs AFTER edges are persisted, so `context.getSupertypes`
|
|
99
|
+
* (and the conformance fallback in resolveMethodOnType) can walk them.
|
|
100
|
+
*
|
|
101
|
+
* Operates only on the leftover unresolved refs that have the `inner().method`
|
|
102
|
+
* chain shape, for the dotted-chain languages — a small set — and is idempotent
|
|
103
|
+
* (re-resolving an already-resolved ref is a no-op since it's been deleted).
|
|
104
|
+
* Returns the number of newly-created edges.
|
|
105
|
+
*/
|
|
106
|
+
resolveChainedCallsViaConformance(): number;
|
|
107
|
+
/**
|
|
108
|
+
* Resolve and persist in batches to keep memory bounded.
|
|
109
|
+
* Processes unresolved references in chunks, persisting edges and cleaning
|
|
110
|
+
* up resolved refs after each batch to avoid accumulating large arrays.
|
|
111
|
+
*/
|
|
112
|
+
resolveAndPersistBatched(onProgress?: (current: number, total: number) => void, batchSize?: number): Promise<ResolutionResult>;
|
|
113
|
+
/**
|
|
114
|
+
* Get detected frameworks
|
|
115
|
+
*/
|
|
116
|
+
getDetectedFrameworks(): string[];
|
|
117
|
+
/**
|
|
118
|
+
* Check if reference is to a built-in or external symbol
|
|
119
|
+
*/
|
|
120
|
+
private isBuiltInOrExternal;
|
|
121
|
+
/**
|
|
122
|
+
* Get file path from node ID
|
|
123
|
+
*/
|
|
124
|
+
private getFilePathFromNodeId;
|
|
125
|
+
/**
|
|
126
|
+
* Get language from node ID
|
|
127
|
+
*/
|
|
128
|
+
private getLanguageFromNodeId;
|
|
129
|
+
/**
|
|
130
|
+
* Drop an import/name-strategy resolution that crosses a language family.
|
|
131
|
+
* Two regimes (mirrors `applyLanguageGate`'s candidate filter):
|
|
132
|
+
* - `references` (type usage): STRICT — a `Type.member` static read names a
|
|
133
|
+
* same-family type, never a coincidentally same-named symbol in another
|
|
134
|
+
* language. Drops any non-same-family target.
|
|
135
|
+
* - `imports` (import binding / `#include`): both-known — a C++ `#include
|
|
136
|
+
* "X.h"` must not resolve to a same-named ObjC header on another platform
|
|
137
|
+
* (basename collision), but a singleton-family / SFC language (`vue` →
|
|
138
|
+
* `.ts`) importing across is left alone.
|
|
139
|
+
* Applies to the import (strategy 2) + name-match (strategy 3) results.
|
|
140
|
+
*/
|
|
141
|
+
/**
|
|
142
|
+
* Collect the `@using` namespaces in scope for a `.razor`/`.cshtml` file: its
|
|
143
|
+
* own `@using` directives plus every `_Imports.razor` from the file's folder up
|
|
144
|
+
* to the project root (Razor `_Imports` cascade). Cached per file.
|
|
145
|
+
*/
|
|
146
|
+
private getRazorUsings;
|
|
147
|
+
/**
|
|
148
|
+
* Resolve a Razor/Blazor simple type ref through the file's `@using`
|
|
149
|
+
* namespaces: `CatalogBrand` + `@using BlazorShared.Models` → the node whose
|
|
150
|
+
* qualified name is `BlazorShared.Models::CatalogBrand`. Only resolves when the
|
|
151
|
+
* `@using` set yields exactly ONE type (otherwise it stays ambiguous and falls
|
|
152
|
+
* through to name-matching).
|
|
153
|
+
*/
|
|
154
|
+
private resolveRazorUsing;
|
|
155
|
+
/**
|
|
156
|
+
* Resolve a `this.<member>` function-as-value reference (#756/#808) to the
|
|
157
|
+
* ENCLOSING CLASS's own member — never a same-named symbol elsewhere. The
|
|
158
|
+
* registration idiom (`btn.on('click', this.handleClick)`) names a member
|
|
159
|
+
* of the class being defined, so the only valid target shares the
|
|
160
|
+
* from-symbol's qualified-name scope. Function/method targets only — a
|
|
161
|
+
* property (a data field, post-#808 classification) yields no edge — same
|
|
162
|
+
* file required, no fallback of any kind.
|
|
163
|
+
*/
|
|
164
|
+
private resolveThisMemberFnRef;
|
|
165
|
+
/**
|
|
166
|
+
* Second pass for `this.<member>` refs whose member wasn't on the enclosing
|
|
167
|
+
* class itself (#808): once implements/extends edges exist, walk the
|
|
168
|
+
* class's supertypes (transitively, depth-capped) and resolve the member on
|
|
169
|
+
* the nearest one that declares it — `this.handleSubmit` registered in a
|
|
170
|
+
* subclass resolves to `FormBase::handleSubmit`. Validated targets only
|
|
171
|
+
* (function/method kind, same language family); no match → no edge.
|
|
172
|
+
* Mirrors resolveChainedCallsViaConformance's lifecycle. Returns the number
|
|
173
|
+
* of newly-created edges.
|
|
174
|
+
*/
|
|
175
|
+
resolveDeferredThisMemberRefs(): number;
|
|
176
|
+
private gateLanguage;
|
|
177
|
+
/**
|
|
178
|
+
* Drop a FRAMEWORK-strategy resolution that crosses two *known* language
|
|
179
|
+
* families for a type-usage (`references`) or import-binding (`imports`)
|
|
180
|
+
* edge. The framework strategy is intentionally ungated for cross-language
|
|
181
|
+
* bridges, but those legitimate bridges are either `calls` edges (RN/Expo
|
|
182
|
+
* JS → native) or config↔code edges whose config side (`yaml`/`blade`/…) is
|
|
183
|
+
* not a known programming-language family. A `references`/`imports` edge
|
|
184
|
+
* between two *known* families is always a coincidental name collision — the
|
|
185
|
+
* React/Svelte/Vue PascalCase component resolvers name-match `getNodesByName`
|
|
186
|
+
* without a language check, so a TS `<TestRunner>` ref happily matched a
|
|
187
|
+
* Kotlin `class TestRunner`. Gating only the both-known-cross-family case
|
|
188
|
+
* lets config bridges and `calls` bridges through untouched.
|
|
189
|
+
*/
|
|
190
|
+
private gateFrameworkLanguage;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Create a reference resolver instance
|
|
194
|
+
*/
|
|
195
|
+
export declare function createResolver(projectRoot: string, queries: QueryBuilder): ReferenceResolver;
|
|
196
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple LRU cache backed by JavaScript's insertion-ordered Map.
|
|
3
|
+
*
|
|
4
|
+
* Used by ReferenceResolver to bound the per-resolver caches that
|
|
5
|
+
* previously grew without limit and OOM'd on large codebases (20k+
|
|
6
|
+
* files). Each cache is sized independently — see `index.ts` for
|
|
7
|
+
* the chosen limits per cache type.
|
|
8
|
+
*
|
|
9
|
+
* Eviction is plain LRU: on `set`, if the cache is full, the
|
|
10
|
+
* least-recently-used entry (the first one in iteration order) is
|
|
11
|
+
* evicted. Touching via `get` moves the entry to the most-recently-used
|
|
12
|
+
* position so hot keys survive eviction passes.
|
|
13
|
+
*/
|
|
14
|
+
export declare class LRUCache<K, V> {
|
|
15
|
+
private readonly max;
|
|
16
|
+
private readonly store;
|
|
17
|
+
constructor(max: number);
|
|
18
|
+
get size(): number;
|
|
19
|
+
get(key: K): V | undefined;
|
|
20
|
+
has(key: K): boolean;
|
|
21
|
+
set(key: K, value: V): void;
|
|
22
|
+
clear(): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=lru-cache.d.ts.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Name Matcher
|
|
3
|
+
*
|
|
4
|
+
* Handles symbol name matching for reference resolution.
|
|
5
|
+
*/
|
|
6
|
+
import { UnresolvedRef, ResolvedRef, ResolutionContext } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Try to resolve a path-like reference (e.g., "snippets/drawer-menu.liquid")
|
|
9
|
+
* by matching the filename against file nodes.
|
|
10
|
+
*/
|
|
11
|
+
export declare function matchByFilePath(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
12
|
+
export declare function sameLanguageFamily(a: string, b: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* True when `lang` belongs to a known multi-language family (jvm/apple/web/c).
|
|
15
|
+
* Languages not listed (php, python, go, ruby, rust, dart, …) and config
|
|
16
|
+
* formats (yaml/xml/blade) form their own singleton families and return
|
|
17
|
+
* `false` — used to leave config↔code framework bridges (whose config side is
|
|
18
|
+
* never a known programming-language family) out of the cross-family gate.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isKnownLanguageFamily(lang: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* True when `a` and `b` are two DIFFERENT *known* language families — the
|
|
23
|
+
* signature of a coincidental cross-language name collision (a TS `import
|
|
24
|
+
* React` matching a Swift `import React`, a C++ `#include "X.h"` matching a
|
|
25
|
+
* same-named ObjC header on another platform). The both-*known* test is
|
|
26
|
+
* deliberately weaker than {@link sameLanguageFamily}'s negation: a
|
|
27
|
+
* single-file-component language that carries its own tag (`vue`/`svelte`)
|
|
28
|
+
* importing a `.ts` module, or any singleton-family language (php/go/ruby/…),
|
|
29
|
+
* returns `false` here and is left alone.
|
|
30
|
+
*/
|
|
31
|
+
export declare function crossesKnownFamily(a: string, b: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a function-as-value reference (#756) — a function name used as a
|
|
34
|
+
* callback/function-pointer value (`register(handler)`, `o->cb = handler`,
|
|
35
|
+
* `{ .cb = handler }`, `signal(SIGINT, handler)`). The ONLY strategy allowed
|
|
36
|
+
* for `function_ref` refs: exact name, function/method targets only, same
|
|
37
|
+
* language family, same-file first, and cross-file only when the match is
|
|
38
|
+
* UNIQUE. No fuzzy fallback, no qualified-name walking — a wrong callback
|
|
39
|
+
* edge is worse than none.
|
|
40
|
+
*/
|
|
41
|
+
export declare function matchFunctionRef(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
42
|
+
/**
|
|
43
|
+
* Try to resolve a reference by exact name match
|
|
44
|
+
*/
|
|
45
|
+
export declare function matchByExactName(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
46
|
+
/**
|
|
47
|
+
* Try to resolve by qualified name
|
|
48
|
+
*/
|
|
49
|
+
export declare function matchByQualifiedName(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a C++ chained call whose receiver is itself a call — encoded by the
|
|
52
|
+
* extractor as `<innerCallee>().<method>` (#645). The receiver's type is what
|
|
53
|
+
* the inner call returns; the outer method is then resolved and VALIDATED on it
|
|
54
|
+
* (resolveMethodOnType requires `cls::method` to exist), so a wrong inference
|
|
55
|
+
* produces no edge rather than a wrong one.
|
|
56
|
+
*/
|
|
57
|
+
export declare function matchCppCallChain(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
58
|
+
/**
|
|
59
|
+
* Resolve a `::`-scoped factory chain whose receiver is a scoped/static call —
|
|
60
|
+
* PHP `Cls::for($x)->method()` (#608, the per-credential Laravel client idiom) or
|
|
61
|
+
* Rust `Foo::new().bar()` (an associated-function call) — both encoded by the
|
|
62
|
+
* extractor as `Cls::factory().method`. The receiver's type is what `Cls::factory`
|
|
63
|
+
* returns: a `self` marker (PHP `: self`/`: static`, Rust `-> Self`) resolves to
|
|
64
|
+
* the factory's own type, a concrete return type to that type. The outer method is
|
|
65
|
+
* then resolved and VALIDATED on it (resolveMethodOnType requires the method to
|
|
66
|
+
* exist on the type or a supertype it conforms to), so a wrong inference yields no
|
|
67
|
+
* edge rather than a wrong one. Shared by the `::`-receiver languages (PHP, Rust).
|
|
68
|
+
*/
|
|
69
|
+
export declare function matchScopedCallChain(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
70
|
+
/**
|
|
71
|
+
* Resolve a dotted chained call whose receiver is a static factory / fluent call —
|
|
72
|
+
* `Foo.getInstance().bar()`, encoded by the extractor as `Foo.getInstance().bar`
|
|
73
|
+
* (#645/#608 mechanism). The receiver's type is what `Foo.getInstance` returns
|
|
74
|
+
* (its declared return type); the outer method is then resolved and VALIDATED on
|
|
75
|
+
* it (resolveMethodOnType requires `Type::method` to exist), so a wrong inference
|
|
76
|
+
* yields no edge rather than a wrong one (e.g. a same-named `bar()` on an
|
|
77
|
+
* unrelated class is never matched). Shared by the dot-notation languages
|
|
78
|
+
* (Java, Kotlin, C#, Swift) — same receiver shape, same `Class::method` qualified names.
|
|
79
|
+
*/
|
|
80
|
+
export declare function matchDottedCallChain(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
81
|
+
/**
|
|
82
|
+
* Try to resolve by method name on a class/object
|
|
83
|
+
*/
|
|
84
|
+
export declare function matchMethodCall(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
85
|
+
/**
|
|
86
|
+
* Fuzzy match - last resort with lower confidence
|
|
87
|
+
*/
|
|
88
|
+
export declare function matchFuzzy(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
89
|
+
/**
|
|
90
|
+
* Match all strategies in order of confidence
|
|
91
|
+
*/
|
|
92
|
+
export declare function matchReference(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null;
|
|
93
|
+
//# sourceMappingURL=name-matcher.d.ts.map
|