@repometry/cli 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +70 -2
  3. package/package.json +75 -4
  4. package/target/main/resources/language-catalog.json +77 -0
  5. package/target/main/resources/report/json/compact-json-v1.schema.json +24 -0
  6. package/target/main/resources/report/json/comparison-v1.schema.json +65 -0
  7. package/target/main/resources/report/json/config-v2.schema.json +224 -0
  8. package/target/main/resources/report/json/diff-coverage-v1.schema.json +55 -0
  9. package/target/main/resources/report/json/file-metrics-v1.schema.json +157 -0
  10. package/target/main/resources/report/json/metabranch-v1.schema.json +9 -0
  11. package/target/main/resources/report/json/metric-catalog-v1.schema.json +31 -0
  12. package/target/main/resources/report/json/pull-review-v1.schema.json +97 -0
  13. package/target/main/resources/report/json/pull-review-v2.schema.json +100 -0
  14. package/target/main/resources/report/json/report-v2.schema.json +534 -0
  15. package/target/main/resources/report/json/repository-summary-v1.schema.json +341 -0
  16. package/target/main/resources/report/json/viewer-inspection-v1.schema.json +534 -0
  17. package/target/main/resources/viewer/files.css +616 -0
  18. package/target/main/resources/viewer/index.html +120 -0
  19. package/target/main/resources/viewer/projects.html +52 -0
  20. package/target/main/resources/viewer/styles.css +579 -0
  21. package/target/main/resources/viewer/viewer-pulls.css +64 -0
  22. package/target/main/ts/api/cache/root.d.ts +2 -0
  23. package/target/main/ts/api/cache/root.js +21 -0
  24. package/target/main/ts/api/gh/github.d.ts +4 -0
  25. package/target/main/ts/api/gh/github.js +47 -0
  26. package/target/main/ts/api/git/blob-batch.d.ts +10 -0
  27. package/target/main/ts/api/git/blob-batch.js +107 -0
  28. package/target/main/ts/api/git/blob-history.d.ts +20 -0
  29. package/target/main/ts/api/git/blob-history.js +54 -0
  30. package/target/main/ts/api/git/changes.d.ts +27 -0
  31. package/target/main/ts/api/git/changes.js +117 -0
  32. package/target/main/ts/api/git/commit-metadata.d.ts +2 -0
  33. package/target/main/ts/api/git/commit-metadata.js +46 -0
  34. package/target/main/ts/api/git/git-churn.d.ts +9 -0
  35. package/target/main/ts/api/git/git-churn.js +72 -0
  36. package/target/main/ts/api/git/git-executable.d.ts +1 -0
  37. package/target/main/ts/api/git/git-executable.js +31 -0
  38. package/target/main/ts/api/git/git-reader.d.ts +24 -0
  39. package/target/main/ts/api/git/git-reader.js +113 -0
  40. package/target/main/ts/api/git/git.d.ts +47 -0
  41. package/target/main/ts/api/git/git.js +289 -0
  42. package/target/main/ts/api/git/inspection-source.d.ts +17 -0
  43. package/target/main/ts/api/git/inspection-source.js +36 -0
  44. package/target/main/ts/api/git/line-changes.d.ts +6 -0
  45. package/target/main/ts/api/git/line-changes.js +57 -0
  46. package/target/main/ts/api/git/local-sources.d.ts +5 -0
  47. package/target/main/ts/api/git/local-sources.js +48 -0
  48. package/target/main/ts/api/git/local.d.ts +7 -0
  49. package/target/main/ts/api/git/local.js +106 -0
  50. package/target/main/ts/api/git/source-cache.d.ts +1 -0
  51. package/target/main/ts/api/git/source-cache.js +42 -0
  52. package/target/main/ts/api/import/cobertura.d.ts +2 -0
  53. package/target/main/ts/api/import/cobertura.js +160 -0
  54. package/target/main/ts/api/import/coverage-xml.d.ts +7 -0
  55. package/target/main/ts/api/import/coverage-xml.js +135 -0
  56. package/target/main/ts/api/import/finding-import.d.ts +9 -0
  57. package/target/main/ts/api/import/finding-import.js +227 -0
  58. package/target/main/ts/api/import/go-cover.d.ts +13 -0
  59. package/target/main/ts/api/import/go-cover.js +150 -0
  60. package/target/main/ts/api/import/lcov-files.d.ts +12 -0
  61. package/target/main/ts/api/import/lcov-files.js +53 -0
  62. package/target/main/ts/api/import/profile-file.d.ts +4 -0
  63. package/target/main/ts/api/import/profile-file.js +17 -0
  64. package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
  65. package/target/main/ts/api/process/docker-tool-runner.js +92 -0
  66. package/target/main/ts/api/process/failure.d.ts +1 -0
  67. package/target/main/ts/api/process/failure.js +12 -0
  68. package/target/main/ts/api/process/plugin.d.ts +13 -0
  69. package/target/main/ts/api/process/plugin.js +100 -0
  70. package/target/main/ts/api/process/tool-snapshot.d.ts +3 -0
  71. package/target/main/ts/api/process/tool-snapshot.js +26 -0
  72. package/target/main/ts/cli/arguments.d.ts +28 -0
  73. package/target/main/ts/cli/arguments.js +109 -0
  74. package/target/main/ts/cli/config.d.ts +63 -0
  75. package/target/main/ts/cli/config.js +165 -0
  76. package/target/main/ts/cli/imports.d.ts +9 -0
  77. package/target/main/ts/cli/imports.js +37 -0
  78. package/target/main/ts/cli/main.d.ts +2 -0
  79. package/target/main/ts/cli/main.js +4 -0
  80. package/target/main/ts/cli/range-inspection.d.ts +38 -0
  81. package/target/main/ts/cli/range-inspection.js +34 -0
  82. package/target/main/ts/cli/range-jobs.d.ts +23 -0
  83. package/target/main/ts/cli/range-jobs.js +152 -0
  84. package/target/main/ts/cli/range-worker.d.ts +1 -0
  85. package/target/main/ts/cli/range-worker.js +40 -0
  86. package/target/main/ts/cli/reporting.d.ts +42 -0
  87. package/target/main/ts/cli/reporting.js +98 -0
  88. package/target/main/ts/cli/revisions.d.ts +6 -0
  89. package/target/main/ts/cli/revisions.js +16 -0
  90. package/target/main/ts/cli/run.d.ts +2 -0
  91. package/target/main/ts/cli/run.js +306 -0
  92. package/target/main/ts/cli/store.d.ts +13 -0
  93. package/target/main/ts/cli/store.js +39 -0
  94. package/target/main/ts/compose/analysis-report.d.ts +6 -0
  95. package/target/main/ts/compose/analysis-report.js +132 -0
  96. package/target/main/ts/compose/analysis-results.d.ts +46 -0
  97. package/target/main/ts/compose/analysis-results.js +119 -0
  98. package/target/main/ts/compose/analysis-steps.d.ts +23 -0
  99. package/target/main/ts/compose/analysis-steps.js +217 -0
  100. package/target/main/ts/compose/analyze-snapshot.d.ts +7 -0
  101. package/target/main/ts/compose/analyze-snapshot.js +21 -0
  102. package/target/main/ts/compose/attach-churn.d.ts +2 -0
  103. package/target/main/ts/compose/attach-churn.js +50 -0
  104. package/target/main/ts/compose/built-ins.d.ts +6 -0
  105. package/target/main/ts/compose/built-ins.js +12 -0
  106. package/target/main/ts/compose/diff-coverage.d.ts +25 -0
  107. package/target/main/ts/compose/diff-coverage.js +82 -0
  108. package/target/main/ts/compose/distribution.d.ts +17 -0
  109. package/target/main/ts/compose/distribution.js +13 -0
  110. package/target/main/ts/compose/docker-image.d.ts +5 -0
  111. package/target/main/ts/compose/docker-image.js +49 -0
  112. package/target/main/ts/compose/file-selection.d.ts +9 -0
  113. package/target/main/ts/compose/file-selection.js +38 -0
  114. package/target/main/ts/compose/history-cache.d.ts +31 -0
  115. package/target/main/ts/compose/history-cache.js +62 -0
  116. package/target/main/ts/compose/inspect.d.ts +34 -0
  117. package/target/main/ts/compose/inspect.js +51 -0
  118. package/target/main/ts/compose/inspection-coverage.d.ts +9 -0
  119. package/target/main/ts/compose/inspection-coverage.js +9 -0
  120. package/target/main/ts/compose/js-plugin.d.ts +113 -0
  121. package/target/main/ts/compose/js-plugin.js +99 -0
  122. package/target/main/ts/compose/language-discovery.d.ts +12 -0
  123. package/target/main/ts/compose/language-discovery.js +51 -0
  124. package/target/main/ts/compose/languages.d.ts +64 -0
  125. package/target/main/ts/compose/languages.js +98 -0
  126. package/target/main/ts/compose/load-plugins.d.ts +6 -0
  127. package/target/main/ts/compose/load-plugins.js +71 -0
  128. package/target/main/ts/compose/parser-order.d.ts +20 -0
  129. package/target/main/ts/compose/parser-order.js +90 -0
  130. package/target/main/ts/compose/phases.d.ts +140 -0
  131. package/target/main/ts/compose/phases.js +147 -0
  132. package/target/main/ts/compose/plugin-list.d.ts +37 -0
  133. package/target/main/ts/compose/plugin-list.js +30 -0
  134. package/target/main/ts/compose/plugin-manifest.d.ts +14 -0
  135. package/target/main/ts/compose/plugin-manifest.js +50 -0
  136. package/target/main/ts/compose/plugin-options.d.ts +2 -0
  137. package/target/main/ts/compose/plugin-options.js +29 -0
  138. package/target/main/ts/compose/plugin-reference.d.ts +9 -0
  139. package/target/main/ts/compose/plugin-reference.js +40 -0
  140. package/target/main/ts/compose/plugin-requirements.d.ts +5 -0
  141. package/target/main/ts/compose/plugin-requirements.js +83 -0
  142. package/target/main/ts/compose/plugin-scope.d.ts +9 -0
  143. package/target/main/ts/compose/plugin-scope.js +60 -0
  144. package/target/main/ts/compose/process-plugins.d.ts +89 -0
  145. package/target/main/ts/compose/process-plugins.js +74 -0
  146. package/target/main/ts/compose/registered-plugin.d.ts +17 -0
  147. package/target/main/ts/compose/registered-plugin.js +8 -0
  148. package/target/main/ts/compose/review.d.ts +26 -0
  149. package/target/main/ts/compose/review.js +54 -0
  150. package/target/main/ts/compose/schema-error.d.ts +2 -0
  151. package/target/main/ts/compose/schema-error.js +16 -0
  152. package/target/main/ts/compose/sources.d.ts +2 -0
  153. package/target/main/ts/compose/sources.js +32 -0
  154. package/target/main/ts/compose/structure-measures.d.ts +9 -0
  155. package/target/main/ts/compose/structure-measures.js +63 -0
  156. package/target/main/ts/index.d.ts +8 -0
  157. package/target/main/ts/index.js +5 -0
  158. package/target/main/ts/plugin.d.ts +2 -0
  159. package/target/main/ts/plugin.js +2 -0
  160. package/target/main/ts/plugins/built-in.d.ts +3 -0
  161. package/target/main/ts/plugins/built-in.js +19 -0
  162. package/target/main/ts/plugins/coverage/coverage.d.ts +11 -0
  163. package/target/main/ts/plugins/coverage/coverage.js +289 -0
  164. package/target/main/ts/plugins/coverage/diff-coverage.d.ts +3 -0
  165. package/target/main/ts/plugins/coverage/diff-coverage.js +85 -0
  166. package/target/main/ts/plugins/duplication/duplication.d.ts +2 -0
  167. package/target/main/ts/plugins/duplication/duplication.js +95 -0
  168. package/target/main/ts/plugins/language-js/babel-provider.d.ts +10 -0
  169. package/target/main/ts/plugins/language-js/babel-provider.js +54 -0
  170. package/target/main/ts/plugins/language-js/clone-candidates.d.ts +3 -0
  171. package/target/main/ts/plugins/language-js/clone-candidates.js +65 -0
  172. package/target/main/ts/plugins/language-js/code-lines.d.ts +6 -0
  173. package/target/main/ts/plugins/language-js/code-lines.js +36 -0
  174. package/target/main/ts/plugins/language-js/extensions.d.ts +1 -0
  175. package/target/main/ts/plugins/language-js/extensions.js +3 -0
  176. package/target/main/ts/plugins/language-js/function-facts.d.ts +9 -0
  177. package/target/main/ts/plugins/language-js/function-facts.js +74 -0
  178. package/target/main/ts/plugins/language-js/js-security.d.ts +4 -0
  179. package/target/main/ts/plugins/language-js/js-security.js +497 -0
  180. package/target/main/ts/plugins/language-js/qualified-names.d.ts +11 -0
  181. package/target/main/ts/plugins/language-js/qualified-names.js +63 -0
  182. package/target/main/ts/plugins/language-js/structural-observations.d.ts +9 -0
  183. package/target/main/ts/plugins/language-js/structural-observations.js +85 -0
  184. package/target/main/ts/plugins/language-js/syntax.d.ts +2 -0
  185. package/target/main/ts/plugins/language-js/syntax.js +11 -0
  186. package/target/main/ts/plugins/maintainability/maintainability.d.ts +2 -0
  187. package/target/main/ts/plugins/maintainability/maintainability.js +38 -0
  188. package/target/main/ts/plugins/maintainability/structural-smells.d.ts +3 -0
  189. package/target/main/ts/plugins/maintainability/structural-smells.js +17 -0
  190. package/target/main/ts/plugins/security/actions-security.d.ts +2 -0
  191. package/target/main/ts/plugins/security/actions-security.js +581 -0
  192. package/target/main/ts/plugins/security/dockerfile.d.ts +2 -0
  193. package/target/main/ts/plugins/security/dockerfile.js +487 -0
  194. package/target/main/ts/plugins/security/npm-supply-chain.d.ts +4 -0
  195. package/target/main/ts/plugins/security/npm-supply-chain.js +368 -0
  196. package/target/main/ts/plugins/security/secrets.d.ts +12 -0
  197. package/target/main/ts/plugins/security/secrets.js +254 -0
  198. package/target/main/ts/plugins/source/forges.d.ts +4 -0
  199. package/target/main/ts/plugins/source/forges.js +80 -0
  200. package/target/main/ts/plugins/structure/structure.d.ts +2 -0
  201. package/target/main/ts/plugins/structure/structure.js +42 -0
  202. package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +13 -0
  203. package/target/main/ts/report/html/app/viewer-chart-bars.js +59 -0
  204. package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
  205. package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
  206. package/target/main/ts/report/html/app/viewer-chart-line.d.ts +33 -0
  207. package/target/main/ts/report/html/app/viewer-chart-line.js +88 -0
  208. package/target/main/ts/report/html/app/viewer-chart-points.d.ts +52 -0
  209. package/target/main/ts/report/html/app/viewer-chart-points.js +65 -0
  210. package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
  211. package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
  212. package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
  213. package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
  214. package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
  215. package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
  216. package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
  217. package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
  218. package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
  219. package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
  220. package/target/main/ts/report/html/app/viewer-chart.d.ts +7 -0
  221. package/target/main/ts/report/html/app/viewer-chart.js +50 -0
  222. package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
  223. package/target/main/ts/report/html/app/viewer-code-map.js +176 -0
  224. package/target/main/ts/report/html/app/viewer-columns.d.ts +40 -0
  225. package/target/main/ts/report/html/app/viewer-columns.js +97 -0
  226. package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
  227. package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
  228. package/target/main/ts/report/html/app/viewer-commits.d.ts +32 -0
  229. package/target/main/ts/report/html/app/viewer-commits.js +81 -0
  230. package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
  231. package/target/main/ts/report/html/app/viewer-controls.js +141 -0
  232. package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
  233. package/target/main/ts/report/html/app/viewer-copy.js +64 -0
  234. package/target/main/ts/report/html/app/viewer-data.d.ts +24 -0
  235. package/target/main/ts/report/html/app/viewer-data.js +78 -0
  236. package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
  237. package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
  238. package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
  239. package/target/main/ts/report/html/app/viewer-dom.js +99 -0
  240. package/target/main/ts/report/html/app/viewer-file-aside.d.ts +15 -0
  241. package/target/main/ts/report/html/app/viewer-file-aside.js +134 -0
  242. package/target/main/ts/report/html/app/viewer-file-figures.d.ts +17 -0
  243. package/target/main/ts/report/html/app/viewer-file-figures.js +65 -0
  244. package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
  245. package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
  246. package/target/main/ts/report/html/app/viewer-files.d.ts +11 -0
  247. package/target/main/ts/report/html/app/viewer-files.js +40 -0
  248. package/target/main/ts/report/html/app/viewer-filter.d.ts +65 -0
  249. package/target/main/ts/report/html/app/viewer-filter.js +161 -0
  250. package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
  251. package/target/main/ts/report/html/app/viewer-hotspots.js +133 -0
  252. package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
  253. package/target/main/ts/report/html/app/viewer-inspection.js +38 -0
  254. package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
  255. package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
  256. package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
  257. package/target/main/ts/report/html/app/viewer-issues.js +173 -0
  258. package/target/main/ts/report/html/app/viewer-language-bar.d.ts +11 -0
  259. package/target/main/ts/report/html/app/viewer-language-bar.js +76 -0
  260. package/target/main/ts/report/html/app/viewer-languages.d.ts +35 -0
  261. package/target/main/ts/report/html/app/viewer-languages.js +97 -0
  262. package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
  263. package/target/main/ts/report/html/app/viewer-layout.js +134 -0
  264. package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
  265. package/target/main/ts/report/html/app/viewer-line-coverage.js +108 -0
  266. package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
  267. package/target/main/ts/report/html/app/viewer-locations.js +31 -0
  268. package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
  269. package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
  270. package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
  271. package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
  272. package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
  273. package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
  274. package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +47 -0
  275. package/target/main/ts/report/html/app/viewer-metric-registry.js +138 -0
  276. package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
  277. package/target/main/ts/report/html/app/viewer-metrics-view.js +159 -0
  278. package/target/main/ts/report/html/app/viewer-metrics.d.ts +51 -0
  279. package/target/main/ts/report/html/app/viewer-metrics.js +195 -0
  280. package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
  281. package/target/main/ts/report/html/app/viewer-overview-cards.js +121 -0
  282. package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
  283. package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
  284. package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
  285. package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
  286. package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
  287. package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
  288. package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
  289. package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
  290. package/target/main/ts/report/html/app/viewer-profile.d.ts +13 -0
  291. package/target/main/ts/report/html/app/viewer-profile.js +180 -0
  292. package/target/main/ts/report/html/app/viewer-projects.d.ts +1 -0
  293. package/target/main/ts/report/html/app/viewer-projects.js +90 -0
  294. package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
  295. package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
  296. package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
  297. package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
  298. package/target/main/ts/report/html/app/viewer-pulls.d.ts +2 -0
  299. package/target/main/ts/report/html/app/viewer-pulls.js +92 -0
  300. package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
  301. package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
  302. package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
  303. package/target/main/ts/report/html/app/viewer-route.js +55 -0
  304. package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
  305. package/target/main/ts/report/html/app/viewer-shell.js +113 -0
  306. package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
  307. package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
  308. package/target/main/ts/report/html/app/viewer-source.d.ts +27 -0
  309. package/target/main/ts/report/html/app/viewer-source.js +57 -0
  310. package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
  311. package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
  312. package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
  313. package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
  314. package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
  315. package/target/main/ts/report/html/app/viewer-table-cells.js +135 -0
  316. package/target/main/ts/report/html/app/viewer-table-rows.d.ts +56 -0
  317. package/target/main/ts/report/html/app/viewer-table-rows.js +97 -0
  318. package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +15 -0
  319. package/target/main/ts/report/html/app/viewer-tokenizer.js +241 -0
  320. package/target/main/ts/report/html/app/viewer-totals.d.ts +20 -0
  321. package/target/main/ts/report/html/app/viewer-totals.js +100 -0
  322. package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
  323. package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
  324. package/target/main/ts/report/html/app/viewer-trend-data.d.ts +54 -0
  325. package/target/main/ts/report/html/app/viewer-trend-data.js +109 -0
  326. package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
  327. package/target/main/ts/report/html/app/viewer-trend-nav.js +86 -0
  328. package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
  329. package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
  330. package/target/main/ts/report/html/app/viewer-trend-series.d.ts +32 -0
  331. package/target/main/ts/report/html/app/viewer-trend-series.js +128 -0
  332. package/target/main/ts/report/html/app/viewer-trends.d.ts +5 -0
  333. package/target/main/ts/report/html/app/viewer-trends.js +89 -0
  334. package/target/main/ts/report/html/app/viewer.d.ts +1 -0
  335. package/target/main/ts/report/html/app/viewer.js +222 -0
  336. package/target/main/ts/report/html/site/badges.d.ts +11 -0
  337. package/target/main/ts/report/html/site/badges.js +72 -0
  338. package/target/main/ts/report/html/site/export-site.d.ts +16 -0
  339. package/target/main/ts/report/html/site/export-site.js +129 -0
  340. package/target/main/ts/report/html/site/exported-server.d.ts +6 -0
  341. package/target/main/ts/report/html/site/exported-server.js +72 -0
  342. package/target/main/ts/report/html/site/local-server.d.ts +7 -0
  343. package/target/main/ts/report/html/site/local-server.js +59 -0
  344. package/target/main/ts/report/html/site/projects.d.ts +1 -0
  345. package/target/main/ts/report/html/site/projects.js +69 -0
  346. package/target/main/ts/report/html/site/server.d.ts +4 -0
  347. package/target/main/ts/report/html/site/server.js +65 -0
  348. package/target/main/ts/report/html/site/source-route.d.ts +6 -0
  349. package/target/main/ts/report/html/site/source-route.js +23 -0
  350. package/target/main/ts/report/json/projections/commit-summary.d.ts +13 -0
  351. package/target/main/ts/report/json/projections/commit-summary.js +126 -0
  352. package/target/main/ts/report/json/projections/components.d.ts +4 -0
  353. package/target/main/ts/report/json/projections/components.js +30 -0
  354. package/target/main/ts/report/json/projections/file-metrics.d.ts +4 -0
  355. package/target/main/ts/report/json/projections/file-metrics.js +260 -0
  356. package/target/main/ts/report/json/projections/ignore-view.d.ts +2 -0
  357. package/target/main/ts/report/json/projections/ignore-view.js +13 -0
  358. package/target/main/ts/report/json/projections/inspection-context.d.ts +5 -0
  359. package/target/main/ts/report/json/projections/inspection-context.js +104 -0
  360. package/target/main/ts/report/json/projections/inspection-details.d.ts +14 -0
  361. package/target/main/ts/report/json/projections/inspection-details.js +98 -0
  362. package/target/main/ts/report/json/projections/metric-values.d.ts +14 -0
  363. package/target/main/ts/report/json/projections/metric-values.js +104 -0
  364. package/target/main/ts/report/json/projections/profile-selectors.d.ts +8 -0
  365. package/target/main/ts/report/json/projections/profile-selectors.js +34 -0
  366. package/target/main/ts/report/json/projections/security-summary.d.ts +11 -0
  367. package/target/main/ts/report/json/projections/security-summary.js +22 -0
  368. package/target/main/ts/report/json/store/directory.d.ts +3 -0
  369. package/target/main/ts/report/json/store/directory.js +19 -0
  370. package/target/main/ts/report/json/store/local-store.d.ts +25 -0
  371. package/target/main/ts/report/json/store/local-store.js +214 -0
  372. package/target/main/ts/report/json/store/object-store.d.ts +14 -0
  373. package/target/main/ts/report/json/store/object-store.js +73 -0
  374. package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
  375. package/target/main/ts/report/json/store/operation-cache.js +32 -0
  376. package/target/main/ts/report/json/store/pull-review-store.d.ts +2 -0
  377. package/target/main/ts/report/json/store/pull-review-store.js +33 -0
  378. package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
  379. package/target/main/ts/report/json/store/replace-file.js +35 -0
  380. package/target/main/ts/report/json/store/report-tree.d.ts +46 -0
  381. package/target/main/ts/report/json/store/report-tree.js +295 -0
  382. package/target/main/ts/report/json/store/store-check.d.ts +32 -0
  383. package/target/main/ts/report/json/store/store-check.js +153 -0
  384. package/target/main/ts/report/json/validation/metabranch.d.ts +4 -0
  385. package/target/main/ts/report/json/validation/metabranch.js +11 -0
  386. package/target/main/ts/report/json/validation/report.d.ts +20 -0
  387. package/target/main/ts/report/json/validation/report.js +82 -0
  388. package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
  389. package/target/main/ts/report/json/validation/summary-validation.js +30 -0
  390. package/target/main/ts/report/json/wire/compact-json.d.ts +11 -0
  391. package/target/main/ts/report/json/wire/compact-json.js +76 -0
  392. package/target/main/ts/report/json/wire/component-model.d.ts +9 -0
  393. package/target/main/ts/report/json/wire/component-model.js +1 -0
  394. package/target/main/ts/report/json/wire/domain-types.d.ts +2 -0
  395. package/target/main/ts/report/json/wire/domain-types.js +1 -0
  396. package/target/main/ts/report/json/wire/file-metrics-model.d.ts +81 -0
  397. package/target/main/ts/report/json/wire/file-metrics-model.js +1 -0
  398. package/target/main/ts/report/json/wire/inspection-context-model.d.ts +31 -0
  399. package/target/main/ts/report/json/wire/inspection-context-model.js +1 -0
  400. package/target/main/ts/report/json/wire/inspection-details-model.d.ts +87 -0
  401. package/target/main/ts/report/json/wire/inspection-details-model.js +1 -0
  402. package/target/main/ts/report/json/wire/project-model.d.ts +7 -0
  403. package/target/main/ts/report/json/wire/project-model.js +1 -0
  404. package/target/main/ts/report/json/wire/public-history-model.d.ts +37 -0
  405. package/target/main/ts/report/json/wire/public-history-model.js +5 -0
  406. package/target/main/ts/report/json/wire/pull-review-model.d.ts +54 -0
  407. package/target/main/ts/report/json/wire/pull-review-model.js +3 -0
  408. package/target/main/ts/report/json/wire/summary-model.d.ts +45 -0
  409. package/target/main/ts/report/json/wire/summary-model.js +1 -0
  410. package/target/main/ts/report/markdown/pull-review.d.ts +5 -0
  411. package/target/main/ts/report/markdown/pull-review.js +132 -0
  412. package/target/main/ts/report.d.ts +23 -0
  413. package/target/main/ts/report.js +12 -0
  414. package/target/main/ts/runtime.d.ts +17 -0
  415. package/target/main/ts/runtime.js +30 -0
