@bridge-ds/core 0.18.0 → 0.20.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 +17 -0
- package/bridge.config.schema.json +21 -0
- package/dist/audit/index.js +3 -3
- package/dist/audit/report.d.ts +17 -2
- package/dist/branch-actions.d.ts +7 -1
- package/dist/build-requests-github.d.ts +25 -0
- package/dist/build-requests.d.ts +403 -0
- package/dist/changelog-model.d.ts +102 -0
- package/dist/component-spec.d.ts +3 -1
- package/dist/config.d.ts +26 -0
- package/dist/css-color.d.ts +25 -0
- package/dist/docs-proposal.d.ts +1 -0
- package/dist/explorations.d.ts +1 -0
- package/dist/fidelity-references.d.ts +12 -0
- package/dist/fidelity.d.ts +12 -1
- package/dist/figma-fix-loop.d.ts +153 -0
- package/dist/figma-fix-run.d.ts +103 -0
- package/dist/figma-fixes.d.ts +169 -0
- package/dist/figma-push-github.d.ts +7 -2
- package/dist/figma-push.d.ts +15 -2
- package/dist/gap-case.d.ts +143 -0
- package/dist/github-client.d.ts +31 -0
- package/dist/id-map.d.ts +10 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +3996 -818
- package/dist/index.js.map +1 -1
- package/dist/layered-review.d.ts +2 -0
- package/dist/measure-location.d.ts +42 -0
- package/dist/measure-status.d.ts +127 -0
- package/dist/measure-workflow.d.ts +48 -0
- package/dist/measured-only.d.ts +30 -0
- package/dist/measured-spec.d.ts +349 -0
- package/dist/measured-tokens.d.ts +25 -0
- package/dist/motion-docs.d.ts +51 -0
- package/dist/node/audit.d.ts +11 -3
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +1640 -24
- package/dist/node/index.js.map +1 -1
- package/dist/node/measure-script.d.ts +1 -0
- package/dist/node/measure.d.ts +212 -0
- package/dist/node/spec-css.d.ts +9 -1
- package/dist/node/tokens-script.d.ts +3 -0
- package/dist/pr-composer.d.ts +5 -0
- package/dist/previews.d.ts +4 -1
- package/dist/{prod-branch-DenQkr_e.js → prod-branch-CJZwMfVD.js} +223 -183
- package/dist/prod-branch-CJZwMfVD.js.map +1 -0
- package/dist/prod-branch.d.ts +1 -1
- package/dist/repo-model.d.ts +7 -1
- package/dist/{repo-source-CRfhLO87.js → repo-source-CshjjC7x.js} +1485 -629
- package/dist/repo-source-CshjjC7x.js.map +1 -0
- package/dist/repo-source-github.d.ts +8 -0
- package/dist/repo-source.d.ts +6 -0
- package/dist/{report-DVEmUr0p.js → report-CE-jHAuw.js} +17 -6
- package/dist/{report-DVEmUr0p.js.map → report-CE-jHAuw.js.map} +1 -1
- package/dist/requester.d.ts +14 -0
- package/dist/requests.d.ts +2 -0
- package/dist/review-gate.d.ts +189 -2
- package/dist/risk.d.ts +12 -0
- package/dist/share-branch.d.ts +1 -1
- package/dist/snapshot.d.ts +34 -0
- package/dist/suggestion-review.d.ts +45 -2
- package/dist/suggestions-github.d.ts +33 -1
- package/dist/suggestions.d.ts +6 -0
- package/dist/tier1-publish.d.ts +48 -0
- package/dist/token-proposal.d.ts +7 -0
- package/dist/try-in-product.d.ts +9 -0
- package/package.json +1 -1
- package/dist/prod-branch-DenQkr_e.js.map +0 -1
- package/dist/repo-source-CRfhLO87.js.map +0 -1
|
@@ -20,6 +20,14 @@ export interface GitHubSourceOptions {
|
|
|
20
20
|
* lands, saying whether it came from the blob cache (no request) or from GitHub.
|
|
21
21
|
*/
|
|
22
22
|
onProgress?: (event: GitHubSourceProgress) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Reads many blob bodies in one request (the Bridge read path, /api/contribute?blobs=): the text of each sha it
|
|
25
|
+
* could read, null for a blob that does not exist; a sha left out is read on its own. Used by `prefetch` in 'api'
|
|
26
|
+
* mode only, `batchSize` shas per request (default 80), `batchConcurrency` requests at once (default 3).
|
|
27
|
+
*/
|
|
28
|
+
batch?: (shas: string[]) => Promise<Record<string, string | null>>;
|
|
29
|
+
batchSize?: number;
|
|
30
|
+
batchConcurrency?: number;
|
|
23
31
|
}
|
|
24
32
|
/** What a GitHub source reports through `onProgress`. */
|
|
25
33
|
export type GitHubSourceProgress = {
|
package/dist/repo-source.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ export interface RepoSource {
|
|
|
13
13
|
list(prefix?: string): Promise<string[]>;
|
|
14
14
|
/** Body of a repo-relative file as UTF-8 text, or null when the file does not exist. */
|
|
15
15
|
text(path: string): Promise<string | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Optional: these files will be read next. A source that can read many bodies in one request (a GitHub source
|
|
18
|
+
* with a `batch` reader) starts reading them now; `text` then waits for that read. Never rejects: a body the batch
|
|
19
|
+
* could not read is read on its own by `text`.
|
|
20
|
+
*/
|
|
21
|
+
prefetch?(paths: string[]): Promise<void>;
|
|
16
22
|
}
|
|
17
23
|
/** "./a//b/" -> "a/b". Paths in a RepoSource are repo-relative and use "/". */
|
|
18
24
|
export declare function normalizeRepoPath(path: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bu as hexToRgba, b0 as comboKey } from "./prod-branch-CJZwMfVD.js";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
const AUDIT_SCHEMA_VERSION = 1;
|
|
4
4
|
const FINDING_CATEGORIES = ["color", "spacing", "size", "radius", "border-width", "shadow", "duration", "easing", "z-index", "font-family", "font-size", "font-weight", "line-height"];
|
|
@@ -1727,7 +1727,8 @@ function historyPoint(r) {
|
|
|
1727
1727
|
};
|
|
1728
1728
|
}
|
|
1729
1729
|
function compareWithBaseline(report, baseline) {
|
|
1730
|
-
if (baseline.schemaVersion
|
|
1730
|
+
if (baseline.schemaVersion === void 0) throw new Error("The baseline is not a bridge audit report (it has no schemaVersion). Pass a report written by bridge audit <path> --json <file>.");
|
|
1731
|
+
if (baseline.schemaVersion !== AUDIT_SCHEMA_VERSION) throw new Error(`baseline schemaVersion ${String(baseline.schemaVersion)} is not supported (expected ${AUDIT_SCHEMA_VERSION}). Write a new one with bridge audit <path> --json <file>.`);
|
|
1731
1732
|
const before = new Map(baseline.files.map((f) => [f.path, f.hardcoded + f.otherComponents]));
|
|
1732
1733
|
const after = new Map(report.files.map((f) => [f.path, f.hardcoded + f.otherComponents]));
|
|
1733
1734
|
const byCategory = {};
|
|
@@ -1836,22 +1837,32 @@ function auditMarkdown(r, opts = {}) {
|
|
|
1836
1837
|
}
|
|
1837
1838
|
return lines.join("\n");
|
|
1838
1839
|
}
|
|
1839
|
-
function planCssFixes(text, lang, ds) {
|
|
1840
|
+
function planCssFixes(text, lang, ds, opts = {}) {
|
|
1840
1841
|
const at = lineCol(text);
|
|
1841
1842
|
const scan = scanCssText(text, lang);
|
|
1842
1843
|
const edits = [];
|
|
1844
|
+
const kept = [];
|
|
1845
|
+
const byComment = new Map(ignoreDirectives(text).filter((d) => d.reason).map((d) => [d.target, d.reason]));
|
|
1846
|
+
const allow = opts.allowlist ?? [];
|
|
1843
1847
|
for (const d of scan.decls) {
|
|
1844
1848
|
const property = d.property.toLowerCase();
|
|
1845
1849
|
for (const h of d.scan.hits) {
|
|
1846
1850
|
const s = ds.suggest(h.category, h.text, property);
|
|
1847
1851
|
if (!isSafeFix(h, s)) continue;
|
|
1848
1852
|
const start = d.valueStart + h.index;
|
|
1849
|
-
|
|
1853
|
+
const pos = at(start);
|
|
1854
|
+
const comment = byComment.get(pos.line);
|
|
1855
|
+
const listed = allow.find((e) => e.line === pos.line && (e.what === void 0 || e.what === h.text));
|
|
1856
|
+
if (comment !== void 0 || listed) {
|
|
1857
|
+
kept.push({ ...pos, from: h.text, reason: comment ?? listed.reason, via: comment !== void 0 ? "comment" : "allowlist" });
|
|
1858
|
+
continue;
|
|
1859
|
+
}
|
|
1860
|
+
edits.push({ ...pos, start, end: start + h.text.length, from: h.text, to: `var(${s.cssVar})`, token: s.token });
|
|
1850
1861
|
}
|
|
1851
1862
|
}
|
|
1852
1863
|
let output = text;
|
|
1853
1864
|
for (const e of [...edits].sort((a, b) => b.start - a.start)) output = output.slice(0, e.start) + e.to + output.slice(e.end);
|
|
1854
|
-
return { edits: edits.map(({ start: _s, end: _e, ...e }) => e), output };
|
|
1865
|
+
return { edits: edits.map(({ start: _s, end: _e, ...e }) => e), output, kept };
|
|
1855
1866
|
}
|
|
1856
1867
|
export {
|
|
1857
1868
|
AUDIT_EXTENSIONS as A,
|
|
@@ -1907,4 +1918,4 @@ export {
|
|
|
1907
1918
|
isRouterLink as y,
|
|
1908
1919
|
isSafeFix as z
|
|
1909
1920
|
};
|
|
1910
|
-
//# sourceMappingURL=report-
|
|
1921
|
+
//# sourceMappingURL=report-CE-jHAuw.js.map
|