@ng-prism/plugin-coverage 21.4.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.
@@ -0,0 +1,17 @@
1
+ import type { CoverageData, MetricDetail } from './coverage.types.js';
2
+ import * as i0 from "@angular/core";
3
+ interface MetricRow {
4
+ label: string;
5
+ detail: MetricDetail;
6
+ level: 'good' | 'warn' | 'bad';
7
+ }
8
+ export declare class CoveragePanelComponent {
9
+ readonly activeComponent: import("@angular/core").InputSignal<unknown>;
10
+ protected readonly coverage: import("@angular/core").Signal<CoverageData | null>;
11
+ protected readonly scoreLevel: import("@angular/core").Signal<"good" | "warn" | "bad">;
12
+ protected readonly metricRows: import("@angular/core").Signal<MetricRow[]>;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<CoveragePanelComponent, never>;
14
+ static ɵcmp: i0.ɵɵComponentDeclaration<CoveragePanelComponent, "prism-coverage-panel", never, { "activeComponent": { "alias": "activeComponent"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=coverage-panel.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-panel.component.d.ts","sourceRoot":"","sources":["../src/coverage-panel.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;;AAEtE,UAAU,SAAS;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;CAChC;AAED,qBAyIa,sBAAsB;IACjC,QAAQ,CAAC,eAAe,+CAAwB;IAEhD,SAAS,CAAC,QAAQ,CAAC,QAAQ,sDAGxB;IAEH,SAAS,CAAC,QAAQ,CAAC,UAAU,0DAK1B;IAEH,SAAS,CAAC,QAAQ,CAAC,UAAU,8CAgB1B;yCA/BQ,sBAAsB;2CAAtB,sBAAsB;CAgClC"}
@@ -0,0 +1,137 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ const _forTrack0 = ($index, $item) => $item.label;
4
+ function CoveragePanelComponent_Conditional_0_For_8_Template(rf, ctx) { if (rf & 1) {
5
+ i0.ɵɵdomElementStart(0, "div", 6)(1, "span", 7);
6
+ i0.ɵɵtext(2);
7
+ i0.ɵɵdomElementEnd();
8
+ i0.ɵɵdomElementStart(3, "div", 8);
9
+ i0.ɵɵdomElement(4, "div", 9);
10
+ i0.ɵɵdomElementEnd();
11
+ i0.ɵɵdomElementStart(5, "span", 10);
12
+ i0.ɵɵtext(6);
13
+ i0.ɵɵdomElementEnd();
14
+ i0.ɵɵdomElementStart(7, "span", 11);
15
+ i0.ɵɵtext(8);
16
+ i0.ɵɵdomElementEnd()();
17
+ } if (rf & 2) {
18
+ const row_r1 = ctx.$implicit;
19
+ i0.ɵɵadvance(2);
20
+ i0.ɵɵtextInterpolate(row_r1.label);
21
+ i0.ɵɵadvance(2);
22
+ i0.ɵɵstyleProp("width", row_r1.detail.pct, "%");
23
+ i0.ɵɵattribute("data-level", row_r1.level);
24
+ i0.ɵɵadvance();
25
+ i0.ɵɵattribute("data-level", row_r1.level);
26
+ i0.ɵɵadvance();
27
+ i0.ɵɵtextInterpolate1("", row_r1.detail.pct, "%");
28
+ i0.ɵɵadvance(2);
29
+ i0.ɵɵtextInterpolate2("", row_r1.detail.covered, "/", row_r1.detail.total);
30
+ } }
31
+ function CoveragePanelComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
32
+ i0.ɵɵdomElementStart(0, "div", 0)(1, "div", 2)(2, "span", 3);
33
+ i0.ɵɵtext(3, "Test Coverage");
34
+ i0.ɵɵdomElementEnd();
35
+ i0.ɵɵdomElementStart(4, "span", 4);
36
+ i0.ɵɵtext(5);
37
+ i0.ɵɵdomElementEnd()();
38
+ i0.ɵɵdomElementStart(6, "div", 5);
39
+ i0.ɵɵrepeaterCreate(7, CoveragePanelComponent_Conditional_0_For_8_Template, 9, 8, "div", 6, _forTrack0);
40
+ i0.ɵɵdomElementEnd()();
41
+ } if (rf & 2) {
42
+ const ctx_r1 = i0.ɵɵnextContext();
43
+ i0.ɵɵadvance(4);
44
+ i0.ɵɵattribute("data-level", ctx_r1.scoreLevel());
45
+ i0.ɵɵadvance();
46
+ i0.ɵɵtextInterpolate1("", ctx_r1.coverage().score, "%");
47
+ i0.ɵɵadvance(2);
48
+ i0.ɵɵrepeater(ctx_r1.metricRows());
49
+ } }
50
+ function CoveragePanelComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
51
+ i0.ɵɵdomElementStart(0, "div", 1)(1, "p", 12);
52
+ i0.ɵɵtext(2, " Keine Coverage-Daten gefunden.");
53
+ i0.ɵɵdomElement(3, "br");
54
+ i0.ɵɵtext(4, " Fuehre ");
55
+ i0.ɵɵdomElementStart(5, "code");
56
+ i0.ɵɵtext(6, "nx test <project> --coverage");
57
+ i0.ɵɵdomElementEnd();
58
+ i0.ɵɵtext(7, " aus und rebuilde den Styleguide. ");
59
+ i0.ɵɵdomElementEnd()();
60
+ } }
61
+ export class CoveragePanelComponent {
62
+ activeComponent = input(null, ...(ngDevMode ? [{ debugName: "activeComponent" }] : []));
63
+ coverage = computed(() => {
64
+ const comp = this.activeComponent();
65
+ return comp?.meta?.showcaseConfig?.meta?.['coverage'] ?? null;
66
+ }, ...(ngDevMode ? [{ debugName: "coverage" }] : []));
67
+ scoreLevel = computed(() => {
68
+ const s = this.coverage()?.score ?? 0;
69
+ if (s >= 80)
70
+ return 'good';
71
+ if (s >= 50)
72
+ return 'warn';
73
+ return 'bad';
74
+ }, ...(ngDevMode ? [{ debugName: "scoreLevel" }] : []));
75
+ metricRows = computed(() => {
76
+ const c = this.coverage();
77
+ if (!c?.found)
78
+ return [];
79
+ const toLevel = (pct) => {
80
+ if (pct >= 80)
81
+ return 'good';
82
+ if (pct >= 50)
83
+ return 'warn';
84
+ return 'bad';
85
+ };
86
+ return [
87
+ { label: 'Statements', detail: c.statements, level: toLevel(c.statements.pct) },
88
+ { label: 'Branches', detail: c.branches, level: toLevel(c.branches.pct) },
89
+ { label: 'Functions', detail: c.functions, level: toLevel(c.functions.pct) },
90
+ { label: 'Lines', detail: c.lines, level: toLevel(c.lines.pct) },
91
+ ];
92
+ }, ...(ngDevMode ? [{ debugName: "metricRows" }] : []));
93
+ static ɵfac = function CoveragePanelComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CoveragePanelComponent)(); };
94
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CoveragePanelComponent, selectors: [["prism-coverage-panel"]], inputs: { activeComponent: [1, "activeComponent"] }, decls: 2, vars: 1, consts: [[1, "prism-coverage"], [1, "prism-coverage", "prism-coverage--empty"], [1, "prism-coverage__header"], [1, "prism-coverage__title"], [1, "prism-coverage__score"], [1, "prism-coverage__metrics"], [1, "prism-coverage__row"], [1, "prism-coverage__label"], [1, "prism-coverage__bar-track"], [1, "prism-coverage__bar-fill"], [1, "prism-coverage__pct"], [1, "prism-coverage__ratio"], [1, "prism-coverage__hint"]], template: function CoveragePanelComponent_Template(rf, ctx) { if (rf & 1) {
95
+ i0.ɵɵconditionalCreate(0, CoveragePanelComponent_Conditional_0_Template, 9, 2, "div", 0)(1, CoveragePanelComponent_Conditional_1_Template, 8, 0, "div", 1);
96
+ } if (rf & 2) {
97
+ let tmp_0_0;
98
+ i0.ɵɵconditional(((tmp_0_0 = ctx.coverage()) == null ? null : tmp_0_0.found) ? 0 : 1);
99
+ } }, styles: [".prism-coverage[_ngcontent-%COMP%] {\n padding: 16px;\n font-family: var(--prism-font-sans, system-ui, sans-serif);\n font-size: 13px;\n color: var(--prism-text, #e2e4e9);\n }\n\n .prism-coverage--empty[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 120px;\n }\n\n .prism-coverage__hint[_ngcontent-%COMP%] {\n color: var(--prism-text-muted, #8b8fa3);\n text-align: center;\n line-height: 1.6;\n }\n\n .prism-coverage__hint[_ngcontent-%COMP%] code[_ngcontent-%COMP%] {\n background: rgba(255, 255, 255, 0.06);\n padding: 2px 6px;\n border-radius: 4px;\n font-size: 12px;\n }\n\n .prism-coverage__header[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n }\n\n .prism-coverage__title[_ngcontent-%COMP%] {\n font-weight: 600;\n font-size: 14px;\n }\n\n .prism-coverage__score[_ngcontent-%COMP%] {\n font-weight: 700;\n font-size: 16px;\n }\n\n .prism-coverage__score[data-level=\"good\"][_ngcontent-%COMP%], \n .prism-coverage__pct[data-level=\"good\"][_ngcontent-%COMP%] { color: #4ade80; }\n .prism-coverage__score[data-level=\"warn\"][_ngcontent-%COMP%], \n .prism-coverage__pct[data-level=\"warn\"][_ngcontent-%COMP%] { color: #fbbf24; }\n .prism-coverage__score[data-level=\"bad\"][_ngcontent-%COMP%], \n .prism-coverage__pct[data-level=\"bad\"][_ngcontent-%COMP%] { color: #f87171; }\n\n .prism-coverage__metrics[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n .prism-coverage__row[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: 90px 1fr 50px 70px;\n align-items: center;\n gap: 10px;\n }\n\n .prism-coverage__label[_ngcontent-%COMP%] {\n color: var(--prism-text-muted, #8b8fa3);\n font-size: 12px;\n }\n\n .prism-coverage__bar-track[_ngcontent-%COMP%] {\n height: 6px;\n border-radius: 3px;\n background: rgba(255, 255, 255, 0.06);\n overflow: hidden;\n }\n\n .prism-coverage__bar-fill[_ngcontent-%COMP%] {\n height: 100%;\n border-radius: 3px;\n transition: width 0.3s ease;\n }\n\n .prism-coverage__bar-fill[data-level=\"good\"][_ngcontent-%COMP%] { background: #4ade80; }\n .prism-coverage__bar-fill[data-level=\"warn\"][_ngcontent-%COMP%] { background: #fbbf24; }\n .prism-coverage__bar-fill[data-level=\"bad\"][_ngcontent-%COMP%] { background: #f87171; }\n\n .prism-coverage__pct[_ngcontent-%COMP%] {\n text-align: right;\n font-weight: 600;\n font-size: 12px;\n }\n\n .prism-coverage__ratio[_ngcontent-%COMP%] {\n text-align: right;\n font-size: 11px;\n color: var(--prism-text-muted, #8b8fa3);\n }"], changeDetection: 0 });
100
+ }
101
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CoveragePanelComponent, [{
102
+ type: Component,
103
+ args: [{ selector: 'prism-coverage-panel', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
104
+ @if (coverage()?.found) {
105
+ <div class="prism-coverage">
106
+ <div class="prism-coverage__header">
107
+ <span class="prism-coverage__title">Test Coverage</span>
108
+ <span class="prism-coverage__score" [attr.data-level]="scoreLevel()">{{ coverage()!.score }}%</span>
109
+ </div>
110
+ <div class="prism-coverage__metrics">
111
+ @for (row of metricRows(); track row.label) {
112
+ <div class="prism-coverage__row">
113
+ <span class="prism-coverage__label">{{ row.label }}</span>
114
+ <div class="prism-coverage__bar-track">
115
+ <div
116
+ class="prism-coverage__bar-fill"
117
+ [attr.data-level]="row.level"
118
+ [style.width.%]="row.detail.pct"
119
+ ></div>
120
+ </div>
121
+ <span class="prism-coverage__pct" [attr.data-level]="row.level">{{ row.detail.pct }}%</span>
122
+ <span class="prism-coverage__ratio">{{ row.detail.covered }}/{{ row.detail.total }}</span>
123
+ </div>
124
+ }
125
+ </div>
126
+ </div>
127
+ } @else {
128
+ <div class="prism-coverage prism-coverage--empty">
129
+ <p class="prism-coverage__hint">
130
+ Keine Coverage-Daten gefunden.<br />
131
+ Fuehre <code>nx test &lt;project&gt; --coverage</code> aus und rebuilde den Styleguide.
132
+ </p>
133
+ </div>
134
+ }
135
+ `, styles: ["\n .prism-coverage {\n padding: 16px;\n font-family: var(--prism-font-sans, system-ui, sans-serif);\n font-size: 13px;\n color: var(--prism-text, #e2e4e9);\n }\n\n .prism-coverage--empty {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 120px;\n }\n\n .prism-coverage__hint {\n color: var(--prism-text-muted, #8b8fa3);\n text-align: center;\n line-height: 1.6;\n }\n\n .prism-coverage__hint code {\n background: rgba(255, 255, 255, 0.06);\n padding: 2px 6px;\n border-radius: 4px;\n font-size: 12px;\n }\n\n .prism-coverage__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n }\n\n .prism-coverage__title {\n font-weight: 600;\n font-size: 14px;\n }\n\n .prism-coverage__score {\n font-weight: 700;\n font-size: 16px;\n }\n\n .prism-coverage__score[data-level=\"good\"],\n .prism-coverage__pct[data-level=\"good\"] { color: #4ade80; }\n .prism-coverage__score[data-level=\"warn\"],\n .prism-coverage__pct[data-level=\"warn\"] { color: #fbbf24; }\n .prism-coverage__score[data-level=\"bad\"],\n .prism-coverage__pct[data-level=\"bad\"] { color: #f87171; }\n\n .prism-coverage__metrics {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n .prism-coverage__row {\n display: grid;\n grid-template-columns: 90px 1fr 50px 70px;\n align-items: center;\n gap: 10px;\n }\n\n .prism-coverage__label {\n color: var(--prism-text-muted, #8b8fa3);\n font-size: 12px;\n }\n\n .prism-coverage__bar-track {\n height: 6px;\n border-radius: 3px;\n background: rgba(255, 255, 255, 0.06);\n overflow: hidden;\n }\n\n .prism-coverage__bar-fill {\n height: 100%;\n border-radius: 3px;\n transition: width 0.3s ease;\n }\n\n .prism-coverage__bar-fill[data-level=\"good\"] { background: #4ade80; }\n .prism-coverage__bar-fill[data-level=\"warn\"] { background: #fbbf24; }\n .prism-coverage__bar-fill[data-level=\"bad\"] { background: #f87171; }\n\n .prism-coverage__pct {\n text-align: right;\n font-weight: 600;\n font-size: 12px;\n }\n\n .prism-coverage__ratio {\n text-align: right;\n font-size: 11px;\n color: var(--prism-text-muted, #8b8fa3);\n }\n "] }]
136
+ }], null, { activeComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeComponent", required: false }] }] }); })();
137
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CoveragePanelComponent, { className: "CoveragePanelComponent", filePath: "coverage-panel.component.ts", lineNumber: 147 }); })();
@@ -0,0 +1,4 @@
1
+ import type { NgPrismPlugin } from '@ng-prism/core/plugin';
2
+ import type { CoveragePluginOptions } from './coverage.types.js';
3
+ export declare function coveragePlugin(_options?: CoveragePluginOptions): NgPrismPlugin;
4
+ //# sourceMappingURL=coverage-plugin.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-plugin.browser.d.ts","sourceRoot":"","sources":["../src/coverage-plugin.browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,qBAAqB,GAAG,aAAa,CAa9E"}
@@ -0,0 +1,13 @@
1
+ export function coveragePlugin(_options) {
2
+ return {
3
+ name: '@ng-prism/plugin-coverage',
4
+ panels: [
5
+ {
6
+ id: 'coverage',
7
+ label: 'Coverage',
8
+ loadComponent: () => import('./coverage-panel.component.js').then((m) => m.CoveragePanelComponent),
9
+ position: 'bottom',
10
+ },
11
+ ],
12
+ };
13
+ }
@@ -0,0 +1,4 @@
1
+ import type { NgPrismPlugin } from '@ng-prism/core/plugin';
2
+ import type { CoveragePluginOptions } from './coverage.types.js';
3
+ export declare function coveragePlugin(options?: CoveragePluginOptions): NgPrismPlugin;
4
+ //# sourceMappingURL=coverage-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-plugin.d.ts","sourceRoot":"","sources":["../src/coverage-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIjE,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,aAAa,CA0B7E"}
@@ -0,0 +1,26 @@
1
+ const DEFAULT_COVERAGE_PATH = 'coverage/coverage-summary.json';
2
+ export function coveragePlugin(options) {
3
+ const coveragePath = options?.coveragePath ?? DEFAULT_COVERAGE_PATH;
4
+ return {
5
+ name: '@ng-prism/plugin-coverage',
6
+ async onComponentScanned(component) {
7
+ const { readCoverageForFile } = await import('./coverage-reader.js');
8
+ const coverage = readCoverageForFile(coveragePath, component.filePath);
9
+ return {
10
+ ...component,
11
+ showcaseConfig: {
12
+ ...component.showcaseConfig,
13
+ meta: { ...component.showcaseConfig.meta, coverage },
14
+ },
15
+ };
16
+ },
17
+ panels: [
18
+ {
19
+ id: 'coverage',
20
+ label: 'Coverage',
21
+ loadComponent: () => import('./coverage-panel.component.js').then((m) => m.CoveragePanelComponent),
22
+ position: 'bottom',
23
+ },
24
+ ],
25
+ };
26
+ }
@@ -0,0 +1,4 @@
1
+ import type { CoverageData } from './coverage.types.js';
2
+ export declare function readCoverageForFile(coveragePath: string, componentFilePath: string): CoverageData;
3
+ export declare function clearCoverageCache(): void;
4
+ //# sourceMappingURL=coverage-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-reader.d.ts","sourceRoot":"","sources":["../src/coverage-reader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,qBAAqB,CAAC;AA6DzE,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,YAAY,CAoBjG;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -0,0 +1,72 @@
1
+ import { readFileSync, statSync } from 'node:fs';
2
+ const EMPTY_METRIC = { total: 0, covered: 0, skipped: 0, pct: 0 };
3
+ const EMPTY_COVERAGE = {
4
+ score: 0,
5
+ statements: { ...EMPTY_METRIC },
6
+ branches: { ...EMPTY_METRIC },
7
+ functions: { ...EMPTY_METRIC },
8
+ lines: { ...EMPTY_METRIC },
9
+ found: false,
10
+ };
11
+ const cache = new Map();
12
+ function normalizePath(p) {
13
+ return p.replace(/\\/g, '/');
14
+ }
15
+ function loadSummary(coveragePath) {
16
+ try {
17
+ const mtime = statSync(coveragePath).mtimeMs;
18
+ const cached = cache.get(coveragePath);
19
+ if (cached && cached.mtime === mtime)
20
+ return cached.data;
21
+ const raw = readFileSync(coveragePath, 'utf-8');
22
+ const parsed = JSON.parse(raw);
23
+ cache.set(coveragePath, { mtime, data: parsed });
24
+ return parsed;
25
+ }
26
+ catch {
27
+ return null;
28
+ }
29
+ }
30
+ function findEntry(summary, componentPath) {
31
+ const normalizedComponent = normalizePath(componentPath);
32
+ const keys = Object.keys(summary).filter((k) => k !== 'total');
33
+ for (const key of keys) {
34
+ const normalizedKey = normalizePath(key);
35
+ if (normalizedKey === normalizedComponent)
36
+ return key;
37
+ }
38
+ for (const key of keys) {
39
+ const normalizedKey = normalizePath(key);
40
+ if (normalizedKey.endsWith(normalizedComponent) ||
41
+ normalizedComponent.endsWith(normalizedKey)) {
42
+ return key;
43
+ }
44
+ }
45
+ const componentSuffix = normalizedComponent.split('/').slice(-3).join('/');
46
+ for (const key of keys) {
47
+ if (normalizePath(key).endsWith(componentSuffix))
48
+ return key;
49
+ }
50
+ return undefined;
51
+ }
52
+ export function readCoverageForFile(coveragePath, componentFilePath) {
53
+ const summary = loadSummary(coveragePath);
54
+ if (!summary)
55
+ return { ...EMPTY_COVERAGE };
56
+ const entryKey = findEntry(summary, componentFilePath);
57
+ if (!entryKey)
58
+ return { ...EMPTY_COVERAGE };
59
+ const entry = summary[entryKey];
60
+ const score = Math.round((entry.statements.pct + entry.branches.pct + entry.functions.pct + entry.lines.pct) / 4);
61
+ return {
62
+ score,
63
+ statements: { ...entry.statements },
64
+ branches: { ...entry.branches },
65
+ functions: { ...entry.functions },
66
+ lines: { ...entry.lines },
67
+ found: true,
68
+ };
69
+ }
70
+ export function clearCoverageCache() {
71
+ cache.clear();
72
+ }
@@ -0,0 +1,27 @@
1
+ export interface MetricDetail {
2
+ total: number;
3
+ covered: number;
4
+ skipped: number;
5
+ pct: number;
6
+ }
7
+ export interface CoverageData {
8
+ score: number;
9
+ statements: MetricDetail;
10
+ branches: MetricDetail;
11
+ functions: MetricDetail;
12
+ lines: MetricDetail;
13
+ found: boolean;
14
+ }
15
+ export interface CoveragePluginOptions {
16
+ coveragePath?: string;
17
+ }
18
+ export interface IstanbulFileCoverage {
19
+ statements: MetricDetail;
20
+ branches: MetricDetail;
21
+ functions: MetricDetail;
22
+ lines: MetricDetail;
23
+ }
24
+ export interface IstanbulSummary {
25
+ [filePath: string]: IstanbulFileCoverage;
26
+ }
27
+ //# sourceMappingURL=coverage.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.types.d.ts","sourceRoot":"","sources":["../src/coverage.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,YAAY,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,YAAY,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB,CAAC;CAC1C"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export { coveragePlugin } from './coverage-plugin.browser.js';
2
+ export { CoveragePanelComponent } from './coverage-panel.component.js';
3
+ export type { CoverageData, MetricDetail, CoveragePluginOptions } from './coverage.types.js';
4
+ //# sourceMappingURL=index.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { coveragePlugin } from './coverage-plugin.browser.js';
2
+ export { CoveragePanelComponent } from './coverage-panel.component.js';
@@ -0,0 +1,4 @@
1
+ export { coveragePlugin } from './coverage-plugin.js';
2
+ export { CoveragePanelComponent } from './coverage-panel.component.js';
3
+ export type { CoverageData, MetricDetail, CoveragePluginOptions } from './coverage.types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { coveragePlugin } from './coverage-plugin.js';
2
+ export { CoveragePanelComponent } from './coverage-panel.component.js';
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@ng-prism/plugin-coverage",
3
+ "version": "21.4.0",
4
+ "description": "Test coverage panel for ng-prism.",
5
+ "keywords": [
6
+ "@ng-prism/core",
7
+ "coverage",
8
+ "testing",
9
+ "plugin",
10
+ "angular",
11
+ "styleguide"
12
+ ],
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "module": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ "./package.json": "./package.json",
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "browser": "./dist/index.browser.js",
23
+ "import": "./dist/index.js",
24
+ "default": "./dist/index.js"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "!**/*.tsbuildinfo"
30
+ ],
31
+ "peerDependencies": {
32
+ "@angular/core": ">=20.0.0",
33
+ "@ng-prism/core": ">=21.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@ng-prism/core": "*"
37
+ },
38
+ "dependencies": {
39
+ "tslib": "^2.3.0"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "https://github.com/dyingangel666/ng-prism.git",
44
+ "directory": "packages/plugin-coverage"
45
+ },
46
+ "homepage": "https://dyingangel666.github.io/ng-prism/",
47
+ "bugs": "https://github.com/dyingangel666/ng-prism/issues"
48
+ }