@ploaness/governance 1.6.0 → 1.8.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 (107) hide show
  1. package/dist/compliance-report-assets.d.ts +20 -0
  2. package/dist/compliance-report-assets.d.ts.map +1 -0
  3. package/dist/compliance-report-assets.js +230 -0
  4. package/dist/compliance-report-assets.js.map +1 -0
  5. package/dist/compliance-report-html.d.ts +18 -0
  6. package/dist/compliance-report-html.d.ts.map +1 -0
  7. package/dist/compliance-report-html.js +365 -0
  8. package/dist/compliance-report-html.js.map +1 -0
  9. package/dist/compliance-report-markup.d.ts +62 -0
  10. package/dist/compliance-report-markup.d.ts.map +1 -0
  11. package/dist/compliance-report-markup.js +118 -0
  12. package/dist/compliance-report-markup.js.map +1 -0
  13. package/dist/compliance-report-outline.d.ts +32 -0
  14. package/dist/compliance-report-outline.d.ts.map +1 -0
  15. package/dist/compliance-report-outline.js +124 -0
  16. package/dist/compliance-report-outline.js.map +1 -0
  17. package/dist/compliance-report.d.ts +136 -0
  18. package/dist/compliance-report.d.ts.map +1 -0
  19. package/dist/compliance-report.js +241 -0
  20. package/dist/compliance-report.js.map +1 -0
  21. package/dist/container-freshness.d.ts +2 -0
  22. package/dist/container-freshness.d.ts.map +1 -1
  23. package/dist/container-freshness.js +10 -5
  24. package/dist/container-freshness.js.map +1 -1
  25. package/dist/container-images.d.ts.map +1 -1
  26. package/dist/container-images.js +3 -4
  27. package/dist/container-images.js.map +1 -1
  28. package/dist/file-roles.d.ts +3 -3
  29. package/dist/file-roles.d.ts.map +1 -1
  30. package/dist/file-roles.js +10 -6
  31. package/dist/file-roles.js.map +1 -1
  32. package/dist/generated-denial.d.ts +2 -0
  33. package/dist/generated-denial.d.ts.map +1 -1
  34. package/dist/generated-denial.js +8 -6
  35. package/dist/generated-denial.js.map +1 -1
  36. package/dist/index.d.ts +11 -0
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +11 -0
  39. package/dist/index.js.map +1 -1
  40. package/dist/license-allowlist.d.ts +14 -0
  41. package/dist/license-allowlist.d.ts.map +1 -1
  42. package/dist/license-allowlist.js +28 -9
  43. package/dist/license-allowlist.js.map +1 -1
  44. package/dist/license-inventory.d.ts +25 -0
  45. package/dist/license-inventory.d.ts.map +1 -0
  46. package/dist/license-inventory.js +41 -0
  47. package/dist/license-inventory.js.map +1 -0
  48. package/dist/oxlint-policy.d.ts +1 -1
  49. package/dist/oxlint-policy.d.ts.map +1 -1
  50. package/dist/oxlint-policy.js +10 -3
  51. package/dist/oxlint-policy.js.map +1 -1
  52. package/dist/oxlint-scope.d.ts +2 -2
  53. package/dist/oxlint-scope.d.ts.map +1 -1
  54. package/dist/oxlint-scope.js +13 -4
  55. package/dist/oxlint-scope.js.map +1 -1
  56. package/dist/payload-access.d.ts.map +1 -1
  57. package/dist/payload-access.js +11 -3
  58. package/dist/payload-access.js.map +1 -1
  59. package/dist/payload-defaults.d.ts +2 -0
  60. package/dist/payload-defaults.d.ts.map +1 -1
  61. package/dist/payload-defaults.js +6 -2
  62. package/dist/payload-defaults.js.map +1 -1
  63. package/dist/payload-field-access.js +1 -1
  64. package/dist/payload-field-access.js.map +1 -1
  65. package/dist/payload-security.d.ts +20 -0
  66. package/dist/payload-security.d.ts.map +1 -0
  67. package/dist/payload-security.js +88 -0
  68. package/dist/payload-security.js.map +1 -0
  69. package/dist/pdf-outline.d.ts +7 -0
  70. package/dist/pdf-outline.d.ts.map +1 -0
  71. package/dist/pdf-outline.js +69 -0
  72. package/dist/pdf-outline.js.map +1 -0
  73. package/dist/production-server.d.ts +11 -0
  74. package/dist/production-server.d.ts.map +1 -0
  75. package/dist/production-server.js +17 -0
  76. package/dist/production-server.js.map +1 -0
  77. package/dist/run-plan.d.ts +4 -0
  78. package/dist/run-plan.d.ts.map +1 -1
  79. package/dist/run-plan.js +4 -0
  80. package/dist/run-plan.js.map +1 -1
  81. package/dist/sbom-policy.d.ts +38 -0
  82. package/dist/sbom-policy.d.ts.map +1 -0
  83. package/dist/sbom-policy.js +255 -0
  84. package/dist/sbom-policy.js.map +1 -0
  85. package/dist/sbom-release.d.ts +16 -0
  86. package/dist/sbom-release.d.ts.map +1 -0
  87. package/dist/sbom-release.js +36 -0
  88. package/dist/sbom-release.js.map +1 -0
  89. package/dist/security-headers.d.ts +3 -0
  90. package/dist/security-headers.d.ts.map +1 -0
  91. package/dist/security-headers.js +26 -0
  92. package/dist/security-headers.js.map +1 -0
  93. package/dist/settings.d.ts +1 -1
  94. package/dist/settings.d.ts.map +1 -1
  95. package/dist/settings.js +24 -2
  96. package/dist/settings.js.map +1 -1
  97. package/dist/toolchain-pins.d.ts +3 -3
  98. package/dist/toolchain-pins.d.ts.map +1 -1
  99. package/dist/toolchain-pins.js +6 -5
  100. package/dist/toolchain-pins.js.map +1 -1
  101. package/dist/version-policy.js +3 -3
  102. package/dist/version-policy.js.map +1 -1
  103. package/dist/vulnerability-policy.d.ts +24 -0
  104. package/dist/vulnerability-policy.d.ts.map +1 -1
  105. package/dist/vulnerability-policy.js +33 -6
  106. package/dist/vulnerability-policy.js.map +1 -1
  107. package/package.json +1 -1
