@repometry/cli 0.0.0-dev.0 → 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.
- package/LICENSE +21 -0
- package/README.md +70 -3
- package/package.json +65 -2
- package/target/main/resources/language-catalog.json +61 -0
- package/target/main/resources/report/json/compact-json-v1.schema.json +24 -0
- package/target/main/resources/report/json/comparison-v1.schema.json +65 -0
- package/target/main/resources/report/json/config-v2.schema.json +224 -0
- package/target/main/resources/report/json/diff-coverage-v1.schema.json +55 -0
- package/target/main/resources/report/json/file-metrics-v1.schema.json +157 -0
- package/target/main/resources/report/json/metabranch-v1.schema.json +9 -0
- package/target/main/resources/report/json/metric-catalog-v1.schema.json +31 -0
- package/target/main/resources/report/json/pull-review-v1.schema.json +97 -0
- package/target/main/resources/report/json/pull-review-v2.schema.json +100 -0
- package/target/main/resources/report/json/report-v2.schema.json +530 -0
- package/target/main/resources/report/json/repository-summary-v1.schema.json +337 -0
- package/target/main/resources/report/json/viewer-inspection-v1.schema.json +534 -0
- package/target/main/resources/viewer/files.css +616 -0
- package/target/main/resources/viewer/index.html +120 -0
- package/target/main/resources/viewer/projects.html +52 -0
- package/target/main/resources/viewer/styles.css +579 -0
- package/target/main/resources/viewer/viewer-pulls.css +64 -0
- package/target/main/ts/api/cache/root.d.ts +2 -0
- package/target/main/ts/api/cache/root.js +21 -0
- package/target/main/ts/api/gh/github.d.ts +4 -0
- package/target/main/ts/api/gh/github.js +47 -0
- package/target/main/ts/api/git/blob-batch.d.ts +10 -0
- package/target/main/ts/api/git/blob-batch.js +107 -0
- package/target/main/ts/api/git/blob-history.d.ts +20 -0
- package/target/main/ts/api/git/blob-history.js +54 -0
- package/target/main/ts/api/git/changes.d.ts +27 -0
- package/target/main/ts/api/git/changes.js +117 -0
- package/target/main/ts/api/git/commit-metadata.d.ts +2 -0
- package/target/main/ts/api/git/commit-metadata.js +46 -0
- package/target/main/ts/api/git/git-churn.d.ts +9 -0
- package/target/main/ts/api/git/git-churn.js +72 -0
- package/target/main/ts/api/git/git-executable.d.ts +1 -0
- package/target/main/ts/api/git/git-executable.js +31 -0
- package/target/main/ts/api/git/git-reader.d.ts +24 -0
- package/target/main/ts/api/git/git-reader.js +113 -0
- package/target/main/ts/api/git/git.d.ts +47 -0
- package/target/main/ts/api/git/git.js +289 -0
- package/target/main/ts/api/git/inspection-source.d.ts +17 -0
- package/target/main/ts/api/git/inspection-source.js +36 -0
- package/target/main/ts/api/git/line-changes.d.ts +6 -0
- package/target/main/ts/api/git/line-changes.js +57 -0
- package/target/main/ts/api/git/local-sources.d.ts +5 -0
- package/target/main/ts/api/git/local-sources.js +48 -0
- package/target/main/ts/api/git/local.d.ts +7 -0
- package/target/main/ts/api/git/local.js +106 -0
- package/target/main/ts/api/git/source-cache.d.ts +1 -0
- package/target/main/ts/api/git/source-cache.js +42 -0
- package/target/main/ts/api/import/cobertura.d.ts +2 -0
- package/target/main/ts/api/import/cobertura.js +160 -0
- package/target/main/ts/api/import/coverage-xml.d.ts +7 -0
- package/target/main/ts/api/import/coverage-xml.js +135 -0
- package/target/main/ts/api/import/finding-import.d.ts +9 -0
- package/target/main/ts/api/import/finding-import.js +227 -0
- package/target/main/ts/api/import/go-cover.d.ts +13 -0
- package/target/main/ts/api/import/go-cover.js +150 -0
- package/target/main/ts/api/import/lcov-files.d.ts +12 -0
- package/target/main/ts/api/import/lcov-files.js +53 -0
- package/target/main/ts/api/import/profile-file.d.ts +4 -0
- package/target/main/ts/api/import/profile-file.js +17 -0
- package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
- package/target/main/ts/api/process/docker-tool-runner.js +92 -0
- package/target/main/ts/api/process/failure.d.ts +1 -0
- package/target/main/ts/api/process/failure.js +12 -0
- package/target/main/ts/api/process/plugin.d.ts +13 -0
- package/target/main/ts/api/process/plugin.js +100 -0
- package/target/main/ts/api/process/tool-snapshot.d.ts +3 -0
- package/target/main/ts/api/process/tool-snapshot.js +26 -0
- package/target/main/ts/cli/arguments.d.ts +28 -0
- package/target/main/ts/cli/arguments.js +109 -0
- package/target/main/ts/cli/config.d.ts +63 -0
- package/target/main/ts/cli/config.js +165 -0
- package/target/main/ts/cli/imports.d.ts +9 -0
- package/target/main/ts/cli/imports.js +37 -0
- package/target/main/ts/cli/main.d.ts +2 -0
- package/target/main/ts/cli/main.js +4 -0
- package/target/main/ts/cli/range-inspection.d.ts +38 -0
- package/target/main/ts/cli/range-inspection.js +34 -0
- package/target/main/ts/cli/range-jobs.d.ts +23 -0
- package/target/main/ts/cli/range-jobs.js +152 -0
- package/target/main/ts/cli/range-worker.d.ts +1 -0
- package/target/main/ts/cli/range-worker.js +40 -0
- package/target/main/ts/cli/reporting.d.ts +42 -0
- package/target/main/ts/cli/reporting.js +98 -0
- package/target/main/ts/cli/revisions.d.ts +6 -0
- package/target/main/ts/cli/revisions.js +16 -0
- package/target/main/ts/cli/run.d.ts +2 -0
- package/target/main/ts/cli/run.js +306 -0
- package/target/main/ts/cli/store.d.ts +13 -0
- package/target/main/ts/cli/store.js +39 -0
- package/target/main/ts/compose/analysis-report.d.ts +6 -0
- package/target/main/ts/compose/analysis-report.js +131 -0
- package/target/main/ts/compose/analysis-results.d.ts +42 -0
- package/target/main/ts/compose/analysis-results.js +84 -0
- package/target/main/ts/compose/analysis-steps.d.ts +23 -0
- package/target/main/ts/compose/analysis-steps.js +217 -0
- package/target/main/ts/compose/analyze-snapshot.d.ts +7 -0
- package/target/main/ts/compose/analyze-snapshot.js +21 -0
- package/target/main/ts/compose/attach-churn.d.ts +2 -0
- package/target/main/ts/compose/attach-churn.js +50 -0
- package/target/main/ts/compose/built-ins.d.ts +6 -0
- package/target/main/ts/compose/built-ins.js +12 -0
- package/target/main/ts/compose/diff-coverage.d.ts +25 -0
- package/target/main/ts/compose/diff-coverage.js +82 -0
- package/target/main/ts/compose/distribution.d.ts +17 -0
- package/target/main/ts/compose/distribution.js +13 -0
- package/target/main/ts/compose/docker-image.d.ts +5 -0
- package/target/main/ts/compose/docker-image.js +49 -0
- package/target/main/ts/compose/file-selection.d.ts +9 -0
- package/target/main/ts/compose/file-selection.js +38 -0
- package/target/main/ts/compose/history-cache.d.ts +31 -0
- package/target/main/ts/compose/history-cache.js +62 -0
- package/target/main/ts/compose/inspect.d.ts +34 -0
- package/target/main/ts/compose/inspect.js +51 -0
- package/target/main/ts/compose/inspection-coverage.d.ts +9 -0
- package/target/main/ts/compose/inspection-coverage.js +9 -0
- package/target/main/ts/compose/js-plugin.d.ts +113 -0
- package/target/main/ts/compose/js-plugin.js +99 -0
- package/target/main/ts/compose/language-discovery.d.ts +12 -0
- package/target/main/ts/compose/language-discovery.js +51 -0
- package/target/main/ts/compose/languages.d.ts +64 -0
- package/target/main/ts/compose/languages.js +98 -0
- package/target/main/ts/compose/load-plugins.d.ts +6 -0
- package/target/main/ts/compose/load-plugins.js +71 -0
- package/target/main/ts/compose/parser-order.d.ts +20 -0
- package/target/main/ts/compose/parser-order.js +90 -0
- package/target/main/ts/compose/phases.d.ts +140 -0
- package/target/main/ts/compose/phases.js +147 -0
- package/target/main/ts/compose/plugin-list.d.ts +37 -0
- package/target/main/ts/compose/plugin-list.js +30 -0
- package/target/main/ts/compose/plugin-manifest.d.ts +14 -0
- package/target/main/ts/compose/plugin-manifest.js +50 -0
- package/target/main/ts/compose/plugin-options.d.ts +2 -0
- package/target/main/ts/compose/plugin-options.js +29 -0
- package/target/main/ts/compose/plugin-reference.d.ts +9 -0
- package/target/main/ts/compose/plugin-reference.js +40 -0
- package/target/main/ts/compose/plugin-requirements.d.ts +5 -0
- package/target/main/ts/compose/plugin-requirements.js +83 -0
- package/target/main/ts/compose/plugin-scope.d.ts +9 -0
- package/target/main/ts/compose/plugin-scope.js +60 -0
- package/target/main/ts/compose/process-plugins.d.ts +89 -0
- package/target/main/ts/compose/process-plugins.js +74 -0
- package/target/main/ts/compose/registered-plugin.d.ts +17 -0
- package/target/main/ts/compose/registered-plugin.js +8 -0
- package/target/main/ts/compose/review.d.ts +26 -0
- package/target/main/ts/compose/review.js +54 -0
- package/target/main/ts/compose/schema-error.d.ts +2 -0
- package/target/main/ts/compose/schema-error.js +16 -0
- package/target/main/ts/compose/sources.d.ts +2 -0
- package/target/main/ts/compose/sources.js +32 -0
- package/target/main/ts/compose/structure-measures.d.ts +9 -0
- package/target/main/ts/compose/structure-measures.js +63 -0
- package/target/main/ts/index.d.ts +8 -0
- package/target/main/ts/index.js +5 -0
- package/target/main/ts/plugin.d.ts +2 -0
- package/target/main/ts/plugin.js +2 -0
- package/target/main/ts/plugins/built-in.d.ts +3 -0
- package/target/main/ts/plugins/built-in.js +19 -0
- package/target/main/ts/plugins/coverage/coverage.d.ts +11 -0
- package/target/main/ts/plugins/coverage/coverage.js +289 -0
- package/target/main/ts/plugins/coverage/diff-coverage.d.ts +3 -0
- package/target/main/ts/plugins/coverage/diff-coverage.js +85 -0
- package/target/main/ts/plugins/duplication/duplication.d.ts +2 -0
- package/target/main/ts/plugins/duplication/duplication.js +95 -0
- package/target/main/ts/plugins/language-js/babel-provider.d.ts +10 -0
- package/target/main/ts/plugins/language-js/babel-provider.js +54 -0
- package/target/main/ts/plugins/language-js/clone-candidates.d.ts +3 -0
- package/target/main/ts/plugins/language-js/clone-candidates.js +65 -0
- package/target/main/ts/plugins/language-js/code-lines.d.ts +6 -0
- package/target/main/ts/plugins/language-js/code-lines.js +36 -0
- package/target/main/ts/plugins/language-js/extensions.d.ts +1 -0
- package/target/main/ts/plugins/language-js/extensions.js +3 -0
- package/target/main/ts/plugins/language-js/function-facts.d.ts +9 -0
- package/target/main/ts/plugins/language-js/function-facts.js +74 -0
- package/target/main/ts/plugins/language-js/js-security.d.ts +4 -0
- package/target/main/ts/plugins/language-js/js-security.js +497 -0
- package/target/main/ts/plugins/language-js/qualified-names.d.ts +11 -0
- package/target/main/ts/plugins/language-js/qualified-names.js +63 -0
- package/target/main/ts/plugins/language-js/structural-observations.d.ts +9 -0
- package/target/main/ts/plugins/language-js/structural-observations.js +85 -0
- package/target/main/ts/plugins/language-js/syntax.d.ts +2 -0
- package/target/main/ts/plugins/language-js/syntax.js +11 -0
- package/target/main/ts/plugins/maintainability/maintainability.d.ts +2 -0
- package/target/main/ts/plugins/maintainability/maintainability.js +38 -0
- package/target/main/ts/plugins/maintainability/structural-smells.d.ts +3 -0
- package/target/main/ts/plugins/maintainability/structural-smells.js +17 -0
- package/target/main/ts/plugins/security/actions-security.d.ts +2 -0
- package/target/main/ts/plugins/security/actions-security.js +581 -0
- package/target/main/ts/plugins/security/dockerfile.d.ts +2 -0
- package/target/main/ts/plugins/security/dockerfile.js +487 -0
- package/target/main/ts/plugins/security/npm-supply-chain.d.ts +4 -0
- package/target/main/ts/plugins/security/npm-supply-chain.js +368 -0
- package/target/main/ts/plugins/security/secrets.d.ts +12 -0
- package/target/main/ts/plugins/security/secrets.js +254 -0
- package/target/main/ts/plugins/source/forges.d.ts +4 -0
- package/target/main/ts/plugins/source/forges.js +80 -0
- package/target/main/ts/plugins/structure/structure.d.ts +2 -0
- package/target/main/ts/plugins/structure/structure.js +42 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-chart-bars.js +59 -0
- package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
- package/target/main/ts/report/html/app/viewer-chart-line.d.ts +33 -0
- package/target/main/ts/report/html/app/viewer-chart-line.js +88 -0
- package/target/main/ts/report/html/app/viewer-chart-points.d.ts +52 -0
- package/target/main/ts/report/html/app/viewer-chart-points.js +65 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
- package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
- package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
- package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
- package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
- package/target/main/ts/report/html/app/viewer-chart.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-chart.js +50 -0
- package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-code-map.js +176 -0
- package/target/main/ts/report/html/app/viewer-columns.d.ts +40 -0
- package/target/main/ts/report/html/app/viewer-columns.js +97 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
- package/target/main/ts/report/html/app/viewer-commits.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-commits.js +81 -0
- package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
- package/target/main/ts/report/html/app/viewer-controls.js +141 -0
- package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-copy.js +64 -0
- package/target/main/ts/report/html/app/viewer-data.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-data.js +78 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
- package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-dom.js +99 -0
- package/target/main/ts/report/html/app/viewer-file-aside.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-file-aside.js +134 -0
- package/target/main/ts/report/html/app/viewer-file-figures.d.ts +17 -0
- package/target/main/ts/report/html/app/viewer-file-figures.js +65 -0
- package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
- package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
- package/target/main/ts/report/html/app/viewer-files.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-files.js +40 -0
- package/target/main/ts/report/html/app/viewer-filter.d.ts +65 -0
- package/target/main/ts/report/html/app/viewer-filter.js +161 -0
- package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-hotspots.js +133 -0
- package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
- package/target/main/ts/report/html/app/viewer-inspection.js +38 -0
- package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
- package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-issues.js +173 -0
- package/target/main/ts/report/html/app/viewer-language-bar.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-language-bar.js +76 -0
- package/target/main/ts/report/html/app/viewer-languages.d.ts +35 -0
- package/target/main/ts/report/html/app/viewer-languages.js +97 -0
- package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
- package/target/main/ts/report/html/app/viewer-layout.js +134 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-line-coverage.js +108 -0
- package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
- package/target/main/ts/report/html/app/viewer-locations.js +31 -0
- package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
- package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
- package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
- package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
- package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
- package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +47 -0
- package/target/main/ts/report/html/app/viewer-metric-registry.js +138 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-metrics-view.js +159 -0
- package/target/main/ts/report/html/app/viewer-metrics.d.ts +51 -0
- package/target/main/ts/report/html/app/viewer-metrics.js +195 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-cards.js +121 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
- package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
- package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
- package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
- package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
- package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
- package/target/main/ts/report/html/app/viewer-profile.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-profile.js +180 -0
- package/target/main/ts/report/html/app/viewer-projects.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer-projects.js +90 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
- package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
- package/target/main/ts/report/html/app/viewer-pulls.d.ts +2 -0
- package/target/main/ts/report/html/app/viewer-pulls.js +92 -0
- package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
- package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
- package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
- package/target/main/ts/report/html/app/viewer-route.js +55 -0
- package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-shell.js +113 -0
- package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
- package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
- package/target/main/ts/report/html/app/viewer-source.d.ts +27 -0
- package/target/main/ts/report/html/app/viewer-source.js +57 -0
- package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
- package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
- package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
- package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
- package/target/main/ts/report/html/app/viewer-table-cells.js +135 -0
- package/target/main/ts/report/html/app/viewer-table-rows.d.ts +56 -0
- package/target/main/ts/report/html/app/viewer-table-rows.js +97 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +15 -0
- package/target/main/ts/report/html/app/viewer-tokenizer.js +241 -0
- package/target/main/ts/report/html/app/viewer-totals.d.ts +20 -0
- package/target/main/ts/report/html/app/viewer-totals.js +100 -0
- package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
- package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
- package/target/main/ts/report/html/app/viewer-trend-data.d.ts +54 -0
- package/target/main/ts/report/html/app/viewer-trend-data.js +109 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trend-nav.js +86 -0
- package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
- package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
- package/target/main/ts/report/html/app/viewer-trend-series.d.ts +32 -0
- package/target/main/ts/report/html/app/viewer-trend-series.js +128 -0
- package/target/main/ts/report/html/app/viewer-trends.d.ts +5 -0
- package/target/main/ts/report/html/app/viewer-trends.js +89 -0
- package/target/main/ts/report/html/app/viewer.d.ts +1 -0
- package/target/main/ts/report/html/app/viewer.js +222 -0
- package/target/main/ts/report/html/site/badges.d.ts +11 -0
- package/target/main/ts/report/html/site/badges.js +72 -0
- package/target/main/ts/report/html/site/export-site.d.ts +16 -0
- package/target/main/ts/report/html/site/export-site.js +129 -0
- package/target/main/ts/report/html/site/exported-server.d.ts +6 -0
- package/target/main/ts/report/html/site/exported-server.js +72 -0
- package/target/main/ts/report/html/site/local-server.d.ts +7 -0
- package/target/main/ts/report/html/site/local-server.js +59 -0
- package/target/main/ts/report/html/site/projects.d.ts +1 -0
- package/target/main/ts/report/html/site/projects.js +69 -0
- package/target/main/ts/report/html/site/server.d.ts +4 -0
- package/target/main/ts/report/html/site/server.js +65 -0
- package/target/main/ts/report/html/site/source-route.d.ts +6 -0
- package/target/main/ts/report/html/site/source-route.js +23 -0
- package/target/main/ts/report/json/projections/commit-summary.d.ts +13 -0
- package/target/main/ts/report/json/projections/commit-summary.js +125 -0
- package/target/main/ts/report/json/projections/components.d.ts +4 -0
- package/target/main/ts/report/json/projections/components.js +30 -0
- package/target/main/ts/report/json/projections/file-metrics.d.ts +4 -0
- package/target/main/ts/report/json/projections/file-metrics.js +260 -0
- package/target/main/ts/report/json/projections/ignore-view.d.ts +2 -0
- package/target/main/ts/report/json/projections/ignore-view.js +13 -0
- package/target/main/ts/report/json/projections/inspection-context.d.ts +5 -0
- package/target/main/ts/report/json/projections/inspection-context.js +104 -0
- package/target/main/ts/report/json/projections/inspection-details.d.ts +14 -0
- package/target/main/ts/report/json/projections/inspection-details.js +98 -0
- package/target/main/ts/report/json/projections/metric-values.d.ts +14 -0
- package/target/main/ts/report/json/projections/metric-values.js +104 -0
- package/target/main/ts/report/json/projections/profile-selectors.d.ts +8 -0
- package/target/main/ts/report/json/projections/profile-selectors.js +34 -0
- package/target/main/ts/report/json/projections/security-summary.d.ts +11 -0
- package/target/main/ts/report/json/projections/security-summary.js +22 -0
- package/target/main/ts/report/json/store/directory.d.ts +3 -0
- package/target/main/ts/report/json/store/directory.js +19 -0
- package/target/main/ts/report/json/store/local-store.d.ts +25 -0
- package/target/main/ts/report/json/store/local-store.js +214 -0
- package/target/main/ts/report/json/store/object-store.d.ts +14 -0
- package/target/main/ts/report/json/store/object-store.js +73 -0
- package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
- package/target/main/ts/report/json/store/operation-cache.js +32 -0
- package/target/main/ts/report/json/store/pull-review-store.d.ts +2 -0
- package/target/main/ts/report/json/store/pull-review-store.js +33 -0
- package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
- package/target/main/ts/report/json/store/replace-file.js +35 -0
- package/target/main/ts/report/json/store/report-tree.d.ts +46 -0
- package/target/main/ts/report/json/store/report-tree.js +295 -0
- package/target/main/ts/report/json/store/store-check.d.ts +32 -0
- package/target/main/ts/report/json/store/store-check.js +153 -0
- package/target/main/ts/report/json/validation/metabranch.d.ts +4 -0
- package/target/main/ts/report/json/validation/metabranch.js +11 -0
- package/target/main/ts/report/json/validation/report.d.ts +20 -0
- package/target/main/ts/report/json/validation/report.js +77 -0
- package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
- package/target/main/ts/report/json/validation/summary-validation.js +26 -0
- package/target/main/ts/report/json/wire/compact-json.d.ts +11 -0
- package/target/main/ts/report/json/wire/compact-json.js +76 -0
- package/target/main/ts/report/json/wire/component-model.d.ts +9 -0
- package/target/main/ts/report/json/wire/component-model.js +1 -0
- package/target/main/ts/report/json/wire/domain-types.d.ts +2 -0
- package/target/main/ts/report/json/wire/domain-types.js +1 -0
- package/target/main/ts/report/json/wire/file-metrics-model.d.ts +81 -0
- package/target/main/ts/report/json/wire/file-metrics-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-context-model.d.ts +31 -0
- package/target/main/ts/report/json/wire/inspection-context-model.js +1 -0
- package/target/main/ts/report/json/wire/inspection-details-model.d.ts +87 -0
- package/target/main/ts/report/json/wire/inspection-details-model.js +1 -0
- package/target/main/ts/report/json/wire/project-model.d.ts +7 -0
- package/target/main/ts/report/json/wire/project-model.js +1 -0
- package/target/main/ts/report/json/wire/public-history-model.d.ts +36 -0
- package/target/main/ts/report/json/wire/public-history-model.js +5 -0
- package/target/main/ts/report/json/wire/pull-review-model.d.ts +54 -0
- package/target/main/ts/report/json/wire/pull-review-model.js +3 -0
- package/target/main/ts/report/json/wire/summary-model.d.ts +45 -0
- package/target/main/ts/report/json/wire/summary-model.js +1 -0
- package/target/main/ts/report/markdown/pull-review.d.ts +5 -0
- package/target/main/ts/report/markdown/pull-review.js +132 -0
- package/target/main/ts/report.d.ts +23 -0
- package/target/main/ts/report.js +12 -0
- package/target/main/ts/runtime.d.ts +17 -0
- package/target/main/ts/runtime.js +30 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { element } from './viewer-dom.js';
|
|
2
|
+
const shown = 50;
|
|
3
|
+
const day = new Intl.DateTimeFormat(undefined, { day: 'numeric', month: 'short', year: 'numeric' });
|
|
4
|
+
export const dayTime = new Intl.DateTimeFormat(undefined, { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' });
|
|
5
|
+
export function commitIndex(entries) {
|
|
6
|
+
return entries.map(entry => {
|
|
7
|
+
const time = when(entry);
|
|
8
|
+
const tags = (entry.tags ?? []).map(tag => tag.toLowerCase());
|
|
9
|
+
const text = [entry.subject ?? '', ...tags, entry.author?.name ?? '', entry.author?.email ?? '',
|
|
10
|
+
time === null ? '' : new Date(time).toISOString().slice(0, 10), time === null ? '' : day.format(new Date(time))]
|
|
11
|
+
.join('\n').toLowerCase();
|
|
12
|
+
return { entry, sha: entry.sha.toLowerCase(), tags, text };
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Commits matching every word of the query, in history order, with exact tags and hash prefixes first. A hash
|
|
17
|
+
* matches from its start only, so "a1" does not match every commit that merely contains it.
|
|
18
|
+
*/
|
|
19
|
+
export function searchCommits(index, query, limit = shown) {
|
|
20
|
+
const words = query.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
21
|
+
const exact = [];
|
|
22
|
+
const rest = [];
|
|
23
|
+
let total = 0;
|
|
24
|
+
for (const [position, item] of index.entries()) {
|
|
25
|
+
if (!words.every(word => item.sha.startsWith(word) || item.text.includes(word)))
|
|
26
|
+
continue;
|
|
27
|
+
total += 1;
|
|
28
|
+
const strong = words.length > 0 && words.some(word => item.tags.includes(word) || (word.length >= 4 && item.sha.startsWith(word)));
|
|
29
|
+
const bucket = strong ? exact : rest;
|
|
30
|
+
if (exact.length + rest.length < limit || strong)
|
|
31
|
+
bucket.push({ entry: item.entry, index: position });
|
|
32
|
+
}
|
|
33
|
+
return { matches: [...exact, ...rest].slice(0, limit), total };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* How a commit's author reads in the list: the name, with the email only when the search found the email and not the
|
|
37
|
+
* name. A history without emails carries the name alone, and then it is the name alone; nothing reads as missing.
|
|
38
|
+
*/
|
|
39
|
+
export function authorLabel(author, words) {
|
|
40
|
+
if (!author?.name)
|
|
41
|
+
return null;
|
|
42
|
+
return author.email && hit(author.email, words) && !hit(author.name, words) ? `${author.name} <${author.email}>` : author.name;
|
|
43
|
+
}
|
|
44
|
+
export function hit(text, words) {
|
|
45
|
+
const lower = text.toLowerCase();
|
|
46
|
+
return words.some(word => lower.includes(word));
|
|
47
|
+
}
|
|
48
|
+
export function when(entry) {
|
|
49
|
+
const time = Date.parse(entry.committedAt ?? entry.generatedAt);
|
|
50
|
+
return Number.isFinite(time) ? time : null;
|
|
51
|
+
}
|
|
52
|
+
/** Where the typed words stand in the text, in order; a hash is matched only from its start. */
|
|
53
|
+
function wordRanges(lower, words, prefixOnly) {
|
|
54
|
+
const ranges = [];
|
|
55
|
+
for (const word of words) {
|
|
56
|
+
if (!prefixOnly) {
|
|
57
|
+
for (let at = lower.indexOf(word); at >= 0; at = lower.indexOf(word, at + word.length))
|
|
58
|
+
ranges.push([at, at + word.length]);
|
|
59
|
+
}
|
|
60
|
+
else if (lower.startsWith(word))
|
|
61
|
+
ranges.push([0, word.length]);
|
|
62
|
+
}
|
|
63
|
+
return ranges.sort((a, b) => a[0] - b[0]);
|
|
64
|
+
}
|
|
65
|
+
/** Text with the typed words marked; a hash is marked only from its start, as it is matched. */
|
|
66
|
+
export function marked(tag, className, text, words, prefixOnly = false) {
|
|
67
|
+
const node = element(tag, className);
|
|
68
|
+
let cursor = 0;
|
|
69
|
+
for (const [start, end] of wordRanges(text.toLowerCase(), words, prefixOnly)) {
|
|
70
|
+
if (end <= cursor)
|
|
71
|
+
continue;
|
|
72
|
+
const from = Math.max(start, cursor);
|
|
73
|
+
if (from > cursor)
|
|
74
|
+
node.append(text.slice(cursor, from));
|
|
75
|
+
node.append(element('mark', '', text.slice(from, end)));
|
|
76
|
+
cursor = end;
|
|
77
|
+
}
|
|
78
|
+
if (cursor < text.length)
|
|
79
|
+
node.append(text.slice(cursor));
|
|
80
|
+
return node;
|
|
81
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare function searchField(text: string, placeholder: string): {
|
|
2
|
+
label: HTMLLabelElement;
|
|
3
|
+
input: HTMLInputElement;
|
|
4
|
+
};
|
|
5
|
+
/** Two or three exclusive views as one segmented switch; the pressed segment is the current view. */
|
|
6
|
+
export declare function segmented(text: string, options: readonly (readonly [string, string])[], selected: string, change: (value: string) => void): HTMLElement;
|
|
7
|
+
/** Presses the segment with this name, as a click on it would look, without running its change. */
|
|
8
|
+
export declare function pressSegment(group: HTMLElement, name: string): void;
|
|
9
|
+
/** A details menu that closes on a click elsewhere or on Escape, as a menu does. */
|
|
10
|
+
export declare function dismissible(menu: HTMLDetailsElement): void;
|
|
11
|
+
/** What a multiple choice's button says: all, up to two names, or how many are chosen. */
|
|
12
|
+
export declare function chosenLabel(chosen: readonly string[], all: string, plural: string): string;
|
|
13
|
+
/** What a multiple choice is called, what it says with nothing ticked, and what it counts with many. */
|
|
14
|
+
export interface ChoiceNames {
|
|
15
|
+
readonly text: string;
|
|
16
|
+
readonly all: string;
|
|
17
|
+
readonly plural: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A dropdown of checkboxes: none ticked means all. The button names what is chosen, so the filter reads at a glance;
|
|
21
|
+
* each option carries its count. It hides itself when there is nothing to choose between.
|
|
22
|
+
*/
|
|
23
|
+
export declare function multiChoice({ text, all, plural }: ChoiceNames, options: readonly (readonly [string, string, number])[], change: () => void, initial?: Iterable<string>): {
|
|
24
|
+
element: HTMLDetailsElement;
|
|
25
|
+
values: Set<string>;
|
|
26
|
+
};
|
|
27
|
+
export declare function choice(text: string, options: readonly (readonly [string, string])[], selected: string): {
|
|
28
|
+
label: HTMLLabelElement;
|
|
29
|
+
select: HTMLSelectElement;
|
|
30
|
+
};
|
|
31
|
+
/** A select's options: the catch-all first, then each distinct value by its label. */
|
|
32
|
+
export declare function choices<T extends string>(first: string, values: readonly T[], labels?: Readonly<Partial<Record<T, string>>>): [string, string][];
|
|
33
|
+
export declare function navigationButtons(label: string, previous: () => void, next: () => void): {
|
|
34
|
+
section: HTMLElement;
|
|
35
|
+
update: (page: number, pages: number) => void;
|
|
36
|
+
};
|
|
37
|
+
/** A paged list's state: its buttons, and the page they move, rendered again on each move. */
|
|
38
|
+
export declare function pager(label: string, render: () => void): {
|
|
39
|
+
page: number;
|
|
40
|
+
} & {
|
|
41
|
+
section: HTMLElement;
|
|
42
|
+
update: (page: number, pages: number) => void;
|
|
43
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { collator, count, element } from './viewer-dom.js';
|
|
2
|
+
export function searchField(text, placeholder) {
|
|
3
|
+
const label = element('label', 'fx-field');
|
|
4
|
+
label.append(element('span', 'fx-field-text', text));
|
|
5
|
+
const input = element('input');
|
|
6
|
+
input.type = 'search';
|
|
7
|
+
input.placeholder = placeholder;
|
|
8
|
+
input.spellcheck = false;
|
|
9
|
+
label.append(input);
|
|
10
|
+
return { label, input };
|
|
11
|
+
}
|
|
12
|
+
/** Two or three exclusive views as one segmented switch; the pressed segment is the current view. */
|
|
13
|
+
export function segmented(text, options, selected, change) {
|
|
14
|
+
const group = element('div', 'fx-segmented');
|
|
15
|
+
group.setAttribute('role', 'group');
|
|
16
|
+
group.setAttribute('aria-label', text);
|
|
17
|
+
const buttons = options.map(([value, name]) => {
|
|
18
|
+
const button = element('button', '', name);
|
|
19
|
+
button.type = 'button';
|
|
20
|
+
button.setAttribute('aria-pressed', String(value === selected));
|
|
21
|
+
button.addEventListener('click', () => {
|
|
22
|
+
for (const other of buttons)
|
|
23
|
+
other.setAttribute('aria-pressed', String(other === button));
|
|
24
|
+
change(value);
|
|
25
|
+
});
|
|
26
|
+
return button;
|
|
27
|
+
});
|
|
28
|
+
group.append(...buttons);
|
|
29
|
+
return group;
|
|
30
|
+
}
|
|
31
|
+
/** Presses the segment with this name, as a click on it would look, without running its change. */
|
|
32
|
+
export function pressSegment(group, name) {
|
|
33
|
+
group.querySelectorAll('button').forEach(button => button.setAttribute('aria-pressed', String(button.textContent === name)));
|
|
34
|
+
}
|
|
35
|
+
/** A details menu that closes on a click elsewhere or on Escape, as a menu does. */
|
|
36
|
+
export function dismissible(menu) {
|
|
37
|
+
const close = (event) => {
|
|
38
|
+
const key = event instanceof KeyboardEvent;
|
|
39
|
+
if (key ? event.key !== 'Escape' : menu.contains(event.target))
|
|
40
|
+
return;
|
|
41
|
+
if (menu.open && key)
|
|
42
|
+
menu.querySelector('summary')?.focus();
|
|
43
|
+
menu.open = false;
|
|
44
|
+
};
|
|
45
|
+
menu.addEventListener('toggle', () => {
|
|
46
|
+
const listen = menu.open ? document.addEventListener.bind(document) : document.removeEventListener.bind(document);
|
|
47
|
+
listen('pointerdown', close, true);
|
|
48
|
+
listen('keydown', close);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/** What a multiple choice's button says: all, up to two names, or how many are chosen. */
|
|
52
|
+
export function chosenLabel(chosen, all, plural) {
|
|
53
|
+
if (chosen.length === 0)
|
|
54
|
+
return all;
|
|
55
|
+
// Two choices read by name, so a filtered view says what it holds; more read as a count.
|
|
56
|
+
return chosen.length <= 2 ? chosen.join(', ') : `${chosen.length} ${plural}`;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A dropdown of checkboxes: none ticked means all. The button names what is chosen, so the filter reads at a glance;
|
|
60
|
+
* each option carries its count. It hides itself when there is nothing to choose between.
|
|
61
|
+
*/
|
|
62
|
+
export function multiChoice({ text, all, plural }, options, change, initial = []) {
|
|
63
|
+
const offered = new Set(options.map(([value]) => value));
|
|
64
|
+
const values = new Set([...initial].filter(value => offered.has(value)));
|
|
65
|
+
const menu = element('details', 'fx-columns fx-multi');
|
|
66
|
+
menu.hidden = options.length < 2;
|
|
67
|
+
const summary = element('summary', '', all);
|
|
68
|
+
summary.setAttribute('aria-label', `${text}: ${all}`);
|
|
69
|
+
const list = element('div', 'fx-column-toggles');
|
|
70
|
+
list.setAttribute('role', 'group');
|
|
71
|
+
list.setAttribute('aria-label', text);
|
|
72
|
+
function label() {
|
|
73
|
+
const chosen = options.filter(([value]) => values.has(value)).map(([, name]) => name);
|
|
74
|
+
summary.textContent = chosenLabel(chosen, all, plural);
|
|
75
|
+
summary.title = chosen.join(', ');
|
|
76
|
+
summary.setAttribute('aria-label', `${text}: ${chosen.length ? chosen.join(', ') : all}`);
|
|
77
|
+
menu.classList.toggle('fx-multi-active', chosen.length > 0);
|
|
78
|
+
}
|
|
79
|
+
for (const [value, name, total] of options) {
|
|
80
|
+
const row = element('label', 'fx-column-toggle');
|
|
81
|
+
const box = element('input');
|
|
82
|
+
box.type = 'checkbox';
|
|
83
|
+
box.value = value;
|
|
84
|
+
box.checked = values.has(value);
|
|
85
|
+
box.addEventListener('change', () => {
|
|
86
|
+
if (box.checked)
|
|
87
|
+
values.add(value);
|
|
88
|
+
else
|
|
89
|
+
values.delete(value);
|
|
90
|
+
label();
|
|
91
|
+
change();
|
|
92
|
+
});
|
|
93
|
+
row.append(box, element('span', 'fx-multi-name', name), element('span', 'fx-multi-count', total.toLocaleString()));
|
|
94
|
+
list.append(row);
|
|
95
|
+
}
|
|
96
|
+
menu.append(summary, list);
|
|
97
|
+
dismissible(menu);
|
|
98
|
+
label();
|
|
99
|
+
return { element: menu, values };
|
|
100
|
+
}
|
|
101
|
+
export function choice(text, options, selected) {
|
|
102
|
+
const label = element('label', 'fx-field');
|
|
103
|
+
label.append(element('span', 'fx-field-text', text));
|
|
104
|
+
const select = element('select');
|
|
105
|
+
for (const [value, name] of options) {
|
|
106
|
+
const option = element('option', '', name);
|
|
107
|
+
option.value = value;
|
|
108
|
+
select.append(option);
|
|
109
|
+
}
|
|
110
|
+
select.value = selected;
|
|
111
|
+
label.append(select);
|
|
112
|
+
return { label, select };
|
|
113
|
+
}
|
|
114
|
+
/** A select's options: the catch-all first, then each distinct value by its label. */
|
|
115
|
+
export function choices(first, values, labels) {
|
|
116
|
+
const unique = [...new Set(values)].map(value => [value, labels?.[value] ?? value]);
|
|
117
|
+
return [['', first], ...unique.sort((a, b) => collator.compare(a[1], b[1]))];
|
|
118
|
+
}
|
|
119
|
+
export function navigationButtons(label, previous, next) {
|
|
120
|
+
const section = element('nav', 'fx-page-buttons');
|
|
121
|
+
section.setAttribute('aria-label', label);
|
|
122
|
+
const back = element('button', 'button', 'Previous');
|
|
123
|
+
const forward = element('button', 'button', 'Next');
|
|
124
|
+
back.type = forward.type = 'button';
|
|
125
|
+
back.addEventListener('click', previous);
|
|
126
|
+
forward.addEventListener('click', next);
|
|
127
|
+
const pageLabel = element('span', 'fx-note');
|
|
128
|
+
pageLabel.setAttribute('aria-live', 'polite');
|
|
129
|
+
section.append(back, pageLabel, forward);
|
|
130
|
+
return { section, update: (page, pages) => {
|
|
131
|
+
back.disabled = page === 0;
|
|
132
|
+
forward.disabled = page + 1 >= pages;
|
|
133
|
+
pageLabel.textContent = `${count(page + 1)} of ${count(pages)}`;
|
|
134
|
+
} };
|
|
135
|
+
}
|
|
136
|
+
/** A paged list's state: its buttons, and the page they move, rendered again on each move. */
|
|
137
|
+
export function pager(label, render) {
|
|
138
|
+
const state = { page: 0 };
|
|
139
|
+
const buttons = navigationButtons(label, () => { state.page--; render(); }, () => { state.page++; render(); });
|
|
140
|
+
return Object.assign(state, buttons);
|
|
141
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface CopyFeedback {
|
|
2
|
+
/** The text is on the clipboard; the button shows its check until `reset`. */
|
|
3
|
+
copied(): void;
|
|
4
|
+
reset(): void;
|
|
5
|
+
/** The browser refused the clipboard: the reader copies by hand. */
|
|
6
|
+
refused(): void;
|
|
7
|
+
}
|
|
8
|
+
/** Copies the text on each click, with a check that fades after a moment, or the fallback the browser leaves. */
|
|
9
|
+
export declare function copyOnClick(button: HTMLButtonElement, text: () => string, feedback: CopyFeedback): void;
|
|
10
|
+
/**
|
|
11
|
+
* Copies a file's path from the repository root. Where the browser refuses the clipboard, `show` puts the path on the
|
|
12
|
+
* page and it is selected, for the reader's own copy shortcut.
|
|
13
|
+
*/
|
|
14
|
+
export declare function copyPathButton(path: string, show: () => HTMLElement): HTMLButtonElement;
|
|
15
|
+
/** The common copy glyph, two offset sheets, with the check it turns into once copied. */
|
|
16
|
+
export declare function copyIcon(): SVGSVGElement;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { element, svgElement } from './viewer-dom.js';
|
|
2
|
+
/** Copies the text on each click, with a check that fades after a moment, or the fallback the browser leaves. */
|
|
3
|
+
export function copyOnClick(button, text, feedback) {
|
|
4
|
+
let timer;
|
|
5
|
+
button.addEventListener('click', async () => {
|
|
6
|
+
clearTimeout(timer);
|
|
7
|
+
try {
|
|
8
|
+
if (!navigator.clipboard)
|
|
9
|
+
throw new Error('Clipboard unavailable');
|
|
10
|
+
await navigator.clipboard.writeText(text());
|
|
11
|
+
button.classList.add('fx-copied');
|
|
12
|
+
feedback.copied();
|
|
13
|
+
timer = setTimeout(() => {
|
|
14
|
+
button.classList.remove('fx-copied');
|
|
15
|
+
feedback.reset();
|
|
16
|
+
}, 1500);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
feedback.refused();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Copies a file's path from the repository root. Where the browser refuses the clipboard, `show` puts the path on the
|
|
25
|
+
* page and it is selected, for the reader's own copy shortcut.
|
|
26
|
+
*/
|
|
27
|
+
export function copyPathButton(path, show) {
|
|
28
|
+
const label = 'Copy path';
|
|
29
|
+
const copy = element('button', 'fx-copy fx-copy-inline');
|
|
30
|
+
copy.type = 'button';
|
|
31
|
+
copy.title = `${label}: ${path}`;
|
|
32
|
+
copy.setAttribute('aria-label', label);
|
|
33
|
+
copy.append(copyIcon());
|
|
34
|
+
const status = element('span', 'visually-hidden');
|
|
35
|
+
status.setAttribute('role', 'status');
|
|
36
|
+
copy.append(status);
|
|
37
|
+
copyOnClick(copy, () => path, {
|
|
38
|
+
copied: () => { status.textContent = 'Path copied'; },
|
|
39
|
+
reset: () => { status.textContent = ''; },
|
|
40
|
+
refused: () => {
|
|
41
|
+
window.getSelection()?.selectAllChildren(show());
|
|
42
|
+
status.textContent = 'Path selected. Press your copy shortcut.';
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
return copy;
|
|
46
|
+
}
|
|
47
|
+
/** The common copy glyph, two offset sheets, with the check it turns into once copied. */
|
|
48
|
+
export function copyIcon() {
|
|
49
|
+
const svg = svgElement('svg');
|
|
50
|
+
svg.setAttribute('viewBox', '0 0 16 16');
|
|
51
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
52
|
+
const shapes = [
|
|
53
|
+
['rect', { class: 'fx-copy-sheets', x: '5.5', y: '5.5', width: '8', height: '8', rx: '1.5' }],
|
|
54
|
+
['path', { class: 'fx-copy-sheets', d: 'M10.5 3.5v-.5A1.5 1.5 0 0 0 9 1.5H3A1.5 1.5 0 0 0 1.5 3v6A1.5 1.5 0 0 0 3 10.5h.5' }],
|
|
55
|
+
['path', { class: 'fx-copy-check', d: 'M3 8.5l3 3 7-7' }],
|
|
56
|
+
];
|
|
57
|
+
for (const [tag, attributes] of shapes) {
|
|
58
|
+
const shape = svgElement(tag);
|
|
59
|
+
for (const [name, value] of Object.entries(attributes))
|
|
60
|
+
shape.setAttribute(name, value);
|
|
61
|
+
svg.append(shape);
|
|
62
|
+
}
|
|
63
|
+
return svg;
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { InspectionAsset } from '../../json/wire/inspection-details-model.js';
|
|
2
|
+
import type { InspectionContext } from '../../json/wire/inspection-context-model.js';
|
|
3
|
+
import type { PublicHistoryEntry, QualityHistory } from '../../json/wire/public-history-model.js';
|
|
4
|
+
import type { InspectionCounts, MetricDescriptor } from '../../json/wire/summary-model.js';
|
|
5
|
+
import type { SourceLocator } from './viewer-source.js';
|
|
6
|
+
export interface ViewerData {
|
|
7
|
+
readonly reports: readonly PublicHistoryEntry[];
|
|
8
|
+
readonly quality: QualityHistory['reports'];
|
|
9
|
+
readonly context: Record<string, InspectionContext>;
|
|
10
|
+
readonly counts: Record<string, InspectionCounts | undefined>;
|
|
11
|
+
/** How many pull request reviews are saved; the summary counts them, so no page loads them to find out. */
|
|
12
|
+
readonly pullReviewCount: number;
|
|
13
|
+
/** The branch whose first-parent history the commits are, when the configuration names it. */
|
|
14
|
+
readonly branch?: string;
|
|
15
|
+
/** The metrics the history's plugins declare; each commit's values are indexed by it. */
|
|
16
|
+
readonly metrics?: readonly MetricDescriptor[];
|
|
17
|
+
/** Where file sources come from, when the export names a place. */
|
|
18
|
+
readonly sources?: SourceLocator;
|
|
19
|
+
loadDetails(sha: string): Promise<InspectionAsset | null>;
|
|
20
|
+
}
|
|
21
|
+
export declare class ViewerSummaryChanged extends Error {
|
|
22
|
+
constructor();
|
|
23
|
+
}
|
|
24
|
+
export declare function loadViewerData(mode: string | undefined): Promise<ViewerData>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// The viewer's data: the repository summary, which lists every inspected commit, and each commit's inspection on demand.
|
|
2
|
+
import { unpackJson } from '../../json/wire/compact-json.js';
|
|
3
|
+
import { summarySchema } from '../../json/wire/summary-model.js';
|
|
4
|
+
import { sourceLocator } from './viewer-source.js';
|
|
5
|
+
const shaPattern = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
|
|
6
|
+
export class ViewerSummaryChanged extends Error {
|
|
7
|
+
constructor() {
|
|
8
|
+
super('The repository summary changed');
|
|
9
|
+
this.name = 'ViewerSummaryChanged';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export async function loadViewerData(mode) {
|
|
13
|
+
const summary = await readSummary();
|
|
14
|
+
const counts = Object.fromEntries(summary.commits.map(commit => [commit.sha, commit.counts]));
|
|
15
|
+
const details = new Map(summary.commits.map(commit => [commit.sha, commit.detail]));
|
|
16
|
+
return {
|
|
17
|
+
reports: summary.commits,
|
|
18
|
+
quality: Object.fromEntries(summary.commits.map(commit => [commit.sha, commit.quality])),
|
|
19
|
+
context: Object.fromEntries(summary.commits.map(commit => [commit.sha, {
|
|
20
|
+
exclusions: null, boundary: commit.profileBoundary ?? null, security: commit.counts?.security,
|
|
21
|
+
}])),
|
|
22
|
+
counts,
|
|
23
|
+
pullReviewCount: summary.pullReviewCount ?? 0,
|
|
24
|
+
...(Array.isArray(summary.metrics) ? { metrics: summary.metrics } : {}),
|
|
25
|
+
...(() => {
|
|
26
|
+
const sources = sourceLocator(summary.sources);
|
|
27
|
+
return sources ? { sources } : {};
|
|
28
|
+
})(),
|
|
29
|
+
...(typeof summary.source?.branch === 'string' && summary.source.branch.trim() ? { branch: summary.source.branch.trim() } : {}),
|
|
30
|
+
async loadDetails(sha) {
|
|
31
|
+
const path = details.get(sha);
|
|
32
|
+
if (path === undefined)
|
|
33
|
+
return null;
|
|
34
|
+
const asset = await readInspection(path, sha, mode);
|
|
35
|
+
if (asset)
|
|
36
|
+
return asset;
|
|
37
|
+
const next = await readSummary('reload').catch(() => null);
|
|
38
|
+
if (!next)
|
|
39
|
+
return null;
|
|
40
|
+
if (next.commits.find(commit => commit.sha === sha)?.detail !== path)
|
|
41
|
+
throw new ViewerSummaryChanged();
|
|
42
|
+
return readInspection(path, sha, mode);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async function readSummary(cache) {
|
|
47
|
+
const response = await fetch('./summary.json', { cache });
|
|
48
|
+
if (!response.ok)
|
|
49
|
+
throw new Error('Could not load the repository summary');
|
|
50
|
+
const data = await response.json();
|
|
51
|
+
if (data?.schema !== summarySchema || !Array.isArray(data.commits)
|
|
52
|
+
|| data.commits.some(commit => !shaPattern.test(commit.sha) || !commit.quality))
|
|
53
|
+
throw new Error('Unsupported repository summary');
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
/** A commit's inspection, where the summary's path names one: `inspection/` when served locally, `details/` in an export. */
|
|
57
|
+
async function readInspection(path, sha, mode) {
|
|
58
|
+
const prefix = `${mode === 'local' ? 'inspection' : 'details'}/${sha}-`;
|
|
59
|
+
const allowed = path.startsWith(prefix) && /^[a-f0-9]{64}\.json$/.test(path.slice(prefix.length));
|
|
60
|
+
if (!allowed)
|
|
61
|
+
return null;
|
|
62
|
+
try {
|
|
63
|
+
const asset = unpackJson(await readOptional(`./${path}`));
|
|
64
|
+
return asset?.schema === 'urn:repometry:schema:viewer-inspection:1' && asset.sha === sha ? asset : null;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function readOptional(path) {
|
|
71
|
+
try {
|
|
72
|
+
const response = await fetch(path);
|
|
73
|
+
return response.ok ? await response.json() : null;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InspectionDetails } from '../../json/wire/inspection-details-model.js';
|
|
2
|
+
import type { Navigation } from './viewer-inspection.js';
|
|
3
|
+
/** The Diagnostics page: what the analysis could not do, filtered by a search, an operation and a state. */
|
|
4
|
+
export declare function diagnosticsView(details: InspectionDetails, navigation: Navigation): HTMLElement;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { choice, choices, navigationButtons, searchField } from './viewer-controls.js';
|
|
2
|
+
import { contains, element, link, quantity } from './viewer-dom.js';
|
|
3
|
+
import { fileHref } from './viewer-file-figures.js';
|
|
4
|
+
import { pageSize } from './viewer-inspection.js';
|
|
5
|
+
const diagnosticStates = { failed: 'Failed', blocked: 'Blocked', partial: 'Partial' };
|
|
6
|
+
function diagnosticItem(row, navigation, files) {
|
|
7
|
+
const item = element('li');
|
|
8
|
+
const heading = element('div', 'fx-event-heading');
|
|
9
|
+
const state = element('span', 'fx-state', diagnosticStates[row.state]);
|
|
10
|
+
state.dataset.state = row.state;
|
|
11
|
+
heading.append(element('code', 'fx-path', row.operation), state);
|
|
12
|
+
item.append(heading, element('p', '', row.message));
|
|
13
|
+
if (row.path)
|
|
14
|
+
item.append(files.has(row.path) ? link(fileHref(navigation, row.path), row.path, 'fx-inline-link') : element('code', 'fx-path', row.path));
|
|
15
|
+
return item;
|
|
16
|
+
}
|
|
17
|
+
/** The Diagnostics page: what the analysis could not do, filtered by a search, an operation and a state. */
|
|
18
|
+
export function diagnosticsView(details, navigation) {
|
|
19
|
+
const { diagnostics, metrics } = details;
|
|
20
|
+
const view = element('section', 'fx-view panel fx-events');
|
|
21
|
+
const path = navigation.file;
|
|
22
|
+
const scoped = path ? diagnostics.filter(row => row.path === path) : diagnostics;
|
|
23
|
+
if (path) {
|
|
24
|
+
const scope = element('div', 'fx-file-heading');
|
|
25
|
+
scope.append(element('code', 'fx-path', path), link(navigation.href('diagnostics'), 'All diagnostics', 'fx-inline-link'));
|
|
26
|
+
view.append(scope);
|
|
27
|
+
}
|
|
28
|
+
if (!scoped.length) {
|
|
29
|
+
view.append(element('p', 'fx-note', path ? 'No analysis diagnostics for this file.' : 'No analysis diagnostics for this commit.'));
|
|
30
|
+
return view;
|
|
31
|
+
}
|
|
32
|
+
const search = searchField('Search diagnostics', 'Operation, path or message');
|
|
33
|
+
const operation = choice('Operation', choices('All operations', scoped.map(row => row.operation)), '');
|
|
34
|
+
const state = choice('State', choices('All states', scoped.map(row => row.state), diagnosticStates), '');
|
|
35
|
+
const tools = element('div', 'fx-tools');
|
|
36
|
+
tools.append(search.label, operation.label, state.label);
|
|
37
|
+
const result = element('p', 'fx-note fx-results');
|
|
38
|
+
result.setAttribute('aria-live', 'polite');
|
|
39
|
+
const events = element('ul', 'fx-event-list');
|
|
40
|
+
const nav = navigationButtons('Diagnostic pages', () => { page--; render(); }, () => { page++; render(); });
|
|
41
|
+
view.append(tools, result, events, nav.section);
|
|
42
|
+
const files = new Set(metrics.files.map(entry => entry.path));
|
|
43
|
+
let page = 0;
|
|
44
|
+
const picked = (select, value) => !select.value || select.value === value;
|
|
45
|
+
function render() {
|
|
46
|
+
const query = search.input.value.trim().toLowerCase();
|
|
47
|
+
const matches = scoped.filter(row => picked(state.select, row.state) && picked(operation.select, row.operation)
|
|
48
|
+
&& contains(query, [row.operation, row.path, row.message]));
|
|
49
|
+
result.textContent = matches.length ? quantity(matches.length, 'diagnostic') : 'No diagnostics match these filters.';
|
|
50
|
+
events.replaceChildren(...matches.slice(page * pageSize, (page + 1) * pageSize).map(row => diagnosticItem(row, navigation, files)));
|
|
51
|
+
nav.section.hidden = matches.length <= pageSize;
|
|
52
|
+
nav.update(page, Math.ceil(matches.length / pageSize));
|
|
53
|
+
}
|
|
54
|
+
const reset = () => { page = 0; render(); };
|
|
55
|
+
search.input.addEventListener('input', reset);
|
|
56
|
+
operation.select.addEventListener('change', reset);
|
|
57
|
+
state.select.addEventListener('change', reset);
|
|
58
|
+
render();
|
|
59
|
+
return view;
|
|
60
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** The DOM building blocks every page of the viewer shares. */
|
|
2
|
+
/** Paths compare as people read them: numbers by value, so file10 follows file9. */
|
|
3
|
+
export declare const collator: Intl.Collator;
|
|
4
|
+
export declare function element<K extends keyof HTMLElementTagNameMap>(tag: K, className?: string, text?: string): HTMLElementTagNameMap[K];
|
|
5
|
+
export declare function svgElement<K extends keyof SVGElementTagNameMap>(tag: K): SVGElementTagNameMap[K];
|
|
6
|
+
export declare function link(href: string, label: string, className?: string): HTMLAnchorElement;
|
|
7
|
+
/** A link that opens another site in a new tab, without handing it this page. */
|
|
8
|
+
export declare function externalLink(href: string, label: string, className?: string): HTMLAnchorElement;
|
|
9
|
+
/** One row of a description list, with a quieter line of context under the value. */
|
|
10
|
+
export declare function fact(label: string, value: string, context?: string): HTMLElement;
|
|
11
|
+
/** A table that scrolls on its own, named so the region can be found and scrolled from the keyboard. */
|
|
12
|
+
export declare function scrollableTable(table: HTMLTableElement, label: string): HTMLElement;
|
|
13
|
+
export declare function count(value: number | null | undefined): string;
|
|
14
|
+
export declare function percent(value: number): string;
|
|
15
|
+
export declare function quantity(amount: number, noun: string): string;
|
|
16
|
+
export declare function parentPath(path: string): string;
|
|
17
|
+
export declare function basename(path: string): string;
|
|
18
|
+
export declare function inside(path: string, directory: string): boolean;
|
|
19
|
+
/** Whether any of the strings holds the lowercased query; an empty query holds everywhere. */
|
|
20
|
+
export declare function contains(query: string, strings: readonly (string | undefined)[]): boolean;
|
|
21
|
+
/** Storage that a private window or a blocked site refuses: reads fall back, writes are forgotten. */
|
|
22
|
+
export declare function stored(storage: () => Storage, key: string): string | null;
|
|
23
|
+
export declare function store(storage: () => Storage, key: string, value: string | null): void;
|
|
24
|
+
/** An element of the page by its id; the page's own markup holds every id the viewer asks for. */
|
|
25
|
+
export declare function byId(id: string): HTMLElement;
|
|
26
|
+
/** A quiet status line in place of a container's content: loading, empty, or failed. */
|
|
27
|
+
export declare function notice(container: HTMLElement, text: string): void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** The DOM building blocks every page of the viewer shares. */
|
|
2
|
+
const integer = new Intl.NumberFormat();
|
|
3
|
+
const percentFormat = new Intl.NumberFormat(undefined, { style: 'percent', maximumFractionDigits: 1 });
|
|
4
|
+
/** Paths compare as people read them: numbers by value, so file10 follows file9. */
|
|
5
|
+
export const collator = new Intl.Collator(undefined, { numeric: true });
|
|
6
|
+
export function element(tag, className, text) {
|
|
7
|
+
const node = document.createElement(tag);
|
|
8
|
+
if (className)
|
|
9
|
+
node.className = className;
|
|
10
|
+
if (text)
|
|
11
|
+
node.textContent = text;
|
|
12
|
+
return node;
|
|
13
|
+
}
|
|
14
|
+
export function svgElement(tag) {
|
|
15
|
+
return document.createElementNS('http://www.w3.org/2000/svg', tag);
|
|
16
|
+
}
|
|
17
|
+
export function link(href, label, className) {
|
|
18
|
+
const result = element('a', className, label);
|
|
19
|
+
result.href = href;
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
/** A link that opens another site in a new tab, without handing it this page. */
|
|
23
|
+
export function externalLink(href, label, className) {
|
|
24
|
+
const result = link(href, label, className);
|
|
25
|
+
result.target = '_blank';
|
|
26
|
+
result.rel = 'noopener noreferrer';
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
/** One row of a description list, with a quieter line of context under the value. */
|
|
30
|
+
export function fact(label, value, context) {
|
|
31
|
+
const pair = element('div');
|
|
32
|
+
pair.append(element('dt', '', label), element('dd', '', value));
|
|
33
|
+
if (context)
|
|
34
|
+
pair.append(element('dd', 'fx-note', context));
|
|
35
|
+
return pair;
|
|
36
|
+
}
|
|
37
|
+
/** A table that scrolls on its own, named so the region can be found and scrolled from the keyboard. */
|
|
38
|
+
export function scrollableTable(table, label) {
|
|
39
|
+
const region = element('div', 'table-scroll fx-table-scroll');
|
|
40
|
+
region.setAttribute('role', 'region');
|
|
41
|
+
region.setAttribute('aria-label', label);
|
|
42
|
+
region.tabIndex = 0;
|
|
43
|
+
region.append(table);
|
|
44
|
+
return region;
|
|
45
|
+
}
|
|
46
|
+
export function count(value) {
|
|
47
|
+
return value == null ? '—' : integer.format(value);
|
|
48
|
+
}
|
|
49
|
+
export function percent(value) {
|
|
50
|
+
return percentFormat.format(value);
|
|
51
|
+
}
|
|
52
|
+
export function quantity(amount, noun) {
|
|
53
|
+
return `${count(amount)} ${noun}${amount === 1 ? '' : 's'}`;
|
|
54
|
+
}
|
|
55
|
+
export function parentPath(path) {
|
|
56
|
+
return path.slice(0, Math.max(0, path.lastIndexOf('/')));
|
|
57
|
+
}
|
|
58
|
+
export function basename(path) {
|
|
59
|
+
return path.slice(path.lastIndexOf('/') + 1);
|
|
60
|
+
}
|
|
61
|
+
export function inside(path, directory) {
|
|
62
|
+
return directory === '' || path.startsWith(`${directory}/`);
|
|
63
|
+
}
|
|
64
|
+
/** Whether any of the strings holds the lowercased query; an empty query holds everywhere. */
|
|
65
|
+
export function contains(query, strings) {
|
|
66
|
+
return query === '' || strings.some(value => value?.toLowerCase().includes(query));
|
|
67
|
+
}
|
|
68
|
+
/** Storage that a private window or a blocked site refuses: reads fall back, writes are forgotten. */
|
|
69
|
+
export function stored(storage, key) {
|
|
70
|
+
try {
|
|
71
|
+
return storage().getItem(key);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export function store(storage, key, value) {
|
|
78
|
+
try {
|
|
79
|
+
if (value === null)
|
|
80
|
+
storage().removeItem(key);
|
|
81
|
+
else
|
|
82
|
+
storage().setItem(key, value);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Without storage the choice lasts for this page only.
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** An element of the page by its id; the page's own markup holds every id the viewer asks for. */
|
|
89
|
+
export function byId(id) {
|
|
90
|
+
return document.getElementById(id);
|
|
91
|
+
}
|
|
92
|
+
/** A quiet status line in place of a container's content: loading, empty, or failed. */
|
|
93
|
+
export function notice(container, text) {
|
|
94
|
+
const paragraph = document.createElement('p');
|
|
95
|
+
paragraph.className = 'detail empty';
|
|
96
|
+
paragraph.setAttribute('role', 'status');
|
|
97
|
+
paragraph.textContent = text;
|
|
98
|
+
container.replaceChildren(paragraph);
|
|
99
|
+
}
|