@bridge-ds/core 0.4.0 → 0.5.1
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/README.md +16 -5
- package/audit-report.schema.json +135 -1
- package/dist/audit/code.d.ts +50 -0
- package/dist/audit/components.d.ts +1 -1
- package/dist/audit/ignore.d.ts +34 -0
- package/dist/audit/index.d.ts +3 -0
- package/dist/audit/index.js +45 -29
- package/dist/audit/markup.d.ts +21 -0
- package/dist/audit/report.d.ts +5 -7
- package/dist/audit/style.d.ts +25 -0
- package/dist/audit/types.d.ts +39 -1
- package/dist/github-client.d.ts +14 -0
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/node/audit.d.ts +5 -1
- package/dist/node/index.js +6 -2
- package/dist/node/index.js.map +1 -1
- package/dist/{report-Bf2HEr9t.js → report-iPSnsjYi.js} +599 -143
- package/dist/report-iPSnsjYi.js.map +1 -0
- package/package.json +1 -1
- package/dist/report-Bf2HEr9t.js.map +0 -1
package/dist/node/audit.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type BridgeConfig } from '../config';
|
|
|
2
2
|
import { LayeredTokenSet } from '../layered';
|
|
3
3
|
import { type CssFixEdit } from '../audit/report';
|
|
4
4
|
import { DesignSystemIndex } from '../audit/ds-index';
|
|
5
|
-
import type { AuditReport } from '../audit/types';
|
|
5
|
+
import type { AllowlistEntry, AuditReport } from '../audit/types';
|
|
6
6
|
export interface LoadedDesignSystem {
|
|
7
7
|
root: string;
|
|
8
8
|
config: BridgeConfig;
|
|
@@ -33,7 +33,11 @@ export interface RunAuditOptions {
|
|
|
33
33
|
/** Path recorded in the report (default: target relative to cwd). */
|
|
34
34
|
displayPath?: string;
|
|
35
35
|
exclude?: string[];
|
|
36
|
+
/** Known violations left out of the counts, each with a reason (see loadAllowlist). */
|
|
37
|
+
allowlist?: AllowlistEntry[];
|
|
36
38
|
}
|
|
39
|
+
/** Read an allowlist file: `{ "entries": [{ "file", "line", "what"?, "reason" }] }`, paths relative to the audited folder. */
|
|
40
|
+
export declare function loadAllowlist(path: string): AllowlistEntry[];
|
|
37
41
|
/** Audit a product folder against a design system. */
|
|
38
42
|
export declare function runAudit(target: string, opts?: RunAuditOptions): AuditReport;
|
|
39
43
|
/** Plan (and optionally write) the safe CSS autofix for every CSS/SCSS/Less file under `target`. */
|
package/dist/node/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { join, resolve, relative, dirname, sep, posix } from "node:path";
|
|
|
5
5
|
import { a as assertSafeBranch, c as collectHistory, p as packageDirCandidates, b as parseChangelog, m as mergeReleases, r as releasesFromTags, d as buildReport, e as prNumberFromSubject, l as loadConfig, h as hashSpec, C as COMPONENT_SPECS_VERSION, f as CONFIG_FILE, g as layoutOptions, v as variantKeyOf, i as buildTokenSet, t as tokenCssVar, j as iconComponentName, k as COLOR_FIELDS } from "../component-spec-cvrSvIZj.js";
|
|
6
6
|
import { s as selectTokenFiles, g as globToRegExp, L as LayeredTokenSet } from "../layered-BnbmToGs.js";
|
|
7
7
|
import { statSync, readFileSync, existsSync, writeFileSync, readdirSync } from "node:fs";
|
|
8
|
-
import {
|
|
8
|
+
import { v as isAuditable, Q as planCssFixes, O as parseAllowlist, c as DesignSystemIndex, k as buildAuditReport, n as compareWithBaseline, a as AUDIT_IGNORE_DIRS } from "../report-iPSnsjYi.js";
|
|
9
9
|
import ts from "typescript";
|
|
10
10
|
function git(root, args, opts = {}) {
|
|
11
11
|
return new Promise((resolve2, reject) => {
|
|
@@ -277,13 +277,16 @@ function collectAuditFiles(target, exclude = []) {
|
|
|
277
277
|
}
|
|
278
278
|
return { root: abs, files, skipped };
|
|
279
279
|
}
|
|
280
|
+
function loadAllowlist(path) {
|
|
281
|
+
return parseAllowlist(JSON.parse(readFileSync(path, "utf8")));
|
|
282
|
+
}
|
|
280
283
|
function runAudit(target, opts = {}) {
|
|
281
284
|
const dsRoot = opts.ds ?? findDesignSystemRoot(process.cwd());
|
|
282
285
|
if (!dsRoot) throw new Error("No design system found: run from a repo with bridge.config.json or pass --ds <dir>.");
|
|
283
286
|
const ds = loadDesignSystem(dsRoot);
|
|
284
287
|
const { files, skipped } = collectAuditFiles(target, [...ds.config.audit?.exclude ?? [], ...opts.exclude ?? []]);
|
|
285
288
|
const report = buildAuditReport(
|
|
286
|
-
{ files, skipped, target: opts.displayPath ?? (toPosix(relative(process.cwd(), resolve(target))) || "."), ...opts.label ? { label: opts.label } : {}, ...opts.version ? { version: opts.version } : {} },
|
|
289
|
+
{ files, skipped, target: opts.displayPath ?? (toPosix(relative(process.cwd(), resolve(target))) || "."), ...opts.label ? { label: opts.label } : {}, ...opts.version ? { version: opts.version } : {}, ...opts.allowlist ? { allowlist: opts.allowlist } : {} },
|
|
287
290
|
ds.index
|
|
288
291
|
);
|
|
289
292
|
return opts.baseline ? compareWithBaseline(report, opts.baseline) : report;
|
|
@@ -1746,6 +1749,7 @@ export {
|
|
|
1746
1749
|
git,
|
|
1747
1750
|
isGitRepo,
|
|
1748
1751
|
listFilesAt,
|
|
1752
|
+
loadAllowlist,
|
|
1749
1753
|
loadDesignSystem,
|
|
1750
1754
|
loadLocalHistory,
|
|
1751
1755
|
localGitHistoryBackend,
|