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.
Files changed (466) hide show
  1. package/dist/boundaries/types.d.ts +1 -1
  2. package/dist/boundaries/types.d.ts.map +1 -1
  3. package/dist/call-graph/analysis/graph-builder.d.ts.map +1 -1
  4. package/dist/call-graph/analysis/graph-builder.js +2 -0
  5. package/dist/call-graph/analysis/graph-builder.js.map +1 -1
  6. package/dist/call-graph/extractors/cpp-data-access-extractor.d.ts +37 -0
  7. package/dist/call-graph/extractors/cpp-data-access-extractor.d.ts.map +1 -0
  8. package/dist/call-graph/extractors/cpp-data-access-extractor.js +467 -0
  9. package/dist/call-graph/extractors/cpp-data-access-extractor.js.map +1 -0
  10. package/dist/call-graph/extractors/cpp-hybrid-extractor.d.ts +89 -0
  11. package/dist/call-graph/extractors/cpp-hybrid-extractor.d.ts.map +1 -0
  12. package/dist/call-graph/extractors/cpp-hybrid-extractor.js +541 -0
  13. package/dist/call-graph/extractors/cpp-hybrid-extractor.js.map +1 -0
  14. package/dist/call-graph/extractors/index.d.ts +8 -1
  15. package/dist/call-graph/extractors/index.d.ts.map +1 -1
  16. package/dist/call-graph/extractors/index.js +9 -1
  17. package/dist/call-graph/extractors/index.js.map +1 -1
  18. package/dist/call-graph/extractors/regex/cpp-regex.d.ts +46 -0
  19. package/dist/call-graph/extractors/regex/cpp-regex.d.ts.map +1 -0
  20. package/dist/call-graph/extractors/regex/cpp-regex.js +325 -0
  21. package/dist/call-graph/extractors/regex/cpp-regex.js.map +1 -0
  22. package/dist/call-graph/extractors/regex/index.d.ts +2 -0
  23. package/dist/call-graph/extractors/regex/index.d.ts.map +1 -1
  24. package/dist/call-graph/extractors/regex/index.js +16 -0
  25. package/dist/call-graph/extractors/regex/index.js.map +1 -1
  26. package/dist/call-graph/extractors/regex/rust-regex.d.ts +45 -0
  27. package/dist/call-graph/extractors/regex/rust-regex.d.ts.map +1 -0
  28. package/dist/call-graph/extractors/regex/rust-regex.js +517 -0
  29. package/dist/call-graph/extractors/regex/rust-regex.js.map +1 -0
  30. package/dist/call-graph/extractors/rust-data-access-extractor.d.ts +35 -0
  31. package/dist/call-graph/extractors/rust-data-access-extractor.d.ts.map +1 -0
  32. package/dist/call-graph/extractors/rust-data-access-extractor.js +349 -0
  33. package/dist/call-graph/extractors/rust-data-access-extractor.js.map +1 -0
  34. package/dist/call-graph/extractors/rust-extractor.d.ts +125 -0
  35. package/dist/call-graph/extractors/rust-extractor.d.ts.map +1 -0
  36. package/dist/call-graph/extractors/rust-extractor.js +604 -0
  37. package/dist/call-graph/extractors/rust-extractor.js.map +1 -0
  38. package/dist/call-graph/extractors/rust-hybrid-extractor.d.ts +119 -0
  39. package/dist/call-graph/extractors/rust-hybrid-extractor.d.ts.map +1 -0
  40. package/dist/call-graph/extractors/rust-hybrid-extractor.js +548 -0
  41. package/dist/call-graph/extractors/rust-hybrid-extractor.js.map +1 -0
  42. package/dist/call-graph/index.d.ts +2 -0
  43. package/dist/call-graph/index.d.ts.map +1 -1
  44. package/dist/call-graph/index.js +4 -0
  45. package/dist/call-graph/index.js.map +1 -1
  46. package/dist/call-graph/streaming-builder.d.ts +60 -0
  47. package/dist/call-graph/streaming-builder.d.ts.map +1 -0
  48. package/dist/call-graph/streaming-builder.js +204 -0
  49. package/dist/call-graph/streaming-builder.js.map +1 -0
  50. package/dist/call-graph/types.d.ts +1 -1
  51. package/dist/call-graph/types.d.ts.map +1 -1
  52. package/dist/call-graph/unified-provider.d.ts +72 -0
  53. package/dist/call-graph/unified-provider.d.ts.map +1 -0
  54. package/dist/call-graph/unified-provider.js +502 -0
  55. package/dist/call-graph/unified-provider.js.map +1 -0
  56. package/dist/constants/extractors/regex/rust-regex.d.ts +43 -0
  57. package/dist/constants/extractors/regex/rust-regex.d.ts.map +1 -0
  58. package/dist/constants/extractors/regex/rust-regex.js +370 -0
  59. package/dist/constants/extractors/regex/rust-regex.js.map +1 -0
  60. package/dist/constants/types.d.ts +1 -1
  61. package/dist/constants/types.d.ts.map +1 -1
  62. package/dist/constants/types.js.map +1 -1
  63. package/dist/constraints/store/constraint-store.d.ts.map +1 -1
  64. package/dist/constraints/store/constraint-store.js +2 -0
  65. package/dist/constraints/store/constraint-store.js.map +1 -1
  66. package/dist/constraints/types.d.ts +1 -1
  67. package/dist/constraints/types.d.ts.map +1 -1
  68. package/dist/constraints/types.js +2 -0
  69. package/dist/constraints/types.js.map +1 -1
  70. package/dist/context/context-generator.d.ts +38 -0
  71. package/dist/context/context-generator.d.ts.map +1 -0
  72. package/dist/context/context-generator.js +392 -0
  73. package/dist/context/context-generator.js.map +1 -0
  74. package/dist/context/index.d.ts +13 -0
  75. package/dist/context/index.d.ts.map +1 -0
  76. package/dist/context/index.js +14 -0
  77. package/dist/context/index.js.map +1 -0
  78. package/dist/context/package-detector.d.ts +53 -0
  79. package/dist/context/package-detector.d.ts.map +1 -0
  80. package/dist/context/package-detector.js +672 -0
  81. package/dist/context/package-detector.js.map +1 -0
  82. package/dist/context/types.d.ts +258 -0
  83. package/dist/context/types.d.ts.map +1 -0
  84. package/dist/context/types.js +10 -0
  85. package/dist/context/types.js.map +1 -0
  86. package/dist/cpp/cpp-analyzer.d.ts +179 -0
  87. package/dist/cpp/cpp-analyzer.d.ts.map +1 -0
  88. package/dist/cpp/cpp-analyzer.js +532 -0
  89. package/dist/cpp/cpp-analyzer.js.map +1 -0
  90. package/dist/cpp/index.d.ts +9 -0
  91. package/dist/cpp/index.d.ts.map +1 -0
  92. package/dist/cpp/index.js +9 -0
  93. package/dist/cpp/index.js.map +1 -0
  94. package/dist/decisions/analyzer/decision-mining-analyzer.d.ts.map +1 -1
  95. package/dist/decisions/analyzer/decision-mining-analyzer.js +4 -0
  96. package/dist/decisions/analyzer/decision-mining-analyzer.js.map +1 -1
  97. package/dist/decisions/types.d.ts +1 -1
  98. package/dist/decisions/types.d.ts.map +1 -1
  99. package/dist/environment/extractors/cpp-env-extractor.d.ts +58 -0
  100. package/dist/environment/extractors/cpp-env-extractor.d.ts.map +1 -0
  101. package/dist/environment/extractors/cpp-env-extractor.js +298 -0
  102. package/dist/environment/extractors/cpp-env-extractor.js.map +1 -0
  103. package/dist/environment/extractors/index.d.ts +2 -0
  104. package/dist/environment/extractors/index.d.ts.map +1 -1
  105. package/dist/environment/extractors/index.js +2 -0
  106. package/dist/environment/extractors/index.js.map +1 -1
  107. package/dist/environment/extractors/rust-env-extractor.d.ts +58 -0
  108. package/dist/environment/extractors/rust-env-extractor.d.ts.map +1 -0
  109. package/dist/environment/extractors/rust-env-extractor.js +297 -0
  110. package/dist/environment/extractors/rust-env-extractor.js.map +1 -0
  111. package/dist/environment/index.d.ts +1 -1
  112. package/dist/environment/index.d.ts.map +1 -1
  113. package/dist/environment/index.js +1 -1
  114. package/dist/environment/index.js.map +1 -1
  115. package/dist/environment/types.d.ts +2 -2
  116. package/dist/environment/types.d.ts.map +1 -1
  117. package/dist/environment/types.js.map +1 -1
  118. package/dist/index.d.ts +15 -3
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +62 -2
  121. package/dist/index.js.map +1 -1
  122. package/dist/licensing/feature-guard.d.ts +103 -0
  123. package/dist/licensing/feature-guard.d.ts.map +1 -0
  124. package/dist/licensing/feature-guard.js +195 -0
  125. package/dist/licensing/feature-guard.js.map +1 -0
  126. package/dist/licensing/index.d.ts +46 -0
  127. package/dist/licensing/index.d.ts.map +1 -0
  128. package/dist/licensing/index.js +47 -0
  129. package/dist/licensing/index.js.map +1 -0
  130. package/dist/licensing/license-manager.d.ts +88 -0
  131. package/dist/licensing/license-manager.d.ts.map +1 -0
  132. package/dist/licensing/license-manager.js +251 -0
  133. package/dist/licensing/license-manager.js.map +1 -0
  134. package/dist/licensing/license-validator.d.ts +60 -0
  135. package/dist/licensing/license-validator.d.ts.map +1 -0
  136. package/dist/licensing/license-validator.js +300 -0
  137. package/dist/licensing/license-validator.js.map +1 -0
  138. package/dist/licensing/types.d.ts +76 -0
  139. package/dist/licensing/types.d.ts.map +1 -0
  140. package/dist/licensing/types.js +51 -0
  141. package/dist/licensing/types.js.map +1 -0
  142. package/dist/parsers/tree-sitter/cpp-loader.d.ts +51 -0
  143. package/dist/parsers/tree-sitter/cpp-loader.d.ts.map +1 -0
  144. package/dist/parsers/tree-sitter/cpp-loader.js +162 -0
  145. package/dist/parsers/tree-sitter/cpp-loader.js.map +1 -0
  146. package/dist/parsers/tree-sitter/index.d.ts +6 -0
  147. package/dist/parsers/tree-sitter/index.d.ts.map +1 -1
  148. package/dist/parsers/tree-sitter/index.js +16 -0
  149. package/dist/parsers/tree-sitter/index.js.map +1 -1
  150. package/dist/parsers/tree-sitter/rust-loader.d.ts +50 -0
  151. package/dist/parsers/tree-sitter/rust-loader.d.ts.map +1 -0
  152. package/dist/parsers/tree-sitter/rust-loader.js +161 -0
  153. package/dist/parsers/tree-sitter/rust-loader.js.map +1 -0
  154. package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.d.ts +198 -0
  155. package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.d.ts.map +1 -0
  156. package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.js +671 -0
  157. package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.js.map +1 -0
  158. package/dist/parsers/tree-sitter/tree-sitter-rust-parser.d.ts +180 -0
  159. package/dist/parsers/tree-sitter/tree-sitter-rust-parser.d.ts.map +1 -0
  160. package/dist/parsers/tree-sitter/tree-sitter-rust-parser.js +478 -0
  161. package/dist/parsers/tree-sitter/tree-sitter-rust-parser.js.map +1 -0
  162. package/dist/parsers/types.d.ts +1 -1
  163. package/dist/parsers/types.d.ts.map +1 -1
  164. package/dist/patterns/adapters/pattern-store-adapter.d.ts.map +1 -1
  165. package/dist/patterns/adapters/pattern-store-adapter.js +35 -10
  166. package/dist/patterns/adapters/pattern-store-adapter.js.map +1 -1
  167. package/dist/quality-gates/gates/base-gate.d.ts +71 -0
  168. package/dist/quality-gates/gates/base-gate.d.ts.map +1 -0
  169. package/dist/quality-gates/gates/base-gate.js +178 -0
  170. package/dist/quality-gates/gates/base-gate.js.map +1 -0
  171. package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.d.ts +62 -0
  172. package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.d.ts.map +1 -0
  173. package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.js +255 -0
  174. package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.js.map +1 -0
  175. package/dist/quality-gates/gates/constraint-verification/index.d.ts +7 -0
  176. package/dist/quality-gates/gates/constraint-verification/index.d.ts.map +1 -0
  177. package/dist/quality-gates/gates/constraint-verification/index.js +7 -0
  178. package/dist/quality-gates/gates/constraint-verification/index.js.map +1 -0
  179. package/dist/quality-gates/gates/custom-rules/custom-rules-gate.d.ts +73 -0
  180. package/dist/quality-gates/gates/custom-rules/custom-rules-gate.d.ts.map +1 -0
  181. package/dist/quality-gates/gates/custom-rules/custom-rules-gate.js +351 -0
  182. package/dist/quality-gates/gates/custom-rules/custom-rules-gate.js.map +1 -0
  183. package/dist/quality-gates/gates/custom-rules/index.d.ts +7 -0
  184. package/dist/quality-gates/gates/custom-rules/index.d.ts.map +1 -0
  185. package/dist/quality-gates/gates/custom-rules/index.js +7 -0
  186. package/dist/quality-gates/gates/custom-rules/index.js.map +1 -0
  187. package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.d.ts +61 -0
  188. package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.d.ts.map +1 -0
  189. package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.js +318 -0
  190. package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.js.map +1 -0
  191. package/dist/quality-gates/gates/impact-simulation/index.d.ts +7 -0
  192. package/dist/quality-gates/gates/impact-simulation/index.d.ts.map +1 -0
  193. package/dist/quality-gates/gates/impact-simulation/index.js +7 -0
  194. package/dist/quality-gates/gates/impact-simulation/index.js.map +1 -0
  195. package/dist/quality-gates/gates/index.d.ts +13 -0
  196. package/dist/quality-gates/gates/index.d.ts.map +1 -0
  197. package/dist/quality-gates/gates/index.js +13 -0
  198. package/dist/quality-gates/gates/index.js.map +1 -0
  199. package/dist/quality-gates/gates/pattern-compliance/index.d.ts +7 -0
  200. package/dist/quality-gates/gates/pattern-compliance/index.d.ts.map +1 -0
  201. package/dist/quality-gates/gates/pattern-compliance/index.js +7 -0
  202. package/dist/quality-gates/gates/pattern-compliance/index.js.map +1 -0
  203. package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.d.ts +61 -0
  204. package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.d.ts.map +1 -0
  205. package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.js +261 -0
  206. package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.js.map +1 -0
  207. package/dist/quality-gates/gates/regression-detection/index.d.ts +7 -0
  208. package/dist/quality-gates/gates/regression-detection/index.d.ts.map +1 -0
  209. package/dist/quality-gates/gates/regression-detection/index.js +7 -0
  210. package/dist/quality-gates/gates/regression-detection/index.js.map +1 -0
  211. package/dist/quality-gates/gates/regression-detection/regression-detection-gate.d.ts +69 -0
  212. package/dist/quality-gates/gates/regression-detection/regression-detection-gate.d.ts.map +1 -0
  213. package/dist/quality-gates/gates/regression-detection/regression-detection-gate.js +330 -0
  214. package/dist/quality-gates/gates/regression-detection/regression-detection-gate.js.map +1 -0
  215. package/dist/quality-gates/gates/security-boundary/index.d.ts +7 -0
  216. package/dist/quality-gates/gates/security-boundary/index.d.ts.map +1 -0
  217. package/dist/quality-gates/gates/security-boundary/index.js +7 -0
  218. package/dist/quality-gates/gates/security-boundary/index.js.map +1 -0
  219. package/dist/quality-gates/gates/security-boundary/security-boundary-gate.d.ts +65 -0
  220. package/dist/quality-gates/gates/security-boundary/security-boundary-gate.d.ts.map +1 -0
  221. package/dist/quality-gates/gates/security-boundary/security-boundary-gate.js +307 -0
  222. package/dist/quality-gates/gates/security-boundary/security-boundary-gate.js.map +1 -0
  223. package/dist/quality-gates/index.d.ts +35 -0
  224. package/dist/quality-gates/index.d.ts.map +1 -0
  225. package/dist/quality-gates/index.js +43 -0
  226. package/dist/quality-gates/index.js.map +1 -0
  227. package/dist/quality-gates/orchestrator/gate-orchestrator.d.ts +79 -0
  228. package/dist/quality-gates/orchestrator/gate-orchestrator.d.ts.map +1 -0
  229. package/dist/quality-gates/orchestrator/gate-orchestrator.js +314 -0
  230. package/dist/quality-gates/orchestrator/gate-orchestrator.js.map +1 -0
  231. package/dist/quality-gates/orchestrator/gate-registry.d.ts +53 -0
  232. package/dist/quality-gates/orchestrator/gate-registry.d.ts.map +1 -0
  233. package/dist/quality-gates/orchestrator/gate-registry.js +141 -0
  234. package/dist/quality-gates/orchestrator/gate-registry.js.map +1 -0
  235. package/dist/quality-gates/orchestrator/index.d.ts +10 -0
  236. package/dist/quality-gates/orchestrator/index.d.ts.map +1 -0
  237. package/dist/quality-gates/orchestrator/index.js +10 -0
  238. package/dist/quality-gates/orchestrator/index.js.map +1 -0
  239. package/dist/quality-gates/orchestrator/parallel-executor.d.ts +35 -0
  240. package/dist/quality-gates/orchestrator/parallel-executor.d.ts.map +1 -0
  241. package/dist/quality-gates/orchestrator/parallel-executor.js +70 -0
  242. package/dist/quality-gates/orchestrator/parallel-executor.js.map +1 -0
  243. package/dist/quality-gates/orchestrator/result-aggregator.d.ts +27 -0
  244. package/dist/quality-gates/orchestrator/result-aggregator.d.ts.map +1 -0
  245. package/dist/quality-gates/orchestrator/result-aggregator.js +70 -0
  246. package/dist/quality-gates/orchestrator/result-aggregator.js.map +1 -0
  247. package/dist/quality-gates/policy/default-policies.d.ts +14 -0
  248. package/dist/quality-gates/policy/default-policies.d.ts.map +1 -0
  249. package/dist/quality-gates/policy/default-policies.js +266 -0
  250. package/dist/quality-gates/policy/default-policies.js.map +1 -0
  251. package/dist/quality-gates/policy/index.d.ts +9 -0
  252. package/dist/quality-gates/policy/index.d.ts.map +1 -0
  253. package/dist/quality-gates/policy/index.js +9 -0
  254. package/dist/quality-gates/policy/index.js.map +1 -0
  255. package/dist/quality-gates/policy/policy-evaluator.d.ts +43 -0
  256. package/dist/quality-gates/policy/policy-evaluator.d.ts.map +1 -0
  257. package/dist/quality-gates/policy/policy-evaluator.js +136 -0
  258. package/dist/quality-gates/policy/policy-evaluator.js.map +1 -0
  259. package/dist/quality-gates/policy/policy-loader.d.ts +72 -0
  260. package/dist/quality-gates/policy/policy-loader.d.ts.map +1 -0
  261. package/dist/quality-gates/policy/policy-loader.js +228 -0
  262. package/dist/quality-gates/policy/policy-loader.js.map +1 -0
  263. package/dist/quality-gates/reporters/github-reporter.d.ts +19 -0
  264. package/dist/quality-gates/reporters/github-reporter.d.ts.map +1 -0
  265. package/dist/quality-gates/reporters/github-reporter.js +49 -0
  266. package/dist/quality-gates/reporters/github-reporter.js.map +1 -0
  267. package/dist/quality-gates/reporters/gitlab-reporter.d.ts +20 -0
  268. package/dist/quality-gates/reporters/gitlab-reporter.d.ts.map +1 -0
  269. package/dist/quality-gates/reporters/gitlab-reporter.js +42 -0
  270. package/dist/quality-gates/reporters/gitlab-reporter.js.map +1 -0
  271. package/dist/quality-gates/reporters/index.d.ts +12 -0
  272. package/dist/quality-gates/reporters/index.d.ts.map +1 -0
  273. package/dist/quality-gates/reporters/index.js +12 -0
  274. package/dist/quality-gates/reporters/index.js.map +1 -0
  275. package/dist/quality-gates/reporters/json-reporter.d.ts +18 -0
  276. package/dist/quality-gates/reporters/json-reporter.d.ts.map +1 -0
  277. package/dist/quality-gates/reporters/json-reporter.js +51 -0
  278. package/dist/quality-gates/reporters/json-reporter.js.map +1 -0
  279. package/dist/quality-gates/reporters/reporter-interface.d.ts +35 -0
  280. package/dist/quality-gates/reporters/reporter-interface.d.ts.map +1 -0
  281. package/dist/quality-gates/reporters/reporter-interface.js +22 -0
  282. package/dist/quality-gates/reporters/reporter-interface.js.map +1 -0
  283. package/dist/quality-gates/reporters/sarif-reporter.d.ts +22 -0
  284. package/dist/quality-gates/reporters/sarif-reporter.d.ts.map +1 -0
  285. package/dist/quality-gates/reporters/sarif-reporter.js +85 -0
  286. package/dist/quality-gates/reporters/sarif-reporter.js.map +1 -0
  287. package/dist/quality-gates/reporters/text-reporter.d.ts +18 -0
  288. package/dist/quality-gates/reporters/text-reporter.d.ts.map +1 -0
  289. package/dist/quality-gates/reporters/text-reporter.js +92 -0
  290. package/dist/quality-gates/reporters/text-reporter.js.map +1 -0
  291. package/dist/quality-gates/store/gate-run-store.d.ts +37 -0
  292. package/dist/quality-gates/store/gate-run-store.d.ts.map +1 -0
  293. package/dist/quality-gates/store/gate-run-store.js +104 -0
  294. package/dist/quality-gates/store/gate-run-store.js.map +1 -0
  295. package/dist/quality-gates/store/index.d.ts +8 -0
  296. package/dist/quality-gates/store/index.d.ts.map +1 -0
  297. package/dist/quality-gates/store/index.js +8 -0
  298. package/dist/quality-gates/store/index.js.map +1 -0
  299. package/dist/quality-gates/store/snapshot-store.d.ts +41 -0
  300. package/dist/quality-gates/store/snapshot-store.d.ts.map +1 -0
  301. package/dist/quality-gates/store/snapshot-store.js +117 -0
  302. package/dist/quality-gates/store/snapshot-store.js.map +1 -0
  303. package/dist/quality-gates/types.d.ts +992 -0
  304. package/dist/quality-gates/types.d.ts.map +1 -0
  305. package/dist/quality-gates/types.js +14 -0
  306. package/dist/quality-gates/types.js.map +1 -0
  307. package/dist/rust/index.d.ts +7 -0
  308. package/dist/rust/index.d.ts.map +1 -0
  309. package/dist/rust/index.js +8 -0
  310. package/dist/rust/index.js.map +1 -0
  311. package/dist/rust/rust-analyzer.d.ts +185 -0
  312. package/dist/rust/rust-analyzer.d.ts.map +1 -0
  313. package/dist/rust/rust-analyzer.js +538 -0
  314. package/dist/rust/rust-analyzer.js.map +1 -0
  315. package/dist/scanner/file-walker.d.ts.map +1 -1
  316. package/dist/scanner/file-walker.js +11 -0
  317. package/dist/scanner/file-walker.js.map +1 -1
  318. package/dist/simulation/simulation-engine.d.ts +6 -0
  319. package/dist/simulation/simulation-engine.d.ts.map +1 -1
  320. package/dist/simulation/simulation-engine.js +6 -0
  321. package/dist/simulation/simulation-engine.js.map +1 -1
  322. package/dist/speculative/types.d.ts +1 -1
  323. package/dist/speculative/types.d.ts.map +1 -1
  324. package/dist/speculative/types.js +2 -0
  325. package/dist/speculative/types.js.map +1 -1
  326. package/dist/store/project-config.d.ts +19 -0
  327. package/dist/store/project-config.d.ts.map +1 -1
  328. package/dist/store/project-config.js.map +1 -1
  329. package/dist/telemetry/index.d.ts +10 -0
  330. package/dist/telemetry/index.d.ts.map +1 -0
  331. package/dist/telemetry/index.js +11 -0
  332. package/dist/telemetry/index.js.map +1 -0
  333. package/dist/telemetry/telemetry-client.d.ts +127 -0
  334. package/dist/telemetry/telemetry-client.d.ts.map +1 -0
  335. package/dist/telemetry/telemetry-client.js +373 -0
  336. package/dist/telemetry/telemetry-client.js.map +1 -0
  337. package/dist/telemetry/types.d.ts +160 -0
  338. package/dist/telemetry/types.d.ts.map +1 -0
  339. package/dist/telemetry/types.js +27 -0
  340. package/dist/telemetry/types.js.map +1 -0
  341. package/dist/test-topology/extractors/cpp-test-extractor.d.ts +38 -0
  342. package/dist/test-topology/extractors/cpp-test-extractor.d.ts.map +1 -0
  343. package/dist/test-topology/extractors/cpp-test-extractor.js +507 -0
  344. package/dist/test-topology/extractors/cpp-test-extractor.js.map +1 -0
  345. package/dist/test-topology/extractors/index.d.ts +2 -0
  346. package/dist/test-topology/extractors/index.d.ts.map +1 -1
  347. package/dist/test-topology/extractors/index.js +2 -0
  348. package/dist/test-topology/extractors/index.js.map +1 -1
  349. package/dist/test-topology/extractors/regex/index.d.ts +1 -0
  350. package/dist/test-topology/extractors/regex/index.d.ts.map +1 -1
  351. package/dist/test-topology/extractors/regex/index.js +4 -0
  352. package/dist/test-topology/extractors/regex/index.js.map +1 -1
  353. package/dist/test-topology/extractors/regex/rust-test-regex.d.ts +66 -0
  354. package/dist/test-topology/extractors/regex/rust-test-regex.d.ts.map +1 -0
  355. package/dist/test-topology/extractors/regex/rust-test-regex.js +565 -0
  356. package/dist/test-topology/extractors/regex/rust-test-regex.js.map +1 -0
  357. package/dist/test-topology/extractors/rust-test-extractor.d.ts +49 -0
  358. package/dist/test-topology/extractors/rust-test-extractor.d.ts.map +1 -0
  359. package/dist/test-topology/extractors/rust-test-extractor.js +422 -0
  360. package/dist/test-topology/extractors/rust-test-extractor.js.map +1 -0
  361. package/dist/test-topology/hybrid-test-topology-analyzer.d.ts.map +1 -1
  362. package/dist/test-topology/hybrid-test-topology-analyzer.js +2 -0
  363. package/dist/test-topology/hybrid-test-topology-analyzer.js.map +1 -1
  364. package/dist/test-topology/test-topology-analyzer.d.ts.map +1 -1
  365. package/dist/test-topology/test-topology-analyzer.js +2 -0
  366. package/dist/test-topology/test-topology-analyzer.js.map +1 -1
  367. package/dist/test-topology/types.d.ts +2 -2
  368. package/dist/test-topology/types.d.ts.map +1 -1
  369. package/dist/unified-provider/integration/unified-scanner.d.ts.map +1 -1
  370. package/dist/unified-provider/integration/unified-scanner.js +3 -0
  371. package/dist/unified-provider/integration/unified-scanner.js.map +1 -1
  372. package/dist/unified-provider/matching/diesel-matcher.d.ts +33 -0
  373. package/dist/unified-provider/matching/diesel-matcher.d.ts.map +1 -0
  374. package/dist/unified-provider/matching/diesel-matcher.js +210 -0
  375. package/dist/unified-provider/matching/diesel-matcher.js.map +1 -0
  376. package/dist/unified-provider/matching/index.d.ts +3 -1
  377. package/dist/unified-provider/matching/index.d.ts.map +1 -1
  378. package/dist/unified-provider/matching/index.js +4 -1
  379. package/dist/unified-provider/matching/index.js.map +1 -1
  380. package/dist/unified-provider/matching/matcher-registry.d.ts.map +1 -1
  381. package/dist/unified-provider/matching/matcher-registry.js +7 -2
  382. package/dist/unified-provider/matching/matcher-registry.js.map +1 -1
  383. package/dist/unified-provider/matching/seaorm-matcher.d.ts +35 -0
  384. package/dist/unified-provider/matching/seaorm-matcher.d.ts.map +1 -0
  385. package/dist/unified-provider/matching/seaorm-matcher.js +200 -0
  386. package/dist/unified-provider/matching/seaorm-matcher.js.map +1 -0
  387. package/dist/unified-provider/matching/sqlx-matcher.d.ts +19 -24
  388. package/dist/unified-provider/matching/sqlx-matcher.d.ts.map +1 -1
  389. package/dist/unified-provider/matching/sqlx-matcher.js +171 -149
  390. package/dist/unified-provider/matching/sqlx-matcher.js.map +1 -1
  391. package/dist/unified-provider/normalization/cpp-normalizer.d.ts +62 -0
  392. package/dist/unified-provider/normalization/cpp-normalizer.d.ts.map +1 -0
  393. package/dist/unified-provider/normalization/cpp-normalizer.js +581 -0
  394. package/dist/unified-provider/normalization/cpp-normalizer.js.map +1 -0
  395. package/dist/unified-provider/normalization/index.d.ts +2 -0
  396. package/dist/unified-provider/normalization/index.d.ts.map +1 -1
  397. package/dist/unified-provider/normalization/index.js +11 -1
  398. package/dist/unified-provider/normalization/index.js.map +1 -1
  399. package/dist/unified-provider/normalization/rust-normalizer.d.ts +71 -0
  400. package/dist/unified-provider/normalization/rust-normalizer.d.ts.map +1 -0
  401. package/dist/unified-provider/normalization/rust-normalizer.js +670 -0
  402. package/dist/unified-provider/normalization/rust-normalizer.js.map +1 -0
  403. package/dist/unified-provider/parsing/parser-registry.d.ts.map +1 -1
  404. package/dist/unified-provider/parsing/parser-registry.js +62 -1
  405. package/dist/unified-provider/parsing/parser-registry.js.map +1 -1
  406. package/dist/unified-provider/provider/unified-language-provider.js +1 -1
  407. package/dist/unified-provider/provider/unified-language-provider.js.map +1 -1
  408. package/dist/unified-provider/types.d.ts +1 -1
  409. package/dist/unified-provider/types.d.ts.map +1 -1
  410. package/dist/wrappers/index.d.ts.map +1 -1
  411. package/dist/wrappers/index.js +2 -0
  412. package/dist/wrappers/index.js.map +1 -1
  413. package/dist/wrappers/integration/adapter.d.ts.map +1 -1
  414. package/dist/wrappers/integration/adapter.js +2 -0
  415. package/dist/wrappers/integration/adapter.js.map +1 -1
  416. package/dist/wrappers/integration/scanner.d.ts.map +1 -1
  417. package/dist/wrappers/integration/scanner.js +2 -0
  418. package/dist/wrappers/integration/scanner.js.map +1 -1
  419. package/dist/wrappers/primitives/registry.d.ts +18 -0
  420. package/dist/wrappers/primitives/registry.d.ts.map +1 -1
  421. package/dist/wrappers/primitives/registry.js +190 -0
  422. package/dist/wrappers/primitives/registry.js.map +1 -1
  423. package/dist/wrappers/types.d.ts +1 -1
  424. package/dist/wrappers/types.d.ts.map +1 -1
  425. package/package.json +5 -2
  426. package/LICENSE +0 -21
  427. package/dist/lake/lake.bak/index-store.d.ts +0 -82
  428. package/dist/lake/lake.bak/index-store.d.ts.map +0 -1
  429. package/dist/lake/lake.bak/index-store.js +0 -357
  430. package/dist/lake/lake.bak/index-store.js.map +0 -1
  431. package/dist/lake/lake.bak/index.d.ts +0 -81
  432. package/dist/lake/lake.bak/index.d.ts.map +0 -1
  433. package/dist/lake/lake.bak/index.js +0 -114
  434. package/dist/lake/lake.bak/index.js.map +0 -1
  435. package/dist/lake/lake.bak/manifest-store.d.ts +0 -51
  436. package/dist/lake/lake.bak/manifest-store.d.ts.map +0 -1
  437. package/dist/lake/lake.bak/manifest-store.js +0 -347
  438. package/dist/lake/lake.bak/manifest-store.js.map +0 -1
  439. package/dist/lake/lake.bak/query-engine.d.ts +0 -112
  440. package/dist/lake/lake.bak/query-engine.d.ts.map +0 -1
  441. package/dist/lake/lake.bak/query-engine.js +0 -370
  442. package/dist/lake/lake.bak/query-engine.js.map +0 -1
  443. package/dist/lake/lake.bak/types.d.ts +0 -428
  444. package/dist/lake/lake.bak/types.d.ts.map +0 -1
  445. package/dist/lake/lake.bak/types.js +0 -46
  446. package/dist/lake/lake.bak/types.js.map +0 -1
  447. package/dist/lake/lake.bak/view-materializer.d.ts +0 -70
  448. package/dist/lake/lake.bak/view-materializer.d.ts.map +0 -1
  449. package/dist/lake/lake.bak/view-materializer.js +0 -314
  450. package/dist/lake/lake.bak/view-materializer.js.map +0 -1
  451. package/dist/lake/lake.bak/view-store.d.ts +0 -57
  452. package/dist/lake/lake.bak/view-store.d.ts.map +0 -1
  453. package/dist/lake/lake.bak/view-store.js +0 -348
  454. package/dist/lake/lake.bak/view-store.js.map +0 -1
  455. package/dist/unified-provider/migration/deprecated-extractors.d.ts +0 -104
  456. package/dist/unified-provider/migration/deprecated-extractors.d.ts.map +0 -1
  457. package/dist/unified-provider/migration/deprecated-extractors.js +0 -129
  458. package/dist/unified-provider/migration/deprecated-extractors.js.map +0 -1
  459. package/dist/unified-provider/migration/deprecated-scanner.d.ts +0 -40
  460. package/dist/unified-provider/migration/deprecated-scanner.d.ts.map +0 -1
  461. package/dist/unified-provider/migration/deprecated-scanner.js +0 -49
  462. package/dist/unified-provider/migration/deprecated-scanner.js.map +0 -1
  463. package/dist/unified-provider/migration/index.d.ts +0 -41
  464. package/dist/unified-provider/migration/index.d.ts.map +0 -1
  465. package/dist/unified-provider/migration/index.js +0 -43
  466. package/dist/unified-provider/migration/index.js.map +0 -1
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Drift Licensing System - Types
3
+ *
4
+ * @license Apache-2.0
5
+ *
6
+ * Defines the license tiers and feature flags for OSS vs Enterprise.
7
+ */
8
+ export type LicenseTier = 'community' | 'team' | 'enterprise';
9
+ export interface License {
10
+ /** License key (JWT or simple key) */
11
+ key: string;
12
+ /** License tier */
13
+ tier: LicenseTier;
14
+ /** Organization name */
15
+ organization: string;
16
+ /** Licensed seats (0 = unlimited for enterprise) */
17
+ seats: number;
18
+ /** Expiration date (ISO string) */
19
+ expiresAt: string;
20
+ /** Features explicitly enabled */
21
+ features: EnterpriseFeature[];
22
+ /** License metadata */
23
+ metadata: {
24
+ issuedAt: string;
25
+ issuer: string;
26
+ version: string;
27
+ };
28
+ }
29
+ /**
30
+ * All gated features in Drift.
31
+ *
32
+ * PHILOSOPHY: Solo devs and small teams can use Drift completely free.
33
+ * Enterprise pays for managing patterns across teams at scale.
34
+ *
35
+ * FREE (Community):
36
+ * - All scanning, pattern detection, analysis
37
+ * - drift check --ci with all output formats (json, github, gitlab, sarif)
38
+ * - Basic thresholds and fail conditions
39
+ * - Single-repo usage with full functionality
40
+ *
41
+ * TEAM/ENTERPRISE: Scale and governance features only.
42
+ */
43
+ export type EnterpriseFeature = 'gate:policy-engine' | 'gate:regression-detection' | 'gate:custom-rules' | 'gate:impact-simulation' | 'gate:security-boundary' | 'governance:multi-repo' | 'governance:team-analytics' | 'governance:audit-trail' | 'integration:webhooks' | 'integration:jira' | 'integration:slack' | 'advanced:self-hosted-models' | 'advanced:custom-detectors' | 'advanced:api-access' | 'dashboard:team-view' | 'dashboard:trends' | 'dashboard:export';
44
+ /**
45
+ * Feature tier mapping - which tier unlocks which features
46
+ *
47
+ * NOTE: Basic CI features are NOT gated:
48
+ * - drift check --ci
49
+ * - --format json/github/gitlab/sarif
50
+ * - --fail-on thresholds
51
+ *
52
+ * These are all FREE for everyone. We only gate scale/governance features.
53
+ */
54
+ export declare const FEATURE_TIERS: Record<EnterpriseFeature, LicenseTier>;
55
+ /**
56
+ * Tier hierarchy for comparison
57
+ */
58
+ export declare const TIER_HIERARCHY: Record<LicenseTier, number>;
59
+ export interface LicenseValidationResult {
60
+ valid: boolean;
61
+ tier: LicenseTier;
62
+ features: EnterpriseFeature[];
63
+ expiresAt: string | null;
64
+ error?: string | undefined;
65
+ warnings?: string[] | undefined;
66
+ }
67
+ export interface FeatureCheckResult {
68
+ allowed: boolean;
69
+ feature: EnterpriseFeature;
70
+ requiredTier: LicenseTier;
71
+ currentTier: LicenseTier;
72
+ message: string;
73
+ upgradeUrl?: string | undefined;
74
+ }
75
+ export type LicenseSource = 'environment' | 'file' | 'config' | 'none';
76
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/licensing/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,MAAM,GAAG,YAAY,CAAC;AAE9D,MAAM,WAAW,OAAO;IACtB,sCAAsC;IACtC,GAAG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O,EAAE,iBAAiB,CAAC;IAC3B,YAAY,EAAE,WAAW,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAMD,MAAM,MAAM,aAAa,GACrB,aAAa,GACb,MAAM,GACN,QAAQ,GACR,MAAM,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Drift Licensing System - Types
3
+ *
4
+ * @license Apache-2.0
5
+ *
6
+ * Defines the license tiers and feature flags for OSS vs Enterprise.
7
+ */
8
+ /**
9
+ * Feature tier mapping - which tier unlocks which features
10
+ *
11
+ * NOTE: Basic CI features are NOT gated:
12
+ * - drift check --ci
13
+ * - --format json/github/gitlab/sarif
14
+ * - --fail-on thresholds
15
+ *
16
+ * These are all FREE for everyone. We only gate scale/governance features.
17
+ */
18
+ export const FEATURE_TIERS = {
19
+ // Team tier features - Advanced policy management
20
+ 'gate:policy-engine': 'team',
21
+ 'gate:regression-detection': 'team',
22
+ 'gate:custom-rules': 'team',
23
+ 'dashboard:trends': 'team',
24
+ 'dashboard:export': 'team',
25
+ // Enterprise tier features - Deep analysis
26
+ 'gate:impact-simulation': 'enterprise',
27
+ 'gate:security-boundary': 'enterprise',
28
+ // Enterprise tier features - Multi-team governance
29
+ 'governance:multi-repo': 'enterprise',
30
+ 'governance:team-analytics': 'enterprise',
31
+ 'governance:audit-trail': 'enterprise',
32
+ // Enterprise tier features - External integrations
33
+ 'integration:webhooks': 'enterprise',
34
+ 'integration:jira': 'enterprise',
35
+ 'integration:slack': 'enterprise',
36
+ // Enterprise tier features - Customization at scale
37
+ 'advanced:self-hosted-models': 'enterprise',
38
+ 'advanced:custom-detectors': 'enterprise',
39
+ 'advanced:api-access': 'enterprise',
40
+ // Enterprise tier features - Team dashboard
41
+ 'dashboard:team-view': 'enterprise',
42
+ };
43
+ /**
44
+ * Tier hierarchy for comparison
45
+ */
46
+ export const TIER_HIERARCHY = {
47
+ community: 0,
48
+ team: 1,
49
+ enterprise: 2,
50
+ };
51
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/licensing/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoFH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAA2C;IACnE,kDAAkD;IAClD,oBAAoB,EAAE,MAAM;IAC5B,2BAA2B,EAAE,MAAM;IACnC,mBAAmB,EAAE,MAAM;IAC3B,kBAAkB,EAAE,MAAM;IAC1B,kBAAkB,EAAE,MAAM;IAE1B,2CAA2C;IAC3C,wBAAwB,EAAE,YAAY;IACtC,wBAAwB,EAAE,YAAY;IAEtC,mDAAmD;IACnD,uBAAuB,EAAE,YAAY;IACrC,2BAA2B,EAAE,YAAY;IACzC,wBAAwB,EAAE,YAAY;IAEtC,mDAAmD;IACnD,sBAAsB,EAAE,YAAY;IACpC,kBAAkB,EAAE,YAAY;IAChC,mBAAmB,EAAE,YAAY;IAEjC,oDAAoD;IACpD,6BAA6B,EAAE,YAAY;IAC3C,2BAA2B,EAAE,YAAY;IACzC,qBAAqB,EAAE,YAAY;IAEnC,4CAA4C;IAC5C,qBAAqB,EAAE,YAAY;CACpC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgC;IACzD,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,CAAC;IACP,UAAU,EAAE,CAAC;CACd,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Tree-sitter C++ Loader
3
+ *
4
+ * Handles loading tree-sitter and tree-sitter-cpp with graceful fallback.
5
+ * Provides functions to check availability and access the parser/language.
6
+ *
7
+ * @requirements C++ Language Support
8
+ * @license Apache-2.0
9
+ */
10
+ import type { TreeSitterParser, TreeSitterLanguage } from './types.js';
11
+ /**
12
+ * Check if tree-sitter-cpp is available.
13
+ *
14
+ * This function attempts to load tree-sitter and tree-sitter-cpp
15
+ * on first call and caches the result.
16
+ *
17
+ * @returns true if tree-sitter-cpp is available and working
18
+ */
19
+ export declare function isCppTreeSitterAvailable(): boolean;
20
+ /**
21
+ * Get the C++ language for tree-sitter.
22
+ *
23
+ * @returns TreeSitter C++ language
24
+ * @throws Error if tree-sitter-cpp is not available
25
+ */
26
+ export declare function getCppLanguage(): TreeSitterLanguage;
27
+ /**
28
+ * Get the tree-sitter Parser constructor for C++.
29
+ *
30
+ * @returns TreeSitter Parser constructor
31
+ * @throws Error if tree-sitter is not available
32
+ */
33
+ export declare function getCppTreeSitter(): new () => TreeSitterParser;
34
+ /**
35
+ * Create a new tree-sitter parser instance configured for C++.
36
+ *
37
+ * @returns Configured TreeSitter parser
38
+ * @throws Error if tree-sitter-cpp is not available
39
+ */
40
+ export declare function createCppParser(): TreeSitterParser;
41
+ /**
42
+ * Get the loading error message if tree-sitter-cpp failed to load.
43
+ *
44
+ * @returns Error message or null if no error
45
+ */
46
+ export declare function getCppLoadingError(): string | null;
47
+ /**
48
+ * Reset the loader state (useful for testing).
49
+ */
50
+ export declare function resetCppLoader(): void;
51
+ //# sourceMappingURL=cpp-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cpp-loader.d.ts","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/cpp-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAyBvE;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAelD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,kBAAkB,CAUnD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,gBAAgB,CAU7D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,gBAAgB,CAgBlD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAIlD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAKrC"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Tree-sitter C++ Loader
3
+ *
4
+ * Handles loading tree-sitter and tree-sitter-cpp with graceful fallback.
5
+ * Provides functions to check availability and access the parser/language.
6
+ *
7
+ * @requirements C++ Language Support
8
+ * @license Apache-2.0
9
+ */
10
+ import { createRequire } from 'node:module';
11
+ // Create require function for ESM compatibility
12
+ const require = createRequire(import.meta.url);
13
+ // ============================================
14
+ // Module State
15
+ // ============================================
16
+ /** Whether tree-sitter-cpp is available */
17
+ let cppAvailable = null;
18
+ /** Cached tree-sitter module */
19
+ let cachedTreeSitter = null;
20
+ /** Cached C++ language */
21
+ let cachedCppLanguage = null;
22
+ /** Loading error message if any */
23
+ let loadingError = null;
24
+ // ============================================
25
+ // Public API
26
+ // ============================================
27
+ /**
28
+ * Check if tree-sitter-cpp is available.
29
+ *
30
+ * This function attempts to load tree-sitter and tree-sitter-cpp
31
+ * on first call and caches the result.
32
+ *
33
+ * @returns true if tree-sitter-cpp is available and working
34
+ */
35
+ export function isCppTreeSitterAvailable() {
36
+ if (cppAvailable !== null) {
37
+ return cppAvailable;
38
+ }
39
+ try {
40
+ loadCppTreeSitter();
41
+ cppAvailable = true;
42
+ }
43
+ catch (error) {
44
+ cppAvailable = false;
45
+ loadingError = error instanceof Error ? error.message : 'Unknown error loading tree-sitter-cpp';
46
+ logDebug(`tree-sitter-cpp not available: ${loadingError}`);
47
+ }
48
+ return cppAvailable;
49
+ }
50
+ /**
51
+ * Get the C++ language for tree-sitter.
52
+ *
53
+ * @returns TreeSitter C++ language
54
+ * @throws Error if tree-sitter-cpp is not available
55
+ */
56
+ export function getCppLanguage() {
57
+ if (!isCppTreeSitterAvailable()) {
58
+ throw new Error(`tree-sitter-cpp is not available: ${loadingError ?? 'unknown error'}`);
59
+ }
60
+ if (!cachedCppLanguage) {
61
+ throw new Error('tree-sitter-cpp language not loaded');
62
+ }
63
+ return cachedCppLanguage;
64
+ }
65
+ /**
66
+ * Get the tree-sitter Parser constructor for C++.
67
+ *
68
+ * @returns TreeSitter Parser constructor
69
+ * @throws Error if tree-sitter is not available
70
+ */
71
+ export function getCppTreeSitter() {
72
+ if (!isCppTreeSitterAvailable()) {
73
+ throw new Error(`tree-sitter-cpp is not available: ${loadingError ?? 'unknown error'}`);
74
+ }
75
+ if (!cachedTreeSitter) {
76
+ throw new Error('tree-sitter module not loaded');
77
+ }
78
+ return cachedTreeSitter;
79
+ }
80
+ /**
81
+ * Create a new tree-sitter parser instance configured for C++.
82
+ *
83
+ * @returns Configured TreeSitter parser
84
+ * @throws Error if tree-sitter-cpp is not available
85
+ */
86
+ export function createCppParser() {
87
+ if (!isCppTreeSitterAvailable()) {
88
+ throw new Error(`tree-sitter-cpp is not available: ${loadingError ?? 'unknown error'}`);
89
+ }
90
+ if (!cachedTreeSitter) {
91
+ throw new Error('tree-sitter module not loaded');
92
+ }
93
+ const Parser = cachedTreeSitter;
94
+ const language = getCppLanguage();
95
+ const parser = new Parser();
96
+ parser.setLanguage(language);
97
+ return parser;
98
+ }
99
+ /**
100
+ * Get the loading error message if tree-sitter-cpp failed to load.
101
+ *
102
+ * @returns Error message or null if no error
103
+ */
104
+ export function getCppLoadingError() {
105
+ // Ensure we've attempted to load
106
+ isCppTreeSitterAvailable();
107
+ return loadingError;
108
+ }
109
+ /**
110
+ * Reset the loader state (useful for testing).
111
+ */
112
+ export function resetCppLoader() {
113
+ cppAvailable = null;
114
+ cachedTreeSitter = null;
115
+ cachedCppLanguage = null;
116
+ loadingError = null;
117
+ }
118
+ // ============================================
119
+ // Internal Functions
120
+ // ============================================
121
+ /**
122
+ * Attempt to load tree-sitter and tree-sitter-cpp.
123
+ *
124
+ * @throws Error if loading fails
125
+ */
126
+ function loadCppTreeSitter() {
127
+ // Skip if already loaded
128
+ if (cachedTreeSitter && cachedCppLanguage) {
129
+ return;
130
+ }
131
+ try {
132
+ // Dynamic require for optional dependencies
133
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
134
+ cachedTreeSitter = require('tree-sitter');
135
+ }
136
+ catch (error) {
137
+ throw new Error(`Failed to load tree-sitter: ${error instanceof Error ? error.message : 'unknown error'}. ` +
138
+ 'Install with: pnpm add tree-sitter tree-sitter-cpp');
139
+ }
140
+ try {
141
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
142
+ cachedCppLanguage = require('tree-sitter-cpp');
143
+ }
144
+ catch (error) {
145
+ // Clear tree-sitter cache since we can't use it without C++
146
+ cachedTreeSitter = null;
147
+ throw new Error(`Failed to load tree-sitter-cpp: ${error instanceof Error ? error.message : 'unknown error'}. ` +
148
+ 'Install with: pnpm add tree-sitter-cpp');
149
+ }
150
+ logDebug('tree-sitter and tree-sitter-cpp loaded successfully');
151
+ }
152
+ /**
153
+ * Log debug message if debug mode is enabled.
154
+ *
155
+ * @param message - Message to log
156
+ */
157
+ function logDebug(message) {
158
+ if (process.env['DRIFT_PARSER_DEBUG'] === 'true') {
159
+ console.debug(`[cpp-loader] ${message}`);
160
+ }
161
+ }
162
+ //# sourceMappingURL=cpp-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cpp-loader.js","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/cpp-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,gDAAgD;AAChD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,+CAA+C;AAC/C,eAAe;AACf,+CAA+C;AAE/C,2CAA2C;AAC3C,IAAI,YAAY,GAAmB,IAAI,CAAC;AAExC,gCAAgC;AAChC,IAAI,gBAAgB,GAAwC,IAAI,CAAC;AAEjE,0BAA0B;AAC1B,IAAI,iBAAiB,GAA8B,IAAI,CAAC;AAExD,mCAAmC;AACnC,IAAI,YAAY,GAAkB,IAAI,CAAC;AAEvC,+CAA+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;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,4DAA4D;QAC5D,gBAAgB,GAAG,IAAI,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,mCAAmC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,IAAI;YAC7F,wCAAwC,CAC3C,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,qDAAqD,CAAC,CAAC;AAClE,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,OAAe;IAC/B,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,KAAK,MAAM,EAAE,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC"}
@@ -20,6 +20,12 @@ export { isPhpTreeSitterAvailable, getPhpLanguage, getPhpTreeSitter, createPhpPa
20
20
  export { isTypeScriptTreeSitterAvailable, isJavaScriptTreeSitterAvailable, getTypeScriptLanguage, getTsxLanguage, getJavaScriptLanguage, getTypeScriptTreeSitter, createTypeScriptParser, createTsxParser, createJavaScriptParser, createParserForFile, getTypeScriptLoadingError, resetTypeScriptLoader, } from './typescript-loader.js';
21
21
  export type { PythonParserConfig } from './config.js';
22
22
  export { DEFAULT_PYTHON_PARSER_CONFIG, validateConfig, mergeConfig, configFromEnv, } from './config.js';
23
+ export { isGoTreeSitterAvailable, getGoLanguage, getGoTreeSitter, createGoParser, getGoLoadingError, resetGoLoader, } from './go-loader.js';
24
+ export { TreeSitterGoParser } from './tree-sitter-go-parser.js';
25
+ export type { GoParseResult, GoPackageInfo, GoImportInfo, GoParameterInfo, GoReturnInfo, GoFunctionInfo, GoMethodInfo, GoReceiverInfo, GoFieldInfo, GoStructInfo, GoInterfaceMethodInfo, GoInterfaceInfo, GoTypeAliasInfo, } from './tree-sitter-go-parser.js';
26
+ export { isRustTreeSitterAvailable, getRustLanguage, getRustTreeSitter, createRustParser, getRustLoadingError, resetRustLoader, } from './rust-loader.js';
27
+ export { RustTreeSitterParser, createRustTreeSitterParser } from './tree-sitter-rust-parser.js';
28
+ export type { RustParseResult, RustFunction, RustParameter, RustGeneric, RustStruct, RustField, RustEnum, RustEnumVariant, RustTrait, RustTraitMethod, RustImpl, RustUse, RustMacroCall, } from './tree-sitter-rust-parser.js';
23
29
  export type { TreeSitterNode, TreeSitterTree, TreeSitterParser, TreeSitterLanguage, TreeSitterPoint, TreeSitterQuery, TreeSitterQueryMatch, TreeSitterQueryCapture, PydanticModelInfo, PydanticFieldInfo, PydanticValidatorInfo, PydanticConfigInfo, TypeInfo, FieldConstraints, } from './types.js';
24
30
  export { PythonASTConverter, convertPoint, convertNodeType } from './python-ast-converter.js';
25
31
  export type { ConversionOptions } from './python-ast-converter.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,YAAY,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAMlF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,YAAY,EACV,2BAA2B,EAC3B,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,aAAa,CAAC;AAMrB,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAE,o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EAEZ,mBAAmB,EACnB,cAAc,EAEd,iBAAiB,EACjB,oBAAoB,EAEpB,eAAe,EAEf,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,YAAY,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAMlF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,YAAY,EACV,2BAA2B,EAC3B,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,aAAa,CAAC;AAMrB,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAMpE,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,WAAW,GACZ,MAAM,6BAA6B,CAAC;AAMrC,OAAO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c,EACd,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAElB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAEV,YAAY,EACZ,iBAAiB,EAEjB,WAAW,EACX,cAAc,EAEd,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EAEf,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EAEnB,aAAa,EAEb,aAAa,EAEb,iBAAiB,EAEjB,gBAAgB,EAChB,YAAY,EAEZ,mBAAmB,EACnB,cAAc,EAEd,iBAAiB,EACjB,oBAAoB,EAEpB,eAAe,EAEf,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
@@ -44,6 +44,22 @@ export { isPhpTreeSitterAvailable, getPhpLanguage, getPhpTreeSitter, createPhpPa
44
44
  export { isTypeScriptTreeSitterAvailable, isJavaScriptTreeSitterAvailable, getTypeScriptLanguage, getTsxLanguage, getJavaScriptLanguage, getTypeScriptTreeSitter, createTypeScriptParser, createTsxParser, createJavaScriptParser, createParserForFile, getTypeScriptLoadingError, resetTypeScriptLoader, } from './typescript-loader.js';
45
45
  export { DEFAULT_PYTHON_PARSER_CONFIG, validateConfig, mergeConfig, configFromEnv, } from './config.js';
46
46
  // ============================================
47
+ // Go Loader Exports
48
+ // ============================================
49
+ export { isGoTreeSitterAvailable, getGoLanguage, getGoTreeSitter, createGoParser, getGoLoadingError, resetGoLoader, } from './go-loader.js';
50
+ // ============================================
51
+ // Go Parser Exports
52
+ // ============================================
53
+ export { TreeSitterGoParser } from './tree-sitter-go-parser.js';
54
+ // ============================================
55
+ // Rust Loader Exports
56
+ // ============================================
57
+ export { isRustTreeSitterAvailable, getRustLanguage, getRustTreeSitter, createRustParser, getRustLoadingError, resetRustLoader, } from './rust-loader.js';
58
+ // ============================================
59
+ // Rust Parser Exports
60
+ // ============================================
61
+ export { RustTreeSitterParser, createRustTreeSitterParser } from './tree-sitter-rust-parser.js';
62
+ // ============================================
47
63
  // AST Converter Exports
48
64
  // ============================================
49
65
  export { PythonASTConverter, convertPoint, convertNodeType } from './python-ast-converter.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,+CAA+C;AAC/C,wBAAwB;AACxB,+CAA+C;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,+CAA+C;AAC/C,oBAAoB;AACpB,+CAA+C;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAkBxE,+CAA+C;AAC/C,wBAAwB;AACxB,+CAA+C;AAE/C,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,+CAA+C;AAC/C,oBAAoB;AACpB,+CAA+C;AAE/C,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,+CAA+C;AAC/C,sBAAsB;AACtB,+CAA+C;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,+CAA+C;AAC/C,sBAAsB;AACtB,+CAA+C;AAE/C,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,+CAA+C;AAC/C,qBAAqB;AACrB,+CAA+C;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAelE,+CAA+C;AAC/C,qBAAqB;AACrB,+CAA+C;AAE/C,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,cAAc,GACf,MAAM,iBAAiB,CAAC;AAEzB,+CAA+C;A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aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,kBAAkB;AAClB,YAAY;AACZ,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,+CAA+C;AAC/C,wBAAwB;AACxB,+CAA+C;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,+CAA+C;AAC/C,oBAAoB;AACpB,+CAA+C;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAkBxE,+CAA+C;AAC/C,wBAAwB;AACxB,+CAA+C;AAE/C,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,+CAA+C;AAC/C,oBAAoB;AACpB,+CAA+C;AAE/C,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,+CAA+C;AAC/C,sBAAsB;AACtB,+CAA+C;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,+CAA+C;AAC/C,sBAAsB;AACtB,+CAA+C;AAE/C,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,+CAA+C;AAC/C,qBAAqB;AACrB,+CAA+C;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAelE,+CAA+C;AAC/C,qBAAqB;AACrB,+CAA+C;AAE/C,OAAO,EACL,wBAAwB,EACxB,c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EACjB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAe7B,+CAA+C;AAC/C,sBAAsB;AACtB,+CAA+C;AAE/C,OAAO;AACL,uBAAuB;AACvB,kBAAkB,EAClB,2BAA2B,EAC3B,yBAAyB,EACzB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB;AACtB,mBAAmB;AACnB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,4BAA4B;AAC5B,oBAAoB;AACpB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,kBAAkB;AAClB,YAAY;AACZ,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Tree-sitter Rust Loader
3
+ *
4
+ * Handles loading tree-sitter and tree-sitter-rust with graceful fallback.
5
+ * Provides functions to check availability and access the parser/language.
6
+ *
7
+ * @requirements Rust Language Support
8
+ */
9
+ import type { TreeSitterParser, TreeSitterLanguage } from './types.js';
10
+ /**
11
+ * Check if tree-sitter-rust is available.
12
+ *
13
+ * This function attempts to load tree-sitter and tree-sitter-rust
14
+ * on first call and caches the result.
15
+ *
16
+ * @returns true if tree-sitter-rust is available and working
17
+ */
18
+ export declare function isRustTreeSitterAvailable(): boolean;
19
+ /**
20
+ * Get the Rust language for tree-sitter.
21
+ *
22
+ * @returns TreeSitter Rust language
23
+ * @throws Error if tree-sitter-rust is not available
24
+ */
25
+ export declare function getRustLanguage(): TreeSitterLanguage;
26
+ /**
27
+ * Get the tree-sitter Parser constructor for Rust.
28
+ *
29
+ * @returns TreeSitter Parser constructor
30
+ * @throws Error if tree-sitter is not available
31
+ */
32
+ export declare function getRustTreeSitter(): new () => TreeSitterParser;
33
+ /**
34
+ * Create a new tree-sitter parser instance configured for Rust.
35
+ *
36
+ * @returns Configured TreeSitter parser
37
+ * @throws Error if tree-sitter-rust is not available
38
+ */
39
+ export declare function createRustParser(): TreeSitterParser;
40
+ /**
41
+ * Get the loading error message if tree-sitter-rust failed to load.
42
+ *
43
+ * @returns Error message or null if no error
44
+ */
45
+ export declare function getRustLoadingError(): string | null;
46
+ /**
47
+ * Reset the loader state (useful for testing).
48
+ */
49
+ export declare function resetRustLoader(): void;
50
+ //# sourceMappingURL=rust-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rust-loader.d.ts","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/rust-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAyBvE;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAenD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,kBAAkB,CAUpD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,gBAAgB,CAU9D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,gBAAgB,CAgBnD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAInD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAKtC"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Tree-sitter Rust Loader
3
+ *
4
+ * Handles loading tree-sitter and tree-sitter-rust with graceful fallback.
5
+ * Provides functions to check availability and access the parser/language.
6
+ *
7
+ * @requirements Rust Language Support
8
+ */
9
+ import { createRequire } from 'node:module';
10
+ // Create require function for ESM compatibility
11
+ const require = createRequire(import.meta.url);
12
+ // ============================================
13
+ // Module State
14
+ // ============================================
15
+ /** Whether tree-sitter-rust is available */
16
+ let rustAvailable = null;
17
+ /** Cached tree-sitter module */
18
+ let cachedTreeSitter = null;
19
+ /** Cached Rust language */
20
+ let cachedRustLanguage = null;
21
+ /** Loading error message if any */
22
+ let loadingError = null;
23
+ // ============================================
24
+ // Public API
25
+ // ============================================
26
+ /**
27
+ * Check if tree-sitter-rust is available.
28
+ *
29
+ * This function attempts to load tree-sitter and tree-sitter-rust
30
+ * on first call and caches the result.
31
+ *
32
+ * @returns true if tree-sitter-rust is available and working
33
+ */
34
+ export function isRustTreeSitterAvailable() {
35
+ if (rustAvailable !== null) {
36
+ return rustAvailable;
37
+ }
38
+ try {
39
+ loadRustTreeSitter();
40
+ rustAvailable = true;
41
+ }
42
+ catch (error) {
43
+ rustAvailable = false;
44
+ loadingError = error instanceof Error ? error.message : 'Unknown error loading tree-sitter-rust';
45
+ logDebug(`tree-sitter-rust not available: ${loadingError}`);
46
+ }
47
+ return rustAvailable;
48
+ }
49
+ /**
50
+ * Get the Rust language for tree-sitter.
51
+ *
52
+ * @returns TreeSitter Rust language
53
+ * @throws Error if tree-sitter-rust is not available
54
+ */
55
+ export function getRustLanguage() {
56
+ if (!isRustTreeSitterAvailable()) {
57
+ throw new Error(`tree-sitter-rust is not available: ${loadingError ?? 'unknown error'}`);
58
+ }
59
+ if (!cachedRustLanguage) {
60
+ throw new Error('tree-sitter-rust language not loaded');
61
+ }
62
+ return cachedRustLanguage;
63
+ }
64
+ /**
65
+ * Get the tree-sitter Parser constructor for Rust.
66
+ *
67
+ * @returns TreeSitter Parser constructor
68
+ * @throws Error if tree-sitter is not available
69
+ */
70
+ export function getRustTreeSitter() {
71
+ if (!isRustTreeSitterAvailable()) {
72
+ throw new Error(`tree-sitter-rust is not available: ${loadingError ?? 'unknown error'}`);
73
+ }
74
+ if (!cachedTreeSitter) {
75
+ throw new Error('tree-sitter module not loaded');
76
+ }
77
+ return cachedTreeSitter;
78
+ }
79
+ /**
80
+ * Create a new tree-sitter parser instance configured for Rust.
81
+ *
82
+ * @returns Configured TreeSitter parser
83
+ * @throws Error if tree-sitter-rust is not available
84
+ */
85
+ export function createRustParser() {
86
+ if (!isRustTreeSitterAvailable()) {
87
+ throw new Error(`tree-sitter-rust is not available: ${loadingError ?? 'unknown error'}`);
88
+ }
89
+ if (!cachedTreeSitter) {
90
+ throw new Error('tree-sitter module not loaded');
91
+ }
92
+ const Parser = cachedTreeSitter;
93
+ const language = getRustLanguage();
94
+ const parser = new Parser();
95
+ parser.setLanguage(language);
96
+ return parser;
97
+ }
98
+ /**
99
+ * Get the loading error message if tree-sitter-rust failed to load.
100
+ *
101
+ * @returns Error message or null if no error
102
+ */
103
+ export function getRustLoadingError() {
104
+ // Ensure we've attempted to load
105
+ isRustTreeSitterAvailable();
106
+ return loadingError;
107
+ }
108
+ /**
109
+ * Reset the loader state (useful for testing).
110
+ */
111
+ export function resetRustLoader() {
112
+ rustAvailable = null;
113
+ cachedTreeSitter = null;
114
+ cachedRustLanguage = null;
115
+ loadingError = null;
116
+ }
117
+ // ============================================
118
+ // Internal Functions
119
+ // ============================================
120
+ /**
121
+ * Attempt to load tree-sitter and tree-sitter-rust.
122
+ *
123
+ * @throws Error if loading fails
124
+ */
125
+ function loadRustTreeSitter() {
126
+ // Skip if already loaded
127
+ if (cachedTreeSitter && cachedRustLanguage) {
128
+ return;
129
+ }
130
+ try {
131
+ // Dynamic require for optional dependencies
132
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
133
+ cachedTreeSitter = require('tree-sitter');
134
+ }
135
+ catch (error) {
136
+ throw new Error(`Failed to load tree-sitter: ${error instanceof Error ? error.message : 'unknown error'}. ` +
137
+ 'Install with: pnpm add tree-sitter tree-sitter-rust');
138
+ }
139
+ try {
140
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
141
+ cachedRustLanguage = require('tree-sitter-rust');
142
+ }
143
+ catch (error) {
144
+ // Clear tree-sitter cache since we can't use it without Rust
145
+ cachedTreeSitter = null;
146
+ throw new Error(`Failed to load tree-sitter-rust: ${error instanceof Error ? error.message : 'unknown error'}. ` +
147
+ 'Install with: pnpm add tree-sitter-rust');
148
+ }
149
+ logDebug('tree-sitter and tree-sitter-rust loaded successfully');
150
+ }
151
+ /**
152
+ * Log debug message if debug mode is enabled.
153
+ *
154
+ * @param message - Message to log
155
+ */
156
+ function logDebug(message) {
157
+ if (process.env['DRIFT_PARSER_DEBUG'] === 'true') {
158
+ console.debug(`[rust-loader] ${message}`);
159
+ }
160
+ }
161
+ //# sourceMappingURL=rust-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rust-loader.js","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/rust-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,gDAAgD;AAChD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,+CAA+C;AAC/C,eAAe;AACf,+CAA+C;AAE/C,4CAA4C;AAC5C,IAAI,aAAa,GAAmB,IAAI,CAAC;AAEzC,gCAAgC;AAChC,IAAI,gBAAgB,GAAwC,IAAI,CAAC;AAEjE,2BAA2B;AAC3B,IAAI,kBAAkB,GAA8B,IAAI,CAAC;AAEzD,mCAAmC;AACnC,IAAI,YAAY,GAAkB,IAAI,CAAC;AAEvC,+CAA+C;AAC/C,aAAa;AACb,+CAA+C;AAE/C;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB;IACvC,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;QAC3B,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,IAAI,CAAC;QACH,kBAAkB,EA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