@colbymchenry/codegraph 0.8.0 → 0.9.1
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 +23 -7
- package/npm-shim.js +43 -0
- package/package.json +13 -51
- package/LICENSE +0 -21
- package/dist/bin/codegraph.d.ts +0 -21
- package/dist/bin/codegraph.d.ts.map +0 -1
- package/dist/bin/codegraph.js +0 -1257
- package/dist/bin/codegraph.js.map +0 -1
- package/dist/bin/node-version-check.d.ts +0 -20
- package/dist/bin/node-version-check.d.ts.map +0 -1
- package/dist/bin/node-version-check.js +0 -42
- package/dist/bin/node-version-check.js.map +0 -1
- package/dist/bin/uninstall.d.ts +0 -14
- package/dist/bin/uninstall.d.ts.map +0 -1
- package/dist/bin/uninstall.js +0 -36
- package/dist/bin/uninstall.js.map +0 -1
- package/dist/config.d.ts +0 -51
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -321
- package/dist/config.js.map +0 -1
- package/dist/context/formatter.d.ts +0 -30
- package/dist/context/formatter.d.ts.map +0 -1
- package/dist/context/formatter.js +0 -244
- package/dist/context/formatter.js.map +0 -1
- package/dist/context/index.d.ts +0 -97
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -1050
- package/dist/context/index.js.map +0 -1
- package/dist/db/index.d.ts +0 -72
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/index.js +0 -200
- package/dist/db/index.js.map +0 -1
- package/dist/db/migrations.d.ts +0 -44
- package/dist/db/migrations.d.ts.map +0 -1
- package/dist/db/migrations.js +0 -131
- package/dist/db/migrations.js.map +0 -1
- package/dist/db/queries.d.ts +0 -253
- package/dist/db/queries.d.ts.map +0 -1
- package/dist/db/queries.js +0 -1207
- package/dist/db/queries.js.map +0 -1
- package/dist/db/schema.sql +0 -151
- package/dist/db/sqlite-adapter.d.ts +0 -52
- package/dist/db/sqlite-adapter.d.ts.map +0 -1
- package/dist/db/sqlite-adapter.js +0 -237
- package/dist/db/sqlite-adapter.js.map +0 -1
- package/dist/directory.d.ts +0 -57
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js +0 -264
- package/dist/directory.js.map +0 -1
- package/dist/errors.d.ts +0 -136
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -219
- package/dist/errors.js.map +0 -1
- package/dist/extraction/dfm-extractor.d.ts +0 -31
- package/dist/extraction/dfm-extractor.d.ts.map +0 -1
- package/dist/extraction/dfm-extractor.js +0 -151
- package/dist/extraction/dfm-extractor.js.map +0 -1
- package/dist/extraction/grammars.d.ts +0 -78
- package/dist/extraction/grammars.d.ts.map +0 -1
- package/dist/extraction/grammars.js +0 -322
- package/dist/extraction/grammars.js.map +0 -1
- package/dist/extraction/index.d.ts +0 -130
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/index.js +0 -1305
- package/dist/extraction/index.js.map +0 -1
- package/dist/extraction/languages/c-cpp.d.ts +0 -4
- package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
- package/dist/extraction/languages/c-cpp.js +0 -126
- package/dist/extraction/languages/c-cpp.js.map +0 -1
- package/dist/extraction/languages/csharp.d.ts +0 -3
- package/dist/extraction/languages/csharp.d.ts.map +0 -1
- package/dist/extraction/languages/csharp.js +0 -72
- package/dist/extraction/languages/csharp.js.map +0 -1
- package/dist/extraction/languages/dart.d.ts +0 -3
- package/dist/extraction/languages/dart.d.ts.map +0 -1
- package/dist/extraction/languages/dart.js +0 -192
- package/dist/extraction/languages/dart.js.map +0 -1
- package/dist/extraction/languages/go.d.ts +0 -3
- package/dist/extraction/languages/go.d.ts.map +0 -1
- package/dist/extraction/languages/go.js +0 -58
- package/dist/extraction/languages/go.js.map +0 -1
- package/dist/extraction/languages/index.d.ts +0 -10
- package/dist/extraction/languages/index.d.ts.map +0 -1
- package/dist/extraction/languages/index.js +0 -45
- package/dist/extraction/languages/index.js.map +0 -1
- package/dist/extraction/languages/java.d.ts +0 -3
- package/dist/extraction/languages/java.d.ts.map +0 -1
- package/dist/extraction/languages/java.js +0 -64
- package/dist/extraction/languages/java.js.map +0 -1
- package/dist/extraction/languages/javascript.d.ts +0 -3
- package/dist/extraction/languages/javascript.d.ts.map +0 -1
- package/dist/extraction/languages/javascript.js +0 -90
- package/dist/extraction/languages/javascript.js.map +0 -1
- package/dist/extraction/languages/kotlin.d.ts +0 -3
- package/dist/extraction/languages/kotlin.d.ts.map +0 -1
- package/dist/extraction/languages/kotlin.js +0 -253
- package/dist/extraction/languages/kotlin.js.map +0 -1
- package/dist/extraction/languages/pascal.d.ts +0 -3
- package/dist/extraction/languages/pascal.d.ts.map +0 -1
- package/dist/extraction/languages/pascal.js +0 -66
- package/dist/extraction/languages/pascal.js.map +0 -1
- package/dist/extraction/languages/php.d.ts +0 -3
- package/dist/extraction/languages/php.d.ts.map +0 -1
- package/dist/extraction/languages/php.js +0 -107
- package/dist/extraction/languages/php.js.map +0 -1
- package/dist/extraction/languages/python.d.ts +0 -3
- package/dist/extraction/languages/python.d.ts.map +0 -1
- package/dist/extraction/languages/python.js +0 -56
- package/dist/extraction/languages/python.js.map +0 -1
- package/dist/extraction/languages/ruby.d.ts +0 -3
- package/dist/extraction/languages/ruby.d.ts.map +0 -1
- package/dist/extraction/languages/ruby.js +0 -114
- package/dist/extraction/languages/ruby.js.map +0 -1
- package/dist/extraction/languages/rust.d.ts +0 -3
- package/dist/extraction/languages/rust.d.ts.map +0 -1
- package/dist/extraction/languages/rust.js +0 -109
- package/dist/extraction/languages/rust.js.map +0 -1
- package/dist/extraction/languages/scala.d.ts +0 -3
- package/dist/extraction/languages/scala.d.ts.map +0 -1
- package/dist/extraction/languages/scala.js +0 -139
- package/dist/extraction/languages/scala.js.map +0 -1
- package/dist/extraction/languages/swift.d.ts +0 -3
- package/dist/extraction/languages/swift.d.ts.map +0 -1
- package/dist/extraction/languages/swift.js +0 -91
- package/dist/extraction/languages/swift.js.map +0 -1
- package/dist/extraction/languages/typescript.d.ts +0 -3
- package/dist/extraction/languages/typescript.d.ts.map +0 -1
- package/dist/extraction/languages/typescript.js +0 -129
- package/dist/extraction/languages/typescript.js.map +0 -1
- package/dist/extraction/liquid-extractor.d.ts +0 -52
- package/dist/extraction/liquid-extractor.d.ts.map +0 -1
- package/dist/extraction/liquid-extractor.js +0 -313
- package/dist/extraction/liquid-extractor.js.map +0 -1
- package/dist/extraction/parse-worker.d.ts +0 -8
- package/dist/extraction/parse-worker.d.ts.map +0 -1
- package/dist/extraction/parse-worker.js +0 -94
- package/dist/extraction/parse-worker.js.map +0 -1
- package/dist/extraction/svelte-extractor.d.ts +0 -56
- package/dist/extraction/svelte-extractor.d.ts.map +0 -1
- package/dist/extraction/svelte-extractor.js +0 -272
- package/dist/extraction/svelte-extractor.js.map +0 -1
- package/dist/extraction/tree-sitter-helpers.d.ts +0 -28
- package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-helpers.js +0 -103
- package/dist/extraction/tree-sitter-helpers.js.map +0 -1
- package/dist/extraction/tree-sitter-types.d.ts +0 -179
- package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-types.js +0 -10
- package/dist/extraction/tree-sitter-types.js.map +0 -1
- package/dist/extraction/tree-sitter.d.ts +0 -233
- package/dist/extraction/tree-sitter.d.ts.map +0 -1
- package/dist/extraction/tree-sitter.js +0 -2393
- package/dist/extraction/tree-sitter.js.map +0 -1
- package/dist/extraction/vue-extractor.d.ts +0 -36
- package/dist/extraction/vue-extractor.d.ts.map +0 -1
- package/dist/extraction/vue-extractor.js +0 -163
- package/dist/extraction/vue-extractor.js.map +0 -1
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/graph/index.d.ts +0 -8
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js +0 -13
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/queries.d.ts +0 -106
- package/dist/graph/queries.d.ts.map +0 -1
- package/dist/graph/queries.js +0 -366
- package/dist/graph/queries.js.map +0 -1
- package/dist/graph/traversal.d.ts +0 -127
- package/dist/graph/traversal.d.ts.map +0 -1
- package/dist/graph/traversal.js +0 -493
- package/dist/graph/traversal.js.map +0 -1
- package/dist/index.d.ts +0 -447
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -825
- package/dist/index.js.map +0 -1
- package/dist/installer/claude-md-template.d.ts +0 -14
- package/dist/installer/claude-md-template.d.ts.map +0 -1
- package/dist/installer/claude-md-template.js +0 -21
- package/dist/installer/claude-md-template.js.map +0 -1
- package/dist/installer/config-writer.d.ts +0 -29
- package/dist/installer/config-writer.d.ts.map +0 -1
- package/dist/installer/config-writer.js +0 -111
- package/dist/installer/config-writer.js.map +0 -1
- package/dist/installer/index.d.ts +0 -65
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js +0 -406
- package/dist/installer/index.js.map +0 -1
- package/dist/installer/instructions-template.d.ts +0 -28
- package/dist/installer/instructions-template.d.ts.map +0 -1
- package/dist/installer/instructions-template.js +0 -64
- package/dist/installer/instructions-template.js.map +0 -1
- package/dist/installer/targets/claude.d.ts +0 -31
- package/dist/installer/targets/claude.d.ts.map +0 -1
- package/dist/installer/targets/claude.js +0 -308
- package/dist/installer/targets/claude.js.map +0 -1
- package/dist/installer/targets/codex.d.ts +0 -18
- package/dist/installer/targets/codex.d.ts.map +0 -1
- package/dist/installer/targets/codex.js +0 -185
- package/dist/installer/targets/codex.js.map +0 -1
- package/dist/installer/targets/cursor.d.ts +0 -35
- package/dist/installer/targets/cursor.d.ts.map +0 -1
- package/dist/installer/targets/cursor.js +0 -229
- package/dist/installer/targets/cursor.js.map +0 -1
- package/dist/installer/targets/opencode.d.ts +0 -30
- package/dist/installer/targets/opencode.d.ts.map +0 -1
- package/dist/installer/targets/opencode.js +0 -235
- package/dist/installer/targets/opencode.js.map +0 -1
- package/dist/installer/targets/registry.d.ts +0 -35
- package/dist/installer/targets/registry.d.ts.map +0 -1
- package/dist/installer/targets/registry.js +0 -83
- package/dist/installer/targets/registry.js.map +0 -1
- package/dist/installer/targets/shared.d.ts +0 -77
- package/dist/installer/targets/shared.d.ts.map +0 -1
- package/dist/installer/targets/shared.js +0 -246
- package/dist/installer/targets/shared.js.map +0 -1
- package/dist/installer/targets/toml.d.ts +0 -52
- package/dist/installer/targets/toml.d.ts.map +0 -1
- package/dist/installer/targets/toml.js +0 -147
- package/dist/installer/targets/toml.js.map +0 -1
- package/dist/installer/targets/types.d.ts +0 -116
- package/dist/installer/targets/types.d.ts.map +0 -1
- package/dist/installer/targets/types.js +0 -16
- package/dist/installer/targets/types.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -94
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -453
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/server-instructions.d.ts +0 -19
- package/dist/mcp/server-instructions.d.ts.map +0 -1
- package/dist/mcp/server-instructions.js +0 -71
- package/dist/mcp/server-instructions.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -257
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1633
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/transport.d.ts +0 -106
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/mcp/transport.js +0 -233
- package/dist/mcp/transport.js.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -18
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.js +0 -225
- package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
- package/dist/resolution/frameworks/csharp.d.ts +0 -8
- package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
- package/dist/resolution/frameworks/csharp.js +0 -213
- package/dist/resolution/frameworks/csharp.js.map +0 -1
- package/dist/resolution/frameworks/express.d.ts +0 -8
- package/dist/resolution/frameworks/express.d.ts.map +0 -1
- package/dist/resolution/frameworks/express.js +0 -225
- package/dist/resolution/frameworks/express.js.map +0 -1
- package/dist/resolution/frameworks/go.d.ts +0 -8
- package/dist/resolution/frameworks/go.d.ts.map +0 -1
- package/dist/resolution/frameworks/go.js +0 -158
- package/dist/resolution/frameworks/go.js.map +0 -1
- package/dist/resolution/frameworks/index.d.ts +0 -42
- package/dist/resolution/frameworks/index.d.ts.map +0 -1
- package/dist/resolution/frameworks/index.js +0 -133
- package/dist/resolution/frameworks/index.js.map +0 -1
- package/dist/resolution/frameworks/java.d.ts +0 -8
- package/dist/resolution/frameworks/java.d.ts.map +0 -1
- package/dist/resolution/frameworks/java.js +0 -177
- package/dist/resolution/frameworks/java.js.map +0 -1
- package/dist/resolution/frameworks/laravel.d.ts +0 -13
- package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
- package/dist/resolution/frameworks/laravel.js +0 -248
- package/dist/resolution/frameworks/laravel.js.map +0 -1
- package/dist/resolution/frameworks/nestjs.d.ts +0 -26
- package/dist/resolution/frameworks/nestjs.d.ts.map +0 -1
- package/dist/resolution/frameworks/nestjs.js +0 -374
- package/dist/resolution/frameworks/nestjs.js.map +0 -1
- package/dist/resolution/frameworks/python.d.ts +0 -10
- package/dist/resolution/frameworks/python.d.ts.map +0 -1
- package/dist/resolution/frameworks/python.js +0 -278
- package/dist/resolution/frameworks/python.js.map +0 -1
- package/dist/resolution/frameworks/react.d.ts +0 -8
- package/dist/resolution/frameworks/react.d.ts.map +0 -1
- package/dist/resolution/frameworks/react.js +0 -272
- package/dist/resolution/frameworks/react.js.map +0 -1
- package/dist/resolution/frameworks/ruby.d.ts +0 -8
- package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
- package/dist/resolution/frameworks/ruby.js +0 -198
- package/dist/resolution/frameworks/ruby.js.map +0 -1
- package/dist/resolution/frameworks/rust.d.ts +0 -8
- package/dist/resolution/frameworks/rust.d.ts.map +0 -1
- package/dist/resolution/frameworks/rust.js +0 -207
- package/dist/resolution/frameworks/rust.js.map +0 -1
- package/dist/resolution/frameworks/svelte.d.ts +0 -9
- package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
- package/dist/resolution/frameworks/svelte.js +0 -249
- package/dist/resolution/frameworks/svelte.js.map +0 -1
- package/dist/resolution/frameworks/swift.d.ts +0 -10
- package/dist/resolution/frameworks/swift.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift.js +0 -376
- package/dist/resolution/frameworks/swift.js.map +0 -1
- package/dist/resolution/frameworks/vue.d.ts +0 -9
- package/dist/resolution/frameworks/vue.d.ts.map +0 -1
- package/dist/resolution/frameworks/vue.js +0 -306
- package/dist/resolution/frameworks/vue.js.map +0 -1
- package/dist/resolution/import-resolver.d.ts +0 -40
- package/dist/resolution/import-resolver.d.ts.map +0 -1
- package/dist/resolution/import-resolver.js +0 -663
- package/dist/resolution/import-resolver.js.map +0 -1
- package/dist/resolution/index.d.ts +0 -106
- package/dist/resolution/index.d.ts.map +0 -1
- package/dist/resolution/index.js +0 -709
- package/dist/resolution/index.js.map +0 -1
- package/dist/resolution/name-matcher.d.ts +0 -32
- package/dist/resolution/name-matcher.d.ts.map +0 -1
- package/dist/resolution/name-matcher.js +0 -384
- package/dist/resolution/name-matcher.js.map +0 -1
- package/dist/resolution/path-aliases.d.ts +0 -68
- package/dist/resolution/path-aliases.d.ts.map +0 -1
- package/dist/resolution/path-aliases.js +0 -238
- package/dist/resolution/path-aliases.js.map +0 -1
- package/dist/resolution/strip-comments.d.ts +0 -27
- package/dist/resolution/strip-comments.d.ts.map +0 -1
- package/dist/resolution/strip-comments.js +0 -441
- package/dist/resolution/strip-comments.js.map +0 -1
- package/dist/resolution/types.d.ts +0 -172
- package/dist/resolution/types.d.ts.map +0 -1
- package/dist/resolution/types.js +0 -8
- package/dist/resolution/types.js.map +0 -1
- package/dist/search/query-parser.d.ts +0 -57
- package/dist/search/query-parser.d.ts.map +0 -1
- package/dist/search/query-parser.js +0 -177
- package/dist/search/query-parser.js.map +0 -1
- package/dist/search/query-utils.d.ts +0 -53
- package/dist/search/query-utils.d.ts.map +0 -1
- package/dist/search/query-utils.js +0 -350
- package/dist/search/query-utils.js.map +0 -1
- package/dist/sync/git-hooks.d.ts +0 -45
- package/dist/sync/git-hooks.d.ts.map +0 -1
- package/dist/sync/git-hooks.js +0 -223
- package/dist/sync/git-hooks.js.map +0 -1
- package/dist/sync/index.d.ts +0 -17
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js +0 -28
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/watch-policy.d.ts +0 -48
- package/dist/sync/watch-policy.d.ts.map +0 -1
- package/dist/sync/watch-policy.js +0 -124
- package/dist/sync/watch-policy.js.map +0 -1
- package/dist/sync/watcher.d.ts +0 -81
- package/dist/sync/watcher.d.ts.map +0 -1
- package/dist/sync/watcher.js +0 -194
- package/dist/sync/watcher.js.map +0 -1
- package/dist/types.d.ts +0 -423
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -256
- package/dist/types.js.map +0 -1
- package/dist/ui/glyphs.d.ts +0 -42
- package/dist/ui/glyphs.d.ts.map +0 -1
- package/dist/ui/glyphs.js +0 -78
- package/dist/ui/glyphs.js.map +0 -1
- package/dist/ui/shimmer-progress.d.ts +0 -11
- package/dist/ui/shimmer-progress.d.ts.map +0 -1
- package/dist/ui/shimmer-progress.js +0 -90
- package/dist/ui/shimmer-progress.js.map +0 -1
- package/dist/ui/shimmer-worker.d.ts +0 -2
- package/dist/ui/shimmer-worker.d.ts.map +0 -1
- package/dist/ui/shimmer-worker.js +0 -118
- package/dist/ui/shimmer-worker.js.map +0 -1
- package/dist/ui/types.d.ts +0 -17
- package/dist/ui/types.d.ts.map +0 -1
- package/dist/ui/types.js +0 -3
- package/dist/ui/types.js.map +0 -1
- package/dist/utils.d.ts +0 -205
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -549
- package/dist/utils.js.map +0 -1
- package/scripts/agent-eval/audit.sh +0 -68
- package/scripts/agent-eval/itrun.sh +0 -107
- package/scripts/agent-eval/parse-run.mjs +0 -45
- package/scripts/agent-eval/parse-session.mjs +0 -93
- package/scripts/agent-eval/run-agent.sh +0 -34
- package/scripts/agent-eval/run-all.sh +0 -67
- package/scripts/extract-release-notes.mjs +0 -130
- package/scripts/local-install.sh +0 -41
- package/scripts/patch-tree-sitter-dart.js +0 -112
- package/scripts/release.sh +0 -68
package/dist/resolution/index.js
DELETED
|
@@ -1,709 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Reference Resolution Orchestrator
|
|
4
|
-
*
|
|
5
|
-
* Coordinates all reference resolution strategies.
|
|
6
|
-
*/
|
|
7
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
-
if (k2 === undefined) k2 = k;
|
|
9
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(o, k2, desc);
|
|
14
|
-
}) : (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
o[k2] = m[k];
|
|
17
|
-
}));
|
|
18
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
-
}) : function(o, v) {
|
|
21
|
-
o["default"] = v;
|
|
22
|
-
});
|
|
23
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
-
var ownKeys = function(o) {
|
|
25
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
-
var ar = [];
|
|
27
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
-
return ar;
|
|
29
|
-
};
|
|
30
|
-
return ownKeys(o);
|
|
31
|
-
};
|
|
32
|
-
return function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
41
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
42
|
-
};
|
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.ReferenceResolver = void 0;
|
|
45
|
-
exports.createResolver = createResolver;
|
|
46
|
-
const fs = __importStar(require("fs"));
|
|
47
|
-
const path = __importStar(require("path"));
|
|
48
|
-
const name_matcher_1 = require("./name-matcher");
|
|
49
|
-
const import_resolver_1 = require("./import-resolver");
|
|
50
|
-
const frameworks_1 = require("./frameworks");
|
|
51
|
-
const path_aliases_1 = require("./path-aliases");
|
|
52
|
-
const errors_1 = require("../errors");
|
|
53
|
-
// Re-export types
|
|
54
|
-
__exportStar(require("./types"), exports);
|
|
55
|
-
// Pre-built Sets for O(1) built-in lookups (allocated once, shared across all instances)
|
|
56
|
-
const JS_BUILT_INS = new Set([
|
|
57
|
-
'console', 'window', 'document', 'global', 'process',
|
|
58
|
-
'Promise', 'Array', 'Object', 'String', 'Number', 'Boolean',
|
|
59
|
-
'Date', 'Math', 'JSON', 'RegExp', 'Error', 'Map', 'Set',
|
|
60
|
-
'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',
|
|
61
|
-
'fetch', 'require', 'module', 'exports', '__dirname', '__filename',
|
|
62
|
-
]);
|
|
63
|
-
const REACT_HOOKS = new Set([
|
|
64
|
-
'useState', 'useEffect', 'useContext', 'useReducer', 'useCallback',
|
|
65
|
-
'useMemo', 'useRef', 'useLayoutEffect', 'useImperativeHandle', 'useDebugValue',
|
|
66
|
-
]);
|
|
67
|
-
const PYTHON_BUILT_INS = new Set([
|
|
68
|
-
'print', 'len', 'range', 'str', 'int', 'float', 'list', 'dict', 'set', 'tuple',
|
|
69
|
-
'open', 'input', 'type', 'isinstance', 'hasattr', 'getattr', 'setattr',
|
|
70
|
-
'super', 'self', 'cls', 'None', 'True', 'False',
|
|
71
|
-
]);
|
|
72
|
-
const PYTHON_BUILT_IN_TYPES = new Set([
|
|
73
|
-
'list', 'dict', 'set', 'tuple', 'str', 'int', 'float', 'bool',
|
|
74
|
-
'bytes', 'bytearray', 'frozenset', 'object', 'super',
|
|
75
|
-
]);
|
|
76
|
-
const PYTHON_BUILT_IN_METHODS = new Set([
|
|
77
|
-
'append', 'extend', 'insert', 'remove', 'pop', 'clear', 'sort', 'reverse', 'copy',
|
|
78
|
-
'update', 'keys', 'values', 'items', 'get',
|
|
79
|
-
'add', 'discard', 'union', 'intersection', 'difference',
|
|
80
|
-
'split', 'join', 'strip', 'lstrip', 'rstrip', 'replace', 'lower', 'upper',
|
|
81
|
-
'startswith', 'endswith', 'find', 'index', 'count', 'encode', 'decode',
|
|
82
|
-
'format', 'isdigit', 'isalpha', 'isalnum',
|
|
83
|
-
'read', 'write', 'readline', 'readlines', 'close', 'flush', 'seek',
|
|
84
|
-
]);
|
|
85
|
-
const GO_STDLIB_PACKAGES = new Set([
|
|
86
|
-
'fmt', 'os', 'io', 'net', 'http', 'log', 'math', 'sort', 'sync',
|
|
87
|
-
'time', 'path', 'bytes', 'strings', 'strconv', 'errors', 'context',
|
|
88
|
-
'json', 'xml', 'csv', 'html', 'template', 'regexp', 'reflect',
|
|
89
|
-
'runtime', 'testing', 'flag', 'bufio', 'crypto', 'encoding',
|
|
90
|
-
'filepath', 'hash', 'mime', 'rand', 'signal', 'sql', 'syscall',
|
|
91
|
-
'unicode', 'unsafe', 'atomic', 'binary', 'debug', 'exec', 'heap',
|
|
92
|
-
'ring', 'scanner', 'tar', 'zip', 'gzip', 'zlib', 'tls', 'url',
|
|
93
|
-
'user', 'pprof', 'trace', 'ast', 'build', 'parser', 'printer',
|
|
94
|
-
'token', 'types', 'cgo', 'plugin', 'race', 'ioutil',
|
|
95
|
-
// Kubernetes-common stdlib aliases
|
|
96
|
-
'utilruntime', 'utilwait', 'utilnet',
|
|
97
|
-
]);
|
|
98
|
-
const GO_BUILT_INS = new Set([
|
|
99
|
-
'make', 'new', 'len', 'cap', 'append', 'copy', 'delete', 'close',
|
|
100
|
-
'panic', 'recover', 'print', 'println', 'complex', 'real', 'imag',
|
|
101
|
-
'error', 'nil', 'true', 'false', 'iota',
|
|
102
|
-
'int', 'int8', 'int16', 'int32', 'int64',
|
|
103
|
-
'uint', 'uint8', 'uint16', 'uint32', 'uint64', 'uintptr',
|
|
104
|
-
'float32', 'float64', 'complex64', 'complex128',
|
|
105
|
-
'string', 'bool', 'byte', 'rune', 'any',
|
|
106
|
-
]);
|
|
107
|
-
const PASCAL_UNIT_PREFIXES = [
|
|
108
|
-
'System.', 'Winapi.', 'Vcl.', 'Fmx.', 'Data.', 'Datasnap.',
|
|
109
|
-
'Soap.', 'Xml.', 'Web.', 'REST.', 'FireDAC.', 'IBX.',
|
|
110
|
-
'IdHTTP', 'IdTCP', 'IdSSL',
|
|
111
|
-
];
|
|
112
|
-
const PASCAL_BUILT_INS = new Set([
|
|
113
|
-
'System', 'SysUtils', 'Classes', 'Types', 'Variants', 'StrUtils',
|
|
114
|
-
'Math', 'DateUtils', 'IOUtils', 'Generics.Collections', 'Generics.Defaults',
|
|
115
|
-
'Rtti', 'TypInfo', 'SyncObjs', 'RegularExpressions',
|
|
116
|
-
'SysInit', 'Windows', 'Messages', 'Graphics', 'Controls', 'Forms',
|
|
117
|
-
'Dialogs', 'StdCtrls', 'ExtCtrls', 'ComCtrls', 'Menus', 'ActnList',
|
|
118
|
-
'WriteLn', 'Write', 'ReadLn', 'Read', 'Inc', 'Dec', 'Ord', 'Chr',
|
|
119
|
-
'Length', 'SetLength', 'High', 'Low', 'Assigned', 'FreeAndNil',
|
|
120
|
-
'Format', 'IntToStr', 'StrToInt', 'FloatToStr', 'StrToFloat',
|
|
121
|
-
'Trim', 'UpperCase', 'LowerCase', 'Pos', 'Copy', 'Delete', 'Insert',
|
|
122
|
-
'Now', 'Date', 'Time', 'DateToStr', 'StrToDate',
|
|
123
|
-
'Raise', 'Exit', 'Break', 'Continue', 'Abort',
|
|
124
|
-
'True', 'False', 'nil', 'Self', 'Result',
|
|
125
|
-
'Create', 'Destroy', 'Free',
|
|
126
|
-
'TObject', 'TComponent', 'TPersistent', 'TInterfacedObject',
|
|
127
|
-
'TList', 'TStringList', 'TStrings', 'TStream', 'TMemoryStream', 'TFileStream',
|
|
128
|
-
'Exception', 'EAbort', 'EConvertError', 'EAccessViolation',
|
|
129
|
-
'IInterface', 'IUnknown',
|
|
130
|
-
]);
|
|
131
|
-
/**
|
|
132
|
-
* Reference Resolver
|
|
133
|
-
*
|
|
134
|
-
* Orchestrates reference resolution using multiple strategies.
|
|
135
|
-
*/
|
|
136
|
-
class ReferenceResolver {
|
|
137
|
-
projectRoot;
|
|
138
|
-
queries;
|
|
139
|
-
context;
|
|
140
|
-
frameworks = [];
|
|
141
|
-
nodeCache = new Map(); // per-file node cache (bounded)
|
|
142
|
-
fileCache = new Map(); // per-file content cache (bounded)
|
|
143
|
-
importMappingCache = new Map();
|
|
144
|
-
reExportCache = new Map();
|
|
145
|
-
nameCache = new Map(); // name → nodes cache
|
|
146
|
-
lowerNameCache = new Map(); // lower(name) → nodes cache
|
|
147
|
-
qualifiedNameCache = new Map(); // qualified_name → nodes cache
|
|
148
|
-
knownNames = null; // all known symbol names for fast pre-filtering
|
|
149
|
-
knownFiles = null;
|
|
150
|
-
cachesWarmed = false;
|
|
151
|
-
// tsconfig/jsconfig path-alias map. `undefined` = not yet computed,
|
|
152
|
-
// `null` = computed and absent. Treated as immutable for the
|
|
153
|
-
// resolver's lifetime; callers re-create the resolver if config changes.
|
|
154
|
-
projectAliases = undefined;
|
|
155
|
-
constructor(projectRoot, queries) {
|
|
156
|
-
this.projectRoot = projectRoot;
|
|
157
|
-
this.queries = queries;
|
|
158
|
-
this.context = this.createContext();
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Initialize the resolver (detect frameworks, etc.)
|
|
162
|
-
*/
|
|
163
|
-
initialize() {
|
|
164
|
-
this.frameworks = (0, frameworks_1.detectFrameworks)(this.context);
|
|
165
|
-
this.clearCaches();
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Pre-build lightweight caches for resolution.
|
|
169
|
-
* Node lookups are now handled by indexed SQLite queries instead of
|
|
170
|
-
* loading all nodes into memory (which caused OOM on large codebases).
|
|
171
|
-
* We cache the set of known symbol names for fast pre-filtering.
|
|
172
|
-
*/
|
|
173
|
-
warmCaches() {
|
|
174
|
-
if (this.cachesWarmed)
|
|
175
|
-
return;
|
|
176
|
-
// Only cache the set of known file paths (lightweight string set)
|
|
177
|
-
this.knownFiles = new Set(this.queries.getAllFilePaths());
|
|
178
|
-
// Cache all distinct symbol names for fast pre-filtering (just strings, not full nodes)
|
|
179
|
-
this.knownNames = new Set(this.queries.getAllNodeNames());
|
|
180
|
-
this.cachesWarmed = true;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Clear internal caches
|
|
184
|
-
*/
|
|
185
|
-
clearCaches() {
|
|
186
|
-
this.nodeCache.clear();
|
|
187
|
-
this.fileCache.clear();
|
|
188
|
-
this.importMappingCache.clear();
|
|
189
|
-
this.reExportCache.clear();
|
|
190
|
-
this.nameCache.clear();
|
|
191
|
-
this.lowerNameCache.clear();
|
|
192
|
-
this.qualifiedNameCache.clear();
|
|
193
|
-
this.knownNames = null;
|
|
194
|
-
this.knownFiles = null;
|
|
195
|
-
this.cachesWarmed = false;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Create the resolution context
|
|
199
|
-
*/
|
|
200
|
-
createContext() {
|
|
201
|
-
return {
|
|
202
|
-
getNodesInFile: (filePath) => {
|
|
203
|
-
if (!this.nodeCache.has(filePath)) {
|
|
204
|
-
this.nodeCache.set(filePath, this.queries.getNodesByFile(filePath));
|
|
205
|
-
}
|
|
206
|
-
return this.nodeCache.get(filePath);
|
|
207
|
-
},
|
|
208
|
-
getNodesByName: (name) => {
|
|
209
|
-
const cached = this.nameCache.get(name);
|
|
210
|
-
if (cached !== undefined)
|
|
211
|
-
return cached;
|
|
212
|
-
const result = this.queries.getNodesByName(name);
|
|
213
|
-
this.nameCache.set(name, result);
|
|
214
|
-
return result;
|
|
215
|
-
},
|
|
216
|
-
getNodesByQualifiedName: (qualifiedName) => {
|
|
217
|
-
const cached = this.qualifiedNameCache.get(qualifiedName);
|
|
218
|
-
if (cached !== undefined)
|
|
219
|
-
return cached;
|
|
220
|
-
const result = this.queries.getNodesByQualifiedNameExact(qualifiedName);
|
|
221
|
-
this.qualifiedNameCache.set(qualifiedName, result);
|
|
222
|
-
return result;
|
|
223
|
-
},
|
|
224
|
-
getNodesByKind: (kind) => {
|
|
225
|
-
return this.queries.getNodesByKind(kind);
|
|
226
|
-
},
|
|
227
|
-
fileExists: (filePath) => {
|
|
228
|
-
// Check pre-built known files set first (O(1))
|
|
229
|
-
if (this.knownFiles) {
|
|
230
|
-
const normalized = filePath.replace(/\\/g, '/');
|
|
231
|
-
if (this.knownFiles.has(filePath) || this.knownFiles.has(normalized)) {
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
// Fall back to filesystem for files not yet indexed
|
|
236
|
-
const fullPath = path.join(this.projectRoot, filePath);
|
|
237
|
-
try {
|
|
238
|
-
return fs.existsSync(fullPath);
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
(0, errors_1.logDebug)('Error checking file existence', { filePath, error: String(error) });
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
readFile: (filePath) => {
|
|
246
|
-
if (this.fileCache.has(filePath)) {
|
|
247
|
-
return this.fileCache.get(filePath);
|
|
248
|
-
}
|
|
249
|
-
const fullPath = path.join(this.projectRoot, filePath);
|
|
250
|
-
try {
|
|
251
|
-
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
252
|
-
this.fileCache.set(filePath, content);
|
|
253
|
-
return content;
|
|
254
|
-
}
|
|
255
|
-
catch (error) {
|
|
256
|
-
(0, errors_1.logDebug)('Failed to read file for resolution', { filePath, error: String(error) });
|
|
257
|
-
this.fileCache.set(filePath, null);
|
|
258
|
-
return null;
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
getProjectRoot: () => this.projectRoot,
|
|
262
|
-
getAllFiles: () => {
|
|
263
|
-
return this.queries.getAllFilePaths();
|
|
264
|
-
},
|
|
265
|
-
listDirectories: (relativePath) => {
|
|
266
|
-
const target = relativePath === '.' || relativePath === ''
|
|
267
|
-
? this.projectRoot
|
|
268
|
-
: path.join(this.projectRoot, relativePath);
|
|
269
|
-
try {
|
|
270
|
-
return fs
|
|
271
|
-
.readdirSync(target, { withFileTypes: true })
|
|
272
|
-
.filter((entry) => entry.isDirectory())
|
|
273
|
-
.map((entry) => entry.name);
|
|
274
|
-
}
|
|
275
|
-
catch (error) {
|
|
276
|
-
(0, errors_1.logDebug)('Failed to list directory for resolution', {
|
|
277
|
-
relativePath,
|
|
278
|
-
error: String(error),
|
|
279
|
-
});
|
|
280
|
-
return [];
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
getNodesByLowerName: (lowerName) => {
|
|
284
|
-
const cached = this.lowerNameCache.get(lowerName);
|
|
285
|
-
if (cached !== undefined)
|
|
286
|
-
return cached;
|
|
287
|
-
const result = this.queries.getNodesByLowerName(lowerName);
|
|
288
|
-
this.lowerNameCache.set(lowerName, result);
|
|
289
|
-
return result;
|
|
290
|
-
},
|
|
291
|
-
getImportMappings: (filePath, language) => {
|
|
292
|
-
const cacheKey = filePath;
|
|
293
|
-
const cached = this.importMappingCache.get(cacheKey);
|
|
294
|
-
if (cached)
|
|
295
|
-
return cached;
|
|
296
|
-
const content = this.context.readFile(filePath);
|
|
297
|
-
if (!content) {
|
|
298
|
-
this.importMappingCache.set(cacheKey, []);
|
|
299
|
-
return [];
|
|
300
|
-
}
|
|
301
|
-
const mappings = (0, import_resolver_1.extractImportMappings)(filePath, content, language);
|
|
302
|
-
this.importMappingCache.set(cacheKey, mappings);
|
|
303
|
-
return mappings;
|
|
304
|
-
},
|
|
305
|
-
getProjectAliases: () => {
|
|
306
|
-
if (this.projectAliases === undefined) {
|
|
307
|
-
this.projectAliases = (0, path_aliases_1.loadProjectAliases)(this.projectRoot);
|
|
308
|
-
}
|
|
309
|
-
return this.projectAliases;
|
|
310
|
-
},
|
|
311
|
-
getReExports: (filePath, language) => {
|
|
312
|
-
const cached = this.reExportCache.get(filePath);
|
|
313
|
-
if (cached)
|
|
314
|
-
return cached;
|
|
315
|
-
const content = this.context.readFile(filePath);
|
|
316
|
-
if (!content) {
|
|
317
|
-
this.reExportCache.set(filePath, []);
|
|
318
|
-
return [];
|
|
319
|
-
}
|
|
320
|
-
const reExports = (0, import_resolver_1.extractReExports)(content, language);
|
|
321
|
-
this.reExportCache.set(filePath, reExports);
|
|
322
|
-
return reExports;
|
|
323
|
-
},
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Resolve all unresolved references
|
|
328
|
-
*/
|
|
329
|
-
resolveAll(unresolvedRefs, onProgress) {
|
|
330
|
-
// Pre-load all nodes into memory for fast lookups
|
|
331
|
-
this.warmCaches();
|
|
332
|
-
const resolved = [];
|
|
333
|
-
const unresolved = [];
|
|
334
|
-
const byMethod = {};
|
|
335
|
-
// Convert to our internal format, using denormalized fields when available
|
|
336
|
-
const refs = unresolvedRefs.map((ref) => ({
|
|
337
|
-
fromNodeId: ref.fromNodeId,
|
|
338
|
-
referenceName: ref.referenceName,
|
|
339
|
-
referenceKind: ref.referenceKind,
|
|
340
|
-
line: ref.line,
|
|
341
|
-
column: ref.column,
|
|
342
|
-
filePath: ref.filePath || this.getFilePathFromNodeId(ref.fromNodeId),
|
|
343
|
-
language: ref.language || this.getLanguageFromNodeId(ref.fromNodeId),
|
|
344
|
-
}));
|
|
345
|
-
const total = refs.length;
|
|
346
|
-
let lastReportedPercent = -1;
|
|
347
|
-
for (let i = 0; i < refs.length; i++) {
|
|
348
|
-
const ref = refs[i]; // Array index is guaranteed to be in bounds
|
|
349
|
-
const result = this.resolveOne(ref);
|
|
350
|
-
if (result) {
|
|
351
|
-
resolved.push(result);
|
|
352
|
-
byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
|
|
353
|
-
}
|
|
354
|
-
else {
|
|
355
|
-
unresolved.push(ref);
|
|
356
|
-
}
|
|
357
|
-
// Report progress every 1% to avoid too many updates
|
|
358
|
-
if (onProgress) {
|
|
359
|
-
const currentPercent = Math.floor((i / total) * 100);
|
|
360
|
-
if (currentPercent > lastReportedPercent) {
|
|
361
|
-
lastReportedPercent = currentPercent;
|
|
362
|
-
onProgress(i + 1, total);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
// Final progress report
|
|
367
|
-
if (onProgress && total > 0) {
|
|
368
|
-
onProgress(total, total);
|
|
369
|
-
}
|
|
370
|
-
return {
|
|
371
|
-
resolved,
|
|
372
|
-
unresolved,
|
|
373
|
-
stats: {
|
|
374
|
-
total: refs.length,
|
|
375
|
-
resolved: resolved.length,
|
|
376
|
-
unresolved: unresolved.length,
|
|
377
|
-
byMethod,
|
|
378
|
-
},
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Check if a reference name has any possible match in the codebase.
|
|
383
|
-
* Uses the pre-built knownNames set to skip expensive resolution
|
|
384
|
-
* for names that definitely don't exist as symbols.
|
|
385
|
-
*/
|
|
386
|
-
hasAnyPossibleMatch(name) {
|
|
387
|
-
if (!this.knownNames)
|
|
388
|
-
return true; // no pre-filter available
|
|
389
|
-
// Direct name match
|
|
390
|
-
if (this.knownNames.has(name))
|
|
391
|
-
return true;
|
|
392
|
-
// For qualified names like "obj.method" or "Class::method", check the parts
|
|
393
|
-
const dotIdx = name.indexOf('.');
|
|
394
|
-
if (dotIdx > 0) {
|
|
395
|
-
const receiver = name.substring(0, dotIdx);
|
|
396
|
-
const member = name.substring(dotIdx + 1);
|
|
397
|
-
if (this.knownNames.has(receiver) || this.knownNames.has(member))
|
|
398
|
-
return true;
|
|
399
|
-
// Also check capitalized receiver (instance-method resolution)
|
|
400
|
-
const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
|
|
401
|
-
if (this.knownNames.has(capitalized))
|
|
402
|
-
return true;
|
|
403
|
-
}
|
|
404
|
-
const colonIdx = name.indexOf('::');
|
|
405
|
-
if (colonIdx > 0) {
|
|
406
|
-
const receiver = name.substring(0, colonIdx);
|
|
407
|
-
const member = name.substring(colonIdx + 2);
|
|
408
|
-
if (this.knownNames.has(receiver) || this.knownNames.has(member))
|
|
409
|
-
return true;
|
|
410
|
-
}
|
|
411
|
-
// For path-like references (e.g., "snippets/drawer-menu.liquid"), check the filename
|
|
412
|
-
const slashIdx = name.lastIndexOf('/');
|
|
413
|
-
if (slashIdx > 0) {
|
|
414
|
-
const fileName = name.substring(slashIdx + 1);
|
|
415
|
-
if (this.knownNames.has(fileName))
|
|
416
|
-
return true;
|
|
417
|
-
}
|
|
418
|
-
return false;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Does `ref.referenceName` match an import declared in its containing
|
|
422
|
-
* file? Used as a pre-filter escape so re-export chain resolution
|
|
423
|
-
* still gets a chance when the name has no project-wide declaration.
|
|
424
|
-
*/
|
|
425
|
-
matchesAnyImport(ref) {
|
|
426
|
-
const imports = this.context.getImportMappings(ref.filePath, ref.language);
|
|
427
|
-
if (imports.length === 0)
|
|
428
|
-
return false;
|
|
429
|
-
for (const imp of imports) {
|
|
430
|
-
if (imp.localName === ref.referenceName ||
|
|
431
|
-
ref.referenceName.startsWith(imp.localName + '.')) {
|
|
432
|
-
return true;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
return false;
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Resolve a single reference
|
|
439
|
-
*/
|
|
440
|
-
resolveOne(ref) {
|
|
441
|
-
// Skip built-in/external references
|
|
442
|
-
if (this.isBuiltInOrExternal(ref)) {
|
|
443
|
-
return null;
|
|
444
|
-
}
|
|
445
|
-
// Fast pre-filter: skip if no symbol with this name exists anywhere
|
|
446
|
-
// AND the name doesn't match a local import. The import escape is
|
|
447
|
-
// necessary because re-export rename chains (`import { login }
|
|
448
|
-
// from './barrel'` where the barrel has `export { signIn as login }
|
|
449
|
-
// from './auth'`) intentionally call a name that has no
|
|
450
|
-
// declaration anywhere — only the renamed upstream symbol does.
|
|
451
|
-
if (!this.hasAnyPossibleMatch(ref.referenceName) && !this.matchesAnyImport(ref)) {
|
|
452
|
-
return null;
|
|
453
|
-
}
|
|
454
|
-
const candidates = [];
|
|
455
|
-
// Strategy 1: Try framework-specific resolution
|
|
456
|
-
for (const framework of this.frameworks) {
|
|
457
|
-
const result = framework.resolve(ref, this.context);
|
|
458
|
-
if (result) {
|
|
459
|
-
if (result.confidence >= 0.9)
|
|
460
|
-
return result; // High confidence, return immediately
|
|
461
|
-
candidates.push(result);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
// Strategy 2: Try import-based resolution
|
|
465
|
-
const importResult = (0, import_resolver_1.resolveViaImport)(ref, this.context);
|
|
466
|
-
if (importResult) {
|
|
467
|
-
if (importResult.confidence >= 0.9)
|
|
468
|
-
return importResult;
|
|
469
|
-
candidates.push(importResult);
|
|
470
|
-
}
|
|
471
|
-
// Strategy 3: Try name matching
|
|
472
|
-
const nameResult = (0, name_matcher_1.matchReference)(ref, this.context);
|
|
473
|
-
if (nameResult) {
|
|
474
|
-
candidates.push(nameResult);
|
|
475
|
-
}
|
|
476
|
-
if (candidates.length === 0)
|
|
477
|
-
return null;
|
|
478
|
-
// Return highest confidence candidate
|
|
479
|
-
return candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best);
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Create edges from resolved references
|
|
483
|
-
*/
|
|
484
|
-
createEdges(resolved) {
|
|
485
|
-
return resolved.map((ref) => {
|
|
486
|
-
let kind = ref.original.referenceKind;
|
|
487
|
-
// Promote "extends" to "implements" when a class/struct targets an interface
|
|
488
|
-
if (kind === 'extends') {
|
|
489
|
-
const targetNode = this.queries.getNodeById(ref.targetNodeId);
|
|
490
|
-
if (targetNode && (targetNode.kind === 'interface' || targetNode.kind === 'protocol')) {
|
|
491
|
-
const sourceNode = this.queries.getNodeById(ref.original.fromNodeId);
|
|
492
|
-
if (sourceNode && sourceNode.kind !== 'interface' && sourceNode.kind !== 'protocol') {
|
|
493
|
-
kind = 'implements';
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
// Promote "calls" to "instantiates" when the resolved target is a
|
|
498
|
-
// class/struct. Languages without a `new` keyword (Python, Ruby)
|
|
499
|
-
// express instantiation as `Foo()` — extraction can't tell that
|
|
500
|
-
// apart from a function call without symbol info, but resolution
|
|
501
|
-
// can: if `Foo` resolves to a class, the call IS an instantiation.
|
|
502
|
-
if (kind === 'calls') {
|
|
503
|
-
const targetNode = this.queries.getNodeById(ref.targetNodeId);
|
|
504
|
-
if (targetNode && (targetNode.kind === 'class' || targetNode.kind === 'struct')) {
|
|
505
|
-
kind = 'instantiates';
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
return {
|
|
509
|
-
source: ref.original.fromNodeId,
|
|
510
|
-
target: ref.targetNodeId,
|
|
511
|
-
kind,
|
|
512
|
-
line: ref.original.line,
|
|
513
|
-
column: ref.original.column,
|
|
514
|
-
metadata: {
|
|
515
|
-
confidence: ref.confidence,
|
|
516
|
-
resolvedBy: ref.resolvedBy,
|
|
517
|
-
},
|
|
518
|
-
};
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Resolve and persist edges to database
|
|
523
|
-
*/
|
|
524
|
-
resolveAndPersist(unresolvedRefs, onProgress) {
|
|
525
|
-
const result = this.resolveAll(unresolvedRefs, onProgress);
|
|
526
|
-
// Create edges from resolved references
|
|
527
|
-
const edges = this.createEdges(result.resolved);
|
|
528
|
-
// Insert edges into database
|
|
529
|
-
if (edges.length > 0) {
|
|
530
|
-
this.queries.insertEdges(edges);
|
|
531
|
-
}
|
|
532
|
-
// Clean up resolved refs from unresolved_refs table so metrics are accurate
|
|
533
|
-
if (result.resolved.length > 0) {
|
|
534
|
-
this.queries.deleteSpecificResolvedReferences(result.resolved.map((r) => ({
|
|
535
|
-
fromNodeId: r.original.fromNodeId,
|
|
536
|
-
referenceName: r.original.referenceName,
|
|
537
|
-
referenceKind: r.original.referenceKind,
|
|
538
|
-
})));
|
|
539
|
-
}
|
|
540
|
-
return result;
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Resolve and persist in batches to keep memory bounded.
|
|
544
|
-
* Processes unresolved references in chunks, persisting edges and cleaning
|
|
545
|
-
* up resolved refs after each batch to avoid accumulating large arrays.
|
|
546
|
-
*/
|
|
547
|
-
async resolveAndPersistBatched(onProgress, batchSize = 5000) {
|
|
548
|
-
this.warmCaches();
|
|
549
|
-
const total = this.queries.getUnresolvedReferencesCount();
|
|
550
|
-
let processed = 0;
|
|
551
|
-
const aggregateStats = {
|
|
552
|
-
total: 0,
|
|
553
|
-
resolved: 0,
|
|
554
|
-
unresolved: 0,
|
|
555
|
-
byMethod: {},
|
|
556
|
-
};
|
|
557
|
-
// Process in batches. We always read from offset 0 because resolved refs
|
|
558
|
-
// are deleted after each batch, shifting the remaining rows forward.
|
|
559
|
-
while (true) {
|
|
560
|
-
const batch = this.queries.getUnresolvedReferencesBatch(0, batchSize);
|
|
561
|
-
if (batch.length === 0)
|
|
562
|
-
break;
|
|
563
|
-
const result = this.resolveAll(batch);
|
|
564
|
-
// Persist edges immediately
|
|
565
|
-
const edges = this.createEdges(result.resolved);
|
|
566
|
-
if (edges.length > 0) {
|
|
567
|
-
this.queries.insertEdges(edges);
|
|
568
|
-
}
|
|
569
|
-
// Clean up resolved refs so they don't appear in the next batch
|
|
570
|
-
if (result.resolved.length > 0) {
|
|
571
|
-
this.queries.deleteSpecificResolvedReferences(result.resolved.map((r) => ({
|
|
572
|
-
fromNodeId: r.original.fromNodeId,
|
|
573
|
-
referenceName: r.original.referenceName,
|
|
574
|
-
referenceKind: r.original.referenceKind,
|
|
575
|
-
})));
|
|
576
|
-
}
|
|
577
|
-
// Delete unresolvable refs from this batch to avoid re-processing them
|
|
578
|
-
if (result.unresolved.length > 0) {
|
|
579
|
-
this.queries.deleteSpecificResolvedReferences(result.unresolved.map((r) => ({
|
|
580
|
-
fromNodeId: r.fromNodeId,
|
|
581
|
-
referenceName: r.referenceName,
|
|
582
|
-
referenceKind: r.referenceKind,
|
|
583
|
-
})));
|
|
584
|
-
}
|
|
585
|
-
// Aggregate stats
|
|
586
|
-
aggregateStats.total += result.stats.total;
|
|
587
|
-
aggregateStats.resolved += result.stats.resolved;
|
|
588
|
-
aggregateStats.unresolved += result.stats.unresolved;
|
|
589
|
-
for (const [method, count] of Object.entries(result.stats.byMethod)) {
|
|
590
|
-
aggregateStats.byMethod[method] = (aggregateStats.byMethod[method] || 0) + count;
|
|
591
|
-
}
|
|
592
|
-
processed += batch.length;
|
|
593
|
-
onProgress?.(processed, total);
|
|
594
|
-
// Yield so progress UI can render between batches
|
|
595
|
-
await new Promise(resolve => setImmediate(resolve));
|
|
596
|
-
// If nothing was resolved or removed in this batch, we'd loop forever
|
|
597
|
-
// on the same rows. Break to avoid infinite loop.
|
|
598
|
-
if (result.resolved.length === 0 && result.unresolved.length === batch.length) {
|
|
599
|
-
break;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
return {
|
|
603
|
-
resolved: [],
|
|
604
|
-
unresolved: [],
|
|
605
|
-
stats: aggregateStats,
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* Get detected frameworks
|
|
610
|
-
*/
|
|
611
|
-
getDetectedFrameworks() {
|
|
612
|
-
return this.frameworks.map((f) => f.name);
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
* Check if reference is to a built-in or external symbol
|
|
616
|
-
*/
|
|
617
|
-
isBuiltInOrExternal(ref) {
|
|
618
|
-
const name = ref.referenceName;
|
|
619
|
-
const isJsTs = ref.language === 'typescript' || ref.language === 'javascript'
|
|
620
|
-
|| ref.language === 'tsx' || ref.language === 'jsx';
|
|
621
|
-
// JavaScript/TypeScript built-ins
|
|
622
|
-
if (isJsTs && JS_BUILT_INS.has(name)) {
|
|
623
|
-
return true;
|
|
624
|
-
}
|
|
625
|
-
// Common JS/TS library calls (console.log, Math.floor, JSON.parse)
|
|
626
|
-
if (isJsTs && (name.startsWith('console.') || name.startsWith('Math.') || name.startsWith('JSON.'))) {
|
|
627
|
-
return true;
|
|
628
|
-
}
|
|
629
|
-
// React hooks from React itself
|
|
630
|
-
if (isJsTs && REACT_HOOKS.has(name)) {
|
|
631
|
-
return true;
|
|
632
|
-
}
|
|
633
|
-
// Python built-ins (bare calls only — dotted calls like console.print are method calls)
|
|
634
|
-
if (ref.language === 'python' && PYTHON_BUILT_INS.has(name)) {
|
|
635
|
-
return true;
|
|
636
|
-
}
|
|
637
|
-
// Python built-in method calls (e.g., list.extend, dict.update)
|
|
638
|
-
if (ref.language === 'python') {
|
|
639
|
-
const dotIdx = name.indexOf('.');
|
|
640
|
-
if (dotIdx > 0) {
|
|
641
|
-
const receiver = name.substring(0, dotIdx);
|
|
642
|
-
const method = name.substring(dotIdx + 1);
|
|
643
|
-
// Filter calls on built-in types (list.append, dict.update, etc.)
|
|
644
|
-
if (PYTHON_BUILT_IN_TYPES.has(receiver)) {
|
|
645
|
-
return true;
|
|
646
|
-
}
|
|
647
|
-
// Filter built-in methods on non-class receivers
|
|
648
|
-
// (e.g., items.append where items is a local list variable)
|
|
649
|
-
// But allow if the capitalized receiver matches a known codebase class
|
|
650
|
-
if (PYTHON_BUILT_IN_METHODS.has(method)) {
|
|
651
|
-
const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
|
|
652
|
-
if (!this.knownNames?.has(capitalized)) {
|
|
653
|
-
return true;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
if (PYTHON_BUILT_IN_METHODS.has(name)) {
|
|
658
|
-
return true;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
// Go standard library packages — refs like "fmt.Println", "http.ListenAndServe", etc.
|
|
662
|
-
if (ref.language === 'go') {
|
|
663
|
-
const dotIdx = name.indexOf('.');
|
|
664
|
-
if (dotIdx > 0) {
|
|
665
|
-
const pkg = name.substring(0, dotIdx);
|
|
666
|
-
if (GO_STDLIB_PACKAGES.has(pkg)) {
|
|
667
|
-
return true;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
if (GO_BUILT_INS.has(name)) {
|
|
671
|
-
return true;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
// Pascal/Delphi built-ins and standard library units
|
|
675
|
-
if (ref.language === 'pascal') {
|
|
676
|
-
if (PASCAL_UNIT_PREFIXES.some((p) => name.startsWith(p))) {
|
|
677
|
-
return true;
|
|
678
|
-
}
|
|
679
|
-
if (PASCAL_BUILT_INS.has(name)) {
|
|
680
|
-
return true;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
return false;
|
|
684
|
-
}
|
|
685
|
-
/**
|
|
686
|
-
* Get file path from node ID
|
|
687
|
-
*/
|
|
688
|
-
getFilePathFromNodeId(nodeId) {
|
|
689
|
-
const node = this.queries.getNodeById(nodeId);
|
|
690
|
-
return node?.filePath || '';
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Get language from node ID
|
|
694
|
-
*/
|
|
695
|
-
getLanguageFromNodeId(nodeId) {
|
|
696
|
-
const node = this.queries.getNodeById(nodeId);
|
|
697
|
-
return node?.language || 'unknown';
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
exports.ReferenceResolver = ReferenceResolver;
|
|
701
|
-
/**
|
|
702
|
-
* Create a reference resolver instance
|
|
703
|
-
*/
|
|
704
|
-
function createResolver(projectRoot, queries) {
|
|
705
|
-
const resolver = new ReferenceResolver(projectRoot, queries);
|
|
706
|
-
resolver.initialize();
|
|
707
|
-
return resolver;
|
|
708
|
-
}
|
|
709
|
-
//# sourceMappingURL=index.js.map
|