@bridge-ds/core 0.13.0 → 0.15.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,43 @@
1
+ import { GitHubClient } from './github-client';
2
+ import { type RepoSource } from './repo-source';
3
+ /** Where blob bodies are kept between sources (IndexedDB in the browser). Keyed by blob sha; may be async. */
4
+ export interface BlobCache {
5
+ get(sha: string): string | undefined | Promise<string | undefined>;
6
+ set(sha: string, text: string): void | Promise<void>;
7
+ }
8
+ export interface GitHubSourceOptions {
9
+ /** Files larger than this are refused (status 413) instead of read. Default 1 MB. */
10
+ maxFileBytes?: number;
11
+ /** Body reads in flight at once. Default 4 (friendly to GitHub's secondary limits). */
12
+ concurrency?: number;
13
+ /**
14
+ * A cache that outlives the source, keyed by blob sha. Bodies of private repositories land in it, so the caller
15
+ * scopes it per repository and account and clears it on sign-out (plan 6.8).
16
+ */
17
+ blobCache?: BlobCache;
18
+ /**
19
+ * Hears what the source does: the tree once it is read (how many files the commit holds), then each body as it
20
+ * lands, saying whether it came from the blob cache (no request) or from GitHub.
21
+ */
22
+ onProgress?: (event: GitHubSourceProgress) => void;
23
+ }
24
+ /** What a GitHub source reports through `onProgress`. */
25
+ export type GitHubSourceProgress = {
26
+ kind: 'tree';
27
+ files: number;
28
+ } | {
29
+ kind: 'file';
30
+ path: string;
31
+ cached: boolean;
32
+ };
33
+ /** How bodies are read: the blobs API with the token, or the raw host without one. */
34
+ export type GitHubSourceMode = 'api' | 'raw';
35
+ export interface GitHubSource extends RepoSource {
36
+ /** Where body reads go: 'api' when the client has a token, 'raw' otherwise. */
37
+ readonly mode: GitHubSourceMode;
38
+ }
39
+ /**
40
+ * A source over `client`'s repository at commit `sha` (a full 40-character sha: a branch name would move under the
41
+ * cache). The first `list` or `text` call reads the tree; `text` of a path the tree does not list costs no request.
42
+ */
43
+ export declare function gitHubSource(client: GitHubClient, sha: string, opts?: GitHubSourceOptions): GitHubSource;
@@ -0,0 +1,38 @@
1
+ /** Which repository and commit a source reads. `sha` pins every read; a local checkout may say "working-tree". */
2
+ export interface RepoSourceRef {
3
+ owner: string;
4
+ repo: string;
5
+ sha: string;
6
+ }
7
+ export interface RepoSource {
8
+ ref: RepoSourceRef;
9
+ /**
10
+ * Repo-relative paths of every file under `prefix` (a directory, repo-relative, no trailing slash), at any depth,
11
+ * sorted. Omitted or empty: the whole repository. A missing directory lists nothing.
12
+ */
13
+ list(prefix?: string): Promise<string[]>;
14
+ /** Body of a repo-relative file as UTF-8 text, or null when the file does not exist. */
15
+ text(path: string): Promise<string | null>;
16
+ }
17
+ /** "./a//b/" -> "a/b". Paths in a RepoSource are repo-relative and use "/". */
18
+ export declare function normalizeRepoPath(path: string): string;
19
+ /** True when `path` is `prefix` itself or a file below it. An empty prefix holds everything. */
20
+ export declare function isUnder(path: string, prefix: string | undefined): boolean;
21
+ /** Parent directory of a repo-relative path ("" for a top-level file). */
22
+ export declare const parentDir: (path: string) => string;
23
+ /** Joins repo-relative segments, dropping empty ones and "." ("packages", "", "a.json" -> "packages/a.json"). */
24
+ export declare const joinRepoPath: (...parts: (string | undefined)[]) => string;
25
+ /**
26
+ * A source over files held in memory, keyed by repo-relative path. Used by tests, by snapshots and by any caller
27
+ * that already has the bodies (a browser cache).
28
+ */
29
+ export declare function memorySource(files: Record<string, string>, ref?: Partial<RepoSourceRef>): RepoSource;
30
+ /** How far a readRepoTexts call has gone: files settled (read, missing or skipped) out of the distinct paths asked. */
31
+ export type ReadProgress = (done: number, total: number) => void;
32
+ /**
33
+ * Reads many files with a few requests in flight (4 by default, like loadRepoFiles), keyed by the path asked for.
34
+ * A missing file maps to null. `onError` decides about a read that throws: return null to skip the file, or throw
35
+ * (the default) to fail the whole read. `onProgress` hears (0, total) first, then once per settled file: real counts,
36
+ * so a progress bar never runs ahead of the reads.
37
+ */
38
+ export declare function readRepoTexts(source: RepoSource, paths: string[], concurrency?: number, onError?: (path: string, err: unknown) => null, onProgress?: ReadProgress): Promise<Map<string, string | null>>;
@@ -1,4 +1,4 @@
1
- import { bn as hexToRgba, aW as comboKey } from "./prod-branch-6ftQWwdu.js";
1
+ import { bn as hexToRgba, aX as comboKey } from "./prod-branch-BjXFIz74.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"];
@@ -1907,4 +1907,4 @@ export {
1907
1907
  isRouterLink as y,
1908
1908
  isSafeFix as z
1909
1909
  };
1910
- //# sourceMappingURL=report-BeWNSjPk.js.map
1910
+ //# sourceMappingURL=report-DCPfvvoq.js.map