@aroman22/codegraph-vba-darwin-arm64 1.5.2 → 1.6.0
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/bin/codegraph +5 -0
- package/lib/dist/bin/codegraph.d.ts +1 -1
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +307 -81
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.d.ts +38 -1
- package/lib/dist/bin/command-supervision.d.ts.map +1 -1
- package/lib/dist/bin/command-supervision.js +22 -3
- package/lib/dist/bin/command-supervision.js.map +1 -1
- package/lib/dist/db/index.d.ts +84 -5
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +209 -12
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +80 -3
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +116 -4
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +294 -7
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +43 -1
- package/lib/dist/db/wal-valve.d.ts +106 -0
- package/lib/dist/db/wal-valve.d.ts.map +1 -0
- package/lib/dist/db/wal-valve.js +208 -0
- package/lib/dist/db/wal-valve.js.map +1 -0
- package/lib/dist/directory.d.ts +9 -5
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +210 -19
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +107 -0
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/cfml-extractor.js +494 -0
- package/lib/dist/extraction/cfml-extractor.js.map +1 -0
- package/lib/dist/extraction/grammars.d.ts +25 -1
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +177 -23
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +47 -2
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +568 -51
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/arkts.d.ts +3 -0
- package/lib/dist/extraction/languages/arkts.d.ts.map +1 -0
- package/lib/dist/extraction/languages/arkts.js +127 -0
- package/lib/dist/extraction/languages/arkts.js.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts +98 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +563 -1
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/cfquery.d.ts +12 -0
- package/lib/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfquery.js +28 -0
- package/lib/dist/extraction/languages/cfquery.js.map +1 -0
- package/lib/dist/extraction/languages/cfscript.d.ts +3 -0
- package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfscript.js +73 -0
- package/lib/dist/extraction/languages/cfscript.js.map +1 -0
- package/lib/dist/extraction/languages/cobol.d.ts +33 -0
- package/lib/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cobol.js +499 -0
- package/lib/dist/extraction/languages/cobol.js.map +1 -0
- package/lib/dist/extraction/languages/erlang.d.ts +3 -0
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/lib/dist/extraction/languages/erlang.js +350 -0
- package/lib/dist/extraction/languages/erlang.js.map +1 -0
- package/lib/dist/extraction/languages/index.d.ts.map +1 -1
- package/lib/dist/extraction/languages/index.js +18 -0
- package/lib/dist/extraction/languages/index.js.map +1 -1
- package/lib/dist/extraction/languages/nix.d.ts +3 -0
- package/lib/dist/extraction/languages/nix.d.ts.map +1 -0
- package/lib/dist/extraction/languages/nix.js +294 -0
- package/lib/dist/extraction/languages/nix.js.map +1 -0
- package/lib/dist/extraction/languages/solidity.d.ts +3 -0
- package/lib/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/lib/dist/extraction/languages/solidity.js +293 -0
- package/lib/dist/extraction/languages/solidity.js.map +1 -0
- package/lib/dist/extraction/languages/terraform.d.ts +3 -0
- package/lib/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/lib/dist/extraction/languages/terraform.js +641 -0
- package/lib/dist/extraction/languages/terraform.js.map +1 -0
- package/lib/dist/extraction/languages/vbnet.d.ts +11 -0
- package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/lib/dist/extraction/languages/vbnet.js +141 -0
- package/lib/dist/extraction/languages/vbnet.js.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts +30 -10
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +140 -38
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +28 -1
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +76 -7
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +11 -4
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +20 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +60 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +905 -20
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts +3 -0
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -0
- package/lib/dist/extraction/vba/call-sweep.js +206 -0
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -0
- package/lib/dist/extraction/vba/calls.d.ts +55 -0
- package/lib/dist/extraction/vba/calls.d.ts.map +1 -0
- package/lib/dist/extraction/vba/calls.js +439 -0
- package/lib/dist/extraction/vba/calls.js.map +1 -0
- package/lib/dist/extraction/vba/constants.d.ts +42 -0
- package/lib/dist/extraction/vba/constants.d.ts.map +1 -0
- package/lib/dist/extraction/vba/constants.js +112 -0
- package/lib/dist/extraction/vba/constants.js.map +1 -0
- package/lib/dist/extraction/vba/context.d.ts +175 -0
- package/lib/dist/extraction/vba/context.d.ts.map +1 -0
- package/lib/dist/extraction/vba/context.js +268 -0
- package/lib/dist/extraction/vba/context.js.map +1 -0
- package/lib/dist/extraction/vba/controls.d.ts +24 -0
- package/lib/dist/extraction/vba/controls.d.ts.map +1 -0
- package/lib/dist/extraction/vba/controls.js +89 -0
- package/lib/dist/extraction/vba/controls.js.map +1 -0
- package/lib/dist/extraction/vba/declarations.d.ts +3 -0
- package/lib/dist/extraction/vba/declarations.d.ts.map +1 -0
- package/lib/dist/extraction/vba/declarations.js +154 -0
- package/lib/dist/extraction/vba/declarations.js.map +1 -0
- package/lib/dist/extraction/vba/dims.d.ts +3 -0
- package/lib/dist/extraction/vba/dims.d.ts.map +1 -0
- package/lib/dist/extraction/vba/dims.js +186 -0
- package/lib/dist/extraction/vba/dims.js.map +1 -0
- package/lib/dist/extraction/vba/docmd.d.ts +16 -0
- package/lib/dist/extraction/vba/docmd.d.ts.map +1 -0
- package/lib/dist/extraction/vba/docmd.js +179 -0
- package/lib/dist/extraction/vba/docmd.js.map +1 -0
- package/lib/dist/extraction/vba/enums-consts.d.ts +15 -0
- package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -0
- package/lib/dist/extraction/vba/enums-consts.js +178 -0
- package/lib/dist/extraction/vba/enums-consts.js.map +1 -0
- package/lib/dist/extraction/vba/implements.d.ts +3 -0
- package/lib/dist/extraction/vba/implements.d.ts.map +1 -0
- package/lib/dist/extraction/vba/implements.js +52 -0
- package/lib/dist/extraction/vba/implements.js.map +1 -0
- package/lib/dist/extraction/vba/procedures.d.ts +3 -0
- package/lib/dist/extraction/vba/procedures.d.ts.map +1 -0
- package/lib/dist/extraction/vba/procedures.js +239 -0
- package/lib/dist/extraction/vba/procedures.js.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts +17 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.js +212 -0
- package/lib/dist/extraction/vba/sql-wrapper.js.map +1 -0
- package/lib/dist/extraction/vba/tempvars.d.ts +10 -0
- package/lib/dist/extraction/vba/tempvars.d.ts.map +1 -0
- package/lib/dist/extraction/vba/tempvars.js +138 -0
- package/lib/dist/extraction/vba/tempvars.js.map +1 -0
- package/lib/dist/extraction/vba/text-utils.d.ts +73 -0
- package/lib/dist/extraction/vba/text-utils.d.ts.map +1 -0
- package/lib/dist/extraction/vba/text-utils.js +195 -0
- package/lib/dist/extraction/vba/text-utils.js.map +1 -0
- package/lib/dist/extraction/vba-extractor.d.ts +3 -951
- package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-extractor.js +46 -2934
- package/lib/dist/extraction/vba-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
- package/lib/dist/extraction/vba-preprocess.js +300 -88
- package/lib/dist/extraction/vba-preprocess.js.map +1 -1
- package/lib/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +76 -17
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/index.d.ts +81 -1
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +460 -10
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +42 -0
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +97 -2
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +35 -3
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +101 -9
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +2 -1
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/early-ppid.d.ts +26 -0
- package/lib/dist/mcp/early-ppid.d.ts.map +1 -0
- package/lib/dist/mcp/early-ppid.js +29 -0
- package/lib/dist/mcp/early-ppid.js.map +1 -0
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +29 -4
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +18 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +73 -13
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +30 -4
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +14 -0
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +18 -0
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +14 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +28 -1
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.d.ts +44 -0
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/lib/dist/mcp/startup-handshake.js +73 -0
- package/lib/dist/mcp/startup-handshake.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +22 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +289 -23
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/transport.d.ts.map +1 -1
- package/lib/dist/mcp/transport.js +18 -0
- package/lib/dist/mcp/transport.js.map +1 -1
- package/lib/dist/project-config.d.ts +44 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +151 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +170 -146
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +1109 -97
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cooperative-yield.d.ts +32 -0
- package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/lib/dist/resolution/cooperative-yield.js +42 -0
- package/lib/dist/resolution/cooperative-yield.js.map +1 -0
- package/lib/dist/resolution/frameworks/cics.d.ts +20 -0
- package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/cics.js +90 -0
- package/lib/dist/resolution/frameworks/cics.js.map +1 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +6 -0
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +14 -6
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/lib/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/terraform.js +277 -0
- package/lib/dist/resolution/frameworks/terraform.js.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/goframe-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/goframe-synthesizer.js +8 -3
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +7 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +129 -4
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +64 -2
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +476 -58
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +22 -3
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +613 -39
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/strip-comments.d.ts +1 -1
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +49 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/types.d.ts +29 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.d.ts +10 -0
- package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.js +142 -4
- package/lib/dist/resolution/workspace-packages.js.map +1 -1
- package/lib/dist/search/identifier-segments.d.ts +60 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -0
- package/lib/dist/search/identifier-segments.js +176 -0
- package/lib/dist/search/identifier-segments.js.map +1 -0
- package/lib/dist/sync/git-hooks.d.ts.map +1 -1
- package/lib/dist/sync/git-hooks.js +2 -0
- package/lib/dist/sync/git-hooks.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +10 -5
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +51 -14
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +9 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +45 -0
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/types.d.ts +25 -2
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +10 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/upgrade/index.d.ts +32 -0
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +163 -14
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/upgrade/remove-binary.d.ts +87 -0
- package/lib/dist/upgrade/remove-binary.d.ts.map +1 -0
- package/lib/dist/upgrade/remove-binary.js +289 -0
- package/lib/dist/upgrade/remove-binary.js.map +1 -0
- package/lib/dist/upgrade/update-check.d.ts +92 -0
- package/lib/dist/upgrade/update-check.d.ts.map +1 -0
- package/lib/dist/upgrade/update-check.js +258 -0
- package/lib/dist/upgrade/update-check.js.map +1 -0
- package/lib/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/lib/dist/reasoning/config.d.ts +0 -45
- package/lib/dist/reasoning/config.d.ts.map +0 -1
- package/lib/dist/reasoning/config.js +0 -171
- package/lib/dist/reasoning/config.js.map +0 -1
- package/lib/dist/reasoning/credentials.d.ts +0 -5
- package/lib/dist/reasoning/credentials.d.ts.map +0 -1
- package/lib/dist/reasoning/credentials.js +0 -83
- package/lib/dist/reasoning/credentials.js.map +0 -1
- package/lib/dist/reasoning/login.d.ts +0 -21
- package/lib/dist/reasoning/login.d.ts.map +0 -1
- package/lib/dist/reasoning/login.js +0 -85
- package/lib/dist/reasoning/login.js.map +0 -1
- package/lib/dist/reasoning/reasoner.d.ts +0 -43
- package/lib/dist/reasoning/reasoner.d.ts.map +0 -1
- package/lib/dist/reasoning/reasoner.js +0 -308
- package/lib/dist/reasoning/reasoner.js.map +0 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Terraform Framework Resolver
|
|
4
|
+
*
|
|
5
|
+
* Terraform's scoping rule is narrow and directory-shaped: `var.X`,
|
|
6
|
+
* `local.X`, `module.M`, and resource/data references resolve ONLY inside
|
|
7
|
+
* the same module directory as the reference site. The generic name matcher
|
|
8
|
+
* resolves by qualified-name alone, so a reference to `var.project_id` from
|
|
9
|
+
* `modules/net-vpc/main.tf` could bind to a `variable "project_id"` declared
|
|
10
|
+
* in an unrelated module — a wrong cross-module edge that poisons impact
|
|
11
|
+
* analysis. This resolver enforces the real semantics:
|
|
12
|
+
*
|
|
13
|
+
* 1. Same directory as the reference site → resolve (highest confidence).
|
|
14
|
+
* 2. `.tfvars` files additionally walk UP to the nearest ancestor
|
|
15
|
+
* directory declaring the variable (`terraform apply -var-file=envs/prod.tfvars`
|
|
16
|
+
* sets ROOT module variables from a subdirectory).
|
|
17
|
+
* 3. Otherwise: no edge. Terraform cannot reference across sibling module
|
|
18
|
+
* directories, so a non-local candidate is never a correct target.
|
|
19
|
+
*
|
|
20
|
+
* It also bridges the module boundary through `:`-scoped references that
|
|
21
|
+
* only this resolver understands (see the extractor's emitModuleWiring):
|
|
22
|
+
*
|
|
23
|
+
* - `module.M:file` → the entry file of the module's local source
|
|
24
|
+
* directory (an `imports` edge, so a module call connects to the code
|
|
25
|
+
* it instantiates).
|
|
26
|
+
* - `module.M:var.<in>` → the child module's `variable "<in>"` node —
|
|
27
|
+
* the module block sets that variable, so "what depends on the child's
|
|
28
|
+
* var.cidr" reaches every caller.
|
|
29
|
+
* - `module.M:output.<o>` → the child module's `output "<o>"` node —
|
|
30
|
+
* `module.M.o` uses flow through to the output's definition instead of
|
|
31
|
+
* dead-ending at the module declaration.
|
|
32
|
+
*
|
|
33
|
+
* The module's `source` is re-read from the declaration's file (cached
|
|
34
|
+
* lines); only local `./`/`../` sources bridge. Registry/git sources stay
|
|
35
|
+
* unresolved — an out-of-repo module is a visible boundary, never a guess.
|
|
36
|
+
*/
|
|
37
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
38
|
+
if (k2 === undefined) k2 = k;
|
|
39
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
40
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
41
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
42
|
+
}
|
|
43
|
+
Object.defineProperty(o, k2, desc);
|
|
44
|
+
}) : (function(o, m, k, k2) {
|
|
45
|
+
if (k2 === undefined) k2 = k;
|
|
46
|
+
o[k2] = m[k];
|
|
47
|
+
}));
|
|
48
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
49
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
50
|
+
}) : function(o, v) {
|
|
51
|
+
o["default"] = v;
|
|
52
|
+
});
|
|
53
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
54
|
+
var ownKeys = function(o) {
|
|
55
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
56
|
+
var ar = [];
|
|
57
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
58
|
+
return ar;
|
|
59
|
+
};
|
|
60
|
+
return ownKeys(o);
|
|
61
|
+
};
|
|
62
|
+
return function (mod) {
|
|
63
|
+
if (mod && mod.__esModule) return mod;
|
|
64
|
+
var result = {};
|
|
65
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
66
|
+
__setModuleDefault(result, mod);
|
|
67
|
+
return result;
|
|
68
|
+
};
|
|
69
|
+
})();
|
|
70
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
|
+
exports.terraformResolver = void 0;
|
|
72
|
+
const path = __importStar(require("path"));
|
|
73
|
+
/** `module.M:file` / `module.M:var.X` / `module.M:output.X` / `module.M:remote-output.X` — extractor-emitted scoped refs. */
|
|
74
|
+
const SCOPED_REF = /^module\.([^.:\s]+):(file$|var\.|output\.|remote-output\.)/;
|
|
75
|
+
exports.terraformResolver = {
|
|
76
|
+
name: 'terraform',
|
|
77
|
+
languages: ['terraform'],
|
|
78
|
+
detect(context) {
|
|
79
|
+
return context.getAllFiles().some((f) => f.endsWith('.tf') || f.endsWith('.tfvars') || f.endsWith('.tofu'));
|
|
80
|
+
},
|
|
81
|
+
// Scoped refs name no declared symbol; opt them through the resolver's
|
|
82
|
+
// name-exists pre-filter so they reach resolve() at all.
|
|
83
|
+
claimsReference(name) {
|
|
84
|
+
return SCOPED_REF.test(name);
|
|
85
|
+
},
|
|
86
|
+
resolve(ref, context) {
|
|
87
|
+
if (ref.language !== 'terraform')
|
|
88
|
+
return null;
|
|
89
|
+
const qname = ref.referenceName;
|
|
90
|
+
const refDir = dirOf(ref.filePath);
|
|
91
|
+
// --- module-boundary bridge: module.M:file / module.M:var.X / module.M:output.X ---
|
|
92
|
+
const scoped = qname.match(/^module\.([^.:\s]+):(.+)$/);
|
|
93
|
+
if (scoped) {
|
|
94
|
+
return resolveScopedModuleRef(ref, scoped[1], scoped[2], refDir, context);
|
|
95
|
+
}
|
|
96
|
+
const candidates = context.getNodesByQualifiedName(qname);
|
|
97
|
+
if (candidates.length === 0)
|
|
98
|
+
return null;
|
|
99
|
+
// 1. Same directory — the only scope Terraform can actually reference.
|
|
100
|
+
const sameDir = candidates.filter((c) => dirOf(c.filePath) === refDir);
|
|
101
|
+
if (sameDir.length > 0) {
|
|
102
|
+
return {
|
|
103
|
+
original: ref,
|
|
104
|
+
targetNodeId: sameDir[0].id,
|
|
105
|
+
confidence: 0.95,
|
|
106
|
+
resolvedBy: 'framework',
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// 2. `.tfvars` assignments set ROOT module variables, and var-files are
|
|
110
|
+
// routinely kept in a subdirectory (`envs/prod.tfvars`). Walk up to
|
|
111
|
+
// the nearest ancestor directory that declares the variable.
|
|
112
|
+
if (ref.filePath.endsWith('.tfvars') && qname.startsWith('var.')) {
|
|
113
|
+
const up = nearestAncestorMatch(candidates, refDir);
|
|
114
|
+
if (up) {
|
|
115
|
+
return { original: ref, targetNodeId: up.id, confidence: 0.9, resolvedBy: 'framework' };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// 2b. Provider configurations are the one construct Terraform inherits
|
|
119
|
+
// across the module tree: they're declared in the root (or a parent)
|
|
120
|
+
// module and passed down, so `provider = aws.east` inside a child
|
|
121
|
+
// module legitimately names a configuration declared above it.
|
|
122
|
+
if (qname.startsWith('provider.')) {
|
|
123
|
+
const configs = candidates.filter((c) => c.kind === 'namespace');
|
|
124
|
+
const up = nearestAncestorMatch(configs, refDir);
|
|
125
|
+
if (up) {
|
|
126
|
+
return { original: ref, targetNodeId: up.id, confidence: 0.9, resolvedBy: 'framework' };
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
// 3. No same-directory declaration → no edge. A candidate in another
|
|
131
|
+
// module directory is never the real target (cross-module access only
|
|
132
|
+
// exists through module.M inputs/outputs, bridged above), and a wrong
|
|
133
|
+
// edge is worse than none.
|
|
134
|
+
return null;
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
/** Nearest candidate walking UP the directory tree from refDir (exclusive). */
|
|
138
|
+
function nearestAncestorMatch(candidates, refDir) {
|
|
139
|
+
for (let dir = parentOf(refDir); dir !== null; dir = parentOf(dir)) {
|
|
140
|
+
const inDir = candidates.filter((c) => dirOf(c.filePath) === dir);
|
|
141
|
+
if (inDir.length > 0)
|
|
142
|
+
return inDir[0];
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Resolve `module.M:<child>` by locating the `module "M"` declaration in the
|
|
148
|
+
* reference's own directory, reading its `source` attribute, and looking the
|
|
149
|
+
* child symbol up inside that directory.
|
|
150
|
+
*/
|
|
151
|
+
function resolveScopedModuleRef(ref, moduleName, child, refDir, context) {
|
|
152
|
+
const decls = context
|
|
153
|
+
.getNodesByQualifiedName(`module.${moduleName}`)
|
|
154
|
+
.filter((n) => n.kind === 'module');
|
|
155
|
+
if (decls.length === 0)
|
|
156
|
+
return null;
|
|
157
|
+
// Terraform scoping: the declaration lives in the reference's directory.
|
|
158
|
+
const decl = decls.find((d) => dirOf(d.filePath) === refDir) ?? (decls.length === 1 ? decls[0] : null);
|
|
159
|
+
if (!decl)
|
|
160
|
+
return null;
|
|
161
|
+
const source = readModuleAttr(decl, 'source', context);
|
|
162
|
+
if (!source)
|
|
163
|
+
return null;
|
|
164
|
+
// --- cloudposse/atmos remote-state: module.M.outputs.X where M is the
|
|
165
|
+
// stack-config remote-state module reading another COMPONENT's state. The
|
|
166
|
+
// component name is static in the monorepo case (`component = "vpc"` or
|
|
167
|
+
// "eks/cluster"), so bridge to that component directory's own
|
|
168
|
+
// `output "X"` — but only when every gate holds: the module source is the
|
|
169
|
+
// remote-state module, the component is a string literal, and exactly ONE
|
|
170
|
+
// directory in the repo matches the component name and declares that
|
|
171
|
+
// output. Anything dynamic or ambiguous stays a visible boundary.
|
|
172
|
+
if (child.startsWith('remote-output.')) {
|
|
173
|
+
if (!/\/remote-state(\/|$)/.test(source))
|
|
174
|
+
return null;
|
|
175
|
+
let component = readModuleAttr(decl, 'component', context);
|
|
176
|
+
if (!component) {
|
|
177
|
+
// The other half of real-world declarations indirect through a
|
|
178
|
+
// variable with a literal default in the same directory
|
|
179
|
+
// (`component = var.vpc_component_name` + `default = "vpc"`) — the
|
|
180
|
+
// component's declared static wiring. One hop, same literal gate.
|
|
181
|
+
const viaVar = readNodeSpanMatch(decl, /^\s*component\s*=\s*var\.([A-Za-z0-9_-]+)\s*$/, context);
|
|
182
|
+
if (viaVar) {
|
|
183
|
+
const declared = context
|
|
184
|
+
.getNodesByQualifiedName(`var.${viaVar}`)
|
|
185
|
+
.filter((n) => dirOf(n.filePath) === dirOf(decl.filePath));
|
|
186
|
+
if (declared.length === 1) {
|
|
187
|
+
component = readNodeSpanMatch(declared[0], /^\s*default\s*=\s*"([^"]+)"/, context);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (!component)
|
|
192
|
+
return null;
|
|
193
|
+
const outName = child.slice('remote-output.'.length);
|
|
194
|
+
const outs = context
|
|
195
|
+
.getNodesByQualifiedName(`output.${outName}`)
|
|
196
|
+
.filter((o) => {
|
|
197
|
+
const d = dirOf(o.filePath);
|
|
198
|
+
return d === component || d.endsWith('/' + component);
|
|
199
|
+
});
|
|
200
|
+
if (outs.length === 0)
|
|
201
|
+
return null;
|
|
202
|
+
const dirs = new Set(outs.map((o) => dirOf(o.filePath)));
|
|
203
|
+
if (dirs.size > 1)
|
|
204
|
+
return null; // two directories claim this component name — never guess
|
|
205
|
+
return { original: ref, targetNodeId: outs[0].id, confidence: 0.9, resolvedBy: 'framework' };
|
|
206
|
+
}
|
|
207
|
+
if (!(source.startsWith('./') || source.startsWith('../'))) {
|
|
208
|
+
// Registry / git / absolute sources are out-of-repo: stay unresolved.
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
const targetDir = normalizeRel(joinDirs(dirOf(decl.filePath), source));
|
|
212
|
+
if (child === 'file') {
|
|
213
|
+
const tfFiles = context
|
|
214
|
+
.getAllFiles()
|
|
215
|
+
.filter((f) => dirOf(f) === targetDir && (f.endsWith('.tf') || f.endsWith('.tofu')))
|
|
216
|
+
.sort();
|
|
217
|
+
if (tfFiles.length === 0)
|
|
218
|
+
return null;
|
|
219
|
+
const entry = tfFiles.find((f) => f.endsWith('/main.tf') || f === 'main.tf') ?? tfFiles[0];
|
|
220
|
+
const fileNode = context.getNodesInFile(entry).find((n) => n.kind === 'file');
|
|
221
|
+
if (!fileNode)
|
|
222
|
+
return null;
|
|
223
|
+
return { original: ref, targetNodeId: fileNode.id, confidence: 0.95, resolvedBy: 'framework' };
|
|
224
|
+
}
|
|
225
|
+
// child is `var.X` or `output.X` — the child module's own qualified names.
|
|
226
|
+
const target = context
|
|
227
|
+
.getNodesByQualifiedName(child)
|
|
228
|
+
.filter((c) => dirOf(c.filePath) === targetDir);
|
|
229
|
+
if (target.length === 0)
|
|
230
|
+
return null;
|
|
231
|
+
return { original: ref, targetNodeId: target[0].id, confidence: 0.95, resolvedBy: 'framework' };
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* A direct string-literal attribute (`source = "…"`, `component = "…"`) of a
|
|
235
|
+
* module declaration, re-read from its file (project paths are stored
|
|
236
|
+
* relative; node metadata isn't persisted, so the declaration's line span +
|
|
237
|
+
* cached file lines are the durable carrier). Non-literal values (variables,
|
|
238
|
+
* expressions) return null — dynamic wiring is never guessed.
|
|
239
|
+
*/
|
|
240
|
+
function readModuleAttr(decl, name, context) {
|
|
241
|
+
return readNodeSpanMatch(decl, new RegExp(`^\\s*${name}\\s*=\\s*"([^"]+)"`), context);
|
|
242
|
+
}
|
|
243
|
+
/** First capture of `re` across the node's line span, or null. */
|
|
244
|
+
function readNodeSpanMatch(node, re, context) {
|
|
245
|
+
const lines = context.getFileLines?.(node.filePath) ?? context.readFile(node.filePath)?.split('\n') ?? null;
|
|
246
|
+
if (!lines)
|
|
247
|
+
return null;
|
|
248
|
+
const end = Math.min(node.endLine, lines.length);
|
|
249
|
+
for (let i = Math.max(node.startLine - 1, 0); i < end; i++) {
|
|
250
|
+
const m = lines[i].match(re);
|
|
251
|
+
if (m)
|
|
252
|
+
return m[1];
|
|
253
|
+
}
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
/** Directory of a stored (forward-slash, project-relative) path. */
|
|
257
|
+
function dirOf(p) {
|
|
258
|
+
const d = path.dirname(p);
|
|
259
|
+
return d === '' ? '.' : d;
|
|
260
|
+
}
|
|
261
|
+
/** Parent directory, or null above the project root. */
|
|
262
|
+
function parentOf(dir) {
|
|
263
|
+
if (dir === '.' || dir === '')
|
|
264
|
+
return null;
|
|
265
|
+
const parent = path.dirname(dir);
|
|
266
|
+
return parent === dir ? null : parent;
|
|
267
|
+
}
|
|
268
|
+
/** Join a base directory with a `./`/`../` relative source path. */
|
|
269
|
+
function joinDirs(base, rel) {
|
|
270
|
+
return path.join(base === '.' ? '' : base, rel);
|
|
271
|
+
}
|
|
272
|
+
/** Normalize to the stored path shape: forward slashes, '.' for the root. */
|
|
273
|
+
function normalizeRel(p) {
|
|
274
|
+
const n = path.normalize(p).replace(/\\/g, '/').replace(/\/+$/, '');
|
|
275
|
+
return n === '' ? '.' : n;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=terraform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terraform.js","sourceRoot":"","sources":["../../../src/resolution/frameworks/terraform.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAI7B,6HAA6H;AAC7H,MAAM,UAAU,GAAG,4DAA4D,CAAC;AAEnE,QAAA,iBAAiB,GAAsB;IAClD,IAAI,EAAE,WAAW;IACjB,SAAS,EAAE,CAAC,WAAW,CAAC;IAExB,MAAM,C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,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,6EAA6E;AAC7E,SAAS,YAAY,CAAC,CAAS;IAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -24,5 +24,6 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import type { Edge } from '../types';
|
|
26
26
|
import type { ResolutionContext } from './types';
|
|
27
|
-
|
|
27
|
+
import type { MaybeYield } from './cooperative-yield';
|
|
28
|
+
export declare function goframeRouteEdges(ctx: ResolutionContext, onYield: MaybeYield): Promise<Edge[]>;
|
|
28
29
|
//# sourceMappingURL=goframe-synthesizer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goframe-synthesizer.d.ts","sourceRoot":"","sources":["../../src/resolution/goframe-synthesizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"goframe-synthesizer.d.ts","sourceRoot":"","sources":["../../src/resolution/goframe-synthesizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAiDtD,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,iBAAiB,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAuEpG"}
|
|
@@ -72,13 +72,16 @@ function selectHandler(candidates, routeFile) {
|
|
|
72
72
|
const sameModule = cands.filter((h) => addonRoot(h.filePath) === ar);
|
|
73
73
|
return sameModule.length === 1 ? sameModule[0] : null;
|
|
74
74
|
}
|
|
75
|
-
function goframeRouteEdges(ctx) {
|
|
75
|
+
async function goframeRouteEdges(ctx, onYield) {
|
|
76
|
+
let scanned255 = 0;
|
|
76
77
|
// Route nodes the goframe extractor created, keyed by their package-qualified
|
|
77
78
|
// request type (`cash.ListReq`). `wanted` holds every key a handler signature
|
|
78
79
|
// could match — the qualified form plus its bare type fallback.
|
|
79
80
|
const routesByReqType = new Map();
|
|
80
81
|
const wanted = new Set();
|
|
81
|
-
for (const route of ctx.getNodesByKind('route')) {
|
|
82
|
+
for (const route of (ctx.iterateNodesByKind?.('route') ?? ctx.getNodesByKind('route'))) {
|
|
83
|
+
if ((++scanned255 & 63) === 0)
|
|
84
|
+
await onYield();
|
|
82
85
|
if (route.language !== 'go')
|
|
83
86
|
continue;
|
|
84
87
|
const marker = route.qualifiedName.indexOf(goframe_1.GOFRAME_ROUTE_MARKER);
|
|
@@ -104,7 +107,9 @@ function goframeRouteEdges(ctx) {
|
|
|
104
107
|
// pointer, indexed by every matching (qualified + bare) form so a route can
|
|
105
108
|
// match precisely on `pkg.Type` and fall back to the bare `Type`.
|
|
106
109
|
const handlersByKey = new Map();
|
|
107
|
-
for (const method of ctx.getNodesByKind('method')) {
|
|
110
|
+
for (const method of (ctx.iterateNodesByKind?.('method') ?? ctx.getNodesByKind('method'))) {
|
|
111
|
+
if ((++scanned255 & 63) === 0)
|
|
112
|
+
await onYield();
|
|
108
113
|
if (method.language !== 'go' || !method.signature)
|
|
109
114
|
continue;
|
|
110
115
|
for (const t of pointerParamTypes(method.signature)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goframe-synthesizer.js","sourceRoot":"","sources":["../../src/resolution/goframe-synthesizer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;
|
|
1
|
+
{"version":3,"file":"goframe-synthesizer.js","sourceRoot":"","sources":["../../src/resolution/goframe-synthesizer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAqDH,8CAuEC;AAvHD,kDAA4D;AAE5D,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,mDAAmD;AAE5E;;;;;;;GAOG;AACH,SAAS,iBAAiB,CAAC,GAAW;IACpC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,EAAE,GAAG,gCAAgC,CAAC;IAC5C,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,CAAC,CAAC,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACtC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;uFAGuF;AACvF,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACxD,CAAC;AAED;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,UAAkB,EAAE,SAAiB;IAC1D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,UAAU,CAAC,CAAC,CAAE,CAAC;IACnD,IAAI,KAAK,GAAG,UAAU,CAAC,MAAM,C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EAAE,EAAE,CAAC;YACxC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,UAAU;gBAAE,SAAS;YACnD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,KAAK,CAAC,IAAI,CAAC;gBACT,MAAM,EAAE,KAAK,CAAC,EAAE;gBAChB,MAAM,EAAE,OAAO,CAAC,EAAE;gBAClB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,KAAK,CAAC,SAAS;gBACrB,UAAU,EAAE,WAAW;gBACvB,QAAQ,EAAE;oBACR,aAAa,EAAE,eAAe;oBAC9B,KAAK,EAAE,KAAK,CAAC,IAAI;oBACjB,WAAW;oBACX,YAAY,EAAE,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,SAAS,EAAE;iBACzD;aACF,CAAC,CAAC;YACH,KAAK,EAAE,CAAC;QACV,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Language } from '../types';
|
|
7
7
|
import { UnresolvedRef, ResolvedRef, ResolutionContext, ImportMapping, ReExport } from './types';
|
|
8
|
+
export declare function isNixPathImportRef(ref: UnresolvedRef): boolean;
|
|
8
9
|
/**
|
|
9
10
|
* Resolve an import path to an actual file
|
|
10
11
|
*/
|
|
@@ -37,6 +38,12 @@ export declare function loadCppIncludeDirs(projectRoot: string): string[];
|
|
|
37
38
|
* to a same-named symbol — so callers must not fall back to the name-matcher.
|
|
38
39
|
*/
|
|
39
40
|
export declare function isPhpIncludePathRef(ref: UnresolvedRef): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Is this a COBOL COPY / EXEC SQL INCLUDE copybook reference? These resolve
|
|
43
|
+
* to files only (or stay unresolved for compiler-supplied members) — never
|
|
44
|
+
* to a same-named symbol via the name-matcher.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isCobolCopybookRef(ref: UnresolvedRef): boolean;
|
|
40
47
|
/**
|
|
41
48
|
* Extract import mappings from a file
|
|
42
49
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-resolver.d.ts","sourceRoot":"","sources":["../../src/resolution/import-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAQ,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"import-resolver.d.ts","sourceRoot":"","sources":["../../src/resolution/import-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAQ,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAoCjG,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAO9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,iBAAiB,GACzB,MAAM,GAAG,IAAI,CAqCf;AAiTD;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAShE;AA6KD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAM/D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAE9D;AA0BD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,GACjB,aAAa,EAAE,CA6BjB;AAmTD;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C;AAqDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAsDhF;AAED;;GAEG;AACH;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,iBAAiB,GACzB,WAAW,GAAG,IAAI,CA6BpB;AAiCD,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,iBAAiB,GACzB,WAAW,GAAG,IAAI,CA4PpB"}
|
|
@@ -38,10 +38,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
};
|
|
39
39
|
})();
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.isNixPathImportRef = isNixPathImportRef;
|
|
41
42
|
exports.resolveImportPath = resolveImportPath;
|
|
42
43
|
exports.clearCppIncludeDirCache = clearCppIncludeDirCache;
|
|
43
44
|
exports.loadCppIncludeDirs = loadCppIncludeDirs;
|
|
44
45
|
exports.isPhpIncludePathRef = isPhpIncludePathRef;
|
|
46
|
+
exports.isCobolCopybookRef = isCobolCopybookRef;
|
|
45
47
|
exports.extractImportMappings = extractImportMappings;
|
|
46
48
|
exports.clearImportMappingCache = clearImportMappingCache;
|
|
47
49
|
exports.extractReExports = extractReExports;
|
|
@@ -56,6 +58,11 @@ const workspace_packages_1 = require("./workspace-packages");
|
|
|
56
58
|
*/
|
|
57
59
|
const EXTENSION_RESOLUTION = {
|
|
58
60
|
typescript: ['.ts', '.tsx', '.d.ts', '.js', '.jsx', '/index.ts', '/index.tsx', '/index.js'],
|
|
61
|
+
// ArkTS imports both `.ets` components and plain `.ts` logic modules —
|
|
62
|
+
// HarmonyOS projects are always a mix. `/Index.ets` (capital I) is ohpm's
|
|
63
|
+
// module-entry convention, hit when a bare workspace import ("data") is
|
|
64
|
+
// rewritten to the member's directory; lowercase variants for safety.
|
|
65
|
+
arkts: ['.ets', '.ts', '.d.ts', '.js', '/Index.ets', '/index.ets', '/index.ts', '/index.js'],
|
|
59
66
|
javascript: ['.js', '.jsx', '.mjs', '.cjs', '/index.js', '/index.jsx'],
|
|
60
67
|
tsx: ['.tsx', '.ts', '.d.ts', '.js', '.jsx', '/index.tsx', '/index.ts', '/index.js'],
|
|
61
68
|
jsx: ['.jsx', '.js', '/index.jsx', '/index.js'],
|
|
@@ -75,11 +82,25 @@ const EXTENSION_RESOLUTION = {
|
|
|
75
82
|
php: ['.php'],
|
|
76
83
|
ruby: ['.rb'],
|
|
77
84
|
objc: ['.h', '.m', '.mm'],
|
|
85
|
+
nix: ['.nix', '/default.nix'],
|
|
78
86
|
};
|
|
87
|
+
function isNixPathImportRef(ref) {
|
|
88
|
+
return (ref.language === 'nix' &&
|
|
89
|
+
ref.referenceKind === 'imports' &&
|
|
90
|
+
(ref.referenceName.startsWith('./') || ref.referenceName.startsWith('../')) &&
|
|
91
|
+
!/[\s{}()[\];"'<>$]/.test(ref.referenceName));
|
|
92
|
+
}
|
|
79
93
|
/**
|
|
80
94
|
* Resolve an import path to an actual file
|
|
81
95
|
*/
|
|
82
96
|
function resolveImportPath(importPath, fromFile, language, context) {
|
|
97
|
+
// COBOL COPY/EXEC SQL INCLUDE names a copybook member, not a path — the
|
|
98
|
+
// compiler searches a library, so we match against indexed file basenames.
|
|
99
|
+
// Must run before isExternalImport: a bare member name would otherwise be
|
|
100
|
+
// misclassified as an external package.
|
|
101
|
+
if (language === 'cobol') {
|
|
102
|
+
return resolveCobolCopybook(importPath, fromFile, context);
|
|
103
|
+
}
|
|
83
104
|
// Skip external/npm packages — but pass the context so the
|
|
84
105
|
// bare-specifier heuristic can consult the project's tsconfig
|
|
85
106
|
// alias map first (custom prefixes like `@components/*` would
|
|
@@ -105,6 +126,55 @@ function resolveImportPath(importPath, fromFile, language, context) {
|
|
|
105
126
|
}
|
|
106
127
|
return null;
|
|
107
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* COBOL copybook lookup: `COPY CVACT01Y` (or `EXEC SQL INCLUDE X`) names a
|
|
131
|
+
* library member resolved by the compiler's copybook search path, so we match
|
|
132
|
+
* the member against indexed file basenames, case-insensitively. `.cpy` wins
|
|
133
|
+
* over a same-named program; a same-directory hit wins within a tier. The
|
|
134
|
+
* stem index is built once per resolution context (a per-ref scan of every
|
|
135
|
+
* file node would go quadratic on copybook-heavy repos).
|
|
136
|
+
*/
|
|
137
|
+
const cobolCopybookIndexes = new WeakMap();
|
|
138
|
+
function resolveCobolCopybook(member, fromFile, context) {
|
|
139
|
+
let index = cobolCopybookIndexes.get(context);
|
|
140
|
+
if (!index) {
|
|
141
|
+
index = new Map();
|
|
142
|
+
for (const fileNode of context.getNodesByKind('file')) {
|
|
143
|
+
const normalized = fileNode.filePath.replace(/\\/g, '/');
|
|
144
|
+
const base = normalized.split('/').pop() ?? '';
|
|
145
|
+
const dot = base.lastIndexOf('.');
|
|
146
|
+
const stem = (dot > 0 ? base.slice(0, dot) : base).toLowerCase();
|
|
147
|
+
const paths = index.get(stem);
|
|
148
|
+
if (paths)
|
|
149
|
+
paths.push(fileNode.filePath);
|
|
150
|
+
else
|
|
151
|
+
index.set(stem, [fileNode.filePath]);
|
|
152
|
+
}
|
|
153
|
+
cobolCopybookIndexes.set(context, index);
|
|
154
|
+
}
|
|
155
|
+
const candidates = index.get(member.toLowerCase());
|
|
156
|
+
if (!candidates || candidates.length === 0)
|
|
157
|
+
return null;
|
|
158
|
+
const fromDir = fromFile.replace(/\\/g, '/').split('/').slice(0, -1).join('/');
|
|
159
|
+
let best = null;
|
|
160
|
+
let bestScore = -1;
|
|
161
|
+
for (const candidate of candidates) {
|
|
162
|
+
const normalized = candidate.replace(/\\/g, '/');
|
|
163
|
+
const ext = normalized.slice(normalized.lastIndexOf('.')).toLowerCase();
|
|
164
|
+
let score = 0;
|
|
165
|
+
if (ext === '.cpy')
|
|
166
|
+
score += 4;
|
|
167
|
+
else if (ext === '.cbl' || ext === '.cob' || ext === '.cobol')
|
|
168
|
+
score += 2;
|
|
169
|
+
if (normalized.split('/').slice(0, -1).join('/') === fromDir)
|
|
170
|
+
score += 1;
|
|
171
|
+
if (score > bestScore) {
|
|
172
|
+
bestScore = score;
|
|
173
|
+
best = candidate;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return best;
|
|
177
|
+
}
|
|
108
178
|
/**
|
|
109
179
|
* C and C++ standard library header names (without delimiters).
|
|
110
180
|
* Used by isExternalImport to filter system includes from resolution.
|
|
@@ -163,7 +233,7 @@ function isExternalImport(importPath, language, context) {
|
|
|
163
233
|
return false;
|
|
164
234
|
}
|
|
165
235
|
// Common external patterns
|
|
166
|
-
if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx') {
|
|
236
|
+
if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx' || language === 'arkts') {
|
|
167
237
|
// Node built-ins
|
|
168
238
|
if (['fs', 'path', 'os', 'crypto', 'http', 'https', 'url', 'util', 'events', 'stream', 'child_process', 'buffer'].includes(importPath)) {
|
|
169
239
|
return true;
|
|
@@ -551,6 +621,14 @@ function isPhpIncludePathRef(ref) {
|
|
|
551
621
|
ref.referenceKind === 'imports' &&
|
|
552
622
|
(ref.referenceName.includes('/') || ref.referenceName.includes('.')));
|
|
553
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* Is this a COBOL COPY / EXEC SQL INCLUDE copybook reference? These resolve
|
|
626
|
+
* to files only (or stay unresolved for compiler-supplied members) — never
|
|
627
|
+
* to a same-named symbol via the name-matcher.
|
|
628
|
+
*/
|
|
629
|
+
function isCobolCopybookRef(ref) {
|
|
630
|
+
return ref.language === 'cobol' && ref.referenceKind === 'imports';
|
|
631
|
+
}
|
|
554
632
|
/**
|
|
555
633
|
* Resolve a PHP include/require path to a project-relative file path.
|
|
556
634
|
*
|
|
@@ -577,7 +655,7 @@ function resolvePhpIncludePath(includePath, fromFile, context) {
|
|
|
577
655
|
*/
|
|
578
656
|
function extractImportMappings(_filePath, content, language) {
|
|
579
657
|
const mappings = [];
|
|
580
|
-
if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx') {
|
|
658
|
+
if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx' || language === 'arkts') {
|
|
581
659
|
mappings.push(...extractJSImports(content));
|
|
582
660
|
}
|
|
583
661
|
else if (language === 'svelte' || language === 'vue' || language === 'astro') {
|
|
@@ -966,7 +1044,8 @@ function extractReExports(content, language) {
|
|
|
966
1044
|
if (language !== 'typescript' &&
|
|
967
1045
|
language !== 'javascript' &&
|
|
968
1046
|
language !== 'tsx' &&
|
|
969
|
-
language !== 'jsx'
|
|
1047
|
+
language !== 'jsx' &&
|
|
1048
|
+
language !== 'arkts') {
|
|
970
1049
|
return [];
|
|
971
1050
|
}
|
|
972
1051
|
const out = [];
|
|
@@ -1130,6 +1209,29 @@ function resolveViaImport(ref, context) {
|
|
|
1130
1209
|
}
|
|
1131
1210
|
return null;
|
|
1132
1211
|
}
|
|
1212
|
+
// COBOL COPY / EXEC SQL INCLUDE — resolve the copybook member to a
|
|
1213
|
+
// file→file edge, mirroring the C/C++ include branch above. A member that
|
|
1214
|
+
// matches no indexed file (compiler-supplied copybooks like SQLCA/DFHAID)
|
|
1215
|
+
// stays unresolved — callers must not fall back to the symbol name-matcher,
|
|
1216
|
+
// which would connect it to a same-named import symbol elsewhere.
|
|
1217
|
+
if (isCobolCopybookRef(ref)) {
|
|
1218
|
+
const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
|
|
1219
|
+
if (!resolvedPath)
|
|
1220
|
+
return null;
|
|
1221
|
+
const basename = resolvedPath.split('/').pop();
|
|
1222
|
+
const fileNode = context
|
|
1223
|
+
.getNodesByName(basename)
|
|
1224
|
+
.find((n) => n.kind === 'file' && n.filePath === resolvedPath);
|
|
1225
|
+
if (fileNode) {
|
|
1226
|
+
return {
|
|
1227
|
+
original: ref,
|
|
1228
|
+
targetNodeId: fileNode.id,
|
|
1229
|
+
confidence: 0.9,
|
|
1230
|
+
resolvedBy: 'import',
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
return null;
|
|
1234
|
+
}
|
|
1133
1235
|
// PHP include/require — resolve the static string path to a file→file
|
|
1134
1236
|
// edge, mirroring the C/C++ branch above. Distinguish include PATHS from
|
|
1135
1237
|
// namespace `use` symbols by shape: an include path contains a slash or a
|
|
@@ -1159,6 +1261,28 @@ function resolveViaImport(ref, context) {
|
|
|
1159
1261
|
// db.php elsewhere in the tree — a wrong edge is worse than a missing one.
|
|
1160
1262
|
return null;
|
|
1161
1263
|
}
|
|
1264
|
+
// Nix static project-path imports (`import ./x.nix`, `builtins.import ./dir`,
|
|
1265
|
+
// `import ./x.nix {}`) resolve to file nodes only. Do not resolve
|
|
1266
|
+
// angle-bracket channels, attribute expressions, variables, or other dynamic
|
|
1267
|
+
// expressions as project files.
|
|
1268
|
+
if (isNixPathImportRef(ref)) {
|
|
1269
|
+
const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
|
|
1270
|
+
if (!resolvedPath)
|
|
1271
|
+
return null;
|
|
1272
|
+
const basename = resolvedPath.split('/').pop();
|
|
1273
|
+
const fileNode = context
|
|
1274
|
+
.getNodesByName(basename)
|
|
1275
|
+
.find((n) => n.kind === 'file' && n.filePath === resolvedPath);
|
|
1276
|
+
if (fileNode) {
|
|
1277
|
+
return {
|
|
1278
|
+
original: ref,
|
|
1279
|
+
targetNodeId: fileNode.id,
|
|
1280
|
+
confidence: 0.9,
|
|
1281
|
+
resolvedBy: 'import',
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1284
|
+
return null;
|
|
1285
|
+
}
|
|
1162
1286
|
// Use cached import mappings (avoids re-reading and re-parsing per ref)
|
|
1163
1287
|
const imports = context.getImportMappings(ref.filePath, ref.language);
|
|
1164
1288
|
if (imports.length === 0 && !context.readFile(ref.filePath)) {
|
|
@@ -1227,7 +1351,8 @@ function resolveViaImport(ref, context) {
|
|
|
1227
1351
|
ref.language === 'typescript' ||
|
|
1228
1352
|
ref.language === 'tsx' ||
|
|
1229
1353
|
ref.language === 'javascript' ||
|
|
1230
|
-
ref.language === 'jsx'
|
|
1354
|
+
ref.language === 'jsx' ||
|
|
1355
|
+
ref.language === 'arkts') {
|
|
1231
1356
|
const moduleFile = resolveModuleImportToFile(ref, imports, context);
|
|
1232
1357
|
if (moduleFile)
|
|
1233
1358
|
return moduleFile;
|