@opencodehub/ingestion 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/README.md +69 -0
- package/dist/extract/index.d.ts +8 -0
- package/dist/extract/index.d.ts.map +1 -0
- package/dist/extract/index.js +6 -0
- package/dist/extract/index.js.map +1 -0
- package/dist/extract/orm-detector.d.ts +19 -0
- package/dist/extract/orm-detector.d.ts.map +1 -0
- package/dist/extract/orm-detector.js +209 -0
- package/dist/extract/orm-detector.js.map +1 -0
- package/dist/extract/property-access.d.ts +76 -0
- package/dist/extract/property-access.d.ts.map +1 -0
- package/dist/extract/property-access.js +260 -0
- package/dist/extract/property-access.js.map +1 -0
- package/dist/extract/receiver-resolver.d.ts +86 -0
- package/dist/extract/receiver-resolver.d.ts.map +1 -0
- package/dist/extract/receiver-resolver.js +77 -0
- package/dist/extract/receiver-resolver.js.map +1 -0
- package/dist/extract/route-detector-java.d.ts +29 -0
- package/dist/extract/route-detector-java.d.ts.map +1 -0
- package/dist/extract/route-detector-java.js +190 -0
- package/dist/extract/route-detector-java.js.map +1 -0
- package/dist/extract/route-detector-nestjs.d.ts +30 -0
- package/dist/extract/route-detector-nestjs.d.ts.map +1 -0
- package/dist/extract/route-detector-nestjs.js +134 -0
- package/dist/extract/route-detector-nestjs.js.map +1 -0
- package/dist/extract/route-detector-python.d.ts +28 -0
- package/dist/extract/route-detector-python.d.ts.map +1 -0
- package/dist/extract/route-detector-python.js +100 -0
- package/dist/extract/route-detector-python.js.map +1 -0
- package/dist/extract/route-detector-rails.d.ts +28 -0
- package/dist/extract/route-detector-rails.d.ts.map +1 -0
- package/dist/extract/route-detector-rails.js +162 -0
- package/dist/extract/route-detector-rails.js.map +1 -0
- package/dist/extract/route-detector.d.ts +45 -0
- package/dist/extract/route-detector.d.ts.map +1 -0
- package/dist/extract/route-detector.js +467 -0
- package/dist/extract/route-detector.js.map +1 -0
- package/dist/extract/tool-detector.d.ts +26 -0
- package/dist/extract/tool-detector.d.ts.map +1 -0
- package/dist/extract/tool-detector.js +364 -0
- package/dist/extract/tool-detector.js.map +1 -0
- package/dist/extract/types.d.ts +89 -0
- package/dist/extract/types.d.ts.map +1 -0
- package/dist/extract/types.js +11 -0
- package/dist/extract/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/parse/cobol-regex.d.ts +85 -0
- package/dist/parse/cobol-regex.d.ts.map +1 -0
- package/dist/parse/cobol-regex.js +355 -0
- package/dist/parse/cobol-regex.js.map +1 -0
- package/dist/parse/grammar-registry.d.ts +115 -0
- package/dist/parse/grammar-registry.d.ts.map +1 -0
- package/dist/parse/grammar-registry.js +278 -0
- package/dist/parse/grammar-registry.js.map +1 -0
- package/dist/parse/index.d.ts +14 -0
- package/dist/parse/index.d.ts.map +1 -0
- package/dist/parse/index.js +10 -0
- package/dist/parse/index.js.map +1 -0
- package/dist/parse/language-detector.d.ts +17 -0
- package/dist/parse/language-detector.d.ts.map +1 -0
- package/dist/parse/language-detector.js +104 -0
- package/dist/parse/language-detector.js.map +1 -0
- package/dist/parse/parse-worker.d.ts +24 -0
- package/dist/parse/parse-worker.d.ts.map +1 -0
- package/dist/parse/parse-worker.js +230 -0
- package/dist/parse/parse-worker.js.map +1 -0
- package/dist/parse/types.d.ts +49 -0
- package/dist/parse/types.d.ts.map +1 -0
- package/dist/parse/types.js +11 -0
- package/dist/parse/types.js.map +1 -0
- package/dist/parse/unified-queries.d.ts +37 -0
- package/dist/parse/unified-queries.d.ts.map +1 -0
- package/dist/parse/unified-queries.js +623 -0
- package/dist/parse/unified-queries.js.map +1 -0
- package/dist/parse/wasm-fallback.d.ts +88 -0
- package/dist/parse/wasm-fallback.d.ts.map +1 -0
- package/dist/parse/wasm-fallback.js +258 -0
- package/dist/parse/wasm-fallback.js.map +1 -0
- package/dist/parse/worker-pool.d.ts +48 -0
- package/dist/parse/worker-pool.d.ts.map +1 -0
- package/dist/parse/worker-pool.js +97 -0
- package/dist/parse/worker-pool.js.map +1 -0
- package/dist/pipeline/dep-parsers/go.d.ts +25 -0
- package/dist/pipeline/dep-parsers/go.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/go.js +146 -0
- package/dist/pipeline/dep-parsers/go.js.map +1 -0
- package/dist/pipeline/dep-parsers/index.d.ts +17 -0
- package/dist/pipeline/dep-parsers/index.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/index.js +16 -0
- package/dist/pipeline/dep-parsers/index.js.map +1 -0
- package/dist/pipeline/dep-parsers/maven.d.ts +24 -0
- package/dist/pipeline/dep-parsers/maven.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/maven.js +131 -0
- package/dist/pipeline/dep-parsers/maven.js.map +1 -0
- package/dist/pipeline/dep-parsers/npm.d.ts +30 -0
- package/dist/pipeline/dep-parsers/npm.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/npm.js +309 -0
- package/dist/pipeline/dep-parsers/npm.js.map +1 -0
- package/dist/pipeline/dep-parsers/nuget.d.ts +24 -0
- package/dist/pipeline/dep-parsers/nuget.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/nuget.js +178 -0
- package/dist/pipeline/dep-parsers/nuget.js.map +1 -0
- package/dist/pipeline/dep-parsers/python.d.ts +21 -0
- package/dist/pipeline/dep-parsers/python.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/python.js +369 -0
- package/dist/pipeline/dep-parsers/python.js.map +1 -0
- package/dist/pipeline/dep-parsers/rust.d.ts +18 -0
- package/dist/pipeline/dep-parsers/rust.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/rust.js +134 -0
- package/dist/pipeline/dep-parsers/rust.js.map +1 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.d.ts +15 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.js +31 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.js.map +1 -0
- package/dist/pipeline/dep-parsers/types.d.ts +63 -0
- package/dist/pipeline/dep-parsers/types.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/types.js +56 -0
- package/dist/pipeline/dep-parsers/types.js.map +1 -0
- package/dist/pipeline/gitignore-stack.d.ts +44 -0
- package/dist/pipeline/gitignore-stack.d.ts.map +1 -0
- package/dist/pipeline/gitignore-stack.js +69 -0
- package/dist/pipeline/gitignore-stack.js.map +1 -0
- package/dist/pipeline/gitignore.d.ts +67 -0
- package/dist/pipeline/gitignore.d.ts.map +1 -0
- package/dist/pipeline/gitignore.js +210 -0
- package/dist/pipeline/gitignore.js.map +1 -0
- package/dist/pipeline/index.d.ts +53 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +29 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/orchestrator.d.ts +105 -0
- package/dist/pipeline/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/orchestrator.js +175 -0
- package/dist/pipeline/orchestrator.js.map +1 -0
- package/dist/pipeline/ownership-helpers/drift.d.ts +41 -0
- package/dist/pipeline/ownership-helpers/drift.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/drift.js +122 -0
- package/dist/pipeline/ownership-helpers/drift.js.map +1 -0
- package/dist/pipeline/ownership-helpers/gini-community.d.ts +24 -0
- package/dist/pipeline/ownership-helpers/gini-community.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/gini-community.js +32 -0
- package/dist/pipeline/ownership-helpers/gini-community.js.map +1 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts +71 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.js +178 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.js.map +1 -0
- package/dist/pipeline/ownership-helpers/line-overlap.d.ts +35 -0
- package/dist/pipeline/ownership-helpers/line-overlap.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/line-overlap.js +62 -0
- package/dist/pipeline/ownership-helpers/line-overlap.js.map +1 -0
- package/dist/pipeline/ownership-helpers/orphan.d.ts +73 -0
- package/dist/pipeline/ownership-helpers/orphan.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/orphan.js +117 -0
- package/dist/pipeline/ownership-helpers/orphan.js.map +1 -0
- package/dist/pipeline/phases/accesses.d.ts +44 -0
- package/dist/pipeline/phases/accesses.d.ts.map +1 -0
- package/dist/pipeline/phases/accesses.js +194 -0
- package/dist/pipeline/phases/accesses.js.map +1 -0
- package/dist/pipeline/phases/annotate.d.ts +28 -0
- package/dist/pipeline/phases/annotate.d.ts.map +1 -0
- package/dist/pipeline/phases/annotate.js +60 -0
- package/dist/pipeline/phases/annotate.js.map +1 -0
- package/dist/pipeline/phases/cochange.d.ts +42 -0
- package/dist/pipeline/phases/cochange.d.ts.map +1 -0
- package/dist/pipeline/phases/cochange.js +0 -0
- package/dist/pipeline/phases/cochange.js.map +1 -0
- package/dist/pipeline/phases/communities.d.ts +34 -0
- package/dist/pipeline/phases/communities.d.ts.map +1 -0
- package/dist/pipeline/phases/communities.js +412 -0
- package/dist/pipeline/phases/communities.js.map +1 -0
- package/dist/pipeline/phases/complexity.d.ts +50 -0
- package/dist/pipeline/phases/complexity.d.ts.map +1 -0
- package/dist/pipeline/phases/complexity.js +794 -0
- package/dist/pipeline/phases/complexity.js.map +1 -0
- package/dist/pipeline/phases/confidence-demote.d.ts +23 -0
- package/dist/pipeline/phases/confidence-demote.d.ts.map +1 -0
- package/dist/pipeline/phases/confidence-demote.js +113 -0
- package/dist/pipeline/phases/confidence-demote.js.map +1 -0
- package/dist/pipeline/phases/content-cache.d.ts +166 -0
- package/dist/pipeline/phases/content-cache.d.ts.map +1 -0
- package/dist/pipeline/phases/content-cache.js +323 -0
- package/dist/pipeline/phases/content-cache.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts +25 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.js +139 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts +25 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.js +51 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts +32 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.js +98 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.d.ts +21 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.js +104 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/types.d.ts +27 -0
- package/dist/pipeline/phases/coverage-parsers/types.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/types.js +39 -0
- package/dist/pipeline/phases/coverage-parsers/types.js.map +1 -0
- package/dist/pipeline/phases/coverage.d.ts +39 -0
- package/dist/pipeline/phases/coverage.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage.js +154 -0
- package/dist/pipeline/phases/coverage.js.map +1 -0
- package/dist/pipeline/phases/cross-file.d.ts +40 -0
- package/dist/pipeline/phases/cross-file.d.ts.map +1 -0
- package/dist/pipeline/phases/cross-file.js +411 -0
- package/dist/pipeline/phases/cross-file.js.map +1 -0
- package/dist/pipeline/phases/dead-code.d.ts +28 -0
- package/dist/pipeline/phases/dead-code.d.ts.map +1 -0
- package/dist/pipeline/phases/dead-code.js +157 -0
- package/dist/pipeline/phases/dead-code.js.map +1 -0
- package/dist/pipeline/phases/default-set.d.ts +24 -0
- package/dist/pipeline/phases/default-set.d.ts.map +1 -0
- package/dist/pipeline/phases/default-set.js +133 -0
- package/dist/pipeline/phases/default-set.js.map +1 -0
- package/dist/pipeline/phases/dependencies.d.ts +59 -0
- package/dist/pipeline/phases/dependencies.d.ts.map +1 -0
- package/dist/pipeline/phases/dependencies.js +281 -0
- package/dist/pipeline/phases/dependencies.js.map +1 -0
- package/dist/pipeline/phases/embedder-pool.d.ts +31 -0
- package/dist/pipeline/phases/embedder-pool.d.ts.map +1 -0
- package/dist/pipeline/phases/embedder-pool.js +79 -0
- package/dist/pipeline/phases/embedder-pool.js.map +1 -0
- package/dist/pipeline/phases/embedder-worker.d.ts +28 -0
- package/dist/pipeline/phases/embedder-worker.d.ts.map +1 -0
- package/dist/pipeline/phases/embedder-worker.js +43 -0
- package/dist/pipeline/phases/embedder-worker.js.map +1 -0
- package/dist/pipeline/phases/embeddings.d.ts +117 -0
- package/dist/pipeline/phases/embeddings.d.ts.map +1 -0
- package/dist/pipeline/phases/embeddings.js +697 -0
- package/dist/pipeline/phases/embeddings.js.map +1 -0
- package/dist/pipeline/phases/fetches.d.ts +47 -0
- package/dist/pipeline/phases/fetches.d.ts.map +1 -0
- package/dist/pipeline/phases/fetches.js +207 -0
- package/dist/pipeline/phases/fetches.js.map +1 -0
- package/dist/pipeline/phases/incremental-helper.d.ts +96 -0
- package/dist/pipeline/phases/incremental-helper.d.ts.map +1 -0
- package/dist/pipeline/phases/incremental-helper.js +125 -0
- package/dist/pipeline/phases/incremental-helper.js.map +1 -0
- package/dist/pipeline/phases/incremental-scope.d.ts +67 -0
- package/dist/pipeline/phases/incremental-scope.d.ts.map +1 -0
- package/dist/pipeline/phases/incremental-scope.js +225 -0
- package/dist/pipeline/phases/incremental-scope.js.map +1 -0
- package/dist/pipeline/phases/markdown.d.ts +29 -0
- package/dist/pipeline/phases/markdown.d.ts.map +1 -0
- package/dist/pipeline/phases/markdown.js +298 -0
- package/dist/pipeline/phases/markdown.js.map +1 -0
- package/dist/pipeline/phases/mro.d.ts +24 -0
- package/dist/pipeline/phases/mro.d.ts.map +1 -0
- package/dist/pipeline/phases/mro.js +303 -0
- package/dist/pipeline/phases/mro.js.map +1 -0
- package/dist/pipeline/phases/openapi.d.ts +52 -0
- package/dist/pipeline/phases/openapi.d.ts.map +1 -0
- package/dist/pipeline/phases/openapi.js +285 -0
- package/dist/pipeline/phases/openapi.js.map +1 -0
- package/dist/pipeline/phases/orm.d.ts +26 -0
- package/dist/pipeline/phases/orm.d.ts.map +1 -0
- package/dist/pipeline/phases/orm.js +183 -0
- package/dist/pipeline/phases/orm.js.map +1 -0
- package/dist/pipeline/phases/ownership.d.ts +88 -0
- package/dist/pipeline/phases/ownership.d.ts.map +1 -0
- package/dist/pipeline/phases/ownership.js +479 -0
- package/dist/pipeline/phases/ownership.js.map +1 -0
- package/dist/pipeline/phases/parse.d.ts +63 -0
- package/dist/pipeline/phases/parse.d.ts.map +1 -0
- package/dist/pipeline/phases/parse.js +994 -0
- package/dist/pipeline/phases/parse.js.map +1 -0
- package/dist/pipeline/phases/processes.d.ts +47 -0
- package/dist/pipeline/phases/processes.d.ts.map +1 -0
- package/dist/pipeline/phases/processes.js +620 -0
- package/dist/pipeline/phases/processes.js.map +1 -0
- package/dist/pipeline/phases/profile.d.ts +33 -0
- package/dist/pipeline/phases/profile.d.ts.map +1 -0
- package/dist/pipeline/phases/profile.js +91 -0
- package/dist/pipeline/phases/profile.js.map +1 -0
- package/dist/pipeline/phases/repo-node.d.ts +112 -0
- package/dist/pipeline/phases/repo-node.d.ts.map +1 -0
- package/dist/pipeline/phases/repo-node.js +272 -0
- package/dist/pipeline/phases/repo-node.js.map +1 -0
- package/dist/pipeline/phases/risk-snapshot.d.ts +34 -0
- package/dist/pipeline/phases/risk-snapshot.d.ts.map +1 -0
- package/dist/pipeline/phases/risk-snapshot.js +63 -0
- package/dist/pipeline/phases/risk-snapshot.js.map +1 -0
- package/dist/pipeline/phases/routes.d.ts +31 -0
- package/dist/pipeline/phases/routes.d.ts.map +1 -0
- package/dist/pipeline/phases/routes.js +262 -0
- package/dist/pipeline/phases/routes.js.map +1 -0
- package/dist/pipeline/phases/sbom.d.ts +45 -0
- package/dist/pipeline/phases/sbom.d.ts.map +1 -0
- package/dist/pipeline/phases/sbom.js +289 -0
- package/dist/pipeline/phases/sbom.js.map +1 -0
- package/dist/pipeline/phases/scan.d.ts +54 -0
- package/dist/pipeline/phases/scan.d.ts.map +1 -0
- package/dist/pipeline/phases/scan.js +340 -0
- package/dist/pipeline/phases/scan.js.map +1 -0
- package/dist/pipeline/phases/scip-index.d.ts +54 -0
- package/dist/pipeline/phases/scip-index.d.ts.map +1 -0
- package/dist/pipeline/phases/scip-index.js +469 -0
- package/dist/pipeline/phases/scip-index.js.map +1 -0
- package/dist/pipeline/phases/structure.d.ts +21 -0
- package/dist/pipeline/phases/structure.d.ts.map +1 -0
- package/dist/pipeline/phases/structure.js +115 -0
- package/dist/pipeline/phases/structure.js.map +1 -0
- package/dist/pipeline/phases/summarize.d.ts +126 -0
- package/dist/pipeline/phases/summarize.d.ts.map +1 -0
- package/dist/pipeline/phases/summarize.js +401 -0
- package/dist/pipeline/phases/summarize.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts +42 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.js +96 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts +22 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.js +32 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts +21 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.js +37 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/gini.d.ts +32 -0
- package/dist/pipeline/phases/temporal-helpers/gini.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/gini.js +78 -0
- package/dist/pipeline/phases/temporal-helpers/gini.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts +14 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.js +25 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts +18 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.js +119 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.js.map +1 -0
- package/dist/pipeline/phases/temporal.d.ts +65 -0
- package/dist/pipeline/phases/temporal.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal.js +621 -0
- package/dist/pipeline/phases/temporal.js.map +1 -0
- package/dist/pipeline/phases/tools.d.ts +21 -0
- package/dist/pipeline/phases/tools.d.ts.map +1 -0
- package/dist/pipeline/phases/tools.js +118 -0
- package/dist/pipeline/phases/tools.js.map +1 -0
- package/dist/pipeline/profile-detectors/api-contracts.d.ts +18 -0
- package/dist/pipeline/profile-detectors/api-contracts.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/api-contracts.js +78 -0
- package/dist/pipeline/profile-detectors/api-contracts.js.map +1 -0
- package/dist/pipeline/profile-detectors/framework-detector.d.ts +11 -0
- package/dist/pipeline/profile-detectors/framework-detector.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/framework-detector.js +11 -0
- package/dist/pipeline/profile-detectors/framework-detector.js.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts +7 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.js +7 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.js.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks.d.ts +7 -0
- package/dist/pipeline/profile-detectors/frameworks.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks.js +7 -0
- package/dist/pipeline/profile-detectors/frameworks.js.map +1 -0
- package/dist/pipeline/profile-detectors/iac.d.ts +22 -0
- package/dist/pipeline/profile-detectors/iac.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/iac.js +97 -0
- package/dist/pipeline/profile-detectors/iac.js.map +1 -0
- package/dist/pipeline/profile-detectors/languages.d.ts +18 -0
- package/dist/pipeline/profile-detectors/languages.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/languages.js +60 -0
- package/dist/pipeline/profile-detectors/languages.js.map +1 -0
- package/dist/pipeline/profile-detectors/manifests.d.ts +7 -0
- package/dist/pipeline/profile-detectors/manifests.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/manifests.js +7 -0
- package/dist/pipeline/profile-detectors/manifests.js.map +1 -0
- package/dist/pipeline/profile-detectors/src-dirs.d.ts +17 -0
- package/dist/pipeline/profile-detectors/src-dirs.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/src-dirs.js +89 -0
- package/dist/pipeline/profile-detectors/src-dirs.js.map +1 -0
- package/dist/pipeline/profile-detectors/variant-detectors.d.ts +7 -0
- package/dist/pipeline/profile-detectors/variant-detectors.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/variant-detectors.js +7 -0
- package/dist/pipeline/profile-detectors/variant-detectors.js.map +1 -0
- package/dist/pipeline/runner.d.ts +54 -0
- package/dist/pipeline/runner.d.ts.map +1 -0
- package/dist/pipeline/runner.js +247 -0
- package/dist/pipeline/runner.js.map +1 -0
- package/dist/pipeline/types.d.ts +235 -0
- package/dist/pipeline/types.d.ts.map +1 -0
- package/dist/pipeline/types.js +15 -0
- package/dist/pipeline/types.js.map +1 -0
- package/dist/providers/c.d.ts +3 -0
- package/dist/providers/c.d.ts.map +1 -0
- package/dist/providers/c.js +162 -0
- package/dist/providers/c.js.map +1 -0
- package/dist/providers/cobol.d.ts +19 -0
- package/dist/providers/cobol.d.ts.map +1 -0
- package/dist/providers/cobol.js +44 -0
- package/dist/providers/cobol.js.map +1 -0
- package/dist/providers/cpp.d.ts +3 -0
- package/dist/providers/cpp.d.ts.map +1 -0
- package/dist/providers/cpp.js +200 -0
- package/dist/providers/cpp.js.map +1 -0
- package/dist/providers/csharp.d.ts +3 -0
- package/dist/providers/csharp.d.ts.map +1 -0
- package/dist/providers/csharp.js +292 -0
- package/dist/providers/csharp.js.map +1 -0
- package/dist/providers/dart.d.ts +3 -0
- package/dist/providers/dart.d.ts.map +1 -0
- package/dist/providers/dart.js +214 -0
- package/dist/providers/dart.js.map +1 -0
- package/dist/providers/definition-ids.d.ts +18 -0
- package/dist/providers/definition-ids.d.ts.map +1 -0
- package/dist/providers/definition-ids.js +23 -0
- package/dist/providers/definition-ids.js.map +1 -0
- package/dist/providers/extract-helpers.d.ts +60 -0
- package/dist/providers/extract-helpers.d.ts.map +1 -0
- package/dist/providers/extract-helpers.js +296 -0
- package/dist/providers/extract-helpers.js.map +1 -0
- package/dist/providers/extraction-types.d.ts +85 -0
- package/dist/providers/extraction-types.d.ts.map +1 -0
- package/dist/providers/extraction-types.js +13 -0
- package/dist/providers/extraction-types.js.map +1 -0
- package/dist/providers/go.d.ts +3 -0
- package/dist/providers/go.d.ts.map +1 -0
- package/dist/providers/go.js +359 -0
- package/dist/providers/go.js.map +1 -0
- package/dist/providers/http-detect.d.ts +44 -0
- package/dist/providers/http-detect.d.ts.map +1 -0
- package/dist/providers/http-detect.js +307 -0
- package/dist/providers/http-detect.js.map +1 -0
- package/dist/providers/index.d.ts +38 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +33 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/java.d.ts +3 -0
- package/dist/providers/java.d.ts.map +1 -0
- package/dist/providers/java.js +259 -0
- package/dist/providers/java.js.map +1 -0
- package/dist/providers/javascript.d.ts +3 -0
- package/dist/providers/javascript.d.ts.map +1 -0
- package/dist/providers/javascript.js +139 -0
- package/dist/providers/javascript.js.map +1 -0
- package/dist/providers/kotlin.d.ts +3 -0
- package/dist/providers/kotlin.d.ts.map +1 -0
- package/dist/providers/kotlin.js +175 -0
- package/dist/providers/kotlin.js.map +1 -0
- package/dist/providers/php.d.ts +3 -0
- package/dist/providers/php.d.ts.map +1 -0
- package/dist/providers/php.js +218 -0
- package/dist/providers/php.js.map +1 -0
- package/dist/providers/python-accesses.d.ts +9 -0
- package/dist/providers/python-accesses.d.ts.map +1 -0
- package/dist/providers/python-accesses.js +22 -0
- package/dist/providers/python-accesses.js.map +1 -0
- package/dist/providers/python.d.ts +3 -0
- package/dist/providers/python.d.ts.map +1 -0
- package/dist/providers/python.js +323 -0
- package/dist/providers/python.js.map +1 -0
- package/dist/providers/registry.d.ts +4 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +46 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/resolution/c3.d.ts +6 -0
- package/dist/providers/resolution/c3.d.ts.map +1 -0
- package/dist/providers/resolution/c3.js +76 -0
- package/dist/providers/resolution/c3.js.map +1 -0
- package/dist/providers/resolution/context.d.ts +38 -0
- package/dist/providers/resolution/context.d.ts.map +1 -0
- package/dist/providers/resolution/context.js +45 -0
- package/dist/providers/resolution/context.js.map +1 -0
- package/dist/providers/resolution/first-wins.d.ts +3 -0
- package/dist/providers/resolution/first-wins.d.ts.map +1 -0
- package/dist/providers/resolution/first-wins.js +27 -0
- package/dist/providers/resolution/first-wins.js.map +1 -0
- package/dist/providers/resolution/mro.d.ts +16 -0
- package/dist/providers/resolution/mro.d.ts.map +1 -0
- package/dist/providers/resolution/mro.js +14 -0
- package/dist/providers/resolution/mro.js.map +1 -0
- package/dist/providers/resolution/none.d.ts +3 -0
- package/dist/providers/resolution/none.d.ts.map +1 -0
- package/dist/providers/resolution/none.js +11 -0
- package/dist/providers/resolution/none.js.map +1 -0
- package/dist/providers/resolution/python-all-filter.d.ts +25 -0
- package/dist/providers/resolution/python-all-filter.d.ts.map +1 -0
- package/dist/providers/resolution/python-all-filter.js +64 -0
- package/dist/providers/resolution/python-all-filter.js.map +1 -0
- package/dist/providers/resolution/resolver-strategy.d.ts +42 -0
- package/dist/providers/resolution/resolver-strategy.d.ts.map +1 -0
- package/dist/providers/resolution/resolver-strategy.js +50 -0
- package/dist/providers/resolution/resolver-strategy.js.map +1 -0
- package/dist/providers/resolution/single-inheritance.d.ts +3 -0
- package/dist/providers/resolution/single-inheritance.d.ts.map +1 -0
- package/dist/providers/resolution/single-inheritance.js +21 -0
- package/dist/providers/resolution/single-inheritance.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts +16 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js +50 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/glue.d.ts +15 -0
- package/dist/providers/resolution/stack-graphs/glue.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/glue.js +44 -0
- package/dist/providers/resolution/stack-graphs/glue.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts +30 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.js +366 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts +9 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.js +152 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.d.ts +11 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.js +247 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/types.d.ts +93 -0
- package/dist/providers/resolution/stack-graphs/types.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/types.js +11 -0
- package/dist/providers/resolution/stack-graphs/types.js.map +1 -0
- package/dist/providers/resolution/stack-graphs-python.d.ts +27 -0
- package/dist/providers/resolution/stack-graphs-python.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs-python.js +104 -0
- package/dist/providers/resolution/stack-graphs-python.js.map +1 -0
- package/dist/providers/resolution/stack-graphs-ts.d.ts +134 -0
- package/dist/providers/resolution/stack-graphs-ts.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs-ts.js +372 -0
- package/dist/providers/resolution/stack-graphs-ts.js.map +1 -0
- package/dist/providers/ruby.d.ts +3 -0
- package/dist/providers/ruby.d.ts.map +1 -0
- package/dist/providers/ruby.js +259 -0
- package/dist/providers/ruby.js.map +1 -0
- package/dist/providers/rust.d.ts +3 -0
- package/dist/providers/rust.d.ts.map +1 -0
- package/dist/providers/rust.js +318 -0
- package/dist/providers/rust.js.map +1 -0
- package/dist/providers/swift.d.ts +3 -0
- package/dist/providers/swift.d.ts.map +1 -0
- package/dist/providers/swift.js +177 -0
- package/dist/providers/swift.js.map +1 -0
- package/dist/providers/test-helpers.d.ts +24 -0
- package/dist/providers/test-helpers.d.ts.map +1 -0
- package/dist/providers/test-helpers.js +33 -0
- package/dist/providers/test-helpers.js.map +1 -0
- package/dist/providers/ts-shared.d.ts +30 -0
- package/dist/providers/ts-shared.d.ts.map +1 -0
- package/dist/providers/ts-shared.js +328 -0
- package/dist/providers/ts-shared.js.map +1 -0
- package/dist/providers/tsx.d.ts +7 -0
- package/dist/providers/tsx.d.ts.map +1 -0
- package/dist/providers/tsx.js +79 -0
- package/dist/providers/tsx.js.map +1 -0
- package/dist/providers/types.d.ts +166 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +7 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/typescript-family-accesses.d.ts +14 -0
- package/dist/providers/typescript-family-accesses.d.ts.map +1 -0
- package/dist/providers/typescript-family-accesses.js +27 -0
- package/dist/providers/typescript-family-accesses.js.map +1 -0
- package/dist/providers/typescript.d.ts +9 -0
- package/dist/providers/typescript.d.ts.map +1 -0
- package/dist/providers/typescript.js +84 -0
- package/dist/providers/typescript.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outbound HTTP-call detectors.
|
|
3
|
+
*
|
|
4
|
+
* Lightweight regex-based detectors shared across provider hooks. The
|
|
5
|
+
* patterns intentionally trade recall for precision: we prefer to miss
|
|
6
|
+
* exotic forms than emit false positives that pollute the FETCHES graph.
|
|
7
|
+
*
|
|
8
|
+
* Covered clients:
|
|
9
|
+
* TypeScript / JavaScript:
|
|
10
|
+
* - `fetch(url, { method: "POST" })`, `fetch(url)` (default GET)
|
|
11
|
+
* - `axios.get(url, ...)`, `axios.post(url, ...)`, `axios({method, url})`
|
|
12
|
+
* - `ky.get(url)` / `ky.post(url)`
|
|
13
|
+
* Python:
|
|
14
|
+
* - `requests.get(url, ...)`, `requests.post(url, ...)`
|
|
15
|
+
* - `httpx.get(url)`, `httpx.post(url)`, `httpx.AsyncClient().get(url)`
|
|
16
|
+
* - `urllib.request.urlopen(url)` — best-effort, assumed GET
|
|
17
|
+
* Go:
|
|
18
|
+
* - `http.Get(url)`, `http.Post(url, ...)`, `http.PostForm(url, ...)`
|
|
19
|
+
* Java:
|
|
20
|
+
* - `restTemplate.getForObject(url, ...)`, `restTemplate.postForObject(url, ...)`
|
|
21
|
+
* - `webClient.get().uri(url)`, `webClient.post().uri(url)`
|
|
22
|
+
* - OkHttp `Request.Builder().url(url)` — method defaults to GET unless
|
|
23
|
+
* a subsequent `.post(...)` / `.put(...)` / `.delete(...)` is chained.
|
|
24
|
+
*
|
|
25
|
+
* Every detector is purely text-oriented. Providers can call into these
|
|
26
|
+
* helpers from their `detectOutboundHttp` hook and merge / sort the result.
|
|
27
|
+
*/
|
|
28
|
+
const METHODS = new Set([
|
|
29
|
+
"GET",
|
|
30
|
+
"POST",
|
|
31
|
+
"PUT",
|
|
32
|
+
"PATCH",
|
|
33
|
+
"DELETE",
|
|
34
|
+
"HEAD",
|
|
35
|
+
"OPTIONS",
|
|
36
|
+
"TRACE",
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* Deterministic sort so two runs of the same input always yield the same
|
|
40
|
+
* edge order. Order:
|
|
41
|
+
* 1. ascending startLine
|
|
42
|
+
* 2. tiebreak on method
|
|
43
|
+
* 3. tiebreak on urlTemplate
|
|
44
|
+
* 4. tiebreak on clientLibrary
|
|
45
|
+
*/
|
|
46
|
+
export function sortHttpCalls(calls) {
|
|
47
|
+
const copy = [...calls];
|
|
48
|
+
copy.sort((a, b) => {
|
|
49
|
+
if (a.startLine !== b.startLine)
|
|
50
|
+
return a.startLine - b.startLine;
|
|
51
|
+
if (a.method !== b.method)
|
|
52
|
+
return a.method < b.method ? -1 : 1;
|
|
53
|
+
if (a.urlTemplate !== b.urlTemplate)
|
|
54
|
+
return a.urlTemplate < b.urlTemplate ? -1 : 1;
|
|
55
|
+
if (a.clientLibrary !== b.clientLibrary)
|
|
56
|
+
return a.clientLibrary < b.clientLibrary ? -1 : 1;
|
|
57
|
+
return 0;
|
|
58
|
+
});
|
|
59
|
+
return copy;
|
|
60
|
+
}
|
|
61
|
+
/** Convert `:id` / `{id}` to a canonical `{id}` form and drop query strings. */
|
|
62
|
+
export function normalizeUrlTemplate(raw) {
|
|
63
|
+
const qIdx = raw.indexOf("?");
|
|
64
|
+
const stripped = qIdx === -1 ? raw : raw.slice(0, qIdx);
|
|
65
|
+
const trimmed = stripped.trim();
|
|
66
|
+
// Convert Express-style `:name` to `{name}`.
|
|
67
|
+
return trimmed.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, "{$1}");
|
|
68
|
+
}
|
|
69
|
+
function lineOf(source, offset) {
|
|
70
|
+
let line = 1;
|
|
71
|
+
for (let i = 0; i < offset && i < source.length; i += 1) {
|
|
72
|
+
if (source.charCodeAt(i) === 10)
|
|
73
|
+
line += 1;
|
|
74
|
+
}
|
|
75
|
+
return line;
|
|
76
|
+
}
|
|
77
|
+
function matchMethodString(raw) {
|
|
78
|
+
const upper = raw.toUpperCase();
|
|
79
|
+
return METHODS.has(upper) ? upper : undefined;
|
|
80
|
+
}
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// TypeScript / JavaScript
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
const TS_STRING_URL = /(['"`])([^'"`]+)\1/;
|
|
85
|
+
/** Match `fetch(url, { method: "POST" })` and `fetch(url)` (default GET). */
|
|
86
|
+
const FETCH_CALL = /\bfetch\s*\(\s*(['"`])([^'"`]+)\1(?:\s*,\s*\{([^}]*)\})?\s*\)/g;
|
|
87
|
+
/**
|
|
88
|
+
* Match `axios.get("/x")`, `axios.post("/x", body)`, etc. The verb is any of
|
|
89
|
+
* the HTTP methods lowercased.
|
|
90
|
+
*/
|
|
91
|
+
const AXIOS_VERB = /\b(axios|ky)\s*\.\s*(get|post|put|patch|delete|head|options|trace)\s*\(\s*(['"`])([^'"`]+)\3/g;
|
|
92
|
+
/** `axios({ method: "post", url: "/x" })` */
|
|
93
|
+
const AXIOS_CONFIG = /\baxios\s*\(\s*\{([^}]*)\}\s*\)/g;
|
|
94
|
+
function extractTsAxiosConfigBody(body) {
|
|
95
|
+
const methodMatch = /\bmethod\s*:\s*(['"`])([^'"`]+)\1/.exec(body);
|
|
96
|
+
const urlMatch = /\burl\s*:\s*(['"`])([^'"`]+)\1/.exec(body);
|
|
97
|
+
const out = {};
|
|
98
|
+
if (methodMatch) {
|
|
99
|
+
const m = matchMethodString(methodMatch[2]);
|
|
100
|
+
if (m !== undefined)
|
|
101
|
+
out.method = m;
|
|
102
|
+
}
|
|
103
|
+
if (urlMatch) {
|
|
104
|
+
out.url = urlMatch[2];
|
|
105
|
+
}
|
|
106
|
+
return out;
|
|
107
|
+
}
|
|
108
|
+
export function detectHttpCallsTsJs(sourceText) {
|
|
109
|
+
const out = [];
|
|
110
|
+
for (const m of sourceText.matchAll(FETCH_CALL)) {
|
|
111
|
+
const url = m[2];
|
|
112
|
+
const optsBody = m[3] ?? "";
|
|
113
|
+
let method = "GET";
|
|
114
|
+
const mm = /\bmethod\s*:\s*(['"`])([^'"`]+)\1/.exec(optsBody);
|
|
115
|
+
if (mm) {
|
|
116
|
+
const parsed = matchMethodString(mm[2]);
|
|
117
|
+
if (parsed !== undefined)
|
|
118
|
+
method = parsed;
|
|
119
|
+
}
|
|
120
|
+
const start = lineOf(sourceText, m.index ?? 0);
|
|
121
|
+
out.push({
|
|
122
|
+
method,
|
|
123
|
+
urlTemplate: normalizeUrlTemplate(url),
|
|
124
|
+
startLine: start,
|
|
125
|
+
endLine: start,
|
|
126
|
+
clientLibrary: "fetch",
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
for (const m of sourceText.matchAll(AXIOS_VERB)) {
|
|
130
|
+
const lib = m[1];
|
|
131
|
+
const verb = m[2];
|
|
132
|
+
const url = m[4];
|
|
133
|
+
const method = matchMethodString(verb);
|
|
134
|
+
if (method === undefined)
|
|
135
|
+
continue;
|
|
136
|
+
const start = lineOf(sourceText, m.index ?? 0);
|
|
137
|
+
out.push({
|
|
138
|
+
method,
|
|
139
|
+
urlTemplate: normalizeUrlTemplate(url),
|
|
140
|
+
startLine: start,
|
|
141
|
+
endLine: start,
|
|
142
|
+
clientLibrary: lib,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
for (const m of sourceText.matchAll(AXIOS_CONFIG)) {
|
|
146
|
+
const body = m[1];
|
|
147
|
+
const parsed = extractTsAxiosConfigBody(body);
|
|
148
|
+
if (parsed.url === undefined)
|
|
149
|
+
continue;
|
|
150
|
+
const method = parsed.method ?? "GET";
|
|
151
|
+
const start = lineOf(sourceText, m.index ?? 0);
|
|
152
|
+
out.push({
|
|
153
|
+
method,
|
|
154
|
+
urlTemplate: normalizeUrlTemplate(parsed.url),
|
|
155
|
+
startLine: start,
|
|
156
|
+
endLine: start,
|
|
157
|
+
clientLibrary: "axios",
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return sortHttpCalls(out);
|
|
161
|
+
}
|
|
162
|
+
// Keep `TS_STRING_URL` referenced (imported for future use / documentation).
|
|
163
|
+
void TS_STRING_URL;
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// Python
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
const PY_VERB_CALL = /\b(requests|httpx)(?:\.AsyncClient\(\)|\.Client\(\))?\s*\.\s*(get|post|put|patch|delete|head|options|trace)\s*\(\s*(['"])([^'"]+)\3/gi;
|
|
168
|
+
const PY_URLOPEN = /\burllib\.request\.urlopen\s*\(\s*(['"])([^'"]+)\1/g;
|
|
169
|
+
export function detectHttpCallsPython(sourceText) {
|
|
170
|
+
const out = [];
|
|
171
|
+
for (const m of sourceText.matchAll(PY_VERB_CALL)) {
|
|
172
|
+
const lib = m[1].toLowerCase();
|
|
173
|
+
const verb = m[2];
|
|
174
|
+
const url = m[4];
|
|
175
|
+
const method = matchMethodString(verb);
|
|
176
|
+
if (method === undefined)
|
|
177
|
+
continue;
|
|
178
|
+
const start = lineOf(sourceText, m.index ?? 0);
|
|
179
|
+
out.push({
|
|
180
|
+
method,
|
|
181
|
+
urlTemplate: normalizeUrlTemplate(url),
|
|
182
|
+
startLine: start,
|
|
183
|
+
endLine: start,
|
|
184
|
+
clientLibrary: lib,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
for (const m of sourceText.matchAll(PY_URLOPEN)) {
|
|
188
|
+
const url = m[2];
|
|
189
|
+
const start = lineOf(sourceText, m.index ?? 0);
|
|
190
|
+
out.push({
|
|
191
|
+
method: "GET",
|
|
192
|
+
urlTemplate: normalizeUrlTemplate(url),
|
|
193
|
+
startLine: start,
|
|
194
|
+
endLine: start,
|
|
195
|
+
clientLibrary: "urllib",
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return sortHttpCalls(out);
|
|
199
|
+
}
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
// Go
|
|
202
|
+
// ---------------------------------------------------------------------------
|
|
203
|
+
const GO_VERB_CALL = /\bhttp\.(Get|Post|PostForm|Head|Put|Delete|Patch)\s*\(\s*(["`])([^"`]+)\2/g;
|
|
204
|
+
export function detectHttpCallsGo(sourceText) {
|
|
205
|
+
const out = [];
|
|
206
|
+
for (const m of sourceText.matchAll(GO_VERB_CALL)) {
|
|
207
|
+
const verbRaw = m[1];
|
|
208
|
+
const url = m[3];
|
|
209
|
+
const verb = verbRaw === "PostForm" ? "POST" : verbRaw.toUpperCase();
|
|
210
|
+
const method = matchMethodString(verb);
|
|
211
|
+
if (method === undefined)
|
|
212
|
+
continue;
|
|
213
|
+
const start = lineOf(sourceText, m.index ?? 0);
|
|
214
|
+
out.push({
|
|
215
|
+
method,
|
|
216
|
+
urlTemplate: normalizeUrlTemplate(url),
|
|
217
|
+
startLine: start,
|
|
218
|
+
endLine: start,
|
|
219
|
+
clientLibrary: "net/http",
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return sortHttpCalls(out);
|
|
223
|
+
}
|
|
224
|
+
// ---------------------------------------------------------------------------
|
|
225
|
+
// Java
|
|
226
|
+
// ---------------------------------------------------------------------------
|
|
227
|
+
const JAVA_REST_TEMPLATE = /\b(restTemplate|this\.restTemplate)\s*\.\s*(getForObject|getForEntity|postForObject|postForEntity|put|delete|patchForObject|exchange)\s*\(\s*"([^"]+)"/g;
|
|
228
|
+
const JAVA_WEBCLIENT_URI = /\bwebClient\s*\.\s*(get|post|put|patch|delete|head|options|trace)\s*\(\s*\)\s*\.\s*uri\s*\(\s*"([^"]+)"/g;
|
|
229
|
+
const JAVA_OKHTTP_URL = /new\s+Request\.Builder\s*\(\s*\)\s*\.\s*url\s*\(\s*"([^"]+)"/g;
|
|
230
|
+
const JAVA_OKHTTP_METHOD_CHAIN = /\.(get|post|put|patch|delete|head|options)\s*\(/g;
|
|
231
|
+
function restTemplateVerb(op) {
|
|
232
|
+
const o = op.toLowerCase();
|
|
233
|
+
if (o.startsWith("getfor"))
|
|
234
|
+
return "GET";
|
|
235
|
+
if (o.startsWith("postfor"))
|
|
236
|
+
return "POST";
|
|
237
|
+
if (o === "put")
|
|
238
|
+
return "PUT";
|
|
239
|
+
if (o === "delete")
|
|
240
|
+
return "DELETE";
|
|
241
|
+
if (o.startsWith("patchfor"))
|
|
242
|
+
return "PATCH";
|
|
243
|
+
if (o === "exchange")
|
|
244
|
+
return "GET"; // ambiguous — default to GET
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
export function detectHttpCallsJava(sourceText) {
|
|
248
|
+
const out = [];
|
|
249
|
+
for (const m of sourceText.matchAll(JAVA_REST_TEMPLATE)) {
|
|
250
|
+
const op = m[2];
|
|
251
|
+
const url = m[3];
|
|
252
|
+
const method = restTemplateVerb(op);
|
|
253
|
+
if (method === undefined)
|
|
254
|
+
continue;
|
|
255
|
+
const start = lineOf(sourceText, m.index ?? 0);
|
|
256
|
+
out.push({
|
|
257
|
+
method,
|
|
258
|
+
urlTemplate: normalizeUrlTemplate(url),
|
|
259
|
+
startLine: start,
|
|
260
|
+
endLine: start,
|
|
261
|
+
clientLibrary: "restTemplate",
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
for (const m of sourceText.matchAll(JAVA_WEBCLIENT_URI)) {
|
|
265
|
+
const verb = m[1];
|
|
266
|
+
const url = m[2];
|
|
267
|
+
const method = matchMethodString(verb);
|
|
268
|
+
if (method === undefined)
|
|
269
|
+
continue;
|
|
270
|
+
const start = lineOf(sourceText, m.index ?? 0);
|
|
271
|
+
out.push({
|
|
272
|
+
method,
|
|
273
|
+
urlTemplate: normalizeUrlTemplate(url),
|
|
274
|
+
startLine: start,
|
|
275
|
+
endLine: start,
|
|
276
|
+
clientLibrary: "webClient",
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
// OkHttp: correlate `new Request.Builder().url(X)` with any method-verb
|
|
280
|
+
// chained within the next ~400 characters of source. If no verb is found
|
|
281
|
+
// assume GET.
|
|
282
|
+
for (const m of sourceText.matchAll(JAVA_OKHTTP_URL)) {
|
|
283
|
+
const url = m[1];
|
|
284
|
+
const start = lineOf(sourceText, m.index ?? 0);
|
|
285
|
+
const end = (m.index ?? 0) + m[0].length;
|
|
286
|
+
const windowText = sourceText.slice(end, end + 400);
|
|
287
|
+
let method = "GET";
|
|
288
|
+
const chain = JAVA_OKHTTP_METHOD_CHAIN.exec(windowText);
|
|
289
|
+
// Reset lastIndex so subsequent iterations of the outer loop aren't
|
|
290
|
+
// skewed by the inner regex state.
|
|
291
|
+
JAVA_OKHTTP_METHOD_CHAIN.lastIndex = 0;
|
|
292
|
+
if (chain !== null) {
|
|
293
|
+
const parsed = matchMethodString(chain[1]);
|
|
294
|
+
if (parsed !== undefined)
|
|
295
|
+
method = parsed;
|
|
296
|
+
}
|
|
297
|
+
out.push({
|
|
298
|
+
method,
|
|
299
|
+
urlTemplate: normalizeUrlTemplate(url),
|
|
300
|
+
startLine: start,
|
|
301
|
+
endLine: start,
|
|
302
|
+
clientLibrary: "okhttp",
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
return sortHttpCalls(out);
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=http-detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-detect.js","sourceRoot":"","sources":["../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iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAW,CAAC,CAAC;YACrD,IAAI,MAAM,KAAK,SAAS;gBAAE,MAAM,GAAG,MAAM,CAAC;QAC5C,CAAC;QACD,GAAG,CAAC,IAAI,CAAC;YACP,MAAM;YACN,WAAW,EAAE,oBAAoB,CAAC,GAAG,CAAC;YACtC,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,QAAQ;SACxB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel exports for the providers subsystem.
|
|
3
|
+
*
|
|
4
|
+
* Shape:
|
|
5
|
+
* - `types` — `LanguageId`, `LanguageProvider`, MRO-strategy names.
|
|
6
|
+
* - `registry` — compile-time exhaustive provider table.
|
|
7
|
+
* - per-language providers — fully implemented across all 15 language IDs.
|
|
8
|
+
* - `resolution/*` — three-tier resolver + MRO strategy registry.
|
|
9
|
+
*/
|
|
10
|
+
export { cProvider } from "./c.js";
|
|
11
|
+
export { cppProvider } from "./cpp.js";
|
|
12
|
+
export { csharpProvider } from "./csharp.js";
|
|
13
|
+
export { dartProvider } from "./dart.js";
|
|
14
|
+
export type { ExtractedCall, ExtractedDefinition, ExtractedHeritage, ExtractedImport, ImportKind, } from "./extraction-types.js";
|
|
15
|
+
export { goProvider } from "./go.js";
|
|
16
|
+
export { javaProvider } from "./java.js";
|
|
17
|
+
export { javascriptProvider } from "./javascript.js";
|
|
18
|
+
export { kotlinProvider } from "./kotlin.js";
|
|
19
|
+
export { phpProvider } from "./php.js";
|
|
20
|
+
export { pythonProvider } from "./python.js";
|
|
21
|
+
export { getProvider, listProviders } from "./registry.js";
|
|
22
|
+
export { c3Strategy, MroConflictError } from "./resolution/c3.js";
|
|
23
|
+
export type { ResolutionCandidate, ResolutionQuery, ResolutionTier, SymbolIndex, } from "./resolution/context.js";
|
|
24
|
+
export { CONFIDENCE_BY_TIER, resolve } from "./resolution/context.js";
|
|
25
|
+
export { firstWinsStrategy } from "./resolution/first-wins.js";
|
|
26
|
+
export type { MroStrategy } from "./resolution/mro.js";
|
|
27
|
+
export { getMroStrategy } from "./resolution/mro.js";
|
|
28
|
+
export { noneStrategy } from "./resolution/none.js";
|
|
29
|
+
export type { ResolverStrategy } from "./resolution/resolver-strategy.js";
|
|
30
|
+
export { defaultResolver } from "./resolution/resolver-strategy.js";
|
|
31
|
+
export { singleInheritanceStrategy } from "./resolution/single-inheritance.js";
|
|
32
|
+
export { rubyProvider } from "./ruby.js";
|
|
33
|
+
export { rustProvider } from "./rust.js";
|
|
34
|
+
export { swiftProvider } from "./swift.js";
|
|
35
|
+
export { tsxProvider } from "./tsx.js";
|
|
36
|
+
export type { DetectOutboundHttpInput, ExtractCallsInput, ExtractDefinitionsInput, ExtractHeritageInput, ExtractImportsInput, HttpCall, ImportSemantics, LanguageId, LanguageProvider, MroStrategyName, TypeExtractionConfig, } from "./types.js";
|
|
37
|
+
export { typescriptProvider } from "./typescript.js";
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;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,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel exports for the providers subsystem.
|
|
3
|
+
*
|
|
4
|
+
* Shape:
|
|
5
|
+
* - `types` — `LanguageId`, `LanguageProvider`, MRO-strategy names.
|
|
6
|
+
* - `registry` — compile-time exhaustive provider table.
|
|
7
|
+
* - per-language providers — fully implemented across all 15 language IDs.
|
|
8
|
+
* - `resolution/*` — three-tier resolver + MRO strategy registry.
|
|
9
|
+
*/
|
|
10
|
+
export { cProvider } from "./c.js";
|
|
11
|
+
export { cppProvider } from "./cpp.js";
|
|
12
|
+
export { csharpProvider } from "./csharp.js";
|
|
13
|
+
export { dartProvider } from "./dart.js";
|
|
14
|
+
export { goProvider } from "./go.js";
|
|
15
|
+
export { javaProvider } from "./java.js";
|
|
16
|
+
export { javascriptProvider } from "./javascript.js";
|
|
17
|
+
export { kotlinProvider } from "./kotlin.js";
|
|
18
|
+
export { phpProvider } from "./php.js";
|
|
19
|
+
export { pythonProvider } from "./python.js";
|
|
20
|
+
export { getProvider, listProviders } from "./registry.js";
|
|
21
|
+
export { c3Strategy, MroConflictError } from "./resolution/c3.js";
|
|
22
|
+
export { CONFIDENCE_BY_TIER, resolve } from "./resolution/context.js";
|
|
23
|
+
export { firstWinsStrategy } from "./resolution/first-wins.js";
|
|
24
|
+
export { getMroStrategy } from "./resolution/mro.js";
|
|
25
|
+
export { noneStrategy } from "./resolution/none.js";
|
|
26
|
+
export { defaultResolver } from "./resolution/resolver-strategy.js";
|
|
27
|
+
export { singleInheritanceStrategy } from "./resolution/single-inheritance.js";
|
|
28
|
+
export { rubyProvider } from "./ruby.js";
|
|
29
|
+
export { rustProvider } from "./rust.js";
|
|
30
|
+
export { swiftProvider } from "./swift.js";
|
|
31
|
+
export { tsxProvider } from "./tsx.js";
|
|
32
|
+
export { typescriptProvider } from "./typescript.js";
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@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,MAAM,UAAU,CAAC;AAcvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"java.d.ts","sourceRoot":"","sources":["../../src/providers/java.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAKV,gBAAgB,EACjB,MAAM,YAAY,CAAC;AA4NpB,eAAO,MAAM,YAAY,EAAE,gBAuD1B,CAAC"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { getLine, innermostEnclosingDef, isInside, pairDefinitionsWithNames, stripComments, } from "./extract-helpers.js";
|
|
2
|
+
import { detectHttpCallsJava } from "./http-detect.js";
|
|
3
|
+
/**
|
|
4
|
+
* Java provider.
|
|
5
|
+
*
|
|
6
|
+
* Kind mapping: Java's query flattens `class_declaration`, `enum_declaration`,
|
|
7
|
+
* and `record_declaration` onto `@definition.class`. We distinguish by the
|
|
8
|
+
* underlying `nodeType` so the graph carries accurate kinds.
|
|
9
|
+
*
|
|
10
|
+
* Exports: `public` modifier on the declaration line. Everything else is
|
|
11
|
+
* package-private / private / protected — not exported for the graph.
|
|
12
|
+
*/
|
|
13
|
+
function mapJavaDefKind(def) {
|
|
14
|
+
if (def.tag === "definition.class") {
|
|
15
|
+
switch (def.nodeType) {
|
|
16
|
+
case "class_declaration":
|
|
17
|
+
return "Class";
|
|
18
|
+
case "enum_declaration":
|
|
19
|
+
return "Enum";
|
|
20
|
+
case "record_declaration":
|
|
21
|
+
return "Record";
|
|
22
|
+
default:
|
|
23
|
+
return "Class";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (def.tag === "definition.interface")
|
|
27
|
+
return "Interface";
|
|
28
|
+
if (def.tag === "definition.method") {
|
|
29
|
+
return def.nodeType === "constructor_declaration" ? "Constructor" : "Method";
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
function extractJavaDefinitions(input) {
|
|
34
|
+
const { filePath, captures, sourceText } = input;
|
|
35
|
+
const paired = pairDefinitionsWithNames(captures);
|
|
36
|
+
const defCaptures = captures.filter((c) => c.tag.startsWith("definition."));
|
|
37
|
+
const out = [];
|
|
38
|
+
for (const { def, name } of paired) {
|
|
39
|
+
const kind = mapJavaDefKind(def);
|
|
40
|
+
if (kind === undefined)
|
|
41
|
+
continue;
|
|
42
|
+
let owner;
|
|
43
|
+
const ownerDef = innermostEnclosingDef(def, defCaptures);
|
|
44
|
+
if (ownerDef !== undefined) {
|
|
45
|
+
const ownerPaired = paired.find((p) => p.def === ownerDef);
|
|
46
|
+
if (ownerPaired !== undefined)
|
|
47
|
+
owner = ownerPaired.name.text;
|
|
48
|
+
}
|
|
49
|
+
const qualifiedName = owner !== undefined ? `${owner}.${name.text}` : name.text;
|
|
50
|
+
const headerLine = getLine(sourceText, def.startLine);
|
|
51
|
+
const isExported = /\bpublic\b/.test(headerLine);
|
|
52
|
+
const rec = {
|
|
53
|
+
kind,
|
|
54
|
+
name: name.text,
|
|
55
|
+
qualifiedName,
|
|
56
|
+
filePath,
|
|
57
|
+
startLine: def.startLine,
|
|
58
|
+
endLine: def.endLine,
|
|
59
|
+
isExported,
|
|
60
|
+
...(owner !== undefined ? { owner } : {}),
|
|
61
|
+
};
|
|
62
|
+
out.push(rec);
|
|
63
|
+
}
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
function extractJavaCalls(input) {
|
|
67
|
+
const { filePath, captures, definitions } = input;
|
|
68
|
+
const defCaptures = captures.filter((c) => c.tag.startsWith("definition."));
|
|
69
|
+
const callRefs = captures.filter((c) => c.tag === "reference.call");
|
|
70
|
+
const out = [];
|
|
71
|
+
for (const ref of callRefs) {
|
|
72
|
+
const innerName = findNameInside(captures, ref);
|
|
73
|
+
const calleeName = innerName?.text ?? ref.text;
|
|
74
|
+
const enclosingDef = innermostEnclosingDef(ref, defCaptures);
|
|
75
|
+
const callerQualifiedName = enclosingDef
|
|
76
|
+
? qualifiedForCapture(enclosingDef, definitions)
|
|
77
|
+
: "<module>";
|
|
78
|
+
// Java call receiver: `foo()`, `this.foo()`, `obj.foo()`, `Class.foo()`.
|
|
79
|
+
// The `@reference.call` capture only covers `method_invocation`'s name
|
|
80
|
+
// child in our query, so `ref.text` is just the bare method name. We
|
|
81
|
+
// fall back to reading the source line and slicing before the name.
|
|
82
|
+
// As a MVP-level approximation, we leave receiver undefined here —
|
|
83
|
+
// downstream type resolution is the authoritative source.
|
|
84
|
+
let receiver;
|
|
85
|
+
if (innerName !== undefined && ref.text.includes(".")) {
|
|
86
|
+
const idx = ref.text.lastIndexOf(`.${innerName.text}`);
|
|
87
|
+
if (idx > 0) {
|
|
88
|
+
const prefix = ref.text.slice(0, idx).trim();
|
|
89
|
+
if (prefix !== "")
|
|
90
|
+
receiver = prefix;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
out.push({
|
|
94
|
+
callerQualifiedName,
|
|
95
|
+
calleeName,
|
|
96
|
+
filePath,
|
|
97
|
+
startLine: ref.startLine,
|
|
98
|
+
...(receiver !== undefined ? { calleeOwner: receiver } : {}),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
function findNameInside(captures, outer) {
|
|
104
|
+
let best;
|
|
105
|
+
for (const c of captures) {
|
|
106
|
+
if (c.tag !== "name")
|
|
107
|
+
continue;
|
|
108
|
+
if (!isInside(c, outer))
|
|
109
|
+
continue;
|
|
110
|
+
if (best === undefined || c.startLine < best.startLine)
|
|
111
|
+
best = c;
|
|
112
|
+
}
|
|
113
|
+
return best;
|
|
114
|
+
}
|
|
115
|
+
function qualifiedForCapture(def, definitions) {
|
|
116
|
+
for (const d of definitions) {
|
|
117
|
+
if (d.startLine === def.startLine)
|
|
118
|
+
return d.qualifiedName;
|
|
119
|
+
}
|
|
120
|
+
return "<module>";
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Parse Java imports:
|
|
124
|
+
* `import pkg.Class;` (named)
|
|
125
|
+
* `import pkg.*;` (package-wildcard)
|
|
126
|
+
* `import static pkg.X.m;` (named, static)
|
|
127
|
+
* `import static pkg.X.*;` (package-wildcard, static)
|
|
128
|
+
*/
|
|
129
|
+
function extractJavaImports(input) {
|
|
130
|
+
const { filePath, sourceText } = input;
|
|
131
|
+
const stripped = stripComments(sourceText);
|
|
132
|
+
const out = [];
|
|
133
|
+
const importRe = /^\s*import\s+(static\s+)?([^;]+);\s*$/gm;
|
|
134
|
+
for (const m of stripped.matchAll(importRe)) {
|
|
135
|
+
const body = m[2].trim();
|
|
136
|
+
if (body.endsWith(".*")) {
|
|
137
|
+
const source = body.slice(0, -2);
|
|
138
|
+
out.push({ filePath, source, kind: "package-wildcard", isWildcard: true });
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const parts = body.split(".");
|
|
142
|
+
if (parts.length < 2)
|
|
143
|
+
continue;
|
|
144
|
+
const last = parts[parts.length - 1];
|
|
145
|
+
const source = parts.slice(0, -1).join(".");
|
|
146
|
+
out.push({ filePath, source, kind: "named", importedNames: [last] });
|
|
147
|
+
}
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
function extractJavaHeritage(input) {
|
|
151
|
+
const { filePath, captures, definitions } = input;
|
|
152
|
+
const out = [];
|
|
153
|
+
// The unified query emits:
|
|
154
|
+
// `(superclass (type_identifier) @name @reference.class)` — single parent
|
|
155
|
+
// `(super_interfaces (type_list (type_identifier) @name @reference.implementation))`
|
|
156
|
+
// Map each ref to its enclosing class/interface definition.
|
|
157
|
+
const classRefs = captures.filter((c) => c.tag === "reference.class");
|
|
158
|
+
const implRefs = captures.filter((c) => c.tag === "reference.implementation");
|
|
159
|
+
for (const ref of classRefs) {
|
|
160
|
+
const child = findChildDef(ref, definitions);
|
|
161
|
+
if (child === undefined)
|
|
162
|
+
continue;
|
|
163
|
+
// Guard against `reference.class` captures that come from
|
|
164
|
+
// `object_creation_expression` (`new Foo()`) rather than `superclass`.
|
|
165
|
+
// Those are call-site-like and would appear outside the declaration
|
|
166
|
+
// header. Keep only refs that lie on the child's header line.
|
|
167
|
+
if (ref.startLine !== child.startLine)
|
|
168
|
+
continue;
|
|
169
|
+
out.push({
|
|
170
|
+
childQualifiedName: child.qualifiedName,
|
|
171
|
+
parentName: ref.text,
|
|
172
|
+
filePath,
|
|
173
|
+
relation: "EXTENDS",
|
|
174
|
+
startLine: ref.startLine,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
for (const ref of implRefs) {
|
|
178
|
+
const child = findChildDef(ref, definitions);
|
|
179
|
+
if (child === undefined)
|
|
180
|
+
continue;
|
|
181
|
+
out.push({
|
|
182
|
+
childQualifiedName: child.qualifiedName,
|
|
183
|
+
parentName: ref.text,
|
|
184
|
+
filePath,
|
|
185
|
+
relation: "IMPLEMENTS",
|
|
186
|
+
startLine: ref.startLine,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
function findChildDef(ref, definitions) {
|
|
192
|
+
let best;
|
|
193
|
+
for (const d of definitions) {
|
|
194
|
+
if (d.kind !== "Class" && d.kind !== "Interface" && d.kind !== "Enum" && d.kind !== "Record") {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (ref.startLine < d.startLine || ref.endLine > d.endLine)
|
|
198
|
+
continue;
|
|
199
|
+
if (best === undefined || d.startLine > best.startLine)
|
|
200
|
+
best = d;
|
|
201
|
+
}
|
|
202
|
+
return best;
|
|
203
|
+
}
|
|
204
|
+
export const javaProvider = {
|
|
205
|
+
id: "java",
|
|
206
|
+
extensions: [".java"],
|
|
207
|
+
importSemantics: "named",
|
|
208
|
+
mroStrategy: "single-inheritance",
|
|
209
|
+
typeConfig: { structural: false, nominal: true, generics: true },
|
|
210
|
+
heritageEdge: "EXTENDS",
|
|
211
|
+
inferImplicitReceiver: () => "this",
|
|
212
|
+
isExportedIdentifier: (_name, context) => context === "top-level",
|
|
213
|
+
complexityDefinitionKinds: ["method_declaration", "constructor_declaration", "lambda_expression"],
|
|
214
|
+
halsteadOperatorKinds: [
|
|
215
|
+
"+",
|
|
216
|
+
"-",
|
|
217
|
+
"*",
|
|
218
|
+
"/",
|
|
219
|
+
"%",
|
|
220
|
+
"=",
|
|
221
|
+
"==",
|
|
222
|
+
"!=",
|
|
223
|
+
"<",
|
|
224
|
+
">",
|
|
225
|
+
"<=",
|
|
226
|
+
">=",
|
|
227
|
+
"&&",
|
|
228
|
+
"||",
|
|
229
|
+
"!",
|
|
230
|
+
"&",
|
|
231
|
+
"|",
|
|
232
|
+
"^",
|
|
233
|
+
"~",
|
|
234
|
+
"<<",
|
|
235
|
+
">>",
|
|
236
|
+
">>>",
|
|
237
|
+
"+=",
|
|
238
|
+
"-=",
|
|
239
|
+
"*=",
|
|
240
|
+
"/=",
|
|
241
|
+
"%=",
|
|
242
|
+
"&=",
|
|
243
|
+
"|=",
|
|
244
|
+
"^=",
|
|
245
|
+
"<<=",
|
|
246
|
+
">>=",
|
|
247
|
+
"?",
|
|
248
|
+
":",
|
|
249
|
+
"->",
|
|
250
|
+
"instanceof",
|
|
251
|
+
],
|
|
252
|
+
extractDefinitions: extractJavaDefinitions,
|
|
253
|
+
extractCalls: extractJavaCalls,
|
|
254
|
+
extractImports: extractJavaImports,
|
|
255
|
+
isExported: (def) => def.isExported,
|
|
256
|
+
extractHeritage: extractJavaHeritage,
|
|
257
|
+
detectOutboundHttp: ({ sourceText }) => detectHttpCallsJava(sourceText),
|
|
258
|
+
};
|
|
259
|
+
//# sourceMappingURL=java.js.map
|