@@ -0,0 +1,365 @@
1
+ // Render the compliance report as one self-contained HTML document: no external asset, so the file is
2
+ // the whole deliverable whether it is opened offline, attached to a message, or printed to PDF.
3
+ import { fontFaces, REPORT_SCRIPT, REPORT_STYLE } from './compliance-report-assets.js';
4
+ import { admonition, CLASS_LABELS, CLASSES, cells, classChip, code, embeddedJson, escapeHtml, facts, formatCount, idList, inventoryCsv, lettered, nowrap, packageLink, percentOf, plural, relationLabel, scopeLabel, severityChip, table, versionLabel, } from './compliance-report-markup.js';
5
+ import { section, sectionReference, subheading, tableOfContents } from './compliance-report-outline.js';
6
+ const SHORT_COMMIT = 12;
7
+ const CHART_LICENSES = 10;
8
+ const shortCommit = (commit) => commit.slice(0, SHORT_COMMIT);
9
+ const draftNotice = (report) => report.draftReasons.length === 0
10
+ ? ''
11
+ : admonition('warning', `<p>This report is a draft and must not be treated as release evidence. ${report.draftReasons
12
+ .map((reason) => escapeHtml(reason))
13
+ .join(' ')}</p>`);
14
+ const verdictNotice = (report) => {
15
+ const threshold = escapeHtml(report.vulnerabilities.threshold);
16
+ return report.isCompliant
17
+ ? admonition('ok', '<p><strong>Compliant.</strong> Every dependency is licensed within the stated policy, and no known ' +
18
+ `vulnerability at or above ${threshold} severity stands unresolved.</p>`)
19
+ : admonition('fail', '<p><strong>Not compliant</strong>. At least one dependency is outside the license policy, or a known ' +
20
+ `vulnerability at or above ${threshold} severity stands unresolved. The sections below name each one.</p>`);
21
+ };
22
+ const header = () => `<div id="header"><h1>Open Source Software Compliance Report</h1>${tableOfContents()}</div>`;
23
+ const opening = (report) => `<div id="preamble">${draftNotice(report)}${verdictNotice(report)}${facts([
24
+ ['Project', escapeHtml(report.projectName)],
25
+ ...(report.projectDescription === undefined
26
+ ? []
27
+ : [['Description', escapeHtml(report.projectDescription)]]),
28
+ ['Source commit', code(report.source.commit)],
29
+ ['Report generated', escapeHtml(report.generatedAt)],
30
+ ['Advisory data as of', escapeHtml(report.auditedAt)],
31
+ ['Package versions', formatCount(report.packages.length)],
32
+ ['Software bill of materials', `CycloneDX 1.6, ${plural(report.sbom.components, 'component')}`],
33
+ ])}</div>`;
34
+ const figure = (value, label, tone) => `<div class="figure ${tone}"><b>${formatCount(value)}</b><span>${escapeHtml(label)}</span></div>`;
35
+ const toneOf = (count, whenPresent) => (count > 0 ? whenPresent : 'good');
36
+ const keyFigures = (report) => {
37
+ const total = report.packages.length;
38
+ const open = report.vulnerabilities.unsuppressed.length;
39
+ const weak = report.classCounts['weak-copyleft'];
40
+ const refused = report.classCounts.refused;
41
+ return `<div class="figures">${[
42
+ figure(total, 'package versions in the resolved set', 'plain'),
43
+ figure(report.productionCount, 'in the production dependency graph', 'plain'),
44
+ figure(total - report.productionCount, 'used only for development and build', 'plain'),
45
+ figure(weak, 'under a weak copyleft license', toneOf(weak, 'warn')),
46
+ figure(refused, 'licenses outside the policy', toneOf(refused, 'bad')),
47
+ figure(open, `open vulnerabilities at or above ${report.vulnerabilities.threshold}`, toneOf(open, 'bad')),
48
+ ].join('')}</div>`;
49
+ };
50
+ const classStack = (report) => {
51
+ const total = report.packages.length;
52
+ const share = (licenseClass) => percentOf(report.classCounts[licenseClass], total);
53
+ const description = CLASSES.map((licenseClass) => `${CLASS_LABELS[licenseClass]} ${share(licenseClass)} percent`).join(', ');
54
+ return (`<div class="stack" role="img" aria-label="${description}">${CLASSES.map((licenseClass) => `<i class="seg-${licenseClass}" style="width:${share(licenseClass)}%"></i>`).join('')}</div>` +
55
+ `<ul class="legend">${CLASSES.map((licenseClass) => `<li class="key-${licenseClass}">${CLASS_LABELS[licenseClass]}: ` +
56
+ `${formatCount(report.classCounts[licenseClass])} (${share(licenseClass)}%)</li>`).join('')}</ul>`);
57
+ };
58
+ const bar = (label, count, largest, tone) => `<span class="label">${escapeHtml(label)}</span><span class="track"><span class="fill fill-${tone}" ` +
59
+ `style="width:${percentOf(count, largest)}%"></span></span><span class="count">${formatCount(count)}</span>`;
60
+ const licenseBars = (report) => {
61
+ const shown = report.licenseCounts.slice(0, CHART_LICENSES);
62
+ const rest = report.licenseCounts.slice(CHART_LICENSES);
63
+ const largest = shown[0]?.count ?? 0;
64
+ const restCount = rest.reduce((sum, entry) => sum + entry.count, 0);
65
+ return `<div class="bars">${[
66
+ ...shown.map((entry) => bar(entry.license, entry.count, largest, entry.licenseClass)),
67
+ ...(rest.length > 0 ? [bar(plural(rest.length, 'other license'), restCount, largest, 'other')] : []),
68
+ ].join('')}</div>`;
69
+ };
70
+ const severityRow = (counts) => `<ul class="severities">${counts
71
+ .map((entry) => `<li>${severityChip(entry.severity)} ${formatCount(entry.count)}</li>`)
72
+ .join('')}</ul>`;
73
+ const statement = (outcome, text) => `<li class="${outcome}">${text}</li>`;
74
+ const verdictOf = (isPassing) => (isPassing ? 'pass' : 'fail');
75
+ const licenseFinding = (report) => statement(verdictOf(report.classCounts.refused === 0), report.classCounts.refused === 0
76
+ ? `All ${plural(report.packages.length, 'package version')} declare a license the policy admits.`
77
+ : `${plural(report.classCounts.refused, 'package version')} declare a license outside the policy.`);
78
+ const vulnerabilityFindings = (report) => {
79
+ const open = report.vulnerabilities.unsuppressed.length;
80
+ const threshold = escapeHtml(report.vulnerabilities.threshold);
81
+ const excused = report.vulnerabilities.suppressed.length;
82
+ const stale = report.vulnerabilities.deadEntries.length;
83
+ const excusedVerb = excused === 1 ? 'is' : 'are';
84
+ return [
85
+ statement(verdictOf(open === 0), open === 0
86
+ ? `No known vulnerability at or above ${threshold} severity stands unresolved across ` +
87
+ `${plural(report.advisoryRecords, 'advisory record')}.`
88
+ : `${plural(open, 'known vulnerability', 'known vulnerabilities')} at or above ${threshold} severity ` +
89
+ 'stand unresolved.'),
90
+ statement(verdictOf(stale === 0), stale === 0
91
+ ? `${plural(excused, 'advisory', 'advisories')} at or above the threshold ${excusedVerb} excused by a ` +
92
+ 'recorded, justified and dated exception.'
93
+ : `${plural(stale, 'recorded exception')} no longer match any finding.`),
94
+ ];
95
+ };
96
+ const noticeFinding = (report) => statement('info', `${plural(report.notices.length, 'distinct license text')} reproduced for the production dependencies.` +
97
+ (report.withoutNotice.length === 0
98
+ ? ''
99
+ : ` ${plural(report.withoutNotice.length, 'production package version')} ship no license file and are ` +
100
+ `attributed by their declared license in ${sectionReference('inventory')}.`));
101
+ const findings = (report) => `<ul class="statements">${[
102
+ licenseFinding(report),
103
+ statement('info', `${plural(report.classCounts['weak-copyleft'], 'package version')} carry a weak copyleft license. Each is ` +
104
+ `listed with its scope in ${sectionReference('copyleft')}.`),
105
+ ...vulnerabilityFindings(report),
106
+ noticeFinding(report),
107
+ ].join('')}</ul>`;
108
+ const summary = (report) => section('summary', lettered([
109
+ 'This section states what the report establishes, in one view.',
110
+ 'Every figure is computed from the installed dependency tree of the source commit named above, with the ' +
111
+ 'same data the project build uses to pass or fail.',
112
+ ]) +
113
+ subheading('key-figures') +
114
+ keyFigures(report) +
115
+ subheading('license-classes') +
116
+ classStack(report) +
117
+ subheading('common-licenses') +
118
+ licenseBars(report) +
119
+ subheading('severities') +
120
+ severityRow(report.severityCounts) +
121
+ subheading('findings') +
122
+ findings(report));
123
+ const policy = (report) => section('policy', lettered([
124
+ 'This section states the policy the build enforces, rendered from the same definition the license check reads.',
125
+ 'A license is identified by its Software Package Data Exchange (SPDX) identifier.',
126
+ 'In a compound expression, an OR is satisfied by any admitted alternative, because the recipient may choose ' +
127
+ 'it, and an AND requires every part.',
128
+ ]) +
129
+ subheading('policy-permissive') +
130
+ lettered([
131
+ `The policy admits ${plural(report.policy.permissive.length, 'license')} with no copyleft obligation.`,
132
+ `Attribution, where the license requires it, is satisfied by ${sectionReference('notices')}.`,
133
+ ]) +
134
+ idList(report.policy.permissive) +
135
+ subheading('policy-weak-copyleft') +
136
+ lettered([
137
+ `The policy admits ${plural(report.policy.weakCopyleft.length, 'license')} only for dependencies used ` +
138
+ 'unmodified.',
139
+ 'File-level copyleft, as in the Mozilla, Eclipse, and Common Development and Distribution licenses, ' +
140
+ 'doesn&#39;t extend to the project&#39;s own source when the component is used as published.',
141
+ 'Neither does library-level copyleft, as in the GNU Lesser General Public License.',
142
+ ]) +
143
+ idList(report.policy.weakCopyleft) +
144
+ subheading('policy-outside') +
145
+ lettered([
146
+ 'Every other license is outside the policy, including strong copyleft such as the GNU General ' +
147
+ 'Public License and the GNU Affero General Public License, licenses that restrict the field of use, and ' +
148
+ 'any package whose license can&#39;t be resolved.',
149
+ 'A single such package fails the build.',
150
+ ]));
151
+ const REVIEW_HEADINGS = ['Package', 'Version', 'License', 'Scope', 'Relation'];
152
+ const reviewRow = (row) => {
153
+ const version = nowrap(escapeHtml(versionLabel(row)));
154
+ return cells([
155
+ packageLink(row),
156
+ `<span class="mono">${version}</span>`,
157
+ code(row.license),
158
+ nowrap(scopeLabel(row)),
159
+ nowrap(relationLabel(row)),
160
+ ]);
161
+ };
162
+ const copyleft = (report) => section('copyleft', lettered([
163
+ 'This section lists every package version whose license carries any copyleft condition.',
164
+ 'The policy admits weak copyleft only for components used unmodified.',
165
+ 'Production components are part of the distributed application. Development components are build, test and ' +
166
+ 'analysis tools that aren&#39;t distributed with it.',
167
+ ]) +
168
+ subheading('review-weak-copyleft') +
169
+ table(REVIEW_HEADINGS, report.copyleft.map((row) => reviewRow(row)), 'No dependency carries a weak copyleft license.') +
170
+ subheading('review-outside') +
171
+ table(REVIEW_HEADINGS, report.refused.map((row) => reviewRow(row)), 'No dependency declares a license outside the policy.'));
172
+ const advisoryLink = (advisory) => advisory.url?.startsWith('https://') === true
173
+ ? `<a href="${escapeHtml(advisory.url)}" rel="noreferrer noopener">${nowrap(code(advisory.id))}</a>`
174
+ : nowrap(code(advisory.id));
175
+ const aliasLine = (advisory) => advisory.aliases.length > 0 ? `<br><span class="mono">${escapeHtml(advisory.aliases.join(', '))}</span>` : '';
176
+ const advisoryCells = (advisory) => [
177
+ severityChip(advisory.severity),
178
+ `${advisoryLink(advisory)}${aliasLine(advisory)}<br>${escapeHtml(advisory.title)}`,
179
+ escapeHtml(advisory.packageName),
180
+ ];
181
+ const ADVISORY_HEADINGS = ['Severity', 'Advisory', 'Package'];
182
+ const excusedRow = (entry) => cells([
183
+ ...advisoryCells(entry.advisory),
184
+ escapeHtml(entry.exception.reason) +
185
+ (entry.isHarnessException ? '<br><span class="empty">Recorded by the build harness.</span>' : ''),
186
+ `<span class="mono">${nowrap(escapeHtml(entry.exception.addedOn))}</span>`,
187
+ ]);
188
+ const listItem = (text) => `<li>${escapeHtml(text)}</li>`;
189
+ const staleExceptions = (entries) => entries.length > 0
190
+ ? `<ul>${entries.map((entry) => listItem(entry)).join('')}</ul>`
191
+ : '<p class="empty">Every recorded exception still matches a finding.</p>';
192
+ const vulnerabilityIntroduction = (report) => lettered([
193
+ 'Every package in the resolved set, development tools included, was checked against the npm registry ' +
194
+ 'advisory service, which publishes the GitHub Advisory Database.',
195
+ `The query ran at ${escapeHtml(report.auditedAt)} and returned ` +
196
+ `${plural(report.advisoryRecords, 'advisory record')}.`,
197
+ `The build fails on any advisory at or above <strong>${escapeHtml(report.vulnerabilities.threshold)}</strong> ` +
198
+ 'severity unless a recorded exception explains why the project can&#39;t reach it.',
199
+ 'Unlike the rest of this report, this section reflects the database at the time of the query and can change ' +
200
+ 'for the same source.',
201
+ ]);
202
+ const vulnerabilities = (report) => {
203
+ const { threshold, unsuppressed, suppressed, belowThreshold, deadEntries } = report.vulnerabilities;
204
+ return section('vulnerabilities', vulnerabilityIntroduction(report) +
205
+ subheading('advisories-open') +
206
+ table(ADVISORY_HEADINGS, unsuppressed.map((advisory) => cells(advisoryCells(advisory))), `No advisory at or above ${threshold} severity stands unresolved.`) +
207
+ subheading('advisories-excused') +
208
+ table([...ADVISORY_HEADINGS, "Why it isn't reachable", 'Recorded'], suppressed.map((entry) => excusedRow(entry)), 'No exception is in use.') +
209
+ subheading('advisories-stale') +
210
+ staleExceptions(deadEntries) +
211
+ subheading('advisories-below') +
212
+ table(ADVISORY_HEADINGS, belowThreshold.map((advisory) => cells(advisoryCells(advisory))), 'No advisory below the threshold was reported.'));
213
+ };
214
+ const inventoryRow = (row) => `<tr data-scope="${row.isProduction ? 'production' : 'development'}" data-class="${row.licenseClass}">` +
215
+ `<td>${packageLink(row)}</td><td class="mono nowrap">${escapeHtml(versionLabel(row))}</td>` +
216
+ `<td>${code(row.license)}</td><td>${classChip(row.licenseClass)}</td>` +
217
+ `<td class="nowrap">${scopeLabel(row)}</td><td class="nowrap">${relationLabel(row)}</td></tr>`;
218
+ const classOption = (licenseClass) => `<option value="${licenseClass}">${CLASS_LABELS[licenseClass]}</option>`;
219
+ const inventoryControls = (fileStem) => '<div class="downloads">' +
220
+ `<button type="button" data-download="sbom" data-file="${escapeHtml(fileStem)}.cdx.json" hidden>` +
221
+ 'Download SBOM (CycloneDX JSON)</button>' +
222
+ `<button type="button" data-download="csv" data-file="${escapeHtml(fileStem)}.csv" hidden>` +
223
+ 'Download inventory (CSV)</button></div>' +
224
+ '<div class="controls">' +
225
+ '<input id="filter-text" type="search" placeholder="Filter by package or license" ' +
226
+ 'aria-label="Filter by package or license">' +
227
+ '<select id="filter-scope" aria-label="Scope"><option value="">All scopes</option>' +
228
+ '<option value="production">Production</option><option value="development">Development</option></select>' +
229
+ '<select id="filter-class" aria-label="License class"><option value="">All license classes</option>' +
230
+ CLASSES.map((licenseClass) => classOption(licenseClass)).join('') +
231
+ '</select><output id="filter-count" aria-live="polite"></output></div>';
232
+ const INVENTORY_HEADINGS = ['Package', 'Version', 'License', 'Class', 'Scope', 'Relation'];
233
+ const inventory = (report, fileStem) => section('inventory', lettered([
234
+ `This section lists every installed package version, ${plural(report.packages.length, 'row')}, with the ` +
235
+ 'license its installed manifest declares.',
236
+ 'Scope is production when the version is reachable from a production dependency of any workspace package, ' +
237
+ 'and development otherwise.',
238
+ 'Relation is direct when a workspace manifest declares the package by name.',
239
+ ]) +
240
+ inventoryControls(fileStem) +
241
+ '<div class="table-wrap"><table class="tableblock" id="inventory-table"><thead><tr>' +
242
+ INVENTORY_HEADINGS.map((heading) => `<th scope="col" data-sort>${heading}</th>`).join('') +
243
+ `</tr></thead><tbody>${report.packages.map((row) => inventoryRow(row)).join('')}` +
244
+ '</tbody></table></div>');
245
+ const LICENSE_HEADING = /^#{1,6}[ \t]+/u;
246
+ const LICENSE_RULE = /^[-=_*~]{3,}$/u;
247
+ // A web or e-mail address cannot break between words, and a copyright statement is a short line of names,
248
+ // so justifying either opens wide gaps. Such a paragraph is set flush left instead.
249
+ const FLUSH_LEFT = /\b(?:https?:\/\/|www\.)\S{20}|<[^<>\s]{1,80}@[^<>\s]{1,80}>|^(?:\(c\)|copyright\b|\u{A9})/iu;
250
+ // A licence block is plain lines, except that a bundle of licences titles each one with a Markdown heading
251
+ // and separates them with a ruled line. Those two are drawn as what they are, not printed as characters.
252
+ const licenseLine = (line) => {
253
+ if (LICENSE_RULE.test(line)) {
254
+ return '<hr>';
255
+ }
256
+ return LICENSE_HEADING.test(line)
257
+ ? `<p class="license-heading">${escapeHtml(line.replace(LICENSE_HEADING, ''))}</p>`
258
+ : `<p>${escapeHtml(line)}</p>`;
259
+ };
260
+ const licenseBlock = (block) => {
261
+ const lines = block.split('\n');
262
+ const isStructured = lines.some((line) => LICENSE_RULE.test(line) || LICENSE_HEADING.test(line));
263
+ const alignment = FLUSH_LEFT.test(block) ? ' class="ragged"' : '';
264
+ return isStructured
265
+ ? `<div class="license-entry">${lines.map((line) => licenseLine(line)).join('')}</div>`
266
+ : `<p${alignment}>${lines.map((line) => escapeHtml(line)).join('<br>')}</p>`;
267
+ };
268
+ // The package is what a reader looks for, so it heads the entry. The file names follow, with the number of
269
+ // package versions that share the text when there is more than one.
270
+ const noticeSource = (group) => escapeHtml(group.fileNames.join(', ')) +
271
+ (group.coordinates.length > 1 ? `, shared by ${plural(group.coordinates.length, 'package version')}` : '');
272
+ const noticeGroup = (group, index) => `<div class="notice" id="notice-${String(index + 1)}">` +
273
+ `<p class="title">${escapeHtml(group.coordinates.join(', '))}</p>` +
274
+ `<p class="notice-packages">${noticeSource(group)}</p>` +
275
+ `<div class="license-text">${group.text
276
+ .split('\n\n')
277
+ .map((block) => licenseBlock(block))
278
+ .join('')}</div></div>`;
279
+ const missingNotices = (report) => report.withoutNotice.length > 0
280
+ ? lettered([
281
+ 'These production package versions ship no license file.',
282
+ `Their declared license is listed in ${sectionReference('inventory')}, and no text is invented for them.`,
283
+ ]) + idList(report.withoutNotice)
284
+ : '<p class="empty">Every production package version ships a license file.</p>';
285
+ const notices = (report) => section('notices', lettered([
286
+ 'This section reproduces the license and notice files shipped by each production dependency, from the ' +
287
+ 'installed package.',
288
+ 'The words are unchanged. Only the fixed-width line breaks and the Markdown markers of the original files ' +
289
+ 'are removed so the text reads as paragraphs.',
290
+ 'Identical texts are printed once with every package version that ships them.',
291
+ 'Development dependencies aren&#39;t distributed with the application, so this section doesn&#39;t ' +
292
+ 'reproduce them.',
293
+ ]) +
294
+ subheading('notices-missing') +
295
+ missingNotices(report) +
296
+ subheading('notices-texts') +
297
+ (report.notices.length > 0
298
+ ? report.notices.map((group, index) => noticeGroup(group, index)).join('')
299
+ : '<p class="empty">No production dependency ships a license file.</p>'));
300
+ // A digest is read as one value, so it is set in the code face without a chip, which would split in two
301
+ // where the value wraps.
302
+ const digest = (value) => `<span class="digest">${escapeHtml(value)}</span>`;
303
+ const provenance = (report) => section('provenance', lettered([
304
+ 'This report is generated by the build, not written by hand.',
305
+ 'It reads the same installed dependency tree, license policy and advisory data that the license and ' +
306
+ 'vulnerability checks of the build use to pass or fail, so the report and the verdict can&#39;t disagree.',
307
+ 'Anyone with the repository can regenerate it from the commit below.',
308
+ ]) +
309
+ subheading('provenance-source') +
310
+ facts([
311
+ ['Source commit', code(report.source.commit)],
312
+ ['Uncommitted changes', report.source.isDirty ? 'Present, so this report is a draft' : 'None'],
313
+ ['Source fingerprint (SHA-256)', digest(report.source.fingerprint)],
314
+ ['Lockfile (SHA-256)', digest(report.source.lockfileSha256)],
315
+ ['SBOM (SHA-256)', digest(report.sbom.sha256)],
316
+ ['SBOM generator', digest(report.sbom.generator)],
317
+ ['Report date', escapeHtml(report.generatedAt)],
318
+ ['Regenerate', code('pnpm exec ploaness compliance-report')],
319
+ ]) +
320
+ subheading('provenance-scope') +
321
+ lettered([
322
+ 'The report covers every package the pnpm workspace resolves, for every workspace package, including ' +
323
+ 'development and build tools.',
324
+ 'A license is the one the installed package manifest declares.',
325
+ 'The embedded SBOM lists the same resolved set with its dependency graph.',
326
+ ]));
327
+ const body = (report, fileStem) => [
328
+ opening(report),
329
+ summary(report),
330
+ policy(report),
331
+ copyleft(report),
332
+ vulnerabilities(report),
333
+ inventory(report, fileStem),
334
+ notices(report),
335
+ provenance(report),
336
+ ];
337
+ /**
338
+ * Render the compliance report as one self-contained HTML document.
339
+ * @param report the assembled report.
340
+ * @param attachments the exact bytes the report carries, and the typefaces it is set in.
341
+ * @param fileStem the file name, without extension, downloads are offered under.
342
+ * @returns the complete document.
343
+ */
344
+ export const renderComplianceReport = (report, attachments, fileStem) => [
345
+ '<!doctype html>',
346
+ '<html lang="en">',
347
+ '<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">',
348
+ `<title>Open source compliance report - ${escapeHtml(report.projectName)}</title>`,
349
+ `<style>${fontFaces(attachments.fonts)}${REPORT_STYLE}</style></head>`,
350
+ '<body class="article toc2 toc-left">',
351
+ header(),
352
+ '<div id="content">',
353
+ ...body(report, fileStem),
354
+ '</div>',
355
+ `<div id="footer">Report for ${escapeHtml(report.projectName)} at commit ` +
356
+ `${code(shortCommit(report.source.commit))}, ${escapeHtml(report.generatedAt)}.</div>`,
357
+ `<script type="application/json" id="report-data">${embeddedJson({
358
+ sbom: attachments.sbom,
359
+ csv: inventoryCsv(report.packages),
360
+ })}</script>`,
361
+ `<script>${REPORT_SCRIPT}</script>`,
362
+ '</body></html>',
363
+ '',
364
+ ].join('\n');
365
+ //# sourceMappingURL=compliance-report-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compliance-report-html.js","sourceRoot":"","sources":["../src/compliance-report-html.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,gGAAgG;AAGhG,OAAO,EAAqB,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACzG,OAAO,EACL,UAAU,EACV,YAAY,EACZ,OAAO,EACP,KAAK,EACL,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,KAAK,EACL,WAAW,EACX,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,WAAW,EACX,SAAS,EACT,MAAM,EACN,aAAa,EACb,UAAU,EACV,YAAY,EACZ,KAAK,EACL,YAAY,GACb,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAYvG,MAAM,YAAY,GAAW,EAAE,CAAA;AAC/B,MAAM,cAAc,G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AW;IACnC,gBAAgB;IAChB,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA"}
@@ -0,0 +1,62 @@
1
+ import type { ReportPackage } from './compliance-report.js';
2
+ import type { LicenseClass } from './license-allowlist.js';
3
+ /**
4
+ * Escape text for an HTML text node or a quoted attribute.
5
+ * @param text untrusted text, such as a package name or a licence file.
6
+ * @returns the text with every markup character replaced by its entity.
7
+ */
8
+ export declare const escapeHtml: (text: string) => string;
9
+ /** The label each licence class is printed with. */
10
+ export declare const CLASS_LABELS: Readonly<Record<LicenseClass, string>>;
11
+ /** Every licence class, from the least to the most restrictive. */
12
+ export declare const CLASSES: readonly LicenseClass[];
13
+ export declare const scopeLabel: (row: ReportPackage) => string;
14
+ export declare const relationLabel: (row: ReportPackage) => string;
15
+ export declare const versionLabel: (row: ReportPackage) => string;
16
+ export declare const percentOf: (count: number, total: number) => string;
17
+ export declare const formatCount: (count: number) => string;
18
+ export declare const plural: (count: number, singular: string, several?: string) => string;
19
+ export declare const classChip: (licenseClass: LicenseClass) => string;
20
+ export declare const severityChip: (severity: string) => string;
21
+ export declare const nowrap: (html: string) => string;
22
+ export declare const code: (text: string) => string;
23
+ export declare const cells: (values: readonly string[]) => string;
24
+ /**
25
+ * A ruled table, or a sentence saying it would be empty.
26
+ * @param headings the column headings.
27
+ * @param rows the rendered rows.
28
+ * @param empty what to say when there are no rows.
29
+ * @returns the table markup.
30
+ */
31
+ export declare const table: (headings: readonly string[], rows: readonly string[], empty: string) => string;
32
+ /**
33
+ * A two-column table of labelled facts.
34
+ * @param rows each label with its already rendered value.
35
+ * @returns the table markup.
36
+ */
37
+ export declare const facts: (rows: readonly (readonly [string, string])[]) => string;
38
+ export declare const packageLink: (row: ReportPackage) => string;
39
+ export declare const idList: (ids: readonly string[]) => string;
40
+ /**
41
+ * Statements set as a lettered list, the way every statement of the report is addressed.
42
+ * @param items each statement, already rendered.
43
+ * @returns the list markup.
44
+ */
45
+ export declare const lettered: (items: readonly string[]) => string;
46
+ /** The icon an admonition carries. */
47
+ export type AdmonitionKind = 'warning' | 'ok' | 'fail';
48
+ /**
49
+ * A notice set apart from the text by an icon and a rule, where a reader looks first.
50
+ * @param kind the icon.
51
+ * @param html the notice, already rendered.
52
+ * @returns the admonition markup.
53
+ */
54
+ export declare const admonition: (kind: AdmonitionKind, html: string) => string;
55
+ export declare const embeddedJson: (value: unknown) => string;
56
+ /**
57
+ * The package inventory as CSV, one row per installed package version.
58
+ * @param packages the report's packages.
59
+ * @returns the CSV text with a header row.
60
+ */
61
+ export declare const inventoryCsv: (packages: readonly ReportPackage[]) => string;
62
+ //# sourceMappingURL=compliance-report-markup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compliance-report-markup.d.ts","sourceRoot":"","sources":["../src/compliance-report-markup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAU1D;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,MACyD,CAAA;AAEnG,oDAAoD;AACpD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAI/D,CAAA;AAED,mEAAmE;AACnE,eAAO,MAAM,OAAO,EAAE,SAAS,YAAY,EAA+C,CAAA;AAE1F,eAAO,MAAM,UAAU,GAAI,KAAK,aAAa,KAAG,MAA2D,CAAA;AAC3G,eAAO,MAAM,aAAa,GAAI,KAAK,aAAa,KAAG,MAAkD,CAAA;AACrG,eAAO,MAAM,YAAY,GAAI,KAAK,aAAa,KAAG,MAAoE,CAAA;AAItH,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,KAAG,MACG,CAAA;AAE5D,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,MAAuC,CAAA;AAEnF,eAAO,MAAM,MAAM,G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,118 @@
1
+ const HTML_ESCAPES = {
2
+ '&': '&amp;',
3
+ '<': '&lt;',
4
+ '>': '&gt;',
5
+ '"': '&quot;',
6
+ "'": '&#39;',
7
+ };
8
+ /**
9
+ * Escape text for an HTML text node or a quoted attribute.
10
+ * @param text untrusted text, such as a package name or a licence file.
11
+ * @returns the text with every markup character replaced by its entity.
12
+ */
13
+ export const escapeHtml = (text) => text.replaceAll(/[&<>"']/gu, (character) => HTML_ESCAPES[character] ?? character);
14
+ /** The label each licence class is printed with. */
15
+ export const CLASS_LABELS = {
16
+ permissive: 'Permissive',
17
+ 'weak-copyleft': 'Weak copyleft',
18
+ refused: 'Outside policy',
19
+ };
20
+ /** Every licence class, from the least to the most restrictive. */
21
+ export const CLASSES = ['permissive', 'weak-copyleft', 'refused'];
22
+ export const scopeLabel = (row) => (row.isProduction ? 'Production' : 'Development');
23
+ export const relationLabel = (row) => (row.isDirect ? 'Direct' : 'Transitive');
24
+ export const versionLabel = (row) => (row.version.length > 0 ? row.version : 'local directory');
25
+ const PERCENT = 100;
26
+ export const percentOf = (count, total) => total === 0 ? '0' : ((count / total) * PERCENT).toFixed(1);
27
+ export const formatCount = (count) => count.toLocaleString('en-US');
28
+ export const plural = (count, singular, several = `${singular}s`) => `${formatCount(count)} ${count === 1 ? singular : several}`;
29
+ export const classChip = (licenseClass) => `<span class="chip chip-${licenseClass}">${CLASS_LABELS[licenseClass]}</span>`;
30
+ export const severityChip = (severity) => {
31
+ const escaped = escapeHtml(severity.toLowerCase());
32
+ return `<span class="sev sev-${escaped}">${escaped}</span>`;
33
+ };
34
+ export const nowrap = (html) => `<span class="nowrap">${html}</span>`;
35
+ export const code = (text) => `<code>${escapeHtml(text)}</code>`;
36
+ const cell = (value) => `<td>${value}</td>`;
37
+ export const cells = (values) => `<tr>${values.map((value) => cell(value)).join('')}</tr>`;
38
+ /**
39
+ * A ruled table, or a sentence saying it would be empty.
40
+ * @param headings the column headings.
41
+ * @param rows the rendered rows.
42
+ * @param empty what to say when there are no rows.
43
+ * @returns the table markup.
44
+ */
45
+ export const table = (headings, rows, empty) => rows.length === 0
46
+ ? `<p class="empty">${escapeHtml(empty)}</p>`
47
+ : `<div class="table-wrap"><table class="tableblock"><thead><tr>${headings
48
+ .map((heading) => `<th scope="col">${escapeHtml(heading)}</th>`)
49
+ .join('')}</tr></thead><tbody>${rows.join('')}</tbody></table></div>`;
50
+ /**
51
+ * A two-column table of labelled facts.
52
+ * @param rows each label with its already rendered value.
53
+ * @returns the table markup.
54
+ */
55
+ export const facts = (rows) => `<div class="table-wrap"><table class="tableblock facts"><tbody>${rows
56
+ .map(([label, value]) => `<tr><td>${escapeHtml(label)}</td><td>${value}</td></tr>`)
57
+ .join('')}</tbody></table></div>`;
58
+ const WEB_LINK = /^https?:\/\//u;
59
+ export const packageLink = (row) => row.homepage !== undefined && WEB_LINK.test(row.homepage)
60
+ ? `<a href="${escapeHtml(row.homepage)}" rel="noreferrer noopener">${escapeHtml(row.name)}</a>`
61
+ : escapeHtml(row.name);
62
+ const idItem = (id) => `<li>${code(id)}</li>`;
63
+ export const idList = (ids) => `<ul class="ids">${ids.map((id) => idItem(id)).join('')}</ul>`;
64
+ const letteredItem = (html) => `<li><p>${html}</p></li>`;
65
+ /**
66
+ * Statements set as a lettered list, the way every statement of the report is addressed.
67
+ * @param items each statement, already rendered.
68
+ * @returns the list markup.
69
+ */
70
+ export const lettered = (items) => `<div class="olist upperalpha"><ol class="upperalpha" type="A">${items
71
+ .map((item) => letteredItem(item))
72
+ .join('')}</ol></div>`;
73
+ const ICON_PATHS = {
74
+ warning: 'M12 2.5 1.5 21h21L12 2.5Zm-1.1 6.5h2.2l-.35 6.6h-1.5L10.9 9Zm1.1 10a1.3 1.3 0 1 1 0-2.6 1.3 1.3 0 0 1 0 2.6Z',
75
+ ok: 'M12 1.5a10.5 10.5 0 1 0 0 21 10.5 10.5 0 0 0 0-21Zm-1.6 15.2-4.7-4.7 1.6-1.6 3.1 3.1 6.3-6.3 1.6 1.6-7.9 7.9Z',
76
+ fail: 'M12 1.5a10.5 10.5 0 1 0 0 21 10.5 10.5 0 0 0 0-21Zm-1.1 5h2.2l-.35 7.6h-1.5L10.9 6.5Zm1.1 11.6a1.3 1.3 0 1 1 ' +
77
+ '0-2.6 1.3 1.3 0 0 1 0 2.6Z',
78
+ };
79
+ /**
80
+ * A notice set apart from the text by an icon and a rule, where a reader looks first.
81
+ * @param kind the icon.
82
+ * @param html the notice, already rendered.
83
+ * @returns the admonition markup.
84
+ */
85
+ export const admonition = (kind, html) => `<div class="admonitionblock ${kind}"><table><tbody><tr><td class="icon">` +
86
+ `<svg class="icon-${kind}" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" ` +
87
+ `d="${ICON_PATHS[kind]}"/></svg></td><td class="content">${html}</td></tr></tbody></table></div>`;
88
+ // Embedded data is JSON inside a script element; escaping `<` keeps a `</script>` in a licence file or a
89
+ // package name from ending the element early.
90
+ export const embeddedJson = (value) => JSON.stringify(value).replaceAll('<', String.raw `\u003c`);
91
+ const CSV_FORMULA_START = /^[=+\-@\t\r]/u;
92
+ // Every field is quoted, and a field a spreadsheet would read as a formula is prefixed with an apostrophe:
93
+ // a package name is registry input, and a CSV opened in a spreadsheet is a place it could execute.
94
+ const csvField = (value) => {
95
+ const safe = CSV_FORMULA_START.test(value) ? `'${value}` : value;
96
+ return `"${safe.replaceAll('"', '""')}"`;
97
+ };
98
+ /**
99
+ * The package inventory as CSV, one row per installed package version.
100
+ * @param packages the report's packages.
101
+ * @returns the CSV text with a header row.
102
+ */
103
+ export const inventoryCsv = (packages) => [
104
+ ['package', 'version', 'license', 'license class', 'scope', 'relation', 'homepage'],
105
+ ...packages.map((row) => [
106
+ row.name,
107
+ row.version,
108
+ row.license,
109
+ CLASS_LABELS[row.licenseClass],
110
+ scopeLabel(row),
111
+ relationLabel(row),
112
+ row.homepage ?? '',
113
+ ]),
114
+ ]
115
+ .map((fields) => fields.map((field) => csvField(field)).join(','))
116
+ .join('\r\n')
117
+ .concat('\r\n');
118
+ //# sourceMappingURL=compliance-report-markup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compliance-report-markup.js","sourceRoot":"","sources":["../src/compliance-report-markup.ts"],"names":[],"mappings":"AAKA,MAAM,YAAY,GAAqC;IACrD,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,OAAO;CACb,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CACjD,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,SAAiB,EAAU,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,CAAA;AAEnG,oDAAoD;AACpD,MAAM,CAAC,MAAM,YAAY,GAA2C;IAClE,UAAU,EAAE,YAAY;IACxB,eAAe,EAAE,eAAe;IAChC,OAAO,EAAE,gBAAgB;CAC1B,CAAA;AAED,mEAAmE;AACnE,MAAM,CAAC,MAAM,OAAO,GAA4B,CAAC,YAAY,EAAE,eAAe,EAAE,SAAS,CAAC,CAAA;AAE1F,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAkB,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAA;AAC3G,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAkB,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;AACrG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAkB,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAA;AAE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M,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE;IACzC,MAAM,IAAI,GAAW,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;IACxE,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAA;AAC1C,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAkC,EAAU,EAAE,CACzE;IACE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC;IACnF,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAkB,EAAqB,EAAE,CAAC;QACzD,GAAG,CAAC,IAAI;QACR,GAAG,CAAC,OAAO;QACX,GAAG,CAAC,OAAO;QACX,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC;QAC9B,UAAU,CAAC,GAAG,CAAC;QACf,aAAa,CAAC,GAAG,CAAC;QAClB,GAAG,CAAC,QAAQ,IAAI,EAAE;KACnB,CAAC;CACH;KACE,GAAG,CAAC,CAAC,MAAyB,EAAU,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAa,EAAU,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC5G,IAAI,CAAC,MAAM,CAAC;KACZ,MAAM,CAAC,MAAM,CAAC,CAAA"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A numbered subsection heading.
3
+ * @param id the outline entry.
4
+ * @returns the heading element.
5
+ */
6
+ export declare const subheading: (id: string) => string;
7
+ /**
8
+ * A numbered top-level section.
9
+ * @param id the outline section.
10
+ * @param body the section's markup after its heading.
11
+ * @returns the section element.
12
+ */
13
+ export declare const section: (id: string, body: string) => string;
14
+ /**
15
+ * The table of contents, read from the same outline as the headings.
16
+ * @returns the contents navigation.
17
+ */
18
+ export declare const tableOfContents: () => string;
19
+ /**
20
+ * The cross-reference text for a section, such as "section 3".
21
+ * @param id the outline entry.
22
+ * @returns the reference text.
23
+ */
24
+ export declare const sectionReference: (id: string) => string;
25
+ /**
26
+ * The page of every outline entry, from the bookmarks of a printed report. A bookmark is titled with the
27
+ * heading's text, which starts with the entry's number, so the number is what is matched.
28
+ * @param bookmarks the page by bookmark title, as read from the PDF.
29
+ * @returns the page number by outline id, for every entry found.
30
+ */
31
+ export declare const contentsPages: (bookmarks: ReadonlyMap<string, number>) => ReadonlyMap<string, number>;
32
+ //# sourceMappingURL=compliance-report-outline.d.ts.map