@bridge-ds/core 0.17.0 → 0.19.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 (64) hide show
  1. package/bridge.config.schema.json +16 -0
  2. package/dist/activity.d.ts +207 -0
  3. package/dist/audit/index.js +3 -3
  4. package/dist/audit/report.d.ts +17 -2
  5. package/dist/branch-actions.d.ts +7 -1
  6. package/dist/build-requests-github.d.ts +25 -0
  7. package/dist/build-requests.d.ts +403 -0
  8. package/dist/changelog-model.d.ts +102 -0
  9. package/dist/component-spec.d.ts +3 -1
  10. package/dist/config.d.ts +21 -0
  11. package/dist/css-color.d.ts +25 -0
  12. package/dist/docs-proposal.d.ts +1 -0
  13. package/dist/explorations.d.ts +1 -0
  14. package/dist/fidelity-references.d.ts +12 -0
  15. package/dist/figma-fix-loop.d.ts +153 -0
  16. package/dist/figma-fixes.d.ts +169 -0
  17. package/dist/figma-push-github.d.ts +7 -2
  18. package/dist/figma-push.d.ts +15 -2
  19. package/dist/gap-case.d.ts +144 -0
  20. package/dist/github-client.d.ts +31 -0
  21. package/dist/id-map.d.ts +10 -0
  22. package/dist/index.d.ts +14 -0
  23. package/dist/index.js +3944 -774
  24. package/dist/index.js.map +1 -1
  25. package/dist/layered-review.d.ts +2 -0
  26. package/dist/measure-status.d.ts +127 -0
  27. package/dist/measured-only.d.ts +28 -0
  28. package/dist/measured-spec.d.ts +349 -0
  29. package/dist/measured-tokens.d.ts +25 -0
  30. package/dist/motion-docs.d.ts +51 -0
  31. package/dist/node/audit.d.ts +11 -3
  32. package/dist/node/index.d.ts +1 -0
  33. package/dist/node/index.js +1637 -24
  34. package/dist/node/index.js.map +1 -1
  35. package/dist/node/measure-script.d.ts +1 -0
  36. package/dist/node/measure.d.ts +212 -0
  37. package/dist/node/spec-css.d.ts +9 -1
  38. package/dist/node/tokens-script.d.ts +3 -0
  39. package/dist/pr-composer.d.ts +5 -0
  40. package/dist/previews.d.ts +4 -1
  41. package/dist/{prod-branch-DenQkr_e.js → prod-branch-Bdx_2bRQ.js} +197 -159
  42. package/dist/prod-branch-Bdx_2bRQ.js.map +1 -0
  43. package/dist/prod-branch.d.ts +1 -1
  44. package/dist/repo-model.d.ts +5 -1
  45. package/dist/repo-source-github.d.ts +8 -0
  46. package/dist/{repo-source-B4jNZhyC.js → repo-source-m0Tc603o.js} +1406 -629
  47. package/dist/repo-source-m0Tc603o.js.map +1 -0
  48. package/dist/repo-source.d.ts +6 -0
  49. package/dist/{report-DVEmUr0p.js → report-DFPKygfk.js} +17 -6
  50. package/dist/{report-DVEmUr0p.js.map → report-DFPKygfk.js.map} +1 -1
  51. package/dist/requester.d.ts +14 -0
  52. package/dist/requests.d.ts +2 -0
  53. package/dist/review-gate.d.ts +183 -2
  54. package/dist/risk.d.ts +12 -0
  55. package/dist/share-branch.d.ts +1 -1
  56. package/dist/snapshot.d.ts +34 -0
  57. package/dist/suggestion-review.d.ts +2 -0
  58. package/dist/suggestions-github.d.ts +21 -0
  59. package/dist/suggestions.d.ts +6 -0
  60. package/dist/token-proposal.d.ts +7 -0
  61. package/dist/try-in-product.d.ts +9 -0
  62. package/package.json +1 -1
  63. package/dist/prod-branch-DenQkr_e.js.map +0 -1
  64. package/dist/repo-source-B4jNZhyC.js.map +0 -1
@@ -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 { bq as hexToRgba, a_ as comboKey } from "./prod-branch-DenQkr_e.js";
1
+ import { bu as hexToRgba, b0 as comboKey } from "./prod-branch-Bdx_2bRQ.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 !== AUDIT_SCHEMA_VERSION) throw new Error(`baseline schemaVersion ${String(baseline.schemaVersion)} is not supported (expected ${AUDIT_SCHEMA_VERSION})`);
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
- edits.push({ ...at(start), start, end: start + h.text.length, from: h.text, to: `var(${s.cssVar})`, token: s.token });
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-DVEmUr0p.js.map
1921
+ //# sourceMappingURL=report-DFPKygfk.js.map