@repometry/cli 0.0.0-stage → 0.0.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 +61 -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 +530 -0
  15. package/target/main/resources/report/json/repository-summary-v1.schema.json +337 -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 +131 -0
  96. package/target/main/ts/compose/analysis-results.d.ts +42 -0
  97. package/target/main/ts/compose/analysis-results.js +84 -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 +125 -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 +77 -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 +26 -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 +36 -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,76 @@
1
+ import { element, percent } from './viewer-dom.js';
2
+ import { sameClause } from './viewer-filter.js';
3
+ import { ignoredLabel, languageColor, languageShares, lockfilesLabel } from './viewer-languages.js';
4
+ import { labelOf } from './viewer-metrics.js';
5
+ /** Lockfiles and the files no plugin read stand at the end in muted tones: categories, not languages. */
6
+ const categories = new Map([
7
+ [lockfilesLabel, { clause: { kind: 'lockfile', value: 'yes' }, color: 'var(--lockfile)', className: 'fx-language-lockfile' }],
8
+ [ignoredLabel, { clause: { kind: 'analysed', value: 'no' }, color: 'var(--grade-none)', className: 'fx-language-unread' }],
9
+ ]);
10
+ /** The clause a language's chip stands for. */
11
+ function clauseOf(language) {
12
+ return categories.get(language)?.clause ?? { kind: 'lang', value: language };
13
+ }
14
+ /** Whether the query holds a language's clause: a language by name in any case, a category exactly. */
15
+ function holds(clauses, language) {
16
+ const clause = clauseOf(language);
17
+ if (clause.kind !== 'lang')
18
+ return clauses.some(other => sameClause(other, clause));
19
+ return clauses.some(other => other.kind === 'lang' && other.value.toLowerCase() === language.toLowerCase());
20
+ }
21
+ /** The query with a language's chip pressed or released. */
22
+ export function toggleLanguage(clauses, language) {
23
+ const clause = clauseOf(language);
24
+ if (!holds(clauses, language))
25
+ return [...clauses, clause];
26
+ if (clause.kind !== 'lang')
27
+ return clauses.filter(other => other.kind !== clause.kind);
28
+ return clauses.filter(other => !(other.kind === 'lang' && other.value.toLowerCase() === language.toLowerCase()));
29
+ }
30
+ /** A share too small to round to 0.1% still reads as present, not as 0%. */
31
+ export function shareText(ratio) {
32
+ return ratio > 0 && ratio < 0.0005 ? `<${percent(0.001)}` : percent(ratio);
33
+ }
34
+ function chip(language, share, color, pressed) {
35
+ const category = categories.get(language);
36
+ const toggle = element('button', category ? `fx-language ${category.className}` : 'fx-language');
37
+ toggle.type = 'button';
38
+ toggle.setAttribute('aria-pressed', String(pressed));
39
+ const dot = element('span', 'fx-language-dot');
40
+ dot.style.background = color;
41
+ toggle.append(dot, element('span', 'fx-language-name', language), element('span', 'fx-language-share', share));
42
+ return toggle;
43
+ }
44
+ /**
45
+ * The languages of the selection as one bar, with a legend whose names toggle their chips in the query. Nothing shows
46
+ * for a single language or no weight at all.
47
+ */
48
+ export function renderLanguages(container, files, clauses, set) {
49
+ const { measure, shares } = languageShares(files);
50
+ const total = shares.reduce((sum, [, weight]) => sum + weight, 0);
51
+ container.hidden = shares.length < 2 || total === 0;
52
+ if (container.hidden)
53
+ return;
54
+ // Any language in the query dims the rest of the bar, even one this selection does not hold.
55
+ const anyPicked = clauses.some(clause => clause.kind === 'lang') || [...categories.keys()].some(name => holds(clauses, name));
56
+ const bar = element('div', 'fx-language-bar');
57
+ bar.setAttribute('aria-hidden', 'true');
58
+ const legend = element('div', 'fx-language-legend');
59
+ legend.setAttribute('role', 'group');
60
+ const measured = measure === 'bytes' ? 'size' : labelOf(measure).toLowerCase();
61
+ legend.setAttribute('aria-label', `Languages by ${measured}`);
62
+ for (const [language, weight] of shares) {
63
+ const pressed = holds(clauses, language);
64
+ const color = categories.get(language)?.color ?? languageColor(language);
65
+ const segment = element('span', !anyPicked || pressed ? 'fx-language-segment' : 'fx-language-segment fx-off');
66
+ segment.style.flexGrow = String(weight);
67
+ segment.style.background = color;
68
+ bar.append(segment);
69
+ const toggle = chip(language, shareText(weight / total), color, pressed);
70
+ toggle.addEventListener('click', () => set(toggleLanguage(clauses, language)));
71
+ legend.append(toggle);
72
+ }
73
+ // The bar says what it weighs, so its shares can be checked against a column of the table.
74
+ legend.append(element('span', 'fx-language-measure', `Share of ${measured}`));
75
+ container.replaceChildren(bar, legend);
76
+ }
@@ -0,0 +1,35 @@
1
+ import type { FileMetricsReport, LanguageSyntax } from '../../json/wire/file-metrics-model.js';
2
+ type FileEntry = FileMetricsReport['files'][number];
3
+ /** Takes the languages of the inspection on screen: their names, and the colours the plugins and the catalog give them. */
4
+ export declare function useLanguages(metrics: Pick<FileMetricsReport, 'languages' | 'files'>): void;
5
+ /** The id of a file's language, as the inspection gives it: what decides how its source is read. */
6
+ export declare function languageIdOf(path: string): string | undefined;
7
+ /** How a file's language is coloured, as its plugin declares it; none for a language that declares no syntax. */
8
+ export declare function syntaxOf(path: string): LanguageSyntax | undefined;
9
+ /**
10
+ * Dependency lockfiles, by exact file name. They are generated, often the largest files in a repository, and no
11
+ * plugin reads them: the language bar and the Metrics list give them a category of their own beside the ignored files.
12
+ */
13
+ export declare const lockfileNames: ReadonlySet<string>;
14
+ /** Whether a path names a lockfile: its file name, at any depth, exactly as the tools write it. */
15
+ export declare function isLockfile(path: string): boolean;
16
+ /** Whether no plugin read a file and it is not a lockfile: what the interface calls ignored. */
17
+ export declare function isIgnored(entry: Pick<FileEntry, 'path' | 'analysed'>): boolean;
18
+ /** The language bar's names for the two categories that are not languages. */
19
+ export declare const lockfilesLabel = "Lockfiles";
20
+ export declare const ignoredLabel = "Ignored";
21
+ /** What the language bar weighs: size in bytes, physical lines, or code lines. */
22
+ export type ShareMeasure = 'bytes' | 'lines' | 'code-lines';
23
+ /** Whether every file carries its size: inspections made before sizes were recorded carry none. */
24
+ export declare function sized(files: readonly Pick<FileEntry, 'bytes'>[]): boolean;
25
+ type Weighed = Pick<FileEntry, 'path' | 'analysed' | 'lines' | 'quality' | 'bytes' | 'language'>;
26
+ /** What the language bar weighs, largest language first, then lockfiles, then the ignored files. */
27
+ export declare function languageShares(files: readonly Weighed[]): {
28
+ readonly measure: ShareMeasure;
29
+ readonly shares: readonly (readonly [string, number])[];
30
+ };
31
+ /** A file's language by the inspection's name for it; a file it names none for is Other. */
32
+ export declare function languageOf(entry: Pick<FileEntry, 'language'>): string;
33
+ /** A language's colour, as the inspection gives it; a neutral grey for one it gives none. */
34
+ export declare function languageColor(language: string): string;
35
+ export {};
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The inspection's languages, which its files point to by index, the colour of each by its name, each file's id, and
3
+ * the syntax each language declares by its id.
4
+ */
5
+ let languages = [];
6
+ let colors = new Map();
7
+ let ids = new Map();
8
+ let syntaxes = new Map();
9
+ function nameOf(language) {
10
+ return language.label ?? language.id;
11
+ }
12
+ /** Takes the languages of the inspection on screen: their names, and the colours the plugins and the catalog give them. */
13
+ export function useLanguages(metrics) {
14
+ languages = metrics.languages ?? [];
15
+ colors = new Map(languages.flatMap(language => language.color ? [[nameOf(language), language.color]] : []));
16
+ ids = new Map(metrics.files.flatMap(file => file.language === undefined || !languages[file.language] ? []
17
+ : [[file.path, languages[file.language].id]]));
18
+ syntaxes = new Map(languages.flatMap(language => language.syntax ? [[language.id, language.syntax]] : []));
19
+ }
20
+ /** The id of a file's language, as the inspection gives it: what decides how its source is read. */
21
+ export function languageIdOf(path) {
22
+ return ids.get(path);
23
+ }
24
+ /** How a file's language is coloured, as its plugin declares it; none for a language that declares no syntax. */
25
+ export function syntaxOf(path) {
26
+ const id = ids.get(path);
27
+ return id === undefined ? undefined : syntaxes.get(id);
28
+ }
29
+ /**
30
+ * Dependency lockfiles, by exact file name. They are generated, often the largest files in a repository, and no
31
+ * plugin reads them: the language bar and the Metrics list give them a category of their own beside the ignored files.
32
+ */
33
+ export const lockfileNames = new Set([
34
+ 'package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lock', 'bun.lockb', 'deno.lock',
35
+ 'Cargo.lock', 'Gemfile.lock', 'composer.lock', 'poetry.lock', 'Pipfile.lock', 'uv.lock', 'go.sum', 'flake.lock',
36
+ 'mix.lock', 'pubspec.lock', 'packages.lock.json', 'gradle.lockfile',
37
+ ]);
38
+ /** Whether a path names a lockfile: its file name, at any depth, exactly as the tools write it. */
39
+ export function isLockfile(path) {
40
+ return lockfileNames.has(path.slice(path.lastIndexOf('/') + 1));
41
+ }
42
+ /** Whether no plugin read a file and it is not a lockfile: what the interface calls ignored. */
43
+ export function isIgnored(entry) {
44
+ return entry.analysed === false && !isLockfile(entry.path);
45
+ }
46
+ /** The language bar's names for the two categories that are not languages. */
47
+ export const lockfilesLabel = 'Lockfiles';
48
+ export const ignoredLabel = 'Ignored';
49
+ /** Whether every file carries its size: inspections made before sizes were recorded carry none. */
50
+ export function sized(files) {
51
+ return files.length > 0 && files.every(entry => entry.bytes !== undefined);
52
+ }
53
+ const weights = {
54
+ bytes: entry => entry.bytes,
55
+ lines: entry => entry.lines,
56
+ 'code-lines': entry => entry.quality?.codeLines,
57
+ };
58
+ /**
59
+ * Size in bytes when every file has it: one measure for code, lockfiles and ignored files alike, untouched by
60
+ * formatting. Without sizes, code lines where every file was read and has them, otherwise physical lines, the one line
61
+ * measure all files have: one bar never adds the two.
62
+ */
63
+ function shareMeasure(files) {
64
+ if (sized(files))
65
+ return 'bytes';
66
+ return files.every(entry => entry.analysed !== false && entry.quality?.codeLines !== undefined) ? 'code-lines' : 'lines';
67
+ }
68
+ /** Where a file's weight goes on the bar: its language, or one of the two categories. */
69
+ function shareOf(entry) {
70
+ if (isLockfile(entry.path))
71
+ return lockfilesLabel;
72
+ return entry.analysed === false ? ignoredLabel : languageOf(entry);
73
+ }
74
+ /** What the language bar weighs, largest language first, then lockfiles, then the ignored files. */
75
+ export function languageShares(files) {
76
+ const measure = shareMeasure(files);
77
+ const totals = new Map();
78
+ for (const entry of files)
79
+ totals.set(shareOf(entry), (totals.get(shareOf(entry)) ?? 0) + (weights[measure](entry) ?? 0));
80
+ const categories = [lockfilesLabel, ignoredLabel];
81
+ const shares = [...totals].filter(([name, weight]) => weight > 0 && !categories.includes(name)).sort((a, b) => b[1] - a[1]);
82
+ for (const name of categories) {
83
+ const weight = totals.get(name) ?? 0;
84
+ if (weight > 0)
85
+ shares.push([name, weight]);
86
+ }
87
+ return { measure, shares };
88
+ }
89
+ /** A file's language by the inspection's name for it; a file it names none for is Other. */
90
+ export function languageOf(entry) {
91
+ const language = entry.language === undefined ? undefined : languages[entry.language];
92
+ return language ? nameOf(language) : 'Other';
93
+ }
94
+ /** A language's colour, as the inspection gives it; a neutral grey for one it gives none. */
95
+ export function languageColor(language) {
96
+ return colors.get(language) ?? 'var(--neutral-2)';
97
+ }
@@ -0,0 +1,14 @@
1
+ import type { Navigation } from './viewer-inspection.js';
2
+ /**
3
+ * The handle between a list and its side panel: a line that shows on hover and drags the panel wider or narrower.
4
+ * Arrow keys move it too, a double click restores the default, and the width is remembered for this viewer.
5
+ */
6
+ export declare function splitter(split: HTMLElement): HTMLElement;
7
+ /**
8
+ * Raises a side column so its heading stands on the page title's baseline: the list and its summary read as one
9
+ * row of headings. What sits between the title and the panel (a folder path, a toolbar) varies, so the distance is
10
+ * measured, and measured again whenever the page above the panel changes height. One column on a narrow screen: no lift.
11
+ */
12
+ export declare function liftToTitle(split: HTMLElement, headingSelector: string): void;
13
+ /** The folder trail above a list: each folder a link, the current one a label, nothing at the root. */
14
+ export declare function breadcrumbs(view: 'metrics' | 'hotspots', navigation: Pick<Navigation, 'href'>, directory: string): HTMLElement;
@@ -0,0 +1,134 @@
1
+ import { element, link, store, stored } from './viewer-dom.js';
2
+ const asideKey = 'repometry.aside';
3
+ /**
4
+ * The handle between a list and its side panel: a line that shows on hover and drags the panel wider or narrower.
5
+ * Arrow keys move it too, a double click restores the default, and the width is remembered for this viewer.
6
+ */
7
+ export function splitter(split) {
8
+ const handle = element('div', 'fx-splitter');
9
+ handle.tabIndex = 0;
10
+ handle.setAttribute('role', 'separator');
11
+ handle.setAttribute('aria-orientation', 'vertical');
12
+ handle.setAttribute('aria-label', 'Resize the side panel');
13
+ handle.title = 'Drag to resize; double-click to reset';
14
+ const apply = (width) => {
15
+ if (width === null) {
16
+ split.style.removeProperty('--aside');
17
+ return;
18
+ }
19
+ const clamped = Math.round(Math.min(Math.max(224, split.clientWidth * .55), Math.max(224, width)));
20
+ split.style.setProperty('--aside', `${clamped}px`);
21
+ handle.setAttribute('aria-valuenow', String(clamped));
22
+ };
23
+ const save = (width) => store(() => localStorage, asideKey, width === null ? null : String(Math.round(width)));
24
+ const current = () => split.lastElementChild instanceof HTMLElement && split.lastElementChild !== handle
25
+ ? split.lastElementChild.getBoundingClientRect().width : 320;
26
+ const remembered = Number(stored(() => localStorage, asideKey));
27
+ if (remembered > 0)
28
+ requestAnimationFrame(() => apply(remembered));
29
+ handle.addEventListener('pointerdown', event => {
30
+ event.preventDefault();
31
+ handle.setPointerCapture(event.pointerId);
32
+ split.classList.add('fx-resizing');
33
+ const right = split.getBoundingClientRect().right;
34
+ const move = (next) => apply(right - next.clientX - handle.offsetWidth / 2);
35
+ const stop = () => {
36
+ split.classList.remove('fx-resizing');
37
+ save(current());
38
+ handle.removeEventListener('pointermove', move);
39
+ handle.removeEventListener('pointerup', stop);
40
+ handle.removeEventListener('pointercancel', stop);
41
+ };
42
+ handle.addEventListener('pointermove', move);
43
+ handle.addEventListener('pointerup', stop);
44
+ handle.addEventListener('pointercancel', stop);
45
+ });
46
+ handle.addEventListener('keydown', event => {
47
+ const step = arrowSteps.get(event.key);
48
+ if (step === undefined)
49
+ return;
50
+ event.preventDefault();
51
+ apply(current() + step);
52
+ save(current());
53
+ });
54
+ handle.addEventListener('dblclick', () => { apply(null); save(null); });
55
+ liftToTitle(split, ':scope > .fx-aside h2');
56
+ return handle;
57
+ }
58
+ /** The side panel sits at the right: the left arrow widens it. */
59
+ const arrowSteps = new Map([['ArrowLeft', 24], ['ArrowRight', -24]]);
60
+ /** Where a text's baseline is: its box ends below the baseline by the descent, about a fifth of its height. */
61
+ function baseline(node) {
62
+ const range = document.createRange();
63
+ range.selectNodeContents(node);
64
+ const box = range.getBoundingClientRect();
65
+ return box.bottom - box.height * .2;
66
+ }
67
+ /** The child of `parent` that holds `node`. */
68
+ function columnOf(node, parent) {
69
+ let column = node;
70
+ while (column.parentElement && column.parentElement !== parent)
71
+ column = column.parentElement;
72
+ return column;
73
+ }
74
+ /**
75
+ * Raises a side column so its heading stands on the page title's baseline: the list and its summary read as one
76
+ * row of headings. What sits between the title and the panel (a folder path, a toolbar) varies, so the distance is
77
+ * measured, and measured again whenever the page above the panel changes height. One column on a narrow screen: no lift.
78
+ */
79
+ export function liftToTitle(split, headingSelector) {
80
+ const measure = () => {
81
+ const title = split.closest('section')?.querySelector(':scope > h2');
82
+ const heading = split.querySelector(headingSelector);
83
+ const columns = getComputedStyle(split).gridTemplateColumns.split(' ').length;
84
+ if (!split.isConnected || !title || !heading || columns < 2) {
85
+ split.style.removeProperty('--lift');
86
+ return;
87
+ }
88
+ // The column may be sticky, and once the page scrolls its box no longer sits where the layout put it. So the
89
+ // heading is measured inside its column, and the column's place is taken from the grid, which never sticks:
90
+ // unlifted, a first-row column starts at the top of the grid's content box.
91
+ const style = getComputedStyle(split);
92
+ const top = split.getBoundingClientRect().top + parseFloat(style.borderTopWidth) + parseFloat(style.paddingTop);
93
+ const offset = baseline(heading) - columnOf(heading, split).getBoundingClientRect().top;
94
+ const current = parseFloat(split.style.getPropertyValue('--lift')) || 0;
95
+ const next = Math.max(0, Math.round(top + offset - baseline(title)));
96
+ if (next !== current)
97
+ split.style.setProperty('--lift', `${next}px`);
98
+ };
99
+ const observer = new ResizeObserver(() => {
100
+ if (split.isConnected)
101
+ measure();
102
+ else
103
+ observer.disconnect();
104
+ });
105
+ requestAnimationFrame(() => {
106
+ measure();
107
+ // The page section, not the view: a view may be laid out through display: contents and never resize itself.
108
+ const page = split.closest('section') ?? split.parentElement;
109
+ if (page)
110
+ observer.observe(page);
111
+ });
112
+ }
113
+ /** The folder trail above a list: each folder a link, the current one a label, nothing at the root. */
114
+ export function breadcrumbs(view, navigation, directory) {
115
+ const nav = element('nav', 'fx-breadcrumbs');
116
+ nav.setAttribute('aria-label', 'Folder path');
117
+ const list = element('ol');
118
+ const segments = directory === '' ? [] : directory.split('/');
119
+ const crumb = (label, target) => {
120
+ const item = element('li');
121
+ if (target === null) {
122
+ item.setAttribute('aria-current', 'location');
123
+ item.textContent = label;
124
+ }
125
+ else
126
+ item.append(link(navigation.href(view, target ? { directory: target } : undefined), label));
127
+ return item;
128
+ };
129
+ list.append(crumb('repo', directory === '' ? null : ''), ...segments.map((part, index) => crumb(part, index === segments.length - 1 ? null : segments.slice(0, index + 1).join('/'))));
130
+ nav.append(list);
131
+ // At the root the trail is a single label that says nothing the page title does not.
132
+ nav.hidden = directory === '';
133
+ return nav;
134
+ }
@@ -0,0 +1,47 @@
1
+ import type { InspectionDetails } from '../../json/wire/inspection-details-model.js';
2
+ /** Line ranges of one file's coverage: 1-based, inclusive and merged. Partial lines ran with some branches missed. */
3
+ export type FileLineCoverage = NonNullable<InspectionDetails['lineCoverage']>[string];
4
+ export type LineState = 'covered' | 'partial' | 'uncovered';
5
+ /** What the source view's lines show: the inspection's findings and complexity, or the tests' coverage. */
6
+ export type SourceLayer = 'issues' | 'coverage';
7
+ export declare function isSourceLayer(value: string | null | undefined): value is SourceLayer;
8
+ /** Switches a rendered source between its findings and its coverage, without drawing it again. */
9
+ export declare function setSourceLayer(container: HTMLElement, layer: SourceLayer): void;
10
+ /**
11
+ * Each line's coverage, by line number; a line no range names was not measured. Where ranges overlap, the worse
12
+ * state wins: a line a test missed is never shown as covered.
13
+ */
14
+ export declare function lineStates(coverage: FileLineCoverage): Map<number, LineState>;
15
+ /** Runs of equal hit counts: first and last line, 1-based and inclusive, and how often tests ran them; 0 is a miss. */
16
+ export type HitRun = readonly [first: number, last: number, count: number];
17
+ /** How often tests ran each line, where the report carries the counts; an older report has none. */
18
+ export declare function lineHits(coverage: FileLineCoverage): Map<number, number>;
19
+ /** A count short enough for the gutter: 3×, 980×, 1.2K×, 45K×, 270K×, 3.4M×. */
20
+ export declare function hitLabel(count: number): string;
21
+ /** What a measured line says to a pointer and a screen reader: its state, and how often it ran where that is known. */
22
+ export declare function lineCoverageText(state: LineState, count?: number): string;
23
+ /** What the gutter shows on a measured line: its state, the count it writes, and the words for both. */
24
+ export interface LineReading {
25
+ readonly state: LineState;
26
+ /** How often the line ran, or how often the functions it starts were called; none where no run is counted. */
27
+ readonly count?: number;
28
+ readonly text: string;
29
+ }
30
+ /**
31
+ * A declaration line reads as its functions' calls, not as the line's own count: that is how often the module was
32
+ * loaded. Called is covered; never called is red, with no number; where only some of the functions starting on the
33
+ * line ran, it is partial.
34
+ */
35
+ export declare function callReading(calls: readonly number[]): LineReading;
36
+ /**
37
+ * What each measured line shows. A line that starts functions shows their calls. Inside a function body a line shows
38
+ * how often it ran. Module-level code runs once per load, so its count says nothing about tests: it keeps its tint and
39
+ * shows no number. A report without function bodies cannot tell the two apart, and every line shows its own count.
40
+ */
41
+ export declare function lineReadings(coverage: FileLineCoverage): Map<number, LineReading>;
42
+ /**
43
+ * The tint the lines without a coverage record take so the strip has no breaks. Coverage records only code, so such a
44
+ * line is a blank, a comment or a declaration no test can run: between two records it takes the state above, the block
45
+ * it closes; before the first record, the state below. After the last record the strip ends.
46
+ */
47
+ export declare function bridgeStates(states: ReadonlyMap<number, LineState>): Map<number, LineState>;
@@ -0,0 +1,108 @@
1
+ export function isSourceLayer(value) {
2
+ return value === 'issues' || value === 'coverage';
3
+ }
4
+ /** Switches a rendered source between its findings and its coverage, without drawing it again. */
5
+ export function setSourceLayer(container, layer) {
6
+ const code = container.querySelector(':scope > .src');
7
+ if (code)
8
+ code.dataset.layer = layer;
9
+ }
10
+ /** Calls back for each line of each range, from line 1 at the earliest. */
11
+ function eachLine(ranges, visit) {
12
+ for (const range of ranges ?? [])
13
+ for (let line = Math.max(1, range[0]); line <= range[1]; line++)
14
+ visit(line, range);
15
+ }
16
+ /**
17
+ * Each line's coverage, by line number; a line no range names was not measured. Where ranges overlap, the worse
18
+ * state wins: a line a test missed is never shown as covered.
19
+ */
20
+ export function lineStates(coverage) {
21
+ const states = new Map();
22
+ for (const state of ['covered', 'partial', 'uncovered'])
23
+ eachLine(coverage[state], line => states.set(line, state));
24
+ return states;
25
+ }
26
+ /** How often tests ran each line, where the report carries the counts; an older report has none. */
27
+ export function lineHits(coverage) {
28
+ const hits = new Map();
29
+ eachLine(coverage.hits, (line, run) => hits.set(line, run[2]));
30
+ return hits;
31
+ }
32
+ // Two figures are enough for a glance; the tooltip has the whole count.
33
+ const compactCount = new Intl.NumberFormat('en', { notation: 'compact', maximumSignificantDigits: 2 });
34
+ const fullCount = new Intl.NumberFormat();
35
+ /** A count short enough for the gutter: 3×, 980×, 1.2K×, 45K×, 270K×, 3.4M×. */
36
+ export function hitLabel(count) {
37
+ return `${count < 1000 ? count : compactCount.format(count)}×`;
38
+ }
39
+ const lineStateNames = {
40
+ covered: 'Covered', partial: 'Partly covered: some branches missed', uncovered: 'Not covered',
41
+ };
42
+ /** What a measured line says to a pointer and a screen reader: its state, and how often it ran where that is known. */
43
+ export function lineCoverageText(state, count) {
44
+ if (count === undefined || state === 'uncovered')
45
+ return lineStateNames[state];
46
+ return `${lineStateNames[state]}. Ran ${fullCount.format(count)} ${count === 1 ? 'time' : 'times'}`;
47
+ }
48
+ function times(count) {
49
+ return `${fullCount.format(count)} ${count === 1 ? 'time' : 'times'}`;
50
+ }
51
+ /**
52
+ * A declaration line reads as its functions' calls, not as the line's own count: that is how often the module was
53
+ * loaded. Called is covered; never called is red, with no number; where only some of the functions starting on the
54
+ * line ran, it is partial.
55
+ */
56
+ export function callReading(calls) {
57
+ const total = calls.reduce((sum, count) => sum + count, 0);
58
+ const idle = calls.filter(count => count === 0).length;
59
+ if (total === 0)
60
+ return { state: 'uncovered', text: calls.length === 1 ? 'Not called' : `Not called: none of the ${calls.length} functions here ran` };
61
+ if (idle === 0)
62
+ return { state: 'covered', count: total, text: `Called ${times(total)}` };
63
+ return { state: 'partial', count: total, text: `Partly called: ${idle} of the ${calls.length} functions here never ran. Called ${times(total)}` };
64
+ }
65
+ /** The calls of the functions that start on each line. */
66
+ function callsByLine(coverage) {
67
+ const calls = new Map();
68
+ for (const [line, count] of coverage.functionCalls ?? [])
69
+ calls.set(line, [...calls.get(line) ?? [], count]);
70
+ return calls;
71
+ }
72
+ /**
73
+ * What each measured line shows. A line that starts functions shows their calls. Inside a function body a line shows
74
+ * how often it ran. Module-level code runs once per load, so its count says nothing about tests: it keeps its tint and
75
+ * shows no number. A report without function bodies cannot tell the two apart, and every line shows its own count.
76
+ */
77
+ export function lineReadings(coverage) {
78
+ const states = lineStates(coverage);
79
+ const hits = lineHits(coverage);
80
+ const calls = callsByLine(coverage);
81
+ const inBody = new Set();
82
+ eachLine(coverage.functionBodies, line => inBody.add(line));
83
+ const counted = (line) => coverage.functionBodies === undefined || inBody.has(line);
84
+ const readings = new Map();
85
+ for (const [line, state] of states) {
86
+ const count = counted(line) ? hits.get(line) : undefined;
87
+ readings.set(line, { state, ...(count === undefined ? {} : { count }), text: lineCoverageText(state, count) });
88
+ }
89
+ for (const [line, counts] of calls)
90
+ readings.set(line, callReading(counts));
91
+ return readings;
92
+ }
93
+ /**
94
+ * The tint the lines without a coverage record take so the strip has no breaks. Coverage records only code, so such a
95
+ * line is a blank, a comment or a declaration no test can run: between two records it takes the state above, the block
96
+ * it closes; before the first record, the state below. After the last record the strip ends.
97
+ */
98
+ export function bridgeStates(states) {
99
+ const lines = [...states.keys()].sort((a, b) => a - b);
100
+ const bridged = new Map();
101
+ const fill = (from, to, state) => { for (let at = from; at < to; at++)
102
+ bridged.set(at, state); };
103
+ if (lines.length)
104
+ fill(1, lines[0], states.get(lines[0]));
105
+ for (const [index, line] of lines.slice(0, -1).entries())
106
+ fill(line + 1, lines[index + 1], states.get(line));
107
+ return bridged;
108
+ }
@@ -0,0 +1,16 @@
1
+ import type { Finding } from '../../json/wire/domain-types.js';
2
+ /** Where a finding points: its primary place first, then the related ones. */
3
+ export interface Location {
4
+ readonly path: string;
5
+ readonly line?: number;
6
+ readonly endLine?: number;
7
+ }
8
+ export declare function allLocations(finding: Finding): readonly Location[];
9
+ /** The distinct files a finding touches. */
10
+ export declare function locationPaths(finding: Finding): Set<string>;
11
+ export declare function atPath(finding: Finding, path: string): boolean;
12
+ export declare function formatLocation(location: Location): string;
13
+ /** How many findings touch each file, a finding with several places in one file counted once. */
14
+ export declare function findingIndex(findings: readonly Finding[]): Map<string, number>;
15
+ /** The line of a file a finding points at, through its related places when its primary one is elsewhere. */
16
+ export declare function lineIn(finding: Finding, path: string): number | undefined;
@@ -0,0 +1,31 @@
1
+ export function allLocations(finding) {
2
+ return [
3
+ ...(finding.path ? [{ path: finding.path, line: finding.line, endLine: finding.endLine }] : []),
4
+ ...(finding.related ?? []),
5
+ ];
6
+ }
7
+ /** The distinct files a finding touches. */
8
+ export function locationPaths(finding) {
9
+ return new Set(allLocations(finding).map(location => location.path));
10
+ }
11
+ export function atPath(finding, path) {
12
+ return finding.path === path || (finding.related?.some(location => location.path === path) ?? false);
13
+ }
14
+ export function formatLocation(location) {
15
+ if (location.line === undefined)
16
+ return location.path;
17
+ const end = location.endLine !== undefined && location.endLine > location.line ? `–${location.endLine}` : '';
18
+ return `${location.path}:${location.line}${end}`;
19
+ }
20
+ /** How many findings touch each file, a finding with several places in one file counted once. */
21
+ export function findingIndex(findings) {
22
+ const index = new Map();
23
+ for (const finding of findings)
24
+ for (const path of locationPaths(finding))
25
+ index.set(path, (index.get(path) ?? 0) + 1);
26
+ return index;
27
+ }
28
+ /** The line of a file a finding points at, through its related places when its primary one is elsewhere. */
29
+ export function lineIn(finding, path) {
30
+ return finding.path === path ? finding.line : finding.related?.find(location => location.path === path)?.line;
31
+ }
@@ -0,0 +1,26 @@
1
+ import type { InspectionDetails } from '../../json/wire/inspection-details-model.js';
2
+ import type { HotspotMetric, Metrics } from './viewer-inspection.js';
3
+ /** What a metric is called where files are ranked by it. */
4
+ export declare function rankTitle(metric: HotspotMetric): string;
5
+ export declare function scoreLabel(metric: HotspotMetric): string;
6
+ /** The profile's limits for a metric with a meaningful scale, when they are well formed; otherwise the defaults. */
7
+ export declare function bandLimits(details: Pick<InspectionDetails, 'bands'>, metric: HotspotMetric): readonly number[] | undefined;
8
+ /** What the map's colour shows, said to assistive technology. */
9
+ export declare function meaningOf(metric: HotspotMetric): string;
10
+ /** Maps a score to one of five colour bands: by the profile's limits where the metric has a meaningful scale. */
11
+ export declare function band(entry: Metrics, metric: HotspotMetric, score: number, highest: number, limits?: readonly number[] | undefined): number;
12
+ /** Each file's worst level spread to the folders above it. */
13
+ export declare function spreadLevels(files: ReadonlyMap<string, number>): Map<string, number>;
14
+ /**
15
+ * The top of a relative colour scale, per level: files against files, folders against the folders at their depth. One
16
+ * scale for both would let a folder's sum outshine every file in it, and the map would read hot folders over pale files.
17
+ */
18
+ export declare function relativePeaks(entries: readonly {
19
+ readonly path: string;
20
+ readonly folder: boolean;
21
+ readonly score: number | null;
22
+ }[]): (path: string, folder: boolean) => number;
23
+ export declare function levelLegend(): HTMLElement;
24
+ export declare function sunburstLegend(metric: HotspotMetric, limits: readonly number[] | undefined): HTMLElement;
25
+ /** The map's colours: grade steps for security, grey for nothing measured, heat where higher is worse, else neutral. */
26
+ export declare function palette(metric: HotspotMetric, levels: boolean, grey: boolean): string;