@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,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy grammar loader.
|
|
3
|
+
*
|
|
4
|
+
* Imports the native tree-sitter grammar modules on demand — the first call
|
|
5
|
+
* to `loadGrammar('python')` pulls in `tree-sitter-python`, subsequent calls
|
|
6
|
+
* hit the in-process cache. This keeps the cold-start cost of the parse
|
|
7
|
+
* subsystem low: importing `grammar-registry` alone does not load any grammar
|
|
8
|
+
* `.node` file.
|
|
9
|
+
*
|
|
10
|
+
* Each grammar package exposes its tree-sitter `Language` object differently:
|
|
11
|
+
* - typescript: module has `.typescript` and `.tsx` properties
|
|
12
|
+
* - javascript/python/go/go/java/rust: module IS the Language
|
|
13
|
+
* - c-sharp: ESM default export IS the Language
|
|
14
|
+
* - c, cpp, ruby, kotlin, swift: module IS the Language (CJS require)
|
|
15
|
+
* - php: module has `.php` and `.php_only` — we load `.php_only` (pure PHP,
|
|
16
|
+
* no HTML template injection; better for static analysis)
|
|
17
|
+
* - dart: git-pinned CJS module that IS the Language
|
|
18
|
+
*
|
|
19
|
+
* This module abstracts those differences behind {@link loadGrammar}.
|
|
20
|
+
*
|
|
21
|
+
* ## Regex-provider escape hatch
|
|
22
|
+
*
|
|
23
|
+
* Some languages — COBOL is the first — have no maintained tree-sitter
|
|
24
|
+
* grammar and ship via a pure-regex extractor instead. The registry encodes
|
|
25
|
+
* that split with a {@link LanguageProviderSpec} discriminated union:
|
|
26
|
+
*
|
|
27
|
+
* - `{ kind: "tree-sitter", package: string }` — the classic path; the
|
|
28
|
+
* grammar package is resolved lazily from npm and hashed into the
|
|
29
|
+
* parse-cache key via {@link getGrammarSha}.
|
|
30
|
+
* - `{ kind: "regex" }` — the escape hatch; {@link loadGrammar} refuses
|
|
31
|
+
* to build a `GrammarHandle`, {@link getGrammarSha} returns `null`
|
|
32
|
+
* (disables parse-cache keying), and upstream parse-phase code is
|
|
33
|
+
* expected to route the file through the language-specific regex
|
|
34
|
+
* extractor instead of the worker pool.
|
|
35
|
+
*
|
|
36
|
+
* This keeps every tree-sitter consumer of the registry working unchanged
|
|
37
|
+
* while giving downstream code a typed way to detect regex-only languages.
|
|
38
|
+
*/
|
|
39
|
+
import { createRequire } from "node:module";
|
|
40
|
+
import { sha256Hex } from "@opencodehub/core-types";
|
|
41
|
+
import { getUnifiedQuery } from "./unified-queries.js";
|
|
42
|
+
const requireFn = createRequire(import.meta.url);
|
|
43
|
+
/**
|
|
44
|
+
* Per-language provider spec. `satisfies Record<LanguageId, …>` keeps this
|
|
45
|
+
* 1:1 with the `LanguageId` union at compile time — adding a new language
|
|
46
|
+
* without an entry here fails the type check.
|
|
47
|
+
*
|
|
48
|
+
* Tree-sitter entries carry the npm grammar package name. The content-
|
|
49
|
+
* addressed parse cache hashes `{ name, version }` from that package's
|
|
50
|
+
* `package.json`, so a grammar version bump in the workspace lockfile
|
|
51
|
+
* invalidates the cache cleanly.
|
|
52
|
+
*
|
|
53
|
+
* Regex entries (currently only `cobol`) carry no package reference —
|
|
54
|
+
* {@link loadGrammar} and {@link getGrammarSha} treat them as a marker
|
|
55
|
+
* that the caller must dispatch through the language's regex extractor.
|
|
56
|
+
*/
|
|
57
|
+
const LANGUAGE_PROVIDERS = {
|
|
58
|
+
typescript: { kind: "tree-sitter", package: "tree-sitter-typescript" },
|
|
59
|
+
tsx: { kind: "tree-sitter", package: "tree-sitter-typescript" },
|
|
60
|
+
javascript: { kind: "tree-sitter", package: "tree-sitter-javascript" },
|
|
61
|
+
python: { kind: "tree-sitter", package: "tree-sitter-python" },
|
|
62
|
+
go: { kind: "tree-sitter", package: "tree-sitter-go" },
|
|
63
|
+
rust: { kind: "tree-sitter", package: "tree-sitter-rust" },
|
|
64
|
+
java: { kind: "tree-sitter", package: "tree-sitter-java" },
|
|
65
|
+
csharp: { kind: "tree-sitter", package: "tree-sitter-c-sharp" },
|
|
66
|
+
c: { kind: "tree-sitter", package: "tree-sitter-c" },
|
|
67
|
+
cpp: { kind: "tree-sitter", package: "tree-sitter-cpp" },
|
|
68
|
+
ruby: { kind: "tree-sitter", package: "tree-sitter-ruby" },
|
|
69
|
+
kotlin: { kind: "tree-sitter", package: "tree-sitter-kotlin" },
|
|
70
|
+
swift: { kind: "tree-sitter", package: "tree-sitter-swift" },
|
|
71
|
+
php: { kind: "tree-sitter", package: "tree-sitter-php" },
|
|
72
|
+
dart: { kind: "tree-sitter", package: "tree-sitter-dart" },
|
|
73
|
+
// COBOL ships via the regex hot path (see `parse/cobol-regex.ts`).
|
|
74
|
+
cobol: { kind: "regex" },
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Narrow a language's provider spec to its discriminated union. Exported so
|
|
78
|
+
* upstream parse-phase code can branch on the provider kind without
|
|
79
|
+
* re-implementing the registry lookup. Typical use:
|
|
80
|
+
* `getLanguageProvider(lang).kind === "regex"` to guard the regex-dispatch
|
|
81
|
+
* path.
|
|
82
|
+
*/
|
|
83
|
+
export function getLanguageProvider(lang) {
|
|
84
|
+
return LANGUAGE_PROVIDERS[lang];
|
|
85
|
+
}
|
|
86
|
+
/** `true` iff `lang` ships via the regex hot path rather than tree-sitter. */
|
|
87
|
+
export function isRegexProviderLanguage(lang) {
|
|
88
|
+
return LANGUAGE_PROVIDERS[lang].kind === "regex";
|
|
89
|
+
}
|
|
90
|
+
const cache = new Map();
|
|
91
|
+
// De-dupe concurrent calls for the same language so we only require() once.
|
|
92
|
+
const inflight = new Map();
|
|
93
|
+
// Per-process memoization of grammar SHAs — the value is stable for the
|
|
94
|
+
// lifetime of the process (resolving + hashing a package.json is cheap but
|
|
95
|
+
// not free, and scan() calls this per-file).
|
|
96
|
+
const grammarShaCache = new Map();
|
|
97
|
+
/**
|
|
98
|
+
* Load and cache the tree-sitter grammar for a language.
|
|
99
|
+
*
|
|
100
|
+
* Thread/context note: the cache is per-module-instance, so in the
|
|
101
|
+
* piscina worker model each worker has its own cache — which matches
|
|
102
|
+
* tree-sitter's thread-safety rules (one Parser per worker_thread).
|
|
103
|
+
*
|
|
104
|
+
* Regex-provider languages (see {@link isRegexProviderLanguage}) throw
|
|
105
|
+
* on entry: they have no tree-sitter grammar to load, and reaching this
|
|
106
|
+
* function means the caller skipped the `kind === "regex"` dispatch
|
|
107
|
+
* guard. That is a bug on the call site, not a runtime condition to
|
|
108
|
+
* recover from.
|
|
109
|
+
*/
|
|
110
|
+
export async function loadGrammar(lang) {
|
|
111
|
+
const spec = LANGUAGE_PROVIDERS[lang];
|
|
112
|
+
if (spec.kind === "regex") {
|
|
113
|
+
throw new Error(`loadGrammar: ${lang} is a regex-provider language and has no tree-sitter grammar; ` +
|
|
114
|
+
`route the file through the language's regex extractor instead.`);
|
|
115
|
+
}
|
|
116
|
+
const cached = cache.get(lang);
|
|
117
|
+
if (cached !== undefined) {
|
|
118
|
+
return cached;
|
|
119
|
+
}
|
|
120
|
+
const existing = inflight.get(lang);
|
|
121
|
+
if (existing !== undefined) {
|
|
122
|
+
return existing;
|
|
123
|
+
}
|
|
124
|
+
const p = doLoad(lang).then((handle) => {
|
|
125
|
+
cache.set(lang, handle);
|
|
126
|
+
inflight.delete(lang);
|
|
127
|
+
return handle;
|
|
128
|
+
});
|
|
129
|
+
inflight.set(lang, p);
|
|
130
|
+
return p;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Preload a list of grammars in parallel. Useful as a warm-up hint during
|
|
134
|
+
* indexing start-up, but not required — {@link loadGrammar} is safe to call
|
|
135
|
+
* lazily during parsing.
|
|
136
|
+
*/
|
|
137
|
+
export async function preloadGrammars(langs) {
|
|
138
|
+
await Promise.all(langs.map((l) => loadGrammar(l)));
|
|
139
|
+
}
|
|
140
|
+
async function doLoad(lang) {
|
|
141
|
+
const tsLanguage = await loadLanguageObject(lang);
|
|
142
|
+
return {
|
|
143
|
+
language: lang,
|
|
144
|
+
tsLanguage,
|
|
145
|
+
queryText: getUnifiedQuery(lang),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Resolve the Language object for each grammar, handling per-package quirks.
|
|
150
|
+
* Returned value is passed straight into `parser.setLanguage()`.
|
|
151
|
+
*/
|
|
152
|
+
async function loadLanguageObject(lang) {
|
|
153
|
+
switch (lang) {
|
|
154
|
+
case "typescript": {
|
|
155
|
+
const mod = requireFn("tree-sitter-typescript");
|
|
156
|
+
return mod.typescript;
|
|
157
|
+
}
|
|
158
|
+
case "tsx": {
|
|
159
|
+
const mod = requireFn("tree-sitter-typescript");
|
|
160
|
+
return mod.tsx;
|
|
161
|
+
}
|
|
162
|
+
case "javascript":
|
|
163
|
+
return requireFn("tree-sitter-javascript");
|
|
164
|
+
case "python":
|
|
165
|
+
return requireFn("tree-sitter-python");
|
|
166
|
+
case "go":
|
|
167
|
+
return requireFn("tree-sitter-go");
|
|
168
|
+
case "rust":
|
|
169
|
+
return requireFn("tree-sitter-rust");
|
|
170
|
+
case "java":
|
|
171
|
+
return requireFn("tree-sitter-java");
|
|
172
|
+
case "csharp": {
|
|
173
|
+
// tree-sitter-c-sharp is ESM-only; use dynamic import. The default
|
|
174
|
+
// export is the Language binding.
|
|
175
|
+
const mod = (await import("tree-sitter-c-sharp"));
|
|
176
|
+
return mod.default;
|
|
177
|
+
}
|
|
178
|
+
case "c":
|
|
179
|
+
// tree-sitter-c 0.24.1 — canonical tree-sitter-org CJS grammar, ships
|
|
180
|
+
// prebuilds for 6 platforms. Module IS the Language.
|
|
181
|
+
return requireFn("tree-sitter-c");
|
|
182
|
+
case "cpp":
|
|
183
|
+
// tree-sitter-cpp 0.23.4 — extends tree-sitter-c; prebuilds shipped.
|
|
184
|
+
return requireFn("tree-sitter-cpp");
|
|
185
|
+
case "ruby":
|
|
186
|
+
// tree-sitter-ruby 0.23.1 — prebuilds shipped. Module IS the Language.
|
|
187
|
+
return requireFn("tree-sitter-ruby");
|
|
188
|
+
case "kotlin":
|
|
189
|
+
// tree-sitter-kotlin 0.3.8 (fwcd) — NO prebuilds on npm; install-time
|
|
190
|
+
// node-gyp build is expected. If the native binary is missing on an
|
|
191
|
+
// exotic platform, require() throws and callers surface the error.
|
|
192
|
+
return requireFn("tree-sitter-kotlin");
|
|
193
|
+
case "swift":
|
|
194
|
+
// tree-sitter-swift 0.7.1 (alex-pinkus) — ships prebuilds but also has
|
|
195
|
+
// a postinstall rebuild (~30s one-time). Runtime-transparent.
|
|
196
|
+
return requireFn("tree-sitter-swift");
|
|
197
|
+
case "php": {
|
|
198
|
+
// tree-sitter-php 0.24.2 ships TWO grammars in one package:
|
|
199
|
+
// - `.php`: pure PHP with HTML injection (for .blade.php, .phtml etc.)
|
|
200
|
+
// - `.php_only`: pure PHP without HTML injection
|
|
201
|
+
// We load `.php_only` — static analysis cares about PHP code, not HTML.
|
|
202
|
+
const mod = requireFn("tree-sitter-php");
|
|
203
|
+
return mod.php_only;
|
|
204
|
+
}
|
|
205
|
+
case "dart":
|
|
206
|
+
// tree-sitter-dart git-pinned to UserNobody14/tree-sitter-dart SHA
|
|
207
|
+
// 0fc19c3a (2026-03-14). npm registry 1.0.0 is 3 years stale; we pin
|
|
208
|
+
// via the `git+https://…#sha` URL in package.json. Module IS the
|
|
209
|
+
// Language (CJS, uses legacy `nan` addon API).
|
|
210
|
+
return requireFn("tree-sitter-dart");
|
|
211
|
+
case "cobol":
|
|
212
|
+
// Guarded at the `loadGrammar` entry point via the provider-kind
|
|
213
|
+
// discriminator; a direct call to `loadLanguageObject("cobol")`
|
|
214
|
+
// indicates a caller bypassed that guard. Keep the branch so
|
|
215
|
+
// TypeScript's exhaustiveness check passes.
|
|
216
|
+
throw new Error("loadLanguageObject: cobol is a regex-provider language (no tree-sitter grammar)");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Compute a stable SHA for the grammar backing `lang`. The SHA is derived
|
|
221
|
+
* from `sha256(JSON.stringify({ name, version }))` of the grammar's
|
|
222
|
+
* `package.json` — bumping the grammar version in the workspace therefore
|
|
223
|
+
* produces a new SHA, which is what the content-addressed parse cache
|
|
224
|
+
* needs in its composite key.
|
|
225
|
+
*
|
|
226
|
+
* Returns `null` when:
|
|
227
|
+
* - the grammar package is not installed (e.g. languages whose provider
|
|
228
|
+
* track has not landed yet), OR
|
|
229
|
+
* - the package.json could not be read/parsed.
|
|
230
|
+
*
|
|
231
|
+
* Result is memoized per-process. Idempotent across concurrent callers.
|
|
232
|
+
*/
|
|
233
|
+
export async function getGrammarSha(lang) {
|
|
234
|
+
if (grammarShaCache.has(lang)) {
|
|
235
|
+
return grammarShaCache.get(lang) ?? null;
|
|
236
|
+
}
|
|
237
|
+
const spec = LANGUAGE_PROVIDERS[lang];
|
|
238
|
+
// Regex-provider languages have no npm grammar to fingerprint, so
|
|
239
|
+
// parse-cache keying is disabled for those files (cache writes / reads
|
|
240
|
+
// treat `null` as "uncacheable").
|
|
241
|
+
const sha = spec.kind === "regex" ? null : await computeGrammarSha(spec.package);
|
|
242
|
+
grammarShaCache.set(lang, sha);
|
|
243
|
+
return sha;
|
|
244
|
+
}
|
|
245
|
+
async function computeGrammarSha(pkgName) {
|
|
246
|
+
// `require.resolve('<pkg>/package.json')` returns the absolute path of the
|
|
247
|
+
// package's manifest without executing any of its bindings — safe to call
|
|
248
|
+
// even for grammars that fail to build natively at install time.
|
|
249
|
+
let manifestPath;
|
|
250
|
+
try {
|
|
251
|
+
manifestPath = requireFn.resolve(`${pkgName}/package.json`);
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
let manifest;
|
|
257
|
+
try {
|
|
258
|
+
const { readFile } = await import("node:fs/promises");
|
|
259
|
+
const text = await readFile(manifestPath, "utf8");
|
|
260
|
+
manifest = JSON.parse(text);
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
const name = typeof manifest.name === "string" ? manifest.name : pkgName;
|
|
266
|
+
const version = typeof manifest.version === "string" ? manifest.version : "";
|
|
267
|
+
if (version === "")
|
|
268
|
+
return null;
|
|
269
|
+
// Canonical JSON-like form so the SHA does not depend on object key order.
|
|
270
|
+
return sha256Hex(JSON.stringify({ name, version }));
|
|
271
|
+
}
|
|
272
|
+
/** For tests: drop the cache so the next load() re-imports fresh. */
|
|
273
|
+
export function _resetGrammarCacheForTests() {
|
|
274
|
+
cache.clear();
|
|
275
|
+
inflight.clear();
|
|
276
|
+
grammarShaCache.clear();
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=grammar-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grammar-registry.js","sourceRoot":"","sources":["../../src/parse/grammar-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAoBjD;;;;;;;;;;;;;GAaG;AACH,MAAM,kBAAkB,GAAG;IACzB,UAAU,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,EAAE;QAAE,OAAO,IAAI,CAAC;IAChC,2EAA2E;IAC3E,OAAO,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,0BAA0B;IACxC,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,eAAe,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel exports for the parse subsystem.
|
|
3
|
+
*/
|
|
4
|
+
export type { CobolElement, CobolElementKind, CobolRegexResult } from "./cobol-regex.js";
|
|
5
|
+
export { parseCobolFile } from "./cobol-regex.js";
|
|
6
|
+
export type { GrammarHandle } from "./grammar-registry.js";
|
|
7
|
+
export { _resetGrammarCacheForTests, loadGrammar, preloadGrammars } from "./grammar-registry.js";
|
|
8
|
+
export { detectLanguage } from "./language-detector.js";
|
|
9
|
+
export type { LanguageId, ParseBatch, ParseCapture, ParseResult, ParseTask, } from "./types.js";
|
|
10
|
+
export { getUnifiedQuery } from "./unified-queries.js";
|
|
11
|
+
export { isNativeAvailable, resetNativeAvailabilityCache } from "./wasm-fallback.js";
|
|
12
|
+
export type { DispatchOptions, ParsePoolOptions } from "./worker-pool.js";
|
|
13
|
+
export { chunkTasks, ParsePool } from "./worker-pool.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parse/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACrF,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel exports for the parse subsystem.
|
|
3
|
+
*/
|
|
4
|
+
export { parseCobolFile } from "./cobol-regex.js";
|
|
5
|
+
export { _resetGrammarCacheForTests, loadGrammar, preloadGrammars } from "./grammar-registry.js";
|
|
6
|
+
export { detectLanguage } from "./language-detector.js";
|
|
7
|
+
export { getUnifiedQuery } from "./unified-queries.js";
|
|
8
|
+
export { isNativeAvailable, resetNativeAvailabilityCache } from "./wasm-fallback.js";
|
|
9
|
+
export { chunkTasks, ParsePool } from "./worker-pool.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parse/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAQxD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Language detection from file path + optional first line (shebang).
|
|
3
|
+
*
|
|
4
|
+
* Extension-first, with shebang as a secondary hint for scripts that lack an
|
|
5
|
+
* informative extension. Returns `undefined` when the file is not one of the
|
|
6
|
+
* seven MVP languages — callers skip those files rather than throwing.
|
|
7
|
+
*/
|
|
8
|
+
import type { LanguageId } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Return the language ID for a given file path, or `undefined` if unknown.
|
|
11
|
+
*
|
|
12
|
+
* @param filePath - Path to the file, either absolute or relative.
|
|
13
|
+
* @param firstLineOrNull - Optional first line of the file (without trailing
|
|
14
|
+
* newline); used as a shebang fallback when the extension is missing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function detectLanguage(filePath: string, firstLineOrNull?: string): LanguageId | undefined;
|
|
17
|
+
//# sourceMappingURL=language-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language-detector.d.ts","sourceRoot":"","sources":["../../src/parse/language-detector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAmF7C;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAUjG"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Language detection from file path + optional first line (shebang).
|
|
3
|
+
*
|
|
4
|
+
* Extension-first, with shebang as a secondary hint for scripts that lack an
|
|
5
|
+
* informative extension. Returns `undefined` when the file is not one of the
|
|
6
|
+
* seven MVP languages — callers skip those files rather than throwing.
|
|
7
|
+
*/
|
|
8
|
+
const EXTENSION_MAP = new Map([
|
|
9
|
+
[".ts", "typescript"],
|
|
10
|
+
[".mts", "typescript"],
|
|
11
|
+
[".cts", "typescript"],
|
|
12
|
+
[".tsx", "tsx"],
|
|
13
|
+
[".js", "javascript"],
|
|
14
|
+
[".mjs", "javascript"],
|
|
15
|
+
[".cjs", "javascript"],
|
|
16
|
+
[".jsx", "javascript"],
|
|
17
|
+
[".py", "python"],
|
|
18
|
+
[".pyi", "python"],
|
|
19
|
+
[".go", "go"],
|
|
20
|
+
[".rs", "rust"],
|
|
21
|
+
[".java", "java"],
|
|
22
|
+
[".cs", "csharp"],
|
|
23
|
+
// --- Extended-language additions (C, C++, Ruby, Kotlin, Swift, PHP, Dart) ---
|
|
24
|
+
[".c", "c"],
|
|
25
|
+
// .h is ambiguous between C and C++ headers. We default to C here; a
|
|
26
|
+
// dedicated C++ header detector (scanning the file for `class`, `template`,
|
|
27
|
+
// `namespace`, etc.) can upgrade the classification in a later pass.
|
|
28
|
+
[".h", "c"],
|
|
29
|
+
[".cpp", "cpp"],
|
|
30
|
+
[".cc", "cpp"],
|
|
31
|
+
[".cxx", "cpp"],
|
|
32
|
+
[".hpp", "cpp"],
|
|
33
|
+
[".hh", "cpp"],
|
|
34
|
+
[".hxx", "cpp"],
|
|
35
|
+
[".rb", "ruby"],
|
|
36
|
+
[".kt", "kotlin"],
|
|
37
|
+
[".kts", "kotlin"],
|
|
38
|
+
[".swift", "swift"],
|
|
39
|
+
[".php", "php"],
|
|
40
|
+
[".php3", "php"],
|
|
41
|
+
[".php4", "php"],
|
|
42
|
+
[".php5", "php"],
|
|
43
|
+
[".php7", "php"],
|
|
44
|
+
[".phtml", "php"],
|
|
45
|
+
[".dart", "dart"],
|
|
46
|
+
// --- COBOL (regex hot path; see parse/cobol-regex.ts). Fixed-format .cbl /
|
|
47
|
+
// .cob programs and .cpy copybooks. Free-format COBOL is NOT handled
|
|
48
|
+
// in v1 — the ProLeap deep-parse path will own that AST when wired in. ---
|
|
49
|
+
[".cbl", "cobol"],
|
|
50
|
+
[".cob", "cobol"],
|
|
51
|
+
[".cpy", "cobol"],
|
|
52
|
+
]);
|
|
53
|
+
/**
|
|
54
|
+
* Best-effort shebang parsing for the rare case where extension is missing.
|
|
55
|
+
* Only covers interpreters we care about at MVP.
|
|
56
|
+
*/
|
|
57
|
+
function detectFromShebang(firstLine) {
|
|
58
|
+
if (!firstLine.startsWith("#!")) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const lowered = firstLine.toLowerCase();
|
|
62
|
+
if (lowered.includes("python")) {
|
|
63
|
+
return "python";
|
|
64
|
+
}
|
|
65
|
+
if (lowered.includes("node")) {
|
|
66
|
+
return "javascript";
|
|
67
|
+
}
|
|
68
|
+
// Rust's `cargo script` style shebang
|
|
69
|
+
if (lowered.includes("rust-script") || lowered.includes("cargo")) {
|
|
70
|
+
return "rust";
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
function lastExtension(filePath) {
|
|
75
|
+
// We intentionally take the LAST dot, not the first, so `.d.ts` resolves to
|
|
76
|
+
// `.ts` (a TypeScript declaration file) rather than the middle `d` part.
|
|
77
|
+
const slashIdx = Math.max(filePath.lastIndexOf("/"), filePath.lastIndexOf("\\"));
|
|
78
|
+
const baseName = slashIdx >= 0 ? filePath.slice(slashIdx + 1) : filePath;
|
|
79
|
+
const dotIdx = baseName.lastIndexOf(".");
|
|
80
|
+
if (dotIdx <= 0) {
|
|
81
|
+
// Dotfile without extension (e.g. ".gitignore") or no extension at all.
|
|
82
|
+
return "";
|
|
83
|
+
}
|
|
84
|
+
return baseName.slice(dotIdx).toLowerCase();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Return the language ID for a given file path, or `undefined` if unknown.
|
|
88
|
+
*
|
|
89
|
+
* @param filePath - Path to the file, either absolute or relative.
|
|
90
|
+
* @param firstLineOrNull - Optional first line of the file (without trailing
|
|
91
|
+
* newline); used as a shebang fallback when the extension is missing.
|
|
92
|
+
*/
|
|
93
|
+
export function detectLanguage(filePath, firstLineOrNull) {
|
|
94
|
+
const ext = lastExtension(filePath);
|
|
95
|
+
const byExt = EXTENSION_MAP.get(ext);
|
|
96
|
+
if (byExt !== undefined) {
|
|
97
|
+
return byExt;
|
|
98
|
+
}
|
|
99
|
+
if (firstLineOrNull !== undefined && firstLineOrNull.length > 0) {
|
|
100
|
+
return detectFromShebang(firstLineOrNull);
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=language-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language-detector.js","sourceRoot":"","sources":["../../src/parse/language-detector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,aAAa,GAAoC,IAAI,GAAG,CAAC;IAC7D,CAAC,KAAK,EAAE,YAAY,CAAC;IACrB,CAAC,MAAM,EAAE,YAAY,CAAC;IACtB,CAAC,MAAM,EAAE,YAAY,CAAC;IACtB,CAAC,MAAM,EAAE,KAAK,CAAC;IACf,CAAC,KAAK,EAAE,YAAY,CAAC;IACrB,CAAC,MAAM,EAAE,YAAY,CAAC;IACtB,CAAC,MAAM,EAAE,YAAY,CAAC;IACtB,CAAC,MAAM,EAAE,YAAY,CAAC;IACtB,CAAC,KAAK,EAAE,QAAQ,CAAC;IACjB,CAAC,MAAM,EAAE,QAAQ,CAAC;IAClB,CAAC,KAAK,EAAE,IAAI,CAAC;IACb,CAAC,KAAK,EAAE,MAAM,CAAC;IACf,CAAC,OAAO,EAAE,MAAM,CAAC;IACjB,CAAC,KAAK,EAAE,QAAQ,CAAC;IACjB,+EAA+E;IAC/E,CAAC,IAAI,EAAE,GAAG,CAAC;IACX,qEAAqE;IACrE,4EAA4E;IAC5E,qEAAqE;IACrE,CAAC,IAAI,EAAE,GAAG,CAAC;IACX,CAAC,MAAM,EAAE,KAAK,CAAC;IACf,CAAC,KAA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{@link ParseBatch}
|
|
5
|
+
* inputs on every `pool.run()` call. The worker:
|
|
6
|
+
* 1. Loads the grammar for each task's language (cached in the worker).
|
|
7
|
+
* 2. Builds a `Parser` with that language (cached).
|
|
8
|
+
* 3. Compiles the unified S-expression query (cached).
|
|
9
|
+
* 4. Parses each task's buffer and maps captures to {@link ParseCapture}.
|
|
10
|
+
* 5. Returns a {@link ParseResult} per task.
|
|
11
|
+
*
|
|
12
|
+
* Per-task wall-clock timeout: 30 seconds. On timeout the task returns a
|
|
13
|
+
* result with empty captures and a warning rather than crashing the worker.
|
|
14
|
+
*
|
|
15
|
+
* Safety: tree-sitter parsers are NOT thread-safe; one Parser per worker per
|
|
16
|
+
* language is a hard constraint. This file enforces that via per-worker maps
|
|
17
|
+
* keyed by LanguageId.
|
|
18
|
+
*/
|
|
19
|
+
import type { ParseBatch, ParseResult } from "./types.js";
|
|
20
|
+
/**
|
|
21
|
+
* Piscina task entry. Default export is the function piscina invokes.
|
|
22
|
+
*/
|
|
23
|
+
export default function parseBatch(batch: ParseBatch): Promise<ParseResult[]>;
|
|
24
|
+
//# sourceMappingURL=parse-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-worker.d.ts","sourceRoot":"","sources":["../../src/parse/parse-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,KAAK,EAAc,UAAU,EAAgB,WAAW,EAAa,MAAM,YAAY,CAAC;AAgC/F;;GAEG;AACH,wBAA8B,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CA0BlF"}
|