@buoy-gg/assets 7.0.16
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 +58 -0
- package/README.md +55 -0
- package/lib/commonjs/capture/expo.js +46 -0
- package/lib/commonjs/capture/expo.js.map +1 -0
- package/lib/commonjs/capture/install.js +78 -0
- package/lib/commonjs/capture/install.js.map +1 -0
- package/lib/commonjs/capture/measure.js +186 -0
- package/lib/commonjs/capture/measure.js.map +1 -0
- package/lib/commonjs/capture/metroGraph.js +148 -0
- package/lib/commonjs/capture/metroGraph.js.map +1 -0
- package/lib/commonjs/capture/registry.js +124 -0
- package/lib/commonjs/capture/registry.js.map +1 -0
- package/lib/commonjs/components/AssetDetail.js +205 -0
- package/lib/commonjs/components/AssetDetail.js.map +1 -0
- package/lib/commonjs/components/AssetRow.js +246 -0
- package/lib/commonjs/components/AssetRow.js.map +1 -0
- package/lib/commonjs/components/AssetsFilterBar.js +92 -0
- package/lib/commonjs/components/AssetsFilterBar.js.map +1 -0
- package/lib/commonjs/components/AssetsHeader.js +66 -0
- package/lib/commonjs/components/AssetsHeader.js.map +1 -0
- package/lib/commonjs/components/AssetsIcon.js +19 -0
- package/lib/commonjs/components/AssetsIcon.js.map +1 -0
- package/lib/commonjs/components/AssetsListControls.js +94 -0
- package/lib/commonjs/components/AssetsListControls.js.map +1 -0
- package/lib/commonjs/components/AssetsModal.js +338 -0
- package/lib/commonjs/components/AssetsModal.js.map +1 -0
- package/lib/commonjs/components/BaselineBar.js +110 -0
- package/lib/commonjs/components/BaselineBar.js.map +1 -0
- package/lib/commonjs/export.js +62 -0
- package/lib/commonjs/export.js.map +1 -0
- package/lib/commonjs/format.js +59 -0
- package/lib/commonjs/format.js.map +1 -0
- package/lib/commonjs/hooks/useAssetRecords.js +22 -0
- package/lib/commonjs/hooks/useAssetRecords.js.map +1 -0
- package/lib/commonjs/index.js +260 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/preset.js +45 -0
- package/lib/commonjs/preset.js.map +1 -0
- package/lib/commonjs/remote.js +65 -0
- package/lib/commonjs/remote.js.map +1 -0
- package/lib/commonjs/state.js +51 -0
- package/lib/commonjs/state.js.map +1 -0
- package/lib/commonjs/store/assetStore.js +234 -0
- package/lib/commonjs/store/assetStore.js.map +1 -0
- package/lib/commonjs/store/baseline.js +165 -0
- package/lib/commonjs/store/baseline.js.map +1 -0
- package/lib/commonjs/store/insights.js +129 -0
- package/lib/commonjs/store/insights.js.map +1 -0
- package/lib/commonjs/sync/assetsSyncAdapter.js +157 -0
- package/lib/commonjs/sync/assetsSyncAdapter.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/capture/expo.js +41 -0
- package/lib/module/capture/expo.js.map +1 -0
- package/lib/module/capture/install.js +72 -0
- package/lib/module/capture/install.js.map +1 -0
- package/lib/module/capture/measure.js +179 -0
- package/lib/module/capture/measure.js.map +1 -0
- package/lib/module/capture/metroGraph.js +141 -0
- package/lib/module/capture/metroGraph.js.map +1 -0
- package/lib/module/capture/registry.js +117 -0
- package/lib/module/capture/registry.js.map +1 -0
- package/lib/module/components/AssetDetail.js +201 -0
- package/lib/module/components/AssetDetail.js.map +1 -0
- package/lib/module/components/AssetRow.js +242 -0
- package/lib/module/components/AssetRow.js.map +1 -0
- package/lib/module/components/AssetsFilterBar.js +88 -0
- package/lib/module/components/AssetsFilterBar.js.map +1 -0
- package/lib/module/components/AssetsHeader.js +62 -0
- package/lib/module/components/AssetsHeader.js.map +1 -0
- package/lib/module/components/AssetsIcon.js +12 -0
- package/lib/module/components/AssetsIcon.js.map +1 -0
- package/lib/module/components/AssetsListControls.js +90 -0
- package/lib/module/components/AssetsListControls.js.map +1 -0
- package/lib/module/components/AssetsModal.js +333 -0
- package/lib/module/components/AssetsModal.js.map +1 -0
- package/lib/module/components/BaselineBar.js +106 -0
- package/lib/module/components/BaselineBar.js.map +1 -0
- package/lib/module/export.js +57 -0
- package/lib/module/export.js.map +1 -0
- package/lib/module/format.js +51 -0
- package/lib/module/format.js.map +1 -0
- package/lib/module/hooks/useAssetRecords.js +18 -0
- package/lib/module/hooks/useAssetRecords.js.map +1 -0
- package/lib/module/index.js +59 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/preset.js +40 -0
- package/lib/module/preset.js.map +1 -0
- package/lib/module/remote.js +58 -0
- package/lib/module/remote.js.map +1 -0
- package/lib/module/state.js +47 -0
- package/lib/module/state.js.map +1 -0
- package/lib/module/store/assetStore.js +219 -0
- package/lib/module/store/assetStore.js.map +1 -0
- package/lib/module/store/baseline.js +157 -0
- package/lib/module/store/baseline.js.map +1 -0
- package/lib/module/store/insights.js +125 -0
- package/lib/module/store/insights.js.map +1 -0
- package/lib/module/sync/assetsSyncAdapter.js +153 -0
- package/lib/module/sync/assetsSyncAdapter.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/capture/expo.d.ts +18 -0
- package/lib/typescript/capture/expo.d.ts.map +1 -0
- package/lib/typescript/capture/install.d.ts +17 -0
- package/lib/typescript/capture/install.d.ts.map +1 -0
- package/lib/typescript/capture/measure.d.ts +38 -0
- package/lib/typescript/capture/measure.d.ts.map +1 -0
- package/lib/typescript/capture/metroGraph.d.ts +33 -0
- package/lib/typescript/capture/metroGraph.d.ts.map +1 -0
- package/lib/typescript/capture/registry.d.ts +45 -0
- package/lib/typescript/capture/registry.d.ts.map +1 -0
- package/lib/typescript/components/AssetDetail.d.ts +17 -0
- package/lib/typescript/components/AssetDetail.d.ts.map +1 -0
- package/lib/typescript/components/AssetRow.d.ts +32 -0
- package/lib/typescript/components/AssetRow.d.ts.map +1 -0
- package/lib/typescript/components/AssetsFilterBar.d.ts +16 -0
- package/lib/typescript/components/AssetsFilterBar.d.ts.map +1 -0
- package/lib/typescript/components/AssetsHeader.d.ts +22 -0
- package/lib/typescript/components/AssetsHeader.d.ts.map +1 -0
- package/lib/typescript/components/AssetsIcon.d.ts +9 -0
- package/lib/typescript/components/AssetsIcon.d.ts.map +1 -0
- package/lib/typescript/components/AssetsListControls.d.ts +18 -0
- package/lib/typescript/components/AssetsListControls.d.ts.map +1 -0
- package/lib/typescript/components/AssetsModal.d.ts +24 -0
- package/lib/typescript/components/AssetsModal.d.ts.map +1 -0
- package/lib/typescript/components/BaselineBar.d.ts +13 -0
- package/lib/typescript/components/BaselineBar.d.ts.map +1 -0
- package/lib/typescript/export.d.ts +8 -0
- package/lib/typescript/export.d.ts.map +1 -0
- package/lib/typescript/format.d.ts +13 -0
- package/lib/typescript/format.d.ts.map +1 -0
- package/lib/typescript/hooks/useAssetRecords.d.ts +11 -0
- package/lib/typescript/hooks/useAssetRecords.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +26 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts +38 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/remote.d.ts +17 -0
- package/lib/typescript/remote.d.ts.map +1 -0
- package/lib/typescript/state.d.ts +41 -0
- package/lib/typescript/state.d.ts.map +1 -0
- package/lib/typescript/store/assetStore.d.ts +51 -0
- package/lib/typescript/store/assetStore.d.ts.map +1 -0
- package/lib/typescript/store/baseline.d.ts +22 -0
- package/lib/typescript/store/baseline.d.ts.map +1 -0
- package/lib/typescript/store/insights.d.ts +7 -0
- package/lib/typescript/store/insights.d.ts.map +1 -0
- package/lib/typescript/sync/assetsSyncAdapter.d.ts +83 -0
- package/lib/typescript/sync/assetsSyncAdapter.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +162 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +77 -0
- package/src/capture/expo.ts +45 -0
- package/src/capture/install.ts +73 -0
- package/src/capture/measure.ts +167 -0
- package/src/capture/metroGraph.ts +146 -0
- package/src/capture/registry.ts +134 -0
- package/src/components/AssetDetail.tsx +207 -0
- package/src/components/AssetRow.tsx +243 -0
- package/src/components/AssetsFilterBar.tsx +99 -0
- package/src/components/AssetsHeader.tsx +75 -0
- package/src/components/AssetsIcon.tsx +9 -0
- package/src/components/AssetsListControls.tsx +101 -0
- package/src/components/AssetsModal.tsx +368 -0
- package/src/components/BaselineBar.tsx +98 -0
- package/src/export.ts +108 -0
- package/src/format.ts +53 -0
- package/src/hooks/useAssetRecords.ts +26 -0
- package/src/index.tsx +87 -0
- package/src/preset.tsx +35 -0
- package/src/remote.ts +65 -0
- package/src/state.ts +84 -0
- package/src/store/assetStore.ts +209 -0
- package/src/store/baseline.ts +152 -0
- package/src/store/insights.ts +145 -0
- package/src/sync/assetsSyncAdapter.ts +151 -0
- package/src/types.ts +160 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AssetsModal — bottom-sheet wrapper rendered by FloatingDevTools when the
|
|
3
|
+
* Assets tool is opened. Inventory list (largest first) → tap for detail.
|
|
4
|
+
* Opening triggers a full rescan (registry walk + Metro graph + size
|
|
5
|
+
* measurement); merely installing the package never hits the network.
|
|
6
|
+
*/
|
|
7
|
+
import type { ModalState } from "@buoy-gg/shared-ui";
|
|
8
|
+
interface AssetsModalProps {
|
|
9
|
+
visible: boolean;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onBack?: () => void;
|
|
12
|
+
onMinimize?: (modalState: ModalState) => void;
|
|
13
|
+
persistenceKey?: string;
|
|
14
|
+
/** Render as a plain header-bar + body stack instead of a JsModal (desktop). */
|
|
15
|
+
inline?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function AssetsModal({ visible, onClose, onBack, onMinimize, persistenceKey, inline, }: AssetsModalProps): import("react").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* The same Assets tool rendered INLINE for hosts that place tools in a panel
|
|
20
|
+
* rather than a modal (the desktop dashboard). One implementation only.
|
|
21
|
+
*/
|
|
22
|
+
export declare function AssetsToolView(props?: Omit<AssetsModalProps, "visible" | "onClose" | "inline">): import("react").JSX.Element;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=AssetsModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetsModal.d.ts","sourceRoot":"","sources":["../../../src/components/AssetsModal.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAerD,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAoED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,cAAc,EACd,MAAc,GACf,EAAE,gBAAgB,+BAuKlB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,GAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAM,+BAGrE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BaselineBar — save/compare-against-baseline controls.
|
|
3
|
+
*
|
|
4
|
+
* No baseline: one "SAVE BASELINE" button. With a baseline: the diff summary
|
|
5
|
+
* ("+3 new · 1 removed · +1.2 MB since 2h ago") plus UPDATE and ✕ (clear).
|
|
6
|
+
* Growth renders in warning color, shrinkage in success — that's the whole
|
|
7
|
+
* point of the feature.
|
|
8
|
+
*/
|
|
9
|
+
import type { AssetsDiff } from "../types";
|
|
10
|
+
export declare function BaselineBar({ diff }: {
|
|
11
|
+
diff: AssetsDiff | null;
|
|
12
|
+
}): import("react").JSX.Element | null;
|
|
13
|
+
//# sourceMappingURL=BaselineBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaselineBar.d.ts","sourceRoot":"","sources":["../../../src/components/BaselineBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAU3C,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;CAAE,sCAkChE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown reports for the shared ToolbarCopyButton — the paste-into-your-
|
|
3
|
+
* issue-tracker view of the inventory.
|
|
4
|
+
*/
|
|
5
|
+
import type { AssetRecord, AssetsDiff, AssetsInsights, AssetsScanStatus, AssetsStats } from "./types";
|
|
6
|
+
export declare function formatAssetMarkdown(record: AssetRecord): string;
|
|
7
|
+
export declare function formatInventoryMarkdown(records: AssetRecord[], stats: AssetsStats, insights: AssetsInsights, scanStatus: AssetsScanStatus, diff?: AssetsDiff | null): string;
|
|
8
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/export.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAmB/D;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,WAAW,EAAE,EACtB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,GACvB,MAAM,CAiER"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared formatting helpers for rows, detail view, and markdown export.
|
|
3
|
+
*/
|
|
4
|
+
import type { AssetKind, AssetRecord } from "./types";
|
|
5
|
+
export declare function formatBytes(bytes: number | null | undefined): string;
|
|
6
|
+
export declare function formatScales(scales: number[]): string;
|
|
7
|
+
export declare function formatDimensions(record: AssetRecord): string;
|
|
8
|
+
/** Display size: measured bytes, or "~" decoded estimate for unmeasured images. */
|
|
9
|
+
export declare function formatSize(record: AssetRecord, estDecoded: number): string;
|
|
10
|
+
export declare const KIND_LABELS: Record<AssetKind, string>;
|
|
11
|
+
/** Family accent per kind — the card's left edge, like network's method bar. */
|
|
12
|
+
export declare const KIND_COLORS: Record<AssetKind, string>;
|
|
13
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAKpE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAMrD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAG5D;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAM1E;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAOjD,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAOjD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React bindings for the asset store.
|
|
3
|
+
*/
|
|
4
|
+
import type { AssetRecord, AssetsInsights, AssetsStats } from "../types";
|
|
5
|
+
export interface UseAssetRecordsResult {
|
|
6
|
+
records: AssetRecord[];
|
|
7
|
+
stats: AssetsStats;
|
|
8
|
+
insights: AssetsInsights;
|
|
9
|
+
}
|
|
10
|
+
export declare function useAssetRecords(): UseAssetRecordsResult;
|
|
11
|
+
//# sourceMappingURL=useAssetRecords.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAssetRecords.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAssetRecords.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,wBAAgB,eAAe,IAAI,qBAAqB,CAUvD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @buoy-gg/assets — bundled-asset inventory for React Native / Expo.
|
|
3
|
+
*
|
|
4
|
+
* Enumerates every asset in the app (images, fonts, video, audio, …) via the
|
|
5
|
+
* runtime asset registry, enriched in dev with the Metro graph (full-bundle
|
|
6
|
+
* coverage, byte sizes, never-loaded detection) and on Expo with loaded font
|
|
7
|
+
* families + the updates localAssets map. Zero configuration: importing this
|
|
8
|
+
* package installs the (cheap, synchronous) registry capture.
|
|
9
|
+
*/
|
|
10
|
+
export { assetsToolPreset, createAssetsTool } from "./preset";
|
|
11
|
+
export { AssetsModal, AssetsToolView } from "./components/AssetsModal";
|
|
12
|
+
export { AssetsIcon, ASSETS_ICON_COLOR } from "./components/AssetsIcon";
|
|
13
|
+
export { installAssetCapture, rescan, getScanStatus } from "./capture/install";
|
|
14
|
+
export { measureSizes } from "./capture/measure";
|
|
15
|
+
export { fetchAssetGraph, getDevServerOrigin } from "./capture/metroGraph";
|
|
16
|
+
export { getLoadedFontFamilies, getLocalAssets } from "./capture/expo";
|
|
17
|
+
export { clearRecords, computeStats, estDecodedBytes, getRecord, getSnapshot, subscribe, } from "./store/assetStore";
|
|
18
|
+
export { computeInsights } from "./store/insights";
|
|
19
|
+
export { clearBaseline, computeDiff, getDiff, loadBaseline, saveBaseline, } from "./store/baseline";
|
|
20
|
+
export { useAssetRecords } from "./hooks/useAssetRecords";
|
|
21
|
+
export { formatAssetMarkdown, formatInventoryMarkdown } from "./export";
|
|
22
|
+
export { assetsSyncAdapter } from "./sync/assetsSyncAdapter";
|
|
23
|
+
export { disableAssetsCapture, replaceAssetsFromSnapshot, setRemoteAssetsHandler, } from "./remote";
|
|
24
|
+
export type { AssetsRemoteDispatch } from "./remote";
|
|
25
|
+
export type { AssetKind, AssetOrigin, AssetRecord, AssetRecordWire, AssetsBaseline, AssetsDiff, AssetsInsights, AssetsScanStatus, AssetsSnapshotPayload, AssetsStats, DuplicateInsight, } from "./types";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK9D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAKxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKvE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WAAW,EACX,SAAS,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,aAAa,EACb,WAAW,EACX,OAAO,EACP,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK1D,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAKxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD,YAAY,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-configured Assets tool for FloatingDevTools.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import { assetsToolPreset } from '@buoy-gg/assets';
|
|
7
|
+
*
|
|
8
|
+
* <FloatingDevTools apps={[assetsToolPreset]} />
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
import { AssetsModal } from "./components/AssetsModal";
|
|
12
|
+
export declare const assetsToolPreset: {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
slot: "both";
|
|
17
|
+
icon: ({ size, color }: {
|
|
18
|
+
size: number;
|
|
19
|
+
color?: string;
|
|
20
|
+
}) => import("react").JSX.Element;
|
|
21
|
+
component: typeof AssetsModal;
|
|
22
|
+
};
|
|
23
|
+
/** Create a custom Assets tool configuration. */
|
|
24
|
+
export declare function createAssetsTool(options?: {
|
|
25
|
+
name?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
}): {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
id: string;
|
|
31
|
+
slot: "both";
|
|
32
|
+
icon: ({ size, color }: {
|
|
33
|
+
size: number;
|
|
34
|
+
color?: string;
|
|
35
|
+
}) => import("react").JSX.Element;
|
|
36
|
+
component: typeof AssetsModal;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=preset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/preset.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,eAAO,MAAM,gBAAgB;;;;;4BAKH;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;CAIzD,CAAC;AAEF,iDAAiD;AACjD,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO;;;;;4BAR7B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;EAezD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote-dispatch seam for dashboard mirrors (Buoy Desktop).
|
|
3
|
+
*
|
|
4
|
+
* On device this stays null and every action runs locally. A dashboard sets
|
|
5
|
+
* a handler that forwards action name + params over external-sync to the
|
|
6
|
+
* SAME adapter actions the MCP uses (sync/assetsSyncAdapter.ts), so one
|
|
7
|
+
* action vocabulary serves phone UI, desktop UI, and LLM automation.
|
|
8
|
+
*/
|
|
9
|
+
import type { AssetsSnapshotPayload } from "./types";
|
|
10
|
+
export type AssetsRemoteDispatch = (action: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
11
|
+
export declare function setRemoteAssetsHandler(handler: AssetsRemoteDispatch | null): void;
|
|
12
|
+
export declare function remoteAssetsDispatch(): AssetsRemoteDispatch | null;
|
|
13
|
+
/** Dashboards never scan their own bundle — the store is purely a mirror. */
|
|
14
|
+
export declare function disableAssetsCapture(): void;
|
|
15
|
+
/** Replace the whole store from a synced adapter snapshot. */
|
|
16
|
+
export declare function replaceAssetsFromSnapshot(payload: AssetsSnapshotPayload): void;
|
|
17
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/remote.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,oBAAoB,GAAG,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,oBAAoB,GAAG,IAAI,GACnC,IAAI,CAEN;AAED,wBAAgB,oBAAoB,IAAI,oBAAoB,GAAG,IAAI,CAElE;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED,8DAA8D;AAC9D,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CA8B9E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global singleton state for the Assets tool.
|
|
3
|
+
*
|
|
4
|
+
* Same rationale as the images tool: the package can be evaluated as two
|
|
5
|
+
* module instances (lib vs src resolution), and the registerAsset patch must
|
|
6
|
+
* share one store with whichever copy the UI renders from. All mutable state
|
|
7
|
+
* lives on globalThis under a well-known symbol.
|
|
8
|
+
*/
|
|
9
|
+
import type { AssetRecord, AssetsBaseline, AssetsDiff, AssetsScanStatus } from "./types";
|
|
10
|
+
export interface AssetsGlobalState {
|
|
11
|
+
records: AssetRecord[];
|
|
12
|
+
byKey: Map<string, AssetRecord>;
|
|
13
|
+
byId: Map<number, AssetRecord>;
|
|
14
|
+
nextId: number;
|
|
15
|
+
listeners: Set<() => void>;
|
|
16
|
+
snapshot: AssetRecord[];
|
|
17
|
+
emitScheduled: boolean;
|
|
18
|
+
installed: boolean;
|
|
19
|
+
patched: boolean;
|
|
20
|
+
registryAvailable: boolean;
|
|
21
|
+
graphSupported: boolean;
|
|
22
|
+
graphCount: number | null;
|
|
23
|
+
graphError: string | null;
|
|
24
|
+
graphFetchInFlight: boolean;
|
|
25
|
+
lastScanAt: number | null;
|
|
26
|
+
measuring: boolean;
|
|
27
|
+
measuredCount: number;
|
|
28
|
+
fontFamilies: string[];
|
|
29
|
+
localAssetCount: number | null;
|
|
30
|
+
baseline: AssetsBaseline | null;
|
|
31
|
+
baselineLoaded: boolean;
|
|
32
|
+
captureDisabled: boolean;
|
|
33
|
+
remoteDispatch: ((action: string, params?: Record<string, unknown>) => Promise<unknown>) | null;
|
|
34
|
+
mirrorScanStatus: AssetsScanStatus | null;
|
|
35
|
+
/** Device PixelRatio adopted from a synced snapshot (scale-gap math). */
|
|
36
|
+
mirrorPixelRatio: number | null;
|
|
37
|
+
/** Device-computed diff adopted from a synced snapshot. */
|
|
38
|
+
mirrorDiff: AssetsDiff | null;
|
|
39
|
+
}
|
|
40
|
+
export declare function assetsState(): AssetsGlobalState;
|
|
41
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE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U,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B;AAID,wBAAgB,WAAW,IAAI,iBAAiB,CAiC/C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* assetStore
|
|
3
|
+
*
|
|
4
|
+
* Bounded store of AssetRecords keyed by their stable asset key
|
|
5
|
+
* (`location/name.type`). Follows the images tool's store shape — Set of
|
|
6
|
+
* listeners, frame-coalesced emit, all mutable state on the globalThis
|
|
7
|
+
* singleton (../state.ts) so dual module instances share one store.
|
|
8
|
+
*
|
|
9
|
+
* Unlike the images tool this is an INVENTORY, not an event log: upserts
|
|
10
|
+
* merge into the existing record for a key instead of appending, and there
|
|
11
|
+
* is no ring-buffer cap (a bundle has a bounded asset count by construction).
|
|
12
|
+
*/
|
|
13
|
+
import type { AssetKind, AssetRecord, AssetsStats } from "../types";
|
|
14
|
+
/** Snapshot identity only changes on emit, so useSyncExternalStore stays cheap. */
|
|
15
|
+
export declare function invalidate(): void;
|
|
16
|
+
export declare function kindForType(type: string): AssetKind;
|
|
17
|
+
export declare function assetKey(httpServerLocation: string | undefined, name: string, type: string): string;
|
|
18
|
+
export interface AssetUpsert {
|
|
19
|
+
key: string;
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
origin: AssetRecord["origin"];
|
|
23
|
+
registryId?: number;
|
|
24
|
+
hash?: string;
|
|
25
|
+
httpServerLocation?: string;
|
|
26
|
+
width?: number;
|
|
27
|
+
height?: number;
|
|
28
|
+
scales?: number[];
|
|
29
|
+
resolvedUri?: string;
|
|
30
|
+
resolvedScale?: number;
|
|
31
|
+
loaded?: boolean;
|
|
32
|
+
fileSystemLocation?: string;
|
|
33
|
+
files?: string[];
|
|
34
|
+
fileHashes?: string[];
|
|
35
|
+
}
|
|
36
|
+
/** Merge an asset sighting into the store; creates the record on first sight. */
|
|
37
|
+
export declare function upsertRecord(input: AssetUpsert): AssetRecord;
|
|
38
|
+
/** Mutate a record in place (records are owned by the store) and notify. */
|
|
39
|
+
export declare function updateRecord(id: number, patch: Partial<AssetRecord>): AssetRecord | undefined;
|
|
40
|
+
export declare function getRecord(id: number): AssetRecord | undefined;
|
|
41
|
+
export declare function getRecordByKey(key: string): AssetRecord | undefined;
|
|
42
|
+
export declare function getSnapshot(): AssetRecord[];
|
|
43
|
+
export declare function subscribe(listener: () => void): () => void;
|
|
44
|
+
export declare function clearRecords(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Estimated decoded-bitmap memory (RGBA8888) at the scale this device would
|
|
47
|
+
* pick — the size fallback when bytes can't be measured (release builds).
|
|
48
|
+
*/
|
|
49
|
+
export declare function estDecodedBytes(record: AssetRecord): number;
|
|
50
|
+
export declare function computeStats(list: AssetRecord[]): AssetsStats;
|
|
51
|
+
//# sourceMappingURL=assetStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetStore.d.ts","sourceRoot":"","sources":["../../../src/store/assetStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAYpE,mFAAmF;AACnF,wBAAgB,UAAU,IAAI,IAAI,CAIjC;AAeD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAEnD;AAED,wBAAgB,QAAQ,CACtB,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,MAAM,CAWR;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAoC5D;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAC1B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,GAC1B,WAAW,GAAG,SAAS,CAOzB;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAE7D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEnE;AAED,wBAAgB,WAAW,IAAI,WAAW,EAAE,CAE3C;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAI1D;AAED,wBAAgB,YAAY,IAAI,IAAI,CAQnC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAM3D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,WAAW,CA8B7D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Baseline diff — the regression-prevention half of the tool.
|
|
3
|
+
*
|
|
4
|
+
* "Save baseline" persists a slim {hash, size} snapshot of the inventory via
|
|
5
|
+
* shared-ui's persistentStorage (FileSystem → AsyncStorage → memory), and
|
|
6
|
+
* every later scan diffs against it: new assets, removed assets, grown
|
|
7
|
+
* assets, net bytes. Run it before and after a branch and you get "this
|
|
8
|
+
* branch added 2.3 MB" without any CI tooling.
|
|
9
|
+
*
|
|
10
|
+
* On dashboard mirrors the actions forward to the device (the baseline
|
|
11
|
+
* belongs to the app being inspected, not the dashboard) and the computed
|
|
12
|
+
* diff arrives back inside the synced snapshot.
|
|
13
|
+
*/
|
|
14
|
+
import type { AssetRecord, AssetsBaseline, AssetsDiff } from "../types";
|
|
15
|
+
/** Load the persisted baseline into state once; safe to call repeatedly. */
|
|
16
|
+
export declare function loadBaseline(): Promise<AssetsBaseline | null>;
|
|
17
|
+
export declare function saveBaseline(): Promise<AssetsBaseline>;
|
|
18
|
+
export declare function clearBaseline(): Promise<void>;
|
|
19
|
+
export declare function computeDiff(records: AssetRecord[], baseline: AssetsBaseline): AssetsDiff;
|
|
20
|
+
/** Current diff: the synced device's on mirrors, computed locally on device. */
|
|
21
|
+
export declare function getDiff(): AssetsDiff | null;
|
|
22
|
+
//# sourceMappingURL=baseline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../src/store/baseline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOxE,4EAA4E;AAC5E,wBAAsB,YAAY,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAiBnE;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,cAAc,CAAC,CA0B5D;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAenD;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,WAAW,EAAE,EACtB,QAAQ,EAAE,cAAc,GACvB,UAAU,CAkDZ;AAED,gFAAgF;AAChF,wBAAgB,OAAO,IAAI,UAAU,GAAG,IAAI,CAK3C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derived insights over the asset inventory — the Lighthouse/Emerge-style
|
|
3
|
+
* audit findings, each pointing at concrete record ids.
|
|
4
|
+
*/
|
|
5
|
+
import type { AssetRecord, AssetsInsights } from "../types";
|
|
6
|
+
export declare function computeInsights(list: AssetRecord[]): AssetsInsights;
|
|
7
|
+
//# sourceMappingURL=insights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../../src/store/insights.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAoB,MAAM,UAAU,CAAC;AA2D9E,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,cAAc,CA6EnE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync adapter for the Assets tool, consumed by @buoy-gg/external-sync's
|
|
3
|
+
* `useExternalSync` (structurally matches its ToolSyncAdapter interface so
|
|
4
|
+
* this package doesn't need a dependency on it — same pattern as images).
|
|
5
|
+
* Exposes the asset inventory to the desktop dashboard and the MCP server.
|
|
6
|
+
*/
|
|
7
|
+
import type { AssetKind, AssetRecordWire } from "../types";
|
|
8
|
+
export declare const assetsSyncAdapter: {
|
|
9
|
+
version: number;
|
|
10
|
+
getSnapshot: () => {
|
|
11
|
+
records: AssetRecordWire[];
|
|
12
|
+
stats: import("..").AssetsStats;
|
|
13
|
+
scanStatus: import("..").AssetsScanStatus;
|
|
14
|
+
insights: import("..").AssetsInsights;
|
|
15
|
+
diff: import("..").AssetsDiff | null;
|
|
16
|
+
};
|
|
17
|
+
subscribe: (onChange: () => void) => () => void;
|
|
18
|
+
actions: {
|
|
19
|
+
/** List assets, largest first. Params: { limit?, kind?, loadedOnly? }. */
|
|
20
|
+
list: (params: unknown) => {
|
|
21
|
+
total: number;
|
|
22
|
+
records: AssetRecordWire[];
|
|
23
|
+
stats: import("..").AssetsStats;
|
|
24
|
+
scanStatus: import("..").AssetsScanStatus;
|
|
25
|
+
insights: import("..").AssetsInsights;
|
|
26
|
+
diff: import("..").AssetsDiff | null;
|
|
27
|
+
};
|
|
28
|
+
/** Full detail for one asset. Params: { id }. */
|
|
29
|
+
getDetail: (params: unknown) => {
|
|
30
|
+
origin: import("..").AssetOrigin;
|
|
31
|
+
fileSystemLocation: string | null;
|
|
32
|
+
files: string[] | null;
|
|
33
|
+
sizesByScale: Record<string, number> | null;
|
|
34
|
+
estDecodedBytes: number | null;
|
|
35
|
+
id: number;
|
|
36
|
+
key: string;
|
|
37
|
+
registryId: number | null;
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
kind: AssetKind;
|
|
41
|
+
hash: string | null;
|
|
42
|
+
location: string | null;
|
|
43
|
+
width: number | null;
|
|
44
|
+
height: number | null;
|
|
45
|
+
scales: number[];
|
|
46
|
+
uri: string | null;
|
|
47
|
+
loaded: boolean;
|
|
48
|
+
sizeBytes: number | null;
|
|
49
|
+
sizeSource: "measured" | "estimate" | null;
|
|
50
|
+
};
|
|
51
|
+
/** Re-walk the registry, merge the Metro graph, refresh fonts, measure sizes. */
|
|
52
|
+
rescan: () => Promise<{
|
|
53
|
+
ok: boolean;
|
|
54
|
+
scanStatus: import("..").AssetsScanStatus;
|
|
55
|
+
}>;
|
|
56
|
+
/** (Re-)measure byte sizes from the dev server. */
|
|
57
|
+
measureSizes: () => Promise<{
|
|
58
|
+
measured: number;
|
|
59
|
+
total: number;
|
|
60
|
+
ok: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
/** Persist the current inventory as the comparison baseline. */
|
|
63
|
+
saveBaseline: () => Promise<{
|
|
64
|
+
ok: boolean;
|
|
65
|
+
savedAt: number;
|
|
66
|
+
assets: number;
|
|
67
|
+
}>;
|
|
68
|
+
/** Drop the saved baseline. */
|
|
69
|
+
clearBaseline: () => Promise<{
|
|
70
|
+
ok: boolean;
|
|
71
|
+
message: string;
|
|
72
|
+
}>;
|
|
73
|
+
/** Change vs the saved baseline (null when no baseline exists). */
|
|
74
|
+
getDiff: () => import("..").AssetsDiff | null;
|
|
75
|
+
/** Wipe the store (next rescan rebuilds it). */
|
|
76
|
+
clearRecords: () => {
|
|
77
|
+
ok: boolean;
|
|
78
|
+
message: string;
|
|
79
|
+
};
|
|
80
|
+
getScanStatus: () => import("..").AssetsScanStatus;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=assetsSyncAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetsSyncAdapter.d.ts","sourceRoot":"","sources":["../../../src/sync/assetsSyncAdapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,KAAK,EAAE,SAAS,EAAe,eAAe,EAAE,MAAM,UAAU,CAAC;AAuDxE,eAAO,MAAM,iBAAiB;;;;;;;;;0BAMN,MAAM,IAAI;;QAE9B,0EAA0E;uBAC3D,OAAO;;;;;;;;QAsBtB,iDAAiD;4BAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;QAW3B,iFAAiF;;;;;QAKjF,mDAAmD;;;;;;QAKnD,gEAAgE;;;;;;QAShE,+BAA+B;;;;;QAK/B,mEAAmE;;QAEnE,gDAAgD;;;;;;;CAOnD,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Assets tool.
|
|
3
|
+
*
|
|
4
|
+
* An AssetRecord is one bundled asset (all of its scale variants together —
|
|
5
|
+
* icon.png + icon@2x.png + icon@3x.png is ONE record, mirroring how Metro
|
|
6
|
+
* registers it). Records come from two places:
|
|
7
|
+
*
|
|
8
|
+
* - "registry": the runtime @react-native/assets-registry — assets whose
|
|
9
|
+
* module has actually been evaluated (`loaded: true`). Works in dev AND
|
|
10
|
+
* release, bare RN AND Expo.
|
|
11
|
+
* - "graph": the Metro dev server's `<entry>.assets` endpoint — every asset
|
|
12
|
+
* in the dependency graph, including ones never required at runtime.
|
|
13
|
+
* Dev-only. Graph-only records are the "shipped but never loaded" set.
|
|
14
|
+
*/
|
|
15
|
+
export type AssetKind = "image" | "font" | "video" | "audio" | "data" | "other";
|
|
16
|
+
export type AssetOrigin = "registry" | "graph";
|
|
17
|
+
export interface AssetRecord {
|
|
18
|
+
id: number;
|
|
19
|
+
/** Stable identity across sources: `${httpServerLocation}/${name}.${type}`. */
|
|
20
|
+
key: string;
|
|
21
|
+
/** Runtime asset id in @react-native/assets-registry (set once evaluated). */
|
|
22
|
+
registryId?: number;
|
|
23
|
+
name: string;
|
|
24
|
+
/** File extension without the dot (png, ttf, mp4, …). */
|
|
25
|
+
type: string;
|
|
26
|
+
kind: AssetKind;
|
|
27
|
+
/** Metro's md5 over ALL scale variants concatenated. */
|
|
28
|
+
hash?: string;
|
|
29
|
+
httpServerLocation?: string;
|
|
30
|
+
/** Logical (scale-divided) dimensions — images only. */
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
scales: number[];
|
|
34
|
+
/** resolveAssetSource().uri for this device/environment. */
|
|
35
|
+
resolvedUri?: string;
|
|
36
|
+
resolvedScale?: number;
|
|
37
|
+
/** True once the asset module was evaluated (present in the runtime registry). */
|
|
38
|
+
loaded: boolean;
|
|
39
|
+
origin: AssetOrigin;
|
|
40
|
+
/** Dev-only fields from the Metro graph (stripped from runtime records). */
|
|
41
|
+
fileSystemLocation?: string;
|
|
42
|
+
files?: string[];
|
|
43
|
+
/** Per-scale md5s (Expo graph) — the key into ExpoUpdates.localAssets. */
|
|
44
|
+
fileHashes?: string[];
|
|
45
|
+
/** Measured bytes per scale ("1", "2", …) — dev server or file system. */
|
|
46
|
+
sizesByScale?: Record<string, number>;
|
|
47
|
+
/** Total measured bytes across all scale variants. */
|
|
48
|
+
sizeBytes?: number;
|
|
49
|
+
sizeSource?: "measured" | "estimate";
|
|
50
|
+
firstSeenAt: number;
|
|
51
|
+
}
|
|
52
|
+
/** How the tool learned its inventory + what enrichment is available. */
|
|
53
|
+
export interface AssetsScanStatus {
|
|
54
|
+
registryAvailable: boolean;
|
|
55
|
+
/** registerAsset wrapper installed (live updates). */
|
|
56
|
+
patched: boolean;
|
|
57
|
+
registryCount: number;
|
|
58
|
+
/** Metro dev server reachable (graph + size measurement possible). */
|
|
59
|
+
graphSupported: boolean;
|
|
60
|
+
/** Assets in the full Metro graph; null until fetched. */
|
|
61
|
+
graphCount: number | null;
|
|
62
|
+
graphError: string | null;
|
|
63
|
+
lastScanAt: number | null;
|
|
64
|
+
measuring: boolean;
|
|
65
|
+
measuredCount: number;
|
|
66
|
+
/** Loaded font families (expo-font native module; [] when unavailable). */
|
|
67
|
+
fontFamilies: string[];
|
|
68
|
+
/** Entries in ExpoUpdates.localAssets; null when not an updates env. */
|
|
69
|
+
localAssetCount: number | null;
|
|
70
|
+
}
|
|
71
|
+
export interface AssetsStats {
|
|
72
|
+
total: number;
|
|
73
|
+
loaded: number;
|
|
74
|
+
neverLoaded: number;
|
|
75
|
+
byKind: Record<AssetKind, {
|
|
76
|
+
count: number;
|
|
77
|
+
bytes: number;
|
|
78
|
+
}>;
|
|
79
|
+
/** Sum of measured bytes only (see measuredCount for coverage). */
|
|
80
|
+
totalBytes: number;
|
|
81
|
+
measuredCount: number;
|
|
82
|
+
fontFamilies: number;
|
|
83
|
+
}
|
|
84
|
+
export interface DuplicateInsight {
|
|
85
|
+
hash: string;
|
|
86
|
+
/** Record ids sharing the hash. */
|
|
87
|
+
ids: number[];
|
|
88
|
+
/** Bytes that could be saved by deduping (null until sizes measured). */
|
|
89
|
+
wastedBytes: number | null;
|
|
90
|
+
}
|
|
91
|
+
export interface AssetsInsights {
|
|
92
|
+
duplicates: DuplicateInsight[];
|
|
93
|
+
/** Image records whose scale variants can't serve this device's PixelRatio. */
|
|
94
|
+
scaleGaps: number[];
|
|
95
|
+
/** png/jpeg records over the size threshold — WebP conversion candidates. */
|
|
96
|
+
webpCandidates: number[];
|
|
97
|
+
/** Records in the bundle graph that no runtime code ever required. */
|
|
98
|
+
neverLoaded: number[];
|
|
99
|
+
/** Images that decode to more pixels than 2× this device's entire screen. */
|
|
100
|
+
overDecode: number[];
|
|
101
|
+
/** GIFs big enough to hurt (every frame decodes into memory). */
|
|
102
|
+
heavyGifs: number[];
|
|
103
|
+
/** Font files over the icon-font-bloat threshold. */
|
|
104
|
+
heavyFonts: number[];
|
|
105
|
+
/** Scale variants whose measured bytes contradict their scale (bad export). */
|
|
106
|
+
scaleAnomalies: number[];
|
|
107
|
+
}
|
|
108
|
+
/** Persisted snapshot of the inventory for before/after comparison. */
|
|
109
|
+
export interface AssetsBaseline {
|
|
110
|
+
savedAt: number;
|
|
111
|
+
entries: Record<string, {
|
|
112
|
+
hash: string | null;
|
|
113
|
+
sizeBytes: number | null;
|
|
114
|
+
name: string;
|
|
115
|
+
type: string;
|
|
116
|
+
}>;
|
|
117
|
+
}
|
|
118
|
+
export interface AssetsDiff {
|
|
119
|
+
baselineSavedAt: number;
|
|
120
|
+
/** Current record ids not present in the baseline. */
|
|
121
|
+
added: number[];
|
|
122
|
+
/** Baseline assets no longer in the inventory. */
|
|
123
|
+
removed: Array<{
|
|
124
|
+
key: string;
|
|
125
|
+
name: string;
|
|
126
|
+
type: string;
|
|
127
|
+
}>;
|
|
128
|
+
/** Current record ids whose measured size grew ≥1 KB vs the baseline. */
|
|
129
|
+
grown: Array<{
|
|
130
|
+
id: number;
|
|
131
|
+
deltaBytes: number;
|
|
132
|
+
}>;
|
|
133
|
+
/** Sum of measured sizes now minus then; null when sizes are unmeasured. */
|
|
134
|
+
netBytes: number | null;
|
|
135
|
+
}
|
|
136
|
+
/** Slim wire form of a record (desktop dashboard + MCP). */
|
|
137
|
+
export interface AssetRecordWire {
|
|
138
|
+
id: number;
|
|
139
|
+
key: string;
|
|
140
|
+
registryId: number | null;
|
|
141
|
+
name: string;
|
|
142
|
+
type: string;
|
|
143
|
+
kind: AssetKind;
|
|
144
|
+
hash: string | null;
|
|
145
|
+
location: string | null;
|
|
146
|
+
width: number | null;
|
|
147
|
+
height: number | null;
|
|
148
|
+
scales: number[];
|
|
149
|
+
uri: string | null;
|
|
150
|
+
loaded: boolean;
|
|
151
|
+
sizeBytes: number | null;
|
|
152
|
+
sizeSource: "measured" | "estimate" | null;
|
|
153
|
+
}
|
|
154
|
+
export interface AssetsSnapshotPayload {
|
|
155
|
+
stats: AssetsStats;
|
|
156
|
+
scanStatus: AssetsScanStatus;
|
|
157
|
+
insights: AssetsInsights;
|
|
158
|
+
/** Change vs the saved baseline; null when no baseline exists. */
|
|
159
|
+
diff: AssetsDiff | null;
|
|
160
|
+
records: AssetRecordWire[];
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhF,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,4D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