@opensip-cli/graph-typescript 0.1.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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/_pipeline.d.ts +40 -0
- package/dist/__tests__/_pipeline.d.ts.map +1 -0
- package/dist/__tests__/_pipeline.js +67 -0
- package/dist/__tests__/_pipeline.js.map +1 -0
- package/dist/__tests__/acceptance/_fixture-runner.d.ts +13 -0
- package/dist/__tests__/acceptance/_fixture-runner.d.ts.map +1 -0
- package/dist/__tests__/acceptance/_fixture-runner.js +55 -0
- package/dist/__tests__/acceptance/_fixture-runner.js.map +1 -0
- package/dist/__tests__/acceptance/alias-resolution.test.d.ts +8 -0
- package/dist/__tests__/acceptance/alias-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/alias-resolution.test.js +39 -0
- package/dist/__tests__/acceptance/alias-resolution.test.js.map +1 -0
- package/dist/__tests__/acceptance/arrow-callback-resolution.test.d.ts +8 -0
- package/dist/__tests__/acceptance/arrow-callback-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/arrow-callback-resolution.test.js +33 -0
- package/dist/__tests__/acceptance/arrow-callback-resolution.test.js.map +1 -0
- package/dist/__tests__/acceptance/constructor-calls.test.d.ts +7 -0
- package/dist/__tests__/acceptance/constructor-calls.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/constructor-calls.test.js +36 -0
- package/dist/__tests__/acceptance/constructor-calls.test.js.map +1 -0
- package/dist/__tests__/acceptance/interface-dispatch.test.d.ts +8 -0
- package/dist/__tests__/acceptance/interface-dispatch.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/interface-dispatch.test.js +44 -0
- package/dist/__tests__/acceptance/interface-dispatch.test.js.map +1 -0
- package/dist/__tests__/acceptance/inventory-completeness.test.d.ts +9 -0
- package/dist/__tests__/acceptance/inventory-completeness.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/inventory-completeness.test.js +72 -0
- package/dist/__tests__/acceptance/inventory-completeness.test.js.map +1 -0
- package/dist/__tests__/acceptance/jsx-resolution.test.d.ts +7 -0
- package/dist/__tests__/acceptance/jsx-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/jsx-resolution.test.js +46 -0
- package/dist/__tests__/acceptance/jsx-resolution.test.js.map +1 -0
- package/dist/__tests__/acceptance/module-init.test.d.ts +10 -0
- package/dist/__tests__/acceptance/module-init.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/module-init.test.js +40 -0
- package/dist/__tests__/acceptance/module-init.test.js.map +1 -0
- package/dist/__tests__/acceptance/projectdir-normalization.test.d.ts +7 -0
- package/dist/__tests__/acceptance/projectdir-normalization.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance/projectdir-normalization.test.js +51 -0
- package/dist/__tests__/acceptance/projectdir-normalization.test.js.map +1 -0
- package/dist/__tests__/body-twin-edges.test.d.ts +12 -0
- package/dist/__tests__/body-twin-edges.test.d.ts.map +1 -0
- package/dist/__tests__/body-twin-edges.test.js +85 -0
- package/dist/__tests__/body-twin-edges.test.js.map +1 -0
- package/dist/__tests__/cache-key.test.d.ts +8 -0
- package/dist/__tests__/cache-key.test.d.ts.map +1 -0
- package/dist/__tests__/cache-key.test.js +86 -0
- package/dist/__tests__/cache-key.test.js.map +1 -0
- package/dist/__tests__/depends-on-emission.test.d.ts +19 -0
- package/dist/__tests__/depends-on-emission.test.d.ts.map +1 -0
- package/dist/__tests__/depends-on-emission.test.js +165 -0
- package/dist/__tests__/depends-on-emission.test.js.map +1 -0
- package/dist/__tests__/discover.test.d.ts +9 -0
- package/dist/__tests__/discover.test.d.ts.map +1 -0
- package/dist/__tests__/discover.test.js +72 -0
- package/dist/__tests__/discover.test.js.map +1 -0
- package/dist/__tests__/edge-helpers/method-target.test.d.ts +8 -0
- package/dist/__tests__/edge-helpers/method-target.test.d.ts.map +1 -0
- package/dist/__tests__/edge-helpers/method-target.test.js +96 -0
- package/dist/__tests__/edge-helpers/method-target.test.js.map +1 -0
- package/dist/__tests__/edge-helpers/resolve-decl.test.d.ts +13 -0
- package/dist/__tests__/edge-helpers/resolve-decl.test.d.ts.map +1 -0
- package/dist/__tests__/edge-helpers/resolve-decl.test.js +176 -0
- package/dist/__tests__/edge-helpers/resolve-decl.test.js.map +1 -0
- package/dist/__tests__/edge-resolvers/branches.test.d.ts +11 -0
- package/dist/__tests__/edge-resolvers/branches.test.d.ts.map +1 -0
- package/dist/__tests__/edge-resolvers/branches.test.js +305 -0
- package/dist/__tests__/edge-resolvers/branches.test.js.map +1 -0
- package/dist/__tests__/edge-resolvers/contract.test.d.ts +8 -0
- package/dist/__tests__/edge-resolvers/contract.test.d.ts.map +1 -0
- package/dist/__tests__/edge-resolvers/contract.test.js +30 -0
- package/dist/__tests__/edge-resolvers/contract.test.js.map +1 -0
- package/dist/__tests__/edge-resolvers/resolver-units.test.d.ts +17 -0
- package/dist/__tests__/edge-resolvers/resolver-units.test.d.ts.map +1 -0
- package/dist/__tests__/edge-resolvers/resolver-units.test.js +286 -0
- package/dist/__tests__/edge-resolvers/resolver-units.test.js.map +1 -0
- package/dist/__tests__/fast-vs-exact.test.d.ts +16 -0
- package/dist/__tests__/fast-vs-exact.test.d.ts.map +1 -0
- package/dist/__tests__/fast-vs-exact.test.js +116 -0
- package/dist/__tests__/fast-vs-exact.test.js.map +1 -0
- package/dist/__tests__/graph-cli.test.d.ts +9 -0
- package/dist/__tests__/graph-cli.test.d.ts.map +1 -0
- package/dist/__tests__/graph-cli.test.js +417 -0
- package/dist/__tests__/graph-cli.test.js.map +1 -0
- package/dist/__tests__/heap-preflight.test.d.ts +10 -0
- package/dist/__tests__/heap-preflight.test.d.ts.map +1 -0
- package/dist/__tests__/heap-preflight.test.js +166 -0
- package/dist/__tests__/heap-preflight.test.js.map +1 -0
- package/dist/__tests__/inventory-differential.test.d.ts +15 -0
- package/dist/__tests__/inventory-differential.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-differential.test.js +319 -0
- package/dist/__tests__/inventory-differential.test.js.map +1 -0
- package/dist/__tests__/inventory-helpers/hash-body.test.d.ts +11 -0
- package/dist/__tests__/inventory-helpers/hash-body.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-helpers/hash-body.test.js +34 -0
- package/dist/__tests__/inventory-helpers/hash-body.test.js.map +1 -0
- package/dist/__tests__/inventory-helpers/synthesize-name.test.d.ts +9 -0
- package/dist/__tests__/inventory-helpers/synthesize-name.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-helpers/synthesize-name.test.js +30 -0
- package/dist/__tests__/inventory-helpers/synthesize-name.test.js.map +1 -0
- package/dist/__tests__/inventory-property-tests.test.d.ts +24 -0
- package/dist/__tests__/inventory-property-tests.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-property-tests.test.js +521 -0
- package/dist/__tests__/inventory-property-tests.test.js.map +1 -0
- package/dist/__tests__/inventory-shape-coverage.test.d.ts +16 -0
- package/dist/__tests__/inventory-shape-coverage.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-shape-coverage.test.js +586 -0
- package/dist/__tests__/inventory-shape-coverage.test.js.map +1 -0
- package/dist/__tests__/inventory-visitors/contract.test.d.ts +9 -0
- package/dist/__tests__/inventory-visitors/contract.test.d.ts.map +1 -0
- package/dist/__tests__/inventory-visitors/contract.test.js +33 -0
- package/dist/__tests__/inventory-visitors/contract.test.js.map +1 -0
- package/dist/__tests__/lang-adapter-contract.test.d.ts +19 -0
- package/dist/__tests__/lang-adapter-contract.test.d.ts.map +1 -0
- package/dist/__tests__/lang-adapter-contract.test.js +880 -0
- package/dist/__tests__/lang-adapter-contract.test.js.map +1 -0
- package/dist/__tests__/lang-adapter-registry.test.d.ts +10 -0
- package/dist/__tests__/lang-adapter-registry.test.d.ts.map +1 -0
- package/dist/__tests__/lang-adapter-registry.test.js +151 -0
- package/dist/__tests__/lang-adapter-registry.test.js.map +1 -0
- package/dist/__tests__/normalize-project-dir.test.d.ts +5 -0
- package/dist/__tests__/normalize-project-dir.test.d.ts.map +1 -0
- package/dist/__tests__/normalize-project-dir.test.js +47 -0
- package/dist/__tests__/normalize-project-dir.test.js.map +1 -0
- package/dist/__tests__/orchestrate.test.d.ts +8 -0
- package/dist/__tests__/orchestrate.test.d.ts.map +1 -0
- package/dist/__tests__/orchestrate.test.js +213 -0
- package/dist/__tests__/orchestrate.test.js.map +1 -0
- package/dist/__tests__/parse-fast.test.d.ts +9 -0
- package/dist/__tests__/parse-fast.test.d.ts.map +1 -0
- package/dist/__tests__/parse-fast.test.js +114 -0
- package/dist/__tests__/parse-fast.test.js.map +1 -0
- package/dist/__tests__/rules/_helpers.d.ts +18 -0
- package/dist/__tests__/rules/_helpers.d.ts.map +1 -0
- package/dist/__tests__/rules/_helpers.js +62 -0
- package/dist/__tests__/rules/_helpers.js.map +1 -0
- package/dist/__tests__/rules/duplicated-function-body.test.d.ts +5 -0
- package/dist/__tests__/rules/duplicated-function-body.test.d.ts.map +1 -0
- package/dist/__tests__/rules/duplicated-function-body.test.js +39 -0
- package/dist/__tests__/rules/duplicated-function-body.test.js.map +1 -0
- package/dist/__tests__/rules/orphan-subtree.test.d.ts +5 -0
- package/dist/__tests__/rules/orphan-subtree.test.d.ts.map +1 -0
- package/dist/__tests__/rules/orphan-subtree.test.js +75 -0
- package/dist/__tests__/rules/orphan-subtree.test.js.map +1 -0
- package/dist/__tests__/rules/rule-hints-integration.test.d.ts +20 -0
- package/dist/__tests__/rules/rule-hints-integration.test.d.ts.map +1 -0
- package/dist/__tests__/rules/rule-hints-integration.test.js +279 -0
- package/dist/__tests__/rules/rule-hints-integration.test.js.map +1 -0
- package/dist/__tests__/tool-register.test.d.ts +16 -0
- package/dist/__tests__/tool-register.test.d.ts.map +1 -0
- package/dist/__tests__/tool-register.test.js +210 -0
- package/dist/__tests__/tool-register.test.js.map +1 -0
- package/dist/__tests__/value-reference-unit.test.d.ts +13 -0
- package/dist/__tests__/value-reference-unit.test.d.ts.map +1 -0
- package/dist/__tests__/value-reference-unit.test.js +226 -0
- package/dist/__tests__/value-reference-unit.test.js.map +1 -0
- package/dist/__tests__/value-reference.test.d.ts +15 -0
- package/dist/__tests__/value-reference.test.d.ts.map +1 -0
- package/dist/__tests__/value-reference.test.js +115 -0
- package/dist/__tests__/value-reference.test.js.map +1 -0
- package/dist/__tests__/walk-fast.test.d.ts +8 -0
- package/dist/__tests__/walk-fast.test.d.ts.map +1 -0
- package/dist/__tests__/walk-fast.test.js +51 -0
- package/dist/__tests__/walk-fast.test.js.map +1 -0
- package/dist/__tests__/walk-reexports.test.d.ts +7 -0
- package/dist/__tests__/walk-reexports.test.d.ts.map +1 -0
- package/dist/__tests__/walk-reexports.test.js +79 -0
- package/dist/__tests__/walk-reexports.test.js.map +1 -0
- package/dist/cache-key.d.ts +41 -0
- package/dist/cache-key.d.ts.map +1 -0
- package/dist/cache-key.js +94 -0
- package/dist/cache-key.js.map +1 -0
- package/dist/discover.d.ts +25 -0
- package/dist/discover.d.ts.map +1 -0
- package/dist/discover.js +124 -0
- package/dist/discover.js.map +1 -0
- package/dist/edge-helpers/cross-package-context.d.ts +34 -0
- package/dist/edge-helpers/cross-package-context.d.ts.map +1 -0
- package/dist/edge-helpers/cross-package-context.js +97 -0
- package/dist/edge-helpers/cross-package-context.js.map +1 -0
- package/dist/edge-helpers/declaration-to-node.d.ts +58 -0
- package/dist/edge-helpers/declaration-to-node.d.ts.map +1 -0
- package/dist/edge-helpers/declaration-to-node.js +93 -0
- package/dist/edge-helpers/declaration-to-node.js.map +1 -0
- package/dist/edge-helpers/find-catalog-entry.d.ts +24 -0
- package/dist/edge-helpers/find-catalog-entry.d.ts.map +1 -0
- package/dist/edge-helpers/find-catalog-entry.js +45 -0
- package/dist/edge-helpers/find-catalog-entry.js.map +1 -0
- package/dist/edge-helpers/method-target.d.ts +22 -0
- package/dist/edge-helpers/method-target.d.ts.map +1 -0
- package/dist/edge-helpers/method-target.js +46 -0
- package/dist/edge-helpers/method-target.js.map +1 -0
- package/dist/edge-helpers/resolution-trace.d.ts +24 -0
- package/dist/edge-helpers/resolution-trace.d.ts.map +1 -0
- package/dist/edge-helpers/resolution-trace.js +38 -0
- package/dist/edge-helpers/resolution-trace.js.map +1 -0
- package/dist/edge-helpers/resolve-decl.d.ts +44 -0
- package/dist/edge-helpers/resolve-decl.d.ts.map +1 -0
- package/dist/edge-helpers/resolve-decl.js +170 -0
- package/dist/edge-helpers/resolve-decl.js.map +1 -0
- package/dist/edge-helpers/unalias-symbol.d.ts +10 -0
- package/dist/edge-helpers/unalias-symbol.d.ts.map +1 -0
- package/dist/edge-helpers/unalias-symbol.js +29 -0
- package/dist/edge-helpers/unalias-symbol.js.map +1 -0
- package/dist/edge-resolvers/__tests__/boundary.test.d.ts +15 -0
- package/dist/edge-resolvers/__tests__/boundary.test.d.ts.map +1 -0
- package/dist/edge-resolvers/__tests__/boundary.test.js +227 -0
- package/dist/edge-resolvers/__tests__/boundary.test.js.map +1 -0
- package/dist/edge-resolvers/__tests__/callee-anchor.test.d.ts +10 -0
- package/dist/edge-resolvers/__tests__/callee-anchor.test.d.ts.map +1 -0
- package/dist/edge-resolvers/__tests__/callee-anchor.test.js +63 -0
- package/dist/edge-resolvers/__tests__/callee-anchor.test.js.map +1 -0
- package/dist/edge-resolvers/__tests__/syntactic.test.d.ts +12 -0
- package/dist/edge-resolvers/__tests__/syntactic.test.d.ts.map +1 -0
- package/dist/edge-resolvers/__tests__/syntactic.test.js +215 -0
- package/dist/edge-resolvers/__tests__/syntactic.test.js.map +1 -0
- package/dist/edge-resolvers/boundary.d.ts +41 -0
- package/dist/edge-resolvers/boundary.d.ts.map +1 -0
- package/dist/edge-resolvers/boundary.js +130 -0
- package/dist/edge-resolvers/boundary.js.map +1 -0
- package/dist/edge-resolvers/catalog-fallback.d.ts +13 -0
- package/dist/edge-resolvers/catalog-fallback.d.ts.map +1 -0
- package/dist/edge-resolvers/catalog-fallback.js +30 -0
- package/dist/edge-resolvers/catalog-fallback.js.map +1 -0
- package/dist/edge-resolvers/direct-call.d.ts +10 -0
- package/dist/edge-resolvers/direct-call.d.ts.map +1 -0
- package/dist/edge-resolvers/direct-call.js +45 -0
- package/dist/edge-resolvers/direct-call.js.map +1 -0
- package/dist/edge-resolvers/jsx-element.d.ts +16 -0
- package/dist/edge-resolvers/jsx-element.d.ts.map +1 -0
- package/dist/edge-resolvers/jsx-element.js +67 -0
- package/dist/edge-resolvers/jsx-element.js.map +1 -0
- package/dist/edge-resolvers/new-expression.d.ts +11 -0
- package/dist/edge-resolvers/new-expression.d.ts.map +1 -0
- package/dist/edge-resolvers/new-expression.js +56 -0
- package/dist/edge-resolvers/new-expression.js.map +1 -0
- package/dist/edge-resolvers/polymorphic.d.ts +8 -0
- package/dist/edge-resolvers/polymorphic.d.ts.map +1 -0
- package/dist/edge-resolvers/polymorphic.js +57 -0
- package/dist/edge-resolvers/polymorphic.js.map +1 -0
- package/dist/edge-resolvers/property-access.d.ts +10 -0
- package/dist/edge-resolvers/property-access.d.ts.map +1 -0
- package/dist/edge-resolvers/property-access.js +56 -0
- package/dist/edge-resolvers/property-access.js.map +1 -0
- package/dist/edge-resolvers/syntactic.d.ts +105 -0
- package/dist/edge-resolvers/syntactic.d.ts.map +1 -0
- package/dist/edge-resolvers/syntactic.js +294 -0
- package/dist/edge-resolvers/syntactic.js.map +1 -0
- package/dist/edge-resolvers/types.d.ts +37 -0
- package/dist/edge-resolvers/types.d.ts.map +1 -0
- package/dist/edge-resolvers/types.js +10 -0
- package/dist/edge-resolvers/types.js.map +1 -0
- package/dist/edges-value-reference.d.ts +26 -0
- package/dist/edges-value-reference.d.ts.map +1 -0
- package/dist/edges-value-reference.js +138 -0
- package/dist/edges-value-reference.js.map +1 -0
- package/dist/edges.d.ts +65 -0
- package/dist/edges.d.ts.map +1 -0
- package/dist/edges.js +392 -0
- package/dist/edges.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +346 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory-helpers/classify-visibility.d.ts +13 -0
- package/dist/inventory-helpers/classify-visibility.d.ts.map +1 -0
- package/dist/inventory-helpers/classify-visibility.js +56 -0
- package/dist/inventory-helpers/classify-visibility.js.map +1 -0
- package/dist/inventory-helpers/extract-decorators.d.ts +6 -0
- package/dist/inventory-helpers/extract-decorators.d.ts.map +1 -0
- package/dist/inventory-helpers/extract-decorators.js +33 -0
- package/dist/inventory-helpers/extract-decorators.js.map +1 -0
- package/dist/inventory-helpers/extract-params.d.ts +7 -0
- package/dist/inventory-helpers/extract-params.d.ts.map +1 -0
- package/dist/inventory-helpers/extract-params.js +28 -0
- package/dist/inventory-helpers/extract-params.js.map +1 -0
- package/dist/inventory-helpers/hash-body.d.ts +43 -0
- package/dist/inventory-helpers/hash-body.d.ts.map +1 -0
- package/dist/inventory-helpers/hash-body.js +52 -0
- package/dist/inventory-helpers/hash-body.js.map +1 -0
- package/dist/inventory-helpers/synthesize-name.d.ts +16 -0
- package/dist/inventory-helpers/synthesize-name.d.ts.map +1 -0
- package/dist/inventory-helpers/synthesize-name.js +17 -0
- package/dist/inventory-helpers/synthesize-name.js.map +1 -0
- package/dist/inventory-visitors/arrow-function.d.ts +8 -0
- package/dist/inventory-visitors/arrow-function.d.ts.map +1 -0
- package/dist/inventory-visitors/arrow-function.js +55 -0
- package/dist/inventory-visitors/arrow-function.js.map +1 -0
- package/dist/inventory-visitors/class-static-init.d.ts +17 -0
- package/dist/inventory-visitors/class-static-init.d.ts.map +1 -0
- package/dist/inventory-visitors/class-static-init.js +45 -0
- package/dist/inventory-visitors/class-static-init.js.map +1 -0
- package/dist/inventory-visitors/constructor-declaration.d.ts +7 -0
- package/dist/inventory-visitors/constructor-declaration.d.ts.map +1 -0
- package/dist/inventory-visitors/constructor-declaration.js +47 -0
- package/dist/inventory-visitors/constructor-declaration.js.map +1 -0
- package/dist/inventory-visitors/function-declaration.d.ts +7 -0
- package/dist/inventory-visitors/function-declaration.d.ts.map +1 -0
- package/dist/inventory-visitors/function-declaration.js +59 -0
- package/dist/inventory-visitors/function-declaration.js.map +1 -0
- package/dist/inventory-visitors/function-expression.d.ts +7 -0
- package/dist/inventory-visitors/function-expression.d.ts.map +1 -0
- package/dist/inventory-visitors/function-expression.js +56 -0
- package/dist/inventory-visitors/function-expression.js.map +1 -0
- package/dist/inventory-visitors/getter-setter.d.ts +7 -0
- package/dist/inventory-visitors/getter-setter.d.ts.map +1 -0
- package/dist/inventory-visitors/getter-setter.js +63 -0
- package/dist/inventory-visitors/getter-setter.js.map +1 -0
- package/dist/inventory-visitors/method-declaration.d.ts +7 -0
- package/dist/inventory-visitors/method-declaration.d.ts.map +1 -0
- package/dist/inventory-visitors/method-declaration.js +75 -0
- package/dist/inventory-visitors/method-declaration.js.map +1 -0
- package/dist/inventory-visitors/module-init.d.ts +15 -0
- package/dist/inventory-visitors/module-init.d.ts.map +1 -0
- package/dist/inventory-visitors/module-init.js +40 -0
- package/dist/inventory-visitors/module-init.js.map +1 -0
- package/dist/inventory-visitors/types.d.ts +26 -0
- package/dist/inventory-visitors/types.d.ts.map +1 -0
- package/dist/inventory-visitors/types.js +14 -0
- package/dist/inventory-visitors/types.js.map +1 -0
- package/dist/normalize-project-dir.d.ts +14 -0
- package/dist/normalize-project-dir.d.ts.map +1 -0
- package/dist/normalize-project-dir.js +36 -0
- package/dist/normalize-project-dir.js.map +1 -0
- package/dist/parse-fast.d.ts +41 -0
- package/dist/parse-fast.d.ts.map +1 -0
- package/dist/parse-fast.js +91 -0
- package/dist/parse-fast.js.map +1 -0
- package/dist/parse.d.ts +42 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +75 -0
- package/dist/parse.js.map +1 -0
- package/dist/test-file.d.ts +7 -0
- package/dist/test-file.d.ts.map +1 -0
- package/dist/test-file.js +42 -0
- package/dist/test-file.js.map +1 -0
- package/dist/walk.d.ts +125 -0
- package/dist/walk.d.ts.map +1 -0
- package/dist/walk.js +393 -0
- package/dist/walk.js.map +1 -0
- package/package.json +57 -0
package/dist/edges.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stage 2 — Edge resolution.
|
|
3
|
+
*
|
|
4
|
+
* Walks every file's AST: for each function-shaped node we hash and
|
|
5
|
+
* find the matching catalog entry. We then collect call sites in
|
|
6
|
+
* that function's body (skipping nested functions, which own their
|
|
7
|
+
* own bodies). For each call site, dispatch to the appropriate
|
|
8
|
+
* resolver and append the CallEdge to the catalog entry's calls[].
|
|
9
|
+
*
|
|
10
|
+
* Top-level statements (statements not inside any function-shaped
|
|
11
|
+
* node) own a synthetic module-init occurrence (synthesized in stage
|
|
12
|
+
* 1).
|
|
13
|
+
*/
|
|
14
|
+
import ts from 'typescript';
|
|
15
|
+
import type { CallSiteRecord } from './walk.js';
|
|
16
|
+
import type { Catalog, ResolutionStats } from '@opensip-cli/graph';
|
|
17
|
+
/** Output of TS edge resolution: catalog (with edges populated) and per-stage stats. */
|
|
18
|
+
export interface EdgeResolutionOutput {
|
|
19
|
+
readonly catalog: Catalog;
|
|
20
|
+
readonly resolutionStats: ResolutionStats;
|
|
21
|
+
}
|
|
22
|
+
/** Input for re-resolving edges from cached {@link CallSiteRecord} arrays (warm path). */
|
|
23
|
+
export interface EdgeResolutionFromRecordsInput {
|
|
24
|
+
readonly catalog: Catalog;
|
|
25
|
+
readonly program: ts.Program;
|
|
26
|
+
readonly projectDirAbs: string;
|
|
27
|
+
readonly callSites: readonly CallSiteRecord[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Stage 2 entry point: resolve a pre-collected list of call-site records
|
|
31
|
+
* produced by `walkProgram` (no AST re-descent). The orchestrator's
|
|
32
|
+
* `resolveCallSitesAdapter` drives this directly with the records the walk
|
|
33
|
+
* already emitted.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveEdgesFromRecords(input: EdgeResolutionFromRecordsInput): Promise<EdgeResolutionOutput>;
|
|
36
|
+
/** Input for the fast (syntactic, checker-free) resolve path. */
|
|
37
|
+
export interface EdgeResolutionSyntacticInput {
|
|
38
|
+
readonly catalog: Catalog;
|
|
39
|
+
readonly projectDirAbs: string;
|
|
40
|
+
readonly callSites: readonly CallSiteRecord[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Fast-tier Stage 2 entry point: resolve the same pre-collected call-site
|
|
44
|
+
* records WITHOUT a `ts.Program` or type checker. Creation edges are
|
|
45
|
+
* static and handled identically to the exact path; call edges are
|
|
46
|
+
* resolved syntactically (callee name + the file's import graph) and
|
|
47
|
+
* labeled `resolution: 'syntactic'` with capped confidence (never
|
|
48
|
+
* `'high'`). The output shape is identical to {@link resolveEdgesFromRecords}
|
|
49
|
+
* — only the verdicts differ — so the catalog stitches the same way.
|
|
50
|
+
*
|
|
51
|
+
* Stats stay honest: fast edges land in `resolvedMedium`/`resolvedLow`/
|
|
52
|
+
* `unresolved`, never `resolvedHigh`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveEdgesSyntactic(input: EdgeResolutionSyntacticInput): Promise<EdgeResolutionOutput>;
|
|
55
|
+
/**
|
|
56
|
+
* The call's return value is discarded when the call expression is the
|
|
57
|
+
* entire expression of an ExpressionStatement (`foo();`). Anything else
|
|
58
|
+
* — assignment RHS, return value, argument, conditional, member chain
|
|
59
|
+
* — consumes the return value.
|
|
60
|
+
*
|
|
61
|
+
* `await foo()` and `(foo())` wrappers are unwrapped so the underlying
|
|
62
|
+
* intent is preserved.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isReturnValueDiscarded(node: ts.Node): boolean;
|
|
65
|
+
//# sourceMappingURL=edges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../src/edges.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;GAYG;AAaH,OAAO,EAAE,MAAM,YAAY,CAAC;AA0B5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAEV,OAAO,EAGP,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAmC5B,wFAAwF;AACxF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;CAC3C;AAED,0FAA0F;AAC1F,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;CAC/C;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,oBAAoB,CAAC,CA0E/B;AAED,iEAAiE;AACjE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;CAC/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAwD/B;AAkND;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CAU7D"}
|
package/dist/edges.js
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
// @fitness-ignore-file file-length-limit -- Stage 2 edge resolver covering call+import+dependency edges in one cohesive pass; the resolution logic is contiguous and a split would push state across module boundaries.
|
|
2
|
+
/**
|
|
3
|
+
* Stage 2 — Edge resolution.
|
|
4
|
+
*
|
|
5
|
+
* Walks every file's AST: for each function-shaped node we hash and
|
|
6
|
+
* find the matching catalog entry. We then collect call sites in
|
|
7
|
+
* that function's body (skipping nested functions, which own their
|
|
8
|
+
* own bodies). For each call site, dispatch to the appropriate
|
|
9
|
+
* resolver and append the CallEdge to the catalog entry's calls[].
|
|
10
|
+
*
|
|
11
|
+
* Top-level statements (statements not inside any function-shaped
|
|
12
|
+
* node) own a synthetic module-init occurrence (synthesized in stage
|
|
13
|
+
* 1).
|
|
14
|
+
*/
|
|
15
|
+
import { relative, sep } from 'node:path';
|
|
16
|
+
import { logger } from '@opensip-cli/core';
|
|
17
|
+
import { appendEdge, createMutableStats, ownerEdgeKey, pushCreationEdge as pushSharedCreationEdge, resolveSpecifierToPackage, truncateForCallEdge, } from '@opensip-cli/graph';
|
|
18
|
+
import ts from 'typescript';
|
|
19
|
+
import { buildCrossPackageContext } from './edge-helpers/cross-package-context.js';
|
|
20
|
+
import { DeclShape, functionLikeFromDeclaration } from './edge-helpers/declaration-to-node.js';
|
|
21
|
+
import { unaliasSymbol } from './edge-helpers/unalias-symbol.js';
|
|
22
|
+
import { resolveByCatalogFallback } from './edge-resolvers/catalog-fallback.js';
|
|
23
|
+
import { resolveDirectCall } from './edge-resolvers/direct-call.js';
|
|
24
|
+
import { resolveJsxElement } from './edge-resolvers/jsx-element.js';
|
|
25
|
+
import { resolveNewExpression } from './edge-resolvers/new-expression.js';
|
|
26
|
+
import { resolvePolymorphicCall } from './edge-resolvers/polymorphic.js';
|
|
27
|
+
import { resolvePropertyAccessCall } from './edge-resolvers/property-access.js';
|
|
28
|
+
import { buildImportIndex, buildImportSpecifierIndex, calleeAnchorNode, collectKnownFiles, resolveSyntactic, } from './edge-resolvers/syntactic.js';
|
|
29
|
+
import { isValueReference, resolveShorthandAssignment, resolveValueReference, } from './edges-value-reference.js';
|
|
30
|
+
/** How many call sites to process between cooperative event-loop yields. Tuned
|
|
31
|
+
* so the live view's 80ms clock ticks several times per second during a long
|
|
32
|
+
* resolve, while keeping the macrotask-hop count (and its overhead) tiny. */
|
|
33
|
+
const YIELD_EVERY_CALL_SITES = 250;
|
|
34
|
+
/** Yield to the event loop once (a macrotask hop), so the in-process live view
|
|
35
|
+
* can paint a frame mid-stage (ADR-0016). */
|
|
36
|
+
function yieldToEventLoop() {
|
|
37
|
+
return new Promise((resolve) => {
|
|
38
|
+
setImmediate(resolve);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function tsPosition(node, sourceFile) {
|
|
42
|
+
// Anchor the edge identity at the CALLEE token (method name / callee / class),
|
|
43
|
+
// not the whole expression's start — so chained calls `a().b()` don't collide
|
|
44
|
+
// on one (line,column) key. The display TEXT stays the whole expression.
|
|
45
|
+
const anchor = calleeAnchorNode(node).getStart(sourceFile);
|
|
46
|
+
const anchorLC = sourceFile.getLineAndCharacterOfPosition(anchor);
|
|
47
|
+
return {
|
|
48
|
+
line: anchorLC.line + 1,
|
|
49
|
+
column: anchorLC.character,
|
|
50
|
+
text: sourceFile.text.slice(node.getStart(sourceFile), node.getEnd()),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Stage 2 entry point: resolve a pre-collected list of call-site records
|
|
55
|
+
* produced by `walkProgram` (no AST re-descent). The orchestrator's
|
|
56
|
+
* `resolveCallSitesAdapter` drives this directly with the records the walk
|
|
57
|
+
* already emitted.
|
|
58
|
+
*/
|
|
59
|
+
export async function resolveEdgesFromRecords(input) {
|
|
60
|
+
logger.info({ evt: 'graph.edges.start', module: 'graph:edges' });
|
|
61
|
+
const checker = input.program.getTypeChecker();
|
|
62
|
+
const callsByHash = new Map();
|
|
63
|
+
const stats = createMutableStats();
|
|
64
|
+
const sink = { edgesByOwner: callsByHash, stats };
|
|
65
|
+
// Cross-package resolution context (export index + manifest index) — the SAME
|
|
66
|
+
// model the sharded linker uses. Built once for the whole resolve stage so a
|
|
67
|
+
// workspace `@scope/pkg` call resolves to the SOURCE occurrence instead of the
|
|
68
|
+
// type checker's bodiless `dist/*.d.ts` declaration (ADR — exact↔sharded
|
|
69
|
+
// convergence). The per-file raw-import-specifier index (binding name → raw
|
|
70
|
+
// specifier) is built lazily and cached, mirroring the boundary extractor.
|
|
71
|
+
const crossPackage = buildCrossPackageContext(input.catalog, input.projectDirAbs);
|
|
72
|
+
// One import-specifier index per source file, built lazily and cached inline in
|
|
73
|
+
// the loop below (the cache Map is a local of THIS function, like the fast
|
|
74
|
+
// path's `importIndexByFile`).
|
|
75
|
+
const importSpecifiersByFile = new Map();
|
|
76
|
+
let processed = 0;
|
|
77
|
+
for (const r of input.callSites) {
|
|
78
|
+
// Cooperative yield (ADR-0016): resolve is the heaviest stage (tens of
|
|
79
|
+
// thousands of sites). Yielding to the event loop every N sites lets the
|
|
80
|
+
// in-process live view's 80ms clock tick, so the spinner animates instead
|
|
81
|
+
// of freezing for the whole stage. The macrotask hops (~1 per N sites) are
|
|
82
|
+
// negligible against the per-site type-checker work.
|
|
83
|
+
if (processed > 0 && processed % YIELD_EVERY_CALL_SITES === 0)
|
|
84
|
+
await yieldToEventLoop();
|
|
85
|
+
processed += 1;
|
|
86
|
+
// Bucket edges per OWNER OCCURRENCE (bodyHash + file), not bodyHash alone:
|
|
87
|
+
// body-twin functions in different files share a hash, and a hash-only
|
|
88
|
+
// bucket would union their edges into phantom cross-package calls.
|
|
89
|
+
const ownerKey = ownerEdgeKey(r.ownerHash, relative(input.projectDirAbs, r.sourceFile.fileName));
|
|
90
|
+
if (r.kind === 'creation') {
|
|
91
|
+
if (r.childHash === undefined)
|
|
92
|
+
continue;
|
|
93
|
+
// @fitness-ignore-next-line detached-promises -- pushCallEdge/pushSharedCreationEdge return void (synchronous edge-sink writes), not promises
|
|
94
|
+
pushSharedCreationEdge(tsPosition(r.node, r.sourceFile), ownerKey, r.childHash, sink);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
let importSpecifiers = importSpecifiersByFile.get(r.sourceFile);
|
|
98
|
+
if (importSpecifiers === undefined) {
|
|
99
|
+
importSpecifiers = buildImportSpecifierIndex(r.sourceFile);
|
|
100
|
+
importSpecifiersByFile.set(r.sourceFile, importSpecifiers);
|
|
101
|
+
}
|
|
102
|
+
const ctx = {
|
|
103
|
+
catalog: input.catalog,
|
|
104
|
+
program: input.program,
|
|
105
|
+
typeChecker: checker,
|
|
106
|
+
sourceFile: r.sourceFile,
|
|
107
|
+
projectDirAbs: input.projectDirAbs,
|
|
108
|
+
crossPackage,
|
|
109
|
+
importSpecifiers,
|
|
110
|
+
};
|
|
111
|
+
const verdict = computeVerdict(r.node, ctx);
|
|
112
|
+
if (verdict === null)
|
|
113
|
+
continue;
|
|
114
|
+
// @fitness-ignore-next-line detached-promises -- pushCallEdge/pushSharedCreationEdge return void (synchronous edge-sink writes), not promises
|
|
115
|
+
pushCallEdge(r.node, r.sourceFile, verdict, ownerKey, sink);
|
|
116
|
+
}
|
|
117
|
+
const newCatalog = rebuildCatalog(input.catalog, callsByHash);
|
|
118
|
+
logger.info({
|
|
119
|
+
evt: 'graph.edges.complete',
|
|
120
|
+
module: 'graph:edges',
|
|
121
|
+
totalCallSites: stats.totalCallSites,
|
|
122
|
+
resolvedHigh: stats.resolvedHigh,
|
|
123
|
+
resolvedMedium: stats.resolvedMedium,
|
|
124
|
+
resolvedLow: stats.resolvedLow,
|
|
125
|
+
unresolved: stats.unresolved,
|
|
126
|
+
});
|
|
127
|
+
return { catalog: newCatalog, resolutionStats: stats };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Fast-tier Stage 2 entry point: resolve the same pre-collected call-site
|
|
131
|
+
* records WITHOUT a `ts.Program` or type checker. Creation edges are
|
|
132
|
+
* static and handled identically to the exact path; call edges are
|
|
133
|
+
* resolved syntactically (callee name + the file's import graph) and
|
|
134
|
+
* labeled `resolution: 'syntactic'` with capped confidence (never
|
|
135
|
+
* `'high'`). The output shape is identical to {@link resolveEdgesFromRecords}
|
|
136
|
+
* — only the verdicts differ — so the catalog stitches the same way.
|
|
137
|
+
*
|
|
138
|
+
* Stats stay honest: fast edges land in `resolvedMedium`/`resolvedLow`/
|
|
139
|
+
* `unresolved`, never `resolvedHigh`.
|
|
140
|
+
*/
|
|
141
|
+
export async function resolveEdgesSyntactic(input) {
|
|
142
|
+
logger.info({ evt: 'graph.edges.syntactic.start', module: 'graph:edges' });
|
|
143
|
+
const callsByHash = new Map();
|
|
144
|
+
const stats = createMutableStats();
|
|
145
|
+
const sink = { edgesByOwner: callsByHash, stats };
|
|
146
|
+
const knownFiles = collectKnownFiles(input.catalog);
|
|
147
|
+
// One import index per source file — cached across that file's sites.
|
|
148
|
+
const importIndexByFile = new Map();
|
|
149
|
+
let processed = 0;
|
|
150
|
+
for (const r of input.callSites) {
|
|
151
|
+
// Cooperative yield — see resolveEdgesFromRecords (ADR-0016).
|
|
152
|
+
// @fitness-ignore-next-line performance-anti-patterns -- cooperative yield (ADR-0016) runs once per N call-sites so the live view stays responsive; intentionally serial, not parallelizable
|
|
153
|
+
if (processed > 0 && processed % YIELD_EVERY_CALL_SITES === 0)
|
|
154
|
+
await yieldToEventLoop();
|
|
155
|
+
processed += 1;
|
|
156
|
+
// Per-owner-occurrence bucket key (see resolveEdgesFromRecords).
|
|
157
|
+
const ownerKey = ownerEdgeKey(r.ownerHash, relative(input.projectDirAbs, r.sourceFile.fileName));
|
|
158
|
+
if (r.kind === 'creation') {
|
|
159
|
+
if (r.childHash === undefined)
|
|
160
|
+
continue;
|
|
161
|
+
// @fitness-ignore-next-line detached-promises -- pushCallEdge/pushSharedCreationEdge return void (synchronous edge-sink writes), not promises
|
|
162
|
+
pushSharedCreationEdge(tsPosition(r.node, r.sourceFile), ownerKey, r.childHash, sink);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
let importIndex = importIndexByFile.get(r.sourceFile);
|
|
166
|
+
if (importIndex === undefined) {
|
|
167
|
+
importIndex = buildImportIndex(r.sourceFile, input.projectDirAbs, knownFiles);
|
|
168
|
+
importIndexByFile.set(r.sourceFile, importIndex);
|
|
169
|
+
}
|
|
170
|
+
const currentFileRel = relative(input.projectDirAbs, r.sourceFile.fileName)
|
|
171
|
+
.split(sep)
|
|
172
|
+
.join('/');
|
|
173
|
+
const verdict = resolveSyntactic(r.node, {
|
|
174
|
+
catalog: input.catalog,
|
|
175
|
+
currentFileRel,
|
|
176
|
+
importIndex,
|
|
177
|
+
});
|
|
178
|
+
if (verdict === null)
|
|
179
|
+
continue;
|
|
180
|
+
// @fitness-ignore-next-line detached-promises -- pushCallEdge/pushSharedCreationEdge return void (synchronous edge-sink writes), not promises
|
|
181
|
+
pushCallEdge(r.node, r.sourceFile, verdict, ownerKey, sink);
|
|
182
|
+
}
|
|
183
|
+
const newCatalog = rebuildCatalog(input.catalog, callsByHash);
|
|
184
|
+
logger.info({
|
|
185
|
+
evt: 'graph.edges.syntactic.complete',
|
|
186
|
+
module: 'graph:edges',
|
|
187
|
+
totalCallSites: stats.totalCallSites,
|
|
188
|
+
resolvedMedium: stats.resolvedMedium,
|
|
189
|
+
resolvedLow: stats.resolvedLow,
|
|
190
|
+
unresolved: stats.unresolved,
|
|
191
|
+
});
|
|
192
|
+
return { catalog: newCatalog, resolutionStats: stats };
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Append an ordinary call/new/jsx/value-reference edge from a resolver
|
|
196
|
+
* verdict. Bumps `totalCallSites` directly (every call expression is
|
|
197
|
+
* a site, even unresolved-by-shape ones); delegates per-confidence
|
|
198
|
+
* classification to `stats.apply`.
|
|
199
|
+
*/
|
|
200
|
+
function pushCallEdge(node, sourceFile, verdict, ownerKey, sink) {
|
|
201
|
+
const { edgesByOwner: callsByHash, stats } = sink;
|
|
202
|
+
stats.totalCallSites++;
|
|
203
|
+
const pos = tsPosition(node, sourceFile);
|
|
204
|
+
const edge = {
|
|
205
|
+
to: verdict.to,
|
|
206
|
+
line: pos.line,
|
|
207
|
+
column: pos.column,
|
|
208
|
+
resolution: verdict.resolution,
|
|
209
|
+
confidence: verdict.confidence,
|
|
210
|
+
text: truncateForCallEdge(pos.text),
|
|
211
|
+
discarded: isReturnValueDiscarded(node),
|
|
212
|
+
};
|
|
213
|
+
appendEdge(callsByHash, ownerKey, edge);
|
|
214
|
+
stats.apply(edge);
|
|
215
|
+
}
|
|
216
|
+
function verdictEntry(predicate, resolve) {
|
|
217
|
+
return { predicate, resolve: (n, c) => resolve(n, c) };
|
|
218
|
+
}
|
|
219
|
+
const isJsxLikeOpening = (n) => ts.isJsxOpeningElement(n) || ts.isJsxSelfClosingElement(n);
|
|
220
|
+
const isValueRefIdentifier = (n) => ts.isIdentifier(n) && isValueReference(n);
|
|
221
|
+
const VERDICT_TABLE = [
|
|
222
|
+
verdictEntry(ts.isCallExpression, (n, c) => dispatchCall(n, c)),
|
|
223
|
+
verdictEntry(ts.isNewExpression, (n, c) => resolveNewExpression(n, c)),
|
|
224
|
+
verdictEntry(isJsxLikeOpening, (n, c) => resolveJsxElement(n, c)),
|
|
225
|
+
verdictEntry(isValueRefIdentifier, (n, c) => {
|
|
226
|
+
const v = resolveValueReference(n, c);
|
|
227
|
+
return v.to.length > 0 ? v : null;
|
|
228
|
+
}),
|
|
229
|
+
verdictEntry(ts.isShorthandPropertyAssignment, (n, c) => {
|
|
230
|
+
const v = resolveShorthandAssignment(n, c);
|
|
231
|
+
return v.to.length > 0 ? v : null;
|
|
232
|
+
}),
|
|
233
|
+
];
|
|
234
|
+
/** Returns null if `node` is not a call/new/jsx/value-reference site. */
|
|
235
|
+
function computeVerdict(node, ctx) {
|
|
236
|
+
for (const entry of VERDICT_TABLE) {
|
|
237
|
+
if (entry.predicate(node))
|
|
238
|
+
return entry.resolve(node, ctx);
|
|
239
|
+
}
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
function dispatchCall(node, ctx) {
|
|
243
|
+
// Direct identifier call: foo()
|
|
244
|
+
if (ts.isIdentifier(node.expression)) {
|
|
245
|
+
const direct = resolveDirectCall(node, ctx);
|
|
246
|
+
if (direct.to.length > 0)
|
|
247
|
+
return direct;
|
|
248
|
+
return fallbackWithBinding(node.expression, node.expression.text, ctx);
|
|
249
|
+
}
|
|
250
|
+
// Property access call: obj.method()
|
|
251
|
+
if (ts.isPropertyAccessExpression(node.expression)) {
|
|
252
|
+
const direct = resolvePropertyAccessCall(node, ctx);
|
|
253
|
+
if (direct.to.length > 0)
|
|
254
|
+
return direct;
|
|
255
|
+
const poly = resolvePolymorphicCall(node, ctx);
|
|
256
|
+
if (poly.to.length > 0)
|
|
257
|
+
return poly;
|
|
258
|
+
// Fallback: look up by the rightmost simple name (binding-gated).
|
|
259
|
+
return fallbackWithBinding(node.expression, node.expression.name.text, ctx);
|
|
260
|
+
}
|
|
261
|
+
return { to: [], resolution: 'unknown', confidence: 'low' };
|
|
262
|
+
}
|
|
263
|
+
const UNRESOLVED_VERDICT = { to: [], resolution: 'unknown', confidence: 'low' };
|
|
264
|
+
/**
|
|
265
|
+
* Binding-gated catalog fallback. The unique-name catalog lookup
|
|
266
|
+
* ({@link resolveByCatalogFallback}) only fires when the call site has a binding
|
|
267
|
+
* that points INTO the project. A project binding is any of:
|
|
268
|
+
*
|
|
269
|
+
* - the callee expression's resolved symbol has an IN-PROJECT SOURCE
|
|
270
|
+
* declaration (a `.ts(x)` file, not a `.d.ts`). This is the receiver/type
|
|
271
|
+
* case the import graph can't see: `g.greet()` where `g: Greeter` resolves
|
|
272
|
+
* to the interface method declared in a project source file, even though
|
|
273
|
+
* `greet` was never imported by name;
|
|
274
|
+
* - the name is imported via a RELATIVE specifier (`./x`) — intra-package; or
|
|
275
|
+
* - the name is imported via a WORKSPACE specifier (`@scope/pkg`) the manifest
|
|
276
|
+
* index knows — inter-package.
|
|
277
|
+
*
|
|
278
|
+
* A callee whose symbol resolves only into an EXTERNAL/ambient `.d.ts` (Vitest's
|
|
279
|
+
* `describe`, `process.cwd`, a `Map`'s `.set`/`.get`) has NO project binding:
|
|
280
|
+
* the real target is outside the catalog, so a unique project function sharing
|
|
281
|
+
* the simple name would be a phantom. Without a project binding we decline —
|
|
282
|
+
* decline-beats-guess.
|
|
283
|
+
*
|
|
284
|
+
* NOTE: a same-named function merely EXISTING in the caller's file is NOT a
|
|
285
|
+
* binding — its presence is no evidence THIS call targets it. The former
|
|
286
|
+
* same-file name-presence branch let `process.send()` / `arr.push()` /
|
|
287
|
+
* `new Map().has()` / core `logger.info()` enter the name-only catalog fallback,
|
|
288
|
+
* which then resolved by SHARD-SCOPED catalog uniqueness — unsound under sharding
|
|
289
|
+
* (unique-in-shard ≠ unique-in-repo). That fabricated 33 local same-name edges on
|
|
290
|
+
* this repo (a cross-package/external method call → a same-file same-name
|
|
291
|
+
* function) that the whole-program checker correctly declines. Removed:
|
|
292
|
+
* decline-beats-guess. (Genuine cross-package edges sharded *does* resolve come
|
|
293
|
+
* from the type-checker resolvers' `.d.ts`→source hop, not this fallback, so they
|
|
294
|
+
* are unaffected.)
|
|
295
|
+
*/
|
|
296
|
+
function fallbackWithBinding(calleeExpr, name, ctx) {
|
|
297
|
+
if (!hasProjectBinding(calleeExpr, name, ctx))
|
|
298
|
+
return UNRESOLVED_VERDICT;
|
|
299
|
+
return resolveByCatalogFallback(name, ctx.catalog);
|
|
300
|
+
}
|
|
301
|
+
/** True when the call's callee binds into the project (see {@link fallbackWithBinding}). */
|
|
302
|
+
function hasProjectBinding(calleeExpr, name, ctx) {
|
|
303
|
+
if (symbolHasInProjectSourceDecl(calleeExpr, ctx))
|
|
304
|
+
return true;
|
|
305
|
+
const spec = ctx.importSpecifiers.get(name);
|
|
306
|
+
if (spec !== undefined) {
|
|
307
|
+
if (spec.startsWith('.'))
|
|
308
|
+
return true; // relative → intra-project
|
|
309
|
+
// Bare specifier → only a project binding if it resolves to a workspace pkg.
|
|
310
|
+
return resolveSpecifierToPackage(spec, ctx.crossPackage.manifestIndex) !== undefined;
|
|
311
|
+
}
|
|
312
|
+
// No type-checked in-project binding and no import specifier ⇒ no binding.
|
|
313
|
+
// (A same-named function merely existing in this file is not a binding — see
|
|
314
|
+
// the fallbackWithBinding doc. Declining here is the decline-beats-guess floor.)
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
/** Concrete-callable declaration shapes a name-only fallback may resolve against
|
|
318
|
+
* — excludes parameters / property- and method-signatures (a function-TYPED
|
|
319
|
+
* binding whose actual target the fallback cannot know). Mirrors the
|
|
320
|
+
* property-access resolver's ACCEPT set. */
|
|
321
|
+
const CALLABLE_DECL = DeclShape.FunctionDeclaration |
|
|
322
|
+
DeclShape.ArrowFunction |
|
|
323
|
+
DeclShape.FunctionExpression |
|
|
324
|
+
DeclShape.MethodDeclaration |
|
|
325
|
+
DeclShape.ConstructorDeclaration |
|
|
326
|
+
DeclShape.Accessor |
|
|
327
|
+
DeclShape.VariableInitializer |
|
|
328
|
+
DeclShape.PropertyAssignmentInitializer;
|
|
329
|
+
/**
|
|
330
|
+
* True when the callee expression's resolved symbol has at least one declaration
|
|
331
|
+
* in an IN-PROJECT SOURCE file (a non-`.d.ts` source file in the program). This
|
|
332
|
+
* is the binding the import graph can't express: a receiver-typed method call
|
|
333
|
+
* (`g.greet()` where `g: Greeter`) whose target is declared in project source,
|
|
334
|
+
* even though the method name was never imported. A symbol that resolves only
|
|
335
|
+
* into `.d.ts` (external / ambient) declarations fails this check, so the
|
|
336
|
+
* name-only fallback stays declined for globals.
|
|
337
|
+
*/
|
|
338
|
+
function symbolHasInProjectSourceDecl(calleeExpr, ctx) {
|
|
339
|
+
const symbol = ctx.typeChecker.getSymbolAtLocation(calleeExpr);
|
|
340
|
+
if (!symbol)
|
|
341
|
+
return false;
|
|
342
|
+
const real = unaliasSymbol(symbol, ctx.typeChecker);
|
|
343
|
+
for (const d of real.getDeclarations() ?? []) {
|
|
344
|
+
// Only a CONCRETE CALLABLE source declaration is a binding the name-only
|
|
345
|
+
// fallback may resolve against. A parameter / property-signature / method-
|
|
346
|
+
// signature (`options.shouldNotRetry?.()`, `push: PushViolation`) is NOT —
|
|
347
|
+
// the call's real target is whatever VALUE flows into it, which the shard-
|
|
348
|
+
// scoped name fallback cannot know, so it guesses a same-name occurrence
|
|
349
|
+
// (resolved when unique IN THE SHARD, declined when ambiguous WHOLE-PROGRAM
|
|
350
|
+
// — the exact↔sharded divergence). Gating to a callable decl declines those
|
|
351
|
+
// guesses in BOTH engines: decline-beats-guess, and convergent.
|
|
352
|
+
if (!d.getSourceFile().isDeclarationFile &&
|
|
353
|
+
functionLikeFromDeclaration(d, CALLABLE_DECL) !== null) {
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* The call's return value is discarded when the call expression is the
|
|
361
|
+
* entire expression of an ExpressionStatement (`foo();`). Anything else
|
|
362
|
+
* — assignment RHS, return value, argument, conditional, member chain
|
|
363
|
+
* — consumes the return value.
|
|
364
|
+
*
|
|
365
|
+
* `await foo()` and `(foo())` wrappers are unwrapped so the underlying
|
|
366
|
+
* intent is preserved.
|
|
367
|
+
*/
|
|
368
|
+
export function isReturnValueDiscarded(node) {
|
|
369
|
+
let parent = node.parent;
|
|
370
|
+
while (parent) {
|
|
371
|
+
if (ts.isParenthesizedExpression(parent) || ts.isAwaitExpression(parent)) {
|
|
372
|
+
parent = parent.parent;
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
return ts.isExpressionStatement(parent);
|
|
376
|
+
}
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
function rebuildCatalog(catalog, callsByHash) {
|
|
380
|
+
const functions = Object.create(null);
|
|
381
|
+
for (const name of Object.keys(catalog.functions)) {
|
|
382
|
+
const occs = catalog.functions[name];
|
|
383
|
+
if (!occs)
|
|
384
|
+
continue;
|
|
385
|
+
functions[name] = occs.map((o) => ({
|
|
386
|
+
...o,
|
|
387
|
+
calls: callsByHash.get(ownerEdgeKey(o.bodyHash, o.filePath)) ?? [],
|
|
388
|
+
}));
|
|
389
|
+
}
|
|
390
|
+
return { ...catalog, functions };
|
|
391
|
+
}
|
|
392
|
+
//# sourceMappingURL=edges.js.map
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AC9C,OAAO,MAAM,EAAE,CAAC;QACd,IAAI,EAAE,CAAC,yBAAyB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;YACzE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YACvB,SAAS;QACX,CAAC;QACD,OAAO,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CACrB,OAAgB,EAChB,WAAqD;IAErD,MAAM,SAAS,GAAkD,MAAM,CAAC,MAAM,CAAC,IAAI,CAGlF,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,GAA8C,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChF,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACjC,GAAG,CAAC;YACJ,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE;SACnE,CAAC,CAAC,CAAC;IACN,CAAC;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC;AACnC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @opensip-cli/graph — TypeScript language adapter.
|
|
3
|
+
*
|
|
4
|
+
* Lands in PR 3 of plan docs/plans/10-graph-language-pluggability.md.
|
|
5
|
+
* Exposes `typescriptGraphAdapter`, the GraphLanguageAdapter
|
|
6
|
+
* implementation that wraps the existing TypeScript-specific
|
|
7
|
+
* walk/discover/edges machinery into the contract surface defined
|
|
8
|
+
* by `lang-adapter/types.ts`.
|
|
9
|
+
*
|
|
10
|
+
* The contract surface is intentionally small (six methods); each
|
|
11
|
+
* one delegates to the TypeScript-specific implementation and
|
|
12
|
+
* translates I/O shapes:
|
|
13
|
+
*
|
|
14
|
+
* discoverFiles → ./discover.ts:discoverFiles
|
|
15
|
+
* parseProject → ./parse.ts:parseProject
|
|
16
|
+
* walkProject → ./walk.ts:walkProgram, with CallSiteRecord
|
|
17
|
+
* translation (node/sourceFile → nodeRef/sourceFileRef)
|
|
18
|
+
* resolveCallSites → ./edges.ts:resolveEdgesFromRecords
|
|
19
|
+
* cacheKey → ./cache-key.ts:cacheKey
|
|
20
|
+
* ruleHints → starter list of side-effect primitives + the
|
|
21
|
+
* `isTestFile` predicate previously inlined in walk.ts
|
|
22
|
+
*
|
|
23
|
+
* Files outside this subtree are forbidden from importing the
|
|
24
|
+
* TypeScript compiler API directly; the dep-cruiser rule
|
|
25
|
+
* `graph-no-typescript-import-outside-lang-typescript` enforces it.
|
|
26
|
+
*/
|
|
27
|
+
import type { TsParsed } from './parse.js';
|
|
28
|
+
import type { GraphLanguageAdapter } from '@opensip-cli/graph';
|
|
29
|
+
export declare const typescriptGraphAdapter: GraphLanguageAdapter<TsParsed>;
|
|
30
|
+
/**
|
|
31
|
+
* Discovery contract: external adapter packs export `adapter` (the
|
|
32
|
+
* GraphLanguageAdapter) and `metadata` (a small descriptor used by
|
|
33
|
+
* the CLI for diagnostics). The CLI bootstrap registers `adapter` into
|
|
34
|
+
* the adapter registry after a successful `import()`.
|
|
35
|
+
*/
|
|
36
|
+
export { typescriptGraphAdapter as adapter };
|
|
37
|
+
export declare const metadata: {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly displayName: string | undefined;
|
|
40
|
+
readonly fileExtensions: readonly string[];
|
|
41
|
+
};
|
|
42
|
+
export type { TsParsed, TypescriptParsedProject } from './parse.js';
|
|
43
|
+
export type { TypescriptFastParsedProject } from './parse-fast.js';
|
|
44
|
+
export type { EdgeResolver, ResolverContext } from './edge-resolvers/types.js';
|
|
45
|
+
export type { InventoryVisitor, VisitorContext } from './inventory-visitors/types.js';
|
|
46
|
+
export { isTypescriptTestFile } from './test-file.js';
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAiBH,OAAO,KAAK,EAAE,QAAQ,EAA2B,MAAM,YAAY,CAAC;AAKpE,OAAO,KAAK,EAMV,oBAAoB,EASrB,MAAM,oBAAoB,CAAC;AAoV5B,eAAO,MAAM,sBAAsB,EAAE,oBAAoB,CAAC,QAAQ,CAcjE,CAAC;AAEF;;;;;GAKG;AACH,OAAO,EAAE,sBAAsB,IAAI,OAAO,EAAE,CAAC;AAC7C,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAIX,YAAY,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACpE,YAAY,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACnE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC/E,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|