driftdetect-core 0.7.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boundaries/types.d.ts +1 -1
- package/dist/boundaries/types.d.ts.map +1 -1
- package/dist/call-graph/analysis/graph-builder.d.ts.map +1 -1
- package/dist/call-graph/analysis/graph-builder.js +2 -0
- package/dist/call-graph/analysis/graph-builder.js.map +1 -1
- package/dist/call-graph/extractors/cpp-data-access-extractor.d.ts +37 -0
- package/dist/call-graph/extractors/cpp-data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/cpp-data-access-extractor.js +467 -0
- package/dist/call-graph/extractors/cpp-data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/cpp-hybrid-extractor.d.ts +89 -0
- package/dist/call-graph/extractors/cpp-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/cpp-hybrid-extractor.js +541 -0
- package/dist/call-graph/extractors/cpp-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/index.d.ts +8 -1
- package/dist/call-graph/extractors/index.d.ts.map +1 -1
- package/dist/call-graph/extractors/index.js +9 -1
- package/dist/call-graph/extractors/index.js.map +1 -1
- package/dist/call-graph/extractors/regex/cpp-regex.d.ts +46 -0
- package/dist/call-graph/extractors/regex/cpp-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/cpp-regex.js +325 -0
- package/dist/call-graph/extractors/regex/cpp-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/index.d.ts +2 -0
- package/dist/call-graph/extractors/regex/index.d.ts.map +1 -1
- package/dist/call-graph/extractors/regex/index.js +16 -0
- package/dist/call-graph/extractors/regex/index.js.map +1 -1
- package/dist/call-graph/extractors/regex/rust-regex.d.ts +45 -0
- package/dist/call-graph/extractors/regex/rust-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/rust-regex.js +517 -0
- package/dist/call-graph/extractors/regex/rust-regex.js.map +1 -0
- package/dist/call-graph/extractors/rust-data-access-extractor.d.ts +35 -0
- package/dist/call-graph/extractors/rust-data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/rust-data-access-extractor.js +349 -0
- package/dist/call-graph/extractors/rust-data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/rust-extractor.d.ts +125 -0
- package/dist/call-graph/extractors/rust-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/rust-extractor.js +604 -0
- package/dist/call-graph/extractors/rust-extractor.js.map +1 -0
- package/dist/call-graph/extractors/rust-hybrid-extractor.d.ts +119 -0
- package/dist/call-graph/extractors/rust-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/rust-hybrid-extractor.js +548 -0
- package/dist/call-graph/extractors/rust-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/index.d.ts +2 -0
- package/dist/call-graph/index.d.ts.map +1 -1
- package/dist/call-graph/index.js +4 -0
- package/dist/call-graph/index.js.map +1 -1
- package/dist/call-graph/streaming-builder.d.ts +60 -0
- package/dist/call-graph/streaming-builder.d.ts.map +1 -0
- package/dist/call-graph/streaming-builder.js +204 -0
- package/dist/call-graph/streaming-builder.js.map +1 -0
- package/dist/call-graph/types.d.ts +1 -1
- package/dist/call-graph/types.d.ts.map +1 -1
- package/dist/call-graph/unified-provider.d.ts +72 -0
- package/dist/call-graph/unified-provider.d.ts.map +1 -0
- package/dist/call-graph/unified-provider.js +502 -0
- package/dist/call-graph/unified-provider.js.map +1 -0
- package/dist/constants/extractors/regex/rust-regex.d.ts +43 -0
- package/dist/constants/extractors/regex/rust-regex.d.ts.map +1 -0
- package/dist/constants/extractors/regex/rust-regex.js +370 -0
- package/dist/constants/extractors/regex/rust-regex.js.map +1 -0
- package/dist/constants/types.d.ts +1 -1
- package/dist/constants/types.d.ts.map +1 -1
- package/dist/constants/types.js.map +1 -1
- package/dist/constraints/store/constraint-store.d.ts.map +1 -1
- package/dist/constraints/store/constraint-store.js +2 -0
- package/dist/constraints/store/constraint-store.js.map +1 -1
- package/dist/constraints/types.d.ts +1 -1
- package/dist/constraints/types.d.ts.map +1 -1
- package/dist/constraints/types.js +2 -0
- package/dist/constraints/types.js.map +1 -1
- package/dist/context/context-generator.d.ts +38 -0
- package/dist/context/context-generator.d.ts.map +1 -0
- package/dist/context/context-generator.js +392 -0
- package/dist/context/context-generator.js.map +1 -0
- package/dist/context/index.d.ts +13 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +14 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/package-detector.d.ts +53 -0
- package/dist/context/package-detector.d.ts.map +1 -0
- package/dist/context/package-detector.js +672 -0
- package/dist/context/package-detector.js.map +1 -0
- package/dist/context/types.d.ts +258 -0
- package/dist/context/types.d.ts.map +1 -0
- package/dist/context/types.js +10 -0
- package/dist/context/types.js.map +1 -0
- package/dist/cpp/cpp-analyzer.d.ts +179 -0
- package/dist/cpp/cpp-analyzer.d.ts.map +1 -0
- package/dist/cpp/cpp-analyzer.js +532 -0
- package/dist/cpp/cpp-analyzer.js.map +1 -0
- package/dist/cpp/index.d.ts +9 -0
- package/dist/cpp/index.d.ts.map +1 -0
- package/dist/cpp/index.js +9 -0
- package/dist/cpp/index.js.map +1 -0
- package/dist/decisions/analyzer/decision-mining-analyzer.d.ts.map +1 -1
- package/dist/decisions/analyzer/decision-mining-analyzer.js +4 -0
- package/dist/decisions/analyzer/decision-mining-analyzer.js.map +1 -1
- package/dist/decisions/types.d.ts +1 -1
- package/dist/decisions/types.d.ts.map +1 -1
- package/dist/environment/extractors/cpp-env-extractor.d.ts +58 -0
- package/dist/environment/extractors/cpp-env-extractor.d.ts.map +1 -0
- package/dist/environment/extractors/cpp-env-extractor.js +298 -0
- package/dist/environment/extractors/cpp-env-extractor.js.map +1 -0
- package/dist/environment/extractors/index.d.ts +2 -0
- package/dist/environment/extractors/index.d.ts.map +1 -1
- package/dist/environment/extractors/index.js +2 -0
- package/dist/environment/extractors/index.js.map +1 -1
- package/dist/environment/extractors/rust-env-extractor.d.ts +58 -0
- package/dist/environment/extractors/rust-env-extractor.d.ts.map +1 -0
- package/dist/environment/extractors/rust-env-extractor.js +297 -0
- package/dist/environment/extractors/rust-env-extractor.js.map +1 -0
- package/dist/environment/index.d.ts +1 -1
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +1 -1
- package/dist/environment/index.js.map +1 -1
- package/dist/environment/types.d.ts +2 -2
- package/dist/environment/types.d.ts.map +1 -1
- package/dist/environment/types.js.map +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -2
- package/dist/index.js.map +1 -1
- package/dist/licensing/feature-guard.d.ts +103 -0
- package/dist/licensing/feature-guard.d.ts.map +1 -0
- package/dist/licensing/feature-guard.js +195 -0
- package/dist/licensing/feature-guard.js.map +1 -0
- package/dist/licensing/index.d.ts +46 -0
- package/dist/licensing/index.d.ts.map +1 -0
- package/dist/licensing/index.js +47 -0
- package/dist/licensing/index.js.map +1 -0
- package/dist/licensing/license-manager.d.ts +88 -0
- package/dist/licensing/license-manager.d.ts.map +1 -0
- package/dist/licensing/license-manager.js +251 -0
- package/dist/licensing/license-manager.js.map +1 -0
- package/dist/licensing/license-validator.d.ts +60 -0
- package/dist/licensing/license-validator.d.ts.map +1 -0
- package/dist/licensing/license-validator.js +300 -0
- package/dist/licensing/license-validator.js.map +1 -0
- package/dist/licensing/types.d.ts +76 -0
- package/dist/licensing/types.d.ts.map +1 -0
- package/dist/licensing/types.js +51 -0
- package/dist/licensing/types.js.map +1 -0
- package/dist/parsers/tree-sitter/cpp-loader.d.ts +51 -0
- package/dist/parsers/tree-sitter/cpp-loader.d.ts.map +1 -0
- package/dist/parsers/tree-sitter/cpp-loader.js +162 -0
- package/dist/parsers/tree-sitter/cpp-loader.js.map +1 -0
- package/dist/parsers/tree-sitter/index.d.ts +6 -0
- package/dist/parsers/tree-sitter/index.d.ts.map +1 -1
- package/dist/parsers/tree-sitter/index.js +16 -0
- package/dist/parsers/tree-sitter/index.js.map +1 -1
- package/dist/parsers/tree-sitter/rust-loader.d.ts +50 -0
- package/dist/parsers/tree-sitter/rust-loader.d.ts.map +1 -0
- package/dist/parsers/tree-sitter/rust-loader.js +161 -0
- package/dist/parsers/tree-sitter/rust-loader.js.map +1 -0
- package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.d.ts +198 -0
- package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.d.ts.map +1 -0
- package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.js +671 -0
- package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.js.map +1 -0
- package/dist/parsers/tree-sitter/tree-sitter-rust-parser.d.ts +180 -0
- package/dist/parsers/tree-sitter/tree-sitter-rust-parser.d.ts.map +1 -0
- package/dist/parsers/tree-sitter/tree-sitter-rust-parser.js +478 -0
- package/dist/parsers/tree-sitter/tree-sitter-rust-parser.js.map +1 -0
- package/dist/parsers/types.d.ts +1 -1
- package/dist/parsers/types.d.ts.map +1 -1
- package/dist/patterns/adapters/pattern-store-adapter.d.ts.map +1 -1
- package/dist/patterns/adapters/pattern-store-adapter.js +35 -10
- package/dist/patterns/adapters/pattern-store-adapter.js.map +1 -1
- package/dist/quality-gates/gates/base-gate.d.ts +71 -0
- package/dist/quality-gates/gates/base-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/base-gate.js +178 -0
- package/dist/quality-gates/gates/base-gate.js.map +1 -0
- package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.d.ts +62 -0
- package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.js +255 -0
- package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.js.map +1 -0
- package/dist/quality-gates/gates/constraint-verification/index.d.ts +7 -0
- package/dist/quality-gates/gates/constraint-verification/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/constraint-verification/index.js +7 -0
- package/dist/quality-gates/gates/constraint-verification/index.js.map +1 -0
- package/dist/quality-gates/gates/custom-rules/custom-rules-gate.d.ts +73 -0
- package/dist/quality-gates/gates/custom-rules/custom-rules-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/custom-rules/custom-rules-gate.js +351 -0
- package/dist/quality-gates/gates/custom-rules/custom-rules-gate.js.map +1 -0
- package/dist/quality-gates/gates/custom-rules/index.d.ts +7 -0
- package/dist/quality-gates/gates/custom-rules/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/custom-rules/index.js +7 -0
- package/dist/quality-gates/gates/custom-rules/index.js.map +1 -0
- package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.d.ts +61 -0
- package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.js +318 -0
- package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.js.map +1 -0
- package/dist/quality-gates/gates/impact-simulation/index.d.ts +7 -0
- package/dist/quality-gates/gates/impact-simulation/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/impact-simulation/index.js +7 -0
- package/dist/quality-gates/gates/impact-simulation/index.js.map +1 -0
- package/dist/quality-gates/gates/index.d.ts +13 -0
- package/dist/quality-gates/gates/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/index.js +13 -0
- package/dist/quality-gates/gates/index.js.map +1 -0
- package/dist/quality-gates/gates/pattern-compliance/index.d.ts +7 -0
- package/dist/quality-gates/gates/pattern-compliance/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/pattern-compliance/index.js +7 -0
- package/dist/quality-gates/gates/pattern-compliance/index.js.map +1 -0
- package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.d.ts +61 -0
- package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.js +261 -0
- package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.js.map +1 -0
- package/dist/quality-gates/gates/regression-detection/index.d.ts +7 -0
- package/dist/quality-gates/gates/regression-detection/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/regression-detection/index.js +7 -0
- package/dist/quality-gates/gates/regression-detection/index.js.map +1 -0
- package/dist/quality-gates/gates/regression-detection/regression-detection-gate.d.ts +69 -0
- package/dist/quality-gates/gates/regression-detection/regression-detection-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/regression-detection/regression-detection-gate.js +330 -0
- package/dist/quality-gates/gates/regression-detection/regression-detection-gate.js.map +1 -0
- package/dist/quality-gates/gates/security-boundary/index.d.ts +7 -0
- package/dist/quality-gates/gates/security-boundary/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/security-boundary/index.js +7 -0
- package/dist/quality-gates/gates/security-boundary/index.js.map +1 -0
- package/dist/quality-gates/gates/security-boundary/security-boundary-gate.d.ts +65 -0
- package/dist/quality-gates/gates/security-boundary/security-boundary-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/security-boundary/security-boundary-gate.js +307 -0
- package/dist/quality-gates/gates/security-boundary/security-boundary-gate.js.map +1 -0
- package/dist/quality-gates/index.d.ts +35 -0
- package/dist/quality-gates/index.d.ts.map +1 -0
- package/dist/quality-gates/index.js +43 -0
- package/dist/quality-gates/index.js.map +1 -0
- package/dist/quality-gates/orchestrator/gate-orchestrator.d.ts +79 -0
- package/dist/quality-gates/orchestrator/gate-orchestrator.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/gate-orchestrator.js +314 -0
- package/dist/quality-gates/orchestrator/gate-orchestrator.js.map +1 -0
- package/dist/quality-gates/orchestrator/gate-registry.d.ts +53 -0
- package/dist/quality-gates/orchestrator/gate-registry.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/gate-registry.js +141 -0
- package/dist/quality-gates/orchestrator/gate-registry.js.map +1 -0
- package/dist/quality-gates/orchestrator/index.d.ts +10 -0
- package/dist/quality-gates/orchestrator/index.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/index.js +10 -0
- package/dist/quality-gates/orchestrator/index.js.map +1 -0
- package/dist/quality-gates/orchestrator/parallel-executor.d.ts +35 -0
- package/dist/quality-gates/orchestrator/parallel-executor.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/parallel-executor.js +70 -0
- package/dist/quality-gates/orchestrator/parallel-executor.js.map +1 -0
- package/dist/quality-gates/orchestrator/result-aggregator.d.ts +27 -0
- package/dist/quality-gates/orchestrator/result-aggregator.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/result-aggregator.js +70 -0
- package/dist/quality-gates/orchestrator/result-aggregator.js.map +1 -0
- package/dist/quality-gates/policy/default-policies.d.ts +14 -0
- package/dist/quality-gates/policy/default-policies.d.ts.map +1 -0
- package/dist/quality-gates/policy/default-policies.js +266 -0
- package/dist/quality-gates/policy/default-policies.js.map +1 -0
- package/dist/quality-gates/policy/index.d.ts +9 -0
- package/dist/quality-gates/policy/index.d.ts.map +1 -0
- package/dist/quality-gates/policy/index.js +9 -0
- package/dist/quality-gates/policy/index.js.map +1 -0
- package/dist/quality-gates/policy/policy-evaluator.d.ts +43 -0
- package/dist/quality-gates/policy/policy-evaluator.d.ts.map +1 -0
- package/dist/quality-gates/policy/policy-evaluator.js +136 -0
- package/dist/quality-gates/policy/policy-evaluator.js.map +1 -0
- package/dist/quality-gates/policy/policy-loader.d.ts +72 -0
- package/dist/quality-gates/policy/policy-loader.d.ts.map +1 -0
- package/dist/quality-gates/policy/policy-loader.js +228 -0
- package/dist/quality-gates/policy/policy-loader.js.map +1 -0
- package/dist/quality-gates/reporters/github-reporter.d.ts +19 -0
- package/dist/quality-gates/reporters/github-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/github-reporter.js +49 -0
- package/dist/quality-gates/reporters/github-reporter.js.map +1 -0
- package/dist/quality-gates/reporters/gitlab-reporter.d.ts +20 -0
- package/dist/quality-gates/reporters/gitlab-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/gitlab-reporter.js +42 -0
- package/dist/quality-gates/reporters/gitlab-reporter.js.map +1 -0
- package/dist/quality-gates/reporters/index.d.ts +12 -0
- package/dist/quality-gates/reporters/index.d.ts.map +1 -0
- package/dist/quality-gates/reporters/index.js +12 -0
- package/dist/quality-gates/reporters/index.js.map +1 -0
- package/dist/quality-gates/reporters/json-reporter.d.ts +18 -0
- package/dist/quality-gates/reporters/json-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/json-reporter.js +51 -0
- package/dist/quality-gates/reporters/json-reporter.js.map +1 -0
- package/dist/quality-gates/reporters/reporter-interface.d.ts +35 -0
- package/dist/quality-gates/reporters/reporter-interface.d.ts.map +1 -0
- package/dist/quality-gates/reporters/reporter-interface.js +22 -0
- package/dist/quality-gates/reporters/reporter-interface.js.map +1 -0
- package/dist/quality-gates/reporters/sarif-reporter.d.ts +22 -0
- package/dist/quality-gates/reporters/sarif-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/sarif-reporter.js +85 -0
- package/dist/quality-gates/reporters/sarif-reporter.js.map +1 -0
- package/dist/quality-gates/reporters/text-reporter.d.ts +18 -0
- package/dist/quality-gates/reporters/text-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/text-reporter.js +92 -0
- package/dist/quality-gates/reporters/text-reporter.js.map +1 -0
- package/dist/quality-gates/store/gate-run-store.d.ts +37 -0
- package/dist/quality-gates/store/gate-run-store.d.ts.map +1 -0
- package/dist/quality-gates/store/gate-run-store.js +104 -0
- package/dist/quality-gates/store/gate-run-store.js.map +1 -0
- package/dist/quality-gates/store/index.d.ts +8 -0
- package/dist/quality-gates/store/index.d.ts.map +1 -0
- package/dist/quality-gates/store/index.js +8 -0
- package/dist/quality-gates/store/index.js.map +1 -0
- package/dist/quality-gates/store/snapshot-store.d.ts +41 -0
- package/dist/quality-gates/store/snapshot-store.d.ts.map +1 -0
- package/dist/quality-gates/store/snapshot-store.js +117 -0
- package/dist/quality-gates/store/snapshot-store.js.map +1 -0
- package/dist/quality-gates/types.d.ts +992 -0
- package/dist/quality-gates/types.d.ts.map +1 -0
- package/dist/quality-gates/types.js +14 -0
- package/dist/quality-gates/types.js.map +1 -0
- package/dist/rust/index.d.ts +7 -0
- package/dist/rust/index.d.ts.map +1 -0
- package/dist/rust/index.js +8 -0
- package/dist/rust/index.js.map +1 -0
- package/dist/rust/rust-analyzer.d.ts +185 -0
- package/dist/rust/rust-analyzer.d.ts.map +1 -0
- package/dist/rust/rust-analyzer.js +538 -0
- package/dist/rust/rust-analyzer.js.map +1 -0
- package/dist/scanner/file-walker.d.ts.map +1 -1
- package/dist/scanner/file-walker.js +11 -0
- package/dist/scanner/file-walker.js.map +1 -1
- package/dist/simulation/simulation-engine.d.ts +6 -0
- package/dist/simulation/simulation-engine.d.ts.map +1 -1
- package/dist/simulation/simulation-engine.js +6 -0
- package/dist/simulation/simulation-engine.js.map +1 -1
- package/dist/speculative/types.d.ts +1 -1
- package/dist/speculative/types.d.ts.map +1 -1
- package/dist/speculative/types.js +2 -0
- package/dist/speculative/types.js.map +1 -1
- package/dist/store/project-config.d.ts +19 -0
- package/dist/store/project-config.d.ts.map +1 -1
- package/dist/store/project-config.js.map +1 -1
- package/dist/telemetry/index.d.ts +10 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +11 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/telemetry-client.d.ts +127 -0
- package/dist/telemetry/telemetry-client.d.ts.map +1 -0
- package/dist/telemetry/telemetry-client.js +373 -0
- package/dist/telemetry/telemetry-client.js.map +1 -0
- package/dist/telemetry/types.d.ts +160 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +27 -0
- package/dist/telemetry/types.js.map +1 -0
- package/dist/test-topology/extractors/cpp-test-extractor.d.ts +38 -0
- package/dist/test-topology/extractors/cpp-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/cpp-test-extractor.js +507 -0
- package/dist/test-topology/extractors/cpp-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/index.d.ts +2 -0
- package/dist/test-topology/extractors/index.d.ts.map +1 -1
- package/dist/test-topology/extractors/index.js +2 -0
- package/dist/test-topology/extractors/index.js.map +1 -1
- package/dist/test-topology/extractors/regex/index.d.ts +1 -0
- package/dist/test-topology/extractors/regex/index.d.ts.map +1 -1
- package/dist/test-topology/extractors/regex/index.js +4 -0
- package/dist/test-topology/extractors/regex/index.js.map +1 -1
- package/dist/test-topology/extractors/regex/rust-test-regex.d.ts +66 -0
- package/dist/test-topology/extractors/regex/rust-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/rust-test-regex.js +565 -0
- package/dist/test-topology/extractors/regex/rust-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/rust-test-extractor.d.ts +49 -0
- package/dist/test-topology/extractors/rust-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/rust-test-extractor.js +422 -0
- package/dist/test-topology/extractors/rust-test-extractor.js.map +1 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.d.ts.map +1 -1
- package/dist/test-topology/hybrid-test-topology-analyzer.js +2 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.js.map +1 -1
- package/dist/test-topology/test-topology-analyzer.d.ts.map +1 -1
- package/dist/test-topology/test-topology-analyzer.js +2 -0
- package/dist/test-topology/test-topology-analyzer.js.map +1 -1
- package/dist/test-topology/types.d.ts +2 -2
- package/dist/test-topology/types.d.ts.map +1 -1
- package/dist/unified-provider/integration/unified-scanner.d.ts.map +1 -1
- package/dist/unified-provider/integration/unified-scanner.js +3 -0
- package/dist/unified-provider/integration/unified-scanner.js.map +1 -1
- package/dist/unified-provider/matching/diesel-matcher.d.ts +33 -0
- package/dist/unified-provider/matching/diesel-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/diesel-matcher.js +210 -0
- package/dist/unified-provider/matching/diesel-matcher.js.map +1 -0
- package/dist/unified-provider/matching/index.d.ts +3 -1
- package/dist/unified-provider/matching/index.d.ts.map +1 -1
- package/dist/unified-provider/matching/index.js +4 -1
- package/dist/unified-provider/matching/index.js.map +1 -1
- package/dist/unified-provider/matching/matcher-registry.d.ts.map +1 -1
- package/dist/unified-provider/matching/matcher-registry.js +7 -2
- package/dist/unified-provider/matching/matcher-registry.js.map +1 -1
- package/dist/unified-provider/matching/seaorm-matcher.d.ts +35 -0
- package/dist/unified-provider/matching/seaorm-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/seaorm-matcher.js +200 -0
- package/dist/unified-provider/matching/seaorm-matcher.js.map +1 -0
- package/dist/unified-provider/matching/sqlx-matcher.d.ts +19 -24
- package/dist/unified-provider/matching/sqlx-matcher.d.ts.map +1 -1
- package/dist/unified-provider/matching/sqlx-matcher.js +171 -149
- package/dist/unified-provider/matching/sqlx-matcher.js.map +1 -1
- package/dist/unified-provider/normalization/cpp-normalizer.d.ts +62 -0
- package/dist/unified-provider/normalization/cpp-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/cpp-normalizer.js +581 -0
- package/dist/unified-provider/normalization/cpp-normalizer.js.map +1 -0
- package/dist/unified-provider/normalization/index.d.ts +2 -0
- package/dist/unified-provider/normalization/index.d.ts.map +1 -1
- package/dist/unified-provider/normalization/index.js +11 -1
- package/dist/unified-provider/normalization/index.js.map +1 -1
- package/dist/unified-provider/normalization/rust-normalizer.d.ts +71 -0
- package/dist/unified-provider/normalization/rust-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/rust-normalizer.js +670 -0
- package/dist/unified-provider/normalization/rust-normalizer.js.map +1 -0
- package/dist/unified-provider/parsing/parser-registry.d.ts.map +1 -1
- package/dist/unified-provider/parsing/parser-registry.js +62 -1
- package/dist/unified-provider/parsing/parser-registry.js.map +1 -1
- package/dist/unified-provider/provider/unified-language-provider.js +1 -1
- package/dist/unified-provider/provider/unified-language-provider.js.map +1 -1
- package/dist/unified-provider/types.d.ts +1 -1
- package/dist/unified-provider/types.d.ts.map +1 -1
- package/dist/wrappers/index.d.ts.map +1 -1
- package/dist/wrappers/index.js +2 -0
- package/dist/wrappers/index.js.map +1 -1
- package/dist/wrappers/integration/adapter.d.ts.map +1 -1
- package/dist/wrappers/integration/adapter.js +2 -0
- package/dist/wrappers/integration/adapter.js.map +1 -1
- package/dist/wrappers/integration/scanner.d.ts.map +1 -1
- package/dist/wrappers/integration/scanner.js +2 -0
- package/dist/wrappers/integration/scanner.js.map +1 -1
- package/dist/wrappers/primitives/registry.d.ts +18 -0
- package/dist/wrappers/primitives/registry.d.ts.map +1 -1
- package/dist/wrappers/primitives/registry.js +190 -0
- package/dist/wrappers/primitives/registry.js.map +1 -1
- package/dist/wrappers/types.d.ts +1 -1
- package/dist/wrappers/types.d.ts.map +1 -1
- package/package.json +5 -2
- package/LICENSE +0 -21
- package/dist/lake/lake.bak/index-store.d.ts +0 -82
- package/dist/lake/lake.bak/index-store.d.ts.map +0 -1
- package/dist/lake/lake.bak/index-store.js +0 -357
- package/dist/lake/lake.bak/index-store.js.map +0 -1
- package/dist/lake/lake.bak/index.d.ts +0 -81
- package/dist/lake/lake.bak/index.d.ts.map +0 -1
- package/dist/lake/lake.bak/index.js +0 -114
- package/dist/lake/lake.bak/index.js.map +0 -1
- package/dist/lake/lake.bak/manifest-store.d.ts +0 -51
- package/dist/lake/lake.bak/manifest-store.d.ts.map +0 -1
- package/dist/lake/lake.bak/manifest-store.js +0 -347
- package/dist/lake/lake.bak/manifest-store.js.map +0 -1
- package/dist/lake/lake.bak/query-engine.d.ts +0 -112
- package/dist/lake/lake.bak/query-engine.d.ts.map +0 -1
- package/dist/lake/lake.bak/query-engine.js +0 -370
- package/dist/lake/lake.bak/query-engine.js.map +0 -1
- package/dist/lake/lake.bak/types.d.ts +0 -428
- package/dist/lake/lake.bak/types.d.ts.map +0 -1
- package/dist/lake/lake.bak/types.js +0 -46
- package/dist/lake/lake.bak/types.js.map +0 -1
- package/dist/lake/lake.bak/view-materializer.d.ts +0 -70
- package/dist/lake/lake.bak/view-materializer.d.ts.map +0 -1
- package/dist/lake/lake.bak/view-materializer.js +0 -314
- package/dist/lake/lake.bak/view-materializer.js.map +0 -1
- package/dist/lake/lake.bak/view-store.d.ts +0 -57
- package/dist/lake/lake.bak/view-store.d.ts.map +0 -1
- package/dist/lake/lake.bak/view-store.js +0 -348
- package/dist/lake/lake.bak/view-store.js.map +0 -1
- package/dist/unified-provider/migration/deprecated-extractors.d.ts +0 -104
- package/dist/unified-provider/migration/deprecated-extractors.d.ts.map +0 -1
- package/dist/unified-provider/migration/deprecated-extractors.js +0 -129
- package/dist/unified-provider/migration/deprecated-extractors.js.map +0 -1
- package/dist/unified-provider/migration/deprecated-scanner.d.ts +0 -40
- package/dist/unified-provider/migration/deprecated-scanner.d.ts.map +0 -1
- package/dist/unified-provider/migration/deprecated-scanner.js +0 -49
- package/dist/unified-provider/migration/deprecated-scanner.js.map +0 -1
- package/dist/unified-provider/migration/index.d.ts +0 -41
- package/dist/unified-provider/migration/index.d.ts.map +0 -1
- package/dist/unified-provider/migration/index.js +0 -43
- package/dist/unified-provider/migration/index.js.map +0 -1
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rust Call Chain Normalizer
|
|
3
|
+
*
|
|
4
|
+
* Converts Rust AST into unified call chains.
|
|
5
|
+
* Handles Rust-specific patterns including:
|
|
6
|
+
* - Method chaining: obj.method1().method2()
|
|
7
|
+
* - Path expressions: Path::to::function()
|
|
8
|
+
* - Macro invocations: macro_name!()
|
|
9
|
+
* - Async/await: async fn, .await
|
|
10
|
+
* - Result/Option chaining: .unwrap(), .map(), .and_then()
|
|
11
|
+
* - Builder patterns
|
|
12
|
+
* - Closures
|
|
13
|
+
*
|
|
14
|
+
* @requirements Rust Language Support
|
|
15
|
+
*/
|
|
16
|
+
import { BaseNormalizer } from './base-normalizer.js';
|
|
17
|
+
/**
|
|
18
|
+
* Rust normalizer
|
|
19
|
+
*/
|
|
20
|
+
export class RustNormalizer extends BaseNormalizer {
|
|
21
|
+
language = 'rust';
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Call Chain Normalization
|
|
24
|
+
// ============================================================================
|
|
25
|
+
normalizeCallChains(rootNode, _source, filePath) {
|
|
26
|
+
const chains = [];
|
|
27
|
+
const processedNodes = new Set();
|
|
28
|
+
this.traverseNode(rootNode, node => {
|
|
29
|
+
if ((node.type === 'call_expression' || node.type === 'method_call_expression') &&
|
|
30
|
+
!processedNodes.has(node)) {
|
|
31
|
+
// Check if this call is part of a larger chain
|
|
32
|
+
const parent = node.parent;
|
|
33
|
+
if (parent?.type === 'method_call_expression' || parent?.type === 'call_expression') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const chain = this.extractCallChain(node, filePath);
|
|
37
|
+
if (chain && chain.segments.length > 0) {
|
|
38
|
+
chains.push(chain);
|
|
39
|
+
this.markChainNodesProcessed(node, processedNodes);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return chains;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Extract a call chain from a call expression
|
|
47
|
+
*/
|
|
48
|
+
extractCallChain(node, filePath) {
|
|
49
|
+
const segments = [];
|
|
50
|
+
let receiver = '';
|
|
51
|
+
let current = node;
|
|
52
|
+
while (current) {
|
|
53
|
+
if (current.type === 'method_call_expression') {
|
|
54
|
+
const nameNode = this.getChildByField(current, 'name');
|
|
55
|
+
const argsNode = this.getChildByField(current, 'arguments');
|
|
56
|
+
const valueNode = this.getChildByField(current, 'value');
|
|
57
|
+
if (nameNode) {
|
|
58
|
+
const args = argsNode ? this.normalizeArguments(argsNode) : [];
|
|
59
|
+
const pos = this.getPosition(nameNode);
|
|
60
|
+
segments.unshift(this.createSegment(nameNode.text, true, args, pos.line, pos.column));
|
|
61
|
+
}
|
|
62
|
+
current = valueNode;
|
|
63
|
+
}
|
|
64
|
+
else if (current.type === 'call_expression') {
|
|
65
|
+
const funcNode = this.getChildByField(current, 'function');
|
|
66
|
+
const argsNode = this.getChildByField(current, 'arguments');
|
|
67
|
+
if (!funcNode)
|
|
68
|
+
break;
|
|
69
|
+
const args = argsNode ? this.normalizeArguments(argsNode) : [];
|
|
70
|
+
if (funcNode.type === 'scoped_identifier') {
|
|
71
|
+
// Path::to::function()
|
|
72
|
+
const parts = funcNode.text.split('::');
|
|
73
|
+
const funcName = parts.pop() ?? funcNode.text;
|
|
74
|
+
const pos = this.getPosition(funcNode);
|
|
75
|
+
segments.unshift(this.createSegment(funcName, true, args, pos.line, pos.column));
|
|
76
|
+
receiver = parts.join('::');
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
else if (funcNode.type === 'field_expression') {
|
|
80
|
+
// obj.field() - rare in Rust, usually method_call_expression
|
|
81
|
+
const fieldNode = this.getChildByField(funcNode, 'field');
|
|
82
|
+
const valueNode = this.getChildByField(funcNode, 'value');
|
|
83
|
+
if (fieldNode) {
|
|
84
|
+
const pos = this.getPosition(fieldNode);
|
|
85
|
+
segments.unshift(this.createSegment(fieldNode.text, true, args, pos.line, pos.column));
|
|
86
|
+
}
|
|
87
|
+
current = valueNode;
|
|
88
|
+
}
|
|
89
|
+
else if (funcNode.type === 'identifier') {
|
|
90
|
+
const pos = this.getPosition(funcNode);
|
|
91
|
+
segments.unshift(this.createSegment(funcNode.text, true, args, pos.line, pos.column));
|
|
92
|
+
receiver = funcNode.text;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else if (current.type === 'field_expression') {
|
|
100
|
+
// Property access without call
|
|
101
|
+
const fieldNode = this.getChildByField(current, 'field');
|
|
102
|
+
const valueNode = this.getChildByField(current, 'value');
|
|
103
|
+
if (fieldNode) {
|
|
104
|
+
const pos = this.getPosition(fieldNode);
|
|
105
|
+
segments.unshift(this.createSegment(fieldNode.text, false, [], pos.line, pos.column));
|
|
106
|
+
}
|
|
107
|
+
current = valueNode;
|
|
108
|
+
}
|
|
109
|
+
else if (current.type === 'await_expression') {
|
|
110
|
+
// .await
|
|
111
|
+
const pos = this.getPosition(current);
|
|
112
|
+
segments.unshift(this.createSegment('await', false, [], pos.line, pos.column));
|
|
113
|
+
const awaitValueNode = this.getChildByField(current, 'value') ?? current.namedChildren[0] ?? null;
|
|
114
|
+
current = awaitValueNode;
|
|
115
|
+
}
|
|
116
|
+
else if (current.type === 'try_expression') {
|
|
117
|
+
// ? operator
|
|
118
|
+
const pos = this.getPosition(current);
|
|
119
|
+
segments.unshift(this.createSegment('?', false, [], pos.line, pos.column));
|
|
120
|
+
const tryValueNode = current.namedChildren[0] ?? null;
|
|
121
|
+
current = tryValueNode;
|
|
122
|
+
}
|
|
123
|
+
else if (current.type === 'identifier') {
|
|
124
|
+
receiver = current.text;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
else if (current.type === 'scoped_identifier') {
|
|
128
|
+
receiver = current.text;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
else if (current.type === 'index_expression') {
|
|
132
|
+
// array[index].method()
|
|
133
|
+
const valueNode = this.getChildByField(current, 'value');
|
|
134
|
+
current = valueNode;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
receiver = current.text;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (segments.length === 0) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const pos = this.getPosition(node);
|
|
145
|
+
const endPos = this.getEndPosition(node);
|
|
146
|
+
return this.createCallChain(receiver, segments, node.text, filePath, pos.line, pos.column, endPos.line, endPos.column, node);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Normalize arguments from an argument list node
|
|
150
|
+
*/
|
|
151
|
+
normalizeArguments(argsNode) {
|
|
152
|
+
const args = [];
|
|
153
|
+
for (const child of argsNode.children) {
|
|
154
|
+
if (child.type === '(' || child.type === ')' || child.type === ',') {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
args.push(this.normalizeArgument(child));
|
|
158
|
+
}
|
|
159
|
+
return args;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Normalize a single argument
|
|
163
|
+
*/
|
|
164
|
+
normalizeArgument(node) {
|
|
165
|
+
const pos = this.getPosition(node);
|
|
166
|
+
switch (node.type) {
|
|
167
|
+
case 'string_literal':
|
|
168
|
+
case 'raw_string_literal':
|
|
169
|
+
return this.createStringArg(node.text, pos.line, pos.column);
|
|
170
|
+
case 'integer_literal':
|
|
171
|
+
case 'float_literal':
|
|
172
|
+
return this.createNumberArg(node.text, pos.line, pos.column);
|
|
173
|
+
case 'boolean_literal':
|
|
174
|
+
return this.createBooleanArg(node.text, pos.line, pos.column);
|
|
175
|
+
case 'identifier':
|
|
176
|
+
if (node.text === 'true' || node.text === 'false') {
|
|
177
|
+
return this.createBooleanArg(node.text, pos.line, pos.column);
|
|
178
|
+
}
|
|
179
|
+
if (node.text === 'None') {
|
|
180
|
+
return this.createUnknownArg('None', pos.line, pos.column);
|
|
181
|
+
}
|
|
182
|
+
return this.createIdentifierArg(node.text, pos.line, pos.column);
|
|
183
|
+
case 'struct_expression':
|
|
184
|
+
return this.normalizeStructExpression(node);
|
|
185
|
+
case 'array_expression':
|
|
186
|
+
return this.normalizeArrayExpression(node);
|
|
187
|
+
case 'tuple_expression':
|
|
188
|
+
return this.normalizeTupleExpression(node);
|
|
189
|
+
case 'call_expression':
|
|
190
|
+
case 'method_call_expression':
|
|
191
|
+
return this.createUnknownArg(node.text, pos.line, pos.column);
|
|
192
|
+
case 'closure_expression':
|
|
193
|
+
return this.createUnknownArg(node.text, pos.line, pos.column);
|
|
194
|
+
case 'reference_expression':
|
|
195
|
+
// &value, &mut value
|
|
196
|
+
return this.createUnknownArg(node.text, pos.line, pos.column);
|
|
197
|
+
case 'unary_expression':
|
|
198
|
+
return this.createUnknownArg(node.text, pos.line, pos.column);
|
|
199
|
+
case 'binary_expression':
|
|
200
|
+
return this.createUnknownArg(node.text, pos.line, pos.column);
|
|
201
|
+
case 'scoped_identifier':
|
|
202
|
+
return this.createIdentifierArg(node.text, pos.line, pos.column);
|
|
203
|
+
case 'field_expression':
|
|
204
|
+
return this.createIdentifierArg(node.text, pos.line, pos.column);
|
|
205
|
+
default:
|
|
206
|
+
return this.createUnknownArg(node.text, pos.line, pos.column);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Normalize a struct expression
|
|
211
|
+
*/
|
|
212
|
+
normalizeStructExpression(node) {
|
|
213
|
+
const pos = this.getPosition(node);
|
|
214
|
+
const properties = {};
|
|
215
|
+
const bodyNode = node.children.find(c => c.type === 'field_initializer_list');
|
|
216
|
+
if (bodyNode) {
|
|
217
|
+
for (const child of bodyNode.children) {
|
|
218
|
+
if (child.type === 'field_initializer') {
|
|
219
|
+
const nameNode = this.getChildByField(child, 'name') ??
|
|
220
|
+
child.children.find(c => c.type === 'field_identifier');
|
|
221
|
+
const valueNode = this.getChildByField(child, 'value') ??
|
|
222
|
+
child.children.find(c => c !== nameNode && c.type !== ':');
|
|
223
|
+
if (nameNode && valueNode) {
|
|
224
|
+
properties[nameNode.text] = this.normalizeArgument(valueNode);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
else if (child.type === 'shorthand_field_initializer') {
|
|
228
|
+
const nameNode = child.children.find(c => c.type === 'identifier');
|
|
229
|
+
if (nameNode) {
|
|
230
|
+
properties[nameNode.text] = this.createIdentifierArg(nameNode.text, pos.line, pos.column);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return this.createObjectArg(node.text, properties, pos.line, pos.column);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Normalize an array expression
|
|
239
|
+
*/
|
|
240
|
+
normalizeArrayExpression(node) {
|
|
241
|
+
const pos = this.getPosition(node);
|
|
242
|
+
const elements = [];
|
|
243
|
+
for (const child of node.children) {
|
|
244
|
+
if (child.type !== '[' && child.type !== ']' && child.type !== ',' && child.type !== ';') {
|
|
245
|
+
elements.push(this.normalizeArgument(child));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return this.createArrayArg(node.text, elements, pos.line, pos.column);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Normalize a tuple expression
|
|
252
|
+
*/
|
|
253
|
+
normalizeTupleExpression(node) {
|
|
254
|
+
const pos = this.getPosition(node);
|
|
255
|
+
const elements = [];
|
|
256
|
+
for (const child of node.children) {
|
|
257
|
+
if (child.type !== '(' && child.type !== ')' && child.type !== ',') {
|
|
258
|
+
elements.push(this.normalizeArgument(child));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return this.createArrayArg(node.text, elements, pos.line, pos.column);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Mark all nodes in a chain as processed
|
|
265
|
+
*/
|
|
266
|
+
markChainNodesProcessed(node, processed) {
|
|
267
|
+
processed.add(node);
|
|
268
|
+
for (const child of node.children) {
|
|
269
|
+
if (child.type === 'call_expression' ||
|
|
270
|
+
child.type === 'method_call_expression' ||
|
|
271
|
+
child.type === 'field_expression') {
|
|
272
|
+
this.markChainNodesProcessed(child, processed);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// ============================================================================
|
|
277
|
+
// Function Extraction
|
|
278
|
+
// ============================================================================
|
|
279
|
+
extractFunctions(rootNode, _source, filePath) {
|
|
280
|
+
const functions = [];
|
|
281
|
+
const moduleName = this.extractModuleName(filePath);
|
|
282
|
+
this.traverseNode(rootNode, node => {
|
|
283
|
+
if (node.type === 'function_item') {
|
|
284
|
+
const func = this.extractFunctionItem(node, filePath, moduleName, null);
|
|
285
|
+
if (func)
|
|
286
|
+
functions.push(func);
|
|
287
|
+
}
|
|
288
|
+
else if (node.type === 'impl_item') {
|
|
289
|
+
const implFunctions = this.extractImplFunctions(node, filePath, moduleName);
|
|
290
|
+
functions.push(...implFunctions);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
return functions;
|
|
294
|
+
}
|
|
295
|
+
extractModuleName(filePath) {
|
|
296
|
+
const parts = filePath.split('/');
|
|
297
|
+
const fileName = parts[parts.length - 1] ?? 'main';
|
|
298
|
+
return fileName.replace('.rs', '');
|
|
299
|
+
}
|
|
300
|
+
extractFunctionItem(node, filePath, moduleName, implName) {
|
|
301
|
+
const nameNode = this.getChildByField(node, 'name');
|
|
302
|
+
if (!nameNode)
|
|
303
|
+
return null;
|
|
304
|
+
const name = nameNode.text;
|
|
305
|
+
const params = this.extractParameters(this.getChildByField(node, 'parameters'));
|
|
306
|
+
const returnTypeNode = this.getChildByField(node, 'return_type');
|
|
307
|
+
const returnType = returnTypeNode?.text?.replace(/^->\s*/, '');
|
|
308
|
+
const bodyNode = this.getChildByField(node, 'body');
|
|
309
|
+
const isPublic = this.hasVisibilityModifier(node, 'pub');
|
|
310
|
+
const isAsync = this.hasModifier(node, 'async');
|
|
311
|
+
const isConstructor = name === 'new' || name === 'default';
|
|
312
|
+
const pos = this.getPosition(node);
|
|
313
|
+
const endPos = this.getEndPosition(node);
|
|
314
|
+
const qualifiedName = implName
|
|
315
|
+
? `${moduleName}::${implName}::${name}`
|
|
316
|
+
: `${moduleName}::${name}`;
|
|
317
|
+
return this.createFunction({
|
|
318
|
+
name,
|
|
319
|
+
qualifiedName,
|
|
320
|
+
file: filePath,
|
|
321
|
+
startLine: pos.line,
|
|
322
|
+
endLine: endPos.line,
|
|
323
|
+
startColumn: pos.column,
|
|
324
|
+
endColumn: endPos.column,
|
|
325
|
+
parameters: params,
|
|
326
|
+
returnType,
|
|
327
|
+
isMethod: implName !== null,
|
|
328
|
+
isStatic: implName !== null && !this.hasSelfParameter(this.getChildByField(node, 'parameters')),
|
|
329
|
+
isExported: isPublic,
|
|
330
|
+
isConstructor,
|
|
331
|
+
isAsync,
|
|
332
|
+
className: implName ?? undefined,
|
|
333
|
+
decorators: this.extractAttributes(node),
|
|
334
|
+
bodyStartLine: bodyNode ? this.getPosition(bodyNode).line : pos.line,
|
|
335
|
+
bodyEndLine: bodyNode ? this.getEndPosition(bodyNode).line : endPos.line,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
extractImplFunctions(node, filePath, moduleName) {
|
|
339
|
+
const functions = [];
|
|
340
|
+
const typeNode = this.getChildByField(node, 'type');
|
|
341
|
+
const traitNode = this.getChildByField(node, 'trait');
|
|
342
|
+
if (!typeNode)
|
|
343
|
+
return functions;
|
|
344
|
+
let implName = this.extractTypeName(typeNode);
|
|
345
|
+
if (traitNode) {
|
|
346
|
+
const traitName = this.extractTypeName(traitNode);
|
|
347
|
+
implName = `${traitName} for ${implName}`;
|
|
348
|
+
}
|
|
349
|
+
const bodyNode = this.getChildByField(node, 'body');
|
|
350
|
+
if (bodyNode) {
|
|
351
|
+
for (const child of bodyNode.children) {
|
|
352
|
+
if (child.type === 'function_item') {
|
|
353
|
+
const func = this.extractFunctionItem(child, filePath, moduleName, implName);
|
|
354
|
+
if (func)
|
|
355
|
+
functions.push(func);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return functions;
|
|
360
|
+
}
|
|
361
|
+
extractParameters(paramsNode) {
|
|
362
|
+
if (!paramsNode)
|
|
363
|
+
return [];
|
|
364
|
+
const params = [];
|
|
365
|
+
for (const child of paramsNode.children) {
|
|
366
|
+
if (child.type === 'parameter') {
|
|
367
|
+
const patternNode = this.getChildByField(child, 'pattern');
|
|
368
|
+
const typeNode = this.getChildByField(child, 'type');
|
|
369
|
+
const name = patternNode?.text ?? '_';
|
|
370
|
+
const type = typeNode?.text;
|
|
371
|
+
params.push(this.createParameter(name, type, false, false));
|
|
372
|
+
}
|
|
373
|
+
else if (child.type === 'self_parameter') {
|
|
374
|
+
params.push(this.createParameter('self', child.text, false, false));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return params;
|
|
378
|
+
}
|
|
379
|
+
hasSelfParameter(paramsNode) {
|
|
380
|
+
if (!paramsNode)
|
|
381
|
+
return false;
|
|
382
|
+
for (const child of paramsNode.children) {
|
|
383
|
+
if (child.type === 'self_parameter') {
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
hasVisibilityModifier(node, modifier) {
|
|
390
|
+
for (const child of node.children) {
|
|
391
|
+
if (child.type === 'visibility_modifier') {
|
|
392
|
+
return child.text.startsWith(modifier);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
hasModifier(node, modifier) {
|
|
398
|
+
for (const child of node.children) {
|
|
399
|
+
if (child.type === modifier || child.text === modifier) {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
extractAttributes(node) {
|
|
406
|
+
const attributes = [];
|
|
407
|
+
let sibling = node.previousSibling;
|
|
408
|
+
while (sibling) {
|
|
409
|
+
if (sibling.type === 'attribute_item') {
|
|
410
|
+
attributes.push(sibling.text);
|
|
411
|
+
}
|
|
412
|
+
else if (sibling.type !== 'line_comment' && sibling.type !== 'block_comment') {
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
sibling = sibling.previousSibling;
|
|
416
|
+
}
|
|
417
|
+
return attributes.reverse();
|
|
418
|
+
}
|
|
419
|
+
extractTypeName(node) {
|
|
420
|
+
if (node.type === 'type_identifier') {
|
|
421
|
+
return node.text;
|
|
422
|
+
}
|
|
423
|
+
else if (node.type === 'scoped_type_identifier') {
|
|
424
|
+
return node.text;
|
|
425
|
+
}
|
|
426
|
+
else if (node.type === 'generic_type') {
|
|
427
|
+
const typeNode = this.getChildByField(node, 'type');
|
|
428
|
+
return typeNode?.text ?? node.text;
|
|
429
|
+
}
|
|
430
|
+
return node.text;
|
|
431
|
+
}
|
|
432
|
+
// ============================================================================
|
|
433
|
+
// Class (Struct/Trait/Enum) Extraction
|
|
434
|
+
// ============================================================================
|
|
435
|
+
extractClasses(rootNode, _source, filePath) {
|
|
436
|
+
const classes = [];
|
|
437
|
+
this.traverseNode(rootNode, node => {
|
|
438
|
+
if (node.type === 'struct_item') {
|
|
439
|
+
const cls = this.extractStructItem(node, filePath);
|
|
440
|
+
if (cls)
|
|
441
|
+
classes.push(cls);
|
|
442
|
+
}
|
|
443
|
+
else if (node.type === 'enum_item') {
|
|
444
|
+
const cls = this.extractEnumItem(node, filePath);
|
|
445
|
+
if (cls)
|
|
446
|
+
classes.push(cls);
|
|
447
|
+
}
|
|
448
|
+
else if (node.type === 'trait_item') {
|
|
449
|
+
const cls = this.extractTraitItem(node, filePath);
|
|
450
|
+
if (cls)
|
|
451
|
+
classes.push(cls);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
return classes;
|
|
455
|
+
}
|
|
456
|
+
extractStructItem(node, filePath) {
|
|
457
|
+
const nameNode = this.getChildByField(node, 'name');
|
|
458
|
+
if (!nameNode)
|
|
459
|
+
return null;
|
|
460
|
+
const name = nameNode.text;
|
|
461
|
+
const isPublic = this.hasVisibilityModifier(node, 'pub');
|
|
462
|
+
const pos = this.getPosition(node);
|
|
463
|
+
const endPos = this.getEndPosition(node);
|
|
464
|
+
return this.createClass({
|
|
465
|
+
name,
|
|
466
|
+
file: filePath,
|
|
467
|
+
startLine: pos.line,
|
|
468
|
+
endLine: endPos.line,
|
|
469
|
+
baseClasses: [],
|
|
470
|
+
methods: [],
|
|
471
|
+
isExported: isPublic,
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
extractEnumItem(node, filePath) {
|
|
475
|
+
const nameNode = this.getChildByField(node, 'name');
|
|
476
|
+
if (!nameNode)
|
|
477
|
+
return null;
|
|
478
|
+
const name = nameNode.text;
|
|
479
|
+
const isPublic = this.hasVisibilityModifier(node, 'pub');
|
|
480
|
+
const pos = this.getPosition(node);
|
|
481
|
+
const endPos = this.getEndPosition(node);
|
|
482
|
+
return this.createClass({
|
|
483
|
+
name,
|
|
484
|
+
file: filePath,
|
|
485
|
+
startLine: pos.line,
|
|
486
|
+
endLine: endPos.line,
|
|
487
|
+
baseClasses: [],
|
|
488
|
+
methods: [],
|
|
489
|
+
isExported: isPublic,
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
extractTraitItem(node, filePath) {
|
|
493
|
+
const nameNode = this.getChildByField(node, 'name');
|
|
494
|
+
if (!nameNode)
|
|
495
|
+
return null;
|
|
496
|
+
const name = nameNode.text;
|
|
497
|
+
const isPublic = this.hasVisibilityModifier(node, 'pub');
|
|
498
|
+
const methods = [];
|
|
499
|
+
const baseClasses = [];
|
|
500
|
+
// Extract super traits
|
|
501
|
+
const boundsNode = this.getChildByField(node, 'bounds');
|
|
502
|
+
if (boundsNode) {
|
|
503
|
+
for (const child of boundsNode.children) {
|
|
504
|
+
if (child.type === 'type_identifier' || child.type === 'scoped_type_identifier') {
|
|
505
|
+
baseClasses.push(child.text);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
// Extract method signatures
|
|
510
|
+
const bodyNode = this.getChildByField(node, 'body');
|
|
511
|
+
if (bodyNode) {
|
|
512
|
+
for (const child of bodyNode.children) {
|
|
513
|
+
if (child.type === 'function_signature_item' || child.type === 'function_item') {
|
|
514
|
+
const methodNameNode = this.getChildByField(child, 'name');
|
|
515
|
+
if (methodNameNode) {
|
|
516
|
+
methods.push(methodNameNode.text);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
const pos = this.getPosition(node);
|
|
522
|
+
const endPos = this.getEndPosition(node);
|
|
523
|
+
return this.createClass({
|
|
524
|
+
name,
|
|
525
|
+
file: filePath,
|
|
526
|
+
startLine: pos.line,
|
|
527
|
+
endLine: endPos.line,
|
|
528
|
+
baseClasses,
|
|
529
|
+
methods,
|
|
530
|
+
isExported: isPublic,
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
// ============================================================================
|
|
534
|
+
// Import Extraction
|
|
535
|
+
// ============================================================================
|
|
536
|
+
extractImports(rootNode, _source, _filePath) {
|
|
537
|
+
const imports = [];
|
|
538
|
+
this.traverseNode(rootNode, node => {
|
|
539
|
+
if (node.type === 'use_declaration') {
|
|
540
|
+
const argumentNode = this.getChildByField(node, 'argument');
|
|
541
|
+
if (argumentNode) {
|
|
542
|
+
const useImports = this.extractUseTree(argumentNode);
|
|
543
|
+
for (const imp of useImports) {
|
|
544
|
+
imports.push(this.createImport({
|
|
545
|
+
source: imp.source,
|
|
546
|
+
names: [{
|
|
547
|
+
imported: imp.name,
|
|
548
|
+
local: imp.alias ?? imp.name,
|
|
549
|
+
isDefault: false,
|
|
550
|
+
isNamespace: imp.isGlob,
|
|
551
|
+
}],
|
|
552
|
+
line: this.getPosition(node).line,
|
|
553
|
+
isTypeOnly: false,
|
|
554
|
+
}));
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
return imports;
|
|
560
|
+
}
|
|
561
|
+
extractUseTree(node) {
|
|
562
|
+
const imports = [];
|
|
563
|
+
if (node.type === 'scoped_identifier' || node.type === 'identifier') {
|
|
564
|
+
const path = node.text;
|
|
565
|
+
const parts = path.split('::');
|
|
566
|
+
const name = parts[parts.length - 1] ?? path;
|
|
567
|
+
imports.push({ source: path, name, isGlob: false });
|
|
568
|
+
}
|
|
569
|
+
else if (node.type === 'use_wildcard') {
|
|
570
|
+
const pathNode = this.getChildByField(node, 'path');
|
|
571
|
+
imports.push({ source: pathNode?.text ?? '', name: '*', isGlob: true });
|
|
572
|
+
}
|
|
573
|
+
else if (node.type === 'use_as_clause') {
|
|
574
|
+
const pathNode = this.getChildByField(node, 'path');
|
|
575
|
+
const aliasNode = this.getChildByField(node, 'alias');
|
|
576
|
+
const path = pathNode?.text ?? '';
|
|
577
|
+
const parts = path.split('::');
|
|
578
|
+
const name = parts[parts.length - 1] ?? path;
|
|
579
|
+
const aliasText = aliasNode?.text;
|
|
580
|
+
imports.push({ source: path, name, ...(aliasText ? { alias: aliasText } : {}), isGlob: false });
|
|
581
|
+
}
|
|
582
|
+
else if (node.type === 'scoped_use_list') {
|
|
583
|
+
const pathNode = this.getChildByField(node, 'path');
|
|
584
|
+
const listNode = this.getChildByField(node, 'list');
|
|
585
|
+
const basePath = pathNode?.text ?? '';
|
|
586
|
+
if (listNode) {
|
|
587
|
+
for (const child of listNode.children) {
|
|
588
|
+
if (child.type === 'identifier') {
|
|
589
|
+
imports.push({
|
|
590
|
+
source: basePath ? `${basePath}::${child.text}` : child.text,
|
|
591
|
+
name: child.text,
|
|
592
|
+
isGlob: false,
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
else if (child.type === 'self') {
|
|
596
|
+
imports.push({
|
|
597
|
+
source: basePath,
|
|
598
|
+
name: basePath.split('::').pop() ?? basePath,
|
|
599
|
+
isGlob: false,
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
else if (child.type !== '{' && child.type !== '}' && child.type !== ',') {
|
|
603
|
+
const subImports = this.extractUseTree(child);
|
|
604
|
+
for (const sub of subImports) {
|
|
605
|
+
imports.push({
|
|
606
|
+
...sub,
|
|
607
|
+
source: basePath ? `${basePath}::${sub.source}` : sub.source,
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return imports;
|
|
615
|
+
}
|
|
616
|
+
// ============================================================================
|
|
617
|
+
// Export Extraction
|
|
618
|
+
// ============================================================================
|
|
619
|
+
extractExports(rootNode, _source, _filePath) {
|
|
620
|
+
const exports = [];
|
|
621
|
+
for (const child of rootNode.children) {
|
|
622
|
+
if (child.type === 'function_item') {
|
|
623
|
+
if (this.hasVisibilityModifier(child, 'pub')) {
|
|
624
|
+
const nameNode = this.getChildByField(child, 'name');
|
|
625
|
+
if (nameNode) {
|
|
626
|
+
exports.push(this.createExport({
|
|
627
|
+
name: nameNode.text,
|
|
628
|
+
line: this.getPosition(child).line,
|
|
629
|
+
}));
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
else if (child.type === 'struct_item' || child.type === 'enum_item' || child.type === 'trait_item') {
|
|
634
|
+
if (this.hasVisibilityModifier(child, 'pub')) {
|
|
635
|
+
const nameNode = this.getChildByField(child, 'name');
|
|
636
|
+
if (nameNode) {
|
|
637
|
+
exports.push(this.createExport({
|
|
638
|
+
name: nameNode.text,
|
|
639
|
+
line: this.getPosition(child).line,
|
|
640
|
+
}));
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
else if (child.type === 'const_item' || child.type === 'static_item') {
|
|
645
|
+
if (this.hasVisibilityModifier(child, 'pub')) {
|
|
646
|
+
const nameNode = this.getChildByField(child, 'name');
|
|
647
|
+
if (nameNode) {
|
|
648
|
+
exports.push(this.createExport({
|
|
649
|
+
name: nameNode.text,
|
|
650
|
+
line: this.getPosition(child).line,
|
|
651
|
+
}));
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
else if (child.type === 'mod_item') {
|
|
656
|
+
if (this.hasVisibilityModifier(child, 'pub')) {
|
|
657
|
+
const nameNode = this.getChildByField(child, 'name');
|
|
658
|
+
if (nameNode) {
|
|
659
|
+
exports.push(this.createExport({
|
|
660
|
+
name: nameNode.text,
|
|
661
|
+
line: this.getPosition(child).line,
|
|
662
|
+
}));
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return exports;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
//# sourceMappingURL=rust-normalizer.js.map
|