@@ -0,0 +1,106 @@
1
+ import { lstat, open, readdir, realpath, readFile } from 'node:fs/promises';
2
+ import { isAbsolute, join, posix, relative, sep } from 'node:path';
3
+ import { comparePaths, isExcludedDirectory, workingSnapshot } from '@repometry/core/internal/model/snapshot.js';
4
+ import { binaryProbeBytes, isClaimedText, maxClaimedFileBytes } from '@repometry/core/internal/model/source.js';
5
+ import { isGeneratedSource } from '@repometry/core/internal/profile/exclusions.js';
6
+ export function containsPath(parent, path) {
7
+ const rest = relative(parent, path);
8
+ return rest === '' || (!isAbsolute(rest) && rest !== '..' && !rest.startsWith(`..${sep}`));
9
+ }
10
+ export async function readWorkingTree(directory, output, excludes, isSource, claims, gitPaths, inventory) {
11
+ const root = await realpath(directory);
12
+ const files = [];
13
+ const generatedExcluded = [];
14
+ const oversizedClaims = [];
15
+ if (containsPath(output, root))
16
+ throw new Error('The output directory must be separate from the source root');
17
+ async function visit(folder, prefix) {
18
+ for (const entry of await readdir(folder, { withFileTypes: true })) {
19
+ const path = prefix + entry.name;
20
+ const absolute = join(folder, entry.name);
21
+ if (excludes(path))
22
+ continue;
23
+ if (entry.isDirectory() && !isExcludedDirectory(entry.name) && absolute !== output) {
24
+ await visit(absolute, `${path}/`);
25
+ }
26
+ else if (entry.isFile())
27
+ await read(path, absolute);
28
+ }
29
+ }
30
+ async function read(path, absolute, size) {
31
+ inventory?.record(path);
32
+ if (isSource(path)) {
33
+ const bytes = await readFile(absolute);
34
+ if (isGeneratedSource(bytes))
35
+ generatedExcluded.push(path);
36
+ else
37
+ files.push({ path, bytes });
38
+ return;
39
+ }
40
+ if (!claims?.(path))
41
+ return;
42
+ if ((size ?? (await lstat(absolute)).size) > maxClaimedFileBytes) {
43
+ if (!await isBinaryHead(absolute))
44
+ oversizedClaims.push(path);
45
+ return;
46
+ }
47
+ const bytes = await readFile(absolute);
48
+ if (bytes.length > maxClaimedFileBytes) {
49
+ if (!bytes.subarray(0, binaryProbeBytes).includes(0))
50
+ oversizedClaims.push(path);
51
+ }
52
+ else if (isClaimedText(bytes))
53
+ files.push({ path, bytes });
54
+ }
55
+ if (gitPaths === undefined) {
56
+ await visit(root, '');
57
+ }
58
+ else {
59
+ const candidate = (path) => isSource(path) || claims?.(path) || inventory?.candidate(path);
60
+ const directories = new Map([['.', true]]);
61
+ async function regularDirectory(path) {
62
+ const cached = directories.get(path);
63
+ if (cached !== undefined)
64
+ return cached;
65
+ const allowed = !isExcludedDirectory(posix.basename(path)) && await regularDirectory(posix.dirname(path))
66
+ && (await statIfPresent(join(root, path)))?.isDirectory() === true;
67
+ directories.set(path, allowed);
68
+ return allowed;
69
+ }
70
+ for (const path of gitPaths) {
71
+ const absolute = join(root, path);
72
+ if (excludes(path) || !containsPath(root, absolute) || containsPath(output, absolute))
73
+ continue;
74
+ if (!candidate(path) || !await regularDirectory(posix.dirname(path)))
75
+ continue;
76
+ const stat = await statIfPresent(absolute);
77
+ if (stat?.isFile())
78
+ await read(path, absolute, stat.size);
79
+ }
80
+ }
81
+ return { ...workingSnapshot(files), generatedExcluded: generatedExcluded.sort(comparePaths),
82
+ ...(oversizedClaims.length ? { oversizedClaims: oversizedClaims.sort(comparePaths) } : {}) };
83
+ }
84
+ async function statIfPresent(path) {
85
+ try {
86
+ return await lstat(path);
87
+ }
88
+ catch (error) {
89
+ if (error instanceof Error && 'code' in error && (error.code === 'ENOENT' || error.code === 'ENOTDIR'))
90
+ return undefined;
91
+ throw error;
92
+ }
93
+ }
94
+ /** Whether the start of a file holds a NUL byte, without reading the rest. */
95
+ async function isBinaryHead(path) {
96
+ const handle = await open(path, 'r');
97
+ try {
98
+ const head = Buffer.alloc(binaryProbeBytes);
99
+ const { bytesRead } = await handle.read(head, 0, binaryProbeBytes, 0);
100
+ return head.subarray(0, bytesRead).includes(0);
101
+ }
102
+ finally {
103
+ await handle.close();
104
+ }
105
+ }
106
+ //# sourceMappingURL=local.js.map
@@ -0,0 +1 @@
1
+ export declare function cachedBlob(root: string, oid: string, load: () => Promise<Buffer | undefined>): Promise<Buffer | undefined>;
@@ -0,0 +1,42 @@
1
+ import { createHash, randomUUID } from 'node:crypto';
2
+ import { lstat, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ import { validSubjectId } from '@repometry/core/internal/model/report.js';
5
+ export async function cachedBlob(root, oid, load) {
6
+ if (!validSubjectId('commit', oid))
7
+ throw new Error('Invalid source blob ID');
8
+ const folder = join(root, 'sources', oid.slice(0, 2));
9
+ const path = join(folder, oid);
10
+ try {
11
+ if ((await lstat(path)).isFile()) {
12
+ const hit = await readFile(path);
13
+ if (blobMatches(oid, hit))
14
+ return hit;
15
+ }
16
+ }
17
+ catch (error) {
18
+ if (!isMissing(error))
19
+ throw error;
20
+ }
21
+ const bytes = await load();
22
+ if (bytes === undefined || !blobMatches(oid, bytes))
23
+ return undefined;
24
+ await mkdir(folder, { recursive: true, mode: 0o700 });
25
+ const temporary = join(folder, `.${randomUUID()}.tmp`);
26
+ try {
27
+ await writeFile(temporary, bytes, { flag: 'wx', mode: 0o600 });
28
+ await rename(temporary, path);
29
+ }
30
+ finally {
31
+ await rm(temporary, { force: true });
32
+ }
33
+ return bytes;
34
+ }
35
+ function blobMatches(oid, bytes) {
36
+ return createHash(oid.length === 40 ? 'sha1' : 'sha256')
37
+ .update(`blob ${bytes.length}\0`).update(bytes).digest('hex') === oid;
38
+ }
39
+ function isMissing(error) {
40
+ return error instanceof Error && 'code' in error && error.code === 'ENOENT';
41
+ }
42
+ //# sourceMappingURL=source-cache.js.map
@@ -0,0 +1,2 @@
1
+ import type { CoverageSource } from './go-cover.js';
2
+ export declare function coberturaToLcov(text: string, input: string, source: CoverageSource): string;
@@ -0,0 +1,160 @@
1
+ import { posix, win32 } from 'node:path';
2
+ import { comparePaths } from '@repometry/core/internal/model/snapshot.js';
3
+ import { readCoverageXml } from './coverage-xml.js';
4
+ export function coberturaToLcov(text, input, source) {
5
+ const invalid = (line, reason) => { throw new Error('Invalid Cobertura report ' + input + ' at line ' + line + ': ' + reason); };
6
+ const { classes, sources } = parse(text, invalid);
7
+ const resolve = coveragePaths(source, sources);
8
+ const files = new Map();
9
+ for (const item of classes) {
10
+ const path = resolve(item.filename);
11
+ if (/[\r\n\0]/.test(path))
12
+ invalid(item.xmlLine, 'filename contains a line break or NUL');
13
+ const file = files.get(path) ?? { lines: new Map(), methods: [] };
14
+ files.set(path, file);
15
+ for (const line of item.lines.values())
16
+ mergeLine(file, line);
17
+ for (const method of item.methods)
18
+ file.methods.push(method);
19
+ }
20
+ return render(files);
21
+ }
22
+ const [sourcesPath, classesPath] = ['coverage/sources', 'coverage/packages/package/classes'];
23
+ const methodsPath = classesPath + '/class/methods';
24
+ const maxBranches = 2 ** 24; // Each branch becomes an entry of one Map, which holds at most 2^24.
25
+ function parse(input, invalid) {
26
+ const classes = [];
27
+ let branches = 0;
28
+ const sources = [];
29
+ let current;
30
+ let method;
31
+ let sourceText;
32
+ readCoverageXml(input, invalid, {
33
+ open(name, attributes, parents, line) {
34
+ const path = parents.join('/');
35
+ if (name === 'source' && path === sourcesPath)
36
+ sourceText = [];
37
+ if (name === 'class' && path === classesPath) {
38
+ const filename = attributes.get('filename');
39
+ if (!filename?.trim())
40
+ return invalid(line, '<class> has no filename');
41
+ current = { filename, name: attributes.get('name') ?? '', lines: new Map(), methods: [], xmlLine: line };
42
+ classes.push(current);
43
+ }
44
+ if (!current)
45
+ return;
46
+ if (name === 'method' && path === methodsPath) {
47
+ const key = current.name + '.' + (attributes.get('name') ?? '') + (attributes.get('signature') ?? '');
48
+ if (/[\r\n\0]/.test(key))
49
+ invalid(line, 'method name contains a line break or NUL');
50
+ method = { key };
51
+ current.methods.push(method);
52
+ }
53
+ if (name !== 'line')
54
+ return;
55
+ if (path === classesPath + '/class/lines') {
56
+ const entry = readLine(attributes, line, invalid, true);
57
+ branches += entry.branches?.total ?? 0;
58
+ if (branches > maxBranches)
59
+ invalid(line, 'too many branches');
60
+ mergeLine(current, entry);
61
+ }
62
+ if (method && path === methodsPath + '/method/lines') {
63
+ const entry = readLine(attributes, line, invalid, false);
64
+ if (!method.first || entry.number < method.first.number)
65
+ method.first = entry;
66
+ }
67
+ },
68
+ close(name, parents) {
69
+ const path = parents.join('/');
70
+ if (name === 'source' && path === sourcesPath && sourceText) {
71
+ const value = sourceText.join('').trim();
72
+ if (value)
73
+ sources.push(value);
74
+ sourceText = undefined;
75
+ }
76
+ if (name === 'class' && path === classesPath)
77
+ current = undefined;
78
+ if (name === 'method' && path === methodsPath)
79
+ method = undefined;
80
+ },
81
+ text(value, parents) {
82
+ if (sourceText && parents.join('/') === sourcesPath + '/source')
83
+ sourceText.push(value);
84
+ },
85
+ });
86
+ return { classes, sources };
87
+ }
88
+ function readLine(attributes, xmlLine, invalid, classLine) {
89
+ const rawLine = attributes.get('number') ?? '';
90
+ const rawHits = attributes.get('hits') ?? '';
91
+ const number = Number(rawLine);
92
+ const hits = Number(rawHits);
93
+ if (!/^\d+$/.test(rawLine) || !Number.isSafeInteger(number) || number === 0)
94
+ invalid(xmlLine, 'line number must be a positive integer');
95
+ if (!/^\d+$/.test(rawHits))
96
+ invalid(xmlLine, 'hits must be a non-negative integer');
97
+ if (!Number.isSafeInteger(hits))
98
+ invalid(xmlLine, 'hit count exceeds the supported integer range');
99
+ return { number, hits, branches: classLine ? readBranches(attributes.get('condition-coverage'), xmlLine, invalid) : undefined };
100
+ }
101
+ function readBranches(value, xmlLine, invalid) {
102
+ const match = value === undefined ? null : /^\d+(?:\.\d+)?%\s*\((\d+)\/(\d+)\)$/.exec(value);
103
+ if (!match)
104
+ return undefined;
105
+ const covered = Number(match[1]);
106
+ const total = Number(match[2]);
107
+ if (!Number.isSafeInteger(total) || !Number.isSafeInteger(covered) || total === 0 || covered > total) {
108
+ invalid(xmlLine, 'invalid condition-coverage ' + JSON.stringify(value));
109
+ }
110
+ return { covered, total };
111
+ }
112
+ function mergeLine(file, line) {
113
+ const previous = file.lines.get(line.number);
114
+ const before = previous?.branches;
115
+ const next = line.branches;
116
+ const branches = next && (!before || next.total > before.total || (next.total === before.total && next.covered > before.covered))
117
+ ? next : before;
118
+ file.lines.set(line.number, { number: line.number, hits: Math.max(line.hits, previous?.hits ?? 0), branches });
119
+ }
120
+ function coveragePaths({ root, snapshot }, sources) {
121
+ const platform = win32.isAbsolute(root) && !posix.isAbsolute(root) ? win32 : posix;
122
+ const slash = (path) => platform === win32 ? path.replaceAll('\\', '/') : path;
123
+ const known = new Set([...snapshot.files.map(file => file.path), ...(snapshot.generatedExcluded ?? []),
124
+ ...(snapshot.inventory?.map(file => file.path) ?? [])]);
125
+ const normalize = (path) => slash(platform.isAbsolute(path) ? platform.relative(root, path) || '.' : platform.normalize(path));
126
+ const paths = new Map();
127
+ return (filename) => {
128
+ const prior = paths.get(filename);
129
+ if (prior !== undefined)
130
+ return prior;
131
+ const candidates = platform.isAbsolute(filename) ? [normalize(filename)]
132
+ : [...sources.map(source => normalize(platform.join(source, filename))), normalize(filename)];
133
+ const matches = [...new Set(candidates)].filter(path => known.has(path));
134
+ if (matches.length > 1)
135
+ throw new Error('Ambiguous Cobertura source ' + JSON.stringify(filename) + ': ' + matches.sort(comparePaths).join(', '));
136
+ const selected = matches[0] ?? candidates.at(-1); // An unknown relative filename stays relative to the root.
137
+ paths.set(filename, selected);
138
+ return selected;
139
+ };
140
+ }
141
+ function render(files) {
142
+ const output = [];
143
+ for (const [path, { lines, methods }] of [...files].sort(([left], [right]) => comparePaths(left, right))) {
144
+ output.push('SF:' + path);
145
+ for (const { key, first } of methods)
146
+ if (first)
147
+ output.push('FN:' + first.number + ',' + key, 'FNDA:' + first.hits + ',' + key);
148
+ for (const { number, hits, branches } of [...lines.values()].sort((a, b) => a.number - b.number)) {
149
+ output.push('DA:' + number + ',' + hits);
150
+ if (!branches)
151
+ continue;
152
+ const prefix = 'BRDA:' + number + ',0,';
153
+ for (let index = 0; index < branches.total; index++)
154
+ output.push(prefix + index + ',' + Number(index < branches.covered));
155
+ }
156
+ output.push('end_of_record');
157
+ }
158
+ return output.join('\n');
159
+ }
160
+ //# sourceMappingURL=cobertura.js.map
@@ -0,0 +1,7 @@
1
+ interface XmlVisitor {
2
+ open(name: string, attributes: ReadonlyMap<string, string>, parents: readonly string[], line: number): void;
3
+ close(name: string, parents: readonly string[]): void;
4
+ text(value: string, parents: readonly string[]): void;
5
+ }
6
+ export declare function readCoverageXml(input: string, invalid: (line: number, reason: string) => never, visitor: XmlVisitor): void;
7
+ export {};
@@ -0,0 +1,135 @@
1
+ const entities = new Map([['lt', '<'], ['gt', '>'], ['amp', '&'], ['quot', '"'], ['apos', "'"]]);
2
+ export function readCoverageXml(input, invalid, visitor) {
3
+ const text = input.replace(/^\uFEFF/, '').replace(/\r\n?/g, '\n');
4
+ const parents = [];
5
+ let root = false;
6
+ let line = 1;
7
+ let offset = 0;
8
+ const fail = (reason, position = offset) => invalid(line + text.slice(offset, position).split('\n').length - 1, reason);
9
+ while (offset < text.length) {
10
+ const token = readToken(text, offset, fail);
11
+ if (token.kind === 'open') {
12
+ if (parents.length === 0) {
13
+ if (root || token.name !== 'coverage')
14
+ invalid(line, 'expected a <coverage> root element');
15
+ root = true;
16
+ }
17
+ visitor.open(token.name, token.attributes, parents, line);
18
+ if (token.empty)
19
+ visitor.close(token.name, parents);
20
+ else
21
+ parents.push(token.name);
22
+ }
23
+ else if (token.kind === 'close') {
24
+ if (parents.pop() !== token.name)
25
+ invalid(line, 'unexpected </' + token.name + '>');
26
+ visitor.close(token.name, parents);
27
+ }
28
+ else if (token.kind === 'text') {
29
+ if (!parents.length && token.value.trim())
30
+ fail('expected a <coverage> root element', offset + text.slice(offset).search(/\S/));
31
+ visitor.text(token.value, parents);
32
+ }
33
+ for (; offset < token.end; offset++)
34
+ if (text.charCodeAt(offset) === 10)
35
+ line++;
36
+ }
37
+ if (parents.length)
38
+ invalid(line, 'unclosed <' + parents.at(-1) + '>');
39
+ if (!root)
40
+ invalid(1, 'expected a <coverage> root element');
41
+ }
42
+ function readToken(text, offset, fail) {
43
+ if (text[offset] !== '<') {
44
+ const next = text.indexOf('<', offset);
45
+ const end = next === -1 ? text.length : next;
46
+ return { kind: 'text', end, value: decode(text.slice(offset, end), offset, fail) };
47
+ }
48
+ if (text.startsWith('<![CDATA[', offset)) {
49
+ const end = sectionEnd(text, offset + 9, ']]>', fail);
50
+ return { kind: 'text', end, value: text.slice(offset + 9, end - 3) };
51
+ }
52
+ if (text.startsWith('<!--', offset))
53
+ return { kind: 'skip', end: sectionEnd(text, offset + 4, '-->', fail) };
54
+ if (text.startsWith('<?', offset))
55
+ return { kind: 'skip', end: sectionEnd(text, offset + 2, '?>', fail) };
56
+ if (text.startsWith('<!DOCTYPE', offset))
57
+ return { kind: 'skip', end: doctypeEnd(text, offset, fail) };
58
+ return readTag(text, offset, fail);
59
+ }
60
+ function sectionEnd(text, start, separator, fail) {
61
+ const end = text.indexOf(separator, start);
62
+ if (end === -1)
63
+ fail('malformed tag');
64
+ return end + separator.length;
65
+ }
66
+ function doctypeEnd(text, offset, fail) {
67
+ const name = /<!DOCTYPE\s+[A-Za-z_:][\w:.-]*/y;
68
+ name.lastIndex = offset;
69
+ if (!name.test(text))
70
+ fail('malformed tag');
71
+ // Quoted identifiers can contain brackets. Stop before reading any unquoted internal subset.
72
+ for (let index = name.lastIndex; index < text.length; index++) {
73
+ const char = text[index];
74
+ if (char === '>')
75
+ return index + 1;
76
+ if (char === '[')
77
+ fail('DOCTYPE with an internal subset is not supported', index);
78
+ if (char === '"' || char === "'")
79
+ index = text.indexOf(char, index + 1);
80
+ if (index === -1)
81
+ break;
82
+ }
83
+ return fail('malformed tag');
84
+ }
85
+ function readTag(text, offset, fail) {
86
+ const tag = /<(\/?)([A-Za-z_:][\w:.-]*)/y;
87
+ tag.lastIndex = offset;
88
+ const match = tag.exec(text);
89
+ if (!match)
90
+ fail('malformed tag');
91
+ const name = match[2];
92
+ const ending = /\s*(\/?)>/y;
93
+ if (match[1]) {
94
+ ending.lastIndex = tag.lastIndex;
95
+ const close = ending.exec(text);
96
+ if (!close || close[1])
97
+ fail('malformed tag');
98
+ return { kind: 'close', end: ending.lastIndex, name };
99
+ }
100
+ const attributes = new Map();
101
+ const attr = /\s+([A-Za-z_:][\w:.-]*)\s*=\s*(?:"([^"<]*)"|'([^'<]*)')/y;
102
+ for (let end = tag.lastIndex;; end = attr.lastIndex) {
103
+ ending.lastIndex = end;
104
+ const edge = ending.exec(text);
105
+ if (edge)
106
+ return { kind: 'open', end: ending.lastIndex, name, attributes, empty: edge[1] === '/' };
107
+ attr.lastIndex = end;
108
+ const value = attr.exec(text);
109
+ if (!value)
110
+ fail('malformed attribute', end + text.slice(end).search(/\S/));
111
+ const key = value[1];
112
+ const raw = value[2] ?? value[3];
113
+ if (attributes.has(key))
114
+ fail('duplicate attribute ' + key, end + value[0].search(/\S/));
115
+ attributes.set(key, decode(raw, attr.lastIndex - raw.length - 1, fail));
116
+ }
117
+ }
118
+ function decode(value, start, fail) {
119
+ return value.replace(/&(?:[^&;<\s]*;)?/g, (reference, index) => {
120
+ const entity = reference.slice(1, -1);
121
+ const named = entities.get(entity);
122
+ if (named !== undefined)
123
+ return named;
124
+ const code = /^#x[\da-f]+$/i.test(entity) ? Number.parseInt(entity.slice(2), 16)
125
+ : /^#\d+$/.test(entity) ? Number(entity.slice(1)) : NaN;
126
+ if (!xmlCharacter(code))
127
+ fail('unknown entity ' + reference, start + index);
128
+ return String.fromCodePoint(code);
129
+ });
130
+ }
131
+ function xmlCharacter(code) {
132
+ return code === 9 || code === 10 || code === 13 || (code >= 32 && code <= 0xd7ff)
133
+ || (code >= 0xe000 && code <= 0xfffd) || (code >= 0x10000 && code <= 0x10ffff);
134
+ }
135
+ //# sourceMappingURL=coverage-xml.js.map
@@ -0,0 +1,9 @@
1
+ import type { Finding } from '@repometry/core/internal/model/finding.js';
2
+ import type { FindingInput, ImportMetadata } from '@repometry/core/internal/model/scanner-import.js';
3
+ export { findingImportMethods } from '@repometry/core/internal/model/scanner-import.js';
4
+ export type { FindingInput } from '@repometry/core/internal/model/scanner-import.js';
5
+ interface Imported {
6
+ readonly findings: readonly Finding[];
7
+ readonly metadata: ImportMetadata;
8
+ }
9
+ export declare function importFindings(input: FindingInput, root: string, excludes: (path: string) => boolean, knownPaths: ReadonlySet<string> | undefined): Promise<Imported>;